From c269c770ac27cbc845c06dfec8c7ac99d4fe657d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Mar 2016 12:35:41 -0500 Subject: TITANIC: Implemented sound manager loading --- engines/titanic/module.mk | 1 + engines/titanic/sound/sound.cpp | 4 +- engines/titanic/sound/sound.h | 4 +- engines/titanic/sound/sound_manager.cpp | 127 ++++++++++++++++++++++++ engines/titanic/sound/sound_manager.h | 118 ++++++++++++++++++++++ engines/titanic/true_talk/true_talk_manager.cpp | 25 ++++- engines/titanic/true_talk/true_talk_manager.h | 2 + engines/titanic/true_talk/tt_named_script.cpp | 5 +- 8 files changed, 279 insertions(+), 7 deletions(-) create mode 100644 engines/titanic/sound/sound_manager.cpp create mode 100644 engines/titanic/sound/sound_manager.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index bfb9317adc..e95977ab56 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -403,6 +403,7 @@ MODULE_OBJS := \ sound/season_noises.o \ sound/seasonal_music_player.o \ sound/sound.o \ + sound/sound_manager.o \ sound/titania_speech.o \ sound/trigger_auto_music_player.o \ sound/view_auto_sound_player.o \ diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index cea377eef7..35c1c708a6 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -28,11 +28,11 @@ CSound::CSound(CGameManager *owner) : _gameManager(owner) { } void CSound::save(SimpleFile *file) const { - + _soundManager.save(file); } void CSound::load(SimpleFile *file) { - + _soundManager.load(file); } } // End of namespace Titanic z diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index 2d0ccecbc5..6ae4019557 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -24,14 +24,16 @@ #define TITANIC_SOUND_H #include "titanic/simple_file.h" +#include "titanic/sound/sound_manager.h" namespace Titanic { class CGameManager; class CSound { -public: +private: CGameManager *_gameManager; + QSoundManager _soundManager; public: CSound(CGameManager *owner); diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp new file mode 100644 index 0000000000..143dd8385f --- /dev/null +++ b/engines/titanic/sound/sound_manager.cpp @@ -0,0 +1,127 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/sound/sound_manager.h" + +namespace Titanic { + +SoundManager::SoundManager() : _field4(0), _field8(0), + _fieldC(0), _field10(0), _field14(1) { +} + +/*------------------------------------------------------------------------*/ + +QSoundManager::QSoundManager() : _field18(0), _field1C(0) { + Common::fill(&_field4A0[0], &_field4A0[16], 0); +} + +int QSoundManager::proc3() { + warning("TODO"); + return 0; +} + +int QSoundManager::proc4() { + warning("TODO"); + return 0; +} + +int QSoundManager::proc5() { + warning("TODO"); + return 0; +} + +void QSoundManager::proc6() { + warning("TODO"); +} + +void QSoundManager::proc7() { + warning("TODO"); +} + +void QSoundManager::proc8() { + warning("TODO"); +} + +void QSoundManager::proc9() { + warning("TODO"); +} + +void QSoundManager::proc10() { + warning("TODO"); +} + +void QSoundManager::proc11() { + warning("TODO"); +} + +void QSoundManager::proc12() { + warning("TODO"); +} + +void QSoundManager::proc13() { + warning("TODO"); +} + +void QSoundManager::proc14() { + warning("TODO"); +} + +int QSoundManager::proc15() { + warning("TODO"); + return 0; +} + +int QSoundManager::proc16() { + warning("TODO"); + return 0; +} + +void QSoundManager::WaveMixPump() { + warning("TODO"); +} + +int QSoundManager::proc18() const { + warning("TODO"); + return 0; +} + +void QSoundManager::proc19(int v) { + warning("TODO"); +} + +void QSoundManager::proc20(int v) { + warning("TODO"); +} + +void QSoundManager::proc21(int v) { + warning("TODO"); +} + +void QSoundManager::proc29() { + warning("TODO"); +} + +void QSoundManager::proc30() { + warning("TODO"); +} + +} // End of namespace Titanic z diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h new file mode 100644 index 0000000000..4936625245 --- /dev/null +++ b/engines/titanic/sound/sound_manager.h @@ -0,0 +1,118 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_SOUND_MANAGER_H +#define TITANIC_SOUND_MANAGER_H + +#include "titanic/simple_file.h" + +namespace Titanic { + +class SoundManager { +protected: + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; +public: + SoundManager(); + + virtual int proc3() const { return 0; } + virtual int proc4() const { return 0; } + virtual int proc5() const { return 0; } + virtual void proc6() = 0; + virtual void proc7() = 0; + virtual void proc8() = 0; + virtual void proc9() {} + virtual void proc10() = 0; + virtual void proc11() = 0; + virtual void proc12() {} + virtual void proc13() {} + virtual void proc14() = 0; + virtual int proc15() const { return 0; } + virtual int proc16() const { return 0; } + virtual void WaveMixPump() {} + virtual int proc18() const { return 0; } + virtual void proc19(int v) { _field4 = v; } + virtual void proc20(int v) { _field8 = v; } + virtual void proc21(int v) { _fieldC = v; } + virtual void proc22(int v) { _field10 = v; } + virtual void proc23() { proc10(); } + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file) {} + + virtual void proc25() {} + virtual void proc26() {} + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file) const {} + + /** + * Called after saving is complete + */ + virtual void postSave() {} + + virtual void proc29() {} +}; + +class QSoundManager : public SoundManager { +public: + int _field18; + int _field1C; + + int _field4A0[16]; +public: + QSoundManager(); + + virtual int proc3(); + virtual int proc4(); + virtual int proc5(); + virtual void proc6(); + virtual void proc7(); + virtual void proc8(); + virtual void proc9(); + virtual void proc10(); + virtual void proc11(); + virtual void proc12(); + virtual void proc13(); + virtual void proc14(); + virtual int proc15(); + virtual int proc16(); + virtual void WaveMixPump(); + virtual int proc18() const; + virtual void proc19(int v); + virtual void proc20(int v); + virtual void proc21(int v); + + virtual void proc29(); + virtual void proc30(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_QSOUND_MANAGER_H */ diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 416a4e2a72..f176b2f3cf 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -62,11 +62,24 @@ void CTrueTalkManager::load(SimpleFile *file) { // Iterate through loading characters int charId = file->readNumber(); while (charId) { - uint ident = MKTAG_BE('U', 'R', 'A', 'H'); + loadNPC(file, charId); - do { + int ident1 = file->readNumber(); + int ident2 = file->readNumber(); + int v = 0; - } while (1); + if (ident1 != MKTAG_BE('U', 'R', 'A', 'H')) { + while (ident2 != MKTAG_BE('A', 'K', 'E', 'R')) { + ident1 = ident2; + ident2 = file->readNumber(); + + if (!ident1) + break; + } + } + + // Get start of next character + charId = file->readNumber(); } } @@ -147,6 +160,12 @@ void CTrueTalkManager::setFlags(int index, int val) { } } +void CTrueTalkManager::loadNPC(SimpleFile *file, int charId) { + TTNamedScript *script = _scripts.getNamedScript(charId); + if (script) + script->load(file); +} + void CTrueTalkManager::saveNPC(SimpleFile *file, int charId) const { TTNamedScript *script = _scripts.getNamedScript(charId); if (script) { diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index cd70af3113..274b5ccc65 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -47,6 +47,8 @@ private: */ static void saveStatics(SimpleFile *file); + void loadNPC(SimpleFile *file, int charId); + void saveNPC(SimpleFile *file, int charId) const; public: static int _v1; diff --git a/engines/titanic/true_talk/tt_named_script.cpp b/engines/titanic/true_talk/tt_named_script.cpp index 129727c62b..dfc5bb243d 100644 --- a/engines/titanic/true_talk/tt_named_script.cpp +++ b/engines/titanic/true_talk/tt_named_script.cpp @@ -36,7 +36,10 @@ TTNamedScriptBase::TTNamedScriptBase(int charId, const char *charClass, int v2, TTNamedScript::TTNamedScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNamedScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + TTNamedScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7), + _subPtr(nullptr), _field60(0), _field64(0), _field68(0), + _field6C(0), _field70(0), _field74(0), _field78(0), + _field7C(0), _field80(0) { CTrueTalkManager::_v2 = 0; Common::fill(&_array[0], &_array[147], 0); -- cgit v1.2.3