From 0973932861fd8f8851a9a6b7e451fed894844cb4 Mon Sep 17 00:00:00 2001 From: James Haley Date: Thu, 3 Feb 2011 21:50:10 +0000 Subject: Implemented "blockingline" variable so that missiles can trigger shoot-type lines in P_XYMovement. Subversion-branch: /branches/strife-branch Subversion-revision: 2244 --- src/strife/p_local.h | 10 +++++----- src/strife/p_map.c | 54 +++++++++++++++++++++++++++++++-------------------- src/strife/p_maputl.c | 42 ++++++++++++++++++++++----------------- src/strife/p_mobj.c | 10 ++++++++++ 4 files changed, 72 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/strife/p_local.h b/src/strife/p_local.h index 07c2a348..096b8b6c 100644 --- a/src/strife/p_local.h +++ b/src/strife/p_local.h @@ -227,12 +227,12 @@ void P_SetThingPosition (mobj_t* thing); // 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); diff --git a/src/strife/p_map.c b/src/strife/p_map.c index d5ab46aa..85671bde 100644 --- a/src/strife/p_map.c +++ b/src/strife/p_map.c @@ -68,24 +68,30 @@ //#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 @@ boolean PIT_CheckThing (mobj_t* thing) // speciallines[] // numspeciallines // +// haleyjd 20110203: +// [STRIFE] Modified to clear blockingline in advance of P_BlockLinesIterator +// boolean P_CheckPosition ( mobj_t* thing, @@ -456,17 +465,20 @@ P_CheckPosition tmthing = thing; tmflags = thing->flags; - + tmx = x; tmy = y; - + tmbbox[BOXTOP] = y + tmthing->radius; tmbbox[BOXBOTTOM] = y - tmthing->radius; tmbbox[BOXRIGHT] = x + tmthing->radius; 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. @@ -474,12 +486,12 @@ P_CheckPosition // 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 @@ P_CheckPosition 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 @@ P_CheckPosition 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; } diff --git a/src/strife/p_maputl.c b/src/strife/p_maputl.c index 4cf681fe..681e7c26 100644 --- a/src/strife/p_maputl.c +++ b/src/strife/p_maputl.c @@ -471,39 +471,45 @@ P_SetThingPosition (mobj_t* thing) // 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 } diff --git a/src/strife/p_mobj.c b/src/strife/p_mobj.c index eacb6c2a..e53678b4 100644 --- a/src/strife/p_mobj.c +++ b/src/strife/p_mobj.c @@ -38,6 +38,9 @@ #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 @@ void P_XYMovement (mobj_t* mo) } 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 && -- cgit v1.2.3