1 #include "3dc.h"
2 #include "dynblock.h"
3
4 #define UseLocalAssert No
5 #include "ourasert.h"
6
7
8 /*KJL****************************************************************************************
9 * P R O T O T Y P E S *
10 ****************************************************************************************KJL*/
11 void InitialiseDynamicsBlocks(void);
12 DYNAMICSBLOCK* AllocateDynamicsBlock(enum DYNAMICS_TEMPLATE_ID templateID);
13 void DeallocateDynamicsBlock(DYNAMICSBLOCK *dynPtr);
14
15 void InitialiseCollisionReports(void);
16 COLLISIONREPORT* AllocateCollisionReport(DYNAMICSBLOCK* dynPtr);
17
18 static DYNAMICSBLOCK DynBlockStorage[MAX_NO_OF_DYNAMICS_BLOCKS];
19 static int NumFreeDynBlocks;
20 static DYNAMICSBLOCK *FreeDynBlockList[MAX_NO_OF_DYNAMICS_BLOCKS];
21 static DYNAMICSBLOCK **FreeDynBlockListPtr;
22
23 static COLLISIONREPORT CollisionReportStorage[MAX_NO_OF_COLLISION_REPORTS];
24 int NumFreeCollisionReports;
25
26 static DYNAMICSBLOCK DynamicsTemplate[]=
27 {
28 /* DYNAMICS_TEMPLATE_MARINE_PLAYER */
29 {
30 {0,0,0},/* EULER OrientEuler - Euler Orientation */
31 {0,0,0,0,0,0,0,0,0},/* MATRIXCH OrientMat - Local -> World Orientation Matrix */
32 {0,0,0},/* EULER PrevOrientEuler - Euler Orientation */
33 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH PrevOrientMat - Local -> World Orientation Matrix */
34
35 {0,0,0},/* VECTORCH Position */
36 {0,0,0},/* VECTORCH PrevPosition */
37
38 {0,0,0},/* VECTORCH LinVelocity */
39 {0,0,0},/* VECTORCH LinImpulse */
40
41 {0,0,0},/* EULER AngVelocity */
42 {0,0,0},/* EULER AngImpulse */
43
44 NULL, /* struct collisionreport *CollisionReportPtr; */
45
46 {0,65536,0},/* VECTORCH GravityDirection */
47 0, /* int TimeNotInContactWithFloor */
48
49 0,/* int Friction; */
50 0,/* int Elasticity; */
51 80*2, /* int Mass */
52
53 DYN_TYPE_NRBB_COLLISIONS,
54 TOPPLE_FORCE_NONE,
55
56 1,/* GravityOn :1; */
57 1,/* UseStandardGravity :1 - ie. in direction of increasing Y */
58 0,/* StopOnCollision :1; */
59 1,/* CanClimbStairs :1; */
60 0,/* IsStatic :1; */
61 0,/* OnlyCollideWithObjects :1; */
62 0,/* IsNetGhost :1; */
63 0,/* IgnoreSameObjectsAsYou :1; */
64 0,/* IgnoreThePlayer :1; */
65 0,/* UseDisplacement :1; */
66 0,/* OnlyCollideWithEnvironment :1; */
67
68
69 0,/* IsInContactWithFloor :1 */
70 0,/* IsInContactWithNearlyFlatFloor */
71 0,/* RequestsToStandUp :1 */
72 0,/* IsFloating :1 */
73 0,/* IsPickupObject :1 */
74 0,/* IsInanimate :1; */
75 0,/* IgnoresNotVisPolys :1; */
76 },
77 /* DYNAMICS_TEMPLATE_ALIEN_NPC */
78 {
79 {0,0,0},/* EULER OrientEuler - Euler Orientation */
80 {0,0,0,0,0,0,0,0,0},/* MATRIXCH OrientMat - Local -> World Orientation Matrix */
81 {0,0,0},/* EULER PrevOrientEuler - Euler Orientation */
82 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH PrevOrientMat - Local -> World Orientation Matrix */
83
84 {0,0,0},/* VECTORCH Position */
85 {0,0,0},/* VECTORCH PrevPosition */
86
87 {0,0,0},/* VECTORCH LinVelocity */
88 {0,0,0},/* VECTORCH LinImpulse */
89
90 {0,0,0},/* EULER AngVelocity */
91 {0,0,0},/* EULER AngImpulse */
92
93 NULL, /* struct collisionreport *CollisionReportPtr; */
94
95 {0,65536,0},/* VECTORCH GravityDirection */
96 0, /* int TimeNotInContactWithFloor */
97
98 1,/* int Friction; */
99 0,/* int Elasticity; */
100 100, /* int Mass */
101
102 DYN_TYPE_NRBB_COLLISIONS,
103 TOPPLE_FORCE_ALIEN,
104
105 1,/* GravityOn :1; */
106 0,/* UseStandardGravity :1 - ie. in direction of increasing Y */
107 0,/* StopOnCollision :1; */
108 1,/* CanClimbStairs :1; */
109 0,/* IsStatic :1; */
110 0,/* OnlyCollideWithObjects :1; */
111 0,/* IsNetGhost :1; */
112 0,/* IgnoreSameObjectsAsYou :1; */
113 0,/* IgnoreThePlayer :1; */
114 0,/* UseDisplacement :1; */
115 0,/* OnlyCollideWithEnvironment :1; */
116
117
118 0,/* IsInContactWithFloor :1 */
119 0,/* IsInContactWithNearlyFlatFloor */
120 0,/* RequestsToStandUp :1 */
121 0,/* IsFloating :1 */
122 0,/* IsPickupObject :1 */
123 0,/* IsInanimate :1; */
124 0,/* IgnoresNotVisPolys :1; */
125 },
126 /* DYNAMICS_TEMPLATE_GRENADE */
127 {
128 {0,0,0},/* EULER OrientEuler - Euler Orientation */
129 {0,0,0,0,0,0,0,0,0},/* MATRIXCH OrientMat - Local -> World Orientation Matrix */
130 {0,0,0},/* EULER PrevOrientEuler - Euler Orientation */
131 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH PrevOrientMat - Local -> World Orientation Matrix */
132
133 {0,0,0},/* VECTORCH Position */
134 {0,0,0},/* VECTORCH PrevPosition */
135
136 {0,0,0},/* VECTORCH LinVelocity */
137 {0,0,0},/* VECTORCH LinImpulse */
138
139 {0,0,0},/* EULER AngVelocity */
140 {0,0,0},/* EULER AngImpulse */
141
142 NULL, /* struct collisionreport *CollisionReportPtr; */
143
144 {0,0,0},/* VECTORCH GravityDirection */
145 0, /* int TimeNotInContactWithFloor */
146
147 0,/* int Friction; */
148 32768/2,/* int Elasticity; */
149 20, /* int Mass */
150
151 DYN_TYPE_NRBB_COLLISIONS,
152 TOPPLE_FORCE_FULL,
153
154 1,/* GravityOn :1; */
155 1,/* UseStandardGravity :1 - ie. in direction of increasing Y */
156 0,/* StopOnCollision :1; */
157 0,/* CanClimbStairs :1; */
158 0,/* IsStatic :1; */
159 0,/* OnlyCollideWithObjects :1; */
160 0,/* IsNetGhost :1; */
161 0,/* IgnoreSameObjectsAsYou :1; */
162 1,/* IgnoreThePlayer :1; */
163 0,/* UseDisplacement :1; */
164 0,/* OnlyCollideWithEnvironment :1; */
165
166 0,/* IsInContactWithFloor :1 */
167 0,/* IsInContactWithNearlyFlatFloor */
168 0,/* RequestsToStandUp :1 */
169 0,/* IsFloating :1 */
170 0,/* IsPickupObject :1 */
171 0,/* IsInanimate :1; */
172 0,/* IgnoresNotVisPolys :1; */
173 },
174 /* DYNAMICS_TEMPLATE_ROCKET & predator disc weapon */
175 {
176 {0,0,0},/* EULER OrientEuler - Euler Orientation */
177 {0,0,0,0,0,0,0,0,0},/* MATRIXCH OrientMat - Local -> World Orientation Matrix */
178 {0,0,0},/* EULER PrevOrientEuler - Euler Orientation */
179 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH PrevOrientMat - Local -> World Orientation Matrix */
180
181 {0,0,0},/* VECTORCH Position */
182 {0,0,0},/* VECTORCH PrevPosition */
183
184 {0,0,0},/* VECTORCH LinVelocity */
185 {0,0,0},/* VECTORCH LinImpulse */
186
187 {0,0,0},/* EULER AngVelocity */
188 {0,0,0},/* EULER AngImpulse */
189
190 NULL, /* struct collisionreport *CollisionReportPtr; */
191
192 {0,0,0},/* VECTORCH GravityDirection */
193 0, /* int TimeNotInContactWithFloor */
194
195 0,/* int Friction; */
196 65536,/* int Elasticity; */
197 40, /* int Mass */
198
199 DYN_TYPE_NRBB_COLLISIONS,
200 TOPPLE_FORCE_NONE,
201
202 0,/* GravityOn :1; */
203 0,/* UseStandardGravity :1 - ie. in direction of increasing Y */
204 1,/* StopOnCollision :1; */
205 0,/* CanClimbStairs :1; */
206 0,/* IsStatic :1; */
207 0,/* OnlyCollideWithObjects :1; */
208 0,/* IsNetGhost :1; */
209 0,/* IgnoreSameObjectsAsYou :1; */
210 1,/* IgnoreThePlayer :1; */
211 0,/* UseDisplacement :1; */
212 0,/* OnlyCollideWithEnvironment :1; */
213
214 0,/* IsInContactWithFloor :1 */
215 0,/* IsInContactWithNearlyFlatFloor */
216 0,/* RequestsToStandUp :1 */
217 0,/* IsFloating :1 */
218 0,/* IsPickupObject :1 */
219 0,/* IsInanimate :1; */
220 0,/* IgnoresNotVisPolys :1; */
221 },
222 /* DYNAMICS_TEMPLATE_DEBRIS */
223 {
224 {0,0,0},/* EULER OrientEuler - Euler Orientation */
225 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH OrientMat - Local -> World Orientation Matrix */
226 {0,0,0},/* EULER PrevOrientEuler - Euler Orientation */
227 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH PrevOrientMat - Local -> World Orientation Matrix */
228
229 {0,0,0},/* VECTORCH Position */
230 {0,0,0},/* VECTORCH PrevPosition */
231
232 {0,0,0},/* VECTORCH LinVelocity */
233 {0,0,0},/* VECTORCH LinImpulse */
234
235 {0,0,0},/* EULER AngVelocity */
236 {0,0,0},/* EULER AngImpulse */
237
238 NULL, /* struct collisionreport *CollisionReportPtr; */
239
240 {0,0,0},/* VECTORCH GravityDirection */
241 0, /* int TimeNotInContactWithFloor */
242
243 0,/* int Friction; */
244 0,/* int Elasticity; */
245 30, /* int Mass */
246
247 DYN_TYPE_NO_COLLISIONS,
248 TOPPLE_FORCE_NONE,
249
250 1,/* GravityOn :1; */
251 1,/* UseStandardGravity :1 - ie. in direction of increasing Y */
252 0,/* StopOnCollision :1; */
253 0,/* CanClimbStairs :1; */
254 0,/* IsStatic :1; */
255 0,/* OnlyCollideWithObjects :1; */
256 0,/* IsNetGhost :1; */
257 0,/* IgnoreSameObjectsAsYou :1; */
258 0,/* IgnoreThePlayer :1; */
259 0,/* UseDisplacement :1; */
260 1,/* OnlyCollideWithEnvironment :1; */
261
262 0,/* IsInContactWithFloor :1 */
263 0,/* IsInContactWithNearlyFlatFloor */
264 0,/* RequestsToStandUp :1 */
265 0,/* IsFloating :1 */
266 0,/* IsPickupObject :1 */
267 0,/* IsInanimate :1; */
268 0,/* IgnoresNotVisPolys :1; */
269 },
270 /* DYNAMICS_TEMPLATE_STATIC */
271 {
272 {0,0,0},/* EULER OrientEuler - Euler Orientation */
273 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH OrientMat - Local -> World Orientation Matrix */
274 {0,0,0},/* EULER PrevOrientEuler - Euler Orientation */
275 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH PrevOrientMat - Local -> World Orientation Matrix */
276
277 {0,0,0},/* VECTORCH Position */
278 {0,0,0},/* VECTORCH PrevPosition */
279
280 {0,0,0},/* VECTORCH LinVelocity */
281 {0,0,0},/* VECTORCH LinImpulse */
282
283 {0,0,0},/* EULER AngVelocity */
284 {0,0,0},/* EULER AngImpulse */
285
286 NULL, /* struct collisionreport *CollisionReportPtr; */
287
288 {0,0,0},/* VECTORCH GravityDirection */
289 0, /* int TimeNotInContactWithFloor */
290
291 0,/* int Friction; */
292 0,/* int Elasticity; */
293 100, /* int Mass */
294
295 DYN_TYPE_NRBB_COLLISIONS,
296 TOPPLE_FORCE_NONE,
297
298 1,/* GravityOn :1; */
299 1,/* UseStandardGravity :1 - ie. in direction of increasing Y */
300 0,/* StopOnCollision :1; */
301 0,/* CanClimbStairs :1; */
302 1,/* IsStatic :1; */
303 0,/* OnlyCollideWithObjects :1; */
304 0,/* IsNetGhost :1; */
305 0,/* IgnoreSameObjectsAsYou :1; */
306 0,/* IgnoreThePlayer :1; */
307 0,/* UseDisplacement :1; */
308 0,/* OnlyCollideWithEnvironment :1; */
309
310 0,/* IsInContactWithFloor :1 */
311 0,/* IsInContactWithNearlyFlatFloor */
312 0,/* RequestsToStandUp :1 */
313 0,/* IsFloating :1 */
314 0,/* IsPickupObject :1 */
315 0,/* IsInanimate :1; */
316 0,/* IgnoresNotVisPolys :1; */
317 },
318 /* DYNAMICS_TEMPLATE_INANIMATE */
319 {
320 {0,0,0},/* EULER OrientEuler - Euler Orientation */
321 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH OrientMat - Local -> World Orientation Matrix */
322 {0,0,0},/* EULER PrevOrientEuler - Euler Orientation */
323 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH PrevOrientMat - Local -> World Orientation Matrix */
324
325 {0,0,0},/* VECTORCH Position */
326 {0,0,0},/* VECTORCH PrevPosition */
327
328 {0,0,0},/* VECTORCH LinVelocity */
329 {0,0,0},/* VECTORCH LinImpulse */
330
331 {0,0,0},/* EULER AngVelocity */
332 {0,0,0},/* EULER AngImpulse */
333
334 NULL, /* struct collisionreport *CollisionReportPtr; */
335
336 {0,0,0},/* VECTORCH GravityDirection */
337 0, /* int TimeNotInContactWithFloor */
338
339 1,/* int Friction; */
340 16384,/* int Elasticity; */
341 65536, /* int Mass */
342
343 DYN_TYPE_NRBB_COLLISIONS,
344 TOPPLE_FORCE_FULL,
345
346 1,/* GravityOn :1; */
347 1,/* UseStandardGravity :1 - ie. in direction of increasing Y */
348 0,/* StopOnCollision :1; */
349 0,/* CanClimbStairs :1; */
350 0,/* IsStatic :1; */
351 0,/* OnlyCollideWithObjects :1; */
352 0,/* IsNetGhost :1; */
353 0,/* IgnoreSameObjectsAsYou :1; */
354 0,/* IgnoreThePlayer :1; */
355 0,/* UseDisplacement :1; */
356 0,/* OnlyCollideWithEnvironment :1; */
357
358 0,/* IsInContactWithFloor :1 */
359 0,/* IsInContactWithNearlyFlatFloor */
360 0,/* RequestsToStandUp :1 */
361 0,/* IsFloating :1 */
362 0,/* IsPickupObject :1 */
363 1,/* IsInanimate :1; */
364 0,/* IgnoresNotVisPolys :1; */
365 },
366 /* DYNAMICS_TEMPLATE_PICKUPOBJECT */
367 {
368 {0,0,0},/* EULER OrientEuler - Euler Orientation */
369 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH OrientMat - Local -> World Orientation Matrix */
370 {0,0,0},/* EULER PrevOrientEuler - Euler Orientation */
371 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH PrevOrientMat - Local -> World Orientation Matrix */
372
373 {0,0,0},/* VECTORCH Position */
374 {0,0,0},/* VECTORCH PrevPosition */
375
376 {0,0,0},/* VECTORCH LinVelocity */
377 {0,0,0},/* VECTORCH LinImpulse */
378
379 {0,0,0},/* EULER AngVelocity */
380 {0,0,0},/* EULER AngImpulse */
381
382 NULL, /* struct collisionreport *CollisionReportPtr; */
383
384 {0,0,0},/* VECTORCH GravityDirection */
385 0, /* int TimeNotInContactWithFloor */
386
387 0,/* int Friction; */
388 16384,/* int Elasticity; */
389 20, /* int Mass */
390
391 DYN_TYPE_NRBB_COLLISIONS,
392 TOPPLE_FORCE_FULL,
393
394 0,/* GravityOn :1; */
395 1,/* UseStandardGravity :1 - ie. in direction of increasing Y */
396 0,/* StopOnCollision :1; */
397 0,/* CanClimbStairs :1; */
398 0,/* IsStatic :1; */
399 0,/* OnlyCollideWithObjects :1; */
400 0,/* IsNetGhost :1; */
401 0,/* IgnoreSameObjectsAsYou :1; */
402 0,/* IgnoreThePlayer :1; */
403 0,/* UseDisplacement :1; */
404 0,/* OnlyCollideWithEnvironment :1; */
405
406 0,/* IsInContactWithFloor :1 */
407 0,/* IsInContactWithNearlyFlatFloor */
408 0,/* RequestsToStandUp :1 */
409 0,/* IsFloating :1 */
410 1,/* IsPickupObject :1 */
411 0,/* IsInanimate :1; */
412 0,/* IgnoresNotVisPolys :1; */
413 },
414 /* DYNAMICS_TEMPLATE_SPRITE_NPC */
415 {
416 {0,0,0},/* EULER OrientEuler - Euler Orientation */
417 {0,0,0,0,0,0,0,0,0},/* MATRIXCH OrientMat - Local -> World Orientation Matrix */
418 {0,0,0},/* EULER PrevOrientEuler - Euler Orientation */
419 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH PrevOrientMat - Local -> World Orientation Matrix */
420
421 {0,0,0},/* VECTORCH Position */
422 {0,0,0},/* VECTORCH PrevPosition */
423
424 {0,0,0},/* VECTORCH LinVelocity */
425 {0,0,0},/* VECTORCH LinImpulse */
426
427 {0,0,0},/* EULER AngVelocity */
428 {0,0,0},/* EULER AngImpulse */
429
430 NULL, /* struct collisionreport *CollisionReportPtr; */
431
432 {0,65536,0},/* VECTORCH GravityDirection */
433 0, /* int TimeNotInContactWithFloor */
434
435 1,/* int Friction; */
436 0,/* int Elasticity; */
437 80*2, /* int Mass */
438
439 DYN_TYPE_NRBB_COLLISIONS,
440 TOPPLE_FORCE_NONE,
441
442 1,/* GravityOn :1; */
443 1,/* UseStandardGravity :1 - ie. in direction of increasing Y */
444 0,/* StopOnCollision :1; */
445 1,/* CanClimbStairs :1; */
446 0,/* IsStatic :1; */
447 0,/* OnlyCollideWithObjects :1; */
448 0,/* IsNetGhost :1; */
449 0,/* IgnoreSameObjectsAsYou :1; */
450 0,/* IgnoreThePlayer :1; */
451 0,/* UseDisplacement :1; */
452 0,/* OnlyCollideWithEnvironment :1; */
453
454 0,/* IsInContactWithFloor :1 */
455 0,/* IsInContactWithNearlyFlatFloor */
456 0,/* RequestsToStandUp :1 */
457 0,/* IsFloating :1 */
458 0,/* IsPickupObject :1 */
459 0,/* IsInanimate :1; */
460 0,/* IgnoresNotVisPolys :1; */
461 },
462 /* DYNAMICS_TEMPLATE_STATIC_SPRITE */
463 {
464 {0,0,0},/* EULER OrientEuler - Euler Orientation */
465 {0,0,0,0,0,0,0,0,0},/* MATRIXCH OrientMat - Local -> World Orientation Matrix */
466 {0,0,0},/* EULER PrevOrientEuler - Euler Orientation */
467 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH PrevOrientMat - Local -> World Orientation Matrix */
468
469 {0,0,0},/* VECTORCH Position */
470 {0,0,0},/* VECTORCH PrevPosition */
471
472 {0,0,0},/* VECTORCH LinVelocity */
473 {0,0,0},/* VECTORCH LinImpulse */
474
475 {0,0,0},/* EULER AngVelocity */
476 {0,0,0},/* EULER AngImpulse */
477
478 NULL, /* struct collisionreport *CollisionReportPtr; */
479
480 {0,65536,0},/* VECTORCH GravityDirection */
481 0, /* int TimeNotInContactWithFloor */
482
483 1,/* int Friction; */
484 0,/* int Elasticity; */
485 80*2, /* int Mass */
486
487 DYN_TYPE_SPRITE_COLLISIONS,
488 TOPPLE_FORCE_NONE,
489
490 1,/* GravityOn :1; */
491 1,/* UseStandardGravity :1 - ie. in direction of increasing Y */
492 0,/* StopOnCollision :1; */
493 1,/* CanClimbStairs :1; */
494 1,/* IsStatic :1; */
495 0,/* OnlyCollideWithObjects :1; */
496 0,/* IsNetGhost :1; */
497 0,/* IgnoreSameObjectsAsYou :1; */
498 0,/* IgnoreThePlayer :1; */
499 0,/* UseDisplacement :1; */
500 0,/* OnlyCollideWithEnvironment :1; */
501
502 0,/* IsInContactWithFloor :1 */
503 0,/* IsInContactWithNearlyFlatFloor */
504 0,/* RequestsToStandUp :1 */
505 0,/* IsFloating :1 */
506 0,/* IsPickupObject :1 */
507 0,/* IsInanimate :1; */
508 0,/* IgnoresNotVisPolys :1; */
509 },
510 /* DYNAMICS_TEMPLATE_PLATFORM_LIFT */
511 {
512 {0,0,0},/* EULER OrientEuler - Euler Orientation */
513 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH OrientMat - Local -> World Orientation Matrix */
514 {0,0,0},/* EULER PrevOrientEuler - Euler Orientation */
515 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH PrevOrientMat - Local -> World Orientation Matrix */
516
517 {0,0,0},/* VECTORCH Position */
518 {0,0,0},/* VECTORCH PrevPosition */
519
520 {0,0,0},/* VECTORCH LinVelocity */
521 {0,0,0},/* VECTORCH LinImpulse */
522
523 {0,0,0},/* EULER AngVelocity */
524 {0,0,0},/* EULER AngImpulse */
525
526 NULL, /* struct collisionreport *CollisionReportPtr; */
527
528 {0,0,0},/* VECTORCH GravityDirection */
529 0, /* int TimeNotInContactWithFloor */
530
531 0,/* int Friction; */
532 0,/* int Elasticity; */
533 1, /* int Mass */
534
535 DYN_TYPE_NRBB_COLLISIONS,
536 TOPPLE_FORCE_NONE,
537
538 0,/* GravityOn :1; */
539 1,/* UseStandardGravity :1 - ie. in direction of increasing Y */
540 1,/* StopOnCollision :1; */
541 0,/* CanClimbStairs :1; */
542 0,/* IsStatic :1; */
543 1,/* OnlyCollideWithObjects :1; */
544 0,/* IsNetGhost :1; */
545 0,/* IgnoreSameObjectsAsYou :1; */
546 0,/* IgnoreThePlayer :1; */
547 1,/* UseDisplacement :1; */
548 0,/* OnlyCollideWithEnvironment :1; */
549
550 0,/* IsInContactWithFloor :1 */
551 0,/* IsInContactWithNearlyFlatFloor */
552 0,/* RequestsToStandUp :1 */
553 0,/* IsFloating :1 */
554 0,/* IsPickupObject :1 */
555 0,/* IsInanimate :1; */
556 0,/* IgnoresNotVisPolys :1; */
557 },
558 /* DYNAMICS_TEMPLATE_ALIEN_DEBRIS */
559 {
560 {0,0,0},/* EULER OrientEuler - Euler Orientation */
561 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH OrientMat - Local -> World Orientation Matrix */
562 {0,0,0},/* EULER PrevOrientEuler - Euler Orientation */
563 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH PrevOrientMat - Local -> World Orientation Matrix */
564
565 {0,0,0},/* VECTORCH Position */
566 {0,0,0},/* VECTORCH PrevPosition */
567
568 {0,0,0},/* VECTORCH LinVelocity */
569 {0,0,0},/* VECTORCH LinImpulse */
570
571 {0,0,0},/* EULER AngVelocity */
572 {0,0,0},/* EULER AngImpulse */
573
574 NULL, /* struct collisionreport *CollisionReportPtr; */
575
576 {0,0,0},/* VECTORCH GravityDirection */
577 0, /* int TimeNotInContactWithFloor */
578
579 0,/* int Friction; */
580 0,/* int Elasticity; */
581 1, /* int Mass */
582
583 DYN_TYPE_NRBB_COLLISIONS,
584 TOPPLE_FORCE_NONE,
585
586 1,/* GravityOn :1; */
587 1,/* UseStandardGravity :1 - ie. in direction of increasing Y */
588 0,/* StopOnCollision :1; */
589 0,/* CanClimbStairs :1; */
590 0,/* IsStatic :1; */
591 0,/* OnlyCollideWithObjects :1; */
592 0,/* IsNetGhost :1; */
593 1,/* IgnoreSameObjectsAsYou :1; */
594 0,/* IgnoreThePlayer :1; */
595 0,/* UseDisplacement :1; */
596 1,/* OnlyCollideWithEnvironment :1; */
597
598 0,/* IsInContactWithFloor :1 */
599 0,/* IsInContactWithNearlyFlatFloor */
600 0,/* RequestsToStandUp :1 */
601 0,/* IsFloating :1 */
602 0,/* IsPickupObject :1 */
603 0,/* IsInanimate :1; */
604 0,/* IgnoresNotVisPolys :1; */
605 },
606 /* DYNAMICS_TEMPLATE_ACID_SMOKE */
607 {
608 {0,0,0},/* EULER OrientEuler - Euler Orientation */
609 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH OrientMat - Local -> World Orientation Matrix */
610 {0,0,0},/* EULER PrevOrientEuler - Euler Orientation */
611 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH PrevOrientMat - Local -> World Orientation Matrix */
612
613 {0,0,0},/* VECTORCH Position */
614 {0,0,0},/* VECTORCH PrevPosition */
615
616 {0,0,0},/* VECTORCH LinVelocity */
617 {0,0,0},/* VECTORCH LinImpulse */
618
619 {0,0,0},/* EULER AngVelocity */
620 {0,0,0},/* EULER AngImpulse */
621
622 NULL, /* struct collisionreport *CollisionReportPtr; */
623
624 {0,-ONE_FIXED,0},/* VECTORCH GravityDirection */
625 0, /* int TimeNotInContactWithFloor */
626
627 0,/* int Friction; */
628 0,/* int Elasticity; */
629 1, /* int Mass */
630
631 DYN_TYPE_NO_COLLISIONS,
632 TOPPLE_FORCE_NONE,
633
634 1,/* GravityOn :1; */
635 0,/* UseStandardGravity :1 - ie. in direction of increasing Y */
636 0,/* StopOnCollision :1; */
637 0,/* CanClimbStairs :1; */
638 0,/* IsStatic :1; */
639 0,/* OnlyCollideWithObjects :1; */
640 0,/* IsNetGhost :1; */
641 0,/* IgnoreSameObjectsAsYou :1; */
642 0,/* IgnoreThePlayer :1; */
643 0,/* UseDisplacement :1; */
644 0,/* OnlyCollideWithEnvironment :1; */
645
646 0,/* IsInContactWithFloor :1 */
647 0,/* IsInContactWithNearlyFlatFloor */
648 0,/* RequestsToStandUp :1 */
649 0,/* IsFloating :1 */
650 0,/* IsPickupObject :1 */
651 0,/* IsInanimate :1; */
652 0,/* IgnoresNotVisPolys :1; */
653 },
654 /* DYNAMICS_TEMPLATE_NET_GHOST */
655 {
656 {0,0,0},/* EULER OrientEuler - Euler Orientation */
657 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH OrientMat - Local -> World Orientation Matrix */
658 {0,0,0},/* EULER PrevOrientEuler - Euler Orientation */
659 {65536,0,0,0,65536,0,0,0,65536},/* MATRIXCH PrevOrientMat - Local -> World Orientation Matrix */
660
661 {0,0,0},/* VECTORCH Position */
662 {0,0,0},/* VECTORCH PrevPosition */
663
664 {0,0,0},/* VECTORCH LinVelocity */
665 {0,0,0},/* VECTORCH LinImpulse */
666
667 {0,0,0},/* EULER AngVelocity */
668 {0,0,0},/* EULER AngImpulse */
669
670 NULL, /* struct collisionreport *CollisionReportPtr; */
671
672 {0,0,0},/* VECTORCH GravityDirection */
673 0, /* int TimeNotInContactWithFloor */
674
675 0,/* int Friction; */
676 0,/* int Elasticity; */
677 100, /* int Mass */
678
679 DYN_TYPE_NRBB_COLLISIONS,
680 TOPPLE_FORCE_NONE,
681
682 1,/* GravityOn :1; */
683 1,/* UseStandardGravity :1 - ie. in direction of increasing Y */
684 0,/* StopOnCollision :1; */
685 0,/* CanClimbStairs :1; */
686 0,/* IsStatic :1; */
687 0,/* OnlyCollideWithObjects :1; */
688 1,/* IsNetGhost :1; */
689 0,/* IgnoreSameObjectsAsYou :1; */
690 0,/* IgnoreThePlayer :1; */
691 0,/* UseDisplacement :1; */
692 0,/* OnlyCollideWithEnvironment :1; */
693
694 0,/* IsInContactWithFloor :1 */
695 0,/* IsInContactWithNearlyFlatFloor */
696 0,/* RequestsToStandUp :1 */
697 0,/* IsFloating :1 */
698 0,/* IsPickupObject :1 */
699 0,/* IsInanimate :1; */
700 0,/* IgnoresNotVisPolys :1; */
701 },
702
703
704
705
706 };
707
708
709 /*KJL***************************************************************************
710 * FUNCTIONS TO ALLOCATE AND DEALLOCATE DYNAMICS BLOCKS - KJL 12:02:14 11/13/96 *
711 ***************************************************************************KJL*/
InitialiseDynamicsBlocks(void)712 void InitialiseDynamicsBlocks(void)
713 {
714 DYNAMICSBLOCK *freeBlockPtr = DynBlockStorage;
715 int blk;
716
717 for(blk=0; blk < MAX_NO_OF_DYNAMICS_BLOCKS; blk++)
718 {
719 FreeDynBlockList[blk] = freeBlockPtr++;
720 }
721
722 FreeDynBlockListPtr = &FreeDynBlockList[MAX_NO_OF_DYNAMICS_BLOCKS-1];
723 NumFreeDynBlocks = MAX_NO_OF_DYNAMICS_BLOCKS;
724 }
725
726
AllocateDynamicsBlock(enum DYNAMICS_TEMPLATE_ID templateID)727 DYNAMICSBLOCK* AllocateDynamicsBlock(enum DYNAMICS_TEMPLATE_ID templateID)
728 {
729 DYNAMICSBLOCK *dynPtr = 0; /* Default to null ptr */
730
731 if (NumFreeDynBlocks)
732 {
733 dynPtr = *FreeDynBlockListPtr--;
734 NumFreeDynBlocks--;
735 GLOBALASSERT(templateID>=0);
736 GLOBALASSERT(templateID<MAX_NO_OF_DYNAMICS_TEMPLATES);
737 *dynPtr = DynamicsTemplate[templateID];
738 }
739 else
740 {
741 /* unable to allocate a dynamics block I'm afraid;
742 MAX_NO_OF_DYNAMICS_BLOCKS is too low */
743 LOCALASSERT(NumFreeDynBlocks);
744 }
745
746 return dynPtr;
747 }
748
749
DeallocateDynamicsBlock(DYNAMICSBLOCK * dynPtr)750 void DeallocateDynamicsBlock(DYNAMICSBLOCK *dynPtr)
751 {
752 GLOBALASSERT(dynPtr);
753 *(++FreeDynBlockListPtr) = dynPtr;
754 NumFreeDynBlocks++;
755 }
756
757 /*KJL***************************************************************************
758 * FUNCTIONS TO INITIALISE & ALLOCATE COLLISION REPORTS - KJL 12:17:13 11/19/96 *
759 ***************************************************************************KJL*/
InitialiseCollisionReports(void)760 void InitialiseCollisionReports(void)
761 {
762 NumFreeCollisionReports = MAX_NO_OF_COLLISION_REPORTS;
763 }
764
765
AllocateCollisionReport(DYNAMICSBLOCK * dynPtr)766 COLLISIONREPORT* AllocateCollisionReport(DYNAMICSBLOCK* dynPtr)
767 {
768 COLLISIONREPORT *newReportPtr = 0; /* Default to null ptr */
769 GLOBALASSERT(dynPtr);
770
771 if (NumFreeCollisionReports)
772 {
773 NumFreeCollisionReports--;
774 newReportPtr = &CollisionReportStorage[NumFreeCollisionReports];
775
776 if (dynPtr->CollisionReportPtr) /* already some reports */
777 {
778 COLLISIONREPORT *reportPtr = dynPtr->CollisionReportPtr;
779
780 /* search for the last report */
781 while(reportPtr->NextCollisionReportPtr)
782 reportPtr = reportPtr->NextCollisionReportPtr;
783 reportPtr->NextCollisionReportPtr = newReportPtr;
784 }
785 else /* object's first report */
786 {
787 dynPtr->CollisionReportPtr = newReportPtr;
788 }
789
790 /* make report the end of the list */
791 newReportPtr->NextCollisionReportPtr=0;
792 }
793 else
794 {
795 /* unable to allocate a collision block I'm afraid */
796 LOCALASSERT(1==0);
797 }
798
799 return newReportPtr;
800 }
801
802