ref: 0973932861fd8f8851a9a6b7e451fed894844cb4
parent: 272bfd44b65ab79dc58422a56e8ef035da9c5784
author: James Haley <haleyjd@hotmail.com>
date: Thu Feb 3 16:50:10 EST 2011
Implemented "blockingline" variable so that missiles can trigger shoot-type lines in P_XYMovement. Subversion-branch: /branches/strife-branch Subversion-revision: 2244
--- a/src/strife/p_local.h
+++ b/src/strife/p_local.h
@@ -227,12 +227,12 @@
// If "floatok" true, move would be ok
// if within "tmfloorz - tmceilingz".
-extern boolean floatok;
-extern fixed_t tmfloorz;
-extern fixed_t tmceilingz;
+extern boolean floatok;
+extern fixed_t tmfloorz;
+extern fixed_t tmceilingz;
-
-extern line_t* ceilingline;
+extern line_t *ceilingline;
+extern line_t *blockingline; // [STRIFE] New global
boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y);
--- a/src/strife/p_map.c
+++ b/src/strife/p_map.c
@@ -68,25 +68,31 @@
//#define DEFAULT_SPECHIT_MAGIC 0x84f968e8
-fixed_t tmbbox[4];
-mobj_t* tmthing;
-int tmflags;
-fixed_t tmx;
-fixed_t tmy;
+fixed_t tmbbox[4];
+mobj_t* tmthing;
+int tmflags;
+fixed_t tmx;
+fixed_t tmy;
// If "floatok" true, move would be ok
// if within "tmfloorz - tmceilingz".
-boolean floatok;
+boolean floatok;
-fixed_t tmfloorz;
-fixed_t tmceilingz;
-fixed_t tmdropoffz;
+fixed_t tmfloorz;
+fixed_t tmceilingz;
+fixed_t tmdropoffz;
// keep track of the line that lowers the ceiling,
// so missiles don't explode against sky hack walls
-line_t* ceilingline;
+line_t* ceilingline;
+// haleyjd 20110203: [STRIFE] New global
+// "blockingline" tracks the linedef responsible for blocking motion of an mobj
+// for purposes of doing impact special activation by missiles. Suspiciously
+// similar to the solution used by Raven in Heretic and Hexen.
+line_t *blockingline;
+
// keep track of special lines as they are hit,
// but don't process them until the move is proven valid
@@ -440,6 +446,9 @@
// speciallines[]
// numspeciallines
//
+// haleyjd 20110203:
+// [STRIFE] Modified to clear blockingline in advance of P_BlockLinesIterator
+//
boolean
P_CheckPosition
( mobj_t* thing,
@@ -456,10 +465,10 @@
tmthing = thing;
tmflags = thing->flags;
-
+
tmx = x;
tmy = y;
-
+
tmbbox[BOXTOP] = y + tmthing->radius;
tmbbox[BOXBOTTOM] = y - tmthing->radius;
tmbbox[BOXRIGHT] = x + tmthing->radius;
@@ -466,8 +475,11 @@
tmbbox[BOXLEFT] = x - tmthing->radius;
newsubsec = R_PointInSubsector (x,y);
- ceilingline = NULL;
+ // [STRIFE] clear blockingline (see P_XYMovement, P_BlockLinesIterator)
+ blockingline = NULL;
+ ceilingline = NULL;
+
// The base floor / ceiling is from the subsector
// that contains the point.
// Any contacted lines the step closer together
@@ -474,12 +486,12 @@
// will adjust them.
tmfloorz = tmdropoffz = newsubsec->sector->floorheight;
tmceilingz = newsubsec->sector->ceilingheight;
-
+
validcount++;
numspechit = 0;
if ( tmflags & MF_NOCLIP )
- return true;
+ return true;
// Check things first, possibly picking things up.
// The bounding box is extended by MAXRADIUS
@@ -492,9 +504,9 @@
yh = (tmbbox[BOXTOP] - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT;
for (bx=xl ; bx<=xh ; bx++)
- for (by=yl ; by<=yh ; by++)
- if (!P_BlockThingsIterator(bx,by,PIT_CheckThing))
- return false;
+ for (by=yl ; by<=yh ; by++)
+ if (!P_BlockThingsIterator(bx,by,PIT_CheckThing))
+ return false;
// check lines
xl = (tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
@@ -503,9 +515,9 @@
yh = (tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
for (bx=xl ; bx<=xh ; bx++)
- for (by=yl ; by<=yh ; by++)
- if (!P_BlockLinesIterator (bx,by,PIT_CheckLine))
- return false;
+ for (by=yl ; by<=yh ; by++)
+ if (!P_BlockLinesIterator (bx,by,PIT_CheckLine))
+ return false;
return true;
}
--- a/src/strife/p_maputl.c
+++ b/src/strife/p_maputl.c
@@ -471,39 +471,45 @@
// to P_BlockLinesIterator, then make one or more calls
// to it.
//
+// haleyjd 20110203:
+// [STRIFE] Modified to track blockingline
+//
boolean
P_BlockLinesIterator
-( int x,
- int y,
+( int x,
+ int y,
boolean(*func)(line_t*) )
{
- int offset;
- short* list;
- line_t* ld;
-
+ int offset;
+ short* list;
+ line_t* ld;
+
if (x<0
- || y<0
- || x>=bmapwidth
- || y>=bmapheight)
+ || y<0
+ || x>=bmapwidth
+ || y>=bmapheight)
{
- return true;
+ return true;
}
offset = y*bmapwidth+x;
-
+
offset = *(blockmap+offset);
for ( list = blockmaplump+offset ; *list != -1 ; list++)
{
- ld = &lines[*list];
+ ld = &lines[*list];
- if (ld->validcount == validcount)
- continue; // line has already been checked
+ // [STRIFE]: set blockingline (see P_XYMovement @ p_mobj.c)
+ blockingline = ld;
- ld->validcount = validcount;
-
- if ( !func(ld) )
- return false;
+ if (ld->validcount == validcount)
+ continue; // line has already been checked
+
+ ld->validcount = validcount;
+
+ if ( !func(ld) )
+ return false;
}
return true; // everything was checked
}
--- a/src/strife/p_mobj.c
+++ b/src/strife/p_mobj.c
@@ -38,7 +38,10 @@
#include "doomstat.h"
#include "d_main.h" // villsa [STRIFE]
+extern line_t *spechit[]; // haleyjd:
+extern int numspechit; // [STRIFE] - needed in P_XYMovement
+
void G_PlayerReborn (int player);
void P_SpawnMapThing (mapthing_t* mthing);
@@ -195,6 +198,13 @@
}
else if (mo->flags & MF_MISSILE)
{
+ // haley 20110203: [STRIFE]
+ // This modification allows missiles to activate shoot specials
+ if(blockingline && blockingline->special)
+ P_ShootSpecialLine(mo, blockingline);
+ if(numspechit)
+ P_ShootSpecialLine(mo, spechit[numspechit]);
+
// explode a missile
if (ceilingline &&
ceilingline->backsector &&