Commit Graph

184 Commits

Author SHA1 Message Date
Christoph Oelckers 3f1673f34f - scriptified A_HeadAttack, A_CyberAttack and A_Hoof. 2016-10-24 00:50:28 +02:00
Christoph Oelckers 9f8a5dae21 - scriptified A_BruisAttack.
- removed 'self' as a dedicated token. Internally this gets handled as a normal but implicitly named variable so the token just gets in the way of proper processing.
- removed P_ prefix from SpawnMissile export.
- fixed a crash with misnamed function exports.
2016-10-23 17:15:24 +02:00
Christoph Oelckers 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 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 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 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 61cc7dbb29 - another batch of Hexen items converted.
- fixed parsing of named damage types and pain chances.
2016-10-18 10:09:02 +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 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
Christoph Oelckers 76f1b9d3f8 - converted the raven actors. 2016-10-17 00:21:52 +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
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 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
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 905e44713f - deprecated A_SetUserVar family for ZSCRIPT due to its muddled semantics. Better use direct variable access which is a lot safer and also provides better error checking. 2016-10-14 09:32:45 +02: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 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
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 900644e465 Merge branch 'master' of https://github.com/rheit/zdoom into zscript 2016-10-12 12:43:56 +02: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 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 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
Christoph Oelckers 49f18c0a19 - renamed the symbol tables holding the tree nodes so that the code becomes clearer to read. Necessary because the unclear naming caused:
- fixed: The tree nodes for classes and struct members were stored in the global tree nodes table.
- sort variable declarations into their own list for processing.
2016-10-09 09:09:17 +02:00
Christoph Oelckers 6bad4809c1 - uncommendted constants.txt after finishing work on the constants creation code. 2016-10-08 22:20:38 +02:00
Christoph Oelckers 08f313d011 - implemented complete resolving of constants - both global and class-local.
This uses a different algorithm as the old implementation - instead of recursively resolving unknown symbols it will first collect all constants from all scopes and then process them in one operation, doing multiple passes over the list until no more constants can be resolved anymore.
2016-10-08 22:16:10 +02:00
Christoph Oelckers 04d4bda262 - converted all constants to enums and gave the enums names. 2016-10-07 18:09:28 +02:00
Christoph Oelckers 6487681736 - started porting constants.txt 2016-10-07 17:49:00 +02:00