SMBX Player Offsets
Jump to navigation
Jump to search
This is the internal player structure of the SMBX game.
The C structure
This is the binary-compatible structure for the player made from the original SMBX code.
Note: All SMBX structures must have the 4 bytes field alignment, therefore between some fields you may notice the padding appearance.
typedef short VBBool;
#define VBTRUE -1
#define VBFALSE 0
#pragma pack(push, 4)
typedef struct
{
VBBool Up;
VBBool Down;
VBBool Left;
VBBool Right;
VBBool Jump;
VBBool AltJump;
VBBool Run;
VBBool AltRun;
VBBool Drop;
VBBool Start;
} Controls_t;
typedef struct
{
double X;
double Y;
double Height;
double Width;
double SpeedX;
double SpeedY;
} Location_t;
typedef struct
{
short DoubleJump;
VBBool FlySparks;
VBBool Driving;
short Quicksand;
short Bombs;
VBBool Slippy;
VBBool Fairy;
short FairyCD;
short FairyTime;
VBBool HasKey;
short SwordPoke;
short Hearts;
VBBool CanFloat;
VBBool FloatRelease;
short FloatTime;
float FloatSpeed;
short FloatDir;
short GrabTime; // how long the player has been trying to grab an npc from above
float GrabSpeed;
double VineNPC; // the NPC that the player is climbing
short Wet; // weather or not the player is under water
VBBool WetFrame; // true if the play should be swimming
short SwimCount; // cool down between swim strokes
short NoGravity;
VBBool Slide; // true if the player is sliding
VBBool SlideKill; // true if the player is sliding fast enough to kill an NPC
short Vine; // greater then 0 if the player is climbing
short NoShellKick; // dont kick a shell
VBBool ShellSurf; // true if surfing a shell
short StateNPC;
short Slope; // the block that the player is standing on when on a slope
VBBool Stoned; // true of a statue form (tanooki suit)
short StonedCD; // delay before going back in to stone form
short StonedTime; // how long the player can remain as a statue
VBBool SpinJump; // true if spin jumping
short SpinFrame; // frame for spinning
short SpinFireDir; // for shooting fireballs while spin jumping
short Multiplier; // for score increase for multiple hops
short SlideCounter; // for creating the dust effect when sliding
short ShowWarp;
VBBool GroundPound; // for purple yoshi pound
VBBool GroundPound2; // for purple yoshi pound
VBBool CanPound; // for purple yoshi pound
short ForceHold; // force the player to hold an item for a specific amount of time
// yoshi powers
VBBool YoshiYellow;
VBBool YoshiBlue;
VBBool YoshiRed;
short YoshiWingsFrame;
short YoshiWingsFrameCount;
// yoshi graphic display
short YoshiTX;
short YoshiTY;
short YoshiTFrame;
short YoshiTFrameCount;
short YoshiBX;
short YoshiBY;
short YoshiBFrame;
short YoshiBFrameCount;
Location_t YoshiTongue;
float YoshiTongueX;
short YoshiTongueLength; // length of yoshi's tongue
VBBool YoshiTonugeBool;
short YoshiNPC; // the NPC that is in yoshi's mouth
short YoshiPlayer; // the player that is in yoshi's mouth
short Dismount; // delay before you can remount
short NoPlayerCol;
Location_t Location; // collision detection info
short Character; // luigi or mario
Controls_t Controls; // players controls
short Direction; // the way the player is facing
short Mount; // 1 for boot, 2 for clown car, 3 for yoshi
short MountType; // for different types of mounts. blue yoshi, red yoshi, etc
short MountSpecial;
short MountOffsetY;
short MountFrame; // GFX frame for the player's mount
short State; // 1 for small mario, 2 for super, 3 for fire, 4 for racoon, 5 for tanooki, 6 for hammer
short Frame;
float FrameCount;
short Jump; // how long the player can jump for
VBBool CanJump; // true if the player can jump
VBBool CanAltJump; // true if the player can alt jump
short Effect; // for various effects like shrinking/growing/warping
double Effect2; // counter for the effects
VBBool DuckRelease;
VBBool Duck; // true if ducking
VBBool DropRelease;
VBBool StandUp; // aid with collision detection after ducking
VBBool StandUp2;
VBBool Bumped; // true if hit by another player
float Bumped2;
VBBool Dead; // true if dead
short TimeToLive; // for returning to the other play after dying
short Immune; // greater then 0 if immune, this is a counter
VBBool Immune2; // makes the player blink
VBBool ForceHitSpot3; // force hitspot 3 for collision detection
// for getting smashed by a block
short Pinched1;
short Pinched2;
short Pinched3;
short Pinched4;
short NPCPinched; // must be > 0 for the player to get crushed
float m2Speed;
short HoldingNPC; // What NPC is being held
VBBool CanGrabNPCs; // If the player can grab NPCs
short HeldBonus; // the NPC that is in the player's container
short Section; // What section of the level the player is in
short WarpCD; // delay before allowing the player to warp again
short Warp; // the warp the player is using
short FireBallCD; // How long the player has to wait before he can shoot again
short FireBallCD2; // How long the player has to wait before he can shoot again
short TailCount; // Used for the tail swipe
float RunCount; // To find how long the player has ran for
VBBool CanFly; // If the player can fly
VBBool CanFly2;
short FlyCount; // length of time the player can fly
VBBool RunRelease; // The player let go of run and pressed again
VBBool JumpRelease; // The player let go of run and pressed again
short StandingOnNPC; // The NPC the player is standing on
short StandingOnTempNPC; // The NPC the player is standing on
VBBool UnStart; // Player let go of the start button
float mountBump; // Player hit something while in a mount
float SpeedFixY;
} Player_t;
#pragma pack(pop)
Memory map and explanation
This is the memory map for the player struct made in the 2015'th year. This struct originally was not fully analyzed originally, however, you can use the C structure above to get more accurate information.
| PC Memory (0x184 bytes) | |||
|---|---|---|---|
| Name | Memory address | Memory type | Description |
| Toad doublejump | PC+0x00 | FIELD_BOOL | Toad doublejump ready (FFFF true) |
| Star sparkle effect | PC+0x02 | FIELD_BOOL | Star sparkling effect on player |
| Using airship vehicle | PC+0x04 | FIELD_BOOL | Whether or not the player is using the unfinished airship vehicle NPC. Forcing to true results in disabling horizontal movement and ducking. Setting to '1' as 'FIELD_WORD' can result in only disabling ducking. |
| In quicksand | PC+0x06 | FIELD_WORD | Whether or not the player is in quicksand. |
| Link bomb count | PC+0x08 | FIELD_WORD | Number of bombs Link has in his inventory. |
| Slippery physics | PC+0x0A | FIELD_BOOL | Is on slippery ground |
| Link Content Below | |||
| Is fairy | PC+0x0C | FIELD_BOOL | Is a fairy |
| Fairy jump | PC+0x0E | FIELD_WORD | Fairy already used this jump |
| Fairy time left | PC+0x10 | FIELD_WORD | Frames until fairy runs out |
| Link has key | PC+0x12 | FIELD_BOOL | Link has a key |
| Link slash timer | PC+0x14 | FIELD_WORD | Link slash cooldown timer |
| Health | PC+0x16 | FIELD_WORD | # of hearts (all characters) |
| Peach Content Below | |||
| Peach can hover | PC+0x18 | FIELD_BOOL | Princess hover is available |
| Jump button flag | PC+0x1A | FIELD_BOOL | Holding jump button (labelled as 'FloatRelease' in source code? Most likely is used somewhere in releasing Peach's hover.) |
| Princess hover timer | PC+0x1C | FIELD_WORD | Princess hover timer |
| Padding | PC+0x1E | 2 bytes | |
| Peach hover y-speed | PC+0x20 | FIELD_FLOAT | Princess hover Y tremble speed |
| Peach hover | PC+0x24 | FIELD_WORD | Princess hover Y tremble direction |
| Situation/Action Content Below | |||
| Grass pull timer | PC+0x26 | FIELD_WORD | Ground item pull-up timer |
| Grass pull saved momentum | PC+0x28 | FIELD_FLOAT | Ground item pull-up momentum save |
| Padding | PC+0x2A | 2 bytes | |
| Climbed NPC index | PC+0x2C | FIELD_DFLOAT | Index of NPC currently being climbed on (-1 if climbing on a net bgo) (Note: does not reset after jumping off. Using 0x40 for checking climbing state.) |
| Water physics | PC+0x34 | FIELD_WORD | 2 when in water or quicksand; can be used to force the player into an underwater state |
| Underwater flag | PC+0x36 | FIELD_BOOL | Is underwater |
| Water stroke timer | PC+0x38 | FIELD_WORD | Water stroke timer (can't stroke again until 0) |
| No Gravity (?) | PC+0x3A | FIELD_WORD | When forced to a value over zero, seemingly causes the player to not be affected by gravity. Possibly used for special states like Peach hover. |
| Sliding flag | PC+0x3C | FIELD_BOOL | Is sliding |
| Sliding dust flag | PC+0x3E | FIELD_BOOL | Is generating sliding dust puffs |
| Climbing state | PC+0x40 | FIELD_WORD | Climbing state (3 climbing, 2 pushed up against edge of climbable area) |
| Unknown | PC+0x42 | FIELD_WORD | Labelled as 'NoShellKick' in source code, seemingly has no effect? |
| Rainbow rider flag | PC+0x44 | FIELD_BOOL | Flag for riding a rainbow shell |
| Powerup ID | PC+0x46 | FIELD_WORD | ID of the NPC used to reach current powerup state |
| Index of slope stood on | PC+0x48 | FIELD_WORD | Index of the slope that the player is standing on in the block array, or 0 for not standing on a slope. |
| Tanooki Suit Content Below | |||
| Statue flag | PC+0x4A | FIELD_BOOL | Tanooki suit statue flag |
| Statue cooldown timer | PC+0x4C | FIELD_WORD | Frames left before you can transform into a statue again |
| Statue timer | PC+0x4E | FIELD_WORD | Frames spent as statue |
| Spin jump Content Below | |||
| Spinjump flag | PC+0x50 | FIELD_BOOL | Spinjump flag |
| Spinjump animation timer | PC+0x52 | FIELD_WORD | Timer used for the animation of the spinjump |
| Spinjump direction | PC+0x54 | FIELD_WORD | The direction that the player was facing before spinjumping (used for shooting fireballs while spinjumping) |
| Misc Content Below | |||
| Kill combo | PC+0x56 | FIELD_WORD | Current enemy kill combo count |
| Sliding dust timer | PC+0x58 | FIELD_WORD | Timer used to spawn sliding puff effects |
| Warp index | PC+0x5A | FIELD_WORD | Index/id of an intersecting warp entrance |
| Mount Content Below | |||
| GroundPound | PC+0x5C | FIELD_BOOL | Purple Yoshi pound stage. |
| GroundPound2 | PC+0x5E | FIELD_BOOL | Purple Yoshi pound stage. |
| Can Groundpound | PC+0x60 | FIELD_BOOL | Whether or not the player can groundpound when using a purple yoshi. |
| Force Hold Timer | PC+0x62 | FIELD_WORD | Automatic holding timer for npcs; used by held item cheats and menu screen characters. |
| Yoshi stomp flag | PC+0x64 | FIELD_BOOL | Yoshi has earthquake stomp (yellow shell) |
| Yoshi flight flag | PC+0x66 | FIELD_BOOL | Yoshi has flight/wings (blue shell) |
| Yoshi flame flag | PC+0x68 | FIELD_BOOL | Yoshi has fire breath (red shell) |
| Wings animation state | PC+0x6A | FIELD_WORD | Wings' current frame (Yoshi and Kuribo's Shoe)) |
| Wings animation timer | PC+0x6C | FIELD_WORD | Wings' animation timer (Yoshi and Kuribo's Shoe) |
| Yoshi head x-offset | PC+0x6E | FIELD_WORD | Yoshi head's x-offset |
| Yoshi head y-offset | PC+0x70 | FIELD_WORD | Yoshi head's y-offset |
| Yoshi head animation state | PC+0x72 | FIELD_WORD | Yoshi head's animation state (0-4 is left, 5-9 is right) |
| Yoshi swallow timer | PC+0x74 | FIELD_WORD | Yoshi swallow timer (not tongue, but swallowing) |
| Unknown | PC+0x76 | FIELD_WORD | Baby-Yoshi offset X |
| Unknown | PC+0x78 | FIELD_WORD | Baby-Yoshi offset Y |
| Yoshi body animation state | PC+0x7A | FIELD_WORD | Yoshi body's animation frame (0-6 is left, 7-13 is right) |
| Yoshi animation timer | PC+0x7C | FIELD_WORD | Yoshi animation frame timer (rapidly increments from 0 to 32, freezes in the air, resets to 0 when pressing down; probably used to to move body and head with the animation) |
| Padding | PC+0x7E | 2 bytes | |
| Tongue x | PC+0x80 | FIELD_DFLOAT | Tongue x-position |
| Tongue y | PC+0x88 | FIELD_DFLOAT | Tongue y-position |
| Tongue width | PC+0x90 | FIELD_DFLOAT | Tongue Width |
| Tongue height | PC+0x98 | FIELD_DFLOAT | Tongue Height |
| Unknown | PC+0xA0 | FIELD_DFLOAT | Tongue SpeedX (Unused) |
| Unknown | PC+0xA8 | FIELD_DFLOAT | Tongue SpeedY (Unused) |
| Tongue x start/end | PC+0xB0 | FIELD_FLOAT | Tongue x-start/end position |
| Tongue x offset | PC+0xB4 | FIELD_WORD | Tongue x-offset from start/end |
| Tongue retracting flag | PC+0xB6 | FIELD_BOOL | Whether tongue is retracting |
| Tongue contained NPC index | PC+0xB8 | FIELD_WORD | Index of NPC currently on the tongue (0 if no NPC) |
| Tounge player index | PC+0xBA | FIELD_WORD | Index of the player on yoshi's tongue/in yoshi's mouth. |
| Mounting cooldown | PC+0xBC | FIELD_WORD | Time until the player is able to reenter a mount. |
| NoPlayerCol | PC+0xBE | FIELD_WORD | No player collision |
| Position Content Below | |||
| Player x | PC+0xC0 | FIELD_DFLOAT | Player x position (absolute coordinates within level) |
| Player y | PC+0xC8 | FIELD_DFLOAT | Player y position (absolute coordinates within level) |
| Player height | PC+0xD0 | FIELD_DFLOAT | Player height or hitbox related |
| Player width | PC+0xD8 | FIELD_DFLOAT | Player width or hitbox related |
| Player x-speed | PC+0xE0 | FIELD_DFLOAT | Player x speed |
| Player y-speed | PC+0xE8 | FIELD_DFLOAT | Player y speed |
| Character | PC+0xF0 | FIELD_WORD | Player identity index: 0: Nothing! Don't use 1: Mario/Demo 2: Luigi/Iris 3: Peach/Princess 4: Toad 5: Link/Sheath) |
| Input Content Below | |||
| U key pressing | PC+0xF2 | FIELD_BOOL | Pressing up key |
| D key pressing | PC+0xF4 | FIELD_BOOL | Pressing down key |
| L key pressing | PC+0xF6 | FIELD_BOOL | Pressing left key |
| R key pressing | PC+0xF8 | FIELD_BOOL | Pressing right key |
| J key pressing | PC+0xFA | FIELD_BOOL | Pressing jump key |
| SJ key pressing | PC+0xFC | FIELD_BOOL | Pressing spin jump key |
| R key pressing | PC+0xFE | FIELD_BOOL | Pressing run key |
| R or AR key pressing | PC+0x100 | FIELD_BOOL | Pressing run or alt run key |
| SEL key pressing | PC+0x102 | FIELD_BOOL | Pressing select key |
| SRT key pressing | PC+0x104 | FIELD_BOOL | Pressing start key |
| Direction facing | PC+0x106 | FIELD_WORD | Direction faced (-1 left, 1 right) |
| Mount Content Below | |||
| Mount identity | PC+0x108 | FIELD_WORD | Mount identity (0 no mount, 1 boot, 2 clowncar, 3 yoshi) |
| Mount color | PC+0x10A | FIELD_WORD | Mount color/variant |
| Multi-purpose flag | PC+0x10C | FIELD_WORD | Yoshi: Whether Yoshi's tongue is out. Shoes: Whether player is able to jump while hopping |
| MountOffsetY | PC+0x10E | FIELD_WORD | Yoshi: Y offset. Shoes: Turns 0 when ducking, goes 5 from -6 and its value is related with player Y speed. May be the shoe hopping velocity. |
| Shoe/clown car animation state | PC+0x110 | FIELD_WORD | Current frame for shoe and clown car |
| State Content Below | |||
| Powerup | PC+0x112 | FIELD_WORD | Current powerup |
| Player animation frame index | PC+0x114 | FIELD_WORD | Current player sprite index being displayed. Chart for values |
| Padding | PC+0x116 | 2 bytes | |
| Frame count | PC+0x118 | FIELD_FLOAT | X momentum assumption (used when determining how to draw the sprite) |
| Jump force | PC+0x11C | FIELD_WORD | Current upward jumping force (2 byte integer representation) |
| Can jump | PC+0x11E | FIELD_BOOL | Used to stop the player jumping when holding the jump button. |
| Can spinjump | PC+0x120 | FIELD_BOOL | Used to stop the player spinjumping when holding the spinjump button. |
| Forced animation state | PC+0x122 | FIELD_WORD | Forced animation state: 1: Powering up to "Big" state 2: Powering down to "Small" state 3: Entering a pipe (Crashes if no valid target warp is provided) 4: Powering up to "Fire Flower" state 5: Powering up to "Leaf" state 6: Respawning in 2-Player mode (Careful with this one) 7: Entering a door (Crashes if no valid target warp is provided) 8: Invisible/Immobile/Intangible state (Turning into a fairy or a different character) 9: On another player's Yoshi's tongue 10: In another player's Yoshi's mouth 11: Powering up to "Tanooki" state 12: Powering up to "Hammer" state 41: Powering up to "Ice Flower" state 227: Powering down from "Fire Flower" state with 3 hearts to "Big" state 228: Powering down from "Ice Flower" state with 3 hearts to "Big" state 500: Tanooki Statue poof state |
| Forced animation timer | PC+0x124 | FIELD_DFLOAT | Forced animation timer |
| DuckRelease | PC+0x12C | FIELD_BOOL | Duck release |
| Duck flag | PC+0x12E | FIELD_BOOL | In ducking state |
| DropRelease | PC+0x130 | FIELD_BOOL | Select button mirror (redundant? Marked for unknown use) |
| Invincibility flag | PC+0x132 | FIELD_BOOL | True when the invincibility frames end after collecting a powerup. |
| Down button pressed flag | PC+0x134 | FIELD_BOOL | Down button pressed this frame (reset next frame) |
| Spit from Yoshi flag | PC+0x136 | FIELD_BOOL | Was spit out of Yoshi's mouth |
| X-speed push | PC+0x138 | FIELD_FLOAT | X momentum push (eg. pushed by a bully) |
| Player dead flag | PC+0x13C | FIELD_BOOL | Player death state |
| Player death animation timer | PC+0x13E | FIELD_WORD | Player death animation timer |
| Invincibility frames timer | PC+0x140 | FIELD_WORD | Invincibility frames timer (Decrements from 50 (powerup get) or 150 (hurt) back to 0; player is invulnerable when this is > 0.) |
| Invincibility frames state | PC+0x142 | FIELD_BOOL | Invincibility frames state (flickers between true and false, dictates player visibility. If used correctly in onDraw(), can be used to make player invisible) |
| ForceHitSpot3 | PC+0x144 | FIELD_BOOL | Force hitspot 3 for collision detection for getting smashed by a block. |
| Collision Content Below | |||
| Bottom state | PC+0x146 | FIELD_WORD | Bottom state (0 not on the ground, standing on sprite, during power-up/power-down and foot contact with a slope, 2 foot contact with a solid layer) |
| Left state | PC+0x148 | FIELD_WORD | Left state (0 no left contact, 1 half or pushed back by a solid layer, 2 pushing against layer) |
| Top state | PC+0x14A | FIELD_WORD | Top state (0 no top contact, 1 half or pushed back by a solid layer, 2 pushing against layer) |
| Right state | PC+0x14C | FIELD_WORD | Right state (0 no right contact, 1 half or pushed back by a solid layer, 2 pushing against layer) |
| Layer push | PC+0x14E | FIELD_WORD | Pushed by a moving layer (0 not pushed by any, 2 being pushed to the left or right) |
| Unknown | PC+0x150 | FIELD_WORD | Unknown/Unused? |
| Unknown | PC+0x152 | FIELD_WORD | Unknown/Unused? |
| Grab Content Below | |||
| Holding sprite index | PC+0x154 | FIELD_WORD | Index of sprite being held (index to a specific sprite object that was generated only, -1 can't carry anything) |
| Can grab | PC+0x156 | FIELD_BOOL | Whether or not the player can grab anything |
| Section Content Below | |||
| Reserve box contents (?) | PC+0x158 | FIELD_WORD | Reserve box contents (0 is no item) |
| Section | PC+0x15A | FIELD_WORD | Current section |
| Warp timer | PC+0x15C | FIELD_WORD | Warp cooldown timer (can't warp / pipe until 0) |
| Exit warp index | PC+0x15E | FIELD_WORD | Target warp exit index/id (not reset after warping) |
| Projectile Content Below | |||
| Projectile timer | PC+0x160 | FIELD_WORD | Projectile timer (fireballs, hammers, link slash..) |
| Link projectile timer | PC+0x162 | FIELD_WORD | Projectile timer 2 (link projectiles) |
| Tail swipe timer | PC+0x164 | FIELD_WORD | Tail swipe timer |
| Unknown | PC+0x166 | FIELD_WORD | Unknown/Unused? |
| Flight Content Below | |||
| Takeoff speed threshold | PC+0x168 | FIELD_FLOAT | Run speed aggregate until flight achievable |
| Can fly | PC+0x16C | FIELD_BOOL | Can fly |
| Flight flag | PC+0x16E | FIELD_BOOL | Is flying |
| Flight time | PC+0x170 | FIELD_WORD | Flight time remaining |
| Flight run button flag | PC+0x172 | FIELD_BOOL | Holding flight run button |
| Fly button flag | PC+0x174 | FIELD_BOOL | Holding flight button |
| Misc Content Below | |||
| Standing NPC index | PC+0x176 | FIELD_WORD | Index of sprite being stood on (stores the index into the NPC array + 1. 0 when not standing on an NPC) |
| Unknown | PC+0x178 | FIELD_WORD | Unknown X momentum with sprites |
| Unknown | PC+0x17A | FIELD_BOOL | Usually forced to true |
| Unknown Content Below | |||
| Unknown | PC+0x17C | FIELD_WORD | Unknown/Unused? |
| Unknown | PC+0x17E | FIELD_WORD | Unknown/Unused? |
| Unknown | PC+0x180 | FIELD_WORD | Unknown/Unused? |
| Unknown | PC+0x182 | FIELD_WORD | Unknown/Unused? |
| Unknown | PC+0x184 | FIELD_WORD | Unknown/Unused? |