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

dreammaster dreammaster at scummvm.org
Sun Jan 29 21:37:08 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:
a9abeb5f95 TITANIC: Cleanup of music room setup code


Commit: a9abeb5f95fa535df08728bc8563675efd007f03
    https://github.com/scummvm/scummvm/commit/a9abeb5f95fa535df08728bc8563675efd007f03
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-01-29T15:37:00-05:00

Commit Message:
TITANIC: Cleanup of music room setup code

Changed paths:
    engines/titanic/game/music_console_button.cpp
    engines/titanic/game/play_music_button.cpp
    engines/titanic/npcs/maitre_d.cpp
    engines/titanic/sound/music_player.cpp
    engines/titanic/sound/music_player.h
    engines/titanic/sound/music_room.cpp
    engines/titanic/sound/music_room.h
    engines/titanic/sound/music_room_handler.cpp
    engines/titanic/sound/music_room_handler.h


diff --git a/engines/titanic/game/music_console_button.cpp b/engines/titanic/game/music_console_button.cpp
index 40492aa..7a1aed0 100644
--- a/engines/titanic/game/music_console_button.cpp
+++ b/engines/titanic/game/music_console_button.cpp
@@ -57,9 +57,9 @@ bool CMusicConsoleButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
 		CMusicHasStartedMsg startedMsg;
 		startedMsg.execute("Music Room Phonograph");
 
-		if (CMusicRoom::_musicHandler->checkSound(1)
-				&& CMusicRoom::_musicHandler->checkSound(2)
-				&& CMusicRoom::_musicHandler->checkSound(3)) {
+		if (CMusicRoom::_musicHandler->checkInstrument(SNAKE)
+				&& CMusicRoom::_musicHandler->checkInstrument(PIANO)
+				&& CMusicRoom::_musicHandler->checkInstrument(BASS)) {
 			CCorrectMusicPlayedMsg correctMsg;
 			correctMsg.execute(findRoom());
 		}
diff --git a/engines/titanic/game/play_music_button.cpp b/engines/titanic/game/play_music_button.cpp
index 21fd3c3..604938f 100644
--- a/engines/titanic/game/play_music_button.cpp
+++ b/engines/titanic/game/play_music_button.cpp
@@ -54,7 +54,7 @@ bool CPlayMusicButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
 		loadFrame(0);
 		_flag = false;
 	} else {
-		musicRoom->startMusic(100);
+		musicRoom->setupMusic(100);
 		playMovie(MOVIE_REPEAT);
 		_ticks = getTicksCount();
 		_flag = true;
diff --git a/engines/titanic/npcs/maitre_d.cpp b/engines/titanic/npcs/maitre_d.cpp
index cbb406f..88eceab 100644
--- a/engines/titanic/npcs/maitre_d.cpp
+++ b/engines/titanic/npcs/maitre_d.cpp
@@ -122,11 +122,11 @@ bool CMaitreD::EnterViewMsg(CEnterViewMsg *msg) {
 
 	if (_string3.contains("nasty ambient"))
 		startTalking(this, 111, findView());
-	else if (!CMusicRoom::_musicHandler->checkSound(1))
+	else if (!CMusicRoom::_musicHandler->checkInstrument(SNAKE))
 		startTalking(this, 114, findView());
-	else if (!CMusicRoom::_musicHandler->checkSound(3))
+	else if (!CMusicRoom::_musicHandler->checkInstrument(BASS))
 		startTalking(this, 113, findView());
-	else if (!CMusicRoom::_musicHandler->checkSound(2))
+	else if (!CMusicRoom::_musicHandler->checkInstrument(PIANO))
 		startTalking(this, 115, findView());
 	else {
 		startTalking(this, 110, findView());
diff --git a/engines/titanic/sound/music_player.cpp b/engines/titanic/sound/music_player.cpp
index a1aaf8f..5489418 100644
--- a/engines/titanic/sound/music_player.cpp
+++ b/engines/titanic/sound/music_player.cpp
@@ -40,7 +40,7 @@ void CMusicPlayer::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(_isActive, indent);
 	file->writeQuotedLine(_stopTarget, indent);
 	file->writeNumberLine(_stopWaves, indent);
-	file->writeNumberLine(_musicId, indent);
+	file->writeNumberLine(_volume, indent);
 
 	CGameObject::save(file, indent);
 }
@@ -50,13 +50,13 @@ void CMusicPlayer::load(SimpleFile *file) {
 	_isActive = file->readNumber();
 	_stopTarget = file->readString();
 	_stopWaves = file->readNumber();
-	_musicId = file->readNumber();
+	_volume = file->readNumber();
 
 	CGameObject::load(file);
 }
 
 bool CMusicPlayer::StartMusicMsg(CStartMusicMsg *msg) {
-	if (msg->_musicPlayer == this) {
+	if (msg->_musicPlayer != this) {
 		if (_isActive) {
 			CStopMusicMsg stopMusicMsg;
 			stopMusicMsg.execute(this);
@@ -73,8 +73,9 @@ bool CMusicPlayer::StartMusicMsg(CStartMusicMsg *msg) {
 		CSetMusicControlsMsg controlsMsg;
 		controlsMsg.execute(this, nullptr, MSGFLAG_SCAN);
 
-		getMusicRoom()->startMusic(_musicId);
+		getMusicRoom()->setupMusic(_volume);
 		_isActive = true;
+		unlockMouse();
 	}
 
 	return true;
diff --git a/engines/titanic/sound/music_player.h b/engines/titanic/sound/music_player.h
index 7b82d4d..3495439 100644
--- a/engines/titanic/sound/music_player.h
+++ b/engines/titanic/sound/music_player.h
@@ -42,11 +42,11 @@ protected:
 	bool _isActive;
 	CString _stopTarget;
 	bool _stopWaves;
-	int _musicId;
+	int _volume;
 public:
 	CLASSDEF;
 	CMusicPlayer() : CGameObject(),
-		_isActive(false), _stopWaves(false), _musicId(100) {}
+		_isActive(false), _stopWaves(false), _volume(100) {}
 
 	/**
 	 * Save the data for the class to file
diff --git a/engines/titanic/sound/music_room.cpp b/engines/titanic/sound/music_room.cpp
index 9586f55..7f4ffdc 100644
--- a/engines/titanic/sound/music_room.cpp
+++ b/engines/titanic/sound/music_room.cpp
@@ -52,7 +52,7 @@ void CMusicRoom::destroyMusicHandler() {
 	_musicHandler = nullptr;
 }
 
-void CMusicRoom::startMusic(int volume) {
+void CMusicRoom::setupMusic(int volume) {
 	if (_musicHandler) {
 		_musicHandler->setSpeedControl2(BELLS, 0);
 		_musicHandler->setSpeedControl2(SNAKE, 1);
diff --git a/engines/titanic/sound/music_room.h b/engines/titanic/sound/music_room.h
index 4b584a0..95557b6 100644
--- a/engines/titanic/sound/music_room.h
+++ b/engines/titanic/sound/music_room.h
@@ -70,9 +70,9 @@ public:
 	void setMuteControl(MusicControlArea index, int val) { _controls[index]._muteControl = val; }
 
 	/**
-	 * Start playing a given music number
+	 * Sets up the music controls
 	 */
-	void startMusic(int volume = 100);
+	void setupMusic(int volume);
 
 	/**
 	 * Stop playing music
diff --git a/engines/titanic/sound/music_room_handler.cpp b/engines/titanic/sound/music_room_handler.cpp
index a9f4116..9db1bac 100644
--- a/engines/titanic/sound/music_room_handler.cpp
+++ b/engines/titanic/sound/music_room_handler.cpp
@@ -85,7 +85,7 @@ void CMusicRoomHandler::stop() {
 	}
 }
 
-bool CMusicRoomHandler::checkSound(int index) const {
+bool CMusicRoomHandler::checkInstrument(MusicControlArea area) const {
 	// TODO
 	return false;
 }
diff --git a/engines/titanic/sound/music_room_handler.h b/engines/titanic/sound/music_room_handler.h
index a15ef2d..395076b 100644
--- a/engines/titanic/sound/music_room_handler.h
+++ b/engines/titanic/sound/music_room_handler.h
@@ -92,7 +92,10 @@ public:
 	 */
 	void stop();
 
-	bool checkSound(int index) const;
+	/**
+	 * Checks the specified instrument to see if it's settings are "correct"
+	 */
+	bool checkInstrument(MusicControlArea area) const;
 
 	/**
 	 * Set a setting





More information about the Scummvm-git-logs mailing list