2020-05-30 15:55:23 +02:00
|
|
|
#pragma once
|
2021-12-24 03:32:19 +03:00
|
|
|
#include "framework.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Game/collision/floordata.h"
|
2021-12-24 03:32:19 +03:00
|
|
|
#include "Specific/newtypes.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Specific/phd_global.h"
|
2020-05-30 15:55:23 +02:00
|
|
|
|
2022-03-14 01:20:51 +11:00
|
|
|
struct TriggerVolume;
|
2021-09-19 23:41:26 +03:00
|
|
|
|
2021-10-28 06:04:13 +02:00
|
|
|
constexpr auto MAX_FLIPMAP = 256;
|
2020-07-25 18:02:35 +02:00
|
|
|
|
2020-06-28 15:51:33 +02:00
|
|
|
struct ROOM_VERTEX
|
2020-05-30 15:55:23 +02:00
|
|
|
{
|
2020-06-28 15:51:33 +02:00
|
|
|
Vector3 position;
|
|
|
|
Vector3 normal;
|
|
|
|
Vector2 textureCoordinates;
|
|
|
|
Vector3 color;
|
|
|
|
int effects;
|
2020-07-03 07:05:33 +02:00
|
|
|
int index;
|
2020-05-30 15:55:23 +02:00
|
|
|
};
|
|
|
|
|
2020-06-26 07:06:18 +02:00
|
|
|
struct ROOM_DOOR
|
|
|
|
{
|
|
|
|
short room;
|
|
|
|
Vector3 normal;
|
|
|
|
Vector3 vertices[4];
|
|
|
|
};
|
|
|
|
|
2021-07-18 15:22:15 +01:00
|
|
|
struct ROOM_LIGHT
|
2020-05-30 15:55:23 +02:00
|
|
|
{
|
2020-07-26 16:17:54 +02:00
|
|
|
int x, y, z; // Position of light, in world coordinates
|
2020-05-30 15:55:23 +02:00
|
|
|
float r, g, b; // Colour of the light
|
2020-07-26 16:17:54 +02:00
|
|
|
float intensity;
|
2020-06-26 07:06:18 +02:00
|
|
|
float in; // Cosine of the IN value for light / size of IN value
|
|
|
|
float out; // Cosine of the OUT value for light / size of OUT value
|
2020-07-26 16:17:54 +02:00
|
|
|
float length; // Range of light
|
|
|
|
float cutoff; // Range of light
|
2020-05-30 15:55:23 +02:00
|
|
|
float dx, dy, dz; // Direction - used only by sun and spot lights
|
2020-06-26 07:06:18 +02:00
|
|
|
byte type;
|
2020-07-26 16:17:54 +02:00
|
|
|
bool castShadows;
|
2020-05-30 15:55:23 +02:00
|
|
|
};
|
|
|
|
|
2021-07-18 15:22:15 +01:00
|
|
|
struct MESH_INFO
|
2020-05-30 15:55:23 +02:00
|
|
|
{
|
2021-09-10 13:49:45 +03:00
|
|
|
PHD_3DPOS pos;
|
2020-05-30 15:55:23 +02:00
|
|
|
short staticNumber;
|
2020-10-07 09:08:23 +02:00
|
|
|
short flags;
|
|
|
|
Vector4 color;
|
2022-02-09 16:55:46 +11:00
|
|
|
short HitPoints;
|
2021-07-14 05:29:23 +02:00
|
|
|
std::string luaName;
|
2020-05-30 15:55:23 +02:00
|
|
|
};
|
|
|
|
|
2021-07-18 15:22:15 +01:00
|
|
|
struct LIGHTINFO
|
2020-05-30 15:55:23 +02:00
|
|
|
{
|
|
|
|
int x; // size=0, offset=0
|
|
|
|
int y; // size=0, offset=4
|
|
|
|
int z; // size=0, offset=8
|
|
|
|
unsigned char Type; // size=0, offset=12
|
|
|
|
unsigned char r; // size=0, offset=13
|
|
|
|
unsigned char g; // size=0, offset=14
|
|
|
|
unsigned char b; // size=0, offset=15
|
|
|
|
short nx; // size=0, offset=16
|
|
|
|
short ny; // size=0, offset=18
|
|
|
|
short nz; // size=0, offset=20
|
|
|
|
short Intensity; // size=0, offset=22
|
|
|
|
unsigned char Inner; // size=0, offset=24
|
|
|
|
unsigned char Outer; // size=0, offset=25
|
|
|
|
short FalloffScale; // size=0, offset=26
|
|
|
|
short Length; // size=0, offset=28
|
|
|
|
short Cutoff; // size=0, offset=30
|
|
|
|
};
|
|
|
|
|
2022-01-27 20:56:05 +11:00
|
|
|
enum RoomEnvFlags
|
2020-05-30 15:55:23 +02:00
|
|
|
{
|
|
|
|
ENV_FLAG_WATER = 0x0001,
|
|
|
|
ENV_FLAG_SWAMP = 0x0004,
|
|
|
|
ENV_FLAG_OUTSIDE = 0x0008,
|
|
|
|
ENV_FLAG_DYNAMIC_LIT = 0x0010,
|
|
|
|
ENV_FLAG_WIND = 0x0020,
|
|
|
|
ENV_FLAG_NOT_NEAR_OUTSIDE = 0x0040,
|
|
|
|
ENV_FLAG_NO_LENSFLARE = 0x0080, // Was quicksand in TR3.
|
|
|
|
ENV_FLAG_MIST = 0x0100,
|
|
|
|
ENV_FLAG_CAUSTICS = 0x0200,
|
2021-11-22 18:55:29 +03:00
|
|
|
ENV_FLAG_UNKNOWN3 = 0x0400,
|
|
|
|
ENV_FLAG_COLD = 0x1000
|
2020-05-30 15:55:23 +02:00
|
|
|
};
|
|
|
|
|
2021-09-08 14:02:32 +03:00
|
|
|
enum StaticMeshFlags : short
|
|
|
|
{
|
2021-09-08 14:05:09 +03:00
|
|
|
SM_VISIBLE = 1,
|
|
|
|
SM_SOLID = 2
|
2021-09-08 14:02:32 +03:00
|
|
|
};
|
|
|
|
|
2020-07-03 07:05:33 +02:00
|
|
|
struct ROOM_INFO
|
2020-05-30 15:55:23 +02:00
|
|
|
{
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int z;
|
|
|
|
int minfloor;
|
|
|
|
int maxceiling;
|
2020-07-05 06:20:36 +02:00
|
|
|
std::vector<Vector3> positions;
|
|
|
|
std::vector<Vector3> normals;
|
|
|
|
std::vector<Vector3> colors;
|
2021-07-31 18:51:30 +03:00
|
|
|
std::vector<Vector3> effects;
|
2020-06-28 15:51:33 +02:00
|
|
|
std::vector<BUCKET> buckets;
|
2020-06-26 07:06:18 +02:00
|
|
|
std::vector<ROOM_DOOR> doors;
|
2020-06-28 15:51:33 +02:00
|
|
|
int xSize;
|
2021-11-08 17:28:04 +03:00
|
|
|
int zSize;
|
2020-06-26 07:06:18 +02:00
|
|
|
std::vector<FLOOR_INFO> floor;
|
2020-06-26 20:51:59 +02:00
|
|
|
Vector3 ambient;
|
2020-06-26 07:06:18 +02:00
|
|
|
std::vector<ROOM_LIGHT> lights;
|
|
|
|
std::vector<MESH_INFO> mesh;
|
2020-06-28 15:51:33 +02:00
|
|
|
int flippedRoom;
|
|
|
|
int flags;
|
|
|
|
int meshEffect;
|
|
|
|
int reverbType;
|
|
|
|
int flipNumber;
|
2020-05-30 15:55:23 +02:00
|
|
|
short itemNumber;
|
|
|
|
short fxNumber;
|
2020-06-26 07:06:18 +02:00
|
|
|
bool boundActive;
|
2022-03-14 01:20:51 +11:00
|
|
|
std::vector<TriggerVolume> triggerVolumes;
|
2020-05-30 15:55:23 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
constexpr auto NUM_ROOMS = 1024;
|
2021-09-17 16:07:53 +03:00
|
|
|
constexpr auto NO_ROOM = -1;
|
2021-09-19 23:41:26 +03:00
|
|
|
constexpr auto OUTSIDE_Z = 64;
|
2021-12-19 03:11:13 +03:00
|
|
|
constexpr auto OUTSIDE_SIZE = 1024;
|
2021-09-19 23:41:26 +03:00
|
|
|
|
|
|
|
extern byte FlipStatus;
|
|
|
|
extern int FlipStats[MAX_FLIPMAP];
|
|
|
|
extern int FlipMap[MAX_FLIPMAP];
|
|
|
|
|
|
|
|
void DoFlipMap(short group);
|
2022-03-14 01:20:51 +11:00
|
|
|
void AddRoomFlipItems(ROOM_INFO* room);
|
|
|
|
void RemoveRoomFlipItems(ROOM_INFO* room);
|
|
|
|
bool IsObjectInRoom(short roomNumber, short objectNumber);
|
|
|
|
bool IsPointInRoom(PHD_3DPOS const& pos, int roomNumber);
|
2021-11-08 21:43:57 +00:00
|
|
|
PHD_3DPOS GetRoomCenter(int roomNumber);
|
2021-09-19 23:41:26 +03:00
|
|
|
int IsRoomOutside(int x, int y, int z);
|
2021-12-19 05:24:12 +03:00
|
|
|
std::set<int> GetRoomList(int roomNumber);
|
2021-09-17 16:07:53 +03:00
|
|
|
|
2022-03-16 13:55:56 +11:00
|
|
|
FLOOR_INFO* GetSector(ROOM_INFO* room, int x, int z);
|