[Scummvm-git-logs] scummvm master -> f61820fd3a2e6f276844e7d68ab6311bf5751a68

yuv422 noreply at scummvm.org
Mon Nov 4 21:51:44 UTC 2024


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:
7b14fcd984 DARKSEED: Fixed some TODO comments.
1f1e5953da DARKSEED: Add giger ancients death animation.
9ccd1c70d3 DARKSEED: Wire up inventory add sound
f61820fd3a DARKSEED: Wiring up SFX for Dos CD version.


Commit: 7b14fcd984cec10c66dad34f49cbd730450cdd9c
    https://github.com/scummvm/scummvm/commit/7b14fcd984cec10c66dad34f49cbd730450cdd9c
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2024-11-05T08:49:22+11:00

Commit Message:
DARKSEED: Fixed some TODO comments.

Changed paths:
    engines/darkseed/usecode.cpp


diff --git a/engines/darkseed/usecode.cpp b/engines/darkseed/usecode.cpp
index 037b1860ca1..2dfebf64c0d 100644
--- a/engines/darkseed/usecode.cpp
+++ b/engines/darkseed/usecode.cpp
@@ -312,7 +312,7 @@ void Darkseed::UseCode::useCode(int objNum) {
 		if (handTosIdx != 0 && handTosIdx < 979) {
 			_console->printTosText(handTosIdx);
 		} else if (handTosIdx > 978) {
-			// TODO genericResponse
+			genericResponse(2, objNum, handTosIdx);
 		}
 		if (objNum == 80) {
 			_console->printTosText(553 + (_objectVar[80] & 1));
@@ -638,17 +638,12 @@ void Darkseed::UseCode::useCode(int objNum) {
 			}
 		} else if ((objNum == 68) && (_objectVar[68] == 0)) {
 			if (_objectVar[12] == 2) {
-				if (true) {
-					if ((_objectVar[66] == 1) && (_objectVar[67] == 1)) {
-						g_engine->playSound(13, 5, -1);
-						_objectVar[68] = 1;
-						g_engine->_animation->setupOtherNspAnimation(0, 23);
-					} else {
-						_objectVar[68] = 2;
-					}
-				// TODO: Unreachable code
-				//} else {
-				//	_objectVar[68] = 0;
+				if ((_objectVar[66] == 1) && (_objectVar[67] == 1)) {
+					g_engine->playSound(13, 5, -1);
+					_objectVar[68] = 1;
+					g_engine->_animation->setupOtherNspAnimation(0, 23);
+				} else {
+					_objectVar[68] = 2;
 				}
 			} else {
 				_console->addTextLine("You touch the surface of the ornate sigil.");


Commit: 1f1e5953daaa7d06b1b26a7592e598ff1e3c6138
    https://github.com/scummvm/scummvm/commit/1f1e5953daaa7d06b1b26a7592e598ff1e3c6138
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2024-11-05T08:49:22+11:00

Commit Message:
DARKSEED: Add giger ancients death animation.

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


diff --git a/engines/darkseed/animation.cpp b/engines/darkseed/animation.cpp
index b8bd44c541b..0c321d5abda 100644
--- a/engines/darkseed/animation.cpp
+++ b/engines/darkseed/animation.cpp
@@ -973,6 +973,39 @@ void Animation::sargoAnim() {
 	g_engine->_cursor.showCursor(true);
 }
 
+void Animation::gancAnim() {
+	g_engine->_cursor.showCursor(false);
+	_player->loadAnimations("ganc.nsp");
+	g_engine->showFullscreenPic("ganc.pic");
+	_animIndexTbl[0] = 0;
+	_spriteAnimCountdownTimer[0] = _player->_animations.getAnimAt(0)._frameDuration[0];
+
+	g_engine->_sound->playMusic(MusicId::kDth);
+	g_engine->playSound(0, 6, -1);
+	g_engine->_console->printTosText(0);
+	g_engine->_console->draw();
+
+	while (!_objRestarted) {
+		g_engine->_sprites.clearSpriteDrawList();
+
+		g_engine->drawFullscreenPic();
+
+		advanceAnimationFrame(0);
+		const Sprite &sargoSprite = _player->_animations.getSpriteAt(_player->_animations.getAnimAt(0)._frameNo[_animIndexTbl[0]]);
+		g_engine->_sprites.addSpriteToDrawList(303, 122, &sargoSprite, 255, sargoSprite._width, sargoSprite._height, false);
+		g_engine->_sprites.drawSprites();
+
+
+		g_engine->_screen->makeAllDirty();
+		g_engine->_screen->update();
+
+		g_system->delayMillis(20);
+	}
+	g_engine->removeFullscreenPic();
+	g_engine->_cursor.showCursor(true);
+	stuffPlayer();
+}
+
 static constexpr uint8 keeperList[250] = {
 	10, 11, 12, 13,
 	12, 12, 13, 10,
diff --git a/engines/darkseed/animation.h b/engines/darkseed/animation.h
index e2a8bd165d6..3dbaee00fb0 100644
--- a/engines/darkseed/animation.h
+++ b/engines/darkseed/animation.h
@@ -52,6 +52,7 @@ public:
 	void dCopAnim();
 	void sargoAnim();
 	void keeperAdmin();
+	void gancAnim();
 	void stuffPlayer();
 	void runDrekethSequence();
 	void libAnim(bool pickingUpReservedBook);
diff --git a/engines/darkseed/usecode.cpp b/engines/darkseed/usecode.cpp
index 2dfebf64c0d..de1e7881eb4 100644
--- a/engines/darkseed/usecode.cpp
+++ b/engines/darkseed/usecode.cpp
@@ -334,7 +334,7 @@ void Darkseed::UseCode::useCode(int objNum) {
 			return;
 		}
 		if (objNum == 114) {
-			gancAnim();
+			g_engine->_animation->gancAnim();
 			return;
 		}
 		if ((objNum == 28) && (_objectVar[28] == 2)) {
@@ -1734,10 +1734,6 @@ void UseCode::putObjUnderPillow(int objNum) {
 	_console->printTosText(947);
 }
 
-void UseCode::gancAnim() {
-	error("implement gancAnim()"); // TODO
-}
-
 static constexpr bool diggingxflipTbl[12] = {
 	true, true, true, true,
 	true, false, false, true,
diff --git a/engines/darkseed/usecode.h b/engines/darkseed/usecode.h
index 9b991ce8268..9bab1b4c18f 100644
--- a/engines/darkseed/usecode.h
+++ b/engines/darkseed/usecode.h
@@ -87,7 +87,6 @@ private:
 	int16 getUseGunTosIdx(uint16 objNum);
 	int16 getUseWatchTosIdx(uint16 objNum);
 
-	void gancAnim();
 	void putObjUnderPillow(int objNum);
 
 	void startDigging(int16 targetObjNum);


Commit: 9ccd1c70d3a146541f1b21f5b95e8f1d15a9d566
    https://github.com/scummvm/scummvm/commit/9ccd1c70d3a146541f1b21f5b95e8f1d15a9d566
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2024-11-05T08:49:22+11:00

Commit Message:
DARKSEED: Wire up inventory add sound

Changed paths:
    engines/darkseed/inventory.cpp


diff --git a/engines/darkseed/inventory.cpp b/engines/darkseed/inventory.cpp
index 4d593e79ce0..db0cc942801 100644
--- a/engines/darkseed/inventory.cpp
+++ b/engines/darkseed/inventory.cpp
@@ -44,7 +44,7 @@ void Inventory::reset() {
 void Inventory::addItem(uint8 item) {
 	_inventory[_inventoryLength] = item;
 	_inventoryLength++;
-	// TODO playsound(6, 5, -1);
+	g_engine->playSound(6, 5, -1);
 	update();
 }
 


Commit: f61820fd3a2e6f276844e7d68ab6311bf5751a68
    https://github.com/scummvm/scummvm/commit/f61820fd3a2e6f276844e7d68ab6311bf5751a68
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2024-11-05T08:49:22+11:00

Commit Message:
DARKSEED: Wiring up SFX for Dos CD version.

Changed paths:
    engines/darkseed/animation.cpp
    engines/darkseed/cutscene.cpp
    engines/darkseed/darkseed.cpp
    engines/darkseed/darkseed.h
    engines/darkseed/nsp.cpp
    engines/darkseed/pic.cpp
    engines/darkseed/sound.cpp
    engines/darkseed/sound.h


diff --git a/engines/darkseed/animation.cpp b/engines/darkseed/animation.cpp
index 0c321d5abda..8fa40b37a5e 100644
--- a/engines/darkseed/animation.cpp
+++ b/engines/darkseed/animation.cpp
@@ -321,7 +321,7 @@ void Animation::updateAnimation() {
 					_objectVar[47] = 1;
 					g_engine->_console->printTosText(922);
 				}
-				g_engine->_sound->waitForSpeech();
+				g_engine->waitForSpeech();
 				setupOtherNspAnimation(1, 9);
 			}
 		}
diff --git a/engines/darkseed/cutscene.cpp b/engines/darkseed/cutscene.cpp
index 5e4d2362851..1a842348ad8 100644
--- a/engines/darkseed/cutscene.cpp
+++ b/engines/darkseed/cutscene.cpp
@@ -31,7 +31,7 @@ Cutscene::~Cutscene() {
 void Cutscene::play(char cutsceneId) {
 	_cutsceneId = cutsceneId;
 	_movieStep = 1;
-	g_engine->_sound->waitForSpeech();
+	g_engine->waitForSpeech();
 	g_engine->_cursor.showCursor(false);
 	g_engine->fadeOut();
 }
diff --git a/engines/darkseed/darkseed.cpp b/engines/darkseed/darkseed.cpp
index 34704c1df10..d1ce5e57d2e 100644
--- a/engines/darkseed/darkseed.cpp
+++ b/engines/darkseed/darkseed.cpp
@@ -195,13 +195,15 @@ void DarkseedEngine::gameLoop() {
 						_animation->stuffPlayer();
 					}
 				} else {
-					_animation->dCopAnim();
-					changeToRoom(59, true);
-					_player->_position = {320, 200};
-					_player->updateSprite();
-					_inventory.gotoJailLogic();
+					if (_objectVar[56] > 0) {
+						_animation->dCopAnim();
+						changeToRoom(59, true);
+						_player->_position = {320, 200};
+						_player->updateSprite();
+						_inventory.gotoJailLogic();
 
-					playSound(0, 6, -1);
+						playSound(0, 6, -1);
+					}
 				}
 			}
 			if (_currentTimeInSeconds > 35999 && _currentTimeInSeconds < 36005 &&
@@ -1019,13 +1021,13 @@ void DarkseedEngine::handlePointerAction() {
 void DarkseedEngine::loadRoom(int roomNumber) {
 //	*(undefined *)&_erasemenu = 1; TODO do we need these?
 //	*(undefined2 *)&_gShipOff = 0;
-	_sound->waitForSpeech();
+	waitForSpeech();
 	if (roomNumber == 33 && _objectVar[62] == 101) {
 		_objectVar[62] = 0;
 	}
 	_printedcomeheredawson = false;
 	_objectVar.setObjectRunningCode(53, 0);
-	_objectVar[56] = 0;
+	_objectVar[56] = 0; // evil sargent anim spriteNumber
 	_objectVar.setObjectRunningCode(72, 0);
 	for (int i = 31; i < 34; i++) {
 		if (_objectVar.getMoveObjectRoom(i) == 99) {
@@ -1941,8 +1943,10 @@ void DarkseedEngine::getPackageObj(int packageType) {
 	}
 }
 
-void DarkseedEngine::playSound(int16 unk, uint8 unk1, int16 unk2) {
-	// TODO...
+void DarkseedEngine::playSound(uint8 sfxId, uint8 unk1, int16 unk2) {
+	// TODO... play sound
+	debug("Play SFX: %d", sfxId);
+	_sound->playSfx(sfxId, unk1, unk2);
 }
 
 void DarkseedEngine::nextFrame(int nspAminIdx) {
@@ -2252,7 +2256,7 @@ void DarkseedEngine::runObjects() {
 			}
 			if (_delbertspeech == 64) {
 				_console->printTosText(908);
-				_sound->waitForSpeech();
+				waitForSpeech();
 			} else if (_delbertspeech == 65) {
 				_animation->setupOtherNspAnimation(3, 20);
 				_animation->_spriteAnimCountdownTimer[1] = 3;
@@ -2574,4 +2578,15 @@ void DarkseedEngine::newGame() {
 	}
 }
 
+void DarkseedEngine::waitForSpeech() {
+	while (_sound && _sound->isPlayingSpeech()) {
+		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 b62f0493e5f..338a6cd7610 100644
--- a/engines/darkseed/darkseed.h
+++ b/engines/darkseed/darkseed.h
@@ -151,6 +151,8 @@ public:
 
 	void wait();
 
+	void waitForSpeech();
+
 	void syncSoundSettings() override;
 
 public:
@@ -226,7 +228,7 @@ public:
 	void drawFullscreenPic();
 	void lookCode(int objNum);
 	void handleObjCollision(int targetObjNum);
-	void playSound(int16 unk, uint8 unk1, int16 unk2);
+	void playSound(uint8 sfxId, uint8 unk1, int16 unk2);
 	void nextFrame(int nspAminIdx);
 
 	void throwmikeinjail();
diff --git a/engines/darkseed/nsp.cpp b/engines/darkseed/nsp.cpp
index 62572e4cafc..8fea18b1a0b 100644
--- a/engines/darkseed/nsp.cpp
+++ b/engines/darkseed/nsp.cpp
@@ -30,6 +30,7 @@ Sprite::Sprite(uint16 width, uint16 height, uint16 pitch) : _width(width), _heig
 }
 
 bool Sprite::loadData(Common::SeekableReadStream &readStream) {
+	g_engine->waitForSpeech();
 	if (_width == 1 && _height == 1) {
 		byte b = readStream.readByte();
 		_pixels[0] = b >> 4;
diff --git a/engines/darkseed/pic.cpp b/engines/darkseed/pic.cpp
index f60caee720e..c4bb881c100 100644
--- a/engines/darkseed/pic.cpp
+++ b/engines/darkseed/pic.cpp
@@ -26,6 +26,7 @@
 namespace Darkseed {
 
 bool Pic::load(const Common::Path &filename) {
+	g_engine->waitForSpeech();
 	Common::File file;
 	Common::Path fullPath = g_engine->getPictureFilePath(filename);
 	if (!file.open(fullPath)) {
diff --git a/engines/darkseed/sound.cpp b/engines/darkseed/sound.cpp
index f8a2953a3b4..b97cc2fffce 100644
--- a/engines/darkseed/sound.cpp
+++ b/engines/darkseed/sound.cpp
@@ -79,6 +79,58 @@ static constexpr char startMusicDosCDFilenameTbl[][14] = {
 	"babydoll.mid"
 };
 
+static constexpr char sfxCDFilenameTbl[][14] = {
+	"",
+	"opendoor.sfx",
+	"showers2.sfx",
+	"razzsysb.sfx",
+	"medicine.sfx",
+	"pop.sfx",
+	"pickupit.sfx",
+	"rockener.sfx",
+	"pullleve.sfx",
+	"starship.sfx",
+	"podwrith.sfx",
+	"starterc.sfx",
+	"sigils.sfx",
+	"tombdoor.sfx",
+	"digging.sfx",
+	"opendoor.sfx",
+	"carstart.sfx",
+	"makehamm.sfx",
+	"picklock.sfx",
+	"impaled.sfx",
+	"evilbeas.sfx",
+	"laser.sfx",
+	"knock.sfx",
+	"bubblesi.sfx",
+	"phone.sfx",
+	"softphon.sfx",
+	"pulsar.sfx",
+	"doorbell.sfx",
+	"mirrorsm.sfx",
+	"softdoor.sfx",
+	"electroc.sfx",
+	"medicine.sfx",
+	"pourings.sfx",
+	"tuneinra.sfx",
+	"opendoor.sfx",
+	"showers1.sfx",
+	"yo.sfx",
+	"showers2.sfx",
+	"popii.sfx",
+	"carhorn.sfx",
+	"yo.sfx",
+	"secretdo.sfx",
+	"opendoor.sfx",
+	"tick.sfx",
+	"tock.sfx",
+	"chime.sfx",
+	"softchim.sfx",
+	"shakeurn.sfx",
+	"beaming.sfx"
+};
+
 Sound::Sound(Audio::Mixer *mixer) : _mixer(mixer) {
 	_musicPlayer = new MusicPlayer(g_engine);
 	_didSpeech.resize(978);
@@ -114,14 +166,12 @@ bool Sound::isPlayingSpeech() const {
 	return _mixer->isSoundHandleActive(_speechHandle);
 }
 
-bool Sound::isPlayingMusic() {
-	return _musicPlayer->isPlaying();
+bool Sound::isPlayingSfx() const {
+	return _mixer->isSoundHandleActive(_sfxHandle);
 }
 
-void Sound::waitForSpeech() {
-	while (isPlayingSpeech()) {
-		// TODO poll events / wait a bit here.
-	}
+bool Sound::isPlayingMusic() {
+	return _musicPlayer->isPlaying();
 }
 
 void Sound::resetSpeech() {
@@ -184,4 +234,33 @@ Common::Error Sound::sync(Common::Serializer &s) {
 	return Common::kNoError;
 }
 
+void Sound::playSfx(uint8 sfxId, int unk1, int unk2) {
+	if (g_engine->isCdVersion()) {
+		playDosCDSfx(sfxId);
+	}
+}
+
+void Sound::playDosCDSfx(int sfxId) {
+	if (sfxId == 0) {
+		// TODO midi SFX
+		return;
+	}
+	if (sfxId > 48) {
+		error("playDosCDSfx: Invalid sfxId %d", sfxId);
+	}
+	if (isPlayingSfx()) {
+		return;
+	}
+	Common::Path path = Common::Path("sound").join(sfxCDFilenameTbl[sfxId]);
+	Common::File f;
+	if (!f.open(path)) {
+		debug("Failed to load sfx. %s", path.toString().c_str());
+		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, &_sfxHandle, stream);
+}
+
 } // End of namespace Darkseed
diff --git a/engines/darkseed/sound.h b/engines/darkseed/sound.h
index 75237d85923..9fe6d5ec93c 100644
--- a/engines/darkseed/sound.h
+++ b/engines/darkseed/sound.h
@@ -60,6 +60,7 @@ enum class StartMusicId : uint8 {
 class Sound {
 	Audio::Mixer *_mixer;
 	Audio::SoundHandle _speechHandle;
+	Audio::SoundHandle _sfxHandle;
 	MusicPlayer *_musicPlayer;
 	Common::Array<uint8> _didSpeech;
 
@@ -73,15 +74,18 @@ public:
 
 	void playTosSpeech(int tosIdx);
 	bool isPlayingSpeech() const;
+	bool isPlayingSfx() const;
 	bool isPlayingMusic();
-	void waitForSpeech();
 	void resetSpeech();
 	void playMusic(MusicId musicId);
 	void playMusic(StartMusicId musicId);
 	void playMusic(Common::String const &filename, bool loop = false);
 	void stopMusic();
+	void playSfx(uint8 sfxId, int unk1, int unk2);
 	void syncSoundSettings();
 	void killAllSound();
+private:
+	void playDosCDSfx(int sfxId);
 };
 
 } // namespace Darkseed




More information about the Scummvm-git-logs mailing list