Commit graph

271 commits

Author SHA1 Message Date
Christoph Oelckers
6634416b89 - allow skipping optional arguments of the parent function in a virtual override definition.
This is mainly to allow retroactive addition to existing virtual functions without breaking existing content.
The MeansOfDeath fix for Actor.Die would not be possible without such handling.
2018-07-29 17:00:05 +02:00
alexey.lysiuk
f17f8c9359 - added end line to various messages
so they don't screw up further output anymore
2018-05-11 18:03:57 +03:00
alexey.lysiuk
2ae8d39441 Removed all superfluous #include's
Automatically optimized by CLion IDE with manual corrections
2018-04-24 14:30:35 +03:00
alexey.lysiuk
9a9c90a504 Fixed crash on exit caused by undefined class
Referenced but undefined optional class does not abort loading with fatal error
For example, incorrect MorphProjectile's PlayerClass or MonsterClass caused crash during shutdown
2018-01-31 18:40:48 +02:00
Christoph Oelckers
694b48423a - fixed initialization of classes so that AllActorClasses only gets initialized when the game knows what is an actor and what is not.
This could result in lost states for weapons because the weapon class did not get added to the array.
2017-04-27 10:52:00 +02:00
Christoph Oelckers
96d328de9b - removed all Doom Source license and all default Raven copyright headers and replaced them with GPLv3. Also fixed the license in a few other files.
For some files that had the Doom Source license attached but saw heavy external contributions over the years I added a special note to license all original ZDoom code under BSD.
2017-04-17 13:33:19 +02:00
Christoph Oelckers
d014395dae - do not delete the namespaces when removing compiler symbols. They still get referenced by some types and must remain until the engine shuts down. 2017-04-14 19:40:50 +02:00
Christoph Oelckers
cd180d29c7 - block direct use of 'new' for DObjects.
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.
2017-04-14 13:31:58 +02:00
Christoph Oelckers
929affa3cb - removed MarkACSThinker.
The global variable holding a pointer to this thinker should be a weak reference to the instance in the thinker chain, there is no need to mark this global variable, as the thinker's lifetime is only determined by the thinker chain.

- committed a few Posix related file the last commit missed.
2017-04-14 10:59:57 +02:00
Christoph Oelckers
2d098e99fb - fixed: WP_NOCHANGE had different values in native and script code, resulting in problems with weapon selection.
This now explicitly allocates a single object it can safely point to instead of trying to hack around it.
2017-04-13 18:59:45 +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
alexey.lysiuk
cbf2a21c83 Fixed registration of tentative classes 2017-04-13 12:03:45 +03: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
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
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
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
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
alexey.lysiuk
4c1e03ebff Fixed alignment issue with GCC/Clang i386 build 2017-04-10 22:20:34 +03:00
Christoph Oelckers
04c2565d7f - added Get/SetValue functions to PBool. 2017-03-22 15:44:54 +01:00
Christoph Oelckers
5fd86cf98c - added some syntactic help to the ZScript parser to allow defining the arrays with native structs on the script side instead of having to define them internally. 2017-03-13 12:51:09 +01:00
Christoph Oelckers
d2beacfc5f - except for DWORD, all homegrown integer types are gone - a handful were left where they represent genuine Windows types. 2017-03-09 19:54:41 +01:00
Christoph Oelckers
878e6015df - made all iterator classes natively abstract so that they do not get a ConstructNative method so that OP_NEW can refuse creating them without the need to mark them as abstract.
- block creation of actors with the 'new' instruction. Unlike the above these cannot be made abstract because without ConstructNative they cannot be serialized.
2017-03-09 17:21:37 +01:00
Christoph Oelckers
ba0f5a3f94 - most WORD and SWORD are gone. 2017-03-08 18:55:55 +01:00
Christoph Oelckers
8ab562ef13 - the fourth. 2017-03-08 18:55:54 +01:00
Christoph Oelckers
6c6bab73ad - more of the same. 2017-03-08 18:55:53 +01:00
Christoph Oelckers
8a5daf211c - added version check for member variables. 2017-03-05 20:41:41 +01:00
Christoph Oelckers
456ac64723 - implemented version checks for compile-time type determination and for class inheritance.
Note that in this system, DECORATE counts as version 2.0, so any data that should be available to DECORATE should not use version restriction.
2017-03-05 17:58:55 +01:00
Christoph Oelckers
fd20e1d78f - allow hooking custom serializers into PPointer so that serializable types can be handled without having to create new type classes which would be a bit unwieldy thanks to how the type system works. 2017-03-03 20:11:13 +01:00
Christoph Oelckers
217bcb847d - fixed: When the savegame code errors out, some cleanup is required in G_DoSaveGame. 2017-03-03 19:19:19 +01:00
Christoph Oelckers
9b2f31e692 - had to add a hack because some people had to exploit implementation-dependent behavior of the PulseLight type. 2017-03-01 20:54:37 +01:00
Christoph Oelckers
b5d4a59465 - fixed: Meta properties must not be serialized. 2017-03-01 20:10:24 +01:00
Christoph Oelckers
5f6da0d222 fixed double allocation of metadata. 2017-02-28 14:44:18 +01:00
Christoph Oelckers
1311f08f47 - scriptified Actor.GetBloodType as a virtual function to allow mods more flexibility here.
- made CameraHeight a modifiable actor property - it was readonly before.
- allow accessing the type constants from ZScript, this required quite a bit of explicit coding because the type system has no capabilities to search for basic types by name.
2017-02-28 12:11:25 +01:00
Christoph Oelckers
78a66e001a - properly handle all meta properties for inventory items. 2017-02-28 00:45:16 +01:00
Christoph Oelckers
f343d36ea9 - implemented the basics of a working metadata system.
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.
2017-02-27 23:28:19 +01:00
Christoph Oelckers
65c4653f59 - restored some code in PClass::CreateDerivedClass that accidentally got removed. 2017-02-23 19:03:31 +01:00
Thomas Hume
17f04c5043 Correct two overflows in PInt ctor 2017-02-23 10:10:58 +01:00
Christoph Oelckers
d8ebbcfc08 - fixed: When loading a savegame the player class in the userinfo needs to be updated.
- fixed: Class pointers should not be added to the list of garbage collected pointers.
- fixed several warnings in the event code.
2017-02-15 11:55:08 +01:00
Christoph Oelckers
7877bcbdcb - exported more parts of the joystick menus and also exported all strings for them to the string table.
- exported the skeleton definition for list menus.
2017-02-13 17:45:03 +01:00
Christoph Oelckers
bb6def820f - everything compiles and mostly works again. 2017-02-12 14:04:48 +01:00
Christoph Oelckers
947b625c50 - all menu items scriptified, but not yet active. 2017-02-11 16:11:48 +01:00