diff options
author | Paul Gilbert | 2016-06-22 13:48:33 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:24:01 -0400 |
commit | 5aff1d01b4088979e207c434476fa7ca3f6a644f (patch) | |
tree | 4e12d11c23742da06e38241d94e081109b20f6d9 /engines | |
parent | 23da68350dee0b211cdcf29734146ac71583044b (diff) | |
download | scummvm-rg350-5aff1d01b4088979e207c434476fa7ca3f6a644f.tar.gz scummvm-rg350-5aff1d01b4088979e207c434476fa7ca3f6a644f.tar.bz2 scummvm-rg350-5aff1d01b4088979e207c434476fa7ca3f6a644f.zip |
TITANIC: Cleaning up mode and room flags fields on PET room glyphs
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/pet_control/pet_rooms.cpp | 15 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_rooms.h | 4 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_rooms_glyphs.cpp | 20 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_rooms_glyphs.h | 29 |
4 files changed, 52 insertions, 16 deletions
diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index a14258ebbf..29a46880e0 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -114,10 +114,10 @@ void CPetRooms::load(SimpleFile *file, int param) { for (int idx = 0; idx < count; ++idx) { CPetRoomsGlyph *glyph = addGlyph(file->readNumber(), false); - glyph->set3C(file->readNumber()); + glyph->setMode((RoomGlyphMode)file->readNumber()); } - _glyphItem.set34(file->readNumber()); + _glyphItem.setMode((RoomGlyphMode)file->readNumber()); file->readNumber(); _field1C0 = file->readNumber(); _field1C4 = file->readNumber(); @@ -191,15 +191,15 @@ bool CPetRooms::setupControl(CPetControl *petControl) { } void CPetRooms::resetHighlight() { - _glyphItem.set34(fn1()); + _glyphItem.setMode(fn1()); _glyphs.resetHighlight(); _glyphItem.updateTooltip(); areaChanged(PET_ROOMS); } -int CPetRooms::fn1() { +RoomGlyphMode CPetRooms::fn1() { warning("TODO: CPetRooms::fn1"); - return 0; + return RGM_0; } int CPetRooms::fn2(int val) { @@ -230,4 +230,9 @@ void CPetRooms::addRoom(int roomNum) { warning("TODO: CPetRooms::addRoom"); } +uint CPetRooms::mode1Flags() const { + CPetRoomsGlyph *glyph = _glyphs.findMode1(); + return glyph ? glyph->getRoomFlags() : 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index 515c9fb10d..608940fec6 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -65,7 +65,7 @@ private: */ void resetHighlight(); - int fn1(); + RoomGlyphMode fn1(); void areaChanged(PetArea area); @@ -73,6 +73,8 @@ private: * Adds a glyph to the list */ CPetRoomsGlyph *addGlyph(int val, bool highlight); + + uint mode1Flags() const; public: CPetRooms(); diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index 57c6e8568c..71fdc5662d 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -27,13 +27,13 @@ namespace Titanic { CPetRoomsGlyph::CPetRoomsGlyph() : CPetGlyph(), - _field34(0), _field38(0), _field3C(0), + _roomFlags(0), _field38(0), _mode(RGM_0), _field40(nullptr), _field44(nullptr), _field48(nullptr), _field4C(nullptr), _field50(nullptr), _field54(nullptr), _field58(nullptr), _field5C(nullptr) { } -CPetRoomsGlyph::CPetRoomsGlyph(int val) : CPetGlyph(), - _field34(val), _field38(0), _field3C(0), +CPetRoomsGlyph::CPetRoomsGlyph(uint flags) : CPetGlyph(), + _roomFlags(flags), _field38(0), _mode(RGM_0), _field40(nullptr), _field44(nullptr), _field48(nullptr), _field4C(nullptr), _field50(nullptr), _field54(nullptr), _field58(nullptr), _field5C(nullptr) { } @@ -71,8 +71,8 @@ int CPetRoomsGlyph::proc29(const Point &pt) { } void CPetRoomsGlyph::save2(SimpleFile *file, int indent) const { - file->writeNumberLine(_field34, indent); - file->writeNumberLine(_field3C, indent); + file->writeNumberLine(_roomFlags, indent); + file->writeNumberLine(_mode, indent); } int CPetRoomsGlyph::proc33() { @@ -92,4 +92,14 @@ void CPetRoomsGlyphs::save2(SimpleFile *file, int indent) const { (*i)->save2(file, indent); } +CPetRoomsGlyph *CPetRoomsGlyphs::findMode1() const { + for (const_iterator i = begin(); i != end(); ++i) { + CPetRoomsGlyph *glyph = static_cast<CPetRoomsGlyph *>(*i); + if (glyph->isMode1()) + return glyph; + } + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index 3f37bdb55d..c48011f347 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -27,11 +27,13 @@ namespace Titanic { +enum RoomGlyphMode { RGM_0 = 0, RGM_1 = 1, RGM_2 = 2 }; + class CPetRoomsGlyph : public CPetGlyph { protected: - int _field34; + uint _roomFlags; int _field38; - int _field3C; + RoomGlyphMode _mode; CGameObject *_field40; CGameObject *_field44; CGameObject *_field48; @@ -42,13 +44,28 @@ protected: CGameObject *_field5C; public: CPetRoomsGlyph(); - CPetRoomsGlyph(int val); + CPetRoomsGlyph(uint flags); - void set34(int val) { _field34 = val; } + /** + * Set the room flags for the glyph + */ + void setFoomFlags(uint flags) { _roomFlags = flags; } + + /** + * Get the room flags for the glyph + */ + uint getRoomFlags() const { return _roomFlags; } void set38(int val) { _field38 = val; } - void set3C(int val) { _field3C = val; } + /** + * Sets the mode of the glyph + */ + void setMode(RoomGlyphMode mode) { _mode = mode; } + + bool isModeValid() const { return _mode != RGM_0; } + bool isMode1() const { return _mode == RGM_1; } + bool isMode2() const { return _mode == RGM_2; } /** * Setup the glyph @@ -86,6 +103,8 @@ public: * Save the list */ void save2(SimpleFile *file, int indent) const; + + CPetRoomsGlyph *findMode1() const; }; } // End of namespace Titanic |