1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-17 21:35:11 +00:00

Decompile the pause menu aka. ovl_kaleido_scope (+ minor changes) (#803)

* Decompile ovl_kaleido_scope + minor cleanups

* Add a common header for ovl_kaleido_scope

* Start cleaning up and documenting kaleido_scope (+ some interface docs)

* Improve and fix some kaleido_scope non matchings

* Match KaleidoSetup_Init

* Extract icon_item_fra/ger_static files

* Add more documentation and matches to kaleido_scope

* Improve the z_kaleido_collect.c non matching

* Rename z_kaleido_8081EFF0.c to z_kaleido_prompt.c

* Update most kaleido variables to be static

* Improve GS flag macros

* Improve z_lmap_mark.c and extract z_lmap_mark_data.c with a script

* Various minor fixes and improvements

* Minor fixes and review changes

* Review changes part 2

* Rename gSetTileCustom to gDPSetTileCustom

* Review changes part 3
This commit is contained in:
Roman971 2021-05-03 01:15:16 +02:00 committed by GitHub
parent 4e9f40cb13
commit a53e084cd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
106 changed files with 8605 additions and 24307 deletions

View file

@ -30,11 +30,11 @@ u16 gUpgradeCapacities[][4] = {
{ 0, 20, 30, 40 }, // Deku Nut Upgrades
};
u32 gGoldSkullFlgMask[] = { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 };
u32 gGoldSkullFlgShift[] = { 0, 8, 16, 24 };
u32 gGsFlagsMask[] = { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 };
u32 gGsFlagsShift[] = { 0, 8, 16, 24 };
// TODO: use symbols for these icon textures once textures are properly in C
u32 gItemIcons[] = {
void* gItemIcons[] = {
0x08000000, 0x08001000, 0x08002000, 0x08003000, 0x08004000, 0x08005000, 0x08006000, 0x08007000, 0x08008000,
0x08009000, 0x0800A000, 0x0800B000, 0x0800C000, 0x0800D000, 0x0800E000, 0x0800F000, 0x08010000, 0x08011000,
0x08012000, 0x08013000, 0x08014000, 0x08015000, 0x08016000, 0x08017000, 0x08018000, 0x08019000, 0x0801A000,
@ -95,7 +95,7 @@ u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) {
}
Player_SetEquipmentData(globalCtx, player);
globalCtx->pauseCtx.unk_238 = 10;
globalCtx->pauseCtx.cursorSpecialPos = PAUSE_CURSOR_PAGE_LEFT;
}
return sp26;

View file

@ -145,7 +145,7 @@ void FlagSet_Update(GlobalContext* globalCtx) {
}
if (CHECK_BTN_ALL(input->press.button, BTN_L)) {
globalCtx->pauseCtx.flag = 0;
globalCtx->pauseCtx.debugState = 0;
}
CLOSE_DISPS(gfxCtx, "../flg_set.c", 241);

View file

@ -3119,7 +3119,7 @@ f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast) {
if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycast->globalCtx != NULL)) {
pauseState = dynaRaycast->globalCtx->pauseCtx.state != 0;
if (pauseState == 0) {
pauseState = dynaRaycast->globalCtx->pauseCtx.flag != 0;
pauseState = dynaRaycast->globalCtx->pauseCtx.debugState != 0;
}
if (!pauseState && (dynaRaycast->colCtx->dyna.bgActorFlags[*dynaRaycast->bgId] & 2)) {
curTransform = &dynaRaycast->dyna->bgActors[*dynaRaycast->bgId].curTransform;

View file

@ -7,7 +7,7 @@ void func_80110990(GlobalContext* globalCtx) {
void func_801109B0(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
u32 parameterSize;
u16 do_actionOffset;
u16 doActionOffset;
u8 temp;
gSaveContext.unk_1422 = 0;
@ -40,72 +40,72 @@ void func_801109B0(GlobalContext* globalCtx) {
DmaMgr_SendRequest1(interfaceCtx->parameterSegment, (u32)_parameter_staticSegmentRomStart, parameterSize,
"../z_construct.c", 162);
interfaceCtx->do_actionSegment = GameState_Alloc(&globalCtx->state, 0x480, "../z_construct.c", 166);
interfaceCtx->doActionSegment = GameState_Alloc(&globalCtx->state, 0x480, "../z_construct.c", 166);
// Translates to: "DO Action Texture Initialization"
osSyncPrintf("DOアクション テクスチャ初期=%x\n", 0x480);
osSyncPrintf("parameter->do_actionSegment=%x\n", interfaceCtx->do_actionSegment);
osSyncPrintf("parameter->do_actionSegment=%x\n", interfaceCtx->doActionSegment);
ASSERT(interfaceCtx->do_actionSegment != NULL, "parameter->do_actionSegment != NULL", "../z_construct.c", 169);
ASSERT(interfaceCtx->doActionSegment != NULL, "parameter->do_actionSegment != NULL", "../z_construct.c", 169);
if (gSaveContext.language == 0) {
do_actionOffset = 0;
doActionOffset = 0;
} else if (gSaveContext.language == 1) {
do_actionOffset = 0x2B80;
doActionOffset = 0x2B80;
} else {
do_actionOffset = 0x5700;
doActionOffset = 0x5700;
}
DmaMgr_SendRequest1(interfaceCtx->do_actionSegment, (u32)_do_action_staticSegmentRomStart + do_actionOffset, 0x300,
DmaMgr_SendRequest1(interfaceCtx->doActionSegment, (u32)_do_action_staticSegmentRomStart + doActionOffset, 0x300,
"../z_construct.c", 174);
if (gSaveContext.language == 0) {
do_actionOffset = 0x480;
doActionOffset = 0x480;
} else if (gSaveContext.language == 1) {
do_actionOffset = 0x3000;
doActionOffset = 0x3000;
} else {
do_actionOffset = 0x5B80;
doActionOffset = 0x5B80;
}
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->do_actionSegment + 0x300),
(u32)_do_action_staticSegmentRomStart + do_actionOffset, 0x180, "../z_construct.c", 178);
DmaMgr_SendRequest1(interfaceCtx->doActionSegment + 0x300, (u32)_do_action_staticSegmentRomStart + doActionOffset,
0x180, "../z_construct.c", 178);
interfaceCtx->icon_itemSegment = GameState_Alloc(&globalCtx->state, 0x4000, "../z_construct.c", 190);
interfaceCtx->iconItemSegment = GameState_Alloc(&globalCtx->state, 0x4000, "../z_construct.c", 190);
// Translates to: "Icon Item Texture Initialization = %x"
osSyncPrintf("アイコンアイテム テクスチャ初期=%x\n", 0x4000);
osSyncPrintf("parameter->icon_itemSegment=%x\n", interfaceCtx->icon_itemSegment);
osSyncPrintf("parameter->icon_itemSegment=%x\n", interfaceCtx->iconItemSegment);
ASSERT(interfaceCtx->icon_itemSegment != NULL, "parameter->icon_itemSegment != NULL", "../z_construct.c", 193);
ASSERT(interfaceCtx->iconItemSegment != NULL, "parameter->icon_itemSegment != NULL", "../z_construct.c", 193);
osSyncPrintf("Register_Item[%x, %x, %x, %x]\n", gSaveContext.equips.buttonItems[0],
gSaveContext.equips.buttonItems[1], gSaveContext.equips.buttonItems[2],
gSaveContext.equips.buttonItems[3]);
if (gSaveContext.equips.buttonItems[0] < 0xF0) {
DmaMgr_SendRequest1(interfaceCtx->icon_itemSegment,
DmaMgr_SendRequest1(interfaceCtx->iconItemSegment,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[0] * 0x1000, 0x1000,
"../z_construct.c", 198);
} else if (gSaveContext.equips.buttonItems[0] != 0xFF) {
DmaMgr_SendRequest1(interfaceCtx->icon_itemSegment,
DmaMgr_SendRequest1(interfaceCtx->iconItemSegment,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[0] * 0x1000, 0x1000,
"../z_construct.c", 203);
}
if (gSaveContext.equips.buttonItems[1] < 0xF0) {
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->icon_itemSegment + 0x1000),
DmaMgr_SendRequest1(interfaceCtx->iconItemSegment + 0x1000,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[1] * 0x1000, 0x1000,
"../z_construct.c", 209);
}
if (gSaveContext.equips.buttonItems[2] < 0xF0) {
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->icon_itemSegment + 0x2000),
DmaMgr_SendRequest1(interfaceCtx->iconItemSegment + 0x2000,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[2] * 0x1000, 0x1000,
"../z_construct.c", 214);
}
if (gSaveContext.equips.buttonItems[3] < 0xF0) {
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->icon_itemSegment + 0x3000),
DmaMgr_SendRequest1(interfaceCtx->iconItemSegment + 0x3000,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[3] * 0x1000, 0x1000,
"../z_construct.c", 219);
}

View file

@ -57,10 +57,11 @@ void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx);
void Cutscene_DrawDebugInfo(GlobalContext* globalCtx, Gfx** dlist, CutsceneContext* csCtx) {
GfxPrint printer;
u8 pad2[8];
s32 pad[2];
GfxPrint_Init(&printer);
GfxPrint_Open(&printer, *dlist);
GfxPrint_SetPos(&printer, 22, 25);
GfxPrint_SetColor(&printer, 255, 255, 55, 32);
GfxPrint_Printf(&printer, "%s", "FLAME ");
@ -69,6 +70,7 @@ void Cutscene_DrawDebugInfo(GlobalContext* globalCtx, Gfx** dlist, CutsceneConte
GfxPrint_SetColor(&printer, 50, 255, 255, 60);
GfxPrint_SetPos(&printer, 4, 26);
GfxPrint_Printf(&printer, "%s", "SKIP=(START) or (Cursole Right)");
*dlist = GfxPrint_Close(&printer);
GfxPrint_Destroy(&printer);
}

View file

@ -7,77 +7,85 @@
_ovl_##name##SegmentEnd, 0, #name, \
}
KaleidoManagerOvl gKaleidoMgrOverlayTable[] = {
KaleidoMgrOverlay gKaleidoMgrOverlayTable[] = {
KALEIDO_OVERLAY(kaleido_scope),
KALEIDO_OVERLAY(player_actor),
};
void* sKaleidoAreaPtr = NULL;
KaleidoManagerOvl* gKaleidoMgrCurOvl = NULL;
u32 D_8012D1E0 = 0;
KaleidoMgrOverlay* gKaleidoMgrCurOvl = NULL;
u8 gBossMarkState = 0;
void KaleidoManager_LoadOvl(KaleidoManagerOvl* ovl) {
void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl) {
LogUtils_CheckNullPointer("KaleidoArea_allocp", sKaleidoAreaPtr, "../z_kaleido_manager.c", 99);
ovl->loadedRamAddr = sKaleidoAreaPtr;
Overlay_Load(ovl->vromStart, ovl->vromEnd, ovl->vramStart, ovl->vramEnd, ovl->loadedRamAddr);
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("OVL(k):Seg:%08x-%08x Ram:%08x-%08x Off:%08x %s\n", ovl->vramStart, ovl->vramEnd, ovl->loadedRamAddr,
((u32)ovl->loadedRamAddr + ovl->vramEnd) - (u32)ovl->vramStart,
(u32)ovl->loadedRamAddr + (u32)ovl->vramEnd - (u32)ovl->vramStart,
(u32)ovl->vramStart - (u32)ovl->loadedRamAddr, ovl->name);
osSyncPrintf(VT_RST);
ovl->off = (u32)ovl->loadedRamAddr - (u32)ovl->vramStart;
ovl->offset = (u32)ovl->loadedRamAddr - (u32)ovl->vramStart;
gKaleidoMgrCurOvl = ovl;
}
void KaleidoManager_ClearOvl(KaleidoManagerOvl* ovl) {
if (ovl->loadedRamAddr) {
ovl->off = 0;
bzero(ovl->loadedRamAddr, ovl->vramEnd - (u32)ovl->vramStart);
void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl) {
if (ovl->loadedRamAddr != NULL) {
ovl->offset = 0;
bzero(ovl->loadedRamAddr, (u32)ovl->vramEnd - (u32)ovl->vramStart);
ovl->loadedRamAddr = NULL;
gKaleidoMgrCurOvl = NULL;
}
}
void KaleidoManager_Init(GlobalContext* globalCtx) {
s32 largestOvl = 0;
s32 vramSize;
u32 idx;
s32 largestSize = 0;
s32 size;
u32 i;
for (idx = 0; idx < ARRAY_COUNT(gKaleidoMgrOverlayTable); idx++) {
vramSize = gKaleidoMgrOverlayTable[idx].vramEnd - (u32)gKaleidoMgrOverlayTable[idx].vramStart;
if (largestOvl < vramSize) {
largestOvl = vramSize;
for (i = 0; i < ARRAY_COUNT(gKaleidoMgrOverlayTable); i++) {
size = (u32)gKaleidoMgrOverlayTable[i].vramEnd - (u32)gKaleidoMgrOverlayTable[i].vramStart;
if (size > largestSize) {
largestSize = size;
}
}
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("KaleidoArea の最大サイズは %d バイトを確保します\n", largestOvl);
osSyncPrintf("KaleidoArea の最大サイズは %d バイトを確保します\n", largestSize);
osSyncPrintf(VT_RST);
sKaleidoAreaPtr = GameState_Alloc(&globalCtx->state, largestOvl, "../z_kaleido_manager.c", 150);
sKaleidoAreaPtr = GameState_Alloc(&globalCtx->state, largestSize, "../z_kaleido_manager.c", 150);
LogUtils_CheckNullPointer("KaleidoArea_allocp", sKaleidoAreaPtr, "../z_kaleido_manager.c", 151);
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("KaleidoArea %08x - %08x\n", sKaleidoAreaPtr, (u32)sKaleidoAreaPtr + largestOvl);
osSyncPrintf("KaleidoArea %08x - %08x\n", sKaleidoAreaPtr, (u32)sKaleidoAreaPtr + largestSize);
osSyncPrintf(VT_RST);
gKaleidoMgrCurOvl = 0;
}
void KaleidoManager_Destroy() {
if (gKaleidoMgrCurOvl) {
if (gKaleidoMgrCurOvl != NULL) {
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
gKaleidoMgrCurOvl = NULL;
}
sKaleidoAreaPtr = NULL;
}
// NOTE: this function looks messed up and probably doesn't work like how the devs wanted it to work
void* KaleidoManager_GetRamAddr(void* vram) {
KaleidoManagerOvl* iter = gKaleidoMgrCurOvl;
KaleidoManagerOvl* ovl = iter;
u32 idx;
KaleidoMgrOverlay* iter = gKaleidoMgrCurOvl;
KaleidoMgrOverlay* ovl = iter;
u32 i;
if (ovl == NULL) {
iter = &gKaleidoMgrOverlayTable[0];
for (idx = 0; idx != ARRAY_COUNT(gKaleidoMgrOverlayTable); idx++) {
if ((u32)vram >= (u32)iter->vramStart && (u32)iter->vramEnd >= (u32)vram) {
for (i = 0; i < ARRAY_COUNT(gKaleidoMgrOverlayTable); i++) {
if (((u32)vram >= (u32)iter->vramStart) && ((u32)iter->vramEnd >= (u32)vram)) {
KaleidoManager_LoadOvl(iter);
ovl = iter;
goto KaleidoManager_GetRamAddr_end;
@ -90,9 +98,9 @@ void* KaleidoManager_GetRamAddr(void* vram) {
}
KaleidoManager_GetRamAddr_end:
if (ovl == NULL || (u32)vram < (u32)ovl->vramStart || (u32)vram >= (u32)ovl->vramEnd) {
if ((ovl == NULL) || ((u32)vram < (u32)ovl->vramStart) || ((u32)vram >= (u32)ovl->vramEnd)) {
return NULL;
}
return (void*)((u32)vram + ovl->off);
return (void*)((u32)vram + ovl->offset);
}

View file

@ -1,35 +1,38 @@
#include "global.h"
#include "vt.h"
void (*sKaleidoScopeUpdateFunc)(GlobalContext*);
void (*sKaleidoScopeDrawFunc)(GlobalContext*);
f32 D_80161398;
void (*sKaleidoScopeUpdateFunc)(GlobalContext* globalCtx);
void (*sKaleidoScopeDrawFunc)(GlobalContext* globalCtx);
f32 gBossMarkScale;
u32 D_8016139C;
void* D_801613A0;
PauseMapMarksData* gLoadedPauseMarkDataTable;
extern void KaleidoScope_Update(GlobalContext*);
extern void KaleidoScope_Draw(GlobalContext*);
extern void KaleidoScope_Update(GlobalContext* globalCtx);
extern void KaleidoScope_Draw(GlobalContext* globalCtx);
void KaleidoScopeCall_LoadPlayer() {
KaleidoManagerOvl* playerActorOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR];
KaleidoMgrOverlay* playerActorOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR];
if (gKaleidoMgrCurOvl != playerActorOvl) {
if (gKaleidoMgrCurOvl) {
if (gKaleidoMgrCurOvl != NULL) {
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("カレイド領域 強制排除\n"); // Kaleido area forced exclusion
osSyncPrintf("カレイド領域 強制排除\n"); // "Kaleido area forced exclusion"
osSyncPrintf(VT_RST);
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
}
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("プレイヤーアクター搬入\n"); // Player actor import
osSyncPrintf("プレイヤーアクター搬入\n"); // "Player actor import"
osSyncPrintf(VT_RST);
KaleidoManager_LoadOvl(playerActorOvl);
}
}
void KaleidoScopeCall_Init(GlobalContext* globalCtx) {
// Kaleidoscope replacement construct
osSyncPrintf("カレイド・スコープ入れ替え コンストラクト \n");
osSyncPrintf("カレイド・スコープ入れ替え コンストラクト \n"); // "Kaleidoscope replacement construction"
sKaleidoScopeUpdateFunc = KaleidoManager_GetRamAddr(KaleidoScope_Update);
sKaleidoScopeDrawFunc = KaleidoManager_GetRamAddr(KaleidoScope_Draw);
@ -37,20 +40,21 @@ void KaleidoScopeCall_Init(GlobalContext* globalCtx) {
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(globalCtx);
}
void KaleidoScopeCall_Destroy(GlobalContext* globalCtx) {
// Kaleidoscope replacement destruction
osSyncPrintf("カレイド・スコープ入れ替え デストラクト \n");
osSyncPrintf("カレイド・スコープ入れ替え デストラクト \n"); // "Kaleidoscope replacement destruction"
KaleidoSetup_Destroy(globalCtx);
}
void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
KaleidoManagerOvl* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
PauseContext* pauseCtx = &globalCtx->pauseCtx;
if (pauseCtx->state != 0 || pauseCtx->flag != 0) {
if ((pauseCtx->state != 0) || (pauseCtx->debugState != 0)) {
if (pauseCtx->state == 1) {
if (ShrinkWindow_GetCurrentVal() == 0) {
HREG(80) = 7;
@ -67,8 +71,9 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
pauseCtx->unk_1E4 = 0;
pauseCtx->unk_1EC = 0;
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1;
} else if (pauseCtx->state == 2 || pauseCtx->state == 9) {
} 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++;
}
@ -76,22 +81,27 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
if (gKaleidoMgrCurOvl != kaleidoScopeOvl) {
if (gKaleidoMgrCurOvl != NULL) {
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("カレイド領域 プレイヤー 強制排除\n"); // Kaleid Zone Player Forced Elimination
osSyncPrintf("カレイド領域 プレイヤー 強制排除\n"); // "Kaleido area Player Forced Elimination"
osSyncPrintf(VT_RST);
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
}
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("カレイド領域 カレイドスコープ搬入\n"); // Kaleid area Kaleidoscope loading
osSyncPrintf("カレイド領域 カレイドスコープ搬入\n"); // "Kaleido area Kaleidoscope loading"
osSyncPrintf(VT_RST);
KaleidoManager_LoadOvl(kaleidoScopeOvl);
}
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
sKaleidoScopeUpdateFunc(globalCtx);
if (globalCtx->pauseCtx.state == 0 && globalCtx->pauseCtx.flag == 0) {
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) {
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("カレイド領域 カレイドスコープ排出\n"); // Kaleid area Kaleidoscope emission
osSyncPrintf("カレイド領域 カレイドスコープ排出\n"); // "Kaleido area Kaleidoscope Emission"
osSyncPrintf(VT_RST);
KaleidoManager_ClearOvl(kaleidoScopeOvl);
KaleidoScopeCall_LoadPlayer();
}
@ -101,11 +111,11 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
}
void KaleidoScopeCall_Draw(GlobalContext* globalCtx) {
KaleidoManagerOvl* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
if (R_PAUSE_MENU_MODE >= 3) {
if ((globalCtx->pauseCtx.state >= 4 && globalCtx->pauseCtx.state < 8) ||
(globalCtx->pauseCtx.state >= 11 && globalCtx->pauseCtx.state < 19)) {
if (((globalCtx->pauseCtx.state >= 4) && (globalCtx->pauseCtx.state <= 7)) ||
((globalCtx->pauseCtx.state >= 11) && (globalCtx->pauseCtx.state <= 18))) {
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
sKaleidoScopeDrawFunc(globalCtx);
}

View file

@ -1,48 +1,18 @@
#include "global.h"
s16 sKaleidoSetupKscpPos0[] = {
2,
3,
0,
1,
};
f32 sKaleidoSetupEyeX0[] = {
0.0f,
64.0f,
0.0f,
-64.0f,
};
f32 sKaleidoSetupEyeZ0[] = {
-64.0f,
0.0f,
64.0f,
0.0f,
};
s16 sKaleidoSetupKscpPos0[] = { PAUSE_QUEST, PAUSE_EQUIP, PAUSE_ITEM, PAUSE_MAP };
f32 sKaleidoSetupEyeX0[] = { 0.0f, 64.0f, 0.0f, -64.0f };
f32 sKaleidoSetupEyeZ0[] = { -64.0f, 0.0f, 64.0f, 0.0f };
s16 sKaleidoSetupKscpPos1[] = {
1,
2,
3,
0,
};
f32 sKaleidoSetupEyeX1[] = {
-64.0f,
0.0f,
64.0f,
0.0f,
};
f32 sKaleidoSetupEyeZ1[] = {
0.0f,
-64.0f,
0.0f,
64.0f,
};
s16 sKaleidoSetupKscpPos1[] = { PAUSE_MAP, PAUSE_QUEST, PAUSE_EQUIP, PAUSE_ITEM };
f32 sKaleidoSetupEyeX1[] = { -64.0f, 0.0f, 64.0f, 0.0f };
f32 sKaleidoSetupEyeZ1[] = { 0.0f, -64.0f, 0.0f, 64.0f };
void KaleidoSetup_Update(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
Input* input = &globalCtx->state.input[0];
if (pauseCtx->state == 0 && pauseCtx->flag == 0 && globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE &&
if (pauseCtx->state == 0 && pauseCtx->debugState == 0 && globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE &&
globalCtx->sceneLoadFlag == 0 && globalCtx->transitionMode == 0 && gSaveContext.cutsceneIndex < 0xFFF0 &&
gSaveContext.nextCutsceneIndex < 0xFFF0 && !Gameplay_InCsMode(globalCtx) &&
globalCtx->shootingGalleryStatus <= 1 && gSaveContext.unk_13F0 != 8 && gSaveContext.unk_13F0 != 9 &&
@ -50,54 +20,59 @@ void KaleidoSetup_Update(GlobalContext* globalCtx) {
if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
if (BREG(0)) {
pauseCtx->flag = 3;
pauseCtx->debugState = 3;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
gSaveContext.unk_13EE = gSaveContext.unk_13EA;
WREG(16) = -0xAF;
WREG(17) = 0x9B;
WREG(16) = -175;
WREG(17) = 155;
pauseCtx->unk_1EA = 0;
pauseCtx->unk_1E4 = 1;
if (ZREG(48) == 0) {
pauseCtx->eye.x = sKaleidoSetupEyeX0[pauseCtx->kscpPos];
pauseCtx->eye.z = sKaleidoSetupEyeZ0[pauseCtx->kscpPos];
pauseCtx->kscpPos = sKaleidoSetupKscpPos0[pauseCtx->kscpPos];
pauseCtx->eye.x = sKaleidoSetupEyeX0[pauseCtx->pageIndex];
pauseCtx->eye.z = sKaleidoSetupEyeZ0[pauseCtx->pageIndex];
pauseCtx->pageIndex = sKaleidoSetupKscpPos0[pauseCtx->pageIndex];
} else {
pauseCtx->eye.x = sKaleidoSetupEyeX1[pauseCtx->kscpPos];
pauseCtx->eye.z = sKaleidoSetupEyeZ1[pauseCtx->kscpPos];
pauseCtx->kscpPos = sKaleidoSetupKscpPos1[pauseCtx->kscpPos];
pauseCtx->eye.x = sKaleidoSetupEyeX1[pauseCtx->pageIndex];
pauseCtx->eye.z = sKaleidoSetupEyeZ1[pauseCtx->pageIndex];
pauseCtx->pageIndex = sKaleidoSetupKscpPos1[pauseCtx->pageIndex];
}
pauseCtx->mode = (u16)(pauseCtx->kscpPos * 2) + 1; // cast required
pauseCtx->mode = (u16)(pauseCtx->pageIndex * 2) + 1;
pauseCtx->state = 1;
osSyncPrintf("=%d eye.x=%f, eye.z=%f kscp_pos=%d\n", pauseCtx->mode, pauseCtx->eye.x,
pauseCtx->eye.z, pauseCtx->kscpPos);
pauseCtx->eye.z, pauseCtx->pageIndex);
}
if (pauseCtx->state == 1) {
WREG(2) = -0x1860;
WREG(2) = -6240;
R_UPDATE_RATE = 2;
if (ShrinkWindow_GetVal()) {
ShrinkWindow_SetVal(0);
}
func_800F64E0(1);
}
}
}
#ifdef NON_MATCHING
// regalloc differences
void KaleidoSetup_Init(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
u64 temp = 0; // Necessary to match
pauseCtx->state = 0;
pauseCtx->flag = 0;
pauseCtx->unk_208 = 0;
pauseCtx->debugState = 0;
pauseCtx->alpha = 0;
pauseCtx->unk_1EA = 0;
pauseCtx->unk_1E4 = 0;
pauseCtx->mode = 0;
pauseCtx->kscpPos = 0;
pauseCtx->unk_218 = 0;
pauseCtx->pageIndex = PAUSE_ITEM;
pauseCtx->unk_1F4 = 160.0f;
pauseCtx->unk_1F8 = 160.0f;
pauseCtx->unk_1FC = 160.0f;
@ -106,38 +81,41 @@ void KaleidoSetup_Init(GlobalContext* globalCtx) {
pauseCtx->unk_1F0 = 936.0f;
pauseCtx->eye.x = pauseCtx->eye.y = 0.0f;
pauseCtx->unk_204 = -314.0f;
pauseCtx->unk_21A = VREG(30) + 3;
pauseCtx->unk_21C = 0;
pauseCtx->unk_21E = 1;
pauseCtx->unk_220 = 10;
pauseCtx->unk_222 = 0;
pauseCtx->unk_22C = 0;
pauseCtx->unk_224 = 0;
pauseCtx->unk_22E = 0;
pauseCtx->unk_226 = 0;
pauseCtx->unk_230 = 0;
pauseCtx->unk_228 = 1;
pauseCtx->unk_232 = 0;
pauseCtx->unk_23E = 999;
pauseCtx->unk_240 = VREG(30) + 3;
pauseCtx->unk_242 = 999;
pauseCtx->unk_244 = 59;
pauseCtx->unk_246 = 0;
pauseCtx->unk_248 = VREG(30) + 3;
pauseCtx->unk_24A = 0;
pauseCtx->unk_24C = pauseCtx->unk_21E;
pauseCtx->unk_25A = -40;
pauseCtx->unk_25C = 0;
pauseCtx->unk_25E = 0;
pauseCtx->unk_260 = 4;
pauseCtx->cursorPoint[PAUSE_ITEM] = 0;
pauseCtx->cursorPoint[PAUSE_MAP] = VREG(30) + 3;
pauseCtx->cursorPoint[PAUSE_QUEST] = 0;
pauseCtx->cursorPoint[PAUSE_EQUIP] = 1;
pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 10;
pauseCtx->cursorX[PAUSE_ITEM] = 0;
pauseCtx->cursorY[PAUSE_ITEM] = 0;
pauseCtx->cursorX[PAUSE_MAP] = 0;
pauseCtx->cursorY[PAUSE_MAP] = 0;
pauseCtx->cursorX[PAUSE_QUEST] = temp;
pauseCtx->cursorY[PAUSE_QUEST] = temp;
pauseCtx->cursorX[PAUSE_EQUIP] = 1;
pauseCtx->cursorY[PAUSE_EQUIP] = 0;
pauseCtx->cursorItem[PAUSE_ITEM] = PAUSE_ITEM_NONE;
pauseCtx->cursorItem[PAUSE_MAP] = VREG(30) + 3;
pauseCtx->cursorItem[PAUSE_QUEST] = PAUSE_ITEM_NONE;
pauseCtx->cursorItem[PAUSE_EQUIP] = ITEM_SWORD_KOKIRI;
pauseCtx->cursorSlot[PAUSE_ITEM] = 0;
pauseCtx->cursorSlot[PAUSE_MAP] = VREG(30) + 3;
pauseCtx->cursorSlot[PAUSE_QUEST] = 0;
pauseCtx->cursorSlot[PAUSE_EQUIP] = pauseCtx->cursorPoint[PAUSE_EQUIP];
pauseCtx->infoPanelOffsetY = -40;
pauseCtx->nameDisplayTimer = 0;
pauseCtx->nameColorSet = 0;
pauseCtx->cursorColorSet = 4;
pauseCtx->unk_264 = -1;
pauseCtx->unk_238 = 0;
pauseCtx->cursorSpecialPos = 0;
View_Init(&pauseCtx->view, globalCtx->state.gfxCtx);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kaleido_setup/KaleidoSetup_Init.s")
#endif
void KaleidoSetup_Destroy(GlobalContext* globalCtx) {
}

View file

@ -1,7 +1,7 @@
#include "global.h"
#include "textures/parameter_static/parameter_static.h"
/*
/**
* These are the colors for the hearts in the interface. The prim color is the red color of the heart
* for the base hearts, while the prim color for the double defense hearts is the white outline. The
* env color for the base hearts is the purple-ish outline, while the env color for the double defense
@ -24,7 +24,7 @@
#define HEARTS_DD_ENV_G 0
#define HEARTS_DD_ENV_B 0
/*
/**
* The burn and drown colors listed here are unused. Prerelease footage of the game confirms that at one
* point in development the orange color was to be used while taking damage from hot environments.
* Based on this, we can assume that the blue heart color was to be used while drowning.
@ -55,8 +55,8 @@ static s16 sHeartsPrimColors[3][3] = {
static s16 sHeartsEnvColors[3][3] = {
{ HEARTS_ENV_R, HEARTS_ENV_G, HEARTS_ENV_B },
{ HEARTS_BURN_ENV_R, HEARTS_BURN_ENV_G },
{ HEARTS_DROWN_ENV_R, HEARTS_DROWN_ENV_G, HEARTS_DROWN_ENV_B },
{ HEARTS_BURN_ENV_R, HEARTS_BURN_ENV_G }, // unused
{ HEARTS_DROWN_ENV_R, HEARTS_DROWN_ENV_G, HEARTS_DROWN_ENV_B }, // unused
};
static s16 sHeartsPrimFactors[3][3] = {
@ -152,10 +152,10 @@ static s16 sHeartsDDEnvFactors[3][3] = {
};
// Current colors for the double defense hearts
s16 sHeartsDDPrim[3];
s16 sHeartsDDEnv[3];
s16 sBeatingHeartsDDPrim[2][3];
s16 sBeatingHeartsDDEnv[2][3];
s16 sBeatingHeartsDDPrim[3];
s16 sBeatingHeartsDDEnv[3];
s16 sHeartsDDPrim[2][3];
s16 sHeartsDDEnv[2][3];
void HealthMeter_Init(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
@ -181,13 +181,13 @@ void HealthMeter_Init(GlobalContext* globalCtx) {
interfaceCtx->heartsEnvG[1] = HEARTS_ENV_G;
interfaceCtx->heartsEnvB[1] = HEARTS_ENV_B;
sBeatingHeartsDDPrim[0][0] = sBeatingHeartsDDPrim[1][0] = HEARTS_DD_PRIM_R;
sBeatingHeartsDDPrim[0][1] = sBeatingHeartsDDPrim[1][1] = HEARTS_DD_PRIM_G;
sBeatingHeartsDDPrim[0][2] = sBeatingHeartsDDPrim[1][2] = HEARTS_DD_PRIM_B;
sHeartsDDPrim[0][0] = sHeartsDDPrim[1][0] = HEARTS_DD_PRIM_R;
sHeartsDDPrim[0][1] = sHeartsDDPrim[1][1] = HEARTS_DD_PRIM_G;
sHeartsDDPrim[0][2] = sHeartsDDPrim[1][2] = HEARTS_DD_PRIM_B;
sBeatingHeartsDDEnv[0][0] = sBeatingHeartsDDEnv[1][0] = HEARTS_DD_ENV_R;
sBeatingHeartsDDEnv[0][1] = sBeatingHeartsDDEnv[1][1] = HEARTS_DD_ENV_G;
sBeatingHeartsDDEnv[0][2] = sBeatingHeartsDDEnv[1][2] = HEARTS_DD_ENV_B;
sHeartsDDEnv[0][0] = sHeartsDDEnv[1][0] = HEARTS_DD_ENV_R;
sHeartsDDEnv[0][1] = sHeartsDDEnv[1][1] = HEARTS_DD_ENV_G;
sHeartsDDEnv[0][2] = sHeartsDDEnv[1][2] = HEARTS_DD_ENV_B;
}
void HealthMeter_Update(GlobalContext* globalCtx) {
@ -253,37 +253,37 @@ void HealthMeter_Update(GlobalContext* globalCtx) {
interfaceCtx->beatingHeartEnv[1] = (u8)(gFactor + HEARTS_ENV_G) & 0xFF;
interfaceCtx->beatingHeartEnv[2] = (u8)(bFactor + HEARTS_ENV_B) & 0xFF;
sBeatingHeartsDDPrim[0][0] = HEARTS_DD_PRIM_R;
sBeatingHeartsDDPrim[0][1] = HEARTS_DD_PRIM_G;
sBeatingHeartsDDPrim[0][2] = HEARTS_DD_PRIM_B;
sHeartsDDPrim[0][0] = HEARTS_DD_PRIM_R;
sHeartsDDPrim[0][1] = HEARTS_DD_PRIM_G;
sHeartsDDPrim[0][2] = HEARTS_DD_PRIM_B;
sBeatingHeartsDDEnv[0][0] = HEARTS_DD_ENV_R;
sBeatingHeartsDDEnv[0][1] = HEARTS_DD_ENV_G;
sBeatingHeartsDDEnv[0][2] = HEARTS_DD_ENV_B;
sHeartsDDEnv[0][0] = HEARTS_DD_ENV_R;
sHeartsDDEnv[0][1] = HEARTS_DD_ENV_G;
sHeartsDDEnv[0][2] = HEARTS_DD_ENV_B;
sBeatingHeartsDDPrim[1][0] = sHeartsDDPrimColors[ddType][0];
sBeatingHeartsDDPrim[1][1] = sHeartsDDPrimColors[ddType][1];
sBeatingHeartsDDPrim[1][2] = sHeartsDDPrimColors[ddType][2];
sHeartsDDPrim[1][0] = sHeartsDDPrimColors[ddType][0];
sHeartsDDPrim[1][1] = sHeartsDDPrimColors[ddType][1];
sHeartsDDPrim[1][2] = sHeartsDDPrimColors[ddType][2];
sBeatingHeartsDDEnv[1][0] = sHeartsDDEnvColors[ddType][0];
sBeatingHeartsDDEnv[1][1] = sHeartsDDEnvColors[ddType][1];
sBeatingHeartsDDEnv[1][2] = sHeartsDDEnvColors[ddType][2];
sHeartsDDEnv[1][0] = sHeartsDDEnvColors[ddType][0];
sHeartsDDEnv[1][1] = sHeartsDDEnvColors[ddType][1];
sHeartsDDEnv[1][2] = sHeartsDDEnvColors[ddType][2];
rFactor = sHeartsDDPrimFactors[ddType][0] * ddFactor;
gFactor = sHeartsDDPrimFactors[ddType][1] * ddFactor;
bFactor = sHeartsDDPrimFactors[ddType][2] * ddFactor;
sHeartsDDPrim[0] = (u8)(rFactor + HEARTS_DD_PRIM_R) & 0xFF;
sHeartsDDPrim[1] = (u8)(gFactor + HEARTS_DD_PRIM_G) & 0xFF;
sHeartsDDPrim[2] = (u8)(bFactor + HEARTS_DD_PRIM_B) & 0xFF;
sBeatingHeartsDDPrim[0] = (u8)(rFactor + HEARTS_DD_PRIM_R) & 0xFF;
sBeatingHeartsDDPrim[1] = (u8)(gFactor + HEARTS_DD_PRIM_G) & 0xFF;
sBeatingHeartsDDPrim[2] = (u8)(bFactor + HEARTS_DD_PRIM_B) & 0xFF;
rFactor = sHeartsDDEnvFactors[ddType][0] * ddFactor;
gFactor = sHeartsDDEnvFactors[ddType][1] * ddFactor;
bFactor = sHeartsDDEnvFactors[ddType][2] * ddFactor;
sHeartsDDEnv[0] = (u8)(rFactor + HEARTS_DD_ENV_R) & 0xFF;
sHeartsDDEnv[1] = (u8)(gFactor + HEARTS_DD_ENV_G) & 0xFF;
sHeartsDDEnv[2] = (u8)(bFactor + HEARTS_DD_ENV_B) & 0xFF;
sBeatingHeartsDDEnv[0] = (u8)(rFactor + HEARTS_DD_ENV_R) & 0xFF;
sBeatingHeartsDDEnv[1] = (u8)(gFactor + HEARTS_DD_ENV_G) & 0xFF;
sBeatingHeartsDDEnv[2] = (u8)(bFactor + HEARTS_DD_ENV_B) & 0xFF;
}
s32 func_80078E18(GlobalContext* globalCtx) {
@ -329,7 +329,7 @@ u64* sHeartTextures[] = {
gHUDHeartThreeQuarterTex, gHUDHeartThreeQuarterTex, gHUDHeartThreeQuarterTex, gHUDHeartThreeQuarterTex,
};
u64* sDDHeartTextures[] = {
u64* sHeartDDTextures[] = {
gHUDDefenseHeartFullTex, gHUDDefenseHeartQuarterTex, gHUDDefenseHeartQuarterTex,
gHUDDefenseHeartQuarterTex, gHUDDefenseHeartQuarterTex, gHUDDefenseHeartQuarterTex,
gHUDDefenseHeartHalfTex, gHUDDefenseHeartHalfTex, gHUDDefenseHeartHalfTex,
@ -351,7 +351,7 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
f32 temp4;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Vtx* sp154 = interfaceCtx->vtx_12C;
Vtx* sp154 = interfaceCtx->beatingHeartVtx;
s32 curHeartFraction = gSaveContext.health % 0x10;
s16 totalHeartCount = gSaveContext.healthCapacity / 0x10;
s16 fullHeartCount = gSaveContext.health / 0x10;
@ -424,43 +424,41 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
if (curColorSet != 4) {
curColorSet = 4;
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sBeatingHeartsDDPrim[0][0], sBeatingHeartsDDPrim[0][1],
sBeatingHeartsDDPrim[0][2], interfaceCtx->healthAlpha);
gDPSetEnvColor(OVERLAY_DISP++, sBeatingHeartsDDEnv[0][0], sBeatingHeartsDDEnv[0][1],
sBeatingHeartsDDEnv[0][2], 255);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sHeartsDDPrim[0][0], sHeartsDDPrim[0][1], sHeartsDDPrim[0][2],
interfaceCtx->healthAlpha);
gDPSetEnvColor(OVERLAY_DISP++, sHeartsDDEnv[0][0], sHeartsDDEnv[0][1], sHeartsDDEnv[0][2], 255);
}
} else if (i == fullHeartCount) {
if (curColorSet != 5) {
curColorSet = 5;
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sHeartsDDPrim[0], sHeartsDDPrim[1], sHeartsDDPrim[2],
interfaceCtx->healthAlpha);
gDPSetEnvColor(OVERLAY_DISP++, sHeartsDDEnv[0], sHeartsDDEnv[1], sHeartsDDEnv[2], 0xFF);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sBeatingHeartsDDPrim[0], sBeatingHeartsDDPrim[1],
sBeatingHeartsDDPrim[2], interfaceCtx->healthAlpha);
gDPSetEnvColor(OVERLAY_DISP++, sBeatingHeartsDDEnv[0], sBeatingHeartsDDEnv[1],
sBeatingHeartsDDEnv[2], 255);
}
} else if (i > fullHeartCount) {
if (curColorSet != 6) {
curColorSet = 6;
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sBeatingHeartsDDPrim[0][0], sBeatingHeartsDDPrim[0][1],
sBeatingHeartsDDPrim[0][2], interfaceCtx->healthAlpha);
gDPSetEnvColor(OVERLAY_DISP++, sBeatingHeartsDDEnv[0][0], sBeatingHeartsDDEnv[0][1],
sBeatingHeartsDDEnv[0][2], 255);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sHeartsDDPrim[0][0], sHeartsDDPrim[0][1], sHeartsDDPrim[0][2],
interfaceCtx->healthAlpha);
gDPSetEnvColor(OVERLAY_DISP++, sHeartsDDEnv[0][0], sHeartsDDEnv[0][1], sHeartsDDEnv[0][2], 255);
}
} else {
if (curColorSet != 7) {
curColorSet = 7;
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sBeatingHeartsDDPrim[1][0], sBeatingHeartsDDPrim[1][1],
sBeatingHeartsDDPrim[1][2], interfaceCtx->healthAlpha);
gDPSetEnvColor(OVERLAY_DISP++, sBeatingHeartsDDEnv[1][0], sBeatingHeartsDDEnv[1][1],
sBeatingHeartsDDEnv[1][2], 255);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sHeartsDDPrim[1][0], sHeartsDDPrim[1][1], sHeartsDDPrim[1][2],
interfaceCtx->healthAlpha);
gDPSetEnvColor(OVERLAY_DISP++, sHeartsDDEnv[1][0], sHeartsDDEnv[1][1], sHeartsDDEnv[1][2], 255);
}
}
if (i < fullHeartCount) {
heartBgImg = gHUDDefenseHeartFullTex;
} else if (i == fullHeartCount) {
heartBgImg = sDDHeartTextures[curHeartFraction];
heartBgImg = sHeartDDTextures[curHeartFraction];
} else {
heartBgImg = gHUDDefenseHeartEmptyTex;
}
@ -545,8 +543,8 @@ void HealthMeter_HandleCriticalAlarm(GlobalContext* globalCtx) {
if (interfaceCtx->unk_22A <= 0) {
interfaceCtx->unk_22A = 0;
interfaceCtx->unk_22C = 0;
if (!Player_InCsMode(globalCtx) && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) &&
HealthMeter_IsCritical() && !Gameplay_InCsMode(globalCtx)) {
if (!Player_InCsMode(globalCtx) && (globalCtx->pauseCtx.state == 0) &&
(globalCtx->pauseCtx.debugState == 0) && HealthMeter_IsCritical() && !Gameplay_InCsMode(globalCtx)) {
func_80078884(NA_SE_SY_HITPOINT_ALARM);
}
}

View file

@ -20,20 +20,20 @@ void Map_SavePlayerInitialInfo(GlobalContext* globalCtx) {
void Map_SetPaletteData(GlobalContext* globalCtx, s16 room) {
s32 mapIndex = gSaveContext.mapIndex;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
s16 paletteNum = gMapData->roomPalette[mapIndex][room];
s16 paletteIndex = gMapData->roomPalette[mapIndex][room];
if (interfaceCtx->mapRoomNum == room) {
interfaceCtx->mapPaletteNum = paletteNum;
interfaceCtx->mapPaletteIndex = paletteIndex;
}
osSyncPrintf(VT_FGCOL(YELLOW));
// Translates to: "PALETE Set"
osSyncPrintf("PALETEセット 【 i=%x : room=%x 】Room_Inf[%d][4]=%x ( map_palete_no = %d )\n", paletteNum,
room, mapIndex, gSaveContext.sceneFlags[mapIndex].rooms, interfaceCtx->mapPaletteNum);
osSyncPrintf("PALETEセット 【 i=%x : room=%x 】Room_Inf[%d][4]=%x ( map_palete_no = %d )\n", paletteIndex,
room, mapIndex, gSaveContext.sceneFlags[mapIndex].rooms, interfaceCtx->mapPaletteIndex);
osSyncPrintf(VT_RST);
interfaceCtx->unk_140[paletteNum * 2] = 2;
interfaceCtx->unk_140[paletteNum * 2 + 1] = 0xBF;
interfaceCtx->mapPalette[paletteIndex * 2] = 2;
interfaceCtx->mapPalette[paletteIndex * 2 + 1] = 0xBF;
}
void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) {
@ -43,13 +43,13 @@ void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) {
s16 i;
for (i = 0; i < 16; i++) {
interfaceCtx->unk_140[i] = 0;
interfaceCtx->unk_140[i + 16] = 0;
interfaceCtx->mapPalette[i] = 0;
interfaceCtx->mapPalette[i + 16] = 0;
}
if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, mapIndex)) {
interfaceCtx->unk_140[30] = 0;
interfaceCtx->unk_140[31] = 1;
interfaceCtx->mapPalette[30] = 0;
interfaceCtx->mapPalette[31] = 1;
}
switch (globalCtx->sceneNum) {
@ -397,7 +397,7 @@ void Minimap_Draw(GlobalContext* globalCtx) {
if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, mapIndex)) {
Minimap_DrawCompassIcons(globalCtx); // Draw icons for the player spawn and current position
func_80094520(globalCtx->state.gfxCtx);
MapMark_DrawConditionally(globalCtx);
MapMark_Draw(globalCtx);
}
}
@ -510,7 +510,7 @@ void Map_Update(GlobalContext* globalCtx) {
s16 floor;
s16 i;
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0)) {
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) {
switch (globalCtx->sceneNum) {
case SCENE_YDAN:
case SCENE_DDAN:
@ -522,11 +522,11 @@ void Map_Update(GlobalContext* globalCtx) {
case SCENE_HAKADAN:
case SCENE_HAKADANCH:
case SCENE_ICE_DOUKUTO:
interfaceCtx->unk_140[30] = 0;
interfaceCtx->mapPalette[30] = 0;
if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, mapIndex)) {
interfaceCtx->unk_140[31] = 1;
interfaceCtx->mapPalette[31] = 1;
} else {
interfaceCtx->unk_140[31] = 0;
interfaceCtx->mapPalette[31] = 0;
}
for (floor = 0; floor < 8; floor++) {

View file

@ -74,7 +74,7 @@ void MapMark_ClearPointers(GlobalContext* globalCtx) {
sLoadedMarkDataTable = NULL;
}
void MapMark_Draw(GlobalContext* globalCtx) {
void MapMark_DrawForDungeon(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx;
MapMarkIconData* mapMarkIconData;
MapMarkPoint* markPoint;
@ -86,7 +86,7 @@ void MapMark_Draw(GlobalContext* globalCtx) {
interfaceCtx = &globalCtx->interfaceCtx;
if (gMapData != NULL && globalCtx->interfaceCtx.mapRoomNum >= gMapData->dgnMinimapCount[dungeon]) {
if ((gMapData != NULL) && (globalCtx->interfaceCtx.mapRoomNum >= gMapData->dgnMinimapCount[dungeon])) {
// Translates to: "ROOM NUMBER EXCEEDED, YIKES %d/%d MapMarkDraw PROCESSING INTERRUPTED"
osSyncPrintf(VT_COL(RED, WHITE) "部屋番号がオーバーしてるで,ヤバイで %d/%d \nMapMarkDraw の処理を中断します\n",
VT_RST, globalCtx->interfaceCtx.mapRoomNum, gMapData->dgnMinimapCount[dungeon]);
@ -107,7 +107,7 @@ void MapMark_Draw(GlobalContext* globalCtx) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->minimapAlpha);
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, interfaceCtx->minimapAlpha);
markPoint = mapMarkIconData->points;
markPoint = &mapMarkIconData->points[0];
for (i = 0; i < mapMarkIconData->count; i++) {
if ((mapMarkIconData->markType != MAP_MARK_CHEST) || !Flags_GetTreasure(globalCtx, markPoint->chestFlag)) {
markInfo = &sMapMarkInfoTable[mapMarkIconData->markType];
@ -131,7 +131,7 @@ void MapMark_Draw(GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_map_mark.c", 339);
}
void MapMark_DrawConditionally(GlobalContext* globalCtx) {
void MapMark_Draw(GlobalContext* globalCtx) {
switch (globalCtx->sceneNum) {
case SCENE_YDAN:
case SCENE_DDAN:
@ -148,6 +148,7 @@ void MapMark_DrawConditionally(GlobalContext* globalCtx) {
case SCENE_BDAN_BOSS:
case SCENE_MORIBOSSROOM:
case SCENE_FIRE_BS:
MapMark_Draw(globalCtx);
MapMark_DrawForDungeon(globalCtx);
break;
}
}

View file

@ -1251,7 +1251,7 @@ void Interface_LoadItemIcon1(GlobalContext* globalCtx, u16 button) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, (u32)interfaceCtx->icon_itemSegment + button * 0x1000,
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, interfaceCtx->iconItemSegment + button * 0x1000,
(u32)_icon_item_staticSegmentRomStart + (gSaveContext.equips.buttonItems[button] * 0x1000),
0x1000, 0, &interfaceCtx->loadQueue, NULL, "../z_parameter.c", 1171);
osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
@ -1261,7 +1261,7 @@ void Interface_LoadItemIcon2(GlobalContext* globalCtx, u16 button) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_180, (u32)interfaceCtx->icon_itemSegment + button * 0x1000,
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_180, interfaceCtx->iconItemSegment + button * 0x1000,
(u32)_icon_item_staticSegmentRomStart + (gSaveContext.equips.buttonItems[button] * 0x1000),
0x1000, 0, &interfaceCtx->loadQueue, NULL, "../z_parameter.c", 1193);
osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
@ -1998,7 +1998,7 @@ void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 button) {
Interface_LoadItemIcon1(globalCtx, button);
globalCtx->pauseCtx.unk_23E = item;
globalCtx->pauseCtx.cursorItem[PAUSE_ITEM] = item;
gSaveContext.buttonStatus[button] = BTN_ENABLED;
}
@ -2053,12 +2053,12 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 a
if ((action != 0x0A) && (action != 0x27) && (action != 0x44)) {
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, (u32)interfaceCtx->do_actionSegment + (arg2 * 0x180),
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, interfaceCtx->doActionSegment + (arg2 * 0x180),
(u32)_do_action_staticSegmentRomStart + (action * 0x180), 0x180, 0,
&interfaceCtx->loadQueue, NULL, "../z_parameter.c", 2145);
osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
} else {
gSegments[7] = VIRTUAL_TO_PHYSICAL(interfaceCtx->do_actionSegment);
gSegments[7] = VIRTUAL_TO_PHYSICAL(interfaceCtx->doActionSegment);
func_80086D5C(SEGMENTED_TO_VIRTUAL(sDoActionTextures[arg2]), 0x180 / 4);
}
}
@ -2114,7 +2114,7 @@ void Interface_LoadActionLabelB(GlobalContext* globalCtx, u16 action) {
interfaceCtx->unk_1FC = action;
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, (u32)interfaceCtx->do_actionSegment + 0x180,
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, interfaceCtx->doActionSegment + 0x180,
(u32)_do_action_staticSegmentRomStart + (action * 0x180), 0x180, 0, &interfaceCtx->loadQueue,
NULL, "../z_parameter.c", 2228);
osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
@ -2452,7 +2452,7 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
break;
case 7:
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && (msgCtx->msgMode == 0) &&
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) && (msgCtx->msgMode == 0) &&
(globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && (globalCtx->sceneLoadFlag == 0) &&
(globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx)) {
if ((gSaveContext.magic == 0) || ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) ||
@ -2668,7 +2668,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_B_BTN_COLOR(0), R_B_BTN_COLOR(1), R_B_BTN_COLOR(2), interfaceCtx->bAlpha);
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255);
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, &D_02000A00[0], 32, 32, R_ITEM_BTN_X(0), R_ITEM_BTN_Y(0),
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, D_02000A00[0], 32, 32, R_ITEM_BTN_X(0), R_ITEM_BTN_Y(0),
R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_DD(0) * 2, R_ITEM_BTN_DD(0) * 2);
// C-Left Button Color & Texture
@ -2694,7 +2694,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(3) * 2, R_ITEM_BTN_DD(3) * 2);
if ((pauseCtx->state < 8) || (pauseCtx->state >= 18)) {
if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.flag != 0)) {
if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) {
// Start Button Texture, Color & Label
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 120, 120, interfaceCtx->startAlpha);
@ -2707,7 +2707,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPLoadTextureBlock_4b(OVERLAY_DISP++, (u32)interfaceCtx->do_actionSegment + 0x300, G_IM_FMT_IA, 48, 16, 0,
gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + 0x300, G_IM_FMT_IA, 48, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
@ -2721,7 +2721,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
}
}
if (interfaceCtx->naviCalling && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) &&
if (interfaceCtx->naviCalling && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) &&
(globalCtx->csCtx.state == CS_STATE_IDLE)) {
if (!sCUpInvisible) {
// C-Up Button Texture, Color & Label (Navi Text)
@ -2777,7 +2777,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
interfaceCtx->cRightAlpha);
}
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, &D_02000A00[temp + 1], 0x20, 0x20, R_ITEM_BTN_X(temp),
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, D_02000A00[temp + 1], 0x20, 0x20, R_ITEM_BTN_X(temp),
R_ITEM_BTN_Y(temp), R_ITEM_BTN_WIDTH(temp), R_ITEM_BTN_WIDTH(temp),
R_ITEM_BTN_DD(temp) * 2, R_ITEM_BTN_DD(temp) * 2);
}
@ -2847,11 +2847,11 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) {
}
if (i != 0) {
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, &D_020035C0[i], 8, 8, R_ITEM_AMMO_X(button),
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, D_020035C0[i], 8, 8, R_ITEM_AMMO_X(button),
R_ITEM_AMMO_Y(button), 8, 8, 1024, 1024);
}
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, &D_020035C0[ammo], 8, 8, R_ITEM_AMMO_X(button) + 6,
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, D_020035C0[ammo], 8, 8, R_ITEM_AMMO_X(button) + 6,
R_ITEM_AMMO_Y(button), 8, 8, 1024, 1024);
}
@ -2871,9 +2871,9 @@ void Interface_DrawActionButton(GlobalContext* globalCtx) {
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_parameter.c", 3177),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPVertex(OVERLAY_DISP++, interfaceCtx->vtx_128, 4, 0);
gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[0], 4, 0);
gDPLoadTextureBlock(OVERLAY_DISP++, &D_02000A00[0], G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP,
gDPLoadTextureBlock(OVERLAY_DISP++, D_02000A00[0], G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0);
@ -2885,101 +2885,104 @@ void Interface_InitVertices(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
s16 i;
interfaceCtx->vtx_128 = Graph_Alloc(globalCtx->state.gfxCtx, 8 * sizeof(Vtx));
interfaceCtx->actionVtx = Graph_Alloc(globalCtx->state.gfxCtx, 8 * sizeof(Vtx));
// clang-format off
interfaceCtx->vtx_128[0].v.ob[0] =
interfaceCtx->vtx_128[2].v.ob[0] = -14;
interfaceCtx->vtx_128[1].v.ob[0] =
interfaceCtx->vtx_128[3].v.ob[0] = interfaceCtx->vtx_128[0].v.ob[0] + 28;
interfaceCtx->actionVtx[0].v.ob[0] =
interfaceCtx->actionVtx[2].v.ob[0] = -14;
interfaceCtx->actionVtx[1].v.ob[0] =
interfaceCtx->actionVtx[3].v.ob[0] = interfaceCtx->actionVtx[0].v.ob[0] + 28;
interfaceCtx->vtx_128[0].v.ob[1] =
interfaceCtx->vtx_128[1].v.ob[1] = 14;
interfaceCtx->vtx_128[2].v.ob[1] =
interfaceCtx->vtx_128[3].v.ob[1] = interfaceCtx->vtx_128[0].v.ob[1] - 28;
interfaceCtx->actionVtx[0].v.ob[1] =
interfaceCtx->actionVtx[1].v.ob[1] = 14;
interfaceCtx->actionVtx[2].v.ob[1] =
interfaceCtx->actionVtx[3].v.ob[1] = interfaceCtx->actionVtx[0].v.ob[1] - 28;
interfaceCtx->vtx_128[4].v.ob[0] =
interfaceCtx->vtx_128[6].v.ob[0] = -(XREG(21) / 2);
interfaceCtx->vtx_128[5].v.ob[0] =
interfaceCtx->vtx_128[7].v.ob[0] = interfaceCtx->vtx_128[4].v.ob[0] + XREG(21);
interfaceCtx->actionVtx[4].v.ob[0] =
interfaceCtx->actionVtx[6].v.ob[0] = -(XREG(21) / 2);
interfaceCtx->actionVtx[5].v.ob[0] =
interfaceCtx->actionVtx[7].v.ob[0] = interfaceCtx->actionVtx[4].v.ob[0] + XREG(21);
interfaceCtx->vtx_128[4].v.ob[1] =
interfaceCtx->vtx_128[5].v.ob[1] = XREG(28) / 2;
interfaceCtx->vtx_128[6].v.ob[1] =
interfaceCtx->vtx_128[7].v.ob[1] = interfaceCtx->vtx_128[4].v.ob[1] - XREG(28);
interfaceCtx->actionVtx[4].v.ob[1] =
interfaceCtx->actionVtx[5].v.ob[1] = XREG(28) / 2;
interfaceCtx->actionVtx[6].v.ob[1] =
interfaceCtx->actionVtx[7].v.ob[1] = interfaceCtx->actionVtx[4].v.ob[1] - XREG(28);
for (i = 0; i < 8; i += 4) {
interfaceCtx->vtx_128[i].v.ob[2] = interfaceCtx->vtx_128[i+1].v.ob[2] =
interfaceCtx->vtx_128[i+2].v.ob[2] = interfaceCtx->vtx_128[i+3].v.ob[2] = 0;
interfaceCtx->actionVtx[i].v.ob[2] = interfaceCtx->actionVtx[i+1].v.ob[2] =
interfaceCtx->actionVtx[i+2].v.ob[2] = interfaceCtx->actionVtx[i+3].v.ob[2] = 0;
interfaceCtx->vtx_128[i].v.flag = interfaceCtx->vtx_128[i+1].v.flag =
interfaceCtx->vtx_128[i+2].v.flag = interfaceCtx->vtx_128[i+3].v.flag = 0;
interfaceCtx->actionVtx[i].v.flag = interfaceCtx->actionVtx[i+1].v.flag =
interfaceCtx->actionVtx[i+2].v.flag = interfaceCtx->actionVtx[i+3].v.flag = 0;
interfaceCtx->vtx_128[i].v.tc[0] = interfaceCtx->vtx_128[i].v.tc[1] =
interfaceCtx->vtx_128[i+1].v.tc[1] = interfaceCtx->vtx_128[i+2].v.tc[0] = 0;
interfaceCtx->vtx_128[i+1].v.tc[0] = interfaceCtx->vtx_128[i+2].v.tc[1] =
interfaceCtx->vtx_128[i+3].v.tc[0] = interfaceCtx->vtx_128[i+3].v.tc[1] = 1024;
interfaceCtx->actionVtx[i].v.tc[0] = interfaceCtx->actionVtx[i].v.tc[1] =
interfaceCtx->actionVtx[i+1].v.tc[1] = interfaceCtx->actionVtx[i+2].v.tc[0] = 0;
interfaceCtx->actionVtx[i+1].v.tc[0] = interfaceCtx->actionVtx[i+2].v.tc[1] =
interfaceCtx->actionVtx[i+3].v.tc[0] = interfaceCtx->actionVtx[i+3].v.tc[1] = 1024;
interfaceCtx->vtx_128[i].v.cn[0] = interfaceCtx->vtx_128[i+1].v.cn[0] =
interfaceCtx->vtx_128[i+2].v.cn[0] = interfaceCtx->vtx_128[i+3].v.cn[0] =
interfaceCtx->vtx_128[i].v.cn[1] = interfaceCtx->vtx_128[i+1].v.cn[1] =
interfaceCtx->vtx_128[i+2].v.cn[1] = interfaceCtx->vtx_128[i+3].v.cn[1] =
interfaceCtx->vtx_128[i].v.cn[2] = interfaceCtx->vtx_128[i+1].v.cn[2] =
interfaceCtx->vtx_128[i+2].v.cn[2] = interfaceCtx->vtx_128[i+3].v.cn[2] = 0xFF;
interfaceCtx->actionVtx[i].v.cn[0] = interfaceCtx->actionVtx[i+1].v.cn[0] =
interfaceCtx->actionVtx[i+2].v.cn[0] = interfaceCtx->actionVtx[i+3].v.cn[0] =
interfaceCtx->actionVtx[i].v.cn[1] = interfaceCtx->actionVtx[i+1].v.cn[1] =
interfaceCtx->actionVtx[i+2].v.cn[1] = interfaceCtx->actionVtx[i+3].v.cn[1] =
interfaceCtx->actionVtx[i].v.cn[2] = interfaceCtx->actionVtx[i+1].v.cn[2] =
interfaceCtx->actionVtx[i+2].v.cn[2] = interfaceCtx->actionVtx[i+3].v.cn[2] = 255;
interfaceCtx->vtx_128[i].v.cn[3] = interfaceCtx->vtx_128[i+1].v.cn[3] =
interfaceCtx->vtx_128[i+2].v.cn[3] = interfaceCtx->vtx_128[i+3].v.cn[3] = 0xFF;
interfaceCtx->actionVtx[i].v.cn[3] = interfaceCtx->actionVtx[i+1].v.cn[3] =
interfaceCtx->actionVtx[i+2].v.cn[3] = interfaceCtx->actionVtx[i+3].v.cn[3] = 255;
}
interfaceCtx->vtx_128[5].v.tc[0] = interfaceCtx->vtx_128[7].v.tc[0] = 1536;
interfaceCtx->vtx_128[6].v.tc[1] = interfaceCtx->vtx_128[7].v.tc[1] = 512;
interfaceCtx->actionVtx[5].v.tc[0] = interfaceCtx->actionVtx[7].v.tc[0] = 1536;
interfaceCtx->actionVtx[6].v.tc[1] = interfaceCtx->actionVtx[7].v.tc[1] = 512;
interfaceCtx->vtx_12C = Graph_Alloc(globalCtx->state.gfxCtx, 4 * sizeof(Vtx));
interfaceCtx->beatingHeartVtx = Graph_Alloc(globalCtx->state.gfxCtx, 4 * sizeof(Vtx));
interfaceCtx->vtx_12C[0].v.ob[0] = interfaceCtx->vtx_12C[2].v.ob[0] = -8;
interfaceCtx->vtx_12C[1].v.ob[0] = interfaceCtx->vtx_12C[3].v.ob[0] = 8;
interfaceCtx->vtx_12C[0].v.ob[1] = interfaceCtx->vtx_12C[1].v.ob[1] = 8;
interfaceCtx->vtx_12C[2].v.ob[1] = interfaceCtx->vtx_12C[3].v.ob[1] = -8;
interfaceCtx->beatingHeartVtx[0].v.ob[0] = interfaceCtx->beatingHeartVtx[2].v.ob[0] = -8;
interfaceCtx->beatingHeartVtx[1].v.ob[0] = interfaceCtx->beatingHeartVtx[3].v.ob[0] = 8;
interfaceCtx->beatingHeartVtx[0].v.ob[1] = interfaceCtx->beatingHeartVtx[1].v.ob[1] = 8;
interfaceCtx->beatingHeartVtx[2].v.ob[1] = interfaceCtx->beatingHeartVtx[3].v.ob[1] = -8;
interfaceCtx->vtx_12C[0].v.ob[2] = interfaceCtx->vtx_12C[1].v.ob[2] =
interfaceCtx->vtx_12C[2].v.ob[2] = interfaceCtx->vtx_12C[3].v.ob[2] = 0;
interfaceCtx->beatingHeartVtx[0].v.ob[2] = interfaceCtx->beatingHeartVtx[1].v.ob[2] =
interfaceCtx->beatingHeartVtx[2].v.ob[2] = interfaceCtx->beatingHeartVtx[3].v.ob[2] = 0;
interfaceCtx->vtx_12C[0].v.flag = interfaceCtx->vtx_12C[1].v.flag =
interfaceCtx->vtx_12C[2].v.flag = interfaceCtx->vtx_12C[3].v.flag = 0;
interfaceCtx->beatingHeartVtx[0].v.flag = interfaceCtx->beatingHeartVtx[1].v.flag =
interfaceCtx->beatingHeartVtx[2].v.flag = interfaceCtx->beatingHeartVtx[3].v.flag = 0;
interfaceCtx->vtx_12C[0].v.tc[0] = interfaceCtx->vtx_12C[0].v.tc[1] =
interfaceCtx->vtx_12C[1].v.tc[1] = interfaceCtx->vtx_12C[2].v.tc[0] = 0;
interfaceCtx->vtx_12C[1].v.tc[0] = interfaceCtx->vtx_12C[2].v.tc[1] =
interfaceCtx->vtx_12C[3].v.tc[0] = interfaceCtx->vtx_12C[3].v.tc[1] = 512;
interfaceCtx->beatingHeartVtx[0].v.tc[0] = interfaceCtx->beatingHeartVtx[0].v.tc[1] =
interfaceCtx->beatingHeartVtx[1].v.tc[1] = interfaceCtx->beatingHeartVtx[2].v.tc[0] = 0;
interfaceCtx->beatingHeartVtx[1].v.tc[0] = interfaceCtx->beatingHeartVtx[2].v.tc[1] =
interfaceCtx->beatingHeartVtx[3].v.tc[0] = interfaceCtx->beatingHeartVtx[3].v.tc[1] = 512;
interfaceCtx->vtx_12C[0].v.cn[0] = interfaceCtx->vtx_12C[1].v.cn[0] =
interfaceCtx->vtx_12C[2].v.cn[0] = interfaceCtx->vtx_12C[3].v.cn[0] =
interfaceCtx->vtx_12C[0].v.cn[1] = interfaceCtx->vtx_12C[1].v.cn[1] =
interfaceCtx->vtx_12C[2].v.cn[1] = interfaceCtx->vtx_12C[3].v.cn[1] =
interfaceCtx->vtx_12C[0].v.cn[2] = interfaceCtx->vtx_12C[1].v.cn[2] =
interfaceCtx->vtx_12C[2].v.cn[2] = interfaceCtx->vtx_12C[3].v.cn[2] =
interfaceCtx->vtx_12C[0].v.cn[3] = interfaceCtx->vtx_12C[1].v.cn[3] =
interfaceCtx->vtx_12C[2].v.cn[3] = interfaceCtx->vtx_12C[3].v.cn[3] = 0xFF;
interfaceCtx->beatingHeartVtx[0].v.cn[0] = interfaceCtx->beatingHeartVtx[1].v.cn[0] =
interfaceCtx->beatingHeartVtx[2].v.cn[0] = interfaceCtx->beatingHeartVtx[3].v.cn[0] =
interfaceCtx->beatingHeartVtx[0].v.cn[1] = interfaceCtx->beatingHeartVtx[1].v.cn[1] =
interfaceCtx->beatingHeartVtx[2].v.cn[1] = interfaceCtx->beatingHeartVtx[3].v.cn[1] =
interfaceCtx->beatingHeartVtx[0].v.cn[2] = interfaceCtx->beatingHeartVtx[1].v.cn[2] =
interfaceCtx->beatingHeartVtx[2].v.cn[2] = interfaceCtx->beatingHeartVtx[3].v.cn[2] =
interfaceCtx->beatingHeartVtx[0].v.cn[3] = interfaceCtx->beatingHeartVtx[1].v.cn[3] =
interfaceCtx->beatingHeartVtx[2].v.cn[3] = interfaceCtx->beatingHeartVtx[3].v.cn[3] = 255;
// clang-format on
}
void func_8008A8B8(GlobalContext* globalCtx, s32 topY, s32 bottomY, s32 leftX, s32 rightX) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
Vec3f sp40;
Vec3f sp34;
Vec3f sp28;
Vec3f eye;
Vec3f lookAt;
Vec3f up;
eye.x = eye.y = eye.z = 0.0f;
lookAt.x = lookAt.y = 0.0f;
lookAt.z = -1.0f;
up.x = up.z = 0.0f;
up.y = 1.0f;
func_800AA358(&interfaceCtx->view, &eye, &lookAt, &up);
sp40.x = sp40.y = sp40.z = 0.0f;
sp34.x = sp34.y = 0.0f;
sp34.z = -1.0f;
sp28.x = sp28.z = 0.0f;
sp28.y = 1.0f;
func_800AA358(&interfaceCtx->view, &sp40, &sp34, &sp28);
interfaceCtx->viewport.topY = topY;
interfaceCtx->viewport.bottomY = bottomY;
interfaceCtx->viewport.leftX = leftX;
interfaceCtx->viewport.rightX = rightX;
View_SetViewport(&interfaceCtx->view, &interfaceCtx->viewport);
func_800AA460(&interfaceCtx->view, 60.0f, 10.0f, 60.0f);
func_800AB560(&interfaceCtx->view);
}
@ -2989,9 +2992,9 @@ void func_8008A994(InterfaceContext* interfaceCtx) {
func_800AB2C4(&interfaceCtx->view);
}
s16 sMagicArrowEffectsR[] = { 0xFF, 0x64, 0xFF };
s16 sMagicArrowEffectsG[] = { 0x00, 0x64, 0xFF };
s16 sMagicArrowEffectsB[] = { 0x00, 0xFF, 0x64 };
s16 sMagicArrowEffectsR[] = { 255, 100, 255 };
s16 sMagicArrowEffectsG[] = { 0, 100, 255 };
s16 sMagicArrowEffectsB[] = { 0, 255, 100 };
s16 sTimerDigitLeftPos[] = { 16, 25, 34, 42, 51 };
s16 sDigitWidth[] = { 9, 9, 8, 9, 9 };
@ -3039,11 +3042,11 @@ void Interface_Draw(GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3405);
gSPSegment(OVERLAY_DISP++, 0x02, interfaceCtx->parameterSegment);
gSPSegment(OVERLAY_DISP++, 0x07, interfaceCtx->do_actionSegment);
gSPSegment(OVERLAY_DISP++, 0x08, interfaceCtx->icon_itemSegment);
gSPSegment(OVERLAY_DISP++, 0x07, interfaceCtx->doActionSegment);
gSPSegment(OVERLAY_DISP++, 0x08, interfaceCtx->iconItemSegment);
gSPSegment(OVERLAY_DISP++, 0x0B, interfaceCtx->mapSegment);
if (pauseCtx->flag == 0) {
if (pauseCtx->debugState == 0) {
Interface_InitVertices(globalCtx);
func_8008A994(interfaceCtx);
HealthMeter_Draw(globalCtx);
@ -3093,12 +3096,12 @@ void Interface_Draw(GlobalContext* globalCtx) {
phi_s2 = 42;
if (interfaceCtx->counterDigits[2] != 0) {
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP, &D_02003040[interfaceCtx->counterDigits[2]], 8, 16,
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP, D_02003040[interfaceCtx->counterDigits[2]], 8, 16,
phi_s2, 190, 8, 16, 1024, 1024);
phi_s2 = 50;
}
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP, &D_02003040[interfaceCtx->counterDigits[3]], 8, 16,
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP, D_02003040[interfaceCtx->counterDigits[3]], 8, 16,
phi_s2, 190, 8, 16, 1024, 1024);
}
@ -3146,7 +3149,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
phi_s1 = sRupeeDigitsCount[CUR_UPG_VALUE(UPG_WALLET)];
for (phi_s3 = 0; phi_s3 < phi_s1; phi_s3++, phi_s0++, phi_s2 += 8) {
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP, &D_02003040[interfaceCtx->counterDigits[phi_s0]], 8, 16, phi_s2,
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP, D_02003040[interfaceCtx->counterDigits[phi_s0]], 8, 16, phi_s2,
206, 8, 16, 1024, 1024);
}
@ -3168,7 +3171,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
if (interfaceCtx->unk_1FA == 0) {
// B Button Icon & possibly Ammo Count
if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) {
Interface_DrawItemIconTexture(globalCtx, (void*)(u32)interfaceCtx->icon_itemSegment, 0);
Interface_DrawItemIconTexture(globalCtx, interfaceCtx->iconItemSegment, 0);
if ((player->stateFlags1 & 0x00800000) || (globalCtx->shootingGalleryStatus > 1) ||
((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) {
@ -3185,7 +3188,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha);
gDPLoadTextureBlock_4b(OVERLAY_DISP++, (u32)interfaceCtx->do_actionSegment + 0x180, G_IM_FMT_IA, 48, 16, 0,
gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + 0x180, G_IM_FMT_IA, 48, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
@ -3202,7 +3205,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
if (gSaveContext.equips.buttonItems[1] < 0xF0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cLeftAlpha);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
Interface_DrawItemIconTexture(globalCtx, (void*)((u32)interfaceCtx->icon_itemSegment + 0x1000), 1);
Interface_DrawItemIconTexture(globalCtx, interfaceCtx->iconItemSegment + 0x1000, 1);
gDPPipeSync(OVERLAY_DISP++);
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
@ -3215,7 +3218,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
if (gSaveContext.equips.buttonItems[2] < 0xF0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cDownAlpha);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
Interface_DrawItemIconTexture(globalCtx, (void*)((u32)interfaceCtx->icon_itemSegment + 0x2000), 2);
Interface_DrawItemIconTexture(globalCtx, interfaceCtx->iconItemSegment + 0x2000, 2);
gDPPipeSync(OVERLAY_DISP++);
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
@ -3228,7 +3231,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
if (gSaveContext.equips.buttonItems[3] < 0xF0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cRightAlpha);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
Interface_DrawItemIconTexture(globalCtx, (void*)((u32)interfaceCtx->icon_itemSegment + 0x3000), 3);
Interface_DrawItemIconTexture(globalCtx, interfaceCtx->iconItemSegment + 0x3000, 3);
gDPPipeSync(OVERLAY_DISP++);
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
@ -3255,12 +3258,12 @@ void Interface_Draw(GlobalContext* globalCtx) {
Matrix_RotateX(interfaceCtx->unk_1F4 / 10000.0f, MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_parameter.c", 3701),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPVertex(OVERLAY_DISP++, &interfaceCtx->vtx_128[4], 4, 0);
gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[4], 4, 0);
if ((interfaceCtx->unk_1EC < 2) || (interfaceCtx->unk_1EC == 3)) {
Interface_DrawActionLabel(globalCtx->state.gfxCtx, (void*)(u32)interfaceCtx->do_actionSegment);
Interface_DrawActionLabel(globalCtx->state.gfxCtx, interfaceCtx->doActionSegment);
} else {
Interface_DrawActionLabel(globalCtx->state.gfxCtx, (void*)((u32)interfaceCtx->do_actionSegment + 0x180));
Interface_DrawActionLabel(globalCtx->state.gfxCtx, interfaceCtx->doActionSegment + 0x180);
}
gDPPipeSync(OVERLAY_DISP++);
@ -3269,45 +3272,45 @@ void Interface_Draw(GlobalContext* globalCtx) {
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 3)) {
// Inventory Equip Effects
gSPSegment(OVERLAY_DISP++, 0x08, pauseCtx->unk_128);
gSPSegment(OVERLAY_DISP++, 0x08, pauseCtx->iconItemSegment);
func_80094A14(globalCtx->state.gfxCtx);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gSPMatrix(OVERLAY_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
pauseCtx->vtx_168[16].v.ob[0] = pauseCtx->vtx_168[18].v.ob[0] = pauseCtx->unk_254 / 10;
pauseCtx->vtx_168[17].v.ob[0] = pauseCtx->vtx_168[19].v.ob[0] =
pauseCtx->vtx_168[16].v.ob[0] + WREG(90) / 10;
pauseCtx->vtx_168[16].v.ob[1] = pauseCtx->vtx_168[17].v.ob[1] = pauseCtx->unk_256 / 10;
pauseCtx->vtx_168[18].v.ob[1] = pauseCtx->vtx_168[19].v.ob[1] =
pauseCtx->vtx_168[16].v.ob[1] - WREG(90) / 10;
pauseCtx->cursorVtx[16].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = pauseCtx->equipAnimX / 10;
pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] =
pauseCtx->cursorVtx[16].v.ob[0] + WREG(90) / 10;
pauseCtx->cursorVtx[16].v.ob[1] = pauseCtx->cursorVtx[17].v.ob[1] = pauseCtx->equipAnimY / 10;
pauseCtx->cursorVtx[18].v.ob[1] = pauseCtx->cursorVtx[19].v.ob[1] =
pauseCtx->cursorVtx[16].v.ob[1] - WREG(90) / 10;
if (pauseCtx->unk_24E < 0xBF) {
if (pauseCtx->equipTargetItem < 0xBF) {
// Normal Equip (icon goes from the inventory slot to the C button when equipping it)
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, pauseCtx->unk_258);
gSPVertex(OVERLAY_DISP++, &pauseCtx->vtx_168[16], 4, 0);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, pauseCtx->equipAnimAlpha);
gSPVertex(OVERLAY_DISP++, &pauseCtx->cursorVtx[16], 4, 0);
gDPLoadTextureBlock(OVERLAY_DISP++, gItemIcons[pauseCtx->unk_24E], G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32,
0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gDPLoadTextureBlock(OVERLAY_DISP++, gItemIcons[pauseCtx->equipTargetItem], G_IM_FMT_RGBA, G_IM_SIZ_32b,
32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
} else {
// Magic Arrow Equip Effect
phi_s3_2 = pauseCtx->unk_24E - 0xBF;
phi_s3_2 = pauseCtx->equipTargetItem - 0xBF;
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sMagicArrowEffectsR[phi_s3_2], sMagicArrowEffectsG[phi_s3_2],
sMagicArrowEffectsB[phi_s3_2], pauseCtx->unk_258);
sMagicArrowEffectsB[phi_s3_2], pauseCtx->equipAnimAlpha);
if ((pauseCtx->unk_258 > 0) && (pauseCtx->unk_258 < 0xFF)) {
phi_s3_2 = (pauseCtx->unk_258 / 8) / 2;
pauseCtx->vtx_168[16].v.ob[0] = pauseCtx->vtx_168[18].v.ob[0] =
pauseCtx->vtx_168[16].v.ob[0] - phi_s3_2;
pauseCtx->vtx_168[17].v.ob[0] = pauseCtx->vtx_168[19].v.ob[0] =
pauseCtx->vtx_168[16].v.ob[0] + phi_s3_2 * 2 + 32;
pauseCtx->vtx_168[16].v.ob[1] = pauseCtx->vtx_168[17].v.ob[1] =
pauseCtx->vtx_168[16].v.ob[1] + phi_s3_2;
pauseCtx->vtx_168[18].v.ob[1] = pauseCtx->vtx_168[19].v.ob[1] =
pauseCtx->vtx_168[16].v.ob[1] - phi_s3_2 * 2 - 32;
if ((pauseCtx->equipAnimAlpha > 0) && (pauseCtx->equipAnimAlpha < 255)) {
phi_s3_2 = (pauseCtx->equipAnimAlpha / 8) / 2;
pauseCtx->cursorVtx[16].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] =
pauseCtx->cursorVtx[16].v.ob[0] - phi_s3_2;
pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] =
pauseCtx->cursorVtx[16].v.ob[0] + phi_s3_2 * 2 + 32;
pauseCtx->cursorVtx[16].v.ob[1] = pauseCtx->cursorVtx[17].v.ob[1] =
pauseCtx->cursorVtx[16].v.ob[1] + phi_s3_2;
pauseCtx->cursorVtx[18].v.ob[1] = pauseCtx->cursorVtx[19].v.ob[1] =
pauseCtx->cursorVtx[16].v.ob[1] - phi_s3_2 * 2 - 32;
}
gSPVertex(OVERLAY_DISP++, &pauseCtx->vtx_168[16], 4, 0);
gSPVertex(OVERLAY_DISP++, &pauseCtx->cursorVtx[16], 4, 0);
gDPLoadTextureBlock(OVERLAY_DISP++, D_080895C0, G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
@ -3318,7 +3321,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
func_80094520(globalCtx->state.gfxCtx);
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0)) {
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) {
if (gSaveContext.minigameState != 1) {
// Carrots rendering if the action corresponds to riding a horse
if (interfaceCtx->unk_1EE == 8) {
@ -3364,7 +3367,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
for (phi_s3 = 0; phi_s3 < 4; phi_s3++) {
if (sHBAScoreDigits[phi_s3] != 0 || (phi_s0 != 0) || (phi_s3 >= 3)) {
OVERLAY_DISP =
Gfx_TextureI8(OVERLAY_DISP, &D_02003040[sHBAScoreDigits[phi_s3]], 8, 16, phi_s1,
Gfx_TextureI8(OVERLAY_DISP, D_02003040[sHBAScoreDigits[phi_s3]], 8, 16, phi_s1,
ZREG(15) - 2, sDigitWidth[0], VREG(42), VREG(43) * 2, VREG(43) * 2);
phi_s1 += 9;
phi_s0++;
@ -3413,7 +3416,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
}
}
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) &&
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) &&
(globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && (msgCtx->msgMode == 0) &&
!(player->stateFlags2 & 0x01000000) && (globalCtx->sceneLoadFlag == 0) &&
(globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx) && (gSaveContext.minigameState != 1) &&
@ -3779,7 +3782,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
}
for (phi_s3 = 0; phi_s3 < 5; phi_s3++) {
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP, &D_02003040[sTimerDigits[phi_s3]], 8, 16,
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP, D_02003040[sTimerDigits[phi_s3]], 8, 16,
gSaveContext.timerX[sp274] + sTimerDigitLeftPos[phi_s3],
gSaveContext.timerY[sp274], sDigitWidth[phi_s3], VREG(42),
VREG(43) * 2, VREG(43) * 2);
@ -3788,7 +3791,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
}
}
if (pauseCtx->flag == 3) {
if (pauseCtx->debugState == 3) {
FlagSet_Update(globalCtx);
}
@ -3832,7 +3835,7 @@ void Interface_Update(GlobalContext* globalCtx) {
osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
}
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0)) {
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) {
if ((gSaveContext.minigameState == 1) || (gSaveContext.sceneSetupIndex < 4) ||
((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneSetupIndex == 4))) {
if ((msgCtx->msgMode == 0) || ((msgCtx->msgMode != 0) && (globalCtx->sceneNum == SCENE_BOWLING))) {
@ -3974,7 +3977,7 @@ void Interface_Update(GlobalContext* globalCtx) {
HealthMeter_Update(globalCtx);
if ((gSaveContext.timer1State >= 3) && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) &&
if ((gSaveContext.timer1State >= 3) && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) &&
(msgCtx->msgMode == 0) && !(player->stateFlags2 & 0x01000000) && (globalCtx->sceneLoadFlag == 0) &&
(globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx)) {}
@ -4055,7 +4058,7 @@ void Interface_Update(GlobalContext* globalCtx) {
WREG(7) = interfaceCtx->unk_1F4;
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && (msgCtx->msgMode == 0) &&
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) && (msgCtx->msgMode == 0) &&
(globalCtx->sceneLoadFlag == 0) && (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) &&
(globalCtx->transitionMode == 0) &&
((globalCtx->csCtx.state == CS_STATE_IDLE) || !Player_InCsMode(globalCtx))) {

View file

@ -778,7 +778,7 @@ void Gameplay_Update(GlobalContext* globalCtx) {
LOG_NUM("1", 1, "../z_play.c", 3551);
}
sp80 = (globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.flag != 0);
sp80 = (globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3555);
@ -903,7 +903,7 @@ void Gameplay_Update(GlobalContext* globalCtx) {
if (globalCtx->unk_1242B != 0) {
if (CHECK_BTN_ALL(input[0].press.button, BTN_CUP)) {
if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.flag != 0)) {
if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) {
// Translates to: "Changing viewpoint is prohibited due to the kaleidoscope"
osSyncPrintf(VT_FGCOL(CYAN) "カレイドスコープ中につき視点変更を禁止しております\n" VT_RST);
} else if (Player_InCsMode(globalCtx)) {
@ -928,7 +928,7 @@ void Gameplay_Update(GlobalContext* globalCtx) {
LOG_NUM("1", 1, "../z_play.c", 3716);
}
if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.flag != 0)) {
if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) {
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3721);
}
@ -1031,7 +1031,7 @@ skip:
}
void Gameplay_DrawOverlayElements(GlobalContext* globalCtx) {
if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.flag != 0)) {
if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) {
KaleidoScopeCall_Draw(globalCtx);
}

View file

@ -1367,7 +1367,7 @@ u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) {
SkelAnime_InitLink(globalCtx, skelAnime, gPlayerSkelHeaders[(void)0, gSaveContext.linkAge], &gPlayerAnim_003238, 9,
ptr, ptr, PLAYER_LIMB_MAX);
return size + 0x8890;
return size + 0x8800 + 0x90;
}
u8 D_801261F8[] = { 2, 2, 5 };
@ -1412,7 +1412,7 @@ s32 func_80091880(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
return 0;
}
void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime* arg3, Vec3f* pos, Vec3s* rot,
void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot,
f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width, s32 height, Vec3f* eye, Vec3f* at,
f32 fovy, void* img1, void* img2) {
static Vp viewport = { 128, 224, 511, 0, 128, 224, 511, 0 };
@ -1503,8 +1503,8 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime
gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList);
func_8008F470(globalCtx, arg3->skeleton, arg3->jointTable, arg3->dListCount, 0, tunic, boots, 0, func_80091880,
NULL, &sp12C);
func_8008F470(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0,
func_80091880, NULL, &sp12C);
gSPEndDisplayList(POLY_OPA_DISP++);
gSPEndDisplayList(POLY_XLU_DISP++);
@ -1515,8 +1515,8 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 3288);
}
void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* arg2, Vec3f* pos, Vec3s* rot, f32 scale, s32 sword,
s32 tunic, s32 shield, s32 boots) {
void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale,
s32 sword, s32 tunic, s32 shield, s32 boots) {
static Vec3f eye = { 0.0f, 0.0f, -400.0f };
static Vec3f at = { 0.0f, 0.0f, 0.0f };
Vec3s* destTable;
@ -1543,12 +1543,12 @@ void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* arg2, Vec3f
}
srcTable = SEGMENTED_TO_VIRTUAL(srcTable);
destTable = arg2->jointTable;
for (i = 0; i < arg2->limbCount; i++) {
destTable = skelAnime->jointTable;
for (i = 0; i < skelAnime->limbCount; i++) {
*destTable++ = *srcTable++;
}
func_80091A24(globalCtx, segment + 0x3800, segment + 0x8800, arg2, pos, rot, scale, sword, tunic, shield, boots, 64,
112, &eye, &at, 60.0f, globalCtx->state.gfxCtx->curFrameBuffer,
func_80091A24(globalCtx, segment + 0x3800, segment + 0x8800, skelAnime, pos, rot, scale, sword, tunic, shield,
boots, 64, 112, &eye, &at, 60.0f, globalCtx->state.gfxCtx->curFrameBuffer,
globalCtx->state.gfxCtx->curFrameBuffer + 0x1C00);
}

View file

@ -27,7 +27,7 @@ void Sample_Draw(SampleContext* this) {
gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_LOAD);
}
POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP, 0xFF, 0xFF, 0xFF, 0, 0, 0);
POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP, 255, 255, 255, 0, 0, 0);
func_80093D18(gfxCtx);
gDPSetCycleType(POLY_OPA_DISP++, G_CYC_1CYCLE);
@ -54,24 +54,24 @@ void Sample_SetupView(SampleContext* this) {
View_Init(view, gfxCtx);
SET_FULLSCREEN_VIEWPORT(view);
func_800AA460(view, 60, 10, 12800);
func_800AA460(view, 60.0f, 10.0f, 12800.0f);
{
Vec3f v1;
Vec3f v2;
Vec3f v3;
Vec3f eye;
Vec3f lookAt;
Vec3f up;
v1.x = 0;
v1.y = 0;
v2.x = 0;
v2.y = 0;
v2.z = 0;
v3.x = 0;
v3.z = 0;
v1.z = 3000;
v3.y = 1;
eye.x = 0.0f;
eye.y = 0.0f;
eye.z = 3000.0f;
lookAt.x = 0.0f;
lookAt.y = 0.0f;
lookAt.z = 0.0f;
up.x = 0.0f;
up.z = 0.0f;
up.y = 1.0f;
func_800AA358(view, &v1, &v2, &v3);
func_800AA358(view, &eye, &lookAt, &up);
}
}

View file

@ -451,7 +451,7 @@ void Sram_OpenSave(SramContext* sramCtx) {
* Write the contents of the Save Context to a main and backup slot in SRAM.
* Note: The whole Save Context is written even though only the `save` substruct is read back later
*/
void Sram_WriteSave(s32 unused) {
void Sram_WriteSave(SramContext* sramCtx) {
u16 offset;
u16 checksum;
u16 j;

View file

@ -222,7 +222,7 @@ u32 func_809EF70C(EnDns* this) {
}
u32 func_809EF73C(EnDns* this) {
if (INV_CONTENT(SLOT_SLINGSHOT) == ITEM_NONE) {
if (INV_CONTENT(ITEM_SLINGSHOT) == ITEM_NONE) {
return 3;
}
if (AMMO(ITEM_SLINGSHOT) >= CUR_CAPACITY(UPG_BULLET_BAG)) {

View file

@ -677,12 +677,8 @@ void func_80A7D460(EnInsect* this, GlobalContext* globalCtx) {
if (sp3A == 2 && (this->unk_314 & 0x10) && !(this->unk_314 & 0x80)) {
if (this->unk_32A >= 15) {
if (this->soilActor != NULL) {
temp_a0 = ((this->soilActor->actor.params >> 8) & 0x1F) - 1;
temp_a1 = temp_a0 & 3;
if ((((gSaveContext.gsFlags[temp_a0 >> 2] & gGoldSkullFlgMask[temp_a1]) >>
gGoldSkullFlgShift[temp_a1]) &
(this->soilActor->actor.params & 0xFF)) == 0) {
if (!(GET_GS_FLAGS(((this->soilActor->actor.params >> 8) & 0x1F) - 1) &
(this->soilActor->actor.params & 0xFF))) {
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
}
}

View file

@ -330,8 +330,8 @@ void EnMag_DrawImageRGBA32(Gfx** gfxp, s16 centerX, s16 centerY, u8* source, u32
textureCount += 1;
}
gSetTileCustom(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, textureHeight, 0, G_TX_NOMIRROR | G_TX_CLAMP,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gDPSetTileCustom(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, textureHeight, 0, G_TX_NOMIRROR | G_TX_CLAMP,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
remainingSize -= textureSize;
@ -344,8 +344,6 @@ void EnMag_DrawImageRGBA32(Gfx** gfxp, s16 centerX, s16 centerY, u8* source, u32
gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + (s32)width) << 2,
(rectTop + textureHeight) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024);
if (1) {}
curTexture += textureSize;
rectTop += textureHeight;
@ -354,8 +352,9 @@ void EnMag_DrawImageRGBA32(Gfx** gfxp, s16 centerX, s16 centerY, u8* source, u32
textureHeight = remainingSize / (s32)(width << 2);
remainingSize -= textureSize;
gSetTileCustom(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, textureHeight, 0, G_TX_NOMIRROR | G_TX_CLAMP,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gDPSetTileCustom(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, textureHeight, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
}
} else {
remainingSize -= textureSize;

View file

@ -42,17 +42,4 @@ typedef enum {
/* 0x04 */ MAG_STATE_POST_DISPLAY
} EnMagGlobalState;
#define gSetTileCustom(pkt, fmt, siz, width, height, pal, cms, cmt, masks, maskt, shifts, shiftt) \
do { \
gDPPipeSync(pkt); \
gDPTileSync(pkt); \
gDPSetTile(pkt, fmt, siz, (((width)*siz##_TILE_BYTES) + 7) >> 3, 0, G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, \
masks, shifts); \
gDPTileSync(pkt); \
gDPSetTile(pkt, fmt, siz, (((width)*siz##_TILE_BYTES) + 7) >> 3, 0, G_TX_RENDERTILE, pal, cmt, maskt, shiftt, \
cms, masks, shifts); \
gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, ((width)-1) << G_TEXTURE_IMAGE_FRAC, \
((height)-1) << G_TEXTURE_IMAGE_FRAC); \
} while (0);
#endif

View file

@ -126,16 +126,11 @@ void func_80AFB89C(EnSi* this, GlobalContext* globalCtx) {
void func_80AFB950(EnSi* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
s32 temp;
s16 params;
if (func_8010BDBC(&globalCtx->msgCtx) != 2) {
player->actor.freezeTimer = 10;
} else {
params = this->actor.params;
temp = (params & 0x1F00) >> 8;
gSaveContext.gsFlags[temp >> 2] |= (params & 0xFF) << gGoldSkullFlgShift[temp & 3];
SET_GS_FLAGS((this->actor.params & 0x1F00) >> 8, this->actor.params & 0xFF);
Actor_Kill(&this->actor);
}
}

View file

@ -237,10 +237,7 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) {
}
// Check to see if this gold skull token has already been retrieved.
if (((gSaveContext.gsFlags[((thisx->params & 0x1F00) >> 8) >> 2] &
gGoldSkullFlgMask[((thisx->params & 0x1F00) >> 8) & 3]) >>
gGoldSkullFlgShift[((thisx->params & 0x1F00) >> 8) & 3]) &
(thisx->params & 0xFF)) {
if (GET_GS_FLAGS((thisx->params & 0x1F00) >> 8) & (thisx->params & 0xFF)) {
Actor_Kill(&this->actor);
return;
}

View file

@ -164,7 +164,7 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, GlobalContext* globalCtx) {
if (this->collider.base.acFlags & AC_HIT) {
func_80078884(NA_SE_SY_CORRECT_CHIME);
osSyncPrintf(VT_FGCOL(CYAN) "SHOT_SUN HIT!!!!!!!\n" VT_RST);
if (INV_CONTENT(SLOT_ARROW_FIRE) == ITEM_NONE) {
if (INV_CONTENT(ITEM_ARROW_FIRE) == ITEM_NONE) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_ETCETERA, 700.0f, -800.0f, 7261.0f, 0, 0, 0, 7);
globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(D_02007020);
if (1) {}

View file

@ -4,5 +4,7 @@ z_kaleido_debug.c
z_kaleido_equipment.c
z_kaleido_item.c
z_kaleido_map_PAL.c
z_kaleido_prompt.c
z_kaleido_scope_PAL.c
z_lmap_mark.c
z_lmap_mark.c
z_lmap_mark_data.c

View file

@ -1,3 +1,733 @@
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_80813820.s")
#include "z_kaleido_scope.h"
#include "textures/parameter_static/parameter_static.h"
#include "textures/icon_item_static/icon_item_static.h"
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_80815CC8.s")
#ifdef NON_MATCHING
// many non matching issues but should be functionally equivalent
void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfxCtx) {
static s16 D_8082A070[][4] = {
{ 255, 0, 0, 255 },
{ 255, 70, 0, 150 },
{ 255, 70, 0, 150 },
{ 255, 0, 0, 255 },
};
static s16 D_8082A090[][3] = {
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 60, 0 }, { 90, 0, 0 }, { 0, 40, 110 }, { 80, 40, 0 }, { 70, 0, 90 }, { 90, 90, 0 },
};
static s16 D_8082A0D8[] = { 255, 255, 255, 255, 255, 255 };
static s16 D_8082A0E4[] = { 255, 255, 255, 255, 255, 255 };
static s16 D_8082A0F0[] = { 150, 150, 150, 150, 150, 150 };
static s16 D_8082A0FC = 20;
static s16 D_8082A100 = 0;
static s16 D_8082A104 = 0;
static s16 D_8082A108 = 0;
static s16 D_8082A10C = 0;
static s16 D_8082A110 = 0;
static s16 D_8082A114 = 20;
static s16 D_8082A118 = 0;
static s16 D_8082A11C = 0;
static s16 D_8082A120 = 0;
static u8 D_8082A124[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
static void* D_8082A130[] = {
gHUDButtonATex, gHUDButtonCDownTex, gHUDButtonCRightTex, gHUDButtonCLeftTex, gHUDButtonCUpTex,
};
static u16 D_8082A144[] = {
0xFFCC, 0xFFCC, 0xFFCC, 0xFFCC, 0xFFCC,
};
static s16 D_8082A150[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
static s16 D_8082A164[] = {
150, 255, 100, 255, 255, 255, 255, 255, 255, 255, 255, 255,
};
static s16 D_8082A17C[] = {
255, 80, 150, 160, 100, 240, 255, 255, 255, 255, 255, 255,
};
static s16 D_8082A194[] = {
100, 40, 255, 0, 255, 100, 255, 255, 255, 255, 255, 255,
};
static s8 D_8082A1AC[][4] = {
{ 0x05, 0x01, 0x05, 0xFE }, { 0x00, 0x02, 0x02, 0xFE }, { 0xFF, 0x13, 0x03, 0x01 }, { 0x04, 0x02, 0x11, 0x02 },
{ 0x05, 0x03, 0x18, 0x05 }, { 0xFF, 0xFF, 0x04, 0x00 }, { 0x0C, 0xFF, 0xFD, 0x07 }, { 0x0D, 0xFF, 0x06, 0x08 },
{ 0x0E, 0xFF, 0x07, 0x09 }, { 0x0F, 0xFF, 0x08, 0x0A }, { 0x10, 0xFF, 0x09, 0x0B }, { 0x11, 0xFF, 0x0A, 0x12 },
{ 0x17, 0x06, 0xFD, 0x0D }, { 0x17, 0x07, 0x0C, 0x0E }, { 0x17, 0x08, 0x0D, 0x0F }, { 0x18, 0x09, 0x0E, 0x10 },
{ 0x18, 0x0A, 0x0F, 0x11 }, { 0x18, 0x0B, 0x10, 0x03 }, { 0x02, 0xFF, 0x0B, 0x13 }, { 0x02, 0xFF, 0x12, 0x14 },
{ 0x02, 0xFF, 0x13, 0xFE }, { 0xFF, 0x17, 0xFD, 0x16 }, { 0xFF, 0x17, 0x15, 0x18 }, { 0x15, 0x0C, 0xFD, 0x18 },
{ 0xFF, 0x10, 0x16, 0x04 }, { 0x00, 0x00, 0x00, 0x00 },
};
PauseContext* pauseCtx = &globalCtx->pauseCtx;
Input* input = &globalCtx->state.input[0];
s16 sp226;
s16 sp224;
s16 sp222;
s16 sp220;
s16 phi_s0;
s16 phi_s3;
s16 sp21A;
s16 sp218;
s16 sp216;
s16 phi_s6;
s16 phi_v1;
s16 phi_a2;
s16 phi_s0_2;
s16 sp208[3];
OPEN_DISPS(gfxCtx, "../z_kaleido_collect.c", 248);
if ((!pauseCtx->unk_1E4 || (pauseCtx->unk_1E4 == 5) || (pauseCtx->unk_1E4 == 8)) &&
(pauseCtx->pageIndex == PAUSE_QUEST)) {
pauseCtx->cursorColorSet = 0;
if (pauseCtx->cursorSpecialPos == 0) {
pauseCtx->nameColorSet = 0;
if ((pauseCtx->state != 6) || ((pauseCtx->stickRelX == 0) && (pauseCtx->stickRelY == 0))) {
sp216 = pauseCtx->cursorSlot[PAUSE_QUEST];
} else {
phi_s3 = pauseCtx->cursorPoint[PAUSE_QUEST];
if (pauseCtx->stickRelX < -30) {
phi_s0 = D_8082A1AC[phi_s3][2];
if (phi_s0 == -3) {
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT);
pauseCtx->unk_1E4 = 0;
} else {
while (phi_s0 >= 0) {
if ((s16)KaleidoScope_UpdateQuestStatusPoint(pauseCtx, phi_s0) != 0) {
break;
}
phi_s0 = D_8082A1AC[phi_s0][2];
}
}
} else if (pauseCtx->stickRelX > 30) {
phi_s0 = D_8082A1AC[phi_s3][3];
if (phi_s0 == -2) {
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT);
pauseCtx->unk_1E4 = 0;
} else {
while (phi_s0 >= 0) {
if ((s16)KaleidoScope_UpdateQuestStatusPoint(pauseCtx, phi_s0) != 0) {
break;
}
phi_s0 = D_8082A1AC[phi_s0][3];
}
}
}
if (pauseCtx->stickRelY < -30) {
phi_s0 = D_8082A1AC[phi_s3][1];
while (phi_s0 >= 0) {
if ((s16)KaleidoScope_UpdateQuestStatusPoint(pauseCtx, phi_s0) != 0) {
break;
}
phi_s0 = D_8082A1AC[phi_s0][1];
}
} else if (pauseCtx->stickRelY > 30) {
phi_s0 = D_8082A1AC[phi_s3][0];
while (phi_s0 >= 0) {
if ((s16)KaleidoScope_UpdateQuestStatusPoint(pauseCtx, phi_s0) != 0) {
break;
}
phi_s0 = D_8082A1AC[phi_s0][0];
}
}
if (phi_s3 != pauseCtx->cursorPoint[PAUSE_QUEST]) {
pauseCtx->unk_1E4 = 0;
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
if (pauseCtx->cursorPoint[PAUSE_QUEST] != 0x18) {
if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) {
if (pauseCtx->cursorPoint[PAUSE_QUEST] < 6) {
phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x66;
osSyncPrintf("000 ccc=%d\n", phi_s0_2);
} else if (pauseCtx->cursorPoint[PAUSE_QUEST] < 0x12) {
phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x54;
osSyncPrintf("111 ccc=%d\n", phi_s0_2);
} else {
phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x5A;
osSyncPrintf("222 ccc=%d (%d, %d, %d)\n", phi_s0_2, pauseCtx->cursorPoint[PAUSE_QUEST],
0x12, 0x6C);
}
} else {
phi_s0_2 = PAUSE_ITEM_NONE;
osSyncPrintf("999 ccc=%d (%d, %d)\n", PAUSE_ITEM_NONE, pauseCtx->cursorPoint[PAUSE_QUEST],
0x18);
}
} else {
if ((gSaveContext.inventory.questItems & 0xF0000000) != 0) {
phi_s0_2 = 0x72;
} else {
phi_s0_2 = PAUSE_ITEM_NONE;
}
osSyncPrintf("888 ccc=%d (%d, %d, %x)\n", phi_s0_2, pauseCtx->cursorPoint[PAUSE_QUEST], 0x72,
gSaveContext.inventory.questItems & 0xF0000000);
}
sp216 = pauseCtx->cursorPoint[PAUSE_QUEST];
pauseCtx->cursorItem[pauseCtx->pageIndex] = phi_s0_2;
pauseCtx->cursorSlot[pauseCtx->pageIndex] = sp216;
}
KaleidoScope_SetCursorVtx(pauseCtx, sp216 * 4, pauseCtx->questVtx);
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->cursorSpecialPos == 0)) {
if ((sp216 >= 6) && (sp216 < 0x12)) {
if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) {
sp216 = pauseCtx->cursorSlot[PAUSE_QUEST];
pauseCtx->unk_264 = D_80153960[sp216];
D_8082A120 = 10;
for (phi_s3 = 0; phi_s3 < 8; phi_s3++) {
D_8082A124[phi_s3] = 0xFF;
D_8082A150[phi_s3] = 0;
}
D_8082A11C = 0;
func_800ED858(1);
func_800ECC04((1 << pauseCtx->unk_264) + 0x8000);
pauseCtx->unk_194 = func_800EE3F8();
pauseCtx->unk_194->unk_02 = 0;
pauseCtx->unk_194->unk_01 = 0xFF;
VREG(21) = -62;
VREG(22) = -56;
VREG(23) = -49;
VREG(24) = -46;
VREG(25) = -41;
pauseCtx->unk_1E4 = 8;
func_800ED858(0);
}
}
} else if (pauseCtx->unk_1E4 == 5) {
if ((pauseCtx->stickRelX != 0) || (pauseCtx->stickRelY != 0)) {
pauseCtx->unk_1E4 = 0;
func_800ED858(0);
}
} else if (pauseCtx->unk_1E4 == 8) {
if (CHECK_BTN_ALL(input->press.button, BTN_A) && (sp216 >= 6) && (sp216 < 0x12)) {
pauseCtx->unk_1E4 = 9;
D_8082A120 = 10;
}
}
} else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
if (pauseCtx->stickRelX > 30) {
pauseCtx->cursorPoint[PAUSE_QUEST] = 0x15;
pauseCtx->nameDisplayTimer = 0;
pauseCtx->cursorSpecialPos = 0;
sp216 = pauseCtx->cursorPoint[PAUSE_QUEST];
KaleidoScope_SetCursorVtx(pauseCtx, sp216 * 4, pauseCtx->questVtx);
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) {
phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x5A;
} else {
phi_s0_2 = PAUSE_ITEM_NONE;
}
sp216 = pauseCtx->cursorPoint[PAUSE_QUEST];
pauseCtx->cursorItem[pauseCtx->pageIndex] = phi_s0_2;
pauseCtx->cursorSlot[pauseCtx->pageIndex] = sp216;
}
} else {
if (pauseCtx->stickRelX < -30) {
pauseCtx->cursorPoint[PAUSE_QUEST] = 0;
pauseCtx->nameDisplayTimer = 0;
pauseCtx->cursorSpecialPos = 0;
sp216 = pauseCtx->cursorPoint[PAUSE_QUEST];
KaleidoScope_SetCursorVtx(pauseCtx, sp216 * 4, pauseCtx->questVtx);
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) {
if (pauseCtx->cursorPoint[PAUSE_QUEST] < 6) {
phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x66;
} else if (pauseCtx->cursorPoint[PAUSE_QUEST] < 0xC) {
phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x4E;
} else {
phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x69;
}
} else {
phi_s0_2 = PAUSE_ITEM_NONE;
}
sp216 = pauseCtx->cursorPoint[PAUSE_QUEST];
pauseCtx->cursorItem[pauseCtx->pageIndex] = phi_s0_2;
pauseCtx->cursorSlot[pauseCtx->pageIndex] = sp216;
}
}
} else {
if (pauseCtx->unk_1E4 == 9) {
pauseCtx->cursorColorSet = 8;
D_8082A120--;
if (D_8082A120 == 0) {
for (phi_s3 = 0; phi_s3 < 8; phi_s3++) {
D_8082A124[phi_s3] = 0xFF;
D_8082A150[phi_s3] = 0;
}
D_8082A11C = 0;
VREG(21) = -62;
VREG(22) = -56;
VREG(23) = -49;
VREG(24) = -46;
VREG(25) = -41;
phi_s6 = pauseCtx->cursorSlot[PAUSE_QUEST];
func_800ED858(1);
func_800ED858(1);
pauseCtx->unk_264 = D_80153960[phi_s6];
func_800ED93C(pauseCtx->unk_264 + 1, 1);
pauseCtx->unk_1E4 = 2;
pauseCtx->unk_194 = func_800EE3F8();
pauseCtx->unk_194->unk_02 = 0;
sp216 = pauseCtx->cursorSlot[PAUSE_QUEST];
KaleidoScope_SetCursorVtx(pauseCtx, sp216 * 4, pauseCtx->questVtx);
}
} else {
sp216 = pauseCtx->cursorSlot[PAUSE_QUEST];
KaleidoScope_SetCursorVtx(pauseCtx, sp216 * 4, pauseCtx->questVtx);
}
}
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE,
ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
D_8082A0FC--;
for (sp218 = sp21A = 0; sp218 < 6; sp218++, sp21A += 4) {
if ((D_8082A100 != 1) && (D_8082A100 != 3)) {
phi_v1 = (D_8082A100 != 0) ? sp218 + 6 : sp218;
if (D_8082A0FC != 0) {
sp226 = ABS(D_8082A0D8[sp218] - D_8082A090[phi_v1][0]) / D_8082A0FC;
sp224 = ABS(D_8082A0E4[sp218] - D_8082A090[phi_v1][1]) / D_8082A0FC;
sp222 = ABS(D_8082A0F0[sp218] - D_8082A090[phi_v1][2]) / D_8082A0FC;
if (D_8082A0D8[sp218] >= D_8082A090[phi_v1][0]) {
D_8082A0D8[sp218] -= sp226;
} else {
D_8082A0D8[sp218] += sp226;
}
if (D_8082A0E4[sp218] >= D_8082A090[phi_v1][1]) {
D_8082A0E4[sp218] -= sp224;
} else {
D_8082A0E4[sp218] += sp224;
}
if (D_8082A0F0[sp218] >= D_8082A090[phi_v1][2]) {
D_8082A0F0[sp218] -= sp222;
} else {
D_8082A0F0[sp218] += sp222;
}
} else {
D_8082A0D8[sp218] = D_8082A090[phi_v1][0];
D_8082A0E4[sp218] = D_8082A090[phi_v1][1];
D_8082A0F0[sp218] = D_8082A090[phi_v1][2];
}
}
if (CHECK_QUEST_ITEM(sp218)) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
gDPSetEnvColor(POLY_OPA_DISP++, D_8082A0D8[sp218], D_8082A0E4[sp218], D_8082A0F0[sp218], 0);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0);
KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gItemIcons[ITEM_MEDALLION_FOREST + sp218], 24, 24, 0);
}
}
if (D_8082A0FC == 0) {
D_8082A0FC = ZREG(61 + D_8082A100);
D_8082A100++;
if (D_8082A100 >= 4) {
D_8082A100 = 0;
}
}
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
gDPLoadTextureBlock(POLY_OPA_DISP++, gSongNoteTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
if (1) {}
for (sp218 = 0; sp218 < 12; sp218++, sp21A += 4) {
if (CHECK_QUEST_ITEM(sp218 + 6)) {
if ((sp218 + 6) == sp216) {
pauseCtx->questVtx[sp21A + 0].v.ob[0] = pauseCtx->questVtx[sp21A + 2].v.ob[0] =
pauseCtx->questVtx[sp21A + 0].v.ob[0] - 2;
pauseCtx->questVtx[sp21A + 1].v.ob[0] = pauseCtx->questVtx[sp21A + 3].v.ob[0] =
pauseCtx->questVtx[sp21A + 1].v.ob[0] + 4;
pauseCtx->questVtx[sp21A + 0].v.ob[1] = pauseCtx->questVtx[sp21A + 1].v.ob[1] =
pauseCtx->questVtx[sp21A + 0].v.ob[1] + 2;
pauseCtx->questVtx[sp21A + 2].v.ob[1] = pauseCtx->questVtx[sp21A + 3].v.ob[1] =
pauseCtx->questVtx[sp21A + 2].v.ob[1] - 4;
}
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, D_8082A164[sp218], D_8082A17C[sp218], D_8082A194[sp218],
pauseCtx->alpha);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
}
}
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
for (sp218 = 0; sp218 < 3; sp218++, sp21A += 4) {
if (CHECK_QUEST_ITEM(sp218 + 0x12)) {
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0);
KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gItemIcons[ITEM_KOKIRI_EMERALD + sp218], 24, 24, 0);
}
}
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
for (sp218 = 0; sp218 < 3; sp218++, sp21A += 4) {
if (CHECK_QUEST_ITEM(sp218 + 0x15)) {
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gItemIcons[ITEM_STONE_OF_AGONY + sp218], 24, 24, 0);
}
}
sp226 = ABS(D_8082A104 - D_8082A070[D_8082A118][0]) / D_8082A114;
sp224 = ABS(D_8082A108 - D_8082A070[D_8082A118][1]) / D_8082A114;
sp222 = ABS(D_8082A10C - D_8082A070[D_8082A118][2]) / D_8082A114;
sp220 = ABS(D_8082A110 - D_8082A070[D_8082A118][3]) / D_8082A114;
if (D_8082A104 >= D_8082A070[D_8082A118][0]) {
D_8082A104 -= sp226;
} else {
D_8082A104 += sp226;
}
if (D_8082A108 >= D_8082A070[D_8082A118][1]) {
D_8082A108 -= sp224;
} else {
D_8082A108 += sp224;
}
if (D_8082A10C >= D_8082A070[D_8082A118][2]) {
D_8082A10C -= sp222;
} else {
D_8082A10C += sp222;
}
if (D_8082A110 >= D_8082A070[D_8082A118][3]) {
D_8082A110 -= sp220;
} else {
D_8082A110 += sp220;
}
D_8082A114--;
if (D_8082A114 == 0) {
D_8082A104 = D_8082A070[D_8082A118][0];
D_8082A108 = D_8082A070[D_8082A118][1];
D_8082A10C = D_8082A070[D_8082A118][2];
D_8082A110 = D_8082A070[D_8082A118][3];
D_8082A114 = ZREG(24 + D_8082A118);
if (++D_8082A118 >= 4) {
D_8082A118 = 0;
}
}
if ((gSaveContext.inventory.questItems >> 0x1C) != 0) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
if ((pauseCtx->state == 4) || (pauseCtx->state == 0x12)) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, D_8082A070[0][0], D_8082A070[0][1], D_8082A070[0][2],
pauseCtx->alpha);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, D_8082A104, D_8082A108, D_8082A10C, D_8082A110);
}
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0);
POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(
POLY_OPA_DISP, gItemIcons[0x79 + (((gSaveContext.inventory.questItems & 0xF0000000) & 0xF0000000) >> 0x1C)],
48, 48, 0);
}
if (pauseCtx->state == 6) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
sp21A += 4;
if ((pauseCtx->cursorSpecialPos == 0) && (sp216 >= 6) && (sp216 < 0x12)) {
if ((pauseCtx->unk_1E4 < 3) || (pauseCtx->unk_1E4 == 5) || (pauseCtx->unk_1E4 == 8)) {
if (pauseCtx->cursorItem[pauseCtx->pageIndex] != PAUSE_ITEM_NONE) {
pauseCtx->cursorColorSet = 8;
if ((pauseCtx->unk_1E4 >= 2) && (pauseCtx->unk_1E4 < 7)) {
pauseCtx->cursorColorSet = 0;
}
}
}
}
if (pauseCtx->unk_1E4 == 2) {
pauseCtx->unk_194 = func_800EE3F8();
if (pauseCtx->unk_194->unk_02 != 0) {
if (D_8082A11C == (pauseCtx->unk_194->unk_02 - 1)) {
D_8082A124[pauseCtx->unk_194->unk_02 - 1] = pauseCtx->unk_194->unk_00;
D_8082A11C++;
}
for (sp218 = 0; sp218 < 8; sp218++, sp21A += 4) {
if (D_8082A124[sp218] == 0xFF) {
break;
}
if (D_8082A150[sp218] != 255) {
D_8082A150[sp218] += VREG(50);
if (D_8082A150[sp218] >= 255) {
D_8082A150[sp218] = 255;
}
}
pauseCtx->questVtx[sp21A + 0].v.ob[1] = pauseCtx->questVtx[sp21A + 1].v.ob[1] =
VREG(21 + D_8082A124[sp218]);
pauseCtx->questVtx[sp21A + 2].v.ob[1] = pauseCtx->questVtx[sp21A + 3].v.ob[1] =
pauseCtx->questVtx[sp21A + 0].v.ob[1] - 12;
gDPPipeSync(POLY_OPA_DISP++);
if (D_8082A124[sp218] == 0) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 80, 255, 150, D_8082A150[sp218]);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, D_8082A150[sp218]);
}
gDPSetEnvColor(POLY_OPA_DISP++, 10, 10, 10, 0);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0);
gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[D_8082A124[sp218]], G_IM_FMT_IA, G_IM_SIZ_8b, 16,
16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
if (1) {}
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
}
}
} else if (((pauseCtx->unk_1E4 >= 4) && (pauseCtx->unk_1E4 <= 6)) || (pauseCtx->unk_1E4 == 8)) {
phi_a2 = pauseCtx->unk_264;
sp226 = D_80131C00[phi_a2][0];
sp218 = sp21A;
for (phi_s3 = 0; phi_s3 < sp226; phi_s3++, sp21A += 4) {
pauseCtx->questVtx[sp21A + 0].v.ob[1] = pauseCtx->questVtx[sp21A + 1].v.ob[1] =
VREG(21 + D_80131C00[phi_a2][phi_s3 + 1]);
pauseCtx->questVtx[sp21A + 2].v.ob[1] = pauseCtx->questVtx[sp21A + 3].v.ob[1] =
pauseCtx->questVtx[sp21A + 0].v.ob[1] - 12;
gDPPipeSync(POLY_OPA_DISP++);
if (pauseCtx->unk_1E4 == 8) {
if (D_80131C00[phi_a2][phi_s3 + 1] == 0) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 80, 255, 150, 200);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, 200);
}
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 150, 150, 150, 150);
}
gDPSetEnvColor(POLY_OPA_DISP++, 10, 10, 10, 0);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0);
gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[D_80131C00[phi_a2][phi_s3 + 1]], G_IM_FMT_IA,
G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
if (1) {}
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
}
if (pauseCtx->unk_1E4 != 8) {
pauseCtx->unk_194 = func_800EE3D4();
if (pauseCtx->unk_194->unk_02 != 0) {
if (D_8082A11C == (pauseCtx->unk_194->unk_02 - 1)) {
if ((pauseCtx->unk_194->unk_00 >= 0) && (pauseCtx->unk_194->unk_00 < 5)) {
D_8082A124[pauseCtx->unk_194->unk_02 - 1] = pauseCtx->unk_194->unk_00;
D_8082A124[pauseCtx->unk_194->unk_02] = 0xFF;
D_8082A11C++;
}
}
}
for (phi_s3 = 0, sp21A = sp218 + 32; phi_s3 < 8; phi_s3++, sp21A += 4) {
if (D_8082A124[phi_s3] == 0xFF) {
break;
}
if (D_8082A150[phi_s3] != 255) {
D_8082A150[phi_s3] += VREG(50);
if (D_8082A150[phi_s3] >= 255) {
D_8082A150[phi_s3] = 255;
}
}
pauseCtx->questVtx[sp21A + 0].v.ob[1] = pauseCtx->questVtx[sp21A + 1].v.ob[1] =
VREG(21 + D_8082A124[phi_s3]);
pauseCtx->questVtx[sp21A + 2].v.ob[1] = pauseCtx->questVtx[sp21A + 3].v.ob[1] =
pauseCtx->questVtx[sp21A + 0].v.ob[1] - 12;
gDPPipeSync(POLY_OPA_DISP++);
if (D_8082A124[phi_s3] == 0) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 80, 255, 150, D_8082A150[phi_s3]);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, D_8082A150[phi_s3]);
}
gDPSetEnvColor(POLY_OPA_DISP++, 10, 10, 10, 0);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0);
gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[D_8082A124[phi_s3]], G_IM_FMT_IA, G_IM_SIZ_8b, 16,
16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
if (1) {}
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
}
if (pauseCtx->unk_1E4 == 4) {
for (phi_s3 = 0; phi_s3 < 8; phi_s3++) {
D_8082A124[phi_s3] = 0xFF;
D_8082A150[phi_s3] = 0;
}
D_8082A11C = 0;
func_800ED858(1);
func_800ECC04((1 << pauseCtx->unk_264) + 0x8000);
pauseCtx->unk_194 = func_800EE3F8();
pauseCtx->unk_194->unk_02 = 0;
pauseCtx->unk_194->unk_01 = 0xFE;
pauseCtx->unk_1E4 = 5;
}
}
}
}
if (CHECK_QUEST_ITEM(QUEST_SKULL_TOKEN)) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
sp208[0] = sp208[1] = 0;
sp208[2] = gSaveContext.inventory.gsTokens;
while (sp208[2] >= 100) {
sp208[0]++;
sp208[2] -= 100;
}
while (sp208[2] >= 10) {
sp208[1]++;
sp208[2] -= 10;
}
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[164], 24, 0);
for (phi_s3 = 0, sp21A = 0; phi_s3 < 2; phi_s3++) {
if (phi_s3 == 0) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, pauseCtx->alpha);
} else if (gSaveContext.inventory.gsTokens == 100) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 200, 50, 50, pauseCtx->alpha);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
}
phi_s0 = 0;
for (sp218 = 0; sp218 < 3; sp218++, sp21A += 4) {
if ((sp218 >= 2) || (sp208[sp218] != 0) || (phi_s0 != 0)) {
gDPLoadTextureBlock(POLY_OPA_DISP++, D_02003040[sp208[sp218]], G_IM_FMT_I, G_IM_SIZ_8b, 8, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
if (1) {}
gSP1Quadrangle(POLY_OPA_DISP++, sp21A, sp21A + 2, sp21A + 3, sp21A + 1, 0);
phi_s0 = 1;
}
}
}
}
CLOSE_DISPS(gfxCtx, "../z_kaleido_collect.c", 863);
}
#else
static s16 D_8082A070[][4] = {
{ 255, 0, 0, 255 },
{ 255, 70, 0, 150 },
{ 255, 70, 0, 150 },
{ 255, 0, 0, 255 },
};
static s16 D_8082A090[][3] = {
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 60, 0 }, { 90, 0, 0 }, { 0, 40, 110 }, { 80, 40, 0 }, { 70, 0, 90 }, { 90, 90, 0 },
};
static s16 D_8082A0D8[] = { 255, 255, 255, 255, 255, 255 };
static s16 D_8082A0E4[] = { 255, 255, 255, 255, 255, 255 };
static s16 D_8082A0F0[] = { 150, 150, 150, 150, 150, 150 };
static s16 D_8082A0FC = 20;
static s16 D_8082A100 = 0;
static s16 D_8082A104 = 0;
static s16 D_8082A108 = 0;
static s16 D_8082A10C = 0;
static s16 D_8082A110 = 0;
static s16 D_8082A114 = 20;
static s16 D_8082A118 = 0;
static s16 D_8082A11C = 0;
static s16 D_8082A120 = 0;
static u8 D_8082A124[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
static void* D_8082A130[] = {
gHUDButtonATex, gHUDButtonCDownTex, gHUDButtonCRightTex, gHUDButtonCLeftTex, gHUDButtonCUpTex,
};
static u16 D_8082A144[] = {
0xFFCC, 0xFFCC, 0xFFCC, 0xFFCC, 0xFFCC,
};
static s16 D_8082A150[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
static s16 D_8082A164[] = {
150, 255, 100, 255, 255, 255, 255, 255, 255, 255, 255, 255,
};
static s16 D_8082A17C[] = {
255, 80, 150, 160, 100, 240, 255, 255, 255, 255, 255, 255,
};
static s16 D_8082A194[] = {
100, 40, 255, 0, 255, 100, 255, 255, 255, 255, 255, 255,
};
static s8 D_8082A1AC[][4] = {
{ 0x05, 0x01, 0x05, 0xFE }, { 0x00, 0x02, 0x02, 0xFE }, { 0xFF, 0x13, 0x03, 0x01 }, { 0x04, 0x02, 0x11, 0x02 },
{ 0x05, 0x03, 0x18, 0x05 }, { 0xFF, 0xFF, 0x04, 0x00 }, { 0x0C, 0xFF, 0xFD, 0x07 }, { 0x0D, 0xFF, 0x06, 0x08 },
{ 0x0E, 0xFF, 0x07, 0x09 }, { 0x0F, 0xFF, 0x08, 0x0A }, { 0x10, 0xFF, 0x09, 0x0B }, { 0x11, 0xFF, 0x0A, 0x12 },
{ 0x17, 0x06, 0xFD, 0x0D }, { 0x17, 0x07, 0x0C, 0x0E }, { 0x17, 0x08, 0x0D, 0x0F }, { 0x18, 0x09, 0x0E, 0x10 },
{ 0x18, 0x0A, 0x0F, 0x11 }, { 0x18, 0x0B, 0x10, 0x03 }, { 0x02, 0xFF, 0x0B, 0x13 }, { 0x02, 0xFF, 0x12, 0x14 },
{ 0x02, 0xFF, 0x13, 0xFE }, { 0xFF, 0x17, 0xFD, 0x16 }, { 0xFF, 0x17, 0x15, 0x18 }, { 0x15, 0x0C, 0xFD, 0x18 },
{ 0xFF, 0x10, 0x16, 0x04 }, { 0x00, 0x00, 0x00, 0x00 },
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/KaleidoScope_DrawQuestStatus.s")
#endif
s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point) {
pauseCtx->cursorPoint[PAUSE_QUEST] = point;
return 1;
}

View file

@ -1,5 +1,647 @@
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_80815CE0.s")
#include "z_kaleido_scope.h"
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_80815FD4.s")
// Positions of each input section in the editor
static u16 sSectionPositions[][2] = {
{ 64, 15 }, { 144, 15 }, { 170, 15 }, { 78, 35 }, { 104, 35 }, { 130, 35 }, { 156, 35 }, { 182, 35 },
{ 208, 35 }, { 78, 50 }, { 104, 50 }, { 130, 50 }, { 156, 50 }, { 182, 50 }, { 208, 50 }, { 78, 65 },
{ 104, 65 }, { 130, 65 }, { 156, 65 }, { 182, 65 }, { 208, 65 }, { 78, 80 }, { 104, 80 }, { 130, 80 },
{ 156, 80 }, { 182, 80 }, { 208, 80 }, { 78, 98 }, { 88, 98 }, { 98, 98 }, { 108, 98 }, { 118, 98 },
{ 128, 98 }, { 138, 98 }, { 148, 98 }, { 158, 98 }, { 168, 98 }, { 178, 98 }, { 188, 98 }, { 198, 98 },
{ 208, 98 }, { 218, 98 }, { 228, 98 }, { 238, 98 }, { 78, 115 }, { 90, 115 }, { 102, 115 }, { 114, 115 },
{ 126, 115 }, { 138, 115 }, { 150, 115 }, { 162, 115 }, { 202, 115 }, { 214, 115 }, { 226, 115 }, { 238, 115 },
{ 78, 132 }, { 90, 132 }, { 102, 132 }, { 114, 132 }, { 126, 132 }, { 138, 132 }, { 150, 132 }, { 162, 132 },
{ 174, 132 }, { 186, 132 }, { 198, 132 }, { 210, 132 }, { 78, 149 }, { 90, 149 }, { 102, 149 }, { 114, 149 },
{ 126, 149 }, { 138, 149 }, { 78, 166 }, { 90, 166 }, { 102, 166 }, { 114, 166 }, { 126, 166 }, { 138, 166 },
{ 150, 166 }, { 162, 166 }, { 174, 166 }, { 186, 166 }, { 198, 166 }, { 210, 166 }, { 210, 149 }, { 222, 149 },
{ 234, 149 }, { 78, 185 }, { 90, 185 }, { 145, 185 }, { 210, 185 },
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_808161AC.s")
// First section of each row in the editor (starting from the top)
static u16 sRowFirstSections[] = {
0x00, 0x03, 0x1B, 0x2C, 0x34, 0x38, 0x44, 0x4A, 0x56, 0x59, 0x5C,
};
// Maximum value of each upgrade type
static u8 sMaxUpgradeValues[] = {
3, 3, 3, 2, 2, 3, 3, 3,
};
// Item ID corresponding to each slot, aside from bottles and trade items
static s16 sSlotItems[] = {
ITEM_STICK, ITEM_NUT, ITEM_BOMB, ITEM_BOW, ITEM_ARROW_FIRE, ITEM_DINS_FIRE,
ITEM_SLINGSHOT, ITEM_OCARINA_FAIRY, ITEM_BOMBCHU, ITEM_HOOKSHOT, ITEM_ARROW_ICE, ITEM_FARORES_WIND,
ITEM_BOOMERANG, ITEM_LENS, ITEM_BEAN, ITEM_HAMMER, ITEM_ARROW_LIGHT, ITEM_NAYRUS_LOVE,
};
void KaleidoScope_DrawDebugEditorText(Gfx** gfxp) {
GfxPrint printer;
s32 pad[2];
GfxPrint_Init(&printer);
GfxPrint_Open(&printer, *gfxp);
GfxPrint_SetPos(&printer, 4, 2);
GfxPrint_SetColor(&printer, 255, 60, 0, 255);
GfxPrint_Printf(&printer, "%s", "\x8Cルピー"); // "Rupee"
GfxPrint_SetPos(&printer, 15, 2);
GfxPrint_Printf(&printer, "%s", "\x8Cハート"); // "Heart"
GfxPrint_SetPos(&printer, 26, 3);
GfxPrint_Printf(&printer, "%s", "/4");
GfxPrint_SetPos(&printer, 4, 5);
GfxPrint_Printf(&printer, "%s", "\x8Cアイテム"); // "Item"
GfxPrint_SetPos(&printer, 4, 13);
GfxPrint_Printf(&printer, "%s", "KEY");
GfxPrint_SetPos(&printer, 4, 15);
GfxPrint_Printf(&printer, "%s", "\x8Dソウビ"); // "Equipment"
GfxPrint_SetPos(&printer, 23, 14);
GfxPrint_Printf(&printer, "%s", "\x8Cケン"); // "Sword"
GfxPrint_SetPos(&printer, 23, 15);
GfxPrint_Printf(&printer, "%s", "\x8Cタテ"); // "Shield"
GfxPrint_SetPos(&printer, 4, 17);
GfxPrint_Printf(&printer, "%s", "MAP");
GfxPrint_SetPos(&printer, 4, 19);
GfxPrint_Printf(&printer, "%s", "\x8Dフウイン"); // "Seal"
GfxPrint_SetPos(&printer, 20, 19);
GfxPrint_Printf(&printer, "%s", "\x8Dセイレイセキ"); // "Spiritual Stone"
GfxPrint_SetPos(&printer, 4, 21);
GfxPrint_Printf(&printer, "%s", "\x8Cオカリナ"); // "Ocarina"
GfxPrint_SetPos(&printer, 4, 24);
GfxPrint_Printf(&printer, "%s", "\x8Cコレクト"); // "Collect"
GfxPrint_SetPos(&printer, 14, 24);
GfxPrint_Printf(&printer, "%s", "\x8Cキンスタ"); // "Skulltula"
GfxPrint_SetPos(&printer, 23, 24);
GfxPrint_Printf(&printer, "%s", "\x8Cカケラ"); // "Gold Token"
GfxPrint_SetPos(&printer, 28, 24);
GfxPrint_Printf(&printer, "%s", "/4");
*gfxp = GfxPrint_Close(&printer);
GfxPrint_Destroy(&printer);
}
void KaleidoScope_DrawDigit(GlobalContext* globalCtx, s32 digit, s32 rectLeft, s32 rectTop) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_debug.c", 208);
gDPLoadTextureBlock(POLY_OPA_DISP++, D_02003040[digit], G_IM_FMT_I, G_IM_SIZ_8b, 8, 16, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSPTextureRectangle(POLY_OPA_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + 8) << 2, (rectTop + 16) << 2,
G_TX_RENDERTILE, 0, 0, 1024, 1024);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_debug.c", 220);
}
void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) {
static s16 curSection = 0;
static s16 curRow = 0;
static s32 prevDBtnInput = 0;
static s32 heldDBtnTimer = 0;
PauseContext* pauseCtx = &globalCtx->pauseCtx;
Input* input = &globalCtx->state.input[0];
Gfx* gfx;
Gfx* gfxRef;
s16 spD8[4];
s16 slot;
s16 i;
s16 j;
s16 x;
s16 y;
s32 dBtnInput = input->cur.button & (BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT);
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_debug.c", 402);
pauseCtx->stickRelX = input->rel.stick_x;
pauseCtx->stickRelY = input->rel.stick_y;
func_800944C4(globalCtx->state.gfxCtx);
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 220);
gDPFillRectangle(POLY_OPA_DISP++, 24, 12, 298, 228);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0,
PRIMITIVE, 0);
gfxRef = POLY_OPA_DISP;
gfx = Graph_GfxPlusOne(gfxRef);
gSPDisplayList(OVERLAY_DISP++, gfx);
KaleidoScope_DrawDebugEditorText(&gfx);
gSPEndDisplayList(gfx++);
Graph_BranchDlist(gfxRef, gfx);
POLY_OPA_DISP = gfx;
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 0, 0, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
// Current Health Quarter (X / 4)
KaleidoScope_DrawDigit(globalCtx, (gSaveContext.health % 0x10) / 4, 194, 15);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
// Rupees
spD8[0] = spD8[1] = spD8[2] = 0;
spD8[3] = gSaveContext.rupees;
while (spD8[3] >= 1000) {
spD8[0]++;
spD8[3] -= 1000;
}
while (spD8[3] >= 100) {
spD8[1]++;
spD8[3] -= 100;
}
while (spD8[3] >= 10) {
spD8[2]++;
spD8[3] -= 10;
}
for (i = 0, x = 68; i < 4; i++, x += 10) {
KaleidoScope_DrawDigit(globalCtx, spD8[i], x, 15);
}
// Health capacity
spD8[2] = 0;
spD8[3] = gSaveContext.healthCapacity / 0x10;
while (spD8[3] >= 10) {
spD8[2]++;
spD8[3] -= 10;
}
KaleidoScope_DrawDigit(globalCtx, spD8[2], 146, 15);
KaleidoScope_DrawDigit(globalCtx, spD8[3], 156, 15);
// Health
spD8[2] = 0;
spD8[3] = gSaveContext.health / 0x10;
while (spD8[3] >= 10) {
spD8[2]++;
spD8[3] -= 10;
}
KaleidoScope_DrawDigit(globalCtx, spD8[2], 172, 15);
KaleidoScope_DrawDigit(globalCtx, spD8[3], 182, 15);
// Inventory
for (slot = 0, i = 0, y = 35; i < 4; i++, y += 15) {
for (j = 0, x = 78; j < 6; j++, slot++, x += 26) {
spD8[2] = 0;
if ((slot <= SLOT_BOW) || (slot == SLOT_SLINGSHOT) || (slot == SLOT_BOMBCHU) || (slot == SLOT_BEAN)) {
spD8[3] = AMMO(gAmmoItems[slot]);
} else if (slot == SLOT_OCARINA) {
spD8[3] = gSaveContext.inventory.items[slot];
} else {
spD8[3] = gSaveContext.inventory.items[slot];
}
if (spD8[3] != ITEM_NONE) {
while (spD8[3] >= 10) {
spD8[2]++;
spD8[3] -= 10;
}
} else {
spD8[2] = spD8[3] = 0;
}
KaleidoScope_DrawDigit(globalCtx, spD8[2], x, y);
KaleidoScope_DrawDigit(globalCtx, spD8[3], x + 10, y);
}
}
// Keys
for (spD8[1] = 78, i = 0; i < 17; i++) {
spD8[2] = 0;
if ((spD8[3] = gSaveContext.inventory.dungeonKeys[i]) >= 0) {
while (spD8[3] >= 10) {
spD8[2]++;
spD8[3] -= 10;
}
} else {
spD8[2] = spD8[3] = 0;
}
KaleidoScope_DrawDigit(globalCtx, spD8[3], spD8[1], 98);
spD8[1] += 10;
}
// Upgrades
for (spD8[1] = 78, i = 0; i < 8; i++, spD8[1] += 12) {
KaleidoScope_DrawDigit(globalCtx, CUR_UPG_VALUE(i), spD8[1], 115);
}
// Equipment
for (spD8[1] = 202, i = 0; i < 4; i++, spD8[1] += 12) {
KaleidoScope_DrawDigit(globalCtx, ALL_EQUIP_VALUE(i), spD8[1], 115);
}
// Dungeon Items
for (spD8[1] = 78, i = 0; i < 12; i++, spD8[1] += 12) {
spD8[2] = gSaveContext.inventory.dungeonItems[i] & gEquipMasks[0];
KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 132);
}
// Medallions
for (spD8[1] = 78, i = 0; i < 6; i++, spD8[1] += 12) {
spD8[2] = 0;
if (CHECK_QUEST_ITEM(QUEST_MEDALLION_FOREST + i)) {
spD8[2] = 1;
}
KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 149);
}
// Spiritual Stones
for (spD8[1] = 210, i = 0; i < 3; i++, spD8[1] += 12) {
spD8[2] = 0;
if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD + i)) {
spD8[2] = 1;
}
KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 149);
}
// Songs
for (spD8[1] = 78, i = 0; i < 12; i++, spD8[1] += 12) {
spD8[2] = 0;
if (CHECK_QUEST_ITEM(QUEST_SONG_MINUET + i)) {
spD8[2] = 1;
}
KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 166);
}
// Other Quest Items
for (spD8[1] = 78, i = 0; i < 2; i++, spD8[1] += 12) {
spD8[2] = 0;
if (CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY + i)) {
spD8[2] = 1;
}
KaleidoScope_DrawDigit(globalCtx, spD8[2], spD8[1], 185);
}
// GS Tokens
spD8[3] = gSaveContext.inventory.gsTokens;
spD8[1] = 0;
spD8[2] = 0;
while (spD8[3] >= 100) {
spD8[1]++;
spD8[3] -= 100;
}
while (spD8[3] >= 10) {
spD8[2]++;
spD8[3] -= 10;
}
KaleidoScope_DrawDigit(globalCtx, spD8[1], 145, 185);
KaleidoScope_DrawDigit(globalCtx, spD8[2], 155, 185);
KaleidoScope_DrawDigit(globalCtx, spD8[3], 165, 185);
// Heart Pieces (X / 4)
KaleidoScope_DrawDigit(globalCtx, ((gSaveContext.inventory.questItems & 0xF0000000) & 0xF0000000) >> 0x1C, 210,
185);
// Handles navigating the menu to different sections with the D-Pad
// When the same direction is held, registers the input periodically based on a timer
if (dBtnInput == prevDBtnInput) {
heldDBtnTimer--;
if (heldDBtnTimer < 0) {
heldDBtnTimer = 1;
} else {
dBtnInput ^= prevDBtnInput;
}
} else {
prevDBtnInput = dBtnInput;
heldDBtnTimer = 16;
}
if (dBtnInput & BTN_DDOWN) {
if ((u32)++curRow > 10) {
curRow = 0;
}
curSection = sRowFirstSections[curRow];
} else if (dBtnInput & BTN_DUP) {
if (--curRow < 0) {
curRow = 22;
}
curSection = sRowFirstSections[curRow];
} else if (dBtnInput & BTN_DLEFT) {
if (--curSection < 0) {
curSection = 0x5C;
}
} else if (dBtnInput & BTN_DRIGHT) {
if (++curSection > 0x5C) {
curSection = 0;
}
}
// Handles the logic to change values based on the selected section
switch (curSection) {
case 0:
if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
gSaveContext.rupees -= 100;
if (gSaveContext.rupees < 0) {
gSaveContext.rupees = 0;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
gSaveContext.rupees += 100;
if (gSaveContext.rupees >= 9999) {
gSaveContext.rupees = 9999;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
gSaveContext.rupees--;
if (gSaveContext.rupees < 0) {
gSaveContext.rupees = 0;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
gSaveContext.rupees++;
if (gSaveContext.rupees >= 9999) {
gSaveContext.rupees = 9999;
}
}
break;
case 1:
if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
gSaveContext.healthCapacity -= 0x10;
if (gSaveContext.healthCapacity < 0x30) {
gSaveContext.healthCapacity = 0x30;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) ||
CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
gSaveContext.healthCapacity += 0x10;
if (gSaveContext.healthCapacity >= 0x140) {
gSaveContext.healthCapacity = 0x140;
}
}
break;
case 2:
if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
Health_ChangeBy(globalCtx, -4);
} else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
Health_ChangeBy(globalCtx, 4);
} else if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
Health_ChangeBy(globalCtx, -0x10);
} else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
Health_ChangeBy(globalCtx, 0x10);
}
break;
case 0x5C:
if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
if ((((gSaveContext.inventory.questItems & 0xF0000000) & 0xF0000000) >> 0x1C) != 0) {
gSaveContext.inventory.questItems -= 0x10000000;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) ||
CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
if ((gSaveContext.inventory.questItems & 0xF0000000) <= 0x40000000) {
gSaveContext.inventory.questItems += 0x10000000;
}
}
break;
default:
if (curSection < 0x1B) {
i = curSection - 3;
if ((i <= SLOT_BOW) || (i == SLOT_SLINGSHOT) || (i == SLOT_BOMBCHU) || (i == SLOT_BEAN)) {
if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
Inventory_DeleteItem(gAmmoItems[i], SLOT(gAmmoItems[i]));
AMMO(gAmmoItems[i]) = 0;
}
if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
if (i != gSaveContext.inventory.items[SLOT(gAmmoItems[i])]) {
gSaveContext.inventory.items[SLOT(gAmmoItems[i])] = gAmmoItems[i];
}
gSaveContext.inventory.ammo[SLOT(gAmmoItems[i])]++;
if (gSaveContext.inventory.ammo[SLOT(gAmmoItems[i])] > 99) {
gSaveContext.inventory.ammo[SLOT(gAmmoItems[i])] = 99;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
gSaveContext.inventory.ammo[SLOT(gAmmoItems[i])]--;
if (gSaveContext.inventory.ammo[SLOT(gAmmoItems[i])] < 0) {
gSaveContext.inventory.ammo[SLOT(gAmmoItems[i])] = 0;
}
}
} else if (i == SLOT_OCARINA) {
if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
Inventory_DeleteItem(ITEM_OCARINA_FAIRY, SLOT(ITEM_OCARINA_FAIRY));
} else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
if (gSaveContext.inventory.items[i] == ITEM_NONE) {
gSaveContext.inventory.items[i] = ITEM_OCARINA_FAIRY;
} else if ((gSaveContext.inventory.items[i] >= ITEM_OCARINA_FAIRY) &&
(gSaveContext.inventory.items[i] < ITEM_OCARINA_TIME)) {
gSaveContext.inventory.items[i]++;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
if (gSaveContext.inventory.items[i] == ITEM_NONE) {
gSaveContext.inventory.items[i] = ITEM_OCARINA_TIME;
} else if ((gSaveContext.inventory.items[i] > ITEM_OCARINA_FAIRY) &&
(gSaveContext.inventory.items[i] <= ITEM_OCARINA_TIME)) {
gSaveContext.inventory.items[i]--;
}
}
} else if (i == SLOT_HOOKSHOT) {
if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
Inventory_DeleteItem(ITEM_HOOKSHOT, SLOT(ITEM_HOOKSHOT));
} else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
if (gSaveContext.inventory.items[i] == ITEM_NONE) {
gSaveContext.inventory.items[i] = ITEM_HOOKSHOT;
} else if ((gSaveContext.inventory.items[i] >= ITEM_HOOKSHOT) &&
(gSaveContext.inventory.items[i] < ITEM_LONGSHOT)) {
gSaveContext.inventory.items[i]++;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
if (gSaveContext.inventory.items[i] == ITEM_NONE) {
gSaveContext.inventory.items[i] = ITEM_LONGSHOT;
} else if ((gSaveContext.inventory.items[i] > ITEM_HOOKSHOT) &&
(gSaveContext.inventory.items[i] <= ITEM_LONGSHOT)) {
gSaveContext.inventory.items[i]--;
}
}
} else if (i == SLOT_TRADE_ADULT) {
if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
Inventory_DeleteItem(ITEM_POCKET_EGG, SLOT(ITEM_POCKET_EGG));
} else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
if (gSaveContext.inventory.items[i] == ITEM_NONE) {
gSaveContext.inventory.items[i] = ITEM_POCKET_EGG;
} else if ((gSaveContext.inventory.items[i] >= ITEM_POCKET_EGG) &&
(gSaveContext.inventory.items[i] < ITEM_CLAIM_CHECK)) {
gSaveContext.inventory.items[i]++;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
if (gSaveContext.inventory.items[i] == ITEM_NONE) {
gSaveContext.inventory.items[i] = ITEM_CLAIM_CHECK;
} else if ((gSaveContext.inventory.items[i] > ITEM_POCKET_EGG) &&
(gSaveContext.inventory.items[i] <= ITEM_CLAIM_CHECK)) {
gSaveContext.inventory.items[i]--;
}
}
} else if (i == SLOT_TRADE_CHILD) {
if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
Inventory_DeleteItem(ITEM_WEIRD_EGG, SLOT(ITEM_WEIRD_EGG));
} else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
if (gSaveContext.inventory.items[i] == ITEM_NONE) {
gSaveContext.inventory.items[i] = ITEM_WEIRD_EGG;
} else if ((gSaveContext.inventory.items[i] >= ITEM_WEIRD_EGG) &&
(gSaveContext.inventory.items[i] < ITEM_SOLD_OUT)) {
gSaveContext.inventory.items[i]++;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
if (gSaveContext.inventory.items[i] == ITEM_NONE) {
gSaveContext.inventory.items[i] = ITEM_SOLD_OUT;
} else if ((gSaveContext.inventory.items[i] > ITEM_WEIRD_EGG) &&
(gSaveContext.inventory.items[i] <= ITEM_SOLD_OUT)) {
gSaveContext.inventory.items[i]--;
}
}
} else if ((i >= SLOT_BOTTLE_1) && (i <= SLOT_BOTTLE_4)) {
if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
Inventory_DeleteItem(ITEM_BOTTLE + i - SLOT_BOTTLE_1, SLOT(ITEM_BOTTLE) + i - SLOT_BOTTLE_1);
} else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
if (gSaveContext.inventory.items[i] == ITEM_NONE) {
gSaveContext.inventory.items[i] = ITEM_BOTTLE;
} else if ((gSaveContext.inventory.items[i] >= ITEM_BOTTLE) &&
(gSaveContext.inventory.items[i] <= ITEM_MILK_HALF)) {
gSaveContext.inventory.items[i]++;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
if (gSaveContext.inventory.items[i] == ITEM_NONE) {
gSaveContext.inventory.items[i] = ITEM_POE;
} else if ((gSaveContext.inventory.items[i] >= ITEM_POTION_RED) &&
(gSaveContext.inventory.items[i] <= ITEM_POE)) {
gSaveContext.inventory.items[i]--;
}
}
} else if (i < 0x1B) {
if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT) ||
CHECK_BTN_ALL(input->press.button, BTN_CDOWN) ||
CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
if (i == SLOT_TRADE_ADULT) {
if (gSaveContext.inventory.items[i] == ITEM_NONE) {
gSaveContext.inventory.items[i] = ITEM_BEAN;
} else {
Inventory_DeleteItem(ITEM_BEAN, SLOT(ITEM_BEAN));
}
} else {
j = sSlotItems[i];
osSyncPrintf("i=%d j=%d\n", i, j);
if (gSaveContext.inventory.items[i] == ITEM_NONE) {
gSaveContext.inventory.items[i] = j;
} else {
Inventory_DeleteItem(j, i);
}
}
}
}
} else if (curSection < 0x2C) {
if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
i = curSection - 0x1B;
gSaveContext.inventory.dungeonKeys[i]--;
if (gSaveContext.inventory.dungeonKeys[i] < 0) {
gSaveContext.inventory.dungeonKeys[i] = -1;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) ||
CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
i = curSection - 0x1B;
if (gSaveContext.inventory.dungeonKeys[i] < 0) {
gSaveContext.inventory.dungeonKeys[i] = 1;
} else {
gSaveContext.inventory.dungeonKeys[i]++;
if (gSaveContext.inventory.dungeonKeys[i] >= 9) {
gSaveContext.inventory.dungeonKeys[i] = 9;
}
}
}
} else {
if (curSection < 0x38) {
i = curSection - 0x2C;
if ((curSection >= 0x2C) && (curSection < 0x34)) {
if (CHECK_BTN_ALL(input->press.button, BTN_CUP) ||
CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
if (CUR_UPG_VALUE(i) != 0) {
Inventory_ChangeUpgrade(i, CUR_UPG_VALUE(i) - 1);
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) ||
CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
if (CUR_UPG_VALUE(i) < sMaxUpgradeValues[i]) {
Inventory_ChangeUpgrade(i, CUR_UPG_VALUE(i) + 1);
}
}
} else {
i = curSection - 0x34;
if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
gSaveContext.inventory.equipment ^= (1 << gEquipShifts[i]);
}
if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
gSaveContext.inventory.equipment ^= (2 << gEquipShifts[i]);
}
if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
gSaveContext.inventory.equipment ^= (4 << gEquipShifts[i]);
}
if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
gSaveContext.inventory.equipment ^= (8 << gEquipShifts[i]);
}
}
} else if (curSection < 0x44) {
i = curSection - 0x38;
if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
gSaveContext.inventory.dungeonItems[i] ^= 4;
}
if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
gSaveContext.inventory.dungeonItems[i] ^= 2;
}
if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
gSaveContext.inventory.dungeonItems[i] ^= 1;
}
} else if (curSection == 0x5B) {
if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
gSaveContext.inventory.gsTokens++;
} else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) ||
CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
gSaveContext.inventory.gsTokens--;
if (gSaveContext.inventory.gsTokens <= 0) {
gSaveContext.inventory.gsTokens = 0;
}
}
} else if (curSection < 0x5C) {
i = curSection - 0x44;
if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
gSaveContext.inventory.questItems ^= gBitFlags[i];
}
}
}
break;
}
// Draws a highlight on the selected section
gDPPipeSync(POLY_OPA_DISP++);
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 200, 120);
if (curSection == 0) {
gDPFillRectangle(POLY_OPA_DISP++, sSectionPositions[curSection][0], sSectionPositions[curSection][1],
sSectionPositions[curSection][0] + 45, sSectionPositions[curSection][1] + 16);
} else if ((curSection >= 0x1B) || (curSection == 0x5B)) {
gDPFillRectangle(POLY_OPA_DISP++, sSectionPositions[curSection][0] - 2, sSectionPositions[curSection][1],
sSectionPositions[curSection][0] + 14, sSectionPositions[curSection][1] + 16);
} else {
gDPFillRectangle(POLY_OPA_DISP++, sSectionPositions[curSection][0] - 4, sSectionPositions[curSection][1],
sSectionPositions[curSection][0] + 24, sSectionPositions[curSection][1] + 16);
}
// Handles exiting the inventory editor with the L button
// The editor is opened with `debugState` set to 1, and becomes closable after a frame once `debugState` is set to 2
if (pauseCtx->debugState == 1) {
pauseCtx->debugState = 2;
} else if ((pauseCtx->debugState == 2) && CHECK_BTN_ALL(input->press.button, BTN_L)) {
pauseCtx->debugState = 0;
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_debug.c", 861);
}

View file

@ -1,6 +1,595 @@
#include "z_kaleido_scope.h"
#include "textures/icon_item_static/icon_item_static.h"
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_80817D50.s")
static u8 sChildUpgrades[] = { UPG_BULLET_BAG, UPG_BOMB_BAG, UPG_STRENGTH, UPG_SCALE };
static u8 sAdultUpgrades[] = { UPG_QUIVER, UPG_BOMB_BAG, UPG_STRENGTH, UPG_SCALE };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_8081819C.s")
static u8 sChildUpgradeItemBases[] = { ITEM_BULLET_BAG_30, ITEM_BOMB_BAG_20, ITEM_BRACELET, ITEM_SCALE_SILVER };
static u8 sAdultUpgradeItemBases[] = { ITEM_QUIVER_30, ITEM_BOMB_BAG_20, ITEM_BRACELET, ITEM_SCALE_SILVER };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_80818340.s")
static u8 sUpgradeItemOffsets[] = { 0x00, 0x03, 0x06, 0x09 };
static u8 sEquipmentItemOffsets[] = {
0x00, 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x00, 0x06, 0x07, 0x08, 0x00, 0x09, 0x0A, 0x0B,
};
static s16 sEquipTimer = 0;
void KaleidoScope_DrawEquipmentImage(GlobalContext* globalCtx, void* source, u32 width, u32 height) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
u8* curTexture;
s32 vtxIndex;
s32 textureCount;
s32 textureHeight;
s32 remainingSize;
s32 textureSize;
s32 pad;
s32 i;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_equipment.c", 68);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
curTexture = source;
remainingSize = width * height * 2;
textureHeight = 4096 / (width * 2);
textureSize = width * textureHeight * 2;
textureCount = remainingSize / textureSize;
if ((remainingSize % textureSize) != 0) {
textureCount += 1;
}
vtxIndex = 80;
gDPSetTileCustom(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, textureHeight, 0, G_TX_NOMIRROR | G_TX_CLAMP,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
remainingSize -= textureSize;
for (i = 0; i < textureCount; i++) {
gSPVertex(POLY_OPA_DISP++, &pauseCtx->equipVtx[vtxIndex], 4, 0);
gDPSetTextureImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, curTexture);
gDPLoadSync(POLY_OPA_DISP++);
gDPLoadTile(POLY_OPA_DISP++, G_TX_LOADTILE, 0, 0, (width - 1) << 2, (textureHeight - 1) << 2);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
curTexture += textureSize;
if ((remainingSize - textureSize) < 0) {
if (remainingSize > 0) {
textureHeight = remainingSize / (s32)(width * 2);
remainingSize -= textureSize;
gDPSetTileCustom(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, textureHeight, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
}
} else {
remainingSize -= textureSize;
}
vtxIndex += 4;
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_equipment.c", 122);
}
void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
Vec3f pos;
Vec3s rot;
f32 scale;
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
pos.x = 2.0f;
pos.y = -130.0f;
pos.z = -150.0f;
scale = 0.046f;
} else if (CUR_EQUIP_VALUE(EQUIP_SWORD) != 2) {
pos.x = 25.0f;
pos.y = -228.0f;
pos.z = 60.0f;
scale = 0.056f;
} else {
pos.x = 20.0f;
pos.y = -180.0f;
pos.z = -40.0f;
scale = 0.047f;
}
rot.y = 32300;
rot.x = rot.z = 0;
func_8009214C(globalCtx, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime, &pos, &rot, scale,
CUR_EQUIP_VALUE(EQUIP_SWORD), CUR_EQUIP_VALUE(EQUIP_TUNIC) - 1, CUR_EQUIP_VALUE(EQUIP_SHIELD),
CUR_EQUIP_VALUE(EQUIP_BOOTS) - 1);
}
void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
Input* input = &globalCtx->state.input[0];
u16 i;
u16 j;
u16 k;
u16 bit;
u16 temp;
u16 point;
u16 rowStart;
u16 pad;
s16 cursorMoveResult;
u16 cursorItem;
u16 cursorSlot;
s16 cursorPoint;
s16 cursorX;
s16 cursorY;
volatile s16 oldCursorPoint;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_equipment.c", 219);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, ZREG(39), ZREG(40), ZREG(41), pauseCtx->alpha);
gDPSetEnvColor(POLY_OPA_DISP++, ZREG(43), ZREG(44), ZREG(45), 0);
for (i = 0, j = 64; i < 4; i++, j += 4) {
if (CUR_EQUIP_VALUE(i) != 0) {
gDPPipeSync(POLY_OPA_DISP++);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->equipVtx[j], 4, 0);
POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, D_02000A00[1], 32, 32, 0);
}
}
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_EQUIP)) {
oldCursorPoint = pauseCtx->cursorPoint[PAUSE_EQUIP];
pauseCtx->cursorColorSet = 0;
if (pauseCtx->cursorSpecialPos == 0) {
pauseCtx->nameColorSet = 0;
cursorItem = pauseCtx->cursorItem[PAUSE_EQUIP];
if ((cursorItem >= ITEM_SWORD_KOKIRI) && (cursorItem <= ITEM_BOOTS_HOVER)) {
pauseCtx->cursorColorSet = 8;
}
cursorPoint = pauseCtx->cursorPoint[PAUSE_EQUIP];
cursorX = pauseCtx->cursorX[PAUSE_EQUIP];
cursorY = pauseCtx->cursorY[PAUSE_EQUIP];
cursorMoveResult = 0;
while (cursorMoveResult == 0) {
if (pauseCtx->stickRelX < -30) {
if (pauseCtx->cursorX[PAUSE_EQUIP] != 0) {
pauseCtx->cursorX[PAUSE_EQUIP] -= 1;
pauseCtx->cursorPoint[PAUSE_EQUIP] -= 1;
if (pauseCtx->cursorX[PAUSE_EQUIP] == 0) {
if (pauseCtx->cursorY[PAUSE_EQUIP] == 0) {
if (CUR_UPG_VALUE(UPG_BULLET_BAG) != 0) {
cursorMoveResult = 1;
}
} else {
if (CUR_UPG_VALUE(pauseCtx->cursorY[PAUSE_EQUIP]) != 0) {
cursorMoveResult = 1;
}
}
} else {
if (gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] & gSaveContext.inventory.equipment) {
cursorMoveResult = 2;
}
}
} else {
pauseCtx->cursorX[PAUSE_EQUIP] = cursorX;
pauseCtx->cursorY[PAUSE_EQUIP] += 1;
if (pauseCtx->cursorY[PAUSE_EQUIP] >= 4) {
pauseCtx->cursorY[PAUSE_EQUIP] = 0;
}
pauseCtx->cursorPoint[PAUSE_EQUIP] =
pauseCtx->cursorX[PAUSE_EQUIP] + (pauseCtx->cursorY[PAUSE_EQUIP] * 4);
if (pauseCtx->cursorPoint[PAUSE_EQUIP] >= 16) {
pauseCtx->cursorPoint[PAUSE_EQUIP] = pauseCtx->cursorX[PAUSE_EQUIP];
}
if (cursorY == pauseCtx->cursorY[PAUSE_EQUIP]) {
pauseCtx->cursorX[PAUSE_EQUIP] = cursorX;
pauseCtx->cursorPoint[PAUSE_EQUIP] = cursorPoint;
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT);
cursorMoveResult = 3;
}
}
} else if (pauseCtx->stickRelX > 30) {
if (pauseCtx->cursorX[PAUSE_EQUIP] < 3) {
pauseCtx->cursorX[PAUSE_EQUIP] += 1;
pauseCtx->cursorPoint[PAUSE_EQUIP] += 1;
if (pauseCtx->cursorX[PAUSE_EQUIP] == 0) {
if (CUR_UPG_VALUE(pauseCtx->cursorY[PAUSE_EQUIP]) != 0) {
cursorMoveResult = 1;
}
} else {
if (gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] & gSaveContext.inventory.equipment) {
cursorMoveResult = 2;
}
}
} else {
pauseCtx->cursorX[PAUSE_EQUIP] = cursorX;
pauseCtx->cursorY[PAUSE_EQUIP] += 1;
if (pauseCtx->cursorY[PAUSE_EQUIP] >= 4) {
pauseCtx->cursorY[PAUSE_EQUIP] = 0;
}
pauseCtx->cursorPoint[PAUSE_EQUIP] =
pauseCtx->cursorX[PAUSE_EQUIP] + (pauseCtx->cursorY[PAUSE_EQUIP] * 4);
if (pauseCtx->cursorPoint[PAUSE_EQUIP] >= 16) {
pauseCtx->cursorPoint[PAUSE_EQUIP] = pauseCtx->cursorX[PAUSE_EQUIP];
}
if (cursorY == pauseCtx->cursorY[PAUSE_EQUIP]) {
pauseCtx->cursorX[PAUSE_EQUIP] = cursorX;
pauseCtx->cursorPoint[PAUSE_EQUIP] = cursorPoint;
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT);
cursorMoveResult = 3;
}
}
} else {
cursorMoveResult = 4;
}
}
cursorPoint = pauseCtx->cursorPoint[PAUSE_EQUIP];
cursorY = pauseCtx->cursorY[PAUSE_EQUIP];
if (cursorMoveResult) {}
cursorMoveResult = 0;
while (cursorMoveResult == 0) {
if (pauseCtx->stickRelY > 30) {
if (pauseCtx->cursorY[PAUSE_EQUIP] != 0) {
pauseCtx->cursorY[PAUSE_EQUIP] -= 1;
pauseCtx->cursorPoint[PAUSE_EQUIP] -= 4;
if (pauseCtx->cursorX[PAUSE_EQUIP] == 0) {
if (pauseCtx->cursorY[PAUSE_EQUIP] == 0) {
if (CUR_UPG_VALUE(UPG_BULLET_BAG) != 0) {
cursorMoveResult = 1;
}
} else if (CUR_UPG_VALUE(pauseCtx->cursorY[PAUSE_EQUIP]) != 0) {
cursorMoveResult = 1;
}
} else if (gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] &
gSaveContext.inventory.equipment) {
cursorMoveResult = 2;
}
} else {
pauseCtx->cursorY[PAUSE_EQUIP] = cursorY;
pauseCtx->cursorPoint[PAUSE_EQUIP] = cursorPoint;
cursorMoveResult = 3;
}
} else if (pauseCtx->stickRelY < -30) {
if (pauseCtx->cursorY[PAUSE_EQUIP] < 3) {
pauseCtx->cursorY[PAUSE_EQUIP] += 1;
pauseCtx->cursorPoint[PAUSE_EQUIP] += 4;
if (pauseCtx->cursorX[PAUSE_EQUIP] == 0) {
if (CUR_UPG_VALUE(pauseCtx->cursorY[PAUSE_EQUIP]) != 0) {
cursorMoveResult = 1;
}
} else if (gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] &
gSaveContext.inventory.equipment) {
cursorMoveResult = 2;
}
} else {
pauseCtx->cursorY[PAUSE_EQUIP] = cursorY;
pauseCtx->cursorPoint[PAUSE_EQUIP] = cursorPoint;
cursorMoveResult = 3;
}
} else {
cursorMoveResult = 4;
}
}
} else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
if (pauseCtx->stickRelX > 30) {
pauseCtx->nameDisplayTimer = 0;
pauseCtx->cursorSpecialPos = 0;
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
cursorPoint = cursorX = cursorY = 0;
while (true) {
if (cursorX == 0) {
if (cursorY == 0) {
if (CUR_UPG_VALUE(UPG_BULLET_BAG) != 0) {
pauseCtx->cursorPoint[PAUSE_EQUIP] = cursorPoint;
pauseCtx->cursorX[PAUSE_EQUIP] = cursorX;
pauseCtx->cursorY[PAUSE_EQUIP] = cursorY;
break;
}
} else if (CUR_UPG_VALUE(cursorY) != 0) {
pauseCtx->cursorPoint[PAUSE_EQUIP] = cursorPoint;
pauseCtx->cursorX[PAUSE_EQUIP] = cursorX;
pauseCtx->cursorY[PAUSE_EQUIP] = cursorY;
break;
}
} else if (gBitFlags[cursorPoint - 1] & gSaveContext.inventory.equipment) {
pauseCtx->cursorPoint[PAUSE_EQUIP] = cursorPoint;
pauseCtx->cursorX[PAUSE_EQUIP] = cursorX;
pauseCtx->cursorY[PAUSE_EQUIP] = cursorY;
break;
}
cursorY = cursorY + 1;
cursorPoint = cursorPoint + 4;
if (cursorY < 4) {
continue;
}
cursorY = 0;
cursorPoint = cursorX + 1;
cursorX = cursorPoint;
if (cursorX < 4) {
continue;
}
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT);
break;
}
}
} else {
if (pauseCtx->stickRelX < -30) {
pauseCtx->nameDisplayTimer = 0;
pauseCtx->cursorSpecialPos = 0;
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
cursorPoint = cursorX = 3;
cursorY = 0;
while (true) {
if (cursorX == 0) {
if (CUR_UPG_VALUE(cursorY) != 0) {
pauseCtx->cursorPoint[PAUSE_EQUIP] = cursorPoint;
pauseCtx->cursorX[PAUSE_EQUIP] = cursorX;
pauseCtx->cursorY[PAUSE_EQUIP] = cursorY;
break;
}
} else if (gBitFlags[cursorPoint - 1] & gSaveContext.inventory.equipment) {
pauseCtx->cursorPoint[PAUSE_EQUIP] = cursorPoint;
pauseCtx->cursorX[PAUSE_EQUIP] = cursorX;
pauseCtx->cursorY[PAUSE_EQUIP] = cursorY;
break;
}
cursorY = cursorY + 1;
cursorPoint = cursorPoint + 4;
if (cursorY < 4) {
continue;
}
cursorY = 0;
cursorPoint = cursorX - 1;
cursorX = cursorPoint;
if (cursorX >= 0) {
continue;
}
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT);
break;
}
}
}
if (pauseCtx->cursorX[PAUSE_EQUIP] == 0) {
pauseCtx->cursorColorSet = 0;
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
if ((pauseCtx->cursorY[PAUSE_EQUIP] == 0) && (CUR_UPG_VALUE(UPG_BULLET_BAG) != 0)) {
cursorItem = ITEM_BULLET_BAG_30 + CUR_UPG_VALUE(UPG_BULLET_BAG) - 1;
} else {
cursorItem = ITEM_QUIVER_30 + sUpgradeItemOffsets[pauseCtx->cursorY[PAUSE_EQUIP]] +
CUR_UPG_VALUE(pauseCtx->cursorY[PAUSE_EQUIP]) - 1;
osSyncPrintf("H_arrowcase_1 + non_equip_item_table = %d\n", cursorItem);
}
} else {
if ((pauseCtx->cursorY[PAUSE_EQUIP] == 0) && (CUR_UPG_VALUE(UPG_QUIVER) == 0)) {
cursorItem = ITEM_BULLET_BAG_30 + CUR_UPG_VALUE(UPG_BULLET_BAG) - 1;
} else {
cursorItem = ITEM_QUIVER_30 + sUpgradeItemOffsets[pauseCtx->cursorY[PAUSE_EQUIP]] +
CUR_UPG_VALUE(pauseCtx->cursorY[PAUSE_EQUIP]) - 1;
osSyncPrintf("大人 H_arrowcase_1 + non_equip_item_table = %d\n", cursorItem);
}
}
} else {
cursorItem = ITEM_SWORD_KOKIRI + sEquipmentItemOffsets[pauseCtx->cursorPoint[PAUSE_EQUIP]];
osSyncPrintf("ccc=%d\n", cursorItem);
if (pauseCtx->cursorSpecialPos == 0) {
pauseCtx->cursorColorSet = 8;
}
}
if ((pauseCtx->cursorY[PAUSE_EQUIP] == 0) && (pauseCtx->cursorX[PAUSE_EQUIP] == 3)) {
if (gSaveContext.bgsFlag != 0) {
cursorItem = ITEM_HEART_PIECE_2;
} else if (gBitFlags[3] & gSaveContext.inventory.equipment) {
cursorItem = ITEM_SWORD_KNIFE;
}
}
cursorSlot = pauseCtx->cursorPoint[PAUSE_EQUIP];
pauseCtx->cursorItem[PAUSE_EQUIP] = cursorItem;
pauseCtx->cursorSlot[PAUSE_EQUIP] = cursorSlot;
osSyncPrintf("kscope->select_name[Display_Equipment] = %d\n", pauseCtx->cursorItem[PAUSE_EQUIP]);
if (!((gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == 9) ||
(gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] ==
((void)0, gSaveContext.linkAge)))) {
pauseCtx->nameColorSet = 1;
}
if (pauseCtx->cursorItem[PAUSE_EQUIP] == ITEM_BRACELET) {
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
pauseCtx->nameColorSet = 0;
} else {
pauseCtx->nameColorSet = 1;
}
}
if ((pauseCtx->cursorX[PAUSE_EQUIP] == 0) && (pauseCtx->cursorY[PAUSE_EQUIP] == 0)) {
if (LINK_AGE_IN_YEARS != YEARS_CHILD) {
if ((cursorItem >= ITEM_BULLET_BAG_30) && (cursorItem <= ITEM_BULLET_BAG_50)) {
pauseCtx->nameColorSet = 1;
} else {
pauseCtx->nameColorSet = 0;
}
} else {
pauseCtx->nameColorSet = 0;
}
}
KaleidoScope_SetCursorVtx(pauseCtx, cursorSlot * 4, pauseCtx->equipVtx);
if ((pauseCtx->cursorSpecialPos == 0) && (cursorItem != PAUSE_ITEM_NONE) && (pauseCtx->state == 6) &&
(pauseCtx->unk_1E4 == 0) && CHECK_BTN_ALL(input->press.button, BTN_A) &&
(pauseCtx->cursorX[PAUSE_EQUIP] != 0)) {
if ((gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == 9) ||
(gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] ==
((void)0, gSaveContext.linkAge))) {
Inventory_ChangeEquipment(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP]);
if (pauseCtx->cursorY[PAUSE_EQUIP] == 0) {
gSaveContext.infTable[29] = 0;
gSaveContext.equips.buttonItems[0] = cursorItem;
if ((pauseCtx->cursorX[PAUSE_EQUIP] == 3) && (gSaveContext.bgsFlag != 0)) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS;
gSaveContext.swordHealth = 8;
} else {
if (gSaveContext.equips.buttonItems[0] == ITEM_HEART_PIECE_2) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS;
}
if ((gSaveContext.equips.buttonItems[0] == ITEM_SWORD_BGS) && (gSaveContext.bgsFlag == 0) &&
(gBitFlags[3] & gSaveContext.inventory.equipment)) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KNIFE;
}
}
Interface_LoadItemIcon1(globalCtx, 0);
}
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
pauseCtx->unk_1E4 = 7;
sEquipTimer = 10;
} else {
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
}
if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_EQUIP]) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
} else if ((pauseCtx->unk_1E4 == 7) && (pauseCtx->pageIndex == PAUSE_EQUIP)) {
KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_EQUIP] * 4, pauseCtx->equipVtx);
pauseCtx->cursorColorSet = 8;
sEquipTimer--;
if (sEquipTimer == 0) {
pauseCtx->unk_1E4 = 0;
}
}
for (rowStart = 0, i = 0, point = 4; i < 4; i++, rowStart += 4, point += 16) {
for (k = 0, temp = rowStart + 1, bit = rowStart, j = point; k < 3; k++, bit++, j += 4, temp++) {
if ((gBitFlags[bit] & gSaveContext.inventory.equipment) && (pauseCtx->cursorSpecialPos == 0)) {
if ((gEquipAgeReqs[i][k + 1] == 9) || (gEquipAgeReqs[i][k + 1] == ((void)0, gSaveContext.linkAge))) {
if (temp == cursorSlot) {
pauseCtx->equipVtx[j].v.ob[0] = pauseCtx->equipVtx[j + 2].v.ob[0] =
pauseCtx->equipVtx[j].v.ob[0] - 2;
pauseCtx->equipVtx[j + 1].v.ob[0] = pauseCtx->equipVtx[j + 3].v.ob[0] =
pauseCtx->equipVtx[j + 1].v.ob[0] + 4;
pauseCtx->equipVtx[j].v.ob[1] = pauseCtx->equipVtx[j + 1].v.ob[1] =
pauseCtx->equipVtx[j].v.ob[1] + 2;
pauseCtx->equipVtx[j + 2].v.ob[1] = pauseCtx->equipVtx[j + 3].v.ob[1] =
pauseCtx->equipVtx[j + 2].v.ob[1] - 4;
}
}
}
}
}
func_800949A8(globalCtx->state.gfxCtx);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
for (rowStart = 0, j = 0, temp = 0, i = 0; i < 4; i++, rowStart += 4, j += 16) {
gSPVertex(POLY_OPA_DISP++, &pauseCtx->equipVtx[j], 16, 0);
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
point = CUR_UPG_VALUE(sChildUpgrades[i]);
if (1) {}
if ((point != 0) && (CUR_UPG_VALUE(sChildUpgrades[i]) != 0)) {
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx,
gItemIcons[sChildUpgradeItemBases[i] + point - 1], 32, 32, 0);
}
} else {
if ((i == 0) && (CUR_UPG_VALUE(sAdultUpgrades[i]) == 0)) {
KaleidoScope_DrawQuadTextureRGBA32(
globalCtx->state.gfxCtx,
gItemIcons[sChildUpgradeItemBases[i] + CUR_UPG_VALUE(sChildUpgrades[i]) - 1], 32, 32, 0);
} else if (CUR_UPG_VALUE(sAdultUpgrades[i]) != 0) {
KaleidoScope_DrawQuadTextureRGBA32(
globalCtx->state.gfxCtx,
gItemIcons[sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1], 32, 32, 0);
}
}
for (k = 0, bit = rowStart, point = 4; k < 3; k++, point += 4, temp++, bit++) {
if (((u32)i == 0) && (k == 2) && (gSaveContext.bgsFlag != 0)) {
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBiggoronSwordIconTex, 32, 32, point);
} else if ((i == 0) && (k == 2) && (gBitFlags[bit + 1] & gSaveContext.inventory.equipment)) {
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBrokenGiantsKnifeIconTex, 32, 32, point);
} else if (gBitFlags[bit] & gSaveContext.inventory.equipment) {
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[ITEM_SWORD_KOKIRI + temp], 32,
32, point);
}
}
}
KaleidoScope_DrawPlayerWork(globalCtx);
if ((pauseCtx->unk_1E4 == 7) && (sEquipTimer == 10)) {
KaleidoScope_SetupPlayerPreRender(globalCtx);
}
if ((pauseCtx->unk_1E4 == 7) && (sEquipTimer == 9)) {
//! @bug: This function shouldn't take any arguments
KaleidoScope_ProcessPlayerPreRender(globalCtx);
}
gSPSegment(POLY_OPA_DISP++, 0x07, pauseCtx->playerSegment);
gSPSegment(POLY_OPA_DISP++, 0x08, pauseCtx->iconItemSegment);
gSPSegment(POLY_OPA_DISP++, 0x09, pauseCtx->iconItem24Segment);
gSPSegment(POLY_OPA_DISP++, 0x0A, pauseCtx->nameSegment);
gSPSegment(POLY_OPA_DISP++, 0x0B, globalCtx->interfaceCtx.mapSegment);
gSPSegment(POLY_OPA_DISP++, 0x0C, pauseCtx->iconItemAltSegment);
func_800949A8(globalCtx->state.gfxCtx);
KaleidoScope_DrawEquipmentImage(globalCtx, pauseCtx->playerSegment, 64, 112);
if (gUpgradeMasks[0]) {}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_equipment.c", 609);
}

View file

@ -1,9 +1,809 @@
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_808198A0.s")
#include "z_kaleido_scope.h"
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_80819E14.s")
u8 gAmmoItems[] = {
ITEM_STICK, ITEM_NUT, ITEM_BOMB, ITEM_BOW, ITEM_NONE, ITEM_NONE, ITEM_SLINGSHOT, ITEM_NONE,
ITEM_BOMBCHU, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_BEAN, ITEM_NONE,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_80819E40.s")
static s16 sEquipState = 0;
static s16 sEquipAnimTimer = 0;
static s16 sEquipMoveTimer = 10;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_80819E6C.s")
static s16 sAmmoVtxOffset[] = {
0, 2, 4, 6, 99, 99, 8, 99, 99, 10, 99, 99, 99, 99, 99, 99, 12,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_8081AD44.s")
void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, s16 item) {
s16 ammo;
s16 i;
OPEN_DISPS(gfxCtx, "../z_kaleido_item.c", 69);
ammo = AMMO(item);
gDPPipeSync(POLY_OPA_DISP++);
if (!((gSlotAgeReqs[SLOT(item)] == 9) || gSlotAgeReqs[SLOT(item)] == ((void)0, gSaveContext.linkAge))) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 100, 100, pauseCtx->alpha);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
if (ammo == 0) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 130, 130, 130, pauseCtx->alpha);
} else if ((item == ITEM_BOMB && AMMO(item) == CUR_CAPACITY(UPG_BOMB_BAG)) ||
(item == ITEM_BOW && AMMO(item) == CUR_CAPACITY(UPG_QUIVER)) ||
(item == ITEM_SLINGSHOT && AMMO(item) == CUR_CAPACITY(UPG_BULLET_BAG)) ||
(item == ITEM_STICK && AMMO(item) == CUR_CAPACITY(UPG_STICKS)) ||
(item == ITEM_NUT && AMMO(item) == CUR_CAPACITY(UPG_NUTS)) || (item == ITEM_BOMBCHU && ammo == 50) ||
(item == ITEM_BEAN && ammo == 15)) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 120, 255, 0, pauseCtx->alpha);
}
}
for (i = 0; ammo >= 10; i++) {
ammo -= 10;
}
gDPPipeSync(POLY_OPA_DISP++);
if (i != 0) {
gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[(sAmmoVtxOffset[item] + 27) * 4], 4, 0);
gDPLoadTextureBlock(POLY_OPA_DISP++, D_020035C0[i], G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
}
gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[(sAmmoVtxOffset[item] + 28) * 4], 4, 0);
gDPLoadTextureBlock(POLY_OPA_DISP++, D_020035C0[ammo], G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
CLOSE_DISPS(gfxCtx, "../z_kaleido_item.c", 116);
}
void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx) {
pauseCtx->cursorVtx[0].v.ob[0] = vtx[index].v.ob[0];
pauseCtx->cursorVtx[0].v.ob[1] = vtx[index].v.ob[1];
}
void KaleidoScope_SetItemCursorVtx(PauseContext* pauseCtx) {
KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_ITEM] * 4, pauseCtx->itemVtx);
}
static s16 sMagicArrowEffectsR[] = { 255, 100, 255 };
static s16 sMagicArrowEffectsG[] = { 0, 100, 255 };
static s16 sMagicArrowEffectsB[] = { 0, 255, 100 };
void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
Input* input = &globalCtx->state.input[0];
PauseContext* pauseCtx = &globalCtx->pauseCtx;
u16 i;
u16 j;
u16 cursorItem;
u16 cursorSlot;
u16 index;
s16 cursorPoint;
s16 cursorX;
s16 cursorY;
s16 oldCursorPoint;
s16 moveCursorResult;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_item.c", 234);
func_800949A8(globalCtx->state.gfxCtx);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
pauseCtx->cursorColorSet = 0;
pauseCtx->nameColorSet = 0;
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM)) {
moveCursorResult = 0;
oldCursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
cursorItem = pauseCtx->cursorItem[PAUSE_ITEM];
cursorSlot = pauseCtx->cursorSlot[PAUSE_ITEM];
if (pauseCtx->cursorSpecialPos == 0) {
pauseCtx->cursorColorSet = 4;
if (cursorItem == PAUSE_ITEM_NONE) {
pauseCtx->stickRelX = 40;
}
if (ABS(pauseCtx->stickRelX) > 30) {
cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
cursorX = pauseCtx->cursorX[PAUSE_ITEM];
cursorY = pauseCtx->cursorY[PAUSE_ITEM];
osSyncPrintf("now=%d ccc=%d\n", cursorPoint, cursorItem);
// Seem necessary to match
if (pauseCtx->cursorX[PAUSE_ITEM]) {}
if (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]) {}
while (moveCursorResult == 0) {
if (pauseCtx->stickRelX < -30) {
if (pauseCtx->cursorX[PAUSE_ITEM] != 0) {
pauseCtx->cursorX[PAUSE_ITEM] -= 1;
pauseCtx->cursorPoint[PAUSE_ITEM] -= 1;
if (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) {
moveCursorResult = 1;
}
} else {
pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
pauseCtx->cursorY[PAUSE_ITEM] += 1;
if (pauseCtx->cursorY[PAUSE_ITEM] >= 4) {
pauseCtx->cursorY[PAUSE_ITEM] = 0;
}
pauseCtx->cursorPoint[PAUSE_ITEM] =
pauseCtx->cursorX[PAUSE_ITEM] + (pauseCtx->cursorY[PAUSE_ITEM] * 6);
if (pauseCtx->cursorPoint[PAUSE_ITEM] >= 24) {
pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorX[PAUSE_ITEM];
}
if (cursorY == pauseCtx->cursorY[PAUSE_ITEM]) {
pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT);
moveCursorResult = 2;
}
}
} else if (pauseCtx->stickRelX > 30) {
if (pauseCtx->cursorX[PAUSE_ITEM] < 5) {
pauseCtx->cursorX[PAUSE_ITEM] += 1;
pauseCtx->cursorPoint[PAUSE_ITEM] += 1;
if (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) {
moveCursorResult = 1;
}
} else {
pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
pauseCtx->cursorY[PAUSE_ITEM] += 1;
if (pauseCtx->cursorY[PAUSE_ITEM] >= 4) {
pauseCtx->cursorY[PAUSE_ITEM] = 0;
}
pauseCtx->cursorPoint[PAUSE_ITEM] =
pauseCtx->cursorX[PAUSE_ITEM] + (pauseCtx->cursorY[PAUSE_ITEM] * 6);
if (pauseCtx->cursorPoint[PAUSE_ITEM] >= 24) {
pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorX[PAUSE_ITEM];
}
if (cursorY == pauseCtx->cursorY[PAUSE_ITEM]) {
pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT);
moveCursorResult = 2;
}
}
}
}
if (moveCursorResult == 1) {
cursorItem = gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]];
}
osSyncPrintf("【X cursor=%d(%) (cur_xpt=%d)(ok_fg=%d)(ccc=%d)(key_angle=%d)】 ",
pauseCtx->cursorPoint[PAUSE_ITEM], pauseCtx->cursorX[PAUSE_ITEM], moveCursorResult,
cursorItem, pauseCtx->cursorSpecialPos);
}
} else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
if (pauseCtx->stickRelX > 30) {
pauseCtx->nameDisplayTimer = 0;
pauseCtx->cursorSpecialPos = 0;
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
cursorPoint = cursorX = cursorY = 0;
while (true) {
if (gSaveContext.inventory.items[cursorPoint] != ITEM_NONE) {
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
pauseCtx->cursorY[PAUSE_ITEM] = cursorY;
moveCursorResult = 1;
break;
}
cursorY = cursorY + 1;
cursorPoint = cursorPoint + 6;
if (cursorY < 4) {
continue;
}
cursorY = 0;
cursorPoint = cursorX + 1;
cursorX = cursorPoint;
if (cursorX < 6) {
continue;
}
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT);
break;
}
}
} else {
if (pauseCtx->stickRelX < -30) {
pauseCtx->nameDisplayTimer = 0;
pauseCtx->cursorSpecialPos = 0;
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
cursorPoint = cursorX = 5;
cursorY = 0;
while (true) {
if (gSaveContext.inventory.items[cursorPoint] != ITEM_NONE) {
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
pauseCtx->cursorY[PAUSE_ITEM] = cursorY;
moveCursorResult = 1;
break;
}
cursorY = cursorY + 1;
cursorPoint = cursorPoint + 6;
if (cursorY < 4) {
continue;
}
cursorY = 0;
cursorPoint = cursorX - 1;
cursorX = cursorPoint;
if (cursorX >= 0) {
continue;
}
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT);
break;
}
}
}
if (pauseCtx->cursorSpecialPos == 0) {
if (cursorItem != PAUSE_ITEM_NONE) {
if (ABS(pauseCtx->stickRelY) > 30) {
moveCursorResult = 0;
cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
cursorY = pauseCtx->cursorY[PAUSE_ITEM];
while (moveCursorResult == 0) {
if (pauseCtx->stickRelY > 30) {
if (pauseCtx->cursorY[PAUSE_ITEM] != 0) {
pauseCtx->cursorY[PAUSE_ITEM] -= 1;
pauseCtx->cursorPoint[PAUSE_ITEM] -= 6;
if (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) {
moveCursorResult = 1;
}
} else {
pauseCtx->cursorY[PAUSE_ITEM] = cursorY;
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
moveCursorResult = 2;
}
} else if (pauseCtx->stickRelY < -30) {
if (pauseCtx->cursorY[PAUSE_ITEM] < 3) {
pauseCtx->cursorY[PAUSE_ITEM] += 1;
pauseCtx->cursorPoint[PAUSE_ITEM] += 6;
if (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) {
moveCursorResult = 1;
}
} else {
pauseCtx->cursorY[PAUSE_ITEM] = cursorY;
pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint;
moveCursorResult = 2;
}
}
}
cursorPoint = PAUSE_ITEM;
osSyncPrintf("【Y cursor=%d(%) (cur_ypt=%d)(ok_fg=%d)(ccc=%d)】 ",
pauseCtx->cursorPoint[cursorPoint], pauseCtx->cursorY[PAUSE_ITEM], moveCursorResult,
cursorItem);
}
}
cursorSlot = pauseCtx->cursorPoint[PAUSE_ITEM];
pauseCtx->cursorColorSet = 4;
if (moveCursorResult == 1) {
cursorItem = gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]];
} else if (moveCursorResult != 2) {
cursorItem = gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]];
}
pauseCtx->cursorItem[PAUSE_ITEM] = cursorItem;
pauseCtx->cursorSlot[PAUSE_ITEM] = cursorSlot;
if (!((gSlotAgeReqs[cursorSlot] == 9) || (gSlotAgeReqs[cursorSlot] == ((void)0, gSaveContext.linkAge)))) {
pauseCtx->nameColorSet = 1;
}
if (cursorItem != PAUSE_ITEM_NONE) {
index = cursorSlot * 4; // required to match?
KaleidoScope_SetCursorVtx(pauseCtx, index, pauseCtx->itemVtx);
if ((pauseCtx->debugState == 0) && (pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) {
if (CHECK_BTN_ANY(input->press.button, BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) {
if (((gSlotAgeReqs[cursorSlot] == 9) ||
(gSlotAgeReqs[cursorSlot] == ((void)0, gSaveContext.linkAge))) &&
(cursorItem != ITEM_SOLD_OUT)) {
if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
pauseCtx->equipTargetCBtn = 0;
} else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
pauseCtx->equipTargetCBtn = 1;
} else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
pauseCtx->equipTargetCBtn = 2;
}
pauseCtx->equipTargetItem = cursorItem;
pauseCtx->equipTargetSlot = cursorSlot;
pauseCtx->unk_1E4 = 3;
pauseCtx->equipAnimX = pauseCtx->itemVtx[index].v.ob[0] * 10;
pauseCtx->equipAnimY = pauseCtx->itemVtx[index].v.ob[1] * 10;
pauseCtx->equipAnimAlpha = 255;
sEquipAnimTimer = 0;
sEquipState = 3;
sEquipMoveTimer = 10;
if ((pauseCtx->equipTargetItem == ITEM_ARROW_FIRE) ||
(pauseCtx->equipTargetItem == ITEM_ARROW_ICE) ||
(pauseCtx->equipTargetItem == ITEM_ARROW_LIGHT)) {
index = 0;
if (pauseCtx->equipTargetItem == ITEM_ARROW_ICE) {
index = 1;
}
if (pauseCtx->equipTargetItem == ITEM_ARROW_LIGHT) {
index = 2;
}
Audio_PlaySoundGeneral(NA_SE_SY_SET_FIRE_ARROW + index, &D_801333D4, 4, &D_801333E0,
&D_801333E0, &D_801333E8);
pauseCtx->equipTargetItem = 0xBF + index;
sEquipState = 0;
pauseCtx->equipAnimAlpha = 0;
sEquipMoveTimer = 6;
} else {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
}
} else {
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
}
}
}
} else {
pauseCtx->cursorVtx[0].v.ob[0] = pauseCtx->cursorVtx[2].v.ob[0] = pauseCtx->cursorVtx[1].v.ob[0] =
pauseCtx->cursorVtx[3].v.ob[0] = 0;
pauseCtx->cursorVtx[0].v.ob[1] = pauseCtx->cursorVtx[1].v.ob[1] = pauseCtx->cursorVtx[2].v.ob[1] =
pauseCtx->cursorVtx[3].v.ob[1] = -200;
}
} else {
pauseCtx->cursorItem[PAUSE_ITEM] = PAUSE_ITEM_NONE;
}
if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_ITEM]) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
} else if ((pauseCtx->unk_1E4 == 3) && (pauseCtx->pageIndex == PAUSE_ITEM)) {
KaleidoScope_SetCursorVtx(pauseCtx, cursorSlot * 4, pauseCtx->itemVtx);
pauseCtx->cursorColorSet = 4;
}
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE,
ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
for (i = 0, j = 24 * 4; i < 3; i++, j += 4) {
if (gSaveContext.equips.buttonItems[i + 1] != ITEM_NONE) {
gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[j], 4, 0);
POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, D_02000A00[1], 32, 32, 0);
}
}
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
for (i = j = 0; i < 24; i++, j += 4) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
if (gSaveContext.inventory.items[i] != ITEM_NONE) {
if ((pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM) && (pauseCtx->cursorSpecialPos == 0)) {
if ((gSlotAgeReqs[i] == 9) || (gSlotAgeReqs[i] == ((void)0, gSaveContext.linkAge))) {
if ((sEquipState == 2) && (i == 3)) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sMagicArrowEffectsR[pauseCtx->equipTargetItem - 0xBF],
sMagicArrowEffectsG[pauseCtx->equipTargetItem - 0xBF],
sMagicArrowEffectsB[pauseCtx->equipTargetItem - 0xBF], pauseCtx->alpha);
pauseCtx->itemVtx[j + 0].v.ob[0] = pauseCtx->itemVtx[j + 2].v.ob[0] =
pauseCtx->itemVtx[j + 0].v.ob[0] - 2;
pauseCtx->itemVtx[j + 1].v.ob[0] = pauseCtx->itemVtx[j + 3].v.ob[0] =
pauseCtx->itemVtx[j + 0].v.ob[0] + 32;
pauseCtx->itemVtx[j + 0].v.ob[1] = pauseCtx->itemVtx[j + 1].v.ob[1] =
pauseCtx->itemVtx[j + 0].v.ob[1] + 2;
pauseCtx->itemVtx[j + 2].v.ob[1] = pauseCtx->itemVtx[j + 3].v.ob[1] =
pauseCtx->itemVtx[j + 0].v.ob[1] - 32;
} else if (i == cursorSlot) {
pauseCtx->itemVtx[j + 0].v.ob[0] = pauseCtx->itemVtx[j + 2].v.ob[0] =
pauseCtx->itemVtx[j + 0].v.ob[0] - 2;
pauseCtx->itemVtx[j + 1].v.ob[0] = pauseCtx->itemVtx[j + 3].v.ob[0] =
pauseCtx->itemVtx[j + 0].v.ob[0] + 32;
pauseCtx->itemVtx[j + 0].v.ob[1] = pauseCtx->itemVtx[j + 1].v.ob[1] =
pauseCtx->itemVtx[j + 0].v.ob[1] + 2;
pauseCtx->itemVtx[j + 2].v.ob[1] = pauseCtx->itemVtx[j + 3].v.ob[1] =
pauseCtx->itemVtx[j + 0].v.ob[1] - 32;
}
}
}
gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[j + 0], 4, 0);
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[gSaveContext.inventory.items[i]], 32,
32, 0);
}
}
if (pauseCtx->cursorSpecialPos == 0) {
KaleidoScope_DrawCursor(globalCtx, PAUSE_ITEM);
}
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE,
ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
for (i = 0; i < 15; i++) {
if ((gAmmoItems[i] != ITEM_NONE) && (gSaveContext.inventory.items[i] != ITEM_NONE)) {
KaleidoScope_DrawAmmoCount(pauseCtx, globalCtx->state.gfxCtx, gSaveContext.inventory.items[i]);
}
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_item.c", 516);
}
static s16 sCButtonPosX[] = { 660, 900, 1140 };
static s16 sCButtonPosY[] = { 1100, 920, 1100 };
void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) {
static s16 D_8082A488 = 0;
PauseContext* pauseCtx = &globalCtx->pauseCtx;
Vtx* bowItemVtx;
u16 offsetX;
u16 offsetY;
if (sEquipState == 0) {
pauseCtx->equipAnimAlpha += 14;
if (pauseCtx->equipAnimAlpha > 255) {
pauseCtx->equipAnimAlpha = 254;
sEquipState++;
}
sEquipAnimTimer = 5;
return;
}
if (sEquipState == 2) {
D_8082A488--;
if (D_8082A488 == 0) {
pauseCtx->equipTargetItem -= 0xBF - ITEM_BOW_ARROW_FIRE;
pauseCtx->equipTargetSlot = SLOT_BOW;
sEquipMoveTimer = 6;
WREG(90) = 320;
WREG(87) = WREG(91);
sEquipState++;
Audio_PlaySoundGeneral(NA_SE_SY_SYNTH_MAGIC_ARROW, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
return;
}
if (sEquipState == 1) {
bowItemVtx = &pauseCtx->itemVtx[12];
offsetX = ABS(pauseCtx->equipAnimX - bowItemVtx->v.ob[0] * 10) / sEquipMoveTimer;
offsetY = ABS(pauseCtx->equipAnimY - bowItemVtx->v.ob[1] * 10) / sEquipMoveTimer;
} else {
offsetX = ABS(pauseCtx->equipAnimX - sCButtonPosX[pauseCtx->equipTargetCBtn]) / sEquipMoveTimer;
offsetY = ABS(pauseCtx->equipAnimY - sCButtonPosY[pauseCtx->equipTargetCBtn]) / sEquipMoveTimer;
}
if ((pauseCtx->equipTargetItem >= 0xBF) && (pauseCtx->equipAnimAlpha < 254)) {
pauseCtx->equipAnimAlpha += 14;
if (pauseCtx->equipAnimAlpha > 255) {
pauseCtx->equipAnimAlpha = 254;
}
sEquipAnimTimer = 5;
return;
}
if (sEquipAnimTimer == 0) {
WREG(90) -= WREG(87) / sEquipMoveTimer;
WREG(87) -= WREG(87) / sEquipMoveTimer;
if (sEquipState == 1) {
if (pauseCtx->equipAnimX >= (pauseCtx->itemVtx[12].v.ob[0] * 10)) {
pauseCtx->equipAnimX -= offsetX;
} else {
pauseCtx->equipAnimX += offsetX;
}
if (pauseCtx->equipAnimY >= (pauseCtx->itemVtx[12].v.ob[1] * 10)) {
pauseCtx->equipAnimY -= offsetY;
} else {
pauseCtx->equipAnimY += offsetY;
}
} else {
if (pauseCtx->equipAnimX >= sCButtonPosX[pauseCtx->equipTargetCBtn]) {
pauseCtx->equipAnimX -= offsetX;
} else {
pauseCtx->equipAnimX += offsetX;
}
if (pauseCtx->equipAnimY >= sCButtonPosY[pauseCtx->equipTargetCBtn]) {
pauseCtx->equipAnimY -= offsetY;
} else {
pauseCtx->equipAnimY += offsetY;
}
}
sEquipMoveTimer--;
if (sEquipMoveTimer == 0) {
if (sEquipState == 1) {
sEquipState++;
D_8082A488 = 4;
return;
}
osSyncPrintf("\n\n");
if (pauseCtx->equipTargetCBtn == 0) {
if (pauseCtx->equipTargetSlot == gSaveContext.equips.cButtonSlots[1]) {
if (gSaveContext.equips.buttonItems[1] != ITEM_NONE) {
if ((pauseCtx->equipTargetItem >= 0xBF) && (pauseCtx->equipTargetItem <= 0xC1) &&
((gSaveContext.equips.buttonItems[1] == ITEM_BOW) ||
((gSaveContext.equips.buttonItems[1] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[1] <= ITEM_BOW_ARROW_LIGHT)))) {
pauseCtx->equipTargetItem -= 0xBF - ITEM_BOW_ARROW_FIRE;
pauseCtx->equipTargetSlot = SLOT_BOW;
} else {
gSaveContext.equips.buttonItems[2] = gSaveContext.equips.buttonItems[1];
gSaveContext.equips.cButtonSlots[1] = gSaveContext.equips.cButtonSlots[0];
Interface_LoadItemIcon2(globalCtx, 2);
}
} else {
gSaveContext.equips.buttonItems[2] = ITEM_NONE;
gSaveContext.equips.cButtonSlots[1] = SLOT_NONE;
}
} else if (pauseCtx->equipTargetSlot == gSaveContext.equips.cButtonSlots[2]) {
if (gSaveContext.equips.buttonItems[1] != ITEM_NONE) {
if ((pauseCtx->equipTargetItem >= 0xBF) && (pauseCtx->equipTargetItem <= 0xC1) &&
((gSaveContext.equips.buttonItems[1] == ITEM_BOW) ||
((gSaveContext.equips.buttonItems[1] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[1] <= ITEM_BOW_ARROW_LIGHT)))) {
pauseCtx->equipTargetItem -= 0xBF - ITEM_BOW_ARROW_FIRE;
pauseCtx->equipTargetSlot = SLOT_BOW;
} else {
gSaveContext.equips.buttonItems[3] = gSaveContext.equips.buttonItems[1];
gSaveContext.equips.cButtonSlots[2] = gSaveContext.equips.cButtonSlots[0];
Interface_LoadItemIcon2(globalCtx, 3);
}
} else {
gSaveContext.equips.buttonItems[3] = ITEM_NONE;
gSaveContext.equips.cButtonSlots[2] = SLOT_NONE;
}
}
if ((pauseCtx->equipTargetItem >= 0xBF) && (pauseCtx->equipTargetItem <= 0xC1)) {
if ((gSaveContext.equips.buttonItems[1] == ITEM_BOW) ||
((gSaveContext.equips.buttonItems[1] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[1] <= ITEM_BOW_ARROW_LIGHT))) {
pauseCtx->equipTargetItem -= 0xBF - ITEM_BOW_ARROW_FIRE;
pauseCtx->equipTargetSlot = SLOT_BOW;
}
} else if (pauseCtx->equipTargetItem == ITEM_BOW) {
if ((gSaveContext.equips.buttonItems[2] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[2] <= ITEM_BOW_ARROW_LIGHT)) {
gSaveContext.equips.buttonItems[2] = gSaveContext.equips.buttonItems[1];
gSaveContext.equips.cButtonSlots[1] = gSaveContext.equips.cButtonSlots[0];
Interface_LoadItemIcon2(globalCtx, 2);
} else if ((gSaveContext.equips.buttonItems[3] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[3] <= ITEM_BOW_ARROW_LIGHT)) {
gSaveContext.equips.buttonItems[3] = gSaveContext.equips.buttonItems[1];
gSaveContext.equips.cButtonSlots[2] = gSaveContext.equips.cButtonSlots[0];
Interface_LoadItemIcon2(globalCtx, 3);
}
}
gSaveContext.equips.buttonItems[1] = pauseCtx->equipTargetItem;
gSaveContext.equips.cButtonSlots[0] = pauseCtx->equipTargetSlot;
Interface_LoadItemIcon1(globalCtx, 1);
osSyncPrintf("左sl_item_no=%d (1)=%d (2)=%d (3)=%d\n", pauseCtx->equipTargetItem,
gSaveContext.equips.buttonItems[1], gSaveContext.equips.buttonItems[2],
gSaveContext.equips.buttonItems[3]);
osSyncPrintf("左sl_number=%d (1)=%d (2)=%d (3)=%d\n", pauseCtx->equipTargetSlot,
gSaveContext.equips.cButtonSlots[0], gSaveContext.equips.cButtonSlots[1],
gSaveContext.equips.cButtonSlots[2]);
} else if (pauseCtx->equipTargetCBtn == 1) {
osSyncPrintf("下sl_item_no=%d (1)=%d (2)=%d (3)=%d\n", pauseCtx->equipTargetItem,
gSaveContext.equips.buttonItems[1], gSaveContext.equips.buttonItems[2],
gSaveContext.equips.buttonItems[3]);
osSyncPrintf("下sl_number=%d (1)=%d (2)=%d (3)=%d\n", pauseCtx->equipTargetSlot,
gSaveContext.equips.cButtonSlots[0], gSaveContext.equips.cButtonSlots[1],
gSaveContext.equips.cButtonSlots[2]);
if (pauseCtx->equipTargetSlot == gSaveContext.equips.cButtonSlots[0]) {
if (gSaveContext.equips.buttonItems[2] != ITEM_NONE) {
if ((pauseCtx->equipTargetItem >= 0xBF) && (pauseCtx->equipTargetItem <= 0xC1) &&
((gSaveContext.equips.buttonItems[2] == ITEM_BOW) ||
((gSaveContext.equips.buttonItems[2] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[2] <= ITEM_BOW_ARROW_LIGHT)))) {
pauseCtx->equipTargetItem -= 0xBF - ITEM_BOW_ARROW_FIRE;
pauseCtx->equipTargetSlot = SLOT_BOW;
} else {
gSaveContext.equips.buttonItems[1] = gSaveContext.equips.buttonItems[2];
gSaveContext.equips.cButtonSlots[0] = gSaveContext.equips.cButtonSlots[1];
Interface_LoadItemIcon2(globalCtx, 1);
}
} else {
gSaveContext.equips.buttonItems[1] = ITEM_NONE;
gSaveContext.equips.cButtonSlots[0] = SLOT_NONE;
}
} else if (pauseCtx->equipTargetSlot == gSaveContext.equips.cButtonSlots[2]) {
if (gSaveContext.equips.buttonItems[2] != ITEM_NONE) {
if ((pauseCtx->equipTargetItem >= 0xBF) && (pauseCtx->equipTargetItem <= 0xC1) &&
((gSaveContext.equips.buttonItems[2] == ITEM_BOW) ||
((gSaveContext.equips.buttonItems[2] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[2] <= ITEM_BOW_ARROW_LIGHT)))) {
pauseCtx->equipTargetItem -= 0xBF - ITEM_BOW_ARROW_FIRE;
pauseCtx->equipTargetSlot = SLOT_BOW;
} else {
gSaveContext.equips.buttonItems[3] = gSaveContext.equips.buttonItems[2];
gSaveContext.equips.cButtonSlots[2] = gSaveContext.equips.cButtonSlots[1];
Interface_LoadItemIcon2(globalCtx, 3);
}
} else {
gSaveContext.equips.buttonItems[3] = ITEM_NONE;
gSaveContext.equips.cButtonSlots[2] = SLOT_NONE;
}
}
if ((pauseCtx->equipTargetItem >= 0xBF) && (pauseCtx->equipTargetItem <= 0xC1)) {
if ((gSaveContext.equips.buttonItems[2] == ITEM_BOW) ||
((gSaveContext.equips.buttonItems[2] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[2] <= ITEM_BOW_ARROW_LIGHT))) {
pauseCtx->equipTargetItem -= 0xBF - ITEM_BOW_ARROW_FIRE;
pauseCtx->equipTargetSlot = SLOT_BOW;
}
} else if (pauseCtx->equipTargetItem == ITEM_BOW) {
if ((gSaveContext.equips.buttonItems[1] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[1] <= ITEM_BOW_ARROW_LIGHT)) {
gSaveContext.equips.buttonItems[1] = gSaveContext.equips.buttonItems[2];
Interface_LoadItemIcon2(globalCtx, 1);
} else if ((gSaveContext.equips.buttonItems[3] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[3] <= ITEM_BOW_ARROW_LIGHT)) {
gSaveContext.equips.buttonItems[3] = gSaveContext.equips.buttonItems[2];
Interface_LoadItemIcon2(globalCtx, 3);
}
}
gSaveContext.equips.buttonItems[2] = pauseCtx->equipTargetItem;
gSaveContext.equips.cButtonSlots[1] = pauseCtx->equipTargetSlot;
Interface_LoadItemIcon1(globalCtx, 2);
osSyncPrintf("下sl_item_no=%d (1)=%d (2)=%d (3)=%d\n", pauseCtx->equipTargetItem,
gSaveContext.equips.buttonItems[1], gSaveContext.equips.buttonItems[2],
gSaveContext.equips.buttonItems[3]);
osSyncPrintf("下sl_number=%d (1)=%d (2)=%d (3)=%d\n", pauseCtx->equipTargetSlot,
gSaveContext.equips.cButtonSlots[0], gSaveContext.equips.cButtonSlots[1],
gSaveContext.equips.cButtonSlots[2]);
} else {
osSyncPrintf("右sl_item_no=%d (1)=%d (2)=%d (3)=%d\n", pauseCtx->equipTargetItem,
gSaveContext.equips.buttonItems[1], gSaveContext.equips.buttonItems[2],
gSaveContext.equips.buttonItems[3]);
osSyncPrintf("右sl_number=%d (1)=%d (2)=%d (3)=%d\n", pauseCtx->equipTargetSlot,
gSaveContext.equips.cButtonSlots[0], gSaveContext.equips.cButtonSlots[1],
gSaveContext.equips.cButtonSlots[2]);
if (pauseCtx->equipTargetSlot == gSaveContext.equips.cButtonSlots[0]) {
if (gSaveContext.equips.buttonItems[3] != ITEM_NONE) {
if ((pauseCtx->equipTargetItem >= 0xBF) && (pauseCtx->equipTargetItem <= 0xC1) &&
((gSaveContext.equips.buttonItems[3] == ITEM_BOW) ||
((gSaveContext.equips.buttonItems[3] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[3] <= ITEM_BOW_ARROW_LIGHT)))) {
pauseCtx->equipTargetItem -= 0xBF - ITEM_BOW_ARROW_FIRE;
pauseCtx->equipTargetSlot = SLOT_BOW;
} else {
gSaveContext.equips.buttonItems[1] = gSaveContext.equips.buttonItems[3];
gSaveContext.equips.cButtonSlots[0] = gSaveContext.equips.cButtonSlots[2];
Interface_LoadItemIcon2(globalCtx, 1);
}
} else {
gSaveContext.equips.buttonItems[1] = ITEM_NONE;
gSaveContext.equips.cButtonSlots[0] = SLOT_NONE;
}
} else if (pauseCtx->equipTargetSlot == gSaveContext.equips.cButtonSlots[1]) {
if (gSaveContext.equips.buttonItems[3] != ITEM_NONE) {
if ((pauseCtx->equipTargetItem >= 0xBF) && (pauseCtx->equipTargetItem <= 0xC1) &&
((gSaveContext.equips.buttonItems[3] == ITEM_BOW) ||
((gSaveContext.equips.buttonItems[3] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[3] <= ITEM_BOW_ARROW_LIGHT)))) {
pauseCtx->equipTargetItem -= 0xBF - ITEM_BOW_ARROW_FIRE;
pauseCtx->equipTargetSlot = SLOT_BOW;
} else {
gSaveContext.equips.buttonItems[2] = gSaveContext.equips.buttonItems[3];
gSaveContext.equips.cButtonSlots[1] = gSaveContext.equips.cButtonSlots[2];
Interface_LoadItemIcon2(globalCtx, 2);
}
} else {
gSaveContext.equips.buttonItems[2] = ITEM_NONE;
gSaveContext.equips.cButtonSlots[1] = SLOT_NONE;
}
}
if ((pauseCtx->equipTargetItem >= 0xBF) && (pauseCtx->equipTargetItem <= 0xC1)) {
if ((gSaveContext.equips.buttonItems[3] == ITEM_BOW) ||
((gSaveContext.equips.buttonItems[3] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[3] <= ITEM_BOW_ARROW_LIGHT))) {
pauseCtx->equipTargetItem -= 0xBF - ITEM_BOW_ARROW_FIRE;
pauseCtx->equipTargetSlot = SLOT_BOW;
}
} else if (pauseCtx->equipTargetItem == ITEM_BOW) {
if ((gSaveContext.equips.buttonItems[1] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[1] <= ITEM_BOW_ARROW_LIGHT)) {
gSaveContext.equips.buttonItems[1] = gSaveContext.equips.buttonItems[3];
Interface_LoadItemIcon2(globalCtx, 1);
} else if ((gSaveContext.equips.buttonItems[2] >= ITEM_BOW_ARROW_FIRE) &&
(gSaveContext.equips.buttonItems[2] <= ITEM_BOW_ARROW_LIGHT)) {
gSaveContext.equips.buttonItems[2] = gSaveContext.equips.buttonItems[3];
Interface_LoadItemIcon2(globalCtx, 2);
}
}
gSaveContext.equips.buttonItems[3] = pauseCtx->equipTargetItem;
gSaveContext.equips.cButtonSlots[2] = pauseCtx->equipTargetSlot;
Interface_LoadItemIcon1(globalCtx, 3);
osSyncPrintf("右sl_item_no=%d (1)=%d (2)=%d (3)=%d\n", pauseCtx->equipTargetItem,
gSaveContext.equips.buttonItems[1], gSaveContext.equips.buttonItems[2],
gSaveContext.equips.buttonItems[3]);
osSyncPrintf("右sl_number=%d (1)=%d (2)=%d (3)=%d\n", pauseCtx->equipTargetSlot,
gSaveContext.equips.cButtonSlots[0], gSaveContext.equips.cButtonSlots[1],
gSaveContext.equips.cButtonSlots[2]);
}
pauseCtx->unk_1E4 = 0;
sEquipMoveTimer = 10;
WREG(90) = 320;
WREG(87) = WREG(91);
}
} else {
sEquipAnimTimer--;
if (sEquipAnimTimer == 0) {
pauseCtx->equipAnimAlpha = 255;
}
}
}

View file

@ -1,5 +1,731 @@
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_8081BB10.s")
#include "z_kaleido_scope.h"
#include "textures/icon_item_24_static/icon_item_24_static.h"
#include "textures/icon_item_nes_static/icon_item_nes_static.h"
#include "textures/icon_item_ger_static/icon_item_ger_static.h"
#include "textures/icon_item_fra_static/icon_item_fra_static.h"
#include "textures/icon_item_field_static/icon_item_field_static.h"
#include "textures/icon_item_dungeon_static/icon_item_dungeon_static.h"
#include "textures/icon_item_nes_static/icon_item_nes_static.h"
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_8081D398.s")
void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx) {
static void* dungeonItemTexs[] = {
gBossKeyIconTex,
gCompassIconTex,
gDungeonMapIconTex,
};
static void* dungeonTitleTexs[] = {
gPauseDekuTitleENGTex, gPauseDodongoTitleENGTex, gPauseJabuTitleENGTex, gPauseForestTitleENGTex,
gPauseFireTitleENGTex, gPauseWaterTitleENGTex, gPauseSpiritTitleENGTex, gPauseShadowTitleENGTex,
gPauseBotWTitleENGTex, gPauseIceCavernTitleENGTex,
};
static void* floorIconTexs[] = {
gDungeonMapBlankFloorButtonTex, gDungeonMap8FButtonTex, gDungeonMap7FButtonTex, gDungeonMap6FButtonTex,
gDungeonMap5FButtonTex, gDungeonMap4FButtonTex, gDungeonMap3FButtonTex, gDungeonMap2FButtonTex,
gDungeonMap1FButtonTex, gDungeonMapB1ButtonTex, gDungeonMapB2ButtonTex, gDungeonMapB3ButtonTex,
gDungeonMapB4ButtonTex, gDungeonMapB5ButtonTex, gDungeonMapB6ButtonTex, gDungeonMapB7ButtonTex,
gDungeonMapB8ButtonTex,
};
static u16 mapBgPulseColors[][3] = {
{ 0 / 8, 80 / 8, 255 / 8 },
{ 0 / 8, 200 / 8, 140 / 8 },
};
static s16 mapBgPulseR = 0 / 8;
static s16 mapBgPulseG = 200 / 8;
static s16 mapBgPulseB = 140 / 8;
static u16 mapBgPulseTimer = 20;
static u16 mapBgPulseStage = 0;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
PauseContext* pauseCtx = &globalCtx->pauseCtx;
s16 i;
s16 j;
s16 oldCursorPoint;
s16 stepR;
s16 stepG;
s16 stepB;
u16 rgba16;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_8081EFF0.s")
OPEN_DISPS(gfxCtx, "../z_kaleido_map_PAL.c", 123);
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) {
pauseCtx->cursorColorSet = 0;
oldCursorPoint = pauseCtx->cursorPoint[PAUSE_MAP];
if (pauseCtx->cursorSpecialPos == 0) {
if (pauseCtx->stickRelX > 30) {
if (pauseCtx->cursorX[PAUSE_MAP] != 0) {
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT);
} else {
pauseCtx->cursorX[PAUSE_MAP] = 1;
pauseCtx->cursorPoint[PAUSE_MAP] = 0;
if (!CHECK_DUNGEON_ITEM(DUNGEON_KEY_BOSS, gSaveContext.mapIndex)) {
pauseCtx->cursorPoint[PAUSE_MAP]++;
if (!CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.mapIndex)) {
pauseCtx->cursorPoint[PAUSE_MAP]++;
if (!CHECK_DUNGEON_ITEM(DUNGEON_MAP, gSaveContext.mapIndex)) {
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT);
}
}
}
}
} else if (pauseCtx->stickRelX < -30) {
if (pauseCtx->cursorX[PAUSE_MAP] == 0) {
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT);
} else {
pauseCtx->cursorX[PAUSE_MAP] = 0;
pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->dungeonMapSlot;
osSyncPrintf("kscope->cursor_point=%d\n", pauseCtx->cursorPoint[PAUSE_MAP]);
R_MAP_TEX_INDEX =
R_MAP_TEX_INDEX_BASE +
gMapData->floorTexIndexOffset[gSaveContext.mapIndex][pauseCtx->cursorPoint[PAUSE_MAP] - 3];
KaleidoScope_UpdateDungeonMap(globalCtx);
}
}
if (pauseCtx->cursorPoint[PAUSE_MAP] < 3) {
if (pauseCtx->stickRelY > 30) {
if (pauseCtx->cursorPoint[PAUSE_MAP] != 0) {
for (i = pauseCtx->cursorPoint[PAUSE_MAP] - 1; i >= 0; i--) {
if (CHECK_DUNGEON_ITEM(i, gSaveContext.mapIndex)) {
pauseCtx->cursorPoint[PAUSE_MAP] = i;
break;
}
}
}
} else {
if (pauseCtx->stickRelY < -30) {
if (pauseCtx->cursorPoint[PAUSE_MAP] != 2) {
for (i = pauseCtx->cursorPoint[PAUSE_MAP] + 1; i < 3; i++) {
if (CHECK_DUNGEON_ITEM(i, gSaveContext.mapIndex)) {
pauseCtx->cursorPoint[PAUSE_MAP] = i;
break;
}
}
}
}
}
} else {
if (pauseCtx->stickRelY > 30) {
if (pauseCtx->cursorPoint[PAUSE_MAP] >= 4) {
for (i = pauseCtx->cursorPoint[PAUSE_MAP] - 3 - 1; i >= 0; i--) {
if ((gSaveContext.sceneFlags[gSaveContext.mapIndex].floors & gBitFlags[i]) ||
(CHECK_DUNGEON_ITEM(DUNGEON_MAP, gSaveContext.mapIndex) &&
(gMapData->floorID[interfaceCtx->unk_25A][i] != 0))) {
pauseCtx->cursorPoint[PAUSE_MAP] = i + 3;
break;
}
}
}
} else if (pauseCtx->stickRelY < -30) {
if (pauseCtx->cursorPoint[PAUSE_MAP] != 10) {
for (i = pauseCtx->cursorPoint[PAUSE_MAP] - 3 + 1; i < 11; i++) {
if ((gSaveContext.sceneFlags[gSaveContext.mapIndex].floors & gBitFlags[i]) ||
(CHECK_DUNGEON_ITEM(DUNGEON_MAP, gSaveContext.mapIndex) &&
(gMapData->floorID[interfaceCtx->unk_25A][i] != 0))) {
pauseCtx->cursorPoint[PAUSE_MAP] = i + 3;
break;
}
}
}
}
i = R_MAP_TEX_INDEX;
R_MAP_TEX_INDEX =
R_MAP_TEX_INDEX_BASE +
gMapData->floorTexIndexOffset[gSaveContext.mapIndex][pauseCtx->cursorPoint[PAUSE_MAP] - 3];
pauseCtx->dungeonMapSlot = pauseCtx->cursorPoint[PAUSE_MAP];
if (i != R_MAP_TEX_INDEX) {
KaleidoScope_UpdateDungeonMap(globalCtx);
}
}
} else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
if (pauseCtx->stickRelX > 30) {
pauseCtx->nameDisplayTimer = 0;
pauseCtx->cursorSpecialPos = 0;
pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->dungeonMapSlot;
pauseCtx->cursorX[PAUSE_MAP] = 0;
j = 72 + (pauseCtx->cursorSlot[PAUSE_MAP] * 4);
KaleidoScope_SetCursorVtx(pauseCtx, j, pauseCtx->mapPageVtx);
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
} else {
if (pauseCtx->stickRelX < -30) {
pauseCtx->nameDisplayTimer = 0;
pauseCtx->cursorSpecialPos = 0;
pauseCtx->cursorX[PAUSE_MAP] = 1;
pauseCtx->cursorPoint[PAUSE_MAP] = 0;
if (!CHECK_DUNGEON_ITEM(DUNGEON_KEY_BOSS, gSaveContext.mapIndex)) {
pauseCtx->cursorPoint[PAUSE_MAP]++;
if (!CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.mapIndex)) {
pauseCtx->cursorPoint[PAUSE_MAP]++;
if (!CHECK_DUNGEON_ITEM(DUNGEON_MAP, gSaveContext.mapIndex)) {
pauseCtx->cursorX[PAUSE_MAP] = 0;
pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP] =
pauseCtx->dungeonMapSlot;
R_MAP_TEX_INDEX =
R_MAP_TEX_INDEX_BASE +
gMapData
->floorTexIndexOffset[gSaveContext.mapIndex][pauseCtx->cursorPoint[PAUSE_MAP] - 3];
KaleidoScope_UpdateDungeonMap(globalCtx);
}
}
} else {
pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP];
}
osSyncPrintf("kscope->cursor_point====%d\n", pauseCtx->cursorPoint[PAUSE_MAP]);
j = 72 + (pauseCtx->cursorSlot[PAUSE_MAP] * 4);
KaleidoScope_SetCursorVtx(pauseCtx, j, pauseCtx->mapPageVtx);
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
}
if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_MAP]) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
}
if (pauseCtx->cursorSpecialPos == 0) {
if (pauseCtx->cursorPoint[PAUSE_MAP] < 3) {
pauseCtx->cursorItem[PAUSE_MAP] = ITEM_KEY_BOSS + pauseCtx->cursorPoint[PAUSE_MAP];
} else {
pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE;
}
pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP];
j = 72 + (pauseCtx->cursorSlot[PAUSE_MAP] * 4);
KaleidoScope_SetCursorVtx(pauseCtx, j, pauseCtx->mapPageVtx);
if (pauseCtx->cursorX[PAUSE_MAP] == 0) {
pauseCtx->mapPageVtx[j + 0].v.ob[0] = pauseCtx->mapPageVtx[j + 2].v.ob[0] =
pauseCtx->mapPageVtx[j + 0].v.ob[0] - 2;
pauseCtx->mapPageVtx[j + 1].v.ob[0] = pauseCtx->mapPageVtx[j + 3].v.ob[0] =
pauseCtx->mapPageVtx[j + 1].v.ob[0] + 4;
pauseCtx->mapPageVtx[j + 0].v.ob[1] = pauseCtx->mapPageVtx[j + 1].v.ob[1] =
pauseCtx->mapPageVtx[j + 0].v.ob[1] + 2;
pauseCtx->mapPageVtx[j + 2].v.ob[1] = pauseCtx->mapPageVtx[j + 3].v.ob[1] =
pauseCtx->mapPageVtx[j + 2].v.ob[1] - 4;
}
}
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA, G_CC_MODULATEIA);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[68], 16, 0);
gDPLoadTextureBlock(POLY_OPA_DISP++, dungeonTitleTexs[gSaveContext.mapIndex], G_IM_FMT_IA, G_IM_SIZ_8b, 96, 16, 0,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
for (i = 0, j = 4; i < 3; i++, j += 4) {
if (CHECK_DUNGEON_ITEM(i, gSaveContext.mapIndex)) {
gDPLoadTextureBlock(POLY_OPA_DISP++, dungeonItemTexs[i], G_IM_FMT_RGBA, G_IM_SIZ_32b, 24, 24, 0,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0);
}
}
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 200, pauseCtx->alpha);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[84], 32, 0);
for (i = j = 0; i < 8; i++, j += 4) {
if ((gSaveContext.sceneFlags[gSaveContext.mapIndex].floors & gBitFlags[i]) ||
CHECK_DUNGEON_ITEM(DUNGEON_MAP, gSaveContext.mapIndex)) {
if (i != (pauseCtx->dungeonMapSlot - 3)) {
gDPLoadTextureBlock(POLY_OPA_DISP++, floorIconTexs[gMapData->floorID[interfaceCtx->unk_25A][i]],
G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0, G_TX_WRAP | G_TX_NOMIRROR,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0);
}
}
}
j = (pauseCtx->dungeonMapSlot - 3) * 4;
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 150, 150, 255, pauseCtx->alpha);
gDPLoadTextureBlock(POLY_OPA_DISP++,
floorIconTexs[gMapData->floorID[interfaceCtx->unk_25A][pauseCtx->dungeonMapSlot - 3]],
G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0, G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR,
G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0);
pauseCtx->mapPageVtx[124].v.ob[0] = pauseCtx->mapPageVtx[126].v.ob[0] = pauseCtx->mapPageVtx[124].v.ob[0] + 2;
pauseCtx->mapPageVtx[125].v.ob[0] = pauseCtx->mapPageVtx[127].v.ob[0] = pauseCtx->mapPageVtx[124].v.ob[0] + 19;
pauseCtx->mapPageVtx[124].v.ob[1] = pauseCtx->mapPageVtx[125].v.ob[1] = pauseCtx->mapPageVtx[124].v.ob[1] - 2;
pauseCtx->mapPageVtx[126].v.ob[1] = pauseCtx->mapPageVtx[127].v.ob[1] = pauseCtx->mapPageVtx[124].v.ob[1] - 19;
gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[116], 12, 0);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
pauseCtx->mapPageVtx[116].v.ob[1] = pauseCtx->mapPageVtx[117].v.ob[1] = pauseCtx->offsetY - (VREG(30) * 14) + 49;
pauseCtx->mapPageVtx[118].v.ob[1] = pauseCtx->mapPageVtx[119].v.ob[1] = pauseCtx->mapPageVtx[116].v.ob[1] - 16;
gDPLoadTextureBlock(POLY_OPA_DISP++, gDungeonMapLinkHeadTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, 16, 16, 0,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.mapIndex) &&
(gMapData->skullFloorIconY[gSaveContext.mapIndex] != -99)) {
pauseCtx->mapPageVtx[120].v.ob[1] = pauseCtx->mapPageVtx[121].v.ob[1] =
gMapData->skullFloorIconY[gSaveContext.mapIndex] + pauseCtx->offsetY;
pauseCtx->mapPageVtx[122].v.ob[1] = pauseCtx->mapPageVtx[123].v.ob[1] = pauseCtx->mapPageVtx[120].v.ob[1] - 16;
gDPLoadTextureBlock(POLY_OPA_DISP++, gDungeonMapSkullTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, 16, 16, 0,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 4, 6, 7, 5, 0);
}
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
if (GET_GS_FLAGS(gSaveContext.mapIndex) == gAreaGsFlags[gSaveContext.mapIndex]) {
KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gGoldSkulltulaIconTex, 24, 24, 8);
}
if ((globalCtx->sceneNum >= SCENE_YDAN) && (globalCtx->sceneNum <= SCENE_TAKARAYA)) {
stepR = (mapBgPulseR - mapBgPulseColors[mapBgPulseStage][0]) / mapBgPulseTimer;
stepG = (mapBgPulseG - mapBgPulseColors[mapBgPulseStage][1]) / mapBgPulseTimer;
stepB = (mapBgPulseB - mapBgPulseColors[mapBgPulseStage][2]) / mapBgPulseTimer;
mapBgPulseR -= stepR;
mapBgPulseG -= stepG;
mapBgPulseB -= stepB;
rgba16 = ((mapBgPulseR & 0x1F) << 11) | ((mapBgPulseG & 0x1F) << 6) | ((mapBgPulseB & 0x1F) << 1) | 1;
interfaceCtx->mapPalette[28] = (rgba16 & 0xFF00) >> 8;
interfaceCtx->mapPalette[29] = rgba16 & 0xFF;
mapBgPulseTimer--;
if (mapBgPulseTimer == 0) {
mapBgPulseStage ^= 1;
mapBgPulseTimer = 20;
}
}
gDPPipeSync(POLY_OPA_DISP++);
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
gDPLoadTLUT_pal16(POLY_OPA_DISP++, 0, interfaceCtx->mapPalette);
gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_RGBA16);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[60], 8, 0);
gDPLoadTextureBlock_4b(POLY_OPA_DISP++, interfaceCtx->mapSegment, G_IM_FMT_CI, 48, 85, 0, G_TX_WRAP | G_TX_NOMIRROR,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
gDPLoadTextureBlock_4b(POLY_OPA_DISP++, interfaceCtx->mapSegment + 0x800, G_IM_FMT_CI, 48, 85, 0,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 4, 6, 7, 5, 0);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP);
CLOSE_DISPS(gfxCtx, "../z_kaleido_map_PAL.c", 388);
}
void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx) {
static void* cloudTexs[] = {
gWorldMapCloud16Tex, gWorldMapCloud15Tex, gWorldMapCloud14Tex, gWorldMapCloud13Tex,
gWorldMapCloud12Tex, gWorldMapCloud11Tex, gWorldMapCloud10Tex, gWorldMapCloud9Tex,
gWorldMapCloud8Tex, gWorldMapCloud7Tex, gWorldMapCloud6Tex, gWorldMapCloud5Tex,
gWorldMapCloud4Tex, gWorldMapCloud3Tex, gWorldMapCloud2Tex, gWorldMapCloud1Tex,
};
static u16 cloudFlagNums[] = {
0x05, 0x00, 0x13, 0x0E, 0x0F, 0x01, 0x02, 0x10, 0x12, 0x03, 0x07, 0x08, 0x09, 0x0C, 0x0B, 0x06,
};
static s16 pointPulsePrimColor[] = { 0, 0, 255 };
static s16 pointPrimColors[][3] = {
{ 0, 0, 255 },
{ 255, 255, 0 },
};
static s16 pointPulseEnvColor[] = { 255, 255, 0 };
static s16 pointEnvColors[][3] = {
{ 255, 255, 0 },
{ 0, 0, 255 },
};
static s16 pointPulseStage = 1;
static s16 pointPulseTimer = 20;
static s16 D_8082A5B8[] = { 64, 64, 64, 28 };
static s16 areaBoxPosX[] = {
-41, 19, 44, 40, 49, 51, -49, 83, 80, -67, 50, -109, -76, -86, -10, -6, 19, 24, 11, -17, 37, -6,
};
static s16 areaBoxWidths[] = {
96, 32, 32, 48, 48, 32, 48, 32, 32, 32, 16, 32, 32, 16, 32, 32, 32, 32, 32, 32, 16, 32,
};
static s16 areaBoxPosY[] = {
30, 36, 35, 26, 7, 11, -31, 30, 38, 23, 2, 42, 40, 32, 38, 50, 57, 58, 56, 12, 36, 50,
};
static s16 areaBoxHeights[] = {
59, 19, 13, 19, 38, 17, 38, 17, 13, 26, 16, 26, 26, 16, 19, 17, 26, 13, 17, 17, 16, 17,
};
static void* areaBoxTexs[] = {
gWorldMapAreaBox7Tex, gWorldMapAreaBox1Tex, gWorldMapAreaBox4Tex, gWorldMapAreaBox6Tex, gWorldMapAreaBox2Tex,
gWorldMapAreaBox3Tex, gWorldMapAreaBox2Tex, gWorldMapAreaBox3Tex, gWorldMapAreaBox4Tex, gWorldMapAreaBox5Tex,
gWorldMapAreaBox8Tex, gWorldMapAreaBox5Tex, gWorldMapAreaBox5Tex, gWorldMapAreaBox8Tex, gWorldMapAreaBox1Tex,
gWorldMapAreaBox3Tex, gWorldMapAreaBox5Tex, gWorldMapAreaBox4Tex, gWorldMapAreaBox3Tex, gWorldMapAreaBox3Tex,
gWorldMapAreaBox8Tex, gWorldMapAreaBox3Tex,
};
static void* currentPosTitleTexs[] = {
gPauseCurrentPositionENGTex,
gPauseCurrentPositionGERTex,
gPauseCurrentPositionFRATex,
};
static u16 D_8082A6D4 = 0;
PauseContext* pauseCtx = &globalCtx->pauseCtx;
s16 i;
s16 j;
s16 t;
s16 k;
s16 oldCursorPoint;
s16 stepR;
s16 stepG;
s16 stepB;
OPEN_DISPS(gfxCtx, "../z_kaleido_map_PAL.c", 556);
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) {
pauseCtx->cursorColorSet = 0;
oldCursorPoint = pauseCtx->cursorPoint[PAUSE_WORLD_MAP];
if (pauseCtx->cursorSpecialPos == 0) {
if (pauseCtx->stickRelX > 30) {
D_8082A6D4 = 0;
do {
pauseCtx->cursorPoint[PAUSE_WORLD_MAP]++;
if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] > 11) {
pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 11;
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_RIGHT);
break;
}
} while (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]] == 0);
} else if (pauseCtx->stickRelX < -30) {
D_8082A6D4 = 0;
do {
pauseCtx->cursorPoint[PAUSE_WORLD_MAP]--;
if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] < 0) {
pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 0;
KaleidoScope_MoveCursorToSpecialPos(globalCtx, PAUSE_CURSOR_PAGE_LEFT);
break;
}
} while (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]] == 0);
} else {
D_8082A6D4++;
}
pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP];
pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP] + 0x1F;
KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_MAP] * 4, pauseCtx->mapPageVtx);
} else {
pauseCtx->cursorItem[PAUSE_MAP] = gSaveContext.worldMapArea + 0x18;
if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
if (pauseCtx->stickRelX > 30) {
pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 0;
pauseCtx->cursorSpecialPos = 0;
while (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]] == 0) {
pauseCtx->cursorPoint[PAUSE_WORLD_MAP]++;
}
pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP];
pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP] + 0x1F;
KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_MAP] * 4, pauseCtx->mapPageVtx);
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
D_8082A6D4 = 0;
}
} else {
if (pauseCtx->stickRelX < -30) {
pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 11;
pauseCtx->cursorSpecialPos = 0;
while (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]] == 0) {
pauseCtx->cursorPoint[PAUSE_WORLD_MAP]--;
}
pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP];
pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP] + 0x1F;
KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_MAP] * 4, pauseCtx->mapPageVtx);
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
D_8082A6D4 = 0;
}
}
}
if (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]] == 0) {
pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE;
}
if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_WORLD_MAP]) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
}
gDPPipeSync(POLY_OPA_DISP++);
if (HREG(15) == 0) {
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT);
gDPLoadTLUT_pal256(POLY_OPA_DISP++, gWorldMapImageTLUT);
gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_RGBA16);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[188], 32, 0);
for (j = t = i = 0; i < 8; i++, t++, j += 4) {
gDPLoadTextureBlock(POLY_OPA_DISP++, (u8*)gWorldMapImageTex + t * 216 * 9, G_IM_FMT_CI, G_IM_SIZ_8b, 216, 9,
0, G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0);
if (1) {}
}
gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[220], 28, 0);
for (j = i = 0; i < 6; i++, t++, j += 4) {
gDPLoadTextureBlock(POLY_OPA_DISP++, (u8*)gWorldMapImageTex + t * 216 * 9, G_IM_FMT_CI, G_IM_SIZ_8b, 216, 9,
0, G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0);
}
gDPLoadTextureBlock(POLY_OPA_DISP++, (u8*)gWorldMapImageTex + t * 216 * 9, G_IM_FMT_CI, G_IM_SIZ_8b, 216, 2, 0,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0);
} else if (HREG(15) == 1) {
Gfx* sp1CC = POLY_OPA_DISP;
void* mapImage = gWorldMapImageTex;
// gSPLoadUcodeL(sp1CC++, rspS2DEX)?
gSPLoadUcodeEx(sp1CC++, OS_K0_TO_PHYSICAL(D_80113070), OS_K0_TO_PHYSICAL(D_801579A0), 0x800);
func_8009638C(&sp1CC, mapImage, gWorldMapImageTLUT, 216, 128, G_IM_FMT_CI, G_IM_SIZ_8b, 0x8000, 256,
HREG(13) / 100.0f, HREG(14) / 100.0f);
// gSPLoadUcode(sp1CC++, SysUcode_GetUCode(), SysUcode_GetUCodeData())?
gSPLoadUcodeEx(sp1CC++, SysUcode_GetUCode(), SysUcode_GetUCodeData(), 0x800);
POLY_OPA_DISP = sp1CC;
}
if (HREG(15) == 2) {
HREG(15) = 1;
HREG(14) = 6100;
HREG(13) = 5300;
}
if (ZREG(38) == 0) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP);
func_800949A8(gfxCtx);
gDPSetCombineLERP(POLY_OPA_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, 0,
PRIMITIVE, 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 235, 235, 235, pauseCtx->alpha);
for (k = 0; k < 15; k += 8) {
gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[60 + k * 4], 32, 0);
for (j = i = 0; i < 8; i++, j += 4) {
if (!(gSaveContext.worldMapAreaData & gBitFlags[cloudFlagNums[k + i]])) {
gDPLoadTextureBlock_4b(POLY_OPA_DISP++, cloudTexs[k + i], G_IM_FMT_I, D_8082AAEC[k + i],
D_8082AB2C[k + i], 0, G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR,
G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0);
if (1) {}
}
}
}
}
if (gSaveContext.worldMapArea < 22) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT);
pauseCtx->mapPageVtx[172].v.ob[0] = pauseCtx->mapPageVtx[174].v.ob[0] =
areaBoxPosX[((void)0, gSaveContext.worldMapArea)];
pauseCtx->mapPageVtx[173].v.ob[0] = pauseCtx->mapPageVtx[175].v.ob[0] =
pauseCtx->mapPageVtx[172].v.ob[0] + areaBoxWidths[((void)0, gSaveContext.worldMapArea)];
pauseCtx->mapPageVtx[172].v.ob[1] = pauseCtx->mapPageVtx[173].v.ob[1] =
areaBoxPosY[((void)0, gSaveContext.worldMapArea)] + pauseCtx->offsetY;
pauseCtx->mapPageVtx[174].v.ob[1] = pauseCtx->mapPageVtx[175].v.ob[1] =
pauseCtx->mapPageVtx[172].v.ob[1] - areaBoxHeights[((void)0, gSaveContext.worldMapArea)];
pauseCtx->mapPageVtx[173].v.tc[0] = pauseCtx->mapPageVtx[175].v.tc[0] =
areaBoxWidths[((void)0, gSaveContext.worldMapArea)] << 5;
pauseCtx->mapPageVtx[174].v.tc[1] = pauseCtx->mapPageVtx[175].v.tc[1] =
areaBoxHeights[((void)0, gSaveContext.worldMapArea)] << 5;
gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[172], 4, 0);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 255, 255, pauseCtx->alpha);
gDPLoadTextureBlock_4b(POLY_OPA_DISP++, areaBoxTexs[((void)0, (gSaveContext.worldMapArea))], G_IM_FMT_IA,
areaBoxWidths[((void)0, (gSaveContext.worldMapArea))],
areaBoxHeights[((void)0, (gSaveContext.worldMapArea))], 0, G_TX_WRAP | G_TX_NOMIRROR,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP);
}
stepR = ABS(pointPulsePrimColor[0] - pointPrimColors[pointPulseStage][0]) / pointPulseTimer;
stepG = ABS(pointPulsePrimColor[1] - pointPrimColors[pointPulseStage][1]) / pointPulseTimer;
stepB = ABS(pointPulsePrimColor[2] - pointPrimColors[pointPulseStage][2]) / pointPulseTimer;
if (pointPulsePrimColor[0] >= pointPrimColors[pointPulseStage][0]) {
pointPulsePrimColor[0] -= stepR;
} else {
pointPulsePrimColor[0] += stepR;
}
if (pointPulsePrimColor[1] >= pointPrimColors[pointPulseStage][1]) {
pointPulsePrimColor[1] -= stepG;
} else {
pointPulsePrimColor[1] += stepG;
}
if (pointPulsePrimColor[2] >= pointPrimColors[pointPulseStage][2]) {
pointPulsePrimColor[2] -= stepB;
} else {
pointPulsePrimColor[2] += stepB;
}
stepR = ABS(pointPulseEnvColor[0] - pointEnvColors[pointPulseStage][0]) / pointPulseTimer;
stepG = ABS(pointPulseEnvColor[1] - pointEnvColors[pointPulseStage][1]) / pointPulseTimer;
stepB = ABS(pointPulseEnvColor[2] - pointEnvColors[pointPulseStage][2]) / pointPulseTimer;
if (pointPulseEnvColor[0] >= pointEnvColors[pointPulseStage][0]) {
pointPulseEnvColor[0] -= stepR;
} else {
pointPulseEnvColor[0] += stepR;
}
if (pointPulseEnvColor[1] >= pointEnvColors[pointPulseStage][1]) {
pointPulseEnvColor[1] -= stepG;
} else {
pointPulseEnvColor[1] += stepG;
}
if (pointPulseEnvColor[2] >= pointEnvColors[pointPulseStage][2]) {
pointPulseEnvColor[2] -= stepB;
} else {
pointPulseEnvColor[2] += stepB;
}
pointPulseTimer--;
if (pointPulseTimer == 0) {
pointPulsePrimColor[0] = pointPrimColors[pointPulseStage][0];
pointPulsePrimColor[1] = pointPrimColors[pointPulseStage][1];
pointPulsePrimColor[2] = pointPrimColors[pointPulseStage][2];
pointPulseEnvColor[0] = pointEnvColors[pointPulseStage][0];
pointPulseEnvColor[1] = pointEnvColors[pointPulseStage][1];
pointPulseEnvColor[2] = pointEnvColors[pointPulseStage][2];
pointPulseStage ^= 1;
pointPulseTimer = 20;
}
func_800949A8(gfxCtx);
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE,
ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPLoadTextureBlock(POLY_OPA_DISP++, gWorldMapDotTex, G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 0, G_TX_WRAP | G_TX_NOMIRROR,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
for (j = i = 0; i < 12; i++, t++, j += 4) {
if (pauseCtx->worldMapPoints[i] != 0) {
gDPPipeSync(POLY_OPA_DISP++);
if (pauseCtx->worldMapPoints[i] == 1) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, pointPrimColors[0][0], pointPrimColors[0][1],
pointPrimColors[0][2], pauseCtx->alpha);
gDPSetEnvColor(POLY_OPA_DISP++, pointEnvColors[0][0], pointEnvColors[0][1], pointEnvColors[0][2], 0);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, pointPulsePrimColor[0], pointPulsePrimColor[1],
pointPulsePrimColor[2], pauseCtx->alpha);
gDPSetEnvColor(POLY_OPA_DISP++, pointPulseEnvColor[0], pointPulseEnvColor[1], pointPulseEnvColor[2], 0);
}
gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[124 + i * 4], 4, 0);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
}
}
if (pauseCtx->cursorSpecialPos == 0) {
KaleidoScope_DrawCursor(globalCtx, PAUSE_MAP);
}
gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[176], 16, 0);
if (pauseCtx->tradeQuestLocation != 0xFF) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, pointPulsePrimColor[0], 0, pauseCtx->alpha);
gDPLoadTextureBlock(POLY_OPA_DISP++, gWorldMapArrowTex, G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 0,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
}
if (gSaveContext.worldMapArea < 22) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 150, 255, 255, pauseCtx->alpha);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, pauseCtx->nameSegment + 0x400, 80, 32, 4);
}
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineLERP(POLY_OPA_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, 0,
PRIMITIVE, 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, pauseCtx->alpha);
gDPLoadTextureBlock_4b(POLY_OPA_DISP++, currentPosTitleTexs[gSaveContext.language], G_IM_FMT_I, 64, 8, 0,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 8, 10, 11, 9, 0);
gDPPipeSync(POLY_OPA_DISP++);
CLOSE_DISPS(gfxCtx, "../z_kaleido_map_PAL.c", 874);
}

View file

@ -0,0 +1,34 @@
#include "z_kaleido_scope.h"
static s16 D_8082A6E0[] = { 100, 255 };
void KaleidoScope_UpdatePrompt(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
Input* input = &globalCtx->state.input[0];
s8 relStickX = input->rel.stick_x;
s16 step;
if (((pauseCtx->state == 7) && (pauseCtx->unk_1EC == 1)) || (pauseCtx->state == 0xE) || (pauseCtx->state == 0x10)) {
if ((pauseCtx->promptChoice == 0) && (relStickX >= 30)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
pauseCtx->promptChoice = 4;
} else if ((pauseCtx->promptChoice != 0) && (relStickX <= -30)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
pauseCtx->promptChoice = 0;
}
step = ABS(VREG(61) - D_8082A6E0[VREG(62)]) / VREG(63);
if (VREG(61) >= D_8082A6E0[VREG(62)]) {
VREG(61) -= step;
} else {
VREG(61) += step;
}
VREG(63)--;
if (VREG(63) == 0) {
VREG(61) = D_8082A6E0[VREG(62)];
VREG(63) = VREG(60) + VREG(62);
VREG(62) ^= 1;
}
}
}

View file

@ -0,0 +1,36 @@
#ifndef _Z_KALEIDO_SCOPE_H_
#define _Z_KALEIDO_SCOPE_H_
#include "ultra64.h"
#include "global.h"
extern u8 gAmmoItems[];
extern s16 D_8082AAEC[];
extern s16 D_8082AB2C[];
extern u8 gSlotAgeReqs[];
extern u8 gEquipAgeReqs[][4];
extern u8 gAreaGsFlags[];
void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfxCtx);
s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point);
void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx);
void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx);
void KaleidoScope_DrawEquipment(GlobalContext* globalCtx);
void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx);
void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx);
void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx);
void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx);
void KaleidoScope_DrawWorldMap(GlobalContext* globalCtx, GraphicsContext* gfxCtx);
void KaleidoScope_UpdatePrompt(GlobalContext* globalCtx);
Gfx* KaleidoScope_QuadTextureIA4(Gfx* gfx, void* texture, s16 width, s16 height, u16 point);
Gfx* KaleidoScope_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, u16 point);
void KaleidoScope_MoveCursorToSpecialPos(GlobalContext* globalCtx, u16 specialPos);
void KaleidoScope_DrawQuadTextureRGBA32(GraphicsContext* gfxCtx, void* texture, u16 width, u16 height, u16 point);
void KaleidoScope_ProcessPlayerPreRender();
void KaleidoScope_SetupPlayerPreRender(GlobalContext* globalCtx);
void KaleidoScope_DrawCursor(GlobalContext* globalCtx, u16 pageIndex);
void KaleidoScope_UpdateDungeonMap(GlobalContext* globalCtx);
void PauseMapMark_Draw(GlobalContext* globalCtx);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,168 @@
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_80829960.s")
#include "z_kaleido_scope.h"
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_80829990.s")
typedef struct {
/* 0x00 */ void* texture;
/* 0x04 */ u32 imageFormat;
/* 0x08 */ u32 imageSize;
/* 0x0C */ u32 textureWidth;
/* 0x10 */ u32 textureHeight;
/* 0x14 */ u32 rectWidth;
/* 0x18 */ u32 rectHeight;
/* 0x1C */ u32 dsdx;
/* 0x20 */ u32 dtdy;
} PauseMapMarkInfo; // size = 0x24
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_808299A0.s")
static PauseMapMarkInfo sMapMarkInfoTable[] = {
{ D_02002580, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 8, 32, 32, 1024, 1024 }, // Chest Icon
{ D_02002900, G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 32, 32, 1024, 1024 }, // Boss Skull Icon
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_8082A00C.s")
static const u32 sBaseImageSizes[] = { 0, 1, 2, 3 };
static const u32 sLoadBlockImageSizes[] = { 2, 2, 2, 3 };
static const u32 sIncrImageSizes[] = { 3, 1, 0, 0 };
static const u32 sShiftImageSizes[] = { 2, 1, 0, 0 };
static const u32 sBytesImageSizes[] = { 0, 1, 2, 4 };
static const u32 sLineBytesImageSizes[] = { 0, 1, 2, 2 };
#define G_IM_SIZ_MARK sBaseImageSizes[markInfo->imageSize]
#define G_IM_SIZ_MARK_LOAD_BLOCK sLoadBlockImageSizes[markInfo->imageSize]
#define G_IM_SIZ_MARK_INCR sIncrImageSizes[markInfo->imageSize]
#define G_IM_SIZ_MARK_SHIFT sShiftImageSizes[markInfo->imageSize]
#define G_IM_SIZ_MARK_BYTES sBytesImageSizes[markInfo->imageSize]
#define G_IM_SIZ_MARK_LINE_BYTES sLineBytesImageSizes[markInfo->imageSize]
extern PauseMapMarksData gPauseMapMarkDataTable[];
void PauseMapMark_Init(GlobalContext* globalCtx) {
gBossMarkState = 0;
gBossMarkScale = 1.0f;
gLoadedPauseMarkDataTable = gPauseMapMarkDataTable;
}
void PauseMapMark_Clear(GlobalContext* globalCtx) {
gLoadedPauseMarkDataTable = NULL;
}
void PauseMapMark_DrawForDungeon(GlobalContext* globalCtx) {
PauseMapMarkData* mapMarkData;
PauseMapMarkPoint* markPoint;
PauseMapMarkInfo* markInfo;
f32 scale;
s32 i = 0;
mapMarkData = &gLoadedPauseMarkDataTable[R_MAP_TEX_INDEX >> 1][i];
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_lmap_mark.c", 182);
while (true) {
if (mapMarkData->markType == PAUSE_MAP_MARK_NONE) {
break;
}
if ((mapMarkData->markType == PAUSE_MAP_MARK_BOSS) && (globalCtx->sceneNum >= SCENE_YDAN_BOSS) &&
(globalCtx->sceneNum <= SCENE_GANON_FINAL)) {
if (gBossMarkState == 0) {
Math_ApproachF(&gBossMarkScale, 1.5f, 1.0f, 0.041f);
if (gBossMarkScale == 1.5f) {
gBossMarkState = 1;
}
} else {
Math_ApproachF(&gBossMarkScale, 1.0f, 1.0f, 0.041f);
if (gBossMarkScale == 1.0f) {
gBossMarkState = 0;
}
}
scale = gBossMarkScale;
} else {
scale = 1.0f;
}
Matrix_Push();
if ((globalCtx->pauseCtx.state == 4) || (globalCtx->pauseCtx.state >= 0x12)) {
Matrix_Translate(-36.0f, 101.0f, 0.0f, MTXMODE_APPLY);
} else {
Matrix_Translate(-36.0f, 21.0f, 0.0f, MTXMODE_APPLY);
}
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
markPoint = &mapMarkData->points[0];
for (i = 0; i < mapMarkData->count; i++) {
s32 display;
if (mapMarkData->markType == PAUSE_MAP_MARK_CHEST) {
if (Flags_GetTreasure(globalCtx, markPoint->chestFlag)) {
display = false;
} else {
switch (globalCtx->sceneNum) {
case SCENE_YDAN_BOSS:
case SCENE_DDAN_BOSS:
case SCENE_BDAN_BOSS:
case SCENE_MORIBOSSROOM:
case SCENE_FIRE_BS:
case SCENE_MIZUSIN_BS:
case SCENE_JYASINBOSS:
case SCENE_HAKADAN_BS:
display = false;
break;
default:
display = true;
break;
}
}
} else {
display = true;
}
if (display) {
markInfo = &sMapMarkInfoTable[mapMarkData->markType];
gDPPipeSync(POLY_OPA_DISP++);
gDPLoadTextureBlock(POLY_OPA_DISP++, markInfo->texture, markInfo->imageFormat, G_IM_SIZ_MARK,
markInfo->textureWidth, markInfo->textureHeight, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
Matrix_Push();
Matrix_Translate(GREG(92) + markPoint->x, GREG(93) + markPoint->y, 0.0f, MTXMODE_APPLY);
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_lmap_mark.c", 272),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
Matrix_Pop();
gSPVertex(POLY_OPA_DISP++, mapMarkData->vtx, mapMarkData->vtxCount, 0);
gSP1Quadrangle(POLY_OPA_DISP++, 1, 3, 2, 0, 0);
}
markPoint++;
}
mapMarkData++;
Matrix_Pop();
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_lmap_mark.c", 286);
}
void PauseMapMark_Draw(GlobalContext* globalCtx) {
PauseMapMark_Init(globalCtx);
switch (globalCtx->sceneNum) {
case SCENE_YDAN:
case SCENE_DDAN:
case SCENE_BDAN:
case SCENE_BMORI1:
case SCENE_HIDAN:
case SCENE_MIZUSIN:
case SCENE_JYASINZOU:
case SCENE_HAKADAN:
case SCENE_HAKADANCH:
case SCENE_ICE_DOUKUTO:
PauseMapMark_DrawForDungeon(globalCtx);
break;
}
PauseMapMark_Clear(globalCtx);
}

View file

@ -0,0 +1,531 @@
#include "z_kaleido_scope.h"
static const Vtx sMarkBossVtx[] = {
VTX(-4, 4, 0, 0, 0, 255, 255, 255, 255),
VTX(-4, -4, 0, 0, 256, 255, 255, 255, 255),
VTX(4, 4, 0, 256, 0, 255, 255, 255, 255),
VTX(4, -4, 0, 256, 256, 255, 255, 255, 255),
};
static const Vtx sMarkChestVtx[] = {
VTX(-4, 4, 0, 0, 0, 255, 255, 255, 255),
VTX(-4, -4, 0, 0, 256, 255, 255, 255, 255),
VTX(4, 4, 0, 256, 0, 255, 255, 255, 255),
VTX(4, -4, 0, 256, 256, 255, 255, 255, 255),
};
PauseMapMarksData gPauseMapMarkDataTable[] = {
// Deku Tree map 0
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
2,
{
{ 2, 40.0f, -33.0f },
{ 6, 49.0f, -42.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Deku Tree map 1
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
1,
{
{ 1, 48.0f, -63.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Deku Tree map 2
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
1,
{
{ 3, 84.0f, -39.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Deku Tree map 3
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
3,
{
{ 0, 46.0f, -59.0f },
{ 4, 77.0f, -26.0f },
{ 5, 65.0f, -61.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Deku Tree map 4
{
{ PAUSE_MAP_MARK_BOSS,
23,
sMarkBossVtx,
4,
1,
{
{ -1, 55.0f, 0.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Dodongo's Cavern map 0
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
3,
{
{ 2, 55.0f, -36.0f },
{ 3, 54.0f, -51.0f },
{ 5, 13.0f, -61.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Dodongo's Cavern map 1
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
3,
{
{ 0, 47.0f, -40.0f },
{ 1, 51.0f, -3.0f },
{ 4, 47.0f, -47.0f },
} },
{ PAUSE_MAP_MARK_BOSS,
23,
sMarkBossVtx,
4,
1,
{
{ -1, 23.0f, -25.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Jabu-Jabu's Belly map 0
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
5,
{
{ 3, 48.0f, -68.0f },
{ 5, 50.0f, -66.0f },
{ 7, 55.0f, -50.0f },
{ 9, 58.0f, 1.0f },
{ 10, 62.0f, -45.0f },
} },
{ PAUSE_MAP_MARK_BOSS,
23,
sMarkBossVtx,
4,
1,
{
{ -1, 65.0f, -37.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Jabu-Jabu's Belly map 1
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
6,
{
{ 0, 37.0f, -49.0f },
{ 1, 65.0f, -38.0f },
{ 2, 52.0f, -48.0f },
{ 4, 46.0f, -36.0f },
{ 6, 59.0f, -41.0f },
{ 8, 52.0f, -26.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Forest Temple map 0
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
6,
{
{ 3, 53.0f, -64.0f },
{ 5, 65.0f, -9.0f },
{ 12, 49.0f, -1.0f },
{ 13, 40.0f, 0.0f },
{ 14, 18.0f, -2.0f },
{ 15, 59.0f, 0.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Forest Temple map 1
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
4,
{
{ 0, 49.0f, -1.0f },
{ 1, 71.0f, -13.0f },
{ 2, 11.0f, -25.0f },
{ 6, 84.0f, -16.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Forest Temple map 2
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
1,
{
{ 9, 65.0f, -30.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Forest Temple map 3
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
1,
{
{ 11, 41.0f, -24.0f },
} },
{ PAUSE_MAP_MARK_BOSS,
23,
sMarkBossVtx,
4,
1,
{
{ -1, 50.0f, -11.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Fire Temple map 0
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
1,
{
{ 5, 24.0f, -40.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Fire Temple map 1
{
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Fire Temple map 2
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
3,
{
{ 3, 75.0f, -47.0f },
{ 6, 72.0f, -51.0f },
{ 8, 65.0f, -12.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Fire Temple map 3
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
1,
{
{ 11, 78.0f, -35.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Fire Temple map 4
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
5,
{
{ 1, 67.0f, -58.0f },
{ 2, 48.0f, -30.0f },
{ 4, 63.0f, -14.0f },
{ 7, 36.0f, -45.0f },
{ 12, 47.0f, -26.0f },
} },
{ PAUSE_MAP_MARK_BOSS,
23,
sMarkBossVtx,
4,
1,
{
{ -1, 26.0f, -34.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Water Temple map 0
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
1,
{
{ 2, 88.0f, -60.0f },
} },
{ PAUSE_MAP_MARK_BOSS,
23,
sMarkBossVtx,
4,
1,
{
{ -1, 62.0f, -23.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Water Temple map 1
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
1,
{
{ 0, 88.0f, -60.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Water Temple map 2
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
2,
{
{ 1, 88.0f, -60.0f },
{ 5, 49.0f, -43.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Water Temple map 3
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
1,
{
{ 6, 75.0f, -65.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Spirit Temple map 0
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
1,
{
{ 18, 46.0f, -30.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Spirit Temple map 1
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
5,
{
{ 1, 23.0f, -33.0f },
{ 2, 56.0f, -11.0f },
{ 5, 83.0f, -25.0f },
{ 24, 84.0f, -39.0f },
{ 25, 74.0f, -37.0f },
} },
{ PAUSE_MAP_MARK_BOSS,
23,
sMarkBossVtx,
4,
1,
{
{ -1, 47.0f, 0.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Spirit Temple map 2
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
5,
{
{ 3, 46.0f, -20.0f },
{ 6, 28.0f, -19.0f },
{ 12, 25.0f, -25.0f },
{ 15, 50.0f, -13.0f },
{ 28, 48.0f, -29.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Spirit Temple map 3
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
9,
{
{ 0, 14.0f, -24.0f },
{ 4, 55.0f, -14.0f },
{ 7, 78.0f, -2.0f },
{ 8, 14.0f, -16.0f },
{ 26, 42.0f, -43.0f },
{ 27, 50.0f, -43.0f },
{ 29, 25.0f, -35.0f },
{ 30, 42.0f, -36.0f },
{ 31, 50.0f, -36.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Shadow Temple map 0
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
2,
{
{ 1, 41.0f, -17.0f },
{ 7, 27.0f, -24.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Shadow Temple map 1
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
2,
{
{ 2, 81.0f, -20.0f },
{ 3, 74.0f, -37.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Shadow Temple map 2
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
2,
{
{ 12, 96.0f, -51.0f },
{ 16, 46.0f, -42.0f },
{ 22, 96.0f, -55.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Shadow Temple map 3
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
12,
{
{ 4, 43.0f, -66.0f },
{ 5, 37.0f, -66.0f },
{ 6, 33.0f, -72.0f },
{ 8, 85.0f, -18.0f },
{ 9, 61.0f, -42.0f },
{ 10, 15.0f, -4.0f },
{ 11, 25.0f, -4.0f },
{ 13, 19.0f, -29.0f },
{ 14, 78.0f, -15.0f },
{ 15, 60.0f, -70.0f },
{ 21, 92.0f, -29.0f },
{ 20, 87.0f, -20.0f },
} },
{ PAUSE_MAP_MARK_BOSS,
23,
sMarkBossVtx,
4,
1,
{
{ -1, 31.0f, -45.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Bottom of the Well map 0
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
2,
{
{ 2, 84.0f, -38.0f },
{ 3, 57.0f, -18.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Bottom of the Well map 1
{
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Bottom of the Well map 2
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
1,
{
{ 1, 72.0f, -32.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
// Ice Cavern map 0
{
{ PAUSE_MAP_MARK_CHEST,
23,
sMarkChestVtx,
4,
3,
{
{ 0, 66.0f, -2.0f },
{ 1, 77.0f, -46.0f },
{ 2, 27.0f, -45.0f },
} },
{ PAUSE_MAP_MARK_NONE, 0, NULL, 0, 0, { 0 } },
},
};

View file

@ -275,13 +275,13 @@ void Select_UpdateMenu(SelectContext* this) {
this->unk_224 = 0x14;
this->unk_22C = 1;
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->unk_220 = SREG(30);
this->unk_220 = R_UPDATE_RATE;
}
}
if (CHECK_BTN_ALL(controller1->cur.button, BTN_DUP) && this->unk_224 == 0) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->unk_220 = SREG(30) * 3;
this->unk_220 = R_UPDATE_RATE * 3;
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_DDOWN)) {
@ -292,24 +292,24 @@ void Select_UpdateMenu(SelectContext* this) {
this->unk_228 = 0x14;
this->unk_230 = 1;
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->unk_220 = -SREG(30);
this->unk_220 = -R_UPDATE_RATE;
}
}
if (CHECK_BTN_ALL(controller1->cur.button, BTN_DDOWN) && (this->unk_228 == 0)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->unk_220 = -SREG(30) * 3;
this->unk_220 = -R_UPDATE_RATE * 3;
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_DLEFT) || CHECK_BTN_ALL(controller1->cur.button, BTN_DLEFT)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->unk_220 = SREG(30);
this->unk_220 = R_UPDATE_RATE;
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_DRIGHT) ||
CHECK_BTN_ALL(controller1->cur.button, BTN_DRIGHT)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->unk_220 = -SREG(30);
this->unk_220 = -R_UPDATE_RATE;
}
}
@ -616,7 +616,7 @@ void Select_Init(GameState* thisx) {
this->unk_20C = dREG(81);
this->unk_1DC = dREG(82);
}
SREG(30) = 1;
R_UPDATE_RATE = 1;
this->staticSegment = GameState_Alloc(&this->state, size, "../z_select.c", 1114);
DmaMgr_SendRequest1(this->staticSegment, _z_select_staticSegmentRomStart, size, "../z_select.c", 1115);

View file

@ -40,24 +40,20 @@ void Title_Calc(TitleContext* this) {
}
void Title_SetupView(TitleContext* this, f32 x, f32 y, f32 z) {
View* view;
Vec3f v1;
Vec3f v2;
Vec3f v3;
View* view = &this->view;
Vec3f eye;
Vec3f lookAt;
Vec3f up;
view = &this->view;
v3.z = 0;
v3.x = 0;
v2.z = 0;
v2.y = 0;
v2.x = 0;
v1.x = x;
v1.y = y;
v1.z = z;
v3.y = 1.0;
eye.x = x;
eye.y = y;
eye.z = z;
up.x = up.z = 0.0f;
lookAt.x = lookAt.y = lookAt.z = 0.0f;
up.y = 1.0f;
func_800AA460(view, 30.0f, 10.0f, 12800.0f);
func_800AA358(view, &v1, &v2, &v3);
func_800AA358(view, &eye, &lookAt, &up);
func_800AAA50(view, 0xF);
}