Mark
7d5d97b0d6
Merge remote-tracking branch 'origin/master' into liquid_container
2016-05-01 19:43:10 +02:00
Lukas Werling
dd48a759d7
Add mathematical modulo helper function Mod(a, b)
2016-05-01 19:25:12 +02:00
Lukas Werling
60e9383a42
Improve seeding of UnsyncedRandomRng
2016-05-01 19:21:09 +02:00
Mark
b96b183007
Merge 'master' into liquid_container
2016-05-01 18:54:38 +02:00
Maikel de Vries
3907281933
fix script error when striking sword ( #1731 )
2016-05-01 16:54:05 +02:00
Mark
853af2c155
Merge 'master' into liquid_container
2016-05-01 08:43:05 +02:00
Günther Brammer
9741af42fd
Replace all usages of the old local variables list with properties
2016-05-01 00:28:37 +02:00
Günther Brammer
7792acdff0
Script: Check for functions before keywords
...
This unifies the lookup for local variables and functions. Its slightly
awkward that global functions can overload if and Par now, but local
variables already could.
2016-05-01 00:28:37 +02:00
Günther Brammer
30f7457d89
Remove unused macros leftover from removed script features
2016-05-01 00:28:37 +02:00
Günther Brammer
b8f2d0ca87
Script: Repeat the parser error message when executing a broken function
2016-05-01 00:28:37 +02:00
Günther Brammer
17b18da26c
Make bytecode dump work again
...
Dumping the bytecode before adding EOFN while depending on that to signal
the end isn't such a hot idea.
2016-05-01 00:28:37 +02:00
Maikel de Vries
f4ae76454b
rename player control callback for specified id's to silence warning
...
It is better to have different names for different callbacks.
2016-04-29 21:51:58 +02:00
Günther Brammer
904bf78d68
Don't crash when deserializing an effect with object command target ( #1730 )
2016-04-29 00:16:20 +02:00
Günther Brammer
4092911349
Move code generation into its own class
2016-04-28 03:25:47 +02:00
Günther Brammer
b00b8554ab
Merge branch script
2016-04-28 03:25:44 +02:00
Günther Brammer
d45ac946fe
Add C4AulParseError constructor and cease reusing it for warnings
...
The nontrivial code that formats the position is now a function of
C4AulParse used by both warnings and errors.
2016-04-28 02:59:12 +02:00
Nicolas Hake
a8f4bd3960
C4AulParseError: Avoid the second string parameter
...
While I'm not a big fan of hiding flow control in a function, Error()
handles formatting and saves me from calling FormatString().getData() a
lot.
2016-04-28 02:59:12 +02:00
Günther Brammer
4b43576f83
Script: Complain about some attempts to Call nonexistant function again
...
This code got lost in the function pointer rewrite.
2016-04-28 02:59:12 +02:00
Nicolas Hake
072661239d
GRBroadcast: Don't noisily fail when a callback function does not exist
...
Since GRBroadcast calls all goal and rule objects and the scenario,
there is a high likelyhood that not all of them implement whatever
arbitrary callback is called. Instead of throwing script errors about
calling undefined functions, just swallow that error and continue.
2016-04-28 02:59:12 +02:00
Günther Brammer
3760363a3b
Script: Add GetPrototype and SetPrototype functions
...
This should eventually replace the Prototype property, so that proplists
can be used as a key-value-storage without any hidden gotchas.
The Prototype is such a magical property that any code dealing with all
properties has to special-case it anyway, and isn't even returned by
GetProperties().
2016-04-28 02:59:11 +02:00
Günther Brammer
525cdc11a3
Deduplicate calculation of the relative stack position of local variables
2016-04-28 02:59:11 +02:00
Günther Brammer
071feaa78f
Deduplicate loop control handling in the script parser
2016-04-28 02:59:11 +02:00
Günther Brammer
d8e8d25ab4
Aul tests: CreateEffect
2016-04-28 02:59:11 +02:00
Günther Brammer
efd4724084
Script: Add Scenario effects
...
These work just like global effects, except that effects from CreateEffect
get the scenario as target parameter in the callbacks.
2016-04-28 02:53:21 +02:00
Günther Brammer
97406d24d2
Script: Add Construction and Destruction effect callbacks
2016-04-28 01:08:04 +02:00
Günther Brammer
50378ffda0
Script: CreateEffect starts effects that receive callbacks themselves
2016-04-28 01:08:04 +02:00
Maikel de Vries
08668ef988
do not reset last item for quick switch when selecting same slot twice
2016-04-27 21:15:37 +02:00
Lukas Werling
11904c0217
Fix Q doing nothing initially
...
Both the initial “selected” and “last” inventory slots were initialized
to 0, making Q useless. Many melees give more than one item to the
player, filling up from the first slot. Having Q switch to the second
slot initially is better than doing nothing, which will never happen
later on.
2016-04-27 19:02:54 +02:00
Maikel de Vries
3f085a0532
balance grenade launcher projectiles
...
Decrease their mass to prevent too much damage when having a direct hit plus explosion. Also decrease the impact of the iron bomb explosion a bit to make it less overpowered.
2016-04-25 21:27:22 +02:00
Maikel de Vries
f5a9412a35
clean up iron bomb and shrapnel scripts
2016-04-25 21:27:22 +02:00
Lukas Werling
c349254d8b
Remove C4Particles.h include from C4Object.h
...
This reduces the number of files indirectly including PCG from ~50 to 7.
2016-04-25 21:24:27 +02:00
Lukas Werling
e33066a4f2
Rename SafeRandom() to UnsyncedRandom()
2016-04-25 17:32:23 +02:00
Lukas Werling
e734f15117
Remove RNG implementation from C4Random.h
2016-04-25 17:28:04 +02:00
Lukas Werling
aeabe28d82
Remove AsyncRandom() script function
...
We couldn't think of any reason you'd want to use this over regular
Random() in script.
2016-04-25 17:18:07 +02:00
Maikel de Vries
92334f5f4c
take into account container velocity in shockwaves
...
This ensures reliable flint jumping when using dynamite, ironbomb, powderkeg, etc.
2016-04-24 20:33:44 +02:00
Günther Brammer
c167e990a5
Add GetName function to Actions
2016-04-24 19:40:29 +02:00
Günther Brammer
e5cfb1858f
Script: GetName() can return the property a proplist was defined in
...
This means that the ActMaps do not need to repeat their name anymore,
provided that all Scripts use GetName() instead of directly accessing .Name.
2016-04-24 19:40:29 +02:00
Günther Brammer
5a470f51f8
Move Effect functions to C4Script.cpp
2016-04-24 19:40:29 +02:00
Günther Brammer
2cdf553953
Change effect list getting function parameter type to C4PropList*
...
This makes it possible to move the effect functions to C4Script.cpp.
2016-04-24 19:40:29 +02:00
Günther Brammer
e8811a7b21
Move global effects from ::Game to ::ScriptEngine
...
This even enables some simplification in the CompileFuncs, since the global
effects were already put in the same section as the other ScriptEngine
parts. The callback for updates due to relinks also fits nicely.
The reset in C4Game::Default was redundant with C4Game::Clear already.
2016-04-24 19:40:28 +02:00
Günther Brammer
e2c6c2a841
Do not use C4Object in C4Effect
...
Instead, the pointer to the effect list is passed to the functions that
previously used the object to determine it.
2016-04-24 19:40:28 +02:00
Günther Brammer
c89e73608b
Unite getting the effects list from a C4Object pointer into a function
...
This way, that function can be re-implemented in standalone c4script.
2016-04-24 19:40:28 +02:00
Günther Brammer
42a15e3be9
Convert C4Effect parameters that do not need to be C4Object* to C4PropList*
2016-04-24 19:40:28 +02:00
Günther Brammer
bfb9b6b1fd
Drop the roundtrip through C4ID for the effect C4Def command target
...
Unfortunately, this complicates the C4Effect::CompileFunc to stay
compatible.
2016-04-24 19:40:27 +02:00
Günther Brammer
632c5cbd0f
Refactor effect callbacks into helper functions
2016-04-24 19:40:27 +02:00
Günther Brammer
e22ca51f72
Don't leak references to Strings on script errors ( #583 )
2016-04-24 19:40:27 +02:00
Günther Brammer
5fbac346d3
Incompatible type warnings work for parameters with type declarations
2016-04-24 19:40:27 +02:00
Günther Brammer
55572720bc
Make the C4ScriptHost a ComponentHost again
2016-04-24 19:40:27 +02:00
Günther Brammer
fb76308812
Make C4ValueConv::Type a constexpr variable instead of an inline function
2016-04-24 19:40:26 +02:00
Nicolas Hake
19a3d43558
Fix definition of explicitly sized enums
2016-04-24 15:20:28 +02:00