shithub: choc

Download patch

ref: d2ce4d3eebbedda517b18c7aaac56661b96cc860
parent: dcfb67dadbe8b9671588c393fdcdb09182302be2
author: nukeykt <alexeytf2@icloud.com>
date: Thu Dec 8 23:04:20 EST 2016

hexen: fix random value order in function arguments to match disassembly

--- a/src/hexen/a_action.c
+++ b/src/hexen/a_action.c
@@ -1175,9 +1175,9 @@
         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)
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -1486,8 +1486,8 @@
     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 @@
     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 @@
         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 @@
         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 @@
     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 @@
         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 @@
         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 @@
         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)
--- a/src/hexen/p_mobj.c
+++ b/src/hexen/p_mobj.c
@@ -1830,9 +1830,10 @@
 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;
 }
 
--- a/src/hexen/p_pspr.c
+++ b/src/hexen/p_pspr.c
@@ -868,9 +868,9 @@
         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 @@
     }
     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)
     {