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

dreammaster dreammaster at scummvm.org
Sun Feb 12 19:05:45 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:
e00fb13809 TITANIC: Fix method names in CMusicRoomInstrument


Commit: e00fb1380949e85afc76163eee47c76027b30e10
    https://github.com/scummvm/scummvm/commit/e00fb1380949e85afc76163eee47c76027b30e10
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-02-12T13:05:37-05:00

Commit Message:
TITANIC: Fix method names in CMusicRoomInstrument

Changed paths:
    engines/titanic/sound/music_room_handler.cpp
    engines/titanic/sound/music_room_handler.h
    engines/titanic/sound/music_room_instrument.cpp
    engines/titanic/sound/music_room_instrument.h


diff --git a/engines/titanic/sound/music_room_handler.cpp b/engines/titanic/sound/music_room_handler.cpp
index b013bb1..81ba196 100644
--- a/engines/titanic/sound/music_room_handler.cpp
+++ b/engines/titanic/sound/music_room_handler.cpp
@@ -108,7 +108,7 @@ void CMusicRoomHandler::stop() {
 	}
 
 	for (int idx = 0; idx < 4; ++idx) {
-		_instruments[idx]->reset();
+		_instruments[idx]->clear();
 		if (_active && _instruments[idx])
 			_instruments[idx]->stop();
 	}
@@ -171,10 +171,10 @@ void CMusicRoomHandler::setMuteControl(MusicInstrument instrument, bool value) {
 		_array1[instrument]._muteControl = value;
 }
 
-void CMusicRoomHandler::trigger() {
+void CMusicRoomHandler::start() {
 	if (_active) {
 		for (int idx = 0; idx < 4; ++idx)
-			_instruments[idx]->trigger();
+			_instruments[idx]->start();
 	}
 }
 
@@ -182,7 +182,7 @@ bool CMusicRoomHandler::update() {
 	uint currentTicks = g_vm->_events->getTicksCount();
 
 	if (!_startTicks) {
-		trigger();
+		start();
 		_startTicks = currentTicks;
 	} else if (!_soundStartTicks && currentTicks >= (_startTicks + 3000)) {
 		if (_waveFile) {
@@ -260,7 +260,7 @@ void CMusicRoomHandler::fn1() {
 				const CValuePair &vp = (*_musicObjs[instrument])[_position[instrument]];
 				if (vp._field0 != 0x7FFFFFFF) {
 					int amount = getPitch(instrument, _position[instrument]);
-					_instruments[instrument]->start(amount);
+					_instruments[instrument]->update(amount);
 				}
 
 				if (ins1._directionControl == ins2._directionControl) {
@@ -276,14 +276,14 @@ void CMusicRoomHandler::fn1() {
 bool CMusicRoomHandler::updateInstrument(MusicInstrument instrument) {
 	int &arrIndex = _startPos[instrument];
 	if (arrIndex < 0) {
-		_instruments[instrument]->reset();
+		_instruments[instrument]->clear();
 		return false;
 	}
 
 	const CMusicObject &mObj = *_musicObjs[instrument];
 	if (arrIndex >= mObj.size()) {
 		arrIndex = -1;
-		_instruments[instrument]->reset();
+		_instruments[instrument]->clear();
 		return false;
 	}
 
@@ -291,7 +291,7 @@ bool CMusicRoomHandler::updateInstrument(MusicInstrument instrument) {
 	int size = static_cast<int>(fn3(instrument, arrIndex) * 44100.0) & ~1;
 
 	if (vp._field0 == 0x7FFFFFFF || _array1[instrument]._muteControl)
-		_instruments[instrument]->setSize(size);
+		_instruments[instrument]->reset(size);
 	else
 		_instruments[instrument]->chooseWaveFile(getPitch(instrument, arrIndex), size);
 
diff --git a/engines/titanic/sound/music_room_handler.h b/engines/titanic/sound/music_room_handler.h
index 999784e..eb274aa 100644
--- a/engines/titanic/sound/music_room_handler.h
+++ b/engines/titanic/sound/music_room_handler.h
@@ -67,7 +67,10 @@ private:
 	uint _startTicks;
 	int _volume;
 private:
-	void trigger();
+	/**
+	 * Starts music room instruments animation
+	 */
+	void start();
 
 	void updateAudio();
 	void fn1();
diff --git a/engines/titanic/sound/music_room_instrument.cpp b/engines/titanic/sound/music_room_instrument.cpp
index 5ec158f..144f9d1 100644
--- a/engines/titanic/sound/music_room_instrument.cpp
+++ b/engines/titanic/sound/music_room_instrument.cpp
@@ -104,7 +104,58 @@ CWaveFile *CMusicRoomInstrument::createWaveFile(const CString &name) {
 	return _soundManager->loadSound(name);
 }
 
-void CMusicRoomInstrument::start(int val) {
+void CMusicRoomInstrument::start() {
+	if (_gameObjects[0]) {
+		switch (_instrument) {
+		case MV_PIANO:
+			_gameObjects[0]->playMovie(0, 29, MOVIE_STOP_PREVIOUS);
+			_gameObjects[2]->loadFrame(14);
+			_gameObjects[3]->loadFrame(22);
+			break;
+
+		case MV_BELLS:
+			_gameObjects[0]->loadFrame(0);
+			_gameObjects[0]->movieSetAudioTiming(true);
+			break;
+
+		case MV_SNAKE:
+			_field4C = 22;
+			_gameObjects[1]->playMovie(0, 22, 0);
+			_gameObjects[2]->playMovie(0, 35, MOVIE_STOP_PREVIOUS);
+			_gameObjects[0]->playMovie(0, 1, MOVIE_STOP_PREVIOUS);
+			_gameObjects[0]->playMovie(0, 1, 0);
+			_gameObjects[0]->playMovie(0, 1, 0);
+			_gameObjects[0]->playMovie(0, 1, 0);
+			_gameObjects[0]->playMovie(0, 1, 0);
+			break;
+
+		default:
+			break;
+		}
+	}
+}
+
+void CMusicRoomInstrument::stop() {
+	if (_gameObjects[0]) {
+		switch (_instrument) {
+		case MV_PIANO:
+			_gameObjects[1]->setVisible(false);
+			_gameObjects[2]->setVisible(false);
+			_gameObjects[3]->setVisible(false);
+			_gameObjects[0]->playMovie(29, 58, MOVIE_STOP_PREVIOUS);
+			break;
+
+		case MV_BELLS:
+			_gameObjects[0]->stopMovie();
+			break;
+
+		default:
+			break;
+		}
+	}
+}
+
+void CMusicRoomInstrument::update(int val) {
 	if (_gameObjects[0]) {
 		switch (_instrument) {
 		case MV_PIANO:
@@ -202,58 +253,7 @@ void CMusicRoomInstrument::start(int val) {
 	}
 }
 
-void CMusicRoomInstrument::stop() {
-	if (_gameObjects[0]) {
-		switch (_instrument) {
-		case MV_PIANO:
-			_gameObjects[1]->setVisible(false);
-			_gameObjects[2]->setVisible(false);
-			_gameObjects[3]->setVisible(false);
-			_gameObjects[0]->playMovie(29, 58, MOVIE_STOP_PREVIOUS);
-			break;
-
-		case MV_BELLS:
-			_gameObjects[0]->stopMovie();
-			break;
-
-		default:
-			break;
-		}
-	}
-}
-
-void CMusicRoomInstrument::trigger() {
-	if (_gameObjects[0]) {
-		switch (_instrument) {
-		case MV_PIANO:
-			_gameObjects[0]->playMovie(0, 29, MOVIE_STOP_PREVIOUS);
-			_gameObjects[2]->loadFrame(14);
-			_gameObjects[3]->loadFrame(22);
-			break;
-
-		case MV_BELLS:
-			_gameObjects[0]->loadFrame(0);
-			_gameObjects[0]->movieSetAudioTiming(true);
-			break;
-		
-		case MV_SNAKE:
-			_field4C = 22;
-			_gameObjects[1]->playMovie(0, 22, 0);
-			_gameObjects[2]->playMovie(0, 35, MOVIE_STOP_PREVIOUS);
-			_gameObjects[0]->playMovie(0, 1, MOVIE_STOP_PREVIOUS);
-			_gameObjects[0]->playMovie(0, 1, 0);
-			_gameObjects[0]->playMovie(0, 1, 0);
-			_gameObjects[0]->playMovie(0, 1, 0);
-			_gameObjects[0]->playMovie(0, 1, 0);
-			break;
-
-		default:
-			break;
-		}
-	}
-}
-
-void CMusicRoomInstrument::reset() {
+void CMusicRoomInstrument::clear() {
 	_waveIndex = 0;
 	_readPos = 0;
 	_readIncrement = 0;
@@ -261,7 +261,7 @@ void CMusicRoomInstrument::reset() {
 	_count = 0;
 }
 
-void CMusicRoomInstrument::setSize(uint total) {
+void CMusicRoomInstrument::reset(uint total) {
 	_waveIndex = -1;
 	_readPos = 0;
 	_readIncrement = 0;
diff --git a/engines/titanic/sound/music_room_instrument.h b/engines/titanic/sound/music_room_instrument.h
index 0a8ff16..d63fe93 100644
--- a/engines/titanic/sound/music_room_instrument.h
+++ b/engines/titanic/sound/music_room_instrument.h
@@ -97,10 +97,11 @@ public:
 	 */
 	void load(int index, const CString &filename, int v3);
 
+
 	/**
 	 * Starts the music and associated animations
 	 */
-	void start(int val);
+	void start();
 
 	/**
 	 * Stops the music and associated animations
@@ -108,13 +109,21 @@ public:
 	void stop();
 
 	/**
-	 * Called regularly to handle triggering the animation of the
-	 * musical instrument associated with the instance
+	 * Handles regular updates of the instrument, allowing associated
+	 * objects to start animations as the music is played
+	 */
+	void update(int val);
+
+	/**
+	 * Clear the instrument
 	 */
-	void trigger();
+	void clear();
 
-	void reset();
-	void setSize(uint total);
+	/**
+	 * Resets the instrument, and sets the maximum for how much data can
+	 * be read from the wave files during each read action
+	 */
+	void reset(uint total);
 
 	/**
 	 * If there is any wave file currently specified, reads it in





More information about the Scummvm-git-logs mailing list