mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-25 05:11:04 +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
|
||||
public:
|
||||
DMover (sector_t *sector);
|
||||
void StopInterpolation(bool force = false);
|
||||
protected:
|
||||
TObjPtr<DInterpolation> interpolation;
|
||||
private:
|
||||
|
@ -33,7 +34,6 @@ protected:
|
|||
DMover ();
|
||||
void Serialize (FArchive &arc);
|
||||
void Destroy();
|
||||
void StopInterpolation(bool force = false);
|
||||
};
|
||||
|
||||
class DMovingFloor : public DMover
|
||||
|
|
|
@ -859,8 +859,8 @@ void FArchive::WriteString(const FString &str)
|
|||
{
|
||||
// The count includes the '\0' terminator, but we don't
|
||||
// actually write it out.
|
||||
WriteCount(str.Len() + 1);
|
||||
Write(str, str.Len());
|
||||
WriteCount(DWORD(str.Len() + 1));
|
||||
Write(str, DWORD(str.Len()));
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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 = §ors[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(§ors[secnum], DFloor::floorMoveToValue, NULL, platspeed, destheight, crush, 0, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
int secnum = -1;
|
||||
sector_t *sec;
|
||||
int tagnum;
|
||||
double platspeed = 1, destheight;
|
||||
int crush;
|
||||
|
@ -1780,11 +1711,7 @@ void FParser::SF_MoveCeiling(void)
|
|||
FSSectorTagIterator itr(tagnum);
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
{
|
||||
sec = §ors[secnum];
|
||||
|
||||
// Don't start a second thinker on the same floor
|
||||
if (sec->ceilingdata) continue;
|
||||
new DMoveCeiling(sec, tagnum, destheight, platspeed, silent, crush);
|
||||
P_CreateCeiling(§ors[secnum], DCeiling::ceilMoveToValue, NULL, tagnum, platspeed, platspeed, destheight, crush, silent | 4, 0, DCeiling::ECrushMode::crushDoom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ struct svalue_t
|
|||
|
||||
void setDouble(double dp)
|
||||
{
|
||||
value.f = fsfix(dp/65536);
|
||||
value.f = fsfix(dp * 65536);
|
||||
type = svt_fixed;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -93,7 +93,7 @@ double floatvalue(const svalue_t &v)
|
|||
{
|
||||
return
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -257,40 +257,40 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
|
|||
}
|
||||
|
||||
// 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;
|
||||
|
||||
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;
|
||||
|
@ -413,6 +413,7 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line,
|
|||
if (ceiling->m_Speed >= movedist)
|
||||
{
|
||||
ceiling->StopInterpolation(true);
|
||||
if (silent & 4) ceiling->m_Silent = 2;
|
||||
}
|
||||
|
||||
// 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
|
||||
//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)
|
||||
|
@ -437,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;
|
||||
}
|
||||
}
|
||||
|
@ -456,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;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
@ -501,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.
|
||||
|
@ -515,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;
|
||||
}
|
||||
|
|
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
|
||||
|
@ -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)
|
||||
{
|
||||
int secnum;
|
||||
bool rtn;
|
||||
sector_t* sec;
|
||||
DFloor* floor;
|
||||
double ceilingheight;
|
||||
double newheight;
|
||||
vertex_t *spot, *spot2;
|
||||
|
||||
rtn = false;
|
||||
bool rtn = false;
|
||||
|
||||
// check if a manual trigger; if so do just the sector on the backside
|
||||
FSectorTagIterator it(tag, line);
|
||||
while ((secnum = it.Next()) >= 0)
|
||||
{
|
||||
sec = §ors[secnum];
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
rtn |= P_CreateFloor(§ors[secnum], floortype, line, speed, height, crush, change, hexencrush, hereticlower);
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
|
|
@ -4463,10 +4463,17 @@ struct SRailHit
|
|||
DVector3 HitPos;
|
||||
DAngle HitAngle;
|
||||
};
|
||||
struct SPortalHit
|
||||
{
|
||||
DVector3 HitPos;
|
||||
DVector3 ContPos;
|
||||
DVector3 OutDir;
|
||||
};
|
||||
struct RailData
|
||||
{
|
||||
AActor *Caller;
|
||||
TArray<SRailHit> RailHits;
|
||||
TArray<SPortalHit> PortalHits;
|
||||
bool StopAtOne;
|
||||
bool StopAtInvul;
|
||||
bool ThruSpecies;
|
||||
|
@ -4475,6 +4482,16 @@ struct RailData
|
|||
static ETraceStatus ProcessRailHit(FTraceResults &res, void *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)
|
||||
{
|
||||
return TRACE_Stop;
|
||||
|
@ -4559,7 +4576,8 @@ void P_RailAttack(FRailParams *p)
|
|||
assert(puffclass != NULL); // Because we set it to a default above
|
||||
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.ThruSpecies = (puffDefaults->flags6 & MF6_MTHRUSPECIES) ? true : false;
|
||||
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)
|
||||
mobj->Scale.X = mthing->Scale.X * mobj->Scale.X;
|
||||
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)
|
||||
mobj->Angles.Pitch = (double)mthing->pitch;
|
||||
if (mthing->roll)
|
||||
|
|
13
src/p_spec.h
13
src/p_spec.h
|
@ -572,10 +572,6 @@ public:
|
|||
void Serialize (FArchive &arc);
|
||||
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:
|
||||
ECeiling m_Type;
|
||||
double m_BottomHeight;
|
||||
|
@ -601,13 +597,13 @@ protected:
|
|||
private:
|
||||
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 void P_ActivateInStasisCeiling (int tag);
|
||||
};
|
||||
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
bool EV_CeilingCrushStop (int tag);
|
||||
void P_ActivateInStasisCeiling (int tag);
|
||||
|
@ -711,6 +707,9 @@ private:
|
|||
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,
|
||||
double stairsize, double speed, int delay, int reset, int igntxt,
|
||||
int usespecials);
|
||||
|
|
|
@ -66,6 +66,8 @@ struct FTraceInfo
|
|||
double startfrac;
|
||||
int aimdir;
|
||||
double limitz;
|
||||
double lastfloorportalheight;
|
||||
double lastceilingportalheight;
|
||||
|
||||
// These are required for 3D-floor checking
|
||||
// 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.aimdir = -1;
|
||||
inf.startfrac = 0;
|
||||
inf.lastfloorportalheight = inf.lastceilingportalheight = start.Z;
|
||||
memset(&res, 0, sizeof(res));
|
||||
|
||||
if (inf.TraceTraverse (ptflags))
|
||||
|
@ -196,6 +199,7 @@ void FTraceInfo::EnterSectorPortal(int position, double frac, sector_t *entersec
|
|||
newtrace.aimdir = position;
|
||||
newtrace.limitz = portal->specialf1;
|
||||
newtrace.sectorsel = 0;
|
||||
newtrace.lastfloorportalheight = newtrace.lastceilingportalheight = limitz;
|
||||
|
||||
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;
|
||||
double enterdist = MaxDist / frac;
|
||||
DVector2 enter = newtrace.Start.XY() + enterdist * Vec.XY();
|
||||
DVector2 enter = newtrace.Start + enterdist * Vec;
|
||||
|
||||
newtrace.ActorMask = ActorMask;
|
||||
newtrace.WallMask = WallMask;
|
||||
|
@ -244,7 +248,9 @@ int FTraceInfo::EnterLinePortal(line_t *li, double frac)
|
|||
newtrace.startfrac = frac;
|
||||
newtrace.aimdir = aimdir;
|
||||
newtrace.limitz = limitz;
|
||||
|
||||
P_TranslatePortalZ(li, newtrace.limitz);
|
||||
newtrace.lastfloorportalheight = newtrace.lastceilingportalheight = newtrace.limitz;
|
||||
newtrace.sectorsel = 0;
|
||||
Results->unlinked = true;
|
||||
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->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.
|
||||
Results->HitType = TRACE_HitNone;
|
||||
return false;
|
||||
if ((TraceFlags & TRACE_ReportPortals) && lastfloorportalheight > fc)
|
||||
{
|
||||
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)
|
||||
|
@ -457,11 +476,24 @@ bool FTraceInfo::LineCheck(intercept_t *in)
|
|||
Results->HitType = TRACE_HitCeiling;
|
||||
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.
|
||||
Results->HitType = TRACE_HitNone;
|
||||
return false;
|
||||
if ((TraceFlags & TRACE_ReportPortals) && lastceilingportalheight < fc)
|
||||
{
|
||||
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())
|
||||
|
|
|
@ -50,7 +50,8 @@ enum ETraceResult
|
|||
TRACE_HitFloor,
|
||||
TRACE_HitCeiling,
|
||||
TRACE_HitWall,
|
||||
TRACE_HitActor
|
||||
TRACE_HitActor,
|
||||
TRACE_CrossingPortal,
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -113,6 +114,7 @@ enum
|
|||
TRACE_PCross = 2, // Trigger SPAC_PCROSS lines
|
||||
TRACE_Impact = 4, // Trigger SPAC_IMPACT lines
|
||||
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
|
||||
|
|
|
@ -110,23 +110,22 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, double x, double y, int tag
|
|||
{
|
||||
va_list tags;
|
||||
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
|
||||
FTexture::Span unmaskedSpan[2];
|
||||
const FTexture::Span **spanptr, *spans;
|
||||
static short bottomclipper[MAXWIDTH], topclipper[MAXWIDTH];
|
||||
|
||||
DrawParms parms;
|
||||
|
||||
if (!ParseDrawTextureTags(img, x, y, tag, tags, &parms, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (parms.masked)
|
||||
{
|
||||
spanptr = &spans;
|
||||
|
@ -171,6 +170,10 @@ void STACK_ARGS DCanvas::DrawTextureV(FTexture *img, double x, double y, uint32
|
|||
|
||||
BYTE *destorgsave = dc_destorg;
|
||||
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 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
|
||||
}
|
||||
|
||||
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;
|
||||
int intval;
|
||||
|
|
|
@ -138,6 +138,40 @@ struct FRemapTable;
|
|||
class player_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
|
||||
//
|
||||
|
@ -223,40 +257,6 @@ public:
|
|||
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, ...);
|
||||
|
||||
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:
|
||||
BYTE *Buffer;
|
||||
int Width;
|
||||
|
@ -265,8 +265,9 @@ protected:
|
|||
int LockCount;
|
||||
|
||||
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);
|
||||
bool ParseDrawTextureTags (FTexture *img, double x, double y, uint32 tag, va_list tags, DrawParms *parms, bool hw) const;
|
||||
void DrawTextureV(FTexture *img, double x, double y, uint32 tag, va_list tags) = delete;
|
||||
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() {}
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
Super::DrawTextureV(img, x, y, tags_first, tags);
|
||||
Super::DrawTextureParms(img, x, y, parms);
|
||||
return;
|
||||
}
|
||||
|
||||
DrawParms parms;
|
||||
|
||||
if (!InScene || !ParseDrawTextureTags(img, x, y, tags_first, tags, &parms, true))
|
||||
if (!InScene)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -257,7 +257,7 @@ public:
|
|||
void DrawBlendingRect ();
|
||||
FNativeTexture *CreateTexture (FTexture *gametex, bool wrapping);
|
||||
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 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);
|
||||
|
@ -370,7 +370,7 @@ private:
|
|||
void DrawPackedTextures(int packnum);
|
||||
void DrawLetterbox();
|
||||
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 void SetColorOverlay(DWORD color, float alpha, D3DCOLOR &color0, D3DCOLOR &color1);
|
||||
void DoWindowedGamma();
|
||||
|
|
Loading…
Reference in a new issue