ruffle-rs / ruffle

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

Toxic 2: BitmapData.threshold implementation quirk makes it impossible to progress past level 4 #17458

Open MinekPo1 opened 1 month ago

MinekPo1 commented 1 month ago

Describe the bug

Expected behavior

The holes are transparent and can be passed through

Content Location

http://www.nitrome.com/games/toxic2/

Affected platform

Desktop app

Operating system

GNU/Linux

Browser

N/A

Additional information

This appears to be caused by ruffle's implementation of BitmapData.threshold not supporting the sourceBitmap and original bitmap being the same (see #10055, the still commented out test case).

Decompiled code (in __Packages.com.nitrome.toxic.Game, decompiled with ffdec):

_global.ground_bmp.threshold(_global.ground_bmp,new flash.geom.Rectangle(x - 40,y - 40,80,80),new flash.geom.Point(x - 40,y - 40),"==",0xff00ff00,0,0x00ffffff,false);
Lord-McSweeney commented 1 month ago

Closing #3086 in favor of this.

torokati44 commented 1 month ago

I think we should do something like this in that method as well...? :thinking: https://github.com/ruffle-rs/ruffle/pull/3383/files#diff-1f00b5ed728f854636715b8e9b091b57ba868456715f3ad9bd8070b40f9f8e94R875-R899