summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2019-08-02 17:43:40 +0200
committerFilip Gawin <filip.gawin@zoho.com>2019-08-27 21:14:28 +0200
commit458fc63f0196dc92362b44d5cf7ebf67bbc903e1 (patch)
treeaa190341ec4d5ee449c80c20fea3c09e4f655532 /src/control
parentMore audio ped (diff)
downloadre3-458fc63f0196dc92362b44d5cf7ebf67bbc903e1.tar
re3-458fc63f0196dc92362b44d5cf7ebf67bbc903e1.tar.gz
re3-458fc63f0196dc92362b44d5cf7ebf67bbc903e1.tar.bz2
re3-458fc63f0196dc92362b44d5cf7ebf67bbc903e1.tar.lz
re3-458fc63f0196dc92362b44d5cf7ebf67bbc903e1.tar.xz
re3-458fc63f0196dc92362b44d5cf7ebf67bbc903e1.tar.zst
re3-458fc63f0196dc92362b44d5cf7ebf67bbc903e1.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/Bridge.h27
-rw-r--r--src/control/PathFind.cpp10
-rw-r--r--src/control/Replay.cpp38
-rw-r--r--src/control/Script.cpp6
4 files changed, 39 insertions, 42 deletions
diff --git a/src/control/Bridge.h b/src/control/Bridge.h
index 52c85322..377c8bf8 100644
--- a/src/control/Bridge.h
+++ b/src/control/Bridge.h
@@ -1,27 +1,24 @@
#pragma once
#include "Entity.h"
+enum bridgeStates {
+ STATE_BRIDGE_LOCKED,
+ STATE_LIFT_PART_IS_UP,
+ STATE_LIFT_PART_MOVING_DOWN,
+ STATE_LIFT_PART_IS_DOWN,
+ STATE_LIFT_PART_ABOUT_TO_MOVE_UP,
+ STATE_LIFT_PART_MOVING_UP
+};
+
class CBridge
{
-private:
- enum bridgeStates
- {
- STATE_BRIDGE_LOCKED,
- STATE_LIFT_PART_IS_UP,
- STATE_LIFT_PART_MOVING_DOWN,
- STATE_LIFT_PART_IS_DOWN,
- STATE_LIFT_PART_ABOUT_TO_MOVE_UP,
- STATE_LIFT_PART_MOVING_UP
- };
-
-
+public:
static CEntity *&pLiftRoad, *&pLiftPart, *&pWeight;
static int &State, &OldState;
static float &DefaultZLiftPart, &DefaultZLiftRoad, &DefaultZLiftWeight;
- static float& OldLift;
- static uint32& TimeOfBridgeBecomingOperational;
+ static float &OldLift;
+ static uint32 &TimeOfBridgeBecomingOperational;
-public:
static void Init();
static void Update();
static bool ShouldLightsBeFlashing();
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index 87ce4476..e9b33395 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -207,8 +207,8 @@ CPathFind::PreparePathData(void)
numExtern++;
if(InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes > numLanes)
numLanes = InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes;
- maxX = Max(maxX, Abs(InfoForTileCars[k].x));
- maxY = Max(maxY, Abs(InfoForTileCars[k].y));
+ maxX = max(maxX, Abs(InfoForTileCars[k].x));
+ maxY = max(maxY, Abs(InfoForTileCars[k].y));
}else if(InfoForTileCars[k].type == NodeTypeIntern)
numIntern++;
}
@@ -392,7 +392,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
if(Abs(dx) < nearestDist){
dy = tempnodes[k].pos.y - CoorsXFormed.y;
if(Abs(dy) < nearestDist){
- nearestDist = Max(Abs(dx), Abs(dy));
+ nearestDist = max(Abs(dx), Abs(dy));
nearestId = k;
}
}
@@ -501,13 +501,13 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
// Find i inside path segment
iseg = 0;
- for(j = Max(oldNumPathNodes, i-12); j < i; j++)
+ for(j = max(oldNumPathNodes, i-12); j < i; j++)
if(m_pathNodes[j].objectIndex == m_pathNodes[i].objectIndex)
iseg++;
istart = 12*m_mapObjects[m_pathNodes[i].objectIndex]->m_modelIndex;
// Add links to other internal nodes
- for(j = Max(oldNumPathNodes, i-12); j < Min(m_numPathNodes, i+12); j++){
+ for(j = max(oldNumPathNodes, i-12); j < min(m_numPathNodes, i+12); j++){
if(m_pathNodes[i].objectIndex != m_pathNodes[j].objectIndex || i == j)
continue;
// N.B.: in every path segment, the externals have to be at the end
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index 207845b9..12636d32 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -366,8 +366,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 * Max(0.0f, Min(4.0f, main->currentTime));
- state->speed = 255.0f / 3.0f * Max(0.0f, Min(3.0f, main->speed));
+ state->time = 255.0f / 4.0f * max(0.0f, min(4.0f, main->currentTime));
+ state->speed = 255.0f / 3.0f * max(0.0f, min(3.0f, main->speed));
}else{
state->animId = 3;
state->time = 0;
@@ -375,9 +375,9 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
}
if (second) {
state->secAnimId = second->animId;
- state->secTime = 255.0f / 4.0f * Max(0.0f, Min(4.0f, second->currentTime));
- state->secSpeed = 255.0f / 3.0f * Max(0.0f, Min(3.0f, second->speed));
- state->blendAmount = 255.0f / 2.0f * Max(0.0f, Min(2.0f, blend_amount));
+ state->secTime = 255.0f / 4.0f * max(0.0f, min(4.0f, second->currentTime));
+ state->secSpeed = 255.0f / 3.0f * max(0.0f, min(3.0f, second->speed));
+ state->blendAmount = 255.0f / 2.0f * max(0.0f, min(2.0f, blend_amount));
}else{
state->secAnimId = 0;
state->secTime = 0;
@@ -387,9 +387,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 * Max(0.0f, Min(4.0f, partial->currentTime));
- state->partAnimSpeed = 255.0f / 3.0f * Max(0.0f, Min(3.0f, partial->speed));
- state->partBlendAmount = 255.0f / 2.0f * Max(0.0f, Min(2.0f, partial->blendAmount));
+ state->partAnimTime = 255.0f / 4.0f * max(0.0f, min(4.0f, partial->currentTime));
+ state->partAnimSpeed = 255.0f / 3.0f * max(0.0f, min(3.0f, partial->speed));
+ state->partBlendAmount = 255.0f / 2.0f * max(0.0f, min(2.0f, partial->blendAmount));
}else{
state->partAnimId = 0;
state->partAnimTime = 0;
@@ -408,9 +408,9 @@ 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 * Max(0.0f, Min(4.0f, assoc->currentTime));
- state->aSpeed[i] = 255.0f / 3.0f * Max(0.0f, Min(3.0f, assoc->speed));
- state->aBlendAmount[i] = 255.0f / 2.0f * Max(0.0f, Min(2.0f, assoc->blendAmount));
+ state->aCurTime[i] = 255.0f / 4.0f * max(0.0f, min(4.0f, assoc->currentTime));
+ state->aSpeed[i] = 255.0f / 3.0f * max(0.0f, min(3.0f, assoc->speed));
+ state->aBlendAmount[i] = 255.0f / 2.0f * max(0.0f, min(2.0f, assoc->blendAmount));
state->aFlags[i] = assoc->flags;
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
state->aFunctionCallbackID[i] = FindCBFunctionID(assoc->callback);
@@ -431,9 +431,9 @@ 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 * Max(0.0f, Min(4.0f, assoc->currentTime));
- state->aSpeed2[i] = 255.0f / 3.0f * Max(0.0f, Min(3.0f, assoc->speed));
- state->aBlendAmount2[i] = 255.0f / 2.0f * Max(0.0f, Min(2.0f, assoc->blendAmount));
+ state->aCurTime2[i] = 255.0f / 4.0f * max(0.0f, min(4.0f, assoc->currentTime));
+ state->aSpeed2[i] = 255.0f / 3.0f * max(0.0f, min(3.0f, assoc->speed));
+ state->aBlendAmount2[i] = 255.0f / 2.0f * max(0.0f, min(2.0f, assoc->blendAmount));
state->aFlags2[i] = assoc->flags;
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
state->aFunctionCallbackID2[i] = FindCBFunctionID(assoc->callback);
@@ -625,9 +625,9 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
vp->health = vehicle->m_fHealth / 4.0f; /* Not anticipated that health can be > 1000. */
vp->acceleration = vehicle->m_fGasPedal * 100.0f;
vp->panels = vehicle->IsCar() ? ((CAutomobile*)vehicle)->Damage.m_panelStatus : 0;
- 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));
+ 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));
vp->mi = vehicle->GetModelIndex();
vp->primary_color = vehicle->m_currentColour1;
vp->secondary_color = vehicle->m_currentColour2;
@@ -1501,9 +1501,9 @@ void CReplay::ProcessLookAroundCam(void)
--FramesActiveLookAroundCam;
fBetaAngleLookAroundCam += x_moved;
if (CPad::NewMouseControllerState.LMB && CPad::NewMouseControllerState.RMB)
- fDistanceLookAroundCam = Max(3.0f, Min(15.0f, fDistanceLookAroundCam + 2.0f * y_moved));
+ fDistanceLookAroundCam = max(3.0f, min(15.0f, fDistanceLookAroundCam + 2.0f * y_moved));
else
- fAlphaAngleLookAroundCam = Max(0.1f, Min(1.5f, fAlphaAngleLookAroundCam + y_moved));
+ fAlphaAngleLookAroundCam = max(0.1f, min(1.5f, fAlphaAngleLookAroundCam + y_moved));
CVector camera_pt(
fDistanceLookAroundCam * Sin(fBetaAngleLookAroundCam) * Cos(fAlphaAngleLookAroundCam),
fDistanceLookAroundCam * Cos(fBetaAngleLookAroundCam) * Cos(fAlphaAngleLookAroundCam),
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 7e87fc6e..c81cd050 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -1987,7 +1987,7 @@ int8 CRunningScript::ProcessCommandsFrom100To199(int32 command)
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
car->m_status = STATUS_PHYSICS;
car->bEngineOn = true;
- car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6);
+ car->AutoPilot.m_nCruiseSpeed = max(car->AutoPilot.m_nCruiseSpeed, 6);
car->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
return 0;
}
@@ -1999,7 +1999,7 @@ int8 CRunningScript::ProcessCommandsFrom100To199(int32 command)
CCarCtrl::JoinCarWithRoadSystem(car);
car->AutoPilot.m_nCarMission = MISSION_CRUISE;
car->bEngineOn = true;
- car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6);
+ car->AutoPilot.m_nCruiseSpeed = max(car->AutoPilot.m_nCruiseSpeed, 6);
car->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
return 0;
}
@@ -2083,7 +2083,7 @@ int8 CRunningScript::ProcessCommandsFrom100To199(int32 command)
CollectParameters(&m_nIp, 2);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(car);
- car->AutoPilot.m_nCruiseSpeed = Min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fUnkMaxVelocity);
+ car->AutoPilot.m_nCruiseSpeed = min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fUnkMaxVelocity);
return 0;
}
case COMMAND_SET_CAR_DRIVING_STYLE: