mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-01 08:31:14 +00:00
- added polyportal offset updates.
- removed the nodebuilder message for splitting polyobject subsectors because it is no longer relevant.
This commit is contained in:
parent
f27c762319
commit
3ed7a25d61
7 changed files with 82 additions and 13 deletions
|
@ -811,15 +811,6 @@ void FNodeBuilder::SplitSegs (DWORD set, node_t &node, DWORD splitseg, DWORD &ou
|
|||
unsigned int vertnum;
|
||||
int seg2;
|
||||
|
||||
if (seg->loopnum)
|
||||
{
|
||||
Printf (" Split seg %u (%d,%d)-(%d,%d) of sector %td in loop %d\n",
|
||||
set,
|
||||
Vertices[seg->v1].x>>16, Vertices[seg->v1].y>>16,
|
||||
Vertices[seg->v2].x>>16, Vertices[seg->v2].y>>16,
|
||||
seg->frontsector - sectors, seg->loopnum);
|
||||
}
|
||||
|
||||
frac = InterceptVector (node, *seg);
|
||||
newvert.x = Vertices[seg->v1].x;
|
||||
newvert.y = Vertices[seg->v1].y;
|
||||
|
|
|
@ -539,7 +539,7 @@ void P_SerializePolyobjs (FArchive &arc)
|
|||
arc << seg << po_NumPolyobjs;
|
||||
for(i = 0, po = polyobjs; i < po_NumPolyobjs; i++, po++)
|
||||
{
|
||||
arc << po->tag << po->Angle << po->StartSpot.pos << po->interpolation << po->bBlocked;
|
||||
arc << po->tag << po->Angle << po->StartSpot.pos << po->interpolation << po->bBlocked << po->bHasPortals;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -573,6 +573,14 @@ void P_SerializePolyobjs (FArchive &arc)
|
|||
{
|
||||
po->bBlocked = false;
|
||||
}
|
||||
if (SaveVersion >= 4538)
|
||||
{
|
||||
arc << po->bHasPortals;
|
||||
}
|
||||
else
|
||||
{
|
||||
po->bHasPortals = 0;
|
||||
}
|
||||
|
||||
po->RotatePolyobj (angle, true);
|
||||
delta -= po->StartSpot.pos;
|
||||
|
|
|
@ -425,6 +425,11 @@ bool EV_RotatePoly (line_t *line, int polyNum, int speed, int byteAngle,
|
|||
{ // poly is already in motion
|
||||
break;
|
||||
}
|
||||
if (poly->bHasPortals == 2)
|
||||
{
|
||||
// cannot do rotations on linked polyportals.
|
||||
break;
|
||||
}
|
||||
pe = new DRotatePoly(poly->tag);
|
||||
poly->specialdata = pe;
|
||||
poly->bBlocked = false;
|
||||
|
@ -476,6 +481,7 @@ void DMovePoly::Tick ()
|
|||
m_Speed = m_Dist * (m_Speed < 0 ? -1 : 1);
|
||||
m_Speedv = m_Angle.ToVector(m_Speed);
|
||||
}
|
||||
poly->UpdateLinks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -555,6 +561,7 @@ void DMovePolyTo::Tick ()
|
|||
m_Speed = m_Dist * (m_Speed < 0 ? -1 : 1);
|
||||
m_Speedv = m_Target - poly->StartSpot.pos;
|
||||
}
|
||||
poly->UpdateLinks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -649,6 +656,7 @@ void DPolyDoor::Tick ()
|
|||
Destroy ();
|
||||
}
|
||||
}
|
||||
poly->UpdateLinks();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -735,6 +743,12 @@ bool EV_OpenPolyDoor(line_t *line, int polyNum, double speed, DAngle angle, int
|
|||
{ // poly is already moving
|
||||
break;
|
||||
}
|
||||
if (poly->bHasPortals == 2 && type == PODOOR_SWING)
|
||||
{
|
||||
// cannot do rotations on linked polyportals.
|
||||
break;
|
||||
}
|
||||
|
||||
pd = new DPolyDoor(poly->tag, type);
|
||||
poly->specialdata = pd;
|
||||
if (type == PODOOR_SLIDE)
|
||||
|
@ -899,6 +913,36 @@ void FPolyObj::ThrustMobj (AActor *actor, side_t *side)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FPolyObj::UpdateLinks()
|
||||
{
|
||||
if (bHasPortals == 2)
|
||||
{
|
||||
TMap<int, bool> processed;
|
||||
for (unsigned i = 0; i < Linedefs.Size(); i++)
|
||||
{
|
||||
if (Linedefs[i]->isLinePortal())
|
||||
{
|
||||
FLinePortal *port = Linedefs[i]->getPortal();
|
||||
if (port->mType == PORTT_LINKED)
|
||||
{
|
||||
DVector2 old = port->mDisplacement;
|
||||
port->mDisplacement = port->mDestination->v2->fPos() - port->mOrigin->v1->fPos();
|
||||
FLinePortal *port2 = port->mDestination->getPortal();
|
||||
if (port2) port2->mDisplacement = -port->mDisplacement;
|
||||
int destgroup = port->mDestination->frontsector->PortalGroup;
|
||||
bool *done = processed.CheckKey(destgroup);
|
||||
if (!done || !*done)
|
||||
{
|
||||
processed[destgroup] = true;
|
||||
DVector2 delta = port->mDisplacement - old;
|
||||
Displacements.MoveGroup(destgroup, delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FPolyObj::UpdateBBox ()
|
||||
{
|
||||
for(unsigned i=0;i<Linedefs.Size(); i++)
|
||||
|
@ -1172,6 +1216,15 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ld->isLinePortal())
|
||||
{
|
||||
// Fixme: this still needs to figure out if the polyobject move made the player cross the portal line.
|
||||
if (P_TryMove(mobj, mobj->Pos(), false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// We have a two-sided linedef so we should only check one side
|
||||
// so that the thrust from both sides doesn't cancel each other out.
|
||||
// Best use the one facing the player and ignore the back side.
|
||||
|
@ -1496,6 +1549,8 @@ static void SpawnPolyobj (int index, int tag, int type)
|
|||
{
|
||||
continue;
|
||||
}
|
||||
po->bBlocked = false;
|
||||
po->bHasPortals = 0;
|
||||
|
||||
side_t *sd = &sides[i];
|
||||
|
||||
|
@ -1563,6 +1618,12 @@ static void SpawnPolyobj (int index, int tag, int type)
|
|||
|
||||
if (l->validcount != validcount)
|
||||
{
|
||||
FLinePortal *port = l->getPortal();
|
||||
if (port && (port->mDefFlags & PORTF_PASSABLE))
|
||||
{
|
||||
int type = port->mType == PORTT_LINKED ? 2 : 1;
|
||||
if (po->bHasPortals < type) po->bHasPortals = (BYTE)type;
|
||||
}
|
||||
l->validcount = validcount;
|
||||
po->Linedefs.Push(l);
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ struct FPolyObj
|
|||
int crush; // should the polyobj attempt to crush mobjs?
|
||||
bool bHurtOnTouch; // should the polyobj hurt anything it touches?
|
||||
bool bBlocked;
|
||||
BYTE bHasPortals; // 1 for any portal, 2 for a linked portal (2 must block rotations.)
|
||||
int seqType;
|
||||
double Size; // polyobj size (area of POLY_AREAUNIT == size of FRACUNIT)
|
||||
FPolyNode *subsectorlinks;
|
||||
|
@ -82,6 +83,7 @@ struct FPolyObj
|
|||
void CreateSubsectorLinks();
|
||||
void ClearSubsectorLinks();
|
||||
void CalcCenter();
|
||||
void UpdateLinks();
|
||||
static void ClearAllSubsectorLinks();
|
||||
|
||||
private:
|
||||
|
|
|
@ -384,8 +384,7 @@ void P_UpdatePortal(FLinePortal *port)
|
|||
}
|
||||
else
|
||||
{
|
||||
port->mDisplacement.X = port->mDestination->v2->fX() - port->mOrigin->v1->fX();
|
||||
port->mDisplacement.Y = port->mDestination->v2->fY() - port->mOrigin->v1->fY();
|
||||
port->mDisplacement = port->mDestination->v2->fPos() - port->mOrigin->v1->fPos();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,14 @@ struct FDisplacementTable
|
|||
return data[x + size*y].pos;
|
||||
}
|
||||
|
||||
void MoveGroup(int grp, DVector2 delta)
|
||||
{
|
||||
for (int i = 1; i < size; i++)
|
||||
{
|
||||
data[grp + size*i].pos -= delta;
|
||||
data[i + grp*size].pos += delta;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
extern FDisplacementTable Displacements;
|
||||
|
|
|
@ -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 4537
|
||||
#define SAVEVER 4538
|
||||
|
||||
#define SAVEVERSTRINGIFY2(x) #x
|
||||
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)
|
||||
|
|
Loading…
Reference in a new issue