From 89df3ed9ff3d8db8e8d5d8970a6ca3559c541edf Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 28 Sep 2024 00:36:10 +0200 Subject: [PATCH] Pause doc: Item page quads (#2238) * Pause doc: Item page quads * format * rm AMMO_{FIRST,MAX,LAST}, _UNITS -> _ONES * add back ITEM_QUAD_AMMO_FIRST (oops) * units -> ones (continued) --- .../misc/ovl_kaleido_scope/z_kaleido_item.c | 78 +++++++++++----- .../misc/ovl_kaleido_scope/z_kaleido_scope.c | 92 +++++++++++++------ .../misc/ovl_kaleido_scope/z_kaleido_scope.h | 55 +++++++++++ 3 files changed, 177 insertions(+), 48 deletions(-) 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 9b62bf51db..980e726424 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -2,8 +2,22 @@ #include "assets/textures/parameter_static/parameter_static.h" u8 gAmmoItems[] = { - ITEM_DEKU_STICK, ITEM_DEKU_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_MAGIC_BEAN, ITEM_NONE, + ITEM_DEKU_STICK, // SLOT_DEKU_STICK + ITEM_DEKU_NUT, // SLOT_DEKU_NUT + ITEM_BOMB, // SLOT_BOMB + ITEM_BOW, // SLOT_BOW + ITEM_NONE, // SLOT_ARROW_FIRE + ITEM_NONE, // SLOT_DINS_FIRE + ITEM_SLINGSHOT, // SLOT_SLINGSHOT + ITEM_NONE, // SLOT_OCARINA + ITEM_BOMBCHU, // SLOT_BOMBCHU + ITEM_NONE, // SLOT_HOOKSHOT + ITEM_NONE, // SLOT_ARROW_ICE + ITEM_NONE, // SLOT_FARORES_WIND + ITEM_NONE, // SLOT_BOOMERANG + ITEM_NONE, // SLOT_LENS_OF_TRUTH + ITEM_MAGIC_BEAN, // SLOT_MAGIC_BEAN + ITEM_NONE, }; static s16 sEquipState = 0; @@ -11,12 +25,28 @@ static s16 sEquipAnimTimer = 0; static s16 sEquipMoveTimer = 10; static s16 sAmmoVtxOffset[] = { - 0, 2, 4, 6, 99, 99, 8, 99, 99, 10, 99, 99, 99, 99, 99, 99, 12, + ITEM_QUAD_AMMO_STICK_TENS - ITEM_QUAD_AMMO_FIRST, // ITEM_DEKU_STICK + ITEM_QUAD_AMMO_NUT_TENS - ITEM_QUAD_AMMO_FIRST, // ITEM_DEKU_NUT + ITEM_QUAD_AMMO_BOMB_TENS - ITEM_QUAD_AMMO_FIRST, // ITEM_BOMB + ITEM_QUAD_AMMO_BOW_TENS - ITEM_QUAD_AMMO_FIRST, // ITEM_BOW + 99, // (ITEM_ARROW_FIRE) + 99, // (ITEM_DINS_FIRE) + ITEM_QUAD_AMMO_SLINGSHOT_TENS - ITEM_QUAD_AMMO_FIRST, // ITEM_SLINGSHOT + 99, // (ITEM_OCARINA_FAIRY) + 99, // (ITEM_OCARINA_OF_TIME) + ITEM_QUAD_AMMO_BOMBCHU_TENS - ITEM_QUAD_AMMO_FIRST, // ITEM_BOMBCHU + 99, // (ITEM_HOOKSHOT) + 99, // (ITEM_LONGSHOT) + 99, // (ITEM_ARROW_ICE) + 99, // (ITEM_FARORES_WIND) + 99, // (ITEM_BOOMERANG) + 99, // (ITEM_LENS) + ITEM_QUAD_AMMO_BEAN_TENS - ITEM_QUAD_AMMO_FIRST, // ITEM_MAGIC_BEAN }; void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, s16 item) { s16 ammo; - s16 i; + s16 ammoTens; OPEN_DISPS(gfxCtx, "../z_kaleido_item.c", 69); @@ -41,23 +71,23 @@ void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, } } - for (i = 0; ammo >= 10; i++) { + for (ammoTens = 0; ammo >= 10; ammoTens++) { ammo -= 10; } gDPPipeSync(POLY_OPA_DISP++); - if (i != 0) { - gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[(sAmmoVtxOffset[item] + 27) * 4], 4, 0); + if (ammoTens != 0) { + gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[(ITEM_QUAD_AMMO_FIRST + sAmmoVtxOffset[item] + 0) * 4], 4, 0); - gDPLoadTextureBlock(POLY_OPA_DISP++, ((u8*)gAmmoDigit0Tex + (8 * 8 * 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); + gDPLoadTextureBlock(POLY_OPA_DISP++, ((u8*)gAmmoDigit0Tex + (8 * 8 * ammoTens)), 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); + gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[(ITEM_QUAD_AMMO_FIRST + sAmmoVtxOffset[item] + 1) * 4], 4, 0); gDPLoadTextureBlock(POLY_OPA_DISP++, ((u8*)gAmmoDigit0Tex + (8 * 8 * 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, @@ -410,7 +440,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { 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) { + for (i = 0, j = ITEM_QUAD_GRID_SELECTED_C_LEFT * 4; i < 3; i++, j += 4) { if (gSaveContext.save.info.equips.buttonItems[i + 1] != ITEM_NONE) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[j], 4, 0); POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, gEquippedItemOutlineTex, 32, 32, 0); @@ -420,7 +450,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { 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) { + for (i = j = 0; i < (ITEM_GRID_ROWS * ITEM_GRID_COLS); i++, j += 4) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); if (gSaveContext.save.info.inventory.items[i] != ITEM_NONE) { @@ -433,28 +463,34 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { magicArrowEffectsB[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 + 0].v.ob[0] - ITEM_GRID_QUAD_ENLARGE_OFFSET; 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[0] + + (ITEM_GRID_QUAD_WIDTH + (ITEM_GRID_QUAD_ENLARGE_OFFSET * 2)); 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 + 0].v.ob[1] + ITEM_GRID_QUAD_ENLARGE_OFFSET; pauseCtx->itemVtx[j + 2].v.ob[1] = pauseCtx->itemVtx[j + 3].v.ob[1] = - pauseCtx->itemVtx[j + 0].v.ob[1] - 32; + pauseCtx->itemVtx[j + 0].v.ob[1] - + (ITEM_GRID_QUAD_HEIGHT + (ITEM_GRID_QUAD_ENLARGE_OFFSET * 2)); } else if (i == cursorSlot) { + // enlarge item under the cursor + 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 + 0].v.ob[0] - ITEM_GRID_QUAD_ENLARGE_OFFSET; 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[0] + + (ITEM_GRID_QUAD_WIDTH + (ITEM_GRID_QUAD_ENLARGE_OFFSET * 2)); 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 + 0].v.ob[1] + ITEM_GRID_QUAD_ENLARGE_OFFSET; pauseCtx->itemVtx[j + 2].v.ob[1] = pauseCtx->itemVtx[j + 3].v.ob[1] = - pauseCtx->itemVtx[j + 0].v.ob[1] - 32; + pauseCtx->itemVtx[j + 0].v.ob[1] - + (ITEM_GRID_QUAD_HEIGHT + (ITEM_GRID_QUAD_ENLARGE_OFFSET * 2)); } } } diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index 83731d5255..8d68f524aa 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -2648,7 +2648,15 @@ s16 KaleidoScope_SetPageVertices(PlayState* play, Vtx* vtx, s16 vtxPage, s16 num return bufI; } -static s16 D_8082B11C[] = { 0, 4, 8, 12, 24, 32, 56 }; +static s16 sItemVtxQuadsWithAmmo[] = { + SLOT_DEKU_STICK * 4, // ITEM_QUAD_AMMO_STICK_ + SLOT_DEKU_NUT * 4, // ITEM_QUAD_AMMO_NUT_ + SLOT_BOMB * 4, // ITEM_QUAD_AMMO_BOMB_ + SLOT_BOW * 4, // ITEM_QUAD_AMMO_BOW_ + SLOT_SLINGSHOT * 4, // ITEM_QUAD_AMMO_SLINGSHOT_ + SLOT_BOMBCHU * 4, // ITEM_QUAD_AMMO_BOMBCHU_ + SLOT_MAGIC_BEAN * 4, // ITEM_QUAD_AMMO_BEAN_ +}; static s16 D_8082B12C[] = { -114, 12, 44, 76 }; @@ -2914,19 +2922,23 @@ void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) { 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->itemVtx = GRAPH_ALLOC(gfxCtx, 164 * sizeof(Vtx)); + pauseCtx->itemVtx = GRAPH_ALLOC(gfxCtx, (ITEM_QUAD_MAX * 4) * sizeof(Vtx)); - for (k = 0, i = 0, y = 58; k < 4; k++, y -= 32) { - for (x = -96, j = 0; j < 6; j++, i += 4, x += 32) { - pauseCtx->itemVtx[i + 0].v.ob[0] = pauseCtx->itemVtx[i + 2].v.ob[0] = x + 2; + // ITEM_QUAD_GRID_FIRST to ITEM_QUAD_GRID_LAST + for (k = 0, i = 0, y = (ITEM_GRID_ROWS * ITEM_GRID_CELL_HEIGHT) / 2 - 6; k < ITEM_GRID_ROWS; + k++, y -= ITEM_GRID_CELL_HEIGHT) { + for (x = 0 - (ITEM_GRID_COLS * ITEM_GRID_CELL_WIDTH) / 2, j = 0; j < ITEM_GRID_COLS; + j++, i += 4, x += ITEM_GRID_CELL_WIDTH) { + pauseCtx->itemVtx[i + 0].v.ob[0] = pauseCtx->itemVtx[i + 2].v.ob[0] = x + ITEM_GRID_QUAD_MARGIN; pauseCtx->itemVtx[i + 1].v.ob[0] = pauseCtx->itemVtx[i + 3].v.ob[0] = - pauseCtx->itemVtx[i + 0].v.ob[0] + 0x1C; + pauseCtx->itemVtx[i + 0].v.ob[0] + ITEM_GRID_QUAD_WIDTH; - pauseCtx->itemVtx[i + 0].v.ob[1] = pauseCtx->itemVtx[i + 1].v.ob[1] = y + pauseCtx->pagesYOrigin1 - 2; + pauseCtx->itemVtx[i + 0].v.ob[1] = pauseCtx->itemVtx[i + 1].v.ob[1] = + y + pauseCtx->pagesYOrigin1 - ITEM_GRID_QUAD_MARGIN; pauseCtx->itemVtx[i + 2].v.ob[1] = pauseCtx->itemVtx[i + 3].v.ob[1] = - pauseCtx->itemVtx[i + 0].v.ob[1] - 0x1C; + pauseCtx->itemVtx[i + 0].v.ob[1] - ITEM_GRID_QUAD_HEIGHT; pauseCtx->itemVtx[i + 0].v.ob[2] = pauseCtx->itemVtx[i + 1].v.ob[2] = pauseCtx->itemVtx[i + 2].v.ob[2] = pauseCtx->itemVtx[i + 3].v.ob[2] = 0; @@ -2938,7 +2950,7 @@ void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->itemVtx[i + 2].v.tc[0] = 0; pauseCtx->itemVtx[i + 1].v.tc[0] = pauseCtx->itemVtx[i + 2].v.tc[1] = pauseCtx->itemVtx[i + 3].v.tc[0] = - pauseCtx->itemVtx[i + 3].v.tc[1] = 0x400; + pauseCtx->itemVtx[i + 3].v.tc[1] = ITEM_GRID_QUAD_TEX_SIZE * (1 << 5); pauseCtx->itemVtx[i + 0].v.cn[0] = pauseCtx->itemVtx[i + 1].v.cn[0] = pauseCtx->itemVtx[i + 2].v.cn[0] = pauseCtx->itemVtx[i + 3].v.cn[0] = pauseCtx->itemVtx[i + 0].v.cn[1] = pauseCtx->itemVtx[i + 1].v.cn[1] = @@ -2951,17 +2963,23 @@ void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) { } } + // ITEM_QUAD_GRID_SELECTED_C_LEFT, ITEM_QUAD_GRID_SELECTED_C_DOWN, ITEM_QUAD_GRID_SELECTED_C_RIGHT + for (j = 1; j < 4; j++, i += 4) { if (gSaveContext.save.info.equips.cButtonSlots[j - 1] != ITEM_NONE) { k = gSaveContext.save.info.equips.cButtonSlots[j - 1] * 4; - pauseCtx->itemVtx[i + 0].v.ob[0] = pauseCtx->itemVtx[i + 2].v.ob[0] = pauseCtx->itemVtx[k].v.ob[0] - 2; + pauseCtx->itemVtx[i + 0].v.ob[0] = pauseCtx->itemVtx[i + 2].v.ob[0] = + pauseCtx->itemVtx[k].v.ob[0] + ITEM_GRID_SELECTED_QUAD_MARGIN; - pauseCtx->itemVtx[i + 1].v.ob[0] = pauseCtx->itemVtx[i + 3].v.ob[0] = pauseCtx->itemVtx[i + 0].v.ob[0] + 32; + pauseCtx->itemVtx[i + 1].v.ob[0] = pauseCtx->itemVtx[i + 3].v.ob[0] = + pauseCtx->itemVtx[i + 0].v.ob[0] + ITEM_GRID_SELECTED_QUAD_WIDTH; - pauseCtx->itemVtx[i + 0].v.ob[1] = pauseCtx->itemVtx[i + 1].v.ob[1] = pauseCtx->itemVtx[k].v.ob[1] + 2; + pauseCtx->itemVtx[i + 0].v.ob[1] = pauseCtx->itemVtx[i + 1].v.ob[1] = + pauseCtx->itemVtx[k].v.ob[1] - ITEM_GRID_SELECTED_QUAD_MARGIN; - pauseCtx->itemVtx[i + 2].v.ob[1] = pauseCtx->itemVtx[i + 3].v.ob[1] = pauseCtx->itemVtx[i + 0].v.ob[1] - 32; + pauseCtx->itemVtx[i + 2].v.ob[1] = pauseCtx->itemVtx[i + 3].v.ob[1] = + pauseCtx->itemVtx[i + 0].v.ob[1] - ITEM_GRID_SELECTED_QUAD_HEIGHT; pauseCtx->itemVtx[i + 0].v.ob[2] = pauseCtx->itemVtx[i + 1].v.ob[2] = pauseCtx->itemVtx[i + 2].v.ob[2] = pauseCtx->itemVtx[i + 3].v.ob[2] = 0; @@ -2973,7 +2991,7 @@ void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->itemVtx[i + 2].v.tc[0] = 0; pauseCtx->itemVtx[i + 1].v.tc[0] = pauseCtx->itemVtx[i + 2].v.tc[1] = pauseCtx->itemVtx[i + 3].v.tc[0] = - pauseCtx->itemVtx[i + 3].v.tc[1] = 0x400; + pauseCtx->itemVtx[i + 3].v.tc[1] = ITEM_GRID_SELECTED_QUAD_TEX_SIZE * (1 << 5); pauseCtx->itemVtx[i + 0].v.cn[0] = pauseCtx->itemVtx[i + 1].v.cn[0] = pauseCtx->itemVtx[i + 2].v.cn[0] = pauseCtx->itemVtx[i + 3].v.cn[0] = pauseCtx->itemVtx[i + 0].v.cn[1] = pauseCtx->itemVtx[i + 1].v.cn[1] = @@ -2984,34 +3002,54 @@ void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->itemVtx[i + 0].v.cn[3] = pauseCtx->itemVtx[i + 1].v.cn[3] = pauseCtx->itemVtx[i + 2].v.cn[3] = pauseCtx->itemVtx[i + 3].v.cn[3] = pauseCtx->alpha; } else { + // No item equipped on the C button, put the quad out of view + pauseCtx->itemVtx[i + 0].v.ob[0] = pauseCtx->itemVtx[i + 2].v.ob[0] = -300; - pauseCtx->itemVtx[i + 1].v.ob[0] = pauseCtx->itemVtx[i + 3].v.ob[0] = pauseCtx->itemVtx[i + 0].v.ob[0] + 32; + pauseCtx->itemVtx[i + 1].v.ob[0] = pauseCtx->itemVtx[i + 3].v.ob[0] = + pauseCtx->itemVtx[i + 0].v.ob[0] + ITEM_GRID_SELECTED_QUAD_WIDTH; pauseCtx->itemVtx[i + 0].v.ob[1] = pauseCtx->itemVtx[i + 1].v.ob[1] = 300; - pauseCtx->itemVtx[i + 2].v.ob[1] = pauseCtx->itemVtx[i + 3].v.ob[1] = pauseCtx->itemVtx[i + 0].v.ob[1] - 32; + pauseCtx->itemVtx[i + 2].v.ob[1] = pauseCtx->itemVtx[i + 3].v.ob[1] = + pauseCtx->itemVtx[i + 0].v.ob[1] - ITEM_GRID_SELECTED_QUAD_HEIGHT; } } - for (i = 108, j = 0; j < 7; j++) { - k = D_8082B11C[j]; + // ITEM_QUAD_AMMO_* - pauseCtx->itemVtx[i + 0].v.ob[0] = pauseCtx->itemVtx[i + 2].v.ob[0] = pauseCtx->itemVtx[k].v.ob[0]; + for (i = ITEM_QUAD_AMMO_FIRST * 4, j = 0; j < 7; j++) { + k = sItemVtxQuadsWithAmmo[j]; - pauseCtx->itemVtx[i + 1].v.ob[0] = pauseCtx->itemVtx[i + 3].v.ob[0] = pauseCtx->itemVtx[i + 0].v.ob[0] + 8; + // tens - pauseCtx->itemVtx[i + 0].v.ob[1] = pauseCtx->itemVtx[i + 1].v.ob[1] = pauseCtx->itemVtx[k].v.ob[1] - 22; + pauseCtx->itemVtx[i + 0].v.ob[0] = pauseCtx->itemVtx[i + 2].v.ob[0] = + pauseCtx->itemVtx[k].v.ob[0] + ITEM_AMMO_TENS_QUAD_OFFSET_X; - pauseCtx->itemVtx[i + 2].v.ob[1] = pauseCtx->itemVtx[i + 3].v.ob[1] = pauseCtx->itemVtx[i + 0].v.ob[1] - 8; + pauseCtx->itemVtx[i + 1].v.ob[0] = pauseCtx->itemVtx[i + 3].v.ob[0] = + pauseCtx->itemVtx[i + 0].v.ob[0] + ITEM_AMMO_DIGIT_QUAD_WIDTH; - pauseCtx->itemVtx[i + 4].v.ob[0] = pauseCtx->itemVtx[i + 6].v.ob[0] = pauseCtx->itemVtx[i + 0].v.ob[0] + 6; + pauseCtx->itemVtx[i + 0].v.ob[1] = pauseCtx->itemVtx[i + 1].v.ob[1] = + pauseCtx->itemVtx[k].v.ob[1] - ITEM_AMMO_TENS_QUAD_OFFSET_Y; - pauseCtx->itemVtx[i + 5].v.ob[0] = pauseCtx->itemVtx[i + 7].v.ob[0] = pauseCtx->itemVtx[i + 4].v.ob[0] + 8; + pauseCtx->itemVtx[i + 2].v.ob[1] = pauseCtx->itemVtx[i + 3].v.ob[1] = + pauseCtx->itemVtx[i + 0].v.ob[1] - ITEM_AMMO_DIGIT_QUAD_HEIGHT; - pauseCtx->itemVtx[i + 4].v.ob[1] = pauseCtx->itemVtx[i + 5].v.ob[1] = pauseCtx->itemVtx[i + 0].v.ob[1]; + // ones - pauseCtx->itemVtx[i + 6].v.ob[1] = pauseCtx->itemVtx[i + 7].v.ob[1] = pauseCtx->itemVtx[i + 4].v.ob[1] - 8; + pauseCtx->itemVtx[i + 4].v.ob[0] = pauseCtx->itemVtx[i + 6].v.ob[0] = + pauseCtx->itemVtx[i + 0].v.ob[0] + ITEM_AMMO_ONES_QUAD_OFFSET_X; + + pauseCtx->itemVtx[i + 5].v.ob[0] = pauseCtx->itemVtx[i + 7].v.ob[0] = + pauseCtx->itemVtx[i + 4].v.ob[0] + ITEM_AMMO_DIGIT_QUAD_WIDTH; + + pauseCtx->itemVtx[i + 4].v.ob[1] = pauseCtx->itemVtx[i + 5].v.ob[1] = + pauseCtx->itemVtx[i + 0].v.ob[1] - ITEM_AMMO_ONES_QUAD_OFFSET_Y; + + pauseCtx->itemVtx[i + 6].v.ob[1] = pauseCtx->itemVtx[i + 7].v.ob[1] = + pauseCtx->itemVtx[i + 4].v.ob[1] - ITEM_AMMO_DIGIT_QUAD_HEIGHT; + + // tens, ones for (k = 0; k < 2; k++, i += 4) { pauseCtx->itemVtx[i + 0].v.ob[2] = pauseCtx->itemVtx[i + 1].v.ob[2] = pauseCtx->itemVtx[i + 2].v.ob[2] = @@ -3024,7 +3062,7 @@ void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->itemVtx[i + 2].v.tc[0] = 0; pauseCtx->itemVtx[i + 1].v.tc[0] = pauseCtx->itemVtx[i + 2].v.tc[1] = pauseCtx->itemVtx[i + 3].v.tc[0] = - pauseCtx->itemVtx[i + 3].v.tc[1] = 0x100; + pauseCtx->itemVtx[i + 3].v.tc[1] = ITEM_AMMO_DIGIT_QUAD_TEX_SIZE * (1 << 5); pauseCtx->itemVtx[i + 0].v.cn[0] = pauseCtx->itemVtx[i + 1].v.cn[0] = pauseCtx->itemVtx[i + 2].v.cn[0] = pauseCtx->itemVtx[i + 3].v.cn[0] = pauseCtx->itemVtx[i + 0].v.cn[1] = pauseCtx->itemVtx[i + 1].v.cn[1] = 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 a7dd165c81..31b2ec48dd 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h @@ -110,6 +110,61 @@ typedef enum PromptQuad { /* 5 */ PROMPT_QUAD_MAX } PromptQuad; +#define ITEM_GRID_ROWS 4 +#define ITEM_GRID_COLS 6 +#define ITEM_GRID_CELL_WIDTH 32 +#define ITEM_GRID_CELL_HEIGHT 32 +#define ITEM_GRID_QUAD_MARGIN 2 +#define ITEM_GRID_QUAD_WIDTH (ITEM_GRID_CELL_WIDTH - (2 * ITEM_GRID_QUAD_MARGIN)) +#define ITEM_GRID_QUAD_HEIGHT (ITEM_GRID_CELL_HEIGHT - (2 * ITEM_GRID_QUAD_MARGIN)) +#define ITEM_GRID_QUAD_TEX_SIZE 32 // both width and height +#define ITEM_GRID_QUAD_ENLARGE_OFFSET 2 + +#define ITEM_GRID_SELECTED_QUAD_MARGIN (-2) +#define ITEM_GRID_SELECTED_QUAD_WIDTH (ITEM_GRID_QUAD_WIDTH - (2 * ITEM_GRID_SELECTED_QUAD_MARGIN)) +#define ITEM_GRID_SELECTED_QUAD_HEIGHT (ITEM_GRID_QUAD_HEIGHT - (2 * ITEM_GRID_SELECTED_QUAD_MARGIN)) +#define ITEM_GRID_SELECTED_QUAD_TEX_SIZE 32 // both width and height + +#define ITEM_AMMO_DIGIT_QUAD_WIDTH 8 +#define ITEM_AMMO_DIGIT_QUAD_HEIGHT 8 +#define ITEM_AMMO_DIGIT_QUAD_TEX_SIZE 8 + +// Relative to the corresponding ITEM_QUAD_GRID_ quad +#define ITEM_AMMO_TENS_QUAD_OFFSET_X 0 +#define ITEM_AMMO_TENS_QUAD_OFFSET_Y 22 + +// Relative to the ammo tens digit +#define ITEM_AMMO_ONES_QUAD_OFFSET_X 6 +#define ITEM_AMMO_ONES_QUAD_OFFSET_Y 0 + +typedef enum ItemQuad { + // 0 to 23 are the ITEM_GRID_ROWS*ITEM_GRID_COLS item grid + // The values follow the `InventorySlot` enum + /* 0 */ ITEM_QUAD_GRID_FIRST, + /* 23 */ ITEM_QUAD_GRID_LAST = ITEM_GRID_ROWS * ITEM_GRID_COLS - 1, + // Markers indicating the currently equipped items + /* 24 */ ITEM_QUAD_GRID_SELECTED_C_LEFT, + /* 25 */ ITEM_QUAD_GRID_SELECTED_C_DOWN, + /* 26 */ ITEM_QUAD_GRID_SELECTED_C_RIGHT, + // Digits for showing ammo count + /* 27 */ ITEM_QUAD_AMMO_FIRST, + /* 27 */ ITEM_QUAD_AMMO_STICK_TENS = ITEM_QUAD_AMMO_FIRST, + /* 28 */ ITEM_QUAD_AMMO_STICK_ONES, + /* 29 */ ITEM_QUAD_AMMO_NUT_TENS, + /* 30 */ ITEM_QUAD_AMMO_NUT_ONES, + /* 31 */ ITEM_QUAD_AMMO_BOMB_TENS, + /* 32 */ ITEM_QUAD_AMMO_BOMB_ONES, + /* 33 */ ITEM_QUAD_AMMO_BOW_TENS, + /* 34 */ ITEM_QUAD_AMMO_BOW_ONES, + /* 35 */ ITEM_QUAD_AMMO_SLINGSHOT_TENS, + /* 36 */ ITEM_QUAD_AMMO_SLINGSHOT_ONES, + /* 37 */ ITEM_QUAD_AMMO_BOMBCHU_TENS, + /* 38 */ ITEM_QUAD_AMMO_BOMBCHU_ONES, + /* 39 */ ITEM_QUAD_AMMO_BEAN_TENS, + /* 40 */ ITEM_QUAD_AMMO_BEAN_ONES, + /* 41 */ ITEM_QUAD_MAX +} ItemQuad; + void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx); s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point); void KaleidoScope_DrawDebugEditor(PlayState* play);