Commit Graph

55 Commits

Author SHA1 Message Date
ZZYZX 6f5fff00a0 Implemented static methods in String struct. Implemented String.Format and String.AppendFormat. Implemented native vararg methods for the future. 2017-01-21 10:32:26 +01:00
Christoph Oelckers 179b6e1a39 - added property definitions to the ZScript parser. This will allow defining custom properties for the default block in custom base classes. See 'Health' for an example.
- support transient object member variables for information that does not need to be put in a savegame.
- fixed: special initialization of objects needs to pass the proper defaults along, otherwise the parent classes will use their own, inappropriate one.
2017-01-15 16:55:30 +01:00
Christoph Oelckers f722967abe - added automatic type deduction capabilities for local variables. If you type 'let variable = value;' the type of 'variable' will be deduced from the given value. This is mostly of interest for type casting pointers, because 'let p = Classtype(objectvar);' does not require writing the class type name twice. 2016-12-05 13:24:42 +01:00
Christoph Oelckers 5ce5466e18 - scriptified hexenspecialdecs.
- made '->' a single token. Although ZScript does not use it, the parser tends to get confused and fatally chokes on leftover arrows so this ensures more robust error handling.
2016-11-27 20:14:43 +01:00
Christoph Oelckers 980c986305 - allow defining native fields through scripts. Internally this only requires exporting the address, but not the entire field.
- added new VARF_Transient flag so that the decision whether to serialize a field does not depend solely on its native status. It may actually make a lot of sense to use the auto-serializer for native fields, too, as this would eliminate a lot of maintenance code.
- defined (u)int8/16 as aliases to the byte and short types (Can't we not just get rid of this naming convention already...?)
- exporting the fields of Actor revealed a few name clashes between them and some global types, so Actor.Sector was renamed to CurSector and Actor.Inventory was renamed to Actor.Inv.
2016-11-22 19:20:31 +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
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 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 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 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 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 2b33601d00 - The fixed_t type for the VM also is not needed any longer and was removed. 2016-03-25 15:50:39 +01:00
Christoph Oelckers 3a598d672e - removed the angle_t type from the VM, now that nothing in the interface requires it anymore. 2016-03-25 14:55:01 +01:00
Randy Heit 964ff46063 Add new state options to parser and actually enable them
- Added new state options that DECORATE got to the lemon parser.
- Enable token generation for state options. They were previously not
  generated, so the grammar treated them as function calls instead.
2016-03-03 18:33:07 -06:00
Randy Heit 55142078d8 Normalize line endings 2016-03-01 09:47:10 -06:00
Randy Heit 326907f6ab Cleanup parsing of DECORATE intrinsics
- Split specific parsing for each intrinsic out of ParseExpression0 and
  into their own functions.
- Instead of reserving keywords for intrinsics, identify them by name
  within TK_Identifier's handling.
2016-02-23 19:39:29 -06:00
Randy Heit 1ffb7ad109 Add min and max to DECORATE 2016-02-23 16:26:00 -06:00
MaxED 1ba526d4de Added #region / #endregion handling (should affect all text lumps, let me know if there are text lumps unaffected by this). 2016-02-20 21:45:08 +01:00
Christoph Oelckers 6ebdf7396c Merge commit '8e0151b4c1b88eaf295042ea2d545a83b4b99acc' into scripting
Conflicts:
	src/sc_man_tokens.h
	src/thingdef/thingdef_exp.h
	src/thingdef/thingdef_expression.cpp

(Scripting branch update part 3)
2015-04-28 10:59:50 +02:00
Randy Heit 8e0151b4c1 Add FRandomPick
- This is RandomPick but for floats. Considering what RandomPick
  translates into in the scripting branch, I hope I don't regret not using
  type inference on RandomPick instead of creating a new keyword.
2015-02-20 17:52:52 -06:00
Randy Heit 775e33ede7 Merge branch 'master' into scripting
Conflicts:
	src/actor.h
	src/g_doom/a_archvile.cpp
	src/g_shared/a_morph.cpp
	src/p_enemy.h
	src/p_local.h
	src/p_mobj.cpp
	src/sc_man_tokens.h
	src/thingdef/thingdef_codeptr.cpp
	src/thingdef/thingdef_exp.h
	src/thingdef/thingdef_expression.cpp
	src/thingdef/thingdef_states.cpp
	wadsrc/static/actors/actor.txt
2015-01-29 20:53:08 -06:00
Randy Heit 3fb9e754f1 Rename 'Pick' to 'RandomPick'
... because 'pick' is way too generic a name to spend a keyword on.
2014-12-23 21:46:27 -06:00
Randy Heit b5e4153c78 Merge branch 'master' into gonesolong
Conflicts:
	src/CMakeLists.txt
	src/b_think.cpp
	src/g_doom/a_doomweaps.cpp
	src/g_hexen/a_clericstaff.cpp
	src/g_hexen/a_fighterplayer.cpp
	src/namedef.h
	src/p_enemy.cpp
	src/p_local.h
	src/p_mobj.cpp
	src/p_teleport.cpp
	src/sc_man_tokens.h
	src/thingdef/thingdef_codeptr.cpp
	src/thingdef/thingdef_function.cpp
	src/thingdef/thingdef_parse.cpp
	wadsrc/static/actors/actor.txt
	wadsrc/static/actors/constants.txt
	wadsrc/static/actors/shared/inventory.txt

- Added register reuse to VMFunctionBuilder for FxPick's code emitter.
- Note to self: Need to reimplement IsPointerEqual and CheckClass, which
  were added to thingdef_function.cpp over the past year, as this file no
  longer exists in this branch.
2014-12-21 21:15:11 -06:00
MajorCooke 785f72d6eb - Renamed RClamp to Pick. 2014-12-13 15:59:27 -06:00
MajorCooke 8c5a8c54f0 - Added rclamp(<int>,<int>).
- Usable for DECORATE expressions. Chooses one of the two numbers placed in the field.
2014-12-13 15:08:18 -06:00
Randy Heit 33344201fa Let the scanner returned unsigned integers
- The scanner already recognized the u suffix for unsigned integers, but
  otherwise ignored it. Return it as a proper token.
2013-09-10 21:40:05 -05:00
Randy Heit aec6aff7a8 Don't accept l as a suffix for floating point numbers in the scanner
- We're never going to support long doubles, so don't pretend.
2013-09-10 21:30:33 -05:00
Randy Heit 459ad5abff - Updated scripting branch to latest version in trunk.
SVN r4337 (scripting)
2013-06-07 03:31:30 +00:00
Randy Heit fb2f201c8b - Fixed: The sc_man scanner must use an unsigned character type, or it won't properly recognize any unquoted characters with the eighth bit set.
SVN r4179 (trunk)
2013-03-13 03:59:57 +00:00
Randy Heit 081ebbb64b - I have decided to opt for simplicity over C-like-ness and group array sizes with the rest
of the type declaration rather than split it up after the variable name.
- More AST work. At this rate, maybe I'll finally be building a complete AST by the end of the
  month!

SVN r2499 (scripting)
2010-08-10 04:25:52 +00:00
Randy Heit 7aa402b2a5 - Add a preliminary grammar and a test driver for it.
SVN r2233 (scripting)
2010-03-19 04:04:13 +00:00
Randy Heit f24c0cf292 - Merge scanner changes from the scripting branch, since I'm pretty sure the
token names were out of sync here, too.



SVN r2209 (trunk)
2010-03-14 04:03:07 +00:00
Randy Heit e489867c18 - Changed some tokens and split the token definitions into a separate file so
that their symbol names and their string names can be maintained in the same
  place.



SVN r2207 (scripting)
2010-03-13 03:28:34 +00:00
Randy Heit 19b23f2cf3 - Removed the Actor uservar array and replaced it with user-defined variables.
A_SetUserVar/SetUserVariable/GetUserVariable now take a variable name
  instead of an array index. A_SetUserArray/SetUserArray/GetUserArray
  have been added to access elements in user-defined arrays.


SVN r1933 (trunk)
2009-10-25 02:19:51 +00:00
Randy Heit e8d1416d81 - Added the frandom decorate function, which is exactly like random except
that it works with floating point instead of integers.


SVN r1797 (trunk)
2009-09-06 02:16:55 +00:00
Christoph Oelckers ba28749df7 - fixed: WIF_STAFF2_KICKBACK did not work anymore because it depended on conditions
that were changed some time ago.
- fixed: The damage inflictor for a rail attack was the shooter, not the puff.
- Fixed: Floor and ceiling huggers may not change their z-velocity when seeking.
- Fixed: UDMF set the secret sector flag before parsing the sector's properties,
  resulting in it always being false.
- Renamed sector's oldspecial variable to secretsector to better reflect its
  only use.
- Fixed: A_BrainSpit stored as the SpawnShot's target the intended BossTarget, 
  not itself contrarily to other projectile spawning functions. 
  A_SpawnFly then used the target for CopyFriendliness, thinking it'll be the 
  BossEye when in fact it wasn't.
- Added Gez's submission for a DEHACKED hack introduced by Boom.
  (using code pointers of the form 'Pointer 0 (x statenumber)'.
- fixed: Attaching 3DMidtex lines by sector tag did not work because lines
  were marked by index in the sector's line list but needed to be marked by
  line index in the global array.
- fixed: On Linux ZDoom was creating a directory called "~.zdoom" for 
  save files because of a missing slash.
- fixed: UDMF was unable to read floating point values in exponential format
  because the C Mode scanner was missing a definition for them.
- fixed: The recent changes for removing pointer aliasing got the end sequence
  info from an incorrect variable. To make this more robust the sequence index
  is now stored as a hexadecimal string to avoid storing binary data in a string.
  Also moved end sequence lookup from f_finale.cpp to the calling code so that
  the proper end sequences can be retrieved for secret exits, too.

SVN r1777 (trunk)
2009-08-30 10:43:51 +00:00
Christoph Oelckers 081658d3d5 - Fixed: The save percentage for Doom's green armor was slightly too low
which caused roundoff errors that made it less than 1/3 effective.
- Added support for "RRGGBB" strings to V_GetColor.
- Fixed: Desaturation maps for the TEXTURES lump were calculated incorrectly.
- Changed GetSpriteIndex to cache the last used sprite name so that the code
  using this function doesn't have to do it itself.
- Moved some more code for the state parser into p_states.cpp.
- Fixed: TDeletingArray should not try to delete NULL pointers.

SVN r1312 (trunk)
2008-12-07 12:11:59 +00:00
Christoph Oelckers b9afb78523 - Added native variables to expression evaluator and replaced the previous
handling of actor variables in expressions with it.
- Added support for floating point constants to DECORATE expression evaluator.

SVN r1271 (trunk)
2008-10-19 21:43:36 +00:00
Christoph Oelckers 65a19e4be7 - Changed the action function declaration parser so that optional parameters
can be given a default value. The 'optional' keyword is no longer needed
  and was removed, as well as 'evalnot'.


SVN r1164 (trunk)
2008-08-12 20:19:47 +00:00
Randy Heit e5572a1c4e - Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
  loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
  support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
  with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
  on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
  scope than before. The skipped entry is assumed to always be at 248, and
  it is assumed that all Shader Model 1.4 cards suffer from this. That's
  because all SM1.4 cards are based on variants of the ATI R200 core, and the
  RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
  other flavors of the R200 are any different. (Interesting note: With the
  Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
  debug Direct3D 9 runtime, but it works perfectly fine with the retail
  Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
  math inside pixel shaders. That would explain perfectly why I can't use
  constants greater than 1 with PS1.4 and why it can't do an exact mapping to
  every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
  "color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
  completely setup, meaning that Shader Model 1.4 cards could not change
  resolution.
- I have decided to let remap palettes specify variable alpha values for
  their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
  reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
  when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
  (Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
  gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
  unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
  being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
  accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
  multiple script scanner states can be stored without being forced to do so
  recursively. I think I might be taking advantage of that in the near
  future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
  * Fixed: When using even length values in drawnumber it would cap to a 98
    value instead of a 99 as intended.
  * The SBarInfo parser can now accept negatives for coordinates. This
    doesn't allow much right now, but later I plan to add better fullscreen
    hud support in which the negatives will be more useful. This also cleans
    up the source a bit since all calls for (x, y) coordinates are with the
    function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
  software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
  space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
  STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
  gets blended with the background, since that seems like a good idea for
  reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
  Since the ERenderStyle enumeration was getting rather unwieldy, I converted
  it into a new FRenderStyle structure that lets each parameter of the
  blending equation be set separately. This simplified the set up for the
  blend quite a bit, and it means a number of new combinations are available
  by setting the parameters properly.


SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
Christoph Oelckers ba6a3451db - Fixed 64 bit compile problem in sc_man_scanner.re.
SVN r596 (trunk)
2007-12-12 08:23:51 +00:00
Christoph Oelckers 912f8666d7 November 11, 2007 (Changes by Graf Zahl)
- Fixed: The FMOD stream player must specify whether it wants to play the
  sound looped or not when playback is started, not when the stream is created.
- Fixed: A_Saw didn't use the puff's damage type.
- Fixed: The AxeBlood's death state was using the wrong sprite frame.
- Fixed: The Mancubus had an attack sound defined even though it shouldn't.


SVN r565 (trunk)
2007-11-11 09:02:04 +00:00
Christoph Oelckers 8f6fdc1d21 - Split thingdef.cpp into several files so that the state and property code
no longer gets in the way of the main parser.
- Changed A_MissileAttack, A_MeleeAttack and A_ComboAttack so that they use
  metadata. Now all the hack code associated with these functions can be removed.


SVN r538 (trunk)
2007-05-28 22:18:51 +00:00
Christoph Oelckers 50f75b6e8a - Fixed: deadthings.txt contained a superfluous ';' which created parsing errors
with my changed code.
- Cleaned up DECORATE parser a little - moved the old style parsing code into its 
  own file and rearranged a few things.
- Made ProcessStates non-static so that it doesn't need to be passed as an argument
  to all functions in the DECORATE parser.
- Moved DECORATE parser files into their own subdirectory.
- Optimization: SC_GetToken no longer sets sc_name for identifiers. In most cases
  this creates needless overhead by adding a potentially unneeded name to the name
  table and looking up the name. In almost all cases where a name is needed it's as
  easy to assign sc_String to the name variable.
- Added enum definitions to DECORATE.


SVN r537 (trunk)
2007-05-28 14:46:49 +00:00
Christoph Oelckers 2345a1a5f0 - Fixed: The speed definition of PowerSpeed used PROP_SpeedFixed instead of
PROP_SpeedLong.
- Fixed: The Chainsaw's kickback was initialized to the default - not 0.


SVN r535 (trunk)
2007-05-27 12:16:43 +00:00
Randy Heit 24b5a0b110 - Finished the framework for specifying all action functions externally,
including restricting them to particular classes.

SVN r403 (trunk)
2006-12-04 23:25:59 +00:00
Christoph Oelckers a537d1a115 SVN r396 (trunk) 2006-11-29 11:14:40 +00:00
Randy Heit 4467cd6563 - Started adding action function declarations to objects.
- Added integer constant declarations to objects.
- Added some new token-based functions to sc_man.cpp that know about keywords
  and record proper type information, so parsers don't need to treat
  everything as strings.
- Added a simple symbol table to PClass.


SVN r394 (trunk)
2006-11-29 04:51:16 +00:00
Christoph Oelckers 8c2f651bdb - Replaced the static string buffer in ProcessStates with an FString.
- After doing some tests with state label scopes I had to conclude that
  using '.' both for separating sub-state-labels and scope resolution 
  identifiers does not work reliably unless all actor class names were
  prohibited from being used as state labels.  Since that is undesirable
  the only solution is to change the scope resolution operator. Fortunately 
  no WADs so far have used it so implementing such a breaking change isn't 
  a major issue. Now it uses '::', like C++ for this purpose.
- Converted Revenant, Mancubus and Pain Elemental to DECORATE.


SVN r375 (trunk)
2006-11-04 22:26:04 +00:00
Randy Heit 3b2c2efcb1 - Version bump to 2.1.7.
- Fixed: Placing a /* */ comment at the very end of a file without a
  terminating newline would not parse reliably.
- Added a NULL WallSpriteTile check to R_RenderDecal().


SVN r365 (trunk)
2006-10-31 00:47:05 +00:00