summaryrefslogtreecommitdiffstats
path: root/src/control/Cranes.h
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-04-06 01:01:03 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-04-06 01:01:03 +0200
commit7f8a78e5decdf23bf0d06674c336f4e3169eaa6a (patch)
treeee0c2b666cacfd6f6a0ee9f36eca6237a78a6df2 /src/control/Cranes.h
parentMerge branch 'master' into garages_dev (diff)
downloadre3-7f8a78e5decdf23bf0d06674c336f4e3169eaa6a.tar
re3-7f8a78e5decdf23bf0d06674c336f4e3169eaa6a.tar.gz
re3-7f8a78e5decdf23bf0d06674c336f4e3169eaa6a.tar.bz2
re3-7f8a78e5decdf23bf0d06674c336f4e3169eaa6a.tar.lz
re3-7f8a78e5decdf23bf0d06674c336f4e3169eaa6a.tar.xz
re3-7f8a78e5decdf23bf0d06674c336f4e3169eaa6a.tar.zst
re3-7f8a78e5decdf23bf0d06674c336f4e3169eaa6a.zip
Diffstat (limited to '')
-rw-r--r--src/control/Cranes.h67
1 files changed, 36 insertions, 31 deletions
diff --git a/src/control/Cranes.h b/src/control/Cranes.h
index c121378b..d9817282 100644
--- a/src/control/Cranes.h
+++ b/src/control/Cranes.h
@@ -6,6 +6,7 @@
class CVehicle;
class CEntity;
class CObject;
+class CBuilding;
class CCrane
{
@@ -14,7 +15,7 @@ public:
IDLE = 0,
GOING_TOWARDS_TARGET = 1,
LIFTING_TARGET = 2,
- GOING_TOWARDS_HEIGHT_TARGET = 3,
+ GOING_TOWARDS_TARGET_ONLY_HEIGHT = 3,
ROTATING_TARGET = 4,
DROPPING_TARGET = 5
};
@@ -23,8 +24,8 @@ public:
ACTIVATED = 1,
DEACTIVATED = 2
};
- CEntity *m_pObject;
- CObject *m_pMagnet;
+ CBuilding *m_pCraneEntity;
+ CObject *m_pHook;
int32 m_nAudioEntity;
float m_fPickupX1;
float m_fPickupX2;
@@ -36,20 +37,19 @@ public:
float m_fDropoffAngle;
float m_fPickupDistance;
float m_fDropoffDistance;
- float m_fAngle;
- float m_fDistance;
- float m_fHeight;
+ float m_fPickupHeight;
+ float m_fDropoffHeight;
+ float m_fHookAngle;
float m_fHookOffset;
float m_fHookHeight;
CVector m_vecHookInitPos;
CVector m_vecHookCurPos;
- float m_fHookVelocityX;
- float m_fHookVelocityY;
+ CVector2D m_vecHookVelocity;
CVehicle *m_pVehiclePickedUp;
- uint32 m_nUpdateTimer;
- CraneStatus m_bCraneStatus;
- CraneState m_bCraneState;
- uint8 m_bVehiclesCollected;
+ uint32 m_nTimeForNextCheck;
+ CraneStatus m_nCraneStatus;
+ CraneState m_nCraneState;
+ uint8 m_nVehiclesCollected;
bool m_bIsCrusher;
bool m_bIsMilitaryCrane;
bool m_bWasMilitaryCrane;
@@ -57,14 +57,19 @@ public:
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();
+ bool RotateCarriedCarProperly(void);
+ void FindCarInSectorList(CPtrList* pList);
+ bool DoesCranePickUpThisCarType(uint32 mi);
+ bool GoTowardsTarget(float fAngleToTarget, float fDistanceToTarget, float fTargetHeight, float fSpeedMultiplier = 1.0f);
+ bool GoTowardsHeightTarget(float fTargetHeight, float fSpeedMultiplier = 1.0f);
+ void FindParametersForTarget(float X, float Y, float Z, float* pAngle, float* pDistance, float* pHeight);
+ void CalcHookCoordinates(float* pX, float* pY, float* pZ);
+ void SetHookMatrix(void);
+
+ float GetHeightToPickup() { return 4.0f + m_fPickupHeight + (m_bIsCrusher ? 4.5f : 0.0f); };
+ float GetHeightToDropoff() { return m_bIsCrusher ? (2.0f + m_fDropoffHeight + 3.0f) : (2.0f + m_fDropoffHeight); }
+ float GetHeightToPickupHeight() { return m_fPickupHeight + (m_bIsCrusher ? 7.0f : 4.0f); }
+ float GetHeightToDropoffHeight() { return m_fDropoffHeight + (m_bIsCrusher ? 7.0f : 2.0f); }
};
static_assert(sizeof(CCrane) == 128, "CCrane: error");
@@ -73,19 +78,19 @@ class CCranes
{
public:
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 bool IsThisCarPickedUp(float, float, CVehicle*);
+ static void AddThisOneCrane(CEntity* pCraneEntity);
+ static void ActivateCrane(float fInfX, float fSupX, float fInfY, float fSupY, float fDropOffX, float fDropOffY, float fDropOffZ, float fHeading, bool bIsCrusher, bool bIsMilitary, float fPosX, float fPosY);
+ static void DeActivateCrane(float fX, float fY);
+ static bool IsThisCarPickedUp(float fX, float fY, CVehicle* pVehicle);
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 bool DoesMilitaryCraneHaveThisOneAlready(uint32 mi);
+ static void RegisterCarForMilitaryCrane(uint32 mi);
+ static bool HaveAllCarsBeenCollectedByMilitaryCrane(void);
+ static bool IsThisCarBeingCarriedByAnyCrane(CVehicle* pVehicle);
+ static bool IsThisCarBeingTargettedByAnyCrane(CVehicle* pVehicle);
+ static void Save(uint8* buf, uint32* size);
- static int32& CarsCollectedMilitaryCrane;
+ static uint32& CarsCollectedMilitaryCrane;
static int32& NumCranes;
static CCrane(&aCranes)[NUM_CRANES];
};