summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ba69b47)
raw | patch | inline | side by side (parent: ba69b47)
author | Stas'M <x86corez@gmail.com> | |
Sun, 27 Jan 2019 12:45:16 +0000 (15:45 +0300) | ||
committer | Stas'M <x86corez@gmail.com> | |
Sun, 27 Jan 2019 12:45:16 +0000 (15:45 +0300) |
http://doom2d.org/forum/viewtopic.php?f=36&t=2597
src/game/g_gfx.pas | patch | blob | history |
diff --git a/src/game/g_gfx.pas b/src/game/g_gfx.pas
index e92f369d78fd66ce8b8cfd57298003928bb0ef42..64b62e8d7682fdbc14f270b7dd01dc4c2645f3a6 100644 (file)
--- a/src/game/g_gfx.pas
+++ b/src/game/g_gfx.pas
r: Integer;
begin
pan := g_Map_PanelAtPoint(x, y, GridTagLift);
- result := (pan <> nil);
+ result := (pan <> nil) and WordBool(pan.PanelType and (PANEL_LIFTUP or PANEL_LIFTDOWN or PANEL_LIFTLEFT or PANEL_LIFTRIGHT));
r := Random(3);
if result then
begin
- if ((pan.PanelType and PANEL_LIFTUP) <> 0) then
- begin
- if (velY > -1-r) then velY -= 0.8;
- if (abs(velX) > 0.1) then velX -= velX/10.0;
- velX += (Random-Random)*0.2;
- accelY := 0.15;
- end
- else if ((pan.PanelType and PANEL_LIFTDOWN) <> 0) then
- begin
- if (velY < 1+r) then velY += 0.8;
- accelY := 0.15;
- end
- else if ((pan.PanelType and PANEL_LIFTLEFT) <> 0) then
- begin
- if (velX > -8-r) then velX -= (8+r) div 2;
- accelY := 0.15;
- end
- else if ((pan.PanelType and PANEL_LIFTRIGHT) <> 0) then
- begin
- if (velX < 8+r) then velX += (8+r) div 2;
- accelY := 0.15;
- end
- else
- begin
- result := false;
+ case pan.LiftType of
+ LIFTTYPE_UP:
+ begin
+ if (velY > -1-r) then velY -= 0.8;
+ if (abs(velX) > 0.1) then velX -= velX/10.0;
+ velX += (Random-Random)*0.2;
+ accelY := 0.15;
+ end;
+ LIFTTYPE_DOWN:
+ begin
+ if (velY < 1+r) then velY += 0.8;
+ accelY := 0.15;
+ end;
+ LIFTTYPE_LEFT:
+ begin
+ if (velX > -8-r) then velX -= (8+r) div 2;
+ accelY := 0.15;
+ end;
+ LIFTTYPE_RIGHT:
+ begin
+ if (velX < 8+r) then velX += (8+r) div 2;
+ accelY := 0.15;
+ end;
+ else
+ result := false;
end;
// awake
if result and (state = TPartState.Sleeping) then state := TPartState.Normal;