[Scummvm-git-logs] scummvm master -> 9dc93418c9bf10e7a61b772deaf3d79f7a9b4de2

whiterandrek whiterandrek at gmail.com
Fri May 29 22:14:41 UTC 2020


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

Summary:
06abfbf7c3 PETKA: fixed sound type in QInterfaceSequence
6f3e877df1 PETKA: properly stop sequence if it's not stopped by opcode
9da9fc9a69 PETKA: fixed playing nested sequences
6aaa1caddf PETKA: refactor QInterfaceSequence
9dc93418c9 PETKA: simplified room unloading


Commit: 06abfbf7c3ce06858035d525083b3565f91d097b
    https://github.com/scummvm/scummvm/commit/06abfbf7c3ce06858035d525083b3565f91d097b
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-05-30T01:14:06+03:00

Commit Message:
PETKA: fixed sound type in QInterfaceSequence

Changed paths:
    engines/petka/interfaces/sequence.cpp


diff --git a/engines/petka/interfaces/sequence.cpp b/engines/petka/interfaces/sequence.cpp
index e6bc6db9b1..641f44ad81 100644
--- a/engines/petka/interfaces/sequence.cpp
+++ b/engines/petka/interfaces/sequence.cpp
@@ -71,7 +71,7 @@ void InterfaceSequence::start(int id) {
 		}
 	} else {
 		g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(bg->_fxId));
-		Sound *sound = g_vm->soundMgr()->addSound(g_vm->resMgr()->findSoundName(bg->_fxId), Audio::Mixer::kMusicSoundType);
+		Sound *sound = g_vm->soundMgr()->addSound(g_vm->resMgr()->findSoundName(bg->_fxId), Audio::Mixer::kSFXSoundType);
 		if (sound) {
 			sound->play(true);
 		}


Commit: 6f3e877df1947c4b7b61e10bb54754f0fd1e06d0
    https://github.com/scummvm/scummvm/commit/6f3e877df1947c4b7b61e10bb54754f0fd1e06d0
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-05-30T01:14:06+03:00

Commit Message:
PETKA: properly stop sequence if it's not stopped by opcode

Changed paths:
    engines/petka/interfaces/sequence.cpp


diff --git a/engines/petka/interfaces/sequence.cpp b/engines/petka/interfaces/sequence.cpp
index 641f44ad81..8f1a7992b6 100644
--- a/engines/petka/interfaces/sequence.cpp
+++ b/engines/petka/interfaces/sequence.cpp
@@ -39,11 +39,7 @@ InterfaceSequence::InterfaceSequence() {
 }
 
 void InterfaceSequence::start(int id) {
-	removeTexts();
-	for (uint i = 0; i < _objs.size(); ++i) {
-		QMessageObject *obj = (QMessageObject *)_objs[i];
-		obj->removeSound();
-	}
+	stop();
 
 	g_system->getMixer()->pauseAll(true);
 


Commit: 9da9fc9a694937c33d099e64cd77d2daff37c579
    https://github.com/scummvm/scummvm/commit/9da9fc9a694937c33d099e64cd77d2daff37c579
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-05-30T01:14:06+03:00

Commit Message:
PETKA: fixed playing nested sequences

Changed paths:
    engines/petka/interfaces/sequence.cpp
    engines/petka/interfaces/sequence.h


diff --git a/engines/petka/interfaces/sequence.cpp b/engines/petka/interfaces/sequence.cpp
index 8f1a7992b6..3411cc103b 100644
--- a/engines/petka/interfaces/sequence.cpp
+++ b/engines/petka/interfaces/sequence.cpp
@@ -39,7 +39,7 @@ InterfaceSequence::InterfaceSequence() {
 }
 
 void InterfaceSequence::start(int id) {
-	stop();
+	removeObjects();
 
 	g_system->getMixer()->pauseAll(true);
 
@@ -89,13 +89,7 @@ void InterfaceSequence::start(int id) {
 }
 
 void InterfaceSequence::stop() {
-	removeTexts();
-	for (uint i = 0; i < _objs.size(); ++i) {
-		QMessageObject *obj = (QMessageObject *)_objs[i];
-		obj->removeSound();
-	}
-
-	_objs.clear();
+	removeObjects();
 
 	g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(_fxId));
 	g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(_musicId));
@@ -116,4 +110,13 @@ void InterfaceSequence::onLeftButtonDown(const Common::Point p) {
 	}
 }
 
+void InterfaceSequence::removeObjects() {
+	removeTexts();
+	for (uint i = 0; i < _objs.size(); ++i) {
+		QMessageObject *obj = (QMessageObject *)_objs[i];
+		obj->removeSound();
+	}
+	_objs.clear();
+}
+
 } // End of namespace Petka
diff --git a/engines/petka/interfaces/sequence.h b/engines/petka/interfaces/sequence.h
index dade946b90..766f4db044 100644
--- a/engines/petka/interfaces/sequence.h
+++ b/engines/petka/interfaces/sequence.h
@@ -36,6 +36,9 @@ public:
 
 	void onLeftButtonDown(const Common::Point p) override;
 
+private:
+	void removeObjects();
+
 private:
 	int _fxId;
 	int _musicId;


Commit: 6aaa1caddffe1eaced3ae58a6c41c3979c0f4dde
    https://github.com/scummvm/scummvm/commit/6aaa1caddffe1eaced3ae58a6c41c3979c0f4dde
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-05-30T01:14:06+03:00

Commit Message:
PETKA: refactor QInterfaceSequence

Changed paths:
    engines/petka/interfaces/sequence.cpp
    engines/petka/interfaces/sequence.h


diff --git a/engines/petka/interfaces/sequence.cpp b/engines/petka/interfaces/sequence.cpp
index 3411cc103b..b58fcee14a 100644
--- a/engines/petka/interfaces/sequence.cpp
+++ b/engines/petka/interfaces/sequence.cpp
@@ -46,33 +46,8 @@ void InterfaceSequence::start(int id) {
 	QObjectBG* bg = (QObjectBG *)g_vm->getQSystem()->findObject(id);
 	_objs.push_back(bg);
 
-	if (bg->_musicId == _musicId) {
-		Sound *s = g_vm->soundMgr()->findSound(g_vm->resMgr()->findSoundName(bg->_musicId));
-		if (s) {
-			s->pause(false);
-		}
-	} else {
-		g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(bg->_musicId));
-		Sound *sound = g_vm->soundMgr()->addSound(g_vm->resMgr()->findSoundName(bg->_musicId), Audio::Mixer::kMusicSoundType);
-		if (sound) {
-			sound->play(true);
-		}
-		_musicId = bg->_musicId;
-	}
-
-	if (bg->_fxId == _fxId) {
-		Sound *s = g_vm->soundMgr()->findSound(g_vm->resMgr()->findSoundName(bg->_fxId));
-		if (s) {
-			s->pause(false);
-		}
-	} else {
-		g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(bg->_fxId));
-		Sound *sound = g_vm->soundMgr()->addSound(g_vm->resMgr()->findSoundName(bg->_fxId), Audio::Mixer::kSFXSoundType);
-		if (sound) {
-			sound->play(true);
-		}
-		_fxId = bg->_fxId;
-	}
+	playSound(bg->_musicId, Audio::Mixer::kMusicSoundType);
+	playSound(bg->_fxId, Audio::Mixer::kSFXSoundType);
 
 	const BGInfo *info = g_vm->getQSystem()->_mainInterface->findBGInfo(id);
 	if (info) {
@@ -119,4 +94,21 @@ void InterfaceSequence::removeObjects() {
 	_objs.clear();
 }
 
+void InterfaceSequence::playSound(int id, Audio::Mixer::SoundType type) {
+	int *soundId = (type == Audio::Mixer::kSFXSoundType) ? &_fxId : &_musicId;
+	if (*soundId == id) {
+		Sound *s = g_vm->soundMgr()->findSound(g_vm->resMgr()->findSoundName(id));
+		if (s) {
+			s->pause(false);
+		}
+	} else {
+		g_vm->soundMgr()->removeSound(g_vm->resMgr()->findSoundName(*soundId));
+		Sound *sound = g_vm->soundMgr()->addSound(g_vm->resMgr()->findSoundName(id), type);
+		if (sound) {
+			sound->play(true);
+		}
+		*soundId = id;
+	}
+}
+
 } // End of namespace Petka
diff --git a/engines/petka/interfaces/sequence.h b/engines/petka/interfaces/sequence.h
index 766f4db044..695b1b1d7c 100644
--- a/engines/petka/interfaces/sequence.h
+++ b/engines/petka/interfaces/sequence.h
@@ -23,6 +23,8 @@
 #ifndef PETKA_SEQUENCE_H
 #define PETKA_SEQUENCE_H
 
+#include "audio/mixer.h"
+
 #include "petka/interfaces/interface.h"
 
 namespace Petka {
@@ -38,6 +40,7 @@ public:
 
 private:
 	void removeObjects();
+	void playSound(int id, Audio::Mixer::SoundType type);
 
 private:
 	int _fxId;


Commit: 9dc93418c9bf10e7a61b772deaf3d79f7a9b4de2
    https://github.com/scummvm/scummvm/commit/9dc93418c9bf10e7a61b772deaf3d79f7a9b4de2
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-05-30T01:14:06+03:00

Commit Message:
PETKA: simplified room unloading

Changed paths:
    engines/petka/interfaces/main.cpp
    engines/petka/sound.cpp


diff --git a/engines/petka/interfaces/main.cpp b/engines/petka/interfaces/main.cpp
index 28d5ef0a93..3d4bb27a32 100644
--- a/engines/petka/interfaces/main.cpp
+++ b/engines/petka/interfaces/main.cpp
@@ -134,34 +134,23 @@ void InterfaceMain::unloadRoom(bool fromSave) {
 	if (_roomId == -1)
 		return;
 	QSystem *sys = g_vm->getQSystem();
-	QObjectBG *room = (QObjectBG *) sys->findObject(_roomId);
-	if (room) {
-		if (!fromSave)
-			sys->addMessageForAllObjects(kLeaveBG, 0, 0, 0, 0, room);
-		g_vm->resMgr()->clearUnneeded();
-		g_vm->soundMgr()->removeSoundsWithType(Audio::Mixer::kSFXSoundType);
-		const BGInfo *info = findBGInfo(_roomId);
-		if (!info)
-			return;
-		for (uint i = 0; i < _objs.size();) {
-			bool removed = false;
-			if (_roomId == ((QMessageObject *) _objs[i])->_id) {
-				_objs.remove_at(i);
-				removed = true;
-			} else {
-				for (uint j = 0; j < info->attachedObjIds.size(); ++j) {
-					if (info->attachedObjIds[j] == ((QMessageObject *) _objs[i])->_id) {
-						QMessageObject *o = (QMessageObject *) _objs.remove_at(i);
-						o->removeSound();
-						removed = true;
-						break;
-					}
-				}
-			}
-			if (!removed)
-				++i;
-		}
-	}
+	QObjectBG *room = (QObjectBG *)sys->findObject(_roomId);
+	if (!room)
+		return;
+
+	if (!fromSave)
+		sys->addMessageForAllObjects(kLeaveBG, 0, 0, 0, 0, room);
+
+	g_vm->soundMgr()->removeSoundsWithType(Audio::Mixer::kSFXSoundType);
+	g_vm->resMgr()->clearUnneeded();
+
+	_objs.clear();
+
+	_objs.push_back(sys->getCursor());
+	_objs.push_back(sys->getCase());
+	_objs.push_back(sys->getStar());
+	_objs.push_back(sys->getPetka());
+	_objs.push_back(sys->getChapay());
 }
 
 void InterfaceMain::onLeftButtonDown(const Common::Point p) {
diff --git a/engines/petka/sound.cpp b/engines/petka/sound.cpp
index 3ab32cc800..3a4dd61a47 100644
--- a/engines/petka/sound.cpp
+++ b/engines/petka/sound.cpp
@@ -109,7 +109,7 @@ void SoundMgr::removeSoundsWithType(Audio::Mixer::SoundType type) {
 	SoundsMap::iterator it;
 	for (it = _sounds.begin(); it != _sounds.end(); ++it) {
 		Sound *s = it->_value.get();
-		if (s->type() == type && !s->isPlaying()) {
+		if (s->type() == type) {
 			_sounds.erase(it);
 		}
 	}




More information about the Scummvm-git-logs mailing list