mirror of
https://github.com/zeldaret/mm.git
synced 2026-06-05 03:07:33 -04:00
45eed680d6
* First pass * import bss * cleanup warnings * PadMgr_ControllerHasRumblePak * z64rumble.h * rename file to z_rumble.c * format * Update src/code/z_rumble.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_rumble.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * name a temp * minor cleaning * bss * match code_80182CE0 * import data and cleanups * Rename RumbleManager struct and sys_rumble file * Rename functions from sys_rumble * Rename parameter to distSq Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * more notes and a bit of cleaning * Name Rumble_Add and Rumble_AddForced * some extra notes * Rename Rumble_Override and Rumble_Request * document states * minor renames * actorfixer * format * very minor docs * whoops * remove redundant prevent_bss_reordering * Update src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * namefixer * Update src/code/sys_rumble.c Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * fix * Elliptic review Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> * minor cleanups * Update include/z64rumble.h Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com> * review Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> * Update src/code/sys_rumble.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_rumble.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * review Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
119 lines
4.2 KiB
C
119 lines
4.2 KiB
C
#include "global.h"
|
|
#include "z64rumble.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 i;
|
|
|
|
switch (gameOverCtx->state) {
|
|
case GAMEOVER_DEATH_START:
|
|
func_801477B4(play);
|
|
|
|
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.save.playerData.tatlTimer = 0;
|
|
gSaveContext.seqIndex = (u8)NA_BGM_DISABLED;
|
|
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(play);
|
|
sGameOverTimer = 20;
|
|
Rumble_Request(0.0f, 126, 124, 63);
|
|
gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND;
|
|
break;
|
|
case GAMEOVER_DEATH_FADE_OUT:
|
|
if (func_801A8A50(1) != NA_BGM_GAME_OVER) {
|
|
func_80169F78(&play->state);
|
|
if (gSaveContext.respawnFlag != -7) {
|
|
gSaveContext.respawnFlag = -6;
|
|
}
|
|
gSaveContext.nextTransition = 2;
|
|
gSaveContext.save.playerData.health = 48;
|
|
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_SetLetterboxTarget(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;
|
|
}
|
|
}
|