00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _OBJECT_H_
00018 #define _OBJECT_H_
00019
00020 #include "grid.h"
00021 #ifndef _PSX
00022 #include "light.h"
00023 #endif
00024 #ifdef _PC
00025 #include "sfx.h"
00026 #endif
00027 #include "control.h"
00028 #ifdef _N64
00029 #include "spark.h"
00030 #endif
00031
00032
00033
00034
00035
00036 #ifndef _PSX
00037 #define MAX_OBJECTS 128
00038 #else
00039 #define MAX_OBJECTS 8
00040 #endif
00041
00042 #define PLANET_SUN 11
00043 #define DRAGON_FIRE_NUM 50
00044 #define DISSOLVE_PARTICLE_SIZE 8.0f
00045 #ifdef _PC
00046 #define SUN_STAR_NUM 2048
00047 #define SUN_OVERLAY_NUM 4
00048 #endif
00049 #ifdef _N64
00050 #define SUN_STAR_NUM 512
00051 #define SUN_OVERLAY_NUM 3
00052 #endif
00053 #ifdef _PSX
00054 #define SUN_STAR_NUM 512
00055 #define SUN_OVERLAY_NUM 3
00056 #endif
00057 #define PICKUP_GEN_TIME 10.0f
00058
00059 #define SPLASH_POLY_NUM 150
00060
00061
00062
00063 enum {
00064 OBJECT_TYPE_CAR = -1,
00065
00066 OBJECT_TYPE_BARREL,
00067 OBJECT_TYPE_BEACHBALL,
00068 OBJECT_TYPE_PLANET,
00069 OBJECT_TYPE_PLANE,
00070 OBJECT_TYPE_COPTER,
00071 OBJECT_TYPE_DRAGON,
00072 OBJECT_TYPE_WATER,
00073 OBJECT_TYPE_TROLLEY,
00074 OBJECT_TYPE_BOAT,
00075 OBJECT_TYPE_SPEEDUP,
00076 OBJECT_TYPE_RADAR,
00077 OBJECT_TYPE_BALLOON,
00078 OBJECT_TYPE_HORSE,
00079 OBJECT_TYPE_TRAIN,
00080 OBJECT_TYPE_STROBE,
00081 OBJECT_TYPE_FOOTBALL,
00082 OBJECT_TYPE_SPARKGEN,
00083 OBJECT_TYPE_SPACEMAN,
00084
00085 OBJECT_TYPE_SHOCKWAVE,
00086 OBJECT_TYPE_FIREWORK,
00087 OBJECT_TYPE_PUTTYBOMB,
00088 OBJECT_TYPE_WATERBOMB,
00089 OBJECT_TYPE_ELECTROPULSE,
00090 OBJECT_TYPE_OILSLICK,
00091 OBJECT_TYPE_OILSLICK_DROPPER,
00092 OBJECT_TYPE_CHROMEBALL,
00093 OBJECT_TYPE_CLONE,
00094 OBJECT_TYPE_TURBO,
00095 OBJECT_TYPE_ELECTROZAPPED,
00096 OBJECT_TYPE_SPRING,
00097
00098 OBJECT_TYPE_PICKUP,
00099 OBJECT_TYPE_DISSOLVEMODEL,
00100 OBJECT_TYPE_FLAP,
00101 OBJECT_TYPE_LASER,
00102 OBJECT_TYPE_SPLASH,
00103 OBJECT_TYPE_BOMBGLOW,
00104
00105 OBJECT_TYPE_MAX
00106 };
00107
00108 enum {
00109 PICKUP_NONE = -1,
00110 PICKUP_SHOCKWAVE = 0,
00111 PICKUP_FIREWORK,
00112 PICKUP_FIREWORKPACK,
00113 PICKUP_PUTTYBOMB,
00114 PICKUP_WATERBOMB,
00115 PICKUP_ELECTROPULSE,
00116 PICKUP_OILSLICK,
00117 PICKUP_CHROMEBALL,
00118 PICKUP_TURBO,
00119
00120 PICKUP_NUM
00121 };
00122
00123
00124
00125
00126
00127
00128
00129 typedef void (*CON_HANDLER)(CTRL *Control, void *Object);
00130 typedef void (*CTRL_HANDLER)(CTRL *Control);
00131 typedef void (*MOVE_HANDLER)(void *Object);
00132 typedef void (*COLL_HANDLER)(void *Object);
00133 typedef void (*AI_HANDLER)(void *Object);
00134 typedef void (*RENDER_HANDLER)(void *Object);
00135 typedef void (*FREE_HANDLER)(void *Object);
00136
00137
00138
00139 struct objflags
00140 {
00141 unsigned long
00142 Draw : 1,
00143 Move : 1,
00144 IsInGrid : 1;
00145 };
00146
00147
00148
00149
00150 struct renderflags
00151 {
00152 unsigned long
00153 envmap : 1,
00154 envonly : 1,
00155 light : 1,
00156 litsimple : 1,
00157 reflect : 1,
00158 fog : 1,
00159 visible : 1,
00160 glare : 1,
00161 meshfx : 1;
00162 };
00163
00164
00165
00166
00167 struct PlayerStruct;
00168 struct ForceFieldStruct;
00169 struct SparkGenStruct;
00170
00171
00172 typedef struct object_def
00173 {
00174 NEWBODY body;
00175
00176 long Type;
00177 long priority;
00178 long ObjID;
00179
00180 struct objflags flag;
00181 struct renderflags renderflag;
00182
00183 struct PlayerStruct *player;
00184 struct object_def *objref;
00185 struct object_def *creator;
00186
00187 struct object_def *carcoll[MAX_NUM_PLAYERS];
00188 struct object_def *objcoll;
00189
00190 long EnvRGB;
00191 long DefaultModel;
00192 long CollType;
00193
00194 struct ForceFieldStruct *Field;
00195 long FieldPriority;
00196
00197 #ifndef _PSX
00198 LIGHT *Light;
00199 #endif
00200 #ifndef _PSX
00201 #ifndef _CARCONV
00202 struct SparkGenStruct *SparkGen;
00203
00204 #ifdef _PC
00205 SAMPLE_3D *Sfx3D;
00206 #endif
00207 #endif
00208 #endif
00209 void *Data;
00210
00211 MOVE_HANDLER movehandler;
00212 COLL_HANDLER collhandler;
00213 AI_HANDLER aihandler;
00214 RENDER_HANDLER renderhandler;
00215 FREE_HANDLER freehandler;
00216
00217 struct object_def *prev;
00218 struct object_def *next;
00219
00220 unsigned short GridX[MAX_GRIDS];
00221 unsigned short GridZ[MAX_GRIDS];
00222
00223 struct object_def *GridPrev[MAX_GRIDS];
00224 struct object_def *GridNext[MAX_GRIDS];
00225
00226 } OBJECT;
00227
00229
00231 typedef struct PairCollInfoStruct {
00232 unsigned int Tested : 1;
00233 unsigned int Collided : 1;
00234 } PAIRCOLLINFO;
00235
00236 #define ClearPairInfo(obj1, obj2) \
00237 { \
00238 OBJ_PairCollInfo[(obj1)->ObjID][(obj2)->ObjID].Tested = 0; \
00239 OBJ_PairCollInfo[(obj1)->ObjID][(obj2)->ObjID].Collided = 0; \
00240 OBJ_PairCollInfo[(obj2)->ObjID][(obj1)->ObjID].Tested = 0; \
00241 OBJ_PairCollInfo[(obj2)->ObjID][(obj1)->ObjID].Collided = 0; \
00242 }
00243
00244 #define SetPairTested(obj1, obj2) \
00245 { \
00246 OBJ_PairCollInfo[(obj1)->ObjID][(obj2)->ObjID].Tested = 1; \
00247 OBJ_PairCollInfo[(obj2)->ObjID][(obj1)->ObjID].Tested = 1; \
00248 }
00249
00250 #define SetPairCollided(obj1, obj2) \
00251 { \
00252 OBJ_PairCollInfo[(obj1)->ObjID][(obj2)->ObjID].Collided = 1; \
00253 OBJ_PairCollInfo[(obj2)->ObjID][(obj1)->ObjID].Collided = 1; \
00254 }
00255
00256 #define IsPairCollided(obj1, obj2) (OBJ_PairCollInfo[(obj1)->ObjID][(obj2)->ObjID].Collided == 1)
00257 #define IsPairTested(obj1, obj2) (OBJ_PairCollInfo[(obj1)->ObjID][(obj2)->ObjID].Tested == 1)
00258
00259
00261
00262
00263
00264 extern OBJECT *OBJ_ObjectList;
00265 extern OBJECT *OBJ_ObjectHead;
00266 extern OBJECT *OBJ_ObjectTail;
00267 extern long OBJ_NumObjects;
00268 extern PAIRCOLLINFO OBJ_PairCollInfo[MAX_OBJECTS][MAX_OBJECTS];
00269
00270
00271
00272
00273
00274
00275 extern long OBJ_InitObjSys(void);
00276 extern void OBJ_KillObjSys(void);
00277 extern OBJECT *OBJ_AllocObject(void);
00278 extern OBJECT *OBJ_ReplaceObject(void);
00279 extern long OBJ_FreeObject(OBJECT *Obj);
00280
00281 extern void ClearActivePairInfo();
00282 extern void ClearAllPairInfo();
00283 extern void ClearThisObjPairInfo(OBJECT *obj2);
00284
00285
00286 #endif