turns out that beams coming from the player entity get their start position

updated which can cause the beam to shrink which can cause lightning ents
to get stranded.
This commit is contained in:
Bill Currie 2002-04-27 03:22:09 +00:00
parent 98fea9ff55
commit 8a8e62f4c2

View file

@ -198,6 +198,17 @@ CL_AllocBeam (int ent)
return 0; return 0;
} }
void
CL_ClearBeam (beam_t *b)
{
if (b->ent_count) {
entity_t *e = b->ent_list + b->ent_count;
while (e != b->ent_list)
R_RemoveEfrags (e-- - 1);
b->ent_count = 0;
}
}
void void
CL_ParseBeam (model_t *m) CL_ParseBeam (model_t *m)
{ {
@ -211,12 +222,7 @@ CL_ParseBeam (model_t *m)
MSG_ReadCoordV (net_message, end); MSG_ReadCoordV (net_message, end);
if ((b = CL_AllocBeam (ent))) { if ((b = CL_AllocBeam (ent))) {
if (b->ent_count) { CL_ClearBeam (b);
entity_t *e = b->ent_list + b->ent_count;
while (e != b->ent_list)
R_RemoveEfrags (e-- - 1);
b->ent_count = 0;
}
b->entity = ent; b->entity = ent;
b->model = m; b->model = m;
b->endtime = cl.time + 0.2; b->endtime = cl.time + 0.2;
@ -414,17 +420,13 @@ CL_UpdateBeams (void)
// 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) {
if (b->ent_count) { CL_ClearBeam (b);
entity_t *e = b->ent_list + b->ent_count;
while (e != b->ent_list)
R_RemoveEfrags (e-- - 1);
b->ent_count = 0;
}
continue; continue;
} }
// if coming from the player, update the start position // if coming from the player, update the start position
if (b->entity == cl.viewentity) { if (b->entity == cl.viewentity) {
CL_ClearBeam (b);
VectorCopy (cl.simorg, b->start); VectorCopy (cl.simorg, b->start);
} }
// calculate pitch and yaw // calculate pitch and yaw