2001-02-19 21:15:25 +00:00
|
|
|
/*
|
|
|
|
client.h
|
|
|
|
|
2001-05-09 05:41:34 +00:00
|
|
|
Client definitions
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __client_h
|
|
|
|
#define __client_h
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/mathlib.h"
|
2001-04-10 06:55:28 +00:00
|
|
|
#include "QF/model.h"
|
2002-08-27 07:16:28 +00:00
|
|
|
#include "QF/quakefs.h"
|
2001-11-27 21:42:49 +00:00
|
|
|
#include "QF/render.h"
|
2001-05-09 05:41:34 +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
|
|
|
#include "QF/scene/entity.h"
|
|
|
|
|
2022-02-22 06:23:09 +00:00
|
|
|
#include "client/chase.h"
|
2012-06-28 00:33:23 +00:00
|
|
|
#include "client/entities.h"
|
2022-02-22 06:23:09 +00:00
|
|
|
#include "client/input.h"
|
2013-01-31 08:18:29 +00:00
|
|
|
#include "client/state.h"
|
2021-03-19 11:18:45 +00:00
|
|
|
#include "client/view.h"
|
2012-06-28 00:33:23 +00:00
|
|
|
|
2001-11-27 21:42:49 +00:00
|
|
|
#include "game.h"
|
2003-02-11 22:48:57 +00:00
|
|
|
#include "netmain.h"
|
2001-05-18 18:33:37 +00:00
|
|
|
#include "protocol.h"
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-05-18 18:33:37 +00:00
|
|
|
|
2002-09-12 22:09:55 +00:00
|
|
|
// client_state_t should hold all pieces of the client state
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2012-05-23 12:38:25 +00:00
|
|
|
typedef enum {
|
|
|
|
so_none,
|
|
|
|
so_prespawn,
|
|
|
|
so_spawn,
|
|
|
|
so_begin,
|
|
|
|
so_active,
|
|
|
|
} signon_t;
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
#define MAX_DEMOS 8
|
|
|
|
#define MAX_DEMONAME 16
|
|
|
|
|
|
|
|
typedef enum {
|
2001-05-18 18:33:37 +00:00
|
|
|
ca_disconnected, // full screen console with no connection
|
2012-06-26 06:03:04 +00:00
|
|
|
ca_connected, // talking to a server
|
|
|
|
ca_active, // everything is in, so frames can be rendered
|
2001-02-19 21:15:25 +00:00
|
|
|
} cactive_t;
|
|
|
|
|
2001-05-18 18:33:37 +00:00
|
|
|
typedef enum {
|
|
|
|
dl_none,
|
|
|
|
dl_model,
|
|
|
|
dl_sound,
|
|
|
|
dl_skin,
|
|
|
|
dl_single
|
|
|
|
} dltype_t; // download type
|
|
|
|
|
|
|
|
/*
|
|
|
|
the client_static_t structure is persistant through an arbitrary number
|
|
|
|
of server connections
|
|
|
|
*/
|
2012-05-24 11:32:41 +00:00
|
|
|
typedef struct {
|
|
|
|
// connection information
|
2012-06-26 00:05:02 +00:00
|
|
|
cactive_t state;
|
2012-05-24 11:32:41 +00:00
|
|
|
signon_t signon;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2012-05-24 11:32:41 +00:00
|
|
|
// network stuff
|
2012-06-26 00:05:02 +00:00
|
|
|
struct qsocket_s *netcon;
|
|
|
|
sizebuf_t message; // writing buffer to send to server
|
2001-05-18 18:33:37 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
// demo loop control
|
2012-06-26 00:05:02 +00:00
|
|
|
int demonum; // -1 = don't play demos
|
|
|
|
char demos[MAX_DEMOS][MAX_DEMONAME]; // when not playing
|
|
|
|
|
|
|
|
QFile *demofile;
|
2022-03-31 15:58:14 +00:00
|
|
|
int demo_capture;
|
2012-06-26 00:05:02 +00:00
|
|
|
int forcetrack; // -1 = use normal cd track
|
2023-06-13 09:06:11 +00:00
|
|
|
bool demorecording;
|
|
|
|
bool demoplayback;
|
|
|
|
bool timedemo;
|
2012-06-26 00:05:02 +00:00
|
|
|
int td_lastframe; // to meter out one message a frame
|
|
|
|
int td_startframe; // host_framecount at start
|
2013-02-27 05:32:29 +00:00
|
|
|
double td_starttime; // realtime at second frame of timedemo
|
2001-02-19 21:15:25 +00:00
|
|
|
} client_static_t;
|
|
|
|
|
|
|
|
extern client_static_t cls;
|
|
|
|
|
2011-06-19 00:49:39 +00:00
|
|
|
#define FPD_NO_MACROS 0x0001 // Many clients ignore this, and it isn't used, but let's honor it
|
|
|
|
#define FPD_NO_TIMERS 0x0002 // We never allow timers anyway
|
|
|
|
#define FPD_NO_STRIGGER 0x0004 // Don't have soundtrigger yet, but this disables it
|
|
|
|
#define FPD_HIDE_PERCENTE 0x0020 // Ditto
|
|
|
|
#define FPD_HIDE_POINT 0x0080 // Can ignore if we do visibility checking for point
|
|
|
|
#define FPD_NO_TEAMSKIN 0x0100 // Disable skin force
|
2012-06-26 00:05:02 +00:00
|
|
|
#define FPD_NO_TEAMCOLOR 0x0200 // Disable color force
|
2011-06-19 00:49:39 +00:00
|
|
|
#define FPD_HIDE_ITEM 0x0400 // No idea what this does
|
2012-05-21 23:23:22 +00:00
|
|
|
#define FPD_LIMIT_PITCH 0x4000 // Limit pitchspeed
|
2011-06-19 00:49:39 +00:00
|
|
|
#define FPD_LIMIT_YAW 0x8000 // Limit yawspeed
|
|
|
|
|
|
|
|
#define FPD_DEFAULT (FPD_HIDE_PERCENTE | FPD_NO_TEAMSKIN)
|
|
|
|
|
2012-05-21 23:23:22 +00:00
|
|
|
// These limits prevent a usable RJ script, requiring > 0.1 sec of turning time.
|
2011-06-19 00:49:39 +00:00
|
|
|
#define FPD_MAXPITCH 1000
|
|
|
|
#define FPD_MAXYAW 2000
|
|
|
|
|
|
|
|
|
2001-05-18 18:33:37 +00:00
|
|
|
/*
|
2012-06-26 00:05:02 +00:00
|
|
|
the client_state_t structure is wiped completely at every server signon
|
2001-05-18 18:33:37 +00:00
|
|
|
*/
|
2013-02-02 09:01:37 +00:00
|
|
|
typedef struct client_state_s {
|
2012-06-26 00:05:02 +00:00
|
|
|
int movemessages; // Since connecting to this server throw out
|
2002-09-12 22:09:55 +00:00
|
|
|
// the first couple, so the player doesn't
|
|
|
|
// accidentally do something the first frame
|
2012-06-26 00:05:02 +00:00
|
|
|
usercmd_t cmd; // Last command sent to the server
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
// information for local display
|
2012-06-26 00:05:02 +00:00
|
|
|
int stats[MAX_CL_STATS]; // Health, etc
|
|
|
|
float item_gettime[32]; // cl.time of aquiring item, for blinking
|
2013-02-02 09:01:37 +00:00
|
|
|
float faceanimtime; // Use anim frame if cl.time < this
|
2002-09-12 22:09:55 +00:00
|
|
|
|
|
|
|
// The client maintains its own idea of view angles, which are sent to the
|
|
|
|
// server each frame. The server sets punchangle when the view is temporarily
|
|
|
|
// offset, and an angle reset commands at the start of each level and after
|
|
|
|
// teleporting.
|
2021-03-11 07:19:49 +00:00
|
|
|
int frameIndex;
|
|
|
|
vec3_t frameViewAngles[2]; // During demo playback viewangles is lerped
|
2001-02-19 21:15:25 +00:00
|
|
|
// between these
|
2021-03-11 07:19:49 +00:00
|
|
|
vec4f_t frameVelocity[2]; // Update by server, used for lean+bob
|
2001-02-19 21:15:25 +00:00
|
|
|
// (0 is newest)
|
2021-03-19 11:18:45 +00:00
|
|
|
viewstate_t viewstate;
|
2022-02-22 06:23:09 +00:00
|
|
|
movestate_t movestate;
|
|
|
|
chasestate_t chasestate;
|
2012-05-21 23:23:22 +00:00
|
|
|
|
2023-06-13 09:06:11 +00:00
|
|
|
bool paused; // Sent over by server
|
|
|
|
bool inwater;
|
2012-06-26 00:05:02 +00:00
|
|
|
float crouch; // Local amount for smoothing stepups
|
|
|
|
|
|
|
|
int intermission; // Don't change view angle, full screen, etc
|
2013-02-02 09:01:37 +00:00
|
|
|
int completed_time; // Latched from time at intermission start
|
2012-06-26 00:05:02 +00:00
|
|
|
|
|
|
|
double mtime[2]; // The timestamp of last two messages
|
|
|
|
double time; // Clients view of time, should be between
|
2012-05-24 12:13:33 +00:00
|
|
|
// servertime and oldvertime to generate a
|
2002-09-12 22:09:55 +00:00
|
|
|
// lerp point for other data
|
2012-06-26 00:05:02 +00:00
|
|
|
double oldtime; // Previous cl.time, time-oldtime is used
|
2001-02-19 21:15:25 +00:00
|
|
|
// to decay light values and smooth step ups
|
|
|
|
|
2013-02-02 09:01:37 +00:00
|
|
|
double last_ping_request; // while showing scoreboard
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-05-18 18:33:37 +00:00
|
|
|
/* information that is static for the entire time connected to a server */
|
|
|
|
|
2012-06-26 00:05:02 +00:00
|
|
|
struct sfx_s *sound_precache[MAX_SOUNDS];
|
2012-01-09 07:22:39 +00:00
|
|
|
int numsounds;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2012-06-26 00:05:02 +00:00
|
|
|
char levelname[40]; // for display on solo scoreboard
|
|
|
|
int spectator;
|
2013-01-31 08:19:05 +00:00
|
|
|
int playernum;
|
2012-06-26 00:05:02 +00:00
|
|
|
int viewentity; // cl_entitites[cl.viewentity] = player
|
|
|
|
unsigned protocol;
|
2013-01-31 08:19:05 +00:00
|
|
|
float stdver;
|
2012-06-26 00:05:02 +00:00
|
|
|
int maxclients;
|
2013-01-31 08:19:05 +00:00
|
|
|
// serverinfo mirrors
|
2012-06-26 00:05:02 +00:00
|
|
|
int sv_cshifts;
|
2013-01-31 08:19:05 +00:00
|
|
|
int no_pogo_stick;
|
|
|
|
int teamplay;
|
2012-06-26 00:05:02 +00:00
|
|
|
int fpd;
|
2013-01-31 08:19:05 +00:00
|
|
|
int fbskins;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
// refresh related state
|
2012-06-26 00:05:02 +00:00
|
|
|
int num_entities; // held in cl_entities array
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2012-06-26 00:06:19 +00:00
|
|
|
int cdtrack; // cd audio
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2013-02-02 07:54:05 +00:00
|
|
|
// all player information
|
|
|
|
player_info_t *players;
|
2012-02-14 08:28:09 +00:00
|
|
|
|
2012-06-26 00:05:02 +00:00
|
|
|
lightstyle_t lightstyle[MAX_LIGHTSTYLES];
|
2001-02-19 21:15:25 +00:00
|
|
|
} client_state_t;
|
|
|
|
|
2002-09-12 22:09:55 +00:00
|
|
|
// 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
|
|
|
extern char *cl_name;
|
|
|
|
extern int cl_color;
|
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
|
|
|
extern int cl_shownet;
|
|
|
|
extern int cl_nolerp;
|
2023-08-05 10:58:37 +00:00
|
|
|
extern int cl_player_shadows;
|
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
|
|
|
extern char *cl_name;
|
|
|
|
extern int cl_writecfg;
|
2001-10-28 04:23: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
|
|
|
extern int cl_cshift_bonus;
|
|
|
|
extern int cl_cshift_contents;
|
|
|
|
extern int cl_cshift_damage;
|
|
|
|
extern int cl_cshift_powerup;
|
2001-10-28 04:23: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
|
|
|
extern int noskins;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
extern client_state_t cl;
|
|
|
|
|
[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
|
|
|
extern struct entity_s cl_entities[MAX_EDICTS];
|
2012-06-26 06:12:17 +00:00
|
|
|
extern double cl_msgtime[MAX_EDICTS];
|
2022-03-04 16:48:10 +00:00
|
|
|
extern struct set_s cl_forcelink;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-10-28 04:23:37 +00:00
|
|
|
extern int fps_count;
|
|
|
|
|
2010-08-24 00:53:54 +00:00
|
|
|
extern void (*write_angles) (sizebuf_t *sb, const vec3_t angles);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-09-12 22:09:55 +00:00
|
|
|
// cl_main
|
2011-12-22 06:44:28 +00:00
|
|
|
struct cbuf_s;
|
|
|
|
void CL_Init (struct cbuf_s *cbuf);
|
2001-02-19 21:15:25 +00:00
|
|
|
void CL_InitCvars (void);
|
2019-07-08 03:46:22 +00:00
|
|
|
void CL_ClearMemory (void);
|
2022-05-26 08:10:23 +00:00
|
|
|
void CL_PreFrame (void);
|
2022-05-26 07:17:00 +00:00
|
|
|
void CL_Frame (void);
|
2021-11-18 06:27:44 +00:00
|
|
|
int CL_ReadConfiguration (const char *cfg_name);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-07-15 07:04:17 +00:00
|
|
|
void CL_EstablishConnection (const char *host);
|
2001-02-19 21:15:25 +00:00
|
|
|
void CL_Signon1 (void);
|
|
|
|
void CL_Signon2 (void);
|
|
|
|
void CL_Signon3 (void);
|
|
|
|
void CL_Signon4 (void);
|
|
|
|
|
|
|
|
void CL_Disconnect (void);
|
|
|
|
void CL_Disconnect_f (void);
|
|
|
|
void CL_NextDemo (void);
|
|
|
|
|
|
|
|
|
2002-09-12 22:09:55 +00:00
|
|
|
// cl_input
|
2022-02-22 06:23:09 +00:00
|
|
|
void CL_Init_Input (struct cbuf_s *cbuf);
|
|
|
|
void CL_Init_Input_Cvars (void);
|
2001-02-19 21:15:25 +00:00
|
|
|
void CL_SendCmd (void);
|
|
|
|
void CL_SendMove (usercmd_t *cmd);
|
|
|
|
|
|
|
|
void CL_ClearState (void);
|
|
|
|
|
|
|
|
int CL_ReadFromServer (void);
|
|
|
|
void CL_WriteToServer (usercmd_t *cmd);
|
|
|
|
void CL_BaseMove (usercmd_t *cmd);
|
|
|
|
|
2002-09-12 22:09:55 +00:00
|
|
|
// cl_demo.c
|
2001-02-19 21:15:25 +00:00
|
|
|
void CL_StopPlayback (void);
|
2011-06-03 13:47:32 +00:00
|
|
|
void CL_StopRecording (void);
|
2011-08-24 11:33:05 +00:00
|
|
|
void CL_Record (const char *argv1, int track);
|
2001-02-19 21:15:25 +00:00
|
|
|
int CL_GetMessage (void);
|
2002-06-08 23:22:26 +00:00
|
|
|
void CL_Demo_Init (void);
|
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
|
|
|
extern int demo_gzip;
|
|
|
|
extern float demo_speed;
|
2001-05-18 18:33:37 +00:00
|
|
|
|
2002-09-12 22:09:55 +00:00
|
|
|
// cl_parse.c
|
2001-05-21 22:25:35 +00:00
|
|
|
struct skin_s;
|
2001-02-19 21:15:25 +00:00
|
|
|
void CL_ParseServerMessage (void);
|
2001-05-21 22:25:35 +00:00
|
|
|
void CL_NewTranslation (int slot, struct skin_s *skin);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-05-18 18:33:37 +00:00
|
|
|
|
2002-09-12 22:09:55 +00:00
|
|
|
// cl_tent
|
2001-02-19 21:15:25 +00:00
|
|
|
void CL_SignonReply (void);
|
2011-06-19 11:02:00 +00:00
|
|
|
void CL_RelinkEntities (void);
|
|
|
|
void CL_ClearEnts (void);
|
[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
|
|
|
struct entity_s CL_GetEntity (int num);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-05-18 18:33:37 +00:00
|
|
|
extern double realtime;
|
|
|
|
|
2023-06-13 09:06:11 +00:00
|
|
|
extern bool recording;
|
2001-10-29 17:46: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
|
|
|
struct cvar_s;
|
|
|
|
void Cvar_Info (void *data, const struct cvar_s *cvar);
|
2001-03-31 01:02:52 +00:00
|
|
|
|
2001-08-20 17:48:16 +00:00
|
|
|
void CL_SetState (cactive_t state);
|
|
|
|
|
2002-07-31 05:19:03 +00:00
|
|
|
void CL_Cmd_ForwardToServer (void);
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
#endif // __client_h
|