From ae89ec30446ea9874fee2f7a06d76f8eb412d4e6 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 31 Oct 2022 17:35:28 +0100 Subject: [PATCH] some cursorVtx doc --- include/z64.h | 9 ++ src/code/z_parameter.c | 6 +- .../ovl_kaleido_scope/z_kaleido_collect.c | 10 +- .../ovl_kaleido_scope/z_kaleido_equipment.c | 4 +- .../misc/ovl_kaleido_scope/z_kaleido_item.c | 19 ++- .../ovl_kaleido_scope/z_kaleido_map_PAL.c | 12 +- .../misc/ovl_kaleido_scope/z_kaleido_scope.h | 2 +- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 148 ++++++++++-------- 8 files changed, 123 insertions(+), 87 deletions(-) diff --git a/include/z64.h b/include/z64.h index cd2b697d2f..875ba96841 100644 --- a/include/z64.h +++ b/include/z64.h @@ -812,6 +812,15 @@ typedef enum { /* 4 */ PAUSE_BG_PRERENDER_MAX } 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 { /* 0x0000 */ View view; /* 0x0128 */ u8* iconItemSegment; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index f1a4fdc0ad..ac4bbfe76a 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -3325,6 +3325,7 @@ void Interface_Draw(PlayState* play) { gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); 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[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] = pauseCtx->cursorVtx[16].v.ob[0] + WREG(90) / 10; @@ -3335,7 +3336,7 @@ void Interface_Draw(PlayState* play) { if (pauseCtx->equipTargetItem < 0xBF) { // Normal Equip (icon goes from the inventory slot to the C button when equipping it) gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, pauseCtx->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, 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)) { 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] - svar1; 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; } - 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, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index 51bdd3b808..1b08703866 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -273,7 +273,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { } // 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 @@ -341,7 +341,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->cursorSpecialPos = 0; 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, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -363,7 +363,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->cursorSpecialPos = 0; 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, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -418,11 +418,11 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->ocarinaStaff->pos = 0; cursor = pauseCtx->cursorSlot[PAUSE_QUEST]; - KaleidoScope_SetCursorVtx(pauseCtx, cursor * 4, pauseCtx->questVtx); + KaleidoScope_SetCursorPos(pauseCtx, cursor * 4, pauseCtx->questVtx); } } else { cursor = pauseCtx->cursorSlot[PAUSE_QUEST]; - KaleidoScope_SetCursorVtx(pauseCtx, cursor * 4, pauseCtx->questVtx); + KaleidoScope_SetCursorPos(pauseCtx, cursor * 4, pauseCtx->questVtx); } // Draw medallions diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index c3f8096e58..da4da3d380 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -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) && (pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && @@ -506,7 +506,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } 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; sEquipTimer--; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index deeeb80057..07692a3580 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -68,13 +68,20 @@ void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, 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[1] = vtx[index].v.ob[1]; } -void KaleidoScope_SetItemCursorVtx(PauseContext* pauseCtx) { - KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_ITEM] * 4, pauseCtx->itemVtx); +void KaleidoScope_SetItemCursorPos(PauseContext* pauseCtx) { + KaleidoScope_SetCursorPos(pauseCtx, pauseCtx->cursorSlot[PAUSE_ITEM] * 4, pauseCtx->itemVtx); } void KaleidoScope_DrawItemSelect(PlayState* play) { @@ -343,7 +350,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { if (cursorItem != PAUSE_ITEM_NONE) { 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) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { @@ -394,6 +401,8 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { } } } 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[3].v.ob[0] = 0; @@ -409,7 +418,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } 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; } diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c index d3336e5570..1ce0886793 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c @@ -145,7 +145,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx) { 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); + KaleidoScope_SetCursorPos(pauseCtx, j, pauseCtx->mapPageVtx); Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } @@ -176,7 +176,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx) { osSyncPrintf("kscope->cursor_point====%d\n", pauseCtx->cursorPoint[PAUSE_MAP]); 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, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } @@ -198,7 +198,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP]; 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) { 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->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 { pauseCtx->cursorItem[PAUSE_MAP] = gSaveContext.worldMapArea + 0x18; 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->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, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); D_8082A6D4 = 0; @@ -475,7 +475,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) { 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); + KaleidoScope_SetCursorPos(pauseCtx, pauseCtx->cursorSlot[PAUSE_MAP] * 4, pauseCtx->mapPageVtx); Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); D_8082A6D4 = 0; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h index 0354e74dd3..0266732372 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h @@ -58,7 +58,7 @@ s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point); void KaleidoScope_DrawDebugEditor(PlayState* play); void KaleidoScope_DrawPlayerWork(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_UpdateItemEquip(PlayState* play); void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 5cdb21ec61..a212447029 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -597,10 +597,10 @@ u8 gAreaGsFlags[] = { }; static void* sCursorTexs[] = { - gPauseMenuCursorTopLeftTex, - gPauseMenuCursorTopRightTex, - gPauseMenuCursorBottomLeftTex, - gPauseMenuCursorBottomRightTex, + gPauseMenuCursorTopLeftTex, // PAUSE_QUAD_CURSOR_TL + gPauseMenuCursorTopRightTex, // PAUSE_QUAD_CURSOR_TR + gPauseMenuCursorBottomLeftTex, // PAUSE_QUAD_CURSOR_BL + gPauseMenuCursorBottomRightTex, // PAUSE_QUAD_CURSOR_BR }; static s16 sCursorColors[][3] = { @@ -857,6 +857,8 @@ void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex) { s16 i; s16 j; + // Draw PAUSE_QUAD_CURSOR_TL, PAUSE_QUAD_CURSOR_TR, PAUSE_QUAD_CURSOR_BL, PAUSE_QUAD_CURSOR_BR + gDPPipeSync(POLY_OPA_DISP++); gDPSetCombineLERP(POLY_OPA_DISP++, 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); gDPSetEnvColor(POLY_OPA_DISP++, sColor82ABRed_D_8082AB8C, sColor82ABGreen_D_8082AB90, 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) { 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_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.flag = 0; @@ -2566,13 +2568,19 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) { 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[3].v.tc[1] = pauseCtx->cursorVtx[5].v.tc[0] = pauseCtx->cursorVtx[6].v.tc[1] = - pauseCtx->cursorVtx[7].v.tc[0] = pauseCtx->cursorVtx[7].v.tc[1] = pauseCtx->cursorVtx[9].v.tc[0] = - pauseCtx->cursorVtx[10].v.tc[1] = pauseCtx->cursorVtx[11].v.tc[0] = pauseCtx->cursorVtx[11].v.tc[1] = - 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); - + pauseCtx->cursorVtx[3].v.tc[1] + // PAUSE_QUAD_CURSOR_TR + = pauseCtx->cursorVtx[5].v.tc[0] = pauseCtx->cursorVtx[6].v.tc[1] = pauseCtx->cursorVtx[7].v.tc[0] = + pauseCtx->cursorVtx[7].v.tc[1] + // 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[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; - s32 temp1; - s32 temp2; - s32 temp3; - s32 temp4; + s32 tlOffsetX; + s32 tlOffsetY; + s32 rightOffsetX; + s32 bottomOffsetY; if (pauseCtx->cursorSpecialPos == 0) { - temp1 = -1; - temp2 = 1; - temp3 = 14; - temp4 = 14; + tlOffsetX = -1; + tlOffsetY = 1; + rightOffsetX = 14; + bottomOffsetY = 14; if (pauseCtx->pageIndex == PAUSE_MAP) { if (!sInDungeonScene) { - temp1 = -6; - temp2 = 6; - temp3 = 4; - temp4 = 4; + tlOffsetX = -6; + tlOffsetY = 6; + rightOffsetX = 4; + bottomOffsetY = 4; } else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] >= 3) { - temp1 = -6; - temp2 = 5; - temp4 = 7; - temp3 = 19; + tlOffsetX = -6; + tlOffsetY = 5; + bottomOffsetY = 7; + rightOffsetX = 19; } else { - temp1 = -3; - temp2 = 3; - temp3 = 13; - temp4 = 13; + tlOffsetX = -3; + tlOffsetY = 3; + rightOffsetX = 13; + bottomOffsetY = 13; } } else if (pauseCtx->pageIndex == PAUSE_QUEST) { - temp1 = -4; - temp2 = 4; - temp3 = 12; - temp4 = 12; + tlOffsetX = -4; + tlOffsetY = 4; + rightOffsetX = 12; + bottomOffsetY = 12; if (pauseCtx->cursorSlot[pauseCtx->pageIndex] == QUEST_HEART_PIECE) { - temp1 = -2; - temp2 = 2; - temp3 = 32; - temp4 = 32; + tlOffsetX = -2; + tlOffsetY = 2; + rightOffsetX = 32; + bottomOffsetY = 32; } else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] == QUEST_SKULL_TOKEN) { - temp1 = -4; - temp2 = 4; - temp4 = 13; - temp3 = 34; + tlOffsetX = -4; + tlOffsetY = 4; + bottomOffsetY = 13; + rightOffsetX = 34; } else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] < QUEST_SONG_MINUET) { - temp1 = -1; - temp2 = 1; - temp3 = 10; - temp4 = 10; + tlOffsetX = -1; + tlOffsetY = 1; + rightOffsetX = 10; + bottomOffsetY = 10; } else if ((pauseCtx->cursorSlot[pauseCtx->pageIndex] >= QUEST_SONG_MINUET) && (pauseCtx->cursorSlot[pauseCtx->pageIndex] < QUEST_KOKIRI_EMERALD)) { - temp1 = -5; - temp2 = 3; - temp3 = 8; - temp4 = 8; + tlOffsetX = -5; + tlOffsetY = 3; + rightOffsetX = 8; + bottomOffsetY = 8; } } } else { - temp1 = -4; - temp2 = 4; - temp3 = 16; - temp4 = 16; + tlOffsetX = -4; + tlOffsetY = 4; + rightOffsetX = 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[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[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[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; + // PAUSE_QUAD_CURSOR_BL 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[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[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[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; } @@ -3201,7 +3217,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->stickAdjX = input->rel.stick_x; pauseCtx->stickAdjY = input->rel.stick_y; - KaleidoScope_UpdateCursorSize(play); + KaleidoScope_UpdateCursorVtx(play); KaleidoScope_HandlePageToggles(pauseCtx, input); } else if ((pauseCtx->pageIndex == PAUSE_QUEST) && ((pauseCtx->mainState < PAUSE_MAIN_STATE_3 @@ -3209,7 +3225,7 @@ void KaleidoScope_Update(PlayState* play) { ) || (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT))) { - KaleidoScope_UpdateCursorSize(play); + KaleidoScope_UpdateCursorVtx(play); } if (pauseCtx->state == PAUSE_STATE_MAIN) {