aboutsummaryrefslogtreecommitdiff
path: root/engines/drascula/animation.cpp
diff options
context:
space:
mode:
authorDavid Turner2011-12-18 18:29:05 -0800
committerDavid Turner2011-12-18 18:29:05 -0800
commit538d83408091e9077f451f45c1ac1127f302b47d (patch)
treea8b3ffaf9199665b41e8f990549fc267c6421b46 /engines/drascula/animation.cpp
parentf0eee81d327957cddb85c5a1ffe7a308a377f636 (diff)
parentf722542ceea557e906699c60b10b3ace1f41c238 (diff)
downloadscummvm-rg350-538d83408091e9077f451f45c1ac1127f302b47d.tar.gz
scummvm-rg350-538d83408091e9077f451f45c1ac1127f302b47d.tar.bz2
scummvm-rg350-538d83408091e9077f451f45c1ac1127f302b47d.zip
Merge pull request #131 from digitall/goto_considered_harmful
Goto Considered Harmful... The following commits should improve the ScummVM code structure by reducing the number of gotos used in various engine code. They should implement identical functionality, but without using goto and without the result being less readable/maintainable than the version with goto.
Diffstat (limited to 'engines/drascula/animation.cpp')
-rw-r--r--engines/drascula/animation.cpp49
1 files changed, 30 insertions, 19 deletions
diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp
index c4a8d3eb01..43799f7944 100644
--- a/engines/drascula/animation.cpp
+++ b/engines/drascula/animation.cpp
@@ -748,6 +748,19 @@ void DrasculaEngine::animation_14_2() {
loadPic(99, backSurface);
}
+void DrasculaEngine::asco() {
+ loadPic(roomDisk, drawSurface3);
+ loadPic(roomNumber, bgSurface, HALF_PAL);
+ black();
+ updateRoom();
+ updateScreen();
+ fadeFromBlack(0);
+ if (roomMusic != 0)
+ playMusic(roomMusic);
+ else
+ stopMusic();
+}
+
// The drunk tells us about Von Braun
void DrasculaEngine::animation_16_2() {
debug(4, "animation_16_2()");
@@ -763,8 +776,10 @@ void DrasculaEngine::animation_16_2() {
else
playMusic(32);
- if (getScan() != 0)
- goto asco;
+ if (getScan() != 0) {
+ asco();
+ return;
+ }
color_abc(kColorDarkGreen);
@@ -778,16 +793,20 @@ void DrasculaEngine::animation_16_2() {
centerText(_texthis[i], 180, 180);
updateScreen();
- if (getScan() != 0)
- goto asco;
+ if (getScan() != 0) {
+ asco();
+ return;
+ }
delay(3000);
if (i < 4) {
fadeToBlack(1);
- if (getScan() != 0)
- goto asco;
+ if (getScan() != 0) {
+ asco();
+ return;
+ }
clearRoom();
}
@@ -800,25 +819,17 @@ void DrasculaEngine::animation_16_2() {
copyBackground(0, 0, 0, l, 320, 200 - l, drawSurface3, screenSurface);
copyBackground(0, 200 - l, 0, 0, 320, l, bgSurface, screenSurface);
updateScreen();
- if (getScan() != 0)
- goto asco;
+ if (getScan() != 0) {
+ asco();
+ return;
+ }
}
pause(5);
fadeToBlack(2);
clearRoom();
-asco:
- loadPic(roomDisk, drawSurface3);
- loadPic(roomNumber, bgSurface, HALF_PAL);
- black();
- updateRoom();
- updateScreen();
- fadeFromBlack(0);
- if (roomMusic != 0)
- playMusic(roomMusic);
- else
- stopMusic();
+ asco();
}
void DrasculaEngine::animation_20_2() {