2001-02-19 21:15:25 +00:00
|
|
|
/*
|
|
|
|
cl_main.c
|
|
|
|
|
|
|
|
Client main loop
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
*/
|
2001-08-28 23:05:45 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2003-01-15 15:31:36 +00:00
|
|
|
|
2002-10-11 20:47:17 +00:00
|
|
|
#ifdef HAVE_WINDOWS_H
|
|
|
|
# include "winquake.h"
|
|
|
|
#endif
|
2001-09-07 04:41:13 +00:00
|
|
|
#include <sys/types.h>
|
2001-02-19 21:15:25 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
2002-08-09 02:44:23 +00:00
|
|
|
# define model_t sun_model_t
|
2001-02-19 21:15:25 +00:00
|
|
|
# include <netinet/in.h>
|
2002-08-09 02:44:23 +00:00
|
|
|
# undef model_t
|
2001-02-19 21:15:25 +00:00
|
|
|
#endif
|
2002-02-22 05:48:59 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
2001-02-19 21:15:25 +00:00
|
|
|
#ifdef HAVE_WINSOCK_H
|
|
|
|
# include <winsock.h>
|
|
|
|
#endif
|
|
|
|
|
2011-08-25 13:35:20 +00:00
|
|
|
#if defined(_WIN32) && defined(HAVE_MALLOC_H)
|
2007-03-22 23:20:57 +00:00
|
|
|
#include <malloc.h>
|
|
|
|
#endif
|
|
|
|
|
2001-08-28 23:05:45 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <errno.h>
|
2001-02-19 21:15:25 +00:00
|
|
|
#include <setjmp.h>
|
|
|
|
|
2013-01-22 05:09:41 +00:00
|
|
|
#include "qfalloca.h"
|
|
|
|
|
2002-07-31 05:19:03 +00:00
|
|
|
#include "QF/cbuf.h"
|
2002-07-31 22:03:53 +00:00
|
|
|
#include "QF/idparse.h"
|
2001-04-10 21:45:42 +00:00
|
|
|
#include "QF/cdaudio.h"
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/cmd.h"
|
|
|
|
#include "QF/console.h"
|
|
|
|
#include "QF/cvar.h"
|
2001-05-09 22:40:51 +00:00
|
|
|
#include "QF/draw.h"
|
2022-05-26 07:11:50 +00:00
|
|
|
#include "QF/dstring.h"
|
2012-01-05 10:19:37 +00:00
|
|
|
#include "QF/image.h"
|
2001-04-10 21:45:42 +00:00
|
|
|
#include "QF/input.h"
|
2021-04-12 13:09:09 +00:00
|
|
|
#include "QF/joystick.h"
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/keys.h"
|
2001-04-10 06:55:28 +00:00
|
|
|
#include "QF/model.h"
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/msg.h"
|
2012-01-05 10:19:37 +00:00
|
|
|
#include "QF/png.h"
|
2002-01-18 19:19:33 +00:00
|
|
|
#include "QF/progs.h"
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/qargs.h"
|
2001-08-28 23:05:45 +00:00
|
|
|
#include "QF/qendian.h"
|
2002-08-27 07:16:28 +00:00
|
|
|
#include "QF/quakefs.h"
|
2021-11-14 01:32:35 +00:00
|
|
|
#include "QF/quakeio.h"
|
2004-01-16 05:46:19 +00:00
|
|
|
#include "QF/ruamoko.h"
|
2021-11-14 01:32:35 +00:00
|
|
|
#include "QF/plist.h"
|
2001-04-15 08:04:15 +00:00
|
|
|
#include "QF/screen.h"
|
2001-04-10 21:45:42 +00:00
|
|
|
#include "QF/sound.h"
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/sys.h"
|
2001-05-09 18:04:45 +00:00
|
|
|
#include "QF/teamplay.h"
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/va.h"
|
2001-08-28 23:05:45 +00:00
|
|
|
#include "QF/vid.h"
|
2003-04-13 22:07:58 +00:00
|
|
|
#include "QF/gib.h"
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2012-02-13 12:58:34 +00:00
|
|
|
#include "QF/plugin/console.h"
|
2022-02-28 07:59:38 +00:00
|
|
|
#include "QF/scene/transform.h"
|
2012-02-13 12:58:34 +00:00
|
|
|
|
2001-05-09 18:28:08 +00:00
|
|
|
#include "buildnum.h"
|
2001-08-28 23:05:45 +00:00
|
|
|
#include "compat.h"
|
2020-06-21 14:15:17 +00:00
|
|
|
|
2021-12-19 04:08:39 +00:00
|
|
|
#include "client/particles.h"
|
2022-12-01 04:11:16 +00:00
|
|
|
#include "client/sbar.h"
|
2022-11-02 06:08:09 +00:00
|
|
|
#include "client/screen.h"
|
2021-03-10 09:00:16 +00:00
|
|
|
#include "client/temp_entities.h"
|
2021-03-12 02:48:53 +00:00
|
|
|
#include "client/view.h"
|
2022-03-04 16:48:10 +00:00
|
|
|
#include "client/world.h"
|
2021-03-10 09:00:16 +00:00
|
|
|
|
2020-06-21 14:15:17 +00:00
|
|
|
#include "qw/bothdefs.h"
|
|
|
|
#include "qw/pmove.h"
|
|
|
|
|
|
|
|
#include "qw/include/cl_cam.h"
|
|
|
|
#include "qw/include/cl_chat.h"
|
|
|
|
#include "qw/include/cl_demo.h"
|
|
|
|
#include "qw/include/cl_ents.h"
|
|
|
|
#include "qw/include/cl_http.h"
|
|
|
|
#include "qw/include/cl_input.h"
|
|
|
|
#include "qw/include/cl_main.h"
|
|
|
|
#include "qw/include/cl_parse.h"
|
|
|
|
#include "qw/include/cl_pred.h"
|
|
|
|
#include "qw/include/cl_skin.h"
|
|
|
|
#include "qw/include/cl_slist.h"
|
|
|
|
#include "qw/include/client.h"
|
|
|
|
#include "qw/include/game.h"
|
|
|
|
#include "qw/include/host.h"
|
|
|
|
#include "netchan.h"
|
2001-05-09 18:28:08 +00:00
|
|
|
|
2002-01-16 21:53:42 +00:00
|
|
|
CLIENT_PLUGIN_PROTOS
|
|
|
|
static plugin_list_t client_plugin_list[] = {
|
2012-02-01 10:52:13 +00:00
|
|
|
CLIENT_PLUGIN_LIST
|
2002-01-16 21:53:42 +00:00
|
|
|
};
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
// we need to declare some mouse variables here, because the menu system
|
|
|
|
// references them even when on a unix system.
|
|
|
|
|
|
|
|
qboolean noclip_anglehack; // remnant from old quake
|
|
|
|
|
2002-07-31 05:19:03 +00:00
|
|
|
cbuf_t *cl_cbuf;
|
2002-12-01 07:22:42 +00:00
|
|
|
cbuf_t *cl_stbuf;
|
2002-07-31 05:19:03 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
float cl_mem_size;
|
|
|
|
static cvar_t cl_mem_size_cvar = {
|
|
|
|
.name = "cl_mem_size",
|
|
|
|
.description =
|
|
|
|
"Amount of memory (in MB) to allocate for the "
|
|
|
|
PACKAGE_NAME
|
|
|
|
" heap",
|
|
|
|
.default_value = "32",
|
|
|
|
.flags = CVAR_ROM,
|
|
|
|
.value = { .type = &cexpr_float, .value = &cl_mem_size },
|
|
|
|
};
|
2001-11-14 20:18:37 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
char *rcon_password;
|
|
|
|
static cvar_t rcon_password_cvar = {
|
|
|
|
.name = "rcon_password",
|
|
|
|
.description =
|
|
|
|
"Set the password for rcon 'root' commands",
|
|
|
|
.default_value = "",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = 0, .value = &rcon_password },
|
|
|
|
};
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
char *rcon_address;
|
|
|
|
static cvar_t rcon_address_cvar = {
|
|
|
|
.name = "rcon_address",
|
|
|
|
.description =
|
|
|
|
"server IP address when client not connected - for sending rcon "
|
|
|
|
"commands",
|
|
|
|
.default_value = "",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = 0, .value = &rcon_address },
|
|
|
|
};
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
int cl_writecfg;
|
|
|
|
static cvar_t cl_writecfg_cvar = {
|
|
|
|
.name = "cl_writecfg",
|
|
|
|
.description =
|
|
|
|
"write config files?",
|
|
|
|
.default_value = "1",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &cl_writecfg },
|
|
|
|
};
|
|
|
|
int cl_allow_cmd_pkt;
|
|
|
|
static cvar_t cl_allow_cmd_pkt_cvar = {
|
|
|
|
.name = "cl_allow_cmd_pkt",
|
|
|
|
.description =
|
|
|
|
"enables packets from the likes of gamespy",
|
|
|
|
.default_value = "1",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &cl_allow_cmd_pkt },
|
|
|
|
};
|
|
|
|
char *cl_cmd_pkt_adr;
|
|
|
|
static cvar_t cl_cmd_pkt_adr_cvar = {
|
|
|
|
.name = "cl_cmd_pkt_adr",
|
|
|
|
.description =
|
|
|
|
"allowed address for non-local command packet",
|
|
|
|
.default_value = "",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = 0, .value = &cl_cmd_pkt_adr },
|
|
|
|
};
|
|
|
|
int cl_paranoid;
|
|
|
|
static cvar_t cl_paranoid_cvar = {
|
|
|
|
.name = "cl_paranoid",
|
|
|
|
.description =
|
|
|
|
"print source address of connectionless packets even when coming from "
|
|
|
|
"the server being connected to.",
|
|
|
|
.default_value = "1",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &cl_paranoid },
|
|
|
|
};
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
float cl_timeout;
|
|
|
|
static cvar_t cl_timeout_cvar = {
|
|
|
|
.name = "cl_timeout",
|
|
|
|
.description =
|
|
|
|
"server connection timeout (since last packet received)",
|
|
|
|
.default_value = "60",
|
|
|
|
.flags = CVAR_ARCHIVE,
|
|
|
|
.value = { .type = &cexpr_float, .value = &cl_timeout },
|
|
|
|
};
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
int cl_draw_locs;
|
|
|
|
static cvar_t cl_draw_locs_cvar = {
|
|
|
|
.name = "cl_draw_locs",
|
|
|
|
.description =
|
|
|
|
"Draw location markers.",
|
|
|
|
.default_value = "0",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &cl_draw_locs },
|
|
|
|
};
|
|
|
|
int cl_shownet;
|
|
|
|
static cvar_t cl_shownet_cvar = {
|
|
|
|
.name = "cl_shownet",
|
|
|
|
.description =
|
|
|
|
"show network packets. 0=off, 1=basic, 2=verbose",
|
|
|
|
.default_value = "0",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &cl_shownet },
|
|
|
|
};
|
|
|
|
int cl_autoexec;
|
|
|
|
static cvar_t cl_autoexec_cvar = {
|
|
|
|
.name = "cl_autoexec",
|
|
|
|
.description =
|
|
|
|
"exec autoexec.cfg on gamedir change",
|
|
|
|
.default_value = "0",
|
|
|
|
.flags = CVAR_ROM,
|
|
|
|
.value = { .type = &cexpr_int, .value = &cl_autoexec },
|
|
|
|
};
|
|
|
|
int cl_quakerc;
|
|
|
|
static cvar_t cl_quakerc_cvar = {
|
|
|
|
.name = "cl_quakerc",
|
|
|
|
.description =
|
|
|
|
"exec quake.rc on startup",
|
|
|
|
.default_value = "1",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &cl_quakerc },
|
|
|
|
};
|
|
|
|
float cl_maxfps;
|
|
|
|
static cvar_t cl_maxfps_cvar = {
|
|
|
|
.name = "cl_maxfps",
|
|
|
|
.description =
|
|
|
|
"maximum frames rendered in one second. 0 == 72",
|
|
|
|
.default_value = "0",
|
|
|
|
.flags = CVAR_ARCHIVE,
|
|
|
|
.value = { .type = &cexpr_float, .value = &cl_maxfps },
|
|
|
|
};
|
|
|
|
int cl_usleep;
|
|
|
|
static cvar_t cl_usleep_cvar = {
|
|
|
|
.name = "cl_usleep",
|
|
|
|
.description =
|
|
|
|
"Turn this on to save cpu when fps limited. May affect frame rate "
|
|
|
|
"adversely depending on local machine/os conditions",
|
|
|
|
.default_value = "1",
|
|
|
|
.flags = CVAR_ARCHIVE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &cl_usleep },
|
|
|
|
};
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
int cl_model_crcs;
|
|
|
|
static cvar_t cl_model_crcs_cvar = {
|
|
|
|
.name = "cl_model_crcs",
|
|
|
|
.description =
|
|
|
|
"Controls setting of emodel and pmodel info vars. Required by some "
|
|
|
|
"servers, but clearing this can make the difference between connecting"
|
|
|
|
" and not connecting on some others.",
|
|
|
|
.default_value = "1",
|
|
|
|
.flags = CVAR_ARCHIVE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &cl_model_crcs },
|
|
|
|
};
|
2001-06-02 23:29:41 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
int cl_predict_players;
|
|
|
|
static cvar_t cl_predict_players_cvar = {
|
|
|
|
.name = "cl_predict_players",
|
|
|
|
.description =
|
|
|
|
"If this is 0, no player prediction is done",
|
|
|
|
.default_value = "1",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &cl_predict_players },
|
|
|
|
};
|
|
|
|
int cl_solid_players;
|
|
|
|
static cvar_t cl_solid_players_cvar = {
|
|
|
|
.name = "cl_solid_players",
|
|
|
|
.description =
|
|
|
|
"Are players solid? If off, you can walk through them with difficulty",
|
|
|
|
.default_value = "1",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &cl_solid_players },
|
|
|
|
};
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
char *localid;
|
|
|
|
static cvar_t localid_cvar = {
|
|
|
|
.name = "localid",
|
|
|
|
.description =
|
|
|
|
"Used by gamespy+others to authenticate when sending commands to the "
|
|
|
|
"client",
|
|
|
|
.default_value = "",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = 0, .value = &localid },
|
|
|
|
};
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
int cl_port;
|
|
|
|
static cvar_t cl_port_cvar = {
|
|
|
|
.name = "cl_port",
|
|
|
|
.description =
|
|
|
|
"UDP Port for client to use.",
|
|
|
|
.default_value = PORT_CLIENT,
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &cl_port },
|
|
|
|
};
|
|
|
|
int cl_autorecord;
|
|
|
|
static cvar_t cl_autorecord_cvar = {
|
|
|
|
.name = "cl_autorecord",
|
|
|
|
.description =
|
|
|
|
"Turn this on, if you want to record every game",
|
|
|
|
.default_value = "0",
|
|
|
|
.flags = CVAR_ARCHIVE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &cl_autorecord },
|
|
|
|
};
|
2001-05-30 18:50:17 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
float cl_fb_players;
|
|
|
|
static cvar_t cl_fb_players_cvar = {
|
|
|
|
.name = "cl_fb_players",
|
|
|
|
.description =
|
|
|
|
"fullbrightness of player models. server must allow (via fbskins "
|
|
|
|
"serverinfo).",
|
|
|
|
.default_value = "0",
|
|
|
|
.flags = CVAR_ARCHIVE,
|
|
|
|
.value = { .type = &cexpr_float, .value = &cl_fb_players },
|
|
|
|
};
|
2004-07-11 01:41:01 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
static qboolean allowremotecmd = true;
|
|
|
|
|
2001-05-19 20:57:29 +00:00
|
|
|
/* info mirrors */
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
char *password;
|
|
|
|
static cvar_t password_cvar = {
|
|
|
|
.name = "password",
|
|
|
|
.description =
|
|
|
|
"Set the server password for players",
|
|
|
|
.default_value = "",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = 0, .value = &password },
|
|
|
|
};
|
2022-04-24 11:04:06 +00:00
|
|
|
int spectator;
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
static cvar_t spectator_cvar = {
|
|
|
|
.name = "spectator",
|
|
|
|
.description =
|
|
|
|
"Set to 1 before connecting to become a spectator",
|
|
|
|
.default_value = "",
|
|
|
|
.flags = CVAR_USERINFO,
|
2022-04-24 11:04:06 +00:00
|
|
|
.value = { .type = &cexpr_int, .value = &spectator },
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
};
|
|
|
|
char *cl_name;
|
|
|
|
static cvar_t cl_name_cvar = {
|
|
|
|
.name = "_cl_name",
|
|
|
|
.description =
|
|
|
|
"Player name",
|
|
|
|
.default_value = "player",
|
|
|
|
.flags = CVAR_ARCHIVE,
|
|
|
|
.value = { .type = 0, .value = &cl_name },
|
|
|
|
};
|
|
|
|
float team;
|
|
|
|
static cvar_t team_cvar = {
|
|
|
|
.name = "team",
|
|
|
|
.description =
|
|
|
|
"Team player is on.",
|
|
|
|
.default_value = "",
|
|
|
|
.flags = CVAR_ARCHIVE | CVAR_USERINFO,
|
|
|
|
.value = { .type = &cexpr_float, .value = &team },
|
|
|
|
};
|
|
|
|
float rate;
|
|
|
|
static cvar_t rate_cvar = {
|
|
|
|
.name = "rate",
|
|
|
|
.description =
|
|
|
|
"Amount of bytes per second server will send/download to you",
|
|
|
|
.default_value = "10000",
|
|
|
|
.flags = CVAR_ARCHIVE | CVAR_USERINFO,
|
|
|
|
.value = { .type = &cexpr_float, .value = &rate },
|
|
|
|
};
|
2022-04-24 11:04:06 +00:00
|
|
|
int noaim;
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
static cvar_t noaim_cvar = {
|
|
|
|
.name = "noaim",
|
|
|
|
.description =
|
|
|
|
"Auto aim off switch. Set to 1 to turn off.",
|
|
|
|
.default_value = "0",
|
|
|
|
.flags = CVAR_ARCHIVE | CVAR_USERINFO,
|
2022-04-24 11:04:06 +00:00
|
|
|
.value = { .type = &cexpr_int, .value = &noaim },
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
};
|
2022-04-24 11:04:06 +00:00
|
|
|
int msg;
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
static cvar_t msg_cvar = {
|
|
|
|
.name = "msg",
|
|
|
|
.description =
|
|
|
|
"Determines the type of messages reported 0 is maximum, 4 is none",
|
|
|
|
.default_value = "1",
|
|
|
|
.flags = CVAR_ARCHIVE | CVAR_USERINFO,
|
2022-04-24 11:04:06 +00:00
|
|
|
.value = { .type = &cexpr_int, .value = &msg },
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
};
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-01-03 04:30:38 +00:00
|
|
|
/* GIB events */
|
|
|
|
gib_event_t *cl_player_health_e, *cl_chat_e;
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
client_static_t cls;
|
|
|
|
client_state_t cl;
|
|
|
|
|
|
|
|
entity_state_t cl_baselines[MAX_EDICTS];
|
|
|
|
|
|
|
|
double connect_time = -1; // for connection retransmits
|
|
|
|
|
|
|
|
quakeparms_t host_parms;
|
|
|
|
qboolean host_initialized; // true if into command execution
|
|
|
|
qboolean nomaster;
|
|
|
|
|
|
|
|
double host_frametime;
|
|
|
|
double realtime; // without any filtering or bounding
|
|
|
|
double oldrealtime; // last frame run
|
|
|
|
int host_framecount;
|
|
|
|
|
2003-07-25 22:21:47 +00:00
|
|
|
double con_frametime;
|
|
|
|
double con_realtime;
|
|
|
|
double oldcon_realtime;
|
|
|
|
|
2021-07-29 02:12:37 +00:00
|
|
|
size_t host_hunklevel;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
int host_speeds;
|
|
|
|
static cvar_t host_speeds_cvar = {
|
|
|
|
.name = "host_speeds",
|
|
|
|
.description =
|
|
|
|
"set for running times",
|
|
|
|
.default_value = "0",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &host_speeds },
|
|
|
|
};
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
int fps_count;
|
|
|
|
|
|
|
|
jmp_buf host_abort;
|
|
|
|
|
|
|
|
char *server_version = NULL; // version of server we connected to
|
|
|
|
|
2004-04-13 01:13:07 +00:00
|
|
|
static netadr_t cl_cmd_packet_address;
|
2002-08-15 09:38:23 +00:00
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Quit_f (void)
|
|
|
|
{
|
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 ();
|
|
|
|
Sys_Quit ();
|
|
|
|
}
|
|
|
|
|
2021-12-20 15:36:42 +00:00
|
|
|
static void
|
|
|
|
pointfile_f (void)
|
|
|
|
{
|
2022-05-05 05:41:46 +00:00
|
|
|
CL_LoadPointFile (cl_world.scene->worldmodel);
|
2021-12-20 15:36:42 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Version_f (void)
|
|
|
|
{
|
2010-08-19 06:01:43 +00:00
|
|
|
Sys_Printf ("%s Version %s\n", PACKAGE_NAME, PACKAGE_VERSION);
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Binary: " __TIME__ " " __DATE__ "\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_SendConnectPacket
|
|
|
|
|
|
|
|
called by CL_Connect_f and CL_CheckResend
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_SendConnectPacket (void)
|
|
|
|
{
|
|
|
|
double t1, t2;
|
|
|
|
|
|
|
|
// JACK: Fixed bug where DNS lookups would cause two connects real fast
|
2002-09-28 02:33:39 +00:00
|
|
|
// Now, adds lookup time to the connect time.
|
|
|
|
// Should I add it to realtime instead?!?!
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
if (cls.state != ca_disconnected)
|
|
|
|
return;
|
|
|
|
|
|
|
|
t1 = Sys_DoubleTime ();
|
|
|
|
|
2010-08-24 07:20:07 +00:00
|
|
|
if (!NET_StringToAdr (cls.servername->str, &cls.server_addr)) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Bad server address\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
connect_time = -1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-12-05 21:56:52 +00:00
|
|
|
if (cls.server_addr.port == 0)
|
|
|
|
cls.server_addr.port = BigShort (27500);
|
2001-02-19 21:15:25 +00:00
|
|
|
t2 = Sys_DoubleTime ();
|
|
|
|
|
|
|
|
connect_time = realtime + t2 - t1; // for retransmit requests
|
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
cls.qport = qport;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2022-05-12 10:47:11 +00:00
|
|
|
const char *data = va (0, "%c%c%c%cconnect %i %i %i \"%s\"\n",
|
|
|
|
255, 255, 255, 255, PROTOCOL_VERSION,
|
|
|
|
cls.qport, cls.challenge,
|
|
|
|
Info_MakeString (cls.userinfo, 0));
|
|
|
|
Netchan_SendPacket (strlen (data), data, cls.server_addr);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_CheckForResend
|
|
|
|
|
|
|
|
Resend a connect message if the last one has timed out
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_CheckForResend (void)
|
|
|
|
{
|
2003-07-08 22:39:45 +00:00
|
|
|
static const char *getchallenge = "\377\377\377\377getchallenge\n";
|
2001-02-19 21:15:25 +00:00
|
|
|
double t1, t2;
|
|
|
|
|
|
|
|
if (connect_time == -1)
|
|
|
|
return;
|
|
|
|
if (cls.state != ca_disconnected)
|
|
|
|
return;
|
|
|
|
if (connect_time && realtime - connect_time < 5.0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
t1 = Sys_DoubleTime ();
|
2010-08-24 07:20:07 +00:00
|
|
|
if (!NET_StringToAdr (cls.servername->str, &cls.server_addr)) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Bad server address\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
connect_time = -1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-12-05 21:56:52 +00:00
|
|
|
if (cls.server_addr.port == 0)
|
|
|
|
cls.server_addr.port = BigShort (27500);
|
2001-02-19 21:15:25 +00:00
|
|
|
t2 = Sys_DoubleTime ();
|
|
|
|
|
|
|
|
connect_time = realtime + t2 - t1; // for retransmit requests
|
|
|
|
|
2021-01-31 07:01:20 +00:00
|
|
|
VID_SetCaption (va (0, "Connecting to %s", cls.servername->str));
|
2010-08-24 07:20:07 +00:00
|
|
|
Sys_Printf ("Connecting to %s...\n", cls.servername->str);
|
2003-07-08 22:39:45 +00:00
|
|
|
Netchan_SendPacket (strlen (getchallenge), (void *) getchallenge,
|
|
|
|
cls.server_addr);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CL_BeginServerConnect (void)
|
|
|
|
{
|
|
|
|
connect_time = 0;
|
|
|
|
CL_CheckForResend ();
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Connect_f (void)
|
|
|
|
{
|
2001-07-15 07:04:17 +00:00
|
|
|
const char *server;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
if (Cmd_Argc () != 2) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("usage: connect <server>\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
server = Cmd_Argv (1);
|
|
|
|
|
|
|
|
CL_Disconnect ();
|
2003-07-18 06:27:26 +00:00
|
|
|
CL_Chat_Flush_Ignores ();
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2010-08-24 07:20:07 +00:00
|
|
|
dstring_copystr (cls.servername, server);
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_BeginServerConnect ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_Rcon_f
|
|
|
|
|
|
|
|
Send the rest of the command line over as
|
|
|
|
an unconnected command.
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Rcon_f (void)
|
|
|
|
{
|
|
|
|
netadr_t to;
|
|
|
|
|
|
|
|
if (cls.state >= ca_connected)
|
|
|
|
to = cls.netchan.remote_address;
|
|
|
|
else {
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (!rcon_address[0]) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("You must either be connected, or set the "
|
2002-09-28 02:33:39 +00:00
|
|
|
"'rcon_address' cvar to issue rcon commands\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
NET_StringToAdr (rcon_address, &to);
|
2001-09-26 21:06:51 +00:00
|
|
|
if (to.port == 0)
|
|
|
|
to.port = BigShort (27500);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2022-05-12 10:47:11 +00:00
|
|
|
|
|
|
|
const char *message;
|
|
|
|
message = va (0, "\377\377\377\377rcon %s %s", rcon_password, Cmd_Args (1));
|
|
|
|
Netchan_SendPacket (strlen (message) + 1, message, to);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CL_ClearState (void)
|
|
|
|
{
|
2002-10-04 02:29:03 +00:00
|
|
|
int i;
|
|
|
|
|
2007-03-17 03:10:45 +00:00
|
|
|
S_StopAllSounds ();
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
if (Entity_Valid (cl.viewstate.weapon_entity)) {
|
2022-03-04 16:48:10 +00:00
|
|
|
Scene_DestroyEntity (cl_world.scene, cl.viewstate.weapon_entity);
|
|
|
|
}
|
2002-06-14 07:55:19 +00:00
|
|
|
// wipe the entire cl structure
|
2012-02-01 12:52:47 +00:00
|
|
|
if (cl.serverinfo)
|
|
|
|
Info_Destroy (cl.serverinfo);
|
2022-11-09 03:50:05 +00:00
|
|
|
__auto_type players = cl.players;
|
2022-02-28 07:59:38 +00:00
|
|
|
__auto_type cam = cl.viewstate.camera_transform;
|
2002-06-14 07:55:19 +00:00
|
|
|
memset (&cl, 0, sizeof (cl));
|
2022-02-28 07:59:38 +00:00
|
|
|
cl.viewstate.camera_transform = cam;
|
2022-11-09 03:50:05 +00:00
|
|
|
cl.players = players;
|
2022-03-18 15:56:30 +00:00
|
|
|
SCR_SetFullscreen (0);
|
2004-07-11 01:41:01 +00:00
|
|
|
|
2012-05-31 23:19:22 +00:00
|
|
|
cl.maxclients = MAX_CLIENTS;
|
2022-02-25 06:48:57 +00:00
|
|
|
cl.viewstate.voffs_enabled = 0;
|
|
|
|
cl.viewstate.chasestate = &cl.chasestate;
|
2022-03-04 16:14:43 +00:00
|
|
|
cl.chasestate.viewstate = &cl.viewstate;
|
|
|
|
cl.viewstate.punchangle = (vec4f_t) {0, 0, 0, 1};
|
|
|
|
|
2012-01-23 10:24:12 +00:00
|
|
|
// Note: we should probably hack around this and give diff values for
|
|
|
|
// diff gamedirs
|
2004-07-11 01:41:01 +00:00
|
|
|
cl.fpd = FPD_DEFAULT;
|
|
|
|
cl.fbskins = FBSKINS_DEFAULT;
|
|
|
|
|
2002-10-04 02:29:03 +00:00
|
|
|
for (i = 0; i < UPDATE_BACKUP; i++)
|
2012-07-01 02:36:47 +00:00
|
|
|
cl.frames[i].packet_entities.entities = qw_entstates.frame[i];
|
2003-02-19 17:39:21 +00:00
|
|
|
cl.serverinfo = Info_ParseString ("", MAX_INFO_STRING, 0);
|
2002-06-14 07:55:19 +00:00
|
|
|
|
2021-03-29 10:58:00 +00:00
|
|
|
Sys_MaskPrintf (SYS_dev, "Clearing memory\n");
|
2019-07-08 03:46:22 +00:00
|
|
|
VID_ClearMemory ();
|
2001-02-19 21:15:25 +00:00
|
|
|
Mod_ClearAll ();
|
|
|
|
if (host_hunklevel) // FIXME: check this...
|
2021-07-28 06:01:45 +00:00
|
|
|
Hunk_FreeToLowMark (0, host_hunklevel);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
CL_ClearEnts ();
|
|
|
|
CL_ClearTEnts ();
|
|
|
|
|
2022-03-04 16:48:10 +00:00
|
|
|
cl.viewstate.weapon_entity = Scene_CreateEntity (cl_world.scene);
|
|
|
|
CL_Init_Entity (cl.viewstate.weapon_entity);
|
|
|
|
r_data->view_model = cl.viewstate.weapon_entity;
|
|
|
|
|
2022-05-13 12:24:45 +00:00
|
|
|
CL_TEnts_Precache ();
|
|
|
|
|
2022-05-11 05:16:23 +00:00
|
|
|
SCR_NewScene (0);
|
2001-05-20 01:58:59 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
SZ_Clear (&cls.netchan.message);
|
|
|
|
|
2022-11-04 03:51:43 +00:00
|
|
|
Sbar_CenterPrint (0);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2001-04-20 13:33:56 +00:00
|
|
|
/*
|
|
|
|
CL_StopCshifts
|
|
|
|
|
|
|
|
Cleans the Cshifts, so your screen doesn't stay red after a timedemo :)
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-04-20 13:33:56 +00:00
|
|
|
CL_StopCshifts (void)
|
|
|
|
{
|
|
|
|
int i;
|
2001-08-28 23:05:45 +00:00
|
|
|
|
2001-04-20 13:33:56 +00:00
|
|
|
for (i = 0; i < NUM_CSHIFTS; i++)
|
2022-02-25 06:48:57 +00:00
|
|
|
cl.viewstate.cshifts[i].percent = 0;
|
2001-04-20 13:33:56 +00:00
|
|
|
for (i = 0; i < MAX_CL_STATS; i++)
|
|
|
|
cl.stats[i] = 0;
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-11-05 19:12:51 +00:00
|
|
|
CL_RemoveQFInfoKeys (void)
|
|
|
|
{
|
|
|
|
Info_RemoveKey (cls.userinfo, "*cap");
|
|
|
|
Info_RemoveKey (cls.userinfo, "*qf_version");
|
|
|
|
Info_RemoveKey (cls.userinfo, "*qsg_version");
|
|
|
|
}
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
/*
|
|
|
|
CL_Disconnect
|
|
|
|
|
|
|
|
Sends a disconnect message to the server
|
|
|
|
This is also called on Host_Error, so it shouldn't cause any errors
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
CL_Disconnect (void)
|
|
|
|
{
|
|
|
|
byte final[10];
|
2002-05-11 00:36:12 +00:00
|
|
|
int i;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
connect_time = -1;
|
|
|
|
|
|
|
|
VID_SetCaption ("Disconnected");
|
|
|
|
|
2001-05-13 23:15:34 +00:00
|
|
|
// stop sounds (especially looping!)
|
2007-03-17 03:10:45 +00:00
|
|
|
S_StopAllSounds ();
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-05-13 23:15:34 +00:00
|
|
|
// Clean the Cshifts
|
2001-04-20 13:33:56 +00:00
|
|
|
CL_StopCshifts ();
|
|
|
|
|
2001-05-13 23:15:34 +00:00
|
|
|
// if running a local server, shut it down
|
2001-02-19 21:15:25 +00:00
|
|
|
if (cls.demoplayback)
|
|
|
|
CL_StopPlayback ();
|
|
|
|
else if (cls.state != ca_disconnected) {
|
|
|
|
if (cls.demorecording)
|
2011-08-24 11:33:05 +00:00
|
|
|
CL_StopRecording ();
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
final[0] = clc_stringcmd;
|
2005-06-08 06:35:48 +00:00
|
|
|
strcpy ((char *) final + 1, "drop");
|
2001-02-19 21:15:25 +00:00
|
|
|
Netchan_Transmit (&cls.netchan, 6, final);
|
|
|
|
Netchan_Transmit (&cls.netchan, 6, final);
|
|
|
|
Netchan_Transmit (&cls.netchan, 6, final);
|
|
|
|
|
2001-08-19 03:51:52 +00:00
|
|
|
CL_SetState (ca_disconnected);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
cls.demoplayback = cls.demorecording = cls.timedemo = false;
|
2002-10-02 21:56:45 +00:00
|
|
|
cls.demoplayback2 = false;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
CL_RemoveQFInfoKeys ();
|
|
|
|
}
|
|
|
|
Cam_Reset ();
|
|
|
|
|
|
|
|
if (cls.download) {
|
2007-03-20 14:16:43 +00:00
|
|
|
CL_HTTP_Reset ();
|
|
|
|
dstring_clearstr (cls.downloadname);
|
|
|
|
dstring_clearstr (cls.downloadurl);
|
|
|
|
dstring_clearstr (cls.downloadtempname);
|
2001-02-19 21:15:25 +00:00
|
|
|
Qclose (cls.download);
|
|
|
|
cls.download = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
CL_StopUpload ();
|
|
|
|
|
2001-11-05 07:23:51 +00:00
|
|
|
Team_ResetTimers ();
|
|
|
|
|
2002-05-11 00:36:12 +00:00
|
|
|
// remove player info strings
|
2003-05-30 20:16:30 +00:00
|
|
|
for (i = 0; i < MAX_CLIENTS; i++) {
|
|
|
|
if (cl.players[i].userinfo)
|
2002-05-11 00:36:12 +00:00
|
|
|
Info_Destroy (cl.players[i].userinfo);
|
2003-05-30 20:16:30 +00:00
|
|
|
memset (&cl.players[i], 0, sizeof (cl.players[i]));
|
|
|
|
}
|
2022-05-05 05:41:46 +00:00
|
|
|
cl_world.scene->worldmodel = NULL;
|
2002-09-09 04:20:15 +00:00
|
|
|
cl.validsequence = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CL_Disconnect_f (void)
|
|
|
|
{
|
|
|
|
CL_Disconnect ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_User_f
|
|
|
|
|
|
|
|
user <name or userid>
|
|
|
|
|
|
|
|
Dump userdata / masterdata for a user
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_User_f (void)
|
|
|
|
{
|
2001-08-28 23:05:45 +00:00
|
|
|
int uid, i;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
if (Cmd_Argc () != 2) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Usage: user <username / userid>\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uid = atoi (Cmd_Argv (1));
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_CLIENTS; i++) {
|
2012-05-21 14:04:47 +00:00
|
|
|
if (!cl.players[i].name->value[0])
|
2001-02-19 21:15:25 +00:00
|
|
|
continue;
|
|
|
|
if (cl.players[i].userid == uid
|
2012-05-21 14:04:47 +00:00
|
|
|
|| !strcmp (cl.players[i].name->value, Cmd_Argv (1))) {
|
2001-02-19 21:15:25 +00:00
|
|
|
Info_Print (cl.players[i].userinfo);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("User not in server.\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_Users_f
|
|
|
|
|
|
|
|
Dump userids for all current players
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Users_f (void)
|
|
|
|
{
|
2001-08-28 23:05:45 +00:00
|
|
|
int c, i;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
c = 0;
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("userid frags name\n");
|
|
|
|
Sys_Printf ("------ ----- ----\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
for (i = 0; i < MAX_CLIENTS; i++) {
|
2012-06-29 08:58:15 +00:00
|
|
|
if (cl.players[i].name && cl.players[i].name->value[0]) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("%6i %4i %s\n", cl.players[i].userid,
|
2012-05-21 14:04:47 +00:00
|
|
|
cl.players[i].frags, cl.players[i].name->value);
|
2001-02-19 21:15:25 +00:00
|
|
|
c++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("%i total users\n", c);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_FullServerinfo_f
|
|
|
|
|
|
|
|
Sent by server when serverinfo changes
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_FullServerinfo_f (void)
|
|
|
|
{
|
2001-07-15 07:04:17 +00:00
|
|
|
const char *p;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
if (Cmd_Argc () != 2) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("usage: fullserverinfo <complete info string>\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-29 10:58:00 +00:00
|
|
|
Sys_MaskPrintf (SYS_dev, "Cmd_Argv (1): '%s'\n", Cmd_Argv (1));
|
2001-11-04 07:50:39 +00:00
|
|
|
Info_Destroy (cl.serverinfo);
|
2003-02-19 17:39:21 +00:00
|
|
|
cl.serverinfo = Info_ParseString (Cmd_Argv (1), MAX_SERVERINFO_STRING, 0);
|
2021-03-29 10:58:00 +00:00
|
|
|
Sys_MaskPrintf (SYS_dev, "cl.serverinfo: '%s'\n",
|
2010-11-23 05:09:30 +00:00
|
|
|
Info_MakeString (cl.serverinfo, 0));
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
if ((p = Info_ValueForKey (cl.serverinfo, "*qf_version")) && *p) {
|
|
|
|
if (server_version == NULL)
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("QuakeForge v%s Server\n", p);
|
2001-02-19 21:15:25 +00:00
|
|
|
server_version = strdup (p);
|
|
|
|
} else if ((p = Info_ValueForKey (cl.serverinfo, "*version")) && *p) {
|
|
|
|
if (server_version == NULL)
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("QuakeWorld v%s Server\n", p);
|
2001-02-19 21:15:25 +00:00
|
|
|
server_version = strdup (p);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((p = Info_ValueForKey (cl.serverinfo, "*qsg_version")) && *p) {
|
2001-09-11 03:50:24 +00:00
|
|
|
if ((cl.stdver = atof (p)))
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Server supports QSG v%s protocol\n", p);
|
2001-02-19 21:15:25 +00:00
|
|
|
else
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Invalid QSG Protocol number: %s", p);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2001-11-11 07:02:38 +00:00
|
|
|
|
2022-02-25 06:48:57 +00:00
|
|
|
cl.viewstate.chase = cl.sv_cshifts = cl.no_pogo_stick = cl.teamplay = 0;
|
2001-10-01 01:51:36 +00:00
|
|
|
if ((p = Info_ValueForKey (cl.serverinfo, "chase")) && *p) {
|
2022-02-25 06:48:57 +00:00
|
|
|
cl.viewstate.chase = atoi (p);
|
2001-11-11 07:02:38 +00:00
|
|
|
}
|
2022-03-04 16:14:43 +00:00
|
|
|
cl.viewstate.chase |= cls.demoplayback;
|
2001-11-11 07:02:38 +00:00
|
|
|
if ((p = Info_ValueForKey (cl.serverinfo, "cshifts")) && *p) {
|
|
|
|
cl.sv_cshifts = atoi (p);
|
2001-10-01 01:51:36 +00:00
|
|
|
}
|
2001-11-04 19:06:50 +00:00
|
|
|
if ((p = Info_ValueForKey (cl.serverinfo, "no_pogo_stick")) && *p) {
|
2001-11-11 07:02:38 +00:00
|
|
|
cl.no_pogo_stick = atoi (p);
|
2001-11-04 19:06:50 +00:00
|
|
|
}
|
|
|
|
if ((p = Info_ValueForKey (cl.serverinfo, "teamplay")) && *p) {
|
2001-11-11 07:02:38 +00:00
|
|
|
cl.teamplay = atoi (p);
|
2022-11-09 03:50:05 +00:00
|
|
|
Sbar_SetTeamplay (cl.teamplay);
|
2001-11-04 19:06:50 +00:00
|
|
|
}
|
2001-10-01 01:51:36 +00:00
|
|
|
if ((p = Info_ValueForKey (cl.serverinfo, "watervis")) && *p) {
|
2022-11-02 06:08:09 +00:00
|
|
|
cl.viewstate.watervis = atoi (p);
|
2001-10-01 01:51:36 +00:00
|
|
|
}
|
2004-07-11 01:41:01 +00:00
|
|
|
if ((p = Info_ValueForKey (cl.serverinfo, "fpd")) && *p) {
|
|
|
|
cl.fpd = atoi (p);
|
|
|
|
}
|
|
|
|
if ((p = Info_ValueForKey (cl.serverinfo, "fbskins")) && *p) {
|
|
|
|
cl.fbskins = atoi (p);
|
|
|
|
}
|
2010-12-28 20:02:56 +00:00
|
|
|
|
2010-12-27 14:12:46 +00:00
|
|
|
// R_LoadSkys does the right thing with null pointers.
|
2012-02-14 10:47:02 +00:00
|
|
|
r_funcs->R_LoadSkys (Info_ValueForKey (cl.serverinfo, "sky"));
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_AddQFInfoKeys (void)
|
|
|
|
{
|
2001-12-19 00:40:34 +00:00
|
|
|
// set the capabilities info. single char flags (possibly with modifiers)
|
2001-02-19 21:15:25 +00:00
|
|
|
// defined capabilities (* = not implemented):
|
|
|
|
// z client can accept gzipped files.
|
2007-03-21 11:56:25 +00:00
|
|
|
// h http transfers
|
|
|
|
// f * ftp transfers
|
|
|
|
// a * audio channel (voice chat)
|
|
|
|
// i * irc
|
|
|
|
// p pogo stick control
|
|
|
|
// t team messages
|
2007-05-07 14:58:53 +00:00
|
|
|
static const char *cap = "pt"
|
2001-02-19 21:15:25 +00:00
|
|
|
#ifdef HAVE_ZLIB
|
2003-07-08 22:39:45 +00:00
|
|
|
"z"
|
2007-03-20 14:16:43 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LIBCURL
|
|
|
|
"h"
|
2001-02-19 21:15:25 +00:00
|
|
|
#endif
|
2003-07-08 22:39:45 +00:00
|
|
|
;
|
|
|
|
|
2001-11-04 07:50:39 +00:00
|
|
|
Info_SetValueForStarKey (cls.userinfo, "*cap", cap, 0);
|
2010-08-19 06:01:43 +00:00
|
|
|
Info_SetValueForStarKey (cls.userinfo, "*qf_version", PACKAGE_VERSION, 0);
|
2001-11-04 07:50:39 +00:00
|
|
|
Info_SetValueForStarKey (cls.userinfo, "*qsg_version", QW_QSG_VERSION, 0);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_FullInfo_f
|
|
|
|
|
|
|
|
Allow clients to change userinfo
|
|
|
|
Casey was here :)
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_FullInfo_f (void)
|
|
|
|
{
|
2003-08-05 01:45:52 +00:00
|
|
|
info_t *info;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
if (Cmd_Argc () != 2) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("fullinfo <complete info string>\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-08-05 01:45:52 +00:00
|
|
|
info = Info_ParseString (Cmd_Argv (1), MAX_INFO_STRING, 0);
|
|
|
|
Info_AddKeys (cls.userinfo, info);
|
|
|
|
Info_Destroy (info);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_SetInfo_f
|
|
|
|
|
|
|
|
Allow clients to change userinfo
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_SetInfo_f (void)
|
|
|
|
{
|
|
|
|
if (Cmd_Argc () == 1) {
|
|
|
|
Info_Print (cls.userinfo);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (Cmd_Argc () != 3) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("usage: setinfo [ <key> <value> ]\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-06-02 22:20:34 +00:00
|
|
|
if (strcaseequal (Cmd_Argv (1), pmodel_name)
|
|
|
|
|| strcaseequal (Cmd_Argv (1), emodel_name))
|
|
|
|
return;
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
Info_SetValueForKey (cls.userinfo, Cmd_Argv (1), Cmd_Argv (2),
|
2002-07-03 05:40:33 +00:00
|
|
|
(!strequal (Cmd_Argv (1), "name")) |
|
|
|
|
(strequal (Cmd_Argv (2), "team") << 1));
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_Packet_f
|
|
|
|
|
|
|
|
packet <destination> <contents>
|
|
|
|
Contents allows \n escape character
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Packet_f (void)
|
|
|
|
{
|
2003-07-08 22:39:45 +00:00
|
|
|
char *send;
|
2001-07-15 07:04:17 +00:00
|
|
|
char *out;
|
2001-08-28 23:05:45 +00:00
|
|
|
const char *in;
|
|
|
|
int i, l;
|
2001-02-19 21:15:25 +00:00
|
|
|
netadr_t adr;
|
|
|
|
|
|
|
|
if (Cmd_Argc () != 3) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("packet <destination> <contents>\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!NET_StringToAdr (Cmd_Argv (1), &adr)) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Bad address\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
in = Cmd_Argv (2);
|
2003-07-08 22:39:45 +00:00
|
|
|
send = malloc (strlen (in) + 4 + 1);
|
2001-02-19 21:15:25 +00:00
|
|
|
out = send + 4;
|
|
|
|
send[0] = send[1] = send[2] = send[3] = 0xff;
|
|
|
|
|
|
|
|
l = strlen (in);
|
|
|
|
for (i = 0; i < l; i++) {
|
|
|
|
if (in[i] == '\\' && in[i + 1] == 'n') {
|
|
|
|
*out++ = '\n';
|
|
|
|
i++;
|
|
|
|
} else
|
|
|
|
*out++ = in[i];
|
|
|
|
}
|
|
|
|
*out = 0;
|
|
|
|
|
2003-02-10 21:41:22 +00:00
|
|
|
Netchan_SendPacket (out - send, send, adr);
|
2003-07-08 22:39:45 +00:00
|
|
|
free (send);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_NextDemo
|
|
|
|
|
|
|
|
Called to play the next demo in the demo loop
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
CL_NextDemo (void)
|
|
|
|
{
|
|
|
|
if (cls.demonum == -1)
|
|
|
|
return; // don't play demos
|
|
|
|
|
|
|
|
if (!cls.demos[cls.demonum][0] || cls.demonum == MAX_DEMOS) {
|
|
|
|
cls.demonum = 0;
|
|
|
|
if (!cls.demos[cls.demonum][0]) {
|
|
|
|
cls.demonum = -1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-31 07:01:20 +00:00
|
|
|
Cbuf_InsertText (cl_cbuf, va (0, "playdemo %s\n", cls.demos[cls.demonum]));
|
2001-02-19 21:15:25 +00:00
|
|
|
cls.demonum++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_Changing_f
|
|
|
|
|
2010-01-13 06:50:44 +00:00
|
|
|
Sent as just a hint to the client that they should
|
2001-02-19 21:15:25 +00:00
|
|
|
drop to full console
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Changing_f (void)
|
|
|
|
{
|
|
|
|
if (cls.download) // don't change when downloading
|
|
|
|
return;
|
|
|
|
|
2007-03-17 03:10:45 +00:00
|
|
|
S_StopAllSounds ();
|
2001-02-19 21:15:25 +00:00
|
|
|
cl.intermission = 0;
|
2022-02-25 06:48:57 +00:00
|
|
|
cl.viewstate.intermission = 0;
|
2022-03-18 15:56:30 +00:00
|
|
|
SCR_SetFullscreen (0);
|
2001-08-19 03:51:52 +00:00
|
|
|
CL_SetState (ca_connected); // not active anymore, but not
|
2001-02-19 21:15:25 +00:00
|
|
|
// disconnected
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("\nChanging map...\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_Reconnect_f
|
|
|
|
|
|
|
|
The server is changing levels
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Reconnect_f (void)
|
|
|
|
{
|
|
|
|
if (cls.download) // don't change when downloading
|
|
|
|
return;
|
2002-10-07 03:58:08 +00:00
|
|
|
if (cls.demoplayback)
|
|
|
|
return;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2007-03-17 03:10:45 +00:00
|
|
|
S_StopAllSounds ();
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
if (cls.state == ca_connected) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("reconnecting...\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
VID_SetCaption ("Reconnecting");
|
2002-07-02 19:13:53 +00:00
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
2001-02-19 21:15:25 +00:00
|
|
|
MSG_WriteString (&cls.netchan.message, "new");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-08-24 07:20:07 +00:00
|
|
|
if (!*cls.servername->str) {
|
|
|
|
Sys_Printf ("No server to which to reconnect...\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CL_Disconnect ();
|
|
|
|
CL_BeginServerConnect ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_ConnectionlessPacket
|
|
|
|
|
|
|
|
Responses to broadcasts, etc
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_ConnectionlessPacket (void)
|
|
|
|
{
|
2001-10-18 06:23:26 +00:00
|
|
|
const char *s;
|
2011-06-19 01:48:02 +00:00
|
|
|
int c;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-23 23:16:13 +00:00
|
|
|
MSG_BeginReading (net_message);
|
|
|
|
MSG_ReadLong (net_message); // skip the -1
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-23 23:16:13 +00:00
|
|
|
c = MSG_ReadByte (net_message);
|
2010-04-26 12:41:04 +00:00
|
|
|
if (net_message->badread)
|
|
|
|
return;
|
2001-12-05 21:56:52 +00:00
|
|
|
if (!cls.demoplayback
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
&& (cl_paranoid
|
2001-12-05 21:56:52 +00:00
|
|
|
|| !NET_CompareAdr (net_from, cls.server_addr)))
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("%s: ", NET_AdrToString (net_from));
|
2001-02-19 21:15:25 +00:00
|
|
|
if (c == S2C_CONNECTION) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("connection\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
if (cls.state >= ca_connected) {
|
|
|
|
if (!cls.demoplayback)
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Dup connect received. Ignored.\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-07-23 08:51:07 +00:00
|
|
|
Netchan_Setup (&cls.netchan, net_from, cls.qport, NC_QPORT_SEND);
|
2002-07-02 19:13:53 +00:00
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
2001-02-19 21:15:25 +00:00
|
|
|
MSG_WriteString (&cls.netchan.message, "new");
|
2001-08-19 03:51:52 +00:00
|
|
|
CL_SetState (ca_connected);
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Connected.\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
allowremotecmd = false; // localid required now for remote
|
|
|
|
// cmds
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// remote command from gui front end
|
|
|
|
if (c == A2C_CLIENT_COMMAND) {
|
2003-07-08 22:39:45 +00:00
|
|
|
char *cmdtext;
|
2001-10-18 06:23:26 +00:00
|
|
|
int len;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("client command\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (!cl_allow_cmd_pkt
|
2004-04-13 02:23:20 +00:00
|
|
|
|| (!NET_CompareBaseAdr (net_from, net_local_adr)
|
|
|
|
&& !NET_CompareBaseAdr (net_from, net_loopback_adr)
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
&& (!cl_cmd_pkt_adr[0]
|
2004-04-13 02:23:20 +00:00
|
|
|
|| !NET_CompareBaseAdr (net_from,
|
|
|
|
cl_cmd_packet_address)))) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Command packet from remote host. Ignored.\n");
|
2004-04-13 02:23:20 +00:00
|
|
|
return;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (cl_cmd_pkt_adr[0]
|
2004-04-13 02:23:20 +00:00
|
|
|
&& NET_CompareBaseAdr (net_from, cl_cmd_packet_address))
|
|
|
|
allowremotecmd = false; // force password checking
|
2001-10-18 06:23:26 +00:00
|
|
|
s = MSG_ReadString (net_message);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-07-08 22:39:45 +00:00
|
|
|
cmdtext = alloca (strlen (s) + 1);
|
|
|
|
strcpy (cmdtext, s);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-10-18 06:23:26 +00:00
|
|
|
s = MSG_ReadString (net_message);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-08-02 03:22:32 +00:00
|
|
|
while (*s && isspace ((byte) *s))
|
2001-02-19 21:15:25 +00:00
|
|
|
s++;
|
2001-10-18 06:23:26 +00:00
|
|
|
len = strlen (s);
|
|
|
|
while (len && isspace ((byte) s[len - 1]))
|
|
|
|
len--;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (!allowremotecmd && (!*localid ||
|
|
|
|
(int) strlen (localid) > len ||
|
|
|
|
strncmp (localid, s, len))) {
|
|
|
|
if (!*localid) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("===========================\n");
|
|
|
|
Sys_Printf ("Command packet received from local host, but no "
|
2001-08-28 23:05:45 +00:00
|
|
|
"localid has been set. You may need to upgrade "
|
|
|
|
"your server browser.\n");
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("===========================\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("===========================\n");
|
|
|
|
Sys_Printf
|
2001-02-19 21:15:25 +00:00
|
|
|
("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,
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
localid, PACKAGE_NAME);
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("===========================\n");
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
Cvar_Set ("localid", "");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("%s\n", cmdtext);
|
2002-07-31 05:19:03 +00:00
|
|
|
Cbuf_AddText (cl_cbuf, cmdtext);
|
2001-02-19 21:15:25 +00:00
|
|
|
allowremotecmd = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// print command from somewhere
|
|
|
|
if (c == A2C_PRINT) {
|
2001-10-18 06:23:26 +00:00
|
|
|
s = MSG_ReadString (net_message);
|
2003-03-21 21:25:44 +00:00
|
|
|
if (SL_CheckStatus (NET_AdrToString (net_from), s))
|
2001-06-09 09:12:24 +00:00
|
|
|
{
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("status response\n");
|
2001-06-09 09:12:24 +00:00
|
|
|
return;
|
2002-09-04 19:13:45 +00:00
|
|
|
} else if (!cls.demoplayback
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
&& (cl_paranoid
|
2002-09-04 19:13:45 +00:00
|
|
|
|| !NET_CompareAdr (net_from, cls.server_addr))) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("print\n");
|
2002-09-04 19:13:45 +00:00
|
|
|
}
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("%s", s);
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// ping from somewhere
|
|
|
|
if (c == A2A_PING) {
|
|
|
|
char data[6];
|
|
|
|
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("ping\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
data[0] = 0xff;
|
|
|
|
data[1] = 0xff;
|
|
|
|
data[2] = 0xff;
|
|
|
|
data[3] = 0xff;
|
|
|
|
data[4] = A2A_ACK;
|
|
|
|
data[5] = 0;
|
|
|
|
|
2003-02-10 21:41:22 +00:00
|
|
|
Netchan_SendPacket (6, &data, net_from);
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (c == S2C_CHALLENGE) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("challenge");
|
2002-07-03 18:29:36 +00:00
|
|
|
if (cls.state >= ca_connected) {
|
|
|
|
if (!cls.demoplayback)
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("\nDup challenge received. Ignored.\n");
|
2002-07-03 18:29:36 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-10-18 06:23:26 +00:00
|
|
|
s = MSG_ReadString (net_message);
|
2001-02-19 21:15:25 +00:00
|
|
|
cls.challenge = atoi (s);
|
2001-12-05 21:56:52 +00:00
|
|
|
if (strstr (s, "QF")) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf (": QuakeForge server detected\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_AddQFInfoKeys ();
|
2007-03-21 11:53:56 +00:00
|
|
|
} else if (strstr (s, "EXT")) {
|
|
|
|
CL_AddQFInfoKeys ();
|
2001-12-05 21:56:52 +00:00
|
|
|
} else {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("\n");
|
2001-12-05 21:56:52 +00:00
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_SendConnectPacket ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-04-03 05:48:24 +00:00
|
|
|
if (c == M2C_MASTER_REPLY)
|
|
|
|
{
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Master Server Reply\n");
|
2011-06-19 01:48:02 +00:00
|
|
|
MSG_ReadByte (net_message);
|
2001-10-18 06:23:26 +00:00
|
|
|
s = MSG_ReadString (net_message);
|
2003-03-21 21:25:44 +00:00
|
|
|
MSL_ParseServerList (s);
|
2001-04-03 05:48:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
if (c == svc_disconnect) {
|
|
|
|
if (cls.demoplayback)
|
|
|
|
Host_EndGame ("End of demo");
|
|
|
|
else
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("svc_disconnect\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("unknown: %c\n", c);
|
2012-05-21 23:23:22 +00:00
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
CL_ReadPackets (void)
|
|
|
|
{
|
|
|
|
while (CL_GetMessage ()) {
|
|
|
|
|
2021-04-04 06:53:53 +00:00
|
|
|
// non-packet set up by the demo reader
|
|
|
|
if ((int) net_message->message->cursize == -1) {
|
2002-03-15 07:35:22 +00:00
|
|
|
continue;
|
2021-04-04 06:53:53 +00:00
|
|
|
}
|
2002-03-15 07:35:22 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (cls.demoplayback && net_packetlog)
|
2003-03-21 21:25:44 +00:00
|
|
|
Log_Incoming_Packet (net_message->message->data,
|
2022-02-06 10:47:22 +00:00
|
|
|
net_message->message->cursize, 0);
|
2001-05-14 03:08:24 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
// remote command packet
|
2001-02-23 23:16:13 +00:00
|
|
|
if (*(int *) net_message->message->data == -1) {
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_ConnectionlessPacket ();
|
|
|
|
continue;
|
|
|
|
}
|
2021-07-11 00:26:05 +00:00
|
|
|
if (net_message->message->cursize == 1
|
|
|
|
&& *(char *) net_message->message->data == A2A_ACK) {
|
|
|
|
Sys_Printf ("ping ack\n");
|
2001-06-09 09:12:24 +00:00
|
|
|
SL_CheckPing (NET_AdrToString (net_from));
|
2001-02-19 21:15:25 +00:00
|
|
|
continue;
|
|
|
|
}
|
2002-10-02 21:56:45 +00:00
|
|
|
if (net_message->message->cursize < 8 && !cls.demoplayback2) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("%s: Runt packet\n", NET_AdrToString (net_from));
|
2001-02-19 21:15:25 +00:00
|
|
|
continue;
|
|
|
|
}
|
2001-05-14 03:08:24 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
// packet from server
|
|
|
|
if (!cls.demoplayback &&
|
|
|
|
!NET_CompareAdr (net_from, cls.netchan.remote_address)) {
|
2021-03-29 10:58:00 +00:00
|
|
|
Sys_MaskPrintf (SYS_dev,
|
2010-11-23 05:09:30 +00:00
|
|
|
"%s:sequenced packet without connection\n",
|
|
|
|
NET_AdrToString (net_from));
|
2001-02-19 21:15:25 +00:00
|
|
|
continue;
|
|
|
|
}
|
2002-10-02 21:56:45 +00:00
|
|
|
if (!cls.demoplayback2) {
|
|
|
|
if (!Netchan_Process (&cls.netchan))
|
|
|
|
continue; // wasn't accepted for some reason
|
|
|
|
} else {
|
|
|
|
MSG_BeginReading (net_message);
|
|
|
|
}
|
2002-09-08 03:21:53 +00:00
|
|
|
if (cls.state != ca_disconnected)
|
|
|
|
CL_ParseServerMessage ();
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// check timeout
|
2002-10-02 21:56:45 +00:00
|
|
|
if (!cls.demoplayback && cls.state >= ca_connected
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
&& realtime - cls.netchan.last_received > cl_timeout) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("\nServer connection timed out.\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Disconnect ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Download_f (void)
|
|
|
|
{
|
2002-10-07 03:58:08 +00:00
|
|
|
if (cls.state == ca_disconnected || cls.demoplayback) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Must be connected.\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Cmd_Argc () != 2) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Usage: download <datafile>\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-03-24 13:57:07 +00:00
|
|
|
dstring_copystr (cls.downloadname, Cmd_Argv (1));
|
|
|
|
dstring_copystr (cls.downloadtempname, Cmd_Argv (1));
|
|
|
|
|
|
|
|
QFS_StripExtension (cls.downloadname->str, cls.downloadtempname->str);
|
|
|
|
dstring_appendstr (cls.downloadtempname, ".tmp");
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2007-03-20 14:16:43 +00:00
|
|
|
cls.download = QFS_WOpen (cls.downloadname->str, 0);
|
2001-02-19 21:15:25 +00:00
|
|
|
if (cls.download) {
|
|
|
|
cls.downloadtype = dl_single;
|
|
|
|
|
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
2021-01-31 07:01:20 +00:00
|
|
|
SZ_Print (&cls.netchan.message, va (0, "download %s\n", Cmd_Argv (1)));
|
2001-02-19 21:15:25 +00:00
|
|
|
} else {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("error downloading %s: %s\n", Cmd_Argv (1),
|
2002-07-03 05:40:33 +00:00
|
|
|
strerror (errno));
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-07-06 17:42:04 +00:00
|
|
|
Force_CenterView_f (void)
|
|
|
|
{
|
2022-03-01 02:43:23 +00:00
|
|
|
cl.viewstate.player_angles[PITCH] = 0;
|
2001-07-06 17:42:04 +00:00
|
|
|
}
|
|
|
|
|
2004-07-11 01:41:01 +00:00
|
|
|
static void
|
|
|
|
CL_PRotate_f (void)
|
|
|
|
{
|
|
|
|
if ((cl.fpd & FPD_LIMIT_PITCH) || Cmd_Argc() < 2)
|
|
|
|
return;
|
|
|
|
|
2022-03-01 02:43:23 +00:00
|
|
|
cl.viewstate.player_angles[PITCH] += atoi (Cmd_Argv (1));
|
2004-07-11 01:41:01 +00:00
|
|
|
|
2022-03-01 02:43:23 +00:00
|
|
|
if (cl.viewstate.player_angles[PITCH] < -70)
|
|
|
|
cl.viewstate.player_angles[PITCH] = -70;
|
|
|
|
else if (cl.viewstate.player_angles[PITCH] > 80)
|
|
|
|
cl.viewstate.player_angles[PITCH] = 80;
|
2004-07-11 01:41:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
CL_Rotate_f (void)
|
|
|
|
{
|
|
|
|
if ((cl.fpd & FPD_LIMIT_YAW) || Cmd_Argc() < 2)
|
|
|
|
return;
|
|
|
|
|
2022-03-01 02:43:23 +00:00
|
|
|
cl.viewstate.player_angles[YAW] += atoi (Cmd_Argv (1));
|
|
|
|
cl.viewstate.player_angles[YAW] = anglemod(cl.viewstate.player_angles[YAW]);
|
2004-07-11 01:41:01 +00:00
|
|
|
}
|
|
|
|
|
2001-08-19 03:51:52 +00:00
|
|
|
void
|
|
|
|
CL_SetState (cactive_t state)
|
|
|
|
{
|
2007-03-20 13:23:17 +00:00
|
|
|
static const char *state_names[] = {
|
|
|
|
"ca_disconnected",
|
|
|
|
"ca_demostate",
|
|
|
|
"ca_connected",
|
|
|
|
"ca_onserver",
|
|
|
|
"ca_active",
|
|
|
|
};
|
2002-07-22 21:25:51 +00:00
|
|
|
cactive_t old_state = cls.state;
|
2007-03-20 13:23:17 +00:00
|
|
|
|
2021-03-29 10:58:00 +00:00
|
|
|
Sys_MaskPrintf (SYS_dev, "CL_SetState (%s)\n", state_names[state]);
|
2001-08-19 03:51:52 +00:00
|
|
|
cls.state = state;
|
2022-02-25 06:48:57 +00:00
|
|
|
cl.viewstate.active = cls.state == ca_active;
|
|
|
|
cl.viewstate.drift_enabled = !cls.demoplayback;
|
2002-07-22 21:25:51 +00:00
|
|
|
if (old_state != state) {
|
|
|
|
if (old_state == ca_active) {
|
|
|
|
// leaving active state
|
2002-07-22 21:47:01 +00:00
|
|
|
IN_ClearStates ();
|
2021-12-02 09:30:57 +00:00
|
|
|
CL_ClearState ();
|
2002-08-27 08:33:21 +00:00
|
|
|
|
2002-07-26 20:50:53 +00:00
|
|
|
// Auto demo recorder stops here
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (cl_autorecord && cls.demorecording)
|
2011-08-24 11:33:05 +00:00
|
|
|
CL_StopRecording ();
|
2021-12-18 02:28:59 +00:00
|
|
|
|
2022-05-11 05:16:23 +00:00
|
|
|
SCR_NewScene (0);
|
2002-07-22 21:25:51 +00:00
|
|
|
} else if (state == ca_active) {
|
|
|
|
// entering active state
|
2010-08-24 07:20:07 +00:00
|
|
|
VID_SetCaption (cls.servername->str);
|
2002-07-22 21:47:01 +00:00
|
|
|
IN_ClearStates ();
|
2002-07-22 21:25:51 +00:00
|
|
|
|
2002-07-26 20:50:53 +00:00
|
|
|
// Auto demo recorder starts here
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (cl_autorecord && !cls.demoplayback
|
2002-07-26 20:50:53 +00:00
|
|
|
&& !cls.demorecording)
|
2011-08-24 11:33:05 +00:00
|
|
|
CL_Record (0, -1);
|
2002-07-22 21:25:51 +00:00
|
|
|
}
|
2022-11-09 03:50:05 +00:00
|
|
|
Sbar_SetActive (state == ca_active);
|
2001-08-19 03:51:52 +00:00
|
|
|
}
|
2021-11-08 02:20:04 +00:00
|
|
|
Con_SetState (state == ca_active ? con_inactive : con_fullscreen);
|
2021-11-11 15:24:04 +00:00
|
|
|
if (state != old_state && state == ca_active) {
|
2022-02-22 06:23:09 +00:00
|
|
|
CL_Input_Activate (!cls.demoplayback);
|
2021-11-11 15:24:04 +00:00
|
|
|
}
|
2001-08-19 03:51:52 +00:00
|
|
|
}
|
|
|
|
|
2022-05-18 00:41:41 +00:00
|
|
|
static void
|
|
|
|
CL_Shutdown (void *data)
|
|
|
|
{
|
|
|
|
static qboolean isdown = false;
|
|
|
|
|
|
|
|
if (isdown) {
|
|
|
|
printf ("recursive shutdown\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
isdown = true;
|
|
|
|
|
|
|
|
SL_Shutdown ();
|
|
|
|
|
|
|
|
Host_WriteConfiguration ();
|
|
|
|
|
|
|
|
CL_HTTP_Shutdown ();
|
|
|
|
|
|
|
|
if (cl.serverinfo) {
|
|
|
|
Info_Destroy (cl.serverinfo);
|
|
|
|
}
|
|
|
|
Info_Destroy (cls.userinfo);
|
|
|
|
Cbuf_DeleteStack (cl_stbuf);
|
|
|
|
dstring_delete (cls.servername);
|
|
|
|
dstring_delete (cls.downloadtempname);
|
|
|
|
dstring_delete (cls.downloadname);
|
|
|
|
dstring_delete (cls.downloadurl);
|
|
|
|
free (cl.players);
|
|
|
|
}
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
void
|
|
|
|
CL_Init (void)
|
|
|
|
{
|
2012-02-01 12:52:47 +00:00
|
|
|
byte *basepal, *colormap;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2014-01-23 02:57:57 +00:00
|
|
|
basepal = (byte *) QFS_LoadHunkFile (QFS_FOpenFile ("gfx/palette.lmp"));
|
2012-02-01 12:52:47 +00:00
|
|
|
if (!basepal)
|
|
|
|
Sys_Error ("Couldn't load gfx/palette.lmp");
|
2014-01-23 02:57:57 +00:00
|
|
|
colormap = (byte *) QFS_LoadHunkFile (QFS_FOpenFile ("gfx/colormap.lmp"));
|
2012-02-01 12:52:47 +00:00
|
|
|
if (!colormap)
|
|
|
|
Sys_Error ("Couldn't load gfx/colormap.lmp");
|
|
|
|
|
|
|
|
W_LoadWadFile ("gfx.wad");
|
|
|
|
VID_Init (basepal, colormap);
|
2021-11-18 06:33:49 +00:00
|
|
|
IN_Init ();
|
2012-02-01 12:52:47 +00:00
|
|
|
Mod_Init ();
|
|
|
|
R_Init ();
|
2012-02-23 12:17:32 +00:00
|
|
|
r_data->lightstyle = cl.lightstyle;
|
2012-02-23 02:23:53 +00:00
|
|
|
|
|
|
|
PI_RegisterPlugins (client_plugin_list);
|
2023-01-20 04:27:17 +00:00
|
|
|
Con_Load ("client");
|
2022-09-21 08:31:18 +00:00
|
|
|
CL_Init_Screen ();
|
2012-02-23 02:23:53 +00:00
|
|
|
if (con_module) {
|
|
|
|
con_module->data->console->dl_name = cls.downloadname;
|
|
|
|
con_module->data->console->dl_percent = &cls.downloadpercent;
|
|
|
|
con_module->data->console->realtime = &con_realtime;
|
|
|
|
con_module->data->console->frametime = &con_frametime;
|
|
|
|
con_module->data->console->quit = CL_Quit_f;
|
2022-05-12 10:47:11 +00:00
|
|
|
//FIXME need to rethink cbuf connections (they can form a stack)
|
|
|
|
Cbuf_DeleteStack (con_module->data->console->cbuf);
|
2012-02-23 02:23:53 +00:00
|
|
|
con_module->data->console->cbuf = cl_cbuf;
|
|
|
|
}
|
2023-01-20 04:27:17 +00:00
|
|
|
Con_Init ();
|
2022-11-02 01:33:06 +00:00
|
|
|
CL_NetGraph_Init ();
|
2012-02-23 02:23:53 +00:00
|
|
|
|
2012-06-24 12:13:51 +00:00
|
|
|
S_Init (&cl.viewentity, &host_frametime);
|
2012-02-01 12:52:47 +00:00
|
|
|
CDAudio_Init ();
|
|
|
|
|
2022-11-09 03:50:05 +00:00
|
|
|
Sbar_Init (cl.stats, cl.item_gettime);
|
2001-05-19 00:05:35 +00:00
|
|
|
|
2022-02-22 06:23:09 +00:00
|
|
|
CL_Init_Input (cl_cbuf);
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Ents_Init ();
|
2021-12-19 04:08:39 +00:00
|
|
|
CL_Particles_Init ();
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_TEnts_Init ();
|
2022-03-04 16:48:10 +00:00
|
|
|
CL_World_Init ();
|
2012-02-01 12:52:47 +00:00
|
|
|
CL_ClearState ();
|
2001-02-19 21:15:25 +00:00
|
|
|
Pmove_Init ();
|
|
|
|
|
2001-06-17 08:14:22 +00:00
|
|
|
SL_Init ();
|
2001-08-28 23:05:45 +00:00
|
|
|
|
2012-02-01 12:52:47 +00:00
|
|
|
CL_Skin_Init ();
|
|
|
|
Locs_Init ();
|
2022-02-28 03:12:51 +00:00
|
|
|
V_Init (&cl.viewstate);
|
2012-02-01 12:52:47 +00:00
|
|
|
|
2022-05-18 00:41:41 +00:00
|
|
|
Sys_RegisterShutdown (CL_Shutdown, 0);
|
|
|
|
|
2012-02-01 12:52:47 +00:00
|
|
|
Info_SetValueForStarKey (cls.userinfo, "*ver", QW_VERSION, 0);
|
|
|
|
|
|
|
|
cls.servername = dstring_newstr ();
|
|
|
|
cls.downloadtempname = dstring_newstr ();
|
|
|
|
cls.downloadname = dstring_newstr ();
|
|
|
|
cls.downloadurl = dstring_newstr ();
|
2022-05-12 10:47:11 +00:00
|
|
|
Info_Destroy (cl.serverinfo);
|
2012-02-01 12:52:47 +00:00
|
|
|
cl.serverinfo = Info_ParseString ("", MAX_INFO_STRING, 0);
|
2022-05-12 10:47:11 +00:00
|
|
|
free (cl.players);
|
2013-02-02 08:32:46 +00:00
|
|
|
cl.players = calloc (MAX_CLIENTS, sizeof (player_info_t));
|
2022-11-09 03:50:05 +00:00
|
|
|
Sbar_SetPlayers (cl.players, MAX_CLIENTS);
|
2012-02-01 12:52:47 +00:00
|
|
|
|
2001-08-28 23:05:45 +00:00
|
|
|
// register our commands
|
2021-12-20 15:36:42 +00:00
|
|
|
Cmd_AddCommand ("pointfile", pointfile_f,
|
|
|
|
"Load a pointfile to determine map leaks.");
|
2001-02-19 21:15:25 +00:00
|
|
|
Cmd_AddCommand ("version", CL_Version_f, "Report version information");
|
|
|
|
Cmd_AddCommand ("changing", CL_Changing_f, "Used when maps are changing");
|
|
|
|
Cmd_AddCommand ("disconnect", CL_Disconnect_f, "Disconnect from server");
|
2001-08-28 23:05:45 +00:00
|
|
|
Cmd_AddCommand ("snap", CL_RSShot_f, "Take a screenshot and upload it to "
|
|
|
|
"the server");
|
2001-11-05 22:24:16 +00:00
|
|
|
Cmd_AddCommand ("maplist", Con_Maplist_f, "List maps available");
|
2001-11-06 07:14:29 +00:00
|
|
|
Cmd_AddCommand ("skinlist", Con_Skinlist_f, "List skins available");
|
|
|
|
Cmd_AddCommand ("skyboxlist", Con_Skyboxlist_f, "List skyboxes available");
|
|
|
|
Cmd_AddCommand ("demolist", Con_Demolist_QWD_f, "List demos available");
|
2002-01-20 00:04:50 +00:00
|
|
|
if (!con_module)
|
|
|
|
Cmd_AddCommand ("quit", CL_Quit_f, "Exit the program");
|
2001-05-14 03:08:24 +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");
|
|
|
|
Cmd_AddCommand ("rcon", CL_Rcon_f, "Issue set of commands to the current "
|
|
|
|
"connected server or the one 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"
|
|
|
|
"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.");
|
2001-12-19 00:40:34 +00:00
|
|
|
Cmd_AddCommand ("fullinfo", CL_FullInfo_f, "Used by GameSpy and Qlist to "
|
2001-05-14 03:08:24 +00:00
|
|
|
"set setinfo variables");
|
2001-12-19 00:40:34 +00:00
|
|
|
Cmd_AddCommand ("fullserverinfo", CL_FullServerinfo_f, "Used by GameSpy "
|
2001-05-14 03:08:24 +00:00
|
|
|
"and Qlist to obtain server variables");
|
|
|
|
Cmd_AddCommand ("download", CL_Download_f, "Manually download a quake "
|
|
|
|
"file from the server");
|
|
|
|
Cmd_AddCommand ("nextul", CL_NextUpload, "Tells the client to send the "
|
|
|
|
"next upload");
|
|
|
|
Cmd_AddCommand ("stopul", CL_StopUpload, "Tells the client to stop "
|
|
|
|
"uploading");
|
2001-08-28 23:05:45 +00:00
|
|
|
Cmd_AddCommand ("force_centerview", Force_CenterView_f, "force the view "
|
|
|
|
"to be level");
|
2004-07-11 01:41:01 +00:00
|
|
|
Cmd_AddCommand ("rotate", CL_Rotate_f, "Look left or right a given amount. Usage: rotate <degrees>");
|
|
|
|
Cmd_AddCommand ("protate", CL_PRotate_f, "Look up or down a given amount. Usage: protate <degrees>");
|
2001-08-28 23:05:45 +00:00
|
|
|
// forward to server commands
|
2002-07-31 05:19:03 +00:00
|
|
|
Cmd_AddCommand ("kill", CL_Cmd_ForwardToServer, "Suicide :)");
|
|
|
|
Cmd_AddCommand ("pause", CL_Cmd_ForwardToServer, "Pause the game");
|
2002-09-28 02:33:39 +00:00
|
|
|
Cmd_AddCommand ("say", CL_Cmd_ForwardToServer, "Say something to all "
|
|
|
|
"other players");
|
2010-01-13 06:42:26 +00:00
|
|
|
Cmd_AddCommand ("say_team", CL_Cmd_ForwardToServer, "Say something to "
|
|
|
|
"only people on your team");
|
2002-07-31 05:19:03 +00:00
|
|
|
Cmd_AddCommand ("serverinfo", CL_Cmd_ForwardToServer, "Report the current "
|
2001-05-14 03:08:24 +00:00
|
|
|
"server info");
|
2003-01-03 04:30:38 +00:00
|
|
|
cl_player_health_e = GIB_Event_New ("player.health");
|
|
|
|
cl_chat_e = GIB_Event_New ("chat");
|
2012-02-01 12:52:47 +00:00
|
|
|
|
|
|
|
CL_SetState (ca_disconnected);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2002-02-22 05:48:59 +00:00
|
|
|
static void
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
cl_cmd_pkt_adr_f (void *data, const cvar_t *cvar)
|
2004-04-13 01:13:07 +00:00
|
|
|
{
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (cl_cmd_pkt_adr[0])
|
|
|
|
NET_StringToAdr (cl_cmd_pkt_adr, &cl_cmd_packet_address);
|
2004-04-15 06:14:03 +00:00
|
|
|
else
|
|
|
|
memset (&cl_cmd_packet_address, 0, sizeof (cl_cmd_packet_address));
|
2004-04-13 01:13:07 +00:00
|
|
|
}
|
|
|
|
|
2022-02-22 06:23:09 +00:00
|
|
|
static void
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
cl_pitchspeed_f (void *data, const cvar_t *var)
|
2022-02-22 06:23:09 +00:00
|
|
|
{
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if ((cl.fpd & FPD_LIMIT_PITCH) && cl_pitchspeed > FPD_MAXPITCH) {
|
|
|
|
cl_pitchspeed = FPD_MAXPITCH;
|
2022-02-22 06:23:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
cl_yawspeed_f (void *data, const cvar_t *var)
|
2022-02-22 06:23:09 +00:00
|
|
|
{
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if ((cl.fpd & FPD_LIMIT_YAW) && cl_yawspeed > FPD_MAXYAW) {
|
|
|
|
cl_yawspeed = FPD_MAXYAW;
|
2022-02-22 06:23:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Init_Cvars (void)
|
|
|
|
{
|
2012-02-01 12:52:47 +00:00
|
|
|
VID_Init_Cvars ();
|
|
|
|
IN_Init_Cvars ();
|
|
|
|
Mod_Init_Cvars ();
|
|
|
|
S_Init_Cvars ();
|
|
|
|
|
|
|
|
CL_Cam_Init_Cvars ();
|
2022-02-22 06:23:09 +00:00
|
|
|
CL_Init_Input_Cvars ();
|
2012-02-01 12:52:47 +00:00
|
|
|
CL_Prediction_Init_Cvars ();
|
2021-07-11 01:59:27 +00:00
|
|
|
CL_NetGraph_Init_Cvars ();
|
2012-02-01 12:52:47 +00:00
|
|
|
Game_Init_Cvars ();
|
|
|
|
Pmove_Init_Cvars ();
|
|
|
|
Team_Init_Cvars ();
|
2022-03-04 16:14:43 +00:00
|
|
|
Chase_Init_Cvars ();
|
2012-02-01 12:52:47 +00:00
|
|
|
V_Init_Cvars ();
|
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
cvar_t *var;
|
|
|
|
var = Cvar_FindVar ("cl_pitchspeed");
|
|
|
|
Cvar_AddListener (var, cl_pitchspeed_f, 0);
|
|
|
|
var = Cvar_FindVar ("cl_yawspeed");
|
|
|
|
Cvar_AddListener (var, cl_yawspeed_f, 0);
|
2022-02-22 06:23:09 +00:00
|
|
|
|
2012-02-01 12:52:47 +00:00
|
|
|
cls.userinfo = Info_ParseString ("", MAX_INFO_STRING, 0);
|
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
Cvar_Register (&cl_model_crcs_cvar, 0, 0);
|
|
|
|
Cvar_Register (&cl_allow_cmd_pkt_cvar, 0, 0);
|
|
|
|
Cvar_Register (&cl_cmd_pkt_adr_cvar, cl_cmd_pkt_adr_f, 0);
|
|
|
|
Cvar_Register (&cl_paranoid_cvar, 0, 0);
|
|
|
|
Cvar_Register (&cl_autoexec_cvar, 0, 0);
|
|
|
|
Cvar_Register (&cl_quakerc_cvar, 0, 0);
|
|
|
|
Cvar_Register (&cl_fb_players_cvar, 0, 0);
|
|
|
|
Cvar_Register (&cl_writecfg_cvar, 0, 0);
|
|
|
|
Cvar_Register (&cl_draw_locs_cvar, 0, 0);
|
|
|
|
Cvar_Register (&cl_shownet_cvar, 0, 0);
|
|
|
|
Cvar_Register (&cl_maxfps_cvar, 0, 0);
|
|
|
|
Cvar_Register (&cl_timeout_cvar, 0, 0);
|
|
|
|
Cvar_Register (&host_speeds_cvar, 0, 0);
|
|
|
|
Cvar_Register (&rcon_password_cvar, 0, 0);
|
|
|
|
Cvar_Register (&rcon_address_cvar, 0, 0);
|
|
|
|
Cvar_Register (&cl_predict_players_cvar, 0, 0);
|
|
|
|
Cvar_Register (&cl_solid_players_cvar, 0, 0);
|
|
|
|
Cvar_Register (&localid_cvar, 0, 0);
|
2001-02-19 21:15:25 +00:00
|
|
|
// info mirrors
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
Cvar_Register (&cl_name_cvar, 0, 0);
|
|
|
|
Cvar_Register (&password_cvar, 0, 0);
|
|
|
|
Cvar_Register (&spectator_cvar, Cvar_Info, &spectator);
|
|
|
|
Cvar_Register (&team_cvar, Cvar_Info, &team);
|
|
|
|
Cvar_Register (&rate_cvar, Cvar_Info, &rate);
|
|
|
|
Cvar_Register (&msg_cvar, Cvar_Info, &msg);
|
|
|
|
Cvar_Register (&noaim_cvar, Cvar_Info, &noaim);
|
|
|
|
Cvar_Register (&cl_port_cvar, Cvar_Info, &cl_port);
|
|
|
|
Cvar_Register (&cl_usleep_cvar, 0, 0);
|
|
|
|
Cvar_Register (&cl_autorecord_cvar, 0, 0);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Host_EndGame
|
|
|
|
|
|
|
|
Call this to drop to a console without exiting the qwcl
|
|
|
|
*/
|
|
|
|
void
|
2001-07-15 07:04:17 +00:00
|
|
|
Host_EndGame (const char *message, ...)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-08-28 23:05:45 +00:00
|
|
|
va_list argptr;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2022-05-12 10:47:11 +00:00
|
|
|
dstring_t *str = dstring_new ();
|
2001-02-19 21:15:25 +00:00
|
|
|
va_start (argptr, message);
|
2003-07-08 22:39:45 +00:00
|
|
|
dvsprintf (str, message, argptr);
|
2001-02-19 21:15:25 +00:00
|
|
|
va_end (argptr);
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("\n===========================\n");
|
|
|
|
Sys_Printf ("Host_EndGame: %s\n", str->str);
|
|
|
|
Sys_Printf ("===========================\n\n");
|
2022-05-12 10:47:11 +00:00
|
|
|
dstring_delete (str);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
CL_Disconnect ();
|
|
|
|
|
|
|
|
longjmp (host_abort, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Host_Error
|
|
|
|
|
|
|
|
This shuts down the client and exits qwcl
|
|
|
|
*/
|
|
|
|
void
|
2001-07-15 07:04:17 +00:00
|
|
|
Host_Error (const char *error, ...)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
|
|
|
static qboolean inerror = false;
|
2001-08-28 23:05:45 +00:00
|
|
|
va_list argptr;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
if (inerror)
|
|
|
|
Sys_Error ("Host_Error: recursively entered");
|
2003-07-08 22:39:45 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
inerror = true;
|
|
|
|
|
2022-05-12 10:47:11 +00:00
|
|
|
dstring_t *str = dstring_new ();
|
2001-02-19 21:15:25 +00:00
|
|
|
va_start (argptr, error);
|
2003-07-08 22:39:45 +00:00
|
|
|
dvsprintf (str, error, argptr);
|
2001-02-19 21:15:25 +00:00
|
|
|
va_end (argptr);
|
|
|
|
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Host_Error: %s", str->str);
|
2003-07-08 22:39:45 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Disconnect ();
|
|
|
|
cls.demonum = -1;
|
|
|
|
|
|
|
|
inerror = false;
|
|
|
|
|
2001-11-12 20:46:11 +00:00
|
|
|
if (host_initialized) {
|
|
|
|
longjmp (host_abort, 1);
|
|
|
|
} else {
|
2003-07-08 22:39:45 +00:00
|
|
|
Sys_Error ("Host_Error: %s", str->str);
|
2001-11-12 20:46:11 +00:00
|
|
|
}
|
2022-05-12 10:47:11 +00:00
|
|
|
dstring_delete (str);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Host_WriteConfiguration (void)
|
|
|
|
{
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (host_initialized && cl_writecfg) {
|
2022-05-12 08:54:23 +00:00
|
|
|
plitem_t *config = PL_NewDictionary (0);
|
2021-11-15 13:04:29 +00:00
|
|
|
Cvar_SaveConfig (config);
|
2021-11-15 23:48:35 +00:00
|
|
|
IN_SaveConfig (config);
|
2021-11-14 01:32:35 +00:00
|
|
|
|
2021-04-12 13:09:09 +00:00
|
|
|
const char *path = va (0, "%s/quakeforge.cfg", qfs_gamedir->dir.def);
|
|
|
|
QFile *f = QFS_WOpen (path, 0);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
if (!f) {
|
2021-04-12 13:09:09 +00:00
|
|
|
Sys_Printf ("Couldn't write quakeforge.cfg.\n");
|
2021-11-14 01:32:35 +00:00
|
|
|
} else {
|
|
|
|
char *cfg = PL_WritePropertyList (config);
|
|
|
|
Qputs (f, cfg);
|
|
|
|
free (cfg);
|
|
|
|
Qclose (f);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2021-11-14 01:32:35 +00:00
|
|
|
PL_Free (config);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
Host_ReadConfiguration (const char *cfg_name)
|
|
|
|
{
|
|
|
|
QFile *cfg_file = QFS_FOpenFile (cfg_name);
|
|
|
|
if (!cfg_file) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
size_t len = Qfilesize (cfg_file);
|
|
|
|
char *cfg = malloc (len + 1);
|
|
|
|
Qread (cfg_file, cfg, len);
|
|
|
|
cfg[len] = 0;
|
|
|
|
Qclose (cfg_file);
|
|
|
|
|
2022-05-12 08:54:23 +00:00
|
|
|
plitem_t *config = PL_GetPropertyList (cfg, 0);
|
2022-05-12 10:47:11 +00:00
|
|
|
free (cfg);
|
|
|
|
|
2021-11-14 01:32:35 +00:00
|
|
|
if (!config) {
|
|
|
|
return 0;
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2021-11-15 13:04:29 +00:00
|
|
|
Cvar_LoadConfig (config);
|
2021-11-15 23:48:35 +00:00
|
|
|
IN_LoadConfig (config);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2021-11-14 01:32:35 +00:00
|
|
|
PL_Free (config);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
Host_ExecConfig (cbuf_t *cbuf, int skip_quakerc)
|
|
|
|
{
|
|
|
|
// quakeforge.cfg overrides quake.rc as it contains quakeforge-specific
|
|
|
|
// commands. If it doesn't exist, then this is the first time quakeforge
|
|
|
|
// has been used in this installation, thus any existing legacy config
|
|
|
|
// should be used to set up defaults on the assumption that the user has
|
|
|
|
// things set up to work with another (hopefully compatible) client
|
|
|
|
if (Host_ReadConfiguration ("quakeforge.cfg")) {
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
Cmd_Exec_File (cbuf, fs_usercfg, 0);
|
2021-11-14 01:32:35 +00:00
|
|
|
Cmd_StuffCmds (cbuf);
|
|
|
|
COM_Check_quakerc ("startdemos", cbuf);
|
|
|
|
} else {
|
|
|
|
if (!skip_quakerc) {
|
|
|
|
Cbuf_InsertText (cbuf, "exec quake.rc\n");
|
|
|
|
}
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
Cmd_Exec_File (cbuf, fs_usercfg, 0);
|
2021-11-14 01:32:35 +00:00
|
|
|
// Reparse the command line for + commands.
|
|
|
|
// (sets still done, but it doesn't matter)
|
|
|
|
// (Note, no non-base commands exist yet)
|
|
|
|
if (skip_quakerc || !COM_Check_quakerc ("stuffcmds", 0)) {
|
|
|
|
Cmd_StuffCmds (cbuf);
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Host_SimulationTime
|
|
|
|
|
2001-05-17 10:10:40 +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
|
2001-02-19 21:15:25 +00:00
|
|
|
*/
|
2001-05-17 10:10:40 +00:00
|
|
|
static inline float
|
2001-02-19 21:15:25 +00:00
|
|
|
Host_SimulationTime (float time)
|
|
|
|
{
|
2001-08-28 23:05:45 +00:00
|
|
|
float fps, timedifference;
|
2001-02-19 21:15:25 +00:00
|
|
|
float timescale = 1.0;
|
|
|
|
|
2003-07-25 22:21:47 +00:00
|
|
|
con_realtime += time;
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
if (cls.demoplayback) {
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
timescale = max (0, demo_speed);
|
2001-02-19 21:15:25 +00:00
|
|
|
time *= timescale;
|
|
|
|
}
|
|
|
|
|
|
|
|
realtime += time;
|
|
|
|
if (oldrealtime > realtime)
|
|
|
|
oldrealtime = 0;
|
|
|
|
|
2012-01-05 10:19:37 +00:00
|
|
|
if (cls.demoplayback)
|
2002-04-25 19:38:15 +00:00
|
|
|
return 0;
|
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (cl_maxfps <= 0)
|
2002-09-12 20:49:40 +00:00
|
|
|
fps = 72;
|
|
|
|
else
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
fps = min (cl_maxfps, 72);
|
2002-04-25 17:16:40 +00:00
|
|
|
|
2001-05-17 10:10:40 +00:00
|
|
|
timedifference = (timescale / fps) - (realtime - oldrealtime);
|
|
|
|
|
2002-04-25 17:16:40 +00:00
|
|
|
if (timedifference > 0)
|
2001-05-17 10:10:40 +00:00
|
|
|
return timedifference; // framerate is too high
|
|
|
|
return 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2022-03-31 15:58:14 +00:00
|
|
|
static void
|
|
|
|
write_capture (tex_t *tex, void *data)
|
|
|
|
{
|
|
|
|
QFile *file = QFS_Open (va (0, "%s/qfmv%06d.png",
|
|
|
|
qfs_gamedir->dir.shots,
|
|
|
|
cls.demo_capture++), "wb");
|
|
|
|
if (file) {
|
|
|
|
WritePNG (file, tex);
|
|
|
|
Qclose (file);
|
|
|
|
}
|
|
|
|
free (tex);
|
|
|
|
}
|
|
|
|
|
2001-08-28 23:05:45 +00:00
|
|
|
int nopacketcount;
|
2001-05-09 22:40:51 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
/*
|
|
|
|
Host_Frame
|
|
|
|
|
|
|
|
Runs all active servers
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Host_Frame (float time)
|
|
|
|
{
|
2002-07-03 05:40:33 +00:00
|
|
|
static double time1 = 0;
|
|
|
|
static double time2 = 0;
|
|
|
|
static double time3 = 0;
|
|
|
|
float sleeptime;
|
|
|
|
int pass1, pass2, pass3;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-08-28 23:05:45 +00:00
|
|
|
if (setjmp (host_abort))
|
|
|
|
// something bad happened, or the server disconnected
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
|
2012-01-05 10:19:37 +00:00
|
|
|
if (cls.demo_capture)
|
|
|
|
time = 1.0 / 30; //FIXME fixed 30fps atm
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
// decide the simulation time
|
2001-05-17 10:10:40 +00:00
|
|
|
if ((sleeptime = Host_SimulationTime (time)) != 0) {
|
2002-02-22 05:48:59 +00:00
|
|
|
#ifdef HAVE_USLEEP
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (cl_usleep && sleeptime > 0.002) // minimum sleep time
|
2002-09-28 02:33:39 +00:00
|
|
|
usleep ((unsigned long) (sleeptime * 1000000 / 2));
|
2002-02-22 05:48:59 +00:00
|
|
|
#endif
|
2001-02-19 21:15:25 +00:00
|
|
|
return; // framerate is too high
|
2001-05-17 10:10:40 +00:00
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
host_frametime = realtime - oldrealtime;
|
|
|
|
oldrealtime = realtime;
|
|
|
|
host_frametime = min (host_frametime, 0.2);
|
|
|
|
|
2021-03-19 11:18:45 +00:00
|
|
|
cl.viewstate.frametime = host_frametime;
|
|
|
|
|
2003-07-25 22:21:47 +00:00
|
|
|
con_frametime = con_realtime - oldcon_realtime;
|
|
|
|
oldcon_realtime = con_realtime;
|
|
|
|
|
2003-04-08 18:45:12 +00:00
|
|
|
IN_ProcessEvents ();
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-08-27 04:47:49 +00:00
|
|
|
// process gib threads
|
2012-05-21 23:23:22 +00:00
|
|
|
|
2002-08-27 04:47:49 +00:00
|
|
|
GIB_Thread_Execute ();
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
// process console commands
|
2002-08-07 06:17:50 +00:00
|
|
|
Cbuf_Execute_Stack (cl_cbuf);
|
2002-12-01 07:22:42 +00:00
|
|
|
Cbuf_Execute_Stack (cl_stbuf);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
// fetch results from server
|
|
|
|
CL_ReadPackets ();
|
2007-03-20 21:17:49 +00:00
|
|
|
if (*cls.downloadurl->str)
|
2007-03-20 14:16:43 +00:00
|
|
|
CL_HTTP_Update ();
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-10-02 21:56:45 +00:00
|
|
|
if (cls.demoplayback2) {
|
|
|
|
player_state_t *self, *oldself;
|
|
|
|
|
|
|
|
self = &cl.frames[cl.parsecount
|
|
|
|
& UPDATE_MASK].playerstate[cl.playernum];
|
|
|
|
oldself = &cl.frames[(cls.netchan.outgoing_sequence - 1)
|
|
|
|
& UPDATE_MASK].playerstate[cl.playernum];
|
|
|
|
self->messagenum = cl.parsecount;
|
2021-03-11 05:27:36 +00:00
|
|
|
VectorCopy (oldself->pls.es.origin, self->pls.es.origin);
|
|
|
|
VectorCopy (oldself->pls.es.velocity, self->pls.es.velocity);
|
2002-10-02 21:56:45 +00:00
|
|
|
VectorCopy (oldself->viewangles, self->viewangles);
|
|
|
|
|
|
|
|
CL_ParseClientdata ();
|
|
|
|
|
|
|
|
cls.netchan.outgoing_sequence = cl.parsecount + 1;
|
|
|
|
}
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
// send intentions now
|
|
|
|
// resend a connection request if necessary
|
|
|
|
if (cls.state == ca_disconnected) {
|
|
|
|
CL_CheckForResend ();
|
2001-09-11 04:53:20 +00:00
|
|
|
} else {
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_SendCmd ();
|
|
|
|
|
2001-09-11 04:53:20 +00:00
|
|
|
// Set up prediction for other players
|
|
|
|
CL_SetUpPlayerPrediction (false);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-09-11 04:53:20 +00:00
|
|
|
// do client side motion prediction
|
|
|
|
CL_PredictMove ();
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-09-11 04:53:20 +00:00
|
|
|
// Set up prediction for other players
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
CL_SetUpPlayerPrediction (cl_predict_players);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-09-11 04:53:20 +00:00
|
|
|
// build a refresh entity list
|
|
|
|
CL_EmitEntities ();
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
// update video
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (host_speeds)
|
2001-02-19 21:15:25 +00:00
|
|
|
time1 = Sys_DoubleTime ();
|
|
|
|
|
2012-02-14 10:47:02 +00:00
|
|
|
r_data->inhibit_viewmodel = (!Cam_DrawViewModel ()
|
|
|
|
|| (cl.stats[STAT_ITEMS] & IT_INVISIBILITY)
|
|
|
|
|| cl.stats[STAT_HEALTH] <= 0);
|
|
|
|
r_data->frametime = host_frametime;
|
2001-05-20 20:38:51 +00:00
|
|
|
|
2022-11-02 06:08:09 +00:00
|
|
|
cl.viewstate.time = realtime;
|
2022-12-01 08:50:13 +00:00
|
|
|
cl.viewstate.realtime = realtime;
|
2022-11-12 02:41:09 +00:00
|
|
|
if (!cls.demoplayback && cls.state == ca_active) {
|
2022-11-10 06:14:29 +00:00
|
|
|
CL_NetUpdate ();
|
|
|
|
}
|
2022-11-09 03:50:05 +00:00
|
|
|
Sbar_Update (cl.time);
|
2022-11-02 06:08:09 +00:00
|
|
|
CL_UpdateScreen (&cl.viewstate);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (host_speeds)
|
2001-02-19 21:15:25 +00:00
|
|
|
time2 = Sys_DoubleTime ();
|
|
|
|
|
|
|
|
// update audio
|
|
|
|
if (cls.state == ca_active) {
|
2012-02-13 04:44:29 +00:00
|
|
|
mleaf_t *l;
|
|
|
|
byte *asl = 0;
|
2022-02-28 07:59:38 +00:00
|
|
|
vec4f_t origin;
|
2012-02-13 04:44:29 +00:00
|
|
|
|
2022-02-28 07:59:38 +00:00
|
|
|
origin = Transform_GetWorldPosition (cl.viewstate.camera_transform);
|
2022-05-22 02:18:32 +00:00
|
|
|
l = Mod_PointInLeaf (origin, cl_world.scene->worldmodel);
|
2012-02-13 04:44:29 +00:00
|
|
|
if (l)
|
|
|
|
asl = l->ambient_sound_level;
|
2022-02-28 07:59:38 +00:00
|
|
|
S_Update (cl.viewstate.camera_transform, asl);
|
2022-03-07 04:40:04 +00:00
|
|
|
R_DecayLights (host_frametime);
|
2001-02-19 21:15:25 +00:00
|
|
|
} else
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
S_Update (nulltransform, 0);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
CDAudio_Update ();
|
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (host_speeds) {
|
2001-02-19 21:15:25 +00:00
|
|
|
pass1 = (time1 - time3) * 1000;
|
|
|
|
time3 = Sys_DoubleTime ();
|
|
|
|
pass2 = (time2 - time1) * 1000;
|
|
|
|
pass3 = (time3 - time2) * 1000;
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("%3i tot %3i server %3i gfx %3i snd\n",
|
2001-02-19 21:15:25 +00:00
|
|
|
pass1 + pass2 + pass3, pass1, pass2, pass3);
|
|
|
|
}
|
2022-03-31 15:58:14 +00:00
|
|
|
|
2012-01-05 10:19:37 +00:00
|
|
|
if (cls.demo_capture) {
|
2022-03-31 15:58:14 +00:00
|
|
|
r_funcs->capture_screen (write_capture, 0);
|
2012-01-05 10:19:37 +00:00
|
|
|
}
|
2022-03-31 15:58:14 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
host_framecount++;
|
|
|
|
fps_count++;
|
|
|
|
}
|
|
|
|
|
2021-12-13 00:13:39 +00:00
|
|
|
static memhunk_t *
|
2001-11-14 20:18:37 +00:00
|
|
|
CL_Init_Memory (void)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-11-14 20:18:37 +00:00
|
|
|
int mem_parm = COM_CheckParm ("-mem");
|
2021-07-26 06:43:57 +00:00
|
|
|
size_t mem_size;
|
2001-11-14 20:18:37 +00:00
|
|
|
void *mem_base;
|
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
Cvar_Register (&cl_mem_size_cvar, 0, 0);
|
2001-11-14 20:18:37 +00:00
|
|
|
if (mem_parm)
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
Cvar_Set ("cl_mem_size", com_argv[mem_parm + 1]);
|
2001-11-14 20:18:37 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
if (COM_CheckParm ("-minmemory"))
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
cl_mem_size = MINIMUM_MEMORY / (1024 * 1024.0);
|
2001-11-14 20:18:37 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
mem_size = ((size_t) cl_mem_size * 1024 * 1024);
|
2001-11-14 20:18:37 +00:00
|
|
|
|
|
|
|
if (mem_size < MINIMUM_MEMORY)
|
2001-02-19 21:15:25 +00:00
|
|
|
Sys_Error ("Only %4.1f megs of memory reported, can't execute game",
|
2001-11-14 20:18:37 +00:00
|
|
|
mem_size / (float) 0x100000);
|
|
|
|
|
2021-02-03 04:19:19 +00:00
|
|
|
mem_base = Sys_Alloc (mem_size);
|
2001-11-14 20:18:37 +00:00
|
|
|
|
|
|
|
if (!mem_base)
|
2021-07-26 06:43:57 +00:00
|
|
|
Sys_Error ("Can't allocate %zd", mem_size);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-02-19 20:47:45 +00:00
|
|
|
Sys_PageIn (mem_base, mem_size);
|
2021-12-13 00:13:39 +00:00
|
|
|
memhunk_t *hunk = Memory_Init (mem_base, mem_size);
|
2012-02-01 12:52:47 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
Sys_Printf ("%4.1f megabyte heap.\n", cl_mem_size);
|
2021-12-13 00:13:39 +00:00
|
|
|
return hunk;
|
2001-11-14 20:18:37 +00:00
|
|
|
}
|
|
|
|
|
2004-02-03 03:01:06 +00:00
|
|
|
static void
|
2022-06-04 07:06:04 +00:00
|
|
|
CL_Autoexec (int phase, void *data)
|
2004-02-03 03:01:06 +00:00
|
|
|
{
|
2007-03-24 10:13:10 +00:00
|
|
|
if (!phase)
|
|
|
|
return;
|
2021-11-14 01:32:35 +00:00
|
|
|
if (!Host_ReadConfiguration ("quakeforge.cfg")) {
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
int cmd_warncmd_val = cmd_warncmd;
|
2021-04-12 13:09:09 +00:00
|
|
|
|
|
|
|
Cbuf_AddText (cl_cbuf, "cmd_warncmd 0\n");
|
|
|
|
Cbuf_AddText (cl_cbuf, "exec config.cfg\n");
|
|
|
|
Cbuf_AddText (cl_cbuf, "exec frontend.cfg\n");
|
|
|
|
|
|
|
|
Cbuf_AddText (cl_cbuf, va (0, "cmd_warncmd %d\n", cmd_warncmd_val));
|
|
|
|
}
|
2004-02-03 03:01:06 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (cl_autoexec) {
|
2004-02-03 03:01:06 +00:00
|
|
|
Cbuf_AddText (cl_cbuf, "exec autoexec.cfg\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-14 20:18:37 +00:00
|
|
|
void
|
|
|
|
Host_Init (void)
|
|
|
|
{
|
2002-08-03 06:04:00 +00:00
|
|
|
cl_cbuf = Cbuf_New (&id_interp);
|
2002-12-01 07:22:42 +00:00
|
|
|
cl_stbuf = Cbuf_New (&id_interp);
|
2002-07-31 05:19:03 +00:00
|
|
|
|
2002-08-20 23:04:57 +00:00
|
|
|
Sys_Init ();
|
2002-11-14 05:28:54 +00:00
|
|
|
GIB_Init (true);
|
2021-07-05 07:26:07 +00:00
|
|
|
GIB_Key_Init ();
|
2021-04-12 13:09:09 +00:00
|
|
|
COM_ParseConfig (cl_cbuf);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2021-12-13 00:13:39 +00:00
|
|
|
memhunk_t *hunk = CL_Init_Memory ();
|
2001-11-14 20:18:37 +00:00
|
|
|
|
2002-04-11 18:42:55 +00:00
|
|
|
pr_gametype = "quakeworld";
|
|
|
|
|
2021-12-13 00:13:39 +00:00
|
|
|
QFS_Init (hunk, "qw");
|
2022-06-04 07:06:04 +00:00
|
|
|
QFS_GamedirCallback (CL_Autoexec, 0);
|
2001-04-25 00:20:23 +00:00
|
|
|
PI_Init ();
|
|
|
|
|
2022-05-12 10:47:11 +00:00
|
|
|
Sys_RegisterShutdown (Net_LogStop, 0);
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
Netchan_Init_Cvars ();
|
2012-02-01 12:52:47 +00:00
|
|
|
|
2020-02-23 06:56:36 +00:00
|
|
|
PR_Init_Cvars (); // FIXME location
|
2012-02-01 12:52:47 +00:00
|
|
|
|
|
|
|
CL_Init_Cvars ();
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-07-18 06:27:26 +00:00
|
|
|
CL_Chat_Init ();
|
|
|
|
|
2002-07-31 05:19:03 +00:00
|
|
|
CL_Cmd_Init ();
|
2001-03-30 00:30:38 +00:00
|
|
|
Game_Init ();
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
NET_Init (cl_port);
|
2001-02-19 21:15:25 +00:00
|
|
|
Netchan_Init ();
|
2004-02-19 23:06:47 +00:00
|
|
|
net_realtime = &realtime;
|
2001-05-29 18:14:12 +00:00
|
|
|
{
|
2001-07-15 07:04:17 +00:00
|
|
|
static const char *sound_precache[MAX_MODELS];
|
2001-05-29 18:14:12 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_MODELS; i++)
|
|
|
|
sound_precache[i] = cl.sound_name[i];
|
2022-02-06 10:47:22 +00:00
|
|
|
Net_Log_Init (sound_precache, 0);
|
2001-05-29 18:14:12 +00:00
|
|
|
}
|
2007-03-20 14:16:43 +00:00
|
|
|
CL_HTTP_Init ();
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-03-21 21:25:44 +00:00
|
|
|
CL_Demo_Init ();
|
2001-08-21 05:35:35 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_Init ();
|
|
|
|
|
2022-11-02 06:08:09 +00:00
|
|
|
cl.viewstate.time = realtime;
|
2022-12-01 08:50:13 +00:00
|
|
|
cl.viewstate.realtime = realtime;
|
2022-11-02 06:08:09 +00:00
|
|
|
CL_UpdateScreen (&cl.viewstate);
|
|
|
|
CL_UpdateScreen (&cl.viewstate);
|
2002-10-11 03:40:41 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
Host_ExecConfig (cl_cbuf, !cl_quakerc);
|
2021-04-12 13:09:09 +00:00
|
|
|
|
|
|
|
// make sure all + commands have been executed
|
|
|
|
Cbuf_Execute_Stack (cl_cbuf);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2021-07-28 06:01:45 +00:00
|
|
|
Hunk_AllocName (0, 0, "-HOST_HUNKLEVEL-");
|
|
|
|
host_hunklevel = Hunk_LowMark (0);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2010-08-19 06:01:43 +00:00
|
|
|
Sys_Printf ("\nClient version %s (build %04d)\n\n", PACKAGE_VERSION,
|
2001-02-19 21:15:25 +00:00
|
|
|
build_number ());
|
2010-08-19 06:01:43 +00:00
|
|
|
Sys_Printf ("\x80\x81\x81\x82 %s initialized \x80\x81\x81\x82\n",
|
|
|
|
PACKAGE_NAME);
|
2003-09-01 01:52:20 +00:00
|
|
|
|
2004-01-07 06:29:34 +00:00
|
|
|
host_initialized = true;
|
|
|
|
|
2022-11-02 06:08:09 +00:00
|
|
|
CL_UpdateScreen (&cl.viewstate);
|
2002-07-03 05:40:33 +00:00
|
|
|
Con_NewMap (); // force the menus to be loaded
|
2022-11-02 06:08:09 +00:00
|
|
|
CL_UpdateScreen (&cl.viewstate);
|
|
|
|
CL_UpdateScreen (&cl.viewstate);
|
2002-04-11 18:42:55 +00:00
|
|
|
|
2003-09-01 03:23:52 +00:00
|
|
|
if (connect_time == -1) {
|
2003-09-01 01:52:20 +00:00
|
|
|
Cbuf_AddText (cl_cbuf, "echo Type connect <internet address> or use a "
|
|
|
|
"server browser to connect to a game.\n");
|
|
|
|
}
|
|
|
|
Cbuf_AddText (cl_cbuf, "set cmd_warncmd 1\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|