DEADSOFTWARE

fixed map loading bug: panel texture internal id was incorrect (and worked only by...
[d2df-sdl.git] / src / game / g_basic.pas
index 8069029bc2c8338113244ef0f753b50659652a5d..f6653a3126574ff91eb115f2af3dda260595b8e1 100644 (file)
@@ -95,7 +95,7 @@ var
 implementation
 
 uses
-  Math, e_log, g_map, g_gfx, g_player, SysUtils, MAPDEF,
+  Math, geom, e_log, g_map, g_gfx, g_player, SysUtils, MAPDEF,
   StrUtils, e_graphics, g_monsters, g_items, g_game;
 
 function g_PatchLength(X1, Y1, X2, Y2: Integer): Word;
@@ -138,7 +138,7 @@ begin
   if gPlayers = nil then Exit;
 
   for a := 0 to High(gPlayers) do
-    if (gPlayers[a] <> nil) and gPlayers[a].Live then
+    if (gPlayers[a] <> nil) and gPlayers[a].alive then
       if gPlayers[a].Collide(X, Y, Width, Height) then
       begin
         Result := True;
@@ -454,8 +454,8 @@ 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 = D_LEFT)) or
-     ((b^.X < a^.X) and (d = D_RIGHT)) then
+  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;
@@ -559,13 +559,17 @@ begin
 end;}
 
 function g_CollideLine(x1, y1, x2, y2, rX, rY: Integer; rWidth, rHeight: Word): Boolean;
+{
 var
   i: Integer;
   dx, dy: Integer;
   Xerr, Yerr: Integer;
   incX, incY: Integer;
   x, y, d: Integer;
+}
 begin
+  result := lineAABBIntersects(x1, y1, x2, y2, rX, rY, rWidth, rHeight);
+{
   Result := True;
 
   Xerr := 0;
@@ -604,6 +608,7 @@ begin
   end;
 
   Result := False;
+}
 end;
 
 function GetStr(var Str: string): string;
@@ -959,7 +964,7 @@ begin
     begin
       p := g_Player_Get(UID);
       if p = nil then Exit;
-      if not p.Live then Exit;
+      if not p.alive then Exit;
 
       o^ := p.Obj;
     end;
@@ -968,7 +973,7 @@ begin
     begin
       m := g_Monsters_ByUID(UID);
       if m = nil then Exit;
-      if not m.Live then Exit;
+      if not m.alive then Exit;
 
       o^ := m.Obj;
     end;