Commit Graph

2582 Commits

Author SHA1 Message Date
Christoph Oelckers e7f4433df6 - consolidation of mouse code and obsolete code removal 2019-11-04 02:07:59 +01:00
Christoph Oelckers 0b6db7eede - cleanup of baselayer.cpp 2019-11-04 01:18:38 +01:00
Christoph Oelckers 4bf6c306ab - added handling for cleariung mouse wheel events 2019-11-04 01:07:34 +01:00
Christoph Oelckers 29b7e1cf79 - moved all mouse button handling to the input state
Yet again an unbelievable piece of code working around how input works on modern systems to keep the old 90's code alive.
2019-11-04 01:01:54 +01:00
Christoph Oelckers b4f91de7d3 - major refactoring on the input code.
* moved the ASCII conversion hackery in SDLayer to a subfunction because this made things just messy.
* integrated the keyboard callback's functionality directly into inputState for consolidation purposes. This was yet another independent layer in the keyboard management.
* hook up D_PostEvent as the central place to dispatch keyboard input. This is now the only function that is getting called from the backend and a major prerequiside for swapping out the backend for GZDoom's.

Todo: Route mouse input through that, too.
2019-11-04 00:55:49 +01:00
Christoph Oelckers b747df60ee - moved all keyboard related code into the InputState class, so that looking for this stuff is easier.
Sadly there's 1ß00 lines of code using this...
2019-11-04 00:53:55 +01:00
Christoph Oelckers 01d5d51f13 - pass key events to the event queue. 2019-11-03 22:46:01 +01:00
Christoph Oelckers c7af86bd00 - use proper key names. 2019-11-03 22:20:19 +01:00
Christoph Oelckers 1b958a7f9f - removed more backing data for the old keybinding code.
Unfortunately this means that the keybinding menus in all games except Blood are shot to shit right now because of how they passed the data on to its destination.
These menus are not fixable, this will have to wait until the replacement is up.
2019-11-03 20:58:10 +01:00
Christoph Oelckers eb049abc3a - it compiles again (safety commit) 2019-11-03 20:24:50 +01:00
Christoph Oelckers 73e64ff0b2 - added ZDoom's keybinding class and some needed support code.
Not hooked up yet with the game.
2019-11-03 18:19:29 +01:00
Christoph Oelckers 12a02cb456 - fixed: lump filters without any dot in the name did not work. 2019-11-03 15:54:18 +01:00
Christoph Oelckers b179767d4a - do not use the command line but the module filename to create the progdir path.
argv[0] is not guaranteed to contain anything usable and in cmd.exe it doesn't.
2019-11-03 13:39:42 +01:00
Christoph Oelckers 250fa0b847 - consolidation of exit and quit CCMDs. 2019-11-03 13:31:03 +01:00
Christoph Oelckers 59fce59a26 - fixed god mode being activated automatically, thanks to a variable that got initialized in the wrong place. 2019-11-03 12:46:53 +01:00
Christoph Oelckers 3c7151810f - made the game interfaces classes instead of function pointer lists because that is far better at error catching.
- fixed: Blood's monster flag is a 'have_monsters', not 'nomonsters' flag. As a result none were spawned.
2019-11-03 12:32:58 +01:00
Christoph Oelckers d7e7c516a0 - fixed: In case no game data can be found, the config needs to be written, to ensure there is one for editing. 2019-11-03 10:51:47 +01:00
Christoph Oelckers 94aa556953 - some work on a generic cache manager.
For main resource data this is probably unnecessary - most resources are never cached with the exception of sounds and textures, which are loaded permanently anyway.
But for hardware textures this is different. Due to the poor precaching it is impossible to selectively evict hardware textures that are not needed any longer, so for this an MRU cache is really needed so that they do not accumulate and congest the video RAM in the process.
2019-11-03 10:00:19 +01:00
Christoph Oelckers e24b1e8903 - replaced all uses of xxhash with SuperFastHash.
That's one more third party dependency down.
Not only are two hashing algorithms redundant, there was also a large size discrepancy: SuperFastHash is 3 kb of source code while xxhash is 120kb and generally extremely awful code.
It was easy to make a choice here. None of the use cases require this kind of performance tweaking, the longest hashed block of data is a 768 byte palette.
2019-11-02 22:52:13 +01:00
Christoph Oelckers d25691881b - removed unused lz4 library.
It looks like this was already unused and a leftover.
2019-11-02 22:27:05 +01:00
Christoph Oelckers 7853a9db6c - do not use EDuke32's savegame identifiers.
The engine may be incopatible already and the format will certainly change in the future.
2019-11-02 22:22:57 +01:00
Christoph Oelckers 3530c52264 - no need to have 2 CRC32 implementations.
Just let Bcrc32 point to zlib instead of having its own implementation.
2019-11-02 22:10:53 +01:00
Christoph Oelckers 4e3ad17e4a - tweaking of the game selection display. 2019-11-02 21:43:17 +01:00
Christoph Oelckers cfbcf33c8c - fixed CVAR saving.
- do not use snd_enabled for temporarily hacking the sound state. userConfig.noSound is better suited for such antics.
2019-11-02 21:21:48 +01:00
Christoph Oelckers e35a5bac79 - fixed: 0 is a valid resource ID for Blood.
Unfortunately this means that looking up ID 0 can be a bit more costly than the rest because all ID-less entries in RFF files also use 0.
For other file types -1 is used.
2019-11-02 20:37:15 +01:00
Christoph Oelckers dc9d75685e - fixed keybind setup. 2019-11-02 20:13:00 +01:00
Christoph Oelckers 4cf62fca77 - do not load subdirectories of the game directory. They cannot contain anything useful because the original assets never used subdirectories.
- fixed RRRA game flags.
2019-11-02 19:12:01 +01:00
Christoph Oelckers c5838df0c8 - fixed addition of main directory. 2019-11-02 18:46:11 +01:00
Christoph Oelckers 395ba5541c - fixed startup and sound issues with Redneck Rampage. 2019-11-02 18:28:50 +01:00
Christoph Oelckers 63d4fc1e1b - fixed flag parsing for grpinfo. 2019-11-02 18:03:41 +01:00
Christoph Oelckers 536c7d61a0 - Duke Nukem starts again.
Now for the other frontends.
2019-11-02 17:41:38 +01:00
Christoph Oelckers 768a75b712 - fixed video startup.
Make sure that SDL is initialized as the first thing and that the validmodecnt variable does not get cleared
2019-11-02 17:26:40 +01:00
Christoph Oelckers d246ff1212 - fixed file system hasher. 2019-11-02 16:52:22 +01:00
Christoph Oelckers e4ecc5d8df - some reshuffling on OSD code.
* moved the binding commands to osd.cpp. They were in the global namespace already and this way everything to be tossed out is in the same place when the time comes.
* removed support for the OSDs native CVARs. The only ones left were some internal ones I won't need until this code can be replaced.
* same for the custpmization code the games added. Duke Nukem was the only one anyway to have a decent font for it.
2019-11-02 14:25:35 +01:00
Christoph Oelckers 906e56a2b1 - fixed some startup errors. 2019-11-02 13:27:40 +01:00
Christoph Oelckers 8fb54b51c3 - rewrote the screenshot code to use m_png as its backend.
Mainly to finally get rid of kplib. There's really no use to keep such code around if alternatives are already present.
2019-11-02 12:59:59 +01:00
Christoph Oelckers edcfad6e11 - updated m_png.cpp from GZDoom. 2019-11-02 12:07:15 +01:00
Christoph Oelckers 1d7bfe14dc - removed kplib's compression code.
Its only use in savegames has already been disabled in favor of a format restructuring.
2019-11-02 11:29:23 +01:00
Christoph Oelckers ab28697c18 - undid the very pointless pow2char (de)optimization by substituting the real array with an empty struct containing an inlined [] operator.
I think this shows a fundamental misunderstanding of what constexpr means, even when declared as such it requires a constant argument to be treated as a constant.
But since nearly all uses of this were not using constants, the compiler was emitting actual memory accesses to the array each time this was used.
2019-11-02 10:45:41 +01:00
Christoph Oelckers fca3c2f5b5 - removed the directory scan code from compat.cpp.
It is only used by the user map menus which I had to disable already and on top of that is blissfully incapable of dealing with Unicode.
2019-11-02 10:39:31 +01:00
Christoph Oelckers f44d309558 - made some adjustments to the RFS parser for the file system.
It's still not active but now should produce correct results when working inside the file system.
What it is missing is a file scanner that picks the data it needs to process.
2019-11-02 10:20:32 +01:00
Christoph Oelckers c54ae1be83 - removed the remaining parts of cache1d. The only thing left is the dummy cacheAllocateBlock function that needs to stick around until a working cache is present.
- disabled the user maps menu because it is hopelessly dependent on functionality that cannot be fixed. Better wait until the menu refactor to do it right - it'd be a waste of time fixing the current menus.
2019-11-02 01:30:21 +01:00
Christoph Oelckers 1149b4f4aa - various fixes and improvements related to file location management:
* saving of demos and savegames no longer mindlessly writes to the mod directory. All such access is now being rerouted through the special paths interface so that the game data can reside in write protected locations.
* refactored all occurences of klistpath except fnlist_getnames.
* do not allow CON scripts to write to arbitrary files. This is a massive exploit and can be used to cause real damage if someone knows how to play this thing - it's far easier than people may think! It will now write any such data to a special section in the main config which is safe and cannot be manipulated to write to random locations on the hard drive.
2019-11-02 00:38:30 +01:00
Christoph Oelckers cfca8060ba - gutted cache1d. The old file system is gone, excepr for klistpath, which still gets used in a few places.
- consolidated the 3 identical S_OpenAudio implementations. The replacement code is disabled for the time being because it needs a rewrite. The replacement logic is uses is a bit too volatile.
- removed the old GRP scan code.
2019-11-01 22:17:15 +01:00
Christoph Oelckers 2d7c0e26d2 - cleanup of the old file system initialization.
The real fun part is yet to come, i.e. removing the remaining dependencies on the old file system code.
2019-11-01 19:25:42 +01:00
Christoph Oelckers 24edfbe03b - removed the pointless double loading of CON files.
The condition for this was no longer present anyway so it was never done.
2019-11-01 09:40:29 +01:00
Christoph Oelckers 8d5e665caa - various initialization related changes
* reroute several error conditions to I_Error.
* removed some soon-to-be obsolete GRP loading code.
* explicitly trigger the SetDefaults script events which depended on side effects from the config implementation.
* removed the nonsensical file system switch. All this does is create instabilities because it is non-obvious from where data is loaded. If a resource is mounted, it should be checked for content no matter what. While this may affect the stray weird mod out there it is a necessity if we want to allow transparent project repackaging.
2019-11-01 09:30:28 +01:00
Christoph Oelckers 39bfd64fe9 - a bit more cleanup in app_init. 2019-11-01 08:24:10 +01:00
Christoph Oelckers 6c5d9c3507 - moved the net init code out of the game frontends to avoid having to call atexit for their deinit function.
When doing this during startup it can be done by regular cleanup measures.
This also moves two larger chunks of networking code out of game.cpp.

Nevertheless, the fact that enet is a very dirty library which directly depends on Windows types is a big problem because it bleeds Windows definitions everywhere thanks to poor abstraction in all relevant layers.
2019-11-01 07:26:49 +01:00
Christoph Oelckers 67acad3984 - startup cleanup. 2019-11-01 00:32:56 +01:00
Christoph Oelckers 57f879fa8b - moved the startup dialog out of the game front ends, now that there is a global cross-game list of playable configurations. 2019-10-31 23:25:21 +01:00
Christoph Oelckers ba00fe4e66 - hooked up the file system with Blood's resource access. 2019-10-31 20:17:49 +01:00
Christoph Oelckers d7e183d46d - fixed compilation of file system code. 2019-10-31 18:06:05 +01:00
Christoph Oelckers 8ef40c5083 - merged most of Blood's resource manager into the file system 2019-10-31 17:13:48 +01:00
Christoph Oelckers 261af9e401 - rework of the file system code.
Made more efficient by basing the lookup on names, not strings and some additions for acting as a stand-in for Blood's resource manager.
2019-10-31 01:48:10 +01:00
Christoph Oelckers 693095bffb - added access wrappers to the two fields of DICTNODE that are accessed from the outside.
The idea here is to completely merge the resource management into the file system so that Blood's DICTNODE is merely an alias to the internal FResourceLump.

A two-tiered resource system is not something I consider worthwile, it made sense to get around Builds crappy cache but in the long term this is not a good solution for a multi-game port to have a resource management system in the backend and another one put over it in the front end, both with their own caching logic that might interfere with each other. Better merge it into one that can handle everything.
2019-10-31 00:50:45 +01:00
Christoph Oelckers c6753a3fec - tested and fixed game list loader. 2019-10-31 00:41:56 +01:00
Christoph Oelckers 2a7beeff69 - cleaned out some chunks of unused or useless code, most importantly the Build cache which was only used by the sound code for permanently loading the data into memory. 2019-10-30 21:51:04 +01:00
Christoph Oelckers 535c68fac1 - fixed Shadow Warrior startup.
It runs to the menu, unfortunately key input is broken.
2019-10-30 20:13:43 +01:00
Christoph Oelckers 5b1036093c - fixed startup. 2019-10-30 19:55:03 +01:00
Christoph Oelckers 266dc9e04e - added SW search paths to new code and cleaned up the init code. 2019-10-30 19:26:55 +01:00
CommonLoon102 bc6c1bbc3c Fix the game on non-Windows (#240) 2019-10-30 18:54:56 +01:00
hendricks266 d410694e40 SW: Fix 3D Realms and ANM palettes
git-svn-id: https://svn.eduke32.com/eduke32@8272 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/duke3d/src/astub.cpp
#	source/sw/src/anim.cpp
#	source/sw/src/colormap.cpp
#	source/sw/src/common_game.h
#	source/sw/src/game.cpp
2019-10-30 18:50:23 +01:00
hendricks266 d679603cab SW: Fix MIDI music
git-svn-id: https://svn.eduke32.com/eduke32@8271 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/sw/src/config.cpp
#	source/sw/src/config.h
#	source/sw/src/game.cpp
#	source/sw/src/menus.cpp
#	source/sw/src/sounds.cpp
2019-10-30 18:45:53 +01:00
hendricks266 dcba445f4e SW: Fix file loading and init sequence
git-svn-id: https://svn.eduke32.com/eduke32@8269 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/duke3d/src/common.cpp
#	source/duke3d/src/game.cpp
#	source/sw/src/common.cpp
#	source/sw/src/common_game.h
#	source/sw/src/game.cpp
#	source/sw/src/jnstub.cpp
2019-10-30 18:38:43 +01:00
Christoph Oelckers ea10e01cc3 - adjustments for last commit. 2019-10-30 18:27:52 +01:00
hendricks266 797c79d4a5 Move registry reading to engine
git-svn-id: https://svn.eduke32.com/eduke32@8268 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/duke3d/src/common.cpp
2019-10-30 18:27:40 +01:00
Christoph Oelckers 418ec0d829 - adjustment to cherry-picked commit. 2019-10-30 18:21:59 +01:00
hendricks266 9b21fe0c28 Move VDF parsing to engine
git-svn-id: https://svn.eduke32.com/eduke32@8267 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/build/include/common.h
#	source/duke3d/src/common.cpp
2019-10-30 18:15:00 +01:00
hendricks266 de3215bcab Add sound and music code for Ken-Build
Patch from Nuke.YKT.

git-svn-id: https://svn.eduke32.com/eduke32@8266 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	GNUmakefile
#	platform/Windows/kenbuild.vcxproj
#	platform/Windows/kenbuild.vcxproj.filters
#	source/kenbuild/src/config.cpp
#	source/kenbuild/src/game.cpp
#	source/kenbuild/src/sound_stub.cpp
2019-10-30 18:10:54 +01:00
Christoph Oelckers 3e5d5a9a3d - it's "loadgrp". 2019-10-30 18:09:38 +01:00
Christoph Oelckers 7f250fc3e8 - WIP on game data search. 2019-10-30 18:09:00 +01:00
Christoph Oelckers 5e76fd659a - search path WIP. 2019-10-29 23:57:28 +01:00
Christoph Oelckers b56dae0e9a - changed path scanner to return only absolute paths and fixed the directory iterator to construct the proper path.
Also avoid collecting duplicate paths.
2019-10-29 21:06:14 +01:00
Christoph Oelckers ac87665972 - use std::filesystem for directory traversal.
So far implemented for scanning search paths
2019-10-29 19:53:46 +01:00
Christoph Oelckers 35342526a5 - WIP search path code
The Steam/GOG path getters were taken out of the frontends.
This also switches the Windows directory reader touse the wide string version to get Unicode file names.
Some paths were added to the config file instead of hard coding them.
2019-10-29 01:00:44 +01:00
Christoph Oelckers cfd9edbe71 - added the main FileSystem class. 2019-10-29 00:15:36 +01:00
Christoph Oelckers 82c844e405 - added GZDoom's resource management classes. 2019-10-28 23:46:15 +01:00
Christoph Oelckers 762f174743 - moved the command line parser out of the game frontends.
Some part are not done yet, and the file system data is currently ignored - there's no way to properly set this up with the file system code Build came with.
2019-10-28 22:19:50 +01:00
Christoph Oelckers 5148fc877d - consolidate the 3 instances of input.cpp.
Some stuff had to be disabled to make it work but that's hardly relevant considering that the goal is to transition off MACT for input handling.
2019-10-28 18:32:05 +01:00
Alexey Khokholov 954d3b14dc Delete _oplmidi.h 2019-10-28 17:51:38 +01:00
Alexey Khokholov 6bb7cb8531 Delete oplmidi.h 2019-10-28 17:51:14 +01:00
Christoph Oelckers a72863112b - fix compilation 2019-10-28 17:50:08 +01:00
Christoph Oelckers 21f6178ade - avoid writing directly to a backend status variable 2019-10-28 07:10:56 +01:00
Christoph Oelckers 901b86577e - more cleanup
Moving init code and key binding getter to backend
2019-10-28 07:05:32 +01:00
Christoph Oelckers 4f4fc1a8d4 - Cleanup 2019-10-28 07:02:42 +01:00
Christoph Oelckers c589a6ab82 - replaced KEY_PRESSED globally
This was just a redundant name getting in the way.
2019-10-28 07:01:01 +01:00
Christoph Oelckers 065721c62b - simplified the button state maintenance
This removes all unused parts of the implementation and moves the rest to the InputState class for easier replacement later. All MACT is doing now here is to call the UpdateStatus function, the internal workings are no longer relevant.
2019-10-28 07:00:31 +01:00
Christoph Oelckers f8203ac766 - fixed the compile errors and consolidated the key binding CCMDs. 2019-10-28 06:47:49 +01:00
Christoph Oelckers e7f75cbf4d WIP 2019-10-28 01:12:31 +01:00
Christoph Oelckers 113b5d9037 - added an input state class which will contain all game-facing input data state.
Having this grouped in a single object will make refactoring a lot easier.
Access functions have been provided to avoid changing client code for the reorganization.
2019-10-28 00:24:09 +01:00
Christoph Oelckers 68b64d2091 - fixed compilation. 2019-10-27 23:18:44 +01:00
CommonLoon102 43da4b68a2 feature: show player names (#234)
# Conflicts:
#	source/blood/src/config.cpp
#	source/blood/src/config.h
#	source/blood/src/menu.cpp
#	source/blood/src/osdcmd.cpp
2019-10-27 22:24:30 +01:00
Christoph Oelckers 19b9e34726 - removed empty #includes. 2019-10-27 22:17:21 +01:00
Christoph Oelckers d962a7810d - deleted unused headers 2019-10-27 22:15:21 +01:00
Christoph Oelckers cee194fd05 - removed the MACT scriplib after completing the config transition. 2019-10-27 17:31:23 +01:00
nukeykt aebd22eea8 This makes more sense 2019-10-27 16:54:25 +01:00
nukeykt 5a087b1768 Add gModernMap guard 2019-10-27 16:54:24 +01:00
Christoph Oelckers bfea07570a - mapped the remaining Shadow Warrior options to the CVARs. 2019-10-27 16:53:00 +01:00
Christoph Oelckers 2e7ba30068 - a bit more config cleanup. 2019-10-27 14:09:56 +01:00