diff options
author | Strangerke | 2012-12-24 11:36:53 +0100 |
---|---|---|
committer | Strangerke | 2012-12-24 11:36:53 +0100 |
commit | 8c1f422bd68fe23c4e73ba3d3b13de028c905134 (patch) | |
tree | 1b4f33a4510fffb40283c86c2f8108834a9a0496 | |
parent | 8cce2721177422a65e73c9f178746403c801f242 (diff) | |
download | scummvm-rg350-8c1f422bd68fe23c4e73ba3d3b13de028c905134.tar.gz scummvm-rg350-8c1f422bd68fe23c4e73ba3d3b13de028c905134.tar.bz2 scummvm-rg350-8c1f422bd68fe23c4e73ba3d3b13de028c905134.zip |
HOPKINS: Remove magic values used to check language, some renaming and refactoring
-rw-r--r-- | engines/hopkins/computer.cpp | 6 | ||||
-rw-r--r-- | engines/hopkins/dialogs.cpp | 42 | ||||
-rw-r--r-- | engines/hopkins/files.cpp | 8 | ||||
-rw-r--r-- | engines/hopkins/globals.cpp | 20 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 6 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 84 | ||||
-rw-r--r-- | engines/hopkins/hopkins.h | 2 | ||||
-rw-r--r-- | engines/hopkins/menu.cpp | 14 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 12 | ||||
-rw-r--r-- | engines/hopkins/script.cpp | 189 | ||||
-rw-r--r-- | engines/hopkins/script.h | 2 | ||||
-rw-r--r-- | engines/hopkins/sound.cpp | 24 | ||||
-rw-r--r-- | engines/hopkins/sound.h | 4 | ||||
-rw-r--r-- | engines/hopkins/talk.cpp | 18 |
14 files changed, 216 insertions, 215 deletions
diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index c3ab69c3ad..a0354e84ff 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -526,11 +526,11 @@ void ComputerManager::readText(int idx) { _vm->_eventsManager._escKeyFl = false; - if (_vm->_globals.FR == 0) + if (_vm->_globals._language == LANG_EN) _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPKAN.TXT"); - else if (_vm->_globals.FR == 1) + else if (_vm->_globals._language == LANG_FR) _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPK.TXT"); - else if (_vm->_globals.FR == 2) + else if (_vm->_globals._language == LANG_SP) _vm->_fileManager.constructFilename(_vm->_globals.HOPLINK, "THOPKES.TXT"); ptr = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index a22f01470b..0e2dee7446 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -59,11 +59,11 @@ void DialogsManager::showOptionsDialog() { doneFlag = false; _vm->_eventsManager.changeMouseCursor(0); _vm->_eventsManager.VBL(); - if (_vm->_globals.FR == 1) + if (_vm->_globals._language == LANG_FR) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIFR.SPR"); - else if (!_vm->_globals.FR) + else if (_vm->_globals._language == LANG_EN) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIAN.SPR"); - else if (_vm->_globals.FR == 2) + else if (_vm->_globals._language == LANG_SP) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "OPTIES.SPR"); _vm->_globals.OPTION_SPR = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER); @@ -129,7 +129,7 @@ void DialogsManager::showOptionsDialog() { } } - if (!_vm->_soundManager.VOICEOFF) { + if (!_vm->_soundManager._voiceOffFl) { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 300 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 327 && mousePos.y <= 192) { ++_vm->_soundManager.VOICEVOL; @@ -143,7 +143,7 @@ void DialogsManager::showOptionsDialog() { _vm->_soundManager.updateScummVMSoundSettings(); } - if (!_vm->_soundManager.VOICEOFF && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { + if (!_vm->_soundManager._voiceOffFl && mousePos.x >= _vm->_graphicsManager.ofscroll + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 358 && mousePos.y <= 192) { --_vm->_soundManager.VOICEVOL; if (_vm->_soundManager.VOICEVOL >= 0) _vm->_soundManager.PLAY_SOUND("bruit2.wav"); @@ -158,11 +158,11 @@ void DialogsManager::showOptionsDialog() { if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { if (mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 219) - _vm->_soundManager.TEXTOFF = _vm->_soundManager.TEXTOFF != 1; + _vm->_soundManager._textOffFl = !_vm->_soundManager._textOffFl; if (mousePos.x >= _vm->_graphicsManager.ofscroll + 431) { if (mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager.ofscroll + 489 && mousePos.y <= 192) { - _vm->_soundManager.VOICEOFF = _vm->_soundManager.VOICEOFF != 1; + _vm->_soundManager._voiceOffFl = !_vm->_soundManager._voiceOffFl; _vm->_soundManager.updateScummVMSoundSettings(); } @@ -252,8 +252,8 @@ void DialogsManager::showOptionsDialog() { else if (_vm->_globals._speed == 3) _vm->_globals.opt_vitesse = 4; - _vm->_globals.opt_txt = !_vm->_soundManager.TEXTOFF ? 7 : 8; - _vm->_globals.opt_voice = !_vm->_soundManager.VOICEOFF ? 7 : 8; + _vm->_globals.opt_txt = !_vm->_soundManager._textOffFl ? 7 : 8; + _vm->_globals.opt_voice = !_vm->_soundManager._voiceOffFl ? 7 : 8; _vm->_globals.opt_sound = !_vm->_soundManager.SOUNDOFF ? 7 : 8; _vm->_globals.opt_music = !_vm->_soundManager.MUSICOFF ? 7 : 8; @@ -320,14 +320,14 @@ LABEL_7: _vm->_globals._disableInventFl = true; _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); - switch (_vm->_globals.FR) { - case 0: + switch (_vm->_globals._language) { + case LANG_EN: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTAN.SPR"); break; - case 1: + case LANG_FR: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTFR.SPR"); break; - case 2: + case LANG_SP: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "INVENTES.SPR"); break; } @@ -405,14 +405,14 @@ LABEL_7: if (_vm->_eventsManager._mouseCursorId == 8) v20 = true; if (!v20) { - _vm->_scriptManager.TRAVAILOBJET = 1; + _vm->_scriptManager.TRAVAILOBJET = true; _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals._curObjectIndex; _vm->_globals.SAUVEGARDE->data[svField8] = _vm->_globals._inventory[v13]; _vm->_globals.SAUVEGARDE->data[svField9] = _vm->_eventsManager._mouseCursorId; _vm->_objectsManager.OPTI_OBJET(); - _vm->_scriptManager.TRAVAILOBJET = 0; + _vm->_scriptManager.TRAVAILOBJET = false; - if (_vm->_soundManager.VOICEOFF == 1) { + if (_vm->_soundManager._voiceOffFl) { do _vm->_eventsManager.VBL(); while (!_vm->_globals.SORTIE && _vm->_eventsManager.getMouseButton() != 1); @@ -629,14 +629,14 @@ void DialogsManager::showSaveLoad(int a1) { hopkinsSavegameHeader header; byte *thumb; - switch (_vm->_globals.FR) { - case 0: + switch (_vm->_globals._language) { + case LANG_EN: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVEAN.SPR"); break; - case 1: + case LANG_FR: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVEFR.SPR"); break; - case 2: + case LANG_SP: _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "SAVEES.SPR"); break; } @@ -646,7 +646,7 @@ void DialogsManager::showSaveLoad(int a1) { _vm->_objectsManager.SL_SPR2 = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 483, 360, 0); - if (_vm->_globals.FR) { + if (_vm->_globals._language == LANG_FR) { if (a1 == 1) _vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager.SL_SPR, _vm->_eventsManager._startPos.x + 525, 375, 1); if (a1 == 2) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index c888bcbd67..6fefd1eb22 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -221,14 +221,14 @@ byte *FileManager::searchCat(const Common::String &file, int a2) { break; case 9: - switch (_vm->_globals.FR) { - case 0: + switch (_vm->_globals._language) { + case LANG_EN: constructFilename(_vm->_globals.HOPLINK, "RES_VAN.CAT"); break; - case 1: + case LANG_FR: constructFilename(_vm->_globals.HOPLINK, "RES_VFR.CAT"); break; - case 2: + case LANG_SP: constructFilename(_vm->_globals.HOPLINK, "RES_VES.CAT"); break; } diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index b5c2d44d4d..dc9254b6e6 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -114,7 +114,7 @@ Globals::Globals() { Common::fill((byte *)&Tri[i], (byte *)&Tri[i] + sizeof(TriItem), 0); // Initialise fields - FR = 0; + _language = LANG_EN; SVGA = 2; _internetFl = true; @@ -137,7 +137,7 @@ Globals::Globals() { nbrligne = 0; largeur_boite = 0; hauteur_boite = 0; - FORET = false; + forest = false; _objectWidth = _objectHeight = 0; HELICO = 0; _catalogPos = 0; @@ -303,13 +303,13 @@ void Globals::setConfig() { switch (_vm->getLanguage()) { case Common::EN_ANY: case Common::PL_POL: - FR = 0; + _language = LANG_EN; break; case Common::FR_FRA: - FR = 1; + _language = LANG_FR; break; case Common::ES_ESP: - FR = 2; + _language = LANG_SP; break; default: warning("Unknown language in internal language mapping"); @@ -322,16 +322,16 @@ void Globals::setConfig() { _internetFl = false; // End of CHECKME - switch (FR) { - case 0: + switch (_language) { + case LANG_EN: FICH_ZONE = "ZONEAN.TXT"; FICH_TEXTE = "TEXTEAN.TXT"; break; - case 1: + case LANG_FR: FICH_ZONE = "ZONE01.TXT"; FICH_TEXTE = "TEXTE01.TXT"; break; - case 2: + case LANG_SP: FICH_ZONE = "ZONEES.TXT"; FICH_TEXTE = "TEXTEES.TXT"; break; @@ -418,7 +418,7 @@ void Globals::clearAll() { ADR_FICHIER_OBJ = g_PTRNUL; FORETSPR = g_PTRNUL; - FORET = false; + forest = false; cache_souris = allocMemory(2500); GESTE = g_PTRNUL; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index e00796ea23..5daf982456 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -295,6 +295,8 @@ struct CreditItem { byte _line[50]; }; +enum Language { LANG_EN = 0, LANG_FR = 1, LANG_SP = 2}; + class HopkinsEngine; /** @@ -326,7 +328,7 @@ public: HopkinsItem Hopkins[70]; int _inventory[36]; TriItem Tri[51]; - int FR; + Language _language; int SVGA; bool _internetFl; bool PUBEXIT; @@ -384,7 +386,7 @@ public: int hauteur_boite; int GESTE_FLAG; byte *FORETSPR; - bool FORET; + bool forest; byte *COUCOU; int16 *chemin; byte *cache_souris; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ea715001ac..d13633d5b4 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -97,7 +97,7 @@ Common::Error HopkinsEngine::run() { _globals.setConfig(); _fileManager.initCensorship(); - INIT_SYSTEM(); + initializeSystem(); _soundManager.WSOUND_INIT(); @@ -219,10 +219,12 @@ bool HopkinsEngine::runWin95Demo() { case 3: if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); - if (_globals.FR == 1) + if (_globals._language == LANG_FR) _graphicsManager.loadImage("fondfr"); - if (!_globals.FR) + else if (_globals._language == LANG_EN) _graphicsManager.loadImage("fondan"); + else if (_globals._language == LANG_SP) + _graphicsManager.loadImage("fondes"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); @@ -331,9 +333,9 @@ bool HopkinsEngine::runWin95Demo() { _globals.Max_Perso_Y = 450; _globals.Max_Ligne_Long = 20; if (_globals.SAUVEGARDE->data[svField225]) { - if (_globals.FR == 1) + if (_globals._language == LANG_FR) _graphicsManager.loadImage("ENDFR"); - else if (!_globals.FR) + else _graphicsManager.loadImage("ENDUK"); _graphicsManager.FADE_INW(); _eventsManager.mouseOn(); @@ -542,11 +544,11 @@ bool HopkinsEngine::runLinuxDemo() { case 3: if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); - if (_globals.FR == 1) + if (_globals._language == LANG_FR) _graphicsManager.loadImage("fondfr"); - if (!_globals.FR) + else if (_globals._language == LANG_EN) _graphicsManager.loadImage("fondan"); - if (_globals.FR == 2) + else if (_globals._language == LANG_SP) _graphicsManager.loadImage("fondes"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); @@ -1229,7 +1231,7 @@ bool HopkinsEngine::runOS2Full() { _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; - _globals.FORET = 1; + _globals.forest = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals.SORTIE); _soundManager.WSOUND(13); @@ -1242,7 +1244,7 @@ bool HopkinsEngine::runOS2Full() { _globals.NOSPRECRAN = false; if (_globals.SORTIE < 35 || _globals.SORTIE > 49 ) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); - _globals.FORET = false; + _globals.forest = false; _soundManager.DEL_SAMPLE(1); } break; @@ -2117,7 +2119,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; - _globals.FORET = true; + _globals.forest = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals.SORTIE); _soundManager.WSOUND(13); @@ -2131,7 +2133,7 @@ bool HopkinsEngine::runBeOSFull() { _globals.NOSPRECRAN = false; if ((_globals.SORTIE < 35) || (_globals.SORTIE > 49)) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); - _globals.FORET = false; + _globals.forest = false; _soundManager.DEL_SAMPLE(1); } break; @@ -2657,10 +2659,12 @@ bool HopkinsEngine::runWin95full() { case 3: if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); - if (_globals.FR == 1) + if (_globals._language == LANG_FR) _graphicsManager.loadImage("fondfr"); - else if (!_globals.FR) + else if (_globals._language == LANG_EN) _graphicsManager.loadImage("fondan"); + else if (_globals._language == LANG_SP) + _graphicsManager.loadImage("fondes"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); @@ -3003,7 +3007,7 @@ bool HopkinsEngine::runWin95full() { _globals.Max_Ligne_Long = 40; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; - _globals.FORET = true; + _globals.forest = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals.SORTIE); _soundManager.WSOUND(13); @@ -3016,7 +3020,7 @@ bool HopkinsEngine::runWin95full() { _globals.NOSPRECRAN = false; if (_globals.SORTIE < 35 || _globals.SORTIE > 49) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); - _globals.FORET = false; + _globals.forest = false; _soundManager.DEL_SAMPLE(1); } break; @@ -3534,11 +3538,11 @@ bool HopkinsEngine::runLinuxFull() { case 3: if (!_globals.SAUVEGARDE->data[svField170]) { _soundManager.WSOUND(3); - if (_globals.FR == 1) + if (_globals._language == LANG_FR) _graphicsManager.loadImage("fondfr"); - else if (!_globals.FR) + else if (_globals._language == LANG_EN) _graphicsManager.loadImage("fondan"); - else if (_globals.FR == 2) + else if (_globals._language == LANG_SP) _graphicsManager.loadImage("fondes"); _graphicsManager.FADE_INW(); _eventsManager.delay(500); @@ -3881,7 +3885,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.Max_Propre_Gen = 20; _globals.Max_Perso_Y = 435; _globals._disableInventFl = false; - _globals.FORET = true; + _globals.forest = true; _globals.NOSPRECRAN = true; Common::String im = Common::String::format("IM%d", _globals.SORTIE); _soundManager.WSOUND(13); @@ -3894,7 +3898,7 @@ bool HopkinsEngine::runLinuxFull() { _globals.NOSPRECRAN = false; if (_globals.SORTIE < 35 || _globals.SORTIE > 49) { _globals.FORETSPR = _globals.freeMemory(_globals.FORETSPR); - _globals.FORET = false; + _globals.forest = false; _soundManager.DEL_SAMPLE(1); } break; @@ -4366,7 +4370,7 @@ int HopkinsEngine::getRandomNumber(int maxNumber) { return _randomSource.getRandomNumber(maxNumber); } -void HopkinsEngine::INIT_SYSTEM() { +void HopkinsEngine::initializeSystem() { // Set graphics mode _graphicsManager.setGraphicalMode(SCREEN_WIDTH, SCREEN_HEIGHT); @@ -4378,20 +4382,20 @@ void HopkinsEngine::INIT_SYSTEM() { else _eventsManager._mouseLinuxFl = false; - switch (_globals.FR) { - case 0: + switch (_globals._language) { + case LANG_EN: if (!_eventsManager._mouseLinuxFl) _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUAN.SPR"); else _fileManager.constructFilename(_globals.HOPSYSTEM, "LSOUAN.SPR"); break; - case 1: + case LANG_FR: if (!_eventsManager._mouseLinuxFl) _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUFR.SPR"); else _fileManager.constructFilename(_globals.HOPSYSTEM, "LSOUFR.SPR"); break; - case 2: + case LANG_SP: _fileManager.constructFilename(_globals.HOPSYSTEM, "SOUES.SPR"); break; } @@ -4416,16 +4420,16 @@ void HopkinsEngine::INIT_SYSTEM() { _fileManager.constructFilename(_globals.HOPSYSTEM, "TETE.SPR"); _globals.TETE = _fileManager.loadFile(_globals.NFICHIER); - switch (_globals.FR) { - case 0: + switch (_globals._language) { + case LANG_EN: _fileManager.constructFilename(_globals.HOPLINK, "ZONEAN.TXT"); _globals.BUF_ZONE = _fileManager.loadFile(_globals.NFICHIER); break; - case 1: + case LANG_FR: _fileManager.constructFilename(_globals.HOPLINK, "ZONE01.TXT"); _globals.BUF_ZONE = _fileManager.loadFile(_globals.NFICHIER); break; - case 2: + case LANG_SP: _fileManager.constructFilename(_globals.HOPLINK, "ZONEES.TXT"); _globals.BUF_ZONE = _fileManager.loadFile(_globals.NFICHIER); break; @@ -4693,13 +4697,13 @@ void HopkinsEngine::PASS() { if (!getIsDemo()) return; - if (_globals.FR == 1) + if (_globals._language == LANG_FR) _graphicsManager.loadImage("ndfr"); else _graphicsManager.loadImage("nduk"); _graphicsManager.FADE_INW(); - if (_soundManager.VOICEOFF) + if (_soundManager._voiceOffFl) _eventsManager.delay(500); else _soundManager.mixVoice(628, 4); @@ -4717,7 +4721,7 @@ void HopkinsEngine::NO_DISPO(int sortie) { void HopkinsEngine::displayEndDemo() { _soundManager.WSOUND(28); - if (_globals.FR == 1) + if (_globals._language == LANG_FR) _graphicsManager.loadImage("endfr"); else _graphicsManager.loadImage("enduk"); @@ -4786,7 +4790,7 @@ void HopkinsEngine::restoreSystem() { void HopkinsEngine::PUBQUIT() { _globals.PUBEXIT = true; _graphicsManager.RESET_SEGMENT_VESA(); - _globals.FORET = false; + _globals.forest = false; _eventsManager._breakoutFl = false; _globals._disableInventFl = true; _globals.FLAG_VISIBLE = false; @@ -5288,18 +5292,18 @@ void HopkinsEngine::loadCredits() { _globals.Credit_l = 10; _globals.Credit_h = 40; _globals.Credit_step = 45; - switch (_globals.FR) { - case 0: + switch (_globals._language) { + case LANG_EN: _fileManager.constructFilename(_globals.HOPLINK, "CREAN.TXT"); break; - case 1: + case LANG_FR: _fileManager.constructFilename(_globals.HOPLINK, "CREFR.TXT"); break; - case 2: + case LANG_SP: _fileManager.constructFilename(_globals.HOPLINK, "CREES.TXT"); break; default: - error("Charge_Credits(): Unhandled language"); + error("Unhandled language"); break; } @@ -5758,7 +5762,7 @@ bool HopkinsEngine::displayAdultDisclaimer() { _graphicsManager.max_x = SCREEN_WIDTH; _graphicsManager.max_y = SCREEN_HEIGHT - 1; _eventsManager._breakoutFl = false; - _globals.FORET = false; + _globals.forest = false; _globals.FLAG_VISIBLE = false; _globals._disableInventFl = true; _globals.SORTIE = 0; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 7a58777241..5b62bb28ab 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -80,7 +80,7 @@ private: const HopkinsGameDescription *_gameDescription; Common::RandomSource _randomSource; - void INIT_SYSTEM(); + void initializeSystem(); void PASS(); void restoreSystem(); diff --git a/engines/hopkins/menu.cpp b/engines/hopkins/menu.cpp index b48409e6b7..c192bc80ce 100644 --- a/engines/hopkins/menu.cpp +++ b/engines/hopkins/menu.cpp @@ -57,7 +57,7 @@ int MenuManager::MENU() { result = 0; while (!g_system->getEventManager()->shouldQuit()) { - _vm->_globals.FORET = false; + _vm->_globals.forest = false; _vm->_eventsManager._breakoutFl = false; _vm->_globals._disableInventFl = true; _vm->_globals.FLAG_VISIBLE = false; @@ -75,19 +75,19 @@ int MenuManager::MENU() { frame1Index = 0; - if (_vm->_globals.FR == 0) + if (_vm->_globals._language == LANG_EN) _vm->_graphicsManager.loadImage("MENUAN"); - else if (_vm->_globals.FR == 1) + else if (_vm->_globals._language == LANG_FR) _vm->_graphicsManager.loadImage("MENUFR"); - else if (_vm->_globals.FR == 2) + else if (_vm->_globals._language == LANG_SP) _vm->_graphicsManager.loadImage("MENUES"); _vm->_graphicsManager.FADE_INW(); - if (_vm->_globals.FR == 0) + if (_vm->_globals._language == LANG_EN) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUAN.SPR"); - else if (_vm->_globals.FR == 1) + else if (_vm->_globals._language == LANG_FR) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUFR.SPR"); - else if (_vm->_globals.FR == 2) + else if (_vm->_globals._language == LANG_SP) _vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "MENUES.SPR"); spriteData = _vm->_objectsManager.loadSprite(_vm->_globals.NFICHIER); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 5658371c03..e870ff72c9 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2661,7 +2661,7 @@ LABEL_38: _vm->_globals.GOACTION = false; v9 = _vm->_globals.chemin; _vm->_globals.chemin = (int16 *)g_PTRNUL; - if (_vm->_globals.FORET && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { + if (_vm->_globals.forest && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { if (getSpriteY(0) <= 374 || getSpriteY(0) > 410) { v10 = getSpriteX(0); v11 = getSpriteY(0); @@ -2752,7 +2752,7 @@ void ObjectsManager::PARADISE() { result = _vm->_globals.SAUVEGARDE->data[svField1]; if (result && _vm->_globals.SAUVEGARDE->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.hideText(5); - if (!_vm->_globals.FORET || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { + if (!_vm->_globals.forest || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { if (_vm->_graphicsManager.DOUBLE_ECRAN) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager._startPos.x >= getSpriteX(0) - 320) @@ -4691,17 +4691,17 @@ void ObjectsManager::SPECIAL_INI(const Common::String &a1) { _vm->_eventsManager.VBL(); VBOB(_vm->_globals.SPRITE_ECRAN, 5, 15, 28, 1); _vm->_fontManager.hideText(9); - if (!_vm->_soundManager.TEXTOFF) { + if (!_vm->_soundManager._textOffFl) { _vm->_fontManager.initTextBuffers(9, 383, _vm->_globals.FICH_TEXTE, 220, 72, 20, 25, 6, 36, 253); - if (!_vm->_soundManager.TEXTOFF) + if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); } - if (!_vm->_soundManager.VOICEOFF) + if (!_vm->_soundManager._voiceOffFl) _vm->_soundManager.mixVoice(383, 4); _vm->_globals.SAUVEGARDE->data[svField270] = 1; _vm->_globals.SAUVEGARDE->data[svField300] = 1; _vm->_globals.SAUVEGARDE->data[svField320] = 1; - if (_vm->_soundManager.VOICEOFF == 1) { + if (_vm->_soundManager._voiceOffFl) { for (int v6 = 0; v6 <= 199; v6++) _vm->_eventsManager.VBL(); } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 3269ed5c93..d55cfe3ffd 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -35,7 +35,7 @@ namespace Hopkins { ScriptManager::ScriptManager() { - TRAVAILOBJET = 0; + TRAVAILOBJET = false; } void ScriptManager::setParent(HopkinsEngine *vm) { @@ -53,78 +53,76 @@ int ScriptManager::Traduction(byte *a1) { int v69 = *(a1 + 8); int v67 = (int16)READ_LE_UINT16(a1 + 9); int v65 = (int16)READ_LE_UINT16(a1 + 11); - int v3 = (int16)READ_LE_UINT16(a1 + 13); + int mesgId = (int16)READ_LE_UINT16(a1 + 13); v1 = 1; if (!TRAVAILOBJET) { if (_vm->_globals.SAUVEGARDE->data[svField356] == 1) { - if (v3 == 53) - v3 = 644; - if (v3 == 624) - v3 = 639; - if (v3 == 627) - v3 = 630; - if (v3 == 625) - v3 = 639; - if (v3 == 8) - v3 = 637; - if (v3 == 53) - v3 = 644; - if (v3 == 557) - v3 = 636; - if (v3 == 51) - v3 = 644; - if (v3 == 287) - v3 = 636; - if (v3 == 619) - v3 = 633; - if (v3 == 620) - v3 = 634; - if (v3 == 622) - v3 = 644; - if (v3 == 297) - v3 = 636; - if (v3 == 612) - v3 = 636; - if ((uint16)(v3 - 613) <= 1u || v3 == 134) - v3 = 636; - if (v3 == 615) - v3 = 635; - if (v3 == 618) - v3 = 632; - if (v3 == 611) - v3 = 642; - if (v3 == 610) - v3 = 641; - if (v3 == 18) - v3 = 643; - if (v3 == 602) - v3 = 645; - if (v3 == 603) - v3 = 646; - if (v3 == 604) - v3 = 647; - if (v3 == 51) - v3 = 644; - if (v3 == 607) - v3 = 650; - if (v3 == 605) - v3 = 648; - if (v3 == 606) - v3 = 649; - if (v3 == 601) - v3 = 652; - if (v3 == 37) - v3 = 636; - if (v3 == 595) - v3 = 633; - if (v3 == 596) - v3 = 634; - if (v3 == 532) - v3 = 636; - if (v3 == 599) - v3 = 636; - if (v3 == 363) - v3 = 636; + if (mesgId == 53) + mesgId = 644; + if (mesgId == 624) + mesgId = 639; + if (mesgId == 627) + mesgId = 630; + if (mesgId == 625) + mesgId = 639; + if (mesgId == 8) + mesgId = 637; + if (mesgId == 53) + mesgId = 644; + if (mesgId == 557) + mesgId = 636; + if (mesgId == 51) + mesgId = 644; + if (mesgId == 287) + mesgId = 636; + if (mesgId == 619) + mesgId = 633; + if (mesgId == 620) + mesgId = 634; + if (mesgId == 622) + mesgId = 644; + if (mesgId == 297) + mesgId = 636; + if (mesgId == 612 || mesgId == 613 || mesgId == 614 || mesgId == 134) + mesgId = 636; + if (mesgId == 615) + mesgId = 635; + if (mesgId == 618) + mesgId = 632; + if (mesgId == 611) + mesgId = 642; + if (mesgId == 610) + mesgId = 641; + if (mesgId == 18) + mesgId = 643; + if (mesgId == 602) + mesgId = 645; + if (mesgId == 603) + mesgId = 646; + if (mesgId == 604) + mesgId = 647; + if (mesgId == 51) + mesgId = 644; + if (mesgId == 607) + mesgId = 650; + if (mesgId == 605) + mesgId = 648; + if (mesgId == 606) + mesgId = 649; + if (mesgId == 601) + mesgId = 652; + if (mesgId == 37) + mesgId = 636; + if (mesgId == 595) + mesgId = 633; + if (mesgId == 596) + mesgId = 634; + if (mesgId == 532) + mesgId = 636; + if (mesgId == 599) + mesgId = 636; + if (mesgId == 363) + mesgId = 636; } if (!_vm->_soundManager.SOUNDOFF && _vm->_soundManager.SOUND_FLAG == 1) { do { @@ -133,42 +131,39 @@ int ScriptManager::Traduction(byte *a1) { _vm->_eventsManager.VBL(); } while (_vm->_soundManager.SOUND_FLAG); } - if (!_vm->_soundManager.TEXTOFF) { - _vm->_fontManager.initTextBuffers(9, v3, _vm->_globals.FICH_TEXTE, 2 * v67, 2 * v65 + 40, 20, 25, 6, v2, 253); - if (!_vm->_soundManager.TEXTOFF) + if (!_vm->_soundManager._textOffFl) { + _vm->_fontManager.initTextBuffers(9, mesgId, _vm->_globals.FICH_TEXTE, 2 * v67, 2 * v65 + 40, 20, 25, 6, v2, 253); + if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); } - if (!_vm->_soundManager.VOICEOFF) - _vm->_soundManager.mixVoice(v3, 4); + if (!_vm->_soundManager._voiceOffFl) + _vm->_soundManager.mixVoice(mesgId, 4); } - if (TRAVAILOBJET == 1) { + if (TRAVAILOBJET) { if (_vm->_globals.SAUVEGARDE->data[svField356]) { _vm->_fontManager.initTextBuffers(9, 635, _vm->_globals.FICH_TEXTE, 55, 20, 20, 25, v69, 35, 253); - if (!_vm->_soundManager.TEXTOFF) + if (!_vm->_soundManager._textOffFl) _vm->_fontManager.showText(9); - if (!_vm->_soundManager.VOICEOFF) + if (!_vm->_soundManager._voiceOffFl) _vm->_soundManager.mixVoice(635, 4); - goto LABEL_104; - } - if (_vm->_globals.FR == 1 && !_vm->_soundManager.TEXTOFF) - _vm->_fontManager.initTextBuffers(9, v3, "OBJET1.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); - else if (!_vm->_globals.FR && !_vm->_soundManager.TEXTOFF) - _vm->_fontManager.initTextBuffers(9, v3, "OBJETAN.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); - else if (_vm->_globals.FR == 2) { - if (_vm->_soundManager.TEXTOFF) { -LABEL_98: - if (!_vm->_soundManager.VOICEOFF) - _vm->_soundManager.mixVoice(v3, 5); - goto LABEL_104; + } else { + if (_vm->_globals._language == LANG_FR && !_vm->_soundManager._textOffFl) + _vm->_fontManager.initTextBuffers(9, mesgId, "OBJET1.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + else if (_vm->_globals._language == LANG_EN && !_vm->_soundManager._textOffFl) + _vm->_fontManager.initTextBuffers(9, mesgId, "OBJETAN.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + else if (_vm->_globals._language == LANG_SP && !_vm->_soundManager._textOffFl) { + _vm->_fontManager.initTextBuffers(9, mesgId, "OBJETES.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); } - _vm->_fontManager.initTextBuffers(9, v3, "OBJETES.TXT", 2 * v67, 60, 20, 25, 6, v2, 253); + + if (!_vm->_soundManager._textOffFl) + _vm->_fontManager.showText(9); + + if (!_vm->_soundManager._voiceOffFl) + _vm->_soundManager.mixVoice(mesgId, 5); } - if (!_vm->_soundManager.TEXTOFF) - _vm->_fontManager.showText(9); - goto LABEL_98; } } -LABEL_104: + if (*(a1 + 2) == 'B' && *(a1 + 3) == 'O' && *(a1 + 4) == 'B') { if (_vm->_objectsManager.DESACTIVE != true) { int v72 = *(a1 + 5); @@ -1924,11 +1919,11 @@ LABEL_1141: _vm->_objectsManager.stopBobAnimation(1); _vm->_objectsManager.setBobAnimation(2); _vm->_fontManager.hideText(9); - if (!_vm->_soundManager.TEXTOFF) { + if (!_vm->_soundManager._textOffFl) { _vm->_fontManager.initTextBuffers(9, 617, _vm->_globals.FICH_TEXTE, 91, 41, 20, 25, 3, 30, 253); _vm->_fontManager.showText(9); } - if (!_vm->_soundManager.VOICEOFF) + if (!_vm->_soundManager._voiceOffFl) _vm->_soundManager.mixVoice(617, 4); for (int i = 0; i <= 29; i++) { if (_vm->shouldQuit()) diff --git a/engines/hopkins/script.h b/engines/hopkins/script.h index 27f167ae1b..d3edf98975 100644 --- a/engines/hopkins/script.h +++ b/engines/hopkins/script.h @@ -34,7 +34,7 @@ class ScriptManager { private: HopkinsEngine *_vm; public: - int TRAVAILOBJET; + bool TRAVAILOBJET; public: ScriptManager(); void setParent(HopkinsEngine *vm); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 2ed7482084..e6e17e8521 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -80,8 +80,8 @@ SoundManager::SoundManager() { OLD_VOICEVOL = 0; SOUNDOFF = true; MUSICOFF = true; - VOICEOFF = true; - TEXTOFF = false; + _voiceOffFl = true; + _textOffFl = false; SOUND_FLAG = false; VBL_MERDE = false; SOUND_NUM = 0; @@ -510,7 +510,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { size_t catPos, catLen; fileNumber = voiceId; - if (VOICEOFF == 1) + if (_voiceOffFl) return false; if ((unsigned int)(voiceMode - 1) <= 1 @@ -570,21 +570,21 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { filename = Common::String::format("%s%d", prefix.c_str(), fileNumber); if (!_vm->_fileManager.searchCat(filename + ".WAV", 9)) { - if (_vm->_globals.FR == 1) + if (_vm->_globals._language == LANG_FR) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VFR.RES"); - else if (!_vm->_globals.FR) + else if (_vm->_globals._language == LANG_EN) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VAN.RES"); - else if (_vm->_globals.FR == 2) + else if (_vm->_globals._language == LANG_SP) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VES.RES"); catPos = _vm->_globals._catalogPos; catLen = _vm->_globals._catalogSize; } else if (!_vm->_fileManager.searchCat(filename + ".APC", 9)) { - if (_vm->_globals.FR == 1) + if (_vm->_globals._language == LANG_FR) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VFR.RES"); - else if (!_vm->_globals.FR) + else if (_vm->_globals._language == LANG_EN) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VAN.RES"); - else if (_vm->_globals.FR == 2) + else if (_vm->_globals._language == LANG_SP) _vm->_fileManager.constructFilename(_vm->_globals.HOPVOICE, "RES_VES.RES"); catPos = _vm->_globals._catalogPos; @@ -853,7 +853,7 @@ void SoundManager::syncSoundSettings() { // Update the mute settings MUSICOFF = muteAll || (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute")); SOUNDOFF = muteAll || (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute")); - VOICEOFF = muteAll || (ConfMan.hasKey("speech_mute") && ConfMan.getBool("speech_mute")); + _voiceOffFl = muteAll || (ConfMan.hasKey("speech_mute") && ConfMan.getBool("speech_mute")); // Update the volume levels MUSICVOL = MIN(255, ConfMan.getInt("music_volume")) * 16 / 255; @@ -875,10 +875,10 @@ void SoundManager::syncSoundSettings() { } void SoundManager::updateScummVMSoundSettings() { - ConfMan.setBool("mute", MUSICOFF && SOUNDOFF && VOICEOFF); + ConfMan.setBool("mute", MUSICOFF && SOUNDOFF && _voiceOffFl); ConfMan.setBool("music_mute", MUSICOFF); ConfMan.setBool("sfx_mute", SOUNDOFF); - ConfMan.setBool("speech_mute", VOICEOFF); + ConfMan.setBool("speech_mute", _voiceOffFl); ConfMan.setInt("music_volume", MUSICVOL * 255 / 16); ConfMan.setInt("sfx_volume", SOUNDVOL * 255 / 16); diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 9e2c8cd8e7..7eb5cc600c 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -121,8 +121,8 @@ public: int OLD_VOICEVOL; bool SOUNDOFF; bool MUSICOFF; - bool VOICEOFF; - bool TEXTOFF; + bool _voiceOffFl; + bool _textOffFl; bool SOUND_FLAG; bool VBL_MERDE; int SOUND_NUM; diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index b55e0814f2..2961e3eba2 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -80,11 +80,11 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { RENVOIE_FICHIER(40, v16, (const char *)_characterBuffer); RENVOIE_FICHIER(0, _questionsFilename, (const char *)_characterBuffer); RENVOIE_FICHIER(20, _answersFilename, (const char *)_characterBuffer); - if (_vm->_globals.FR == 1) { + if (_vm->_globals._language == LANG_FR) { _answersFilename = _questionsFilename = "RUE.TXT"; - } else if (!_vm->_globals.FR) { + } else if (_vm->_globals._language == LANG_EN) { _answersFilename = _questionsFilename = "RUEAN.TXT"; - } else if (_vm->_globals.FR == 2) { + } else if (_vm->_globals._language == LANG_SP) { _answersFilename = _questionsFilename = "RUEES.TXT"; } v2 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40); @@ -193,16 +193,16 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) { RENVOIE_FICHIER(0, _questionsFilename, (const char *)_characterBuffer); RENVOIE_FICHIER(20, _answersFilename, (const char *)_characterBuffer); - switch (_vm->_globals.FR) { - case 0: + switch (_vm->_globals._language) { + case LANG_EN: _questionsFilename = "RUEAN.TXT"; _answersFilename = "RUEAN.TXT"; break; - case 1: + case LANG_FR: _questionsFilename = "RUE.TXT"; _answersFilename = "RUE.TXT"; break; - case 2: + case LANG_SP: _questionsFilename = "RUEES.TXT"; _answersFilename = "RUEES.TXT"; break; @@ -452,7 +452,7 @@ int TalkManager::DIALOGUE_REP(int idx) { VISU_PARLE(); } - if (!_vm->_soundManager.TEXTOFF) { + if (!_vm->_soundManager._textOffFl) { _vm->_fontManager.initTextBuffers(9, v22, _answersFilename, v25, v24, 20, 25, 5, v23, 252); _vm->_fontManager.showText(9); } @@ -485,7 +485,7 @@ int TalkManager::DIALOGUE_REP(int idx) { } } - if (!_vm->_soundManager.TEXTOFF) + if (!_vm->_soundManager._textOffFl) _vm->_fontManager.hideText(9); if (STATI) { v15 = _characterBuffer; |