diff options
author | athrxx | 2011-08-03 00:40:21 +0200 |
---|---|---|
committer | Johannes Schickel | 2011-12-26 16:18:13 +0100 |
commit | aab9e62247af1c22772bb79821675fbab06c047d (patch) | |
tree | 2dd15c76b96c3df0778a68c4b546f57797f1cd64 /engines | |
parent | 48f83b7bb48a1625f6c195e396f8d40047f50915 (diff) | |
download | scummvm-rg350-aab9e62247af1c22772bb79821675fbab06c047d.tar.gz scummvm-rg350-aab9e62247af1c22772bb79821675fbab06c047d.tar.bz2 scummvm-rg350-aab9e62247af1c22772bb79821675fbab06c047d.zip |
KYRA: (EOB) - some more sequence code and bug fixes
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/eobcommon.cpp | 36 | ||||
-rw-r--r-- | engines/kyra/eobcommon.h | 18 | ||||
-rw-r--r-- | engines/kyra/gui_eob.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/items_eob.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/magic_eob.cpp | 3 | ||||
-rw-r--r-- | engines/kyra/resource.h | 5 | ||||
-rw-r--r-- | engines/kyra/script_eob.cpp | 5 | ||||
-rw-r--r-- | engines/kyra/sprites_eob.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/staticres_eob.cpp | 10 |
9 files changed, 77 insertions, 20 deletions
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp index eef3873285..f323dd4e17 100644 --- a/engines/kyra/eobcommon.cpp +++ b/engines/kyra/eobcommon.cpp @@ -1500,6 +1500,40 @@ int EobCoreEngine::countResurrectionCandidates() { return _rrCount; } +void EobCoreEngine::seq_portal() { + //_portalSeq +} + +bool EobCoreEngine::checkPassword() { + char answ[20]; + Screen::FontId of = _screen->setFont(Screen::FID_8_FNT); + _screen->copyPage(0, 10); + + _screen->setScreenDim(13); + gui_drawBox(_screen->_curDim->sx << 3, _screen->_curDim->sy, _screen->_curDim->w << 3, _screen->_curDim->h, _color1_1, _color2_1, -1); + gui_drawBox((_screen->_curDim->sx << 3) + 1, _screen->_curDim->sy + 1, (_screen->_curDim->w << 3) - 2, _screen->_curDim->h - 2, _color1_1, _color2_1, _bkgColor_1); + _screen->modifyScreenDim(13, _screen->_curDim->sx + 1, _screen->_curDim->sy + 2, _screen->_curDim->w - 2, _screen->_curDim->h - 16); + + for (int i = 0; i < 3; i++) { + _screen->fillRect(_screen->_curDim->sx << 3, _screen->_curDim->sy, ((_screen->_curDim->sx + _screen->_curDim->w) << 3) - 1, (_screen->_curDim->sy + _screen->_curDim->h) - 1, _bkgColor_1); + int c = rollDice(1, _mnNumWord - 1, -1); + _screen->drawShape(0, _largeItemShapes[_mnDef[c << 2]], 100, 2, 13); + _screen->printShadedText(Common::String::format(_mnPrompt[0], _mnDef[(c << 2) + 1], _mnDef[(c << 2) + 2]).c_str(), (_screen->_curDim->sx + 1) << 3, _screen->_curDim->sy, _screen->_curDim->unk8, _bkgColor_1); + memset(answ, 0, 20); + gui_drawBox(76, 100, 133, 14, _color2_1, _color1_1, -1); + gui_drawBox(77, 101, 131, 12, _color2_1, _color1_1, -1); + if (_gui->getTextInput(answ, 10, 103, 15, _screen->_curDim->unk8, _bkgColor_1, 8) < 0) + i = 3; + if (scumm_stricmp(_mnWord[c], answ) && i == 2) + return false; + } + + _screen->modifyScreenDim(13, _screen->_curDim->sx - 1, _screen->_curDim->sy - 2, _screen->_curDim->w + 2, _screen->_curDim->h + 16); + _screen->setFont(of); + _screen->copyPage(10, 0); + return true; +} + void EobCoreEngine::useSlotWeapon(int charIndex, int slotIndex, Item item) { EobCharacter *c = &_characters[charIndex]; int tp = item ? _items[item].type : 0; @@ -2110,7 +2144,7 @@ void EobCoreEngine::explodeMonster(EobMonsterInPlay *m) { } void EobCoreEngine::snd_playSoundEffect(int id, int volume) { - if (id < 1 || id > 119 || shouldQuit()) + if ((id < 1) || (_flags.gameID == GI_EOB2 && id > 119) || shouldQuit()) return; _sound->playSoundEffect(id, volume); diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h index 1c730f7687..7ebc883f3e 100644 --- a/engines/kyra/eobcommon.h +++ b/engines/kyra/eobcommon.h @@ -174,15 +174,15 @@ struct EobMonsterProperty { int32 experience; uint8 u30; - uint8 sound1; - uint8 sound2; + int8 sound1; + int8 sound2; uint8 numRemoteAttacks; uint8 remoteWeaponChangeMode; uint8 numRemoteWeapons; int8 remoteWeapons[5]; - uint8 tuResist; + int8 tuResist; uint8 dmgModifierEvade; uint8 decorations[3]; @@ -623,6 +623,7 @@ protected: const uint8 *_wllFlagPreset; int _wllFlagPresetSize; const uint8 *_teleporterShapeCoords; + const uint8 *_portalSeq; // Script void runLevelScript(int block, int flags); @@ -807,12 +808,16 @@ protected: // misc void delay(uint32 millis, bool doUpdate = false, bool isMainLoop = false); + void displayParchment(int id); int countResurrectionCandidates(); + + void seq_portal(); + bool checkPassword(); + virtual int resurrectionSelectDialogue() = 0; virtual void useHorn(int charIndex, int weaponSlot) {} virtual bool checkPartyStatusExtra() = 0; - virtual void drawLightningColumn() {} virtual int charSelectDialogue() { return -1; } virtual void characterLevelGain(int charIndex) {} @@ -826,6 +831,11 @@ protected: const char * const *_saveLoadStrings; + const uint8 *_mnDef; + const char * const *_mnWord; + const char * const *_mnPrompt; + int _mnNumWord; + int _rrCount; const char *_rrNames[10]; int8 _rrId[10]; diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp index c495eb541f..9dec1584c5 100644 --- a/engines/kyra/gui_eob.cpp +++ b/engines/kyra/gui_eob.cpp @@ -2509,7 +2509,7 @@ int GUI_Eob::getTextInput(char *dest, int x, int y, int destMaxLen, int textColo in = 0; _keyPressed.reset(); - while (!in) { + while (!in && !_vm->shouldQuit()) { if (next <= _vm->_system->getMillis()) { if (cursorState) { _screen->copyRegion((pos + 1) << 3, 191, (x + pos) << 3, y, 8, 9, 2, 0, Screen::CR_NO_P_CHECK); @@ -2595,7 +2595,7 @@ int GUI_Eob::getTextInput(char *dest, int x, int y, int destMaxLen, int textColo _screen->printShadedText(sufx, (x + pos) << 3, y, textColor1, textColor2); _screen->updateScreen(); - } while (_keyPressed.keycode != Common::KEYCODE_RETURN && _keyPressed.keycode != Common::KEYCODE_ESCAPE); + } while (_keyPressed.keycode != Common::KEYCODE_RETURN && _keyPressed.keycode != Common::KEYCODE_ESCAPE && !_vm->shouldQuit()); return _keyPressed.keycode == Common::KEYCODE_ESCAPE ? -1 : len; } @@ -3194,8 +3194,10 @@ bool GUI_Eob::restParty() { continue; if (_vm->checkInventoryForItem(i, 30, -1) == -1) continue; - if (_vm->restParty_checkHealSpells(i)) + if (_vm->restParty_checkHealSpells(i)) { useHealers = confirmDialogue(40); + break; + } } } diff --git a/engines/kyra/items_eob.cpp b/engines/kyra/items_eob.cpp index 78d3f8b8aa..b48c3934c8 100644 --- a/engines/kyra/items_eob.cpp +++ b/engines/kyra/items_eob.cpp @@ -176,7 +176,9 @@ int EobCoreEngine::deleteInventoryItem(int charIndex, int slot) { void EobCoreEngine::deleteBlockItem(uint16 block, int type) { uint16 itm = _levelBlockProperties[block].drawObjects; if (!itm) - return; + return; + + _levelBlockProperties[block].drawObjects = 0; for (uint16 i2 = itm, i = 0; itm != i2 || !i; i++ ) { if (type == _items[itm].type || type == -1) { diff --git a/engines/kyra/magic_eob.cpp b/engines/kyra/magic_eob.cpp index 70e4892342..3eb7591413 100644 --- a/engines/kyra/magic_eob.cpp +++ b/engines/kyra/magic_eob.cpp @@ -75,7 +75,7 @@ void EobCoreEngine::useMagicScroll(int charIndex, int type, int weaponSlot) { } void EobCoreEngine::usePotion(int charIndex, int weaponSlot) { - EobCharacter *c = &_characters[_openBookChar]; + EobCharacter *c = &_characters[charIndex]; int val = deleteInventoryItem(charIndex, weaponSlot); snd_playSoundEffect(10); @@ -607,6 +607,7 @@ bool EobCoreEngine::magicObjectStatusHit(EobMonsterInPlay *m, int type, bool try } bool EobCoreEngine::turnUndeadHit(EobMonsterInPlay *m, int hitChance, int casterLevel) { + assert(_monsterProps[m->type].tuResist > 0); uint8 e = _turnUndeadEffect[_monsterProps[m->type].tuResist * 14 + MIN(casterLevel, 14)]; if (e == 0xff) { diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h index 55946e5b7f..0f1539b610 100644 --- a/engines/kyra/resource.h +++ b/engines/kyra/resource.h @@ -435,6 +435,11 @@ enum KyraResources { kEobBaseDscTelptrShpCoords, + kEobBasePortalSeqData, + kEobBaseManDef, + kEobBaseManWord, + kEobBaseManPrompt, + kEobBaseBookNumbers, kEobBaseMageSpellsList, kEobBaseClericSpellsList, diff --git a/engines/kyra/script_eob.cpp b/engines/kyra/script_eob.cpp index 1e113fb2ae..715970074a 100644 --- a/engines/kyra/script_eob.cpp +++ b/engines/kyra/script_eob.cpp @@ -1416,12 +1416,11 @@ int EobInfProcessor::oeob_sequence(int8 *data) { return 0; case -2: - // portal sequence - error("EobInfProcessor::oeob_sequence(): unimplemented cmd -2"); + _vm->seq_portal(); break; case -1: - // copy protection + _vm->_runFlag = _vm->checkPassword(); break; default: diff --git a/engines/kyra/sprites_eob.cpp b/engines/kyra/sprites_eob.cpp index 97ee51bd22..3447b6bc7f 100644 --- a/engines/kyra/sprites_eob.cpp +++ b/engines/kyra/sprites_eob.cpp @@ -107,8 +107,8 @@ const uint8 *EobCoreEngine::loadMonsterProperties(const uint8 *data) { data += 2; d->u30 = *data++; - d->sound1 = *data++; - d->sound2 = *data++; + d->sound1 = (int8)*data++; + d->sound2 = (int8)*data++; d->numRemoteAttacks = *data++; if (*data++ != 0xff) { @@ -121,7 +121,7 @@ const uint8 *EobCoreEngine::loadMonsterProperties(const uint8 *data) { } } - d->tuResist = *data++; + d->tuResist = (int8)*data++; d->dmgModifierEvade = *data++; for (int i = 0; i < 3; i++) @@ -1181,7 +1181,7 @@ bool EobCoreEngine::walkMonsterNextStep(EobMonsterInPlay *m, int destBlock, int m->dir = direction; checkSceneUpdateNeed(obl); - if (!_partyResting && p->sound2) + if (!_partyResting && p->sound2 > 0) snd_processEnvironmentalSoundEffect(p->sound2, m->block); return true; diff --git a/engines/kyra/staticres_eob.cpp b/engines/kyra/staticres_eob.cpp index ea943f32d4..9b15d4aea8 100644 --- a/engines/kyra/staticres_eob.cpp +++ b/engines/kyra/staticres_eob.cpp @@ -448,6 +448,10 @@ void EobCoreEngine::initStaticResource() { _npcPreset = _staticres->loadEobNpcData(kEobBaseNpcPresets, temp); _teleporterShapeCoords = _staticres->loadRawData(kEobBaseDscTelptrShpCoords, temp); + _portalSeq = _staticres->loadRawData(kEobBasePortalSeqData, temp); + _mnDef = _staticres->loadRawData(kEobBaseManDef, temp); + _mnWord = _staticres->loadStrings(kEobBaseManWord, _mnNumWord); + _mnPrompt = _staticres->loadStrings(kEobBaseManPrompt, temp); _monsterStepTable0 = (int8*) _staticres->loadRawData(_flags.gameID == GI_EOB2 ? kEobBaseMonsterStepTable02 : kEobBaseMonsterStepTable01, temp); _monsterStepTable1 = (int8*)_staticres->loadRawData(kEobBaseMonsterStepTable1, temp); @@ -1114,10 +1118,10 @@ void EobEngine::initStaticResource() { p->experience = READ_LE_UINT16(ps); ps += 2; p->u30 = *ps++; - p->sound1 = *ps++; - p->sound2 = *ps++; + p->sound1 = (int8)*ps++; + p->sound2 = (int8)*ps++; p->numRemoteAttacks = *ps++; - p->tuResist = *ps++; + p->tuResist = (int8)*ps++; p->dmgModifierEvade = *ps++; } } |