[Scummvm-git-logs] scummvm master -> 6902ea4654c419c99a764ab8dbdacbb71af3cd0f

yuv422 noreply at scummvm.org
Sat Nov 16 01:58:33 UTC 2024


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

Summary:
25254585ad DARKSEED: Add more missing sfx
b156f836f4 DARKSEED: Add won game logic
cc94491aed DARKSEED: Stop sfx when shower sequence is done.
988f4bf0a7 DARKSEED: Fix valves and face animation in nightmare3 cutscene
7fd61521fe DARKSEED: Add searchTos debug console command. This searches for tos strings matching a given input string.
6902ea4654 DARKSEED: Add DOS floppy speech


Commit: 25254585adb009f9044b967978e6abfdf2373b14
    https://github.com/scummvm/scummvm/commit/25254585adb009f9044b967978e6abfdf2373b14
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2024-11-16T12:55:18+11:00

Commit Message:
DARKSEED: Add more missing sfx

Changed paths:
    engines/darkseed/animation.cpp
    engines/darkseed/darkseed.cpp
    engines/darkseed/darkseed.h
    engines/darkseed/inventory.cpp
    engines/darkseed/usecode.cpp


diff --git a/engines/darkseed/animation.cpp b/engines/darkseed/animation.cpp
index 8fa40b37a5e..6f32681c40b 100644
--- a/engines/darkseed/animation.cpp
+++ b/engines/darkseed/animation.cpp
@@ -251,6 +251,7 @@ void Animation::updateAnimation() {
 		}
 		if (_frameAdvanced && ((currentRoomNumber == 6 && _animIndexTbl[1] == 1) || (currentRoomNumber == 5 && _animIndexTbl[2] == 1))) {
 			//			FUN_1208_0dacg_engine->_sound_related(0xd,CONCAT11(uVar4,5));
+			g_engine->playSound(4, 5, -1);
 		}
 		if (!_objRestarted) {
 			if (currentRoomNumber == 6) {
@@ -273,6 +274,7 @@ void Animation::updateAnimation() {
 			advanceAnimationFrame(3);
 			if (_frameAdvanced && _animIndexTbl[3] == 1) {
 				// FUN_1208_0dacg_engine->_sound_related(0xd,CONCAT11(extraout_AH_05,5));
+				g_engine->playSound(4, 5, -1);
 			}
 			if (!_objRestarted) {
 				_player->_frameIdx = _player->_animations.getAnimAt(3)._frameNo[_player->_animations.getAnimAt(3)._frameNo[_animIndexTbl[3]]];
@@ -284,6 +286,7 @@ void Animation::updateAnimation() {
 			advanceAnimationFrame(0);
 			if (_frameAdvanced && _animIndexTbl[0] == 1) {
 				// FUN_1208_0dacg_engine->_sound_related(0xd,CONCAT11(extraout_AH_05,5));
+				g_engine->playSound(4, 5, -1);
 			}
 			if (!_objRestarted) {
 				_player->_frameIdx = _player->_animations.getAnimAt(0)._frameNo[_player->_animations.getAnimAt(0)._frameNo[_animIndexTbl[0]]];
@@ -542,11 +545,21 @@ void Animation::updateAnimation() {
 	}
 	case 32:
 	case 33:
-	case 34: {
+	case 34: { // Take medicine from cabinet
 		_objectVar[112] = 1;
 		int animIdx = _otherNspAnimationType_maybe - 30;
 		advanceAnimationFrame(animIdx);
-		// TODO play sfx.
+		if (_frameAdvanced) {
+			if (_otherNspAnimationType_maybe == 33) {
+				if (_animIndexTbl[animIdx] == 12) {
+					g_engine->playSound(35, 5, -1); // water
+				}
+			} else if (_otherNspAnimationType_maybe == 32) {
+				if (_animIndexTbl[animIdx] == 1 || _animIndexTbl[animIdx] == 18) {
+					g_engine->playSound(34, 5, -1); // open / close cabinet
+				}
+			}
+		}
 		if (_isPlayingAnimation_maybe) {
 			_player->_frameIdx = _player->_animations.getAnimAt(animIdx)._frameNo[_animIndexTbl[animIdx]];
 		}
@@ -653,6 +666,9 @@ void Animation::updateAnimation() {
 		advanceAnimationFrame(iVar4);
 		_player->_frameIdx = _player->_animations.getAnimAt(iVar4)._frameNo[_player->_animations.getAnimAt(iVar4)._frameNo[_animIndexTbl[iVar4]]];
 		//		_HeroSpr = (uint) * (byte *)((int)&DAT_1060_7eb8 + *(int *)((int)&_ObjFrame + iVar4 * 2) + iVar4 * 202);
+		if (_frameAdvanced && _animIndexTbl[iVar4] == 3) { // TODO should we add this conditionally? This logic was missing from the original game. I assume they just forgot to add the sfx.
+			g_engine->playSound(8, 5, -1); // pull lever sound.
+		}
 		if (!_objRestarted || (_otherNspAnimationType_maybe != 46 && _otherNspAnimationType_maybe != 44)) {
 			if (_otherNspAnimationType_maybe == 45) {
 				_objectVar[117] = 1;
@@ -728,9 +744,9 @@ void Animation::updateAnimation() {
 				break;
 			}
 		}
-		if (_frameAdvanced && _animIndexTbl[0] == 1) {
+		if (_otherNspAnimationType_maybe == 55 && _frameAdvanced && _animIndexTbl[stairsIdx] == 4) {
 			// FUN_1208_0dacg_engine->_sound_related(0xd,CONCAT11(extraout_AH_05,5));
-			// PlaySound(1,5,-1);
+			g_engine->playSound(1, 5, -1); //open door to police station
 		}
 		break;
 	}
@@ -798,6 +814,9 @@ void Animation::updateAnimation() {
 				g_engine->_console->addTextLine("The cops ignore your demands for attention.");
 			}
 		}
+		if (_frameAdvanced && _player->_frameIdx == 1) {
+			g_engine->playSound(22, 5, -1);
+		}
 		break;
 	case 65:
 		advanceAnimationFrame(0);
diff --git a/engines/darkseed/darkseed.cpp b/engines/darkseed/darkseed.cpp
index d1ce5e57d2e..fa980f7146f 100644
--- a/engines/darkseed/darkseed.cpp
+++ b/engines/darkseed/darkseed.cpp
@@ -748,6 +748,7 @@ void DarkseedEngine::handleInput() {
 						_player->loadAnimations("opendoor.nsp");
 						_animation->setupOtherNspAnimation(0, 14);
 						// FUN_1208_0dac_sound_related(10,CONCAT11(extraout_AH,5));
+						playSound(1, 5, -1);
 						return;
 					}
 					if (currentRoomNumber == 6 && roomExit.roomNumber == 5 && bVar) {
@@ -761,6 +762,7 @@ void DarkseedEngine::handleInput() {
 						_player->loadAnimations("opendoor.nsp");
 						_animation->setupOtherNspAnimation(0, 25);
 						// FUN_1208_0dac_sound_related(24,CONCAT11(extraout_AH,5));
+						playSound(15, 5, -1); //open car door
 						return;
 					}
 					if (currentRoomNumber == 5 && roomExit.roomNumber == 6 && bVar) {
@@ -2589,4 +2591,15 @@ void DarkseedEngine::waitForSpeech() {
 	}
 }
 
+void DarkseedEngine::waitForSpeechOrSfx() {
+	while (_sound && (_sound->isPlayingSpeech() || _sound->isPlayingSfx())) {
+		updateEvents();
+		if (_room) {
+			_room->update();
+		}
+		_screen->update();
+		wait();
+	}
+}
+
 } // End of namespace Darkseed
diff --git a/engines/darkseed/darkseed.h b/engines/darkseed/darkseed.h
index 338a6cd7610..90bfad8b851 100644
--- a/engines/darkseed/darkseed.h
+++ b/engines/darkseed/darkseed.h
@@ -152,6 +152,7 @@ public:
 	void wait();
 
 	void waitForSpeech();
+	void waitForSpeechOrSfx();
 
 	void syncSoundSettings() override;
 
diff --git a/engines/darkseed/inventory.cpp b/engines/darkseed/inventory.cpp
index db0cc942801..206105cfe3f 100644
--- a/engines/darkseed/inventory.cpp
+++ b/engines/darkseed/inventory.cpp
@@ -134,6 +134,7 @@ void Inventory::handleClick() {
 	}
 	int iconIdx = (clickPos.x - 140) / 37;
 	int icon = _iconList[iconIdx];
+	g_engine->playSound(5, 4, -1);
 	if (icon == 42) {
 		leftArrowClicked();
 	} else if (icon == 43) {
diff --git a/engines/darkseed/usecode.cpp b/engines/darkseed/usecode.cpp
index de1e7881eb4..d04934e41ef 100644
--- a/engines/darkseed/usecode.cpp
+++ b/engines/darkseed/usecode.cpp
@@ -260,11 +260,9 @@ void Darkseed::UseCode::useCode(int objNum) {
 	if ((162 < objNum) && (objNum < 169)) {
 		g_engine->playSound(47, 5, -1);
 	}
-	if (objNum == 175) {
+	if (objNum == 175) { // car horn
 		g_engine->playSound(39, 5, -1);
-		//		while (iVar2 = VOCPlaying(), iVar2 != 0) {
-		//			VOCPoll();
-		//		}
+		g_engine->waitForSpeechOrSfx();
 		_console->printTosText(719);
 		return;
 	}


Commit: b156f836f4942f276938a2b2424b081dc12a9ee9
    https://github.com/scummvm/scummvm/commit/b156f836f4942f276938a2b2424b081dc12a9ee9
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2024-11-16T12:55:18+11:00

Commit Message:
DARKSEED: Add won game logic

Changed paths:
    engines/darkseed/animation.cpp
    engines/darkseed/animation.h
    engines/darkseed/darkseed.cpp
    engines/darkseed/darkseed.h
    engines/darkseed/sound.cpp
    engines/darkseed/sound.h


diff --git a/engines/darkseed/animation.cpp b/engines/darkseed/animation.cpp
index 6f32681c40b..f9e946f5119 100644
--- a/engines/darkseed/animation.cpp
+++ b/engines/darkseed/animation.cpp
@@ -469,13 +469,13 @@ void Animation::updateAnimation() {
 		} else {
 			_player->updateSprite();
 			if (_otherNspAnimationType_maybe == 14) {
-				// TODO
 				if (_objectVar.getObjectRunningCode(140) == 0 || g_engine->_room->_roomNumber != 6) {
 					g_engine->_previousRoomNumber = g_engine->_room->_roomNumber;
 					int newRoomNumber;
 					if (g_engine->_room->_roomNumber == 6) {
 						if (_player->_isAutoWalkingToBed && _objectVar[137] == 2) {
-							g_engine->wonGame();
+							wonGame();
+							return;
 						}
 						newRoomNumber = 10;
 					} else if (g_engine->_room->_roomNumber == 10) {
@@ -1327,4 +1327,76 @@ void Animation::libAnim(bool pickingUpReservedBook) {
 	}
 }
 
+void Animation::wonGame() {
+	_player->loadAnimations("libparts.nsp");
+	g_engine->_room->loadLocationSprites("libmorph.nsp");
+	g_engine->showFullscreenPic("lib_babe.pic");
+
+	g_engine->_cursor.showCursor(false);
+	g_engine->_console->printTosText(925);
+
+	_animIndexTbl[0] = 0;
+	_spriteAnimCountdownTimer[0] = _player->_animations.getAnimAt(0)._frameDuration[0];
+	int counter = 68;
+	uint8 lipsIdx = 0;
+
+	while (counter < 70) {
+		g_engine->_sprites.clearSpriteDrawList();
+
+		g_engine->drawFullscreenPic();
+		g_engine->_console->draw();
+
+		if (!g_engine->_sound->isPlayingSpeech()) {
+			counter++;
+			if (counter == 69) {
+				g_engine->_console->printTosText(926);
+			}
+		}
+		g_engine->_animation->advanceAnimationFrame(0);
+		const Sprite &eyesSprite = _player->_animations.getSpriteAt(_player->_animations.getAnimAt(0)._frameNo[_animIndexTbl[0]]);
+		g_engine->_sprites.addSpriteToDrawList(255, 114, &eyesSprite, 255, eyesSprite._width, eyesSprite._height, false);
+		g_engine->_animation->advanceAnimationFrame(1);
+
+		const Sprite &mouthSprite = _player->_animations.getSpriteAt(libList[lipsIdx]);
+		g_engine->_sprites.addSpriteToDrawList(255, 154, &mouthSprite, 255, mouthSprite._width, mouthSprite._height, false);
+
+		g_engine->_sprites.drawSprites();
+
+		g_engine->_screen->makeAllDirty();
+		g_engine->_screen->update();
+
+		lipsIdx++;
+		if (lipsIdx == 100) {
+			lipsIdx = 0;
+		}
+
+		g_system->delayMillis(50);
+	}
+
+	_objRestarted = false;
+	while (!_objRestarted) {
+		g_engine->_sprites.clearSpriteDrawList();
+		g_engine->_room->advanceFrame(0);
+		const Sprite &headMorph = g_engine->_room->_locationSprites.getSpriteAt(g_engine->_room->_locationSprites.getAnimAt(0)._frameNo[g_engine->_room->_locObjFrame[0]]);
+		g_engine->_sprites.addSpriteToDrawList(227, 50, &headMorph, 255, headMorph._width, headMorph._height, false);
+
+		g_engine->_sprites.drawSprites();
+
+		g_engine->_screen->makeAllDirty();
+		g_engine->_screen->update();
+		g_system->delayMillis(30);
+	}
+	g_engine->_console->printTosText(918);
+	g_engine->_sound->playMusic(MusicId::kVictory, false);
+	g_engine->showFullscreenPic("wonpic.pic");
+	g_engine->_console->draw();
+	g_engine->_screen->makeAllDirty();
+	g_engine->_screen->update();
+
+	while (g_engine->_sound->isPlayingMusic() && !g_engine->shouldQuit()) {
+		g_engine->waitxticks(1);
+	}
+	g_engine->_cutscene.play('Z');
+}
+
 } // End of namespace Darkseed
diff --git a/engines/darkseed/animation.h b/engines/darkseed/animation.h
index 3dbaee00fb0..0e06a19a90f 100644
--- a/engines/darkseed/animation.h
+++ b/engines/darkseed/animation.h
@@ -60,6 +60,7 @@ public:
 	void setupOtherNspAnimation(int nspAnimIdx, int animId);
 private:
 	void adddrekbutt();
+	void wonGame();
 };
 
 } // End of namespace Darkseed
diff --git a/engines/darkseed/darkseed.cpp b/engines/darkseed/darkseed.cpp
index fa980f7146f..33a25e94d42 100644
--- a/engines/darkseed/darkseed.cpp
+++ b/engines/darkseed/darkseed.cpp
@@ -1895,11 +1895,6 @@ void DarkseedEngine::lookCode(int objNum) {
 	_console->addTextLine(Common::String::format("You see the %s.", _objectVar.getObjectName(objNum)));
 }
 
-void DarkseedEngine::wonGame() {
-	error("implement wonGame()"); // TODO
-	//	_cutscene.play('Z');
-}
-
 void DarkseedEngine::printTime() {
 	_console->printTosText(958);
 	int hour = g_engine->_currentTimeInSeconds / 60 / 60 + 1;
diff --git a/engines/darkseed/darkseed.h b/engines/darkseed/darkseed.h
index 90bfad8b851..dcb73094f09 100644
--- a/engines/darkseed/darkseed.h
+++ b/engines/darkseed/darkseed.h
@@ -145,8 +145,6 @@ public:
 
 	void playDayChangeCutscene();
 
-	void wonGame();
-
 	void removeFullscreenPic();
 
 	void wait();
diff --git a/engines/darkseed/sound.cpp b/engines/darkseed/sound.cpp
index b97cc2fffce..d2b55ebe1c2 100644
--- a/engines/darkseed/sound.cpp
+++ b/engines/darkseed/sound.cpp
@@ -180,7 +180,7 @@ void Sound::resetSpeech() {
 	}
 }
 
-void Sound::playMusic(MusicId musicId) {
+void Sound::playMusic(MusicId musicId, bool loop) {
 	if (musicId == MusicId::kNone) {
 		return;
 	}
@@ -188,7 +188,7 @@ void Sound::playMusic(MusicId musicId) {
 	playMusic(g_engine->isCdVersion()
 		? musicDosCDFilenameTbl[filenameIdx]
 		: musicDosFloppyFilenameTbl[filenameIdx],
-		true);
+		loop);
 }
 
 void Sound::playMusic(StartMusicId musicId) {
diff --git a/engines/darkseed/sound.h b/engines/darkseed/sound.h
index 9fe6d5ec93c..c1b7b6f6b26 100644
--- a/engines/darkseed/sound.h
+++ b/engines/darkseed/sound.h
@@ -77,7 +77,7 @@ public:
 	bool isPlayingSfx() const;
 	bool isPlayingMusic();
 	void resetSpeech();
-	void playMusic(MusicId musicId);
+	void playMusic(MusicId musicId, bool loop = true);
 	void playMusic(StartMusicId musicId);
 	void playMusic(Common::String const &filename, bool loop = false);
 	void stopMusic();


Commit: cc94491aed7a59f6dac433849ef3ce12dc24e59a
    https://github.com/scummvm/scummvm/commit/cc94491aed7a59f6dac433849ef3ce12dc24e59a
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2024-11-16T12:55:19+11:00

Commit Message:
DARKSEED: Stop sfx when shower sequence is done.

Changed paths:
    engines/darkseed/animation.cpp
    engines/darkseed/darkseed.cpp
    engines/darkseed/sound.cpp
    engines/darkseed/sound.h


diff --git a/engines/darkseed/animation.cpp b/engines/darkseed/animation.cpp
index f9e946f5119..ccacf293e2d 100644
--- a/engines/darkseed/animation.cpp
+++ b/engines/darkseed/animation.cpp
@@ -169,7 +169,7 @@ void Animation::updateAnimation() {
 			_player->updateSprite();
 		}
 		break;
-	case 2:
+	case 2: // shower
 		advanceAnimationFrame(0);
 		if (!_objRestarted) {
 			_player->_frameIdx = _player->_animations.getAnimAt(0)._frameNo[_player->_animations.getAnimAt(0)._frameNo[_animIndexTbl[0]]];
@@ -181,7 +181,7 @@ void Animation::updateAnimation() {
 			_player->_walkTarget.x = 218;
 			_player->_walkTarget.y = 198;
 			_objectVar[52] = 0;
-			//			StopVOC(); TODO
+			g_engine->_sound->stopSfx();
 		}
 		break;
 	case 3:
diff --git a/engines/darkseed/darkseed.cpp b/engines/darkseed/darkseed.cpp
index 33a25e94d42..cd3309c26f9 100644
--- a/engines/darkseed/darkseed.cpp
+++ b/engines/darkseed/darkseed.cpp
@@ -1941,7 +1941,6 @@ void DarkseedEngine::getPackageObj(int packageType) {
 }
 
 void DarkseedEngine::playSound(uint8 sfxId, uint8 unk1, int16 unk2) {
-	// TODO... play sound
 	debug("Play SFX: %d", sfxId);
 	_sound->playSfx(sfxId, unk1, unk2);
 }
diff --git a/engines/darkseed/sound.cpp b/engines/darkseed/sound.cpp
index d2b55ebe1c2..d65d11864b0 100644
--- a/engines/darkseed/sound.cpp
+++ b/engines/darkseed/sound.cpp
@@ -162,6 +162,10 @@ void Sound::playTosSpeech(int tosIdx) {
 	_didSpeech[tosIdx] = 1;
 }
 
+void Sound::stopSpeech() {
+	_mixer->stopHandle(_speechHandle);
+}
+
 bool Sound::isPlayingSpeech() const {
 	return _mixer->isSoundHandleActive(_speechHandle);
 }
@@ -223,6 +227,8 @@ void Sound::stopMusic() {
 
 void Sound::killAllSound() {
 	stopMusic();
+	stopSfx();
+	stopSpeech();
 }
 
 void Sound::syncSoundSettings() {
@@ -240,6 +246,10 @@ void Sound::playSfx(uint8 sfxId, int unk1, int unk2) {
 	}
 }
 
+void Sound::stopSfx() {
+	_mixer->stopHandle(_sfxHandle);
+}
+
 void Sound::playDosCDSfx(int sfxId) {
 	if (sfxId == 0) {
 		// TODO midi SFX
diff --git a/engines/darkseed/sound.h b/engines/darkseed/sound.h
index c1b7b6f6b26..5dad88fd221 100644
--- a/engines/darkseed/sound.h
+++ b/engines/darkseed/sound.h
@@ -73,6 +73,7 @@ public:
 	Common::Error sync(Common::Serializer &s);
 
 	void playTosSpeech(int tosIdx);
+	void stopSpeech();
 	bool isPlayingSpeech() const;
 	bool isPlayingSfx() const;
 	bool isPlayingMusic();
@@ -82,6 +83,7 @@ public:
 	void playMusic(Common::String const &filename, bool loop = false);
 	void stopMusic();
 	void playSfx(uint8 sfxId, int unk1, int unk2);
+	void stopSfx();
 	void syncSoundSettings();
 	void killAllSound();
 private:


Commit: 988f4bf0a7d2a0c5b236ae0b48b83ab7ed00b848
    https://github.com/scummvm/scummvm/commit/988f4bf0a7d2a0c5b236ae0b48b83ab7ed00b848
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2024-11-16T12:55:19+11:00

Commit Message:
DARKSEED: Fix valves and face animation in nightmare3 cutscene

Changed paths:
    engines/darkseed/anm.cpp
    engines/darkseed/anm.h
    engines/darkseed/cutscene.cpp
    engines/darkseed/cutscene.h
    engines/darkseed/img.cpp
    engines/darkseed/img.h


diff --git a/engines/darkseed/anm.cpp b/engines/darkseed/anm.cpp
index a3ecf75f564..e00177b7306 100644
--- a/engines/darkseed/anm.cpp
+++ b/engines/darkseed/anm.cpp
@@ -24,9 +24,7 @@
 
 namespace Darkseed {
 bool Anm::load(const Common::Path &filename, int deltaOffset) {
-	if (_file.isOpen()) {
-		_file.close();
-	}
+	close();
 	if (!_file.open(filename)) {
 		return false;
 	}
@@ -36,6 +34,12 @@ bool Anm::load(const Common::Path &filename, int deltaOffset) {
 	return true;
 }
 
+void Anm::close() {
+	if (_file.isOpen()) {
+		_file.close();
+	}
+}
+
 bool Anm::getImg(uint16 index, Img &img, bool includesPosition) {
 	_file.seek(4 + index * 2);
 	int offset = _file.readUint16LE() + _deltaOffset;
diff --git a/engines/darkseed/anm.h b/engines/darkseed/anm.h
index 876a05a9866..505119036f7 100644
--- a/engines/darkseed/anm.h
+++ b/engines/darkseed/anm.h
@@ -36,6 +36,7 @@ private:
 
 public:
 	bool load(const Common::Path &filename, int deltaOffset = 0);
+	void close();
 	bool getImg(uint16 index, Img &img, bool includesPosition = true);
 	int numImages() const;
 };
diff --git a/engines/darkseed/cutscene.cpp b/engines/darkseed/cutscene.cpp
index 1a842348ad8..f93ed641e55 100644
--- a/engines/darkseed/cutscene.cpp
+++ b/engines/darkseed/cutscene.cpp
@@ -991,7 +991,7 @@ bool Cutscene::nightmare2Scene() {
 	return true;
 }
 
-bool Cutscene::nightmare3Scene() { // TODO fix animation of values + face here.
+bool Cutscene::nightmare3Scene() {
 	switch (_movieStep) {
 	case 1: {
 		_palette.load("art/ship.pal");
@@ -1022,20 +1022,31 @@ bool Cutscene::nightmare3Scene() { // TODO fix animation of values + face here.
 		break;
 	case 4:
 		_animIdx = 0;
-		_animCount = 12;
-		// TODO speed = 2
+		_animCount = 24;
 		runAnim();
 		break;
 	case 5:
-		if (stepAnim(1)) {
+		if (stepValveAnim(false)) {
 			return true;
 		}
 		registTime();
 		break;
 	case 6:
+		_faceIdx = 0;
+		_animCount = 34;
+		break;
 	case 7:
+		if (stepValveAnim(true)) {
+			return true;
+		}
+		break;
 	case 8:
+		_animCount = 34;
+		break;
 	case 9:
+		if (stepValveAnim(false)) {
+			return true;
+		}
 		registTime();
 		break;
 	case 10:
@@ -1052,6 +1063,7 @@ bool Cutscene::nightmare3Scene() { // TODO fix animation of values + face here.
 		}
 		break;
 	default:
+		g_engine->_sound->stopMusic();
 		_movieStep = 9999;
 		return false;
 	}
@@ -1079,6 +1091,39 @@ bool Cutscene::stepAnim(int drawMode) {
 	return false;
 }
 
+bool Cutscene::stepValveAnim(bool doFaceAnim) {
+	if (_animDelayCount == 0) {
+		Img animLeftFrame;
+		_animation.getImg(_valvesIdx, animLeftFrame);
+		animLeftFrame.draw(1);
+
+		Img animRightFrame;
+		_animation.getImg(_valvesIdx + 6, animRightFrame);
+		animRightFrame.draw(1);
+
+		if (doFaceAnim && (_animCount % 2) == 0) {
+			Img faceFrame;
+			Common::Path facePath = Common::Path("art").join(Common::String::format("f%02d.img", _faceIdx + 2));
+			faceFrame.load(facePath);
+			faceFrame.draw(0, faceFrame.getWidth() - 6);
+			_faceIdx++;
+		}
+
+		_valvesIdx++;
+		if (_valvesIdx > 5) {
+			_valvesIdx = 0;
+		}
+		_animCount--;
+	}
+
+	_animDelayCount++;
+	if (_animDelayCount == 12) {
+		_animDelayCount = 0;
+	}
+
+	return _animCount > 0;
+}
+
 void Cutscene::putHouse() {
 	Img dollImg;
 	dollImg.load("art/bdoll0.img");
diff --git a/engines/darkseed/cutscene.h b/engines/darkseed/cutscene.h
index 378b85396d0..65341652971 100644
--- a/engines/darkseed/cutscene.h
+++ b/engines/darkseed/cutscene.h
@@ -40,6 +40,8 @@ class Cutscene {
 	int _animDirection = 0;
 	uint32 _startTime = 0;
 	Morph *_morph = nullptr;
+	int _valvesIdx = 0;
+	int _faceIdx = 0;
 
 public:
 	Cutscene() {}
@@ -63,6 +65,8 @@ private:
 	void runAnim(int direction = 1);
 	bool stepAnim(int drawMode = 1);
 
+	bool stepValveAnim(bool doFaceAnim);
+
 	void putHouse();
 
 	void registTime();
diff --git a/engines/darkseed/img.cpp b/engines/darkseed/img.cpp
index f00c1a1aae9..45d0f87e5f9 100644
--- a/engines/darkseed/img.cpp
+++ b/engines/darkseed/img.cpp
@@ -106,16 +106,16 @@ Common::Array<uint8> &Img::getPixels() {
 	return _pixels;
 }
 
-void Img::draw(int drawMode) {
-	drawAt(_x, _y, drawMode);
+void Img::draw(int drawMode, int drawWidth) {
+	drawAt(_x, _y, drawMode, drawWidth);
 }
 
 void Img::drawAt(uint16 xPos, uint16 yPos, int drawMode, int drawWidth) {
+	int w = drawWidth != 0 ? drawWidth : _width;
 	if (drawMode != 0) {
 		uint8 *screen = (uint8 *)g_engine->_screen->getBasePtr(xPos, yPos);
 		uint8 *imgPixels = _pixels.data();
 		for (int sy = 0; sy < _height; sy++) {
-			int w = drawWidth != 0 ? drawWidth : _width;
 			for (int sx = 0; sx < w; sx++) {
 				if (drawMode == 1 && imgPixels[sx] != 0) {
 					screen[sx] ^= imgPixels[sx];
@@ -129,9 +129,9 @@ void Img::drawAt(uint16 xPos, uint16 yPos, int drawMode, int drawWidth) {
 			screen += g_engine->_screen->pitch;
 		}
 	} else {
-		g_engine->_screen->copyRectToSurface(_pixels.data(), _width, xPos, yPos, _width, _height);
+		g_engine->_screen->copyRectToSurface(_pixels.data(), _width, xPos, yPos, w, _height);
 	}
-	g_engine->_screen->addDirtyRect({{(int16)xPos, (int16)yPos}, (int16)_width, (int16)_height});
+	g_engine->_screen->addDirtyRect({{(int16)xPos, (int16)yPos}, (int16)w, (int16)_height});
 }
 
 } // namespace Darkseed
diff --git a/engines/darkseed/img.h b/engines/darkseed/img.h
index d596e8d21ca..08da2da28e1 100644
--- a/engines/darkseed/img.h
+++ b/engines/darkseed/img.h
@@ -40,7 +40,7 @@ public:
 	bool load(const Common::Path &filename);
 	bool load(Common::SeekableReadStream &readStream);
 	bool loadWithoutPosition(Common::SeekableReadStream &readStream);
-	void draw(int drawMode = 0);
+	void draw(int drawMode = 0, int drawWidth = 0);
 	void drawAt(uint16 xPos, uint16 yPos, int drawMode = 0, int drawWidth = 0);
 
 	Common::Array<uint8> &getPixels();


Commit: 7fd61521fe72c626be70a89b62c066f0e1d766fd
    https://github.com/scummvm/scummvm/commit/7fd61521fe72c626be70a89b62c066f0e1d766fd
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2024-11-16T12:55:19+11:00

Commit Message:
DARKSEED: Add searchTos debug console command. This searches for tos strings matching a given input string.

Changed paths:
    engines/darkseed/debugconsole.cpp
    engines/darkseed/debugconsole.h


diff --git a/engines/darkseed/debugconsole.cpp b/engines/darkseed/debugconsole.cpp
index 5c6b203a6a5..701944ceca1 100644
--- a/engines/darkseed/debugconsole.cpp
+++ b/engines/darkseed/debugconsole.cpp
@@ -35,6 +35,7 @@ DebugConsole::DebugConsole(TosText *tosText) : _tosText(tosText) {
 	registerCmd("invAdd",   WRAP_METHOD(DebugConsole, Cmd_invAdd));
 	registerCmd("invRemove",   WRAP_METHOD(DebugConsole, Cmd_invRemove));
 	registerCmd("changeDay",   WRAP_METHOD(DebugConsole, Cmd_changeDay));
+	registerCmd("searchTos",   WRAP_METHOD(DebugConsole, Cmd_searchTos));
 }
 
 DebugConsole::~DebugConsole() {
@@ -180,6 +181,25 @@ bool DebugConsole::Cmd_changeDay(int argc, const char **argv) {
 	return true;
 }
 
+bool DebugConsole::Cmd_searchTos(int argc, const char **argv) {
+	if (argc != 2) {
+		debugPrintf("Usage: searchTos \"search string\"\n");
+		return true;
+	}
+
+	Common::String searchString = Common::String(argv[1]);
+	searchString.toLowercase();
+
+	for (int i = 0; i < g_engine->_tosText->getNumEntries(); i++) {
+		Common::String entry = g_engine->_tosText->getText(i);
+		entry.toLowercase();
+		if (entry.contains(searchString)) {
+			debugPrintf("% 3d: %s\n", i, entry.c_str());
+		}
+	}
+	return true;
+}
+
 void DebugConsole::printDayAndTime() {
 	int hour = g_engine->_currentTimeInSeconds / 60 / 60 + 1;
 	debugPrintf("Day %d at %d:%02d%s (%d seconds)\n",
diff --git a/engines/darkseed/debugconsole.h b/engines/darkseed/debugconsole.h
index cb128b5b14e..1d3fcc2be94 100644
--- a/engines/darkseed/debugconsole.h
+++ b/engines/darkseed/debugconsole.h
@@ -40,6 +40,7 @@ class DebugConsole : public GUI::Debugger {
 	bool Cmd_invAdd(int argc, const char **argv);
 	bool Cmd_invRemove(int argc, const char **argv);
 	bool Cmd_changeDay(int argc, const char **argv);
+	bool Cmd_searchTos(int argc, const char **argv);
 	bool validateObjVarIndex(int16 varIdx);
 	void printDayAndTime();
 


Commit: 6902ea4654c419c99a764ab8dbdacbb71af3cd0f
    https://github.com/scummvm/scummvm/commit/6902ea4654c419c99a764ab8dbdacbb71af3cd0f
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2024-11-16T12:55:19+11:00

Commit Message:
DARKSEED: Add DOS floppy speech

Changed paths:
    engines/darkseed/darkseed.h
    engines/darkseed/sound.cpp
    engines/darkseed/sound.h


diff --git a/engines/darkseed/darkseed.h b/engines/darkseed/darkseed.h
index dcb73094f09..6b1e37c594b 100644
--- a/engines/darkseed/darkseed.h
+++ b/engines/darkseed/darkseed.h
@@ -172,10 +172,18 @@ public:
 		return _randomSource.getRandomNumber(maxNum);
 	}
 
+	bool isDosVersion() const {
+		return _gameDescription->platform == Common::kPlatformDOS;
+	}
+
 	bool isCdVersion() const {
 		return getFeatures() & ADGF_CD;
 	}
 
+	bool isDosFloppy() const {
+		return isDosVersion() && !isCdVersion();
+	}
+
 	bool hasFeature(EngineFeature f) const override {
 		return
 		    (f == kSupportsLoadingDuringRuntime) ||
diff --git a/engines/darkseed/sound.cpp b/engines/darkseed/sound.cpp
index d65d11864b0..1050a77625d 100644
--- a/engines/darkseed/sound.cpp
+++ b/engines/darkseed/sound.cpp
@@ -146,6 +146,11 @@ int Sound::init() {
 }
 
 void Sound::playTosSpeech(int tosIdx) {
+	if (g_engine->isDosFloppy()) {
+		playFloppySpeech(tosIdx);
+		return;
+	}
+
 	if (!g_engine->isCdVersion() || _didSpeech[tosIdx] == 1) {
 		return;
 	}
@@ -273,4 +278,47 @@ void Sound::playDosCDSfx(int sfxId) {
 	_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_sfxHandle, stream);
 }
 
+void Sound::playFloppySpeech(int tosIdx) {
+	Common::String filename;
+
+	switch (tosIdx) {
+	case 927 : filename = "CL1.VOC"; break;
+	case 905 : filename = "CL2.VOC"; break;
+	case 906 : filename = "CL3.VOC"; break;
+	case 907 : filename = "D4A-1.VOC"; break;
+	case 909 : filename = "D5A-1.VOC"; break;
+	case 910 : filename = "D6A-2.VOC"; break;
+	case 908 : filename = "D6C-2.VOC"; break;
+	case 916 : filename = "G10A-1.VOC"; break;
+	case 917 : filename = "G10B-1.VOC"; break;
+	case 925 : filename = "GL0A.VOC"; break;
+	case 926 : filename = "GL1B.VOC"; break;
+	case 924 : filename = "GL2A.VOC"; break;
+	case 928 : filename = "GL3A.VOC"; break; // TODO is this correct?
+	case 922 : filename = "K15A-1.VOC"; break;
+	case 913 : filename = "K9A-3.VOC"; break;
+	case 914 : filename = "K9C-3.VOC"; break;
+	case 915 : filename = "K9E-3.VOC"; break;
+	case 904 : filename = "M1-1.VOC"; break;
+	case 918 : filename = "M11A-1.VOC"; break;
+	case 919 : filename = "O12A-1.VOC"; break;
+	case 920 : filename = "O13A-1.VOC"; break;
+	case 921 : filename = "O14A-1.VOC"; break;
+	case 923 : filename = "S16A-1.VOC"; break;
+	case 912 : filename = "S8A-2.VOC"; break;
+	default : return;
+	}
+
+	Common::Path path = Common::Path(filename);
+	Common::File f;
+	if (!f.open(path)) {
+		return;
+	}
+
+	Common::SeekableReadStream *srcStream = f.readStream((uint32)f.size());
+	Audio::SeekableAudioStream *stream = Audio::makeVOCStream(srcStream,
+															  Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
+	_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream);
+}
+
 } // End of namespace Darkseed
diff --git a/engines/darkseed/sound.h b/engines/darkseed/sound.h
index 5dad88fd221..a51a572ca3e 100644
--- a/engines/darkseed/sound.h
+++ b/engines/darkseed/sound.h
@@ -88,6 +88,7 @@ public:
 	void killAllSound();
 private:
 	void playDosCDSfx(int sfxId);
+	void playFloppySpeech(int tosIdx);
 };
 
 } // namespace Darkseed




More information about the Scummvm-git-logs mailing list