Commit graph

7784 commits

Author SHA1 Message Date
Marisa Heit
09b82b8a3a Merge branch 'master' into zscript 2016-10-21 22:13:24 -05:00
Marisa Heit
5c596d3797 Change VM to increment PC after each instruction rather than before
- VC++ generated horribly stupid code for x64 when incrementing pc at the
  beginning of each instruction by storing hundreds of copies of it for
  every opcode executed. Incrementing pc at the end avoids this madness.
- It is possible I messed something up with this change. Hopefully not.
2016-10-21 22:11:23 -05:00
Christoph Oelckers
1e11042de0 - changed VM_EPSILON from 1/1024 to 1/65536 so that the ~== operator can actually be used.
1/1024 is far too coarse for ZDoom's purposes, this needs to be at least fixed point precision.
2016-10-22 02:52:28 +02:00
Christoph Oelckers
4b41e735f1 - added null pointer.
- fixed: FxMemberIdentifier checked for ClassPointers instead of object pointers to resolve the left hand side of the expression.
- allow comparison of pointers.
2016-10-22 00:50:04 +02:00
Christoph Oelckers
3b0b0baf05 Merge branch 'master' of https://github.com/rheit/zdoom into zscript
# Conflicts:
#	wadsrc/static/actors/shared/player.txt
2016-10-21 19:31:08 +02:00
Christoph Oelckers
b1289fa783 - fixed: The serialiter functionfor FDoorAnimation accessed the invalid destination pointer when loading a savegame. 2016-10-21 19:24:40 +02:00
nashmuhandes
21b690a3c7 Fixed: Player.ViewBob should be multiplying the bobbing height in P_CalcHeight, not the velocity of the bobbing.
This mimics the act of the user altering their movebob CVar to compensate for non-standard player movement speeds.
2016-10-21 19:24:39 +02:00
raa-eruanna
e0efdd97b3 - Added: PlayerPawn property "Player.ViewBob" which acts as a MoveBob/StillBob multiplier. 2016-10-21 19:24:39 +02:00
Christoph Oelckers
89416835a8 - preparations for null pointer support.
- add pointer support to FxAssign.
2016-10-21 19:18:39 +02:00
Christoph Oelckers
5bed0a2b39 - implemented class member access for variables. (Struct members and functions not done yet.) 2016-10-21 17:41:39 +02:00
Christoph Oelckers
f5e4c4b109 - implemented the '<>=' operator - more as a VM coding exercise than for its usefulness, though. 2016-10-21 16:35:07 +02:00
raa-eruanna
513f8312b3 - Renamed menu option for r_fullbrightignoresectorcolor 2016-10-21 08:36:20 -04:00
Christoph Oelckers
9f260983c7 - implemented all assign/modify operators.
- use a table to translate from PEX to tokens to make the code easier to read.
2016-10-21 14:18:31 +02:00
raa-eruanna
8678baf6f5 - Fullbright fixes 2016-10-21 07:32:18 -04:00
raa-eruanna
df6214b142 - Fixes 2016-10-21 07:21:56 -04:00
raa-eruanna
c76431414a - Implemented r_fullbrightignoresectorcolor from QZDoom 2016-10-21 07:06:24 -04:00
Christoph Oelckers
3e995d7aac - changed assignment operators to be expressions, like they are in C and DECORATE.
This also means that for now Lua-style multi-assignments are disabled, those should be easy to enable by making some changes to the assignment_statement grammar so that it doesn't recognize single assignments, but for now this is low priority because it adds a significant amount of complexity to do this right with functions that have multiple return values.
2016-10-21 12:22:42 +02:00
Christoph Oelckers
1450c3dffb - tested and fixed the regular assignment statement for both local and member variables.
The generated object code can definitely use an optimization pass but that's something left for later when more things are working. Right now it creates one opcode more than necessary for all member accesses (instead of using the offset in the store command it calculates an actual address of the variable in another address register) and can create one too many for non-constant expressions being assigned to local variables (a move between two registers because the emitted expression on the right hand side does not know that it can emit to the actual variable's register.)
2016-10-21 10:09:01 +02:00
Christoph Oelckers
9f99ca4788 - process most of the remaining statement types.
- extend assignment operations to handle local variables (untested.)
- make the implicit function arguments read only.
2016-10-21 01:12:54 +02:00
Christoph Oelckers
24394dfc92 - tested and fixed FxLocalVariableDeclaration.
- create proper variable data from the function prototype instead of assuming that there's just 3 pointers.
- added a printable name to VMScriptFunction for error output during gameplay in case something goes wrong.
2016-10-20 16:55:12 +02:00
Christoph Oelckers
2fd4fa9660 Merge branch 'master' of https://github.com/rheit/zdoom into zscript
# Conflicts:
#	wadsrc/static/actors/doom/doomimp.txt
2016-10-20 10:44:53 +02:00
Christoph Oelckers
4b956a2f2b - added support for the skyoffset property that had been settable in ANIMDEFS for GZDoom. This will only have an effect in sky mode 2. 2016-10-20 09:56:45 +02:00
Christoph Oelckers
19d070c9bd - fixed: averageColor swapped red and blue.
- renamed some stuff
2016-10-20 09:08:07 +02:00
Christoph Oelckers
ffc38d422e - split up FxCompoundStatement into the old FxSequence and a new subclass. FxSequence is just a sequence of expressions, while FxCompoundStatement is the one that actually implements handling of local variables. The split was done so that ZCCCompiler::ConvertNode can return multiple statements as one object and for that FxCompoundStatement is not suitable.
- added conversion of local variable declarations. This is still untested
2016-10-20 01:09:35 +02:00
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
f6b3cdc23d - converted the Chex Quest actors, completing the DECORATE conversion. 2016-10-18 23:22:41 +02:00
Christoph Oelckers
5643831ccc - converted all Strife actors. 2016-10-18 23:05:58 +02:00
Christoph Oelckers
1bdc1ccb6c - converted the remaining Hexen actors. 2016-10-18 18:11:13 +02:00
Christoph Oelckers
2c1d9a7a96 - another bunch of Hexen actors converted. 2016-10-18 15:15:06 +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
Marisa Heit
d2a9f7ac6f Fix Raise definition for DoomImp 2016-10-17 21:45:06 -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
4aecc4f565 - more Hexen conversions. 2016-10-18 00:49:13 +02:00
Christoph Oelckers
d66631478a - converted some Hexen stuff. 2016-10-17 23:27:34 +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