diff options
Diffstat (limited to 'engines/xeen')
-rw-r--r-- | engines/xeen/saves.cpp | 44 | ||||
-rw-r--r-- | engines/xeen/saves.h | 27 |
2 files changed, 66 insertions, 5 deletions
diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp index 771affc6bc..b3f1b4c71e 100644 --- a/engines/xeen/saves.cpp +++ b/engines/xeen/saves.cpp @@ -171,6 +171,46 @@ void Party::synchronize(Common::Serializer &s) { /*------------------------------------------------------------------------*/ +Conditions::Conditions() { + _cursed = 0; + _heartBroken = 0; + _weak = 0; + _poisoned = 0; + _diseased = 0; + _insane = 0; + _inLove = 0; + _drunk = 0; + _asleep = 0; + _depressed = 0; + _confused = 0; + _paralyzed = 0; + _unconscious = 0; + _dead = 0; + _stoned = 0; + _eradicated = 0; +} + +void Conditions::synchronize(Common::Serializer &s) { + s.syncAsByte(_cursed); + s.syncAsByte(_heartBroken); + s.syncAsByte(_weak); + s.syncAsByte(_poisoned); + s.syncAsByte(_diseased); + s.syncAsByte(_insane); + s.syncAsByte(_inLove); + s.syncAsByte(_drunk); + s.syncAsByte(_asleep); + s.syncAsByte(_depressed); + s.syncAsByte(_confused); + s.syncAsByte(_paralyzed); + s.syncAsByte(_unconscious); + s.syncAsByte(_dead); + s.syncAsByte(_stoned); + s.syncAsByte(_eradicated); +} + +/*------------------------------------------------------------------------*/ + PlayerStruct::PlayerStruct() { _sex = MALE; _race = HUMAN; @@ -187,7 +227,6 @@ PlayerStruct::PlayerStruct() { _currentSpell = 0; _quickOption = 0; _lloydSide = 0; - Common::fill(&_conditions[0], &_conditions[16], 0); _townUnknown = 0; _unknown2 = 0; _currentHp = 0; @@ -253,8 +292,7 @@ void PlayerStruct::synchronize(Common::Serializer &s) { _energyResistence.synchronize(s); _magicResistence.synchronize(s); - for (int i = 0; i < 16; ++i) - s.syncAsByte(_conditions[i]); + _conditions.synchronize(s); s.syncAsUint16LE(_townUnknown); s.syncAsByte(_unknown2); diff --git a/engines/xeen/saves.h b/engines/xeen/saves.h index 3d8978e25a..307582505f 100644 --- a/engines/xeen/saves.h +++ b/engines/xeen/saves.h @@ -49,7 +49,7 @@ enum Skill { THIEVERY = 0, ARMS_MASTER = 1, ASTROLOGER = 2, BODYBUILDER = 3, SPOT_DOORS = 16, DANGER_SENSE = 17 }; -enum Condition { CURSED = 0, HEART_BROKEN = 1, WEAK = 2, POISONED = 3, +enum ConditionType { CURSED = 0, HEART_BROKEN = 1, WEAK = 2, POISONED = 3, DISEASED = 4, INSANE = 5, IN_LOVE = 6, DRUNK = 7, SLEEP = 8, DEPRESSED = 9, CONFUSED = 10, PARALYZED = 11 }; @@ -129,6 +129,29 @@ public: void synchronize(Common::Serializer &s); }; +class Conditions { + byte _cursed; + byte _heartBroken; + byte _weak; + byte _poisoned; + byte _diseased; + byte _insane; + byte _inLove; + byte _drunk; + byte _asleep; + byte _depressed; + byte _confused; + byte _paralyzed; + byte _unconscious; + byte _dead; + byte _stoned; + byte _eradicated; +public: + Conditions(); + + void synchronize(Common::Serializer &s); +}; + class PlayerStruct { public: Common::String _name; @@ -166,7 +189,7 @@ public: AttributePair _poisonResistence; AttributePair _energyResistence; AttributePair _magicResistence; - int _conditions[16]; + Conditions _conditions; int _townUnknown; int _unknown2; int _currentHp; |