ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.48k stars 801 forks source link

Hoosha: Clicking play gets stuck on level reset #12026

Open zanzlanz opened 1 year ago

zanzlanz commented 1 year ago

Describe the bug

SWF: https://zanzlanz.com/Games/Hoosha.swf Flash: https://zanzlanz.com/g/Hoosha Self-hosted: https://zanzlanz.com/g/Hoosha&Ruffle

Clicking the "play" on the main menu using the code code will cause the game to remain on the level reset frame (39), locking the game. Using any other valid code (z, for example) will activate the associated level properly.

I'll take a guess that this may be because _root.level is still undefined in only this situation, so gotoAndPlay("level" + level); fails to parse to "level1" in the current implementation.

Expected behavior

In the Flash version, clicking "play" with the code code will reset and proceed to frame labelled "level1", as hoped.

Affected platform

Desktop app

Operating system

Windows 10

Browser

Chrome 114

Additional information

No response

n0samu commented 1 year ago

This happens because the level variable is actually a text field variable, defined by the variablename field of DefineEditText 38, 123, and 127, which are placed on frames 4 and 38. The game jumps straight from frame 3 to frame 39, but Flash Player defines the variables set by the text fields in the intermediate frames, including the level variable.

Here is a minimal reproduction of this behavior: TextVarTimeline.zip

In this example, the lv variable is defined by a text field placed on frame 5, and we jump straight from frame 1 to frame 9. Yet Flash Player still defines the variable and the value is read successfully.

Lord-McSweeney commented 1 year ago

5431 should fix this- the issue is that we should instead be going from 1-2-3-4-5-6-7-8-9, instead of 1-9. However, that approach does have some performance penalties.

waspennator commented 2 months ago

Still a problem as of latest nightly.