From 367f0aac7ed8c205deb6294ceb8b2367118fbc04 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Oct 2012 15:46:52 +1100 Subject: HOPKINS: Remove duplicate GOACTION variable. This fixes arriving at destinations from the map view. --- engines/hopkins/dialogs.cpp | 7 ------- engines/hopkins/objects.cpp | 23 +++++++++++------------ engines/hopkins/objects.h | 1 - engines/hopkins/saveload.cpp | 10 +++++++++- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 5e157ff66e..742946e2cb 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -607,13 +607,6 @@ void DialogsManager::SAUVE_PARTIE() { _vm->_objectsManager.SL_Y = 0; if (slotNumber != 7) { - // Set the selected slot number - _vm->_globals.SAUVEGARDE->data[svField10] = slotNumber; - - // Set up the inventory - for (int i = 0; i < 35; ++i) - _vm->_globals.SAUVEGARDE->inventory[i] = _vm->_globals.INVENTAIRE[i]; - // Since the original GUI doesn't support save names, use a default name saveName = Common::String::format("Save #%d", slotNumber); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 11aaf579e5..008ef7a9e3 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -56,7 +56,6 @@ ObjectsManager::ObjectsManager() { DESACTIVE_CURSOR = 0; BOBTOUS = false; my_anim = 0; - GOACTION = 0; NUMZONE = 0; ARRET_PERSO_FLAG = 0; ARRET_PERSO_NUM = 0; @@ -1890,7 +1889,7 @@ void ObjectsManager::GOHOME() { } else { SETANISPR(0, _vm->_globals.g_old_sens + 59); _vm->_globals.ACTION_SENS = 0; - if (GOACTION == 1) + if (_vm->_globals.GOACTION == 1) v54 = _vm->_globals.SAUVEGARDE->data[svField2]; else v54 = NUMZONE; @@ -2231,7 +2230,7 @@ LABEL_153: _vm->_globals.chemin++; if (nouveau_x == -1 && v48 == -1) { - if (GOACTION == 1) + if (_vm->_globals.GOACTION == 1) v49 = _vm->_globals.SAUVEGARDE->data[svField2]; else v49 = NUMZONE; @@ -2804,7 +2803,7 @@ void ObjectsManager::BTGAUCHE() { } } if (_vm->_globals.PLAN_FLAG == 1) { - if (GOACTION != 1) + if (_vm->_globals.GOACTION != 1) goto LABEL_38; VERIFZONE(); if (NUMZONE <= 0) @@ -2823,9 +2822,9 @@ void ObjectsManager::BTGAUCHE() { v5[v2 + 2] = -1; v5[v2 + 3] = -1; } - if (GOACTION == 1) { + if (_vm->_globals.GOACTION == 1) { VERIFZONE(); - GOACTION = 0; + _vm->_globals.GOACTION = 0; _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; } @@ -2845,7 +2844,7 @@ LABEL_38: } } } - GOACTION = 0; + _vm->_globals.GOACTION = 0; v9 = _vm->_globals.chemin; _vm->_globals.chemin = (int16 *)g_PTRNUL; if (_vm->_globals.FORET && ((uint16)(NUMZONE - 20) <= 1u || (uint16)(NUMZONE - 22) <= 1u)) { @@ -2908,7 +2907,7 @@ LABEL_65: _vm->_globals.SAUVEGARDE->data[svField1] = 6; _vm->_globals.SAUVEGARDE->data[svField2] = NUMZONE; _vm->_globals.SAUVEGARDE->data[svField3] = _vm->_globals.OBJET_EN_COURS; - GOACTION = 1; + _vm->_globals.GOACTION = 1; } _vm->_fontManager.TEXTE_OFF(5); _vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100); @@ -3036,7 +3035,7 @@ LABEL_64: BTDROITE(); } } - GOACTION = 0; + _vm->_globals.GOACTION = 0; } // Clear Screen @@ -3083,7 +3082,7 @@ void ObjectsManager::CLEAR_ECRAN() { Vold_taille = 200; _vm->_globals.SAUVEGARDE->data[svField1] = 0; _vm->_globals.SAUVEGARDE->data[svField2] = 0; - GOACTION = 0; + _vm->_globals.GOACTION = 0; FORCEZONE = 1; CHANGEVERBE = 0; _vm->_globals.NOSPRECRAN = 0; @@ -5637,7 +5636,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s BTDROITE(); _vm->_dialogsManager.TestForDialogOpening(); VERIFZONE(); - if (GOACTION == 1) + if (_vm->_globals.GOACTION == 1) PARADISE(); if (!_vm->_globals.SORTIE) { _vm->_eventsManager.VBL(); @@ -5783,7 +5782,7 @@ LABEL_70: VERIFZONE(); if (_vm->_globals.chemin == (int16 *)g_PTRNUL || (GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { - if (GOACTION == 1) + if (_vm->_globals.GOACTION == 1) PARADISE(); } SPECIAL_JEU(); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index d9f15abdea..3140674e5c 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -81,7 +81,6 @@ public: int DESACTIVE_CURSOR; bool BOBTOUS; int my_anim; - int GOACTION; int NUMZONE; int ARRET_PERSO_FLAG; int ARRET_PERSO_NUM; diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 023257ede0..cd7c32c345 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -138,7 +138,15 @@ void SaveLoadManager::writeSavegameHeader(Common::OutSaveFile *out, hopkinsSaveg } Common::Error SaveLoadManager::save(int slot, const Common::String &saveName) { - // Try and create the save file + /* Pack any necessary data into the savegame data structure */ + // Set the selected slot number + _vm->_globals.SAUVEGARDE->data[svField10] = slot; + + // Set up the inventory + for (int i = 0; i < 35; ++i) + _vm->_globals.SAUVEGARDE->inventory[i] = _vm->_globals.INVENTAIRE[i]; + + /* Create the savegame */ Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving( _vm->generateSaveName(slot)); if (!saveFile) -- cgit v1.2.3