From 02dc9c0b6850a1f1f8a89e73c442afbfb0c5b57c Mon Sep 17 00:00:00 2001 From: Briggs Baltzell Date: Sun, 8 Feb 2026 00:14:59 -0600 Subject: [PATCH] Match `dMCloth_c::plot_shadow` implementation and update parameter names in `plot` and `plot_shadow` declarations. --- include/d/d_menu_cloth.h | 4 ++-- src/d/d_menu_cloth.cpp | 48 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/include/d/d_menu_cloth.h b/include/d/d_menu_cloth.h index b0296ba3a..6104831da 100644 --- a/include/d/d_menu_cloth.h +++ b/include/d/d_menu_cloth.h @@ -26,8 +26,8 @@ public: void init(); void setBackNrm(); void setNrmVtx(cXyz* pDst, int x, int y); - void plot(float, float, float, float); - void plot_shadow(float, float, float, float); + void plot(float xMin, float yMin, float xMax, float yMax); + void plot_shadow(float xMin, float yMin, float xMax, float yMax); void alpha_out(); void TevSettingMenu(); void TevSettingFileSelect(); diff --git a/src/d/d_menu_cloth.cpp b/src/d/d_menu_cloth.cpp index 389cdaabb..29f9f1987 100644 --- a/src/d/d_menu_cloth.cpp +++ b/src/d/d_menu_cloth.cpp @@ -370,8 +370,54 @@ void dMCloth_c::plot(float xMin, float yMin, float xMax, float yMax) { } /* 8019A65C-8019A838 .text plot_shadow__9dMCloth_cFffff */ -void dMCloth_c::plot_shadow(float, float, float, float) { +void dMCloth_c::plot_shadow(float xMin, float yMin, float xMax, float yMax) { /* Nonmatching */ + + f32 xPos = 0.0f; + const f32 xStep = (xMax - xMin) * (1.0f / (f32)(INNER_SIZE - 1)); + const f32 yStep = (yMax - yMin) * (1.0f / (f32)(INNER_SIZE - 1)); + + int x = 0, xNext = 1; + for (x = 0; x < INNER_SIZE - 1; x++, xNext++) { + GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT0, INNER_SIZE * 2); + f32 yPos = yMax; + for (int y = 0; y < INNER_SIZE - 1; y++) { + f32 xPos2 = xPos + xStep; + switch (mClothType) { + case 0: + case 2: { + GXPosition1x16(x + y * INNER_SIZE); + GXPosition1x16(x + y * INNER_SIZE); + GXPosition2f32(xPos, yPos); + GXPosition1x16(xNext + y * INNER_SIZE); + GXPosition1x16(xNext + y * INNER_SIZE); + GXPosition2f32(xPos2, yPos); + } break; + + case 1: { + int iv2, iv3, iv5; + iv5 = (10 - x + y) * 25; + iv2 = iv5 > 0xFF ? 0xFF : iv5; + iv3 = (10 - xNext + y) * 25; + iv5 = iv3 > 0xFF ? 0xFF : iv3; + GXPosition1x16(x + y * INNER_SIZE); + GXPosition1x16(x + y * INNER_SIZE); + GXPosition3s8(field_0x9162.r, field_0x9162.g, field_0x9162.b); + GXPosition1x8(iv2); + GXPosition2f32(xPos, yPos); + GXPosition1x16(xNext + y * INNER_SIZE); + GXPosition1x16(xNext + y * INNER_SIZE); + GXPosition3s8(field_0x9162.r, field_0x9162.g, field_0x9162.b); + GXPosition1x8(iv5); + GXPosition2f32(xPos2, yPos); + } break; + } + + yPos -= yStep; + } + + xPos += xStep; + } } /* 8019A838-8019A844 .text alpha_out__9dMCloth_cFv */