mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-01 09:18:00 +03:00
New floordata prototype
This commit is contained in:
parent
1bb626dede
commit
dbdba8d2df
6 changed files with 106 additions and 58 deletions
42
TR5Main/Game/floordata.cpp
Normal file
42
TR5Main/Game/floordata.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
#include "framework.h"
|
||||
#include "trmath.h"
|
||||
#include "floordata.h"
|
||||
#include "room.h"
|
||||
|
||||
SECTOR_POSITION FLOOR_INFO::GetSectorPosition(ROOM_INFO* room, int x, int z)
|
||||
{
|
||||
SECTOR_POSITION pos;
|
||||
|
||||
pos.x = (z - room->z) / WALL_SIZE;
|
||||
pos.y = (x - room->x) / WALL_SIZE;
|
||||
|
||||
if (pos.x < 0)
|
||||
{
|
||||
pos.x = 0;
|
||||
}
|
||||
else if (pos.x > room->xSize - 1)
|
||||
{
|
||||
pos.x = room->xSize - 1;
|
||||
}
|
||||
|
||||
if (pos.y < 0)
|
||||
{
|
||||
pos.y = 0;
|
||||
}
|
||||
else if (pos.y > room->ySize - 1)
|
||||
{
|
||||
pos.y = room->ySize - 1;
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
FLOOR_INFO& FLOOR_INFO::GetFloor(ROOM_INFO* room, int x, int z)
|
||||
{
|
||||
return GetFloor(room, GetSectorPosition(room, x, z));
|
||||
}
|
||||
|
||||
FLOOR_INFO& FLOOR_INFO::GetFloor(ROOM_INFO* room, SECTOR_POSITION pos)
|
||||
{
|
||||
return room->floor[pos.x + pos.y * room->xSize];
|
||||
}
|
36
TR5Main/Game/floordata.h
Normal file
36
TR5Main/Game/floordata.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
#pragma once
|
||||
|
||||
struct ROOM_INFO;
|
||||
|
||||
struct SECTOR_COLLISION_INFO
|
||||
{
|
||||
float SplitAngle;
|
||||
int Portals[2];
|
||||
Vector3 Planes[2];
|
||||
};
|
||||
|
||||
struct SECTOR_POSITION
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
class FLOOR_INFO
|
||||
{
|
||||
public:
|
||||
int index;
|
||||
int box;
|
||||
int fx;
|
||||
int stopper;
|
||||
int pitRoom;
|
||||
int floor;
|
||||
int skyRoom;
|
||||
int ceiling;
|
||||
SECTOR_COLLISION_INFO FloorCollision;
|
||||
SECTOR_COLLISION_INFO CeilingCollision;
|
||||
int WallPortal;
|
||||
|
||||
static SECTOR_POSITION GetSectorPosition(ROOM_INFO* room, int x, int z);
|
||||
static FLOOR_INFO& GetFloor(ROOM_INFO* room, int x, int z);
|
||||
static FLOOR_INFO& GetFloor(ROOM_INFO* room, SECTOR_POSITION pos);
|
||||
};
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include <framework.h>
|
||||
#include <newtypes.h>
|
||||
#include "floordata.h"
|
||||
|
||||
struct ANIM_FRAME;
|
||||
|
||||
|
@ -67,48 +68,6 @@ typedef struct LIGHTINFO
|
|||
short Cutoff; // size=0, offset=30
|
||||
};
|
||||
|
||||
enum SECTOR_SPLIT_TYPE
|
||||
{
|
||||
ST_NONE = 0,
|
||||
ST_SPLIT1 = 1,
|
||||
ST_SPLIT2 = 2
|
||||
};
|
||||
|
||||
enum SECTOR_NOCOLLISION_TYPE
|
||||
{
|
||||
NC_NONE = 0,
|
||||
NC_TRIANGLE1 = 1,
|
||||
NC_TRIANGLE2 = 2
|
||||
};
|
||||
|
||||
struct SECTOR_PLANE
|
||||
{
|
||||
float a;
|
||||
float b;
|
||||
float c;
|
||||
};
|
||||
|
||||
struct SECTOR_COLLISION_INFO
|
||||
{
|
||||
int split;
|
||||
int noCollision;
|
||||
SECTOR_PLANE planes[2];
|
||||
};
|
||||
|
||||
struct FLOOR_INFO
|
||||
{
|
||||
int index;
|
||||
int box;
|
||||
int fx;
|
||||
int stopper;
|
||||
int pitRoom;
|
||||
int floor;
|
||||
int skyRoom;
|
||||
int ceiling;
|
||||
SECTOR_COLLISION_INFO floorCollision;
|
||||
SECTOR_COLLISION_INFO ceilingCollision;
|
||||
};
|
||||
|
||||
enum RoomEnumFlag
|
||||
{
|
||||
ENV_FLAG_WATER = 0x0001,
|
||||
|
|
|
@ -572,22 +572,25 @@ void ReadRooms()
|
|||
floor.floor = ReadInt32();
|
||||
floor.skyRoom = ReadInt32();
|
||||
floor.ceiling = ReadInt32();
|
||||
floor.floorCollision.split = ReadInt32();
|
||||
floor.floorCollision.noCollision = ReadInt32();
|
||||
floor.floorCollision.planes[0].a = ReadFloat();
|
||||
floor.floorCollision.planes[0].b = ReadFloat();
|
||||
floor.floorCollision.planes[0].c = ReadFloat();
|
||||
floor.floorCollision.planes[1].a = ReadFloat();
|
||||
floor.floorCollision.planes[1].b = ReadFloat();
|
||||
floor.floorCollision.planes[1].c = ReadFloat();
|
||||
floor.ceilingCollision.split = ReadInt32();
|
||||
floor.ceilingCollision.noCollision = ReadInt32();
|
||||
floor.ceilingCollision.planes[0].a = ReadFloat();
|
||||
floor.ceilingCollision.planes[0].b = ReadFloat();
|
||||
floor.ceilingCollision.planes[0].c = ReadFloat();
|
||||
floor.ceilingCollision.planes[1].a = ReadFloat();
|
||||
floor.ceilingCollision.planes[1].b = ReadFloat();
|
||||
floor.ceilingCollision.planes[1].c = ReadFloat();
|
||||
floor.FloorCollision.SplitAngle = ReadFloat();
|
||||
floor.FloorCollision.Portals[0] = ReadInt32();
|
||||
floor.FloorCollision.Portals[1] = ReadInt32();
|
||||
floor.FloorCollision.Planes[0].x = ReadFloat();
|
||||
floor.FloorCollision.Planes[0].y = ReadFloat();
|
||||
floor.FloorCollision.Planes[0].z = ReadFloat();
|
||||
floor.FloorCollision.Planes[1].x = ReadFloat();
|
||||
floor.FloorCollision.Planes[1].y = ReadFloat();
|
||||
floor.FloorCollision.Planes[1].z = ReadFloat();
|
||||
floor.CeilingCollision.SplitAngle = ReadFloat();
|
||||
floor.CeilingCollision.Portals[0] = ReadInt32();
|
||||
floor.CeilingCollision.Portals[1] = ReadInt32();
|
||||
floor.CeilingCollision.Planes[0].x = ReadFloat();
|
||||
floor.CeilingCollision.Planes[0].y = ReadFloat();
|
||||
floor.CeilingCollision.Planes[0].z = ReadFloat();
|
||||
floor.CeilingCollision.Planes[1].x = ReadFloat();
|
||||
floor.CeilingCollision.Planes[1].y = ReadFloat();
|
||||
floor.CeilingCollision.Planes[1].z = ReadFloat();
|
||||
floor.WallPortal = ReadInt32();
|
||||
|
||||
room.floor.push_back(floor);
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts"</Command>
|
|||
<ClInclude Include="Game\debug\debug.h" />
|
||||
<ClInclude Include="Game\drip.h" />
|
||||
<ClInclude Include="Game\explosion.h" />
|
||||
<ClInclude Include="Game\floordata.h" />
|
||||
<ClInclude Include="Game\footprint.h" />
|
||||
<ClInclude Include="Game\groundfx.h" />
|
||||
<ClInclude Include="Game\Lara\lara_basic.h" />
|
||||
|
@ -436,6 +437,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts"</Command>
|
|||
<ClCompile Include="Game\chaffFX.cpp" />
|
||||
<ClCompile Include="Game\drip.cpp" />
|
||||
<ClCompile Include="Game\explosion.cpp" />
|
||||
<ClCompile Include="Game\floordata.cpp" />
|
||||
<ClCompile Include="Game\footprint.cpp" />
|
||||
<ClCompile Include="Game\Lara\lara_basic.cpp" />
|
||||
<ClCompile Include="Game\Lara\lara_cheat.cpp" />
|
||||
|
|
|
@ -915,6 +915,9 @@
|
|||
<ClInclude Include="Objects\TR3\Vehicles\biggun.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Game\floordata.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Game\box.cpp">
|
||||
|
@ -1676,6 +1679,9 @@
|
|||
<ClCompile Include="Objects\TR3\Vehicles\biggun.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Game\floordata.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue