diff options
author | Sven Hesse | 2008-12-17 13:07:56 +0000 |
---|---|---|
committer | Sven Hesse | 2008-12-17 13:07:56 +0000 |
commit | d0e2107b7e07587f732ae1f882b8ddae8c5ef5bd (patch) | |
tree | f0d6333ed40ff3be9c7906a49532d441615e55eb /engines/gob | |
parent | 774773b7cd02e3c6932095af4905a25eb1862392 (diff) | |
download | scummvm-rg350-d0e2107b7e07587f732ae1f882b8ddae8c5ef5bd.tar.gz scummvm-rg350-d0e2107b7e07587f732ae1f882b8ddae8c5ef5bd.tar.bz2 scummvm-rg350-d0e2107b7e07587f732ae1f882b8ddae8c5ef5bd.zip |
Only do the no-cd-workaround if all resource files can be found
svn-id: r35409
Diffstat (limited to 'engines/gob')
-rw-r--r-- | engines/gob/game.cpp | 2 | ||||
-rw-r--r-- | engines/gob/game.h | 4 | ||||
-rw-r--r-- | engines/gob/game_v6.cpp | 12 | ||||
-rw-r--r-- | engines/gob/inter_v6.cpp | 2 | ||||
-rw-r--r-- | engines/gob/saveload.h | 3 | ||||
-rw-r--r-- | engines/gob/saveload_v6.cpp | 19 |
6 files changed, 36 insertions, 6 deletions
diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 47da5cf8f4..1a7c31eec0 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -81,6 +81,8 @@ Game::Game(GobEngine *vm) : _vm(vm) { _preventScroll = false; _scrollHandleMouse = false; + _noCd = false; + _tempStr[0] = 0; _curImaFile[0] = 0; _collStr[0] = 0; diff --git a/engines/gob/game.h b/engines/gob/game.h index 8a7c483bc0..655180f4b4 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -95,6 +95,8 @@ public: bool _preventScroll; bool _scrollHandleMouse; + bool _noCd; + Game(GobEngine *vm); virtual ~Game(); @@ -307,6 +309,8 @@ public: uint16 right, uint16 bottom, int16 flags, int16 key, uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0); + virtual void prepareStart(void); + virtual void pushCollisions(char all); virtual int16 checkCollisions(byte handleMouse, int16 deltaTime, diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index 0ba232677a..0b764c399e 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -25,6 +25,7 @@ #include "common/endian.h" #include "common/stream.h" +#include "common/file.h" #include "gob/gob.h" #include "gob/game.h" @@ -154,6 +155,17 @@ int16 Game_v6::addNewCollision(int16 id, uint16 left, uint16 top, return 0; } +void Game_v6::prepareStart(void) { + _noCd = false; + + if (Common::File::exists("cd1.itk") && Common::File::exists("cd2.itk") && + Common::File::exists("cd3.itk") && Common::File::exists("cd4.itk")) { + _noCd = true; + } + + Game_v2::prepareStart(); +} + void Game_v6::pushCollisions(char all) { Collision *srcPtr; Collision *destPtr; diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index 1571546faa..e61e78cbbb 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -769,7 +769,7 @@ void Inter_v6::o6_openItk() { // (it checks CD1.ITK - CD4.ITK and the first that's found determines // the CD number), while its NO_CD modus wants everything in CD1.ITK. // So we just open the other ITKs, too. - if (!scumm_stricmp(fileName, "cd1.itk")) { + if (_vm->_game->_noCd && !scumm_stricmp(fileName, "CD1.ITK")) { _vm->_dataIO->openDataFile("CD2.ITK", true); _vm->_dataIO->openDataFile("CD3.ITK", true); _vm->_dataIO->openDataFile("CD4.ITK", true); diff --git a/engines/gob/saveload.h b/engines/gob/saveload.h index 593c13f374..467403bdb8 100644 --- a/engines/gob/saveload.h +++ b/engines/gob/saveload.h @@ -413,7 +413,8 @@ protected: class SaveLoad_v6 : public SaveLoad { public: enum SaveType { - kSaveNone + kSaveNone, + kSaveNoCD }; SaveLoad_v6(GobEngine *vm, const char *targetName); diff --git a/engines/gob/saveload_v6.cpp b/engines/gob/saveload_v6.cpp index 9e49a3ea63..cc233a36ba 100644 --- a/engines/gob/saveload_v6.cpp +++ b/engines/gob/saveload_v6.cpp @@ -27,12 +27,13 @@ #include "gob/gob.h" #include "gob/saveload.h" +#include "gob/game.h" namespace Gob { SaveLoad_v6::SaveFile SaveLoad_v6::_saveFiles[] = { {"mdo.def", 0, kSaveModeExists, kSaveNone}, - {"NO_CD.TXT", 0, kSaveModeExists, kSaveNone} + {"NO_CD.TXT", 0, kSaveModeExists, kSaveNoCD} }; SaveLoad_v6::SaveLoad_v6(GobEngine *vm, const char *targetName) : @@ -45,11 +46,21 @@ SaveLoad_v6::~SaveLoad_v6() { SaveLoad::SaveMode SaveLoad_v6::getSaveMode(const char *fileName) { fileName = stripPath(fileName); - for (int i = 0; i < ARRAYSIZE(_saveFiles); i++) + int i; + for (i = 0; i < ARRAYSIZE(_saveFiles); i++) if (!scumm_stricmp(fileName, _saveFiles[i].sourceName)) - return _saveFiles[i].mode; + break; - return kSaveModeNone; + if (i >= ARRAYSIZE(_saveFiles)) + return kSaveModeNone; + + if (_saveFiles[i].type != kSaveNoCD) + return _saveFiles[i].mode; + + if (_vm->_game->_noCd) + return kSaveModeExists; + else + return kSaveModeNone; } } // End of namespace Gob |