From a33f296e0f0b55106d5f4744798e00b2fffd7620 Mon Sep 17 00:00:00 2001 From: Sonic Dreamcaster Date: Tue, 20 May 2025 21:50:52 -0300 Subject: better object interpolation --- src/render_objects.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/render_objects.c') 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) { -- cgit v1.2.3 From 11e4d2a6a9f727c7dc7262e69a28763e0c818fe5 Mon Sep 17 00:00:00 2001 From: Sonic Dreamcaster Date: Tue, 20 May 2025 21:53:41 -0300 Subject: shift is not needed here --- src/render_objects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/render_objects.c') diff --git a/src/render_objects.c b/src/render_objects.c index e97e9ea1c..3211d0f9b 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -2630,7 +2630,7 @@ void draw_simplified_lap_count(s32 playerId) { void func_8004E800(s32 playerId) { // @port: Tag the transform. - FrameInterpolation_RecordOpenChild("Player place HUD", playerId << 8); + FrameInterpolation_RecordOpenChild("Player place HUD", playerId); if (playerHUD[playerId].unk_81 != 0) { if (playerHUD[playerId].lapCount != 3) { func_8004A384(playerHUD[playerId].rankX + playerHUD[playerId].slideRankX, -- cgit v1.2.3 From 0d6db3ad1ec2235d173142b94a2d8e7f264de3ab Mon Sep 17 00:00:00 2001 From: Sonic Dreamcaster Date: Tue, 20 May 2025 22:44:06 -0300 Subject: comment --- src/render_objects.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/render_objects.c') diff --git a/src/render_objects.c b/src/render_objects.c index 3211d0f9b..515a319f9 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -3514,6 +3514,7 @@ void func_800519D4(s32 objectIndex, s16 arg1, s16 arg2) { } } +// Render clouds void func_80051ABC(s16 arg0, s32 arg1) { s32 var_s0; s32 objectIndex; -- cgit v1.2.3 From 6f61776b910cea30f99edf6d087263fd4ca9a991 Mon Sep 17 00:00:00 2001 From: sitton76 <58642183+sitton76@users.noreply.github.com> Date: Tue, 20 May 2025 22:21:38 -0500 Subject: Changed how shell flames are interpolated. --- src/render_objects.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/render_objects.c') diff --git a/src/render_objects.c b/src/render_objects.c index 3211d0f9b..9492916f7 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -3930,19 +3930,21 @@ void func_8005477C(s32 objectIndex, u8 arg1, Vec3f arg2) { void render_object_smoke_particles(s32 cameraId) { UNUSED s32 stackPadding[2]; Camera* sp54; - s32 var_s0; + s32 i; s32 objectIndex; Object* object; sp54 = &camera1[cameraId]; - FrameInterpolation_RecordOpenChild("SmokeParticles", TAG_OBJECT(sp54)); + gSPDisplayList(gDisplayListHead++, D_0D007AE0); load_texture_block_i8_nomirror(common_texture_particle_smoke[D_80165598], 32, 32); func_8004B72C(255, 255, 255, 255, 255, 255, 255); D_80183E80[0] = 0; D_80183E80[2] = 0x8000; - for (var_s0 = 0; var_s0 < gObjectParticle4_SIZE; var_s0++) { - objectIndex = gObjectParticle4[var_s0]; + for (i = 0; i < gObjectParticle4_SIZE; i++) { + // @port: Tag the transform. + FrameInterpolation_RecordOpenChild("SmokeParticles", (uintptr_t) i); + objectIndex = gObjectParticle4[i]; if (objectIndex != NULL_OBJECT_ID) { object = &gObjectList[objectIndex]; if (object->state >= 2) { @@ -3956,8 +3958,10 @@ void render_object_smoke_particles(s32 cameraId) { } } } + // @port Pop the transform id. + FrameInterpolation_RecordCloseChild(); } - FrameInterpolation_RecordCloseChild(); + } UNUSED void func_800557AC() { -- cgit v1.2.3 From 622795584c1161b4a167575c78f0ff932318ca5f Mon Sep 17 00:00:00 2001 From: sitton76 <58642183+sitton76@users.noreply.github.com> Date: Tue, 20 May 2025 22:44:51 -0500 Subject: Shell flames handled better. --- src/render_objects.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/render_objects.c') diff --git a/src/render_objects.c b/src/render_objects.c index f2fd0a67c..3b6aa44c6 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -3943,11 +3943,11 @@ void render_object_smoke_particles(s32 cameraId) { D_80183E80[0] = 0; D_80183E80[2] = 0x8000; for (i = 0; i < gObjectParticle4_SIZE; i++) { - // @port: Tag the transform. - FrameInterpolation_RecordOpenChild("SmokeParticles", (uintptr_t) i); objectIndex = gObjectParticle4[i]; if (objectIndex != NULL_OBJECT_ID) { object = &gObjectList[objectIndex]; + // @port: Tag the transform. + FrameInterpolation_RecordOpenChild("SmokeParticles", (uintptr_t) object); if (object->state >= 2) { if (object->unk_0D8 == 3) { func_8008A364(objectIndex, cameraId, 0x4000U, 0x00000514); @@ -3958,11 +3958,10 @@ void render_object_smoke_particles(s32 cameraId) { func_8005477C(objectIndex, object->unk_0D8, sp54->pos); } } + // @port Pop the transform id. + FrameInterpolation_RecordCloseChild(); } - // @port Pop the transform id. - FrameInterpolation_RecordCloseChild(); } - } UNUSED void func_800557AC() { -- cgit v1.2.3