diff options
author | Strangerke | 2013-01-27 01:25:46 +0100 |
---|---|---|
committer | Strangerke | 2013-01-27 01:25:46 +0100 |
commit | 84f7ce6ea3666b3933ea48f29c60b30cce175db3 (patch) | |
tree | b50698229d8930790605a62b1533fdc79eb7561a /engines/hopkins | |
parent | e21fed17073d87f06fc549ad5fd5e4ebf06db5de (diff) | |
download | scummvm-rg350-84f7ce6ea3666b3933ea48f29c60b30cce175db3.tar.gz scummvm-rg350-84f7ce6ea3666b3933ea48f29c60b30cce175db3.tar.bz2 scummvm-rg350-84f7ce6ea3666b3933ea48f29c60b30cce175db3.zip |
HOPKINS: Refactor REPONSE
Diffstat (limited to 'engines/hopkins')
-rw-r--r-- | engines/hopkins/globals.cpp | 12 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 4 | ||||
-rw-r--r-- | engines/hopkins/graphics.cpp | 9 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 4 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 102 | ||||
-rw-r--r-- | engines/hopkins/script.cpp | 58 | ||||
-rw-r--r-- | engines/hopkins/talk.cpp | 178 |
7 files changed, 183 insertions, 184 deletions
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index a66dafc053..44d3798daa 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -187,9 +187,9 @@ Globals::Globals() { GESTE = NULL; _inventoryObject = NULL; _forestSprite = NULL; - COUCOU = NULL; - chemin = NULL; - BufLig = NULL; + _answerBuffer = g_PTRNUL; + _route = (int16 *)g_PTRNUL; + BufLig = (int16 *)g_PTRNUL; ADR_FICHIER_OBJ = NULL; police = NULL; PERSO = NULL; @@ -235,7 +235,7 @@ Globals::~Globals() { freeMemory(GESTE); freeMemory(_inventoryObject); freeMemory(_forestSprite); - freeMemory(COUCOU); + freeMemory(_answerBuffer); freeMemory(ADR_FICHIER_OBJ); freeMemory(PERSO); @@ -304,7 +304,7 @@ void Globals::clearAll() { _vm->_eventsManager._objectBuf = g_PTRNUL; _vm->_dialogsManager._inventWin1 = g_PTRNUL; _vm->_dialogsManager._inventBuf2 = g_PTRNUL; - COUCOU = g_PTRNUL; + _answerBuffer = g_PTRNUL; SPRITE_ECRAN = g_PTRNUL; _saveData = (Sauvegarde *)g_PTRNUL; _curObjectIndex = 0; @@ -319,7 +319,7 @@ void Globals::clearAll() { essai1 = (int16 *)g_PTRNUL; essai2 = (int16 *)g_PTRNUL; BufLig = (int16 *)g_PTRNUL; - chemin = (int16 *)g_PTRNUL; + _route = (int16 *)g_PTRNUL; for (int idx = 0; idx < MAX_LINES; ++idx) { _vm->_linesManager.Ligne[idx]._lineDataEndIdx = 0; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index db8409a664..b81ce5fceb 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -349,8 +349,8 @@ public: int GESTE_FLAG; byte *_forestSprite; bool _forestFl; - byte *COUCOU; - int16 *chemin; + byte *_answerBuffer; + int16 *_route; int16 *BufLig; byte *ADR_FICHIER_OBJ; byte *PERSO; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 69ea5b2190..3203749cf8 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1793,15 +1793,14 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode, bool initia } _vm->_globals.freeMemory(ptr); if (mode != 1) { - _vm->_globals.COUCOU = _vm->_globals.freeMemory(_vm->_globals.COUCOU); + _vm->_globals._answerBuffer = _vm->_globals.freeMemory(_vm->_globals._answerBuffer); filename = file + ".rep"; byte *dataP = _vm->_fileManager.searchCat(filename, 2); - _vm->_globals.COUCOU = dataP; - if (g_PTRNUL == dataP) { + if (dataP == g_PTRNUL) dataP = _vm->_fileManager.loadFile(filename); - _vm->_globals.COUCOU = dataP; - } + + _vm->_globals._answerBuffer = dataP; } _vm->_objectsManager._forceZoneFl = true; _vm->_objectsManager._changeVerbFl = false; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index ed94ad8e2b..90978c1196 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2172,7 +2172,7 @@ void HopkinsEngine::playEnding() { _globals.PLAN_FLAG = false; _globals.iRegul = 1; _soundManager.WSOUND(26); - _globals.chemin = (int16 *)g_PTRNUL; + _globals._route = (int16 *)g_PTRNUL; _globals.NOMARCHE = true; _globals._exitId = 0; _soundManager.loadSample(1, "SOUND90.WAV"); @@ -2856,7 +2856,7 @@ void HopkinsEngine::OCEAN(int16 curExitId, Common::String backgroundFilename, in _graphicsManager.SETCOLOR3(251, 100, 100, 100); _graphicsManager.SETCOLOR3(254, 0, 0, 0); _objectsManager.animateSprite(0); - _globals.chemin = (int16 *)g_PTRNUL; + _globals._route = (int16 *)g_PTRNUL; _eventsManager.mouseOn(); _eventsManager.changeMouseCursor(4); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 7b6128a98b..ff6e09c3d2 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -1279,7 +1279,7 @@ void ObjectsManager::checkZone() { if (_vm->_globals.compteur_71 <= 1) return; - if (_vm->_globals.NOMARCHE || (_vm->_globals.chemin == (int16 *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { + if (_vm->_globals.NOMARCHE || (_vm->_globals._route == (int16 *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) { _vm->_globals.compteur_71 = 0; int zoneId; if (_vm->_globals._oldMouseX != mouseX || _vm->_globals._oldMouseY != oldMouseY) { @@ -1347,7 +1347,7 @@ void ObjectsManager::GOHOME() { int v58 = 0; int v1 = 0; - if (_vm->_globals.chemin == (int16 *)g_PTRNUL) + if (_vm->_globals._route == (int16 *)g_PTRNUL) return; if (_vm->_globals.Compteur > 1) { @@ -1362,10 +1362,10 @@ void ObjectsManager::GOHOME() { _vm->_globals.Compteur = 0; if (_vm->_globals._oldDirection == -1) { computeAndSetSpriteSize(); - newPosX = *_vm->_globals.chemin++; - newPosY = *_vm->_globals.chemin++; - newDirection = *_vm->_globals.chemin++; - _vm->_globals.chemin++; + newPosX = *_vm->_globals._route++; + newPosY = *_vm->_globals._route++; + newDirection = *_vm->_globals._route++; + _vm->_globals._route++; if (newPosX != -1 || newPosY != -1) { _vm->_globals._oldDirection = newDirection; @@ -1381,11 +1381,11 @@ void ObjectsManager::GOHOME() { zoneId = _vm->_globals._saveData->_data[svField2]; else zoneId = _zoneNum; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; _vm->_globals._oldDirection = -1; if (zoneId > 0) { if (_vm->_globals.ZONEP[zoneId]._destX && _vm->_globals.ZONEP[zoneId]._destY && _vm->_globals.ZONEP[zoneId]._destY != 31) { @@ -1588,10 +1588,10 @@ void ObjectsManager::GOHOME() { } bool loopCond = false; do { - newPosX = *_vm->_globals.chemin++; - newPosY = *_vm->_globals.chemin++; - newDirection = *_vm->_globals.chemin++; - _vm->_globals.chemin++; + newPosX = *_vm->_globals._route++; + newPosY = *_vm->_globals._route++; + newDirection = *_vm->_globals._route++; + _vm->_globals._route++; if (newPosX == -1 && newPosY == -1) { int zoneId; @@ -1601,7 +1601,7 @@ void ObjectsManager::GOHOME() { zoneId = _zoneNum; setSpriteIndex(0, _vm->_globals._oldDirection + 59); _vm->_globals._actionDirection = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; @@ -1661,7 +1661,7 @@ void ObjectsManager::GOHOME() { } void ObjectsManager::GOHOME2() { - if (_vm->_globals.chemin == (int16 *)g_PTRNUL) + if (_vm->_globals._route == (int16 *)g_PTRNUL) return; int v0 = 2; @@ -1673,10 +1673,10 @@ void ObjectsManager::GOHOME2() { _vm->_globals.j_104 = 0; for (;;) { - int nexPosX = *_vm->_globals.chemin++; - int newPosY = *_vm->_globals.chemin++; - int newDirection = *_vm->_globals.chemin++; - _vm->_globals.chemin++; + int nexPosX = *_vm->_globals._route++; + int newPosY = *_vm->_globals._route++; + int newDirection = *_vm->_globals._route++; + _vm->_globals._route++; if ((nexPosX == -1) && (newPosY == -1)) break; @@ -1710,7 +1710,7 @@ void ObjectsManager::GOHOME2() { else if (_vm->_globals._lastDirection == 7) setSpriteIndex(0, 3); - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; my_anim = 0; } @@ -1902,7 +1902,7 @@ void ObjectsManager::PLAN_BETA() { _vm->_graphicsManager.scrollScreen(getSpriteX(0) - 320); _vm->_graphicsManager._scrollOffset = getSpriteX(0) - 320; animateSprite(0); - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100); _vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100); @@ -1942,7 +1942,7 @@ void ObjectsManager::PLAN_BETA() { checkZone(); GOHOME2(); - if (_vm->_globals.chemin == (int16 *)g_PTRNUL && _vm->_globals.GOACTION) + if (_vm->_globals._route == (int16 *)g_PTRNUL && _vm->_globals.GOACTION) PARADISE(); _vm->_eventsManager.VBL(); @@ -2012,9 +2012,9 @@ void ObjectsManager::handleLeftButton() { return; int routeIdx = 0; do { - _vm->_globals.essai2[routeIdx] = _vm->_globals.chemin[routeIdx]; + _vm->_globals.essai2[routeIdx] = _vm->_globals._route[routeIdx]; ++routeIdx; - } while (_vm->_globals.chemin[routeIdx] != -1); + } while (_vm->_globals._route[routeIdx] != -1); _vm->_globals.essai2[routeIdx] = -1; _vm->_globals.essai2[routeIdx + 1] = -1; @@ -2038,26 +2038,26 @@ void ObjectsManager::handleLeftButton() { } } _vm->_globals.GOACTION = false; - int16 *oldRoute = _vm->_globals.chemin; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + int16 *oldRoute = _vm->_globals._route; + _vm->_globals._route = (int16 *)g_PTRNUL; if (_vm->_globals._forestFl && _zoneNum >= 20 && _zoneNum <= 23) { if (getSpriteY(0) <= 374 || getSpriteY(0) > 410) { - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390); - if (_vm->_globals.chemin != (int16 *)g_PTRNUL) - PACOURS_PROPRE(_vm->_globals.chemin); + _vm->_globals._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), getSpriteX(0), 390); + if (_vm->_globals._route != (int16 *)g_PTRNUL) + PACOURS_PROPRE(_vm->_globals._route); g_old_x = getSpriteX(0); g_old_y = getSpriteY(0); _vm->_globals.Compteur = 0; - if (_vm->_globals.chemin != (int16 *)g_PTRNUL || oldRoute == _vm->_globals.chemin) { + if (_vm->_globals._route != (int16 *)g_PTRNUL || oldRoute == _vm->_globals._route) { _vm->_globals._oldDirection = -1; goto LABEL_65; } goto LABEL_63; } - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; setSpriteIndex(0, _vm->_globals._oldDirectionSpriteIdx); _vm->_globals._actionDirection = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); setFlipSprite(0, false); _vm->_globals.Compteur = 0; @@ -2066,21 +2066,21 @@ void ObjectsManager::handleLeftButton() { } if (!_vm->_globals.NOMARCHE) { if (!_vm->_globals.PLAN_FLAG) { - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), destX, destY); - if (_vm->_globals.chemin != (int16 *)g_PTRNUL) - PACOURS_PROPRE(_vm->_globals.chemin); + _vm->_globals._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), destX, destY); + if (_vm->_globals._route != (int16 *)g_PTRNUL) + PACOURS_PROPRE(_vm->_globals._route); g_old_x = getSpriteX(0); g_old_y = getSpriteY(0); _vm->_globals.Compteur = 0; - if (_vm->_globals.chemin != (int16 *)g_PTRNUL || oldRoute == _vm->_globals.chemin) + if (_vm->_globals._route != (int16 *)g_PTRNUL || oldRoute == _vm->_globals._route) _vm->_globals._oldDirection = -1; else LABEL_63: - _vm->_globals.chemin = oldRoute; + _vm->_globals._route = oldRoute; } LABEL_65: if (!_vm->_globals.NOMARCHE && _vm->_globals.PLAN_FLAG) - _vm->_globals.chemin = cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY); + _vm->_globals._route = cityMapCarRoute(getSpriteX(0), getSpriteY(0), destX, destY); } if (_zoneNum != -1 && _zoneNum != 0) { if (_vm->_eventsManager._mouseCursorId == 23) @@ -2100,7 +2100,7 @@ LABEL_65: && _vm->_globals._curObjectIndex == 20 && _zoneNum == 12 && _vm->_eventsManager._mouseCursorId == 23) { // Special case for throwing darts at the switch in Purgatory - the player shouldn't move - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; getSpriteX(0); getSpriteY(0); } @@ -2217,8 +2217,8 @@ void ObjectsManager::clearScreen() { _forceZoneFl = true; _vm->_linesManager._linesNumb = 0; _lastLine = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.COUCOU = _vm->_globals.freeMemory(_vm->_globals.COUCOU); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._answerBuffer = _vm->_globals.freeMemory(_vm->_globals._answerBuffer); _vm->_globals.SPRITE_ECRAN = _vm->_globals.freeMemory(_vm->_globals.SPRITE_ECRAN); _vm->_eventsManager._startPos.x = 0; _vm->_eventsManager._mouseSpriteId = 0; @@ -2227,7 +2227,7 @@ void ObjectsManager::clearScreen() { _vm->_globals.GOACTION = false; _forceZoneFl = true; _changeVerbFl = false; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; _vm->_globals._oldDirection = -1; my_anim = 1; _vm->_graphicsManager.RESET_SEGMENT_VESA(); @@ -2243,7 +2243,7 @@ void ObjectsManager::changeCharacterHead(PlayerCharacter oldCharacter, PlayerCha _vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, 532, 25, 65, 40, _vm->_graphicsManager._vesaBuffer, 532, 25); _vm->_graphicsManager.addVesaSegment(532, 25, 597, 65); _vm->_globals.NOT_VERIF = true; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; if (oldCharacter == CHARACTER_SAMANTHA && newCharacter == CHARACTER_HOPKINS && _vm->_globals._saveData->_realHopkins._location == _vm->_globals._screenId) { @@ -4250,7 +4250,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo _vm->_globals.PLAN_FLAG = false; _vm->_globals.iRegul = 1; _vm->_soundManager.WSOUND(v); - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; _vm->_globals.NOMARCHE = true; _vm->_globals._exitId = 0; if (!backgroundFile.empty()) @@ -4270,7 +4270,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo if (_vm->_globals._screenId == 61) { addStaticSprite(_vm->_globals.PERSO, Common::Point(330, 418), 0, 60, 0, false, 34, 190); animateSprite(0); - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); } _vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100); @@ -4288,13 +4288,13 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo g_old_x = getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), 330, 345); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(getSpriteX(0), getSpriteY(0), 330, 345); _vm->_globals.NOT_VERIF = true; do { GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); setSpriteIndex(0, 64); } do { @@ -4398,7 +4398,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm computeAndSetSpriteSize(); animateSprite(0); _vm->_globals.CACHE_ON(); - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; computeAndSetSpriteSize(); SPECIAL_INI(); _vm->_eventsManager._mouseSpriteId = 4; @@ -4429,7 +4429,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm yp = _vm->_eventsManager.getMouseY(); if ((xCheck == xp) && (yCheck == yp)) { - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; PARADISE(); if (_vm->_globals._exitId) breakFlag = true; @@ -4445,8 +4445,8 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm if (!_vm->_globals._exitId) { _vm->_dialogsManager.testDialogOpening(); checkZone(); - if (_vm->_globals.chemin == (int16 *)g_PTRNUL - || (GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { + if (_vm->_globals._route == (int16 *)g_PTRNUL + || (GOHOME(), _vm->_globals._route == (int16 *)g_PTRNUL)) { if (_vm->_globals.GOACTION) PARADISE(); } diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 85522a72f3..cb287fe9e7 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -722,8 +722,8 @@ int ScriptManager::handleOpcode(byte *dataP) { case 46: { _vm->_globals.NOT_VERIF = true; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 564, 420); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 564, 420); _vm->_objectsManager._zoneNum = -1; do { if (_vm->shouldQuit()) @@ -731,7 +731,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_globals.NOT_VERIF = true; _vm->_soundManager.loadSample(1, "SOUND44.WAV"); @@ -934,8 +934,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 445, 332); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 445, 332); _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) @@ -943,7 +943,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(7); _vm->_objectsManager.SET_BOBPOSI(7, 0); @@ -1034,8 +1034,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 119, 268); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 119, 268); _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) @@ -1043,7 +1043,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setBobAnimation(11); _vm->_objectsManager.setBobAnimation(8); @@ -1350,15 +1350,15 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0); _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; if (_vm->_globals._saveData->_data[svField253] == 1) { - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 201, 294); + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 201, 294); } if (_vm->_globals._saveData->_data[svField253] == 2) { - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 158, 338); + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 158, 338); } if (_vm->_globals._saveData->_data[svField253] > 2) { - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 211, 393); + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 211, 393); } _vm->_globals.NOT_VERIF = true; do { @@ -1367,7 +1367,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); _vm->_objectsManager.setSpriteIndex(0, 60); _vm->_soundManager.loadSample(1, "SOUND63.WAV"); @@ -1598,8 +1598,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = -1; do { @@ -1608,7 +1608,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_globals._exitId = 59; break; } @@ -1626,8 +1626,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 361, 325); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = -1; do { @@ -1636,7 +1636,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_globals._exitId = 59; break; } @@ -1801,8 +1801,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_soundManager._specialSoundNum = 0; } _vm->_globals.NOT_VERIF = true; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 418); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 418); _vm->_globals.NOT_VERIF = true; _vm->_objectsManager._zoneNum = 0; do { @@ -1811,7 +1811,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_objectsManager.setSpriteIndex(0, 64); _vm->_globals._exitId = _vm->_globals._saveData->_data[svField401]; _vm->_globals._disableInventFl = false; @@ -1831,9 +1831,9 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_eventsManager.VBL(); } while (_vm->_objectsManager.BOBPOSI(1) != 9); _vm->_objectsManager.stopBobAnimation(1); - _vm->_globals.chemin = (int16 *)g_PTRNUL; + _vm->_globals._route = (int16 *)g_PTRNUL; _vm->_globals.NOT_VERIF = true; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 314); + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 330, 314); _vm->_objectsManager._zoneNum = 0; _vm->_globals.NOT_VERIF = true; do { @@ -1842,7 +1842,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_objectsManager.setSpriteIndex(0, 64); _vm->_objectsManager.setBobAnimation(2); _vm->_soundManager.playSound("SOUND66.WAV"); @@ -1930,8 +1930,8 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals._oldDirection = -1; _vm->_globals.Compteur = 0; _vm->_globals.NOT_VERIF = true; - _vm->_globals.chemin = (int16 *)g_PTRNUL; - _vm->_globals.chemin = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 488, 280); + _vm->_globals._route = (int16 *)g_PTRNUL; + _vm->_globals._route = _vm->_linesManager.PARCOURS2(_vm->_objectsManager.getSpriteX(0), _vm->_objectsManager.getSpriteY(0), 488, 280); _vm->_globals.NOT_VERIF = true; do { if (_vm->shouldQuit()) @@ -1939,7 +1939,7 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_objectsManager.GOHOME(); _vm->_eventsManager.VBL(); - } while (_vm->_globals.chemin != (int16 *)g_PTRNUL); + } while (_vm->_globals._route != (int16 *)g_PTRNUL); _vm->_objectsManager.removeSprite(0); int v45 = 0; _vm->_objectsManager.setBobAnimation(7); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index eb72133c4d..60553cd009 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -792,15 +792,13 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int a3, int } void TalkManager::REPONSE(int zone, int verb) { - byte *v5; - byte *v6; uint16 v7; byte *v8; int v10; uint16 v11; int v12; int v13; - bool v15; + bool tagFound; bool v16; bool loopCond; byte *ptr; @@ -808,90 +806,92 @@ void TalkManager::REPONSE(int zone, int verb) { byte zoneObj = zone; byte verbObj = verb; LABEL_2: - v15 = false; - if (_vm->_globals.COUCOU != g_PTRNUL) { - v5 = _vm->_globals.COUCOU; - for (;;) { - if (v5[0] == 'C' && v5[1] == 'O' && v5[2] == 'D') { - if (v5[3] == zoneObj && v5[4] == verbObj) - v15 = true; - } - if (v5[0] == 'F' && v5[1] == 'I' && v5[2] == 'N') - break; - if (!v15) - v5++; - else if (v15) { - v6 = v5 + 5; - ptr = _vm->_globals.allocMemory(620); - if (g_PTRNUL == ptr) - error("TRADUC"); - memset(ptr, 0, 620); - v7 = 0; - v12 = 0; - loopCond = false; - do { - v16 = false; - if (v6[v7] == 'F' && v6[v7 + 1] == 'C') { - ++v12; - assert(v12 < (620 / 20)); - - v8 = (ptr + 20 * v12); - v11 = 0; - do { - assert(v11 < 20); - v8[v11++] = v6[v7++]; - if (v6[v7] == 'F' && v6[v7 + 1] == 'F') { - v16 = true; - v8[v11] = 'F'; - v8[v11 + 1] = 'F'; - ++v7; - } - } while (!v16); - } - if (!v16) { - if ((v6[v7] == 'C' && v6[v7 + 1] == 'O' && v6[v7 + 2] == 'D') || (v6[v7] == 'F' && v6[v7 + 1] == 'I' && v6[v7 + 2] == 'N')) - loopCond = true; - } - v6 += v7 + 1; - v7 = 0; - } while (!loopCond); - loopCond = false; - v13 = 1; - do { - v10 = _vm->_scriptManager.handleOpcode(ptr + 20 * v13); - if (_vm->shouldQuit()) - return; - - if (v10 == 2) - // GOTO - v13 = _vm->_scriptManager.handleGoto(ptr + 20 * v13); - else if (v10 == 3) - // IF - v13 = _vm->_scriptManager.handleIf(ptr, v13); - - if (v13 == -1) - error("Invalid IFF function"); - - if (v10 == 1 || v10 == 4) - // Already handled opcode or END IF - ++v13; - else if (!v10 || v10 == 5) - // EXIT - loopCond = true; - else if (v10 == 6) { - // JUMP - _vm->_globals.freeMemory(ptr); - zoneObj = _vm->_objectsManager._jumpZone; - verbObj = _vm->_objectsManager._jumpVerb; - goto LABEL_2; - } - } while (!loopCond); - _vm->_globals.freeMemory(ptr); - _vm->_globals._saveData->_data[svField2] = 0; - return; - } + tagFound = false; + if (_vm->_globals._answerBuffer == g_PTRNUL) + return; + + byte *curAnswerBuf = _vm->_globals._answerBuffer; + for (;;) { + if (curAnswerBuf[0] == 'F' && curAnswerBuf[1] == 'I' && curAnswerBuf[2] == 'N') + return; + if (curAnswerBuf[0] == 'C' && curAnswerBuf[1] == 'O' && curAnswerBuf[2] == 'D') { + if (curAnswerBuf[3] == zoneObj && curAnswerBuf[4] == verbObj) + tagFound = true; } + if (!tagFound) + curAnswerBuf++; + else + break; } + + // 'COD' tag found + curAnswerBuf += 5; + ptr = _vm->_globals.allocMemory(620); + assert(ptr != g_PTRNUL); + memset(ptr, 0, 620); + v7 = 0; + v12 = 0; + loopCond = false; + do { + v16 = false; + if (curAnswerBuf[v7] == 'F' && curAnswerBuf[v7 + 1] == 'C') { + ++v12; + assert(v12 < (620 / 20)); + + v8 = (ptr + 20 * v12); + v11 = 0; + do { + assert(v11 < 20); + v8[v11++] = curAnswerBuf[v7++]; + if (curAnswerBuf[v7] == 'F' && curAnswerBuf[v7 + 1] == 'F') { + v16 = true; + v8[v11] = 'F'; + v8[v11 + 1] = 'F'; + ++v7; + } + } while (!v16); + } + if (!v16) { + if ((curAnswerBuf[v7] == 'C' && curAnswerBuf[v7 + 1] == 'O' && curAnswerBuf[v7 + 2] == 'D') || (curAnswerBuf[v7] == 'F' && curAnswerBuf[v7 + 1] == 'I' && curAnswerBuf[v7 + 2] == 'N')) + loopCond = true; + } + curAnswerBuf += v7 + 1; + v7 = 0; + } while (!loopCond); + loopCond = false; + v13 = 1; + do { + v10 = _vm->_scriptManager.handleOpcode(ptr + 20 * v13); + if (_vm->shouldQuit()) + return; + + if (v10 == 2) + // GOTO + v13 = _vm->_scriptManager.handleGoto(ptr + 20 * v13); + else if (v10 == 3) + // IF + v13 = _vm->_scriptManager.handleIf(ptr, v13); + + if (v13 == -1) + error("Invalid IFF function"); + + if (v10 == 1 || v10 == 4) + // Already handled opcode or END IF + ++v13; + else if (!v10 || v10 == 5) + // EXIT + loopCond = true; + else if (v10 == 6) { + // JUMP + _vm->_globals.freeMemory(ptr); + zoneObj = _vm->_objectsManager._jumpZone; + verbObj = _vm->_objectsManager._jumpVerb; + goto LABEL_2; + } + } while (!loopCond); + _vm->_globals.freeMemory(ptr); + _vm->_globals._saveData->_data[svField2] = 0; + return; } void TalkManager::REPONSE2(int a1, int a2) { @@ -1050,8 +1050,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_objectsManager.PERSO_ON = true; searchCharacterPalette(_paletteBufferIdx, true); startCharacterAnim0(_paletteBufferIdx, false); - v11 = _vm->_globals.COUCOU; - _vm->_globals.COUCOU = g_PTRNUL; + v11 = _vm->_globals._answerBuffer; + _vm->_globals._answerBuffer = g_PTRNUL; _vm->_globals.NOMARCHE = true; _vm->_objectsManager.INILINK(v22); _vm->_objectsManager.PERSO_ON = true; @@ -1090,8 +1090,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { for (int i = 0; i <= 44; i++) _vm->_globals.BOBZONE[i] = 0; - _vm->_globals.freeMemory(_vm->_globals.COUCOU); - _vm->_globals.COUCOU = v11; + _vm->_globals.freeMemory(_vm->_globals._answerBuffer); + _vm->_globals._answerBuffer = v11; _vm->_objectsManager._disableFl = true; _vm->_objectsManager.INILINK(v20); _vm->_graphicsManager.INI_ECRAN2(v20, true); |