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