Health

From SM64Decomp Wiki
Jump to navigation Jump to search

Health, also known as Power, is what keeps Mario alive. On screen, the player only sees up to 8 units of health. Technically however, there are more values underneath.

Mario's current health is stored as a 2-byte value in gMarioState->health and usually ranges from 0x0FF (dead) to 0x880 (full live). The upper byte is used as the number of health units that's shown in the HUD. For example, 0x360 corresponds to 3 units of health, 0x520 corresponds to 5 units of health.

Where health is modified

There are a few occasions in which Mario's health is modified.

Water

While underwater, Mario continously loses health. It's restored when he's on the surface. If the level terrain is set to snow, Mario loses three times health, even on surface.

Mario's health, when in water, is updated in src/game/mario.c in the function update_mario_health().

Where health is checked

There are several locations in code where health is checked for various actions, such as showing or hiding health in the HUD, changing Mario's animation or to make him die or drown.

See also

  • HP on Ukikipedia