From 69763fd804372986bf934359205bc71855acb43b Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 8 Jun 2022 00:34:02 -0700 Subject: [PATCH] Spawn more precip objects under smaller MobjScale --- src/p_mobj.c | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index ea20da99e..79526a68b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10642,30 +10642,26 @@ static CV_PossibleValue_t respawnitemtime_cons_t[] = {{1, "MIN"}, {300, "MAX"}, consvar_t cv_itemrespawntime = CVAR_INIT ("respawnitemtime", "2", CV_NETVAR|CV_CHEAT, respawnitemtime_cons_t, NULL); consvar_t cv_itemrespawn = CVAR_INIT ("respawnitem", "On", CV_NETVAR, CV_OnOff, NULL); -void P_SpawnPrecipitation(void) +static void P_SpawnPrecipitationAt(fixed_t basex, fixed_t basey) { - INT32 i, j, k; + INT32 j, k; const mobjtype_t type = precipprops[curWeather].type; const UINT8 randomstates = (UINT8)mobjinfo[type].damage; const boolean flip = (mobjinfo[type].speed < 0); - fixed_t basex, basey, x, y, z, height; + fixed_t i, x, y, z, height; + UINT16 numparticles = 0; boolean condition = false; subsector_t *precipsector = NULL; precipmobj_t *rainmo = NULL; - if (dedicated || !cv_drawdist_precip.value || type == MT_NULL) - return; - - // Use the blockmap to narrow down our placing patterns - for (i = 0; i < bmapwidth*bmapheight; ++i) + // If mobjscale < FRACUNIT, each blockmap cell covers + // more area so spawn more precipitation in that area. + for (i = 0; i < FRACUNIT; i += mapobjectscale) { - basex = bmaporgx + (i % bmapwidth) * MAPBLOCKSIZE; - basey = bmaporgy + (i / bmapwidth) * MAPBLOCKSIZE; - x = basex + ((M_RandomKey(MAPBLOCKUNITS << 3) << FRACBITS) >> 3); y = basey + ((M_RandomKey(MAPBLOCKUNITS << 3) << FRACBITS) >> 3); @@ -10714,6 +10710,7 @@ void P_SpawnPrecipitation(void) } height = precipsector->sector->ceilingheight - precipsector->sector->floorheight; + height = FixedDiv(height, mapobjectscale); // Exists, but is too small for reasonable precipitation. if (height < 64<