diff options
author | Paul Gilbert | 2016-03-05 12:14:52 -0500 |
---|---|---|
committer | Paul Gilbert | 2016-03-05 12:14:52 -0500 |
commit | 03d3d5b539500a77c894ef4479bbe14e1b392fa3 (patch) | |
tree | 8f0427662be29ea1c6fc0dc8945a111f348ec07f /engines/titanic | |
parent | 7e966dbc5e9285da69a55312a81ff280845752ea (diff) | |
download | scummvm-rg350-03d3d5b539500a77c894ef4479bbe14e1b392fa3.tar.gz scummvm-rg350-03d3d5b539500a77c894ef4479bbe14e1b392fa3.tar.bz2 scummvm-rg350-03d3d5b539500a77c894ef4479bbe14e1b392fa3.zip |
TITANIC: Implemented remaining CPetControl classes loading
Diffstat (limited to 'engines/titanic')
28 files changed, 153 insertions, 185 deletions
diff --git a/engines/titanic/game/pet/pet_val.cpp b/engines/titanic/game/pet/pet_val.cpp deleted file mode 100644 index b978a8b724..0000000000 --- a/engines/titanic/game/pet/pet_val.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "titanic/game/pet/pet_val.h" - -namespace Titanic { - - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_val.h b/engines/titanic/game/pet/pet_val.h deleted file mode 100644 index f5cae8222d..0000000000 --- a/engines/titanic/game/pet/pet_val.h +++ /dev/null @@ -1,41 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef TITANIC_PET_VAL_H -#define TITANIC_PET_VAL_H - -#include "titanic/game/pet/pet_val_base.h" - -namespace Titanic { - -class CPetVal: public CPetValBase { -private: - int _field18; - int _field1C; - int _field20; -public: - CPetVal() : CPetValBase(), _field18(0), _field1C(0), _field20(0) {} -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_VAL_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index f11512eced..e597860b51 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -238,8 +238,6 @@ MODULE_OBJS := \ game/pet/pet_sounds.o \ game/pet/pet_transition.o \ game/pet/pet_transport.o \ - game/pet/pet_val_base.o \ - game/pet/pet_val.o \ game/pickup/pick_up.o \ game/pickup/pick_up_bar_glass.o \ game/pickup/pick_up_hose.o \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 354ed393a8..e123e99dc5 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -36,14 +36,14 @@ void CPetControl::save(SimpleFile *file, int indent) const { void CPetControl::load(SimpleFile *file) { int val = file->readNumber(); - // TODO: sub_43A9E0 + bool valid = isValid(); - if (!val) { + if (!valid) { _fieldBC = file->readNumber(); _string1 = file->readString(); _string2 = file->readString(); - loadSubObjects(file); + loadSubObjects(file, 0); } CGameObject::load(file); @@ -53,15 +53,22 @@ void CPetControl::gameLoaded() { // TODO } -void CPetControl::loadSubObjects(SimpleFile *file) { - _sub1.load(file); - _sub2.load(file); - _sub3.load(file); - _sub4.load(file); - _sub5.load(file); - _sub6.load(file); - _sub7.load(file); - _sub8.load(file); +bool CPetControl::isValid() const { + return _sub1.isValid() && _sub2.isValid() + && _sub3.isValid() && _sub4.isValid() + && _sub5.isValid() && _sub6.isValid() + && _sub7.isValid() && _sub8.isValid(); +} + +void CPetControl::loadSubObjects(SimpleFile *file, int param) { + _sub1.load(file, param); + _sub2.load(file, param); + _sub3.load(file, param); + _sub4.load(file, param); + _sub5.load(file, param); + _sub6.load(file, param); + _sub7.load(file, param); + _sub8.load(file, param); } void CPetControl::saveSubObjects(SimpleFile *file, int indent) const { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index dab44266c4..087ecd1d8f 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -55,7 +55,12 @@ private: CString _string2; int _field13A4; private: - void loadSubObjects(SimpleFile *file); + /** + * Returns true if the control is in a valid state + */ + bool isValid() const; + + void loadSubObjects(SimpleFile *file, int param); void saveSubObjects(SimpleFile *file, int indent) const; public: diff --git a/engines/titanic/pet_control/pet_control_list_item2.cpp b/engines/titanic/pet_control/pet_control_list_item2.cpp index 05847a9fe5..82b59929d2 100644 --- a/engines/titanic/pet_control/pet_control_list_item2.cpp +++ b/engines/titanic/pet_control/pet_control_list_item2.cpp @@ -23,12 +23,15 @@ #include "titanic/pet_control/pet_control_list_item2.h" namespace Titanic { -/* -CPetControlListItem2::CPetControlListItem2(), + +CPetControlListItem2::CPetControlListItem2() : _field34(0), _field38(0), _field3C(0), _field40(0), _field44(0), _field48(0), _field4C(0), _field50(0), _field54(0), _field58(0), _field5C(0) { } -*/ + +void CPetControlListItem2::setField34(int val) { + _field34 = val; +} } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_list_item2.h b/engines/titanic/pet_control/pet_control_list_item2.h index 26f32d5371..a7f28fa12d 100644 --- a/engines/titanic/pet_control/pet_control_list_item2.h +++ b/engines/titanic/pet_control/pet_control_list_item2.h @@ -41,7 +41,9 @@ protected: int _field58; int _field5C; public: - //CPetControlListItem2(); + CPetControlListItem2(); + + void setField34(int val); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub1.cpp b/engines/titanic/pet_control/pet_control_sub1.cpp index 7ca6d6ffbc..0daae0637d 100644 --- a/engines/titanic/pet_control/pet_control_sub1.cpp +++ b/engines/titanic/pet_control/pet_control_sub1.cpp @@ -31,8 +31,12 @@ void CPetControlSub1::save(SimpleFile *file, int indent) const { } -void CPetControlSub1::load(SimpleFile *file) { +void CPetControlSub1::load(SimpleFile *file, int param) { + _sub2.load(file, param); + _sub1.load(file, param); + for (int idx = 0; idx < 3; ++idx) + _valArray3[idx] = file->readNumber(); } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub1.h b/engines/titanic/pet_control/pet_control_sub1.h index fbe1bbb510..e826182afc 100644 --- a/engines/titanic/pet_control/pet_control_sub1.h +++ b/engines/titanic/pet_control/pet_control_sub1.h @@ -61,7 +61,7 @@ public: /** * Load the data for the class from file */ - virtual void load(SimpleFile *file); + virtual void load(SimpleFile *file, int param); }; } // 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 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 diff --git a/engines/titanic/pet_control/pet_control_sub12.h b/engines/titanic/pet_control/pet_control_sub12.h index b90c451d5e..5c0f0b397c 100644 --- a/engines/titanic/pet_control/pet_control_sub12.h +++ b/engines/titanic/pet_control/pet_control_sub12.h @@ -28,17 +28,19 @@ namespace Titanic { class CPetControlSub12 { -protected: - int _field0; - int _field4; - int _field8; + struct ArrayEntry { + CString _string1; + CString _string2; + CString _string3; + }; +private: + Common::Array<ArrayEntry> _array; CString _string1; int _field18; int _field1C; int _field20; int _field24; int _field28; - int _field2C; int _field30; int _field34; int _field38; @@ -59,9 +61,14 @@ protected: int _field74; int _field78; int _field7C; +private: + void setupArrays(int count); + + void freeArrays(); public: - CPetControlSub12(); + CPetControlSub12(int count = 10); + void load(SimpleFile *file, int param); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub2.cpp b/engines/titanic/pet_control/pet_control_sub2.cpp index 84896bb939..2e8b35e2f0 100644 --- a/engines/titanic/pet_control/pet_control_sub2.cpp +++ b/engines/titanic/pet_control/pet_control_sub2.cpp @@ -35,8 +35,25 @@ void CPetControlSub2::save(SimpleFile *file, int indent) const { } -void CPetControlSub2::load(SimpleFile *file) { - +void CPetControlSub2::load(SimpleFile *file, int param) { + if (!param) { + int count = file->readNumber(); + + for (int idx = 0; idx < count; ++idx) { + int v1 = file->readNumber(); + int v2 = file->readNumber(); + warning("TODO: CPetControlSub2::load - %d,%d", v1, v2); + } + + _listItem.setField34(file->readNumber()); + file->readNumber(); + _field1C0 = file->readNumber(); + _field1C4 = file->readNumber(); + _field1C8 = file->readNumber(); + _field1CC = file->readNumber(); + _field1D0 = file->readNumber(); + _field1D4 = file->readNumber(); + } } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub2.h b/engines/titanic/pet_control/pet_control_sub2.h index 46ad1acacc..d32b30aea0 100644 --- a/engines/titanic/pet_control/pet_control_sub2.h +++ b/engines/titanic/pet_control/pet_control_sub2.h @@ -61,7 +61,7 @@ public: /** * Load the data for the class from file */ - virtual void load(SimpleFile *file); + virtual void load(SimpleFile *file, int param); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub3.cpp b/engines/titanic/pet_control/pet_control_sub3.cpp index 2f508be3e6..d134b1bbc3 100644 --- a/engines/titanic/pet_control/pet_control_sub3.cpp +++ b/engines/titanic/pet_control/pet_control_sub3.cpp @@ -24,12 +24,4 @@ namespace Titanic { -void CPetControlSub3::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub3::load(SimpleFile *file) { - -} - } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub3.h b/engines/titanic/pet_control/pet_control_sub3.h index b5eebb1fb6..aa53db5e00 100644 --- a/engines/titanic/pet_control/pet_control_sub3.h +++ b/engines/titanic/pet_control/pet_control_sub3.h @@ -46,15 +46,8 @@ private: CPetVal _val11; CPetControlSub12 _sub12; public: - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); + + }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub4.cpp b/engines/titanic/pet_control/pet_control_sub4.cpp index 49e5cb23fd..041bf50fa6 100644 --- a/engines/titanic/pet_control/pet_control_sub4.cpp +++ b/engines/titanic/pet_control/pet_control_sub4.cpp @@ -35,8 +35,8 @@ void CPetControlSub4::save(SimpleFile *file, int indent) const { } -void CPetControlSub4::load(SimpleFile *file) { - +void CPetControlSub4::load(SimpleFile *file, int param) { + _field298 = file->readNumber(); } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub4.h b/engines/titanic/pet_control/pet_control_sub4.h index b5de13b468..18dbd7c1ae 100644 --- a/engines/titanic/pet_control/pet_control_sub4.h +++ b/engines/titanic/pet_control/pet_control_sub4.h @@ -51,7 +51,7 @@ public: /** * Load the data for the class from file */ - virtual void load(SimpleFile *file); + virtual void load(SimpleFile *file, int param); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub5.cpp b/engines/titanic/pet_control/pet_control_sub5.cpp index 461fb1ebc1..6a9b92e7b2 100644 --- a/engines/titanic/pet_control/pet_control_sub5.cpp +++ b/engines/titanic/pet_control/pet_control_sub5.cpp @@ -24,12 +24,20 @@ namespace Titanic { +CPetControlSub5::CPetControlSub5() : + _field98(0), _field9C(0), _fieldA0(0), + _field18C(0), _field20C(0), _field210(0) { +} + void CPetControlSub5::save(SimpleFile *file, int indent) const { } -void CPetControlSub5::load(SimpleFile *file) { - +void CPetControlSub5::load(SimpleFile *file, int param) { + if (!param) { + _field20C = file->readNumber(); + _field210 = file->readNumber(); + } } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub5.h b/engines/titanic/pet_control/pet_control_sub5.h index 41b37fd7b2..5ef1b26312 100644 --- a/engines/titanic/pet_control/pet_control_sub5.h +++ b/engines/titanic/pet_control/pet_control_sub5.h @@ -24,6 +24,7 @@ #define TITANIC_PET_CONTROL_SUB5_H #include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_control_sub12.h" #include "titanic/pet_control/pet_val.h" namespace Titanic { @@ -34,13 +35,18 @@ private: CPetVal _val2; CPetVal _val3; CPetVal _val4; - CPetControlSubData _field17C; int _field98; int _field9C; int _fieldA0; CPetVal _valArray1[6]; - + CPetControlSubData _field17C; + int _field18C; + CPetControlSub12 _sub12; + int _field20C; + int _field210; public: + CPetControlSub5(); + /** * Save the data for the class to file */ @@ -49,7 +55,7 @@ public: /** * Load the data for the class from file */ - virtual void load(SimpleFile *file); + virtual void load(SimpleFile *file, int param); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub6.cpp b/engines/titanic/pet_control/pet_control_sub6.cpp index d33ea1f824..d017e81d9e 100644 --- a/engines/titanic/pet_control/pet_control_sub6.cpp +++ b/engines/titanic/pet_control/pet_control_sub6.cpp @@ -24,12 +24,4 @@ namespace Titanic { -void CPetControlSub6::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub6::load(SimpleFile *file) { - -} - } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub6.h b/engines/titanic/pet_control/pet_control_sub6.h index 93f83c2d6b..420da0c7ae 100644 --- a/engines/titanic/pet_control/pet_control_sub6.h +++ b/engines/titanic/pet_control/pet_control_sub6.h @@ -34,15 +34,7 @@ private: CPetControlSub10 _sub10; CPetControlSub10 _sub12; public: - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub7.cpp b/engines/titanic/pet_control/pet_control_sub7.cpp index 8333dc1508..f57454da67 100644 --- a/engines/titanic/pet_control/pet_control_sub7.cpp +++ b/engines/titanic/pet_control/pet_control_sub7.cpp @@ -24,12 +24,4 @@ namespace Titanic { -void CPetControlSub7::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub7::load(SimpleFile *file) { - -} - } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub7.h b/engines/titanic/pet_control/pet_control_sub7.h index d74ac3c405..f4a1decf12 100644 --- a/engines/titanic/pet_control/pet_control_sub7.h +++ b/engines/titanic/pet_control/pet_control_sub7.h @@ -33,15 +33,7 @@ private: CPetControlSub12 _sub1; CPetControlSub12 _sub2; public: - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub8.cpp b/engines/titanic/pet_control/pet_control_sub8.cpp index c2b0f7f67f..18c68c7ddb 100644 --- a/engines/titanic/pet_control/pet_control_sub8.cpp +++ b/engines/titanic/pet_control/pet_control_sub8.cpp @@ -33,12 +33,4 @@ CPetControlSub8::CPetControlSub8() { _indexes[INDEXES[idx]] = idx; } -void CPetControlSub8::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub8::load(SimpleFile *file) { - -} - } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub8.h b/engines/titanic/pet_control/pet_control_sub8.h index 391d4cf1fa..115e6d508f 100644 --- a/engines/titanic/pet_control/pet_control_sub8.h +++ b/engines/titanic/pet_control/pet_control_sub8.h @@ -42,15 +42,6 @@ private: public: CPetControlSub8(); - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub_base.h b/engines/titanic/pet_control/pet_control_sub_base.h index ead9a6e6dd..b59c85b30a 100644 --- a/engines/titanic/pet_control/pet_control_sub_base.h +++ b/engines/titanic/pet_control/pet_control_sub_base.h @@ -69,14 +69,14 @@ public: /** * Load the data for the class from file */ - virtual void load(SimpleFile *file) = 0; + virtual void load(SimpleFile *file, int param) {} virtual void proc19() {} /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const = 0; + virtual void save(SimpleFile *file, int indent) const {} virtual void proc21() {} virtual void proc22() {} diff --git a/engines/titanic/pet_control/pet_val_base.cpp b/engines/titanic/pet_control/pet_val_base.cpp index fed1b0d709..c1d2fa7d4f 100644 --- a/engines/titanic/pet_control/pet_val_base.cpp +++ b/engines/titanic/pet_control/pet_val_base.cpp @@ -25,6 +25,9 @@ namespace Titanic { +CPetValBase::CPetValBase() : _field4(0), _field8(0), _fieldC(0), + _field10(0), _field14(0) {} + void CPetValBase::proc5(CLinkItemSub *linkItem) { if (linkItem) linkItem->clear(); diff --git a/engines/titanic/pet_control/pet_val_base.h b/engines/titanic/pet_control/pet_val_base.h index 1d5399b70b..f5f6e58387 100644 --- a/engines/titanic/pet_control/pet_val_base.h +++ b/engines/titanic/pet_control/pet_val_base.h @@ -36,8 +36,7 @@ protected: int _field10; int _field14; public: - CPetValBase() : _field4(0), _field8(0), _fieldC(0), - _field10(0), _field14(0) {} + CPetValBase(); virtual ~CPetValBase() {} virtual void proc1() {} |