This removes the last non-vararg cases where a native VM function checks 'numparam'. As of this commit all function calls will pass the complete list of arguments.
Null pointers must be allowed and non-object pointers which are not null must be explicitly checked for because the code could crash on them when performing a static_cast on an incorrect type.
There were some issues here:
* a check for mismatching count is too strict because it is legal to omit return values
* it failed to detect returning multiple values in a single expression.
The instruction one free instruction byte so it's now using that to extend its argument's register range to 65535.
For param this is needed because it passes strings by reference and creating an implicit temporary copy for string constants does not work here.
This setup has been a constant source of problems so now I reviewed all uses of FName to make sure that everything that needs to be initialized is done manually.
This also merges the player_t constructor into the class definition as default values.
Due to how function calls get resolved by the code generator there were some incorrect flags on the self pointer which triggered an assert and caused incorrect code generation.
Fortunately this was a mostly contained special case for which a workaround was possible.
This is needed so that MAPINFO settings for these flags don't get ignored.
(cherry picked from commit 1fdcacc337)
# Conflicts:
# src/scripting/backend/codegen.cpp
This violated an important rule that a cast may not alter the expression's type and led to failed asserts elsewhere.
(cherry picked from commit 7d515e72c2)
Due to the special nature of this expression the code generator got stuck in 'address' mode and passed the address of the variable instead of its value.
Note that this is merely a hotfix. Properly handling this to allow universal use of state scopes will require more work in cases where a scoped state is being accessed through a non-self pointer.
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.