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