From 27e020cbf98d88373111bff0f1d6ed0e846b2311 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 2 Jan 2015 12:14:57 -1000 Subject: XEEN: Split char/party logic into it's own file --- engines/xeen/module.mk | 1 + engines/xeen/party.cpp | 317 +++++++++++++++++++++++++++++++++++++++++++++++++ engines/xeen/party.h | 217 +++++++++++++++++++++++++++++++++ engines/xeen/saves.h | 183 +--------------------------- engines/xeen/xeen.cpp | 12 +- engines/xeen/xeen.h | 2 + 6 files changed, 549 insertions(+), 183 deletions(-) create mode 100644 engines/xeen/party.cpp create mode 100644 engines/xeen/party.h diff --git a/engines/xeen/module.mk b/engines/xeen/module.mk index 2f5a092ca9..752608a136 100644 --- a/engines/xeen/module.mk +++ b/engines/xeen/module.mk @@ -12,6 +12,7 @@ MODULE_OBJS := \ files.o \ font.o \ items.o \ + party.o \ resdata.o \ resources.o \ saves.o \ diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp new file mode 100644 index 0000000000..69a64bb9c7 --- /dev/null +++ b/engines/xeen/party.cpp @@ -0,0 +1,317 @@ +/* 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 "common/scummsys.h" +#include "common/algorithm.h" +#include "xeen/party.h" +#include "xeen/files.h" +#include "xeen/xeen.h" + +namespace Xeen { + +AttributePair::AttributePair() { + _temporary = _permanent = 0; +} + +void AttributePair::synchronize(Common::Serializer &s) { + s.syncAsByte(_permanent); + s.syncAsByte(_temporary); +} + +/*------------------------------------------------------------------------*/ + +Party::Party() { + _partyCount = 0; + _realPartyCount = 0; + Common::fill(&_partyMembers[0], &_partyMembers[8], 0); + _mazeDirection = DIR_NORTH; + _mazeId = _priorMazeId = 0; + _levitateActive = false; + _automapOn = false; + _wizardEyeActive = false; + _clairvoyanceActive = false; + _walkOnWaterActive = false; + _blessedActive = false; + _powerShieldActive = false; + _holyBonusActive = false; + _heroismActive = false; + _difficulty = ADVENTURER; + _cloudsEnd = false; + _darkSideEnd = false; + _worldEnd = false; + hour_maybe = 0; + _day = 0; + _year = 0; + _minutes = 0; + _food = 0; + _lightCount = 0; + _torchCount = 0; + _fireResistence = 0; + _electricityResistence = 0; + _coldResistence = 0; + _poisonResistence = 0; + _deathCount = 0; + _winCount = 0; + _lossCount = 0; + _gold = 0; + _gems = 0; + _bankGold = 0; + _bankGems = 0; + _totalTime = 0; + _rested = false; + + Common::fill(&_gameFlags[0], &_gameFlags[512], false); + Common::fill(&_autoNotes[0], &_autoNotes[128], false); + Common::fill(&_quests[0], &_quests[64], false); + Common::fill(&_questItems[0], &_questItems[85], 0); + + for (int i = 0; i < TOTAL_CHARACTERS; ++i) + Common::fill(&_characterFlags[i][0], &_characterFlags[i][24], false); +} + +void Party::synchronize(Common::Serializer &s) { + byte dummy[30]; + Common::fill(&dummy[0], &dummy[30], 0); + + s.syncAsByte(_partyCount); + s.syncAsByte(_realPartyCount); + for (int i = 0; i < 8; ++i) + s.syncAsByte(_partyMembers[i]); + s.syncAsByte(_mazeDirection); + s.syncAsByte(_mazePosition.x); + s.syncAsByte(_mazePosition.y); + s.syncAsByte(_mazeId); + + // Game configuration flags not used in this implementation + s.syncBytes(dummy, 3); + + s.syncAsByte(_priorMazeId); + s.syncAsByte(_levitateActive); + s.syncAsByte(_automapOn); + s.syncAsByte(_wizardEyeActive); + s.syncAsByte(_clairvoyanceActive); + s.syncAsByte(_walkOnWaterActive); + s.syncAsByte(_blessedActive); + s.syncAsByte(_powerShieldActive); + s.syncAsByte(_holyBonusActive); + s.syncAsByte(_heroismActive); + s.syncAsByte(_difficulty); + + for (int i = 0; i < ITEMS_COUNT; ++i) + _blacksmithWeapons[i].synchronize(s); + for (int i = 0; i < ITEMS_COUNT; ++i) + _blacksmithArmor[i].synchronize(s); + for (int i = 0; i < ITEMS_COUNT; ++i) + _blacksmithAccessories[i].synchronize(s); + for (int i = 0; i < ITEMS_COUNT; ++i) + _blacksmithMisc[i].synchronize(s); + + s.syncAsUint16LE(_cloudsEnd); + s.syncAsUint16LE(_darkSideEnd); + s.syncAsUint16LE(_worldEnd); + s.syncAsUint16LE(hour_maybe); + s.syncAsUint16LE(_day); + s.syncAsUint16LE(_year); + s.syncAsUint16LE(_minutes); + s.syncAsUint16LE(_food); + s.syncAsUint16LE(_lightCount); + s.syncAsUint16LE(_torchCount); + s.syncAsUint16LE(_fireResistence); + s.syncAsUint16LE(_electricityResistence); + s.syncAsUint16LE(_coldResistence); + s.syncAsUint16LE(_poisonResistence); + s.syncAsUint16LE(_deathCount); + s.syncAsUint16LE(_winCount); + s.syncAsUint16LE(_lossCount); + s.syncAsUint32LE(_gold); + s.syncAsUint32LE(_gems); + s.syncAsUint32LE(_bankGold); + s.syncAsUint32LE(_bankGems); + s.syncAsUint32LE(_totalTime); + s.syncAsByte(_rested); + SavesManager::syncBitFlags(s, &_gameFlags[0], &_gameFlags[512]); + SavesManager::syncBitFlags(s, &_autoNotes[0], &_autoNotes[128]); + SavesManager::syncBitFlags(s, &_quests[0], &_quests[64]); + + for (int i = 0; i < 85; ++i) + s.syncAsByte(_questItems[i]); + + for (int i = 0; i < ITEMS_COUNT; ++i) + _blacksmithWeapons2[i].synchronize(s); + for (int i = 0; i < ITEMS_COUNT; ++i) + _blacksmithArmor2[i].synchronize(s); + for (int i = 0; i < ITEMS_COUNT; ++i) + _blacksmithAccessories2[i].synchronize(s); + for (int i = 0; i < ITEMS_COUNT; ++i) + _blacksmithMisc2[i].synchronize(s); + + for (int i = 0; i < TOTAL_CHARACTERS; ++i) + SavesManager::syncBitFlags(s, &_characterFlags[i][0], &_characterFlags[i][24]); + s.syncBytes(&dummy[0], 30); +} + +/*------------------------------------------------------------------------*/ + +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; + _xeenSide = 0; + _class = KNIGHT; + _ACTemp = 0; + _dbDay = 0; + _tempAge = 0; + Common::fill(&_skills[0], &_skills[18], 0); + Common::fill(&_awards[0], &_awards[512], false); + Common::fill(&_spells[9], &_spells[312], false); + _lloydMap = 0; + _hasSpells = false; + _currentSpell = 0; + _quickOption = 0; + _lloydSide = 0; + _townUnknown = 0; + _unknown2 = 0; + _currentHp = 0; + _currentSp = 0; + _ybDay = 0; + _experience = 0; + _currentAdventuringSpell = 0; + _currentCombatSpell = 0; +} + +void PlayerStruct::synchronize(Common::Serializer &s) { + char name[16]; + Common::fill(&name[0], &name[16], '\0'); + strncpy(name, _name.c_str(), 16); + s.syncBytes((byte *)name, 16); + + if (s.isLoading()) + _name = Common::String(name); + + s.syncAsByte(_sex); + s.syncAsByte(_race); + s.syncAsByte(_xeenSide); + s.syncAsByte(_class); + + _might.synchronize(s); + _intellect.synchronize(s); + _personality.synchronize(s); + _endurance.synchronize(s); + _speed.synchronize(s); + _accuracy.synchronize(s); + _luck.synchronize(s); + s.syncAsByte(_ACTemp); + _level.synchronize(s); + s.syncAsByte(_dbDay); + s.syncAsByte(_tempAge); + + for (int i = 0; i < 18; ++i) + s.syncAsByte(_skills[i]); + SavesManager::syncBitFlags(s, &_awards[0], &_awards[512]); + SavesManager::syncBitFlags(s, &_spells[0], &_spells[312]); + + s.syncAsByte(_lloydMap); + s.syncAsByte(_lloydPosition.x); + s.syncAsByte(_lloydPosition.y); + s.syncAsByte(_hasSpells); + s.syncAsByte(_currentSpell); + s.syncAsByte(_quickOption); + + for (int i = 0; i < 9; ++i) + _weapons[i].synchronize(s); + for (int i = 0; i < 9; ++i) + _armor[i].synchronize(s); + for (int i = 0; i < 9; ++i) + _accessories[i].synchronize(s); + for (int i = 0; i < 9; ++i) + _misc[i].synchronize(s); + + s.syncAsByte(_lloydSide); + _fireResistence.synchronize(s); + _coldResistence.synchronize(s); + _electricityResistence.synchronize(s); + _poisonResistence.synchronize(s); + _energyResistence.synchronize(s); + _magicResistence.synchronize(s); + + _conditions.synchronize(s); + + s.syncAsUint16LE(_townUnknown); + s.syncAsByte(_unknown2); + s.syncAsUint16LE(_currentHp); + s.syncAsUint16LE(_currentSp); + s.syncAsUint16LE(_ybDay); + s.syncAsUint32LE(_experience); + s.syncAsByte(_currentAdventuringSpell); + s.syncAsByte(_currentCombatSpell); +} + +/*------------------------------------------------------------------------*/ + +void Roster::synchronize(Common::Serializer &s) { + if (s.isLoading()) + resize(30); + + for (uint i = 0; i < 30; ++i) + (*this)[i].synchronize(s); +} + +} // End of namespace Xeen diff --git a/engines/xeen/party.h b/engines/xeen/party.h new file mode 100644 index 0000000000..6a6ec5f8a1 --- /dev/null +++ b/engines/xeen/party.h @@ -0,0 +1,217 @@ +/* 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 XEEN_PARTY_H +#define XEEN_PARTY_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "common/rect.h" +#include "common/serializer.h" +#include "xeen/items.h" + +namespace Xeen { + +enum Direction { DIR_NORTH = 0, DIR_EAST = 1, DIR_SOUTH = 2, DIR_WEST = 3 }; + +enum Difficulty { ADVENTURER = 0, WARRIOR = 1 }; + +enum Sex { MALE = 0, FEMALE = 1, YES_PLEASE = 2 }; + +enum Race { HUMAN = 0, ELF = 1, DWARF = 2, GNOME = 3, HALF_ORC = 4 }; + +enum CharacterClass { KNIGHT = 0, PALADIN = 1, ARCHER = 2, CLERIC = 3, + SORCERER = 4, ROBBER = 5, NINJA = 6, BARBARIAN = 7, DRUID = 8, RANGER = 9 +}; + +enum Skill { THIEVERY = 0, ARMS_MASTER = 1, ASTROLOGER = 2, BODYBUILDER = 3, + CARTOGRAPHER = 4, CRUSADER = 5, DIRECTION_SENSE = 6, LINGUIST = 7, + MERCHANT = 8, MOUNTAINEER = 9, NAVIGATOR = 10, PATHFINDER = 11, + PRAYER_MASTER = 12, PRESTIDIGITATION = 13, SWIMMING = 14, TRACKING = 15, + SPOT_DOORS = 16, DANGER_SENSE = 17 +}; + +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 +}; + +#define ITEMS_COUNT 36 +#define TOTAL_CHARACTERS 30 +#define MAX_ACTIVE_PARTY 6 + +class XeenEngine; + +class Party { +public: + int _partyCount; + int _realPartyCount; + int _partyMembers[8]; + Direction _mazeDirection; + Common::Point _mazePosition; + int _mazeId; + int _priorMazeId; + bool _levitateActive; + bool _automapOn; + bool _wizardEyeActive; + bool _clairvoyanceActive; + bool _walkOnWaterActive; + bool _blessedActive; + bool _powerShieldActive; + bool _holyBonusActive; + bool _heroismActive; + Difficulty _difficulty; + XeenItem _blacksmithWeapons[ITEMS_COUNT]; + XeenItem _blacksmithArmor[ITEMS_COUNT]; + XeenItem _blacksmithAccessories[ITEMS_COUNT]; + XeenItem _blacksmithMisc[ITEMS_COUNT]; + bool _cloudsEnd; + bool _darkSideEnd; + bool _worldEnd; + int hour_maybe; + int _day; + int _year; + int _minutes; + int _food; + int _lightCount; + int _torchCount; + int _fireResistence; + int _electricityResistence; + int _coldResistence; + int _poisonResistence; + int _deathCount; + int _winCount; + int _lossCount; + int _gold; + int _gems; + int _bankGold; + int _bankGems; + int _totalTime; + bool _rested; + bool _gameFlags[512]; + bool _autoNotes[128]; + bool _quests[64]; + int _questItems[85]; + XeenItem _blacksmithWeapons2[ITEMS_COUNT]; + XeenItem _blacksmithArmor2[ITEMS_COUNT]; + XeenItem _blacksmithAccessories2[ITEMS_COUNT]; + XeenItem _blacksmithMisc2[ITEMS_COUNT]; + bool _characterFlags[30][24]; +public: + Party(); + + void synchronize(Common::Serializer &s); +}; + +class AttributePair { +public: + int _permanent; + int _temporary; +public: + AttributePair(); + 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; + Sex _sex; + Race _race; + int _xeenSide; + CharacterClass _class; + AttributePair _might; + AttributePair _intellect; + AttributePair _personality; + AttributePair _endurance; + AttributePair _speed; + AttributePair _accuracy; + AttributePair _luck; + int _ACTemp; + AttributePair _level; + int _dbDay; + int _tempAge; + int _skills[18]; + bool _awards[512]; + bool _spells[312]; + int _lloydMap; + Common::Point _lloydPosition; + bool _hasSpells; + int _currentSpell; + int _quickOption; + XeenItem _weapons[9]; + XeenItem _armor[9]; + XeenItem _accessories[9]; + XeenItem _misc[9]; + int _lloydSide; + AttributePair _fireResistence; + AttributePair _coldResistence; + AttributePair _electricityResistence; + AttributePair _poisonResistence; + AttributePair _energyResistence; + AttributePair _magicResistence; + Conditions _conditions; + int _townUnknown; + int _unknown2; + int _currentHp; + int _currentSp; + int _ybDay; + uint32 _experience; + int _currentAdventuringSpell; + int _currentCombatSpell; +public: + PlayerStruct(); + void synchronize(Common::Serializer &s); +}; + +class Roster: public Common::Array { +public: + Roster() {} + + void synchronize(Common::Serializer &s); +}; + +} // End of namespace Xeen + +#endif /* XEEN_PARTY_H */ diff --git a/engines/xeen/saves.h b/engines/xeen/saves.h index 307582505f..8b29f15838 100644 --- a/engines/xeen/saves.h +++ b/engines/xeen/saves.h @@ -24,192 +24,11 @@ #define XEEN_SAVES_H #include "common/scummsys.h" -#include "common/rect.h" #include "common/savefile.h" -#include "xeen/items.h" +#include "xeen/party.h" namespace Xeen { -enum Direction { DIR_NORTH = 0, DIR_EAST = 1, DIR_SOUTH = 2, DIR_WEST = 3 }; - -enum Difficulty { ADVENTURER = 0, WARRIOR = 1 }; - -enum Sex { MALE = 0, FEMALE = 1, YES_PLEASE = 2 }; - -enum Race { HUMAN = 0, ELF = 1, DWARF = 2, GNOME = 3, HALF_ORC = 4 }; - -enum CharacterClass { KNIGHT = 0, PALADIN = 1, ARCHER = 2, CLERIC = 3, - SORCERER = 4, ROBBER = 5, NINJA = 6, BARBARIAN = 7, DRUID = 8, RANGER = 9 -}; - -enum Skill { THIEVERY = 0, ARMS_MASTER = 1, ASTROLOGER = 2, BODYBUILDER = 3, - CARTOGRAPHER = 4, CRUSADER = 5, DIRECTION_SENSE = 6, LINGUIST = 7, - MERCHANT = 8, MOUNTAINEER = 9, NAVIGATOR = 10, PATHFINDER = 11, - PRAYER_MASTER = 12, PRESTIDIGITATION = 13, SWIMMING = 14, TRACKING = 15, - SPOT_DOORS = 16, DANGER_SENSE = 17 -}; - -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 -}; - -#define ITEMS_COUNT 36 -#define TOTAL_CHARACTERS 30 - -class XeenEngine; - -class Party { -public: - int _partyCount; - int _realPartyCount; - int _partyMembers[8]; - Direction _mazeDirection; - Common::Point _mazePosition; - int _mazeId; - int _priorMazeId; - bool _levitateActive; - bool _automapOn; - bool _wizardEyeActive; - bool _clairvoyanceActive; - bool _walkOnWaterActive; - bool _blessedActive; - bool _powerShieldActive; - bool _holyBonusActive; - bool _heroismActive; - Difficulty _difficulty; - XeenItem _blacksmithWeapons[ITEMS_COUNT]; - XeenItem _blacksmithArmor[ITEMS_COUNT]; - XeenItem _blacksmithAccessories[ITEMS_COUNT]; - XeenItem _blacksmithMisc[ITEMS_COUNT]; - bool _cloudsEnd; - bool _darkSideEnd; - bool _worldEnd; - int hour_maybe; - int _day; - int _year; - int _minutes; - int _food; - int _lightCount; - int _torchCount; - int _fireResistence; - int _electricityResistence; - int _coldResistence; - int _poisonResistence; - int _deathCount; - int _winCount; - int _lossCount; - int _gold; - int _gems; - int _bankGold; - int _bankGems; - int _totalTime; - bool _rested; - bool _gameFlags[512]; - bool _autoNotes[128]; - bool _quests[64]; - int _questItems[85]; - XeenItem _blacksmithWeapons2[ITEMS_COUNT]; - XeenItem _blacksmithArmor2[ITEMS_COUNT]; - XeenItem _blacksmithAccessories2[ITEMS_COUNT]; - XeenItem _blacksmithMisc2[ITEMS_COUNT]; - bool _characterFlags[30][24]; -public: - Party(); - - void synchronize(Common::Serializer &s); -}; - -class AttributePair { -public: - int _permanent; - int _temporary; -public: - AttributePair(); - 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; - Sex _sex; - Race _race; - int _xeenSide; - CharacterClass _class; - AttributePair _might; - AttributePair _intellect; - AttributePair _personality; - AttributePair _endurance; - AttributePair _speed; - AttributePair _accuracy; - AttributePair _luck; - int _ACTemp; - AttributePair _level; - int _dbDay; - int _tempAge; - int _skills[18]; - bool _awards[512]; - bool _spells[312]; - int _lloydMap; - Common::Point _lloydPosition; - bool _hasSpells; - int _currentSpell; - int _quickOption; - XeenItem _weapons[9]; - XeenItem _armor[9]; - XeenItem _accessories[9]; - XeenItem _misc[9]; - int _lloydSide; - AttributePair _fireResistence; - AttributePair _coldResistence; - AttributePair _electricityResistence; - AttributePair _poisonResistence; - AttributePair _energyResistence; - AttributePair _magicResistence; - Conditions _conditions; - int _townUnknown; - int _unknown2; - int _currentHp; - int _currentSp; - int _ybDay; - uint32 _experience; - int _currentAdventuringSpell; - int _currentCombatSpell; -public: - PlayerStruct(); - void synchronize(Common::Serializer &s); -}; - -class Roster: public Common::Array { -public: - Roster() {} - - void synchronize(Common::Serializer &s); -}; - class SavesManager { private: XeenEngine *_vm; diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 96a4f5f3cf..45d9c22413 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -41,6 +41,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _screen = nullptr; _sound = nullptr; _eventData = nullptr; + Common::fill(&_activeRoster[0], &_activeRoster[MAX_ACTIVE_PARTY], nullptr); } XeenEngine::~XeenEngine() { @@ -241,12 +242,21 @@ void XeenEngine::showMainMenu() { void XeenEngine::playGame() { _saves->reset(); -// drawUI(); + drawUI(); } +/* + * Lots of stuff in this method. + * TODO: Consider renaming method when better understood + */ void XeenEngine::drawUI() { SpriteResource sprites1("global.icn"), borderSprites("border.icn"); + // Get mappings to the active characters in the party + Common::fill(&_activeRoster[0], &_activeRoster[MAX_ACTIVE_PARTY], nullptr); + for (int i = 0; i < _saves->_party._partyCount; ++i) { + _activeRoster[i] = &_saves->_roster[_saves->_party._partyMembers[i]]; + } } } // End of namespace Xeen diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h index 7d23fded23..159ce7446b 100644 --- a/engines/xeen/xeen.h +++ b/engines/xeen/xeen.h @@ -34,6 +34,7 @@ #include "graphics/surface.h" #include "xeen/debugger.h" #include "xeen/events.h" +#include "xeen/party.h" #include "xeen/saves.h" #include "xeen/screen.h" #include "xeen/sound.h" @@ -126,6 +127,7 @@ public: Mode _mode; GameEvent _gameEvent; Common::SeekableReadStream *_eventData; + PlayerStruct *_activeRoster[MAX_ACTIVE_PARTY]; public: XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc); virtual ~XeenEngine(); -- cgit v1.2.3