aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control/pet_glyphs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/pet_control/pet_glyphs.cpp')
-rw-r--r--engines/titanic/pet_control/pet_glyphs.cpp38
1 files changed, 32 insertions, 6 deletions
diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp
index 1ab7d7ee1b..7144378548 100644
--- a/engines/titanic/pet_control/pet_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_glyphs.cpp
@@ -38,7 +38,7 @@ void CPetGlyph::drawAt(CScreenManager *screenManager, const Point &pt) {
_element.translate(-pt.x, -pt.y);
}
-void CPetGlyph::proc14(const Point &pt) {
+void CPetGlyph::proc14() {
warning("TODO: CPetGlyph::proc14");
}
@@ -183,7 +183,34 @@ Rect CPetGlyphs::getRect(int index) {
}
void CPetGlyphs::changeHighlight(int index) {
- warning("TODO: CPetGlyphs::changeHighlight");
+ if (index == _highlightIndex)
+ return;
+
+ if (_highlightIndex >= 0 && (_field20 & 4)) {
+ CPetGlyph *glyph = getGlyph(_highlightIndex);
+ if (glyph)
+ glyph->unhighlightCurrent();
+ }
+
+ _highlightIndex = index;
+ if (index >= 0) {
+ CPetGlyph *glyph = getGlyph(_highlightIndex);
+
+ if (glyph) {
+ if (_field20 & 4) {
+ Point pt;
+ int idx = getHighlightedIndex(_highlightIndex);
+ if (idx >= 0)
+ pt = getPosition(idx);
+
+ glyph->highlightCurrent(pt);
+ }
+
+ glyph->proc14();
+ }
+ } else if (_owner) {
+ _owner->proc28();
+ }
}
void CPetGlyphs::highlight(int index) {
@@ -281,11 +308,10 @@ bool CPetGlyphs::mouseButtonDown(const Point &pt) {
int index = getItemIndex(idx);
CPetGlyph *glyph = getGlyph(index);
if (glyph) {
- if (index == _highlightIndex) {
- glyph->proc28(glyphRect);
- glyph->proc14(pt);
+ if (glyph->checkHighlight(pt))
return true;
- } else {
+
+ if (!(_field20 & 2)) {
changeHighlight(index);
makePetDirty();
return true;