diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-03-22 19:47:14 +0300 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-03-22 19:47:14 +0300 |
commit | 861506d048b7c4370f066e62233448979824bd68 (patch) | |
tree | caa435843c73aab13174a3b63bfb6dd759a9df73 /src/control | |
parent | d1d123dc6aeaa88702672c181377735e1b66125f (diff) | |
parent | 0e817230afb3a69ebc0acc16cb06d2021a17095e (diff) |
merge with upstream
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/Bridge.cpp | 16 | ||||
-rw-r--r-- | src/control/Cranes.h | 41 | ||||
-rw-r--r-- | src/control/PathFind.cpp | 4 | ||||
-rw-r--r-- | src/control/Pickups.cpp | 36 | ||||
-rw-r--r-- | src/control/Script.cpp | 2 |
5 files changed, 71 insertions, 28 deletions
diff --git a/src/control/Bridge.cpp b/src/control/Bridge.cpp index dacb7aab..6a577449 100644 --- a/src/control/Bridge.cpp +++ b/src/control/Bridge.cpp @@ -24,7 +24,7 @@ uint32& CBridge::TimeOfBridgeBecomingOperational = *(uint32*)0x8F2BC0; void CBridge::Init() { FindBridgeEntities(); - OldLift = -1.0; + OldLift = -1.0f; if (pLiftPart && pWeight) { DefaultZLiftPart = pLiftPart->GetPosition().z; @@ -60,32 +60,32 @@ void CBridge::Update() if (timeElapsed < 10000) { State = STATE_LIFT_PART_MOVING_DOWN; - liftHeight = 25.0 - timeElapsed / 10000.0 * 25.0; + liftHeight = 25.0f - timeElapsed / 10000.0f * 25.0f; } else if (timeElapsed < 40000) { - liftHeight = 0.0; + liftHeight = 0.0f; State = STATE_LIFT_PART_IS_DOWN; } else if (timeElapsed < 50000) { - liftHeight = 0.0; + liftHeight = 0.0f; State = STATE_LIFT_PART_ABOUT_TO_MOVE_UP; } else if (timeElapsed < 60000) { State = STATE_LIFT_PART_MOVING_UP; - liftHeight = (timeElapsed - 50000) / 10000.0 * 25.0; + liftHeight = (timeElapsed - 50000) / 10000.0f * 25.0f; } else { - liftHeight = 25.0; + liftHeight = 25.0f; State = STATE_LIFT_PART_IS_UP; } } else { - liftHeight = 25.0; + liftHeight = 25.0f; TimeOfBridgeBecomingOperational = 0; State = STATE_BRIDGE_LOCKED; } @@ -151,4 +151,4 @@ STARTPATCHES InjectHook(0x413D10, &CBridge::ShouldLightsBeFlashing, PATCH_JUMP); InjectHook(0x413D20, &CBridge::FindBridgeEntities, PATCH_JUMP); InjectHook(0x413DE0, &CBridge::ThisIsABridgeObjectMovingUp, PATCH_JUMP); -ENDPATCHES
\ No newline at end of file +ENDPATCHES diff --git a/src/control/Cranes.h b/src/control/Cranes.h index 9f606c9f..b40454ea 100644 --- a/src/control/Cranes.h +++ b/src/control/Cranes.h @@ -2,6 +2,47 @@ #include "common.h" class CVehicle; +class CEntity; +class CObject; + +class CCrane +{ +public: + CEntity *m_pObject; + CObject *m_pMagnet; + int m_nAudioEntity; + float m_fPickupX1; + float m_fPickupX2; + float m_fPickupY1; + float m_fPickupY2; + CVector m_vecDropoffTarget; + float m_fDropoffHeading; + float m_fPickupAngle; + float m_fDropoffAngle; + float m_fPickupDistance; + float m_fDropoffDistance; + float m_fAngle; + float m_fDistance; + float m_fHeight; + float m_fHookOffset; + float m_fHookHeight; + CVector m_vecHookInitPos; + CVector m_vecHookCurPos; + float m_fHookVelocityX; + float m_fHookVelocityY; + CVehicle *m_pVehiclePickedUp; + int m_nUpdateTimer; + char m_bCraneActive; + char m_bCraneStatus; + char m_bVehiclesCollected; + char m_bIsCrusher; + char m_bIsMilitaryCrane; + char field_125; + char m_bNotMilitaryCrane; + char gap_127[1]; +}; + +static_assert(sizeof(CCrane) == 128, "CCrane: error"); class CCranes { diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index 3a959049..daa27e57 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -991,7 +991,7 @@ float CPathFind::FindNodeOrientationForCarPlacement(int32 nodeId) { if(m_pathNodes[nodeId].numLinks == 0) - return 0.0; + return 0.0f; CVector dir = m_pathNodes[m_connections[m_pathNodes[nodeId].firstLink]].pos - m_pathNodes[nodeId].pos; dir.z = 0.0f; dir.Normalise(); @@ -1008,7 +1008,7 @@ CPathFind::FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, flo CVector dir; if(m_pathNodes[nodeId].numLinks == 0) - return 0.0; + return 0.0f; int bestNode = m_connections[m_pathNodes[nodeId].firstLink]; #ifdef FIX_BUGS diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 67c59101..53da89f4 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -1,27 +1,29 @@ #include "common.h"
#include "patcher.h"
#include "main.h"
-#include "Pickups.h"
+
#include "Camera.h"
-#include "Entity.h"
-#include "Timer.h"
-#include "Shadows.h"
#include "Coronas.h"
-#include "World.h"
+#include "Darkel.h"
+#include "Entity.h"
+#include "Explosion.h"
+#include "Font.h"
+#include "Garages.h"
+#include "General.h"
#include "ModelIndices.h"
-#include "PlayerPed.h"
#include "Object.h"
-#include "Pools.h"
#include "Pad.h"
+#include "Pickups.h"
+#include "PlayerPed.h"
+#include "PointLights.h"
+#include "Pools.h"
#include "Script.h"
-#include "Darkel.h"
-#include "Garages.h"
-#include "Explosion.h"
-#include "WaterLevel.h"
+#include "Shadows.h"
#include "SpecialFX.h"
-#include "PointLights.h"
#include "Sprite.h"
-#include "Font.h"
+#include "Timer.h"
+#include "WaterLevel.h"
+#include "World.h"
CPickup(&CPickups::aPickUps)[NUMPICKUPS] = *(CPickup(*)[NUMPICKUPS])*(uintptr*)0x878C98;
int16 CPickups::NumMessages;// = *(int16*)0x95CC98;
@@ -693,7 +695,7 @@ CPickups::DoPickUpEffects(CEntity *entity) CVector &pos = entity->GetPosition();
- float colorModifier = ((double)(rand() & 0x1F) * 0.015f + 1.0f) * modifiedSin * 0.15f;
+ float colorModifier = ((CGeneral::GetRandomNumber() & 0x1F) * 0.015f + 1.0f) * modifiedSin * 0.15f;
CShadows::StoreStaticShadow(
(uintptr)entity,
SHADOWTYPE_ADDITIVE,
@@ -704,9 +706,9 @@ CPickups::DoPickUpEffects(CEntity *entity) aWeaponReds[colorId] * colorModifier, aWeaponGreens[colorId] * colorModifier, aWeaponBlues[colorId] * colorModifier,
4.0f, 1.0f, 40.0f, false, 0.0f);
- float radius = (double)(rand() & 0xF) * 0.1 + 3.0;
+ float radius = (CGeneral::GetRandomNumber() & 0xF) * 0.1f + 3.0f;
CPointLights::AddLight(CPointLights::LIGHT_POINT, pos, CVector(0.0f, 0.0f, 0.0f), radius, aWeaponReds[colorId] * modifiedSin / 256.0f, aWeaponGreens[colorId] * modifiedSin / 256.0f, aWeaponBlues[colorId] * modifiedSin / 256.0f, CPointLights::FOG_NONE, true);
- float size = (double)(rand() & 0xF) * 0.0005 + 0.6;
+ float size = (CGeneral::GetRandomNumber() & 0xF) * 0.0005f + 0.6f;
CCoronas::RegisterCorona( (uintptr)entity,
aWeaponReds[colorId] * modifiedSin / 2.0f, aWeaponGreens[colorId] * modifiedSin / 2.0f, aWeaponBlues[colorId] * modifiedSin / 2.0f,
255,
@@ -1044,4 +1046,4 @@ STARTPATCHES InjectHook(0x433E40, CPickups::Save, PATCH_JUMP);
InjectHook(0x433BA0, &CPickup::GiveUsAPickUpObject, PATCH_JUMP);
InjectHook(0x430860, &CPickup::Update, PATCH_JUMP);
-ENDPATCHES
\ No newline at end of file +ENDPATCHES
diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 75c594cf..7c563492 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -174,7 +174,7 @@ void CMissionCleanup::Process() { CPopulation::m_AllRandomPedsThisType = -1; CPopulation::PedDensityMultiplier = 1.0f; - CCarCtrl::CarDensityMultiplier = 1.0; + CCarCtrl::CarDensityMultiplier = 1.0f; FindPlayerPed()->m_pWanted->m_fCrimeSensitivity = 1.0f; TheCamera.Restore(); TheCamera.SetWideScreenOff(); |