diff options
author | Strangerke | 2016-08-20 11:00:24 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 92c9c54481b8eccc9454c982976221baa3697704 (patch) | |
tree | 5bf3c6570fad00055c339683316f65b35967b1dc | |
parent | 705e906698505e8a547ef46c8a2fc65e3f48a49b (diff) | |
download | scummvm-rg350-92c9c54481b8eccc9454c982976221baa3697704.tar.gz scummvm-rg350-92c9c54481b8eccc9454c982976221baa3697704.tar.bz2 scummvm-rg350-92c9c54481b8eccc9454c982976221baa3697704.zip |
DM: Start refactoring of eventMan
-rw-r--r-- | engines/dm/champion.cpp | 4 | ||||
-rw-r--r-- | engines/dm/dm.cpp | 4 | ||||
-rw-r--r-- | engines/dm/eventman.cpp | 102 | ||||
-rw-r--r-- | engines/dm/eventman.h | 17 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 2 |
5 files changed, 74 insertions, 55 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 79840fa1c4..2af6889a05 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -867,8 +867,8 @@ void ChampionMan::f314_wakeUp() { _vm->_displayMan->f98_drawFloorAndCeiling(); _vm->_eventMan->_g441_primaryMouseInput = g447_PrimaryMouseInput_Interface; _vm->_eventMan->_g442_secondaryMouseInput = g448_SecondaryMouseInput_Movement; - _vm->_eventMan->_g443_primaryKeyboardInput = g458_primaryKeyboardInput_interface; - _vm->_eventMan->_g444_secondaryKeyboardInput = g459_secondaryKeyboardInput_movement; + _vm->_eventMan->_g443_primaryKeyboardInput = _vm->_eventMan->g458_primaryKeyboardInput_interface; + _vm->_eventMan->_g444_secondaryKeyboardInput = _vm->_eventMan->g459_secondaryKeyboardInput_movement; _vm->_eventMan->f357_discardAllInput(); _vm->_menuMan->f457_drawEnabledMenus(); } diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index fa35035a2e..43f9c27580 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -351,8 +351,8 @@ void DMEngine::f462_startGame() { _eventMan->_g441_primaryMouseInput = g447_PrimaryMouseInput_Interface; _eventMan->_g442_secondaryMouseInput = g448_SecondaryMouseInput_Movement; - _eventMan->_g443_primaryKeyboardInput = g458_primaryKeyboardInput_interface; - _eventMan->_g444_secondaryKeyboardInput = g459_secondaryKeyboardInput_movement; + _eventMan->_g443_primaryKeyboardInput = _eventMan->g458_primaryKeyboardInput_interface; + _eventMan->_g444_secondaryKeyboardInput = _eventMan->g459_secondaryKeyboardInput_movement; f3_processNewPartyMap(_dungeonMan->_g309_partyMapIndex); diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index f9ce68be7a..c0e3ff282a 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -43,48 +43,6 @@ namespace DM { -KeyboardInput g458_primaryKeyboardInput_interface[7] = { // @ G0458_as_Graphic561_PrimaryKeyboardInput_Interface - /* { Command, Code } */ - KeyboardInput(k7_CommandToggleInventoryChampion_0, Common::KEYCODE_F1, 0), /* F1 (<CSI>1~) Atari ST: Code = 0x3B00 */ - KeyboardInput(k8_CommandToggleInventoryChampion_1, Common::KEYCODE_F2, 0), /* F2 (<CSI>2~) Atari ST: Code = 0x3C00 */ - KeyboardInput(k9_CommandToggleInventoryChampion_2, Common::KEYCODE_F3, 0), /* F3 (<CSI>3~) Atari ST: Code = 0x3D00 */ - KeyboardInput(k10_CommandToggleInventoryChampion_3, Common::KEYCODE_F4, 0), /* F4 (<CSI>4~) Atari ST: Code = 0x3E00 */ - KeyboardInput(k140_CommandSaveGame, Common::KEYCODE_s, Common::KBD_CTRL), /* CTRL-S Atari ST: Code = 0x0013 */ - KeyboardInput(k147_CommandFreezeGame, Common::KEYCODE_ESCAPE, 0), /* Esc (0x1B) Atari ST: Code = 0x001B */ - KeyboardInput(k0_CommandNone, Common::KEYCODE_INVALID, 0)}; - - -KeyboardInput g459_secondaryKeyboardInput_movement[19] = { // @ G0459_as_Graphic561_SecondaryKeyboardInput_Movement - /* { Command, Code } */ - KeyboardInput(k1_CommandTurnLeft, Common::KEYCODE_KP4, 0), /* Numeric pad 4 Atari ST: Code = 0x5200 */ - KeyboardInput(k3_CommandMoveForward, Common::KEYCODE_KP5, 0), /* Numeric pad 5 Atari ST: Code = 0x4800 */ - KeyboardInput(k2_CommandTurnRight, Common::KEYCODE_KP6, 0), /* Numeric pad 6 Atari ST: Code = 0x4700 */ - KeyboardInput(k6_CommandMoveLeft, Common::KEYCODE_KP1, 0), /* Numeric pad 1 Atari ST: Code = 0x4B00 */ - KeyboardInput(k5_CommandMoveBackward, Common::KEYCODE_KP2, 0), /* Numeric pad 2 Atari ST: Code = 0x5000 */ - KeyboardInput(k4_CommandMoveRight, Common::KEYCODE_KP3, 0), /* Numeric pad 3 Atari ST: Code = 0x4D00. Remaining entries below not present */ - KeyboardInput(k3_CommandMoveForward, Common::KEYCODE_w, 0), /* Up Arrow (<CSI>A) */ /*Differs for testing convenience*/ - KeyboardInput(k3_CommandMoveForward, Common::KEYCODE_w, Common::KBD_SHIFT), /* Shift Up Arrow (<CSI>T) */ /*Differs for testing convenience*/ - KeyboardInput(k6_CommandMoveLeft, Common::KEYCODE_a, 0), /* Backward Arrow (<CSI>D) */ /*Differs for testing convenience*/ - KeyboardInput(k6_CommandMoveLeft, Common::KEYCODE_a, Common::KBD_SHIFT), /* Shift Forward Arrow (<CSI> A) */ /*Differs for testing convenience*/ - KeyboardInput(k4_CommandMoveRight, Common::KEYCODE_d, 0), /* Forward Arrow (<CSI>C) */ /*Differs for testing convenience*/ - KeyboardInput(k4_CommandMoveRight, Common::KEYCODE_d, Common::KBD_SHIFT), /* Shift Backward Arrow (<CSI> @) */ /*Differs for testing convenience*/ - KeyboardInput(k5_CommandMoveBackward, Common::KEYCODE_s, 0), /* Down arrow (<CSI>B) */ /*Differs for testing convenience*/ - KeyboardInput(k5_CommandMoveBackward, Common::KEYCODE_s, Common::KBD_SHIFT), /* Shift Down arrow (<CSI>S) */ /*Differs for testing convenience*/ - KeyboardInput(k1_CommandTurnLeft, Common::KEYCODE_q, 0), /* Del (0x7F) */ /*Differs for testing convenience*/ - KeyboardInput(k1_CommandTurnLeft, Common::KEYCODE_q, Common::KBD_SHIFT), /* Shift Del (0x7F) */ /*Differs for testing convenience*/ - KeyboardInput(k2_CommandTurnRight, Common::KEYCODE_e, 0), /* Help (<CSI>?~) */ /*Differs for testing convenience*/ - KeyboardInput(k2_CommandTurnRight, Common::KEYCODE_e, Common::KBD_SHIFT), /* Shift Help (<CSI>?~) */ /*Differs for testing convenience*/ - KeyboardInput(k0_CommandNone, Common::KEYCODE_INVALID, 0)}; -KeyboardInput g460_primaryKeyboardInput_partySleeping[3] = { // @ G0460_as_Graphic561_PrimaryKeyboardInput_PartySleeping - /* { Command, Code } */ - KeyboardInput(k146_CommandWakeUp, Common::KEYCODE_RETURN, 0), /* Return */ - KeyboardInput(k147_CommandFreezeGame, Common::KEYCODE_ESCAPE, 0), /* Esc */ - KeyboardInput(k0_CommandNone, Common::KEYCODE_INVALID, 0)}; -KeyboardInput g461_primaryKeyboardInput_frozenGame[2] = { // @ G0461_as_Graphic561_PrimaryKeyboardInput_FrozenGame - /* { Command, Code } */ - KeyboardInput(k148_CommandUnfreezeGame, Common::KEYCODE_ESCAPE, 0), /* Esc */ - KeyboardInput(k0_CommandNone, Common::KEYCODE_INVALID, 0)}; - MouseInput g445_PrimaryMouseInput_Entrance[4] = { // @ G0445_as_Graphic561_PrimaryMouseInput_Entrance[4] /* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */ @@ -286,7 +244,65 @@ MouseInput* g480_PrimaryMouseInput_DialogSets[2][4] = { // @ G0480_aaps_PrimaryM g477_PrimaryMouseInput_ScreenDialog3Choices, g478_PrimaryMouseInput_ScreenDialog4Choices},}; +void EventManager::initArrays() { + KeyboardInput primaryKeyboardInputInterface[7] = { // @ G0458_as_Graphic561_PrimaryKeyboardInput_Interface + /* { Command, Code } */ + KeyboardInput(k7_CommandToggleInventoryChampion_0, Common::KEYCODE_F1, 0), /* F1 (<CSI>1~) Atari ST: Code = 0x3B00 */ + KeyboardInput(k8_CommandToggleInventoryChampion_1, Common::KEYCODE_F2, 0), /* F2 (<CSI>2~) Atari ST: Code = 0x3C00 */ + KeyboardInput(k9_CommandToggleInventoryChampion_2, Common::KEYCODE_F3, 0), /* F3 (<CSI>3~) Atari ST: Code = 0x3D00 */ + KeyboardInput(k10_CommandToggleInventoryChampion_3, Common::KEYCODE_F4, 0), /* F4 (<CSI>4~) Atari ST: Code = 0x3E00 */ + KeyboardInput(k140_CommandSaveGame, Common::KEYCODE_s, Common::KBD_CTRL), /* CTRL-S Atari ST: Code = 0x0013 */ + KeyboardInput(k147_CommandFreezeGame, Common::KEYCODE_ESCAPE, 0), /* Esc (0x1B) Atari ST: Code = 0x001B */ + KeyboardInput(k0_CommandNone, Common::KEYCODE_INVALID, 0) + }; + + KeyboardInput secondaryKeyboardInputMovement[19] = { // @ G0459_as_Graphic561_SecondaryKeyboardInput_Movement + /* { Command, Code } */ + KeyboardInput(k1_CommandTurnLeft, Common::KEYCODE_KP4, 0), /* Numeric pad 4 Atari ST: Code = 0x5200 */ + KeyboardInput(k3_CommandMoveForward, Common::KEYCODE_KP5, 0), /* Numeric pad 5 Atari ST: Code = 0x4800 */ + KeyboardInput(k2_CommandTurnRight, Common::KEYCODE_KP6, 0), /* Numeric pad 6 Atari ST: Code = 0x4700 */ + KeyboardInput(k6_CommandMoveLeft, Common::KEYCODE_KP1, 0), /* Numeric pad 1 Atari ST: Code = 0x4B00 */ + KeyboardInput(k5_CommandMoveBackward, Common::KEYCODE_KP2, 0), /* Numeric pad 2 Atari ST: Code = 0x5000 */ + KeyboardInput(k4_CommandMoveRight, Common::KEYCODE_KP3, 0), /* Numeric pad 3 Atari ST: Code = 0x4D00. Remaining entries below not present */ + KeyboardInput(k3_CommandMoveForward, Common::KEYCODE_w, 0), /* Up Arrow (<CSI>A) */ /*Differs for testing convenience*/ + KeyboardInput(k3_CommandMoveForward, Common::KEYCODE_w, Common::KBD_SHIFT), /* Shift Up Arrow (<CSI>T) */ /*Differs for testing convenience*/ + KeyboardInput(k6_CommandMoveLeft, Common::KEYCODE_a, 0), /* Backward Arrow (<CSI>D) */ /*Differs for testing convenience*/ + KeyboardInput(k6_CommandMoveLeft, Common::KEYCODE_a, Common::KBD_SHIFT), /* Shift Forward Arrow (<CSI> A) */ /*Differs for testing convenience*/ + KeyboardInput(k4_CommandMoveRight, Common::KEYCODE_d, 0), /* Forward Arrow (<CSI>C) */ /*Differs for testing convenience*/ + KeyboardInput(k4_CommandMoveRight, Common::KEYCODE_d, Common::KBD_SHIFT), /* Shift Backward Arrow (<CSI> @) */ /*Differs for testing convenience*/ + KeyboardInput(k5_CommandMoveBackward, Common::KEYCODE_s, 0), /* Down arrow (<CSI>B) */ /*Differs for testing convenience*/ + KeyboardInput(k5_CommandMoveBackward, Common::KEYCODE_s, Common::KBD_SHIFT), /* Shift Down arrow (<CSI>S) */ /*Differs for testing convenience*/ + KeyboardInput(k1_CommandTurnLeft, Common::KEYCODE_q, 0), /* Del (0x7F) */ /*Differs for testing convenience*/ + KeyboardInput(k1_CommandTurnLeft, Common::KEYCODE_q, Common::KBD_SHIFT), /* Shift Del (0x7F) */ /*Differs for testing convenience*/ + KeyboardInput(k2_CommandTurnRight, Common::KEYCODE_e, 0), /* Help (<CSI>?~) */ /*Differs for testing convenience*/ + KeyboardInput(k2_CommandTurnRight, Common::KEYCODE_e, Common::KBD_SHIFT), /* Shift Help (<CSI>?~) */ /*Differs for testing convenience*/ + KeyboardInput(k0_CommandNone, Common::KEYCODE_INVALID, 0) + }; + KeyboardInput primaryKeyboardInputPartySleeping[3] = { // @ G0460_as_Graphic561_PrimaryKeyboardInput_PartySleeping + /* { Command, Code } */ + KeyboardInput(k146_CommandWakeUp, Common::KEYCODE_RETURN, 0), /* Return */ + KeyboardInput(k147_CommandFreezeGame, Common::KEYCODE_ESCAPE, 0), /* Esc */ + KeyboardInput(k0_CommandNone, Common::KEYCODE_INVALID, 0) + }; + KeyboardInput primaryKeyboardInputFrozenGame[2] = { // @ G0461_as_Graphic561_PrimaryKeyboardInput_FrozenGame + /* { Command, Code } */ + KeyboardInput(k148_CommandUnfreezeGame, Common::KEYCODE_ESCAPE, 0), /* Esc */ + KeyboardInput(k0_CommandNone, Common::KEYCODE_INVALID, 0) + }; + + for (int i = 0; i < 7; i++) + g458_primaryKeyboardInput_interface[i] = primaryKeyboardInputInterface[i]; + + for (int i = 0; i < 19; i++) + g459_secondaryKeyboardInput_movement[i] = secondaryKeyboardInputMovement[i]; + + for (int i = 0; i < 3 ; i++) + g460_primaryKeyboardInput_partySleeping[i] = primaryKeyboardInputPartySleeping[i]; + for (int i = 0; i < 2; i++) + g461_primaryKeyboardInput_frozenGame[i] = primaryKeyboardInputFrozenGame[i]; + +} EventManager::EventManager(DMEngine *vm) : _vm(vm) { _mousePos = Common::Point(0, 0); _dummyMapIndex = 0; @@ -315,6 +331,8 @@ EventManager::EventManager(DMEngine *vm) : _vm(vm) { _g587_hideMousePointerRequestCount = 0; _g558_mouseButtonStatus = 0; _highlightScreenBox.setToZero(); + + initArrays(); } EventManager::~EventManager() { diff --git a/engines/dm/eventman.h b/engines/dm/eventman.h index 7dfd5ac9e0..9741fd343b 100644 --- a/engines/dm/eventman.h +++ b/engines/dm/eventman.h @@ -208,16 +208,9 @@ public: byte _modifiers; KeyboardInput(CommandType command, Common::KeyCode keycode, byte modifierFlags) : _commandToIssue(command), _key(keycode), _modifiers(modifierFlags) {} + KeyboardInput() : _commandToIssue(k0_CommandNone), _key(Common::KEYCODE_ESCAPE), _modifiers(0) {} }; // @ KEYBOARD_INPUT - - -extern KeyboardInput g458_primaryKeyboardInput_interface[7]; -extern KeyboardInput g459_secondaryKeyboardInput_movement[19]; -extern KeyboardInput g460_primaryKeyboardInput_partySleeping[3]; -extern KeyboardInput g461_primaryKeyboardInput_frozenGame[2]; - - class DMEngine; #define k0_pointerArrow 0 // @ C0_POINTER_ARROW @@ -323,6 +316,14 @@ public: void f362_commandHighlightBoxEnable(int16 x1, int16 x2, int16 y1, int16 y2); // @ F0362_COMMAND_HighlightBoxEnable void f363_highlightBoxDisable(); // @ F0363_COMMAND_HighlightBoxDisable void f6_highlightScreenBox(int16 x1, int16 x2, int16 y1, int16 y2) { warning(false, "STUB METHOD: f6_highlightScreenBox"); } // @ F0006_MAIN_HighlightScreenBox + + + KeyboardInput g458_primaryKeyboardInput_interface[7]; // @ G0458_as_Graphic561_PrimaryKeyboardInput_Interface + KeyboardInput g459_secondaryKeyboardInput_movement[19]; // @ G0459_as_Graphic561_SecondaryKeyboardInput_Movement + KeyboardInput g460_primaryKeyboardInput_partySleeping[3]; // @ G0460_as_Graphic561_PrimaryKeyboardInput_PartySleeping + KeyboardInput g461_primaryKeyboardInput_frozenGame[2]; // @ G0461_as_Graphic561_PrimaryKeyboardInput_FrozenGame + + void initArrays(); }; } diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index a19a71a370..dc6b6a1e46 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -126,7 +126,7 @@ void InventoryMan::f355_toggleInventory(ChampionIndex championIndex) { _vm->_menuMan->f395_drawMovementArrows(); _vm->_eventMan->f77_hideMouse(); _vm->_eventMan->_g442_secondaryMouseInput = g448_SecondaryMouseInput_Movement; - _vm->_eventMan->_g444_secondaryKeyboardInput = g459_secondaryKeyboardInput_movement; + _vm->_eventMan->_g444_secondaryKeyboardInput = _vm->_eventMan->g459_secondaryKeyboardInput_movement; _vm->_eventMan->f357_discardAllInput(); _vm->_displayMan->f98_drawFloorAndCeiling(); return; |