diff options
Diffstat (limited to 'engines/drascula')
-rw-r--r-- | engines/drascula/animation.cpp | 49 | ||||
-rw-r--r-- | engines/drascula/converse.cpp | 2 | ||||
-rw-r--r-- | engines/drascula/detection.cpp | 26 | ||||
-rw-r--r-- | engines/drascula/drascula.cpp | 4 | ||||
-rw-r--r-- | engines/drascula/drascula.h | 1 | ||||
-rw-r--r-- | engines/drascula/graphics.cpp | 5 | ||||
-rw-r--r-- | engines/drascula/interface.cpp | 13 | ||||
-rw-r--r-- | engines/drascula/saveload.cpp | 2 | ||||
-rw-r--r-- | engines/drascula/sound.cpp | 32 | ||||
-rw-r--r-- | engines/drascula/talk.cpp | 30 |
10 files changed, 97 insertions, 67 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() { diff --git a/engines/drascula/converse.cpp b/engines/drascula/converse.cpp index 6f028e6e12..7abbb3214b 100644 --- a/engines/drascula/converse.cpp +++ b/engines/drascula/converse.cpp @@ -197,7 +197,7 @@ void DrasculaEngine::converse(int index) { // from 1(top) to 31 color_abc(kColorLightGreen); - while (breakOut == 0) { + while (breakOut == 0 && !shouldQuit()) { updateRoom(); if (musicStatus() == 0 && roomMusic != 0) { diff --git a/engines/drascula/detection.cpp b/engines/drascula/detection.cpp index 0969ad4131..3310ac0598 100644 --- a/engines/drascula/detection.cpp +++ b/engines/drascula/detection.cpp @@ -73,7 +73,7 @@ static const DrasculaGameDescription gameDescriptions[] = { Common::EN_ANY, Common::kPlatformPC, ADGF_NO_FLAGS, - GUIO1(GUIO_NONE) + GUIO0() }, }, @@ -93,7 +93,7 @@ static const DrasculaGameDescription gameDescriptions[] = { Common::EN_ANY, Common::kPlatformPC, GF_PACKED, - GUIO1(GUIO_NONE) + GUIO0() }, }, @@ -110,7 +110,7 @@ static const DrasculaGameDescription gameDescriptions[] = { Common::DE_DEU, Common::kPlatformPC, GF_PACKED, - GUIO1(GUIO_NONE) + GUIO0() }, }, @@ -127,7 +127,7 @@ static const DrasculaGameDescription gameDescriptions[] = { Common::FR_FRA, Common::kPlatformPC, GF_PACKED, - GUIO1(GUIO_NONE) + GUIO0() }, }, @@ -140,7 +140,7 @@ static const DrasculaGameDescription gameDescriptions[] = { Common::ES_ESP, Common::kPlatformPC, GF_PACKED, - GUIO1(GUIO_NONE) + GUIO0() }, }, @@ -153,7 +153,7 @@ static const DrasculaGameDescription gameDescriptions[] = { Common::ES_ESP, Common::kPlatformPC, ADGF_NO_FLAGS, - GUIO1(GUIO_NONE) + GUIO0() }, }, @@ -166,7 +166,7 @@ static const DrasculaGameDescription gameDescriptions[] = { Common::DE_DEU, Common::kPlatformPC, ADGF_NO_FLAGS, - GUIO1(GUIO_NONE) + GUIO0() }, }, @@ -179,7 +179,7 @@ static const DrasculaGameDescription gameDescriptions[] = { Common::FR_FRA, Common::kPlatformPC, ADGF_NO_FLAGS, - GUIO1(GUIO_NONE) + GUIO0() }, }, @@ -192,7 +192,7 @@ static const DrasculaGameDescription gameDescriptions[] = { Common::IT_ITA, Common::kPlatformPC, GF_PACKED, - GUIO1(GUIO_NONE) + GUIO0() }, }, { @@ -204,7 +204,7 @@ static const DrasculaGameDescription gameDescriptions[] = { Common::IT_ITA, Common::kPlatformPC, ADGF_NO_FLAGS, - GUIO1(GUIO_NONE) + GUIO0() }, }, @@ -221,7 +221,7 @@ static const DrasculaGameDescription gameDescriptions[] = { Common::ES_ESP, Common::kPlatformPC, GF_PACKED, - GUIO1(GUIO_NONE) + GUIO0() }, }, @@ -238,7 +238,7 @@ static const DrasculaGameDescription gameDescriptions[] = { Common::IT_ITA, Common::kPlatformPC, GF_PACKED, - GUIO1(GUIO_NONE) + GUIO0() }, }, @@ -255,7 +255,7 @@ static const DrasculaGameDescription gameDescriptions[] = { Common::FR_FRA, Common::kPlatformPC, GF_PACKED, - GUIO1(GUIO_NONE) + GUIO0() }, }, diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index b4f009eb44..1b3c4038f0 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -789,7 +789,7 @@ void DrasculaEngine::delay(int ms) { _system->delayMillis(10); updateEvents(); _system->updateScreen(); - } while (_system->getMillis() < end); + } while (_system->getMillis() < end && !shouldQuit()); } void DrasculaEngine::pause(int duration) { @@ -882,7 +882,7 @@ bool DrasculaEngine::loadDrasculaDat() { in.read(buf, 8); buf[8] = '\0'; - if (strcmp(buf, "DRASCULA")) { + if (strcmp(buf, "DRASCULA") != 0) { Common::String errorMessage = "File 'drascula.dat' is corrupt. Get it from the ScummVM website"; GUIErrorMessage(errorMessage); warning("%s", errorMessage.c_str()); diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index 6f98c50fdc..2d1954e3ca 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -664,6 +664,7 @@ public: void animation_12_2(); void animation_13_2(); void animation_14_2(); + void asco(); void animation_16_2(); void animation_20_2(); void animation_23_2(); diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index 9ea20e3e12..590561f0bd 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -154,6 +154,7 @@ void DrasculaEngine::showFrame(Common::SeekableReadStream *stream, bool firstFra } void DrasculaEngine::copyBackground(int xorg, int yorg, int xdes, int ydes, int width, int height, byte *src, byte *dest) { + debug(1, "DrasculaEngine::copyBackground(xorg:%d, yorg:%d, xdes:%d, ydes:%d width:%d height:%d, src, dest)", xorg, yorg, xdes, ydes, width,height); dest += xdes + ydes * 320; src += xorg + yorg * 320; /* Unoptimized code @@ -361,7 +362,7 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) { curWord = strtok(msg, " "); while (curWord != NULL) { // Check if the word and the current line fit on screen - if (strlen(tmpMessageLine) > 0) + if (tmpMessageLine[0] != '\0') strcat(tmpMessageLine, " "); strcat(tmpMessageLine, curWord); if (textFitsCentered(tmpMessageLine, textX)) { @@ -643,7 +644,7 @@ void DrasculaEngine::waitFrameSSN() { } bool DrasculaEngine::animate(const char *animationFile, int FPS) { - int NFrames = 1; + int NFrames; int cnt = 2; Common::SeekableReadStream *stream = _archives.open(animationFile); diff --git a/engines/drascula/interface.cpp b/engines/drascula/interface.cpp index e3a97087c0..c08bcea01f 100644 --- a/engines/drascula/interface.cpp +++ b/engines/drascula/interface.cpp @@ -100,9 +100,18 @@ bool DrasculaEngine::confirmExit() { key = getScan(); if (key != 0) break; + + // This gives a better feedback to the user when he is asked to + // confirm whether he wants to quit. It now still updates the room and + // shows mouse cursor movement. Hopefully it will work in all + // locations of the game. + updateRoom(); + color_abc(kColorRed); + centerText(_textsys[1], 160, 87); + updateScreen(); } - if (key == Common::KEYCODE_ESCAPE) { + if (key == Common::KEYCODE_ESCAPE || shouldQuit()) { stopMusic(); return false; } @@ -159,7 +168,7 @@ void DrasculaEngine::enterName() { key = getScan(); if (key != 0) { - if (key >= 0 && key <= 0xFF && isalpha(static_cast<unsigned char>(key))) + if (key >= 0 && key <= 0xFF && isAlpha(key)) select2[v] = tolower(key); else if ((key >= Common::KEYCODE_0 && key <= Common::KEYCODE_9) || key == Common::KEYCODE_SPACE) select2[v] = key; diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp index c8622f3c92..35e3821dc4 100644 --- a/engines/drascula/saveload.cpp +++ b/engines/drascula/saveload.cpp @@ -123,7 +123,7 @@ bool DrasculaEngine::saveLoadScreen() { if (mouseX > 115 && mouseY > y + (9 * n) && mouseX < 115 + 175 && mouseY < y + 10 + (9 * n)) { strcpy(select, _saveNames[n]); - if (strcmp(select, "*")) + if (strcmp(select, "*") != 0) selectionMade = 1; else { enterName(); diff --git a/engines/drascula/sound.cpp b/engines/drascula/sound.cpp index 413a631118..112f6fd06c 100644 --- a/engines/drascula/sound.cpp +++ b/engines/drascula/sound.cpp @@ -26,6 +26,7 @@ #include "common/config-manager.h" #include "common/textconsole.h" +#include "common/substream.h" #include "backends/audiocd/audiocd.h" @@ -78,6 +79,8 @@ void DrasculaEngine::volumeControls() { ; if (rightMouseButton == 1) { + // Clear this to avoid going straight to the inventory + rightMouseButton = 0; delay(100); break; } @@ -163,29 +166,28 @@ void DrasculaEngine::MusicFadeout() { void DrasculaEngine::playFile(const char *fname) { Common::SeekableReadStream *stream = _archives.open(fname); if (stream) { - int soundSize = stream->size(); - byte *soundData = (byte *)malloc(soundSize); + int startOffset = 0; + int soundSize = stream->size() - startOffset; - if (!(!strcmp(fname, "3.als") && soundSize == 145166 && _lang != kSpanish)) { - stream->seek(32); - } else { + if (!strcmp(fname, "3.als") && soundSize == 145166 && _lang != kSpanish) { // WORKAROUND: File 3.als with English speech files has a big silence at // its beginning and end. We seek past the silence at the beginning, // and ignore the silence at the end // Fixes bug #2111815 - "DRASCULA: Voice delayed" - stream->seek(73959, SEEK_SET); - soundSize = 117158 - 73959; + startOffset = 73959; + soundSize = soundSize - startOffset - 26306; } - stream->read(soundData, soundSize); - delete stream; - - _subtitlesDisabled = !ConfMan.getBool("subtitles"); - if (ConfMan.getBool("speech_mute")) - memset(soundData, 0x80, soundSize); // Mute speech but keep the pause + Common::SeekableReadStream *subStream = new Common::SeekableSubReadStream( + stream, startOffset, startOffset + soundSize, DisposeAfterUse::YES); + if (!subStream) { + warning("playFile: Out of memory"); + delete stream; + return; + } - Audio::AudioStream *sound = Audio::makeRawStream(soundData, soundSize - 64, - 11025, Audio::FLAG_UNSIGNED); + Audio::AudioStream *sound = Audio::makeRawStream(subStream, 11025, + Audio::FLAG_UNSIGNED); _mixer->playStream(Audio::Mixer::kSpeechSoundType, &_soundHandle, sound); } else warning("playFile: Could not open %s", fname); diff --git a/engines/drascula/talk.cpp b/engines/drascula/talk.cpp index 6d1509fe3c..a326852e96 100644 --- a/engines/drascula/talk.cpp +++ b/engines/drascula/talk.cpp @@ -34,6 +34,11 @@ void DrasculaEngine::talkInit(const char *filename) { } bool DrasculaEngine::isTalkFinished() { + if (shouldQuit()) { + stopSound(); + return true; + } + if (getScan() != 0) stopSound(); if (soundIsActive()) @@ -367,6 +372,7 @@ void DrasculaEngine::talk(int index) { } void DrasculaEngine::talk(const char *said, const char *filename) { + debug(1, "DrasculaEngine::talk(said:\"%s\", filename:\"%s\")", said, filename); int talkOffset = 0; if (currentChapter != 2) talkOffset = 1; @@ -409,8 +415,8 @@ void DrasculaEngine::talk(const char *said, const char *filename) { if (currentChapter == 2) copyBackground(curX, curY, OBJWIDTH + 1, 0, curWidth, talkHeight - 1, screenSurface, drawSurface3); else - copyBackground(curX, curY, OBJWIDTH + 1, 0, (int)(((float)curWidth / 100) * factor_red[curY + curHeight]), - (int)(((float)(talkHeight - 1) / 100) * factor_red[curY + curHeight]), + copyBackground(curX, curY, OBJWIDTH + 1, 0, (int)(((float)curWidth / 100) * factor_red[MIN(201, curY + curHeight)]), + (int)(((float)(talkHeight - 1) / 100) * factor_red[MIN(201, curY + curHeight)]), screenSurface, drawSurface3); moveCharacters(); @@ -419,8 +425,8 @@ void DrasculaEngine::talk(const char *said, const char *filename) { if (!strcmp(menuBackground, "99.alg") || !strcmp(menuBackground, "994.alg")) copyBackground(OBJWIDTH + 1, 0, curX, curY, curWidth, talkHeight - 1, drawSurface3, screenSurface); } else { - copyBackground(OBJWIDTH + 1, 0, curX, curY, (int)(((float)curWidth / 100) * factor_red[curY + curHeight]), - (int)(((float)(talkHeight - 1) / 100) * factor_red[curY + curHeight]), + copyBackground(OBJWIDTH + 1, 0, curX, curY, (int)(((float)curWidth / 100) * factor_red[MIN(201, curY + curHeight)]), + (int)(((float)(talkHeight - 1) / 100) * factor_red[MIN(201, curY + curHeight)]), drawSurface3, screenSurface); } @@ -429,8 +435,8 @@ void DrasculaEngine::talk(const char *said, const char *filename) { copyRect(x_talk_izq[face], y_mask_talk, curX + 8, curY - 1, talkWidth, talkHeight, extraSurface, screenSurface); else - reduce_hare_chico(x_talk_izq[face], y_mask_talk, curX + (int)((8.0f / 100) * factor_red[curY + curHeight]), - curY, talkWidth, talkHeight, factor_red[curY + curHeight], + reduce_hare_chico(x_talk_izq[face], y_mask_talk, curX + (int)((8.0f / 100) * factor_red[MIN(201, curY + curHeight)]), + curY, talkWidth, talkHeight, factor_red[MIN(201, curY + curHeight)], extraSurface, screenSurface); updateRefresh(); @@ -439,8 +445,8 @@ void DrasculaEngine::talk(const char *said, const char *filename) { copyRect(x_talk_dch[face], y_mask_talk, curX + 12, curY, talkWidth, talkHeight, extraSurface, screenSurface); else - reduce_hare_chico(x_talk_dch[face], y_mask_talk, curX + (int)((12.0f / 100) * factor_red[curY + curHeight]), - curY, talkWidth, talkHeight, factor_red[curY + curHeight], extraSurface, screenSurface); + reduce_hare_chico(x_talk_dch[face], y_mask_talk, curX + (int)((12.0f / 100) * factor_red[MIN(201, curY + curHeight)]), + curY, talkWidth, talkHeight, factor_red[MIN(201, curY + curHeight)], extraSurface, screenSurface); updateRefresh(); } else if (trackProtagonist == 2) { if (currentChapter == 2) @@ -448,8 +454,8 @@ void DrasculaEngine::talk(const char *said, const char *filename) { frontSurface, screenSurface); else reduce_hare_chico(x_talk_izq[face], y_mask_talk, - talkOffset + curX + (int)((12.0f / 100) * factor_red[curY + curHeight]), - curY, talkWidth, talkHeight, factor_red[curY + curHeight], + talkOffset + curX + (int)((12.0f / 100) * factor_red[MIN(201, curY + curHeight)]), + curY, talkWidth, talkHeight, factor_red[MIN(201, curY + curHeight)], frontSurface, screenSurface); updateRefresh(); } else if (trackProtagonist == 3) { @@ -458,8 +464,8 @@ void DrasculaEngine::talk(const char *said, const char *filename) { frontSurface, screenSurface); else reduce_hare_chico(x_talk_dch[face], y_mask_talk, - talkOffset + curX + (int)((8.0f / 100) * factor_red[curY + curHeight]), - curY, talkWidth,talkHeight, factor_red[curY + curHeight], + talkOffset + curX + (int)((8.0f / 100) * factor_red[MIN(201, curY + curHeight)]), + curY, talkWidth,talkHeight, factor_red[MIN(201, curY + curHeight)], frontSurface, screenSurface); updateRefresh(); } |