diff options
author | Eugene Sandulenko | 2008-05-31 08:09:34 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2008-05-31 08:09:34 +0000 |
commit | 46fce5ff50f1c907bb137f3b898cbb70d4b34332 (patch) | |
tree | 48bd13fd2609086279655107ce8ac4eabe1e6cb1 /engines/drascula | |
parent | d05600d22821862c73ed9c17829bd9af3deb6b0e (diff) | |
download | scummvm-rg350-46fce5ff50f1c907bb137f3b898cbb70d4b34332.tar.gz scummvm-rg350-46fce5ff50f1c907bb137f3b898cbb70d4b34332.tar.bz2 scummvm-rg350-46fce5ff50f1c907bb137f3b898cbb70d4b34332.zip |
Replace evil gotos with proper do-while loops.
svn-id: r32414
Diffstat (limited to 'engines/drascula')
-rw-r--r-- | engines/drascula/talk.cpp | 941 |
1 files changed, 435 insertions, 506 deletions
diff --git a/engines/drascula/talk.cpp b/engines/drascula/talk.cpp index 1f139c11c6..18e5c4d03b 100644 --- a/engines/drascula/talk.cpp +++ b/engines/drascula/talk.cpp @@ -76,31 +76,29 @@ void DrasculaEngine::talk_igor_dch(const char *said, const char *filename) { talkInit(filename); -bucless: + do { + face = _rnd->getRandomNumber(7); - face = _rnd->getRandomNumber(7); - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - updateRefresh_pre(); + updateRefresh_pre(); - placeIgor(); - placeDrascula(); - copyBackground(x_igor + 17, y_igor, x_igor + 17, y_igor, 37, 24, drawSurface1, screenSurface); + placeIgor(); + placeDrascula(); + copyBackground(x_igor + 17, y_igor, x_igor + 17, y_igor, 37, 24, drawSurface1, screenSurface); - copyRect(x_talk[face], 148, x_igor + 17, y_igor, 25, 24, frontSurface, screenSurface); + copyRect(x_talk[face], 148, x_igor + 17, y_igor, 25, 24, frontSurface, screenSurface); - updateRefresh(); + updateRefresh(); - if (withVoices == 0) - centerText(said, x_igor + 26, y_igor); + if (withVoices == 0) + centerText(said, x_igor + 26, y_igor); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - pause(3); + pause(3); - if (!isTalkFinished(&length)) - goto bucless; + } while (!isTalkFinished(&length)); copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); placeIgor(); @@ -123,36 +121,34 @@ void DrasculaEngine::talk_dr_izq(const char *said, const char *filename) { talkInit(filename); -bucless: + do { + face = _rnd->getRandomNumber(7); - face = _rnd->getRandomNumber(7); - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - updateRefresh_pre(); + updateRefresh_pre(); - placeIgor(); - placeDrascula(); - if (num_ejec == 6) - pon_hare(); + placeIgor(); + placeDrascula(); + if (num_ejec == 6) + pon_hare(); - copyBackground(x_dr, y_dr, x_dr, y_dr, 38, 31, drawSurface1, screenSurface); - if (num_ejec == 6) - copyRect(x_talk[face], 90, x_dr, y_dr, 38, 31, drawSurface2, screenSurface); - else - copyRect(x_talk[face], 90, x_dr, y_dr, 38, 31, backSurface, screenSurface); + copyBackground(x_dr, y_dr, x_dr, y_dr, 38, 31, drawSurface1, screenSurface); + if (num_ejec == 6) + copyRect(x_talk[face], 90, x_dr, y_dr, 38, 31, drawSurface2, screenSurface); + else + copyRect(x_talk[face], 90, x_dr, y_dr, 38, 31, backSurface, screenSurface); - updateRefresh(); + updateRefresh(); - if (withVoices == 0) - centerText(said, x_dr + 19, y_dr); + if (withVoices == 0) + centerText(said, x_dr + 19, y_dr); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - pause(3); + pause(3); - if (!isTalkFinished(&length)) - goto bucless; + } while (!isTalkFinished(&length)); copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); placeIgor(); @@ -175,35 +171,33 @@ void DrasculaEngine::talk_dr_dch(const char *said, const char *filename) { talkInit(filename); -bucless: - - face = _rnd->getRandomNumber(7); + do { + face = _rnd->getRandomNumber(7); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - updateRefresh_pre(); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + updateRefresh_pre(); - placeIgor(); - placeDrascula(); - if (num_ejec == 6) - pon_hare(); + placeIgor(); + placeDrascula(); + if (num_ejec == 6) + pon_hare(); - copyBackground(x_dr, y_dr, x_dr, y_dr, 45, 31, drawSurface1, screenSurface); - if (num_ejec != 6) - copyRect(x_talk[face], 58, x_dr + 7, y_dr, 38, 31, backSurface, screenSurface); - else - copyRect(x_talk[face], 58, x_dr + 7, y_dr, 38, 31, drawSurface2, screenSurface); + copyBackground(x_dr, y_dr, x_dr, y_dr, 45, 31, drawSurface1, screenSurface); + if (num_ejec != 6) + copyRect(x_talk[face], 58, x_dr + 7, y_dr, 38, 31, backSurface, screenSurface); + else + copyRect(x_talk[face], 58, x_dr + 7, y_dr, 38, 31, drawSurface2, screenSurface); - updateRefresh(); + updateRefresh(); - if (withVoices == 0) - centerText(said, x_dr + 19, y_dr); + if (withVoices == 0) + centerText(said, x_dr + 19, y_dr); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - pause(3); + pause(3); - if (!isTalkFinished(&length)) - goto bucless; + } while (!isTalkFinished(&length)); if (num_ejec == 6) updateRoom(); @@ -228,20 +222,17 @@ void DrasculaEngine::talk_solo(const char *said, const char *filename) { if (num_ejec == 6) copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); -bucless: - - if (withVoices == 0) { - if (num_ejec == 1) - centerText(said, 156, 90); - else if (num_ejec == 6) - centerText(said, 213, 72); - else if (num_ejec == 5) - centerText(said, 173, 92); - } - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - - if (!isTalkFinished(&length)) - goto bucless; + do { + if (withVoices == 0) { + if (num_ejec == 1) + centerText(said, 156, 90); + else if (num_ejec == 6) + centerText(said, 213, 72); + else if (num_ejec == 5) + centerText(said, 173, 92); + } + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + } while (!isTalkFinished(&length)); if (num_ejec == 6) { copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); @@ -264,33 +255,30 @@ void DrasculaEngine::talk_igor_front(const char *said, const char *filename) { talkInit(filename); -bucless: - - face = _rnd->getRandomNumber(7); + do { + face = _rnd->getRandomNumber(7); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - - updateRefresh_pre(); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - if (num_ejec == 1 || num_ejec == 4) - placeIgor(); - if (num_ejec == 1) - placeDrascula(); - if (num_ejec == 1 || num_ejec == 6) - copyBackground(x_igor, y_igor, x_igor, y_igor, 29, 25, drawSurface1, screenSurface); - copyRect(x_talk[face], 173, x_igor, y_igor, 29, 25, frontSurface, screenSurface); + updateRefresh_pre(); - updateRefresh(); + if (num_ejec == 1 || num_ejec == 4) + placeIgor(); + if (num_ejec == 1) + placeDrascula(); + if (num_ejec == 1 || num_ejec == 6) + copyBackground(x_igor, y_igor, x_igor, y_igor, 29, 25, drawSurface1, screenSurface); + copyRect(x_talk[face], 173, x_igor, y_igor, 29, 25, frontSurface, screenSurface); - if (withVoices == 0) - centerText(said, x_igor + 26, y_igor); + updateRefresh(); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, x_igor + 26, y_igor); - pause(3); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (!isTalkFinished(&length)) - goto bucless; + pause(3); + } while (!isTalkFinished(&length)); if (num_ejec == 6) { updateRoom(); @@ -319,35 +307,33 @@ void DrasculaEngine::talk_bartender(const char *said, const char *filename) { talkInit(filename); -bucless: - - if (num_ejec == 1) { - if (musicStatus() == 0) - playMusic(roomMusic); - } else if (num_ejec == 2) { - if (musicStatus() == 0 && flags[11] == 0 && roomMusic != 0) - playMusic(roomMusic); - } + do { + if (num_ejec == 1) { + if (musicStatus() == 0) + playMusic(roomMusic); + } else if (num_ejec == 2) { + if (musicStatus() == 0 && flags[11] == 0 && roomMusic != 0) + playMusic(roomMusic); + } - face = _rnd->getRandomNumber(8); + face = _rnd->getRandomNumber(8); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - updateRefresh_pre(); + updateRefresh_pre(); - copyBackground(x_talk[face], 2, 121, 44, 21, 24, extraSurface, screenSurface); - pon_hare(); - updateRefresh(); + copyBackground(x_talk[face], 2, 121, 44, 21, 24, extraSurface, screenSurface); + pon_hare(); + updateRefresh(); - if (withVoices == 0) - centerText(said, 132, 45); + if (withVoices == 0) + centerText(said, 132, 45); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - pause(3); + pause(3); - if (!isTalkFinished(&length)) - goto bucless; + } while (!isTalkFinished(&length)); updateRoom(); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -368,39 +354,37 @@ void DrasculaEngine::talk_bj(const char *said, const char *filename) { talkInit(filename); -bucless: - if (num_ejec != 5) { - face = _rnd->getRandomNumber(4); + do { + if (num_ejec != 5) { + face = _rnd->getRandomNumber(4); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - updateRefresh_pre(); + updateRefresh_pre(); - copyBackground(x_bj + 2, y_bj - 1, x_bj + 2, y_bj - 1, 27, 40, - drawSurface1, screenSurface); + copyBackground(x_bj + 2, y_bj - 1, x_bj + 2, y_bj - 1, 27, 40, + drawSurface1, screenSurface); - copyRect(x_talk[face], 99, x_bj + 2, y_bj - 1, 27, 40, - drawSurface3, screenSurface); - pon_hare(); - updateRefresh(); + copyRect(x_talk[face], 99, x_bj + 2, y_bj - 1, 27, 40, + drawSurface3, screenSurface); + pon_hare(); + updateRefresh(); - if (withVoices == 0) - centerText(said, x_bj + 7, y_bj); - - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, x_bj + 7, y_bj); - pause(3); - } else { - updateRoom(); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (withVoices == 0) - centerText(said, 93, 80); + pause(3); + } else { + updateRoom(); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - } + if (withVoices == 0) + centerText(said, 93, 80); - if (!isTalkFinished(&length)) - goto bucless; + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + } + } while (!isTalkFinished(&length)); updateRoom(); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -449,80 +433,77 @@ void DrasculaEngine::talk(const char *said, const char *filename) { talkInit(filename); -bucless: + do { + face = _rnd->getRandomNumber(5); - face = _rnd->getRandomNumber(5); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + updateRefresh_pre(); + if (num_ejec == 2) + copyBackground(hare_x, hare_y, OBJWIDTH + 1, 0, ancho_hare, alto_talk - 1, screenSurface, drawSurface3); + else + copyBackground(hare_x, hare_y, OBJWIDTH + 1, 0, (int)(((float)ancho_hare / 100) * factor_red[hare_y + alto_hare]), + (int)(((float)(alto_talk - 1) / 100) * factor_red[hare_y + alto_hare]), + screenSurface, drawSurface3); - updateRefresh_pre(); - if (num_ejec == 2) - copyBackground(hare_x, hare_y, OBJWIDTH + 1, 0, ancho_hare, alto_talk - 1, screenSurface, drawSurface3); - else - copyBackground(hare_x, hare_y, OBJWIDTH + 1, 0, (int)(((float)ancho_hare / 100) * factor_red[hare_y + alto_hare]), - (int)(((float)(alto_talk - 1) / 100) * factor_red[hare_y + alto_hare]), - screenSurface, drawSurface3); - - pon_hare(); - - if (num_ejec == 2) { - if (!strcmp(menuBackground, "99.alg") || !strcmp(menuBackground, "994.alg")) - copyBackground(OBJWIDTH + 1, 0, hare_x, hare_y, ancho_hare, alto_talk - 1, drawSurface3, screenSurface); - } else { - copyBackground(OBJWIDTH + 1, 0, hare_x, hare_y, (int)(((float)ancho_hare / 100) * factor_red[hare_y + alto_hare]), - (int)(((float)(alto_talk - 1) / 100) * factor_red[hare_y + alto_hare]), - drawSurface3, screenSurface); - } + pon_hare(); - if (sentido_hare == 0) { - if (num_ejec == 2) - copyRect(x_talk_izq[face], y_mask_talk, hare_x + 8, hare_y - 1, ancho_talk, alto_talk, + if (num_ejec == 2) { + if (!strcmp(menuBackground, "99.alg") || !strcmp(menuBackground, "994.alg")) + copyBackground(OBJWIDTH + 1, 0, hare_x, hare_y, ancho_hare, alto_talk - 1, drawSurface3, screenSurface); + } else { + copyBackground(OBJWIDTH + 1, 0, hare_x, hare_y, (int)(((float)ancho_hare / 100) * factor_red[hare_y + alto_hare]), + (int)(((float)(alto_talk - 1) / 100) * factor_red[hare_y + alto_hare]), + drawSurface3, screenSurface); + } + + if (sentido_hare == 0) { + if (num_ejec == 2) + copyRect(x_talk_izq[face], y_mask_talk, hare_x + 8, hare_y - 1, ancho_talk, alto_talk, extraSurface, screenSurface); - else - reduce_hare_chico(x_talk_izq[face], y_mask_talk, hare_x + (int)((8.0f / 100) * factor_red[hare_y + alto_hare]), + else + reduce_hare_chico(x_talk_izq[face], y_mask_talk, hare_x + (int)((8.0f / 100) * factor_red[hare_y + alto_hare]), hare_y, ancho_talk, alto_talk, factor_red[hare_y + alto_hare], extraSurface, screenSurface); - updateRefresh(); - } else if (sentido_hare == 1) { - if (num_ejec == 2) - copyRect(x_talk_dch[face], y_mask_talk, hare_x + 12, hare_y, ancho_talk, alto_talk, + updateRefresh(); + } else if (sentido_hare == 1) { + if (num_ejec == 2) + copyRect(x_talk_dch[face], y_mask_talk, hare_x + 12, hare_y, ancho_talk, alto_talk, extraSurface, screenSurface); - else - reduce_hare_chico(x_talk_dch[face], y_mask_talk, hare_x + (int)((12.0f / 100) * factor_red[hare_y + alto_hare]), + else + reduce_hare_chico(x_talk_dch[face], y_mask_talk, hare_x + (int)((12.0f / 100) * factor_red[hare_y + alto_hare]), hare_y, ancho_talk, alto_talk, factor_red[hare_y + alto_hare], extraSurface, screenSurface); - updateRefresh(); - } else if (sentido_hare == 2) { - if (num_ejec == 2) - copyRect(x_talk_izq[face], y_mask_talk, hare_x + 12, hare_y, ancho_talk, alto_talk, + updateRefresh(); + } else if (sentido_hare == 2) { + if (num_ejec == 2) + copyRect(x_talk_izq[face], y_mask_talk, hare_x + 12, hare_y, ancho_talk, alto_talk, frontSurface, screenSurface); - else - reduce_hare_chico(x_talk_izq[face], y_mask_talk, + else + reduce_hare_chico(x_talk_izq[face], y_mask_talk, suma_1_pixel + hare_x + (int)((12.0f / 100) * factor_red[hare_y + alto_hare]), hare_y, ancho_talk, alto_talk, factor_red[hare_y + alto_hare], frontSurface, screenSurface); - updateRefresh(); - } else if (sentido_hare == 3) { - if (num_ejec == 2) - copyRect(x_talk_dch[face], y_mask_talk, hare_x + 8, hare_y, ancho_talk, alto_talk, + updateRefresh(); + } else if (sentido_hare == 3) { + if (num_ejec == 2) + copyRect(x_talk_dch[face], y_mask_talk, hare_x + 8, hare_y, ancho_talk, alto_talk, frontSurface, screenSurface); - else - reduce_hare_chico(x_talk_dch[face], y_mask_talk, + else + reduce_hare_chico(x_talk_dch[face], y_mask_talk, suma_1_pixel + hare_x + (int)((8.0f / 100) * factor_red[hare_y + alto_hare]), hare_y, ancho_talk,alto_talk, factor_red[hare_y + alto_hare], frontSurface, screenSurface); - updateRefresh(); - } - - if (withVoices == 0) - centerText(said, hare_x, hare_y); + updateRefresh(); + } - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, hare_x, hare_y); - pause(3); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (!isTalkFinished(&length)) - goto bucless; + pause(3); + } while (!isTalkFinished(&length)); updateRoom(); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -548,28 +529,25 @@ void DrasculaEngine::talk_pianist(const char *said, const char *filename) { talkInit(filename); -bucless: + do { + face = _rnd->getRandomNumber(3); - face = _rnd->getRandomNumber(3); - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - - updateRefresh_pre(); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - copyBackground(x_talk[face], 139, 228, 112, 47, 60, - extraSurface, screenSurface); - pon_hare(); - updateRefresh(); + updateRefresh_pre(); - if (withVoices == 0) - centerText(said, 221, 128); + copyBackground(x_talk[face], 139, 228, 112, 47, 60, + extraSurface, screenSurface); + pon_hare(); + updateRefresh(); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, 221, 128); - pause(3); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (!isTalkFinished(&length)) - goto bucless; + pause(3); + } while (!isTalkFinished(&length)); updateRoom(); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -604,27 +582,24 @@ bebiendo: talkInit(filename); -bucless: - - face = _rnd->getRandomNumber(7); + do { + face = _rnd->getRandomNumber(7); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - - updateRefresh_pre(); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - copyBackground(x_talk[face], 29, 177, 50, 19, 19, frontSurface, screenSurface); - pon_hare(); - updateRefresh(); + updateRefresh_pre(); - if (withVoices == 0) - centerText(said, 181, 54); + copyBackground(x_talk[face], 29, 177, 50, 19, 19, frontSurface, screenSurface); + pon_hare(); + updateRefresh(); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, 181, 54); - pause(3); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (!isTalkFinished(&length)) - goto bucless; + pause(3); + } while (!isTalkFinished(&length)); updateRoom(); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -660,29 +635,26 @@ void DrasculaEngine::talk_vb(const char *said, const char *filename) { copyBackground(vb_x + 5, 64, OBJWIDTH + 1, 0, 25, 27, drawSurface1, drawSurface3); -bucless: + do { + if (sentido_vb == 1) { + face = _rnd->getRandomNumber(5); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - if (sentido_vb == 1) { - face = _rnd->getRandomNumber(5); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + pon_hare(); + pon_vb(); - pon_hare(); - pon_vb(); - - copyBackground(OBJWIDTH + 1, 0, vb_x + 5, 64, 25, 27, drawSurface3, screenSurface); - copyRect(x_talk[face], 34, vb_x + 5, 64, 25, 27, frontSurface, screenSurface); - updateRefresh(); - } - - if (withVoices == 0) - centerText(said, vb_x, 66); + copyBackground(OBJWIDTH + 1, 0, vb_x + 5, 64, 25, 27, drawSurface3, screenSurface); + copyRect(x_talk[face], 34, vb_x + 5, 64, 25, 27, frontSurface, screenSurface); + updateRefresh(); + } - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, vb_x, 66); - pause(3); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (!isTalkFinished(&length)) - goto bucless; + pause(3); + } while (!isTalkFinished(&length)); updateRoom(); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -703,15 +675,14 @@ void DrasculaEngine::talk_vbpuerta(const char *said, const char *filename) { talkInit(filename); -bucless: + do { + updateRoom(); - updateRoom(); - if (withVoices == 0) - centerText(said, 150, 80); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, 150, 80); - if (!isTalkFinished(&length)) - goto bucless; + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + } while (!isTalkFinished(&length)); updateRoom(); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -738,38 +709,36 @@ void DrasculaEngine::talk_blind(const char *said, const char *filename, const ch pos_blind[4] = 126; pos_blind[5] = 149; -bucless: - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - pos_blind[5] = 149; - char c = toupper(sincronia[p]); - - if (c == '0' || c == '2' || c == '4' || c == '6') - pos_blind[0] = 1; - else - pos_blind[0] = 132; - - if (c == '0' || c == '1') - num_cara = drawSurface3; - else if (c == '2' || c == '3') - num_cara = extraSurface; - else if (c == '4' || c == '5') - num_cara = backSurface; - else { - num_cara = frontSurface; - pos_blind[5] = 146; - } + do { + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + pos_blind[5] = 149; + char c = toupper(sincronia[p]); - copyRectClip( pos_blind, num_cara, screenSurface); + if (c == '0' || c == '2' || c == '4' || c == '6') + pos_blind[0] = 1; + else + pos_blind[0] = 132; + + if (c == '0' || c == '1') + num_cara = drawSurface3; + else if (c == '2' || c == '3') + num_cara = extraSurface; + else if (c == '4' || c == '5') + num_cara = backSurface; + else { + num_cara = frontSurface; + pos_blind[5] = 146; + } - if (withVoices == 0) - centerText(said, 310, 71); + copyRectClip( pos_blind, num_cara, screenSurface); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - pause(2); - p++; + if (withVoices == 0) + centerText(said, 310, 71); - if (!isTalkFinished(&length)) - goto bucless; + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + pause(2); + p++; + } while (!isTalkFinished(&length)); } void DrasculaEngine::talk_hacker(const char *said, const char *filename) { @@ -782,13 +751,11 @@ void DrasculaEngine::talk_hacker(const char *said, const char *filename) { talkInit(filename); -bucless: - if (withVoices == 0) - centerText(said, 156, 170); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - - if (!isTalkFinished(&length)) - goto bucless; + do { + if (withVoices == 0) + centerText(said, 156, 170); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + } while (!isTalkFinished(&length)); } void DrasculaEngine::talk_wolf(int index) { @@ -806,27 +773,24 @@ void DrasculaEngine::talk_wolf(const char *said, const char *filename) { talkInit(filename); -bucless: + do { + face = _rnd->getRandomNumber(8); - face = _rnd->getRandomNumber(8); - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - - updateRefresh_pre(); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - copyBackground(x_talk[face], 136, 198, 81, 26, 24, drawSurface3, screenSurface); - pon_hare(); - updateRefresh(); + updateRefresh_pre(); - if (withVoices == 0) - centerText(said, 203, 78); + copyBackground(x_talk[face], 136, 198, 81, 26, 24, drawSurface3, screenSurface); + pon_hare(); + updateRefresh(); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, 203, 78); - pause(3); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (!isTalkFinished(&length)) - goto bucless; + pause(3); + } while (!isTalkFinished(&length)); updateRoom(); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -847,27 +811,25 @@ void DrasculaEngine::talk_mus(const char *said, const char *filename) { talkInit(filename); -bucless: - - face = _rnd->getRandomNumber(7); + do { + face = _rnd->getRandomNumber(7); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - updateRefresh_pre(); + updateRefresh_pre(); - copyBackground(x_talk[face], 156, 190, 64, 18, 24, drawSurface3, screenSurface); - pon_hare(); - updateRefresh(); + copyBackground(x_talk[face], 156, 190, 64, 18, 24, drawSurface3, screenSurface); + pon_hare(); + updateRefresh(); - if (withVoices == 0) - centerText(said, 197, 64); + if (withVoices == 0) + centerText(said, 197, 64); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - pause(3); + pause(3); - if (!isTalkFinished(&length)) - goto bucless; + } while (!isTalkFinished(&length)); updateRoom(); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -888,27 +850,24 @@ void DrasculaEngine::talk_pen(const char *said, const char *filename) { talkInit(filename); -bucless: - - face = _rnd->getRandomNumber(7); - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + do { + face = _rnd->getRandomNumber(7); - updateRefresh_pre(); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - copyRect(x_talk[face], 145, 145, 105, 25, 29, drawSurface3, screenSurface); + updateRefresh_pre(); - updateRefresh(); + copyRect(x_talk[face], 145, 145, 105, 25, 29, drawSurface3, screenSurface); - if (withVoices == 0) - centerText(said, 160, 105); + updateRefresh(); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, 160, 105); - pause(3); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (!isTalkFinished(&length)) - goto bucless; + pause(3); + } while (!isTalkFinished(&length)); flags[1] = 0; copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); @@ -927,27 +886,24 @@ void DrasculaEngine::talk_pen2(const char *said, const char *filename) { talkInit(filename); -bucless: - - face = _rnd->getRandomNumber(4); - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + do { + face = _rnd->getRandomNumber(4); - updateRefresh_pre(); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - copyBackground(x_talk[face], 171, 173, 116, 25, 28, drawSurface3, screenSurface); + updateRefresh_pre(); - updateRefresh(); + copyBackground(x_talk[face], 171, 173, 116, 25, 28, drawSurface3, screenSurface); - if (withVoices == 0) - centerText(said, 195, 107); + updateRefresh(); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, 195, 107); - pause(3); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (!isTalkFinished(&length)) - goto bucless; + pause(3); + } while (!isTalkFinished(&length)); flags[1] = 0; copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); @@ -970,27 +926,24 @@ void DrasculaEngine::talk_taber2(const char *said, const char *filename) { talkInit(filename); -bucless: - - face = _rnd->getRandomNumber(5); - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + do { + face = _rnd->getRandomNumber(5); - updateRefresh_pre(); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - copyBackground(x_talk[face], 130, 151, 43, 21, 24, drawSurface3, screenSurface); - pon_hare(); - updateRefresh(); + updateRefresh_pre(); - if (withVoices == 0) - centerText(said, 132, 45); + copyBackground(x_talk[face], 130, 151, 43, 21, 24, drawSurface3, screenSurface); + pon_hare(); + updateRefresh(); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, 132, 45); - pause(3); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (!isTalkFinished(&length)) - goto bucless; + pause(3); + } while (!isTalkFinished(&length)); updateRoom(); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -1011,28 +964,25 @@ void DrasculaEngine::talk_bj_bed(const char *said, const char *filename) { talkInit(filename); -bucless: - - face = _rnd->getRandomNumber(4); - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + do { + face = _rnd->getRandomNumber(4); - updateRefresh_pre(); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - copyBackground(65, 103, 65, 103, 49, 38, drawSurface1, screenSurface); - copyRect(x_talk[face], 105, 65, 103, 49, 38, drawSurface3, screenSurface); - pon_hare(); - updateRefresh(); + updateRefresh_pre(); - if (withVoices == 0) - centerText(said, 104, 102); + copyBackground(65, 103, 65, 103, 49, 38, drawSurface1, screenSurface); + copyRect(x_talk[face], 105, 65, 103, 49, 38, drawSurface3, screenSurface); + pon_hare(); + updateRefresh(); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, 104, 102); - pause(3); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (!isTalkFinished(&length)) - goto bucless; + pause(3); + } while (!isTalkFinished(&length)); updateRoom(); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -1054,30 +1004,27 @@ void DrasculaEngine::talk_htel(const char *said, const char *filename) { talkInit(filename); -bucless: + do { + face = _rnd->getRandomNumber(2); + pantalla = _rnd->getRandomNumber(2); - face = _rnd->getRandomNumber(2); - pantalla = _rnd->getRandomNumber(2); - - if (face == 0 && pantalla == 0) - num_cara = (char *)drawSurface3; - else if (pantalla == 1) - num_cara = (char *)frontSurface; - else - num_cara = (char *)backSurface; - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + if (face == 0 && pantalla == 0) + num_cara = (char *)drawSurface3; + else if (pantalla == 1) + num_cara = (char *)frontSurface; + else + num_cara = (char *)backSurface; - copyBackground(x_talk[face], 1, 45, 24, 92, 108, (byte *)num_cara, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - if (withVoices == 0) - centerText(said, 90, 50); + copyBackground(x_talk[face], 1, 45, 24, 92, 108, (byte *)num_cara, screenSurface); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - pause(3); + if (withVoices == 0) + centerText(said, 90, 50); - if (!isTalkFinished(&length)) - goto bucless; + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + pause(3); + } while (!isTalkFinished(&length)); copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -1102,68 +1049,65 @@ void DrasculaEngine::talk_sinc(const char *said, const char *filename, const cha talkInit(filename); -bucless: - - face = atoi(&sincronia[p]); + do { + face = atoi(&sincronia[p]); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - updateRefresh_pre(); - if (num_ejec == 2) - copyBackground(hare_x, hare_y, OBJWIDTH + 1, 0, ancho_hare, alto_talk - 1, screenSurface, drawSurface3); - else - copyBackground(hare_x, hare_y, OBJWIDTH + 1, 0, (int)(((float)ancho_hare / 100) * factor_red[hare_y + alto_hare]), + updateRefresh_pre(); + if (num_ejec == 2) + copyBackground(hare_x, hare_y, OBJWIDTH + 1, 0, ancho_hare, alto_talk - 1, screenSurface, drawSurface3); + else + copyBackground(hare_x, hare_y, OBJWIDTH + 1, 0, (int)(((float)ancho_hare / 100) * factor_red[hare_y + alto_hare]), (int)(((float)(alto_talk - 1) / 100) * factor_red[hare_y + alto_hare]), screenSurface, drawSurface3); - pon_hare(); - if (num_ejec == 2) { - if (alto_hare != 56) - copyBackground(OBJWIDTH + 1, 0, hare_x, hare_y, ancho_hare, alto_talk - 1, drawSurface3, screenSurface); - } else - copyBackground(OBJWIDTH + 1, 0, hare_x, hare_y, (int)(((float)ancho_hare / 100) * factor_red[hare_y + alto_hare]), + pon_hare(); + if (num_ejec == 2) { + if (alto_hare != 56) + copyBackground(OBJWIDTH + 1, 0, hare_x, hare_y, ancho_hare, alto_talk - 1, drawSurface3, screenSurface); + } else + copyBackground(OBJWIDTH + 1, 0, hare_x, hare_y, (int)(((float)ancho_hare / 100) * factor_red[hare_y + alto_hare]), (int)(((float)(alto_talk - 1) / 100) * factor_red[hare_y + alto_hare]), drawSurface3, screenSurface); - if (sentido_hare == 0) { - if (num_ejec == 2) - copyRect(x_talk_izq[face], y_mask_talk, hare_x + 8, hare_y - 1, ancho_talk, alto_talk, extraSurface, screenSurface); - else - reduce_hare_chico(x_talk_izq[face], y_mask_talk, (int)(hare_x + (8.0f / 100) * factor_red[hare_y + alto_hare]), + if (sentido_hare == 0) { + if (num_ejec == 2) + copyRect(x_talk_izq[face], y_mask_talk, hare_x + 8, hare_y - 1, ancho_talk, alto_talk, extraSurface, screenSurface); + else + reduce_hare_chico(x_talk_izq[face], y_mask_talk, (int)(hare_x + (8.0f / 100) * factor_red[hare_y + alto_hare]), hare_y, ancho_talk, alto_talk, factor_red[hare_y + alto_hare], extraSurface, screenSurface); - updateRefresh(); - } else if (sentido_hare == 1) { - if (num_ejec == 2) - copyRect(x_talk_dch[face], y_mask_talk, hare_x + 12, hare_y, ancho_talk, alto_talk, extraSurface, screenSurface); - else - reduce_hare_chico(x_talk_dch[face], y_mask_talk, (int)(hare_x + (12.0f / 100) * factor_red[hare_y + alto_hare]), + updateRefresh(); + } else if (sentido_hare == 1) { + if (num_ejec == 2) + copyRect(x_talk_dch[face], y_mask_talk, hare_x + 12, hare_y, ancho_talk, alto_talk, extraSurface, screenSurface); + else + reduce_hare_chico(x_talk_dch[face], y_mask_talk, (int)(hare_x + (12.0f / 100) * factor_red[hare_y + alto_hare]), hare_y, ancho_talk, alto_talk, factor_red[hare_y + alto_hare], extraSurface, screenSurface); - updateRefresh(); - } else if (sentido_hare == 2) { - if (num_ejec == 2) - copyRect(x_talk_izq[face], y_mask_talk, hare_x + 12, hare_y, ancho_talk, alto_talk, frontSurface, screenSurface); - else - reduce_hare_chico(x_talk_izq[face], y_mask_talk, + updateRefresh(); + } else if (sentido_hare == 2) { + if (num_ejec == 2) + copyRect(x_talk_izq[face], y_mask_talk, hare_x + 12, hare_y, ancho_talk, alto_talk, frontSurface, screenSurface); + else + reduce_hare_chico(x_talk_izq[face], y_mask_talk, (int)(suma_1_pixel + hare_x + (12.0f / 100) * factor_red[hare_y + alto_hare]), hare_y, ancho_talk, alto_talk, factor_red[hare_y + alto_hare], frontSurface, screenSurface); - updateRefresh(); - } else if (sentido_hare == 3) { - if (num_ejec == 2) - copyRect(x_talk_dch[face], y_mask_talk, hare_x + 8, hare_y, ancho_talk, alto_talk, frontSurface, screenSurface); - else - reduce_hare_chico(x_talk_dch[face], y_mask_talk, + updateRefresh(); + } else if (sentido_hare == 3) { + if (num_ejec == 2) + copyRect(x_talk_dch[face], y_mask_talk, hare_x + 8, hare_y, ancho_talk, alto_talk, frontSurface, screenSurface); + else + reduce_hare_chico(x_talk_dch[face], y_mask_talk, (int)(suma_1_pixel + hare_x + (8.0f / 100) * factor_red[hare_y + alto_hare]), hare_y, ancho_talk, alto_talk, factor_red[hare_y + alto_hare], frontSurface, screenSurface); - updateRefresh(); - } - - if (withVoices == 0) - centerText(said, hare_x, hare_y); + updateRefresh(); + } - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, hare_x, hare_y); - p++; - pause(3); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (!isTalkFinished(&length)) - goto bucless; + p++; + pause(3); + } while (!isTalkFinished(&length)); if (num_ejec == 1 && musicStatus() == 0 && flags[11] == 0) playMusic(roomMusic); @@ -1181,22 +1125,19 @@ void DrasculaEngine::talk_baul(const char *said, const char *filename) { talkInit(filename); -bucless: - - face = (face == 1) ? 0 : 1; + do { + face = (face == 1) ? 0 : 1; - flags[19] = face; - updateRoom(); - - if (withVoices == 0) - centerText(said, 263, 69); + flags[19] = face; + updateRoom(); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, 263, 69); - pause(4); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (!isTalkFinished(&length)) - goto bucless; + pause(4); + } while (!isTalkFinished(&length)); flags[19] = cara_antes; updateRoom(); @@ -1216,15 +1157,12 @@ void DrasculaEngine::talk_igor_door(const char *said, const char *filename) { talkInit(filename); -bucless: - - updateRoom(); - if (withVoices == 0) - centerText(said, 87, 66); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - - if (!isTalkFinished(&length)) - goto bucless; + do { + updateRoom(); + if (withVoices == 0) + centerText(said, 87, 66); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + } while (!isTalkFinished(&length)); updateRoom(); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -1245,27 +1183,24 @@ void DrasculaEngine::talk_igor_seated(const char *said, const char *filename) { talkInit(filename); -bucless: - - face = _rnd->getRandomNumber(3); + do { + face = _rnd->getRandomNumber(3); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - - updateRefresh_pre(); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - copyBackground(x_talk[face], 109, 207, 92, 21, 23, drawSurface3, screenSurface); - pon_hare(); - updateRefresh(); + updateRefresh_pre(); - if (withVoices == 0) - centerText(said, 221, 102); + copyBackground(x_talk[face], 109, 207, 92, 21, 23, drawSurface3, screenSurface); + pon_hare(); + updateRefresh(); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, 221, 102); - pause(3); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (!isTalkFinished(&length)) - goto bucless; + pause(3); + } while (!isTalkFinished(&length)); updateRoom(); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -1286,27 +1221,24 @@ void DrasculaEngine::talk_igor_wig(const char *said, const char *filename) { talkInit(filename); -bucless: + do { + _rnd->getRandomNumber(3); - _rnd->getRandomNumber(3); - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - - updateRefresh_pre(); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - copyBackground(x_talk[face], 78, 199, 94, 38, 27, drawSurface3, screenSurface); - pon_hare(); - updateRefresh(); + updateRefresh_pre(); - if (withVoices == 0) - centerText(said, 221, 102); + copyBackground(x_talk[face], 78, 199, 94, 38, 27, drawSurface3, screenSurface); + pon_hare(); + updateRefresh(); - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, 221, 102); - pause(3); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - if (!isTalkFinished(&length)) - goto bucless; + pause(3); + } while (!isTalkFinished(&length)); updateRoom(); updateScreen(0, 0, 0, 0, 320, 200, screenSurface); @@ -1322,29 +1254,26 @@ void DrasculaEngine::talk_dr_grande(const char *said, const char *filename) { talkInit(filename); -bucless: - - face = _rnd->getRandomNumber(3); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - copyBackground(interf_x[l] + 24, interf_y[l], 0, 45, 39, 31, drawSurface2, screenSurface); - copyBackground(x_talk[face], 1, 171, 68, 45, 48, drawSurface2, screenSurface); - l++; - if (l == 7) - l = 0; - - if (withVoices == 0) - centerText(said, 191, 69); + do { + face = _rnd->getRandomNumber(3); + copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(interf_x[l] + 24, interf_y[l], 0, 45, 39, 31, drawSurface2, screenSurface); + copyBackground(x_talk[face], 1, 171, 68, 45, 48, drawSurface2, screenSurface); + l++; + if (l == 7) + l = 0; - updateScreen(0, 0, 0, 0, 320, 200, screenSurface); + if (withVoices == 0) + centerText(said, 191, 69); - pause(3); + updateScreen(0, 0, 0, 0, 320, 200, screenSurface); - byte key = getScan(); - if (key == Common::KEYCODE_ESCAPE) - term_int = 1; + pause(3); - if (!isTalkFinished(&length)) - goto bucless; + byte key = getScan(); + if (key == Common::KEYCODE_ESCAPE) + term_int = 1; + } while (!isTalkFinished(&length)); } } // End of namespace Drascula |