Commit graph

9044 commits

Author SHA1 Message Date
Christoph Oelckers
ff3baac8a7 - made PStatePointer a real pointer pointing to a native struct named 'state', because that's what it really is and what it needs to be if we want to use a state as more than an opaque identifier in the VM 2016-11-21 19:36:14 +01:00
Christoph Oelckers
6cc00e79a6 - made all internal struct types NativeStructs so that all variables of their types are made references. 2016-11-21 19:20:27 +01:00
Christoph Oelckers
360436c201 - scriptified the scripted marines.
- fixed symbol name generation for native functions.
- moved PrintableName to VMFunction so that native functions also have this information.
2016-11-21 19:09:58 +01:00
Christoph Oelckers
97763b5a2b - added scriptable virtual overrides for PostBeginPlay, Tick, BeginPlay, Activate and Deactivate. 2016-11-21 14:59:17 +01:00
Christoph Oelckers
7d99552903 - added two new integral types SpriteID and TextureID, both are needed to allow proper serialization as they require something different to be written out than a regular integer. 2016-11-21 13:45:33 +01:00
Christoph Oelckers
de2eb18727 - added per-channel access for color variables. However, since they are locally stored in registers, it required a minor bit of fudging for this case.
- make sure that a PFunction's implementation is always initialized before starting the code generator.
2016-11-21 12:38:39 +01:00
Christoph Oelckers
393bcf9e91 - extended ExpEmit::RegNum to 16 bits so that it can hold larger values for constant registers. 2016-11-21 10:50:09 +01:00
Christoph Oelckers
188c0ee932 - removed the REGT_NIL check from the PARAM_EXISTS macro, because with the implemented handling of named arguments it isn't possible that REGT_NIL can end up in the parameters without a programming error.. 2016-11-21 10:28:06 +01:00
Kyle Evans
3270b20045 Remove non-existant source file 2016-11-20 21:33:23 -06:00
Christoph Oelckers
e7f6bae83e - implemented named arguments.
- fixed flag CVAR access. As it turned out, OP_LBIT is a bit messy to set up properly when accessing integers that may or may not be big endian, so it now uses a shift and bit masking to do its work.
- used the SpawnPlayerMissile call in A_FireBFG to test named arguments.
2016-11-21 01:32:01 +01:00
Christoph Oelckers
7d8143224e - restored two accidentally deleted VM instructions. 2016-11-21 00:33:55 +01:00
Christoph Oelckers
8f722a3633 - fixed: FxCVar must free its address register. 2016-11-20 23:26:32 +01:00
Christoph Oelckers
e93961da96 - removed all constant versions of vector instructions. The vector code does not use compound constants so there's no need to have instructions for them.
- fixed: The code generator had no good safeguards for exceeding the maximum amount of registers.

All there was was a handful of pitiful asserts which in production code do nothing at all but generate broken output.
Even worse, the VM was hardwired to at most 255 constants per type per function by storing the constant count in a byte! This has been extended to 65535, but since many instructions only have a byte available for the constant index, a workaround had to be added to do a two-instruction setup if larger indices are needed.
2016-11-20 23:00:05 +01:00
Christoph Oelckers
1c2c26eb08 - implemented direct CVar access. 2016-11-20 20:24:39 +01:00
Christoph Oelckers
5951a9449c - added static constant arrays. At the moment they can only be defined inside functions due to lack of dedicated storage inside classes for static data.
- added new VM instructions to access the constant tables with a variable index.
- refactored VMFunctionBuilder's constant tables so that they are not limited to one entry per value. While this works fine for single values, it makes it impossible to store constant arrays in here.
2016-11-20 18:00:37 +01:00
Christoph Oelckers
bb25c5faaa - scriptified the remaining Doom weapon code.
- implemented method calls from struct instances.
- optimized disassembly of VM call instructions to print the function's name at the end where it is more visible and does not need to be truncated. Also use the printable name for script functions here.
2016-11-20 12:27:26 +01:00
Christoph Oelckers
ab6b2f369e - fixed: For varargs, not only the type but also the flag of the last specified argument need to be stored for later parameters. 2016-11-20 09:47:46 +01:00
Christoph Oelckers
3c726aa570 - scriptified A_FirePlasma. 2016-11-20 01:18:21 +01:00
Christoph Oelckers
fdab994fcb - scriptified the Rocket launcher. 2016-11-20 01:11:01 +01:00
Christoph Oelckers
814493b68d - scriptified the Super Shotgun. 2016-11-20 00:45:06 +01:00
Christoph Oelckers
af34d82888 - scriptified A_Saw.
- implemented multiple-return-value assignment. Due to some grammar conflicts the originally intended Lua-inspired syntax of 'a, b = Function()' could not be done, so it's '[a, b] = Function()'
2016-11-20 00:25:38 +01:00
Christoph Oelckers
74c5659fc5 - explicitly call Destroy in PClass::StaticShutdown because some class type objects were no longer automatically collected. 2016-11-19 18:09:34 +01:00
Christoph Oelckers
7595343aaa - fixed: Completely empty if statements left the code generator in a broken state. 2016-11-19 18:02:07 +01:00
alexey.lysiuk
c28bcca3f3 Print unknown if release information is unavailable on macOS
At least 10.4 Tiger doesn't support required sysctl name
2016-11-19 16:42:16 +01:00
alexey.lysiuk
60ac12be0a Fixed compilation warnings in Cocoa backend 2016-11-19 16:42:16 +01:00
alexey.lysiuk
3b240b73e9 Fixed endianness issue with saved games
See http://forum.zdoom.org/viewtopic.php?t=54272
2016-11-19 16:42:16 +01:00
Christoph Oelckers
0b70df88d8 - scriptified A_FireShotgun and A_FireChaingun. 2016-11-19 16:39:45 +01:00
Christoph Oelckers
d50da34664 - scriptified the pistol to test if struct member functions work.
- made APlayerPawn::PlayAttacking(2) virtual script functions so that mods have better control over player animations. Note that these have no native base so they skip the templated interface for managing virtual functions.
2016-11-19 13:56:29 +01:00
Christoph Oelckers
de8cacc465 - for struct member calls an address request is needed. 2016-11-19 12:41:00 +01:00
Christoph Oelckers
25e285b65d - fixed bad conversion from FString to const char * in state label type cast. 2016-11-19 12:25:53 +01:00
Christoph Oelckers
9fab8380ff - fixed: FxVMFunctionCall::GetDirectFunction did not check if the function could be called with no arguments. 2016-11-19 12:22:58 +01:00
Christoph Oelckers
f11f020b6c - allow functions in structs. This is needed for several internal data types like players, sectors, lines, etc.
- added a new type 'NativeStruct'. This will be used for types that cannot be instantiated, and is also needed to cleanly handle many internal types that only can exist as reference.
2016-11-19 12:12:29 +01:00
Christoph Oelckers
df4e9324c9 - added terminators to all flag lists. 2016-11-19 09:24:54 +01:00
Christoph Oelckers
10bc01c000 - fixed yet another place where VS did not warn about improper use of NULL. 2016-11-19 09:10:31 +01:00
Christoph Oelckers
3ce699bf9b - implemented pass-by-reference arguments - so far only for memory based variables.
- changed Dehacked weapon function lookup to check the symbol table instead of directly referencing the VM functions. Once scriptified these pointers will no longer be available.
- removed all special ATAGs from the VM. While well intentioned any pointer tagged with them is basically unusable because it'd trigger asserts all over the place.
- scriptified A_Punch for testing pass-by-reference parameters and stack variables.
2016-11-19 01:23:56 +01:00
Christoph Oelckers
7ff5069617 - added all missing things to enable the scriptified version of A_BrainSpit.
This uses a global function, this has been placed into DObject for now because the scripting interface does not allow non-class-owned functions yet.
2016-11-18 22:12:53 +01:00
Christoph Oelckers
aa32d8970b - scriptified a_hereticmisc.cpp. 2016-11-18 21:34:06 +01:00
Christoph Oelckers
34c949f84b - implemented the string concatenation operator '..'. This is capable of stringifying all of the common types for output.
- gave OP_CONCAT some sane semantics. The way this was defined, by specifying the source operands as a range of registers instead of a pair like everything else made it completely useless for the task at hand.
- changed formatting for floats to %.5f which for normal output in a game makes more sense. For special cases there should be a special formatting function for ints and floats that can do more specialized conversions.
2016-11-18 17:44:25 +01:00
Christoph Oelckers
24481781b4 - added missing unsigned casts to the VM.
- make the pointer to string cast a bit more useful by using the actual object's type rather than 'Object' which can be a great asset when debugging.
- fixed a few bad asserts.
2016-11-18 14:50:21 +01:00
Christoph Oelckers
f71aad4cdd - cleanup of the remaining FxBinary operators.
- changed FxCompareEq with strings and other types that can be cast to from a string always convert the string to the other type before comparing.
2016-11-18 14:19:55 +01:00
Christoph Oelckers
d9953eb3bd - cleaned up FxCompareRel::Resolve. Also added unsigned integer support to it and FxMulDiv (these, aside from the float cast, are the only two operations where this is important.) 2016-11-18 12:23:58 +01:00
Christoph Oelckers
b6801d526b - same as last commit for FxMulDiv and FxPow.
- some streamlining of FxAddSub.
2016-11-18 11:53:18 +01:00
Christoph Oelckers
a00181c899 - started refactoring binary operators by starting to movw the relevant parts or ResolveLR into the respective Resolve methods. FxAddSub complete.
This one-size-fits all function has become too unwieldy with all its special cases and makes improvements harder than necessary.
2016-11-18 11:28:15 +01:00
Christoph Oelckers
8650d6806e - script export of player_t.
- replaced __alignof with the standard alignof equivalent.
2016-11-18 00:42:04 +01:00
Christoph Oelckers
b3b5cb2fa4 - fixed: Lines with both sides in the same sector but an active portal may not be discarded early. 2016-11-17 23:13:17 +01:00
Christoph Oelckers
6461f5995b - fixed: Script defined pointers were not added to the FlatPointers array. 2016-11-17 22:21:08 +01:00
Christoph Oelckers
e4dfb13d25 - fixed: OP_LO was missing a read barrier. 2016-11-17 20:41:59 +01:00
Christoph Oelckers
3bcd85eb8a added class pointer casts. Due to grammar problems the type has to be put into parentheses to get the class token out of the global parsing namespace:
class<Actor> myclass = (class<Actor>)(GetClass());
2016-11-17 20:31:53 +01:00
Christoph Oelckers
022228d8a9 - fixed code generation of class type cast for local variables. 2016-11-17 19:30:30 +01:00
Christoph Oelckers
8205e6cf08 - optimize access to array members with constant index. Like with struct members this can be combined with the outer index/address.
- fixed register allocation with array indices and stack variables.
2016-11-17 18:06:56 +01:00
Christoph Oelckers
2cc48ec378 - implemented code generation for stack variables.
- fixed code generation for using local variables as array index. This must use a different register for the array element offset because the original register may not be overwritten.
2016-11-17 16:44:41 +01:00
Christoph Oelckers
d86f03e2e0 - reverted most of the last commit after realizing that trying to manage constructing/destructing per variable is not going to work because it'd require some extensive exception management in the compiled VM code.
- instead add a list of SpecialInits to VMScriptFunction so this can be done transparently when setting up and popping the stack frame. The only drawback is that this requires permanent allocation of stack objects for the entire lifetime of a function but this is a relatively small tradeoff for significantly reduced maintenance work throughout.
- removed most #include "vm.h", because nearly all files already pull this in through dobject.h.
2016-11-17 13:10:19 +01:00
Christoph Oelckers
30e6e8e25f - added bookkeeping info to types for allowing data on the stack that requires construction and destruction.
- removed unused PVector type.
2016-11-17 11:16:00 +01:00
Christoph Oelckers
21a1d5ffc8 - scriptified Hexen's Wraith and parts of the Spike. 2016-11-17 00:44:43 +01:00
Christoph Oelckers
df43ee96ce - fixed a lost '='.
- scriptified A_TimeBomb.
2016-11-16 21:12:16 +01:00
Christoph Oelckers
7a29e6cfdc - scriptified Hexen's fog. 2016-11-16 20:00:25 +01:00
Christoph Oelckers
063e94971d - removed incorrect _DEF. 2016-11-16 19:47:07 +01:00
Major Cooke
af3bda3f2a Removed _DEF. 2016-11-16 19:47:06 +01:00
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
Major Cooke
f2ec266eec Fixed: Actors with NOINTERACTION shouldn't waste time continuously applying NOBLOCKMAP if it has it already and not moving. 2016-11-15 11:38:03 -06: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
b0a0056097 Merge branch 'zscript' into gz-zscript 2016-11-15 15:35:35 +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
06cdcf1338 Merge branch 'zscript' of https://github.com/rheit/zdoom into gz-zscript 2016-11-15 13:40:18 +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
3a2d0e3486 - copied all necessary adjustments from the test branch in the QZDoom repo. 2016-11-15 11:49:27 +01:00
Christoph Oelckers
6e223ebc21 Merge branch 'zscript' of https://github.com/rheit/zdoom into gz-zscript
# Conflicts:
#	src/CMakeLists.txt
#	wadsrc/static/actors/doom/doomarmor.txt
#	wadsrc/static/decorate.txt
2016-11-15 11:36:59 +01:00
Christoph Oelckers
196986ae6b Merge branch 'master' of https://github.com/rheit/zdoom 2016-11-15 11:25:42 +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
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
0111ec451a Revert "Fixed: A_SetInventory with an amount of 0 was not truly eliminating the actor."
This reverts commit 02435b46a0.
2016-11-14 15:52:49 +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
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
970c750daa Added OpenGL support to the underwater view blend scalar option. 2016-11-11 18:08:47 +08: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
Rachael Alexanderson
d36993a03b - Textured automap would crash due to an additional parameter in the software renderer to the FillSimplePoly function call, causing stack issues. 2016-11-08 15:05:23 -05:00
Christoph Oelckers
5c7affd102 Merge branch 'master' of https://github.com/rheit/zdoom 2016-11-08 14:31:10 +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
747b612860 Merge branch 'master' of https://github.com/rheit/zdoom 2016-11-03 19:42:03 +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
7f2350cf64 Merge branch 'master' of https://github.com/rheit/zdoom 2016-10-29 16:08:46 +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
f0ee3e3fa3 Merge branch 'master' of https://github.com/rheit/zdoom 2016-10-25 01:04:43 +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
fe909c4e3b Merge branch 'master' of https://github.com/rheit/zdoom 2016-10-24 22:25:04 +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
bea625a42c - added an ATTENUATE flag to dynamic lights, this is set by default for attached lights. For placed lights this is off, because it'd interfere with many existing maps that depend on unattenuated lights. 2016-10-23 20:42:48 +02:00
Christoph Oelckers
fbe2b76705 - fixed checks in sprite sorting logic. There were some missing parentheses. 2016-10-23 19:08:43 +02:00
Christoph Oelckers
10203afa41 Merge branch 'master' of https://github.com/rheit/zdoom 2016-10-23 18:50:59 +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
Magnus Norddahl
6c1c0d2972 Improve scene selection for SSAO so that the mainview drawmode always takes precedence 2016-10-22 21:35:49 +02:00
Magnus Norddahl
a3e19bf337 Fixed gl_ssao_portals not having effect 2016-10-22 21:25:29 +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
Magnus Norddahl
e891911a99 Fix broken SSAO portal rendering and let FRenderState do the glDrawBuffers calls 2016-10-22 00:09:06 +02:00
Magnus Norddahl
be2c50f11c Merge remote-tracking branch 'gzdoom/master' into ssao 2016-10-21 23:48:30 +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
96437d95fa - use the new ZDoom code for retrieving a sky's cap color to avoid redundancies. 2016-10-20 10:36:23 +02:00
Christoph Oelckers
ce80d8157b Merge branch 'master' of https://github.com/rheit/zdoom 2016-10-20 10:24:37 +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
Magnus Norddahl
2fe545a4fd Merge r_stretchsky and r_capsky into r_skymode 2016-10-20 00:59:51 +02:00
Magnus Norddahl
5de8112578 Add support for capping sky with a solid color 2016-10-19 23:52:09 +02:00
Christoph Oelckers
2d85efce2a - added processing of compound statements to the compiler. This means that anonymous functions without control statements are generating code now.
- added local variable declarations to the code generator. This is not tested yet, that will come with the next commit.
2016-10-19 19:05:48 +02:00
Christoph Oelckers
8a6230d64a - Renamed FxSequence to FxCompoundStatement.
- fixed: The state parser was unable to accept empty anonymous functions, which should be treated as if there is none at all.
2016-10-19 16:15:02 +02:00
Christoph Oelckers
458c68775f - fixed handling of loop statements.
All break and continue statements were collected in one list, and each loop statement taking hold of that entire list, including the breaks and continues from previous outer loops.
Changed it so that loop statements contain the jump addresses themselves and set a pointer in FCompileContext, so that the jump point can be set directly in the loop statement - and an error printed if there is none in the resolving stage, not the emitting one.
Consolidated the identical backpatching code of the three loop statement nodes into a subfunction.
2016-10-19 14:36:54 +02:00
Christoph Oelckers
cfbcfc440d - 'fixed' local variable declrations to work like C, not like some Lua-inspired nightmare. Also added proper initialization syntax for arrays. 2016-10-19 13:07:44 +02:00
Christoph Oelckers
33567741f5 - fixed: The parser was not generating a compound statement node for anonymous action functions. 2016-10-19 10:38:25 +02:00
Christoph Oelckers
665d752686 - added 'null' token to the ZScript parser which is needed for null pointers.
- removed function declaration parser from DECORATE because it is not needed anymore.
- fixed: comparison operators could not handle names.
2016-10-19 00:35:34 +02:00
Christoph Oelckers
bef71f29e2 - make generation of the AST dump a command line parameter instead of having it depend on running a debug build.
- disable generation of the parser's trace file in debug builds.

This increases parsing time by a factor of 15 and is only needed when debugging a problem in the grammar.
2016-10-18 10:17:09 +02:00
Christoph Oelckers
61cc7dbb29 - another batch of Hexen items converted.
- fixed parsing of named damage types and pain chances.
2016-10-18 10:09:02 +02:00
Marisa Heit
1652c02a08 Add unsigned division opcodes to the VM 2016-10-17 22:37:49 -05:00
Christoph Oelckers
646f9b21c7 Merge branch 'master' of https://github.com/rheit/zdoom into zscript
# Conflicts:
#	src/scripting/codegeneration/codegen.cpp
2016-10-18 00:55:56 +02:00
Christoph Oelckers
1c21dbc44c - handle trinary conditional statement. 2016-10-17 21:43:14 +02:00
Christoph Oelckers
a6a0c4b93c - handle all unary operators.
- handle all binary operators which are already implemented in the code generator.
- implemented sizeof/alignof operators in code generator.
- rewrote RequestAddress so that its return value is not the writability of an address but the mere existence. Also changed it to not output errors itself because those cannot be dealt with by the calling function.
2016-10-17 20:33:35 +02:00
Christoph Oelckers
23a2a19a78 - added handling for shift and bit operators.
- added the '>>>' (unsigned shift) operator. Although, with unsigned numbers available, this is technically not really needed, DECORATE supports this so ZScript should, too, if only for the benefit of making conversion tools easier to handle.
2016-10-17 15:52:29 +02:00
Christoph Oelckers
938ab4ca70 - implemented '**' (power) operator. To ensure reliability, acustom 'pow' function will be used to calculate it.
- fixed: FxBinary::ResolveLR' check for numeric operations was incomplete. Like far too many other places it just assumed that everything with ValueType->GetRegType() == REGT_INT is a numeric type, but for names this is not the case.
2016-10-17 15:17:48 +02:00
Christoph Oelckers
d0a8960f61 - added genuine PEX_GT, PEX_GTEQ and PEX_NEQ operations to the parser.
These were previously faked with the inverse plus a boolean not. Although this works, it either leads to sub-optimal code generation or some fudging to avoid the inefficient handling.
Just adding proper handling to the parser seems the easiest and most straightforward way to get around this. The code generator already can deal with these operations properly so there's no good reason to do it differently.
2016-10-17 14:38:51 +02:00
Christoph Oelckers
552f094ec1 - converted the rest of Heretic's actors.
- fixed: Boolean constants were not properly handled.
2016-10-17 12:58:23 +02:00
Christoph Oelckers
c13916ea18 - converted more Heretic actors. 2016-10-17 10:07:12 +02:00
Braden Obrzut
b4bdb8fa7d - Fixed: Assertion failure if a save was loaded without starting a new game (due to uninitialized RNG). 2016-10-17 00:22:06 -04:00
Braden Obrzut
741c9edf42 - Clear out GCC 6.2 warnings (interestingly they now check for misleading indentation which found a good case in fragglescript/t_func.cpp even though I believe it was harmless) 2016-10-17 00:19:08 -04:00
Christoph Oelckers
c623539d2d Merge branch 'master' of https://github.com/rheit/zdoom into zscript 2016-10-17 00:33:28 +02:00
Christoph Oelckers
6650e2bbfb - converted some Heretic stuff to ZScript for testing.
- added type casts to the arguments of function calls.
- added string constant to state conversion to FxTypeCast.
2016-10-16 22:32:52 +02:00
Braden Obrzut
9dd42be15f - Fixed: Demo playback on Windows XP since we don't patch fstat for v140_xp bug. 2016-10-16 16:22:21 -04:00
Christoph Oelckers
afd9347087 - changed order of script files to match the old DECORATE list for easy comparison of the disassembly.
- added a descriptive name to all types for error messages.
- added a generic type cast node to the code generator.
- added a few more cast operations to the 'cast' VM instruction.
- extended FxClassTypeCast to handle all possible input that can be cast to a class pointer, not just names.
2016-10-16 19:42:22 +02:00
Christoph Oelckers
2da52cedc9 - restrict 8 and 16 bit integer types to struct and class members - and I am not really sure if they should even be allowed there, aside from legacy readonly properties. For 32 bit floats the same would hold, but those are already mapped to 64 bit doubles silently.
ZDoom only uses these types in a very few isolated places, and even those can be removed without problems, so it's very doubtful that having support for these types is of any benefit - on the other hand, having them will most likely introduce more code than is saved in the data by using them...
2016-10-16 12:47:26 +02:00
Christoph Oelckers
59ab8b7ccd - implemented array-style syntax for Random calls.
- implemented handling of the basic math operators so that heretic/beast.txt can be processed.

This is working, aside from still needing the type casts to properly transform the strings to class pointers.
2016-10-16 10:59:12 +02:00
Christoph Oelckers
2c7c04e803 - when simplifying a non-constant expression, leave any identifier that cannot be trivially simplified to a constant alone. It is better to defer resolution to more context-aware code for those. 2016-10-16 09:31:03 +02:00
Christoph Oelckers
6a6263a614 Merge branch 'master' of https://github.com/coelckers/gzdoom 2016-10-16 09:13:19 +02:00
Christoph Oelckers
59576e6d23 - use the newly added OF_Transient flag to avoid writing out the owned dynamic lights to savegames instead of destroying and recreating them each time. 2016-10-16 09:12:43 +02:00
Christoph Oelckers
b03489a43c Merge branch 'master' of https://github.com/rheit/zdoom 2016-10-16 08:51:13 +02:00
Marisa Heit
e4281454ce Split ANIMATED into three parts, filtered by game that uses them
- ANIMATED contained definitions for Doom, Heretic, and Strife, all
  crammed into a single file. This meant that animations from one game
  could erroneously make their way into maps for another game that
  provided custom textures with names that matched textures that animated
  in the other game. There are now three separate ANIMATED lumps with only
  the animations defined for the original game and no others. The one
  that gets loaded depends on the game being played.
- Added documentation for the ANIMATED file format to the comment for
  FTextureManager::InitAnimated(), since I had to figure it out from the
  code.
2016-10-15 21:40:24 -05:00
Marisa Heit
ae14993ba4 Fixed: Possible invalid processing for Crash states that immediately destroy the actor
- Setting an actor's Crash state has the potential to destroy the actor if
  the Crash state has one or more 0-tic states that end with Stop. This
  was not taken into account when the object's Z velocity was 0, but it
  was under the floor anyway.
2016-10-15 21:14:34 -05:00
Marisa Heit
58ec0e4594 Add OF_Transient flag for objects that shouldn't be written to disk 2016-10-15 20:57:56 -05:00
Christoph Oelckers
847b8c45ef - Changed ZCCCompiler::Simplify to allow running in constant and non-constant mode. The difference is that non-constant mode does not attempt to simplify function name expressions because these cannot be processed without destroying them, if some identifier in there is not referencing a symbol, which is quite common. 2016-10-16 01:33:36 +02:00
Christoph Oelckers
d6ce60f63a - added named RNG support to FxFunctionCall.
This looks simpler than duplicating all that stuff and avoids a lot code duplication.
2016-10-16 01:08:02 +02:00
Christoph Oelckers
55f6661c87 - added handling for all the builtins supported by DECORATE to FxFunctionCall.
For the random functions this class only handles the default-RNG version. The one with an explicit RNG needs to be done separately because the parser produces different output for them.
2016-10-16 00:12:33 +02:00
Christoph Oelckers
b299b64e47 - the compile context now knows if it is invoked by ZScript or DECORATE, so that it can be more strict with ZScript if needed.
- added a truncation warning to FxIntCast, which only occurs with ZScript, not with DECORATE. FxBoolCast is intentionally left out because it would defeat the reason for this cast type.
2016-10-15 21:35:31 +02:00
Christoph Oelckers
c3e693b507 - added FindClassMemberFunction which retrieves a function symbol and performs some verification.
- removed Self parameter from FxFunctionCall. Actual member function calls through an object require quite different handling so lumping these two together makes no sense.
- added a workaround to deal with ACS_NamedExecuteWithResult to both the compiler and FindClassMemberFunction. The way the ZScript compiler sets this up means that it will call the builtin, not the actual action function, so the parser needs to do some explicit check to get past the same-named action function.
- pass a proper self pointer to FxActionSpecial. Although it's still not being used, propagating design shortcuts through several function levels is a very, very bad idea.
2016-10-15 20:16:44 +02:00
Christoph Oelckers
cbb990a79e - pass the current function to the compile context instead of just the containing class. 2016-10-15 17:40:27 +02:00
Christoph Oelckers
db8ab1bc4a - give PFunction a bit more information:
* explicitly require passing the owning class when creating it.
 * extract self pointer class when adding a variant.
 * put the flags on the single variants, we can not fully rule out that they will be 100% identical, if variants ever get allowed.
2016-10-15 15:50:45 +02:00
Christoph Oelckers
091da92819 - Added AStateProvider class which is used to define the special action function behavior of weapons and custom inventorys. The class itself does not do anything, but the compiler will use it to set up the action function prototypes differently which in turn will be used to do type checking during code generation. 2016-10-15 15:10:48 +02:00
Christoph Oelckers
32a3f57a54 - more preparations to compile functions:
* Allow PFunction to work without a VMFunction being attached.
 * The Variant for a function must store the prototype itself instead of relying on the VMFunction it points to. Otherwise it would not be possible to reference a prototype during compilation of the function because it does not exist yet.
 * Give the variant a list of the function's argument's names, because these are also needed to compile the function.
 * create an anonymous function symbol when the function gets registered to the builder. At this point we have all the needed information to set it up correctly, but later this is no longer the case. This is the most convenient info to have here because it contains everything that's needed to compile the function in the proper context, so it has to be present when starting compilation.
 * added some preparations to implement special handling for weapons and custom inventory items, which can run action functions in another actor's context. This part is not active yet but the basics are present in SetImplicitArgs.
2016-10-15 14:36:08 +02:00
Christoph Oelckers
2cb5839c11 - count errors in the parser and abort afterward if there were some.
- use FScriptPosition's error counter throughout the compiler so that there is only one counter for everything, not two.

Parts of the compiler use FScriptPosition, so this is easier to handle than having a separate counter in the compiler class. It also avoids having to pass the compiler object to any function where an error may be output. The TreeNodes contain sufficient data to be converted to an FScriptPosition and using that for error message formatting.
2016-10-15 12:15:25 +02:00
Christoph Oelckers
5f5da26321 Merge branch 'master' of https://github.com/rheit/zdoom into zscript 2016-10-15 10:52:35 +02:00
Christoph Oelckers
162da2fcaf - allow to specify "none" to set an actor's translation to the identity table. 2016-10-15 10:51:48 +02:00
Christoph Oelckers
3b0d687b22 - committed from the wrong subdirectory and missed all files that just changed the #include line. 2016-10-15 10:43:02 +02:00
Christoph Oelckers
f86e64e712 - renamed thingdef_expression to codegen. Eventually this needs to be split up into smaller units because the file is already quite large and there's still a lot to add here. 2016-10-15 10:39:58 +02:00
Christoph Oelckers
d8a8b59006 - cleaned up the loop statement nodes in the code generator, which put some handling in FCompileContext and some of their data into the base FxExpression class instead of having an intermediate base class for all loops which is responsible for the relevant data. All this is now encapsulated in a new FxLoopStatement class which serves as base for the actual loop statements. 2016-10-15 10:34:26 +02:00
Christoph Oelckers
7bdd320f13 - forgot to save this. 2016-10-14 23:51:38 +02:00
Christoph Oelckers
2e882a41a3 - removed some redundancy. 2016-10-14 23:13:08 +02:00
FishyClockwork
08504dcbe2 Added a small check just in case... 2016-10-14 23:11:58 +02:00
FishyClockwork
ecffd0bea6 Done the code changes.
This time only nulls I've added are nullptrs
2016-10-14 23:11:57 +02:00
alexey.lysiuk
0370592422 Fixed serialization of DSeqPolyNode class objects
Polyobject pointer was not serialized at all
2016-10-14 23:05:02 +02:00
Magnus Norddahl
36aff68501 Fix divide by zero if yscale is too small a number 2016-10-14 23:02:16 +02:00
Magnus Norddahl
657abb374b Fix SkyViewpoint skyboxes not being rendered 2016-10-14 23:01:10 +02:00
Christoph Oelckers
9def9ec095 - added more casting kludges so that I can run some tests with Heretic's definitions. 2016-10-14 22:54:22 +02:00
Christoph Oelckers
d00e93bdab - fixed order of state setup.
It looks like the setup of the action function and the adding of the states got inverted by something I tried, leaving the ActionFunc member empty on the real states.
2016-10-14 21:56:45 +02:00
Christoph Oelckers
52005214c1 - Added some fudging so that A_PlayerSkinCheck creates proper code until I can rewrite the FunctionCall expression to match what the script compiler needs. The current version of this class is too much geared toward DECORATE. 2016-10-14 21:15:46 +02:00
Christoph Oelckers
784f7ed671 - converted all of Doom's actors.
- fixed a few problems that were encountered during conversion:
 * action specials as action functions were not recognized by the parser.
 * Player.StartItem could not be parsed.
 * disabled the naming hack for PowerupType. ZScript, unlike DECORATE will never prepend 'Power' to the power's name, it always needs to specified by its full name.
 * states and defaults were not checked for empty bodies.
 * the scope qualifier for goto labels was not properly converted to a string, because it is an ENamedName, not an FName.
2016-10-14 20:08:41 +02:00
alexey.lysiuk
c3ced5842a Added multithreaded upscaling with xBRZ (macOS only) 2016-10-14 17:14:49 +03:00
alexey.lysiuk
58d44e89c9 Use single helper for xBRZ scalers 2016-10-14 17:03:26 +03:00
alexey.lysiuk
d6b3cbe0c9 Fixed serialization of MovePoly class objects
See http://forum.zdoom.org/viewtopic.php?t=53787
Removed "speed" field which is serialized in the parent class
2016-10-14 14:33:13 +03:00
Christoph Oelckers
9e2830a3db - converted the rest of actors/shared.
- moved damagetype definitions to MAPINFO. These were in DECORATE which is not correct. The old code is left for compatibility.
2016-10-14 10:46:15 +02:00
Christoph Oelckers
b8a2059aa9 Merge branch 'master' of https://github.com/rheit/zdoom into zscript 2016-10-14 09:11:54 +02:00
Marisa Heit
97107b6b6d Update lempar.c to 2016-10-04 version
- Every update rolled into one, because I'm pretty sure I missed some while
updating lemon.c (not counting today's commits), since it wasn't always
updated at the same time as lemon.c.
- In particular, I think this check-in from 2016-06-06 was very important to
  us after commit 3d5867d29e (For the
  Lemon-generated parser, add a new action type SHIFTREDUCE and use it to
  further compress the parser tables and improve parser performance.):
  * Fix lempar.c so that the shift-reduce optimization works for error
    processing.
2016-10-13 22:30:12 -05:00
Christoph Oelckers
7de683f9f5 - converted a few more DECORATE files.
- started with the AST converter. So far it only deals with direct function calls with simple constants as parameters.
- added an error condition for the defaults block to get rid of some asserts.
2016-10-14 00:40:20 +02:00
Christoph Oelckers
7e8d7eb2ec - fixed parsing of 'damage' default property.
- fixed processing of goto labels.
2016-10-13 22:52:31 +02:00
Christoph Oelckers
433bf46010 - removed token 'mode' because it isn't used anywhere and clashed with some actor properties.
- fixed uninitialized counter variable in DECORATE parser.
- allow dottable_id of xxx.color so that the property parser can parse 'powerup.color'.
- fixed crash with actor replacement in script compiler.
- add the lump number to tree nodes because parts of the property parser need that to make decisions.
- removed test stuff.
- converted inventory.txt, player.txt and specialspot.txt to ZSCRIPT. These were the minimal files required to allow actor.txt to parse successfully.
- removed the converted files from the DECORATE include list so that these are entirely handled by ZSCRIPT now.
2016-10-13 20:45:52 +02:00
Magnus Norddahl
660a45a0e0 Add normals to decals 2016-10-13 18:04:00 +02:00
Christoph Oelckers
a72fbb771f - separated the code generation from the DECORATE parser and cleaned up the interface to the code generator. Most importantly, the VMScriptFunctions are now preallocated when being added to the list of functions to compile and will be filled in later by the code generator. This allowed the removal of some ugly maintenance code. 2016-10-13 00:53:59 +02:00
Christoph Oelckers
59ed26c0b6 - resorted some of thingdef.cpp's contents into more appropriate files.
- split FinishActor into several functions. While DECORATE can, ZSCRIPT cannot do all this in one go.
- split the state finalization into several class-specific virtual functions.
2016-10-12 20:42:41 +02:00
Christoph Oelckers
b1a83bfd26 - started with cleanup and separation of DECORATE code.
* everything related to scripting is now placed in a subdirectory 'scripting', which itself is separated into DECORATE, ZSCRIPT, the VM and code generation.
 * a few items have been moved to different headers so that the DECORATE parser definitions can mostly be kept local. The only exception at the moment is the flags interface on which 3 source files depend.
2016-10-12 19:22:33 +02:00
Christoph Oelckers
6a8ab9a4d3 - implemented the state compiler. So far all it can handle is parameter-less functions.
To do the rest, some cleanup is needed first, to untangle the DECORATE parser from the actual code generation so that the low end stuff can actually be reused here instead of having to be redone.
2016-10-12 17:50:23 +02:00
Christoph Oelckers
900644e465 Merge branch 'master' of https://github.com/rheit/zdoom into zscript 2016-10-12 12:43:56 +02:00
Christoph Oelckers
6f92efc72c - renamed thingdef_codeptr.cpp and moved it out of thingdef/.
Ultimately, thingdef should only contain code that is directly related to the DECORATE parser, but that's not the case with this file. It's only function definitions which get used during gameplay and will also be accessed by ZScript.
The change is intentionally on master so that pull requests can adjust to it now instead of creating conflicts later.
2016-10-12 12:43:26 +02:00
Christoph Oelckers
a4a00435e2 Merge branch 'master' of https://github.com/rheit/zdoom 2016-10-12 08:42:37 +02:00
Major Cooke
41bf9def80 GZDoom compatibility for PSPF_FLIP. 2016-10-11 20:18:06 -05:00
Major Cooke
3de83b8943 Added PSPF_FLIP.
Flips the overlay on the X axis.
2016-10-11 17:20:58 -05:00
Christoph Oelckers
f46b6b5be5 - fixed some issues with the grammar for parsing states:
* Goto did not support the class scope operator '::'. Like in DECORATE, this cannot be done with a simple '.' because it creates semantic problems with first part of a state label. This requires different syntax so that it can unambiguously distinguish between a scope identifier and the actual label
 * Goto used the incorrect token PLUS for '+' instead of ADD.
 * The state's duration was not stored in the AST.
 * Truncating the sprite name inside the parser is probably not the best idea because it used a simple Printf to report this. Let's do this during processing of the AST where this can be properly handled as an error.
2016-10-12 00:04:30 +02:00
Major Cooke
5dc94a10c3 Added A_SetInventory.
- Sets the absolute amount of an inventory actor.
- Limits itself to the range [0, MaxAmount]. Setting beyondMax to true disregards the MaxAmount. Default is false.
2016-10-11 14:44:31 -05:00
Christoph Oelckers
d8c689d874 - initialize function symbols. At the moment all it does is process the existing native functions. Any further processing will be done once the base classes of the engine can be parsed from the scripting files.
- switched the types of the internal 'self' and 'stateowner' parameters so that they get assigned correctly. I can't tell if this will error out if fields get accessed from the caller with the wrong class, but for actual scripting to work these must be correct.

The committed 'actor.txt' can be parsed successfully, with the exception of a few subclass references that cannot be resolved yet.
2016-10-11 18:53:10 +02:00
Christoph Oelckers
bdbc7c3fb7 - removed CreateDamageFunction, because it's no longer needed for defining a 'damage' constant. 2016-10-11 14:43:17 +02:00
alexey.lysiuk
7510ad1635 Fixed missing fake floors in deferred buffer mode
wow.wad is now genuine and authentic...
2016-10-11 14:56:22 +03:00
Christoph Oelckers
6989b81688 - extended the grammar so that the DECORATE function declaration list can almost be used as-is, with the sole exception of requiring any action function to declare a return type, even if it is void.
This adds:
 * builtin types color, state and sound.
 * ending a parameter list with an ellipsis to declare a varargs list. (A_Jump uses this.)
 * allowing to declare optional arguments by giving them a default value.
 * adding an 'action' qualifier for function declarations.
2016-10-11 13:11:40 +02:00
Christoph Oelckers
dde25820e2 - fixed winding of voxel polygons. 2016-10-11 09:08:31 +02:00
Christoph Oelckers
acec2e5b07 Merge branch 'master' of https://github.com/rheit/zdoom into zscript 2016-10-11 00:57:31 +02:00
Christoph Oelckers
3b19887637 - implemented the Defaults property initializer.
This uses the same property and flag tables as DECORATE with a few changes:

 * it sets the parse mode to strict, so that several DECORATE warnings are now errors.
 * trying to change a deprecated flag will print a warning.
 * setting of editor numbers, spawn and conversation ID id not possible. Use MAPINFO to do this.
 * all subclass flags must use the qualified name now (e.g. +ALWAYSPICKUP will print an error.)
 * the scriptable Damage property is not yet implemented. This will require a special case with a differently named property in the processing function because in the AST it is no longer possible to distinguish between a damage value and a constant damage function.
2016-10-11 00:56:47 +02:00
Christoph Oelckers
084bf8c576 - fixed: VisibleAngle and VisiblePitch actor properties require both parameters to be present, but the second one was set to optional. 2016-10-11 00:23:50 +02:00
Christoph Oelckers
2b9af0176c - changed grammar for a class's default block to look and act like DECORATE, so that it can hook into the same property dispatcher.
This had been defined as a regular compound statement but in the context this will be used in, that makes very little sense, because all it can do is set some constant values.
The most important thing here is that it doesn't provide an unnecessary learning curve to its users and doing it this way will not only ensure that but also avoid redundant documentation.
To allow initialization of other user-defined properties it will require some extensions but that's a job for later and can just as easily be done in the current framework, rather than throwing everything out and start from zero.
2016-10-10 16:53:24 +02:00
Christoph Oelckers
14a6e7989b Merge branch 'master' of https://github.com/rheit/zdoom
# Conflicts:
#	wadsrc/static/menudef.txt
2016-10-10 11:38:08 +02:00
Major Cooke
31ca5a1900 Added OverlayX/Y(int layer)
- Retrieves the X/Y positions of an overlay.
- A_OverlayFlags and A_OverlayOffset now interpret a layer of 0 to mean 'use this calling layer'.
2016-10-10 10:48:50 +02:00
alexey.lysiuk
a771a3edd4 Fixed potential crash caused by A_Warp()
ACSF_Warp case was refactored to express its intention clearly
http://forum.zdoom.org/viewtopic.php?f=2&t=53734
2016-10-10 10:47:43 +02:00
Christoph Oelckers
e84d6a06d8 - changed PClass:AddField so that it doesn't create defaults if none are present. The ZScript compiler will not create any defaults until after all fields have been added and this function created bad data if it was run on a class without defaults.
- added checks for duplicate field names.
- moved the tree node symbol tables out of PSymbolTreeNode to the worker data. That symbol is a bad location because it restricts the usefulness of the symbol class which is also needed for variables which use different AST structs.
- fixed some memory management issues with the work classes for the compiler that became apparent after moving the symbol tables in there. In several places these were copied around, possibly losing data.
2016-10-10 01:18:47 +02:00
Christoph Oelckers
4ecd7dd13a - a bit of cleanup. 2016-10-09 22:01:23 +02:00
Christoph Oelckers
ad43f2bc7e - parse the list of class/struct fields and add the PField entries to their type.
- fixed a few issues with trying to access a class's Type before it got initialized.
2016-10-09 21:54:23 +02:00