aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorathrxx2011-08-21 20:26:07 +0200
committerJohannes Schickel2011-12-26 16:18:14 +0100
commit2448d885e4e331a22e1e468277142155a5ddda87 (patch)
tree98584a9a40a940da8cfd2b21bbc68e9b24d2a925 /engines
parentc35de374dfe545ffc5044a00a247c5814e3b250e (diff)
downloadscummvm-rg350-2448d885e4e331a22e1e468277142155a5ddda87.tar.gz
scummvm-rg350-2448d885e4e331a22e1e468277142155a5ddda87.tar.bz2
scummvm-rg350-2448d885e4e331a22e1e468277142155a5ddda87.zip
KYRA: (EOB) - complete EOBII playability
- fixed temp data generation, block data loading, some spell issues, etc. - both EOB I and II should now be completable - one big issue remaining (AdLib driver gets swamped with monster sounds which causes heavy lags in some levels)
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/detection.cpp4
-rw-r--r--engines/kyra/eob1.cpp3
-rw-r--r--engines/kyra/eob2.cpp11
-rw-r--r--engines/kyra/eobcommon.cpp5
-rw-r--r--engines/kyra/eobcommon.h25
-rw-r--r--engines/kyra/gui_eob.cpp8
-rw-r--r--engines/kyra/items_eob.cpp7
-rw-r--r--engines/kyra/lol.h1
-rw-r--r--engines/kyra/loleobbase.h4
-rw-r--r--engines/kyra/magic_eob.cpp22
-rw-r--r--engines/kyra/saveload_eob.cpp50
-rw-r--r--engines/kyra/scene_eob.cpp27
-rw-r--r--engines/kyra/scene_lol.cpp5
-rw-r--r--engines/kyra/screen_eob.cpp10
-rw-r--r--engines/kyra/script_eob.cpp11
-rw-r--r--engines/kyra/script_eob.h7
-rw-r--r--engines/kyra/sequences_eob2.cpp8
-rw-r--r--engines/kyra/sprites_eob.cpp3
-rw-r--r--engines/kyra/staticres_eob.cpp16
-rw-r--r--engines/kyra/text_eob.cpp1
-rw-r--r--engines/kyra/timer_eob.cpp1
21 files changed, 137 insertions, 92 deletions
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp
index adfb1c612a..dd67c3e715 100644
--- a/engines/kyra/detection.cpp
+++ b/engines/kyra/detection.cpp
@@ -160,6 +160,10 @@ SaveStateList KyraMetaEngine::listSaves(const char *target) const {
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
+ // Skip automatic final saves made by EOB for the purpose of party transfer
+ if (!scumm_stricmp(file->c_str() + file->size() - 3, "fin"))
+ continue;
+
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 3);
diff --git a/engines/kyra/eob1.cpp b/engines/kyra/eob1.cpp
index 8ce41d6b5b..d67cda529d 100644
--- a/engines/kyra/eob1.cpp
+++ b/engines/kyra/eob1.cpp
@@ -78,9 +78,6 @@ Common::Error EobEngine::init() {
_scriptTimersCount = 1;
- //_wllWallFlags[132] = 1;
- //_wllWallFlags[133] = 1;
-
return Common::kNoError;
}
diff --git a/engines/kyra/eob2.cpp b/engines/kyra/eob2.cpp
index 0ffca10093..d9aad0ce3d 100644
--- a/engines/kyra/eob2.cpp
+++ b/engines/kyra/eob2.cpp
@@ -77,10 +77,6 @@ Common::Error DarkMoonEngine::init() {
_color13 = 177;
_color14 = 182;
- // Necessary wall hacks (where the original code makes out of bounds accesses)
- _wllWallFlags[183] = 0x50;
- _wllVmpMap[183] = 1;
-
return Common::kNoError;
}
@@ -226,8 +222,8 @@ void DarkMoonEngine::loadMonsterDecoration(const char *file, int16 monsterIndex)
SpriteDecoration *m = &_monsterDecorations[i * 6 + ii + monsterIndex];
m->shp = _screen->encodeShape(dc[0], dc[1], dc[2], dc[3]);
- m->x = dc[4];
- m->y = dc[5];
+ m->x = (int8)dc[4];
+ m->y = (int8)dc[5];
}
}
@@ -281,6 +277,7 @@ bool DarkMoonEngine::killMonsterExtra(EobMonsterInPlay *m) {
if (m->type) {
_playFinale = true;
_runFlag = false;
+ delay(850);
} else {
m->hitPointsCur = 150;
m->curRemoteWeapon = 0;
@@ -306,7 +303,7 @@ const uint8 *DarkMoonEngine::loadDoorShapes(const char *filename, int doorIndex,
shapeDefs += 8;
_doorSwitches[doorIndex * 3 + i].x = *shapeDefs;
shapeDefs += 2;
- _doorSwitches[doorIndex * 3 + i]. y= *shapeDefs;
+ _doorSwitches[doorIndex * 3 + i].y= *shapeDefs;
shapeDefs += 2;
}
_screen->_curPage = 0;
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp
index 67609520fa..fbd8ef62e1 100644
--- a/engines/kyra/eobcommon.cpp
+++ b/engines/kyra/eobcommon.cpp
@@ -398,8 +398,11 @@ Common::Error EobCoreEngine::go() {
if (!shouldQuit() && action > -3) {
runLoop();
- if (_playFinale)
+ if (_playFinale) {
+ // make final save for party transfer
+ saveGameStateIntern(-1, 0, 0);
seq_playFinale();
+ }
}
return Common::kNoError;
diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h
index 5f1bf8b709..7ab933390e 100644
--- a/engines/kyra/eobcommon.h
+++ b/engines/kyra/eobcommon.h
@@ -151,8 +151,8 @@ struct EobItemType {
struct SpriteDecoration {
uint8 *shp;
- uint8 x;
- uint8 y;
+ int16 x;
+ int16 y;
};
struct EobMonsterProperty {
@@ -574,11 +574,13 @@ protected:
const int8 *_monsterDirChangeTable;
// Level
- void loadLevel(int level, int func);
- Common::String initLevelData(int func);
+ void loadLevel(int level, int sub);
+ Common::String initLevelData(int sub);
void addLevelItems();
void loadVcnData(const char *file, const char */*nextFile*/);
void loadBlockProperties(const char *mazFile);
+ const uint8 *getBlockFileData(int levelIndex);
+ const uint8 *getBlockFileData(const char *mazFile);
void loadDecorations(const char *cpsFile, const char *decFile);
void assignWallsAndDecorations(int wallIndex, int vmpIndex, int decDataIndex, int specialType, int flags);
void releaseDecorations();
@@ -613,6 +615,7 @@ protected:
int8 _currentSub;
Common::String _curGfxFile;
+ Common::String _curBlockFile;
uint32 _drawSceneTimer;
uint32 _flashShapeTimer;
@@ -1006,13 +1009,13 @@ protected:
void spellCallback_start_heal();
void spellCallback_start_layOnHands();
void spellCallback_start_turnUndead();
- bool spellCallback_end_lightningBoltPassive(void *obj);
- bool spellCallback_end_unk1Passive(void *obj);
- bool spellCallback_end_unk2Passive(void *obj);
- bool spellCallback_end_deathSpellPassive(void *obj);
- bool spellCallback_end_disintegratePassive(void *obj);
- bool spellCallback_end_causeCriticalWoundsPassive(void *obj);
- bool spellCallback_end_fleshToStonePassive(void *obj);
+ bool spellCallback_end_monster_lightningBolt(void *obj);
+ bool spellCallback_end_monster_fireball1(void *obj);
+ bool spellCallback_end_monster_fireball2(void *obj);
+ bool spellCallback_end_monster_deathSpell(void *obj);
+ bool spellCallback_end_monster_disintegrate(void *obj);
+ bool spellCallback_end_monster_causeCriticalWounds(void *obj);
+ bool spellCallback_end_monster_fleshToStone(void *obj);
int8 _openBookSpellLevel;
int8 _openBookSpellSelectedItem;
diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp
index a5f06c551e..d333528ab2 100644
--- a/engines/kyra/gui_eob.cpp
+++ b/engines/kyra/gui_eob.cpp
@@ -853,12 +853,12 @@ int EobCoreEngine::clickedCamp(Button *button) {
gui_drawCharPortraitWithStats(i);
}
- _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 14, Screen::CR_NO_P_CHECK);
_screen->copyPage(0, 7);
+ _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 12, Screen::CR_NO_P_CHECK);
_gui->runCampMenu();
- _screen->copyRegion(0, 0, 0, 120, 176, 24, 14, 2, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 0, 0, 120, 176, 24, 12, 2, Screen::CR_NO_P_CHECK);
_screen->setScreenDim(cd);
drawScene(0);
@@ -2250,7 +2250,7 @@ void GUI_Eob::runCampMenu() {
_vm->dropCharacter(selectCharacterDialogue(53));
_vm->gui_drawPlayField(false);
res = true;
- _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 14, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 12, Screen::CR_NO_P_CHECK);
_screen->setFont(Screen::FID_6_FNT);
_vm->gui_drawAllCharPortraitsWithStats();
_screen->setFont(Screen::FID_8_FNT);
@@ -2282,6 +2282,8 @@ void GUI_Eob::runCampMenu() {
default:
break;
}
+
+ lastMenu = -1;
} else {
Common::Point p = _vm->getMousePos();
diff --git a/engines/kyra/items_eob.cpp b/engines/kyra/items_eob.cpp
index a83207b565..e3309f830d 100644
--- a/engines/kyra/items_eob.cpp
+++ b/engines/kyra/items_eob.cpp
@@ -208,8 +208,8 @@ int EobCoreEngine::validateInventorySlotForItem(Item item, int charIndex, int sl
int itm = _characters[charIndex].inventory[slot];
int ex = _itemTypes[_items[itm].type].extraProperties & 0x7f;
- if (slot < 2 && (_items[itm].flags & 0x20) && ex > 0 && ex < 4) {
- if (_flags.gameID == GI_EOB2)
+ if (_items[itm].flags & 0x20 && (_flags.gameID == GI_EOB1 || slot < 2)) {
+ if (_flags.gameID == GI_EOB2 && ex > 0 && ex < 4)
_txt->printMessage(_validateCursedString[0], -1, _characters[charIndex].name);
return 0;
}
@@ -692,6 +692,9 @@ void EobCoreEngine::endObjectFlight(EobFlyingObject *fo) {
}
void EobCoreEngine::checkFlyingObjects() {
+ if (!_runFlag)
+ return;
+
for (int i = 0; i < 10; i++) {
EobFlyingObject *fo = &_flyingObjects[i];
if (!fo->enable)
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 8ddba8607c..e75d621cc3 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -917,6 +917,7 @@ private:
uint8 *getLevelDecorationShapes(int index);
void restoreTempDataAdjustMonsterStrength(int index);
void loadBlockProperties(const char *cmzFile);
+ const uint8 *getBlockFileData(int levelIndex);
void loadLevelShpDat(const char *shpFile, const char *datFile, bool flag);
void loadLevelGraphics(const char *file, int specialColor, int weight, int vcnLen, int vmpLen, const char *palFile);
diff --git a/engines/kyra/loleobbase.h b/engines/kyra/loleobbase.h
index 02b236d44f..cb7f920cb8 100644
--- a/engines/kyra/loleobbase.h
+++ b/engines/kyra/loleobbase.h
@@ -147,6 +147,7 @@ protected:
virtual void drawSceneShapes(int start) = 0;
virtual void drawDecorations(int index) = 0;
+ virtual const uint8 *getBlockFileData(int levelIndex) = 0;
void setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim);
void scaleLevelShapesDim(int index, int16 &y1, int16 &y2, int dim);
void drawLevelModifyScreenDim(int dim, int16 x1, int16 y1, int16 x2, int16 y2);
@@ -233,6 +234,7 @@ protected:
const uint8 *_dscTileIndex;
const uint8 *_dscDoorShpIndex;
+ int _dscDoorShpIndexSize;
const uint8 *_dscDoorY2;
// Script
@@ -308,7 +310,7 @@ protected:
virtual Common::Error saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumbnail) = 0;
void generateTempData();
- void restoreBlockTempData(int levelIndex);
+ virtual void restoreBlockTempData(int levelIndex);
void releaseTempData();
virtual void *generateMonsterTempData(LevelTempData *tmp) = 0;
virtual void restoreMonsterTempData(LevelTempData *tmp) = 0;
diff --git a/engines/kyra/magic_eob.cpp b/engines/kyra/magic_eob.cpp
index 0424558b04..9063d512f0 100644
--- a/engines/kyra/magic_eob.cpp
+++ b/engines/kyra/magic_eob.cpp
@@ -236,8 +236,14 @@ void EobCoreEngine::removeCharacterEffect(int spell, int charIndex, int showWarn
EobCharacter *c = &_characters[charIndex];
EobSpell *s = &_spells[spell];
- if (showWarning)
+ if (showWarning) {
+ int od = _screen->curDimIndex();
+ Screen::FontId of = _screen->setFont(Screen::FID_6_FNT);
+ _screen->setScreenDim(7);
printWarning(Common::String::format(_magicStrings3[_flags.gameID == GI_EOB1 ? 3 : 2], c->name, s->name).c_str());
+ _screen->setScreenDim(od);
+ _screen->setFont(of);
+ }
if (s->endCallback)
(this->*s->endCallback)(c);
@@ -1281,12 +1287,12 @@ void EobCoreEngine::spellCallback_start_turnUndead() {
_preventMonsterFlash = false;
}
-bool EobCoreEngine::spellCallback_end_lightningBoltPassive(void *obj) {
+bool EobCoreEngine::spellCallback_end_monster_lightningBolt(void *obj) {
EobFlyingObject *fo = (EobFlyingObject*)obj;
return magicObjectDamageHit(fo, 0, 0, 12, 1);
}
-bool EobCoreEngine::spellCallback_end_unk1Passive(void *obj) {
+bool EobCoreEngine::spellCallback_end_monster_fireball1(void *obj) {
EobFlyingObject *fo = (EobFlyingObject*)obj;
bool res = false;
if (_partyEffectFlags & 0x20000) {
@@ -1301,12 +1307,12 @@ bool EobCoreEngine::spellCallback_end_unk1Passive(void *obj) {
return res;
}
-bool EobCoreEngine::spellCallback_end_unk2Passive(void *obj) {
+bool EobCoreEngine::spellCallback_end_monster_fireball2(void *obj) {
EobFlyingObject *fo = (EobFlyingObject*)obj;
return magicObjectDamageHit(fo, 0, 0, 18, 0);
}
-bool EobCoreEngine::spellCallback_end_deathSpellPassive(void *obj) {
+bool EobCoreEngine::spellCallback_end_monster_deathSpell(void *obj) {
EobFlyingObject *fo = (EobFlyingObject*)obj;
if (fo->curBlock != _currentBlock)
return false;
@@ -1323,7 +1329,7 @@ bool EobCoreEngine::spellCallback_end_deathSpellPassive(void *obj) {
return true;
}
-bool EobCoreEngine::spellCallback_end_disintegratePassive(void *obj) {
+bool EobCoreEngine::spellCallback_end_monster_disintegrate(void *obj) {
EobFlyingObject *fo = (EobFlyingObject*)obj;
if (fo->curBlock != _currentBlock)
return false;
@@ -1339,7 +1345,7 @@ bool EobCoreEngine::spellCallback_end_disintegratePassive(void *obj) {
return true;
}
-bool EobCoreEngine::spellCallback_end_causeCriticalWoundsPassive(void *obj) {
+bool EobCoreEngine::spellCallback_end_monster_causeCriticalWounds(void *obj) {
EobFlyingObject *fo = (EobFlyingObject*)obj;
if (fo->curBlock != _currentBlock)
return false;
@@ -1353,7 +1359,7 @@ bool EobCoreEngine::spellCallback_end_causeCriticalWoundsPassive(void *obj) {
return true;
}
-bool EobCoreEngine::spellCallback_end_fleshToStonePassive(void *obj) {
+bool EobCoreEngine::spellCallback_end_monster_fleshToStone(void *obj) {
EobFlyingObject *fo = (EobFlyingObject*)obj;
if (fo->curBlock != _currentBlock)
return false;
diff --git a/engines/kyra/saveload_eob.cpp b/engines/kyra/saveload_eob.cpp
index 01fbd75cfe..49c6668abf 100644
--- a/engines/kyra/saveload_eob.cpp
+++ b/engines/kyra/saveload_eob.cpp
@@ -47,15 +47,7 @@ void LolEobBaseEngine::generateTempData() {
_lvlTempData[l]->wallsXorData = new uint8[4096];
_lvlTempData[l]->flags = new uint16[1024];
- const uint8 *p = 0;
- const uint8 *p2 = 0;
- if (_flags.gameID == GI_LOL) {
- screen()->loadBitmap(Common::String::format("LEVEL%d.CMZ", _currentLevel).c_str(), 15, 15, 0);
- p = screen()->getCPagePtr(14);
- } else {
- p2 = p = _res->fileData(Common::String::format("LEVEL%d.MAZ", _currentLevel).c_str(), 0);
- }
-
+ const uint8 *p = getBlockFileData(_currentLevel);
uint16 len = READ_LE_UINT16(p + 4);
p += 6;
@@ -75,20 +67,11 @@ void LolEobBaseEngine::generateTempData() {
_lvlTempData[l]->wallsOfForce = generateWallOfForceTempData(_lvlTempData[l]);
_hasTempDataFlags |= (1 << l);
- delete[] p2;
}
void LolEobBaseEngine::restoreBlockTempData(int levelIndex) {
int l = levelIndex - 1;
- const uint8 *p = 0;
- const uint8 *p2 = 0;
- if (_flags.gameID == GI_LOL) {
- screen()->loadBitmap(Common::String::format("LEVEL%d.CMZ", levelIndex).c_str(), 3, 3, 0);
- p = screen()->getCPagePtr(2);
- } else {
- p2 = p = _res->fileData(Common::String::format("LEVEL%d.MAZ", levelIndex).c_str(), 0);
- }
-
+ const uint8 *p = getBlockFileData(levelIndex);
uint16 len = READ_LE_UINT16(p + 4);
p += 6;
@@ -106,8 +89,6 @@ void LolEobBaseEngine::restoreBlockTempData(int levelIndex) {
restoreMonsterTempData(_lvlTempData[l]);
restoreFlyingObjectTempData(_lvlTempData[l]);
restoreWallOfForceTempData(_lvlTempData[l]);
-
- delete[] p2;
}
void LolEobBaseEngine::releaseTempData() {
@@ -144,7 +125,14 @@ void LolEobBaseEngine::releaseFlyingObjectTempData(LevelTempData *tmp) {
#ifdef ENABLE_EOB
Common::Error EobCoreEngine::loadGameState(int slot) {
- const char *fileName = getSavegameFilename(slot);
+ const char *fileName = 0;
+
+ if (slot == -1) {
+ _savegameFilename = /*_targetName + */Common::String("eob.fin");
+ fileName = _savegameFilename.c_str();
+ } else {
+ fileName = getSavegameFilename(slot);
+ }
SaveHeader header;
Common::InSaveFile *saveFile = openSaveForReading(fileName, header);
@@ -388,7 +376,7 @@ Common::Error EobCoreEngine::loadGameState(int slot) {
useMagicBookOrSymbol(_openBookChar, _openBookType);
}
- _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 14, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 12, Screen::CR_NO_P_CHECK);
gui_toggleButtons();
setHandItem(_itemInHand);
@@ -404,8 +392,18 @@ Common::Error EobCoreEngine::loadGameState(int slot) {
}
Common::Error EobCoreEngine::saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumbnail) {
- const Common::String finSuffix(".FIN");
- const char *fileName = (slot != -1) ? getSavegameFilename(slot) : (_targetName + finSuffix).c_str();
+ Common::String saveNameTmp;
+ const char *fileName = 0;
+
+ if (slot == -1) {
+ _savegameFilename = _targetName + Common::String(".fin");
+ fileName = _savegameFilename.c_str();
+ saveNameTmp = _targetName + Common::String(" final");
+ saveNameTmp.toUppercase();
+ saveName = saveNameTmp.c_str();
+ } else {
+ fileName = getSavegameFilename(slot);
+ }
Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumbnail);
if (!out)
@@ -525,7 +523,7 @@ Common::Error EobCoreEngine::saveGameStateIntern(int slot, const char *saveName,
LevelTempData *l = _lvlTempData[i];
if (!l || !(_hasTempDataFlags & (1 << i)))
continue;
-
+
out->write(l->wallsXorData, 4096);
for (int ii = 0; ii < 1024; ii++)
out->writeByte(l->flags[ii] & 0xff);
diff --git a/engines/kyra/scene_eob.cpp b/engines/kyra/scene_eob.cpp
index 98cd60dcd9..5f06139f3f 100644
--- a/engines/kyra/scene_eob.cpp
+++ b/engines/kyra/scene_eob.cpp
@@ -863,23 +863,31 @@ void EobCoreEngine::loadVcnData(const char *file, const char*/*nextFile*/) {
void EobCoreEngine::loadBlockProperties(const char *mazFile) {
memset(_levelBlockProperties, 0, 1024 * sizeof(LevelBlockProperty));
- Common::SeekableReadStream *s = _res->createReadStream(mazFile);
- _screen->loadFileDataToPage(s, 2, 4096);
- delete s;
+ const uint8 *p = getBlockFileData(mazFile) + 6;
if (_hasTempDataFlags & (1 << (_currentLevel - 1))) {
restoreBlockTempData(_currentLevel);
return;
}
- const uint8 *p = _screen->getCPagePtr(2) + 6;
-
for (int i = 0; i < 1024; i++) {
for (int ii = 0; ii < 4; ii++)
_levelBlockProperties[i].walls[ii] = *p++;
}
}
+const uint8 *EobCoreEngine::getBlockFileData(int) {
+ Common::SeekableReadStream *s = _res->createReadStream(_curBlockFile);
+ _screen->loadFileDataToPage(s, 15, s->size());
+ delete s;
+ return _screen->getCPagePtr(14);
+}
+
+const uint8 *EobCoreEngine::getBlockFileData(const char *mazFile) {
+ _curBlockFile = mazFile;
+ return getBlockFileData(0);
+}
+
void EobCoreEngine::loadDecorations(const char *cpsFile, const char *decFile) {
_screen->loadShapeSetBitmap(cpsFile, 3, 3);
Common::SeekableReadStream *s = _res->createReadStream(decFile);
@@ -919,6 +927,12 @@ void EobCoreEngine::loadDecorations(const char *cpsFile, const char *decFile) {
void EobCoreEngine::assignWallsAndDecorations(int wallIndex, int vmpIndex, int decIndex, int specialType, int flags) {
_wllVmpMap[wallIndex] = vmpIndex;
+ for (int i = 0; i < 6; i++) {
+ for (int ii = 0; ii < 10; ii++) {
+ if (_characters[i].events[ii] == -57)
+ spellCallback_start_trueSeeing();
+ }
+ }
_wllShapeMap[wallIndex] = _mappedDecorationsCount + 1;
_specialWallTypes[wallIndex] = specialType;
_wllWallFlags[wallIndex] = flags ^ 4;
@@ -1145,8 +1159,7 @@ int EobCoreEngine::calcNewBlockPositionAndTestPassability(uint16 curBlock, uint1
int w = _levelBlockProperties[b].walls[direction ^ 2];
int f = _wllWallFlags[w];
- //if (!f)
- assert((_flags.gameID == GI_EOB1 && w < 70) || (_flags.gameID == GI_EOB2 && w < 80));
+ assert((_flags.gameID == GI_EOB1 && w < 70) || (_flags.gameID == GI_EOB2 && w < 80));
if (_flags.gameID == GI_EOB2 && w == 74 && _currentBlock == curBlock) {
for (int i = 0; i < 5; i++) {
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 998fb73364..d28477b148 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -252,6 +252,11 @@ void LoLEngine::loadBlockProperties(const char *cmzFile) {
}
}
+const uint8 *LoLEngine::getBlockFileData(int levelIndex) {
+ _screen->loadBitmap(Common::String::format("LEVEL%d.CMZ", levelIndex).c_str(), 15, 15, 0);
+ return screen()->getCPagePtr(14);
+}
+
void LoLEngine::loadLevelShpDat(const char *shpFile, const char *datFile, bool flag) {
memset(_tempBuffer5120, 0, 5120);
diff --git a/engines/kyra/screen_eob.cpp b/engines/kyra/screen_eob.cpp
index 9c67750ba8..4161c757d8 100644
--- a/engines/kyra/screen_eob.cpp
+++ b/engines/kyra/screen_eob.cpp
@@ -769,7 +769,6 @@ void Screen_Eob::drawExplosion(int scale, int radius, int numElements, int stepS
for (int l = 2; l;) {
if (l != 2) {
for (int i = numElements - 1; i >= 0; i--) {
- uint32 end = _system->getMillis() + 1;
int16 px = ((ptr2[i] >> 6) >> scale) + gx2;
int16 py = ((ptr3[i] >> 6) >> scale) + gy2;
if (py > ymax)
@@ -902,7 +901,6 @@ void Screen_Eob::drawVortex(int numElements, int radius, int stepSize, int, int
int d = 0;
for (int i = 2; i; ) {
if (i != 2) {
- uint32 nextDelay = _system->getMillis() + 1;
for (int ii = numElements - 1; ii >= 0; ii--) {
int16 px = CLIP((xCoords[ii] >> 6) + cx, 0, SCREEN_W - 1);
int16 py = CLIP((yCoords[ii] >> 6) + cy, 0, SCREEN_H - 1);
@@ -912,7 +910,7 @@ void Screen_Eob::drawVortex(int numElements, int radius, int stepSize, int, int
i = 0;
int r = (stepSize >> 1) + (stepSize >> 2) + (stepSize >> 3);
- uint32 nextDelay2 = _system->getMillis() + 1;
+ uint32 nextDelay = _system->getMillis() + 1;
for (int ii = 0; ii < numElements; ii++) {
if (pixDelay[ii] == 0) {
@@ -951,9 +949,9 @@ void Screen_Eob::drawVortex(int numElements, int radius, int stepSize, int, int
if (ii % 15 == 0) {
updateScreen();
uint32 cur = _system->getMillis();
- if (nextDelay2 > cur)
- _system->delayMillis(nextDelay2 - cur);
- nextDelay2 += 1;
+ if (nextDelay > cur)
+ _system->delayMillis(nextDelay - cur);
+ nextDelay += 1;
}
}
} else {
diff --git a/engines/kyra/script_eob.cpp b/engines/kyra/script_eob.cpp
index 1dbb02414f..6522731751 100644
--- a/engines/kyra/script_eob.cpp
+++ b/engines/kyra/script_eob.cpp
@@ -89,8 +89,8 @@ void EobCoreEngine::updateScriptTimers() {
EobInfProcessor::EobInfProcessor(EobCoreEngine *engine, Screen_Eob *screen) : _vm(engine), _screen(screen),
_commandMin(engine->game() == GI_EOB1 ? -27 : -31) {
-#define Opcode(x) _opcodes.push_back(new InfProc(this, &EobInfProcessor::x))
-#define OpcodeAlt(x) if (_vm->game() == GI_EOB1) Opcode(x##_v1); else Opcode(x##_v2);
+#define Opcode(x) _opcodes.push_back(new InfOpcode(new InfProc(this, &EobInfProcessor::x), #x))
+#define OpcodeAlt(x) if (_vm->game() == GI_EOB1) { Opcode(x##_v1); } else { Opcode(x##_v2); }
Opcode(oeob_setWallType);
Opcode(oeob_toggleWallState);
Opcode(oeob_openDoor);
@@ -157,8 +157,10 @@ EobInfProcessor::~EobInfProcessor() {
delete[] _flagTable;
delete[] _stack;
delete[] _scriptData;
- for (Common::Array<const InfProc*>::const_iterator a = _opcodes.begin(); a != _opcodes.end(); ++a)
+ for (Common::Array<const InfOpcode*>::const_iterator a = _opcodes.begin(); a != _opcodes.end(); ++a) {
+ delete (*a)->proc;
delete *a;
+ }
_opcodes.clear();
}
@@ -196,7 +198,8 @@ void EobInfProcessor::run(int func, int sub) {
int8 cmd = *pos++;
if (cmd <= _commandMin || cmd >= 0)
continue;
- pos += (*_opcodes[-(cmd + 1)])(pos);
+ debugC(5, kDebugLevelScript, "[0x%.08X] EobInfProcessor::%s()", (uint32)(pos - _scriptData), _opcodes[-(cmd + 1)]->desc.c_str());
+ pos += (*_opcodes[-(cmd + 1)]->proc)(pos);
} while (!_abortScript && !_abortAfterSubroutine);
}
diff --git a/engines/kyra/script_eob.h b/engines/kyra/script_eob.h
index 8f44c7f6f9..f7e5f09379 100644
--- a/engines/kyra/script_eob.h
+++ b/engines/kyra/script_eob.h
@@ -91,7 +91,12 @@ private:
Screen_Eob *_screen;
typedef Common::Functor1Mem<int8*, int, EobInfProcessor> InfProc;
- Common::Array<const InfProc*> _opcodes;
+ struct InfOpcode {
+ InfOpcode(InfProc *p, const char *d) : proc(p), desc(d) {}
+ InfProc *proc;
+ Common::String desc;
+ };
+ Common::Array<const InfOpcode*> _opcodes;
int8 *_scriptData;
uint16 _scriptSize;
diff --git a/engines/kyra/sequences_eob2.cpp b/engines/kyra/sequences_eob2.cpp
index dcf293bd52..37aca45237 100644
--- a/engines/kyra/sequences_eob2.cpp
+++ b/engines/kyra/sequences_eob2.cpp
@@ -466,6 +466,7 @@ void DarkMoonEngine::seq_playFinale() {
DarkmoonSequenceHelper sq(_system, this, _screen, DarkmoonSequenceHelper::kFinale, _finaleStrings, _cpsFilesFinale, _palFilesFinale, _shapesFinale, _seqFinale);
_screen->setCurPage(0);
+ _screen->setFont(Screen::FID_8_FNT);
_sound->loadSoundFile("FINALE1");
_sound->playTrack(0);
@@ -936,10 +937,11 @@ DarkmoonSequenceHelper::DarkmoonSequenceHelper(OSystem *system, DarkMoonEngine *
_fadePalRate = 0;
_screen->setScreenPalette(*_palettes[0]);
+ _screen->setFont(Screen::FID_8_FNT);
_screen->hideMouse();
- _system->delayMillis(150);
- _vm->resetSkipFlag(true);
+ _vm->delay(150);
+ _vm->_eventList.clear();
_vm->_allowSkip = true;
}
@@ -1274,7 +1276,7 @@ void DarkmoonSequenceHelper::waitForSongNotifier(int index, bool introUpdateAnim
void DarkMoonEngine::seq_nightmare() {
Screen::FontId of = _screen->setFont(Screen::FID_6_FNT);
- _screen->copyRegion(0, 0, 0, 120, 176, 24, 14, 2, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 0, 0, 120, 176, 24, 12, 2, Screen::CR_NO_P_CHECK);
initDialogueSequence();
gui_drawDialogueBox();
diff --git a/engines/kyra/sprites_eob.cpp b/engines/kyra/sprites_eob.cpp
index bd5ab27ead..eca053017c 100644
--- a/engines/kyra/sprites_eob.cpp
+++ b/engines/kyra/sprites_eob.cpp
@@ -471,7 +471,8 @@ void EobCoreEngine::drawDoor(int index) {
if (_flags.gameID == GI_EOB1 && s == 0x85)
s = 0;
- assert((_flags.gameID == GI_EOB1 && s < 32) || (_flags.gameID == GI_EOB2 && s < 53));
+ if (s >= _dscDoorShpIndexSize)
+ return;
int type = _dscDoorShpIndex[s];
int d = _dscDimMap[index];
diff --git a/engines/kyra/staticres_eob.cpp b/engines/kyra/staticres_eob.cpp
index 274feba4fa..4ff879c69c 100644
--- a/engines/kyra/staticres_eob.cpp
+++ b/engines/kyra/staticres_eob.cpp
@@ -254,7 +254,7 @@ void LolEobBaseEngine::initStaticResource() {
_dscBlockMap = _staticres->loadRawData(kLolEobCommonDscBlockMap, temp);
_dscBlockIndex = (const int8 *)_staticres->loadRawData(kLolEobCommonDscBlockIndex, temp);
_dscDimMap = _staticres->loadRawData(kLolEobCommonDscDimMap, temp);
- _dscDoorShpIndex = _staticres->loadRawData(kLolEobCommonDscDoorShapeIndex, temp);
+ _dscDoorShpIndex = _staticres->loadRawData(kLolEobCommonDscDoorShapeIndex, _dscDoorShpIndexSize);
_dscDoorY2 = _staticres->loadRawData(kLolEobCommonDscDoorY2, temp);
_moreStrings = _staticres->loadStrings(kLolEobCommonMoreStrings, temp);
}
@@ -1010,14 +1010,14 @@ void EobCoreEngine::initSpells() {
ec2(empty);
ec(empty);
ec2(empty);
- ec1(lightningBoltPassive);
- ec2(unk1Passive);
+ ec1(monster_lightningBolt);
+ ec2(monster_fireball1);
ec2(empty);
- ec2(unk2Passive);
- ec(deathSpellPassive);
- ec(disintegratePassive);
- ec2(causeCriticalWoundsPassive);
- ec2(fleshToStonePassive);
+ ec2(monster_fireball2);
+ ec(monster_deathSpell);
+ ec(monster_disintegrate);
+ ec2(monster_causeCriticalWounds);
+ ec2(monster_fleshToStone);
_spells = new EobSpell[_numSpells];
memset(_spells, 0, _numSpells * sizeof(EobSpell));
diff --git a/engines/kyra/text_eob.cpp b/engines/kyra/text_eob.cpp
index a2cc5c6e00..0fe01df770 100644
--- a/engines/kyra/text_eob.cpp
+++ b/engines/kyra/text_eob.cpp
@@ -619,6 +619,7 @@ void TextDisplayer_Eob::textPageBreak() {
screen()->fillRect(x, y, x + w - 1, y + 8, _textDimData[screen()->curDimIndex()].color2);
clearCurDim();
+ _screen->updateScreen();
if (vm()->game() == GI_LOL)
vm()->_timer->pauseSingleTimer(11, false);
diff --git a/engines/kyra/timer_eob.cpp b/engines/kyra/timer_eob.cpp
index f36688df39..277e04e769 100644
--- a/engines/kyra/timer_eob.cpp
+++ b/engines/kyra/timer_eob.cpp
@@ -390,6 +390,7 @@ void EobCoreEngine::timerUpdateTeleporters(int timerNum) {
void EobCoreEngine::timerUpdateFoodStatus(int timerNum) {
for (int i = 0; i < 6; i++) {
+ // Ring of Sustenance check
if (checkInventoryForRings(i, 2))
continue;
EobCharacter *c = &_characters[i];