2019-08-11 17:11:54 +00:00
|
|
|
#pragma once
|
|
|
|
#include "common.h"
|
|
|
|
|
2020-04-05 09:35:51 +00:00
|
|
|
#include "World.h"
|
|
|
|
|
2019-08-11 17:11:54 +00:00
|
|
|
class CVehicle;
|
2020-02-24 19:40:39 +00:00
|
|
|
class CEntity;
|
|
|
|
class CObject;
|
|
|
|
|
|
|
|
class CCrane
|
|
|
|
{
|
|
|
|
public:
|
2020-04-05 09:35:51 +00:00
|
|
|
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
|
|
|
|
};
|
2020-02-24 19:40:39 +00:00
|
|
|
CEntity *m_pObject;
|
|
|
|
CObject *m_pMagnet;
|
2020-04-05 09:35:51 +00:00
|
|
|
int32 m_nAudioEntity;
|
2020-02-24 19:40:39 +00:00
|
|
|
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;
|
2020-04-05 09:35:51 +00:00
|
|
|
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();
|
2020-02-24 19:40:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static_assert(sizeof(CCrane) == 128, "CCrane: error");
|
2019-08-11 17:11:54 +00:00
|
|
|
|
|
|
|
class CCranes
|
|
|
|
{
|
|
|
|
public:
|
2020-04-05 09:35:51 +00:00
|
|
|
static void InitCranes(void);
|
|
|
|
static void AddThisOneCrane(CEntity*);
|
2019-10-13 11:46:09 +00:00
|
|
|
static void ActivateCrane(float, float, float, float, float, float, float, float, bool, bool, float, float);
|
|
|
|
static void DeActivateCrane(float, float);
|
2020-04-05 09:35:51 +00:00
|
|
|
static bool IsThisCarPickedUp(float, float, CVehicle*);
|
2019-10-18 22:23:40 +00:00
|
|
|
static void UpdateCranes(void);
|
2020-04-05 09:35:51 +00:00
|
|
|
static bool DoesMilitaryCraneHaveThisOneAlready(uint32);
|
|
|
|
static void RegisterCarForMilitaryCrane(uint32);
|
|
|
|
static bool HaveAllCarsBeenCollectedByMilitaryCrane();
|
|
|
|
static bool IsThisCarBeingCarriedByAnyCrane(CVehicle*);
|
|
|
|
static bool IsThisCarBeingTargettedByAnyCrane(CVehicle*);
|
2020-03-11 03:25:50 +00:00
|
|
|
static void Save(uint8*, uint32*);
|
2020-04-05 09:35:51 +00:00
|
|
|
|
|
|
|
static int32& CarsCollectedMilitaryCrane;
|
|
|
|
static int32& NumCranes;
|
|
|
|
static CCrane(&aCranes)[NUM_CRANES];
|
2019-08-11 17:11:54 +00:00
|
|
|
};
|
2020-03-11 03:25:50 +00:00
|
|
|
|
|
|
|
void CranesLoad(uint8*, uint32); // is this really outside CCranes?
|