X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fcommon%2Fdebug.qh;h=e63a7f04f63e7e86f69f04dd3befb13af5868a0a;hb=4e21f418ad9e6287efb942c1fa2861a51981110a;hp=c95bb2d73cf95e458a66485679e06b74f79357e5;hpb=bac31b218e747443d2e4c1f8d6b26b2bb71dddb8;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/debug.qh b/qcsrc/common/debug.qh index c95bb2d73..e63a7f04f 100644 --- a/qcsrc/common/debug.qh +++ b/qcsrc/common/debug.qh @@ -1,7 +1,9 @@ #pragma once #ifdef CSQC +#include #include +#include #endif @@ -69,7 +71,7 @@ REGISTER_NET_TEMP(net_debug) * 6: on (.solid != 0) */ bool autocvar_debugdraw; -#endif +#endif // GAMEQC #ifdef CSQC string autocvar_debugdraw_filter, autocvar_debugdraw_filterout; @@ -161,8 +163,7 @@ bool autocvar_debugdraw; }); }); } -#endif - +#endif // CSQC #ifdef SVQC COMMON_COMMAND(debugdraw_sv, "Dump all server entities") @@ -188,13 +189,13 @@ bool autocvar_debugdraw; default: case CMD_REQUEST_USAGE: { - LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " debugdraw_sv"); + LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " debugdraw_sv"); return; } } } -#endif -#endif +#endif // SVQC +#endif // ENABLE_DEBUGDRAW GENERIC_COMMAND(bufstr_get, "Examine a string buffer object", false) @@ -212,7 +213,7 @@ GENERIC_COMMAND(bufstr_get, "Examine a string buffer object", false) default: case CMD_REQUEST_USAGE: { - LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " bufstr_get bufhandle string_index"); + LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " bufstr_get "); return; } } @@ -225,13 +226,13 @@ GENERIC_COMMAND(version, "Print the current version", false) { case CMD_REQUEST_COMMAND: { - LOG_INFO(WATERMARK); + LOG_INFO(PROGNAME, " version: ", WATERMARK); return; } default: case CMD_REQUEST_USAGE: { - LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " version"); + LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " version"); return; } } @@ -241,6 +242,7 @@ GENERIC_COMMAND(version, "Print the current version", false) #ifdef CSQC void(float bufhandle, string pattern, string antipattern) buf_cvarlist = #517; #endif + GENERIC_COMMAND(cvar_localchanges, "Print locally changed cvars", false) { switch (request) @@ -266,7 +268,7 @@ GENERIC_COMMAND(cvar_localchanges, "Print locally changed cvars", false) default: case CMD_REQUEST_USAGE: { - LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " cvar_localchanges"); + LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " cvar_localchanges"); return; } } @@ -275,6 +277,7 @@ GENERIC_COMMAND(cvar_localchanges, "Print locally changed cvars", false) #if ENABLE_DEBUGTRACE REGISTER_STAT(TRACE_ENT, int) + #ifdef SVQC bool autocvar_debugtrace; @@ -310,7 +313,8 @@ MUTATOR_HOOKFUNCTION(trace, SV_StartFrame) stuffcmd(it, sprintf("prvm_edict server %d\n", i)); }); } -#endif +#endif // SVQC + #ifdef CSQC entity TRACE_ENT; void Trace_draw2d(entity this) @@ -328,11 +332,12 @@ STATIC_INIT(TRACE_ENT) e.draw2d = Trace_draw2d; IL_PUSH(g_drawables_2d, e); } -#endif +#endif // CSQC + #endif -GENERIC_COMMAND(find, "Search through entities for matching classname", false) +GENERIC_COMMAND(findent, "Search through entities for matching classname", false) { switch (request) { @@ -341,22 +346,20 @@ GENERIC_COMMAND(find, "Search through entities for matching classname", false) int entcnt = 0; FOREACH_ENTITY_CLASS_ORDERED(argv(1), true, { - LOG_INFOF("%i (%s)", it, it.classname); + LOG_HELPF("%i (%s)", it, it.classname); ++entcnt; }); if(entcnt) - LOG_INFOF("Found %d entities", entcnt); + LOG_HELPF("Found %d entities", entcnt); return; } default: - { - LOG_INFO("Incorrect parameters for ^2find^7"); - } + LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0)); case CMD_REQUEST_USAGE: { - LOG_INFO("Usage:^3 " GetProgramCommandPrefix() " find classname"); - LOG_INFO(" Where 'classname' is the classname to search for."); + LOG_HELP("Usage:^3 " GetProgramCommandPrefix() " find "); + LOG_HELP(" Where is the classname to search for."); return; } } @@ -369,16 +372,32 @@ GENERIC_COMMAND(findat, "Search through entities for matching origin", false) { case CMD_REQUEST_COMMAND: { - vector match = stov(argv(1)); - FOREACH_ENTITY_ORDERED(it.origin == match, LOG_INFOF("%i (%s)", it, it.classname)); + vector org = stov(argv(1)); + float dist = stof(argv(2)); + int entcnt = 0; + FOREACH_ENTITY_ORDERED(true, + { + if (dist > 0) + { + if (!vdist(it.origin - org, <, dist)) + continue; + } + else if (it.origin != org) + continue; + LOG_HELPF("%i (%s)", it, it.classname); + ++entcnt; + }); + if(entcnt) + LOG_HELPF("Found %d entities", entcnt); return; } default: - LOG_INFO("Incorrect parameters for ^2findat^7"); + LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0)); case CMD_REQUEST_USAGE: { - LOG_INFO("Usage:^3 " GetProgramCommandPrefix() " findat \"0 0 0\""); + LOG_HELP("Usage:^3 " GetProgramCommandPrefix() " findat []"); + LOG_HELP(" Where is a vector \"x y z\""); return; } } @@ -399,7 +418,7 @@ CLASS(DebugText3d, Object) ATTRIB(DebugText3d, message, string); // the text (i wanted to use the .text field but then this whole macro-based-inheritance thing shat itself) ATTRIB(DebugText3d, health, float); // text alignment (recycled field) ATTRIB(DebugText3d, hit_time, float); // when it was created - ATTRIB(DebugText3d, fade_rate, float); // how fast is should disappear + ATTRIB(DebugText3d, fade_rate, float); // how fast it should disappear ATTRIB(DebugText3d, velocity, vector); CONSTRUCTOR(DebugText3d, vector pos, string msg, float align, float fade_rate_, vector vel) {