30 #include "common/events.h" 31 #include "common/queue.h" 32 #include "common/array.h" 36 #include "dm/champion.h" 41 kDMMouseButtonNone = 0,
42 kDMMouseButtonLeft = 1,
43 kDMMouseButtonRight = 2
48 kDMCommandTurnLeft = 1,
49 kDMCommandTurnRight = 2,
50 kDMCommandMoveForward = 3,
51 kDMCommandMoveRight = 4,
52 kDMCommandMoveBackward = 5,
53 kDMCommandMoveLeft = 6,
54 kDMCommandToggleInventoryChampion0 = 7,
55 kDMCommandToggleInventoryChampion1 = 8,
56 kDMCommandToggleInventoryChampion2 = 9,
57 kDMCommandToggleInventoryChampion3 = 10,
58 kDMCommandCloseInventory = 11,
59 kDMCommandClickInChampion0StatusBox = 12,
60 kDMCommandClickInChampion1StatusBox = 13,
61 kDMCommandClickInChampion2StatusBox = 14,
62 kDMCommandClickInChampion3StatusBox = 15,
63 kDMCommandSetLeaderChampion0 = 16,
64 kDMCommandSetLeaderChampion1 = 17,
65 kDMCommandSetLeaderChampion2 = 18,
66 kDMCommandSetLeaderChampion3 = 19,
67 kDMCommandClickOnSlotBoxChampion0StatusBoxReadyHand = 20,
68 kDMCommandClickOnSlotBoxChampion0StatusBoxActionHand = 21,
69 kDMCommandClickOnSlotBoxChampion1StatusBoxReadyHand = 22,
70 kDMCommandClickOnSlotBoxChampion1StatusBoxActionHand = 23,
71 kDMCommandClickOnSlotBoxChampion2StatusBoxReadyHand = 24,
72 kDMCommandClickOnSlotBoxChampion2StatusBoxActionHand = 25,
73 kDMCommandClickOnSlotBoxChampion3StatusBoxReadyHand = 26,
74 kDMCommandClickOnSlotBoxChampion3StatusBoxActionHand = 27,
75 kDMCommandClickOnSlotBoxInventoryReadyHand = 28,
76 kDMCommandClickOnSlotBoxInventoryActionHand = 29,
77 kDMCommandClickOnSlotBoxInventoryHead = 30,
78 kDMCommandClickOnSlotBoxInventoryTorso = 31,
79 kDMCommandClickOnSlotBoxInventoryLegs = 32,
80 kDMCommandClickOnSlotBoxInventoryFeet = 33,
81 kDMCommandClickOnSlotBoxInventoryPouch2 = 34,
82 kDMCommandClickOnSlotBoxInventoryQuiverLine2_1 = 35,
83 kDMCommandClickOnSlotBoxInventoryQuiverLine1_2 = 36,
84 kDMCommandClickOnSlotBoxInventoryQuiverLine2_2 = 37,
85 kDMCommandClickOnSlotBoxInventoryNeck = 38,
86 kDMCommandClickOnSlotBoxInventoryPouch1 = 39,
87 kDMCommandClickOnSlotBoxInventoryQuiverLine1_1 = 40,
88 kDMCommandClickOnSlotBoxInventoryBackpackLine1_1 = 41,
89 kDMCommandClickOnSlotBoxInventoryBackpackLine2_2 = 42,
90 kDMCommandClickOnSlotBoxInventoryBackpackLine2_3 = 43,
91 kDMCommandClickOnSlotBoxInventoryBackpackLine2_4 = 44,
92 kDMCommandClickOnSlotBoxInventoryBackpackLine2_5 = 45,
93 kDMCommandClickOnSlotBoxInventoryBackpackLine2_6 = 46,
94 kDMCommandClickOnSlotBoxInventoryBackpackLine2_7 = 47,
95 kDMCommandClickOnSlotBoxInventoryBackpackLine2_8 = 48,
96 kDMCommandClickOnSlotBoxInventoryBackpackLine2_9 = 49,
97 kDMCommandClickOnSlotBoxInventoryBackpackLine1_2 = 50,
98 kDMCommandClickOnSlotBoxInventoryBackpackLine1_3 = 51,
99 kDMCommandClickOnSlotBoxInventoryBackpackLine1_4 = 52,
100 kDMCommandClickOnSlotBoxInventoryBackpackLine1_5 = 53,
101 kDMCommandClickOnSlotBoxInventoryBackpackLine1_6 = 54,
102 kDMCommandClickOnSlotBoxInventoryBackpackLine1_7 = 55,
103 kDMCommandClickOnSlotBoxInventoryBackpackLine1_8 = 56,
104 kDMCommandClickOnSlotBoxInventoryBackpackLine1_9 = 57,
105 kDMCommandClickOnSlotBoxChest1 = 58,
106 kDMCommandClickOnSlotBoxChest2 = 59,
107 kDMCommandClickOnSlotBoxChest3 = 60,
108 kDMCommandClickOnSlotBoxChest4 = 61,
109 kDMCommandClickOnSlotBoxChest5 = 62,
110 kDMCommandClickOnSlotBoxChest6 = 63,
111 kDMCommandClickOnSlotBoxChest7 = 64,
112 kDMCommandClickOnSlotBoxChest8 = 65,
113 kDMCommandClickOnMouth = 70,
114 kDMCommandClickOnEye = 71,
115 kDMCommandClickInDungeonView = 80,
116 kDMCommandClickInPanel = 81,
117 kDMCommandToggleInventoryLeader = 83,
118 kDMCommandClickInSpellArea = 100,
119 kDMCommandClickInSpellAreaSymbol1 = 101,
120 kDMCommandClickInSpellAreaSymbol2 = 102,
121 kDMCommandClickInSpellAreaSymbol3 = 103,
122 kDMCommandClickInSpellAreaSymbol4 = 104,
123 kDMCommandClickInSpellAreaSymbol5 = 105,
124 kDMCommandClickInSpellAreaSymbol6 = 106,
125 kDMCommandClickInSpellAreaRecantSymbol = 107,
126 kDMCommandClickInSpeallAreaCastSpell = 108,
127 kDMCommandClickInActionArea = 111,
128 kDMCommandClickInActionAreaPass = 112,
129 kDMCommandClickInActionAreaAction0 = 113,
130 kDMCommandClickInActionAreaAction1 = 114,
131 kDMCommandClickInActionAreaAction2 = 115,
132 kDMCommandClickInActionAreaChampion0Action = 116,
133 kDMCommandClickInActionAreaChampion1Action = 117,
134 kDMCommandClickInActionAreaChampion2Action = 118,
135 kDMCommandClickInActionAreaChampion3Action = 119,
136 kDMCommandClickOnChamptionIconTopLeft = 125,
137 kDMCommandClickOnChamptionIconTopRight = 126,
138 kDMCommandClickOnChamptionIconLowerRight = 127,
139 kDMCommandClickOnChamptionIconLowerLeft = 128,
140 kDMCommandSaveGame = 140,
141 kDMCommandSleep = 145,
142 kDMCommandWakeUp = 146,
143 kDMCommandFreezeGame = 147,
144 kDMCommandUnfreezeGame = 148,
145 kDMCommandClickInPanelResurrect = 160,
146 kDMCommandClickInPanelReincarnate = 161,
147 kDMCommandClickInPanelCancel = 162,
148 kDMCommandEntranceEnterDungeon = 200,
149 kDMCommandEntranceResume = 201,
150 kDMCommandEntranceDrawCredits = 202,
151 kDMCommandClickOnDialogChoice1 = 210,
152 kDMCommandClickOnDialogChoice2 = 211,
153 kDMCommandClickOnDialogChoice3 = 212,
154 kDMCommandClickOnDialogChoice4 = 213,
155 kDMCommandRestartGame = 215
163 Command(
Common::Point position, CommandType commandType) : _pos(position), _type(commandType) {}
169 CommandType _commandTypeToIssue;
173 MouseInput(CommandType type, uint16 x1, uint16 x2, uint16 y1, uint16 y2, MouseButton mouseButton)
174 : _commandTypeToIssue(type), _hitbox(x1, x2 + 1, y1, y2 + 1), _button(mouseButton) {}
176 : _commandTypeToIssue(kDMCommandNone), _hitbox(0, 1, 0, 1), _button(kDMMouseButtonNone) {}
181 CommandType _commandToIssue;
182 Common::KeyCode _key;
185 KeyboardInput(CommandType command, Common::KeyCode keycode, byte modifierFlags) : _commandToIssue(command), _key(keycode), _modifiers(modifierFlags) {}
186 KeyboardInput() : _commandToIssue(kDMCommandNone), _key(Common::KEYCODE_ESCAPE), _modifiers(0) {}
191 #define k0_pointerArrow 0 // @ C0_POINTER_ARROW 192 #define k1_pointerHand 1 // @ C1_POINTER_HAND 194 #define k0_pointerTypeArrow 0 // @ C0_POINTER_TYPE_ARROW 195 #define k1_pointerTypeObjectIcon 1 // @ C1_POINTER_TYPE_OBJECT_ICON 196 #define k2_pointerTypeChampionIcon 2 // @ C2_POINTER_TYPE_CHAMPION_ICON 197 #define k3_pointerTypeHand 3 // @ C3_POINTER_TYPE_HAND 198 #define k4_pointerTypeAutoselect 4 // @ C4_POINTER_TYPE_AUTOSELECT 204 uint16 _dummyMapIndex;
206 bool _pendingClickPresent;
208 MouseButton _pendingClickButton;
209 bool _useObjectAsMousePointerBitmap;
210 bool _useHandAsMousePointerBitmap;
211 bool _preventBuildPointerScreenArea;
212 byte *_mousePointerOriginalColorsObject;
213 byte *_mousePointerOriginalColorsChampionIcon;
214 byte *_mousePointerTempBuffer;
215 int16 _mousePointerType;
216 int16 _previousMousePointerType;
217 uint16 _mouseButtonStatus;
220 bool _isCommandQueueLocked;
223 void commandTurnParty(CommandType cmdType);
224 void commandMoveParty(CommandType cmdType);
225 bool isLeaderHandObjThrown(int16 posX, int16 posY);
226 void setMousePointerFromSpriteData(byte *mouseSprite);
228 Box _highlightScreenBox;
235 bool _mousePointerBitmapUpdated;
236 bool _refreshMousePointerInMainLoop;
237 bool _highlightBoxEnabled;
238 uint16 _useChampionIconOrdinalAsMousePointerBitmap;
241 bool _ignoreMouseMovements;
242 int16 _hideMousePointerRequestCount;
245 void setMousePointerToNormal(int16 mousePointer);
246 void setPointerToObject(byte *bitmap);
247 void mouseDropChampionIcon();
248 void buildpointerScreenArea(int16 mousePosX, int16 mousePosY);
249 void setMousePointer();
252 bool isMouseButtonDown(MouseButton button);
263 void processPendingClick();
264 void processClick(
Common::Point mousePos, MouseButton button);
266 void processCommandQueue();
268 void commandSetLeader(ChampionIndex index);
269 void commandProcessType80ClickInDungeonViewTouchFrontWall();
270 void commandProcessType80ClickInDungeonView(int16 posX, int16 posY);
271 void commandProcessCommands160To162ClickInResurrectReincarnatePanel(CommandType commandType);
272 void commandProcess81ClickInPanel(int16 x, int16 y);
273 void processType80_clickInDungeonView_grabLeaderHandObject(uint16 viewCell);
274 void clickInDungeonViewDropLeaderHandObject(uint16 viewCell);
276 bool hasPendingClick(
Common::Point &point, MouseButton button);
277 void drawSleepScreen();
278 void discardAllInput();
279 void commandTakeStairs(
bool stairsGoDown);
280 void commandProcessTypes12to27_clickInChampionStatusBox(uint16 champIndex, int16 posX,
282 void mouseProcessCommands125To128_clickOnChampionIcon(uint16 champIconIndex);
283 void commandProcessType100_clickInSpellArea(uint16 posX, uint16 posY);
284 void commandProcessTypes101To108_clickInSpellSymbolsArea(CommandType cmdType);
285 void commandProcessType111To115_ClickInActionArea(int16 posX, int16 posY);
286 void resetPressingEyeOrMouth();
287 void waitForMouseOrKeyActivity();
288 void commandHighlightBoxEnable(int16 x1, int16 x2, int16 y1, int16 y2);
289 void highlightBoxDisable();
290 void highlightScreenBox(int16 x1, int16 x2, int16 y1, int16 y2) {
warning(
"STUB METHOD: highlightScreenBox"); }
300 MouseInput _secondaryMouseInputChampionInventory[38];
301 MouseInput _primaryMouseInputPartySleeping[3];
308 MouseInput _mouseInputPanelResurrectReincarnateCancel[4];
309 MouseInput _primaryMouseInputViewportDialog1Choice[2];
310 MouseInput _primaryMouseInputScreenDialog1Choice[2];
311 MouseInput _primaryMouseInputViewportDialog2Choices[3];
312 MouseInput _primaryMouseInputScreenDialog2Choices[3];
313 MouseInput _primaryMouseInputViewportDialog3Choices[4];
314 MouseInput _primaryMouseInputScreenDialog3Choices[4];
315 MouseInput _primaryMouseInputViewportDialog4Choices[5];
316 MouseInput _primaryMouseInputScreenDialog4Choices[5];
318 MouseInput *_primaryMouseInputDialogSets[2][4];
void warning(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
EventType
Definition: events.h:49
Definition: eventman.h:200
MouseButton
Definition: events.h:183
Definition: champion.h:35
Definition: eventman.h:158