diff options
author | Paul Gilbert | 2016-04-19 22:00:47 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:11:37 -0400 |
commit | a8f8e4b69eab768f38d5cd73ceecce03bd096a4d (patch) | |
tree | 16411b2115087fbcf5be361b66e1996a32b2b337 /engines/titanic/pet_control | |
parent | a6e76530b248c6ad61aac0fc4496e126ca6cd77b (diff) | |
download | scummvm-rg350-a8f8e4b69eab768f38d5cd73ceecce03bd096a4d.tar.gz scummvm-rg350-a8f8e4b69eab768f38d5cd73ceecce03bd096a4d.tar.bz2 scummvm-rg350-a8f8e4b69eab768f38d5cd73ceecce03bd096a4d.zip |
TITANIC: Clarified UI color methods & tables
Diffstat (limited to 'engines/titanic/pet_control')
-rw-r--r-- | engines/titanic/pet_control/pet_glyphs.cpp | 3 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_glyphs.h | 2 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_quit.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_quit.h | 2 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_real_life.cpp | 10 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_section.cpp | 24 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_section.h | 12 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_text.cpp | 28 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_text.h | 16 |
9 files changed, 68 insertions, 35 deletions
diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 9e588bfed9..4669a1f1ec 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -25,9 +25,10 @@ namespace Titanic { -void CPetGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { +bool CPetGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { _element.setBounds(Rect(0, 0, 52, 50)); _owner = owner; + return true; } void CPetGlyph::drawAt(CScreenManager *screenManager, const Point &pt) { diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 48351c9e44..adc7ceb5e8 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -82,7 +82,7 @@ public: /** * Setup the glyph */ - virtual void setup(CPetControl *petControl, CPetGlyphs *owner); + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); /** * Reset the glyph diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index 562a63f80c..c3d6e4e40d 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -28,7 +28,7 @@ namespace Titanic { -void CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) { +bool CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) { CPetGlyph::setup(petControl, owner); Rect tempRect(0, 0, 280, 16); tempRect.moveTo(32, 407); @@ -40,6 +40,8 @@ void CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) { Rect elementRect(0, 0, 496, 388); elementRect.moveTo(496, 388); _element.setBounds(elementRect); + + return true; } bool CPetQuit::reset() { @@ -49,7 +51,7 @@ bool CPetQuit::reset() { setName("PetExit", pet); - uint col = getPetSection()->getDataIndex(0); + uint col = getPetSection()->getColor(0); _text.setText("Are you sure you want to quit?"); _text.setColor(0, col); diff --git a/engines/titanic/pet_control/pet_quit.h b/engines/titanic/pet_control/pet_quit.h index ca207f616a..213ed450d4 100644 --- a/engines/titanic/pet_control/pet_quit.h +++ b/engines/titanic/pet_control/pet_quit.h @@ -37,7 +37,7 @@ public: /** * Setup the glyph */ - virtual void setup(CPetControl *petControl, CPetGlyphs *owner); + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); /** * Reset the glyph diff --git a/engines/titanic/pet_control/pet_real_life.cpp b/engines/titanic/pet_control/pet_real_life.cpp index 8d439e9cc1..38b7125ed3 100644 --- a/engines/titanic/pet_control/pet_real_life.cpp +++ b/engines/titanic/pet_control/pet_real_life.cpp @@ -36,6 +36,11 @@ bool CPetRealLife::setup(CPetControl *petControl) { } bool CPetRealLife::reset() { + _glyphs.reset(); + uint col = getColor(0); + _text.setColor(col); + _text.setColor(0, col); + return true; } @@ -67,7 +72,10 @@ bool CPetRealLife::setupControl(CPetControl *petControl) { } void CPetRealLife::addButton(CPetGlyph *glyph) { - + if (glyph) { + if (glyph->setup(_petControl, &_glyphs)) + _glyphs.push_back(glyph); + } } bool CPetRealLife::isValid(CPetControl *petControl) { diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index 3d26fc444a..a41118bf76 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -26,15 +26,15 @@ namespace Titanic { -static const uint ARRAY1[6] = { +static const uint PALETTE1[6] = { 0xA7C0DB, 0x9CFFFE, 0x73AEFF, 0xA7C0DB, 0x9CFFFE, 0 }; -static const uint ARRAY2[6] = { +static const uint PALETTE2[6] = { 0x10101, 0x1013C, 0xC80101, 0x10101, 0x800101, 0 }; -static const uint ARRAY3[5] = { +static const uint PALETTE3[5] = { 0x10101, 0x1013C, 0xC80101, 0x10101, 0x800101 }; @@ -62,20 +62,20 @@ void CPetSection::proc30() { error("TODO"); } -uint CPetSection::getDataIndex(int index) { - return getDataTable()[index]; +uint CPetSection::getColor(uint index) { + return getColorTable()[index]; } -const uint *CPetSection::getDataTable(int index) { - if (index == -1) { +const uint *CPetSection::getColorTable(int tableNum) { + if (tableNum == -1) { CPetControl *pet = getPetControl(); - index = pet ? pet->getState8() : 3; + tableNum = pet ? pet->getState8() : 3; } - switch (index) { - case 1: return ARRAY1; - case 2: return ARRAY2; - default: return ARRAY3; + switch (tableNum) { + case 1: return PALETTE1; + case 2: return PALETTE2; + default: return PALETTE3; } } diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 40a3151304..6cc1c10333 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -160,8 +160,16 @@ public: */ CPetControl *getPetControl() const { return _petControl; } - uint getDataIndex(int index); - const uint *getDataTable(int index = -1); + /** + * Get a specified color in the currently active UI color table + */ + uint getColor(uint index); + + /** + * Get one of the game's three UI color tables. If the default + * tableNum of -1 is used, the table is taken from the game state + */ + const uint *getColorTable(int tableNum = -1); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index cda637a4ba..af00473050 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -25,12 +25,12 @@ namespace Titanic { CPetText::CPetText(uint count) : - _stringsMerged(false), _field30(-1), _lineCount(0), _field38(-1), - _field3C(0), _field40(0), _field44(0), _backR(0xff), - _backG(0xff), _backB(0xff), _field54(0), _field58(0), - _field5C(200), _field60(0), _field64(0), _field68(0), - _field6C(0), _hasBorder(true), _field74(0), _field78(0), - _field7C(0) { + _stringsMerged(false), _field30(-1), _lineCount(0), + _field38(-1), _field3C(0), _field40(0), _field44(0), + _backR(0xff), _backG(0xff), _backB(0xff), + _textR(0), _textG(0), _textB(200), + _field60(0), _field64(0), _field68(0), _field6C(0), + _hasBorder(true), _field74(0), _field78(0), _field7C(0) { setupArrays(count); } @@ -48,7 +48,7 @@ void CPetText::freeArrays() { void CPetText::setup() { for (int idx = 0; idx < (int)_array.size(); ++idx) { _array[idx]._string1.clear(); - setArrayStr2(idx, _field54, _field58, _field5C); + setArrayStr2(idx, _textR, _textG, _textB); _array[idx]._string3.clear(); } @@ -89,9 +89,9 @@ void CPetText::load(SimpleFile *file, int param) { _backR = file->readNumber(); _backG = file->readNumber(); _backB = file->readNumber(); - _field54 = file->readNumber(); - _field58 = file->readNumber(); - _field5C = file->readNumber(); + _textR = file->readNumber(); + _textG = file->readNumber(); + _textB = file->readNumber(); _hasBorder = file->readNumber() != 0; _field74 = file->readNumber(); @@ -164,8 +164,14 @@ void CPetText::changeText(const CString &str) { warning("TODO: CPetText::changeText"); } -void CPetText::setColor(int val1, int val2) { +void CPetText::setColor(int val1, uint col) { warning("CPetText::setColor"); } +void CPetText::setColor(uint col) { + _textR = col & 0xff; + _textG = (col >> 8) & 0xff; + _textB = (col >> 16) & 0xff; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index d43345cfe8..55416fdc7d 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -48,9 +48,9 @@ private: int _backR; int _backG; int _backB; - int _field54; - int _field58; - int _field5C; + int _textR; + int _textG; + int _textB; int _field60; int _field64; int _field68; @@ -110,7 +110,15 @@ public: */ void setText(const CString &str); - void setColor(int val1, int val2); + /** + * Set text color + */ + void setColor(int val1, uint col); + + /** + * Set text color + */ + void setColor(uint col); }; } // End of namespace Titanic |