[Scummvm-git-logs] scummvm master -> 0d6578dac704dc1ae3c3658245ed2320fb05e05a

dreammaster dreammaster at scummvm.org
Thu Feb 2 02:25:44 CET 2017


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

Summary:
0d6578dac7 TITANIC: Git rid of old stubs in CMusicRoomHandler, start fleshing it out


Commit: 0d6578dac704dc1ae3c3658245ed2320fb05e05a
    https://github.com/scummvm/scummvm/commit/0d6578dac704dc1ae3c3658245ed2320fb05e05a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-02-01T20:25:36-05:00

Commit Message:
TITANIC: Git rid of old stubs in CMusicRoomHandler, start fleshing it out

Changed paths:
    engines/titanic/game/play_music_button.cpp
    engines/titanic/sound/music_player.cpp
    engines/titanic/sound/music_room_handler.cpp
    engines/titanic/sound/music_room_handler.h


diff --git a/engines/titanic/game/play_music_button.cpp b/engines/titanic/game/play_music_button.cpp
index 604938f..d4d7e1c 100644
--- a/engines/titanic/game/play_music_button.cpp
+++ b/engines/titanic/game/play_music_button.cpp
@@ -64,7 +64,7 @@ bool CPlayMusicButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
 }
 
 bool CPlayMusicButton::FrameMsg(CFrameMsg *msg) {
-	if (_flag && !CMusicRoom::_musicHandler->poll()) {
+	if (_flag && !CMusicRoom::_musicHandler->update()) {
 		CMusicRoom *musicRoom = getMusicRoom();
 		musicRoom->stopMusic();
 		stopMovie();
diff --git a/engines/titanic/sound/music_player.cpp b/engines/titanic/sound/music_player.cpp
index 6fb073b..c05a519 100644
--- a/engines/titanic/sound/music_player.cpp
+++ b/engines/titanic/sound/music_player.cpp
@@ -98,7 +98,7 @@ bool CMusicPlayer::StopMusicMsg(CStopMusicMsg *msg) {
 }
 
 bool CMusicPlayer::FrameMsg(CFrameMsg *msg) {
-	if (_isActive && !CMusicRoom::_musicHandler->poll()) {
+	if (_isActive && !CMusicRoom::_musicHandler->update()) {
 		getMusicRoom()->stopMusic();
 		_isActive = false;
 
diff --git a/engines/titanic/sound/music_room_handler.cpp b/engines/titanic/sound/music_room_handler.cpp
index fdc98b9..c9e4d76 100644
--- a/engines/titanic/sound/music_room_handler.cpp
+++ b/engines/titanic/sound/music_room_handler.cpp
@@ -70,11 +70,6 @@ void CMusicRoomHandler::createWaveFile(int musicVolume) {
 //	_waveFile = _soundManager->loadMusic()
 }
 
-bool CMusicRoomHandler::poll() {
-	// TODO
-	return false;
-}
-
 void CMusicRoomHandler::stop() {
 	if (_waveFile) {
 		_soundManager->stopSound(_soundHandle);
@@ -147,11 +142,6 @@ void CMusicRoomHandler::setMuteControl(MusicInstrument instrument, bool value) {
 		_array1[instrument]._muteControl = value;
 }
 
-bool CMusicRoomHandler::isBusy() {
-	// TODO: stuff
-	return _field108 > 0;
-}
-
 void CMusicRoomHandler::trigger() {
 	if (_active) {
 		for (int idx = 0; idx < 4; ++idx)
@@ -159,7 +149,7 @@ void CMusicRoomHandler::trigger() {
 	}
 }
 
-void CMusicRoomHandler::update() {
+bool CMusicRoomHandler::update() {
 	uint currentTicks = g_vm->_events->getTicksCount();
 
 	if (!_startTicks) {
@@ -174,6 +164,32 @@ void CMusicRoomHandler::update() {
 
 		_soundStartTicks = currentTicks;
 	}
+
+	updateAudio();
+	fn1();
+
+	return _field108 > 0;
+}
+
+void CMusicRoomHandler::updateAudio() {
+	// TODO
+}
+
+void CMusicRoomHandler::fn1() {
+	if (_active && _soundStartTicks) {
+		for (int idx = 0; idx < 4; ++idx) {
+			MusicRoomInstrument &ins1 = _array1[idx];
+			MusicRoomInstrument &ins2 = _array2[idx];
+
+			// Is this about checking playback position?
+			if (_array6[idx] < 0 || ins1._muteControl || _array6[idx] >= _array3[idx]->_field4) {
+				_array6[idx] = -1;
+				continue;
+			}
+
+			// TODO
+		}
+	}
 }
 
 } // End of namespace Titanic
diff --git a/engines/titanic/sound/music_room_handler.h b/engines/titanic/sound/music_room_handler.h
index 68a0c51..b8ab277 100644
--- a/engines/titanic/sound/music_room_handler.h
+++ b/engines/titanic/sound/music_room_handler.h
@@ -44,6 +44,13 @@ struct MusicRoomInstrument {
 };
 
 class CMusicRoomHandler {
+	struct Object3 {
+		byte *_field0;
+		int _field4;
+		Object3() : _field0(nullptr), _field4(0) {}
+		~Object3() { delete[] _field0; }
+	};
+
 	struct Array5Entry {
 		int _v1;
 		int _v2;
@@ -55,7 +62,9 @@ private:
 	CMusicWave *_musicWaves[4];
 	MusicRoomInstrument _array1[4];
 	MusicRoomInstrument _array2[4];
+	Object3 *_array3[4];
 	Array5Entry _array5[4];
+	int _array6[4];
 	bool _active;
 	CWaveFile *_waveFile;
 	int _soundHandle;
@@ -66,6 +75,9 @@ private:
 	int _volume;
 private:
 	void trigger();
+
+	void updateAudio();
+	void fn1();
 public:
 	CMusicRoomHandler(CProjectItem *project, CSoundManager *soundManager);
 	~CMusicRoomHandler();
@@ -81,13 +93,6 @@ public:
 	void createWaveFile(int musicVolume);
 
 	/**
-	 * Handles regular polling the music handler
-	 */
-	bool poll();
-
-	bool isBusy();
-
-	/**
 	 * Flags whether the music handler is active
 	 */
 	void setActive(bool flag) { _active = flag; }
@@ -149,8 +154,9 @@ public:
 
 	/**
 	 * Handles regular updates
+	 * @returns		True if the music is still playing
 	 */
-	void update();
+	bool update();
 };
 
 } // End of namespace Titanic





More information about the Scummvm-git-logs mailing list