Open FynnFreyer opened 2 years ago
Thanks for the report.
The issue is around these lines in \DefineSprite (157)\frame 1\PlaceObject2 (134) Depth: 5 (arms)\onClipEvent(load)
:
onClipEvent(load){
if(_root.setListen != true)
{
click = new Object();
click.onMouseDown = function()
{
trace(this._currentframe);
trace(_currentframe);
if(_currentframe == 1)
{
// code to shoot an arrow...
}
...
_currentframe
always holds a value of 1 in Flash Player, but on Ruffle the value changes to 3 when reaching the second level.
It appears the game was partially working in nightly-2021-10-13 and the older releases (it's possible to shoot arrows in the second level but there are other issues related to #5492), so it seems like the commit e9fbed7be0d33e47fe5cc522fc468ebbdfc4a2bf (PR #5465) introduced a regression.
@Herschel, maybe you have an idea of what's going on here?
Yes, when you e.g. play on addictinggames.com (nightly 2021-04-04) there is another issue with the bow (position doesn't update anymore). Just as an example of it 'working' in an older release.
Addictinggames is where I initially found this project btw, but I thought just mentioning my test with the newest nightly version might be better for clarity.
PS: Even though this might not be the right place, thanks a lot for putting work into this. I have many fond memories of old flash games, and this project helps keeping those available!
5$ bounty: https://app.bountysource.com/issues/110151502-champion-archer-bow-not-working-after-first-level
Edit: While the bounty still stands, I do regret making it, per this blog post
Thanks for the report.
The issue is around these lines in
\DefineSprite (157)\frame 1\PlaceObject2 (134) Depth: 5 (arms)\onClipEvent(load)
:onClipEvent(load){ if(_root.setListen != true) { click = new Object(); click.onMouseDown = function() { trace(this._currentframe); trace(_currentframe); if(_currentframe == 1) { // code to shoot an arrow... } ...
_currentframe
always holds a value of 1 in Flash Player, but on Ruffle the value changes to 3 when reaching the second level.
It’s not so much that it stays at 3, but rather it stays at the last frame of the animation at the time of you releasing the primary mouse button when ending the level (you’ll notice that you begin to shoot as you press “Continue” if you hold the button).
If you again recall the ghost arrows being shot in the old nightlies that you mentioned, that is the reason why.
On latest nightly, the issue is no longer that _currentframe
is incorrect, but rather that _parent
, referenced inside the code to shoot an arrow is set incorrectly. This happens because _root.warriors.champ
gets removed when opening the shop window, and when the shop window is closed and a new level started, a new champ
is created and added to the same path. However, the Avm1Function.base_clip
of the set onMouseDown
function still references the old champ, which is avm1_removed
. It seems that Avm1Function.base_clip
needs to be a string path, which will be resolved every time a function is executed. This ties in with #9447/#5492.
This is also probably what was behind the issues in earlier versions before the regression.
Describe the bug
Steps to reproduce
SWF file
Champion Archer
Visual problems
None
Expected behavior
When you finish the first level, you can still use your bow afterwards.
Affected platform
Desktop app and browser demo
Operating system
Ubuntu 20.04
Browser
Firefox 96.0 (64-bit) on Ubuntu
Additional information
I did test this in the online demo and with the desktop app (linux-x86_64)