HP: Difference between revisions

From Ukikipedia
Jump to navigation Jump to search
(Page created (help on chart would be appreciated))
(No difference)

Revision as of 02:05, 11 March 2019

HP-INC.gif

HP (also known as Health) is the measure of Mario’s health. If this reaches 0, Mario loses a life.

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.

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, 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 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.

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, 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

(TODO: get exact values)

Losing Health

Enemies

(TODO: create chart that desplays how much HP each Entity removes)

Environment

  • Contact with lava removes 3 sectors
  • If Mario remains in the squished state for 10 seconds straight, then his HP will be set to 255, and he will die as a result.
  • Note that going out of bounds, going near the death barrier, going into the whirlpool in DDD, and going into the quicksand in SSL all kill Mario, but they don't actually change his HP.

References

[1]