blob: 003f5dd7b7b21f4731679a4871fa184294ed1dca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
#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;
}
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)) {
Environment_FadeInGameOverLights(play);
}
}
static s16 sGameOverTimer = 0;
void GameOver_Update(PlayState* play) {
GameOverContext* gameOverCtx = &play->gameOverCtx;
s16 timerId;
switch (gameOverCtx->state) {
case GAMEOVER_DEATH_START:
Message_CloseTextbox(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.nayrusLoveTimer = 2000;
gSaveContext.save.saveInfo.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;
Environment_InitGameOverLights(play);
sGameOverTimer = 20;
Rumble_Request(0.0f, 126, 124, 63);
gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND;
break;
case GAMEOVER_DEATH_FADE_OUT:
if (AudioSeq_GetActiveSeqId(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.saveInfo.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++; // GAMEOVER_REVIVE_RUMBLE
sGameOverTimer = 0;
Environment_InitGameOverLights(play);
ShrinkWindow_Letterbox_SetSizeTarget(32);
break;
case GAMEOVER_REVIVE_RUMBLE:
sGameOverTimer = 50;
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++; // GAMEOVER_REVIVE_WAIT_FAIRY
}
break;
case GAMEOVER_REVIVE_WAIT_FAIRY:
sGameOverTimer--;
if (sGameOverTimer == 0) {
sGameOverTimer = 50;
gameOverCtx->state++; // GAMEOVER_REVIVE_FADE_OUT
}
break;
case GAMEOVER_REVIVE_FADE_OUT:
Environment_FadeOutGameOverLights(play);
sGameOverTimer--;
if (sGameOverTimer == 0) {
gameOverCtx->state = GAMEOVER_INACTIVE;
}
break;
}
}
|