From bf0f29bdcd1c281b6efd1271a764682f734dcafc Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 21 Dec 2000 20:43:19 +0000 Subject: [PATCH] cl_ents.c: fix sporadic rocket dlights in software cl_parse.c: simpify CL_ParseStatic cl_tent.c: misc cleanups --- source/cl_ents.c | 2 +- source/cl_parse.c | 19 ++++----------- source/cl_tent.c | 59 +++++++++++++++++------------------------------ 3 files changed, 27 insertions(+), 53 deletions(-) diff --git a/source/cl_ents.c b/source/cl_ents.c index 271454f..82464b6 100644 --- a/source/cl_ents.c +++ b/source/cl_ents.c @@ -620,7 +620,7 @@ CL_LinkPacketEntities (void) if (model->flags & EF_ROCKET) { R_RocketTrail (0, (*ent)); - dl = CL_AllocDlight (s1->number); + dl = CL_AllocDlight (-s1->number); VectorCopy ((*ent)->origin, dl->origin); dl->radius = 200; dl->die = cl.time + 0.1; diff --git a/source/cl_parse.c b/source/cl_parse.c index b788f5e..16a833e 100644 --- a/source/cl_parse.c +++ b/source/cl_parse.c @@ -47,6 +47,7 @@ #include "cl_main.h" #include "skin.h" #include "cl_ents.h" +#include "cl_tent.h" #include "cl_input.h" #include "view.h" @@ -852,33 +853,23 @@ void CL_ParseStatic (void) { entity_t *ent; - int i; entity_state_t es; CL_ParseBaseline (&es); - i = cl.num_statics; - if (i >= MAX_STATIC_ENTITIES) + if (cl.num_statics >= MAX_STATIC_ENTITIES) Host_EndGame ("Too many static entities"); - ent = &cl_static_entities[i]; - cl.num_statics++; + ent = &cl_static_entities[cl.num_statics++]; + CL_Init_Entity (ent); -// copy it to the current state + // copy it to the current state ent->model = cl.model_precache[es.modelindex]; ent->frame = es.frame; - ent->colormap = vid.colormap; ent->skinnum = es.skinnum; VectorCopy (es.origin, ent->origin); VectorCopy (es.angles, ent->angles); - // LordHavoc: make static entities visible - ent->alpha = 1; - ent->scale = 1; - ent->glowsize = 0; - ent->glowcolor = 254; - ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1; - R_AddEfrags (ent); } diff --git a/source/cl_tent.c b/source/cl_tent.c index 6f628b6..ac0b2de 100644 --- a/source/cl_tent.c +++ b/source/cl_tent.c @@ -78,9 +78,7 @@ sfx_t *cl_sfx_ric3; sfx_t *cl_sfx_r_exp3; /* -================= -CL_ParseTEnts -================= + CL_TEnts_Init */ void CL_TEnts_Init (void) @@ -95,26 +93,28 @@ CL_TEnts_Init (void) } /* -================= -CL_ClearTEnts -================= -*/ + CL_Init_Entity + Set the fields of the entity to reasonable defaults. Especially + the extended fields. +*/ void CL_Init_Entity (entity_t *ent) { memset (ent, 0, sizeof (*ent)); ent->colormap = vid.colormap; - // LordHavoc: Endy had neglected to do this as part of the QSG VERSION 2 - // stuff ent->glowsize = 0; ent->glowcolor = 254; ent->alpha = 1; ent->scale = 1; ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1; + ent->pose1 = ent->pose2 = -1; } +/* + CL_ClearTEnts +*/ void CL_ClearTEnts (void) { @@ -134,9 +134,7 @@ CL_ClearTEnts (void) } /* -================= -CL_AllocExplosion -================= + CL_AllocExplosion */ explosion_t * CL_AllocExplosion (void) @@ -148,7 +146,7 @@ CL_AllocExplosion (void) for (i = 0; i < MAX_EXPLOSIONS; i++) if (!cl_explosions[i].ent.model) return &cl_explosions[i]; -// find the oldest explosion + // find the oldest explosion time = cl.time; index = 0; @@ -161,9 +159,7 @@ CL_AllocExplosion (void) } /* -================= -CL_ParseBeam -================= + CL_ParseBeam */ void CL_ParseBeam (model_t *m) @@ -183,7 +179,7 @@ CL_ParseBeam (model_t *m) end[1] = MSG_ReadCoord (); end[2] = MSG_ReadCoord (); -// override any beam with the same entity + // override any beam with the same entity for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) if (b->entity == ent) { b->entity = ent; @@ -193,7 +189,7 @@ CL_ParseBeam (model_t *m) VectorCopy (end, b->end); return; } -// find a free beam + // find a free beam for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) { if (!b->model || b->endtime < cl.time) { b->entity = ent; @@ -208,9 +204,7 @@ CL_ParseBeam (model_t *m) } /* -================= -CL_ParseTEnt -================= + CL_ParseTEnt */ void CL_ParseTEnt (void) @@ -355,16 +349,13 @@ CL_ParseTEnt (void) break; default: -// Sys_Error ("CL_ParseTEnt: bad type"); Host_EndGame ("CL_ParseTEnt: bad type"); } } /* -================= -CL_NewTempEntity -================= + CL_NewTempEntity */ entity_t ** CL_NewTempEntity (void) @@ -376,9 +367,7 @@ CL_NewTempEntity (void) } /* -================= -CL_UpdateBeams -================= + CL_UpdateBeams */ void CL_UpdateBeams (void) @@ -391,16 +380,14 @@ CL_UpdateBeams (void) float yaw, pitch; float forward; -// update lightning + // update lightning for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) { if (!b->model || b->endtime < cl.time) continue; // if coming from the player, update the start position - if (b->entity == cl.playernum + 1) // entity 0 is the world - { + if (b->entity == cl.playernum + 1) { // entity 0 is the world VectorCopy (cl.simorg, b->start); -// b->start[2] -= 22; // adjust for view height } // calculate pitch and yaw VectorSubtract (b->end, b->start, dist); @@ -444,9 +431,7 @@ CL_UpdateBeams (void) } /* -================= -CL_UpdateExplosions -================= + CL_UpdateExplosions */ void CL_UpdateExplosions (void) @@ -474,9 +459,7 @@ CL_UpdateExplosions (void) } /* -================= -CL_UpdateTEnts -================= + CL_UpdateTEnts */ void CL_UpdateTEnts (void)