diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hopkins/dialogs.cpp | 31 | ||||
-rw-r--r-- | engines/hopkins/dialogs.h | 2 | ||||
-rw-r--r-- | engines/hopkins/events.cpp | 12 | ||||
-rw-r--r-- | engines/hopkins/events.h | 4 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 12 |
5 files changed, 45 insertions, 16 deletions
diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 7e4dc16d11..5e157ff66e 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -521,16 +521,35 @@ void DialogsManager::INVENT_ANIM() { } } -void DialogsManager::TEST_INVENT() { +void DialogsManager::TestForDialogOpening() { if (_vm->_globals.PLAN_FLAG) - _vm->_eventsManager.KEY_INVENT = 0; - if (_vm->_eventsManager.KEY_INVENT == 1) { + _vm->_eventsManager.GAME_KEY = KEY_NONE; + + if (_vm->_eventsManager.GAME_KEY != KEY_NONE) { if (!INVENTFLAG) { - _vm->_eventsManager.KEY_INVENT = 0; + GAME_KEY key = _vm->_eventsManager.GAME_KEY; + _vm->_eventsManager.GAME_KEY = KEY_NONE; INVENTFLAG = 1; - _vm->_dialogsManager.showInventory(); + + switch (key) { + case KEY_INVENTORY: + _vm->_dialogsManager.showInventory(); + break; + case KEY_OPTIONS: + _vm->_dialogsManager.showOptionsDialog(); + break; + case KEY_LOAD: + _vm->_dialogsManager.CHARGE_PARTIE(); + break; + case KEY_SAVE: + _vm->_dialogsManager.SAUVE_PARTIE(); + break; + default: + break; + } + INVENTFLAG = 0; - _vm->_eventsManager.KEY_INVENT = 0; + _vm->_eventsManager.GAME_KEY = KEY_NONE; } } } diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h index 7e049bf717..3f4cdfadbb 100644 --- a/engines/hopkins/dialogs.h +++ b/engines/hopkins/dialogs.h @@ -55,7 +55,7 @@ public: void showInventory(); void INVENT_ANIM(); - void TEST_INVENT(); + void TestForDialogOpening(); void CHARGE_PARTIE(); void SAUVE_PARTIE(); void LOAD_SAUVE(int a1); diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 0eb65c8f01..ea88e1de5a 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -44,7 +44,7 @@ EventsManager::EventsManager() { _gameCounter = 0; lItCounter = 0; ESC_KEY = false; - KEY_INVENT = false; + GAME_KEY = KEY_NONE; btsouris = 0; OLD_ICONE = 0; @@ -260,7 +260,15 @@ void EventsManager::pollEvents() { void EventsManager::handleKey(Common::Event &event) { ESC_KEY = event.kbd.keycode == Common::KEYCODE_ESCAPE; - KEY_INVENT = event.kbd.keycode == Common::KEYCODE_i || event.kbd.keycode == Common::KEYCODE_TAB; + + if (event.kbd.keycode == Common::KEYCODE_i || event.kbd.keycode == Common::KEYCODE_TAB) + GAME_KEY = KEY_INVENTORY; + else if (event.kbd.keycode == Common::KEYCODE_F5) + GAME_KEY = KEY_SAVE; + else if (event.kbd.keycode == Common::KEYCODE_F7) + GAME_KEY = KEY_LOAD; + else if (event.kbd.keycode == Common::KEYCODE_F1 || event.kbd.keycode == Common::KEYCODE_o) + GAME_KEY = KEY_OPTIONS; // Check for debugger if ((event.kbd.keycode == Common::KEYCODE_d) && (event.kbd.flags & Common::KBD_CTRL)) { diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 8aa87e0cdc..7979115a0f 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -34,6 +34,8 @@ namespace Hopkins { class HopkinsEngine; +enum GAME_KEY { KEY_NONE = 0, KEY_INVENTORY = 1, KEY_OPTIONS = 2, KEY_SAVE = 3, KEY_LOAD = 4 }; + class EventsManager { private: HopkinsEngine *_vm; @@ -60,7 +62,7 @@ public: uint32 _priorFrameTime; bool ESC_KEY; bool NOESC; - bool KEY_INVENT; + GAME_KEY GAME_KEY; int btsouris; public: EventsManager(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index f8e229290b..11aaf579e5 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2623,7 +2623,7 @@ void ObjectsManager::PLAN_BETA() { v1 = 0; _vm->_dialogsManager.INVENTFLAG = false; - _vm->_eventsManager.KEY_INVENT = 0; + _vm->_eventsManager.GAME_KEY = KEY_NONE; _vm->_globals.Max_Propre = 1; _vm->_globals.Max_Ligne_Long = 1; _vm->_globals.Max_Propre_Gen = 1; @@ -2766,7 +2766,7 @@ void ObjectsManager::BTGAUCHE() { _vm->_dialogsManager.INVENTFLAG = 1; _vm->_dialogsManager.showInventory(); _vm->_dialogsManager.INVENTFLAG = 0; - _vm->_eventsManager.KEY_INVENT = 0; + _vm->_eventsManager.GAME_KEY = KEY_NONE; if (!_vm->_globals.SORTIE) { _vm->_dialogsManager.INVENTFLAG = 0; _vm->_eventsManager.btsouris = v1; @@ -5565,7 +5565,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s v5 = 0; _vm->_dialogsManager.INVENTFLAG = 0; - _vm->_eventsManager.KEY_INVENT = 0; + _vm->_eventsManager.GAME_KEY = KEY_NONE; _vm->_dialogsManager.VIRE_INVENT = false; _vm->_graphicsManager.ofscroll = 0; _vm->_globals.PLAN_FLAG = 0; @@ -5635,7 +5635,7 @@ void ObjectsManager::PERSONAGE(const Common::String &s1, const Common::String &s } if (v9 == 2) BTDROITE(); - _vm->_dialogsManager.TEST_INVENT(); + _vm->_dialogsManager.TestForDialogOpening(); VERIFZONE(); if (GOACTION == 1) PARADISE(); @@ -5662,7 +5662,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &s1, const Common::String & int xp, yp; _vm->_dialogsManager.INVENTFLAG = 0; - _vm->_eventsManager.KEY_INVENT = 0; + _vm->_eventsManager.GAME_KEY = KEY_NONE; verbe = 4; _vm->_globals.MAX_COMPTE = 6; _vm->_graphicsManager.ofscroll = 0; @@ -5779,7 +5779,7 @@ LABEL_70: } } if (!_vm->_globals.SORTIE) { - _vm->_dialogsManager.TEST_INVENT(); + _vm->_dialogsManager.TestForDialogOpening(); VERIFZONE(); if (_vm->_globals.chemin == (int16 *)g_PTRNUL || (GOHOME(), _vm->_globals.chemin == (int16 *)g_PTRNUL)) { |