diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 38122b977d..050e4ae76e 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -540,6 +540,14 @@ void P_SerializePolyobjs (FArchive &arc) for(i = 0, po = polyobjs; i < po_NumPolyobjs; i++, po++) { arc << po->tag << po->Angle << po->StartSpot.pos << po->interpolation; + if (SaveVersion >= 4537) + { + arc << po->bBlocked; + } + else + { + po->bBlocked = false; + } } } else diff --git a/src/po_man.cpp b/src/po_man.cpp index b6921b0d4d..f2029026d0 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -421,12 +421,13 @@ bool EV_RotatePoly (line_t *line, int polyNum, int speed, int byteAngle, while ((poly = it.NextMirror()) != NULL) { - if (poly->specialdata != NULL && !overRide) + if ((poly->specialdata != NULL || poly->bBlocked) && !overRide) { // poly is already in motion break; } pe = new DRotatePoly(poly->tag); poly->specialdata = pe; + poly->bBlocked = false; if (byteAngle != 0) { if (byteAngle == 255) @@ -501,12 +502,13 @@ bool EV_MovePoly (line_t *line, int polyNum, double speed, DAngle angle, while ((poly = it.NextMirror()) != NULL) { - if (poly->specialdata != NULL && !overRide) + if ((poly->specialdata != NULL || poly->bBlocked) && !overRide) { // poly is already in motion break; } pe = new DMovePoly(poly->tag); poly->specialdata = pe; + poly->bBlocked = false; pe->m_Dist = dist; // Distance pe->m_Speed = speed; pe->m_Angle = angle; @@ -581,12 +583,13 @@ bool EV_MovePolyTo(line_t *line, int polyNum, double speed, const DVector2 &targ distlen = dist.MakeUnit(); while ((poly = it.NextMirror()) != NULL) { - if (poly->specialdata != NULL && !overRide) + if ((poly->specialdata != NULL || poly->bBlocked) && !overRide) { // poly is already in motion break; } pe = new DMovePolyTo(poly->tag); poly->specialdata = pe; + poly->bBlocked = false; pe->m_Dist = distlen; pe->m_Speed = speed; pe->m_Speedv = dist * speed; @@ -630,7 +633,7 @@ void DPolyDoor::Tick () if (m_Dist <= 0) { SN_StopSequence (poly); - if (!m_Close) + if (!m_Close && m_WaitTics >= 0) { m_Dist = m_TotalDist; m_Close = true; @@ -640,6 +643,9 @@ void DPolyDoor::Tick () } else { + // if set to wait infinitely, Hexen kept the dead thinker to block the polyobject from getting activated again but that causes some problems + // with the subsectorlinks and the interpolation. Better delete the thinker and use a different means to block it. + if (!m_Close) poly->bBlocked = true; Destroy (); } } @@ -669,7 +675,7 @@ void DPolyDoor::Tick () if (m_Dist <= 0) { SN_StopSequence (poly); - if (!m_Close) + if (!m_Close && m_WaitTics >= 0) { m_Dist = m_TotalDist; m_Close = true; @@ -678,6 +684,7 @@ void DPolyDoor::Tick () } else { + if (!m_Close) poly->bBlocked = true; Destroy (); } } @@ -724,7 +731,7 @@ bool EV_OpenPolyDoor(line_t *line, int polyNum, double speed, DAngle angle, int while ((poly = it.NextMirror()) != NULL) { - if (poly->specialdata != NULL) + if ((poly->specialdata != NULL || poly->bBlocked)) { // poly is already moving break; } @@ -815,6 +822,7 @@ FPolyObj::FPolyObj() bHurtOnTouch = false; seqType = 0; Size = 0; + bBlocked = false; subsectorlinks = NULL; specialdata = NULL; interpolation = NULL; diff --git a/src/po_man.h b/src/po_man.h index 2fbc433cf5..2b9c8afeff 100644 --- a/src/po_man.h +++ b/src/po_man.h @@ -62,6 +62,7 @@ struct FPolyObj int validcount; int crush; // should the polyobj attempt to crush mobjs? bool bHurtOnTouch; // should the polyobj hurt anything it touches? + bool bBlocked; int seqType; double Size; // polyobj size (area of POLY_AREAUNIT == size of FRACUNIT) FPolyNode *subsectorlinks; diff --git a/src/version.h b/src/version.h index 3a79f24c7c..a824525c9e 100644 --- a/src/version.h +++ b/src/version.h @@ -76,7 +76,7 @@ const char *GetVersionString(); // Use 4500 as the base git save version, since it's higher than the // SVN revision ever got. -#define SAVEVER 4536 +#define SAVEVER 4537 #define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)