This was done to ensure that this code only runs when the thinker itself is fully set up.
With a constructor there is no control about such things, if some common initialization needs to be done it has to be in the base constructor, but that makes the entire approach chosen here to ensure proper linking into the thinker chains impossible.
ZDoom originally did it that way, which resulted in a very inflexible system and required some awful hacks to let the serializer work with it - the corresponding bSerialOverride flag is now gone.
The only thinker class still having a constructor is DFraggleThinker, because it contains non-serializable data that needs to be initialized in a piece of code that always runs, regardless of whether the object is created explicitly or from a savegame.
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.
Referenced but undefined optional class does not abort loading with fatal error
For example, incorrect MorphProjectile's PlayerClass or MonsterClass caused crash during shutdown
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.
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.
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.
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.
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.
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.
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.
- 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.
- 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.
- block creation of actors with the 'new' instruction. Unlike the above these cannot be made abstract because without ConstructNative they cannot be serialized.
- 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.
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.