diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/support/simple_file.cpp | 15 | ||||
-rw-r--r-- | engines/titanic/support/simple_file.h | 10 |
3 files changed, 26 insertions, 1 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 26b78247ba..510e455656 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -96,7 +96,7 @@ void CGameObject::load(SimpleFile *file) { // Deliberate fall-through case 1: - _bounds = file->readRect(); + _bounds = file->readBounds(); _field34 = file->readFloat(); _field38 = file->readFloat(); _field3C = file->readFloat(); diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp index fccf6c5b4f..88d74a9f47 100644 --- a/engines/titanic/support/simple_file.cpp +++ b/engines/titanic/support/simple_file.cpp @@ -213,6 +213,16 @@ Rect SimpleFile::readRect() { return r; } +Rect SimpleFile::readBounds() { + Rect r; + r.left = readNumber(); + r.top = readNumber(); + r.setWidth(readNumber()); + r.setHeight(readNumber()); + + return r; +} + void SimpleFile::readBuffer(char *buffer, size_t count) { CString tempString = readString(); if (buffer) { @@ -309,6 +319,11 @@ void SimpleFile::writeRect(const Rect &r, int indent) { writePoint(Point(r.right, r.bottom), indent); } +void SimpleFile::writeBounds(const Rect &r, int indent) { + writePoint(Point(r.left, r.top), indent); + writePoint(Point(r.width(), r.height()), indent); +} + void SimpleFile::writeIndent(uint indent) { for (uint idx = 0; idx < indent; ++idx) write("\t", 1); diff --git a/engines/titanic/support/simple_file.h b/engines/titanic/support/simple_file.h index 0ba7699088..115e3805da 100644 --- a/engines/titanic/support/simple_file.h +++ b/engines/titanic/support/simple_file.h @@ -112,6 +112,11 @@ public: Rect readRect(); /** + * Rect in a bounds + */ + Rect readBounds(); + + /** * Read a string and copy it into an optionally passed buffer */ void readBuffer(char *buffer = nullptr, size_t count = 0); @@ -167,6 +172,11 @@ public: void writeRect(const Rect &r, int indent); /** + * Write out a bounds line + */ + void writeBounds(const Rect &r, int indent); + + /** * Write out a number of tabs to form an indent in the output */ void writeIndent(uint indent); |