- 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:
parent
caae61de4c
commit
bc7e159be0
5 changed files with 261 additions and 292 deletions
|
|
@ -142,7 +142,7 @@ void DCeiling::Tick ()
|
|||
{
|
||||
switch (m_Type)
|
||||
{
|
||||
case ceilCrushAndRaise:
|
||||
case DCeiling::ceilCrushAndRaise:
|
||||
m_Direction = -1;
|
||||
m_Speed = m_Speed1;
|
||||
if (!SN_IsMakingLoopingSound (m_Sector))
|
||||
|
|
@ -173,8 +173,8 @@ void DCeiling::Tick ()
|
|||
{
|
||||
switch (m_Type)
|
||||
{
|
||||
case ceilCrushAndRaise:
|
||||
case ceilCrushRaiseAndStay:
|
||||
case DCeiling::ceilCrushAndRaise:
|
||||
case DCeiling::ceilCrushRaiseAndStay:
|
||||
m_Speed = m_Speed2;
|
||||
m_Direction = 1;
|
||||
if (!SN_IsMakingLoopingSound (m_Sector))
|
||||
|
|
@ -202,8 +202,8 @@ void DCeiling::Tick ()
|
|||
{
|
||||
switch (m_Type)
|
||||
{
|
||||
case ceilCrushAndRaise:
|
||||
case ceilLowerAndCrush:
|
||||
case DCeiling::ceilCrushAndRaise:
|
||||
case DCeiling::ceilLowerAndCrush:
|
||||
if (m_CrushMode == ECrushMode::crushSlowdown)
|
||||
m_Speed = 1. / 8;
|
||||
break;
|
||||
|
|
@ -244,9 +244,9 @@ DCeiling::DCeiling (sector_t *sec, double speed1, double speed2, int silent)
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag,
|
||||
bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag,
|
||||
double speed, double speed2, double height,
|
||||
int crush, int silent, int change, ECrushMode hexencrush)
|
||||
int crush, int silent, int change, DCeiling::ECrushMode hexencrush)
|
||||
{
|
||||
double targheight = 0; // Silence, GCC
|
||||
|
||||
|
|
@ -262,35 +262,35 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
|
|||
|
||||
switch (type)
|
||||
{
|
||||
case ceilCrushAndRaise:
|
||||
case ceilCrushRaiseAndStay:
|
||||
case DCeiling::ceilCrushAndRaise:
|
||||
case DCeiling::ceilCrushRaiseAndStay:
|
||||
ceiling->m_TopHeight = sec->ceilingplane.fD();
|
||||
case ceilLowerAndCrush:
|
||||
case DCeiling::ceilLowerAndCrush:
|
||||
targheight = sec->FindHighestFloorPoint (&spot);
|
||||
targheight += height;
|
||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = -1;
|
||||
break;
|
||||
|
||||
case ceilRaiseToHighest:
|
||||
case DCeiling::ceilRaiseToHighest:
|
||||
targheight = sec->FindHighestCeilingSurrounding (&spot);
|
||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = 1;
|
||||
break;
|
||||
|
||||
case ceilLowerByValue:
|
||||
case DCeiling::ceilLowerByValue:
|
||||
targheight = sec->ceilingplane.ZatPoint (spot) - height;
|
||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = -1;
|
||||
break;
|
||||
|
||||
case ceilRaiseByValue:
|
||||
case DCeiling::ceilRaiseByValue:
|
||||
targheight = sec->ceilingplane.ZatPoint (spot) + height;
|
||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = 1;
|
||||
break;
|
||||
|
||||
case ceilMoveToValue:
|
||||
case DCeiling::ceilMoveToValue:
|
||||
{
|
||||
double diff = height - sec->ceilingplane.ZatPoint (spot);
|
||||
|
||||
|
|
@ -308,81 +308,81 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
|
|||
}
|
||||
break;
|
||||
|
||||
case ceilLowerToHighestFloor:
|
||||
case DCeiling::ceilLowerToHighestFloor:
|
||||
targheight = sec->FindHighestFloorSurrounding (&spot);
|
||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = -1;
|
||||
break;
|
||||
|
||||
case ceilRaiseToHighestFloor:
|
||||
case DCeiling::ceilRaiseToHighestFloor:
|
||||
targheight = sec->FindHighestFloorSurrounding (&spot);
|
||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = 1;
|
||||
break;
|
||||
|
||||
case ceilLowerInstant:
|
||||
case DCeiling::ceilLowerInstant:
|
||||
targheight = sec->ceilingplane.ZatPoint (spot) - height;
|
||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = -1;
|
||||
ceiling->m_Speed = height;
|
||||
break;
|
||||
|
||||
case ceilRaiseInstant:
|
||||
case DCeiling::ceilRaiseInstant:
|
||||
targheight = sec->ceilingplane.ZatPoint (spot) + height;
|
||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = 1;
|
||||
ceiling->m_Speed = height;
|
||||
break;
|
||||
|
||||
case ceilLowerToNearest:
|
||||
case DCeiling::ceilLowerToNearest:
|
||||
targheight = sec->FindNextLowestCeiling (&spot);
|
||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = -1;
|
||||
break;
|
||||
|
||||
case ceilRaiseToNearest:
|
||||
case DCeiling::ceilRaiseToNearest:
|
||||
targheight = sec->FindNextHighestCeiling (&spot);
|
||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = 1;
|
||||
break;
|
||||
|
||||
case ceilLowerToLowest:
|
||||
case DCeiling::ceilLowerToLowest:
|
||||
targheight = sec->FindLowestCeilingSurrounding (&spot);
|
||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = -1;
|
||||
break;
|
||||
|
||||
case ceilRaiseToLowest:
|
||||
case DCeiling::ceilRaiseToLowest:
|
||||
targheight = sec->FindLowestCeilingSurrounding (&spot);
|
||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = 1;
|
||||
break;
|
||||
|
||||
case ceilLowerToFloor:
|
||||
case DCeiling::ceilLowerToFloor:
|
||||
targheight = sec->FindHighestFloorPoint (&spot);
|
||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = -1;
|
||||
break;
|
||||
|
||||
case ceilRaiseToFloor: // [RH] What's this for?
|
||||
case DCeiling::ceilRaiseToFloor: // [RH] What's this for?
|
||||
targheight = sec->FindHighestFloorPoint (&spot);
|
||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = 1;
|
||||
break;
|
||||
|
||||
case ceilLowerToHighest:
|
||||
case DCeiling::ceilLowerToHighest:
|
||||
targheight = sec->FindHighestCeilingSurrounding (&spot);
|
||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = -1;
|
||||
break;
|
||||
|
||||
case ceilLowerByTexture:
|
||||
case DCeiling::ceilLowerByTexture:
|
||||
targheight = sec->ceilingplane.ZatPoint (spot) - sec->FindShortestUpperAround ();
|
||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = -1;
|
||||
break;
|
||||
|
||||
case ceilRaiseByTexture:
|
||||
case DCeiling::ceilRaiseByTexture:
|
||||
targheight = sec->ceilingplane.ZatPoint (spot) + sec->FindShortestUpperAround ();
|
||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||
ceiling->m_Direction = 1;
|
||||
|
|
@ -426,9 +426,9 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
|
|||
//jff 5/23/98 find model with floor at target height if target
|
||||
//is a floor type
|
||||
modelsec = (/*type == ceilRaiseToHighest ||*/
|
||||
type == ceilRaiseToFloor ||
|
||||
type == DCeiling::ceilRaiseToFloor ||
|
||||
/*type == ceilLowerToHighest ||*/
|
||||
type == ceilLowerToFloor) ?
|
||||
type == DCeiling::ceilLowerToFloor) ?
|
||||
sec->FindModelFloorSector (targheight) :
|
||||
sec->FindModelCeilingSector (targheight);
|
||||
if (modelsec != NULL)
|
||||
|
|
@ -438,14 +438,14 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
|
|||
{
|
||||
case 1: // type is zeroed
|
||||
ceiling->m_NewSpecial.Clear();
|
||||
ceiling->m_Type = genCeilingChg0;
|
||||
ceiling->m_Type = DCeiling::genCeilingChg0;
|
||||
break;
|
||||
case 2: // type is copied
|
||||
sec->GetSpecial(&ceiling->m_NewSpecial);
|
||||
ceiling->m_Type = genCeilingChgT;
|
||||
ceiling->m_Type = DCeiling::genCeilingChgT;
|
||||
break;
|
||||
case 3: // type is left alone
|
||||
ceiling->m_Type = genCeilingChg;
|
||||
ceiling->m_Type = DCeiling::genCeilingChg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -457,21 +457,21 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
|
|||
{
|
||||
case 1: // type is zeroed
|
||||
ceiling->m_NewSpecial.Clear();
|
||||
ceiling->m_Type = genCeilingChg0;
|
||||
ceiling->m_Type = DCeiling::genCeilingChg0;
|
||||
break;
|
||||
case 2: // type is copied
|
||||
line->frontsector->GetSpecial(&ceiling->m_NewSpecial);
|
||||
ceiling->m_Type = genCeilingChgT;
|
||||
ceiling->m_Type = DCeiling::genCeilingChgT;
|
||||
break;
|
||||
case 3: // type is left alone
|
||||
ceiling->m_Type = genCeilingChg;
|
||||
ceiling->m_Type = DCeiling::genCeilingChg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ceiling->PlayCeilingSound ();
|
||||
return ceiling;
|
||||
return ceiling != NULL;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
@ -502,7 +502,7 @@ bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line,
|
|||
// [RH] Hack to let manual crushers be retriggerable, too
|
||||
tag ^= secnum | 0x1000000;
|
||||
P_ActivateInStasisCeiling (tag);
|
||||
return !!DCeiling::Create(sec, type, line, tag, speed, speed2, height, crush, silent, change, hexencrush);
|
||||
return P_CreateCeiling(sec, type, line, tag, speed, speed2, height, crush, silent, change, hexencrush);
|
||||
}
|
||||
|
||||
// Reactivate in-stasis ceilings...for certain types.
|
||||
|
|
@ -516,7 +516,7 @@ bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line,
|
|||
FSectorTagIterator it(tag);
|
||||
while ((secnum = it.Next()) >= 0)
|
||||
{
|
||||
rtn |= !!DCeiling::Create(§ors[secnum], type, line, tag, speed, speed2, height, crush, silent, change, hexencrush);
|
||||
rtn |= P_CreateCeiling(§ors[secnum], type, line, tag, speed, speed2, height, crush, silent, change, hexencrush);
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue