diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index 42831447a301bf9409e28a2eb38bd66590b9f4a5..b84bf3aaca6170f165147659879aa9e2971c8f28 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
uses
e_graphics, g_basic, MAPSTRUCT, g_textures, Classes,
- g_phys, wadreader, BinEditor, g_panel, g_grid, md5;
+ g_phys, wadreader, BinEditor, g_panel, g_grid, md5, xprofiler;
type
TMapInfo = record
procedure g_Map_DrawPanelShadowVolumes(lightX: Integer; lightY: Integer; radius: Integer);
+procedure g_Map_ProfilersBegin ();
+procedure g_Map_ProfilersEnd ();
+
const
RESPAWNPOINT_PLAYER1 = 1;
RESPAWNPOINT_PLAYER2 = 2;
gdbg_map_use_grid_render: Boolean = true;
gdbg_map_use_grid_coldet: Boolean = true;
+ profMapCollision: TProfiler = nil; //WARNING: FOR DEBUGGING ONLY!
implementation
gMapGrid: TBodyGrid = nil;
+procedure g_Map_ProfilersBegin ();
+begin
+ if (profMapCollision = nil) then profMapCollision := TProfiler.Create('MAP COLLISION');
+ profMapCollision.mainBegin(g_profile_collision);
+ // create sections
+ if g_profile_collision then
+ begin
+ profMapCollision.sectionBeginAccum('wall coldet');
+ profMapCollision.sectionEnd();
+ profMapCollision.sectionBeginAccum('liquid coldet');
+ profMapCollision.sectionEnd();
+ end;
+end;
+
+procedure g_Map_ProfilersEnd ();
+begin
+ if (profMapCollision <> nil) then profMapCollision.mainEnd();
+end;
+
+
function g_Map_IsSpecialTexture(Texture: String): Boolean;
begin
Result := (Texture = TEXTURE_NAME_WATER) or
@@ -2189,13 +2213,19 @@ function g_Map_CollidePanel(X, Y: Integer; Width, Height: Word; PanelType: Word;
end;
begin
- if gdbg_map_use_grid_coldet then
- begin
- result := gMapGrid.forEachInAABB(X, Y, Width, Height, checker);
- end
- else
- begin
- result := g_Map_CollidePanelOld(X, Y, Width, Height, PanelType, b1x3);
+ //TODO: detailed profile
+ if (profMapCollision <> nil) then profMapCollision.sectionBeginAccum('wall coldet');
+ try
+ if gdbg_map_use_grid_coldet then
+ begin
+ result := gMapGrid.forEachInAABB(X, Y, Width, Height, checker);
+ end
+ else
+ begin
+ result := g_Map_CollidePanelOld(X, Y, Width, Height, PanelType, b1x3);
+ end;
+ finally
+ if (profMapCollision <> nil) then profMapCollision.sectionEnd();
end;
end;
end;
begin
- if not gdbg_map_use_grid_coldet then
- begin
- result := g_Map_CollideLiquid_TextureOld(X, Y, Width, Height);
- end
- else
- begin
- texid := TEXTURE_NONE;
- gMapGrid.forEachInAABB(X, Y, Width, Height, checker);
- result := texid;
+ //TODO: detailed profile?
+ if (profMapCollision <> nil) then profMapCollision.sectionBeginAccum('liquid coldet');
+ try
+ if not gdbg_map_use_grid_coldet then
+ begin
+ result := g_Map_CollideLiquid_TextureOld(X, Y, Width, Height);
+ end
+ else
+ begin
+ texid := TEXTURE_NONE;
+ gMapGrid.forEachInAABB(X, Y, Width, Height, checker);
+ result := texid;
+ end;
+ finally
+ if (profMapCollision <> nil) then profMapCollision.sectionEnd();
end;
end;