mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-11 15:45:05 +02:00
#14 path blocking by doors
This commit is contained in:
@@ -859,6 +859,9 @@ struct ZoneCache {
|
|||||||
// has same zone
|
// has same zone
|
||||||
if (zones[index] != zone)
|
if (zones[index] != zone)
|
||||||
continue;
|
continue;
|
||||||
|
// check blocking (doors)
|
||||||
|
if (level->boxes[index].overlap.block)
|
||||||
|
continue;
|
||||||
// check for height difference
|
// check for height difference
|
||||||
int d = level->boxes[index].floor - b.floor;
|
int d = level->boxes[index].floor - b.floor;
|
||||||
if (d > ascend || d < descend)
|
if (d > ascend || d < descend)
|
||||||
|
@@ -840,6 +840,7 @@ namespace TR {
|
|||||||
int floor, ceiling;
|
int floor, ceiling;
|
||||||
int slantX, slantZ;
|
int slantX, slantZ;
|
||||||
int floorIndex;
|
int floorIndex;
|
||||||
|
int boxIndex;
|
||||||
int kill;
|
int kill;
|
||||||
int trigCmdCount;
|
int trigCmdCount;
|
||||||
Trigger trigger;
|
Trigger trigger;
|
||||||
@@ -1617,6 +1618,7 @@ namespace TR {
|
|||||||
info.roomBelow = s.roomBelow;
|
info.roomBelow = s.roomBelow;
|
||||||
info.roomAbove = s.roomAbove;
|
info.roomAbove = s.roomAbove;
|
||||||
info.floorIndex = s.floorIndex;
|
info.floorIndex = s.floorIndex;
|
||||||
|
info.boxIndex = s.boxIndex;
|
||||||
info.kill = 0;
|
info.kill = 0;
|
||||||
info.trigger = Trigger::ACTIVATE;
|
info.trigger = Trigger::ACTIVATE;
|
||||||
info.trigCmdCount = 0;
|
info.trigCmdCount = 0;
|
||||||
|
@@ -215,6 +215,7 @@ struct MovingBlock : Trigger {
|
|||||||
|
|
||||||
struct Door : Trigger {
|
struct Door : Trigger {
|
||||||
int8 *floor[2], orig[2];
|
int8 *floor[2], orig[2];
|
||||||
|
uint16 box;
|
||||||
|
|
||||||
Door(IGame *game, int entity) : Trigger(game, entity, true) {
|
Door(IGame *game, int entity) : Trigger(game, entity, true) {
|
||||||
TR::Entity &e = getEntity();
|
TR::Entity &e = getEntity();
|
||||||
@@ -222,6 +223,8 @@ struct Door : Trigger {
|
|||||||
vec3 p = pos - getDir() * 1024.0f;
|
vec3 p = pos - getDir() * 1024.0f;
|
||||||
|
|
||||||
level->getFloorInfo(e.room, (int)p.x, (int)p.y, (int)p.z, info);
|
level->getFloorInfo(e.room, (int)p.x, (int)p.y, (int)p.z, info);
|
||||||
|
box = info.boxIndex;
|
||||||
|
|
||||||
int dx, dz;
|
int dx, dz;
|
||||||
TR::Room::Sector *s = &level->getSector(e.room, (int)p.x, (int)p.z, dx, dz);
|
TR::Room::Sector *s = &level->getSector(e.room, (int)p.x, (int)p.z, dx, dz);
|
||||||
|
|
||||||
@@ -244,6 +247,12 @@ struct Door : Trigger {
|
|||||||
} else
|
} else
|
||||||
v[0] = v[1] = TR::FLOOR_BLOCK;
|
v[0] = v[1] = TR::FLOOR_BLOCK;
|
||||||
|
|
||||||
|
if (box != 0xFFFF) {
|
||||||
|
TR::Box &b = level->boxes[box];
|
||||||
|
if (b.overlap.blockable)
|
||||||
|
b.overlap.block = !getEntity().flags.active;
|
||||||
|
}
|
||||||
|
|
||||||
if (floor[0]) *floor[0] = v[0];
|
if (floor[0]) *floor[0] = v[0];
|
||||||
if (floor[1]) *floor[1] = v[1];
|
if (floor[1]) *floor[1] = v[1];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user