diff options
author | Paul Gilbert | 2015-02-01 23:32:16 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-02-01 23:32:16 -0500 |
commit | 7febe773008db7cee0ed1b3f5f1f2fb114d22334 (patch) | |
tree | 8950cd1ecd626dc2cfedde87ba1cfe7d0e9521ee | |
parent | 78234db2c02c95e1b9e88b4096b9a9c96fd95adf (diff) | |
download | scummvm-rg350-7febe773008db7cee0ed1b3f5f1f2fb114d22334.tar.gz scummvm-rg350-7febe773008db7cee0ed1b3f5f1f2fb114d22334.tar.bz2 scummvm-rg350-7febe773008db7cee0ed1b3f5f1f2fb114d22334.zip |
XEEN: Beginnings of Items dialog
-rw-r--r-- | engines/xeen/dialogs_char_info.cpp | 3 | ||||
-rw-r--r-- | engines/xeen/dialogs_items.cpp | 292 | ||||
-rw-r--r-- | engines/xeen/dialogs_items.h | 63 | ||||
-rw-r--r-- | engines/xeen/dialogs_quick_ref.cpp | 1 | ||||
-rw-r--r-- | engines/xeen/items.cpp | 6 | ||||
-rw-r--r-- | engines/xeen/items.h | 4 | ||||
-rw-r--r-- | engines/xeen/module.mk | 1 | ||||
-rw-r--r-- | engines/xeen/party.cpp | 18 | ||||
-rw-r--r-- | engines/xeen/party.h | 12 | ||||
-rw-r--r-- | engines/xeen/resources.cpp | 25 | ||||
-rw-r--r-- | engines/xeen/resources.h | 19 | ||||
-rw-r--r-- | engines/xeen/scripts.cpp | 12 | ||||
-rw-r--r-- | engines/xeen/town.cpp | 9 | ||||
-rw-r--r-- | engines/xeen/town.h | 2 |
14 files changed, 429 insertions, 38 deletions
diff --git a/engines/xeen/dialogs_char_info.cpp b/engines/xeen/dialogs_char_info.cpp index 985309aa8c..1d907cf7d9 100644 --- a/engines/xeen/dialogs_char_info.cpp +++ b/engines/xeen/dialogs_char_info.cpp @@ -22,6 +22,7 @@ #include "xeen/dialogs_char_info.h" #include "xeen/dialogs_exchange.h" +#include "xeen/dialogs_items.h" #include "xeen/dialogs_quick_ref.h" #include "xeen/resources.h" #include "xeen/xeen.h" @@ -185,7 +186,7 @@ void CharacterInfo::execute(int charIndex) { case Common::KEYCODE_i: _vm->_mode = oldMode; _vm->_treasure._v1 = _vm->_mode == MODE_InCombat; - error("TODO: c = ItemDialog::show"); + c = ItemsDialog::show(_vm, c, ITEMMODE_CHAR_INFO); if (!c) { party._stepped = true; diff --git a/engines/xeen/dialogs_items.cpp b/engines/xeen/dialogs_items.cpp new file mode 100644 index 0000000000..fea043213f --- /dev/null +++ b/engines/xeen/dialogs_items.cpp @@ -0,0 +1,292 @@ +/* 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 "xeen/dialogs_items.h" +#include "xeen/resources.h" +#include "xeen/xeen.h" + +namespace Xeen { + +Character *ItemsDialog::show(XeenEngine *vm, Character *c, ItemsMode mode) { + ItemsDialog *dlg = new ItemsDialog(vm); + Character *result = dlg->execute(c, mode); + delete dlg; + + return result; +} + +Character *ItemsDialog::execute(Character *c, ItemsMode mode) { + EventsManager &events = *_vm->_events; + Interface &intf = *_vm->_interface; + Party &party = *_vm->_party; + Screen &screen = *_vm->_screen; + + Character *tempChar = c; + int typeNum = mode == ITEMMODE_4 || mode == ITEMMODE_COMBAT ? 3 : 0; + int varA = mode == ITEMMODE_COMBAT ? 1 : 0; + if (varA != 0) + mode = ITEMMODE_CHAR_INFO; + int varE = mode == 1 ? 1 : 0; + + events.setCursor(0); + loadButtons(mode, c); + + screen._windows[29].open(); + screen._windows[30].open(); + + bool redrawFlag = true; + while (!_vm->shouldQuit()) { + if (redrawFlag) { + if ((mode != ITEMMODE_CHAR_INFO || typeNum != 3) && mode != ITEMMODE_6 + && mode != ITEMMODE_4 && mode != ITEMMODE_TO_GOLD) { + _buttons[8]._bounds.moveTo(148, _buttons[8]._bounds.top); + _buttons[9]._draw = false; + } else if (mode == ITEMMODE_4) { + _buttons[4]._value = Common::KEYCODE_r; + } else if (mode == ITEMMODE_6) { + _buttons[4]._value = Common::KEYCODE_e; + } else if (mode == ITEMMODE_TO_GOLD) { + _buttons[4]._value = Common::KEYCODE_g; + } else { + _buttons[8]._bounds.moveTo(0, _buttons[8]._bounds.top); + _buttons[9]._draw = true; + _buttons[9]._value = Common::KEYCODE_u; + } + + // Write text for the dialog + Common::String msg; + if (mode != ITEMMODE_CHAR_INFO && mode != ITEMMODE_8 && mode != ITEMMODE_6 + && mode != ITEMMODE_4 && mode != ITEMMODE_TO_GOLD) { + msg = Common::String::format(ITEMS_DIALOG_TEXT1, + BTN_SELL, BTN_IDENTIFY, BTN_FIX); + } else if (mode != ITEMMODE_6 && mode != ITEMMODE_4 && mode != ITEMMODE_TO_GOLD) { + msg = Common::String::format(ITEMS_DIALOG_TEXT1, + typeNum == 3 ? BTN_USE : BTN_EQUIP, + BTN_REMOVE, BTN_DISCARD, BTN_QUEST); + } else if (mode == ITEMMODE_6) { + msg = Common::String::format(ITEMS_DIALOG_TEXT2, BTN_ENCHANT); + } else if (mode == ITEMMODE_4) { + msg = Common::String::format(ITEMS_DIALOG_TEXT2, BTN_RECHARGE); + } else { + msg = Common::String::format(ITEMS_DIALOG_TEXT2, BTN_GOLD); + } + + screen._windows[29].writeString(msg); + drawButtons(&screen); + } + + int arr[40]; + Common::fill(&arr[0], &arr[40], false); + int var2 = -1; + + if (mode == ITEMMODE_CHAR_INFO || typeNum != 3) { + _iconSprites.draw(screen, 8, Common::Point(148, 109)); + } + if (mode != ITEMMODE_6 && mode != ITEMMODE_4 && mode != ITEMMODE_TO_GOLD) { + _iconSprites.draw(screen, 10, Common::Point(182, 109)); + _iconSprites.draw(screen, 12, Common::Point(216, 109)); + _iconSprites.draw(screen, 14, Common::Point(250, 109)); + } + + switch (mode) { + case ITEMMODE_CHAR_INFO: + _iconSprites.draw(screen, 9, Common::Point(148, 109)); + break; + case ITEMMODE_BLACKSMITH: + _iconSprites.draw(screen, 11, Common::Point(182, 109)); + break; + case ITEMMODE_9: + _iconSprites.draw(screen, 15, Common::Point(250, 109)); + break; + case ITEMMODE_10: + _iconSprites.draw(screen, 13, Common::Point(216, 109)); + break; + default: + break; + } + + for (int idx = 0; idx < 9; ++idx) { + _itemsDrawList[idx]._y = 10 + idx * 9; + + switch (typeNum) { + case 0: + if (c->_weapons[idx]._id) { + if (mode == ITEMMODE_CHAR_INFO || mode == ITEMMODE_8 + || mode == ITEMMODE_6 || mode == ITEMMODE_4) { + // TODO + } + } else if (_itemsDrawList[idx]._sprites == nullptr) { + // TODO + } + break; + // TODO + default: + break; + } + } + } + + return c; +} + +/** + * Load the buttons for the dialog + */ +void ItemsDialog::loadButtons(ItemsMode mode, Character *&c) { + _iconSprites.load(Common::String::format("%s.icn", + (mode == ITEMMODE_CHAR_INFO) ? "items" : "buy")); + _equipSprites.load("equip.icn"); + + if (mode == ITEMMODE_6 || mode == ITEMMODE_4 || mode == ITEMMODE_TO_GOLD) { + // Enchant button list + addButton(Common::Rect(12, 109, 36, 129), Common::KEYCODE_w, &_iconSprites); + addButton(Common::Rect(46, 109, 70, 129), Common::KEYCODE_a, &_iconSprites); + addButton(Common::Rect(80, 109, 104, 129), Common::KEYCODE_c, &_iconSprites); + addButton(Common::Rect(114, 109, 138, 129), Common::KEYCODE_n, &_iconSprites); + addButton(Common::Rect(148, 109, 172, 129), Common::KEYCODE_e, &_iconSprites); + addButton(Common::Rect(284, 109, 308, 129), Common::KEYCODE_ESCAPE, &_iconSprites); + addButton(Common::Rect(148, 109, 172, 129), Common::KEYCODE_u, &_iconSprites); + addButton(Common::Rect(8, 20, 263, 28), Common::KEYCODE_1, &_iconSprites, false); + addButton(Common::Rect(8, 29, 263, 37), Common::KEYCODE_2, &_iconSprites, false); + addButton(Common::Rect(8, 38, 263, 46), Common::KEYCODE_3, &_iconSprites, false); + addButton(Common::Rect(8, 47, 263, 55), Common::KEYCODE_4, &_iconSprites, false); + addButton(Common::Rect(8, 56, 263, 64), Common::KEYCODE_5, &_iconSprites, false); + addButton(Common::Rect(8, 65, 263, 73), Common::KEYCODE_6, &_iconSprites, false); + addButton(Common::Rect(8, 74, 263, 82), Common::KEYCODE_7, &_iconSprites, false); + addButton(Common::Rect(8, 83, 263, 91), Common::KEYCODE_8, &_iconSprites, false); + addButton(Common::Rect(8, 92, 263, 100), Common::KEYCODE_9, &_iconSprites, false); + } else { + addButton(Common::Rect(12, 109, 36, 129), Common::KEYCODE_w, &_iconSprites); + addButton(Common::Rect(46, 109, 70, 129), Common::KEYCODE_a, &_iconSprites); + addButton(Common::Rect(80, 109, 104, 129), Common::KEYCODE_c, &_iconSprites); + addButton(Common::Rect(114, 109, 138, 129), Common::KEYCODE_n, &_iconSprites); + addButton(Common::Rect(148, 109, 172, 129), Common::KEYCODE_e, &_iconSprites); + addButton(Common::Rect(182, 109, 206, 129), Common::KEYCODE_r, &_iconSprites); + addButton(Common::Rect(216, 109, 240, 129), Common::KEYCODE_d, &_iconSprites); + addButton(Common::Rect(250, 109, 274, 129), Common::KEYCODE_q, &_iconSprites); + addButton(Common::Rect(284, 109, 308, 129), Common::KEYCODE_ESCAPE, &_iconSprites); + addButton(Common::Rect(8, 20, 263, 28), Common::KEYCODE_1, &_iconSprites, false); + addButton(Common::Rect(8, 29, 263, 37), Common::KEYCODE_2, &_iconSprites, false); + addButton(Common::Rect(8, 38, 263, 46), Common::KEYCODE_3, &_iconSprites, false); + addButton(Common::Rect(8, 47, 263, 55), Common::KEYCODE_4, &_iconSprites, false); + addButton(Common::Rect(8, 56, 263, 64), Common::KEYCODE_5, &_iconSprites, false); + addButton(Common::Rect(8, 65, 263, 73), Common::KEYCODE_6, &_iconSprites, false); + addButton(Common::Rect(8, 74, 263, 82), Common::KEYCODE_7, &_iconSprites, false); + addButton(Common::Rect(8, 83, 263, 91), Common::KEYCODE_8, &_iconSprites, false); + addButton(Common::Rect(8, 92, 263, 100), Common::KEYCODE_9, &_iconSprites, false); + } + + if (mode == ITEMMODE_BLACKSMITH) { + _oldCharacter = c; + c = &_itemsCharacter; + blackData2CharData(); + + _buttons[4]._value = Common::KEYCODE_b; + _buttons[5]._value = Common::KEYCODE_s; + _buttons[6]._value = Common::KEYCODE_i; + _buttons[7]._value = Common::KEYCODE_f; + + setEquipmentIcons(); + } else { + _buttons[4]._value = Common::KEYCODE_e; + _buttons[5]._value = Common::KEYCODE_r; + _buttons[6]._value = Common::KEYCODE_d; + _buttons[7]._value = Common::KEYCODE_q; + } +} + +/** + * Loads the temporary _itemsCharacter character with the item set + * the given blacksmith has available, so the user can "view" the + * set as if it were a standard character's inventory + */ +void ItemsDialog::blackData2CharData() { + Party &party = *_vm->_party; + bool isDarkCc = _vm->_files->_isDarkCc; + int slotIndex = 0; + while (party._mazeId != (int)BLACKSMITH_MAP_IDS[isDarkCc][slotIndex] && slotIndex < 4) + ++slotIndex; + if (slotIndex == 4) + slotIndex = 0; + + for (int idx = 0; idx < INV_ITEMS_TOTAL; ++idx) { + _itemsCharacter._weapons[idx] = party._blacksmithWeapons[isDarkCc][idx]; + _itemsCharacter._armor[idx] = party._blacksmithArmor[isDarkCc][idx]; + _itemsCharacter._accessories[idx] = party._blacksmithAccessories[isDarkCc][idx]; + _itemsCharacter._misc[idx] = party._blacksmithMisc[isDarkCc][idx]; + } +} + +/** + * Sets the equipment icon to use for each item for display + */ +void ItemsDialog::setEquipmentIcons() { + for (int typeIndex = 0; typeIndex < 4; ++typeIndex) { + for (int idx = 0; idx < INV_ITEMS_TOTAL; ++idx) { + switch (typeIndex) { + case 0: { + XeenItem &i = _itemsCharacter._weapons[idx]; + if (i._id <= 17) + i._equipped = 1; + else if (i._id <= 29 || i._id > 33) + i._equipped = 13; + else + i._equipped = 4; + break; + } + + case 1: { + XeenItem &i = _itemsCharacter._armor[idx]; + if (i._id <= 7) + i._equipped = 3; + else if (i._id == 9) + i._equipped = 5; + else if (i._id == 10) + i._equipped = 9; + else if (i._id <= 12) + i._equipped = 10; + else + i._equipped = 6; + break; + } + + case 2: { + XeenItem &i = _itemsCharacter._accessories[idx]; + if (i._id == 1) + i._id = 8; + else if (i._id == 2) + i._equipped = 12; + else if (i._id <= 7) + i._equipped = 7; + else + i._equipped = 11; + break; + } + + default: + break; + } + } + } +} + +} // End of namespace Xeen diff --git a/engines/xeen/dialogs_items.h b/engines/xeen/dialogs_items.h new file mode 100644 index 0000000000..100ac5c8b7 --- /dev/null +++ b/engines/xeen/dialogs_items.h @@ -0,0 +1,63 @@ +/* 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_DIALOGS_ITEMS_H +#define XEEN_DIALOGS_ITEMS_H + +#include "xeen/dialogs.h" +#include "xeen/party.h" +#include "xeen/screen.h" + +namespace Xeen { + +enum ItemsMode { + ITEMMODE_CHAR_INFO = 0, ITEMMODE_BLACKSMITH = 1, ITEMMODE_4 = 4, + ITEMMODE_6 = 6, ITEMMODE_COMBAT = 7, ITEMMODE_8 = 8, + ITEMMODE_9 = 9, ITEMMODE_10 = 10, ITEMMODE_TO_GOLD = 11 +}; + +class ItemsDialog : public ButtonContainer { +private: + XeenEngine *_vm; + SpriteResource _iconSprites; + SpriteResource _equipSprites; + Character _itemsCharacter; + Character *_oldCharacter; + DrawStruct _itemsDrawList[9]; + + ItemsDialog(XeenEngine *vm) : ButtonContainer(), + _vm(vm), _oldCharacter(nullptr) {} + + Character *execute(Character *c, ItemsMode mode); + + void loadButtons(ItemsMode mode, Character *&c); + + void blackData2CharData(); + + void setEquipmentIcons(); +public: + static Character *show(XeenEngine *vm, Character *c, ItemsMode mode); +}; + +} // End of namespace Xeen + +#endif /* XEEN_DIALOGS_ITEMS_H */ diff --git a/engines/xeen/dialogs_quick_ref.cpp b/engines/xeen/dialogs_quick_ref.cpp index a54bb06025..6c8da5ef86 100644 --- a/engines/xeen/dialogs_quick_ref.cpp +++ b/engines/xeen/dialogs_quick_ref.cpp @@ -35,7 +35,6 @@ void QuickReferenceDialog::show(XeenEngine *vm) { void QuickReferenceDialog::execute() { Combat &combat = *_vm->_combat; EventsManager &events = *_vm->_events; - Interface &intf = *_vm->_interface; Party &party = *_vm->_party; Screen &screen = *_vm->_screen; Common::String lines[8]; diff --git a/engines/xeen/items.cpp b/engines/xeen/items.cpp index c55a227502..fd06af1024 100644 --- a/engines/xeen/items.cpp +++ b/engines/xeen/items.cpp @@ -26,13 +26,13 @@ namespace Xeen { XeenItem::XeenItem() { - _material = _name = _bonusFlags = 0; - _equipped = false; + _material = _id = _bonusFlags = 0; + _equipped = 0; } void XeenItem::synchronize(Common::Serializer &s) { s.syncAsByte(_material); - s.syncAsByte(_name); + s.syncAsByte(_id); s.syncAsByte(_bonusFlags); s.syncAsByte(_equipped); } diff --git a/engines/xeen/items.h b/engines/xeen/items.h index 8e8f172790..154fd21888 100644 --- a/engines/xeen/items.h +++ b/engines/xeen/items.h @@ -35,9 +35,9 @@ enum BonusFlags { FLAG_CURSED = 0x40 }; class XeenItem { public: int _material; - uint _name; + uint _id; int _bonusFlags; - bool _equipped; + int _equipped; public: XeenItem(); diff --git a/engines/xeen/module.mk b/engines/xeen/module.mk index eef8d78455..c1cdd055b8 100644 --- a/engines/xeen/module.mk +++ b/engines/xeen/module.mk @@ -17,6 +17,7 @@ MODULE_OBJS := \ dialogs_options.o \ dialogs_info.o \ dialogs_input.o \ + dialogs_items.o \ dialogs_quick_ref.o \ dialogs_spells.o \ dialogs_whowill.o \ diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index ce5ccd0bc1..03535066e1 100644 --- a/engines/xeen/party.cpp +++ b/engines/xeen/party.cpp @@ -487,7 +487,7 @@ int Character::itemScan(int itemId) const { } if (itemId == 9) { - result += ARMOR_STRENGTHS[item._name]; + result += ARMOR_STRENGTHS[item._id]; if (item._material >= 37 && item._material <= 58) result += METAL_LAC[item._material - 37]; @@ -959,13 +959,13 @@ void Party::synchronize(Common::Serializer &s) { s.syncAsByte(_difficulty); for (int i = 0; i < ITEMS_COUNT; ++i) - _blacksmithWeapons[i].synchronize(s); + _blacksmithWeapons[0][i].synchronize(s); for (int i = 0; i < ITEMS_COUNT; ++i) - _blacksmithArmor[i].synchronize(s); + _blacksmithArmor[0][i].synchronize(s); for (int i = 0; i < ITEMS_COUNT; ++i) - _blacksmithAccessories[i].synchronize(s); + _blacksmithAccessories[0][i].synchronize(s); for (int i = 0; i < ITEMS_COUNT; ++i) - _blacksmithMisc[i].synchronize(s); + _blacksmithMisc[0][i].synchronize(s); s.syncAsUint16LE(_cloudsEnd); s.syncAsUint16LE(_darkSideEnd); @@ -998,13 +998,13 @@ void Party::synchronize(Common::Serializer &s) { s.syncAsByte(_questItems[i]); for (int i = 0; i < ITEMS_COUNT; ++i) - _blacksmithWeapons2[i].synchronize(s); + _blacksmithWeapons[1][i].synchronize(s); for (int i = 0; i < ITEMS_COUNT; ++i) - _blacksmithArmor2[i].synchronize(s); + _blacksmithArmor[1][i].synchronize(s); for (int i = 0; i < ITEMS_COUNT; ++i) - _blacksmithAccessories2[i].synchronize(s); + _blacksmithAccessories[1][i].synchronize(s); for (int i = 0; i < ITEMS_COUNT; ++i) - _blacksmithMisc2[i].synchronize(s); + _blacksmithMisc[1][i].synchronize(s); for (int i = 0; i < TOTAL_CHARACTERS; ++i) SavesManager::syncBitFlags(s, &_characterFlags[i][0], &_characterFlags[i][24]); diff --git a/engines/xeen/party.h b/engines/xeen/party.h index 65e6608d71..8285ddfecf 100644 --- a/engines/xeen/party.h +++ b/engines/xeen/party.h @@ -214,10 +214,10 @@ public: int _holyBonus; int _heroism; Difficulty _difficulty; - XeenItem _blacksmithWeapons[ITEMS_COUNT]; - XeenItem _blacksmithArmor[ITEMS_COUNT]; - XeenItem _blacksmithAccessories[ITEMS_COUNT]; - XeenItem _blacksmithMisc[ITEMS_COUNT]; + XeenItem _blacksmithWeapons[2][ITEMS_COUNT]; + XeenItem _blacksmithArmor[2][ITEMS_COUNT]; + XeenItem _blacksmithAccessories[2][ITEMS_COUNT]; + XeenItem _blacksmithMisc[2][ITEMS_COUNT]; bool _cloudsEnd; bool _darkSideEnd; bool _worldEnd; @@ -245,10 +245,6 @@ public: bool _worldFlags[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: // Other party related runtime data diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp index eecc5b8027..d89d2e6e25 100644 --- a/engines/xeen/resources.cpp +++ b/engines/xeen/resources.cpp @@ -984,4 +984,29 @@ const char *const QUICK_REFERENCE = "\xB""110\x9""064\x3""cGold\x9""144Gems\x9""224Food\xB""119" "\x9""064\xC""15%lu\x9""144%lu\x9""224%u day%s\xC""d"; +const uint BLACKSMITH_MAP_IDS[2][4] = { { 28, 30, 73, 49 }, { 29, 31, 37, 43 } }; + +char *const ITEMS_DIALOG_TEXT1 = + "\r\x2\x3""c\v021\t017\f37W\fdeap\t051\f37A\fdrmor\t085A" + "\f37c\fdces\t119\f37M\fdisc\t153%s\t187%s\t221%s" + "\t255%s\t289Exit"; + +char *const ITEMS_DIALOG_TEXT2 = + "\r\x2\x3""c\v021\t017\f37W\fdeap\t051\f37A\fdrmor\t085A" + "\f37c\fdces\t119\f37M\fdisc\t153\f37%s\t289Exit"; + +const char *const BTN_BUY = "\f37B\fduy"; +const char *const BTN_SELL = "\f37S\fdell"; +const char *const BTN_IDENTIFY = "\f37I\fddentify"; +const char *const BTN_FIX = "\f37F\fdix"; +const char *const BTN_USE = "\f37U\fdse"; +const char *const BTN_EQUIP = "\f37E\fdquip"; +const char *const BTN_REMOVE = "\f37R\fdem"; +const char *const BTN_DISCARD = "\f37D\fdisc"; +const char *const BTN_QUEST = "\f37Q\fduest"; +const char *const BTN_ENCHANT = "E\fdnchant"; +const char *const BTN_RECHARGE = "R\fdechrg"; +const char *const BTN_GOLD = "G\fdold"; + + } // End of namespace Xeen diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h index e8f5c31867..5437d40641 100644 --- a/engines/xeen/resources.h +++ b/engines/xeen/resources.h @@ -327,6 +327,25 @@ extern const char *const QUICK_REF_LINE; extern const char *const QUICK_REFERENCE; +extern const uint BLACKSMITH_MAP_IDS[2][4]; + +extern char *const ITEMS_DIALOG_TEXT1; +extern char *const ITEMS_DIALOG_TEXT2; + +extern const char *const BTN_BUY; +extern const char *const BTN_SELL; +extern const char *const BTN_IDENTIFY; +extern const char *const BTN_FIX; +extern const char *const BTN_USE; +extern const char *const BTN_EQUIP; +extern const char *const BTN_REMOVE; +extern const char *const BTN_DISCARD; +extern const char *const BTN_EQUIP; +extern const char *const BTN_QUEST; +extern const char *const BTN_ENCHANT; +extern const char *const BTN_RECHARGE; +extern const char *const BTN_GOLD; + } // End of namespace Xeen #endif /* XEEN_RESOURCES_H */ diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index 3ba6329b70..12fe2f1257 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -623,8 +623,8 @@ void Scripts::cmdConfirmWord(Common::Array<byte> ¶ms) { if (result == 59 && !_vm->_files->_isDarkCc) { for (int idx = 0; idx < TOTAL_ITEMS; ++idx) { XeenItem &item = _vm->_treasure._weapons[idx]; - if (!item._name) { - item._name = 34; + if (!item._id) { + item._id = 34; item._material = 0; item._bonusFlags = 0; _vm->_treasure._hasItems = true; @@ -1007,22 +1007,22 @@ bool Scripts::ifProc(int action, uint32 mask, int mode, int charIndex) { if (mask < 82) { for (int idx = 0; idx < 9; ++idx) { if (mask == 35) { - if (ps._weapons[idx]._name == mask) { + if (ps._weapons[idx]._id == mask) { v = mask; break; } } else if (mask < 49) { - if (ps._armor[idx]._name == (mask - 35)) { + if (ps._armor[idx]._id == (mask - 35)) { v = mask; break; } } else if (mask < 60) { - if (ps._accessories[idx]._name == (mask - 49)) { + if (ps._accessories[idx]._id == (mask - 49)) { v = mask; break; } } else { - if (ps._misc[idx]._name == (mask - 60)) { + if (ps._misc[idx]._id == (mask - 60)) { v = mask; break; } diff --git a/engines/xeen/town.cpp b/engines/xeen/town.cpp index 3449c2e3c3..c5cf0b6a10 100644 --- a/engines/xeen/town.cpp +++ b/engines/xeen/town.cpp @@ -22,6 +22,7 @@ #include "xeen/town.h" #include "xeen/dialogs_input.h" +#include "xeen/dialogs_items.h" #include "xeen/dialogs_yesno.h" #include "xeen/dialogs_spells.h" #include "xeen/resources.h" @@ -536,8 +537,8 @@ Character *Town::doBlacksmithOptions(Character *c) { intf.highlightChar(_buttonValue); } } - else if (_buttonValue == Common::KEYCODE_c) { - c = showItems(c, 1); + else if (_buttonValue == Common::KEYCODE_b) { + c = ItemsDialog::show(_vm, c, ITEMMODE_BLACKSMITH); _buttonValue = 0; } @@ -1190,8 +1191,4 @@ bool Town::isActive() const { return _townSprites.size() > 0 && !_townSprites[0].empty(); } -Character *Town::showItems(Character *c, int v2) { - error("TODO: showItems"); -} - } // End of namespace Xeen diff --git a/engines/xeen/town.h b/engines/xeen/town.h index de87f03b23..8f6ef15710 100644 --- a/engines/xeen/town.h +++ b/engines/xeen/town.h @@ -95,8 +95,6 @@ private: Character *doTrainingOptions(Character *c); void depositWithdrawl(int choice); - - Character *showItems(Character *c, int v2); public: Town(XeenEngine *vm); |