2015-06-30 12:46:07 +03:00
|
|
|
#include "precompiled.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Globals initialization
|
|
|
|
*/
|
|
|
|
#ifndef HOOK_GAMEDLL
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
DebugOutputLevel outputLevel[ NUM_LEVELS ] =
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
{ "bot", DEBUG_BOT },
|
|
|
|
{ "career", DEBUG_CAREER },
|
|
|
|
{ "tutor", DEBUG_TUTOR },
|
|
|
|
{ "stats", DEBUG_STATS },
|
|
|
|
{ "hostage", DEBUG_HOSTAGE },
|
|
|
|
{ "all", DEBUG_ALL }
|
2015-06-30 12:46:07 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
unsigned int theDebugOutputTypes;
|
2015-08-20 13:35:01 +03:00
|
|
|
static char theDebugBuffer[ DebugBufferSize ];
|
2015-06-30 12:46:07 +03:00
|
|
|
|
|
|
|
#else // HOOK_GAMEDLL
|
|
|
|
|
|
|
|
DebugOutputLevel outputLevel[ NUM_LEVELS ];
|
|
|
|
unsigned int theDebugOutputTypes;
|
|
|
|
char theDebugBuffer[ DebugBufferSize ];
|
|
|
|
|
|
|
|
#endif // HOOK_GAMEDLL
|
|
|
|
|
|
|
|
/* <22fe8b> ../cstrike/dlls/debug.cpp:39 */
|
2015-08-20 13:35:01 +03:00
|
|
|
bool IsDeveloper(void)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
return (CVAR_GET_FLOAT("developer") > 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* <22ff69> ../cstrike/dlls/debug.cpp:45 */
|
|
|
|
NOXREF void UTIL_DPrintf(DebugOutputType outputType, char *pszMsg, ...)
|
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
if (!IsDeveloper())
|
|
|
|
return;
|
2015-06-30 12:46:07 +03:00
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
if (theDebugOutputTypes & outputType)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
va_list argptr;
|
|
|
|
va_start(argptr, pszMsg);
|
|
|
|
vsprintf(theDebugBuffer, pszMsg, argptr);
|
|
|
|
va_end(argptr);
|
|
|
|
|
|
|
|
SERVER_PRINT(theDebugBuffer);
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
/* <22fe23> ../cstrike/dlls/debug.cpp:56 */
|
2015-06-30 12:46:07 +03:00
|
|
|
void UTIL_DPrintf(char *pszMsg, ...)
|
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
if (!IsDeveloper())
|
|
|
|
return;
|
|
|
|
|
2015-06-30 12:46:07 +03:00
|
|
|
va_list argptr;
|
|
|
|
va_start(argptr, pszMsg);
|
2015-08-20 13:35:01 +03:00
|
|
|
vsprintf(theDebugBuffer, pszMsg, argptr);
|
|
|
|
va_end(argptr);
|
2015-06-30 12:46:07 +03:00
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
SERVER_PRINT(theDebugBuffer);
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* <22fe97> ../cstrike/dlls/debug.cpp:78 */
|
2015-08-20 13:35:01 +03:00
|
|
|
void PrintDebugFlags(void)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
|
|
|
char *tmp;
|
|
|
|
int remainder = DebugBufferSize;
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
theDebugBuffer[0] = '\0';
|
2015-06-30 12:46:07 +03:00
|
|
|
tmp = BufPrintf(theDebugBuffer, remainder, "mp_debug:\n");
|
|
|
|
|
|
|
|
for (int i = 0; i < NUM_LEVELS - 1; i++)
|
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
DebugOutputLevel level = outputLevel[i];
|
2015-06-30 12:46:07 +03:00
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
tmp = BufPrintf(tmp, remainder, " %s: %s\n", level.name, (theDebugOutputTypes & level.value) ? "on" : "off");
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
SERVER_PRINT(theDebugBuffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* <22fed4> ../cstrike/dlls/debug.cpp:94 */
|
2015-08-20 13:35:01 +03:00
|
|
|
void SetDebugFlag(const char *flagStr, bool state)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-12-09 01:39:54 +03:00
|
|
|
if (flagStr != NULL)
|
|
|
|
{
|
|
|
|
DebugOutputType flag;
|
|
|
|
for (int i = 0; i < ARRAYSIZE(outputLevel); i++)
|
|
|
|
{
|
|
|
|
DebugOutputLevel level = outputLevel[ i ];
|
|
|
|
|
|
|
|
if (FStrEq(level.name, flagStr))
|
|
|
|
{
|
|
|
|
flag = level.value;
|
|
|
|
|
|
|
|
if (state)
|
|
|
|
theDebugOutputTypes |= flag;
|
|
|
|
else
|
|
|
|
theDebugOutputTypes &= ~flag;
|
|
|
|
|
|
|
|
SERVER_PRINT(SharedVarArgs("mp_debug: %s is now %s\n", flagStr, state ? "on" : "off"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
SERVER_PRINT(SharedVarArgs("mp_debug: unknown variable '%s'\n", flagStr));
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* <23001f> ../cstrike/dlls/debug.cpp:126 */
|
2015-08-20 13:35:01 +03:00
|
|
|
void PrintDebugFlag(const char *flagStr)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-12-09 01:39:54 +03:00
|
|
|
if (flagStr != NULL)
|
|
|
|
{
|
|
|
|
DebugOutputType flag;
|
|
|
|
for (int i = 0; i < ARRAYSIZE(outputLevel); i++)
|
|
|
|
{
|
|
|
|
DebugOutputLevel level = outputLevel[ i ];
|
|
|
|
|
|
|
|
if (FStrEq(level.name, flagStr))
|
|
|
|
{
|
|
|
|
flag = level.value;
|
|
|
|
SERVER_PRINT(SharedVarArgs("mp_debug: %s is %s\n", flagStr, (flag & theDebugOutputTypes) ? "on" : "off"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-20 13:35:01 +03:00
|
|
|
SERVER_PRINT(SharedVarArgs("mp_debug: unknown variable '%s'\n", flagStr));
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* <2300a9> ../cstrike/dlls/debug.cpp:149 */
|
2015-08-20 13:35:01 +03:00
|
|
|
void UTIL_SetDprintfFlags(const char *flagStr)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
if (!IsDeveloper())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (flagStr != NULL && flagStr[0] != '\0')
|
|
|
|
{
|
|
|
|
if (flagStr[0] == '+')
|
|
|
|
SetDebugFlag(&flagStr[1], true);
|
|
|
|
|
|
|
|
else if (flagStr[0] == '-')
|
|
|
|
SetDebugFlag(&flagStr[1], false);
|
|
|
|
else
|
|
|
|
PrintDebugFlag(flagStr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
PrintDebugFlags();
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* <23012d> ../cstrike/dlls/debug.cpp:175 */
|
2015-08-20 13:35:01 +03:00
|
|
|
NOXREF void UTIL_BotDPrintf(char *pszMsg, ...)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
if (!IsDeveloper())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (theDebugOutputTypes & DEBUG_BOT)
|
|
|
|
{
|
|
|
|
va_list argptr;
|
|
|
|
va_start(argptr, pszMsg);
|
|
|
|
vsprintf(theDebugBuffer, pszMsg, argptr);
|
|
|
|
va_end(argptr);
|
|
|
|
|
|
|
|
SERVER_PRINT(theDebugBuffer);
|
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* <230181> ../cstrike/dlls/debug.cpp:193 */
|
2015-08-20 13:35:01 +03:00
|
|
|
void UTIL_CareerDPrintf(char *pszMsg, ...)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
if (!IsDeveloper())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (theDebugOutputTypes & DEBUG_CAREER)
|
|
|
|
{
|
|
|
|
va_list argptr;
|
|
|
|
va_start(argptr, pszMsg);
|
|
|
|
vsprintf(theDebugBuffer, pszMsg, argptr);
|
|
|
|
va_end(argptr);
|
|
|
|
|
|
|
|
SERVER_PRINT(theDebugBuffer);
|
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* <2301d5> ../cstrike/dlls/debug.cpp:211 */
|
2015-08-20 13:35:01 +03:00
|
|
|
NOXREF void UTIL_TutorDPrintf(char *pszMsg, ...)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
if (!IsDeveloper())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (theDebugOutputTypes & DEBUG_TUTOR)
|
|
|
|
{
|
|
|
|
va_list argptr;
|
|
|
|
va_start(argptr, pszMsg);
|
|
|
|
vsprintf(theDebugBuffer, pszMsg, argptr);
|
|
|
|
va_end(argptr);
|
|
|
|
|
|
|
|
SERVER_PRINT(theDebugBuffer);
|
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* <230229> ../cstrike/dlls/debug.cpp:229 */
|
2015-08-20 13:35:01 +03:00
|
|
|
NOXREF void UTIL_StatsDPrintf(char *pszMsg, ...)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
if (!IsDeveloper())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (theDebugOutputTypes & DEBUG_STATS)
|
|
|
|
{
|
|
|
|
va_list argptr;
|
|
|
|
va_start(argptr, pszMsg);
|
|
|
|
vsprintf(theDebugBuffer, pszMsg, argptr);
|
|
|
|
va_end(argptr);
|
|
|
|
|
|
|
|
SERVER_PRINT(theDebugBuffer);
|
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* <23027d> ../cstrike/dlls/debug.cpp:247 */
|
2015-08-20 13:35:01 +03:00
|
|
|
NOXREF void UTIL_HostageDPrintf(char *pszMsg, ...)
|
2015-06-30 12:46:07 +03:00
|
|
|
{
|
2015-08-20 13:35:01 +03:00
|
|
|
if (!IsDeveloper())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (theDebugOutputTypes & DEBUG_HOSTAGE)
|
|
|
|
{
|
|
|
|
va_list argptr;
|
|
|
|
va_start(argptr, pszMsg);
|
|
|
|
vsprintf(theDebugBuffer, pszMsg, argptr);
|
|
|
|
va_end(argptr);
|
|
|
|
|
|
|
|
SERVER_PRINT(theDebugBuffer);
|
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|