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 HARVESTER_INVENTORY_H
23 #define HARVESTER_INVENTORY_H
24 
25 #include "common/array.h"
26 #include "common/hash-str.h"
27 #include "common/hashmap.h"
28 #include "common/rect.h"
29 #include "common/str.h"
30 #include "harvester/art.h"
31 #include "harvester/room_support.h"
32 
33 namespace Graphics {
34 class Screen;
35 }
36 
37 namespace Harvester {
38 
39 class HarvesterEngine;
40 
42  ObjectRecord object;
43  IndexedBitmap bitmap;
44  Common::Rect bounds;
45  bool hasBitmap = false;
46 };
47 
49  Common::String actionTag;
50  bool closeInventory = false;
51 };
52 
54 public:
55  explicit InventorySystem(HarvesterEngine &engine);
56 
57  bool refresh();
58  bool open();
59  bool close();
60  bool clearSelection();
61  bool refreshIfRuntimeStateChanged();
62  bool isOpen() const;
63  bool hasSelection() const;
64  const Common::String &getSelectedItemName() const;
65  Common::String resolveSelectedLabel() const;
66  Common::String buildSelectedPrompt(const Common::String &targetLabel) const;
67  void selectItem(const Common::String &objectName);
68  bool toggleCombatLoadout(const ObjectRecord &object, int currentLoadout, bool &changed);
69  bool resolveSecondaryAction(const ObjectRecord &object, InventorySecondaryAction &action) const;
70  void setPromptText(const Common::String &promptText);
71  const Common::String &getPromptText() const;
72  Common::String resolveWeekdayLabel() const;
73  const InventoryVisual *findItemAtPoint(const Common::Point &point) const;
74  Common::Rect getPanelBounds() const;
75  void drawOverlay(Graphics::Screen &screen) const;
76  void drawSelectedDragItem(Graphics::Screen &screen, const Common::Point &point) const;
77 
78  static bool isExitObject(const ObjectRecord &object);
79  static bool isStatusObject(const ObjectRecord &object);
80 
81 private:
82  bool loadBitmap(const Common::String &path, IndexedBitmap &bitmap);
83 
87  bool _open = false;
88  int _lastPlayerHitPoints = -1;
89  int _lastStoryDayIndex = -1;
90  bool _lastHasHarvestBlade = false;
91  Common::String _selectedItemName;
92  Common::String _promptText;
93  HarvesterEngine &_engine;
94 };
95 
96 } // End of namespace Harvester
97 
98 #endif // HARVESTER_INVENTORY_H
Definition: inventory.h:41
Definition: str.h:59
Definition: art.h:31
Definition: art.h:35
Definition: array.h:52
Definition: rect.h:536
Definition: script.h:86
Definition: atari-screen.h:58
Definition: screen.h:47
Definition: inventory.h:53
Definition: hashmap.h:85
Definition: formatinfo.h:28
Definition: rect.h:144
Definition: harvester.h:47
Definition: inventory.h:48
Definition: hash-str.h:49
Definition: hash-str.h:45