diff options
Diffstat (limited to 'engines/titanic/pet_control/pet_control_sub12.cpp')
-rw-r--r-- | engines/titanic/pet_control/pet_control_sub12.cpp | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/engines/titanic/pet_control/pet_control_sub12.cpp b/engines/titanic/pet_control/pet_control_sub12.cpp index 1e8d62834e..616d6920ae 100644 --- a/engines/titanic/pet_control/pet_control_sub12.cpp +++ b/engines/titanic/pet_control/pet_control_sub12.cpp @@ -24,15 +24,57 @@ namespace Titanic { -CPetControlSub12::CPetControlSub12() : - _field0(0), _field4(0), _field8(0), _field18(0), - _field1C(0), _field20(0), _field24(0), _field28(0), - _field2C(0), _field30(0), _field34(0), _field38(0), - _field3C(0), _field40(0), _field44(0), _field48(0), - _field4C(0), _field50(0), _field54(0), _field58(0), - _field5C(0), _field60(0), _field64(0), _field68(0), - _field6C(0), _field70(0), _field74(0), _field78(0), +CPetControlSub12::CPetControlSub12(int count) : + _field18(0), _field1C(0), _field20(0), _field24(0), + _field28(0), _field30(-1), _field34(0), _field38(-1), + _field3C(0), _field40(0), _field44(0), _field48(0xff), + _field4C(0xff), _field50(0xff), _field54(0), _field58(0), + _field5C(200), _field60(0), _field64(0), _field68(0), + _field6C(0), _field70(1), _field74(0), _field78(0), _field7C(0) { + setupArrays(count); } +void CPetControlSub12::setupArrays(int count) { + freeArrays(); + if (count < 10 || count > 60) + count = 10; + _array.resize(count); +} + +void CPetControlSub12::freeArrays() { + _array.clear(); +} + +void CPetControlSub12::load(SimpleFile *file, int param) { + if (!param) { + int var1 = file->readNumber(); + int var2 = file->readNumber(); + uint count = file->readNumber(); + _field1C = file->readNumber(); + _field20 = file->readNumber(); + _field24 = file->readNumber(); + _field28 = file->readNumber(); + _field3C = file->readNumber(); + _field40 = file->readNumber(); + _field44 = file->readNumber(); + _field48 = file->readNumber(); + _field4C = file->readNumber(); + _field50 = file->readNumber(); + _field54 = file->readNumber(); + _field58 = file->readNumber(); + _field5C = file->readNumber(); + _field70 = file->readNumber(); + _field74 = file->readNumber(); + + assert(_array.size() >= count); + for (uint idx = 0; idx < count; ++idx) { + _array[idx]._string1 = file->readString(); + _array[idx]._string2 = file->readString(); + _array[idx]._string3 = file->readString(); + } + } +} + + } // End of namespace Titanic |