diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/xeen/dialogs_party.cpp | 172 | ||||
-rw-r--r-- | engines/xeen/interface.cpp | 137 | ||||
-rw-r--r-- | engines/xeen/interface.h | 2 | ||||
-rw-r--r-- | engines/xeen/party.cpp | 7 | ||||
-rw-r--r-- | engines/xeen/party.h | 3 | ||||
-rw-r--r-- | engines/xeen/saves.cpp | 8 | ||||
-rw-r--r-- | engines/xeen/saves.h | 3 | ||||
-rw-r--r-- | engines/xeen/xeen.cpp | 2 | ||||
-rw-r--r-- | engines/xeen/xeen.h | 1 |
9 files changed, 168 insertions, 167 deletions
diff --git a/engines/xeen/dialogs_party.cpp b/engines/xeen/dialogs_party.cpp index 510cd6572d..aa8d58f32b 100644 --- a/engines/xeen/dialogs_party.cpp +++ b/engines/xeen/dialogs_party.cpp @@ -38,38 +38,161 @@ namespace Xeen { void PartyDialog::execute() { EventsManager &events = *_vm->_events; Map &map = *_vm->_map; + Party &party = *_vm->_party; Screen &screen = *_vm->_screen; loadButtons(); setupBackground(); - _vm->_mode = MODE_1; - Common::Array<int> xeenSideChars; + while (!_vm->shouldQuit()) { + _vm->_mode = MODE_1; + Common::Array<int> xeenSideChars; - // Build up a list of characters on the same Xeen side being loaded - for (int i = 0; i < XEEN_TOTAL_CHARACTERS; ++i) { - Character &player = _vm->_roster[i]; - if (player._name.empty() || player._xeenSide != (map._loadDarkSide ? 1 : 0)) - continue; + party.loadActiveParty(); - xeenSideChars.push_back(i); + // Build up a list of characters on the same Xeen side being loaded + for (int i = 0; i < XEEN_TOTAL_CHARACTERS; ++i) { + Character &player = party._roster[i]; + if (player._name.empty() || player._xeenSide != (map._loadDarkSide ? 1 : 0)) + continue; + + xeenSideChars.push_back(i); + } + + Window &w = screen._windows[11]; + w.open(); + setupFaces(0, xeenSideChars, false); + w.writeString(_displayText); + w.drawList(&_faceDrawStructs[0], 4); + + _iconSprites.draw(w, 0, Common::Point(16, 100)); + _iconSprites.draw(w, 2, Common::Point(52, 100)); + _iconSprites.draw(w, 4, Common::Point(87, 100)); + _iconSprites.draw(w, 6, Common::Point(122, 100)); + _iconSprites.draw(w, 8, Common::Point(157, 100)); + _iconSprites.draw(w, 10, Common::Point(192, 100)); + screen.loadPalette("mm4.pal"); + + /* + + + if (flag) { + screen._windows[0].update(); + events.setCursor(0); + screen.fadeIn(4); + } else { + if (_vm->getGameID() == GType_DarkSide) { + screen.fadeOut(4); + screen._windows[0].update(); + } + + doScroll(_vm, false, false); + events.setCursor(0); + + if (_vm->getGameID() == GType_DarkSide) { + screen.fadeIn(4); + } + } + + // TODO + bool breakFlag = false; + while (!_vm->shouldQuit() && !breakFlag) { + events.pollEventsAndWait(); + checkEvents(_vm); + + switch (_buttonValue) { + case Common::KEYCODE_ESCAPE: + case Common::KEYCODE_SPACE: + case Common::KEYCODE_e: + case Common::KEYCODE_x: + if (_vm->_party->_partyCount == 0) { + ErrorScroll::show(_vm, NO_ONE_TO_ADVENTURE_WITH); + } else { + if (_vm->_mode != MODE_0) { + for (_intrIndex1 = 4; _intrIndex1 >= 0; --_intrIndex1) { + events.updateGameCounter(); + drawViewBackground(_intrIndex1); + w.update(); + + while (events.timeElapsed() < 1) + events.pollEventsAndWait(); + } + } + + w.close(); + _vm->_party->_realPartyCount = _vm->_party->_partyCount; + _vm->_party->_mazeId = _vm->_party->_priorMazeId; + + _vm->_party->copyPartyToRoster(_vm->_roster); + _vm->_saves->writeCharFile(); + breakFlag = true; + break; + } + break; + case Common::KEYCODE_1: + break; + case Common::KEYCODE_2: + break; + case Common::KEYCODE_3: + break; + case Common::KEYCODE_4: + break; + case Common::KEYCODE_c: + if (xeenSideChars.size() == 24) { + ErrorScroll::show(_vm, YOUR_ROSTER_IS_FULL); + } else { + screen.fadeOut(4); + w.close(); + moveCharacterToRoster(); + _vm->_saves->writeCharFile(); + screen.fadeOut(4); + flag = true; + _buttonsLoaded = true; + goto start; + } + break; + case Common::KEYCODE_d: + break; + case Common::KEYCODE_r: + if (_vm->_party->_partyCount > 0) { + // TODO + } + break; + case 201: + // TODO + break; + case 202: + // TODO + break; + case 203: + // TODO + break; + case 204: + // TODO + break; + case 205: + // TODO + break; + case 206: + // TODO + break; + case 242: + // TODO + break; + case 243: + // TODO + break; + default: + break; + } + } } - Window &w = screen._windows[11]; - w.open(); - setupFaces(0, xeenSideChars, false); - w.writeString(_displayText); - w.drawList(&_faceDrawStructs[0], 4); - - _iconSprites.draw(w, 0, Common::Point(16, 100)); - _iconSprites.draw(w, 2, Common::Point(52, 100)); - _iconSprites.draw(w, 4, Common::Point(87, 100)); - _iconSprites.draw(w, 6, Common::Point(122, 100)); - _iconSprites.draw(w, 8, Common::Point(157, 100)); - _iconSprites.draw(w, 10, Common::Point(192, 100)); - - screen.loadPalette("mm4.pal"); - // TODO + for (int i = 0; i < TOTAL_CHARACTERS; ++i) + _charFaces[i].clear(); + */ + // TODO + } } void PartyDialog::loadButtons() { @@ -103,6 +226,7 @@ void PartyDialog::setupBackground() { * Sets up the faces for display in the party dialog */ void PartyDialog::setupFaces(int charIndex, Common::Array<int> xeenSideChars, bool updateFlag) { + Party &party = *_vm->_party; Resources &res = *_vm->_resources; Common::String charNames[4]; Common::String charRaces[4]; @@ -123,7 +247,7 @@ void PartyDialog::setupFaces(int charIndex, Common::Array<int> xeenSideChars, bo Common::Rect &b = _buttons[7 + posIndex]._bounds; b.moveTo((posIndex & 1) ? 117 : 16, b.top); - Character &ps = _vm->_roster[xeenSideChars[charIndex + posIndex]]; + Character &ps = party._roster[xeenSideChars[charIndex + posIndex]]; charNames[posIndex] = isInParty ? IN_PARTY : ps._name; charRaces[posIndex] = RACE_NAMES[ps._race]; charSex[posIndex] = SEX_NAMES[ps._sex]; diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index a88217e5ad..8aa938b583 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -69,139 +69,11 @@ void Interface::setup() { _restoreSprites.load("restorex.icn"); _hpSprites.load("hpbars.icn"); _uiSprites.load("inn.icn"); - - // Get mappings to the active characters in the party - _vm->_party->_activeParty.resize(_vm->_party->_partyCount); - for (int i = 0; i < _vm->_party->_partyCount; ++i) { - _vm->_party->_activeParty[i] = _vm->_roster[_vm->_party->_partyMembers[i]]; - } - - _vm->_party->_newDay = _vm->_party->_minutes >= 300; -} - -void Interface::manageCharacters(bool soundPlayed) { - /* - - - if (flag) { - screen._windows[0].update(); - events.setCursor(0); - screen.fadeIn(4); - } else { - if (_vm->getGameID() == GType_DarkSide) { - screen.fadeOut(4); - screen._windows[0].update(); - } - - doScroll(_vm, false, false); - events.setCursor(0); - - if (_vm->getGameID() == GType_DarkSide) { - screen.fadeIn(4); - } - } - - // TODO - bool breakFlag = false; - while (!_vm->shouldQuit() && !breakFlag) { - events.pollEventsAndWait(); - checkEvents(_vm); - - switch (_buttonValue) { - case Common::KEYCODE_ESCAPE: - case Common::KEYCODE_SPACE: - case Common::KEYCODE_e: - case Common::KEYCODE_x: - if (_vm->_party->_partyCount == 0) { - ErrorScroll::show(_vm, NO_ONE_TO_ADVENTURE_WITH); - } else { - if (_vm->_mode != MODE_0) { - for (_intrIndex1 = 4; _intrIndex1 >= 0; --_intrIndex1) { - events.updateGameCounter(); - drawViewBackground(_intrIndex1); - w.update(); - - while (events.timeElapsed() < 1) - events.pollEventsAndWait(); - } - } - - w.close(); - _vm->_party->_realPartyCount = _vm->_party->_partyCount; - _vm->_party->_mazeId = _vm->_party->_priorMazeId; - - _vm->_party->copyPartyToRoster(_vm->_roster); - _vm->_saves->writeCharFile(); - breakFlag = true; - break; - } - break; - case Common::KEYCODE_1: - break; - case Common::KEYCODE_2: - break; - case Common::KEYCODE_3: - break; - case Common::KEYCODE_4: - break; - case Common::KEYCODE_c: - if (xeenSideChars.size() == 24) { - ErrorScroll::show(_vm, YOUR_ROSTER_IS_FULL); - } else { - screen.fadeOut(4); - w.close(); - moveCharacterToRoster(); - _vm->_saves->writeCharFile(); - screen.fadeOut(4); - flag = true; - _buttonsLoaded = true; - goto start; - } - break; - case Common::KEYCODE_d: - break; - case Common::KEYCODE_r: - if (_vm->_party->_partyCount > 0) { - // TODO - } - break; - case 201: - // TODO - break; - case 202: - // TODO - break; - case 203: - // TODO - break; - case 204: - // TODO - break; - case 205: - // TODO - break; - case 206: - // TODO - break; - case 242: - // TODO - break; - case 243: - // TODO - break; - default: - break; - } - } - } - - for (int i = 0; i < TOTAL_CHARACTERS; ++i) - _charFaces[i].clear(); - */ -} - -void Interface::loadCharIcons() { _dseFace.load("dse.fac"); + + Party &party = *_vm->_party; + party.loadActiveParty(); + party._newDay = party._minutes >= 300; } void Interface::loadPartyIcons() { @@ -304,7 +176,6 @@ void Interface::moveCharacterToRoster() { void Interface::startup() { Screen &screen = *_vm->_screen; - loadCharIcons(); _iconSprites.load("main.icn"); animate3d(); diff --git a/engines/xeen/interface.h b/engines/xeen/interface.h index 9ab9102374..cce2eaaa30 100644 --- a/engines/xeen/interface.h +++ b/engines/xeen/interface.h @@ -83,8 +83,6 @@ public: void manageCharacters(bool soundPlayed); - void loadCharIcons(); - void loadPartyIcons(); void startup(); diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index ff59ed9b18..5cf5181142 100644 --- a/engines/xeen/party.cpp +++ b/engines/xeen/party.cpp @@ -186,6 +186,13 @@ void Party::synchronize(Common::Serializer &s) { s.syncBytes(&dummy[0], 30); } +void Party::loadActiveParty() { + _activeParty.resize(_partyCount); + for (int i = 0; i < _partyCount; ++i) { + _activeParty[i] = _roster[_partyMembers[i]]; + } +} + bool Party::checkSkill(Skill skillId) { uint total = 0; for (uint i = 0; i < _activeParty.size(); ++i) { diff --git a/engines/xeen/party.h b/engines/xeen/party.h index 5b7da052ba..1382969477 100644 --- a/engines/xeen/party.h +++ b/engines/xeen/party.h @@ -113,6 +113,7 @@ public: bool _characterFlags[30][24]; public: // Other party related runtime data + Roster _roster; Common::Array<Character> _activeParty; Common::Array<Character *> _combatParty; int _combatPartyCount; @@ -131,6 +132,8 @@ public: void synchronize(Common::Serializer &s); + void loadActiveParty(); + bool checkSkill(Skill skillId); bool isInParty(int charId); diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp index 85ab60bc12..61022a31cb 100644 --- a/engines/xeen/saves.cpp +++ b/engines/xeen/saves.cpp @@ -45,8 +45,8 @@ void OutFile::finalize() { /*------------------------------------------------------------------------*/ -SavesManager::SavesManager(XeenEngine *vm, Party &party, Roster &roster) : - BaseCCArchive(), _vm(vm), _party(party), _roster(roster) { +SavesManager::SavesManager(XeenEngine *vm, Party &party) : + BaseCCArchive(), _vm(vm), _party(party) { SearchMan.add("saves", this, 0, false); _data = nullptr; _wonWorld = false; @@ -113,7 +113,7 @@ void SavesManager::load(Common::SeekableReadStream *stream) { // Load in the character stats and active party Common::SeekableReadStream *chr = createReadStreamForMember("maze.chr"); Common::Serializer sChr(chr, nullptr); - _roster.synchronize(sChr); + _party._roster.synchronize(sChr); delete chr; Common::SeekableReadStream *pty = createReadStreamForMember("maze.pty"); @@ -158,7 +158,7 @@ void SavesManager::reset() { File fChar("maze.chr", gameCur); Common::Serializer sChar(&fChar, nullptr); - _roster.synchronize(sChar); + _party._roster.synchronize(sChar); fChar.close(); } diff --git a/engines/xeen/saves.h b/engines/xeen/saves.h index 5d35518348..8f112f689e 100644 --- a/engines/xeen/saves.h +++ b/engines/xeen/saves.h @@ -59,7 +59,6 @@ class SavesManager: public BaseCCArchive { private: XeenEngine *_vm; Party &_party; - Roster &_roster; byte *_data; Common::HashMap<uint16, Common::MemoryWriteStreamDynamic > _newData; @@ -70,7 +69,7 @@ public: bool _wonWorld; bool _wonDarkSide; public: - SavesManager(XeenEngine *vm, Party &party, Roster &roster); + SavesManager(XeenEngine *vm, Party &party); ~SavesManager(); diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index ed944262e1..3c2b7a2c77 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -94,7 +94,7 @@ void XeenEngine::initialize() { _interface = new Interface(this); _map = new Map(this); _party = new Party(this); - _saves = new SavesManager(this, *_party, _roster); + _saves = new SavesManager(this, *_party); _screen = new Screen(this); _scripts = new Scripts(this); _screen->setupWindows(); diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h index 4664998a3e..c4f826d508 100644 --- a/engines/xeen/xeen.h +++ b/engines/xeen/xeen.h @@ -152,7 +152,6 @@ public: Mode _mode; GameEvent _gameEvent; Common::SeekableReadStream *_eventData; - Roster _roster; int _quitMode; bool _dangerSenseAllowed; bool _noDirectionSense; |