2001-02-19 21:15:25 +00:00
|
|
|
/*
|
|
|
|
host_cmd.c
|
|
|
|
|
|
|
|
@description@
|
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2005-08-04 15:27:09 +00:00
|
|
|
static __attribute__ ((used)) const char rcsid[] =
|
2003-01-15 15:31:36 +00:00
|
|
|
"$Id$";
|
|
|
|
|
2004-01-20 05:57:39 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
2002-07-31 05:19:03 +00:00
|
|
|
#include "QF/cbuf.h"
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/cmd.h"
|
|
|
|
#include "QF/console.h"
|
2004-11-12 02:39:00 +00:00
|
|
|
#include "QF/cvar.h"
|
|
|
|
#include "QF/dstring.h"
|
|
|
|
#include "QF/idparse.h"
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/keys.h"
|
2004-11-12 02:39:00 +00:00
|
|
|
#include "QF/model.h"
|
|
|
|
#include "QF/msg.h"
|
2006-12-09 00:02:57 +00:00
|
|
|
#include "QF/qfplist.h"
|
2004-11-12 02:39:00 +00:00
|
|
|
#include "QF/screen.h"
|
|
|
|
#include "QF/script.h"
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/sys.h"
|
2004-11-12 02:39:00 +00:00
|
|
|
#include "QF/va.h"
|
2001-05-31 03:41:35 +00:00
|
|
|
|
|
|
|
#include "client.h"
|
2002-07-31 05:19:03 +00:00
|
|
|
#include "compat.h"
|
2001-05-31 03:41:35 +00:00
|
|
|
#include "host.h"
|
|
|
|
#include "server.h"
|
2001-03-03 08:31:58 +00:00
|
|
|
#include "sv_progs.h"
|
2001-05-31 03:41:35 +00:00
|
|
|
#include "world.h"
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
int current_skill;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
void
|
|
|
|
Host_Quit_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-03-04 07:43:27 +00:00
|
|
|
// if (key_dest != key_console && cls.state != ca_dedicated) {
|
|
|
|
// M_Menu_Quit_f ();
|
|
|
|
// return;
|
|
|
|
// }
|
2002-01-20 00:04:50 +00:00
|
|
|
if (!con_module)
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("I hope you wanted to quit\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Disconnect ();
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_ShutdownServer (false);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
Sys_Quit ();
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Status_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
client_t *client;
|
|
|
|
int seconds;
|
|
|
|
int minutes;
|
|
|
|
int hours = 0;
|
|
|
|
int j;
|
2001-07-15 07:04:17 +00:00
|
|
|
void (*print) (const char *fmt, ...);
|
2001-02-26 06:48:02 +00:00
|
|
|
|
|
|
|
if (cmd_source == src_command) {
|
|
|
|
if (!sv.active) {
|
2002-07-31 05:19:03 +00:00
|
|
|
CL_Cmd_ForwardToServer ();
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-11-06 10:17:14 +00:00
|
|
|
print = Sys_Printf;
|
2001-02-26 06:48:02 +00:00
|
|
|
} else
|
2001-02-19 21:15:25 +00:00
|
|
|
print = SV_ClientPrintf;
|
|
|
|
|
|
|
|
print ("host: %s\n", Cvar_VariableString ("hostname"));
|
2010-08-19 06:01:43 +00:00
|
|
|
print ("version: %4.2f\n", PACKAGE_VERSION);
|
2001-02-19 21:15:25 +00:00
|
|
|
if (tcpipAvailable)
|
|
|
|
print ("tcp/ip: %s\n", my_tcpip_address);
|
|
|
|
if (ipxAvailable)
|
|
|
|
print ("ipx: %s\n", my_ipx_address);
|
|
|
|
print ("map: %s\n", sv.name);
|
2001-02-26 06:48:02 +00:00
|
|
|
print ("players: %i active (%i max)\n\n", net_activeconnections,
|
|
|
|
svs.maxclients);
|
|
|
|
for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++) {
|
2001-02-19 21:15:25 +00:00
|
|
|
if (!client->active)
|
|
|
|
continue;
|
2001-02-26 06:48:02 +00:00
|
|
|
seconds = (int) (net_time - client->netconnection->connecttime);
|
2001-02-19 21:15:25 +00:00
|
|
|
minutes = seconds / 60;
|
2001-02-26 06:48:02 +00:00
|
|
|
if (minutes) {
|
2001-02-19 21:15:25 +00:00
|
|
|
seconds -= (minutes * 60);
|
|
|
|
hours = minutes / 60;
|
|
|
|
if (hours)
|
|
|
|
minutes -= (hours * 60);
|
2001-02-26 06:48:02 +00:00
|
|
|
} else
|
2001-02-19 21:15:25 +00:00
|
|
|
hours = 0;
|
2001-02-26 06:48:02 +00:00
|
|
|
print ("#%-2u %-16.16s %3i %2i:%02i:%02i\n", j + 1, client->name,
|
2001-08-08 20:28:53 +00:00
|
|
|
(int) SVfloat (client->edict, frags), hours, minutes, seconds);
|
2001-02-19 21:15:25 +00:00
|
|
|
print (" %s\n", client->netconnection->address);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2001-12-12 21:56:09 +00:00
|
|
|
Host_God_f
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
Sets client to godmode
|
2001-02-19 21:15:25 +00:00
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_God_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
if (cmd_source == src_command) {
|
2002-07-31 05:19:03 +00:00
|
|
|
CL_Cmd_ForwardToServer ();
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-03-03 08:31:58 +00:00
|
|
|
if (*sv_globals.deathmatch && !host_client->privileged)
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
|
2001-08-08 20:28:53 +00:00
|
|
|
SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) ^ FL_GODMODE;
|
|
|
|
if (!((int) SVfloat (sv_player, flags) & FL_GODMODE))
|
2001-02-19 21:15:25 +00:00
|
|
|
SV_ClientPrintf ("godmode OFF\n");
|
|
|
|
else
|
|
|
|
SV_ClientPrintf ("godmode ON\n");
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Notarget_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
if (cmd_source == src_command) {
|
2002-07-31 05:19:03 +00:00
|
|
|
CL_Cmd_ForwardToServer ();
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-03-03 08:31:58 +00:00
|
|
|
if (*sv_globals.deathmatch && !host_client->privileged)
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) ^
|
|
|
|
FL_NOTARGET;
|
2001-08-08 20:28:53 +00:00
|
|
|
if (!((int) SVfloat (sv_player, flags) & FL_NOTARGET))
|
2001-02-19 21:15:25 +00:00
|
|
|
SV_ClientPrintf ("notarget OFF\n");
|
|
|
|
else
|
|
|
|
SV_ClientPrintf ("notarget ON\n");
|
|
|
|
}
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
qboolean noclip_anglehack;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Noclip_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
if (cmd_source == src_command) {
|
2002-07-31 05:19:03 +00:00
|
|
|
CL_Cmd_ForwardToServer ();
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-03-03 08:31:58 +00:00
|
|
|
if (*sv_globals.deathmatch && !host_client->privileged)
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
|
2001-08-08 20:28:53 +00:00
|
|
|
if (SVfloat (sv_player, movetype) != MOVETYPE_NOCLIP) {
|
2001-02-19 21:15:25 +00:00
|
|
|
noclip_anglehack = true;
|
2001-08-08 20:28:53 +00:00
|
|
|
SVfloat (sv_player, movetype) = MOVETYPE_NOCLIP;
|
2001-02-19 21:15:25 +00:00
|
|
|
SV_ClientPrintf ("noclip ON\n");
|
2001-02-26 06:48:02 +00:00
|
|
|
} else {
|
2001-02-19 21:15:25 +00:00
|
|
|
noclip_anglehack = false;
|
2001-08-08 20:28:53 +00:00
|
|
|
SVfloat (sv_player, movetype) = MOVETYPE_WALK;
|
2001-02-19 21:15:25 +00:00
|
|
|
SV_ClientPrintf ("noclip OFF\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2001-12-12 21:56:09 +00:00
|
|
|
Host_Fly_f
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
Sets client to flymode
|
2001-02-19 21:15:25 +00:00
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Fly_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
if (cmd_source == src_command) {
|
2002-07-31 05:19:03 +00:00
|
|
|
CL_Cmd_ForwardToServer ();
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-03-03 08:31:58 +00:00
|
|
|
if (*sv_globals.deathmatch && !host_client->privileged)
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
|
2001-08-08 20:28:53 +00:00
|
|
|
if (SVfloat (sv_player, movetype) != MOVETYPE_FLY) {
|
|
|
|
SVfloat (sv_player, movetype) = MOVETYPE_FLY;
|
2001-02-19 21:15:25 +00:00
|
|
|
SV_ClientPrintf ("flymode ON\n");
|
2001-02-26 06:48:02 +00:00
|
|
|
} else {
|
2001-08-08 20:28:53 +00:00
|
|
|
SVfloat (sv_player, movetype) = MOVETYPE_WALK;
|
2001-02-19 21:15:25 +00:00
|
|
|
SV_ClientPrintf ("flymode OFF\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Ping_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
int i, j;
|
|
|
|
float total;
|
|
|
|
client_t *client;
|
|
|
|
|
|
|
|
if (cmd_source == src_command) {
|
2002-07-31 05:19:03 +00:00
|
|
|
CL_Cmd_ForwardToServer ();
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SV_ClientPrintf ("Client ping times:\n");
|
2001-02-26 06:48:02 +00:00
|
|
|
for (i = 0, client = svs.clients; i < svs.maxclients; i++, client++) {
|
2001-02-19 21:15:25 +00:00
|
|
|
if (!client->active)
|
|
|
|
continue;
|
|
|
|
total = 0;
|
2001-02-26 06:48:02 +00:00
|
|
|
for (j = 0; j < NUM_PING_TIMES; j++)
|
|
|
|
total += client->ping_times[j];
|
2001-02-19 21:15:25 +00:00
|
|
|
total /= NUM_PING_TIMES;
|
2001-02-26 06:48:02 +00:00
|
|
|
SV_ClientPrintf ("%4i %s\n", (int) (total * 1000), client->name);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
// SERVER TRANSITIONS =========================================================
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-11-07 16:43:05 +00:00
|
|
|
static const char *
|
|
|
|
nice_time (float time)
|
|
|
|
{
|
|
|
|
int t = time + 0.5;
|
|
|
|
|
|
|
|
if (t < 60) {
|
|
|
|
return va ("%ds", t);
|
|
|
|
} else if (t < 3600) {
|
|
|
|
return va ("%dm%02ds", t / 60, t % 60);
|
|
|
|
} else if (t < 86400) {
|
|
|
|
return va ("%dh%02dm%02ds", t / 3600, (t / 60) % 60, t % 60);
|
|
|
|
} else {
|
|
|
|
return va ("%dd%02dh%02dm%02ds",
|
|
|
|
t / 86400, (t / 3600) % 24, (t / 60) % 60, t % 60);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
/*
|
2001-12-12 21:56:09 +00:00
|
|
|
Host_Map_f
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
handle a
|
|
|
|
map <servername>
|
|
|
|
command from the console. Active clients are kicked off.
|
2001-02-19 21:15:25 +00:00
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Map_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
int i;
|
|
|
|
char name[MAX_QPATH];
|
2002-10-11 03:15:41 +00:00
|
|
|
const char *expanded;
|
|
|
|
QFile *f;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
if (cmd_source != src_command)
|
|
|
|
return;
|
|
|
|
|
2002-10-11 03:15:41 +00:00
|
|
|
if (Cmd_Argc () > 2) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("map <levelname> : continue game on a new level\n");
|
2002-10-11 03:15:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-07-06 17:38:17 +00:00
|
|
|
if (Cmd_Argc () == 1) {
|
2010-08-13 05:17:18 +00:00
|
|
|
Sys_Printf ("map is %s \"%s\" (%s)\n", sv.name,
|
|
|
|
PR_GetString (&sv_pr_state, SVstring (sv.edicts, message)),
|
|
|
|
nice_time (sv.time));
|
2001-07-06 17:38:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-10-11 03:15:41 +00:00
|
|
|
// check to make sure the level exists
|
|
|
|
expanded = va ("maps/%s.bsp", Cmd_Argv (1));
|
2003-02-14 19:46:07 +00:00
|
|
|
QFS_FOpenFile (expanded, &f);
|
2002-10-11 03:15:41 +00:00
|
|
|
if (!f) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Can't find %s\n", expanded);
|
2002-10-11 03:15:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
Qclose (f);
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
cls.demonum = -1; // stop demo loop in case this fails
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
CL_Disconnect ();
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_ShutdownServer (false);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-05-11 01:01:27 +00:00
|
|
|
// SCR_BeginLoadingPlaque ();
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
cls.mapstring[0] = 0;
|
2001-02-26 06:48:02 +00:00
|
|
|
for (i = 0; i < Cmd_Argc (); i++) {
|
|
|
|
strcat (cls.mapstring, Cmd_Argv (i));
|
2001-02-19 21:15:25 +00:00
|
|
|
strcat (cls.mapstring, " ");
|
|
|
|
}
|
|
|
|
strcat (cls.mapstring, "\n");
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
svs.serverflags = 0; // haven't completed an episode yet
|
|
|
|
strcpy (name, Cmd_Argv (1));
|
2001-02-19 21:15:25 +00:00
|
|
|
SV_SpawnServer (name);
|
|
|
|
if (!sv.active)
|
|
|
|
return;
|
2001-02-26 06:48:02 +00:00
|
|
|
|
|
|
|
if (cls.state != ca_dedicated) {
|
2001-02-19 21:15:25 +00:00
|
|
|
strcpy (cls.spawnparms, "");
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
for (i = 2; i < Cmd_Argc (); i++) {
|
|
|
|
strcat (cls.spawnparms, Cmd_Argv (i));
|
2001-02-19 21:15:25 +00:00
|
|
|
strcat (cls.spawnparms, " ");
|
|
|
|
}
|
2001-02-26 06:48:02 +00:00
|
|
|
|
2001-02-22 04:46:59 +00:00
|
|
|
Cmd_ExecuteString ("connect local", src_command);
|
2001-02-26 06:48:02 +00:00
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2001-12-12 21:56:09 +00:00
|
|
|
Host_Changelevel_f
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
Goes to a new map, taking all clients along
|
2001-02-19 21:15:25 +00:00
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Changelevel_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
char level[MAX_QPATH];
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (Cmd_Argc () != 2) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("changelevel <levelname> : continue game on a new "
|
2001-12-12 21:56:09 +00:00
|
|
|
"level\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-02-26 06:48:02 +00:00
|
|
|
if (!sv.active || cls.demoplayback) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Only the server may changelevel\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
SV_SaveSpawnparms ();
|
2001-02-26 06:48:02 +00:00
|
|
|
strcpy (level, Cmd_Argv (1));
|
2001-02-19 21:15:25 +00:00
|
|
|
SV_SpawnServer (level);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2001-12-12 21:56:09 +00:00
|
|
|
Host_Restart_f
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
Restarts the current server for a dead player
|
2001-02-19 21:15:25 +00:00
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Restart_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
char mapname[MAX_QPATH];
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
if (cls.demoplayback || !sv.active)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (cmd_source != src_command)
|
|
|
|
return;
|
2001-02-26 06:48:02 +00:00
|
|
|
strcpy (mapname, sv.name); // must copy out, because it gets
|
2001-12-12 21:56:09 +00:00
|
|
|
// cleared in sv_spawnserver
|
2001-02-19 21:15:25 +00:00
|
|
|
SV_SpawnServer (mapname);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2001-12-12 21:56:09 +00:00
|
|
|
Host_Reconnect_f
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
This command causes the client to wait for the signon messages again.
|
|
|
|
This is sent just before a server changes levels
|
2001-02-19 21:15:25 +00:00
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Reconnect_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-05-11 01:01:27 +00:00
|
|
|
// SCR_BeginLoadingPlaque ();
|
2001-02-26 06:48:02 +00:00
|
|
|
cls.signon = 0; // need new connection messages
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2001-12-12 21:56:09 +00:00
|
|
|
Host_Connect_f
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
User command to connect to server
|
2001-02-19 21:15:25 +00:00
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Connect_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
char name[MAX_QPATH];
|
|
|
|
|
|
|
|
cls.demonum = -1; // stop demo loop in case this fails
|
|
|
|
if (cls.demoplayback) {
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_StopPlayback ();
|
|
|
|
CL_Disconnect ();
|
|
|
|
}
|
2001-02-26 06:48:02 +00:00
|
|
|
strcpy (name, Cmd_Argv (1));
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_EstablishConnection (name);
|
|
|
|
Host_Reconnect_f ();
|
|
|
|
}
|
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
// LOAD / SAVE GAME ===========================================================
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
#define SAVEGAME_VERSION 5
|
|
|
|
|
|
|
|
|
2006-12-09 02:35:44 +00:00
|
|
|
static plitem_t *
|
|
|
|
spawn_parms_array (void)
|
|
|
|
{
|
|
|
|
plitem_t *parms = PL_NewArray ();
|
|
|
|
int i;
|
|
|
|
const char *parm;
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_SPAWN_PARMS; i++) {
|
|
|
|
parm = va ("%f", svs.clients->spawn_parms[i]);
|
|
|
|
PL_A_AddObject (parms, PL_NewString (parm));
|
|
|
|
}
|
|
|
|
return parms;
|
|
|
|
}
|
|
|
|
|
|
|
|
static plitem_t *
|
|
|
|
lightstyles_array (void)
|
|
|
|
{
|
|
|
|
plitem_t *styles = PL_NewArray ();
|
|
|
|
const char *st;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_LIGHTSTYLES; i++) {
|
|
|
|
st = "m";
|
|
|
|
if (sv.lightstyles[i])
|
|
|
|
st = sv.lightstyles[i];
|
|
|
|
PL_A_AddObject (styles, PL_NewString (st));
|
|
|
|
}
|
|
|
|
return styles;
|
|
|
|
}
|
|
|
|
|
|
|
|
static plitem_t *
|
|
|
|
entities_array (void)
|
|
|
|
{
|
|
|
|
plitem_t *entities = PL_NewArray ();
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < sv.num_edicts; i++) {
|
|
|
|
PL_A_AddObject (entities,
|
|
|
|
ED_EntityDict (&sv_pr_state,
|
|
|
|
EDICT_NUM (&sv_pr_state, i)));
|
|
|
|
}
|
|
|
|
return entities;
|
|
|
|
}
|
|
|
|
|
|
|
|
static plitem_t *
|
|
|
|
game_dict (void)
|
|
|
|
{
|
|
|
|
plitem_t *game = PL_NewDictionary ();
|
|
|
|
|
2006-12-09 06:00:36 +00:00
|
|
|
PL_D_AddObject (game, "comment",
|
2006-12-09 02:35:44 +00:00
|
|
|
PL_NewString (va ("%-21s kills:%3i/%3i", cl.levelname,
|
|
|
|
cl.stats[STAT_MONSTERS],
|
|
|
|
cl.stats[STAT_TOTALMONSTERS])));
|
2006-12-09 06:00:36 +00:00
|
|
|
PL_D_AddObject (game, "spawn_parms", spawn_parms_array ());
|
|
|
|
PL_D_AddObject (game, "current_skill",
|
2006-12-09 02:35:44 +00:00
|
|
|
PL_NewString (va ("%d", current_skill)));
|
2006-12-09 06:00:36 +00:00
|
|
|
PL_D_AddObject (game, "name", PL_NewString (sv.name));
|
|
|
|
PL_D_AddObject (game, "time", PL_NewString (va ("%f", sv.time)));
|
|
|
|
PL_D_AddObject (game, "lightstyles", lightstyles_array ());
|
|
|
|
PL_D_AddObject (game, "globals", ED_GlobalsDict (&sv_pr_state));
|
|
|
|
PL_D_AddObject (game, "entities", entities_array ());
|
2006-12-09 02:35:44 +00:00
|
|
|
return game;
|
|
|
|
}
|
|
|
|
|
|
|
|
static plitem_t *
|
|
|
|
convert_to_game_dict (script_t *script)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2006-12-09 02:35:44 +00:00
|
|
|
plitem_t *game = PL_NewDictionary ();
|
|
|
|
plitem_t *item;
|
|
|
|
plitem_t *list;
|
|
|
|
int skill;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
// savegame comment (ignored)
|
|
|
|
Script_GetToken (script, 1);
|
2006-12-09 06:00:36 +00:00
|
|
|
PL_D_AddObject (game, "comment", PL_NewString (script->token->str));
|
2006-12-09 02:35:44 +00:00
|
|
|
|
|
|
|
// spawn_parms
|
|
|
|
item = PL_NewArray ();
|
|
|
|
for (i = 0; i < NUM_SPAWN_PARMS; i++) {
|
|
|
|
Script_GetToken (script, 1);
|
|
|
|
PL_A_AddObject (item, PL_NewString (script->token->str));
|
|
|
|
}
|
2006-12-09 06:00:36 +00:00
|
|
|
PL_D_AddObject (game, "spawn_parms", item);
|
2006-12-09 02:35:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
// this silliness is so we can load 1.06 save files, which have float skill
|
|
|
|
// values
|
|
|
|
Script_GetToken (script, 1);
|
|
|
|
skill = (int) (atof (script->token->str) + 0.1);
|
2006-12-09 06:00:36 +00:00
|
|
|
PL_D_AddObject (game, "current_skill", PL_NewString (va ("%d", skill)));
|
2006-12-09 02:35:44 +00:00
|
|
|
|
|
|
|
Script_GetToken (script, 1);
|
2006-12-09 06:00:36 +00:00
|
|
|
PL_D_AddObject (game, "name", PL_NewString (script->token->str));
|
2006-12-09 02:35:44 +00:00
|
|
|
|
|
|
|
Script_GetToken (script, 1);
|
2006-12-09 06:00:36 +00:00
|
|
|
PL_D_AddObject (game, "time", PL_NewString (script->token->str));
|
2006-12-09 02:35:44 +00:00
|
|
|
|
|
|
|
// load the light styles
|
|
|
|
item = PL_NewArray ();
|
|
|
|
for (i = 0; i < MAX_LIGHTSTYLES; i++) {
|
|
|
|
Script_GetToken (script, 1);
|
|
|
|
PL_A_AddObject (item, PL_NewString (script->token->str));
|
|
|
|
//char *s;
|
|
|
|
|
|
|
|
//s = Hunk_Alloc (strlen (script->token->str) + 1);
|
|
|
|
//strcpy (s, script->token->str);
|
|
|
|
//sv.lightstyles[i] = s;
|
|
|
|
}
|
2006-12-09 06:00:36 +00:00
|
|
|
PL_D_AddObject (game, "lightstyles", item);
|
2006-12-09 02:35:44 +00:00
|
|
|
|
|
|
|
// load the edicts out of the savegame file
|
|
|
|
list = ED_ConvertToPlist (&sv_pr_state, script);
|
|
|
|
item = PL_RemoveObjectAtIndex (list, 0);
|
2006-12-09 06:00:36 +00:00
|
|
|
PL_D_AddObject (game, "globals", item);
|
|
|
|
PL_D_AddObject (game, "entities", list);
|
2006-12-09 02:35:44 +00:00
|
|
|
|
|
|
|
return game;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Savegame_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
char name[256];
|
2007-05-13 03:34:49 +00:00
|
|
|
char *save_text;
|
2002-08-27 07:16:28 +00:00
|
|
|
QFile *f;
|
2001-02-26 06:48:02 +00:00
|
|
|
int i;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
if (cmd_source != src_command)
|
|
|
|
return;
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (!sv.active) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Not playing a local game.\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (cl.intermission) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Can't save in intermission.\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (svs.maxclients != 1) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Can't save multiplayer games.\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (Cmd_Argc () != 2) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("save <savename> : save a game\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (strstr (Cmd_Argv (1), "..")) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Relative pathnames are not allowed.\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-02-26 06:48:02 +00:00
|
|
|
|
|
|
|
for (i = 0; i < svs.maxclients; i++) {
|
2001-12-12 21:56:09 +00:00
|
|
|
if (svs.clients[i].active && (SVfloat (svs.clients[i].edict, health)
|
|
|
|
<= 0)) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Can't savegame with a dead player\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-23 17:17:01 +00:00
|
|
|
snprintf (name, sizeof (name), "%s/%s",
|
|
|
|
qfs_gamedir->dir.def, Cmd_Argv (1));
|
2003-02-14 19:46:07 +00:00
|
|
|
QFS_DefaultExtension (name, ".sav");
|
2001-02-26 06:48:02 +00:00
|
|
|
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Saving game to %s...\n", name);
|
2003-02-14 22:36:10 +00:00
|
|
|
f = QFS_WOpen (name, 0);
|
2001-02-26 06:48:02 +00:00
|
|
|
if (!f) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("ERROR: couldn't open.\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-02-26 06:48:02 +00:00
|
|
|
|
2007-05-13 03:34:49 +00:00
|
|
|
save_text = PL_WritePropertyList (game_dict ());
|
2010-08-19 06:01:43 +00:00
|
|
|
Qprintf (f, "%s\n%s", PACKAGE_NAME, save_text);
|
2007-05-13 03:34:49 +00:00
|
|
|
free (save_text);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
Qclose (f);
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("done.\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Loadgame_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2004-11-12 02:39:00 +00:00
|
|
|
dstring_t *name = 0;
|
2002-08-27 07:16:28 +00:00
|
|
|
QFile *f;
|
2004-11-12 02:39:00 +00:00
|
|
|
char *mapname = 0;
|
|
|
|
script_t *script = 0;
|
2007-03-25 03:50:18 +00:00
|
|
|
plitem_t *game = 0;
|
2006-12-09 00:02:57 +00:00
|
|
|
plitem_t *list;
|
2006-12-09 02:35:44 +00:00
|
|
|
plitem_t *item;
|
2007-03-25 03:50:18 +00:00
|
|
|
char *script_data = 0;
|
2006-12-09 02:35:44 +00:00
|
|
|
int i;
|
2001-02-26 06:48:02 +00:00
|
|
|
int entnum;
|
2006-12-09 00:02:57 +00:00
|
|
|
int count;
|
2001-02-26 06:48:02 +00:00
|
|
|
int version;
|
|
|
|
float spawn_parms[NUM_SPAWN_PARMS];
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
if (cmd_source != src_command)
|
2004-11-12 02:39:00 +00:00
|
|
|
goto end;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (Cmd_Argc () != 2) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("load <savename> : load a game\n");
|
2004-11-12 02:39:00 +00:00
|
|
|
goto end;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
cls.demonum = -1; // stop demo loop in case this fails
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2004-11-12 02:39:00 +00:00
|
|
|
name = dstring_newstr ();
|
|
|
|
dsprintf (name, "%s/%s", qfs_gamedir->dir.def, Cmd_Argv (1));
|
|
|
|
name->size += 4;
|
|
|
|
dstring_adjust (name);
|
|
|
|
|
|
|
|
QFS_DefaultExtension (name->str, ".sav");
|
2001-02-26 06:48:02 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
// we can't call SCR_BeginLoadingPlaque, because too much stack space has
|
|
|
|
// been used. The menu calls it before stuffing loadgame command
|
2001-02-26 06:48:02 +00:00
|
|
|
// SCR_BeginLoadingPlaque ();
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Loading game from %s...\n", name->str);
|
2004-11-12 02:39:00 +00:00
|
|
|
f = QFS_Open (name->str, "rz");
|
2001-02-26 06:48:02 +00:00
|
|
|
if (!f) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("ERROR: couldn't open.\n");
|
2004-11-12 02:39:00 +00:00
|
|
|
goto end;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2007-03-25 03:50:18 +00:00
|
|
|
script_data = malloc (Qfilesize (f) + 1);
|
|
|
|
i = Qread (f, script_data, Qfilesize (f));
|
|
|
|
script_data[i] = 0;
|
2004-11-12 02:39:00 +00:00
|
|
|
Qclose (f);
|
|
|
|
|
|
|
|
script = Script_New ();
|
2007-03-25 03:50:18 +00:00
|
|
|
Script_Start (script, name->str, script_data);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2004-11-12 02:39:00 +00:00
|
|
|
Script_GetToken (script, 1);
|
2010-08-19 06:01:43 +00:00
|
|
|
if (strequal (script->token->str, PACKAGE_NAME)) {
|
2006-12-09 02:35:44 +00:00
|
|
|
if (!Script_TokenAvailable (script, 1)) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Unexpected EOF reading %s\n", name->str);
|
2006-12-09 02:35:44 +00:00
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
game = PL_GetPropertyList (script->p);
|
|
|
|
} else {
|
|
|
|
sscanf (script->token->str, "%i", &version);
|
|
|
|
if (version != SAVEGAME_VERSION) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Savegame is version %i, not %i\n", version,
|
2006-12-09 02:35:44 +00:00
|
|
|
SAVEGAME_VERSION);
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
game = convert_to_game_dict (script);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2004-11-12 02:39:00 +00:00
|
|
|
|
2006-12-09 02:35:44 +00:00
|
|
|
item = PL_ObjectForKey (game, "spawn_parms");
|
2001-02-26 06:48:02 +00:00
|
|
|
for (i = 0; i < NUM_SPAWN_PARMS; i++) {
|
2006-12-09 02:35:44 +00:00
|
|
|
if (i >= PL_A_NumObjects (item))
|
|
|
|
break;
|
|
|
|
spawn_parms[i] = atof (PL_String (PL_ObjectAtIndex (item, i)));
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2006-12-09 02:35:44 +00:00
|
|
|
current_skill = atoi (PL_String (PL_ObjectForKey (game, "current_skill")));
|
2007-03-25 05:47:53 +00:00
|
|
|
Cvar_SetValue (skill, current_skill);
|
2006-12-09 02:35:44 +00:00
|
|
|
mapname = strdup (PL_String (PL_ObjectForKey (game, "name")));
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
CL_Disconnect_f ();
|
2001-02-26 06:48:02 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
SV_SpawnServer (mapname);
|
2001-02-26 06:48:02 +00:00
|
|
|
if (!sv.active) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Couldn't load map %s\n", mapname);
|
2004-11-12 02:39:00 +00:00
|
|
|
goto end;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2001-02-26 06:48:02 +00:00
|
|
|
sv.paused = true; // pause until all clients connect
|
2001-02-19 21:15:25 +00:00
|
|
|
sv.loadgame = true;
|
|
|
|
|
2007-03-25 03:50:18 +00:00
|
|
|
list = PL_ObjectForKey (game, "lightstyles");
|
|
|
|
for (i = 0; i < MAX_LIGHTSTYLES; i++) {
|
|
|
|
const char *style;
|
|
|
|
char *str;
|
|
|
|
if (i >= PL_A_NumObjects (list))
|
|
|
|
break;
|
|
|
|
item = PL_ObjectAtIndex (list, i);
|
|
|
|
style = PL_String (item);
|
|
|
|
sv.lightstyles[i] = str = Hunk_Alloc (strlen (style) + 1);
|
|
|
|
strcpy (str, style);
|
|
|
|
}
|
|
|
|
|
2006-12-09 02:35:44 +00:00
|
|
|
ED_InitGlobals (&sv_pr_state, PL_ObjectForKey (game, "globals"));
|
2004-11-12 02:39:00 +00:00
|
|
|
|
2006-12-09 02:35:44 +00:00
|
|
|
list = PL_ObjectForKey (game, "entities");
|
|
|
|
entnum = 0;
|
|
|
|
count = PL_A_NumObjects (list);
|
|
|
|
for (entnum = 0; entnum < count; entnum++) {
|
|
|
|
plitem_t *entity = PL_ObjectAtIndex (list, entnum);
|
|
|
|
edict_t *ent = EDICT_NUM (&sv_pr_state, entnum);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2006-12-09 02:35:44 +00:00
|
|
|
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
|
|
|
|
ent->free = false;
|
|
|
|
ED_InitEntity (&sv_pr_state, entity, ent);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2006-12-09 02:35:44 +00:00
|
|
|
// link it into the bsp tree
|
|
|
|
if (!ent->free)
|
|
|
|
SV_LinkEdict (ent, false);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2001-02-26 06:48:02 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
sv.num_edicts = entnum;
|
2006-12-09 02:35:44 +00:00
|
|
|
sv.time = atof (PL_String (PL_ObjectForKey (game, "time")));
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
2001-02-19 21:15:25 +00:00
|
|
|
svs.clients->spawn_parms[i] = spawn_parms[i];
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (cls.state != ca_dedicated) {
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_EstablishConnection ("local");
|
|
|
|
Host_Reconnect_f ();
|
|
|
|
}
|
2004-11-12 02:39:00 +00:00
|
|
|
end:
|
2007-03-25 03:50:18 +00:00
|
|
|
if (game)
|
|
|
|
PL_Free (game);
|
2004-11-12 02:39:00 +00:00
|
|
|
if (mapname)
|
|
|
|
free (mapname);
|
|
|
|
if (script)
|
|
|
|
Script_Delete (script);
|
2007-03-25 03:50:18 +00:00
|
|
|
if (script_data)
|
|
|
|
free (script_data);
|
2004-11-12 02:39:00 +00:00
|
|
|
if (name)
|
|
|
|
dstring_delete (name);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Name_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-07-15 07:04:17 +00:00
|
|
|
const char *newName;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (Cmd_Argc () == 1) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("\"name\" is \"%s\"\n", cl_name->string);
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (Cmd_Argc () == 2)
|
2001-02-26 06:48:02 +00:00
|
|
|
newName = Cmd_Argv (1);
|
2001-02-19 21:15:25 +00:00
|
|
|
else
|
2001-07-10 18:25:54 +00:00
|
|
|
newName = Cmd_Args (1);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (cmd_source == src_command) {
|
|
|
|
if (strcmp (cl_name->string, newName) == 0)
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
2001-07-15 07:04:17 +00:00
|
|
|
Cvar_Set (cl_name, va ("%.15s", newName));
|
2001-02-19 21:15:25 +00:00
|
|
|
if (cls.state == ca_connected)
|
2002-07-31 05:19:03 +00:00
|
|
|
CL_Cmd_ForwardToServer ();
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (host_client->name[0] && strcmp (host_client->name, "unconnected"))
|
|
|
|
if (strcmp (host_client->name, newName) != 0)
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("%s renamed to %s\n", host_client->name, newName);
|
2001-02-19 21:15:25 +00:00
|
|
|
strcpy (host_client->name, newName);
|
2001-08-08 20:28:53 +00:00
|
|
|
SVstring (host_client->edict, netname) =
|
2001-03-04 05:27:29 +00:00
|
|
|
PR_SetString (&sv_pr_state, host_client->name);
|
2001-02-26 06:48:02 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
// send notification to all clients
|
2001-02-19 21:15:25 +00:00
|
|
|
MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
|
|
|
|
MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
|
|
|
|
MSG_WriteString (&sv.reliable_datagram, host_client->name);
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Version_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2010-08-19 06:01:43 +00:00
|
|
|
Sys_Printf ("Version %s\n", PACKAGE_VERSION);
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Exe: " __TIME__ " " __DATE__ "\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Say (qboolean teamonly)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
client_t *client;
|
|
|
|
client_t *save;
|
|
|
|
int j;
|
|
|
|
char *p;
|
2005-06-08 06:35:48 +00:00
|
|
|
char text[64];
|
2001-02-26 06:48:02 +00:00
|
|
|
qboolean fromServer = false;
|
|
|
|
|
|
|
|
if (cmd_source == src_command) {
|
|
|
|
if (cls.state == ca_dedicated) {
|
2001-02-19 21:15:25 +00:00
|
|
|
fromServer = true;
|
|
|
|
teamonly = false;
|
2001-02-26 06:48:02 +00:00
|
|
|
} else {
|
2002-07-31 05:19:03 +00:00
|
|
|
CL_Cmd_ForwardToServer ();
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Cmd_Argc () < 2)
|
|
|
|
return;
|
|
|
|
|
|
|
|
save = host_client;
|
|
|
|
|
2003-03-21 21:26:26 +00:00
|
|
|
p = Hunk_TempAlloc (strlen (Cmd_Args (1)) + 1);
|
2001-07-15 07:04:17 +00:00
|
|
|
strcpy (p, Cmd_Args (1));
|
2001-12-12 21:56:09 +00:00
|
|
|
// remove quotes if present
|
2001-02-26 06:48:02 +00:00
|
|
|
if (*p == '"') {
|
2001-02-19 21:15:25 +00:00
|
|
|
p++;
|
2001-02-26 06:48:02 +00:00
|
|
|
p[strlen (p) - 1] = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2001-12-12 21:56:09 +00:00
|
|
|
// turn on color set 1
|
2001-02-19 21:15:25 +00:00
|
|
|
if (!fromServer)
|
2001-02-26 06:48:02 +00:00
|
|
|
snprintf (text, sizeof (text), "%c%s: ", 1, save->name);
|
2001-02-19 21:15:25 +00:00
|
|
|
else
|
2001-02-26 06:48:02 +00:00
|
|
|
snprintf (text, sizeof (text), "%c<%s> ", 1, hostname->string);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
j = sizeof (text) - 2 - strlen (text); // -2 for /n and null terminator
|
2003-04-17 00:01:48 +00:00
|
|
|
if ((int) strlen (p) > j)
|
2001-02-19 21:15:25 +00:00
|
|
|
p[j] = 0;
|
|
|
|
|
|
|
|
strcat (text, p);
|
|
|
|
strcat (text, "\n");
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++) {
|
2001-02-19 21:15:25 +00:00
|
|
|
if (!client || !client->active || !client->spawned)
|
|
|
|
continue;
|
2001-12-12 21:56:09 +00:00
|
|
|
if (teamplay->int_val && teamonly && SVfloat (client->edict, team) !=
|
|
|
|
SVfloat (save->edict, team))
|
|
|
|
continue;
|
2001-02-19 21:15:25 +00:00
|
|
|
host_client = client;
|
2001-02-26 06:48:02 +00:00
|
|
|
SV_ClientPrintf ("%s", text);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
host_client = save;
|
|
|
|
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("%s", &text[1]);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Say_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Say (false);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Say_Team_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Say (true);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Tell_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
client_t *client;
|
|
|
|
client_t *save;
|
|
|
|
int j;
|
|
|
|
char *p;
|
|
|
|
char text[64];
|
|
|
|
|
|
|
|
if (cmd_source == src_command) {
|
2002-07-31 05:19:03 +00:00
|
|
|
CL_Cmd_ForwardToServer ();
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Cmd_Argc () < 3)
|
|
|
|
return;
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
strcpy (text, host_client->name);
|
|
|
|
strcat (text, ": ");
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-03-21 21:26:26 +00:00
|
|
|
p = Hunk_TempAlloc (strlen (Cmd_Args (1)) + 1);
|
2001-07-15 07:04:17 +00:00
|
|
|
strcpy (p, Cmd_Args (1));
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
// remove quotes if present
|
2001-02-26 06:48:02 +00:00
|
|
|
if (*p == '"') {
|
2001-02-19 21:15:25 +00:00
|
|
|
p++;
|
2001-02-26 06:48:02 +00:00
|
|
|
p[strlen (p) - 1] = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2001-12-12 21:56:09 +00:00
|
|
|
// check length & truncate if necessary
|
2001-02-26 06:48:02 +00:00
|
|
|
j = sizeof (text) - 2 - strlen (text); // -2 for /n and null terminator
|
2003-04-17 00:01:48 +00:00
|
|
|
if ((int) strlen (p) > j)
|
2001-02-19 21:15:25 +00:00
|
|
|
p[j] = 0;
|
|
|
|
|
|
|
|
strcat (text, p);
|
|
|
|
strcat (text, "\n");
|
|
|
|
|
|
|
|
save = host_client;
|
2001-02-26 06:48:02 +00:00
|
|
|
for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++) {
|
2001-02-19 21:15:25 +00:00
|
|
|
if (!client->active || !client->spawned)
|
|
|
|
continue;
|
2001-02-26 06:48:02 +00:00
|
|
|
if (strcasecmp (client->name, Cmd_Argv (1)))
|
2001-02-19 21:15:25 +00:00
|
|
|
continue;
|
|
|
|
host_client = client;
|
2001-02-26 06:48:02 +00:00
|
|
|
SV_ClientPrintf ("%s", text);
|
2001-02-19 21:15:25 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
host_client = save;
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Kill_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
if (cmd_source == src_command) {
|
2002-07-31 05:19:03 +00:00
|
|
|
CL_Cmd_ForwardToServer ();
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-08-08 20:28:53 +00:00
|
|
|
if (SVfloat (sv_player, health) <= 0) {
|
2001-02-22 00:15:03 +00:00
|
|
|
SV_ClientPrintf ("Can't suicide -- already dead!\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-02-26 06:48:02 +00:00
|
|
|
|
2001-03-03 08:31:58 +00:00
|
|
|
*sv_globals.time = sv.time;
|
2001-12-12 21:56:09 +00:00
|
|
|
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, sv_player);
|
2001-03-03 08:31:58 +00:00
|
|
|
PR_ExecuteProgram (&sv_pr_state, sv_funcs.ClientKill);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Pause_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
|
|
|
|
if (cmd_source == src_command) {
|
2002-07-31 05:19:03 +00:00
|
|
|
CL_Cmd_ForwardToServer ();
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!pausable->int_val)
|
|
|
|
SV_ClientPrintf ("Pause not allowed.\n");
|
2001-02-26 06:48:02 +00:00
|
|
|
else {
|
2001-02-19 21:15:25 +00:00
|
|
|
sv.paused ^= 1;
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (sv.paused) {
|
|
|
|
SV_BroadcastPrintf ("%s paused the game\n",
|
2001-12-12 21:56:09 +00:00
|
|
|
PR_GetString (&sv_pr_state,
|
|
|
|
SVstring (sv_player, netname)));
|
2001-02-26 06:48:02 +00:00
|
|
|
} else {
|
|
|
|
SV_BroadcastPrintf ("%s unpaused the game\n",
|
2001-12-12 21:56:09 +00:00
|
|
|
PR_GetString (&sv_pr_state,
|
|
|
|
SVstring (sv_player, netname)));
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
// send notification to all clients
|
2001-02-19 21:15:25 +00:00
|
|
|
MSG_WriteByte (&sv.reliable_datagram, svc_setpause);
|
|
|
|
MSG_WriteByte (&sv.reliable_datagram, sv.paused);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_PreSpawn_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
if (cmd_source == src_command) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("prespawn is not valid from the console\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (host_client->spawned) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("prespawn not valid -- already spawned\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-02-26 06:48:02 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
SZ_Write (&host_client->message, sv.signon.data, sv.signon.cursize);
|
|
|
|
MSG_WriteByte (&host_client->message, svc_signonnum);
|
|
|
|
MSG_WriteByte (&host_client->message, 2);
|
|
|
|
host_client->sendsignon = true;
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Spawn_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
int i;
|
|
|
|
client_t *client;
|
|
|
|
edict_t *ent;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (cmd_source == src_command) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("spawn is not valid from the console\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (host_client->spawned) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Spawn not valid -- already spawned\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-12-12 21:56:09 +00:00
|
|
|
// run the entrance script
|
|
|
|
if (sv.loadgame) { // loaded games are fully inited already
|
2001-02-19 21:15:25 +00:00
|
|
|
// if this is the last client to be connected, unpause
|
|
|
|
sv.paused = false;
|
2001-02-26 06:48:02 +00:00
|
|
|
} else {
|
2001-02-19 21:15:25 +00:00
|
|
|
// set up the edict
|
|
|
|
ent = host_client->edict;
|
2001-02-26 20:52:14 +00:00
|
|
|
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
|
2001-08-08 20:28:53 +00:00
|
|
|
SVfloat (ent, colormap) = NUM_FOR_EDICT (&sv_pr_state, ent);
|
|
|
|
SVfloat (ent, team) = (host_client->colors & 15) + 1;
|
2001-12-12 21:56:09 +00:00
|
|
|
SVstring (ent, netname) = PR_SetString (&sv_pr_state,
|
|
|
|
host_client->name);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
// copy spawn parms out of the client_t
|
2001-02-26 06:48:02 +00:00
|
|
|
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
2001-03-03 08:31:58 +00:00
|
|
|
sv_globals.parms[i] = host_client->spawn_parms[i];
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
// call the spawn function
|
2001-03-03 08:31:58 +00:00
|
|
|
*sv_globals.time = sv.time;
|
2001-12-12 21:56:09 +00:00
|
|
|
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, sv_player);
|
|
|
|
PR_ExecuteProgram (&sv_pr_state, sv_funcs.ClientConnect);
|
2001-02-26 06:48:02 +00:00
|
|
|
if ((Sys_DoubleTime () - host_client->netconnection->connecttime) <=
|
2007-11-06 10:17:14 +00:00
|
|
|
sv.time) Sys_Printf ("%s entered the game\n", host_client->name);
|
2001-12-12 21:56:09 +00:00
|
|
|
PR_ExecuteProgram (&sv_pr_state, sv_funcs.PutClientInServer);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
// send all current names, colors, and frag counts
|
2001-02-19 21:15:25 +00:00
|
|
|
SZ_Clear (&host_client->message);
|
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
// send time of update
|
2001-02-19 21:15:25 +00:00
|
|
|
MSG_WriteByte (&host_client->message, svc_time);
|
|
|
|
MSG_WriteFloat (&host_client->message, sv.time);
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
for (i = 0, client = svs.clients; i < svs.maxclients; i++, client++) {
|
2001-02-19 21:15:25 +00:00
|
|
|
MSG_WriteByte (&host_client->message, svc_updatename);
|
|
|
|
MSG_WriteByte (&host_client->message, i);
|
|
|
|
MSG_WriteString (&host_client->message, client->name);
|
|
|
|
MSG_WriteByte (&host_client->message, svc_updatefrags);
|
|
|
|
MSG_WriteByte (&host_client->message, i);
|
|
|
|
MSG_WriteShort (&host_client->message, client->old_frags);
|
|
|
|
MSG_WriteByte (&host_client->message, svc_updatecolors);
|
|
|
|
MSG_WriteByte (&host_client->message, i);
|
|
|
|
MSG_WriteByte (&host_client->message, client->colors);
|
|
|
|
}
|
2001-02-26 06:48:02 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
// send all current light styles
|
2001-02-26 06:48:02 +00:00
|
|
|
for (i = 0; i < MAX_LIGHTSTYLES; i++) {
|
2001-02-19 21:15:25 +00:00
|
|
|
MSG_WriteByte (&host_client->message, svc_lightstyle);
|
2001-02-26 06:48:02 +00:00
|
|
|
MSG_WriteByte (&host_client->message, (char) i);
|
2001-02-19 21:15:25 +00:00
|
|
|
MSG_WriteString (&host_client->message, sv.lightstyles[i]);
|
|
|
|
}
|
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
// send some stats
|
2001-02-19 21:15:25 +00:00
|
|
|
MSG_WriteByte (&host_client->message, svc_updatestat);
|
|
|
|
MSG_WriteByte (&host_client->message, STAT_TOTALSECRETS);
|
2001-02-26 20:52:14 +00:00
|
|
|
MSG_WriteLong (&host_client->message,
|
2001-03-03 08:31:58 +00:00
|
|
|
*sv_globals.total_secrets);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
MSG_WriteByte (&host_client->message, svc_updatestat);
|
|
|
|
MSG_WriteByte (&host_client->message, STAT_TOTALMONSTERS);
|
2001-02-26 20:52:14 +00:00
|
|
|
MSG_WriteLong (&host_client->message,
|
2001-03-03 08:31:58 +00:00
|
|
|
*sv_globals.total_monsters);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
MSG_WriteByte (&host_client->message, svc_updatestat);
|
|
|
|
MSG_WriteByte (&host_client->message, STAT_SECRETS);
|
2001-02-26 20:52:14 +00:00
|
|
|
MSG_WriteLong (&host_client->message,
|
2001-03-03 08:31:58 +00:00
|
|
|
*sv_globals.found_secrets);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
MSG_WriteByte (&host_client->message, svc_updatestat);
|
|
|
|
MSG_WriteByte (&host_client->message, STAT_MONSTERS);
|
2001-02-26 20:52:14 +00:00
|
|
|
MSG_WriteLong (&host_client->message,
|
2001-03-03 08:31:58 +00:00
|
|
|
*sv_globals.killed_monsters);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
// send a fixangle
|
|
|
|
// Never send a roll angle, because savegames can catch the server
|
|
|
|
// in a state where it is expecting the client to correct the angle
|
|
|
|
// and it won't happen if the game was just loaded, so you wind up
|
|
|
|
// with a permanent head tilt
|
2001-02-26 20:52:14 +00:00
|
|
|
ent = EDICT_NUM (&sv_pr_state, 1 + (host_client - svs.clients));
|
2001-02-19 21:15:25 +00:00
|
|
|
MSG_WriteByte (&host_client->message, svc_setangle);
|
2001-12-12 21:56:09 +00:00
|
|
|
MSG_WriteAngle (&host_client->message, SVvector (ent, angles)[0]);
|
|
|
|
MSG_WriteAngle (&host_client->message, SVvector (ent, angles)[1]);
|
2001-02-26 06:48:02 +00:00
|
|
|
MSG_WriteAngle (&host_client->message, 0);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
SV_WriteClientdataToMessage (sv_player, &host_client->message);
|
|
|
|
|
|
|
|
MSG_WriteByte (&host_client->message, svc_signonnum);
|
|
|
|
MSG_WriteByte (&host_client->message, 3);
|
|
|
|
host_client->sendsignon = true;
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Begin_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
if (cmd_source == src_command) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("begin is not valid from the console\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
host_client->spawned = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
/*
|
2001-12-12 21:56:09 +00:00
|
|
|
Host_Kick_f
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
Kicks a user off of the server
|
2001-02-19 21:15:25 +00:00
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Kick_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-07-15 07:04:17 +00:00
|
|
|
const char *who;
|
|
|
|
const char *message = NULL;
|
2001-02-26 06:48:02 +00:00
|
|
|
client_t *save;
|
|
|
|
int i;
|
|
|
|
qboolean byNumber = false;
|
|
|
|
|
|
|
|
if (cmd_source == src_command) {
|
|
|
|
if (!sv.active) {
|
2002-07-31 05:19:03 +00:00
|
|
|
CL_Cmd_ForwardToServer ();
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-02-26 20:52:14 +00:00
|
|
|
}
|
2001-03-03 08:31:58 +00:00
|
|
|
else if (*sv_globals.deathmatch
|
2001-02-26 20:52:14 +00:00
|
|
|
&& !host_client->privileged) return;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
save = host_client;
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (Cmd_Argc () > 2 && strcmp (Cmd_Argv (1), "#") == 0) {
|
|
|
|
i = atof (Cmd_Argv (2)) - 1;
|
2001-02-19 21:15:25 +00:00
|
|
|
if (i < 0 || i >= svs.maxclients)
|
|
|
|
return;
|
|
|
|
if (!svs.clients[i].active)
|
|
|
|
return;
|
|
|
|
host_client = &svs.clients[i];
|
|
|
|
byNumber = true;
|
2001-02-26 06:48:02 +00:00
|
|
|
} else {
|
|
|
|
for (i = 0, host_client = svs.clients; i < svs.maxclients;
|
|
|
|
i++, host_client++) {
|
2001-02-19 21:15:25 +00:00
|
|
|
if (!host_client->active)
|
|
|
|
continue;
|
2001-02-26 06:48:02 +00:00
|
|
|
if (strcasecmp (host_client->name, Cmd_Argv (1)) == 0)
|
2001-02-19 21:15:25 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (i < svs.maxclients) {
|
2001-02-19 21:15:25 +00:00
|
|
|
if (cmd_source == src_command)
|
|
|
|
if (cls.state == ca_dedicated)
|
|
|
|
who = "Console";
|
|
|
|
else
|
|
|
|
who = cl_name->string;
|
|
|
|
else
|
|
|
|
who = save->name;
|
|
|
|
|
|
|
|
// can't kick yourself!
|
|
|
|
if (host_client == save)
|
|
|
|
return;
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (Cmd_Argc () > 2) {
|
2001-07-10 18:25:54 +00:00
|
|
|
message = COM_Parse (Cmd_Args (1));
|
2001-02-26 06:48:02 +00:00
|
|
|
if (byNumber) {
|
|
|
|
message++; // skip the #
|
|
|
|
while (*message == ' ') // skip white space
|
2001-02-19 21:15:25 +00:00
|
|
|
message++;
|
2001-02-26 06:48:02 +00:00
|
|
|
message += strlen (Cmd_Argv (2)); // skip the number
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
while (*message && *message == ' ')
|
|
|
|
message++;
|
|
|
|
}
|
|
|
|
if (message)
|
|
|
|
SV_ClientPrintf ("Kicked by %s: %s\n", who, message);
|
|
|
|
else
|
|
|
|
SV_ClientPrintf ("Kicked by %s\n", who);
|
|
|
|
SV_DropClient (false);
|
|
|
|
}
|
|
|
|
|
|
|
|
host_client = save;
|
|
|
|
}
|
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
// DEBUGGING TOOLS ============================================================
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-03-09 07:58:10 +00:00
|
|
|
// FIXME: This cheat should be re-implemented OUTSIDE the engine!
|
|
|
|
#if 0
|
2001-02-26 06:48:02 +00:00
|
|
|
void
|
|
|
|
Host_Give_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
char *t;
|
|
|
|
int v;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (cmd_source == src_command) {
|
2002-07-31 05:19:03 +00:00
|
|
|
CL_Cmd_ForwardToServer ();
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-03-03 08:31:58 +00:00
|
|
|
if (*sv_globals.deathmatch && !host_client->privileged)
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
t = Cmd_Argv (1);
|
|
|
|
v = atoi (Cmd_Argv (2));
|
|
|
|
|
|
|
|
switch (t[0]) {
|
|
|
|
case '0':
|
|
|
|
case '1':
|
|
|
|
case '2':
|
|
|
|
case '3':
|
|
|
|
case '4':
|
|
|
|
case '5':
|
|
|
|
case '6':
|
|
|
|
case '7':
|
|
|
|
case '8':
|
|
|
|
case '9':
|
2002-09-28 02:33:39 +00:00
|
|
|
// MED 01/04/97 added hipnotic give stuff
|
|
|
|
if (hipnotic) {
|
|
|
|
if (t[0] == '6') {
|
|
|
|
if (t[1] == 'a')
|
|
|
|
SVfloat (sv_player, items) =
|
|
|
|
(int) SVfloat (sv_player, items)
|
|
|
|
| HIT_PROXIMITY_GUN;
|
|
|
|
else
|
|
|
|
SVfloat (sv_player, items) =
|
|
|
|
(int) SVfloat (sv_player, items)
|
|
|
|
| IT_GRENADE_LAUNCHER;
|
|
|
|
} else if (t[0] == '9')
|
2001-08-08 20:28:53 +00:00
|
|
|
SVfloat (sv_player, items) =
|
2002-09-28 02:33:39 +00:00
|
|
|
(int) SVfloat (sv_player, items) | HIT_LASER_CANNON;
|
|
|
|
else if (t[0] == '0')
|
2001-08-08 20:28:53 +00:00
|
|
|
SVfloat (sv_player, items) =
|
2002-09-28 02:33:39 +00:00
|
|
|
(int) SVfloat (sv_player, items) | HIT_MJOLNIR;
|
|
|
|
else if (t[0] >= '2')
|
|
|
|
SVfloat (sv_player, items) =
|
|
|
|
(int) SVfloat (sv_player, items)
|
|
|
|
| (IT_SHOTGUN << (t[0] - '2'));
|
|
|
|
} else {
|
|
|
|
if (t[0] >= '2')
|
|
|
|
SVfloat (sv_player, items) =
|
|
|
|
(int) SVfloat (sv_player, items)
|
|
|
|
| (IT_SHOTGUN << (t[0] - '2'));
|
|
|
|
}
|
|
|
|
break;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
case 's':
|
2002-09-28 02:33:39 +00:00
|
|
|
if (rogue) {
|
|
|
|
SVfloat (sv_player, ammo_shells1) = v;
|
|
|
|
}
|
2001-02-26 06:48:02 +00:00
|
|
|
|
2002-09-28 02:33:39 +00:00
|
|
|
SVfloat (sv_player, ammo_shells) = v;
|
|
|
|
break;
|
2001-02-26 06:48:02 +00:00
|
|
|
case 'n':
|
2002-09-28 02:33:39 +00:00
|
|
|
if (rogue) {
|
|
|
|
SVfloat (sv_player, ammo_nails1) = v;
|
|
|
|
if (SVfloat (sv_player, weapon) <= IT_LIGHTNING)
|
|
|
|
SVfloat (sv_player, ammo_nails) = v;
|
|
|
|
} else {
|
2002-02-25 07:44:17 +00:00
|
|
|
SVfloat (sv_player, ammo_nails) = v;
|
2002-09-28 02:33:39 +00:00
|
|
|
}
|
|
|
|
break;
|
2001-02-26 06:48:02 +00:00
|
|
|
case 'l':
|
2002-09-28 02:33:39 +00:00
|
|
|
if (rogue) {
|
|
|
|
SVfloat (sv_player, ammo_lava_nails) = v;
|
|
|
|
if (SVfloat (sv_player, weapon) > IT_LIGHTNING)
|
|
|
|
SVfloat (sv_player, ammo_nails) = v;
|
|
|
|
}
|
|
|
|
break;
|
2001-02-26 06:48:02 +00:00
|
|
|
case 'r':
|
2002-09-28 02:33:39 +00:00
|
|
|
if (rogue) {
|
|
|
|
SVfloat (sv_player, ammo_rockets1) = v;
|
|
|
|
if (SVfloat (sv_player, weapon) <= IT_LIGHTNING)
|
|
|
|
SVfloat (sv_player, ammo_rockets) = v;
|
|
|
|
} else {
|
2002-02-25 07:44:17 +00:00
|
|
|
SVfloat (sv_player, ammo_rockets) = v;
|
2002-09-28 02:33:39 +00:00
|
|
|
}
|
|
|
|
break;
|
2001-02-26 06:48:02 +00:00
|
|
|
case 'm':
|
2002-09-28 02:33:39 +00:00
|
|
|
if (rogue) {
|
|
|
|
SVfloat (sv_player, ammo_multi_rockets) = 0;
|
|
|
|
if (SVfloat (sv_player, weapon) > IT_LIGHTNING)
|
|
|
|
SVfloat (sv_player, ammo_rockets) = v;
|
|
|
|
}
|
|
|
|
break;
|
2001-02-26 06:48:02 +00:00
|
|
|
case 'h':
|
2002-09-28 02:33:39 +00:00
|
|
|
SVfloat (sv_player, health) = v;
|
|
|
|
break;
|
2001-02-26 06:48:02 +00:00
|
|
|
case 'c':
|
2002-09-28 02:33:39 +00:00
|
|
|
if (rogue) {
|
|
|
|
SVfloat (sv_player, ammo_cells1) = v;
|
|
|
|
if (SVfloat (sv_player, weapon) <= IT_LIGHTNING)
|
|
|
|
SVfloat (sv_player, ammo_cells) = v;
|
|
|
|
} else {
|
2002-02-25 07:44:17 +00:00
|
|
|
SVfloat (sv_player, ammo_cells) = v;
|
2002-09-28 02:33:39 +00:00
|
|
|
}
|
|
|
|
break;
|
2001-02-26 06:48:02 +00:00
|
|
|
case 'p':
|
2002-09-28 02:33:39 +00:00
|
|
|
if (rogue) {
|
|
|
|
SVfloat (sv_player, ammo_plasma) = v;
|
|
|
|
if (SVfloat (sv_player, weapon) > IT_LIGHTNING)
|
|
|
|
SVfloat (sv_player, ammo_cells) = v;
|
|
|
|
}
|
|
|
|
break;
|
2001-02-26 06:48:02 +00:00
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2001-03-09 07:58:10 +00:00
|
|
|
#endif
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static edict_t *
|
2001-02-26 06:48:02 +00:00
|
|
|
FindViewthing (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
int i;
|
|
|
|
edict_t *e;
|
|
|
|
|
|
|
|
for (i = 0; i < sv.num_edicts; i++) {
|
2001-02-26 20:52:14 +00:00
|
|
|
e = EDICT_NUM (&sv_pr_state, i);
|
2001-12-12 21:56:09 +00:00
|
|
|
if (!strcmp (PR_GetString (&sv_pr_state, SVstring (e, classname)),
|
|
|
|
"viewthing"))
|
2001-02-19 21:15:25 +00:00
|
|
|
return e;
|
|
|
|
}
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("No viewthing on map\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Viewmodel_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
edict_t *e;
|
|
|
|
model_t *m;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
e = FindViewthing ();
|
|
|
|
if (!e)
|
|
|
|
return;
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
m = Mod_ForName (Cmd_Argv (1), false);
|
|
|
|
if (!m) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Can't load %s\n", Cmd_Argv (1));
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-02-26 06:48:02 +00:00
|
|
|
|
2001-08-08 20:28:53 +00:00
|
|
|
SVfloat (e, frame) = 0;
|
|
|
|
cl.model_precache[(int) SVfloat (e, modelindex)] = m;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Viewframe_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
edict_t *e;
|
|
|
|
int f;
|
|
|
|
model_t *m;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
e = FindViewthing ();
|
|
|
|
if (!e)
|
|
|
|
return;
|
2001-08-08 20:28:53 +00:00
|
|
|
m = cl.model_precache[(int) SVfloat (e, modelindex)];
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
f = atoi (Cmd_Argv (1));
|
2001-02-19 21:15:25 +00:00
|
|
|
if (f >= m->numframes)
|
2001-02-26 06:48:02 +00:00
|
|
|
f = m->numframes - 1;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-08-08 20:28:53 +00:00
|
|
|
SVfloat (e, frame) = f;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
PrintFrameName (model_t *m, int frame)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
aliashdr_t *hdr;
|
|
|
|
maliasframedesc_t *pframedesc;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-08-31 12:22:45 +00:00
|
|
|
hdr = Cache_TryGet (&m->cache);
|
2001-02-19 21:15:25 +00:00
|
|
|
if (!hdr)
|
|
|
|
return;
|
|
|
|
pframedesc = &hdr->frames[frame];
|
2001-02-26 06:48:02 +00:00
|
|
|
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("frame %i: %s\n", frame, pframedesc->name);
|
2001-08-31 12:22:45 +00:00
|
|
|
Cache_Release (&m->cache);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Viewnext_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
edict_t *e;
|
|
|
|
model_t *m;
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
e = FindViewthing ();
|
|
|
|
if (!e)
|
|
|
|
return;
|
2001-08-08 20:28:53 +00:00
|
|
|
m = cl.model_precache[(int) SVfloat (e, modelindex)];
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-08-08 20:28:53 +00:00
|
|
|
SVfloat (e, frame) = SVfloat (e, frame) + 1;
|
|
|
|
if (SVfloat (e, frame) >= m->numframes)
|
|
|
|
SVfloat (e, frame) = m->numframes - 1;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-08-08 20:28:53 +00:00
|
|
|
PrintFrameName (m, SVfloat (e, frame));
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Viewprev_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
edict_t *e;
|
|
|
|
model_t *m;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
e = FindViewthing ();
|
|
|
|
if (!e)
|
|
|
|
return;
|
|
|
|
|
2001-08-08 20:28:53 +00:00
|
|
|
m = cl.model_precache[(int) SVfloat (e, modelindex)];
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-08-08 20:28:53 +00:00
|
|
|
SVfloat (e, frame) = SVfloat (e, frame) - 1;
|
|
|
|
if (SVfloat (e, frame) < 0)
|
|
|
|
SVfloat (e, frame) = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-08-08 20:28:53 +00:00
|
|
|
PrintFrameName (m, SVfloat (e, frame));
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
// DEMO LOOP CONTROL ==========================================================
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Startdemos_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
int i, c;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (cls.state == ca_dedicated) {
|
2001-02-19 21:15:25 +00:00
|
|
|
if (!sv.active)
|
2002-07-31 05:19:03 +00:00
|
|
|
Cbuf_AddText (host_cbuf, "map start\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
c = Cmd_Argc () - 1;
|
|
|
|
if (c > MAX_DEMOS) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Max %i demos in demoloop\n", MAX_DEMOS);
|
2001-02-19 21:15:25 +00:00
|
|
|
c = MAX_DEMOS;
|
|
|
|
}
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("%i demo(s) in loop\n", c);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
for (i = 1; i < c + 1; i++)
|
|
|
|
strncpy (cls.demos[i - 1], Cmd_Argv (i), sizeof (cls.demos[0]) - 1);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if (!sv.active && cls.demonum != -1 && !cls.demoplayback) {
|
2001-02-19 21:15:25 +00:00
|
|
|
cls.demonum = 0;
|
|
|
|
CL_NextDemo ();
|
2001-02-26 06:48:02 +00:00
|
|
|
} else
|
2001-02-19 21:15:25 +00:00
|
|
|
cls.demonum = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2001-12-12 21:56:09 +00:00
|
|
|
Host_Demos_f
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
Return to looping demos
|
2001-02-19 21:15:25 +00:00
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Demos_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
|
|
|
if (cls.state == ca_dedicated)
|
|
|
|
return;
|
|
|
|
if (cls.demonum == -1)
|
|
|
|
cls.demonum = 1;
|
|
|
|
CL_Disconnect_f ();
|
|
|
|
CL_NextDemo ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2001-12-12 21:56:09 +00:00
|
|
|
Host_Stopdemo_f
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-12-12 21:56:09 +00:00
|
|
|
Return to looping demos
|
2001-02-19 21:15:25 +00:00
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-26 06:48:02 +00:00
|
|
|
Host_Stopdemo_f (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
|
|
|
if (cls.state == ca_dedicated)
|
|
|
|
return;
|
|
|
|
if (!cls.demoplayback)
|
|
|
|
return;
|
|
|
|
CL_StopPlayback ();
|
|
|
|
CL_Disconnect ();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
void
|
|
|
|
Host_InitCommands (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-02-21 19:35:06 +00:00
|
|
|
Cmd_AddCommand ("status", Host_Status_f, "No Description");
|
2002-07-21 03:55:10 +00:00
|
|
|
if (!con_module || isDedicated)
|
2002-01-20 00:04:50 +00:00
|
|
|
Cmd_AddCommand ("quit", Host_Quit_f, "No Description");
|
2001-02-21 19:35:06 +00:00
|
|
|
Cmd_AddCommand ("god", Host_God_f, "No Description");
|
|
|
|
Cmd_AddCommand ("notarget", Host_Notarget_f, "No Description");
|
|
|
|
Cmd_AddCommand ("fly", Host_Fly_f, "No Description");
|
|
|
|
Cmd_AddCommand ("map", Host_Map_f, "No Description");
|
|
|
|
Cmd_AddCommand ("restart", Host_Restart_f, "No Description");
|
|
|
|
Cmd_AddCommand ("changelevel", Host_Changelevel_f, "No Description");
|
|
|
|
Cmd_AddCommand ("connect", Host_Connect_f, "No Description");
|
|
|
|
Cmd_AddCommand ("reconnect", Host_Reconnect_f, "No Description");
|
|
|
|
Cmd_AddCommand ("name", Host_Name_f, "No Description");
|
|
|
|
Cmd_AddCommand ("noclip", Host_Noclip_f, "No Description");
|
|
|
|
Cmd_AddCommand ("version", Host_Version_f, "No Description");
|
|
|
|
Cmd_AddCommand ("say", Host_Say_f, "No Description");
|
|
|
|
Cmd_AddCommand ("say_team", Host_Say_Team_f, "No Description");
|
|
|
|
Cmd_AddCommand ("tell", Host_Tell_f, "No Description");
|
|
|
|
Cmd_AddCommand ("kill", Host_Kill_f, "No Description");
|
|
|
|
Cmd_AddCommand ("pause", Host_Pause_f, "No Description");
|
|
|
|
Cmd_AddCommand ("spawn", Host_Spawn_f, "No Description");
|
|
|
|
Cmd_AddCommand ("begin", Host_Begin_f, "No Description");
|
|
|
|
Cmd_AddCommand ("prespawn", Host_PreSpawn_f, "No Description");
|
|
|
|
Cmd_AddCommand ("kick", Host_Kick_f, "No Description");
|
|
|
|
Cmd_AddCommand ("ping", Host_Ping_f, "No Description");
|
|
|
|
Cmd_AddCommand ("load", Host_Loadgame_f, "No Description");
|
|
|
|
Cmd_AddCommand ("save", Host_Savegame_f, "No Description");
|
|
|
|
|
|
|
|
Cmd_AddCommand ("startdemos", Host_Startdemos_f, "No Description");
|
|
|
|
Cmd_AddCommand ("demos", Host_Demos_f, "No Description");
|
|
|
|
Cmd_AddCommand ("stopdemo", Host_Stopdemo_f, "No Description");
|
|
|
|
|
|
|
|
Cmd_AddCommand ("viewmodel", Host_Viewmodel_f, "No Description");
|
|
|
|
Cmd_AddCommand ("viewframe", Host_Viewframe_f, "No Description");
|
|
|
|
Cmd_AddCommand ("viewnext", Host_Viewnext_f, "No Description");
|
|
|
|
Cmd_AddCommand ("viewprev", Host_Viewprev_f, "No Description");
|
|
|
|
|
|
|
|
Cmd_AddCommand ("mcache", Mod_Print, "No Description");
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|