Commit graph

8033 commits

Author SHA1 Message Date
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
Marisa Heit
c69394fa40 Add con_numnotify cvar to control number of lines of notification text
- If con_numnotify < 0, then there is no limit on the number of lines of
  text.
- If con_numnotify == 0, then any text that would normally be shown in the
  notification area is discarded.
- If con_numnotify > 0, then that is the maximum number of lines of
  notification text to display.
2016-11-12 00:34:07 -06:00
Marisa Heit
1e497e0b3e Fixed: FString::StripLeftRight() lost the right character when copying to a new buffer
- Also, some minor improvements to the strip functions to avoid doing
  extra work.
2016-11-12 00:34:07 -06:00
Marisa Heit
513ad7f75f Use FString to store console atexit commands 2016-11-12 00:34:07 -06:00
Marisa Heit
c5eb28d360 Fix console scrolling too far when page scrolling with scaled text 2016-11-12 00:34:07 -06:00
Marisa Heit
4dce07762b Change con_scale behavior for value 0
- Do not use uiscale for con_scale default. A 40 column console when
  everything is defaults is maddening. The default is now CleanXfac minus 1.
2016-11-12 00:34:07 -06:00
Marisa Heit
3926ca13b0 Fix console input not scrolling when you hit the side of the screen
- Also changed the console input buffer into a struct instead of a
  frankenstein buffer.
2016-11-12 00:34:07 -06:00
Christoph Oelckers
5bc89e7efc - added a VM handler for PostBeginPlay.
- made a few changes to let the templates compile again on Linux.
2016-11-12 00:57:21 +01:00
Christoph Oelckers
696af7d7e5 - Moved all virtual function related template code to its own file because it depends on includes that cannot be done in dobject.h. 2016-11-12 00:33:40 +01:00
Christoph Oelckers
14a9c13113 - scriptified Heretic's wizard. 2016-11-11 23:32:13 +01:00
Christoph Oelckers
a5f9eb5be1 - Scriptified Heretic's knight. 2016-11-11 22:14:29 +01:00
Christoph Oelckers
924096694e - implemented super calls and proper dispatch of scripted virtual overrides for Destroy. 2016-11-11 21:52:08 +01:00
Christoph Oelckers
72e77a6c65 - implemented handling for virtual function.
Syntax-wise I chose to make it as strict as possible to reduce the chance of errors: Virtual base functions must be declared with the 'virtual' keyword, and overrides in child classes with the 'override' keyword. This way any mismatch in parameters that otherwise would cause silent failure will outright produce a compile error.
2016-11-11 20:05:07 +01:00
Leonard2
a1aceaf04f Fixed the remaining errors with GCC 2016-11-11 16:01:09 +01:00
Edoardo Prezioso
8d01ba7733 - Fixed Clang errors with delayed templates on. 2016-11-11 15:22:53 +01:00
Christoph Oelckers
5e8c8b80c9 - removed bogus token paste operator. 2016-11-11 14:51:36 +01:00
Christoph Oelckers
6529931281 fixed and completed the special field init code. Strings can now be used as class members, and so can structs which contain strings.
- made 'DamageMultiply' an actor property and moved the initialization of ConversationRoot to the property handler for the compiler to get this stuff out of the type classes.
- consolidate default initialization into one function which performs all the required setup. The original implementation did this when adding the fields but that cannot work because at that time no defaults have been created yet.
- fixed: When deriving a class the child class's defaults also must initialize the copied parent fields with special initialization. This part was completely missing.
- removed DECORATE code for parsing native classes because it's no longer needed.
2016-11-11 14:40:32 +01:00
nashmuhandes
fd31c84745 Added a slider to control the intensity of underwater screen blending. 2016-11-11 17:18:39 +08:00
Christoph Oelckers
15ddf70f58 - typo 2016-11-11 09:27:52 +01:00
Christoph Oelckers
a60bdc2bfb use a memory arena for allocating code generation nodes.
- Since the number of small allocations here is extremely high this will help a lot to prevent fragmentation and since most nodes are collected up front and this is done when no large resources are being loaded it won't cause heap spikes.

let Emit methods delete FxExpression arrays when they are done.
- For some reason the deletion process does not work 100%, there are always some nodes left behind and so far I haven't found them. This ensures that these arrays do not live any longer than needed.
2016-11-10 15:13:31 +01:00