TombEngine/TR5Main/Game/room.h

172 lines
3.3 KiB
C
Raw Normal View History

#pragma once
#include <framework.h>
2020-07-03 07:05:33 +02:00
#include <newtypes.h>
2020-09-14 00:19:05 -03:00
#include "floordata.h"
2020-07-25 18:02:35 +02:00
struct ANIM_FRAME;
2020-06-28 15:51:33 +02:00
struct ROOM_VERTEX
{
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;
};
struct ROOM_DOOR
{
short room;
Vector3 normal;
Vector3 vertices[4];
};
struct ROOM_LIGHT
{
2020-07-26 16:17:54 +02:00
int x, y, z; // Position of light, in world coordinates
float r, g, b; // Colour of the light
2020-07-26 16:17:54 +02:00
float intensity;
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
float dx, dy, dz; // Direction - used only by sun and spot lights
byte type;
2020-07-26 16:17:54 +02:00
bool castShadows;
};
struct MESH_INFO
{
int x;
int y;
int z;
short yRot;
short staticNumber;
2020-10-07 09:08:23 +02:00
short flags;
Vector4 color;
short hitPoints;
std::string luaName;
};
struct LIGHTINFO
{
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
};
2020-07-03 07:05:33 +02:00
enum RoomEnumFlag
{
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,
ENV_FLAG_UNKNOWN3 = 0x0400
};
2021-07-05 16:33:50 +02:00
enum TriggerStatus
{
TS_OUTSIDE = 0,
TS_ENTERING = 1,
TS_INSIDE = 2,
TS_LEAVING = 3
};
2021-08-05 15:46:03 +03:00
enum TriggerVolumeType
{
VOLUME_BOX = 0,
VOLUME_SPHERE = 1,
VOLUME_PRISM = 2 // Unsupported as of now
};
2021-07-05 16:33:50 +02:00
struct TRIGGER_VOLUME
{
2021-08-05 15:46:03 +03:00
TriggerVolumeType type;
2021-07-05 16:33:50 +02:00
Vector3 position;
Quaternion rotation;
2021-08-05 15:46:03 +03:00
Vector3 scale; // X used as radius if type is VOLUME_SPHERE
2021-07-05 16:33:50 +02:00
std::string onEnter;
std::string onInside;
std::string onLeave;
2021-08-05 15:46:03 +03:00
int activators;
2021-07-05 16:33:50 +02:00
bool oneShot;
2021-08-05 15:46:03 +03:00
2021-07-05 16:33:50 +02:00
TriggerStatus status;
BoundingOrientedBox box;
2021-08-05 15:46:03 +03:00
BoundingSphere sphere;
2021-07-05 16:33:50 +02:00
};
2020-07-03 07:05:33 +02:00
struct ROOM_INFO
{
int x;
int y;
int z;
int minfloor;
int maxceiling;
std::vector<Vector3> positions;
std::vector<Vector3> normals;
std::vector<Vector3> colors;
std::vector<Vector3> effects;
2020-06-28 15:51:33 +02:00
std::vector<BUCKET> buckets;
std::vector<ROOM_DOOR> doors;
2020-06-28 15:51:33 +02:00
int xSize;
int ySize;
std::vector<FLOOR_INFO> floor;
Vector3 ambient;
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;
short itemNumber;
short fxNumber;
bool boundActive;
2021-07-05 16:33:50 +02:00
std::vector<TRIGGER_VOLUME> triggerVolumes;
};
2020-07-03 07:05:33 +02:00
struct ANIM_STRUCT
{
2020-07-25 18:02:35 +02:00
int framePtr;
short interpolation;
short currentAnimState;
int velocity;
int acceleration;
int Xvelocity;
int Xacceleration;
short frameBase;
short frameEnd;
short jumpAnimNum;
short jumpFrameNum;
short numberChanges;
short changeIndex;
short numberCommands;
short commandIndex;
};
constexpr auto NUM_ROOMS = 1024;
2020-07-11 21:16:04 +02:00
constexpr auto NO_ROOM = -1;
constexpr auto NO_HEIGHT = (-0x7F00);