diff --git a/src/d/d_menu_cloth.cpp b/src/d/d_menu_cloth.cpp index dfcdebf83..260508c94 100644 --- a/src/d/d_menu_cloth.cpp +++ b/src/d/d_menu_cloth.cpp @@ -325,8 +325,54 @@ void dMCloth_c::setNrmVtx(cXyz* pDst, int x, int y) { } /* 8019A480-8019A65C .text plot__9dMCloth_cFffff */ -void dMCloth_c::plot(float, float, float, float) { +void dMCloth_c::plot(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_0x915e[0], field_0x915e[1], field_0x915e[2]); + GXPosition1x8(iv2); + GXPosition2f32(xPos, yPos); + GXPosition1x16(xNext + y * INNER_SIZE); + GXPosition1x16(xNext + y * INNER_SIZE); + GXPosition3s8(field_0x915e[0], field_0x915e[1], field_0x915e[2]); + GXPosition1x8(iv5); + GXPosition2f32(xPos2, yPos); + } break; + } + + yPos -= yStep; + } + + xPos += xStep; + } } /* 8019A65C-8019A838 .text plot_shadow__9dMCloth_cFffff */ @@ -395,7 +441,7 @@ void dMCloth_c::TevSetting() { /* 8019ABB4-8019AC8C .text ShadowTevSettingMenu__9dMCloth_cFv */ void dMCloth_c::ShadowTevSettingMenu() { - GXSetChanCtrl(GX_COLOR0,true,GX_SRC_REG,GX_SRC_REG,1,GX_DF_CLAMP,GX_AF_NONE); + GXSetChanCtrl(GX_COLOR0, true, GX_SRC_REG, GX_SRC_REG, 1, GX_DF_CLAMP, GX_AF_NONE); GXSetNumTexGens(1); GXSetNumTevStages(1); GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);