Reworked Travelling logic

Added safety barriers for STAT_STATIC and STAT_TRAVELLING to avoid potential exploits. Properly clear all internal fields pointing towards non-read barriered data and always relink properly when finishing travelling. Moved ZScript callback to after travelling has finished for all Thinkers, that way everything is initialized correctly.  Allow arbitrary thinkers (excluding native ones) to be added to the travelling list (for Actors, their positioning will need to be handled by modders). Ensure lights get re-enabled after travelling.
This commit is contained in:
Boondorl 2025-07-10 13:29:59 -04:00 committed by Ricardo Luís Vaz Silva
commit d7d71177d7
10 changed files with 302 additions and 191 deletions

View file

@ -290,14 +290,6 @@ void FLevelLocals::ClearPortals()
void FLevelLocals::ClearLevelData(bool fullgc)
{
{
auto it = GetThinkerIterator<AActor>(NAME_None, STAT_TRAVELLING);
for (AActor *actor = it.Next(); actor != nullptr; actor = it.Next())
{
actor->BlockingMobj = nullptr;
actor->BlockingLine = actor->MovementBlockingLine = nullptr;
actor->BlockingFloor = actor->BlockingCeiling = actor->Blocking3DFloor = nullptr;
}
// Make sure map data gets cleared appropriately so any leftover Objects aren't pointing
// towards anything invalid.
FName fieldTypes[] = { NAME_SectorPortal, NAME_LinePortal, NAME_Vertex, NAME_Side, NAME_Line, NAME_SecPlane, NAME_F3DFloor, NAME_Sector };