Files
mm/src/code/z_kaleido_scope_call.c
T
Derek Hensley 8c961f2b16 Play_Hireso (Bombers Notebook) OK w/ Docs (#1235)
* Start

* Try every function

* Import data

* Docs from message branch

* Fix non-equivalency for func_8016AE1C

* Everything looks NON_MATCHING

* Some more clean up and docs

* Some cleanup

* Small format

* Small improvements here and there

* Match a couple

* Anotha one

* and than there was 1

* and than there were none :)

* Lots of docs

* Finish code docs

* schedule static

* Macros + cleanup

* text ids array cleanup

* Entries cleanup

* Use sBombersNotebookEntries in macros

* Some docs from message branch

* eventIndex -> event

* Remove outdated comments

* PR

* BOMBERS_NOTEBOOK_ENTRY_SIZE

* tables

* Token pasting to simplify

* Some more fixes

* PR pt 1

* Format

* Bring over BombersNotebook docs from z_message branch

Co-authored-by: ZoeyZolotova <zoey.zolotova@gmail.com>

* Full enum glory

* Format

* Name weekeventregs

* typo

* Some comments

* bss

* Review

* bss

* Update src/code/z_play_hireso.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Fix

* Namefixer

* bss

* Format

* 0 = 0x0000

---------

Co-authored-by: ZoeyZolotova <zoey.zolotova@gmail.com>
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
2023-06-06 10:54:50 -04:00

88 lines
3.5 KiB
C

#include "global.h"
#include "z64shrink_window.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
void (*sKaleidoScopeUpdateFunc)(PlayState* play);
void (*sKaleidoScopeDrawFunc)(PlayState* play);
extern void KaleidoScope_Update(PlayState* play);
extern void KaleidoScope_Draw(PlayState* play);
void KaleidoScopeCall_LoadPlayer() {
KaleidoMgrOverlay* playerActorOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR];
if (gKaleidoMgrCurOvl != playerActorOvl) {
if (gKaleidoMgrCurOvl != NULL) {
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
}
KaleidoManager_LoadOvl(playerActorOvl);
}
}
void KaleidoScopeCall_Init(PlayState* play) {
sKaleidoScopeUpdateFunc = KaleidoManager_GetRamAddr(KaleidoScope_Update);
sKaleidoScopeDrawFunc = KaleidoManager_GetRamAddr(KaleidoScope_Draw);
KaleidoSetup_Init(play);
}
void KaleidoScopeCall_Destroy(PlayState* play) {
KaleidoSetup_Destroy(play);
}
void KaleidoScopeCall_Update(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx;
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
if ((play->pauseCtx.state != PAUSE_STATE_OFF) || (play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) {
if ((pauseCtx->state == PAUSE_STATE_OPENING_0) || (pauseCtx->state == PAUSE_STATE_OWLWARP_0)) {
if (ShrinkWindow_Letterbox_GetSize() == 0) {
R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP;
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_APPEARING;
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1;
}
} else if (pauseCtx->state == PAUSE_STATE_GAMEOVER_0) {
R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP;
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_APPEARING;
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1;
} else if ((pauseCtx->state == PAUSE_STATE_OPENING_1) || (pauseCtx->state == PAUSE_STATE_GAMEOVER_1) ||
(pauseCtx->state == PAUSE_STATE_OWLWARP_1)) {
if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_READY) {
pauseCtx->state++;
}
} else if (pauseCtx->state != PAUSE_STATE_OFF) {
if (gKaleidoMgrCurOvl != kaleidoScopeOvl) {
if (gKaleidoMgrCurOvl != NULL) {
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
}
KaleidoManager_LoadOvl(kaleidoScopeOvl);
}
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
sKaleidoScopeUpdateFunc(play);
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) {
KaleidoManager_ClearOvl(kaleidoScopeOvl);
KaleidoScopeCall_LoadPlayer();
}
}
}
}
}
void KaleidoScopeCall_Draw(PlayState* play) {
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_READY) {
if (((play->pauseCtx.state >= PAUSE_STATE_OPENING_3) && (play->pauseCtx.state <= PAUSE_STATE_SAVEPROMPT)) ||
((play->pauseCtx.state >= PAUSE_STATE_GAMEOVER_3) && (play->pauseCtx.state <= PAUSE_STATE_UNPAUSE_SETUP))) {
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
sKaleidoScopeDrawFunc(play);
}
}
}
}