Commit graph

7886 commits

Author SHA1 Message Date
Christoph Oelckers
88fd47247d - scriptified several trivial functions from a_action.cpp. 2016-11-01 16:32:47 +01:00
Edoardo Prezioso
7137e87b4b - Fixed GCC/Clang errors from recent commits. 2016-11-01 10:35:45 +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
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
Christoph Oelckers
ede350ba36 - there seem to be some problems with the line endings... 2016-10-30 23:44:55 +01:00
FishyClockwork
4fc5d527c6 Moved 'goodbye' from usdf.txt to usdf_zdoom.txt
I have undone all my changes to usdf.txt.
It should look like how it did before commit 0df6ba6
2016-10-30 20:30:32 +01: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
8f2e9be70c Changed a description in usdf_zdoom.txt
Changed a description in usdf_zdoom.txt to be more truthful. It's not just one new field anymore.
(I really should learn to read these things before changing them.)
2016-10-30 19:30:56 +01:00
FishyClockwork
4a56d426c3 Actually put the new info in the proper section
Actually put the new info in the proper section in usdf_zdoom.txt
2016-10-30 19:30:55 +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
f450a60f66 Undone changes to usdf.txt, updated usdf_zdoom.txt
Undone changes to usdf.txt, updated usdf_zdoom.txt
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
f1a80770e1 Updated the USDF specs
Updated the USDF specs about 'require' and 'exclude'.
2016-10-30 19:30:54 +01:00
FishyClockwork
b1880964fa Added two new sub-blocks for Choice blocks
Added two new sub-blocks for Choice blocks: Require and Exclude.
The syntax for both is the same as Cost blocks.

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

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

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