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/scene/room_support.h"
32
33namespace Graphics {
34class Screen;
35}
36
37namespace Harvester {
38
39class HarvesterEngine;
40struct 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
55public:
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 const IndexedBitmap *getSelectedItemBitmap() const;
67 Common::String resolveSelectedLabel() const;
68 Common::String buildSelectedPrompt(const Common::String &targetLabel,
69 const MenuTextConfig &menuTextConfig) const;
70 void selectItem(const Common::String &objectName);
71 bool toggleCombatLoadout(const ObjectRecord &object, int currentLoadout, bool &changed);
72 bool resolveSecondaryAction(const ObjectRecord &object, InventorySecondaryAction &action) const;
73 void setPromptText(const Common::String &promptText);
74 const Common::String &getPromptText() const;
75 Common::String resolveWeekdayLabel(const MenuTextConfig &menuTextConfig) const;
76 const InventoryVisual *findItemAtPoint(const Common::Point &point) const;
77 Common::Rect getPanelBounds() const;
78 void drawOverlay(Graphics::Screen &screen) const;
79 void drawSelectedDragItem(Graphics::Screen &screen, const Common::Point &point) const;
80
81 static bool isExitObject(const ObjectRecord &object);
82 static bool isStatusObject(const ObjectRecord &object);
83
84private:
85 bool loadBitmap(const Common::String &path, IndexedBitmap &bitmap);
86
90 bool _open = false;
91 int _lastPlayerHitPoints = -1;
92 int _lastStoryDayIndex = -1;
93 bool _lastHasHarvestBlade = false;
94 Common::String _selectedItemName;
95 Common::String _promptText;
96 HarvesterEngine &_engine;
97};
98
99} // End of namespace Harvester
100
101#endif // HARVESTER_INVENTORY_H
Definition: array.h:52
Definition: hashmap.h:85
Definition: str.h:59
Definition: screen.h:47
Definition: harvester.h:47
Definition: inventory.h:54
Definition: formatinfo.h:28
Definition: hash-str.h:45
Definition: hash-str.h:49
Definition: rect.h:144
Definition: rect.h:536
Definition: bitmap.h:33
Definition: inventory.h:49
Definition: inventory.h:42
Definition: menu.h:45
Definition: script.h:86
Definition: atari-screen.h:58