Commit graph

10322 commits

Author SHA1 Message Date
alexey.lysiuk
4dd7e02721 AActor::GiveInventory() is now functional
See https://mantis.zdoom.org/view.php?id=213
2017-02-09 10:15:05 +02:00
Christoph Oelckers
ccecfeb45c - to avoid problems with the final garbage collection, the players' PendingWeapon needs to be cleared manually.
This is because it can point to a non-standard value which the garbage collector cannot deal with during engine shutdown.
2017-02-09 01:34:07 +01:00
Christoph Oelckers
4e685f2b78 - fixed: for unpositioned sounds the play position was never initialized and depended on random memory contents. 2017-02-08 23:29:52 +01:00
Christoph Oelckers
36a07b8e6e - remove all type table entries from garbage collection.
Like the symbols and the VM functions this is data that is static from startup until shutdown and has no need to be subjected to garbage collection. All things combined this reduces the amount of GC-sensitive objects at startup from 9600 to 600.
2017-02-08 22:43:20 +01:00
Christoph Oelckers
8277299135 - Turned DropItem into a plain struct again like it was before the scripting branch got merged.
Making this an object had little to no advantage, except being able to remove the deleter code. Now, with some of the class data already being allocated in a memory arena so that freeing it is easier, this can also be used for the drop item lists which makes it unnecessary to subject them to the GC. This also merges the memory arenas for VM functions and flat pointers because both get deleted at the same time so they can share the same one.
2017-02-08 20:37:22 +01:00
Christoph Oelckers
9499c22dfe - restored ZDoom 2.8.1's version of FindClassTentative which just modified the existing class instead of replacing it and having to run a costly and volatile PointerSubstitution call to replace all pointers to the old one. 2017-02-08 19:52:33 +01:00
Christoph Oelckers
17a2666bd4 - moved DisplayName, the last remaining PlayerPawn meta property, to PClassActor so that PClassPlayerPawn could be removed.
Now all actors have the same metaclass and therefore it will always be the same size which will finally allow some needed changes to the type system which couldn't be done because it was occasionally necessary to replace tentatively created classes due to size mismatches.
2017-02-08 19:42:24 +01:00
Christoph Oelckers
68e9918ed5 - moved player color sets and pain flashes into global variables.
There's simply never enough of them and they are used far too infrequently to justify the hassle of tagging along two TMaps per class.
For what they provide, single global lists that handle all player classes at once are fully sufficient.
2017-02-08 19:10:11 +01:00
Major Cooke
dd102caf13 - Fixed: SetCamera didn't have the 'action' identifier, nor did it use the actual 'cam' actor provided, rendering it nonfunctional. 2017-02-08 18:17:09 +01:00
Christoph Oelckers
c77f6636f8 - moved the three remaining variables from PClassInventory to PClassActor so that PClassInventory can be removed. 2017-02-08 18:11:23 +01:00
Christoph Oelckers
eebe09fb59 - moved the scalar class properties of PClassInventory into AInventory.
What's left is the non-scalars, they will need different treatment to get them out of the way.
2017-02-08 16:57:48 +01:00
Christoph Oelckers
2ca0e34785 - turned many of PClassPlayerPawn's strings into names and moved all scalar properties into APlayerPawn.
The goal is to get rid of PClassPlayerPawn and PClassInventory so that the old assumption that all actor class descriptors have the same size can be restored
This is important to remove some code that seriously blocks optimization of the type table because that can only be done if types do not need to be replaced.
2017-02-08 16:42:13 +01:00
Christoph Oelckers
a6785afddb - optimized the FName versions of IsDescendantOf and IsKindOf. These can be done without first looking up the class type itself. 2017-02-08 15:47:22 +01:00
Christoph Oelckers
31223ca180 - remove all symbols that get linked into the symbol table from the garbage collector.
Symbols are very easy to manage once they are in a symbol table and there's lots of them so this reduces the amount of work the GC needs to do quite considerably.
After cleaning out compile-time-only symbols there will still be more than 2000 left, one for each function and one for each member variable of a class or struct.
This means more than 2000 object that won't need to tracked constantly by the garbage collector.

Note that loose fields which do occur during code generation will be GC'd just as before.
2017-02-08 14:34:39 +01:00
Christoph Oelckers
f1b3d60b2f - PSymbol does not need to inherit from PTypeBase. This also means that there are no remaining references to any symbol object outside of the symbol tables. 2017-02-08 13:37:13 +01:00
Christoph Oelckers
18c532c307 - moved the compiler symbols into their own file.
- removed all pointer declarations to types from the symbols. All types must be placed into the type table which means that they can be considered static.
2017-02-08 13:17:25 +01:00
Christoph Oelckers
5a81a4ca16 - moved a few things around to have them into better fitting places. 2017-02-08 12:24:08 +01:00
Christoph Oelckers
f6d6f310a9 - fixed comments. 2017-02-08 11:56:12 +01:00
Christoph Oelckers
3cbd62479b - took VMFunction out of the DObject hierarchy.
As it stood, just compiling the internal ZScript code created more than 9000 DObjects, none of which really need to be subjected to garbage collection, aside from allowing lazy deallocation.
This puts an incredible drag on the garbage collector which often needs several minutes to finish processing before actual deletion can start.

The VM functions with roughly 1800 of these objects were by far the easiest to refactor so they are now. They also use a memory arena now which significantly reduces their memory footprint.
2017-02-08 11:13:41 +01:00
Christoph Oelckers
3cddcc8524 - removed PClassType and PClassClass.
All non-actors now use PClass exclusively as their type descriptor.
Getting rid of these two classes already removes a lot of obtuse code from the type system, but there's still three more classes to go before a major cleanup can be undertaken.
2017-02-07 20:45:56 +01:00
Christoph Oelckers
e3d07bddab - moved the TypeTableType pointer from PClassType to PType.
Removing this variable is needed to remove PClassType and PClassClass as the next step to eliminate all of PClass's subclasses in order to clean up the type system.
2017-02-07 20:25:52 +01:00
Christoph Oelckers
7ed554158c - got rid of PClassWeapon.
Still 5 subclasses of PClass left...
2017-02-07 19:02:27 +01:00
Christoph Oelckers
776509e68a - let skip_super use the AActor assignment operator. The blanket memcpy it used was clobbering some data.
- moved the Finalize method from PClassActor to AActor. Now that defaults get their vtbl pointer initialized this will actually work.
2017-02-07 18:12:59 +01:00
Christoph Oelckers
56024a1ebe - implemented the backend for dynamic arrays. Still needs thorough testing but it should be complete.
- use a memory arena to store flat pointers so that the messed up cleanup can be avoided by deallocating this in bulk.
- added a new SO opcode to the VM to execute a write barrier. This is necessary for all objects that are not linked into one global table, i.e. everything except thinkers and class types.
- always use the cheaper LOS opcode for reading pointers to classes and defaults because these cannot be destroyed during normal operation.
- removed the pointless validation from String.Mid. If the values are read as unsigned the internal validation of FString::Mid will automatically ensure proper results.
2017-02-07 14:48:27 +01:00
Christoph Oelckers
4ca69f10c7 - removed a few unused definitions. 2017-02-07 10:55:59 +01:00
Christoph Oelckers
dae6230f76 - fixed: Since the FastProjectile does not perform a velocity underflow check it must use an approximate comparison when deciding whether to call the Effect method. 2017-02-07 00:39:46 +01:00
Christoph Oelckers
f9712460f3 - fixed: 3D floors could be set for untagged sectors. 2017-02-07 00:31:01 +01:00
Christoph Oelckers
2021baf47d - fixed: The 'transparent' line flag did not work due to a leftover OPAQUE constant where floats were expected. 2017-02-07 00:24:04 +01:00
Christoph Oelckers
f77a528e13 - added type checks for DynArray.Copy and Move and fixed parameter processing. 2017-02-07 00:12:55 +01:00
Christoph Oelckers
96b2cb0a45 - fixed code generation for local dynamic arrays.
- removed some code repetition by inherit all variable types which reference a PField for a variable offset from a base class so that PField replacements can be done with one set of code.
2017-02-06 22:57:42 +01:00
Christoph Oelckers
ca48a687f8 - major work on dynamic array support. Mostly working, some issues still exist with Move and Copy methods and with assignments in stack variables. 2017-02-06 21:39:21 +01:00
Christoph Oelckers
12477216ef - did some cleanup on the OPL files to remove all use of homegrown integer types in favor of the standard ones. This already helps getting rid of one of the MUSLIB files still left. 2017-02-06 19:26:45 +01:00
ZZYZX
f368e70f89 Fixed overflows in String.Mid 2017-02-06 13:31:01 +01:00
ZZYZX
124d025131 More string methods 2017-02-06 12:35:21 +01:00
Christoph Oelckers
d90f2ba1fa - wrap the va_list that gets passed around by the Draw functions into a struct so that the templates can use reliable, identical semantics for both this and the VM's arg list. 2017-02-05 21:54:09 +01:00
Christoph Oelckers
a4dbbf6969 - fixed P_NightmareRespawn did not respawn a map defined spawn health and neither made skill-related adjustments. 2017-02-05 21:43:16 +01:00
Christoph Oelckers
810efe517d - fixed: AActor::SetOrigin lost its 'virtual' qualifier in the ZScript merge, but ADynamicLight needs this to work properly. 2017-02-05 21:38:06 +01:00
Christoph Oelckers
e55406bc23 - changed clean scaling factor calculation so that it doesn't prefer larger scales on high resolution displays.
This was a tweak that only makes sense when the scaling factors are low, i.e. 2 vs. 3, but for modern high resolutions it will enlarge things a bit too much.
2017-02-05 18:48:49 +01:00
alexey.lysiuk
481bddf628 Fixed incorrect offscreen rendering of player's blend 2017-02-05 18:16:27 +01:00
Christoph Oelckers
72810c969d - added ChangeCamera script function. 2017-02-05 18:07:12 +01:00
Christoph Oelckers
9e038b75fa - exported DrawChar and DrawText. 2017-02-05 16:47:33 +01:00
Christoph Oelckers
52bec33c0d - exported BrokenLines to scripting as a new class.
- removed the hard limit of 128 lines for V_BreakLines.
2017-02-05 16:18:41 +01:00
Christoph Oelckers
d8a1ce88b0 - a few more exports from FFont. 2017-02-05 13:55:38 +01:00
alexey.lysiuk
ef871ec09f Fixed compilation with GCC/Clang
error: cannot pass non-trivial object of type 'FName' to variadic function; expected type from format string was 'char *' [-Wnon-pod-varargs]
2017-02-05 14:52:17 +02:00
Christoph Oelckers
b570d0819b - streamlined font handling for scripts a bit.
- moved the two 'you raised the alarm' messages for Strife to the string table
2017-02-05 13:14:22 +01:00
Christoph Oelckers
5cfac78116 - added write barriers to the menu code.
The GC was causing some crash issues with the items not having been subjected to a write barrier.
2017-02-05 01:52:09 +01:00
Christoph Oelckers
470dc138c6 - got rid of all DTA_Translation uses. 2017-02-05 00:17:29 +01:00
Christoph Oelckers
dadc8e2ec2 - removed all uses of DTA_Translation except for the single one that passes a custom built table.
This means that with the exception of 3 pointers the DrawTexture interface only accepts numeric values now.
Still need to get rid of the last 3 to have this ready for scripting.
2017-02-04 23:26:28 +01:00
Christoph Oelckers
d50e52ea59 - use DrawChar to draw font characters instead of calling DrawTexture directly.
Mostly done to remove uses of DTA_Translation.
2017-02-04 22:50:23 +01:00
Christoph Oelckers
6dea3eef8e - exported DrawTexture to scripting.
This uses templates to avoid source duplication of ParseDrawTextureTags. Not tested yet.
2017-02-04 22:09:49 +01:00