Commit graph

80 commits

Author SHA1 Message Date
Randy Heit
55142078d8 Normalize line endings 2016-03-01 09:47:10 -06:00
Randy Heit
e7b9e7e955 Rename A_Int/A_Bool/A_State to int/bool/state
- This is an effort to emphasize that these are just type casts. Now they
  look like function-style casts with no action function styling.
  They do no magic joojoo at all. The only reason they exist is because
  the DECORATE parser can only parse return statements that call a
  function, so these satisfy that requirement. i.e. *return int(666);* is
  identical to *return 666;* (if the parser could handle the latter).
2016-02-20 22:05:17 -06:00
Randy Heit
5e298173f7 Redo ACTION_RETURN macros so they can be treated like return statements 2016-02-20 21:34:58 -06:00
Randy Heit
b2ccd0bd28 Use action function return value to make state jumps happen
- The A_Jump family of action functions now return the state to jump
  to (NULL if no jump is to be taken) instead of jumping directly.
  It is the caller's responsibility to handle the jump. This will
  make it possible to use their results in if statements and
  do something other than jump.
- DECORATE return statements can now return the result of a function
  (but not any random expression--it must be a function call). To
  make a jump happen from inside a multi-action block, you must
  return the value of an A_Jump function. e.g.:
    { return A_Jump(128, "SomeState"); }
- The VMFunction class now contains its prototype instead of storing
  it at a higher level in PFunction. This is so that
  FState::CallAction can easily tell if a function returns a state.
- Removed the FxTailable class because with explicit return
  statements, it's not useful anymore.
2016-02-18 20:39:40 -06:00
Christoph Oelckers
d25455736a - store floating point parameters for DECORATE properties as doubles. 2016-02-12 01:21:29 +01:00
Randy Heit
8cb269388e Eliminate .mreg section
- Member variables are now declared all in one place: InitThingdef(). They
  are not partially defined in thingdef_expression.cpp and further refined
  in actor.txt.
- This left ParseNativeVariable() parsing only functions, so it has been
  renamed to ParseNativeFunction().
- Note that their declarations in InitThingdef() are expected to be
  temporary.
2015-03-14 22:16:05 -05:00
Randy Heit
649875b17e Add if/else blocks for action sequences
- So now you can do something like this for an action:
    {
      if (health > 1000)
      {
        A_Scream;
      }
      else
      {
        A_XScream;
      }
    }
  Yes, the braces are required. Because I see too many instances where
  somebody writes an if statement in ACS and doesn't understand why it
  doesn't work right because they forgot braces.
- Fixed: Not actually putting an action between { and } would crash.
2015-01-08 21:36:42 -06:00
Randy Heit
7d0faa5bd5 Allow multiple actions per frame
- You can now call several actions from one frame by grouping them between
  curly braces. i.e. :
   POSS G 3 { A_Pain; A_Log("Ow! That hurt!"); }
  I will probably add an `if (something) { blah; blah; } else { wah; wah; }`
  construct later, but that's the extent of the munging I plan for DECORATE. The
  real work goes to the scripting language, not here. But if this branch is
  getting merged to master sooner than later, here's an immediate benefit
  from it right now.
2015-01-07 22:42:03 -06:00
Randy Heit
00274c5e4c Split action parsing out of ParseStates() and into ParseAction() 2015-01-06 20:02:22 -06:00
Randy Heit
8c105ff3a0 Use FxVMFunctionCall in FStateTempCall
- Leveraging FxVMFunctionCall simplifies FinishThingdef() slightly.
2015-01-03 22:45:11 -06:00
Randy Heit
c6c2b21901 Add FxVMFunctionCall class
- This replaces the general extensibility that had existed formerly
  in thingdef_function.cpp. Parameter parsing for function calls is
  shared with state parameter parsing. Functions are defined exactly in
  the same way as action functions, but without the 'action' keyword.
2014-12-30 23:31:07 -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
alexey.lysiuk
0a5dd94072 Fixed whole program (link-time) optimization build with Clang 2014-08-03 12:20:30 +03:00
Christoph Oelckers
3e4678765b Merge branch 'master' into scripting
Conflicts:
	src/actor.h
	src/thingdef/thingdef_codeptr.cpp
2013-08-18 12:18:59 +02:00
Randy Heit
5fe5fe7c51 Merge branch 'scripting' of github.com:rheit/zdoom into scripting 2013-08-14 22:15:28 -05:00
Randy Heit
cf87d0f1e9 Use PFunction instead of PSymbolActionFunction in DECORATE parser 2013-08-14 22:00:16 -05:00
Christoph Oelckers
61c94648dc - added ACS CheckFlag function. 2013-08-12 22:38:52 +02:00
Christoph Oelckers
bba092cc0b Merge branch 'master' into scripting
Conflicts:
	src/d_player.h
	src/g_doom/a_archvile.cpp
	src/thingdef/thingdef.h
	src/thingdef/thingdef_properties.cpp
2013-08-09 13:03:28 +02:00
Edoardo Prezioso
0dc70f847c - Be more compatible with C++11 narrowing conversions system. 2013-07-31 12:27:54 +02:00
Randy Heit
4a1fbdb32a Remove all state expression/param stuff
- This all became vestigial code after the relevant information was all
  moved into FStateTempCall. Now that the MBF code pointer code has been
  converted, I can be sure it wasn't still used anywhere.
2013-07-27 22:34:44 -05:00
Randy Heit
070c0a9e30 Stop leaking function damage expressions.
- Function damage expressions parsed from DECORATE are now stored in a
  single array and deleted at the end of FinishThingdef().
2013-07-25 21:42:30 -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
9072c25e65 - Added a big-endian fix for actor flag fields that aren't four bytes wide.
SVN r4251 (trunk)
2013-05-05 00:01:51 +00:00
Randy Heit
0e19a0e330 - Added a NODELAY state flag. This is only valid for a state immediately following a Spawn label.
When set, the actor will run this state during its first tick. This means Spawn
  states may now run an action function if you set this flag. Note that this action function
  is executed during the actor's first tick, which is not the same as when it is spawned.

SVN r4240 (trunk)
2013-04-30 04:20:09 +00:00
Braden Obrzut
dcb1a3c8bd - GCC warning cleanup
SVN r4031 (trunk)
2013-01-21 22:30:30 +00:00
Randy Heit
6e88529324 - Added a RETI instruction for returning 15-bit signed immediate values.
- Changed Actor's Damage property into an actual function. All access to the damage property
  must now be done through GetMissileDamage. actor->GetMissileDamage(0, 1) is equivalent
  to the former actor->Damage, for the case where actor->Damage was not an expression. (I
  suppose I will probably need to make a thunk for DECORATE expressions that want to read it.)
- Cleaned up some decorate expression evaluation functions that are no longer used.

SVN r3919 (scripting)
2012-10-28 04:36:52 +00:00
Randy Heit
e7efa1d802 - Update to latest version in trunk.
SVN r3890 (scripting)
2012-10-17 04:24:54 +00:00
Randy Heit
27f6d431ca - Trying to replace an actor that does not exist is now a warning rather than an error.
SVN r3820 (trunk)
2012-08-12 03:36:49 +00:00
Randy Heit
fcceeb814a - Changed state calls to use the VM's standard return value mechanism. StateCallData has been
removed as a result, so now action functions take a minimum of three parameters rather than four.

SVN r3770 (scripting)
2012-07-17 05:31:41 +00:00
Randy Heit
d85604da19 - Update scripting branch to latest version of trunk.
SVN r3767 (scripting)
2012-07-17 02:53:53 +00:00
Randy Heit
fdc6a03125 - Remove Item from StateCallData, since it isn't read anywhere.
SVN r3766 (trunk)
2012-07-15 23:00:16 +00:00
Randy Heit
562cf04db2 - Update scripting branch to trunk.
SVN r3758 (scripting)
2012-07-14 03:04:41 +00:00
Christoph Oelckers
7356350d5c - fixed: having a state immediately followed label with a goto immediately following that label did not link the state to its proper next state.
SVN r3661 (trunk)
2012-05-17 11:16:20 +00:00
Randy Heit
0fae305224 - Fixed: A_LookEx did not default to a 180 degree cone.
SVN r3655 (trunk)
2012-05-15 22:05:14 +00:00
Christoph Oelckers
b044c134d3 - fixed ammo usage issues with Dehacked modified weapons that switch attack code pointers. Unless Dehacked specifies an 'ammo use' value for a weapon any Dehacked modified weapon determines ammo use by attack function, like Doom did originally, and not by the weapon's AmmoUse property. This also addresses that the Cells/BFG shot value always modified the BFG itself.
- fixed: A_Saw depleted ammo after the attack so it still went through with it, even though it was out of ammo.


SVN r3522 (trunk)
2012-04-07 11:33:35 +00:00
Christoph Oelckers
f69181f851 - added FDARI's latest actor pointer submission.
SVN r3222 (trunk)
2011-06-07 23:05:24 +00:00
Christoph Oelckers
770a879f6a - fixed: The TouchedActors array in the Dehacked parser was not freed after parsing was done.
- Initialize the alt HUD explicitly in D_DoomMain.
- don't let S_UnloadReverbDef leave a broken list of sound environments behind.
- Added more code to explicitly delete data before initializing it.

SVN r3039 (trunk)
2010-12-15 00:09:31 +00:00
Randy Heit
99670b708c - Sync scripting branch with what was in trunk on Sunday. I believe that would be revision 2739.
SVN r2790 (scripting)
2010-09-16 03:14:32 +00:00
Christoph Oelckers
2cf19f436a - added Gez's dumpactors patch.
SVN r2463 (trunk)
2010-07-26 17:10:43 +00:00
Randy Heit
604b5ef673 - Removed the old meta data system. All meta data is now stored in subclasses of PClass. This
should simplify scripting, since it means that meta fields can be treated (mostly) the same as
  normal fields.

SVN r2242 (scripting)
2010-03-25 20:38:00 +00:00
Randy Heit
f88f601230 - Removed the third parameter from dumpclasses when it was restricted it to Actors, because
I have no idea what that was all about.
- Got rid of FActorInfo and merged it into a new PClassActor.

SVN r2240 (scripting)
2010-03-24 02:49:37 +00:00
Randy Heit
6f1bf257e9 - State code now properly calls action functions and has a RET instruction. As expected,
running with the checked VM can be quite slow, since it has asserts everywhere. Some other
  fixes were needed before the code actually worked:
  - A_CallSpecial needs to have its arguments cast to ints.
  - Some functions that set pnum/paramnum directly did not decrement it by 1. This also applies
    to A_Jump, though it just uses the value of paramnum instead of changing it.
  - Renamed pnum in the PARAM macros to paramnum, since pnum is already used in a few other
    places for something different, so this makes searching for it easier.
  This has not been tested especially thoroughly, but a first glance seems to indicate success.

SVN r2163 (scripting)
2010-02-14 19:59:21 +00:00
Randy Heit
739e684549 - Converted all action functions be directly callable by the VM (though they are not yet
usable).

SVN r2154 (scripting)
2010-02-12 06:04:57 +00:00
Randy Heit
85cc335725 - Added dummy code generation for states that pass parameters to action functions.
Currently, they're only good for disassembly and pasting into a proper text editor
  for viewing.
- Fixed some problems with the FxExpression emitters that were revealed by actually
  using them on the standard actors.

SVN r1911 (scripting)
2009-10-15 03:58:23 +00:00
Randy Heit
1eb7912bd8 - Make the autosegs read-only.
- Derive PClass from dobject.cpp. This has one major ramification: Since the PClass
  is not allocated until runtime, you cannot initialize any static/global data
  structures with pointers to PClasses using RUNTIME_CLASS. Attempting to do so
  will just initialize with a NULL pointer. Instead, you can initialize using
  the address of the pointer returned by RUNTIME_CLASS and dereference that. By
  the time you have an opportunity to dereference it, it will no longer be NULL.
- Sync CmakeLists.txt.
- Random fixes for problems GCC spotted.

SVN r1852 (scripting)
2009-09-17 01:36:14 +00:00
Christoph Oelckers
ea8c94d637 - Fixed: Argument count for UsePuzzleItem was wrong.
- Added more things from Gez's experimental build:
  * MBF grenade and bouncing code.
  * Arch Vile ghosts emulation (only for compatibility.txt.)
  * Several MBF related compatibility options.



SVN r1821 (trunk)
2009-09-14 20:47:53 +00:00
Christoph Oelckers
238d4c3fac - More things from Gez's experimental build:
* info CCMD to print extended actor information (not fully implemented yet)
  * summonmbf CCMD.
  * Beta BFG code pointer (but not the related missiles yet.)
  * PowerInvisibility enhancements.
  * ScoreItem with one significant change: Added a score variable that can be
    checked through ACS and DECORATE. The engine itself will do nothing with it.
  * Nailgun option for A_Explode.
  * A_PrintBold and A_Log.
  * A_SetSpecial.


SVN r1819 (trunk)
2009-09-14 19:44:14 +00:00
Christoph Oelckers
356e4a0fcc - Added A_Mushroom compatibility option for Dehacked.
- Added Gez's submission for interhubamount DECORATE property.


SVN r1747 (trunk)
2009-08-02 15:54:34 +00:00
Randy Heit
93202a5488 - Removed -fno-strict-aliasing from the GCC flags for ZDoom and fixed the
issues that caused its inclusion. Is an optimized GCC build any faster
  for being able to use strict aliasing rules? I dunno. It's still slower
  than a VC++ build.
  
  I did run into two cases where TAutoSegIterator caused intractable problems
  with breaking strict aliasing rules, so I removed the templating from it,
  and the caller is now responsible for casting the probe value from void *.
- Removed #include "autosegs.h" from several files that did not need it
  (in particular, dobject.h when not compiling with VC++).


SVN r1743 (trunk)
2009-08-02 03:38:57 +00:00
Randy Heit
e4af82ae96 - Enough with this "momentum" garbage. What Doom calls "momentum" is really
velocity, and now it's known as such. The actor variables momx/momy/momz
  are now known as velx/vely/velz, and the ACS functions GetActorMomX/Y/Z
  are now known as GetActorVelX/Y/Z. For compatibility, momx/momy/momz will
  continue to work as aliases from DECORATE. The ACS functions, however,
  require you to use the new name, since they never saw an official release
  yet.


SVN r1689 (trunk)
2009-06-30 20:57:51 +00:00