Commit Graph

8052 Commits

Author SHA1 Message Date
Major Cooke 60d93008ba Exported TryMove. 2016-11-16 19:47:06 +01:00
Christoph Oelckers 76a74e0364 - scriptified Hexen's Dragon.
- fixed several places in the code generator that did not consider locked registers for local variables: array indices, abs and floating point builtin functions.
- added some debug aids to the bounds opcode. Just triggering an exception here which loses all relevant info is perfectly useless in a debug situation.
2016-11-16 19:18:21 +01:00
Christoph Oelckers 633da6e5d8 - scriptified two of the Acolyte's functions.
- added a DActorIterator class.
- fixed: It was not possible to have functions of the same name in two different classes because the name they were searched for was not qualified by the class. Changed so that the class name is included now, but to avoid renaming several hundreds of functions all at once, if the search fails, it will repeat with 'Actor' as class name.

This commit contains preparations for scriptifying Hexen's Dragon, but that doesn't work yet so it's not included.
2016-11-16 01:36:21 +01:00
Christoph Oelckers a2e17c0ab5 - implemented usage restrictions for action functions. 2016-11-15 21:38:12 +01:00
Christoph Oelckers 1d006b37c3 - fixed: The distance check in CheckIfCloser used the wrong variable. 2016-11-15 17:41:49 +01:00
Christoph Oelckers 4cc7d95ba5 - fixed: A_ZoomFactor and A_SetCrosshair need to be declared 'action'. 2016-11-15 16:05:42 +01:00
Christoph Oelckers e559109419 - made the floating point truncation warning a debug message because I can see this becoming more a hassle than an asset. 2016-11-15 16:01:08 +01:00
Christoph Oelckers 77a99890cf - relaxed the message for incompatible class types in DECORATE to a warning. Like finding no class at all here, this initially fell under a situation that was not discoverable and there's mods that break by making it a fatal error. 2016-11-15 15:34:25 +01:00
Christoph Oelckers 97e643c7e1 - fixed: DECORATE tried to resolved null states again, causing a type conflict. 2016-11-15 15:34:25 +01:00
Christoph Oelckers d4d6b739e0 - fixed: FxUnaryNotBoolean is not necessarily TypeBoolean, it can be altered by a type cast so the asserts had to be adjusted to cover that case. 2016-11-15 15:34:25 +01:00
Christoph Oelckers a63c749f04 - moved A_Light to Actor after finding some mods which used it badly. Besides, it should be fine to use this from PlayerPawns as well. 2016-11-15 13:39:41 +01:00
Christoph Oelckers 96d093d01f - added compile time checks for bad state links and state label references.
- preserve a state's source line information for the postprocessing phase so that the checker can output more useful information.
- added missing check for weapon psprites to DPSprite::SetState.
2016-11-15 11:21:08 +01:00
Christoph Oelckers 647e1399f1 - added runtime checks for the state usage flags. 2016-11-15 00:18:57 +01:00
Christoph Oelckers 4f998fa879 - finished the state usage parser.
- added state usage specifiers to Actor and Inventory. The states in these classes must be set to full access so that any existing mod can link to them.
2016-11-14 23:24:10 +01:00
Christoph Oelckers c797319314 - fixed parser for state block options.
- fixed incorrect flags for weapons.
2016-11-14 20:00:01 +01:00
Christoph Oelckers 7bcd83f0c1 - parser for states flags. 2016-11-14 19:35:29 +01:00
Christoph Oelckers 384f4fe7ce - added a 'DefaultStateUsage' property so that this setting can be properly set up for the classes that can inject states into other actors. 2016-11-14 18:31:12 +01:00
Christoph Oelckers a8e2f4d539 - added missing 'action' qualifiers to A_Warp and A_Teleport 2016-11-14 18:11:44 +01:00
Christoph Oelckers 199e2e2f9c - fixed CheckRange return value.
- removed the error message for multiple state blocks in DECORATE.
- added some constants for state types.
2016-11-14 17:50:09 +01:00
Christoph Oelckers ba62a86c80 - fixed: A_SetInventory still had default initializers. 2016-11-14 15:48:34 +01:00
Christoph Oelckers 85ff172ee3 Merge remote-tracking branch 'remotes/origin/master' into zscript 2016-11-14 15:03:14 +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 109558d74d - added unsigned char casts to all isspace calls in zstring.cpp
isspace takes a signed integer as parameter which triggers an assert on any non-ASCII character taken from a signed char array.
2016-11-14 13:14:07 +01:00
Major Cooke 02435b46a0 Fixed: A_SetInventory with an amount of 0 was not truly eliminating the actor. 2016-11-13 19:27:59 -06:00
Christoph Oelckers 1e6a632774 - copy the Unsafe flag to the actual function. This must have gotten lost during the merge between my own code and Leonard2's fix.
Now even in DECORATE it is possible to report most cases in which user variables are accessed from non-item states as an error. This will report all states which can be traced by a direct link from a special state label. It will not find states that only get used via A_Jump etc.
2016-11-13 14:48: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 7d49a82963 removed some unneeded checks
- since we now look for fields in the base class first the restriction check is no longer needed as it was for a different mode of looking up the identifier.
- In DECORATE we do not need to bother with non-action functions. Non-action functions cannot be defined from DECORATE so there's no need to check if we are in one.
- make the warning for unsafe access a debug message because this can affect legitimate code.
2016-11-13 12:37:28 +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 ac0413838c Fixed: A StateProvider actor could no longer use its own user variables
Refactored the FxIdentifier code a bit to avoid code duplication
2016-11-13 10:41:10 +01:00
Braden Obrzut 472f35d2ce - Fixed building with gtk2 headers. 2016-11-13 00:17:09 -05:00
Braden Obrzut 9342898361 - Added support for GTK3 (thanks to "MineyMe" and edward-san)
- Replaced GTK/OS X (note different from Cocoa) clipboard code with SDL clipboard API.
- Removed requirement to link to GTK in order to compile with GTK support.
	- GTK is no longer init'd if the GTK IWAD picker is not used.
	- Our usage of GTK is such that the dynamic loader can work with both GTK2 and GTK3 depending on what's installed.
	- Since we're accumulating a lot of library loaders I've built a generic interface as FModule which replaces TOptWin32Proc and the loaders in the OpenAL and Fluidsynth code.
2016-11-12 18:32:09 -05:00
Christoph Oelckers 49ef541513 - scriptified Hexen's Firedemon. 2016-11-12 19:16:47 +01:00
Christoph Oelckers 213b3f1fe4 - scriptified Hexen's Centaur. 2016-11-12 17:21:11 +01:00
Christoph Oelckers 8f8017836f - scriptified Hexen's Bishop. 2016-11-12 16:32:26 +01:00
Christoph Oelckers c9ee17cdcd Merge branch 'master' of https://github.com/rheit/zdoom into zscript 2016-11-12 15:36:59 +01:00
Christoph Oelckers 0c0cb6d69c - fixed warnings. 2016-11-12 15:36:36 +01:00
Christoph Oelckers 91938cd35b - fixed: The pointer defaulr for GetDistance was incorrect. 2016-11-12 15:26:29 +01:00
Christoph Oelckers a603af805c - fixed identifier resolution in FxIdentifier for action functions with a different invoker than self.
- fixed creation of direct function invocations on a state line. In order to receive the implicit arguments this needs to be wrapped into a compound statement so that the local variable getter works.
2016-11-12 15:21:59 +01:00
Christoph Oelckers fe74a14431 - fixed: A_GiveInventory should not try to give stuff to an owned inventory item, because it doesn't own its Inventory pointer - it is used for the linked list of the owner's inventory. 2016-11-12 14:48:10 +01:00
Christoph Oelckers 32e0123e1b - fixed: FResourceLump::LumpNameSetup passed negative numbers to FString::Truncate for extension-less lump names. 2016-11-12 14:01:34 +01:00
Edoardo Prezioso ffea457d81 - Fixed GCC/Clang warnings with serializer Unicode parser. 2016-11-12 13:35:10 +01:00
Christoph Oelckers 5adb2fe690 - fixed copy/paste error in A_UnsetReflectiveInvulnerable. 2016-11-12 13:11:32 +01:00
Christoph Oelckers 479b216c06 - fixed: ZScript did not properly fill in tentatively created classes from defaults processing.
The proper setup for such classes was only done in CreateDerivedClass, but not in FindClassTentative itself. This extends CreateDerivedClass to allow it to create a class without fully initializing it.
2016-11-12 13:09:19 +01:00
Edoardo Prezioso 104030697f - Rename con_numnotify to con_notifylines.
Zandronum 1.1 added an option with the same purpose. Use it to avoid duplicates.
2016-11-12 11:08:33 +01:00
Edoardo Prezioso f123da9385 - Fixed GCC warnings with new history code. 2016-11-12 11:07:39 +01:00
Christoph Oelckers e009cbec9e - fixed: PClass::StaticShutdown did not remove the class pointers for VM base classes from their class registration entries. 2016-11-12 10:17:57 +01:00
Christoph Oelckers 30a2171080 - let "" be synonymous with 'none' in ZScript. 2016-11-12 10:06:26 +01:00
Christoph Oelckers 62a259bb36 Merge branch 'master' of https://github.com/rheit/zdoom into zscript 2016-11-12 09:46:09 +01:00
Christoph Oelckers 34fc6323a4 - scriptified Hexen's bats.
- removed AMinotaurFriend::IsOkayToAttack. The condition it checks (i.e. friendliness with player) is already covered by the base version of this function so this is quite redundant.
- removed a few 'virtual' qualifiers from functions that never get overridden.
2016-11-12 09:33:43 +01:00