From ee71f19e6e0af8bdc84c3c4f8203c41a7b7f5e01 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Mon, 5 Apr 2021 04:21:14 +0300 Subject: [PATCH] partially fix jitter with two of the same model --- src/game/mario_misc.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/game/mario_misc.c b/src/game/mario_misc.c index 43f81eb6..5909d1d9 100644 --- a/src/game/mario_misc.c +++ b/src/game/mario_misc.c @@ -405,7 +405,8 @@ Gfx* geo_switch_mario_eyes(s32 callContext, struct GraphNode* node, UNUSED Mat4* Gfx* geo_mario_tilt_torso(s32 callContext, struct GraphNode* node, Mat4* mtx) { Mat4 * curTransform = mtx; struct GraphNodeGenerated* asGenerated = (struct GraphNodeGenerated*) node; - struct MarioBodyState* bodyState = geo_get_body_state(); + u8 plrIdx = geo_get_processing_object_index(); + struct MarioBodyState* bodyState = &gBodyStates[plrIdx]; s32 action = bodyState->action; if (callContext == GEO_CONTEXT_RENDER) { @@ -418,6 +419,11 @@ Gfx* geo_mario_tilt_torso(s32 callContext, struct GraphNode* node, Mat4* mtx) { rotNode->rotation[0] = bodyState->torsoAngle[1]; rotNode->rotation[1] = bodyState->torsoAngle[2]; rotNode->rotation[2] = bodyState->torsoAngle[0]; + if (plrIdx != 0) { + // only interpolate angles for the local player + vec3s_copy(rotNode->prevRotation, rotNode->rotation); + rotNode->prevTimestamp = gGlobalTimer; + } // update torso position in bodyState get_pos_from_transform_mtx(bodyState->torsoPos, *curTransform, *gCurGraphNodeCamera->matrixPtr); } @@ -429,7 +435,8 @@ Gfx* geo_mario_tilt_torso(s32 callContext, struct GraphNode* node, Mat4* mtx) { */ Gfx* geo_mario_head_rotation(s32 callContext, struct GraphNode* node, UNUSED Mat4* c) { struct GraphNodeGenerated* asGenerated = (struct GraphNodeGenerated*) node; - struct MarioBodyState* bodyState = geo_get_body_state(); + u8 plrIdx = geo_get_processing_object_index(); + struct MarioBodyState* bodyState = &gBodyStates[plrIdx]; s32 action = bodyState->action; if (callContext == GEO_CONTEXT_RENDER) { @@ -449,6 +456,12 @@ Gfx* geo_mario_head_rotation(s32 callContext, struct GraphNode* node, UNUSED Mat vec3s_set(bodyState->headAngle, 0, 0, 0); vec3s_set(rotNode->rotation, 0, 0, 0); } + + if (plrIdx != 0) { + // only interpolate angles for the local player + vec3s_copy(rotNode->prevRotation, rotNode->rotation); + rotNode->prevTimestamp = gGlobalTimer; + } } return NULL; }