codemp/game/NPC_misc.c File Reference

#include "b_local.h"
#include "q_shared.h"

Go to the source code of this file.

Functions

void Debug_Printf (vmCvar_t *cv, int debugLevel, char *fmt,...)
void Debug_NPCPrintf (gentity_t *printNPC, vmCvar_t *cv, int debugLevel, char *fmt,...)


Function Documentation

void Debug_NPCPrintf gentity_t printNPC,
vmCvar_t cv,
int  debugLevel,
char *  fmt,
... 
 

Definition at line 41 of file NPC_misc.c.

References COLOR_GREEN, COLOR_RED, COLOR_WHITE, COLOR_YELLOW, Com_Printf(), DEBUG_LEVEL_DETAIL, DEBUG_LEVEL_ERROR, DEBUG_LEVEL_INFO, DEBUG_LEVEL_WARNING, gentity_t, level, Q_COLOR_ESCAPE, gentity_s::targetname, level_locals_t::time, va_end, va_list, va_start, vmCvar_t::value, and vsprintf().

00042 {
00043         int                     color;
00044         va_list         argptr;
00045         char            msg[1024];
00046 
00047         if (cv->value < debugLevel)
00048         {
00049                 return;
00050         }
00051 
00052 //      if ( debugNPCName.string[0] && Q_stricmp( debugNPCName.string, printNPC->targetname) != 0 ) 
00053 //      {
00054 //              return;
00055 //      }
00056 
00057         if (debugLevel == DEBUG_LEVEL_DETAIL)
00058                 color = COLOR_WHITE;
00059         else if (debugLevel == DEBUG_LEVEL_INFO)
00060                 color = COLOR_GREEN;
00061         else if (debugLevel == DEBUG_LEVEL_WARNING)
00062                 color = COLOR_YELLOW;
00063         else if (debugLevel == DEBUG_LEVEL_ERROR)
00064                 color = COLOR_RED;
00065         else
00066                 color = COLOR_RED;
00067 
00068         va_start (argptr,fmt);
00069         vsprintf (msg, fmt, argptr);
00070         va_end (argptr);
00071 
00072         Com_Printf ("%c%c%5i (%s) %s", Q_COLOR_ESCAPE, color, level.time, printNPC->targetname, msg);
00073 }

void Debug_Printf vmCvar_t cv,
int  debugLevel,
char *  fmt,
... 
 

Definition at line 10 of file NPC_misc.c.

References Com_Printf(), DEBUG_LEVEL_DETAIL, DEBUG_LEVEL_ERROR, DEBUG_LEVEL_INFO, DEBUG_LEVEL_WARNING, level, S_COLOR_GREEN, S_COLOR_RED, S_COLOR_WHITE, S_COLOR_YELLOW, level_locals_t::time, va_end, va_list, va_start, vmCvar_t::value, and vsprintf().

Referenced by NPC_PickEnemy().

00011 {
00012         char            *color;
00013         va_list         argptr;
00014         char            msg[1024];
00015 
00016         if (cv->value < debugLevel)
00017                 return;
00018 
00019         if (debugLevel == DEBUG_LEVEL_DETAIL)
00020                 color = S_COLOR_WHITE;
00021         else if (debugLevel == DEBUG_LEVEL_INFO)
00022                 color = S_COLOR_GREEN;
00023         else if (debugLevel == DEBUG_LEVEL_WARNING)
00024                 color = S_COLOR_YELLOW;
00025         else if (debugLevel == DEBUG_LEVEL_ERROR)
00026                 color = S_COLOR_RED;
00027         else
00028                 color = S_COLOR_RED;
00029 
00030         va_start (argptr,fmt);
00031         vsprintf (msg, fmt, argptr);
00032         va_end (argptr);
00033 
00034         Com_Printf("%s%5i:%s", color, level.time, msg);
00035 }