1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 06:10:21 +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

@ -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 } },
},
};