mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 15:01:41 +00:00
o misc little cleanups
o add plent_state_t, packet_players_t and delta_t in preparation for re-worked delta compression code. o use plent_state_t in the client.
This commit is contained in:
parent
2697671a9b
commit
d308d324cc
12 changed files with 195 additions and 177 deletions
|
@ -125,7 +125,7 @@
|
|||
#define clc_bad 0
|
||||
#define clc_nop 1
|
||||
//define clc_doublemove 2
|
||||
#define clc_move 3 // [[usercmd_t]
|
||||
#define clc_move 3 // [usercmd_t]
|
||||
#define clc_stringcmd 4 // [string] message
|
||||
#define clc_delta 5 // [byte] sequence number, requests delta compression of message
|
||||
#define clc_tmove 6 // teleport request, spectator only
|
||||
|
@ -182,7 +182,7 @@
|
|||
|
||||
// if the high bit of the client to server byte is set, the low bits are
|
||||
// client move cmd bits
|
||||
// ms and angle2 are always sent, the others are optional
|
||||
// msec is always sent, the others are optional
|
||||
#define CM_ANGLE1 (1<<0)
|
||||
#define CM_ANGLE3 (1<<1)
|
||||
#define CM_FORWARD (1<<2)
|
||||
|
@ -279,44 +279,68 @@
|
|||
|
||||
// entity_state_t is the information conveyed from the server
|
||||
// in an update message
|
||||
typedef struct
|
||||
{
|
||||
int number; // edict index
|
||||
typedef struct {
|
||||
int number; // edict index
|
||||
|
||||
int flags; // nolerp, etc
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
int modelindex;
|
||||
int frame;
|
||||
int colormap;
|
||||
int skinnum;
|
||||
int effects;
|
||||
unsigned int flags; // nolerp, etc
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
int modelindex;
|
||||
int frame;
|
||||
int colormap;
|
||||
int skinnum;
|
||||
int effects;
|
||||
|
||||
// LordHavoc: Endy neglected to mark this as a QSG version 2 thingy...
|
||||
byte alpha;
|
||||
byte scale;
|
||||
byte glow_size;
|
||||
byte glow_color;
|
||||
byte colormod;
|
||||
// QSG 2
|
||||
byte alpha;
|
||||
byte scale;
|
||||
byte glow_size;
|
||||
byte glow_color;
|
||||
byte colormod;
|
||||
} entity_state_t;
|
||||
|
||||
|
||||
#define MAX_PACKET_ENTITIES 64 // doesn't count nails
|
||||
#define MAX_DEMO_PACKET_ENTITIES 196 // doesn't count nails
|
||||
typedef struct
|
||||
{
|
||||
int num_entities;
|
||||
entity_state_t *entities;
|
||||
typedef struct {
|
||||
int num_entities;
|
||||
entity_state_t *entities;
|
||||
} packet_entities_t;
|
||||
|
||||
typedef struct usercmd_s
|
||||
{
|
||||
byte msec;
|
||||
byte padding[3]; // make sure non-aligning compilers get it right
|
||||
vec3_t angles;
|
||||
short forwardmove, sidemove, upmove;
|
||||
byte buttons;
|
||||
byte impulse;
|
||||
typedef struct usercmd_s {
|
||||
byte msec;
|
||||
byte padding[3]; // make sure non-aligning compilers get it right
|
||||
vec3_t angles;
|
||||
short forwardmove, sidemove, upmove;
|
||||
byte buttons;
|
||||
byte impulse;
|
||||
} usercmd_t;
|
||||
|
||||
typedef struct plent_state_s {
|
||||
int number;
|
||||
|
||||
unsigned int flags;
|
||||
vec3_t origin;
|
||||
usercmd_t cmd;
|
||||
vec3_t velocity;
|
||||
int modelindex;
|
||||
int frame;
|
||||
int skinnum;
|
||||
int effects;
|
||||
int weaponframe;
|
||||
|
||||
byte msec;
|
||||
|
||||
// QSG 2
|
||||
byte alpha;
|
||||
byte scale;
|
||||
byte glow_size;
|
||||
byte glow_color;
|
||||
byte colormod;
|
||||
} plent_state_t;
|
||||
|
||||
typedef struct {
|
||||
int num_players;
|
||||
plent_state_t *players;
|
||||
} packet_players_t;
|
||||
|
||||
#endif//__qw_protocol_h
|
||||
|
|
|
@ -49,29 +49,15 @@ typedef struct player_state_s {
|
|||
|
||||
double state_time; // not the same as the packet time,
|
||||
// because player commands come asyncronously
|
||||
usercmd_t command; // last command for prediction
|
||||
|
||||
vec3_t origin;
|
||||
vec3_t viewangles; // only for demos, not from server
|
||||
vec3_t velocity;
|
||||
int weaponframe;
|
||||
|
||||
int number;
|
||||
int modelindex;
|
||||
int frame;
|
||||
int skinnum;
|
||||
int effects;
|
||||
|
||||
int flags; // dead, gib, etc
|
||||
plent_state_t pls;
|
||||
|
||||
float waterjumptime;
|
||||
int onground; // -1 = in air, else pmove entity number
|
||||
int oldbuttons;
|
||||
int oldonground;
|
||||
|
||||
// QSG2
|
||||
byte glow_size;
|
||||
byte glow_color;
|
||||
} player_state_t;
|
||||
|
||||
#undef MAX_SCOREBOARDNAME
|
||||
|
|
|
@ -56,8 +56,7 @@ typedef enum {
|
|||
// some qc commands are only valid before the server has finished
|
||||
// initializing (precache commands, static sounds / objects, etc)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
qboolean active; // false when server is going down
|
||||
server_state_t state; // precache commands are only valid during load
|
||||
|
||||
|
@ -118,8 +117,7 @@ typedef struct
|
|||
|
||||
#define NUM_SPAWN_PARMS 16
|
||||
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
cs_free, // can be reused for a new connection
|
||||
cs_server, // client is grabbed by the server for its own purposes
|
||||
cs_zombie, // client has been disconnected, but don't reuse
|
||||
|
@ -128,16 +126,31 @@ typedef enum
|
|||
cs_spawned // client is fully in game
|
||||
} sv_client_state_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
// received from client
|
||||
|
||||
// reply
|
||||
double senttime;
|
||||
float ping_time;
|
||||
packet_entities_t entities;
|
||||
packet_players_t players;
|
||||
} client_frame_t;
|
||||
|
||||
typedef enum {
|
||||
dt_pvs_normal,
|
||||
dt_pvs_fat,
|
||||
dt_pvs_none,
|
||||
} delta_pvs_t;
|
||||
|
||||
typedef struct {
|
||||
delta_pvs_t pvs;
|
||||
int delta_sequence;
|
||||
int cur_frame;
|
||||
int out_frame;
|
||||
struct client_s *client;
|
||||
client_frame_t frames[UPDATE_BACKUP]; // updates can be deltad from here
|
||||
} delta_t;
|
||||
|
||||
#define MAX_BACK_BUFFERS 8
|
||||
#define MAX_STUFFTEXT 512
|
||||
#define MAX_NAME 32
|
||||
|
@ -148,8 +161,7 @@ typedef enum {
|
|||
ft_cuff, // cuff penatly save over disconnect
|
||||
} filtertype_t;
|
||||
|
||||
typedef struct client_s
|
||||
{
|
||||
typedef struct client_s {
|
||||
sv_client_state_t state;
|
||||
int ping; // fake ping for server clients
|
||||
qboolean prespawned;
|
||||
|
@ -158,14 +170,14 @@ typedef struct client_s
|
|||
int spectator; // non-interactive
|
||||
|
||||
qboolean sendinfo; // at end of frame, send info to all
|
||||
// this prevents malicious multiple broadcasts
|
||||
// this prevents malicious multiple
|
||||
// broadcasts
|
||||
float lastnametime; // time of last name change
|
||||
int lastnamecount; // time of last name change
|
||||
unsigned int checksum; // checksum for calcs
|
||||
qboolean drop; // lose this guy next opportunity
|
||||
int lossage; // loss percentage
|
||||
|
||||
int userid; // identifying number
|
||||
int userid; // identifying number
|
||||
struct info_s *userinfo; // infostring
|
||||
|
||||
usercmd_t lastcmd; // for filling in big drops and partial predictions
|
||||
|
@ -176,8 +188,8 @@ typedef struct client_s
|
|||
float maxspeed; // localized maxspeed
|
||||
float entgravity; // localized ent gravity
|
||||
|
||||
struct edict_s *edict; // EDICT_NUM(clientnum+1)
|
||||
char name[MAX_NAME]; // for printing to other people
|
||||
struct edict_s *edict; // EDICT_NUM(clientnum+1)
|
||||
char name[MAX_NAME]; // for printing to other people
|
||||
// extracted from userinfo
|
||||
int messagelevel; // for filtering printed messages
|
||||
|
||||
|
@ -214,8 +226,6 @@ typedef struct client_s
|
|||
int whensaidhead; // Head value for floodprots
|
||||
double lockedtill;
|
||||
|
||||
qboolean upgradewarn; // did we warn him?
|
||||
|
||||
QFile *upload;
|
||||
struct dstring_s *uploadfn;
|
||||
netadr_t snap_from;
|
||||
|
@ -243,8 +253,7 @@ extern qboolean rcon_from_user; // current command is a from a user
|
|||
|
||||
|
||||
#define STATFRAMES 100
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
double active;
|
||||
double idle;
|
||||
double demo;
|
||||
|
@ -262,15 +271,13 @@ typedef struct
|
|||
// out before legitimate users connected
|
||||
#define MAX_CHALLENGES 1024
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
netadr_t adr;
|
||||
int challenge;
|
||||
int time;
|
||||
} challenge_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
int spawncount; // number of servers spawned since start,
|
||||
// used to check late spawns
|
||||
client_t clients[MAX_CLIENTS];
|
||||
|
@ -300,8 +307,7 @@ typedef struct
|
|||
//=============================================================================
|
||||
// DoSflood protection
|
||||
//=============================================================================
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
netadr_t adr;
|
||||
double issued;
|
||||
int floodcount;
|
||||
|
@ -309,8 +315,7 @@ typedef struct
|
|||
double firstseen;
|
||||
} flood_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
FLOOD_PING,
|
||||
FLOOD_LOG,
|
||||
FLOOD_CONNECT,
|
||||
|
|
|
@ -229,23 +229,23 @@ Cam_TryFlyby (player_state_t * self, player_state_t * player, vec3_t vec,
|
|||
vectoangles (vec, v);
|
||||
VectorCopy (v, pmove.angles);
|
||||
VectorNormalize (vec);
|
||||
VectorMultAdd (player->origin, 800, vec, v);
|
||||
VectorMultAdd (player->pls.origin, 800, vec, v);
|
||||
// v is endpos
|
||||
// fake a player move
|
||||
trace = Cam_DoTrace (player->origin, v);
|
||||
trace = Cam_DoTrace (player->pls.origin, v);
|
||||
if ( /* trace.inopen || */ trace.inwater)
|
||||
return 9999;
|
||||
VectorCopy (trace.endpos, vec);
|
||||
len = VectorDistance (trace.endpos, player->origin);
|
||||
len = VectorDistance (trace.endpos, player->pls.origin);
|
||||
|
||||
if (len < 32 || len > 800)
|
||||
return 9999;
|
||||
if (checkvis) {
|
||||
trace = Cam_DoTrace (self->origin, vec);
|
||||
trace = Cam_DoTrace (self->pls.origin, vec);
|
||||
if (trace.fraction != 1 || trace.inwater)
|
||||
return 9999;
|
||||
|
||||
len = VectorDistance (trace.endpos, self->origin);
|
||||
len = VectorDistance (trace.endpos, self->pls.origin);
|
||||
}
|
||||
|
||||
return len;
|
||||
|
@ -259,11 +259,11 @@ Cam_IsVisible (player_state_t * player, vec3_t vec)
|
|||
trace_t trace;
|
||||
vec3_t v;
|
||||
|
||||
trace = Cam_DoTrace (player->origin, vec);
|
||||
trace = Cam_DoTrace (player->pls.origin, vec);
|
||||
if (trace.fraction != 1 || /* trace.inopen || */ trace.inwater)
|
||||
return false;
|
||||
// check distance, don't let the player get too far away or too close
|
||||
VectorSubtract (player->origin, vec, v);
|
||||
VectorSubtract (player->pls.origin, vec, v);
|
||||
d = VectorLength (v);
|
||||
|
||||
return (d > 16.0);
|
||||
|
@ -451,22 +451,22 @@ Cam_Track (usercmd_t *cmd)
|
|||
cmd->forwardmove = cmd->sidemove = cmd->upmove = 0;
|
||||
|
||||
VectorCopy (player->viewangles, cl.viewangles);
|
||||
VectorCopy (player->origin, desired_position);
|
||||
if (memcmp (&desired_position, &self->origin,
|
||||
VectorCopy (player->pls.origin, desired_position);
|
||||
if (memcmp (&desired_position, &self->pls.origin,
|
||||
sizeof (desired_position)) != 0) {
|
||||
if (!cls.demoplayback) {
|
||||
MSG_WriteByte (&cls.netchan.message, clc_tmove);
|
||||
MSG_WriteCoordV (&cls.netchan.message, desired_position);
|
||||
}
|
||||
// move there locally immediately
|
||||
VectorCopy (desired_position, self->origin);
|
||||
VectorCopy (desired_position, self->pls.origin);
|
||||
}
|
||||
self->weaponframe = player->weaponframe;
|
||||
self->pls.weaponframe = player->pls.weaponframe;
|
||||
|
||||
} else {
|
||||
// Ok, move to our desired position and set our angles to view
|
||||
// the player
|
||||
VectorSubtract (desired_position, self->origin, vec);
|
||||
VectorSubtract (desired_position, self->pls.origin, vec);
|
||||
len = VectorLength (vec);
|
||||
cmd->forwardmove = cmd->sidemove = cmd->upmove = 0;
|
||||
if (len > 16) { // close enough?
|
||||
|
@ -476,9 +476,9 @@ Cam_Track (usercmd_t *cmd)
|
|||
}
|
||||
}
|
||||
// move there locally immediately
|
||||
VectorCopy (desired_position, self->origin);
|
||||
VectorCopy (desired_position, self->pls.origin);
|
||||
|
||||
VectorSubtract (player->origin, desired_position, vec);
|
||||
VectorSubtract (player->pls.origin, desired_position, vec);
|
||||
vectoangles (vec, cl.viewangles);
|
||||
cl.viewangles[0] = -cl.viewangles[0];
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ Cam_SetView (void)
|
|||
player = frame->playerstate + spec_track;
|
||||
self = frame->playerstate + cl.playernum;
|
||||
|
||||
VectorSubtract (player->origin, cl.simorg, vec);
|
||||
VectorSubtract (player->pls.origin, cl.simorg, vec);
|
||||
if (cam_forceview) {
|
||||
cam_forceview = false;
|
||||
vectoangles (vec, cam_viewangles);
|
||||
|
@ -570,7 +570,7 @@ Cam_FinishMove (usercmd_t *cmd)
|
|||
player = frame->playerstate + spec_track;
|
||||
self = frame->playerstate + cl.playernum;
|
||||
|
||||
VectorSubtract (player->origin, self->origin, vec);
|
||||
VectorSubtract (player->pls.origin, self->pls.origin, vec);
|
||||
if (cam_forceview) {
|
||||
cam_forceview = false;
|
||||
vectoangles (vec, cam_viewangles);
|
||||
|
|
|
@ -675,7 +675,7 @@ CL_ParsePlayerinfo (void)
|
|||
info = &cl.players[num];
|
||||
state = &cl.frames[parsecountmod].playerstate[num];
|
||||
|
||||
state->number = num;
|
||||
state->pls.number = num;
|
||||
|
||||
if (cls.demoplayback2) {
|
||||
if (info->prevcount > cl.parsecount || !cl.parsecount) {
|
||||
|
@ -699,35 +699,35 @@ CL_ParsePlayerinfo (void)
|
|||
memcpy (state, prevstate, sizeof (player_state_t));
|
||||
|
||||
flags = MSG_ReadShort (net_message);
|
||||
state->flags = TranslateFlags (flags);
|
||||
state->pls.flags = TranslateFlags (flags);
|
||||
state->messagenum = cl.parsecount;
|
||||
state->command.msec = 0;
|
||||
state->frame = MSG_ReadByte (net_message);
|
||||
state->pls.cmd.msec = 0;
|
||||
state->pls.frame = MSG_ReadByte (net_message);
|
||||
state->state_time = parsecounttime;
|
||||
for (i=0; i <3; i++)
|
||||
if (flags & (DF_ORIGIN << i))
|
||||
state->origin[i] = MSG_ReadCoord (net_message);
|
||||
state->pls.origin[i] = MSG_ReadCoord (net_message);
|
||||
for (i=0; i <3; i++)
|
||||
if (flags & (DF_ANGLES << i))
|
||||
state->command.angles[i] = MSG_ReadAngle16 (net_message);
|
||||
state->pls.cmd.angles[i] = MSG_ReadAngle16 (net_message);
|
||||
if (flags & DF_MODEL)
|
||||
state->modelindex = MSG_ReadByte (net_message);
|
||||
state->pls.modelindex = MSG_ReadByte (net_message);
|
||||
if (flags & DF_SKINNUM)
|
||||
state->skinnum = MSG_ReadByte (net_message);
|
||||
state->pls.skinnum = MSG_ReadByte (net_message);
|
||||
if (flags & DF_EFFECTS)
|
||||
state->effects = MSG_ReadByte (net_message);
|
||||
state->pls.effects = MSG_ReadByte (net_message);
|
||||
if (flags & DF_WEAPONFRAME)
|
||||
state->weaponframe = MSG_ReadByte (net_message);
|
||||
VectorCopy (state->command.angles, state->viewangles);
|
||||
state->pls.weaponframe = MSG_ReadByte (net_message);
|
||||
VectorCopy (state->pls.cmd.angles, state->viewangles);
|
||||
return;
|
||||
}
|
||||
|
||||
flags = state->flags = MSG_ReadShort (net_message);
|
||||
flags = state->pls.flags = MSG_ReadShort (net_message);
|
||||
|
||||
state->messagenum = cl.parsecount;
|
||||
MSG_ReadCoordV (net_message, state->origin);
|
||||
MSG_ReadCoordV (net_message, state->pls.origin);
|
||||
|
||||
state->frame = MSG_ReadByte (net_message);
|
||||
state->pls.frame = MSG_ReadByte (net_message);
|
||||
|
||||
// the other player's last move was likely some time
|
||||
// before the packet was sent out, so accurately track
|
||||
|
@ -739,36 +739,36 @@ CL_ParsePlayerinfo (void)
|
|||
state->state_time = parsecounttime;
|
||||
|
||||
if (flags & PF_COMMAND)
|
||||
MSG_ReadDeltaUsercmd (net_message, &nullcmd, &state->command);
|
||||
MSG_ReadDeltaUsercmd (net_message, &nullcmd, &state->pls.cmd);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (flags & (PF_VELOCITY1 << i))
|
||||
state->velocity[i] = MSG_ReadShort (net_message);
|
||||
state->pls.velocity[i] = MSG_ReadShort (net_message);
|
||||
else
|
||||
state->velocity[i] = 0;
|
||||
state->pls.velocity[i] = 0;
|
||||
}
|
||||
if (flags & PF_MODEL)
|
||||
i = MSG_ReadByte (net_message);
|
||||
else
|
||||
i = cl_playerindex;
|
||||
state->modelindex = i;
|
||||
state->pls.modelindex = i;
|
||||
|
||||
if (flags & PF_SKINNUM)
|
||||
state->skinnum = MSG_ReadByte (net_message);
|
||||
state->pls.skinnum = MSG_ReadByte (net_message);
|
||||
else
|
||||
state->skinnum = 0;
|
||||
state->pls.skinnum = 0;
|
||||
|
||||
if (flags & PF_EFFECTS)
|
||||
state->effects = MSG_ReadByte (net_message);
|
||||
state->pls.effects = MSG_ReadByte (net_message);
|
||||
else
|
||||
state->effects = 0;
|
||||
state->pls.effects = 0;
|
||||
|
||||
if (flags & PF_WEAPONFRAME)
|
||||
state->weaponframe = MSG_ReadByte (net_message);
|
||||
state->pls.weaponframe = MSG_ReadByte (net_message);
|
||||
else
|
||||
state->weaponframe = 0;
|
||||
state->pls.weaponframe = 0;
|
||||
|
||||
VectorCopy (state->command.angles, state->viewangles);
|
||||
VectorCopy (state->pls.cmd.angles, state->viewangles);
|
||||
|
||||
if (cl.stdver >= 2.0 && (flags & PF_QF)) {
|
||||
// QSG2
|
||||
|
@ -787,13 +787,13 @@ CL_ParsePlayerinfo (void)
|
|||
ent->scale = val / 16.0;
|
||||
}
|
||||
if (bits & PF_EFFECTS2) {
|
||||
state->effects |= MSG_ReadByte (net_message) << 8;
|
||||
state->pls.effects |= MSG_ReadByte (net_message) << 8;
|
||||
}
|
||||
if (bits & PF_GLOWSIZE) {
|
||||
state->glow_size = MSG_ReadByte (net_message);
|
||||
state->pls.glow_size = MSG_ReadByte (net_message);
|
||||
}
|
||||
if (bits & PF_GLOWCOLOR) {
|
||||
state->glow_color = MSG_ReadByte (net_message);
|
||||
state->pls.glow_color = MSG_ReadByte (net_message);
|
||||
}
|
||||
if (bits & PF_COLORMOD) {
|
||||
val = MSG_ReadByte (net_message);
|
||||
|
@ -806,7 +806,7 @@ CL_ParsePlayerinfo (void)
|
|||
}
|
||||
}
|
||||
if (bits & PF_FRAME2) {
|
||||
state->frame |= MSG_ReadByte (net_message) << 8;
|
||||
state->pls.frame |= MSG_ReadByte (net_message) << 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -900,37 +900,38 @@ CL_LinkPlayers (void)
|
|||
r_player_entity = &cl_player_ents[j];
|
||||
clientplayer = true;
|
||||
} else {
|
||||
VectorCopy (state->origin, org);
|
||||
VectorCopy (state->pls.origin, org);
|
||||
clientplayer = false;
|
||||
}
|
||||
CL_NewDlight (j + 1, org, state->effects, state->glow_size,
|
||||
state->glow_color);
|
||||
CL_NewDlight (j + 1, org, state->pls.effects, state->pls.glow_size,
|
||||
state->pls.glow_color);
|
||||
|
||||
// Draw player?
|
||||
if (!Cam_DrawPlayer (j))
|
||||
continue;
|
||||
|
||||
if (!state->modelindex)
|
||||
if (!state->pls.modelindex)
|
||||
continue;
|
||||
|
||||
// Hack hack hack
|
||||
if (cl_deadbodyfilter->int_val && state->modelindex == cl_playerindex
|
||||
&& ((i = state->frame) == 49 || i == 60 || i == 69 || i == 84
|
||||
if (cl_deadbodyfilter->int_val
|
||||
&& state->pls.modelindex == cl_playerindex
|
||||
&& ((i = state->pls.frame) == 49 || i == 60 || i == 69 || i == 84
|
||||
|| i == 93 || i == 102))
|
||||
continue;
|
||||
|
||||
// only predict half the move to minimize overruns
|
||||
msec = 500 * (playertime - state->state_time);
|
||||
if (msec <= 0 || (!cl_predict_players->int_val) || cls.demoplayback2) {
|
||||
VectorCopy (state->origin, ent->origin);
|
||||
VectorCopy (state->pls.origin, ent->origin);
|
||||
} else { // predict players movement
|
||||
state->command.msec = msec = min (msec, 255);
|
||||
state->pls.cmd.msec = msec = min (msec, 255);
|
||||
|
||||
oldphysent = pmove.numphysent;
|
||||
CL_SetSolidPlayers (j);
|
||||
CL_PredictUsercmd (state, &exact, &state->command, clientplayer);
|
||||
CL_PredictUsercmd (state, &exact, &state->pls.cmd, clientplayer);
|
||||
pmove.numphysent = oldphysent;
|
||||
VectorCopy (exact.origin, ent->origin);
|
||||
VectorCopy (exact.pls.origin, ent->origin);
|
||||
}
|
||||
|
||||
// angles
|
||||
|
@ -942,17 +943,18 @@ CL_LinkPlayers (void)
|
|||
ent->angles[PITCH] = -state->viewangles[PITCH] / 3.0;
|
||||
ent->angles[YAW] = state->viewangles[YAW];
|
||||
}
|
||||
ent->angles[ROLL] = V_CalcRoll (ent->angles, state->velocity) * 4.0;
|
||||
ent->angles[ROLL] = V_CalcRoll (ent->angles,
|
||||
state->pls.velocity) * 4.0;
|
||||
|
||||
ent->model = cl.model_precache[state->modelindex];
|
||||
ent->frame = state->frame;
|
||||
ent->model = cl.model_precache[state->pls.modelindex];
|
||||
ent->frame = state->pls.frame;
|
||||
ent->colormap = info->translations;
|
||||
ent->skinnum = state->skinnum;
|
||||
ent->skinnum = state->pls.skinnum;
|
||||
|
||||
ent->min_light = 0;
|
||||
ent->fullbright = 0;
|
||||
|
||||
if (state->modelindex == cl_playerindex) { //XXX
|
||||
if (state->pls.modelindex == cl_playerindex) { //XXX
|
||||
// use custom skin
|
||||
if (!info->skin)
|
||||
Skin_Find (info);
|
||||
|
@ -976,9 +978,9 @@ CL_LinkPlayers (void)
|
|||
// stuff entity in map
|
||||
R_AddEfrags (ent);
|
||||
|
||||
if (state->effects & EF_FLAG1)
|
||||
if (state->pls.effects & EF_FLAG1)
|
||||
CL_AddFlagModels (ent, 0, j);
|
||||
else if (state->effects & EF_FLAG2)
|
||||
else if (state->pls.effects & EF_FLAG2)
|
||||
CL_AddFlagModels (ent, 1, j);
|
||||
}
|
||||
}
|
||||
|
@ -1066,30 +1068,30 @@ CL_SetUpPlayerPrediction (qboolean dopred)
|
|||
if (state->messagenum != cl.parsecount)
|
||||
continue; // not present this frame
|
||||
|
||||
if (!state->modelindex)
|
||||
if (!state->pls.modelindex)
|
||||
continue;
|
||||
|
||||
pplayer->active = true;
|
||||
pplayer->flags = state->flags;
|
||||
pplayer->flags = state->pls.flags;
|
||||
|
||||
// note that the local player is special, since he moves locally
|
||||
// we use his last predicted postition
|
||||
if (j == cl.playernum) {
|
||||
VectorCopy (cl.frames[cls.netchan.outgoing_sequence & UPDATE_MASK].
|
||||
playerstate[cl.playernum].origin, pplayer->origin);
|
||||
playerstate[cl.playernum].pls.origin, pplayer->origin);
|
||||
} else {
|
||||
// only predict half the move to minimize overruns
|
||||
msec = 500 * (playertime - state->state_time);
|
||||
if (msec <= 0 || !dopred) {
|
||||
VectorCopy (state->origin, pplayer->origin);
|
||||
VectorCopy (state->pls.origin, pplayer->origin);
|
||||
// Con_DPrintf ("nopredict\n");
|
||||
} else {
|
||||
// predict players movement
|
||||
state->command.msec = msec = min (msec, 255);
|
||||
state->pls.cmd.msec = msec = min (msec, 255);
|
||||
// Con_DPrintf ("predict: %i\n", msec);
|
||||
|
||||
CL_PredictUsercmd (state, &exact, &state->command, false);
|
||||
VectorCopy (exact.origin, pplayer->origin);
|
||||
CL_PredictUsercmd (state, &exact, &state->pls.cmd, false);
|
||||
VectorCopy (exact.pls.origin, pplayer->origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1548,8 +1548,8 @@ Host_Frame (float time)
|
|||
oldself = &cl.frames[(cls.netchan.outgoing_sequence - 1)
|
||||
& UPDATE_MASK].playerstate[cl.playernum];
|
||||
self->messagenum = cl.parsecount;
|
||||
VectorCopy (oldself->origin, self->origin);
|
||||
VectorCopy (oldself->velocity, self->velocity);
|
||||
VectorCopy (oldself->pls.origin, self->pls.origin);
|
||||
VectorCopy (oldself->pls.velocity, self->pls.velocity);
|
||||
VectorCopy (oldself->viewangles, self->viewangles);
|
||||
|
||||
CL_ParseClientdata ();
|
||||
|
|
|
@ -1171,7 +1171,7 @@ CL_MuzzleFlash (void)
|
|||
else
|
||||
AngleVectors (pl->viewangles, fv, rv, uv);
|
||||
|
||||
VectorMultAdd (pl->origin, 18, fv, dl->origin);
|
||||
VectorMultAdd (pl->pls.origin, 18, fv, dl->origin);
|
||||
dl->radius = 200 + (rand () & 31);
|
||||
dl->die = cl.time + 0.1;
|
||||
dl->minlight = 32;
|
||||
|
|
|
@ -53,10 +53,10 @@ CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u,
|
|||
qboolean clientplayer)
|
||||
{
|
||||
if (!clientplayer) {
|
||||
if (VectorIsZero (from->velocity)) {
|
||||
VectorCopy (from->origin, to->origin);
|
||||
if (VectorIsZero (from->pls.velocity)) {
|
||||
VectorCopy (from->pls.origin, to->pls.origin);
|
||||
VectorCopy (u->angles, to->viewangles);
|
||||
VectorCopy (from->velocity, to->velocity);
|
||||
VectorCopy (from->pls.velocity, to->pls.velocity);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -74,9 +74,9 @@ CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u,
|
|||
return;
|
||||
}
|
||||
|
||||
VectorCopy (from->origin, pmove.origin);
|
||||
VectorCopy (from->pls.origin, pmove.origin);
|
||||
VectorCopy (u->angles, pmove.angles);
|
||||
VectorCopy (from->velocity, pmove.velocity);
|
||||
VectorCopy (from->pls.velocity, pmove.velocity);
|
||||
|
||||
pmove.oldbuttons = from->oldbuttons;
|
||||
pmove.oldonground = from->oldonground;
|
||||
|
@ -94,11 +94,11 @@ CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u,
|
|||
to->waterjumptime = pmove.waterjumptime;
|
||||
to->oldbuttons = pmove.oldbuttons; // Tonik
|
||||
to->oldonground = pmove.oldonground;
|
||||
VectorCopy (pmove.origin, to->origin);
|
||||
VectorCopy (pmove.origin, to->pls.origin);
|
||||
VectorCopy (pmove.angles, to->viewangles);
|
||||
VectorCopy (pmove.velocity, to->velocity);
|
||||
VectorCopy (pmove.velocity, to->pls.velocity);
|
||||
to->onground = onground;
|
||||
to->weaponframe = from->weaponframe;
|
||||
to->pls.weaponframe = from->pls.weaponframe;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -151,8 +151,8 @@ CL_PredictMove (void)
|
|||
check_onserver ();
|
||||
|
||||
if (!cl_predict->int_val) {
|
||||
VectorCopy (from->playerstate[cl.playernum].velocity, cl.simvel);
|
||||
VectorCopy (from->playerstate[cl.playernum].origin, cl.simorg);
|
||||
VectorCopy (from->playerstate[cl.playernum].pls.velocity, cl.simvel);
|
||||
VectorCopy (from->playerstate[cl.playernum].pls.origin, cl.simorg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -188,21 +188,21 @@ CL_PredictMove (void)
|
|||
(to->senttime - from->senttime), 1);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (fabs (from->playerstate[cl.playernum].origin[i] -
|
||||
to->playerstate[cl.playernum].origin[i]) > 128) {
|
||||
if (fabs (from->playerstate[cl.playernum].pls.origin[i] -
|
||||
to->playerstate[cl.playernum].pls.origin[i]) > 128) {
|
||||
// teleported, so don't lerp
|
||||
VectorCopy (to->playerstate[cl.playernum].velocity, cl.simvel);
|
||||
VectorCopy (to->playerstate[cl.playernum].origin, cl.simorg);
|
||||
VectorCopy (to->playerstate[cl.playernum].pls.velocity, cl.simvel);
|
||||
VectorCopy (to->playerstate[cl.playernum].pls.origin, cl.simorg);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
cl.simorg[i] = from->playerstate[cl.playernum].origin[i] +
|
||||
f * (to->playerstate[cl.playernum].origin[i] -
|
||||
from->playerstate[cl.playernum].origin[i]);
|
||||
cl.simvel[i] = from->playerstate[cl.playernum].velocity[i] +
|
||||
f * (to->playerstate[cl.playernum].velocity[i] -
|
||||
from->playerstate[cl.playernum].velocity[i]);
|
||||
cl.simorg[i] = from->playerstate[cl.playernum].pls.origin[i] +
|
||||
f * (to->playerstate[cl.playernum].pls.origin[i] -
|
||||
from->playerstate[cl.playernum].pls.origin[i]);
|
||||
cl.simvel[i] = from->playerstate[cl.playernum].pls.velocity[i] +
|
||||
f * (to->playerstate[cl.playernum].pls.velocity[i] -
|
||||
from->playerstate[cl.playernum].pls.velocity[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -627,14 +627,14 @@ V_CalcRefdef (void)
|
|||
V_CalcViewRoll ();
|
||||
V_AddIdle ();
|
||||
|
||||
if (view_message->flags & PF_GIB)
|
||||
if (view_message->pls.flags & PF_GIB)
|
||||
r_refdef.vieworg[2] += 8; // gib view height
|
||||
else if (view_message->flags & PF_DEAD)
|
||||
else if (view_message->pls.flags & PF_DEAD)
|
||||
r_refdef.vieworg[2] -= 16; // corpse view height
|
||||
else
|
||||
r_refdef.vieworg[2] += zofs; // view height
|
||||
|
||||
if (view_message->flags & PF_DEAD) // PF_GIB will also set PF_DEAD
|
||||
if (view_message->pls.flags & PF_DEAD) // PF_GIB will also set PF_DEAD
|
||||
r_refdef.viewangles[ROLL] = 80; // dead view angle
|
||||
|
||||
// offsets
|
||||
|
@ -668,11 +668,11 @@ V_CalcRefdef (void)
|
|||
else if (scr_viewsize->int_val == 80)
|
||||
view->origin[2] += 0.5;
|
||||
|
||||
if (view_message->flags & (PF_GIB | PF_DEAD))
|
||||
if (view_message->pls.flags & (PF_GIB | PF_DEAD))
|
||||
view->model = NULL;
|
||||
else
|
||||
view->model = cl.model_precache[cl.stats[STAT_WEAPON]];
|
||||
view->frame = view_message->weaponframe;
|
||||
view->frame = view_message->pls.weaponframe;
|
||||
view->colormap = vid.colormap8;
|
||||
|
||||
// set up the refresh position
|
||||
|
|
|
@ -154,11 +154,11 @@ SV_EmitNailUpdate (sizebuf_t *msg, qboolean recorder)
|
|||
*buf++ = (byte)SVfloat (ent, colormap);
|
||||
}
|
||||
|
||||
x = ((int) (SVvector (ent, origin)[0] + 4096 + 1) >> 1) & 4095;
|
||||
y = ((int) (SVvector (ent, origin)[1] + 4096 + 1) >> 1) & 4095;
|
||||
z = ((int) (SVvector (ent, origin)[2] + 4096 + 1) >> 1) & 4095;
|
||||
p = (int) (SVvector (ent, angles)[0] * (16.0 / 360.0)) & 15;
|
||||
yaw = (int) (SVvector (ent, angles)[1] * (256.0 / 360.0)) & 255;
|
||||
x = ((int) (SVvector (ent, origin)[0] + 4096 + 1) >> 1) & 0xfff;
|
||||
y = ((int) (SVvector (ent, origin)[1] + 4096 + 1) >> 1) & 0xfff;
|
||||
z = ((int) (SVvector (ent, origin)[2] + 4096 + 1) >> 1) & 0xfff;
|
||||
p = (int) (SVvector (ent, angles)[0] * (16.0 / 360.0)) & 0x00f;
|
||||
yaw = (int) (SVvector (ent, angles)[1] * (256.0 / 360.0)) & 0x0ff;
|
||||
|
||||
*buf++ = x;
|
||||
*buf++ = (x >> 8) | (y << 4);
|
||||
|
@ -209,7 +209,7 @@ SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg,
|
|||
if (to->frame != from->frame)
|
||||
bits |= U_FRAME;
|
||||
|
||||
if (to->effects != from->effects)
|
||||
if ((to->effects & 0xff) != (from->effects & 0xff))
|
||||
bits |= U_EFFECTS;
|
||||
|
||||
if (to->modelindex != from->modelindex)
|
||||
|
@ -224,7 +224,7 @@ SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg,
|
|||
if (to->scale != from->scale)
|
||||
bits |= U_SCALE;
|
||||
|
||||
if (to->effects > 255)
|
||||
if ((to->effects & 0xff00) != (from->effects & 0xff00))
|
||||
bits |= U_EFFECTS2;
|
||||
|
||||
if (to->glow_size != from->glow_size)
|
||||
|
|
|
@ -749,6 +749,8 @@ SV_AllocClient (int spectator, int server)
|
|||
svs.num_clients++;
|
||||
memset (cl, 0, sizeof (client_t));
|
||||
cl->userid = userid++; // so every client gets a unique id
|
||||
if (userid < 0) // reserve -ve userids for special purposes
|
||||
userid = 0;
|
||||
cl->edict = EDICT_NUM (&sv_pr_state, (cl - svs.clients) + 1);
|
||||
return cl;
|
||||
}
|
||||
|
|
|
@ -313,7 +313,6 @@ SV_PreSpawn_f (void *unused)
|
|||
SV_DropClient (host_client);
|
||||
return;
|
||||
}
|
||||
host_client->checksum = check;
|
||||
}
|
||||
|
||||
host_client->prespawned = true;
|
||||
|
|
Loading…
Reference in a new issue