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 protected:
77  bool canHaveHotspot() const override { return true; }
78  Common::String getRecordTypeName() const override { return "ShowInventoryItem"; }
79  bool isViewportRelative() const override { return true; }
80 };
81 
82 // When clicking an ActionRecord hotspot with a kItem dependency, the engine
83 // checks if the required item is currently being held; when it isn't, it plays
84 // a specific sound to inform the player they need some item. This AR changes that
85 // sound and its related caption (or stops it from playing entirely).
87 public:
88  void readData(Common::SeekableReadStream &stream) override;
89  void execute() override;
90 
91  byte _command = 0;
92  uint16 _itemID = 0;
93  SoundDescription _sound;
94  Common::String _caption;
95 
96 protected:
97  Common::String getRecordTypeName() const override { return "InventorySoundOverride"; }
98 };
99 
100 // Temporarily disable (or re-enable) clicking on a specific item in the inventory box
102 public:
103  void readData(Common::SeekableReadStream &stream) override;
104  void execute() override;
105 
106  uint16 _itemID = 0;
107  byte _disabledState = 0;
108 
109 protected:
110  Common::String getRecordTypeName() const override { return "EnableDisableInventory"; }
111 };
112 
113 // Pops the scene and item that get pushed when a player clicks a kInvItemNewSceneView item
115 public:
116  void readData(Common::SeekableReadStream &stream) override;
117  void execute() override;
118 
119 protected:
120  Common::String getRecordTypeName() const override { return "PopInvViewPriorScene"; }
121 };
122 
123 class GoInvViewScene : public ActionRecord {
124 public:
125  void readData(Common::SeekableReadStream &stream) override;
126  void execute() override;
127 
128 protected:
129  Common::String getRecordTypeName() const override { return "GoInvViewScene"; }
130 
131  uint16 _itemID = 0;
132  bool _addToInventory = false;
133 };
134 
135 } // End of namespace Action
136 } // End of namespace Nancy
137 
138 #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:114
Definition: actionrecord.h:149
Definition: inventoryrecords.h:101
Definition: actionrecord.h:97
Definition: commontypes.h:254
Definition: inventoryrecords.h:86
Definition: inventoryrecords.h:59
Definition: inventoryrecords.h:123
Definition: inventoryrecords.h:45
Definition: actionmanager.h:32