aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control/pet_rooms_glyphs.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-06-23 20:17:26 -0400
committerPaul Gilbert2016-07-15 19:24:18 -0400
commitf7d6db05e849855cbd17a60c3bbc3b1e96d1453a (patch)
treea0399d8b1a146a174e2af38e7b4e52473bb2964a /engines/titanic/pet_control/pet_rooms_glyphs.cpp
parent54eac84dc5051c9833ea96f0be6c7b44ba262817 (diff)
downloadscummvm-rg350-f7d6db05e849855cbd17a60c3bbc3b1e96d1453a.tar.gz
scummvm-rg350-f7d6db05e849855cbd17a60c3bbc3b1e96d1453a.tar.bz2
scummvm-rg350-f7d6db05e849855cbd17a60c3bbc3b1e96d1453a.zip
TITANIC: Adding Pet Room glyph methods
Diffstat (limited to 'engines/titanic/pet_control/pet_rooms_glyphs.cpp')
-rw-r--r--engines/titanic/pet_control/pet_rooms_glyphs.cpp51
1 files changed, 50 insertions, 1 deletions
diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp
index 9ecaefbf68..de06e02bc4 100644
--- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp
@@ -21,9 +21,11 @@
*/
#include "titanic/pet_control/pet_rooms_glyphs.h"
+#include "titanic/pet_control/pet_control.h"
#include "titanic/pet_control/pet_section.h"
#include "titanic/support/screen_manager.h"
#include "titanic/room_flags.h"
+#include "titanic/titanic.h"
namespace Titanic {
@@ -63,11 +65,36 @@ void CPetRoomsGlyph::drawAt(CScreenManager *screenManager, const Point &pt) {
warning("TODO: CPetRoomsGlyph::drawAt");
}
-void CPetRoomsGlyph::proc28(const Point &pt) {
+void CPetRoomsGlyph::proc28(const Point &topLeft, const Point &pt) {
+ if (isModeValid()) {
+ bool isShiftPressed = g_vm->_events->getSpecialButtons() & MK_SHIFT;
+ if (isShiftPressed) {
+ int selection = getSelection(topLeft, pt);
+ if (selection >= 0)
+ _roomFlags |= 1 << selection;
+ }
+
+ updateTooltip();
+ }
}
int CPetRoomsGlyph::proc29(const Point &pt) {
+ bool isShiftPressed = g_vm->_events->getSpecialButtons() & MK_SHIFT;
+ CPetControl *petControl = getPetControl();
+
+ if (!isShiftPressed && petControl) {
+ CGameObject *chevron = petControl->getHiddenObject("3PetChevron");
+
+ if (chevron) {
+ chevron->_id = _roomFlags;
+ chevron->_isMail = _field38;
+// petControl->removeFromInventory(chevon);
+// chevron->loadSurface();
+ // TODO
+ }
+ }
+
return 0;
}
@@ -92,6 +119,28 @@ void CPetRoomsGlyph::changeLocation(int newClassNum) {
_roomFlags = roomFlags.get();
}
+int CPetRoomsGlyph::getSelection(const Point &topLeft, const Point &pt) {
+ Rect rects[4] = {
+ Rect(topLeft.x, topLeft.y, topLeft.x + 13, topLeft.y + 10),
+ Rect(topLeft.x + 13, topLeft.y, topLeft.x + 26, topLeft.y + 10),
+ Rect(topLeft.x + 26, topLeft.y, topLeft.x + 39, topLeft.y + 10),
+ Rect(topLeft.x + 39, topLeft.y, topLeft.x + 52, topLeft.y + 10)
+ };
+
+ for (int idx = 0, btnIndex = 19; idx < 5; ++idx, btnIndex -= 4) {
+ // Iterate through each of the four rects, seeing if there's a match.
+ // If not, move it down to the next row for the next loop iteration
+ for (int i = 0; i < 4; ++i) {
+ if (rects[i].contains(pt))
+ return btnIndex - i;
+
+ rects[i].translate(0, 10);
+ }
+ }
+
+ return -1;
+}
+
/*------------------------------------------------------------------------*/
void CPetRoomsGlyphs::save2(SimpleFile *file, int indent) const {