summaryrefslogtreecommitdiff
path: root/src/code/z_parameter.c
diff options
context:
space:
mode:
authorpetrie911 <69443847+petrie911@users.noreply.github.com>2021-09-20 11:51:35 -0500
committerGitHub <noreply@github.com>2021-09-20 12:51:35 -0400
commite51f50f0ff9d79cd4c19fb6519183fd00445719c (patch)
tree2151497dd9464253f6f12f069256790e7eb5c37a /src/code/z_parameter.c
parent50095d427c21465b7560d7178906a3dee3eea090 (diff)
Decompile z_kankyo (#956)
* working * start color switch * progress * progress * progress on bgm func * progress * game over matched (except the rodata meme) * start update * progress * lightning docs done * progress * progress * progress * progress * progress * can compile at least * suns state, progress on kankyo_update * some new names * progress * progress * progress * new functions * cleanup * more matches * another match * now functional * format * better match * hugely improved update * cleanup/review * remove old changes * review2 * review3 * missed one * review4 * change asm filenames * update doorwarp1 * review5 * Kankyo_ -> Environment_ * format * merge master and format functions.h Co-authored-by: Jacob Young <jacobly0@users.noreply.github.com> Co-authored-by: fig <fig02srl@gmail.com> Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Diffstat (limited to 'src/code/z_parameter.c')
-rw-r--r--src/code/z_parameter.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c
index 8e3dda4c8..e896cddcc 100644
--- a/src/code/z_parameter.c
+++ b/src/code/z_parameter.c
@@ -3789,7 +3789,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
void Interface_Update(GlobalContext* globalCtx) {
static u8 D_80125B60 = 0;
- static s16 D_80125B64 = 0;
+ static s16 sPrevTimeIncrement = 0;
MessageContext* msgCtx = &globalCtx->msgCtx;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
Player* player = GET_PLAYER(globalCtx);
@@ -4098,30 +4098,32 @@ void Interface_Update(GlobalContext* globalCtx) {
}
}
- if (gSaveContext.unk_1422 != 0) {
- if ((msgCtx->unk_E3F0 != 0x31) && (gSaveContext.unk_1422 == 1)) {
+ if (gSaveContext.sunsSongState != SUNSSONG_INACTIVE) {
+ // exit out of ocarina mode after suns song finishes playing
+ if ((msgCtx->unk_E3F0 != 0x31) && (gSaveContext.sunsSongState == SUNSSONG_START)) {
globalCtx->msgCtx.unk_E3EE = 4;
}
- if (globalCtx->envCtx.unk_02 != 0) {
- if (gSaveContext.unk_1422 != 2) {
+ // handle suns song in areas where time moves
+ if (globalCtx->envCtx.timeIncrement != 0) {
+ if (gSaveContext.sunsSongState != SUNSSONG_SPEED_TIME) {
D_80125B60 = 0;
if ((gSaveContext.dayTime >= 0x4555) && (gSaveContext.dayTime <= 0xC001)) {
D_80125B60 = 1;
}
- gSaveContext.unk_1422 = 2;
- D_80125B64 = D_8011FB40;
- D_8011FB40 = 400;
+ gSaveContext.sunsSongState = SUNSSONG_SPEED_TIME;
+ sPrevTimeIncrement = gTimeIncrement;
+ gTimeIncrement = 400;
} else if (D_80125B60 == 0) {
if ((gSaveContext.dayTime >= 0x4555) && (gSaveContext.dayTime <= 0xC001)) {
- gSaveContext.unk_1422 = 0;
- D_8011FB40 = D_80125B64;
+ gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
+ gTimeIncrement = sPrevTimeIncrement;
globalCtx->msgCtx.unk_E3EE = 4;
}
} else if (gSaveContext.dayTime > 0xC001) {
- gSaveContext.unk_1422 = 0;
- D_8011FB40 = D_80125B64;
+ gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
+ gTimeIncrement = sPrevTimeIncrement;
globalCtx->msgCtx.unk_E3EE = 4;
}
} else if ((globalCtx->roomCtx.curRoom.unk_03 != 1) && (interfaceCtx->restrictions.sunsSong != 3)) {
@@ -4145,12 +4147,12 @@ void Interface_Update(GlobalContext* globalCtx) {
gSaveContext.respawnFlag = -2;
globalCtx->nextEntranceIndex = gSaveContext.entranceIndex;
globalCtx->sceneLoadFlag = 0x14;
- gSaveContext.unk_1422 = 0;
+ gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
func_800F6964(30);
gSaveContext.seqIndex = 0xFF;
gSaveContext.nightSeqIndex = 0xFF;
} else {
- gSaveContext.unk_1422 = 3;
+ gSaveContext.sunsSongState = SUNSSONG_SPECIAL;
}
}
}