If a button event had both a keyPress condition and another
condition:
on(release, keyPress "A") { }
these actions would not fire on click, because it would still
check if the key was down (which doesn't apply to clicks!)
Fixes#195.
A lot of the arithmetic ops were still using SWFv4 style coercion
(`Value::into_number_v1`) even though they use full ECMA-262
coercion in SWF5+. This would cause `undefined` to turn into 0
isntead of NaN, for example.
Fixes disappearing player in Achievement Unlocked
(https://www.newgrounds.com/portal/view/474371)
It's possible even the older ops such as ActionAdd should do this,
too. Handcrafted bytecode will need to be used to test as you
cannot export these ops in newer SWF versions from the Flash IDE.
ActionAnd, ActionOr, and ActionNot were incorrectly comparing
to 0. This only works for SWF<4. Now they all go through the
Value::as_bool method to handle version specific behavior.
Value::from_bool_v1 was also renamed to Value::from_bool.
Functions now store their base clip (the code that contains the
executing bytecode). This is because `GotoFrame` and other actions
will execute on the clip the bytecode exists on, not on `this`.
(Note that `this.gotoAndStop` uses `GetMember` actions, which
worked correctly).
`Activation` now stores `target_clip`, and `Avm1::target_clip` and
`target_clip_or_root` grab this from the current stack frame.
Renamed `start_clip` to `base_clip` to match Flash conventions.
Removed `active_clip` as this was superfluous. Now you can use
`Avm1::target_clip_or_root`.
`UpdateContext` no longer contains `target_clip` etc.
Add a check and clear the stack if it isn't empty at the end of
`run_stack_till_empty`. This is probably a bug on our side
and we a good place for breakpoints.
When running an clip event handler (e.g. onEnterFrame), a stack
frame is pushed to get the property value. However, this frame
was causing an extra Undefined to be pushed on the operand stack in
`Avm1::retire_stack_frame`, which would blow out the stack.
Now this stack frame is popped after the property is resolved and
before the function is executed. The function will push its own
stack frame when it executes.
This is a very rough stub out of Stage.width and height to get
basic V-cams to start functioning.
TODO: Implement the different stage scaling modes. We will probably
want to add a "Stage" display object to handle this.