Commit Graph

12764 Commits

Author SHA1 Message Date
Christoph Oelckers aeb455d705 - removed all RTTI checks for the types. 2017-04-13 15:38:06 +02:00
Christoph Oelckers b2d944974e - first stage of simplifying the type system.
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.
2017-04-13 12:52:18 +02:00
Christoph Oelckers 522ce59be2 - use in-class initialization for FLightDefaults to avoid uninitialized variables in the future. 2017-04-13 12:50:43 +02:00
alexey.lysiuk cced9e014b Fixed issue with actors occasionally unaffected by dynamic lights
https://mantis.zdoom.org/view.php?id=536
2017-04-13 13:14:33 +03:00
alexey.lysiuk fbc1028d2b Fixed crash when parsing DECORATE constant expressions 2017-04-13 12:06:59 +03:00
alexey.lysiuk cbf2a21c83 Fixed registration of tentative classes 2017-04-13 12:03:45 +03:00
alexey.lysiuk c99cecea8e Fixed warnings reported by GCC/Clang
src/p_pspr.cpp:363:37: warning: more '%' conversions than data arguments [-Wformat]
src/gl/textures/gl_texture.cpp:845:21: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
2017-04-13 10:40:44 +03:00
alexey.lysiuk 1889efa814 Fixed build with Clang
Fixed bunch of compilation errors:
cannot pass non-trivial object of type 'FString' to variadic method; expected type from format string was 'char *' [-Wnon-pod-varargs]

Fixed linker erorr:
g_doomedmap.cpp.o: In function `InitActorNumsFromMapinfo()':
src/g_doomedmap.cpp: undefined reference to `PClass::FindActor(FName)'
2017-04-13 10:40:43 +03:00
Christoph Oelckers 1c8d698121 - added WeaponState enum for ZScript. 2017-04-13 02:42:31 +02:00
Christoph Oelckers 1712667ce2 Merge branch 'master' of https://github.com/coelckers/gzdoom 2017-04-13 02:18:16 +02:00
Christoph Oelckers 85d8244d03 - fixed: With the reorganization of the class data the setup of actor replacements must be delayed until after InitializeDefaults has been called. 2017-04-13 02:18:06 +02:00
Christoph Oelckers 6599e2c425 - moved the VM types into their own file and only include it where really needed. 2017-04-13 01:12:04 +02:00
Christoph Oelckers 3e47f00ba0 - the new order requires manual deletion of all class descriptors. 2017-04-12 22:57:14 +02:00
Christoph Oelckers fc9e304189 - separated class descriptors from VM types.
Combining these two groups of data has been the cause of many hard to detect errors because it allowed liberal casting between types that are used for completely different things.
2017-04-12 22:46:49 +02:00
Christoph Oelckers afd6743965 - moved AddNativeField to PSymbolTable, too. 2017-04-12 18:29:58 +02:00
Christoph Oelckers 8dc11317dd - Moved WriteFields into SymbolTable as well. 2017-04-12 17:42:10 +02:00
Christoph Oelckers 96631e8808 - make PClass not inherit from PStruct.
Having these two types related can cause problems with detection in the compiler because for some parts they need quite different handling.
Common handling for the fields has been moved into PSymbolTable but overall redundancy was quite minor as both types share surprisingly little functionality.
2017-04-12 17:21:13 +02:00
alexey.lysiuk 20a9f17a15 Fixed handling of count parameter's default value in Array.Delete()
https://mantis.zdoom.org/view.php?id=571
2017-04-12 17:40:17 +03:00
alexey.lysiuk d8d7dc973c Added check for selected item in save/load menu
https://mantis.zdoom.org/view.php?id=570
2017-04-12 17:15:12 +03:00
Christoph Oelckers 0d7b7d6ab1 - merged PStruct and PNativeStruct.
There were exactly 4 places in the code that checked for the difference, this is better done with a flag.
2017-04-12 15:12:41 +02:00
Christoph Oelckers 63eb3e331e - un-const-ify some functions. 2017-04-12 14:40:29 +02:00
Christoph Oelckers abc4481431 - set PointedType to null for PClassPointer to simplify the functions for this class. 2017-04-12 13:11:59 +02:00
Christoph Oelckers 6308251084 - added a FindSymbol wrapper to PClass so that other code does not need to access the symbol table directly.
- added an isActor utility function to codegen.cpp to simplify a few constructs.
2017-04-12 13:08:41 +02:00
Christoph Oelckers b17ab7a133 - put PObjectPointer to some use.
- fixed: There was no check for compatible class pointers.
2017-04-12 11:40:40 +02:00
Christoph Oelckers bc486904cd - split PPointer into PPointer and PObjectPointer.
A pointer to an object has quite different semantics so let's do this with proper virtual inheritance. This should allow to simplify a lot of pointer related checks in the compiler.
2017-04-12 10:52:54 +02:00
Christoph Oelckers 80801d11b1 - removed some redundant static_casts. 2017-04-12 10:29:04 +02:00
Christoph Oelckers 9c9b2ccf6d - replaced more dyn_casts and checks for RUNTIME_CLASS(PClassActor)
It is preferable to use IsDescendantOf wherever possible if we ever want to be able to separate PClass from PType.
2017-04-12 10:20:58 +02:00
Christoph Oelckers 5350721ec5 - removed PClass::DeriveData because it is no longer needed.
- fixed: IsVisibleToPlayer and optimized it a bit more.
- moved SourceLumpName to PClass, so that it can also be used for non-actors (there's a lot of non-Actor classes already.)
- separated the serializer for PClassPointer from PPointer. Even though not doable, a pointer to a class type is something entirely different than a class pointer with a restriction so each should handle its own case.
2017-04-12 09:55:27 +02:00
Magnus Norddahl df8fa1274a - Oops, forgot to actually disable vid_glswfb in last commit 2017-04-12 03:22:38 +02:00
Magnus Norddahl 96834fa524 - Turn off vid_glswfb, gl_es on Linux ARM and stop saving it in the config file until it fully works 2017-04-12 03:21:43 +02:00
Christoph Oelckers 0e0eca0e0f - replaced some dyn_casts with calls to FindActor.
- fixed type checks in A_Morph.
2017-04-12 01:29:51 +02:00
Christoph Oelckers e4d2380775 - moved all remaining fields from PClassActor to FActorInfo.
- added a few access functions for FActorInfo variables.

With PClassActor now empty the class descriptors can finally be converted back to static data outside the class hierarchy, like they were before the scripting merge, and untangle the game data from VM internals.
2017-04-12 00:07:41 +02:00
Christoph Oelckers 854053a14f - use TArrays instead of TMaps to store damage factors and pain chances.
For these fields maps have no advantage. Linearly searching a small array with up to 10 entries is nearly always faster than generating a hash for finding the entry in the map.
2017-04-11 23:29:37 +02:00
Christoph Oelckers 4afe2d4218 - moved OwnedStates and NumOwnedStates out of PClassActor. 2017-04-11 22:44:35 +02:00
Christoph Oelckers 05240ccbe5 - fixed redundant reallocation of constructable meta fields.
- some optimization of access to OwnedStates in old DECORATE.
- consolidate all places that print a state name into a subfunction.
- allocate states from the ClassDataAllocator memory arena. States do not need to be freed separately from the rest of the static class data.
2017-04-11 21:48:41 +02:00
Christoph Oelckers 311ce2362a - started moving stuff out of PClassActor into meta data.
This reinstates the old FActorInfo as part of the meta data a class can have so that the class descriptor itself can be freed from any data not directly relevant for managing the class's type information.
2017-04-11 19:37:56 +02:00
Christoph Oelckers 6a3ddaa8fa - moved Restricted/ForbiddenToPlayerClass fully to the script side.
This required some fixes for allowing to read from metadata arrays.
2017-04-11 15:11:13 +02:00
Christoph Oelckers 45691e91c9 - removed PClassActor::PointerSubstitution.
This is not needed anymore because classes do not need to be replaced. The only reason this was implemented was the original design with the class descriptors taking on all the metadata themselves.
2017-04-11 14:03:49 +02:00
Christoph Oelckers 1febf277af - fixed crash on bad PNGs.
The cast to a signed long could create negative numbers which failed the sanity check and caused a stack corruption.
2017-04-11 10:29:52 +02:00
Magnus Norddahl f049e6145b - remove all usage of std::make_unique to keep things C++11 compliant 2017-04-11 01:25:44 +02:00
Magnus Norddahl bdf02ea67c - move masked reads 2017-04-11 01:11:30 +02:00
Christoph Oelckers 7a6e70e777 - reenabled the part of OP_THROW that throws a VMAbortException. This part is still needed for a runtime variable access check. 2017-04-11 00:11:36 +02:00
alexey.lysiuk 4c1e03ebff Fixed alignment issue with GCC/Clang i386 build 2017-04-10 22:20:34 +03:00
alexey.lysiuk d5edd3db36 Commented out remains of VM exception handling opcodes
This fixes build with GCC/Clang
2017-04-10 22:18:43 +03:00
Christoph Oelckers 040c70714c - commented out the exception handling opcodes in the VM.
They are currently not used and not planned to be used - and they are rather costly by increasing stack size per call quite significantly.
2017-04-10 20:41:55 +02:00
Christoph Oelckers 9ae97502be - removed the last remnants of the ATAGs. 2017-04-10 17:08:52 +02:00
Christoph Oelckers 60dd58e7d2 - most ATAG stuff is gone, except for the static storage space in the VMFunction. 2017-04-10 16:06:18 +02:00
Christoph Oelckers 5464336035 - removed ATAGs from the function builder. 2017-04-10 15:48:27 +02:00
Christoph Oelckers e551ef52f8 - removed atag parameter from GetConstantAddress. 2017-04-10 15:39:04 +02:00
Christoph Oelckers ef77cbd295 - stop using the ATAGs for checking pointer types in asserts.
This is an incredibly costly way to do a debug check as it infests the entire VM design from top to bottom. These tags are basically useless for anything else but validating object pointers being passed to native functions (i.e. mismatches between definition and declaration) and that simply does not justify a feature that costs execution time in non-debug builds and added memory overhead everywhere.
Note that this commit does not remove the tags, it only discontinues their use.
2017-04-10 15:18:31 +02:00