- fixed: puff checks for MF6_NOTRIGGER need to resolve actor replacements.

SVN r1909 (trunk)
This commit is contained in:
Christoph Oelckers 2009-10-11 17:44:50 +00:00
parent 4529108b8f
commit 9dfef79702
2 changed files with 374 additions and 56 deletions

View file

@ -413,14 +413,24 @@ void AM_getIslope (mline_t *ml, islope_t *is)
} }
*/ */
//=============================================================================
//
// called by the coordinate drawer
//
//=============================================================================
void AM_GetPosition(fixed_t &x, fixed_t &y) void AM_GetPosition(fixed_t &x, fixed_t &y)
{ {
x = (m_x + m_w/2) << FRACTOMAPBITS; x = (m_x + m_w/2) << FRACTOMAPBITS;
y = (m_y + m_h/2) << FRACTOMAPBITS; y = (m_y + m_h/2) << FRACTOMAPBITS;
} }
//=============================================================================
// //
// //
// //
//=============================================================================
void AM_activateNewScale () void AM_activateNewScale ()
{ {
m_x += m_w/2; m_x += m_w/2;
@ -433,9 +443,12 @@ void AM_activateNewScale ()
m_y2 = m_y + m_h; m_y2 = m_y + m_h;
} }
//=============================================================================
// //
// //
// //
//=============================================================================
void AM_saveScaleAndLoc () void AM_saveScaleAndLoc ()
{ {
old_m_x = m_x; old_m_x = m_x;
@ -444,9 +457,12 @@ void AM_saveScaleAndLoc ()
old_m_h = m_h; old_m_h = m_h;
} }
//=============================================================================
// //
// //
// //
//=============================================================================
void AM_restoreScaleAndLoc () void AM_restoreScaleAndLoc ()
{ {
m_w = old_m_w; m_w = old_m_w;
@ -469,9 +485,12 @@ void AM_restoreScaleAndLoc ()
scale_ftom = MapDiv(MAPUNIT, scale_mtof); scale_ftom = MapDiv(MAPUNIT, scale_mtof);
} }
//=============================================================================
// //
// adds a marker at the current location // adds a marker at the current location
// //
//=============================================================================
bool AM_addMark () bool AM_addMark ()
{ {
if (marknums[0].isValid()) if (marknums[0].isValid())
@ -484,10 +503,13 @@ bool AM_addMark ()
return false; return false;
} }
//=============================================================================
// //
// Determines bounding box of all vertices, // Determines bounding box of all vertices,
// sets global variables controlling zoom range. // sets global variables controlling zoom range.
// //
//=============================================================================
static void AM_findMinMaxBoundaries () static void AM_findMinMaxBoundaries ()
{ {
min_x = min_y = FIXED_MAX; min_x = min_y = FIXED_MAX;
@ -515,6 +537,12 @@ static void AM_findMinMaxBoundaries ()
AM_calcMinMaxMtoF(); AM_calcMinMaxMtoF();
} }
//=============================================================================
//
//
//
//=============================================================================
static void AM_calcMinMaxMtoF() static void AM_calcMinMaxMtoF()
{ {
fixed_t a = MapDiv (SCREENWIDTH << MAPBITS, max_w); fixed_t a = MapDiv (SCREENWIDTH << MAPBITS, max_w);
@ -524,6 +552,12 @@ static void AM_calcMinMaxMtoF()
max_scale_mtof = MapDiv (SCREENHEIGHT << MAPBITS, 2*PLAYERRADIUS); max_scale_mtof = MapDiv (SCREENHEIGHT << MAPBITS, 2*PLAYERRADIUS);
} }
//=============================================================================
//
//
//
//=============================================================================
static void AM_ClipRotatedExtents (fixed_t pivotx, fixed_t pivoty) static void AM_ClipRotatedExtents (fixed_t pivotx, fixed_t pivoty)
{ {
if (am_rotate == 0 || (am_rotate == 2 && !viewactive)) if (am_rotate == 0 || (am_rotate == 2 && !viewactive))
@ -588,6 +622,12 @@ static void AM_ClipRotatedExtents (fixed_t pivotx, fixed_t pivoty)
m_y2 = m_y + m_h; m_y2 = m_y + m_h;
} }
//=============================================================================
//
//
//
//=============================================================================
static void AM_ScrollParchment (fixed_t dmapx, fixed_t dmapy) static void AM_ScrollParchment (fixed_t dmapx, fixed_t dmapy)
{ {
mapxstart -= MulScale12 (dmapx, scale_mtof); mapxstart -= MulScale12 (dmapx, scale_mtof);
@ -614,9 +654,12 @@ static void AM_ScrollParchment (fixed_t dmapx, fixed_t dmapy)
} }
} }
//=============================================================================
// //
// //
// //
//=============================================================================
void AM_changeWindowLoc () void AM_changeWindowLoc ()
{ {
if (0 != (m_paninc.x | m_paninc.y)) if (0 != (m_paninc.x | m_paninc.y))
@ -646,9 +689,12 @@ void AM_changeWindowLoc ()
} }
//=============================================================================
// //
// //
// //
//=============================================================================
void AM_initVariables () void AM_initVariables ()
{ {
int pnum; int pnum;
@ -694,6 +740,11 @@ static void GetComponents (int color, DWORD *palette, float &r, float &g, float
} }
*/ */
//=============================================================================
//
//
//
//=============================================================================
static void AM_initColors (bool overlayed) static void AM_initColors (bool overlayed)
{ {
@ -840,9 +891,12 @@ static void AM_initColors (bool overlayed)
lastpal = palette; lastpal = palette;
} }
//=============================================================================
// //
// //
// //
//=============================================================================
void AM_loadPics () void AM_loadPics ()
{ {
int i; int i;
@ -859,6 +913,12 @@ void AM_loadPics ()
mapback = TexMan.CheckForTexture(autopage, FTexture::TEX_MiscPatch); mapback = TexMan.CheckForTexture(autopage, FTexture::TEX_MiscPatch);
} }
//=============================================================================
//
//
//
//=============================================================================
bool AM_clearMarks () bool AM_clearMarks ()
{ {
for (int i = AM_NUMMARKPOINTS-1; i >= 0; i--) for (int i = AM_NUMMARKPOINTS-1; i >= 0; i--)
@ -867,9 +927,12 @@ bool AM_clearMarks ()
return marknums[0].isValid(); return marknums[0].isValid();
} }
//=============================================================================
// //
// called right after the level has been loaded // called right after the level has been loaded
// //
//=============================================================================
void AM_LevelInit () void AM_LevelInit ()
{ {
leveljuststarted = 0; leveljuststarted = 0;
@ -883,9 +946,12 @@ void AM_LevelInit ()
scale_ftom = MapDiv(MAPUNIT, scale_mtof); scale_ftom = MapDiv(MAPUNIT, scale_mtof);
} }
//=============================================================================
// //
// //
// //
//=============================================================================
void AM_Stop () void AM_Stop ()
{ {
automapactive = false; automapactive = false;
@ -894,9 +960,12 @@ void AM_Stop ()
viewactive = true; viewactive = true;
} }
//=============================================================================
// //
// //
// //
//=============================================================================
void AM_Start () void AM_Start ()
{ {
if (!stopped) AM_Stop(); if (!stopped) AM_Stop();
@ -907,27 +976,36 @@ void AM_Start ()
//=============================================================================
// //
// set the window scale to the maximum size // set the window scale to the maximum size
// //
//=============================================================================
void AM_minOutWindowScale () void AM_minOutWindowScale ()
{ {
scale_mtof = min_scale_mtof; scale_mtof = min_scale_mtof;
scale_ftom = MapDiv(MAPUNIT, scale_mtof); scale_ftom = MapDiv(MAPUNIT, scale_mtof);
} }
//=============================================================================
// //
// set the window scale to the minimum size // set the window scale to the minimum size
// //
//=============================================================================
void AM_maxOutWindowScale () void AM_maxOutWindowScale ()
{ {
scale_mtof = max_scale_mtof; scale_mtof = max_scale_mtof;
scale_ftom = MapDiv(MAPUNIT, scale_mtof); scale_ftom = MapDiv(MAPUNIT, scale_mtof);
} }
//=============================================================================
// //
// Called right after the resolution has changed // Called right after the resolution has changed
// //
//=============================================================================
void AM_NewResolution() void AM_NewResolution()
{ {
fixed_t oldmin = min_scale_mtof; fixed_t oldmin = min_scale_mtof;
@ -949,11 +1027,23 @@ void AM_NewResolution()
} }
//=============================================================================
//
//
//
//=============================================================================
CCMD (togglemap) CCMD (togglemap)
{ {
gameaction = ga_togglemap; gameaction = ga_togglemap;
} }
//=============================================================================
//
//
//
//=============================================================================
void AM_ToggleMap () void AM_ToggleMap ()
{ {
if (gamestate != GS_LEVEL) if (gamestate != GS_LEVEL)
@ -983,9 +1073,12 @@ void AM_ToggleMap ()
} }
} }
//=============================================================================
// //
// Handle events (user inputs) in automap mode // Handle events (user inputs) in automap mode
// //
//=============================================================================
bool AM_Responder (event_t *ev) bool AM_Responder (event_t *ev)
{ {
bool rc; bool rc;
@ -1110,9 +1203,12 @@ bool AM_Responder (event_t *ev)
} }
//=============================================================================
// //
// Zooming // Zooming
// //
//=============================================================================
void AM_changeWindowScale () void AM_changeWindowScale ()
{ {
// Change the scaling multipliers // Change the scaling multipliers
@ -1126,9 +1222,12 @@ void AM_changeWindowScale ()
} }
//=============================================================================
// //
// //
// //
//=============================================================================
void AM_doFollowPlayer () void AM_doFollowPlayer ()
{ {
fixed_t sx, sy; fixed_t sx, sy;
@ -1156,6 +1255,12 @@ void AM_doFollowPlayer ()
} }
} }
//=============================================================================
//
//
//
//=============================================================================
static void AM_ToggleFollowPlayer() static void AM_ToggleFollowPlayer()
{ {
followplayer = !followplayer; followplayer = !followplayer;
@ -1163,9 +1268,12 @@ static void AM_ToggleFollowPlayer()
Printf ("%s\n", GStrings(followplayer ? "AMSTR_FOLLOWON" : "AMSTR_FOLLOWOFF")); Printf ("%s\n", GStrings(followplayer ? "AMSTR_FOLLOWON" : "AMSTR_FOLLOWOFF"));
} }
//=============================================================================
// //
// Updates on Game Tick // Updates on Game Tick
// //
//=============================================================================
void AM_Ticker () void AM_Ticker ()
{ {
if (!automapactive) if (!automapactive)
@ -1186,9 +1294,12 @@ void AM_Ticker ()
} }
//=============================================================================
// //
// Clear automap frame buffer. // Clear automap frame buffer.
// //
//=============================================================================
void AM_clearFB (const AMColor &color) void AM_clearFB (const AMColor &color)
{ {
if (!mapback.isValid() || !am_drawmapback) if (!mapback.isValid() || !am_drawmapback)
@ -1217,6 +1328,7 @@ void AM_clearFB (const AMColor &color)
} }
//=============================================================================
// //
// Automap clipping of lines. // Automap clipping of lines.
// //
@ -1224,6 +1336,8 @@ void AM_clearFB (const AMColor &color)
// faster reject and precalculated slopes. If the speed is needed, // faster reject and precalculated slopes. If the speed is needed,
// use a hash algorithm to handle the common cases. // use a hash algorithm to handle the common cases.
// //
//=============================================================================
bool AM_clipMline (mline_t *ml, fline_t *fl) bool AM_clipMline (mline_t *ml, fline_t *fl)
{ {
enum { enum {
@ -1345,9 +1459,12 @@ bool AM_clipMline (mline_t *ml, fline_t *fl)
#undef DOOUTCODE #undef DOOUTCODE
//=============================================================================
// //
// Clip lines, draw visible parts of lines. // Clip lines, draw visible parts of lines.
// //
//=============================================================================
void AM_drawMline (mline_t *ml, const AMColor &color) void AM_drawMline (mline_t *ml, const AMColor &color)
{ {
fline_t fl; fline_t fl;
@ -1358,11 +1475,12 @@ void AM_drawMline (mline_t *ml, const AMColor &color)
} }
} }
//=============================================================================
// //
// Draws flat (floor/ceiling tile) aligned grid lines. // Draws flat (floor/ceiling tile) aligned grid lines.
// //
//=============================================================================
void AM_drawGrid (const AMColor &color) void AM_drawGrid (const AMColor &color)
{ {
fixed_t x, y; fixed_t x, y;
@ -1425,6 +1543,12 @@ void AM_drawGrid (const AMColor &color)
} }
} }
//=============================================================================
//
//
//
//=============================================================================
static bool AM_CheckSecret(line_t *line) static bool AM_CheckSecret(line_t *line)
{ {
if (line->frontsector != NULL) if (line->frontsector != NULL)
@ -1445,10 +1569,15 @@ static bool AM_CheckSecret(line_t *line)
} }
return false; return false;
} }
//=============================================================================
// //
// Determines visible lines, draws them. // Determines visible lines, draws them.
// This is LineDef based, not LineSeg based. // This is LineDef based, not LineSeg based.
// //
//=============================================================================
void AM_drawWalls (bool allmap) void AM_drawWalls (bool allmap)
{ {
int i; int i;
@ -1556,10 +1685,13 @@ void AM_drawWalls (bool allmap)
} }
//=============================================================================
// //
// Rotation in 2D. // Rotation in 2D.
// Used to rotate player arrow line character. // Used to rotate player arrow line character.
// //
//=============================================================================
void AM_rotate (fixed_t *x, fixed_t *y, angle_t a) void AM_rotate (fixed_t *x, fixed_t *y, angle_t a)
{ {
fixed_t tmpx; fixed_t tmpx;
@ -1570,6 +1702,12 @@ void AM_rotate (fixed_t *x, fixed_t *y, angle_t a)
*x = tmpx; *x = tmpx;
} }
//=============================================================================
//
//
//
//=============================================================================
void AM_rotatePoint (fixed_t *x, fixed_t *y) void AM_rotatePoint (fixed_t *x, fixed_t *y)
{ {
fixed_t pivotx = m_x + m_w/2; fixed_t pivotx = m_x + m_w/2;
@ -1581,6 +1719,12 @@ void AM_rotatePoint (fixed_t *x, fixed_t *y)
*y += pivoty; *y += pivoty;
} }
//=============================================================================
//
//
//
//=============================================================================
void void
AM_drawLineCharacter AM_drawLineCharacter
( const mline_t *lineguy, ( const mline_t *lineguy,
@ -1627,6 +1771,12 @@ AM_drawLineCharacter
} }
} }
//=============================================================================
//
//
//
//=============================================================================
void AM_drawPlayers () void AM_drawPlayers ()
{ {
mpoint_t pt; mpoint_t pt;
@ -1723,6 +1873,12 @@ void AM_drawPlayers ()
} }
} }
//=============================================================================
//
//
//
//=============================================================================
void AM_drawThings () void AM_drawThings ()
{ {
AMColor color; AMColor color;
@ -1777,6 +1933,12 @@ void AM_drawThings ()
} }
} }
//=============================================================================
//
//
//
//=============================================================================
static void DrawMarker (FTexture *tex, fixed_t x, fixed_t y, int yadjust, static void DrawMarker (FTexture *tex, fixed_t x, fixed_t y, int yadjust,
INTBOOL flip, fixed_t xscale, fixed_t yscale, int translation, fixed_t alpha, DWORD fillcolor, FRenderStyle renderstyle) INTBOOL flip, fixed_t xscale, fixed_t yscale, int translation, fixed_t alpha, DWORD fillcolor, FRenderStyle renderstyle)
{ {
@ -1803,6 +1965,12 @@ static void DrawMarker (FTexture *tex, fixed_t x, fixed_t y, int yadjust,
TAG_DONE); TAG_DONE);
} }
//=============================================================================
//
//
//
//=============================================================================
void AM_drawMarks () void AM_drawMarks ()
{ {
for (int i = 0; i < AM_NUMMARKPOINTS; i++) for (int i = 0; i < AM_NUMMARKPOINTS; i++)
@ -1815,6 +1983,12 @@ void AM_drawMarks ()
} }
} }
//=============================================================================
//
//
//
//=============================================================================
void AM_drawAuthorMarkers () void AM_drawAuthorMarkers ()
{ {
// [RH] Draw any actors derived from AMapMarker on the automap. // [RH] Draw any actors derived from AMapMarker on the automap.
@ -1876,11 +2050,23 @@ void AM_drawAuthorMarkers ()
} }
} }
//=============================================================================
//
//
//
//=============================================================================
void AM_drawCrosshair (const AMColor &color) void AM_drawCrosshair (const AMColor &color)
{ {
screen->DrawPixel(f_w/2, (f_h+1)/2, color.Index, color.RGB); screen->DrawPixel(f_w/2, (f_h+1)/2, color.Index, color.RGB);
} }
//=============================================================================
//
//
//
//=============================================================================
void AM_Drawer () void AM_Drawer ()
{ {
if (!automapactive) if (!automapactive)
@ -1928,6 +2114,12 @@ void AM_Drawer ()
AM_drawMarks(); AM_drawMarks();
} }
//=============================================================================
//
//
//
//=============================================================================
void AM_SerializeMarkers(FArchive &arc) void AM_SerializeMarkers(FArchive &arc)
{ {
arc << markpointnum; arc << markpointnum;

View file

@ -161,6 +161,12 @@ static bool PIT_FindFloorCeiling (line_t *ld, const FBoundingBox &box, FCheckPos
} }
//==========================================================================
//
//
//
//==========================================================================
void P_GetFloorCeilingZ(FCheckPosition &tmf, bool get) void P_GetFloorCeilingZ(FCheckPosition &tmf, bool get)
{ {
sector_t *sec; sector_t *sec;
@ -278,6 +284,7 @@ void P_FindFloorCeiling (AActor *actor, bool onlyspawnpos)
} }
} }
//==========================================================================
// //
// TELEPORT MOVE // TELEPORT MOVE
// //
@ -291,6 +298,9 @@ void P_FindFloorCeiling (AActor *actor, bool onlyspawnpos)
// move was made, so the height checking I added for 1.13 could // move was made, so the height checking I added for 1.13 could
// potentially erroneously indicate the move was okay if the thing // potentially erroneously indicate the move was okay if the thing
// was being teleported between two non-overlapping height ranges. // was being teleported between two non-overlapping height ranges.
//
//==========================================================================
bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefrag) bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefrag)
{ {
FCheckPosition tmf; FCheckPosition tmf;
@ -389,12 +399,15 @@ bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefr
return true; return true;
} }
//==========================================================================
// //
// [RH] P_PlayerStartStomp // [RH] P_PlayerStartStomp
// //
// Like P_TeleportMove, but it doesn't move anything, and only monsters and other // Like P_TeleportMove, but it doesn't move anything, and only monsters and other
// players get telefragged. // players get telefragged.
// //
//==========================================================================
void P_PlayerStartStomp (AActor *actor) void P_PlayerStartStomp (AActor *actor)
{ {
AActor *th; AActor *th;
@ -425,6 +438,12 @@ void P_PlayerStartStomp (AActor *actor)
} }
} }
//==========================================================================
//
//
//
//==========================================================================
inline fixed_t secfriction (const sector_t *sec) inline fixed_t secfriction (const sector_t *sec)
{ {
fixed_t friction = Terrains[TerrainTypes[sec->GetTexture(sector_t::floor)]].Friction; fixed_t friction = Terrains[TerrainTypes[sec->GetTexture(sector_t::floor)]].Friction;
@ -437,12 +456,15 @@ inline fixed_t secmovefac (const sector_t *sec)
return movefactor != 0 ? movefactor : sec->movefactor; return movefactor != 0 ? movefactor : sec->movefactor;
} }
//==========================================================================
// //
// killough 8/28/98: // killough 8/28/98:
// //
// P_GetFriction() // P_GetFriction()
// //
// Returns the friction associated with a particular mobj. // Returns the friction associated with a particular mobj.
//
//==========================================================================
int P_GetFriction (const AActor *mo, int *frictionfactor) int P_GetFriction (const AActor *mo, int *frictionfactor)
{ {
@ -511,11 +533,15 @@ int P_GetFriction (const AActor *mo, int *frictionfactor)
return friction; return friction;
} }
//==========================================================================
//
// phares 3/19/98 // phares 3/19/98
// P_GetMoveFactor() returns the value by which the x,y // P_GetMoveFactor() returns the value by which the x,y
// movements are multiplied to add to player movement. // movements are multiplied to add to player movement.
// //
// killough 8/28/98: rewritten // killough 8/28/98: rewritten
//
//==========================================================================
int P_GetMoveFactor (const AActor *mo, int *frictionp) int P_GetMoveFactor (const AActor *mo, int *frictionp)
{ {
@ -550,10 +576,14 @@ int P_GetMoveFactor (const AActor *mo, int *frictionp)
// MOVEMENT ITERATOR FUNCTIONS // MOVEMENT ITERATOR FUNCTIONS
// //
//==========================================================================
//
// //
// PIT_CheckLine // PIT_CheckLine
// Adjusts tmfloorz and tmceilingz as lines are contacted // Adjusts tmfloorz and tmceilingz as lines are contacted
// //
//
//==========================================================================
static // killough 3/26/98: make static static // killough 3/26/98: make static
bool PIT_CheckLine (line_t *ld, const FBoundingBox &box, FCheckPosition &tm) bool PIT_CheckLine (line_t *ld, const FBoundingBox &box, FCheckPosition &tm)
@ -1130,40 +1160,7 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
=============================================================================== ===============================================================================
*/ */
//---------------------------------------------------------------------------- //==========================================================================
//
// FUNC P_TestMobjLocation
//
// Returns true if the mobj is not blocked by anything at its current
// location, otherwise returns false.
//
//----------------------------------------------------------------------------
bool P_TestMobjLocation (AActor *mobj)
{
int flags;
flags = mobj->flags;
mobj->flags &= ~MF_PICKUP;
if (P_CheckPosition(mobj, mobj->x, mobj->y))
{ // XY is ok, now check Z
mobj->flags = flags;
fixed_t z = mobj->z;
if (mobj->flags2 & MF2_FLOATBOB)
{
z -= FloatBobOffsets[(mobj->FloatBobPhase + level.maptime - 1) & 63];
}
if ((z < mobj->floorz) || (z + mobj->height > mobj->ceilingz))
{ // Bad Z
return false;
}
return true;
}
mobj->flags = flags;
return false;
}
// //
// P_CheckPosition // P_CheckPosition
// This is purely informative, nothing is modified // This is purely informative, nothing is modified
@ -1187,6 +1184,9 @@ bool P_TestMobjLocation (AActor *mobj)
// numspeciallines // numspeciallines
// AActor *BlockingMobj = pointer to thing that blocked position (NULL if not // AActor *BlockingMobj = pointer to thing that blocked position (NULL if not
// blocked, or blocked by a line). // blocked, or blocked by a line).
//
//==========================================================================
bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm) bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm)
{ {
sector_t *newsec; sector_t *newsec;
@ -1373,6 +1373,40 @@ bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y)
return P_CheckPosition(thing, x, y, tm); return P_CheckPosition(thing, x, y, tm);
} }
//----------------------------------------------------------------------------
//
// FUNC P_TestMobjLocation
//
// Returns true if the mobj is not blocked by anything at its current
// location, otherwise returns false.
//
//----------------------------------------------------------------------------
bool P_TestMobjLocation (AActor *mobj)
{
int flags;
flags = mobj->flags;
mobj->flags &= ~MF_PICKUP;
if (P_CheckPosition(mobj, mobj->x, mobj->y))
{ // XY is ok, now check Z
mobj->flags = flags;
fixed_t z = mobj->z;
if (mobj->flags2 & MF2_FLOATBOB)
{
z -= FloatBobOffsets[(mobj->FloatBobPhase + level.maptime - 1) & 63];
}
if ((z < mobj->floorz) || (z + mobj->height > mobj->ceilingz))
{ // Bad Z
return false;
}
return true;
}
mobj->flags = flags;
return false;
}
//============================================================================= //=============================================================================
// //
// P_CheckOnmobj(AActor *thing) // P_CheckOnmobj(AActor *thing)
@ -1541,11 +1575,14 @@ static void CheckForPushSpecial (line_t *line, int side, AActor *mobj)
} }
} }
//==========================================================================
// //
// P_TryMove // P_TryMove
// Attempt to move to a new position, // Attempt to move to a new position,
// crossing special lines unless MF_TELEPORT is set. // crossing special lines unless MF_TELEPORT is set.
// //
//==========================================================================
bool P_TryMove (AActor *thing, fixed_t x, fixed_t y, bool P_TryMove (AActor *thing, fixed_t x, fixed_t y,
int dropoff, // killough 3/15/98: allow dropoff as option int dropoff, // killough 3/15/98: allow dropoff as option
const secplane_t *onfloor, // [RH] Let P_TryMove keep the thing on the floor const secplane_t *onfloor, // [RH] Let P_TryMove keep the thing on the floor
@ -1920,10 +1957,12 @@ bool P_TryMove (AActor *thing, fixed_t x, fixed_t y,
//==========================================================================
// //
// P_CheckMove // P_CheckMove
// Similar to P_TryMove but doesn't actually move the actor. Used for polyobject crushing // Similar to P_TryMove but doesn't actually move the actor. Used for polyobject crushing
// //
//==========================================================================
bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y) bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y)
{ {
@ -1999,10 +2038,13 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y)
//==========================================================================
// //
// SLIDE MOVE // SLIDE MOVE
// Allows the player to slide along any angled walls. // Allows the player to slide along any angled walls.
// //
//==========================================================================
struct FSlide struct FSlide
{ {
fixed_t bestslidefrac; fixed_t bestslidefrac;
@ -2025,12 +2067,15 @@ struct FSlide
bool BounceWall (AActor *mo); bool BounceWall (AActor *mo);
}; };
//==========================================================================
// //
// P_HitSlideLine // P_HitSlideLine
// Adjusts the xmove / ymove // Adjusts the xmove / ymove
// so that the next move will slide along the wall. // so that the next move will slide along the wall.
// If the floor is icy, then you can bounce off a wall. // phares // If the floor is icy, then you can bounce off a wall. // phares
// //
//==========================================================================
void FSlide::HitSlideLine (line_t* ld) void FSlide::HitSlideLine (line_t* ld)
{ {
int side; int side;
@ -2164,9 +2209,12 @@ void FSlide::HitSlideLine (line_t* ld)
} }
//==========================================================================
// //
// PTR_SlideTraverse // PTR_SlideTraverse
// //
//==========================================================================
void FSlide::SlideTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy) void FSlide::SlideTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy)
{ {
FLineOpening open; FLineOpening open;
@ -2255,6 +2303,7 @@ void FSlide::SlideTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_
//==========================================================================
// //
// P_SlideMove // P_SlideMove
// //
@ -2264,6 +2313,8 @@ void FSlide::SlideTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_
// //
// This is a kludgy mess. // This is a kludgy mess.
// //
//==========================================================================
void FSlide::SlideMove (AActor *mo, fixed_t tryx, fixed_t tryy, int numsteps) void FSlide::SlideMove (AActor *mo, fixed_t tryx, fixed_t tryy, int numsteps)
{ {
fixed_t leadx, leady; fixed_t leadx, leady;
@ -2691,6 +2742,12 @@ bool P_BounceWall (AActor *mo)
return slide.BounceWall(mo); return slide.BounceWall(mo);
} }
//==========================================================================
//
//
//
//==========================================================================
extern FRandom pr_bounce; extern FRandom pr_bounce;
bool P_BounceActor (AActor *mo, AActor * BlockingMobj) bool P_BounceActor (AActor *mo, AActor * BlockingMobj)
{ {
@ -3065,6 +3122,7 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
// P_AimLineAttack // P_AimLineAttack
// //
//============================================================================ //============================================================================
fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget, fixed_t vrange, bool forcenosmart, bool check3d, bool checknonshootable) fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget, fixed_t vrange, bool forcenosmart, bool check3d, bool checknonshootable)
{ {
fixed_t x2; fixed_t x2;
@ -3154,15 +3212,11 @@ fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **p
} }
/* //==========================================================================
================= //
= //
= P_LineAttack //
= //==========================================================================
= if damage == 0, it is just a test trace that will leave linetarget set
=
=================
*/
static bool CheckForGhost (FTraceResults &res) static bool CheckForGhost (FTraceResults &res)
{ {
@ -3198,6 +3252,14 @@ static bool CheckForSpectral (FTraceResults &res)
return false; return false;
} }
//==========================================================================
//
// P_LineAttack
//
// if damage == 0, it is just a test trace that will leave linetarget set
//
//==========================================================================
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
int pitch, int damage, FName damageType, const PClass *pufftype, bool ismeleeattack) int pitch, int damage, FName damageType, const PClass *pufftype, bool ismeleeattack)
{ {
@ -3231,7 +3293,8 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
t1->player->ReadyWeapon != NULL && t1->player->ReadyWeapon != NULL &&
(t1->player->ReadyWeapon->flags2 & MF2_THRUGHOST)); (t1->player->ReadyWeapon->flags2 & MF2_THRUGHOST));
AActor *puffDefaults = GetDefaultByType (pufftype); // Need to check defaults of replacement here
AActor *puffDefaults = GetDefaultByType(pufftype->ActorInfo->GetReplacement()->Class);
int tflags; int tflags;
if (puffDefaults != NULL && puffDefaults->flags6 & MF6_NOTRIGGER) tflags = TRACE_NoSky; if (puffDefaults != NULL && puffDefaults->flags6 & MF6_NOTRIGGER) tflags = TRACE_NoSky;
@ -3416,6 +3479,12 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
return NULL; return NULL;
} }
//==========================================================================
//
//
//
//==========================================================================
void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *actor, angle_t angle, int pitch) void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *actor, angle_t angle, int pitch)
{ {
if (!cl_bloodsplats) if (!cl_bloodsplats)
@ -3505,6 +3574,12 @@ void P_TraceBleed (int damage, AActor *target, angle_t angle, int pitch)
target, angle, pitch); target, angle, pitch);
} }
//==========================================================================
//
//
//
//==========================================================================
void P_TraceBleed (int damage, AActor *target, AActor *missile) void P_TraceBleed (int damage, AActor *target, AActor *missile)
{ {
int pitch; int pitch;
@ -3530,6 +3605,12 @@ void P_TraceBleed (int damage, AActor *target, AActor *missile)
pitch); pitch);
} }
//==========================================================================
//
//
//
//==========================================================================
void P_TraceBleed (int damage, AActor *target) void P_TraceBleed (int damage, AActor *target)
{ {
if (target != NULL) if (target != NULL)
@ -3542,9 +3623,12 @@ void P_TraceBleed (int damage, AActor *target)
} }
} }
//==========================================================================
// //
// [RH] Rail gun stuffage // [RH] Rail gun stuffage
// //
//==========================================================================
struct SRailHit struct SRailHit
{ {
AActor *HitActor; AActor *HitActor;
@ -3574,6 +3658,12 @@ static bool ProcessRailHit (FTraceResults &res)
return true; return true;
} }
//==========================================================================
//
//
//
//==========================================================================
static bool ProcessNoPierceRailHit (FTraceResults &res) static bool ProcessNoPierceRailHit (FTraceResults &res)
{ {
if (res.HitType != TRACE_HitActor) if (res.HitType != TRACE_HitActor)
@ -3596,6 +3686,12 @@ static bool ProcessNoPierceRailHit (FTraceResults &res)
return false; return false;
} }
//==========================================================================
//
//
//
//==========================================================================
void P_RailAttack (AActor *source, int damage, int offset, int color1, int color2, float maxdiff, bool silent, const PClass *puffclass, bool pierce) void P_RailAttack (AActor *source, int damage, int offset, int color1, int color2, float maxdiff, bool silent, const PClass *puffclass, bool pierce)
{ {
fixed_t vx, vy, vz; fixed_t vx, vy, vz;
@ -3639,7 +3735,8 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
int flags; int flags;
AActor *puffDefaults = puffclass == NULL? NULL : GetDefaultByType (puffclass); AActor *puffDefaults = puffclass == NULL?
NULL : GetDefaultByType (puffclass->ActorInfo->GetReplacement()->Class);
if (puffDefaults != NULL && puffDefaults->flags6 & MF6_NOTRIGGER) flags = 0; if (puffDefaults != NULL && puffDefaults->flags6 & MF6_NOTRIGGER) flags = 0;
else flags = TRACE_PCross|TRACE_Impact; else flags = TRACE_PCross|TRACE_Impact;
@ -3718,9 +3815,12 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
P_DrawRailTrail (source, start, end, color1, color2, maxdiff, silent); P_DrawRailTrail (source, start, end, color1, color2, maxdiff, silent);
} }
//==========================================================================
// //
// [RH] P_AimCamera // [RH] P_AimCamera
// //
//==========================================================================
CVAR (Float, chase_height, -8.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Float, chase_height, -8.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Float, chase_dist, 90.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Float, chase_dist, 90.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
@ -3758,9 +3858,11 @@ void P_AimCamera (AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &Camer
} }
//==========================================================================
// //
// USE LINES // USE LINES
// //
//==========================================================================
bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline) bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline)
{ {
@ -3885,6 +3987,8 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline
return false; return false;
} }
//==========================================================================
//
// Returns false if a "oof" sound should be made because of a blocking // Returns false if a "oof" sound should be made because of a blocking
// linedef. Makes 2s middles which are impassable, as well as 2s uppers // linedef. Makes 2s middles which are impassable, as well as 2s uppers
// and lowers which block the player, cause the sound effect when the // and lowers which block the player, cause the sound effect when the
@ -3894,6 +3998,7 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline
// //
// by Lee Killough // by Lee Killough
// //
//==========================================================================
bool P_NoWayTraverse (AActor *usething, fixed_t endx, fixed_t endy) bool P_NoWayTraverse (AActor *usething, fixed_t endx, fixed_t endy)
{ {
@ -3905,7 +4010,7 @@ bool P_NoWayTraverse (AActor *usething, fixed_t endx, fixed_t endy)
line_t *ld = in->d.line; line_t *ld = in->d.line;
FLineOpening open; FLineOpening open;
// [GrafZahl] de-obfuscated. Was I the only one who was unable to makes sense out of // [GrafZahl] de-obfuscated. Was I the only one who was unable to make sense out of
// this convoluted mess? // this convoluted mess?
if (ld->special) continue; if (ld->special) continue;
if (ld->flags&(ML_BLOCKING|ML_BLOCKEVERYTHING|ML_BLOCK_PLAYERS)) return true; if (ld->flags&(ML_BLOCKING|ML_BLOCKEVERYTHING|ML_BLOCK_PLAYERS)) return true;
@ -3918,14 +4023,13 @@ bool P_NoWayTraverse (AActor *usething, fixed_t endx, fixed_t endy)
return false; return false;
} }
/* //==========================================================================
================ //
= // P_UseLines
= P_UseLines //
= // Looks for special lines in front of the player to activate
= Looks for special lines in front of the player to activate //
================ //==========================================================================
*/
void P_UseLines (player_t *player) void P_UseLines (player_t *player)
{ {
@ -4028,9 +4132,13 @@ bool P_UsePuzzleItem (AActor *PuzzleItemUser, int PuzzleItemType)
return false; return false;
} }
//==========================================================================
// //
// RADIUS ATTACK // RADIUS ATTACK
// //
//
//==========================================================================
// [RH] Damage scale to apply to thing that shot the missile. // [RH] Damage scale to apply to thing that shot the missile.
static float selfthrustscale; static float selfthrustscale;
@ -4043,10 +4151,13 @@ CUSTOM_CVAR (Float, splashfactor, 1.f, CVAR_SERVERINFO)
selfthrustscale = 1.f / self; selfthrustscale = 1.f / self;
} }
//==========================================================================
// //
// P_RadiusAttack // P_RadiusAttack
// Source is the creature that caused the explosion at spot. // Source is the creature that caused the explosion at spot.
// //
//==========================================================================
void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int bombdistance, FName bombmod, void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int bombdistance, FName bombmod,
bool DamageSource, bool bombdodamage, int fulldamagedistance) bool DamageSource, bool bombdodamage, int fulldamagedistance)
{ {
@ -4222,6 +4333,7 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b
} }
} }
//==========================================================================
// //
// SECTOR HEIGHT CHANGING // SECTOR HEIGHT CHANGING
// After modifying a sector's floor or ceiling height, // After modifying a sector's floor or ceiling height,
@ -4240,6 +4352,8 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b
// DOOM crushing behavior set crushchange to 10 or -1 // DOOM crushing behavior set crushchange to 10 or -1
// if no crushing is desired. // if no crushing is desired.
// //
//==========================================================================
struct FChangePosition struct FChangePosition
{ {
@ -5131,6 +5245,12 @@ void P_CreateSecNodeList (AActor *thing, fixed_t x, fixed_t y)
} }
} }
//==========================================================================
//
//
//
//==========================================================================
void SpawnShootDecal (AActor *t1, const FTraceResults &trace) void SpawnShootDecal (AActor *t1, const FTraceResults &trace)
{ {
FDecalBase *decalbase = NULL; FDecalBase *decalbase = NULL;
@ -5150,6 +5270,12 @@ void SpawnShootDecal (AActor *t1, const FTraceResults &trace)
} }
} }
//==========================================================================
//
//
//
//==========================================================================
static void SpawnDeepSplash (AActor *t1, const FTraceResults &trace, AActor *puff, static void SpawnDeepSplash (AActor *t1, const FTraceResults &trace, AActor *puff,
fixed_t vx, fixed_t vy, fixed_t vz, fixed_t shootz) fixed_t vx, fixed_t vy, fixed_t vz, fixed_t shootz)
{ {