aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control/pet_glyphs.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-23 11:16:33 -0400
committerPaul Gilbert2016-07-10 16:11:47 -0400
commit58e1a807f3c7c9e0342ef1edd964d6d13de57dc3 (patch)
tree8ba734b03ca8ccaef46077a0de6ca7b523b830f0 /engines/titanic/pet_control/pet_glyphs.cpp
parent990f7b87c1b328b0cb2b663d37f4a1de50edf56c (diff)
downloadscummvm-rg350-58e1a807f3c7c9e0342ef1edd964d6d13de57dc3.tar.gz
scummvm-rg350-58e1a807f3c7c9e0342ef1edd964d6d13de57dc3.tar.bz2
scummvm-rg350-58e1a807f3c7c9e0342ef1edd964d6d13de57dc3.zip
TITANIC: Clean up on element highlighting
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;