1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-09 06:36:59 +02:00

#14 path blocking by doors

This commit is contained in:
XProger
2017-05-10 02:34:59 +03:00
parent 58e4b27904
commit 42dc19bb39
3 changed files with 14 additions and 0 deletions

View File

@@ -859,6 +859,9 @@ struct ZoneCache {
// has same zone
if (zones[index] != zone)
continue;
// check blocking (doors)
if (level->boxes[index].overlap.block)
continue;
// check for height difference
int d = level->boxes[index].floor - b.floor;
if (d > ascend || d < descend)

View File

@@ -840,6 +840,7 @@ namespace TR {
int floor, ceiling;
int slantX, slantZ;
int floorIndex;
int boxIndex;
int kill;
int trigCmdCount;
Trigger trigger;
@@ -1617,6 +1618,7 @@ namespace TR {
info.roomBelow = s.roomBelow;
info.roomAbove = s.roomAbove;
info.floorIndex = s.floorIndex;
info.boxIndex = s.boxIndex;
info.kill = 0;
info.trigger = Trigger::ACTIVATE;
info.trigCmdCount = 0;

View File

@@ -215,6 +215,7 @@ struct MovingBlock : Trigger {
struct Door : Trigger {
int8 *floor[2], orig[2];
uint16 box;
Door(IGame *game, int entity) : Trigger(game, entity, true) {
TR::Entity &e = getEntity();
@@ -222,6 +223,8 @@ struct Door : Trigger {
vec3 p = pos - getDir() * 1024.0f;
level->getFloorInfo(e.room, (int)p.x, (int)p.y, (int)p.z, info);
box = info.boxIndex;
int 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
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[1]) *floor[1] = v[1];
}