aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/sound/music_wave.cpp109
-rw-r--r--engines/titanic/sound/music_wave.h16
-rw-r--r--engines/titanic/titanic.cpp2
3 files changed, 126 insertions, 1 deletions
diff --git a/engines/titanic/sound/music_wave.cpp b/engines/titanic/sound/music_wave.cpp
index 835f4bc130..b4bb216d06 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 04709d18c6..bbafbb7abe 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 60d01dae35..5c84bde8a8 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();