Commit graph

14834 commits

Author SHA1 Message Date
Christoph Oelckers
8d83f03138 - changed the linedef translator into a struct and reorganized its storage to allow having different ones at the same time.
This was the last piece of data that couldn't be distinct for more than one level.
2019-02-02 01:22:12 +01:00
Christoph Oelckers
45dc9a7b47 - renamed the level variables.
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.
2019-02-02 00:25:51 +01:00
Christoph Oelckers
6c006a5fbd - added the missing Level parameters to AActor::StaticSpawn and P_ExecuteSpecial.
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.
2019-02-01 22:02:16 +01:00
Christoph Oelckers
bf665961cc - moved KEYCONF_only CCMDs out of play files. 2019-02-01 21:19:16 +01:00
Christoph Oelckers
32e5be83ea - moved a few more files and copied the data related parts of p_things.cpp to g_doomedmap.cpp 2019-02-01 19:48:17 +01:00
Christoph Oelckers
a1cc548af4 - moved some more code into the gamedata folder.
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.
2019-02-01 19:20:58 +01:00
Christoph Oelckers
db77ed79cd - moved the resourcefiles and textures folders into gamedata. 2019-02-01 18:31:57 +01:00
Christoph Oelckers
c1e1284b52 - moved the CCMDs out of a_pickups.cpp. 2019-02-01 18:15:49 +01:00
Christoph Oelckers
3f90764faa - moved the contents of g_inventory to g_shared and gamedata subfolders.
a_pickups only contains a few native remains of the inventory code and the other two only the static data maintenance for their items.
2019-02-01 18:13:12 +01:00
Christoph Oelckers
edb34b9f7f Merge remote-tracking branch 'remotes/origin/master' into new_level_refactor 2019-02-01 17:59:25 +01:00
alexey.lysiuk
5e9001e7bc - fixed potentially incomplete list of argument flags for virtual function
https://forum.zdoom.org/viewtopic.php?t=63450
2019-02-01 17:58:06 +01:00
Christoph Oelckers
202f3d7d80 - changed most places where a player index is calculated by subtracting the player array's base access. 2019-02-01 17:31:11 +01:00
Christoph Oelckers
d358e401ee - removed all access to the consoleplayer variable from the play code
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.
2019-02-01 17:02:10 +01:00
Christoph Oelckers
2903025268 - a few minor fixes. 2019-02-01 12:31:08 +01:00
Christoph Oelckers
de24fc2c88 - do not call renderer code directly to reset the view interpolation
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.
2019-02-01 12:03:36 +01:00
alexey.lysiuk
5278274acf - fixed compilation errors with POSIX targets
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
2019-02-01 11:08:58 +02:00
alexey.lysiuk
e400137ffe - fixed compilation of Windows Debug targets
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
2019-02-01 10:09:36 +02:00
Christoph Oelckers
ba451b46c8 - moved a bunch of files to the utility folder. 2019-02-01 01:18:32 +01:00
Christoph Oelckers
b77e83e0b9 - moved 15 more files to g_shared. 2019-02-01 00:48:21 +01:00
Christoph Oelckers
e3eaa5964d - removed v_video.h include from portals.h
This has no business in a play related file which also made no use of it.
2019-02-01 00:30:21 +01:00
Christoph Oelckers
18fb7fdd81 - moved some diagnostic CCMDs to g_dumpinfo.cpp. 2019-02-01 00:14:31 +01:00
Christoph Oelckers
5010e61309 - moved a few more play files free of global state references to g_shared. 2019-01-31 22:31:41 +01:00
Christoph Oelckers
65c2c318fb - prettification of p_teleport.cpp and some include cleanup. 2019-01-31 22:22:39 +01:00
Christoph Oelckers
ff903da19a Merge remote-tracking branch 'remotes/origin/master' into new_level_refactor 2019-01-31 20:43:24 +01:00
Christoph Oelckers
b40c709b66 - minor corrections. 2019-01-31 20:42:36 +01:00
Christoph Oelckers
7241072b16 - moved most utility code to a subdirectory.
Again no code changes.
2019-01-31 20:33:52 +01:00
Christoph Oelckers
89d607c9a6 - moved all rendering code into a common subdirectory.
No changes to the files themselves was made.
2019-01-31 19:58:17 +01:00
Christoph Oelckers
c77487dab8 - moved the menu.h include from oalsound.h to oalsound.cpp.
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.
2019-01-31 19:44:04 +01:00
Christoph Oelckers
f6a91e1722 - moved the I_Error prototypes to doomerrors.h to avoid having to include the low level system header for this. 2019-01-31 19:38:04 +01:00
Major Cooke
b1c508fa6c Added CheckReplacee.
- 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.
2019-01-31 19:05:44 +01:00
Christoph Oelckers
1dcdfec733 - Unload behavior with the map, not outside. 2019-01-31 17:58:18 +01:00
Christoph Oelckers
7b7334e245 - only activate lights if the light actor isn't dormant, and only create a new one if it doesn't already have one.
-
2019-01-31 09:01:02 +01:00
Christoph Oelckers
ddab2c3e78 - removed the playernum parameter from CheckLocalView
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.
2019-01-31 03:29:25 +01:00
Christoph Oelckers
7149d1d312 - added missing includes 2019-01-31 03:25:49 +01:00
Christoph Oelckers
0a781b9bbb - fixed: DInterpolation was unlinking itself from the wrong interpolator
The global one was just a leftover, the real one is on the current level.
2019-01-31 03:25:26 +01:00
Christoph Oelckers
65f3fec283 - copied a few more map information CCMDs to g_ccmd. 2019-01-31 03:03:56 +01:00
Christoph Oelckers
aa340145ac - moved the remaining thinker code to g_shared 2019-01-31 02:51:07 +01:00
Christoph Oelckers
4984bc8c5f - prettification of a few files 2019-01-31 02:50:12 +01:00
Christoph Oelckers
65a812e316 - moved the door thinkers into g_shared. 2019-01-31 02:38:39 +01:00
Christoph Oelckers
77f8dfeabf - fixed g_dumpinfo.cpp's includes 2019-01-31 02:38:23 +01:00
Christoph Oelckers
51581d018a - moved the hud message and alt hud code from g_shared to g_statusbar
This is where it really belongs, this was simply overlooked when the folder was split.
2019-01-31 02:31:57 +01:00
Christoph Oelckers
25d5b788f5 - reviewed and sorted out the remaining parts of g_shared 2019-01-31 02:27:54 +01:00
Christoph Oelckers
0b4862480e - fixed macOS compilation. 2019-01-31 02:05:33 +01:00
Christoph Oelckers
0f2938089d - started cleaning up the contents of the g_shared directory, starting with a_dynlight.cpp
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.
2019-01-31 02:05:16 +01:00
Christoph Oelckers
18b8a03f05 - cleaned up the header list in maploader.cpp. 2019-01-31 01:23:06 +01:00
Christoph Oelckers
fa3312e2a9 - moved gamestate_t to g_game.h.
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.
2019-01-31 00:28:43 +01:00
Christoph Oelckers
c18a0e7736 - replaced DWORD_MAX with UINT_MAX globally.
This was the last remnant of ZDoom's old integer types.
2019-01-30 22:34:11 +01:00
Christoph Oelckers
0eb3b2abca Merge branch 'master' into new_level_refactor 2019-01-30 22:03:21 +01:00
Christoph Oelckers
a2065cae4b - fixed: RecreateAllAttachedLights must activate the lights it creates.
This also removes the gl_attachedlights CVAR because with the new management this doesn't really work anymore.
2019-01-30 20:21:00 +01:00
Christoph Oelckers
64ac6dbc6e - moved thinker storage into FLevelLocals. 2019-01-30 19:09:21 +01:00
Christoph Oelckers
99d63faea9 - fixed bad merge of dobjgc.cpp 2019-01-30 18:22:37 +01:00
Christoph Oelckers
3b4ded5694 - refactored the thinker list.
This was an unorganized set of static members in DThinker but has now been regrouped into something more structured.
2019-01-30 02:15:48 +01:00
Christoph Oelckers
e30f116faf - moved bglobal into FLevelLocals
This is still all static data, only the location has changed, but none of the access.
2019-01-30 01:38:18 +01:00
Christoph Oelckers
8bbdee5c28 - redirect most references to the global players array through FLevelLocals.
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.
2019-01-30 01:15:32 +01:00
Christoph Oelckers
c15212ca82 -fixed: The HUD model info was taken from the wrong player
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
2019-01-30 01:04:30 +01:00
Christoph Oelckers
b12de04258 - fixed the remaining deprecation warnings in the base script.
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.
2019-01-30 00:58:44 +01:00
Christoph Oelckers
3c0200de19 - run disconnect scripts on the level the disconnected player is on
This is nearly always the primary one but let's keep the option of using bots on secondary levels.
2019-01-30 00:47:34 +01:00
Christoph Oelckers
ebdb2643c4 - moved UDMF custom properties into FLevelLocals. 2019-01-30 00:47:20 +01:00
Christoph Oelckers
f410762695 - missed two lines. 2019-01-30 00:29:42 +01:00
Christoph Oelckers
78b7b64237 - replaced all TThinkerIterators except one that probably won't be relevant anymore as things progress. 2019-01-30 00:27:05 +01:00
Christoph Oelckers
4ad327d7e0 - moved G_ChangeLevel and other exit functions into FLevelLocals. 2019-01-29 23:45:14 +01:00
Christoph Oelckers
68fe5534a4 - moved the SectorMarker handling into the level itself. 2019-01-29 21:29:44 +01:00
Christoph Oelckers
ea849e5aca - split G_DoLoadLevel into a level specific and a global part. 2019-01-29 21:19:16 +01:00
Christoph Oelckers
12351ae9bb - made dumpportals CCMD multi-level aware. 2019-01-29 20:23:18 +01:00
Christoph Oelckers
1b37d85ac3 - removed a few missed references in FLevelLocals's member functions. 2019-01-29 20:15:06 +01:00
Christoph Oelckers
4af5ea25c1 - change per-level attenuation of dynamic lights for each viewpoint.
To avoid unnecessary work, the current state is tracked.
2019-01-29 20:09:06 +01:00
Christoph Oelckers
6451b7d592 - moved the combined compatibility flags into FLevelLocals. 2019-01-29 19:28:22 +01:00
Christoph Oelckers
d716a17b96 - compatibility variable handling 2019-01-29 17:41:50 +01:00
Christoph Oelckers
4cb3ce8196 - StartTravel and EndTravel 2019-01-29 16:11:23 +01:00
Christoph Oelckers
14101fa447 - health groups and software rendering textures freed of 'level'
Edited cherry-pick of an older commit.
2019-01-29 16:06:17 +01:00
Christoph Oelckers
eb5a39960e - missed a few references 2019-01-29 15:22:26 +01:00
Christoph Oelckers
3c565c9e86 - moved the static sky variables into FLevelLocals and removed the redundant ones for the texture ID. 2019-01-29 04:44:44 +01:00
Christoph Oelckers
06e5dd1d86 - Handle level in bot code 2019-01-29 04:27:21 +01:00
Christoph Oelckers
14971c8c3a - missed references in p_effect.cpp 2019-01-29 04:20:36 +01:00
Christoph Oelckers
d4ee52f606 - handle G_StartSlideshow 2019-01-29 04:17:58 +01:00
Christoph Oelckers
de1b89707d Handle level in block iterators.
The scripted interface isn't done yet.
2019-01-29 03:26:22 +01:00
Christoph Oelckers
7d3cd53c7e - handle the software renderer's GetColorTable function
The real question here should be: Why does this need to get called in over 40 differenrt locations…?
2019-01-29 03:15:42 +01:00
Christoph Oelckers
f823e57446 Handle level check in texture coordinate calculation 2019-01-29 02:51:06 +01:00
Christoph Oelckers
473892dede - changed all model related references to level. 2019-01-29 02:18:19 +01:00
Christoph Oelckers
8652f140f2 - fixed missing declaration 2019-01-29 02:17:25 +01:00
Christoph Oelckers
932bbee928 - fixed some warnings 2019-01-29 02:16:36 +01:00
Christoph Oelckers
1d748b72a8 Split G_DoCompleted into a global part and a level specific part. 2019-01-29 02:39:14 +01:00
Christoph Oelckers
87859b2950 - add Level parameter to G_LeavingHub 2019-01-29 02:08:53 +01:00
Christoph Oelckers
f9239f6e0f - added a compiler-side workaround for the formerly static methods of FLevelLocals.
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.
2019-01-29 02:04:31 +01:00
Christoph Oelckers
60873bc5d6 Moved the PointInSector functions into FLevelLocals 2019-01-29 01:30:41 +01:00
Christoph Oelckers
68667e5eaa - moved particle storage into FLevelLocals.
- 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.
2019-01-29 01:09:02 +01:00
Christoph Oelckers
50d59e99cb - moved sound sequence head of list into FLevelLocals. 2019-01-28 23:53:40 +01:00
Christoph Oelckers
623330f938 - initial adjustments for P_Ticker. 2019-01-28 22:33:50 +01:00
Christoph Oelckers
befacddab4 - removed level references in p_trace.cpp. Also added a null check to the sector pointer of the LineTracer Trace function because a null pointer here would crash. 2019-01-28 22:19:09 +01:00
Christoph Oelckers
6312c44234 - removed the remaining level references from p_acs.cpp. 2019-01-28 22:04:33 +01:00
Christoph Oelckers
259ae41774 - sanitized the 'frozen level' 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.
2019-01-28 20:15:48 +01:00
Christoph Oelckers
3c14a7db76 - use map time, not hub time for map actions. 2019-01-28 18:42:56 +01:00
Christoph Oelckers
3364988680 - moved the interpolator into FLevelLocals and refactored its use to happen outside the renderers.
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.
2019-01-28 18:26:14 +01:00
Christoph Oelckers
6a43d6c7ff Merge remote-tracking branch 'origin/master' into new_level_refactor 2019-01-28 15:50:42 +01:00
Christoph Oelckers
44f622c644 - more XCode warnings fixed. 2019-01-28 15:41:52 +01:00
Christoph Oelckers
d1ca3ef994 - added braces as per XCode's suggestion. 2019-01-28 15:20:02 +01:00
Christoph Oelckers
1dc11c5032 - changed infighting check so that the static skill checker does not access the level
Instead the level needs to be queried now.
2019-01-28 14:31:23 +01:00
Christoph Oelckers
d0942bcb97 - moved FirstThinker function to FLevelLocals
Currently it is meaningless but that's where it should be later.
2019-01-28 14:06:19 +01:00
Christoph Oelckers
41e576bbb5 - removed the intermediate P_SpawnPlayer inline 2019-01-28 03:02:25 +01:00
Christoph Oelckers
66695ac6a0 - made most of the player spawn spot handliing functions members of FLevelLocals. 2019-01-28 02:44:05 +01:00