mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'precip-height-random-crash' into 'master'
Conditionally randomize precip height Closes #528 See merge request KartKrew/Kart!1536
This commit is contained in:
commit
6b18563549
1 changed files with 16 additions and 2 deletions
18
src/p_mobj.c
18
src/p_mobj.c
|
|
@ -11652,6 +11652,9 @@ static void P_SpawnPrecipitationAt(fixed_t basex, fixed_t basey)
|
|||
|
||||
for (j = 0; j < numparticles; j++)
|
||||
{
|
||||
INT32 floorz;
|
||||
INT32 ceilingz;
|
||||
|
||||
rainmo = P_SpawnPrecipMobj(x, y, z, type);
|
||||
|
||||
if (randomstates > 0)
|
||||
|
|
@ -11670,8 +11673,19 @@ static void P_SpawnPrecipitationAt(fixed_t basex, fixed_t basey)
|
|||
}
|
||||
}
|
||||
|
||||
// Randomly assign a height, now that floorz is set.
|
||||
rainmo->z = M_RandomRange(rainmo->floorz >> FRACBITS, rainmo->ceilingz >> FRACBITS) << FRACBITS;
|
||||
floorz = rainmo->floorz >> FRACBITS;
|
||||
ceilingz = rainmo->ceilingz >> FRACBITS;
|
||||
|
||||
if (floorz < ceilingz)
|
||||
{
|
||||
// Randomly assign a height, now that floorz is set.
|
||||
rainmo->z = M_RandomRange(floorz, ceilingz) << FRACBITS;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ...except if the floor is above the ceiling.
|
||||
rainmo->z = ceilingz << FRACBITS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue