ScummVM API documentation
character_inventory.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 MM1_VIEWS_ENH_CHARACTER_INVENTORY_H
23 #define MM1_VIEWS_ENH_CHARACTER_INVENTORY_H
24 
25 #include "mm/mm1/views_enh/items_view.h"
26 #include "mm/mm1/data/character.h"
27 #include "mm/mm1/game/equip_remove.h"
28 #include "mm/mm1/game/use_item.h"
29 
30 namespace MM {
31 namespace MM1 {
32 namespace ViewsEnh {
33 
35  public Game::UseItem {
36 protected:
37  enum SelectedButton {
38  BTN_NONE, BTN_EQUIP, BTN_REMOVE, BTN_DISCARD, BTN_USE, BTN_CHARGE, BTN_COPY
39  };
40  enum DisplayMode {
41  ARMS_MODE, BACKPACK_MODE
42  };
43  SelectedButton _selectedButton = BTN_NONE;
44  DisplayMode _mode = ARMS_MODE;
45 
46 private:
47  Common::String _tradeMode;
48  int _tradeAmount;
49 
53  void populateItems();
54 
58  void drawTitle();
59 
63  void equipItem();
64 
68  void removeItem();
69 
73  void discardItem();
74 
78  void useItem();
79 
83  void tradeItem(Character *from);
84 
88  void trade(const Common::String &mode, int amount, Character *destChar);
89 
90 protected:
94  bool canSwitchChar() override;
95 
99  bool canSwitchToChar(Character *dst) override;
100 
104  void itemSelected() override;
105 
109  void charSwitched(Character *priorChar) override;
110 
114  virtual void performAction();
115 
119  void selectButton(SelectedButton btnMode);
120 
121 public:
123  CharacterInventory(const Common::String &name);
124  virtual ~CharacterInventory() {}
125  void setup();
126 
127  bool msgFocus(const FocusMessage &msg) override;
128  bool msgGame(const GameMessage &msg) override;
129  void draw() override;
130  bool msgKeypress(const KeypressMessage &msg) override;
131  bool msgAction(const ActionMessage &msg) override;
132 };
133 
134 } // namespace ViewsEnh
135 } // namespace MM1
136 } // namespace MM
137 
138 #endif
Definition: str.h:59
bool canSwitchToChar(Character *dst) override
Definition: messages.h:56
Definition: character_inventory.h:34
Definition: messages.h:49
Definition: detection.h:27
void charSwitched(Character *priorChar) override
Definition: character.h:432
void selectButton(SelectedButton btnMode)
Definition: messages.h:87
Definition: items_view.h:31
Definition: use_item.h:32
Definition: equip_remove.h:31
Definition: messages.h:41