Added client-side Thinkers

Adds support for client-side Thinkers, Actors, and ACS scripts (ACS uses the existing CLIENTSIDE keyword). These will tick regardless of the network state allowing for localized client handling and are put in their own separate lists so they can't be accidentally accessed by server code. They currently aren't serialized since this would have no meaning for other clients in the game that would get saved. Other logic like the menu, console, HUD, and particles have also been moved to client-side ticking to prevent them from becoming locked up by poor network conditions. Additionally, screenshotting and the automap are now handled immediately instead of having to wait for any game tick to run first, making them free of net lag.
This commit is contained in:
Boondorl 2024-11-09 22:18:04 -05:00 committed by Ricardo Luís Vaz Silva
commit f7e62a8cd6
28 changed files with 507 additions and 215 deletions

View file

@ -457,7 +457,7 @@ void G_NewInit ()
int i;
// Destory all old player refrences that may still exist
TThinkerIterator<AActor> it(primaryLevel, NAME_PlayerPawn, STAT_TRAVELLING);
TThinkerIterator<AActor> it(primaryLevel, NAME_PlayerPawn, STAT_TRAVELLING, false);
AActor *pawn, *next;
next = it.Next();
@ -473,6 +473,7 @@ void G_NewInit ()
// Destroy thinkers that may remain after change level failure
// Usually, the list contains just a sentinel when such error occurred
primaryLevel->Thinkers.DestroyThinkersInList(STAT_TRAVELLING);
primaryLevel->ClientsideThinkers.DestroyThinkersInList(STAT_TRAVELLING); // This isn't currently supported, but maybe in the future
G_ClearSnapshots ();
netgame = false;
@ -586,6 +587,7 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
for (auto Level : AllLevels())
{
Level->Thinkers.DestroyThinkersInList(STAT_STATIC);
Level->ClientsideThinkers.DestroyThinkersInList(STAT_STATIC);
}
if (paused)
@ -1780,6 +1782,7 @@ int FLevelLocals::FinishTravel ()
// Since this list is excluded from regular thinker cleaning, anything that may survive through here
// will endlessly multiply and severely break the following savegames or just simply crash on broken pointers.
Thinkers.DestroyThinkersInList(STAT_TRAVELLING);
ClientsideThinkers.DestroyThinkersInList(STAT_TRAVELLING);
return failnum;
}
@ -2284,6 +2287,7 @@ void FLevelLocals::Mark()
GC::Mark(SpotState);
GC::Mark(FraggleScriptThinker);
GC::Mark(ACSThinker);
GC::Mark(ClientSideACSThinker);
GC::Mark(automap);
GC::Mark(interpolator.Head);
GC::Mark(SequenceListHead);
@ -2296,6 +2300,7 @@ void FLevelLocals::Mark()
GC::Mark(localEventManager->LastEventHandler);
}
Thinkers.MarkRoots();
ClientsideThinkers.MarkRoots();
canvasTextureInfo.Mark();
for (auto &c : CorpseQueue)
{