shithub: choc

Download patch

ref: d086fa7b7e200a86ada6b482a616b02f4eb1e77b
parent: 15fdcbbe5899bde4831d100db63117ba2c00a4dd
author: James Haley <haleyjd@hotmail.com>
date: Fri Sep 10 00:12:08 EDT 2010

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

--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -273,8 +273,7 @@
 
     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 @@
 // haleyjd 09/05/10: Needed below.
 extern void P_BulletSlope (mobj_t *mo);
 
-#define LOCAL_MELEERANGE 64*FRACUNIT
-
 //
 // P_LookForPlayers
 //
@@ -815,7 +812,7 @@
                 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 @@
         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);
 }
 
--- 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
--- a/src/strife/p_mobj.c
+++ b/src/strife/p_mobj.c
@@ -954,16 +954,20 @@
   fixed_t	z )
 {
     mobj_t*	th;
-	
-    z += ((P_Random()-P_Random())<<10);
+    int t = P_Random();
 
-    th = P_SpawnMobj (x,y,z, MT_STRIFEPUFF);
-    th->momz = FRACUNIT;
-    th->tics -= P_Random()&3;
+    z += ((t - P_Random())<<10);
 
+    // [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 @@
   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,11 +1078,11 @@
     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);
@@ -1084,7 +1089,7 @@
 
     // 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 @@
     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;
 }
 
--- a/src/strife/p_pspr.c
+++ b/src/strife/p_pspr.c
@@ -446,17 +446,19 @@
     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 @@
         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);
     }