ScummVM API documentation
dialogs_items.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef XEEN_DIALOGS_ITEMS_H
23 #define XEEN_DIALOGS_ITEMS_H
24 
25 #include "mm/xeen/dialogs/dialogs.h"
26 #include "mm/xeen/party.h"
27 #include "mm/xeen/window.h"
28 
29 namespace MM {
30 namespace Xeen {
31 
32 enum ItemsMode {
33  ITEMMODE_CHAR_INFO = 0, ITEMMODE_BUY = 1, ITEMMODE_SELL = 2, ITEMMODE_3 = 3,
34  ITEMMODE_RECHARGE = 4, ITEMMODE_5 = 5, ITEMMODE_ENCHANT = 6, ITEMMODE_COMBAT = 7, ITEMMODE_8 = 8,
35  ITEMMODE_REPAIR = 9, ITEMMODE_IDENTIFY = 10, ITEMMODE_TO_GOLD = 11,
36  ITEMMODE_INVALID = -1
37 };
38 
39 class ItemsDialog : public ButtonContainer {
40 private:
41  SpriteResource _iconSprites;
42  SpriteResource _equipSprites;
43  Character _itemsCharacter;
44  Character *_oldCharacter;
45  DrawStruct _itemsDrawList[INV_ITEMS_TOTAL];
46 
47  ItemsDialog(XeenEngine *vm) : ButtonContainer(vm), _oldCharacter(nullptr) {}
48 
49  Character *execute(Character *c, ItemsMode mode);
50 
54  void loadButtons(ItemsMode mode, Character *&c, ItemCategory category);
55 
59  void setEquipmentIcons();
60 
64  int calcItemCost(Character *c, int itemIndex, ItemsMode mode, int skillLevel,
65  ItemCategory category);
66 
70  const char *getGoldPlurals(int val);
71 
72  int doItemOptions(Character &c, int actionIndex, int itemIndex,
73  ItemCategory category, ItemsMode mode);
74 
75  void itemToGold(Character &c, int itemIndex, ItemCategory category, ItemsMode mode);
76 public:
77  static Character *show(XeenEngine *vm, Character *c, ItemsMode mode);
78 };
79 
81 private:
82  SpriteResource _icons;
83  int _actionIndex;
84  InventoryItems &_items;
85 
86  ItemSelectionDialog(XeenEngine *vm, int actionIndex, InventoryItems &items) : ButtonContainer(vm),
87  _actionIndex(actionIndex), _items(items) {
88  loadButtons();
89  }
90 
95  int execute();
96 
100  void loadButtons();
101 public:
108  static int show(int actionIndex, InventoryItems &items);
109 };
110 
111 
112 } // End of namespace Xeen
113 } // End of namespace MM
114 
115 #endif
Definition: dialogs_items.h:80
Definition: sprites.h:52
Definition: item.h:175
Definition: dialogs_items.h:39
Definition: xeen.h:93
Definition: window.h:38
Definition: character.h:106
Definition: detection.h:27
Definition: dialogs.h:74