- removed the global 'sector_list' variable.

If the calling code wants to recycle this it will have to pass a container variable to AActor::UnlinkFromWorld and AActor::LinkToWorld.
This was changed because keeping such data in a global variable is dangerous for a set of functions that can be called from a script.
Note that the scripted versions do not yet support saving of the touching_sectorlist.
This commit is contained in:
Christoph Oelckers 2016-12-25 22:40:26 +01:00
commit 04ff4282ef
14 changed files with 95 additions and 107 deletions

View file

@ -82,9 +82,6 @@ static FRandom pr_crunch("DoCrunch");
TArray<spechit_t> spechit;
TArray<spechit_t> portalhit;
// Temporary holder for thing_sectorlist threads
msecnode_t* sector_list = NULL; // phares 3/16/98
//==========================================================================
//
// FindRefPoint
@ -2390,10 +2387,11 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
FLinePortal *port = ld->getPortal();
if (port->mType == PORTT_LINKED)
{
thing->UnlinkFromWorld();
FLinkContext ctx;
thing->UnlinkFromWorld(&ctx);
thing->SetXY(tm.pos + port->mDisplacement);
thing->Prev += port->mDisplacement;
thing->LinkToWorld();
thing->LinkToWorld(&ctx);
P_FindFloorCeiling(thing);
portalcrossed = true;
tm.portalstep = false;
@ -2414,11 +2412,12 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
thing->flags6 &= ~MF6_INTRYMOVE;
return false;
}
thing->UnlinkFromWorld();
FLinkContext ctx;
thing->UnlinkFromWorld(&ctx);
thing->SetXYZ(pos);
P_TranslatePortalVXVY(ld, thing->Vel.X, thing->Vel.Y);
P_TranslatePortalAngle(ld, thing->Angles.Yaw);
thing->LinkToWorld();
thing->LinkToWorld(&ctx);
P_FindFloorCeiling(thing);
thing->ClearInterpolation();
portalcrossed = true;
@ -2459,7 +2458,8 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
if (!portalcrossed)
{
// the move is ok, so link the thing into its new position
thing->UnlinkFromWorld();
FLinkContext ctx;
thing->UnlinkFromWorld(&ctx);
oldsector = thing->Sector;
thing->floorz = tm.floorz;
@ -2472,7 +2472,7 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
thing->ceilingsector = tm.ceilingsector;
thing->SetXY(pos);
thing->LinkToWorld();
thing->LinkToWorld(&ctx);
}
if (thing->flags2 & MF2_FLOORCLIP)
@ -2565,13 +2565,14 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
// If the actor stepped through a ceiling portal we need to reacquire the actual position info after the transition
if (tm.portalstep)
{
FLinkContext ctx;
DVector3 oldpos = thing->Pos();
thing->UnlinkFromWorld();
thing->UnlinkFromWorld(&ctx);
thing->SetXYZ(thing->PosRelative(thing->Sector->GetOppositePortalGroup(sector_t::ceiling)));
thing->Prev = thing->Pos() - oldpos;
thing->Sector = P_PointInSector(thing->Pos());
thing->PrevPortalGroup = thing->Sector->PortalGroup;
thing->LinkToWorld();
thing->LinkToWorld(&ctx);
P_FindFloorCeiling(thing);
}
@ -6532,23 +6533,6 @@ msecnode_t *P_DelSecnode(msecnode_t *node, msecnode_t *sector_t::*listhead)
return NULL;
} // phares 3/13/98
//=============================================================================
//
// P_DelSector_List
//
// Deletes the sector_list and NULLs it.
//
//=============================================================================
void P_DelSector_List()
{
if (sector_list != NULL)
{
P_DelSeclist(sector_list);
sector_list = NULL;
}
}
//=============================================================================
//
// P_DelSeclist
@ -6572,7 +6556,7 @@ void P_DelSeclist(msecnode_t *node)
//
//=============================================================================
void P_CreateSecNodeList(AActor *thing)
msecnode_t *P_CreateSecNodeList(AActor *thing, msecnode_t *sector_list)
{
msecnode_t *node;
@ -6638,6 +6622,7 @@ void P_CreateSecNodeList(AActor *thing)
node = node->m_tnext;
}
}
return sector_list;
}