2020-04-09 20:50:24 +02:00
|
|
|
#pragma once
|
|
|
|
#include "Weapon.h"
|
|
|
|
|
|
|
|
enum ePickupType : uint8
|
|
|
|
{
|
|
|
|
PICKUP_NONE = 0,
|
|
|
|
PICKUP_IN_SHOP,
|
|
|
|
PICKUP_ON_STREET,
|
|
|
|
PICKUP_ONCE,
|
|
|
|
PICKUP_ONCE_TIMEOUT,
|
2020-05-10 16:54:13 +02:00
|
|
|
PICKUP_ONCE_TIMEOUT_SLOW,
|
2020-04-09 20:50:24 +02:00
|
|
|
PICKUP_COLLECTABLE1,
|
|
|
|
PICKUP_IN_SHOP_OUT_OF_STOCK,
|
|
|
|
PICKUP_MONEY,
|
|
|
|
PICKUP_MINE_INACTIVE,
|
|
|
|
PICKUP_MINE_ARMED,
|
|
|
|
PICKUP_NAUTICAL_MINE_INACTIVE,
|
|
|
|
PICKUP_NAUTICAL_MINE_ARMED,
|
|
|
|
PICKUP_FLOATINGPACKAGE,
|
|
|
|
PICKUP_FLOATINGPACKAGE_FLOATING,
|
|
|
|
PICKUP_ON_STREET_SLOW,
|
2020-05-10 16:54:13 +02:00
|
|
|
PICKUP_ASSET_REVENUE,
|
|
|
|
PICKUP_PROPERTY_LOCKED,
|
|
|
|
PICKUP_PROPERTY_FORSALE,
|
2020-04-09 20:50:24 +02:00
|
|
|
PICKUP_NUMOFTYPES
|
|
|
|
};
|
|
|
|
|
|
|
|
class CEntity;
|
|
|
|
class CObject;
|
|
|
|
class CVehicle;
|
|
|
|
class CPlayerPed;
|
|
|
|
|
|
|
|
class CPickup
|
|
|
|
{
|
|
|
|
public:
|
2020-07-30 14:11:06 +02:00
|
|
|
CVector m_vecPos;
|
2020-10-17 07:23:01 +02:00
|
|
|
float m_fRevenue;
|
2020-04-09 20:50:24 +02:00
|
|
|
CObject *m_pObject;
|
2020-07-30 14:11:06 +02:00
|
|
|
CObject *m_pExtraObject;
|
2020-10-17 07:23:01 +02:00
|
|
|
uint32 m_nQuantity;
|
2020-04-09 20:50:24 +02:00
|
|
|
uint32 m_nTimer;
|
2020-10-17 07:23:01 +02:00
|
|
|
uint16 m_nMoneySpeed;
|
2020-04-09 20:50:24 +02:00
|
|
|
int16 m_eModelIndex;
|
|
|
|
uint16 m_nIndex;
|
2020-07-30 14:11:06 +02:00
|
|
|
char m_sTextKey[8];
|
|
|
|
ePickupType m_eType;
|
|
|
|
bool m_bRemoved;
|
2020-10-21 20:00:13 +02:00
|
|
|
uint8 m_bWasAmmoCollected:1;
|
|
|
|
uint8 m_bWasControlMessageShown:1;
|
2020-04-09 20:50:24 +02:00
|
|
|
|
2020-10-17 07:23:01 +02:00
|
|
|
CObject *GiveUsAPickUpObject(CObject **object, CObject **extraObject, int32 handle, int32 extraHandle);
|
2020-04-09 20:50:24 +02:00
|
|
|
bool Update(CPlayerPed *player, CVehicle *vehicle, int playerId);
|
2020-10-17 07:23:01 +02:00
|
|
|
void GetRidOfObjects();
|
2020-10-21 20:00:13 +02:00
|
|
|
void ExtractAmmoFromPickup(CPlayerPed *player);
|
|
|
|
void ProcessGunShot(CVector *vec1, CVector *vec2);
|
2020-04-09 20:50:24 +02:00
|
|
|
private:
|
2020-10-21 20:00:13 +02:00
|
|
|
inline bool IsMine() { return m_eType >= PICKUP_MINE_INACTIVE && m_eType <= PICKUP_FLOATINGPACKAGE_FLOATING; }
|
2020-05-16 22:06:33 +02:00
|
|
|
inline bool CanBePickedUp(CPlayerPed *player, int playerId);
|
2020-10-21 20:00:13 +02:00
|
|
|
inline void Remove();
|
2020-04-09 20:50:24 +02:00
|
|
|
};
|
|
|
|
|
2020-05-10 17:49:33 +02:00
|
|
|
VALIDATE_SIZE(CPickup, 0x1C);
|
2020-04-09 20:50:24 +02:00
|
|
|
|
|
|
|
struct tPickupMessage
|
|
|
|
{
|
|
|
|
CVector2D m_pos;
|
|
|
|
eWeaponType m_weaponType;
|
|
|
|
CVector2D m_dist;
|
|
|
|
CRGBA m_color;
|
2020-10-17 14:57:12 +02:00
|
|
|
uint8 m_bOutOfStock;
|
2020-04-09 20:50:24 +02:00
|
|
|
uint8 m_quantity;
|
2020-10-17 14:57:12 +02:00
|
|
|
uint16 money;
|
2020-04-09 20:50:24 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class CPickups
|
|
|
|
{
|
|
|
|
static int32 aPickUpsCollected[NUMCOLLECTEDPICKUPS];
|
|
|
|
static int16 CollectedPickUpIndex;
|
|
|
|
static int16 NumMessages;
|
|
|
|
static tPickupMessage aMessages[NUMPICKUPMESSAGES];
|
|
|
|
public:
|
2020-06-09 15:50:00 +02:00
|
|
|
static int32 PlayerOnWeaponPickup;
|
|
|
|
|
2020-04-09 20:50:24 +02:00
|
|
|
static void Init();
|
|
|
|
static void Update();
|
|
|
|
static void RenderPickUpText();
|
|
|
|
static void DoCollectableEffects(CEntity *ent);
|
|
|
|
static void DoMoneyEffects(CEntity *ent);
|
|
|
|
static void DoMineEffects(CEntity *ent);
|
|
|
|
static void DoPickUpEffects(CEntity *ent);
|
2020-07-30 14:11:06 +02:00
|
|
|
static int32 GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quantity, uint32 rate = 0, bool highPriority = false, char* pText = nil);
|
2020-04-09 20:50:24 +02:00
|
|
|
static int32 GenerateNewOne_WeaponType(CVector pos, eWeaponType weaponType, uint8 type, uint32 quantity);
|
|
|
|
static void RemovePickUp(int32 pickupIndex);
|
|
|
|
static void AddToCollectedPickupsArray(int32 index);
|
|
|
|
static bool IsPickUpPickedUp(int32 pickupId);
|
|
|
|
static int32 ModelForWeapon(eWeaponType weaponType);
|
|
|
|
static enum eWeaponType WeaponForModel(int32 model);
|
|
|
|
static int32 GetActualPickupIndex(int32 index);
|
|
|
|
static int32 GetNewUniquePickupIndex(int32 slot);
|
|
|
|
static void PassTime(uint32 time);
|
|
|
|
static bool GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex);
|
2020-05-17 19:36:48 +02:00
|
|
|
static bool TestForPickupsInBubble(CVector pos, float range);
|
|
|
|
static bool TryToMerge_WeaponType(CVector pos, eWeaponType weapon, uint8 type, uint32 quantity, bool unused);
|
2020-05-20 19:10:05 +02:00
|
|
|
static void CreateSomeMoney(CVector, int);
|
2020-10-21 20:00:13 +02:00
|
|
|
static void DetonateMinesHitByGunShot(CVector *vec1, CVector *vec2);
|
2020-11-10 22:08:32 +01:00
|
|
|
static void RemoveUnnecessaryPickups(const CVector& center, float radius);
|
2020-04-09 20:50:24 +02:00
|
|
|
static void Load(uint8 *buf, uint32 size);
|
|
|
|
static void Save(uint8 *buf, uint32 *size);
|
|
|
|
|
2020-04-17 07:54:14 +02:00
|
|
|
static CPickup aPickUps[NUMPICKUPS];
|
2020-04-09 20:50:24 +02:00
|
|
|
|
|
|
|
// unused
|
2020-04-17 07:54:14 +02:00
|
|
|
static bool bPickUpcamActivated;
|
|
|
|
static CVehicle *pPlayerVehicle;
|
|
|
|
static CVector StaticCamCoors;
|
|
|
|
static uint32 StaticCamStartTime;
|
2020-08-27 18:52:43 +02:00
|
|
|
|
2020-10-17 07:23:01 +02:00
|
|
|
static void RemoveAllPickupsOfACertainWeaponGroupWithNoAmmo(eWeaponType);
|
2020-10-17 14:57:12 +02:00
|
|
|
static CPickup *FindPickUpForThisObject(CEntity*);
|
2020-04-09 20:50:24 +02:00
|
|
|
};
|
|
|
|
|
2020-10-17 16:53:27 +02:00
|
|
|
extern uint16 AmmoForWeapon[WEAPONTYPE_TOTALWEAPONS + 1];
|
|
|
|
extern uint16 AmmoForWeapon_OnStreet[WEAPONTYPE_TOTALWEAPONS + 1];
|
|
|
|
extern uint16 CostOfWeapon[WEAPONTYPE_TOTALWEAPONS + 3];
|
2020-04-09 20:50:24 +02:00
|
|
|
|
2020-10-21 20:00:13 +02:00
|
|
|
extern int32 CollectPickupBuffer;
|
|
|
|
|
2020-04-12 22:50:34 +02:00
|
|
|
enum ePacmanPickupType
|
|
|
|
{
|
|
|
|
PACMAN_NONE,
|
|
|
|
PACMAN_SCRAMBLE,
|
|
|
|
PACMAN_RACE,
|
|
|
|
};
|
|
|
|
|
|
|
|
class CPacManPickup
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CVector m_vecPosn;
|
|
|
|
CObject *m_pObject;
|
|
|
|
uint8 m_eType;
|
|
|
|
|
|
|
|
void Update();
|
|
|
|
};
|
|
|
|
|
2020-04-09 20:50:24 +02:00
|
|
|
class CPacManPickups
|
|
|
|
{
|
2020-04-12 22:50:34 +02:00
|
|
|
friend CPacManPickup;
|
|
|
|
|
|
|
|
static CPacManPickup aPMPickUps[NUMPACMANPICKUPS];
|
|
|
|
static CVector LastPickUpCoors;
|
|
|
|
static int PillsEatenInRace;
|
|
|
|
static bool bPMActive;
|
2020-04-09 20:50:24 +02:00
|
|
|
public:
|
|
|
|
static void Init(void);
|
|
|
|
static void Update(void);
|
|
|
|
static void GeneratePMPickUps(CVector, float, int16, uint8);
|
|
|
|
static void GeneratePMPickUpsForRace(int32);
|
|
|
|
static void GenerateOnePMPickUp(CVector);
|
|
|
|
static void Render(void);
|
|
|
|
static void StartPacManRace(int32);
|
|
|
|
static void StartPacManRecord(void);
|
|
|
|
static uint32 QueryPowerPillsEatenInRace(void);
|
|
|
|
static void ResetPowerPillsEatenInRace(void);
|
2020-04-12 22:50:34 +02:00
|
|
|
static void ClearPMPickUps(void);
|
2020-04-09 20:50:24 +02:00
|
|
|
static void CleanUpPacManStuff(void);
|
|
|
|
static void StartPacManScramble(CVector, float, int16);
|
|
|
|
static uint32 QueryPowerPillsCarriedByPlayer(void);
|
|
|
|
static void ResetPowerPillsCarriedByPlayer(void);
|
|
|
|
|
|
|
|
};
|