Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
debug.qh File Reference
Include dependency graph for debug.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  DebugText3d

Macros

#define debug_text_3d(...)
#define debug_text_3d_2(pos, msg)
#define debug_text_3d_3(pos, msg, align)
#define debug_text_3d_4(pos, msg, align, dur)
#define debug_text_3d_5(pos, msg, align, dur, vel)

Functions

bool debug_send (entity this, entity to, int sf)
ERASEABLE void debug_text_3d_fn (vector pos, string msg, float align, float duration, vector vel)
 GENERIC_COMMAND (bufstr_get, "Examine a string buffer object", false)
 GENERIC_COMMAND (cvar_localchanges, "Print locally changed cvars", false)
 GENERIC_COMMAND (findat, "Search through entities for matching origin", false)
 GENERIC_COMMAND (findent, "Search through entities for matching classname", false)
 GENERIC_COMMAND (version, "Print the current version", false)
 NET_HANDLE (debug_text_3d, bool is_new)
 NET_HANDLE (net_debug, bool isNew)
 REGISTER_NET_TEMP (debug_text_3d)
 void (float bufhandle, string pattern, string antipattern) buf_cvarlist

Variables

bool debug
int sv_entnum
entity tag_entity

Macro Definition Documentation

◆ debug_text_3d

#define debug_text_3d ( ...)
Value:
EVAL(OVERLOAD(debug_text_3d, __VA_ARGS__))
#define debug_text_3d(...)
Definition debug.qh:486
#define OVERLOAD(F,...)
Definition misc.qh:12
#define EVAL(...)
Definition misc.qh:4

Definition at line 486 of file debug.qh.

Referenced by debug_text_3d_fn(), NET_HANDLE(), REGISTER_NET_TEMP(), and show_entnum().

◆ debug_text_3d_2

#define debug_text_3d_2 ( pos,
msg )
Value:
debug_text_3d_3(pos, msg, cvar("debug_text_3d_default_align"))
#define debug_text_3d_3(pos, msg, align)
Definition debug.qh:488
float cvar(string name)

Definition at line 487 of file debug.qh.

◆ debug_text_3d_3

#define debug_text_3d_3 ( pos,
msg,
align )
Value:
debug_text_3d_4(pos, msg, align, cvar("debug_text_3d_default_duration"))
#define debug_text_3d_4(pos, msg, align, dur)
Definition debug.qh:489

Definition at line 488 of file debug.qh.

◆ debug_text_3d_4

#define debug_text_3d_4 ( pos,
msg,
align,
dur )
Value:
debug_text_3d_5(pos, msg, align, dur, stov(cvar_string("debug_text_3d_default_velocity")))
#define debug_text_3d_5(pos, msg, align, dur, vel)
Definition debug.qh:490
vector stov(string s)
const string cvar_string(string name)

Definition at line 489 of file debug.qh.

◆ debug_text_3d_5

#define debug_text_3d_5 ( pos,
msg,
align,
dur,
vel )
Value:
debug_text_3d_fn(pos, msg, align, dur, vel)
ERASEABLE void debug_text_3d_fn(vector pos, string msg, float align, float duration, vector vel)
Definition debug.qh:493

Definition at line 490 of file debug.qh.

Function Documentation

◆ debug_send()

bool debug_send ( entity this,
entity to,
int sf )

Definition at line 42 of file debug.qh.

43 {
44 int channel = MSG_ONE;
45 msg_entity = to;
46 WriteHeader(channel, net_debug);
47 WriteShort(channel, etof(this));
48 WriteByte(channel, is_pure(this));
49 vector o = this.origin;
50 if (o == '0 0 0') // brushes
51 o = (this.absmin + this.absmax) * 0.5;
52 if (this.tag_entity)
53 o += this.tag_entity.origin;
54 WriteVector(channel, o);
55 WriteString(channel, this.classname);
56 WriteString(channel, this.sourceLoc);
57 return true;
58 }
string classname
vector absmax
vector origin
vector absmin
entity tag_entity
#define WriteHeader(to, id)
Definition net.qh:221
float MSG_ONE
Definition menudefs.qc:56
void WriteString(string data, float dest, float desto)
void WriteShort(float data, float dest, float desto)
void WriteByte(float data, float dest, float desto)
#define etof(e)
Definition misc.qh:25
#define is_pure(e)
Definition oo.qh:16
string sourceLoc
Location entity was spawned from in source.
Definition oo.qh:27
entity msg_entity
Definition progsdefs.qc:63
vector
Definition self.qh:92

References absmax, absmin, classname, entity(), etof, is_pure, msg_entity, MSG_ONE, origin, sourceLoc, tag_entity, vector, WriteByte(), WriteHeader, WriteShort(), and WriteString().

◆ debug_text_3d_fn()

ERASEABLE void debug_text_3d_fn ( vector pos,
string msg,
float align,
float duration,
vector vel )

Definition at line 493 of file debug.qh.

493 {
495 WriteVector(MSG_BROADCAST, pos);
497 WriteFloat(MSG_BROADCAST, align);
498 WriteFloat(MSG_BROADCAST, duration);
499 WriteVector(MSG_BROADCAST, vel);
500}
float MSG_BROADCAST
Definition menudefs.qc:55

References debug_text_3d, MSG_BROADCAST, vector, WriteHeader, and WriteString().

◆ GENERIC_COMMAND() [1/5]

GENERIC_COMMAND ( bufstr_get ,
"Examine a string buffer object" ,
false  )

Definition at line 201 of file debug.qh.

202{
203 switch (request)
204 {
206 {
207 int bufhandle = stof(argv(1));
208 int string_index = stof(argv(2));
209 LOG_INFO(bufstr_get(bufhandle, string_index));
210 return;
211 }
212
213 default:
215 {
216 LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " bufstr_get <bufhandle> <string_index>");
217 return;
218 }
219 }
220}
const int CMD_REQUEST_COMMAND
Definition command.qh:3
const int CMD_REQUEST_USAGE
Definition command.qh:4
#define GetProgramCommandPrefix()
Definition generic.qh:25
#define LOG_HELP(...)
Definition log.qh:85
#define LOG_INFO(...)
Definition log.qh:65
float stof(string val,...)
string argv(float n)

References argv(), CMD_REQUEST_COMMAND, CMD_REQUEST_USAGE, GetProgramCommandPrefix, LOG_HELP, LOG_INFO, and stof().

◆ GENERIC_COMMAND() [2/5]

GENERIC_COMMAND ( cvar_localchanges ,
"Print locally changed cvars" ,
false  )

Definition at line 246 of file debug.qh.

247{
248 switch (request)
249 {
251 {
252 string s = "";
253 int h = buf_create();
254 buf_cvarlist(h, "", "_"); // exclude all _ cvars as they are temporary
255 int n = buf_getsize(h);
256 for (int i = 0; i < n; ++i) {
257 string k = bufstr_get(h, i);
258 string v = cvar_string(k);
259 string d = cvar_defstring(k);
260 if (v == d)
261 continue;
262 s = strcat(s, k, " \"", v, "\" // \"", d, "\"\n");
263 }
264 buf_del(h);
265 LOG_INFO(s);
266 return;
267 }
268 default:
270 {
271 LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " cvar_localchanges");
272 return;
273 }
274 }
275}
#define buf_create
const string cvar_defstring(string name)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

References buf_create, CMD_REQUEST_COMMAND, CMD_REQUEST_USAGE, cvar_defstring(), cvar_string(), GetProgramCommandPrefix, LOG_HELP, LOG_INFO, and strcat().

◆ GENERIC_COMMAND() [3/5]

GENERIC_COMMAND ( findat ,
"Search through entities for matching origin" ,
false  )

Definition at line 369 of file debug.qh.

370{
371 switch (request)
372 {
374 {
375 vector org = stov(argv(1));
376 float dist = stof(argv(2));
377 int entcnt = 0;
379 {
380 if (dist > 0)
381 {
382 if (!vdist(it.origin - org, <, dist))
383 continue;
384 }
385 else if (it.origin != org)
386 continue;
387 LOG_HELPF("%i (%s)", it, it.classname);
388 ++entcnt;
389 });
390 if(entcnt)
391 LOG_HELPF("Found %d entities", entcnt);
392 return;
393 }
394
395 default:
396 LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
398 {
399 LOG_HELP("Usage:^3 " GetProgramCommandPrefix() " findat <position> [<dist>]");
400 LOG_HELP(" Where <position> is a vector \"x y z\"");
401 return;
402 }
403 }
404}
#define FOREACH_ENTITY_ORDERED(cond, body)
Definition iter.qh:138
#define LOG_HELPF(...)
Definition log.qh:86
#define LOG_INFOF(...)
Definition log.qh:66
vector org
Definition self.qh:92
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8

References argv(), CMD_REQUEST_COMMAND, CMD_REQUEST_USAGE, FOREACH_ENTITY_ORDERED, GetProgramCommandPrefix, LOG_HELP, LOG_HELPF, LOG_INFOF, org, stof(), stov(), vdist, and vector.

◆ GENERIC_COMMAND() [4/5]

GENERIC_COMMAND ( findent ,
"Search through entities for matching classname" ,
false  )

Definition at line 340 of file debug.qh.

341{
342 switch (request)
343 {
345 {
346 int entcnt = 0;
348 {
349 LOG_HELPF("%i (%s)", it, it.classname);
350 ++entcnt;
351 });
352 if(entcnt)
353 LOG_HELPF("Found %d entities", entcnt);
354 return;
355 }
356
357 default:
358 LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
360 {
361 LOG_HELP("Usage:^3 " GetProgramCommandPrefix() " find <classname>");
362 LOG_HELP(" Where <classname> is the classname to search for.");
363 return;
364 }
365 }
366}
#define FOREACH_ENTITY_CLASS_ORDERED(class, cond, body)
Definition iter.qh:190

References argv(), CMD_REQUEST_COMMAND, CMD_REQUEST_USAGE, FOREACH_ENTITY_CLASS_ORDERED, GetProgramCommandPrefix, LOG_HELP, LOG_HELPF, and LOG_INFOF.

◆ GENERIC_COMMAND() [5/5]

GENERIC_COMMAND ( version ,
"Print the current version" ,
false  )

Definition at line 223 of file debug.qh.

224{
225 switch (request)
226 {
228 {
229 LOG_INFO(PROGNAME, " version: ", WATERMARK);
230 return;
231 }
232 default:
234 {
235 LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " version");
236 return;
237 }
238 }
239}
#define PROGNAME
Definition progname.qh:4

References CMD_REQUEST_COMMAND, CMD_REQUEST_USAGE, GetProgramCommandPrefix, LOG_HELP, LOG_INFO, and PROGNAME.

◆ NET_HANDLE() [1/2]

NET_HANDLE ( debug_text_3d ,
bool is_new )

Definition at line 471 of file debug.qh.

471 {
472 vector pos = ReadVector();
473 string msg = ReadString();
474 float align = ReadFloat();
475 float duration = ReadFloat();
476 vector vel = ReadVector();
477 make_impure(NEW(DebugText3d, pos, msg, align, 1 / duration, vel));
478 return true;
479}
#define ReadString
#define ReadFloat()
Definition net.qh:366
#define ReadVector()
Definition net.qh:367
#define NEW(cname,...)
Definition oo.qh:117
#define make_impure(e)
Definition oo.qh:22

References debug_text_3d, make_impure, NET_HANDLE, NEW, ReadFloat, ReadString, ReadVector, and vector.

◆ NET_HANDLE() [2/2]

NET_HANDLE ( net_debug ,
bool isNew )

Definition at line 27 of file debug.qh.

28 {
29 Net_Accept(net_debug);
30 this.sv_entnum = ReadShort();
31 if (ReadByte()) make_pure(this);
32 this.origin = ReadVector();
33 setorigin(this, this.origin);
34 this.debug = true; // identify server entities by this
37 return true;
38 }
int sv_entnum
Definition main.qh:186
bool debug
Definition debug.qh:21
#define Net_Accept(classname)
Definition net.qh:201
int ReadByte()
string strzone(string s)
#define make_pure(e)
direct use is
Definition oo.qh:13

References classname, debug, make_pure, Net_Accept, origin, ReadByte(), ReadString, ReadVector, sourceLoc, strzone(), and sv_entnum.

◆ REGISTER_NET_TEMP()

REGISTER_NET_TEMP ( debug_text_3d )

References debug_text_3d.

◆ void()

void ( float bufhandle,
string pattern,
string antipattern )

Variable Documentation

◆ debug

bool debug

Definition at line 21 of file debug.qh.

Referenced by NET_HANDLE().

◆ sv_entnum

int sv_entnum

Definition at line 22 of file debug.qh.

◆ tag_entity

entity tag_entity

Definition at line 16 of file debug.qh.