Commit graph

7218 commits

Author SHA1 Message Date
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