[Scummvm-git-logs] scummvm master -> 5416e640a3de47b1a7d2d6962ac688b463d5fba1

sev- sev at scummvm.org
Wed Mar 28 00:44:13 CEST 2018


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
3a41e5f364 BLADERUNNER: Implemented EndCredits
5d8ff054f2 BLADERUNNER: Allow quit credits on windows closing
5416e640a3 BLADERUNNER: Switch to doubles in AudStream::getLength() calculations


Commit: 3a41e5f36422c3a3540ce5dadf7b95cd0fe40564
    https://github.com/scummvm/scummvm/commit/3a41e5f36422c3a3540ce5dadf7b95cd0fe40564
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-03-27T23:44:05+02:00

Commit Message:
BLADERUNNER: Implemented EndCredits

Changed paths:
    engines/bladerunner/bladerunner.cpp
    engines/bladerunner/bladerunner.h
    engines/bladerunner/ui/end_credits.cpp


diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 1a3c114..5a9e167 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 5561890..fc0abf4 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 0051fad..692e8fb 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


Commit: 5d8ff054f246cdeb6171727dc75f0934f8f32ba6
    https://github.com/scummvm/scummvm/commit/5d8ff054f246cdeb6171727dc75f0934f8f32ba6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-03-28T00:41:56+02:00

Commit Message:
BLADERUNNER: Allow quit credits on windows closing

Changed paths:
    engines/bladerunner/ui/end_credits.cpp


diff --git a/engines/bladerunner/ui/end_credits.cpp b/engines/bladerunner/ui/end_credits.cpp
index 692e8fb..1ab0b9f 100644
--- a/engines/bladerunner/ui/end_credits.cpp
+++ b/engines/bladerunner/ui/end_credits.cpp
@@ -97,7 +97,7 @@ void EndCredits::show() {
 	double position = 0.0;
 	uint32 timeLast = _vm->getTotalPlayTime();
 
-	while (!_vm->_vqaStopIsRequested) {
+	while (!_vm->_vqaStopIsRequested && !_vm->shouldQuit()) {
 		if (position >= textPositions[textCount - 1]) {
 			break;
 		}


Commit: 5416e640a3de47b1a7d2d6962ac688b463d5fba1
    https://github.com/scummvm/scummvm/commit/5416e640a3de47b1a7d2d6962ac688b463d5fba1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-03-28T00:42:26+02:00

Commit Message:
BLADERUNNER: Switch to doubles in AudStream::getLength() calculations

Since we have everything in samples, and we have 44kHz, we easily
get overflows. Use doubles for calculating the length in
milliseconds more accurately.

Changed paths:
    engines/bladerunner/aud_stream.cpp


diff --git a/engines/bladerunner/aud_stream.cpp b/engines/bladerunner/aud_stream.cpp
index 0d4434c..3d14f94 100644
--- a/engines/bladerunner/aud_stream.cpp
+++ b/engines/bladerunner/aud_stream.cpp
@@ -133,7 +133,12 @@ int AudStream::getLength() const {
 	if (_flags & 2) { // stereo
 		bytesPerSecond *= 2;
 	}
-	return (1000 * _sizeDecompressed) / bytesPerSecond;
+
+	// since everything is 44100, we easily get overflows with ints
+	// thus we must use doubles
+	double res = (double)_sizeDecompressed * 1000.0 / (double)bytesPerSecond;
+
+	return (int32)res;
 }
 
 } // End of namespace BladeRunner





More information about the Scummvm-git-logs mailing list