foxygit / doom Log in
commit d086fa7b7e200a86ada6b482a616b02f4eb1e77b
Author:     James Haley <haleyjd@hotmail.com>
AuthorDate: Fri Sep 10 04:12:08 2010 +0000
Commit:     James Haley <haleyjd@hotmail.com>
CommitDate: Fri Sep 10 04:12:08 2010 +0000

    Changed MELEERANGE back to 64 and defined a new PLAYERMELEERANGE to be
    80. Fixed P_SpawnPuff by removing more unused DOOM code. Fixed Crusader
    flamethower attack bug due to a missed return statement.

    Subversion-branch: /branches/strife-branch
    Subversion-revision: 2054
---
 src/strife/p_enemy.c | 35 +++++++++++++++--------------------
 src/strife/p_local.h |  3 ++-
 src/strife/p_mobj.c  | 45 +++++++++++++++++++++++++--------------------
 src/strife/p_pspr.c  | 23 +++++++++++++----------
 4 files changed, 55 insertions(+), 51 deletions(-)

diff --git a/src/strife/p_enemy.c b/src/strife/p_enemy.c
index 6cdc4d86..a5d3da3c 100644
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -273,8 +273,7 @@ boolean P_CheckMeleeRange(mobj_t* actor)

     dist = P_AproxDistance(pl->x - actor->x, pl->y - actor->y);

-    // villsa [STRIFE] change to 36
-    if(dist >= MELEERANGE - 36*FRACUNIT + pl->info->radius)
+    if(dist >= MELEERANGE - 20*FRACUNIT + pl->info->radius)
         return false;

     if(!P_CheckSight (actor, actor->target))
@@ -700,8 +699,6 @@ void P_NewRandomDir(mobj_t* actor)
 // haleyjd 09/05/10: Needed below.
 extern void P_BulletSlope (mobj_t *mo);

-#define LOCAL_MELEERANGE 64*FRACUNIT
-
 //
 // P_LookForPlayers
 //
@@ -815,7 +812,7 @@ P_LookForPlayers
                 dist = P_AproxDistance (player->mo->x - actor->x,
                     player->mo->y - actor->y);
                 // if real close, react anyway
-                if (dist > LOCAL_MELEERANGE) // haleyjd: ......
+                if (dist > MELEERANGE)
                     continue;       // behind back
             }
         }
@@ -1513,26 +1510,24 @@ void A_CrusaderAttack(mobj_t* actor)
         actor->angle -= (ANG90 / 8);
         P_SpawnFacingMissile(actor, actor->target, MT_C_FLAME);
     }
-    else
+    else if(P_CheckMissileRange(actor))
     {
-        if(P_CheckMissileRange(actor))
-        {
-            A_FaceTarget(actor);
-            actor->z += (16*FRACUNIT);
-            P_SpawnFacingMissile(actor, actor->target, MT_C_MISSILE);
+        A_FaceTarget(actor);
+        actor->z += (16*FRACUNIT);
+        P_SpawnFacingMissile(actor, actor->target, MT_C_MISSILE);

-            actor->angle -= (ANG45 / 32);
-            actor->z -= (16*FRACUNIT);
-            P_SpawnFacingMissile(actor, actor->target, MT_C_MISSILE);
+        actor->angle -= (ANG45 / 32);
+        actor->z -= (16*FRACUNIT);
+        P_SpawnFacingMissile(actor, actor->target, MT_C_MISSILE);

-            actor->angle += (ANG45 / 16);
-            P_SpawnFacingMissile(actor, actor->target, MT_C_MISSILE);
+        actor->angle += (ANG45 / 16);
+        P_SpawnFacingMissile(actor, actor->target, MT_C_MISSILE);

-            actor->reactiontime += 15;
-        }
+        actor->reactiontime += 15;
     }
-
-    P_SetMobjState(actor, actor->info->seestate);
+    else
+        P_SetMobjState(actor, actor->info->seestate);
+
     actor->z -= (8*FRACUNIT);
 }

diff --git a/src/strife/p_local.h b/src/strife/p_local.h
index be94523e..fa50e1bf 100644
--- a/src/strife/p_local.h
+++ b/src/strife/p_local.h
@@ -59,7 +59,8 @@
 #define MAXMOVE		(30*FRACUNIT)

 #define USERANGE		(64*FRACUNIT)
-#define MELEERANGE		(80*FRACUNIT)   // villsa [STRIFE] changed from 64 to 80
+#define MELEERANGE		(64*FRACUNIT)
+#define PLAYERMELEERANGE	(80*FRACUNIT) // haleyjd [STRIFE] New constant
 #define MISSILERANGE	(32*64*FRACUNIT)

 // follow a player exlusively for 3 seconds
diff --git a/src/strife/p_mobj.c b/src/strife/p_mobj.c
index 3c9d1a69..e0cb8466 100644
--- a/src/strife/p_mobj.c
+++ b/src/strife/p_mobj.c
@@ -954,16 +954,20 @@ P_SpawnPuff
   fixed_t	z )
 {
     mobj_t*	th;
-
-    z += ((P_Random()-P_Random())<<10);
+    int t = P_Random();
+
+    z += ((t - P_Random())<<10);

-    th = P_SpawnMobj (x,y,z, MT_STRIFEPUFF);
-    th->momz = FRACUNIT;
-    th->tics -= P_Random()&3;
+    // [STRIFE] Unused
+    //th->momz = FRACUNIT;
+    //th->tics -= P_Random()&3;
+
+    th = P_SpawnMobj (x,y,z, MT_STRIFEPUFF); // [STRIFE]: new type

     // don't make punches spark on the wall
-    if(attackrange == MELEERANGE)
-        P_SetMobjState(th, S_POW2_00);
+    // [STRIFE] Use a separate melee attack range for the player
+    if(attackrange == PLAYERMELEERANGE)
+        P_SetMobjState(th, S_POW2_00); // 141

     // villsa [STRIFE] unused
     /*if (th->tics < 1)
@@ -993,23 +997,24 @@ P_SpawnBlood
   int		damage )
 {
     mobj_t*	th;
-
+
     z += ((P_Random()-P_Random())<<10);
     th = P_SpawnMobj (x,y,z, MT_BLOOD_DEATH);
     th->momz = FRACUNIT*2;
+
     //th->tics -= P_Random()&3; // villsa [STRIFE] unused

     // villsa [STRIFE] unused
     /*if (th->tics < 1)
-	th->tics = 1;*/
-
+        th->tics = 1;*/
+
     // villsa [STRIFE] different checks for damage range
     if (damage >= 10 && damage <= 13)
-	P_SetMobjState (th,S_BLOD_00);
+        P_SetMobjState (th,S_BLOD_00);
     else if (damage < 10 && damage >= 7)
         P_SetMobjState (th,S_BLOD_01);
     else if (damage < 7)
-	P_SetMobjState (th,S_BLOD_02);
+        P_SetMobjState (th,S_BLOD_02);
 }


@@ -1073,18 +1078,18 @@ P_SpawnMissile
     int		dist;

     th = P_SpawnMobj (source->x,
-		      source->y,
-		      source->z + 4*8*FRACUNIT, type);
-
+                      source->y,
+                      source->z + 4*8*FRACUNIT, type);
+
     if (th->info->seesound)
-	S_StartSound (th, th->info->seesound);
+        S_StartSound (th, th->info->seesound);

     th->target = source;	// where it came from
     an = R_PointToAngle2 (source->x, source->y, dest->x, dest->y);

     // fuzzy player
     if (dest->flags & MF_SHADOW)
-	an += (P_Random()-P_Random())<<21;
+        an += (P_Random()-P_Random())<<21;
     // villsa [STRIFE] check for heavily transparent things
     else if(dest->flags & MF_MVIS)
         an += (P_Random()-P_Random())<<22;
@@ -1093,16 +1098,16 @@ P_SpawnMissile
     an >>= ANGLETOFINESHIFT;
     th->momx = FixedMul (th->info->speed, finecosine[an]);
     th->momy = FixedMul (th->info->speed, finesine[an]);
-
+
     dist = P_AproxDistance (dest->x - source->x, dest->y - source->y);
     dist = dist / th->info->speed;

     if (dist < 1)
-	dist = 1;
+        dist = 1;

     th->momz = (dest->z - source->z) / dist;
     P_CheckMissileSpawn (th);
-
+
     return th;
 }

diff --git a/src/strife/p_pspr.c b/src/strife/p_pspr.c
index 6e2ccfad..99981739 100644
--- a/src/strife/p_pspr.c
+++ b/src/strife/p_pspr.c
@@ -446,17 +446,19 @@ void A_Punch(player_t* player, pspdef_t* psp)
     int         damage;
     int         slope;
     int         sound;
-
+    int         t;
+
     // villsa [STRIFE] new damage formula
     damage = ((player->stamina / 10) + 2) * (psp->tics + 3) & P_Random();

     if(player->powers[pw_strength])
-	damage *= 10;
+        damage *= 10;

     angle = player->mo->angle;
-    angle += (P_Random()-P_Random())<<18;
-    slope = P_AimLineAttack (player->mo, angle, MELEERANGE);
-    P_LineAttack (player->mo, angle, MELEERANGE, slope, damage);
+    t = P_Random();
+    angle += (t - P_Random()) << 18;
+    slope = P_AimLineAttack (player->mo, angle, PLAYERMELEERANGE);
+    P_LineAttack (player->mo, angle, PLAYERMELEERANGE, slope, damage);

     // turn to face target
     if(linetarget)
@@ -467,14 +469,15 @@ void A_Punch(player_t* player, pspdef_t* psp)
         else
             sound = sfx_meatht;

-	S_StartSound (player->mo, sound);
-	player->mo->angle = R_PointToAngle2 (player->mo->x,
-					     player->mo->y,
-					     linetarget->x,
-					     linetarget->y);
+        S_StartSound (player->mo, sound);
+        player->mo->angle = R_PointToAngle2 (player->mo->x,
+                                             player->mo->y,
+                                             linetarget->x,
+                                             linetarget->y);

         // villsa [STRIFE] apply flag
         player->mo->flags |= MF_JUSTATTACKED;
+
         // villsa [STRIFE] do punch alert routine
         P_DoPunchAlert(player->mo, linetarget);
     }