Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Luigi's Mansion silently stops working #1140

Closed
Toad06 opened this issue Sep 8, 2020 · 4 comments · Fixed by #9447
Closed

Luigi's Mansion silently stops working #1140

Toad06 opened this issue Sep 8, 2020 · 4 comments · Fixed by #9447

Comments

@Toad06
Copy link
Member

Toad06 commented Sep 8, 2020

Edit 2020-11-29:
The game now works but there's still an unexpected behavior - please see the tests in the comments below.


After the ghost has reached the top of the screen, a sound effect plays and then nothing else happens anymore.
No error and no warning in the console.

Expected (Flash Player):
expe

Game:
luigimansion.zip

@CUB3D
Copy link
Contributor

CUB3D commented Sep 27, 2020

This failing test case may be causing some of the issues here, it seems like something to do with the order of onEnterFrame or onDestroy calls but I'm not sure.

Test:
clip_destruction.zip

@Toad06
Copy link
Member Author

Toad06 commented Oct 14, 2020

Thanks for investigating this issue!
I've tested the file again and for some reason, the game just "works" if you remove some Destroy() calls (removeMovieClip). But that's weird.

IntroScreen.prototype.onEnterFrame = function()
{
   if(IntroKong0._y < 168)
   {
      IntroKong0.removemovieclip();
      _root.attachMovie("StartScreen","StartScreen0",1);
      this.Destroy(); // remove this
   }
};

=> Removing this allows the game to start but platforms won't be visible.

StartScreen.prototype.onEnterFrame = function()
{
   var _local1 = this;
   _local1.DelayCount = _local1.DelayCount + 1;
   if(35 < _local1.DelayCount)
   {
      _root.attachMovie("Level1","Level10",1);
      _local1.Destroy(); // remove this
   }
};

=> Also removing this allows platforms to be visible.

luigismansion_edit.zip

@Toad06
Copy link
Member Author

Toad06 commented Nov 23, 2020

So I think I've finally found out what's wrong here: attachMovie() and removeMovieClip() are changing the value of this in Flash.

I've made two samples based on your original test:
test_this.zip

function A()
{
}
function B()
{
}
A.prototype = new MovieClip();
Object.registerClass("A",A);
A.prototype.onEnterFrame = function()
{
   trace(this + " - " + typeof this);
   _root.attachMovie("B","B0",1);
   trace(this + " - " + typeof this);
   this.removeMovieClip();
   trace(this + " - " + typeof this);
};
B.prototype = new MovieClip();
Object.registerClass("B",B);
attachMovie("A","A0",1); // depth is 2 in test_differentdepth.swf

test_samedepth.swf

Flash traces:

_level0.A0 - movieclip
 - movieclip
 - movieclip

Ruffle traces:

_level0.A0 - movieclip
_level0.A0 - movieclip
_level0.A0 - movieclip

test_differentdepth.swf

Flash traces:

_level0.A0 - movieclip
_level0.A0 - movieclip
 - movieclip

Ruffle traces:

_level0.A0 - movieclip
_level0.A0 - movieclip
_level0.A0 - movieclip

Note that replacing all instances of this in the samples with _level0.A0 produces consistent results in Flash and Ruffle.

Trace in test_samedepth.swf

_level0.A0 - movieclip
undefined - undefined
undefined - undefined

Trace in test_differentdepth.swf

_level0.A0 - movieclip
_level0.A0 - movieclip
undefined - undefined

@Herschel
Copy link
Member

Sounds like another case of #993 -- after a clip is removed/overwritten, the object should go into a "removed" state and return undefined for all properties, and "" when coerced to a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants