diff --git a/include/functions.h b/include/functions.h index 6ce39d892e..1e9d7b4c81 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1698,15 +1698,13 @@ Vec3f* OLib_Vec3fDiffDegF(Vec3f* dest, Vec3f* a, Vec3f* b); Vec3s* OLib_Vec3fDiffBinAng(Vec3s* dest, Vec3f* a, Vec3f* b); void OLib_DbCameraVec3fDiff(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode); void OLib_DbCameraVec3fSum(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode); -Gfx* func_8010CB80(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); -Gfx* func_8010CD98(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); -// void func_8010CFBC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11, UNK_TYPE2 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14); -// void func_8010D2D4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11); -// void func_8010D480(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11, UNK_TYPE2 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14, UNK_TYPE4 param_15, UNK_TYPE4 param_16); -Gfx* func_8010D7D0(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); -// void func_8010D9F4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11, UNK_TYPE4 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14); -Gfx* func_8010DC58(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, u16 i); -Gfx* func_8010DE38(Gfx* gfx, TexturePtr texture, s32 fmt, s16 textureWidth, s16 textureHeight, u16 point); + +Gfx* Gfx_DrawTexRectRGBA16(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); +Gfx* Gfx_DrawTexRectIA8(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); +Gfx* Gfx_DrawTexRectI8(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); +Gfx* Gfx_DrawTexQuadIA8(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, u16 point); +Gfx* Gfx_DrawTexQuad4b(Gfx* gfx, TexturePtr texture, s32 fmt, s16 textureWidth, s16 textureHeight, u16 point); + // void func_8010E028(void); void Interface_StartTimer(s16 timerId, s16 seconds); void Interface_StartPostmanTimer(s16 seconds, s16 bunnyHoodState); diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index db3cce0bb5..79c50e9211 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -222,27 +222,289 @@ s16 sFinalHoursClockFrameEnvBlue = 0; s16 sFinalHoursClockColorTimer = 15; s16 sFinalHoursClockColorTargetIndex = 0; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010CB80.s") +/** + * Draw a RGBA16 texture on a rectangle + * + * @param gfx the display list pointer + * @param texture + * @param textureWidth texture image width in texels + * @param textureHeight texture image height in texels + * @param rectLeft the x-coordinate of upper-left corner of rectangle + * @param rectTop the y-coordinate of upper-left corner of rectangle + * @param rectWidth rectangle width in texels + * @param rectHeight rectangle height in texels + * @param dsdx the change in s for each change in x (s5.10) + * @param dtdy the change in t for each change in y (s5.10) + * @return Gfx* the display list pointer + */ +Gfx* Gfx_DrawTexRectRGBA16(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, + s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy) { + gDPLoadTextureBlock(gfx++, texture, G_IM_FMT_RGBA, G_IM_SIZ_16b, textureWidth, 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); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010CD98.s") + gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, + G_TX_RENDERTILE, 0, 0, dsdx, dtdy); -Gfx* func_8010CFBC(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, - s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy, s16 r, s16 g, s16 b, s16 a); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010CFBC.s") + return gfx; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010D2D4.s") +/** + * Draw an IA8 texture on a rectangle + * + * @param gfx the display list pointer + * @param texture + * @param textureWidth texture image width in texels + * @param textureHeight texture image height in texels + * @param rectLeft the x-coordinate of upper-left corner of rectangle + * @param rectTop the y-coordinate of upper-left corner of rectangle + * @param rectWidth rectangle width in texels + * @param rectHeight rectangle height in texels + * @param dsdx the change in s for each change in x (s5.10) + * @param dtdy the change in t for each change in y (s5.10) + * @return Gfx* the display list pointer + */ +Gfx* Gfx_DrawTexRectIA8(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, + s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy) { + gDPLoadTextureBlock(gfx++, texture, G_IM_FMT_IA, G_IM_SIZ_8b, textureWidth, 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); -Gfx* func_8010D480(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, - s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy, s16 r, s16 g, s16 b, s16 a, s32 argE, s32 argF); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010D480.s") + gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, + G_TX_RENDERTILE, 0, 0, dsdx, dtdy); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010D7D0.s") + return gfx; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010D9F4.s") +/** + * Draw an IA8 texture on a rectangle with a shadow slightly offset to the bottom-right + * + * @param gfx the display list pointer + * @param texture + * @param textureWidth texture image width in texels + * @param textureHeight texture image height in texels + * @param rectLeft the x-coordinate of upper-left corner of rectangle + * @param rectTop the y-coordinate of upper-left corner of rectangle + * @param rectWidth rectangle width in texels + * @param rectHeight rectangle height in texels + * @param dsdx the change in s for each change in x (s5.10) + * @param dtdy the change in t for each change in y (s5.10) + * @param r texture red + * @param g texture green + * @param b texture blue + * @param a texture alpha + * @return Gfx* the display list pointer + */ +Gfx* Gfx_DrawTexRectIA8_DropShadow(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, + s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy, s16 r, s16 g, s16 b, + s16 a) { + s16 dropShadowAlpha = a; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010DC58.s") + if (a > 100) { + dropShadowAlpha = 100; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010DE38.s") + gDPPipeSync(gfx++); + gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, dropShadowAlpha); + + gDPLoadTextureBlock(gfx++, texture, G_IM_FMT_IA, G_IM_SIZ_8b, textureWidth, 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); + + gSPTextureRectangle(gfx++, (rectLeft + 2) * 4, (rectTop + 2) * 4, (rectLeft + rectWidth + 2) * 4, + (rectTop + rectHeight + 2) * 4, G_TX_RENDERTILE, 0, 0, dsdx, dtdy); + + gDPPipeSync(gfx++); + gDPSetPrimColor(gfx++, 0, 0, r, g, b, a); + + gSPTextureRectangle(gfx++, rectLeft * 4, rectTop * 4, (rectLeft + rectWidth) * 4, (rectTop + rectHeight) * 4, + G_TX_RENDERTILE, 0, 0, dsdx, dtdy); + + return gfx; +} + +/** + * Draw a colored rectangle with a shadow slightly offset to the bottom-right + * + * @param gfx the display list pointer + * @param rectLeft the x-coordinate of upper-left corner of rectangle + * @param rectTop the y-coordinate of upper-left corner of rectangle + * @param rectWidth rectangle width in texels + * @param rectHeight rectangle height in texels + * @param dsdx the change in s for each change in x (s5.10) + * @param dtdy the change in t for each change in y (s5.10) + * @param r // rectangle red + * @param g // rectangle green + * @param b // rectangle blue + * @param a // rectangle alpha + * @return Gfx* the display list pointer + */ +Gfx* Gfx_DrawRect_DropShadow(Gfx* gfx, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy, + s16 r, s16 g, s16 b, s16 a) { + s16 dropShadowAlpha = a; + + if (a > 100) { + dropShadowAlpha = 100; + } + + gDPPipeSync(gfx++); + gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, dropShadowAlpha); + gSPTextureRectangle(gfx++, (rectLeft + 2) * 4, (rectTop + 2) * 4, (rectLeft + rectWidth + 2) * 4, + (rectTop + rectHeight + 2) * 4, G_TX_RENDERTILE, 0, 0, dsdx, dtdy); + + gDPPipeSync(gfx++); + gDPSetPrimColor(gfx++, 0, 0, r, g, b, a); + + gSPTextureRectangle(gfx++, rectLeft * 4, rectTop * 4, (rectLeft + rectWidth) * 4, (rectTop + rectHeight) * 4, + G_TX_RENDERTILE, 0, 0, dsdx, dtdy); + + return gfx; +} + +/** + * Draw an IA8 texture on a rectangle with a shadow slightly offset to the bottom-right with additional texture offsets + * + * @param gfx the display list pointer + * @param texture + * @param textureWidth texture image width in texels + * @param textureHeight texture image height in texels + * @param rectLeft the x-coordinate of upper-left corner of rectangle + * @param rectTop the y-coordinate of upper-left corner of rectangle + * @param rectWidth rectangle width in texels + * @param rectHeight rectangle height in texels + * @param dsdx the change in s for each change in x (s5.10) + * @param dtdy the change in t for each change in y (s5.10) + * @param r // texture red + * @param g // texture green + * @param b // texture blue + * @param a // texture alpha + * @param masks specify the mask for the s axis + * @param rects the texture coordinate s of upper-left corner of rectangle (s10.5) + * @return Gfx* the display list pointer + */ +Gfx* Gfx_DrawTexRectIA8_DropShadowOffset(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, + s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy, + s16 r, s16 g, s16 b, s16 a, s32 masks, s32 rects) { + s16 dropShadowAlpha = a; + + if (a > 100) { + dropShadowAlpha = 100; + } + + gDPPipeSync(gfx++); + gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, dropShadowAlpha); + + gDPLoadTextureBlock(gfx++, texture, G_IM_FMT_IA, G_IM_SIZ_8b, textureWidth, textureHeight, 0, + G_TX_MIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + gSPTextureRectangle(gfx++, (rectLeft + 2) * 4, (rectTop + 2) * 4, (rectLeft + rectWidth + 2) * 4, + (rectTop + rectHeight + 2) * 4, G_TX_RENDERTILE, rects, 0, dsdx, dtdy); + + gDPPipeSync(gfx++); + gDPSetPrimColor(gfx++, 0, 0, r, g, b, a); + + gSPTextureRectangle(gfx++, rectLeft * 4, rectTop * 4, (rectLeft + rectWidth) * 4, (rectTop + rectHeight) * 4, + G_TX_RENDERTILE, rects, 0, dsdx, dtdy); + + return gfx; +} + +/** + * Draw an I8 texture on a rectangle + * + * @param gfx the display list pointer + * @param texture + * @param textureWidth texture image width in texels + * @param textureHeight texture image height in texels + * @param rectLeft the x-coordinate of upper-left corner of rectangle + * @param rectTop the y-coordinate of upper-left corner of rectangle + * @param rectWidth rectangle width in texels + * @param rectHeight rectangle height in texels + * @param dsdx the change in s for each change in x (s5.10) + * @param dtdy the change in t for each change in y (s5.10) + * @return Gfx* the display list pointer + */ +Gfx* Gfx_DrawTexRectI8(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, + s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy) { + gDPLoadTextureBlock(gfx++, texture, G_IM_FMT_I, G_IM_SIZ_8b, textureWidth, 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); + + gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, + G_TX_RENDERTILE, 0, 0, dsdx, dtdy); + + return gfx; +} + +/** + * Draw a 4b texture on a rectangle + * + * @param gfx the display list pointer + * @param texture + * @param fmt texture image format + * @param textureWidth texture image width in texels + * @param textureHeight texture image height in texels + * @param rectLeft the x-coordinate of upper-left corner of rectangle + * @param rectTop the y-coordinate of upper-left corner of rectangle + * @param rectWidth rectangle width in texels + * @param rectHeight rectangle height in texels + * @param cms gives the clamp, wrap, and mirror flag for the s axis + * @param masks specify the mask for the s axis + * @param rects the texture coordinate s of upper-left corner of rectangle (s10.5) + * @param dsdx the change in s for each change in x (s5.10) + * @param dtdy the change in t for each change in y (s5.10) + * @return Gfx* the display list pointer + */ +Gfx* Gfx_DrawTexRect4b(Gfx* gfx, TexturePtr texture, s32 fmt, s16 textureWidth, s16 textureHeight, s16 rectLeft, + s16 rectTop, s16 rectWidth, s16 rectHeight, s32 cms, s32 masks, s32 rects, u16 dsdx, u16 dtdy) { + gDPLoadTextureBlock_4b(gfx++, texture, fmt, textureWidth, textureHeight, 0, cms, G_TX_NOMIRROR | G_TX_WRAP, masks, + G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, + G_TX_RENDERTILE, rects, 0, dsdx, dtdy); + + return gfx; +} + +/** + * Draw an I8 texture on a Quadrangle + * + * @param gfx the display list pointer + * @param texture + * @param textureWidth texture image width in texels + * @param textureHeight texture image height in texels + * @param point index of the first point to draw the Quadrangle + * @return Gfx* the display list pointer + */ +Gfx* Gfx_DrawTexQuadIA8(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, u16 point) { + gDPLoadTextureBlock(gfx++, texture, G_IM_FMT_IA, G_IM_SIZ_8b, textureWidth, 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); + + gSP1Quadrangle(gfx++, point, point + 2, point + 3, point + 1, 0); + + return gfx; +} + +/** + * Draw a 4b texture on a Quadrangle + * + * @param gfx the display list pointer + * @param texture + * @param fmt texture image format + * @param textureWidth texture image width in texels + * @param textureHeight texture image height in texels + * @param point index of the first point to draw the Quadrangle + * @return Gfx* the display list pointer + */ +Gfx* Gfx_DrawTexQuad4b(Gfx* gfx, TexturePtr texture, s32 fmt, s16 textureWidth, s16 textureHeight, u16 point) { + gDPLoadTextureBlock_4b(gfx++, texture, fmt, textureWidth, 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); + + gSP1Quadrangle(gfx++, point, point + 2, point + 3, point + 1, 0); + + return gfx; +} s16 D_801BFA04[] = { -14, -14, -24, -8, -12, -12, -7, -8, -7, -8, -12, 0, @@ -2418,17 +2680,17 @@ void Magic_DrawMeter(PlayState* play) { gDPSetEnvColor(OVERLAY_DISP++, 100, 50, 50, 255); - OVERLAY_DISP = func_8010CFBC(OVERLAY_DISP, gMagicMeterEndTex, 8, 16, 18, magicBarY, 8, 16, 1 << 10, 1 << 10, - sMagicMeterOutlinePrimRed, sMagicMeterOutlinePrimGreen, sMagicMeterOutlinePrimBlue, - interfaceCtx->magicAlpha); - OVERLAY_DISP = - func_8010CFBC(OVERLAY_DISP, gMagicMeterMidTex, 24, 16, 26, magicBarY, ((void)0, gSaveContext.magicCapacity), - 16, 1 << 10, 1 << 10, sMagicMeterOutlinePrimRed, sMagicMeterOutlinePrimGreen, - sMagicMeterOutlinePrimBlue, interfaceCtx->magicAlpha); - OVERLAY_DISP = - func_8010D480(OVERLAY_DISP, gMagicMeterEndTex, 8, 16, ((void)0, gSaveContext.magicCapacity) + 26, magicBarY, - 8, 16, 1 << 10, 1 << 10, sMagicMeterOutlinePrimRed, sMagicMeterOutlinePrimGreen, - sMagicMeterOutlinePrimBlue, interfaceCtx->magicAlpha, 3, 0x100); + OVERLAY_DISP = Gfx_DrawTexRectIA8_DropShadow( + OVERLAY_DISP, gMagicMeterEndTex, 8, 16, 18, magicBarY, 8, 16, 1 << 10, 1 << 10, sMagicMeterOutlinePrimRed, + sMagicMeterOutlinePrimGreen, sMagicMeterOutlinePrimBlue, interfaceCtx->magicAlpha); + OVERLAY_DISP = Gfx_DrawTexRectIA8_DropShadow(OVERLAY_DISP, gMagicMeterMidTex, 24, 16, 26, magicBarY, + ((void)0, gSaveContext.magicCapacity), 16, 1 << 10, 1 << 10, + sMagicMeterOutlinePrimRed, sMagicMeterOutlinePrimGreen, + sMagicMeterOutlinePrimBlue, interfaceCtx->magicAlpha); + OVERLAY_DISP = Gfx_DrawTexRectIA8_DropShadowOffset( + OVERLAY_DISP, gMagicMeterEndTex, 8, 16, ((void)0, gSaveContext.magicCapacity) + 26, magicBarY, 8, 16, + 1 << 10, 1 << 10, sMagicMeterOutlinePrimRed, sMagicMeterOutlinePrimGreen, sMagicMeterOutlinePrimBlue, + interfaceCtx->magicAlpha, 3, 0x100); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, PRIMITIVE, PRIMITIVE, @@ -3034,9 +3296,9 @@ void Interface_DrawTimers(PlayState* play) { gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); - OVERLAY_DISP = - func_8010CD98(OVERLAY_DISP, gTimerClockIconTex, 0x10, 0x10, ((void)0, gSaveContext.timerX[sTimerId]), - ((void)0, gSaveContext.timerY[sTimerId]) + 2, 0x10, 0x10, 1 << 10, 1 << 10); + OVERLAY_DISP = Gfx_DrawTexRectIA8( + OVERLAY_DISP, gTimerClockIconTex, 0x10, 0x10, ((void)0, gSaveContext.timerX[sTimerId]), + ((void)0, gSaveContext.timerY[sTimerId]) + 2, 0x10, 0x10, 1 << 10, 1 << 10); gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); @@ -3083,7 +3345,7 @@ void Interface_DrawTimers(PlayState* play) { if (sPostmanBunnyHoodState == POSTMAN_MINIGAME_BUNNY_HOOD_ON) { // draw sTimerDigits[3] (10s of seconds) to sTimerDigits[6] (100s of milliseconds) for (j = 0; j < 4; j++) { - OVERLAY_DISP = func_8010D7D0( + OVERLAY_DISP = Gfx_DrawTexRectI8( OVERLAY_DISP, ((u8*)gCounterDigit0Tex + (8 * 16 * sTimerDigits[j + 3])), 8, 0x10, ((void)0, gSaveContext.timerX[sTimerId]) + sTimerDigitsOffsetX[j], ((void)0, gSaveContext.timerY[sTimerId]), sTimerDigitsWidth[j], 0xFA, 0x370, 0x370); @@ -3091,7 +3353,7 @@ void Interface_DrawTimers(PlayState* play) { } else { // draw sTimerDigits[3] (10s of seconds) to sTimerDigits[7] (10s of milliseconds) for (j = 0; j < 5; j++) { - OVERLAY_DISP = func_8010D7D0( + OVERLAY_DISP = Gfx_DrawTexRectI8( OVERLAY_DISP, ((u8*)gCounterDigit0Tex + (8 * 16 * sTimerDigits[j + 3])), 8, 0x10, ((void)0, gSaveContext.timerX[sTimerId]) + sTimerDigitsOffsetX[j], ((void)0, gSaveContext.timerY[sTimerId]), sTimerDigitsWidth[j], 0xFA, 0x370, 0x370); @@ -3100,7 +3362,7 @@ void Interface_DrawTimers(PlayState* play) { } else { // draw sTimerDigits[3] (6s of minutes) to sTimerDigits[7] (10s of milliseconds) for (j = 0; j < 8; j++) { - OVERLAY_DISP = func_8010D7D0( + OVERLAY_DISP = Gfx_DrawTexRectI8( OVERLAY_DISP, ((u8*)gCounterDigit0Tex + (8 * 16 * sTimerDigits[j])), 8, 0x10, ((void)0, gSaveContext.timerX[sTimerId]) + sTimerDigitsOffsetX[j], ((void)0, gSaveContext.timerY[sTimerId]), sTimerDigitsWidth[j], 0xFA, 0x370, 0x370); diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c index 92fe82e76d..3d819423c0 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c @@ -64,7 +64,7 @@ s16 sQuestRemainsEnvBlue[] = { #ifdef NON_EQUIVALENT // TODO: is actually NON_MATCHING, update once `z_kaleido_scope_NES.c` is decompiled -// A single small regalloc at the first `func_8010DC58` for the heart piece count (see `gItemIcons`) +// A single small regalloc at the first `Gfx_DrawTexQuadIA8` for the heart piece count (see `gItemIcons`) void KaleidoScope_DrawQuestStatus(PlayState* play) { static s16 sQuestRemainsColorTimer = 20; static s16 sQuestRemainsColorTimerIndex = 0; @@ -337,7 +337,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[j], 4, 0); - POLY_OPA_DISP = func_8010DC58( + POLY_OPA_DISP = Gfx_DrawTexQuadIA8( POLY_OPA_DISP, gItemIcons[(0x7A + ((GET_SAVE_INVENTORY_QUEST_ITEMS & 0xF0000000) >> QUEST_HEART_PIECE_COUNT))], 48, 48, 0); } @@ -387,8 +387,8 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[j], 4, 0); - POLY_OPA_DISP = func_8010DC58(POLY_OPA_DISP, - sOcarinaButtonTextures[sQuestSongPlayedOcarinaButtons[i]], 16, 16, 0); + POLY_OPA_DISP = Gfx_DrawTexQuadIA8( + POLY_OPA_DISP, sOcarinaButtonTextures[sQuestSongPlayedOcarinaButtons[i]], 16, 16, 0); } } } else if (IS_PAUSE_MAIN_STATE_SAVE_PROMPT || (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) { @@ -421,7 +421,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[j], 4, 0); - POLY_OPA_DISP = func_8010DC58( + POLY_OPA_DISP = Gfx_DrawTexQuadIA8( POLY_OPA_DISP, sOcarinaButtonTextures[gOcarinaSongButtons[sp1C8].buttonIndex[k]], 16, 16, 0); } @@ -471,8 +471,8 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[j], 4, 0); - POLY_OPA_DISP = func_8010DC58(POLY_OPA_DISP, - sOcarinaButtonTextures[sQuestSongPlayedOcarinaButtons[k]], 16, 16, 0); + POLY_OPA_DISP = Gfx_DrawTexQuadIA8( + POLY_OPA_DISP, sOcarinaButtonTextures[sQuestSongPlayedOcarinaButtons[k]], 16, 16, 0); } if (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT_INIT) { diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c index 8e69188fb4..d1a358e753 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c @@ -223,13 +223,15 @@ void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, // Draw upper digit if (ammoUpperDigit != 0) { - POLY_OPA_DISP = func_8010CD98(POLY_OPA_DISP, ((u8*)gAmmoDigit0Tex + (8 * 8 * ammoUpperDigit)), 8, 8, - sAmmoRectLeft[ammoIndex], sAmmoRectHeight[ammoIndex], 8, 8, 1 << 10, 1 << 10); + POLY_OPA_DISP = + Gfx_DrawTexRectIA8(POLY_OPA_DISP, ((u8*)gAmmoDigit0Tex + (8 * 8 * ammoUpperDigit)), 8, 8, + sAmmoRectLeft[ammoIndex], sAmmoRectHeight[ammoIndex], 8, 8, 1 << 10, 1 << 10); } // Draw lower digit - POLY_OPA_DISP = func_8010CD98(POLY_OPA_DISP, ((u8*)gAmmoDigit0Tex + (8 * 8 * ammo)), 8, 8, - sAmmoRectLeft[ammoIndex] + 6, sAmmoRectHeight[ammoIndex], 8, 8, 1 << 10, 1 << 10); + POLY_OPA_DISP = + Gfx_DrawTexRectIA8(POLY_OPA_DISP, ((u8*)gAmmoDigit0Tex + (8 * 8 * ammo)), 8, 8, sAmmoRectLeft[ammoIndex] + 6, + sAmmoRectHeight[ammoIndex], 8, 8, 1 << 10, 1 << 10); CLOSE_DISPS(gfxCtx); } @@ -260,7 +262,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { if (GET_CUR_FORM_BTN_ITEM(i + 1) != ITEM_NONE) { if (GET_CUR_FORM_BTN_SLOT(i + 1) < NUM_ITEM_SLOTS) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[j], 4, 0); - POLY_OPA_DISP = func_8010DC58(POLY_OPA_DISP, gEquippedItemOutlineTex, 32, 32, 0); + POLY_OPA_DISP = Gfx_DrawTexQuadIA8(POLY_OPA_DISP, gEquippedItemOutlineTex, 32, 32, 0); } } } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c index e0c82a1bb3..87acfaa6cd 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c @@ -35,8 +35,8 @@ void KaleidoScope_DrawDungeonStrayFairyCount(PlayState* play) { gDPPipeSync(POLY_OPA_DISP++); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 255); - POLY_OPA_DISP = func_8010D7D0(POLY_OPA_DISP, (u8*)gCounterDigit0Tex + (8 * 16 * counterDigits[digitIndex]), 8, - 16, rectLeft + 1, 146, 8, 16, 1 << 10, 1 << 10); + POLY_OPA_DISP = Gfx_DrawTexRectI8(POLY_OPA_DISP, (u8*)gCounterDigit0Tex + (8 * 16 * counterDigits[digitIndex]), + 8, 16, rectLeft + 1, 146, 8, 16, 1 << 10, 1 << 10); gDPPipeSync(POLY_OPA_DISP++); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); @@ -50,7 +50,7 @@ void KaleidoScope_DrawDungeonStrayFairyCount(PlayState* play) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 255); POLY_OPA_DISP = - func_8010D7D0(POLY_OPA_DISP, gStrayFairyMapCounterSlashTex, 8, 16, 107, 146, 8, 16, 1 << 10, 1 << 10); + Gfx_DrawTexRectI8(POLY_OPA_DISP, gStrayFairyMapCounterSlashTex, 8, 16, 107, 146, 8, 16, 1 << 10, 1 << 10); gDPPipeSync(POLY_OPA_DISP++); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); @@ -68,8 +68,8 @@ void KaleidoScope_DrawDungeonStrayFairyCount(PlayState* play) { gDPPipeSync(POLY_OPA_DISP++); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 255); - POLY_OPA_DISP = func_8010D7D0(POLY_OPA_DISP, (u8*)gCounterDigit0Tex + (8 * 16 * counterDigits[digitIndex]), 8, - 16, rectLeft + 1, 146, 8, 16, 1 << 10, 1 << 10); + POLY_OPA_DISP = Gfx_DrawTexRectI8(POLY_OPA_DISP, (u8*)gCounterDigit0Tex + (8 * 16 * counterDigits[digitIndex]), + 8, 16, rectLeft + 1, 146, 8, 16, 1 << 10, 1 << 10); gDPPipeSync(POLY_OPA_DISP++); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); @@ -159,7 +159,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA, G_CC_MODULATEIA); POLY_OPA_DISP = - func_8010DC58(POLY_OPA_DISP, sDungeonTitleTextures[((void)0, gSaveContext.dungeonIndex)], 128, 16, 0); + Gfx_DrawTexQuadIA8(POLY_OPA_DISP, sDungeonTitleTextures[((void)0, gSaveContext.dungeonIndex)], 128, 16, 0); gDPPipeSync(POLY_OPA_DISP++); @@ -224,7 +224,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[76], 4, 0); POLY_OPA_DISP = - func_8010DE38(POLY_OPA_DISP, gStrayFairyGlowingCircleIconTex, G_IM_FMT_I, 32, 24, 0); + Gfx_DrawTexQuad4b(POLY_OPA_DISP, gStrayFairyGlowingCircleIconTex, G_IM_FMT_I, 32, 24, 0); KaleidoScope_SetView(pauseCtx, pauseCtx->eye.x, pauseCtx->eye.y, pauseCtx->eye.z); func_8012C628(play->state.gfxCtx); @@ -275,13 +275,14 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); // Draw Player's face next to the dungeon floor icon currently in. - POLY_OPA_DISP = func_8010CB80(POLY_OPA_DISP, &D_09007500, 16, 16, 62, - sDungeonMapFloorIconPosY[R_REVERSE_FLOOR_INDEX], 16, 16, 1 << 10, 1 << 10); + POLY_OPA_DISP = + Gfx_DrawTexRectRGBA16(POLY_OPA_DISP, &D_09007500, 16, 16, 62, + sDungeonMapFloorIconPosY[R_REVERSE_FLOOR_INDEX], 16, 16, 1 << 10, 1 << 10); if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.dungeonIndex)) { - POLY_OPA_DISP = func_8010CB80(POLY_OPA_DISP, gDungeonMapSkullTex, 16, 16, 108, - sDungeonMapFloorIconPosY[FLOOR_INDEX_MAX - func_80105318()], 16, 16, - 1 << 10, 1 << 10); + POLY_OPA_DISP = Gfx_DrawTexRectRGBA16(POLY_OPA_DISP, gDungeonMapSkullTex, 16, 16, 108, + sDungeonMapFloorIconPosY[FLOOR_INDEX_MAX - func_80105318()], 16, + 16, 1 << 10, 1 << 10); } gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); @@ -645,7 +646,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[60 + n * 4], 4, 0); - POLY_OPA_DISP = func_8010DC58(POLY_OPA_DISP, sCloudTextures[n], D_8082B7F0[n], D_8082B838[n], 0); + POLY_OPA_DISP = Gfx_DrawTexQuadIA8(POLY_OPA_DISP, sCloudTextures[n], D_8082B7F0[n], D_8082B838[n], 0); } } @@ -798,8 +799,8 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); - POLY_OPA_DISP = func_8010CB80(POLY_OPA_DISP, &D_09007500, 16, 16, sWorldMapCursorsRectLeft[n], - sWorldMapCursorsRectTop[n], 16, 16, 1 << 10, 1 << 10); + POLY_OPA_DISP = Gfx_DrawTexRectRGBA16(POLY_OPA_DISP, &D_09007500, 16, 16, sWorldMapCursorsRectLeft[n], + sWorldMapCursorsRectTop[n], 16, 16, 1 << 10, 1 << 10); } } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c index 6e9f17843c..02cb7ce462 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c @@ -208,7 +208,7 @@ void KaleidoScope_DrawMaskSelect(PlayState* play) { if (GET_CUR_FORM_BTN_ITEM(i + 1) != ITEM_NONE) { if (GET_CUR_FORM_BTN_SLOT(i + 1) >= NUM_ITEM_SLOTS) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->maskVtx[j], 4, 0); - POLY_OPA_DISP = func_8010DC58(POLY_OPA_DISP, gEquippedItemOutlineTex, 32, 32, 0); + POLY_OPA_DISP = Gfx_DrawTexQuadIA8(POLY_OPA_DISP, gEquippedItemOutlineTex, 32, 32, 0); } } } diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 17c834003e..94d2bd0599 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2083,15 +2083,15 @@ 0x8010C930:("OLib_Vec3fDiffBinAng",), 0x8010C9C8:("OLib_DbCameraVec3fDiff",), 0x8010CAA0:("OLib_DbCameraVec3fSum",), - 0x8010CB80:("func_8010CB80",), - 0x8010CD98:("func_8010CD98",), - 0x8010CFBC:("func_8010CFBC",), - 0x8010D2D4:("func_8010D2D4",), - 0x8010D480:("func_8010D480",), - 0x8010D7D0:("func_8010D7D0",), - 0x8010D9F4:("func_8010D9F4",), - 0x8010DC58:("func_8010DC58",), - 0x8010DE38:("func_8010DE38",), + 0x8010CB80:("Gfx_DrawTexRectRGBA16",), + 0x8010CD98:("Gfx_DrawTexRectIA8",), + 0x8010CFBC:("Gfx_DrawTexRectIA8_DropShadow",), + 0x8010D2D4:("Gfx_DrawRect_DropShadow",), + 0x8010D480:("Gfx_DrawTexRectIA8_DropShadowOffset",), + 0x8010D7D0:("Gfx_DrawTexRectI8",), + 0x8010D9F4:("Gfx_DrawTexRect4b",), + 0x8010DC58:("Gfx_DrawTexQuadIA8",), + 0x8010DE38:("Gfx_DrawTexQuad4b",), 0x8010E028:("func_8010E028",), 0x8010E968:("Interface_PostmanTimerCallback",), 0x8010E9F0:("Interface_StartTimer",), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 7d6952054b..6b3273c934 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1597,15 +1597,15 @@ asm/non_matchings/code/z_olib/OLib_Vec3fDiffDegF.s,OLib_Vec3fDiffDegF,0x8010C8C8 asm/non_matchings/code/z_olib/OLib_Vec3fDiffBinAng.s,OLib_Vec3fDiffBinAng,0x8010C930,0x26 asm/non_matchings/code/z_olib/OLib_DbCameraVec3fDiff.s,OLib_DbCameraVec3fDiff,0x8010C9C8,0x36 asm/non_matchings/code/z_olib/OLib_DbCameraVec3fSum.s,OLib_DbCameraVec3fSum,0x8010CAA0,0x34 -asm/non_matchings/code/z_parameter/func_8010CB80.s,func_8010CB80,0x8010CB80,0x86 -asm/non_matchings/code/z_parameter/func_8010CD98.s,func_8010CD98,0x8010CD98,0x89 -asm/non_matchings/code/z_parameter/func_8010CFBC.s,func_8010CFBC,0x8010CFBC,0xC6 -asm/non_matchings/code/z_parameter/func_8010D2D4.s,func_8010D2D4,0x8010D2D4,0x6B -asm/non_matchings/code/z_parameter/func_8010D480.s,func_8010D480,0x8010D480,0xD4 -asm/non_matchings/code/z_parameter/func_8010D7D0.s,func_8010D7D0,0x8010D7D0,0x89 -asm/non_matchings/code/z_parameter/func_8010D9F4.s,func_8010D9F4,0x8010D9F4,0x99 -asm/non_matchings/code/z_parameter/func_8010DC58.s,func_8010DC58,0x8010DC58,0x78 -asm/non_matchings/code/z_parameter/func_8010DE38.s,func_8010DE38,0x8010DE38,0x7C +asm/non_matchings/code/z_parameter/Gfx_DrawTexRectRGBA16.s,Gfx_DrawTexRectRGBA16,0x8010CB80,0x86 +asm/non_matchings/code/z_parameter/Gfx_DrawTexRectIA8.s,Gfx_DrawTexRectIA8,0x8010CD98,0x89 +asm/non_matchings/code/z_parameter/Gfx_DrawTexRectIA8_DropShadow.s,Gfx_DrawTexRectIA8_DropShadow,0x8010CFBC,0xC6 +asm/non_matchings/code/z_parameter/Gfx_DrawRect_DropShadow.s,Gfx_DrawRect_DropShadow,0x8010D2D4,0x6B +asm/non_matchings/code/z_parameter/Gfx_DrawTexRectIA8_DropShadowOffset.s,Gfx_DrawTexRectIA8_DropShadowOffset,0x8010D480,0xD4 +asm/non_matchings/code/z_parameter/Gfx_DrawTexRectI8.s,Gfx_DrawTexRectI8,0x8010D7D0,0x89 +asm/non_matchings/code/z_parameter/Gfx_DrawTexRect4b.s,Gfx_DrawTexRect4b,0x8010D9F4,0x99 +asm/non_matchings/code/z_parameter/Gfx_DrawTexQuadIA8.s,Gfx_DrawTexQuadIA8,0x8010DC58,0x78 +asm/non_matchings/code/z_parameter/Gfx_DrawTexQuad4b.s,Gfx_DrawTexQuad4b,0x8010DE38,0x7C asm/non_matchings/code/z_parameter/func_8010E028.s,func_8010E028,0x8010E028,0x250 asm/non_matchings/code/z_parameter/Interface_PostmanTimerCallback.s,Interface_PostmanTimerCallback,0x8010E968,0x22 asm/non_matchings/code/z_parameter/Interface_StartTimer.s,Interface_StartTimer,0x8010E9F0,0x2B