From 5c6f4058720847a2857a81e962e51e6aaf69b291 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Mon, 4 Nov 2024 01:12:09 -0800 Subject: [PATCH] Client: add vv_flag VFL_VIDREMOVE, for client-side entities needing deletion on renderer restart. --- src/client/entities.qc | 15 +++++++++++---- src/shared/flags.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/client/entities.qc b/src/client/entities.qc index 88a65792..79d90e54 100644 --- a/src/client/entities.qc +++ b/src/client/entities.qc @@ -272,13 +272,20 @@ Entities_ParseLump(void) void Entities_RendererRestarted(void) { - int c = 0; + int c = 0i; + int f = 0i; for (entity b = world; (b = findfloat(b, ::isCSQC, TRUE));) { NSEntity pf = (NSEntity) b; - pf.RendererRestarted(); - c++; + + if (pf.vv_flags & VFL_VIDREMOVE) { + pf.Destroy(); + f++; + } else { + pf.RendererRestarted(); + c++; + } } - NSLog("...resource reload called on %i entities", c); + NSLog("...resource reload called on %i entities, flushed %i", c, f); } diff --git a/src/shared/flags.h b/src/shared/flags.h index 940e6c9c..5274820c 100644 --- a/src/shared/flags.h +++ b/src/shared/flags.h @@ -47,3 +47,4 @@ #define VFL_PRIMEDFUSE (1<<11) /**< Entity is not allowed to fire. */ #define VFL_REDRAW (1<<12) /**< Entity is not allowed to fire. */ #define VFL_FIRING (1<<13) /**< Entity is firing. */ +#define VFL_VIDREMOVE (1<<14) /**< Entity will be flushed upon vid_reload. */