aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-18 22:52:11 -0400
committerPaul Gilbert2016-07-10 16:11:31 -0400
commit225af470883f7e8e90ea18faf6b26b29342accb9 (patch)
tree7c36d94ac930599c31f9634e347b6444a8063b8a
parent42206332d0d7474dfead288c643ef4980c739773 (diff)
downloadscummvm-rg350-225af470883f7e8e90ea18faf6b26b29342accb9.tar.gz
scummvm-rg350-225af470883f7e8e90ea18faf6b26b29342accb9.tar.bz2
scummvm-rg350-225af470883f7e8e90ea18faf6b26b29342accb9.zip
TITANIC: Beginnings of PET RealLife Quit button
-rw-r--r--engines/titanic/pet_control/pet_control_sub12.cpp8
-rw-r--r--engines/titanic/pet_control/pet_control_sub12.h1
-rw-r--r--engines/titanic/pet_control/pet_gfx_element.h2
-rw-r--r--engines/titanic/pet_control/pet_glyphs.cpp14
-rw-r--r--engines/titanic/pet_control/pet_glyphs.h15
-rw-r--r--engines/titanic/pet_control/pet_quit.cpp26
-rw-r--r--engines/titanic/pet_control/pet_quit.h9
-rw-r--r--engines/titanic/pet_control/pet_section.h5
8 files changed, 79 insertions, 1 deletions
diff --git a/engines/titanic/pet_control/pet_control_sub12.cpp b/engines/titanic/pet_control/pet_control_sub12.cpp
index 59097e33a7..cc8d6ada10 100644
--- a/engines/titanic/pet_control/pet_control_sub12.cpp
+++ b/engines/titanic/pet_control/pet_control_sub12.cpp
@@ -148,4 +148,12 @@ void CPetControlSub12::mergeStrings() {
}
}
+void CPetControlSub12::resize(uint count) {
+ if (!count || _array.size() == count)
+ return;
+ _array.clear();
+ _array.resize(count);
+}
+
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_control_sub12.h b/engines/titanic/pet_control/pet_control_sub12.h
index 70010f0bd9..a5296ea62e 100644
--- a/engines/titanic/pet_control/pet_control_sub12.h
+++ b/engines/titanic/pet_control/pet_control_sub12.h
@@ -98,6 +98,7 @@ public:
*/
void draw(CScreenManager *screenManager);
+ void resize(uint count);
};
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_gfx_element.h b/engines/titanic/pet_control/pet_gfx_element.h
index bc9150e04c..5bfeca1716 100644
--- a/engines/titanic/pet_control/pet_gfx_element.h
+++ b/engines/titanic/pet_control/pet_gfx_element.h
@@ -28,7 +28,7 @@
namespace Titanic {
class CPetGfxElement: public CPetElement {
-protected:
+public:
CGameObject *_object0;
CGameObject *_object1;
CGameObject *_object2;
diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp
index 2bf73d909c..b121a17288 100644
--- a/engines/titanic/pet_control/pet_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_glyphs.cpp
@@ -52,6 +52,16 @@ CPetSection *CPetGlyph::getPetSection() const {
return _owner ? _owner->getOwner() : nullptr;
}
+CPetControl *CPetGlyph::getPetControl() const {
+ return _owner ? _owner->getPetControl() : nullptr;
+}
+
+void CPetGlyph::setName(const CString &name, CPetControl *petControl) {
+ Rect r(0, 0, 52, 52);
+ _element.setBounds(r);
+ _element.reset(name, petControl, MODE_UNSELECTED);
+}
+
/*------------------------------------------------------------------------*/
CPetGlyphs::CPetGlyphs() : _firstVisibleIndex(0), _numVisibleGlyphs(TOTAL_GLYPHS),
@@ -178,4 +188,8 @@ CPetGlyph *CPetGlyphs::getGlyph(int index) {
return nullptr;
}
+CPetControl *CPetGlyphs::getPetControl() const {
+ return _owner ? _owner->getPetControl() : nullptr;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h
index c9962bdb2a..2360bfa13d 100644
--- a/engines/titanic/pet_control/pet_glyphs.h
+++ b/engines/titanic/pet_control/pet_glyphs.h
@@ -69,6 +69,16 @@ public:
void translateBack(const Point &pt) { _element.translate(-pt.x, -pt.y); }
/**
+ * Get the PET control
+ */
+ CPetControl *getPetControl() const;
+
+ /**
+ * Sets new name and default bounds for glyph
+ */
+ void setName(const CString &name, CPetControl *petControl);
+
+ /**
* Setup the glyph
*/
virtual void setup(CPetControl *petControl, CPetGlyphs *owner);
@@ -215,6 +225,11 @@ public:
* Get the owning section for the glyphs
*/
CPetSection *getOwner() const { return _owner; }
+
+ /**
+ * Get the PET control
+ */
+ CPetControl *getPetControl() const;
};
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp
index da757f5ba4..a68452dfd6 100644
--- a/engines/titanic/pet_control/pet_quit.cpp
+++ b/engines/titanic/pet_control/pet_quit.cpp
@@ -21,8 +21,34 @@
*/
#include "titanic/pet_control/pet_quit.h"
+#include "titanic/pet_control/pet_real_life.h"
+#include "titanic/support/rect.h"
namespace Titanic {
+void CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) {
+ CPetGlyph::setup(petControl, owner);
+ Rect tempRect(0, 0, 280, 16);
+ tempRect.moveTo(32, 407);
+ _sub12.setBounds(tempRect);
+ _sub12.resize(3);
+ _sub12.setHasBorder(true);
+ _sub12.setup();
+
+ Rect elementRect(0, 0, 496, 388);
+ elementRect.moveTo(496, 388);
+ _element.setBounds(elementRect);
+}
+
+bool CPetQuit::reset() {
+ CPetControl *pet = getPetControl();
+ if (!pet)
+ return false;
+
+ setName("PetExit", pet);
+ // TODO
+
+ return true;
+}
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_quit.h b/engines/titanic/pet_control/pet_quit.h
index 28b4b87c43..6c54abb626 100644
--- a/engines/titanic/pet_control/pet_quit.h
+++ b/engines/titanic/pet_control/pet_quit.h
@@ -34,6 +34,15 @@ private:
CPetControlSub12 _sub12;
CPetGfxElement _element;
public:
+ /**
+ * Setup the glyph
+ */
+ virtual void setup(CPetControl *petControl, CPetGlyphs *owner);
+
+ /**
+ * Reset the glyph
+ */
+ virtual bool reset();
};
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h
index 728fb49467..122781341f 100644
--- a/engines/titanic/pet_control/pet_section.h
+++ b/engines/titanic/pet_control/pet_section.h
@@ -154,6 +154,11 @@ public:
virtual void proc36() {}
virtual void proc37() {}
virtual void proc38(int val) {}
+
+ /**
+ * Get the PET control
+ */
+ CPetControl *getPetControl() const { return _petControl; }
};
} // End of namespace Titanic