2000-05-10 20:33:16 +00:00
|
|
|
|
/*
|
2000-05-11 16:03:29 +00:00
|
|
|
|
cl_main.c
|
2000-05-10 20:33:16 +00:00
|
|
|
|
|
2000-05-22 06:46:35 +00:00
|
|
|
|
Client main loop
|
2000-05-10 20:33:16 +00:00
|
|
|
|
|
2000-05-11 16:03:29 +00:00
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
2000-05-10 20:33:16 +00:00
|
|
|
|
|
2000-05-11 16:03:29 +00:00
|
|
|
|
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.
|
2000-05-10 20:33:16 +00:00
|
|
|
|
|
2000-05-11 16:03:29 +00:00
|
|
|
|
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.
|
2000-05-10 20:33:16 +00:00
|
|
|
|
|
2000-05-11 16:03:29 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
$Id$
|
2000-05-10 20:33:16 +00:00
|
|
|
|
*/
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-05-17 10:03:19 +00:00
|
|
|
|
#ifdef HAVE_CONFIG_H
|
2000-05-19 10:48:21 +00:00
|
|
|
|
# include "config.h"
|
2000-05-17 10:03:19 +00:00
|
|
|
|
#endif
|
2001-02-08 20:56:40 +00:00
|
|
|
|
|
|
|
|
|
#ifdef __sun
|
|
|
|
|
/* Sun's model_t in sys/model.h conflicts w/ Quake's model_t */
|
|
|
|
|
# define model_t sunmodel_t
|
|
|
|
|
#endif
|
2000-12-30 03:07:15 +00:00
|
|
|
|
#ifdef HAVE_STRING_H
|
2001-01-04 20:43:36 +00:00
|
|
|
|
# include <string.h>
|
2000-12-30 03:07:15 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_STRINGS_H
|
2001-01-04 20:43:36 +00:00
|
|
|
|
# include <strings.h>
|
2000-12-30 03:07:15 +00:00
|
|
|
|
#endif
|
2000-12-30 11:20:36 +00:00
|
|
|
|
|
2001-06-12 00:02:48 +00:00
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
|
# include <unistd.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-01-22 22:48:22 +00:00
|
|
|
|
#include <errno.h>
|
2000-05-14 16:56:28 +00:00
|
|
|
|
#include <ctype.h>
|
2001-01-21 02:55:53 +00:00
|
|
|
|
#include <sys/types.h>
|
2000-12-30 11:20:36 +00:00
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
2001-01-04 20:43:36 +00:00
|
|
|
|
# include <netinet/in.h>
|
2000-12-30 11:20:36 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2000-12-30 03:07:15 +00:00
|
|
|
|
#ifdef HAVE_WINSOCK_H
|
2001-01-04 20:43:36 +00:00
|
|
|
|
# include <winsock.h>
|
2000-12-30 03:07:15 +00:00
|
|
|
|
#endif
|
2001-07-05 19:07:02 +00:00
|
|
|
|
#ifdef HAVE_RPC_TYPES_H
|
|
|
|
|
# include <rpc/types.h>
|
|
|
|
|
#endif
|
2001-01-04 20:43:36 +00:00
|
|
|
|
|
2000-12-30 03:23:31 +00:00
|
|
|
|
#include <setjmp.h>
|
2000-12-05 06:33:44 +00:00
|
|
|
|
|
2001-02-08 20:56:40 +00:00
|
|
|
|
#ifdef __sun
|
|
|
|
|
# undef model_t
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-05-21 08:24:45 +00:00
|
|
|
|
#include "bothdefs.h"
|
2000-05-21 22:13:01 +00:00
|
|
|
|
#include "buildnum.h"
|
2000-05-21 08:24:45 +00:00
|
|
|
|
#include "cdaudio.h"
|
2000-10-29 15:35:24 +00:00
|
|
|
|
#include "cl_cam.h"
|
|
|
|
|
#include "cl_demo.h"
|
|
|
|
|
#include "cl_ents.h"
|
2000-12-30 02:16:36 +00:00
|
|
|
|
#include "cl_input.h"
|
|
|
|
|
#include "cl_main.h"
|
2000-10-29 15:35:24 +00:00
|
|
|
|
#include "cl_parse.h"
|
|
|
|
|
#include "cl_pred.h"
|
2000-12-30 03:07:15 +00:00
|
|
|
|
#include "cl_slist.h"
|
2000-12-30 02:16:36 +00:00
|
|
|
|
#include "cl_tent.h"
|
|
|
|
|
#include "client.h"
|
|
|
|
|
#include "cmd.h"
|
|
|
|
|
#include "console.h"
|
|
|
|
|
#include "cvar.h"
|
|
|
|
|
#include "draw.h"
|
|
|
|
|
#include "host.h"
|
|
|
|
|
#include "input.h"
|
|
|
|
|
#include "keys.h"
|
|
|
|
|
#include "menu.h"
|
|
|
|
|
#include "model.h"
|
|
|
|
|
#include "msg.h"
|
|
|
|
|
#include "net.h"
|
|
|
|
|
#include "pmove.h"
|
|
|
|
|
#include "qendian.h"
|
|
|
|
|
#include "quakefs.h"
|
|
|
|
|
#include "qargs.h"
|
|
|
|
|
#include "sbar.h"
|
|
|
|
|
#include "screen.h"
|
|
|
|
|
#include "skin.h"
|
|
|
|
|
#include "sound.h"
|
|
|
|
|
#include "sys.h"
|
|
|
|
|
#include "teamplay.h"
|
|
|
|
|
#include "vid.h"
|
|
|
|
|
#include "view.h"
|
|
|
|
|
#include "va.h"
|
2000-05-26 03:55:27 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void CL_RemoveQFInfoKeys ();
|
2000-05-22 01:37:19 +00:00
|
|
|
|
|
2000-12-29 03:14:53 +00:00
|
|
|
|
// we need to declare some mouse variables here, because the menu system
|
|
|
|
|
// references them even when on a unix system.
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
qboolean noclip_anglehack; // remnant from old quake
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cvar_t *fs_globalcfg;
|
2001-02-10 00:40:55 +00:00
|
|
|
|
cvar_t *fs_usercfg;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cvar_t *rcon_password;
|
2000-05-16 04:47:41 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cvar_t *rcon_address;
|
2000-05-16 04:47:41 +00:00
|
|
|
|
|
2001-02-11 07:15:39 +00:00
|
|
|
|
cvar_t *cl_writecfg;
|
2001-02-14 22:25:22 +00:00
|
|
|
|
cvar_t *cl_allow_cmd_pkt;
|
2001-02-11 07:15:39 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cvar_t *cl_timeout;
|
2000-05-16 04:47:41 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cvar_t *cl_shownet; // can be 0, 1, or 2
|
|
|
|
|
cvar_t *cl_autoexec;
|
|
|
|
|
cvar_t *cl_sbar;
|
|
|
|
|
cvar_t *cl_sbar_separator;
|
|
|
|
|
cvar_t *cl_hudswap;
|
|
|
|
|
cvar_t *cl_maxfps;
|
2000-05-16 04:47:41 +00:00
|
|
|
|
|
2001-02-14 22:25:22 +00:00
|
|
|
|
cvar_t *cl_cshift_bonus;
|
|
|
|
|
cvar_t *cl_cshift_contents;
|
|
|
|
|
cvar_t *cl_cshift_damage;
|
|
|
|
|
cvar_t *cl_cshift_powerup;
|
2000-12-13 09:01:11 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cvar_t *lookspring;
|
|
|
|
|
cvar_t *lookstrafe;
|
|
|
|
|
cvar_t *sensitivity;
|
|
|
|
|
cvar_t *cl_freelook;
|
2000-05-16 04:47:41 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cvar_t *m_pitch;
|
|
|
|
|
cvar_t *m_yaw;
|
|
|
|
|
cvar_t *m_forward;
|
|
|
|
|
cvar_t *m_side;
|
2000-05-16 04:47:41 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cvar_t *cl_predict_players;
|
|
|
|
|
cvar_t *cl_predict_players2;
|
|
|
|
|
cvar_t *cl_solid_players;
|
2000-05-16 04:47:41 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cvar_t *localid;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
static qboolean allowremotecmd = true;
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// info mirrors
|
|
|
|
|
//
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cvar_t *password;
|
|
|
|
|
cvar_t *spectator;
|
|
|
|
|
cvar_t *name;
|
|
|
|
|
cvar_t *team;
|
|
|
|
|
cvar_t *rate;
|
|
|
|
|
cvar_t *noaim;
|
|
|
|
|
cvar_t *msg;
|
2000-05-16 04:47:41 +00:00
|
|
|
|
|
|
|
|
|
extern cvar_t *cl_hightrack;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
client_static_t cls;
|
|
|
|
|
client_state_t cl;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
entity_state_t cl_baselines[MAX_EDICTS];
|
|
|
|
|
efrag_t cl_efrags[MAX_EFRAGS];
|
|
|
|
|
entity_t cl_static_entities[MAX_STATIC_ENTITIES];
|
|
|
|
|
lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
|
|
|
|
|
dlight_t cl_dlights[MAX_DLIGHTS];
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
// refresh list
|
|
|
|
|
// this is double buffered so the last frame
|
|
|
|
|
// can be scanned for oldorigins of trailing objects
|
2001-02-08 17:43:14 +00:00
|
|
|
|
int cl_numvisedicts;
|
|
|
|
|
entity_t *cl_visedicts[MAX_VISEDICTS];
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
double connect_time = -1; // for connection retransmits
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-11-29 23:26:45 +00:00
|
|
|
|
quakeparms_t host_parms;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
qboolean host_initialized; // true if into command execution
|
|
|
|
|
qboolean nomaster;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
double host_frametime;
|
|
|
|
|
double realtime; // without any filtering or bounding
|
|
|
|
|
double oldrealtime; // last frame run
|
|
|
|
|
int host_framecount;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
int host_hunklevel;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
byte *host_basepal;
|
|
|
|
|
byte *host_colormap;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cvar_t *host_speeds; // set for running times
|
|
|
|
|
cvar_t *show_fps; // set for running times
|
|
|
|
|
cvar_t *show_time;
|
|
|
|
|
cvar_t *developer;
|
2001-02-07 20:15:33 +00:00
|
|
|
|
cvar_t *cl_demospeed;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
int fps_count;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
jmp_buf host_abort;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void Master_Connect_f (void);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
char *server_version = NULL; // version of server we connected to
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
char emodel_name[] = "emodel";
|
|
|
|
|
char pmodel_name[] = "pmodel";
|
|
|
|
|
char prespawn_name[] = "prespawn %i 0 %i";
|
|
|
|
|
char modellist_name[] = "modellist %i %i";
|
|
|
|
|
char soundlist_name[] = "soundlist %i %i";
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cvar_t *confirm_quit;
|
2000-10-29 20:49:50 +00:00
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_Quit_f
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_Quit_f (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-29 03:14:53 +00:00
|
|
|
|
if (confirm_quit->int_val) {
|
|
|
|
|
M_Menu_Quit_f ();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2000-05-10 11:29:38 +00:00
|
|
|
|
CL_Disconnect ();
|
|
|
|
|
Sys_Quit ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_Version_f
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_Version_f (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-05-17 18:28:13 +00:00
|
|
|
|
Con_Printf ("%s Version %s\n", PROGRAM, VERSION);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Con_Printf ("Binary: " __TIME__ " " __DATE__ "\n");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_SendConnectPacket
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
called by CL_Connect_f and CL_CheckResend
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_SendConnectPacket (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
netadr_t adr;
|
|
|
|
|
char data[2048];
|
|
|
|
|
double t1, t2;
|
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
// JACK: Fixed bug where DNS lookups would cause two connects real fast
|
|
|
|
|
// Now, adds lookup time to the connect time.
|
2000-12-08 06:51:37 +00:00
|
|
|
|
// Should I add it to realtime instead?!?!
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
if (cls.state != ca_disconnected)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
t1 = Sys_DoubleTime ();
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (!NET_StringToAdr (cls.servername, &adr)) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("Bad server address\n");
|
|
|
|
|
connect_time = -1;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (!NET_IsClientLegal (&adr)) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("Illegal server address\n");
|
|
|
|
|
connect_time = -1;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (adr.port == 0)
|
|
|
|
|
adr.port = BigShort (27500);
|
|
|
|
|
t2 = Sys_DoubleTime ();
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
connect_time = realtime + t2 - t1; // for retransmit requests
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cls.qport = Cvar_VariableValue ("qport");
|
2000-05-10 20:33:16 +00:00
|
|
|
|
|
2000-05-14 09:57:28 +00:00
|
|
|
|
// Arrgh, this was not in the old binary only release, and eats up
|
|
|
|
|
// far too much of the 196 chars in the userinfo space, leaving nothing
|
|
|
|
|
// for player use, thus, its commented out for the moment..
|
2000-12-08 06:51:37 +00:00
|
|
|
|
//
|
|
|
|
|
// Info_SetValueForStarKey (cls.userinfo, "*ip", NET_AdrToString(adr),
|
|
|
|
|
// MAX_INFO_STRING);
|
|
|
|
|
|
|
|
|
|
// Con_Printf ("Connecting to %s...\n", cls.servername);
|
|
|
|
|
snprintf (data, sizeof (data), "%c%c%c%cconnect %i %i %i \"%s\"\n",
|
|
|
|
|
255, 255, 255, 255, PROTOCOL_VERSION, cls.qport, cls.challenge,
|
|
|
|
|
cls.userinfo);
|
|
|
|
|
NET_SendPacket (strlen (data), data, adr);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_CheckForResend
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Resend a connect message if the last one has timed out
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_CheckForResend (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
netadr_t adr;
|
|
|
|
|
char data[2048];
|
|
|
|
|
double t1, t2;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
if (connect_time == -1)
|
|
|
|
|
return;
|
|
|
|
|
if (cls.state != ca_disconnected)
|
|
|
|
|
return;
|
|
|
|
|
if (connect_time && realtime - connect_time < 5.0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
t1 = Sys_DoubleTime ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (!NET_StringToAdr (cls.servername, &adr)) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("Bad server address\n");
|
|
|
|
|
connect_time = -1;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (!NET_IsClientLegal (&adr)) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("Illegal server address\n");
|
|
|
|
|
connect_time = -1;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (adr.port == 0)
|
|
|
|
|
adr.port = BigShort (27500);
|
|
|
|
|
t2 = Sys_DoubleTime ();
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
connect_time = realtime + t2 - t1; // for retransmit requests
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-10-14 07:10:56 +00:00
|
|
|
|
VID_SetCaption (va ("Connecting to %s", cls.servername));
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("Connecting to %s...\n", cls.servername);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
snprintf (data, sizeof (data), "%c%c%c%cgetchallenge\n", 255, 255, 255,
|
|
|
|
|
255);
|
|
|
|
|
NET_SendPacket (strlen (data), data, adr);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_BeginServerConnect (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
connect_time = 0;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
CL_CheckForResend ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_Connect_f
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_Connect_f (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
char *server;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (Cmd_Argc () != 2) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("usage: connect <server>\n");
|
2000-12-08 06:51:37 +00:00
|
|
|
|
return;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
server = Cmd_Argv (1);
|
|
|
|
|
|
|
|
|
|
CL_Disconnect ();
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
strncpy (cls.servername, server, sizeof (cls.servername) - 1);
|
|
|
|
|
CL_BeginServerConnect ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_Rcon_f
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Send the rest of the command line over as
|
|
|
|
|
an unconnected command.
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_Rcon_f (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
char message[1024];
|
|
|
|
|
int i;
|
|
|
|
|
netadr_t to;
|
|
|
|
|
int len;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-10-16 03:18:37 +00:00
|
|
|
|
snprintf (message, sizeof (message), "\377\377\377\377rcon %s ",
|
|
|
|
|
rcon_password->string);
|
|
|
|
|
len = strlen (message);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
for (i = 1; i < Cmd_Argc (); i++) {
|
|
|
|
|
strncat (message, Cmd_Argv (i), sizeof (message) - len - 1);
|
|
|
|
|
len += strlen (Cmd_Argv (i));
|
2000-10-16 03:18:37 +00:00
|
|
|
|
strncat (message, " ", sizeof (message) - len - 1);
|
|
|
|
|
len += strlen (" ");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cls.state >= ca_connected)
|
|
|
|
|
to = cls.netchan.remote_address;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
else {
|
|
|
|
|
if (!strlen (rcon_address->string)) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("You must either be connected,\n"
|
|
|
|
|
"or set the 'rcon_address' cvar\n"
|
|
|
|
|
"to issue rcon commands\n");
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
2000-05-16 04:47:41 +00:00
|
|
|
|
NET_StringToAdr (rcon_address->string, &to);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
|
|
NET_SendPacket (strlen (message) + 1, message, to);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_ClearState
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_ClearState (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
int i;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
S_StopAllSounds (true);
|
|
|
|
|
|
|
|
|
|
Con_DPrintf ("Clearing memory\n");
|
|
|
|
|
D_FlushCaches ();
|
|
|
|
|
Mod_ClearAll ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (host_hunklevel) // FIXME: check this...
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Hunk_FreeToLowMark (host_hunklevel);
|
|
|
|
|
|
2000-12-20 06:18:55 +00:00
|
|
|
|
CL_ClearEnts ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
CL_ClearTEnts ();
|
|
|
|
|
|
|
|
|
|
// wipe the entire cl structure
|
2000-12-08 06:51:37 +00:00
|
|
|
|
memset (&cl, 0, sizeof (cl));
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
SZ_Clear (&cls.netchan.message);
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
// clear other arrays
|
|
|
|
|
memset (cl_efrags, 0, sizeof (cl_efrags));
|
|
|
|
|
memset (cl_dlights, 0, sizeof (cl_dlights));
|
|
|
|
|
memset (cl_lightstyle, 0, sizeof (cl_lightstyle));
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// allocate the efrags and chain together into a free list
|
|
|
|
|
//
|
|
|
|
|
cl.free_efrags = cl_efrags;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
for (i = 0; i < MAX_EFRAGS - 1; i++)
|
|
|
|
|
cl.free_efrags[i].entnext = &cl.free_efrags[i + 1];
|
2000-05-10 11:29:38 +00:00
|
|
|
|
cl.free_efrags[i].entnext = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-20 13:29:55 +00:00
|
|
|
|
/*
|
|
|
|
|
CL_StopCshifts
|
|
|
|
|
|
|
|
|
|
Cleans the Cshifts, so your screen doesn't stay red after a timedemo :)
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
CL_StopCshifts (void)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < NUM_CSHIFTS; i++)
|
|
|
|
|
cl.cshifts[i].percent = 0;
|
|
|
|
|
for (i = 0; i < MAX_CL_STATS; i++)
|
|
|
|
|
cl.stats[i] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_Disconnect
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Sends a disconnect message to the server
|
|
|
|
|
This is also called on Host_Error, so it shouldn't cause any errors
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_Disconnect (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
byte final[10];
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
connect_time = -1;
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
VID_SetCaption ("Disconnected");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
// stop sounds (especially looping!)
|
|
|
|
|
S_StopAllSounds (true);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
2001-04-20 13:29:55 +00:00
|
|
|
|
// Clean the Cshifts
|
|
|
|
|
CL_StopCshifts ();
|
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
// if running a local server, shut it down
|
|
|
|
|
if (cls.demoplayback)
|
|
|
|
|
CL_StopPlayback ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
else if (cls.state != ca_disconnected) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
if (cls.demorecording)
|
|
|
|
|
CL_Stop_f ();
|
|
|
|
|
|
|
|
|
|
final[0] = clc_stringcmd;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
strcpy (final + 1, "drop");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Netchan_Transmit (&cls.netchan, 6, final);
|
|
|
|
|
Netchan_Transmit (&cls.netchan, 6, final);
|
|
|
|
|
Netchan_Transmit (&cls.netchan, 6, final);
|
|
|
|
|
|
|
|
|
|
cls.state = ca_disconnected;
|
|
|
|
|
|
|
|
|
|
cls.demoplayback = cls.demorecording = cls.timedemo = false;
|
2000-10-03 22:39:51 +00:00
|
|
|
|
|
2000-10-04 16:22:51 +00:00
|
|
|
|
CL_RemoveQFInfoKeys ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Cam_Reset ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
if (cls.download) {
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Qclose (cls.download);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
cls.download = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
CL_StopUpload ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_Disconnect_f (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
CL_Disconnect ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_User_f
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
user <name or userid>
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Dump userdata / masterdata for a user
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_User_f (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
int uid;
|
|
|
|
|
int i;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (Cmd_Argc () != 2) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("Usage: user <username / userid>\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
uid = atoi (Cmd_Argv (1));
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
for (i = 0; i < MAX_CLIENTS; i++) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
if (!cl.players[i].name[0])
|
|
|
|
|
continue;
|
|
|
|
|
if (cl.players[i].userid == uid
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|| !strcmp (cl.players[i].name, Cmd_Argv (1))) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Info_Print (cl.players[i].userinfo);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Con_Printf ("User not in server.\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_Users_f
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Dump userids for all current players
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_Users_f (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
int i;
|
|
|
|
|
int c;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
c = 0;
|
|
|
|
|
Con_Printf ("userid frags name\n");
|
|
|
|
|
Con_Printf ("------ ----- ----\n");
|
2000-12-08 06:51:37 +00:00
|
|
|
|
for (i = 0; i < MAX_CLIENTS; i++) {
|
|
|
|
|
if (cl.players[i].name[0]) {
|
|
|
|
|
Con_Printf ("%6i %4i %s\n", cl.players[i].userid,
|
|
|
|
|
cl.players[i].frags, cl.players[i].name);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Con_Printf ("%i total users\n", c);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_FullServerinfo_f
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Sent by server when serverinfo changes
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_FullServerinfo_f (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
char *p;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (Cmd_Argc () != 2) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("usage: fullserverinfo <complete info string>\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Con_DPrintf ("Cmd_Argv(1): '%s'\n", Cmd_Argv (1));
|
|
|
|
|
strcpy (cl.serverinfo, Cmd_Argv (1));
|
|
|
|
|
Con_DPrintf ("cl.serverinfo: '%s'\n", cl.serverinfo);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if ((p = Info_ValueForKey (cl.serverinfo, "*qf_version")) && *p) {
|
2000-05-16 04:59:51 +00:00
|
|
|
|
if (server_version == NULL)
|
2001-03-09 04:50:14 +00:00
|
|
|
|
Con_Printf ("QuakeForge v%s server\n", p);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
server_version = strdup (p);
|
|
|
|
|
} else if ((p = Info_ValueForKey (cl.serverinfo, "*version")) && *p) {
|
2000-05-16 04:59:51 +00:00
|
|
|
|
if (server_version == NULL)
|
2001-03-09 04:50:14 +00:00
|
|
|
|
Con_Printf ("QuakeWorld v%s server\n", p);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
server_version = strdup (p);
|
2000-05-16 04:59:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if ((p = Info_ValueForKey (cl.serverinfo, "*qsg_version")) && *p) {
|
2001-03-09 04:50:14 +00:00
|
|
|
|
if ((cl.stdver = atof (p)))
|
|
|
|
|
Con_Printf ("Server supports QSG v%s protocol\n", p);
|
2000-05-16 04:59:51 +00:00
|
|
|
|
else
|
2001-03-09 04:50:14 +00:00
|
|
|
|
Con_Printf ("Invalid QSG Protocol number: %s\n", p);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if ((p = Info_ValueForKey (cl.serverinfo, "skybox")) && *p) {
|
2001-05-23 08:08:49 +00:00
|
|
|
|
if (strcaseequal (p, "none")) {
|
2000-05-19 03:06:05 +00:00
|
|
|
|
allowskybox = false;
|
|
|
|
|
} else {
|
|
|
|
|
allowskybox = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
allowskybox = false;
|
|
|
|
|
}
|
2000-10-04 16:22:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
CL_AddQFInfoKeys
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void
|
2000-12-28 09:27:30 +00:00
|
|
|
|
CL_AddQFInfoKeys (void)
|
2000-10-04 16:22:51 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
char cap[100] = ""; // max of 98 or so flags
|
|
|
|
|
|
2000-10-04 16:22:51 +00:00
|
|
|
|
// set the capabilities info. single char flags (possibly with
|
|
|
|
|
// modifiefs)
|
2000-10-16 20:41:06 +00:00
|
|
|
|
// defined capabilities (* = not implemented):
|
2000-12-08 06:51:37 +00:00
|
|
|
|
// z client can accept gzipped files.
|
|
|
|
|
// h * http transfers
|
|
|
|
|
// f * ftp transfers
|
|
|
|
|
// a * audio channel (voice chat)
|
|
|
|
|
// i * irc
|
|
|
|
|
// p pogo stick control
|
|
|
|
|
// t team messages
|
2000-10-16 20:41:06 +00:00
|
|
|
|
strncpy (cap, "pt", sizeof (cap));
|
2000-10-03 22:39:51 +00:00
|
|
|
|
#ifdef HAVE_ZLIB
|
2000-10-16 20:41:06 +00:00
|
|
|
|
strncat (cap, "z", sizeof (cap) - strlen (cap) - 1);
|
2000-10-03 22:39:51 +00:00
|
|
|
|
#endif
|
2001-08-12 03:45:37 +00:00
|
|
|
|
Info_SetValueForStarKey (cls.userinfo, "*cap", cap, MAX_INFO_STRING, 0);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Info_SetValueForStarKey (cls.userinfo, "*qf_version", VERSION,
|
2001-08-12 03:45:37 +00:00
|
|
|
|
MAX_INFO_STRING, 0);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Info_SetValueForStarKey (cls.userinfo, "*qsg_version", QSG_VERSION,
|
2001-08-12 03:45:37 +00:00
|
|
|
|
MAX_INFO_STRING, 0);
|
2000-10-04 16:22:51 +00:00
|
|
|
|
Con_Printf ("QuakeForge server detected\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
CL_RemoveQFInfoKeys
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
void
|
2000-12-28 09:27:30 +00:00
|
|
|
|
CL_RemoveQFInfoKeys (void)
|
2000-10-04 16:22:51 +00:00
|
|
|
|
{
|
|
|
|
|
Info_RemoveKey (cls.userinfo, "*cap");
|
2000-11-25 14:22:09 +00:00
|
|
|
|
Info_RemoveKey (cls.userinfo, "*qf_version");
|
2000-10-04 16:22:51 +00:00
|
|
|
|
Info_RemoveKey (cls.userinfo, "*qsg_version");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_FullInfo_f
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Allow clients to change userinfo
|
|
|
|
|
Casey was here :)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_FullInfo_f (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
char key[512];
|
|
|
|
|
char value[512];
|
|
|
|
|
char *o;
|
|
|
|
|
char *s;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (Cmd_Argc () != 2) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("fullinfo <complete info string>\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
s = Cmd_Argv (1);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
if (*s == '\\')
|
|
|
|
|
s++;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
while (*s) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
o = key;
|
|
|
|
|
while (*s && *s != '\\')
|
|
|
|
|
*o++ = *s++;
|
|
|
|
|
*o = 0;
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (!*s) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("MISSING VALUE\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
o = value;
|
|
|
|
|
s++;
|
|
|
|
|
while (*s && *s != '\\')
|
|
|
|
|
*o++ = *s++;
|
|
|
|
|
*o = 0;
|
|
|
|
|
|
|
|
|
|
if (*s)
|
|
|
|
|
s++;
|
|
|
|
|
|
2001-05-23 08:08:49 +00:00
|
|
|
|
if (strcaseequal (key, pmodel_name) || strcaseequal (key, emodel_name))
|
2000-05-10 11:29:38 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
2001-08-12 03:45:37 +00:00
|
|
|
|
Info_SetValueForKey (cls.userinfo, key, value, MAX_INFO_STRING,
|
|
|
|
|
(!strequal (key, "name"))
|
|
|
|
|
| (strequal (key, "team") << 1));
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_SetInfo_f
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Allow clients to change userinfo
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_SetInfo_f (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (Cmd_Argc () == 1) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Info_Print (cls.userinfo);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (Cmd_Argc () != 3) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("usage: setinfo [ <key> <value> ]\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-05-23 08:08:49 +00:00
|
|
|
|
if (strcaseequal (Cmd_Argv (1), pmodel_name)
|
|
|
|
|
|| strcaseequal (Cmd_Argv (1), emodel_name))
|
|
|
|
|
return;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Info_SetValueForKey (cls.userinfo, Cmd_Argv (1), Cmd_Argv (2),
|
2001-08-12 03:45:37 +00:00
|
|
|
|
MAX_INFO_STRING, (!strequal (Cmd_Argv (1), "name"))
|
|
|
|
|
| (strequal (Cmd_Argv (2), "team") << 1));
|
2000-05-10 11:29:38 +00:00
|
|
|
|
if (cls.state >= ca_connected)
|
|
|
|
|
Cmd_ForwardToServer ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_Packet_f
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
packet <destination> <contents>
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Contents allows \n escape character
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_Packet_f (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
char send[2048];
|
|
|
|
|
int i, l;
|
|
|
|
|
char *in, *out;
|
|
|
|
|
netadr_t adr;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (Cmd_Argc () != 3) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("packet <destination> <contents>\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (!NET_StringToAdr (Cmd_Argv (1), &adr)) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("Bad address\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
in = Cmd_Argv (2);
|
|
|
|
|
out = send + 4;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
send[0] = send[1] = send[2] = send[3] = 0xff;
|
|
|
|
|
|
|
|
|
|
l = strlen (in);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
for (i = 0; i < l; i++) {
|
|
|
|
|
if (in[i] == '\\' && in[i + 1] == 'n') {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*out++ = '\n';
|
|
|
|
|
i++;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
} else
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*out++ = in[i];
|
|
|
|
|
}
|
|
|
|
|
*out = 0;
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
NET_SendPacket (out - send, send, adr);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_NextDemo
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Called to play the next demo in the demo loop
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_NextDemo (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
char str[1024];
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
if (cls.demonum == -1)
|
2000-12-08 06:51:37 +00:00
|
|
|
|
return; // don't play demos
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (!cls.demos[cls.demonum][0] || cls.demonum == MAX_DEMOS) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
cls.demonum = 0;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (!cls.demos[cls.demonum][0]) {
|
|
|
|
|
// Con_Printf ("No demos listed with startdemos\n");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
cls.demonum = -1;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
snprintf (str, sizeof (str), "playdemo %s\n", cls.demos[cls.demonum]);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Cbuf_InsertText (str);
|
|
|
|
|
cls.demonum++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_Changing_f
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Just sent as a hint to the client that they should
|
|
|
|
|
drop to full console
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_Changing_f (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (cls.download) // don't change when downloading
|
2000-05-10 11:29:38 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
S_StopAllSounds (true);
|
|
|
|
|
cl.intermission = 0;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cls.state = ca_connected; // not active anymore, but not
|
|
|
|
|
// disconnected
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("\nChanging map...\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_Reconnect_f
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
The server is changing levels
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_Reconnect_f (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (cls.download) // don't change when downloading
|
2000-05-10 11:29:38 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
S_StopAllSounds (true);
|
|
|
|
|
|
|
|
|
|
if (cls.state == ca_connected) {
|
|
|
|
|
Con_Printf ("reconnecting...\n");
|
2000-10-14 07:10:56 +00:00
|
|
|
|
VID_SetCaption ("Reconnecting");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
MSG_WriteChar (&cls.netchan.message, clc_stringcmd);
|
|
|
|
|
MSG_WriteString (&cls.netchan.message, "new");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!*cls.servername) {
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Con_Printf ("No server to reconnect to...\n");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
CL_Disconnect ();
|
|
|
|
|
CL_BeginServerConnect ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_ConnectionlessPacket
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Responses to broadcasts, etc
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_ConnectionlessPacket (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
char *s;
|
|
|
|
|
int c;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
MSG_BeginReading ();
|
|
|
|
|
MSG_ReadLong (); // skip the -1
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
c = MSG_ReadByte ();
|
|
|
|
|
if (!cls.demoplayback)
|
|
|
|
|
Con_Printf ("%s: ", NET_AdrToString (net_from));
|
2000-12-08 06:51:37 +00:00
|
|
|
|
// Con_DPrintf ("%s", net_message.data + 5);
|
|
|
|
|
if (c == S2C_CONNECTION) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("connection\n");
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (cls.state >= ca_connected) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
if (!cls.demoplayback)
|
|
|
|
|
Con_Printf ("Dup connect received. Ignored.\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Netchan_Setup (&cls.netchan, net_from, cls.qport);
|
|
|
|
|
MSG_WriteChar (&cls.netchan.message, clc_stringcmd);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
MSG_WriteString (&cls.netchan.message, "new");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
cls.state = ca_connected;
|
|
|
|
|
Con_Printf ("Connected.\n");
|
2000-12-08 06:51:37 +00:00
|
|
|
|
allowremotecmd = false; // localid required now for remote
|
|
|
|
|
// cmds
|
2000-05-10 11:29:38 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// remote command from gui front end
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (c == A2C_CLIENT_COMMAND) {
|
|
|
|
|
char cmdtext[2048];
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
Con_Printf ("client command\n");
|
|
|
|
|
|
2001-02-14 22:25:22 +00:00
|
|
|
|
if (!cl_allow_cmd_pkt->int_val
|
2001-02-14 22:26:57 +00:00
|
|
|
|
|| ((*(unsigned int *) net_from.ip != *(unsigned int *) net_local_adr.ip
|
|
|
|
|
&& *(unsigned int *) net_from.ip != htonl (INADDR_LOOPBACK)))) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("Command packet from remote host. Ignored.\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
s = MSG_ReadString ();
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
strncpy (cmdtext, s, sizeof (cmdtext) - 1);
|
|
|
|
|
cmdtext[sizeof (cmdtext) - 1] = 0;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
s = MSG_ReadString ();
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
while (*s && isspace ((int) *s))
|
2000-05-10 11:29:38 +00:00
|
|
|
|
s++;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
while (*s && isspace ((int) (s[strlen (s) - 1])))
|
|
|
|
|
s[strlen (s) - 1] = 0;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (!allowremotecmd
|
|
|
|
|
&& (!*localid->string || strcmp (localid->string, s))) {
|
2000-05-16 04:47:41 +00:00
|
|
|
|
if (!*localid->string) {
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Con_Printf ("===========================\n");
|
|
|
|
|
Con_Printf ("Command packet received from local host, but no "
|
|
|
|
|
"localid has been set. You may need to upgrade your server "
|
|
|
|
|
"browser.\n");
|
|
|
|
|
Con_Printf ("===========================\n");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Con_Printf ("===========================\n");
|
|
|
|
|
Con_Printf
|
|
|
|
|
("Invalid localid on command packet received from local host. "
|
|
|
|
|
"\n|%s| != |%s|\n"
|
|
|
|
|
"You may need to reload your server browser and %s.\n", s,
|
|
|
|
|
localid->string, PROGRAM);
|
|
|
|
|
Con_Printf ("===========================\n");
|
|
|
|
|
Cvar_Set (localid, "");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-14 21:50:55 +00:00
|
|
|
|
Con_Printf ("%s\n", cmdtext);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Cbuf_AddText (cmdtext);
|
|
|
|
|
allowremotecmd = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// print command from somewhere
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (c == A2C_PRINT) {
|
2000-12-29 03:14:53 +00:00
|
|
|
|
netadr_t addy;
|
|
|
|
|
server_entry_t *temp;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
s = MSG_ReadString ();
|
2000-12-29 03:14:53 +00:00
|
|
|
|
for (temp = slist; temp; temp = temp->next)
|
|
|
|
|
if (temp->waitstatus)
|
|
|
|
|
{
|
|
|
|
|
NET_StringToAdr (temp->server, &addy);
|
|
|
|
|
if (NET_CompareBaseAdr (net_from, addy))
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
temp->status = realloc(temp->status, strlen(s) + 1);
|
|
|
|
|
strcpy(temp->status, s);
|
|
|
|
|
temp->waitstatus = 0;
|
|
|
|
|
for (i = 0; i < strlen(temp->status); i++)
|
|
|
|
|
if (temp->status[i] == '\n')
|
|
|
|
|
{
|
|
|
|
|
temp->status[i] = '\\';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Con_Printf("status response\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-12-25 02:36:36 +00:00
|
|
|
|
Con_Printf ("print\n");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Print (s);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// ping from somewhere
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (c == A2A_PING) {
|
|
|
|
|
char data[6];
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
Con_Printf ("ping\n");
|
|
|
|
|
|
|
|
|
|
data[0] = 0xff;
|
|
|
|
|
data[1] = 0xff;
|
|
|
|
|
data[2] = 0xff;
|
|
|
|
|
data[3] = 0xff;
|
|
|
|
|
data[4] = A2A_ACK;
|
|
|
|
|
data[5] = 0;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
NET_SendPacket (6, &data, net_from);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (c == S2C_CHALLENGE) {
|
|
|
|
|
Con_Printf ("challenge\n");
|
|
|
|
|
|
|
|
|
|
s = MSG_ReadString ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
cls.challenge = atoi (s);
|
2000-10-04 16:22:51 +00:00
|
|
|
|
if (strstr (s, "QF"))
|
|
|
|
|
CL_AddQFInfoKeys ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
CL_SendConnectPacket ();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (c == svc_disconnect) {
|
2000-08-04 09:47:53 +00:00
|
|
|
|
if (cls.demoplayback)
|
|
|
|
|
Host_EndGame ("End of demo");
|
|
|
|
|
else
|
|
|
|
|
Con_Printf ("svc_disconnect\n");
|
2000-12-08 06:51:37 +00:00
|
|
|
|
// Host_EndGame ("Server disconnected");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Con_Printf ("unknown: %c\n", c);
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-29 03:14:53 +00:00
|
|
|
|
void
|
|
|
|
|
CL_PingPacket (void)
|
|
|
|
|
{
|
|
|
|
|
server_entry_t *temp;
|
|
|
|
|
netadr_t addy;
|
|
|
|
|
MSG_ReadByte ();;
|
|
|
|
|
for (temp = slist; temp; temp = temp->next)
|
|
|
|
|
if (temp->pingsent && !temp->pongback) {
|
|
|
|
|
NET_StringToAdr (temp->server, &addy);
|
|
|
|
|
if (NET_CompareBaseAdr (net_from, addy)) {
|
|
|
|
|
temp->pongback = Sys_DoubleTime ();
|
|
|
|
|
timepassed(temp->pingsent, &temp->pongback);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_ReadPackets
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_ReadPackets (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
// while (NET_GetPacket ())
|
|
|
|
|
while (CL_GetMessage ()) {
|
2001-01-15 14:12:19 +00:00
|
|
|
|
|
|
|
|
|
#ifdef PACKET_LOGGING
|
|
|
|
|
if (cls.demoplayback) Log_Incoming_Packet(net_message.data,net_message.cursize);
|
|
|
|
|
#endif
|
2000-12-08 06:51:37 +00:00
|
|
|
|
//
|
2000-05-10 11:29:38 +00:00
|
|
|
|
// remote command packet
|
2000-12-25 02:36:36 +00:00
|
|
|
|
//
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (*(int *) net_message.data == -1) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
CL_ConnectionlessPacket ();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2000-12-29 03:14:53 +00:00
|
|
|
|
if (*(char *) net_message.data == A2A_ACK)
|
|
|
|
|
{
|
|
|
|
|
CL_PingPacket ();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (net_message.cursize < 8) {
|
|
|
|
|
Con_Printf ("%s: Runt packet\n", NET_AdrToString (net_from));
|
2000-05-10 11:29:38 +00:00
|
|
|
|
continue;
|
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
|
//
|
2000-05-10 11:29:38 +00:00
|
|
|
|
// packet from server
|
2000-12-08 06:51:37 +00:00
|
|
|
|
//
|
|
|
|
|
if (!cls.demoplayback &&
|
|
|
|
|
!NET_CompareAdr (net_from, cls.netchan.remote_address)) {
|
|
|
|
|
Con_DPrintf ("%s:sequenced packet without connection\n",
|
|
|
|
|
NET_AdrToString (net_from));
|
2000-05-10 11:29:38 +00:00
|
|
|
|
continue;
|
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (!Netchan_Process (&cls.netchan))
|
|
|
|
|
continue; // wasn't accepted for some reason
|
2000-05-10 11:29:38 +00:00
|
|
|
|
CL_ParseServerMessage ();
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
// if (cls.demoplayback && cls.state >= ca_active && !CL_DemoBehind())
|
|
|
|
|
// return;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
//
|
2000-05-10 11:29:38 +00:00
|
|
|
|
// check timeout
|
2000-12-08 06:51:37 +00:00
|
|
|
|
//
|
2000-05-10 11:29:38 +00:00
|
|
|
|
if (cls.state >= ca_connected
|
2000-12-08 06:51:37 +00:00
|
|
|
|
&& realtime - cls.netchan.last_received > cl_timeout->value) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("\nServer connection timed out.\n");
|
|
|
|
|
CL_Disconnect ();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_Download_f
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_Download_f (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (cls.state == ca_disconnected) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("Must be connected.\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (Cmd_Argc () != 2) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("Usage: download <datafile>\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
snprintf (cls.downloadname, sizeof (cls.downloadname), "%s/%s", com_gamedir,
|
|
|
|
|
Cmd_Argv (1));
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-11-08 06:07:03 +00:00
|
|
|
|
COM_CreatePath (cls.downloadname);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
strncpy (cls.downloadtempname, cls.downloadname,
|
|
|
|
|
sizeof (cls.downloadtempname));
|
2000-09-27 19:44:26 +00:00
|
|
|
|
cls.download = Qopen (cls.downloadname, "wb");
|
2001-01-22 22:48:22 +00:00
|
|
|
|
if (cls.download) {
|
|
|
|
|
cls.downloadtype = dl_single;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-01-22 22:48:22 +00:00
|
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
|
|
|
|
SZ_Print (&cls.netchan.message, va ("download %s\n", Cmd_Argv (1)));
|
|
|
|
|
} else {
|
|
|
|
|
Con_Printf ("error downloading %s: %s\n", Cmd_Argv (1),
|
|
|
|
|
strerror (errno));
|
|
|
|
|
}
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
CL_Init
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_Init (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
QFile *servlist;
|
|
|
|
|
char st[80];
|
|
|
|
|
char e_path[MAX_OSPATH];
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
cls.state = ca_disconnected;
|
|
|
|
|
|
2001-08-12 03:45:37 +00:00
|
|
|
|
Info_SetValueForKey (cls.userinfo, "name", "unnamed", MAX_INFO_STRING, 0);
|
|
|
|
|
Info_SetValueForKey (cls.userinfo, "topcolor", "0", MAX_INFO_STRING, 0);
|
|
|
|
|
Info_SetValueForKey (cls.userinfo, "bottomcolor", "0", MAX_INFO_STRING, 0);
|
|
|
|
|
Info_SetValueForKey (cls.userinfo, "rate", "2500", MAX_INFO_STRING, 0);
|
|
|
|
|
Info_SetValueForKey (cls.userinfo, "msg", "1", MAX_INFO_STRING, 0);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
// snprintf (st, sizeof(st), "%s-%04d", QW_VERSION, build_number());
|
|
|
|
|
snprintf (st, sizeof (st), "%s", QW_VERSION);
|
2001-08-12 03:45:37 +00:00
|
|
|
|
Info_SetValueForStarKey (cls.userinfo, "*ver", st, MAX_INFO_STRING, 0);
|
2001-01-15 14:12:19 +00:00
|
|
|
|
#ifdef PACKET_LOGGING
|
|
|
|
|
Net_Log_Init();
|
|
|
|
|
#endif
|
2000-10-29 15:35:24 +00:00
|
|
|
|
CL_Input_Init ();
|
2001-01-08 07:31:59 +00:00
|
|
|
|
CL_Ents_Init ();
|
2000-10-31 05:48:32 +00:00
|
|
|
|
CL_TEnts_Init ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Pmove_Init ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
|
|
Qexpand_squiggle (fs_userpath->string, e_path);
|
|
|
|
|
if ((servlist = Qopen (va ("%s/servers.txt", e_path), "r"))) {
|
|
|
|
|
slist = SL_LoadF (servlist, slist);
|
|
|
|
|
Qclose (servlist);
|
2000-05-19 04:33:12 +00:00
|
|
|
|
}
|
2000-05-19 10:48:21 +00:00
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
//
|
|
|
|
|
// register our commands
|
|
|
|
|
//
|
2000-05-19 10:48:21 +00:00
|
|
|
|
|
2001-02-06 02:56:14 +00:00
|
|
|
|
Cmd_AddCommand ("version", CL_Version_f, "Report version information");
|
2000-05-19 10:48:21 +00:00
|
|
|
|
|
2001-02-06 02:56:14 +00:00
|
|
|
|
Cmd_AddCommand ("changing", CL_Changing_f, "Used when maps are changing");
|
|
|
|
|
Cmd_AddCommand ("disconnect", CL_Disconnect_f, "Disconnect from server");
|
|
|
|
|
Cmd_AddCommand ("record", CL_Record_f, "Record a demo 'record filename server'");
|
|
|
|
|
Cmd_AddCommand ("rerecord", CL_ReRecord_f, "Rerecord a demo on the same server");
|
|
|
|
|
Cmd_AddCommand ("stop", CL_Stop_f, "Stop recording a demo");
|
|
|
|
|
Cmd_AddCommand ("playdemo", CL_PlayDemo_f, "Play a recorded demo");
|
|
|
|
|
Cmd_AddCommand ("timedemo", CL_TimeDemo_f, "Play a demo as fast as your hardware can. Useful for benchmarking.");
|
2000-05-19 10:48:21 +00:00
|
|
|
|
|
2001-02-06 02:56:14 +00:00
|
|
|
|
Cmd_AddCommand ("maplist", COM_Maplist_f, "List maps available");
|
2000-05-31 14:16:08 +00:00
|
|
|
|
|
2001-02-06 02:56:14 +00:00
|
|
|
|
Cmd_AddCommand ("quit", CL_Quit_f, "Exit the program");
|
2000-05-19 10:48:21 +00:00
|
|
|
|
|
2001-02-06 02:56:14 +00:00
|
|
|
|
Cmd_AddCommand ("connect", CL_Connect_f, "Connect to a server 'connect hostname:port'");
|
|
|
|
|
Cmd_AddCommand ("reconnect", CL_Reconnect_f, "Reconnect to the last server");
|
2000-05-19 10:48:21 +00:00
|
|
|
|
|
2001-02-06 02:56:14 +00:00
|
|
|
|
Cmd_AddCommand ("rcon", CL_Rcon_f, "Issue the set of commands to the server you are currently connected to or have set in rcon_address");
|
|
|
|
|
Cmd_AddCommand ("packet", CL_Packet_f, "Send a packet with specified contents to the destination");
|
|
|
|
|
Cmd_AddCommand ("user", CL_User_f, "Queries the user for his setinfo information");
|
|
|
|
|
Cmd_AddCommand ("users", CL_Users_f, "Report information on connected players and retrieve user ids");
|
|
|
|
|
Cmd_AddCommand ("setinfo", CL_SetInfo_f, "Sets information about your QuakeWorld user.\n"
|
|
|
|
|
"Used without a key it will list all of your current settings.\n"
|
|
|
|
|
"Specifying a non-existent key and a value will create the new key.\n"
|
2000-05-19 10:48:21 +00:00
|
|
|
|
|
2001-02-06 02:56:14 +00:00
|
|
|
|
"Special Keys:\n"
|
|
|
|
|
"b_switch - Determines the highest weapon that Quake should switch to upon a backpack pickup.\n"
|
|
|
|
|
"w_switch - Determines the highest weapon that Quake should switch to upon a weapon pickup.");
|
|
|
|
|
|
|
|
|
|
Cmd_AddCommand ("fullinfo", CL_FullInfo_f, "Used by QuakeSpy and Qlist to set setinfo variables");
|
|
|
|
|
Cmd_AddCommand ("fullserverinfo", CL_FullServerinfo_f, "Used by QuakeSpy and Qlist to obtain server variables");
|
2000-05-19 10:48:21 +00:00
|
|
|
|
|
2001-02-06 02:56:14 +00:00
|
|
|
|
Cmd_AddCommand ("download", CL_Download_f, "Manually download a quake file from the server");
|
2000-05-19 10:48:21 +00:00
|
|
|
|
|
2001-02-06 02:56:14 +00:00
|
|
|
|
Cmd_AddCommand ("nextul", CL_NextUpload, "Tells the client to send the next upload");
|
|
|
|
|
Cmd_AddCommand ("stopul", CL_StopUpload, "Tells the client to stop uploading");
|
2000-05-19 10:48:21 +00:00
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// forward to server commands
|
|
|
|
|
//
|
2001-02-06 02:56:14 +00:00
|
|
|
|
Cmd_AddCommand ("kill", NULL, "Suicide :)");
|
|
|
|
|
Cmd_AddCommand ("pause", NULL, "Pause the game");
|
|
|
|
|
Cmd_AddCommand ("say", NULL, "Say something to all other players");
|
|
|
|
|
Cmd_AddCommand ("say_team", NULL, "Say something only to people on your team");
|
|
|
|
|
Cmd_AddCommand ("serverinfo", NULL, "Report the current server info");
|
|
|
|
|
|
2000-05-19 10:48:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-02-06 02:56:14 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
CL_Init_Cvars (void)
|
2000-05-19 10:48:21 +00:00
|
|
|
|
{
|
2000-10-29 20:49:50 +00:00
|
|
|
|
// LordHavoc: some people like it asking on quit, others don't...
|
2000-12-08 06:51:37 +00:00
|
|
|
|
confirm_quit =
|
2001-05-13 05:10:02 +00:00
|
|
|
|
Cvar_Get ("confirm_quit", "1", CVAR_ARCHIVE, NULL, "confirm quit command");
|
|
|
|
|
cl_allow_cmd_pkt = Cvar_Get ("cl_allow_cmd_pkt", "1", CVAR_NONE, NULL,
|
2001-02-15 18:03:59 +00:00
|
|
|
|
"enables packets from the likes of gamespy");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
show_fps = Cvar_Get ("show_fps", "0", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"display realtime frames per second");
|
2000-12-04 03:46:04 +00:00
|
|
|
|
// Misty: I like to be able to see the time when I play
|
2001-05-13 05:10:02 +00:00
|
|
|
|
show_time = Cvar_Get ("show_time", "0", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"display the current time");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
host_speeds = Cvar_Get ("host_speeds", "0", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"display host processing times");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
developer = Cvar_Get ("developer", "0", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"show info interesting to developers");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_demospeed = Cvar_Get ("cl_demospeed", "1.0", CVAR_NONE, NULL,
|
2001-02-07 20:15:33 +00:00
|
|
|
|
"adjust demo playback speed. 1.0 = normal, < 1 slow-mo, > 1 timelaps");
|
2000-12-13 09:01:11 +00:00
|
|
|
|
// Misty: Turn on or off screen filling colors for powerups among other things.
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_cshift_bonus = Cvar_Get ("cl_cshift_bonus", "1", CVAR_ARCHIVE, NULL,
|
2000-12-13 09:01:11 +00:00
|
|
|
|
"Show bonus flash on item pickup");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_cshift_contents = Cvar_Get ("cl_cshift_content", "1", CVAR_ARCHIVE, NULL,
|
2000-12-13 09:01:11 +00:00
|
|
|
|
"Shift view colors for contents (water, slime, etc)");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_cshift_damage = Cvar_Get ("cl_cshift_damage", "1", CVAR_ARCHIVE, NULL,
|
2000-12-13 09:01:11 +00:00
|
|
|
|
"Shift view colors on damage");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_cshift_powerup = Cvar_Get ("cl_cshift_powerup", "1", CVAR_ARCHIVE, NULL,
|
2000-12-13 09:01:11 +00:00
|
|
|
|
"Shift view colors for powerups");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_autoexec = Cvar_Get ("cl_autoexec", "0", CVAR_ROM, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"exec autoexec.cfg on gamedir change");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_warncmd = Cvar_Get ("cl_warncmd", "0", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"inform when execing a command");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_upspeed = Cvar_Get ("cl_upspeed", "200", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"swim/fly up/down speed");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"forward speed");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_backspeed = Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"backward speed");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_sidespeed = Cvar_Get ("cl_sidespeed", "350", CVAR_NONE, NULL, "strafe speed");
|
|
|
|
|
cl_movespeedkey = Cvar_Get ("cl_movespeedkey", "2.0", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"move `run' speed multiplier");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, NULL, "turning speed");
|
|
|
|
|
cl_pitchspeed = Cvar_Get ("cl_pitchspeed", "150", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"look up/down speed");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_anglespeedkey = Cvar_Get ("cl_anglespeedkey", "1.5", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"turn `run' speed multiplier");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_shownet = Cvar_Get ("cl_shownet", "0", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"show network packets. 0=off, 1=basic, 2=verbose");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, NULL, "status bar mode");
|
|
|
|
|
cl_sbar_separator = Cvar_Get ("cl_sbar_separator", "0", CVAR_ARCHIVE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"turns on status bar separator");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_hudswap = Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"new HUD on left side?");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_maxfps = Cvar_Get ("cl_maxfps", "0", CVAR_ARCHIVE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"maximum frames rendered in one second. 0 == 32");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_timeout = Cvar_Get ("cl_timeout", "60", CVAR_ARCHIVE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"server connection timeout (since last packet received)");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
lookspring = Cvar_Get ("lookspring", "0", CVAR_ARCHIVE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"Snap view to center when moving and no mlook/klook");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
lookstrafe = Cvar_Get ("lookstrafe", "0", CVAR_ARCHIVE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"when mlook/klook on player will strafe");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
sensitivity = Cvar_Get ("sensitivity", "3", CVAR_ARCHIVE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"mouse sensitivity multiplier");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_freelook = Cvar_Get ("freelook", "0", CVAR_ARCHIVE, NULL, "force +mlook");
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
2001-05-13 05:10:02 +00:00
|
|
|
|
m_pitch = Cvar_Get ("m_pitch", "0.022", CVAR_ARCHIVE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"mouse pitch (up/down) multipier");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
m_yaw = Cvar_Get ("m_yaw", "0.022", CVAR_NONE, NULL,
|
2000-12-31 04:46:04 +00:00
|
|
|
|
"mouse yaw (left/right) multiplier");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
m_forward = Cvar_Get ("m_forward", "1", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"mouse forward/back speed");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
m_side = Cvar_Get ("m_side", "0.8", CVAR_NONE, NULL, "mouse strafe speed");
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
2001-05-13 05:10:02 +00:00
|
|
|
|
rcon_password = Cvar_Get ("rcon_password", "", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"remote control password");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
rcon_address = Cvar_Get ("rcon_address", "", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"server IP address when client not connected - for sending rcon commands");
|
|
|
|
|
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_writecfg = Cvar_Get ("cl_writecfg", "1", CVAR_NONE, NULL, "write config files?");
|
2001-02-11 07:15:39 +00:00
|
|
|
|
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_predict_players2 = Cvar_Get ("cl_predict_players2", "1", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"If this and cl_predict_players is 0, no player prediction is done");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_predict_players = Cvar_Get ("cl_predict_players", "1", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"If this and cl_predict_players2 is 0, no player prediction is done");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
cl_solid_players = Cvar_Get ("cl_solid_players", "1", CVAR_NONE, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"Are players solid? If off, you can walk through them with difficulty");
|
|
|
|
|
|
2001-05-13 05:10:02 +00:00
|
|
|
|
localid = Cvar_Get ("localid", "", CVAR_NONE, NULL,
|
2001-02-06 02:56:14 +00:00
|
|
|
|
"FIXME: This has something to do with client authentication. No Description");
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
|
|
//
|
2000-05-10 11:29:38 +00:00
|
|
|
|
// info mirrors
|
2000-12-08 06:51:37 +00:00
|
|
|
|
//
|
2001-05-13 05:10:02 +00:00
|
|
|
|
name = Cvar_Get ("name", "unnamed", CVAR_ARCHIVE | CVAR_USERINFO, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"Player name");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
password = Cvar_Get ("password", "", CVAR_USERINFO, NULL, "Server password");
|
|
|
|
|
spectator = Cvar_Get ("spectator", "", CVAR_USERINFO, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"Set to 1 before connecting to become a spectator");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
team = Cvar_Get ("team", "", CVAR_ARCHIVE | CVAR_USERINFO, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"Team player is on.");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
rate = Cvar_Get ("rate", "2500", CVAR_ARCHIVE | CVAR_USERINFO, NULL,
|
2000-12-31 04:46:04 +00:00
|
|
|
|
"Amount of bytes per second server will send/download to you");
|
2001-05-13 05:10:02 +00:00
|
|
|
|
msg = Cvar_Get ("msg", "1", CVAR_ARCHIVE | CVAR_USERINFO, NULL, "Determines the type of messages reported 0 is maximum, 4 is none");
|
|
|
|
|
noaim = Cvar_Get ("noaim", "0", CVAR_ARCHIVE | CVAR_USERINFO, NULL,
|
2000-12-08 06:51:37 +00:00
|
|
|
|
"Auto aim off switch. Set to 1 to turn off.");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Host_EndGame
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Call this to drop to a console without exiting the qwcl
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
Host_EndGame (char *message, ...)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
va_list argptr;
|
|
|
|
|
char string[1024];
|
|
|
|
|
|
2000-05-15 08:59:12 +00:00
|
|
|
|
va_start (argptr, message);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
vsnprintf (string, sizeof (string), message, argptr);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
va_end (argptr);
|
|
|
|
|
Con_Printf ("\n===========================\n");
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Con_Printf ("Host_EndGame: %s\n", string);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("===========================\n\n");
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
CL_Disconnect ();
|
|
|
|
|
|
|
|
|
|
longjmp (host_abort, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Host_Error
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
This shuts down the client and exits qwcl
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
Host_Error (char *error, ...)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
va_list argptr;
|
|
|
|
|
char string[1024];
|
|
|
|
|
static qboolean inerror = false;
|
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
if (inerror)
|
|
|
|
|
Sys_Error ("Host_Error: recursively entered");
|
|
|
|
|
inerror = true;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
|
|
va_start (argptr, error);
|
|
|
|
|
vsnprintf (string, sizeof (string), error, argptr);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
va_end (argptr);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Con_Printf ("Host_Error: %s\n", string);
|
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
CL_Disconnect ();
|
|
|
|
|
cls.demonum = -1;
|
|
|
|
|
|
|
|
|
|
inerror = false;
|
|
|
|
|
|
|
|
|
|
// FIXME
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Sys_Error ("Host_Error: %s\n", string);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Host_WriteConfiguration
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Writes key bindings and archived cvars to config.cfg
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
Host_WriteConfiguration (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
QFile *f;
|
|
|
|
|
|
2001-02-11 07:15:39 +00:00
|
|
|
|
if (cl_writecfg->int_val && host_initialized) {
|
2000-12-08 06:51:37 +00:00
|
|
|
|
char *path = va ("%s/config.cfg", com_gamedir);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-04 16:07:08 +00:00
|
|
|
|
COM_CreatePath (path);
|
|
|
|
|
f = Qopen (path, "w");
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (!f) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("Couldn't write config.cfg.\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Key_WriteBindings (f);
|
|
|
|
|
Cvar_WriteVariables (f);
|
|
|
|
|
|
2000-09-27 19:44:26 +00:00
|
|
|
|
Qclose (f);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Host_SimulationTime
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-05-16 08:59:10 +00:00
|
|
|
|
This determines if enough time has passed to run a simulation frame, or
|
|
|
|
|
returns the amount of time that has to be waited
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2001-05-16 08:59:10 +00:00
|
|
|
|
static inline float
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Host_SimulationTime (float time)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
float fps;
|
2001-02-07 20:15:33 +00:00
|
|
|
|
float timescale = 1.0;
|
2001-05-16 08:59:10 +00:00
|
|
|
|
float timedifference;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-07 20:15:33 +00:00
|
|
|
|
if (cls.demoplayback) {
|
2001-02-08 00:08:32 +00:00
|
|
|
|
timescale = max (0, cl_demospeed->value);
|
2001-02-07 20:15:33 +00:00
|
|
|
|
time *= timescale;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
realtime += time;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
if (oldrealtime > realtime)
|
|
|
|
|
oldrealtime = 0;
|
|
|
|
|
|
2000-10-17 03:17:42 +00:00
|
|
|
|
if (cl_maxfps->int_val)
|
2001-02-08 00:02:26 +00:00
|
|
|
|
fps = bound (1, cl_maxfps->value, 72);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
else
|
2001-02-08 00:02:26 +00:00
|
|
|
|
fps = bound (30, rate->value / 80.0, 72);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-05-16 08:59:10 +00:00
|
|
|
|
timedifference = (timescale / fps) - (realtime - oldrealtime);
|
|
|
|
|
|
|
|
|
|
if (!cls.timedemo && (timedifference > 0))
|
|
|
|
|
return timedifference; // framerate is too high
|
|
|
|
|
return 0;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Host_Frame
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Runs all active servers
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
int nopacketcount;
|
|
|
|
|
void
|
|
|
|
|
Host_Frame (float time)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
|
static double time1 = 0;
|
|
|
|
|
static double time2 = 0;
|
|
|
|
|
static double time3 = 0;
|
|
|
|
|
int pass1, pass2, pass3;
|
2001-05-16 08:59:10 +00:00
|
|
|
|
float sleeptime;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
2000-12-28 09:27:30 +00:00
|
|
|
|
if (setjmp (host_abort)) // something bad happened, or the server disconnected
|
|
|
|
|
return;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
// decide the simulation time
|
2001-05-16 08:59:10 +00:00
|
|
|
|
if ((sleeptime = Host_SimulationTime (time)) != 0) {
|
2001-05-22 05:39:16 +00:00
|
|
|
|
#ifdef HAVE_USLEEP
|
2001-05-16 08:59:10 +00:00
|
|
|
|
if (sleeptime > 0.01) // minimum sleep time
|
|
|
|
|
usleep((unsigned long)((sleeptime - 0.001) * 1000000));
|
2001-05-22 05:39:16 +00:00
|
|
|
|
#endif
|
2000-12-28 09:27:30 +00:00
|
|
|
|
return; // framerate is too high
|
2001-05-16 08:59:10 +00:00
|
|
|
|
}
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
host_frametime = realtime - oldrealtime;
|
|
|
|
|
oldrealtime = realtime;
|
2000-12-28 09:27:30 +00:00
|
|
|
|
host_frametime = min (host_frametime, 0.2);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
// get new key events
|
2000-05-23 06:36:33 +00:00
|
|
|
|
IN_SendKeyEvents ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-12-28 09:27:30 +00:00
|
|
|
|
// allow mouses or other external controllers to add commands
|
2000-05-10 11:29:38 +00:00
|
|
|
|
IN_Commands ();
|
|
|
|
|
|
|
|
|
|
// process console commands
|
|
|
|
|
Cbuf_Execute ();
|
|
|
|
|
|
|
|
|
|
// fetch results from server
|
|
|
|
|
CL_ReadPackets ();
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (atoi (Info_ValueForKey (cl.serverinfo, "no_pogo_stick")))
|
2000-10-15 04:26:09 +00:00
|
|
|
|
Cvar_Set (no_pogo_stick, "1");
|
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
// send intentions now
|
|
|
|
|
// resend a connection request if necessary
|
|
|
|
|
if (cls.state == ca_disconnected) {
|
|
|
|
|
CL_CheckForResend ();
|
2001-03-05 18:10:52 +00:00
|
|
|
|
} else {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
CL_SendCmd ();
|
|
|
|
|
|
|
|
|
|
// Set up prediction for other players
|
2001-03-05 18:10:52 +00:00
|
|
|
|
CL_SetUpPlayerPrediction (false);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
// do client side motion prediction
|
2001-03-05 18:10:52 +00:00
|
|
|
|
CL_PredictMove ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
// Set up prediction for other players
|
2001-03-05 18:10:52 +00:00
|
|
|
|
CL_SetUpPlayerPrediction (true);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
// build a refresh entity list
|
2001-03-05 18:10:52 +00:00
|
|
|
|
CL_EmitEntities ();
|
|
|
|
|
}
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
// update video
|
2000-10-17 03:17:42 +00:00
|
|
|
|
if (host_speeds->int_val)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
time1 = Sys_DoubleTime ();
|
|
|
|
|
|
|
|
|
|
SCR_UpdateScreen ();
|
|
|
|
|
|
2000-10-17 03:17:42 +00:00
|
|
|
|
if (host_speeds->int_val)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
time2 = Sys_DoubleTime ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
// update audio
|
2000-12-08 06:51:37 +00:00
|
|
|
|
if (cls.state == ca_active) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
S_Update (r_origin, vpn, vright, vup);
|
|
|
|
|
CL_DecayLights ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
} else
|
2000-05-10 11:29:38 +00:00
|
|
|
|
S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin);
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
CDAudio_Update ();
|
|
|
|
|
|
|
|
|
|
if (host_speeds->int_val) {
|
|
|
|
|
pass1 = (time1 - time3) * 1000;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
time3 = Sys_DoubleTime ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
pass2 = (time2 - time1) * 1000;
|
|
|
|
|
pass3 = (time3 - time2) * 1000;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Con_Printf ("%3i tot %3i server %3i gfx %3i snd\n",
|
2000-12-08 06:51:37 +00:00
|
|
|
|
pass1 + pass2 + pass3, pass1, pass2, pass3);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
host_framecount++;
|
|
|
|
|
fps_count++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
2001-01-18 04:28:26 +00:00
|
|
|
|
static int
|
|
|
|
|
check_quakerc (void)
|
|
|
|
|
{
|
|
|
|
|
QFile *f;
|
|
|
|
|
char *l, *p;
|
|
|
|
|
int ret = 1;
|
|
|
|
|
|
|
|
|
|
COM_FOpenFile ("quake.rc", &f);
|
|
|
|
|
if (!f)
|
|
|
|
|
return 1;
|
|
|
|
|
while ((l = Qgetline (f))) {
|
|
|
|
|
if ((p = strstr (l, "stuffcmds"))) {
|
|
|
|
|
if (p == l) { // only known case so far
|
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Qclose (f);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Host_Init
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
Host_Init (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
if (COM_CheckParm ("-minmemory"))
|
2000-11-27 13:17:48 +00:00
|
|
|
|
host_parms.memsize = MINIMUM_MEMORY;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-11-27 13:17:48 +00:00
|
|
|
|
if (host_parms.memsize < MINIMUM_MEMORY)
|
2000-05-21 09:49:25 +00:00
|
|
|
|
Sys_Error ("Only %4.1f megs of memory reported, can't execute game",
|
2000-12-08 06:51:37 +00:00
|
|
|
|
host_parms.memsize / (float) 0x100000);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-01-04 19:10:38 +00:00
|
|
|
|
Cvar_Init_Hash ();
|
2001-01-04 20:51:35 +00:00
|
|
|
|
Cmd_Init_Hash ();
|
2000-11-27 13:17:48 +00:00
|
|
|
|
Memory_Init (host_parms.membase, host_parms.memsize);
|
2000-05-16 06:33:37 +00:00
|
|
|
|
Cvar_Init ();
|
2000-10-31 05:29:32 +00:00
|
|
|
|
Sys_Init_Cvars ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Sys_Init ();
|
2000-05-16 06:33:37 +00:00
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Cbuf_Init ();
|
|
|
|
|
Cmd_Init ();
|
2000-12-03 23:52:54 +00:00
|
|
|
|
Locs_Init ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-05-21 09:49:25 +00:00
|
|
|
|
// execute +set as early as possible
|
|
|
|
|
Cmd_StuffCmds_f ();
|
|
|
|
|
Cbuf_Execute_Sets ();
|
|
|
|
|
|
|
|
|
|
// execute the global configuration file if it exists
|
|
|
|
|
// would have been nice if Cmd_Exec_f could have been used, but it
|
|
|
|
|
// only reads from within the quake file system, and changing that is
|
|
|
|
|
// probably Not A Good Thing (tm).
|
2000-12-08 06:51:37 +00:00
|
|
|
|
fs_globalcfg = Cvar_Get ("fs_globalcfg", FS_GLOBALCFG,
|
2001-05-13 05:10:02 +00:00
|
|
|
|
CVAR_ROM, NULL, "global configuration file");
|
2000-05-21 09:49:25 +00:00
|
|
|
|
Cmd_Exec_File (fs_globalcfg->string);
|
|
|
|
|
Cbuf_Execute_Sets ();
|
|
|
|
|
|
2000-11-30 19:53:25 +00:00
|
|
|
|
// execute +set again to override the config file
|
|
|
|
|
Cmd_StuffCmds_f ();
|
|
|
|
|
Cbuf_Execute_Sets ();
|
|
|
|
|
|
2001-02-10 00:40:55 +00:00
|
|
|
|
fs_usercfg = Cvar_Get ("fs_usercfg", FS_USERCFG,
|
2001-05-13 05:10:02 +00:00
|
|
|
|
CVAR_ROM, NULL, "user configuration file");
|
2001-02-10 00:40:55 +00:00
|
|
|
|
Cmd_Exec_File (fs_usercfg->string);
|
|
|
|
|
Cbuf_Execute_Sets ();
|
|
|
|
|
|
|
|
|
|
// execute +set again to override the config file
|
|
|
|
|
Cmd_StuffCmds_f ();
|
|
|
|
|
Cbuf_Execute_Sets ();
|
|
|
|
|
|
2000-10-29 15:35:24 +00:00
|
|
|
|
CL_Cam_Init_Cvars ();
|
|
|
|
|
CL_Input_Init_Cvars ();
|
2001-01-17 07:28:34 +00:00
|
|
|
|
Skin_Init_Cvars ();
|
2000-10-29 15:35:24 +00:00
|
|
|
|
CL_Init_Cvars ();
|
|
|
|
|
CL_Prediction_Init_Cvars ();
|
|
|
|
|
COM_Init_Cvars ();
|
|
|
|
|
Con_Init_Cvars ();
|
|
|
|
|
Draw_Init_Cvars ();
|
|
|
|
|
COM_Filesystem_Init_Cvars ();
|
|
|
|
|
IN_Init_Cvars ();
|
|
|
|
|
Key_Init_Cvars ();
|
|
|
|
|
Mod_Init_Cvars ();
|
|
|
|
|
Netchan_Init_Cvars ();
|
|
|
|
|
Pmove_Init_Cvars ();
|
|
|
|
|
R_Init_Cvars ();
|
|
|
|
|
S_Init_Cvars ();
|
|
|
|
|
SCR_Init_Cvars ();
|
|
|
|
|
Team_Init_Cvars ();
|
|
|
|
|
V_Init_Cvars ();
|
|
|
|
|
VID_Init_Cvars ();
|
|
|
|
|
|
|
|
|
|
cl_Cmd_Init ();
|
2000-05-21 09:49:25 +00:00
|
|
|
|
V_Init ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
COM_Init ();
|
2000-05-21 09:49:25 +00:00
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
NET_Init (PORT_CLIENT);
|
|
|
|
|
Netchan_Init ();
|
|
|
|
|
|
|
|
|
|
W_LoadWadFile ("gfx.wad");
|
|
|
|
|
Key_Init ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Con_Init ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Mod_Init ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
|
|
// Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
|
|
|
|
|
Con_Printf ("%4.1f megs RAM used.\n", host_parms.memsize / (1024 * 1024.0));
|
|
|
|
|
|
2000-10-29 15:35:24 +00:00
|
|
|
|
R_Textures_Init ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
|
|
host_basepal = (byte *) COM_LoadHunkFile ("gfx/palette.lmp");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
if (!host_basepal)
|
|
|
|
|
Sys_Error ("Couldn't load gfx/palette.lmp");
|
2000-12-08 06:51:37 +00:00
|
|
|
|
host_colormap = (byte *) COM_LoadHunkFile ("gfx/colormap.lmp");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
if (!host_colormap)
|
|
|
|
|
Sys_Error ("Couldn't load gfx/colormap.lmp");
|
|
|
|
|
#ifdef __linux__
|
|
|
|
|
CDAudio_Init ();
|
|
|
|
|
VID_Init (host_basepal);
|
2000-05-23 06:36:33 +00:00
|
|
|
|
IN_Init ();
|
2001-05-13 08:26:45 +00:00
|
|
|
|
M_Init ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Draw_Init ();
|
|
|
|
|
SCR_Init ();
|
|
|
|
|
R_Init ();
|
|
|
|
|
|
2000-05-14 09:57:28 +00:00
|
|
|
|
S_Init ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
cls.state = ca_disconnected;
|
|
|
|
|
Sbar_Init ();
|
2001-01-17 07:28:34 +00:00
|
|
|
|
Skin_Init ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
CL_Init ();
|
|
|
|
|
#else
|
|
|
|
|
VID_Init (host_basepal);
|
|
|
|
|
Draw_Init ();
|
|
|
|
|
SCR_Init ();
|
|
|
|
|
R_Init ();
|
|
|
|
|
|
2000-05-14 09:57:28 +00:00
|
|
|
|
S_Init ();
|
2000-05-14 06:20:41 +00:00
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
cls.state = ca_disconnected;
|
|
|
|
|
CDAudio_Init ();
|
|
|
|
|
Sbar_Init ();
|
2001-01-17 19:44:45 +00:00
|
|
|
|
Skin_Init ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
CL_Init ();
|
|
|
|
|
IN_Init ();
|
2001-05-13 08:26:45 +00:00
|
|
|
|
M_Init ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2001-01-01 18:00:06 +00:00
|
|
|
|
// Reparse the command line for + commands.
|
|
|
|
|
// (Note, no non-base commands exist yet)
|
2001-01-18 04:28:26 +00:00
|
|
|
|
if (check_quakerc ()) {
|
|
|
|
|
Cmd_StuffCmds_f ();
|
|
|
|
|
Cbuf_Execute ();
|
|
|
|
|
}
|
2001-01-01 18:00:06 +00:00
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Cbuf_InsertText ("exec quake.rc\n");
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Cbuf_AddText
|
2000-12-28 07:18:11 +00:00
|
|
|
|
("echo Type connect <internet address> or use a server browser to connect to a game.\n");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
Cbuf_AddText ("cl_warncmd 1\n");
|
|
|
|
|
|
|
|
|
|
Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
|
|
|
|
|
host_hunklevel = Hunk_LowMark ();
|
|
|
|
|
|
|
|
|
|
host_initialized = true;
|
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Con_Printf ("\nClient version %s (build %04d)\n\n", VERSION,
|
|
|
|
|
build_number ());
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2000-11-04 07:42:43 +00:00
|
|
|
|
Con_Printf ("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s initialized <20><><EFBFBD><EFBFBD>\n", PROGRAM);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2001-02-05 23:06:57 +00:00
|
|
|
|
Host_Shutdown
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
2001-02-05 23:06:57 +00:00
|
|
|
|
FIXME: this is a callback from Sys_Quit and Sys_Error. It would be better
|
|
|
|
|
to run quit through here before the final handoff to the sys code.
|
2000-05-10 11:29:38 +00:00
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
|
void
|
|
|
|
|
Host_Shutdown (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
static qboolean isdown = false;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
|
|
if (isdown) {
|
2000-05-10 11:29:38 +00:00
|
|
|
|
printf ("recursive shutdown\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
isdown = true;
|
|
|
|
|
|
2000-05-25 01:38:52 +00:00
|
|
|
|
SL_Shutdown (slist);
|
2000-05-19 04:33:12 +00:00
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
|
Host_WriteConfiguration ();
|
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
|
CDAudio_Shutdown ();
|
|
|
|
|
NET_Shutdown ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
S_Shutdown ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
IN_Shutdown ();
|
|
|
|
|
if (host_basepal)
|
2000-12-08 06:51:37 +00:00
|
|
|
|
VID_Shutdown ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
}
|