diff --git a/asm/non_matchings/code/z_lifemeter/Health_UpdateData.s b/asm/non_matchings/code/z_lifemeter/HealthMeter_Update.s similarity index 68% rename from asm/non_matchings/code/z_lifemeter/Health_UpdateData.s rename to asm/non_matchings/code/z_lifemeter/HealthMeter_Update.s index d9f97dabe8..72a7172675 100644 --- a/asm/non_matchings/code/z_lifemeter/Health_UpdateData.s +++ b/asm/non_matchings/code/z_lifemeter/HealthMeter_Update.s @@ -3,7 +3,7 @@ glabel D_8013C888 .float 0.1 .text -glabel Health_UpdateData +glabel HealthMeter_Update /* AEFBD8 80078A38 3C0E0001 */ lui $t6, 1 /* AEFBDC 80078A3C 01C47021 */ addu $t6, $t6, $a0 /* AEFBE0 80078A40 85CE06EE */ lh $t6, 0x6ee($t6) @@ -52,41 +52,41 @@ glabel Health_UpdateData /* AEFC80 80078AE0 A444021A */ sh $a0, 0x21a($v0) /* AEFC84 80078AE4 A44B021E */ sh $t3, 0x21e($v0) /* AEFC88 80078AE8 A44C0222 */ sh $t4, 0x222($v0) -/* AEFC8C 80078AEC 3C0D8012 */ lui $t5, %hi(D_8011FF10) # $t5, 0x8012 -/* AEFC90 80078AF0 85ADFF10 */ lh $t5, %lo(D_8011FF10)($t5) -/* AEFC94 80078AF4 3C0E8012 */ lui $t6, %hi(D_8011FF10+2) # $t6, 0x8012 -/* AEFC98 80078AF8 3C0F8012 */ lui $t7, %hi(D_8011FF10+4) # $t7, 0x8012 +/* AEFC8C 80078AEC 3C0D8012 */ lui $t5, %hi(sHeartsPrimColors) # $t5, 0x8012 +/* AEFC90 80078AF0 85ADFF10 */ lh $t5, %lo(sHeartsPrimColors)($t5) +/* AEFC94 80078AF4 3C0E8012 */ lui $t6, %hi(sHeartsPrimColors+2) # $t6, 0x8012 +/* AEFC98 80078AF8 3C0F8012 */ lui $t7, %hi(sHeartsPrimColors+4) # $t7, 0x8012 /* AEFC9C 80078AFC A44D0210 */ sh $t5, 0x210($v0) -/* AEFCA0 80078B00 85CEFF12 */ lh $t6, %lo(D_8011FF10+2)($t6) -/* AEFCA4 80078B04 3C188012 */ lui $t8, %hi(D_8011FF24) # $t8, 0x8012 -/* AEFCA8 80078B08 3C198012 */ lui $t9, %hi(D_8011FF24+2) # $t9, 0x8012 +/* AEFCA0 80078B00 85CEFF12 */ lh $t6, %lo(sHeartsPrimColors+2)($t6) +/* AEFCA4 80078B04 3C188012 */ lui $t8, %hi(sHeartsEnvColors) # $t8, 0x8012 +/* AEFCA8 80078B08 3C198012 */ lui $t9, %hi(sHeartsEnvColors+2) # $t9, 0x8012 /* AEFCAC 80078B0C A44E0214 */ sh $t6, 0x214($v0) -/* AEFCB0 80078B10 85EFFF14 */ lh $t7, %lo(D_8011FF10+4)($t7) -/* AEFCB4 80078B14 3C0B8012 */ lui $t3, %hi(D_8011FF24+4) # $t3, 0x8012 -/* AEFCB8 80078B18 3C078012 */ lui $a3, %hi(D_8011FF38) # $a3, 0x8012 +/* AEFCB0 80078B10 85EFFF14 */ lh $t7, %lo(sHeartsPrimColors+4)($t7) +/* AEFCB4 80078B14 3C0B8012 */ lui $t3, %hi(sHeartsEnvColors+4) # $t3, 0x8012 +/* AEFCB8 80078B18 3C078012 */ lui $a3, %hi(sHeartsPrimFactors) # $a3, 0x8012 /* AEFCBC 80078B1C A44F0218 */ sh $t7, 0x218($v0) -/* AEFCC0 80078B20 8718FF24 */ lh $t8, %lo(D_8011FF24)($t8) -/* AEFCC4 80078B24 24E7FF38 */ addiu $a3, %lo(D_8011FF38) # addiu $a3, $a3, -0xc8 -/* AEFCC8 80078B28 3C088012 */ lui $t0, %hi(D_8011FF4C) # $t0, 0x8012 +/* AEFCC0 80078B20 8718FF24 */ lh $t8, %lo(sHeartsEnvColors)($t8) +/* AEFCC4 80078B24 24E7FF38 */ addiu $a3, %lo(sHeartsPrimFactors) # addiu $a3, $a3, -0xc8 +/* AEFCC8 80078B28 3C088012 */ lui $t0, %hi(sHeartsEnvFactors) # $t0, 0x8012 /* AEFCCC 80078B2C A458021C */ sh $t8, 0x21c($v0) -/* AEFCD0 80078B30 8739FF26 */ lh $t9, %lo(D_8011FF24+2)($t9) -/* AEFCD4 80078B34 2508FF4C */ addiu $t0, %lo(D_8011FF4C) # addiu $t0, $t0, -0xb4 -/* AEFCD8 80078B38 3C018016 */ lui $at, %hi(D_8015FDD0+6) # $at, 0x8016 +/* AEFCD0 80078B30 8739FF26 */ lh $t9, %lo(sHeartsEnvColors+2)($t9) +/* AEFCD4 80078B34 2508FF4C */ addiu $t0, %lo(sHeartsEnvFactors) # addiu $t0, $t0, -0xb4 +/* AEFCD8 80078B38 3C018016 */ lui $at, %hi(sBeatingHeartsDDPrim+6) # $at, 0x8016 /* AEFCDC 80078B3C A4590220 */ sh $t9, 0x220($v0) -/* AEFCE0 80078B40 856BFF28 */ lh $t3, %lo(D_8011FF24+4)($t3) -/* AEFCE4 80078B44 3C098016 */ lui $t1, %hi(D_8015FDC0) # $t1, 0x8016 -/* AEFCE8 80078B48 2529FDC0 */ addiu $t1, %lo(D_8015FDC0) # addiu $t1, $t1, -0x240 +/* AEFCE0 80078B40 856BFF28 */ lh $t3, %lo(sHeartsEnvColors+4)($t3) +/* AEFCE4 80078B44 3C098016 */ lui $t1, %hi(sHeartsDDPrim) # $t1, 0x8016 +/* AEFCE8 80078B48 2529FDC0 */ addiu $t1, %lo(sHeartsDDPrim) # addiu $t1, $t1, -0x240 /* AEFCEC 80078B4C A44B0224 */ sh $t3, 0x224($v0) /* AEFCF0 80078B50 84EC0000 */ lh $t4, ($a3) /* AEFCF4 80078B54 84EE0002 */ lh $t6, 2($a3) /* AEFCF8 80078B58 84F80004 */ lh $t8, 4($a3) /* AEFCFC 80078B5C 448C5000 */ mtc1 $t4, $f10 /* AEFD00 80078B60 448E3000 */ mtc1 $t6, $f6 -/* AEFD04 80078B64 3C078016 */ lui $a3, %hi(D_8015FDD0) # $a3, 0x8016 +/* AEFD04 80078B64 3C078016 */ lui $a3, %hi(sBeatingHeartsDDPrim) # $a3, 0x8016 /* AEFD08 80078B68 46805420 */ cvt.s.w $f16, $f10 -/* AEFD0C 80078B6C 24E7FDD0 */ addiu $a3, %lo(D_8015FDD0) # addiu $a3, $a3, -0x230 -/* AEFD10 80078B70 3C0A8016 */ lui $t2, %hi(D_8015FDC8) -/* AEFD14 80078B74 254AFDC8 */ addiu $t2, %lo(D_8015FDC8) # addiu $t2, $t2, -0x238 +/* AEFD0C 80078B6C 24E7FDD0 */ addiu $a3, %lo(sBeatingHeartsDDPrim) # addiu $a3, $a3, -0x230 +/* AEFD10 80078B70 3C0A8016 */ lui $t2, %hi(sHeartsDDEnv) +/* AEFD14 80078B74 254AFDC8 */ addiu $t2, %lo(sHeartsDDEnv) # addiu $t2, $t2, -0x238 /* AEFD18 80078B78 46803220 */ cvt.s.w $f8, $f6 /* AEFD1C 80078B7C 46008482 */ mul.s $f18, $f16, $f0 /* AEFD20 80078B80 4600910D */ trunc.w.s $f4, $f18 @@ -121,11 +121,11 @@ glabel Health_UpdateData /* AEFD94 80078BF4 85190004 */ lh $t9, 4($t0) /* AEFD98 80078BF8 448D5000 */ mtc1 $t5, $f10 /* AEFD9C 80078BFC 448F3000 */ mtc1 $t7, $f6 -/* AEFDA0 80078C00 3C088016 */ lui $t0, %hi(D_8015FDE0) # $t0, 0x8016 +/* AEFDA0 80078C00 3C088016 */ lui $t0, %hi(sBeatingHeartsDDEnv) # $t0, 0x8016 /* AEFDA4 80078C04 46805420 */ cvt.s.w $f16, $f10 -/* AEFDA8 80078C08 2508FDE0 */ addiu $t0, %lo(D_8015FDE0) # addiu $t0, $t0, -0x220 -/* AEFDAC 80078C0C 3C0F8012 */ lui $t7, %hi(D_8011FF60) # $t7, 0x8012 -/* AEFDB0 80078C10 3C0B8012 */ lui $t3, %hi(D_8011FF74) +/* AEFDA8 80078C08 2508FDE0 */ addiu $t0, %lo(sBeatingHeartsDDEnv) # addiu $t0, $t0, -0x220 +/* AEFDAC 80078C0C 3C0F8012 */ lui $t7, %hi(sHeartsDDPrimColors) # $t7, 0x8012 +/* AEFDB0 80078C10 3C0B8012 */ lui $t3, %hi(sHeartsDDEnvColors) /* AEFDB4 80078C14 46803220 */ cvt.s.w $f8, $f6 /* AEFDB8 80078C18 46008482 */ mul.s $f18, $f16, $f0 /* AEFDBC 80078C1C 4600910D */ trunc.w.s $f4, $f18 @@ -151,7 +151,7 @@ glabel Health_UpdateData /* AEFE0C 80078C6C 331900FF */ andi $t9, $t8, 0xff /* AEFE10 80078C70 44054000 */ mfc1 $a1, $f8 /* AEFE14 80078C74 A459020A */ sh $t9, 0x20a($v0) -/* AEFE18 80078C78 3C188012 */ lui $t8, %hi(D_8011FF60+2) # $t8, 0x8012 +/* AEFE18 80078C78 3C188012 */ lui $t8, %hi(sHeartsDDPrimColors+2) # $t8, 0x8012 /* AEFE1C 80078C7C 00052C00 */ sll $a1, $a1, 0x10 /* AEFE20 80078C80 00052C03 */ sra $a1, $a1, 0x10 /* AEFE24 80078C84 24AC003C */ addiu $t4, $a1, 0x3c @@ -163,49 +163,49 @@ glabel Health_UpdateData /* AEFE3C 80078C9C A4E60004 */ sh $a2, 4($a3) /* AEFE40 80078CA0 A5000002 */ sh $zero, 2($t0) /* AEFE44 80078CA4 A5000004 */ sh $zero, 4($t0) -/* AEFE48 80078CA8 3C0E8012 */ lui $t6, %hi(D_8011FF88) # $t6, 0x8012 -/* AEFE4C 80078CAC 85CEFF88 */ lh $t6, %lo(D_8011FF88)($t6) -/* AEFE50 80078CB0 85EFFF60 */ lh $t7, %lo(D_8011FF60)($t7) -/* AEFE54 80078CB4 8718FF62 */ lh $t8, %lo(D_8011FF60+2)($t8) +/* AEFE48 80078CA8 3C0E8012 */ lui $t6, %hi(sHeartsDDPrimFactors) # $t6, 0x8012 +/* AEFE4C 80078CAC 85CEFF88 */ lh $t6, %lo(sHeartsDDPrimFactors)($t6) +/* AEFE50 80078CB0 85EFFF60 */ lh $t7, %lo(sHeartsDDPrimColors)($t7) +/* AEFE54 80078CB4 8718FF62 */ lh $t8, %lo(sHeartsDDPrimColors+2)($t8) /* AEFE58 80078CB8 448E5000 */ mtc1 $t6, $f10 -/* AEFE5C 80078CBC 3C198012 */ lui $t9, %hi(D_8011FF60+4) # $t9, 0x8012 -/* AEFE60 80078CC0 8739FF64 */ lh $t9, %lo(D_8011FF60+4)($t9) +/* AEFE5C 80078CBC 3C198012 */ lui $t9, %hi(sHeartsDDPrimColors+4) # $t9, 0x8012 +/* AEFE60 80078CC0 8739FF64 */ lh $t9, %lo(sHeartsDDPrimColors+4)($t9) /* AEFE64 80078CC4 46805420 */ cvt.s.w $f16, $f10 -/* AEFE68 80078CC8 A42FFDD6 */ sh $t7, %lo(D_8015FDD0+6)($at) -/* AEFE6C 80078CCC 3C018016 */ lui $at, %hi(D_8015FDD0+8) # $at, 0x8016 -/* AEFE70 80078CD0 856BFF74 */ lh $t3, %lo(D_8011FF74)($t3) -/* AEFE74 80078CD4 A438FDD8 */ sh $t8, %lo(D_8015FDD0+8)($at) -/* AEFE78 80078CD8 3C188012 */ lui $t8, %hi(D_8011FF88+2) # $t8, 0x8012 +/* AEFE68 80078CC8 A42FFDD6 */ sh $t7, %lo(sBeatingHeartsDDPrim+6)($at) +/* AEFE6C 80078CCC 3C018016 */ lui $at, %hi(sBeatingHeartsDDPrim+8) # $at, 0x8016 +/* AEFE70 80078CD0 856BFF74 */ lh $t3, %lo(sHeartsDDEnvColors)($t3) +/* AEFE74 80078CD4 A438FDD8 */ sh $t8, %lo(sBeatingHeartsDDPrim+8)($at) +/* AEFE78 80078CD8 3C188012 */ lui $t8, %hi(sHeartsDDPrimFactors+2) # $t8, 0x8012 /* AEFE7C 80078CDC 46008482 */ mul.s $f18, $f16, $f0 -/* AEFE80 80078CE0 A439FDDA */ sh $t9, %lo(D_8015FDD0+0xa)($at) -/* AEFE84 80078CE4 8718FF8A */ lh $t8, %lo(D_8011FF88+2)($t8) -/* AEFE88 80078CE8 3C018016 */ lui $at, %hi(D_8015FDE0+6) # $at, 0x8016 -/* AEFE8C 80078CEC A42BFDE6 */ sh $t3, %lo(D_8015FDE0+6)($at) -/* AEFE90 80078CF0 3C0B8012 */ lui $t3, %hi(D_8011FF88+4) -/* AEFE94 80078CF4 856BFF8C */ lh $t3, %lo(D_8011FF88+4)($t3) +/* AEFE80 80078CE0 A439FDDA */ sh $t9, %lo(sBeatingHeartsDDPrim+0xa)($at) +/* AEFE84 80078CE4 8718FF8A */ lh $t8, %lo(sHeartsDDPrimFactors+2)($t8) +/* AEFE88 80078CE8 3C018016 */ lui $at, %hi(sBeatingHeartsDDEnv+6) # $at, 0x8016 +/* AEFE8C 80078CEC A42BFDE6 */ sh $t3, %lo(sBeatingHeartsDDEnv+6)($at) +/* AEFE90 80078CF0 3C0B8012 */ lui $t3, %hi(sHeartsDDPrimFactors+4) +/* AEFE94 80078CF4 856BFF8C */ lh $t3, %lo(sHeartsDDPrimFactors+4)($t3) /* AEFE98 80078CF8 44983000 */ mtc1 $t8, $f6 /* AEFE9C 80078CFC 4600910D */ trunc.w.s $f4, $f18 /* AEFEA0 80078D00 448B9000 */ mtc1 $t3, $f18 -/* AEFEA4 80078D04 3C0D8012 */ lui $t5, %hi(D_8011FF74+4) # $t5, 0x8012 +/* AEFEA4 80078D04 3C0D8012 */ lui $t5, %hi(sHeartsDDEnvColors+4) # $t5, 0x8012 /* AEFEA8 80078D08 46803220 */ cvt.s.w $f8, $f6 /* AEFEAC 80078D0C 44032000 */ mfc1 $v1, $f4 -/* AEFEB0 80078D10 85ADFF78 */ lh $t5, %lo(D_8011FF74+4)($t5) -/* AEFEB4 80078D14 3C0C8012 */ lui $t4, %hi(D_8011FF74+2) # $t4, 0x8012 -/* AEFEB8 80078D18 858CFF76 */ lh $t4, %lo(D_8011FF74+2)($t4) +/* AEFEB0 80078D10 85ADFF78 */ lh $t5, %lo(sHeartsDDEnvColors+4)($t5) +/* AEFEB4 80078D14 3C0C8012 */ lui $t4, %hi(sHeartsDDEnvColors+2) # $t4, 0x8012 +/* AEFEB8 80078D18 858CFF76 */ lh $t4, %lo(sHeartsDDEnvColors+2)($t4) /* AEFEBC 80078D1C 46809120 */ cvt.s.w $f4, $f18 /* AEFEC0 80078D20 46004282 */ mul.s $f10, $f8, $f0 /* AEFEC4 80078D24 00031C00 */ sll $v1, $v1, 0x10 -/* AEFEC8 80078D28 3C018016 */ lui $at, %hi(D_8015FDE0+8) # $at, 0x8016 +/* AEFEC8 80078D28 3C018016 */ lui $at, %hi(sBeatingHeartsDDEnv+8) # $at, 0x8016 /* AEFECC 80078D2C 00031C03 */ sra $v1, $v1, 0x10 /* AEFED0 80078D30 246E00FF */ addiu $t6, $v1, 0xff /* AEFED4 80078D34 46002182 */ mul.s $f6, $f4, $f0 -/* AEFED8 80078D38 A42DFDEA */ sh $t5, %lo(D_8015FDE0+0xa)($at) +/* AEFED8 80078D38 A42DFDEA */ sh $t5, %lo(sBeatingHeartsDDEnv+0xa)($at) /* AEFEDC 80078D3C 31CF00FF */ andi $t7, $t6, 0xff -/* AEFEE0 80078D40 A42CFDE8 */ sh $t4, %lo(D_8015FDE0+8)($at) +/* AEFEE0 80078D40 A42CFDE8 */ sh $t4, %lo(sBeatingHeartsDDEnv+8)($at) /* AEFEE4 80078D44 A52F0000 */ sh $t7, ($t1) -/* AEFEE8 80078D48 3C0F8012 */ lui $t7, %hi(D_8011FF9C) # $t7, 0x8012 +/* AEFEE8 80078D48 3C0F8012 */ lui $t7, %hi(sHeartsDDEnvFactors) # $t7, 0x8012 /* AEFEEC 80078D4C 4600540D */ trunc.w.s $f16, $f10 -/* AEFEF0 80078D50 3C0C8012 */ lui $t4, %hi(D_8011FF9C+4) # $t4, 0x8012 +/* AEFEF0 80078D50 3C0C8012 */ lui $t4, %hi(sHeartsDDEnvFactors+4) # $t4, 0x8012 /* AEFEF4 80078D54 4600320D */ trunc.w.s $f8, $f6 /* AEFEF8 80078D58 44048000 */ mfc1 $a0, $f16 /* AEFEFC 80078D5C 44054000 */ mfc1 $a1, $f8 @@ -219,11 +219,11 @@ glabel Health_UpdateData /* AEFF1C 80078D7C 31AE00FF */ andi $t6, $t5, 0xff /* AEFF20 80078D80 A52B0002 */ sh $t3, 2($t1) /* AEFF24 80078D84 A52E0004 */ sh $t6, 4($t1) -/* AEFF28 80078D88 85EFFF9C */ lh $t7, %lo(D_8011FF9C)($t7) -/* AEFF2C 80078D8C 3C198012 */ lui $t9, %hi(D_8011FF9C+2) -/* AEFF30 80078D90 8739FF9E */ lh $t9, %lo(D_8011FF9C+2)($t9) +/* AEFF28 80078D88 85EFFF9C */ lh $t7, %lo(sHeartsDDEnvFactors)($t7) +/* AEFF2C 80078D8C 3C198012 */ lui $t9, %hi(sHeartsDDEnvFactors+2) +/* AEFF30 80078D90 8739FF9E */ lh $t9, %lo(sHeartsDDEnvFactors+2)($t9) /* AEFF34 80078D94 448F5000 */ mtc1 $t7, $f10 -/* AEFF38 80078D98 858CFFA0 */ lh $t4, %lo(D_8011FF9C+4)($t4) +/* AEFF38 80078D98 858CFFA0 */ lh $t4, %lo(sHeartsDDEnvFactors+4)($t4) /* AEFF3C 80078D9C 44993000 */ mtc1 $t9, $f6 /* AEFF40 80078DA0 46805420 */ cvt.s.w $f16, $f10 /* AEFF44 80078DA4 46803220 */ cvt.s.w $f8, $f6 diff --git a/asm/non_matchings/code/z_parameter/Interface_Draw.s b/asm/non_matchings/code/z_parameter/Interface_Draw.s index c0a1d28658..2ccf771c54 100644 --- a/asm/non_matchings/code/z_parameter/Interface_Draw.s +++ b/asm/non_matchings/code/z_parameter/Interface_Draw.s @@ -140,7 +140,7 @@ glabel Interface_Draw /* B01C74 8008AAD4 02E02025 */ move $a0, $s7 /* B01C78 8008AAD8 0C022A65 */ jal func_8008A994 /* B01C7C 8008AADC 02C02025 */ move $a0, $s6 -/* B01C80 8008AAE0 0C01E3C7 */ jal Health_Draw +/* B01C80 8008AAE0 0C01E3C7 */ jal HealthMeter_Draw /* B01C84 8008AAE4 02E02025 */ move $a0, $s7 /* B01C88 8008AAE8 0C025148 */ jal func_80094520 /* B01C8C 8008AAEC 8EE40000 */ lw $a0, ($s7) diff --git a/data/z_lifemeter.data.s b/data/z_lifemeter.data.s deleted file mode 100644 index 0b506e4ab5..0000000000 --- a/data/z_lifemeter.data.s +++ /dev/null @@ -1,40 +0,0 @@ -.include "macro.inc" - -# assembler directives -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches -.set gp=64 # allow use of 64-bit general purpose registers - -.section .data - -.balign 16 - -glabel D_8011FF10 - .incbin "baserom.z64", 0xB970B0, 0x14 - -glabel D_8011FF24 - .incbin "baserom.z64", 0xB970C4, 0x14 - -glabel D_8011FF38 - .incbin "baserom.z64", 0xB970D8, 0x14 - -glabel D_8011FF4C - .incbin "baserom.z64", 0xB970EC, 0x14 - -glabel D_8011FF60 - .incbin "baserom.z64", 0xB97100, 0x14 - -glabel D_8011FF74 - .incbin "baserom.z64", 0xB97114, 0x14 - -glabel D_8011FF88 - .incbin "baserom.z64", 0xB97128, 0x14 - -glabel D_8011FF9C - .incbin "baserom.z64", 0xB9713C, 0x14 - -glabel D_8011FFB0 - .incbin "baserom.z64", 0xB97150, 0x40 - -glabel D_8011FFF0 - .incbin "baserom.z64", 0xB97190, 0x40 diff --git a/include/functions.h b/include/functions.h index 7aeefd9a34..46833a75eb 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1020,11 +1020,11 @@ void Color_RGBA8_Copy(Color_RGBA8* dst, Color_RGBA8* src); void func_80078884(u16 sfxId); void func_800788CC(u16 sfxId); void func_80078914(Vec3f* arg0, u16 sfxId); -void Health_InitData(GlobalContext* globalCtx); -void Health_UpdateData(GlobalContext* globalCtx); -void Health_Draw(GlobalContext* globalCtx); -void Health_HandleCriticalAlarm(GlobalContext* globalCtx); -u32 Health_IsCritical(void); +void HealthMeter_Init(GlobalContext* globalCtx); +void HealthMeter_Update(GlobalContext* globalCtx); +void HealthMeter_Draw(GlobalContext* globalCtx); +void HealthMeter_HandleCriticalAlarm(GlobalContext* globalCtx); +u32 HealthMeter_IsCritical(void); void Lights_PointSetInfo(LightInfo* info, s16 x, s16 y, s16 z, u8 r, u8 g, u8 b, s16 radius, s32 type); void Lights_PointNoGlowSetInfo(LightInfo* info, s16 x, s16 y, s16 z, u8 r, u8 g, u8 b, s16 radius); void Lights_PointGlowSetInfo(LightInfo* info, s16 x, s16 y, s16 z, u8 r, u8 g, u8 b, s16 radius); diff --git a/include/z64.h b/include/z64.h index 7f4ee92206..fbc6977aba 100644 --- a/include/z64.h +++ b/include/z64.h @@ -363,10 +363,14 @@ typedef struct { /* 0x01FC */ s16 unk_1FC; /* 0x01FE */ s16 unk_1FE; /* 0x0200 */ s16 unk_200; - /* 0x0202 */ s16 unk_202[3]; - /* 0x0208 */ s16 unk_208[3]; - /* 0x020E */ s16 unk_20E[6]; - /* 0x021A */ s16 unk_21A[6]; + /* 0x0202 */ s16 beatingHeartPrim[3]; + /* 0x0208 */ s16 beatingHeartEnv[3]; + /* 0x020E */ s16 heartsPrimR[2]; + /* 0x0212 */ s16 heartsPrimG[2]; + /* 0x0216 */ s16 heartsPrimB[2]; + /* 0x021A */ s16 heartsEnvR[2]; + /* 0x021E */ s16 heartsEnvG[2]; + /* 0x0222 */ s16 heartsEnvB[2]; /* 0x0226 */ s16 unk_226; /* 0x0228 */ s16 unk_228; /* 0x022A */ s16 unk_22A; diff --git a/spec b/spec index 2834eadf44..cacc692ef6 100644 --- a/spec +++ b/spec @@ -309,7 +309,6 @@ beginseg include "build/data/z_kankyo.bss.o" include "build/src/code/z_lib.o" include "build/src/code/z_lifemeter.o" - include "build/data/z_lifemeter.data.o" include "build/src/code/z_lights.o" include "build/src/code/z_malloc.o" include "build/src/code/z_map_mark.o" diff --git a/src/code/z_construct.c b/src/code/z_construct.c index 3d5a9337bc..d4fdd05ff6 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -155,7 +155,7 @@ void func_801109B0(GlobalContext* globalCtx) { // Translates to: "Parameter Area = %x" osSyncPrintf("PARAMETER領域=%x\n", parameterSize + 0x5300); - Health_InitData(globalCtx); + HealthMeter_Init(globalCtx); Map_Init(globalCtx); interfaceCtx->unk_23C = interfaceCtx->unk_242 = 0; diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index f4d92e86f3..e2f913bb33 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -1,22 +1,106 @@ #include "global.h" -extern s16 D_8011FF10[3]; -extern s16 D_8011FF24[3]; -extern s16 D_8011FF38[3]; -extern s16 D_8011FF4C[3]; -extern s16 D_8011FF60[3]; -extern s16 D_8011FF74[3]; -extern s16 D_8011FF88[3]; -extern s16 D_8011FF9C[3]; -extern u8* D_8011FFB0[]; -extern u8* D_8011FFF0[]; +/* + * These are the colors for the hearts in the interface. The prim color is the red color of the heart + * for the base hearts, while the prim color for the double defense hearts is the white outline. The + * env color for the base hearts is the purple-ish outline, while the env color for the double defense + * hearts is the red color of the hearts. + */ -s16 D_8015FDC0[3]; -s16 D_8015FDC8[3]; -s16 D_8015FDD0[6]; -s16 D_8015FDE0[6]; +#define HEARTS_PRIM_R 255 +#define HEARTS_PRIM_G 70 +#define HEARTS_PRIM_B 50 -void Health_InitData(GlobalContext* globalCtx) { +#define HEARTS_ENV_R 50 +#define HEARTS_ENV_G 40 +#define HEARTS_ENV_B 60 + +#define HEARTS_DD_PRIM_R 255 +#define HEARTS_DD_PRIM_G 255 +#define HEARTS_DD_PRIM_B 255 + +#define HEARTS_DD_ENV_R 200 +#define HEARTS_DD_ENV_G 0 +#define HEARTS_DD_ENV_B 0 + +/* + * The burn and drown colors listed here are unused. Prerelease footage of the game confirms that at one + * point in development the orange color was to be used while taking damage from hot environments. + * Based on this, we can assume that the blue heart color was to be used while drowning. + * In the final game these environments only have a timer and do not damage you continuously. + */ + +#define HEARTS_BURN_PRIM_R 255 +#define HEARTS_BURN_PRIM_G 190 +#define HEARTS_BURN_PRIM_B 0 + +#define HEARTS_BURN_ENV_R 255 +#define HEARTS_BURN_ENV_G 0 +#define HEARTS_BURN_ENV_B 0 + +#define HEARTS_DROWN_PRIM_R 100 +#define HEARTS_DROWN_PRIM_G 100 +#define HEARTS_DROWN_PRIM_B 255 + +#define HEARTS_DROWN_ENV_R 0 +#define HEARTS_DROWN_ENV_G 0 +#define HEARTS_DROWN_ENV_B 255 + +s16 sHeartsPrimColors[3][3] = { + { HEARTS_PRIM_R, HEARTS_PRIM_G, HEARTS_PRIM_B }, + { HEARTS_BURN_PRIM_R, HEARTS_BURN_PRIM_G, HEARTS_BURN_PRIM_B }, // unused + { HEARTS_DROWN_PRIM_R, HEARTS_DROWN_PRIM_G, HEARTS_DROWN_PRIM_B }, // unused +}; + +s16 sHeartsEnvColors[3][3] = { + { HEARTS_ENV_R, HEARTS_ENV_G, HEARTS_ENV_B }, + { HEARTS_BURN_ENV_R, HEARTS_BURN_ENV_G }, // unused + { HEARTS_DROWN_ENV_R, HEARTS_DROWN_ENV_G, HEARTS_DROWN_ENV_B }, // unused +}; + +s16 sHeartsPrimFactors[3][3] = { + { 0, 0, 0 }, + { 0, 120, -50 }, // unused + { -155, 30, 205 }, // unused +}; + +s16 sHeartsEnvFactors[3][3] = { + { 0, 0, 0 }, + { 205, -40, -60 }, // unused + { -50, -40, 195 }, // unused +}; + +s16 sHeartsDDPrimColors[3][3] = { + { HEARTS_DD_PRIM_R, HEARTS_DD_PRIM_G, HEARTS_DD_PRIM_B }, + { HEARTS_BURN_PRIM_R, HEARTS_BURN_PRIM_G, HEARTS_BURN_PRIM_B }, // unused + { HEARTS_DROWN_PRIM_R, HEARTS_DROWN_PRIM_G, HEARTS_DROWN_PRIM_B }, // unused +}; + +s16 sHeartsDDEnvColors[3][3] = { + { HEARTS_DD_ENV_R, HEARTS_DD_ENV_G, HEARTS_DD_ENV_B }, + { HEARTS_BURN_ENV_R, HEARTS_BURN_ENV_G, HEARTS_BURN_ENV_B }, // unused + { HEARTS_DROWN_ENV_R, HEARTS_DROWN_ENV_G, HEARTS_DROWN_ENV_B }, // unused +}; + +s16 sHeartsDDPrimFactors[3][3] = { + { 0, 0, 0 }, + { 0, -65, -255 }, // unused + { -155, -155, 0 }, // unused +}; + +s16 sHeartsDDEnvFactors[3][3] = { + { 0, 0, 0 }, + { 55, 0, 0 }, // unused + { -200, 0, 255 }, // unused +}; + +// Current colors for the double defense hearts +s16 sHeartsDDPrim[3]; +s16 sHeartsDDEnv[3]; +s16 sBeatingHeartsDDPrim[2][3]; +s16 sBeatingHeartsDDEnv[2][3]; + +void HealthMeter_Init(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; interfaceCtx->unk_228 = 0x140; @@ -24,36 +108,42 @@ void Health_InitData(GlobalContext* globalCtx) { interfaceCtx->unk_22A = interfaceCtx->unk_1FE = 0; interfaceCtx->unk_22C = interfaceCtx->unk_200 = 0; - interfaceCtx->unk_20E[0] = 255; - interfaceCtx->unk_20E[2] = 70; - interfaceCtx->unk_20E[4] = 50; - interfaceCtx->unk_21A[0] = 50; - interfaceCtx->unk_21A[2] = 40; - interfaceCtx->unk_21A[4] = 60; + interfaceCtx->heartsPrimR[0] = HEARTS_PRIM_R; + interfaceCtx->heartsPrimG[0] = HEARTS_PRIM_G; + interfaceCtx->heartsPrimB[0] = HEARTS_PRIM_B; - interfaceCtx->unk_20E[1] = 255; - interfaceCtx->unk_20E[3] = 70; - interfaceCtx->unk_20E[5] = 50; - interfaceCtx->unk_21A[1] = 50; - interfaceCtx->unk_21A[3] = 40; - interfaceCtx->unk_21A[5] = 60; + interfaceCtx->heartsEnvR[0] = HEARTS_ENV_R; + interfaceCtx->heartsEnvG[0] = HEARTS_ENV_G; + interfaceCtx->heartsEnvB[0] = HEARTS_ENV_B; - D_8015FDD0[0] = D_8015FDD0[3] = 255; - D_8015FDD0[1] = D_8015FDD0[4] = 255; - D_8015FDD0[2] = D_8015FDD0[5] = 255; - D_8015FDE0[0] = D_8015FDE0[3] = 200; - D_8015FDE0[1] = D_8015FDE0[4] = 0; - D_8015FDE0[2] = D_8015FDE0[5] = 0; + interfaceCtx->heartsPrimR[1] = HEARTS_PRIM_R; + interfaceCtx->heartsPrimG[1] = HEARTS_PRIM_G; + interfaceCtx->heartsPrimB[1] = HEARTS_PRIM_B; + + interfaceCtx->heartsEnvR[1] = HEARTS_ENV_R; + interfaceCtx->heartsEnvG[1] = HEARTS_ENV_G; + interfaceCtx->heartsEnvB[1] = HEARTS_ENV_B; + + sBeatingHeartsDDPrim[0][0] = sBeatingHeartsDDPrim[1][0] = HEARTS_DD_PRIM_R; + sBeatingHeartsDDPrim[0][1] = sBeatingHeartsDDPrim[1][1] = HEARTS_DD_PRIM_G; + sBeatingHeartsDDPrim[0][2] = sBeatingHeartsDDPrim[1][2] = HEARTS_DD_PRIM_B; + + sBeatingHeartsDDEnv[0][0] = sBeatingHeartsDDEnv[1][0] = HEARTS_DD_ENV_R; + sBeatingHeartsDDEnv[0][1] = sBeatingHeartsDDEnv[1][1] = HEARTS_DD_ENV_G; + sBeatingHeartsDDEnv[0][2] = sBeatingHeartsDDEnv[1][2] = HEARTS_DD_ENV_B; } #ifdef NON_MATCHING -// this function still needs some work but it should be functionally equivalent -void Health_UpdateData(GlobalContext* globalCtx) { +// Far from matching, but is equivalent. The for loop needs to become unrolled somehow in order to match. +void HealthMeter_Update(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - f32 temp_f0 = interfaceCtx->unk_1FE * 0.1f; - s16 temp1, temp2, temp3; - - if (0) {} + f32 factor = interfaceCtx->unk_1FE * 0.1f; + s16 rFactor; + s16 gFactor; + s16 bFactor; + s16 i; + s16* prim; + s16* env; if (interfaceCtx->unk_200 != 0) { interfaceCtx->unk_1FE--; @@ -69,80 +159,69 @@ void Health_UpdateData(GlobalContext* globalCtx) { } } - interfaceCtx->unk_20E[0] = 255; - interfaceCtx->unk_20E[2] = 70; - interfaceCtx->unk_20E[4] = 50; + interfaceCtx->heartsPrimR[0] = HEARTS_PRIM_R; + interfaceCtx->heartsPrimG[0] = HEARTS_PRIM_G; + interfaceCtx->heartsPrimB[0] = HEARTS_PRIM_B; - interfaceCtx->unk_21A[0] = 50; - interfaceCtx->unk_21A[2] = 40; - interfaceCtx->unk_21A[4] = 60; + interfaceCtx->heartsEnvR[0] = HEARTS_ENV_R; + interfaceCtx->heartsEnvG[0] = HEARTS_ENV_G; + interfaceCtx->heartsEnvB[0] = HEARTS_ENV_B; - interfaceCtx->unk_20E[1] = D_8011FF10[0]; - interfaceCtx->unk_20E[3] = D_8011FF10[1]; - interfaceCtx->unk_20E[5] = D_8011FF10[2]; + interfaceCtx->heartsPrimR[1] = sHeartsPrimColors[0][0]; + interfaceCtx->heartsPrimG[1] = sHeartsPrimColors[0][1]; + interfaceCtx->heartsPrimB[1] = sHeartsPrimColors[0][2]; - interfaceCtx->unk_21A[1] = D_8011FF24[0]; - interfaceCtx->unk_21A[3] = D_8011FF24[1]; - interfaceCtx->unk_21A[5] = D_8011FF24[2]; + interfaceCtx->heartsEnvR[1] = sHeartsEnvColors[0][0]; + interfaceCtx->heartsEnvG[1] = sHeartsEnvColors[0][1]; + interfaceCtx->heartsEnvB[1] = sHeartsEnvColors[0][2]; - temp1 = D_8011FF38[0]; - temp2 = D_8011FF38[1]; - temp3 = D_8011FF38[2]; - temp1 *= temp_f0; - interfaceCtx->unk_202[0] = (u8)(temp1 + 0xFF); - temp2 *= temp_f0; - interfaceCtx->unk_202[1] = (u8)(temp2 + 0x46); - temp3 *= temp_f0; - interfaceCtx->unk_202[2] = (u8)(temp3 + 0x32); + rFactor = sHeartsPrimFactors[0][0] * factor; + gFactor = sHeartsPrimFactors[0][1] * factor; + bFactor = sHeartsPrimFactors[0][2] * factor; - temp1 = D_8011FF4C[0]; - temp2 = D_8011FF4C[1]; - temp3 = D_8011FF4C[2]; - temp1 *= temp_f0; - interfaceCtx->unk_208[0] = (u8)(temp1 + 0x32); - temp2 *= temp_f0; - interfaceCtx->unk_208[1] = (u8)(temp2 + 0x28); - temp3 *= temp_f0; - interfaceCtx->unk_208[2] = (u8)(temp3 + 0x3C); + interfaceCtx->beatingHeartPrim[0] = (u8)(s32)(rFactor + HEARTS_PRIM_R) & 0xFF; + interfaceCtx->beatingHeartPrim[1] = (u8)(s32)(gFactor + HEARTS_PRIM_G) & 0xFF; + interfaceCtx->beatingHeartPrim[2] = (u8)(s32)(bFactor + HEARTS_PRIM_B) & 0xFF; - D_8015FDD0[0] = 0xFF; - D_8015FDD0[1] = 0xFF; - D_8015FDD0[2] = 0xFF; + rFactor = sHeartsEnvFactors[0][0] * factor; + gFactor = sHeartsEnvFactors[0][1] * factor; + bFactor = sHeartsEnvFactors[0][2] * factor; - D_8015FDE0[0] = 200; - D_8015FDE0[1] = 0; - D_8015FDE0[2] = 0; + interfaceCtx->beatingHeartEnv[0] = (u8)(s32)(rFactor + HEARTS_ENV_R) & 0xFF; + interfaceCtx->beatingHeartEnv[1] = (u8)(s32)(gFactor + HEARTS_ENV_G) & 0xFF; + interfaceCtx->beatingHeartEnv[2] = (u8)(s32)(bFactor + HEARTS_ENV_B) & 0xFF; - D_8015FDD0[3] = D_8011FF60[0]; - D_8015FDD0[4] = D_8011FF60[1]; - D_8015FDD0[5] = D_8011FF60[2]; + sBeatingHeartsDDPrim[0][0] = HEARTS_DD_PRIM_R; + sBeatingHeartsDDPrim[0][1] = HEARTS_DD_PRIM_G; + sBeatingHeartsDDPrim[0][2] = HEARTS_DD_PRIM_B; - D_8015FDE0[3] = D_8011FF74[0]; - D_8015FDE0[4] = D_8011FF74[1]; - D_8015FDE0[5] = D_8011FF74[2]; + sBeatingHeartsDDEnv[0][0] = HEARTS_DD_ENV_R; + sBeatingHeartsDDEnv[0][1] = HEARTS_DD_ENV_G; + sBeatingHeartsDDEnv[0][2] = HEARTS_DD_ENV_B; - temp1 = D_8011FF88[0]; - temp2 = D_8011FF88[1]; - temp3 = D_8011FF88[2]; - temp1 *= temp_f0; - D_8015FDC0[0] = (u8)(temp1 + 0xFF); - temp2 *= temp_f0; - D_8015FDC0[1] = (u8)(temp2 + 0xFF); - temp3 *= temp_f0; - D_8015FDC0[2] = (u8)(temp3 + 0xFF); + for (prim = &sBeatingHeartsDDPrim[1][0], env = &sBeatingHeartsDDEnv[1][0], i = 0; i < 3; i++) { + prim[i] = sHeartsDDPrimColors[0][i]; + env[i] = sHeartsDDEnvColors[0][i]; + } - temp1 = D_8011FF9C[0]; - temp2 = D_8011FF9C[1]; - temp3 = D_8011FF9C[2]; - temp1 *= temp_f0; - D_8015FDC8[0] = (u8)(temp1 + 0xC8); - temp2 *= temp_f0; - D_8015FDC8[1] = (u8)(temp2 + 0x00); - temp3 *= temp_f0; - D_8015FDC8[2] = (u8)(temp3 + 0x00); + rFactor = sHeartsDDPrimFactors[0][0] * factor; + gFactor = sHeartsDDPrimFactors[0][1] * factor; + bFactor = sHeartsDDPrimFactors[0][2] * factor; + + sHeartsDDPrim[0] = (u8)(s32)(rFactor + HEARTS_DD_PRIM_R) & 0xFF; + sHeartsDDPrim[1] = (u8)(s32)(gFactor + HEARTS_DD_PRIM_G) & 0xFF; + sHeartsDDPrim[2] = (u8)(s32)(bFactor + HEARTS_DD_PRIM_B) & 0xFF; + + rFactor = sHeartsDDEnvFactors[0][0] * factor; + gFactor = sHeartsDDEnvFactors[0][1] * factor; + bFactor = sHeartsDDEnvFactors[0][2] * factor; + + sHeartsDDEnv[0] = (u8)(s32)(rFactor + HEARTS_DD_ENV_R) & 0xFF; + sHeartsDDEnv[1] = (u8)(s32)(gFactor + HEARTS_DD_ENV_G) & 0xFF; + sHeartsDDEnv[2] = (u8)(s32)(bFactor + HEARTS_DD_ENV_B) & 0xFF; } #else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_lifemeter/Health_UpdateData.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_lifemeter/HealthMeter_Update.s") #endif s32 func_80078E18(GlobalContext* globalCtx) { @@ -172,20 +251,26 @@ s32 func_80078E84(GlobalContext* globalCtx) { } else { interfaceCtx->unk_228 = 0x140; interfaceCtx->unk_226 -= 0x10; - if (interfaceCtx->unk_226 <= 0) { interfaceCtx->unk_226 = 0; globalCtx->damagePlayer(globalCtx, -(gSaveContext.health + 1)); return 1; } } - return 0; } -void Health_Draw(GlobalContext* globalCtx) { +void HealthMeter_Draw(GlobalContext* globalCtx) { + static UNK_PTR sHeartTextures[] = { + 0x02000400, 0x02000100, 0x02000100, 0x02000100, 0x02000100, 0x02000100, 0x02000200, 0x02000200, + 0x02000200, 0x02000200, 0x02000200, 0x02000300, 0x02000300, 0x02000300, 0x02000300, 0x02000300, + }; + static UNK_PTR sDDHeartTextures[] = { + 0x02000900, 0x02000600, 0x02000600, 0x02000600, 0x02000600, 0x02000600, 0x02000700, 0x02000700, + 0x02000700, 0x02000700, 0x02000700, 0x02000800, 0x02000800, 0x02000800, 0x02000800, 0x02000800, + }; s32 pad[5]; - u8* heartBgImg; + UNK_PTR heartBgImg; u32 curColorSet; f32 offsetX; f32 offsetY; @@ -222,44 +307,45 @@ void Health_Draw(GlobalContext* globalCtx) { if (curColorSet != 0) { curColorSet = 0; gDPPipeSync(OVERLAY_DISP++); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, interfaceCtx->unk_20E[0], interfaceCtx->unk_20E[2], - interfaceCtx->unk_20E[4], interfaceCtx->healthAlpha); - gDPSetEnvColor(OVERLAY_DISP++, interfaceCtx->unk_21A[0], interfaceCtx->unk_21A[2], - interfaceCtx->unk_21A[4], 0xFF); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, interfaceCtx->heartsPrimR[0], interfaceCtx->heartsPrimG[0], + interfaceCtx->heartsPrimB[0], interfaceCtx->healthAlpha); + gDPSetEnvColor(OVERLAY_DISP++, interfaceCtx->heartsEnvR[0], interfaceCtx->heartsEnvG[0], + interfaceCtx->heartsEnvB[0], 255); } } else if (i == fullHeartCount) { if (curColorSet != 1) { curColorSet = 1; gDPPipeSync(OVERLAY_DISP++); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, interfaceCtx->unk_202[0], interfaceCtx->unk_202[1], - interfaceCtx->unk_202[2], interfaceCtx->healthAlpha); - gDPSetEnvColor(OVERLAY_DISP++, interfaceCtx->unk_208[0], interfaceCtx->unk_208[1], - interfaceCtx->unk_208[2], 0xFF); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, interfaceCtx->beatingHeartPrim[0], + interfaceCtx->beatingHeartPrim[1], interfaceCtx->beatingHeartPrim[2], + interfaceCtx->healthAlpha); + gDPSetEnvColor(OVERLAY_DISP++, interfaceCtx->beatingHeartEnv[0], interfaceCtx->beatingHeartEnv[1], + interfaceCtx->beatingHeartEnv[2], 255); } } else if (i > fullHeartCount) { if (curColorSet != 2) { curColorSet = 2; gDPPipeSync(OVERLAY_DISP++); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, interfaceCtx->unk_20E[0], interfaceCtx->unk_20E[2], - interfaceCtx->unk_20E[4], interfaceCtx->healthAlpha); - gDPSetEnvColor(OVERLAY_DISP++, interfaceCtx->unk_21A[0], interfaceCtx->unk_21A[2], - interfaceCtx->unk_21A[4], 0xFF); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, interfaceCtx->heartsPrimR[0], interfaceCtx->heartsPrimG[0], + interfaceCtx->heartsPrimB[0], interfaceCtx->healthAlpha); + gDPSetEnvColor(OVERLAY_DISP++, interfaceCtx->heartsEnvR[0], interfaceCtx->heartsEnvG[0], + interfaceCtx->heartsEnvB[0], 255); } } else { if (curColorSet != 3) { curColorSet = 3; gDPPipeSync(OVERLAY_DISP++); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, interfaceCtx->unk_20E[1], interfaceCtx->unk_20E[3], - interfaceCtx->unk_20E[5], interfaceCtx->healthAlpha); - gDPSetEnvColor(OVERLAY_DISP++, interfaceCtx->unk_21A[1], interfaceCtx->unk_21A[3], - interfaceCtx->unk_21A[5], 0xFF); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, interfaceCtx->heartsPrimR[1], interfaceCtx->heartsPrimG[1], + interfaceCtx->heartsPrimB[1], interfaceCtx->healthAlpha); + gDPSetEnvColor(OVERLAY_DISP++, interfaceCtx->heartsEnvR[1], interfaceCtx->heartsEnvG[1], + interfaceCtx->heartsEnvB[1], 255); } } if (i < fullHeartCount) { heartBgImg = D_02000400; } else if (i == fullHeartCount) { - heartBgImg = D_8011FFB0[curHeartFraction]; + heartBgImg = sHeartTextures[curHeartFraction]; } else { heartBgImg = D_02000000; } @@ -268,40 +354,43 @@ void Health_Draw(GlobalContext* globalCtx) { if (curColorSet != 4) { curColorSet = 4; gDPPipeSync(OVERLAY_DISP++); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, D_8015FDD0[0], D_8015FDD0[1], D_8015FDD0[2], - interfaceCtx->healthAlpha); - gDPSetEnvColor(OVERLAY_DISP++, D_8015FDE0[0], D_8015FDE0[1], D_8015FDE0[2], 0xFF); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sBeatingHeartsDDPrim[0][0], sBeatingHeartsDDPrim[0][1], + sBeatingHeartsDDPrim[0][2], interfaceCtx->healthAlpha); + gDPSetEnvColor(OVERLAY_DISP++, sBeatingHeartsDDEnv[0][0], sBeatingHeartsDDEnv[0][1], + sBeatingHeartsDDEnv[0][2], 255); } } else if (i == fullHeartCount) { if (curColorSet != 5) { curColorSet = 5; gDPPipeSync(OVERLAY_DISP++); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, D_8015FDC0[0], D_8015FDC0[1], D_8015FDC0[2], + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sHeartsDDPrim[0], sHeartsDDPrim[1], sHeartsDDPrim[2], interfaceCtx->healthAlpha); - gDPSetEnvColor(OVERLAY_DISP++, D_8015FDC8[0], D_8015FDC8[1], D_8015FDC8[2], 0xFF); + gDPSetEnvColor(OVERLAY_DISP++, sHeartsDDEnv[0], sHeartsDDEnv[1], sHeartsDDEnv[2], 0xFF); } } else if (i > fullHeartCount) { if (curColorSet != 6) { curColorSet = 6; gDPPipeSync(OVERLAY_DISP++); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, D_8015FDD0[0], D_8015FDD0[1], D_8015FDD0[2], - interfaceCtx->healthAlpha); - gDPSetEnvColor(OVERLAY_DISP++, D_8015FDE0[0], D_8015FDE0[1], D_8015FDE0[2], 0xFF); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sBeatingHeartsDDPrim[0][0], sBeatingHeartsDDPrim[0][1], + sBeatingHeartsDDPrim[0][2], interfaceCtx->healthAlpha); + gDPSetEnvColor(OVERLAY_DISP++, sBeatingHeartsDDEnv[0][0], sBeatingHeartsDDEnv[0][1], + sBeatingHeartsDDEnv[0][2], 255); } } else { if (curColorSet != 7) { curColorSet = 7; gDPPipeSync(OVERLAY_DISP++); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, D_8015FDD0[3], D_8015FDD0[4], D_8015FDD0[5], - interfaceCtx->healthAlpha); - gDPSetEnvColor(OVERLAY_DISP++, D_8015FDE0[3], D_8015FDE0[4], D_8015FDE0[5], 0xFF); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sBeatingHeartsDDPrim[1][0], sBeatingHeartsDDPrim[1][1], + sBeatingHeartsDDPrim[1][2], interfaceCtx->healthAlpha); + gDPSetEnvColor(OVERLAY_DISP++, sBeatingHeartsDDEnv[1][0], sBeatingHeartsDDEnv[1][1], + sBeatingHeartsDDEnv[1][2], 255); } } if (i < fullHeartCount) { heartBgImg = D_02000900; } else if (i == fullHeartCount) { - heartBgImg = D_8011FFF0[curHeartFraction]; + heartBgImg = sDDHeartTextures[curHeartFraction]; } else { heartBgImg = D_02000500; } @@ -378,7 +467,7 @@ void Health_Draw(GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx, "../z_lifemeter.c", 606); } -void Health_HandleCriticalAlarm(GlobalContext* globalCtx) { +void HealthMeter_HandleCriticalAlarm(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; if (interfaceCtx->unk_22C != 0) { @@ -387,7 +476,7 @@ void Health_HandleCriticalAlarm(GlobalContext* globalCtx) { interfaceCtx->unk_22A = 0; interfaceCtx->unk_22C = 0; if (!Player_InCsMode(globalCtx) && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && - Health_IsCritical() && !Gameplay_InCsMode(globalCtx)) { + HealthMeter_IsCritical() && !Gameplay_InCsMode(globalCtx)) { func_80078884(NA_SE_SY_HITPOINT_ALARM); } } @@ -400,7 +489,7 @@ void Health_HandleCriticalAlarm(GlobalContext* globalCtx) { } } -u32 Health_IsCritical(void) { +u32 HealthMeter_IsCritical(void) { s32 var; if (gSaveContext.healthCapacity <= 0x50) { @@ -414,8 +503,8 @@ u32 Health_IsCritical(void) { } if ((var >= gSaveContext.health) && (gSaveContext.health > 0)) { - return 1; + return true; } else { - return 0; + return false; } } diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index fede83307f..66b9a04835 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -3082,7 +3082,7 @@ void Interface_Draw(GlobalContext* globalCtx) { if (pauseCtx->flag == 0) { Interface_InitVertices(globalCtx); func_8008A994(interfaceCtx); - Health_Draw(globalCtx); + HealthMeter_Draw(globalCtx); func_80094520(globalCtx->state.gfxCtx); @@ -4035,7 +4035,7 @@ void Interface_Update(GlobalContext* globalCtx) { } } - Health_HandleCriticalAlarm(globalCtx); + HealthMeter_HandleCriticalAlarm(globalCtx); D_80125A58 = func_8008F2F8(globalCtx); if (D_80125A58 == 1) { @@ -4048,7 +4048,7 @@ void Interface_Update(GlobalContext* globalCtx) { } } - Health_UpdateData(globalCtx); + HealthMeter_Update(globalCtx); if ((gSaveContext.timer1State >= 3) && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && (msgCtx->msgMode == 0) && !(player->stateFlags2 & 0x01000000) && (globalCtx->sceneLoadFlag == 0) && diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 09e81c15e8..2d55a4d005 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -6748,7 +6748,7 @@ void func_808409CC(GlobalContext* globalCtx, Player* this) { s32 sp34; if ((this->unk_664 != NULL) || - (!(heathIsCritical = Health_IsCritical()) && ((this->unk_6AC = (this->unk_6AC + 1) & 1) != 0))) { + (!(heathIsCritical = HealthMeter_IsCritical()) && ((this->unk_6AC = (this->unk_6AC + 1) & 1) != 0))) { this->stateFlags2 &= ~0x10000000; anim = func_80833338(this); } else {