summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-06-30 20:26:36 +0200
committerSergeanur <s.anureev@yandex.ua>2021-06-30 20:26:36 +0200
commit138abb91f6232ef40e1093b3c37122e1b0bf2cf1 (patch)
treec4c694734bb56c29ddf8b5bbd891741540a7c68b /src/control
parentFix script load (diff)
parentPause radio when game is paused (diff)
downloadre3-138abb91f6232ef40e1093b3c37122e1b0bf2cf1.tar
re3-138abb91f6232ef40e1093b3c37122e1b0bf2cf1.tar.gz
re3-138abb91f6232ef40e1093b3c37122e1b0bf2cf1.tar.bz2
re3-138abb91f6232ef40e1093b3c37122e1b0bf2cf1.tar.lz
re3-138abb91f6232ef40e1093b3c37122e1b0bf2cf1.tar.xz
re3-138abb91f6232ef40e1093b3c37122e1b0bf2cf1.tar.zst
re3-138abb91f6232ef40e1093b3c37122e1b0bf2cf1.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/CarCtrl.cpp4
-rw-r--r--src/control/Replay.cpp38
-rw-r--r--src/control/Script4.cpp4
3 files changed, 23 insertions, 23 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 44e7ae40..f50111ec 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -2608,7 +2608,7 @@ void CCarCtrl::SteerAIBoatWithPhysicsHeadingForTarget(CVehicle* pVehicle, float
float angleToTarget = GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
float angleForward = GetATanOfXY(forward.x, forward.y);
float steerAngle = LimitRadianAngle(angleToTarget - angleForward);
- steerAngle = clamp(steerAngle, -DEFAULT_MAX_STEER_ANGLE, DEFAULT_MAX_STEER_ANGLE);
+ steerAngle = Clamp(steerAngle, -DEFAULT_MAX_STEER_ANGLE, DEFAULT_MAX_STEER_ANGLE);
#ifdef FIX_BUGS
float speedTarget = pVehicle->AutoPilot.GetCruiseSpeed();
#else
@@ -2768,7 +2768,7 @@ void CCarCtrl::SteerAIPlaneTowardsTargetCoors(CAutomobile* pPlane)
{
CVector2D vecToTarget = pPlane->AutoPilot.m_vecDestinationCoors - pPlane->GetPosition();
float fForwardZ = (pPlane->AutoPilot.m_vecDestinationCoors.z - pPlane->GetPosition().z) / vecToTarget.Magnitude();
- fForwardZ = clamp(fForwardZ, -0.3f, 0.3f);
+ fForwardZ = Clamp(fForwardZ, -0.3f, 0.3f);
float angle = GetATanOfXY(vecToTarget.x, vecToTarget.y);
while (angle > TWOPI)
angle -= TWOPI;
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index 22347b92..8d7dbf85 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -425,9 +425,9 @@ void CReplay::RecordParticle(tParticleType type, const CVector& vecPos, const CV
pp->pos_x = 4.0f * vecPos.x;
pp->pos_y = 4.0f * vecPos.y;
pp->pos_z = 4.0f * vecPos.z;
- pp->dir_x = 120.0f * clamp(vecDir.x, -1.0f, 1.0f);
- pp->dir_y = 120.0f * clamp(vecDir.y, -1.0f, 1.0f);
- pp->dir_z = 120.0f * clamp(vecDir.z, -1.0f, 1.0f);
+ pp->dir_x = 120.0f * Clamp(vecDir.x, -1.0f, 1.0f);
+ pp->dir_y = 120.0f * Clamp(vecDir.y, -1.0f, 1.0f);
+ pp->dir_z = 120.0f * Clamp(vecDir.z, -1.0f, 1.0f);
pp->size = fSize;
pp->r = color.red;
pp->g = color.green;
@@ -463,8 +463,8 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
CAnimBlendAssociation* main = RpAnimBlendClumpGetMainAssociation((RpClump*)ped->m_rwObject, &second, &blend_amount);
if (main){
state->animId = main->animId;
- state->time = 255.0f / 4.0f * clamp(main->currentTime, 0.0f, 4.0f);
- state->speed = 255.0f / 3.0f * clamp(main->speed, 0.0f, 3.0f);
+ state->time = 255.0f / 4.0f * Clamp(main->currentTime, 0.0f, 4.0f);
+ state->speed = 255.0f / 3.0f * Clamp(main->speed, 0.0f, 3.0f);
state->groupId = main->groupId;
}else{
state->animId = 3;
@@ -474,9 +474,9 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
}
if (second) {
state->secAnimId = second->animId;
- state->secTime = 255.0f / 4.0f * clamp(second->currentTime, 0.0f, 4.0f);
- state->secSpeed = 255.0f / 3.0f * clamp(second->speed, 0.0f, 3.0f);
- state->blendAmount = 255.0f / 2.0f * clamp(blend_amount, 0.0f, 2.0f);
+ state->secTime = 255.0f / 4.0f * Clamp(second->currentTime, 0.0f, 4.0f);
+ state->secSpeed = 255.0f / 3.0f * Clamp(second->speed, 0.0f, 3.0f);
+ state->blendAmount = 255.0f / 2.0f * Clamp(blend_amount, 0.0f, 2.0f);
state->secGroupId = second->groupId;
}else{
state->secAnimId = 0;
@@ -488,9 +488,9 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
CAnimBlendAssociation* partial = RpAnimBlendClumpGetMainPartialAssociation((RpClump*)ped->m_rwObject);
if (partial) {
state->partAnimId = partial->animId;
- state->partAnimTime = 255.0f / 4.0f * clamp(partial->currentTime, 0.0f, 4.0f);
- state->partAnimSpeed = 255.0f / 3.0f * clamp(partial->speed, 0.0f, 3.0f);
- state->partBlendAmount = 255.0f / 2.0f * clamp(partial->blendAmount, 0.0f, 2.0f);
+ state->partAnimTime = 255.0f / 4.0f * Clamp(partial->currentTime, 0.0f, 4.0f);
+ state->partAnimSpeed = 255.0f / 3.0f * Clamp(partial->speed, 0.0f, 3.0f);
+ state->partBlendAmount = 255.0f / 2.0f * Clamp(partial->blendAmount, 0.0f, 2.0f);
state->partGroupId = partial->groupId;
}else{
state->partAnimId = 0;
@@ -507,10 +507,10 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
CAnimBlendAssociation* assoc = RpAnimBlendClumpGetMainAssociation_N((RpClump*)ped->m_rwObject, i);
if (assoc){
state->aAnimId[i] = assoc->animId;
- state->aCurTime[i] = 255.0f / 4.0f * clamp(assoc->currentTime, 0.0f, 4.0f);
- state->aSpeed[i] = 255.0f / 3.0f * clamp(assoc->speed, 0.0f, 3.0f);
- state->aBlendAmount[i] = 255.0f / 2.0f * clamp(assoc->blendAmount, 0.0f, 2.0f);
- state->aBlendDelta[i] = 127.0f / 32.0f * clamp(assoc->blendDelta, -16.0f, 16.0f);
+ state->aCurTime[i] = 255.0f / 4.0f * Clamp(assoc->currentTime, 0.0f, 4.0f);
+ state->aSpeed[i] = 255.0f / 3.0f * Clamp(assoc->speed, 0.0f, 3.0f);
+ state->aBlendAmount[i] = 255.0f / 2.0f * Clamp(assoc->blendAmount, 0.0f, 2.0f);
+ state->aBlendDelta[i] = 127.0f / 32.0f * Clamp(assoc->blendDelta, -16.0f, 16.0f);
state->aFlags[i] = assoc->flags;
state->aGroupId[i] = assoc->groupId;
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
@@ -533,10 +533,10 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
CAnimBlendAssociation* assoc = RpAnimBlendClumpGetMainPartialAssociation_N((RpClump*)ped->m_rwObject, i);
if (assoc) {
state->aAnimId2[i] = assoc->animId;
- state->aCurTime2[i] = 255.0f / 4.0f * clamp(assoc->currentTime, 0.0f, 4.0f);
- state->aSpeed2[i] = 255.0f / 3.0f * clamp(assoc->speed, 0.0f, 3.0f);
- state->aBlendAmount2[i] = 255.0f / 2.0f * clamp(assoc->blendAmount, 0.0f, 2.0f);
- state->aBlendDelta2[i] = 127.0f / 16.0f * clamp(assoc->blendDelta, -16.0f, 16.0f);
+ state->aCurTime2[i] = 255.0f / 4.0f * Clamp(assoc->currentTime, 0.0f, 4.0f);
+ state->aSpeed2[i] = 255.0f / 3.0f * Clamp(assoc->speed, 0.0f, 3.0f);
+ state->aBlendAmount2[i] = 255.0f / 2.0f * Clamp(assoc->blendAmount, 0.0f, 2.0f);
+ state->aBlendDelta2[i] = 127.0f / 16.0f * Clamp(assoc->blendDelta, -16.0f, 16.0f);
state->aFlags2[i] = assoc->flags;
state->aGroupId2[i] = assoc->groupId;
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp
index 33042bac..d5edc5cf 100644
--- a/src/control/Script4.cpp
+++ b/src/control/Script4.cpp
@@ -744,7 +744,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
CollectParameters(&m_nIp, 2);
CPlayerPed* pPlayerPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPlayerPed);
- pPlayerPed->m_fArmour = clamp(pPlayerPed->m_fArmour + GET_INTEGER_PARAM(1), 0.0f, CWorld::Players[GET_INTEGER_PARAM(0)].m_nMaxArmour);
+ pPlayerPed->m_fArmour = Clamp(pPlayerPed->m_fArmour + GET_INTEGER_PARAM(1), 0.0f, CWorld::Players[GET_INTEGER_PARAM(0)].m_nMaxArmour);
return 0;
}
case COMMAND_ADD_ARMOUR_TO_CHAR:
@@ -752,7 +752,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- pPed->m_fArmour = clamp(pPed->m_fArmour + GET_INTEGER_PARAM(1), 0.0f, 100.0f);
+ pPed->m_fArmour = Clamp(pPed->m_fArmour + GET_INTEGER_PARAM(1), 0.0f, 100.0f);
return 0;
}
case COMMAND_OPEN_GARAGE: