From 8a8e62f4c23ca239ebaa766cf085df5a85e76dd2 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 27 Apr 2002 03:22:09 +0000 Subject: [PATCH] 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. --- qw/source/cl_tent.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/qw/source/cl_tent.c b/qw/source/cl_tent.c index bdfcd914c..cdfcdd1d9 100644 --- a/qw/source/cl_tent.c +++ b/qw/source/cl_tent.c @@ -198,6 +198,17 @@ CL_AllocBeam (int ent) 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 CL_ParseBeam (model_t *m) { @@ -211,12 +222,7 @@ CL_ParseBeam (model_t *m) MSG_ReadCoordV (net_message, end); if ((b = CL_AllocBeam (ent))) { - 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; - } + CL_ClearBeam (b); b->entity = ent; b->model = m; b->endtime = cl.time + 0.2; @@ -414,17 +420,13 @@ CL_UpdateBeams (void) // update lightning for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) { if (!b->model || b->endtime < cl.time) { - 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; - } + CL_ClearBeam (b); continue; } // if coming from the player, update the start position if (b->entity == cl.viewentity) { + CL_ClearBeam (b); VectorCopy (cl.simorg, b->start); } // calculate pitch and yaw