Fixed crash in uv_update_scroll()

This commit is contained in:
MysterD 2023-11-08 13:48:54 -08:00
parent 0e37e21e4c
commit 728b373dbe
1 changed files with 8 additions and 8 deletions

View File

@ -53,11 +53,11 @@ static void shift_UV_JUMP(s32 vtxIndex, u16 vertcount, s16 speed, u16 bhv, u16 c
if (bhv < SCROLL_UV_X) { if (bhv < SCROLL_UV_X) {
for (i = 0; i < vertcount; i++) { for (i = 0; i < vertcount; i++) {
verts[i]->n.ob[bhv] += speed; verts[i]->n.ob[MIN(bhv, 2)] += speed;
} }
} else { } else {
for (i = 0; i < vertcount; i++) { for (i = 0; i < vertcount; i++) {
verts[i]->n.tc[bhv-SCROLL_UV_X] += speed; verts[i]->n.tc[MIN(bhv-SCROLL_UV_X, 1)] += speed;
} }
} }
} }
@ -80,9 +80,9 @@ static void shift_UV_NORMAL(u32 vtxIndex, u16 vertcount, s16 speed, u16 bhv, u16
for (i = 0; i < vertcount; i++) { for (i = 0; i < vertcount; i++) {
if (correction == 0) { if (correction == 0) {
verts[i]->n.ob[bhv] += speed; verts[i]->n.ob[MIN(bhv, 2)] += speed;
} else { } else {
verts[i]->n.ob[bhv] -= correction; verts[i]->n.ob[MIN(bhv, 2)] -= correction;
} }
} }
} else { } else {
@ -93,9 +93,9 @@ static void shift_UV_NORMAL(u32 vtxIndex, u16 vertcount, s16 speed, u16 bhv, u16
for (i = 0; i < vertcount; i++) { for (i = 0; i < vertcount; i++) {
if (correction == 0) { if (correction == 0) {
verts[i]->n.tc[bhv-SCROLL_UV_X] += speed; verts[i]->n.tc[MIN(bhv-SCROLL_UV_X, 1)] += speed;
} else { } else {
verts[i]->n.tc[bhv-SCROLL_UV_X] -= correction; verts[i]->n.tc[MIN(bhv-SCROLL_UV_X, 1)] -= correction;
} }
} }
} }
@ -115,11 +115,11 @@ static void shift_UV_SINE(u32 vtxIndex, u16 vertcount, s16 speed, u16 bhv, u16 c
if (bhv < SCROLL_UV_X) { if (bhv < SCROLL_UV_X) {
for (i = 0; i < vertcount; i++) { for (i = 0; i < vertcount; i++) {
verts[i]->n.ob[bhv] += sins(verts[0]->n.flag) * speed; verts[i]->n.ob[MIN(bhv, 2)] += sins(verts[0]->n.flag) * speed;
} }
} else { } else {
for (i = 0; i < vertcount; i++) { for (i = 0; i < vertcount; i++) {
verts[i]->n.tc[bhv-SCROLL_UV_X] += (u16) (sins(verts[0]->n.flag) * speed); verts[i]->n.tc[MIN(bhv-SCROLL_UV_X, 1)] += (u16) (sins(verts[0]->n.flag) * speed);
} }
} }
verts[0]->n.flag += cycle * 0x23; verts[0]->n.flag += cycle * 0x23;