Cmd_AddCommand(CF_CLIENT, "packet", CL_Packet_f, "send a packet to the specified address:port containing a text string");
Cmd_AddCommand(CF_CLIENT, "fullinfo", CL_FullInfo_f, "allows client to modify their userinfo");
Cmd_AddCommand(CF_CLIENT, "setinfo", CL_SetInfo_f, "modifies your userinfo");
- Cmd_AddCommand(CF_CLIENT, "sendcvar", CL_SendCvar_f, "sends the value of a cvar to the server as a sentcvar command, for use by QuakeC");
Cmd_AddCommand(CF_CLIENT, "fixtrans", Image_FixTransparentPixels_f, "change alpha-zero pixels in an image file to sensible values, and write out a new TGA (warning: SLOW)");
+ host.hook.CL_SendCvar = CL_SendCvar_f;
// commands that are only sent by server to client for execution
Cmd_AddCommand(CF_CLIENT_FROM_SERVER, "pingplreport", CL_PingPLReport_f, "command sent by server containing client ping and packet loss values for scoreboard, triggered by pings command from client (not used by QW servers)");
Cvar_SetValueQuick(var, 0);
}
+// TODO: Find a better home for this.
+static void SendCvar_f(cmd_state_t *cmd)
+{
+ if(cmd->source == src_local && host.hook.SV_SendCvar)
+ {
+ host.hook.SV_SendCvar(cmd);
+ return;
+ }
+ if(cmd->source == src_client && host.hook.CL_SendCvar)
+ {
+ host.hook.CL_SendCvar(cmd);
+ return;
+ }
+}
+
/*
=======================
Host_InitLocal
Cmd_AddCommand(CF_SHARED, "version", Host_Version_f, "print engine version");
Cmd_AddCommand(CF_SHARED, "saveconfig", Host_SaveConfig_f, "save settings to config.cfg (or a specified filename) immediately (also automatic when quitting)");
Cmd_AddCommand(CF_SHARED, "loadconfig", Host_LoadConfig_f, "reset everything and reload configs");
+ Cmd_AddCommand(CF_SHARED, "sendcvar", SendCvar_f, "sends the value of a cvar to the server as a sentcvar command, for use by QuakeC");
Cvar_RegisterVariable (&cl_maxphysicsframesperserverframe);
Cvar_RegisterVariable (&host_framerate);
Cvar_RegisterCallback (&host_framerate, Host_Framerate_c);
#include "qdefs.h"
#include "cmd.h"
+struct cmd_state_s;
+
typedef enum host_state_e
{
host_shutdown,
void (*ToggleMenu)(void);
qbool (*CL_Intermission)(void); // Quake compatibility
qbool (*SV_CanSave)(void); // Quake compatibility
+ void (*CL_SendCvar)(struct cmd_state_s *);
+ void (*SV_SendCvar)(struct cmd_state_s *);
} hook;
} host_t;
Cmd_AddCommand(CF_SHARED, "viewnext", SV_Viewnext_f, "change to next animation frame of viewthing entity in current level");
Cmd_AddCommand(CF_SHARED, "viewprev", SV_Viewprev_f, "change to previous animation frame of viewthing entity in current level");
Cmd_AddCommand(CF_SHARED, "maxplayers", SV_MaxPlayers_f, "sets limit on how many players (or bots) may be connected to the server at once");
- Cmd_AddCommand(CF_SERVER, "sendcvar", SV_SendCvar_f, "sends the value of a cvar to the server as a sentcvar command, for use by QuakeC");
+ host.hook.SV_SendCvar = SV_SendCvar_f;
// commands that do not have automatic forwarding from cmd_client, these are internal details of the network protocol and not of interest to users (if they know what they are doing they can still use a generic "cmd prespawn" or similar)
Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "prespawn", SV_PreSpawn_f, "internal use - signon 1 (client acknowledges that server information has been received)");