- split DSectorEffect::MovePlane into MoveFloor and MoveCeiling.

What was the point of this strange setup anyway? MoveFloor and MoveCeiling were inlines calling the universal MovePlane, which had nothing better to do than a switch/case with two cases - floor and ceiling!
This commit is contained in:
Christoph Oelckers 2016-04-08 13:39:08 +02:00
parent 74c9a7bf67
commit fb2234396c
2 changed files with 205 additions and 209 deletions

View file

@ -155,8 +155,7 @@ bool DMover::MoveAttached(int crush, double move, int floorOrCeiling, bool reset
// (Use -1 to prevent it from trying to crush)
// dest is the desired d value for the plane
//
DMover::EResult DMover::MovePlane (double speed, double dest, int crush,
int floorOrCeiling, int direction, bool hexencrush)
DMover::EResult DMover::MoveFloor(double speed, double dest, int crush, int direction, bool hexencrush)
{
bool flag;
double lastpos;
@ -164,10 +163,6 @@ DMover::EResult DMover::MovePlane (double speed, double dest, int crush,
double move;
//double destheight; //jff 02/04/98 used to keep floors/ceilings
// from moving thru each other
switch (floorOrCeiling)
{
case 0:
// FLOOR
lastpos = m_Sector->floorplane.fD();
switch (direction)
{
@ -278,10 +273,18 @@ DMover::EResult DMover::MovePlane (double speed, double dest, int crush,
}
break;
}
break;
return ok;
}
DMover::EResult DMover::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
case 1:
// CEILING
lastpos = m_Sector->ceilingplane.fD();
switch (direction)
{
@ -383,8 +386,5 @@ DMover::EResult DMover::MovePlane (double speed, double dest, int crush,
}
break;
}
break;
}
return ok;
}

View file

@ -31,28 +31,24 @@ protected:
TObjPtr<DInterpolation> interpolation;
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:
DMover ();
void Serialize (FArchive &arc);
void Destroy();
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);
}
EResult MoveFloor(double speed, double dest, int crush, int direction, bool hexencrush);
EResult MoveCeiling(double speed, double dest, int crush, int direction, bool 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);
return MoveFloor(speed, dest, -1, direction, false);
}
inline EResult MoveCeiling(double speed, double dest, int direction)
{
return MovePlane (speed, dest, -1, 1, direction, false);
return MoveCeiling(speed, dest, -1, direction, false);
}
};
class DMovingFloor : public DMover