diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 10 | ||||
-rw-r--r-- | engines/titanic/messages/mouse_messages.h | 6 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_glyphs.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_glyphs.h | 14 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_rooms.cpp | 5 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_rooms_glyphs.cpp | 13 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_rooms_glyphs.h | 9 |
8 files changed, 39 insertions, 26 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 735caad288..7b894380b0 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -492,7 +492,7 @@ void CGameObject::setPosition(const Point &newPos) { } bool CGameObject::checkStartDragging(CMouseDragStartMsg *msg) { - if (_visible && checkPoint(msg->_mousePos, msg->_field14, 1)) { + if (_visible && checkPoint(msg->_mousePos, msg->_handled, 1)) { savePosition(); msg->_dragItem = this; return true; diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 4b9fab98f7..afcd2f05ee 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -276,11 +276,6 @@ protected: bool changeView(const CString &viewName, const CString &clipName); /** - * Support function for drag moving - */ - void dragMove(const Point &pt); - - /** * Get the centre of the game object's bounds */ Point getControid() const; @@ -573,6 +568,11 @@ public: * Gives the player a new assigned room in the specified passenger class */ void reassignRoom(int passClassNum); + + /** + * Support function for drag moving + */ + void dragMove(const Point &pt); }; } // End of namespace Titanic diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index ce02e1df73..4f568cd682 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -127,12 +127,12 @@ public: class CMouseDragStartMsg : public CMouseDragMsg { public: CTreeItem *_dragItem; - int _field14; + bool _handled; public: CLASSDEF - CMouseDragStartMsg() : CMouseDragMsg(), _dragItem(nullptr), _field14(0) {} + CMouseDragStartMsg() : CMouseDragMsg(), _dragItem(nullptr), _handled(false) {} CMouseDragStartMsg(const Point &pt) : CMouseDragMsg(pt), - _dragItem(nullptr), _field14(0) {} + _dragItem(nullptr), _handled(false) {} static bool isSupportedBy(const CTreeItem *item) { return supports(item, _type); diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index d1cb384729..b5fa407dd4 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -259,7 +259,7 @@ void CPetGlyphs::setFirstVisible(int index) { int idx = getHighlightedIndex(_highlightIndex); if (idx != -1) { Point tempPt = getPosition(idx); - glyph->proc27(tempPt, true); + glyph->glyphFocused(tempPt, true); } } } @@ -318,7 +318,7 @@ bool CPetGlyphs::MouseButtonDownMsg(const Point &pt) { CPetGlyph *glyph = getGlyph(index); if (glyph) { if (_highlightIndex == index) { - glyph->MouseButtonDownMsg(glyphRect); + glyph->selectGlyph(glyphRect, pt); glyph->updateTooltip(); } else { changeHighlight(index); @@ -366,7 +366,7 @@ bool CPetGlyphs::MouseDragStartMsg(CMouseDragStartMsg *msg) { Rect glyphRect = getRect(index); if (glyphRect.contains(msg->_mousePos)) - return glyph->proc29(glyphRect); + return glyph->dragGlyph(glyphRect, msg); else return glyph->MouseDragStartMsg(msg); } diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index f6c4806d83..26b1a658a6 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -173,14 +173,20 @@ public: */ virtual void highlightCurrent(const Point &pt) {} - virtual void proc27(const Point &pt, bool flag) {} + /** + * Glyph has been shifted to be first visible one + */ + virtual void glyphFocused(const Point &pt, bool flag) {} /** - * + * Selects a glyph */ - virtual void proc28(const Point &topLeft, const Point &pt) {} + virtual void selectGlyph(const Point &topLeft, const Point &pt) {} - virtual int proc29(const Point &pt) { return 0; } + /** + * Called when a glyph drag starts + */ + virtual bool dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg) { return false; } /** * Returns true if the glyph's bounds, shifted to a given position, diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index 34554eba95..028f1def3d 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -75,10 +75,11 @@ bool CPetRooms::MouseDragStartMsg(CMouseDragStartMsg *msg) { if (_glyphs.MouseDragStartMsg(msg)) return true; - if (!_glyphItem.contains(getGlyphPos(), msg->_mousePos)) + Point topLeft = getGlyphPos(); + if (!_glyphItem.contains(topLeft, msg->_mousePos)) return false; - _glyphItem.proc29(msg->_mousePos); + _glyphItem.dragGlyph(topLeft, msg); return true; } diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index 7f6ebd6898..b0a486d574 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -101,7 +101,7 @@ void CPetRoomsGlyph::drawAt(CScreenManager *screenManager, const Point &pt, bool _object5 = obj5; } -void CPetRoomsGlyph::proc28(const Point &topLeft, const Point &pt) { +void CPetRoomsGlyph::selectGlyph(const Point &topLeft, const Point &pt) { if (isAssigned()) { bool isShiftPressed = g_vm->_events->getSpecialButtons() & MK_SHIFT; @@ -115,7 +115,7 @@ void CPetRoomsGlyph::proc28(const Point &topLeft, const Point &pt) { } } -int CPetRoomsGlyph::proc29(const Point &pt) { +bool CPetRoomsGlyph::dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg) { bool isShiftPressed = g_vm->_events->getSpecialButtons() & MK_SHIFT; CPetControl *petControl = getPetControl(); @@ -128,12 +128,15 @@ int CPetRoomsGlyph::proc29(const Point &pt) { petControl->removeFromInventory(chevron, false, false); chevron->loadSurface(); - warning("TODO: CPetRoomsGlyph::proc29"); - // TODO + chevron->dragMove(msg->_mousePos); + msg->_handled = true; + + if (msg->execute(chevron)) + return true; } } - return 0; + return false; } void CPetRoomsGlyph::getTooltip(CPetText *text) { diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index f3bd2d2b61..3706fcc01e 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -76,11 +76,14 @@ public: virtual void draw2(CScreenManager *screenManager) {} /** - * + * Selects a glyph */ - virtual void proc28(const Point &topLeft, const Point &pt); + virtual void selectGlyph(const Point &topLeft, const Point &pt); - virtual int proc29(const Point &pt); + /** + * Called when a glyph drag starts + */ + virtual bool dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg); /** * Returns the tooltip text for when the glyph is selected |