diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index f966e26229eeac837a2e2536655b547d2a8a10f2..802425a68977ff8074cc0b4ba967bf6dcdfdafbb 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
g_profile_frame_update: Boolean = false;
g_profile_frame_draw: Boolean = false;
+ g_profile_collision: Boolean = false;
+ g_profile_history_size: Integer = 1000;
procedure g_ResetDynlights ();
procedure g_AddDynLight (x, y, radius: Integer; r, g, b, a: Single);
*)
-procedure drawProfiles (x, y: Integer; prof: TProfiler);
+function calcProfilesHeight (prof: TProfiler): Integer;
+begin
+ result := 0;
+ if (prof = nil) then exit;
+ if (length(prof.bars) = 0) then exit;
+ result := length(prof.bars)*(16+2);
+end;
+
+// returns width
+function drawProfiles (x, y: Integer; prof: TProfiler): Integer;
var
wdt, hgt: Integer;
yy: Integer;
- ii, idx: Integer;
+ ii: Integer;
begin
+ result := 0;
if (prof = nil) then exit;
// gScreenWidth
if (length(prof.bars) = 0) then exit;
wdt := 192;
- hgt := length(prof.bars)*(16+2);
+ hgt := calcProfilesHeight(prof);
if (x < 0) then x := gScreenWidth-(wdt-1)+x;
if (y < 0) then y := gScreenHeight-(hgt-1)+y;
// background
e_TextureFontPrintEx(x+2+4*prof.bars[ii].level, yy, Format('%s: %d', [prof.bars[ii].name, prof.bars[ii].value]), gStdFont, 255, 255, 0, 1, false);
Inc(yy, 16+2);
end;
+ result := wdt;
end;
Exit;
end;
- if (profileFrameDraw = nil) then profileFrameDraw := TProfiler.Create('MAP RENDER');
+ if (profileFrameDraw = nil) then profileFrameDraw := TProfiler.Create('MAP RENDER', g_profile_history_size);
profileFrameDraw.mainBegin(g_profile_frame_draw);
gPlayerDrawn := p;
p.DrawGUI();
end;
+procedure drawProfilers ();
+var
+ px: Integer = -1;
+begin
+ if g_profile_frame_draw then px := px-drawProfiles(px, -1, profileFrameDraw);
+ if g_profile_collision then px := px-drawProfiles(px, -1, profMapCollision);
+end;
+
procedure g_Game_Draw();
var
ID: DWORD;
Format('%d:%.2d:%.2d', [gTime div 1000 div 3600, (gTime div 1000 div 60) mod 60, gTime div 1000 mod 60]),
gStdFont);
- if g_profile_frame_draw then drawProfiles(-1, -1, profileFrameDraw); //drawProfiles(-1, -1, 'MAP RENDER');
+ drawProfilers();
end;
procedure g_Game_Quit();
begin
//if not gDebugMode then exit;
cmd := LowerCase(P[0]);
+
if cmd = 'dpp' then
begin
g_profile_frame_draw := not g_profile_frame_draw;
exit;
end;
+
if cmd = 'dpu' then
begin
g_profile_frame_update := not g_profile_frame_update;
exit;
end;
- if cmd = 'r_draw_grid' then
+
+ if cmd = 'dpc' then
+ begin
+ g_profile_collision := not g_profile_collision;
+ exit;
+ end;
+
+ if cmd = 'r_gridrender' then
begin
case getBool(1) of
-1: begin end;
if gdbg_map_use_grid_render then g_Console_Add('grid rendering: tan') else g_Console_Add('grid rendering: ona');
exit;
end;
+
if cmd = 'dbg_coldet_grid' then
begin
case getBool(1) of
if gdbg_map_use_grid_coldet then g_Console_Add('grid coldet: tan') else g_Console_Add('grid coldet: ona');
exit;
end;
+
+ if (cmd = 'sq_use_grid') or (cmd = 'sq_use_sap') then
+ begin
+ case getBool(1) of
+ -1: begin end;
+ 0: gdbg_map_use_sap := (cmd = 'sq_use_grid');
+ 1: gdbg_map_use_sap := (cmd = 'sq_use_sap');
+ end;
+ if gdbg_map_use_sap then g_Console_Add('coldet: sap') else g_Console_Add('coldet: grid');
+ exit;
+ end;
end;
procedure DebugCommands(P: SArray);
s := Find_Param_Value(pars, '--profile-frame');
if (s <> '') then g_profile_frame_draw := true;
+ s := Find_Param_Value(pars, '--profile-coldet');
+ if (s <> '') then g_profile_collision := true;
+
// Debug mode:
s := Find_Param_Value(pars, '--debug');
if (s <> '') then