From 287a9f6ef2ceb1cac4fef74832b3fdee9987ecf1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 07:35:04 -0400 Subject: TITANIC: Implement display of tooltips in RealLife --- engines/titanic/pet_control/pet_glyphs.cpp | 17 ++++++++++++----- engines/titanic/pet_control/pet_glyphs.h | 5 ++++- engines/titanic/pet_control/pet_real_life.cpp | 2 +- engines/titanic/pet_control/pet_rooms.cpp | 2 +- engines/titanic/pet_control/pet_section.cpp | 6 ++++-- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index ed879f286b..96e61c9d48 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -38,8 +38,15 @@ void CPetGlyph::drawAt(CScreenManager *screenManager, const Point &pt, bool isHi _element.translate(-pt.x, -pt.y); } -void CPetGlyph::proc14() { - warning("TODO: CPetGlyph::proc14"); +void CPetGlyph::updateTooltip() { + CPetText *petText = getPetSection()->getText(); + if (petText) { + petText->setColor(getPetSection()->getColor(0)); + getTooltip(petText); + + if (_owner) + getPetSection()->proc29(); + } } bool CPetGlyph::contains(const Point &delta, const Point &pt) { @@ -204,7 +211,7 @@ void CPetGlyphs::changeHighlight(int index) { glyph->highlightCurrent(pt); } - glyph->proc14(); + glyph->updateTooltip(); } } else if (_owner) { _owner->proc28(); @@ -308,7 +315,7 @@ bool CPetGlyphs::MouseButtonDownMsg(const Point &pt) { if (glyph) { if (_highlightIndex == index) { glyph->MouseButtonDownMsg(glyphRect); - glyph->proc14(); + glyph->updateTooltip(); } else { changeHighlight(index); makePetDirty(); @@ -430,7 +437,7 @@ bool CPetGlyphs::highlighted14() { if (_highlightIndex != -1) { CPetGlyph *pet = getGlyph(_highlightIndex); if (pet) { - pet->proc14(); + pet->updateTooltip(); return true; } } diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 792050166c..12f66870c6 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -118,7 +118,10 @@ public: */ virtual void draw2(CScreenManager *screenManager) {} - virtual void proc14(); + /** + * Updates the tooltip being shown for the glyph + */ + virtual void updateTooltip(); /** * Get the bounds for the glyph diff --git a/engines/titanic/pet_control/pet_real_life.cpp b/engines/titanic/pet_control/pet_real_life.cpp index 9d469626aa..72e350cd33 100644 --- a/engines/titanic/pet_control/pet_real_life.cpp +++ b/engines/titanic/pet_control/pet_real_life.cpp @@ -107,7 +107,7 @@ bool CPetRealLife::setupControl(CPetControl *petControl) { addButton(new CPetSound()); addButton(new CPetQuit()); - Rect textRect(0, 0, 32, 436); + Rect textRect(0, 0, 276, 30); textRect.moveTo(32, 436); _text.setBounds(textRect); _text.setHasBorder(false); diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index ee63f41ca6..71fa01ee77 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -187,7 +187,7 @@ bool CPetRooms::setupControl(CPetControl *petControl) { void CPetRooms::resetHighlight() { _glyphItem.set34(fn1()); _glyphs.resetHighlight(); - _glyphItem.proc14(); + _glyphItem.updateTooltip(); areaChanged(PET_ROOMS); } diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index 213c93e78d..8cd9207316 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -54,11 +54,13 @@ void CPetSection::proc27(int duration) { } void CPetSection::proc28() { - error("TODO"); + CPetText *text = getText(); + if (text) + text->setup(); } void CPetSection::proc29() { - error("TODO"); + _petControl->stopPetTimer(0); } void CPetSection::proc30() { -- cgit v1.2.3