2020-12-21 13:16:29 -03:00
|
|
|
#pragma once
|
2021-09-25 15:59:51 +03:00
|
|
|
#include <cstdint>
|
|
|
|
#include <string>
|
2021-08-28 13:27:58 +02:00
|
|
|
#include <vector>
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Game/animation.h"
|
2021-12-24 03:32:19 +03:00
|
|
|
#include "Game/itemdata/itemdata.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Specific/newtypes.h"
|
2021-12-24 03:32:19 +03:00
|
|
|
#include "Specific/phd_global.h"
|
2021-09-19 23:41:26 +03:00
|
|
|
|
|
|
|
enum GAME_OBJECT_ID : short;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-13 02:04:24 +11:00
|
|
|
// used by fx->shade !
|
|
|
|
#define RGB555(r, g, b) ((r << 7) & 0x7C00 | (g << 2) & 0x3E0 | (b >> 3) & 0x1F)
|
|
|
|
#define WHITE555 RGB555(255, 255, 255)
|
|
|
|
#define GRAY555 RGB555(128, 128, 128)
|
|
|
|
#define BLACK555 RGB555( 0, 0, 0)
|
|
|
|
|
2021-10-08 16:45:45 +03:00
|
|
|
constexpr unsigned int NO_MESH_BITS = UINT_MAX;
|
|
|
|
|
2022-03-13 02:04:24 +11:00
|
|
|
constexpr auto NO_ITEM = -1;
|
|
|
|
constexpr auto ALL_MESHBITS = -1;
|
|
|
|
constexpr auto NOT_TARGETABLE = -16384;
|
|
|
|
constexpr auto NUM_ITEMS = 1024;
|
|
|
|
|
2021-07-18 15:22:15 +01:00
|
|
|
enum AIObjectType
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
|
|
|
NO_AI = 0x0000,
|
|
|
|
GUARD = 0x0001,
|
|
|
|
AMBUSH = 0x0002,
|
|
|
|
PATROL1 = 0x0004,
|
|
|
|
MODIFY = 0x0008,
|
|
|
|
FOLLOW = 0x0010,
|
|
|
|
PATROL2 = 0x0020,
|
|
|
|
ALL_AIOBJ = (GUARD | AMBUSH | PATROL1 | MODIFY | FOLLOW | PATROL2)
|
|
|
|
};
|
|
|
|
|
2021-07-18 15:22:15 +01:00
|
|
|
enum ItemStatus
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-05-13 10:11:22 +02:00
|
|
|
ITEM_NOT_ACTIVE = 0,
|
|
|
|
ITEM_ACTIVE = 1,
|
|
|
|
ITEM_DEACTIVATED = 2,
|
|
|
|
ITEM_INVISIBLE = 3
|
2020-12-21 13:16:29 -03:00
|
|
|
};
|
|
|
|
|
2021-07-18 15:22:15 +01:00
|
|
|
enum ItemFlags
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
|
|
|
IFLAG_CLEAR_BODY = (1 << 7), // 0x0080
|
|
|
|
IFLAG_INVISIBLE = (1 << 8), // 0x0100
|
|
|
|
IFLAG_REVERSE = (1 << 14), // 0x4000
|
|
|
|
IFLAG_KILLED = (1 << 15), // 0x8000
|
|
|
|
IFLAG_ACTIVATION_MASK = 0x3E00 // bits 9-13
|
|
|
|
};
|
|
|
|
|
2022-03-13 02:04:24 +11:00
|
|
|
struct EntityAnimationData
|
|
|
|
{
|
|
|
|
int AnimNumber;
|
|
|
|
int FrameNumber;
|
|
|
|
int ActiveState;
|
|
|
|
int TargetState;
|
|
|
|
int RequiredState; // TODO: Phase out this weird feature.
|
|
|
|
|
|
|
|
bool Airborne;
|
|
|
|
int Velocity;
|
|
|
|
int VerticalVelocity;
|
|
|
|
int LateralVelocity;
|
|
|
|
std::vector<BONE_MUTATOR> Mutator;
|
|
|
|
};
|
|
|
|
|
2021-09-25 15:59:51 +03:00
|
|
|
struct ITEM_INFO
|
2021-09-19 23:41:26 +03:00
|
|
|
{
|
2022-02-09 16:55:46 +11:00
|
|
|
GAME_OBJECT_ID ObjectNumber;
|
2022-03-14 01:20:51 +11:00
|
|
|
std::string LuaName;
|
2022-03-06 18:59:04 +11:00
|
|
|
short NextItem;
|
|
|
|
short NextActive;
|
|
|
|
|
2022-03-13 02:04:24 +11:00
|
|
|
bool Active;
|
2022-03-14 01:20:51 +11:00
|
|
|
int Status; // ItemStatus enum.
|
|
|
|
short RoomNumber;
|
|
|
|
ROOM_VECTOR Location;
|
|
|
|
int BoxNumber;
|
|
|
|
int Timer;
|
|
|
|
int Floor;
|
|
|
|
short Shade;
|
|
|
|
int HitPoints;
|
|
|
|
|
2022-03-13 02:04:24 +11:00
|
|
|
bool HitStatus;
|
|
|
|
bool LookedAt;
|
2022-03-14 01:20:51 +11:00
|
|
|
bool Collidable;
|
2022-03-13 02:04:24 +11:00
|
|
|
bool InDrawRoom;
|
|
|
|
|
|
|
|
ITEM_DATA Data;
|
|
|
|
EntityAnimationData Animation;
|
2022-02-09 16:55:46 +11:00
|
|
|
PHD_3DPOS Position;
|
2022-03-13 02:04:24 +11:00
|
|
|
PHD_3DPOS StartPosition;
|
2022-03-06 18:59:04 +11:00
|
|
|
|
2022-03-14 01:20:51 +11:00
|
|
|
uint32_t TouchBits;
|
2022-03-06 18:59:04 +11:00
|
|
|
uint32_t MeshBits;
|
2022-02-09 16:55:46 +11:00
|
|
|
|
2022-03-14 01:20:51 +11:00
|
|
|
uint16_t Flags; // ItemFlags enum
|
2022-02-09 16:55:46 +11:00
|
|
|
short ItemFlags[8];
|
|
|
|
short TriggerFlags;
|
|
|
|
uint32_t SwapMeshFlags;
|
|
|
|
|
2022-03-06 20:45:50 +11:00
|
|
|
// TODO: Move to CreatureInfo?
|
|
|
|
uint8_t AIBits; // AIObjectType enum.
|
|
|
|
short AfterDeath;
|
|
|
|
short CarriedItem;
|
2021-09-19 23:41:26 +03:00
|
|
|
};
|
2020-12-21 13:16:29 -03:00
|
|
|
|
|
|
|
void EffectNewRoom(short fxNumber, short roomNumber);
|
2022-03-07 14:30:56 +11:00
|
|
|
void ItemNewRoom(short itemNumber, short roomNumber);
|
2020-12-21 13:16:29 -03:00
|
|
|
void AddActiveItem(short itemNumber);
|
2022-03-07 14:30:56 +11:00
|
|
|
void ClearItem(short itemNumber);
|
2020-12-21 13:16:29 -03:00
|
|
|
short CreateItem();
|
|
|
|
void RemoveAllItemsInRoom(short roomNumber, short objectNumber);
|
2022-03-07 14:30:56 +11:00
|
|
|
void RemoveActiveItem(short itemNumber);
|
|
|
|
void RemoveDrawnItem(short itemNumber);
|
|
|
|
void InitialiseFXArray(int allocateMemory);
|
|
|
|
short CreateNewEffect(short roomNumber);
|
2020-12-21 13:16:29 -03:00
|
|
|
void KillEffect(short fxNumber);
|
2022-03-07 14:30:56 +11:00
|
|
|
void InitialiseItem(short itemNumber);
|
|
|
|
void InitialiseItemArray(int totalItems);
|
|
|
|
void KillItem(short itemNumber);
|
2022-02-02 18:28:23 +11:00
|
|
|
void UpdateItemRoom(ITEM_INFO* item, int height, int xOffset = 0, int zOffset = 0);
|
2021-09-15 14:24:03 +03:00
|
|
|
std::vector<int> FindAllItems(short objectNumber);
|
2022-03-07 14:30:56 +11:00
|
|
|
ITEM_INFO* FindItem(int objectNumber);
|
2021-09-17 15:32:55 +03:00
|
|
|
int FindItem(ITEM_INFO* item);
|