- cleaned up ceiling creation and moved the Create function out of the DCeiling class.

- did the same for floors so that FraggleScript no longer needs access to the thinkers themselves.
This commit is contained in:
Christoph Oelckers 2016-04-09 12:07:34 +02:00
commit bc7e159be0
5 changed files with 261 additions and 292 deletions

View file

@ -1596,35 +1596,6 @@ void FParser::SF_FloorHeight(void)
}
//=============================================================================
//
//
//=============================================================================
class DMoveFloor : public DFloor
{
public:
DMoveFloor(sector_t * sec,double moveheight,int _m_Direction,int crush,double movespeed)
: DFloor(sec)
{
m_Type = floorRaiseByValue;
m_Crush = crush;
m_Speed=movespeed;
m_Direction = _m_Direction;
m_FloorDestDist = moveheight;
// Do not interpolate instant movement floors.
double movedist = fabs(-sec->floorplane.fD() - moveheight);
if (m_Speed >= movedist)
{
StopInterpolation(true);
}
StartFloorSound();
}
};
//==========================================================================
//
//
@ -1634,7 +1605,6 @@ public:
void FParser::SF_MoveFloor(void)
{
int secnum = -1;
sector_t *sec;
int tagnum, crush;
double platspeed = 1, destheight;
@ -1650,12 +1620,7 @@ void FParser::SF_MoveFloor(void)
FSSectorTagIterator itr(tagnum);
while ((secnum = itr.Next()) >= 0)
{
sec = &sectors[secnum];
// Don't start a second thinker on the same floor
if (sec->floordata) continue;
new DMoveFloor(sec, sec->floorplane.PointToDist(sec->centerspot, destheight),
destheight < sec->CenterFloor() ? -1 : 1, crush, platspeed);
P_CreateFloor(&sectors[secnum], DFloor::floorMoveToValue, NULL, platspeed, destheight, crush, 0, false, false);
}
}
}
@ -1729,7 +1694,6 @@ void FParser::SF_CeilingHeight(void)
void FParser::SF_MoveCeiling(void)
{
int secnum = -1;
sector_t *sec;
int tagnum;
double platspeed = 1, destheight;
int crush;
@ -1747,11 +1711,7 @@ void FParser::SF_MoveCeiling(void)
FSSectorTagIterator itr(tagnum);
while ((secnum = itr.Next()) >= 0)
{
sec = &sectors[secnum];
// Don't start a second thinker on the same floor
if (sec->ceilingdata) continue;
DCeiling::Create(sec, DCeiling::ceilMoveToValue, NULL, tagnum, platspeed, platspeed, destheight, crush, silent | 4, 0, DCeiling::ECrushMode::crushDoom);
P_CreateCeiling(&sectors[secnum], DCeiling::ceilMoveToValue, NULL, tagnum, platspeed, platspeed, destheight, crush, silent | 4, 0, DCeiling::ECrushMode::crushDoom);
}
}
}