Shipwright/soh/src/code/z_kaleido_scope_call.c
Baoulettes a5df9dddf0
Use Macro for __FILE__ & __LINE__ when possible (#559)
* First batch some overlay

* Almost all overlay

* effect & gamestate

* kaleido stuffs

* more overlay

* more left over from code folder

* remaining hardcoded line and file

* Open & Close _DISP __FILE__ & __LINE__ clean up

* Some if (1) {} remove

* LOG_xxxx __FILE__ , __LINE__ cleaned

* ASSERT macro __FILE__ __LINE__

* mtx without line/file in functions

* " if (1) {} " & "if (0) {}" and tab/white place

* LogUtils as macro

* GameState_, GameAlloc_, SystemArena_ & ZeldaArena_

* Revert "GameState_, GameAlloc_, SystemArena_ & ZeldaArena_"

This reverts commit 0d85caaf7e.

* Like last commit but as macro

* Fix matrix not using macros

* use function not macro

* DebugArena_* functions
GameAlloc_MallocDebug
BgCheck_PosErrorCheck as macros
removed issues with ; in macro file
2022-07-05 19:29:34 -04:00

133 lines
4.8 KiB
C

#include "global.h"
#include "vt.h"
void (*sKaleidoScopeUpdateFunc)(GlobalContext* globalCtx);
void (*sKaleidoScopeDrawFunc)(GlobalContext* globalCtx);
f32 gBossMarkScale;
u32 D_8016139C;
PauseMapMarksData* gLoadedPauseMarkDataTable;
extern void KaleidoScope_Update(GlobalContext* globalCtx);
extern void KaleidoScope_Draw(GlobalContext* globalCtx);
void KaleidoScopeCall_LoadPlayer() {
KaleidoMgrOverlay* playerActorOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR];
if (gKaleidoMgrCurOvl != playerActorOvl) {
if (gKaleidoMgrCurOvl != NULL) {
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("カレイド領域 強制排除\n"); // "Kaleido area forced exclusion"
osSyncPrintf(VT_RST);
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
}
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("プレイヤーアクター搬入\n"); // "Player actor import"
osSyncPrintf(VT_RST);
KaleidoManager_LoadOvl(playerActorOvl);
}
}
void KaleidoScopeCall_Init(GlobalContext* globalCtx) {
// "Kaleidoscope replacement construction"
osSyncPrintf("カレイド・スコープ入れ替え コンストラクト \n");
sKaleidoScopeUpdateFunc = KaleidoManager_GetRamAddr(KaleidoScope_Update);
sKaleidoScopeDrawFunc = KaleidoManager_GetRamAddr(KaleidoScope_Draw);
LOG_ADDRESS("kaleido_scope_move", KaleidoScope_Update);
LOG_ADDRESS("kaleido_scope_move_func", sKaleidoScopeUpdateFunc);
LOG_ADDRESS("kaleido_scope_draw", KaleidoScope_Draw);
LOG_ADDRESS("kaleido_scope_draw_func", sKaleidoScopeDrawFunc);
KaleidoSetup_Init(globalCtx);
}
void KaleidoScopeCall_Destroy(GlobalContext* globalCtx) {
// "Kaleidoscope replacement destruction"
osSyncPrintf("カレイド・スコープ入れ替え デストラクト \n");
KaleidoSetup_Destroy(globalCtx);
}
void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
PauseContext* pauseCtx = &globalCtx->pauseCtx;
if ((pauseCtx->state != 0) || (pauseCtx->debugState != 0)) {
if (pauseCtx->state == 1) {
if (ShrinkWindow_GetCurrentVal() == 0) {
HREG(80) = 7;
HREG(82) = 3;
R_PAUSE_MENU_MODE = 3;
pauseCtx->unk_1E4 = 0;
pauseCtx->unk_1EC = 0;
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1;
}
} else if (pauseCtx->state == 8) {
HREG(80) = 7;
HREG(82) = 3;
R_PAUSE_MENU_MODE = 1;
pauseCtx->unk_1E4 = 0;
pauseCtx->unk_1EC = 0;
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1;
} else if ((pauseCtx->state == 2) || (pauseCtx->state == 9)) {
osSyncPrintf("PR_KAREIDOSCOPE_MODE=%d\n", R_PAUSE_MENU_MODE);
if (R_PAUSE_MENU_MODE >= 3) {
pauseCtx->state++;
}
} else if (pauseCtx->state != 0) {
if (gKaleidoMgrCurOvl != kaleidoScopeOvl)
{
if (gKaleidoMgrCurOvl != NULL) {
osSyncPrintf(VT_FGCOL(GREEN));
// "Kaleido area Player Forced Elimination"
osSyncPrintf("カレイド領域 プレイヤー 強制排除\n");
osSyncPrintf(VT_RST);
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
}
osSyncPrintf(VT_FGCOL(GREEN));
// "Kaleido area Kaleidoscope loading"
osSyncPrintf("カレイド領域 カレイドスコープ搬入\n");
osSyncPrintf(VT_RST);
KaleidoManager_LoadOvl(kaleidoScopeOvl);
}
if (gKaleidoMgrCurOvl == kaleidoScopeOvl)
{
sKaleidoScopeUpdateFunc(globalCtx);
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) {
osSyncPrintf(VT_FGCOL(GREEN));
// "Kaleido area Kaleidoscope Emission"
osSyncPrintf("カレイド領域 カレイドスコープ排出\n");
osSyncPrintf(VT_RST);
KaleidoManager_ClearOvl(kaleidoScopeOvl);
KaleidoScopeCall_LoadPlayer();
}
}
}
}
}
void KaleidoScopeCall_Draw(GlobalContext* globalCtx) {
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
if (R_PAUSE_MENU_MODE >= 3) {
if (((globalCtx->pauseCtx.state >= 4) && (globalCtx->pauseCtx.state <= 7)) ||
((globalCtx->pauseCtx.state >= 11) && (globalCtx->pauseCtx.state <= 18))) {
if (gKaleidoMgrCurOvl == kaleidoScopeOvl)
{
sKaleidoScopeDrawFunc(globalCtx);
}
}
}
}