DEADSOFTWARE

cleanup: move monster-specific code from g_basic
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Wed, 9 Jun 2021 10:42:03 +0000 (13:42 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Tue, 29 Jun 2021 09:51:11 +0000 (12:51 +0300)
src/game/g_basic.pas
src/game/g_monsters.pas

index d58e487a8d9edb6b0c97a12ee3ff90eb0695a628..d119742bcec3881673e4e8acb7a922810da417ae 100644 (file)
@@ -54,7 +54,6 @@ function g_CollidePlayer(X, Y: Integer; Width, Height: Word): Boolean; inline;
 function g_PatchLength(X1, Y1, X2, Y2: Integer): Word;
 function g_TraceVector(X1, Y1, X2, Y2: Integer): Boolean; // `true`: no wall hit
 function g_GetAcidHit(X, Y: Integer; Width, Height: Word): Byte;
 function g_PatchLength(X1, Y1, X2, Y2: Integer): Word;
 function g_TraceVector(X1, Y1, X2, Y2: Integer): Boolean; // `true`: no wall hit
 function g_GetAcidHit(X, Y: Integer; Width, Height: Word): Byte;
-function g_Look(a, b: PObj; d: TDirection): Boolean;
 procedure IncMax(var A: Integer; B, Max: Integer); overload;
 procedure IncMax(var A: Single; B, Max: Single); overload;
 procedure IncMax(var A: Integer; Max: Integer); overload;
 procedure IncMax(var A: Integer; B, Max: Integer); overload;
 procedure IncMax(var A: Single; B, Max: Single); overload;
 procedure IncMax(var A: Integer; Max: Integer); overload;
@@ -480,23 +479,6 @@ begin
   Result := tab[a];
 end;
 
   Result := tab[a];
 end;
 
-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;
-
 function GetAngle(baseX, baseY, pointX, PointY: Integer): SmallInt;
 var
   c: Single;
 function GetAngle(baseX, baseY, pointX, PointY: Integer): SmallInt;
 var
   c: Single;
index f858d122dd8e8680a85b0ac52a1bdfba90f8b83e..36780ec4308c7f41d725717e48e6f7e04078b1cc 100644 (file)
@@ -494,6 +494,22 @@ uses
   g_language, g_netmsg, idpool, utils, xstreams;
 
 
   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 ();
 
 // ////////////////////////////////////////////////////////////////////////// //
 procedure g_Mons_ProfilersBegin ();