mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 23:32:02 +00:00
Merge branch 'master' of c:\programming\doom-dev\zdoom
This commit is contained in:
commit
3f28478eb2
10 changed files with 283 additions and 322 deletions
|
@ -133,17 +133,17 @@ DMovingCeiling::DMovingCeiling (sector_t *sector)
|
||||||
interpolation = sector->SetInterpolation(sector_t::CeilingMove, true);
|
interpolation = sector->SetInterpolation(sector_t::CeilingMove, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DMover::MoveAttached(int crush, double move, int floorOrCeiling, bool resetfailed)
|
bool sector_t::MoveAttached(int crush, double move, int floorOrCeiling, bool resetfailed)
|
||||||
{
|
{
|
||||||
if (!P_Scroll3dMidtex(m_Sector, crush, move, !!floorOrCeiling) && resetfailed)
|
if (!P_Scroll3dMidtex(this, crush, move, !!floorOrCeiling) && resetfailed)
|
||||||
{
|
{
|
||||||
P_Scroll3dMidtex(m_Sector, crush, -move, !!floorOrCeiling);
|
P_Scroll3dMidtex(this, crush, -move, !!floorOrCeiling);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!P_MoveLinkedSectors(m_Sector, crush, move, !!floorOrCeiling) && resetfailed)
|
if (!P_MoveLinkedSectors(this, crush, move, !!floorOrCeiling) && resetfailed)
|
||||||
{
|
{
|
||||||
P_MoveLinkedSectors(m_Sector, crush, -move, !!floorOrCeiling);
|
P_MoveLinkedSectors(this, crush, -move, !!floorOrCeiling);
|
||||||
P_Scroll3dMidtex(m_Sector, crush, -move, !!floorOrCeiling);
|
P_Scroll3dMidtex(this, crush, -move, !!floorOrCeiling);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -155,8 +155,7 @@ bool DMover::MoveAttached(int crush, double move, int floorOrCeiling, bool reset
|
||||||
// (Use -1 to prevent it from trying to crush)
|
// (Use -1 to prevent it from trying to crush)
|
||||||
// dest is the desired d value for the plane
|
// dest is the desired d value for the plane
|
||||||
//
|
//
|
||||||
DMover::EResult DMover::MovePlane (double speed, double dest, int crush,
|
EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direction, bool hexencrush)
|
||||||
int floorOrCeiling, int direction, bool hexencrush)
|
|
||||||
{
|
{
|
||||||
bool flag;
|
bool flag;
|
||||||
double lastpos;
|
double lastpos;
|
||||||
|
@ -164,227 +163,228 @@ DMover::EResult DMover::MovePlane (double speed, double dest, int crush,
|
||||||
double move;
|
double move;
|
||||||
//double destheight; //jff 02/04/98 used to keep floors/ceilings
|
//double destheight; //jff 02/04/98 used to keep floors/ceilings
|
||||||
// from moving thru each other
|
// from moving thru each other
|
||||||
switch (floorOrCeiling)
|
lastpos = floorplane.fD();
|
||||||
|
switch (direction)
|
||||||
{
|
{
|
||||||
case 0:
|
case -1:
|
||||||
// FLOOR
|
// DOWN
|
||||||
lastpos = m_Sector->floorplane.fD();
|
movedest = floorplane.GetChangedHeight(-speed);
|
||||||
switch (direction)
|
if (movedest >= dest)
|
||||||
{
|
{
|
||||||
case -1:
|
move = floorplane.HeightDiff(lastpos, dest);
|
||||||
// DOWN
|
|
||||||
movedest = m_Sector->floorplane.GetChangedHeight (-speed);
|
if (!MoveAttached(crush, move, 0, true)) return EMoveResult::crushed;
|
||||||
if (movedest >= dest)
|
|
||||||
|
floorplane.setD(dest);
|
||||||
|
flag = P_ChangeSector(this, crush, move, 0, false);
|
||||||
|
if (flag)
|
||||||
{
|
{
|
||||||
move = m_Sector->floorplane.HeightDiff (lastpos, dest);
|
floorplane.setD(lastpos);
|
||||||
|
P_ChangeSector(this, crush, -move, 0, true);
|
||||||
if (!MoveAttached(crush, move, 0, true)) return crushed;
|
MoveAttached(crush, -move, 0, false);
|
||||||
|
|
||||||
m_Sector->floorplane.setD(dest);
|
|
||||||
flag = P_ChangeSector (m_Sector, crush, move, 0, false);
|
|
||||||
if (flag)
|
|
||||||
{
|
|
||||||
m_Sector->floorplane.setD(lastpos);
|
|
||||||
P_ChangeSector (m_Sector, crush, -move, 0, true);
|
|
||||||
MoveAttached(crush, -move, 0, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_Sector->ChangePlaneTexZ(sector_t::floor, move);
|
|
||||||
m_Sector->AdjustFloorClip ();
|
|
||||||
}
|
|
||||||
return pastdest;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!MoveAttached(crush, -speed, 0, true)) return crushed;
|
ChangePlaneTexZ(sector_t::floor, move);
|
||||||
|
AdjustFloorClip();
|
||||||
m_Sector->floorplane.setD(movedest);
|
|
||||||
|
|
||||||
flag = P_ChangeSector (m_Sector, crush, -speed, 0, false);
|
|
||||||
if (flag)
|
|
||||||
{
|
|
||||||
m_Sector->floorplane.setD(lastpos);
|
|
||||||
P_ChangeSector (m_Sector, crush, speed, 0, true);
|
|
||||||
MoveAttached(crush, speed, 0, false);
|
|
||||||
return crushed;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_Sector->ChangePlaneTexZ(sector_t::floor, m_Sector->floorplane.HeightDiff (lastpos));
|
|
||||||
m_Sector->AdjustFloorClip ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
return EMoveResult::pastdest;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!MoveAttached(crush, -speed, 0, true)) return EMoveResult::crushed;
|
||||||
|
|
||||||
case 1:
|
floorplane.setD(movedest);
|
||||||
// UP
|
|
||||||
// jff 02/04/98 keep floor from moving thru ceilings
|
flag = P_ChangeSector(this, crush, -speed, 0, false);
|
||||||
// [RH] not so easy with arbitrary planes
|
if (flag)
|
||||||
//destheight = (dest < m_Sector->ceilingheight) ? dest : m_Sector->ceilingheight;
|
|
||||||
if (!m_Sector->ceilingplane.isSlope() && !m_Sector->floorplane.isSlope() &&
|
|
||||||
(!(i_compatflags2 & COMPATF2_FLOORMOVE) && -dest > m_Sector->ceilingplane.fD()))
|
|
||||||
{
|
{
|
||||||
dest = -m_Sector->ceilingplane.fD();
|
floorplane.setD(lastpos);
|
||||||
}
|
P_ChangeSector(this, crush, speed, 0, true);
|
||||||
|
MoveAttached(crush, speed, 0, false);
|
||||||
movedest = m_Sector->floorplane.GetChangedHeight (speed);
|
return EMoveResult::crushed;
|
||||||
|
|
||||||
if (movedest <= dest)
|
|
||||||
{
|
|
||||||
move = m_Sector->floorplane.HeightDiff (lastpos, dest);
|
|
||||||
|
|
||||||
if (!MoveAttached(crush, move, 0, true)) return crushed;
|
|
||||||
|
|
||||||
m_Sector->floorplane.setD(dest);
|
|
||||||
|
|
||||||
flag = P_ChangeSector (m_Sector, crush, move, 0, false);
|
|
||||||
if (flag)
|
|
||||||
{
|
|
||||||
m_Sector->floorplane.setD(lastpos);
|
|
||||||
P_ChangeSector (m_Sector, crush, -move, 0, true);
|
|
||||||
MoveAttached(crush, -move, 0, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_Sector->ChangePlaneTexZ(sector_t::floor, move);
|
|
||||||
m_Sector->AdjustFloorClip ();
|
|
||||||
}
|
|
||||||
return pastdest;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!MoveAttached(crush, speed, 0, true)) return crushed;
|
ChangePlaneTexZ(sector_t::floor, floorplane.HeightDiff(lastpos));
|
||||||
|
AdjustFloorClip();
|
||||||
m_Sector->floorplane.setD(movedest);
|
|
||||||
|
|
||||||
// COULD GET CRUSHED
|
|
||||||
flag = P_ChangeSector (m_Sector, crush, speed, 0, false);
|
|
||||||
if (flag)
|
|
||||||
{
|
|
||||||
if (crush >= 0 && !hexencrush)
|
|
||||||
{
|
|
||||||
m_Sector->ChangePlaneTexZ(sector_t::floor, m_Sector->floorplane.HeightDiff (lastpos));
|
|
||||||
m_Sector->AdjustFloorClip ();
|
|
||||||
return crushed;
|
|
||||||
}
|
|
||||||
m_Sector->floorplane.setD(lastpos);
|
|
||||||
P_ChangeSector (m_Sector, crush, -speed, 0, true);
|
|
||||||
MoveAttached(crush, -speed, 0, false);
|
|
||||||
return crushed;
|
|
||||||
}
|
|
||||||
m_Sector->ChangePlaneTexZ(sector_t::floor, m_Sector->floorplane.HeightDiff (lastpos));
|
|
||||||
m_Sector->AdjustFloorClip ();
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
// CEILING
|
// UP
|
||||||
lastpos = m_Sector->ceilingplane.fD();
|
// jff 02/04/98 keep floor from moving thru ceilings
|
||||||
switch (direction)
|
// [RH] not so easy with arbitrary planes
|
||||||
|
//destheight = (dest < ceilingheight) ? dest : ceilingheight;
|
||||||
|
if (!ceilingplane.isSlope() && !floorplane.isSlope() &&
|
||||||
|
(!(i_compatflags2 & COMPATF2_FLOORMOVE) && -dest > ceilingplane.fD()))
|
||||||
{
|
{
|
||||||
case -1:
|
dest = -ceilingplane.fD();
|
||||||
// DOWN
|
}
|
||||||
// jff 02/04/98 keep ceiling from moving thru floors
|
|
||||||
// [RH] not so easy with arbitrary planes
|
movedest = floorplane.GetChangedHeight(speed);
|
||||||
//destheight = (dest > m_Sector->floorheight) ? dest : m_Sector->floorheight;
|
|
||||||
if (!m_Sector->ceilingplane.isSlope() && !m_Sector->floorplane.isSlope() &&
|
if (movedest <= dest)
|
||||||
(!(i_compatflags2 & COMPATF2_FLOORMOVE) && dest < -m_Sector->floorplane.fD()))
|
{
|
||||||
|
move = floorplane.HeightDiff(lastpos, dest);
|
||||||
|
|
||||||
|
if (!MoveAttached(crush, move, 0, true)) return EMoveResult::crushed;
|
||||||
|
|
||||||
|
floorplane.setD(dest);
|
||||||
|
|
||||||
|
flag = P_ChangeSector(this, crush, move, 0, false);
|
||||||
|
if (flag)
|
||||||
{
|
{
|
||||||
dest = -m_Sector->floorplane.fD();
|
floorplane.setD(lastpos);
|
||||||
}
|
P_ChangeSector(this, crush, -move, 0, true);
|
||||||
movedest = m_Sector->ceilingplane.GetChangedHeight (-speed);
|
MoveAttached(crush, -move, 0, false);
|
||||||
if (movedest <= dest)
|
|
||||||
{
|
|
||||||
move = m_Sector->ceilingplane.HeightDiff (lastpos, dest);
|
|
||||||
|
|
||||||
if (!MoveAttached(crush, move, 1, true)) return crushed;
|
|
||||||
|
|
||||||
m_Sector->ceilingplane.setD(dest);
|
|
||||||
flag = P_ChangeSector (m_Sector, crush, move, 1, false);
|
|
||||||
|
|
||||||
if (flag)
|
|
||||||
{
|
|
||||||
m_Sector->ceilingplane.setD(lastpos);
|
|
||||||
P_ChangeSector (m_Sector, crush, -move, 1, true);
|
|
||||||
MoveAttached(crush, -move, 1, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_Sector->ChangePlaneTexZ(sector_t::ceiling, move);
|
|
||||||
}
|
|
||||||
return pastdest;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!MoveAttached(crush, -speed, 1, true)) return crushed;
|
ChangePlaneTexZ(sector_t::floor, move);
|
||||||
|
AdjustFloorClip();
|
||||||
m_Sector->ceilingplane.setD(movedest);
|
|
||||||
|
|
||||||
// COULD GET CRUSHED
|
|
||||||
flag = P_ChangeSector (m_Sector, crush, -speed, 1, false);
|
|
||||||
if (flag)
|
|
||||||
{
|
|
||||||
if (crush >= 0 && !hexencrush)
|
|
||||||
{
|
|
||||||
m_Sector->ChangePlaneTexZ(sector_t::ceiling, m_Sector->ceilingplane.HeightDiff (lastpos));
|
|
||||||
return crushed;
|
|
||||||
}
|
|
||||||
m_Sector->ceilingplane.setD(lastpos);
|
|
||||||
P_ChangeSector (m_Sector, crush, speed, 1, true);
|
|
||||||
MoveAttached(crush, speed, 1, false);
|
|
||||||
return crushed;
|
|
||||||
}
|
|
||||||
m_Sector->ChangePlaneTexZ(sector_t::ceiling, m_Sector->ceilingplane.HeightDiff (lastpos));
|
|
||||||
}
|
}
|
||||||
break;
|
return EMoveResult::pastdest;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!MoveAttached(crush, speed, 0, true)) return EMoveResult::crushed;
|
||||||
|
|
||||||
case 1:
|
floorplane.setD(movedest);
|
||||||
// UP
|
|
||||||
movedest = m_Sector->ceilingplane.GetChangedHeight (speed);
|
// COULD GET CRUSHED
|
||||||
if (movedest >= dest)
|
flag = P_ChangeSector(this, crush, speed, 0, false);
|
||||||
|
if (flag)
|
||||||
{
|
{
|
||||||
move = m_Sector->ceilingplane.HeightDiff (lastpos, dest);
|
if (crush >= 0 && !hexencrush)
|
||||||
|
|
||||||
if (!MoveAttached(crush, move, 1, true)) return crushed;
|
|
||||||
|
|
||||||
m_Sector->ceilingplane.setD(dest);
|
|
||||||
|
|
||||||
flag = P_ChangeSector (m_Sector, crush, move, 1, false);
|
|
||||||
if (flag)
|
|
||||||
{
|
{
|
||||||
m_Sector->ceilingplane.setD(lastpos);
|
ChangePlaneTexZ(sector_t::floor, floorplane.HeightDiff(lastpos));
|
||||||
P_ChangeSector (m_Sector, crush, move, 1, true);
|
AdjustFloorClip();
|
||||||
MoveAttached(crush, move, 1, false);
|
return EMoveResult::crushed;
|
||||||
}
|
}
|
||||||
else
|
floorplane.setD(lastpos);
|
||||||
{
|
P_ChangeSector(this, crush, -speed, 0, true);
|
||||||
m_Sector->ChangePlaneTexZ(sector_t::ceiling, move);
|
MoveAttached(crush, -speed, 0, false);
|
||||||
}
|
return EMoveResult::crushed;
|
||||||
return pastdest;
|
|
||||||
}
|
}
|
||||||
else
|
ChangePlaneTexZ(sector_t::floor, floorplane.HeightDiff(lastpos));
|
||||||
{
|
AdjustFloorClip();
|
||||||
if (!MoveAttached(crush, speed, 1, true)) return crushed;
|
|
||||||
|
|
||||||
m_Sector->ceilingplane.setD(movedest);
|
|
||||||
|
|
||||||
flag = P_ChangeSector (m_Sector, crush, speed, 1, false);
|
|
||||||
if (flag)
|
|
||||||
{
|
|
||||||
m_Sector->ceilingplane.setD(lastpos);
|
|
||||||
P_ChangeSector (m_Sector, crush, -speed, 1, true);
|
|
||||||
MoveAttached(crush, -speed, 1, false);
|
|
||||||
return crushed;
|
|
||||||
}
|
|
||||||
m_Sector->ChangePlaneTexZ(sector_t::ceiling, m_Sector->ceilingplane.HeightDiff (lastpos));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return ok;
|
return EMoveResult::ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
EMoveResult sector_t::MoveCeiling(double speed, double dest, int crush, int direction, bool hexencrush)
|
||||||
|
{
|
||||||
|
bool flag;
|
||||||
|
double lastpos;
|
||||||
|
double movedest;
|
||||||
|
double move;
|
||||||
|
//double destheight; //jff 02/04/98 used to keep floors/ceilings
|
||||||
|
// from moving thru each other
|
||||||
|
|
||||||
|
lastpos = ceilingplane.fD();
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
case -1:
|
||||||
|
// DOWN
|
||||||
|
// jff 02/04/98 keep ceiling from moving thru floors
|
||||||
|
// [RH] not so easy with arbitrary planes
|
||||||
|
//destheight = (dest > floorheight) ? dest : floorheight;
|
||||||
|
if (!ceilingplane.isSlope() && !floorplane.isSlope() &&
|
||||||
|
(!(i_compatflags2 & COMPATF2_FLOORMOVE) && dest < -floorplane.fD()))
|
||||||
|
{
|
||||||
|
dest = -floorplane.fD();
|
||||||
|
}
|
||||||
|
movedest = ceilingplane.GetChangedHeight (-speed);
|
||||||
|
if (movedest <= dest)
|
||||||
|
{
|
||||||
|
move = ceilingplane.HeightDiff (lastpos, dest);
|
||||||
|
|
||||||
|
if (!MoveAttached(crush, move, 1, true)) return EMoveResult::crushed;
|
||||||
|
|
||||||
|
ceilingplane.setD(dest);
|
||||||
|
flag = P_ChangeSector (this, crush, move, 1, false);
|
||||||
|
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
ceilingplane.setD(lastpos);
|
||||||
|
P_ChangeSector (this, crush, -move, 1, true);
|
||||||
|
MoveAttached(crush, -move, 1, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChangePlaneTexZ(sector_t::ceiling, move);
|
||||||
|
}
|
||||||
|
return EMoveResult::pastdest;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!MoveAttached(crush, -speed, 1, true)) return EMoveResult::crushed;
|
||||||
|
|
||||||
|
ceilingplane.setD(movedest);
|
||||||
|
|
||||||
|
// COULD GET CRUSHED
|
||||||
|
flag = P_ChangeSector (this, crush, -speed, 1, false);
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
if (crush >= 0 && !hexencrush)
|
||||||
|
{
|
||||||
|
ChangePlaneTexZ(sector_t::ceiling, ceilingplane.HeightDiff (lastpos));
|
||||||
|
return EMoveResult::crushed;
|
||||||
|
}
|
||||||
|
ceilingplane.setD(lastpos);
|
||||||
|
P_ChangeSector (this, crush, speed, 1, true);
|
||||||
|
MoveAttached(crush, speed, 1, false);
|
||||||
|
return EMoveResult::crushed;
|
||||||
|
}
|
||||||
|
ChangePlaneTexZ(sector_t::ceiling, ceilingplane.HeightDiff (lastpos));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
// UP
|
||||||
|
movedest = ceilingplane.GetChangedHeight (speed);
|
||||||
|
if (movedest >= dest)
|
||||||
|
{
|
||||||
|
move = ceilingplane.HeightDiff (lastpos, dest);
|
||||||
|
|
||||||
|
if (!MoveAttached(crush, move, 1, true)) return EMoveResult::crushed;
|
||||||
|
|
||||||
|
ceilingplane.setD(dest);
|
||||||
|
|
||||||
|
flag = P_ChangeSector (this, crush, move, 1, false);
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
ceilingplane.setD(lastpos);
|
||||||
|
P_ChangeSector (this, crush, move, 1, true);
|
||||||
|
MoveAttached(crush, move, 1, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChangePlaneTexZ(sector_t::ceiling, move);
|
||||||
|
}
|
||||||
|
return EMoveResult::pastdest;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!MoveAttached(crush, speed, 1, true)) return EMoveResult::crushed;
|
||||||
|
|
||||||
|
ceilingplane.setD(movedest);
|
||||||
|
|
||||||
|
flag = P_ChangeSector (this, crush, speed, 1, false);
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
ceilingplane.setD(lastpos);
|
||||||
|
P_ChangeSector (this, crush, -speed, 1, true);
|
||||||
|
MoveAttached(crush, -speed, 1, false);
|
||||||
|
return EMoveResult::crushed;
|
||||||
|
}
|
||||||
|
ChangePlaneTexZ(sector_t::ceiling, ceilingplane.HeightDiff (lastpos));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return EMoveResult::ok;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,32 +27,13 @@ class DMover : public DSectorEffect
|
||||||
public:
|
public:
|
||||||
DMover (sector_t *sector);
|
DMover (sector_t *sector);
|
||||||
protected:
|
protected:
|
||||||
enum EResult { ok, crushed, pastdest };
|
|
||||||
TObjPtr<DInterpolation> interpolation;
|
TObjPtr<DInterpolation> interpolation;
|
||||||
private:
|
private:
|
||||||
bool MoveAttached(int crush, double move, int floorOrCeiling, bool resetfailed);
|
|
||||||
EResult MovePlane (double speed, double dest, int crush, int floorOrCeiling, int direction, bool hexencrush);
|
|
||||||
protected:
|
protected:
|
||||||
DMover ();
|
DMover ();
|
||||||
void Serialize (FArchive &arc);
|
void Serialize (FArchive &arc);
|
||||||
void Destroy();
|
void Destroy();
|
||||||
void StopInterpolation(bool force = false);
|
void StopInterpolation(bool force = false);
|
||||||
inline EResult MoveFloor (double speed, double dest, int crush, int direction, bool hexencrush)
|
|
||||||
{
|
|
||||||
return MovePlane (speed, dest, crush, 0, direction, hexencrush);
|
|
||||||
}
|
|
||||||
inline EResult MoveFloor (double speed, double dest, int direction)
|
|
||||||
{
|
|
||||||
return MovePlane (speed, dest, -1, 0, direction, false);
|
|
||||||
}
|
|
||||||
inline EResult MoveCeiling (double speed, double dest, int crush, int direction, bool hexencrush)
|
|
||||||
{
|
|
||||||
return MovePlane (speed, dest, crush, 1, direction, hexencrush);
|
|
||||||
}
|
|
||||||
inline EResult MoveCeiling (double speed, double dest, int direction)
|
|
||||||
{
|
|
||||||
return MovePlane (speed, dest, -1, 1, direction, false);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DMovingFloor : public DMover
|
class DMovingFloor : public DMover
|
||||||
|
|
|
@ -1535,26 +1535,6 @@ void FParser::SF_StartSectorSound(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/************* Sector functions ***************/
|
|
||||||
|
|
||||||
class DFloorChanger : public DFloor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DFloorChanger(sector_t * sec)
|
|
||||||
: DFloor(sec) {}
|
|
||||||
|
|
||||||
bool Move(double speed, double dest, int crush, int direction)
|
|
||||||
{
|
|
||||||
bool res = DMover::crushed != MoveFloor(speed, dest, crush, direction, false);
|
|
||||||
Destroy();
|
|
||||||
m_Sector->floordata=NULL;
|
|
||||||
StopInterpolation(true);
|
|
||||||
m_Sector=NULL;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -1588,12 +1568,12 @@ void FParser::SF_FloorHeight(void)
|
||||||
{
|
{
|
||||||
if (sectors[i].floordata) continue; // don't move floors that are active!
|
if (sectors[i].floordata) continue; // don't move floors that are active!
|
||||||
|
|
||||||
DFloorChanger * f = new DFloorChanger(§ors[i]);
|
if (sectors[i].MoveFloor(
|
||||||
if (!f->Move(
|
|
||||||
fabs(dest - sectors[i].CenterFloor()),
|
fabs(dest - sectors[i].CenterFloor()),
|
||||||
sectors[i].floorplane.PointToDist (sectors[i].centerspot, dest),
|
sectors[i].floorplane.PointToDist (sectors[i].centerspot, dest),
|
||||||
crush? 10:-1,
|
crush? 10:-1,
|
||||||
(dest > sectors[i].CenterFloor()) ? 1 : -1))
|
(dest > sectors[i].CenterFloor()) ? 1 : -1,
|
||||||
|
false) != EMoveResult::crushed)
|
||||||
{
|
{
|
||||||
returnval = 0;
|
returnval = 0;
|
||||||
}
|
}
|
||||||
|
@ -1686,29 +1666,6 @@ void FParser::SF_MoveFloor(void)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
class DCeilingChanger : public DCeiling
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DCeilingChanger(sector_t * sec)
|
|
||||||
: DCeiling(sec) {}
|
|
||||||
|
|
||||||
bool Move(double speed, double dest, int crush, int direction)
|
|
||||||
{
|
|
||||||
bool res = DMover::crushed != MoveCeiling(speed, dest, crush, direction, false);
|
|
||||||
Destroy();
|
|
||||||
m_Sector->ceilingdata=NULL;
|
|
||||||
StopInterpolation (true);
|
|
||||||
m_Sector=NULL;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
// ceiling height of sector
|
// ceiling height of sector
|
||||||
void FParser::SF_CeilingHeight(void)
|
void FParser::SF_CeilingHeight(void)
|
||||||
{
|
{
|
||||||
|
@ -1735,12 +1692,12 @@ void FParser::SF_CeilingHeight(void)
|
||||||
{
|
{
|
||||||
if (sectors[i].ceilingdata) continue; // don't move ceilings that are active!
|
if (sectors[i].ceilingdata) continue; // don't move ceilings that are active!
|
||||||
|
|
||||||
DCeilingChanger * c = new DCeilingChanger(§ors[i]);
|
if (sectors[i].MoveCeiling(
|
||||||
if (!c->Move(
|
|
||||||
fabs(dest - sectors[i].CenterCeiling()),
|
fabs(dest - sectors[i].CenterCeiling()),
|
||||||
sectors[i].ceilingplane.PointToDist (sectors[i].centerspot, dest),
|
sectors[i].ceilingplane.PointToDist (sectors[i].centerspot, dest),
|
||||||
crush? 10:-1,
|
crush? 10:-1,
|
||||||
(dest > sectors[i].CenterCeiling()) ? 1 : -1))
|
(dest > sectors[i].CenterCeiling()) ? 1 : -1,
|
||||||
|
false) != EMoveResult::crushed)
|
||||||
{
|
{
|
||||||
returnval = 0;
|
returnval = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,11 @@ static FRandom pr_fpatk ("FPunchAttack");
|
||||||
|
|
||||||
void AdjustPlayerAngle (AActor *pmo, FTranslatedLineTarget *t)
|
void AdjustPlayerAngle (AActor *pmo, FTranslatedLineTarget *t)
|
||||||
{
|
{
|
||||||
DAngle difference = deltaangle(pmo->Angles.Yaw, pmo->AngleTo(t->linetarget));
|
// normally this will adjust relative to the actual direction to the target,
|
||||||
|
// but with arbitrary portals that cannot be calculated so using the actual
|
||||||
|
// attack angle is the only option.
|
||||||
|
DAngle atkangle = t->unlinked ? t->angleFromSource : pmo->AngleTo(t->linetarget);
|
||||||
|
DAngle difference = deltaangle(pmo->Angles.Yaw, atkangle);
|
||||||
if (fabs(difference) > MAX_ANGLE_ADJUST)
|
if (fabs(difference) > MAX_ANGLE_ADJUST)
|
||||||
{
|
{
|
||||||
if (difference > 0)
|
if (difference > 0)
|
||||||
|
|
|
@ -127,7 +127,7 @@ void DCeiling::PlayCeilingSound ()
|
||||||
|
|
||||||
void DCeiling::Tick ()
|
void DCeiling::Tick ()
|
||||||
{
|
{
|
||||||
EResult res;
|
EMoveResult res;
|
||||||
|
|
||||||
switch (m_Direction)
|
switch (m_Direction)
|
||||||
{
|
{
|
||||||
|
@ -136,9 +136,9 @@ void DCeiling::Tick ()
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// UP
|
// UP
|
||||||
res = MoveCeiling (m_Speed, m_TopHeight, m_Direction);
|
res = m_Sector->MoveCeiling (m_Speed, m_TopHeight, m_Direction);
|
||||||
|
|
||||||
if (res == pastdest)
|
if (res == EMoveResult::pastdest)
|
||||||
{
|
{
|
||||||
switch (m_Type)
|
switch (m_Type)
|
||||||
{
|
{
|
||||||
|
@ -167,9 +167,9 @@ void DCeiling::Tick ()
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
// DOWN
|
// DOWN
|
||||||
res = MoveCeiling (m_Speed, m_BottomHeight, m_Crush, m_Direction, m_CrushMode == ECrushMode::crushHexen);
|
res = m_Sector->MoveCeiling (m_Speed, m_BottomHeight, m_Crush, m_Direction, m_CrushMode == ECrushMode::crushHexen);
|
||||||
|
|
||||||
if (res == pastdest)
|
if (res == EMoveResult::pastdest)
|
||||||
{
|
{
|
||||||
switch (m_Type)
|
switch (m_Type)
|
||||||
{
|
{
|
||||||
|
@ -198,7 +198,7 @@ void DCeiling::Tick ()
|
||||||
}
|
}
|
||||||
else // ( res != pastdest )
|
else // ( res != pastdest )
|
||||||
{
|
{
|
||||||
if (res == crushed)
|
if (res == EMoveResult::crushed)
|
||||||
{
|
{
|
||||||
switch (m_Type)
|
switch (m_Type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,7 +80,7 @@ void DDoor::Serialize (FArchive &arc)
|
||||||
|
|
||||||
void DDoor::Tick ()
|
void DDoor::Tick ()
|
||||||
{
|
{
|
||||||
EResult res;
|
EMoveResult res;
|
||||||
|
|
||||||
// Adjust bottom height - but only if there isn't an active lift attached to the floor.
|
// Adjust bottom height - but only if there isn't an active lift attached to the floor.
|
||||||
if (m_Sector->floorplane.fD() != m_OldFloorDist)
|
if (m_Sector->floorplane.fD() != m_OldFloorDist)
|
||||||
|
@ -137,7 +137,7 @@ void DDoor::Tick ()
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
// DOWN
|
// DOWN
|
||||||
res = MoveCeiling (m_Speed, m_BotDist, -1, m_Direction, false);
|
res = m_Sector->MoveCeiling (m_Speed, m_BotDist, -1, m_Direction, false);
|
||||||
|
|
||||||
// killough 10/98: implement gradual lighting effects
|
// killough 10/98: implement gradual lighting effects
|
||||||
if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.fD())
|
if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.fD())
|
||||||
|
@ -146,7 +146,7 @@ void DDoor::Tick ()
|
||||||
(m_Sector->ceilingplane.fD() + m_Sector->floorplane.fD()) / (m_TopDist + m_Sector->floorplane.fD()));
|
(m_Sector->ceilingplane.fD() + m_Sector->floorplane.fD()) / (m_TopDist + m_Sector->floorplane.fD()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res == pastdest)
|
if (res == EMoveResult::pastdest)
|
||||||
{
|
{
|
||||||
SN_StopSequence (m_Sector, CHAN_CEILING);
|
SN_StopSequence (m_Sector, CHAN_CEILING);
|
||||||
switch (m_Type)
|
switch (m_Type)
|
||||||
|
@ -166,7 +166,7 @@ void DDoor::Tick ()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (res == crushed)
|
else if (res == EMoveResult::crushed)
|
||||||
{
|
{
|
||||||
switch (m_Type)
|
switch (m_Type)
|
||||||
{
|
{
|
||||||
|
@ -183,7 +183,7 @@ void DDoor::Tick ()
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
// UP
|
// UP
|
||||||
res = MoveCeiling (m_Speed, m_TopDist, -1, m_Direction, false);
|
res = m_Sector->MoveCeiling (m_Speed, m_TopDist, -1, m_Direction, false);
|
||||||
|
|
||||||
// killough 10/98: implement gradual lighting effects
|
// killough 10/98: implement gradual lighting effects
|
||||||
if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.fD())
|
if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.fD())
|
||||||
|
@ -192,7 +192,7 @@ void DDoor::Tick ()
|
||||||
(m_Sector->ceilingplane.fD() + m_Sector->floorplane.fD()) / (m_TopDist + m_Sector->floorplane.fD()));
|
(m_Sector->ceilingplane.fD() + m_Sector->floorplane.fD()) / (m_TopDist + m_Sector->floorplane.fD()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res == pastdest)
|
if (res == EMoveResult::pastdest)
|
||||||
{
|
{
|
||||||
SN_StopSequence (m_Sector, CHAN_CEILING);
|
SN_StopSequence (m_Sector, CHAN_CEILING);
|
||||||
switch (m_Type)
|
switch (m_Type)
|
||||||
|
@ -212,7 +212,7 @@ void DDoor::Tick ()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (res == crushed)
|
else if (res == EMoveResult::crushed)
|
||||||
{
|
{
|
||||||
switch (m_Type)
|
switch (m_Type)
|
||||||
{
|
{
|
||||||
|
@ -560,12 +560,12 @@ bool DAnimatedDoor::StartClosing ()
|
||||||
}
|
}
|
||||||
|
|
||||||
double topdist = m_Sector->ceilingplane.fD();
|
double topdist = m_Sector->ceilingplane.fD();
|
||||||
if (MoveCeiling (2048., m_BotDist, 0, -1, false) == crushed)
|
if (m_Sector->MoveCeiling (2048., m_BotDist, 0, -1, false) == EMoveResult::crushed)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveCeiling (2048., topdist, 1);
|
m_Sector->MoveCeiling (2048., topdist, 1);
|
||||||
|
|
||||||
m_Line1->flags |= ML_BLOCKING;
|
m_Line1->flags |= ML_BLOCKING;
|
||||||
m_Line2->flags |= ML_BLOCKING;
|
m_Line2->flags |= ML_BLOCKING;
|
||||||
|
@ -650,7 +650,7 @@ void DAnimatedDoor::Tick ()
|
||||||
if (--m_Frame < 0)
|
if (--m_Frame < 0)
|
||||||
{
|
{
|
||||||
// IF DOOR IS DONE CLOSING...
|
// IF DOOR IS DONE CLOSING...
|
||||||
MoveCeiling (2048., m_BotDist, -1);
|
m_Sector->MoveCeiling (2048., m_BotDist, -1);
|
||||||
m_Sector->ceilingdata = NULL;
|
m_Sector->ceilingdata = NULL;
|
||||||
Destroy ();
|
Destroy ();
|
||||||
// Unset blocking flags on lines that didn't start with them. Since the
|
// Unset blocking flags on lines that didn't start with them. Since the
|
||||||
|
@ -734,7 +734,7 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay,
|
||||||
m_Line1->flags |= ML_BLOCKING;
|
m_Line1->flags |= ML_BLOCKING;
|
||||||
m_Line2->flags |= ML_BLOCKING;
|
m_Line2->flags |= ML_BLOCKING;
|
||||||
m_BotDist = m_Sector->ceilingplane.fD();
|
m_BotDist = m_Sector->ceilingplane.fD();
|
||||||
MoveCeiling (2048., topdist, 1);
|
m_Sector->MoveCeiling (2048., topdist, 1);
|
||||||
if (m_DoorAnim->OpenSound != NAME_None)
|
if (m_DoorAnim->OpenSound != NAME_None)
|
||||||
{
|
{
|
||||||
SN_StartSequence (m_Sector, CHAN_INTERIOR, m_DoorAnim->OpenSound, 1);
|
SN_StartSequence (m_Sector, CHAN_INTERIOR, m_DoorAnim->OpenSound, 1);
|
||||||
|
|
|
@ -112,7 +112,7 @@ void DFloor::Serialize (FArchive &arc)
|
||||||
|
|
||||||
void DFloor::Tick ()
|
void DFloor::Tick ()
|
||||||
{
|
{
|
||||||
EResult res;
|
EMoveResult res;
|
||||||
|
|
||||||
// [RH] Handle resetting stairs
|
// [RH] Handle resetting stairs
|
||||||
if (m_Type == buildStair || m_Type == waitStair)
|
if (m_Type == buildStair || m_Type == waitStair)
|
||||||
|
@ -144,9 +144,9 @@ void DFloor::Tick ()
|
||||||
if (m_Type == waitStair)
|
if (m_Type == waitStair)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
res = MoveFloor (m_Speed, m_FloorDestDist, m_Crush, m_Direction, m_Hexencrush);
|
res = m_Sector->MoveFloor (m_Speed, m_FloorDestDist, m_Crush, m_Direction, m_Hexencrush);
|
||||||
|
|
||||||
if (res == pastdest)
|
if (res == EMoveResult::pastdest)
|
||||||
{
|
{
|
||||||
SN_StopSequence (m_Sector, CHAN_FLOOR);
|
SN_StopSequence (m_Sector, CHAN_FLOOR);
|
||||||
|
|
||||||
|
@ -898,7 +898,7 @@ void DElevator::Destroy()
|
||||||
|
|
||||||
void DElevator::Tick ()
|
void DElevator::Tick ()
|
||||||
{
|
{
|
||||||
EResult res;
|
EMoveResult res;
|
||||||
|
|
||||||
double oldfloor, oldceiling;
|
double oldfloor, oldceiling;
|
||||||
|
|
||||||
|
@ -907,30 +907,30 @@ void DElevator::Tick ()
|
||||||
|
|
||||||
if (m_Direction < 0) // moving down
|
if (m_Direction < 0) // moving down
|
||||||
{
|
{
|
||||||
res = MoveFloor (m_Speed, m_FloorDestDist, m_Direction);
|
res = m_Sector->MoveFloor (m_Speed, m_FloorDestDist, m_Direction);
|
||||||
if (res == ok || res == pastdest)
|
if (res == EMoveResult::ok || res == EMoveResult::pastdest)
|
||||||
{
|
{
|
||||||
res = MoveCeiling (m_Speed, m_CeilingDestDist, m_Direction);
|
res = m_Sector->MoveCeiling (m_Speed, m_CeilingDestDist, m_Direction);
|
||||||
if (res == crushed)
|
if (res == EMoveResult::crushed)
|
||||||
{
|
{
|
||||||
MoveFloor (m_Speed, oldfloor, -m_Direction);
|
m_Sector->MoveFloor (m_Speed, oldfloor, -m_Direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // up
|
else // up
|
||||||
{
|
{
|
||||||
res = MoveCeiling (m_Speed, m_CeilingDestDist, m_Direction);
|
res = m_Sector->MoveCeiling (m_Speed, m_CeilingDestDist, m_Direction);
|
||||||
if (res == ok || res == pastdest)
|
if (res == EMoveResult::ok || res == EMoveResult::pastdest)
|
||||||
{
|
{
|
||||||
res = MoveFloor (m_Speed, m_FloorDestDist, m_Direction);
|
res = m_Sector->MoveFloor (m_Speed, m_FloorDestDist, m_Direction);
|
||||||
if (res == crushed)
|
if (res == EMoveResult::crushed)
|
||||||
{
|
{
|
||||||
MoveCeiling (m_Speed, oldceiling, -m_Direction);
|
m_Sector->MoveCeiling (m_Speed, oldceiling, -m_Direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res == pastdest) // if destination height acheived
|
if (res == EMoveResult::pastdest) // if destination height acheived
|
||||||
{
|
{
|
||||||
// make floor stop sound
|
// make floor stop sound
|
||||||
SN_StopSequence (m_Sector, CHAN_FLOOR);
|
SN_StopSequence (m_Sector, CHAN_FLOOR);
|
||||||
|
|
|
@ -88,7 +88,7 @@ void DPillar::Serialize (FArchive &arc)
|
||||||
|
|
||||||
void DPillar::Tick ()
|
void DPillar::Tick ()
|
||||||
{
|
{
|
||||||
int r, s;
|
EMoveResult r, s;
|
||||||
double oldfloor, oldceiling;
|
double oldfloor, oldceiling;
|
||||||
|
|
||||||
oldfloor = m_Sector->floorplane.fD();
|
oldfloor = m_Sector->floorplane.fD();
|
||||||
|
@ -96,29 +96,29 @@ void DPillar::Tick ()
|
||||||
|
|
||||||
if (m_Type == pillarBuild)
|
if (m_Type == pillarBuild)
|
||||||
{
|
{
|
||||||
r = MoveFloor (m_FloorSpeed, m_FloorTarget, m_Crush, 1, m_Hexencrush);
|
r = m_Sector->MoveFloor (m_FloorSpeed, m_FloorTarget, m_Crush, 1, m_Hexencrush);
|
||||||
s = MoveCeiling (m_CeilingSpeed, m_CeilingTarget, m_Crush, -1, m_Hexencrush);
|
s = m_Sector->MoveCeiling (m_CeilingSpeed, m_CeilingTarget, m_Crush, -1, m_Hexencrush);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r = MoveFloor (m_FloorSpeed, m_FloorTarget, m_Crush, -1, m_Hexencrush);
|
r = m_Sector->MoveFloor (m_FloorSpeed, m_FloorTarget, m_Crush, -1, m_Hexencrush);
|
||||||
s = MoveCeiling (m_CeilingSpeed, m_CeilingTarget, m_Crush, 1, m_Hexencrush);
|
s = m_Sector->MoveCeiling (m_CeilingSpeed, m_CeilingTarget, m_Crush, 1, m_Hexencrush);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r == pastdest && s == pastdest)
|
if (r == EMoveResult::pastdest && s == EMoveResult::pastdest)
|
||||||
{
|
{
|
||||||
SN_StopSequence (m_Sector, CHAN_FLOOR);
|
SN_StopSequence (m_Sector, CHAN_FLOOR);
|
||||||
Destroy ();
|
Destroy ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (r == crushed)
|
if (r == EMoveResult::crushed)
|
||||||
{
|
{
|
||||||
MoveFloor (m_FloorSpeed, oldfloor, -1, -1, m_Hexencrush);
|
m_Sector->MoveFloor (m_FloorSpeed, oldfloor, -1, -1, m_Hexencrush);
|
||||||
}
|
}
|
||||||
if (s == crushed)
|
if (s == EMoveResult::crushed)
|
||||||
{
|
{
|
||||||
MoveCeiling (m_CeilingSpeed, oldceiling, -1, 1, m_Hexencrush);
|
m_Sector->MoveCeiling (m_CeilingSpeed, oldceiling, -1, 1, m_Hexencrush);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,20 +94,20 @@ void DPlat::PlayPlatSound (const char *sound)
|
||||||
//
|
//
|
||||||
void DPlat::Tick ()
|
void DPlat::Tick ()
|
||||||
{
|
{
|
||||||
EResult res;
|
EMoveResult res;
|
||||||
|
|
||||||
switch (m_Status)
|
switch (m_Status)
|
||||||
{
|
{
|
||||||
case up:
|
case up:
|
||||||
res = MoveFloor (m_Speed, m_High, m_Crush, 1, false);
|
res = m_Sector->MoveFloor (m_Speed, m_High, m_Crush, 1, false);
|
||||||
|
|
||||||
if (res == crushed && (m_Crush == -1))
|
if (res == EMoveResult::crushed && (m_Crush == -1))
|
||||||
{
|
{
|
||||||
m_Count = m_Wait;
|
m_Count = m_Wait;
|
||||||
m_Status = down;
|
m_Status = down;
|
||||||
PlayPlatSound ("Platform");
|
PlayPlatSound ("Platform");
|
||||||
}
|
}
|
||||||
else if (res == pastdest)
|
else if (res == EMoveResult::pastdest)
|
||||||
{
|
{
|
||||||
SN_StopSequence (m_Sector, CHAN_FLOOR);
|
SN_StopSequence (m_Sector, CHAN_FLOOR);
|
||||||
if (m_Type != platToggle)
|
if (m_Type != platToggle)
|
||||||
|
@ -144,9 +144,9 @@ void DPlat::Tick ()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case down:
|
case down:
|
||||||
res = MoveFloor (m_Speed, m_Low, -1, -1, false);
|
res = m_Sector->MoveFloor (m_Speed, m_Low, -1, -1, false);
|
||||||
|
|
||||||
if (res == pastdest)
|
if (res == EMoveResult::pastdest)
|
||||||
{
|
{
|
||||||
SN_StopSequence (m_Sector, CHAN_FLOOR);
|
SN_StopSequence (m_Sector, CHAN_FLOOR);
|
||||||
// if not an instant toggle, start waiting
|
// if not an instant toggle, start waiting
|
||||||
|
@ -172,7 +172,7 @@ void DPlat::Tick ()
|
||||||
m_Status = in_stasis; //for reactivation of toggle
|
m_Status = in_stasis; //for reactivation of toggle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (res == crushed && m_Crush < 0 && m_Type != platToggle)
|
else if (res == EMoveResult::crushed && m_Crush < 0 && m_Type != platToggle)
|
||||||
{
|
{
|
||||||
m_Status = up;
|
m_Status = up;
|
||||||
m_Count = m_Wait;
|
m_Count = m_Wait;
|
||||||
|
|
19
src/r_defs.h
19
src/r_defs.h
|
@ -648,9 +648,28 @@ struct secspecial_t
|
||||||
|
|
||||||
FArchive &operator<< (FArchive &arc, secspecial_t &p);
|
FArchive &operator<< (FArchive &arc, secspecial_t &p);
|
||||||
|
|
||||||
|
enum class EMoveResult { ok, crushed, pastdest };
|
||||||
|
|
||||||
struct sector_t
|
struct sector_t
|
||||||
{
|
{
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool MoveAttached(int crush, double move, int floorOrCeiling, bool resetfailed);
|
||||||
|
public:
|
||||||
|
EMoveResult MoveFloor(double speed, double dest, int crush, int direction, bool hexencrush);
|
||||||
|
EMoveResult MoveCeiling(double speed, double dest, int crush, int direction, bool hexencrush);
|
||||||
|
|
||||||
|
inline EMoveResult MoveFloor(double speed, double dest, int direction)
|
||||||
|
{
|
||||||
|
return MoveFloor(speed, dest, -1, direction, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline EMoveResult MoveCeiling(double speed, double dest, int direction)
|
||||||
|
{
|
||||||
|
return MoveCeiling(speed, dest, -1, direction, false);
|
||||||
|
}
|
||||||
|
|
||||||
bool IsLinked(sector_t *other, bool ceiling) const;
|
bool IsLinked(sector_t *other, bool ceiling) const;
|
||||||
double FindLowestFloorSurrounding(vertex_t **v) const;
|
double FindLowestFloorSurrounding(vertex_t **v) const;
|
||||||
double FindHighestFloorSurrounding(vertex_t **v) const;
|
double FindHighestFloorSurrounding(vertex_t **v) const;
|
||||||
|
|
Loading…
Reference in a new issue