From 533f265f55ffea86a2090e3cd44f9efe69df8b57 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 7 Jul 2019 10:16:16 +0200 Subject: made code use TimeStepIn(Milli)Seconds; purged unnecessary inlines --- src/Pad.h | 128 +++++++++++++++++++++++----------------------- src/Timer.h | 20 ++++---- src/control/Replay.h | 4 +- src/control/Script.cpp | 2 +- src/entities/Automobile.h | 2 +- src/entities/Ped.h | 10 ++-- src/entities/Physical.cpp | 2 +- src/entities/Vehicle.cpp | 2 +- src/math/Vector.h | 10 ++-- src/render/Hud.cpp | 44 ++++++++-------- src/render/Particle.h | 2 +- 11 files changed, 114 insertions(+), 112 deletions(-) (limited to 'src') diff --git a/src/Pad.h b/src/Pad.h index e06aa9a6..30cdb8df 100644 --- a/src/Pad.h +++ b/src/Pad.h @@ -288,80 +288,80 @@ public: static int32 *EditCodesForControls(int32 *pRsKeys, int32 nSize); // mouse - inline bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); } + bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); } // keyboard - inline bool GetCharJustDown(int32 c) { return !!(NewKeyState.VK_KEYS[c] && !OldKeyState.VK_KEYS[c]); } - inline bool GetFJustDown(int32 n) { return !!(NewKeyState.F[n] && !OldKeyState.F[n]); } - inline bool GetEscapeJustDown() { return !!(NewKeyState.ESC && !OldKeyState.ESC); } - inline bool GetInsertJustDown() { return !!(NewKeyState.INS && !OldKeyState.INS); } - inline bool GetDeleteJustDown() { return !!(NewKeyState.DEL && !OldKeyState.DEL); } - inline bool GetHomeJustDown() { return !!(NewKeyState.HOME && !OldKeyState.HOME); } - inline bool GetEndJustDown() { return !!(NewKeyState.END && !OldKeyState.END); } - inline bool GetPageUpJustDown() { return !!(NewKeyState.PGUP && !OldKeyState.PGUP); } - inline bool GetPageDownJustDown() { return !!(NewKeyState.PGDN && !OldKeyState.PGDN); } - inline bool GetUpJustDown() { return !!(NewKeyState.UP && !OldKeyState.UP); } - inline bool GetDownJustDown() { return !!(NewKeyState.DOWN && !OldKeyState.DOWN); } - inline bool GetLeftJustDown() { return !!(NewKeyState.LEFT && !OldKeyState.LEFT); } - inline bool GetRightJustDown() { return !!(NewKeyState.RIGHT && !OldKeyState.RIGHT); } - inline bool GetScrollLockJustDown() { return !!(NewKeyState.SCROLLLOCK && !OldKeyState.SCROLLLOCK); } - inline bool GetPauseJustDown() { return !!(NewKeyState.PAUSE && !OldKeyState.PAUSE); } - inline bool GetNumLockJustDown() { return !!(NewKeyState.NUMLOCK && !OldKeyState.NUMLOCK); } - inline bool GetDivideJustDown() { return !!(NewKeyState.DIV && !OldKeyState.DIV); } - inline bool GetTimesJustDown() { return !!(NewKeyState.MUL && !OldKeyState.MUL); } - inline bool GetMinusJustDown() { return !!(NewKeyState.SUB && !OldKeyState.SUB); } - inline bool GetPlusJustDown() { return !!(NewKeyState.ADD && !OldKeyState.ADD); } - inline bool GetPadEnterJustDown() { return !!(NewKeyState.ENTER && !OldKeyState.ENTER); } // GetEnterJustDown - inline bool GetPadDelJustDown() { return !!(NewKeyState.DECIMAL && !OldKeyState.DECIMAL); } - inline bool GetPad1JustDown() { return !!(NewKeyState.NUM1 && !OldKeyState.NUM1); } - inline bool GetPad2JustDown() { return !!(NewKeyState.NUM2 && !OldKeyState.NUM2); } - inline bool GetPad3JustDown() { return !!(NewKeyState.NUM3 && !OldKeyState.NUM3); } - inline bool GetPad4JustDown() { return !!(NewKeyState.NUM4 && !OldKeyState.NUM4); } - inline bool GetPad5JustDown() { return !!(NewKeyState.NUM5 && !OldKeyState.NUM5); } - inline bool GetPad6JustDown() { return !!(NewKeyState.NUM6 && !OldKeyState.NUM6); } - inline bool GetPad7JustDown() { return !!(NewKeyState.NUM7 && !OldKeyState.NUM7); } - inline bool GetPad8JustDown() { return !!(NewKeyState.NUM8 && !OldKeyState.NUM8); } - inline bool GetPad9JustDown() { return !!(NewKeyState.NUM9 && !OldKeyState.NUM9); } - inline bool GetPad0JustDown() { return !!(NewKeyState.NUM0 && !OldKeyState.NUM0); } - inline bool GetBackspaceJustDown() { return !!(NewKeyState.BACKSP && !OldKeyState.BACKSP); } - inline bool GetTabJustDown() { return !!(NewKeyState.TAB && !OldKeyState.TAB); } - inline bool GetCapsLockJustDown() { return !!(NewKeyState.CAPSLOCK && !OldKeyState.CAPSLOCK); } - inline bool GetEnterJustDown() { return !!(NewKeyState.EXTENTER && !OldKeyState.EXTENTER); } - inline bool GetLeftShiftJustDown() { return !!(NewKeyState.LSHIFT && !OldKeyState.LSHIFT); } - inline bool GetShiftJustDown() { return !!(NewKeyState.SHIFT && !OldKeyState.SHIFT); } - inline bool GetRightShiftJustDown() { return !!(NewKeyState.RSHIFT && !OldKeyState.RSHIFT); } - inline bool GetLeftCtrlJustDown() { return !!(NewKeyState.LCTRL && !OldKeyState.LCTRL); } - inline bool GetRightCtrlJustDown() { return !!(NewKeyState.RCTRL && !OldKeyState.RCTRL); } - inline bool GetLeftAltJustDown() { return !!(NewKeyState.LALT && !OldKeyState.LALT); } - inline bool GetRightAltJustDown() { return !!(NewKeyState.RALT && !OldKeyState.RALT); } - inline bool GetLeftWinJustDown() { return !!(NewKeyState.LWIN && !OldKeyState.LWIN); } - inline bool GetRightWinJustDown() { return !!(NewKeyState.RWIN && !OldKeyState.RWIN); } - inline bool GetAppsJustDown() { return !!(NewKeyState.APPS && !OldKeyState.APPS); } + bool GetCharJustDown(int32 c) { return !!(NewKeyState.VK_KEYS[c] && !OldKeyState.VK_KEYS[c]); } + bool GetFJustDown(int32 n) { return !!(NewKeyState.F[n] && !OldKeyState.F[n]); } + bool GetEscapeJustDown() { return !!(NewKeyState.ESC && !OldKeyState.ESC); } + bool GetInsertJustDown() { return !!(NewKeyState.INS && !OldKeyState.INS); } + bool GetDeleteJustDown() { return !!(NewKeyState.DEL && !OldKeyState.DEL); } + bool GetHomeJustDown() { return !!(NewKeyState.HOME && !OldKeyState.HOME); } + bool GetEndJustDown() { return !!(NewKeyState.END && !OldKeyState.END); } + bool GetPageUpJustDown() { return !!(NewKeyState.PGUP && !OldKeyState.PGUP); } + bool GetPageDownJustDown() { return !!(NewKeyState.PGDN && !OldKeyState.PGDN); } + bool GetUpJustDown() { return !!(NewKeyState.UP && !OldKeyState.UP); } + bool GetDownJustDown() { return !!(NewKeyState.DOWN && !OldKeyState.DOWN); } + bool GetLeftJustDown() { return !!(NewKeyState.LEFT && !OldKeyState.LEFT); } + bool GetRightJustDown() { return !!(NewKeyState.RIGHT && !OldKeyState.RIGHT); } + bool GetScrollLockJustDown() { return !!(NewKeyState.SCROLLLOCK && !OldKeyState.SCROLLLOCK); } + bool GetPauseJustDown() { return !!(NewKeyState.PAUSE && !OldKeyState.PAUSE); } + bool GetNumLockJustDown() { return !!(NewKeyState.NUMLOCK && !OldKeyState.NUMLOCK); } + bool GetDivideJustDown() { return !!(NewKeyState.DIV && !OldKeyState.DIV); } + bool GetTimesJustDown() { return !!(NewKeyState.MUL && !OldKeyState.MUL); } + bool GetMinusJustDown() { return !!(NewKeyState.SUB && !OldKeyState.SUB); } + bool GetPlusJustDown() { return !!(NewKeyState.ADD && !OldKeyState.ADD); } + bool GetPadEnterJustDown() { return !!(NewKeyState.ENTER && !OldKeyState.ENTER); } // GetEnterJustDown + bool GetPadDelJustDown() { return !!(NewKeyState.DECIMAL && !OldKeyState.DECIMAL); } + bool GetPad1JustDown() { return !!(NewKeyState.NUM1 && !OldKeyState.NUM1); } + bool GetPad2JustDown() { return !!(NewKeyState.NUM2 && !OldKeyState.NUM2); } + bool GetPad3JustDown() { return !!(NewKeyState.NUM3 && !OldKeyState.NUM3); } + bool GetPad4JustDown() { return !!(NewKeyState.NUM4 && !OldKeyState.NUM4); } + bool GetPad5JustDown() { return !!(NewKeyState.NUM5 && !OldKeyState.NUM5); } + bool GetPad6JustDown() { return !!(NewKeyState.NUM6 && !OldKeyState.NUM6); } + bool GetPad7JustDown() { return !!(NewKeyState.NUM7 && !OldKeyState.NUM7); } + bool GetPad8JustDown() { return !!(NewKeyState.NUM8 && !OldKeyState.NUM8); } + bool GetPad9JustDown() { return !!(NewKeyState.NUM9 && !OldKeyState.NUM9); } + bool GetPad0JustDown() { return !!(NewKeyState.NUM0 && !OldKeyState.NUM0); } + bool GetBackspaceJustDown() { return !!(NewKeyState.BACKSP && !OldKeyState.BACKSP); } + bool GetTabJustDown() { return !!(NewKeyState.TAB && !OldKeyState.TAB); } + bool GetCapsLockJustDown() { return !!(NewKeyState.CAPSLOCK && !OldKeyState.CAPSLOCK); } + bool GetEnterJustDown() { return !!(NewKeyState.EXTENTER && !OldKeyState.EXTENTER); } + bool GetLeftShiftJustDown() { return !!(NewKeyState.LSHIFT && !OldKeyState.LSHIFT); } + bool GetShiftJustDown() { return !!(NewKeyState.SHIFT && !OldKeyState.SHIFT); } + bool GetRightShiftJustDown() { return !!(NewKeyState.RSHIFT && !OldKeyState.RSHIFT); } + bool GetLeftCtrlJustDown() { return !!(NewKeyState.LCTRL && !OldKeyState.LCTRL); } + bool GetRightCtrlJustDown() { return !!(NewKeyState.RCTRL && !OldKeyState.RCTRL); } + bool GetLeftAltJustDown() { return !!(NewKeyState.LALT && !OldKeyState.LALT); } + bool GetRightAltJustDown() { return !!(NewKeyState.RALT && !OldKeyState.RALT); } + bool GetLeftWinJustDown() { return !!(NewKeyState.LWIN && !OldKeyState.LWIN); } + bool GetRightWinJustDown() { return !!(NewKeyState.RWIN && !OldKeyState.RWIN); } + bool GetAppsJustDown() { return !!(NewKeyState.APPS && !OldKeyState.APPS); } // pad - inline bool GetTriangleJustDown() { return !!(NewState.Triangle && !OldState.Triangle); } - inline bool GetCircleJustDown() { return !!(NewState.Circle && !OldState.Circle); } - inline bool GetCrossJustDown() { return !!(NewState.Cross && !OldState.Cross); } - inline bool GetSquareJustDown() { return !!(NewState.Square && !OldState.Square); } - inline bool GetDPadUpJustDown() { return !!(NewState.DPadUp && !OldState.DPadUp); } - inline bool GetDPadDownJustDown() { return !!(NewState.DPadDown && !OldState.DPadDown); } - inline bool GetDPadLeftJustDown() { return !!(NewState.DPadLeft && !OldState.DPadLeft); } - inline bool GetDPadRightJustDown() { return !!(NewState.DPadRight && !OldState.DPadRight); } - inline bool GetLeftShoulder1JustDown() { return !!(NewState.LeftShoulder1 && !OldState.LeftShoulder1); } - inline bool GetLeftShoulder2JustDown() { return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); } - inline bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); } - inline bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); } + bool GetTriangleJustDown() { return !!(NewState.Triangle && !OldState.Triangle); } + bool GetCircleJustDown() { return !!(NewState.Circle && !OldState.Circle); } + bool GetCrossJustDown() { return !!(NewState.Cross && !OldState.Cross); } + bool GetSquareJustDown() { return !!(NewState.Square && !OldState.Square); } + bool GetDPadUpJustDown() { return !!(NewState.DPadUp && !OldState.DPadUp); } + bool GetDPadDownJustDown() { return !!(NewState.DPadDown && !OldState.DPadDown); } + bool GetDPadLeftJustDown() { return !!(NewState.DPadLeft && !OldState.DPadLeft); } + bool GetDPadRightJustDown() { return !!(NewState.DPadRight && !OldState.DPadRight); } + bool GetLeftShoulder1JustDown() { return !!(NewState.LeftShoulder1 && !OldState.LeftShoulder1); } + bool GetLeftShoulder2JustDown() { return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); } + bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); } + bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); } - inline int32 GetLeftShoulder1(void) { return NewState.LeftShoulder1; } - inline int32 GetLeftShoulder2(void) { return NewState.LeftShoulder2; } - inline int32 GetRightShoulder1(void) { return NewState.RightShoulder1; } - inline int32 GetRightShoulder2(void) { return NewState.RightShoulder2; } + int32 GetLeftShoulder1(void) { return NewState.LeftShoulder1; } + int32 GetLeftShoulder2(void) { return NewState.LeftShoulder2; } + int32 GetRightShoulder1(void) { return NewState.RightShoulder1; } + int32 GetRightShoulder2(void) { return NewState.RightShoulder2; } }; VALIDATE_SIZE(CPad, 0xFC); #define IsButtonJustDown(pad, btn) \ (!(pad)->OldState.btn && (pad)->NewState.btn) -void LittleTest(void); \ No newline at end of file +void LittleTest(void); diff --git a/src/Timer.h b/src/Timer.h index fbb130a3..9e6d447e 100644 --- a/src/Timer.h +++ b/src/Timer.h @@ -14,22 +14,24 @@ class CTimer static bool &m_CodePause; public: static float GetTimeStep(void) { return ms_fTimeStep; } - static inline void SetTimeStep(float ts) { ms_fTimeStep = ts; } + static void SetTimeStep(float ts) { ms_fTimeStep = ts; } + static float GetTimeStepInSeconds() { return ms_fTimeStep / 50.0f; } + static float GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; } static float GetTimeStepNonClipped(void) { return ms_fTimeStepNonClipped; } - static inline void SetTimeStepNonClipped(float ts) { ms_fTimeStepNonClipped = ts; } + static float GetTimeStepNonClippedInSeconds(void) { return ms_fTimeStepNonClipped / 50.0f; } + static void SetTimeStepNonClipped(float ts) { ms_fTimeStepNonClipped = ts; } static uint32 GetFrameCounter(void) { return m_FrameCounter; } - static inline void SetFrameCounter(uint32 fc) { m_FrameCounter = fc; } + static void SetFrameCounter(uint32 fc) { m_FrameCounter = fc; } static uint32 GetTimeInMilliseconds(void) { return m_snTimeInMilliseconds; } - static inline void SetTimeInMilliseconds(uint32 t) { m_snTimeInMilliseconds = t; } + static void SetTimeInMilliseconds(uint32 t) { m_snTimeInMilliseconds = t; } static uint32 GetTimeInMillisecondsNonClipped(void) { return m_snTimeInMillisecondsNonClipped; } - static inline void SetTimeInMillisecondsNonClipped(uint32 t) { m_snTimeInMillisecondsNonClipped = t; } + static void SetTimeInMillisecondsNonClipped(uint32 t) { m_snTimeInMillisecondsNonClipped = t; } static uint32 GetTimeInMillisecondsPauseMode(void) { return m_snTimeInMillisecondsPauseMode; } - static inline void SetTimeInMillisecondsPauseMode(uint32 t) { m_snTimeInMillisecondsPauseMode = t; } + static void SetTimeInMillisecondsPauseMode(uint32 t) { m_snTimeInMillisecondsPauseMode = t; } static uint32 GetPreviousTimeInMilliseconds(void) { return m_snPreviousTimeInMilliseconds; } - static inline void SetPreviousTimeInMilliseconds(uint32 t) { m_snPreviousTimeInMilliseconds = t; } + static void SetPreviousTimeInMilliseconds(uint32 t) { m_snPreviousTimeInMilliseconds = t; } static float GetTimeScale(void) { return ms_fTimeScale; } - static inline void SetTimeScale(float ts) { ms_fTimeScale = ts; } - static inline float GetFrameTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; } + static void SetTimeScale(float ts) { ms_fTimeScale = ts; } static bool GetIsPaused() { return m_UserPause || m_CodePause; } static bool GetIsUserPaused() { return m_UserPause; } diff --git a/src/control/Replay.h b/src/control/Replay.h index e6885f59..cd8d9a45 100644 --- a/src/control/Replay.h +++ b/src/control/Replay.h @@ -262,8 +262,8 @@ public: static void StreamAllNecessaryCarsAndPeds(void); static bool ShouldStandardCameraBeProcessed(void); - inline static bool IsPlayingBack() { return Mode == MODE_PLAYBACK; } - inline static bool IsPlayingBackFromFile() { return bPlayingBackFromFile; } + static bool IsPlayingBack() { return Mode == MODE_PLAYBACK; } + static bool IsPlayingBackFromFile() { return bPlayingBackFromFile; } private: static void RecordThisFrame(void); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 06edd16a..af151802 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -151,7 +151,7 @@ bool CUpsideDownCarCheck::IsCarUpsideDown(int32 id) void CUpsideDownCarCheck::UpdateTimers() { - uint32 timeStep = CTimer::GetFrameTimeStepInMilliseconds(); + uint32 timeStep = CTimer::GetTimeStepInMilliseconds(); for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){ CVehicle* v = CPools::GetVehiclePool()->GetAt(m_sCars[i].m_nVehicleIndex); if (v){ diff --git a/src/entities/Automobile.h b/src/entities/Automobile.h index b6617f4b..b1463936 100644 --- a/src/entities/Automobile.h +++ b/src/entities/Automobile.h @@ -26,7 +26,7 @@ public: RwFrame *m_aCarNodes[NUM_CAR_NODES]; CColPoint m_aWheelColPoints[4]; float m_aWheelDist[4]; - float m_aWheelDist_2[4]; + float m_aWheelDistPrev[4]; float m_aWheelSkidThing[4]; int field_49C; bool m_aWheelSkidmarkMuddy[4]; diff --git a/src/entities/Ped.h b/src/entities/Ped.h index 3888c076..95731e15 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -522,11 +522,11 @@ public: void SetPedStats(ePedStats); bool IsGangMember(void); - inline bool HasWeapon(uint8 weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; } - inline CWeapon &GetWeapon(uint8 weaponType) { return m_weapons[weaponType]; } - inline CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } - inline RwFrame *GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; } - inline static uint8 GetVehEnterExitFlag(eVehEnter vehEnter) { + bool HasWeapon(uint8 weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; } + CWeapon &GetWeapon(uint8 weaponType) { return m_weapons[weaponType]; } + CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } + RwFrame *GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; } + static uint8 GetVehEnterExitFlag(eVehEnter vehEnter) { switch (vehEnter) { case VEHICLE_ENTER_FRONT_RIGHT: return 4; diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 14891cd9..b7ca1904 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -346,7 +346,7 @@ CPhysical::ProcessControl(void) IsPed() && !bPedPhysics){ m_vecMoveSpeedAvg = (m_vecMoveSpeedAvg + m_vecMoveSpeed)/2.0f; m_vecTurnSpeedAvg = (m_vecTurnSpeedAvg + m_vecTurnSpeed)/2.0f; - float step = CTimer::GetTimeStep() * 0.003; + float step = CTimer::GetTimeStep() * 0.003f; if(m_vecMoveSpeedAvg.MagnitudeSqr() < step*step && m_vecTurnSpeedAvg.MagnitudeSqr() < step*step){ m_nStaticFrames++; diff --git a/src/entities/Vehicle.cpp b/src/entities/Vehicle.cpp index 25bede65..dccd9195 100644 --- a/src/entities/Vehicle.cpp +++ b/src/entities/Vehicle.cpp @@ -429,7 +429,7 @@ CVehicle::ProcessCarAlarm(void) if(m_nAlarmState == 0 || m_nAlarmState == -1) return; - step = CTimer::GetTimeStep()/50.0f * 1000.0f; + step = CTimer::GetTimeStepInMilliseconds(); if((uint16)m_nAlarmState < step) m_nAlarmState = 0; else diff --git a/src/math/Vector.h b/src/math/Vector.h index 2c431d0d..b49f00f2 100644 --- a/src/math/Vector.h +++ b/src/math/Vector.h @@ -38,35 +38,35 @@ public: x = 1.0f; } - inline const CVector &operator+=(CVector const &right) { + const CVector &operator+=(CVector const &right) { x += right.x; y += right.y; z += right.z; return *this; } - inline const CVector &operator-=(CVector const &right) { + const CVector &operator-=(CVector const &right) { x -= right.x; y -= right.y; z -= right.z; return *this; } - inline const CVector &operator*=(float right) { + const CVector &operator*=(float right) { x *= right; y *= right; z *= right; return *this; } - inline const CVector &operator/=(float right) { + const CVector &operator/=(float right) { x /= right; y /= right; z /= right; return *this; } - inline CVector operator-() const { + CVector operator-() const { return CVector(-x, -y, -z); } diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 081aaa64..680720e0 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -496,7 +496,7 @@ void CHud::Draw() fZoneAlpha = 255.0f; break; case 2: - m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_ZoneFadeTimer += CTimer::GetTimeStepInMilliseconds(); if (m_ZoneFadeTimer > 1000) { m_ZoneState = 1; m_ZoneFadeTimer = 1000; @@ -504,7 +504,7 @@ void CHud::Draw() fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f; break; case 3: - m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + m_ZoneFadeTimer -= CTimer::GetTimeStepInMilliseconds(); if (m_ZoneFadeTimer < 0) { m_ZoneState = 0; m_ZoneFadeTimer = 0; @@ -512,7 +512,7 @@ void CHud::Draw() fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f; break; case 4: - m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + m_ZoneFadeTimer -= CTimer::GetTimeStepInMilliseconds(); if (m_ZoneFadeTimer < 0) { m_ZoneFadeTimer = 0; m_ZoneToPrint = m_pLastZoneName; @@ -526,7 +526,7 @@ void CHud::Draw() } if (!m_Message[0]) { - m_ZoneNameTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_ZoneNameTimer += CTimer::GetTimeStepInMilliseconds(); CFont::SetJustifyOff(); CFont::SetPropOn(); CFont::SetBackgroundOff(); @@ -592,7 +592,7 @@ void CHud::Draw() fVehicleAlpha = 255.0f; break; case 2: - m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_VehicleFadeTimer += CTimer::GetTimeStepInMilliseconds(); if (m_VehicleFadeTimer > 1000) { m_VehicleState = 1; m_VehicleFadeTimer = 1000; @@ -600,7 +600,7 @@ void CHud::Draw() fVehicleAlpha = m_VehicleFadeTimer * 0.001f * 255.0f; break; case 3: - m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + m_VehicleFadeTimer -= CTimer::GetTimeStepInMilliseconds(); if (m_VehicleFadeTimer < 0) { m_VehicleState = 0; m_VehicleFadeTimer = 0; @@ -608,7 +608,7 @@ void CHud::Draw() fVehicleAlpha = m_VehicleFadeTimer * 0.001f * 255.0f; break; case 4: - m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + m_VehicleFadeTimer -= CTimer::GetTimeStepInMilliseconds(); if (m_VehicleFadeTimer < 0) { m_VehicleFadeTimer = 0; m_pVehicleNameToPrint = m_pLastVehicleName; @@ -622,7 +622,7 @@ void CHud::Draw() } if (!m_Message[0]) { - m_VehicleNameTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_VehicleNameTimer += CTimer::GetTimeStepInMilliseconds(); CFont::SetJustifyOff(); CFont::SetPropOn(); CFont::SetBackgroundOff(); @@ -924,11 +924,11 @@ void CHud::Draw() CFont::SetFontStyle(FONT_HEADING); if (BigMessageX[0] >= (SCREEN_WIDTH - 20)) { - BigMessageInUse[0] += (CTimer::GetTimeStep() * 0.02f * 120.0f); + BigMessageInUse[0] += (CTimer::GetTimeStepInSeconds() * 120.0f); if (BigMessageInUse[0] >= 120.0f) { BigMessageInUse[0] = 120.0; - BigMessageAlpha[0] += (CTimer::GetTimeStep() * 0.02f * -255.0f); + BigMessageAlpha[0] += (CTimer::GetTimeStepInSeconds() * -255.0f); } if (BigMessageAlpha[0] <= 0.0f) { @@ -937,8 +937,8 @@ void CHud::Draw() } } else { - BigMessageX[0] += (CTimer::GetTimeStep() * 0.02f * 255.0f); - BigMessageAlpha[0] += (CTimer::GetTimeStep() * 0.02f * 255.0f); + BigMessageX[0] += (CTimer::GetTimeStepInSeconds() * 255.0f); + BigMessageAlpha[0] += (CTimer::GetTimeStepInSeconds() * 255.0f); if (BigMessageAlpha[0] >= 255.0f) BigMessageAlpha[0] = 255.0f; @@ -963,7 +963,7 @@ void CHud::Draw() // WastedBustedText if (m_BigMessage[2][0]) { if (BigMessageInUse[2] != 0.0f) { - BigMessageAlpha[2] += (CTimer::GetTimeStep() * 0.02f * 255.0f); + BigMessageAlpha[2] += (CTimer::GetTimeStepInSeconds() * 255.0f); if (BigMessageAlpha[2] > 255.0f) BigMessageAlpha[2] = 255.0; @@ -1045,7 +1045,7 @@ void CHud::DrawAfterFade() } break; case 2: - m_HelpMessageFadeTimer += 2 * (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_HelpMessageFadeTimer += 2 * CTimer::GetTimeStepInMilliseconds(); if (m_HelpMessageFadeTimer > 0) { m_HelpMessageState = 1; m_HelpMessageFadeTimer = 0; @@ -1053,7 +1053,7 @@ void CHud::DrawAfterFade() fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f; break; case 3: - m_HelpMessageFadeTimer -= 2 * (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds(); if (m_HelpMessageFadeTimer >= 0) { m_HelpMessageState = 0; m_HelpMessageFadeTimer = 0; @@ -1061,7 +1061,7 @@ void CHud::DrawAfterFade() fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f; break; case 4: - m_HelpMessageFadeTimer -= 2 * (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds(); if (m_HelpMessageFadeTimer >= 0) { m_HelpMessageState = 2; m_HelpMessageFadeTimer = 0; @@ -1073,7 +1073,7 @@ void CHud::DrawAfterFade() break; } - m_HelpMessageTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_HelpMessageTimer += CTimer::GetTimeStepInMilliseconds(); CFont::SetAlphaFade(fAlpha); CFont::SetCentreOff(); @@ -1121,7 +1121,7 @@ void CHud::DrawAfterFade() // Oddjob result if (OddJob2OffTimer > 0) - OddJob2OffTimer = OddJob2OffTimer - (CTimer::GetTimeStep() * 0.02f * 1000.0f); + OddJob2OffTimer = OddJob2OffTimer - CTimer::GetTimeStepInMilliseconds(); static float fStep; if (!m_BigMessage[1][0] && m_BigMessage[4][0] && m_BigMessage[5][0] && OddJob2OffTimer <= 0.0f) { @@ -1197,11 +1197,11 @@ void CHud::DrawAfterFade() CFont::SetRightJustifyOn(); CFont::SetFontStyle(FONT_HEADING); if (BigMessageX[1] >= (SCREEN_WIDTH - 20)) { - BigMessageInUse[1] += (CTimer::GetTimeStep() * 0.02f * 120.0f); + BigMessageInUse[1] += (CTimer::GetTimeStepInSeconds() * 120.0f); if (BigMessageInUse[1] >= 120.0f) { BigMessageInUse[1] = 120.0; - BigMessageAlpha[1] += (CTimer::GetTimeStep() * 0.02f * -255.0f); + BigMessageAlpha[1] += (CTimer::GetTimeStepInSeconds() * -255.0f); } if (BigMessageAlpha[1] <= 0) { m_BigMessage[1][0] = 0; @@ -1209,8 +1209,8 @@ void CHud::DrawAfterFade() } } else { - BigMessageX[1] += (CTimer::GetTimeStep() * 0.02f * 255.0f); - BigMessageAlpha[1] += (CTimer::GetTimeStep() * 0.02f * 255.0f); + BigMessageX[1] += (CTimer::GetTimeStepInSeconds() * 255.0f); + BigMessageAlpha[1] += (CTimer::GetTimeStepInSeconds() * 255.0f); if (BigMessageAlpha[1] >= 255.0f) BigMessageAlpha[1] = 255.0f; diff --git a/src/render/Particle.h b/src/render/Particle.h index 92b6809e..25677569 100644 --- a/src/render/Particle.h +++ b/src/render/Particle.h @@ -74,7 +74,7 @@ public: static void RemovePSystem(tParticleType type); static void RemoveParticle(CParticle *pParticle, CParticle *pPrevParticle, tParticleSystemData *pPSystemData); - static inline void _Next(CParticle *&pParticle, CParticle *&pPrevParticle, tParticleSystemData *pPSystemData, bool bRemoveParticle) + static void _Next(CParticle *&pParticle, CParticle *&pPrevParticle, tParticleSystemData *pPSystemData, bool bRemoveParticle) { if ( bRemoveParticle ) { -- cgit v1.2.3