diff --git a/include/kaleido.h b/include/kaleido.h index 5e272464b..cae41079e 100644 --- a/include/kaleido.h +++ b/include/kaleido.h @@ -103,8 +103,10 @@ struct PauseContext { /* 0x024E */ u16 equipTargetItem; // "sl_item_no" /* 0x0250 */ u16 equipTargetSlot; // "sl_number" /* 0x0252 */ u16 equipTargetCBtn; - /* 0x0254 */ s16 equipAnimX; - /* 0x0256 */ s16 equipAnimY; + /* 0x0254 */ float equipAnimX; + /* 0x0256 */ float equipAnimY; + float equipAnimStartX; + float equipAnimStartY; /* 0x0258 */ s16 equipAnimAlpha; /* 0x025A */ s16 infoPanelOffsetY; /* 0x025C */ u16 nameDisplayTimer; diff --git a/src/code/z_parameter.cpp b/src/code/z_parameter.cpp index 229ce1a11..8ce615c37 100644 --- a/src/code/z_parameter.cpp +++ b/src/code/z_parameter.cpp @@ -3313,12 +3313,10 @@ void Interface_Draw(GlobalContext* globalCtx) { gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); gSPMatrix(OVERLAY_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); - pauseCtx->cursorVtx[svar3].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = svar2 = pauseCtx->equipAnimX / 10; - pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] = svar2 = - pauseCtx->cursorVtx[svar3].v.ob[0] + WREG(90) / 10; - pauseCtx->cursorVtx[svar3].v.ob[1] = pauseCtx->cursorVtx[17].v.ob[1] = svar2 = pauseCtx->equipAnimY / 10; - pauseCtx->cursorVtx[18].v.ob[1] = pauseCtx->cursorVtx[19].v.ob[1] = svar2 = - pauseCtx->cursorVtx[svar3].v.ob[1] - WREG(90) / 10; + pauseCtx->cursorVtx[svar3].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = svar2 = pauseCtx->equipAnimX; + pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] = svar2 = pauseCtx->cursorVtx[svar3].v.ob[0] + WREG(90) / 10; + pauseCtx->cursorVtx[svar3].v.ob[1] = pauseCtx->cursorVtx[17].v.ob[1] = svar2 = pauseCtx->equipAnimY; + pauseCtx->cursorVtx[18].v.ob[1] = pauseCtx->cursorVtx[19].v.ob[1] = svar2 = pauseCtx->cursorVtx[svar3].v.ob[1] - WREG(90) / 10; if (pauseCtx->equipTargetItem < 0xBF) { // Normal Equip (icon goes from the inventory slot to the C button when equipping it) diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.cpp b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.cpp index ff8968fb1..4f0d47e77 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.cpp +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.cpp @@ -366,8 +366,8 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { 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->equipAnimStartX = pauseCtx->equipAnimX = pauseCtx->itemVtx[index].v.ob[0]; + pauseCtx->equipAnimStartY = pauseCtx->equipAnimY = pauseCtx->itemVtx[index].v.ob[1]; pauseCtx->equipAnimAlpha = 255; sEquipAnimTimer = 0; sEquipState = 3; @@ -493,15 +493,15 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_item.c", 516); } -static s16 sCButtonPosX[] = { 660, 900, 1140 }; -static s16 sCButtonPosY[] = { 1100, 920, 1100 }; +static float sCButtonPosX[] = { 66.0f, 90.0f, 114.0f }; +static float sCButtonPosY[] = { 110.0f, 92.0f, 110.0f }; void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { static s16 D_8082A488 = 0; PauseContext* pauseCtx = &globalCtx->pauseCtx; Vtx* bowItemVtx; - u16 offsetX; - u16 offsetY; + float targetX; + float targetY; if (sEquipState == 0) { pauseCtx->equipAnimAlpha += 14; @@ -530,11 +530,11 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { if (sEquipState == 1) { bowItemVtx = &pauseCtx->itemVtx[12]; - offsetX = (u16)(ABS((s16)pauseCtx->equipAnimX - bowItemVtx->v.ob[0] * 10) / sEquipMoveTimer); - offsetY = (u16)(ABS((s16)pauseCtx->equipAnimY - bowItemVtx->v.ob[1] * 10) / sEquipMoveTimer); + targetX = bowItemVtx->v.ob[0]; + targetY = bowItemVtx->v.ob[1]; } else { - offsetX = (u16)(ABS((s16)pauseCtx->equipAnimX - (sCButtonPosX[pauseCtx->equipTargetCBtn] * gfx_ar_ratio())) / sEquipMoveTimer); - offsetY = (u16)(ABS((s16)pauseCtx->equipAnimY - (sCButtonPosY[pauseCtx->equipTargetCBtn])) / sEquipMoveTimer); + targetX = sCButtonPosX[pauseCtx->equipTargetCBtn] * gfx_ar_ratio(); + targetY = sCButtonPosY[pauseCtx->equipTargetCBtn]; } if ((pauseCtx->equipTargetItem >= 0xBF) && (pauseCtx->equipAnimAlpha < 254)) { @@ -548,34 +548,21 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) { if (sEquipAnimTimer == 0) { WREG(90) -= (s16)(WREG(87) / sEquipMoveTimer); - WREG(87) -= (s16)(WREG(87) / sEquipMoveTimer); + WREG(87) -= (s16)(WREG(87) / sEquipMoveTimer); + + float pos = 1.0f - ((float)sEquipMoveTimer / 10.0f); if (sEquipState == 1) { - if (pauseCtx->equipAnimX >= (pauseCtx->itemVtx[12].v.ob[0] * 10) * gfx_ar_ratio()) { - pauseCtx->equipAnimX -= offsetX; - } else { - pauseCtx->equipAnimX += offsetX; - } - - if (pauseCtx->equipAnimY >= (pauseCtx->itemVtx[12].v.ob[1] * 10)) { - pauseCtx->equipAnimY -= offsetY; - } else { - pauseCtx->equipAnimY += offsetY; - } + targetX = pauseCtx->itemVtx[12].v.ob[0]; + targetY = pauseCtx->itemVtx[12].v.ob[1]; } else { - if (pauseCtx->equipAnimX >= sCButtonPosX[pauseCtx->equipTargetCBtn] * gfx_ar_ratio()) { - pauseCtx->equipAnimX -= offsetX; - } else { - pauseCtx->equipAnimX += offsetX; - } - - if (pauseCtx->equipAnimY >= sCButtonPosY[pauseCtx->equipTargetCBtn]) { - pauseCtx->equipAnimY -= offsetY; - } else { - pauseCtx->equipAnimY += offsetY; - } + targetX = sCButtonPosX[pauseCtx->equipTargetCBtn]; + targetY = sCButtonPosY[pauseCtx->equipTargetCBtn]; } + pauseCtx->equipAnimX = F32_LERP(pauseCtx->equipAnimStartX, GFX_ALIGN_RIGHT_F(targetX), pos); + pauseCtx->equipAnimY = F32_LERP(pauseCtx->equipAnimStartY, targetY, pos); + sEquipMoveTimer--; if (sEquipMoveTimer == 0) {