1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-02 15:55:59 +00:00
oot/src/code/z_kaleido_scope_call.c

130 lines
4.8 KiB
C
Raw Normal View History

#include "global.h"
#include "terminal.h"
2020-03-17 04:31:30 +00:00
void (*sKaleidoScopeUpdateFunc)(PlayState* play);
void (*sKaleidoScopeDrawFunc)(PlayState* play);
f32 gBossMarkScale;
2020-03-17 04:31:30 +00:00
u32 D_8016139C;
PauseMapMarksData* gLoadedPauseMarkDataTable;
2020-03-17 04:31:30 +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) {
KaleidoMgrOverlay* playerActorOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR];
2020-10-13 03:15:42 +00:00
if (gKaleidoMgrCurOvl != playerActorOvl) {
if (gKaleidoMgrCurOvl != NULL) {
2020-03-17 04:31:30 +00:00
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("カレイド領域 強制排除\n"); // "Kaleido area forced exclusion"
2020-03-17 04:31:30 +00:00
osSyncPrintf(VT_RST);
2020-03-17 04:31:30 +00:00
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
}
2020-03-17 04:31:30 +00:00
osSyncPrintf(VT_FGCOL(GREEN));
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
}
}
void KaleidoScopeCall_Init(PlayState* play) {
// "Kaleidoscope replacement construction"
osSyncPrintf("カレイド・スコープ入れ替え コンストラクト \n");
sKaleidoScopeUpdateFunc = KaleidoManager_GetRamAddr(KaleidoScope_Update);
sKaleidoScopeDrawFunc = KaleidoManager_GetRamAddr(KaleidoScope_Draw);
LOG_ADDRESS("kaleido_scope_move", KaleidoScope_Update, "../z_kaleido_scope_call.c", 98);
LOG_ADDRESS("kaleido_scope_move_func", sKaleidoScopeUpdateFunc, "../z_kaleido_scope_call.c", 99);
LOG_ADDRESS("kaleido_scope_draw", KaleidoScope_Draw, "../z_kaleido_scope_call.c", 100);
LOG_ADDRESS("kaleido_scope_draw_func", sKaleidoScopeDrawFunc, "../z_kaleido_scope_call.c", 101);
KaleidoSetup_Init(play);
2020-03-17 04:31:30 +00:00
}
void KaleidoScopeCall_Destroy(PlayState* play) {
// "Kaleidoscope replacement destruction"
osSyncPrintf("カレイド・スコープ入れ替え デストラクト \n");
KaleidoSetup_Destroy(play);
2020-03-17 04:31:30 +00:00
}
void KaleidoScopeCall_Update(PlayState* play) {
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
PauseContext* pauseCtx = &play->pauseCtx;
2020-03-17 04:31:30 +00:00
if ((pauseCtx->state != 0) || (pauseCtx->debugState != 0)) {
2020-03-22 21:19:43 +00:00
if (pauseCtx->state == 1) {
if (Letterbox_GetSize() == 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;
} else if ((pauseCtx->state == 2) || (pauseCtx->state == 9)) {
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));
// "Kaleido area Player Forced Elimination"
osSyncPrintf("カレイド領域 プレイヤー 強制排除\n");
2020-03-17 04:31:30 +00:00
osSyncPrintf(VT_RST);
2020-03-17 04:31:30 +00:00
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
}
2020-03-17 04:31:30 +00:00
osSyncPrintf(VT_FGCOL(GREEN));
// "Kaleido area Kaleidoscope loading"
osSyncPrintf("カレイド領域 カレイドスコープ搬入\n");
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) {
sKaleidoScopeUpdateFunc(play);
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) {
2020-03-17 04:31:30 +00:00
osSyncPrintf(VT_FGCOL(GREEN));
// "Kaleido area Kaleidoscope Emission"
osSyncPrintf("カレイド領域 カレイドスコープ排出\n");
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();
}
}
}
}
}
void KaleidoScopeCall_Draw(PlayState* play) {
KaleidoMgrOverlay* 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 (((play->pauseCtx.state >= 4) && (play->pauseCtx.state <= 7)) ||
((play->pauseCtx.state >= 11) && (play->pauseCtx.state <= 18))) {
2020-03-22 21:19:43 +00:00
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
sKaleidoScopeDrawFunc(play);
2020-03-22 21:19:43 +00:00
}
2020-03-17 04:31:30 +00:00
}
}
}