MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / zGameStateSwitchEvent

Function zGameStateSwitchEvent

src/SB/Game/zGameState.cpp:155–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155void zGameStateSwitchEvent(S32 event)
156{
157 S32 old_mode = zGameModeGet();
158 S32 old_state = zGameStateGet();
159 S32 new_mode = -1;
160 S32 new_state = -1;
161
162 if (zGameStateFindEvent(sGameState_DoDispatchTable, eGameState_Count, eGameMode_Game, event,
163 &new_mode, &new_state) ||
164 zGameStateFindEvent(sPauseState_DoDispatchTable, ePauseState_Count, eGameMode_Pause, event,
165 &new_mode, &new_state) ||
166 zGameStateFindEvent(sSaveState_DoDispatchTable, eSaveState_Count, eGameMode_Save, event,
167 &new_mode, &new_state) ||
168 zGameStateFindEvent(sOptionsState_DoDispatchTable, eOptionsState_Count, eGameMode_Options,
169 event, &new_mode, &new_state) ||
170 zGameStateFindEvent(sLoadState_DoDispatchTable, eLoadState_Count, eGameMode_Load, event,
171 &new_mode, &new_state) ||
172 zGameStateFindEvent(sTitleState_DoDispatchTable, eTitleState_Count, eGameMode_Title, event,
173 &new_mode, &new_state) ||
174 zGameStateFindEvent(sIntroState_DoDispatchTable, eIntroState_Count, eGameMode_Intro, event,
175 &new_mode, &new_state))
176 {
177 // yay
178 }
179
180 if (new_mode != old_mode)
181 {
182 zGameModeSwitch((eGameMode)new_mode);
183 }
184
185 if (new_mode != old_mode || new_state != old_state)
186 {
187 zGameStateSwitch(new_state);
188
189 if (new_state == eGameState_Exit)
190 {
191 zEntEvent("MNU4 CONFIRM SFX", eEventPlay);
192 xSerialWipeMainBuffer();
193 }
194 }
195}
196
197void zGameStateSwitch(S32 theNewState)
198{

Callers 2

ZDSP_elcb_eventFunction · 0.70
zUI_ScenePortalUpdateFunction · 0.70

Calls 7

zGameModeGetFunction · 0.85
zGameStateGetFunction · 0.85
zGameStateFindEventFunction · 0.85
xSerialWipeMainBufferFunction · 0.85
zGameModeSwitchFunction · 0.70
zGameStateSwitchFunction · 0.70
zEntEventFunction · 0.50

Tested by

no test coverage detected