Commit graph

163 commits

Author SHA1 Message Date
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
a2f4cd7cda - fixed: All functions that are callable from weapon states and not members of Actor need to be declared 'action'.
With the stricter type checks of the self pointer that were now implemented these all produced errors.
2016-11-13 14:20:30 +01:00
Christoph Oelckers
f238f0ba5c - try to preserve a bit more information about incorrect use of user variables to print more meaningful error messages. This is not complete yet and will need integration with the previous commit. 2016-11-13 12:02:41 +01:00
Leonard2
7dbc4710f1 Add the new argument to all uses of the implement macro 2016-11-09 17:45:55 +01:00
Leonard2
bb2d61de50 Replaced the many implement macros with a single one that takes arguments instead 2016-11-09 17:45:53 +01:00
Leonard2
0b3585c83f Separate the pointer list from the implement macro 2016-11-09 17:45:52 +01:00
Christoph Oelckers
f940216c17 Merge branch 'master' into zscript
# Conflicts:
#	src/p_actionfunctions.cpp
#	wadsrc/static/actors/actor.txt
2016-11-02 11:08:51 +01:00
Christoph Oelckers
6e6249f896 - reverted WEAPONTOP to its original value of 32 and made the added fudging bit part of the render side.
This is needed so that 'offset(0,32)' does what it is supposed to do.
2016-10-31 18:53:28 +01:00
Christoph Oelckers
286f9510d4 - got rid of all default parameter redundancies.
- scriptified a few more functions.
2016-10-28 00:32:52 +02:00
Christoph Oelckers
371712c53a - turned everything I could into non-action functions.
- fixed emission of the self pointer in FxVMFunctionCall. I did not realize that the self expression only sets up a register for the value, not pushing it onto the stack.
2016-10-22 17:49:08 +02:00
Christoph Oelckers
3b0b0baf05 Merge branch 'master' of https://github.com/rheit/zdoom into zscript
# Conflicts:
#	wadsrc/static/actors/shared/player.txt
2016-10-21 19:31:08 +02:00
raa-eruanna
e0efdd97b3 - Added: PlayerPawn property "Player.ViewBob" which acts as a MoveBob/StillBob multiplier. 2016-10-21 19:24:39 +02:00
Christoph Oelckers
b1a83bfd26 - started with cleanup and separation of DECORATE code.
* everything related to scripting is now placed in a subdirectory 'scripting', which itself is separated into DECORATE, ZSCRIPT, the VM and code generation.
 * a few items have been moved to different headers so that the DECORATE parser definitions can mostly be kept local. The only exception at the moment is the flags interface on which 3 source files depend.
2016-10-12 19:22:33 +02:00
Major Cooke
31ca5a1900 Added OverlayX/Y(int layer)
- Retrieves the X/Y positions of an overlay.
- A_OverlayFlags and A_OverlayOffset now interpret a layer of 0 to mean 'use this calling layer'.
2016-10-10 10:48:50 +02:00
Major Cooke
201ae3c60f Added OverlayID() for retrieving psprite layer numbers. 2016-10-03 00:44:06 +02:00
Christoph Oelckers
f0e8e860f1 Merge branch 'master' into json 2016-09-22 09:09:48 +02:00
raa-eruanna
bc0624e3b2 Fixed my error where I was using a local session variable rather than the proper user info for the weapon bob speed. 2016-09-22 08:42:59 +02:00
raa-eruanna
780d672b25 Adds user-definable weapon bob speed 2016-09-22 08:42:59 +02:00
Christoph Oelckers
f93e4813d1 - removed farchive.cpp and .h 2016-09-22 00:48:22 +02:00
Christoph Oelckers
af6404f763 - all DObjects converted.
- cleaned out some old cruft that's no longer needed.
2016-09-20 10:27:53 +02:00
Leonard2
c0d3eb997a Fixed: the instant weapon switch flag didn't work anymore 2016-07-30 23:50:14 +02:00
Leonard2
5907ff662d Added a new state that the weapon jumps to when it is lowered all the way and the player is currently dead
The state is undefined by default to preserve the original behavior of having the weapon layer deleted which modders can now avoid by defining it properly
2016-07-28 17:42:22 +02:00
MajorCooke
1322ef2449 Renamed NODEATHJUMP to NODEATHDESELECT. 2016-07-28 08:29:47 +02:00
Leonard2
797f3aec0a Added a weapon flag to ignore a player's input when dead
The reason this is not set by default is because before that anyone could call A_WeaponReady within their Deselect state which would have allowed players to fire even when dead
2016-07-28 08:29:46 +02:00
Leonard2
bcb18cf7d8 Added a flag to prevent the weapon from jumping to its Deselect state when the player dies 2016-07-28 08:29:46 +02:00
Leonard2
446bc1018c Fixed: weapons didn't clear their flash layer when the player died 2016-07-17 17:28:45 +02:00
Leonard2
e482a54389 Fixed a crash with A_ClearOverlays 2016-07-17 14:27:56 +02:00
Leonard2
05d1df3571 Fixed crashes with the A_CrispyPlayer and A_HandLower action functions
Simply using FindPSprite in those functions wouldn't be enough because if a mod is using the firehands layer when they are called this would go very wrong
2016-07-13 13:01:32 +02:00
Leonard2
3ea70980f9 Fixed: the strife firehands were interpolated if a mod used the layer before them
The flags were also already reset, no need to do it twice
2016-07-13 13:01:32 +02:00
Leonard2
da6e12d5bc Fixed: the weapon layer offsets were interpolated even after the player switched his weapon 2016-07-13 13:01:32 +02:00
Leonard2
75cb8c00a6 Fixed: the flags weren't properly reset if a mod used the old layers before the code used them 2016-07-13 13:01:32 +02:00
MajorCooke
41d20fa6cf Fixed freeze with A_ClearOverlays. 2016-06-29 12:46:50 +02:00
MajorCooke
e02ed3a6f7 Take in the targeter layers if someone disables the safety and uses 0 for start and stop. 2016-06-20 01:15:51 +02:00
MajorCooke
ecfa7415b3 This small change was left out by mistake. 2016-06-20 01:15:51 +02:00
MajorCooke
30880aab79 And a bit more optimization... 2016-06-20 01:15:50 +02:00
MajorCooke
2b91db7b3a Refactored A_ClearOverlays. 2016-06-20 01:15:50 +02:00
MajorCooke
dd410876cf Added A_ClearOverlays(int start, int stop, bool safety).
- Clears a set of overlays in ranges [start,stop]. If unspecified, wipes all non-hardcoded layers. Safety determines whether to affect core layers or not (i.e. weapon). Returns the number of layers cleared.

Added no override boolean to A_Overlay and a boolean return type.

- If true, and a layer already has an active layer, the function returns false. Otherwise, sets the layer and returns true.
2016-06-20 01:15:49 +02:00
Edoardo Prezioso
574f2936d4 - Fixed GCC/Clang compiler errors and warnings. 2016-06-17 10:19:03 +02:00
Christoph Oelckers
cfaa3e3fa9 - changed action function interface so that callers can be identified directly, instead of guessing it from looking at the parameters.
With arbitrary PSP layers the old method was no longer safe because the layer ID was not available in the action function.
2016-06-16 16:16:27 +02:00
MajorCooke
c9f4620702 Reimplemented P_SetPsprite. 2016-06-16 07:24:00 -05:00
Leonard2
0b88bae458 The strife firehands now make proper use of the psprite layers 2016-06-03 19:46:31 +02:00
Leonard2
afa708c138 Allow psprite layers to be manipulated directly from the player's own body 2016-06-03 19:18:58 +02:00
Leonard2
eeff17c550 Account for this on the renderer's side instead
This fixes the weapon's layer behaving differently when called from
A_Overlay (the flag would be set in this case breaking the offsets)
2016-06-03 00:50:12 +02:00
Leonard2
543414d31f Added 2 new layer flags: PSPF_CVARFAST and PSPF_POWDOUBLE
These flags allowed to easily restore a lost part of the targeter layers
behavior
2016-06-03 00:50:11 +02:00
Leonard2
e1f139ddcd The targeter layers now use a proper Caller
This will avoid having to check for certain stuff and also allow them to not be destroyed when the ReadyWeapon is null like before
2016-06-03 00:50:10 +02:00
Leonard2
8244d2c844 Make sure never to call GetPSprite when the ReadyWeapon is null 2016-06-03 00:37:55 +02:00
Leonard2
9ee5e57340 Call GetPSprite here to update the ReadyWeapon but avoid doing so if it
is null

TickPSprites will take care of destroying the weapon/flash layers if the
ReadyWeapon is null
2016-06-03 00:37:54 +02:00
Leonard2
f14a840777 The ReadyWeapon is now assumed to not be null 2016-06-03 00:37:54 +02:00
Leonard2
8668719bbc Revert "- re-added P_SetPSrite."
This reverts commit e6d89b9f71.
2016-06-02 20:02:03 +02:00
Leonard2
360ad7a844 Replaced every remaining instances of the old layer names 2016-05-28 01:19:42 +02:00