From ff37a80149a147d6ff9ca3695d303213ebba833e Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Sun, 19 Feb 2023 17:35:44 +0300 Subject: [PATCH] gl: implement d_sounds --- src/game/g_console.pas | 1 - src/game/g_game.pas | 12 +----------- src/game/renders/opengl/r_render.pas | 14 ++++++++++++-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/game/g_console.pas b/src/game/g_console.pas index 3b2f290..1f1ed05 100644 --- a/src/game/g_console.pas +++ b/src/game/g_console.pas @@ -1049,7 +1049,6 @@ begin AddCommand('version', ConsoleCommands); AddCommand('d_window', DebugCommands); - AddCommand('d_sounds', DebugCommands); AddCommand('d_winmsg', DebugCommands); AddCommand('d_monoff', DebugCommands); AddCommand('d_botoff', DebugCommands); diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 8ad28c2..a141feb 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -1,4 +1,4 @@ - (* Copyright (C) Doom 2D: Forever Developers +(* Copyright (C) Doom 2D: Forever Developers * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -312,7 +312,6 @@ var gRC_FullScreen, gRC_Maximized: Boolean; gLanguageChange: Boolean = False; gDebugMode: Boolean = False; - g_debug_Sounds: Boolean = False; g_debug_WinMsgs: Boolean = False; g_debug_MonsterOff: Boolean = False; g_debug_BotAIOff: Byte = 0; @@ -1030,7 +1029,6 @@ end; procedure ClearDebugCvars(); begin - g_debug_Sounds := False; g_debug_WinMsgs := False; g_debug_MonsterOff := False; g_debug_BotAIOff := 0; @@ -4666,14 +4664,6 @@ begin g_Console_Add(Format('gScreenWidth = %d, gScreenHeight = %d', [gScreenWidth, gScreenHeight])); g_Console_Add(Format('gScreenWidth = %d, gScreenHeight = %d', [gScreenWidth, gScreenHeight])); end - else if cmd = 'd_sounds' then - begin - if (Length(P) > 1) and - ((P[1] = '1') or (P[1] = '0')) then - g_Debug_Sounds := (P[1][1] = '1'); - - g_Console_Add(Format('d_sounds is %d', [Byte(g_Debug_Sounds)])); - end else if cmd = 'd_winmsg' then begin if (Length(P) > 1) and diff --git a/src/game/renders/opengl/r_render.pas b/src/game/renders/opengl/r_render.pas index 44ee5b6..0a27c45 100644 --- a/src/game/renders/opengl/r_render.pas +++ b/src/game/renders/opengl/r_render.pas @@ -99,6 +99,7 @@ implementation {$ENDIF} SysUtils, Classes, Math, g_basic, + e_sound, // DebugSound e_log, e_res, utils, wadreader, mapdef, g_game, g_map, g_panel, g_options, g_console, g_player, g_weapons, g_language, g_triggers, g_monsters, g_net, g_netmaster, @@ -118,6 +119,7 @@ implementation FPS, FPSCounter, FPSTime: LongWord; TakeScreenShot: Boolean; + DebugSound: Boolean; procedure r_Render_LoadTextures; begin @@ -1132,7 +1134,7 @@ implementation end; procedure r_Render_Draw; - var p1, p2: TPlayer; time: LongWord; pw, ph: Integer; + var p1, p2: TPlayer; time: LongWord; pw, ph, i, j: Integer; begin if gExit = EXIT_QUIT then exit; @@ -1324,7 +1326,12 @@ implementation r_Console_Draw(false); - // TODO g_debug_Sounds + if DebugSound and gGameOn then + begin + for i := 0 to High(e_SoundsArray) do + for j := 0 to e_SoundsArray[i].nRefs do + r_Draw_FillRect(i + 100, j + 100, i + 100 + 1, j + 100 + 1, 255, 0, 0, 255); + end; if gShowFPS then begin @@ -1478,4 +1485,7 @@ implementation end; {$ENDIF} +begin + conRegVar('d_sounds', @DebugSound, '', ''); + DebugSound := false; end. -- 2.29.2