From dc4c06e954ee0d09f8227e6cf3bf4f083a43eedf Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 21 Sep 2007 19:12:53 +0000 Subject: Several bug fixes for Mickey's Space Adventure: - Fixed a logic bug, where it was possible that the planets were not initialized properly when flipping XL30's switch without holding any crystal. Note that this breaks older Mickey saved games - Fixed a bug with the initialization of the planet data, where the random number assigned to each planet could go out of logical bounds - Save games are saved with the correct extension now (e.g. mickey.s01 instead of mickey.s 1) - Some save game messages which were not shown are shown now - Disabled two problematic objects (the scale in Mickey's house and the rock in Jupiter) so they are not shown for now, as our current picture showing algorithm crashes when trying to display them svn-id: r29007 --- engines/agi/preagi_mickey.cpp | 32 +++++++++++++++++++------------- engines/agi/preagi_mickey.h | 1 + 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index edd1b12406..264c0ac8b0 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -216,8 +216,8 @@ void Mickey::printExeStr(int ofs) { readExe(ofs, buffer, sizeof(buffer)); printStr((char *)buffer); - //_vm->_gfx->doUpdate(); - //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop + _vm->_gfx->doUpdate(); + _vm->_system->updateScreen(); // TODO: this should go in the game's main loop } void Mickey::printExeMsg(int ofs) { @@ -693,6 +693,14 @@ void Mickey::drawObj(ENUM_MSA_OBJECT iObj, int x0, int y0) { if (iObj == IDI_MSA_OBJECT_CRYSTAL) _vm->_picture->setPictureFlags(kPicFStep); + // HACK: attempting to draw the scale in Mickey's house causes a crash, so we don't draw it + if (iObj == IDI_MSA_OBJECT_SCALE) + return; + + // HACK: attempting to draw the rock in Jupiter causes a crash, so we don't draw it + if (iObj == IDI_MSA_OBJECT_ROCK_1 || iObj == IDI_MSA_OBJECT_ROCK_2 || iObj == IDI_MSA_OBJECT_ROCK_3) + return; + _vm->_picture->setOffset(x0, y0); _vm->_picture->decodePicture(buffer, size, false, IDI_MSA_PIC_WIDTH, IDI_MSA_PIC_HEIGHT); _vm->_picture->setOffset(0, 0); @@ -958,7 +966,7 @@ bool Mickey::loadGame() { return false; // load game - sprintf(szFile, "%s.s%2d", _vm->getTargetName().c_str(), sel); + sprintf(szFile, "%s.s%02d", _vm->getTargetName().c_str(), sel); if (!(infile = _vm->getSaveFileMan()->openForLoading(szFile))) { printExeStr(IDO_MSA_CHECK_DISK_DRIVE); if (_vm->getSelection(kSelAnyKey) == 0) @@ -1004,7 +1012,7 @@ void Mickey::saveGame() { return; // save game - sprintf(szFile, "%s.s%2d", _vm->getTargetName().c_str(), sel); + sprintf(szFile, "%s.s%02d", _vm->getTargetName().c_str(), sel); if (!(outfile = _vm->getSaveFileMan()->openForSaving(szFile))) { printExeStr(IDO_MSA_CHECK_DISK_DRIVE); if (_vm->getSelection(kSelAnyKey) == 0) @@ -1166,10 +1174,11 @@ void Mickey::gameOver() { void Mickey::flipSwitch() { if (game.fHasXtal || game.nXtals) { - if (!game.fStoryShown) { + if (!game.fStoryShown) printStory(); + + if (!game.fPlanetsInitialized) randomize(); - } // activate screen animation game.fAnimXL30 = true; @@ -1260,7 +1269,7 @@ void Mickey::randomize() { } else { done = false; while (!done) { - iPlanet = _vm->rnd(IDI_MSA_MAX_PLANET); + iPlanet = _vm->rnd(IDI_MSA_MAX_PLANET - 2); // Earth (planet 0) is excluded done = true; for (int j = 0; j < IDI_MSA_MAX_PLANET; j++) { if (game.iPlanetXtal[j] == iPlanet) { @@ -1273,14 +1282,11 @@ void Mickey::randomize() { game.iPlanetXtal[i] = iPlanet; - done = false; - while (!done) { - iHint = _vm->rnd(5); - done = true; - } - + iHint = _vm->rnd(5) - 1; // clues are 0-4 game.iClue[i] = IDO_MSA_NEXT_PIECE[iPlanet][iHint]; } + + game.fPlanetsInitialized = true; } void Mickey::flashScreen() { diff --git a/engines/agi/preagi_mickey.h b/engines/agi/preagi_mickey.h index 3b45fb8630..24a07d376e 100644 --- a/engines/agi/preagi_mickey.h +++ b/engines/agi/preagi_mickey.h @@ -708,6 +708,7 @@ struct MSA_GAME { bool fShipDoorOpen; bool fFlying; bool fStoryShown; + bool fPlanetsInitialized; bool fTempleDoorOpen; bool fItem[IDI_MSA_MAX_ITEM]; -- cgit v1.2.3