aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/pet_control')
-rw-r--r--engines/titanic/pet_control/pet_control_sub12.cpp57
-rw-r--r--engines/titanic/pet_control/pet_control_sub12.h24
-rw-r--r--engines/titanic/pet_control/pet_inventory.cpp2
3 files changed, 62 insertions, 21 deletions
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;
}