X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_monsters.pas;h=11c98dab8a4fadd8f0f16fe4d7f506d92d942955;hb=8ef31e93656fa721dbcdc9169aff3d277632405c;hp=5aa8bdc3d6f16eed16dcaadc53ae6e369f2e39c3;hpb=273292d8328e27d0819e361198010dfbcd01ad60;p=d2df-sdl.git diff --git a/src/game/g_monsters.pas b/src/game/g_monsters.pas index 5aa8bdc..11c98da 100644 --- a/src/game/g_monsters.pas +++ b/src/game/g_monsters.pas @@ -23,7 +23,7 @@ uses SysUtils, Classes, mempool, MAPDEF, - g_basic, e_graphics, g_phys, g_textures, g_grid, + g_base, g_basic, g_phys, g_textures, g_grid, g_saveload, g_panel, xprofiler; const @@ -494,6 +494,22 @@ uses g_language, g_netmsg, idpool, utils, xstreams; +function g_Look(a, b: PObj; d: TDirection): Boolean; +begin + if not gmon_dbg_los_enabled then begin result := false; exit; end; // always "wall hit" + + if ((b^.X > a^.X) and (d = TDirection.D_LEFT)) or + ((b^.X < a^.X) and (d = TDirection.D_RIGHT)) then + begin + Result := False; + Exit; + end; + + Result := g_TraceVector(a^.X+a^.Rect.X+(a^.Rect.Width div 2), + a^.Y+a^.Rect.Y+(a^.Rect.Height div 2), + b^.X+b^.Rect.X+(b^.Rect.Width div 2), + b^.Y+b^.Rect.Y+(b^.Rect.Height div 2)); +end; // ////////////////////////////////////////////////////////////////////////// // procedure g_Mons_ProfilersBegin ();