From 9e2c474d386e58707a937ed8b304924ca8470029 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 27 Jul 2021 17:54:50 +0900 Subject: [PATCH] [model] Ensure the pvs is not inverted Mod_DecompressVis_set (via Mod_LeafPVS_set) can be used to recycle pvs sets, but the set may have been set to everything at some stage, which is implemented by inverting the set (making the set infinite) and having 1-bits remove elements from the set. This is most definitely not wanted for pvs :) Currently undecided what to do about Mod_DecompressVis_mix, thus the fixme. Fixes the flickering lights in any map where the camera is out of the map for a single frame (eg, start.bsp, The Catacombs (hipnotic, hip2m3)). --- libs/models/brush/model_brush.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/models/brush/model_brush.c b/libs/models/brush/model_brush.c index ac9901c01..179fcac7d 100644 --- a/libs/models/brush/model_brush.c +++ b/libs/models/brush/model_brush.c @@ -92,6 +92,8 @@ Mod_DecompressVis_set (const byte *in, const mod_brush_t *brush, byte defvis, byte *start = out; int row, c; + // Ensure the set repesents visible leafs rather than invisible leafs. + pvs->inverted = 0; row = (brush->visleafs + 7) >> 3; if (!in) { // no vis info, so make all visible @@ -125,6 +127,8 @@ Mod_DecompressVis_mix (const byte *in, const mod_brush_t *brush, byte defvis, byte *start = out; int row, c; + //FIXME should pvs->inverted be checked and the vis bits used to remove + // set bits? row = (brush->visleafs + 7) >> 3; if (!in) { // no vis info, so make all visible