DM: Start refactoring of eventMan

This commit is contained in:
Strangerke 2016-08-20 11:00:24 +02:00 committed by Bendegúz Nagy
parent 705e906698
commit 92c9c54481
5 changed files with 74 additions and 55 deletions

View File

@ -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();
}

View File

@ -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);

View File

@ -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() {

View File

@ -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();
};
}

View File

@ -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;