diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index f966e26229eeac837a2e2536655b547d2a8a10f2..fa9c2883bdd1deed73ae7041b597992ab655f2fa 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;
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;
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;
w: Word;
i, b: Integer;
begin
+ g_Map_ProfilersBegin();
+
g_ResetDynlights();
// Ïîðà âûêëþ÷àòü èãðó:
if gExit = EXIT_QUIT then
end;
if gGameOn then g_Weapon_AddDynLights();
+
+ g_Map_ProfilersEnd();
end;
procedure g_Game_LoadData();
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();
g_profile_frame_update := not g_profile_frame_update;
exit;
end;
+ if cmd = 'dpc' then
+ begin
+ g_profile_collision := not g_profile_collision;
+ exit;
+ end;
if cmd = 'r_draw_grid' then
begin
case getBool(1) of
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