foxygit / doom Log in
commit d2ce4d3eebbedda517b18c7aaac56661b96cc860
Author:     nukeykt <alexeytf2@icloud.com>
AuthorDate: Fri Dec 9 04:04:20 2016 +0900
Commit:     nukeykt <alexeytf2@icloud.com>
CommitDate: Fri Dec 9 04:04:20 2016 +0900

    hexen: fix random value order in function arguments to match disassembly
---
 src/hexen/a_action.c |  4 ++--
 src/hexen/p_enemy.c  | 32 ++++++++++++++++----------------
 src/hexen/p_mobj.c   |  3 ++-
 src/hexen/p_pspr.c   |  8 ++++----
 4 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/src/hexen/a_action.c b/src/hexen/a_action.c
index 737f72f6..21b9e85b 100644
--- a/src/hexen/a_action.c
+++ b/src/hexen/a_action.c
@@ -1175,9 +1175,9 @@ void A_SoAExplode(mobj_t * actor)
         r1 = P_Random();
         r2 = P_Random();
         r3 = P_Random();
-        mo = P_SpawnMobj(actor->x + ((r1 - 128) << 12),
+        mo = P_SpawnMobj(actor->x + ((r3 - 128) << 12),
                          actor->y + ((r2 - 128) << 12),
-                         actor->z + (r3 * actor->height / 256),
+                         actor->z + (r1 * actor->height / 256),
                          MT_ZARMORCHUNK);
         P_SetMobjState(mo, mo->info->spawnstate + i);
         if (mo)
diff --git a/src/hexen/p_enemy.c b/src/hexen/p_enemy.c
index 1ad58b49..cbc574cf 100644
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -1486,8 +1486,8 @@ void A_MntrFloorFire(mobj_t * actor)
     r = P_SubRandom();

     actor->z = actor->floorz;
-    mo = P_SpawnMobj(actor->x + (r << 10),
-                     actor->y + (P_SubRandom() << 10), ONFLOORZ,
+    mo = P_SpawnMobj(actor->x + (P_SubRandom() << 10),
+                     actor->y + (r << 10), ONFLOORZ,
                      MT_MNTRFX3);
     mo->target = actor->target;
     mo->momx = 1;               // Force block checking
@@ -2413,8 +2413,8 @@ void A_SerpentSpawnGibs(mobj_t * actor)
     mobj_t *mo;
     int r = P_Random();

-    mo = P_SpawnMobj(actor->x + ((r - 128) << 12),
-                     actor->y + ((P_Random() - 128) << 12),
+    mo = P_SpawnMobj(actor->x + ((P_Random() - 128) << 12),
+                     actor->y + ((r - 128) << 12),
                      actor->floorz + FRACUNIT, MT_SERPENT_GIB1);
     if (mo)
     {
@@ -2423,8 +2423,8 @@ void A_SerpentSpawnGibs(mobj_t * actor)
         mo->floorclip = 6 * FRACUNIT;
     }
     r = P_Random();
-    mo = P_SpawnMobj(actor->x + ((r - 128) << 12),
-                     actor->y + ((P_Random() - 128) << 12),
+    mo = P_SpawnMobj(actor->x + ((P_Random() - 128) << 12),
+                     actor->y + ((r - 128) << 12),
                      actor->floorz + FRACUNIT, MT_SERPENT_GIB2);
     if (mo)
     {
@@ -2433,8 +2433,8 @@ void A_SerpentSpawnGibs(mobj_t * actor)
         mo->floorclip = 6 * FRACUNIT;
     }
     r = P_Random();
-    mo = P_SpawnMobj(actor->x + ((r - 128) << 12),
-                     actor->y + ((P_Random() - 128) << 12),
+    mo = P_SpawnMobj(actor->x + ((P_Random() - 128) << 12),
+                     actor->y + ((r - 128) << 12),
                      actor->floorz + FRACUNIT, MT_SERPENT_GIB3);
     if (mo)
     {
@@ -2797,9 +2797,9 @@ void A_BishopPainBlur(mobj_t * actor)
     r2 = P_SubRandom();
     r3 = P_SubRandom();

-    mo = P_SpawnMobj(actor->x + (r1 << 12), actor->y
+    mo = P_SpawnMobj(actor->x + (r3 << 12), actor->y
                      + (r2 << 12),
-                     actor->z + (r3 << 11),
+                     actor->z + (r1 << 11),
                      MT_BISHOPPAINBLUR);
     if (mo)
     {
@@ -3048,9 +3048,9 @@ void A_DragonFX2(mobj_t * actor)
         r1 = P_Random();
         r2 = P_Random();
         r3 = P_Random();
-        mo = P_SpawnMobj(actor->x + ((r1 - 128) << 14),
+        mo = P_SpawnMobj(actor->x + ((r3 - 128) << 14),
                          actor->y + ((r2 - 128) << 14),
-                         actor->z + ((r3 - 128) << 12),
+                         actor->z + ((r1 - 128) << 12),
                          MT_DRAGON_FX2);
         if (mo)
         {
@@ -4865,10 +4865,10 @@ void A_FreezeDeathChunks(mobj_t * actor)
         r2 = P_Random();
         r3 = P_Random();
         mo = P_SpawnMobj(actor->x +
-                         (((r1 - 128) * actor->radius) >> 7),
+                         (((r3 - 128) * actor->radius) >> 7),
                          actor->y +
                          (((r2 - 128) * actor->radius) >> 7),
-                         actor->z + (r3 * actor->height / 255),
+                         actor->z + (r1 * actor->height / 255),
                          MT_ICECHUNK);
         P_SetMobjState(mo, mo->info->spawnstate + (P_Random() % 3));
         if (mo)
@@ -4885,10 +4885,10 @@ void A_FreezeDeathChunks(mobj_t * actor)
         r2 = P_Random();
         r3 = P_Random();
         mo = P_SpawnMobj(actor->x +
-                         (((r1 - 128) * actor->radius) >> 7),
+                         (((r3 - 128) * actor->radius) >> 7),
                          actor->y +
                          (((r2 - 128) * actor->radius) >> 7),
-                         actor->z + (r3 * actor->height / 255),
+                         actor->z + (r1 * actor->height / 255),
                          MT_ICECHUNK);
         P_SetMobjState(mo, mo->info->spawnstate + (P_Random() % 3));
         if (mo)
diff --git a/src/hexen/p_mobj.c b/src/hexen/p_mobj.c
index 2ec15952..79df7cd3 100644
--- a/src/hexen/p_mobj.c
+++ b/src/hexen/p_mobj.c
@@ -1830,9 +1830,10 @@ 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();

     mo = P_SpawnMobj(x + ((P_Random() - 128) << 11),
-                     y + ((P_Random() - 128) << 11), z, MT_AXEBLOOD);
+                     y + ((r - 128) << 11), z, MT_AXEBLOOD);
     mo->target = originator;
 }

diff --git a/src/hexen/p_pspr.c b/src/hexen/p_pspr.c
index 8605e7b7..9ab2a752 100644
--- a/src/hexen/p_pspr.c
+++ b/src/hexen/p_pspr.c
@@ -868,9 +868,9 @@ void A_FSwordFlames(mobj_t * actor)
         r1 = P_Random();
         r2 = P_Random();
         r3 = P_Random();
-        P_SpawnMobj(actor->x + ((r1 - 128) << 12), actor->y
+        P_SpawnMobj(actor->x + ((r3 - 128) << 12), actor->y
                     + ((r2 - 128) << 12),
-                    actor->z + ((r3 - 128) << 11), MT_FSWORD_FLAME);
+                    actor->z + ((r1 - 128) << 11), MT_FSWORD_FLAME);
     }
 }

@@ -1003,8 +1003,8 @@ void A_LightningZap(mobj_t * actor)
     }
     r1 = P_Random();
     r2 = P_Random();
-    mo = P_SpawnMobj(actor->x + ((r1 - 128) * actor->radius / 256),
-                     actor->y + ((r2 - 128) * actor->radius / 256),
+    mo = P_SpawnMobj(actor->x + ((r2 - 128) * actor->radius / 256),
+                     actor->y + ((r1 - 128) * actor->radius / 256),
                      actor->z + deltaZ, MT_LIGHTNING_ZAP);
     if (mo)
     {