aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-05-20 11:56:36 +0000
committerMax Horn2003-05-20 11:56:36 +0000
commit8d1110bfee983ad8e28f67564688eea872d8d4c1 (patch)
treef305238feee60a02661677e1ee4d1a3dc5d2a392
parente420517d027ad7d961088a27272eef939bb9e103 (diff)
downloadscummvm-rg350-8d1110bfee983ad8e28f67564688eea872d8d4c1.tar.gz
scummvm-rg350-8d1110bfee983ad8e28f67564688eea872d8d4c1.tar.bz2
scummvm-rg350-8d1110bfee983ad8e28f67564688eea872d8d4c1.zip
init all Bundle members properly; make _voiceFile/_musicFile protected
svn-id: r7718
-rw-r--r--scumm/bundle.cpp10
-rw-r--r--scumm/bundle.h40
-rw-r--r--scumm/resource.cpp4
-rw-r--r--scumm/sound.cpp4
4 files changed, 34 insertions, 24 deletions
diff --git a/scumm/bundle.cpp b/scumm/bundle.cpp
index 6d94cd7821..0804ca5125 100644
--- a/scumm/bundle.cpp
+++ b/scumm/bundle.cpp
@@ -93,11 +93,17 @@ const byte imxShortTable[] = {
};
Bundle::Bundle() {
- _lastSong = -1;
- _initializedImcTables = false;
+ _compVoiceTable = NULL;
+ _compMusicTable = NULL;
_bundleVoiceTable = NULL;
_bundleMusicTable = NULL;
+
+ _numVoiceFiles = 0;
+ _numMusicFiles = 0;
+
+ _lastSong = -1;
+ _initializedImcTables = false;
}
Bundle::~Bundle() {
diff --git a/scumm/bundle.h b/scumm/bundle.h
index 9f4d48f0ac..7bcb8b27f4 100644
--- a/scumm/bundle.h
+++ b/scumm/bundle.h
@@ -28,20 +28,18 @@ class Bundle {
private:
-struct CompTable {
- int32 offset;
- int32 size;
- int32 codec;
-};
-
-struct BundleAudioTable {
- char filename[13];
- int32 size;
- int32 offset;
-};
-
- int32 compDecode(byte *src, byte *dst);
- int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 size);
+ struct CompTable {
+ int32 offset;
+ int32 size;
+ int32 codec;
+ };
+
+ struct BundleAudioTable {
+ char filename[13];
+ int32 size;
+ int32 offset;
+ };
+
CompTable *_compVoiceTable;
CompTable *_compMusicTable;
BundleAudioTable *_bundleVoiceTable;
@@ -54,15 +52,21 @@ struct BundleAudioTable {
byte _destImcTable[93];
uint32 _destImcTable2[5697];
+ File _voiceFile;
+ File _musicFile;
+
+ int32 compDecode(byte *src, byte *dst);
+ int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 size);
+
public:
- Bundle();
- ~Bundle();
+ Bundle();
+ ~Bundle();
- File _musicFile;
- File _voiceFile;
void initializeImcTables();
bool openVoiceFile(const char *filename, const char *directory);
bool openMusicFile(const char *filename, const char *directory);
+ void closeVoiceFile() { _voiceFile.close(); }
+ void closeMusicFile() { _musicFile.close(); }
int32 decompressVoiceSampleByName(char *name, byte **comp_final);
int32 decompressVoiceSampleByIndex(int32 index, byte **comp_final);
int32 decompressMusicSampleByName(char *name, int32 number, byte *comp_final);
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index a30a21b83c..e4acb819cc 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -225,8 +225,8 @@ void Scumm::askForDisk(const char *filename, int disknum) {
if (_features & GF_AFTER_V8) {
char result;
- _bundle->_voiceFile.close();
- _bundle->_musicFile.close();
+ _bundle->closeVoiceFile();
+ _bundle->closeMusicFile();
sprintf(buf, "Cannot find file: '%s'\nInsert disc %d into drive %s\nHit Ok to retry, Cancel to exit", filename, disknum, getGameDataPath());
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 12d5633da9..ff496acd8a 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -1041,7 +1041,7 @@ void Sound::playBundleMusic(char *song) {
char bunfile[20];
sprintf(bunfile, "musdisk%d.bun", _scumm->VAR(_scumm->VAR_CURRENTDISK));
if (_musicDisk != _scumm->VAR(_scumm->VAR_CURRENTDISK))
- _scumm->_bundle->_musicFile.close();
+ _scumm->_bundle->closeMusicFile();
if (_scumm->_bundle->openMusicFile(bunfile, _scumm->getGameDataPath()) == false) {
if (_scumm->_bundle->openMusicFile("music.bun", _scumm->getGameDataPath()) == false) {
@@ -1226,7 +1226,7 @@ int Sound::playBundleSound(char *sound) {
char voxfile[20];
sprintf(voxfile, "voxdisk%d.bun", _scumm->VAR(_scumm->VAR_CURRENTDISK));
if (_voiceDisk != _scumm->VAR(_scumm->VAR_CURRENTDISK))
- _scumm->_bundle->_voiceFile.close();
+ _scumm->_bundle->closeVoiceFile();
result = _scumm->_bundle->openVoiceFile(voxfile, _scumm->getGameDataPath());