Program: 163853
Project: 163853
Buggy source:
@Override public void create(){
  super.create();
  String loadingAsset;
  int loadingDepth;
  final float scrollSpeed;
switch (mode) {
default :
    loadingDepth=Dungeon.depth;
  scrollSpeed=0;
break;
case CONTINUE:
loadingDepth=GamesInProgress.check(GamesInProgress.curSlot).depth;
scrollSpeed=5;
break;
case DESCEND:
if (Dungeon.hero == null) loadingDepth=1;
 else loadingDepth=Dungeon.depth + 1;
scrollSpeed=5;
break;
case FALL:
loadingDepth=Dungeon.depth + 1;
scrollSpeed=100;
break;
case ASCEND:
loadingDepth=Dungeon.depth - 1;
scrollSpeed=-5;
break;
case RETURN:
loadingDepth=returnDepth;
scrollSpeed=returnDepth > Dungeon.depth ? 15 : -15;
break;
}
if (loadingDepth <= 5) loadingAsset=Assets.LOADING_SEWERS;
 else if (loadingDepth <= 10) loadingAsset=Assets.LOADING_PRISON;
 else if (loadingDepth <= 15) loadingAsset=Assets.LOADING_CAVES;
 else if (loadingDepth <= 21) loadingAsset=Assets.LOADING_CITY;
 else loadingAsset=Assets.LOADING_HALLS;
SkinnedBlock bg=new SkinnedBlock(Camera.main.width,Camera.main.height,loadingAsset){
@Override protected NoosaScript script(){
return NoosaScriptNoLighting.get();
}
@Override public void draw(){
Blending.disable();
super.draw();
Blending.enable();
}
@Override public void update(){
super.update();
offset(0,Game.elapsed * scrollSpeed);
}
}
;
bg.scale(4,4);
add(bg);
Image im=new Image(TextureCache.createGradient(0xAA000000,0xBB000000,0xCC000000,0xDD000000,0xFF000000)){
@Override public void update(){
super.update();
if (phase == Phase.FADE_IN) aa=Math.max(0,timeLeft - 0.6f);
 else if (phase == Phase.FADE_OUT) aa=Math.max(0,0.4f - (timeLeft));
 else aa=0;
}
}
;
im.angle=90;
im.x=Camera.main.width;
im.scale.x=Camera.main.height / 5f;
im.scale.y=Camera.main.width;
add(im);
String text=Messages.get(Mode.class,mode.name());
message=PixelScene.renderText(text,9);
message.x=(Camera.main.width - message.width()) / 2;
message.y=(Camera.main.height - message.height()) / 2;
align(message);
add(message);
phase=Phase.FADE_IN;
timeLeft=TIME_TO_FADE;
thread=new Thread(){
@Override public void run(){
try {
switch (mode) {
case DESCEND:
descend();
break;
case ASCEND:
ascend();
break;
case CONTINUE:
restore();
break;
case RESURRECT:
resurrect();
break;
case RETURN:
returnTo();
break;
case FALL:
fall();
break;
case RESET:
reset();
break;
}
if ((Dungeon.depth % 5) == 0) {
Sample.INSTANCE.load(Assets.SND_BOSS);
}
}
 catch (Exception e) {
error=e;
}
if (phase == Phase.STATIC && error == null) {
phase=Phase.FADE_OUT;
timeLeft=TIME_TO_FADE;
}
}
}
;
thread.start();
waitingTime=0f;
}

Fixed version (ground truth):
@Override public void create(){
  super.create();
  String loadingAsset;
  int loadingDepth;
  final float scrollSpeed;
switch (mode) {
default :
    loadingDepth=Dungeon.depth;
  scrollSpeed=0;
break;
case CONTINUE:
loadingDepth=GamesInProgress.check(GamesInProgress.curSlot).depth;
scrollSpeed=5;
break;
case DESCEND:
if (Dungeon.hero == null) loadingDepth=1;
 else loadingDepth=Dungeon.depth + 1;
scrollSpeed=5;
break;
case FALL:
loadingDepth=Dungeon.depth + 1;
scrollSpeed=100;
break;
case ASCEND:
loadingDepth=Dungeon.depth - 1;
scrollSpeed=-5;
break;
case RETURN:
loadingDepth=returnDepth;
scrollSpeed=returnDepth > Dungeon.depth ? 15 : -15;
break;
}
if (loadingDepth <= 5) loadingAsset=Assets.LOADING_SEWERS;
 else if (loadingDepth <= 10) loadingAsset=Assets.LOADING_PRISON;
 else if (loadingDepth <= 15) loadingAsset=Assets.LOADING_CAVES;
 else if (loadingDepth <= 21) loadingAsset=Assets.LOADING_CITY;
 else loadingAsset=Assets.LOADING_HALLS;
SkinnedBlock bg=new SkinnedBlock(Camera.main.width,Camera.main.height,loadingAsset){
@Override protected NoosaScript script(){
return NoosaScriptNoLighting.get();
}
@Override public void draw(){
Blending.disable();
super.draw();
Blending.enable();
}
@Override public void update(){
super.update();
offset(0,Game.elapsed * scrollSpeed);
}
}
;
bg.scale(4,4);
add(bg);
Image im=new Image(TextureCache.createGradient(0xAA000000,0xBB000000,0xCC000000,0xDD000000,0xFF000000)){
@Override public void update(){
super.update();
if (phase == Phase.FADE_IN) aa=Math.max(0,timeLeft - 0.6f);
 else if (phase == Phase.FADE_OUT) aa=Math.max(0,0.4f - (timeLeft));
 else aa=0;
}
}
;
im.angle=90;
im.x=Camera.main.width;
im.scale.x=Camera.main.height / 5f;
im.scale.y=Camera.main.width;
add(im);
String text=Messages.get(Mode.class,mode.name());
message=PixelScene.renderText(text,9);
message.x=(Camera.main.width - message.width()) / 2;
message.y=(Camera.main.height - message.height()) / 2;
align(message);
add(message);
phase=Phase.FADE_IN;
timeLeft=TIME_TO_FADE;
if (thread == null) {
thread=new Thread(){
@Override public void run(){
try {
switch (mode) {
case DESCEND:
descend();
break;
case ASCEND:
ascend();
break;
case CONTINUE:
restore();
break;
case RESURRECT:
resurrect();
break;
case RETURN:
returnTo();
break;
case FALL:
fall();
break;
case RESET:
reset();
break;
}
if ((Dungeon.depth % 5) == 0) {
Sample.INSTANCE.load(Assets.SND_BOSS);
}
}
 catch (Exception e) {
error=e;
}
if (phase == Phase.STATIC && error == null) {
phase=Phase.FADE_OUT;
timeLeft=TIME_TO_FADE;
}
}
}
;
thread.start();
}
waitingTime=0f;
}