Commit Graph

63 Commits

Author SHA1 Message Date
Christoph Oelckers 06ad2351d3 - fixed error in vertical velocity calculation for A_SkullAttack. 2017-01-21 19:56:54 +01:00
Christoph Oelckers bf09a89b5d - fixed typo in A_BrainSpit. 2017-01-02 23:26:19 +01:00
Christoph Oelckers 80effbb547 - fixed: A_M_Refire's 'ignoremissile' parameter lost its default value. 2017-01-01 15:41:40 +01:00
Christoph Oelckers 3d61d2c1f4 - reviewd script code for spawn calls that did not check their results.
Nothing should ever assume that spawning an actor is unconditionally successful. There can always be some edge cases where this is not the case.
2016-12-31 15:40:51 +01:00
Christoph Oelckers 19856d6ccb Merge branch 'master' of https://github.com/rheit/zdoom 2016-12-25 22:56:35 +01:00
Christoph Oelckers 4fcf9933f0 - copy target to a local variable in A_VileAttack so that it remains accessible if A_Explode destroys the actor. 2016-12-23 16:34:02 +01:00
Christoph Oelckers 71fd949f26 Merge branch 'master' of https://github.com/rheit/zdoom 2016-12-11 14:45:42 +01:00
Christoph Oelckers 40355f6298 - allow A_M_Refire to be called without state label because this seems to have been used in existing DECORATE mods. This way of calling it will revert to the old behavior of jumping one state forward instead of to a state label. 2016-12-11 13:07:25 +01:00
Christoph Oelckers 952e47cfe4 - renamed internal MELEERANGE constant to deconflict with Actor's MeleeRange member. 2016-12-10 16:36:19 +01:00
Christoph Oelckers e41e404143 Merge branch 'zscript' of https://github.com/rheit/zdoom into gz-zscript 2016-12-06 12:33:52 +01:00
Christoph Oelckers 092461ed34 - make dynamic object casts a dedicated VM instruction instead of a builtin function.
This can see some heavy use in iterators where saving several hundreds of function calls can be achieved. In these cases, using a function to do the job will become a significant time waster.
2016-12-05 14:52:34 +01:00
Christoph Oelckers ebdc672985 - fixed: A_Saw was using the wrong angle for adjusting the facing direction at the end. 2016-12-04 10:45:20 +01:00
Christoph Oelckers c927aca2a0 Merge branch 'zscript' of https://github.com/rheit/zdoom into gz-zscript
# Conflicts:
#	wadsrc/static/zscript.txt
2016-11-30 18:46:23 +01:00
Christoph Oelckers f5b3429274 - partial scriptification of the Heresiarch 2016-11-29 15:24:38 +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 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 b5f55cacba - removed test code. 2016-11-25 09:56:06 +01:00
Christoph Oelckers 11ac0c622b - fixed: The BFG needs to get its default ammo usage from the DehInfo struct.
- fixed: State's fields need to be declared native.
2016-11-25 01:33:04 +01:00
Edoardo Prezioso c25774e311 - Fixed the Super Shotgun refire mismatch. 2016-11-25 00:42:09 +01:00
Edoardo Prezioso 3a059cbfd6 - Backported A_FireRailgun 'puffType' param from Zandronum.
Zandronum added this so that it could restore the original Skulltag piercing armor capability with a specific puff, like it's done with the other zdoom railgun action functions.
2016-11-24 11:31:40 +01:00
Christoph Oelckers 1a20a5b999 - scriptified A_PainShootSkull which was the last remaining bit in g_doom, so this directory is gone now. 2016-11-23 19:47:09 +01:00
Christoph Oelckers 099b9970ef - added proper definitions for all exported native fields.
- synthesize native fields for all declared flags, not just for AActor.
2016-11-22 23:43:32 +01:00
Christoph Oelckers 980c986305 - allow defining native fields through scripts. Internally this only requires exporting the address, but not the entire field.
- added new VARF_Transient flag so that the decision whether to serialize a field does not depend solely on its native status. It may actually make a lot of sense to use the auto-serializer for native fields, too, as this would eliminate a lot of maintenance code.
- defined (u)int8/16 as aliases to the byte and short types (Can't we not just get rid of this naming convention already...?)
- exporting the fields of Actor revealed a few name clashes between them and some global types, so Actor.Sector was renamed to CurSector and Actor.Inventory was renamed to Actor.Inv.
2016-11-22 19:20:31 +01:00
Christoph Oelckers 3db712cd73 - fixed: Switch statement without a default jumped to the first first case label instead.
- removed placeholder code from scripted Marine.
2016-11-21 22:20:25 +01:00
Christoph Oelckers 135cfcf016 - implemented State as an actual native struct, so that its fields can be accessed from scripts.
- refactored state bitfield members into a flag word because the address of a bitfield cannot be taken, making such variables inaccessible to scripts.
- actually use PNativeStruct for representing native structs defined in a script.
2016-11-21 21:34:34 +01:00
Christoph Oelckers 360436c201 - scriptified the scripted marines.
- fixed symbol name generation for native functions.
- moved PrintableName to VMFunction so that native functions also have this information.
2016-11-21 19:09:58 +01:00
Christoph Oelckers 7c122d03e9 - renamed all instances of 'float' parameters to 'double', so that the Float32 type can be made usable for structs. 2016-11-21 13:04:27 +01:00
Christoph Oelckers e7f6bae83e - implemented named arguments.
- fixed flag CVAR access. As it turned out, OP_LBIT is a bit messy to set up properly when accessing integers that may or may not be big endian, so it now uses a shift and bit masking to do its work.
- used the SpawnPlayerMissile call in A_FireBFG to test named arguments.
2016-11-21 01:32:01 +01:00
Christoph Oelckers 0cbd260f96 - replaced all calls to GetCVar with direct CVar accesses. 2016-11-20 23:39:37 +01:00
Christoph Oelckers bb25c5faaa - scriptified the remaining Doom weapon code.
- implemented method calls from struct instances.
- optimized disassembly of VM call instructions to print the function's name at the end where it is more visible and does not need to be truncated. Also use the printable name for script functions here.
2016-11-20 12:27:26 +01:00
Christoph Oelckers 3c726aa570 - scriptified A_FirePlasma. 2016-11-20 01:18:21 +01:00
Christoph Oelckers fdab994fcb - scriptified the Rocket launcher. 2016-11-20 01:11:01 +01:00
Christoph Oelckers 814493b68d - scriptified the Super Shotgun. 2016-11-20 00:45:06 +01:00
Christoph Oelckers af34d82888 - scriptified A_Saw.
- implemented multiple-return-value assignment. Due to some grammar conflicts the originally intended Lua-inspired syntax of 'a, b = Function()' could not be done, so it's '[a, b] = Function()'
2016-11-20 00:25:38 +01:00
Christoph Oelckers 0b70df88d8 - scriptified A_FireShotgun and A_FireChaingun. 2016-11-19 16:39:45 +01:00
Christoph Oelckers d50da34664 - scriptified the pistol to test if struct member functions work.
- made APlayerPawn::PlayAttacking(2) virtual script functions so that mods have better control over player animations. Note that these have no native base so they skip the templated interface for managing virtual functions.
2016-11-19 13:56:29 +01:00
Christoph Oelckers 3ce699bf9b - implemented pass-by-reference arguments - so far only for memory based variables.
- changed Dehacked weapon function lookup to check the symbol table instead of directly referencing the VM functions. Once scriptified these pointers will no longer be available.
- removed all special ATAGs from the VM. While well intentioned any pointer tagged with them is basically unusable because it'd trigger asserts all over the place.
- scriptified A_Punch for testing pass-by-reference parameters and stack variables.
2016-11-19 01:23:56 +01:00
Christoph Oelckers 7ff5069617 - added all missing things to enable the scriptified version of A_BrainSpit.
This uses a global function, this has been placed into DObject for now because the scripting interface does not allow non-class-owned functions yet.
2016-11-18 22:12:53 +01:00
Christoph Oelckers 6e223ebc21 Merge branch 'zscript' of https://github.com/rheit/zdoom into gz-zscript
# Conflicts:
#	src/CMakeLists.txt
#	wadsrc/static/actors/doom/doomarmor.txt
#	wadsrc/static/decorate.txt
2016-11-15 11:36:59 +01:00
Christoph Oelckers 56a3dcfe80 - moved the 'brainexplode' state to the rocket, which is the actor which actually uses it.
This appears to be the only case where an actor was set to a state owned by a completely unrelated actor which would present some problems with state owner checking in AActor::SetState, so let's better get rid of it ASAP.
I believe the only reason this wasn't changed when all actors were exported 8 years ago was that old binary DEHSUPP lump.
2016-11-14 15:02:44 +01:00
Christoph Oelckers ac86a535e7 - fixed: State labels were resolved in the calling function's context instead of the called function one's.
This could cause problems with functions that take states as parameters but use them to set them internally instead of passing them through the A_Jump interface back to the caller, like A_Chase or A_LookEx.
This required some quite significant refactoring because the entire state resolution logic had been baked into the compiler which turned out to be a major maintenance problem.
Fixed this by adding a new builtin type 'statelabel'. This is an opaque identifier representing a state, with the actual data either directly encoded into the number for single label state or an index into a state information table.
The state resolution is now the task of the called function as it should always have remained. Note, that this required giving back the 'action' qualifier to most state jumping functions.

- refactored most A_Jump checkers to a two stage setup with a pure checker that returns a boolean and a scripted A_Jump wrapper, for some simpler checks the checker function was entirely omitted and calculated inline in the A_Jump function. It is strongly recommended to use the boolean checkers unless using an inline function invocation in a state as they lead to vastly clearer code and offer more flexibility.

- let Min() and Max() use the OP_MIN and OP_MAX opcodes. Although these were present, these function were implemented using some grossly inefficient branching tests.
- the DECORATE 'state' cast kludge will now actually call ResolveState because a state label is not a state and needs conversion.
2016-11-14 14:12:27 +01:00
Christoph Oelckers cf9cdeb480 - scriptified the Revenant's code. 2016-11-07 23:16:25 +01:00
Christoph Oelckers 75c20ebaa6 - typo in Lostsoul definition. 2016-11-07 21:30:08 +01:00
Christoph Oelckers 062574b726 - fixed damage handling in A_BetaSkullAttack. For unknown reasons this completely bypassed the normal damage function semantics and even multiplied that with a random value.
- made some tests about calling script code from native functions.

 * scriptified A_SkullAttack to have something to test
 * changed the A_SkullAttack call in A_PainShootSkull.
 * use a macro to declare the function pointer. Using local static variable init directly results in hideous code for the need of being thread-safe (which, even if the engine was made multithreaded is not needed here.)
 * Importsnt node here: Apparently passing an actor pointer to the VMValue constructor results in the void * version being called, not the DObject * version.
2016-11-06 11:36:12 +01:00
Christoph Oelckers 98fa3d2d93 - added an accessor to the actor defaults. This might have been possible with less work using a function but that would have necessitated some type casts when using it on subclasses.
- scriptified A_BarrelDestroy to test the above.
2016-11-05 17:14:16 +01:00
Christoph Oelckers 010fd038be - scriptified A_KeenDie.
- added an 'exact' parameter to FThinkerIterator's Next function. This is mainly for scripting which allows to do a lot more checks natively when running the iterator while looking for one specific class.
2016-11-05 01:19:41 +01:00
Christoph Oelckers 8305005125 - remove debug message. 2016-11-03 13:39:51 +01:00
Christoph Oelckers a45523fb63 - scriptified A_SpawnFly.
- added support for global variables to the code generator - not the compiler, though. For the handful of entries this is needed for it may just as well be done manually. So far FLevelLocals level is the only one being exported.
- fixed: The VM disassembler truncated 64 bit pointers to 15 digits because the output buffer was too small.
- resolve entire FxSequences instead of aborting on the first failed entry. This allows to output all errors at once.
2016-11-03 13:38:40 +01:00
Christoph Oelckers 5e76d3af18 - fixed BrainishExplosion and removed some unnecessary checks, the state to be set is being defined in the same file, after all... 2016-11-02 00:14:08 +01:00
Christoph Oelckers e620c9bd7d - scriptified parts of a_bossbrain.cpp. Some things cannot be done yet, the script code is there but commented out.
- exported thinker iterator and drop item chain to scripting. Unlike its native counterpart the script-side iterator is wrapped into a DObject to allow proper handling for memory management.
- fixed: The VMFunctionBuilder only distinguished between member and action functions but failed on static ones.
- fixed: FxAssign did not add all needed type casts. Except for purely numeric types it will now wrap the expression in an FxTypeCast. Numeric handling remains unchanged for both performance reasons and not altering semantics for DECORATE.
- exported all internal flags as variables to scripting. They still cannot be used in an actor definition.
- make ATAG_STATE the same as ATAG_GENERIC. Since state pointers exist as actual variables they can take both values which on occasion can trigger some asserts.
- gave PClass a bExported flag, so that scripts cannot see purely internal classes. Especially the types like PInt can cause problems.

Todo: we need readonly references to safely expose the actor defaults. Right now some badly behaving code could overwrite them.
2016-10-31 17:03:26 +01:00