- use msecnode_t's for the touching_renderlists instead of std::forward_list.

- preparations for checking the proper sector to get a sprite's lighting info.
This commit is contained in:
Christoph Oelckers 2016-12-26 11:58:08 +01:00
commit 7f72de6b71
10 changed files with 55 additions and 141 deletions

View file

@ -271,15 +271,19 @@ void AActor::UnlinkFromWorld (FLinkContext *ctx)
// put it back into touching_sectorlist. It's done this way to
// avoid a lot of deleting/creating for nodes, when most of the
// time you just get back what you deleted anyway.
//
// If this Thing is being removed entirely, then the calling
// routine will clear out the nodes in sector_list.
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);
if (ctx != nullptr)
{
ctx->sector_list = touching_sectorlist;
ctx->render_list = touching_rendersectors;
}
else
{
P_DelSeclist(touching_sectorlist, &sector_t::touching_thinglist);
P_DelSeclist(touching_rendersectors, &sector_t::touching_renderthings);
}
touching_sectorlist = nullptr; //to be restored by P_SetThingPosition
touching_rendersectors = nullptr;
}
}
@ -456,9 +460,13 @@ void AActor::LinkToWorld(FLinkContext *ctx, bool spawningmapthing, sector_t *sec
// 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.
touching_sectorlist = P_CreateSecNodeList(this, ctx != nullptr? ctx->sector_list : nullptr); // Attach to thing
P_LinkRenderSectors(this);
touching_sectorlist = P_CreateSecNodeList(this, radius, ctx != nullptr? ctx->sector_list : nullptr, &sector_t::touching_thinglist); // Attach to thing
if (renderradius >= 0) touching_rendersectors = P_CreateSecNodeList(this, MAX(radius, renderradius), ctx != nullptr ? ctx->render_list : nullptr, &sector_t::touching_renderthings);
else
{
touching_rendersectors = nullptr;
if (ctx != nullptr) P_DelSeclist(ctx->render_list, &sector_t::touching_renderthings);
}
}