2020-10-03 15:22:44 +00:00
|
|
|
#include "global.h"
|
|
|
|
#include "vt.h"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
void (*sKaleidoScopeUpdateFunc)(GlobalContext*);
|
|
|
|
void (*sKaleidoScopeDrawFunc)(GlobalContext*);
|
2020-10-03 15:22:44 +00:00
|
|
|
f32 D_80161398;
|
2020-03-17 04:31:30 +00:00
|
|
|
u32 D_8016139C;
|
|
|
|
void* D_801613A0;
|
|
|
|
|
2020-06-04 21:54:50 +00:00
|
|
|
extern void KaleidoScope_Update(GlobalContext*);
|
|
|
|
extern void KaleidoScope_Draw(GlobalContext*);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
void KaleidoScopeCall_LoadPlayer() {
|
2020-10-13 03:15:42 +00:00
|
|
|
KaleidoManagerOvl* playerActorOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR];
|
|
|
|
|
|
|
|
if (gKaleidoMgrCurOvl != playerActorOvl) {
|
2020-03-22 21:19:43 +00:00
|
|
|
if (gKaleidoMgrCurOvl) {
|
2020-03-17 04:31:30 +00:00
|
|
|
osSyncPrintf(VT_FGCOL(GREEN));
|
2020-03-22 21:19:43 +00:00
|
|
|
osSyncPrintf("カレイド領域 強制排除\n"); // Kaleido area forced exclusion
|
2020-03-17 04:31:30 +00:00
|
|
|
osSyncPrintf(VT_RST);
|
|
|
|
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
|
|
|
|
}
|
|
|
|
osSyncPrintf(VT_FGCOL(GREEN));
|
2020-03-22 21:19:43 +00:00
|
|
|
osSyncPrintf("プレイヤーアクター搬入\n"); // Player actor import
|
2020-03-17 04:31:30 +00:00
|
|
|
osSyncPrintf(VT_RST);
|
2020-10-13 03:15:42 +00:00
|
|
|
KaleidoManager_LoadOvl(playerActorOvl);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
void KaleidoScopeCall_Init(GlobalContext* globalCtx) {
|
|
|
|
// Kaleidoscope replacement construct
|
2020-03-17 04:31:30 +00:00
|
|
|
osSyncPrintf("カレイド・スコープ入れ替え コンストラクト \n");
|
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);
|
2020-06-17 19:23:42 +00:00
|
|
|
KaleidoSetup_Init(globalCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
void KaleidoScopeCall_Destroy(GlobalContext* globalCtx) {
|
2020-06-17 19:23:42 +00:00
|
|
|
// Kaleidoscope replacement destruction
|
2020-03-17 04:31:30 +00:00
|
|
|
osSyncPrintf("カレイド・スコープ入れ替え デストラクト \n");
|
2020-06-17 19:23:42 +00:00
|
|
|
KaleidoSetup_Destroy(globalCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
|
2020-10-13 03:15:42 +00:00
|
|
|
KaleidoManagerOvl* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
|
|
|
|
PauseContext* pauseCtx = &globalCtx->pauseCtx;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (pauseCtx->state != 0 || pauseCtx->flag != 0) {
|
|
|
|
if (pauseCtx->state == 1) {
|
2020-07-09 01:54:39 +00:00
|
|
|
if (ShrinkWindow_GetCurrentVal() == 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
HREG(80) = 7;
|
|
|
|
HREG(82) = 3;
|
|
|
|
R_PAUSE_MENU_MODE = 1;
|
|
|
|
pauseCtx->unk_1E4 = 0;
|
|
|
|
pauseCtx->unk_1EC = 0;
|
2020-10-13 03:15:42 +00:00
|
|
|
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
} else if (pauseCtx->state == 8) {
|
2020-03-17 04:31:30 +00:00
|
|
|
HREG(80) = 7;
|
|
|
|
HREG(82) = 3;
|
|
|
|
R_PAUSE_MENU_MODE = 1;
|
|
|
|
pauseCtx->unk_1E4 = 0;
|
|
|
|
pauseCtx->unk_1EC = 0;
|
2020-10-13 03:15:42 +00:00
|
|
|
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1;
|
2020-03-22 21:19:43 +00:00
|
|
|
} else if (pauseCtx->state == 2 || pauseCtx->state == 9) {
|
2020-05-19 19:55:49 +00:00
|
|
|
osSyncPrintf("PR_KAREIDOSCOPE_MODE=%d\n", R_PAUSE_MENU_MODE);
|
2020-03-23 23:11:21 +00:00
|
|
|
if (R_PAUSE_MENU_MODE >= 3) {
|
2020-03-17 04:31:30 +00:00
|
|
|
pauseCtx->state++;
|
2020-03-23 23:11:21 +00:00
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
} else if (pauseCtx->state != 0) {
|
2020-10-13 03:15:42 +00:00
|
|
|
if (gKaleidoMgrCurOvl != kaleidoScopeOvl) {
|
|
|
|
if (gKaleidoMgrCurOvl != NULL) {
|
2020-03-17 04:31:30 +00:00
|
|
|
osSyncPrintf(VT_FGCOL(GREEN));
|
2020-03-22 21:19:43 +00:00
|
|
|
osSyncPrintf("カレイド領域 プレイヤー 強制排除\n"); // Kaleid Zone Player Forced Elimination
|
2020-03-17 04:31:30 +00:00
|
|
|
osSyncPrintf(VT_RST);
|
|
|
|
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
|
|
|
|
}
|
|
|
|
osSyncPrintf(VT_FGCOL(GREEN));
|
2020-03-22 21:19:43 +00:00
|
|
|
osSyncPrintf("カレイド領域 カレイドスコープ搬入\n"); // Kaleid area Kaleidoscope loading
|
2020-03-17 04:31:30 +00:00
|
|
|
osSyncPrintf(VT_RST);
|
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) {
|
2020-03-17 04:31:30 +00:00
|
|
|
sKaleidoScopeUpdateFunc(globalCtx);
|
2020-03-22 21:19:43 +00:00
|
|
|
if (globalCtx->pauseCtx.state == 0 && globalCtx->pauseCtx.flag == 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
osSyncPrintf(VT_FGCOL(GREEN));
|
2020-03-22 21:19:43 +00:00
|
|
|
osSyncPrintf("カレイド領域 カレイドスコープ排出\n"); // Kaleid area Kaleidoscope emission
|
2020-03-17 04:31:30 +00:00
|
|
|
osSyncPrintf(VT_RST);
|
2020-10-13 03:15:42 +00:00
|
|
|
KaleidoManager_ClearOvl(kaleidoScopeOvl);
|
2020-03-17 04:31:30 +00:00
|
|
|
KaleidoScopeCall_LoadPlayer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
void KaleidoScopeCall_Draw(GlobalContext* globalCtx) {
|
2020-10-13 03:15:42 +00:00
|
|
|
KaleidoManagerOvl* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (R_PAUSE_MENU_MODE >= 3) {
|
|
|
|
if ((globalCtx->pauseCtx.state >= 4 && globalCtx->pauseCtx.state < 8) ||
|
|
|
|
(globalCtx->pauseCtx.state >= 11 && globalCtx->pauseCtx.state < 19)) {
|
|
|
|
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
|
2020-03-17 04:31:30 +00:00
|
|
|
sKaleidoScopeDrawFunc(globalCtx);
|
2020-03-22 21:19:43 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|