#include "../mapvoting.qh"
#include "../miscfunctions.qh"
+#include "../mutators/events.qh"
+
#include "../../common/mapinfo.qh"
#include "../../common/command/generic.qh"
case "radar":
{
if(argv(2))
- hud_panel_radar_maximized = InterpretBoolean(argv(2));
+ HUD_Radar_Show_Maximized(InterpretBoolean(argv(2)),0);
else
- hud_panel_radar_maximized = !hud_panel_radar_maximized;
+ HUD_Radar_Show_Maximized(!hud_panel_radar_maximized,0);
+ return;
+ }
+
+ case "clickradar":
+ {
+ HUD_Radar_Show_Maximized(!hud_panel_radar_mouse,1);
return;
}
}
}
}
+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)
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 */
// argc: 1 - 2 - 3 - 4
// argv: 0 - 1 - 2 - 3
// cmd vote - master - login - password
-
- if(strtolower(argv(0)) == "help")
+ string s = strtolower(argv(0));
+ if (s == "help")
{
if(argc == 1)
{
return;
}
}
- else if(GenericCommand(command))
- {
- return; // handled by common/command/generic.qc
- }
- else if(LocalCommand_macro_command(argc)) // continue as usual and scan for normal commands
- {
- return; // handled by one of the above LocalCommand_* functions
- }
+ // continue as usual and scan for normal commands
+ if (GenericCommand(command)// handled by common/command/generic.qc
+ || LocalCommand_macro_command(argc) // handled by one of the above LocalCommand_* functions
+ || MUTATOR_CALLHOOK(CSQC_ConsoleCommand, s, argc, command) // handled by a mutator
+ ) return;
// nothing above caught the command, must be invalid
print(((command != "") ? strcat("Unknown client command \"", command, "\"") : "No command provided"), ". For a list of supported commands, try cl_cmd help.\n");
#ifndef CAMERATEST
}
#endif
-
- return;
}
-bool ConsoleCommand_macro_normal(int argc)
+bool ConsoleCommand_macro_normal(string s, int argc)
{
#define CONSOLE_COMMAND(name,execution) \
- { if(name == strtolower(argv(0))) { { execution } return true; } }
+ { if (name == s) { { execution } return true; } }
CONSOLE_COMMANDS_NORMAL();
#undef CONSOLE_COMMAND
return false;
}
-bool ConsoleCommand_macro_movement(int argc)
+bool ConsoleCommand_macro_movement(string s, int argc)
{
if(camera_active)
{
#define CONSOLE_COMMAND(name,execution) \
- { if(name == strtolower(argv(0))) { { execution } return true; } }
+ { if (name == s) { { execution } return true; } }
CONSOLE_COMMANDS_MOVEMENT();
#undef CONSOLE_COMMAND
bool CSQC_ConsoleCommand(string command)
{
int argc = tokenize_console(command);
-
- if(ConsoleCommand_macro_normal(argc))
- {
- return true;
- }
- else if(ConsoleCommand_macro_movement(argc))
- {
- return true;
- }
-
- // Return value should be 1 if CSQC handled the command, otherwise return 0 to have the engine handle it.
-
- return false;
+ string s = strtolower(argv(0));
+ // Return value should be true if CSQC handled the command, otherwise return false to have the engine handle it.
+ return (ConsoleCommand_macro_normal(s, argc)
+ || ConsoleCommand_macro_movement(s, argc)
+ );
}