Commit graph

12733 commits

Author SHA1 Message Date
alexey.lysiuk
2add60a4c4 Single RUNTIME_CLASS() macro for classes and templates
The main purpose of this is to fix compilation errors with GCC/Clang
src/dobject.h:87:48: error: expected primary-expression before ‘)’ token
2017-04-14 18:07:20 +03:00
Christoph Oelckers
cde450dd8a - some enhancements for PowerReflection. 2017-04-14 16:51:11 +02:00
Christoph Oelckers
329c168cc2 - added a distance parameter to A_SprayDecal. 2017-04-14 16:28:54 +02:00
Christoph Oelckers
92acbdc625 - made GetClassName an intrinsic and expanded it to also work on class types. 2017-04-14 16:14:27 +02:00
Christoph Oelckers
1135f154b7 - fixed: For Screen.SetClipRect, -1 is a valid value for width and height so it must not be clamped away. 2017-04-14 15:41:36 +02:00
Christoph Oelckers
47bb29bac6 - check the return value of ogl_LoadFunctions and abort if it indicates failure.
If this happens there is normally something very wrong on the system side so continuing is not advised.
2017-04-14 15:32:04 +02:00
Christoph Oelckers
7983f6ea4f - fixed incorrect return variable. 2017-04-14 15:23:18 +02:00
alexey.lysiuk
fd07b56ae9 Fixed link error for MSVC x64 build with modern Windows SDK
win32video.obj : error LNK2001: unresolved external symbol IID_IDirectDraw2
2017-04-14 16:13:51 +03:00
Christoph Oelckers
33145610b1 - let's better add a null check to Create<> in case allocation or construction fails. Although unlikely it's not impossible. 2017-04-14 13:48:00 +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
dc5a5419fc - took DCanvas and all its subtypes out of the DObject tree.
I have no idea why they were even in there, as they intentionally circumvented all GC related features - they declared themselves fixed if prone to getting collected, they all used OF_YesReallyDelete when destroying themselves and they never used any of the object creation or RTTI features, aside from a single assert in V_Init2.

Essentially they were a drag on the system and OF_YesReallyDelete was effectively added just to deal with the canvases which were DObjects but not supposed to behave like them in the first place.
2017-04-14 10:48:18 +02:00
Magnus Norddahl
d407aa3157 - Fix linear filtering bug for sprites 2017-04-13 22:16:26 +02:00
Christoph Oelckers
b1057cee36 - fixed: do not draw armor on the fullscreen HUD if the amount is 0. 2017-04-13 20:43:17 +02:00
Major Cooke
29394da7ed Static functions cannot have const. 2017-04-13 19:43:41 +02:00
Major Cooke
523b31a16a Made several string functions const. 2017-04-13 19:43:41 +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
98dab9c4b9 - took PTypeBase and all its subclasses out of the DObject hierarchy.
- moved scope flag to a new variable that is specific to PType instead of hijacking the ObjectFlags for this.
2017-04-13 17:47:17 +02:00
Christoph Oelckers
988fe8d735 - removed all RTTI from the type table.
Using names is just as good as using types so now this is what's done.
2017-04-13 16:01:38 +02:00
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