aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2012-04-29 11:23:02 +1000
committerPaul Gilbert2012-04-29 11:23:02 +1000
commitdd89597f880b9119ef0174cf9c61e662c129e266 (patch)
treea9b6763dba8f163a5db9f358db72f88d066e0908 /engines
parentf21bfe1c41148368f30b0602a8e8820fbd543543 (diff)
downloadscummvm-rg350-dd89597f880b9119ef0174cf9c61e662c129e266.tar.gz
scummvm-rg350-dd89597f880b9119ef0174cf9c61e662c129e266.tar.bz2
scummvm-rg350-dd89597f880b9119ef0174cf9c61e662c129e266.zip
TONY: Added voice database initialisation, as well as stubs for music init
Diffstat (limited to 'engines')
-rw-r--r--engines/tony/tony.cpp71
-rw-r--r--engines/tony/tony.h17
2 files changed, 88 insertions, 0 deletions
diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp
index 0708b45497..0eacbb5ff4 100644
--- a/engines/tony/tony.cpp
+++ b/engines/tony/tony.cpp
@@ -22,6 +22,7 @@
#include "common/scummsys.h"
#include "common/algorithm.h"
+#include "common/config-manager.h"
#include "common/file.h"
#include "tony/tony.h"
#include "tony/mpal/mpal.h"
@@ -36,6 +37,8 @@ TonyEngine::TonyEngine(OSystem *syst, const TonyGameDescription *gameDesc) : Eng
}
TonyEngine::~TonyEngine() {
+ // Close the voice database
+ CloseVoiceDatabase();
}
/**
@@ -72,6 +75,12 @@ Common::ErrorCode TonyEngine::Init() {
// Initialise the update resources
_resUpdate.Init("ROASTED.MPU");
+ // Initialise the music
+ InitMusic();
+
+ if (!OpenVoiceDatabase())
+ return Common::kReadingFailed;
+
return Common::kNoError;
}
@@ -82,4 +91,66 @@ void TonyEngine::GUIError(const Common::String &msg) {
GUIErrorMessage(msg);
}
+void TonyEngine::InitMusic() {
+ warning("TODO: TonyEngine::InitMusic");
+}
+
+void TonyEngine::CloseMusic() {
+ warning("TODO: TonyEngine::CloseMusic");
+}
+
+void TonyEngine::PauseSound(bool bPause) {
+}
+
+void TonyEngine::SetMusicVolume(int nChannel, int volume) {
+}
+
+int TonyEngine::GetMusicVolume(int nChannel) {
+ return 255;
+}
+
+bool TonyEngine::OpenVoiceDatabase() {
+ char id[4];
+ uint32 numfiles;
+
+ // Add the voices folder to the search directory list
+ const Common::FSNode gameDataDir(ConfMan.get("path"));
+ SearchMan.addSubDirectoryMatching(gameDataDir, "voices");
+
+ // Open the voices database
+ if (!_vdbFP.open("voices.vdb"))
+ return false;
+
+ _vdbFP.seek(-8, SEEK_END);
+ numfiles = _vdbFP.readUint32LE();
+ _vdbFP.read(id, 4);
+
+ if (id[0] != 'V' || id[1] != 'D' || id[2] != 'B' || id[3] != '1') {
+ _vdbFP.close();
+ return false;
+ }
+
+ // Read in the index
+ _vdbFP.seek(-8 - (numfiles * VOICE_HEADER_SIZE), SEEK_END);
+
+ for (uint32 i = 0; i < numfiles; ++i) {
+ VoiceHeader vh;
+ vh.offset = _vdbFP.readUint32LE();
+ vh.code = _vdbFP.readUint32LE();
+ vh.parts = _vdbFP.readUint32LE();
+
+ _voices.push_back(vh);
+ }
+
+ return true;
+}
+
+void TonyEngine::CloseVoiceDatabase() {
+ if (_vdbFP.isOpen())
+ _vdbFP.close();
+
+ if (_voices.size() > 0)
+ _voices.clear();
+}
+
} // End of namespace Tony
diff --git a/engines/tony/tony.h b/engines/tony/tony.h
index 9bf5f4cb98..77b1596112 100644
--- a/engines/tony/tony.h
+++ b/engines/tony/tony.h
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
#include "common/system.h"
+#include "common/array.h"
#include "common/error.h"
#include "common/random.h"
#include "common/util.h"
@@ -58,9 +59,23 @@ enum {
struct TonyGameDescription;
+struct VoiceHeader {
+ int offset;
+ int code;
+ int parts;
+};
+#define VOICE_HEADER_SIZE 12
+
class TonyEngine : public Engine {
private:
Common::ErrorCode Init();
+ void InitMusic();
+ void CloseMusic();
+ void PauseSound(bool bPause);
+ void SetMusicVolume(int nChannel, int volume);
+ int GetMusicVolume(int nChannel);
+ bool OpenVoiceDatabase();
+ void CloseVoiceDatabase();
protected:
// Engine APIs
virtual Common::Error run();
@@ -69,6 +84,8 @@ public:
LPCUSTOMFUNCTION FuncList[300];
Common::RandomSource _randomSource;
RMResUpdate _resUpdate;
+ Common::File _vdbFP;
+ Common::Array<VoiceHeader> _voices;
public:
TonyEngine(OSystem *syst, const TonyGameDescription *gameDesc);
virtual ~TonyEngine();