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 STARTREK_OBJECT_H
23 #define STARTREK_OBJECT_H
24 
25 #include "startrek/common.h"
26 #include "startrek/fixedint.h"
27 #include "startrek/items.h"
28 #include "startrek/sprite.h"
29 
30 #include "common/ptr.h"
31 #include "common/stream.h"
32 #include "common/memstream.h"
33 #include "common/scummsys.h"
34 
35 namespace StarTrek {
36 
37 class StarTrekEngine;
38 class Room;
39 
40 // FIXME: Eventually get rid of Common::SharedPtr and dispose of file streams properly
42 
43 // Objects 0-31 are "actors" that are drawn to the screen, are animated, etc.
44 // Objects 32-63 are "hotspots" corresponding to specific regions in the screen.
45 // Objects 64+ are "items".
46 // All interactions in the game consist of specific object indices interacting with each
47 // other, ie. object 0 (kirk) interacts with object 32 (a hotspot) via ACTION_LOOK.
48 
49 const int ACTORS_START = 0;
50 const int SCALED_ACTORS_END = 8; // Only first 8 actors have room scaling applied?
51 const int ACTORS_END = 32;
52 const int NUM_ACTORS = ACTORS_END - ACTORS_START;
53 
54 const int HOTSPOTS_START = 32;
55 const int HOTSPOTS_END = 64;
56 const int NUM_HOTSPOTS = HOTSPOTS_END - HOTSPOTS_START;
57 
58 const int ITEMS_START = 64;
59 const int ITEMS_END = ITEMS_START + NUM_ITEMS; // See items.h
60 
61 const int NUM_OBJECTS = ITEMS_END;
62 
63 
64 enum Directions {
65  DIR_N = 0,
66  DIR_S = 1,
67  DIR_E = 2,
68  DIR_W = 3
69 };
70 
71 // Some object indices are reserved (see items.h for item objects)
72 enum Objects {
73  OBJECT_KIRK = 0,
74  OBJECT_SPOCK = 1,
75  OBJECT_MCCOY = 2,
76  OBJECT_REDSHIRT = 3,
77  OBJECT_INVENTORY_ICON = 31
78 };
79 
80 
81 struct Actor {
82  bool spriteDrawn;
83  Common::String animFilename;
84  uint16 animType;
85  Sprite sprite;
86  Common::String bitmapFilename;
87  Fixed8 scale;
88  FileStream animFile;
89  uint16 numAnimFrames;
90  uint16 animFrame;
91  uint32 frameToStartNextAnim;
92  Common::Point pos;
93  uint16 field60;
94  uint16 field62;
95 
96  // When an object finished walking somewhere or finishes an animation, if
97  // "triggerActionWhenAnimFinished" is true, it will create an action of type
98  // "ACTION_FINISHED_WALKING" or "ACTION_FINISHED_ANIMATION", with the integer value
99  // "finishedAnimActionParam".
100  bool triggerActionWhenAnimFinished;
101  uint16 finishedAnimActionParam;
102 
103  Common::String animationString2;
104  uint16 field70;
105  uint16 field72;
106  uint16 field74;
107  uint16 field76;
108  int16 iwSrcPosition;
109  int16 iwDestPosition;
110 
111  // Fixed-point position values (16.16) used while walking.
112  Fixed16 granularPosX;
113  Fixed16 granularPosY;
114 
115  // Fixed-point speed values (16.16).
116  Fixed16 speedX;
117  Fixed16 speedY;
118 
119  Common::Point dest; // Position object is walking toward
120  uint16 field90;
121  byte field92;
122 
123  // Can 'n', 's', 'e', 'w', or 0 for uninitialized?
124  // Can also be capitalized?
125  char direction;
126 
127  uint16 field94;
128  uint16 field96;
129 
130  Common::String animationString;
131 
132  // These might be part of "animationString"?
133  uint16 fielda2;
134  uint16 fielda4;
135  uint16 fielda6;
136 
137 public:
138  Actor() :
139  spriteDrawn(false),
140  animType(0),
141  sprite(),
142  scale(0),
143  animFile(),
144  numAnimFrames(0),
145  animFrame(0),
146  frameToStartNextAnim(0),
147  pos(Common::Point(0, 0)),
148  field60(0),
149  field62(0),
150  triggerActionWhenAnimFinished(false),
151  finishedAnimActionParam(0),
152  //animationString2[8](),
153  field70(0),
154  field72(0),
155  field74(0),
156  field76(0),
157  iwSrcPosition(0),
158  iwDestPosition(0),
159  granularPosX(0),
160  granularPosY(0),
161  speedX(0),
162  speedY(0),
163 
164  dest(Common::Point(0, 0)),
165  field90(0),
166  field92(0),
167 
168  direction(0),
169  field94(0),
170  field96(0),
171 
172  fielda2(0),
173  fielda4(0),
174  fielda6(0) {
175  }
176 
177 };
178 
179 } // End of namespace StarTrek
180 
181 #endif
182 
Definition: str.h:59
Definition: sprite.h:44
Definition: object.h:81
Definition: rect.h:45
Definition: action.h:27