From: Ketmar Dark Date: Tue, 22 Aug 2017 10:47:40 +0000 (+0300) Subject: more particle control options X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=de88b5482374846d66aefa81d45394213057082b;p=d2df-sdl.git more particle control options --- diff --git a/src/game/g_basic.pas b/src/game/g_basic.pas index a579023..e3655bb 100644 --- a/src/game/g_basic.pas +++ b/src/game/g_basic.pas @@ -88,6 +88,10 @@ procedure SortSArray(var S: SArray); function b_Text_Format(S: string): string; function b_Text_Unformat(S: string): string; + +var + gmon_dbg_los_enabled: Boolean = true; + implementation uses @@ -455,6 +459,8 @@ end; 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 8ce2167..7d563ae 100644 --- a/src/game/g_console.pas +++ b/src/game/g_console.pas @@ -405,18 +405,14 @@ begin //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 ab82f01..38fb35a 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -4941,102 +4941,40 @@ var 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 44a9db4..4be9437 100644 --- a/src/game/g_gfx.pas +++ b/src/game/g_gfx.pas @@ -53,12 +53,17 @@ function g_GFX_GetMax(): Integer; 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 @@ -104,52 +109,59 @@ var 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 @@ -825,6 +837,7 @@ var 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 45a3fa3..dba67ec 100644 --- a/src/game/g_map.pas +++ b/src/game/g_map.pas @@ -2439,7 +2439,7 @@ begin 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; @@ -2450,7 +2450,7 @@ begin 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; @@ -2493,7 +2493,6 @@ begin begin LiftType := t; - { g_Mark(X, Y, Width, Height, MARK_LIFT, False); if LiftType = 0 then @@ -2504,7 +2503,6 @@ begin 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 ac9c9c6..f7770bb 100644 --- a/src/game/g_window.pas +++ b/src/game/g_window.pas @@ -48,7 +48,7 @@ uses 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; @@ -713,6 +713,15 @@ begin //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);