Miles: put event queue warnings behind a cvar

These warnings can get verbose, especially if events from the map itself are missing. Put behind a cvar and enabled it by default in development configurations.
This commit is contained in:
Kawe Mazidjatari 2024-04-23 00:15:02 +02:00
parent 8ef05a8f43
commit 065f86391e
2 changed files with 16 additions and 5 deletions

View File

@ -6,6 +6,7 @@
#include "filesystem/filesystem.h"
static ConVar miles_debug("miles_debug", "0", FCVAR_RELEASE, "Enables debug prints for the Miles Sound System", "1 = print; 0 (zero) = no print");
static ConVar miles_warnings("miles_warnings", "0", FCVAR_RELEASE, "Enables warning prints for the Miles Sound System", "1 = print; 0 (zero) = no print");
//-----------------------------------------------------------------------------
// Purpose: logs debug output emitted from the Miles Sound System
@ -40,7 +41,8 @@ bool Miles_Initialize()
// if we are loading english and the file is still not found, we can let it hit the regular engine error, since that is not recoverable
if (!FileSystem()->FileExists(baseStreamFilePath.c_str()))
{
Error(eDLL_T::AUDIO, NO_ERROR, "%s: attempted to load language '%s' but the required streaming source file (%s) was not found. falling back to english...\n", __FUNCTION__, pszLanguage, baseStreamFilePath.c_str());
Error(eDLL_T::AUDIO, NO_ERROR, "%s: attempted to load language '%s' but the required streaming source file (%s) was not found. falling back to '%s'...\n",
__FUNCTION__, pszLanguage, baseStreamFilePath.c_str(), MILES_DEFAULT_LANGUAGE);
pszLanguage = MILES_DEFAULT_LANGUAGE;
miles_language->SetValue(pszLanguage);
@ -99,11 +101,14 @@ void CSOM_AddEventToQueue(const char* eventName)
v_CSOM_AddEventToQueue(eventName);
if (g_milesGlobals->queuedEventHash == 1)
Warning(eDLL_T::AUDIO, "%s: failed to add event to queue; invalid event name '%s'\n", __FUNCTION__, eventName);
if (miles_warnings.GetBool())
{
if (g_milesGlobals->queuedEventHash == 1)
Warning(eDLL_T::AUDIO, "%s: failed to add event to queue; invalid event name '%s'\n", __FUNCTION__, eventName);
if (g_milesGlobals->queuedEventHash == 2)
Warning(eDLL_T::AUDIO, "%s: failed to add event to queue; event '%s' not found.\n", __FUNCTION__, eventName);
if (g_milesGlobals->queuedEventHash == 2)
Warning(eDLL_T::AUDIO, "%s: failed to add event to queue; event '%s' not found.\n", __FUNCTION__, eventName);
}
};

View File

@ -72,3 +72,9 @@ cl_ent_absbox "1" // Display entity abs bo
gl_clear_color_buffer "1" // Enable or disable the clearing of the main color buffer.
//mat_sync_rt "1" // Enable to debug render threads more easily ( !slower! ).
//mat_sync_rt_flushes_gpu "1" // Enable to debug render threads more easily ( !slower! ).
//////////////////////////
//// SOUND ////
//////////////////////////
//miles_debug "1" // Enable miles debug ( !slower! ).
miles_warnings "1" // Enable miles warnings.