From 2f70b6cba59a589d96c2d4e445a59d2f3e9cfc81 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 3 May 2021 00:39:06 +0700 Subject: [PATCH] SV_FatPVS/SV_FatPAS: Sanity checks, gPVSRowBytes is not used for singleplayer --- rehlds/engine/sv_main.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index a34d900..904053a 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -4057,10 +4057,12 @@ void SV_AddToFatPVS(vec_t *org, mnode_t *node) unsigned char* EXT_FUNC SV_FatPVS(float *org) { #ifdef REHLDS_FIXES - fatbytes = gPVSRowBytes; -#else // REHLDS_FIXES - fatbytes = (g_psv.worldmodel->numleafs + 31) >> 3; + if (gPVS) + fatbytes = gPVSRowBytes; + else #endif // REHLDS_FIXES + fatbytes = (g_psv.worldmodel->numleafs + 31) >> 3; + Q_memset(fatpvs, 0, fatbytes); SV_AddToFatPVS(org, g_psv.worldmodel->nodes); return fatpvs; @@ -4112,10 +4114,12 @@ void SV_AddToFatPAS(vec_t *org, mnode_t *node) unsigned char* EXT_FUNC SV_FatPAS(float *org) { #ifdef REHLDS_FIXES - fatpasbytes = gPVSRowBytes; -#else // REHLDS_FIXES - fatpasbytes = (g_psv.worldmodel->numleafs + 31) >> 3; + if (gPAS) + fatpasbytes = gPVSRowBytes; + else #endif // REHLDS_FIXES + fatpasbytes = (g_psv.worldmodel->numleafs + 31) >> 3; + Q_memset(fatpas, 0, fatpasbytes); SV_AddToFatPAS(org, g_psv.worldmodel->nodes); return fatpas;