forked from circa-III/basejkaplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNPC_misc.c
91 lines (74 loc) · 2.28 KB
/
NPC_misc.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
===========================================================================
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Copyright (C) 2013 - 2015, OpenJK contributors
This file is part of the OpenJK source code.
OpenJK is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
===========================================================================
*/
//
// NPC_misc.cpp
//
#include "b_local.h"
#include "qcommon/q_shared.h"
/*
Debug_Printf
*/
void Debug_Printf (vmCvar_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;
va_start (argptr,fmt);
Q_vsnprintf(msg, sizeof(msg), fmt, argptr);
va_end (argptr);
Com_Printf("%s%5i:%s", color, level.time, msg);
}
/*
Debug_NPCPrintf
*/
void Debug_NPCPrintf (gentity_t *printNPC, vmCvar_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;
va_start (argptr,fmt);
Q_vsnprintf(msg, sizeof(msg), fmt, argptr);
va_end (argptr);
Com_Printf ("%c%c%5i (%s) %s", Q_COLOR_ESCAPE, color, level.time, printNPC->targetname, msg);
}