If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler
NEW : You can now close your own issues and reopen them later if needed. You can also comment closed issues.
List of issues#2723 another switch case statement not correctly decompiled
Author:
zsd2
zsd2Date created:
Type: bug
Visibility: Everybody
Assigned to:
State: new 

> What steps will reproduce the problem?
open home sheep home 2 lost in space(or lost underground, or lost in london, should have
the same issue)
> What is the expected output? What do you see instead?
in com.aardman.app.Game
in function switchActive, there is a switch-case statement shown as:
switch(switchClip.switchFunction)
{
case "boulder":
this.level.boulder.body.SetMassFromShapes();
case "reverse":
target.motor.SetMotorSpeed(-target.motorSpeed);
break;
case "rebound":
target.motor.SetMotorSpeed(-target.motor.GetMotorSpeed());
target.body.WakeUp();
break;
case "stop":
target.motor.SetMotorSpeed(0);
target.body.WakeUp();
if(target.isPortal)
{
Sounds.stop("rotationloop");
Sounds.clearAutoFade("rotationloop");
}
break;
case "forward":
target.motor.SetMotorSpeed(target.motorSpeed);
target.body.WakeUp();
this.cloudSpeed = 2;
break;
case "backward":
target.motor.SetMotorSpeed(-target.motorSpeed);
target.body.WakeUp();
this.cloudSpeed = -1;
break;
case "field":
this.setFieldActive(target,false);
break;
case "release":
target.body.SetMassFromShapes();
if(target.isFountain)
{
Sounds.play("fountainloop",true,0,undefined,0);
Sounds.autoFadeSound("fountainloop",[this.level.shirley,this.level.shaun,this.level.timmy]
,[this.level.fountainA.noisePoint,this.level.fountainB.noisePoint],250,0.75);
}
if(target.isPortal)
{
Sounds.play("portalrelease1");
}
break;
case "activate":
target.active = true;
if(this.farmer)
{
this.farmer.receivedShock();
}
break;
case "reset":
target.state = "hold";
if(this.level.lamp.currentLabel == "on")
{
Sounds.play("door" + this.levelDef.episode.toLowerCase());
}
this.level.lamp.gotoAndStop("off");
this.level.door.motor.SetMotorSpeed(-this.level.door.motorSpeed);
this.level.door.body.WakeUp();
break;
case "launch":
this.launchRocket();
break;
case "lights":
target.gotoAndStop("on");
Sounds.play("lightson");
TweenMax.to(this.level.hrHolder,10,{
"alpha":0,
"useFrames":true
});
break;
case "goto":
target.gotoAndStop(switchClip.value);
break;
case "trafficlights":
target.state = (target.state + 1) % 4;
switch(target.state)
{
case 0:
target.gotoAndStop("red");
break;
case 1:
target.gotoAndStop("redamber");
break;
case 2:
target.gotoAndStop("green");
if(!this.level.towtruck.away)
{
this.level.towtruck.away = true;
this.level.towtruck.body.SetMassFromShapes();
this.level.towtruck.backWheelMotor.SetMotorSpeed(-10);
this.level.towtruck.frontWheelMotor.SetMotorSpeed(-10);
this.level.towtruck.body.WakeUp();
Sounds.play("truckaway");
}
break;
case 3:
target.gotoAndStop("amber");
}
}
target.body.WakeUp();
according to game logic and p-code, the `target.body.WakeUp();` outside the switch-case
block should be in case "reverse":
switch(switchClip.switchFunction)
{
case "boulder":
this.level.boulder.body.SetMassFromShapes();
case "reverse":
target.motor.SetMotorSpeed(-target.motorSpeed);
target.body.WakeUp();
break;
case "rebound":
target.motor.SetMotorSpeed(-target.motor.GetMotorSpeed());
target.body.WakeUp();
break;
case "stop":
target.motor.SetMotorSpeed(0);
target.body.WakeUp();
if(target.isPortal)
{
Sounds.stop("rotationloop");
Sounds.clearAutoFade("rotationloop");
}
break;
case "forward":
target.motor.SetMotorSpeed(target.motorSpeed);
target.body.WakeUp();
this.cloudSpeed = 2;
break;
case "backward":
target.motor.SetMotorSpeed(-target.motorSpeed);
target.body.WakeUp();
this.cloudSpeed = -1;
break;
case "field":
this.setFieldActive(target,false);
break;
case "release":
target.body.SetMassFromShapes();
if(target.isFountain)
{
Sounds.play("fountainloop",true,0,undefined,0);
Sounds.autoFadeSound("fountainloop",[this.level.shirley,this.level.shaun,this.level.timmy]
,[this.level.fountainA.noisePoint,this.level.fountainB.noisePoint],250,0.75);
}
if(target.isPortal)
{
Sounds.play("portalrelease1");
}
break;
case "activate":
target.active = true;
if(this.farmer)
{
this.farmer.receivedShock();
}
break;
case "reset":
target.state = "hold";
if(this.level.lamp.currentLabel == "on")
{
Sounds.play("door" + this.levelDef.episode.toLowerCase());
}
this.level.lamp.gotoAndStop("off");
this.level.door.motor.SetMotorSpeed(-this.level.door.motorSpeed);
this.level.door.body.WakeUp();
break;
case "launch":
this.launchRocket();
break;
case "lights":
target.gotoAndStop("on");
Sounds.play("lightson");
TweenMax.to(this.level.hrHolder,10,{
"alpha":0,
"useFrames":true
});
break;
case "goto":
target.gotoAndStop(switchClip.value);
break;
case "trafficlights":
target.state = (target.state + 1) % 4;
switch(target.state)
{
case 0:
target.gotoAndStop("red");
break;
case 1:
target.gotoAndStop("redamber");
break;
case 2:
target.gotoAndStop("green");
if(!this.level.towtruck.away)
{
this.level.towtruck.away = true;
this.level.towtruck.body.SetMassFromShapes();
this.level.towtruck.backWheelMotor.SetMotorSpeed(-10);
this.level.towtruck.frontWheelMotor.SetMotorSpeed(-10);
this.level.towtruck.body.WakeUp();
Sounds.play("truckaway");
}
break;
case 3:
target.gotoAndStop("amber");
}
}
> What version of the product are you using? Is it "nightly build"? Which operating system
do you have?
26.2.1, not nightly build
windows 10
> Please provide any additional information below. If the problem is related to a SWF
file, attach it here, otherwise we can't help you.
homesheephome2lostinspace.zip (11,662 KiB)