summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorengineer124 <engineer124engineer124@gmail.com>2022-04-03 14:54:20 +1000
committerengineer124 <engineer124engineer124@gmail.com>2022-04-03 14:54:20 +1000
commit9ab45197a108525da0c4bff419c538ccb669c17e (patch)
tree64032d348bb14f00096ab6f28b9eff9819c1a60b /src/code
parent4bc4ea3dfada94712fe450e52332dcd3981e075a (diff)
Match another 4 functions
Diffstat (limited to 'src/code')
-rw-r--r--src/code/z_en_item00.c4
-rw-r--r--src/code/z_parameter.c91
2 files changed, 85 insertions, 10 deletions
diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c
index 7100aec71..9dda61d3f 100644
--- a/src/code/z_en_item00.c
+++ b/src/code/z_en_item00.c
@@ -215,7 +215,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
break;
case ITEM00_FLEXIBLE:
case ITEM00_BIG_FAIRY:
- func_80115908(globalCtx, 0x70);
+ Health_ChangeBy(globalCtx, 0x70);
break;
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
@@ -528,7 +528,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
break;
case ITEM00_FLEXIBLE:
case ITEM00_BIG_FAIRY:
- func_80115908(globalCtx, 0x70);
+ Health_ChangeBy(globalCtx, 0x70);
break;
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c
index 73aed66aa..687066760 100644
--- a/src/code/z_parameter.c
+++ b/src/code/z_parameter.c
@@ -171,9 +171,8 @@ s16 sHBAScoreTier = 0;
u16 sMinigameScoreDigits[] = { 0, 0, 0, 0 };
-s32 D_801BF898 = 0;
-
-s32 D_801BF89C = 0;
+s16 D_801BF898 = 0;
+s16 D_801BF89C = 0;
s16 sMagicBarOutlinePrimRed = 255;
s16 sMagicBarOutlinePrimGreen = 255;
@@ -1750,7 +1749,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
return ITEM_NONE;
} else if (item == ITEM_HEART) {
- func_80115908(globalCtx, 0x10);
+ Health_ChangeBy(globalCtx, 0x10);
return item;
} else if (item == ITEM_MAGIC_SMALL) {
@@ -2047,13 +2046,89 @@ void Interface_SetDoAction(GlobalContext* globalCtx, u16 action) {
}
}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_801155B4.s")
+void func_801155B4(GlobalContext* globalCtx, s16 arg1) {
+ InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
+
+ if (((gSaveContext.save.equips.buttonItems[CUR_FORM][0] >= ITEM_SWORD_KOKIRI) &&
+ (gSaveContext.save.equips.buttonItems[CUR_FORM][0] <= ITEM_SWORD_GILDED)) ||
+ (gSaveContext.save.equips.buttonItems[CUR_FORM][0] == ITEM_NONE) ||
+ (gSaveContext.save.equips.buttonItems[CUR_FORM][0] == ITEM_NUT)) {
+ if ((CUR_FORM == PLAYER_FORM_DEKU) && (gSaveContext.save.playerData.magicAcquired == 0)) {
+ interfaceCtx->unk_21E = 0xFD;
+ } else {
+ interfaceCtx->unk_21E = arg1;
+ if (interfaceCtx->unk_21E != 0xA) {
+ osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, 1);
+ DmaMgr_SendRequestImpl(&interfaceCtx->dmaRequest_184, interfaceCtx->doActionSegment + 0x600,
+ (arg1 * 0x180) + SEGMENT_ROM_START(do_action_static), 0x180, 0,
+ &interfaceCtx->loadQueue, NULL);
+ osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
+ }
+
+ interfaceCtx->unk_21C = 1;
+ }
+ } else {
+ interfaceCtx->unk_21C = 0;
+ interfaceCtx->unk_21E = 0;
+ }
+}
+
+void Interface_SetNaviCall(GlobalContext* globalCtx, u16 naviCallState) {
+ InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
+
+ if (((naviCallState == 0x2A) || (naviCallState == 0x2B)) && (interfaceCtx->unk_220 == 0) &&
+ (globalCtx->csCtx.state == 0)) {
+ if (naviCallState == 0x2B) {
+ play_sound(NA_SE_VO_NAVY_CALL);
+ }
+ if (naviCallState == 0x2A) {
+ func_8019FDC8(&D_801DB4A4, NA_SE_VO_NA_HELLO_2, 0x20);
+ }
+ interfaceCtx->unk_220 = 1;
+ D_801BF898 = 0;
+ D_801BF89C = 10;
+ } else if (naviCallState == 0x2C) {
+ if (interfaceCtx->unk_220 != 0) {
+ interfaceCtx->unk_220 = 0;
+ }
+ }
+}
+
+// Interface_LoadActionLabelB?
+void func_80115844(GlobalContext* globalCtx, s16 arg1) {
+ InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
+
+ interfaceCtx->unk_224 = arg1;
+
+ osCreateMesgQueue(&globalCtx->interfaceCtx.loadQueue, &globalCtx->interfaceCtx.loadMsg, 1);
+ DmaMgr_SendRequestImpl(&interfaceCtx->dmaRequest_184, interfaceCtx->doActionSegment + 0x480, (arg1 * 0x180) + SEGMENT_ROM_START(do_action_static), 0x180, 0, &interfaceCtx->loadQueue, NULL);
+ osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
+
+ interfaceCtx->unk_222 = 1;
+}
+
+s32 Health_ChangeBy(GlobalContext* globalCtx, s16 healthChange) {
+
+ if (healthChange > 0) {
+ play_sound(NA_SE_SY_HP_RECOVER);
+ } else if ((gSaveContext.save.playerData.doubleDefense != 0) && (healthChange < 0)) {
+ healthChange >>= 1;
+ }
+
+ gSaveContext.save.playerData.health += healthChange;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80115764.s")
+ if (((void)0, gSaveContext.save.playerData.health) > ((void)0, gSaveContext.save.playerData.healthCapacity)) {
+ gSaveContext.save.playerData.health = gSaveContext.save.playerData.healthCapacity;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80115844.s")
+ if (gSaveContext.save.playerData.health <= 0) {
+ gSaveContext.save.playerData.health = 0;
+ return false;
+ } else {
+ return true;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80115908.s")
void Health_GiveHearts(s16 hearts) {
gSaveContext.save.playerData.healthCapacity += hearts * 0x10;