- split P_SetupLevel so that the main part of it can be made part of the MapLoader class.

- allocate BlockNodes from the same memory arena as SecNodes.
This commit is contained in:
Christoph Oelckers 2018-12-27 23:34:07 +01:00
commit 467c73b2d7
5 changed files with 348 additions and 472 deletions

View file

@ -444,3 +444,39 @@ void AActor::ClearRenderLineList()
P_DelSeclist(touching_lineportallist, &FLinePortal::lineportal_thinglist);
touching_lineportallist = nullptr;
}
//===========================================================================
//
// FBlockNode - allows to link actors into multiple blocks in the blockmap
//
//===========================================================================
FBlockNode *FBlockNode::FreeBlocks = nullptr;
FBlockNode *FBlockNode::Create(AActor *who, int x, int y, int group)
{
FBlockNode *block;
if (FreeBlocks != nullptr)
{
block = FreeBlocks;
FreeBlocks = block->NextBlock;
}
else
{
block = (FBlockNode *)secnodearena.Alloc(sizeof(FBlockNode));
}
block->BlockIndex = x + y * level.blockmap.bmapwidth;
block->Me = who;
block->NextActor = nullptr;
block->PrevActor = nullptr;
block->PrevBlock = nullptr;
block->NextBlock = nullptr;
return block;
}
void FBlockNode::Release()
{
NextBlock = FreeBlocks;
FreeBlocks = this;
}