mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
z_game_over.c (#263)
* game over * Fixes * Revert save field rename * Fix comment indent Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com> * Add bss reordering stuff, fix bss reordering in z_scene_proc * Enum uggestions, fix item id * link -> player in enum comments Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com> Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>
This commit is contained in:
co-authored by
Anghelo Carvajal
EllipticEllipsis
parent
b2747aa8b4
commit
ef53ba8261
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "prevent_bss_reordering.h"
|
||||
|
||||
StackEntry sBootThreadInfo;
|
||||
OSThread sIdleThread;
|
||||
|
||||
+113
-3
@@ -1,7 +1,117 @@
|
||||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_game_over/func_801AA610.s")
|
||||
void GameOver_Init(GlobalContext* globalCtx) {
|
||||
globalCtx->gameOverCtx.state = GAMEOVER_INACTIVE;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_game_over/func_801AA624.s")
|
||||
void GameOver_FadeLights(GlobalContext* globalCtx) {
|
||||
GameOverContext* gameOverCtx = &globalCtx->gameOverCtx;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_game_over/func_801AA68C.s")
|
||||
if ((gameOverCtx->state >= GAMEOVER_DEATH_WAIT_GROUND && gameOverCtx->state < GAMEOVER_REVIVE_START) ||
|
||||
(gameOverCtx->state >= GAMEOVER_REVIVE_RUMBLE && gameOverCtx->state < GAMEOVER_REVIVE_FADE_OUT)) {
|
||||
Kankyo_FadeInGameOverLights(globalCtx);
|
||||
}
|
||||
}
|
||||
|
||||
static s16 sGameOverTimer = 0;
|
||||
|
||||
void GameOver_Update(GlobalContext* globalCtx) {
|
||||
GameOverContext* gameOverCtx = &globalCtx->gameOverCtx;
|
||||
s16 i;
|
||||
|
||||
switch (gameOverCtx->state) {
|
||||
case GAMEOVER_DEATH_START:
|
||||
func_801477B4(globalCtx);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.unk_3DD0); i++) {
|
||||
gSaveContext.unk_3DD0[i] = 0;
|
||||
}
|
||||
|
||||
gSaveContext.eventInf[1] &= ~1;
|
||||
|
||||
if (CUR_FORM == 0) {
|
||||
if (CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_KOKIRI &&
|
||||
CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_RAZOR &&
|
||||
CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_GILDED &&
|
||||
CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_DEITY) {
|
||||
|
||||
if (gSaveContext.buttonStatus[0] != BTN_ENABLED) {
|
||||
CUR_FORM_EQUIP(EQUIP_SLOT_B) = gSaveContext.buttonStatus[0];
|
||||
} else {
|
||||
CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gSaveContext.unk_3DC0 = 2000;
|
||||
gSaveContext.naviTimer = 0;
|
||||
gSaveContext.seqIndex = 0xFF;
|
||||
gSaveContext.nightSeqIndex = 0xFF;
|
||||
gSaveContext.eventInf[0] = 0;
|
||||
gSaveContext.eventInf[1] = 0;
|
||||
gSaveContext.eventInf[2] = 0;
|
||||
gSaveContext.eventInf[3] = 0;
|
||||
gSaveContext.buttonStatus[0] = BTN_ENABLED;
|
||||
gSaveContext.buttonStatus[1] = BTN_ENABLED;
|
||||
gSaveContext.buttonStatus[2] = BTN_ENABLED;
|
||||
gSaveContext.buttonStatus[3] = BTN_ENABLED;
|
||||
gSaveContext.buttonStatus[4] = BTN_ENABLED;
|
||||
gSaveContext.unk_3F1E = 0;
|
||||
gSaveContext.unk_3F20 = 0;
|
||||
gSaveContext.unk_3F22 = 0;
|
||||
gSaveContext.unk_3F24 = 0;
|
||||
Kankyo_InitGameOverLights(globalCtx);
|
||||
sGameOverTimer = 20;
|
||||
func_8013ECE0(0.0f, 126, 124, 63);
|
||||
gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND;
|
||||
break;
|
||||
case GAMEOVER_DEATH_FADE_OUT:
|
||||
if (func_801A8A50(1) != 32) {
|
||||
func_80169F78(globalCtx);
|
||||
if (gSaveContext.respawnFlag != -7) {
|
||||
gSaveContext.respawnFlag = -6;
|
||||
}
|
||||
gSaveContext.nextTransition = 2;
|
||||
gSaveContext.health = 48;
|
||||
gameOverCtx->state++;
|
||||
if (gSaveContext.inventory.items[SLOT(ITEM_MASK_DEKU)] == ITEM_MASK_DEKU) {
|
||||
gSaveContext.playerForm = PLAYER_FORM_HUMAN;
|
||||
gSaveContext.equippedMask = PLAYER_MASK_NONE;
|
||||
}
|
||||
func_8013EE24();
|
||||
}
|
||||
break;
|
||||
case GAMEOVER_REVIVE_START:
|
||||
gameOverCtx->state++;
|
||||
sGameOverTimer = 0;
|
||||
Kankyo_InitGameOverLights(globalCtx);
|
||||
ShrinkWindow_SetLetterboxTarget(32);
|
||||
break;
|
||||
case GAMEOVER_REVIVE_RUMBLE:
|
||||
sGameOverTimer = 50;
|
||||
gameOverCtx->state++;
|
||||
func_8013ECE0(0.0f, 126, 124, 63);
|
||||
break;
|
||||
case GAMEOVER_REVIVE_WAIT_GROUND:
|
||||
sGameOverTimer--;
|
||||
if (sGameOverTimer == 0) {
|
||||
sGameOverTimer = 64;
|
||||
gameOverCtx->state++;
|
||||
}
|
||||
break;
|
||||
case GAMEOVER_REVIVE_WAIT_FAIRY:
|
||||
sGameOverTimer--;
|
||||
if (sGameOverTimer == 0) {
|
||||
sGameOverTimer = 50;
|
||||
gameOverCtx->state++;
|
||||
}
|
||||
break;
|
||||
case GAMEOVER_REVIVE_FADE_OUT:
|
||||
Kankyo_FadeOutGameOverLights(globalCtx);
|
||||
sGameOverTimer--;
|
||||
if (sGameOverTimer == 0) {
|
||||
gameOverCtx->state = GAMEOVER_INACTIVE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -74,11 +74,11 @@
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FBCBC.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FBDEC.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Kankyo_InitGameOverLights.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FBF3C.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Kankyo_FadeInGameOverLights.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FC158.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Kankyo_FadeOutGameOverLights.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FC3DC.s")
|
||||
|
||||
|
||||
@@ -556,22 +556,22 @@ s32 func_80BA4530(EnToto* this, GlobalContext* globalCtx) {
|
||||
|
||||
s32 func_80BA46D8(EnToto* this, GlobalContext* globalCtx) {
|
||||
func_800B7298(globalCtx, NULL, 0x44);
|
||||
func_80152434(globalCtx, D_80BA5120[gSaveContext.playerForm == 4 ? 0 : gSaveContext.playerForm]);
|
||||
func_80152434(globalCtx, D_80BA5120[CUR_FORM]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 func_80BA4740(EnToto* this, GlobalContext* globalCtx) {
|
||||
if (globalCtx->msgCtx.unk1202A == 4) {
|
||||
if (gSaveContext.playerForm == 4) {
|
||||
if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) {
|
||||
gSaveContext.weekEventReg[56] |= 0x10;
|
||||
}
|
||||
if (gSaveContext.playerForm == 3) {
|
||||
if (gSaveContext.playerForm == PLAYER_FORM_DEKU) {
|
||||
gSaveContext.weekEventReg[56] |= 0x20;
|
||||
}
|
||||
if (gSaveContext.playerForm == 2) {
|
||||
if (gSaveContext.playerForm == PLAYER_FORM_ZORA) {
|
||||
gSaveContext.weekEventReg[56] |= 0x40;
|
||||
}
|
||||
if (gSaveContext.playerForm == 1) {
|
||||
if (gSaveContext.playerForm == PLAYER_FORM_GORON) {
|
||||
gSaveContext.weekEventReg[56] |= 0x80;
|
||||
}
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user