2020-10-03 15:22:44 +00:00
|
|
|
#include "global.h"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
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[];
|
|
|
|
|
|
|
|
s16 D_8015FDC0[3];
|
|
|
|
s16 D_8015FDC8[3];
|
|
|
|
s16 D_8015FDD0[6];
|
|
|
|
s16 D_8015FDE0[6];
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
void Health_InitData(GlobalContext* globalCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
|
|
|
|
|
|
|
interfaceCtx->unk_228 = 0x140;
|
|
|
|
interfaceCtx->unk_226 = gSaveContext.health;
|
|
|
|
interfaceCtx->unk_22A = interfaceCtx->unk_1FE = 0;
|
|
|
|
interfaceCtx->unk_22C = interfaceCtx->unk_200 = 0;
|
|
|
|
|
2020-07-17 01:37:53 +00:00
|
|
|
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->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;
|
|
|
|
|
|
|
|
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;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NON_MATCHING
|
2020-03-23 00:38:25 +00:00
|
|
|
// this function still needs some work but it should be functionally equivalent
|
2020-03-22 21:19:43 +00:00
|
|
|
void Health_UpdateData(GlobalContext* globalCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
|
|
|
f32 temp_f0 = interfaceCtx->unk_1FE * 0.1f;
|
|
|
|
s16 temp1, temp2, temp3;
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (0) {}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (interfaceCtx->unk_200 != 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_1FE--;
|
2020-03-22 21:19:43 +00:00
|
|
|
if (interfaceCtx->unk_1FE <= 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_1FE = 0;
|
|
|
|
interfaceCtx->unk_200 = 0;
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_1FE++;
|
2020-03-22 21:19:43 +00:00
|
|
|
if (interfaceCtx->unk_1FE >= 10) {
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_1FE = 10;
|
|
|
|
interfaceCtx->unk_200 = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-17 01:37:53 +00:00
|
|
|
interfaceCtx->unk_20E[0] = 255;
|
|
|
|
interfaceCtx->unk_20E[2] = 70;
|
|
|
|
interfaceCtx->unk_20E[4] = 50;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-07-17 01:37:53 +00:00
|
|
|
interfaceCtx->unk_21A[0] = 50;
|
|
|
|
interfaceCtx->unk_21A[2] = 40;
|
|
|
|
interfaceCtx->unk_21A[4] = 60;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
interfaceCtx->unk_20E[1] = D_8011FF10[0];
|
|
|
|
interfaceCtx->unk_20E[3] = D_8011FF10[1];
|
|
|
|
interfaceCtx->unk_20E[5] = D_8011FF10[2];
|
|
|
|
|
|
|
|
interfaceCtx->unk_21A[1] = D_8011FF24[0];
|
|
|
|
interfaceCtx->unk_21A[3] = D_8011FF24[1];
|
|
|
|
interfaceCtx->unk_21A[5] = D_8011FF24[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);
|
|
|
|
|
|
|
|
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;
|
2020-06-30 18:44:07 +00:00
|
|
|
interfaceCtx->unk_208[2] = (u8)(temp3 + 0x3C);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
D_8015FDD0[0] = 0xFF;
|
|
|
|
D_8015FDD0[1] = 0xFF;
|
|
|
|
D_8015FDD0[2] = 0xFF;
|
|
|
|
|
2020-07-17 01:37:53 +00:00
|
|
|
D_8015FDE0[0] = 200;
|
|
|
|
D_8015FDE0[1] = 0;
|
|
|
|
D_8015FDE0[2] = 0;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
D_8015FDD0[3] = D_8011FF60[0];
|
|
|
|
D_8015FDD0[4] = D_8011FF60[1];
|
|
|
|
D_8015FDD0[5] = D_8011FF60[2];
|
|
|
|
|
|
|
|
D_8015FDE0[3] = D_8011FF74[0];
|
|
|
|
D_8015FDE0[4] = D_8011FF74[1];
|
|
|
|
D_8015FDE0[5] = D_8011FF74[2];
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#pragma GLOBAL_ASM("asm/non_matchings/code/z_lifemeter/Health_UpdateData.s")
|
|
|
|
#endif
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
s32 func_80078E18(GlobalContext* globalCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
gSaveContext.health = globalCtx->interfaceCtx.unk_226;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
s32 func_80078E34(GlobalContext* globalCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
|
|
|
|
|
|
|
interfaceCtx->unk_228 = 0x140;
|
|
|
|
interfaceCtx->unk_226 += 0x10;
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (interfaceCtx->unk_226 >= gSaveContext.health) {
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_226 = gSaveContext.health;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
s32 func_80078E84(GlobalContext* globalCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (interfaceCtx->unk_228 != 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_228--;
|
2020-03-22 21:19:43 +00:00
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_228 = 0x140;
|
|
|
|
interfaceCtx->unk_226 -= 0x10;
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (interfaceCtx->unk_226 <= 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_226 = 0;
|
2020-09-19 01:45:39 +00:00
|
|
|
globalCtx->damagePlayer(globalCtx, -(gSaveContext.health + 1));
|
2020-03-17 04:31:30 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-05-01 15:09:20 +00:00
|
|
|
void Health_Draw(GlobalContext* globalCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
s32 pad[5];
|
|
|
|
u8* heartBgImg;
|
|
|
|
u32 curColorSet;
|
|
|
|
f32 offsetX;
|
|
|
|
f32 offsetY;
|
|
|
|
s32 i;
|
|
|
|
f32 temp1;
|
|
|
|
f32 temp2;
|
|
|
|
f32 temp3;
|
|
|
|
f32 temp4;
|
|
|
|
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
|
|
|
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
|
|
|
Vtx* sp154 = interfaceCtx->vtx_12C;
|
|
|
|
s32 curHeartFraction = gSaveContext.health % 0x10;
|
2020-04-16 21:36:12 +00:00
|
|
|
s16 totalHeartCount = gSaveContext.healthCapacity / 0x10;
|
2020-03-17 04:31:30 +00:00
|
|
|
s16 fullHeartCount = gSaveContext.health / 0x10;
|
|
|
|
s32 pad2;
|
|
|
|
f32 sp144 = interfaceCtx->unk_22A * 0.1f;
|
|
|
|
s32 curCombineModeSet = 0;
|
|
|
|
u8* curBgImgLoaded = NULL;
|
2020-10-11 17:45:08 +00:00
|
|
|
s32 ddHeartCountMinusOne = gSaveContext.inventory.defenseHearts - 1;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
OPEN_DISPS(gfxCtx, "../z_lifemeter.c", 353);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (!(gSaveContext.health % 0x10)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
fullHeartCount--;
|
2020-03-22 21:19:43 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
curColorSet = -1;
|
|
|
|
offsetY = 0.0f;
|
|
|
|
offsetX = 0.0f;
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
for (i = 0; i < totalHeartCount; i++) {
|
|
|
|
if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) {
|
|
|
|
if (i < fullHeartCount) {
|
|
|
|
if (curColorSet != 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
curColorSet = 0;
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPPipeSync(oGfxCtx->overlay.p++);
|
|
|
|
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_20E[0], interfaceCtx->unk_20E[2],
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_20E[4], interfaceCtx->healthAlpha);
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPSetEnvColor(oGfxCtx->overlay.p++, interfaceCtx->unk_21A[0], interfaceCtx->unk_21A[2],
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_21A[4], 0xFF);
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
} else if (i == fullHeartCount) {
|
|
|
|
if (curColorSet != 1) {
|
2020-03-17 04:31:30 +00:00
|
|
|
curColorSet = 1;
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPPipeSync(oGfxCtx->overlay.p++);
|
|
|
|
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_202[0], interfaceCtx->unk_202[1],
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_202[2], interfaceCtx->healthAlpha);
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPSetEnvColor(oGfxCtx->overlay.p++, interfaceCtx->unk_208[0], interfaceCtx->unk_208[1],
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_208[2], 0xFF);
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
} else if (i > fullHeartCount) {
|
|
|
|
if (curColorSet != 2) {
|
2020-03-17 04:31:30 +00:00
|
|
|
curColorSet = 2;
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPPipeSync(oGfxCtx->overlay.p++);
|
|
|
|
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_20E[0], interfaceCtx->unk_20E[2],
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_20E[4], interfaceCtx->healthAlpha);
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPSetEnvColor(oGfxCtx->overlay.p++, interfaceCtx->unk_21A[0], interfaceCtx->unk_21A[2],
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_21A[4], 0xFF);
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
} else {
|
|
|
|
if (curColorSet != 3) {
|
2020-03-17 04:31:30 +00:00
|
|
|
curColorSet = 3;
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPPipeSync(oGfxCtx->overlay.p++);
|
|
|
|
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_20E[1], interfaceCtx->unk_20E[3],
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_20E[5], interfaceCtx->healthAlpha);
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPSetEnvColor(oGfxCtx->overlay.p++, interfaceCtx->unk_21A[1], interfaceCtx->unk_21A[3],
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_21A[5], 0xFF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (i < fullHeartCount) {
|
2020-03-17 04:31:30 +00:00
|
|
|
heartBgImg = D_02000400;
|
2020-03-22 21:19:43 +00:00
|
|
|
} else if (i == fullHeartCount) {
|
2020-03-17 04:31:30 +00:00
|
|
|
heartBgImg = D_8011FFB0[curHeartFraction];
|
2020-03-22 21:19:43 +00:00
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
heartBgImg = D_02000000;
|
2020-03-22 21:19:43 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (i < fullHeartCount) {
|
|
|
|
if (curColorSet != 4) {
|
2020-03-17 04:31:30 +00:00
|
|
|
curColorSet = 4;
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPPipeSync(oGfxCtx->overlay.p++);
|
|
|
|
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, D_8015FDD0[0], D_8015FDD0[1], D_8015FDD0[2],
|
2020-03-22 21:19:43 +00:00
|
|
|
interfaceCtx->healthAlpha);
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPSetEnvColor(oGfxCtx->overlay.p++, D_8015FDE0[0], D_8015FDE0[1], D_8015FDE0[2], 0xFF);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
} else if (i == fullHeartCount) {
|
|
|
|
if (curColorSet != 5) {
|
2020-03-17 04:31:30 +00:00
|
|
|
curColorSet = 5;
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPPipeSync(oGfxCtx->overlay.p++);
|
|
|
|
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, D_8015FDC0[0], D_8015FDC0[1], D_8015FDC0[2],
|
2020-03-22 21:19:43 +00:00
|
|
|
interfaceCtx->healthAlpha);
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPSetEnvColor(oGfxCtx->overlay.p++, D_8015FDC8[0], D_8015FDC8[1], D_8015FDC8[2], 0xFF);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
} else if (i > fullHeartCount) {
|
|
|
|
if (curColorSet != 6) {
|
2020-03-17 04:31:30 +00:00
|
|
|
curColorSet = 6;
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPPipeSync(oGfxCtx->overlay.p++);
|
|
|
|
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, D_8015FDD0[0], D_8015FDD0[1], D_8015FDD0[2],
|
2020-03-22 21:19:43 +00:00
|
|
|
interfaceCtx->healthAlpha);
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPSetEnvColor(oGfxCtx->overlay.p++, D_8015FDE0[0], D_8015FDE0[1], D_8015FDE0[2], 0xFF);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
} else {
|
|
|
|
if (curColorSet != 7) {
|
2020-03-17 04:31:30 +00:00
|
|
|
curColorSet = 7;
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPPipeSync(oGfxCtx->overlay.p++);
|
|
|
|
gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, D_8015FDD0[3], D_8015FDD0[4], D_8015FDD0[5],
|
2020-03-22 21:19:43 +00:00
|
|
|
interfaceCtx->healthAlpha);
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPSetEnvColor(oGfxCtx->overlay.p++, D_8015FDE0[3], D_8015FDE0[4], D_8015FDE0[5], 0xFF);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (i < fullHeartCount) {
|
2020-03-17 04:31:30 +00:00
|
|
|
heartBgImg = D_02000900;
|
2020-03-22 21:19:43 +00:00
|
|
|
} else if (i == fullHeartCount) {
|
2020-03-17 04:31:30 +00:00
|
|
|
heartBgImg = D_8011FFF0[curHeartFraction];
|
2020-03-22 21:19:43 +00:00
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
heartBgImg = D_02000500;
|
2020-03-22 21:19:43 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (curBgImgLoaded != heartBgImg) {
|
2020-03-17 04:31:30 +00:00
|
|
|
curBgImgLoaded = heartBgImg;
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPLoadTextureBlock(oGfxCtx->overlay.p++, heartBgImg, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 0,
|
2020-03-22 21:19:43 +00:00
|
|
|
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
2020-03-17 04:31:30 +00:00
|
|
|
G_TX_NOLOD, G_TX_NOLOD);
|
|
|
|
}
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (i != fullHeartCount) {
|
|
|
|
if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) {
|
|
|
|
if (curCombineModeSet != 1) {
|
2020-03-17 04:31:30 +00:00
|
|
|
curCombineModeSet = 1;
|
|
|
|
func_80094520(gfxCtx);
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0,
|
2020-03-22 21:19:43 +00:00
|
|
|
PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE,
|
|
|
|
0);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
} else {
|
|
|
|
if (curCombineModeSet != 3) {
|
2020-03-17 04:31:30 +00:00
|
|
|
curCombineModeSet = 3;
|
|
|
|
func_80094520(gfxCtx);
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPSetCombineLERP(oGfxCtx->overlay.p++, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0,
|
2020-03-22 21:19:43 +00:00
|
|
|
PRIMITIVE, 0, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
temp3 = 26.0f + offsetY;
|
|
|
|
temp2 = 30.0f + offsetX;
|
|
|
|
temp4 = 1.0f;
|
|
|
|
temp4 /= 0.68f;
|
|
|
|
temp4 *= 1024.0f;
|
|
|
|
temp1 = 8.0f;
|
|
|
|
temp1 *= 0.68f;
|
2020-08-29 23:00:17 +00:00
|
|
|
gSPTextureRectangle(oGfxCtx->overlay.p++, (s32)((temp2 - temp1) * 4), (s32)((temp3 - temp1) * 4),
|
2020-03-22 21:19:43 +00:00
|
|
|
(s32)((temp2 + temp1) * 4), (s32)((temp3 + temp1) * 4), G_TX_RENDERTILE, 0, 0,
|
2020-03-17 04:31:30 +00:00
|
|
|
(s32)temp4, (s32)temp4);
|
2020-03-22 21:19:43 +00:00
|
|
|
} else {
|
|
|
|
if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) {
|
|
|
|
if (curCombineModeSet != 2) {
|
2020-03-17 04:31:30 +00:00
|
|
|
curCombineModeSet = 2;
|
|
|
|
func_80094A14(gfxCtx);
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0,
|
2020-03-22 21:19:43 +00:00
|
|
|
PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE,
|
|
|
|
0);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
} else {
|
|
|
|
if (curCombineModeSet != 4) {
|
2020-03-17 04:31:30 +00:00
|
|
|
curCombineModeSet = 4;
|
|
|
|
func_80094A14(gfxCtx);
|
2020-08-29 23:00:17 +00:00
|
|
|
gDPSetCombineLERP(oGfxCtx->overlay.p++, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0,
|
2020-03-22 21:19:43 +00:00
|
|
|
PRIMITIVE, 0, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
{
|
2020-03-17 04:31:30 +00:00
|
|
|
Mtx* matrix = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
|
|
|
func_800D2CEC(matrix, 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144),
|
|
|
|
-130.0f + offsetX, 94.5f - offsetY, 0.0f);
|
2020-08-29 23:00:17 +00:00
|
|
|
gSPMatrix(oGfxCtx->overlay.p++, matrix, G_MTX_MODELVIEW | G_MTX_LOAD);
|
|
|
|
gSPVertex(oGfxCtx->overlay.p++, sp154, 4, 0);
|
|
|
|
gSP1Quadrangle(oGfxCtx->overlay.p++, 0, 2, 3, 1, 0);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
offsetX += 10.0f;
|
2020-03-22 21:19:43 +00:00
|
|
|
if (i == 9) {
|
2020-03-17 04:31:30 +00:00
|
|
|
offsetY += 10.0f;
|
|
|
|
offsetX = 0.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
CLOSE_DISPS(gfxCtx, "../z_lifemeter.c", 606);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
void Health_HandleCriticalAlarm(GlobalContext* globalCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (interfaceCtx->unk_22C != 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_22A--;
|
2020-03-22 21:19:43 +00:00
|
|
|
if (interfaceCtx->unk_22A <= 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_22A = 0;
|
|
|
|
interfaceCtx->unk_22C = 0;
|
2020-09-19 01:45:39 +00:00
|
|
|
if (!Player_InCsMode(globalCtx) && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) &&
|
2020-04-16 21:36:12 +00:00
|
|
|
Health_IsCritical() && !Gameplay_InCsMode(globalCtx)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
func_80078884(NA_SE_SY_HITPOINT_ALARM);
|
|
|
|
}
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_22A++;
|
2020-03-22 21:19:43 +00:00
|
|
|
if (interfaceCtx->unk_22A >= 10) {
|
2020-03-17 04:31:30 +00:00
|
|
|
interfaceCtx->unk_22A = 10;
|
|
|
|
interfaceCtx->unk_22C = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
u32 Health_IsCritical(void) {
|
2020-03-17 04:31:30 +00:00
|
|
|
s32 var;
|
|
|
|
|
2020-04-16 21:36:12 +00:00
|
|
|
if (gSaveContext.healthCapacity <= 0x50) {
|
2020-03-17 04:31:30 +00:00
|
|
|
var = 0x10;
|
2020-04-16 21:36:12 +00:00
|
|
|
} else if (gSaveContext.healthCapacity <= 0xA0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
var = 0x18;
|
2020-04-16 21:36:12 +00:00
|
|
|
} else if (gSaveContext.healthCapacity <= 0xF0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
var = 0x20;
|
2020-03-22 21:19:43 +00:00
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
var = 0x2C;
|
2020-03-22 21:19:43 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if ((var >= gSaveContext.health) && (gSaveContext.health > 0)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
return 1;
|
2020-03-22 21:19:43 +00:00
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
return 0;
|
2020-03-22 21:19:43 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|