mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-01 09:18:00 +03:00
Add more bridge slots; Allow optional floor and ceiling overriding
This commit is contained in:
parent
44a9ff2df2
commit
c252205ca6
6 changed files with 28 additions and 20 deletions
|
@ -252,8 +252,8 @@ std::optional<int> FLOOR_INFO::GetFloorHeight(int startRoomNumber, int x, int y,
|
|||
{
|
||||
auto item = &g_Level.Items[itemNumber];
|
||||
auto itemHeight = Objects[item->objectNumber].floor(itemNumber, x, y, z);
|
||||
if (itemHeight >= y && itemHeight < height)
|
||||
height = itemHeight;
|
||||
if (itemHeight && *itemHeight >= y && *itemHeight < height)
|
||||
height = *itemHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,8 +276,8 @@ std::optional<int> FLOOR_INFO::GetCeilingHeight(int startRoomNumber, int x, int
|
|||
{
|
||||
auto item = &g_Level.Items[itemNumber];
|
||||
auto itemHeight = Objects[item->objectNumber].ceiling(itemNumber, x, y, z);
|
||||
if (itemHeight <= y && itemHeight > height)
|
||||
height = itemHeight;
|
||||
if (itemHeight && *itemHeight <= y && *itemHeight > height)
|
||||
height = *itemHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,16 +9,16 @@ void InitialiseBridge(short itemNumber)
|
|||
FLOOR_INFO::AddCeiling(itemNumber);
|
||||
}
|
||||
|
||||
int BridgeFloor(short itemNumber, int x, int y, int z)
|
||||
std::optional<int> BridgeFloor(short itemNumber, int x, int y, int z)
|
||||
{
|
||||
auto item = &g_Level.Items[itemNumber];
|
||||
return item->pos.yPos + GetOffset(&item->pos, x, z);
|
||||
return std::optional{item->pos.yPos + GetOffset(&item->pos, x, z)};
|
||||
}
|
||||
|
||||
int BridgeCeiling(short itemNumber, int x, int y, int z)
|
||||
std::optional<int> BridgeCeiling(short itemNumber, int x, int y, int z)
|
||||
{
|
||||
auto item = &g_Level.Items[itemNumber];
|
||||
return item->pos.yPos + GetOffset(&item->pos, x, z);
|
||||
return std::optional{item->pos.yPos + GetOffset(&item->pos, x, z)};
|
||||
}
|
||||
|
||||
int GetOffset(PHD_3DPOS* pos, int x, int z)
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
#include "phd_global.h"
|
||||
|
||||
void InitialiseBridge(short itemNumber);
|
||||
int BridgeFloor(short itemNumber, int x, int y, int z);
|
||||
int BridgeCeiling(short itemNumber, int x, int y, int z);
|
||||
std::optional<int> BridgeFloor(short itemNumber, int x, int y, int z);
|
||||
std::optional<int> BridgeCeiling(short itemNumber, int x, int y, int z);
|
||||
int GetOffset(PHD_3DPOS* pos, int x, int z);
|
||||
|
|
|
@ -9,14 +9,15 @@
|
|||
|
||||
static void StartObject()
|
||||
{
|
||||
OBJECT_INFO* obj;
|
||||
|
||||
obj = &Objects[ID_BRIDGE];
|
||||
if (obj->loaded)
|
||||
for (int objNumber = ID_BRIDGE1; objNumber <= ID_BRIDGE8; ++objNumber)
|
||||
{
|
||||
obj->initialise = InitialiseBridge;
|
||||
obj->floor = BridgeFloor;
|
||||
obj->ceiling = BridgeCeiling;
|
||||
auto obj = &Objects[objNumber];
|
||||
if (obj->loaded)
|
||||
{
|
||||
obj->initialise = InitialiseBridge;
|
||||
obj->floor = BridgeFloor;
|
||||
obj->ceiling = BridgeCeiling;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -955,7 +955,14 @@ typedef enum GAME_OBJECT_ID
|
|||
ID_LASERHEAD_BASE,
|
||||
ID_LASERHEAD_TENTACLE,
|
||||
|
||||
ID_BRIDGE = 1340,
|
||||
ID_BRIDGE1 = 1340,
|
||||
ID_BRIDGE2,
|
||||
ID_BRIDGE3,
|
||||
ID_BRIDGE4,
|
||||
ID_BRIDGE5,
|
||||
ID_BRIDGE6,
|
||||
ID_BRIDGE7,
|
||||
ID_BRIDGE8,
|
||||
|
||||
ID_HORIZON = 1350,
|
||||
ID_BINOCULAR_GRAPHICS,
|
||||
|
|
|
@ -21,8 +21,8 @@ struct OBJECT_INFO
|
|||
int frameBase;
|
||||
std::function<void(short itemNumber)> initialise;
|
||||
std::function<void(short itemNumber)> control;
|
||||
std::function<int(short itemNumber, int x, int y, int z)> floor;
|
||||
std::function<int(short itemNumber, int x, int y, int z)> ceiling;
|
||||
std::function<std::optional<int>(short itemNumber, int x, int y, int z)> floor;
|
||||
std::function<std::optional<int>(short itemNumber, int x, int y, int z)> ceiling;
|
||||
std::function<void(ITEM_INFO* item)> drawRoutine;
|
||||
std::function<void(ITEM_INFO* item)> drawRoutineExtra;
|
||||
std::function<void(short item_num, ITEM_INFO* laraitem, COLL_INFO* coll)> collision;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue