aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner
diff options
context:
space:
mode:
authorEugene Sandulenko2018-03-27 23:43:38 +0200
committerEugene Sandulenko2018-03-27 23:44:05 +0200
commit3a41e5f36422c3a3540ce5dadf7b95cd0fe40564 (patch)
treeb4f14c634f4e4a8cff2c76d7e00f32a4abd10761 /engines/bladerunner
parent084b2071a209b3ee07055b75125add7666be514e (diff)
downloadscummvm-rg350-3a41e5f36422c3a3540ce5dadf7b95cd0fe40564.tar.gz
scummvm-rg350-3a41e5f36422c3a3540ce5dadf7b95cd0fe40564.tar.bz2
scummvm-rg350-3a41e5f36422c3a3540ce5dadf7b95cd0fe40564.zip
BLADERUNNER: Implemented EndCredits
Diffstat (limited to 'engines/bladerunner')
-rw-r--r--engines/bladerunner/bladerunner.cpp10
-rw-r--r--engines/bladerunner/bladerunner.h2
-rw-r--r--engines/bladerunner/ui/end_credits.cpp130
3 files changed, 142 insertions, 0 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 1a3c11464b..5a9e1671e9 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -94,6 +94,9 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *des
_windowIsActive = true;
_gameIsRunning = true;
+ _vqaIsPlaying = false;
+ _vqaStopIsRequested = false;
+
_playerLosesControlCounter = 0;
_playerActorIdle = false;
@@ -935,6 +938,13 @@ void BladeRunnerEngine::handleKeyUp(Common::Event &event) {
_speechSkipped = true;
}
+ if (_vqaIsPlaying) {
+ _vqaStopIsRequested = true;
+ _vqaIsPlaying = false;
+
+ return;
+ }
+
// TODO:
if (!playerHasControl() /*|| ActorInWalkingLoop*/) {
return;
diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h
index 556189082f..fc0abf4e0a 100644
--- a/engines/bladerunner/bladerunner.h
+++ b/engines/bladerunner/bladerunner.h
@@ -184,6 +184,8 @@ public:
int _gameAutoSave;
bool _gameIsLoading;
bool _sceneIsLoading;
+ bool _vqaIsPlaying;
+ bool _vqaStopIsRequested;
int _walkSoundId;
int _walkSoundVolume;
diff --git a/engines/bladerunner/ui/end_credits.cpp b/engines/bladerunner/ui/end_credits.cpp
index 0051fad534..692e8fbbf9 100644
--- a/engines/bladerunner/ui/end_credits.cpp
+++ b/engines/bladerunner/ui/end_credits.cpp
@@ -20,6 +20,19 @@
*
*/
+#include "common/system.h"
+#include "common/rect.h"
+
+#include "audio/mixer.h"
+
+#include "bladerunner/bladerunner.h"
+#include "bladerunner/ambient_sounds.h"
+#include "bladerunner/audio_speech.h"
+#include "bladerunner/font.h"
+#include "bladerunner/game_info.h"
+#include "bladerunner/mouse.h"
+#include "bladerunner/music.h"
+#include "bladerunner/text_resource.h"
#include "bladerunner/ui/end_credits.h"
namespace BladeRunner {
@@ -32,6 +45,123 @@ EndCredits::~EndCredits() {
}
void EndCredits::show() {
+ _vm->_mouse->disable();
+ _vm->_mixer->stopAll();
+ _vm->_ambientSounds->removeAllNonLoopingSounds(true);
+ _vm->_ambientSounds->removeAllLoopingSounds(4);
+ _vm->_audioSpeech->stopSpeech();
+
+ _vm->_music->play(_vm->_gameInfo->getMusicTrack(17), 100, 0, 2, -1, 0, 3);
+
+ Font *fontBig = new Font(_vm);
+ fontBig->open("TAHOMA24.FON", 640, 480, -1, 0, 0);
+ fontBig->setSpacing(1, 0);
+
+ Font *fontSmall = new Font(_vm);
+ fontSmall->open("TAHOMA18.FON", 640, 480, -1, 0, 0);
+ fontSmall->setSpacing(1, 0);
+
+ TextResource *textResource = new TextResource(_vm);
+ textResource->open("ENDCRED");
+
+ int textCount = textResource->getCount();
+ int *textPositions = (int *)malloc(textCount * sizeof(int));
+ int y = 452;
+ bool small = false;
+
+ for (int i = 0; i < textCount; i++) {
+ Common::String s = textResource->getText(i);
+ if (s.hasPrefix("^")) {
+ if (!small) {
+ y += 28;
+ }
+ small = false;
+ } else {
+ if (small) {
+ y += 24;
+ } else {
+ y += 28;
+ }
+ small = true;
+ }
+ if (s.hasPrefix("^")) {
+ textPositions[i] = y;
+ } else {
+ textPositions[i] = y + 2;
+ }
+ }
+
+ _vm->_vqaIsPlaying = true;
+ _vm->_vqaStopIsRequested = false;
+
+ double position = 0.0;
+ uint32 timeLast = _vm->getTotalPlayTime();
+
+ while (!_vm->_vqaStopIsRequested) {
+ if (position >= textPositions[textCount - 1]) {
+ break;
+ }
+
+ //soundSystem::tick(SoundSystem);
+ _vm->handleEvents();
+
+ if (!_vm->_gameIsRunning) {
+ timeLast = _vm->getTotalPlayTime();
+
+ continue;
+ }
+
+ uint32 timeNow = _vm->getTotalPlayTime();
+ position += (double)(timeNow - timeLast) * 0.05f;
+ timeLast = timeNow;
+
+ _vm->_surfaceFront.fillRect(Common::Rect(640, 480), 0);
+
+ for (int i = 0; i < textCount; i++) {
+ Common::String s = textResource->getText(i);
+ Font *font;
+ int height;
+
+ if (s.hasPrefix("^")) {
+ font = fontBig;
+ height = 28;
+ s.deleteChar(0);
+ } else {
+ font = fontSmall;
+ height = 24;
+ }
+
+ y = textPositions[i] - (int)position;
+
+ if (y < 452 && y + height > 28) {
+ int x;
+
+ if (font == fontBig) {
+ x = 280;
+ } else {
+ x = 270 - font->getTextWidth(s);
+ }
+
+ font->draw(s, _vm->_surfaceFront, x, y);
+ }
+ }
+
+ _vm->_surfaceFront.fillRect(Common::Rect(0, 0, 640, 28), 0);
+ _vm->_surfaceFront.fillRect(Common::Rect(0, 452, 640, 480), 0);
+
+ _vm->blitToScreen(_vm->_surfaceFront);
+
+ _vm->_system->delayMillis(10);
+ }
+
+ _vm->_vqaIsPlaying = false;
+ _vm->_vqaStopIsRequested = false;
+
+ free(textPositions);
+ delete textResource;
+
+ _vm->_music->stop(0);
+ _vm->_mouse->enable();
}
} // End of namespace BladeRunner