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 TETRAEDGE_GAME_INVENTORY_H
23 #define TETRAEDGE_GAME_INVENTORY_H
24 
25 #include "common/str.h"
26 #include "tetraedge/game/inventory_object.h"
27 #include "tetraedge/te/te_layout.h"
28 #include "tetraedge/te/te_lua_gui.h"
29 
30 namespace Tetraedge {
31 
32 class Cellphone;
33 
34 class Inventory : public TeLayout {
35 public:
37  Common::String _id;
38  Common::String _name;
39  bool _isDocument;
40  };
41 
42  Inventory();
43  virtual ~Inventory();
44 
45  void enter();
46  void leave();
47  void load();
48  void unload();
49  void loadCellphone();
50 
51  //void loadFromBackup(TiXmlNode *node);
52  //void saveToBackup(TiXmlNode *node);
53 
54  void addObject(const Common::String &objname);
55  bool addObject(InventoryObject *obj);
56  bool isDocument(const Common::String &objname);
57 
58  int objectCount(const Common::String &objname);
59  Common::String objectDescription(const Common::String &objname);
60  Common::String objectName(const Common::String &objname);
61 
62  void pauseAnims();
63  void unPauseAnims();
64 
65  void removeObject(const Common::String &objname);
66  void removeSelectedObject();
67 
68  InventoryObject *selectedInventoryObject();
69  void selectedObject(const Common::String &objname);
70  void selectedObject(InventoryObject *obj);
71  const Common::String &selectedObject();
72 
73  bool updateLayout();
74 
75  Common::Error syncState(Common::Serializer &s);
76  Common::Error syncStateWithCount(Common::Serializer &s, uint nitems);
77 
78  Cellphone *cellphone() { return _cellphone; }
79 
80 private:
81  // Amerzone navigation events
82  void currentPage(uint page);
83  bool onPreviousPage();
84  bool onNextPage();
85 
86  // Syberia navigation events
87  bool onMainMenuButton();
88  bool onObjectSelected(InventoryObject &obj);
89  bool onQuitButton();
90  bool onTakeObjectSelected();
91  bool onVisibleCellphone();
92  bool onZoomed();
93 
94  void loadXMLFile(const Common::Path &path);
95 
96  TeLuaGUI _gui;
98  Cellphone *_cellphone;
99  InventoryObject *_selectedObject;
101 
102  // This is used when we need a reference to a blank str in selectedObject()
103  const Common::String _blankStr;
104 
105  uint _currentPage;
106 
107  TeTimer _selectedTimer;
108 };
109 
110 } // end namespace Tetraedge
111 
112 #endif // TETRAEDGE_GAME_INVENTORY_H
Definition: str.h:59
Definition: detection.h:27
Definition: error.h:84
Definition: te_lua_gui.h:51
Definition: list.h:44
Definition: path.h:52
Definition: inventory.h:34
Definition: serializer.h:79
Definition: inventory_object.h:31
Definition: te_timer.h:33
Definition: hashmap.h:85
Definition: te_layout.h:35
Definition: cellphone.h:36