- 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:
parent
5723f10cc3
commit
04ff4282ef
14 changed files with 95 additions and 107 deletions
|
|
@ -242,9 +242,9 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, co
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void AActor::UnlinkFromWorld ()
|
||||
void AActor::UnlinkFromWorld (FLinkContext *ctx)
|
||||
{
|
||||
sector_list = NULL;
|
||||
if (ctx != nullptr) ctx->sector_list = nullptr;
|
||||
if (!(flags & MF_NOSECTOR))
|
||||
{
|
||||
// invisible things don't need to be in sector list
|
||||
|
|
@ -275,7 +275,8 @@ void AActor::UnlinkFromWorld ()
|
|||
// If this Thing is being removed entirely, then the calling
|
||||
// routine will clear out the nodes in sector_list.
|
||||
|
||||
sector_list = touching_sectorlist;
|
||||
if (ctx != nullptr) ctx->sector_list = touching_sectorlist;
|
||||
else P_DelSeclist(touching_sectorlist);
|
||||
touching_sectorlist = NULL; //to be restored by P_SetThingPosition
|
||||
|
||||
P_UnlinkRenderSectors(this);
|
||||
|
|
@ -390,7 +391,7 @@ bool AActor::FixMapthingPos()
|
|||
DEFINE_ACTION_FUNCTION(AActor, UnlinkFromWorld)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
self->UnlinkFromWorld();
|
||||
self->UnlinkFromWorld(nullptr); // fixme
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -403,7 +404,7 @@ DEFINE_ACTION_FUNCTION(AActor, UnlinkFromWorld)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector)
|
||||
void AActor::LinkToWorld(FLinkContext *ctx, bool spawningmapthing, sector_t *sector)
|
||||
{
|
||||
bool spawning = spawningmapthing;
|
||||
|
||||
|
|
@ -455,9 +456,7 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector)
|
|||
// When a node is deleted, its sector links (the links starting
|
||||
// at sector_t->touching_thinglist) are broken. When a node is
|
||||
// added, new sector links are created.
|
||||
P_CreateSecNodeList(this);
|
||||
touching_sectorlist = sector_list; // Attach to thing
|
||||
sector_list = NULL; // clear for next time
|
||||
touching_sectorlist = P_CreateSecNodeList(this, ctx != nullptr? ctx->sector_list : nullptr); // Attach to thing
|
||||
|
||||
P_LinkRenderSectors(this);
|
||||
}
|
||||
|
|
@ -522,15 +521,16 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector)
|
|||
DEFINE_ACTION_FUNCTION(AActor, LinkToWorld)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
self->LinkToWorld();
|
||||
self->LinkToWorld(nullptr); // fixme
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AActor::SetOrigin(double x, double y, double z, bool moving)
|
||||
{
|
||||
UnlinkFromWorld ();
|
||||
FLinkContext ctx;
|
||||
UnlinkFromWorld (&ctx);
|
||||
SetXYZ(x, y, z);
|
||||
LinkToWorld ();
|
||||
LinkToWorld (&ctx);
|
||||
P_FindFloorCeiling(this, FFCF_ONLYSPAWNPOS);
|
||||
if (!moving) ClearInterpolation();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue