diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-04-11 01:27:50 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-04-11 01:27:50 +0200 |
commit | bc90f958da4682a4b951cd77cbfd1aa3c12e2fad (patch) | |
tree | f40097d562ba1cc1603a1291a41eae5ea3dccb96 /src | |
parent | Merge branch 'master' into garages_dev (diff) | |
download | re3-bc90f958da4682a4b951cd77cbfd1aa3c12e2fad.tar re3-bc90f958da4682a4b951cd77cbfd1aa3c12e2fad.tar.gz re3-bc90f958da4682a4b951cd77cbfd1aa3c12e2fad.tar.bz2 re3-bc90f958da4682a4b951cd77cbfd1aa3c12e2fad.tar.lz re3-bc90f958da4682a4b951cd77cbfd1aa3c12e2fad.tar.xz re3-bc90f958da4682a4b951cd77cbfd1aa3c12e2fad.tar.zst re3-bc90f958da4682a4b951cd77cbfd1aa3c12e2fad.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/control/Record.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/control/Record.cpp b/src/control/Record.cpp index 19fd8969..e858bc1d 100644 --- a/src/control/Record.cpp +++ b/src/control/Record.cpp @@ -230,8 +230,8 @@ void CRecordDataForChase::SaveOrRetrieveDataForThisFrame(void) #else CCarStateEachFrame* pState = (CCarStateEachFrame*)pChaseCars[CurrentCar]; #endif - CVector right = CVector(pState->rightX, pState->rightY, pState->rightZ) / (UINT8_MAX / 2); - CVector forward = CVector(pState->forwardX, pState->forwardY, pState->forwardZ) / (UINT8_MAX / 2); + CVector right = CVector(pState->rightX, pState->rightY, pState->rightZ) / INT8_MAX; + CVector forward = CVector(pState->forwardX, pState->forwardY, pState->forwardZ) / INT8_MAX; CVector up = CrossProduct(right, forward); sprintf(gString, "%f %f %f\n", pState->pos.x, pState->pos.y, pState->pos.z); CFileMgr::Write(fid2, gString, strlen(gString) - 1); @@ -330,16 +330,16 @@ void CRecordDataForChase::SaveOrRetrieveCarPositions(void) void CRecordDataForChase::StoreInfoForCar(CAutomobile* pCar, CCarStateEachFrame* pState) { - pState->rightX = UINT8_MAX / 2 * pCar->GetRight().x; - pState->rightY = UINT8_MAX / 2 * pCar->GetRight().y; - pState->rightZ = UINT8_MAX / 2 * pCar->GetRight().z; - pState->forwardX = UINT8_MAX / 2 * pCar->GetForward().x; - pState->forwardY = UINT8_MAX / 2 * pCar->GetForward().y; - pState->forwardZ = UINT8_MAX / 2 * pCar->GetForward().z; + pState->rightX = INT8_MAX * pCar->GetRight().x; + pState->rightY = INT8_MAX * pCar->GetRight().y; + pState->rightZ = INT8_MAX * pCar->GetRight().z; + pState->forwardX = INT8_MAX * pCar->GetForward().x; + pState->forwardY = INT8_MAX * pCar->GetForward().y; + pState->forwardZ = INT8_MAX * pCar->GetForward().z; pState->pos = pCar->GetPosition(); - pState->velX = 1.0f * (UINT16_MAX / 2) * pCar->GetMoveSpeed().x; - pState->velY = 1.0f * (UINT16_MAX / 2) * pCar->GetMoveSpeed().y; - pState->velZ = 1.0f * (UINT16_MAX / 2) * pCar->GetMoveSpeed().z; + pState->velX = 0.5f * INT16_MAX * pCar->GetMoveSpeed().x; + pState->velY = 0.5f * INT16_MAX * pCar->GetMoveSpeed().y; + pState->velZ = 0.5f * INT16_MAX * pCar->GetMoveSpeed().z; pState->wheel = 20 * pCar->m_fSteerAngle; pState->gas = 100 * pCar->m_fGasPedal; pState->brake = 100 * pCar->m_fBrakePedal; @@ -348,8 +348,8 @@ void CRecordDataForChase::StoreInfoForCar(CAutomobile* pCar, CCarStateEachFrame* void CRecordDataForChase::RestoreInfoForMatrix(CMatrix& matrix, CCarStateEachFrame* pState) { - matrix.GetRight() = CVector(pState->rightX, pState->rightY, pState->rightZ) / (UINT8_MAX / 2); - matrix.GetForward() = CVector(pState->forwardX, pState->forwardY, pState->forwardZ) / (UINT8_MAX / 2); + matrix.GetRight() = CVector(pState->rightX, pState->rightY, pState->rightZ) / INT8_MAX; + matrix.GetForward() = CVector(pState->forwardX, pState->forwardY, pState->forwardZ) / INT8_MAX; matrix.GetUp() = CrossProduct(matrix.GetRight(), matrix.GetForward()); matrix.GetPosition() = pState->pos; } @@ -358,7 +358,7 @@ void CRecordDataForChase::RestoreInfoForCar(CAutomobile* pCar, CCarStateEachFram { CVector oldPos = pCar->GetPosition(); RestoreInfoForMatrix(pCar->GetMatrix(), pState); - pCar->SetMoveSpeed(CVector(pState->velX, pState->velY, pState->velZ) * 1.0f / (UINT16_MAX / 2)); + pCar->SetMoveSpeed(CVector(pState->velX, pState->velY, pState->velZ) / INT16_MAX / 0.5f); pCar->SetTurnSpeed(0.0f, 0.0f, 0.0f); pCar->m_fSteerAngle = pState->wheel / 20.0f; pCar->m_fGasPedal = pState->gas / 100.0f; |