ScummVM API documentation
inventoryrecords.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 NANCY_ACTION_INVENTORYRECORDS_H
23 #define NANCY_ACTION_INVENTORYRECORDS_H
24 
25 #include "engines/nancy/action/actionrecord.h"
26 
27 namespace Nancy {
28 namespace Action {
29 
30 // Simply adds an item to the player's inventory.
32 public:
33  void readData(Common::SeekableReadStream &stream) override;
34  void execute() override;
35 
36  uint16 _itemID = 0;
37  bool _setCursor = false;
38  bool _forceCursor = false;
39 
40 protected:
41  Common::String getRecordTypeName() const override { return "AddInventoryNoHS"; }
42 };
43 
44 // Simply removes an item from the player's inventory.
46 public:
47  void readData(Common::SeekableReadStream &stream) override;
48  void execute() override;
49 
50  uint _itemID;
51 
52 protected:
53  Common::String getRecordTypeName() const override { return "RemoveInventoryNoHS"; }
54 };
55 
56 // Displays a static image inside the viewport. The static image corresponds to an
57 // inventory item, and is only displayed if the item is not in the player's possession.
58 // On click, it hides the image and adds the item to the inventory.
60 public:
61  void readData(Common::SeekableReadStream &stream) override;
62  void execute() override;
63 
65  virtual ~ShowInventoryItem() { _fullSurface.free(); }
66 
67  void init() override;
68 
69  uint16 _objectID = 0;
70  Common::Path _imageName;
71  Common::Array<FrameBlitDescription> _blitDescriptions;
72 
73  int16 _drawnFrameID = -1;
74  Graphics::ManagedSurface _fullSurface;
75 
76  bool canHaveHotspot() const override { return true; }
77  bool isViewportRelative() const override { return true; }
78 
79 protected:
80  Common::String getRecordTypeName() const override { return "ShowInventoryItem"; }
81 };
82 
83 // When clicking an ActionRecord hotspot with a kItem dependency, the engine
84 // checks if the required item is currently being held; when it isn't, it plays
85 // a specific sound to inform the player they need some item. This AR changes that
86 // sound and its related caption (or stops it from playing entirely).
88 public:
89  void readData(Common::SeekableReadStream &stream) override;
90  void execute() override;
91 
92  byte _command = 0;
93  uint16 _itemID = 0;
94  SoundDescription _sound;
95  Common::String _caption;
96 
97 protected:
98  Common::String getRecordTypeName() const override { return "InventorySoundOverride"; }
99 };
100 
101 // Temporarily disable (or re-enable) clicking on a specific item in the inventory box
103 public:
104  void readData(Common::SeekableReadStream &stream) override;
105  void execute() override;
106 
107  uint16 _itemID = 0;
108  byte _disabledState = 0;
109 
110 protected:
111  Common::String getRecordTypeName() const override { return "EnableDisableInventory"; }
112 };
113 
114 // Pops the scene and item that get pushed when a player clicks a kInvItemNewSceneView item
116 public:
117  void readData(Common::SeekableReadStream &stream) override;
118  void execute() override;
119 
120 protected:
121  Common::String getRecordTypeName() const override { return "PopInvViewPriorScene"; }
122 };
123 
124 class GoInvViewScene : public ActionRecord {
125 public:
126  void readData(Common::SeekableReadStream &stream) override;
127  void execute() override;
128 
129 protected:
130  Common::String getRecordTypeName() const override { return "GoInvViewScene"; }
131 
132  uint16 _itemID = 0;
133  bool _addToInventory = false;
134 };
135 
136 } // End of namespace Action
137 } // End of namespace Nancy
138 
139 #endif // NANCY_ACTION_INVENTORYRECORDS_H
Definition: managed_surface.h:51
Definition: str.h:59
Definition: array.h:52
Definition: inventoryrecords.h:31
Definition: path.h:52
Definition: stream.h:745
Definition: inventoryrecords.h:115
Definition: actionrecord.h:152
Definition: inventoryrecords.h:102
Definition: actionrecord.h:97
Definition: commontypes.h:255
Definition: inventoryrecords.h:87
Definition: inventoryrecords.h:59
Definition: inventoryrecords.h:124
Definition: inventoryrecords.h:45
Definition: actionmanager.h:32