ScummVM API documentation
object.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 MADS_CORE_OBJECT_H
23#define MADS_CORE_OBJECT_H
24
25#include "common/serializer.h"
26#include "common/stream.h"
27#include "mads/core/general.h"
28#include "mads/core/vocab.h"
29#include "mads/core/qual.h"
30#include "mads/core/inter.h"
31
32namespace MADS {
33
34#define OBJECT_MAX_VERBS 5
35#define OBJECT_MAX_QUALITIES 4
36
37#define OBJECT_SHORT_NAME_LEN 5
38
39#define OBJECT_VIEW_OFFSET 6
40#define OBJECT_GREY_BASE 248
41#define OBJECT_GREY_COLORS 8
42#define OBJECT_GREY_SPEED 1
43#define OBJECT_GREY_STEPS 16
44
45
46struct HagVerb {
47 char name[VC_MAXWORDLEN + 1];
48 byte verb_type;
49 byte prep_type;
50};
51
52
53/* Format for storing objects on disk */
54
56 int16 number; /* Official object number */
57 char vocab_name[VC_MAXWORDLEN + 1];
58 char variable_name[VC_MAXWORDLEN + 1];
59 char desc[80];
60 int16 location;
61 byte prep;
62 byte num_verbs;
63 byte num_qualities;
64 byte syntax;
65 HagVerb verb[OBJECT_MAX_VERBS];
66 char quality_name[OBJECT_MAX_QUALITIES][QU_MAXWORDLEN + 1];
67 int32 quality_value[OBJECT_MAX_QUALITIES];
68};
69
72
73struct ObjectBuf {
74 word vocab_id; /* Vocab word for name */
75 int16 location; /* Current location */
76 byte prep; /* "Put" preposition */
77 byte num_verbs; /* Number of special verbs */
78 byte num_qualities; /* Number of qualities */
79 byte syntax; /* Syntax */
80 Verb verb[OBJECT_MAX_VERBS]; /* Verb list for objects */
81 byte quality_id[OBJECT_MAX_QUALITIES]; /* Quality list */
82 int32 quality_value[OBJECT_MAX_QUALITIES]; /* Quality values */
83
84 void load(Common::SeekableReadStream *src);
85 void synchronize(Common::Serializer &s);
86};
87
88typedef ObjectBuf Object;
89typedef Object *ObjectPtr;
90
91
92extern ObjectPtr object;
93extern int num_objects;
94
95extern int object_ems_handle;
96
97
98extern int object_load();
99extern void object_unload();
100
101extern int object_named(int vocab_id);
102extern int object_is_here(int object_id);
103
104extern int object_has_quality(int object_id, int quality_id);
105extern long object_check_quality(int object_id, int quality_id);
106extern void object_set_quality(int object_id, int quality_id, long quality_value);
107
112extern int object_examine(int number, long message, int speech = 0);
113
114extern void init_object();
115
116} // namespace MADS
117
118#endif
Definition: stream.h:745
Definition: serializer.h:80
Definition: object.h:55
Definition: object.h:46
Definition: object.h:73
Definition: inter.h:159