mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-23 06:54:14 -04:00
ab8d34b8dc
* Bring over progress from another branch
Co-authored-by: Maide <34639600+Kelebek1@users.noreply.github.com>
* cleanup, fake match Play_Init
* small fixes
* Some small cleanup
* Match func_80165460 (from debug)
* Match func_80165658
* Match func_80165DB8, func_80165DCC, func_80165DF0, func_80165E04
* Match func_80167DE4 (from debug)
* Match func_80167F0C
* Match func_80168DAC
* Matched func_80169100
* Matched func_801691F0
* import D_801DFA18
* match Play_Main thanks to debug
* cleanup
* synray does it again
* add docs from debug
* fix func_801656A4
* more docs and cleanup
* Match func_80166B30 and diff fake match in Init
* import transition docs from OoT
* Play Update, sort of
* cleanup Play_Update
* more cleanup
* slightly more docs
* small docs
* Play_Draw WIP Thanks @petrie911
* progress?
* two more matches
* format
* misc play docs
* transitions cleanup
* Motion Blur
* Transitions
* Fog
* Bombers notebook + small cleanup
* bss
* Camera Functions
* Picto functions
* Init
* MotionBlur Clean up
* Floor Surface
* Pictographs some more
* regs
* fix circular dependency problem
* Cleanup PR commits outside play
* namefixer
* PR picto
* PR audio
* PR small clean ups
* debug strings
* Picto defines
* bss
* enums
* remove void
* typedefs
* Hireso -> BombersNotebook
* bss comments
* bss and I8/I5 functions
* Smaller PR comments
* Transitions
* Combine enums
* Revert "Combine enums"
This reverts commit 0da1ebcaed.
* Fix Transition defines
* RGBA16 macros
* Unname
* worldCoverAlpha
* Rename Update and Draw
* PR review, plus annotate bug
* Clean up nonmatchings with a closer DrawGame
* Format
* New macros
* UpdateMain and DrawMain
* Fix merge
* Small cleanups from PR
* zFar
* Intensity macros
* Format
* Remove bss comments
* Compression/decompression
* Small cleanup
* Format
* More PR cleanup
* Cleanup picto stuff
* format
* Fix compression comments
* Play processes state enums DONE -> READY
* cutscene comment
* fix bss
Co-authored-by: Maide <34639600+Kelebek1@users.noreply.github.com>
Co-authored-by: engineer124 <engineer124engineer124@gmail.com>
Co-authored-by: petrie911 <pmontag@PHYS-S129.iowa.uiowa.edu>
Co-authored-by: angie <angheloalf95@gmail.com>
120 lines
4.5 KiB
C
120 lines
4.5 KiB
C
#include "global.h"
|
|
#include "z64rumble.h"
|
|
#include "z64shrink_window.h"
|
|
|
|
void GameOver_Init(PlayState* play) {
|
|
play->gameOverCtx.state = GAMEOVER_INACTIVE;
|
|
}
|
|
|
|
void GameOver_FadeLights(PlayState* play) {
|
|
GameOverContext* gameOverCtx = &play->gameOverCtx;
|
|
|
|
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(play);
|
|
}
|
|
}
|
|
|
|
static s16 sGameOverTimer = 0;
|
|
|
|
void GameOver_Update(PlayState* play) {
|
|
GameOverContext* gameOverCtx = &play->gameOverCtx;
|
|
s16 timerId;
|
|
|
|
switch (gameOverCtx->state) {
|
|
case GAMEOVER_DEATH_START:
|
|
func_801477B4(play);
|
|
|
|
for (timerId = 0; timerId < TIMER_ID_MAX; timerId++) {
|
|
gSaveContext.timerStates[timerId] = TIMER_STATE_OFF;
|
|
}
|
|
|
|
CLEAR_EVENTINF_ALT(EVENTINF_10);
|
|
|
|
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[EQUIP_SLOT_B] != BTN_ENABLED) {
|
|
CUR_FORM_EQUIP(EQUIP_SLOT_B) = gSaveContext.buttonStatus[EQUIP_SLOT_B];
|
|
} else {
|
|
CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE;
|
|
}
|
|
}
|
|
}
|
|
|
|
gSaveContext.unk_3DC0 = 2000;
|
|
gSaveContext.save.playerData.tatlTimer = 0;
|
|
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
|
|
gSaveContext.ambienceId = AMBIENCE_ID_DISABLED;
|
|
gSaveContext.eventInf[0] = 0;
|
|
gSaveContext.eventInf[1] = 0;
|
|
gSaveContext.eventInf[2] = 0;
|
|
gSaveContext.eventInf[3] = 0;
|
|
gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED;
|
|
gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_ENABLED;
|
|
gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED;
|
|
gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED;
|
|
gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED;
|
|
gSaveContext.hudVisibilityForceButtonAlphasByStatus = false;
|
|
gSaveContext.nextHudVisibility = HUD_VISIBILITY_IDLE;
|
|
gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE;
|
|
gSaveContext.hudVisibilityTimer = 0;
|
|
Kankyo_InitGameOverLights(play);
|
|
sGameOverTimer = 20;
|
|
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);
|
|
if (gSaveContext.respawnFlag != -7) {
|
|
gSaveContext.respawnFlag = -6;
|
|
}
|
|
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
|
|
gSaveContext.save.playerData.health = 0x30;
|
|
gameOverCtx->state++;
|
|
if (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU) {
|
|
gSaveContext.save.playerForm = PLAYER_FORM_HUMAN;
|
|
gSaveContext.save.equippedMask = PLAYER_MASK_NONE;
|
|
}
|
|
Rumble_StateReset();
|
|
}
|
|
break;
|
|
case GAMEOVER_REVIVE_START:
|
|
gameOverCtx->state++;
|
|
sGameOverTimer = 0;
|
|
Kankyo_InitGameOverLights(play);
|
|
ShrinkWindow_Letterbox_SetSizeTarget(32);
|
|
break;
|
|
case GAMEOVER_REVIVE_RUMBLE:
|
|
sGameOverTimer = 50;
|
|
gameOverCtx->state++;
|
|
Rumble_Request(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(play);
|
|
sGameOverTimer--;
|
|
if (sGameOverTimer == 0) {
|
|
gameOverCtx->state = GAMEOVER_INACTIVE;
|
|
}
|
|
break;
|
|
}
|
|
}
|