[Scummvm-cvs-logs] SF.net SVN: scummvm: [30198] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Jan 3 15:42:49 CET 2008


Revision: 30198
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30198&view=rev
Author:   lordhoto
Date:     2008-01-03 06:42:49 -0800 (Thu, 03 Jan 2008)

Log Message:
-----------
Committed slightly modified patch #1862758 "KYRA: audio data assignment patch".

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/kyra.h
    scummvm/trunk/engines/kyra/kyra_v1.cpp
    scummvm/trunk/engines/kyra/kyra_v1.h
    scummvm/trunk/engines/kyra/kyra_v2.cpp
    scummvm/trunk/engines/kyra/kyra_v2.h
    scummvm/trunk/engines/kyra/saveload_v1.cpp
    scummvm/trunk/engines/kyra/sequences_v2.cpp
    scummvm/trunk/engines/kyra/sound.cpp
    scummvm/trunk/engines/kyra/sound.h
    scummvm/trunk/engines/kyra/sound_adlib.cpp
    scummvm/trunk/engines/kyra/sound_towns.cpp
    scummvm/trunk/engines/kyra/staticres.cpp

Modified: scummvm/trunk/engines/kyra/kyra.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra.h	2008-01-03 13:28:04 UTC (rev 30197)
+++ scummvm/trunk/engines/kyra/kyra.h	2008-01-03 14:42:49 UTC (rev 30198)
@@ -56,6 +56,13 @@
 	GI_KYRA3 = 2
 };
 
+struct AudioDataStruct {
+	const char * const *_fileList;
+	const uint _fileListLen;	
+	const void * const _cdaTracks;
+	const uint _cdaNumTracks;
+};
+
 // TODO: this is just the start of makeing the debug output of the kyra engine a bit more useable
 // in the future we maybe merge some flags  and/or create new ones
 enum kDebugLevels {

Modified: scummvm/trunk/engines/kyra/kyra_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.cpp	2008-01-03 13:28:04 UTC (rev 30197)
+++ scummvm/trunk/engines/kyra/kyra_v1.cpp	2008-01-03 14:42:49 UTC (rev 30198)
@@ -180,10 +180,9 @@
 
 	initStaticResource();
 	
-	if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98)
-		_sound->setSoundFileList(_soundFilesTowns, _soundFilesTownsCount);
-	else
-		_sound->setSoundFileList(_soundFiles, _soundFilesCount);
+	const AudioDataStruct *const sndList = (_flags.platform == Common::kPlatformFMTowns ||
+		_flags.platform == Common::kPlatformPC98) ? _soundData_TOWNS : _soundData_PC;
+	_sound->setSoundList(sndList);
 
 	_trackMap = _dosTrackMap;
 	_trackMapSize = _dosTrackMapSize;

Modified: scummvm/trunk/engines/kyra/kyra_v1.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.h	2008-01-03 13:28:04 UTC (rev 30197)
+++ scummvm/trunk/engines/kyra/kyra_v1.h	2008-01-03 14:42:49 UTC (rev 30198)
@@ -764,10 +764,11 @@
 	const uint8 * const*_specialPalettes;
 
 	static const char *_soundFiles[];
-	static const int _soundFilesCount;
 	static const char *_soundFilesTowns[];
-	static const int _soundFilesTownsCount;
-	
+	static const int32 _cdaTrackTable[];
+	static const AudioDataStruct _soundData_PC[];
+	static const AudioDataStruct _soundData_TOWNS[];
+		
 	static const int8 _charXPosTable[];
 	static const int8 _charYPosTable[];
 

Modified: scummvm/trunk/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-01-03 13:28:04 UTC (rev 30197)
+++ scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-01-03 14:42:49 UTC (rev 30198)
@@ -139,12 +139,21 @@
 		_sequenceStrings = (const char * const *) _sequenceStrings_TOWNS_EN;
 		_sequenceStringsSize = _sequenceStringsSize_TOWNS_EN;
 		_sequences = (const Sequence*) _sequences_TOWNS;
-	} else {
+		_soundData = (const AudioDataStruct *) _soundData_TOWNS;
+	} else if (_flags.isTalkie) {
 		_sequenceSoundList = (const char * const *) _sequenceSoundList_PC;
 		_sequenceSoundListSize = _sequenceSoundListSize_PC;
 		_sequenceStrings = (const char * const *) _sequenceStrings_PC_EN;
 		_sequenceStringsSize = _sequenceStringsSize_PC_EN;
 		_sequences = (const Sequence*) _sequences_PC;
+		_soundData = (const AudioDataStruct *) _soundData_PC;
+	} else {
+		_sequenceSoundList = (const char * const *) _sequenceSoundList_PCFLOPPY;
+		_sequenceSoundListSize = _sequenceSoundListSize_PCFLOPPY;
+		_sequenceStrings = (const char * const *) _sequenceStrings_PC_EN;
+		_sequenceStringsSize = _sequenceStringsSize_PC_EN;
+		_sequences = (const Sequence*) _sequences_PC;
+		_soundData = (const AudioDataStruct *) _soundData_PC;
 	}
 
 	for (int i = 0; i < 33; i++)
@@ -170,45 +179,58 @@
 	if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98)
 		seq_showStarcraftLogo();
 
-	seq_playSequences(kSequenceVirgin, kSequenceZanfaun);
-	//seq_playSequences(kSequenceFunters, kSequenceFrash);
+	if (_flags.platform == Common::kPlatformPC && _flags.isDemo) {
+		_res->loadPakFile("VOC.PAK");
+		_menuChoice = 2;
+	} else {
+		seq_playSequences(kSequenceVirgin, kSequenceZanfaun);
+		//seq_playSequences(kSequenceFunters, kSequenceFrash);
 
-	if (_menuChoice == 1) {
-		// load just the pak files needed for ingame
 		_res->unloadAllPakFiles();
-		if (_flags.platform == Common::kPlatformPC && (_flags.isTalkie || _flags.isDemo)) {
-			_res->loadFileList("FILEDATA.FDT");
-		} else if (_flags.platform == Common::kPlatformPC) {
-			//TODO:
-			//What files are needed for floppy version?
-		} else if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) {
-			char tmpfilename[13];
-			static const char * pakfiles [] = { "KYRA.DAT", "AUDIO.PAK", "CAULDRON.PAK",
-				"MISC_CPS.PAK", "MISC_EMC.PAK", "OTHER.PAK", "VOC.PAK", "WSCORE.PAK" };
-			for (int i = 0; i < 8; i++)
-				_res->loadPakFile(pakfiles[i]);
-			for (int i = 1; i < 10; i++) {
-				sprintf(tmpfilename, "COST%d_SH.PAK", i);
-				_res->loadPakFile(tmpfilename);
+
+		if (_menuChoice != 4) {
+			// load just the pak files needed for ingame
+			if (_flags.platform == Common::kPlatformPC && _flags.isTalkie) {
+				_res->loadFileList("FILEDATA.FDT");
+				_res->loadPakFile("KYRA.DAT");			
+			} else if (_flags.platform == Common::kPlatformPC) {
+				// TODO
+
+			} else if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) {
+				char tmpfilename[13];
+				static const char * pakfiles [] = { "KYRA.DAT", "AUDIO.PAK", "CAULDRON.PAK",
+					"MISC_CPS.PAK", "MISC_EMC.PAK", "OTHER.PAK", "VOC.PAK", "WSCORE.PAK" };
+				for (int i = 0; i < 8; i++)
+					_res->loadPakFile(pakfiles[i]);
+				for (int i = 1; i < 10; i++) {
+					sprintf(tmpfilename, "COST%d_SH.PAK", i);
+					_res->loadPakFile(tmpfilename);
+				}
+				for (int i = 1; i < 6; i++) {
+					sprintf(tmpfilename, "HOFCH_%d.PAK", i);
+					_res->loadPakFile(tmpfilename);
+				}
 			}
-			for (int i = 1; i < 6; i++) {
-				sprintf(tmpfilename, "HOFCH_%d.PAK", i);
-				_res->loadPakFile(tmpfilename);
-			}
 		}
+	}
 
+	if (_menuChoice == 1) {
 		startup();
 		runLoop();
 		cleanup();
 	} else if (_menuChoice == 3) {
-		// Load Game
+		// TODO:	Load Game
+
+	} else if (_menuChoice == 2) {
+		// TODO:	Run Demo
+
 	}
 
 	return 0;
 }
 
 void KyraEngine_v2::startup() {
-	snd_assignMusicData(kMusicIngame);
+	_sound->setSoundList(&_soundData[kMusicIngame]);
 	// The track map is exactly the same
 	// for FM-TOWNS and DOS
 	_trackMap = _dosTrackMap;
@@ -1567,19 +1589,6 @@
 	_sound->loadSoundFile(file);
 }
 
-void KyraEngine_v2::snd_assignMusicData(kMusicDataID id) {
-	if (_flags.platform == Common::kPlatformPC) {
-		if (id == kMusicIntro)
-			_sound->setSoundFileList(_dosSoundFileListIntro, 1);
-		else if (id == kMusicFinale)
-			_sound->setSoundFileList(_dosSoundFileListFinale, 1);
-		else
-			_sound->setSoundFileList(_dosSoundFileList, _dosSoundFileListSize);
-	} else {
-		_sound->assignData(id);
-	}
-}
-
 void KyraEngine_v2::playVoice(int high, int low) {
 	int vocFile = high * 10000 + low * 10;
 	snd_playVoiceFile(vocFile);

Modified: scummvm/trunk/engines/kyra/kyra_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.h	2008-01-03 13:28:04 UTC (rev 30197)
+++ scummvm/trunk/engines/kyra/kyra_v2.h	2008-01-03 14:42:49 UTC (rev 30198)
@@ -250,10 +250,18 @@
 
 	static const char *_dosSoundFileListIntro[];
 	static const char *_dosSoundFileListFinale[];
-	static const char *_dosSoundFileList[];
-	static const int _dosSoundFileListSize;
+	static const char *_dosSoundFileList[];	
+	static const char *_fmtSoundFileListIntro[];
+	static const char *_fmtSoundFileListFinale[];
+	static const char *_fmtSoundFileList[];
+	static const uint8 _cdaTrackTableIntro[];
+	static const uint8 _cdaTrackTableIngame[];
+	static const uint8 _cdaTrackTableFinale[];
+	static const AudioDataStruct _soundData_PC[];
+	static const AudioDataStruct _soundData_TOWNS[];
 	static const int8 _dosTrackMap[];
 	static const int _dosTrackMapSize;
+	const AudioDataStruct * _soundData;
 
 protected:
 	// game initialization
@@ -630,7 +638,6 @@
 
 	virtual void snd_playVoiceFile(int id);
 	void snd_loadSoundFile(int id);
-	void snd_assignMusicData(kMusicDataID id);
 
 	void playVoice(int high, int low);
 
@@ -843,6 +850,8 @@
 
 	static const char *_sequenceSoundList_PC[];
 	static const int _sequenceSoundListSize_PC;
+	static const char *_sequenceSoundList_PCFLOPPY[];
+	static const int _sequenceSoundListSize_PCFLOPPY;
 	static const char *_sequenceSoundList_TOWNS[];
 	static const int _sequenceSoundListSize_TOWNS;
 	static const char *_sequenceStrings_TOWNS_EN[];

Modified: scummvm/trunk/engines/kyra/saveload_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/saveload_v1.cpp	2008-01-03 13:28:04 UTC (rev 30197)
+++ scummvm/trunk/engines/kyra/saveload_v1.cpp	2008-01-03 14:42:49 UTC (rev 30198)
@@ -202,7 +202,7 @@
 		// In the first version when this entry was introduced,
 		// it wasn't made sure that _curSfxFile was initialized
 		// so if it's out of bounds we just set it to 0.
-		if (_curSfxFile >= _soundFilesTownsCount || _curSfxFile < 0)
+		if (_curSfxFile >= (int)_soundData_TOWNS->_fileListLen || _curSfxFile < 0)
 			_curSfxFile = 0;
 
 		if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98)

Modified: scummvm/trunk/engines/kyra/sequences_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_v2.cpp	2008-01-03 13:28:04 UTC (rev 30197)
+++ scummvm/trunk/engines/kyra/sequences_v2.cpp	2008-01-03 14:42:49 UTC (rev 30198)
@@ -46,15 +46,8 @@
 
 	assert(startSeq >= 0 && endSeq < kSequenceArraySize && startSeq <= endSeq);
 
-	if (_flags.isDemo) {
-		static const char *soundFileList[] = {
-			"K2_DEMO",
-			"LOLSYSEX"
-		};
-		_sound->setSoundFileList(soundFileList, 2);
-	} else {
-		snd_assignMusicData((startSeq > kSequenceZanfaun) ?	kMusicFinale : kMusicIntro);
-	}
+	// TODO: verfiy this is also correct for the demo
+	_sound->setSoundList(&_soundData[(startSeq > kSequenceZanfaun) ? kMusicFinale : kMusicIntro]);
 	_sound->loadSoundFile(0);
 
 	_screen->_charWidth = -2;
@@ -1528,7 +1521,7 @@
 	_screen->loadBitmap("finale.cps", 3, 3, _screen->_currentPalette);
 	_screen->setFont(Screen::FID_GOLDFONT_FNT);
 
-	snd_assignMusicData(kMusicIngame);
+	_sound->setSoundList(&_soundData[kMusicIngame]);
 	_sound->loadSoundFile(3);
 	_sound->playTrack(3);
 
@@ -1537,7 +1530,7 @@
 
 	//XXX
 
-	snd_assignMusicData(kMusicFinale);
+	_sound->setSoundList(&_soundData[kMusicFinale]);
 	_sound->loadSoundFile(0);
 }
 

Modified: scummvm/trunk/engines/kyra/sound.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound.cpp	2008-01-03 13:28:04 UTC (rev 30197)
+++ scummvm/trunk/engines/kyra/sound.cpp	2008-01-03 14:42:49 UTC (rev 30198)
@@ -40,7 +40,7 @@
 
 Sound::Sound(KyraEngine *vm, Audio::Mixer *mixer)
 	: _vm(vm), _mixer(mixer), _currentVocFile(0), _vocHandle(), _compressHandle(),
-	_musicEnabled(1), _sfxEnabled(true), _soundFileList(0), _soundFileListSize(0) {
+	_musicEnabled(1), _sfxEnabled(true), _soundDataList(0) {
 }
 
 Sound::~Sound() {
@@ -259,7 +259,7 @@
 
 void SoundMidiPC::loadSoundFile(uint file) {
 	char filename[25];
-	sprintf(filename, "%s.%s", soundFilename(file), _useC55 ? "C55" : "XMI");
+	sprintf(filename, "%s.%s", fileListEntry(file), _useC55 ? "C55" : "XMI");
 
 	uint32 size;
 	uint8 *data = (_vm->resource())->fileData(filename, &size);
@@ -296,7 +296,7 @@
 
 void SoundMidiPC::loadSoundEffectFile(uint file) {
 	char filename[25];
-	sprintf(filename, "%s.%s", soundFilename(file), _useC55 ? "C55" : "XMI");
+	sprintf(filename, "%s.%s", fileListEntry(file), _useC55 ? "C55" : "XMI");
 
 	uint32 size;
 	uint8 *data = (_vm->resource())->fileData(filename, &size);

Modified: scummvm/trunk/engines/kyra/sound.h
===================================================================
--- scummvm/trunk/engines/kyra/sound.h	2008-01-03 13:28:04 UTC (rev 30197)
+++ scummvm/trunk/engines/kyra/sound.h	2008-01-03 14:42:49 UTC (rev 30198)
@@ -105,25 +105,10 @@
 	 * when playing a track and/or sound effect.
 	 *
 	 * @param list	soundfile list
-	 * @param s		number of soundfiles
 	 */
-	virtual void setSoundFileList(const char * const *list, uint s) { _soundFileList = list; _soundFileListSize = s; }
+	virtual void setSoundList(const AudioDataStruct *list) { _soundDataList = list; }
 
 	/**
-	 * Selects preset bundles of music files
-	 * and cd audio tracks the output device will use
-	 * when playing a track and/or sound effect.
-	 *
-	 * TODO: this is just needed for Kyrandia 2 FM-Towns version,
-	 * and is similar to what setSoundFileList is used for, so we
-	 * should think of a better solution than this.
-	 * @see setSoundFileList
-	 *
-	 * @param id	kMusicIntro, kMusicIngame or kMusicFinale
-	 */	
-	virtual void assignData(kMusicDataID id) { _currentTheme = id; }
-
-	/**
 	 * Load a specifc sound file for use of
 	 * playing music and sound effects.
 	 */
@@ -191,7 +176,10 @@
 	void voiceStop();
 
 protected:
-	const char *soundFilename(uint file) { return (file < _soundFileListSize) ? _soundFileList[file] : ""; }
+	const char *fileListEntry(uint file) const { return (file < _soundDataList->_fileListLen) ? _soundDataList->_fileList[file] : ""; }
+	const void *cdaData() const { return _soundDataList->_cdaTracks; }
+	const uint32 cdaTrackNum() const { return _soundDataList->_cdaNumTracks; }
+
 	int _musicEnabled;
 	bool _sfxEnabled;
 
@@ -201,9 +189,7 @@
 	Audio::Mixer *_mixer;
 
 private:
-	const char * const *_soundFileList;
-	uint _soundFileListSize;
-
+	const AudioDataStruct *_soundDataList;
 	Audio::AudioStream *_currentVocFile;
 	Audio::SoundHandle _vocHandle;
 	Common::File _compressHandle;
@@ -444,16 +430,6 @@
 
 	//SoundTowns_v2_TwnDriver * _driver;
 	uint8 * _twnTrackData;
-
-	static const uint8 _cdaTrackTableK2Intro[];
-	static const uint8 _cdaTrackTableK2Ingame[];
-	static const uint8 _cdaTrackTableK2Finale[];
-
-	static const struct Kyra2AudioThemes {
-		const uint8 * cdaTable;
-		const uint8 cdaTableSize;
-		const char * twnFilename;
-	} _themes[];
 };
 
 class MixedSoundDriver : public Sound {
@@ -467,7 +443,7 @@
 	void setVolume(int volume) { _music->setVolume(volume); _sfx->setVolume(volume); }
 	int getVolume() { return _music->getVolume(); }
 
-	void setSoundFileList(const char * const*list, uint s) { _music->setSoundFileList(list, s); _sfx->setSoundFileList(list, s); }
+	void setSoundList(const AudioDataStruct * const list) { _music->setSoundList(list); _sfx->setSoundList(list); }
 	void loadSoundFile(uint file) { _music->loadSoundFile(file); _sfx->loadSoundFile(file); }
 
 	void playTrack(uint8 track) { _music->playTrack(track); }

Modified: scummvm/trunk/engines/kyra/sound_adlib.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_adlib.cpp	2008-01-03 13:28:04 UTC (rev 30197)
+++ scummvm/trunk/engines/kyra/sound_adlib.cpp	2008-01-03 14:42:49 UTC (rev 30198)
@@ -2267,7 +2267,7 @@
 		// sync for each loop. To avoid that, we declare that all four
 		// of the song channels have to jump "in sync".
 
-		if (track == 4 && scumm_stricmp(soundFilename(_soundFileLoaded), "KYRA1B") == 0)
+		if (track == 4 && scumm_stricmp(fileListEntry(_soundFileLoaded), "KYRA1B") == 0)
 			_driver->setSyncJumpMask(0x000F);
 		else
 			_driver->setSyncJumpMask(0);
@@ -2351,7 +2351,7 @@
 	uint8 *file_data = 0; uint32 file_size = 0;
 
 	char filename[25];
-	sprintf(filename, "%s.ADL", soundFilename(file));
+	sprintf(filename, "%s.ADL", fileListEntry(file));
 
 	file_data = _vm->resource()->fileData(filename, &file_size);
 	if (!file_data) {

Modified: scummvm/trunk/engines/kyra/sound_towns.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_towns.cpp	2008-01-03 13:28:04 UTC (rev 30197)
+++ scummvm/trunk/engines/kyra/sound_towns.cpp	2008-01-03 14:42:49 UTC (rev 30198)
@@ -1118,46 +1118,16 @@
 	AudioCD.updateCD();
 }
 
-namespace {
-
-struct CDTrackTable {
-	uint32 fileOffset;
-	bool loop;
-	int track;
-};
-
-} // end of anonymous namespace
-
 void SoundTowns::playTrack(uint8 track) {
 	if (track < 2)
 		return;
 	track -= 2;
 
-	static const CDTrackTable tTable[] = {
-		{ 0x04000, 1,  0 },	{ 0x05480, 1,  6 },	{ 0x05E70, 0,  1 },
-		{ 0x06D90, 1,  3 },	{ 0x072C0, 0, -1 },	{ 0x075F0, 1, -1 },
-		{ 0x07880, 1, -1 },	{ 0x089C0, 0, -1 },	{ 0x09080, 0, -1 },
-		{ 0x091D0, 1,  4 },	{ 0x0A880, 1,  5 },	{ 0x0AF50, 0, -1 },
-		{ 0x0B1A0, 1, -1 },	{ 0x0B870, 0, -1 },	{ 0x0BCF0, 1, -1 },
-		{ 0x0C5D0, 1,  7 },	{ 0x0D3E0, 1,  8 },	{ 0x0e7b0, 1,  2 },
-		{ 0x0edc0, 0, -1 },	{ 0x0eef0, 1,  9 },	{ 0x10540, 1, 10 },
-		{ 0x10d80, 0, -1 },	{ 0x10E30, 0, -1 },	{ 0x10FC0, 0, -1 },
-		{ 0x11310, 1, -1 },	{ 0x11A20, 1, -1 },	{ 0x12380, 0, -1 },
-		{ 0x12540, 1, -1 },	{ 0x12730, 1, -1 },	{ 0x12A90, 1, 11 },
-		{ 0x134D0, 0, -1 },	{ 0x00000, 0, -1 },	{ 0x13770, 0, -1 },
-		{ 0x00000, 0, -1 },	{ 0x00000, 0, -1 },	{ 0x00000, 0, -1 },
-		{ 0x00000, 0, -1 },	{ 0x14710, 1, 12 },	{ 0x15DF0, 1, 13 },
-		{ 0x16030, 1, 14 },	{ 0x17030, 0, -1 },	{ 0x17650, 0, -1 },
-		{ 0x134D0, 0, -1 },	{ 0x178E0, 1, -1 },	{ 0x18200, 0, -1 },
-		{ 0x18320, 0, -1 },	{ 0x184A0, 0, -1 },	{ 0x18BB0, 0, -1 },
-		{ 0x19040, 0, 19 },	{ 0x19B50, 0, 20 },	{ 0x17650, 0, -1 },
-		{ 0x1A730, 1, 21 },	{ 0x00000, 0, -1 },	{ 0x12380, 0, -1 },
-		{ 0x1B810, 0, -1 },	{ 0x1BA50, 0, 15 },	{ 0x1C190, 0, 16 },
-		{ 0x1CA50, 0, 17 },	{ 0x1D100, 0, 18 }
-	};
+	const int32 * const tTable = (const int32 * const) cdaData();
+	int tTableIndex = 3 * track;
 
-	int trackNum = tTable[track].track;
-	bool loop = tTable[track].loop;
+	int trackNum = tTable[tTableIndex + 2];
+	int32 loop = tTable[tTableIndex + 1];
 
 	if (track == _lastTrack && _musicEnabled)
 		return;
@@ -1168,7 +1138,7 @@
 		AudioCD.play(trackNum+1, loop ? -1 : 1, 0, 0);
 		AudioCD.updateCD();
 	} else if (_musicEnabled) {
-		playEuphonyTrack(tTable[track].fileOffset, loop);
+		playEuphonyTrack((uint32) tTable[tTableIndex], loop);
 	}
 
 	_lastTrack = track;
@@ -1195,7 +1165,7 @@
 		return;
 	_sfxFileIndex = file;
 	delete [] _sfxFileData;
-	_sfxFileData = _vm->resource()->fileData(soundFilename(file), 0);
+	_sfxFileData = _vm->resource()->fileData(fileListEntry(file), 0);
 }
 
 void SoundTowns::playSoundEffect(uint8 track) {
@@ -1230,22 +1200,13 @@
 	if (offset == -1)
 		return;
 
-	struct SfxHeader {
-		uint32 id;
-		uint32 inBufferSize;
-		uint32 unused1;
-		uint32 outBufferSize;
-		uint32 unused2;
-		uint32 unused3;
-		uint32 rate;
-		uint32 rootNoteOffs;
-	} *sfxHeader = (SfxHeader*)(fileBody + offset);
+	uint32 * sfxHeader = (uint32*)(fileBody + offset);
 
-	uint32 sfxHeaderID = TO_LE_32(sfxHeader->id);
-	uint32 sfxHeaderInBufferSize = TO_LE_32(sfxHeader->inBufferSize);
-	uint32 sfxHeaderOutBufferSize = TO_LE_32(sfxHeader->outBufferSize);
-	uint32 sfxRootNoteOffs = TO_LE_32(sfxHeader->rootNoteOffs);
-	uint32 sfxRate = TO_LE_32(sfxHeader->rate);
+	uint32 sfxHeaderID = READ_LE_UINT32(sfxHeader);
+	uint32 sfxHeaderInBufferSize = READ_LE_UINT32(&sfxHeader[1]);
+	uint32 sfxHeaderOutBufferSize = READ_LE_UINT32(&sfxHeader[3]);
+	uint32 sfxRootNoteOffs = READ_LE_UINT32(&sfxHeader[7]);
+	uint32 sfxRate = READ_LE_UINT32(&sfxHeader[6]);
 
 	uint32 playbackBufferSize = (sfxHeaderID == 1) ? sfxHeaderInBufferSize : sfxHeaderOutBufferSize;
 
@@ -1452,10 +1413,12 @@
 	if (track == _lastTrack && _musicEnabled)
 		return;
 
+	const uint8 * const cdaTracks = (const uint8 * const) cdaData();
+
 	int trackNum = -1;
-	for (int i = 0; i < _themes[_currentTheme].cdaTableSize; i++) {
-		if (track == _themes[_currentTheme].cdaTable[i * 2]) {
-			trackNum = _themes[_currentTheme].cdaTable[i * 2 + 1] - 1;
+	for (uint32 i = 0; i < cdaTrackNum(); i++) {
+		if (track == cdaTracks[i * 2]) {
+			trackNum = cdaTracks[i * 2 + 1] - 1;
 			break;
 		}
 	}
@@ -1470,7 +1433,7 @@
 		AudioCD.updateCD();
 	} else if (_musicEnabled) {
 		char musicfile[13];
-		sprintf(musicfile, "%s%d.twn", _themes[_currentTheme].twnFilename, track);
+		sprintf(musicfile, "%s%d.twn", fileListEntry(0), track);
 		if (_twnTrackData)
 			delete [] _twnTrackData;
 		_twnTrackData = _vm->resource()->fileData(musicfile, 0);
@@ -1547,33 +1510,6 @@
 	haltTrack();
 }
 
-const uint8 SoundTowns_v2::_cdaTrackTableK2Intro[] =	{
-	0x03, 0x01, 0x04, 0x02, 0x05, 0x03, 0x06, 0x04, 0x07, 0x05, 0x08, 0x06
-};
-
-const uint8 SoundTowns_v2::_cdaTrackTableK2Ingame[] =	{
-	0x02, 0x07, 0x03, 0x08, 0x04, 0x09, 0x07, 0x0A, 0x0C, 0x0B, 0x0D, 0x0C, 0x0E, 0x0D, 0x0F, 0x0E,
-	0x10, 0x0F, 0x12, 0x10, 0x13, 0x11, 0x15, 0x12,	0x17, 0x13, 0x18, 0x14, 0x19, 0x15, 0x1A, 0x16,
-	0x1B, 0x17, 0x1C, 0x18,	0x1D, 0x19, 0x1E, 0x1A, 0x1F, 0x1B, 0x21, 0x1C, 0x22, 0x1D, 0x23, 0x1E,
-	0x24, 0x1F, 0x25, 0x20, 0x26, 0x21, 0x27, 0x22, 0x28, 0x23, 0x29, 0x24,	0x2A, 0x25, 0x2B, 0x26,
-	0x2C, 0x27, 0x2D, 0x28, 0x2E, 0x29, 0x2F, 0x2A,	0x30, 0x2B, 0x31, 0x2C, 0x32, 0x2D, 0x33, 0x2E,
-	0x34, 0x2F, 0x35, 0x30,	0x36, 0x31, 0x37, 0x32, 0x38, 0x33, 0x39, 0x34, 0x3A, 0x35, 0x3B, 0x36,
-	0x3C, 0x37, 0x3D, 0x38, 0x3E, 0x39, 0x3F, 0x3A, 0x40, 0x3B, 0x41, 0x3C,	0x42, 0x3D, 0x43, 0x3E,
-	0x44, 0x3F, 0x45, 0x40, 0x46, 0x41, 0x47, 0x42,	0x48, 0x43, 0x49, 0x44, 0x4A, 0x45, 0x4B, 0x46,
-	0x4C, 0x47, 0x4D, 0x48,	0x4E, 0x49, 0x4F, 0x4A, 0x50, 0x4B, 0x51, 0x4C, 0x52, 0x4D, 0x53, 0x4E,
-	0x54, 0x4F, 0x55, 0x50, 0x56, 0x51, 0x57, 0x52
-};
-
-const uint8 SoundTowns_v2::_cdaTrackTableK2Finale[] =	{
-	0x03, 0x53, 0x04, 0x54
-};
-
-const SoundTowns_v2::Kyra2AudioThemes SoundTowns_v2::_themes[] = {
-	{ _cdaTrackTableK2Intro,	ARRAYSIZE(_cdaTrackTableK2Intro) >> 1,	"intro"		},
-	{ _cdaTrackTableK2Ingame,	ARRAYSIZE(_cdaTrackTableK2Ingame) >> 1,	"k2"		},
-	{ _cdaTrackTableK2Finale,	ARRAYSIZE(_cdaTrackTableK2Finale) >> 1,	"finale"	}
-};
-
 } // end of namespace Kyra
 
 #undef EUPHONY_FADEOUT_TICKS

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2008-01-03 13:28:04 UTC (rev 30197)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2008-01-03 14:42:49 UTC (rev 30198)
@@ -917,8 +917,6 @@
 	"INTRO"
 };
 
-const int KyraEngine_v1::_soundFilesCount = ARRAYSIZE(KyraEngine_v1::_soundFiles);
-
 const char *KyraEngine_v1::_soundFilesTowns[] = {
 	"TW_INTRO.SFX",
 	"TW_SCEN1.SFX",
@@ -928,8 +926,38 @@
 	"TW_SCEN5.SFX"
 };
 
-const int KyraEngine_v1::_soundFilesTownsCount = ARRAYSIZE(KyraEngine_v1::_soundFilesTowns);
+const int32 KyraEngine_v1::_cdaTrackTable[] = {
+	0x04000, 1,  0,	0x05480, 1,  6,	0x05E70, 0,  1,
+	0x06D90, 1,  3,	0x072C0, 0, -1,	0x075F0, 1, -1,
+	0x07880, 1, -1,	0x089C0, 0, -1,	0x09080, 0, -1,
+	0x091D0, 1,  4,	0x0A880, 1,  5,	0x0AF50, 0, -1,
+	0x0B1A0, 1, -1,	0x0B870, 0, -1,	0x0BCF0, 1, -1,
+	0x0C5D0, 1,  7,	0x0D3E0, 1,  8,	0x0e7b0, 1,  2,
+	0x0edc0, 0, -1,	0x0eef0, 1,  9,	0x10540, 1, 10,
+	0x10d80, 0, -1,	0x10E30, 0, -1,	0x10FC0, 0, -1,
+	0x11310, 1, -1,	0x11A20, 1, -1,	0x12380, 0, -1,
+	0x12540, 1, -1,	0x12730, 1, -1,	0x12A90, 1, 11,
+	0x134D0, 0, -1,	0x00000, 0, -1,	0x13770, 0, -1,
+	0x00000, 0, -1,	0x00000, 0, -1,	0x00000, 0, -1,
+	0x00000, 0, -1,	0x14710, 1, 12,	0x15DF0, 1, 13,
+	0x16030, 1, 14,	0x17030, 0, -1,	0x17650, 0, -1,
+	0x134D0, 0, -1,	0x178E0, 1, -1,	0x18200, 0, -1,
+	0x18320, 0, -1,	0x184A0, 0, -1,	0x18BB0, 0, -1,
+	0x19040, 0, 19,	0x19B50, 0, 20,	0x17650, 0, -1,
+	0x1A730, 1, 21,	0x00000, 0, -1,	0x12380, 0, -1,
+	0x1B810, 0, -1,	0x1BA50, 0, 15,	0x1C190, 0, 16,
+	0x1CA50, 0, 17,	0x1D100, 0, 18
+};
 
+const AudioDataStruct KyraEngine_v1::_soundData_PC[] = {
+	{ _soundFiles, ARRAYSIZE(_soundFiles), 0, 0 },
+	{ 0, 0, 0, 0}
+};
+
+const AudioDataStruct KyraEngine_v1::_soundData_TOWNS[] = {
+	{ _soundFilesTowns, ARRAYSIZE(_soundFilesTowns), _cdaTrackTable, ARRAYSIZE(_cdaTrackTable) },
+	{ 0, 0, 0, 0}
+};
 const int8 KyraEngine_v1::_charXPosTable[] = {
 	 0,  4,  4,  4,  0, -4, -4, -4
 };
@@ -1427,6 +1455,42 @@
 	"theend"
 };
 
+const char *KyraEngine_v2::_sequenceSoundList_PCFLOPPY[] = {
+	"intro1",
+	"intro2",
+	"intro3",
+	"intro4",
+	"intro5",
+	"intro6",
+	"intro7",
+	"intro8",
+	"intro9",
+	"intro10",
+	"intro11",
+	"intro12",
+	"glow",
+
+	"asong",
+	"crowcaw",
+	"eyerub2",
+	"pluck3",
+	"rodnreel",
+	"frog1",
+	"scavmov2",
+	"lambmom3",
+	"lambkid1",
+	"thunder2",
+	"thunder3",
+	"wind6",
+	"h2odrop2",
+	"gasleak",
+	"polgulp1",
+	"hndslap1",
+	"burp1",
+	"scream1",
+	"theend"
+};
+
 const char *KyraEngine_v2::_sequenceSoundList_TOWNS[] = {
 	"intro1.pcm",
 	"intro2.pcm",
@@ -1464,6 +1528,7 @@
 };
 
 const int KyraEngine_v2::_sequenceSoundListSize_PC = ARRAYSIZE(KyraEngine_v2::_sequenceSoundList_PC);
+const int KyraEngine_v2::_sequenceSoundListSize_PCFLOPPY = ARRAYSIZE(KyraEngine_v2::_sequenceSoundList_PCFLOPPY);
 const int KyraEngine_v2::_sequenceSoundListSize_TOWNS = ARRAYSIZE(KyraEngine_v2::_sequenceSoundList_TOWNS);
 
 const uint8 KyraEngine_v2::_seqTextColorPresets[] = { 0x01, 0x01, 0x00, 0x3f, 0x3f, 0x3f };
@@ -1542,8 +1607,43 @@
 	"K2TEST15"
 };
 
-const int KyraEngine_v2::_dosSoundFileListSize = ARRAYSIZE(KyraEngine_v2::_dosSoundFileList);
+const char *KyraEngine_v2::_fmtSoundFileListIntro[] = { "intro" };
+const char *KyraEngine_v2::_fmtSoundFileListFinale[] = { "finale" };
+const char *KyraEngine_v2::_fmtSoundFileList[] = { "k2" };
 
+const uint8 KyraEngine_v2::_cdaTrackTableIntro[] =	{
+	0x03, 0x01, 0x04, 0x02, 0x05, 0x03, 0x06, 0x04, 0x07, 0x05, 0x08, 0x06
+};
+
+const uint8 KyraEngine_v2::_cdaTrackTableIngame[] =	{
+	0x02, 0x07, 0x03, 0x08, 0x04, 0x09, 0x07, 0x0A, 0x0C, 0x0B, 0x0D, 0x0C, 0x0E, 0x0D, 0x0F, 0x0E,
+	0x10, 0x0F, 0x12, 0x10, 0x13, 0x11, 0x15, 0x12,	0x17, 0x13, 0x18, 0x14, 0x19, 0x15, 0x1A, 0x16,
+	0x1B, 0x17, 0x1C, 0x18,	0x1D, 0x19, 0x1E, 0x1A, 0x1F, 0x1B, 0x21, 0x1C, 0x22, 0x1D, 0x23, 0x1E,
+	0x24, 0x1F, 0x25, 0x20, 0x26, 0x21, 0x27, 0x22, 0x28, 0x23, 0x29, 0x24,	0x2A, 0x25, 0x2B, 0x26,
+	0x2C, 0x27, 0x2D, 0x28, 0x2E, 0x29, 0x2F, 0x2A,	0x30, 0x2B, 0x31, 0x2C, 0x32, 0x2D, 0x33, 0x2E,
+	0x34, 0x2F, 0x35, 0x30,	0x36, 0x31, 0x37, 0x32, 0x38, 0x33, 0x39, 0x34, 0x3A, 0x35, 0x3B, 0x36,
+	0x3C, 0x37, 0x3D, 0x38, 0x3E, 0x39, 0x3F, 0x3A, 0x40, 0x3B, 0x41, 0x3C,	0x42, 0x3D, 0x43, 0x3E,
+	0x44, 0x3F, 0x45, 0x40, 0x46, 0x41, 0x47, 0x42,	0x48, 0x43, 0x49, 0x44, 0x4A, 0x45, 0x4B, 0x46,
+	0x4C, 0x47, 0x4D, 0x48,	0x4E, 0x49, 0x4F, 0x4A, 0x50, 0x4B, 0x51, 0x4C, 0x52, 0x4D, 0x53, 0x4E,
+	0x54, 0x4F, 0x55, 0x50, 0x56, 0x51, 0x57, 0x52
+};
+
+const uint8 KyraEngine_v2::_cdaTrackTableFinale[] =	{
+	0x03, 0x53, 0x04, 0x54
+};
+
+const AudioDataStruct KyraEngine_v2::_soundData_PC[] = {
+	{ _dosSoundFileListIntro, ARRAYSIZE(_dosSoundFileListIntro), 0, 0 },
+	{ _dosSoundFileList, ARRAYSIZE(_dosSoundFileList), 0, 0},
+	{ _dosSoundFileListFinale, ARRAYSIZE(_dosSoundFileListFinale), 0, 0 }
+};
+
+const AudioDataStruct KyraEngine_v2::_soundData_TOWNS[] = {
+	{ _fmtSoundFileListIntro, ARRAYSIZE(_fmtSoundFileListIntro), _cdaTrackTableIntro, ARRAYSIZE(_cdaTrackTableIntro) >> 1 },
+	{ _fmtSoundFileList, ARRAYSIZE(_fmtSoundFileList),_cdaTrackTableIngame, ARRAYSIZE(_cdaTrackTableIngame) >> 1 },
+	{ _fmtSoundFileListFinale, ARRAYSIZE(_fmtSoundFileListFinale),_cdaTrackTableFinale, ARRAYSIZE(_cdaTrackTableFinale) >> 1 }
+};
+
 const int KyraEngine_v2::_itemStringMapSize = ARRAYSIZE(KyraEngine_v2::_itemStringMap);
 
 const int8 KyraEngine_v2::_dosTrackMap[] = {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list