[Scummvm-git-logs] scummvm master -> 77e3979c796ba3e6d6650fcc047ad08b514cbcdb

antoniou79 noreply at scummvm.org
Wed May 11 20:45:10 UTC 2022


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

Summary:
1bda2b5546 BLADERUNNER: Set old and new outtake filename only if container > 0
52e283a758 BLADERUNNER: Use static const for screen dimensions
3eeb4c9023 BLADERUNNER: Add extra conditions for canLoadGameStateCurrently()
77e3979c79 BLADERUNNER: Detection and launch support for demo


Commit: 1bda2b5546dda284393d4e6eff02b372d4170ef0
    https://github.com/scummvm/scummvm/commit/1bda2b5546dda284393d4e6eff02b372d4170ef0
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-05-11T23:07:38+03:00

Commit Message:
BLADERUNNER: Set old and new outtake filename only if container > 0

Changed paths:
    engines/bladerunner/outtake.cpp


diff --git a/engines/bladerunner/outtake.cpp b/engines/bladerunner/outtake.cpp
index 59491491d04..989e99c3334 100644
--- a/engines/bladerunner/outtake.cpp
+++ b/engines/bladerunner/outtake.cpp
@@ -47,10 +47,12 @@ OuttakePlayer::~OuttakePlayer() {
 }
 
 void OuttakePlayer::play(const Common::String &name, bool noLocalization, int container) {
-	Common::String oldOuttakeFile = Common::String::format("OUTTAKE%d.MIX", _vm->_chapters->currentResourceId());
-	Common::String newOuttakeFile = Common::String::format("OUTTAKE%d.MIX", container);
-
+	Common::String oldOuttakeFile;
+	Common::String newOuttakeFile;
 	if (container > 0) {
+		oldOuttakeFile = Common::String::format("OUTTAKE%d.MIX", _vm->_chapters->currentResourceId());
+		newOuttakeFile = Common::String::format("OUTTAKE%d.MIX", container);
+
 		if (_vm->isArchiveOpen(oldOuttakeFile)
 		    && _vm->_chapters->currentResourceId() != container) {
 			_vm->closeArchive(oldOuttakeFile);


Commit: 52e283a758ae5f49cd5b64bb9d7ef4fddbe94d9a
    https://github.com/scummvm/scummvm/commit/52e283a758ae5f49cd5b64bb9d7ef4fddbe94d9a
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-05-11T23:07:38+03:00

Commit Message:
BLADERUNNER: Use static const for screen dimensions

Instead of the literals 640 for width and 480 for height

Changed paths:
    engines/bladerunner/actor.cpp
    engines/bladerunner/bladerunner.cpp
    engines/bladerunner/bladerunner.h
    engines/bladerunner/dialogue_menu.cpp
    engines/bladerunner/item_pickup.cpp
    engines/bladerunner/mouse.cpp
    engines/bladerunner/slice_renderer.cpp
    engines/bladerunner/ui/end_credits.cpp
    engines/bladerunner/ui/kia.cpp
    engines/bladerunner/ui/ui_image_picker.cpp
    engines/bladerunner/zbuffer.cpp


diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index 0832fe97a25..77d1463843e 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -1355,7 +1355,8 @@ void Actor::speechPlay(int sentenceId, bool voiceOver) {
 	if (!voiceOver && _id != BladeRunnerEngine::kActorVoiceOver) {
 #if BLADERUNNER_ORIGINAL_BUGS
 		Vector3 screenPosition = _vm->_view->calculateScreenPosition(_position);
-		pan = (75 * (2 *  CLIP<int>(screenPosition.x, 0, 640) - 640)) / 640; // map [0..640] to [-75..75]
+		// pan:: map [0..640] to [-75..75]
+		pan = (75 * (2 *  CLIP<int>(screenPosition.x, 0, BladeRunnerEngine::kOriginalGameWidth) - BladeRunnerEngine::kOriginalGameWidth)) / BladeRunnerEngine::kOriginalGameWidth;
 #else
 		// There are a few situations whereby 
 		// the actor is not actually in the set when speaking, 
@@ -1465,7 +1466,8 @@ void Actor::speechPlay(int sentenceId, bool voiceOver) {
 			default:
 				actorScreenPosition = _vm->_view->calculateScreenPosition(_position);
 			}
-			pan	= (75 * (2 *  CLIP<int>(actorScreenPosition.x, 0, 640) - 640)) / 640; // map [0..640] to [-75..75]
+			// map [0..640] to [-75..75]
+			pan	= (75 * (2 *  CLIP<int>(actorScreenPosition.x, 0, BladeRunnerEngine::kOriginalGameWidth) - BladeRunnerEngine::kOriginalGameWidth)) / BladeRunnerEngine::kOriginalGameWidth;
 		}
 		// debug("actor: %d, pan: %d", _id, pan);
 #endif // BLADERUNNER_ORIGINAL_BUGS
@@ -1583,7 +1585,7 @@ int Actor::soundPan(uint8 overrideRange) const {
 	Vector3 screenPosition = _vm->_view->calculateScreenPosition(_position);
 	// By default map [0..640] to [-overrideRange..overrideRange] (default range [-35..35])
 	CLIP<int>(overrideRange, 35, 100);
-	return (overrideRange * (2 * CLIP<int>(screenPosition.x, 0, 640) - 640)) / 640;
+	return (overrideRange * (2 * CLIP<int>(screenPosition.x, 0, BladeRunnerEngine::kOriginalGameWidth) - BladeRunnerEngine::kOriginalGameWidth)) / BladeRunnerEngine::kOriginalGameWidth;
 }
 
 bool Actor::isObstacleBetween(const Vector3 &target) {
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 97ec1707474..3d066d380c4 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -359,8 +359,8 @@ Common::Error BladeRunnerEngine::run() {
 		_screenPixelFormat = Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0);
 	}
 	debug("Using pixel format: %s", _screenPixelFormat.toString().c_str());
-	initGraphics(640, 480, &_screenPixelFormat);
 
+	initGraphics(kOriginalGameWidth, kOriginalGameHeight, &_screenPixelFormat);
 	_system->showMouse(true);
 
 	bool hasSavegames = !SaveFileManager::list(getMetaEngine(), _targetName).empty();
@@ -370,7 +370,7 @@ Common::Error BladeRunnerEngine::run() {
 		return Common::Error(Common::kUnknownError, _("Failed to initialize resources"));
 	}
 
-	// improvement: Use a do-while() loop to handle the normal end-game state
+	// Improvement: Use a do-while() loop to handle the normal end-game state
 	// so that the game won't exit abruptly after end credits
 	do {
 		// additional code for gracefully handling end-game after _endCredits->show()
@@ -402,7 +402,7 @@ Common::Error BladeRunnerEngine::run() {
 
 			if (getEventManager()->getKeymapper()->getKeymap(BladeRunnerEngine::kKiaKeymapId) != nullptr) {
 				// When disabling a keymap, make sure all their active events in the _activeCustomEvents array
-				// are cleared, because as they won't get an explicit "EVENT_CUSTOM_ENGINE_ACTION_END" event.
+				// are cleared, because they won't get an explicit "EVENT_CUSTOM_ENGINE_ACTION_END" event.
 				cleanupPendingRepeatingEvents(BladeRunnerEngine::kKiaKeymapId);
 				getEventManager()->getKeymapper()->getKeymap(BladeRunnerEngine::kKiaKeymapId)->setEnabled(false);
 			}
@@ -548,10 +548,9 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
 	setDebugger(_debugger);
 
 	// This is the original startup in the game
-
-	_surfaceFront.create(640, 480, screenPixelFormat());
+	_surfaceFront.create(kOriginalGameWidth, kOriginalGameHeight, screenPixelFormat());
 	_surfaceFrontCreated = true;
-	_surfaceBack.create(640, 480, screenPixelFormat());
+	_surfaceBack.create(kOriginalGameWidth, kOriginalGameHeight, screenPixelFormat());
 	_surfaceBackCreated = true;
 
 	_time = new Time(this);
@@ -657,7 +656,7 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
 	_overlays->init();
 
 	_zbuffer = new ZBuffer();
-	_zbuffer->init(640, 480);
+	_zbuffer->init(kOriginalGameWidth, kOriginalGameHeight);
 
 	int actorCount = (int)_gameInfo->getActorCount();
 	assert(actorCount < kActorCount);
@@ -1200,10 +1199,10 @@ void BladeRunnerEngine::gameTick() {
 		// The surface front pixel format is 32 bit now,
 		// but the _zbuffer->getData() still returns 16bit pixels
 		// We need to copy pixel by pixel, converting each pixel from 16 to 32bit
-		for (int y = 0; y < 480; ++y) {
-			for (int x = 0; x < 640; ++x) {
+		for (int y = 0; y < kOriginalGameHeight; ++y) {
+			for (int x = 0; x < kOriginalGameWidth; ++x) {
 				uint8 a, r, g, b;
-				getGameDataColor(_zbuffer->getData()[y*640 + x], a, r, g, b);
+				getGameDataColor(_zbuffer->getData()[y*kOriginalGameWidth + x], a, r, g, b);
 				void   *dstPixel = _surfaceFront.getBasePtr(x, y);
 				drawPixel(_surfaceFront, dstPixel, _surfaceFront.format.ARGBToColor(a, r, g, b));
 			}
@@ -2743,7 +2742,7 @@ void BladeRunnerEngine::blitToScreen(const Graphics::Surface &src) const {
 
 Graphics::Surface BladeRunnerEngine::generateThumbnail() const {
 	Graphics::Surface thumbnail;
-	thumbnail.create(640 / 8, 480 / 8, gameDataPixelFormat());
+	thumbnail.create(kOriginalGameWidth / 8, kOriginalGameHeight / 8, gameDataPixelFormat());
 
 	for (int y = 0; y < thumbnail.h; ++y) {
 		for (int x = 0; x < thumbnail.w; ++x) {
diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h
index 8acb28f1ecc..3988e91ea9f 100644
--- a/engines/bladerunner/bladerunner.h
+++ b/engines/bladerunner/bladerunner.h
@@ -113,6 +113,9 @@ public:
 	static const int kActorVoiceOver = kActorCount - 1;
 	static const int kMaxCustomConcurrentRepeatableEvents = 20;
 
+	static const int16 kOriginalGameWidth  = 640;
+	static const int16 kOriginalGameHeight = 480;
+
 	// Incremental number to keep track of significant revisions of the ScummVM bladerunner engine
 	// that could potentially introduce incompatibilities with old save files or require special actions to restore compatibility
 	// This is stored in game global variable "kVariableGameVersion"
diff --git a/engines/bladerunner/dialogue_menu.cpp b/engines/bladerunner/dialogue_menu.cpp
index f409f2f7b55..12490999e00 100644
--- a/engines/bladerunner/dialogue_menu.cpp
+++ b/engines/bladerunner/dialogue_menu.cpp
@@ -415,8 +415,8 @@ void DialogueMenu::calculatePosition(int unusedX, int unusedY) {
 	_screenX = _centerX - w / 2;
 	_screenY = _centerY - h / 2;
 
-	_screenX = CLIP(_screenX, 0, 640 - w);
-	_screenY = CLIP(_screenY, 0, 480 - h);
+	_screenX = CLIP(_screenX, 0, BladeRunnerEngine::kOriginalGameWidth  - w);
+	_screenY = CLIP(_screenY, 0, BladeRunnerEngine::kOriginalGameHeight - h);
 
 	_fadeInItemIndex = 0;
 }
@@ -544,8 +544,8 @@ void DialogueMenu::reset() {
 void DialogueMenu::darkenRect(Graphics::Surface &s, int x1, int y1, int x2, int y2) {
 	x1 = MAX(x1, 0);
 	y1 = MAX(y1, 0);
-	x2 = MIN(x2, 640);
-	y2 = MIN(y2, 480);
+	x2 = MIN<int32>(x2, BladeRunnerEngine::kOriginalGameWidth);
+	y2 = MIN<int32>(y2, BladeRunnerEngine::kOriginalGameHeight);
 
 	if (x1 < x2 && y1 < y2) {
 		for (int y = y1; y != y2; ++y) {
diff --git a/engines/bladerunner/item_pickup.cpp b/engines/bladerunner/item_pickup.cpp
index 4953b8f7cf7..27f37621807 100644
--- a/engines/bladerunner/item_pickup.cpp
+++ b/engines/bladerunner/item_pickup.cpp
@@ -47,14 +47,15 @@ void ItemPickup::setup(int animationId, int screenX, int screenY) {
 	_facing = 0.0;
 	_timeLeft = 3000u;
 	_scale = 0;
-	_screenX = CLIP(screenX, 40, 600);
-	_screenY = CLIP(screenY, 40, 440);
+	_screenX = CLIP(screenX, 40, BladeRunnerEngine::kOriginalGameWidth  - 40);
+	_screenY = CLIP(screenY, 40, BladeRunnerEngine::kOriginalGameHeight - 40);
 	_screenRect.left = _screenX - 40;
 	_screenRect.right = _screenX + 40;
 	_screenRect.top = _screenY - 40;
 	_screenRect.bottom = _screenY + 40;
 
-	int pan = (75 * (2 * _screenX - 640)) / 640; // map [0..640] to [-75..75]
+	// map [0..640] to [-75..75]
+	int pan = (75 * (2 * _screenX - BladeRunnerEngine::kOriginalGameWidth)) / BladeRunnerEngine::kOriginalGameWidth;
 	_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(kSfxGETITEM1), 80, pan, pan, 50, 0);
 
 	_timeLast = _vm->_time->currentSystem();
diff --git a/engines/bladerunner/mouse.cpp b/engines/bladerunner/mouse.cpp
index c06e145a33d..44d98eea9aa 100644
--- a/engines/bladerunner/mouse.cpp
+++ b/engines/bladerunner/mouse.cpp
@@ -538,13 +538,14 @@ Vector3 Mouse::getXYZ(int x, int y) const {
 	if (_vm->_scene->getSetId() == -1)
 		return Vector3();
 
-	int screenRight = 640 - x;
-	int screenDown  = 480 - y;
+	int screenRight = BladeRunnerEngine::kOriginalGameWidth  - x;
+	int screenDown  = BladeRunnerEngine::kOriginalGameHeight - y;
 
 	float zcoef = 1.0f / tan(_vm->_view->_fovX / 2.0f);
 
-	float x3d = (2.0f / 640.0f * screenRight - 1.0f);
-	float y3d = (2.0f / 480.0f * screenDown  - 1.0f) * 0.75f;
+	// Division of float by int is float, so no precision is lost here
+	float x3d = (2.0f / BladeRunnerEngine::kOriginalGameWidth  * screenRight - 1.0f);
+	float y3d = (2.0f / BladeRunnerEngine::kOriginalGameHeight * screenDown  - 1.0f) * 0.75f;
 
 	uint16 zbufval = _vm->_zbuffer->getZValue(x, y);
 
diff --git a/engines/bladerunner/slice_renderer.cpp b/engines/bladerunner/slice_renderer.cpp
index 74121fe4c89..f1ac0ca803b 100644
--- a/engines/bladerunner/slice_renderer.cpp
+++ b/engines/bladerunner/slice_renderer.cpp
@@ -233,8 +233,8 @@ void SliceRenderer::calculateBoundingRect() {
 	Matrix3x2 mStartMVP = mStart * _mvpMatrix;
 	Matrix3x2 mEndMVP   = mEnd   * _mvpMatrix;
 
-	float minX =  640.0f;
-	float maxX =    0.0f;
+	float minX = (float)BladeRunnerEngine::kOriginalGameWidth;
+	float maxX = 0.0f;
 
 	for (float i = 0.0f; i <= 255.0f; i += 255.0f) {
 		for (float j = 0.0f; j <= 255.0f; j += 255.0f) {
@@ -248,8 +248,8 @@ void SliceRenderer::calculateBoundingRect() {
 		}
 	}
 
-	_screenRectangle.left  = CLIP((int)minX,     0, 640);
-	_screenRectangle.right = CLIP((int)maxX + 1, 0, 640);
+	_screenRectangle.left  = CLIP<int32>(minX,     0, BladeRunnerEngine::kOriginalGameWidth);
+	_screenRectangle.right = CLIP<int32>(maxX + 1, 0, BladeRunnerEngine::kOriginalGameWidth);
 
 	_startScreenVector.x = startScreenVector.x;
 	_startScreenVector.y = startScreenVector.y;
@@ -442,7 +442,7 @@ void SliceRenderer::drawInWorld(int animationId, int animationFrame, Vector3 pos
 
 	int frameY = sliceLineIterator._startY;
 
-	uint16 *zBufferLinePtr = zbuffer + 640 * frameY;
+	uint16 *zBufferLinePtr = zbuffer + BladeRunnerEngine::kOriginalGameWidth * frameY;
 
 	while (sliceLineIterator._currentY <= sliceLineIterator._endY) {
 		_m13 = sliceLineIterator._sliceMatrix(0, 2);
@@ -473,7 +473,7 @@ void SliceRenderer::drawInWorld(int animationId, int animationFrame, Vector3 pos
 
 		sliceLineIterator.advance();
 		++frameY;
-		zBufferLinePtr += 640;
+		zBufferLinePtr += BladeRunnerEngine::kOriginalGameWidth;
 	}
 }
 
@@ -525,11 +525,11 @@ void SliceRenderer::drawOnScreen(int animationId, int animationFrame, int screen
 	float currentSlice = 0;
 	float sliceStep = 1.0f / size / _frameSliceHeight;
 
-	uint16 lineZbuffer[640];
+	uint16 lineZbuffer[BladeRunnerEngine::kOriginalGameWidth];
 
 	while (currentSlice < _frameSliceCount) {
 		if (currentY >= 0 && currentY < surface.h) {
-			memset(lineZbuffer, 0xFF, 640 * 2);
+			memset(lineZbuffer, 0xFF, BladeRunnerEngine::kOriginalGameWidth * 2);
 			drawSlice(currentSlice, false, currentY, surface, lineZbuffer);
 			currentSlice += sliceStep;
 			--currentY;
@@ -566,7 +566,7 @@ void SliceRenderer::drawSlice(int slice, bool advanced, int y, Graphics::Surface
 		int previousVertexX = lastVertexX;
 
 		while (vertexCount--) {
-			int vertexX = CLIP((_m11lookup[p[0]] + _m12lookup[p[1]] + _m13) / 65536, 0, 640);
+			int vertexX = CLIP<int32>((_m11lookup[p[0]] + _m12lookup[p[1]] + _m13) / 65536, 0, BladeRunnerEngine::kOriginalGameWidth);
 
 			if (vertexX > previousVertexX) {
 				int vertexZ = (_m21lookup[p[0]] + _m22lookup[p[1]] + _m23) / 64;
@@ -644,11 +644,11 @@ void SliceRenderer::drawShadowPolygon(int transparency, Graphics::Surface &surfa
 	// this simplified polygon drawing algo is in the game
 
 	int yMax = 0;
-	int yMin = 480;
+	int yMin = BladeRunnerEngine::kOriginalGameHeight;
 	uint16 zMin = 65535;
 
-	int polygonLeft[480] = {};
-	int polygonRight[480] = {};
+	int polygonLeft[BladeRunnerEngine::kOriginalGameHeight] = {};
+	int polygonRight[BladeRunnerEngine::kOriginalGameHeight] = {};
 
 	int iNext = 11;
 	for (int i = 0; i < 12; ++i) {
@@ -682,7 +682,7 @@ void SliceRenderer::drawShadowPolygon(int transparency, Graphics::Surface &surfa
 
 		if (yCurrent > yNext) {
 			while (y >= yNext) {
-				if (y >= 0 && y < 480) {
+				if (y >= 0 && y < BladeRunnerEngine::kOriginalGameHeight) {
 					polygonLeft[y] = x;
 				}
 				xCounter += xDelta;
@@ -694,7 +694,7 @@ void SliceRenderer::drawShadowPolygon(int transparency, Graphics::Surface &surfa
 			}
 		} else if (yCurrent < yNext) {
 			while (y <= yNext) {
-				if (y >= 0 && y < 480) {
+				if (y >= 0 && y < BladeRunnerEngine::kOriginalGameHeight) {
 					polygonRight[y] = x;
 				}
 				xCounter += xDelta;
@@ -708,8 +708,8 @@ void SliceRenderer::drawShadowPolygon(int transparency, Graphics::Surface &surfa
 		iNext = (iNext + 1) % 12;
 	}
 
-	yMax = CLIP(yMax, 0, 480);
-	yMin = CLIP(yMin, 0, 480);
+	yMax = CLIP<int32>(yMax, 0, BladeRunnerEngine::kOriginalGameHeight);
+	yMin = CLIP<int32>(yMin, 0, BladeRunnerEngine::kOriginalGameHeight);
 
 	static const int ditheringFactor[] = {
 		0,  8,  2, 10,
@@ -719,11 +719,11 @@ void SliceRenderer::drawShadowPolygon(int transparency, Graphics::Surface &surfa
 	};
 
 	for (int y = yMin; y < yMax; ++y) {
-		int xMin = CLIP(polygonLeft[y], 0, 640);
-		int xMax = CLIP(polygonRight[y], 0, 640);
+		int xMin = CLIP<int32>(polygonLeft[y],  0, BladeRunnerEngine::kOriginalGameWidth);
+		int xMax = CLIP<int32>(polygonRight[y], 0, BladeRunnerEngine::kOriginalGameWidth);
 
 		for (int x = MIN(xMin, xMax); x < MAX(xMin, xMax); ++x) {
-			uint16 z = zbuffer[x + y * 640];
+			uint16 z = zbuffer[x + y * BladeRunnerEngine::kOriginalGameWidth];
 			void *pixel = surface.getBasePtr(CLIP(x, 0, surface.w - 1), CLIP(y, 0, surface.h - 1));
 
 			if (z >= zMin) {
diff --git a/engines/bladerunner/ui/end_credits.cpp b/engines/bladerunner/ui/end_credits.cpp
index 587c2d89255..98ef42d5b71 100644
--- a/engines/bladerunner/ui/end_credits.cpp
+++ b/engines/bladerunner/ui/end_credits.cpp
@@ -110,7 +110,7 @@ void EndCredits::show() {
 		position += (double)(timeNow - timeLast) * 0.05f; // unsigned difference is intentional
 		timeLast = timeNow;
 
-		_vm->_surfaceFront.fillRect(Common::Rect(640, 480), 0);
+		_vm->_surfaceFront.fillRect(Common::Rect(BladeRunnerEngine::kOriginalGameWidth, BladeRunnerEngine::kOriginalGameHeight), 0);
 
 		for (int i = 0; i < textCount; ++i) {
 			Common::String s = textResource->getText(i);
@@ -141,8 +141,8 @@ void EndCredits::show() {
 			}
 		}
 
-		_vm->_surfaceFront.fillRect(Common::Rect(0, 0, 640, 28), 0);
-		_vm->_surfaceFront.fillRect(Common::Rect(0, 452, 640, 480), 0);
+		_vm->_surfaceFront.fillRect(Common::Rect(0, 0, BladeRunnerEngine::kOriginalGameWidth, 28), 0);
+		_vm->_surfaceFront.fillRect(Common::Rect(0, BladeRunnerEngine::kOriginalGameHeight - 28, BladeRunnerEngine::kOriginalGameWidth, BladeRunnerEngine::kOriginalGameHeight), 0);
 
 		_vm->blitToScreen(_vm->_surfaceFront);
 	}
diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp
index 48cbe73702d..85451e80dc9 100644
--- a/engines/bladerunner/ui/kia.cpp
+++ b/engines/bladerunner/ui/kia.cpp
@@ -703,7 +703,7 @@ void KIA::mouseDownCallback(int buttonId, void *callbackData) {
 		if (buttonId == 12) {
 			int endTrackId = self->_vm->_audioPlayer->playAud(self->_vm->_gameInfo->getSfxTrack(kSfxSHUTDOWN), 70, 0, 0, 50, 0);
 
-			self->_vm->_surfaceFront.fillRect(Common::Rect(0, 0, 640, 480), 0);
+			self->_vm->_surfaceFront.fillRect(Common::Rect(0, 0, BladeRunnerEngine::kOriginalGameWidth, BladeRunnerEngine::kOriginalGameHeight), 0);
 			self->_vm->blitToScreen(self->_vm->_surfaceFront);
 
 			if (endTrackId != -1) {
diff --git a/engines/bladerunner/ui/ui_image_picker.cpp b/engines/bladerunner/ui/ui_image_picker.cpp
index a520d11f2a6..bd6c4a8e823 100644
--- a/engines/bladerunner/ui/ui_image_picker.cpp
+++ b/engines/bladerunner/ui/ui_image_picker.cpp
@@ -295,15 +295,19 @@ void UIImagePicker::drawTooltip(Graphics::Surface &surface, int x, int y) {
 	}
 
 	rect.right = width + rect.left + 3;
-	if (rect.right >= 640) {
-		rect.right = 639;
-		rect.left = 636 - width;
+	if (rect.right >= BladeRunnerEngine::kOriginalGameWidth) {
+		rect.right = BladeRunnerEngine::kOriginalGameWidth - 1;
+		rect.left = BladeRunnerEngine::kOriginalGameWidth - 4 - width;
+		if (rect.left < 0)  rect.left = 0;  // should never happen
+		if (rect.right < 0) rect.right = 0; // should never happen
 	}
 
 	rect.bottom = height + rect.top + 2;
-	if (rect.bottom >= 480) {
-		rect.bottom = 479;
-		rect.top = 478 - height;
+	if (rect.bottom >= BladeRunnerEngine::kOriginalGameHeight) {
+		rect.bottom = BladeRunnerEngine::kOriginalGameHeight - 1;
+		rect.top = BladeRunnerEngine::kOriginalGameHeight - 3 - height;
+		if (rect.top < 0)    rect.top = 0;    // should never happen
+		if (rect.bottom < 0) rect.bottom = 0; // should never happen
 	}
 
 	surface.fillRect(rect, surface.format.RGBToColor(0, 0, 0));
diff --git a/engines/bladerunner/zbuffer.cpp b/engines/bladerunner/zbuffer.cpp
index f2657f06714..b80882f9c87 100644
--- a/engines/bladerunner/zbuffer.cpp
+++ b/engines/bladerunner/zbuffer.cpp
@@ -94,7 +94,7 @@ void ZBuffer::init(int width, int height) {
 }
 
 static int decodePartialZBuffer(const uint8 *src, uint16 *curZBUF, uint32 srcLen) {
-	uint32 dstSize = 640 * 480; // This is taken from global variables?
+	const uint32 dstSize = BladeRunnerEngine::kOriginalGameWidth * BladeRunnerEngine::kOriginalGameHeight;
 	uint32 dstRemain = dstSize;
 
 	uint16 *curzp = curZBUF;


Commit: 3eeb4c9023e204bd71396f7e97999fe5fa7f6198
    https://github.com/scummvm/scummvm/commit/3eeb4c9023e204bd71396f7e97999fe5fa7f6198
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-05-11T23:07:38+03:00

Commit Message:
BLADERUNNER: Add extra conditions for canLoadGameStateCurrently()

Changed paths:
    engines/bladerunner/bladerunner.cpp


diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 3d066d380c4..932197e02e8 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -260,6 +260,10 @@ bool BladeRunnerEngine::hasFeature(EngineFeature f) const {
 bool BladeRunnerEngine::canLoadGameStateCurrently() {
 	return
 		playerHasControl() &&
+		_gameIsRunning &&
+		!_actorIsSpeaking &&
+		!_vqaIsPlaying &&
+		!_gameJustLaunched &&
 		!_sceneScript->isInsideScript() &&
 		!_aiScripts->isInsideScript() &&
 		!_kia->isOpen() &&


Commit: 77e3979c796ba3e6d6650fcc047ad08b514cbcdb
    https://github.com/scummvm/scummvm/commit/77e3979c796ba3e6d6650fcc047ad08b514cbcdb
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-05-11T23:42:43+03:00

Commit Message:
BLADERUNNER: Detection and launch support for demo

Demo is the sizzle2 VQA/VQP early teaser for Blade Runner

Changed paths:
    engines/bladerunner/bladerunner.cpp
    engines/bladerunner/bladerunner.h
    engines/bladerunner/detection.cpp
    engines/bladerunner/detection_tables.h


diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 932197e02e8..f6b0506c197 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -244,6 +244,8 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *des
 	_activeCustomEvents->clear();
 	_customEventRepeatTimeLast = 0;
 	_customEventRepeatTimeDelay = 0;
+
+	_isNonInteractiveDemo = desc->flags & ADGF_DEMO;
 }
 
 BladeRunnerEngine::~BladeRunnerEngine() {
@@ -261,6 +263,7 @@ bool BladeRunnerEngine::canLoadGameStateCurrently() {
 	return
 		playerHasControl() &&
 		_gameIsRunning &&
+		!_isNonInteractiveDemo &&
 		!_actorIsSpeaking &&
 		!_vqaIsPlaying &&
 		!_gameJustLaunched &&
@@ -300,6 +303,7 @@ bool BladeRunnerEngine::canSaveGameStateCurrently() {
 	return
 		playerHasControl() &&
 		_gameIsRunning &&
+		!_isNonInteractiveDemo &&
 		!_actorIsSpeaking &&
 		!_vqaIsPlaying &&
 		!_gameJustLaunched &&
@@ -340,7 +344,7 @@ void BladeRunnerEngine::pauseEngineIntern(bool pause) {
 
 Common::Error BladeRunnerEngine::run() {
 	Common::Array<Common::String> missingFiles;
-	if (!checkFiles(missingFiles)) {
+	if (!_isNonInteractiveDemo && !checkFiles(missingFiles)) {
 		Common::String missingFileStr = "";
 		for (uint i = 0; i < missingFiles.size(); ++i) {
 			if (i > 0) {
@@ -364,8 +368,20 @@ Common::Error BladeRunnerEngine::run() {
 	}
 	debug("Using pixel format: %s", _screenPixelFormat.toString().c_str());
 
-	initGraphics(kOriginalGameWidth, kOriginalGameHeight, &_screenPixelFormat);
-	_system->showMouse(true);
+	int16 gameBRWidth = kOriginalGameWidth;
+	int16 gameBRHeight = kOriginalGameHeight;
+	if (_isNonInteractiveDemo) {
+		if (Common::File::exists("SIZZLE2.VQP")) {
+			gameBRWidth = kDemoGameWidth * 2;
+			gameBRHeight = kDemoGameHeight * 2;
+		} else {
+			gameBRWidth = kDemoGameWidth;
+			gameBRHeight = kDemoGameHeight;
+		}
+	}
+
+	initGraphics(gameBRWidth, gameBRHeight, &_screenPixelFormat);
+	_system->showMouse(_isNonInteractiveDemo ? false : true);
 
 	bool hasSavegames = !SaveFileManager::list(getMetaEngine(), _targetName).empty();
 
@@ -374,6 +390,40 @@ Common::Error BladeRunnerEngine::run() {
 		return Common::Error(Common::kUnknownError, _("Failed to initialize resources"));
 	}
 
+	if (_isNonInteractiveDemo) {
+		_gameOver         = false;
+		_gameIsRunning    = true;
+		_gameJustLaunched = true;
+
+		if (getEventManager()->getKeymapper() != nullptr) {
+			if (getEventManager()->getKeymapper()->getKeymap(BladeRunnerEngine::kGameplayKeymapId) != nullptr) {
+				getEventManager()->getKeymapper()->getKeymap(BladeRunnerEngine::kGameplayKeymapId)->setEnabled(true);
+				const Common::Keymap::ActionArray karr = getEventManager()->getKeymapper()->getKeymap(BladeRunnerEngine::kGameplayKeymapId)->getActions();
+				for (uint8 i = 0; i < karr.size(); ++i) {
+					if (karr[i]->description == "COMBAT"
+					    || karr[i]->description == "SKIPDLG"
+					    || karr[i]->description == "KIADB") {
+						getEventManager()->getKeymapper()->getKeymap(BladeRunnerEngine::kGameplayKeymapId)->unregisterMapping(karr[i]);
+					}
+				}
+			}
+		}
+
+		// Required for calls in OuttakePlayer::play() of playerLosesControl(), playerGainsControl()
+		_mouse = new Mouse(this);
+		_mouse->disable();
+
+		// Speech Sound Type (kSpeechSoundType) is the volume of the outtake video,
+		// so we don't mute that one
+		_mixer->setVolumeForSoundType(_mixer->kMusicSoundType, 0);
+		_mixer->setVolumeForSoundType(_mixer->kPlainSoundType, 0);
+		_mixer->setVolumeForSoundType(_mixer->kSFXSoundType, 0);
+		int vqpCompanionPresenceId = Common::File::exists("SIZZLE2.VQP")? -2 : -3;
+		outtakePlay("SIZZLE2", true, vqpCompanionPresenceId);
+		// shutting down
+		return Common::kNoError;
+	}
+
 	// Improvement: Use a do-while() loop to handle the normal end-game state
 	// so that the game won't exit abruptly after end credits
 	do {
@@ -511,50 +561,21 @@ bool BladeRunnerEngine::checkFiles(Common::Array<Common::String> &missingFiles)
 
 bool BladeRunnerEngine::startup(bool hasSavegames) {
 	// Assign default values to the ScummVM configuration manager, in case settings are missing
-	ConfMan.registerDefault("subtitles", "true");
 	ConfMan.registerDefault("sfx_volume", 192);
 	ConfMan.registerDefault("music_volume", 192);
 	ConfMan.registerDefault("speech_volume", 192);
 	ConfMan.registerDefault("mute", "false");
 	ConfMan.registerDefault("speech_mute", "false");
-	ConfMan.registerDefault("sitcom", "false");
-	ConfMan.registerDefault("shorty", "false");
 	ConfMan.registerDefault("nodelaymillisfl", "false");
 	ConfMan.registerDefault("frames_per_secondfl", "false");
-	ConfMan.registerDefault("disable_stamina_drain", "false");
 
-	_sitcomMode                = ConfMan.getBool("sitcom");
-	_shortyMode                = ConfMan.getBool("shorty");
 	_noDelayMillisFramelimiter = ConfMan.getBool("nodelaymillisfl");
 	_framesPerSecondMax        = ConfMan.getBool("frames_per_secondfl");
-	_disableStaminaDrain       = ConfMan.getBool("disable_stamina_drain");
-
-	// These are static objects in original game
-	_screenEffects = new ScreenEffects(this, 0x8000);
-
-	_endCredits = new EndCredits(this);
-
-	_actorDialogueQueue = new ActorDialogueQueue(this);
-
-	_settings = new Settings(this);
-
-	_itemPickup = new ItemPickup(this);
-
-	_lights = new Lights(this);
-
-	// outtake player was initialized here in the original game - but this is done bit differently
-
-	_obstacles = new Obstacles(this);
-
-	_sceneScript = new SceneScript(this);
-
-	_debugger = new Debugger(this);
-	setDebugger(_debugger);
 
 	// This is the original startup in the game
-	_surfaceFront.create(kOriginalGameWidth, kOriginalGameHeight, screenPixelFormat());
+	_surfaceFront.create(_system->getWidth(), _system->getHeight(), screenPixelFormat());
 	_surfaceFrontCreated = true;
-	_surfaceBack.create(kOriginalGameWidth, kOriginalGameHeight, screenPixelFormat());
+	_surfaceBack.create(_system->getWidth(), _system->getHeight(), screenPixelFormat());
 	_surfaceBackCreated = true;
 
 	_time = new Time(this);
@@ -575,47 +596,6 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
 		debug("Download SUBTITLES.MIX from ScummVM's website to enable subtitles");
 	}
 
-	bool r = openArchive("STARTUP.MIX");
-	if (!r)
-		return false;
-
-	_gameInfo = new GameInfo(this);
-	if (!_gameInfo)
-		return false;
-
-	r = _gameInfo->open("GAMEINFO.DAT");
-	if (!r) {
-		return false;
-	}
-
-	if (hasSavegames) {
-		if (!loadSplash()) {
-			return false;
-		}
-	}
-
-	_waypoints = new Waypoints(this, _gameInfo->getWaypointCount());
-
-	_combat = new Combat(this);
-
-	_gameVars = new int[_gameInfo->getGlobalVarCount()]();
-
-	// Seed rand
-
-	_cosTable1024 = new Common::CosineTable(1024); // 10-bits = 1024 points for 2*PI;
-	_sinTable1024 = new Common::SineTable(1024);
-
-	_view = new View();
-
-	_sceneObjects = new SceneObjects(this, _view);
-
-	_gameFlags = new GameFlags();
-	_gameFlags->setFlagCount(_gameInfo->getFlagCount());
-
-	_items = new Items(this);
-
-	_audioCache = new AudioCache();
-
 	_audioMixer = new AudioMixer(this);
 
 	_audioPlayer = new AudioPlayer(this);
@@ -643,127 +623,201 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
 	//
 	syncSoundSettings();
 
-	_chapters = new Chapters(this);
-	if (!_chapters)
-		return false;
+	if (!_isNonInteractiveDemo) {
+		ConfMan.registerDefault("subtitles", "true");
+		ConfMan.registerDefault("sitcom", "false");
+		ConfMan.registerDefault("shorty", "false");
+		ConfMan.registerDefault("disable_stamina_drain", "false");
 
-	if (!openArchive("MUSIC.MIX"))
-		return false;
+		_sitcomMode                = ConfMan.getBool("sitcom");
+		_shortyMode                = ConfMan.getBool("shorty");
+		_disableStaminaDrain       = ConfMan.getBool("disable_stamina_drain");
 
-	if (!openArchive("SFX.MIX"))
-		return false;
+		// These are static objects in original game
+		_screenEffects = new ScreenEffects(this, 0x8000);
 
-	if (!openArchive("SPCHSFX.TLK"))
-		return false;
+		_endCredits = new EndCredits(this);
 
-	_overlays = new Overlays(this);
-	_overlays->init();
+		_actorDialogueQueue = new ActorDialogueQueue(this);
 
-	_zbuffer = new ZBuffer();
-	_zbuffer->init(kOriginalGameWidth, kOriginalGameHeight);
+		_settings = new Settings(this);
 
-	int actorCount = (int)_gameInfo->getActorCount();
-	assert(actorCount < kActorCount);
-	for (int i = 0; i != actorCount; ++i) {
-		_actors[i] = new Actor(this, i);
-	}
-	_actors[kActorVoiceOver] = new Actor(this, kActorVoiceOver);
-	_playerActor = _actors[_gameInfo->getPlayerId()];
+		_itemPickup = new ItemPickup(this);
 
-	_playerActor->setFPS(15); // this seems redundant
+		_lights = new Lights(this);
+
+		// outtake player was initialized here in the original game - but this is done bit differently
+
+		_obstacles = new Obstacles(this);
+
+		_sceneScript = new SceneScript(this);
+
+		_debugger = new Debugger(this);
+		setDebugger(_debugger);
+
+		bool r = openArchive("STARTUP.MIX");
+		if (!r)
+			return false;
+
+		_gameInfo = new GameInfo(this);
+		if (!_gameInfo)
+			return false;
+
+		r = _gameInfo->open("GAMEINFO.DAT");
+		if (!r) {
+			return false;
+		}
+
+		if (hasSavegames) {
+			if (!loadSplash()) {
+				return false;
+			}
+		}
+
+		_waypoints = new Waypoints(this, _gameInfo->getWaypointCount());
+
+		_combat = new Combat(this);
+
+		_gameVars = new int[_gameInfo->getGlobalVarCount()]();
+
+		// Seed rand
+
+		_cosTable1024 = new Common::CosineTable(1024); // 10-bits = 1024 points for 2*PI;
+		_sinTable1024 = new Common::SineTable(1024);
+
+		_view = new View();
+
+		_sceneObjects = new SceneObjects(this, _view);
+
+		_gameFlags = new GameFlags();
+		_gameFlags->setFlagCount(_gameInfo->getFlagCount());
+
+		_items = new Items(this);
+
+		_audioCache = new AudioCache();
+
+		_chapters = new Chapters(this);
+		if (!_chapters)
+			return false;
+
+		if (!openArchive("MUSIC.MIX"))
+			return false;
+
+		if (!openArchive("SFX.MIX"))
+			return false;
+
+		if (!openArchive("SPCHSFX.TLK"))
+			return false;
+
+		_overlays = new Overlays(this);
+		_overlays->init();
+
+		_zbuffer = new ZBuffer();
+		_zbuffer->init(kOriginalGameWidth, kOriginalGameHeight);
+
+		int actorCount = (int)_gameInfo->getActorCount();
+		assert(actorCount < kActorCount);
+		for (int i = 0; i != actorCount; ++i) {
+			_actors[i] = new Actor(this, i);
+		}
+		_actors[kActorVoiceOver] = new Actor(this, kActorVoiceOver);
+		_playerActor = _actors[_gameInfo->getPlayerId()];
+
+		_playerActor->setFPS(15); // this seems redundant
 #if BLADERUNNER_ORIGINAL_BUGS
-	_playerActor->timerStart(kActorTimerRunningStaminaFPS, 200);
-#else
-	// Make code here similar to the bugfix in newGame in that
-	// we only start the timer in vanilla game mode (not Restored Content mode)
-	if (!_cutContent) {
 		_playerActor->timerStart(kActorTimerRunningStaminaFPS, 200);
-	}
+#else
+		// Make code here similar to the bugfix in newGame in that
+		// we only start the timer in vanilla game mode (not Restored Content mode)
+		if (!_cutContent) {
+			_playerActor->timerStart(kActorTimerRunningStaminaFPS, 200);
+		}
 #endif // BLADERUNNER_ORIGINAL_BUGS
 
-	_policeMaze = new PoliceMaze(this);
+		_policeMaze = new PoliceMaze(this);
 
-	_textActorNames = new TextResource(this);
-	if (!_textActorNames->open("ACTORS"))
-		return false;
+		_textActorNames = new TextResource(this);
+		if (!_textActorNames->open("ACTORS"))
+			return false;
 
-	_textCrimes = new TextResource(this);
-	if (!_textCrimes->open("CRIMES"))
-		return false;
+		_textCrimes = new TextResource(this);
+		if (!_textCrimes->open("CRIMES"))
+			return false;
 
-	_textClueTypes = new TextResource(this);
-	if (!_textClueTypes->open("CLUETYPE"))
-		return false;
+		_textClueTypes = new TextResource(this);
+		if (!_textClueTypes->open("CLUETYPE"))
+			return false;
 
-	_textKIA = new TextResource(this);
-	if (!_textKIA->open("KIA"))
-		return false;
+		_textKIA = new TextResource(this);
+		if (!_textKIA->open("KIA"))
+			return false;
 
-	_textSpinnerDestinations = new TextResource(this);
-	if (!_textSpinnerDestinations->open("SPINDEST"))
-		return false;
+		_textSpinnerDestinations = new TextResource(this);
+		if (!_textSpinnerDestinations->open("SPINDEST"))
+			return false;
 
-	_textVK = new TextResource(this);
-	if (!_textVK->open("VK"))
-		return false;
+		_textVK = new TextResource(this);
+		if (!_textVK->open("VK"))
+			return false;
 
-	_textOptions = new TextResource(this);
-	if (!_textOptions->open("OPTIONS"))
-		return false;
+		_textOptions = new TextResource(this);
+		if (!_textOptions->open("OPTIONS"))
+			return false;
 
-	_russianCP1251 = ((uint8)_textOptions->getText(0)[0]) == 209;
+		_russianCP1251 = ((uint8)_textOptions->getText(0)[0]) == 209;
 
-	_dialogueMenu = new DialogueMenu(this);
-	if (!_dialogueMenu->loadResources())
-		return false;
+		_dialogueMenu = new DialogueMenu(this);
+		if (!_dialogueMenu->loadResources())
+			return false;
 
-	_suspectsDatabase = new SuspectsDatabase(this, _gameInfo->getSuspectCount());
+		_suspectsDatabase = new SuspectsDatabase(this, _gameInfo->getSuspectCount());
 
-	_kia = new KIA(this);
+		_kia = new KIA(this);
 
-	_spinner = new Spinner(this);
+		_spinner = new Spinner(this);
 
-	_elevator = new Elevator(this);
+		_elevator = new Elevator(this);
 
-	_scores = new Scores(this);
+		_scores = new Scores(this);
 
-	_mainFont = Font::load(this, "KIA6PT.FON", 1, false);
+		_mainFont = Font::load(this, "KIA6PT.FON", 1, false);
 
-	_shapes = new Shapes(this);
-	_shapes->load("SHAPES.SHP");
+		_shapes = new Shapes(this);
+		_shapes->load("SHAPES.SHP");
 
-	_esper = new ESPER(this);
+		_esper = new ESPER(this);
 
-	_vk = new VK(this);
+		_vk = new VK(this);
 
-	_mouse = new Mouse(this);
-	_mouse->setCursor(0);
+		_mouse = new Mouse(this);
+		_mouse->setCursor(0);
 
-	_sliceAnimations = new SliceAnimations(this);
-	r = _sliceAnimations->open("INDEX.DAT");
-	if (!r)
-		return false;
+		_sliceAnimations = new SliceAnimations(this);
+		r = _sliceAnimations->open("INDEX.DAT");
+		if (!r)
+			return false;
 
-	r = _sliceAnimations->openCoreAnim();
-	if (!r) {
-		return false;
-	}
+		r = _sliceAnimations->openCoreAnim();
+		if (!r) {
+			return false;
+		}
 
-	_sliceRenderer = new SliceRenderer(this);
-	_sliceRenderer->setScreenEffects(_screenEffects);
+		_sliceRenderer = new SliceRenderer(this);
+		_sliceRenderer->setScreenEffects(_screenEffects);
 
-	_crimesDatabase = new CrimesDatabase(this, "CLUES", _gameInfo->getClueCount());
+		_crimesDatabase = new CrimesDatabase(this, "CLUES", _gameInfo->getClueCount());
 
-	_scene = new Scene(this);
+		_scene = new Scene(this);
 
-	// Load INIT.DLL
-	InitScript initScript(this);
-	initScript.SCRIPT_Initialize_Game();
+		// Load INIT.DLL
+		InitScript initScript(this);
+		initScript.SCRIPT_Initialize_Game();
 
-	// Load AI-ACT1.DLL
-	_aiScripts = new AIScripts(this, actorCount);
+		// Load AI-ACT1.DLL
+		_aiScripts = new AIScripts(this, actorCount);
 
-	initChapterAndScene();
+		initChapterAndScene();
+	}
 	return true;
 }
 
diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h
index 3988e91ea9f..acaf997b9a4 100644
--- a/engines/bladerunner/bladerunner.h
+++ b/engines/bladerunner/bladerunner.h
@@ -115,6 +115,8 @@ public:
 
 	static const int16 kOriginalGameWidth  = 640;
 	static const int16 kOriginalGameHeight = 480;
+	static const int16 kDemoGameWidth      = 320;
+	static const int16 kDemoGameHeight     = 200;
 
 	// Incremental number to keep track of significant revisions of the ScummVM bladerunner engine
 	// that could potentially introduce incompatibilities with old save files or require special actions to restore compatibility
@@ -262,6 +264,8 @@ public:
 
 	uint32 _timeOfMainGameLoopTickPrevious;
 
+	bool _isNonInteractiveDemo;
+
 	// This addon is to emulate keeping a keyboard key pressed (continuous / repeated firing of the event)
 	// -- code is pretty much identical from our common\events.cpp (KeyboardRepeatEventSourceWrapper)
 	// for continuous events (keyDown)
diff --git a/engines/bladerunner/detection.cpp b/engines/bladerunner/detection.cpp
index 60d89491aed..6b8c1a0054d 100644
--- a/engines/bladerunner/detection.cpp
+++ b/engines/bladerunner/detection.cpp
@@ -121,7 +121,17 @@ BladeRunnerMetaEngineDetection::BladeRunnerMetaEngineDetection()
 		BladeRunner::gameDescriptions,
 		sizeof(BladeRunner::gameDescriptions[0]),
 		BladeRunner::bladeRunnerGames,
-		BladeRunner::optionsList) {}
+		BladeRunner::optionsList) {
+		// Setting this, allows the demo files to be copied in the BladeRunner
+		// game data folder and be detected and subsequently launched without
+		// any issues (eg. like ScummVM launching Blade Runner instead of the demo).
+		// Although the demo files are not part of the original game's installation
+		// or CD content, it's nice to support the use case whereby the user
+		// manually copies the demo files in the Blade Runner game data folder
+		// and expects ScummVM to detect both, offer a choice on which to add,
+		// and finally launch the proper one depending on which was added.
+		_flags = kADFlagUseExtraAsHint;
+}
 
 const char *BladeRunnerMetaEngineDetection::getEngineId() const {
 	return "bladerunner";
diff --git a/engines/bladerunner/detection_tables.h b/engines/bladerunner/detection_tables.h
index fbdb9bc868a..69ea2c19c77 100644
--- a/engines/bladerunner/detection_tables.h
+++ b/engines/bladerunner/detection_tables.h
@@ -37,7 +37,7 @@ static const ADGameDescription gameDescriptions[] = {
 	// BladeRunner (English) - ENG
 	{
 		"bladerunner",
-		0,
+		"",
 		AD_ENTRY1s("STARTUP.MIX", "5643b53306ca7764cf1ec7b79c9630a3", 2312374),
 		Common::EN_ANY,
 		Common::kPlatformWindows,
@@ -48,7 +48,7 @@ static const ADGameDescription gameDescriptions[] = {
 	// BladeRunner (German) - DEU
 	{
 		"bladerunner",
-		0,
+		"",
 		AD_ENTRY1s("STARTUP.MIX", "57d674ed860148a530b7f4957cbe65ec", 2314301),
 		Common::DE_DEU,
 		Common::kPlatformWindows,
@@ -59,7 +59,7 @@ static const ADGameDescription gameDescriptions[] = {
 	// BladeRunner (French) - FRA - Bug #9722
 	{
 		"bladerunner",
-		0,
+		"",
 		AD_ENTRY1s("STARTUP.MIX", "39d1901df50935d58aee252707134952", 2314526),
 		Common::FR_FRA,
 		Common::kPlatformWindows,
@@ -70,7 +70,7 @@ static const ADGameDescription gameDescriptions[] = {
 	// BladeRunner (Italian) - ITA
 	{
 		"bladerunner",
-		0,
+		"",
 		AD_ENTRY1s("STARTUP.MIX", "c7ceb9c691223d25e78516aa519ff504", 2314461),
 		Common::IT_ITA,
 		Common::kPlatformWindows,
@@ -81,7 +81,7 @@ static const ADGameDescription gameDescriptions[] = {
 	// BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc.) - RUS
 	{
 		"bladerunner",
-		0,
+		"",
 		AD_ENTRY1s("STARTUP.MIX", "bf42af841d9f4b643665013a348c81e0", 2483111),
 		Common::RU_RUS,
 		Common::kPlatformWindows,
@@ -114,7 +114,7 @@ static const ADGameDescription gameDescriptions[] = {
 	// BladeRunner (Spanish) - ESP
 	{
 		"bladerunner",
-		0,
+		"",
 		AD_ENTRY1s("STARTUP.MIX", "54cad53da9e4ae03a85648834ac6765d", 2312976),
 		Common::ES_ESP,
 		Common::kPlatformWindows,
@@ -139,7 +139,7 @@ static const ADGameDescription gameDescriptions[] = {
 	// BladeRunner (English) - ENG
 	{
 		"bladerunner-final",
-		0,
+		"",
 		AD_ENTRY1s("STARTUP.MIX", "5643b53306ca7764cf1ec7b79c9630a3", 2312374),
 		Common::EN_ANY,
 		Common::kPlatformWindows,
@@ -150,7 +150,7 @@ static const ADGameDescription gameDescriptions[] = {
 	// BladeRunner (German) - DEU
 	{
 		"bladerunner-final",
-		0,
+		"",
 		AD_ENTRY1s("STARTUP.MIX", "57d674ed860148a530b7f4957cbe65ec", 2314301),
 		Common::DE_DEU,
 		Common::kPlatformWindows,
@@ -161,7 +161,7 @@ static const ADGameDescription gameDescriptions[] = {
 	// BladeRunner (French) - FRA
 	{
 		"bladerunner-final",
-		0,
+		"",
 		AD_ENTRY1s("STARTUP.MIX", "39d1901df50935d58aee252707134952", 2314526),
 		Common::FR_FRA,
 		Common::kPlatformWindows,
@@ -172,7 +172,7 @@ static const ADGameDescription gameDescriptions[] = {
 	// BladeRunner (Italian) - ITA
 	{
 		"bladerunner-final",
-		0,
+		"",
 		AD_ENTRY1s("STARTUP.MIX", "c7ceb9c691223d25e78516aa519ff504", 2314461),
 		Common::IT_ITA,
 		Common::kPlatformWindows,
@@ -183,7 +183,7 @@ static const ADGameDescription gameDescriptions[] = {
 	// BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc.) - RUS
 	{
 		"bladerunner-final",
-		0,
+		"",
 		AD_ENTRY1s("STARTUP.MIX", "bf42af841d9f4b643665013a348c81e0", 2483111),
 		Common::RU_RUS,
 		Common::kPlatformWindows,
@@ -194,7 +194,7 @@ static const ADGameDescription gameDescriptions[] = {
 	// BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc. + Siberian Studio, R3) - RUS
 	{
 		"bladerunner-final",
-		0,
+		"",
 		AD_ENTRY1s("STARTUP.MIX", "c198b54a5366b88b1734bbca21d3b192", 2678672),
 		Common::RU_RUS,
 		Common::kPlatformWindows,
@@ -205,7 +205,7 @@ static const ADGameDescription gameDescriptions[] = {
 	// BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc. + Siberian Studio, R4) - RUS
 	{
 		"bladerunner-final",
-		0,
+		"",
 		AD_ENTRY1s("STARTUP.MIX", "d62498a7415682bb3ff86a894303c836", 2810053),
 		Common::RU_RUS,
 		Common::kPlatformWindows,
@@ -216,7 +216,7 @@ static const ADGameDescription gameDescriptions[] = {
 	// BladeRunner (Spanish) - ESP
 	{
 		"bladerunner-final",
-		0,
+		"",
 		AD_ENTRY1s("STARTUP.MIX", "54cad53da9e4ae03a85648834ac6765d", 2312976),
 		Common::ES_ESP,
 		Common::kPlatformWindows,
@@ -224,6 +224,19 @@ static const ADGameDescription gameDescriptions[] = {
 		GUIO6(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS, GAMEOPTION_FRAMELIMITER_FPS, GAMEOPTION_DISABLE_STAMINA_DRAIN, GUIO_NOMIDI)
 	},
 
+	// Demo Version(s)
+
+	// BladeRunner (VQA/VQP Teaser) - Non-interactive demo
+	{
+		"bladerunner",
+		"Non-Interactive Demo",
+		AD_ENTRY1s("SIZZLE2.VQA", "2979892996f9f6fafb06c0cd72fc1025", 14386668),
+		Common::EN_ANY,
+		Common::kPlatformWindows,
+		ADGF_DEMO,
+		GUIO3(GAMEOPTION_FRAMELIMITER_NODELAYMILLIS, GAMEOPTION_FRAMELIMITER_FPS, GUIO_NOMIDI)
+	},
+
 	AD_TABLE_END_MARKER
 };
 




More information about the Scummvm-git-logs mailing list