[Scummvm-git-logs] scummvm master -> 126bae6320caee835b42149d09f69a06542f4eed

dreammaster dreammaster at scummvm.org
Mon Jan 30 05:51:28 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:
126bae6320 TITANIC: Implemented CMusicWave start


Commit: 126bae6320caee835b42149d09f69a06542f4eed
    https://github.com/scummvm/scummvm/commit/126bae6320caee835b42149d09f69a06542f4eed
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-01-29T23:51:22-05:00

Commit Message:
TITANIC: Implemented CMusicWave start

Changed paths:
    engines/titanic/sound/music_wave.cpp
    engines/titanic/sound/music_wave.h
    engines/titanic/titanic.cpp


diff --git a/engines/titanic/sound/music_wave.cpp b/engines/titanic/sound/music_wave.cpp
index 835f4bc..b4bb216 100644
--- a/engines/titanic/sound/music_wave.cpp
+++ b/engines/titanic/sound/music_wave.cpp
@@ -27,6 +27,16 @@
 
 namespace Titanic {
 
+bool CMusicWave::_pianoToggle;
+int CMusicWave::_pianoCtr;
+int CMusicWave::_bassCtr;
+
+void CMusicWave::init() {
+	_pianoToggle = false;
+	_pianoCtr = 0;
+	_bassCtr = 0;
+}
+
 CMusicWave::CMusicWave(CProjectItem *project, CSoundManager *soundManager, MusicWaveInstrument instrument) :
 		_soundManager(soundManager), _instrument(instrument) {
 	Common::fill(&_gameObjects[0], &_gameObjects[4], (CGameObject *)nullptr);
@@ -79,6 +89,105 @@ CWaveFile *CMusicWave::createWaveFile(const CString &name) {
 	return _soundManager->loadSound(name);
 }
 
+void CMusicWave::start(int val) {
+	if (_gameObjects[0]) {
+		switch (_instrument) {
+		case MV_PIANO:
+			_gameObjects[1]->setVisible(true);
+			_gameObjects[2]->setVisible(true);
+			_gameObjects[3]->setVisible(true);
+			_gameObjects[_pianoToggle ? 3 : 2]->playMovie(MOVIE_STOP_PREVIOUS);
+			_pianoToggle = !_pianoToggle;
+
+			switch (_pianoCtr) {
+			case 0:
+				_gameObjects[1]->playMovie(0, 4, MOVIE_STOP_PREVIOUS);
+				break;
+			case 1:
+				_gameObjects[1]->playMovie(4, 8, MOVIE_STOP_PREVIOUS);
+				break;
+			case 2:
+				_gameObjects[1]->playMovie(8, 12, MOVIE_STOP_PREVIOUS);
+				break;
+			case 3:
+				_gameObjects[1]->playMovie(12, 16, MOVIE_STOP_PREVIOUS);
+				break;
+			default:
+				break;
+			}
+
+			_pianoCtr = (_pianoCtr + 1) % 4;
+			break;
+
+		case MV_BASS:
+			switch (_bassCtr) {
+			case 0:
+				_gameObjects[0]->playMovie(0, 7, MOVIE_STOP_PREVIOUS);
+				break;
+			case 1:
+				_gameObjects[0]->playMovie(7, 14, MOVIE_STOP_PREVIOUS);
+				break;
+			case 2:
+				_gameObjects[0]->playMovie(15, 24, MOVIE_STOP_PREVIOUS);
+				break;
+			case 3:
+				_gameObjects[0]->playMovie(25, 33, MOVIE_STOP_PREVIOUS);
+				break;
+			default:
+				break;
+			}
+
+			// WORKAROUND: Original didn't change the selected bass animation
+			_bassCtr = (_bassCtr + 1) % 4;
+			break;
+
+		case MV_BELLS:
+			switch (val) {
+			case 60:
+				_gameObjects[0]->movieSetAudioTiming(true);
+				_gameObjects[0]->playMovie(0, 512, MOVIE_STOP_PREVIOUS);
+				_field20 = 0x33333333;
+				_field24 = 0x3FE33333;
+
+			case 62:
+				_gameObjects[0]->playMovie(828, 1023, MOVIE_STOP_PREVIOUS);
+				_field20 = 0x33333333;
+				_field24 = 0x3FD33333;
+				break;
+
+			case 63:
+				_gameObjects[0]->playMovie(1024, 1085, MOVIE_STOP_PREVIOUS);
+				break;
+
+			default:
+				break;
+			}
+			break;
+
+		case MV_SNAKE: {
+			_gameObjects[0]->playMovie(0, 7, MOVIE_STOP_PREVIOUS);
+
+			double tempVal = 46.0 - ((double)(val - 14) * 1.43);
+			int frameNum = _field4C;
+			int frameNum1 = (tempVal - frameNum) * 0.25;
+			_gameObjects[1]->playMovie(frameNum1, frameNum1, MOVIE_STOP_PREVIOUS);
+
+			frameNum += frameNum1;
+			_gameObjects[1]->playMovie(frameNum, frameNum, 0);
+
+			frameNum += frameNum1;
+			_gameObjects[1]->playMovie(frameNum, frameNum, 0);
+
+			_gameObjects[2]->playMovie(45, 49, MOVIE_STOP_PREVIOUS);
+			break;
+		}
+
+		default:
+			break;
+		}
+	}
+}
+
 void CMusicWave::stop() {
 	if (_gameObjects[0]) {
 		switch (_instrument) {
diff --git a/engines/titanic/sound/music_wave.h b/engines/titanic/sound/music_wave.h
index 04709d1..bbafbb7 100644
--- a/engines/titanic/sound/music_wave.h
+++ b/engines/titanic/sound/music_wave.h
@@ -42,6 +42,10 @@ class CMusicWave {
 		CMusicWaveFile() : _waveFile(nullptr), _value(0) {}
 	};
 private:
+	static bool _pianoToggle;
+	static int _pianoCtr;
+	static int _bassCtr;
+private:
 	CSoundManager *_soundManager;
 	Common::Array<CMusicWaveFile> _items;
 	MusicWaveInstrument _instrument;
@@ -56,6 +60,11 @@ private:
 	 */
 	CWaveFile *createWaveFile(const CString &name);
 public:
+	/**
+	 * Handles initialization of static fields
+	 */
+	static void init();
+public:
 	CMusicWave(CProjectItem *project, CSoundManager *soundManager, MusicWaveInstrument instrument);
 
 	/**
@@ -69,7 +78,12 @@ public:
 	void load(int index, const CString &filename, int v3);
 
 	/**
-	 * Stops the music
+	 * Starts the music and associated animations
+	 */
+	void start(int val);
+
+	/**
+	 * Stops the music and associated animations
 	 */
 	void stop();
 
diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp
index 60d01da..5c84bde 100644
--- a/engines/titanic/titanic.cpp
+++ b/engines/titanic/titanic.cpp
@@ -41,6 +41,7 @@
 #include "titanic/moves/enter_exit_sec_class_mini_lift.h"
 #include "titanic/moves/exit_pellerator.h"
 #include "titanic/pet_control/pet_control.h"
+#include "titanic/sound/music_wave.h"
 #include "titanic/support/simple_file.h"
 #include "titanic/true_talk/tt_npc_script.h"
 
@@ -86,6 +87,7 @@ void TitanicEngine::initialize() {
 	CGetLiftEye2::init();
 	CHose::init();
 	CMovie::init();
+	CMusicWave::init();
 	CParrotLobbyObject::init();
 	CSGTNavigation::init();
 	CSGTStateRoom::init();





More information about the Scummvm-git-logs mailing list