aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/pet_control/pet_control.cpp5
-rw-r--r--engines/titanic/pet_control/pet_control.h5
-rw-r--r--engines/titanic/pet_control/pet_glyphs.cpp14
-rw-r--r--engines/titanic/pet_control/pet_glyphs.h14
-rw-r--r--engines/titanic/pet_control/pet_rooms.cpp71
-rw-r--r--engines/titanic/pet_control/pet_rooms.h18
-rw-r--r--engines/titanic/pet_control/pet_rooms_glyphs.cpp3
-rw-r--r--engines/titanic/pet_control/pet_rooms_glyphs.h6
-rw-r--r--engines/titanic/pet_control/pet_section.h2
-rw-r--r--engines/titanic/pet_control/pet_sound.cpp1
10 files changed, 120 insertions, 19 deletions
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index 145543fb07..98887f60d2 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -431,4 +431,9 @@ void CPetControl::playSound(int soundNum) {
}
}
+CString CPetControl::getRoomName() const {
+ CRoomItem *room = getRoom();
+ return room ? room->getName() : CString();
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index baad471b8d..78cfb61864 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -245,6 +245,11 @@ public:
* Play a sound
*/
void playSound(int soundNum);
+
+ /**
+ * Get the room name
+ */
+ CString getRoomName() const;
};
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp
index 8ed8fcf47c..8f8d8ba331 100644
--- a/engines/titanic/pet_control/pet_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_glyphs.cpp
@@ -307,7 +307,7 @@ bool CPetGlyphs::MouseButtonDownMsg(const Point &pt) {
CPetGlyph *glyph = getGlyph(index);
if (glyph) {
if (_highlightIndex == index) {
- glyph->proc28(glyphRect);
+ glyph->MouseButtonDownMsg(glyphRect);
glyph->proc14();
} else {
changeHighlight(index);
@@ -426,4 +426,16 @@ void CPetGlyphs::endDragging() {
_dragGlyph = nullptr;
}
+bool CPetGlyphs::highlighted14() {
+ if (_highlightIndex != -1) {
+ CPetGlyph *pet = getGlyph(_highlightIndex);
+ if (pet) {
+ pet->proc14();
+ return true;
+ }
+ }
+
+ return false;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h
index 9216a42c74..cefcd5cae9 100644
--- a/engines/titanic/pet_control/pet_glyphs.h
+++ b/engines/titanic/pet_control/pet_glyphs.h
@@ -172,7 +172,12 @@ public:
virtual void highlightCurrent(const Point &pt) {}
virtual void proc27(const Point &pt, bool flag) {}
- virtual void proc28(const Point &pt) {}
+
+ /**
+ * Handles mouse button down messages
+ */
+ virtual void MouseButtonDownMsg(const Point &pt) {}
+
virtual int proc29(const Point &pt) { return 0; }
/**
@@ -384,6 +389,13 @@ public:
* Called when a dragging operation ends
*/
void endDragging();
+
+ /**
+ * Reset the highlight
+ */
+ void resetHighlight() { changeHighlight(-1); }
+
+ bool highlighted14();
};
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp
index 9a55af2ba9..60ce398eb4 100644
--- a/engines/titanic/pet_control/pet_rooms.cpp
+++ b/engines/titanic/pet_control/pet_rooms.cpp
@@ -41,43 +41,71 @@ bool CPetRooms::setup(CPetControl *petControl) {
}
bool CPetRooms::reset() {
+ if (_petControl) {
+ _plinth.reset("PetChevPlinth", _petControl, MODE_UNSELECTED);
+ _glyphs.reset();
+
+ uint col = getColor(0);
+ _text.setColor(col);
+ _text.setColor(0, col);
+ }
+
return true;
}
void CPetRooms::draw(CScreenManager *screenManager) {
-
+ _petControl->drawSquares(screenManager, 6);
+ _plinth.draw(screenManager);
+ _glyphItem.drawAt(screenManager, getGlyphPos());
+ _text.draw(screenManager);
}
bool CPetRooms::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ if (_glyphs.MouseButtonDownMsg(msg->_mousePos))
+ return true;
+
+ if (!_glyphItem.contains(getGlyphPos(), msg->_mousePos))
+ return false;
+
+ _glyphItem.MouseButtonDownMsg(msg->_mousePos);
return true;
}
bool CPetRooms::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+ if (_glyphs.MouseDragStartMsg(msg))
+ return true;
+
+ if (!_glyphItem.contains(getGlyphPos(), msg->_mousePos))
+ return false;
+
+ _glyphItem.proc29(msg->_mousePos);
return true;
}
bool CPetRooms::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
- return true;
+ return false;
}
bool CPetRooms::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
- return true;
+ return !_glyphs.MouseButtonDownMsg(msg->_mousePos);
}
bool CPetRooms::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) {
- return true;
+ return _glyphs.VirtualKeyCharMsg(msg->_keyState.keycode);
}
-int CPetRooms::proc14() {
- return 0;
+bool CPetRooms::proc14(void *v1) {
+ warning("TODO: proc14");
+ return false;
}
void CPetRooms::displayMessage(const CString &msg) {
-
+ _glyphs.resetHighlight();
+ CPetSection::displayMessage(msg);
}
bool CPetRooms::isValid(CPetControl *petControl) {
- return true;
+ return setupControl(petControl);
}
void CPetRooms::load(SimpleFile *file, int param) {
@@ -102,15 +130,16 @@ void CPetRooms::load(SimpleFile *file, int param) {
}
void CPetRooms::postLoad() {
-
+ reset();
}
void CPetRooms::save(SimpleFile *file, int indent) const {
-
+ warning("TODO: CPetRooms::save");
}
void CPetRooms::enter(PetArea oldArea) {
-
+ if (!_glyphs.highlighted14())
+ _text.setText("");
}
void CPetRooms::enterRoom(CRoomItem *room) {
@@ -137,7 +166,7 @@ bool CPetRooms::setupControl(CPetControl *petControl) {
Rect rect2(0, 0, 81, 81);
rect2.moveTo(374, 494);
- _element.setBounds(rect2);
+ _plinth.setBounds(rect2);
_chevLeftOnDim = petControl->getHiddenObject("3PetChevLeftOnDim");
_chevLeftOffDim = petControl->getHiddenObject("3PetChevLeftOffDim");
@@ -152,6 +181,24 @@ bool CPetRooms::setupControl(CPetControl *petControl) {
_glyphs.setFlags(GFLAG_16);
_glyphItem.setup(petControl, &_glyphs);
_glyphItem.set38(1);
+ return true;
+}
+
+void CPetRooms::resetHighlight() {
+ _glyphItem.set34(fn1());
+ _glyphs.resetHighlight();
+ _glyphItem.proc14();
+ areaChanged(PET_ROOMS);
+}
+
+int CPetRooms::fn1() {
+ warning("TODO: CPetRooms::fn1");
+ return 0;
+}
+
+void CPetRooms::areaChanged(PetArea area) {
+ if (_petControl && _petControl->_currentArea == area)
+ _petControl->makeDirty();
}
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h
index 0974fee026..4c153d7fad 100644
--- a/engines/titanic/pet_control/pet_rooms.h
+++ b/engines/titanic/pet_control/pet_rooms.h
@@ -41,7 +41,7 @@ private:
CGameObject *_chevLeftOffLit;
CGameObject *_chevRightOnLit;
CGameObject *_chevRightOffLit;
- CPetGfxElement _element;
+ CPetGfxElement _plinth;
CPetText _text;
int _field1C0;
int _field1C4;
@@ -54,6 +54,20 @@ private:
* Setup the control
*/
bool setupControl(CPetControl *petControl);
+
+ /**
+ * Returns the glyth position
+ */
+ Point getGlyphPos() const { return Point(509, 388); }
+
+ /**
+ * Reset the highlight
+ */
+ void resetHighlight();
+
+ int fn1();
+
+ void areaChanged(PetArea area);
public:
CPetRooms();
@@ -82,7 +96,7 @@ public:
virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg);
- virtual int proc14();
+ virtual bool proc14(void *v1);
/**
* Display a message
diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp
index 6c032e7daf..d127c412f9 100644
--- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp
@@ -64,9 +64,10 @@ void CPetRoomsGlyph::drawAt(CScreenManager *screenManager, const Point &pt) {
warning("TODO: CPetRoomsGlyph::drawAt");
}
-void CPetRoomsGlyph::proc28(const Point &pt) {
+void CPetRoomsGlyph::MouseButtonDownMsg(const Point &pt) {
}
+
int CPetRoomsGlyph::proc29(const Point &pt) {
return 0;
}
diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h
index 80c3d36ad8..2832438fc9 100644
--- a/engines/titanic/pet_control/pet_rooms_glyphs.h
+++ b/engines/titanic/pet_control/pet_rooms_glyphs.h
@@ -62,7 +62,11 @@ public:
*/
virtual void draw2(CScreenManager *screenManager) {}
- virtual void proc28(const Point &pt);
+ /**
+ * Handles mouse button down messages
+ */
+ virtual void MouseButtonDownMsg(const Point &pt);
+
virtual int proc29(const Point &pt);
virtual void proc32();
virtual int proc33();
diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h
index 0911fd44f1..720e5323cf 100644
--- a/engines/titanic/pet_control/pet_section.h
+++ b/engines/titanic/pet_control/pet_section.h
@@ -90,7 +90,7 @@ public:
virtual bool KeyCharMsg(CKeyCharMsg *msg) { return false; }
virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return false; }
- virtual int proc14() { return 0; }
+ virtual bool proc14(void *v1) { return false; }
/**
* Returns item a drag-drop operation has dropped on, if any
diff --git a/engines/titanic/pet_control/pet_sound.cpp b/engines/titanic/pet_control/pet_sound.cpp
index 736b966974..72e991aa3d 100644
--- a/engines/titanic/pet_control/pet_sound.cpp
+++ b/engines/titanic/pet_control/pet_sound.cpp
@@ -272,6 +272,7 @@ bool CPetSound::MouseButtonUpMsg(const Point &pt) {
double offset = slider->getOffsetPixels();
sliderChanged(offset, sliderNum);
+ return true;
}
void CPetSound::getTooltip(CPetText *text) {