Commit graph

7402 commits

Author SHA1 Message Date
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
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
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
Christoph Oelckers
e0bd6a2c0a - fixed a memory leak in the compiler.
- removed test Printfs.
2016-11-10 13:37:38 +01:00
Christoph Oelckers
5151547df0 - fixed: String comparisons with constants did not work. 2016-11-09 20:28:46 +01:00
Leonard2
fb2a843c03 Test on a few methods/classes 2016-11-09 17:45:56 +01:00
Leonard2
26dc0c6df2 TODO: Find a better place to insert the classes in the hierarchy 2016-11-09 17:45:55 +01:00
Leonard2
7dbc4710f1 Add the new argument to all uses of the implement macro 2016-11-09 17:45:55 +01:00
Leonard2
33e2c74642 Provide a way to expose a native class to zscript for virtual functions overriding 2016-11-09 17:45:54 +01:00
Leonard2
ad19e439a6 Implement a general and easy-to-use way of overriding native virtual functions 2016-11-09 17:45:53 +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
701ffb868b - fixed: The first argument of string-based ACS specials was missing a string to name cast. 2016-11-08 22:36:44 +01:00
Christoph Oelckers
7b7b66d8b7 - added a new variable flag that allows defining variables which can only be modified by internal script code but not by external mods. Currently this is used by the NoBlockmap and NoSector flags which need special handling for changing. 2016-11-08 11:12:56 +01:00
Christoph Oelckers
3661e479d9 - fixed: Runtime conversion of names to classes used the wrong argument to check the class type. 2016-11-07 23:29:54 +01:00
Christoph Oelckers
aac931192b - fixed: Declaring a damage function must set regular damage to -1 to disable it. 2016-11-07 23:22:00 +01:00
Christoph Oelckers
cf9cdeb480 - scriptified the Revenant's code. 2016-11-07 23:16:25 +01:00
Christoph Oelckers
387287008c - fixed: Clamp was initialized with incorrect values. 2016-11-07 14:57:59 +01:00
Christoph Oelckers
5e8c819a33 - fixed checks in Powerup.Type property to properly deal with the differences between DECORATE and ZScript.
- properly initialize Baggage everywhere it gets used.
- fixed a few items with incorrect Powerup.Type settings that got flagged by the above changes.
2016-11-07 11:53:49 +01:00
Christoph Oelckers
208fe28042 - properly clear all script compiler data for a restart. 2016-11-07 11:30:41 +01:00
Christoph Oelckers
dc055b74c1 - fixed the octal parser in strbin. Like its hex counterpart it needs to backtrack one character if it find the end of a sequence.
- since ZScript already receives filtered strings, the 'T' converter for the properties should not do it again.
2016-11-07 09:54:46 +01:00
Christoph Oelckers
b206d19df4 - fixed: RegAvailability never set the number of allocated registers to more than 32.
- fixed register allocation in ?: operator which was quite broken.
2016-11-07 01:10:56 +01:00
Christoph Oelckers
7da4e0d03d - removed a parsing hack for the old internal definitions.
- fixed: The state cast hack for DECORATE could not properly create state constants.

Instead they were passed to FxRuntimeStateIndex without resolving them to something constant. This adds proper handling of constant indices within that class.
2016-11-06 23:10:23 +01:00
Braden Obrzut
640bf2a6d4 - Fixed: SBarInfo didn't support animated images in some places. 2016-11-06 17:07:44 -05:00
Christoph Oelckers
779f9d7a72 Merge branch 'master' of https://github.com/rheit/zdoom into zscript 2016-11-06 15:13:44 +01:00
Major Cooke
2583da9680 Do not allow DMG_FORCED to bypass ultimate degreeslessness/buddha for players. 2016-11-06 07:44:30 -06:00
Christoph Oelckers
10ef430bae Revert "Do not allow DMG_FORCED to penetrate player ultimate degreelessness/buddha."
This reverts commit 0130bde077.

This wasn't supposed to get merged, so get rid of it again. The change in semantics here is not acceptable.
2016-11-06 14:18:13 +01:00
Christoph Oelckers
647fd53a15 - fixed: An 'if' statement with only one branch may never considered to be always returning. 2016-11-06 14:14:54 +01:00
Christoph Oelckers
6414fd301b - let's add a 'float' cast, too, just in case. It still will cast to double, because single precision floats only can exist as memory values. 2016-11-06 13:21:47 +01:00
Christoph Oelckers
398433b5e6 - fixed: Explicit casts to bool were missing. 2016-11-06 13:20:22 +01:00
Christoph Oelckers
2ac0046cda - fixed and cleaned up state index jump handling
* use the function build list instead of the function to pass the info. The function is permanent so not the best place for compile-time info.
 * pass along the current state index which is needed to calculate the target state.
2016-11-06 13:14:46 +01:00
Christoph Oelckers
c354000f1c - block "" and 0 as valid state names in ZScript. There were common workarounds for the lack of a null pointer in DECORATE which no longer are supported as those and would produce errors now. 2016-11-06 12:00:16 +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
dbde0971ef - removed the second 'calculated' return value from the damage function call in GetMissileDamage as it is no longer needed or even code being generated for. 2016-11-06 10:28:01 +01:00
Christoph Oelckers
c3ae560289 - scriptified two more trivial functions. 2016-11-06 09:22:03 +01:00
Marisa Heit
55ee78fc0b Add bottomclip parameter to FillSimplePoly() for the software implementation
- Polygons will be clipped to bottomclip. If this is zero or below, they
  will be clipped to the bottom of the screen instead. This keeps the
  polygons from overwriting the status bar border for sofware 2D. The
  hardware version ignores it, since it always draws the status bar border
  every frame.
2016-11-05 22:49:33 -05:00
Marisa Heit
dbc54fbca0 Fix FillSimplePoly() for 1-pixel tall or wide textures 2016-11-05 22:30:16 -05:00
Marisa Heit
ae28c9b29c Fix divide by 0 in new wallscan functions with 1-pixel tall textures 2016-11-05 22:09:38 -05:00
Major Cooke
0130bde077 Do not allow DMG_FORCED to penetrate player ultimate degreelessness/buddha. 2016-11-05 20:15:41 -05:00
Christoph Oelckers
c9a96ed0ae - fixed: CALL_ACTION always set 3 args, even for normal methods. Also moved this to a sunfunction because the macro created a lot of code. 2016-11-06 01:34:54 +01:00
Christoph Oelckers
b59f4e950f - fixed: The return prototyxpe may only be retrieved after the return state of the function has been checked. Also made this a real error message instead of an assert because it will inevitably result in a crash if the prototype cannot be generated, making diagnostics impossible. 2016-11-05 21:02:26 +01:00
Christoph Oelckers
0f9ebff3ee - fixed: The return checking code must be inside the nullptr check for item.code. 2016-11-05 18:56:04 +01:00
Christoph Oelckers
0851d698de - don't run constant state indices through the runtime checker. 2016-11-05 18:15:53 +01:00
Christoph Oelckers
1b77a8f491 - fixed: Tacking on a return statement should only be done if the function has branches that actually reach the end. Otherwise it may interfere with return type deduction.
- used the return check to optimize out unneeded jumps at the end of an if statement's first block.
2016-11-05 18:05:57 +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
24925c88a8 - added readonly pointers. They need to be defined with 'readonly<classtype>'. These are significantly different from declaring a field readonly in that they do not disallow modification of the variable itself but what it points to. For the actor defaults this is necessary to prevent accidental modification. A readonly pointer is actually a different type than a regular pointer.
- fixed code generation for dynamic cast. It was missing the jump instruction after the compare.
2016-11-05 13:51:46 +01:00
Christoph Oelckers
ca878b5e6b Merge branch 'master' of https://github.com/rheit/zdoom into zscript 2016-11-05 10:40:02 +01:00
Christoph Oelckers
9ab779fd61 Merge commit '60ae4a8568d9fc929c803036fa16fa0f9bfb68a2' 2016-11-05 10:39:13 +01:00
Christoph Oelckers
b890f2b608 - fixed retrieval of constant for state index. 2016-11-05 10:38:23 +01:00
Christoph Oelckers
272dff6b8f Merge branch 'master' into zscript 2016-11-05 10:35:00 +01:00
Christoph Oelckers
76c34d7b2f - block access to private and protected data for the external variabler getter functions.
- fixed: The state index comparison against 0 was broken.
- fixed: Resolving codegen nodes must set the strictness flag per function so that ZSCRIPT and DECORATE are done properly.
2016-11-05 09:50:53 +01:00
Braden Obrzut
dd1f72bbf9 - Check the version of FMOD in CMake to produce an error on the condition that OpenAL is also enabled and the FMOD version is low enough to also export Xiph symbols. 2016-11-04 23:27:04 -04:00
Magnus Norddahl
60ae4a8568 Replace build wallscan with a rewritten version that tile and scale correctly 2016-11-05 04:02:30 +01:00
Christoph Oelckers
514bcfb128 Print a clearer error message if a function name is encountered without parentheses. 2016-11-05 01:24:52 +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
b6633bc489 - fixed: The states parser tried to simplify the head node for random duration but it has to simplify the two value nodes separately.
- added jump by index to ZScript.
2016-11-05 00:39:00 +01:00
Christoph Oelckers
8ae7aae14a - do not delete duplicate PFields - they are better be destroyed and left to the GC.
- removed two duplicate entries to the flag table.
2016-11-04 15:21:45 +01:00
Christoph Oelckers
407345668a - fixed: ZCCCompiler tried to process replacements too early, it can only be done after all classes have been created. 2016-11-04 15:16:56 +01:00
Christoph Oelckers
faea61cf01 - fixed: Turbo messages were printed, even when no turbo mode was active. 2016-11-04 12:43:23 +01:00
Christoph Oelckers
540f20882e - fixed: Degeneration should use the same base health value as all the rest of the engine.
- also replaced deh.MaxHealth in the bot code which was the only other remaining case where this was used as health limiter.
2016-11-04 11:32:57 +01:00
Christoph Oelckers
7755a3525a - do not allow menu slider values very close to zero. They not only can produce a glitched number display but also some weird inconsistencies when operating a slider. 2016-11-04 11:17:22 +01:00
Christoph Oelckers
07c24c7e27 - use different names for different AST dumps. 2016-11-04 10:35:14 +01:00
Magnus Norddahl
4b4d7a0768 Add texturefrac bounds clamping to R_DrawMaskedColumn to avoid buffer overruns 2016-11-04 10:16:44 +01:00
Magnus Norddahl
b04118032e Fix wrapping and scaling issue for the U texture coordinate for sprites 2016-11-04 10:15:57 +01:00
Christoph Oelckers
7068070c0d - fixed: The identifier fallback which existed for all other basic types was missing for 'state'.
- added the option to put code right into the ZSCRIPT lump for smaller definitions where a file list would be too cumbersome.
2016-11-04 09:56:03 +01:00
Christoph Oelckers
157cfe3ab3 - fixed: The RNG was not initialized for script calls that did not explicitly specify an RNG by name. 2016-11-04 09:23:29 +01:00
Christoph Oelckers
d433fb76c9 - completed the list of AActor exported member variables, with the exception of a few things that cannot be done yet.
Note that AActor::Inventory needed to be renamed because defining this symbol within AActor would hide the global type of the same name!
2016-11-04 08:57:10 +01:00
Christoph Oelckers
9563045305 - moved declaration of native fields into the respective class definitions.
This bypasses a declaration in the script in favor of a simpler implementation. In order to work it is always necessary to have an offset table to map the variables to, but doing it fully on the native side only requires adding the type to the declaration.
2016-11-04 00:19:36 +01:00
Christoph Oelckers
c9dad70408 - removed the GetConstantInt overloads since it appears they are not needed. 2016-11-03 16:46:55 +01:00
Christoph Oelckers
9188dc07a7 - removed excess parameter from A_FadeIn. 2016-11-03 14:38:18 +01:00
Christoph Oelckers
995f01f8aa - removed obsolete code from a_bossbrain.cpp.
- fixed: divisions wasted one register for each operation due to a double allocation.
- changed math operations to use less registers. There was a well-intended change to allocate the destination first, but the better approach is to first allocate the operands and free then before allocating the destination register.
2016-11-03 14:23:29 +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
6aecb29995 - fixed: The VM function builder was set up with the wrong number of implicit arguments. 2016-11-02 16:05:57 +01:00
Christoph Oelckers
ff66dc3189 - flatten FxBinaryLogical chains into a single node for more efficient processing. 2016-11-02 15:46:15 +01:00
Christoph Oelckers
eca4fba0f6 - fixed a merge conflict which wasn't flagged by TortoiseMerge. 2016-11-02 14:15:09 +01:00
Christoph Oelckers
3a7f51db88 a_hereticimp.cpp does not exist anymore... 2016-11-02 13:39:37 +01:00
Christoph Oelckers
c44dc8d951 Merge branch 'master' of https://github.com/rheit/zdoom into zscript 2016-11-02 11:46:18 +01:00
Christoph Oelckers
570572fcf2 - scriptified a_hereticimp.cpp.
- fixed the comparison against 0 simplification which did not negate the result for '=='.
2016-11-02 11:44:48 +01:00
Christoph Oelckers
8b21719068 Merge branch 'zscript' of https://github.com/rheit/zdoom into zscript 2016-11-02 11:43:23 +01:00
Christoph Oelckers
703aaa373e SHA-1: 8852bc7278d033bbed66c51bf23aee841ee977a9
* Revert "Modify CMPJMP to produce more compact code (as far as VC++ is concerned, anyway)"

This reverts commit 6ff973a06b.

This modification did not work and broke the comparisons. Actually this had three problems:

* the asserts checked the wrong instruction
* the mask was not applied to regular comparisons.
* incrementing PC before testing does not work because 'test' references the PC.
2016-11-02 11:40:43 +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
ff8b216167 SHA-1: 8852bc7278d033bbed66c51bf23aee841ee977a9
* Revert "Modify CMPJMP to produce more compact code (as far as VC++ is concerned, anyway)"

This reverts commit 6ff973a06b.

This modification did not work and broke the comparisons. Actually this had three problems:

* the asserts checked the wrong instruction
* the mask was not applied to regular comparisons.
* incrementing PC before testing does not work because 'test' references the PC.
2016-11-02 10:52:14 +01:00
Marisa Heit
f8641c0ffb Fixed: MaxVisForFloor was broken by the switch to floats
- TODO: See if these visibility limits are even needed anymore.
2016-11-02 00:07:57 -05:00
Marisa Heit
3f32ccada6 Zero In2D before calling Flip()
- Fixes an assert when resizing the window in windowed mode. Flip() can call
  V_OutputResized() in windowed mode.
2016-11-01 22:54:27 -05:00
Christoph Oelckers
88fd47247d - scriptified several trivial functions from a_action.cpp. 2016-11-01 16:32:47 +01:00
nashmuhandes
b420347bab Added "local" parameters to A_PlaySound and ACS PlaySound 2016-11-01 15:14:06 +01:00
Rachael Alexanderson
6755373f46 - fixed: map commands will now take capslock DM/COOP as arguments 2016-11-01 15:09:09 +01:00
Rachael Alexanderson
f72ebe6768 - Extended map, recordmap, and open commands to accept "dm/coop" as an extra parameter - to open maps in multiplayer mode with the requested ruleset. 2016-11-01 15:09:08 +01:00
Christoph Oelckers
3f57269a8b - fixed: ACSStringPool::AddString did not check for NULL pointers as input. Let's just map them to the empty string, that's a lot better than crashing. 2016-11-01 13:36:33 +01:00
Christoph Oelckers
4cf0d76e8c - fixed: RapidJSON in ASCII mode cannot handle extended 8 bit character sets and will produce broken data if the input contains some. This means we need to perform the conversion to UTF-8 on ZDoom's side and run RapidJSON in UTF-8 mode.
Daedalus triggers this with a 0x85 character which in Windows CP 1252 is the ellipsis (...) The converter will assume ISO-8859-1, though, but cannot do anything with these characters because they map to the font being used here.
2016-11-01 13:33:18 +01:00
Edoardo Prezioso
7137e87b4b - Fixed GCC/Clang errors from recent commits. 2016-11-01 10:35:45 +01:00
Edoardo Prezioso
46a311b23c - Fixed a typo in 1 pixel tall support addition.
Found by Clang -Wparentheses warning.
2016-11-01 09:59:59 +01:00
Marisa Heit
5df21fda68 Fixed: Masked midtexture yscale incorrectly used the texture's X scale 2016-11-01 00:18:56 -05:00
Marisa Heit
9388597443 Add 1 pixel tall and wide texture support to the renderer
- These require manual detection and overriding of the scaling factors to
  0, because a right shift of (32-0) bits wraps around to 0 and results in
  no shift at all rather than leaving the register zeroed out.
2016-11-01 00:08:16 -05:00
Marisa Heit
8d7e400f8e Fixed: DCanvas::FillSimplePoly must set dc_destorg
- dc_destorg is normally set to the upper-left corner of the view window.
  If there is a border, then this won't coincide with the upper-left
  corner of the screen, and DCanvas::FillSimplePoly would merrily write off
  the end of the screen buffer.
2016-10-31 22:34:46 -05: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
8e12e7462c Merge branch 'master' into zscript 2016-10-31 17:03:33 +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
Braden Obrzut
43b2584f79 - Fixed: Reference to freed stack object in R_FindPlane. This caused a massive slowdown (90% drop in total performance) in R_FindPlane when built with optimizations on in GCC6. Although I don't really understand why since the comparison should have been O(1) regardless of memory contents and even if the check failed every plane it would still be pretty fast, this is what they mean when they say that anything can happen when undefined behavior is triggered. 2016-10-30 23:27:29 -04:00
Marisa Heit
6ff973a06b Modify CMPJMP to produce more compact code (as far as VC++ is concerned, anyway) 2016-10-30 22:16:02 -05:00
FishyClockwork
7c1f7aa81c Restricted custom goodbyes to ZSDF 2016-10-30 20:27:07 +01:00
Kyle Evans
1502eae2ac Add XPM (X PixMap) version of ZDoom icon 2016-10-30 19:31:32 +01:00
FishyClockwork
42be7bee93 For USDF treat Require/Exclude as unknown
For USDF treat Require/Exclude as an unknown keyword.
2016-10-30 19:30:55 +01:00
FishyClockwork
c341bc0d3c Added restriction of Require/Exclude to ZSDF
Added restriction of Require/Exclude to ZSDF (namespace = "ZDoom";).
A warning will be printed if a Require/Exclude block is detected in USDF (namespace = "Strife";).
2016-10-30 19:30:54 +01:00
FishyClockwork
b1880964fa Added two new sub-blocks for Choice blocks
Added two new sub-blocks for Choice blocks: Require and Exclude.
The syntax for both is the same as Cost blocks.

Require defines what item must be present in your inventory in order to show this choice/reply.
Exclude defines what item must not be present in your inventory in order to show this choice/reply.

If any Require/Exclude blocks are defined then this choice/reply will be hidden until all blocks of both types are satisfied.
2016-10-30 19:30:53 +01:00
Christoph Oelckers
2857fac338 - scriptified a_archvile.cpp.
- fixed the type checks for the conditional operator.
2016-10-30 18:41:39 +01:00
Christoph Oelckers
a652c5f259 - fixed: For named functions the prototype needs to be set before the code generator starts resolving. Otherwise it will crash on incompletely set up forward declarations. 2016-10-30 16:21:44 +01:00
Christoph Oelckers
f8ccda2dc8 - scriptified A_Mushroom to test something a bit more complex.
- fixed: FxMinusSign trashed local variables that were used with negation.
- fixed: FxConditional only handled ints and floats, but not pointers and strings.
- fixed: A 'no states in non-actors' error was triggered, even for classes without any states.
2016-10-30 14:00:11 +01:00
Christoph Oelckers
9eeb56212b - fixed: A VM function's NumArgs value needs to count stack arguments, not logical ones, meaning that for vectors each element needs to count separately.
- renamed VMFunction::Defaults to DefaultArgs to make searching easier.
- let ZCCCompiler process vector defaults for function parameters.
2016-10-30 09:05:42 +01:00
Leonard2
06ec6318a9 Fixed: A vector value could point to garbage data after being 'unnested' 2016-10-30 07:37:13 +01:00
Leonard2
5643d6c692 Make sure to use the REGT_MULTIREG flags for opcodes that need it 2016-10-30 07:37:12 +01:00
Leonard2
8be7af41a9 Don't use a struct reference for vectors as return type just like for parameters 2016-10-30 07:36:00 +01:00
Leonard2
94410accf4 Renamed "VectorInitializer" to "VectorValue"
This was really confusing for me as this is an actual vector "value" rather than an "initializer"
2016-10-30 07:34:14 +01:00
Christoph Oelckers
ac1c022911 - implemented the 'is' operator (i.e. class type check.) 2016-10-30 01:05:56 +02:00
Christoph Oelckers
78a18acf46 - added string handling to comparison operators. 2016-10-29 18:57:56 +02:00
Christoph Oelckers
853c6f6684 - fixed initialization of local variables with other local variables.
- fixed several occurenced where vectors were treated as floats. NOTE: The entire codegen.cpp file needs to be carefully reviewed for bad use of the REGT_ constants, there's probably more places where using them has broken some type checks.
- fixed: committed test version of zscript.txt instead of changed actor.txt by accident.

Initialization and assignment for strings is working with this commit.
2016-10-29 16:49:21 +02:00
Christoph Oelckers
4dc97a6ed0 - fixed register allocation for vector arguments to script functions.
- handle 2D and 3D vectors in SetReturn.
2016-10-29 13:42:37 +02:00
Christoph Oelckers
7209f9edd6 - implemented passing vectors as parameters. So far working for native functions.
- removed the bogus optional value from the first A_Jump argument. A quick test with an older ZDoom revealed that this was never working - and implementing it would make things a lot more complicated, especially error checking in the code generator.
- fixed: The check for insufficient parameters to a function call was missing.
2016-10-29 13:10:27 +02:00
Christoph Oelckers
e94b4cc74e Merge branch 'master' into zscript 2016-10-29 11:20:32 +02:00
Christoph Oelckers
f5d1b1a491 - added vector builtins Length() and Unit().
This should complete the vector type except for use as function parameter.
2016-10-29 10:43:22 +02:00
Christoph Oelckers
b5222f08e8 - implemented dot and cross products (not that I'd ever expect these to become useful in a game like Doom...) 2016-10-29 10:16:00 +02:00
Magnus Norddahl
87ea75169e Fix texturefrac out of bounds bug 2016-10-29 08:11:12 +02:00
Magnus Norddahl
837ed7bd80 Fix dancing sprites due to texture coordinate calculations not taking pixel centers into account
Merge R_DrawMaskedColumn and R_DrawMaskedColumnHoriz into one function to remove code duplication
2016-10-29 05:35:41 +02:00
Leonard2
594a0c2008 Fixed: FxVMFunctionCall didn't check for varargs while checking argument count 2016-10-29 02:18:15 +02:00
Christoph Oelckers
e5878f0cb2 - implemented vector operations. Vectors are now fully working as local variables.
- removed mulv_kr and divv_kr instructions. The first are redundant and the second are useless. Maybe remove all other vector/const operations as well? They won't get used by the code generator.
- fixed disassembly of vector multiplication and division instructions.
2016-10-29 01:39:25 +02:00
Christoph Oelckers
9400f97189 - implemented local vector variables. Currently only the definition plus initial assignment works.
- removed all vector4 handling that had already been added, now that this type can no longer be defined.
2016-10-28 15:15:30 +02:00
Christoph Oelckers
f2f365bfef - fixed setup for PString which was missing the load/store/move instructions which caused me to overlook its register type.
- properly set up the vector types.
- fixed: a struct must start with a size of 0, not 1. This caused the layout of the vectors to be broken.
2016-10-28 14:43:29 +02:00
Christoph Oelckers
ed5a94d187 - fixed GetOps() call and added info for vectors. 2016-10-28 13:30:19 +02:00
Christoph Oelckers
f511a9398e - changed GetStore/LoadMoveOp and GetRegType to be based on a set of member variables instead of using virtual functions to return such trivial values. This not only creates significantly better code but also allows overriding these settings without having to create a new class just for changing them (as is needed for vectors.) 2016-10-28 10:44:01 +02:00
Christoph Oelckers
3b1f411dce - added a full set of 2D vector instructions to the VM. The existing one was 3D only but there's also need to handle two-dimensional vectors.
- added the missing divv* instructions.
2016-10-28 10:13:07 +02:00
Christoph Oelckers
35cd48b86b - fixed grammar rule for two-dimensional vectors. 2016-10-28 09:47:22 +02:00
Christoph Oelckers
3fa315aaea - replaced 'vector<2>' and 'vector<3>' with 'vector2' and 'vector3'.
- added initializer syntax for vectors. A vector can be set with vectorvar = (x,y,z); for a 3-dimensional vector and vectorvar = (x, y); for a 2-dimensional one.
2016-10-28 01:14:21 +02: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
03efb63e93 - fixed bad register use in postincrement operator. 2016-10-27 19:14:16 +02:00
Christoph Oelckers
c7347608a4 - scriptified A_FatAttack*.
- swapped parameters of two-parameter VelToAngle method, so that internal and script version are in line.
- fixed parameter asserts to handle NULL pointers properly.
2016-10-27 17:47:46 +02:00
Christoph Oelckers
948ef62fcd - use the function defaults from the script instead of explicitly setting them again in the code. This is a needless cause of potential errors and since the values are readily available now it's better to use them in the functions.
- fixed: ZCCCompiler did not process array access nodes.
- fixed: Function argument names were not placed in the destination list by the compiler.
- scriptified several trivial functions from p_actionfunctions.cpp.
2016-10-27 15:53:53 +02:00
Jason A. Yundt
4c420938c9 - Added install rules so that 'make install' works. 2016-10-26 20:57:42 -04:00
Christoph Oelckers
66b1f36e56 - actually evaluate the default parameters and store them in the VMFunction.
- disabled the assert in PType::GetRegType. This assert blocks any use to check for types that are incompatible with function parameters.
- pass the default parameter constants to the native functions. At the moment this is not used yet.
- use the function defaults to complete argument lists to script functions.
- fixed all default values that got flagged by the expression evaluator as non-constant. Most were state labels and colors which were defaulted to "". The proper value is null for states and 0 for colors.
- also replaced all "" defaults for names with "none".
2016-10-27 01:30:34 +02:00
Christoph Oelckers
d32d52c0b9 - scriptified a_spidermaster.cpp.
- fixed bad assert in XOR_RK instruction.
2016-10-26 17:21:25 +02:00
Christoph Oelckers
c961e653a5 Merge branch 'master' into zscript 2016-10-26 15:55:56 +02:00
Christoph Oelckers
327d4d85a7 - fixed: UseOffsets can only be handled after the patch is has been set up. 2016-10-26 15:02:20 +02:00
Christoph Oelckers
a166183ab4 -fixed type handling for varargs (i.e. A_Jump.) 2016-10-26 14:15:11 +02:00
Christoph Oelckers
7c759f9fcf - removed the FxDamageValue hack and implemented it properly using FxReturnStatement.
- added handling of damage functions for ZScript.
2016-10-26 14:04:49 +02:00
Christoph Oelckers
e50315bd31 - fixed: Deprecation messages should never appear in DECORATE.
- removed some console message spam.
2016-10-26 13:22:36 +02:00
Christoph Oelckers
d4ea991763 Merge branch 'master' into zscript 2016-10-26 12:18:06 +02:00
Christoph Oelckers
12ce76426e Revert "Allows loading directories as IWADs using "-iwad" command line parameter."
This reverts commit 81449728d7.

Reverted because it compromises the IWAD file lookup and fixing it properly is not so trivial.
The skipping of adding the file name extension was not only broken, but even after fixing the code does not work if the IWADs are located outside the working directory.
2016-10-26 12:13:57 +02:00
Christoph Oelckers
5309209039 - print a developer warning if the texture manager had to resolve a circular reference. 2016-10-26 12:03:28 +02:00
Christoph Oelckers
28fefdabc7 - added a 'listall' option to FTextureManager::ListTextures, so that the multipatchtexture lookup can find multiple older versions with the same use type.
This fixes an issue with DUMP 2 which looked for patches of the same name as the texture currently being defined and where the patches had the same use type as the composite texture. The function as implemented would only find the newly added composite and print an error.
2016-10-26 11:56:15 +02:00
Christoph Oelckers
823c52aeb2 - scriptified the functions in a_possessed.cpp and added the needed exports and constants.
- fixed: Script functions did not receive the function name when being created.
- relaxed the asserts for PARAM_STATE, because the VM knows nothing about ATAG_STATE. Any state variable's content (e.g. Actor.SeeState) will receive ATAG_GENERIC, rather than ATAG_STATE.
- added a 'NeedResult' flag so that certain operations can create shorter code if the result of the expression is not needed. So far only used for postdecrement/increment statements on local variables (which is the most frequent case where this matters.)
- fixed postincrement and decrement for local variables. Due to the result preservation semantics it created faulty code.
2016-10-26 11:30:30 +02:00
alexey.lysiuk
316e3395ad Fixed crash on loading multipatch texture with height of 256
http://forum.zdoom.org/viewtopic.php?t=53953
2016-10-26 12:15:22 +03:00
Christoph Oelckers
fa8e05d56d - do not allow a multipatch texture to use itself as patch. Instead, look for an older texture with the same name. 2016-10-25 22:40:58 +02:00
Christoph Oelckers
33d00070b5 - made some variables signed that should not be unsigned. 2016-10-25 17:07:19 +02:00
Edoardo Prezioso
be4ce05aee - Fixed Clang compiler errors and some warnings. 2016-10-25 16:53:14 +02:00
Christoph Oelckers
6d0dad3b38 - scriptified the code for the Demon and DoomImp. 2016-10-25 14:41:58 +02:00
Christoph Oelckers
576fc0c237 - how did this happen. 2016-10-25 14:27:49 +02:00
Christoph Oelckers
142278a818 - fixed incomplete commit for bounce flags
- fixed flag clearing in new function.
2016-10-25 13:29:58 +02:00
Christoph Oelckers
656b8cb16e - added explicit setter functions for the count and link flags so that A_ChangeFlag and A_SetFlag can be deprecated. 2016-10-25 10:15:24 +02:00
Christoph Oelckers
ae728cc61a - made the count flags and NOBLOCKMAP and NOSECTOR read-only. These require special treatment to work which can only be done by a setter function. 2016-10-25 09:55:13 +02:00
Christoph Oelckers
34a07d4bd6 Merge branch 'master' of https://github.com/rheit/zdoom into zscript 2016-10-25 09:29:12 +02:00
MaxED
81449728d7 Allows loading directories as IWADs using "-iwad" command line parameter. 2016-10-25 09:25:57 +02:00
Rachael Alexanderson
623910bd2a - Putting the CVAR definition right in the middle of prediction stuff probably wasn't the best idea. 2016-10-25 09:25:57 +02:00
Rachael Alexanderson
043e761eec - Implemented sv_singleplayerrespawn 2016-10-25 09:25:56 +02:00
Christoph Oelckers
dad89b0783 - fixed: Portals with disconnected parts were not grouped correctly. 2016-10-25 01:03:44 +02:00
Christoph Oelckers
8368272b4d - just to be thorough, added a 'sprite' keyword to define a patch to give priority to the TEX_Sprite namespace. 2016-10-24 23:40:37 +02:00
Christoph Oelckers
4e4fd97950 - fixed: Multipatch textures may not set up their patch references until all textures have been loaded.
If done earlier they will not be able to detect overrides of sprites and graphics which are not part of the PATCHES lump. There was some fudging code to work around this problem but it was only partially working.
Now these textures only collect the texture name and use type during setup and resolve them after all textures have been created.
2016-10-24 23:35:18 +02:00
Christoph Oelckers
93ec6eb92e - fixed DACSThinker did not save its LastScript member.
This was probably responsible for some weird behavior recently, but with the addition of the OF_Transient flag this outright crashed because it left NULL pointers on reload in places where they weren't checked for.
2016-10-24 22:23:27 +02:00
Christoph Oelckers
f810b98167 - implement flag variables with the VM's sbit and lbit instructions.
- synthesize PField entries from the flag list for AActor. This intentionally excludes the bounce flags for now.
- allow deprecated flags that do not call the deprecated flag handler.
- disallow constructs like (a = b) = c by not allowing an address request on an assignment operation.
- restrict modify/assign on boolean variables to the bit operators. Everything else needs to promote the result to an integer to make sense so it should be disallowed.
2016-10-24 17:18:20 +02:00
Christoph Oelckers
808188ff18 - added handling for structs. When defined inside classes or other structs the double member access will be merged, so there is no performance hit by using structs to group data. 2016-10-24 13:18:13 +02:00
Christoph Oelckers
3f1673f34f - scriptified A_HeadAttack, A_CyberAttack and A_Hoof. 2016-10-24 00:50:28 +02:00
Christoph Oelckers
9f8a5dae21 - scriptified A_BruisAttack.
- removed 'self' as a dedicated token. Internally this gets handled as a normal but implicitly named variable so the token just gets in the way of proper processing.
- removed P_ prefix from SpawnMissile export.
- fixed a crash with misnamed function exports.
2016-10-23 17:15:24 +02:00
Christoph Oelckers
da56e5908d - added an optimization to FxBoolCast that it doesn't force the source value to a 0/1 integer if not explicitly needed. When doing comparisons we do not care about actual values, we only want to know if it is 0 or not.
- added the above for the 'if' condition. It works for integers, floats and pointers and will save 3 instructions if the condition is a non-boolean that can be implicitly casted to bool.
2016-10-23 15:30:58 +02:00
Christoph Oelckers
5b952b116a - named class functions are working. Yay!!
- converted A_BspiAttack and A_BabyMetal to script functions to test the implementation.
2016-10-23 14:26:33 +02:00
Christoph Oelckers
a2116fc7bf - created an export for P_SpawnMissile so that I can do some tests with functions.
- allow class extensions.

These are separate blocks in different files that get concatenated to one class body for processing. The reason is to allow spreading the many functions in Actor over multiple files, so that they remain manageable. For example, all the Doom action functions should be in their respective files, but their symbols need to be in Actor. To extend a class, both files need to be in the same translation unit, so it won't allow user-side extension of internal classes.
2016-10-23 12:57:21 +02:00
Christoph Oelckers
f9cd2c9af7 - added switch/case processing. Right now it is just a sequence of test/jmp instructions. It may make sense to add a special opcode that can perform the comparisons natively but that's an option for later.
- added a TESTN instruction. This is like TEST but negates the operand. This was added to avoid flooding the constant table with too many case labels. With TEST and TESTN combined, all numbers between -65535 and 65535 can be kept entirely inside the instruction. Numbers outside this range still use a BEQ instruction.
2016-10-23 12:00:25 +02:00
Christoph Oelckers
6587828e32 Merge branch 'master' of https://github.com/rheit/zdoom into zscript 2016-10-23 08:34:46 +02:00
Marisa Heit
5ba5da0dcc Fixed: Loading a savegame momentarily left players with undefined pitch limits
- This was only visible when using a screen wipe because the initial frame wiped
  to would clamp the pitch to whatever undefined pitch range the player
  had before the proper range was received.
2016-10-22 21:02:10 -05:00
Marisa Heit
31f01d076e Fixed: Decals calculated "lighting" wrong
- Instead of calculating lighting based from the left edge of the wall
  segment the decal was on, it was calculated from the left edge of the
  wall instead.
2016-10-22 20:27:02 -05:00
Christoph Oelckers
ccabb6f9bd - Gave FxExpression a type identifier field so that certain combinations that are easy to optimize can be detected. 2016-10-23 01:14:49 +02:00
Christoph Oelckers
32d33618ea - better fix for the class type problem: We already know the wanted type so let's use that instead of trying to determine it from the actual name. 2016-10-22 19:51:24 +02:00
Christoph Oelckers
c2b37aeeea - fixed a conversion warning with the pointer-type AActor fields.
- added master and tracer to the list of exported variables.
- fixed: 'none' as class type must map to the real null pointer so that it won't get rejected by the stricter type checks.
- added handling for member function calls to zcc_compile.cpp.
- fixed: FxMemberFunctionCall may not delete the self expression if it gets passed on to the actual function call.
2016-10-22 19:43:53 +02:00
Christoph Oelckers
37914223f0 - reviewed all places where VARF_Action and NAP were used and fixed what was still wrong. 2016-10-22 18:24:47 +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
32ac1a8ad7 - moved the special weapon functions from Inventory to StateProvider.
This will restrict them to the only classes that may use them: Weapon and CustomInventory.
Note: Should a mod surface which uses them improperly the better solution would be a warning message and NULLing the bogus code pointer instead of leaving them in Inventory.
2016-10-22 16:46:47 +02:00
Christoph Oelckers
d714670acc - allow calling non-action functions directly from a state.
Ironically this only requires a very minor change in the calling code and an added member for the VMFunction to tell that code how many parameters to pass.
This change will allow to turn the vast majority of action functions into regular members, the only ones that still need to be an action function are the few that actually use the pointers.
2016-10-22 16:35:48 +02:00
Christoph Oelckers
d6047ae651 - added the required code genration nodes for member function calls.
This is not testable right now because finally the action function mess has come full circle. The current setup makes it impossible to call action functions from non-action functions because the needed info is local to the functions.
Long avoided, this needs to be refactored now so that the different semantics for action functions are no longer needed.
2016-10-22 12:10:19 +02:00
Christoph Oelckers
38fa26af75 Merge branch 'master' of https://github.com/rheit/zdoom into zscript 2016-10-22 10:15:52 +02:00
Christoph Oelckers
853e49a077 - fixed: R_InitSkyMap must check for the null texture which cannot be used as a sky because it has no bitmap and will cause an access violation in the sky cap color calculation. 2016-10-22 09:58:56 +02:00
Christoph Oelckers
43aec68559 - implemented ~== operator.
Turned out this was really simple because the functionality was already there.
2016-10-22 09:31:37 +02:00
Marisa Heit
09b82b8a3a Merge branch 'master' into zscript 2016-10-21 22:13:24 -05:00
Marisa Heit
5c596d3797 Change VM to increment PC after each instruction rather than before
- VC++ generated horribly stupid code for x64 when incrementing pc at the
  beginning of each instruction by storing hundreds of copies of it for
  every opcode executed. Incrementing pc at the end avoids this madness.
- It is possible I messed something up with this change. Hopefully not.
2016-10-21 22:11:23 -05:00
Christoph Oelckers
1e11042de0 - changed VM_EPSILON from 1/1024 to 1/65536 so that the ~== operator can actually be used.
1/1024 is far too coarse for ZDoom's purposes, this needs to be at least fixed point precision.
2016-10-22 02:52:28 +02:00
Christoph Oelckers
4b41e735f1 - added null pointer.
- fixed: FxMemberIdentifier checked for ClassPointers instead of object pointers to resolve the left hand side of the expression.
- allow comparison of pointers.
2016-10-22 00:50:04 +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
Christoph Oelckers
b1289fa783 - fixed: The serialiter functionfor FDoorAnimation accessed the invalid destination pointer when loading a savegame. 2016-10-21 19:24:40 +02:00
nashmuhandes
21b690a3c7 Fixed: Player.ViewBob should be multiplying the bobbing height in P_CalcHeight, not the velocity of the bobbing.
This mimics the act of the user altering their movebob CVar to compensate for non-standard player movement speeds.
2016-10-21 19:24:39 +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
89416835a8 - preparations for null pointer support.
- add pointer support to FxAssign.
2016-10-21 19:18:39 +02:00
Christoph Oelckers
5bed0a2b39 - implemented class member access for variables. (Struct members and functions not done yet.) 2016-10-21 17:41:39 +02:00
Christoph Oelckers
f5e4c4b109 - implemented the '<>=' operator - more as a VM coding exercise than for its usefulness, though. 2016-10-21 16:35:07 +02:00
Christoph Oelckers
9f260983c7 - implemented all assign/modify operators.
- use a table to translate from PEX to tokens to make the code easier to read.
2016-10-21 14:18:31 +02:00
raa-eruanna
8678baf6f5 - Fullbright fixes 2016-10-21 07:32:18 -04:00
raa-eruanna
df6214b142 - Fixes 2016-10-21 07:21:56 -04:00
raa-eruanna
c76431414a - Implemented r_fullbrightignoresectorcolor from QZDoom 2016-10-21 07:06:24 -04:00
Christoph Oelckers
3e995d7aac - changed assignment operators to be expressions, like they are in C and DECORATE.
This also means that for now Lua-style multi-assignments are disabled, those should be easy to enable by making some changes to the assignment_statement grammar so that it doesn't recognize single assignments, but for now this is low priority because it adds a significant amount of complexity to do this right with functions that have multiple return values.
2016-10-21 12:22:42 +02:00
Christoph Oelckers
1450c3dffb - tested and fixed the regular assignment statement for both local and member variables.
The generated object code can definitely use an optimization pass but that's something left for later when more things are working. Right now it creates one opcode more than necessary for all member accesses (instead of using the offset in the store command it calculates an actual address of the variable in another address register) and can create one too many for non-constant expressions being assigned to local variables (a move between two registers because the emitted expression on the right hand side does not know that it can emit to the actual variable's register.)
2016-10-21 10:09:01 +02:00
Christoph Oelckers
9f99ca4788 - process most of the remaining statement types.
- extend assignment operations to handle local variables (untested.)
- make the implicit function arguments read only.
2016-10-21 01:12:54 +02:00
Christoph Oelckers
24394dfc92 - tested and fixed FxLocalVariableDeclaration.
- create proper variable data from the function prototype instead of assuming that there's just 3 pointers.
- added a printable name to VMScriptFunction for error output during gameplay in case something goes wrong.
2016-10-20 16:55:12 +02:00
Christoph Oelckers
2fd4fa9660 Merge branch 'master' of https://github.com/rheit/zdoom into zscript
# Conflicts:
#	wadsrc/static/actors/doom/doomimp.txt
2016-10-20 10:44:53 +02:00
Christoph Oelckers
4b956a2f2b - added support for the skyoffset property that had been settable in ANIMDEFS for GZDoom. This will only have an effect in sky mode 2. 2016-10-20 09:56:45 +02:00
Christoph Oelckers
19d070c9bd - fixed: averageColor swapped red and blue.
- renamed some stuff
2016-10-20 09:08:07 +02:00
Christoph Oelckers
ffc38d422e - split up FxCompoundStatement into the old FxSequence and a new subclass. FxSequence is just a sequence of expressions, while FxCompoundStatement is the one that actually implements handling of local variables. The split was done so that ZCCCompiler::ConvertNode can return multiple statements as one object and for that FxCompoundStatement is not suitable.
- added conversion of local variable declarations. This is still untested
2016-10-20 01:09:35 +02:00