Having everything lumped together made this a maintenance hassle because it affected how the level has to be stored.
This hasn't been tested yet, so it may not work as intended!
The original place in I_CheckNativeMouse is unsafe because that function can get called from the system message queue which can result in a bad global state of the VM for such a call because it can be recursively invoked from code that may temporarily alter some settings.
currentUILevel is now primaryLevel.
For ZScript, currentVMLevel was added. This is also exported as 'level' and will change as needed.
This also means that no breaking deprecations will be needed in the future, because in order to sandbox a level only 4 variables need to be handled: level, players, playeringame and consoleplayer.
The remaining global variables are not relevant for the level state.
The static 'level' has been mostly removed from the code except some places that still need work.
I think these were the last two still missing it, all remaining uses of the global level variable are in code that doesn't get run through a level tick and are supposed to access the primary level.
Two files were split:
g_level.h contained both the game data definitions and some prototypes belonging to the game logic. These were split up.
decallib.cpp contained both the data and the animation thinkers. The thinkers are now in their own file.
There is one exception in ACS for a net arbitrator check.
Aside from this the bot_observer CVAR was also removed. This was never implemented properly and could stomp upon custom player settings.
The playsim really has no idea what the renderer is supposed to do here and the current system has some serious issues that eventually need addressing. So it is better to just set a flag that an actor needs to have its view interpolation reset if being used as a camera and let the render code deal with it.
This will keep the playsim clean of future changes to this feature.
src/posix/cocoa/i_video.mm:559:2: error: use of undeclared identifier 'atterm'
src/posix/sdl/hardware.cpp:85:28: error: ‘atterm’ was not declared in this scope
src/posix/sdl/i_input.cpp:261:10: error: ‘gamestate’ was not declared in this scope
src/posix/sdl/i_input.cpp:261:23: error: ‘GS_LEVEL’ was not declared in this scope
src/posix/sdl/i_input.cpp:263:48: error: ‘GS_INTERMISSION’ was not declared in this scope
src/posix/sdl/i_input.cpp:263:80: error: ‘GS_FINALE’ was not declared in this scope
src/posix/sdl/i_system.cpp:115:25: error: ‘atterm’ was not declared in this scope
src/posix/sdl/i_system.cpp:372:30: error: invalid use of incomplete type ‘const struct dirent’
src/posix/sdl/i_system.cpp:375:42: error: ‘findstate_t’ has not been declared
src/posix/sdl/i_system.cpp:391:12: error: request for member ‘current’ in ‘* fileinfo’, which is of non-class type ‘int’
src/posix/sdl/i_system.cpp:392:12: error: request for member ‘count’ in ‘* fileinfo’, which is of non-class type ‘int’
src/posix/sdl/i_system.cpp:392:56: error: request for member ‘namelist’ in ‘* fileinfo’, which is of non-class type ‘int’
src/posix/sdl/i_system.cpp:393:22: error: ‘alphasort’ was not declared in this scope
src/posix/sdl/i_system.cpp:393:31: error: ‘scandir’ was not declared in this scope
src/posix/sdl/i_system.cpp:394:16: error: request for member ‘count’ in ‘* fileinfo’, which is of non-class type ‘int’
src/posix/sdl/i_system.cpp:401:31: error: ‘findstate_t’ has not been declared
src/posix/sdl/i_system.cpp:403:2: error: ‘findstate_t’ was not declared in this scope
src/posix/sdl/i_system.cpp:403:15: error: ‘state’ was not declared in this scope
src/posix/sdl/i_system.cpp:403:37: error: expected primary-expression before ‘)’ token
src/posix/sdl/i_system.cpp:404:33: error: request for member ‘count’ in ‘* fileinfo’, which is of non-class type ‘int’
src/posix/sdl/i_system.cpp:406:39: error: request for member ‘count’ in ‘* fileinfo’, which is of non-class type ‘int’
src/posix/sdl/i_system.cpp:413:2: error: ‘findstate_t’ was not declared in this scope
src/posix/sdl/i_system.cpp:413:15: error: ‘state’ was not declared in this scope
src/posix/sdl/i_system.cpp:413:37: error: expected primary-expression before ‘)’ token
src/posix/sdl/i_system.cpp:425:16: error: ‘findstate_t’ was not declared in this scope
src/posix/sdl/i_system.cpp:425:29: error: expected primary-expression before ‘const’
src/posix/sdl/i_system.cpp:426:1: error: expected ‘,’ or ‘;’ before ‘{’ token
src/posix/sdl/i_main.cpp:160:6: error: ‘gamestate’ was not declared in this scope
src/posix/sdl/i_main.cpp:160:19: error: ‘GS_LEVEL’ was not declared in this scope
src/posix/sdl/i_main.cpp:160:44: error: ‘GS_TITLELEVEL’ was not declared in this scope
src/posix/sdl/i_main.cpp:217:18: error: ‘atterm’ was not declared in this scope
src/posix/sdl/i_main.cpp:242:11: error: ‘I_Quit’ was not declared in this scope
src/gameconfigfile.cpp:126:27: error: ‘SHARE_DIR’ was not declared in this scope
src/scripting/decorate/thingdef_parse.cpp:929:2: error: use of undeclared identifier 'strlwr'; did you mean 'strlen'?
src/scripting/decorate/thingdef_parse.cpp:937:3: error: use of undeclared identifier 'strlwr'; did you mean 'strlen'?
src/scripting/decorate/thingdef_states.cpp:564:2: error: use of undeclared identifier 'strlwr'; did you mean 'strlen'?
src/scripting/vm/jit_runtime.cpp:957:2: error: ‘unique_ptr’ is not a member of ‘std’
src/scripting/vm/jit_runtime.cpp:957:38: error: expected primary-expression before ‘>’ token
src/scripting/vm/jit_runtime.cpp:957:40: error: ‘nativeSymbols’ was not declared in this scope
src/utility/cmdlib.cpp:962:2: error: ‘DIR’ was not declared in this scope
src/utility/cmdlib.cpp:962:7: error: ‘directory’ was not declared in this scope
src/utility/cmdlib.cpp:962:34: error: ‘opendir’ was not declared in this scope
src/utility/cmdlib.cpp:967:33: error: ‘readdir’ was not declared in this scope
src/utility/cmdlib.cpp:969:10: error: invalid use of incomplete type ‘struct ScanDirectory(TArray<FFileList>&, const char*)::dirent’
src/utility/cmdlib.cpp:973:34: error: invalid use of incomplete type ‘struct ScanDirectory(TArray<FFileList>&, const char*)::dirent’
src/utility/cmdlib.cpp:985:20: error: ‘closedir’ was not declared in this scope
src\sound\mididevices\music_opl_mididevice.cpp(112): error C3861: 'I_DebugPrint': identifier not found
src\sound\mididevices\music_opl_mididevice.cpp(206): error C3861: 'I_DebugPrint': identifier not found
src\sound\mididevices\music_opl_mididevice.cpp(234): error C3861: 'I_DebugPrint': identifier not found
src\sound\mididevices\music_opl_mididevice.cpp(244): error C3861: 'I_DebugPrint': identifier not found
The menu is a very 'dirty' header, and forcing it to be pulled in with something entirely unrelated is not good - even though only two files include oalsound.h.
- Allows defining of what actor is replacing another for information.
- If multiple arachnotrons, a modder can attribute them as being a replacer of Arachnotron itself, allowing A_BossDeath and GetReplacee to work with it.
This was always used with 'consoleplayer' which really is the only thing making sense here. But this is a part of the global state which should be avoided in play code.
In particular, this makes no real sense in case of secondary maps where it should always return false.
This is supposed to be come the place where all pure play code should be placed, but for that all CVARs and CCMDs and other things that do not directly handle play data should be taken out to make code reviewing easier. These now get collected in two separate files, g_cvars.cpp and g_dumpinfo.cpp respectively.
The sole ZScript property in here has also been moved - to thingdef_properties.cpp.
This made reviewing the code for accessing the global state hard, because the doomdef.h contains mainly constants, this particular item was the only thing in there that represents actual engine state.
The Map loader may not access any global state at all - everything it can touch must be exchangable.
Furthermore, if we want to sandbox each level, there may be no direct access to any kind of global state whatsoever from the play code.
It used the current console player's camera, not the actual camera being used for rendering. Although this is the same most of the time, let's better do it right.
This also removes a few leftover references to the player array elsewhwere in the hardware renderer
All these required access to the sector's Level reference.
The remaining references to the global 'level' variable are all in deprecated functions which is ok.
LevelLocals on the left side of.a function call will now always be remapped to 'Level', which will either remap to the same-named instance variable or the global deprecated one.
In a few degenerate cases where there is a conflicting local variable named 'level' it may error out but that is unavoidable here but this is very unlikely.
- moved parts of the render setup out of the separate render functions.
Things like particle and polyobject linking were duplicated several times for rendering different things in different renderers.
These things only need to be set up once before the renderer is started so it makes a lot more sense to consolidate them into one place outside the actual rendering code.
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.