Commit Graph

121 Commits

Author SHA1 Message Date
Christoph Oelckers de4153ceaf some groundwork for the implementation of dynamic arrays
- created script exports for all relevant functions with all integral types.
- created script side definitions for the underlying data types.
- added a void pointer type so that the prototype for the pointer array can use a generic type every pointer can be assigned to.
2017-01-11 00:57:31 +01:00
Christoph Oelckers 3e4f799bbc - made Actor.DamageMobj virtual. 2017-01-10 21:31:52 +01:00
Christoph Oelckers 06c97d898b - added a new parameter to A_CustomRailgun to customize the inaccuracy induced by a moving target. 2017-01-10 20:08:23 +01:00
Christoph Oelckers 3b7eb849a7 - fixed: The default minimum and maximum distances for A_Teleport were swapped. 2017-01-04 23:56:41 +01:00
Christoph Oelckers 9948189193 - scriptified PowerProtection and PowerDamage.
- made ModifyDamage calls iterative instead of recursive. With going through the VM they'd be too costly otherwise.
- small optimization: Detect empty VM functions right when entering the VM and shortcut them. This is to reduce the overhead of virtual placeholders, which in a few cases (e.g. CanCollideWith and ModifyDamage) can be called quite frequently.
2017-01-01 23:11:48 +01:00
ZZYZX 44c19b5ad9 Changed zero RenderRadius logic - negative values now used for 'no rendering', restored old logic with max(radius, renderradius) 2016-12-25 13:40:21 +02:00
ZZYZX fcd8a0ce92 Reverted STYLE_None change to P_LinkRenderSectors, implemented zero RenderRadius that effectively disables rendering of an actor entirely 2016-12-25 13:35:03 +02:00
ZZYZX 87b23d160b Ported RenderRadius and related code from gzdoom branch 2016-12-25 13:09:32 +02:00
Christoph Oelckers d4c0ee9e43 - address bad use of pitch in A_CustomMissile.
This function calculated everything correctly but ultimately set the vertical velocity wrong. Most importantly this meant that the actual velocity vector and actor pitch - if CMF_SAVEPITCH was used - did not match.
Since this bug has been present since the pitch parameter was added, this deprecates A_CustomMissile and replaces it with a properly implemented A_SpawnProjectile function and handling the compatibility case with a new flag and a scripted wrapper function.
All internal uses of A_CustomMissile have been replaced as well.
2016-12-24 14:46:34 +01:00
Major Cooke 1bcebb091a Added option to check the location for resizing, changing the return into a bool. 2016-12-18 11:59:24 +01:00
Major Cooke 3023af8223 - Added A_SetSize(double newradius, double newheight = -1).
- Changes the calling actor's radius and height.
2016-12-18 11:59:24 +01:00
Christoph Oelckers aa758159c9 - renamed Actor.NoiseAlert to Actor.SoundAlert to deconflict with the same-named action special. 2016-12-11 12:10:05 +01:00
Christoph Oelckers 94287518e0 - added a virtual CanCollideWith script method that can be overridden to do class specific collision checks.
This will get called for both actors taking part in a collision, if one of the two calls returns false it will immediately abort PIT_CheckThing with no collision taking place at all.
2016-12-04 10:13:36 +01:00
Christoph Oelckers 82c2670617 - removed redundant DoDropItem function. A_DropItem already exists and can be used instead. 2016-12-02 11:42:33 +01:00
Christoph Oelckers 86544086df - allow the VM to run on one global stack per thread.
It is utterly pointless to require every function that wants to make a VM call to allocate a new stack first. The allocation overhead doubles the time to set up the call.
With one stack, previously allocated memory can be reused. The only important thing is, if this ever gets used in a multithreaded environment to have the stack being declared as thread_local, although for ZDoom this is of no consequence.

- eliminated all cases where native code was calling other native code through the VM interface. After scriptifying the game code, only 5 places were left which were quickly eliminated. This was mostly to ensure that the native VM function parameters do not need to be propagated further than absolutely necessary.
2016-11-30 17:15:01 +01:00
Christoph Oelckers 47884f8a71 - fixed a few bad declarations. 2016-11-30 16:19:13 +01:00
Christoph Oelckers fb3bde0e0d - cleaned up and grouped the virtual function declarations in AActor to ensure that everything has been properly exported.
- removed the native parts of SpecialBlastHandling. Since this is called from the script side and the only remaining native remnant was an empty function it's now 100% scripted.
2016-11-30 01:39:06 +01:00
Christoph Oelckers bbf62132d8 - added a larger batch of function exports.
- cleaned up the virtual function interface of APlayerPawn which still had many virtual declarations from old times when class properties were handled through virtual overrides. None of this makes sense these days anymore.
2016-11-30 01:25:51 +01:00
Christoph Oelckers 9193466572 - scriptified ASecurityCamera and AAimingCamera.
This concludes this round of script converesions of internal classes.
2016-11-29 20:16:14 +01:00
Christoph Oelckers a13e23dbe6 - scriptified some trivial stuff from g_shared. 2016-11-29 19:50:34 +01:00
Christoph Oelckers 0c969746d0 - scriptified Hexen's spike, which was the last remaining item in the game directories.
- added a BlockThingsIterator for scripts.
2016-11-29 18:42:48 +01:00
Christoph Oelckers b625156df6 - scriptified Strife's flamethrower and grenade launcher. 2016-11-29 14:12:39 +01:00
Christoph Oelckers 5beebb83b7 - scriptified Strife's assault gun and missile launcher. 2016-11-29 13:28:43 +01:00
Christoph Oelckers be5ba70ed2 - scriptified Strife's dagger and crossbow. 2016-11-29 13:00:07 +01:00
Christoph Oelckers 3af9232fca - scriptified a_strifeitems.cpp and a_debris.cpp.
- Changed the glass shards so that they do not have to override FloorBounceMissile. It was the only place where this was virtually overridden and provided little usefulness.
- made 'out' variables work.
- fixed virtual call handling for HandlePickup.
2016-11-29 12:17:05 +01:00
Christoph Oelckers 55b549c0c6 - converted the rest of a_strifestuff.cpp.
- changed some very old A_Explode calls which passed all values as integer literals.
2016-11-29 00:16:30 +01:00
Christoph Oelckers edd8e51a69 - scriptified most of a_strifestuff.cpp. 2016-11-28 23:30:14 +01:00
Christoph Oelckers caef5344b0 - scriptified a_thingstoblowup.cpp.
- changed the power crystal floor movement to use DFloor instead of an incomplete in-place hack to ensure that everything is processed properly.
2016-11-28 21:33:14 +01:00
Christoph Oelckers dd5494d848 - scriptified Stalker and Sentinel. 2016-11-28 19:56:16 +01:00
Christoph Oelckers 360cbfba2a - scriptified Oracle, Programmer and Rebels. 2016-11-28 19:42:26 +01:00
Christoph Oelckers 119bcb924d - scriptified the Loremaster. 2016-11-28 18:59:57 +01:00
Christoph Oelckers b8cf377d9e - scriptified the Crusader. 2016-11-28 18:36:13 +01:00
Christoph Oelckers dc9ee0727a - scriptified a_spectral.cpp.
- consolidated A_Tracer and A_Tracer2.

Note that this commit temporarily disables a few features in order to make it compile.
2016-11-28 12:55:33 +01:00
Christoph Oelckers b171d6e21f - scriptified a_alienspectres.cpp. 2016-11-28 11:52:03 +01:00
Christoph Oelckers ebd2c27e0a - scriptified Hexen's Bloodscourge and Serpent.
- merged the FrontBlock searcher for the Bloodscourge into RoughMonsterSearch. This also fixes the bug that the searcher was not initialized properly for the MageBoss.
2016-11-28 00:49:10 +01:00
Christoph Oelckers f9a1388066 - scriptified Hexen's lightning weapon. 2016-11-27 22:14:18 +01:00
Christoph Oelckers 7b5a589635 - scriptified Hexen's Frost shards.
- scriptified all SpecialMissileHit methods.
2016-11-27 21:41:04 +01:00
Christoph Oelckers 5ce5466e18 - scriptified hexenspecialdecs.
- made '->' a single token. Although ZScript does not use it, the parser tends to get confused and fatally chokes on leftover arrows so this ensures more robust error handling.
2016-11-27 20:14:43 +01:00
Christoph Oelckers de6969997a - scriptified Hexen's flies.
A few notes:

 * this accesses the lines array in sector_t which effectively is a pointer to an array of pointers - a type the parser can not represent. The compiler has no problems with it, so for now it is defined internally.
 * array sizes were limited to 65536 entries because the 'bound' instruction only existed as an immediate version with no provisions for larger values. For the static map arrays 65536 is not sufficient so now there are alternative instructions for these cases.
 * despite the above, at the moment there is no proper bounds checking for arrays that have no fixed size. To do this, a lot more work is needed. The type system as-is is not prepared for such a scenario.
2016-11-27 18:52:24 +01:00
Christoph Oelckers f409a24d2d - fixed: Readonly pointers never were flagged as such.
- fixed: Assignment from a readonly to a read-allowed pointer must be an error.
- made GetDefaultByType a builtin so that it can do proper type assignment to the result, which for a function would be problematic in this case, even if automatic type deduction was implemented. Since this returns the class defaults which are not a real object, the result cannot be subjected to a type cast.
- error out if a type cast of a readonly pointer is attempted.
- fixed: FxBooleanNot could clobber a local variable because it used the source register to manipulate the result.
2016-11-27 16:24:33 +01:00
Christoph Oelckers 3dd323ac0d - scriptified the Flechette. Not fully tested yet.
- fixed issues with the refactoring of the recent commits. This one starts again.
- added builtins for TextureID.

Note about builtins: Currently they are just hacked into the compiler backend. They really should be made part of the respective types to keep matters clean and allow more widespread use of builtins to create more efficient code.
2016-11-27 16:24:33 +01:00
Christoph Oelckers b10ffb5133 - exported a few more functions.
- refactored the ModifyDamage interface to be more scripting friendly.

In general it should be avoided having to call directly into chained inventory functions because they are very problematic and prone to errors. So this got wrapped into a single handler (on AActor, not AInventory!) which will later make it easier to refactor the parameters of ModifyDamage to work better for scripting and avoid the chaining.
2016-11-27 16:24:32 +01:00
Christoph Oelckers 096c51d546 - changed AInventory::HandlePickup to work iteratively instead of recursively.
Two reasons for this:

1. if this has to be routed through the VM each recursion will cost 1000 bytes of stack space which simply is not good.
2. having the virtual function only care about the item itself but not the entire inventory chain is a lot less error prone for scripting.

Since the scripting interface needs a separate caller function anyway this seemed like a good time to change it. The same will be done for the other chained inventory handlers as well.
2016-11-27 16:24:31 +01:00
Christoph Oelckers ab03b016e9 - scriptified the IceGuy. 2016-11-27 00:41:06 +01:00
Christoph Oelckers 69d4d36429 - scriptified ArtiHealingRadius.
- allow switch/case with names.
- fixed break jump target handling for switch/case. This only worked when the break was in the outermost compound statement, those in inner ones were missed.
2016-11-27 00:18:07 +01:00
Christoph Oelckers 796c262285 - scriptified the Quietus. 2016-11-26 23:05:16 +01:00
Christoph Oelckers 80f233cd0b - scriptified the fighter's fist. 2016-11-26 22:25:49 +01:00
Christoph Oelckers 997e4a2ac4 - scriptified the remaining Cleric weapons. 2016-11-26 19:23:22 +01:00
Christoph Oelckers 177aa6ec42 - converted half of ClericHoly. (Making a commit before starting on the more complex stuff.)
- added a 'constructor' for color values.
2016-11-26 13:18:48 +01:00
Christoph Oelckers 4e802652c7 - scriptified ArtiBlastRadius. 2016-11-26 09:51:14 +01:00