1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-24 00:25:48 +00:00

some cursorVtx doc

This commit is contained in:
Dragorn421 2022-10-31 17:35:28 +01:00
parent 40538e7aea
commit ae89ec3044
No known key found for this signature in database
GPG key ID: 32B53D2D16FC4118
8 changed files with 123 additions and 87 deletions

View file

@ -812,6 +812,15 @@ typedef enum {
/* 4 */ PAUSE_BG_PRERENDER_MAX /* 4 */ PAUSE_BG_PRERENDER_MAX
} PauseBgPreRenderState; } PauseBgPreRenderState;
typedef enum {
/* 0 */ PAUSE_QUAD_CURSOR_TL,
/* 1 */ PAUSE_QUAD_CURSOR_TR,
/* 2 */ PAUSE_QUAD_CURSOR_BL,
/* 3 */ PAUSE_QUAD_CURSOR_BR,
/* 4 */ PAUSE_QUAD_CURSOR_4,
/* 5 */ PAUSE_QUAD_CURSOR_MAX
} PauseCursorQuad;
typedef struct { typedef struct {
/* 0x0000 */ View view; /* 0x0000 */ View view;
/* 0x0128 */ u8* iconItemSegment; /* 0x0128 */ u8* iconItemSegment;

View file

@ -3325,6 +3325,7 @@ void Interface_Draw(PlayState* play) {
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM);
gSPMatrix(OVERLAY_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); gSPMatrix(OVERLAY_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
// PAUSE_QUAD_CURSOR_4
pauseCtx->cursorVtx[16].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = pauseCtx->equipAnimX / 10; pauseCtx->cursorVtx[16].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = pauseCtx->equipAnimX / 10;
pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] = pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] =
pauseCtx->cursorVtx[16].v.ob[0] + WREG(90) / 10; pauseCtx->cursorVtx[16].v.ob[0] + WREG(90) / 10;
@ -3335,7 +3336,7 @@ void Interface_Draw(PlayState* play) {
if (pauseCtx->equipTargetItem < 0xBF) { if (pauseCtx->equipTargetItem < 0xBF) {
// Normal Equip (icon goes from the inventory slot to the C button when equipping it) // Normal Equip (icon goes from the inventory slot to the C button when equipping it)
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, pauseCtx->equipAnimAlpha); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, pauseCtx->equipAnimAlpha);
gSPVertex(OVERLAY_DISP++, &pauseCtx->cursorVtx[16], 4, 0); gSPVertex(OVERLAY_DISP++, &pauseCtx->cursorVtx[PAUSE_QUAD_CURSOR_4 * 4], 4, 0);
gDPLoadTextureBlock(OVERLAY_DISP++, gItemIcons[pauseCtx->equipTargetItem], G_IM_FMT_RGBA, G_IM_SIZ_32b, gDPLoadTextureBlock(OVERLAY_DISP++, gItemIcons[pauseCtx->equipTargetItem], G_IM_FMT_RGBA, G_IM_SIZ_32b,
32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
@ -3348,6 +3349,7 @@ void Interface_Draw(PlayState* play) {
if ((pauseCtx->equipAnimAlpha > 0) && (pauseCtx->equipAnimAlpha < 255)) { if ((pauseCtx->equipAnimAlpha > 0) && (pauseCtx->equipAnimAlpha < 255)) {
svar1 = (pauseCtx->equipAnimAlpha / 8) / 2; svar1 = (pauseCtx->equipAnimAlpha / 8) / 2;
// PAUSE_QUAD_CURSOR_4
pauseCtx->cursorVtx[16].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = pauseCtx->cursorVtx[16].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] =
pauseCtx->cursorVtx[16].v.ob[0] - svar1; pauseCtx->cursorVtx[16].v.ob[0] - svar1;
pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] = pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] =
@ -3358,7 +3360,7 @@ void Interface_Draw(PlayState* play) {
pauseCtx->cursorVtx[16].v.ob[1] - svar1 * 2 - 32; pauseCtx->cursorVtx[16].v.ob[1] - svar1 * 2 - 32;
} }
gSPVertex(OVERLAY_DISP++, &pauseCtx->cursorVtx[16], 4, 0); gSPVertex(OVERLAY_DISP++, &pauseCtx->cursorVtx[PAUSE_QUAD_CURSOR_4 * 4], 4, 0);
gDPLoadTextureBlock(OVERLAY_DISP++, gMagicArrowEquipEffectTex, G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0, gDPLoadTextureBlock(OVERLAY_DISP++, gMagicArrowEquipEffectTex, G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD); G_TX_NOLOD, G_TX_NOLOD);

View file

@ -273,7 +273,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
} }
// Use the appropriate QUEST_MEDALLION_FOREST-QUEST_HEART_PIECE quad (see `KaleidoScope_InitVertices`) // Use the appropriate QUEST_MEDALLION_FOREST-QUEST_HEART_PIECE quad (see `KaleidoScope_InitVertices`)
KaleidoScope_SetCursorVtx(pauseCtx, cursor * 4, pauseCtx->questVtx); KaleidoScope_SetCursorPos(pauseCtx, cursor * 4, pauseCtx->questVtx);
// Handle part of the ocarina songs playback // Handle part of the ocarina songs playback
@ -341,7 +341,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->cursorSpecialPos = 0; pauseCtx->cursorSpecialPos = 0;
cursor = pauseCtx->cursorPoint[PAUSE_QUEST]; cursor = pauseCtx->cursorPoint[PAUSE_QUEST];
KaleidoScope_SetCursorVtx(pauseCtx, cursor * 4, pauseCtx->questVtx); KaleidoScope_SetCursorPos(pauseCtx, cursor * 4, pauseCtx->questVtx);
Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@ -363,7 +363,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->cursorSpecialPos = 0; pauseCtx->cursorSpecialPos = 0;
cursor = pauseCtx->cursorPoint[PAUSE_QUEST]; cursor = pauseCtx->cursorPoint[PAUSE_QUEST];
KaleidoScope_SetCursorVtx(pauseCtx, cursor * 4, pauseCtx->questVtx); KaleidoScope_SetCursorPos(pauseCtx, cursor * 4, pauseCtx->questVtx);
Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@ -418,11 +418,11 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->ocarinaStaff->pos = 0; pauseCtx->ocarinaStaff->pos = 0;
cursor = pauseCtx->cursorSlot[PAUSE_QUEST]; cursor = pauseCtx->cursorSlot[PAUSE_QUEST];
KaleidoScope_SetCursorVtx(pauseCtx, cursor * 4, pauseCtx->questVtx); KaleidoScope_SetCursorPos(pauseCtx, cursor * 4, pauseCtx->questVtx);
} }
} else { } else {
cursor = pauseCtx->cursorSlot[PAUSE_QUEST]; cursor = pauseCtx->cursorSlot[PAUSE_QUEST];
KaleidoScope_SetCursorVtx(pauseCtx, cursor * 4, pauseCtx->questVtx); KaleidoScope_SetCursorPos(pauseCtx, cursor * 4, pauseCtx->questVtx);
} }
// Draw medallions // Draw medallions

View file

@ -462,7 +462,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
} }
} }
KaleidoScope_SetCursorVtx(pauseCtx, cursorSlot * 4, pauseCtx->equipVtx); KaleidoScope_SetCursorPos(pauseCtx, cursorSlot * 4, pauseCtx->equipVtx);
if ((pauseCtx->cursorSpecialPos == 0) && (cursorItem != PAUSE_ITEM_NONE) && if ((pauseCtx->cursorSpecialPos == 0) && (cursorItem != PAUSE_ITEM_NONE) &&
(pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && (pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) &&
@ -506,7 +506,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
} }
} else if ((pauseCtx->mainState == PAUSE_MAIN_STATE_7) && (pauseCtx->pageIndex == PAUSE_EQUIP)) { } else if ((pauseCtx->mainState == PAUSE_MAIN_STATE_7) && (pauseCtx->pageIndex == PAUSE_EQUIP)) {
KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_EQUIP] * 4, pauseCtx->equipVtx); KaleidoScope_SetCursorPos(pauseCtx, pauseCtx->cursorSlot[PAUSE_EQUIP] * 4, pauseCtx->equipVtx);
pauseCtx->cursorColorSet = 8; pauseCtx->cursorColorSet = 8;
sEquipTimer--; sEquipTimer--;

View file

@ -68,13 +68,20 @@ void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx,
CLOSE_DISPS(gfxCtx, "../z_kaleido_item.c", 116); CLOSE_DISPS(gfxCtx, "../z_kaleido_item.c", 116);
} }
void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx) { /**
* Set the cursor to the position of `vtx[index]`.
* The position indicates the cursor's top-left.
*
* @see KaleidoScope_UpdateCursorVtx where this position is used to update all cursor quads.
*/
void KaleidoScope_SetCursorPos(PauseContext* pauseCtx, u16 index, Vtx* vtx) {
// PAUSE_QUAD_CURSOR_TL
pauseCtx->cursorVtx[0].v.ob[0] = vtx[index].v.ob[0]; pauseCtx->cursorVtx[0].v.ob[0] = vtx[index].v.ob[0];
pauseCtx->cursorVtx[0].v.ob[1] = vtx[index].v.ob[1]; pauseCtx->cursorVtx[0].v.ob[1] = vtx[index].v.ob[1];
} }
void KaleidoScope_SetItemCursorVtx(PauseContext* pauseCtx) { void KaleidoScope_SetItemCursorPos(PauseContext* pauseCtx) {
KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_ITEM] * 4, pauseCtx->itemVtx); KaleidoScope_SetCursorPos(pauseCtx, pauseCtx->cursorSlot[PAUSE_ITEM] * 4, pauseCtx->itemVtx);
} }
void KaleidoScope_DrawItemSelect(PlayState* play) { void KaleidoScope_DrawItemSelect(PlayState* play) {
@ -343,7 +350,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
if (cursorItem != PAUSE_ITEM_NONE) { if (cursorItem != PAUSE_ITEM_NONE) {
index = cursorSlot * 4; // required to match? index = cursorSlot * 4; // required to match?
KaleidoScope_SetCursorVtx(pauseCtx, index, pauseCtx->itemVtx); KaleidoScope_SetCursorPos(pauseCtx, index, pauseCtx->itemVtx);
if ((pauseCtx->debugState == 0) && (pauseCtx->state == PAUSE_STATE_MAIN) && if ((pauseCtx->debugState == 0) && (pauseCtx->state == PAUSE_STATE_MAIN) &&
(pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) {
@ -394,6 +401,8 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
} }
} }
} else { } else {
// PAUSE_QUAD_CURSOR_TL
pauseCtx->cursorVtx[0].v.ob[0] = pauseCtx->cursorVtx[2].v.ob[0] = pauseCtx->cursorVtx[1].v.ob[0] = 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[3].v.ob[0] = 0;
@ -409,7 +418,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
} }
} else if ((pauseCtx->mainState == PAUSE_MAIN_STATE_3) && (pauseCtx->pageIndex == PAUSE_ITEM)) { } else if ((pauseCtx->mainState == PAUSE_MAIN_STATE_3) && (pauseCtx->pageIndex == PAUSE_ITEM)) {
KaleidoScope_SetCursorVtx(pauseCtx, cursorSlot * 4, pauseCtx->itemVtx); KaleidoScope_SetCursorPos(pauseCtx, cursorSlot * 4, pauseCtx->itemVtx);
pauseCtx->cursorColorSet = 4; pauseCtx->cursorColorSet = 4;
} }

View file

@ -145,7 +145,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->dungeonMapSlot; pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->dungeonMapSlot;
pauseCtx->cursorX[PAUSE_MAP] = 0; pauseCtx->cursorX[PAUSE_MAP] = 0;
j = 72 + (pauseCtx->cursorSlot[PAUSE_MAP] * 4); j = 72 + (pauseCtx->cursorSlot[PAUSE_MAP] * 4);
KaleidoScope_SetCursorVtx(pauseCtx, j, pauseCtx->mapPageVtx); KaleidoScope_SetCursorPos(pauseCtx, j, pauseCtx->mapPageVtx);
Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
} }
@ -176,7 +176,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx) {
osSyncPrintf("kscope->cursor_point====%d\n", pauseCtx->cursorPoint[PAUSE_MAP]); osSyncPrintf("kscope->cursor_point====%d\n", pauseCtx->cursorPoint[PAUSE_MAP]);
j = 72 + (pauseCtx->cursorSlot[PAUSE_MAP] * 4); j = 72 + (pauseCtx->cursorSlot[PAUSE_MAP] * 4);
KaleidoScope_SetCursorVtx(pauseCtx, j, pauseCtx->mapPageVtx); KaleidoScope_SetCursorPos(pauseCtx, j, pauseCtx->mapPageVtx);
Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
} }
@ -198,7 +198,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP]; pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP];
j = 72 + (pauseCtx->cursorSlot[PAUSE_MAP] * 4); j = 72 + (pauseCtx->cursorSlot[PAUSE_MAP] * 4);
KaleidoScope_SetCursorVtx(pauseCtx, j, pauseCtx->mapPageVtx); KaleidoScope_SetCursorPos(pauseCtx, j, pauseCtx->mapPageVtx);
if (pauseCtx->cursorX[PAUSE_MAP] == 0) { 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] = pauseCtx->mapPageVtx[j + 2].v.ob[0] =
@ -445,7 +445,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP];
pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP] + 0x1F; pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP] + 0x1F;
KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_MAP] * 4, pauseCtx->mapPageVtx); KaleidoScope_SetCursorPos(pauseCtx, pauseCtx->cursorSlot[PAUSE_MAP] * 4, pauseCtx->mapPageVtx);
} else { } else {
pauseCtx->cursorItem[PAUSE_MAP] = gSaveContext.worldMapArea + 0x18; pauseCtx->cursorItem[PAUSE_MAP] = gSaveContext.worldMapArea + 0x18;
if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
@ -459,7 +459,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP];
pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP] + 0x1F; pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP] + 0x1F;
KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_MAP] * 4, pauseCtx->mapPageVtx); KaleidoScope_SetCursorPos(pauseCtx, pauseCtx->cursorSlot[PAUSE_MAP] * 4, pauseCtx->mapPageVtx);
Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
D_8082A6D4 = 0; D_8082A6D4 = 0;
@ -475,7 +475,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP];
pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP] + 0x1F; pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP] + 0x1F;
KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_MAP] * 4, pauseCtx->mapPageVtx); KaleidoScope_SetCursorPos(pauseCtx, pauseCtx->cursorSlot[PAUSE_MAP] * 4, pauseCtx->mapPageVtx);
Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
D_8082A6D4 = 0; D_8082A6D4 = 0;

View file

@ -58,7 +58,7 @@ s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point);
void KaleidoScope_DrawDebugEditor(PlayState* play); void KaleidoScope_DrawDebugEditor(PlayState* play);
void KaleidoScope_DrawPlayerWork(PlayState* play); void KaleidoScope_DrawPlayerWork(PlayState* play);
void KaleidoScope_DrawEquipment(PlayState* play); void KaleidoScope_DrawEquipment(PlayState* play);
void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx); void KaleidoScope_SetCursorPos(PauseContext* pauseCtx, u16 index, Vtx* vtx);
void KaleidoScope_DrawItemSelect(PlayState* play); void KaleidoScope_DrawItemSelect(PlayState* play);
void KaleidoScope_UpdateItemEquip(PlayState* play); void KaleidoScope_UpdateItemEquip(PlayState* play);
void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx); void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx);

View file

@ -597,10 +597,10 @@ u8 gAreaGsFlags[] = {
}; };
static void* sCursorTexs[] = { static void* sCursorTexs[] = {
gPauseMenuCursorTopLeftTex, gPauseMenuCursorTopLeftTex, // PAUSE_QUAD_CURSOR_TL
gPauseMenuCursorTopRightTex, gPauseMenuCursorTopRightTex, // PAUSE_QUAD_CURSOR_TR
gPauseMenuCursorBottomLeftTex, gPauseMenuCursorBottomLeftTex, // PAUSE_QUAD_CURSOR_BL
gPauseMenuCursorBottomRightTex, gPauseMenuCursorBottomRightTex, // PAUSE_QUAD_CURSOR_BR
}; };
static s16 sCursorColors[][3] = { static s16 sCursorColors[][3] = {
@ -857,6 +857,8 @@ void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex) {
s16 i; s16 i;
s16 j; s16 j;
// Draw PAUSE_QUAD_CURSOR_TL, PAUSE_QUAD_CURSOR_TR, PAUSE_QUAD_CURSOR_BL, PAUSE_QUAD_CURSOR_BR
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
@ -865,7 +867,7 @@ void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex) {
sCursorColors[pauseCtx->cursorColorSet >> 2][2], 255); sCursorColors[pauseCtx->cursorColorSet >> 2][2], 255);
gDPSetEnvColor(POLY_OPA_DISP++, sColor82ABRed_D_8082AB8C, sColor82ABGreen_D_8082AB90, gDPSetEnvColor(POLY_OPA_DISP++, sColor82ABRed_D_8082AB8C, sColor82ABGreen_D_8082AB90,
sColor82ABBlue_D_8082AB94, 255); sColor82ABBlue_D_8082AB94, 255);
gSPVertex(POLY_OPA_DISP++, pauseCtx->cursorVtx, 16, 0); gSPVertex(POLY_OPA_DISP++, pauseCtx->cursorVtx, 4 * 4, 0);
for (i = j = 0; i < 4; i++, j += 4) { for (i = j = 0; i < 4; i++, j += 4) {
gDPLoadTextureBlock_4b(POLY_OPA_DISP++, sCursorTexs[i], G_IM_FMT_IA, 16, 16, 0, gDPLoadTextureBlock_4b(POLY_OPA_DISP++, sCursorTexs[i], G_IM_FMT_IA, 16, 16, 0,
@ -2553,9 +2555,9 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) {
func_80823A0C_makeVertices_(play, pauseCtx->questPageVtx, FUNC_80823A0C_USAGE_ARG2_QUEST_PAGE_VTX, func_80823A0C_makeVertices_(play, pauseCtx->questPageVtx, FUNC_80823A0C_USAGE_ARG2_QUEST_PAGE_VTX,
FUNC_80823A0C_ARG3_QUEST_PAGE_VTX); FUNC_80823A0C_ARG3_QUEST_PAGE_VTX);
pauseCtx->cursorVtx = Graph_Alloc(gfxCtx, 20 * sizeof(Vtx)); pauseCtx->cursorVtx = Graph_Alloc(gfxCtx, (PAUSE_QUAD_CURSOR_MAX * 4) * sizeof(Vtx));
for (i = 0; i < 20; i++) { for (i = 0; i < (PAUSE_QUAD_CURSOR_MAX * 4); i++) {
pauseCtx->cursorVtx[i].v.ob[0] = pauseCtx->cursorVtx[i].v.ob[1] = pauseCtx->cursorVtx[i].v.ob[2] = 0; pauseCtx->cursorVtx[i].v.ob[0] = pauseCtx->cursorVtx[i].v.ob[1] = pauseCtx->cursorVtx[i].v.ob[2] = 0;
pauseCtx->cursorVtx[i].v.flag = 0; pauseCtx->cursorVtx[i].v.flag = 0;
@ -2566,13 +2568,19 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->cursorVtx[i].v.cn[3] = 255; pauseCtx->cursorVtx[i].v.cn[3] = 255;
} }
// PAUSE_QUAD_CURSOR_TL
pauseCtx->cursorVtx[1].v.tc[0] = pauseCtx->cursorVtx[2].v.tc[1] = pauseCtx->cursorVtx[3].v.tc[0] = pauseCtx->cursorVtx[1].v.tc[0] = pauseCtx->cursorVtx[2].v.tc[1] = pauseCtx->cursorVtx[3].v.tc[0] =
pauseCtx->cursorVtx[3].v.tc[1] = pauseCtx->cursorVtx[5].v.tc[0] = pauseCtx->cursorVtx[6].v.tc[1] = pauseCtx->cursorVtx[3].v.tc[1]
pauseCtx->cursorVtx[7].v.tc[0] = pauseCtx->cursorVtx[7].v.tc[1] = pauseCtx->cursorVtx[9].v.tc[0] = // PAUSE_QUAD_CURSOR_TR
pauseCtx->cursorVtx[10].v.tc[1] = pauseCtx->cursorVtx[11].v.tc[0] = pauseCtx->cursorVtx[11].v.tc[1] = = pauseCtx->cursorVtx[5].v.tc[0] = pauseCtx->cursorVtx[6].v.tc[1] = pauseCtx->cursorVtx[7].v.tc[0] =
pauseCtx->cursorVtx[13].v.tc[0] = pauseCtx->cursorVtx[14].v.tc[1] = pauseCtx->cursorVtx[7].v.tc[1]
pauseCtx->cursorVtx[15].v.tc[0] = pauseCtx->cursorVtx[15].v.tc[1] = 16 * (1 << 5); // PAUSE_QUAD_CURSOR_BL
= pauseCtx->cursorVtx[9].v.tc[0] = pauseCtx->cursorVtx[10].v.tc[1] = pauseCtx->cursorVtx[11].v.tc[0] =
pauseCtx->cursorVtx[11].v.tc[1]
// PAUSE_QUAD_CURSOR_BR
= pauseCtx->cursorVtx[13].v.tc[0] = pauseCtx->cursorVtx[14].v.tc[1] = pauseCtx->cursorVtx[15].v.tc[0] =
pauseCtx->cursorVtx[15].v.tc[1] = 16 * (1 << 5);
// PAUSE_QUAD_CURSOR_4
pauseCtx->cursorVtx[17].v.tc[0] = pauseCtx->cursorVtx[18].v.tc[1] = pauseCtx->cursorVtx[19].v.tc[0] = pauseCtx->cursorVtx[17].v.tc[0] = pauseCtx->cursorVtx[18].v.tc[1] = pauseCtx->cursorVtx[19].v.tc[0] =
pauseCtx->cursorVtx[19].v.tc[1] = 32 * (1 << 5); pauseCtx->cursorVtx[19].v.tc[1] = 32 * (1 << 5);
@ -3045,88 +3053,96 @@ void KaleidoScope_UpdateOpening(PlayState* play) {
} }
} }
void KaleidoScope_UpdateCursorSize(PlayState* play) { void KaleidoScope_UpdateCursorVtx(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx; PauseContext* pauseCtx = &play->pauseCtx;
s32 temp1; s32 tlOffsetX;
s32 temp2; s32 tlOffsetY;
s32 temp3; s32 rightOffsetX;
s32 temp4; s32 bottomOffsetY;
if (pauseCtx->cursorSpecialPos == 0) { if (pauseCtx->cursorSpecialPos == 0) {
temp1 = -1; tlOffsetX = -1;
temp2 = 1; tlOffsetY = 1;
temp3 = 14; rightOffsetX = 14;
temp4 = 14; bottomOffsetY = 14;
if (pauseCtx->pageIndex == PAUSE_MAP) { if (pauseCtx->pageIndex == PAUSE_MAP) {
if (!sInDungeonScene) { if (!sInDungeonScene) {
temp1 = -6; tlOffsetX = -6;
temp2 = 6; tlOffsetY = 6;
temp3 = 4; rightOffsetX = 4;
temp4 = 4; bottomOffsetY = 4;
} else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] >= 3) { } else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] >= 3) {
temp1 = -6; tlOffsetX = -6;
temp2 = 5; tlOffsetY = 5;
temp4 = 7; bottomOffsetY = 7;
temp3 = 19; rightOffsetX = 19;
} else { } else {
temp1 = -3; tlOffsetX = -3;
temp2 = 3; tlOffsetY = 3;
temp3 = 13; rightOffsetX = 13;
temp4 = 13; bottomOffsetY = 13;
} }
} else if (pauseCtx->pageIndex == PAUSE_QUEST) { } else if (pauseCtx->pageIndex == PAUSE_QUEST) {
temp1 = -4; tlOffsetX = -4;
temp2 = 4; tlOffsetY = 4;
temp3 = 12; rightOffsetX = 12;
temp4 = 12; bottomOffsetY = 12;
if (pauseCtx->cursorSlot[pauseCtx->pageIndex] == QUEST_HEART_PIECE) { if (pauseCtx->cursorSlot[pauseCtx->pageIndex] == QUEST_HEART_PIECE) {
temp1 = -2; tlOffsetX = -2;
temp2 = 2; tlOffsetY = 2;
temp3 = 32; rightOffsetX = 32;
temp4 = 32; bottomOffsetY = 32;
} else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] == QUEST_SKULL_TOKEN) { } else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] == QUEST_SKULL_TOKEN) {
temp1 = -4; tlOffsetX = -4;
temp2 = 4; tlOffsetY = 4;
temp4 = 13; bottomOffsetY = 13;
temp3 = 34; rightOffsetX = 34;
} else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] < QUEST_SONG_MINUET) { } else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] < QUEST_SONG_MINUET) {
temp1 = -1; tlOffsetX = -1;
temp2 = 1; tlOffsetY = 1;
temp3 = 10; rightOffsetX = 10;
temp4 = 10; bottomOffsetY = 10;
} else if ((pauseCtx->cursorSlot[pauseCtx->pageIndex] >= QUEST_SONG_MINUET) && } else if ((pauseCtx->cursorSlot[pauseCtx->pageIndex] >= QUEST_SONG_MINUET) &&
(pauseCtx->cursorSlot[pauseCtx->pageIndex] < QUEST_KOKIRI_EMERALD)) { (pauseCtx->cursorSlot[pauseCtx->pageIndex] < QUEST_KOKIRI_EMERALD)) {
temp1 = -5; tlOffsetX = -5;
temp2 = 3; tlOffsetY = 3;
temp3 = 8; rightOffsetX = 8;
temp4 = 8; bottomOffsetY = 8;
} }
} }
} else { } else {
temp1 = -4; tlOffsetX = -4;
temp2 = 4; tlOffsetY = 4;
temp3 = 16; rightOffsetX = 16;
temp4 = 16; bottomOffsetY = 16;
} }
pauseCtx->cursorVtx[0].v.ob[0] = pauseCtx->cursorVtx[2].v.ob[0] = pauseCtx->cursorVtx[0].v.ob[0] + temp1; // Move the quads according to the offsets set above,
// and the position of the cursor in `pauseCtx->cursorVtx[0].v.ob`
// (see `KaleidoScope_SetCursorPos` and other `PAUSE_QUAD_CURSOR_TL` uses)
// PAUSE_QUAD_CURSOR_TL
pauseCtx->cursorVtx[0].v.ob[0] = pauseCtx->cursorVtx[2].v.ob[0] = pauseCtx->cursorVtx[0].v.ob[0] + tlOffsetX;
pauseCtx->cursorVtx[1].v.ob[0] = pauseCtx->cursorVtx[3].v.ob[0] = pauseCtx->cursorVtx[0].v.ob[0] + 16; pauseCtx->cursorVtx[1].v.ob[0] = pauseCtx->cursorVtx[3].v.ob[0] = pauseCtx->cursorVtx[0].v.ob[0] + 16;
pauseCtx->cursorVtx[0].v.ob[1] = pauseCtx->cursorVtx[1].v.ob[1] = pauseCtx->cursorVtx[0].v.ob[1] + temp2; pauseCtx->cursorVtx[0].v.ob[1] = pauseCtx->cursorVtx[1].v.ob[1] = pauseCtx->cursorVtx[0].v.ob[1] + tlOffsetY;
pauseCtx->cursorVtx[2].v.ob[1] = pauseCtx->cursorVtx[3].v.ob[1] = pauseCtx->cursorVtx[0].v.ob[1] - 16; pauseCtx->cursorVtx[2].v.ob[1] = pauseCtx->cursorVtx[3].v.ob[1] = pauseCtx->cursorVtx[0].v.ob[1] - 16;
pauseCtx->cursorVtx[4].v.ob[0] = pauseCtx->cursorVtx[6].v.ob[0] = pauseCtx->cursorVtx[0].v.ob[0] + temp3; // PAUSE_QUAD_CURSOR_TR
pauseCtx->cursorVtx[4].v.ob[0] = pauseCtx->cursorVtx[6].v.ob[0] = pauseCtx->cursorVtx[0].v.ob[0] + rightOffsetX;
pauseCtx->cursorVtx[5].v.ob[0] = pauseCtx->cursorVtx[7].v.ob[0] = pauseCtx->cursorVtx[4].v.ob[0] + 16; pauseCtx->cursorVtx[5].v.ob[0] = pauseCtx->cursorVtx[7].v.ob[0] = pauseCtx->cursorVtx[4].v.ob[0] + 16;
pauseCtx->cursorVtx[4].v.ob[1] = pauseCtx->cursorVtx[5].v.ob[1] = pauseCtx->cursorVtx[0].v.ob[1]; pauseCtx->cursorVtx[4].v.ob[1] = pauseCtx->cursorVtx[5].v.ob[1] = pauseCtx->cursorVtx[0].v.ob[1];
pauseCtx->cursorVtx[6].v.ob[1] = pauseCtx->cursorVtx[7].v.ob[1] = pauseCtx->cursorVtx[4].v.ob[1] - 16; pauseCtx->cursorVtx[6].v.ob[1] = pauseCtx->cursorVtx[7].v.ob[1] = pauseCtx->cursorVtx[4].v.ob[1] - 16;
// PAUSE_QUAD_CURSOR_BL
pauseCtx->cursorVtx[8].v.ob[0] = pauseCtx->cursorVtx[10].v.ob[0] = pauseCtx->cursorVtx[0].v.ob[0]; pauseCtx->cursorVtx[8].v.ob[0] = pauseCtx->cursorVtx[10].v.ob[0] = pauseCtx->cursorVtx[0].v.ob[0];
pauseCtx->cursorVtx[9].v.ob[0] = pauseCtx->cursorVtx[11].v.ob[0] = pauseCtx->cursorVtx[8].v.ob[0] + 16; pauseCtx->cursorVtx[9].v.ob[0] = pauseCtx->cursorVtx[11].v.ob[0] = pauseCtx->cursorVtx[8].v.ob[0] + 16;
pauseCtx->cursorVtx[8].v.ob[1] = pauseCtx->cursorVtx[9].v.ob[1] = pauseCtx->cursorVtx[0].v.ob[1] - temp4; pauseCtx->cursorVtx[8].v.ob[1] = pauseCtx->cursorVtx[9].v.ob[1] = pauseCtx->cursorVtx[0].v.ob[1] - bottomOffsetY;
pauseCtx->cursorVtx[10].v.ob[1] = pauseCtx->cursorVtx[11].v.ob[1] = pauseCtx->cursorVtx[8].v.ob[1] - 16; pauseCtx->cursorVtx[10].v.ob[1] = pauseCtx->cursorVtx[11].v.ob[1] = pauseCtx->cursorVtx[8].v.ob[1] - 16;
pauseCtx->cursorVtx[12].v.ob[0] = pauseCtx->cursorVtx[14].v.ob[0] = pauseCtx->cursorVtx[0].v.ob[0] + temp3; // PAUSE_QUAD_CURSOR_BR
pauseCtx->cursorVtx[12].v.ob[0] = pauseCtx->cursorVtx[14].v.ob[0] = pauseCtx->cursorVtx[0].v.ob[0] + rightOffsetX;
pauseCtx->cursorVtx[13].v.ob[0] = pauseCtx->cursorVtx[15].v.ob[0] = pauseCtx->cursorVtx[12].v.ob[0] + 16; pauseCtx->cursorVtx[13].v.ob[0] = pauseCtx->cursorVtx[15].v.ob[0] = pauseCtx->cursorVtx[12].v.ob[0] + 16;
pauseCtx->cursorVtx[12].v.ob[1] = pauseCtx->cursorVtx[13].v.ob[1] = pauseCtx->cursorVtx[0].v.ob[1] - temp4; pauseCtx->cursorVtx[12].v.ob[1] = pauseCtx->cursorVtx[13].v.ob[1] = pauseCtx->cursorVtx[0].v.ob[1] - bottomOffsetY;
pauseCtx->cursorVtx[14].v.ob[1] = pauseCtx->cursorVtx[15].v.ob[1] = pauseCtx->cursorVtx[12].v.ob[1] - 16; pauseCtx->cursorVtx[14].v.ob[1] = pauseCtx->cursorVtx[15].v.ob[1] = pauseCtx->cursorVtx[12].v.ob[1] - 16;
} }
@ -3201,7 +3217,7 @@ void KaleidoScope_Update(PlayState* play) {
pauseCtx->stickAdjX = input->rel.stick_x; pauseCtx->stickAdjX = input->rel.stick_x;
pauseCtx->stickAdjY = input->rel.stick_y; pauseCtx->stickAdjY = input->rel.stick_y;
KaleidoScope_UpdateCursorSize(play); KaleidoScope_UpdateCursorVtx(play);
KaleidoScope_HandlePageToggles(pauseCtx, input); KaleidoScope_HandlePageToggles(pauseCtx, input);
} else if ((pauseCtx->pageIndex == PAUSE_QUEST) && } else if ((pauseCtx->pageIndex == PAUSE_QUEST) &&
((pauseCtx->mainState < PAUSE_MAIN_STATE_3 ((pauseCtx->mainState < PAUSE_MAIN_STATE_3
@ -3209,7 +3225,7 @@ void KaleidoScope_Update(PlayState* play) {
) || ) ||
(pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT))) { (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT))) {
KaleidoScope_UpdateCursorSize(play); KaleidoScope_UpdateCursorVtx(play);
} }
if (pauseCtx->state == PAUSE_STATE_MAIN) { if (pauseCtx->state == PAUSE_STATE_MAIN) {