diff options
author | Paul Gilbert | 2016-03-31 20:27:28 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-03-31 20:27:28 -0400 |
commit | 24a2fc7e853d826f184bcd977e69a0d906f327a7 (patch) | |
tree | a04ae7ccb84024d4bf9b36b8fd8738a63cb12014 /engines/titanic | |
parent | d94b1dc7bb68ee1641edcbbd31fd40ef7e5dc442 (diff) | |
download | scummvm-rg350-24a2fc7e853d826f184bcd977e69a0d906f327a7.tar.gz scummvm-rg350-24a2fc7e853d826f184bcd977e69a0d906f327a7.tar.bz2 scummvm-rg350-24a2fc7e853d826f184bcd977e69a0d906f327a7.zip |
TITANIC: Implement CPetFrame setup and drawing code
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/pet_control/pet_control.h | 3 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_frame.cpp | 27 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_gfx_element.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_gfx_element.h | 2 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_section.h | 5 | ||||
-rw-r--r-- | engines/titanic/string.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/string.h | 2 |
7 files changed, 41 insertions, 8 deletions
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 4f101caaf5..4fcfe6e7a4 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -39,7 +39,6 @@ namespace Titanic { class CPetControl : public CGameObject { private: - PetArea _currentArea; int _fieldC0; int _locked; int _fieldC8; @@ -88,6 +87,8 @@ private: */ CRoomItem *getHiddenRoom(); public: + PetArea _currentArea; +public: CLASSDEF CPetControl(); diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index e94bc6c848..48a05cdd11 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -21,6 +21,7 @@ */ #include "titanic/pet_control/pet_frame.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -41,7 +42,23 @@ bool CPetFrame::setup(CPetControl *petControl) { bool CPetFrame::setup() { if (_petControl) { - // TODO + _background.setup("PetBackground", _petControl, MODE_0); + _modeBackground.setup("PetModeBackground", _petControl, MODE_0); + + for (int idx = 0; idx < 5; ++idx) { + CString resName = Common::String::format("PetMode%d", idx); + _modeButtons[idx].setup(resName, _petControl, MODE_0); + } + + for (int idx = 0; idx < 6; ++idx) { + CString resName = Common::String::format("3Pettitle%d", idx); + _titles[idx].setup(resName, _petControl, MODE_0); + } + + for (int idx = 0; idx < 7; ++idx) { + CString resName = Common::String::format("PetIndent%d", idx); + _titles[idx].setup(resName, _petControl, MODE_0); + } } return true; @@ -98,7 +115,13 @@ void CPetFrame::setArea(PetArea newArea) { } void CPetFrame::drawFrame(CScreenManager *screenManager) { - warning("TODO: CPetFrame::drawFrame"); + _background.draw(screenManager); + _modeBackground.draw(screenManager); + + for (int idx = 0; idx < 5; ++idx) + _modeButtons[idx].draw(screenManager); + + _titles[_petControl->_currentArea].draw(screenManager); } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp index 5f2f05e6c3..616db72377 100644 --- a/engines/titanic/pet_control/pet_gfx_element.cpp +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -44,7 +44,7 @@ void CPetGfxElement::setup(PetElementMode mode, const CString &name, } } -void CPetGfxElement::setup(const CString &name, CPetControl *petControl) { +void CPetGfxElement::setup(const CString &name, CPetControl *petControl, PetElementMode mode) { if (!petControl) return; @@ -60,7 +60,7 @@ void CPetGfxElement::setup(const CString &name, CPetControl *petControl) { } CString resName = numString + name; - setup(resName, petControl); + setup(mode, resName, petControl); } void CPetGfxElement::draw(CScreenManager *screenManager) { diff --git a/engines/titanic/pet_control/pet_gfx_element.h b/engines/titanic/pet_control/pet_gfx_element.h index b0bf6e4abe..a4c39c6d24 100644 --- a/engines/titanic/pet_control/pet_gfx_element.h +++ b/engines/titanic/pet_control/pet_gfx_element.h @@ -45,7 +45,7 @@ public: /** * Setup the element */ - virtual void setup(const CString &name, CPetControl *petControl); + virtual void setup(const CString &name, CPetControl *petControl, PetElementMode mode); /** * Draw the item diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 77535662a6..2612d64a19 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -85,7 +85,10 @@ public: /** * Returns true if the object is in a valid state */ - virtual bool isValid(CPetControl *petControl) { return false; } + virtual bool isValid(CPetControl *petControl) { + // TODO: Switch back to false after implementing all sections + return true; + } /** * Load the data for the class from file diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp index f29d2c7938..6b43e7992b 100644 --- a/engines/titanic/string.cpp +++ b/engines/titanic/string.cpp @@ -31,6 +31,12 @@ CString::CString(char c, uint32 len) : Common::String() { (*this) += c; } +CString::CString(int val) : Common::String() { + char buffer[16]; + itoa(val, buffer, 10); + *this += buffer; +} + CString CString::left(uint count) const { return (count > size()) ? CString() : CString(c_str(), c_str() + count); } diff --git a/engines/titanic/string.h b/engines/titanic/string.h index 0c0c64e0be..c41130369b 100644 --- a/engines/titanic/string.h +++ b/engines/titanic/string.h @@ -46,7 +46,7 @@ public: CString(const String &str) : Common::String(str) {} CString(char c, uint32 len); explicit CString(char c) : Common::String(c) {} - explicit CString(int val) : Common::String(Common::String::format("%d", val)) {} + explicit CString(int val); /** * Returns the left n characters of the string |