ScummVM API documentation
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 PINK_INVENTORY_H
23 #define PINK_INVENTORY_H
24 
25 #include "common/rect.h"
26 
27 #include "pink/utils.h"
28 
29 namespace Pink {
30 
31 class InventoryItem : public NamedObject {
32 public:
33  void deserialize(Archive &archive) override;
34 
35  void toConsole() const override;
36 
37  const Common::String &getCurrentOwner() const { return _currentOwner; }
38 
39  friend class InventoryMgr;
40 private:
41  Common::String _initialOwner;
42  Common::String _currentOwner;
43 };
44 
45 class LeadActor;
46 class Actor;
47 
48 class InventoryMgr : public Object {
49 public:
50  InventoryMgr();
51  ~InventoryMgr() override;
52  void deserialize(Archive &archive) override;
53  void toConsole() const override;
54 
55  void loadState(Archive &archive);
56  void saveState(Archive &archive);
57 
58  void update();
59  void onClick(Common::Point point);
60 
61  bool start(bool paused);
62 
63  void setLeadActor(LeadActor *lead) { _lead = lead; }
64  InventoryItem *findInventoryItem(const Common::String &name);
65 
66  bool isPinkOwnsAnyItems();
67  void setItemOwner(const Common::String &owner, InventoryItem *item);
68 
69  InventoryItem *getCurrentItem() { return _currentItem; }
70 
71  friend class Console;
72 
73 private:
74  void close();
75  enum Direction {
76  kLeft = 0,
77  kRight = 1
78  };
79  void showNextItem(bool direction);
80 
81  LeadActor *_lead;
82  Actor *_window;
83  Actor *_itemActor;
84  Actor *_rightArrow;
85  Actor *_leftArrow;
86 
87  InventoryItem *_currentItem;
89 
90  enum State {
91  kIdle = 0,
92  kOpening = 1,
93  kReady = 2,
94  kClosing = 3
95  } _state;
96  bool _isClickedOnItem;
97 };
98 
99 } // End of namespace Pink
100 
101 #endif
Definition: archive.h:39
Definition: str.h:59
Definition: inventory.h:48
Definition: console.h:31
Definition: object.h:40
Definition: object.h:31
Definition: archive.h:35
Definition: lead_actor.h:41
Definition: rect.h:45
Definition: actor.h:39
Definition: utils.h:30
Definition: inventory.h:31