HP: Difference between revisions

Jump to navigation Jump to search
108 bytes added ,  27 March 2023
m
Misc edits
m (Bolding title in lead)
m (Misc edits)
 
Line 4: Line 4:
The variable that represents Mario’s HP is a short, which ranges from 0 to 2176 (or 0x0000 to 0x0880 in hexadecimal). Specifically, the upper byte represents how many full sectors of health Mario has, and the lower byte represents what portion of the next sector Mario has. Thus, one sector is equivalent to 256 HP units. The number of sectors displayed is the truncated version of the actual number of sectors. The maximum health is 2176 HP units (8.5 sectors). Mario will die if he goes below 256 HP units (1 sector).
The variable that represents Mario’s HP is a short, which ranges from 0 to 2176 (or 0x0000 to 0x0880 in hexadecimal). Specifically, the upper byte represents how many full sectors of health Mario has, and the lower byte represents what portion of the next sector Mario has. Thus, one sector is equivalent to 256 HP units. The number of sectors displayed is the truncated version of the actual number of sectors. The maximum health is 2176 HP units (8.5 sectors). Mario will die if he goes below 256 HP units (1 sector).


The HP short is signed, so even if there was a way to push it below 0, it would not wrap around to 65535. Instead, you'd have to push it below -32768 to wrap it around to 32767. Of course, if HP is above 2176, it will just get set to 2176.  
The HP variable is signed, so even if there was a way to push it below 0, it would not wrap around to 65535. Instead, the value would have to be pushed below -32768 to wrap it around to 32767. However, if HP is above 2176, it will just get set to 2176.  


== INC and DEC ==
== INC and DEC ==
There are two bytes related to health: the increase counter and the decrease counter. When Mario gains or loses an integer number of health sectors, it’s these counters that manage that. Specifically, these counters specify how many increments of 64 HP units (one quarter sector) Mario should gain or lose. For example, if Mario touches a [[Goomba|goomba]], the decrease counter increases to 4. Thus, over the next 4 frames, Mario will lose 64 HP units on each frame, resulting in one full health sector lost.
There are two bytes related to health: the increase counter and the decrease counter. When Mario gains or loses an integer number of health sectors, it’s these counters that manage that. Specifically, these counters specify how many increments of 64 HP units (one quarter sector) Mario should gain or lose. For example, if Mario touches a [[Goomba|goomba]], the decrease counter increases to 4. Thus, over the next 4 frames, Mario will lose 64 HP units on each frame, resulting in one full health sector lost.


Once Mario's HP goes below 256 (1 sector), then he's dead, and there's no way to restore HP at that point. Mario can still collect [[Coin|coins]] to increase the INC counter, but the INC and DEC counters no longer function. For example, if you have 255 HP and collect a yellow coin, then INC will increase from 0 to 4, but it will just stay at 4 while Mario does the dying animation.  
Once Mario's HP goes below 256 (1 sector), then he's dead, and there's no way to restore HP at that point. Mario can still collect [[Coin|coins]] to increase the INC counter, but the INC and DEC counters no longer function. For example, if Mario has 255 HP and collects a yellow coin, then INC will increase from 0 to 4, but it will just stay at 4 while Mario does the dying animation.  


Separately, there are many things that change Mario’s HP directly, rather than going through the counter system. These include being underwater, being at the surface of [[Water|water]], being in cold water, being in toxic gas, and being burned by fire. Additionally, there are some things that set Mario’s HP to a particular value. These include being eaten by bubba, dying, selecting a save file, and letting the demo play.
Separately, there are many things that change Mario’s HP directly, rather than going through the counter system. These include being underwater, being at the surface of [[Water|water]], being in cold water, being in toxic gas, and being burned by fire. Additionally, there are some things that set Mario’s HP to a particular value. These include being eaten by [[Bubba]], dying, selecting a save file, and letting the demo play.


== Gaining Health ==
== Gaining Health ==
Line 47: Line 47:
'''Enemies that shock:''' [[Amp]]
'''Enemies that shock:''' [[Amp]]


'''Enemies with a Knockback of 1:''' Bubble, Cheep Chomp, [[Goomba]], [[Scuttlebug]], Swoop
'''Enemies with a Knockback of 1:''' Bubble, [[Cheep Chomp]], [[Goomba]], [[Scuttlebug]], [[Swoop]]


'''Enemies with a Knockback of 2:''' Big Cannonball, [[Goomba|Big Goomba]], Big Piranha Plant, [[Bob-omb]], [[Boo]], Bookend, Bubba, Chairs, Clam, Fly Guy, Lakitu, [[Moneybag]], Mr. I, Pokey, Skeeter, Small Cannonball, Small Piranha Plant, Snowman, [[Snufit]], [[Spindrift]], Spiny
'''Enemies with a Knockback of 2:''' Big Cannonball, [[Goomba|Big Goomba]], Big Piranha Plant, [[Bob-omb]], [[Boo]], [[Bookend]], [[Bubba]], [[Haunted Chair]], Clam, [[Fly Guy]], [[Lakitu]], [[Moneybag]], Mr. I, [[Pokey]], [[Skeeter]], Small Cannonball, Small Piranha Plant, [[Mr. Blizzard]], [[Snufit]], [[Spindrift]], [[Spiny]]
*Bubba can eat Mario, instantly killing him.
*Bubba can also eat Mario, instantly killing him.


'''Enemies with a Knockback of 3:''' Big Boo, [[Bullet Bill]], [[Chain Chomp]], Piano, Piranha Plant, [[Sushi]], Unagi
'''Enemies with a Knockback of 3:''' Big Boo, [[Bullet Bill]], [[Chain Chomp]], [[Mad Piano]], [[Piranha Plant]], [[Sushi]], [[Unagi]]


'''Enemies that squish:''' [[Grindel]], King Whomp, [[Spindel]], [[Thwomp]], Tox Box, Whomp
'''Enemies that squish:''' [[Grindel]], King Whomp, [[Spindel]], [[Thwomp]], [[Tox Box]], [[Whomp]]


'''Enemies that don't do damage:''' Big Bullies, [[Bomp]], [[Bully | Bullies]], [[Chuckya]], Heave Ho, Klepto, Koopa, Manta, Small Koopa
'''Enemies that don't do damage:''' Big Bullies, [[Bomp]], [[Bully | Bullies]], [[Chuckya]], Heave Ho, Klepto, Koopa, Manta, Small Koopa
Line 67: Line 67:
| Small [[Fall Damage]] || 8 || -2 || 12 || -3
| Small [[Fall Damage]] || 8 || -2 || 12 || -3
|-
|-
| Lava || 12 || -3 || 18 || -4.5
| [[Lava]] || 12 || -3 || 18 || -4.5
|-
|-
| Big Fall Damage || 16 || -4 || 24 || -6
| Big Fall Damage || 16 || -4 || 24 || -6

Navigation menu