00001
00002
00003
00004 #include "b_local.h"
00005 #include "q_shared.h"
00006
00007
00008
00009
00010 void Debug_Printf (vmCvar_t *cv, int debugLevel, char *fmt, ...)
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 }
00036
00037
00038
00039
00040
00041 void Debug_NPCPrintf (gentity_t *printNPC, vmCvar_t *cv, int debugLevel, char *fmt, ...)
00042 {
00043 int color;
00044 va_list argptr;
00045 char msg[1024];
00046
00047 if (cv->value < debugLevel)
00048 {
00049 return;
00050 }
00051
00052
00053
00054
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 }