diff options
author | Paul Gilbert | 2015-02-11 21:04:05 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-02-11 21:04:05 -0500 |
commit | 6548dd05e316588bde3eae5db10793f8c6effd7b (patch) | |
tree | 98a1024069730013c0f2f3901b9c127439bc1d6a /engines/xeen | |
parent | 2f39bd5cd259cd5af16543338f4bb6a930191786 (diff) | |
download | scummvm-rg350-6548dd05e316588bde3eae5db10793f8c6effd7b.tar.gz scummvm-rg350-6548dd05e316588bde3eae5db10793f8c6effd7b.tar.bz2 scummvm-rg350-6548dd05e316588bde3eae5db10793f8c6effd7b.zip |
XEEN: Fix removing and adding chars to party in Party dialog
Diffstat (limited to 'engines/xeen')
-rw-r--r-- | engines/xeen/dialogs.cpp | 9 | ||||
-rw-r--r-- | engines/xeen/dialogs.h | 2 | ||||
-rw-r--r-- | engines/xeen/dialogs_error.cpp | 4 | ||||
-rw-r--r-- | engines/xeen/dialogs_party.cpp | 61 |
4 files changed, 55 insertions, 21 deletions
diff --git a/engines/xeen/dialogs.cpp b/engines/xeen/dialogs.cpp index ff4eaf622a..33eda14414 100644 --- a/engines/xeen/dialogs.cpp +++ b/engines/xeen/dialogs.cpp @@ -51,6 +51,15 @@ void ButtonContainer::addButton(const Common::Rect &bounds, int val, SpriteResou _buttons.push_back(UIButton(bounds, val, sprites, draw)); } +void ButtonContainer::addPartyButtons(XeenEngine *vm) { + Party &party = *vm->_party; + + for (uint idx = 0; idx < party._activeParty.size(); ++idx) { + addButton(Common::Rect(CHAR_FACES_X[idx], 150, CHAR_FACES_X[idx] + 32, 182), + Common::KEYCODE_F1 + idx, nullptr, false); + } +} + bool ButtonContainer::checkEvents(XeenEngine *vm) { EventsManager &events = *vm->_events; _buttonValue = 0; diff --git a/engines/xeen/dialogs.h b/engines/xeen/dialogs.h index d8a9123c10..ba27fe97ec 100644 --- a/engines/xeen/dialogs.h +++ b/engines/xeen/dialogs.h @@ -67,6 +67,8 @@ public: void restoreButtons(); void addButton(const Common::Rect &bounds, int val, SpriteResource *sprites, bool draw = true); + + void addPartyButtons(XeenEngine *vm); }; class SettingsBaseDialog : public ButtonContainer { diff --git a/engines/xeen/dialogs_error.cpp b/engines/xeen/dialogs_error.cpp index 4fe39db3b3..db2603ab87 100644 --- a/engines/xeen/dialogs_error.cpp +++ b/engines/xeen/dialogs_error.cpp @@ -44,7 +44,7 @@ void ErrorDialog::execute(const Common::String &msg, ErrorWaitType waitType) { switch (waitType) { case WT_FREEZE_WAIT: - while (!_vm->shouldQuit() && !events.isKeyPending()) + while (!_vm->shouldQuit() && !events.isKeyMousePressed()) events.pollEventsAndWait(); events.clearEvents(); @@ -71,6 +71,8 @@ void ErrorDialog::execute(const Common::String &msg, ErrorWaitType waitType) { default: break; } + + w.close(); } /*------------------------------------------------------------------------*/ diff --git a/engines/xeen/dialogs_party.cpp b/engines/xeen/dialogs_party.cpp index 9de0346cc6..e1a6dbc92a 100644 --- a/engines/xeen/dialogs_party.cpp +++ b/engines/xeen/dialogs_party.cpp @@ -56,7 +56,8 @@ void PartyDialog::execute() { while (!_vm->shouldQuit()) { _vm->_mode = MODE_1; - // Build up a list of characters on the same Xeen side being loaded + // Build up a list of available characters in the Roster that are on the + // same side of Xeen as the player is currently on _charList.clear(); for (int i = 0; i < XEEN_TOTAL_CHARACTERS; ++i) { Character &player = party._roster[i]; @@ -159,28 +160,37 @@ void PartyDialog::execute() { break; } + // Only add the character if they're not already in the party if (idx == party._activeParty.size()) { - sound.playFX(21); - ErrorScroll::show(_vm, YOUR_PARTY_IS_FULL); - } else { - party._activeParty.push_back(party._roster[ - _charList[_buttonValue - 7 + startingChar]]); - error("TODO"); + if (party._activeParty.size() == MAX_ACTIVE_PARTY) { + sound.playFX(21); + ErrorScroll::show(_vm, YOUR_PARTY_IS_FULL); + } else { + // Add the character to the active party + party._activeParty.push_back(party._roster[ + _charList[_buttonValue - 7 + startingChar]]); + startingCharChanged(startingChar); + } } } - // TODO break; case Common::KEYCODE_UP: case Common::KEYCODE_KP8: + // Up arrow if (startingChar > 0) { startingChar -= 4; startingCharChanged(startingChar); } break; + case Common::KEYCODE_DOWN: case Common::KEYCODE_KP2: - // TODO + // Down arrow + if (startingChar < (_charList.size() - 4)) { + startingChar += 4; + startingCharChanged(startingChar); + } break; case Common::KEYCODE_c: @@ -231,10 +241,6 @@ void PartyDialog::loadButtons() { addButton(Common::Rect(157, 100, 181, 120), Common::KEYCODE_c, &_uiSprites); addButton(Common::Rect(192, 100, 216, 120), Common::KEYCODE_x, &_uiSprites); addButton(Common::Rect(0, 0, 0, 0), Common::KEYCODE_ESCAPE, &_uiSprites, false); - addButton(Common::Rect(16, 16, 48, 48), Common::KEYCODE_1, &_uiSprites, false); - addButton(Common::Rect(117, 16, 149, 48), Common::KEYCODE_2, &_uiSprites, false); - addButton(Common::Rect(59, 59, 91, 91), Common::KEYCODE_3, &_uiSprites, false); - addButton(Common::Rect(117, 59, 151, 91), Common::KEYCODE_4, &_uiSprites, false); } void PartyDialog::initDrawStructs() { @@ -261,6 +267,15 @@ void PartyDialog::setupFaces(int firstDisplayChar, bool updateFlag) { int posIndex; int charId; + // Reset the button areas for the display character images + while (_buttons.size() > 7) + _buttons.remove_at(7); + addButton(Common::Rect(16, 16, 48, 48), Common::KEYCODE_1, &_uiSprites, false); + addButton(Common::Rect(117, 16, 149, 48), Common::KEYCODE_2, &_uiSprites, false); + addButton(Common::Rect(59, 59, 91, 91), Common::KEYCODE_3, &_uiSprites, false); + addButton(Common::Rect(117, 59, 151, 91), Common::KEYCODE_4, &_uiSprites, false); + + for (posIndex = 0; posIndex < 4; ++posIndex) { charId = (firstDisplayChar + posIndex) >= (int)_charList.size() ? -1 : _charList[firstDisplayChar + posIndex]; @@ -304,7 +319,7 @@ void PartyDialog::startingCharChanged(int firstDisplayChar) { Window &w = _vm->_screen->_windows[11]; setupFaces(firstDisplayChar, true); - w.writeString(_partyDetails); + w.writeString(Common::String::format(PARTY_DIALOG_TEXT, _partyDetails.c_str())); w.drawList(_faceDrawStructs, 4); _uiSprites.draw(w, 0, Common::Point(16, 100)); @@ -344,6 +359,7 @@ int PartyDialog::selectCharacter(bool isDelete, int firstDisplayChar) { addButton(Common::Rect(117, 16, 149, 48), Common::KEYCODE_2, &iconSprites, false); addButton(Common::Rect(16, 59, 48, 91), Common::KEYCODE_3, &iconSprites, false); addButton(Common::Rect(117, 59, 149, 91), Common::KEYCODE_4, &iconSprites, false); + addPartyButtons(_vm); int result = -1, v; while (!_vm->shouldQuit() && result == -1) { @@ -364,18 +380,23 @@ int PartyDialog::selectCharacter(bool isDelete, int firstDisplayChar) { case Common::KEYCODE_F4: case Common::KEYCODE_F5: case Common::KEYCODE_F6: - v = _buttonValue - Common::KEYCODE_F1; - if (v < (int)party._activeParty.size()) - result = _buttonValue; + if (!isDelete) { + v = _buttonValue - Common::KEYCODE_F1; + if (v < (int)party._activeParty.size()) + result = _buttonValue; + } break; case Common::KEYCODE_1: case Common::KEYCODE_2: case Common::KEYCODE_3: case Common::KEYCODE_4: - v = _buttonValue - Common::KEYCODE_1; - if ((firstDisplayChar + v) < (int)_charList.size()) - result = _buttonValue; + if (isDelete) { + v = _buttonValue - Common::KEYCODE_1; + if ((firstDisplayChar + v) < (int)_charList.size()) + result = _buttonValue; + } + break; default: break; |