summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0f3ace5)
raw | patch | inline | side by side (parent: 0f3ace5)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Fri, 21 Jan 2022 18:58:03 +0000 (21:58 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Fri, 21 Jan 2022 18:58:16 +0000 (21:58 +0300) |
src/game/g_panel.pas | patch | blob | history |
diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas
index 084f64db416a805fc917215dcf74c7c898994715..d236550df72b3023824d5840d82ae06711d8f9e0 100644 (file)
--- a/src/game/g_panel.pas
+++ b/src/game/g_panel.pas
nx, ny, nw, nh: Integer;
ex, ey, nex, ney: Integer;
mpw, mph: Integer;
+ conveyor: Boolean;
// return `true` if we should move by dx,dy
function tryMPlatMove (px, py, pw, ph: Integer; out dx, dy: Integer; out squash: Boolean; ontop: PBoolean=nil): Boolean;
dx := tex-px;
dy := tey-py;
result := (dx <> 0) or (dy <> 0);
- if ((tag and (GridTagWall or GridTagDoor)) <> 0) then
+ if not conveyor and ((tag and (GridTagWall or GridTagDoor)) <> 0) then
begin
// check for squashing; as entity cannot be pushed into a wall, check only collision with the platform itself
squash := g_Collide(tex, tey, pw, ph, nx, ny, nw, nh); // squash, if still in platform
mpw := Width;
mph := Height;
+ // the mplat acts as a stationary conveyor belt when it's locked within a movement rect of zero area
+ conveyor := (mMovingEnd.X = mMovingStart.X) and (mMovingEnd.Y = mMovingStart.Y)
+ and (mMovingEnd.X = X) and (mMovingEnd.Y = Y);
+
nw := mpw+mSizeSpeed.w;
nh := mph+mSizeSpeed.h;
- nx := ox+mMovingSpeed.X;
- ny := oy+mMovingSpeed.Y;
+ nx := ox;
+ ny := oy;
+ if not conveyor then
+ begin
+ nx += mMovingSpeed.X;
+ ny += mMovingSpeed.Y;
+ end;
// force network updates only if some sudden change happened
// set the flag here, so we can sync affected monsters
if (nw < 1) or (nh < 1) then mMovingActive := false; //HACK!
end;
- // reverse moving direction, if necessary
- if ((mMovingSpeed.X < 0) and (nx <= mMovingStart.X)) or ((mMovingSpeed.X > 0) and (nx >= mMovingEnd.X)) then
+ if not conveyor then
begin
- if mMoveOnce then mMovingActive := false else mMovingSpeed.X := -mMovingSpeed.X;
- actMoveTrig := true;
- end;
+ // reverse moving direction, if necessary
+ if ((mMovingSpeed.X < 0) and (nx <= mMovingStart.X)) or ((mMovingSpeed.X > 0) and (nx >= mMovingEnd.X)) then
+ begin
+ if mMoveOnce then mMovingActive := false else mMovingSpeed.X := -mMovingSpeed.X;
+ actMoveTrig := true;
+ end;
- if ((mMovingSpeed.Y < 0) and (ny <= mMovingStart.Y)) or ((mMovingSpeed.Y > 0) and (ny >= mMovingEnd.Y)) then
- begin
- if mMoveOnce then mMovingActive := false else mMovingSpeed.Y := -mMovingSpeed.Y;
- actMoveTrig := true;
- end;
+ if ((mMovingSpeed.Y < 0) and (ny <= mMovingStart.Y)) or ((mMovingSpeed.Y > 0) and (ny >= mMovingEnd.Y)) then
+ begin
+ if mMoveOnce then mMovingActive := false else mMovingSpeed.Y := -mMovingSpeed.Y;
+ actMoveTrig := true;
+ end;
- if (mOldMovingActive <> mMovingActive) then mNeedSend := true;
- mOldMovingActive := mMovingActive;
+ if (mOldMovingActive <> mMovingActive) then mNeedSend := true;
+ mOldMovingActive := mMovingActive;
+ end;
if not g_Game_IsClient then
begin