From 057b28e39b2e58aae1f47d44bd1ce6222a781978 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 5 Apr 2020 12:35:51 +0300 Subject: cranes init --- src/control/Cranes.h | 62 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 15 deletions(-) (limited to 'src/control/Cranes.h') diff --git a/src/control/Cranes.h b/src/control/Cranes.h index b40454ea..c121378b 100644 --- a/src/control/Cranes.h +++ b/src/control/Cranes.h @@ -1,6 +1,8 @@ #pragma once #include "common.h" +#include "World.h" + class CVehicle; class CEntity; class CObject; @@ -8,9 +10,22 @@ class CObject; class CCrane { public: + enum CraneState : uint8 { + IDLE = 0, + GOING_TOWARDS_TARGET = 1, + LIFTING_TARGET = 2, + GOING_TOWARDS_HEIGHT_TARGET = 3, + ROTATING_TARGET = 4, + DROPPING_TARGET = 5 + }; + enum CraneStatus : uint8 { + NONE = 0, + ACTIVATED = 1, + DEACTIVATED = 2 + }; CEntity *m_pObject; CObject *m_pMagnet; - int m_nAudioEntity; + int32 m_nAudioEntity; float m_fPickupX1; float m_fPickupX2; float m_fPickupY1; @@ -31,15 +46,25 @@ public: 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]; + uint32 m_nUpdateTimer; + CraneStatus m_bCraneStatus; + CraneState m_bCraneState; + uint8 m_bVehiclesCollected; + bool m_bIsCrusher; + bool m_bIsMilitaryCrane; + bool m_bWasMilitaryCrane; + bool m_bIsTop; + + void Init(void) { memset(this, 0, sizeof(*this)); } + void Update(void); + bool RotateCarriedCarProperly(); + void FindCarInSectorList(CPtrList*); + bool DoesCranePickUpThisCarType(uint32); + bool GoTowardsTarget(float, float, float, float); + bool GoTowardsHeightTarget(float, float); + void FindParametersForTarget(float, float, float, float*, float*, float*); + void CalcHookCoordinates(float*, float*, float*); + void SetHookMatrix(); }; static_assert(sizeof(CCrane) == 128, "CCrane: error"); @@ -47,15 +72,22 @@ static_assert(sizeof(CCrane) == 128, "CCrane: error"); class CCranes { public: - static bool IsThisCarBeingTargettedByAnyCrane(CVehicle*); - static bool IsThisCarBeingCarriedByAnyCrane(CVehicle*); - static bool IsThisCarPickedUp(float, float, CVehicle*); - static bool HaveAllCarsBeenCollectedByMilitaryCrane(); + static void InitCranes(void); + static void AddThisOneCrane(CEntity*); static void ActivateCrane(float, float, float, float, float, float, float, float, bool, bool, float, float); static void DeActivateCrane(float, float); - static void InitCranes(void); + static bool IsThisCarPickedUp(float, float, CVehicle*); static void UpdateCranes(void); + static bool DoesMilitaryCraneHaveThisOneAlready(uint32); + static void RegisterCarForMilitaryCrane(uint32); + static bool HaveAllCarsBeenCollectedByMilitaryCrane(); + static bool IsThisCarBeingCarriedByAnyCrane(CVehicle*); + static bool IsThisCarBeingTargettedByAnyCrane(CVehicle*); static void Save(uint8*, uint32*); + + static int32& CarsCollectedMilitaryCrane; + static int32& NumCranes; + static CCrane(&aCranes)[NUM_CRANES]; }; void CranesLoad(uint8*, uint32); // is this really outside CCranes? -- cgit v1.2.3