X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Fcommand%2Fcl_cmd.qc;h=0748483c5f1ec62d9901a540483aaca67352671d;hp=e8f3600d48156351c1d536661b376218ee86c92f;hb=6dc9591eba337374f2b4348a6a6deaa1cb6887d0;hpb=845401fd312c66c059aaee1772ac5d79555ab4fc diff --git a/qcsrc/client/command/cl_cmd.qc b/qcsrc/client/command/cl_cmd.qc index e8f3600d4..0748483c5 100644 --- a/qcsrc/client/command/cl_cmd.qc +++ b/qcsrc/client/command/cl_cmd.qc @@ -3,6 +3,9 @@ // Last updated: December 28th, 2011 // ============================================== +#include "../../common/command/generic.qh" +#include "../../common/command/shared_defs.qh" + void DrawDebugModel() { if(time - floor(time) > 0.5) @@ -336,6 +339,31 @@ void LocalCommand_mv_download(int request, int argc) } } +void LocalCommand_find(int request, int argc) +{ + switch(request) + { + case CMD_REQUEST_COMMAND: + { + entity client; + + for(client = world; (client = find(client, classname, argv(1))); ) + print(etos(client), "\n"); + + return; + } + + default: + print("Incorrect parameters for ^2find^7\n"); + case CMD_REQUEST_USAGE: + { + print("\nUsage:^3 cl_cmd find classname\n"); + print(" Where 'classname' is the classname to search for.\n"); + return; + } + } +} + void LocalCommand_sendcvar(int request, int argc) { switch(request) @@ -407,6 +435,7 @@ void LocalCommand_(int request) CLIENT_COMMAND("handlevote", LocalCommand_handlevote(request, arguments), "System to handle selecting a vote or option") \ CLIENT_COMMAND("hud", LocalCommand_hud(request, arguments), "Commands regarding/controlling the HUD system") \ CLIENT_COMMAND("localprint", LocalCommand_localprint(request, arguments), "Create your own centerprint sent to yourself") \ + CLIENT_COMMAND("find", LocalCommand_find(request, arguments), "Search through entities for matching classname") \ CLIENT_COMMAND("mv_download", LocalCommand_mv_download(request, arguments), "Retrieve mapshot picture from the server") \ CLIENT_COMMAND("sendcvar", LocalCommand_sendcvar(request, arguments), "Send a cvar to the server (like weaponpriority)") \ /* nothing */ @@ -416,7 +445,7 @@ void LocalCommand_macro_help() #define CLIENT_COMMAND(name,function,description) \ { if(strtolower(description) != "") { print(" ^2", name, "^7: ", description, "\n"); } } - CLIENT_COMMANDS(0, 0) + CLIENT_COMMANDS(0, 0); #undef CLIENT_COMMAND return; @@ -427,7 +456,7 @@ bool LocalCommand_macro_command(int argc) #define CLIENT_COMMAND(name,function,description) \ { if(name == strtolower(argv(0))) { function; return true; } } - CLIENT_COMMANDS(CMD_REQUEST_COMMAND, argc) + CLIENT_COMMANDS(CMD_REQUEST_COMMAND, argc); #undef CLIENT_COMMAND return false; @@ -438,7 +467,7 @@ bool LocalCommand_macro_usage(int argc) #define CLIENT_COMMAND(name,function,description) \ { if(name == strtolower(argv(1))) { function; return true; } } - CLIENT_COMMANDS(CMD_REQUEST_USAGE, argc) + CLIENT_COMMANDS(CMD_REQUEST_USAGE, argc); #undef CLIENT_COMMAND return false; @@ -449,7 +478,7 @@ void LocalCommand_macro_write_aliases(int fh) #define CLIENT_COMMAND(name,function,description) \ { if(strtolower(description) != "") { CMD_Write_Alias("qc_cmd_cl", name, description); } } - CLIENT_COMMANDS(0, 0) + CLIENT_COMMANDS(0, 0); #undef CLIENT_COMMAND return; @@ -516,14 +545,14 @@ void GameCommand(string command) // These functions are here specifically to add special + - commands to the game, and are not really normal commands. // Please add client commands to the function above this, as this is only for special reasons. -#define CONSOLE_COMMANDS_NORMAL \ +#define CONSOLE_COMMANDS_NORMAL() \ CONSOLE_COMMAND("+showscores", { scoreboard_showscores = true; }) \ CONSOLE_COMMAND("-showscores", { scoreboard_showscores = false; }) \ CONSOLE_COMMAND("+showaccuracy", { scoreboard_showaccuracy = true; }) \ CONSOLE_COMMAND("-showaccuracy", { scoreboard_showaccuracy = false; }) \ /* nothing */ -#define CONSOLE_COMMANDS_MOVEMENT \ +#define CONSOLE_COMMANDS_MOVEMENT() \ CONSOLE_COMMAND("+forward", { ++camera_direction.x; }) \ CONSOLE_COMMAND("-forward", { --camera_direction.x; }) \ CONSOLE_COMMAND("+back", { --camera_direction.x; }) \ @@ -548,7 +577,7 @@ void ConsoleCommand_macro_init() #define CONSOLE_COMMAND(name,execution) \ { registercommand(name); } - CONSOLE_COMMANDS_NORMAL + CONSOLE_COMMANDS_NORMAL(); #undef CONSOLE_COMMAND // then init movement commands @@ -559,7 +588,7 @@ void ConsoleCommand_macro_init() #define CONSOLE_COMMAND(name,execution) \ { registercommand(name); } - CONSOLE_COMMANDS_MOVEMENT + CONSOLE_COMMANDS_MOVEMENT(); #undef CONSOLE_COMMAND #ifndef CAMERATEST } @@ -573,7 +602,7 @@ bool ConsoleCommand_macro_normal(int argc) #define CONSOLE_COMMAND(name,execution) \ { if(name == strtolower(argv(0))) { { execution } return true; } } - CONSOLE_COMMANDS_NORMAL + CONSOLE_COMMANDS_NORMAL(); #undef CONSOLE_COMMAND return false; @@ -586,7 +615,7 @@ bool ConsoleCommand_macro_movement(int argc) #define CONSOLE_COMMAND(name,execution) \ { if(name == strtolower(argv(0))) { { execution } return true; } } - CONSOLE_COMMANDS_MOVEMENT + CONSOLE_COMMANDS_MOVEMENT(); #undef CONSOLE_COMMAND }