aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/dialogs_party.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-02-13 23:48:02 -0500
committerPaul Gilbert2015-02-13 23:48:02 -0500
commit9b0b0cd9e747780ec32a3589343f0172c0237aa0 (patch)
tree91bb9140b2188acb1112551cc948305dd1457193 /engines/xeen/dialogs_party.cpp
parentd225bc4cb3364b2cc8fc0fcab96347cc91e93866 (diff)
downloadscummvm-rg350-9b0b0cd9e747780ec32a3589343f0172c0237aa0.tar.gz
scummvm-rg350-9b0b0cd9e747780ec32a3589343f0172c0237aa0.tar.bz2
scummvm-rg350-9b0b0cd9e747780ec32a3589343f0172c0237aa0.zip
XEEN: Implemented exchangeAttribute
Diffstat (limited to 'engines/xeen/dialogs_party.cpp')
-rw-r--r--engines/xeen/dialogs_party.cpp77
1 files changed, 75 insertions, 2 deletions
diff --git a/engines/xeen/dialogs_party.cpp b/engines/xeen/dialogs_party.cpp
index 058ead4edc..b570612ff4 100644
--- a/engines/xeen/dialogs_party.cpp
+++ b/engines/xeen/dialogs_party.cpp
@@ -874,9 +874,83 @@ void PartyDialog::drawDice(SpriteResource &dice) {
* Exchanging two attributes for the character being rolled
*/
int PartyDialog::exchangeAttribute(int srcAttr) {
- error("TODO: exchangeAttribute");
+ EventsManager &events = *_vm->_events;
+ Screen &screen = *_vm->_screen;
+ SpriteResource icons;
+ icons.load("create2.icn");
+
+ saveButtons();
+ addButton(Common::Rect(118, 58, 142, 78), Common::KEYCODE_ESCAPE, &icons);
+ addButton(Common::Rect(168, 19, 192, 39), Common::KEYCODE_m);
+ addButton(Common::Rect(168, 43, 192, 63), Common::KEYCODE_i);
+ addButton(Common::Rect(168, 67, 192, 87), Common::KEYCODE_p);
+ addButton(Common::Rect(168, 91, 192, 111), Common::KEYCODE_e);
+ addButton(Common::Rect(168, 115, 192, 135), Common::KEYCODE_s);
+ addButton(Common::Rect(168, 139, 192, 159), Common::KEYCODE_a);
+ addButton(Common::Rect(168, 163, 192, 183), Common::KEYCODE_l);
+
+ Window &w = screen._windows[26];
+ w.open();
+ w.writeString(Common::String::format(EXCHANGE_ATTR_WITH, STAT_NAMES[srcAttr - 1]));
+ icons.draw(w, 0, Common::Point(118, 58));
+ w.update();
+
+ int result = 0;
+ bool breakFlag = false;
+ while (!_vm->shouldQuit() && !breakFlag) {
+ // Wait for an action
+ do {
+ events.pollEventsAndWait();
+ checkEvents(_vm);
+ } while (!_vm->shouldQuit() && !_buttonValue);
+
+ Attribute destAttr;
+ switch (_buttonValue) {
+ case Common::KEYCODE_m:
+ destAttr = MIGHT;
+ break;
+ case Common::KEYCODE_i:
+ destAttr = INTELLECT;
+ break;
+ case Common::KEYCODE_p:
+ destAttr = PERSONALITY;
+ break;
+ case Common::KEYCODE_e:
+ destAttr = ENDURANCE;
+ break;
+ case Common::KEYCODE_s:
+ destAttr = SPEED;
+ break;
+ case Common::KEYCODE_a:
+ destAttr = ACCURACY;
+ break;
+ case Common::KEYCODE_l:
+ destAttr = LUCK;
+ break;
+ case Common::KEYCODE_ESCAPE:
+ result = 0;
+ breakFlag = true;
+ continue;
+ default:
+ continue;
+ }
+
+ if ((srcAttr - 1) != destAttr) {
+ result = destAttr + 1;
+ break;
+ }
+ }
+
+ w.close();
+ _buttonValue = 0;
+ restoreButtons();
+
+ return result;
}
+/**
+ * Saves the rolled character into the roster
+ */
bool PartyDialog::saveCharacter(Character &c, CharacterClass classId,
Race race, Sex sex, uint attribs[TOTAL_ATTRIBUTES]) {
if (classId == -1) {
@@ -953,5 +1027,4 @@ bool PartyDialog::saveCharacter(Character &c, CharacterClass classId,
return true;
}
-
} // End of namespace Xeen