commit cd260be97f2374545f840a05b44ee8d67ce42151
Author: nukeykt <alexeytf2@icloud.com>
AuthorDate: Fri Dec 9 17:01:30 2016 +0900
Commit: nukeykt <alexeytf2@icloud.com>
CommitDate: Fri Dec 9 17:01:30 2016 +0900
raven: move P_Random calls to variables
---
src/heretic/p_enemy.c | 18 ++++++++++--------
src/hexen/p_enemy.c | 31 ++++++++++++++++++-------------
src/hexen/p_mobj.c | 8 +++++---
3 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/src/heretic/p_enemy.c b/src/heretic/p_enemy.c
index 008dea24..882be721 100644
--- a/src/heretic/p_enemy.c
+++ b/src/heretic/p_enemy.c
@@ -2416,11 +2416,12 @@ void A_ESound(mobj_t * mo)
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_SpawnTeleGlitter(mobj_t * actor)
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;
}
diff --git a/src/hexen/p_enemy.c b/src/hexen/p_enemy.c
index cbc574cf..ff265c8e 100644
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -1481,13 +1481,14 @@ void A_MinotaurAtk3(mobj_t * actor)
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_SerpentHeadPop(mobj_t * actor)
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 @@ void A_SerpentSpawnGibs(mobj_t * actor)
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 @@ void A_SerpentSpawnGibs(mobj_t * actor)
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)
{
diff --git a/src/hexen/p_mobj.c b/src/hexen/p_mobj.c
index 79df7cd3..1f5db12f 100644
--- a/src/hexen/p_mobj.c
+++ b/src/hexen/p_mobj.c
@@ -1830,10 +1830,12 @@ void P_BloodSplatter(fixed_t x, fixed_t y, fixed_t z, mobj_t * originator)
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;
}