mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 06:10:56 +00:00
More client.h tidyup.
Whitespace and shuffling fields around. Now diffing the two headers makes sense in client_static_t and client_state_t.
This commit is contained in:
parent
f128aca207
commit
8584021311
2 changed files with 155 additions and 166 deletions
|
@ -99,28 +99,26 @@ typedef enum {
|
|||
*/
|
||||
typedef struct {
|
||||
// connection information
|
||||
cactive_t state;
|
||||
cactive_t state;
|
||||
signon_t signon;
|
||||
|
||||
// network stuff
|
||||
struct qsocket_s *netcon;
|
||||
sizebuf_t message; // writing buffer to send to server
|
||||
struct qsocket_s *netcon;
|
||||
sizebuf_t message; // writing buffer to send to server
|
||||
|
||||
// demo loop control
|
||||
int demonum; // -1 = don't play demos
|
||||
char demos[MAX_DEMOS][MAX_DEMONAME]; // when not playing
|
||||
int demonum; // -1 = don't play demos
|
||||
char demos[MAX_DEMOS][MAX_DEMONAME]; // when not playing
|
||||
|
||||
// demo recording info must be here, because record is started before
|
||||
// entering a map (and clearing client_state_t)
|
||||
qboolean demorecording;
|
||||
qboolean demo_capture;
|
||||
qboolean demoplayback;
|
||||
qboolean timedemo;
|
||||
int forcetrack; // -1 = use normal cd track
|
||||
QFile *demofile;
|
||||
int td_lastframe; // to meter out one message a frame
|
||||
int td_startframe; // host_framecount at start
|
||||
float td_starttime; // realtime at second frame of timedemo
|
||||
QFile *demofile;
|
||||
qboolean demorecording;
|
||||
qboolean demo_capture;
|
||||
qboolean demoplayback;
|
||||
int forcetrack; // -1 = use normal cd track
|
||||
qboolean timedemo;
|
||||
int td_lastframe; // to meter out one message a frame
|
||||
int td_startframe; // host_framecount at start
|
||||
float td_starttime; // realtime at second frame of timedemo
|
||||
} client_static_t;
|
||||
|
||||
extern client_static_t cls;
|
||||
|
@ -131,7 +129,7 @@ extern client_static_t cls;
|
|||
#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
|
||||
#define FPD_NO_TEAMCOLOR 0x0200 // Disable color force
|
||||
#define FPD_NO_TEAMCOLOR 0x0200 // Disable color force
|
||||
#define FPD_HIDE_ITEM 0x0400 // No idea what this does
|
||||
#define FPD_LIMIT_PITCH 0x4000 // Limit pitchspeed
|
||||
#define FPD_LIMIT_YAW 0x8000 // Limit yawspeed
|
||||
|
@ -144,97 +142,93 @@ extern client_static_t cls;
|
|||
|
||||
|
||||
/*
|
||||
the client_state_t structure is wiped completely at every
|
||||
server signon
|
||||
the client_state_t structure is wiped completely at every server signon
|
||||
*/
|
||||
typedef struct {
|
||||
qboolean loading;
|
||||
|
||||
int movemessages; // Since connecting to this server throw out
|
||||
int movemessages; // Since connecting to this server throw out
|
||||
// the first couple, so the player doesn't
|
||||
// accidentally do something the first frame
|
||||
usercmd_t cmd; // Last command sent to the server
|
||||
usercmd_t cmd; // Last command sent to the server
|
||||
|
||||
// information for local display
|
||||
int stats[MAX_CL_STATS]; // Health, etc
|
||||
float item_gettime[32]; // cl.time of aquiring item, for blinking
|
||||
float faceanimtime; // Use anim frame if cl.time < this
|
||||
int stats[MAX_CL_STATS]; // Health, etc
|
||||
float item_gettime[32]; // cl.time of aquiring item, for blinking
|
||||
float faceanimtime; // Use anim frame if cl.time < this
|
||||
|
||||
cshift_t cshifts[NUM_CSHIFTS]; // Color shifts for damage, powerups
|
||||
cshift_t prev_cshifts[NUM_CSHIFTS]; // And content types
|
||||
cshift_t cshifts[NUM_CSHIFTS]; // Color shifts for damage, powerups
|
||||
cshift_t prev_cshifts[NUM_CSHIFTS]; // and content types
|
||||
|
||||
// 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.
|
||||
vec3_t mviewangles[2]; // During demo playback viewangles is lerped
|
||||
vec3_t mviewangles[2]; // During demo playback viewangles is lerped
|
||||
// between these
|
||||
vec3_t viewangles;
|
||||
vec3_t mvelocity[2]; // Update by server, used for lean+bob
|
||||
vec3_t viewangles;
|
||||
vec3_t mvelocity[2]; // Update by server, used for lean+bob
|
||||
// (0 is newest)
|
||||
vec3_t velocity; // Lerped between mvelocity[0] and [1]
|
||||
vec3_t punchangle; // Temporary offset
|
||||
vec3_t velocity; // Lerped between mvelocity[0] and [1]
|
||||
vec3_t punchangle; // Temporary offset
|
||||
|
||||
// pitch drifting vars
|
||||
float idealpitch;
|
||||
float pitchvel;
|
||||
qboolean nodrift;
|
||||
float driftmove;
|
||||
double laststop;
|
||||
float idealpitch;
|
||||
float pitchvel;
|
||||
qboolean nodrift;
|
||||
float driftmove;
|
||||
double laststop;
|
||||
|
||||
float viewheight;
|
||||
float crouch; // Local amount for smoothing stepups
|
||||
qboolean paused; // Sent over by server
|
||||
int onground;
|
||||
float viewheight;
|
||||
float crouch; // Local amount for smoothing stepups
|
||||
qboolean inwater;
|
||||
|
||||
qboolean paused; // Sent over by server
|
||||
int onground;
|
||||
qboolean inwater;
|
||||
int intermission; // Don't change view angle, full screen, etc
|
||||
int completed_time; // Latched at intermission start
|
||||
|
||||
int intermission; // Don't change view angle, full screen, etc
|
||||
int completed_time; // Latched at intermission start
|
||||
|
||||
double mtime[2]; // The timestamp of last two messages
|
||||
double time; // Clients view of time, should be between
|
||||
double mtime[2]; // The timestamp of last two messages
|
||||
double time; // Clients view of time, should be between
|
||||
// servertime and oldvertime to generate a
|
||||
// lerp point for other data
|
||||
double oldtime; // Previous cl.time, time-oldtime is used
|
||||
double oldtime; // Previous cl.time, time-oldtime is used
|
||||
// to decay light values and smooth step ups
|
||||
|
||||
float last_received_message; // (realtime) for net trouble icon
|
||||
float last_received_message; // (realtime) for net trouble icon
|
||||
|
||||
/* information that is static for the entire time connected to a server */
|
||||
|
||||
struct model_s *model_precache[MAX_MODELS];
|
||||
struct sfx_s *sound_precache[MAX_SOUNDS];
|
||||
struct model_s *model_precache[MAX_MODELS];
|
||||
struct sfx_s *sound_precache[MAX_SOUNDS];
|
||||
int nummodels;
|
||||
int numsounds;
|
||||
|
||||
struct plitem_s *edicts;
|
||||
struct plitem_s *worldspawn;
|
||||
|
||||
char levelname[40]; // for display on solo scoreboard
|
||||
int viewentity; // cl_entitites[cl.viewentity] = player
|
||||
unsigned protocol;
|
||||
int maxclients;
|
||||
int gametype;
|
||||
|
||||
// refresh related state
|
||||
struct model_s *worldmodel; // cl_entitites[0].model
|
||||
int num_entities; // held in cl_entities array
|
||||
entity_t viewent; // the gun model
|
||||
|
||||
int cdtrack, looptrack; // cd audio
|
||||
|
||||
// frag scoreboard
|
||||
scoreboard_t *scores; // [cl.maxclients]
|
||||
|
||||
char levelname[40]; // for display on solo scoreboard
|
||||
int spectator;
|
||||
|
||||
int sv_cshifts;
|
||||
int viewentity; // cl_entitites[cl.viewentity] = player
|
||||
unsigned protocol;
|
||||
int gametype;
|
||||
int maxclients;
|
||||
int chase;
|
||||
int sv_cshifts;
|
||||
int watervis;
|
||||
int fpd;
|
||||
|
||||
lightstyle_t lightstyle[MAX_LIGHTSTYLES];
|
||||
// refresh related state
|
||||
struct model_s *worldmodel; // cl_entitites[0].model
|
||||
int num_entities; // held in cl_entities array
|
||||
entity_t viewent; // the weapon model
|
||||
|
||||
int cdtrack, looptrack; // cd audio
|
||||
|
||||
// frag scoreboard
|
||||
scoreboard_t *scores; // [cl.maxclients]
|
||||
|
||||
lightstyle_t lightstyle[MAX_LIGHTSTYLES];
|
||||
} client_state_t;
|
||||
|
||||
|
||||
|
|
|
@ -126,71 +126,68 @@ typedef enum {
|
|||
the client_static_t structure is persistant through an arbitrary number
|
||||
of server connections
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
// connection information
|
||||
cactive_t state;
|
||||
cactive_t state;
|
||||
|
||||
// network stuff
|
||||
netchan_t netchan;
|
||||
int qport;
|
||||
int challenge;
|
||||
float latency; // rolling average
|
||||
netchan_t netchan;
|
||||
int qport;
|
||||
int challenge;
|
||||
float latency; // rolling average
|
||||
struct dstring_s *servername; // name of server from original connect
|
||||
netadr_t server_addr; // address of server
|
||||
netadr_t server_addr; // address of server
|
||||
|
||||
// private userinfo for sending to masterless servers
|
||||
struct info_s *userinfo;
|
||||
|
||||
// file transfer from server
|
||||
QFile *download;
|
||||
QFile *download;
|
||||
struct dstring_s *downloadtempname;
|
||||
struct dstring_s *downloadname;
|
||||
struct dstring_s *downloadurl;
|
||||
int downloadnumber;
|
||||
dltype_t downloadtype;
|
||||
int downloadpercent;
|
||||
int downloadnumber;
|
||||
dltype_t downloadtype;
|
||||
int downloadpercent;
|
||||
|
||||
// demo loop control
|
||||
int demonum; // -1 = don't play demos
|
||||
char demos[MAX_DEMOS][MAX_DEMONAME]; // when not playing
|
||||
int demonum; // -1 = don't play demos
|
||||
char demos[MAX_DEMOS][MAX_DEMONAME]; // when not playing
|
||||
|
||||
// demo recording info must be here, because record is started before
|
||||
// entering a map (and clearing client_state_t)
|
||||
qboolean demorecording;
|
||||
qboolean demo_capture;
|
||||
qboolean demoplayback;
|
||||
qboolean demoplayback2;
|
||||
qboolean findtrack;
|
||||
int lastto;
|
||||
int lasttype;
|
||||
int prevtime;
|
||||
double basetime;
|
||||
qboolean timedemo;
|
||||
QFile *demofile;
|
||||
float td_lastframe; // to meter out one message a frame
|
||||
int td_startframe; // host_framecount at start
|
||||
float td_starttime; // realtime at second frame of timedemo
|
||||
QFile *demofile;
|
||||
qboolean demorecording;
|
||||
qboolean demo_capture;
|
||||
qboolean demoplayback;
|
||||
qboolean demoplayback2;
|
||||
qboolean findtrack;
|
||||
int lastto;
|
||||
int lasttype;
|
||||
int prevtime;
|
||||
double basetime;
|
||||
qboolean timedemo;
|
||||
int td_lastframe; // to meter out one message a frame
|
||||
int td_startframe; // host_framecount at start
|
||||
float td_starttime; // realtime at second frame of timedemo
|
||||
} client_static_t;
|
||||
|
||||
extern client_static_t cls;
|
||||
|
||||
#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
|
||||
#define FPD_NO_TEAMCOLOR 0x0200 // Disable color force
|
||||
#define FPD_HIDE_ITEM 0x0400 // No idea what this does
|
||||
#define FPD_LIMIT_PITCH 0x4000 // Limit pitchspeed
|
||||
#define FPD_LIMIT_YAW 0x8000 // Limit yawspeed
|
||||
#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
|
||||
#define FPD_NO_TEAMCOLOR 0x0200 // Disable color force
|
||||
#define FPD_HIDE_ITEM 0x0400 // No idea what this does
|
||||
#define FPD_LIMIT_PITCH 0x4000 // Limit pitchspeed
|
||||
#define FPD_LIMIT_YAW 0x8000 // Limit yawspeed
|
||||
|
||||
#define FPD_DEFAULT (FPD_HIDE_PERCENTE | FPD_NO_TEAMSKIN)
|
||||
#define FPD_DEFAULT (FPD_HIDE_PERCENTE | FPD_NO_TEAMSKIN)
|
||||
|
||||
// These limits prevent a usable RJ script, requiring > 0.1 sec of turning time.
|
||||
#define FPD_MAXPITCH 1000
|
||||
#define FPD_MAXYAW 2000
|
||||
#define FPD_MAXYAW 2000
|
||||
|
||||
// Default fbskins value. This should really be different for different gamedirs, but eh
|
||||
#define FBSKINS_DEFAULT 0.0
|
||||
|
@ -201,99 +198,97 @@ extern client_static_t cls;
|
|||
typedef struct {
|
||||
qboolean loading;
|
||||
|
||||
int movemessages; // Since connecting to this server throw out
|
||||
int movemessages; // Since connecting to this server throw out
|
||||
// the first couple, so the player doesn't
|
||||
// accidentally do something the first frame
|
||||
// sentcmds[cl.netchan.outgoing_sequence & UPDATE_MASK] = cmd
|
||||
frame_t frames[UPDATE_BACKUP];
|
||||
frame_t frames[UPDATE_BACKUP];
|
||||
|
||||
// information for local display
|
||||
int stats[MAX_CL_STATS]; // health, etc
|
||||
float item_gettime[32]; // cl.time of aquiring item, for blinking
|
||||
float faceanimtime; // use anim frame if cl.time < this
|
||||
int stats[MAX_CL_STATS]; // health, etc
|
||||
float item_gettime[32]; // cl.time of aquiring item, for blinking
|
||||
float faceanimtime; // Use anim frame if cl.time < this
|
||||
|
||||
cshift_t cshifts[NUM_CSHIFTS]; // color shifts for damage, powerups
|
||||
cshift_t prev_cshifts[NUM_CSHIFTS]; // and content types
|
||||
cshift_t cshifts[NUM_CSHIFTS]; // Color shifts for damage, powerups
|
||||
cshift_t prev_cshifts[NUM_CSHIFTS]; // and content types
|
||||
|
||||
// the client maintains its own idea of view angles, which are sent to the
|
||||
// server each frame. And reset only at level change and teleport times
|
||||
vec3_t viewangles;
|
||||
vec3_t viewangles;
|
||||
|
||||
// the client simulates or interpolates movement to get these values
|
||||
double time; // this is the time value that the client
|
||||
double time; // this is the time value that the client
|
||||
// is rendering at. always <= realtime
|
||||
vec3_t simorg;
|
||||
vec3_t simvel;
|
||||
vec3_t simangles;
|
||||
vec3_t simorg;
|
||||
vec3_t simvel;
|
||||
vec3_t simangles;
|
||||
|
||||
vec3_t punchangle; // temporary view kick from weapon firing
|
||||
vec3_t punchangle; // temporary view kick from weapon firing
|
||||
|
||||
// pitch drifting vars
|
||||
float idealpitch;
|
||||
float pitchvel;
|
||||
qboolean nodrift;
|
||||
float driftmove;
|
||||
double laststop;
|
||||
float idealpitch;
|
||||
float pitchvel;
|
||||
qboolean nodrift;
|
||||
float driftmove;
|
||||
double laststop;
|
||||
|
||||
qboolean paused; // Sent over by server
|
||||
int onground; // -1 when in air
|
||||
qboolean paused; // Sent over by server
|
||||
int onground; // -1 when in air
|
||||
float viewheight;
|
||||
float crouch; // local amount for smoothing stepups
|
||||
float crouch; // local amount for smoothing stepups
|
||||
|
||||
int servercount; // server identification for prespawns
|
||||
struct info_s *serverinfo;
|
||||
int parsecount; // server message counter
|
||||
int validsequence; // this is the sequence number of the last good
|
||||
int intermission; // don't change view angle, full screen, etc
|
||||
int completed_time; // latched from time at intermission start
|
||||
|
||||
int servercount; // server identification for prespawns
|
||||
struct info_s *serverinfo;
|
||||
int parsecount; // server message counter
|
||||
int validsequence; // this is the sequence number of the last good
|
||||
// packetentity_t we got. If this is 0, we
|
||||
// can't render a frame yet
|
||||
|
||||
int spectator;
|
||||
|
||||
double last_ping_request; // while showing scoreboard
|
||||
double last_servermessage;
|
||||
|
||||
int intermission; // don't change view angle, full screen, etc
|
||||
int completed_time; // latched from time at intermission start
|
||||
double last_ping_request; // while showing scoreboard
|
||||
double last_servermessage;
|
||||
|
||||
/* information that is static for the entire time connected to a server */
|
||||
|
||||
char model_name[MAX_MODELS][MAX_QPATH];
|
||||
char sound_name[MAX_SOUNDS][MAX_QPATH];
|
||||
char model_name[MAX_MODELS][MAX_QPATH];
|
||||
char sound_name[MAX_SOUNDS][MAX_QPATH];
|
||||
|
||||
struct model_s *model_precache[MAX_MODELS];
|
||||
struct sfx_s *sound_precache[MAX_SOUNDS];
|
||||
struct model_s *model_precache[MAX_MODELS];
|
||||
struct sfx_s *sound_precache[MAX_SOUNDS];
|
||||
int nummodels;
|
||||
int numsounds;
|
||||
|
||||
struct plitem_s *edicts;
|
||||
struct plitem_s *worldspawn;
|
||||
|
||||
char levelname[40]; // for display on solo scoreboard
|
||||
int playernum;
|
||||
int viewentity;
|
||||
float stdver;
|
||||
|
||||
// serverinfo mirrors
|
||||
int chase;
|
||||
int sv_cshifts;
|
||||
int no_pogo_stick;
|
||||
int teamplay;
|
||||
int watervis;
|
||||
int fpd;
|
||||
int fbskins;
|
||||
char levelname[40]; // for display on solo scoreboard
|
||||
int spectator;
|
||||
int playernum;
|
||||
int viewentity;
|
||||
float stdver;
|
||||
int maxclients;
|
||||
// serverinfo mirrors
|
||||
int chase;
|
||||
int sv_cshifts;
|
||||
int no_pogo_stick;
|
||||
int teamplay;
|
||||
int watervis;
|
||||
int fpd;
|
||||
int fbskins;
|
||||
|
||||
// refresh related state
|
||||
struct model_s *worldmodel; // cl_entitites[0].model
|
||||
int num_entities; // stored bottom up in cl_entities array
|
||||
entity_t viewent; // weapon model
|
||||
struct model_s *worldmodel; // cl_entitites[0].model
|
||||
int num_entities; // stored bottom up in cl_entities array
|
||||
entity_t viewent; // the weapon model
|
||||
|
||||
int cdtrack; // cd audio
|
||||
int cdtrack; // cd audio
|
||||
|
||||
// all player information
|
||||
player_info_t players[MAX_CLIENTS];
|
||||
player_info_t players[MAX_CLIENTS];
|
||||
|
||||
lightstyle_t lightstyle[MAX_LIGHTSTYLES];
|
||||
lightstyle_t lightstyle[MAX_LIGHTSTYLES];
|
||||
} client_state_t;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue