mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-08 02:42:34 +00:00
DM: Add mouseclick processing
This commit is contained in:
parent
6b31b1bbc3
commit
bcfe176df5
@ -74,15 +74,15 @@ Common::Error DMEngine::run() {
|
||||
_dungeonMan->setCurrentMapAndPartyMap(dummyMapIndex);
|
||||
|
||||
|
||||
|
||||
|
||||
_displayMan->loadCurrentMapGraphics();
|
||||
|
||||
_displayMan->loadPalette(gPalCredits);
|
||||
|
||||
_eventMan->initMouse();
|
||||
_eventMan->showMouse(true);
|
||||
|
||||
startGame();
|
||||
|
||||
|
||||
while (true) {
|
||||
_eventMan->processInput();
|
||||
_displayMan->clearScreen(kColorBlack);
|
||||
@ -95,4 +95,10 @@ Common::Error DMEngine::run() {
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
|
||||
void DMEngine::startGame() {
|
||||
_eventMan->_primaryMouseInput = gPrimaryMouseInput_Interface;
|
||||
_eventMan->_secondaryMouseInput = gSecondaryMouseInput_Movement;
|
||||
}
|
||||
|
||||
} // End of namespace DM
|
||||
|
@ -76,6 +76,7 @@ enum {
|
||||
};
|
||||
|
||||
class DMEngine : public Engine {
|
||||
void startGame(); // @ F0462_START_StartGame_CPSF
|
||||
public:
|
||||
DMEngine(OSystem *syst);
|
||||
~DMEngine();
|
||||
|
@ -6,21 +6,21 @@
|
||||
|
||||
|
||||
|
||||
using namespace DM;
|
||||
|
||||
namespace DM {
|
||||
|
||||
MouseInput DM::gPrimaryMouseInput_Entrance[4] = { // @ G0445_as_Graphic561_PrimaryMouseInput_Entrance[4]
|
||||
MouseInput gPrimaryMouseInput_Entrance[4] = { // @ G0445_as_Graphic561_PrimaryMouseInput_Entrance[4]
|
||||
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
|
||||
MouseInput(kCommandEntranceEnterDungeon, 244, 298, 45, 58, kLeftMouseButton),
|
||||
// Strangerke - C201_COMMAND_ENTRANCE_RESUME isn't present in the demo
|
||||
MouseInput(kCommandEntranceResume, 244, 298, 76, 93, kLeftMouseButton),
|
||||
MouseInput(kCommandEntranceDrawCredits, 248, 293, 187, 199, kLeftMouseButton),
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gPrimaryMouseInput_RestartGame[2] = { // @ G0446_as_Graphic561_PrimaryMouseInput_RestartGame[2]
|
||||
MouseInput gPrimaryMouseInput_RestartGame[2] = { // @ G0446_as_Graphic561_PrimaryMouseInput_RestartGame[2]
|
||||
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
|
||||
MouseInput(kCommandRestartGame, 103, 217, 145, 159, kLeftMouseButton),
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gPrimaryMouseInput_Interface[20] = { // @ G0447_as_Graphic561_PrimaryMouseInput_Interface[20]
|
||||
MouseInput gPrimaryMouseInput_Interface[20] = { // @ G0447_as_Graphic561_PrimaryMouseInput_Interface[20]
|
||||
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
|
||||
MouseInput(kCommandClickInChampion_0_StatusBox, 0, 42, 0, 28, kLeftMouseButton),
|
||||
MouseInput(kCommandClickInChampion_1_StatusBox, 69, 111, 0, 28, kLeftMouseButton),
|
||||
@ -42,7 +42,7 @@ MouseInput DM::gPrimaryMouseInput_Interface[20] = { // @ G0447_as_Graphic561_Pri
|
||||
MouseInput(kCommandClickInActionArea, 233, 319, 77, 121, kLeftMouseButton),
|
||||
MouseInput(kCommandFreezeGame, 0, 1, 198, 199, kLeftMouseButton),
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gSecondaryMouseInput_Movement[9] = { // @ G0448_as_Graphic561_SecondaryMouseInput_Movement[9]
|
||||
MouseInput gSecondaryMouseInput_Movement[9] = { // @ G0448_as_Graphic561_SecondaryMouseInput_Movement[9]
|
||||
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
|
||||
MouseInput(kCommandTurnLeft, 234, 261, 125, 145, kLeftMouseButton),
|
||||
MouseInput(kCommandMoveForward, 263, 289, 125, 145, kLeftMouseButton),
|
||||
@ -53,7 +53,7 @@ MouseInput DM::gSecondaryMouseInput_Movement[9] = { // @ G0448_as_Graphic561_Sec
|
||||
MouseInput(kCommandClickInDungeonView, 0, 223, 33, 168, kLeftMouseButton),
|
||||
MouseInput(kCommandToggleInventoryLeader, 0, 319, 33, 199, kRightMouseButton),
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gSecondaryMouseInput_ChampionInventory[38] = { // @ G0449_as_Graphic561_SecondaryMouseInput_ChampionInventory[38]
|
||||
MouseInput gSecondaryMouseInput_ChampionInventory[38] = { // @ G0449_as_Graphic561_SecondaryMouseInput_ChampionInventory[38]
|
||||
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
|
||||
MouseInput(kCommandCloseInventory, 0, 319, 0, 199, kRightMouseButton),
|
||||
MouseInput(kCommandSaveGame, 174, 182, 36, 44, kLeftMouseButton),
|
||||
@ -93,31 +93,31 @@ MouseInput DM::gSecondaryMouseInput_ChampionInventory[38] = { // @ G0449_as_Grap
|
||||
MouseInput(kCommandClickOnSlotBoxInventoryBackpackLine_1_9, 202, 217, 66, 81, kLeftMouseButton),
|
||||
MouseInput(kCommandClickInPanel, 96, 223, 83, 167, kLeftMouseButton),
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gPrimaryMouseInput_PartySleeping[3] = { // @ G0450_as_Graphic561_PrimaryMouseInput_PartySleeping[3]
|
||||
MouseInput gPrimaryMouseInput_PartySleeping[3] = { // @ G0450_as_Graphic561_PrimaryMouseInput_PartySleeping[3]
|
||||
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
|
||||
MouseInput(kCommandWakeUp, 0, 223, 33, 168, kLeftMouseButton),
|
||||
MouseInput(kCommandWakeUp, 0, 223, 33, 168, kRightMouseButton),
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gPrimaryMouseInput_FrozenGame[3] = { // @ G0451_as_Graphic561_PrimaryMouseInput_FrozenGame[3]
|
||||
MouseInput gPrimaryMouseInput_FrozenGame[3] = { // @ G0451_as_Graphic561_PrimaryMouseInput_FrozenGame[3]
|
||||
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
|
||||
MouseInput(kCommandUnfreezeGame, 0, 319, 0, 199, kLeftMouseButton),
|
||||
MouseInput(kCommandUnfreezeGame, 0, 319, 0, 199, kRightMouseButton),
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gMouseInput_ActionAreaNames[5] = { // @ G0452_as_Graphic561_MouseInput_ActionAreaNames[5]
|
||||
MouseInput gMouseInput_ActionAreaNames[5] = { // @ G0452_as_Graphic561_MouseInput_ActionAreaNames[5]
|
||||
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
|
||||
MouseInput(kCommandClickInActionAreaPass, 285, 318, 77, 83, kLeftMouseButton),
|
||||
MouseInput(kCommandClickInActionAreaAction_0, 234, 318, 86, 96, kLeftMouseButton),
|
||||
MouseInput(kCommandClickInActionAreaAction_1, 234, 318, 98, 108, kLeftMouseButton),
|
||||
MouseInput(kCommandClickInActionAreaAction_2, 234, 318, 110, 120, kLeftMouseButton),
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gMouseInput_ActionAreaIcons[5] = { // @ G0453_as_Graphic561_MouseInput_ActionAreaIcons[5]
|
||||
MouseInput gMouseInput_ActionAreaIcons[5] = { // @ G0453_as_Graphic561_MouseInput_ActionAreaIcons[5]
|
||||
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
|
||||
MouseInput(kCommandClickInActionAreaChampion_0_Action, 233, 252, 86, 120, kLeftMouseButton),
|
||||
MouseInput(kCommandClickInActionAreaChampion_1_Action, 255, 274, 86, 120, kLeftMouseButton),
|
||||
MouseInput(kCommandClickInActionAreaChampion_2_Action, 277, 296, 86, 120, kLeftMouseButton),
|
||||
MouseInput(kCommandClickInActionAreaChampion_3_Action, 299, 318, 86, 120, kLeftMouseButton),
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gMouseInput_SpellArea[9] = { // @ G0454_as_Graphic561_MouseInput_SpellArea[9]
|
||||
MouseInput gMouseInput_SpellArea[9] = { // @ G0454_as_Graphic561_MouseInput_SpellArea[9]
|
||||
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
|
||||
MouseInput(kCommandClickInSpellAreaSymbol_1, 235, 247, 51, 61, kLeftMouseButton),
|
||||
MouseInput(kCommandClickInSpellAreaSymbol_2, 249, 261, 51, 61, kLeftMouseButton),
|
||||
@ -128,7 +128,7 @@ MouseInput DM::gMouseInput_SpellArea[9] = { // @ G0454_as_Graphic561_MouseInput_
|
||||
MouseInput(kCommandClickInSpeallAreaCastSpell, 234, 303, 63, 73, kLeftMouseButton),
|
||||
MouseInput(kCommandClickInSpellAreaRecantSymbol, 305, 318, 63, 73, kLeftMouseButton),
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gMouseInput_ChampionNamesHands[13] = { // @ G0455_as_Graphic561_MouseInput_ChampionNamesHands[13]
|
||||
MouseInput gMouseInput_ChampionNamesHands[13] = { // @ G0455_as_Graphic561_MouseInput_ChampionNamesHands[13]
|
||||
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
|
||||
MouseInput(kCommandSetLeaderChampion_0, 0, 42, 0, 6, kLeftMouseButton),
|
||||
MouseInput(kCommandSetLeaderChampion_1, 69, 111, 0, 6, kLeftMouseButton),
|
||||
@ -143,7 +143,7 @@ MouseInput DM::gMouseInput_ChampionNamesHands[13] = { // @ G0455_as_Graphic561_M
|
||||
MouseInput(kCommandClickOnSlotBoxChampion_3_StatusBoxReadyHand, 211, 226, 10, 25, kLeftMouseButton),
|
||||
MouseInput(kCommandClickOnSlotBoxChampion_3_StatusBoxActionHand, 231, 246, 10, 25, kLeftMouseButton),
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gMouseInput_PanelChest[9] = { // @ G0456_as_Graphic561_MouseInput_PanelChest[9]
|
||||
MouseInput gMouseInput_PanelChest[9] = { // @ G0456_as_Graphic561_MouseInput_PanelChest[9]
|
||||
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
|
||||
MouseInput(kCommandClickOnSlotBoxChest_1, 117, 132, 92, 107, kLeftMouseButton),
|
||||
MouseInput(kCommandClickOnSlotBoxChest_2, 106, 121, 109, 124, kLeftMouseButton),
|
||||
@ -154,7 +154,7 @@ MouseInput DM::gMouseInput_PanelChest[9] = { // @ G0456_as_Graphic561_MouseInput
|
||||
MouseInput(kCommandClickOnSlotBoxChest_7, 179, 194, 137, 152, kLeftMouseButton),
|
||||
MouseInput(kCommandClickOnSlotBoxChest_8, 196, 211, 138, 153, kLeftMouseButton),
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gMouseInput_PanelResurrectReincarnateCancel[4] = { // @ G0457_as_Graphic561_MouseInput_PanelResurrectReincarnateCancel[4]
|
||||
MouseInput gMouseInput_PanelResurrectReincarnateCancel[4] = { // @ G0457_as_Graphic561_MouseInput_PanelResurrectReincarnateCancel[4]
|
||||
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
|
||||
MouseInput(kCommandClickInPanelResurrect, 108, 158, 90, 138, kLeftMouseButton), /* Atari ST: Box = 104, 158, 86, 142 */
|
||||
MouseInput(kCommandClickInPanelReincarnate, 161, 211, 90, 138, kLeftMouseButton), /* Atari ST: Box = 163, 217, 86, 142 */
|
||||
@ -162,44 +162,44 @@ MouseInput DM::gMouseInput_PanelResurrectReincarnateCancel[4] = { // @ G0457_as_
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
|
||||
|
||||
MouseInput DM::gPrimaryMouseInput_ViewportDialog1Choice[2] = { // @ G0471_as_Graphic561_PrimaryMouseInput_ViewportDialog1Choice[2]
|
||||
MouseInput gPrimaryMouseInput_ViewportDialog1Choice[2] = { // @ G0471_as_Graphic561_PrimaryMouseInput_ViewportDialog1Choice[2]
|
||||
MouseInput(kCommandClickOnDialogChoice_1, 16, 207, 138, 152, kLeftMouseButton), /* Bottom button */
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gPrimaryMouseInput_ViewportDialog2Choices[3] = { // @ G0472_as_Graphic561_PrimaryMouseInput_ViewportDialog2Choices[3]
|
||||
MouseInput gPrimaryMouseInput_ViewportDialog2Choices[3] = { // @ G0472_as_Graphic561_PrimaryMouseInput_ViewportDialog2Choices[3]
|
||||
MouseInput(kCommandClickOnDialogChoice_1, 16, 207, 101, 115, kLeftMouseButton), /* Top button */
|
||||
MouseInput(kCommandClickOnDialogChoice_2, 16, 207, 138, 152, kLeftMouseButton), /* Bottom button */
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gPrimaryMouseInput_ViewportDialog3Choices[4] = { // @ G0473_as_Graphic561_PrimaryMouseInput_ViewportDialog3Choices[4]
|
||||
MouseInput gPrimaryMouseInput_ViewportDialog3Choices[4] = { // @ G0473_as_Graphic561_PrimaryMouseInput_ViewportDialog3Choices[4]
|
||||
MouseInput(kCommandClickOnDialogChoice_1, 16, 207, 101, 115, kLeftMouseButton), /* Top button */
|
||||
MouseInput(kCommandClickOnDialogChoice_2, 16, 101, 138, 152, kLeftMouseButton), /* Lower left button */
|
||||
MouseInput(kCommandClickOnDialogChoice_3, 123, 207, 138, 152, kLeftMouseButton), /* Lower right button */
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gPrimaryMouseInput_ViewportDialog4Choices[5] = { // @ G0474_as_Graphic561_PrimaryMouseInput_ViewportDialog4Choices[5]
|
||||
MouseInput gPrimaryMouseInput_ViewportDialog4Choices[5] = { // @ G0474_as_Graphic561_PrimaryMouseInput_ViewportDialog4Choices[5]
|
||||
MouseInput(kCommandClickOnDialogChoice_1, 16, 101, 101, 115, kLeftMouseButton), /* Top left button */
|
||||
MouseInput(kCommandClickOnDialogChoice_2, 123, 207, 101, 115, kLeftMouseButton), /* Top right button */
|
||||
MouseInput(kCommandClickOnDialogChoice_3, 16, 101, 138, 152, kLeftMouseButton), /* Lower left button */
|
||||
MouseInput(kCommandClickOnDialogChoice_4, 123, 207, 138, 152, kLeftMouseButton), /* Lower right button */
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gPrimaryMouseInput_ScreenDialog1Choice[2] = { // @ G0475_as_Graphic561_PrimaryMouseInput_ScreenDialog1Choice[2]
|
||||
MouseInput gPrimaryMouseInput_ScreenDialog1Choice[2] = { // @ G0475_as_Graphic561_PrimaryMouseInput_ScreenDialog1Choice[2]
|
||||
MouseInput(kCommandClickOnDialogChoice_1, 63, 254, 138, 152, kLeftMouseButton), /* Bottom button */
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gPrimaryMouseInput_ScreenDialog2Choices[3] = { // @ G0476_as_Graphic561_PrimaryMouseInput_ScreenDialog2Choices[3]
|
||||
MouseInput gPrimaryMouseInput_ScreenDialog2Choices[3] = { // @ G0476_as_Graphic561_PrimaryMouseInput_ScreenDialog2Choices[3]
|
||||
MouseInput(kCommandClickOnDialogChoice_1, 63, 254, 101, 115, kLeftMouseButton), /* Top button */
|
||||
MouseInput(kCommandClickOnDialogChoice_2, 63, 254, 138, 152, kLeftMouseButton), /* Bottom button */
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gPrimaryMouseInput_ScreenDialog3Choices[4] = { // @ G0477_as_Graphic561_PrimaryMouseInput_ScreenDialog3Choices[4]
|
||||
MouseInput gPrimaryMouseInput_ScreenDialog3Choices[4] = { // @ G0477_as_Graphic561_PrimaryMouseInput_ScreenDialog3Choices[4]
|
||||
MouseInput(kCommandClickOnDialogChoice_1, 63, 254, 101, 115, kLeftMouseButton), /* Top button */
|
||||
MouseInput(kCommandClickOnDialogChoice_2, 63, 148, 138, 152, kLeftMouseButton), /* Lower left button */
|
||||
MouseInput(kCommandClickOnDialogChoice_3, 170, 254, 138, 152, kLeftMouseButton), /* Lower right button */
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
MouseInput DM::gPrimaryMouseInput_ScreenDialog4Choices[5] = { // @ G0478_as_Graphic561_PrimaryMouseInput_ScreenDialog4Choices[5]
|
||||
MouseInput gPrimaryMouseInput_ScreenDialog4Choices[5] = { // @ G0478_as_Graphic561_PrimaryMouseInput_ScreenDialog4Choices[5]
|
||||
MouseInput(kCommandClickOnDialogChoice_1, 63, 148, 101, 115, kLeftMouseButton), /* Top left button */
|
||||
MouseInput(kCommandClickOnDialogChoice_2, 170, 254, 101, 115, kLeftMouseButton), /* Top right button */
|
||||
MouseInput(kCommandClickOnDialogChoice_3, 63, 148, 138, 152, kLeftMouseButton), /* Lower left button */
|
||||
MouseInput(kCommandClickOnDialogChoice_4, 170, 254, 138, 152, kLeftMouseButton), /* Lower right button */
|
||||
MouseInput(kCommandNone, 0, 0, 0, 0, kNoneMouseButton)};
|
||||
|
||||
MouseInput* DM::gPrimaryMouseInput_DialogSets[2][4] = { // @ G0480_aaps_PrimaryMouseInput_DialogSets
|
||||
MouseInput* gPrimaryMouseInput_DialogSets[2][4] = { // @ G0480_aaps_PrimaryMouseInput_DialogSets
|
||||
{gPrimaryMouseInput_ViewportDialog1Choice,
|
||||
gPrimaryMouseInput_ViewportDialog2Choices,
|
||||
gPrimaryMouseInput_ViewportDialog3Choices,
|
||||
@ -211,7 +211,13 @@ MouseInput* DM::gPrimaryMouseInput_DialogSets[2][4] = { // @ G0480_aaps_PrimaryM
|
||||
|
||||
|
||||
EventManager::EventManager(DMEngine *vm) : _vm(vm) {
|
||||
_dummyMapIndex = 0;
|
||||
_primaryMouseInput = nullptr;
|
||||
_secondaryMouseInput = nullptr;
|
||||
|
||||
_pendingClickPresent = false;
|
||||
_isCommandQueueLocked = true;
|
||||
|
||||
_dummyMapIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -242,7 +248,7 @@ void EventManager::initMouse() {
|
||||
CursorMan.pushCursor(mouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0);
|
||||
CursorMan.showMouse(false);
|
||||
|
||||
setMousePos(Common::Point(320/2, 200/2));
|
||||
setMousePos(Common::Point(320 / 2, 200 / 2));
|
||||
// TODO: add cursor creatin, set to hidden
|
||||
}
|
||||
|
||||
@ -261,7 +267,11 @@ void EventManager::processInput() {
|
||||
|
||||
Common::Event event;
|
||||
while (_vm->_system->getEventManager()->pollEvent(event)) {
|
||||
if (event.type == Common::EVENT_KEYDOWN && !event.synthetic) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.synthetic)
|
||||
break;
|
||||
|
||||
switch (event.kbd.keycode) {
|
||||
case Common::KEYCODE_w:
|
||||
dungeonMan.mapCoordsAfterRelMovement(dungeonMan._currMap.partyDir, 1, 0, currMap.partyPosX, currMap.partyPosY);
|
||||
@ -290,8 +300,51 @@ void EventManager::processInput() {
|
||||
dungeonMan.setCurrentMapAndPartyMap(--_dummyMapIndex);
|
||||
break;
|
||||
}
|
||||
} else if (event.type == Common::EVENT_MOUSEMOVE) {
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
_mousePos = event.mouse;
|
||||
break;
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
_pendingClickPresent = true;
|
||||
_pendingClickPos = _mousePos;
|
||||
_pendingClickButton = (event.type == Common::EVENT_LBUTTONUP) ? kLeftMouseButton : kRightMouseButton;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EventManager::processPendingClick() {
|
||||
if (_pendingClickPresent) {
|
||||
_pendingClickPresent = false;
|
||||
processClick(_pendingClickPos, _pendingClickButton);
|
||||
}
|
||||
}
|
||||
|
||||
void EventManager::processClick(Common::Point mousePos, MouseButton button) {
|
||||
CommandType commandType;
|
||||
|
||||
commandType = getCommandTypeFromMouseInput(_primaryMouseInput, mousePos, button);
|
||||
if (commandType == kCommandNone)
|
||||
commandType = getCommandTypeFromMouseInput(_secondaryMouseInput, mousePos, button);
|
||||
|
||||
if (commandType != kCommandNone)
|
||||
_commandQueue.push(Command(mousePos, commandType));
|
||||
|
||||
_isCommandQueueLocked = false;
|
||||
}
|
||||
|
||||
CommandType EventManager::getCommandTypeFromMouseInput(MouseInput *input, Common::Point mousePos, MouseButton button) {
|
||||
if (!input)
|
||||
return kCommandNone;
|
||||
CommandType commandType = kCommandNone;
|
||||
|
||||
while ((commandType = input->commandTypeToIssue) != kCommandNone) {
|
||||
if (input->hitbox.isPointInside(mousePos) && input->button == button)
|
||||
break;
|
||||
input++;
|
||||
}
|
||||
return commandType;
|
||||
}
|
||||
|
||||
|
||||
}; // end of namespace DM
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define DM_EVENTMAN_H
|
||||
|
||||
#include "common/events.h"
|
||||
#include "common/queue.h"
|
||||
#include "gfx.h"
|
||||
|
||||
|
||||
@ -127,10 +128,10 @@ enum CommandType {
|
||||
|
||||
class Command {
|
||||
public:
|
||||
int16 posX, posY;
|
||||
Common::Point pos;
|
||||
CommandType type;
|
||||
|
||||
Command(int16 x, int16 y, CommandType commandType): posX(x), posY(y), type(type) {}
|
||||
Command(Common::Point position, CommandType commandType): pos(position), type(type) {}
|
||||
}; // @ COMMAND
|
||||
|
||||
|
||||
@ -141,7 +142,7 @@ public:
|
||||
MouseButton button;
|
||||
|
||||
MouseInput(CommandType type, uint16 x1, uint16 x2, uint16 y1, uint16 y2, MouseButton mouseButton)
|
||||
: commandTypeToIssue(type), hitbox(x1, x2, y1, y2), button(mouseButton) {}
|
||||
: commandTypeToIssue(type), hitbox(x1, x2 + 1, y1, y2 + 1), button(mouseButton) {}
|
||||
}; // @ MOUSE_INPUT
|
||||
|
||||
extern MouseInput gPrimaryMouseInput_Entrance[4]; // @ G0445_as_Graphic561_PrimaryMouseInput_Entrance[4]
|
||||
@ -183,13 +184,26 @@ class EventManager {
|
||||
|
||||
Common::Point _mousePos;
|
||||
uint16 _dummyMapIndex;
|
||||
|
||||
bool _pendingClickPresent; // G0436_B_PendingClickPresent
|
||||
Common::Point _pendingClickPos; // @ G0437_i_PendingClickX, G0438_i_PendingClickY
|
||||
MouseButton _pendingClickButton; // @ G0439_i_PendingClickButtonsStatus
|
||||
|
||||
bool _isCommandQueueLocked;
|
||||
Common::Queue<Command> _commandQueue;
|
||||
public:
|
||||
MouseInput* _primaryMouseInput;// @ G0441_ps_PrimaryMouseInput
|
||||
MouseInput* _secondaryMouseInput;// @ G0442_ps_SecondaryMouseInput
|
||||
|
||||
EventManager(DMEngine *vm);
|
||||
void initMouse();
|
||||
void showMouse(bool visibility);
|
||||
|
||||
void setMousePos(Common::Point pos);
|
||||
void processInput();
|
||||
void processPendingClick(); // @ F0360_COMMAND_ProcessPendingClick
|
||||
void processClick(Common::Point mousePos, MouseButton button); // @ F0359_COMMAND_ProcessClick_CPSC
|
||||
CommandType getCommandTypeFromMouseInput(MouseInput *input, Common::Point mousePos, MouseButton button); // @ F0358_COMMAND_GetCommandFromMouseInput_CPSC
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -622,7 +622,7 @@ DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) {
|
||||
for (int i = 0; i < 18; i++)
|
||||
_currMapDoorOrnIndices[i] = 0;
|
||||
|
||||
Thing _inscriptionThing = Thing::thingNone;
|
||||
_inscriptionThing = Thing::thingNone;
|
||||
}
|
||||
|
||||
DisplayMan::~DisplayMan() {
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define GFX_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/rect.h"
|
||||
#include "dm.h"
|
||||
|
||||
namespace DM {
|
||||
@ -20,6 +21,9 @@ public:
|
||||
uint16 Y2;
|
||||
|
||||
Box(uint16 x1, uint16 x2, uint16 y1, uint16 y2): X1(x1), X2(x2), Y1(y1), Y2(y2) {}
|
||||
bool isPointInside(Common::Point point) {
|
||||
return (X1 <= point.x) && (point.x < X2) && (Y1 <= point.y) && (point.y < Y2);
|
||||
}
|
||||
}; // @ BOX_BYTE, BOX_WORD
|
||||
|
||||
// The frames in the original sources contain inclusive boundaries and byte widths, not pixel widths
|
||||
|
Loading…
Reference in New Issue
Block a user