User Tools


This is an old revision of the document!


HUD Rendering

The HUD is rendered using function RenderHud: 802E3D2C/09ED2C. This function reads state to determine which HUD elements to display and calls several other subroutines and makes use of the PrintStr() and PrintInt() functions.

Lives

RenderHudMarioLives: 802E3744/09E744

PrintStr(0x16, 0xD1, 0x80338380); // "," = Mario
PrintStr(0x26, 0xD1, 0x80338384); // "*" = X
PrintInt(0x36, 0xD1, 0x80338388, *0x8033b260); // "%d"

Coins

RenderHudCoins: 802E37A8/09E7A8

PrintStr(0xA8, 0xD1, 0x8033838C); // "+" = coin
PrintStr(0xB8, 0xD1, 0x80338390); // "*" = X
PrintInt(0xC6, 0xD1, 0x80338394, *0x8033b262); // "%d"

Stars

RenderHudStars: 802E380C/09E80C

int showX = 0; // 0x1F($SP)
if ((*0x803316d4 == 1) || (*0x8032d5d4 & 0x8 == 0)) {
   if (*0x8033b264 < 100) {
      showX = 1;
   }
   PrintStr(0xF2, 0xD1, 0x80338398); // "-" = star
   if (showX) {
      PrintStr(0x102, 0xD1, 0x8033839C); // "*" = X
   }
   PrintInt(0x102+14*showX, 0xD1, 0x803383A0, *0x8033B264); // "%d"
}

Health

RenderHudHp: 802E3654/09E654

Camera

ShowCameraStatus: 802E3B3C/09EB3C

Timer

RenderHudTimer: 802E395C/09E95C

Printing Functions

The two commonly used printing functions PrintStr and PrintInt accept null-terminated ASCII strings as input. It then uses a lookup table to determine which letter to display. This table is located in segment 02 alongside the letters. It notably contains missing entries for the letters J,Q,X,Z.

PrintStr

PrintStr: 802D6554/091554

void PrintStr(int X, int Y, char *string);

PrintInt

PrintInt: 802D62D8/0912D8 This is more of a generic printf() style function that accepts a format and variable arguments.

void PrintInt(int X, int Y, char *format, ...);