DEADSOFTWARE

grid: `traceBox()` API; `sweepAABB()` API
[d2df-sdl.git] / src / game / g_map.pas
index ae8ee105f42f3bc783b26d62a6ec4ac7ff08d70f..bbf39cb5efb7bad44613c76d9352e0cb2655b37b 100644 (file)
@@ -373,7 +373,7 @@ begin
       result := dfmapdef.parseMap(pr);
     except on e: Exception do
       begin
-        if (pr <> nil) then e_LogWritefln('ERROR at (%s,%s): %s', [pr.line, pr.col, e.message])
+        if (pr <> nil) then e_LogWritefln('ERROR at (%s,%s): %s', [pr.tokLine, pr.tokCol, e.message])
         else e_LogWritefln('ERROR: %s', [e.message]);
         pr.Free(); // will free `wst`
         result := nil;
@@ -1677,6 +1677,12 @@ begin
 
     FreeMem(Data);
 
+    if (mapReader = nil) then
+    begin
+      e_LogWritefln('invalid map file: ''%s''', [mapResName]);
+      exit;
+    end;
+
     generateExternalResourcesList(mapReader);
     mapTextureList := mapReader['texture'];
     // get all other lists here too
@@ -2224,6 +2230,8 @@ begin
 
   FreeMem(Data);
 
+  if (mapReader = nil) then exit;
+
   if (mapReader.Width > 0) and (mapReader.Height > 0) then
   begin
     Result.Name := mapReader.MapName;
@@ -2430,6 +2438,8 @@ var
   end;
 
 begin
+  if g_dbgpan_mplat_step then g_dbgpan_mplat_active := true;
+
   UpdatePanelArray(gWalls);
   UpdatePanelArray(gRenderBackgrounds);
   UpdatePanelArray(gRenderForegrounds);
@@ -2438,6 +2448,8 @@ begin
   UpdatePanelArray(gAcid2);
   UpdatePanelArray(gSteps);
 
+  if g_dbgpan_mplat_step then begin g_dbgpan_mplat_step := false; g_dbgpan_mplat_active := false; end;
+
   if gGameSettings.GameMode = GM_CTF then
   begin
     for a := FLAG_RED to FLAG_BLUE do
@@ -2483,7 +2495,7 @@ begin
               if j > High(gPlayers) then j := 0;
               if gPlayers[j] <> nil then
               begin
-                if gPlayers[j].Live and g_Obj_Collide(@Obj, @gPlayers[j].Obj) then
+                if gPlayers[j].alive and g_Obj_Collide(@Obj, @gPlayers[j].Obj) then
                 begin
                   if gPlayers[j].GetFlag(a) then Break;
                 end;