diff --git a/include/types.h b/include/types.h index 4ebeec86..ae7e2ce6 100644 --- a/include/types.h +++ b/include/types.h @@ -293,6 +293,7 @@ struct MarioBodyState /*0x18*/ Vec3f heldObjLastPosition; /// also known as HOLP /*????*/ Vec3f torsoPos; /*????*/ Vec3f handFootPos[4]; + /*????*/ u32 updateTorsoTime; //u8 padding[4]; }; diff --git a/src/game/mario_misc.c b/src/game/mario_misc.c index cf8b7c2b..cdbaf46e 100644 --- a/src/game/mario_misc.c +++ b/src/game/mario_misc.c @@ -516,6 +516,7 @@ Gfx* geo_mario_tilt_torso(s32 callContext, struct GraphNode* node, Mat4* mtx) { } // update torso position in bodyState get_pos_from_transform_mtx(bodyState->torsoPos, *curTransform, *gCurGraphNodeCamera->matrixPtr); + bodyState->updateTorsoTime = gGlobalTimer; } return NULL; } diff --git a/src/game/object_list_processor.c b/src/game/object_list_processor.c index 56e2a18c..4f8bbb26 100644 --- a/src/game/object_list_processor.c +++ b/src/game/object_list_processor.c @@ -276,9 +276,8 @@ void bhv_mario_update(void) { gMarioState = &gMarioStates[stateIndex]; // sanity check torsoPos, it isn't updated off-screen otherwise - Vec3f torsoDiff = { 0 }; - vec3f_dif(torsoDiff, gMarioState->pos, gMarioState->marioBodyState->torsoPos); - if (vec3f_length(torsoDiff) > 300) { + extern u32 gGlobalTimer; + if (gMarioState->marioBodyState->updateTorsoTime != (gGlobalTimer - 1)) { vec3f_copy(gMarioState->marioBodyState->torsoPos, gMarioState->pos); }