Generalize ZRANGE and ANGRANGE to accept any nonnegative number.

Numbers 0 and 1 mean 'no spread', but the latter does one krand() call.
Negative numbers are reserved for potential future use.

git-svn-id: https://svn.eduke32.com/eduke32@3715 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-04-29 19:24:12 +00:00
parent 75294401c4
commit c6d7c08d58
2 changed files with 9 additions and 5 deletions

View file

@ -3294,6 +3294,8 @@ static void P_FinishWaterChange(int32_t j, DukePlayer_t *ps, int32_t sectlotag,
}
}
// Check prevention of teleportation *when alive*. For example, commanders and
// octabrains would be transported by SE7 (both water and normal) only if dead.
static int32_t A_CheckNonTeleporting(int32_t s)
{
int32_t pic = sprite[s].picnum;

View file

@ -434,9 +434,11 @@ static void Proj_MaybeAddSpread(int32_t not_accurate_p, int32_t *zvel, int16_t *
{
if (not_accurate_p)
{
// NOTE: if {z,ang}Range is 0, there is a huge spread
*zvel += (zRange/2)-(krand()&(zRange-1));
*sa += (angRange/2)-(krand()&(angRange-1));
// Ranges <= 1 mean no spread at all. A range of 1 calls krand() though.
if (zRange > 0)
*zvel += zRange/2 - krand()%zRange;
if (angRange > 0)
*sa += angRange/2 - krand()%angRange;
}
}