diff options
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/font.cpp | 5 | ||||
-rw-r--r-- | engines/titanic/font.h | 10 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control_sub12.cpp | 57 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control_sub12.h | 24 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_inventory.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/screen_manager.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/screen_manager.h | 15 |
7 files changed, 95 insertions, 24 deletions
diff --git a/engines/titanic/font.cpp b/engines/titanic/font.cpp index bb8f2e05e9..962d6659e0 100644 --- a/engines/titanic/font.cpp +++ b/engines/titanic/font.cpp @@ -20,6 +20,7 @@ * */ +#include "common/textconsole.h" #include "titanic/font.h" namespace Titanic { @@ -31,4 +32,8 @@ void STFont::load(int fontNumber) { // TODO } +void STFont::writeString(int maxWidth, const CString &text, int *v1, int *v2) { + warning("TODO: STFont::writeString"); +} + } // End of namespace Titanic diff --git a/engines/titanic/font.h b/engines/titanic/font.h index 2948505c92..db0698766c 100644 --- a/engines/titanic/font.h +++ b/engines/titanic/font.h @@ -24,6 +24,7 @@ #define TITANIC_FONT_H #include "common/scummsys.h" +#include "titanic/string.h" namespace Titanic { @@ -32,7 +33,16 @@ public: public: STFont(); + /** + * Load a specified font + */ void load(int fontNumber); + + /** + * Write out a string + * TODO: Verify this + */ + void writeString(int maxWidth, const CString &text, int *v1, int *v2); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub12.cpp b/engines/titanic/pet_control/pet_control_sub12.cpp index 79a53ecb8d..59097e33a7 100644 --- a/engines/titanic/pet_control/pet_control_sub12.cpp +++ b/engines/titanic/pet_control/pet_control_sub12.cpp @@ -25,11 +25,11 @@ namespace Titanic { CPetControlSub12::CPetControlSub12(int count) : - _field18(0), _field30(-1), _field34(0), _field38(-1), - _field3C(0), _field40(0), _field44(0), _field48(0xff), - _field4C(0xff), _field50(0xff), _field54(0), _field58(0), + _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), _field70(1), _field74(0), _field78(0), + _field6C(0), _hasBorder(true), _field74(0), _field78(0), _field7C(0) { setupArrays(count); } @@ -52,8 +52,8 @@ void CPetControlSub12::setup() { _array[idx]._string3.clear(); } - _field34 = 0; - _field18 = 0; + _lineCount = 0; + _stringsMerged = false; } void CPetControlSub12::setArrayStr2(uint idx, int val1, int val2, int val3) { @@ -86,13 +86,13 @@ void CPetControlSub12::load(SimpleFile *file, int param) { _field3C = file->readNumber(); _field40 = file->readNumber(); _field44 = file->readNumber(); - _field48 = file->readNumber(); - _field4C = file->readNumber(); - _field50 = file->readNumber(); + _backR = file->readNumber(); + _backG = file->readNumber(); + _backB = file->readNumber(); _field54 = file->readNumber(); _field58 = file->readNumber(); _field5C = file->readNumber(); - _field70 = file->readNumber(); + _hasBorder = file->readNumber() != 0; _field74 = file->readNumber(); warning("TODO: CPetControlSub12::load %d,%d", var1, var2); @@ -108,11 +108,44 @@ void CPetControlSub12::load(SimpleFile *file, int param) { void CPetControlSub12::draw(CScreenManager *screenManager) { Rect tempRect = _bounds; - if (_field70) { - + if (_hasBorder) { + // Create border effect + // Top edge + tempRect.bottom = tempRect.top + 1; + screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); + + // Bottom edge + tempRect.top = _bounds.bottom - 1; + tempRect.bottom = _bounds.bottom; + screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); + + // Left edge + tempRect = _bounds; + tempRect.right = tempRect.left + 1; + screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); + + // Right edge + tempRect = _bounds; + tempRect.left = tempRect.right - 1; + screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); } warning("TODO: CPetControlSub12::draw"); } +void CPetControlSub12::mergeStrings() { + if (!_stringsMerged) { + _lines.clear(); + + for (int idx = 0; idx < _lineCount; ++idx) { + CString line = _array[idx]._string2 + _array[idx]._string3 + + _array[idx]._string1 + "\n"; + _lines += line; + + } + + _stringsMerged = true; + } +} + } // 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 a189bc2159..88faf3d074 100644 --- a/engines/titanic/pet_control/pet_control_sub12.h +++ b/engines/titanic/pet_control/pet_control_sub12.h @@ -36,18 +36,18 @@ class CPetControlSub12 { }; private: Common::Array<ArrayEntry> _array; - CString _string1; - int _field18; + CString _lines; + bool _stringsMerged; Rect _bounds; int _field30; - int _field34; + int _lineCount; int _field38; int _field3C; int _field40; int _field44; - int _field48; - int _field4C; - int _field50; + int _backR; + int _backG; + int _backB; int _field54; int _field58; int _field5C; @@ -55,7 +55,7 @@ private: int _field64; int _field68; int _field6C; - int _field70; + bool _hasBorder; int _field74; int _field78; int _field7C; @@ -65,6 +65,11 @@ private: void freeArrays(); void setArrayStr2(uint idx, int val1, int val2, int val3); + + /** + * Merges the strings in the strings array + */ + void mergeStrings(); public: CPetControlSub12(int count = 10); @@ -83,7 +88,10 @@ public: */ void setBounds(const Rect &bounds) { _bounds = bounds; } - void set70(int val) { _field70 = val; } + /** + * Sets the flag for whether to draw a frame border around the control + */ + void setHasBorder(bool val) { _hasBorder = val; } /** * Draw the control diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 6e0bb22dc5..66d093f513 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -92,7 +92,7 @@ bool CPetInventory::setPetControl(CPetControl *petControl) { tempRect = Rect(0, 0, 580, 15); tempRect.translate(32, 445); _sub12.setBounds(tempRect); - _sub12.set70(0); + _sub12.setHasBorder(false); return true; } diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index f74c97bafb..99de75a6f4 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -198,7 +198,11 @@ void OSScreenManager::proc12() {} void OSScreenManager::proc13() {} void OSScreenManager::proc14() {} void OSScreenManager::proc15() {} -void OSScreenManager::proc16() {} + +void OSScreenManager::writeString(int maxWidth, const CString &text, int *v1, int *v2) { + _fonts[_fontNumber].writeString(maxWidth, text, v1, v2); +} + void OSScreenManager::getFont() {} void OSScreenManager::proc18() {} void OSScreenManager::proc19() {} diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index 8ca17525a1..e39151b85b 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -109,7 +109,13 @@ public: virtual void proc13() = 0; virtual void proc14() = 0; virtual void proc15() = 0; - virtual void proc16() = 0; + + + /** + * Write out a string + */ + virtual void writeString(int maxWidth, const CString &text, int *v1, int *v2) = 0; + virtual void getFont() = 0; virtual void proc18() = 0; virtual void proc19() = 0; @@ -200,7 +206,12 @@ public: virtual void proc13(); virtual void proc14(); virtual void proc15(); - virtual void proc16(); + + /** + * Write out a string + */ + virtual void writeString(int maxWidth, const CString &text, int *v1, int *v2); + virtual void getFont(); virtual void proc18(); virtual void proc19(); |