Initial commit.
This commit is contained in:
79
code/game/NPC_misc.cpp
Normal file
79
code/game/NPC_misc.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// NPC_misc.cpp
|
||||
//
|
||||
|
||||
// leave this line at the top for all NPC_xxxx.cpp files...
|
||||
#include "g_headers.h"
|
||||
|
||||
|
||||
|
||||
|
||||
#include "b_local.h"
|
||||
#include "q_shared.h"
|
||||
/*
|
||||
Debug_Printf
|
||||
*/
|
||||
void Debug_Printf (cvar_t *cv, int debugLevel, char *fmt, ...)
|
||||
{
|
||||
char *color;
|
||||
va_list argptr;
|
||||
char msg[1024];
|
||||
|
||||
if (cv->value < debugLevel)
|
||||
return;
|
||||
|
||||
if (debugLevel == DEBUG_LEVEL_DETAIL)
|
||||
color = S_COLOR_WHITE;
|
||||
else if (debugLevel == DEBUG_LEVEL_INFO)
|
||||
color = S_COLOR_GREEN;
|
||||
else if (debugLevel == DEBUG_LEVEL_WARNING)
|
||||
color = S_COLOR_YELLOW;
|
||||
else if (debugLevel == DEBUG_LEVEL_ERROR)
|
||||
color = S_COLOR_RED;
|
||||
else
|
||||
color = S_COLOR_RED;
|
||||
|
||||
va_start (argptr,fmt);
|
||||
vsprintf (msg, fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
gi.Printf("%s%5i:%s", color, level.time, msg);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Debug_NPCPrintf
|
||||
*/
|
||||
void Debug_NPCPrintf (gentity_t *printNPC, cvar_t *cv, int debugLevel, char *fmt, ...)
|
||||
{
|
||||
int color;
|
||||
va_list argptr;
|
||||
char msg[1024];
|
||||
|
||||
if (cv->value < debugLevel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( debugNPCName->string[0] && Q_stricmp( debugNPCName->string, printNPC->targetname) != 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (debugLevel == DEBUG_LEVEL_DETAIL)
|
||||
color = COLOR_WHITE;
|
||||
else if (debugLevel == DEBUG_LEVEL_INFO)
|
||||
color = COLOR_GREEN;
|
||||
else if (debugLevel == DEBUG_LEVEL_WARNING)
|
||||
color = COLOR_YELLOW;
|
||||
else if (debugLevel == DEBUG_LEVEL_ERROR)
|
||||
color = COLOR_RED;
|
||||
else
|
||||
color = COLOR_RED;
|
||||
|
||||
va_start (argptr,fmt);
|
||||
vsprintf (msg, fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
gi.Printf ("%c%c%5i (%s) %s", Q_COLOR_ESCAPE, color, level.time, printNPC->targetname, msg);
|
||||
}
|
||||
Reference in New Issue
Block a user