- Eliminated all use of global variables used as output for P_CheckPosition
and P_TryMove. Moved BlockingLine and BlockingMobj into AActor because the global variables can be easily overwritten with certain DECORATE constructs. SVN r894 (trunk)
This commit is contained in:
parent
f7a1fb3978
commit
894b663877
13 changed files with 320 additions and 325 deletions
|
|
@ -322,7 +322,9 @@ void AActor::Serialize (FArchive &arc)
|
|||
<< gravity
|
||||
<< FastChaseStrafeCount
|
||||
<< master
|
||||
<< smokecounter;
|
||||
<< smokecounter
|
||||
<< BlockingMobj
|
||||
<< BlockingLine;
|
||||
|
||||
if (arc.IsStoring ())
|
||||
{
|
||||
|
|
@ -1523,19 +1525,20 @@ void P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
|||
*/
|
||||
// [RH] If walking on a slope, stay on the slope
|
||||
// killough 3/15/98: Allow objects to drop off
|
||||
if (!P_TryMove (mo, ptryx, ptryy, true, walkplane))
|
||||
FCheckPosition tm;
|
||||
if (!P_TryMove (mo, ptryx, ptryy, true, walkplane, tm))
|
||||
{
|
||||
// blocked move
|
||||
|
||||
if ((mo->flags2 & (MF2_SLIDE|MF2_BLASTED) || bForceSlide) && !(mo->flags&MF_MISSILE))
|
||||
{
|
||||
// try to slide along it
|
||||
if (BlockingMobj == NULL)
|
||||
if (mo->BlockingMobj == NULL)
|
||||
{ // slide against wall
|
||||
if (BlockingLine != NULL &&
|
||||
if (mo->BlockingLine != NULL &&
|
||||
mo->player && mo->waterlevel && mo->waterlevel < 3 &&
|
||||
(mo->player->cmd.ucmd.forwardmove | mo->player->cmd.ucmd.sidemove) &&
|
||||
BlockingLine->sidenum[1] != NO_SIDE)
|
||||
mo->BlockingLine->sidenum[1] != NO_SIDE)
|
||||
{
|
||||
mo->momz = WATER_JUMP_SPEED;
|
||||
}
|
||||
|
|
@ -1603,6 +1606,7 @@ void P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
|||
}
|
||||
else if (mo->flags & MF_MISSILE)
|
||||
{
|
||||
AActor *BlockingMobj = mo->BlockingMobj;
|
||||
steps = 0;
|
||||
if (BlockingMobj)
|
||||
{
|
||||
|
|
@ -1681,10 +1685,10 @@ void P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
|||
}
|
||||
explode:
|
||||
// explode a missile
|
||||
if (ceilingline &&
|
||||
ceilingline->backsector &&
|
||||
ceilingline->backsector->ceilingpic == skyflatnum &&
|
||||
mo->z >= ceilingline->backsector->ceilingplane.ZatPoint (mo->x, mo->y) && //killough
|
||||
if (tm.ceilingline &&
|
||||
tm.ceilingline->backsector &&
|
||||
tm.ceilingline->backsector->ceilingpic == skyflatnum &&
|
||||
mo->z >= tm.ceilingline->backsector->ceilingplane.ZatPoint (mo->x, mo->y) && //killough
|
||||
!(mo->flags3 & MF3_SKYEXPLODE))
|
||||
{
|
||||
// Hack to prevent missiles exploding against the sky.
|
||||
|
|
@ -1694,13 +1698,13 @@ explode:
|
|||
return;
|
||||
}
|
||||
// [RH] Don't explode on horizon lines.
|
||||
if (BlockingLine != NULL && BlockingLine->special == Line_Horizon)
|
||||
if (mo->BlockingLine != NULL && mo->BlockingLine->special == Line_Horizon)
|
||||
{
|
||||
mo->Destroy ();
|
||||
DoRipping = false;
|
||||
return;
|
||||
}
|
||||
P_ExplodeMissile (mo, BlockingLine, BlockingMobj);
|
||||
P_ExplodeMissile (mo, mo->BlockingLine, BlockingMobj);
|
||||
DoRipping = false;
|
||||
return;
|
||||
}
|
||||
|
|
@ -4470,7 +4474,7 @@ bool P_CheckMissileSpawn (AActor* th)
|
|||
if (!P_TryMove (th, th->x, th->y, false))
|
||||
{
|
||||
// [RH] Don't explode ripping missiles that spawn inside something
|
||||
if (BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (BlockingMobj->flags5 & MF5_DONTRIP))
|
||||
if (th->BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (th->BlockingMobj->flags5 & MF5_DONTRIP))
|
||||
{
|
||||
// If this is a monster spawned by A_CustomMissile subtract it from the counter.
|
||||
if (th->CountsAsKill())
|
||||
|
|
@ -4479,13 +4483,13 @@ bool P_CheckMissileSpawn (AActor* th)
|
|||
level.total_monsters--;
|
||||
}
|
||||
// [RH] Don't explode missiles that spawn on top of horizon lines
|
||||
if (BlockingLine != NULL && BlockingLine->special == Line_Horizon)
|
||||
if (th->BlockingLine != NULL && th->BlockingLine->special == Line_Horizon)
|
||||
{
|
||||
th->Destroy ();
|
||||
}
|
||||
else
|
||||
{
|
||||
P_ExplodeMissile (th, NULL, BlockingMobj);
|
||||
P_ExplodeMissile (th, NULL, th->BlockingMobj);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue