diff options
-rw-r--r-- | engines/dm/dm.cpp | 5 | ||||
-rw-r--r-- | engines/dm/dm.h | 2 | ||||
-rw-r--r-- | engines/dm/dungeonman.cpp | 4 | ||||
-rw-r--r-- | engines/dm/dungeonman.h | 6 | ||||
-rw-r--r-- | engines/dm/eventman.cpp | 7 | ||||
-rw-r--r-- | engines/dm/eventman.h | 142 | ||||
-rw-r--r-- | engines/dm/gfx.h | 9 |
7 files changed, 156 insertions, 19 deletions
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index a86e7850b9..002068a650 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -12,8 +12,9 @@ #include "common/events.h" #include "dm/dm.h" -#include "dm/gfx.h" -#include "dm/dungeonman.h" +#include "gfx.h" +#include "dungeonman.h" +#include "eventman.h" namespace DM { diff --git a/engines/dm/dm.h b/engines/dm/dm.h index b77f2cce44..c381587abf 100644 --- a/engines/dm/dm.h +++ b/engines/dm/dm.h @@ -4,7 +4,6 @@ #include "common/random.h" #include "engines/engine.h" #include "gui/debugger.h" -#include "eventman.h" namespace DM { @@ -12,6 +11,7 @@ namespace DM { class Console; class DisplayMan; class DungeonMan; +class EventManager; enum direction { diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp index dd73e24a81..efff5ff16c 100644 --- a/engines/dm/dungeonman.cpp +++ b/engines/dm/dungeonman.cpp @@ -1,8 +1,6 @@ -#include "dungeonman.h" -#include "gfx.h" #include "common/file.h" #include "common/memstream.h" - +#include "dungeonman.h" using namespace DM; diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h index 7652596eb4..93261560f6 100644 --- a/engines/dm/dungeonman.h +++ b/engines/dm/dungeonman.h @@ -2,12 +2,12 @@ #define DUNGEONMAN_H #include "dm.h" +#include "dungeonman.h" #include "gfx.h" + namespace DM { -class DungeonMan; -struct Map; int16 ordinalToIndex(int16 val); // @ M01_ORDINAL_TO_INDEX int16 indexToOrdinal(int16 val); // @ M00_INDEX_TO_ORDINAL @@ -458,7 +458,7 @@ public: bool _isFacingFountain; // @ G0288_B_FacingFountain }; -} +}; #endif diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index 96a6bf570a..860ea06453 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -1,9 +1,8 @@ -#include "eventman.h" -#include "dm.h" #include "common/system.h" -#include "dungeonman.h" #include "graphics/cursorman.h" -#include "gfx.h" + +#include "eventman.h" +#include "dungeonman.h" diff --git a/engines/dm/eventman.h b/engines/dm/eventman.h index ccce4c46b7..cf34636598 100644 --- a/engines/dm/eventman.h +++ b/engines/dm/eventman.h @@ -1,12 +1,148 @@ - - #ifndef DM_EVENTMAN_H #define DM_EVENTMAN_H #include "common/events.h" +#include "gfx.h" + namespace DM { +enum MouseButton { + kLeftMouseButton, + kRightMouseButton +}; + +enum CommandType { + kCommandNone = 0, // @ C000_COMMAND_NONE + kCommandTurnLeft = 1, // @ C001_COMMAND_TURN_LEFT + kCommandTurnRight = 2, // @ C002_COMMAND_TURN_RIGHT + kCommandMoveForward = 3, // @ C003_COMMAND_MOVE_FORWARD + kCommandMoveRight = 4, // @ C004_COMMAND_MOVE_RIGHT + kCommandMoveBackward = 5, // @ C005_COMMAND_MOVE_BACKWARD + kCommandMoveLeft = 6, // @ C006_COMMAND_MOVE_LEFT + kCommandToggleInventoryChampion_0 = 7, // @ C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0 + kCommandToggleInventoryChampion_1 = 8, // @ C008_COMMAND_TOGGLE_INVENTORY_CHAMPION_1 + kCommandToggleInventoryChampion_2 = 9, // @ C009_COMMAND_TOGGLE_INVENTORY_CHAMPION_2 + kCommandToggleInventoryChampion_3 = 10, // @ C010_COMMAND_TOGGLE_INVENTORY_CHAMPION_3 + kCommandCloseInventory = 11, // @ C011_COMMAND_CLOSE_INVENTORY + kCommandClickInChampion_0_StatusBox = 12, // @ C012_COMMAND_CLICK_IN_CHAMPION_0_STATUS_BOX + kCommandClickInChampion_1_StatusBox = 13, // @ C013_COMMAND_CLICK_IN_CHAMPION_1_STATUS_BOX + kCommandClickInChampion_2_StatusBox = 14, // @ C014_COMMAND_CLICK_IN_CHAMPION_2_STATUS_BOX + kCommandClickInChampion_3_StatusBox = 15, // @ C015_COMMAND_CLICK_IN_CHAMPION_3_STATUS_BOX + kCommandSetLeaderChampion_0 = 16, // @ C016_COMMAND_SET_LEADER_CHAMPION_0 + kCommandSetLeaderChampion_1 = 17, // @ C017_COMMAND_SET_LEADER_CHAMPION_1 + kCommandSetLeaderChampion_2 = 18, // @ C018_COMMAND_SET_LEADER_CHAMPION_2 + kCommandSetLeaderChampion_3 = 19, // @ C019_COMMAND_SET_LEADER_CHAMPION_3 + kCommandClickOnSlotBoxChampion_0_StatusBoxReadyHand = 20, // @ C020_COMMAND_CLICK_ON_SLOT_BOX_00_CHAMPION_0_STATUS_BOX_READY_HAND + kCommandClickOnSlotBoxChampion_0_StatusBoxActionHand = 21, // @ C021_COMMAND_CLICK_ON_SLOT_BOX_01_CHAMPION_0_STATUS_BOX_ACTION_HAND + kCommandClickOnSlotBoxChampion_1_StatusBoxReadyHand = 22, // @ C022_COMMAND_CLICK_ON_SLOT_BOX_02_CHAMPION_1_STATUS_BOX_READY_HAND + kCommandClickOnSlotBoxChampion_1_StatusBoxAactionHand = 23, // @ C023_COMMAND_CLICK_ON_SLOT_BOX_03_CHAMPION_1_STATUS_BOX_ACTION_HAND + kCommandClickOnSlotBoxChampion_2_StatusBoxReadyHand = 24, // @ C024_COMMAND_CLICK_ON_SLOT_BOX_04_CHAMPION_2_STATUS_BOX_READY_HAND + kCommandClickOnSlotBoxChampion_2_StatusBoxActionHand = 25, // @ C025_COMMAND_CLICK_ON_SLOT_BOX_05_CHAMPION_2_STATUS_BOX_ACTION_HAND + kCommandClickOnSlotBoxChampion_3_StatusBoxReadyHand = 26, // @ C026_COMMAND_CLICK_ON_SLOT_BOX_06_CHAMPION_3_STATUS_BOX_READY_HAND + kCommandClickOnSlotBoxChampion_3_StatusBoxActionHand = 27, // @ C027_COMMAND_CLICK_ON_SLOT_BOX_07_CHAMPION_3_STATUS_BOX_ACTION_HAND + kCommandClickOnSlotBoxInventoryReadyHand = 28, // @ C028_COMMAND_CLICK_ON_SLOT_BOX_08_INVENTORY_READY_HAND + kCommandClickOnSlotBoxInventoryActionHand = 29, // @ C029_COMMAND_CLICK_ON_SLOT_BOX_09_INVENTORY_ACTION_HAND + kCommandClickOnSlotBoxInventoryHead = 30, // @ C030_COMMAND_CLICK_ON_SLOT_BOX_10_INVENTORY_HEAD + kCommandClickOnSlotBoxInventoryTorso = 31, // @ C031_COMMAND_CLICK_ON_SLOT_BOX_11_INVENTORY_TORSO + kCommandClickOnSlotBoxInventoryLegs = 32, // @ C032_COMMAND_CLICK_ON_SLOT_BOX_12_INVENTORY_LEGS + kCommandClickOnSlotBoxInventoryFeet = 33, // @ C033_COMMAND_CLICK_ON_SLOT_BOX_13_INVENTORY_FEET + kCommandClickOnSlotBoxInventoryPouch_2 = 34, // @ C034_COMMAND_CLICK_ON_SLOT_BOX_14_INVENTORY_POUCH_2 + kCommandClickOnSlotBoxInventoryQuiverLine_2_1 = 35, // @ C035_COMMAND_CLICK_ON_SLOT_BOX_15_INVENTORY_QUIVER_LINE2_1 + kCommandClickOnSlotBoxInventoryQuiverLine_1_2 = 36, // @ C036_COMMAND_CLICK_ON_SLOT_BOX_16_INVENTORY_QUIVER_LINE1_2 + kCommandClickOnSlotBoxInventoryQuiverLine_2_2 = 37, // @ C037_COMMAND_CLICK_ON_SLOT_BOX_17_INVENTORY_QUIVER_LINE2_2 + kCommandClickOnSlotBoxInventoryNeck = 38, // @ C038_COMMAND_CLICK_ON_SLOT_BOX_18_INVENTORY_NECK + kCommandClickOnSlotBoxInventoryPouch_1 = 39, // @ C039_COMMAND_CLICK_ON_SLOT_BOX_19_INVENTORY_POUCH_1 + kCommandClickOnSlotBoxInventoryQuiverLine_1_1 = 40, // @ C040_COMMAND_CLICK_ON_SLOT_BOX_20_INVENTORY_QUIVER_LINE1_1 + kCommandClickOnSlotBoxInventoryBackpackLine_1_1 = 41, // @ C041_COMMAND_CLICK_ON_SLOT_BOX_21_INVENTORY_BACKPACK_LINE1_1 + kCommandClickOnSlotBoxInventoryBackpackLine_2_2 = 42, // @ C042_COMMAND_CLICK_ON_SLOT_BOX_22_INVENTORY_BACKPACK_LINE2_2 + kCommandClickOnSlotBoxInventoryBackpackLine_2_3 = 43, // @ C043_COMMAND_CLICK_ON_SLOT_BOX_23_INVENTORY_BACKPACK_LINE2_3 + kCommandClickOnSlotBoxInventoryBackpackLine_2_4 = 44, // @ C044_COMMAND_CLICK_ON_SLOT_BOX_24_INVENTORY_BACKPACK_LINE2_4 + kCommandClickOnSlotBoxInventoryBackpackLine_2_5 = 45, // @ C045_COMMAND_CLICK_ON_SLOT_BOX_25_INVENTORY_BACKPACK_LINE2_5 + kCommandClickOnSlotBoxInventoryBackpackLine_2_6 = 46, // @ C046_COMMAND_CLICK_ON_SLOT_BOX_26_INVENTORY_BACKPACK_LINE2_6 + kCommandClickOnSlotBoxInventoryBackpackLine_2_7 = 47, // @ C047_COMMAND_CLICK_ON_SLOT_BOX_27_INVENTORY_BACKPACK_LINE2_7 + kCommandClickOnSlotBoxInventoryBackpackLine_2_8 = 48, // @ C048_COMMAND_CLICK_ON_SLOT_BOX_28_INVENTORY_BACKPACK_LINE2_8 + kCommandClickOnSlotBoxInventoryBackpackLine_2_9 = 49, // @ C049_COMMAND_CLICK_ON_SLOT_BOX_29_INVENTORY_BACKPACK_LINE2_9 + kCommandClickOnSlotBoxInventoryBackpackLine_1_2 = 50, // @ C050_COMMAND_CLICK_ON_SLOT_BOX_30_INVENTORY_BACKPACK_LINE1_2 + kCommandClickOnSlotBoxInventoryBackpackLine_1_3 = 51, // @ C051_COMMAND_CLICK_ON_SLOT_BOX_31_INVENTORY_BACKPACK_LINE1_3 + kCommandClickOnSlotBoxInventoryBackpackLine_1_4 = 52, // @ C052_COMMAND_CLICK_ON_SLOT_BOX_32_INVENTORY_BACKPACK_LINE1_4 + kCommandClickOnSlotBoxInventoryBackpackLine_1_5 = 53, // @ C053_COMMAND_CLICK_ON_SLOT_BOX_33_INVENTORY_BACKPACK_LINE1_5 + kCommandClickOnSlotBoxInventoryBackpackLine_1_6 = 54, // @ C054_COMMAND_CLICK_ON_SLOT_BOX_34_INVENTORY_BACKPACK_LINE1_6 + kCommandClickOnSlotBoxInventoryBackpackLine_1_7 = 55, // @ C055_COMMAND_CLICK_ON_SLOT_BOX_35_INVENTORY_BACKPACK_LINE1_7 + kCommandClickOnSlotBoxInventoryBackpackLine_1_8 = 56, // @ C056_COMMAND_CLICK_ON_SLOT_BOX_36_INVENTORY_BACKPACK_LINE1_8 + kCommandClickOnSlotBoxInventoryBackpackLine_1_9 = 57, // @ C057_COMMAND_CLICK_ON_SLOT_BOX_37_INVENTORY_BACKPACK_LINE1_9 + kCommandClickOnSlotBoxChest_1 = 58, // @ C058_COMMAND_CLICK_ON_SLOT_BOX_38_CHEST_1 + kCommandClickOnSlotBoxChest_2 = 59, // @ C059_COMMAND_CLICK_ON_SLOT_BOX_39_CHEST_2 + kCommandClickOnSlotBoxChest_3 = 60, // @ C060_COMMAND_CLICK_ON_SLOT_BOX_40_CHEST_3 + kCommandClickOnSlotBoxChest_4 = 61, // @ C061_COMMAND_CLICK_ON_SLOT_BOX_41_CHEST_4 + kCommandClickOnSlotBoxChest_5 = 62, // @ C062_COMMAND_CLICK_ON_SLOT_BOX_42_CHEST_5 + kCommandClickOnSlotBoxChest_6 = 63, // @ C063_COMMAND_CLICK_ON_SLOT_BOX_43_CHEST_6 + kCommandClickOnSlotBoxChest_7 = 64, // @ C064_COMMAND_CLICK_ON_SLOT_BOX_44_CHEST_7 + kCommandClickOnSlotBoxChest_8 = 65, // @ C065_COMMAND_CLICK_ON_SLOT_BOX_45_CHEST_8 + kCommandClickOnMouth = 70, // @ C070_COMMAND_CLICK_ON_MOUTH + kCommandClickOnEye = 71, // @ C071_COMMAND_CLICK_ON_EYE + kCommandClickInDungeonView = 80, // @ C080_COMMAND_CLICK_IN_DUNGEON_VIEW + kCommandClickInPanel = 81, // @ C081_COMMAND_CLICK_IN_PANEL + kCommandToggleInventoryLeader = 83, // @ C083_COMMAND_TOGGLE_INVENTORY_LEADER + kCommandClickInSpellArea = 100, // @ C100_COMMAND_CLICK_IN_SPELL_AREA + kCommandClickInSpellAreaSymbol_1 = 101, // @ C101_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_1 + kCommandClickInSpellAreaSymbol_2 = 102, // @ C102_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_2 + kCommandClickInSpellAreaSymbol_3 = 103, // @ C103_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_3 + kCommandClickInSpellAreaSymbol_4 = 104, // @ C104_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_4 + kCommandClickInSpellAreaSymbol_5 = 105, // @ C105_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_5 + kCommandClickInSpellAreaSymbol_6 = 106, // @ C106_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_6 + kCommandClickInSpellAreaRecantSymbol = 107, // @ C107_COMMAND_CLICK_IN_SPELL_AREA_RECANT_SYMBOL + kCommandClickInSpeallAreaCastSpell = 108, // @ C108_COMMAND_CLICK_IN_SPELL_AREA_CAST_SPELL + kCommandClickInActionArea = 111, // @ C111_COMMAND_CLICK_IN_ACTION_AREA + kCommandClickInActionAreaPass = 112, // @ C112_COMMAND_CLICK_IN_ACTION_AREA_PASS + kCommandClickInActionAreaAction_0 = 113, // @ C113_COMMAND_CLICK_IN_ACTION_AREA_ACTION_0 + kCommandClickInActionAreaAction_1 = 114, // @ C114_COMMAND_CLICK_IN_ACTION_AREA_ACTION_1 + kCommandClickInActionAreaAction_2 = 115, // @ C115_COMMAND_CLICK_IN_ACTION_AREA_ACTION_2 + kCommandClickInActionAreaChampion_0_Action = 116, // @ C116_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_0_ACTION + kCommandClickInActionAreaChampion_1_Action = 117, // @ C117_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_1_ACTION + kCommandClickInActionAreaChampion_2_Action = 118, // @ C118_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_2_ACTION + kCommandClickInActionAreaChampion_3_Action = 119, // @ C119_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_3_ACTION + kCommandClickOnChamptionIcon_Top_Left = 125, // @ C125_COMMAND_CLICK_ON_CHAMPION_ICON_TOP_LEFT + kCommandClickOnChamptionIcon_Top_Right = 126, // @ C126_COMMAND_CLICK_ON_CHAMPION_ICON_TOP_RIGHT + kCommandClickOnChamptionIcon_Lower_Right = 127, // @ C127_COMMAND_CLICK_ON_CHAMPION_ICON_LOWER_RIGHT + kCommandClickOnChamptionIcon_Lower_Left = 128, // @ C128_COMMAND_CLICK_ON_CHAMPION_ICON_LOWER_LEFT + kCommandSaveGame = 140, // @ C140_COMMAND_SAVE_GAME + kCommandSleep = 145, // @ C145_COMMAND_SLEEP + kCommandWakeUp = 146, // @ C146_COMMAND_WAKE_UP + kCommandFreezeGame = 147, // @ C147_COMMAND_FREEZE_GAME + kCommandUnfreezeGame = 148, // @ C148_COMMAND_UNFREEZE_GAME + kCommandClickInPanelResurrect = 160, // @ C160_COMMAND_CLICK_IN_PANEL_RESURRECT + kCommandClickInPanelReincarnate = 161, // @ C161_COMMAND_CLICK_IN_PANEL_REINCARNATE + kCommandClickInPanelCancel = 162, // @ C162_COMMAND_CLICK_IN_PANEL_CANCEL + kCommandEntranceEnterDungeon = 200, // @ C200_COMMAND_ENTRANCE_ENTER_DUNGEON + kCommandEntranceResume = 201, // @ C201_COMMAND_ENTRANCE_RESUME /* Versions 1.x and 2.x command */ + kCommandEntranceDrawCredits = 202, // @ C202_COMMAND_ENTRANCE_DRAW_CREDITS /* Versions 1.x and 2.x command */ + kCommandClickOnDialogChoice_1 = 210, // @ C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1 + kCommandClickOnDialogChoice_2 = 211, // @ C211_COMMAND_CLICK_ON_DIALOG_CHOICE_2 + kCommandClickOnDialogChoice_3 = 212, // @ C212_COMMAND_CLICK_ON_DIALOG_CHOICE_3 + kCommandClickOnDialogChoice_4 = 213, // @ C213_COMMAND_CLICK_ON_DIALOG_CHOICE_4 + kCommandRestartGame = 215 // @ C215_COMMAND_RESTART_GAME +}; // @ NONE + +class Command { +public: + int16 posX, posY; + CommandType type; + + Command(int16 x, int16 y, CommandType commandType): posX(x), posY(y), type(type) {} +}; // @ COMMAND + + +class MouseInput { +public: + CommandType commandTypeToIssue; + Box hitbox; + MouseButton button; + + MouseInput(CommandType type, uint16 x1, uint16 x2, uint16 y1, uint16 y2, MouseButton mouseButton) + : commandTypeToIssue(type), hitbox(x1, x2, y1, y2), button(mouseButton) {} +}; // @ MOUSE_INPUT + class DMEngine; class EventManager { @@ -26,4 +162,4 @@ public: } -#endif DM_EVENTMAN_H +#endif diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index bbd2b190a6..9790517507 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -2,7 +2,7 @@ #define GFX_H #include "common/scummsys.h" -#include "dm/dm.h" +#include "dm.h" namespace DM { @@ -12,12 +12,15 @@ extern uint16 gPalCredits[16]; extern uint16 gPalEntrance[16]; extern uint16 gPalDungeonView[6][16]; -typedef struct { +class Box { +public: uint16 X1; uint16 X2; uint16 Y1; uint16 Y2; -} Box; // @ BOX_BYTE, BOX_WORD + + Box(uint16 x1, uint16 x2, uint16 y1, uint16 y2): X1(x1), X2(x2), Y1(y1), Y2(y2) {} +}; // @ BOX_BYTE, BOX_WORD // The frames in the original sources contain inclusive boundaries and byte widths, not pixel widths struct Frame { |