Commit Graph

115 Commits

Author SHA1 Message Date
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 823c52aeb2 - scriptified the functions in a_possessed.cpp and added the needed exports and constants.
- fixed: Script functions did not receive the function name when being created.
- relaxed the asserts for PARAM_STATE, because the VM knows nothing about ATAG_STATE. Any state variable's content (e.g. Actor.SeeState) will receive ATAG_GENERIC, rather than ATAG_STATE.
- added a 'NeedResult' flag so that certain operations can create shorter code if the result of the expression is not needed. So far only used for postdecrement/increment statements on local variables (which is the most frequent case where this matters.)
- fixed postincrement and decrement for local variables. Due to the result preservation semantics it created faulty code.
2016-10-26 11:30:30 +02:00
Christoph Oelckers d714670acc - allow calling non-action functions directly from a state.
Ironically this only requires a very minor change in the calling code and an added member for the VMFunction to tell that code how many parameters to pass.
This change will allow to turn the vast majority of action functions into regular members, the only ones that still need to be an action function are the few that actually use the pointers.
2016-10-22 16:35:48 +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 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 b1a83bfd26 - started with cleanup and separation of DECORATE code.
* everything related to scripting is now placed in a subdirectory 'scripting', which itself is separated into DECORATE, ZSCRIPT, the VM and code generation.
 * a few items have been moved to different headers so that the DECORATE parser definitions can mostly be kept local. The only exception at the moment is the flags interface on which 3 source files depend.
2016-10-12 19:22:33 +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 65c6388d44 Merge branch 'master' into json 2016-09-19 03:54:36 +02:00
Christoph Oelckers f1ba19073f - split Damage into two variables: DamageVal for the old constant and DamageFunc for the DECORATE function.
The way this was done was a major headache inducer, requiring reconstruction of the function each time the value was changed and in general made actor damage a major hassle.
There was a DECORATE wrapper to mimic the original behavior but this looked quite broken because it completely ignored the different semantics of both damage calculation types.
It also made it impossible to determine if damage was a function or a value.
This accessor has been reverted to what it should be, only returning the constant, which now is -1 for a damage function. I am sorry if this may break the odd mod out but a quick look over some DECORATE-heavy stuff showed that this was never combined in any of them so that accessing 'damage' in DECORATE code depended on an actual damage function.

To get proper damage, a future commit will add a DECORATE function which calls AActor::GetMissileDamage.
2016-09-19 03:36:51 +02:00
Christoph Oelckers 718614a820 - cleanup 2016-09-19 01:07:51 +02:00
Christoph Oelckers cfaa3e3fa9 - changed action function interface so that callers can be identified directly, instead of guessing it from looking at the parameters.
With arbitrary PSP layers the old method was no longer safe because the layer ID was not available in the action function.
2016-06-16 16:16:27 +02:00
Christoph Oelckers 21b45fc0eb - fixed: distancecheck as a class property needs to be copied manually to subclasses. 2016-04-12 22:42:02 +02:00
Christoph Oelckers 6c9e5b03c8 - floatified meleerange, pushfactor and radiusdamagefactor, 2016-03-24 21:31:04 +01:00
Christoph Oelckers af427b80bd - did some cleanup and consolidation on damage factor code while converting it all to floating point.
- made armor properties floating point.
2016-03-22 16:35:41 +01:00
Christoph Oelckers cff8e51811 - converted AActor::height to double. 2016-03-20 20:55:06 +01:00
Christoph Oelckers 51b05d331d - replaced AActor::vel and player_t::Vel with a floating point version.
- Converted P_MovePlayer and all associated variables to floating point because this wasn't working well with a mixture between float and fixed.

Like the angle commit this has just been patched up to compile, the bulk of work is yet to be done.
2016-03-20 00:54:18 +01:00
Randy Heit 55142078d8 Normalize line endings 2016-03-01 09:47:10 -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 6adb069506 - rewrote p_local.h so that it doesn't pull in the entire bunch of headers.
This was to resolve some circular dependencies with the portal code.
The most notable changees:

 * FTextureID was moved from textures.h to doomtype.h because it is frequently needed in files that don't want to do anything with actual textures.
 * split off the parts from p_maputl into a separate header.
 * consolidated all blockmap related data into p_blockmap.h
 * split off the polyobject parts into po_man.h
2016-02-15 02:14:34 +01:00
Christoph Oelckers d1b2ef5368 - some refactoring of olddecorations.cpp to move some repeated code into a subfunction. 2016-02-10 14:38:08 +01:00
Christoph Oelckers 3358181f18 - cleaned up the class data organization:
* moved RestrictedToPlayerClass and ForbiddenToPlayerClass arrays to AInventory.
 * moved all copy-from-parent code into DeriveData functions.
2016-02-10 00:46:51 +01:00
Christoph Oelckers 6ce0c9f78e - split up PClass::Derive and its child functions because part of them is also needed when initializing an inherited native class with the properties of its parent - but calling the base version in PClass is not possible.
- moved a few AActor properties out of the EXE so that I could easily test if it works.
2016-02-10 00:17:00 +01:00
Christoph Oelckers b484cbf18a - fixed: It is not guaranteed that the class object that is created by FindClassTentative actually matches the real object that is required later, so it needs to be replaced wherever it could be referenced once the real object is created.
- removed some unneeded code from earlier attempts to fix the class type resolving issue.
2016-02-09 23:08:51 +01:00
Christoph Oelckers 4d2a52418f - added an errorlog option.
This cuts down on as much message noise as possible, outputs everything to a file specified as a parameter and then quits immediately, allowing this to run from a batch that's supposed to check a larger list of files for errors.
Multiple outputs get appended if the file already exists.
2016-02-09 14:20:49 +01:00
Edoardo Prezioso 002177e33f - Fixed alloc/dealloc mismatch in PClass code.
The function 'PClassActor::InitializeNativeDefault' is the only one which didn't allocate the 'Defaults' member variable with M_Malloc. Reported by the Address Sanitizer.
2016-02-05 03:03:34 +01:00
Christoph Oelckers 2e0f999fea Merge branch 'master' into scripting
Conflicts:
	src/p_effect.cpp
	src/p_effect.h
	src/p_local.h
	src/p_map.cpp
	src/thingdef/thingdef_codeptr.cpp
	wadsrc/static/actors/actor.txt
	wadsrc/static/actors/shared/inventory.txt
	zdoom.vcproj
2015-04-28 14:45:13 +02:00
Christoph Oelckers f7834061df Merge commit 'b6a4511dd1e74440fad99bc673c1f2b3680dba48' into scripting
Conflicts:
	src/dobjtype.cpp
	src/p_conversation.cpp
	src/p_local.h
	src/p_things.cpp
	src/thingdef/thingdef_properties.cpp

(This is just the conversationID to MAPINFO stuff to keep the conflicts as small as possible)
2015-04-28 13:08:18 +02:00
Christoph Oelckers 0474560ac6 Merge commit '2ec8e2c2ac61d30f7f1d666ec58ca0fd37e2e3b0' into scripting
Conflicts:
	src/d_main.cpp
	src/info.cpp
	src/p_local.h

(Had to merge this all by itself because it was creating too many merge conflicts when combined with other stuff.
2015-04-28 12:54:01 +02:00
Christoph Oelckers 065c0a79cd Merge commit '4f7ec3ad891d556c0d3f680e209a120ed38e9cdb' into scripting
Conflicts:
	src/d_main.cpp
	src/info.cpp
	src/info.h
	src/p_acs.cpp
	src/p_interaction.cpp
	src/p_mobj.cpp
	src/thingdef/thingdef_codeptr.cpp
	src/thingdef/thingdef_properties.cpp

(scripting branch update part 5)
2015-04-28 12:48:33 +02:00
Christoph Oelckers d6e3fc0567 Merge commit 'fb9231a38db2025eb77bfd246f36d985cbbccd2e' into scripting
Conflicts:
	src/info.cpp
	src/thingdef/thingdef_expression.cpp
	wadsrc/static/actors/constants.txt

(Scripting branch update part 2)
2015-04-28 09:57:01 +02:00
Christoph Oelckers b6a4511dd1 - move conversation ID definition to MAPINFO as well. Uses the newly added filter feature to handle the teaser differences. 2015-04-05 00:31:15 +02:00
Christoph Oelckers 2ec8e2c2ac - moved spawn ID definitions to MAPINFO as well and removed all 'Game' directives from DECORATE because editor and spawn numbers are the only thing that required them. 2015-04-04 00:39:09 +02:00
Christoph Oelckers 15dbbc9137 - set editor numbers through MAPINFO. The DECORATE way still works ans will override any definition made in MAPINFO.
- use a standard TMap for finding editor numbers
2015-04-03 16:51:45 +02:00
Christoph Oelckers ccd9fb9c23 - moved FDoomEdMap to its own file to make the upcoming changes a bit nicer to handle. 2015-04-03 10:54:55 +02:00
Christoph Oelckers 7789975b6c - reverted a few of Zzombo's changes. 2015-02-07 17:02:46 +01:00
ZzZombo 322742d4b1 - Fixed various instances of unused variables, accessing arrays out of bounds, initialization of non-primitive members in constructor's body, dead code, passing parameters by value instead of reference, usage of uninitialized variables, as reported by cppcheck. 2015-02-07 23:35:23 +08: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 f4e108552e - Fixed: pr_statetics must be named, since it's critical to sync.
SVN r3962 (trunk)
2012-11-10 03:36:30 +00:00
Randy Heit 955d929d5e - Ensure that only actor with positive SpawnIDs get added to the SpawnableThings map, so there will
be no conflicts with recently-added named arguments for spawnable things on UDMF maps.
- Change the SpawnableThings array into a map, so there is no longer any particular upper limit on an actor's SpawnID. Also fixes a possible exploit, since an actor's SpawnID was never checked to make sure it was within range.

SVN r3959 (trunk)
2012-11-09 23:53:58 +00:00
Randy Heit 35ba5b79d3 - Added a NULL Defaults check to PClassActor::PropagateMark().
SVN r3921 (scripting)
2012-10-29 00:42:58 +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 47eec0b275 - Added tracking of time spent specifically in running action functions. I feel kind of stupid
about this now. I spent three days trying to figure out why the VC++ debug version was so slow.
  It turns out I had a conditional breakpoint set in a high-traffic area. D'oh!

The rest of this stuff should get merged into trunk:

- Fixed: Writing to debugfile uses the standard fprintf, which does not understand %td on VC++.
- Fixed: Instead of crashing when a sprite has been scaled to 0, just don't draw it.

SVN r3896 (scripting)
2012-10-21 03:46:17 +00:00
Randy Heit e7efa1d802 - Update to latest version in trunk.
SVN r3890 (scripting)
2012-10-17 04:24:54 +00:00
Randy Heit 1c71c1dce1 - Added support for random state durations. Instead of defining a frame like this:
POSS A 10 A_Look
  You can define it as:
    POSS A random(10,20) A_Look
  and the state will last a random duration between 10 and 20 tics, inclusive.

SVN r3847 (trunk)
2012-08-23 01:00:30 +00:00
Randy Heit d2843c199e - Fixed: Pain flashes were not inheritable.
SVN r3779 (trunk)
2012-07-21 02:58:52 +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 562cf04db2 - Update scripting branch to trunk.
SVN r3758 (scripting)
2012-07-14 03:04:41 +00:00
Christoph Oelckers 26dbec2aae - added FDARI*s damagetype fix
SVN r3533 (trunk)
2012-04-07 15:29:47 +00:00
Christoph Oelckers 81eef71067 - added FDARI's Default/global damagetype properties submission.
SVN r3523 (trunk)
2012-04-07 12:11:17 +00:00
Randy Heit 9fcc6ebc89 - Fixed: Armor did not use damagefactor "Normal" as a fallback factor.
SVN r3469 (trunk)
2012-03-23 01:20:45 +00:00