diff options
author | Alejandro Marzini | 2010-07-30 05:28:09 +0000 |
---|---|---|
committer | Alejandro Marzini | 2010-07-30 05:28:09 +0000 |
commit | fb4086cadb8ce3e473dae40558d713e7a31b3858 (patch) | |
tree | 95c19d544da914c43a43f0538a1977f43e17cb39 /engines/kyra | |
parent | 7b070bbef8275ff25dfc2cbc3106acfdc8de74a5 (diff) | |
parent | a17e3c444917ca90dfd537c2102a6150e7ffe977 (diff) | |
download | scummvm-rg350-fb4086cadb8ce3e473dae40558d713e7a31b3858.tar.gz scummvm-rg350-fb4086cadb8ce3e473dae40558d713e7a31b3858.tar.bz2 scummvm-rg350-fb4086cadb8ce3e473dae40558d713e7a31b3858.zip |
Merged from trunk, from Rev 50841 to HEAD
svn-id: r51495
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/debugger.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/detection_tables.h | 2 | ||||
-rw-r--r-- | engines/kyra/gui_lok.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/gui_lol.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/gui_v2.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_lok.cpp | 1 | ||||
-rw-r--r-- | engines/kyra/kyra_lok.h | 33 | ||||
-rw-r--r-- | engines/kyra/kyra_mr.cpp | 7 | ||||
-rw-r--r-- | engines/kyra/kyra_mr.h | 1 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.cpp | 9 | ||||
-rw-r--r-- | engines/kyra/module.mk | 1 | ||||
-rw-r--r-- | engines/kyra/scene_mr.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/screen.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/script_tim.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/sequences_lok.cpp | 74 | ||||
-rw-r--r-- | engines/kyra/sound_midi.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/sound_towns.cpp | 60 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 862 | ||||
-rw-r--r-- | engines/kyra/staticres_lol.cpp | 882 | ||||
-rw-r--r-- | engines/kyra/text_lok.cpp | 22 | ||||
-rw-r--r-- | engines/kyra/timer_lok.cpp | 91 | ||||
-rw-r--r-- | engines/kyra/vqa.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/vqa.h | 3 |
23 files changed, 1087 insertions, 999 deletions
diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp index d71f7b8b25..225b44b3f4 100644 --- a/engines/kyra/debugger.cpp +++ b/engines/kyra/debugger.cpp @@ -240,7 +240,7 @@ bool Debugger_LoK::cmd_enterRoom(int argc, const char **argv) { while (!_vm->_screen->isMouseVisible()) _vm->_screen->showMouse(); - _detach_now = true; + detach(); return false; } @@ -327,7 +327,7 @@ bool Debugger_v2::cmd_enterScene(int argc, const char **argv) { while (!_vm->screen_v2()->isMouseVisible()) _vm->screen_v2()->showMouse(); - _detach_now = true; + detach(); return false; } diff --git a/engines/kyra/detection_tables.h b/engines/kyra/detection_tables.h index 390281c356..fe4cc7298f 100644 --- a/engines/kyra/detection_tables.h +++ b/engines/kyra/detection_tables.h @@ -228,7 +228,7 @@ const KYRAGameDescription adGameDescs[] = { Common::EN_ANY, Common::kPlatformMacintosh, ADGF_NO_FLAGS, - Common::GUIO_NOSPEECH + Common::GUIO_NOSPEECH | Common::GUIO_MIDIGM }, KYRA1_FLOPPY_FLAGS }, diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp index c8b7e8ec4f..9a1d750391 100644 --- a/engines/kyra/gui_lok.cpp +++ b/engines/kyra/gui_lok.cpp @@ -579,7 +579,7 @@ void GUI_LoK::setupSavegames(Menu &menu, int num) { for (int i = startSlot; i < num; ++i) menu.item[i].enabled = 0; - KyraEngine_v1::SaveHeader header; + KyraEngine_LoK::SaveHeader header; for (int i = startSlot; i < num && uint(_savegameOffset + i) < _saveSlots.size(); i++) { if ((in = _vm->openSaveForReading(_vm->getSavegameFilename(_saveSlots[i + _savegameOffset]), header))) { Common::strlcpy(savenames[i], header.description.c_str(), ARRAYSIZE(savenames[0])); diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index ded1326110..2c86073892 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -2611,7 +2611,7 @@ void GUI_LoL::updateSavegameList() { if (_savegameListSize) { Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Greater<int>()); - KyraEngine_v1::SaveHeader header; + LoLEngine::SaveHeader header; Common::InSaveFile *in; _savegameList = new char *[_savegameListSize]; @@ -2658,7 +2658,7 @@ int GUI_LoL::getInput() { if (_currentMenu == &_savenameMenu) { _vm->updateInput(); - for (Common::List<KyraEngine_v1::Event>::const_iterator evt = _vm->_eventList.begin(); evt != _vm->_eventList.end(); ++evt) { + for (Common::List<LoLEngine::Event>::const_iterator evt = _vm->_eventList.begin(); evt != _vm->_eventList.end(); ++evt) { if (evt->event.type == Common::EVENT_KEYDOWN) _keyPressed = evt->event.kbd; } diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp index de19228d16..fe4b54d09b 100644 --- a/engines/kyra/gui_v2.cpp +++ b/engines/kyra/gui_v2.cpp @@ -452,7 +452,7 @@ void GUI_v2::setupSavegameNames(Menu &menu, int num) { if (_isSaveMenu && _savegameOffset == 0) startSlot = 1; - KyraEngine_v1::SaveHeader header; + KyraEngine_v2::SaveHeader header; Common::InSaveFile *in; for (int i = startSlot; i < num && uint(_savegameOffset + i) < _saveSlots.size(); ++i) { if ((in = _vm->openSaveForReading(_vm->getSavegameFilename(_saveSlots[i + _savegameOffset]), header)) != 0) { diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp index cf61b58326..159230e928 100644 --- a/engines/kyra/kyra_lok.cpp +++ b/engines/kyra/kyra_lok.cpp @@ -234,6 +234,7 @@ Common::Error KyraEngine_LoK::init() { _talkingCharNum = -1; _charSayUnk3 = -1; + _disabledTalkAnimObject = _enabledTalkAnimObject = 0; memset(_currSentenceColor, 0, 3); _startSentencePalIndex = -1; _fadeText = false; diff --git a/engines/kyra/kyra_lok.h b/engines/kyra/kyra_lok.h index c0c9bf06c4..b37a14bad4 100644 --- a/engines/kyra/kyra_lok.h +++ b/engines/kyra/kyra_lok.h @@ -132,7 +132,7 @@ public: int _paletteChanged; int16 _northExitHeight; - typedef void (KyraEngine_LoK::*IntroProc)(); + typedef bool (KyraEngine_LoK::*IntroProc)(); // static data access const char * const *seqWSATable() { return _seq_WSATable; } @@ -157,11 +157,12 @@ protected: // -> intro void seq_intro(); - void seq_introLogos(); - void seq_introStory(); - void seq_introMalcolmTree(); - void seq_introKallakWriting(); - void seq_introKallakMalcolm(); + bool seq_introPublisherLogos(); + bool seq_introLogos(); + bool seq_introStory(); + bool seq_introMalcolmTree(); + bool seq_introKallakWriting(); + bool seq_introKallakMalcolm(); // -> ingame animations void seq_createAmuletJewel(int jewel, int page, int noSound, int drawOnly); @@ -373,20 +374,24 @@ protected: //void setTimer19(); void setupTimers(); void timerUpdateHeadAnims(int timerNum); - void timerSetFlags1(int timerNum); - void timerSetFlags2(int timerNum); - void timerSetFlags3(int timerNum); - void timerCheckAnimFlag1(int timerNum); - void timerCheckAnimFlag2(int timerNum); + void timerTulipCreator(int timerNum); + void timerRubyCreator(int timerNum); + void timerAsInvisibleTimeout(int timerNum); + void timerAsWillowispTimeout(int timerNum); void checkAmuletAnimFlags(); void timerRedrawAmulet(int timerNum); + void timerLavenderRoseCreator(int timerNum); + void timerAcornCreator(int timerNum); + void timerBlueberryCreator(int timerNum); void timerFadeText(int timerNum); - void updateAnimFlag1(int timerNum); - void updateAnimFlag2(int timerNum); + void timerWillowispFrameTimer(int timerNum); + void timerInvisibleFrameTimer(int timerNum); void drawAmulet(); void setTextFadeTimerCountdown(int16 countdown); void setWalkspeed(uint8 newSpeed); + void setItemCreationFlags(int offset, int count); + int buttonInventoryCallback(Button *caller); int buttonAmuletCallback(Button *caller); @@ -472,6 +477,8 @@ protected: int8 _charSayUnk2; int8 _charSayUnk3; int8 _currHeadShape; + int8 _disabledTalkAnimObject; + int8 _enabledTalkAnimObject; uint8 _currSentenceColor[3]; int8 _startSentencePalIndex; bool _fadeText; diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp index cf90c73dbd..61bc3708c3 100644 --- a/engines/kyra/kyra_mr.cpp +++ b/engines/kyra/kyra_mr.cpp @@ -369,9 +369,7 @@ void KyraEngine_MR::playVQA(const char *name) { VQAMovie vqa(this, _system); char filename[20]; - int size = 0; // TODO: Movie size is 0, 1 or 2. - - snprintf(filename, sizeof(filename), "%s%d.VQA", name, size); + snprintf(filename, sizeof(filename), "%s%d.VQA", name, _configVQAQuality); if (vqa.open(filename)) { for (int i = 0; i < 4; ++i) { @@ -1460,6 +1458,8 @@ void KyraEngine_MR::registerDefaultSettings() { ConfMan.registerDefault("studio_audience", true); ConfMan.registerDefault("skip_support", true); ConfMan.registerDefault("helium_mode", false); + // 0 - best, 1 - mid, 2 - low + ConfMan.registerDefault("video_quality", 0); } void KyraEngine_MR::writeSettings() { @@ -1495,6 +1495,7 @@ void KyraEngine_MR::readSettings() { _configStudio = ConfMan.getBool("studio_audience"); _configSkip = ConfMan.getBool("skip_support"); _configHelium = ConfMan.getBool("helium_mode"); + _configVQAQuality = CLIP(ConfMan.getInt("video_quality"), 0, 2); } } // End of namespace Kyra diff --git a/engines/kyra/kyra_mr.h b/engines/kyra/kyra_mr.h index 773b0a1699..36b937f2a8 100644 --- a/engines/kyra/kyra_mr.h +++ b/engines/kyra/kyra_mr.h @@ -73,6 +73,7 @@ private: bool _configStudio; bool _configSkip; bool _configHelium; + int _configVQAQuality; void registerDefaultSettings(); void writeSettings(); diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index abe13cec2b..5db2c360d6 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -100,9 +100,7 @@ void KyraEngine_v1::pauseEngineIntern(bool pause) { Common::Error KyraEngine_v1::init() { // Setup mixer - _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); - _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); - _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume")); + syncSoundSettings(); if (!_flags.useDigSound) { // We prefer AdLib over MIDI in Kyra 1, since it offers MT-32 support only, most users don't have a real @@ -259,7 +257,7 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag) int keys = 0; int8 mouseWheel = 0; - while (_eventList.size()) { + while (!_eventList.empty()) { Common::Event event = *_eventList.begin(); bool breakLoop = false; @@ -283,6 +281,7 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag) if (event.kbd.keycode == Common::KEYCODE_d) { if (_debugger) _debugger->attach(); + breakLoop = true; } else if (event.kbd.keycode == Common::KEYCODE_q) { quitGame(); } @@ -336,7 +335,7 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag) break; } - if (_debugger && _debugger->isAttached()) + if (_debugger) _debugger->onFrame(); if (breakLoop) diff --git a/engines/kyra/module.mk b/engines/kyra/module.mk index b9006431d7..4708041cf7 100644 --- a/engines/kyra/module.mk +++ b/engines/kyra/module.mk @@ -84,6 +84,7 @@ MODULE_OBJS += \ sequences_lol.o \ sound_lol.o \ sprites_lol.o \ + staticres_lol.o \ text_lol.o \ timer_lol.o endif diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp index 875200895a..bd0a1fe544 100644 --- a/engines/kyra/scene_mr.cpp +++ b/engines/kyra/scene_mr.cpp @@ -79,11 +79,9 @@ void KyraEngine_MR::enterNewScene(uint16 sceneId, int facing, int unk1, int unk2 musicUpdate(0); uint32 waitUntilTimer = 0; - bool newSoundFile = false; if (_lastMusicCommand != _sceneList[sceneId].sound) { fadeOutMusic(60); waitUntilTimer = _system->getMillis() + 60 * _tickLength; - newSoundFile = true; } _chatAltFlag = false; diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 7f3959d5fe..ade9886c2e 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -611,14 +611,6 @@ void Screen::fadePalette(const Palette &pal, int delay, const UpdateFunctor *upF _vm->delay((delayAcc >> 8) * 1000 / 60); delayAcc &= 0xFF; } - - if (_vm->shouldQuit()) { - setScreenPalette(pal); - if (upFunc && upFunc->isValid()) - (*upFunc)(); - else - _system->updateScreen(); - } } void Screen::getFadeParams(const Palette &pal, int delay, int &delayInc, int &diff) { diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp index 4ec6e7f349..20bc8abec5 100644 --- a/engines/kyra/script_tim.cpp +++ b/engines/kyra/script_tim.cpp @@ -159,7 +159,7 @@ TIM *TIMInterpreter::load(const char *filename, const Common::Array<const TIMOpc _tim->opcodes = opcodes; IFFParser iff(*stream); - Common::Functor1Mem< Common::IFFChunk &, bool, TIMInterpreter > c(this, &TIMInterpreter::callback); + Common::Functor1Mem<Common::IFFChunk &, bool, TIMInterpreter> c(this, &TIMInterpreter::callback); iff.parse(c); if (!_tim->avtl) @@ -170,7 +170,7 @@ TIM *TIMInterpreter::load(const char *filename, const Common::Array<const TIMOpc delete stream; - int num = (_avtlChunkSize < TIM::kCountFuncs) ? _avtlChunkSize : (int)TIM::kCountFuncs; + const int num = (_avtlChunkSize < TIM::kCountFuncs) ? _avtlChunkSize : (int)TIM::kCountFuncs; for (int i = 0; i < num; ++i) _tim->func[i].avtl = _tim->avtl + _tim->avtl[i]; diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp index 78e8ded9f7..c4bdc29f57 100644 --- a/engines/kyra/sequences_lok.cpp +++ b/engines/kyra/sequences_lok.cpp @@ -93,6 +93,7 @@ void KyraEngine_LoK::seq_intro() { _res->loadPakFile("INTRO.VRM"); static const IntroProc introProcTable[] = { + &KyraEngine_LoK::seq_introPublisherLogos, &KyraEngine_LoK::seq_introLogos, &KyraEngine_LoK::seq_introStory, &KyraEngine_LoK::seq_introMalcolmTree, @@ -114,8 +115,13 @@ void KyraEngine_LoK::seq_intro() { snd_playTheme(0, 2); _text->setTalkCoords(144); - for (int i = 0; i < ARRAYSIZE(introProcTable) && !seq_skipSequence(); ++i) - (this->*introProcTable[i])(); + for (int i = 0; i < ARRAYSIZE(introProcTable) && !seq_skipSequence(); ++i) { + if ((this->*introProcTable[i])() && !shouldQuit()) { + resetSkipFlag(); + _screen->fadeToBlack(); + _screen->clearPage(0); + } + } _text->setTalkCoords(136); delay(30 * _tickLength); @@ -127,18 +133,32 @@ void KyraEngine_LoK::seq_intro() { _res->unloadPakFile("INTRO.VRM"); } -void KyraEngine_LoK::seq_introLogos() { +bool KyraEngine_LoK::seq_introPublisherLogos() { if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) { _screen->loadBitmap("LOGO.CPS", 3, 3, &_screen->getPalette(0)); _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); _screen->updateScreen(); _screen->fadeFromBlack(); delay(90 * _tickLength); - _screen->fadeToBlack(); - if (!_abortIntroFlag) + if (!_abortIntroFlag) { + _screen->fadeToBlack(); snd_playWanderScoreViaMap(_flags.platform == Common::kPlatformFMTowns ? 57 : 2, 0); + } + } else if (_flags.platform == Common::kPlatformMacintosh && _res->exists("MP_GOLD.CPS")) { + _screen->loadPalette("MP_GOLD.COL", _screen->getPalette(0)); + _screen->loadBitmap("MP_GOLD.CPS", 3, 3, 0); + _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); + _screen->updateScreen(); + _screen->fadeFromBlack(); + delay(120 * _tickLength); + if (!_abortIntroFlag) + _screen->fadeToBlack(); } + return _abortIntroFlag; +} + +bool KyraEngine_LoK::seq_introLogos() { _screen->clearPage(0); if (_flags.platform == Common::kPlatformAmiga) { @@ -159,11 +179,8 @@ void KyraEngine_LoK::seq_introLogos() { _screen->updateScreen(); _screen->fadeFromBlack(); - if (_seq->playSequence(_seq_WestwoodLogo, skipFlag()) || shouldQuit()) { - _screen->fadeToBlack(); - _screen->clearPage(0); - return; - } + if (_seq->playSequence(_seq_WestwoodLogo, skipFlag()) || shouldQuit()) + return true; delay(60 * _tickLength); @@ -174,16 +191,14 @@ void KyraEngine_LoK::seq_introLogos() { Screen::FontId of = _screen->setFont(Screen::FID_8_FNT); - if ((_seq->playSequence(_seq_KyrandiaLogo, skipFlag()) && !seq_skipSequence()) || shouldQuit()) { - _screen->fadeToBlack(); - _screen->clearPage(0); - return; - } + if (_seq->playSequence(_seq_KyrandiaLogo, skipFlag()) || shouldQuit()) + return true; + _screen->setFont(of); _screen->fillRect(0, 179, 319, 199, 0); if (shouldQuit()) - return; + return false; if (_flags.platform == Common::kPlatformAmiga) { _screen->copyPalette(0, 2); @@ -225,20 +240,20 @@ void KyraEngine_LoK::seq_introLogos() { } while (!doneFlag && !shouldQuit() && !_abortIntroFlag); } - if (shouldQuit()) - return; + if (_abortIntroFlag || shouldQuit()) + return true; - _seq->playSequence(_seq_Forest, true); + return _seq->playSequence(_seq_Forest, true); } -void KyraEngine_LoK::seq_introStory() { +bool KyraEngine_LoK::seq_introStory() { _screen->clearPage(3); _screen->clearPage(0); // HACK: The Italian fan translation uses an special text screen here // so we show it even when text is disabled if (!textEnabled() && speechEnabled() && _flags.lang != Common::IT_ITA) - return; + return false; if ((_flags.lang == Common::EN_ANY && !_flags.isTalkie && _flags.platform == Common::kPlatformPC) || _flags.platform == Common::kPlatformAmiga) _screen->loadBitmap("TEXT.CPS", 3, 3, &_screen->getPalette(0)); @@ -292,25 +307,30 @@ void KyraEngine_LoK::seq_introStory() { _screen->updateScreen(); delay(360 * _tickLength); + + return _abortIntroFlag; } -void KyraEngine_LoK::seq_introMalcolmTree() { +bool KyraEngine_LoK::seq_introMalcolmTree() { _screen->_curPage = 0; _screen->clearPage(3); - _seq->playSequence(_seq_MalcolmTree, true); + return _seq->playSequence(_seq_MalcolmTree, true); } -void KyraEngine_LoK::seq_introKallakWriting() { +bool KyraEngine_LoK::seq_introKallakWriting() { _seq->makeHandShapes(); _screen->setAnimBlockPtr(5060); _screen->_charWidth = -2; _screen->clearPage(3); - _seq->playSequence(_seq_KallakWriting, true); + const bool skipped = _seq->playSequence(_seq_KallakWriting, true); + _seq->freeHandShapes(); + + return skipped; } -void KyraEngine_LoK::seq_introKallakMalcolm() { +bool KyraEngine_LoK::seq_introKallakMalcolm() { _screen->clearPage(3); - _seq->playSequence(_seq_KallakMalcolm, true); + return _seq->playSequence(_seq_KallakMalcolm, true); } void KyraEngine_LoK::seq_createAmuletJewel(int jewel, int page, int noSound, int drawOnly) { diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp index 7eb151a64d..026c72de26 100644 --- a/engines/kyra/sound_midi.cpp +++ b/engines/kyra/sound_midi.cpp @@ -573,8 +573,12 @@ void SoundMidiPC::updateVolumeSettings() { if (!_output) return; - int newMusVol = ConfMan.getInt("music_volume"); - _sfxVolume = ConfMan.getInt("sfx_volume"); + bool mute = false; + if (ConfMan.hasKey("mute")) + mute = ConfMan.getBool("mute"); + + const int newMusVol = (mute ? 0 : ConfMan.getInt("music_volume")); + _sfxVolume = (mute ? 0 : ConfMan.getInt("sfx_volume")); _output->setSourceVolume(0, newMusVol, newMusVol != _musicVolume); _musicVolume = newMusVol; diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index 7a570b3100..32fbbdf1e7 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -596,21 +596,15 @@ Towns_EuphonyDriver::~Towns_EuphonyDriver() { MidiDriver_YM2612::removeLookupTables(); - if (_fmInstruments) { - delete[] _fmInstruments; - _fmInstruments = 0; - } + delete[] _fmInstruments; + _fmInstruments = 0; - if (_waveInstruments) { - delete[] _waveInstruments; - _waveInstruments = 0; - } + delete[] _waveInstruments; + _waveInstruments = 0; for (int i = 0; i < 10; i++) { - if (_waveSounds[i]) { - delete[] _waveSounds[i]; - _waveSounds[i] = 0; - } + delete[] _waveSounds[i]; + _waveSounds[i] = 0; } if (_queue) { @@ -1859,7 +1853,7 @@ void TownsPC98_OpnChannel::loadData(uint8 *data) { _dataPtr = data; _totalLevel = 0x7F; - uint8 *tmp = _dataPtr; + uint8 *tmp = _dataPtr; for (bool loop = true; loop; ) { uint8 cmd = *tmp++; if (cmd < 0xf0) { @@ -2507,7 +2501,7 @@ void TownsPC98_OpnSfxChannel::loadData(uint8 *data) { _ssgTl = 0xff; _algorithm = 0x80; - uint8 *tmp = _dataPtr; + uint8 *tmp = _dataPtr; for (bool loop = true; loop; ) { uint8 cmd = *tmp++; if (cmd < 0xf0) { @@ -2798,7 +2792,7 @@ void TownsPC98_OpnSquareSineSource::nextTick(int32 *buffer, uint32 bufferSize) { finOut += finOutTemp; } - finOut /= 3; + finOut /= 3; buffer[i << 1] += finOut; buffer[(i << 1) + 1] += finOut; @@ -3335,7 +3329,7 @@ void TownsPC98_OpnCore::setVolumeChannelMasks(int channelMaskA, int channelMaskB if (_ssg) _ssg->setVolumeChannelMasks(_volMaskA >> _numChan, _volMaskB >> _numChan); if (_prc) - _prc->setVolumeChannelMasks(_volMaskA >> (_numChan + _numSSG), _volMaskB >> (_numChan + _numSSG)); + _prc->setVolumeChannelMasks(_volMaskA >> (_numChan + _numSSG), _volMaskB >> (_numChan + _numSSG)); } void TownsPC98_OpnCore::generateTables() { @@ -3805,7 +3799,7 @@ void TownsPC98_OpnDriver::setSfxTempo(uint16 tempo) { void TownsPC98_OpnDriver::startSoundEffect() { int volFlags = 0; - + for (int i = 0; i < 2; i++) { if (_sfxOffsets[i]) { _ssgChannels[i + 1]->protect(); @@ -3818,7 +3812,7 @@ void TownsPC98_OpnDriver::startSoundEffect() { _updateSfxFlag &= ~_sfxChannels[i]->_idFlag; } } - + setVolumeChannelMasks(~volFlags, volFlags); _sfxData = 0; } @@ -4259,8 +4253,12 @@ void SoundPC98::updateVolumeSettings() { if (!_driver) return; - _driver->setMusicVolume(ConfMan.getInt("music_volume")); - _driver->setSoundEffectVolume(ConfMan.getInt("sfx_volume")); + bool mute = false; + if (ConfMan.hasKey("mute")) + mute = ConfMan.getBool("mute"); + + _driver->setMusicVolume((mute ? 0 : ConfMan.getInt("music_volume"))); + _driver->setSoundEffectVolume((mute ? 0 : ConfMan.getInt("sfx_volume"))); } // KYRA 2 @@ -4461,14 +4459,18 @@ void SoundTownsPC98_v2::updateVolumeSettings() { if (!_driver) return; - _driver->setMusicVolume(ConfMan.getInt("music_volume")); - _driver->setSoundEffectVolume(ConfMan.getInt("sfx_volume")); + bool mute = false; + if (ConfMan.hasKey("mute")) + mute = ConfMan.getBool("mute"); + + _driver->setMusicVolume((mute ? 0 : ConfMan.getInt("music_volume"))); + _driver->setSoundEffectVolume((mute ? 0 : ConfMan.getInt("sfx_volume"))); } // static resources const uint32 TownsPC98_OpnCore::_adtStat[] = { - 0x00010001, 0x00010001, 0x00010001, 0x01010001, + 0x00010001, 0x00010001, 0x00010001, 0x01010001, 0x00010101, 0x00010101, 0x00010101, 0x01010101, 0x01010101, 0x01010101, 0x01010102, 0x01010102, 0x01020102, 0x01020102, 0x01020202, 0x01020202, @@ -4482,14 +4484,14 @@ const uint32 TownsPC98_OpnCore::_adtStat[] = { const uint8 TownsPC98_OpnCore::_detSrc[] = { 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x06, 0x06, 0x07, - 0x08, 0x08, 0x08, 0x08, 0x01, 0x01, 0x01, 0x01, - 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, + 0x08, 0x08, 0x08, 0x08, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x06, 0x06, 0x07, - 0x08, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, - 0x10, 0x10, 0x10, 0x10, 0x02, 0x02, 0x02, 0x02, + 0x08, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, + 0x10, 0x10, 0x10, 0x10, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, - 0x05, 0x06, 0x06, 0x07, 0x08, 0x08, 0x09, 0x0a, - 0x0b, 0x0c, 0x0d, 0x0e, 0x10, 0x11, 0x13, 0x14, + 0x05, 0x06, 0x06, 0x07, 0x08, 0x08, 0x09, 0x0a, + 0x0b, 0x0c, 0x0d, 0x0e, 0x10, 0x11, 0x13, 0x14, 0x16, 0x16, 0x16, 0x16 }; diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 2f2acd78d1..9ad2f50619 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -27,18 +27,15 @@ #include "common/md5.h" #include "kyra/kyra_v1.h" #include "kyra/kyra_lok.h" -#include "kyra/lol.h" #include "kyra/kyra_v2.h" #include "kyra/kyra_hof.h" #include "kyra/kyra_mr.h" #include "kyra/screen.h" #include "kyra/screen_lok.h" -#include "kyra/screen_lol.h" #include "kyra/screen_hof.h" #include "kyra/screen_mr.h" #include "kyra/resource.h" #include "kyra/gui_lok.h" -#include "kyra/gui_lol.h" #include "kyra/gui_hof.h" #include "kyra/gui_mr.h" #include "kyra/sound_intern.h" @@ -305,36 +302,6 @@ const ItemAnimData_v2 *StaticResource::loadShapeAnimData_v2(int id, int &entries return (const ItemAnimData_v2 *)getData(id, k2ShpAnimDataV2, entries); } -#ifdef ENABLE_LOL -const LoLCharacter *StaticResource::loadCharData(int id, int &entries) { - return (const LoLCharacter *)getData(id, kLolCharData, entries); -} - -const SpellProperty *StaticResource::loadSpellData(int id, int &entries) { - return (const SpellProperty *)getData(id, kLolSpellData, entries); -} - -const CompassDef *StaticResource::loadCompassData(int id, int &entries) { - return (const CompassDef *)getData(id, kLolCompassData, entries); -} - -const FlyingObjectShape *StaticResource::loadFlyingObjectData(int id, int &entries) { - return (const FlyingObjectShape *)getData(id, kLolFlightShpData, entries); -} - -const uint16 *StaticResource::loadRawDataBe16(int id, int &entries) { - return (const uint16 *)getData(id, kLolRawDataBe16, entries); -} - -const uint32 *StaticResource::loadRawDataBe32(int id, int &entries) { - return (const uint32 *)getData(id, kLolRawDataBe32, entries); -} - -const ButtonDef *StaticResource::loadButtonDefs(int id, int &entries) { - return (const ButtonDef *)getData(id, kLolButtonData, entries); -} -#endif // ENABLE_LOL - bool StaticResource::prefetchId(int id) { if (id == -1) { for (DataMap::const_iterator i = _dataTable.begin(); i != _dataTable.end(); ++i) { @@ -641,160 +608,6 @@ bool StaticResource::loadShapeAnimData_v2(Common::SeekableReadStream &stream, vo return true; } -#ifdef ENABLE_LOL -bool StaticResource::loadCharData(Common::SeekableReadStream &stream, void *&ptr, int &size) { - size = stream.size() / 130; - LoLCharacter *charData = new LoLCharacter[size]; - - for (int i = 0; i < size; i++) { - LoLCharacter *t = &charData[i]; - - t->flags = stream.readUint16LE(); - stream.read(t->name, 11); - t->raceClassSex = stream.readByte(); - t->id = stream.readSint16LE(); - t->curFaceFrame = stream.readByte(); - t->tempFaceFrame = stream.readByte(); - t->screamSfx = stream.readByte(); - stream.readUint32LE(); - for (int ii = 0; ii < 8; ii++) - t->itemsMight[ii] = stream.readUint16LE(); - for (int ii = 0; ii < 8; ii++) - t->protectionAgainstItems[ii] = stream.readUint16LE(); - t->itemProtection = stream.readUint16LE(); - t->hitPointsCur = stream.readSint16LE(); - t->hitPointsMax = stream.readUint16LE(); - t->magicPointsCur = stream.readSint16LE(); - t->magicPointsMax = stream.readUint16LE(); - t->field_41 = stream.readByte(); - t->damageSuffered = stream.readUint16LE(); - t->weaponHit = stream.readUint16LE(); - t->totalMightModifier = stream.readUint16LE(); - t->totalProtectionModifier = stream.readUint16LE(); - t->might = stream.readUint16LE(); - t->protection = stream.readUint16LE(); - t->nextAnimUpdateCountdown = stream.readSint16LE(); - for (int ii = 0; ii < 11; ii++) - t->items[ii] = stream.readUint16LE(); - for (int ii = 0; ii < 3; ii++) - t->skillLevels[ii] = stream.readByte(); - for (int ii = 0; ii < 3; ii++) - t->skillModifiers[ii] = stream.readByte(); - for (int ii = 0; ii < 3; ii++) - t->experiencePts[ii] = stream.readUint32LE(); - for (int ii = 0; ii < 5; ii++) - t->characterUpdateEvents[ii] = stream.readByte(); - for (int ii = 0; ii < 5; ii++) - t->characterUpdateDelay[ii] = stream.readByte(); - }; - - ptr = charData; - return true; -} - -bool StaticResource::loadSpellData(Common::SeekableReadStream &stream, void *&ptr, int &size) { - size = stream.size() / 28; - SpellProperty *spellData = new SpellProperty[size]; - - for (int i = 0; i < size; i++) { - SpellProperty *t = &spellData[i]; - - t->spellNameCode = stream.readUint16LE(); - for (int ii = 0; ii < 4; ii++) - t->mpRequired[ii] = stream.readUint16LE(); - t->field_a = stream.readUint16LE(); - t->field_c = stream.readUint16LE(); - for (int ii = 0; ii < 4; ii++) - t->hpRequired[ii] = stream.readUint16LE(); - t->field_16 = stream.readUint16LE(); - t->field_18 = stream.readUint16LE(); - t->flags = stream.readUint16LE(); - }; - - ptr = spellData; - return true; -} - -bool StaticResource::loadCompassData(Common::SeekableReadStream &stream, void *&ptr, int &size) { - size = stream.size() / 4; - CompassDef *defs = new CompassDef[size]; - - for (int i = 0; i < size; i++) { - CompassDef *t = &defs[i]; - t->shapeIndex = stream.readByte(); - t->x = stream.readByte(); - t->y = stream.readByte(); - t->flags = stream.readByte(); - }; - - - ptr = defs; - return true; -} - -bool StaticResource::loadFlyingObjectData(Common::SeekableReadStream &stream, void *&ptr, int &size) { - size = stream.size() / 5; - FlyingObjectShape *defs = new FlyingObjectShape[size]; - - for (int i = 0; i < size; i++) { - FlyingObjectShape *t = &defs[i]; - t->shapeFront = stream.readByte(); - t->shapeBack = stream.readByte(); - t->shapeLeft = stream.readByte(); - t->drawFlags = stream.readByte(); - t->flipFlags = stream.readByte(); - }; - - ptr = defs; - return true; -} - -bool StaticResource::loadRawDataBe16(Common::SeekableReadStream &stream, void *&ptr, int &size) { - size = stream.size() >> 1; - - uint16 *r = new uint16[size]; - - for (int i = 0; i < size; i++) - r[i] = stream.readUint16BE(); - - ptr = r; - return true; -} - -bool StaticResource::loadRawDataBe32(Common::SeekableReadStream &stream, void *&ptr, int &size) { - size = stream.size() >> 2; - - uint32 *r = new uint32[size]; - - for (int i = 0; i < size; i++) - r[i] = stream.readUint32BE(); - - ptr = r; - return true; -} - -bool StaticResource::loadButtonDefs(Common::SeekableReadStream &stream, void *&ptr, int &size) { - size = stream.size() / 18; - - ButtonDef *r = new ButtonDef[size]; - - for (int i = 0; i < size; i++) { - r[i].buttonflags = stream.readUint16BE(); - r[i].keyCode = stream.readUint16BE(); - r[i].keyCode2 = stream.readUint16BE(); - r[i].x = stream.readSint16BE(); - r[i].y = stream.readSint16BE(); - r[i].w = stream.readUint16BE(); - r[i].h = stream.readUint16BE(); - r[i].index = stream.readUint16BE(); - r[i].screenDim = stream.readUint16BE(); - } - - ptr = r; - return true; -} -#endif // ENABLE_LOL - void StaticResource::freeRawData(void *&ptr, int &size) { uint8 *data = (uint8 *)ptr; delete[] data; @@ -870,58 +683,6 @@ void StaticResource::freeHofShapeAnimDataV2(void *&ptr, int &size) { size = 0; } -#ifdef ENABLE_LOL -void StaticResource::freeCharData(void *&ptr, int &size) { - LoLCharacter *d = (LoLCharacter *)ptr; - delete[] d; - ptr = 0; - size = 0; -} - -void StaticResource::freeSpellData(void *&ptr, int &size) { - SpellProperty *d = (SpellProperty *)ptr; - delete[] d; - ptr = 0; - size = 0; -} - -void StaticResource::freeCompassData(void *&ptr, int &size) { - CompassDef *d = (CompassDef *)ptr; - delete[] d; - ptr = 0; - size = 0; -} - -void StaticResource::freeFlyingObjectData(void *&ptr, int &size) { - FlyingObjectShape *d = (FlyingObjectShape *)ptr; - delete[] d; - ptr = 0; - size = 0; -} - - -void StaticResource::freeRawDataBe16(void *&ptr, int &size) { - uint16 *data = (uint16 *)ptr; - delete[] data; - ptr = 0; - size = 0; -} - -void StaticResource::freeRawDataBe32(void *&ptr, int &size) { - uint32 *data = (uint32 *)ptr; - delete[] data; - ptr = 0; - size = 0; -} - -void StaticResource::freeButtonDefs(void *&ptr, int &size) { - ButtonDef *d = (ButtonDef *)ptr; - delete[] d; - ptr = 0; - size = 0; -} -#endif // ENABLE_LOL - #pragma mark - void KyraEngine_LoK::initStaticResource() { @@ -1360,371 +1121,6 @@ void KyraEngine_MR::initStaticResource() { _itemStringMap = _staticres->loadRawData(k3ItemStringMap, _itemStringMapSize); } -#ifdef ENABLE_LOL -// TODO: move this to lol.cpp maybe? -void LoLEngine::initStaticResource() { - // assign music data - static const char *pcMusicFileListIntro[] = { "LOREINTR" }; - static const char *pcMusicFileListFinale[] = { "LOREFINL" }; - static const char *pcMusicFileListIngame[] = { "LORE%02d%c" }; - - static const char *pc98MusicFileListIntro[] = { 0, "lore84.86", "lore82.86", 0, 0, 0, "lore83.86", "lore81.86" }; - static const char *pc98MusicFileListFinale[] = { 0, 0, "lore85.86", "lore86.86", "lore87.86" }; - static const char *pc98MusicFileListIngame[] = { "lore%02d.86" }; - - memset(_soundData, 0, sizeof(_soundData)); - if (_flags.platform == Common::kPlatformPC) { - _soundData[0].fileList = pcMusicFileListIntro; - _soundData[0].fileListLen = ARRAYSIZE(pcMusicFileListIntro); - _soundData[1].fileList = pcMusicFileListIngame; - _soundData[1].fileListLen = ARRAYSIZE(pcMusicFileListIngame); - _soundData[2].fileList = pcMusicFileListFinale; - _soundData[2].fileListLen = ARRAYSIZE(pcMusicFileListFinale); - } else if (_flags.platform == Common::kPlatformPC98) { - _soundData[0].fileList = pc98MusicFileListIntro; - _soundData[0].fileListLen = ARRAYSIZE(pc98MusicFileListIntro); - _soundData[1].fileList = pc98MusicFileListIngame; - _soundData[1].fileListLen = ARRAYSIZE(pc98MusicFileListIngame); - _soundData[2].fileList = pc98MusicFileListFinale; - _soundData[2].fileListLen = ARRAYSIZE(pc98MusicFileListFinale); - } - - if (_flags.isDemo) - return; - - _pakFileList = _staticres->loadStrings(kLolIngamePakFiles, _pakFileListSize); - _charDefaults = _staticres->loadCharData(kLolCharacterDefs, _charDefaultsSize); - _ingameSoundIndex = (const uint16 *)_staticres->loadRawData(kLolIngameSfxIndex, _ingameSoundIndexSize); - _musicTrackMap = _staticres->loadRawData(kLolMusicTrackMap, _musicTrackMapSize); - _ingameGMSoundIndex = _staticres->loadRawData(kLolIngameGMSfxIndex, _ingameGMSoundIndexSize); - _ingameMT32SoundIndex = _staticres->loadRawData(kLolIngameMT32SfxIndex, _ingameMT32SoundIndexSize); - _ingamePCSpeakerSoundIndex = _staticres->loadRawData(kLolIngamePcSpkSfxIndex, _ingamePCSpeakerSoundIndexSize); - _spellProperties = _staticres->loadSpellData(kLolSpellProperties, _spellPropertiesSize); - _gameShapeMap = (const int8 *)_staticres->loadRawData(kLolGameShapeMap, _gameShapeMapSize); - _sceneItemOffs = (const int8 *)_staticres->loadRawData(kLolSceneItemOffs, _sceneItemOffsSize); - _charInvIndex = _staticres->loadRawData(kLolCharInvIndex, _charInvIndexSize); - _charInvDefs = _staticres->loadRawData(kLolCharInvDefs, _charInvDefsSize); - _charDefsMan = _staticres->loadRawDataBe16(kLolCharDefsMan, _charDefsManSize); - _charDefsWoman = _staticres->loadRawDataBe16(kLolCharDefsWoman, _charDefsWomanSize); - _charDefsKieran = _staticres->loadRawDataBe16(kLolCharDefsKieran, _charDefsKieranSize); - _charDefsAkshel = _staticres->loadRawDataBe16(kLolCharDefsAkshel, _charDefsAkshelSize); - _expRequirements = (const int32 *)_staticres->loadRawDataBe32(kLolExpRequirements, _expRequirementsSize); - _monsterModifiers = _staticres->loadRawDataBe16(kLolMonsterModifiers, _monsterModifiersSize); - _monsterShiftOffs = (const int8 *)_staticres->loadRawData(kLolMonsterShiftOffsets, _monsterShiftOffsSize); - _monsterDirFlags = _staticres->loadRawData(kLolMonsterDirFlags, _monsterDirFlagsSize); - _monsterScaleX = _staticres->loadRawData(kLolMonsterScaleX, _monsterScaleXSize); - _monsterScaleY = _staticres->loadRawData(kLolMonsterScaleY, _monsterScaleYSize); - _monsterScaleWH = _staticres->loadRawDataBe16(kLolMonsterScaleWH, _monsterScaleWHSize); - _inventorySlotDesc = _staticres->loadRawDataBe16(kLolInventoryDesc, _inventorySlotDescSize); - _levelShpList = _staticres->loadStrings(kLolLevelShpList, _levelShpListSize); - _levelDatList = _staticres->loadStrings(kLolLevelDatList, _levelDatListSize); - _compassDefs = _staticres->loadCompassData(kLolCompassDefs, _compassDefsSize); - _flyingItemShapes = _staticres->loadFlyingObjectData(kLolFlyingObjectShp, _flyingItemShapesSize); - _itemCost = _staticres->loadRawDataBe16(kLolItemPrices, _itemCostSize); - _stashSetupData = _staticres->loadRawData(kLolStashSetup, _stashSetupDataSize); - - _dscUnk1 = (const int8 *)_staticres->loadRawData(kLolDscUnk1, _dscUnk1Size); - _dscShapeIndex = (const int8 *)_staticres->loadRawData(kLolDscShapeIndex, _dscShapeIndexSize); - _dscOvlMap = _staticres->loadRawData(kLolDscOvlMap, _dscOvlMapSize); - _dscShapeScaleW = _staticres->loadRawDataBe16(kLolDscScaleWidthData, _dscShapeScaleWSize); - _dscShapeScaleH = _staticres->loadRawDataBe16(kLolDscScaleHeightData, _dscShapeScaleHSize); - _dscShapeX = (const int16 *)_staticres->loadRawDataBe16(kLolDscX, _dscShapeXSize); - _dscShapeY = (const int8 *)_staticres->loadRawData(kLolDscY, _dscShapeYSize); - _dscTileIndex = _staticres->loadRawData(kLolDscTileIndex, _dscTileIndexSize); - _dscUnk2 = _staticres->loadRawData(kLolDscUnk2, _dscUnk2Size); - _dscDoorShpIndex = _staticres->loadRawData(kLolDscDoorShapeIndex, _dscDoorShpIndexSize); - _dscDim1 = (const int8 *)_staticres->loadRawData(kLolDscDimData1, _dscDim1Size); - _dscDim2 = (const int8 *)_staticres->loadRawData(kLolDscDimData2, _dscDim2Size); - _dscBlockMap = _staticres->loadRawData(kLolDscBlockMap, _dscBlockMapSize); - _dscDimMap = _staticres->loadRawData(kLolDscDimMap, _dscDimMapSize); - _dscDoorMonsterScaleTable = _staticres->loadRawDataBe16(kLolDscDoorScale, _dscDoorMonsterScaleTableSize); - _dscShapeOvlIndex = _staticres->loadRawData(kLolDscOvlIndex, _dscShapeOvlIndexSize); - _dscDoor4 = _staticres->loadRawDataBe16(kLolDscDoor4, _dscDoor4Size); - _dscBlockIndex = (const int8 *)_staticres->loadRawData(kLolDscBlockIndex, _dscBlockIndexSize); - _dscDoor1 = _staticres->loadRawData(kLolDscDoor1, _dscDoor1Size); - _dscDoorMonsterX = (const int16 *)_staticres->loadRawDataBe16(kLolDscDoorX, _dscDoorMonsterXSize); - _dscDoorMonsterY = (const int16 *)_staticres->loadRawDataBe16(kLolDscDoorY, _dscDoorMonsterYSize); - - _scrollXTop = _staticres->loadRawData(kLolScrollXTop, _scrollXTopSize); - _scrollYTop = _staticres->loadRawData(kLolScrollYTop, _scrollYTopSize); - _scrollXBottom = _staticres->loadRawData(kLolScrollXBottom, _scrollXBottomSize); - _scrollYBottom = _staticres->loadRawData(kLolScrollYBottom, _scrollYBottomSize); - - const char *const *tmpSndList = _staticres->loadStrings(kLolIngameSfxFiles, _ingameSoundListSize); - if (tmpSndList) { - _ingameSoundList = new char *[_ingameSoundListSize]; - for (int i = 0; i < _ingameSoundListSize; i++) { - _ingameSoundList[i] = new char[strlen(tmpSndList[i]) + 1]; - strcpy(_ingameSoundList[i], tmpSndList[i]); - } - _staticres->unloadId(kLolIngameSfxFiles); - } - - _buttonData = _staticres->loadButtonDefs(kLolButtonDefs, _buttonDataSize); - _buttonList1 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList1, _buttonList1Size); - _buttonList2 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList2, _buttonList2Size); - _buttonList3 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList3, _buttonList3Size); - _buttonList4 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList4, _buttonList4Size); - _buttonList5 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList5, _buttonList5Size); - _buttonList6 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList6, _buttonList6Size); - _buttonList7 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList7, _buttonList7Size); - _buttonList8 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList8, _buttonList8Size); - - _autoMapStrings = _staticres->loadRawDataBe16(kLolMapStringId, _autoMapStringsSize); - - int tmpSize = 0; - const uint8 *tmp = _staticres->loadRawData(kLolLegendData, tmpSize); - tmpSize /= 5; - if (tmp) { - _defaultLegendData = new MapLegendData[tmpSize]; - for (int i = 0; i < tmpSize; i++) { - _defaultLegendData[i].shapeIndex = *tmp++; - _defaultLegendData[i].enable = *tmp++ ? true : false; - _defaultLegendData[i].x = (int8)*tmp++; - _defaultLegendData[i].stringId = READ_LE_UINT16(tmp); - tmp += 2; - } - _staticres->unloadId(kLolLegendData); - } - - tmp = _staticres->loadRawData(kLolMapCursorOvl, tmpSize); - _mapCursorOverlay = new uint8[tmpSize]; - memcpy(_mapCursorOverlay, tmp, tmpSize); - _staticres->unloadId(kLolMapCursorOvl); - - _updateSpellBookCoords = _staticres->loadRawData(kLolSpellbookCoords, _updateSpellBookCoordsSize); - _updateSpellBookAnimData = _staticres->loadRawData(kLolSpellbookAnim, _updateSpellBookAnimDataSize); - _healShapeFrames = _staticres->loadRawData(kLolHealShapeFrames, _healShapeFramesSize); - - tmp = _staticres->loadRawData(kLolLightningDefs, tmpSize); - if (tmp) { - _lightningProps = new LightningProperty[5]; - for (int i = 0; i < 5; i++) { - _lightningProps[i].lastFrame = tmp[i << 2]; - _lightningProps[i].frameDiv = tmp[(i << 2) + 1]; - _lightningProps[i].sfxId = READ_LE_UINT16(&tmp[(i << 2) + 2]); - } - _staticres->unloadId(kLolLightningDefs); - } - - _fireBallCoords = (const int16 *)_staticres->loadRawDataBe16(kLolFireballCoords, _fireBallCoordsSize); - - _buttonCallbacks.clear(); - _buttonCallbacks.reserve(95); -#define cb(x) _buttonCallbacks.push_back(BUTTON_FUNCTOR(LoLEngine, this, &LoLEngine::x)) - // 0x00 - cb(clickedUpArrow); - cb(clickedDownArrow); - _buttonCallbacks.push_back(_buttonCallbacks[1]); - cb(clickedLeftArrow); - - // 0x04 - cb(clickedRightArrow); - cb(clickedTurnLeftArrow); - cb(clickedTurnRightArrow); - cb(clickedAttackButton); - - // 0x08 - for (int i = 0; i < 3; ++i) - _buttonCallbacks.push_back(_buttonCallbacks[7]); - cb(clickedMagicButton); - - // 0x0C - for (int i = 0; i < 3; ++i) - _buttonCallbacks.push_back(_buttonCallbacks[11]); - cb(clickedMagicSubmenu); - - // 0x10 - cb(clickedScreen); - cb(clickedPortraitLeft); - for (int i = 0; i < 7; ++i) - _buttonCallbacks.push_back(_buttonCallbacks[17]); - - // 0x19 - cb(clickedLiveMagicBarsLeft); - for (int i = 0; i < 3; ++i) - _buttonCallbacks.push_back(_buttonCallbacks[25]); - - // 0x1D - cb(clickedPortraitEtcRight); - for (int i = 0; i < 3; ++i) - _buttonCallbacks.push_back(_buttonCallbacks[29]); - - // 0x21 - cb(clickedCharInventorySlot); - for (int i = 0; i < 10; ++i) - _buttonCallbacks.push_back(_buttonCallbacks[33]); - - // 0x2C - cb(clickedExitCharInventory); - cb(clickedSceneDropItem); - for (int i = 0; i < 3; ++i) - _buttonCallbacks.push_back(_buttonCallbacks[45]); - - // 0x31 - cb(clickedScenePickupItem); - cb(clickedInventorySlot); - for (int i = 0; i < 9; ++i) - _buttonCallbacks.push_back(_buttonCallbacks[50]); - - // 0x3C - cb(clickedInventoryScroll); - cb(clickedInventoryScroll); - cb(clickedWall); - _buttonCallbacks.push_back(_buttonCallbacks[62]); - - // 0x40 - cb(clickedSequenceWindow); - _buttonCallbacks.push_back(_buttonCallbacks[0]); - _buttonCallbacks.push_back(_buttonCallbacks[1]); - _buttonCallbacks.push_back(_buttonCallbacks[3]); - - // 0x44 - _buttonCallbacks.push_back(_buttonCallbacks[4]); - _buttonCallbacks.push_back(_buttonCallbacks[5]); - _buttonCallbacks.push_back(_buttonCallbacks[6]); - cb(clickedScroll); - - // 0x48 - for (int i = 0; i < 9; ++i) - _buttonCallbacks.push_back(_buttonCallbacks[71]); - - // 0x51 - cb(clickedSpellTargetCharacter); - for (int i = 0; i < 3; ++i) - _buttonCallbacks.push_back(_buttonCallbacks[81]); - - // 0x55 - cb(clickedSpellTargetScene); - cb(clickedSceneThrowItem); - _buttonCallbacks.push_back(_buttonCallbacks[86]); - - // 0x58 - cb(clickedOptions); - cb(clickedRestParty); - cb(clickedMoneyBox); - cb(clickedCompass); - - // 0x5C - cb(clickedAutomap); - cb(clickedLamp); - cb(clickedStatusIcon); -#undef cb -} - -void GUI_LoL::initStaticData() { - GUI_V2_BUTTON(_scrollUpButton, 20, 96, 0, 1, 1, 1, 0x4487, 0, 0, 0, 25, 16, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0); - GUI_V2_BUTTON(_scrollDownButton, 21, 98, 0, 1, 1, 1, 0x4487, 0, 0, 0, 25, 16, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0); - - for (uint i = 0; i < ARRAYSIZE(_menuButtons); ++i) - GUI_V2_BUTTON(_menuButtons[i], i, 0, 0, 0, 0, 0, 0x4487, 0, 0, 0, 0, 0, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0); - - if (_vm->gameFlags().isTalkie) - GUI_LOL_MENU(_mainMenu, 9, 0x4000, 0, 7, -1, -1, -1, -1); - else - GUI_LOL_MENU(_mainMenu, 17, 0x4000, 0, 6, -1, -1, -1, -1); - - GUI_LOL_MENU_ITEM(_mainMenu.item[0], 0x4001, 16, 23, 176, 15, 0, 0); - GUI_LOL_MENU_ITEM(_mainMenu.item[1], 0x4002, 16, 40, 176, 15, 0, 0); - GUI_LOL_MENU_ITEM(_mainMenu.item[2], 0x4003, 16, 57, 176, 15, 0, 0); - GUI_LOL_MENU_ITEM(_mainMenu.item[3], 0x4004, 16, 74, 176, 15, 0, 0); - - if (_vm->gameFlags().isTalkie) { - GUI_LOL_MENU_ITEM(_mainMenu.item[4], 0x42D9, 16, 91, 176, 15, 0, 0); - GUI_LOL_MENU_ITEM(_mainMenu.item[5], 0x4006, 16, 108, 176, 15, 0, 0); - GUI_LOL_MENU_ITEM(_mainMenu.item[6], 0x4005, 88, 127, 104, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); - } else { - GUI_LOL_MENU_ITEM(_mainMenu.item[4], 0x4006, 16, 91, 176, 15, 0, 0); - GUI_LOL_MENU_ITEM(_mainMenu.item[5], 0x4005, 88, 110, 104, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); - } - - Button::Callback mainMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedMainMenu); - for (int i = 0; i < _mainMenu.numberOfItems; ++i) - _mainMenu.item[i].callback = mainMenuFunctor; - - GUI_LOL_MENU(_loadMenu, 10, 0x400e, 1, 5, 128, 20, 128, 118); - GUI_LOL_MENU_ITEM(_loadMenu.item[0], 0xfffe, 8, 39, 256, 15, 0, 0); - GUI_LOL_MENU_ITEM(_loadMenu.item[1], 0xfffd, 8, 56, 256, 15, 0, 0); - GUI_LOL_MENU_ITEM(_loadMenu.item[2], 0xfffc, 8, 73, 256, 15, 0, 0); - GUI_LOL_MENU_ITEM(_loadMenu.item[3], 0xfffb, 8, 90, 256, 15, 0, 0); - GUI_LOL_MENU_ITEM(_loadMenu.item[4], 0x4011, 168, 118, 96, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); - Button::Callback loadMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedLoadMenu); - for (int i = 0; i < 5; ++i) - _loadMenu.item[i].callback = loadMenuFunctor; - - GUI_LOL_MENU(_saveMenu, 10, 0x400d, 1, 5, 128, 20, 128, 118); - GUI_LOL_MENU_ITEM(_saveMenu.item[0], 0xfffe, 8, 39, 256, 15, 0, 0); - GUI_LOL_MENU_ITEM(_saveMenu.item[1], 0xfffd, 8, 56, 256, 15, 0, 0); - GUI_LOL_MENU_ITEM(_saveMenu.item[2], 0xfffc, 8, 73, 256, 15, 0, 0); - GUI_LOL_MENU_ITEM(_saveMenu.item[3], 0xfffb, 8, 90, 256, 15, 0, 0); - GUI_LOL_MENU_ITEM(_saveMenu.item[4], 0x4011, 168, 118, 96, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); - Button::Callback saveMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedSaveMenu); - for (int i = 0; i < 5; ++i) - _saveMenu.item[i].callback = saveMenuFunctor; - - GUI_LOL_MENU(_deleteMenu, 10, 0x400f, 1, 5, 128, 20, 128, 118); - GUI_LOL_MENU_ITEM(_deleteMenu.item[0], 0xfffe, 8, 39, 256, 15, 0, 0); - GUI_LOL_MENU_ITEM(_deleteMenu.item[1], 0xfffd, 8, 56, 256, 15, 0, 0); - GUI_LOL_MENU_ITEM(_deleteMenu.item[2], 0xfffc, 8, 73, 256, 15, 0, 0); - GUI_LOL_MENU_ITEM(_deleteMenu.item[3], 0xfffb, 8, 90, 256, 15, 0, 0); - GUI_LOL_MENU_ITEM(_deleteMenu.item[4], 0x4011, 168, 118, 96, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); - Button::Callback deleteMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedDeleteMenu); - for (int i = 0; i < 5; ++i) - _deleteMenu.item[i].callback = deleteMenuFunctor; - - GUI_LOL_MENU(_gameOptions, 17, 0x400c, 0, 6, -1, -1, -1, -1); - if (_vm->gameFlags().isTalkie) { - GUI_LOL_MENU_ITEM(_gameOptions.item[0], 0xfff7, 120, 22, 80, 15, 0x406e, 0); - GUI_LOL_MENU_ITEM(_gameOptions.item[1], 0xfff6, 120, 39, 80, 15, 0x406c, 0); - GUI_LOL_MENU_ITEM(_gameOptions.item[2], 0xfff5, 120, 56, 80, 15, 0x406d, 0); - GUI_LOL_MENU_ITEM(_gameOptions.item[3], 0xfff4, 120, 73, 80, 15, 0x42d5, 0); - GUI_LOL_MENU_ITEM(_gameOptions.item[4], 0xfff3, 120, 90, 80, 15, 0x42d2, 0); - GUI_LOL_MENU_ITEM(_gameOptions.item[5], 0x4072, 104, 110, 96, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); - } else { - GUI_LOL_MENU_ITEM(_gameOptions.item[0], 0xfff9, 120, 22, 80, 15, 0x406a, 0); - GUI_LOL_MENU_ITEM(_gameOptions.item[1], 0xfff8, 120, 39, 80, 15, 0x406b, 0); - GUI_LOL_MENU_ITEM(_gameOptions.item[2], 0xfff7, 120, 56, 80, 15, 0x406e, 0); - GUI_LOL_MENU_ITEM(_gameOptions.item[3], 0xfff6, 120, 73, 80, 15, 0x406c, 0); - GUI_LOL_MENU_ITEM(_gameOptions.item[4], 0xfff5, 120, 90, 80, 15, 0x406d, 0); - GUI_LOL_MENU_ITEM(_gameOptions.item[5], 0x4072, 104, 110, 96, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); - } - Button::Callback optionsMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedOptionsMenu); - for (int i = 0; i < _gameOptions.numberOfItems; ++i) - _gameOptions.item[i].callback = optionsMenuFunctor; - - GUI_LOL_MENU(_audioOptions, 18, 0x42d9, 2, 1, -1, -1, -1, -1); - GUI_LOL_MENU_ITEM(_audioOptions.item[0], 0x4072, 152, 76, 96, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); - GUI_LOL_MENU_ITEM(_audioOptions.item[1], 3, 128, 22, 114, 14, 0x42db, 0); - GUI_LOL_MENU_ITEM(_audioOptions.item[2], 4, 128, 39, 114, 14, 0x42da, 0); - GUI_LOL_MENU_ITEM(_audioOptions.item[3], 5, 128, 56, 114, 14, 0x42dc, 0); - Button::Callback audioMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedAudioMenu); - for (int i = 0; i < 4; ++i) - _audioOptions.item[i].callback = audioMenuFunctor; - - GUI_LOL_MENU(_deathMenu, 11, 0x4013, 0, 2, -1, -1, -1, -1); - GUI_LOL_MENU_ITEM(_deathMenu.item[0], 0x4006, 8, 30, 104, 15, 0, 0); - GUI_LOL_MENU_ITEM(_deathMenu.item[1], 0x4001, 176, 30, 104, 15, 0, 0); - Button::Callback deathMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedDeathMenu); - for (int i = 0; i < 2; ++i) - _deathMenu.item[i].callback = deathMenuFunctor; - - GUI_LOL_MENU(_savenameMenu, 7, 0x4053, 0, 2, -1, -1, -1, -1); - GUI_LOL_MENU_ITEM(_savenameMenu.item[0], 0x4012, 8, 38, 72, 15, 0, _vm->_keyMap[Common::KEYCODE_RETURN]); - GUI_LOL_MENU_ITEM(_savenameMenu.item[1], 0x4011, 176, 38, 72, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); - Button::Callback savenameMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedSavenameMenu); - for (int i = 0; i < 2; ++i) - _savenameMenu.item[i].callback = savenameMenuFunctor; - - GUI_LOL_MENU(_choiceMenu, 11, 0, 0, 2, -1, -1, -1, -1); - GUI_LOL_MENU_ITEM(_choiceMenu.item[0], 0x4007, 8, 30, 72, 15, 0, 0); - GUI_LOL_MENU_ITEM(_choiceMenu.item[1], 0x4008, 208, 30, 72, 15, 0, 0); - Button::Callback choiceMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedChoiceMenu); - for (int i = 0; i < 2; ++i) - _choiceMenu.item[i].callback = choiceMenuFunctor; -} - -#endif // ENABLE_LOL - const uint8 Screen_LoK_16::_palette16[48] = { 0x00, 0x00, 0x00, 0x02, 0x07, 0x0B, 0x0C, 0x06, 0x04, 0x0E, 0x09, 0x07, 0x00, 0x06, 0x03, 0x00, 0x0C, 0x07, @@ -2745,263 +2141,5 @@ const int8 KyraEngine_MR::_albumWSAY[] = { -1, -2, 2, 2, -6, -6, -6, 0 }; -// lands of lore static res - -#ifdef ENABLE_LOL -const ScreenDim Screen_LoL::_screenDimTable256C[] = { - { 0x00, 0x00, 0x28, 0xC8, 0xC7, 0xCF, 0x00, 0x00 }, // Taken from Intro - { 0x08, 0x48, 0x18, 0x38, 0xFE, 0x01, 0x00, 0x00 }, - { 0x0E, 0x00, 0x16, 0x78, 0xFE, 0x01, 0x00, 0x00 }, - { 0x0B, 0x7B, 0x1C, 0x12, 0xFE, 0xFC, 0x00, 0x00 }, - { 0x0B, 0x7B, 0x1C, 0x2D, 0xFE, 0xFC, 0x00, 0x00 }, - { 0x55, 0x7B, 0xE9, 0x37, 0xFE, 0xFC, 0x00, 0x00 }, - { 0x0B, 0x8C, 0x10, 0x2B, 0x3D, 0x01, 0x00, 0x00 }, // Main menu box (4 entries) - { 0x04, 0x59, 0x20, 0x3C, 0x00, 0x00, 0x00, 0x00 }, - { 0x05, 0x6E, 0x1E, 0x0C, 0xFE, 0x01, 0x00, 0x00 }, - { 0x07, 0x19, 0x1A, 0x97, 0x00, 0x00, 0x00, 0x00 }, // Ingame main menu box CD version - { 0x03, 0x1E, 0x22, 0x8C, 0x00, 0x00, 0x00, 0x00 }, - { 0x02, 0x48, 0x24, 0x34, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x0E, 0x00, 0x16, 0x78, 0xFE, 0x01, 0x00, 0x00 }, - { 0x0D, 0xA2, 0x18, 0x0C, 0xFE, 0x01, 0x00, 0x00 }, - { 0x0F, 0x06, 0x14, 0x6E, 0x01, 0x00, 0x00, 0x00 }, - { 0x1A, 0xBE, 0x0A, 0x07, 0xFE, 0x01, 0x00, 0x00 }, - { 0x07, 0x21, 0x1A, 0x85, 0x00, 0x00, 0x00, 0x00 }, - { 0x03, 0x32, 0x22, 0x62, 0x00, 0x00, 0x00, 0x00 }, - { 0x0B, 0x8C, 0x10, 0x33, 0x3D, 0x01, 0x00, 0x00 }, // Main menu box (5 entries, CD version only) - { 0x0B, 0x8C, 0x10, 0x23, 0x3D, 0x01, 0x00, 0x00 }, // Main menu box (3 entries, floppy version only) - - { 0x01, 0x20, 0x26, 0x80, 0xDC, 0xFD, 0x00, 0x00 }, // Credits - { 0x09, 0x29, 0x08, 0x2C, 0x00, 0x00, 0x00, 0x00 }, - { 0x19, 0x29, 0x08, 0x2C, 0x00, 0x00, 0x00, 0x00 }, - { 0x01, 0x02, 0x26, 0x14, 0x00, 0x0F, 0x0E, 0x00 }, -}; - -const ScreenDim Screen_LoL::_screenDimTable16C[] = { - { 0x00, 0x00, 0x28, 0xC8, 0x33, 0x44, 0x00, 0x00 }, // Taken from Intro - { 0x08, 0x48, 0x18, 0x38, 0x33, 0x44, 0x00, 0x00 }, - { 0x0E, 0x00, 0x16, 0x78, 0x33, 0x44, 0x00, 0x00 }, - { 0x0B, 0x7B, 0x1C, 0x11, 0x33, 0x11, 0x00, 0x00 }, - { 0x0B, 0x7B, 0x1C, 0x2D, 0x33, 0x11, 0x00, 0x00 }, - { 0x55, 0x7B, 0xE9, 0x37, 0x33, 0x11, 0x00, 0x00 }, - { 0x0B, 0x92, 0x10, 0x2A, 0x33, 0x44, 0x00, 0x00 }, // Main menu box (4 entries) - { 0x04, 0x58, 0x20, 0x3C, 0x00, 0x00, 0x00, 0x00 }, - { 0x05, 0x6C, 0x1E, 0x0D, 0x33, 0x44, 0x00, 0x00 }, - { 0x07, 0x20, 0x1A, 0x86, 0x00, 0x00, 0x00, 0x00 }, - { 0x03, 0x20, 0x22, 0x8C, 0x00, 0x00, 0x00, 0x00 }, - { 0x02, 0x48, 0x24, 0x34, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x0E, 0x00, 0x16, 0x78, 0x33, 0x44, 0x00, 0x00 }, - { 0x0D, 0xA2, 0x18, 0x0C, 0x33, 0x44, 0x00, 0x00 }, - { 0x0F, 0x06, 0x14, 0x6E, 0x44, 0x00, 0x00, 0x00 }, - { 0x1A, 0xBE, 0x0A, 0x07, 0x33, 0x44, 0x00, 0x00 }, - { 0x07, 0x21, 0x1A, 0x85, 0x00, 0x00, 0x00, 0x00 }, - { 0x03, 0x32, 0x22, 0x62, 0x00, 0x00, 0x00, 0x00 }, - { 0x0B, 0x8C, 0x10, 0x33, 0x33, 0x44, 0x00, 0x00 }, // Main menu box (5 entries, not used here) - { 0x0B, 0x8C, 0x10, 0x23, 0x33, 0x44, 0x00, 0x00 }, // Main menu box (3 entries) - - { 0x01, 0x20, 0x26, 0x80, 0xDC, 0xFD, 0x00, 0x00 }, // Credits (TODO: Check this!) - { 0x09, 0x29, 0x08, 0x2C, 0x00, 0x00, 0x00, 0x00 }, - { 0x19, 0x29, 0x08, 0x2C, 0x00, 0x00, 0x00, 0x00 }, - { 0x01, 0x02, 0x26, 0x14, 0x00, 0x0F, 0x0E, 0x00 }, -}; - -const int Screen_LoL::_screenDimTableCount = ARRAYSIZE(Screen_LoL::_screenDimTable256C); - -const char * const LoLEngine::_languageExt[] = { - "ENG", - "FRE", - "GER" -}; - -const LoLEngine::CharacterPrev LoLEngine::_charPreviews[] = { - { "Ak\'shel", 0x060, 0x7F, { 0x0F, 0x08, 0x05 } }, - { "Michael", 0x09A, 0x7F, { 0x06, 0x0A, 0x0F } }, - { "Kieran", 0x0D4, 0x7F, { 0x08, 0x06, 0x08 } }, - { "Conrad", 0x10F, 0x7F, { 0x0A, 0x0C, 0x0A } } -}; - -const uint16 LoLEngine::_charPosXPC98[] = { - 92, 152, 212, 268 -}; - -const uint8 LoLEngine::_charNamesPC98[][11] = { - { 0x83, 0x41, 0x83, 0x4E, 0x83, 0x56, 0x83, 0x46, 0x83, 0x8B, 0x00 }, - { 0x83, 0x7D, 0x83, 0x43, 0x83, 0x50, 0x83, 0x8B, 0x00, 0x00, 0x00 }, - { 0x83, 0x4C, 0x81, 0x5B, 0x83, 0x89, 0x83, 0x93, 0x00, 0x00, 0x00 }, - { 0x83, 0x52, 0x83, 0x93, 0x83, 0x89, 0x83, 0x62, 0x83, 0x68, 0x00 } -}; - -const uint8 LoLEngine::_chargenFrameTableTalkie[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, - 0x05, 0x04, 0x03, 0x02, 0x01, - 0x00, 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x0A, 0x0B, 0x0C, 0x0D, - 0x0E, 0x0F, 0x10, 0x11, 0x12 -}; - -const uint8 LoLEngine::_chargenFrameTableFloppy[] = { - 0, 1, 2, 3, 4, 5, 4, 3, 2, - 1, 0, 0, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15 -}; - -const uint16 LoLEngine::_selectionPosTable[] = { - 0x6F, 0x00, 0x8F, 0x00, 0xAF, 0x00, 0xCF, 0x00, - 0xEF, 0x00, 0x6F, 0x20, 0x8F, 0x20, 0xAF, 0x20, - 0xCF, 0x20, 0xEF, 0x20, 0x6F, 0x40, 0x8F, 0x40, - 0xAF, 0x40, 0xCF, 0x40, 0xEF, 0x40, 0x10F, 0x00 -}; - -const uint8 LoLEngine::_selectionChar1IdxTable[] = { - 0, 0, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 0, 0, 5, 5, 5, - 5, 5, 5, 5, 0, 0, 5, 5, - 5, 5, 5 -}; - -const uint8 LoLEngine::_selectionChar2IdxTable[] = { - 1, 1, 6, 6, 1, 1, 6, 6, - 6, 6, 6, 6, 6, 1, 1, 6, - 6, 6, 1, 1, 6, 6, 6, 6, - 6, 6, 6 -}; - -const uint8 LoLEngine::_selectionChar3IdxTable[] = { - 2, 2, 7, 7, 7, 7, 2, 2, - 7, 7, 7, 7, 7, 7, 7, 2, - 2, 7, 7, 7, 7, 2, 2, 7, - 7, 7, 7 -}; - -const uint8 LoLEngine::_selectionChar4IdxTable[] = { - 3, 3, 8, 8, 8, 8, 3, 3, - 8, 8, 3, 3, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 3, 3, 8, - 8, 8, 8 -}; - -const uint8 LoLEngine::_reminderChar1IdxTable[] = { - 4, 4, 4, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, - 5 -}; - -const uint8 LoLEngine::_reminderChar2IdxTable[] = { - 9, 9, 9, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, - 6 -}; - -const uint8 LoLEngine::_reminderChar3IdxTable[] = { - 0xE, 0xE, 0xE, 0x7, 0x7, 0x7, 0x7, 0x7, - 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, - 0x7 -}; - -const uint8 LoLEngine::_reminderChar4IdxTable[] = { - 0xF, 0xF, 0xF, 0x8, 0x8, 0x8, 0x8, 0x8, - 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, - 0x8 -}; - -const uint8 LoLEngine::_selectionAnimIndexTable[] = { - 0, 5, 1, 6, 2, 7, 3, 8 -}; - -const uint8 LoLEngine::_charInfoFrameTable[] = { - 0x0, 0x7, 0x8, 0x9, 0xA, 0xB, 0xA, 0x9, - 0x8, 0x7, 0x0, 0x0, 0x7, 0x8, 0x9, 0xA, - 0xB, 0xA, 0x9, 0x8, 0x7, 0x0, 0x0, 0x7, - 0x8, 0x9, 0xA, 0xB, 0xA, 0x9, 0x8, 0x7 -}; - -const uint8 LoLEngine::_clock2Timers[] = { - 0x00, 0x10, 0x11, 0x03, 0x04, 0x50, - 0x51, 0x52, 0x08, 0x09, 0x0A -}; - -const uint8 LoLEngine::_numClock2Timers = ARRAYSIZE(LoLEngine::_clock2Timers); - -const int8 LoLEngine::_mapCoords[12][4] = { - { 0, 7, 0, -5 }, { -5, 0, 6, 0 }, { 7, 5, 7, 1 }, - { 5, 6, 4, 6 }, { 0, 7, 0, -1 }, { -3, 0, 6, 0 }, - { 6, 7, 6, -3 }, { -3, 5, 6, 5 }, { 1, 5, 1, 1 }, - { 3, 1, 3, 1 }, { -1, 6, -1, -8 }, { -7, -1, 5, -1 } -}; - -const MistOfDoomAnimData LoLEngine::_mistAnimData[] = { - { 0, 7, 7, 13, 155 }, - { 0, 16, 16, 17, 155 }, - { 0, 24, 24, 24, 174 }, - { 0, 19, 19, 19, 174 }, - { 0, 16, 16, 17, 175 }, -}; - -const char * const LoLEngine::_outroShapeFileTable[] = { - "AMAZON.SHP", "ARCHRSLG.SHP", "AVIANWRM.SHP", "BANDIT.SHP", "BOAR.SHP", "CABAL.SHP", - "GUARD.SHP", "HAG.SHP", "HORNET.SHP", "HURZELL.SHP", "IRONGRZR.SHP", "KNOWLES.SHP", - "LIZARD.SHP", "MANTHA.SHP", "MINOTAUR.SHP", "MORIBUND.SHP", "ORC.SHP", "ORCLDR.SHP", - "PENTROG.SHP", "RATMAN.SHP", "ROCKLING.SHP", "SCAVNGR.SHP", "STARK.SHP", - "SWAMPCIT.SHP", "SWAMPMON.SHP", "THUG.SHP", "VIPER.SHP", "XEOB.SHP" -}; - -const uint8 LoLEngine::_outroFrameTable[] = { - 0, 0, 0, 0, 0, 1, 2, 3, - 0, 1, 2, 3, 8, 9, 10, 11, - 8, 9, 10, 11, 4, 5, 6, 7 -}; - -const int16 LoLEngine::_outroRightMonsterPos[] = { - 205, 55, 205, 55, 205, 55, 205, 55, - 205, 56, 207, 57, 208, 58, 210, 59, - 213, 60, 216, 61, 220, 61, 225, 61, - 230, 61, 235, 61, 240, 61, 240, 61, - 240, 61, 240, 61, 240, 61, 240, 61, - 240, 61, 265, 61, 290, 61, 315, 61 -}; - -const int16 LoLEngine::_outroLeftMonsterPos[] = { - 92, 55, 92, 55, 92, 55, 92, 55, - 92, 56, 90, 57, 85, 58, 77, 59, - 67, 60, 57, 61, 47, 61, 35, 61, - 35, 61, 35, 61, 35, 61, 35, 61, - 35, 61, 35, 61, 35, 61, 35, 61, - 35, 61, 10, 61, -20, 61, -45, 61 -}; - -const int16 LoLEngine::_outroRightDoorPos[] = { - 200, 41, 200, 29, 200, 17, 200, 5, - 200, -7, 200, -7, 200, -7, 200, -7, - 200, 5, 200, 17, 200, 29, 200, 41, - 200, 41, 200, 41, 200, 41, 200, 41, - 200, 41, 200, 41, 200, 41, 200, 41, - 200, 41, 200, 41, 200, 41, 200, 41 -}; - -const int16 LoLEngine::_outroLeftDoorPos[] = { - 72, 41, 72, 29, 72, 17, 72, 5, - 72, -7, 72, -7, 72, -7, 72, -7, - 72, 5, 72, 17, 72, 29, 72, 41, - 72, 41, 72, 41, 72, 41, 72, 41, - 72, 41, 72, 41, 72, 41, 72, 41, - 72, 41, 72, 41, 72, 41, 72, 41 -}; - -const int LoLEngine::_outroMonsterScaleTableX[] = { - 0x050, 0x050, 0x050, 0x050, 0x050, 0x05D, 0x070, 0x085, - 0x0A0, 0x0C0, 0x0E2, 0x100, 0x100, 0x100, 0x100, 0x100, - 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100 -}; - -const int LoLEngine::_outroMonsterScaleTableY[] = { - 0x04C, 0x04C, 0x04C, 0x04C, 0x04C, 0x059, 0x06B, 0x080, - 0x099, 0x0B8, 0x0D9, 0x100, 0x100, 0x100, 0x100, 0x100, - 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100 -}; - -#endif // ENABLE_LOL - } // End of namespace Kyra diff --git a/engines/kyra/staticres_lol.cpp b/engines/kyra/staticres_lol.cpp new file mode 100644 index 0000000000..dbf6808e37 --- /dev/null +++ b/engines/kyra/staticres_lol.cpp @@ -0,0 +1,882 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#include "kyra/resource.h" +#include "kyra/lol.h" +#include "kyra/screen_lol.h" +#include "kyra/gui_lol.h" + +#ifdef ENABLE_LOL + +namespace Kyra { + +const LoLCharacter *StaticResource::loadCharData(int id, int &entries) { + return (const LoLCharacter *)getData(id, kLolCharData, entries); +} + +const SpellProperty *StaticResource::loadSpellData(int id, int &entries) { + return (const SpellProperty *)getData(id, kLolSpellData, entries); +} + +const CompassDef *StaticResource::loadCompassData(int id, int &entries) { + return (const CompassDef *)getData(id, kLolCompassData, entries); +} + +const FlyingObjectShape *StaticResource::loadFlyingObjectData(int id, int &entries) { + return (const FlyingObjectShape *)getData(id, kLolFlightShpData, entries); +} + +const uint16 *StaticResource::loadRawDataBe16(int id, int &entries) { + return (const uint16 *)getData(id, kLolRawDataBe16, entries); +} + +const uint32 *StaticResource::loadRawDataBe32(int id, int &entries) { + return (const uint32 *)getData(id, kLolRawDataBe32, entries); +} + +const ButtonDef *StaticResource::loadButtonDefs(int id, int &entries) { + return (const ButtonDef *)getData(id, kLolButtonData, entries); +} + +bool StaticResource::loadCharData(Common::SeekableReadStream &stream, void *&ptr, int &size) { + size = stream.size() / 130; + LoLCharacter *charData = new LoLCharacter[size]; + + for (int i = 0; i < size; i++) { + LoLCharacter *t = &charData[i]; + + t->flags = stream.readUint16LE(); + stream.read(t->name, 11); + t->raceClassSex = stream.readByte(); + t->id = stream.readSint16LE(); + t->curFaceFrame = stream.readByte(); + t->tempFaceFrame = stream.readByte(); + t->screamSfx = stream.readByte(); + stream.readUint32LE(); + for (int ii = 0; ii < 8; ii++) + t->itemsMight[ii] = stream.readUint16LE(); + for (int ii = 0; ii < 8; ii++) + t->protectionAgainstItems[ii] = stream.readUint16LE(); + t->itemProtection = stream.readUint16LE(); + t->hitPointsCur = stream.readSint16LE(); + t->hitPointsMax = stream.readUint16LE(); + t->magicPointsCur = stream.readSint16LE(); + t->magicPointsMax = stream.readUint16LE(); + t->field_41 = stream.readByte(); + t->damageSuffered = stream.readUint16LE(); + t->weaponHit = stream.readUint16LE(); + t->totalMightModifier = stream.readUint16LE(); + t->totalProtectionModifier = stream.readUint16LE(); + t->might = stream.readUint16LE(); + t->protection = stream.readUint16LE(); + t->nextAnimUpdateCountdown = stream.readSint16LE(); + for (int ii = 0; ii < 11; ii++) + t->items[ii] = stream.readUint16LE(); + for (int ii = 0; ii < 3; ii++) + t->skillLevels[ii] = stream.readByte(); + for (int ii = 0; ii < 3; ii++) + t->skillModifiers[ii] = stream.readByte(); + for (int ii = 0; ii < 3; ii++) + t->experiencePts[ii] = stream.readUint32LE(); + for (int ii = 0; ii < 5; ii++) + t->characterUpdateEvents[ii] = stream.readByte(); + for (int ii = 0; ii < 5; ii++) + t->characterUpdateDelay[ii] = stream.readByte(); + }; + + ptr = charData; + return true; +} + +bool StaticResource::loadSpellData(Common::SeekableReadStream &stream, void *&ptr, int &size) { + size = stream.size() / 28; + SpellProperty *spellData = new SpellProperty[size]; + + for (int i = 0; i < size; i++) { + SpellProperty *t = &spellData[i]; + + t->spellNameCode = stream.readUint16LE(); + for (int ii = 0; ii < 4; ii++) + t->mpRequired[ii] = stream.readUint16LE(); + t->field_a = stream.readUint16LE(); + t->field_c = stream.readUint16LE(); + for (int ii = 0; ii < 4; ii++) + t->hpRequired[ii] = stream.readUint16LE(); + t->field_16 = stream.readUint16LE(); + t->field_18 = stream.readUint16LE(); + t->flags = stream.readUint16LE(); + }; + + ptr = spellData; + return true; +} + +bool StaticResource::loadCompassData(Common::SeekableReadStream &stream, void *&ptr, int &size) { + size = stream.size() / 4; + CompassDef *defs = new CompassDef[size]; + + for (int i = 0; i < size; i++) { + CompassDef *t = &defs[i]; + t->shapeIndex = stream.readByte(); + t->x = stream.readByte(); + t->y = stream.readByte(); + t->flags = stream.readByte(); + }; + + + ptr = defs; + return true; +} + +bool StaticResource::loadFlyingObjectData(Common::SeekableReadStream &stream, void *&ptr, int &size) { + size = stream.size() / 5; + FlyingObjectShape *defs = new FlyingObjectShape[size]; + + for (int i = 0; i < size; i++) { + FlyingObjectShape *t = &defs[i]; + t->shapeFront = stream.readByte(); + t->shapeBack = stream.readByte(); + t->shapeLeft = stream.readByte(); + t->drawFlags = stream.readByte(); + t->flipFlags = stream.readByte(); + }; + + ptr = defs; + return true; +} + +bool StaticResource::loadRawDataBe16(Common::SeekableReadStream &stream, void *&ptr, int &size) { + size = stream.size() >> 1; + + uint16 *r = new uint16[size]; + + for (int i = 0; i < size; i++) + r[i] = stream.readUint16BE(); + + ptr = r; + return true; +} + +bool StaticResource::loadRawDataBe32(Common::SeekableReadStream &stream, void *&ptr, int &size) { + size = stream.size() >> 2; + + uint32 *r = new uint32[size]; + + for (int i = 0; i < size; i++) + r[i] = stream.readUint32BE(); + + ptr = r; + return true; +} + +bool StaticResource::loadButtonDefs(Common::SeekableReadStream &stream, void *&ptr, int &size) { + size = stream.size() / 18; + + ButtonDef *r = new ButtonDef[size]; + + for (int i = 0; i < size; i++) { + r[i].buttonflags = stream.readUint16BE(); + r[i].keyCode = stream.readUint16BE(); + r[i].keyCode2 = stream.readUint16BE(); + r[i].x = stream.readSint16BE(); + r[i].y = stream.readSint16BE(); + r[i].w = stream.readUint16BE(); + r[i].h = stream.readUint16BE(); + r[i].index = stream.readUint16BE(); + r[i].screenDim = stream.readUint16BE(); + } + + ptr = r; + return true; +} + +void StaticResource::freeCharData(void *&ptr, int &size) { + LoLCharacter *d = (LoLCharacter *)ptr; + delete[] d; + ptr = 0; + size = 0; +} + +void StaticResource::freeSpellData(void *&ptr, int &size) { + SpellProperty *d = (SpellProperty *)ptr; + delete[] d; + ptr = 0; + size = 0; +} + +void StaticResource::freeCompassData(void *&ptr, int &size) { + CompassDef *d = (CompassDef *)ptr; + delete[] d; + ptr = 0; + size = 0; +} + +void StaticResource::freeFlyingObjectData(void *&ptr, int &size) { + FlyingObjectShape *d = (FlyingObjectShape *)ptr; + delete[] d; + ptr = 0; + size = 0; +} + + +void StaticResource::freeRawDataBe16(void *&ptr, int &size) { + uint16 *data = (uint16 *)ptr; + delete[] data; + ptr = 0; + size = 0; +} + +void StaticResource::freeRawDataBe32(void *&ptr, int &size) { + uint32 *data = (uint32 *)ptr; + delete[] data; + ptr = 0; + size = 0; +} + +void StaticResource::freeButtonDefs(void *&ptr, int &size) { + ButtonDef *d = (ButtonDef *)ptr; + delete[] d; + ptr = 0; + size = 0; +} + +void LoLEngine::initStaticResource() { + // assign music data + static const char *pcMusicFileListIntro[] = { "LOREINTR" }; + static const char *pcMusicFileListFinale[] = { "LOREFINL" }; + static const char *pcMusicFileListIngame[] = { "LORE%02d%c" }; + + static const char *pc98MusicFileListIntro[] = { 0, "lore84.86", "lore82.86", 0, 0, 0, "lore83.86", "lore81.86" }; + static const char *pc98MusicFileListFinale[] = { 0, 0, "lore85.86", "lore86.86", "lore87.86" }; + static const char *pc98MusicFileListIngame[] = { "lore%02d.86" }; + + memset(_soundData, 0, sizeof(_soundData)); + if (_flags.platform == Common::kPlatformPC) { + _soundData[0].fileList = pcMusicFileListIntro; + _soundData[0].fileListLen = ARRAYSIZE(pcMusicFileListIntro); + _soundData[1].fileList = pcMusicFileListIngame; + _soundData[1].fileListLen = ARRAYSIZE(pcMusicFileListIngame); + _soundData[2].fileList = pcMusicFileListFinale; + _soundData[2].fileListLen = ARRAYSIZE(pcMusicFileListFinale); + } else if (_flags.platform == Common::kPlatformPC98) { + _soundData[0].fileList = pc98MusicFileListIntro; + _soundData[0].fileListLen = ARRAYSIZE(pc98MusicFileListIntro); + _soundData[1].fileList = pc98MusicFileListIngame; + _soundData[1].fileListLen = ARRAYSIZE(pc98MusicFileListIngame); + _soundData[2].fileList = pc98MusicFileListFinale; + _soundData[2].fileListLen = ARRAYSIZE(pc98MusicFileListFinale); + } + + if (_flags.isDemo) + return; + + _pakFileList = _staticres->loadStrings(kLolIngamePakFiles, _pakFileListSize); + _charDefaults = _staticres->loadCharData(kLolCharacterDefs, _charDefaultsSize); + _ingameSoundIndex = (const uint16 *)_staticres->loadRawData(kLolIngameSfxIndex, _ingameSoundIndexSize); + _musicTrackMap = _staticres->loadRawData(kLolMusicTrackMap, _musicTrackMapSize); + _ingameGMSoundIndex = _staticres->loadRawData(kLolIngameGMSfxIndex, _ingameGMSoundIndexSize); + _ingameMT32SoundIndex = _staticres->loadRawData(kLolIngameMT32SfxIndex, _ingameMT32SoundIndexSize); + _ingamePCSpeakerSoundIndex = _staticres->loadRawData(kLolIngamePcSpkSfxIndex, _ingamePCSpeakerSoundIndexSize); + _spellProperties = _staticres->loadSpellData(kLolSpellProperties, _spellPropertiesSize); + _gameShapeMap = (const int8 *)_staticres->loadRawData(kLolGameShapeMap, _gameShapeMapSize); + _sceneItemOffs = (const int8 *)_staticres->loadRawData(kLolSceneItemOffs, _sceneItemOffsSize); + _charInvIndex = _staticres->loadRawData(kLolCharInvIndex, _charInvIndexSize); + _charInvDefs = _staticres->loadRawData(kLolCharInvDefs, _charInvDefsSize); + _charDefsMan = _staticres->loadRawDataBe16(kLolCharDefsMan, _charDefsManSize); + _charDefsWoman = _staticres->loadRawDataBe16(kLolCharDefsWoman, _charDefsWomanSize); + _charDefsKieran = _staticres->loadRawDataBe16(kLolCharDefsKieran, _charDefsKieranSize); + _charDefsAkshel = _staticres->loadRawDataBe16(kLolCharDefsAkshel, _charDefsAkshelSize); + _expRequirements = (const int32 *)_staticres->loadRawDataBe32(kLolExpRequirements, _expRequirementsSize); + _monsterModifiers = _staticres->loadRawDataBe16(kLolMonsterModifiers, _monsterModifiersSize); + _monsterShiftOffs = (const int8 *)_staticres->loadRawData(kLolMonsterShiftOffsets, _monsterShiftOffsSize); + _monsterDirFlags = _staticres->loadRawData(kLolMonsterDirFlags, _monsterDirFlagsSize); + _monsterScaleX = _staticres->loadRawData(kLolMonsterScaleX, _monsterScaleXSize); + _monsterScaleY = _staticres->loadRawData(kLolMonsterScaleY, _monsterScaleYSize); + _monsterScaleWH = _staticres->loadRawDataBe16(kLolMonsterScaleWH, _monsterScaleWHSize); + _inventorySlotDesc = _staticres->loadRawDataBe16(kLolInventoryDesc, _inventorySlotDescSize); + _levelShpList = _staticres->loadStrings(kLolLevelShpList, _levelShpListSize); + _levelDatList = _staticres->loadStrings(kLolLevelDatList, _levelDatListSize); + _compassDefs = _staticres->loadCompassData(kLolCompassDefs, _compassDefsSize); + _flyingItemShapes = _staticres->loadFlyingObjectData(kLolFlyingObjectShp, _flyingItemShapesSize); + _itemCost = _staticres->loadRawDataBe16(kLolItemPrices, _itemCostSize); + _stashSetupData = _staticres->loadRawData(kLolStashSetup, _stashSetupDataSize); + + _dscUnk1 = (const int8 *)_staticres->loadRawData(kLolDscUnk1, _dscUnk1Size); + _dscShapeIndex = (const int8 *)_staticres->loadRawData(kLolDscShapeIndex, _dscShapeIndexSize); + _dscOvlMap = _staticres->loadRawData(kLolDscOvlMap, _dscOvlMapSize); + _dscShapeScaleW = _staticres->loadRawDataBe16(kLolDscScaleWidthData, _dscShapeScaleWSize); + _dscShapeScaleH = _staticres->loadRawDataBe16(kLolDscScaleHeightData, _dscShapeScaleHSize); + _dscShapeX = (const int16 *)_staticres->loadRawDataBe16(kLolDscX, _dscShapeXSize); + _dscShapeY = (const int8 *)_staticres->loadRawData(kLolDscY, _dscShapeYSize); + _dscTileIndex = _staticres->loadRawData(kLolDscTileIndex, _dscTileIndexSize); + _dscUnk2 = _staticres->loadRawData(kLolDscUnk2, _dscUnk2Size); + _dscDoorShpIndex = _staticres->loadRawData(kLolDscDoorShapeIndex, _dscDoorShpIndexSize); + _dscDim1 = (const int8 *)_staticres->loadRawData(kLolDscDimData1, _dscDim1Size); + _dscDim2 = (const int8 *)_staticres->loadRawData(kLolDscDimData2, _dscDim2Size); + _dscBlockMap = _staticres->loadRawData(kLolDscBlockMap, _dscBlockMapSize); + _dscDimMap = _staticres->loadRawData(kLolDscDimMap, _dscDimMapSize); + _dscDoorMonsterScaleTable = _staticres->loadRawDataBe16(kLolDscDoorScale, _dscDoorMonsterScaleTableSize); + _dscShapeOvlIndex = _staticres->loadRawData(kLolDscOvlIndex, _dscShapeOvlIndexSize); + _dscDoor4 = _staticres->loadRawDataBe16(kLolDscDoor4, _dscDoor4Size); + _dscBlockIndex = (const int8 *)_staticres->loadRawData(kLolDscBlockIndex, _dscBlockIndexSize); + _dscDoor1 = _staticres->loadRawData(kLolDscDoor1, _dscDoor1Size); + _dscDoorMonsterX = (const int16 *)_staticres->loadRawDataBe16(kLolDscDoorX, _dscDoorMonsterXSize); + _dscDoorMonsterY = (const int16 *)_staticres->loadRawDataBe16(kLolDscDoorY, _dscDoorMonsterYSize); + + _scrollXTop = _staticres->loadRawData(kLolScrollXTop, _scrollXTopSize); + _scrollYTop = _staticres->loadRawData(kLolScrollYTop, _scrollYTopSize); + _scrollXBottom = _staticres->loadRawData(kLolScrollXBottom, _scrollXBottomSize); + _scrollYBottom = _staticres->loadRawData(kLolScrollYBottom, _scrollYBottomSize); + + const char *const *tmpSndList = _staticres->loadStrings(kLolIngameSfxFiles, _ingameSoundListSize); + if (tmpSndList) { + _ingameSoundList = new char *[_ingameSoundListSize]; + for (int i = 0; i < _ingameSoundListSize; i++) { + _ingameSoundList[i] = new char[strlen(tmpSndList[i]) + 1]; + strcpy(_ingameSoundList[i], tmpSndList[i]); + } + _staticres->unloadId(kLolIngameSfxFiles); + } + + _buttonData = _staticres->loadButtonDefs(kLolButtonDefs, _buttonDataSize); + _buttonList1 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList1, _buttonList1Size); + _buttonList2 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList2, _buttonList2Size); + _buttonList3 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList3, _buttonList3Size); + _buttonList4 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList4, _buttonList4Size); + _buttonList5 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList5, _buttonList5Size); + _buttonList6 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList6, _buttonList6Size); + _buttonList7 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList7, _buttonList7Size); + _buttonList8 = (const int16 *)_staticres->loadRawDataBe16(kLolButtonList8, _buttonList8Size); + + _autoMapStrings = _staticres->loadRawDataBe16(kLolMapStringId, _autoMapStringsSize); + + int tmpSize = 0; + const uint8 *tmp = _staticres->loadRawData(kLolLegendData, tmpSize); + tmpSize /= 5; + if (tmp) { + _defaultLegendData = new MapLegendData[tmpSize]; + for (int i = 0; i < tmpSize; i++) { + _defaultLegendData[i].shapeIndex = *tmp++; + _defaultLegendData[i].enable = *tmp++ ? true : false; + _defaultLegendData[i].x = (int8)*tmp++; + _defaultLegendData[i].stringId = READ_LE_UINT16(tmp); + tmp += 2; + } + _staticres->unloadId(kLolLegendData); + } + + tmp = _staticres->loadRawData(kLolMapCursorOvl, tmpSize); + _mapCursorOverlay = new uint8[tmpSize]; + memcpy(_mapCursorOverlay, tmp, tmpSize); + _staticres->unloadId(kLolMapCursorOvl); + + _updateSpellBookCoords = _staticres->loadRawData(kLolSpellbookCoords, _updateSpellBookCoordsSize); + _updateSpellBookAnimData = _staticres->loadRawData(kLolSpellbookAnim, _updateSpellBookAnimDataSize); + _healShapeFrames = _staticres->loadRawData(kLolHealShapeFrames, _healShapeFramesSize); + + tmp = _staticres->loadRawData(kLolLightningDefs, tmpSize); + if (tmp) { + _lightningProps = new LightningProperty[5]; + for (int i = 0; i < 5; i++) { + _lightningProps[i].lastFrame = tmp[i << 2]; + _lightningProps[i].frameDiv = tmp[(i << 2) + 1]; + _lightningProps[i].sfxId = READ_LE_UINT16(&tmp[(i << 2) + 2]); + } + _staticres->unloadId(kLolLightningDefs); + } + + _fireBallCoords = (const int16 *)_staticres->loadRawDataBe16(kLolFireballCoords, _fireBallCoordsSize); + + _buttonCallbacks.clear(); + _buttonCallbacks.reserve(95); +#define cb(x) _buttonCallbacks.push_back(BUTTON_FUNCTOR(LoLEngine, this, &LoLEngine::x)) + // 0x00 + cb(clickedUpArrow); + cb(clickedDownArrow); + _buttonCallbacks.push_back(_buttonCallbacks[1]); + cb(clickedLeftArrow); + + // 0x04 + cb(clickedRightArrow); + cb(clickedTurnLeftArrow); + cb(clickedTurnRightArrow); + cb(clickedAttackButton); + + // 0x08 + for (int i = 0; i < 3; ++i) + _buttonCallbacks.push_back(_buttonCallbacks[7]); + cb(clickedMagicButton); + + // 0x0C + for (int i = 0; i < 3; ++i) + _buttonCallbacks.push_back(_buttonCallbacks[11]); + cb(clickedMagicSubmenu); + + // 0x10 + cb(clickedScreen); + cb(clickedPortraitLeft); + for (int i = 0; i < 7; ++i) + _buttonCallbacks.push_back(_buttonCallbacks[17]); + + // 0x19 + cb(clickedLiveMagicBarsLeft); + for (int i = 0; i < 3; ++i) + _buttonCallbacks.push_back(_buttonCallbacks[25]); + + // 0x1D + cb(clickedPortraitEtcRight); + for (int i = 0; i < 3; ++i) + _buttonCallbacks.push_back(_buttonCallbacks[29]); + + // 0x21 + cb(clickedCharInventorySlot); + for (int i = 0; i < 10; ++i) + _buttonCallbacks.push_back(_buttonCallbacks[33]); + + // 0x2C + cb(clickedExitCharInventory); + cb(clickedSceneDropItem); + for (int i = 0; i < 3; ++i) + _buttonCallbacks.push_back(_buttonCallbacks[45]); + + // 0x31 + cb(clickedScenePickupItem); + cb(clickedInventorySlot); + for (int i = 0; i < 9; ++i) + _buttonCallbacks.push_back(_buttonCallbacks[50]); + + // 0x3C + cb(clickedInventoryScroll); + cb(clickedInventoryScroll); + cb(clickedWall); + _buttonCallbacks.push_back(_buttonCallbacks[62]); + + // 0x40 + cb(clickedSequenceWindow); + _buttonCallbacks.push_back(_buttonCallbacks[0]); + _buttonCallbacks.push_back(_buttonCallbacks[1]); + _buttonCallbacks.push_back(_buttonCallbacks[3]); + + // 0x44 + _buttonCallbacks.push_back(_buttonCallbacks[4]); + _buttonCallbacks.push_back(_buttonCallbacks[5]); + _buttonCallbacks.push_back(_buttonCallbacks[6]); + cb(clickedScroll); + + // 0x48 + for (int i = 0; i < 9; ++i) + _buttonCallbacks.push_back(_buttonCallbacks[71]); + + // 0x51 + cb(clickedSpellTargetCharacter); + for (int i = 0; i < 3; ++i) + _buttonCallbacks.push_back(_buttonCallbacks[81]); + + // 0x55 + cb(clickedSpellTargetScene); + cb(clickedSceneThrowItem); + _buttonCallbacks.push_back(_buttonCallbacks[86]); + + // 0x58 + cb(clickedOptions); + cb(clickedRestParty); + cb(clickedMoneyBox); + cb(clickedCompass); + + // 0x5C + cb(clickedAutomap); + cb(clickedLamp); + cb(clickedStatusIcon); +#undef cb +} + +void GUI_LoL::initStaticData() { + GUI_V2_BUTTON(_scrollUpButton, 20, 96, 0, 1, 1, 1, 0x4487, 0, 0, 0, 25, 16, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0); + GUI_V2_BUTTON(_scrollDownButton, 21, 98, 0, 1, 1, 1, 0x4487, 0, 0, 0, 25, 16, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0); + + for (uint i = 0; i < ARRAYSIZE(_menuButtons); ++i) + GUI_V2_BUTTON(_menuButtons[i], i, 0, 0, 0, 0, 0, 0x4487, 0, 0, 0, 0, 0, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0); + + if (_vm->gameFlags().isTalkie) + GUI_LOL_MENU(_mainMenu, 9, 0x4000, 0, 7, -1, -1, -1, -1); + else + GUI_LOL_MENU(_mainMenu, 17, 0x4000, 0, 6, -1, -1, -1, -1); + + GUI_LOL_MENU_ITEM(_mainMenu.item[0], 0x4001, 16, 23, 176, 15, 0, 0); + GUI_LOL_MENU_ITEM(_mainMenu.item[1], 0x4002, 16, 40, 176, 15, 0, 0); + GUI_LOL_MENU_ITEM(_mainMenu.item[2], 0x4003, 16, 57, 176, 15, 0, 0); + GUI_LOL_MENU_ITEM(_mainMenu.item[3], 0x4004, 16, 74, 176, 15, 0, 0); + + if (_vm->gameFlags().isTalkie) { + GUI_LOL_MENU_ITEM(_mainMenu.item[4], 0x42D9, 16, 91, 176, 15, 0, 0); + GUI_LOL_MENU_ITEM(_mainMenu.item[5], 0x4006, 16, 108, 176, 15, 0, 0); + GUI_LOL_MENU_ITEM(_mainMenu.item[6], 0x4005, 88, 127, 104, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); + } else { + GUI_LOL_MENU_ITEM(_mainMenu.item[4], 0x4006, 16, 91, 176, 15, 0, 0); + GUI_LOL_MENU_ITEM(_mainMenu.item[5], 0x4005, 88, 110, 104, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); + } + + Button::Callback mainMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedMainMenu); + for (int i = 0; i < _mainMenu.numberOfItems; ++i) + _mainMenu.item[i].callback = mainMenuFunctor; + + GUI_LOL_MENU(_loadMenu, 10, 0x400e, 1, 5, 128, 20, 128, 118); + GUI_LOL_MENU_ITEM(_loadMenu.item[0], 0xfffe, 8, 39, 256, 15, 0, 0); + GUI_LOL_MENU_ITEM(_loadMenu.item[1], 0xfffd, 8, 56, 256, 15, 0, 0); + GUI_LOL_MENU_ITEM(_loadMenu.item[2], 0xfffc, 8, 73, 256, 15, 0, 0); + GUI_LOL_MENU_ITEM(_loadMenu.item[3], 0xfffb, 8, 90, 256, 15, 0, 0); + GUI_LOL_MENU_ITEM(_loadMenu.item[4], 0x4011, 168, 118, 96, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); + Button::Callback loadMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedLoadMenu); + for (int i = 0; i < 5; ++i) + _loadMenu.item[i].callback = loadMenuFunctor; + + GUI_LOL_MENU(_saveMenu, 10, 0x400d, 1, 5, 128, 20, 128, 118); + GUI_LOL_MENU_ITEM(_saveMenu.item[0], 0xfffe, 8, 39, 256, 15, 0, 0); + GUI_LOL_MENU_ITEM(_saveMenu.item[1], 0xfffd, 8, 56, 256, 15, 0, 0); + GUI_LOL_MENU_ITEM(_saveMenu.item[2], 0xfffc, 8, 73, 256, 15, 0, 0); + GUI_LOL_MENU_ITEM(_saveMenu.item[3], 0xfffb, 8, 90, 256, 15, 0, 0); + GUI_LOL_MENU_ITEM(_saveMenu.item[4], 0x4011, 168, 118, 96, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); + Button::Callback saveMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedSaveMenu); + for (int i = 0; i < 5; ++i) + _saveMenu.item[i].callback = saveMenuFunctor; + + GUI_LOL_MENU(_deleteMenu, 10, 0x400f, 1, 5, 128, 20, 128, 118); + GUI_LOL_MENU_ITEM(_deleteMenu.item[0], 0xfffe, 8, 39, 256, 15, 0, 0); + GUI_LOL_MENU_ITEM(_deleteMenu.item[1], 0xfffd, 8, 56, 256, 15, 0, 0); + GUI_LOL_MENU_ITEM(_deleteMenu.item[2], 0xfffc, 8, 73, 256, 15, 0, 0); + GUI_LOL_MENU_ITEM(_deleteMenu.item[3], 0xfffb, 8, 90, 256, 15, 0, 0); + GUI_LOL_MENU_ITEM(_deleteMenu.item[4], 0x4011, 168, 118, 96, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); + Button::Callback deleteMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedDeleteMenu); + for (int i = 0; i < 5; ++i) + _deleteMenu.item[i].callback = deleteMenuFunctor; + + GUI_LOL_MENU(_gameOptions, 17, 0x400c, 0, 6, -1, -1, -1, -1); + if (_vm->gameFlags().isTalkie) { + GUI_LOL_MENU_ITEM(_gameOptions.item[0], 0xfff7, 120, 22, 80, 15, 0x406e, 0); + GUI_LOL_MENU_ITEM(_gameOptions.item[1], 0xfff6, 120, 39, 80, 15, 0x406c, 0); + GUI_LOL_MENU_ITEM(_gameOptions.item[2], 0xfff5, 120, 56, 80, 15, 0x406d, 0); + GUI_LOL_MENU_ITEM(_gameOptions.item[3], 0xfff4, 120, 73, 80, 15, 0x42d5, 0); + GUI_LOL_MENU_ITEM(_gameOptions.item[4], 0xfff3, 120, 90, 80, 15, 0x42d2, 0); + GUI_LOL_MENU_ITEM(_gameOptions.item[5], 0x4072, 104, 110, 96, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); + } else { + GUI_LOL_MENU_ITEM(_gameOptions.item[0], 0xfff9, 120, 22, 80, 15, 0x406a, 0); + GUI_LOL_MENU_ITEM(_gameOptions.item[1], 0xfff8, 120, 39, 80, 15, 0x406b, 0); + GUI_LOL_MENU_ITEM(_gameOptions.item[2], 0xfff7, 120, 56, 80, 15, 0x406e, 0); + GUI_LOL_MENU_ITEM(_gameOptions.item[3], 0xfff6, 120, 73, 80, 15, 0x406c, 0); + GUI_LOL_MENU_ITEM(_gameOptions.item[4], 0xfff5, 120, 90, 80, 15, 0x406d, 0); + GUI_LOL_MENU_ITEM(_gameOptions.item[5], 0x4072, 104, 110, 96, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); + } + Button::Callback optionsMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedOptionsMenu); + for (int i = 0; i < _gameOptions.numberOfItems; ++i) + _gameOptions.item[i].callback = optionsMenuFunctor; + + GUI_LOL_MENU(_audioOptions, 18, 0x42d9, 2, 1, -1, -1, -1, -1); + GUI_LOL_MENU_ITEM(_audioOptions.item[0], 0x4072, 152, 76, 96, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); + GUI_LOL_MENU_ITEM(_audioOptions.item[1], 3, 128, 22, 114, 14, 0x42db, 0); + GUI_LOL_MENU_ITEM(_audioOptions.item[2], 4, 128, 39, 114, 14, 0x42da, 0); + GUI_LOL_MENU_ITEM(_audioOptions.item[3], 5, 128, 56, 114, 14, 0x42dc, 0); + Button::Callback audioMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedAudioMenu); + for (int i = 0; i < 4; ++i) + _audioOptions.item[i].callback = audioMenuFunctor; + + GUI_LOL_MENU(_deathMenu, 11, 0x4013, 0, 2, -1, -1, -1, -1); + GUI_LOL_MENU_ITEM(_deathMenu.item[0], 0x4006, 8, 30, 104, 15, 0, 0); + GUI_LOL_MENU_ITEM(_deathMenu.item[1], 0x4001, 176, 30, 104, 15, 0, 0); + Button::Callback deathMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedDeathMenu); + for (int i = 0; i < 2; ++i) + _deathMenu.item[i].callback = deathMenuFunctor; + + GUI_LOL_MENU(_savenameMenu, 7, 0x4053, 0, 2, -1, -1, -1, -1); + GUI_LOL_MENU_ITEM(_savenameMenu.item[0], 0x4012, 8, 38, 72, 15, 0, _vm->_keyMap[Common::KEYCODE_RETURN]); + GUI_LOL_MENU_ITEM(_savenameMenu.item[1], 0x4011, 176, 38, 72, 15, 0, _vm->_keyMap[Common::KEYCODE_ESCAPE]); + Button::Callback savenameMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedSavenameMenu); + for (int i = 0; i < 2; ++i) + _savenameMenu.item[i].callback = savenameMenuFunctor; + + GUI_LOL_MENU(_choiceMenu, 11, 0, 0, 2, -1, -1, -1, -1); + GUI_LOL_MENU_ITEM(_choiceMenu.item[0], 0x4007, 8, 30, 72, 15, 0, 0); + GUI_LOL_MENU_ITEM(_choiceMenu.item[1], 0x4008, 208, 30, 72, 15, 0, 0); + Button::Callback choiceMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedChoiceMenu); + for (int i = 0; i < 2; ++i) + _choiceMenu.item[i].callback = choiceMenuFunctor; +} + +const ScreenDim Screen_LoL::_screenDimTable256C[] = { + { 0x00, 0x00, 0x28, 0xC8, 0xC7, 0xCF, 0x00, 0x00 }, // Taken from Intro + { 0x08, 0x48, 0x18, 0x38, 0xFE, 0x01, 0x00, 0x00 }, + { 0x0E, 0x00, 0x16, 0x78, 0xFE, 0x01, 0x00, 0x00 }, + { 0x0B, 0x7B, 0x1C, 0x12, 0xFE, 0xFC, 0x00, 0x00 }, + { 0x0B, 0x7B, 0x1C, 0x2D, 0xFE, 0xFC, 0x00, 0x00 }, + { 0x55, 0x7B, 0xE9, 0x37, 0xFE, 0xFC, 0x00, 0x00 }, + { 0x0B, 0x8C, 0x10, 0x2B, 0x3D, 0x01, 0x00, 0x00 }, // Main menu box (4 entries) + { 0x04, 0x59, 0x20, 0x3C, 0x00, 0x00, 0x00, 0x00 }, + { 0x05, 0x6E, 0x1E, 0x0C, 0xFE, 0x01, 0x00, 0x00 }, + { 0x07, 0x19, 0x1A, 0x97, 0x00, 0x00, 0x00, 0x00 }, // Ingame main menu box CD version + { 0x03, 0x1E, 0x22, 0x8C, 0x00, 0x00, 0x00, 0x00 }, + { 0x02, 0x48, 0x24, 0x34, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x0E, 0x00, 0x16, 0x78, 0xFE, 0x01, 0x00, 0x00 }, + { 0x0D, 0xA2, 0x18, 0x0C, 0xFE, 0x01, 0x00, 0x00 }, + { 0x0F, 0x06, 0x14, 0x6E, 0x01, 0x00, 0x00, 0x00 }, + { 0x1A, 0xBE, 0x0A, 0x07, 0xFE, 0x01, 0x00, 0x00 }, + { 0x07, 0x21, 0x1A, 0x85, 0x00, 0x00, 0x00, 0x00 }, + { 0x03, 0x32, 0x22, 0x62, 0x00, 0x00, 0x00, 0x00 }, + { 0x0B, 0x8C, 0x10, 0x33, 0x3D, 0x01, 0x00, 0x00 }, // Main menu box (5 entries, CD version only) + { 0x0B, 0x8C, 0x10, 0x23, 0x3D, 0x01, 0x00, 0x00 }, // Main menu box (3 entries, floppy version only) + + { 0x01, 0x20, 0x26, 0x80, 0xDC, 0xFD, 0x00, 0x00 }, // Credits + { 0x09, 0x29, 0x08, 0x2C, 0x00, 0x00, 0x00, 0x00 }, + { 0x19, 0x29, 0x08, 0x2C, 0x00, 0x00, 0x00, 0x00 }, + { 0x01, 0x02, 0x26, 0x14, 0x00, 0x0F, 0x0E, 0x00 }, +}; + +const ScreenDim Screen_LoL::_screenDimTable16C[] = { + { 0x00, 0x00, 0x28, 0xC8, 0x33, 0x44, 0x00, 0x00 }, // Taken from Intro + { 0x08, 0x48, 0x18, 0x38, 0x33, 0x44, 0x00, 0x00 }, + { 0x0E, 0x00, 0x16, 0x78, 0x33, 0x44, 0x00, 0x00 }, + { 0x0B, 0x7B, 0x1C, 0x11, 0x33, 0x11, 0x00, 0x00 }, + { 0x0B, 0x7B, 0x1C, 0x2D, 0x33, 0x11, 0x00, 0x00 }, + { 0x55, 0x7B, 0xE9, 0x37, 0x33, 0x11, 0x00, 0x00 }, + { 0x0B, 0x92, 0x10, 0x2A, 0x33, 0x44, 0x00, 0x00 }, // Main menu box (4 entries) + { 0x04, 0x58, 0x20, 0x3C, 0x00, 0x00, 0x00, 0x00 }, + { 0x05, 0x6C, 0x1E, 0x0D, 0x33, 0x44, 0x00, 0x00 }, + { 0x07, 0x20, 0x1A, 0x86, 0x00, 0x00, 0x00, 0x00 }, + { 0x03, 0x20, 0x22, 0x8C, 0x00, 0x00, 0x00, 0x00 }, + { 0x02, 0x48, 0x24, 0x34, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x0E, 0x00, 0x16, 0x78, 0x33, 0x44, 0x00, 0x00 }, + { 0x0D, 0xA2, 0x18, 0x0C, 0x33, 0x44, 0x00, 0x00 }, + { 0x0F, 0x06, 0x14, 0x6E, 0x44, 0x00, 0x00, 0x00 }, + { 0x1A, 0xBE, 0x0A, 0x07, 0x33, 0x44, 0x00, 0x00 }, + { 0x07, 0x21, 0x1A, 0x85, 0x00, 0x00, 0x00, 0x00 }, + { 0x03, 0x32, 0x22, 0x62, 0x00, 0x00, 0x00, 0x00 }, + { 0x0B, 0x8C, 0x10, 0x33, 0x33, 0x44, 0x00, 0x00 }, // Main menu box (5 entries, not used here) + { 0x0B, 0x8C, 0x10, 0x23, 0x33, 0x44, 0x00, 0x00 }, // Main menu box (3 entries) + + { 0x01, 0x20, 0x26, 0x80, 0xDC, 0xFD, 0x00, 0x00 }, // Credits (TODO: Check this!) + { 0x09, 0x29, 0x08, 0x2C, 0x00, 0x00, 0x00, 0x00 }, + { 0x19, 0x29, 0x08, 0x2C, 0x00, 0x00, 0x00, 0x00 }, + { 0x01, 0x02, 0x26, 0x14, 0x00, 0x0F, 0x0E, 0x00 }, +}; + +const int Screen_LoL::_screenDimTableCount = ARRAYSIZE(Screen_LoL::_screenDimTable256C); + +const char * const LoLEngine::_languageExt[] = { + "ENG", + "FRE", + "GER" +}; + +const LoLEngine::CharacterPrev LoLEngine::_charPreviews[] = { + { "Ak\'shel", 0x060, 0x7F, { 0x0F, 0x08, 0x05 } }, + { "Michael", 0x09A, 0x7F, { 0x06, 0x0A, 0x0F } }, + { "Kieran", 0x0D4, 0x7F, { 0x08, 0x06, 0x08 } }, + { "Conrad", 0x10F, 0x7F, { 0x0A, 0x0C, 0x0A } } +}; + +const uint16 LoLEngine::_charPosXPC98[] = { + 92, 152, 212, 268 +}; + +const uint8 LoLEngine::_charNamesPC98[][11] = { + { 0x83, 0x41, 0x83, 0x4E, 0x83, 0x56, 0x83, 0x46, 0x83, 0x8B, 0x00 }, + { 0x83, 0x7D, 0x83, 0x43, 0x83, 0x50, 0x83, 0x8B, 0x00, 0x00, 0x00 }, + { 0x83, 0x4C, 0x81, 0x5B, 0x83, 0x89, 0x83, 0x93, 0x00, 0x00, 0x00 }, + { 0x83, 0x52, 0x83, 0x93, 0x83, 0x89, 0x83, 0x62, 0x83, 0x68, 0x00 } +}; + +const uint8 LoLEngine::_chargenFrameTableTalkie[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, + 0x05, 0x04, 0x03, 0x02, 0x01, + 0x00, 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0A, 0x0B, 0x0C, 0x0D, + 0x0E, 0x0F, 0x10, 0x11, 0x12 +}; + +const uint8 LoLEngine::_chargenFrameTableFloppy[] = { + 0, 1, 2, 3, 4, 5, 4, 3, 2, + 1, 0, 0, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15 +}; + +const uint16 LoLEngine::_selectionPosTable[] = { + 0x6F, 0x00, 0x8F, 0x00, 0xAF, 0x00, 0xCF, 0x00, + 0xEF, 0x00, 0x6F, 0x20, 0x8F, 0x20, 0xAF, 0x20, + 0xCF, 0x20, 0xEF, 0x20, 0x6F, 0x40, 0x8F, 0x40, + 0xAF, 0x40, 0xCF, 0x40, 0xEF, 0x40, 0x10F, 0x00 +}; + +const uint8 LoLEngine::_selectionChar1IdxTable[] = { + 0, 0, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 0, 0, 5, 5, 5, + 5, 5, 5, 5, 0, 0, 5, 5, + 5, 5, 5 +}; + +const uint8 LoLEngine::_selectionChar2IdxTable[] = { + 1, 1, 6, 6, 1, 1, 6, 6, + 6, 6, 6, 6, 6, 1, 1, 6, + 6, 6, 1, 1, 6, 6, 6, 6, + 6, 6, 6 +}; + +const uint8 LoLEngine::_selectionChar3IdxTable[] = { + 2, 2, 7, 7, 7, 7, 2, 2, + 7, 7, 7, 7, 7, 7, 7, 2, + 2, 7, 7, 7, 7, 2, 2, 7, + 7, 7, 7 +}; + +const uint8 LoLEngine::_selectionChar4IdxTable[] = { + 3, 3, 8, 8, 8, 8, 3, 3, + 8, 8, 3, 3, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 3, 3, 8, + 8, 8, 8 +}; + +const uint8 LoLEngine::_reminderChar1IdxTable[] = { + 4, 4, 4, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 5 +}; + +const uint8 LoLEngine::_reminderChar2IdxTable[] = { + 9, 9, 9, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, + 6 +}; + +const uint8 LoLEngine::_reminderChar3IdxTable[] = { + 0xE, 0xE, 0xE, 0x7, 0x7, 0x7, 0x7, 0x7, + 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, + 0x7 +}; + +const uint8 LoLEngine::_reminderChar4IdxTable[] = { + 0xF, 0xF, 0xF, 0x8, 0x8, 0x8, 0x8, 0x8, + 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, + 0x8 +}; + +const uint8 LoLEngine::_selectionAnimIndexTable[] = { + 0, 5, 1, 6, 2, 7, 3, 8 +}; + +const uint8 LoLEngine::_charInfoFrameTable[] = { + 0x0, 0x7, 0x8, 0x9, 0xA, 0xB, 0xA, 0x9, + 0x8, 0x7, 0x0, 0x0, 0x7, 0x8, 0x9, 0xA, + 0xB, 0xA, 0x9, 0x8, 0x7, 0x0, 0x0, 0x7, + 0x8, 0x9, 0xA, 0xB, 0xA, 0x9, 0x8, 0x7 +}; + +const uint8 LoLEngine::_clock2Timers[] = { + 0x00, 0x10, 0x11, 0x03, 0x04, 0x50, + 0x51, 0x52, 0x08, 0x09, 0x0A +}; + +const uint8 LoLEngine::_numClock2Timers = ARRAYSIZE(LoLEngine::_clock2Timers); + +const int8 LoLEngine::_mapCoords[12][4] = { + { 0, 7, 0, -5 }, { -5, 0, 6, 0 }, { 7, 5, 7, 1 }, + { 5, 6, 4, 6 }, { 0, 7, 0, -1 }, { -3, 0, 6, 0 }, + { 6, 7, 6, -3 }, { -3, 5, 6, 5 }, { 1, 5, 1, 1 }, + { 3, 1, 3, 1 }, { -1, 6, -1, -8 }, { -7, -1, 5, -1 } +}; + +const MistOfDoomAnimData LoLEngine::_mistAnimData[] = { + { 0, 7, 7, 13, 155 }, + { 0, 16, 16, 17, 155 }, + { 0, 24, 24, 24, 174 }, + { 0, 19, 19, 19, 174 }, + { 0, 16, 16, 17, 175 }, +}; + +const char * const LoLEngine::_outroShapeFileTable[] = { + "AMAZON.SHP", "ARCHRSLG.SHP", "AVIANWRM.SHP", "BANDIT.SHP", "BOAR.SHP", "CABAL.SHP", + "GUARD.SHP", "HAG.SHP", "HORNET.SHP", "HURZELL.SHP", "IRONGRZR.SHP", "KNOWLES.SHP", + "LIZARD.SHP", "MANTHA.SHP", "MINOTAUR.SHP", "MORIBUND.SHP", "ORC.SHP", "ORCLDR.SHP", + "PENTROG.SHP", "RATMAN.SHP", "ROCKLING.SHP", "SCAVNGR.SHP", "STARK.SHP", + "SWAMPCIT.SHP", "SWAMPMON.SHP", "THUG.SHP", "VIPER.SHP", "XEOB.SHP" +}; + +const uint8 LoLEngine::_outroFrameTable[] = { + 0, 0, 0, 0, 0, 1, 2, 3, + 0, 1, 2, 3, 8, 9, 10, 11, + 8, 9, 10, 11, 4, 5, 6, 7 +}; + +const int16 LoLEngine::_outroRightMonsterPos[] = { + 205, 55, 205, 55, 205, 55, 205, 55, + 205, 56, 207, 57, 208, 58, 210, 59, + 213, 60, 216, 61, 220, 61, 225, 61, + 230, 61, 235, 61, 240, 61, 240, 61, + 240, 61, 240, 61, 240, 61, 240, 61, + 240, 61, 265, 61, 290, 61, 315, 61 +}; + +const int16 LoLEngine::_outroLeftMonsterPos[] = { + 92, 55, 92, 55, 92, 55, 92, 55, + 92, 56, 90, 57, 85, 58, 77, 59, + 67, 60, 57, 61, 47, 61, 35, 61, + 35, 61, 35, 61, 35, 61, 35, 61, + 35, 61, 35, 61, 35, 61, 35, 61, + 35, 61, 10, 61, -20, 61, -45, 61 +}; + +const int16 LoLEngine::_outroRightDoorPos[] = { + 200, 41, 200, 29, 200, 17, 200, 5, + 200, -7, 200, -7, 200, -7, 200, -7, + 200, 5, 200, 17, 200, 29, 200, 41, + 200, 41, 200, 41, 200, 41, 200, 41, + 200, 41, 200, 41, 200, 41, 200, 41, + 200, 41, 200, 41, 200, 41, 200, 41 +}; + +const int16 LoLEngine::_outroLeftDoorPos[] = { + 72, 41, 72, 29, 72, 17, 72, 5, + 72, -7, 72, -7, 72, -7, 72, -7, + 72, 5, 72, 17, 72, 29, 72, 41, + 72, 41, 72, 41, 72, 41, 72, 41, + 72, 41, 72, 41, 72, 41, 72, 41, + 72, 41, 72, 41, 72, 41, 72, 41 +}; + +const int LoLEngine::_outroMonsterScaleTableX[] = { + 0x050, 0x050, 0x050, 0x050, 0x050, 0x05D, 0x070, 0x085, + 0x0A0, 0x0C0, 0x0E2, 0x100, 0x100, 0x100, 0x100, 0x100, + 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100 +}; + +const int LoLEngine::_outroMonsterScaleTableY[] = { + 0x04C, 0x04C, 0x04C, 0x04C, 0x04C, 0x059, 0x06B, 0x080, + 0x099, 0x0B8, 0x0D9, 0x100, 0x100, 0x100, 0x100, 0x100, + 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100 +}; + +} // End of namespace Kyra + +#endif + diff --git a/engines/kyra/text_lok.cpp b/engines/kyra/text_lok.cpp index 3e45c0f286..79b16bc1be 100644 --- a/engines/kyra/text_lok.cpp +++ b/engines/kyra/text_lok.cpp @@ -137,8 +137,11 @@ void KyraEngine_LoK::endCharacterChat(int8 charNum, int16 convoInitialized) { _charSayUnk3 = -1; if (charNum > 4 && charNum < 11) { - //TODO: weird _game_inventory stuff here - //warning("STUB: endCharacterChat() for high charnums"); + _animator->sprites()[_disabledTalkAnimObject].active = 1; + _sprites->_anims[_disabledTalkAnimObject].play = true; + + _animator->sprites()[_enabledTalkAnimObject].active = 0; + _sprites->_anims[_enabledTalkAnimObject].play = false; } if (convoInitialized != 0) { @@ -225,8 +228,19 @@ int KyraEngine_LoK::initCharacterChat(int8 charNum) { _animator->restoreAllObjectBackgrounds(); if (charNum > 4 && charNum < 11) { - // TODO: Fill in weird _game_inventory stuff here - //warning("STUB: initCharacterChat() for high charnums"); + const uint8 animDisableTable[] = { 3, 1, 1, 5, 0, 6 }; + const uint8 animEnableTable[] = { 4, 2, 5, 6, 1, 7 }; + + _disabledTalkAnimObject = animDisableTable[charNum - 5]; + _enabledTalkAnimObject = animEnableTable[charNum - 5]; + + _animator->sprites()[_disabledTalkAnimObject].active = 0; + _sprites->_anims[_disabledTalkAnimObject].play = false; + + _animator->sprites()[_enabledTalkAnimObject].active = 1; + _sprites->_anims[_enabledTalkAnimObject].play = true; + + _charSayUnk2 = _enabledTalkAnimObject; } _animator->flagAllObjectsForRefresh(); diff --git a/engines/kyra/timer_lok.cpp b/engines/kyra/timer_lok.cpp index 3a7d1ed0de..40426a3dfe 100644 --- a/engines/kyra/timer_lok.cpp +++ b/engines/kyra/timer_lok.cpp @@ -48,33 +48,39 @@ void KyraEngine_LoK::setupTimers() { for (int i = 10; i <= 13; ++i) _timer->addTimer(i, 0, 420, 1); - _timer->addTimer(14, TimerV1(timerCheckAnimFlag2), 600, 1); + _timer->addTimer(14, TimerV1(timerAsWillowispTimeout), 600, 1); _timer->addTimer(15, TimerV1(timerUpdateHeadAnims), 11, 1); - _timer->addTimer(16, TimerV1(timerSetFlags1), 7200, 1); - _timer->addTimer(17, 0 /*sub_15120*/, 7200, 1); - _timer->addTimer(18, TimerV1(timerCheckAnimFlag1), 600, 1); + _timer->addTimer(16, TimerV1(timerTulipCreator), 7200, 1); + _timer->addTimer(17, TimerV1(timerRubyCreator), 7200, 1); + _timer->addTimer(18, TimerV1(timerAsInvisibleTimeout), 600, 1); _timer->addTimer(19, TimerV1(timerRedrawAmulet), 600, 1); _timer->addTimer(20, 0, 7200, 1); - _timer->addTimer(21, 0/*sub_1517C*/, 18000, 1); + _timer->addTimer(21, TimerV1(timerLavenderRoseCreator), 18000, 1); _timer->addTimer(22, 0, 7200, 1); - for (int i = 23; i <= 27; ++i) - _timer->addTimer(i, 0, 10800, 1); + _timer->addTimer(23, 0, 10800, 1); + _timer->addTimer(24, TimerV1(timerAcornCreator), 10800, 1); + _timer->addTimer(25, 0, 10800, 1); + _timer->addTimer(26, TimerV1(timerBlueberryCreator), 10800, 1); + _timer->addTimer(27, 0, 10800, 1); _timer->addTimer(28, 0, 21600, 1); _timer->addTimer(29, 0, 7200, 1); _timer->addTimer(30, 0, 10800, 1); _timer->addTimer(31, TimerV1(timerFadeText), -1, 1); - _timer->addTimer(32, TimerV1(updateAnimFlag1), 9, 1); - _timer->addTimer(33, TimerV1(updateAnimFlag2), 3, 1); + _timer->addTimer(32, TimerV1(timerWillowispFrameTimer), 9, 1); + _timer->addTimer(33, TimerV1(timerInvisibleFrameTimer), 3, 1); } void KyraEngine_LoK::timerUpdateHeadAnims(int timerNum) { static int8 currentFrame = 0; - static const int8 frameTable[] = {4, 5, 4, 5, 4, 5, 0, 1, 4, 5, - 4, 4, 6, 4, 8, 1, 9, 4, -1}; + static const int8 frameTable[] = { + 4, 5, 4, 5, 4, 5, 0, 1, + 4, 5, 4, 4, 6, 4, 8, 1, + 9, 4, -1 + }; if (_talkingCharNum < 0) return; @@ -89,19 +95,51 @@ void KyraEngine_LoK::timerUpdateHeadAnims(int timerNum) { _animator->animRefreshNPC(_talkingCharNum); } -void KyraEngine_LoK::timerSetFlags1(int timerNum) { +void KyraEngine_LoK::timerTulipCreator(int timerNum) { if (_currentCharacter->sceneId == 0x1C) return; - int rndNr = _rnd.getRandomNumberRng(0, 3); + setItemCreationFlags(17, 3); +} + +void KyraEngine_LoK::timerRubyCreator(int timerNum) { + if (_currentCharacter->sceneId == 0x23) + return; + + setItemCreationFlags(22, 4); +} + +void KyraEngine_LoK::timerLavenderRoseCreator(int timerNum) { + if (_currentCharacter->sceneId == 0x06) + return; + + setItemCreationFlags(0, 4); +} - for (int i = 0; i < 4; i++) { - if (!queryGameFlag(rndNr + 17)) { - setGameFlag(rndNr + 17); +void KyraEngine_LoK::timerAcornCreator(int timerNum) { + if (_currentCharacter->sceneId == 0x1F) + return; + + setItemCreationFlags(72, 5); +} + +void KyraEngine_LoK::timerBlueberryCreator(int timerNum) { + if (_currentCharacter->sceneId == 0x28) + return; + + setItemCreationFlags(26, 7); +} + +void KyraEngine_LoK::setItemCreationFlags(int offset, int count) { + int rndNr = _rnd.getRandomNumberRng(0, count); + + for (int i = 0; i <= count; i++) { + if (!queryGameFlag(rndNr + offset)) { + setGameFlag(rndNr + offset); break; } else { rndNr++; - if (rndNr > 3) + if (rndNr > count) rndNr = 0; } } @@ -111,16 +149,14 @@ void KyraEngine_LoK::timerFadeText(int timerNum) { _fadeText = true; } -void KyraEngine_LoK::updateAnimFlag1(int timerNum) { - if (_brandonStatusBit & 2) { +void KyraEngine_LoK::timerWillowispFrameTimer(int timerNum) { + if (_brandonStatusBit & 2) _brandonStatusBit0x02Flag = 1; - } } -void KyraEngine_LoK::updateAnimFlag2(int timerNum) { - if (_brandonStatusBit & 0x20) { +void KyraEngine_LoK::timerInvisibleFrameTimer(int timerNum) { + if (_brandonStatusBit & 0x20) _brandonStatusBit0x20Flag = 1; - } } void KyraEngine_LoK::setTextFadeTimerCountdown(int16 countdown) { @@ -130,19 +166,14 @@ void KyraEngine_LoK::setTextFadeTimerCountdown(int16 countdown) { _timer->setCountdown(31, countdown*60); } -void KyraEngine_LoK::timerSetFlags2(int timerNum) { - if (!((uint32 *)(_flagsTable+0x2D))[timerNum]) - ((uint32 *)(_flagsTable+0x2D))[timerNum] = 1; -} - -void KyraEngine_LoK::timerCheckAnimFlag1(int timerNum) { +void KyraEngine_LoK::timerAsInvisibleTimeout(int timerNum) { if (_brandonStatusBit & 0x20) { checkAmuletAnimFlags(); _timer->setCountdown(18, -1); } } -void KyraEngine_LoK::timerCheckAnimFlag2(int timerNum) { +void KyraEngine_LoK::timerAsWillowispTimeout(int timerNum) { if (_brandonStatusBit & 0x2) { checkAmuletAnimFlags(); _timer->setCountdown(14, -1); diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp index 8a598591bb..d0e54f996b 100644 --- a/engines/kyra/vqa.cpp +++ b/engines/kyra/vqa.cpp @@ -260,8 +260,8 @@ bool VQAMovie::open(const char *filename) { _header.bits = 8; } - setX((Screen::SCREEN_W - _header.width) / 2); - setY((Screen::SCREEN_H - _header.height) / 2); + _x = (Screen::SCREEN_W - _header.width) / 2; + _y = (Screen::SCREEN_H - _header.height) / 2; _frameInfo = new uint32[_header.numFrames]; _frame = new byte[_header.width * _header.height]; diff --git a/engines/kyra/vqa.h b/engines/kyra/vqa.h index c1448a4865..129d526e98 100644 --- a/engines/kyra/vqa.h +++ b/engines/kyra/vqa.h @@ -56,9 +56,6 @@ public: // It's unlikely that we ever want to change the movie position from // its default. - void setX(int x) { _x = x; } - void setY(int y) { _y = y; } - void setDrawPage(int page) { _drawPage = page; } bool open(const char *filename); |