summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9bca9a6)
raw | patch | inline | side by side (parent: 9bca9a6)
author | binarymaster <x86corez@gmail.com> | |
Sat, 23 Sep 2017 19:14:54 +0000 (22:14 +0300) | ||
committer | binarymaster <x86corez@gmail.com> | |
Sat, 23 Sep 2017 19:14:54 +0000 (22:14 +0300) |
http://doom2d.org/forum/viewtopic.php?f=36&t=2347
src/game/g_phys.pas | patch | blob | history |
diff --git a/src/game/g_phys.pas b/src/game/g_phys.pas
index e92e49b1a6a9ba171d187a2acc2aa4e167df4fe8..dd4c07a7b08fa6a2cea87f837430fae77e010b81 100644 (file)
--- a/src/game/g_phys.pas
+++ b/src/game/g_phys.pas
function g_Obj_CollideLiquid(Obj: PObj; XInc, YInc: Integer): Boolean; inline;
function g_Obj_CollidePanel(Obj: PObj; XInc, YInc: Integer; PanelType: Word): Boolean; inline;
function g_Obj_StayOnStep(Obj: PObj): Boolean; inline;
+function g_Obj_CanMoveY(Obj: PObj; YInc: Integer): Boolean; inline;
procedure g_Obj_Push(Obj: PObj; VelX, VelY: Integer); inline;
procedure g_Obj_PushA(Obj: PObj; Vel: Integer; Angle: SmallInt); inline;
procedure g_Obj_SetSpeed(Obj: PObj; s: Integer); inline;
PANEL_STEP, False);
end;
+function g_Obj_CanMoveY(Obj: PObj; YInc: Integer): Boolean; inline;
+begin
+ // Åñëè øàãíóòü â ïî âåðòèêàëè, à òàì ñòåíà => øàãàòü íåëüçÿ
+ // Èëè åñëè øàãíóòü âíèç, à òàì ñòóïåíü => øàãàòü íåëüçÿ
+ Result := not(g_Obj_CollideLevel(Obj, 0, YInc) or ((YInc > 0) and g_Obj_StayOnStep(Obj)));
+end;
+
function CollideLiquid(Obj: PObj; XInc, YInc: Integer): Boolean; inline;
begin
Result := g_Map_CollidePanel(Obj^.X+Obj^.Rect.X+XInc, Obj^.Y+Obj^.Rect.Y+YInc,
begin
result := true;
if (not g_Obj_CollideLevel(Obj, sx, -12)) and // çàáèðàåìñÿ íà 12 ïèêñåëåé âëåâî/âïðàâî
- g_Obj_CollidePanel(Obj, 0, 1, PANEL_WALL or PANEL_STEP) then // òîëüêî åñëè åñòü çåìëÿ ïîä íîãàìè
+ (sy >= 0) and (not g_Obj_CanMoveY(Obj, sy)) then // òîëüêî åñëè åñòü çåìëÿ ïîä íîãàìè
begin
slope(-1);
end
if Blocked(Obj, 0, sy) then st := st or MOVE_BLOCK;
end;
- // Åñëè øàãíóòü â ïî âåðòèêàëè, à òàì ñòåíà => øàãàòü íåëüçÿ
- // Èëè åñëè øàãíóòü âíèç, à òàì ñòóïåíü => øàãàòü íåëüçÿ
- if g_Obj_CollideLevel(Obj, 0, sy) or ((sy > 0) and g_Obj_StayOnStep(Obj)) then
+ // Åñëè øàãàòü íåëüçÿ
+ if not g_Obj_CanMoveY(Obj, sy) then
begin
if sy > 0 then
st := st or MOVE_HITLAND