diff options
Diffstat (limited to 'engines/hopkins')
-rw-r--r-- | engines/hopkins/computer.cpp | 20 | ||||
-rw-r--r-- | engines/hopkins/computer.h | 38 | ||||
-rw-r--r-- | engines/hopkins/files.h | 5 |
3 files changed, 55 insertions, 8 deletions
diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index b8ac7d209c..f15f292372 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -290,9 +290,19 @@ void ComputerManager::showComputer(ComputerEnum mode) { * Load Menu data */ void ComputerManager::loadMenu() { - _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "COMPUTAN.TXT"); - byte *ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); - byte *tmpPtr = ptr; + char *ptr; + if (!_vm->_fileManager.fileExists(_vm->_globals.HOPLINK, "COMPUTAN.TXT")) { + _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "COMPUTAN.TXT"); + ptr = (char *)_vm->_fileManager.loadFile(_vm->_globals._curFilename); + } else if (_vm->_globals._language == LANG_FR) { + ptr = (char *)_vm->_globals.allocMemory(sizeof(_frenchText)); + strcpy(ptr, _frenchText); + } else { + ptr = (char *)_vm->_globals.allocMemory(sizeof(_englishText)); + strcpy(ptr, _englishText); + } + + char *tmpPtr = ptr; int lineNum = 0; int strPos; bool loopCond = false; @@ -306,7 +316,7 @@ void ComputerManager::loadMenu() { _menuText[lineNum]._actvFl = 1; strPos = 0; while (strPos <= 89) { - byte curChar = tmpPtr[strPos + 2]; + char curChar = tmpPtr[strPos + 2]; if (curChar == '%' || curChar == 10) break; _menuText[lineNum]._line[strPos++] = curChar; @@ -319,7 +329,7 @@ void ComputerManager::loadMenu() { } tmpPtr = tmpPtr + 1; } while (!loopCond); - ptr = _vm->_globals.freeMemory(ptr); + _vm->_globals.freeMemory((byte *)ptr); } void ComputerManager::TXT4(int xp, int yp, int textIdx) { diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index d52cc28799..2d82b56f15 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -31,6 +31,44 @@ namespace Hopkins { class HopkinsEngine; +static char _englishText[] = + "% ****** FBI COMPUTER NUMBER 4985 ****** J.HOPKINS COMPUTER ******\n" + "% ****** FBI COMPUTER NUMBER 4998 ****** S.COLLINS COMPUTER ******\n" + "% ****** FBI COMPUTER NUMBER 4997 ****** ACCES FREE COMPUTER ******\n" + "% PASSWORD IS: ALLFREE\n% ENTER CURRENT PASSWORD\n" + "% ****** ACCES DENIED ******\n" + "% 1) *** GAME ***\n" + "% 0) QUIT COMPUTER\n" + "% 2) STRANGE CADAVER\n" + "% 3) STRANGE CADAVER\n" + "% 4) SENATOR FERGUSSON\n" + "% 5) DOG KILLER\n" + "% 2) SCIENTIST KIDNAPPED.\n" + "% 3) SCIENTIST KIDNAPPED (next).\n" + "% 4) SCIENTIST KIDNAPPED (next).\n" + "% 5) SCIENTIST KIDNAPPED (next).\n" + "% 6) SCIENTIST KIDNAPPED (next).\n" + "%% fin\n"; +static char _frenchText[] = + "% ****** FBI COMPUTER NUMBER 4985 ****** J.HOPKINS COMPUTER ******\n" + "% ****** FBI COMPUTER NUMBER 4998 ****** S.COLLINS COMPUTER ******\n" + "% ****** FBI COMPUTER NUMBER 4997 ****** ACCES FREE COMPUTER ******\n" + "% PASSWORD IS: ALLFREE\n" + "% ENTER CURRENT PASSWORD\n" + "% ****** ACCES DENIED ******\n" + "% 1) *** CASSE BRIQUE ***\n" + "% 0) QUITTER L'ORDINATEUR\n" + "% 2) CADAVRE SANS TETE\n" + "% 3) CADAVRE SANS TETE\n" + "% 4) AGRESSION DU SENATEUR\n" + "% 5) LES CHIENS TUEURS\n" + "% 2) DISPARITIONS DE CHERCHEURS.\n" + "% 3) DISPARITIONS (suite).\n" + "% 4) DISPARITIONS (suite).\n" + "% 5) DISPARITIONS (suite).\n" + "% 6) DISPARITIONS (suite).\n" + "%% fin\n"; + struct MenuItem { bool _actvFl; int _lineSize; diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index 3328a66ace..427d61e183 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -33,14 +33,13 @@ namespace Hopkins { class HopkinsEngine; class FileManager { -private: - bool fileExists(const Common::String &folder, const Common::String &file); public: HopkinsEngine *_vm; -public: + FileManager(); void setParent(HopkinsEngine *vm); + bool fileExists(const Common::String &folder, const Common::String &file); byte *loadFile(const Common::String &file); int readStream(Common::ReadStream &stream, void *buf, size_t nbytes); void initCensorship(); |