ScummVM API documentation
inv_objects.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 TINSEL_INV_OBJECT_H
23#define TINSEL_INV_OBJECT_H
24
25#include "common/memstream.h"
26#include "tinsel/tinsel.h"
27#include "tinsel/dw.h"
28
29namespace Tinsel {
30
31// attribute values - not a bit bit field to prevent portability problems
32enum class InvObjAttr {
33 IO_ONLYINV1 = 0x01,
34 IO_ONLYINV2 = 0x02,
35 IO_DROPCODE = 0x04,
36 DEFINV1 = 0x08,
37 DEFINV2 = 0x10,
38 PERMACONV = 0x20,
39 CONVENDITEM = 0x40,
40
41 // Noir only
42 V3ATTR_X80 = 0x80,
43 NOTEBOOK_CLUE = 0x200,
44 V3ATTR_X400 = 0x400,
45 NOTEBOOK_TITLE = 0x800, // is a notebook title
46 V3ATTR_X1000 = 0x1000,
47 V3ATTR_X2000 = 0x2000,
48};
49
51public:
53 int32 getId() const { return _id; }
54 SCNHANDLE getIconFilm() const { return _hIconFilm; };
55 void setIconFilm(SCNHANDLE hIconFilm) { _hIconFilm = hIconFilm; }
56 SCNHANDLE getScript() const { return _hScript; }
57 // Tinsel1+
58 bool hasAttribute(InvObjAttr attribute) const {
59 return getAttribute() & (int32)attribute;
60 }
61
62 // Data size consumed by constructor
63 static int SIZE() {
64 return (TinselVersion == 0 ? T0_SIZE : T1_SIZE);
65 }
66protected:
67 static const int T0_SIZE = 3 * 4;
68 static const int T1_SIZE = T0_SIZE + 4; // Versions above 0 have attributes
69 // Tinsel 1+
70 int32 getAttribute() const {
71 return _attribute;
72 };
73private:
74 int32 _id; // inventory objects id
75 SCNHANDLE _hIconFilm; // inventory objects animation film
76 SCNHANDLE _hScript; // inventory objects event handling script
77 int32 _attribute = 0;
78};
79
81public:
83 _unknown = stream.readUint32();
84 _title = stream.readUint32();
85 }
86 // Noir:
87 bool isNotebookTitle() const {
88 return (getAttribute() & (int)InvObjAttr::NOTEBOOK_TITLE) != 0;
89 }
90 int32 getUnknown() const {
91 return _unknown;
92 }
93 int32 getTitle() const {
94 return _title;
95 }
96 // Data size consumed by constructor
97 static int SIZE() {
98 return InventoryObject::SIZE() + 8;
99 }
100private:
101 int32 _unknown;
102 int32 _title;
103};
104
106public:
107 virtual ~InventoryObjects() {};
108 virtual const InventoryObject *GetInvObject(int id) = 0;
109 virtual const InventoryObjectT3 *GetInvObjectT3(int id) = 0;
110 virtual const InventoryObject *GetObjectByIndex(int index) const = 0;
111 virtual void SetObjectFilm(int id, SCNHANDLE hFilm) = 0;
112 virtual int GetObjectIndexIfExists(int id) const = 0;
113 virtual int numObjects() const = 0;
114};
115
116InventoryObjects *InstantiateInventoryObjects(const byte *invObjects, int numObjects);
117
118} // End of namespace Tinsel
119
120#endif // TINSEL_INV_OBJECT_H
Definition: memstream.h:103
uint32 readUint32()
Definition: stream.h:883
Definition: inv_objects.h:50
Definition: inv_objects.h:80
Definition: inv_objects.h:105
Definition: actors.h:36
uint32 SCNHANDLE
Definition: dw.h:31