foxygit / doom Log in
commit 9efed5192aeb52379a8bfc66cde3b773b1bcb681
Author:     James Haley <haleyjd@hotmail.com>
AuthorDate: Sun Sep 5 05:51:38 2010 +0000
Commit:     James Haley <haleyjd@hotmail.com>
CommitDate: Sun Sep 5 05:51:38 2010 +0000

    Remove an order-of-evaluation dependency with respect to P_Random().

    Subversion-branch: /branches/strife-branch
    Subversion-revision: 2012
---
 src/strife/p_pspr.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/src/strife/p_pspr.c b/src/strife/p_pspr.c
index 8d0940ce..6696e153 100644
--- a/src/strife/p_pspr.c
+++ b/src/strife/p_pspr.c
@@ -654,13 +654,13 @@ void P_BulletSlope (mobj_t*	mo)

     if (!linetarget)
     {
-	an += 1<<26;
-	bulletslope = P_AimLineAttack (mo, an, 16*64*FRACUNIT);
-	if (!linetarget)
-	{
-	    an -= 2<<26;
-	    bulletslope = P_AimLineAttack (mo, an, 16*64*FRACUNIT);
-	}
+        an += 1<<26;
+        bulletslope = P_AimLineAttack (mo, an, 16*64*FRACUNIT);
+        if (!linetarget)
+        {
+            an -= 2<<26;
+            bulletslope = P_AimLineAttack (mo, an, 16*64*FRACUNIT);
+        }
     }
 }

@@ -668,20 +668,26 @@ void P_BulletSlope (mobj_t*	mo)
 //
 // P_GunShot
 //
+// [STRIFE] Modifications to support accuracy.
+//
 void
 P_GunShot
 ( mobj_t*	mo,
   boolean	accurate )
 {
-    angle_t	angle;
-    int		damage;
-
+    angle_t     angle;
+    int         damage;
+    int         t;
+
     damage = 4*(P_Random ()%3+4);   // villsa [STRIFE] different damage formula
     angle = mo->angle;

     // villsa [STRIFE] apply player accuracy
     if (!accurate)
-	angle += (P_Random()-P_Random())<<(20 - (mo->player->accuracy * 4 / 100));
+    {
+        t = P_Random();
+        angle += (t - P_Random())<<(20 - (mo->player->accuracy * 4 / 100));
+    }

     P_LineAttack (mo, angle, MISSILERANGE, bulletslope, damage);
 }