Files
mm/src/code/z_kaleido_scope_call.c
T
Derek Hensley ab8d34b8dc Play (2 NON_MATCHINGS) (#1109)
* 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>
2023-01-14 12:18:13 -03:00

89 lines
3.6 KiB
C

#include "prevent_bss_reordering.h"
#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_0;
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_0;
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);
}
}
}
}