mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2025-04-22 09:10:57 +00:00
Hopefully fix "shooting arrows at Dead Souls" freezing game
For some reason the idMoveableArrow's animator didn't have a modelDef, which caused masterAnimator->GetJointTransform() to return immediately without setting masterAxis or masterOrigin - so they contained garbage data which lead to NaNs which lead to trouble. I check for that issue now to make sure they're initialized, but I'm not 100% sure this is a proper fix - the underlying issue is that this animator has no modelDef. Is that bad? Could it create other issues? No idea.
This commit is contained in:
parent
e2f53b1b01
commit
b651f9dc1d
1 changed files with 7 additions and 2 deletions
|
@ -2321,12 +2321,17 @@ bool idEntity::GetMasterPosition( idVec3 &masterOrigin, idMat3 &masterAxis ) con
|
|||
// if bound to a joint of an animated model
|
||||
if ( bindJoint != INVALID_JOINT ) {
|
||||
masterAnimator = bindMaster->GetAnimator();
|
||||
if ( !masterAnimator ) {
|
||||
// DG: not sure this is the proper solution, but I had idMoveableArrows where
|
||||
// masterAnimator->modelDef was NULL, so masterAnimator->GetJointTransform()
|
||||
// wouldn't do anything and masterOrigin/Axis would remain uninitialized
|
||||
// and eventually spread NaNs all over the place
|
||||
if ( !masterAnimator || !masterAnimator->ModelDef() ) {
|
||||
masterOrigin = vec3_origin;
|
||||
masterAxis = mat3_identity;
|
||||
return false;
|
||||
} else {
|
||||
masterAnimator->GetJointTransform( bindJoint, gameLocal.time, masterOrigin, masterAxis );
|
||||
bool b = masterAnimator->GetJointTransform( bindJoint, gameLocal.time, masterOrigin, masterAxis );
|
||||
assert(b); // DG: this mustn't fail, else masterAxis/Origin remain uninitialized!
|
||||
masterAxis *= bindMaster->renderEntity.axis;
|
||||
masterOrigin = bindMaster->renderEntity.origin + masterOrigin * bindMaster->renderEntity.axis;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue