2020-10-03 15:22:44 +00:00
|
|
|
#include "global.h"
|
2022-11-01 23:17:11 +00:00
|
|
|
#include "terminal.h"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2024-09-12 18:10:43 +00:00
|
|
|
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \
|
|
|
|
"ntsc-1.2:128"
|
2024-04-14 21:51:32 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void (*sKaleidoScopeUpdateFunc)(PlayState* play);
|
|
|
|
void (*sKaleidoScopeDrawFunc)(PlayState* play);
|
2021-05-02 23:15:16 +00:00
|
|
|
f32 gBossMarkScale;
|
2020-03-17 04:31:30 +00:00
|
|
|
u32 D_8016139C;
|
2021-05-02 23:15:16 +00:00
|
|
|
PauseMapMarksData* gLoadedPauseMarkDataTable;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
extern void KaleidoScope_Update(PlayState* play);
|
|
|
|
extern void KaleidoScope_Draw(PlayState* play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-03-21 19:49:11 +00:00
|
|
|
void KaleidoScopeCall_LoadPlayer(void) {
|
2021-05-02 23:15:16 +00:00
|
|
|
KaleidoMgrOverlay* playerActorOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR];
|
2020-10-13 03:15:42 +00:00
|
|
|
|
|
|
|
if (gKaleidoMgrCurOvl != playerActorOvl) {
|
2021-05-02 23:15:16 +00:00
|
|
|
if (gKaleidoMgrCurOvl != NULL) {
|
2024-01-12 15:38:13 +00:00
|
|
|
PRINTF(VT_FGCOL(GREEN));
|
2024-08-24 15:47:45 +00:00
|
|
|
PRINTF(T("カレイド領域 強制排除\n", "Kaleido area forced exclusion\n"));
|
2024-01-12 15:38:13 +00:00
|
|
|
PRINTF(VT_RST);
|
2021-05-02 23:15:16 +00:00
|
|
|
|
2020-03-17 04:31:30 +00:00
|
|
|
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
|
|
|
|
}
|
2021-05-02 23:15:16 +00:00
|
|
|
|
2024-01-12 15:38:13 +00:00
|
|
|
PRINTF(VT_FGCOL(GREEN));
|
2024-08-24 15:47:45 +00:00
|
|
|
PRINTF(T("プレイヤーアクター搬入\n", "Player actor import\n"));
|
2024-01-12 15:38:13 +00:00
|
|
|
PRINTF(VT_RST);
|
2021-05-02 23:15:16 +00:00
|
|
|
|
2020-10-13 03:15:42 +00:00
|
|
|
KaleidoManager_LoadOvl(playerActorOvl);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void KaleidoScopeCall_Init(PlayState* play) {
|
2024-08-24 15:47:45 +00:00
|
|
|
PRINTF(T("カレイド・スコープ入れ替え コンストラクト \n", "Kaleidoscope replacement construction\n"));
|
2021-05-02 23:15:16 +00:00
|
|
|
|
2020-06-04 21:54:50 +00:00
|
|
|
sKaleidoScopeUpdateFunc = KaleidoManager_GetRamAddr(KaleidoScope_Update);
|
|
|
|
sKaleidoScopeDrawFunc = KaleidoManager_GetRamAddr(KaleidoScope_Draw);
|
2020-04-04 17:28:53 +00:00
|
|
|
|
2020-06-04 21:54:50 +00:00
|
|
|
LOG_ADDRESS("kaleido_scope_move", KaleidoScope_Update, "../z_kaleido_scope_call.c", 98);
|
2020-04-04 17:28:53 +00:00
|
|
|
LOG_ADDRESS("kaleido_scope_move_func", sKaleidoScopeUpdateFunc, "../z_kaleido_scope_call.c", 99);
|
2020-06-04 21:54:50 +00:00
|
|
|
LOG_ADDRESS("kaleido_scope_draw", KaleidoScope_Draw, "../z_kaleido_scope_call.c", 100);
|
2020-04-04 17:28:53 +00:00
|
|
|
LOG_ADDRESS("kaleido_scope_draw_func", sKaleidoScopeDrawFunc, "../z_kaleido_scope_call.c", 101);
|
2021-05-02 23:15:16 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
KaleidoSetup_Init(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void KaleidoScopeCall_Destroy(PlayState* play) {
|
2024-08-24 15:47:45 +00:00
|
|
|
PRINTF(T("カレイド・スコープ入れ替え デストラクト \n", "Kaleidoscope replacement destruction\n"));
|
2021-05-02 23:15:16 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
KaleidoSetup_Destroy(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void KaleidoScopeCall_Update(PlayState* play) {
|
2021-05-02 23:15:16 +00:00
|
|
|
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
|
2022-05-21 18:23:43 +00:00
|
|
|
PauseContext* pauseCtx = &play->pauseCtx;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2024-02-08 13:40:08 +00:00
|
|
|
if (IS_PAUSED(&play->pauseCtx)) {
|
2023-09-06 15:14:15 +00:00
|
|
|
if (pauseCtx->state == PAUSE_STATE_WAIT_LETTERBOX) {
|
2022-08-15 13:39:06 +00:00
|
|
|
if (Letterbox_GetSize() == 0) {
|
2024-02-08 13:40:08 +00:00
|
|
|
#if OOT_DEBUG
|
2022-11-26 20:22:01 +00:00
|
|
|
R_HREG_MODE = HREG_MODE_UCODE_DISAS;
|
|
|
|
R_UCODE_DISAS_LOG_MODE = 3;
|
2024-02-08 13:40:08 +00:00
|
|
|
#endif
|
|
|
|
|
2022-12-20 00:19:57 +00:00
|
|
|
R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP;
|
2023-09-22 18:48:09 +00:00
|
|
|
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
|
2024-09-11 16:58:33 +00:00
|
|
|
pauseCtx->savePromptState = PAUSE_SAVE_PROMPT_STATE_APPEARING;
|
2023-09-06 15:14:15 +00:00
|
|
|
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_WAIT_BG_PRERENDER
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
2023-09-06 15:14:15 +00:00
|
|
|
} else if (pauseCtx->state == PAUSE_STATE_8) {
|
2024-02-08 13:40:08 +00:00
|
|
|
#if OOT_DEBUG
|
2022-11-26 20:22:01 +00:00
|
|
|
R_HREG_MODE = HREG_MODE_UCODE_DISAS;
|
|
|
|
R_UCODE_DISAS_LOG_MODE = 3;
|
2024-02-08 13:40:08 +00:00
|
|
|
#endif
|
|
|
|
|
2022-12-20 00:19:57 +00:00
|
|
|
R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP;
|
2023-09-22 18:48:09 +00:00
|
|
|
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
|
2024-09-11 16:58:33 +00:00
|
|
|
pauseCtx->savePromptState = PAUSE_SAVE_PROMPT_STATE_APPEARING;
|
2023-09-06 15:14:15 +00:00
|
|
|
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_9
|
|
|
|
} else if ((pauseCtx->state == PAUSE_STATE_WAIT_BG_PRERENDER) || (pauseCtx->state == PAUSE_STATE_9)) {
|
2024-01-12 15:38:13 +00:00
|
|
|
PRINTF("PR_KAREIDOSCOPE_MODE=%d\n", R_PAUSE_BG_PRERENDER_STATE);
|
2021-05-02 23:15:16 +00:00
|
|
|
|
2022-12-28 21:29:59 +00:00
|
|
|
if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_READY) {
|
2023-09-06 15:14:15 +00:00
|
|
|
pauseCtx->state++; // PAUSE_STATE_INIT or PAUSE_STATE_10
|
2020-03-23 23:11:21 +00:00
|
|
|
}
|
2023-09-06 15:14:15 +00:00
|
|
|
} else if (pauseCtx->state != PAUSE_STATE_OFF) {
|
2020-10-13 03:15:42 +00:00
|
|
|
if (gKaleidoMgrCurOvl != kaleidoScopeOvl) {
|
|
|
|
if (gKaleidoMgrCurOvl != NULL) {
|
2024-01-12 15:38:13 +00:00
|
|
|
PRINTF(VT_FGCOL(GREEN));
|
2024-08-24 15:47:45 +00:00
|
|
|
PRINTF(T("カレイド領域 プレイヤー 強制排除\n", "Kaleido area Player Forced Elimination\n"));
|
2024-01-12 15:38:13 +00:00
|
|
|
PRINTF(VT_RST);
|
2021-05-02 23:15:16 +00:00
|
|
|
|
2020-03-17 04:31:30 +00:00
|
|
|
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
|
|
|
|
}
|
2021-05-02 23:15:16 +00:00
|
|
|
|
2024-01-12 15:38:13 +00:00
|
|
|
PRINTF(VT_FGCOL(GREEN));
|
2024-08-24 15:47:45 +00:00
|
|
|
PRINTF(T("カレイド領域 カレイドスコープ搬入\n", "Kaleido area Kaleidoscope loading\n"));
|
2024-01-12 15:38:13 +00:00
|
|
|
PRINTF(VT_RST);
|
2021-05-02 23:15:16 +00:00
|
|
|
|
2020-10-13 03:15:42 +00:00
|
|
|
KaleidoManager_LoadOvl(kaleidoScopeOvl);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
2020-10-13 03:15:42 +00:00
|
|
|
|
|
|
|
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
|
2022-05-21 18:23:43 +00:00
|
|
|
sKaleidoScopeUpdateFunc(play);
|
2021-05-02 23:15:16 +00:00
|
|
|
|
2023-09-06 15:14:15 +00:00
|
|
|
if (!IS_PAUSED(&play->pauseCtx)) {
|
2024-01-12 15:38:13 +00:00
|
|
|
PRINTF(VT_FGCOL(GREEN));
|
2024-08-24 15:47:45 +00:00
|
|
|
PRINTF(T("カレイド領域 カレイドスコープ排出\n", "Kaleido area Kaleidoscope Emission\n"));
|
2024-01-12 15:38:13 +00:00
|
|
|
PRINTF(VT_RST);
|
2021-05-02 23:15:16 +00:00
|
|
|
|
2020-10-13 03:15:42 +00:00
|
|
|
KaleidoManager_ClearOvl(kaleidoScopeOvl);
|
2020-03-17 04:31:30 +00:00
|
|
|
KaleidoScopeCall_LoadPlayer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void KaleidoScopeCall_Draw(PlayState* play) {
|
2021-05-02 23:15:16 +00:00
|
|
|
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-12-28 21:29:59 +00:00
|
|
|
if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_READY) {
|
2023-09-06 15:14:15 +00:00
|
|
|
if (((play->pauseCtx.state >= PAUSE_STATE_OPENING_1) && (play->pauseCtx.state <= PAUSE_STATE_SAVE_PROMPT)) ||
|
|
|
|
((play->pauseCtx.state >= PAUSE_STATE_11) && (play->pauseCtx.state <= PAUSE_STATE_CLOSING))) {
|
2020-03-22 21:19:43 +00:00
|
|
|
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
|
2022-05-21 18:23:43 +00:00
|
|
|
sKaleidoScopeDrawFunc(play);
|
2020-03-22 21:19:43 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|