More QSG2 work.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2002-09-12 22:09:55 +00:00
parent beb6219072
commit 7bf16df448
5 changed files with 57 additions and 70 deletions

View file

@ -67,9 +67,7 @@ typedef struct
#define NAME_LENGTH 64 #define NAME_LENGTH 64
/* // client_state_t should hold all pieces of the client state
client_state_t should hold all pieces of the client state
*/
#define SIGNONS 4 // signon messages to receive before connected #define SIGNONS 4 // signon messages to receive before connected
@ -144,33 +142,32 @@ extern client_static_t cls;
*/ */
typedef struct typedef struct
{ {
int movemessages; // since connecting to this server int movemessages; // Since connecting to this server throw out
// throw out the first couple, so the player // the first couple, so the player doesn't
// doesn't accidentally do something the // accidentally do something the first frame
// first frame usercmd_t cmd; // Last command sent to the server
usercmd_t cmd; // last command sent to the server
// information for local display // information for local display
int stats[MAX_CL_STATS]; // health, etc int stats[MAX_CL_STATS]; // Health, etc
float item_gettime[32]; // cl.time of aquiring item, for blinking float item_gettime[32]; // cl.time of aquiring item, for blinking
float faceanimtime; // use anim frame if cl.time < this float faceanimtime; // Use anim frame if cl.time < this
cshift_t cshifts[NUM_CSHIFTS]; // color shifts for damage, powerups cshift_t cshifts[NUM_CSHIFTS]; // Color shifts for damage, powerups
cshift_t prev_cshifts[NUM_CSHIFTS]; // and content types cshift_t prev_cshifts[NUM_CSHIFTS]; // And content types
// the client maintains its own idea of view angles, which are // The client maintains its own idea of view angles, which are sent to the
// sent to the server each frame. The server sets punchangle when // server each frame. The server sets punchangle when the view is temporarily
// the view is temporarliy offset, and an angle reset commands at the start // offset, and an angle reset commands at the start of each level and after
// of each level and after teleporting. // teleporting.
vec3_t mviewangles[2]; // during demo playback viewangles is lerped vec3_t mviewangles[2]; // During demo playback viewangles is lerped
// between these // between these
vec3_t viewangles; vec3_t viewangles;
vec3_t mvelocity[2]; // update by server, used for lean+bob vec3_t mvelocity[2]; // Update by server, used for lean+bob
// (0 is newest) // (0 is newest)
vec3_t velocity; // lerped between mvelocity[0] and [1] vec3_t velocity; // Lerped between mvelocity[0] and [1]
vec3_t punchangle; // temporary offset vec3_t punchangle; // Temporary offset
// pitch drifting vars // pitch drifting vars
float idealpitch; float idealpitch;
@ -180,23 +177,22 @@ typedef struct
double laststop; double laststop;
float viewheight; float viewheight;
float crouch; // local amount for smoothing stepups float crouch; // Local amount for smoothing stepups
qboolean paused; // send over by server qboolean paused; // Send over by server
qboolean onground; qboolean onground;
qboolean inwater; qboolean inwater;
int intermission; // don't change view angle, full screen, etc int intermission; // Don't change view angle, full screen, etc
int completed_time; // latched at intermission start int completed_time; // Latched at intermission start
double mtime[2]; // the timestamp of last two messages double mtime[2]; // The timestamp of last two messages
double time; // clients view of time, should be between double time; // Clients view of time, should be between
// servertime and oldservertime to generate // servertime and oldservertime to generate a
// a lerp point for other data // 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 // 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 */ /* information that is static for the entire time connected to a server */
@ -233,11 +229,15 @@ typedef struct cl_entity_state_s {
int colors; int colors;
struct model_s *model; struct model_s *model;
int skinnum; int skinnum;
byte alpha;
byte scale;
byte colormod;
byte glow_size;
byte glow_color;
} cl_entity_state_t; } cl_entity_state_t;
/*
cvars // cvars
*/
extern struct cvar_s *cl_name; extern struct cvar_s *cl_name;
extern struct cvar_s *cl_color; extern struct cvar_s *cl_color;
@ -292,9 +292,7 @@ extern entity_t cl_static_entities[MAX_STATIC_ENTITIES];
extern int fps_count; extern int fps_count;
/* // cl_main
cl_main
*/
void CL_Init (void); void CL_Init (void);
void CL_InitCvars (void); void CL_InitCvars (void);
@ -309,9 +307,7 @@ void CL_Disconnect_f (void);
void CL_NextDemo (void); void CL_NextDemo (void);
/* // cl_input
cl_input
*/
void CL_InitInput (void); void CL_InitInput (void);
void CL_SendCmd (void); void CL_SendCmd (void);
void CL_SendMove (usercmd_t *cmd); void CL_SendMove (usercmd_t *cmd);
@ -327,9 +323,7 @@ void CL_WriteToServer (usercmd_t *cmd);
void CL_BaseMove (usercmd_t *cmd); void CL_BaseMove (usercmd_t *cmd);
/* // cl_demo.c
cl_demo.c
*/
void CL_StopPlayback (void); void CL_StopPlayback (void);
int CL_GetMessage (void); int CL_GetMessage (void);
@ -342,17 +336,13 @@ void CL_Demo_Init (void);
extern struct cvar_s *demo_gzip; extern struct cvar_s *demo_gzip;
extern struct cvar_s *demo_speed; extern struct cvar_s *demo_speed;
/* // cl_parse.c
cl_parse.c
*/
struct skin_s; struct skin_s;
void CL_ParseServerMessage (void); void CL_ParseServerMessage (void);
void CL_NewTranslation (int slot, struct skin_s *skin); void CL_NewTranslation (int slot, struct skin_s *skin);
/* // view
view
*/
void V_StartPitchDrift (void); void V_StartPitchDrift (void);
void V_StopPitchDrift (void); void V_StopPitchDrift (void);
@ -363,9 +353,7 @@ void V_ParseDamage (void);
void V_SetContentsColor (int contents); void V_SetContentsColor (int contents);
void V_PrepBlend (void); void V_PrepBlend (void);
/* // cl_tent
cl_tent
*/
void CL_TEnts_Init (void); void CL_TEnts_Init (void);
void CL_ClearEnts (void); void CL_ClearEnts (void);
void CL_ClearTEnts (void); void CL_ClearTEnts (void);

View file

@ -557,10 +557,10 @@ CL_RelinkEntities (void)
VectorCopy (ent->origin, ent->old_origin); VectorCopy (ent->origin, ent->old_origin);
if (state->forcelink) { // the entity was not updated in the if (state->forcelink) { // The entity was not updated in the last
// last message so move to the final spot // message so move to the final spot
} else { // if the delta is large, assume a } else { // If the delta is large, assume a teleport
// teleport and don't lerp // and don't lerp
f = frac; f = frac;
VectorSubtract (state->msg_origins[0], VectorSubtract (state->msg_origins[0],
state->msg_origins[1], delta); state->msg_origins[1], delta);
@ -608,7 +608,8 @@ CL_RelinkEntities (void)
} }
} }
CL_NewDlight (i, ent->origin, state->effects); CL_NewDlight (i, ent->origin, state->effects);
if (VectorDistance_fast(state->msg_origins[1], ent->origin) > (256*256)) if ( VectorDistance_fast(state->msg_origins[1], ent->origin)
> (256*256))
VectorCopy (ent ->origin, state->msg_origins[1]); VectorCopy (ent ->origin, state->msg_origins[1]);
if (ent->model->flags & EF_ROCKET) { if (ent->model->flags & EF_ROCKET) {
dl = R_AllocDlight (i); dl = R_AllocDlight (i);
@ -632,7 +633,7 @@ CL_RelinkEntities (void)
else if (ent->model->flags & EF_TRACER3) else if (ent->model->flags & EF_TRACER3)
R_VoorTrail (ent); R_VoorTrail (ent);
else if (ent->model->flags & EF_GLOWTRAIL) else if (ent->model->flags & EF_GLOWTRAIL)
R_GlowTrail (ent); R_GlowTrail (ent, state->glow_color);
state->forcelink = false; state->forcelink = false;

View file

@ -362,7 +362,6 @@ CL_ParseUpdate (int bits)
bits |= (i << 8); bits |= (i << 8);
} }
if (bits & U_LONGENTITY) if (bits & U_LONGENTITY)
num = MSG_ReadShort (net_message); num = MSG_ReadShort (net_message);
else else
@ -486,16 +485,15 @@ CL_ParseUpdate (int bits)
forcelink = true; forcelink = true;
// QSG Start // QSG Start
#if 0
if (bits & U_ALPHA) if (bits & U_ALPHA)
state->alpha = MSG_ReadByte (net_message); state->alpha = MSG_ReadByte (net_message);
else else
state->alpha = state.baseline.alpha; state->alpha = state->baseline.alpha;
if (bits & U_SCALE) if (bits & U_SCALE)
state->scale = MSG_ReadByte (net_message); state->scale = MSG_ReadByte (net_message);
else else
state->scale = state.baseline.scale; state->scale = state->baseline.scale;
if (bits & U_EFFECTS2) if (bits & U_EFFECTS2)
state->effects = (state->effects & 0xFF) | state->effects = (state->effects & 0xFF) |
@ -504,17 +502,17 @@ CL_ParseUpdate (int bits)
if (bits & U_GLOWSIZE) if (bits & U_GLOWSIZE)
state->glow_size = MSG_ReadByte (net_message); state->glow_size = MSG_ReadByte (net_message);
else else
state->glow_size = state.baseline.glow_size; state->glow_size = state->baseline.glow_size;
if (bits & U_GLOWCOLOR) if (bits & U_GLOWCOLOR)
state->glow_color = MSG_ReadByte (net_message); state->glow_color = MSG_ReadByte (net_message);
else else
state->glow_color = state.baseline.glow_color; state->glow_color = state->baseline.glow_color;
if (bits & U_COLORMOD) if (bits & U_COLORMOD)
state->colormod = MSG_ReadByte (net_message); state->colormod = MSG_ReadByte (net_message);
else else
state->colormod = state.baseline.colormod; state->colormod = state->baseline.colormod;
if (!(bits & U_EXTEND2)) if (!(bits & U_EXTEND2))
return; return;
@ -523,8 +521,7 @@ CL_ParseUpdate (int bits)
state->effects |= EF_GLOWTRAIL; state->effects |= EF_GLOWTRAIL;
if (bits & U_FRAME2) if (bits & U_FRAME2)
to->frame = (to->frame & 0xFF) | (MSG_ReadByte (net_message) << 8); ent->frame = (ent->frame & 0xFF) | (MSG_ReadByte (net_message) << 8);
#endif
// QSG End // QSG End
if (forcelink) { // didn't have an update last message if (forcelink) { // didn't have an update last message
@ -582,7 +579,8 @@ CL_ParseClientdata (int bits)
else else
cl.punchangle[i] = 0; cl.punchangle[i] = 0;
if (bits & (SU_VELOCITY1 << i)) if (bits & (SU_VELOCITY1 << i))
cl.mvelocity[0][i] = ((signed char) MSG_ReadByte (net_message)) * 16; cl.mvelocity[0][i] = ((signed char) MSG_ReadByte (net_message))
* 16;
else else
cl.mvelocity[0][i] = 0; cl.mvelocity[0][i] = 0;
} }

View file

@ -546,7 +546,7 @@ CL_LinkPacketEntities (void)
else if (model->flags & EF_TRACER3) else if (model->flags & EF_TRACER3)
R_VoorTrail (*ent); R_VoorTrail (*ent);
else if (model->flags & EF_GLOWTRAIL) else if (model->flags & EF_GLOWTRAIL)
R_GlowTrail (*ent); R_GlowTrail (*ent, s1->glow_color);
} }
} }

View file

@ -214,7 +214,7 @@ CL_CheckOrDownloadFile (const char *filename)
} }
if (!snd_initialized && strnequal ("sound/", filename, 6)) { if (!snd_initialized && strnequal ("sound/", filename, 6)) {
// don't bother downloading sownds if we can't play them // don't bother downloading sounds if we can't play them
return true; return true;
} }