mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-14 08:30:50 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
c502a4b3cc
16 changed files with 412 additions and 422 deletions
|
@ -26,6 +26,7 @@ class DMover : public DSectorEffect
|
||||||
HAS_OBJECT_POINTERS
|
HAS_OBJECT_POINTERS
|
||||||
public:
|
public:
|
||||||
DMover (sector_t *sector);
|
DMover (sector_t *sector);
|
||||||
|
void StopInterpolation(bool force = false);
|
||||||
protected:
|
protected:
|
||||||
TObjPtr<DInterpolation> interpolation;
|
TObjPtr<DInterpolation> interpolation;
|
||||||
private:
|
private:
|
||||||
|
@ -33,7 +34,6 @@ protected:
|
||||||
DMover ();
|
DMover ();
|
||||||
void Serialize (FArchive &arc);
|
void Serialize (FArchive &arc);
|
||||||
void Destroy();
|
void Destroy();
|
||||||
void StopInterpolation(bool force = false);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DMovingFloor : public DMover
|
class DMovingFloor : public DMover
|
||||||
|
|
|
@ -859,8 +859,8 @@ void FArchive::WriteString(const FString &str)
|
||||||
{
|
{
|
||||||
// The count includes the '\0' terminator, but we don't
|
// The count includes the '\0' terminator, but we don't
|
||||||
// actually write it out.
|
// actually write it out.
|
||||||
WriteCount(str.Len() + 1);
|
WriteCount(DWORD(str.Len() + 1));
|
||||||
Write(str, str.Len());
|
Write(str, DWORD(str.Len()));
|
||||||
}
|
}
|
||||||
|
|
||||||
FArchive &FArchive::operator<< (char *&str)
|
FArchive &FArchive::operator<< (char *&str)
|
||||||
|
|
|
@ -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)
|
void FParser::SF_MoveFloor(void)
|
||||||
{
|
{
|
||||||
int secnum = -1;
|
int secnum = -1;
|
||||||
sector_t *sec;
|
|
||||||
int tagnum, crush;
|
int tagnum, crush;
|
||||||
double platspeed = 1, destheight;
|
double platspeed = 1, destheight;
|
||||||
|
|
||||||
|
@ -1650,12 +1620,7 @@ void FParser::SF_MoveFloor(void)
|
||||||
FSSectorTagIterator itr(tagnum);
|
FSSectorTagIterator itr(tagnum);
|
||||||
while ((secnum = itr.Next()) >= 0)
|
while ((secnum = itr.Next()) >= 0)
|
||||||
{
|
{
|
||||||
sec = §ors[secnum];
|
P_CreateFloor(§ors[secnum], DFloor::floorMoveToValue, NULL, platspeed, destheight, crush, 0, false, false);
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1720,39 +1685,6 @@ void FParser::SF_CeilingHeight(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
class DMoveCeiling : public DCeiling
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
DMoveCeiling(sector_t * sec,int tag,double destheight,double speed,int silent,int crush)
|
|
||||||
: DCeiling(sec)
|
|
||||||
{
|
|
||||||
m_Crush = crush;
|
|
||||||
m_Speed2 = m_Speed = m_Speed1 = speed;
|
|
||||||
m_Silent = silent;
|
|
||||||
m_Type = DCeiling::ceilLowerByValue; // doesn't really matter as long as it's no special value
|
|
||||||
m_Tag=tag;
|
|
||||||
m_TopHeight=m_BottomHeight=sec->ceilingplane.PointToDist(sec->centerspot,destheight);
|
|
||||||
m_Direction=destheight>sec->GetPlaneTexZF(sector_t::ceiling)? 1:-1;
|
|
||||||
|
|
||||||
// Do not interpolate instant movement ceilings.
|
|
||||||
double movedist = fabs(sec->ceilingplane.fD() - m_BottomHeight);
|
|
||||||
if (m_Speed >= movedist)
|
|
||||||
{
|
|
||||||
StopInterpolation (true);
|
|
||||||
m_Silent=2;
|
|
||||||
}
|
|
||||||
PlayCeilingSound();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -1762,7 +1694,6 @@ public:
|
||||||
void FParser::SF_MoveCeiling(void)
|
void FParser::SF_MoveCeiling(void)
|
||||||
{
|
{
|
||||||
int secnum = -1;
|
int secnum = -1;
|
||||||
sector_t *sec;
|
|
||||||
int tagnum;
|
int tagnum;
|
||||||
double platspeed = 1, destheight;
|
double platspeed = 1, destheight;
|
||||||
int crush;
|
int crush;
|
||||||
|
@ -1780,11 +1711,7 @@ void FParser::SF_MoveCeiling(void)
|
||||||
FSSectorTagIterator itr(tagnum);
|
FSSectorTagIterator itr(tagnum);
|
||||||
while ((secnum = itr.Next()) >= 0)
|
while ((secnum = itr.Next()) >= 0)
|
||||||
{
|
{
|
||||||
sec = §ors[secnum];
|
P_CreateCeiling(§ors[secnum], DCeiling::ceilMoveToValue, NULL, tagnum, platspeed, platspeed, destheight, crush, silent | 4, 0, DCeiling::ECrushMode::crushDoom);
|
||||||
|
|
||||||
// Don't start a second thinker on the same floor
|
|
||||||
if (sec->ceilingdata) continue;
|
|
||||||
new DMoveCeiling(sec, tagnum, destheight, platspeed, silent, crush);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ struct svalue_t
|
||||||
|
|
||||||
void setDouble(double dp)
|
void setDouble(double dp)
|
||||||
{
|
{
|
||||||
value.f = fsfix(dp/65536);
|
value.f = fsfix(dp * 65536);
|
||||||
type = svt_fixed;
|
type = svt_fixed;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -93,7 +93,7 @@ double floatvalue(const svalue_t &v)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
v.type == svt_string ? atof(v.string) :
|
v.type == svt_string ? atof(v.string) :
|
||||||
v.type == svt_fixed ? v.value.f * 65536. :
|
v.type == svt_fixed ? v.value.f / 65536. :
|
||||||
v.type == svt_mobj ? -1. : (double)v.value.i;
|
v.type == svt_mobj ? -1. : (double)v.value.i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ void DCeiling::Tick ()
|
||||||
{
|
{
|
||||||
switch (m_Type)
|
switch (m_Type)
|
||||||
{
|
{
|
||||||
case ceilCrushAndRaise:
|
case DCeiling::ceilCrushAndRaise:
|
||||||
m_Direction = -1;
|
m_Direction = -1;
|
||||||
m_Speed = m_Speed1;
|
m_Speed = m_Speed1;
|
||||||
if (!SN_IsMakingLoopingSound (m_Sector))
|
if (!SN_IsMakingLoopingSound (m_Sector))
|
||||||
|
@ -173,8 +173,8 @@ void DCeiling::Tick ()
|
||||||
{
|
{
|
||||||
switch (m_Type)
|
switch (m_Type)
|
||||||
{
|
{
|
||||||
case ceilCrushAndRaise:
|
case DCeiling::ceilCrushAndRaise:
|
||||||
case ceilCrushRaiseAndStay:
|
case DCeiling::ceilCrushRaiseAndStay:
|
||||||
m_Speed = m_Speed2;
|
m_Speed = m_Speed2;
|
||||||
m_Direction = 1;
|
m_Direction = 1;
|
||||||
if (!SN_IsMakingLoopingSound (m_Sector))
|
if (!SN_IsMakingLoopingSound (m_Sector))
|
||||||
|
@ -202,8 +202,8 @@ void DCeiling::Tick ()
|
||||||
{
|
{
|
||||||
switch (m_Type)
|
switch (m_Type)
|
||||||
{
|
{
|
||||||
case ceilCrushAndRaise:
|
case DCeiling::ceilCrushAndRaise:
|
||||||
case ceilLowerAndCrush:
|
case DCeiling::ceilLowerAndCrush:
|
||||||
if (m_CrushMode == ECrushMode::crushSlowdown)
|
if (m_CrushMode == ECrushMode::crushSlowdown)
|
||||||
m_Speed = 1. / 8;
|
m_Speed = 1. / 8;
|
||||||
break;
|
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,
|
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
|
double targheight = 0; // Silence, GCC
|
||||||
|
|
||||||
|
@ -257,40 +257,40 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
|
||||||
}
|
}
|
||||||
|
|
||||||
// new door thinker
|
// new door thinker
|
||||||
DCeiling *ceiling = new DCeiling (sec, speed, speed2, silent);
|
DCeiling *ceiling = new DCeiling (sec, speed, speed2, silent & ~4);
|
||||||
vertex_t *spot = sec->lines[0]->v1;
|
vertex_t *spot = sec->lines[0]->v1;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case ceilCrushAndRaise:
|
case DCeiling::ceilCrushAndRaise:
|
||||||
case ceilCrushRaiseAndStay:
|
case DCeiling::ceilCrushRaiseAndStay:
|
||||||
ceiling->m_TopHeight = sec->ceilingplane.fD();
|
ceiling->m_TopHeight = sec->ceilingplane.fD();
|
||||||
case ceilLowerAndCrush:
|
case DCeiling::ceilLowerAndCrush:
|
||||||
targheight = sec->FindHighestFloorPoint (&spot);
|
targheight = sec->FindHighestFloorPoint (&spot);
|
||||||
targheight += height;
|
targheight += height;
|
||||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = -1;
|
ceiling->m_Direction = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilRaiseToHighest:
|
case DCeiling::ceilRaiseToHighest:
|
||||||
targheight = sec->FindHighestCeilingSurrounding (&spot);
|
targheight = sec->FindHighestCeilingSurrounding (&spot);
|
||||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = 1;
|
ceiling->m_Direction = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilLowerByValue:
|
case DCeiling::ceilLowerByValue:
|
||||||
targheight = sec->ceilingplane.ZatPoint (spot) - height;
|
targheight = sec->ceilingplane.ZatPoint (spot) - height;
|
||||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = -1;
|
ceiling->m_Direction = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilRaiseByValue:
|
case DCeiling::ceilRaiseByValue:
|
||||||
targheight = sec->ceilingplane.ZatPoint (spot) + height;
|
targheight = sec->ceilingplane.ZatPoint (spot) + height;
|
||||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = 1;
|
ceiling->m_Direction = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilMoveToValue:
|
case DCeiling::ceilMoveToValue:
|
||||||
{
|
{
|
||||||
double diff = height - sec->ceilingplane.ZatPoint (spot);
|
double diff = height - sec->ceilingplane.ZatPoint (spot);
|
||||||
|
|
||||||
|
@ -308,81 +308,81 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilLowerToHighestFloor:
|
case DCeiling::ceilLowerToHighestFloor:
|
||||||
targheight = sec->FindHighestFloorSurrounding (&spot);
|
targheight = sec->FindHighestFloorSurrounding (&spot);
|
||||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = -1;
|
ceiling->m_Direction = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilRaiseToHighestFloor:
|
case DCeiling::ceilRaiseToHighestFloor:
|
||||||
targheight = sec->FindHighestFloorSurrounding (&spot);
|
targheight = sec->FindHighestFloorSurrounding (&spot);
|
||||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = 1;
|
ceiling->m_Direction = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilLowerInstant:
|
case DCeiling::ceilLowerInstant:
|
||||||
targheight = sec->ceilingplane.ZatPoint (spot) - height;
|
targheight = sec->ceilingplane.ZatPoint (spot) - height;
|
||||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = -1;
|
ceiling->m_Direction = -1;
|
||||||
ceiling->m_Speed = height;
|
ceiling->m_Speed = height;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilRaiseInstant:
|
case DCeiling::ceilRaiseInstant:
|
||||||
targheight = sec->ceilingplane.ZatPoint (spot) + height;
|
targheight = sec->ceilingplane.ZatPoint (spot) + height;
|
||||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = 1;
|
ceiling->m_Direction = 1;
|
||||||
ceiling->m_Speed = height;
|
ceiling->m_Speed = height;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilLowerToNearest:
|
case DCeiling::ceilLowerToNearest:
|
||||||
targheight = sec->FindNextLowestCeiling (&spot);
|
targheight = sec->FindNextLowestCeiling (&spot);
|
||||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = -1;
|
ceiling->m_Direction = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilRaiseToNearest:
|
case DCeiling::ceilRaiseToNearest:
|
||||||
targheight = sec->FindNextHighestCeiling (&spot);
|
targheight = sec->FindNextHighestCeiling (&spot);
|
||||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = 1;
|
ceiling->m_Direction = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilLowerToLowest:
|
case DCeiling::ceilLowerToLowest:
|
||||||
targheight = sec->FindLowestCeilingSurrounding (&spot);
|
targheight = sec->FindLowestCeilingSurrounding (&spot);
|
||||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = -1;
|
ceiling->m_Direction = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilRaiseToLowest:
|
case DCeiling::ceilRaiseToLowest:
|
||||||
targheight = sec->FindLowestCeilingSurrounding (&spot);
|
targheight = sec->FindLowestCeilingSurrounding (&spot);
|
||||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = 1;
|
ceiling->m_Direction = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilLowerToFloor:
|
case DCeiling::ceilLowerToFloor:
|
||||||
targheight = sec->FindHighestFloorPoint (&spot);
|
targheight = sec->FindHighestFloorPoint (&spot);
|
||||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = -1;
|
ceiling->m_Direction = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilRaiseToFloor: // [RH] What's this for?
|
case DCeiling::ceilRaiseToFloor: // [RH] What's this for?
|
||||||
targheight = sec->FindHighestFloorPoint (&spot);
|
targheight = sec->FindHighestFloorPoint (&spot);
|
||||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = 1;
|
ceiling->m_Direction = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilLowerToHighest:
|
case DCeiling::ceilLowerToHighest:
|
||||||
targheight = sec->FindHighestCeilingSurrounding (&spot);
|
targheight = sec->FindHighestCeilingSurrounding (&spot);
|
||||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = -1;
|
ceiling->m_Direction = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilLowerByTexture:
|
case DCeiling::ceilLowerByTexture:
|
||||||
targheight = sec->ceilingplane.ZatPoint (spot) - sec->FindShortestUpperAround ();
|
targheight = sec->ceilingplane.ZatPoint (spot) - sec->FindShortestUpperAround ();
|
||||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = -1;
|
ceiling->m_Direction = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ceilRaiseByTexture:
|
case DCeiling::ceilRaiseByTexture:
|
||||||
targheight = sec->ceilingplane.ZatPoint (spot) + sec->FindShortestUpperAround ();
|
targheight = sec->ceilingplane.ZatPoint (spot) + sec->FindShortestUpperAround ();
|
||||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = 1;
|
ceiling->m_Direction = 1;
|
||||||
|
@ -413,6 +413,7 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
|
||||||
if (ceiling->m_Speed >= movedist)
|
if (ceiling->m_Speed >= movedist)
|
||||||
{
|
{
|
||||||
ceiling->StopInterpolation(true);
|
ceiling->StopInterpolation(true);
|
||||||
|
if (silent & 4) ceiling->m_Silent = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set texture/type change properties
|
// set texture/type change properties
|
||||||
|
@ -425,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
|
//jff 5/23/98 find model with floor at target height if target
|
||||||
//is a floor type
|
//is a floor type
|
||||||
modelsec = (/*type == ceilRaiseToHighest ||*/
|
modelsec = (/*type == ceilRaiseToHighest ||*/
|
||||||
type == ceilRaiseToFloor ||
|
type == DCeiling::ceilRaiseToFloor ||
|
||||||
/*type == ceilLowerToHighest ||*/
|
/*type == ceilLowerToHighest ||*/
|
||||||
type == ceilLowerToFloor) ?
|
type == DCeiling::ceilLowerToFloor) ?
|
||||||
sec->FindModelFloorSector (targheight) :
|
sec->FindModelFloorSector (targheight) :
|
||||||
sec->FindModelCeilingSector (targheight);
|
sec->FindModelCeilingSector (targheight);
|
||||||
if (modelsec != NULL)
|
if (modelsec != NULL)
|
||||||
|
@ -437,14 +438,14 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
|
||||||
{
|
{
|
||||||
case 1: // type is zeroed
|
case 1: // type is zeroed
|
||||||
ceiling->m_NewSpecial.Clear();
|
ceiling->m_NewSpecial.Clear();
|
||||||
ceiling->m_Type = genCeilingChg0;
|
ceiling->m_Type = DCeiling::genCeilingChg0;
|
||||||
break;
|
break;
|
||||||
case 2: // type is copied
|
case 2: // type is copied
|
||||||
sec->GetSpecial(&ceiling->m_NewSpecial);
|
sec->GetSpecial(&ceiling->m_NewSpecial);
|
||||||
ceiling->m_Type = genCeilingChgT;
|
ceiling->m_Type = DCeiling::genCeilingChgT;
|
||||||
break;
|
break;
|
||||||
case 3: // type is left alone
|
case 3: // type is left alone
|
||||||
ceiling->m_Type = genCeilingChg;
|
ceiling->m_Type = DCeiling::genCeilingChg;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -456,21 +457,21 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
|
||||||
{
|
{
|
||||||
case 1: // type is zeroed
|
case 1: // type is zeroed
|
||||||
ceiling->m_NewSpecial.Clear();
|
ceiling->m_NewSpecial.Clear();
|
||||||
ceiling->m_Type = genCeilingChg0;
|
ceiling->m_Type = DCeiling::genCeilingChg0;
|
||||||
break;
|
break;
|
||||||
case 2: // type is copied
|
case 2: // type is copied
|
||||||
line->frontsector->GetSpecial(&ceiling->m_NewSpecial);
|
line->frontsector->GetSpecial(&ceiling->m_NewSpecial);
|
||||||
ceiling->m_Type = genCeilingChgT;
|
ceiling->m_Type = DCeiling::genCeilingChgT;
|
||||||
break;
|
break;
|
||||||
case 3: // type is left alone
|
case 3: // type is left alone
|
||||||
ceiling->m_Type = genCeilingChg;
|
ceiling->m_Type = DCeiling::genCeilingChg;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ceiling->PlayCeilingSound ();
|
ceiling->PlayCeilingSound ();
|
||||||
return ceiling;
|
return ceiling != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
@ -501,7 +502,7 @@ bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line,
|
||||||
// [RH] Hack to let manual crushers be retriggerable, too
|
// [RH] Hack to let manual crushers be retriggerable, too
|
||||||
tag ^= secnum | 0x1000000;
|
tag ^= secnum | 0x1000000;
|
||||||
P_ActivateInStasisCeiling (tag);
|
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.
|
// Reactivate in-stasis ceilings...for certain types.
|
||||||
|
@ -515,7 +516,7 @@ bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line,
|
||||||
FSectorTagIterator it(tag);
|
FSectorTagIterator it(tag);
|
||||||
while ((secnum = it.Next()) >= 0)
|
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;
|
return rtn;
|
||||||
}
|
}
|
||||||
|
|
470
src/p_floor.cpp
470
src/p_floor.cpp
|
@ -271,6 +271,244 @@ DFloor::DFloor (sector_t *sec)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
bool P_CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t *line,
|
||||||
|
double speed, double height, int crush, int change, bool hexencrush, bool hereticlower)
|
||||||
|
{
|
||||||
|
bool rtn;
|
||||||
|
DFloor* floor;
|
||||||
|
double ceilingheight;
|
||||||
|
double newheight;
|
||||||
|
vertex_t *spot, *spot2;
|
||||||
|
|
||||||
|
// ALREADY MOVING? IF SO, KEEP GOING...
|
||||||
|
if (sec->PlaneMoving(sector_t::floor))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// new floor thinker
|
||||||
|
rtn = true;
|
||||||
|
floor = new DFloor(sec);
|
||||||
|
floor->m_Type = floortype;
|
||||||
|
floor->m_Crush = crush;
|
||||||
|
floor->m_Hexencrush = hexencrush;
|
||||||
|
floor->m_Speed = speed;
|
||||||
|
floor->m_ResetCount = 0; // [RH]
|
||||||
|
floor->m_OrgDist = sec->floorplane.fD(); // [RH]
|
||||||
|
|
||||||
|
switch (floortype)
|
||||||
|
{
|
||||||
|
case DFloor::floorLowerToHighest:
|
||||||
|
floor->m_Direction = -1;
|
||||||
|
newheight = sec->FindHighestFloorSurrounding(&spot);
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, newheight);
|
||||||
|
// [RH] DOOM's turboLower type did this. I've just extended it
|
||||||
|
// to be applicable to all LowerToHighest types.
|
||||||
|
if (hereticlower || floor->m_FloorDestDist != sec->floorplane.fD())
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, newheight + height);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorLowerToLowest:
|
||||||
|
floor->m_Direction = -1;
|
||||||
|
newheight = sec->FindLowestFloorSurrounding(&spot);
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, newheight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorLowerToNearest:
|
||||||
|
//jff 02/03/30 support lowering floor to next lowest floor
|
||||||
|
floor->m_Direction = -1;
|
||||||
|
newheight = sec->FindNextLowestFloor(&spot);
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, newheight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorLowerInstant:
|
||||||
|
floor->m_Speed = height;
|
||||||
|
case DFloor::floorLowerByValue:
|
||||||
|
floor->m_Direction = -1;
|
||||||
|
newheight = sec->CenterFloor() - height;
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(sec->centerspot, newheight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorRaiseInstant:
|
||||||
|
floor->m_Speed = height;
|
||||||
|
case DFloor::floorRaiseByValue:
|
||||||
|
floor->m_Direction = 1;
|
||||||
|
newheight = sec->CenterFloor() + height;
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(sec->centerspot, newheight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorMoveToValue:
|
||||||
|
sec->FindHighestFloorPoint(&spot);
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, height);
|
||||||
|
floor->m_Direction = (floor->m_FloorDestDist > sec->floorplane.fD()) ? -1 : 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorRaiseAndCrushDoom:
|
||||||
|
case DFloor::floorRaiseToLowestCeiling:
|
||||||
|
floor->m_Direction = 1;
|
||||||
|
newheight = sec->FindLowestCeilingSurrounding(&spot);
|
||||||
|
if (floortype == DFloor::floorRaiseAndCrushDoom)
|
||||||
|
newheight -= 8;
|
||||||
|
ceilingheight = sec->FindLowestCeilingPoint(&spot2);
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, newheight);
|
||||||
|
if (sec->floorplane.ZatPointDist(spot2, floor->m_FloorDestDist) > ceilingheight)
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot2,
|
||||||
|
floortype == DFloor::floorRaiseAndCrushDoom ? ceilingheight - 8 : ceilingheight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorRaiseToHighest:
|
||||||
|
floor->m_Direction = 1;
|
||||||
|
newheight = sec->FindHighestFloorSurrounding(&spot);
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, newheight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorRaiseToNearest:
|
||||||
|
floor->m_Direction = 1;
|
||||||
|
newheight = sec->FindNextHighestFloor(&spot);
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, newheight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorRaiseToLowest:
|
||||||
|
floor->m_Direction = 1;
|
||||||
|
newheight = sec->FindLowestFloorSurrounding(&spot);
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, newheight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorRaiseAndCrush:
|
||||||
|
floor->m_Direction = 1;
|
||||||
|
newheight = sec->FindLowestCeilingPoint(&spot) - 8;
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, newheight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorRaiseToCeiling:
|
||||||
|
floor->m_Direction = 1;
|
||||||
|
newheight = sec->FindLowestCeilingPoint(&spot);
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, newheight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorLowerToLowestCeiling:
|
||||||
|
floor->m_Direction = -1;
|
||||||
|
newheight = sec->FindLowestCeilingSurrounding(&spot);
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, newheight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorLowerByTexture:
|
||||||
|
floor->m_Direction = -1;
|
||||||
|
newheight = sec->CenterFloor() - sec->FindShortestTextureAround();
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(sec->centerspot, newheight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorLowerToCeiling:
|
||||||
|
// [RH] Essentially instantly raises the floor to the ceiling
|
||||||
|
floor->m_Direction = -1;
|
||||||
|
newheight = sec->FindLowestCeilingPoint(&spot);
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, newheight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorRaiseByTexture:
|
||||||
|
floor->m_Direction = 1;
|
||||||
|
// [RH] Use P_FindShortestTextureAround from BOOM to do this
|
||||||
|
// since the code is identical to what was here. (Oddly
|
||||||
|
// enough, BOOM preserved the code here even though it
|
||||||
|
// also had this function.)
|
||||||
|
newheight = sec->CenterFloor() + sec->FindShortestTextureAround();
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(sec->centerspot, newheight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorRaiseAndChange:
|
||||||
|
floor->m_Direction = 1;
|
||||||
|
newheight = sec->CenterFloor() + height;
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(sec->centerspot, newheight);
|
||||||
|
if (line != NULL)
|
||||||
|
{
|
||||||
|
FTextureID oldpic = sec->GetTexture(sector_t::floor);
|
||||||
|
sec->SetTexture(sector_t::floor, line->frontsector->GetTexture(sector_t::floor));
|
||||||
|
sec->TransferSpecial(line->frontsector);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sec->ClearSpecial();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DFloor::floorLowerAndChange:
|
||||||
|
floor->m_Direction = -1;
|
||||||
|
newheight = sec->FindLowestFloorSurrounding(&spot);
|
||||||
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, newheight);
|
||||||
|
floor->m_Texture = sec->GetTexture(sector_t::floor);
|
||||||
|
// jff 1/24/98 make sure floor->m_NewSpecial gets initialized
|
||||||
|
// in case no surrounding sector is at floordestheight
|
||||||
|
sec->GetSpecial(&floor->m_NewSpecial);
|
||||||
|
|
||||||
|
//jff 5/23/98 use model subroutine to unify fixes and handling
|
||||||
|
sector_t *modelsec;
|
||||||
|
modelsec = sec->FindModelFloorSector(newheight);
|
||||||
|
if (modelsec != NULL)
|
||||||
|
{
|
||||||
|
floor->m_Texture = modelsec->GetTexture(sector_t::floor);
|
||||||
|
modelsec->GetSpecial(&floor->m_NewSpecial);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not interpolate instant movement floors.
|
||||||
|
bool silent = false;
|
||||||
|
|
||||||
|
if ((floor->m_Direction > 0 && floor->m_FloorDestDist > sec->floorplane.fD()) || // moving up but going down
|
||||||
|
(floor->m_Direction < 0 && floor->m_FloorDestDist < sec->floorplane.fD()) || // moving down but going up
|
||||||
|
(floor->m_Speed >= fabs(sec->floorplane.fD() - floor->m_FloorDestDist))) // moving in one step
|
||||||
|
{
|
||||||
|
floor->StopInterpolation(true);
|
||||||
|
|
||||||
|
// [Graf Zahl]
|
||||||
|
// Don't make sounds for instant movement hacks but make an exception for
|
||||||
|
// switches that activate their own back side.
|
||||||
|
if (!(i_compatflags & COMPATF_SILENT_INSTANT_FLOORS))
|
||||||
|
{
|
||||||
|
if (!line || !(line->activation & (SPAC_Use | SPAC_Push)) || line->backsector != sec)
|
||||||
|
silent = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!silent) floor->StartFloorSound();
|
||||||
|
|
||||||
|
if (change & 3)
|
||||||
|
{
|
||||||
|
// [RH] Need to do some transferring
|
||||||
|
if (change & 4)
|
||||||
|
{
|
||||||
|
// Numeric model change
|
||||||
|
sector_t *modelsec;
|
||||||
|
|
||||||
|
modelsec = (floortype == DFloor::floorRaiseToLowestCeiling ||
|
||||||
|
floortype == DFloor::floorLowerToLowestCeiling ||
|
||||||
|
floortype == DFloor::floorRaiseToCeiling ||
|
||||||
|
floortype == DFloor::floorLowerToCeiling) ?
|
||||||
|
sec->FindModelCeilingSector(-floor->m_FloorDestDist) :
|
||||||
|
sec->FindModelFloorSector(-floor->m_FloorDestDist);
|
||||||
|
|
||||||
|
if (modelsec != NULL)
|
||||||
|
{
|
||||||
|
floor->SetFloorChangeType(modelsec, change);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (line)
|
||||||
|
{
|
||||||
|
// Trigger model change
|
||||||
|
floor->SetFloorChangeType(line->frontsector, change);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// HANDLE FLOOR TYPES
|
// HANDLE FLOOR TYPES
|
||||||
|
@ -283,241 +521,13 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
|
||||||
double speed, double height, int crush, int change, bool hexencrush, bool hereticlower)
|
double speed, double height, int crush, int change, bool hexencrush, bool hereticlower)
|
||||||
{
|
{
|
||||||
int secnum;
|
int secnum;
|
||||||
bool rtn;
|
bool rtn = false;
|
||||||
sector_t* sec;
|
|
||||||
DFloor* floor;
|
|
||||||
double ceilingheight;
|
|
||||||
double newheight;
|
|
||||||
vertex_t *spot, *spot2;
|
|
||||||
|
|
||||||
rtn = false;
|
|
||||||
|
|
||||||
// check if a manual trigger; if so do just the sector on the backside
|
// check if a manual trigger; if so do just the sector on the backside
|
||||||
FSectorTagIterator it(tag, line);
|
FSectorTagIterator it(tag, line);
|
||||||
while ((secnum = it.Next()) >= 0)
|
while ((secnum = it.Next()) >= 0)
|
||||||
{
|
{
|
||||||
sec = §ors[secnum];
|
rtn |= P_CreateFloor(§ors[secnum], floortype, line, speed, height, crush, change, hexencrush, hereticlower);
|
||||||
// ALREADY MOVING? IF SO, KEEP GOING...
|
|
||||||
if (sec->PlaneMoving(sector_t::floor))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// new floor thinker
|
|
||||||
rtn = true;
|
|
||||||
floor = new DFloor (sec);
|
|
||||||
floor->m_Type = floortype;
|
|
||||||
floor->m_Crush = crush;
|
|
||||||
floor->m_Hexencrush = hexencrush;
|
|
||||||
floor->m_Speed = speed;
|
|
||||||
floor->m_ResetCount = 0; // [RH]
|
|
||||||
floor->m_OrgDist = sec->floorplane.fD(); // [RH]
|
|
||||||
|
|
||||||
switch (floortype)
|
|
||||||
{
|
|
||||||
case DFloor::floorLowerToHighest:
|
|
||||||
floor->m_Direction = -1;
|
|
||||||
newheight = sec->FindHighestFloorSurrounding (&spot);
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
|
|
||||||
// [RH] DOOM's turboLower type did this. I've just extended it
|
|
||||||
// to be applicable to all LowerToHighest types.
|
|
||||||
if (hereticlower || floor->m_FloorDestDist != sec->floorplane.fD())
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight+height);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorLowerToLowest:
|
|
||||||
floor->m_Direction = -1;
|
|
||||||
newheight = sec->FindLowestFloorSurrounding (&spot);
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorLowerToNearest:
|
|
||||||
//jff 02/03/30 support lowering floor to next lowest floor
|
|
||||||
floor->m_Direction = -1;
|
|
||||||
newheight = sec->FindNextLowestFloor (&spot);
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorLowerInstant:
|
|
||||||
floor->m_Speed = height;
|
|
||||||
case DFloor::floorLowerByValue:
|
|
||||||
floor->m_Direction = -1;
|
|
||||||
newheight = sec->CenterFloor() - height;
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorRaiseInstant:
|
|
||||||
floor->m_Speed = height;
|
|
||||||
case DFloor::floorRaiseByValue:
|
|
||||||
floor->m_Direction = 1;
|
|
||||||
newheight = sec->CenterFloor() + height;
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorMoveToValue:
|
|
||||||
sec->FindHighestFloorPoint (&spot);
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, height);
|
|
||||||
floor->m_Direction = (floor->m_FloorDestDist > sec->floorplane.fD()) ? -1 : 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorRaiseAndCrushDoom:
|
|
||||||
case DFloor::floorRaiseToLowestCeiling:
|
|
||||||
floor->m_Direction = 1;
|
|
||||||
newheight = sec->FindLowestCeilingSurrounding (&spot);
|
|
||||||
if (floortype == DFloor::floorRaiseAndCrushDoom)
|
|
||||||
newheight -= 8;
|
|
||||||
ceilingheight = sec->FindLowestCeilingPoint (&spot2);
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
|
|
||||||
if (sec->floorplane.ZatPointDist (spot2, floor->m_FloorDestDist) > ceilingheight)
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot2,
|
|
||||||
floortype == DFloor::floorRaiseAndCrushDoom ? ceilingheight - 8 : ceilingheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorRaiseToHighest:
|
|
||||||
floor->m_Direction = 1;
|
|
||||||
newheight = sec->FindHighestFloorSurrounding (&spot);
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorRaiseToNearest:
|
|
||||||
floor->m_Direction = 1;
|
|
||||||
newheight = sec->FindNextHighestFloor (&spot);
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorRaiseToLowest:
|
|
||||||
floor->m_Direction = 1;
|
|
||||||
newheight = sec->FindLowestFloorSurrounding (&spot);
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorRaiseAndCrush:
|
|
||||||
floor->m_Direction = 1;
|
|
||||||
newheight = sec->FindLowestCeilingPoint (&spot) - 8;
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorRaiseToCeiling:
|
|
||||||
floor->m_Direction = 1;
|
|
||||||
newheight = sec->FindLowestCeilingPoint (&spot);
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorLowerToLowestCeiling:
|
|
||||||
floor->m_Direction = -1;
|
|
||||||
newheight = sec->FindLowestCeilingSurrounding (&spot);
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorLowerByTexture:
|
|
||||||
floor->m_Direction = -1;
|
|
||||||
newheight = sec->CenterFloor() - sec->FindShortestTextureAround ();
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorLowerToCeiling:
|
|
||||||
// [RH] Essentially instantly raises the floor to the ceiling
|
|
||||||
floor->m_Direction = -1;
|
|
||||||
newheight = sec->FindLowestCeilingPoint (&spot);
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorRaiseByTexture:
|
|
||||||
floor->m_Direction = 1;
|
|
||||||
// [RH] Use P_FindShortestTextureAround from BOOM to do this
|
|
||||||
// since the code is identical to what was here. (Oddly
|
|
||||||
// enough, BOOM preserved the code here even though it
|
|
||||||
// also had this function.)
|
|
||||||
newheight = sec->CenterFloor() + sec->FindShortestTextureAround ();
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorRaiseAndChange:
|
|
||||||
floor->m_Direction = 1;
|
|
||||||
newheight = sec->CenterFloor() + height;
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
|
|
||||||
if (line != NULL)
|
|
||||||
{
|
|
||||||
FTextureID oldpic = sec->GetTexture(sector_t::floor);
|
|
||||||
sec->SetTexture(sector_t::floor, line->frontsector->GetTexture(sector_t::floor));
|
|
||||||
sec->TransferSpecial(line->frontsector);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sec->ClearSpecial();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DFloor::floorLowerAndChange:
|
|
||||||
floor->m_Direction = -1;
|
|
||||||
newheight = sec->FindLowestFloorSurrounding (&spot);
|
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (spot, newheight);
|
|
||||||
floor->m_Texture = sec->GetTexture(sector_t::floor);
|
|
||||||
// jff 1/24/98 make sure floor->m_NewSpecial gets initialized
|
|
||||||
// in case no surrounding sector is at floordestheight
|
|
||||||
sec->GetSpecial(&floor->m_NewSpecial);
|
|
||||||
|
|
||||||
//jff 5/23/98 use model subroutine to unify fixes and handling
|
|
||||||
sector_t *modelsec;
|
|
||||||
modelsec = sec->FindModelFloorSector (newheight);
|
|
||||||
if (modelsec != NULL)
|
|
||||||
{
|
|
||||||
floor->m_Texture = modelsec->GetTexture(sector_t::floor);
|
|
||||||
modelsec->GetSpecial(&floor->m_NewSpecial);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do not interpolate instant movement floors.
|
|
||||||
bool silent = false;
|
|
||||||
|
|
||||||
if ((floor->m_Direction>0 && floor->m_FloorDestDist>sec->floorplane.fD()) || // moving up but going down
|
|
||||||
(floor->m_Direction<0 && floor->m_FloorDestDist<sec->floorplane.fD()) || // moving down but going up
|
|
||||||
(floor->m_Speed >= fabs(sec->floorplane.fD() - floor->m_FloorDestDist))) // moving in one step
|
|
||||||
{
|
|
||||||
floor->StopInterpolation(true);
|
|
||||||
|
|
||||||
// [Graf Zahl]
|
|
||||||
// Don't make sounds for instant movement hacks but make an exception for
|
|
||||||
// switches that activate their own back side.
|
|
||||||
if (!(i_compatflags & COMPATF_SILENT_INSTANT_FLOORS))
|
|
||||||
{
|
|
||||||
if (!line || !(line->activation & (SPAC_Use|SPAC_Push)) || line->backsector!=sec)
|
|
||||||
silent = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!silent) floor->StartFloorSound ();
|
|
||||||
|
|
||||||
if (change & 3)
|
|
||||||
{
|
|
||||||
// [RH] Need to do some transferring
|
|
||||||
if (change & 4)
|
|
||||||
{
|
|
||||||
// Numeric model change
|
|
||||||
sector_t *modelsec;
|
|
||||||
|
|
||||||
modelsec = (floortype == DFloor::floorRaiseToLowestCeiling ||
|
|
||||||
floortype == DFloor::floorLowerToLowestCeiling ||
|
|
||||||
floortype == DFloor::floorRaiseToCeiling ||
|
|
||||||
floortype == DFloor::floorLowerToCeiling) ?
|
|
||||||
sec->FindModelCeilingSector (-floor->m_FloorDestDist) :
|
|
||||||
sec->FindModelFloorSector (-floor->m_FloorDestDist);
|
|
||||||
|
|
||||||
if (modelsec != NULL)
|
|
||||||
{
|
|
||||||
floor->SetFloorChangeType (modelsec, change);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (line)
|
|
||||||
{
|
|
||||||
// Trigger model change
|
|
||||||
floor->SetFloorChangeType (line->frontsector, change);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return rtn;
|
return rtn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4463,10 +4463,17 @@ struct SRailHit
|
||||||
DVector3 HitPos;
|
DVector3 HitPos;
|
||||||
DAngle HitAngle;
|
DAngle HitAngle;
|
||||||
};
|
};
|
||||||
|
struct SPortalHit
|
||||||
|
{
|
||||||
|
DVector3 HitPos;
|
||||||
|
DVector3 ContPos;
|
||||||
|
DVector3 OutDir;
|
||||||
|
};
|
||||||
struct RailData
|
struct RailData
|
||||||
{
|
{
|
||||||
AActor *Caller;
|
AActor *Caller;
|
||||||
TArray<SRailHit> RailHits;
|
TArray<SRailHit> RailHits;
|
||||||
|
TArray<SPortalHit> PortalHits;
|
||||||
bool StopAtOne;
|
bool StopAtOne;
|
||||||
bool StopAtInvul;
|
bool StopAtInvul;
|
||||||
bool ThruSpecies;
|
bool ThruSpecies;
|
||||||
|
@ -4475,6 +4482,16 @@ struct RailData
|
||||||
static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata)
|
static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata)
|
||||||
{
|
{
|
||||||
RailData *data = (RailData *)userdata;
|
RailData *data = (RailData *)userdata;
|
||||||
|
if (res.HitType == TRACE_CrossingPortal)
|
||||||
|
{
|
||||||
|
SPortalHit newhit;
|
||||||
|
newhit.HitPos = res.HitPos;
|
||||||
|
newhit.ContPos = res.SrcFromTarget;
|
||||||
|
newhit.OutDir = res.HitVector;
|
||||||
|
data->PortalHits.Push(newhit);
|
||||||
|
return TRACE_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (res.HitType != TRACE_HitActor)
|
if (res.HitType != TRACE_HitActor)
|
||||||
{
|
{
|
||||||
return TRACE_Stop;
|
return TRACE_Stop;
|
||||||
|
@ -4559,7 +4576,8 @@ void P_RailAttack(FRailParams *p)
|
||||||
assert(puffclass != NULL); // Because we set it to a default above
|
assert(puffclass != NULL); // Because we set it to a default above
|
||||||
AActor *puffDefaults = GetDefaultByType(puffclass->GetReplacement()); //Contains all the flags such as FOILINVUL, etc.
|
AActor *puffDefaults = GetDefaultByType(puffclass->GetReplacement()); //Contains all the flags such as FOILINVUL, etc.
|
||||||
|
|
||||||
flags = (puffDefaults->flags6 & MF6_NOTRIGGER) ? 0 : TRACE_PCross | TRACE_Impact;
|
// disabled because not complete yet.
|
||||||
|
flags = (puffDefaults->flags6 & MF6_NOTRIGGER) ? 0/*TRACE_ReportPortals*/ : TRACE_PCross | TRACE_Impact /*| TRACE_ReportPortals*/;
|
||||||
rail_data.StopAtInvul = (puffDefaults->flags3 & MF3_FOILINVUL) ? false : true;
|
rail_data.StopAtInvul = (puffDefaults->flags3 & MF3_FOILINVUL) ? false : true;
|
||||||
rail_data.ThruSpecies = (puffDefaults->flags6 & MF6_MTHRUSPECIES) ? true : false;
|
rail_data.ThruSpecies = (puffDefaults->flags6 & MF6_MTHRUSPECIES) ? true : false;
|
||||||
Trace(start, source->Sector, vec, p->distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace, flags, ProcessRailHit, &rail_data);
|
Trace(start, source->Sector, vec, p->distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace, flags, ProcessRailHit, &rail_data);
|
||||||
|
|
|
@ -5010,7 +5010,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
||||||
if (mthing->Scale.X != 0)
|
if (mthing->Scale.X != 0)
|
||||||
mobj->Scale.X = mthing->Scale.X * mobj->Scale.X;
|
mobj->Scale.X = mthing->Scale.X * mobj->Scale.X;
|
||||||
if (mthing->Scale.Y != 0)
|
if (mthing->Scale.Y != 0)
|
||||||
mobj->Scale.X = mthing->Scale.Y * mobj->Scale.Y;
|
mobj->Scale.Y = mthing->Scale.Y * mobj->Scale.Y;
|
||||||
if (mthing->pitch)
|
if (mthing->pitch)
|
||||||
mobj->Angles.Pitch = (double)mthing->pitch;
|
mobj->Angles.Pitch = (double)mthing->pitch;
|
||||||
if (mthing->roll)
|
if (mthing->roll)
|
||||||
|
|
13
src/p_spec.h
13
src/p_spec.h
|
@ -572,10 +572,6 @@ public:
|
||||||
void Serialize (FArchive &arc);
|
void Serialize (FArchive &arc);
|
||||||
void Tick ();
|
void Tick ();
|
||||||
|
|
||||||
static DCeiling *Create(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);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ECeiling m_Type;
|
ECeiling m_Type;
|
||||||
double m_BottomHeight;
|
double m_BottomHeight;
|
||||||
|
@ -601,13 +597,13 @@ protected:
|
||||||
private:
|
private:
|
||||||
DCeiling ();
|
DCeiling ();
|
||||||
|
|
||||||
|
friend 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, DCeiling::ECrushMode hexencrush);
|
||||||
friend bool EV_CeilingCrushStop (int tag);
|
friend bool EV_CeilingCrushStop (int tag);
|
||||||
friend void P_ActivateInStasisCeiling (int tag);
|
friend void P_ActivateInStasisCeiling (int tag);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line,
|
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, DCeiling::ECrushMode hexencrush);
|
||||||
int tag, double speed, double speed2, double height,
|
bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line, int tag, double speed, double speed2, double height, int crush, int silent, int change, DCeiling::ECrushMode hexencrush = DCeiling::ECrushMode::crushDoom);
|
||||||
int crush, int silent, int change, DCeiling::ECrushMode hexencrush = DCeiling::ECrushMode::crushDoom);
|
|
||||||
|
|
||||||
bool EV_CeilingCrushStop (int tag);
|
bool EV_CeilingCrushStop (int tag);
|
||||||
void P_ActivateInStasisCeiling (int tag);
|
void P_ActivateInStasisCeiling (int tag);
|
||||||
|
@ -711,6 +707,9 @@ private:
|
||||||
DFloor ();
|
DFloor ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool P_CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t *line,
|
||||||
|
double speed, double height, int crush, int change, bool hexencrush, bool hereticlower);
|
||||||
|
|
||||||
bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
|
bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
|
||||||
double stairsize, double speed, int delay, int reset, int igntxt,
|
double stairsize, double speed, int delay, int reset, int igntxt,
|
||||||
int usespecials);
|
int usespecials);
|
||||||
|
|
|
@ -66,6 +66,8 @@ struct FTraceInfo
|
||||||
double startfrac;
|
double startfrac;
|
||||||
int aimdir;
|
int aimdir;
|
||||||
double limitz;
|
double limitz;
|
||||||
|
double lastfloorportalheight;
|
||||||
|
double lastceilingportalheight;
|
||||||
|
|
||||||
// These are required for 3D-floor checking
|
// These are required for 3D-floor checking
|
||||||
// to create a fake sector with a floor
|
// to create a fake sector with a floor
|
||||||
|
@ -141,6 +143,7 @@ bool Trace(const DVector3 &start, sector_t *sector, const DVector3 &direction, d
|
||||||
inf.sectorsel=0;
|
inf.sectorsel=0;
|
||||||
inf.aimdir = -1;
|
inf.aimdir = -1;
|
||||||
inf.startfrac = 0;
|
inf.startfrac = 0;
|
||||||
|
inf.lastfloorportalheight = inf.lastceilingportalheight = start.Z;
|
||||||
memset(&res, 0, sizeof(res));
|
memset(&res, 0, sizeof(res));
|
||||||
|
|
||||||
if (inf.TraceTraverse (ptflags))
|
if (inf.TraceTraverse (ptflags))
|
||||||
|
@ -196,6 +199,7 @@ void FTraceInfo::EnterSectorPortal(int position, double frac, sector_t *entersec
|
||||||
newtrace.aimdir = position;
|
newtrace.aimdir = position;
|
||||||
newtrace.limitz = portal->specialf1;
|
newtrace.limitz = portal->specialf1;
|
||||||
newtrace.sectorsel = 0;
|
newtrace.sectorsel = 0;
|
||||||
|
newtrace.lastfloorportalheight = newtrace.lastceilingportalheight = limitz;
|
||||||
|
|
||||||
if (newtrace.TraceTraverse(ActorMask ? PT_ADDLINES | PT_ADDTHINGS | PT_COMPATIBLE : PT_ADDLINES))
|
if (newtrace.TraceTraverse(ActorMask ? PT_ADDLINES | PT_ADDTHINGS | PT_COMPATIBLE : PT_ADDLINES))
|
||||||
{
|
{
|
||||||
|
@ -227,7 +231,7 @@ int FTraceInfo::EnterLinePortal(line_t *li, double frac)
|
||||||
|
|
||||||
frac += 1 / MaxDist;
|
frac += 1 / MaxDist;
|
||||||
double enterdist = MaxDist / frac;
|
double enterdist = MaxDist / frac;
|
||||||
DVector2 enter = newtrace.Start.XY() + enterdist * Vec.XY();
|
DVector2 enter = newtrace.Start + enterdist * Vec;
|
||||||
|
|
||||||
newtrace.ActorMask = ActorMask;
|
newtrace.ActorMask = ActorMask;
|
||||||
newtrace.WallMask = WallMask;
|
newtrace.WallMask = WallMask;
|
||||||
|
@ -244,7 +248,9 @@ int FTraceInfo::EnterLinePortal(line_t *li, double frac)
|
||||||
newtrace.startfrac = frac;
|
newtrace.startfrac = frac;
|
||||||
newtrace.aimdir = aimdir;
|
newtrace.aimdir = aimdir;
|
||||||
newtrace.limitz = limitz;
|
newtrace.limitz = limitz;
|
||||||
|
|
||||||
P_TranslatePortalZ(li, newtrace.limitz);
|
P_TranslatePortalZ(li, newtrace.limitz);
|
||||||
|
newtrace.lastfloorportalheight = newtrace.lastceilingportalheight = newtrace.limitz;
|
||||||
newtrace.sectorsel = 0;
|
newtrace.sectorsel = 0;
|
||||||
Results->unlinked = true;
|
Results->unlinked = true;
|
||||||
return newtrace.TraceTraverse(ActorMask ? PT_ADDLINES | PT_ADDTHINGS | PT_COMPATIBLE : PT_ADDLINES);
|
return newtrace.TraceTraverse(ActorMask ? PT_ADDLINES | PT_ADDTHINGS | PT_COMPATIBLE : PT_ADDLINES);
|
||||||
|
@ -442,11 +448,24 @@ bool FTraceInfo::LineCheck(intercept_t *in)
|
||||||
Results->HitType = TRACE_HitFloor;
|
Results->HitType = TRACE_HitFloor;
|
||||||
Results->HitTexture = CurSector->GetTexture(sector_t::floor);
|
Results->HitTexture = CurSector->GetTexture(sector_t::floor);
|
||||||
}
|
}
|
||||||
else if (entersector == NULL || entersector->PortalBlocksMovement(sector_t::floor))
|
else
|
||||||
{
|
{
|
||||||
// hit beyond a portal plane. This needs to be taken care of by the trace spawned on the other side.
|
if ((TraceFlags & TRACE_ReportPortals) && lastfloorportalheight > fc)
|
||||||
Results->HitType = TRACE_HitNone;
|
{
|
||||||
return false;
|
lastfloorportalheight = fc;
|
||||||
|
if (TraceCallback != NULL)
|
||||||
|
{
|
||||||
|
// Todo: calculate the intersection point.
|
||||||
|
Results->HitType = TRACE_CrossingPortal;
|
||||||
|
TraceCallback(*Results, TraceCallbackData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (entersector == NULL || entersector->PortalBlocksMovement(sector_t::floor))
|
||||||
|
{
|
||||||
|
// hit beyond a portal plane. This needs to be taken care of by the trace spawned on the other side.
|
||||||
|
Results->HitType = TRACE_HitNone;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (hit.Z >= fc)
|
else if (hit.Z >= fc)
|
||||||
|
@ -457,11 +476,24 @@ bool FTraceInfo::LineCheck(intercept_t *in)
|
||||||
Results->HitType = TRACE_HitCeiling;
|
Results->HitType = TRACE_HitCeiling;
|
||||||
Results->HitTexture = CurSector->GetTexture(sector_t::ceiling);
|
Results->HitTexture = CurSector->GetTexture(sector_t::ceiling);
|
||||||
}
|
}
|
||||||
else if (entersector == NULL || entersector->PortalBlocksMovement(sector_t::ceiling))
|
else
|
||||||
{
|
{
|
||||||
// hit beyond a portal plane. This needs to be taken care of by the trace spawned on the other side.
|
if ((TraceFlags & TRACE_ReportPortals) && lastceilingportalheight < fc)
|
||||||
Results->HitType = TRACE_HitNone;
|
{
|
||||||
return false;
|
lastceilingportalheight = fc;
|
||||||
|
if (TraceCallback != NULL)
|
||||||
|
{
|
||||||
|
// Todo: calculate the intersection point.
|
||||||
|
Results->HitType = TRACE_CrossingPortal;
|
||||||
|
TraceCallback(*Results, TraceCallbackData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (entersector == NULL || entersector->PortalBlocksMovement(sector_t::ceiling))
|
||||||
|
{
|
||||||
|
// hit beyond a portal plane. This needs to be taken care of by the trace spawned on the other side.
|
||||||
|
Results->HitType = TRACE_HitNone;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (in->d.line->isLinePortal())
|
else if (in->d.line->isLinePortal())
|
||||||
|
|
|
@ -50,7 +50,8 @@ enum ETraceResult
|
||||||
TRACE_HitFloor,
|
TRACE_HitFloor,
|
||||||
TRACE_HitCeiling,
|
TRACE_HitCeiling,
|
||||||
TRACE_HitWall,
|
TRACE_HitWall,
|
||||||
TRACE_HitActor
|
TRACE_HitActor,
|
||||||
|
TRACE_CrossingPortal,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -113,6 +114,7 @@ enum
|
||||||
TRACE_PCross = 2, // Trigger SPAC_PCROSS lines
|
TRACE_PCross = 2, // Trigger SPAC_PCROSS lines
|
||||||
TRACE_Impact = 4, // Trigger SPAC_IMPACT lines
|
TRACE_Impact = 4, // Trigger SPAC_IMPACT lines
|
||||||
TRACE_PortalRestrict= 8, // Cannot go through portals without a static link offset.
|
TRACE_PortalRestrict= 8, // Cannot go through portals without a static link offset.
|
||||||
|
TRACE_ReportPortals = 16, // Report any portal crossing to the TraceCallback
|
||||||
};
|
};
|
||||||
|
|
||||||
// return values from callback
|
// return values from callback
|
||||||
|
|
|
@ -110,23 +110,22 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, double x, double y, int tag
|
||||||
{
|
{
|
||||||
va_list tags;
|
va_list tags;
|
||||||
va_start(tags, tags_first);
|
va_start(tags, tags_first);
|
||||||
DrawTextureV(img, x, y, tags_first, tags);
|
DrawParms parms;
|
||||||
|
|
||||||
|
if (!ParseDrawTextureTags(img, x, y, tags_first, tags, &parms, false))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DrawTextureParms(img, x, y, parms);
|
||||||
}
|
}
|
||||||
|
|
||||||
void STACK_ARGS DCanvas::DrawTextureV(FTexture *img, double x, double y, uint32 tag, va_list tags)
|
void DCanvas::DrawTextureParms(FTexture *img, double x, double y, DrawParms &parms)
|
||||||
{
|
{
|
||||||
#ifndef NO_SWRENDER
|
#ifndef NO_SWRENDER
|
||||||
FTexture::Span unmaskedSpan[2];
|
FTexture::Span unmaskedSpan[2];
|
||||||
const FTexture::Span **spanptr, *spans;
|
const FTexture::Span **spanptr, *spans;
|
||||||
static short bottomclipper[MAXWIDTH], topclipper[MAXWIDTH];
|
static short bottomclipper[MAXWIDTH], topclipper[MAXWIDTH];
|
||||||
|
|
||||||
DrawParms parms;
|
|
||||||
|
|
||||||
if (!ParseDrawTextureTags(img, x, y, tag, tags, &parms, false))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parms.masked)
|
if (parms.masked)
|
||||||
{
|
{
|
||||||
spanptr = &spans;
|
spanptr = &spans;
|
||||||
|
@ -171,6 +170,10 @@ void STACK_ARGS DCanvas::DrawTextureV(FTexture *img, double x, double y, uint32
|
||||||
|
|
||||||
BYTE *destorgsave = dc_destorg;
|
BYTE *destorgsave = dc_destorg;
|
||||||
dc_destorg = screen->GetBuffer();
|
dc_destorg = screen->GetBuffer();
|
||||||
|
if (dc_destorg == NULL)
|
||||||
|
{
|
||||||
|
I_FatalError("Attempt to write to buffer of hardware canvas");
|
||||||
|
}
|
||||||
|
|
||||||
double x0 = parms.x - parms.left * parms.destwidth / parms.texwidth;
|
double x0 = parms.x - parms.left * parms.destwidth / parms.texwidth;
|
||||||
double y0 = parms.y - parms.top * parms.destheight / parms.texheight;
|
double y0 = parms.y - parms.top * parms.destheight / parms.texheight;
|
||||||
|
@ -327,7 +330,7 @@ void STACK_ARGS DCanvas::DrawTextureV(FTexture *img, double x, double y, uint32
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag, va_list tags, DrawParms *parms, bool hw) const
|
bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag, va_list tags, DrawParms *parms, bool fortext) const
|
||||||
{
|
{
|
||||||
INTBOOL boolval;
|
INTBOOL boolval;
|
||||||
int intval;
|
int intval;
|
||||||
|
|
|
@ -138,6 +138,40 @@ struct FRemapTable;
|
||||||
class player_t;
|
class player_t;
|
||||||
typedef uint32 angle_t;
|
typedef uint32 angle_t;
|
||||||
|
|
||||||
|
struct DrawParms
|
||||||
|
{
|
||||||
|
double x, y;
|
||||||
|
double texwidth;
|
||||||
|
double texheight;
|
||||||
|
double destwidth;
|
||||||
|
double destheight;
|
||||||
|
double virtWidth;
|
||||||
|
double virtHeight;
|
||||||
|
double windowleft;
|
||||||
|
double windowright;
|
||||||
|
int dclip;
|
||||||
|
int uclip;
|
||||||
|
int lclip;
|
||||||
|
int rclip;
|
||||||
|
double top;
|
||||||
|
double left;
|
||||||
|
float Alpha;
|
||||||
|
uint32 fillcolor;
|
||||||
|
FRemapTable *remap;
|
||||||
|
const BYTE *translation;
|
||||||
|
uint32 colorOverlay;
|
||||||
|
INTBOOL alphaChannel;
|
||||||
|
INTBOOL flipX;
|
||||||
|
fixed_t shadowAlpha;
|
||||||
|
int shadowColor;
|
||||||
|
INTBOOL keepratio;
|
||||||
|
INTBOOL masked;
|
||||||
|
INTBOOL bilinear;
|
||||||
|
FRenderStyle style;
|
||||||
|
struct FSpecialColormap *specialcolormap;
|
||||||
|
struct FColormapStyle *colormapstyle;
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// VIDEO
|
// VIDEO
|
||||||
//
|
//
|
||||||
|
@ -223,40 +257,6 @@ public:
|
||||||
void DrawTextV (FFont *font, int normalcolor, int x, int y, const char *string, va_list tags);
|
void DrawTextV (FFont *font, int normalcolor, int x, int y, const char *string, va_list tags);
|
||||||
void STACK_ARGS DrawChar (FFont *font, int normalcolor, int x, int y, BYTE character, ...);
|
void STACK_ARGS DrawChar (FFont *font, int normalcolor, int x, int y, BYTE character, ...);
|
||||||
|
|
||||||
struct DrawParms
|
|
||||||
{
|
|
||||||
double x, y;
|
|
||||||
double texwidth;
|
|
||||||
double texheight;
|
|
||||||
double destwidth;
|
|
||||||
double destheight;
|
|
||||||
double virtWidth;
|
|
||||||
double virtHeight;
|
|
||||||
double windowleft;
|
|
||||||
double windowright;
|
|
||||||
int dclip;
|
|
||||||
int uclip;
|
|
||||||
int lclip;
|
|
||||||
int rclip;
|
|
||||||
double top;
|
|
||||||
double left;
|
|
||||||
float Alpha;
|
|
||||||
uint32 fillcolor;
|
|
||||||
FRemapTable *remap;
|
|
||||||
const BYTE *translation;
|
|
||||||
uint32 colorOverlay;
|
|
||||||
INTBOOL alphaChannel;
|
|
||||||
INTBOOL flipX;
|
|
||||||
fixed_t shadowAlpha;
|
|
||||||
int shadowColor;
|
|
||||||
INTBOOL keepratio;
|
|
||||||
INTBOOL masked;
|
|
||||||
INTBOOL bilinear;
|
|
||||||
FRenderStyle style;
|
|
||||||
struct FSpecialColormap *specialcolormap;
|
|
||||||
struct FColormapStyle *colormapstyle;
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BYTE *Buffer;
|
BYTE *Buffer;
|
||||||
int Width;
|
int Width;
|
||||||
|
@ -265,8 +265,9 @@ protected:
|
||||||
int LockCount;
|
int LockCount;
|
||||||
|
|
||||||
bool ClipBox (int &left, int &top, int &width, int &height, const BYTE *&src, const int srcpitch) const;
|
bool ClipBox (int &left, int &top, int &width, int &height, const BYTE *&src, const int srcpitch) const;
|
||||||
virtual void STACK_ARGS DrawTextureV (FTexture *img, double x, double y, uint32 tag, va_list tags);
|
void DrawTextureV(FTexture *img, double x, double y, uint32 tag, va_list tags) = delete;
|
||||||
bool ParseDrawTextureTags (FTexture *img, double x, double y, uint32 tag, va_list tags, DrawParms *parms, bool hw) const;
|
virtual void DrawTextureParms(FTexture *img, double x, double y, DrawParms &parms);
|
||||||
|
bool ParseDrawTextureTags (FTexture *img, double x, double y, uint32 tag, va_list tags, DrawParms *parms, bool fortext) const;
|
||||||
|
|
||||||
DCanvas() {}
|
DCanvas() {}
|
||||||
|
|
||||||
|
|
|
@ -2762,17 +2762,14 @@ void D3DFB::DrawPixel(int x, int y, int palcolor, uint32 color)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void STACK_ARGS D3DFB::DrawTextureV (FTexture *img, double x, double y, uint32 tags_first, va_list tags)
|
void D3DFB::DrawTextureParms (FTexture *img, double x, double y, DrawParms &parms)
|
||||||
{
|
{
|
||||||
if (In2D < 2)
|
if (In2D < 2)
|
||||||
{
|
{
|
||||||
Super::DrawTextureV(img, x, y, tags_first, tags);
|
Super::DrawTextureParms(img, x, y, parms);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!InScene)
|
||||||
DrawParms parms;
|
|
||||||
|
|
||||||
if (!InScene || !ParseDrawTextureTags(img, x, y, tags_first, tags, &parms, true))
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,7 @@ public:
|
||||||
void DrawBlendingRect ();
|
void DrawBlendingRect ();
|
||||||
FNativeTexture *CreateTexture (FTexture *gametex, bool wrapping);
|
FNativeTexture *CreateTexture (FTexture *gametex, bool wrapping);
|
||||||
FNativePalette *CreatePalette (FRemapTable *remap);
|
FNativePalette *CreatePalette (FRemapTable *remap);
|
||||||
void STACK_ARGS DrawTextureV (FTexture *img, double x, double y, uint32 tag, va_list tags);
|
void DrawTextureParms (FTexture *img, double x, double y, DrawParms &parms);
|
||||||
void Clear (int left, int top, int right, int bottom, int palcolor, uint32 color);
|
void Clear (int left, int top, int right, int bottom, int palcolor, uint32 color);
|
||||||
void Dim (PalEntry color, float amount, int x1, int y1, int w, int h);
|
void Dim (PalEntry color, float amount, int x1, int y1, int w, int h);
|
||||||
void FlatFill (int left, int top, int right, int bottom, FTexture *src, bool local_origin);
|
void FlatFill (int left, int top, int right, int bottom, FTexture *src, bool local_origin);
|
||||||
|
@ -370,7 +370,7 @@ private:
|
||||||
void DrawPackedTextures(int packnum);
|
void DrawPackedTextures(int packnum);
|
||||||
void DrawLetterbox();
|
void DrawLetterbox();
|
||||||
void Draw3DPart(bool copy3d);
|
void Draw3DPart(bool copy3d);
|
||||||
bool SetStyle(D3DTex *tex, DCanvas::DrawParms &parms, D3DCOLOR &color0, D3DCOLOR &color1, BufferedTris &quad);
|
bool SetStyle(D3DTex *tex, DrawParms &parms, D3DCOLOR &color0, D3DCOLOR &color1, BufferedTris &quad);
|
||||||
static D3DBLEND GetStyleAlpha(int type);
|
static D3DBLEND GetStyleAlpha(int type);
|
||||||
static void SetColorOverlay(DWORD color, float alpha, D3DCOLOR &color0, D3DCOLOR &color1);
|
static void SetColorOverlay(DWORD color, float alpha, D3DCOLOR &color0, D3DCOLOR &color1);
|
||||||
void DoWindowedGamma();
|
void DoWindowedGamma();
|
||||||
|
|
Loading…
Reference in a new issue