ruffle-rs / ruffle

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

Bloons TD 3 - Cannot continue after winning #9941

Open danielhjacobs opened 1 year ago

danielhjacobs commented 1 year ago

Describe the bug

No option to continue when beating the final round (50 on easy), as no popup appears.

Expected behavior

There should be a popup saying: "Congratulations!!!" with options "OK" or "Keep Playing in Freeplay Mode"

Affected platform

Self-hosted version

Operating system

Windows 11

Browser

Chrome 110

Additional information

Version at https://www.kongregate.com/games/Ninjakiwi/bloons-tower-defense-3

n0samu commented 1 year ago

The same problem occurs when running the SWF in the Flash projector as a local file. Here is the relevant function:

        public function EndLevel() : *
        {
            var _loc1_:int = 0;
            ingame = false;
            trace("You win");
            ClearBullets();
            ClearBalloons();
            if(curLevel != 50)
            {
                startrnd_btn.visible = true;
                _loc1_ = 99 + curLevel;
                money += _loc1_;
                UpdateMoney();
                kongregate.stats.submit("HighestLevelComplete_" + diff + "_" + trackNum,curLevel);
                kongregate.stats.submit("HighestLevelComplete_" + diff,curLevel);
                kongregate.stats.submit("HighestLevelComplete",curLevel);
                Output("Round " + curLevel + " passed. " + _loc1_ + " money awarded. " + GetNextLevelHint());
            }
            else if(curLevel == 50)
            {
                kongregate.stats.submit("LivesLeft50_" + diff + "_" + trackNum,lives);
                kongregate.stats.submit("LivesLeft50_" + diff,lives);
                kongregate.stats.submit("LivesLeft50",lives);
                GameOver(true);
            }
        }

When the Kongregate API fails to load, any Kongregate API call (kongregate.stats.*) fails with this error: ERROR core/src/avm2/activation.rs:942 TypeError: Error #1010: A term is undefined and has no properties. (accessing field: stats) Thus anything that is supposed to happen after that does not occur. So you don't get the end-of-round messages or the Congratulations screen. In Ruffle, the Kongregate API fails to load on web due to CORS issues. The problem does not occur on the desktop app.