diff options
| author | Sonic Dreamcaster <alejandro.asenjo88@gmail.com> | 2025-05-20 21:50:52 -0300 |
|---|---|---|
| committer | Sonic Dreamcaster <alejandro.asenjo88@gmail.com> | 2025-05-20 21:50:52 -0300 |
| commit | a33f296e0f0b55106d5f4744798e00b2fffd7620 (patch) | |
| tree | 1b7904596e2485a3b75a49d04276f0ab747277ad /src/render_objects.c | |
| parent | 64e2a39b446cd358181c0350660e98423d0914f1 (diff) | |
better object interpolation
Diffstat (limited to 'src/render_objects.c')
| -rw-r--r-- | src/render_objects.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/render_objects.c b/src/render_objects.c index e3a5d869d..0bfef1437 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -3449,23 +3449,24 @@ void render_object_snowflakes_particles(void) { gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF); } -struct CloudInterpData { +struct ObjectInterpData { s32 objectIndex; - s16 x; + s16 x, y; }; -struct CloudInterpData prevClouds[OBJECT_LIST_SIZE] = { 0 }; +struct ObjectInterpData prevObject[OBJECT_LIST_SIZE] = { 0 }; void func_800518F8(s32 objectIndex, s16 x, s16 y) { - // Search all recorded clouds for the one we're drawing + // Search all recorded objects for the one we're drawing for (int i = 0; i < OBJECT_LIST_SIZE; i++) { - if (objectIndex == prevClouds[i].objectIndex) { + if (objectIndex == prevObject[i].objectIndex) { // Coincidence! - // Skip drawing the cloud this frame if it warped to the other side of the screen - if (fabs(x - prevClouds[i].x) > SCREEN_WIDTH / 2) { - prevClouds[objectIndex].x = x; - prevClouds[objectIndex].objectIndex = objectIndex; + // Skip drawing the object this frame if it warped to the other side of the screen + if ((fabs(x - prevObject[i].x) > SCREEN_WIDTH / 2) || (fabs(y - prevObject[i].y) > SCREEN_HEIGHT / 2)) { + prevObject[objectIndex].x = x; + prevObject[objectIndex].y = y; + prevObject[objectIndex].objectIndex = objectIndex; return; } } @@ -3490,8 +3491,9 @@ void func_800518F8(s32 objectIndex, s16 x, s16 y) { } // Save current cloud index and x position - prevClouds[objectIndex].x = x; - prevClouds[objectIndex].objectIndex = objectIndex; + prevObject[objectIndex].x = x; + prevObject[objectIndex].y = y; + prevObject[objectIndex].objectIndex = objectIndex; } void func_800519D4(s32 objectIndex, s16 arg1, s16 arg2) { |
