Improve sanity check for torsoPos (fixes PVP when using non-player-models)
This commit is contained in:
parent
e1000f32fc
commit
0b48fb139a
|
@ -293,6 +293,7 @@ struct MarioBodyState
|
|||
/*0x18*/ Vec3f heldObjLastPosition; /// also known as HOLP
|
||||
/*????*/ Vec3f torsoPos;
|
||||
/*????*/ Vec3f handFootPos[4];
|
||||
/*????*/ u32 updateTorsoTime;
|
||||
//u8 padding[4];
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue