|
@@ -1,29 +1,14 @@
|
1
|
|
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
|
2
|
|
-/*================================================================
|
|
1
|
+/*!
|
|
2
|
+ * \file include/World.h
|
|
3
|
+ * \brief The game world (model)
|
3
|
4
|
*
|
4
|
|
- * Project : OpenRaider
|
5
|
|
- * Author : Terry 'Mongoose' Hendrix II
|
6
|
|
- * Website : http://www.westga.edu/~stu7440/
|
7
|
|
- * Email : stu7440@westga.edu
|
8
|
|
- * Object : World
|
9
|
|
- * License : No use w/o permission (C) 2002 Mongoose
|
10
|
|
- * Comments: The game world ( model )
|
11
|
|
- *
|
12
|
|
- *
|
13
|
|
- * This file was generated using Mongoose's C++
|
14
|
|
- * template generator script. <stu7440@westga.edu>
|
15
|
|
- *
|
16
|
|
- *-- History ------------------------------------------------
|
17
|
|
- *
|
18
|
|
- * 2002.12.16:
|
19
|
|
- * Mongoose - Created
|
20
|
|
- ================================================================*/
|
21
|
|
-
|
|
5
|
+ * \author Mongoose
|
|
6
|
+ */
|
22
|
7
|
|
23
|
8
|
#ifndef _WORLD_H_
|
24
|
9
|
#define _WORLD_H_
|
25
|
10
|
|
26
|
|
-#define BAD_BLOOD // For temp rendering use
|
|
11
|
+#define BAD_BLOOD //!< \todo For temp rendering use
|
27
|
12
|
|
28
|
13
|
#ifdef BAD_BLOOD
|
29
|
14
|
#include <SkeletalModel.h>
|
|
@@ -33,89 +18,63 @@
|
33
|
18
|
#include <Vector.h>
|
34
|
19
|
#include <MatMath.h>
|
35
|
20
|
|
36
|
|
-
|
37
|
21
|
// Mirrors TombRaider class' room flags really
|
38
|
|
-typedef enum
|
39
|
|
-{
|
|
22
|
+typedef enum {
|
40
|
23
|
roomFlag_underWater = 0x0001
|
41
|
|
-
|
42
|
24
|
} room_flags_t;
|
43
|
25
|
|
44
|
|
-typedef enum
|
45
|
|
-{
|
|
26
|
+typedef enum {
|
46
|
27
|
worldMoveType_walkNoSwim = -1,
|
47
|
28
|
worldMoveType_walk = 0,
|
48
|
29
|
worldMoveType_noClipping = 1,
|
49
|
30
|
worldMoveType_fly = 2,
|
50
|
31
|
worldMoveType_swim = 3
|
51
|
|
-
|
52
|
32
|
} worldMoveType;
|
53
|
33
|
|
54
|
|
-
|
55
|
|
-typedef struct vertex_s
|
56
|
|
-{
|
|
34
|
+typedef struct {
|
57
|
35
|
vec3_t pos;
|
58
|
|
-
|
59
|
36
|
} vertex_t;
|
60
|
37
|
|
61
|
|
-
|
62
|
|
-typedef struct uv_s
|
63
|
|
-{
|
|
38
|
+/*
|
|
39
|
+typedef struct {
|
64
|
40
|
vec2_t uv;
|
65
|
|
-
|
66
|
41
|
} uv_t;
|
67
|
42
|
|
68
|
|
-typedef struct texel_s
|
69
|
|
-{
|
70
|
|
- vec2_t st;
|
71
|
|
-
|
72
|
|
-} texel_t;
|
73
|
|
-
|
74
|
|
-
|
75
|
|
-typedef struct color_s
|
76
|
|
-{
|
|
43
|
+typedef struct {
|
77
|
44
|
vec4_t rgba;
|
78
|
|
-
|
79
|
45
|
} color_t;
|
|
46
|
+*/
|
80
|
47
|
|
|
48
|
+typedef struct {
|
|
49
|
+ vec2_t st;
|
|
50
|
+} texel_t;
|
81
|
51
|
|
82
|
|
-typedef struct sprite_s
|
83
|
|
-{
|
84
|
|
- int num_verts; // 4 == Quad, 3 == Triangle, rendered as triangles
|
|
52
|
+typedef struct {
|
|
53
|
+ int num_verts; //!< 4 == Quad, 3 == Triangle, rendered as triangles
|
85
|
54
|
vertex_t vertex[4];
|
86
|
55
|
texel_t texel[4];
|
87
|
56
|
float pos[3];
|
88
|
|
- float radius; // yeah, I know
|
|
57
|
+ float radius; //!< \fixme yeah, I know
|
89
|
58
|
int texture;
|
90
|
|
-
|
91
|
59
|
} sprite_t;
|
92
|
60
|
|
93
|
|
-
|
94
|
|
-typedef struct sprite_seq_s
|
95
|
|
-{
|
|
61
|
+typedef struct {
|
96
|
62
|
int num_sprites;
|
97
|
63
|
sprite_t *sprite;
|
98
|
|
-
|
99
|
64
|
} sprite_seq_t;
|
100
|
65
|
|
101
|
|
-
|
102
|
66
|
/*! \fixme For now shaders are textures on tex objects
|
103
|
67
|
* and materials on color objects. If -1
|
104
|
68
|
* then it doesn't have that information yet.
|
105
|
69
|
*/
|
106
|
|
-
|
107
|
|
-typedef struct texture_tri_s
|
108
|
|
-{
|
|
70
|
+typedef struct {
|
109
|
71
|
int index[3];
|
110
|
72
|
vec_t st[6];
|
111
|
73
|
int texture;
|
112
|
74
|
unsigned short transparency;
|
113
|
|
-
|
114
|
75
|
} texture_tri_t;
|
115
|
76
|
|
116
|
|
-
|
117
|
|
-typedef struct model_mesh_s
|
118
|
|
-{
|
|
77
|
+typedef struct {
|
119
|
78
|
Vector<texture_tri_t *> texturedTriangles;
|
120
|
79
|
Vector<texture_tri_t *> coloredTriangles;
|
121
|
80
|
Vector<texture_tri_t *> texturedRectangles;
|
|
@@ -132,84 +91,64 @@ typedef struct model_mesh_s
|
132
|
91
|
|
133
|
92
|
unsigned int normalCount;
|
134
|
93
|
vec_t *normals;
|
135
|
|
-
|
136
|
94
|
} model_mesh_t;
|
137
|
95
|
|
|
96
|
+typedef struct entity_s {
|
|
97
|
+ int id; //!< Unique identifier
|
|
98
|
+ float pos[3]; //!< World position
|
|
99
|
+ float angles[3]; //!< Euler angles (pitch, yaw, roll)
|
|
100
|
+ int type; //!< {(0x00, item), (0x01, ai), (0x02, player)}
|
|
101
|
+ int room; //!< Current room entity is in
|
|
102
|
+ worldMoveType moveType; //!< Type of motion/clipping
|
|
103
|
+ bool moving; //!< In motion?
|
|
104
|
+ struct entity_s *master; //!< Part of entity chain?
|
138
|
105
|
|
139
|
|
-////////////////////////////////////////////////////////////////
|
140
|
|
-
|
141
|
|
-
|
142
|
|
-typedef struct entity_s
|
143
|
|
-{
|
144
|
|
- int id; // Unique identifier
|
145
|
|
- float pos[3]; // World position
|
146
|
|
- float angles[3]; // Euler angles (pitch, yaw, roll)
|
147
|
|
- int type; // {(0x00, item), (0x01, ai), (0x02, player)}
|
148
|
|
- int room; // Current room entity is in
|
149
|
|
- worldMoveType moveType; // Type of motion/clipping
|
150
|
|
- bool moving; // In motion?
|
151
|
|
- struct entity_s *master; // Part of entity chain?
|
|
106
|
+ int state; //!< State of the Player, AI, or object
|
|
107
|
+ int objectId; //!< What kind of entity?
|
152
|
108
|
|
153
|
|
- int state; // State of the Player, AI, or object
|
154
|
|
- int objectId; // What kind of entity?
|
155
|
|
-
|
156
|
|
- int modelId; // Animation model
|
|
109
|
+ int modelId; //!< Animation model
|
157
|
110
|
void *tmpHook;
|
158
|
111
|
bool animate;
|
159
|
112
|
|
160
|
113
|
/*
|
161
|
|
- float time, lastTime;
|
162
|
|
- int state, lastState;
|
163
|
|
- int event, lastEvent;
|
164
|
|
- int goal;
|
165
|
|
- */
|
166
|
|
-
|
|
114
|
+ float time, lastTime;
|
|
115
|
+ int state, lastState;
|
|
116
|
+ int event, lastEvent;
|
|
117
|
+ int goal;
|
|
118
|
+ */
|
167
|
119
|
} entity_t;
|
168
|
120
|
|
169
|
|
-
|
170
|
|
-typedef struct static_model_s
|
171
|
|
-{
|
172
|
|
- int index; // model_mesh index
|
173
|
|
- float yaw; // angle of rotation on Y
|
174
|
|
- float pos[3]; // position
|
|
121
|
+typedef struct {
|
|
122
|
+ int index; //!< model_mesh index
|
|
123
|
+ float yaw; //!< angle of rotation on Y
|
|
124
|
+ float pos[3]; //!< position
|
175
|
125
|
|
176
|
126
|
//vec3_t bboxMax;
|
177
|
127
|
//vec3_t bboxMin;
|
178
|
|
-
|
179
|
128
|
} static_model_t;
|
180
|
129
|
|
181
|
|
-
|
182
|
|
-
|
183
|
|
-typedef struct portal_s
|
184
|
|
-{
|
|
130
|
+typedef struct {
|
185
|
131
|
float vertices[4][3];
|
186
|
132
|
float normal[3];
|
187
|
133
|
int adjoining_room;
|
188
|
|
-
|
189
|
134
|
} portal_t;
|
190
|
135
|
|
191
|
|
-
|
192
|
|
-typedef struct box_s
|
193
|
|
-{
|
|
136
|
+typedef struct {
|
194
|
137
|
vertex_t a;
|
195
|
138
|
vertex_t b;
|
196
|
139
|
vertex_t c;
|
197
|
140
|
vertex_t d;
|
198
|
|
-
|
199
|
141
|
} box_t;
|
200
|
142
|
|
201
|
|
-typedef struct sector_s
|
202
|
|
-{
|
|
143
|
+typedef struct {
|
203
|
144
|
vec_t floor;
|
204
|
145
|
vec_t ceiling;
|
205
|
146
|
|
206
|
147
|
bool wall;
|
207
|
|
-
|
208
|
148
|
} sector_t;
|
209
|
149
|
|
210
|
150
|
//! \fixme No room mesh list or sprites and etc
|
211
|
|
-typedef struct room_mesh_s
|
212
|
|
-{
|
|
151
|
+typedef struct {
|
213
|
152
|
Vector<int> adjacentRooms;
|
214
|
153
|
Vector<portal_t *> portals;
|
215
|
154
|
Vector<static_model_t *> models;
|
|
@@ -224,13 +163,10 @@ typedef struct room_mesh_s
|
224
|
163
|
float pos[3];
|
225
|
164
|
vec3_t bbox_min;
|
226
|
165
|
vec3_t bbox_max;
|
227
|
|
-
|
228
|
166
|
} room_mesh_t;
|
229
|
167
|
|
230
|
|
-
|
231
|
168
|
// Workout generic entity and a client class from these entities
|
232
|
|
-typedef struct world_entity_s
|
233
|
|
-{
|
|
169
|
+typedef struct world_entity_s {
|
234
|
170
|
vec3_t pos;
|
235
|
171
|
vec3_t lastPos;
|
236
|
172
|
vec3_t angle;
|
|
@@ -243,9 +179,7 @@ typedef struct world_entity_s
|
243
|
179
|
|
244
|
180
|
} world_entity_t;
|
245
|
181
|
|
246
|
|
-
|
247
|
|
-typedef struct actor_entity_s
|
248
|
|
-{
|
|
182
|
+typedef struct {
|
249
|
183
|
vec3_t pos;
|
250
|
184
|
vec3_t lastPos;
|
251
|
185
|
vec3_t angle;
|
|
@@ -266,9 +200,8 @@ typedef struct actor_entity_s
|
266
|
200
|
|
267
|
201
|
} actor_entity_t;
|
268
|
202
|
|
269
|
|
-enum OpenRaiderEvent
|
270
|
|
-{
|
271
|
|
- eNone = 0,
|
|
203
|
+enum OpenRaiderEvent {
|
|
204
|
+ eNone = 0,
|
272
|
205
|
eWeaponDischarge,
|
273
|
206
|
eDying,
|
274
|
207
|
eDead,
|
|
@@ -284,138 +217,97 @@ enum OpenRaiderEvent
|
284
|
217
|
eLand
|
285
|
218
|
};
|
286
|
219
|
|
|
220
|
+/*!
|
|
221
|
+ * \brief The game world (model)
|
|
222
|
+ */
|
|
223
|
+class World {
|
|
224
|
+public:
|
287
|
225
|
|
288
|
|
-class World
|
289
|
|
-{
|
290
|
|
- public:
|
291
|
|
-
|
292
|
|
- enum WorldFlag
|
293
|
|
- {
|
|
226
|
+ enum WorldFlag {
|
294
|
227
|
fEnableHopping = 1
|
295
|
228
|
};
|
296
|
229
|
|
297
|
|
- ////////////////////////////////////////////////////////////
|
298
|
|
- // Constructors
|
299
|
|
- ////////////////////////////////////////////////////////////
|
300
|
|
-
|
|
230
|
+ /*!
|
|
231
|
+ * \brief Constructs an object of World
|
|
232
|
+ */
|
301
|
233
|
World();
|
302
|
|
- /*------------------------------------------------------
|
303
|
|
- * Pre :
|
304
|
|
- * Post : Constructs an object of World
|
305
|
|
- *
|
306
|
|
- *-- History ------------------------------------------
|
307
|
|
- *
|
308
|
|
- * 2002.12.16:
|
309
|
|
- * Mongoose - Created
|
310
|
|
- ------------------------------------------------------*/
|
311
|
234
|
|
|
235
|
+ /*!
|
|
236
|
+ * \brief Deconstructs an object of World
|
|
237
|
+ */
|
312
|
238
|
~World();
|
313
|
|
- /*------------------------------------------------------
|
314
|
|
- * Pre : World object is allocated
|
315
|
|
- * Post : Deconstructs an object of World
|
316
|
|
- *
|
317
|
|
- *-- History ------------------------------------------
|
318
|
|
- *
|
319
|
|
- * 2002.12.16:
|
320
|
|
- * Mongoose - Created
|
321
|
|
- ------------------------------------------------------*/
|
322
|
|
-
|
323
|
239
|
|
324
|
|
- ////////////////////////////////////////////////////////////
|
325
|
|
- // Public Accessors
|
326
|
|
- ////////////////////////////////////////////////////////////
|
327
|
|
-
|
328
|
|
- int getRoomByLocation(int index, float x, float y, float z);
|
329
|
|
- /*------------------------------------------------------
|
330
|
|
- * Pre : index - Guessed room index
|
331
|
|
- * Post : Returns correct room index or -1 for unknown
|
332
|
|
- *
|
333
|
|
- * NOTE: If it fails to be in a room it gives
|
334
|
|
- * closest overlapping room
|
335
|
|
- *
|
336
|
|
- *-- History ------------------------------------------
|
|
240
|
+ /*!
|
|
241
|
+ * \brief Find room a location is in.
|
337
|
242
|
*
|
338
|
|
- * 2002.12.20:
|
339
|
|
- * Mongoose - Created, factored out of Render class
|
340
|
|
- ------------------------------------------------------*/
|
|
243
|
+ * If it fails to be in a room it gives closest overlapping room.
|
|
244
|
+ * \param index Guessed room index
|
|
245
|
+ * \param x X coordinate
|
|
246
|
+ * \param y Y coordinate
|
|
247
|
+ * \param z Z coordinate
|
|
248
|
+ * \returns correct room index or -1 for unknown
|
|
249
|
+ */
|
|
250
|
+ int getRoomByLocation(int index, float x, float y, float z);
|
341
|
251
|
|
342
|
|
- int getRoomByLocation(float x, float y, float z);
|
343
|
|
- /*------------------------------------------------------
|
344
|
|
- * Pre :
|
345
|
|
- * Post : Returns correct room index or -1 for unknown
|
|
252
|
+ /*!
|
|
253
|
+ * \brief Find room a location is in.
|
346
|
254
|
*
|
347
|
|
- * NOTE: If it fails to be in a room it gives
|
348
|
|
- * closest overlapping room
|
349
|
|
- *
|
350
|
|
- *-- History ------------------------------------------
|
351
|
|
- *
|
352
|
|
- * 2002.12.20:
|
353
|
|
- * Mongoose - Created, factored out of Render class
|
354
|
|
- ------------------------------------------------------*/
|
|
255
|
+ * If it fails to be in a room it gives closest overlapping room.
|
|
256
|
+ * \param x X coordinate
|
|
257
|
+ * \param y Y coordinate
|
|
258
|
+ * \param z Z coordinate
|
|
259
|
+ * \returns correct room index or -1 for unknown
|
|
260
|
+ */
|
|
261
|
+ int getRoomByLocation(float x, float y, float z);
|
355
|
262
|
|
|
263
|
+ /*!
|
|
264
|
+ * \brief Looks for portal crossings from xyz to xyz2 segment
|
|
265
|
+ * from room[index]
|
|
266
|
+ * \param index valid room index
|
|
267
|
+ * \param x X coordinate of first point
|
|
268
|
+ * \param y Y coordinate of first point
|
|
269
|
+ * \param z Z coordinate of first point
|
|
270
|
+ * \param x2 X coordinate of second point
|
|
271
|
+ * \param y2 Y coordinate of second point
|
|
272
|
+ * \param z2 Z coordinate of second point
|
|
273
|
+ * \returns index of adjoined room or -1
|
|
274
|
+ */
|
356
|
275
|
int getAdjoiningRoom(int index,
|
357
|
|
- float x, float y, float z,
|
358
|
|
- float x2, float y2, float z2);
|
359
|
|
- /*------------------------------------------------------
|
360
|
|
- * Pre :
|
361
|
|
- * Post : Looks for portal crossings from xyz to xyz2 segment
|
362
|
|
- * from room[index] returns index of adjoined room or -1
|
363
|
|
- *
|
364
|
|
- *-- History ------------------------------------------
|
365
|
|
- *
|
366
|
|
- * 2003.05.29:
|
367
|
|
- * Mongoose - Created
|
368
|
|
- ------------------------------------------------------*/
|
369
|
|
-
|
|
276
|
+ float x, float y, float z,
|
|
277
|
+ float x2, float y2, float z2);
|
|
278
|
+
|
|
279
|
+ /*!
|
|
280
|
+ * \brief Gets the sector index of the position in room
|
|
281
|
+ * \param room valid room index
|
|
282
|
+ * \param x X coordinate in room
|
|
283
|
+ * \param z Z coordinate in room
|
|
284
|
+ * \returns sector index of position in room
|
|
285
|
+ */
|
370
|
286
|
int getSector(int room, float x, float z);
|
371
|
287
|
int getSector(int room, float x, float z, float *floor, float *ceiling);
|
372
|
|
- /*------------------------------------------------------
|
373
|
|
- * Pre : room - valid room index
|
374
|
|
- * Post : Gets the sector index of the position in room
|
375
|
|
- *
|
376
|
|
- *-- History ------------------------------------------
|
377
|
|
- *
|
378
|
|
- * 2002.12.20:
|
379
|
|
- * Mongoose - Created, factored out of Render class
|
380
|
|
- ------------------------------------------------------*/
|
381
|
288
|
|
382
|
289
|
unsigned int getRoomInfo(int room);
|
383
|
|
- /*------------------------------------------------------
|
384
|
|
- * Pre :
|
385
|
|
- * Post :
|
386
|
|
- *
|
387
|
|
- *-- History ------------------------------------------
|
388
|
|
- *
|
389
|
|
- * 2003.05.28:
|
390
|
|
- * Mongoose - Created
|
391
|
|
- ------------------------------------------------------*/
|
392
|
290
|
|
|
291
|
+ /*!
|
|
292
|
+ * \brief Check if sector is a wall
|
|
293
|
+ * \param room valid room index
|
|
294
|
+ * \param sector valid sector index
|
|
295
|
+ * \returns true if this sector is a wall
|
|
296
|
+ */
|
393
|
297
|
bool isWall(int room, int sector);
|
394
|
|
- /*------------------------------------------------------
|
395
|
|
- * Pre : room - valid room index
|
396
|
|
- * sector - valid sector index
|
397
|
|
- * Post : Returns true if this sector is a wall
|
398
|
|
- *
|
399
|
|
- *-- History ------------------------------------------
|
400
|
|
- *
|
401
|
|
- * 2002.12.20:
|
402
|
|
- * Mongoose - Created, factored out of Render class
|
403
|
|
- ------------------------------------------------------*/
|
404
|
298
|
|
|
299
|
+ /*!
|
|
300
|
+ * \brief Get the world height at a position
|
|
301
|
+ * \param index valid room index
|
|
302
|
+ * \param x X coordinate
|
|
303
|
+ * \param y will be set to world height in that room
|
|
304
|
+ * \param z Z coordinate
|
|
305
|
+ * \returns true if position is in a room
|
|
306
|
+ */
|
405
|
307
|
bool getHeightAtPosition(int index, float x, float *y, float z);
|
406
|
|
- /*------------------------------------------------------
|
407
|
|
- * Pre : index - valid room index
|
408
|
|
- * Post : Returns true if position is in a room
|
409
|
|
- * and sets y to the world height in that room
|
410
|
|
- *
|
411
|
|
- *-- History ------------------------------------------
|
412
|
|
- *
|
413
|
|
- * 2002.12.20:
|
414
|
|
- * Mongoose - Created, factored out of Render class
|
415
|
|
- ------------------------------------------------------*/
|
416
|
308
|
|
417
|
|
- // Temp methods for rendering use until more refactoring is done
|
418
|
309
|
#ifdef BAD_BLOOD
|
|
310
|
+ //! \todo Temp methods for rendering use until more refactoring is done
|
419
|
311
|
model_mesh_t *getMesh(int index);
|
420
|
312
|
skeletal_model_t *getModel(int index);
|
421
|
313
|
room_mesh_t *getRoom(int index);
|
|
@@ -424,155 +316,76 @@ class World
|
424
|
316
|
Vector<room_mesh_t *> *getRooms();
|
425
|
317
|
#endif
|
426
|
318
|
|
427
|
|
- ////////////////////////////////////////////////////////////
|
428
|
|
- // Public Mutators
|
429
|
|
- ////////////////////////////////////////////////////////////
|
430
|
|
-
|
|
319
|
+ /*!
|
|
320
|
+ * \brief Set an option flag
|
|
321
|
+ * \param flag flag to set
|
|
322
|
+ */
|
431
|
323
|
void setFlag(WorldFlag flag);
|
432
|
|
- /*------------------------------------------------------
|
433
|
|
- * Pre :
|
434
|
|
- * Post : Sets option flag
|
435
|
|
- *
|
436
|
|
- *-- History ------------------------------------------
|
437
|
|
- *
|
438
|
|
- * 2002.12.20:
|
439
|
|
- * Mongoose - Created, factored out of Render class
|
440
|
|
- ------------------------------------------------------*/
|
441
|
324
|
|
|
325
|
+ /*!
|
|
326
|
+ * \brief Clear an option flag
|
|
327
|
+ * \param flag flag to clear
|
|
328
|
+ */
|
442
|
329
|
void clearFlag(WorldFlag flag);
|
443
|
|
- /*------------------------------------------------------
|
444
|
|
- * Pre :
|
445
|
|
- * Post : Clears option flag
|
446
|
|
- *
|
447
|
|
- *-- History ------------------------------------------
|
448
|
|
- *
|
449
|
|
- * 2002.12.20:
|
450
|
|
- * Mongoose - Created, factored out of Render class
|
451
|
|
- ------------------------------------------------------*/
|
452
|
330
|
|
|
331
|
+ /*!
|
|
332
|
+ * \brief Clears all data in world
|
|
333
|
+ * \todo in future will check if data is in use before clearing
|
|
334
|
+ */
|
453
|
335
|
void destroy();
|
454
|
|
- /*------------------------------------------------------
|
455
|
|
- * Pre :
|
456
|
|
- * Post : Clears all data in world, in future will check
|
457
|
|
- * if data is in use before clearing
|
458
|
|
- *
|
459
|
|
- *-- History ------------------------------------------
|
460
|
|
- *
|
461
|
|
- * 2002.12.20:
|
462
|
|
- * Mongoose - Created
|
463
|
|
- ------------------------------------------------------*/
|
464
|
336
|
|
|
337
|
+ /*!
|
|
338
|
+ * \brief Adds room to world
|
|
339
|
+ * \param room room to add
|
|
340
|
+ */
|
465
|
341
|
void addRoom(room_mesh_t *room);
|
466
|
|
- /*------------------------------------------------------
|
467
|
|
- * Pre :
|
468
|
|
- * Post : Adds object to world
|
469
|
|
- *
|
470
|
|
- *-- History ------------------------------------------
|
471
|
|
- *
|
472
|
|
- * 2002.12.20:
|
473
|
|
- * Mongoose - Created, factored out of Render class
|
474
|
|
- ------------------------------------------------------*/
|
475
|
342
|
|
|
343
|
+ /*!
|
|
344
|
+ * \brief ADds mesh to world
|
|
345
|
+ * \param model mesh to add
|
|
346
|
+ */
|
476
|
347
|
void addMesh(model_mesh_t *model);
|
477
|
|
- /*------------------------------------------------------
|
478
|
|
- * Pre :
|
479
|
|
- * Post : Adds object to world
|
480
|
|
- *
|
481
|
|
- *-- History ------------------------------------------
|
482
|
|
- *
|
483
|
|
- * 2002.12.20:
|
484
|
|
- * Mongoose - Created, factored out of Render class
|
485
|
|
- ------------------------------------------------------*/
|
486
|
348
|
|
|
349
|
+ /*!
|
|
350
|
+ * \brief Adds entity to world
|
|
351
|
+ * \param e entity to add
|
|
352
|
+ */
|
487
|
353
|
void addEntity(entity_t *e);
|
488
|
|
- /*------------------------------------------------------
|
489
|
|
- * Pre :
|
490
|
|
- * Post : Adds object to world
|
491
|
|
- *
|
492
|
|
- *-- History ------------------------------------------
|
493
|
|
- *
|
494
|
|
- * 2002.12.20:
|
495
|
|
- * Mongoose - Created, factored out of Render class
|
496
|
|
- ------------------------------------------------------*/
|
497
|
354
|
|
|
355
|
+ /*!
|
|
356
|
+ * \brief Adds model to world.
|
|
357
|
+ * \param model model to add
|
|
358
|
+ * \returns next model ID or -1 on error
|
|
359
|
+ */
|
498
|
360
|
int addModel(skeletal_model_t *model);
|
499
|
|
- /*------------------------------------------------------
|
500
|
|
- * Pre :
|
501
|
|
- * Post : Adds object to world, returns next model Id
|
502
|
|
- * or -1 if failed to add model to world
|
503
|
|
- *
|
504
|
|
- *-- History ------------------------------------------
|
505
|
|
- *
|
506
|
|
- * 2002.12.20:
|
507
|
|
- * Mongoose - Created, factored out of Render class
|
508
|
|
- ------------------------------------------------------*/
|
509
|
361
|
|
|
362
|
+ /*!
|
|
363
|
+ * \brief Adds sprite to world
|
|
364
|
+ * \param sprite sprite to add
|
|
365
|
+ */
|
510
|
366
|
void addSprite(sprite_seq_t *sprite);
|
511
|
|
- /*------------------------------------------------------
|
512
|
|
- * Pre :
|
513
|
|
- * Post : Adds object to world
|
514
|
|
- *
|
515
|
|
- *-- History ------------------------------------------
|
516
|
|
- *
|
517
|
|
- * 2002.12.20:
|
518
|
|
- * Mongoose - Created, factored out of Render class
|
519
|
|
- ------------------------------------------------------*/
|
520
|
367
|
|
|
368
|
+ /*!
|
|
369
|
+ * \brief Move entity in given direction unless collision occurs
|
|
370
|
+ * \param e entity to move
|
|
371
|
+ * \param movement direction of movement ('f', 'b', 'l' or 'r')
|
|
372
|
+ */
|
521
|
373
|
void moveEntity(entity_t *e, char movement);
|
522
|
|
- /*------------------------------------------------------
|
523
|
|
- * Pre : movement - 'f' orward
|
524
|
|
- * 'b' ackward
|
525
|
|
- * 'l' eft
|
526
|
|
- * 'r' ight
|
527
|
|
- *
|
528
|
|
- * Post : Move entity e in a given direction, unless
|
529
|
|
- * a collision ocurrs
|
530
|
|
- *
|
531
|
|
- *-- History ------------------------------------------
|
532
|
|
- *
|
533
|
|
- * 2002.12.20:
|
534
|
|
- * Mongoose - Moved to WOrld class
|
535
|
|
- *
|
536
|
|
- * 2002.09.02:
|
537
|
|
- * Mongoose - Created
|
538
|
|
- ------------------------------------------------------*/
|
539
|
|
-
|
540
|
|
-
|
541
|
|
- private:
|
542
|
374
|
|
543
|
|
- ////////////////////////////////////////////////////////////
|
544
|
|
- // Private Accessors
|
545
|
|
- ////////////////////////////////////////////////////////////
|
546
|
|
-
|
547
|
|
-
|
548
|
|
- ////////////////////////////////////////////////////////////
|
549
|
|
- // Private Mutators
|
550
|
|
- ////////////////////////////////////////////////////////////
|
|
375
|
+private:
|
551
|
376
|
|
|
377
|
+ /*!
|
|
378
|
+ * \brief Clears all data in world
|
|
379
|
+ */
|
552
|
380
|
void clear();
|
553
|
|
- /*------------------------------------------------------
|
554
|
|
- * Pre :
|
555
|
|
- * Post : Clears all data in world
|
556
|
|
- *
|
557
|
|
- *-- History ------------------------------------------
|
558
|
|
- *
|
559
|
|
- * 2002.12.20:
|
560
|
|
- * Mongoose - Created
|
561
|
|
- ------------------------------------------------------*/
|
562
|
381
|
|
563
|
382
|
bool mClearLock;
|
564
|
|
-
|
565
|
|
- unsigned int mFlags; /* World flags */
|
566
|
|
-
|
567
|
|
- Vector<entity_t *> mEntities; /* World entities */
|
568
|
|
-
|
569
|
|
- Vector<room_mesh_t *> mRooms; /* Map data and meshes */
|
570
|
|
-
|
571
|
|
- Vector<model_mesh_t *> mMeshes; /* Unanimated meshes */
|
572
|
|
-
|
573
|
|
- Vector<sprite_seq_t *> mSprites; /* Sprites */
|
574
|
|
-
|
575
|
|
- Vector<skeletal_model_t *> mModels; /* Skeletal animation models */
|
|
383
|
+ unsigned int mFlags; //!< World flags
|
|
384
|
+ Vector<entity_t *> mEntities; //!< World entities
|
|
385
|
+ Vector<room_mesh_t *> mRooms; //!< Map data and meshes
|
|
386
|
+ Vector<model_mesh_t *> mMeshes; //!< Unanimated meshes
|
|
387
|
+ Vector<sprite_seq_t *> mSprites; //!< Sprites
|
|
388
|
+ Vector<skeletal_model_t *> mModels; //!< Skeletal animation models
|
576
|
389
|
};
|
577
|
390
|
|
578
|
391
|
#endif
|