summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5b1aa74)
raw | patch | inline | side by side (parent: 5b1aa74)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Tue, 22 Aug 2017 10:47:40 +0000 (13:47 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Wed, 23 Aug 2017 18:23:55 +0000 (21:23 +0300) |
diff --git a/src/game/g_basic.pas b/src/game/g_basic.pas
index a5790239f616380501b8e33b29ce7a19d0d7954d..e3655bbac9678b575f1653b5d0ac535e26f8b6d0 100644 (file)
--- a/src/game/g_basic.pas
+++ b/src/game/g_basic.pas
function b_Text_Format(S: string): string;
function b_Text_Unformat(S: string): string;
+
+var
+ gmon_dbg_los_enabled: Boolean = true;
+
implementation
uses
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
begin
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 8ce21672eefc219b83daf63e470340afc792e893..7d563ae8868f4480cfbeb0afc6b561412c942854 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
//AddCommand('pf_update_frame', ProfilerCommands);
AddCommand('pf_coldet', ProfilerCommands, 'draw collision detection profiles');
AddCommand('r_sq_draw', ProfilerCommands, 'accelerated spatial queries in rendering');
- //AddCommand('r_sq_use_grid', ProfilerCommands, 'use grid for render acceleration');
- //AddCommand('r_sq_use_tree', ProfilerCommands, 'use tree for render acceleration');
AddCommand('cd_sq_enabled', ProfilerCommands, 'accelerated spatial queries in map coldet');
-
- //AddCommand('t_dump_node_queries', ProfilerCommands);
-
- //AddCommand('sq_use_grid', ProfilerCommands, 'use grid for map coldet acceleration');
- //AddCommand('sq_use_tree', ProfilerCommands, 'use tree for map coldet acceleration');
-
AddCommand('mon_sq_enabled', ProfilerCommands, 'use accelerated spatial queries for monsters');
AddCommand('wtrace_sq_enabled', ProfilerCommands, 'use accelerated weapon hitscan trace');
+ AddCommand('pr_enabled', ProfilerCommands, 'enable/disable particles');
+ AddCommand('pr_phys_enabled', ProfilerCommands, 'enable/disable particle physics');
+ AddCommand('los_enabled', ProfilerCommands, 'enable/disable LOS calculations');
+
AddCommand('p1_name', GameCVars);
AddCommand('p2_name', GameCVars);
AddCommand('p1_color', GameCVars);
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index ab82f010edd0b0294f0338d3b6199400797f0efe..38fb35a5f5b8792903142ade3cfcfcd5e6df3fe3 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
if (P[idx] = '1') or (P[idx] = 'on') or (P[idx] = 'true') or (P[idx] = 'tan') then result := 1;
end;
-begin
- //if not gDebugMode then exit;
- cmd := LowerCase(P[0]);
-
- if cmd = 'pf_draw_frame' then
- begin
- g_profile_frame_draw := not g_profile_frame_draw;
- exit;
- end;
-
- if cmd = 'pf_update_frame' then
- begin
- g_profile_frame_update := not g_profile_frame_update;
- exit;
- end;
-
- if cmd = 'pf_coldet' then
- begin
- g_profile_collision := not g_profile_collision;
- exit;
- end;
-
- if cmd = 'r_sq_draw' then
- begin
- case getBool(1) of
- -1: begin end;
- 0: gdbg_map_use_accel_render := false;
- 1: gdbg_map_use_accel_render := true;
- end;
- if gdbg_map_use_accel_render then g_Console_Add('accelerated rendering: tan') else g_Console_Add('accelerated rendering: ona');
- exit;
- end;
-
- if cmd = 'cd_sq_enabled' then
- begin
- case getBool(1) of
- -1: begin end;
- 0: gdbg_map_use_accel_coldet := false;
- 1: gdbg_map_use_accel_coldet := true;
- end;
- if gdbg_map_use_accel_coldet then g_Console_Add('accelerated coldet: tan') else g_Console_Add('accelerated coldet: ona');
- exit;
- end;
-
- {
- if (cmd = 'sq_use_grid') or (cmd = 'sq_use_tree') then
- begin
- gdbg_map_use_tree_coldet := (cmd = 'sq_use_tree');
- if gdbg_map_use_tree_coldet then g_Console_Add('coldet acceleration: tree') else g_Console_Add('coldet acceleration: grid');
- exit;
- end;
-
- if (cmd = 'r_sq_use_grid') or (cmd = 'r_sq_use_tree') then
- begin
- gdbg_map_use_tree_draw := (cmd = 'r_sq_use_tree');
- if gdbg_map_use_tree_draw then g_Console_Add('render acceleration: tree') else g_Console_Add('render acceleration: grid');
- exit;
- end;
- }
-
- {
- if (cmd = 't_dump_node_queries') then
+ procedure binaryFlag (var flag: Boolean; msg: string);
begin
- case getBool(1) of
- -1: begin end;
- 0: gdbg_map_dump_coldet_tree_queries := false;
- 1: gdbg_map_dump_coldet_tree_queries := true;
+ if (Length(p) > 2) then
+ begin
+ g_Console_Add('too many arguments to '''+P[0]+'''');
+ end
+ else
+ begin
+ case getBool(1) of
+ -1: begin end;
+ 0: flag := false;
+ 1: flag := true;
+ end;
+ if flag then g_Console_Add(msg+': tan') else g_Console_Add(msg+': ona');
end;
- if gdbg_map_dump_coldet_tree_queries then g_Console_Add('grid coldet tree queries: tan') else g_Console_Add('grid coldet tree queries: ona');
- exit;
end;
- }
- if (cmd = 'mon_sq_enabled') then
- begin
- case getBool(1) of
- -1: begin end;
- 0: gmon_debug_use_sqaccel := false;
- 1: gmon_debug_use_sqaccel := true;
- end;
- if gmon_debug_use_sqaccel then g_Console_Add('accelerated monster coldet: tan') else g_Console_Add('accelerated monster coldet: ona');
- exit;
- end;
+begin
+ //if not gDebugMode then exit;
+ cmd := LowerCase(P[0]);
- if (cmd = 'wtrace_sq_enabled') then
- begin
- case getBool(1) of
- -1: begin end;
- 0: gwep_debug_fast_trace := false;
- 1: gwep_debug_fast_trace := true;
- end;
- if gwep_debug_fast_trace then g_Console_Add('accelerated weapon hitscan: tan') else g_Console_Add('accelerated weapon hitscan: ona');
- exit;
- end;
+ if (cmd = 'pf_draw_frame') then begin binaryFlag(g_profile_frame_draw, 'render profiles'); exit; end;
+ if (cmd = 'pf_update_frame') then begin binaryFlag(g_profile_frame_update, 'update profiles (not yet)'); exit; end;
+ if (cmd = 'pf_coldet') then begin binaryFlag(g_profile_collision, 'coldet profiles'); exit; end;
+ if (cmd = 'r_sq_draw') then begin binaryFlag(gdbg_map_use_accel_render, 'accelerated rendering'); exit; end;
+ if (cmd = 'cd_sq_enabled') then begin binaryFlag(gdbg_map_use_accel_coldet, 'accelerated map coldet'); exit; end;
+ if (cmd = 'mon_sq_enabled') then begin binaryFlag(gmon_debug_use_sqaccel, 'accelerated monster coldet'); exit; end;
+ if (cmd = 'wtrace_sq_enabled') then begin binaryFlag(gwep_debug_fast_trace, 'accelerated weapon hitscan'); exit; end;
+ if (cmd = 'pr_enabled') then begin binaryFlag(gpart_dbg_enabled, 'particles'); exit; end;
+ if (cmd = 'pr_phys_enabled') then begin binaryFlag(gpart_dbg_phys_enabled, 'particle physics'); exit; end;
+ if (cmd = 'los_enabled') then begin binaryFlag(gmon_dbg_los_enabled, 'LOS calculations'); exit; end;
end;
+
procedure DebugCommands(P: SArray);
var
a, b: Integer;
diff --git a/src/game/g_gfx.pas b/src/game/g_gfx.pas
index 44a9db46fc7adcc63d9c3b734a55f55bbab9d275..4be9437ab278b002c609235a6865c85c3fadab02 100644 (file)
--- a/src/game/g_gfx.pas
+++ b/src/game/g_gfx.pas
procedure g_GFX_OnceAnim(X, Y: Integer; Anim: TAnimation; AnimType: Byte = 0);
-//procedure g_Mark(x, y, Width, Height: Integer; t: Byte; st: Boolean);
+procedure g_Mark(x, y, Width, Height: Integer; t: Byte; st: Boolean);
procedure g_GFX_Update();
procedure g_GFX_Draw();
+var
+ gpart_dbg_enabled: Boolean = true;
+ gpart_dbg_phys_enabled: Boolean = true;
+
+
implementation
uses
function isBlockedAt (x, y: Integer): Boolean; inline;
begin
+ if not gpart_dbg_phys_enabled then begin result := false; exit; end;
result := g_Map_HasAnyPanelAtPoint(x, y, (PANEL_WALL or PANEL_CLOSEDOOR or PANEL_STEP));
end;
-
// ???
function isWallAt (x, y: Integer): Boolean; inline;
begin
+ if not gpart_dbg_phys_enabled then begin result := false; exit; end;
result := g_Map_HasAnyPanelAtPoint(x, y, (PANEL_WALL or PANEL_STEP));
end;
-
function isLiftUpAt (x, y: Integer): Boolean; inline;
begin
+ if not gpart_dbg_phys_enabled then begin result := false; exit; end;
result := g_Map_HasAnyPanelAtPoint(x, y, PANEL_LIFTUP);
end;
function isLiftDownAt (x, y: Integer): Boolean; inline;
begin
+ if not gpart_dbg_phys_enabled then begin result := false; exit; end;
result := g_Map_HasAnyPanelAtPoint(x, y, PANEL_LIFTDOWN);
end;
function isLiftLeftAt (x, y: Integer): Boolean; inline;
begin
+ if not gpart_dbg_phys_enabled then begin result := false; exit; end;
result := g_Map_HasAnyPanelAtPoint(x, y, PANEL_LIFTLEFT);
end;
function isLiftRightAt (x, y: Integer): Boolean; inline;
begin
+ if not gpart_dbg_phys_enabled then begin result := false; exit; end;
result := g_Map_HasAnyPanelAtPoint(x, y, PANEL_LIFTRIGHT);
end;
-
function isLiquidAt (x, y: Integer): Boolean; inline;
begin
+ if not gpart_dbg_phys_enabled then begin result := false; exit; end;
result := g_Map_HasAnyPanelAtPoint(x, y, (PANEL_WATER or PANEL_ACID1 or PANEL_ACID2));
end;
-
function isAnythingAt (x, y: Integer): Boolean; inline;
begin
+ if not gpart_dbg_phys_enabled then begin result := false; exit; end;
result := g_Map_HasAnyPanelAtPoint(x, y, (PANEL_WALL or PANEL_CLOSEDOOR or PANEL_OPENDOOR or PANEL_WATER or PANEL_ACID1 or PANEL_ACID2 or PANEL_STEP or PANEL_LIFTUP or PANEL_LIFTDOWN or PANEL_LIFTLEFT or PANEL_LIFTRIGHT));
end;
-{$IF DEFINED(HAS_COLLIDE_BITMAP)}
procedure g_Mark(x, y, Width, Height: Integer; t: Byte; st: Boolean);
+{$IF not DEFINED(HAS_COLLIDE_BITMAP)}
+begin
+end;
+{$ELSE}
var
yy, y2, xx, x2: Integer;
begin
s: ShortInt;
//c: Byte;
begin
+ if not gpart_dbg_enabled then exit;
if Particles <> nil then
begin
w := gMapInfo.Width;
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index 45a3fa3ccfb5b5c0e48acc5281dd295b55d782a3..dba67ec98f1d18122f0f420a48e1db41a3cb18fe 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
with gWalls[ID] do
begin
Enabled := True;
- //g_Mark(X, Y, Width, Height, MARK_DOOR, True);
+ g_Mark(X, Y, Width, Height, MARK_DOOR, True);
if g_Game_IsServer and g_Game_IsNet then MH_SEND_PanelState(PanelType, ID);
end;
with gWalls[ID] do
begin
Enabled := False;
- //g_Mark(X, Y, Width, Height, MARK_DOOR, False);
+ g_Mark(X, Y, Width, Height, MARK_DOOR, False);
if g_Game_IsServer and g_Game_IsNet then MH_SEND_PanelState(PanelType, ID);
end;
begin
LiftType := t;
- {
g_Mark(X, Y, Width, Height, MARK_LIFT, False);
if LiftType = 0 then
g_Mark(X, Y, Width, Height, MARK_LIFTLEFT, True)
else if LiftType = 3 then
g_Mark(X, Y, Width, Height, MARK_LIFTRIGHT, True);
- }
if g_Game_IsServer and g_Game_IsNet then MH_SEND_PanelState(PanelType, ID);
end;
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index ac9c9c6bd8e6f11b398b194b199570418df918ed..f7770bbb7511f0fcd3fb9d9b7a7637e856820689 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
SDL2, GL, GLExt, e_graphics, e_log, g_main,
g_console, SysUtils, e_input, g_options, g_game,
g_basic, g_textures, e_sound, g_sound, g_menu, ENet, g_net,
- g_map;
+ g_map, g_gfx;
var
h_Wnd: PSDL_Window;
//if ParamStr(idx) = '--grid-draw' then gdbg_map_use_tree_draw := false;
//if ParamStr(idx) = '--tree-coldet' then gdbg_map_use_tree_coldet := true;
//if ParamStr(idx) = '--grid-coldet' then gdbg_map_use_tree_coldet := false;
+ if ParamStr(idx) = '--no-particles' then gpart_dbg_enabled := false;
+ if ParamStr(idx) = '--no-los' then gmon_dbg_los_enabled := false;
+
+ if ParamStr(idx) = '--no-part-phys' then gpart_dbg_phys_enabled := false;
+ if ParamStr(idx) = '--no-part-physics' then gpart_dbg_phys_enabled := false;
+ if ParamStr(idx) = '--no-particles-phys' then gpart_dbg_phys_enabled := false;
+ if ParamStr(idx) = '--no-particles-physics' then gpart_dbg_phys_enabled := false;
+ if ParamStr(idx) = '--no-particle-phys' then gpart_dbg_phys_enabled := false;
+ if ParamStr(idx) = '--no-particle-physics' then gpart_dbg_phys_enabled := false;
end;
//if gdbg_map_use_tree_draw then e_WriteLog('using TREE renderer', MSG_NOTIFY);