User:Monster Iestyn/Sandbox 2

From SRB2 Wiki
Jump to: navigation, search

Lua Hook notes

LUAh_MobjHook is the base function for the following:

  • LUAh_MobjSpawn (MobjSpawn)
  • LUAh_MobjFuse (MobjFuse)
  • LUAh_BossThinker (BossThinker)
  • LUAh_BossDeath (BossDeath)
  • LUAh_MobjRemoved (MobjRemoved)

LUAh_PlayerHook is the base function for the following:

  • LUAh_JumpSpecial (JumpSpecial)
  • LUAh_AbilitySpecial (AbilitySpecial)
  • LUAh_SpinSpecial (SpinSpecial)
  • LUAh_JumpSpinSpecial (JumpSpinSpecial)
  • LUAh_PlayerSpawn (PlayerSpawn)
Hook Function(s) modified File location Notes
NetVars NetArchiveHook lua_script.c
MapChange Got_Mapcmd d_netcmd.c
G_DoReborn g_game.c
G_DoPlayDemo g_game.c
MapLoad P_SetupLevel p_setup.c
PlayerJoin Got_AddPlayer d_clisrv.c
ThinkFrame P_Ticker p_tick.c
P_PreTicker p_tick.c
MobjSpawn P_SpawnMobj p_mobj.c
MobjCollide PIT_CheckThing p_map.c
MobjMoveCollide PIT_CheckThing p_map.c
TouchSpecial P_TouchSpecialThing p_inter.c
MobjFuse P_MobjThinker p_mobj.c
MobjThinker P_MobjThinker p_mobj.c
BossThinker P_MobjThinker p_mobj.c
ShouldDamage P_DamageMobj p_inter.c
MobjDamage P_DamageMobj p_inter.c
MobjDeath P_KillMobj p_inter.c
BossDeath A_BossDeath p_enemy.c
MobjRemoved P_RemoveMobj p_mobj.c
JumpSpecial P_DoJumpStuff p_user.c
AbilitySpecial P_DoJumpStuff p_user.c
SpinSpecial P_DoSpinDash p_user.c
JumpSpinSpecial P_DoJumpStuff p_user.c
BotTiccmd B_BuildTiccmd b_bot.c
BotAI B_BuildTailsTiccmd b_bot.c
LinedefExecute P_ProcessLineSpecial p_spec.c
PlayerMsg Got_Saycmd hu_stuff.c
HurtMsg P_HitDeathMessages p_inter.c
PlayerSpawn G_SpawnPlayer g_game.c

MF_SPECIAL

key:

  • uses default touch behavior afterwards (plays DeathSound and calls P_KillMobj)
  • does not do the above

List of objects with special MF_SPECIAL behavior (see P_TouchSpecialThing):

  • MF_BOSS (boss objects) - damages on touch, can be damaged when player is spinning/invincible
  • MF_ENEMY (enemy objects) - damages on touch, can be damaged when player is spinning/invincible
    • MT_GSNAPPER (Green Snapper) - damages when side is touched (unless invincible)
    • MT_SHARP (Sharp) - damages when top is touched
  • MF_FIRE (fire objects) - damages on touch
  • MT_REDTEAMRING/MT_BLUETEAMRING/MT_RING/MT_FLINGRING (Ring, CTF Team Ring (Red) and CTF Team Ring (Blue)) - ring is collected on touch
  • MT_COIN/MT_FLINGCOIN (Coin) - coin is collected on touch
  • MT_BLUESPHERE (Blue sphere) - blue sphere is collected on touch
  • MT_AUTOPICKUP to MT_RAILPICKUP - panel is collected on touch
  • MT_INFINITYRING to MT_RAILRING - ammo is collected on touch
  • MT_EMMY (Special Stage Token) - token is collected on touch
  • MT_EMERHUNT (Emerald Hunt Location) - emerald is collected on touch
  • MT_EMERALD1 - MT_EMERALD7 - emerald is collected on touch
  • MT_FLINGEMERALD - flung emerald is collected on touch
  • MT_EMBLEM (Emblem) - emblem is collected on touch
  • MT_REDFLAG/MT_BLUEFLAG (CTF Red Flag/CTF Blue Flag) - if on opposite team to flag, flag is collected on touch; if on same team flag is returned to base
  • MT_NIGHTSDRONE (Ideya Drone) - turns the player into NiGHTS Super Sonic on touch
  • MT_NIGHTSLOOPHELPER (Paraloop helper) - triggers paraloop effects
  • MT_EGGCAPSULE (Ideya Capture) - player is pulled into capsule to deposit rings
  • MT_NIGHTSBUMPER (NiGHTS Bumper) - player is propelled in bumper's direction
  • MT_NIGHTSSUPERLOOP (Super Paraloop) - player is awarded the powerup on touch
  • MT_NIGHTSDRILLREFILL (Drill Refill) - player is awarded the powerup on touch
  • MT_NIGHTSHELPER (Nightopian Helper) - player is awarded the powerup on touch
  • MT_NIGHTSEXTRATIME (Extra Time) - player is awarded the powerup on touch
  • MT_NIGHTSLINKFREEZE (Link Freeze) - player is awarded the powerup on touch
  • MT_NIGHTSWING (Wing Logo) - wing logo is collected on touch
  • MT_HOOPCOLIDE (Hoop collision helper) - triggers hoop collision effects
  • MT_SHELL (Koopa Shell) - shell starts moving on touch
  • MT_AXE (Axe) - axe is collected on touch
  • MT_FIREFLOWER (Fire Flower) - player is awarded the powerup on touch
  • MT_STARPOST (Star Post) - starpost is activated on touch
  • MT_FAKEMOBILE (Sea Egg decoy) - player bounces off object on touch
  • MT_BLACKEGGMAN_GOOPFIRE (Brak Eggman (Old) goop projectile) - player is immobilized on touch
  • MT_EGGSHIELD (Egg Guard shield) - player bounces off object on touch, unless attacked from behind
  • MT_BIGTUMBLEWEED/MT_LITTLETUMBLEWEED (Tumbleweed (Big) and Tumbleweed (Small)) - Tumbleweed "bounces" off player on touch
  • MT_SMALLMACECHAIN/MT_BIGMACECHAIN (Chain (Hang)'s/Chain (Spin) chain link) - if last link in the chain, player grabs onto chain on touch
  • MT_BIGMINE/MT_BIGAIRMINE (Big Floating Mine/Big Floating Mine (Air)) - mine explodes on touch
  • MT_SPECIALSPIKEBALL (Spikeball) - damages player on touch - if in special stage only 10 rings are lost
  • MT_EGGMOBILE2_POGO (Egg Slimer pogo hitbox) - damages on touch if landing on player, and is removed
  • MT_EXTRALARGEBUBBLE (Breathable bubble from Air Bubble Patch) - player breathes bubble on touch to restore underwater timer
  • MT_WATERDROP (water drop from Dripping Water) - drop plays sound and stops moving on touch

Old version tidbits

Demo 4 music

Music for Special stage music and Christmas Hunt Zone were all from Ojamajo Doremi (not sure about Special Stage #1, which in 2.1 still exists as Tunes 51):

Final Demo and onwards music changes

1.08

  • RVZ1 added
  • Green Hill Zone added
  • Old VFZ + AGZ added
  • Invincibility theme changed
  • Speed Shoes added, using pre-1.08 Invincibility theme
  • Xmas music moved to music.dta

1.09

  • CEZ2 updated
  • RVZ1 updated
  • RMZ1 added
  • RMZ2 removed
  • Old ACZ1 added
  • Old VFZ + AGZ removed
  • Mystic Realm music added
  • Super Sonic changed
  • Emerald Quest music (Empyrean's Channel, Tails' House, Cavernous, Lazy Saturdays) added
  • Multiplayer Results added

1.09.2

  • Super Sonic changed

1.09.4

  • CEZ1 updated
  • CEZ2 updated
  • Special Stage updated
  • Old Special Stage added
  • Extra Life updated

2.0

  • ACZ1+2, ERZ1-3 added
  • Old ACZ1 updated
  • Old ACZ2 added
  • Old DSZ1 (remix) added
  • Old ERZ1 added
  • MKB3 updated
  • Emerald Quest - Cavernous updated
  • Midnight Freeze Zone updated
  • Remixes (GFZ1, DSZ2, ACZ, RVZ1) added
  • ERZ1 premix added
  • Old AGZ added
  • Old Space countdown added
  • Other tunes: "Metal Sonic" (Tunes 24), Virtual Sonic Metal Sonic theme (Tunes 25)
  • Credits updated (v2.0.5 onwards)

2.1

  • Virtual Sonic Metal Sonic theme removed
  • SRB2-ERZ_A3 added (aka Tunes 24)
  • Credits updated
  • STJr intro added

Character skins

Vanilla SRB2 S_SKINs

Attribute (Default) Sonic Tails Knuckles
name N/A sonic tails knuckles
sprite N/A PLAY TAIL KNUX
flags 0 SF_SUPER|SF_SUPERANIMS|SF_SUPERSPIN 0 0
realname Someone Sonic Tails Knuckles
hudname ??? SONIC TAILS K.T.E
charsel CHRSONIC CHRSONIC CHRTAILS CHRKNUX
face MISSING LIVSONIC LIVTAILS LIVKNUX
superface MISSING LIVSUPER N/A N/A
startcolor 160
prefcolor Green Blue Orange Red
normalspeed 36 36 32 34
runspeed 28
thrustfactor 5 5 3 4
accelstart 96 96 192 128
acceleration 40 40 50 45
ability CA_NONE CA_THOK CA_FLY CA_GLIDEANDCLIMB
ability2 CA2_SPINDASH
jumpfactor 1 1 1 0.85
actionspd 30 60 100 25
mindash 15
maxdash 90
thokitem -1 (Default, MT_THOK)
spinitem -1 (Default, MT_THOK)
revitem -1 (Default, MT_THOK)
highresscale 0.5

Vanilla Character Select Entries

(These are all recreated examples, as they are all hardcoded in reality - see m_menu.c)

Character
SkinName = sonic
Status = 1
PlayerText = ^2Sonic^0 is the fastest of the three, but also the hardest to control. Beginners beware, but experts will find Sonic very powerful.

^2Ability:^0 Speed Thok
Double jump to zoom forward with a huge burst of speed.

^2Tip:^0 Simply letting go of forward does not slow down in SRB2. To slow down, hold the opposite direction.
#

Character
SkinName = tails
Status = 1
PlayerText = ^2Tails^0 is the most mobile of the three, but has the slowest speed. Because of his mobility, he's well-
suited to beginners.

^2Ability:^0 Fly
Double jump to start flying for a limited time. Repetitively hit the jump button to ascend.

^2Tip:^0 To quickly descend while flying, hit the spin button.
#

Character
SkinName = knuckles
Status = 1
PlayerText = ^2Knuckles^0 is well-
rounded and can destroy breakable walls simply by touching them, but he can't jump as high as the other two.

^2Ability:^0 Glide & Climb
Double jump to glide in the air as long as jump is held. Glide into a wall to climb it.

^2Tip:^0 Press spin while climbing to jump off the wall; press jump instead to jump off
and face away from
the wall.
#

Character
SkinName = sonic&tails
PicName = CHRS&T
Status = 1
PlayerText = ^2Sonic & Tails^0 team up to take on Dr. Eggman!
Control Sonic while Tails desperately struggles to keep up.

Player 2 can control Tails directly by setting the controls in the options menu.
Tails's directional controls are relative to Player 1's camera.

Tails can pick up Sonic while flying and carry him around.
#

Game modifying commands/variables

All console commands/variables that actually set off the "game has been modified" trigger directly; most cheats do not fall in this category as they depend entirely on development mode being enabled to have any effect at all (by which time the game has already been modified)

Commands

Variables

Understanding bitwise operators

Let's use Object flags constants to help explain things here...

bitwise AND (&)

example value: mobj.flags = MF_SPECIAL|MF_ENEMY|MF_SHOOTABLE|MF_NOGRAVITY|MF_SLIDEME

In binary, mobj.flags has a value of 10000000000101000000101

This makes more sense if we turn this sideways, and place the object flags by their corresponding bits:

MF_SPECIAL         1
MF_SOLID           0
MF_SHOOTABLE       1
MF_NOSECTOR        0
MF_NOBLOCKMAP      0
MF_AMBUSH          0
MF_PUSHABLE        0
MF_BOSS            0
MF_SPAWNCEILING    0
MF_NOGRAVITY       1
MF_AMBIENT         0
MF_SLIDEME         1
MF_NOCLIP          0
MF_FLOAT           0
MF_BOXICON         0
MF_MISSILE         0
MF_SPRING          0
MF_BOUNCE          0
MF_MONITOR         0
MF_NOTHINK         0
MF_FIRE            0
MF_NOCLIPHEIGHT    0
MF_ENEMY           1
MF_SCENERY         0
MF_PAIN            0
MF_STICKY          0
MF_NIGHTSITEM      0
MF_NOCLIPTHING     0
MF_GRENADEBOUNCE   0
MF_RUNSPAWNFUNC    0

let's say we want to check if mobj.flags has MF_ENEMY or not

so typically we use "mobj.flags & MF_ENEMY" to do this

since we already know mobj.flags has MF_ENEMY, this means mobj.flags & MF_ENEMY actually gives us the value of MF_ENEMY!

why does it do this, you wonder? see, what "mobj.flags & MF_ENEMY" actually does in terms of binary is the following:

               mobj.flags    &   MF_ENEMY    ->      result

MF_SPECIAL         1                 0                 0
MF_SOLID           0                 0                 0
MF_SHOOTABLE       1                 0                 0
MF_NOSECTOR        0                 0                 0
MF_NOBLOCKMAP      0                 0                 0
MF_AMBUSH          0                 0                 0
MF_PUSHABLE        0                 0                 0
MF_BOSS            0                 0                 0
MF_SPAWNCEILING    0                 0                 0
MF_NOGRAVITY       1                 0                 0
MF_AMBIENT         0                 0                 0
MF_SLIDEME         1                 0                 0
MF_NOCLIP          0                 0                 0
MF_FLOAT           0                 0                 0
MF_BOXICON         0                 0                 0
MF_MISSILE         0                 0                 0
MF_SPRING          0                 0                 0
MF_BOUNCE          0                 0                 0
MF_MONITOR         0                 0                 0
MF_NOTHINK         0                 0                 0
MF_FIRE            0                 0                 0
MF_NOCLIPHEIGHT    0                 0                 0
MF_ENEMY        >  1              >  1              >  1
MF_SCENERY         0                 0                 0
MF_PAIN            0                 0                 0
MF_STICKY          0                 0                 0
MF_NIGHTSITEM      0                 0                 0
MF_NOCLIPTHING     0                 0                 0
MF_GRENADEBOUNCE   0                 0                 0
MF_RUNSPAWNFUNC    0                 0                 0

MF_ENEMY only turns on one bit, and since mobj.flags has that bit, the whole operation results in only the value of that bit

if mobj.flags DIDN'T have a particular flag, say for instance we did "mobj.flags & MF_BOUNCE", the result would be 0:

               mobj.flags    &   MF_BOUNCE   ->      result

MF_SPECIAL         1                 0                 0
MF_SOLID           0                 0                 0
MF_SHOOTABLE       1                 0                 0
MF_NOSECTOR        0                 0                 0
MF_NOBLOCKMAP      0                 0                 0
MF_AMBUSH          0                 0                 0
MF_PUSHABLE        0                 0                 0
MF_BOSS            0                 0                 0
MF_SPAWNCEILING    0                 0                 0
MF_NOGRAVITY       1                 0                 0
MF_AMBIENT         0                 0                 0
MF_SLIDEME         1                 0                 0
MF_NOCLIP          0                 0                 0
MF_FLOAT           0                 0                 0
MF_BOXICON         0                 0                 0
MF_MISSILE         0                 0                 0
MF_SPRING          0                 0                 0
MF_BOUNCE       >  0              >  1              >  0
MF_MONITOR         0                 0                 0
MF_NOTHINK         0                 0                 0
MF_FIRE            0                 0                 0
MF_NOCLIPHEIGHT    0                 0                 0
MF_ENEMY           1                 0                 0
MF_SCENERY         0                 0                 0
MF_PAIN            0                 0                 0
MF_STICKY          0                 0                 0
MF_NIGHTSITEM      0                 0                 0
MF_NOCLIPTHING     0                 0                 0
MF_GRENADEBOUNCE   0                 0                 0
MF_RUNSPAWNFUNC    0                 0                 0

now, if we use & with multiple flags at once, e.g.: "mobj.flags & (MF_NOGRAVITY|MF_SLIDEME)", we get the following:

               mobj.flags    &   (MF_NOGRAVITY|MF_SLIDEME)      ->      result

MF_SPECIAL         1                 0                                    0
MF_SOLID           0                 0                                    0
MF_SHOOTABLE       1                 0                                    0
MF_NOSECTOR        0                 0                                    0
MF_NOBLOCKMAP      0                 0                                    0
MF_AMBUSH          0                 0                                    0
MF_PUSHABLE        0                 0                                    0
MF_BOSS            0                 0                                    0
MF_SPAWNCEILING    0                 0                                    0
MF_NOGRAVITY    >  1              >  1                                 >  1
MF_AMBIENT         0                 0                                    0
MF_SLIDEME      >  1              >  1                                 >  1
MF_NOCLIP          0                 0                                    0
MF_FLOAT           0                 0                                    0
MF_BOXICON         0                 0                                    0
MF_MISSILE         0                 0                                    0
MF_SPRING          0                 0                                    0
MF_BOUNCE          0                 0                                    0
MF_MONITOR         0                 0                                    0
MF_NOTHINK         0                 0                                    0
MF_FIRE            0                 0                                    0
MF_NOCLIPHEIGHT    0                 0                                    0
MF_ENEMY           1                 0                                    0
MF_SCENERY         0                 0                                    0
MF_PAIN            0                 0                                    0
MF_STICKY          0                 0                                    0
MF_NIGHTSITEM      0                 0                                    0
MF_NOCLIPTHING     0                 0                                    0
MF_GRENADEBOUNCE   0                 0                                    0
MF_RUNSPAWNFUNC    0                 0                                    0

here the result is the value of MF_NOGRAVITY and MF_SLIDEME combined, since they were BOTH present in mobj.flags

here's another example, "mobj.flags & (MF_SHOOTABLE|MF_MISSILE)". This gives the following:

               mobj.flags    &   (MF_SHOOTABLE|MF_MISSILE)      ->      result

MF_SPECIAL         1                 0                                    0
MF_SOLID           0                 0                                    0
MF_SHOOTABLE    >  1              >  1                                 >  1
MF_NOSECTOR        0                 0                                    0
MF_NOBLOCKMAP      0                 0                                    0
MF_AMBUSH          0                 0                                    0
MF_PUSHABLE        0                 0                                    0
MF_BOSS            0                 0                                    0
MF_SPAWNCEILING    0                 0                                    0
MF_NOGRAVITY       1                 0                                    0
MF_AMBIENT         0                 0                                    0
MF_SLIDEME         1                 0                                    0
MF_NOCLIP          0                 0                                    0
MF_FLOAT           0                 0                                    0
MF_BOXICON         0                 0                                    0
MF_MISSILE      >  0              >  1                                 >  0
MF_SPRING          0                 0                                    0
MF_BOUNCE          0                 0                                    0
MF_MONITOR         0                 0                                    0
MF_NOTHINK         0                 0                                    0
MF_FIRE            0                 0                                    0
MF_NOCLIPHEIGHT    0                 0                                    0
MF_ENEMY           1                 0                                    0
MF_SCENERY         0                 0                                    0
MF_PAIN            0                 0                                    0
MF_STICKY          0                 0                                    0
MF_NIGHTSITEM      0                 0                                    0
MF_NOCLIPTHING     0                 0                                    0
MF_GRENADEBOUNCE   0                 0                                    0
MF_RUNSPAWNFUNC    0                 0                                    0

mobj.flags has MF_SHOOTABLE but NOT MF_MISSILE, so the result gives only the value of MF_SHOOTABLE

this is very important to note, as this means when using & with multiple flags, the result differs depending on which of flags are present in mobj.flags

Real version numbers

From Demo 1 to the Final Demo releases a different versioning system was in place to what the SRB2 versions were released as to the public. Until v1.08 these versions were displayed on the title bar of the SRB2 window (if playing in windowed mode):

Version name Real version number
Demo 1 v0.25
Demo 2 v0.5
Demo 3 v0.6
Demo 4 to 4.1 v0.6
Demo 4.35 v0.65
SRB2 2k3 v0.70
v1.01 to v1.04 v0.70
v1.08 v0.70? (from source code)
v1.09 to v1.09.4 unknown

From 2.0 onwards this different versioning system was discarded in favour of the current 2.X version numbers, while the Demo and Final Demo versions were retroactively designated as 0.X and 1.X.