Subversion Repositories Games.Carmageddon

Rev

Rev 1 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 pmbaty 1
#ifndef _CAR_H_
2
#define _CAR_H_
3
 
4
#include "dr_types.h"
5
 
6
#define CAR_MAX_SIMPLIFICATION_LEVEL 4
7
 
8
extern int gDoing_physics;
9
extern br_scalar gDt;
18 pmbaty 10
extern int gCollision_detection_on__car;                  // suffix added to avoid duplicate symbol
11
extern br_vector3 gGround_normal__car;                    // suffix added to avoid duplicate symbol
1 pmbaty 12
extern void (*ControlCar__car[6])(tCar_spec*, br_scalar); // suffix added to avoid duplicate symbol
18 pmbaty 13
extern int gControl__car;                                 // suffix added to avoid duplicate symbol
14
extern int gFace_num__car;                                // suffix added to avoid duplicate symbol
15
extern br_angle gOld_yaw__car;                            // suffix added to avoid duplicate symbol
1 pmbaty 16
extern br_angle gOld_zoom;
17
extern br_vector3 gCamera_pos_before_collide;
18
extern int gMetal_crunch_sound_id__car[5]; // suffix added to avoid duplicate symbol
19
extern int gMetal_scrape_sound_id__car[3]; // suffix added to avoid duplicate symbol
20
extern int gCar_car_collisions;
21
extern int gFreeze_mechanics;
22
extern tU32 gLast_cunning_stunt;
23
extern tU32 gWild_start;
24
extern tU32 gQuite_wild_start;
25
extern tU32 gQuite_wild_end;
26
extern tU32 gOn_me_wheels_start;
27
extern int gWoz_upside_down_at_all;
28
extern tS3_sound_tag gSkid_tag[2];
29
extern tCar_spec* gLast_car_to_skid[2];
30
extern int gEliminate_faces;
31
extern br_vector3 gZero_v__car; // suffix added to avoid duplicate symbol
32
extern tU32 gSwitch_time;
33
extern tSave_camera gSave_camera[2];
34
extern tU32 gLast_mechanics_time;
35
extern int gOpponent_viewing_mode;
36
extern int gNet_player_to_view_index;
37
extern int gDouble_pling_water;
38
extern int gStop_opponents_moving;
39
extern float gDefensive_powerup_factor[6];
40
extern float gOffensive_powerup_factor[6];
41
extern float gEngine_powerup_factor[6];
42
extern br_angle gPanning_camera_angle;
43
extern br_scalar gPanning_camera_height;
44
extern int gFace_count;
45
extern float gCar_simplification_factor[2][5];
46
extern int gCar_simplification_level;
47
extern int gNum_active_non_cars;
48
extern int gCamera_has_collided;
49
extern tFace_ref gFace_list__car[150]; // suffix added to avoid duplicate symbol
50
extern tNon_car_spec* gActive_non_car_list[50];
51
extern int gOver_shoot;
52
extern br_scalar gMin_world_y;
53
extern br_scalar gAccel;
54
extern br_vector3 gAverage_grid_position;
55
extern br_actor* gPed_actor;
56
extern int gCollision_count;
57
extern int gCamera_frozen;
58
extern int gMaterial_index;
59
extern int gInTheSea;
60
extern int gCamera_mode;
18 pmbaty 61
extern br_scalar gOur_yaw__car;            // suffix added to avoid duplicate symbol
62
extern br_scalar gGravity__car;            // suffix added to avoid duplicate symbol
1 pmbaty 63
extern br_vector3 gNew_ground_normal__car; // suffix added to avoid duplicate symbol
64
extern char gNon_car_spec_list[100];
65
extern tU32 gMechanics_time_sync;
66
extern int gNum_cars_and_non_cars;
67
 
68
void DamageUnit(tCar_spec* pCar, int pUnit_type, int pDamage_amount);
69
 
70
void DamageUnitWithSmoke(tCar_spec* pCar, int pUnit_type, int pDamage_amount);
71
 
72
void DamageEngine(int pDamage_amount);
73
 
74
void DamageTrans(int pDamage_amount);
75
 
76
void DamageSteering(int pDamage_amount);
77
 
78
void DamageLFWheel(int pDamage_amount);
79
 
80
void DamageLFBrake(int pDamage_amount);
81
 
82
void DamageLRBrake(int pDamage_amount);
83
 
84
void DamageLRWheel(int pDamage_amount);
85
 
86
void DamageRFWheel(int pDamage_amount);
87
 
88
void DamageRFBrake(int pDamage_amount);
89
 
90
void DamageRRBrake(int pDamage_amount);
91
 
92
void DamageRRWheel(int pDamage_amount);
93
 
94
void CalculatePlaneNormal(br_vector3* pP1, br_vector3* pP2, br_vector3* pP3, br_vector3* pNormal);
95
 
96
void CalculateGroundNormal(br_model* pThe_model, int pFace_index);
97
 
98
void ChangeYCoordinate(br_scalar pNew_y, tU32 pTime_taken, br_model* pThe_model, int pFace_index);
99
 
100
void SwitchCarActor(tCar_spec* pCar_spec, int pModel_index);
101
 
102
void InitialiseCar2(tCar_spec* pCar, int pClear_disabled_flag);
103
 
104
void InitialiseCar(tCar_spec* pCar);
105
 
106
void InitialiseCarsEtc(tRace_info* pThe_race);
107
 
108
void GetAverageGridPosition(tRace_info* pThe_race);
109
 
110
void SetInitialPosition(tRace_info* pThe_race, int pCar_index, int pGrid_index);
111
 
112
void SetInitialPositions(tRace_info* pThe_race);
113
 
114
void InitialiseNonCar(tNon_car_spec* non_car);
115
 
116
void GetFacesInBox(tCollision_info* c);
117
 
118
int IsCarInTheSea(void);
119
 
120
void RememberSafePosition(tCar_spec* car, tU32 pTime);
121
 
122
void ControlOurCar(tU32 pTime_difference);
123
 
124
void CalcEngineForce(tCar_spec* c, br_scalar dt);
125
 
126
void PrepareCars(tU32 pFrame_start_time);
127
 
128
void FinishCars(tU32 pLast_frame_time, tU32 pTime);
129
 
130
void InterpolateCars(tU32 pLast_frame_time, tU32 pTime);
131
 
132
void ResetOldmat(void);
133
 
134
void GetNonCars(void);
135
 
136
void GetNetPos(tCar_spec* pCar);
137
 
138
void ApplyPhysicsToCars(tU32 last_frame_time, tU32 pTime_difference);
139
 
140
void MungeSpecialVolume(tCollision_info* pCar);
141
 
142
void ResetCarSpecialVolume(tCollision_info* pCar);
143
 
144
void TestAutoSpecialVolume(tCollision_info* pCar);
145
 
146
void MoveAndCollideCar(tCar_spec* car, br_scalar dt);
147
 
148
void MoveAndCollideNonCar(tNon_car_spec* non_car, br_scalar dt);
149
 
150
int CollideCarWithWall(tCollision_info* car, br_scalar dt);
151
 
152
void ToggleControls(void);
153
 
154
void ControlCar2(tCar_spec* c, br_scalar dt);
155
 
156
void ControlCar3(tCar_spec* c, br_scalar dt);
157
 
158
void ControlCar4(tCar_spec* c, br_scalar dt);
159
 
160
void ControlCar5(tCar_spec* c, br_scalar dt);
161
 
162
void ControlCar1(tCar_spec* c, br_scalar dt);
163
 
164
void setrotate(br_vector3* wdt, br_matrix34* m);
165
 
166
void RotateCar2(tCollision_info* c, br_scalar dt);
167
 
168
void RotateCarSecondOrder(tCollision_info* c, br_scalar dt);
169
 
170
void RotateCarFirstOrder(tCollision_info* c, br_scalar dt);
171
 
172
void SimpleRotate(tCollision_info* c, br_scalar dt);
173
 
174
void RotateCar(tCollision_info* c, br_scalar dt);
175
 
176
void SteeringSelfCentre(tCar_spec* c, br_scalar dt, br_vector3* n);
177
 
178
void NonCarCalcForce(tNon_car_spec* nc, br_scalar dt);
179
 
180
void AddDrag(tCar_spec* c, br_scalar dt);
181
 
182
void DoBumpiness(tCar_spec* c, br_vector3* wheel_pos, br_vector3* norm, br_scalar* d, int n);
183
 
184
void CalcForce(tCar_spec* c, br_scalar dt);
185
 
186
void DoRevs(tCar_spec* c, br_scalar dt);
187
 
188
void ApplyTorque(tCar_spec* c, br_vector3* tdt);
189
 
190
void TranslateCar(tCollision_info* c, br_scalar dt);
191
 
192
int CollCheck(tCollision_info* c, br_scalar dt);
193
 
194
br_scalar AddFriction(tCollision_info* c, br_vector3* vel, br_vector3* normal_force, br_vector3* pos, br_scalar total_force, br_vector3* max_friction);
195
 
196
void AddFrictionCarToCar(tCollision_info* car1, tCollision_info* car2, br_vector3* vel1, br_vector3* vel2, br_vector3* normal_force1, br_vector3* pos1, br_vector3* pos2, br_scalar total_force, br_vector3* max_friction);
197
 
198
void ScrapeNoise(br_scalar vel, br_vector3* position, int material);
199
 
200
void SkidNoise(tCar_spec* pC, int pWheel_num, br_scalar pV, int material);
201
 
202
void StopSkid(tCar_spec* pC);
203
 
204
void CrashNoise(br_vector3* pForce, br_vector3* position, int material);
205
 
206
void CrushAndDamageCar(tCar_spec* c, br_vector3* pPosition, br_vector3* pForce_car_space, tCar_spec* car2);
207
 
208
int ExpandBoundingBox(tCar_spec* c);
209
 
210
void CrushBoundingBox(tCar_spec* c, int crush_only);
211
 
212
void AddCollPoint(br_scalar dist, br_vector3* p, br_vector3* norm, br_vector3* r, br_vector3* n, br_vector3* dir, int num, tCollision_info* c);
213
 
214
br_scalar SinglePointColl(br_scalar* f, br_matrix4* m, br_scalar* d);
215
 
216
br_scalar TwoPointColl(br_scalar* f, br_matrix4* m, br_scalar* d, br_vector3* tau, br_vector3* n);
217
 
218
br_scalar DrMatrix4Inverse(br_matrix4* mi, br_matrix4* mc);
219
 
220
br_scalar ThreePointColl(br_scalar* f, br_matrix4* m, br_scalar* d);
221
 
222
br_scalar ThreePointCollRec(br_scalar* f, br_matrix4* m, br_scalar* d, br_vector3* tau, br_vector3* n, tCollision_info* c);
223
 
224
br_scalar FourPointColl(br_scalar* f, br_matrix4* m, br_scalar* d, br_vector3* tau, br_vector3* n, tCollision_info* c);
225
 
226
void MultiFindFloorInBoxM(int pNum_rays, br_vector3* a, br_vector3* b, br_vector3* nor, br_scalar* d, tCar_spec* c, int* mat_ref);
227
 
228
void MultiFindFloorInBoxBU(int pNum_rays, br_vector3* a, br_vector3* b, br_vector3* nor, br_scalar* d, tCar_spec* c, int* mat_ref);
229
 
230
void findfloor(br_vector3* a, br_vector3* b, br_vector3* nor, br_scalar* d);
231
 
232
int FindFloorInBoxM(br_vector3* a, br_vector3* b, br_vector3* nor, br_scalar* d, tCollision_info* c);
233
 
234
int FindFloorInBoxBU(br_vector3* a, br_vector3* b, br_vector3* nor, br_scalar* d, tCollision_info* c);
235
 
236
int FindFloorInBoxBU2(br_vector3* a, br_vector3* b, br_vector3* nor, br_scalar* d, tCollision_info* c);
237
 
238
int FindFloorInBoxM2(br_vector3* a, br_vector3* b, br_vector3* nor, br_scalar* d, tCollision_info* c);
239
 
240
int BoxFaceIntersect(br_bounds* pB, br_matrix34* pM, br_matrix34* pMold, br_vector3* pPoint_list, br_vector3* pNorm_list, br_scalar* pDist_list, int pMax_pnts, tCollision_info* c);
241
 
242
int AddEdgeCollPoints(br_vector3* p1, br_vector3* p2, br_bounds* pB, br_matrix34* pMold, br_vector3* pPoint_list, br_vector3* pNorm_list, int n, int pMax_pnts, tCollision_info* c);
243
 
244
void GetPlaneNormal(br_vector3* n, int p);
245
 
246
int GetBoundsEdge(br_vector3* pos, br_vector3* edge, br_bounds* pB, int plane1, int plane2, br_vector3* a, br_vector3* b, br_vector3* c, int flag);
247
 
248
void oldMoveOurCar(tU32 pTime_difference);
249
 
250
void ToggleCollisionDetection(void);
251
 
252
void CancelPendingCunningStunt(void);
253
 
254
float frac(float pN);
255
 
256
void SetAmbientPratCam(tCar_spec* pCar);
257
 
258
void MungeCarGraphics(tU32 pFrame_period);
259
 
260
void ResetCarScreens(void);
261
 
262
tCar_spec* GetRaceLeader(void);
263
 
264
void AmIGettingBoredWatchingCameraSpin(void);
265
 
266
void ViewNetPlayer(void);
267
 
268
void ViewOpponent(void);
269
 
270
void ToggleCarToCarCollisions(void);
271
 
272
void SwapCar(void);
273
 
274
void AdjustDownForce(void);
275
 
276
void FreezeMechanics(void);
277
 
278
void PutOpponentsInNeutral(void);
279
 
280
void SetPanningFieldOfView(void);
281
 
282
void CheckDisablePlingMaterials(tCar_spec* pCar);
283
 
284
void PositionExternalCamera(tCar_spec* c, tU32 pTime);
285
 
286
void CameraBugFix(tCar_spec* c, tU32 pTime);
287
 
288
int PossibleRemoveNonCarFromWorld(br_actor* pActor);
289
 
290
void PutNonCarBackInWorld(br_actor* pActor);
291
 
292
int IncidentCam(tCar_spec* c, tU32 pTime);
293
 
294
int MoveCamToIncident(tCar_spec* c, tIncident_type* type, float* severity, tIncident_info* info, tU32* next_incident_time);
295
 
296
void PanningExternalCamera(tCar_spec* c, tU32 pTime);
297
 
298
int CheckForWall(br_vector3* start, br_vector3* end);
299
 
300
void SetUpPanningCamera(tCar_spec* c);
301
 
302
void SaveCameraPosition(int i);
303
 
304
void RestoreCameraPosition(int i);
305
 
306
void NormalPositionExternalCamera(tCar_spec* c, tU32 pTime);
307
 
308
void MoveWithWheels(tCar_spec* c, br_vector3* vn, int manual_swing);
309
 
310
void SwingCamera(tCar_spec* c, br_matrix34* m1, br_matrix34* m2, br_vector3* vn, tU32 pTime);
311
 
312
void PointCameraAtCar(tCar_spec* c, br_matrix34* m1, br_matrix34* m2);
313
 
314
void PointCamera(br_vector3* pos, br_matrix34* m2);
315
 
316
int CollideCamera2(br_vector3* car_pos, br_vector3* cam_pos, br_vector3* old_camera_pos, int manual_move);
317
 
318
int BoundsTest(br_bounds* bnds, br_vector3* p);
319
 
320
int CollideCameraWithOtherCars(br_vector3* car_pos, br_vector3* cam_pos);
321
 
322
void InitialiseExternalCamera(void);
323
 
324
void FreezeCamera(void);
325
 
326
void FlyCar(tCar_spec* c, br_scalar dt);
327
 
328
void DrVector3RotateY(br_vector3* v, br_angle t);
329
 
330
void CrashCarsTogether(br_scalar dt);
331
 
332
int CrashCarsTogetherSinglePass(br_scalar dt, int pPass, tCollison_data* collide_list);
333
 
334
void BringCarToAGrindingHalt(tCollision_info* car);
335
 
336
int BoundsOverlapTest_car(br_bounds* b1, br_bounds* b2);
337
 
338
int SimpleCarCarCollisionTest(tCollision_info* car1, tCollision_info* car2);
339
 
340
int CollideTwoCarsWithWalls(tCollision_info* car1, tCollision_info* car2, br_scalar dt);
341
 
342
int CollideTwoCarsRepeatedly(tCollision_info* car1, tCollision_info* car2, br_scalar dt);
343
 
344
int CollideTwoCars(tCollision_info* car1, tCollision_info* car2, int pPass);
345
 
346
int GetEdgeEdgeCollisions(br_bounds* pB1, br_bounds* pB2, br_matrix34* pM21, br_matrix34* pM12, br_matrix34* pMo21, br_matrix34* pMo12, br_matrix34* pM1o1, br_vector3* pPoint_list, br_vector3* pNorm_list, int pMax);
347
 
348
int FacePointCarCarCollide(tCollision_info* car1, tCollision_info* car2, br_matrix34* pMms, br_matrix34* pMoms, br_matrix34* pMsos, br_vector3* pPoint_list, br_vector3* pNorm_list, int pMax, int order);
349
 
350
void MungeCarsMass(tCollision_info* pCar, br_scalar pFactor);
351
 
352
void ModifyCarsMass(tCollision_info* pCar_1, tCollision_info* pCar_2);
353
 
354
void ResetCarsMass(tCollision_info* pCar_1, tCollision_info* pCar_2);
355
 
356
int DoCollide(tCollision_info* car1, tCollision_info* car2, br_vector3* r, br_vector3* n, int k, int pPass, br_matrix34* mat1_to_mat2);
357
 
358
br_scalar TwoPointCollB(br_scalar* f, br_matrix4* m, br_scalar* d, br_vector3* tau, br_vector3* n);
359
 
360
br_scalar ThreePointCollRecB(br_scalar* f, br_matrix4* m, br_scalar* d, br_vector3* tau, br_vector3* n);
361
 
362
br_scalar FourPointCollB(br_scalar* f, br_matrix4* m, br_scalar* d, br_vector3* tau, br_vector3* n);
363
 
364
int TestForNan(float* f);
365
 
366
void CheckCameraHither(void);
367
 
368
void SetCarSuspGiveAndHeight(tCar_spec* pCar, br_scalar pFront_give_factor, br_scalar pRear_give_factor, br_scalar pDamping_factor, br_scalar pExtra_front_height, br_scalar pExtra_rear_height);
369
 
370
int TestForCarInSensiblePlace(tCar_spec* car);
371
 
372
int TestOldMats(tCollision_info* c1, tCollision_info* c2, int newmats);
373
 
374
int PullActorFromWorld(br_actor* pActor);
375
 
376
int DoPullActorFromWorld(br_actor* pActor);
377
 
378
void CheckForDeAttachmentOfNonCars(tU32 pTime);
379
 
380
void AdjustNonCar(br_actor* pActor, br_matrix34* pMat);
381
 
382
void PipeSingleNonCar(tCollision_info* c);
383
 
384
int GetPrecalculatedFacesUnderCar(tCar_spec* pCar, tFace_ref** pFace_refs);
385
 
386
br_material* SomeNearbyMaterial(void);
387
 
388
#endif