diff options
author | Strangerke | 2013-04-03 23:57:38 +0200 |
---|---|---|
committer | Strangerke | 2013-04-03 23:58:11 +0200 |
commit | 4b21ec23d0e445d8364bcab5732318734f4c27cc (patch) | |
tree | 9b6236f189d1e767a2eeda0aa0b499db9f75ee30 /engines/hopkins/graphics.cpp | |
parent | f019d5a4881c8ee42fa36ef0613d9e82b3b36297 (diff) | |
download | scummvm-rg350-4b21ec23d0e445d8364bcab5732318734f4c27cc.tar.gz scummvm-rg350-4b21ec23d0e445d8364bcab5732318734f4c27cc.tar.bz2 scummvm-rg350-4b21ec23d0e445d8364bcab5732318734f4c27cc.zip |
HOPKINS: Refactor searchCat to remove the use of g_PTRNUL, add a parameter to clarify the result of the function
Diffstat (limited to 'engines/hopkins/graphics.cpp')
-rw-r--r-- | engines/hopkins/graphics.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 9d1093edf9..a903462ecb 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -201,7 +201,9 @@ void GraphicsManager::loadScreen(const Common::String &file) { assert(!_videoPtr); bool flag = true; - if (_vm->_fileManager->searchCat(file, RES_PIC) == g_PTRNUL) { + bool fileFoundFl = false; + _vm->_fileManager->searchCat(file, RES_PIC, fileFoundFl); + if (!fileFoundFl) { if (!f.open(file)) error("loadScreen - %s", file.c_str()); @@ -1680,17 +1682,21 @@ void GraphicsManager::displayFont(byte *surface, const byte *spriteData, int xp, void GraphicsManager::initScreen(const Common::String &file, int mode, bool initializeScreen) { Common::String filename = file + ".ini"; - byte *ptr = _vm->_fileManager->searchCat(filename, RES_INI); + bool fileFoundFl = false; - if (ptr == g_PTRNUL) { + byte *ptr = _vm->_fileManager->searchCat(filename, RES_INI, fileFoundFl); + + if (!fileFoundFl) { ptr = _vm->_fileManager->loadFile(filename); } + if (!mode) { filename = file + ".spr"; _vm->_globals->_levelSpriteBuf = _vm->_globals->freeMemory(_vm->_globals->_levelSpriteBuf); if (initializeScreen) { - _vm->_globals->_levelSpriteBuf = _vm->_fileManager->searchCat(filename, RES_SLI); - if (_vm->_globals->_levelSpriteBuf) { + fileFoundFl = false; + _vm->_globals->_levelSpriteBuf = _vm->_fileManager->searchCat(filename, RES_SLI, fileFoundFl); + if (!fileFoundFl) { _vm->_globals->_levelSpriteBuf = _vm->_fileManager->loadFile(filename); } else { _vm->_globals->_levelSpriteBuf = _vm->_fileManager->loadFile("RES_SLI.RES"); @@ -1724,8 +1730,9 @@ void GraphicsManager::initScreen(const Common::String &file, int mode, bool init _vm->_globals->_answerBuffer = _vm->_globals->freeMemory(_vm->_globals->_answerBuffer); filename = file + ".rep"; - byte *dataP = _vm->_fileManager->searchCat(filename, RES_REP); - if (dataP == g_PTRNUL) + fileFoundFl = false; + byte *dataP = _vm->_fileManager->searchCat(filename, RES_REP, fileFoundFl); + if (!fileFoundFl) dataP = _vm->_fileManager->loadFile(filename); _vm->_globals->_answerBuffer = dataP; |