From 5380ce85d9049e5f2b33bdc35b56560259ada7f8 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 18 Jan 2025 21:03:06 +0100 Subject: [PATCH] fix lessprecip toggle doing nothing logic error on my part --- src/p_mobj.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 553fb7ea4..c9dc64eec 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10315,7 +10315,7 @@ consvar_t cv_suddendeath = {"suddendeath", "Off", CV_NETVAR|CV_CHEAT|CV_NOSHOWHE void P_SpawnPrecipitation(void) { - INT32 i, mrand; + INT32 i, j, mrand; fixed_t basex, basey, j, x, y, z; subsector_t *precipsector = NULL; precipmobj_t *rainmo = NULL; @@ -10323,10 +10323,7 @@ void P_SpawnPrecipitation(void) if (dedicated || !cv_drawdist_precip.value || curWeather == PRECIP_NONE || curWeather == PRECIP_STORM_NORAIN) return; - fixed_t density = (cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT); - - if (cv_lessprecip.value) - density *= 2; // just spawn half the precip + const fixed_t precipmoscale = (cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT); // Use the blockmap to narrow down our placing patterns for (i = 0; i < bmapwidth*bmapheight; ++i) @@ -10334,9 +10331,15 @@ void P_SpawnPrecipitation(void) basex = bmaporgx + (i % bmapwidth) * MAPBLOCKSIZE; basey = bmaporgy + (i / bmapwidth) * MAPBLOCKSIZE; + if (cv_lessprecip.value) + { + basex = 3*basex/2; + basey = 3*basey/2; + } + // If mobjscale < FRACUNIT, each blockmap cell covers // more area so spawn more precipitation in that area. - for (j = 0; j < FRACUNIT; j += density) + for (j = 0; j < FRACUNIT; j += precipmoscale) { INT32 floorz; INT32 ceilingz;