mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-10 14:52:08 +00:00
cl_ents.c:
fix sporadic rocket dlights in software cl_parse.c: simpify CL_ParseStatic cl_tent.c: misc cleanups
This commit is contained in:
parent
b52f1baf96
commit
bf0f29bdcd
3 changed files with 27 additions and 53 deletions
|
@ -620,7 +620,7 @@ CL_LinkPacketEntities (void)
|
||||||
|
|
||||||
if (model->flags & EF_ROCKET) {
|
if (model->flags & EF_ROCKET) {
|
||||||
R_RocketTrail (0, (*ent));
|
R_RocketTrail (0, (*ent));
|
||||||
dl = CL_AllocDlight (s1->number);
|
dl = CL_AllocDlight (-s1->number);
|
||||||
VectorCopy ((*ent)->origin, dl->origin);
|
VectorCopy ((*ent)->origin, dl->origin);
|
||||||
dl->radius = 200;
|
dl->radius = 200;
|
||||||
dl->die = cl.time + 0.1;
|
dl->die = cl.time + 0.1;
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "cl_main.h"
|
#include "cl_main.h"
|
||||||
#include "skin.h"
|
#include "skin.h"
|
||||||
#include "cl_ents.h"
|
#include "cl_ents.h"
|
||||||
|
#include "cl_tent.h"
|
||||||
#include "cl_input.h"
|
#include "cl_input.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
|
||||||
|
@ -852,33 +853,23 @@ void
|
||||||
CL_ParseStatic (void)
|
CL_ParseStatic (void)
|
||||||
{
|
{
|
||||||
entity_t *ent;
|
entity_t *ent;
|
||||||
int i;
|
|
||||||
entity_state_t es;
|
entity_state_t es;
|
||||||
|
|
||||||
CL_ParseBaseline (&es);
|
CL_ParseBaseline (&es);
|
||||||
|
|
||||||
i = cl.num_statics;
|
if (cl.num_statics >= MAX_STATIC_ENTITIES)
|
||||||
if (i >= MAX_STATIC_ENTITIES)
|
|
||||||
Host_EndGame ("Too many static entities");
|
Host_EndGame ("Too many static entities");
|
||||||
ent = &cl_static_entities[i];
|
ent = &cl_static_entities[cl.num_statics++];
|
||||||
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->model = cl.model_precache[es.modelindex];
|
||||||
ent->frame = es.frame;
|
ent->frame = es.frame;
|
||||||
ent->colormap = vid.colormap;
|
|
||||||
ent->skinnum = es.skinnum;
|
ent->skinnum = es.skinnum;
|
||||||
|
|
||||||
VectorCopy (es.origin, ent->origin);
|
VectorCopy (es.origin, ent->origin);
|
||||||
VectorCopy (es.angles, ent->angles);
|
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);
|
R_AddEfrags (ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,9 +78,7 @@ sfx_t *cl_sfx_ric3;
|
||||||
sfx_t *cl_sfx_r_exp3;
|
sfx_t *cl_sfx_r_exp3;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
CL_TEnts_Init
|
||||||
CL_ParseTEnts
|
|
||||||
=================
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
CL_TEnts_Init (void)
|
CL_TEnts_Init (void)
|
||||||
|
@ -95,26 +93,28 @@ CL_TEnts_Init (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
CL_Init_Entity
|
||||||
CL_ClearTEnts
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
Set the fields of the entity to reasonable defaults. Especially
|
||||||
|
the extended fields.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
CL_Init_Entity (entity_t *ent)
|
CL_Init_Entity (entity_t *ent)
|
||||||
{
|
{
|
||||||
memset (ent, 0, sizeof (*ent));
|
memset (ent, 0, sizeof (*ent));
|
||||||
|
|
||||||
ent->colormap = vid.colormap;
|
ent->colormap = vid.colormap;
|
||||||
// LordHavoc: Endy had neglected to do this as part of the QSG VERSION 2
|
|
||||||
// stuff
|
|
||||||
ent->glowsize = 0;
|
ent->glowsize = 0;
|
||||||
ent->glowcolor = 254;
|
ent->glowcolor = 254;
|
||||||
ent->alpha = 1;
|
ent->alpha = 1;
|
||||||
ent->scale = 1;
|
ent->scale = 1;
|
||||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1;
|
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1;
|
||||||
|
ent->pose1 = ent->pose2 = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
CL_ClearTEnts
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
CL_ClearTEnts (void)
|
CL_ClearTEnts (void)
|
||||||
{
|
{
|
||||||
|
@ -134,9 +134,7 @@ CL_ClearTEnts (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
CL_AllocExplosion
|
||||||
CL_AllocExplosion
|
|
||||||
=================
|
|
||||||
*/
|
*/
|
||||||
explosion_t *
|
explosion_t *
|
||||||
CL_AllocExplosion (void)
|
CL_AllocExplosion (void)
|
||||||
|
@ -148,7 +146,7 @@ CL_AllocExplosion (void)
|
||||||
for (i = 0; i < MAX_EXPLOSIONS; i++)
|
for (i = 0; i < MAX_EXPLOSIONS; i++)
|
||||||
if (!cl_explosions[i].ent.model)
|
if (!cl_explosions[i].ent.model)
|
||||||
return &cl_explosions[i];
|
return &cl_explosions[i];
|
||||||
// find the oldest explosion
|
// find the oldest explosion
|
||||||
time = cl.time;
|
time = cl.time;
|
||||||
index = 0;
|
index = 0;
|
||||||
|
|
||||||
|
@ -161,9 +159,7 @@ CL_AllocExplosion (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
CL_ParseBeam
|
||||||
CL_ParseBeam
|
|
||||||
=================
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
CL_ParseBeam (model_t *m)
|
CL_ParseBeam (model_t *m)
|
||||||
|
@ -183,7 +179,7 @@ CL_ParseBeam (model_t *m)
|
||||||
end[1] = MSG_ReadCoord ();
|
end[1] = MSG_ReadCoord ();
|
||||||
end[2] = 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++)
|
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++)
|
||||||
if (b->entity == ent) {
|
if (b->entity == ent) {
|
||||||
b->entity = ent;
|
b->entity = ent;
|
||||||
|
@ -193,7 +189,7 @@ CL_ParseBeam (model_t *m)
|
||||||
VectorCopy (end, b->end);
|
VectorCopy (end, b->end);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// find a free beam
|
// find a free beam
|
||||||
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) {
|
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) {
|
||||||
if (!b->model || b->endtime < cl.time) {
|
if (!b->model || b->endtime < cl.time) {
|
||||||
b->entity = ent;
|
b->entity = ent;
|
||||||
|
@ -208,9 +204,7 @@ CL_ParseBeam (model_t *m)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
CL_ParseTEnt
|
||||||
CL_ParseTEnt
|
|
||||||
=================
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
CL_ParseTEnt (void)
|
CL_ParseTEnt (void)
|
||||||
|
@ -355,16 +349,13 @@ CL_ParseTEnt (void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Sys_Error ("CL_ParseTEnt: bad type");
|
|
||||||
Host_EndGame ("CL_ParseTEnt: bad type");
|
Host_EndGame ("CL_ParseTEnt: bad type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
CL_NewTempEntity
|
||||||
CL_NewTempEntity
|
|
||||||
=================
|
|
||||||
*/
|
*/
|
||||||
entity_t **
|
entity_t **
|
||||||
CL_NewTempEntity (void)
|
CL_NewTempEntity (void)
|
||||||
|
@ -376,9 +367,7 @@ CL_NewTempEntity (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
CL_UpdateBeams
|
||||||
CL_UpdateBeams
|
|
||||||
=================
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
CL_UpdateBeams (void)
|
CL_UpdateBeams (void)
|
||||||
|
@ -391,16 +380,14 @@ CL_UpdateBeams (void)
|
||||||
float yaw, pitch;
|
float yaw, pitch;
|
||||||
float forward;
|
float forward;
|
||||||
|
|
||||||
// update lightning
|
// update lightning
|
||||||
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) {
|
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) {
|
||||||
if (!b->model || b->endtime < cl.time)
|
if (!b->model || b->endtime < cl.time)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// if coming from the player, update the start position
|
// 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);
|
VectorCopy (cl.simorg, b->start);
|
||||||
// b->start[2] -= 22; // adjust for view height
|
|
||||||
}
|
}
|
||||||
// calculate pitch and yaw
|
// calculate pitch and yaw
|
||||||
VectorSubtract (b->end, b->start, dist);
|
VectorSubtract (b->end, b->start, dist);
|
||||||
|
@ -444,9 +431,7 @@ CL_UpdateBeams (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
CL_UpdateExplosions
|
||||||
CL_UpdateExplosions
|
|
||||||
=================
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
CL_UpdateExplosions (void)
|
CL_UpdateExplosions (void)
|
||||||
|
@ -474,9 +459,7 @@ CL_UpdateExplosions (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
CL_UpdateTEnts
|
||||||
CL_UpdateTEnts
|
|
||||||
=================
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
CL_UpdateTEnts (void)
|
CL_UpdateTEnts (void)
|
||||||
|
|
Loading…
Reference in a new issue