This had two different flags that were checked totally inconsistently, and one was not even saved.
Moved everything into a few subfunctions so that these checks do not have to be scattered all over the code.
There is no need to do this deep inside the renderer where it required code duplication and made it problematic to execute on multiple levels.
This is now being done before and after the top level call into the renderer in d_main.cpp.
This also serializes the interpolator itself to avoid problems with the Serialize functions adding the interpolations into the list which can only work with a single global instance.
The shader timer may be taken from the primary level for the entire scene, because it will always be the same for all levels in a set.
The camera textures need to be prepared for all levels.
Since currently there is only one level, this will obvciously only run once on that level for the time being.
This is mainly used for CCMDs and CVARs which either print some diagnostics or change some user-settable configuration.
Depending on serialization order is not a good idea here, so now it's no longer stored as a parent in the main level script but explicitly checked for when looking for a variable.
This is what should be audible. To prevent other levels from playing sound, all entry points check whether the sound playing entity belongs to the current UI level.
src/c_dispatch.cpp:143:5: warning: delete called on 'FDelayedCommand' that is abstract but has non-virtual destructor [-Wdelete-non-virtual-dtor]
src/tarray.h:582:5: warning: delete called on 'FDelayedCommand' that is abstract but has non-virtual destructor [-Wdelete-non-virtual-dtor]
src/tarray.h:574:5: warning: delete called on 'FDelayedCommand' that is abstract but has non-virtual destructor [-Wdelete-non-virtual-dtor]
This was done to ensure that this code only runs when the thinker itself is fully set up.
With a constructor there is no control about such things, if some common initialization needs to be done it has to be in the base constructor, but that makes the entire approach chosen here to ensure proper linking into the thinker chains impossible.
ZDoom originally did it that way, which resulted in a very inflexible system and required some awful hacks to let the serializer work with it - the corresponding bSerialOverride flag is now gone.
The only thinker class still having a constructor is DFraggleThinker, because it contains non-serializable data that needs to be initialized in a piece of code that always runs, regardless of whether the object is created explicitly or from a savegame.
Doing this intermingled with the thinkers is highly unsafe because there are absolutely no guarantees about order of execution.
Effectively it ran these commands right in the middle of the playsim which could cause all sorts of synchronization issues, because CCMDs are part of the UI, not the playsim.
- pass a const string to AddCommandString.
This function manipulated the input buffer, leading to all sorts of code contortions to make sure that the passed parameter is clean for that.
This function will now create a copy of the passed parameter which it can manipulate without complicating its calling code.
# Conflicts:
# src/c_dispatch.cpp
This doesn't really write out any info for the pointer, if the level does not match it just errors out.
This is both for quick detection of badly used level data and for automatic restoring of the pointer from the serializer's working level.
This also removed the temporary workarounds in DAutomap and DLevelScript to restore these pointers when a savegame is loaded.