ref: cd260be97f2374545f840a05b44ee8d67ce42151
parent: d2ce4d3eebbedda517b18c7aaac56661b96cc860
author: nukeykt <alexeytf2@icloud.com>
date: Fri Dec 9 12:01:30 EST 2016
raven: move P_Random calls to variables
--- a/src/heretic/p_enemy.c
+++ b/src/heretic/p_enemy.c
@@ -2416,11 +2416,12 @@
void A_SpawnTeleGlitter(mobj_t * actor)
{
mobj_t *mo;
- int r;
+ int r1, r2;
- r = P_Random();
- mo = P_SpawnMobj(actor->x + ((P_Random() & 31) - 16) * FRACUNIT,
- actor->y + ((r & 31) - 16) * FRACUNIT,
+ r1 = P_Random();
+ r2 = P_Random();
+ mo = P_SpawnMobj(actor->x + ((r2 & 31) - 16) * FRACUNIT,
+ actor->y + ((r1 & 31) - 16) * FRACUNIT,
actor->subsector->sector->floorheight, MT_TELEGLITTER);
mo->momz = FRACUNIT / 4;
}
@@ -2434,11 +2435,12 @@
void A_SpawnTeleGlitter2(mobj_t * actor)
{
mobj_t *mo;
- int r;
+ int r1, r2;
- r = P_Random();
- mo = P_SpawnMobj(actor->x + ((P_Random() & 31) - 16) * FRACUNIT,
- actor->y + ((r & 31) - 16) * FRACUNIT,
+ r1 = P_Random();
+ r2 = P_Random();
+ mo = P_SpawnMobj(actor->x + ((r2 & 31) - 16) * FRACUNIT,
+ actor->y + ((r1 & 31) - 16) * FRACUNIT,
actor->subsector->sector->floorheight, MT_TELEGLITTER2);
mo->momz = FRACUNIT / 4;
}
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -1481,13 +1481,14 @@
void A_MntrFloorFire(mobj_t * actor)
{
mobj_t *mo;
- int r;
+ int r1, r2;
- r = P_SubRandom();
+ r1 = P_SubRandom();
+ r2 = P_SubRandom();
actor->z = actor->floorz;
- mo = P_SpawnMobj(actor->x + (P_SubRandom() << 10),
- actor->y + (r << 10), ONFLOORZ,
+ mo = P_SpawnMobj(actor->x + (r2 << 10),
+ actor->y + (r1 << 10), ONFLOORZ,
MT_MNTRFX3);
mo->target = actor->target;
mo->momx = 1; // Force block checking
@@ -2411,10 +2412,12 @@
void A_SerpentSpawnGibs(mobj_t * actor)
{
mobj_t *mo;
- int r = P_Random();
+ int r1, r2;
- mo = P_SpawnMobj(actor->x + ((P_Random() - 128) << 12),
- actor->y + ((r - 128) << 12),
+ r1 = P_Random();
+ r2 = P_Random();
+ mo = P_SpawnMobj(actor->x + ((r2 - 128) << 12),
+ actor->y + ((r1 - 128) << 12),
actor->floorz + FRACUNIT, MT_SERPENT_GIB1);
if (mo)
{
@@ -2422,9 +2425,10 @@
mo->momy = (P_Random() - 128) << 6;
mo->floorclip = 6 * FRACUNIT;
}
- r = P_Random();
- mo = P_SpawnMobj(actor->x + ((P_Random() - 128) << 12),
- actor->y + ((r - 128) << 12),
+ r1 = P_Random();
+ r2 = P_Random();
+ mo = P_SpawnMobj(actor->x + ((r2 - 128) << 12),
+ actor->y + ((r1 - 128) << 12),
actor->floorz + FRACUNIT, MT_SERPENT_GIB2);
if (mo)
{
@@ -2432,9 +2436,10 @@
mo->momy = (P_Random() - 128) << 6;
mo->floorclip = 6 * FRACUNIT;
}
- r = P_Random();
- mo = P_SpawnMobj(actor->x + ((P_Random() - 128) << 12),
- actor->y + ((r - 128) << 12),
+ r1 = P_Random();
+ r2 = P_Random();
+ mo = P_SpawnMobj(actor->x + ((r2 - 128) << 12),
+ actor->y + ((r1 - 128) << 12),
actor->floorz + FRACUNIT, MT_SERPENT_GIB3);
if (mo)
{
--- a/src/hexen/p_mobj.c
+++ b/src/hexen/p_mobj.c
@@ -1830,10 +1830,12 @@
void P_BloodSplatter2(fixed_t x, fixed_t y, fixed_t z, mobj_t * originator)
{
mobj_t *mo;
- int r = P_Random();
+ int r1, r2;
- mo = P_SpawnMobj(x + ((P_Random() - 128) << 11),
- y + ((r - 128) << 11), z, MT_AXEBLOOD);
+ r1 = P_Random();
+ r2 = P_Random();
+ mo = P_SpawnMobj(x + ((r2 - 128) << 11),
+ y + ((r1 - 128) << 11), z, MT_AXEBLOOD);
mo->target = originator;
}