diff --git a/devtools/create_kyradat/create_kyradat.cpp b/devtools/create_kyradat/create_kyradat.cpp index a8531dd470c..069118bdabe 100644 --- a/devtools/create_kyradat/create_kyradat.cpp +++ b/devtools/create_kyradat/create_kyradat.cpp @@ -571,6 +571,11 @@ const ExtractFilename extractFilenames[] = { { kEob2DranFoolsStrings, kTypeStringList, true }, { kEob2HornStrings, kTypeStringList, true }, { kEob2HornSounds, kTypeRawData, false }, + { kEob2WallOfForceDsX, kLolTypeRaw16, false }, + { kEob2WallOfForceDsY, kTypeRawData, false }, + { kEob2WallOfForceNumW, kTypeRawData, false }, + { kEob2WallOfForceNumH, kTypeRawData, false }, + { kEob2WallOfForceShpId, kTypeRawData, false }, // LANDS OF LORE @@ -1986,6 +1991,16 @@ const char *getIdString(const int id) { return "kEob2HornStrings"; case kEob2HornSounds: return "kEob2HornSounds"; + case kEob2WallOfForceDsX: + return "kEob2WallOfForceDsX"; + case kEob2WallOfForceDsY: + return "kEob2WallOfForceDsY"; + case kEob2WallOfForceNumW: + return "kEob2WallOfForceNumW"; + case kEob2WallOfForceNumH: + return "kEob2WallOfForceNumH"; + case kEob2WallOfForceShpId: + return "kEob2WallOfForceShpId"; case kLolIngamePakFiles: return "kLolIngamePakFiles"; case kLolCharacterDefs: diff --git a/devtools/create_kyradat/create_kyradat.h b/devtools/create_kyradat/create_kyradat.h index 44fa93a1746..c7a29fb99a3 100644 --- a/devtools/create_kyradat/create_kyradat.h +++ b/devtools/create_kyradat/create_kyradat.h @@ -553,6 +553,12 @@ enum kExtractID { kEob2HornStrings, kEob2HornSounds, + kEob2WallOfForceDsX, + kEob2WallOfForceDsY, + kEob2WallOfForceNumW, + kEob2WallOfForceNumH, + kEob2WallOfForceShpId, + kLolIngamePakFiles, kLolCharacterDefs, kLolIngameSfxFiles, diff --git a/devtools/create_kyradat/games.cpp b/devtools/create_kyradat/games.cpp index 9ecbf0144c3..d5b5c29aa99 100644 --- a/devtools/create_kyradat/games.cpp +++ b/devtools/create_kyradat/games.cpp @@ -1595,6 +1595,11 @@ const int eob2FloppyNeed[] = { kEob2DranFoolsStrings, kEob2HornStrings, kEob2HornSounds, + kEob2WallOfForceDsX, + kEob2WallOfForceDsY, + kEob2WallOfForceNumW, + kEob2WallOfForceNumH, + kEob2WallOfForceShpId, kLolEobCommonDscShapeIndex, kLolEobCommonDscX, diff --git a/devtools/create_kyradat/tables.cpp b/devtools/create_kyradat/tables.cpp index ab75baf91ca..0b249247d8e 100644 --- a/devtools/create_kyradat/tables.cpp +++ b/devtools/create_kyradat/tables.cpp @@ -3195,6 +3195,32 @@ const ExtractEntrySearchData kEob2HornSoundsProvider[] = { EXTRACT_END_ENTRY }; +const ExtractEntrySearchData kEob2WallOfForceDsXProvider[] = { + { UNK_LANG, kPlatformPC, { 0x00000024, 0x00000D67, { { 0x51, 0xCF, 0xAB, 0x1E, 0xB4, 0xE0, 0xE3, 0x44, 0x29, 0xD1, 0xDC, 0x82, 0xCD, 0x08, 0x50, 0xF5 } } } }, + + EXTRACT_END_ENTRY +}; + +const ExtractEntrySearchData kEob2WallOfForceDsYProvider[] = { + { UNK_LANG, kPlatformPC, { 0x00000003, 0x00000048, { { 0x45, 0xFC, 0xEA, 0x8C, 0x34, 0xD7, 0xBE, 0x74, 0x05, 0x03, 0xE6, 0x94, 0x34, 0xB5, 0x45, 0x4D } } } }, + EXTRACT_END_ENTRY +}; + +const ExtractEntrySearchData kEob2WallOfForceNumWProvider[] = { + { UNK_LANG, kPlatformPC, { 0x00000003, 0x00000006, { { 0x52, 0x89, 0xDF, 0x73, 0x7D, 0xF5, 0x73, 0x26, 0xFC, 0xDD, 0x22, 0x59, 0x7A, 0xFB, 0x1F, 0xAC } } } }, + EXTRACT_END_ENTRY +}; + +const ExtractEntrySearchData kEob2WallOfForceNumHProvider[] = { + { UNK_LANG, kPlatformPC, { 0x00000003, 0x00000011, { { 0x33, 0x86, 0x06, 0xBE, 0x8D, 0xC8, 0x37, 0x2D, 0x0F, 0x61, 0x97, 0xA4, 0x26, 0xA9, 0xBC, 0x60 } } } }, + EXTRACT_END_ENTRY +}; + +const ExtractEntrySearchData kEob2WallOfForceShpIdProvider[] = { + { UNK_LANG, kPlatformPC, { 0x00000003, 0x00000006, { { 0x77, 0xAE, 0x9B, 0x52, 0x9E, 0xF7, 0xEB, 0x48, 0xA8, 0x5E, 0xED, 0xC2, 0x08, 0x53, 0xCE, 0x3C } } } }, + EXTRACT_END_ENTRY +}; + const ExtractEntrySearchData kLolIngamePakFilesProvider[] = { { UNK_LANG, kPlatformPC, { 0x00000088, 0x0000224F, { { 0xDA, 0x24, 0x18, 0xA3, 0xEF, 0x16, 0x70, 0x8F, 0xA8, 0xC2, 0x2E, 0xC2, 0xED, 0x39, 0x03, 0xD1 } } } }, { UNK_LANG, kPlatformPC98, { 0x00000084, 0x00002125, { { 0x7A, 0x89, 0xE2, 0x36, 0xEC, 0x6F, 0x52, 0x2B, 0xEF, 0xBA, 0x3D, 0x28, 0x54, 0xDA, 0xFB, 0x72 } } } }, @@ -4162,6 +4188,11 @@ const ExtractEntry extractProviders[] = { { kEob2DranFoolsStrings, kEob2DranFoolsStringsProvider }, { kEob2HornStrings, kEob2HornStringsProvider }, { kEob2HornSounds, kEob2HornSoundsProvider }, + { kEob2WallOfForceDsX, kEob2WallOfForceDsXProvider }, + { kEob2WallOfForceDsY, kEob2WallOfForceDsYProvider }, + { kEob2WallOfForceNumW, kEob2WallOfForceNumWProvider }, + { kEob2WallOfForceNumH, kEob2WallOfForceNumHProvider }, + { kEob2WallOfForceShpId, kEob2WallOfForceShpIdProvider }, { kLolIngamePakFiles, kLolIngamePakFilesProvider }, { kLolCharacterDefs, kLolCharacterDefsProvider }, diff --git a/dists/engine-data/kyra.dat b/dists/engine-data/kyra.dat index aa3d62b84d0..35aff97dde9 100644 Binary files a/dists/engine-data/kyra.dat and b/dists/engine-data/kyra.dat differ diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp index dc987c15332..c94cb16703c 100644 --- a/engines/kyra/eobcommon.cpp +++ b/engines/kyra/eobcommon.cpp @@ -141,6 +141,8 @@ EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBa _restPartyElapsedTime = 0; _allowSkip = false; + _wallsOfForce = 0; + _rrCount = 0; memset(_rrNames, 0, 10 * sizeof(const char*)); memset(_rrId, 0, 10 * sizeof(int8)); @@ -205,6 +207,7 @@ EobCoreEngine::~EobCoreEngine() { delete[] _spells; delete[] _spellAnimBuffer; + delete[] _wallsOfForce; delete _gui; _gui = 0; @@ -318,6 +321,9 @@ Common::Error EobCoreEngine::init() { _spellAnimBuffer = new uint8[4096]; memset(_spellAnimBuffer, 0, 4096); + _wallsOfForce = new WallOfForce[5]; + memset(_wallsOfForce, 0, 5 * sizeof(WallOfForce)); + memset(_doorType, 0, sizeof(_doorType)); memset(_noDoorSwitch, 0, sizeof(_noDoorSwitch)); @@ -349,7 +355,6 @@ Common::Error EobCoreEngine::go() { loadItemsAndDecorationsShapes(); _screen->setMouseCursor(0, 0, _itemIconShapes[0]); - _screen->showMouse(); loadItemDefs(); int action = 0; @@ -363,6 +368,7 @@ Common::Error EobCoreEngine::go() { startupLoad(); _gameToLoad = -1; } else { + _screen->showMouse(); action = mainMenu(); } @@ -453,6 +459,7 @@ void EobCoreEngine::runLoop() { _timer->update(); updateScriptTimers(); + updateWallOfForceTimers(); if (_sceneUpdateRequired) drawScene(1); diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h index 51dfb8b726d..ffc951e80da 100644 --- a/engines/kyra/eobcommon.h +++ b/engines/kyra/eobcommon.h @@ -561,6 +561,12 @@ protected: const uint16 *_encodeMonsterShpTable; const uint8 _teleporterWallId; + const int16 *_wallOfForceDsX; + const uint8 *_wallOfForceDsY; + const uint8 *_wallOfForceDsNumW; + const uint8 *_wallOfForceDsNumH; + const uint8 *_wallOfForceShpId; + const int8 *_monsterDirChangeTable; // Level @@ -833,6 +839,9 @@ protected: void *generateMonsterTempData(LevelTempData *tmp); void restoreMonsterTempData(LevelTempData *tmp); void releaseMonsterTempData(LevelTempData *tmp); + void *generateWallOfForceTempData(LevelTempData *tmp); + void restoreWallOfForceTempData(LevelTempData *tmp); + void releaseWallOfForceTempData(LevelTempData *tmp); const char * const *_saveLoadStrings; @@ -920,6 +929,9 @@ protected: Item createMagicWeaponItem(int flags, int icon, int value, int type); void removeMagicWeaponItem(Item item); + void updateWallOfForceTimers(); + void destroyWallOfForce(int index); + int findSingleSpellTarget(int dist); int findFirstCharacterSpellTarget(); @@ -1031,6 +1043,13 @@ protected: EobSpell *_spells; int _numSpells; + struct WallOfForce { + uint16 block; + uint32 duration; + }; + + WallOfForce *_wallsOfForce; + const char *const *_bookNumbers; const char *const *_mageSpellList; int _mageSpellListSize; diff --git a/engines/kyra/loleobbase.h b/engines/kyra/loleobbase.h index ba59fe796b0..02b236d44fd 100644 --- a/engines/kyra/loleobbase.h +++ b/engines/kyra/loleobbase.h @@ -60,6 +60,7 @@ struct LevelTempData { uint16 *flags; void *monsters; void *flyingObjects; + void *wallsOfForce; uint8 monsterDifficulty; }; @@ -315,6 +316,9 @@ protected: void restoreFlyingObjectTempData(LevelTempData *tmp); void *generateFlyingObjectTempData(LevelTempData *tmp); void releaseFlyingObjectTempData(LevelTempData *tmp); + virtual void *generateWallOfForceTempData(LevelTempData *tmp) { return 0; } + virtual void restoreWallOfForceTempData(LevelTempData *tmp) {} + virtual void releaseWallOfForceTempData(LevelTempData *tmp) {} LevelTempData *_lvlTempData[29]; const int _numFlyingObjects; diff --git a/engines/kyra/magic_eob.cpp b/engines/kyra/magic_eob.cpp index 2ad0da72583..646d3897065 100644 --- a/engines/kyra/magic_eob.cpp +++ b/engines/kyra/magic_eob.cpp @@ -24,6 +24,7 @@ #include "kyra/eobcommon.h" #include "kyra/resource.h" +#include "common/system.h" namespace Kyra { @@ -490,11 +491,11 @@ bool EobCoreEngine::magicObjectDamageHit(EobFlyingObject *fo, int dcTimes, int d int blockDamage = fo->flags & 2; int hitTest = fo->flags & 4; - int s = 5; - int dmgType = 3; + int savingThrowType = 5; + int savingThrowEffect = 3; if (fo->flags & 8) { - s = 4; - dmgType = 0; + savingThrowType = 4; + savingThrowEffect = 0; } int dmgFlag = _spells[fo->callBackIndex].damageFlags; @@ -516,7 +517,7 @@ bool EobCoreEngine::magicObjectDamageHit(EobFlyingObject *fo, int dcTimes, int d continue; } - calcAndInflictMonsterDamage(&_monsters[*m], 0, 0, dmg, dmgFlag, s, dmgType); + calcAndInflictMonsterDamage(&_monsters[*m], 0, 0, dmg, dmgFlag, savingThrowType, savingThrowEffect); res = true; } updateAllMonsterShapes(); @@ -532,7 +533,7 @@ bool EobCoreEngine::magicObjectDamageHit(EobFlyingObject *fo, int dcTimes, int d int dmg = rollDice(dcTimes, dcPips, dcOffs) * level; res = true; - calcAndInflictCharacterDamage(i, 0, 0, dmg, dmgFlag, s, dmgType); + calcAndInflictCharacterDamage(i, 0, 0, dmg, dmgFlag, savingThrowType, savingThrowEffect); } } else { int c = _dscItemPosIndex[(_currentDirection << 2) + (fo->curPos & 3)]; @@ -545,7 +546,7 @@ bool EobCoreEngine::magicObjectDamageHit(EobFlyingObject *fo, int dcTimes, int d if ((_characters[c].flags & 1) && (!hitTest || monsterAttackHitTest(&_monsters[0], c))) { int dmg = rollDice(dcTimes, dcPips, dcOffs) * level; res = true; - calcAndInflictCharacterDamage(c, 0, 0, dmg, dmgFlag, s, dmgType); + calcAndInflictCharacterDamage(c, 0, 0, dmg, dmgFlag, savingThrowType, savingThrowEffect); } } } @@ -708,6 +709,22 @@ void EobCoreEngine::removeMagicWeaponItem(Item item) { _items[item].level = -1; } +void EobCoreEngine::updateWallOfForceTimers() { + uint32 ct = _system->getMillis(); + for (int i = 0; i < 5; i++) { + if (!_wallsOfForce[i].block) + continue; + if (_wallsOfForce[i].duration < ct) + destroyWallOfForce(i); + } +} + +void EobCoreEngine::destroyWallOfForce(int index) { + memset(_levelBlockProperties[_wallsOfForce[index].block].walls, 0, 4); + _wallsOfForce[index].block = 0; + _sceneUpdateRequired = true; +} + int EobCoreEngine::findSingleSpellTarget(int dist) { uint16 bl = _currentBlock; int res = -1; @@ -924,7 +941,7 @@ void EobCoreEngine::spellCallback_start_vampiricTouch() { Item i = (t != -1) ? createMagicWeaponItem(0x18, 83, 0, t) : -1; if (t == -1 || i == -1) { if (_flags.gameID == GI_EOB2) - printWarning(_magicStrings8[0]); + printWarning(_magicStrings8[2]); removeCharacterEffect(_activeSpell, _activeSpellCharId, 0); deleteCharEventTimer(_activeSpellCharId, -_activeSpell); _returnAfterSpellCallback = true; @@ -1019,7 +1036,33 @@ bool EobCoreEngine::spellCallback_end_holdMonster(void *obj) { } void EobCoreEngine::spellCallback_start_wallOfForce() { + uint16 bl = calcNewBlockPosition(_currentBlock, _currentDirection); + LevelBlockProperty *l = &_levelBlockProperties[bl]; + if (l->walls[0] || l->walls[1] || l->walls[2] || l->walls[3] || (l->flags & 7)) { + printWarning(_magicStrings8[3]); + return; + } + uint32 dur = 0xffffffff; + int s = 0; + int i = 0; + + for (; i < 5; i++) { + if (!_wallsOfForce[i].block) + break; + if (_wallsOfForce[i].duration < dur) { + dur = _wallsOfForce[i].duration; + s = i; + } + } + + if (i == 5) + destroyWallOfForce(s); + + memset(_levelBlockProperties[bl].walls, 74, 4); + _wallsOfForce[s].block = bl; + _wallsOfForce[s].duration = _system->getMillis() + (((getMageLevel(_openBookChar) * 546) >> 1) + 546) * _tickLength; + _sceneUpdateRequired = true; } void EobCoreEngine::spellCallback_start_disintegrate() { diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h index 5ed658ccee5..f330d42004a 100644 --- a/engines/kyra/resource.h +++ b/engines/kyra/resource.h @@ -627,6 +627,12 @@ enum KyraResources { kEob2HornStrings, kEob2HornSounds, + kEob2WallOfForceDsX, + kEob2WallOfForceDsY, + kEob2WallOfForceNumW, + kEob2WallOfForceNumH, + kEob2WallOfForceShpId, + kLolIngamePakFiles, kLolCharacterDefs, kLolIngameSfxFiles, diff --git a/engines/kyra/saveload_eob.cpp b/engines/kyra/saveload_eob.cpp index 05eea820bb5..24a10133d09 100644 --- a/engines/kyra/saveload_eob.cpp +++ b/engines/kyra/saveload_eob.cpp @@ -72,6 +72,7 @@ void LolEobBaseEngine::generateTempData() { _lvlTempData[l]->monsters = generateMonsterTempData(_lvlTempData[l]); _lvlTempData[l]->flyingObjects = generateFlyingObjectTempData(_lvlTempData[l]); + _lvlTempData[l]->wallsOfForce = generateWallOfForceTempData(_lvlTempData[l]); _hasTempDataFlags |= (1 << l); delete[] p2; @@ -104,6 +105,7 @@ void LolEobBaseEngine::restoreBlockTempData(int levelIndex) { restoreMonsterTempData(_lvlTempData[l]); restoreFlyingObjectTempData(_lvlTempData[l]); + restoreWallOfForceTempData(_lvlTempData[l]); delete[] p2; } @@ -115,6 +117,7 @@ void LolEobBaseEngine::releaseTempData() { delete[] _lvlTempData[i]->flags; releaseMonsterTempData(_lvlTempData[i]); releaseFlyingObjectTempData(_lvlTempData[i]); + releaseWallOfForceTempData(_lvlTempData[i]); delete _lvlTempData[i]; _lvlTempData[i] = 0; } @@ -293,13 +296,15 @@ Common::Error EobCoreEngine::loadGameState(int slot) { } _lvlTempData[i] = new LevelTempData; - _lvlTempData[i]->wallsXorData = new uint8[4096]; - _lvlTempData[i]->flags = new uint16[1024]; - EobMonsterInPlay *lm = new EobMonsterInPlay[30]; - _lvlTempData[i]->monsters = lm; - EobFlyingObject *lf = new EobFlyingObject[_numFlyingObjects]; - _lvlTempData[i]->flyingObjects = lf; LevelTempData *l = _lvlTempData[i]; + l->wallsXorData = new uint8[4096]; + l->flags = new uint16[1024]; + EobMonsterInPlay *lm = new EobMonsterInPlay[30]; + l->monsters = lm; + EobFlyingObject *lf = new EobFlyingObject[_numFlyingObjects]; + l->flyingObjects = lf; + WallOfForce *lw = new WallOfForce[5]; + l->wallsOfForce = lw; in.read(l->wallsXorData, 4096); for (int ii = 0; ii < 1024; ii++) @@ -349,10 +354,14 @@ Common::Error EobCoreEngine::loadGameState(int slot) { m->flags = in.readByte(); m->unused = in.readByte(); } + + for (int ii = 0; ii < 5; ii++) { + WallOfForce *w = &lw[ii]; + w->block = in.readUint16BE(); + w->duration = in.readUint32BE(); + } } - if (_flags.gameID == GI_EOB1) - _screen->loadPalette("EOBPAL.COL", _screen->getPalette(0)); loadLevel(_currentLevel, _currentSub); _sceneUpdateRequired = true; _screen->setFont(Screen::FID_6_FNT); @@ -515,6 +524,7 @@ Common::Error EobCoreEngine::saveGameStateIntern(int slot, const char *saveName, EobMonsterInPlay *lm = (EobMonsterInPlay*)_lvlTempData[i]->monsters; EobFlyingObject *lf = (EobFlyingObject*)_lvlTempData[i]->flyingObjects; + WallOfForce *lw = (WallOfForce*)_lvlTempData[i]->wallsOfForce; for (int ii = 0; ii < 30; ii++) { EobMonsterInPlay *m = &lm[ii]; @@ -560,6 +570,12 @@ Common::Error EobCoreEngine::saveGameStateIntern(int slot, const char *saveName, out->writeByte(m->flags); out->writeByte(m->unused); } + + for (int ii = 0; ii < 5; ii++) { + WallOfForce *w = &lw[ii]; + out->writeUint16BE(w->block); + out->writeUint32BE(w->duration); + } } out->finalize(); @@ -591,6 +607,27 @@ void EobCoreEngine::releaseMonsterTempData(LevelTempData *tmp) { delete[] p; } +void *EobCoreEngine::generateWallOfForceTempData(LevelTempData *tmp) { + WallOfForce *w = new WallOfForce[5]; + memcpy(w, _wallsOfForce, sizeof(WallOfForce) * 5); + uint32 ct = _system->getMillis(); + for (int i = 0; i < 5; i++) + w[i].duration = (w[i].duration > ct) ? w[i].duration - ct : _tickLength; + return w; +} + +void EobCoreEngine::restoreWallOfForceTempData(LevelTempData *tmp) { + memcpy(_wallsOfForce, tmp->wallsOfForce, sizeof(WallOfForce) * 5); + uint32 ct = _system->getMillis(); + for (int i = 0; i < 5; i++) + _wallsOfForce[i].duration += ct; +} + +void EobCoreEngine::releaseWallOfForceTempData(LevelTempData *tmp) { + WallOfForce *p = (WallOfForce*)tmp->wallsOfForce; + delete[] p; +} + #endif // ENABLE_EOB } // End of namespace Kyra diff --git a/engines/kyra/scene_eob.cpp b/engines/kyra/scene_eob.cpp index aef131f6cb2..afce9efdfa0 100644 --- a/engines/kyra/scene_eob.cpp +++ b/engines/kyra/scene_eob.cpp @@ -1144,9 +1144,12 @@ int EobCoreEngine::calcNewBlockPositionAndTestPassability(uint16 curBlock, uint1 if (!f) assert((_flags.gameID == GI_EOB1 && w < 70) || (_flags.gameID == GI_EOB2 && w < 80)); - if (w == 74 && _currentBlock == curBlock) { + if (_flags.gameID == GI_EOB2 && w == 74 && _currentBlock == curBlock) { for (int i = 0; i < 5; i++) { - + if (_wallsOfForce[i].block == b) { + destroyWallOfForce(i); + f = _wllWallFlags[0]; + } } } diff --git a/engines/kyra/script_eob.cpp b/engines/kyra/script_eob.cpp index 15f3c80b22d..6feac6bd77f 100644 --- a/engines/kyra/script_eob.cpp +++ b/engines/kyra/script_eob.cpp @@ -638,13 +638,13 @@ int EobInfProcessor::oeob_calcAndInflictCharacterDamage(int8 *data) { int useStrModifierOrBase = *pos++; int flg = (charIndex == -1) ? 4 : 0; - int a = 5; - int damageType = 1; + int savingThrowType = 5; + int savingThrowEffect = 1; if (_vm->game() == GI_EOB2) { flg = *pos++; - a = *pos++; - damageType = *pos++; + savingThrowType = *pos++; + savingThrowEffect = *pos++; } else if (!itemOrPips) { useStrModifierOrBase = times; times = 0; @@ -652,9 +652,9 @@ int EobInfProcessor::oeob_calcAndInflictCharacterDamage(int8 *data) { if (charIndex == -1) { for (int i = 0; i < 6; i++) - _vm->calcAndInflictCharacterDamage(i, times, itemOrPips, useStrModifierOrBase, flg, a, damageType); + _vm->calcAndInflictCharacterDamage(i, times, itemOrPips, useStrModifierOrBase, flg, savingThrowType, savingThrowEffect); } else { - _vm->calcAndInflictCharacterDamage(charIndex, times, itemOrPips, useStrModifierOrBase, flg, a, damageType); + _vm->calcAndInflictCharacterDamage(charIndex, times, itemOrPips, useStrModifierOrBase, flg, savingThrowType, savingThrowEffect); } return pos - data; } diff --git a/engines/kyra/sequences_eob2.cpp b/engines/kyra/sequences_eob2.cpp index 395e94713cb..ea96779bb1c 100644 --- a/engines/kyra/sequences_eob2.cpp +++ b/engines/kyra/sequences_eob2.cpp @@ -239,7 +239,7 @@ void DarkMoonEngine::seq_playIntro() { sq.loadScene(1, 2); sq.waitForSongNotifier(4); - //intro scroll + // intro scroll if (!skipFlag() && !shouldQuit()) { for (int i = 0; i < 280; i += 3) { uint32 endtime = _system->getMillis() + _tickLength; @@ -978,7 +978,7 @@ void DarkmoonSequenceHelper::loadScene(int index, int pageNum) { } if (!s) - error("DarkmoonSequenceHelper::loadScene(): Sequence CPS file loading failed."); + error("DarkmoonSequenceHelper::loadScene(): CPS file loading failure in scene %d", index); if (_mode == kFinale) s->read(_palettes[0]->getData(), 768); @@ -1026,7 +1026,7 @@ void DarkmoonSequenceHelper::runSequence(int index, int del) { if (s->pal) setPaletteWithoutTextColor(palIndex); delay(s->delay); - if (_mode == DarkmoonSequenceHelper::kIntro && s->pal) + if (_mode == kIntro && s->pal) setPaletteWithoutTextColor(0); break; @@ -1035,7 +1035,7 @@ void DarkmoonSequenceHelper::runSequence(int index, int del) { shapeW = _shapes[s->obj][2]; shapeH = _shapes[s->obj][3]; - if (_mode == DarkmoonSequenceHelper::kFinale) { + if (_mode == kFinale) { _screen->setScreenDim(18); x -= (_screen->_curDim->sx << 3); y -= _screen->_curDim->sy; @@ -1045,7 +1045,7 @@ void DarkmoonSequenceHelper::runSequence(int index, int del) { x2 = x; } - _screen->drawShape(0, _shapes[s->obj], x, y, _mode == DarkmoonSequenceHelper::kIntro ? 0 : 18); + _screen->drawShape(0, _shapes[s->obj], x, y, _mode == kIntro ? 0 : 18); if (s->pal) setPaletteWithoutTextColor(palIndex); @@ -1054,7 +1054,7 @@ void DarkmoonSequenceHelper::runSequence(int index, int del) { delay(s->delay); - if (_mode == DarkmoonSequenceHelper::kIntro) { + if (_mode == kIntro) { if (s->pal) setPaletteWithoutTextColor(0); _screen->copyRegion(x - 8, y - 8, x, y, (shapeW + 1) << 3, shapeH, 2, 0, Screen::CR_NO_P_CHECK); @@ -1076,14 +1076,14 @@ void DarkmoonSequenceHelper::runSequence(int index, int del) { delay(s->delay); - if (_mode == DarkmoonSequenceHelper::kIntro && s->pal) + if (_mode == kIntro && s->pal) setPaletteWithoutTextColor(0); break; case 3: case 4: // fade shape in or out or restore background - if (_mode == DarkmoonSequenceHelper::kFinale) + if (_mode == kFinale) break; _screen->setShapeFadeMode(0, true); @@ -1109,10 +1109,10 @@ void DarkmoonSequenceHelper::runSequence(int index, int del) { case 5: // copy region - if (_mode == DarkmoonSequenceHelper::kFinale && s->pal) + if (_mode == kFinale && s->pal) setPaletteWithoutTextColor(palIndex); - _screen->copyRegion(s->x2 << 3, s->y2, s->x1, s->y1, s->w << 3, s->h, (s->obj && _mode == DarkmoonSequenceHelper::kFinale) ? 6 : 2, 0, Screen::CR_NO_P_CHECK); + _screen->copyRegion(s->x2 << 3, s->y2, s->x1, s->y1, s->w << 3, s->h, (s->obj && _mode == kFinale) ? 6 : 2, 0, Screen::CR_NO_P_CHECK); _screen->updateScreen(); delay(s->delay); break; diff --git a/engines/kyra/sprites_eob.cpp b/engines/kyra/sprites_eob.cpp index e4001b24d72..caf4a748da4 100644 --- a/engines/kyra/sprites_eob.cpp +++ b/engines/kyra/sprites_eob.cpp @@ -587,7 +587,24 @@ void EobCoreEngine::drawMonsters(int index) { } void EobCoreEngine::drawWallOfForce(int index) { + int d = _dscDimMap[index]; + assert(d < 3); + int dH = _wallOfForceDsNumH[d]; + int dW = _wallOfForceDsNumW[d]; + int y = _wallOfForceDsY[d]; + int shpId = _wallOfForceShpId[d] + _teleporterPulse; + int h = _wallOfForceShapes[shpId][1]; + int w = _wallOfForceShapes[shpId][2] << 3; + for (int i = 0; i < dH; i++) { + int x = _wallOfForceDsX[index]; + for (int ii = 0; ii < dW; ii++) { + drawBlockObject(0, 2, _wallOfForceShapes[shpId], x, y, 5); + x += w; + } + y += h; + shpId ^= 1; + } } void EobCoreEngine::drawFlyingObjects(int index) { diff --git a/engines/kyra/staticres_eob.cpp b/engines/kyra/staticres_eob.cpp index 5995f8a5cd7..069bf1337d1 100644 --- a/engines/kyra/staticres_eob.cpp +++ b/engines/kyra/staticres_eob.cpp @@ -1280,6 +1280,12 @@ void DarkMoonEngine::initStaticResource() { _dranFoolsStrings = _staticres->loadStrings(kEob2DranFoolsStrings, temp); _hornStrings = _staticres->loadStrings(kEob2HornStrings, temp); _hornSounds = _staticres->loadRawData(kEob2HornSounds, temp); + + _wallOfForceDsX = (const int16*)_staticres->loadRawDataBe16(kEob2WallOfForceDsX, temp); + _wallOfForceDsY = _staticres->loadRawData(kEob2WallOfForceDsY, temp); + _wallOfForceDsNumW = _staticres->loadRawData(kEob2WallOfForceNumW, temp); + _wallOfForceDsNumH = _staticres->loadRawData(kEob2WallOfForceNumH, temp); + _wallOfForceShpId = _staticres->loadRawData(kEob2WallOfForceShpId, temp); } void DarkMoonEngine::initSpells() { diff --git a/engines/kyra/timer_eob.cpp b/engines/kyra/timer_eob.cpp index 20a05f9ee6b..61fa554193b 100644 --- a/engines/kyra/timer_eob.cpp +++ b/engines/kyra/timer_eob.cpp @@ -371,7 +371,7 @@ void EobCoreEngine::timerUpdateTeleporters(int timerNum) { _teleporterPulse ^= 1; for (int i = 0; i < 18; i++) { uint8 w = _visibleBlocks[i]->walls[_sceneDrawVarDown]; - if ((_flags.gameID == GI_EOB1 && w == 52) || (_flags.gameID == GI_EOB2 && (w == 44 || w == 74))) { + if ((w == _teleporterWallId) || (_flags.gameID == GI_EOB2 && w == 74)) { _sceneUpdateRequired = true; return; }