summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 76c10f8)
raw | patch | inline | side by side (parent: 76c10f8)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 4 Sep 2017 20:41:05 +0000 (23:41 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 4 Sep 2017 20:41:20 +0000 (23:41 +0300) |
src/game/g_panel.pas | patch | blob | history |
diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas
index 6160929b5f214697fc8170fba949589246f319a9..7ea056dc25f97fef599dfaa48539367915558137 100644 (file)
--- a/src/game/g_panel.pas
+++ b/src/game/g_panel.pas
tex, tey: Integer;
pdx, pdy: Integer;
pan: TPanel;
+ trtag: Integer;
begin
squash := false;
tex := px;
if (py+ph = oy) then
begin
if (ontop <> nil) then ontop^ := true;
- // yes, move with it
- pan := mapGrid.traceBox(tex, tey, px, py, pw, ph, pdx, pdy, nil, GridTagObstacle);
+ // yes, move with it; but skip steps
+ pan := mapGrid.traceBox(tex, tey, px, py, pw, ph, pdx, pdy, nil, (GridTagWall or GridTagDoor));
if (pan <> nil) then
begin
//e_LogWritefln('entity on the platform; tracing=(%s,%s); endpoint=(%s,%s); mustbe=(%s,%s)', [px, py, tex, tey, px+pdx, py+pdy]);
- if (tex = px) and (tey = py) then squash := true;
+ // if we cannot move, only walls should squash the entity
+ if ((tag and (GridTagWall or GridTagDoor)) <> 0) then
+ begin
+ if (tex = px) and (tey = py) then squash := true;
+ end;
end;
end
else
if (pdx <> 0) or (pdy <> 0) then
begin
// has some path to go, trace the entity
- pan := mapGrid.traceBox(tex, tey, px, py, pw, ph, pdx, pdy, nil, GridTagObstacle);
+ trtag := (GridTagWall or GridTagDoor);
+ // if we're moving down, consider steps too
+ if (pdy > 0) then trtag := trtag or GridTagStep;
+ pan := mapGrid.traceBox(tex, tey, px, py, pw, ph, pdx, pdy, nil, trtag);
//e_LogWritefln(' tracebox: te=(%s,%s)', [tex, tey]);
- if (pan <> nil) and (tex = px) and (tey = py) then squash := true;
+ // if we cannot move, only walls should squash the entity
+ if ((tag and (GridTagWall or GridTagDoor)) <> 0) then
+ begin
+ if (pan <> nil) and (tex = px) and (tey = py) then squash := true;
+ end;
end;
end
else
dx := tex-px;
dy := tey-py;
result := (dx <> 0) or (dy <> 0);
- if result and (not squash) then
+ if result and (not squash) and ((tag and (GridTagWall or GridTagDoor)) <> 0) then
begin
squash := g_Collide(tex, tey, pw, ph, nx, ny, mpw, mph); // still in platform?
if not squash then squash := g_Map_CollidePanel(tex, tey, pw, ph, (PANEL_WALL or PANEL_OPENDOOR or PANEL_CLOSEDOOR));