diff options
Diffstat (limited to '')
-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; |