Testing with Adventures of Square this mostly works, but it is clear that a list of old and deleted CVARs still needs to be added so that any items referring to those can be eliminated as well. Some stuff is still slipping through that refers to features which no longer exist.
Sadly, some mods are truly careless enough to modify the engine internal menus to add their own things, which should have no business whatsoever in there.
As an example, in a D4D version released in May, the Display Options menu is showing quite a bit of outdated content and missing important settings.
- added a '-nocustommenu' command line options. This is for disabling user menus that intentionally or accidentally disable crucial menu features.
- do not allow replacement of the main options menu. This menu contains engine-critical settings and may change at any time when new features get added. For now it will be the only one that gets protected but this may soon be extended to some of its submenus as well.
This is to ensure that the Class pointer can be set right on creation. ZDoom had always depended on handling this lazily which poses some problems for the VM.
So now there is a variadic Create<classtype> function taking care of that, but to ensure that it gets used, direct access to the new operator has been blocked.
This also neccessitated making DArgs a regular object because they get created before the type system is up. Since the few uses of DArgs are easily controllable this wasn't a big issue.
- did a bit of optimization on the bots' decision making whether to pick up a health item or not.
Let's use inline checkers in PType instead of constantly having to do clumsy IsKindOf checks etc. Once complete this also means that the types can be taken out of the class hierarchy, freeing up some common names.
Currently this is only being used for draw operations that are not automap related, i.e. DrawLine, DrawPixel and FillSimplePoly are not subjected to it.
- made bluramount also into a gameinfo option
- negative gl_menu_blur cvar now uses gameinfo option, 0 disables it
- removed gl_menu_blur_enabled since gl_menu_blur==0 does that anyway
- made gl_menu_blur default to -1 to use gameinfo option
- add default gameinfo bluramount options
This makes VMValue a real POD type with no hacky overloads and eliminates a lot of destructor code in all places that call a VM function. Due to the way this had to be handled, none of these destructors could be skipped because any value could have been a string.
This required some minor changes in functions that passed a temporary FString into the VM to ensure that the temporary object lives long enough to be handled. The code generator had already been changed to deal with this in a previous commit.
This is easily offset by the code savings and reduced maintenance needs elsewhere.
Note that the Strife status bar does not draw the health bars yet. I tried to replace the hacky custom texture with a single fill operation but had to find out that all the coordinate mangling for the status bar is being done deep in the video code. This needs to be fixed before this can be made to work.
Currently this is not usable in mods because they cannot initialize custom status bars yet.
This method was chosen because it avoids adding variable declarations to the global namespace which would have required a lot more work while polluting the grammar.
This way the global variables can be handled by a small bit of special coding in the struct generator.
This one was particularly nasty because Windows also defines a DWORD, but in Windows it is an unsigned long, not an unsigned int so changing types caused type conflicts and not all could be removed.
Those referring to the Windows type have to be kept, fortunately they are mostly in the Win32 directory, with a handful of exceptions elsewhere.
This addresses the main issue with TObjPtr, namely that using it required pulling in the entire class hierarchy in basic headers like r_defs which polluted nearly every single source file in the project.
src/menu/menu.cpp:806:20: error: cannot pass non-trivial object of type 'FString' to variadic function; expected type from format string was 'char *' [-Wnon-pod-varargs]
This will store class meta properties in a separate memory block so that it won't have to muck around with PClass - which made the implementation from the scripting branch relatively useless because extending the data wasn't particularly easy and also not well implemented. This can now be handled just like the defaults.
This reverts commit 76a44ebf9c.
Fix was done in the wrong place, it should be inside the script so that script-side calls to open a confirmation screen also get proper treatment.
Doing this to Menu itself would not work because the different menus require different parameters.
This also means that all menus that are routed through menu items must inherit from either ListMenu, OptionMenu or GenericMenu.
All other types can only be used internally.
This should complete the menu scriptification.
The manager class cannot be scriptified because it provides the internal implementation which may change at some point in the future. It also encapsulates all access to the file level because if that part is not protected, modders could write malware mods.
Now all actors have the same metaclass and therefore it will always be the same size which will finally allow some needed changes to the type system which couldn't be done because it was occasionally necessary to replace tentatively created classes due to size mismatches.
There's simply never enough of them and they are used far too infrequently to justify the hassle of tagging along two TMaps per class.
For what they provide, single global lists that handle all player classes at once are fully sufficient.
The goal is to get rid of PClassPlayerPawn and PClassInventory so that the old assumption that all actor class descriptors have the same size can be restored
This is important to remove some code that seriously blocks optimization of the type table because that can only be done if types do not need to be replaced.
This means that with the exception of 3 pointers the DrawTexture interface only accepts numeric values now.
Still need to get rid of the last 3 to have this ready for scripting.
This function will truncate everything that is larger than LONG_MAX or smaller than LONG_MIN to fit into a long variable, but longs are 32 bit on Windows and 64 bit elsewhere, so to ensure consistency and the ability to parse larger values better use strtoll which does not truncate 32 bit values.
This was done to ensure it can be properly overridden in scripts without causing problems when called during engine shutdown for the type and symbol objects the VM needs to work and to have the scripted version always run first.
Since the scripted OnDestroy method never calls the native version - the native one is run after the scripted one - this can be simply skipped over during shutdown.
Needless to say, this is simply too volatile and would require constant active maintenance, not to mention a huge amount of work up front to get going.
It also hid a nasty problem with the Destroy method. Due to the way the garbage collector works, Destroy cannot be exposed to scripts as-is. It may be called from scripts but it may not be overridden from scripts because the garbage collector can call this function after all data needed for calling a scripted override has already been destroyed because if that data is also being collected there is no guarantee that proper order of destruction is observed. So for now Destroy is just a normal native method to scripted classes
* everything related to scripting is now placed in a subdirectory 'scripting', which itself is separated into DECORATE, ZSCRIPT, the VM and code generation.
* a few items have been moved to different headers so that the DECORATE parser definitions can mostly be kept local. The only exception at the moment is the flags interface on which 3 source files depend.
- always make the top level object randomaccess when opening a JSON file for reading. Some things won't work right if this is opened for sequential access.
- For most cvars, this is equivalent to calling GetGenericRep() to get a
string.
- For float cvars, it uses %g instead of %H, because %H is generally more
information than is needed.
- removed use of finesine for creating the player backdrop for the menu display. This mostly uses the code from the old 2.0 floating point version but fixes some of the constants in there which were not correct.
- replaced some uses of FRACUNIT with OPAQUE when it was about translucency.
- simplified some overly complicated translucency multiplications in the SBARINFO code.
The reason is that in such a case it is very likely that the IWAD defines its own menu and will most likely not provide all assets for the base definitions. See 'Adventures of Square' for an example.
- replace all implicit conversions from FString to const char * in the header files (so that it can be test compiled with the implicit type conversion turned off without throwing thousands of identical errors.)
- having a value of 5000 as the default for autoaim makes no sense, since this is an angle value that will always be clamped to [0..35]. So now 35 is both the default and the maximum.
This CCMD tried to access the current menu to decide which colors to reset but that is not available at all when this function gets called. It now uses the automap's own CVAR arrays.
* added global functions that check whether FMod and OpenAL are present, without initializing the sound backend.
* make sound init code more fault tolerant. It will now try to switch between FMod and OpenAL if the currently active one cannot be found but the other one can.
* added 'ifoption' checks for sound backend to menu code.
* only show sound backends which are present and hide the options for the ones which are not.
- "If it ain't broke, don't fix it."
- Some of the changes were downright wrong and some were pointless, so undo
everything that doesn't look like an actual improvement.
- Fixed: If the menu cursor was on the topmost-displayed item, pressing up
would not scroll the view up. The check for scrolling only tested if the
newly selected item was the topmost one, since the menu code had
assumed the only time the cursor would be on the topmost visible line
was when it was the very first line of the menu. Using PgDn breaks this
assumption.