diff --git a/include/functions.h b/include/functions.h index 1cef380f15..bac7712b2c 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2989,9 +2989,6 @@ u8 func_801A982C(void); // void func_801A99B8(void); // void func_801A9A74(void); -void GameOver_Init(PlayState* play); -void GameOver_FadeLights(PlayState* play); -void GameOver_Update(PlayState* play); void Regs_InitData(PlayState* play); #endif diff --git a/include/z64.h b/include/z64.h index 043219fdb2..6e8e72938f 100644 --- a/include/z64.h +++ b/include/z64.h @@ -39,6 +39,7 @@ #include "z64eff_footmark.h" #include "z64effect.h" #include "z64frameadvance.h" +#include "z64game_over.h" #include "z64interface.h" #include "z64item.h" #include "z64light.h" @@ -615,22 +616,6 @@ typedef struct { /* 0x1 */ u8 ambienceId; } SequenceContext; // size = 0x2 -typedef enum { - /* 0 */ GAMEOVER_INACTIVE, - /* 1 */ GAMEOVER_DEATH_START, - /* 2 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for player to fall and hit the ground - /* 3 */ GAMEOVER_DEATH_FADE_OUT, // wait before fading out - /* 20 */ GAMEOVER_REVIVE_START = 20, - /* 21 */ GAMEOVER_REVIVE_RUMBLE, - /* 22 */ GAMEOVER_REVIVE_WAIT_GROUND, // wait for player to fall and hit the ground - /* 23 */ GAMEOVER_REVIVE_WAIT_FAIRY, // wait for the fairy to rise all the way up out of player's body - /* 24 */ GAMEOVER_REVIVE_FADE_OUT // fade out the game over lights as player is revived and gets back up -} GameOverState; - -typedef struct { - /* 0x0 */ u16 state; -} GameOverContext; // size = 0x2 - typedef struct PlayState { /* 0x00000 */ GameState state; /* 0x000A4 */ s16 sceneId; diff --git a/include/z64game_over.h b/include/z64game_over.h new file mode 100644 index 0000000000..240efdf41e --- /dev/null +++ b/include/z64game_over.h @@ -0,0 +1,30 @@ +#ifndef Z64GAME_OVER_H +#define Z64GAME_OVER_H + +#include "ultra64.h" + +struct PlayState; + + +typedef enum GameOverState { + /* 0 */ GAMEOVER_INACTIVE, + /* 1 */ GAMEOVER_DEATH_START, + /* 2 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for player to fall and hit the ground + /* 3 */ GAMEOVER_DEATH_FADE_OUT, // wait before fading out + /* 20 */ GAMEOVER_REVIVE_START = 20, + /* 21 */ GAMEOVER_REVIVE_RUMBLE, + /* 22 */ GAMEOVER_REVIVE_WAIT_GROUND, // wait for player to fall and hit the ground + /* 23 */ GAMEOVER_REVIVE_WAIT_FAIRY, // wait for the fairy to rise all the way up out of player's body + /* 24 */ GAMEOVER_REVIVE_FADE_OUT // fade out the game over lights as player is revived and gets back up +} GameOverState; + +typedef struct GameOverContext { + /* 0x0 */ u16 state; +} GameOverContext; // size = 0x2 + + +void GameOver_Init(struct PlayState* play); +void GameOver_FadeLights(struct PlayState* play); +void GameOver_Update(struct PlayState* play); + +#endif diff --git a/include/z64shrink_window.h b/include/z64shrink_window.h index 2742fb602e..bff11b9394 100644 --- a/include/z64shrink_window.h +++ b/include/z64shrink_window.h @@ -18,6 +18,6 @@ s32 ShrinkWindow_Pillarbox_GetSize(void); void ShrinkWindow_Init(void); void ShrinkWindow_Destroy(void); void ShrinkWindow_Update(s32 framerateDivisor); -void ShrinkWindow_Draw(GraphicsContext* gfxCtx); +void ShrinkWindow_Draw(struct GraphicsContext* gfxCtx); #endif diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index ec5d3b05ca..01eaf2cd8f 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -1,6 +1,10 @@ -#include "global.h" +#include "z64game_over.h" #include "z64rumble.h" #include "z64shrink_window.h" +#include "z64.h" +#include "functions.h" +#include "variables.h" +#include "macros.h" void GameOver_Init(PlayState* play) { play->gameOverCtx.state = GAMEOVER_INACTIVE; @@ -67,6 +71,7 @@ void GameOver_Update(PlayState* play) { Rumble_Request(0.0f, 126, 124, 63); gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND; break; + case GAMEOVER_DEATH_FADE_OUT: if (Audio_GetActiveSequence(SEQ_PLAYER_FANFARE) != NA_BGM_GAME_OVER) { func_80169F78(&play->state); @@ -83,31 +88,36 @@ void GameOver_Update(PlayState* play) { Rumble_StateReset(); } break; + case GAMEOVER_REVIVE_START: - gameOverCtx->state++; + gameOverCtx->state++; // GAMEOVER_REVIVE_RUMBLE sGameOverTimer = 0; Kankyo_InitGameOverLights(play); ShrinkWindow_Letterbox_SetSizeTarget(32); break; + case GAMEOVER_REVIVE_RUMBLE: sGameOverTimer = 50; - gameOverCtx->state++; + gameOverCtx->state++; // GAMEOVER_REVIVE_WAIT_GROUND Rumble_Request(0.0f, 126, 124, 63); break; + case GAMEOVER_REVIVE_WAIT_GROUND: sGameOverTimer--; if (sGameOverTimer == 0) { sGameOverTimer = 64; - gameOverCtx->state++; + gameOverCtx->state++; // GAMEOVER_REVIVE_WAIT_FAIRY } break; + case GAMEOVER_REVIVE_WAIT_FAIRY: sGameOverTimer--; if (sGameOverTimer == 0) { sGameOverTimer = 50; - gameOverCtx->state++; + gameOverCtx->state++; // GAMEOVER_REVIVE_FADE_OUT } break; + case GAMEOVER_REVIVE_FADE_OUT: Kankyo_FadeOutGameOverLights(play); sGameOverTimer--; diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index d1c42dd73f..4c3ca7ebb0 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -962,7 +962,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->promptChoice = PAUSE_PROMPT_YES; pauseCtx->state++; if (gameOverCtx->state == GAMEOVER_INACTIVE) { - pauseCtx->state++; + pauseCtx->state++; // GAMEOVER_DEATH_START } break;