diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-12-26 10:56:20 +0100 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-12-26 10:56:20 +0100 |
commit | 149aef929dfb21642a5d7b698b9802bd7a45359c (patch) | |
tree | 757d35d90351255a506ab9b3657c6aacc076d58b /src/control/Replay.cpp | |
parent | Backface cull. in INI, mouse sensitivity fix, aspect ratio auto as default (diff) | |
download | re3-149aef929dfb21642a5d7b698b9802bd7a45359c.tar re3-149aef929dfb21642a5d7b698b9802bd7a45359c.tar.gz re3-149aef929dfb21642a5d7b698b9802bd7a45359c.tar.bz2 re3-149aef929dfb21642a5d7b698b9802bd7a45359c.tar.lz re3-149aef929dfb21642a5d7b698b9802bd7a45359c.tar.xz re3-149aef929dfb21642a5d7b698b9802bd7a45359c.tar.zst re3-149aef929dfb21642a5d7b698b9802bd7a45359c.zip |
Diffstat (limited to 'src/control/Replay.cpp')
-rw-r--r-- | src/control/Replay.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 8d28970f..d3de987e 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -794,10 +794,19 @@ void CReplay::StoreBikeUpdate(CVehicle* vehicle, int id) vp->matrix.CompressFromFullMatrix(vehicle->GetMatrix()); vp->health = vehicle->m_fHealth / 4.0f; /* Not anticipated that health can be > 1000. */ vp->acceleration = vehicle->m_fGasPedal * 100.0f; +#ifdef FIX_BUGS // originally it's undefined behaviour - different fields are copied on PC and mobile + for (int i = 0; i < 2; i++) + vp->wheel_rotation[i] = 128.0f / PI * bike->m_aWheelRotation[i]; + for (int i = 0; i < 2; i++) + vp->wheel_rotation[i + 2] = 128.0f / PI * bike->m_aWheelSpeed[i]; + for (int i = 0; i < 4; i++) + vp->wheel_susp_dist[i] = 50.0f * bike->m_aSuspensionSpringRatio[i]; +#else for (int i = 0; i < 4; i++) { vp->wheel_susp_dist[i] = 50.0f * bike->m_aSuspensionSpringRatio[i]; vp->wheel_rotation[i] = 128.0f / PI * bike->m_aWheelRotation[i]; } +#endif vp->velocityX = 8000.0f * Max(-4.0f, Min(4.0f, vehicle->GetMoveSpeed().x)); /* 8000!? */ vp->velocityY = 8000.0f * Max(-4.0f, Min(4.0f, vehicle->GetMoveSpeed().y)); vp->velocityZ = 8000.0f * Max(-4.0f, Min(4.0f, vehicle->GetMoveSpeed().z)); @@ -902,12 +911,19 @@ void CReplay::ProcessBikeUpdate(CVehicle* vehicle, float interpolation, CAddress vehicle->m_vecMoveSpeed = CVector(vp->velocityX / 8000.0f, vp->velocityY / 8000.0f, vp->velocityZ / 8000.0f); vehicle->m_fSteerAngle = vp->wheel_state / 50.0f; vehicle->bEngineOn = true; +#ifdef FIX_BUGS + for (int i = 0; i < 2; i++) + bike->m_aWheelRotation[i] = vp->wheel_rotation[i] / (128.0f / PI); + for (int i = 0; i < 2; i++) + bike->m_aWheelSpeed[i] = vp->wheel_rotation[i + 2] / (128.0f / PI); + for (int i = 0; i < 4; i++) + bike->m_aSuspensionSpringRatio[i] = vp->wheel_susp_dist[i] / 50.0f; +#else for (int i = 0; i < 4; i++) { bike->m_aSuspensionSpringRatio[i] = vp->wheel_susp_dist[i] / 50.0f; bike->m_aWheelRotation[i] = vp->wheel_rotation[i] / (128.0f / PI); - // NB: technically last assignment overflows - there are 2 wheels of bike - // however it saves two useful fields; this looks like unrolled loop, not sequential assignments } +#endif bike->m_fLeanLRAngle = vp->lean_angle / 50.0f; bike->m_fWheelAngle = vp->wheel_angle / 50.0f; bike->bLeanMatrixClean = false; |