mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Improve sanity check for torsoPos (fixes PVP when using non-player-models)
This commit is contained in:
parent
9ab1021f33
commit
5b45e44b81
3 changed files with 4 additions and 3 deletions
|
|
@ -293,6 +293,7 @@ struct MarioBodyState
|
||||||
/*0x18*/ Vec3f heldObjLastPosition; /// also known as HOLP
|
/*0x18*/ Vec3f heldObjLastPosition; /// also known as HOLP
|
||||||
/*????*/ Vec3f torsoPos;
|
/*????*/ Vec3f torsoPos;
|
||||||
/*????*/ Vec3f handFootPos[4];
|
/*????*/ Vec3f handFootPos[4];
|
||||||
|
/*????*/ u32 updateTorsoTime;
|
||||||
//u8 padding[4];
|
//u8 padding[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -516,6 +516,7 @@ Gfx* geo_mario_tilt_torso(s32 callContext, struct GraphNode* node, Mat4* mtx) {
|
||||||
}
|
}
|
||||||
// update torso position in bodyState
|
// update torso position in bodyState
|
||||||
get_pos_from_transform_mtx(bodyState->torsoPos, *curTransform, *gCurGraphNodeCamera->matrixPtr);
|
get_pos_from_transform_mtx(bodyState->torsoPos, *curTransform, *gCurGraphNodeCamera->matrixPtr);
|
||||||
|
bodyState->updateTorsoTime = gGlobalTimer;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -276,9 +276,8 @@ void bhv_mario_update(void) {
|
||||||
gMarioState = &gMarioStates[stateIndex];
|
gMarioState = &gMarioStates[stateIndex];
|
||||||
|
|
||||||
// sanity check torsoPos, it isn't updated off-screen otherwise
|
// sanity check torsoPos, it isn't updated off-screen otherwise
|
||||||
Vec3f torsoDiff = { 0 };
|
extern u32 gGlobalTimer;
|
||||||
vec3f_dif(torsoDiff, gMarioState->pos, gMarioState->marioBodyState->torsoPos);
|
if (gMarioState->marioBodyState->updateTorsoTime != (gGlobalTimer - 1)) {
|
||||||
if (vec3f_length(torsoDiff) > 300) {
|
|
||||||
vec3f_copy(gMarioState->marioBodyState->torsoPos, gMarioState->pos);
|
vec3f_copy(gMarioState->marioBodyState->torsoPos, gMarioState->pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue