diff --git a/engines/ultima/nuvie/nuvie.h b/engines/ultima/nuvie/nuvie.h index 748e8132e2b..5cfc2657a8e 100644 --- a/engines/ultima/nuvie/nuvie.h +++ b/engines/ultima/nuvie/nuvie.h @@ -22,6 +22,7 @@ #ifndef NUVIE_NUVIE_H #define NUVIE_NUVIE_H +#include "ultima/shared/engine/events.h" #include "ultima/shared/engine/ultima.h" #include "ultima/shared/std/string.h" #include "ultima/nuvie/conf/configuration.h" @@ -39,7 +40,7 @@ class Screen; class Script; class SoundManager; -class NuvieEngine : public Ultima::Shared::UltimaEngine { +class NuvieEngine : public Ultima::Shared::UltimaEngine, public Ultima::Shared::EventsCallback { private: Configuration *_config; Screen *_screen; @@ -48,6 +49,7 @@ private: SaveGame *_savegame; SoundManager *_soundManager; + Ultima::Shared::EventsManager *_events; private: void initConfig(); void assignGameConfigValues(uint8 game_type); diff --git a/engines/ultima/shared/early/ultima_early.h b/engines/ultima/shared/early/ultima_early.h index c926119fcd0..49a17b44555 100644 --- a/engines/ultima/shared/early/ultima_early.h +++ b/engines/ultima/shared/early/ultima_early.h @@ -34,6 +34,7 @@ #include "engines/engine.h" #include "ultima/detection.h" +#include "ultima/shared/engine/events.h" #include "ultima/shared/engine/ultima.h" namespace Ultima { @@ -65,7 +66,7 @@ namespace Gfx { class Screen; } -class UltimaEarlyEngine : public UltimaEngine { +class UltimaEarlyEngine : public UltimaEngine, public EventsCallback { private: /** * Initialize the engine @@ -86,6 +87,7 @@ public: GameBase *_game; MouseCursor *_mouseCursor; Gfx::Screen *_screen; + EventsManager *_events; public: UltimaEarlyEngine(OSystem *syst, const UltimaGameDescription *gameDesc); ~UltimaEarlyEngine() override; diff --git a/engines/ultima/shared/engine/ultima.cpp b/engines/ultima/shared/engine/ultima.cpp index dce15cf0b69..df0f66bd857 100644 --- a/engines/ultima/shared/engine/ultima.cpp +++ b/engines/ultima/shared/engine/ultima.cpp @@ -36,7 +36,7 @@ UltimaEngine * g_ultima; UltimaEngine::UltimaEngine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _randomSource("Ultima"), - _dataArchive(nullptr), _events(nullptr) { + _dataArchive(nullptr) { g_ultima = this; } diff --git a/engines/ultima/shared/engine/ultima.h b/engines/ultima/shared/engine/ultima.h index 86dc41a59d5..57365e4c68b 100644 --- a/engines/ultima/shared/engine/ultima.h +++ b/engines/ultima/shared/engine/ultima.h @@ -23,8 +23,6 @@ #define ULTIMA_SHARED_ENGINE_ULTIMA_H #include "ultima/detection.h" -#include "ultima/shared/engine/debugger.h" -#include "ultima/shared/engine/events.h" #include "common/archive.h" #include "common/random.h" #include "engines/engine.h" @@ -32,7 +30,7 @@ namespace Ultima { namespace Shared { -class UltimaEngine : public Engine, public EventsCallback { +class UltimaEngine : public Engine { private: Common::RandomSource _randomSource; protected: @@ -56,8 +54,6 @@ protected: return false; } -public: - EventsManager *_events; public: UltimaEngine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc); ~UltimaEngine() override; diff --git a/engines/ultima/ultima8/gumps/container_gump.cpp b/engines/ultima/ultima8/gumps/container_gump.cpp index 33a2000341f..a21e6e19df1 100644 --- a/engines/ultima/ultima8/gumps/container_gump.cpp +++ b/engines/ultima/ultima8/gumps/container_gump.cpp @@ -302,14 +302,14 @@ Gump *ContainerGump::onMouseDown(int button, int32 mx, int32 my) { if (handled) return handled; // only interested in left clicks - if (button == Shared::BUTTON_LEFT) + if (button == Mouse::BUTTON_LEFT) return this; return nullptr; } void ContainerGump::onMouseClick(int button, int32 mx, int32 my) { - if (button == Shared::BUTTON_LEFT) { + if (button == Mouse::BUTTON_LEFT) { uint16 objID = TraceObjId(mx, my); Item *item = getItem(objID); @@ -326,7 +326,7 @@ void ContainerGump::onMouseClick(int button, int32 mx, int32 my) { } void ContainerGump::onMouseDouble(int button, int32 mx, int32 my) { - if (button == Shared::BUTTON_LEFT) { + if (button == Mouse::BUTTON_LEFT) { uint16 objID = TraceObjId(mx, my); if (objID == getObjId()) { diff --git a/engines/ultima/ultima8/gumps/credits_gump.cpp b/engines/ultima/ultima8/gumps/credits_gump.cpp index 90ada5e69ee..3ba34c23e9f 100644 --- a/engines/ultima/ultima8/gumps/credits_gump.cpp +++ b/engines/ultima/ultima8/gumps/credits_gump.cpp @@ -20,6 +20,7 @@ */ #include "common/config-manager.h" +#include "common/events.h" #include "ultima/ultima8/gumps/credits_gump.h" diff --git a/engines/ultima/ultima8/gumps/difficulty_gump.cpp b/engines/ultima/ultima8/gumps/difficulty_gump.cpp index 9d11a5bd784..ab5a31e50a0 100644 --- a/engines/ultima/ultima8/gumps/difficulty_gump.cpp +++ b/engines/ultima/ultima8/gumps/difficulty_gump.cpp @@ -141,7 +141,7 @@ void DifficultyGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scal } void DifficultyGump::onMouseClick(int button, int32 mx, int32 my) { - if (button == Shared::BUTTON_LEFT) { + if (button == Mouse::BUTTON_LEFT) { Gump *gump = FindGump(mx, my); if (gump && gump->GetIndex() > 0) { int idx = gump->GetIndex(); diff --git a/engines/ultima/ultima8/gumps/game_map_gump.cpp b/engines/ultima/ultima8/gumps/game_map_gump.cpp index 667cdd48a51..100b9b33cdf 100644 --- a/engines/ultima/ultima8/gumps/game_map_gump.cpp +++ b/engines/ultima/ultima8/gumps/game_map_gump.cpp @@ -271,12 +271,12 @@ Gump *GameMapGump::onMouseDown(int button, int32 mx, int32 my) { GumpToScreenSpace(sx, sy); AvatarMoverProcess *amp = Ultima8Engine::get_instance()->getAvatarMoverProcess(); - if (button == Shared::BUTTON_RIGHT || button == Shared::BUTTON_LEFT) { + if (button == Mouse::BUTTON_RIGHT || button == Mouse::BUTTON_LEFT) { amp->onMouseDown(button, sx, sy); } - if (button == Shared::BUTTON_LEFT || button == Shared::BUTTON_RIGHT || - button == Shared::BUTTON_MIDDLE) { + if (button == Mouse::BUTTON_LEFT || button == Mouse::BUTTON_RIGHT || + button == Mouse::BUTTON_MIDDLE) { // we take all clicks return this; } @@ -286,7 +286,7 @@ Gump *GameMapGump::onMouseDown(int button, int32 mx, int32 my) { void GameMapGump::onMouseUp(int button, int32 mx, int32 my) { AvatarMoverProcess *amp = Ultima8Engine::get_instance()->getAvatarMoverProcess(); - if (button == Shared::BUTTON_RIGHT || button == Shared::BUTTON_LEFT) { + if (button == Mouse::BUTTON_RIGHT || button == Mouse::BUTTON_LEFT) { amp->onMouseUp(button); } } @@ -294,10 +294,10 @@ void GameMapGump::onMouseUp(int button, int32 mx, int32 my) { void GameMapGump::onMouseClick(int button, int32 mx, int32 my) { MainActor *avatar = getMainActor(); switch (button) { - case Shared::BUTTON_LEFT: { + case Mouse::BUTTON_LEFT: { if (avatar->isInCombat()) break; - if (Mouse::get_instance()->isMouseDownEvent(Shared::BUTTON_RIGHT)) break; + if (Mouse::get_instance()->isMouseDownEvent(Mouse::BUTTON_RIGHT)) break; uint16 objID = TraceObjId(mx, my); Item *item = getItem(objID); @@ -314,7 +314,7 @@ void GameMapGump::onMouseClick(int button, int32 mx, int32 my) { } break; } - case Shared::BUTTON_MIDDLE: { + case Mouse::BUTTON_MIDDLE: { uint16 objID = TraceObjId(mx, my); Item *item = getItem(objID); if (item) { @@ -359,10 +359,10 @@ void GameMapGump::onMouseClick(int button, int32 mx, int32 my) { void GameMapGump::onMouseDouble(int button, int32 mx, int32 my) { MainActor *avatar = getMainActor(); switch (button) { - case Shared::BUTTON_LEFT: { + case Mouse::BUTTON_LEFT: { if (avatar->isInCombat()) break; - if (Mouse::get_instance()->isMouseDownEvent(Shared::BUTTON_RIGHT)) break; + if (Mouse::get_instance()->isMouseDownEvent(Mouse::BUTTON_RIGHT)) break; uint16 objID = TraceObjId(mx, my); Item *item = getItem(objID); diff --git a/engines/ultima/ultima8/gumps/keypad_gump.cpp b/engines/ultima/ultima8/gumps/keypad_gump.cpp index 87b6c2c1e69..7bf6dedf300 100644 --- a/engines/ultima/ultima8/gumps/keypad_gump.cpp +++ b/engines/ultima/ultima8/gumps/keypad_gump.cpp @@ -19,6 +19,8 @@ * */ +#include "common/events.h" + #include "ultima/ultima8/audio/audio_process.h" #include "ultima/ultima8/gumps/keypad_gump.h" #include "ultima/ultima8/games/game_data.h" diff --git a/engines/ultima/ultima8/gumps/mini_stats_gump.cpp b/engines/ultima/ultima8/gumps/mini_stats_gump.cpp index a1e0add4247..f8c62fed79e 100644 --- a/engines/ultima/ultima8/gumps/mini_stats_gump.cpp +++ b/engines/ultima/ultima8/gumps/mini_stats_gump.cpp @@ -102,7 +102,7 @@ uint16 MiniStatsGump::TraceObjId(int32 mx, int32 my) { } Gump *MiniStatsGump::onMouseDown(int button, int32 mx, int32 my) { - if (button == Shared::BUTTON_LEFT) + if (button == Mouse::BUTTON_LEFT) return this; return nullptr; diff --git a/engines/ultima/ultima8/gumps/minimap_gump.cpp b/engines/ultima/ultima8/gumps/minimap_gump.cpp index 734fb1809cd..54127cf15ec 100644 --- a/engines/ultima/ultima8/gumps/minimap_gump.cpp +++ b/engines/ultima/ultima8/gumps/minimap_gump.cpp @@ -177,14 +177,14 @@ Gump *MiniMapGump::onMouseDown(int button, int32 mx, int32 my) { return handled; // only interested in left clicks - if (button == Shared::BUTTON_LEFT) + if (button == Mouse::BUTTON_LEFT) return this; return nullptr; } void MiniMapGump::onMouseDouble(int button, int32 mx, int32 my) { - if (button == Shared::BUTTON_LEFT) { + if (button == Mouse::BUTTON_LEFT) { HideGump(); } } diff --git a/engines/ultima/ultima8/gumps/paged_gump.cpp b/engines/ultima/ultima8/gumps/paged_gump.cpp index 610e4080c39..86ea9ff7fb8 100644 --- a/engines/ultima/ultima8/gumps/paged_gump.cpp +++ b/engines/ultima/ultima8/gumps/paged_gump.cpp @@ -19,6 +19,8 @@ * */ +#include "common/events.h" + #include "ultima/ultima8/gumps/paged_gump.h" #include "ultima/ultima8/games/game_data.h" #include "ultima/ultima8/graphics/gump_shape_archive.h" diff --git a/engines/ultima/ultima8/gumps/u8_save_gump.cpp b/engines/ultima/ultima8/gumps/u8_save_gump.cpp index 1981edcac62..7d41dde710f 100644 --- a/engines/ultima/ultima8/gumps/u8_save_gump.cpp +++ b/engines/ultima/ultima8/gumps/u8_save_gump.cpp @@ -171,7 +171,7 @@ Gump *U8SaveGump::onMouseDown(int button, int32 mx, int32 my) { void U8SaveGump::onMouseClick(int button, int32 mx, int32 my) { - if (button != Shared::BUTTON_LEFT) return; + if (button != Mouse::BUTTON_LEFT) return; ParentToGump(mx, my); diff --git a/engines/ultima/ultima8/gumps/widgets/button_widget.cpp b/engines/ultima/ultima8/gumps/widgets/button_widget.cpp index a5296b5f0b3..d25b044efdd 100644 --- a/engines/ultima/ultima8/gumps/widgets/button_widget.cpp +++ b/engines/ultima/ultima8/gumps/widgets/button_widget.cpp @@ -110,7 +110,7 @@ Gump *ButtonWidget::onMouseDown(int button, int32 mx, int32 my) { Gump *ret = Gump::onMouseDown(button, mx, my); if (ret) return ret; - if (button == Shared::BUTTON_LEFT) { + if (button == Mouse::BUTTON_LEFT) { // CHECKME: change dimensions or not? if (!_mouseOver) { _shape = _shapeDown; @@ -130,7 +130,7 @@ uint16 ButtonWidget::TraceObjId(int32 mx, int32 my) { void ButtonWidget::onMouseUp(int button, int32 mx, int32 my) { - if (button == Shared::BUTTON_LEFT) { + if (button == Mouse::BUTTON_LEFT) { if (!_mouseOver) { _shape = _shapeUp; _frameNum = _frameNumUp; diff --git a/engines/ultima/ultima8/kernel/mouse.cpp b/engines/ultima/ultima8/kernel/mouse.cpp index f6c85ff4d56..33a54da0ec6 100644 --- a/engines/ultima/ultima8/kernel/mouse.cpp +++ b/engines/ultima/ultima8/kernel/mouse.cpp @@ -52,8 +52,8 @@ Mouse::~Mouse() { _instance = nullptr; } -bool Mouse::buttonDown(Shared::MouseButton button) { - assert(button != Shared::MOUSE_LAST); +bool Mouse::buttonDown(MouseButton button) { + assert(button != MOUSE_LAST); bool handled = false; uint32 now = g_system->getMillis(); @@ -91,8 +91,8 @@ bool Mouse::buttonDown(Shared::MouseButton button) { return handled; } -bool Mouse::buttonUp(Shared::MouseButton button) { - assert(button != Shared::MOUSE_LAST); +bool Mouse::buttonUp(MouseButton button) { + assert(button != MOUSE_LAST); bool handled = false; _mouseButton[button].clearState(MBS_DOWN); @@ -112,7 +112,7 @@ bool Mouse::buttonUp(Shared::MouseButton button) { handled = true; } - if (button == Shared::BUTTON_LEFT && _dragging != Mouse::DRAG_NOT) { + if (button == BUTTON_LEFT && _dragging != Mouse::DRAG_NOT) { stopDragging(_mousePos.x, _mousePos.y); handled = true; } @@ -126,7 +126,7 @@ void Mouse::popAllCursors() { update(); } -bool Mouse::isMouseDownEvent(Shared::MouseButton button) const { +bool Mouse::isMouseDownEvent(MouseButton button) const { return _mouseButton[button].isState(MBS_DOWN); } @@ -329,9 +329,9 @@ void Mouse::setMouseCoords(int mx, int my) { } if (_dragging == DRAG_NOT) { - if (_mouseButton[Shared::BUTTON_LEFT].isState(MBS_DOWN)) { - int startx = _mouseButton[Shared::BUTTON_LEFT]._downPoint.x; - int starty = _mouseButton[Shared::BUTTON_LEFT]._downPoint.y; + if (_mouseButton[BUTTON_LEFT].isState(MBS_DOWN)) { + int startx = _mouseButton[BUTTON_LEFT]._downPoint.x; + int starty = _mouseButton[BUTTON_LEFT]._downPoint.y; if (ABS(startx - mx) > 2 || ABS(starty - my) > 2) { startDragging(startx, starty); @@ -417,7 +417,7 @@ void Mouse::startDragging(int startx, int starty) { // pause the kernel Kernel::get_instance()->pause(); - _mouseButton[Shared::BUTTON_LEFT].setState(MBS_HANDLED); + _mouseButton[BUTTON_LEFT].setState(MBS_HANDLED); if (_dragging == DRAG_INVALID) { setMouseCursor(MOUSE_CROSS); @@ -518,7 +518,7 @@ void Mouse::stopDragging(int mx, int my) { } void Mouse::handleDelayedEvents() { - for (int button = 0; button < Shared::MOUSE_LAST; ++button) { + for (int button = 0; button < MOUSE_LAST; ++button) { if (!(_mouseButton[button]._state & (MBS_HANDLED | MBS_DOWN)) && !_mouseButton[button].lastWithinDblClkTimeout()) { Gump *gump = getGump(_mouseButton[button]._downGump); diff --git a/engines/ultima/ultima8/kernel/mouse.h b/engines/ultima/ultima8/kernel/mouse.h index 06744eec5cf..3e700756cce 100644 --- a/engines/ultima/ultima8/kernel/mouse.h +++ b/engines/ultima/ultima8/kernel/mouse.h @@ -24,7 +24,6 @@ #include "common/system.h" #include "common/rect.h" -#include "ultima/shared/engine/events.h" #include "ultima/ultima8/misc/common_types.h" #include "ultima/ultima8/misc/direction.h" @@ -81,6 +80,14 @@ class Gump; class Mouse { public: + enum MouseButton { + BUTTON_NONE = 0, + BUTTON_LEFT = 1, + BUTTON_RIGHT = 2, + BUTTON_MIDDLE = 3, + MOUSE_LAST + }; + enum MouseCursor { MOUSE_NORMAL = 0, MOUSE_NONE = 1, @@ -109,7 +116,7 @@ private: uint32 _flashingCursorTime; // mouse input state - MButton _mouseButton[Shared::MOUSE_LAST]; + MButton _mouseButton[MOUSE_LAST]; uint16 _mouseOverGump; Common::Point _mousePos; @@ -134,12 +141,12 @@ public: /** * Called when a mouse button is pressed down */ - bool buttonDown(Shared::MouseButton button); + bool buttonDown(MouseButton button); /** * Called when a mouse ubtton is released */ - bool buttonUp(Shared::MouseButton button); + bool buttonUp(MouseButton button); //! get mouse cursor length. 0 = short, 1 = medium, 2 = long int getMouseLength(int mx, int my) const; @@ -174,7 +181,7 @@ public: //! set current mouse cursor location void setMouseCoords(int mx, int my); - bool isMouseDownEvent(Shared::MouseButton button) const; + bool isMouseDownEvent(MouseButton button) const; //! remove all existing cursors void popAllCursors(); diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp index c2de86104a5..a6fec08b2aa 100644 --- a/engines/ultima/ultima8/ultima8.cpp +++ b/engines/ultima/ultima8/ultima8.cpp @@ -97,6 +97,8 @@ //#define PAINT_TIMING 1 +#define GAME_FRAME_TIME 50 + namespace Ultima { namespace Ultima8 { @@ -138,7 +140,6 @@ Ultima8Engine::Ultima8Engine(OSystem *syst, const Ultima::UltimaGameDescription } Ultima8Engine::~Ultima8Engine() { - FORGET_OBJECT(_events); FORGET_OBJECT(_kernel); FORGET_OBJECT(_objectManager); FORGET_OBJECT(_audioMixer); @@ -176,9 +177,6 @@ bool Ultima8Engine::initialize() { if (!Shared::UltimaEngine::initialize()) return false; - // Set up the events manager - _events = new Shared::EventsManager(this); - return true; } @@ -574,7 +572,7 @@ Common::Error Ultima8Engine::runGame() { } // get & handle all events in queue - while (_isRunning && _events->pollEvent(event)) { + while (_isRunning && pollEvent(event)) { handleEvent(event); } handleDelayedEvents(); @@ -781,11 +779,11 @@ void Ultima8Engine::handleEvent(const Common::Event &event) { case Common::EVENT_LBUTTONDOWN: case Common::EVENT_MBUTTONDOWN: case Common::EVENT_RBUTTONDOWN: { - Shared::MouseButton button = Shared::BUTTON_LEFT; + Mouse::MouseButton button = Mouse::BUTTON_LEFT; if (event.type == Common::EVENT_RBUTTONDOWN) - button = Shared::BUTTON_RIGHT; + button = Mouse::BUTTON_RIGHT; else if (event.type == Common::EVENT_MBUTTONDOWN) - button = Shared::BUTTON_MIDDLE; + button = Mouse::BUTTON_MIDDLE; _mouse->setMouseCoords(event.mouse.x, event.mouse.y); _mouse->buttonDown(button); @@ -795,11 +793,11 @@ void Ultima8Engine::handleEvent(const Common::Event &event) { case Common::EVENT_LBUTTONUP: case Common::EVENT_MBUTTONUP: case Common::EVENT_RBUTTONUP: { - Shared::MouseButton button = Shared::BUTTON_LEFT; + Mouse::MouseButton button = Mouse::BUTTON_LEFT; if (event.type == Common::EVENT_RBUTTONUP) - button = Shared::BUTTON_RIGHT; + button = Mouse::BUTTON_RIGHT; else if (event.type == Common::EVENT_MBUTTONUP) - button = Shared::BUTTON_MIDDLE; + button = Mouse::BUTTON_MIDDLE; _mouse->setMouseCoords(event.mouse.x, event.mouse.y); _mouse->buttonUp(button); @@ -1662,7 +1660,24 @@ void Ultima8Engine::showSplashScreen() { scr->update(); // Handle a single event to get the splash screen shown Common::Event event; - _events->pollEvent(event); + pollEvent(event); +} + +bool Ultima8Engine::pollEvent(Common::Event &event) { + uint32 timer = g_system->getMillis(); + + if (timer >= (_priorFrameCounterTime + GAME_FRAME_TIME)) { + // Time to build up next game frame + _priorFrameCounterTime = timer; + + // Render anything pending for the screen + Graphics::Screen *screen = getScreen(); + if (screen) + screen->update(); + } + + // Event handling + return g_system->getEventManager()->pollEvent(event); } } // End of namespace Ultima8 diff --git a/engines/ultima/ultima8/ultima8.h b/engines/ultima/ultima8/ultima8.h index f69477eb398..12cfa25d584 100644 --- a/engines/ultima/ultima8/ultima8.h +++ b/engines/ultima/ultima8/ultima8.h @@ -23,7 +23,9 @@ #ifndef ULTIMA8_ULTIMA8 #define ULTIMA8_ULTIMA8 +#include "common/events.h" #include "common/stream.h" +#include "graphics/screen.h" #include "ultima/shared/std/containers.h" #include "ultima/shared/engine/ultima.h" #include "ultima/ultima8/usecode/intrinsics.h" @@ -104,6 +106,7 @@ private: // Timing stuff int32 _lerpFactor; //!< Interpolation factor for this frame (0-256) bool _inBetweenFrame; //!< Set true if we are doing an inbetween frame + uint32 _priorFrameCounterTime; bool _highRes; //!< Set to true to enable larger screen size bool _frameSkip; //!< Set to true to enable frame skipping (default false) @@ -165,6 +168,7 @@ private: //! \return true if detected all the fields, false if detection failed bool getGameInfo(const istring &game, GameInfo *gameinfo); + bool pollEvent(Common::Event &event); protected: // Engine APIs Common::Error run() override; @@ -206,7 +210,7 @@ public: return _screen; } - Graphics::Screen *getScreen() const override; + Graphics::Screen *getScreen() const; Common::Error runGame(); virtual void handleEvent(const Common::Event &event); diff --git a/engines/ultima/ultima8/world/actors/avatar_gravity_process.cpp b/engines/ultima/ultima8/world/actors/avatar_gravity_process.cpp index ecf6bb9fbc2..3223a8da291 100644 --- a/engines/ultima/ultima8/world/actors/avatar_gravity_process.cpp +++ b/engines/ultima/ultima8/world/actors/avatar_gravity_process.cpp @@ -41,7 +41,7 @@ AvatarGravityProcess::AvatarGravityProcess(MainActor *avatar, int gravity) } void AvatarGravityProcess::run() { - if (!Mouse::get_instance()->isMouseDownEvent(Shared::BUTTON_RIGHT)) { + if (!Mouse::get_instance()->isMouseDownEvent(Mouse::BUTTON_RIGHT)) { // right mouse button not down, so fall normally GravityProcess::run(); diff --git a/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp b/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp index 5c90621dcab..68618112257 100644 --- a/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp +++ b/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp @@ -182,11 +182,11 @@ void AvatarMoverProcess::onMouseDown(int button, int32 mx, int32 my) { int bid = 0; switch (button) { - case Shared::BUTTON_LEFT: { + case Mouse::BUTTON_LEFT: { bid = 0; break; } - case Shared::BUTTON_RIGHT: { + case Mouse::BUTTON_RIGHT: { bid = 1; break; } @@ -204,9 +204,9 @@ void AvatarMoverProcess::onMouseDown(int button, int32 mx, int32 my) { void AvatarMoverProcess::onMouseUp(int button) { int bid = 0; - if (button == Shared::BUTTON_LEFT) { + if (button == Mouse::BUTTON_LEFT) { bid = 0; - } else if (button == Shared::BUTTON_RIGHT) { + } else if (button == Mouse::BUTTON_RIGHT) { bid = 1; } else { CANT_HAPPEN_MSG("invalid MouseUp passed to AvatarMoverProcess");