From 086dd66a654e5b08c7c15b8715c4b15e211f6727 Mon Sep 17 00:00:00 2001 From: athrxx Date: Sun, 11 Nov 2012 16:42:52 +0100 Subject: KYRA: fix several GCC compile issues in previous commits --- engines/kyra/sequences_hof.cpp | 11 ++++++---- engines/kyra/sound.h | 10 ++++----- engines/kyra/sound_towns.cpp | 10 +++++---- engines/kyra/staticres.cpp | 47 +++++++++++++++++++++++++++--------------- engines/kyra/staticres_lol.cpp | 12 +++++++---- 5 files changed, 56 insertions(+), 34 deletions(-) diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp index 7b9e91db73..757907d4a8 100644 --- a/engines/kyra/sequences_hof.cpp +++ b/engines/kyra/sequences_hof.cpp @@ -763,14 +763,18 @@ bool SeqPlayer_HOF::checkAbortPlayback() { _abortRequested = true; _vm->quitGame(); return true; - } else if (event.kbd.keycode != Common::KEYCODE_ESCAPE && event.kbd.keycode != Common::KEYCODE_RETURN && event.kbd.keycode != Common::KEYCODE_SPACE) + } else if (event.kbd.keycode != Common::KEYCODE_ESCAPE && event.kbd.keycode != Common::KEYCODE_RETURN && event.kbd.keycode != Common::KEYCODE_SPACE) { continue; + } + // fall through case Common::EVENT_LBUTTONDOWN: case Common::EVENT_RBUTTONDOWN: case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: _abortRequested = true; return true; + default: + break; } } @@ -995,7 +999,7 @@ void SeqPlayer_HOF::playAnimation(WSAMovie_v2 *wsaObj, int startFrame, int lastF updateAllNestedAnimations(); updateSubTitles(); - if (wsaObj || callback && (!(checkAbortPlayback() || _vm->shouldQuit() || _result))) { + if ((wsaObj || callback) && (!(checkAbortPlayback() || _vm->shouldQuit() || _result))) { _screen->copyPage(2, 0); _screen->updateScreen(); } @@ -1010,7 +1014,7 @@ void SeqPlayer_HOF::playAnimation(WSAMovie_v2 *wsaObj, int startFrame, int lastF break; } - if (wsaObj || callback && (!(checkAbortPlayback() || _vm->shouldQuit() || _result))) { + if ((wsaObj || callback) && (!(checkAbortPlayback() || _vm->shouldQuit() || _result))) { _screen->copyPage(2, 0); _screen->updateScreen(); } @@ -1792,7 +1796,6 @@ int SeqPlayer_HOF::cbHOF_overview(WSAMovie_v2 *wsaObj, int x, int y, int frm) { uint8 *tmpPal = _screen->getPalette(3).getData() + 0x101; memset(tmpPal, 0, 256); uint32 frameEnd = 0; - uint32 curTime = 0; switch (_callbackCurrentFrame) { case 0: diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index 48d9b60419..3418c8a4aa 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -41,15 +41,15 @@ namespace Kyra { struct SoundResourceInfo_PC { SoundResourceInfo_PC(const char *const *files, int numFiles) : fileList(files), fileListSize(numFiles) {} const char *const *fileList; - int fileListSize; + uint fileListSize; }; struct SoundResourceInfo_Towns { SoundResourceInfo_Towns(const char *const *files, int numFiles, const int32 *cdaTbl, int cdaTblSize) : fileList(files), fileListSize(numFiles), cdaTable(cdaTbl), cdaTableSize(cdaTblSize) {} const char *const *fileList; - int fileListSize; + uint fileListSize; const int32 *cdaTable; - int cdaTableSize; + uint cdaTableSize; }; struct SoundResourceInfo_PC98 { @@ -60,10 +60,10 @@ struct SoundResourceInfo_PC98 { struct SoundResourceInfo_TownsPC98V2 { SoundResourceInfo_TownsPC98V2(const char *const *files, int numFiles, const char *fileNamePattern, const uint16 *cdaTbl, int cdaTblSize) : fileList(files), fileListSize(numFiles), pattern(fileNamePattern), cdaTable(cdaTbl), cdaTableSize(cdaTblSize) {} const char *const *fileList; - int fileListSize; + uint fileListSize; const char *pattern; const uint16 *cdaTable; - int cdaTableSize; + uint cdaTableSize; }; /** diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index c9a4e207f9..6f57ebfcbb 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -80,7 +80,7 @@ void SoundTowns::playTrack(uint8 track) { return; track -= 2; - int tTableIndex = 3 * track; + uint tTableIndex = 3 * track; assert(tTableIndex + 2 < res()->cdaTableSize); @@ -137,6 +137,7 @@ void SoundTowns::selectAudioResourceSet(int set) { bool SoundTowns::hasSoundFile(uint file) { if (file < res()->fileListSize) return (res()->fileList[file] != 0); + return false; } void SoundTowns::loadSoundFile(uint file) { @@ -532,9 +533,9 @@ bool SoundTownsPC98_v2::init() { // this misses the possibility that we play the tracks // right off CD. So we should find another way to // check if we have access to CD audio. - Resource *res = _vm->resource(); + Resource *r = _vm->resource(); if (_musicEnabled && - (res->exists("track1.mp3") || res->exists("track1.ogg") || res->exists("track1.flac") || res->exists("track1.fla"))) + (r->exists("track1.mp3") || r->exists("track1.ogg") || r->exists("track1.flac") || r->exists("track1.fla"))) _musicEnabled = 2; else _musicEnabled = 1; @@ -566,6 +567,7 @@ void SoundTownsPC98_v2::selectAudioResourceSet(int set) { bool SoundTownsPC98_v2::hasSoundFile(uint file) { if (file < res()->fileListSize) return (res()->fileList[file] != 0); + return false; } void SoundTownsPC98_v2::loadSoundFile(Common::String file) { @@ -583,7 +585,7 @@ void SoundTownsPC98_v2::playTrack(uint8 track) { int trackNum = -1; if (_vm->gameFlags().platform == Common::kPlatformFMTowns) { - for (int i = 0; i < res()->cdaTableSize; i++) { + for (uint i = 0; i < res()->cdaTableSize; i++) { if (track == (uint8) READ_LE_UINT16(&res()->cdaTable[i * 2])) { trackNum = (int) READ_LE_UINT16(&res()->cdaTable[i * 2 + 1]) - 1; break; diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 5909931f9f..a488884124 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -824,14 +824,20 @@ void KyraEngine_LoK::initStaticResource() { // FIXME: It seems Kyra1 MAC CD includes AdLib and MIDI music and sfx, thus we enable // support for those for now. (Based on patch #2767489 "Support for Mac Kyrandia 1 CD" by satz). if (_flags.platform == Common::kPlatformPC || _flags.platform == Common::kPlatformMacintosh) { - _sound->initAudioResourceInfo(kMusicIntro, &SoundResourceInfo_PC(soundFilesIntro, soundFilesIntroSize)); - _sound->initAudioResourceInfo(kMusicIngame, &SoundResourceInfo_PC(soundFiles, soundFilesSize)); + SoundResourceInfo_PC resInfoIntro(soundFilesIntro, soundFilesIntroSize); + SoundResourceInfo_PC resInfoIngame(soundFiles, soundFilesSize); + _sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro); + _sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame); } else if (_flags.platform == Common::kPlatformFMTowns) { - _sound->initAudioResourceInfo(kMusicIntro, &SoundResourceInfo_Towns(soundFiles, soundFilesSize, cdaTable, cdaTableSize)); - _sound->initAudioResourceInfo(kMusicIngame, &SoundResourceInfo_Towns(soundFiles, soundFilesSize, cdaTable, cdaTableSize)); + SoundResourceInfo_Towns resInfoIntro(soundFiles, soundFilesSize, cdaTable, cdaTableSize); + SoundResourceInfo_Towns resInfoIngame(soundFiles, soundFilesSize, cdaTable, cdaTableSize); + _sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro); + _sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame); } else if (_flags.platform == Common::kPlatformPC98) { - _sound->initAudioResourceInfo(kMusicIntro, &SoundResourceInfo_PC98("INTRO%d.DAT")); - _sound->initAudioResourceInfo(kMusicIngame, &SoundResourceInfo_PC98("KYRAM%d.DAT")); + SoundResourceInfo_PC98 resInfoIntro("INTRO%d.DAT"); + SoundResourceInfo_PC98 resInfoIngame("KYRAM%d.DAT"); + _sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro); + _sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame); } } @@ -977,8 +983,6 @@ void KyraEngine_LoK::loadMainScreen(int page) { } void KyraEngine_HoF::initStaticResource() { - int tmpSize = 0; - _ingamePakList = _staticres->loadStrings(k2IngamePakFiles, _ingamePakListSize); _ingameSoundList = _staticres->loadStrings(k2IngameSfxFiles, _ingameSoundListSize); _ingameSoundIndex = (const uint16 *)_staticres->loadRawData(k2IngameSfxIndex, _ingameSoundIndexSize); @@ -994,17 +998,26 @@ void KyraEngine_HoF::initStaticResource() { // assign music data if (_flags.platform == Common::kPlatformPC) { - _sound->initAudioResourceInfo(kMusicIntro, &SoundResourceInfo_PC(_musicFileListIntro, _musicFileListIntroSize)); - _sound->initAudioResourceInfo(kMusicIngame, &SoundResourceInfo_PC(_musicFileListIngame, _musicFileListIngameSize)); - _sound->initAudioResourceInfo(kMusicFinale, &SoundResourceInfo_PC(_musicFileListFinale, _musicFileListFinaleSize)); + SoundResourceInfo_PC resInfoIntro(_musicFileListIntro, _musicFileListIntroSize); + SoundResourceInfo_PC resInfoIngame(_musicFileListIngame, _musicFileListIngameSize); + SoundResourceInfo_PC resInfoFinale(_musicFileListFinale, _musicFileListFinaleSize); + _sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro); + _sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame); + _sound->initAudioResourceInfo(kMusicFinale, &resInfoFinale); } else if (_flags.platform == Common::kPlatformFMTowns) { - _sound->initAudioResourceInfo(kMusicIntro, &SoundResourceInfo_TownsPC98V2(0, 0, "intro%d.twn", (const uint16*)_cdaTrackTableIntro, _cdaTrackTableIntroSize >> 1)); - _sound->initAudioResourceInfo(kMusicIngame, &SoundResourceInfo_TownsPC98V2(0, 0, "km%02d.twn", (const uint16*)_cdaTrackTableIngame, _cdaTrackTableIngameSize >> 1)); - _sound->initAudioResourceInfo(kMusicFinale, &SoundResourceInfo_TownsPC98V2(0, 0, "finale%d.twn", (const uint16*)_cdaTrackTableFinale, _cdaTrackTableFinaleSize >> 1)); + SoundResourceInfo_TownsPC98V2 resInfoIntro(0, 0, "intro%d.twn", (const uint16*)_cdaTrackTableIntro, _cdaTrackTableIntroSize >> 1); + SoundResourceInfo_TownsPC98V2 resInfoIngame(0, 0, "km%02d.twn", (const uint16*)_cdaTrackTableIngame, _cdaTrackTableIngameSize >> 1); + SoundResourceInfo_TownsPC98V2 resInfoFinale(0, 0, "finale%d.twn", (const uint16*)_cdaTrackTableFinale, _cdaTrackTableFinaleSize >> 1); + _sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro); + _sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame); + _sound->initAudioResourceInfo(kMusicFinale, &resInfoFinale); } else if (_flags.platform == Common::kPlatformPC98) { - _sound->initAudioResourceInfo(kMusicIntro, &SoundResourceInfo_TownsPC98V2(0, 0, "intro%d.86", 0, 0)); - _sound->initAudioResourceInfo(kMusicIngame, &SoundResourceInfo_TownsPC98V2(0, 0, "km%02d.86", 0, 0)); - _sound->initAudioResourceInfo(kMusicFinale, &SoundResourceInfo_TownsPC98V2(0, 0, "finale%d.86", 0, 0)); + SoundResourceInfo_TownsPC98V2 resInfoIntro(0, 0, "intro%d.86", 0, 0); + SoundResourceInfo_TownsPC98V2 resInfoIngame(0, 0, "km%02d.86", 0, 0); + SoundResourceInfo_TownsPC98V2 resInfoFinale(0, 0, "finale%d.86", 0, 0); + _sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro); + _sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame); + _sound->initAudioResourceInfo(kMusicFinale, &resInfoFinale); } } diff --git a/engines/kyra/staticres_lol.cpp b/engines/kyra/staticres_lol.cpp index af32fb9ad5..b8a68ffb81 100644 --- a/engines/kyra/staticres_lol.cpp +++ b/engines/kyra/staticres_lol.cpp @@ -217,13 +217,17 @@ void LoLEngine::initStaticResource() { // assign music resource data (not required for the PC version, resource loading is implemented differently there) if (_flags.isDemo) { static const char *const file[] = { "LOREDEMO" }; - _sound->initAudioResourceInfo(kMusicIntro, &SoundResourceInfo_TownsPC98V2(file, ARRAYSIZE(file), 0, 0, 0)); + SoundResourceInfo_TownsPC98V2 resInfoDemo(file, ARRAYSIZE(file), 0, 0, 0); + _sound->initAudioResourceInfo(kMusicIntro, &resInfoDemo); } else if (_flags.platform == Common::kPlatformPC98) { static const char *const fileListIntro[] = { 0, "lore84.86", "lore82.86", 0, 0, 0, "lore83.86", "lore81.86" }; static const char *const fileListFinale[] = { 0, 0, "lore85.86", "lore86.86", "lore87.86" }; - _sound->initAudioResourceInfo(kMusicIntro, &SoundResourceInfo_TownsPC98V2(fileListIntro, ARRAYSIZE(fileListIntro), 0, 0, 0)); - _sound->initAudioResourceInfo(kMusicIngame, &SoundResourceInfo_TownsPC98V2(0, 0, "lore%02d.86", 0, 0)); - _sound->initAudioResourceInfo(kMusicFinale, &SoundResourceInfo_TownsPC98V2(fileListFinale, ARRAYSIZE(fileListFinale), 0, 0, 0)); + SoundResourceInfo_TownsPC98V2 resInfoIntro(fileListIntro, ARRAYSIZE(fileListIntro), 0, 0, 0); + SoundResourceInfo_TownsPC98V2 resInfoIngame(0, 0, "lore%02d.86", 0, 0); + SoundResourceInfo_TownsPC98V2 resInfoFinale(fileListFinale, ARRAYSIZE(fileListFinale), 0, 0, 0); + _sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro); + _sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame); + _sound->initAudioResourceInfo(kMusicFinale, &resInfoFinale); } if (_flags.isDemo) -- cgit v1.2.3