foxygit / doom Log in
commit 5aa95863f364142d404a989eec0d28844352811a
Author:     James Haley <haleyjd@hotmail.com>
AuthorDate: Wed Sep 22 00:10:59 2010 +0000
Commit:     James Haley <haleyjd@hotmail.com>
CommitDate: Wed Sep 22 00:10:59 2010 +0000

    Fixed firing of missiles when looking up/down so that the aimslope
    calculated in P_AimLineAttack is used. Added W1 handling for linetype
    182 to P_CrossSpecialLine, which lets missiles break windows. Corrected
    numerous mistakes in the implementation of P_ChangeSwitchTexture.

    Subversion-branch: /branches/strife-branch
    Subversion-revision: 2128
---
 src/strife/p_map.c    | 18 +++++++++---------
 src/strife/p_mobj.c   |  6 +++++-
 src/strife/p_spec.c   | 44 ++++++++++++++++++++++++++++++--------------
 src/strife/p_switch.c | 11 ++++++-----
 4 files changed, 50 insertions(+), 29 deletions(-)

diff --git a/src/strife/p_map.c b/src/strife/p_map.c
index 4d87f772..e4b00eac 100644
--- a/src/strife/p_map.c
+++ b/src/strife/p_map.c
@@ -1214,11 +1214,11 @@ P_AimLineAttack
   angle_t	angle,
   fixed_t	distance )
 {
-    fixed_t	x2;
-    fixed_t	y2;
+    fixed_t     x2;
+    fixed_t     y2;

     t1 = P_SubstNullMobj(t1);
-
+
     angle >>= ANGLETOFINESHIFT;
     shootthing = t1;

@@ -1232,14 +1232,14 @@ P_AimLineAttack

     attackrange = distance;
     linetarget = NULL;
-
+
     P_PathTraverse ( t1->x, t1->y,
-		     x2, y2,
-		     PT_ADDLINES|PT_ADDTHINGS,
-		     PTR_AimTraverse );
-
+                     x2, y2,
+                     PT_ADDLINES|PT_ADDTHINGS,
+                     PTR_AimTraverse );
+
     if (linetarget)
-	return aimslope;
+        return aimslope;
     else    // villsa [STRIFE] checks for player pitch
     {
         if(t1->player)
diff --git a/src/strife/p_mobj.c b/src/strife/p_mobj.c
index 4e630d91..d52669de 100644
--- a/src/strife/p_mobj.c
+++ b/src/strife/p_mobj.c
@@ -1177,6 +1177,8 @@ mobj_t* P_SpawnFacingMissile(mobj_t* source, mobj_t* target, mobjtype_t type)
 //
 // Tries to aim at a nearby monster
 // villsa [STRIFE] now returns a mobj
+// * Also modified to allow up/down look, and to account for foot-clipping
+//   by liquid terrain.
 //
 mobj_t* P_SpawnPlayerMissile(mobj_t* source, mobjtype_t type)
 {
@@ -1206,7 +1208,9 @@ mobj_t* P_SpawnPlayerMissile(mobj_t* source, mobjtype_t type)
         if (!linetarget)
         {
             an = source->angle;
-            slope = 0;
+
+            // haleyjd 09/21/10: [STRIFE] Removed, for look up/down support.
+            //slope = 0;
         }
     }

diff --git a/src/strife/p_spec.c b/src/strife/p_spec.c
index 2111cdc3..786da835 100644
--- a/src/strife/p_spec.c
+++ b/src/strife/p_spec.c
@@ -627,7 +627,7 @@ P_CrossSpecialLine
         case 231:       // haleyjd: STRIFE-TODO: Identify type
         case 125:       // TELEPORT MONSTERONLY TRIGGER
         case 126:       // TELEPORT MONSTERONLY RETRIGGER
-        case 182:       // haleyjd: STRIFE-TODO: Identify type
+        case 182:       // haleyjd: [STRIFE] Break glass - it's a cross type too!
         case 10:        // PLAT DOWN-WAIT-UP-STAY TRIGGER
         case 39:        // TELEPORT TRIGGER
         case 88:        // PLAT DOWN-WAIT-UP-STAY RETRIGGER
@@ -643,8 +643,10 @@ P_CrossSpecialLine
     // Note: could use some const's here.
     switch (line->special)
     {
+        //
         // TRIGGERS.
         // All from here to RETRIGGERS.
+        //
     case 2:
         // Open Door
         EV_DoDoor(line,open);
@@ -865,6 +867,8 @@ P_CrossSpecialLine

     case 124:
         // Secret EXIT
+        // [STRIFE] No secret exits;
+        // STRIFE-TODO: is this reused for something else?
         //G_SecretExitLevel ();
         break;

@@ -889,7 +893,29 @@ P_CrossSpecialLine
         line->special = 0;
         break;

+    case 174:
+        // villsa [STRIFE] Split Open
+        EV_DoDoor(line, splitOpen);
+        line->special = 0;
+        break;
+
+    case 182:
+        // haleyjd 09/21/10: [STRIFE]
+        // 182 is a unique linetype in that it is both a G1 and a W1 linetype,
+        // but only missiles may activate it as a W1 type.
+        if(thing->flags & MF_MISSILE)
+            P_ChangeSwitchTexture(line, 1); // why 1? it will be cleared anyway.
+        break;
+
+    case 183:
+        // villsa [STRIFE] Split Raise Nearest
+        EV_DoDoor(line, splitRaiseNearest);
+        line->special = 0;
+        break;
+
+        //
         // RETRIGGERS.  All from here till end.
+        //
     case 72:
         // Ceiling Crush
         EV_DoCeiling( line, lowerAndCrush );
@@ -1071,7 +1097,7 @@ P_CrossSpecialLine
             }

             DEH_snprintf(msgbuf, sizeof(msgbuf), "Entering%s",
-                         mapnames[map - 1] + 8);
+                         DEH_String(mapnames[map - 1]) + 8);
             thing->player->message = msgbuf;

             if(netgame && deathmatch)
@@ -1101,18 +1127,8 @@ P_CrossSpecialLine
             }
         }
         break;
-
-    case 174:
-        // villsa [STRIFE] Split Open
-        EV_DoDoor(line, splitOpen);
-        line->special = 0;
-        break;
-
-    case 183:
-        // villsa [STRIFE] Split Raise Nearest
-        EV_DoDoor(line, splitRaiseNearest);
-        line->special = 0;
-        break;
+
+        // haleyjd 09/21/10: Moved one-time-use lines up above with the others.
     }
 }

diff --git a/src/strife/p_switch.c b/src/strife/p_switch.c
index d190da09..f40e24ac 100644
--- a/src/strife/p_switch.c
+++ b/src/strife/p_switch.c
@@ -263,7 +263,6 @@ void P_ChangeSwitchTexture(line_t* line, int useAgain)

     sound = sfx_swtchn;

-    // EXIT SWITCH?
     // villsa [STRIFE] check for linetype 182 (break glass)
     if(line->special == 182)
     {
@@ -272,11 +271,12 @@ void P_ChangeSwitchTexture(line_t* line, int useAgain)

         if(useAgain)
         {
-            texMid = 0;
+            // haleyjd 09/21/10: Corrected (>> 16 == next field)
             texTop = 0;
+            texBot = 0;
         }

-        if(texBot)
+        if(texMid) // haleyjd 09/21/10: Corrected (>> 16 == next field)
             useAgain = 0;

         sound = sfx_bglass;
@@ -295,7 +295,7 @@ void P_ChangeSwitchTexture(line_t* line, int useAgain)
             if(sl->sound)
                 sound = sl->sound;

-            S_StartSound(buttonlist->soundorg,sound);
+            S_StartSound(buttonlist->soundorg, sound);
             sides[line->sidenum[0]].toptexture = switchlist[i^1];

             if(useAgain)
@@ -318,13 +318,14 @@ void P_ChangeSwitchTexture(line_t* line, int useAgain)
                 sides[line->sidenum[0]].midtexture = switchlist[i^1];

                 // villsa [STRIFE] affect second side of line
+                // BUG: will crash if 1S line is marked with TWOSIDED flag!
                 if(line->flags & ML_TWOSIDED)
                     sides[line->sidenum[1]].midtexture = switchlist[i^1];

                 if(useAgain)
                     P_StartButton(line, middle,switchlist[i],BUTTONTIME);

-                // villsa [STRIFE]
+                // villsa [STRIFE]: Mines Converter hack
                 if(sound == sfx_firxpl)
                 {
                     breakglass = true;