Refactor dMCloth_c::plot to improve naming consistency for loop variables and pointer arithmetic.

This commit is contained in:
Briggs Baltzell
2026-02-08 18:58:51 -06:00
parent 4f11e02768
commit 67e6c789e1
+13 -13
View File
@@ -127,24 +127,24 @@ void dMCloth_c::cloth_init() {
/* Nonmatching */
cXyz* pNrm = getNrm();
for (int i = 0; i < INNER_SIZE; i++) {
s16 xAngle = -(i * 3500);
for (int j = 0; j < INNER_SIZE; j++) {
cXyz* pPos = &getPos()[i * INNER_SIZE + j];
pPos->x = cM_ssin(j * 3276.8f) * 954.9299f + -1500.0f + j * 10.0f * cM_ssin(xAngle);
pPos->y = i * 300.0f + -1500.0f;
pPos->z = (1.0f - cM_scos(j * 3276.8f)) * 716.1974f - 3400.0f + j * -5.0f * cM_scos(xAngle);
for (int y = 0; y < INNER_SIZE; y++) {
s16 yAngle = -(y * 3500);
for (int x = 0; x < INNER_SIZE; x++) {
cXyz* pPos = &getPos()[x + y * INNER_SIZE];
pPos->x = cM_ssin(x * 3276.8f) * 954.9299f + -1500.0f + x * 10.0f * cM_ssin(yAngle);
pPos->y = y * 300.0f + -1500.0f;
pPos->z = (1.0f - cM_scos(x * 3276.8f)) * 716.1974f + -3400.0f + x * -5.0f * cM_scos(yAngle);
cXyz* pOff = &getOffsetVec()[i * INNER_SIZE + j];
pOff->x = cM_scos(j * 3276.8f - 1000.0f) * -320.0f;
cXyz* pOff = &getOffsetVec()[x + y * INNER_SIZE];
pOff->x = cM_scos(x * 3276.8f - 1000.0f) * -320.0f;
pOff->y = 0.0f;
pOff->z = cM_ssin(j * 3276.8f - 1000.0f) * -270.0f;
pOff->z = cM_ssin(x * 3276.8f - 1000.0f) * -270.0f;
}
}
for (int i = 0; i < INNER_SIZE; i++) {
for (int j = 0; j < INNER_SIZE; j++) {
setNrmVtx(pNrm, j, i);
for (int y = 0; y < INNER_SIZE; y++) {
for (int x = 0; x < INNER_SIZE; x++) {
setNrmVtx(pNrm, x, y);
pNrm++;
}
}