Xonotic
debug.qh File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 GENERIC_COMMAND (bufstr_get, "Examine a string buffer object", false)
 
 GENERIC_COMMAND (version, "Print the current version", false)
 
 GENERIC_COMMAND (cvar_localchanges, "Print locally changed cvars", false)
 
 GENERIC_COMMAND (findent, "Search through entities for matching classname", false)
 
 GENERIC_COMMAND (findat, "Search through entities for matching origin", false)
 

Function Documentation

◆ GENERIC_COMMAND() [1/5]

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

Definition at line 201 of file debug.qh.

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

202 {
203  switch (request)
204  {
205  case CMD_REQUEST_COMMAND:
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:
214  case CMD_REQUEST_USAGE:
215  {
216  LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " bufstr_get <bufhandle> <string_index>");
217  return;
218  }
219  }
220 }
const int CMD_REQUEST_USAGE
Definition: command.qh:4
#define LOG_HELP(...)
Definition: log.qh:95
const int CMD_REQUEST_COMMAND
Definition: command.qh:3
#define LOG_INFO(...)
Definition: log.qh:70
+ Here is the call graph for this function:

◆ GENERIC_COMMAND() [2/5]

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

Definition at line 223 of file debug.qh.

References CMD_REQUEST_COMMAND, CMD_REQUEST_USAGE, LOG_HELP, LOG_INFO, and void.

224 {
225  switch (request)
226  {
227  case CMD_REQUEST_COMMAND:
228  {
229  LOG_INFO(PROGNAME, " version: ", WATERMARK);
230  return;
231  }
232  default:
233  case CMD_REQUEST_USAGE:
234  {
235  LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " version");
236  return;
237  }
238  }
239 }
const int CMD_REQUEST_USAGE
Definition: command.qh:4
#define LOG_HELP(...)
Definition: log.qh:95
const int CMD_REQUEST_COMMAND
Definition: command.qh:3
#define LOG_INFO(...)
Definition: log.qh:70

◆ GENERIC_COMMAND() [3/5]

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

Definition at line 246 of file debug.qh.

References buf_create, CMD_REQUEST_COMMAND, CMD_REQUEST_USAGE, cvar_defstring(), cvar_string(), DRAWFLAG_NORMAL, drawstring(), entity(), etof(), FOREACH_CLIENT, FOREACH_ENTITY, g_drawables_2d, IL_PUSH(), LOG_HELP, LOG_INFO, MOVE_NORMAL, MUTATOR_HOOKFUNCTION, new_pure, PHYS_INPUT_BUTTON_HOOK, REGISTER_MUTATOR, REGISTER_STAT(), setorigin(), SOLID_BBOX, STATIC_INIT, strcat(), stuffcmd, trace_ent, v, vector(), and vid_conheight.

247 {
248  switch (request)
249  {
250  case CMD_REQUEST_COMMAND:
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:
269  case CMD_REQUEST_USAGE:
270  {
271  LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " cvar_localchanges");
272  return;
273  }
274  }
275 }
const int CMD_REQUEST_USAGE
Definition: command.qh:4
#define LOG_HELP(...)
Definition: log.qh:95
#define buf_create
Definition: dpextensions.qh:63
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
const int CMD_REQUEST_COMMAND
Definition: command.qh:3
#define LOG_INFO(...)
Definition: log.qh:70
vector v
Definition: ent_cs.qc:116
+ Here is the call graph for this function:

◆ GENERIC_COMMAND() [4/5]

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

Definition at line 340 of file debug.qh.

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

341 {
342  switch (request)
343  {
344  case CMD_REQUEST_COMMAND:
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));
359  case CMD_REQUEST_USAGE:
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 LOG_HELPF(...)
Definition: log.qh:96
const int CMD_REQUEST_USAGE
Definition: command.qh:4
#define LOG_HELP(...)
Definition: log.qh:95
#define LOG_INFOF(...)
Definition: log.qh:71
const int CMD_REQUEST_COMMAND
Definition: command.qh:3
#define FOREACH_ENTITY_CLASS_ORDERED(class, cond, body)
Definition: iter.qh:190
+ Here is the call graph for this function:

◆ GENERIC_COMMAND() [5/5]

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

Definition at line 369 of file debug.qh.

References argv(), ATTRIB, CLASS(), CMD_REQUEST_COMMAND, CMD_REQUEST_USAGE, CONSTRUCT, CONSTRUCTOR, DESTRUCTOR, DRAWFLAG_NORMAL, ENDCLASS, ERASEABLE, eY, fade_rate, FOREACH_ENTITY_ORDERED, g_drawables_2d, GetResource(), health, IL_PUSH(), LOG_HELP, LOG_HELPF, LOG_INFOF, make_impure, message, min(), MSG_BROADCAST, NET_HANDLE, NEW, origin, project_3d_to_2d(), ReadString, REGISTER_NET_TEMP, RES_HEALTH, SetResource(), size, stof(), stov(), strfree, stringwidth, strzone(), time, tokenizebyseparator, vdist, vector(), velocity, and WriteString().

370 {
371  switch (request)
372  {
373  case CMD_REQUEST_COMMAND:
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));
397  case CMD_REQUEST_USAGE:
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 LOG_HELPF(...)
Definition: log.qh:96
const int CMD_REQUEST_USAGE
Definition: command.qh:4
#define LOG_HELP(...)
Definition: log.qh:95
#define FOREACH_ENTITY_ORDERED(cond, body)
Definition: iter.qh:138
#define LOG_INFOF(...)
Definition: log.qh:71
const int CMD_REQUEST_COMMAND
Definition: command.qh:3
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition: vector.qh:8
+ Here is the call graph for this function: