mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2024-11-21 12:11:07 +00:00
Fix player's clipModel->axis when loading savegame, fixes #328
idClipModel::axis is an idMat3 rotation matrix. Usually it's an identity matrix, but if the player is pushed around by an idPush entity it's modified and apparently can (wrongly) remain modified, possibly when saving while idPush is active. This seems to happen sometimes on the crashing elevator in game/delta1. The fix/workaround is to reset it to mat3_identity when loading a savegame.
This commit is contained in:
parent
983a3c3c37
commit
967815d27e
2 changed files with 28 additions and 0 deletions
|
@ -1626,6 +1626,20 @@ void idPhysics_Player::Restore( idRestoreGame *savefile ) {
|
|||
|
||||
savefile->ReadInt( (int &)waterLevel );
|
||||
savefile->ReadInt( waterType );
|
||||
|
||||
/* DG: It can apparently happen that the player saves while the clipModel's axis are
|
||||
* modified by idPush::TryRotatePushEntity() -> idPhysics_Player::Rotate() -> idClipModel::Link()
|
||||
* Normally idPush seems to reset them to the identity matrix in the next frame,
|
||||
* but apparently not when coming from a savegame.
|
||||
* Usually clipModel->axis is the identity matrix, and if it isn't there's clipping bugs
|
||||
* like CheckGround() reporting that it's steep even though the player is only trying to
|
||||
* walk up normal stairs.
|
||||
* Resetting the axis to mat3_identity when restoring a savegame works around that issue
|
||||
* and makes sure players can go on playing if their savegame was "corrupted" by saving
|
||||
* while idPush was active. See https://github.com/dhewm/dhewm3/issues/328 for more details */
|
||||
if ( clipModel != nullptr ) {
|
||||
clipModel->SetPosition( clipModel->GetOrigin(), mat3_identity );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1626,6 +1626,20 @@ void idPhysics_Player::Restore( idRestoreGame *savefile ) {
|
|||
|
||||
savefile->ReadInt( (int &)waterLevel );
|
||||
savefile->ReadInt( waterType );
|
||||
|
||||
/* DG: It can apparently happen that the player saves while the clipModel's axis are
|
||||
* modified by idPush::TryRotatePushEntity() -> idPhysics_Player::Rotate() -> idClipModel::Link()
|
||||
* Normally idPush seems to reset them to the identity matrix in the next frame,
|
||||
* but apparently not when coming from a savegame.
|
||||
* Usually clipModel->axis is the identity matrix, and if it isn't there's clipping bugs
|
||||
* like CheckGround() reporting that it's steep even though the player is only trying to
|
||||
* walk up normal stairs.
|
||||
* Resetting the axis to mat3_identity when restoring a savegame works around that issue
|
||||
* and makes sure players can go on playing if their savegame was "corrupted" by saving
|
||||
* while idPush was active. See https://github.com/dhewm/dhewm3/issues/328 for more details */
|
||||
if ( clipModel != nullptr ) {
|
||||
clipModel->SetPosition( clipModel->GetOrigin(), mat3_identity );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue