summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2019-08-03 17:51:19 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2019-08-03 17:51:19 +0200
commit537f0dfc16b3b3d00440003cd28d3e87ce6d762a (patch)
tree85bdd0e893739d3f5db4591e60d86b1ec9cdc030 /src
parentMerge remote-tracking branch 'upstream/master' (diff)
downloadre3-537f0dfc16b3b3d00440003cd28d3e87ce6d762a.tar
re3-537f0dfc16b3b3d00440003cd28d3e87ce6d762a.tar.gz
re3-537f0dfc16b3b3d00440003cd28d3e87ce6d762a.tar.bz2
re3-537f0dfc16b3b3d00440003cd28d3e87ce6d762a.tar.lz
re3-537f0dfc16b3b3d00440003cd28d3e87ce6d762a.tar.xz
re3-537f0dfc16b3b3d00440003cd28d3e87ce6d762a.tar.zst
re3-537f0dfc16b3b3d00440003cd28d3e87ce6d762a.zip
Diffstat (limited to 'src')
-rw-r--r--src/control/Script.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 423f36dd..b5f2e7b4 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -3239,9 +3239,7 @@ int8 CRunningScript::ProcessCommandsFrom300To399(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- float angle = pPed->bInVehicle ?
- Atan2(-pPed->m_pMyVehicle->GetForward().x, pPed->m_pMyVehicle->GetForward().y) :
- Atan2(-pPed->GetForward().x, pPed->GetForward().y);
+ float angle = pPed->bInVehicle ? pPed->m_pMyVehicle->GetForward().Heading() : pPed->GetForward().Heading();
*(float*)&ScriptParams[0] = CGeneral::LimitAngle(RADTODEG(angle));
StoreParameters(&m_nIp, 1);
return 0;
@@ -3263,9 +3261,7 @@ int8 CRunningScript::ProcessCommandsFrom300To399(int32 command)
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
- float angle = pPed->bInVehicle ?
- Atan2(-pPed->m_pMyVehicle->GetForward().x, pPed->m_pMyVehicle->GetForward().y) :
- Atan2(-pPed->GetForward().x, pPed->GetForward().y);
+ float angle = pPed->bInVehicle ? pPed->m_pMyVehicle->GetForward().Heading() : pPed->GetForward().Heading();
*(float*)&ScriptParams[0] = CGeneral::LimitAngle(RADTODEG(angle));
StoreParameters(&m_nIp, 1);
return 0;
@@ -3288,7 +3284,7 @@ int8 CRunningScript::ProcessCommandsFrom300To399(int32 command)
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle);
- float angle = Atan2(-pVehicle->GetForward().x, pVehicle->GetForward().y);
+ float angle = pVehicle->GetForward().Heading();
*(float*)&ScriptParams[0] = CGeneral::LimitAngle(RADTODEG(angle));
StoreParameters(&m_nIp, 1);
return 0;
@@ -3306,7 +3302,7 @@ int8 CRunningScript::ProcessCommandsFrom300To399(int32 command)
CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
assert(pObject);
- float angle = Atan2(-pObject->GetForward().x, pObject->GetForward().y);
+ float angle = pObject->GetForward().Heading();
*(float*)&ScriptParams[0] = CGeneral::LimitAngle(RADTODEG(angle));
StoreParameters(&m_nIp, 1);
return 0;