From 7bf16df44820f10802fb2bc995e138323ebfcc57 Mon Sep 17 00:00:00 2001 From: Ragnvald Maartmann-Moe IV Date: Thu, 12 Sep 2002 22:09:55 +0000 Subject: [PATCH] More QSG2 work. --- nq/include/client.h | 92 +++++++++++++++++++------------------------- nq/source/cl_main.c | 13 ++++--- nq/source/cl_parse.c | 18 ++++----- qw/source/cl_ents.c | 2 +- qw/source/cl_parse.c | 2 +- 5 files changed, 57 insertions(+), 70 deletions(-) diff --git a/nq/include/client.h b/nq/include/client.h index 63d3226df..369429e0d 100644 --- a/nq/include/client.h +++ b/nq/include/client.h @@ -67,9 +67,7 @@ typedef struct #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 @@ -144,33 +142,32 @@ extern client_static_t cls; */ typedef struct { - 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 + 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 // 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 temporarliy 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 +// 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 // between these 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) - 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 float idealpitch; @@ -180,22 +177,21 @@ typedef struct double laststop; 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 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 - // servertime and oldservertime to generate - // a lerp point for other data - double oldtime; // previous cl.time, time-oldtime is used + double mtime[2]; // The timestamp of last two messages + double time; // Clients view of time, should be between + // servertime and oldservertime to generate a + // lerp point for other data + 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 @@ -233,11 +229,15 @@ typedef struct cl_entity_state_s { int colors; struct model_s *model; int skinnum; + byte alpha; + byte scale; + byte colormod; + byte glow_size; + byte glow_color; } cl_entity_state_t; -/* - cvars -*/ + +// cvars extern struct cvar_s *cl_name; extern struct cvar_s *cl_color; @@ -292,9 +292,7 @@ extern entity_t cl_static_entities[MAX_STATIC_ENTITIES]; extern int fps_count; -/* - cl_main -*/ +// cl_main void CL_Init (void); void CL_InitCvars (void); @@ -309,9 +307,7 @@ void CL_Disconnect_f (void); void CL_NextDemo (void); -/* - cl_input -*/ +// cl_input void CL_InitInput (void); void CL_SendCmd (void); void CL_SendMove (usercmd_t *cmd); @@ -327,9 +323,7 @@ void CL_WriteToServer (usercmd_t *cmd); void CL_BaseMove (usercmd_t *cmd); -/* - cl_demo.c -*/ +// cl_demo.c void CL_StopPlayback (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_speed; -/* - cl_parse.c -*/ +// cl_parse.c struct skin_s; void CL_ParseServerMessage (void); void CL_NewTranslation (int slot, struct skin_s *skin); -/* - view -*/ +// view void V_StartPitchDrift (void); void V_StopPitchDrift (void); @@ -363,9 +353,7 @@ void V_ParseDamage (void); void V_SetContentsColor (int contents); void V_PrepBlend (void); -/* - cl_tent -*/ +// cl_tent void CL_TEnts_Init (void); void CL_ClearEnts (void); void CL_ClearTEnts (void); diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index e7f3fc09c..9b140cbf1 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -557,10 +557,10 @@ CL_RelinkEntities (void) VectorCopy (ent->origin, ent->old_origin); - if (state->forcelink) { // the entity was not updated in the - // last message so move to the final spot - } else { // if the delta is large, assume a - // teleport and don't lerp + if (state->forcelink) { // The entity was not updated in the last + // message so move to the final spot + } else { // If the delta is large, assume a teleport + // and don't lerp f = frac; VectorSubtract (state->msg_origins[0], state->msg_origins[1], delta); @@ -608,7 +608,8 @@ CL_RelinkEntities (void) } } 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]); if (ent->model->flags & EF_ROCKET) { dl = R_AllocDlight (i); @@ -632,7 +633,7 @@ CL_RelinkEntities (void) else if (ent->model->flags & EF_TRACER3) R_VoorTrail (ent); else if (ent->model->flags & EF_GLOWTRAIL) - R_GlowTrail (ent); + R_GlowTrail (ent, state->glow_color); state->forcelink = false; diff --git a/nq/source/cl_parse.c b/nq/source/cl_parse.c index 2fd67bedf..20ee3e03e 100644 --- a/nq/source/cl_parse.c +++ b/nq/source/cl_parse.c @@ -362,7 +362,6 @@ CL_ParseUpdate (int bits) bits |= (i << 8); } - if (bits & U_LONGENTITY) num = MSG_ReadShort (net_message); else @@ -486,16 +485,15 @@ CL_ParseUpdate (int bits) forcelink = true; // QSG Start -#if 0 if (bits & U_ALPHA) state->alpha = MSG_ReadByte (net_message); else - state->alpha = state.baseline.alpha; + state->alpha = state->baseline.alpha; if (bits & U_SCALE) state->scale = MSG_ReadByte (net_message); else - state->scale = state.baseline.scale; + state->scale = state->baseline.scale; if (bits & U_EFFECTS2) state->effects = (state->effects & 0xFF) | @@ -504,17 +502,17 @@ CL_ParseUpdate (int bits) if (bits & U_GLOWSIZE) state->glow_size = MSG_ReadByte (net_message); else - state->glow_size = state.baseline.glow_size; + state->glow_size = state->baseline.glow_size; if (bits & U_GLOWCOLOR) state->glow_color = MSG_ReadByte (net_message); else - state->glow_color = state.baseline.glow_color; + state->glow_color = state->baseline.glow_color; if (bits & U_COLORMOD) state->colormod = MSG_ReadByte (net_message); else - state->colormod = state.baseline.colormod; + state->colormod = state->baseline.colormod; if (!(bits & U_EXTEND2)) return; @@ -523,8 +521,7 @@ CL_ParseUpdate (int bits) state->effects |= EF_GLOWTRAIL; if (bits & U_FRAME2) - to->frame = (to->frame & 0xFF) | (MSG_ReadByte (net_message) << 8); -#endif + ent->frame = (ent->frame & 0xFF) | (MSG_ReadByte (net_message) << 8); // QSG End if (forcelink) { // didn't have an update last message @@ -582,7 +579,8 @@ CL_ParseClientdata (int bits) else cl.punchangle[i] = 0; 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 cl.mvelocity[0][i] = 0; } diff --git a/qw/source/cl_ents.c b/qw/source/cl_ents.c index 425718543..7421e962f 100644 --- a/qw/source/cl_ents.c +++ b/qw/source/cl_ents.c @@ -546,7 +546,7 @@ CL_LinkPacketEntities (void) else if (model->flags & EF_TRACER3) R_VoorTrail (*ent); else if (model->flags & EF_GLOWTRAIL) - R_GlowTrail (*ent); + R_GlowTrail (*ent, s1->glow_color); } } diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index d6ec94ad0..212c5586d 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -214,7 +214,7 @@ CL_CheckOrDownloadFile (const char *filename) } 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; }