00001 #ifndef __BG_VEHICLES_H 00002 #define __BG_VEHICLES_H 00003 00004 #include "q_shared.h" 00005 00006 typedef struct Vehicle_s Vehicle_t; 00007 typedef struct bgEntity_s bgEntity_t; 00008 00009 typedef enum 00010 { 00011 VH_NONE = 0, //0 just in case anyone confuses VH_NONE and VEHICLE_NONE below 00012 VH_WALKER, //something you ride inside of, it walks like you, like an AT-ST 00013 VH_FIGHTER, //something you fly inside of, like an X-Wing or TIE fighter 00014 VH_SPEEDER, //something you ride on that hovers, like a speeder or swoop 00015 VH_ANIMAL, //animal you ride on top of that walks, like a tauntaun 00016 VH_FLIER, //animal you ride on top of that flies, like a giant mynoc? 00017 VH_NUM_VEHICLES 00018 } vehicleType_t; 00019 00020 typedef enum 00021 { 00022 WPOSE_NONE = 0, 00023 WPOSE_BLASTER, 00024 WPOSE_SABERLEFT, 00025 WPOSE_SABERRIGHT, 00026 } EWeaponPose; 00027 00028 #include "../namespace_begin.h" 00029 extern stringID_table_t VehicleTable[VH_NUM_VEHICLES+1]; 00030 #include "../namespace_end.h" 00031 00032 //=========================================================================================================== 00033 //START VEHICLE WEAPONS 00034 //=========================================================================================================== 00035 typedef struct 00036 { 00037 //*** IMPORTANT!!! *** the number of variables in the vehWeaponStats_t struct (including all elements of arrays) must be reflected by NUM_VWEAP_PARMS!!! 00038 //*** IMPORTANT!!! *** vWeapFields table correponds to this structure! 00039 char *name; 00040 qboolean bIsProjectile; //traceline or entity? 00041 qboolean bHasGravity; //if a projectile, drops 00042 qboolean bIonWeapon;//disables ship shields and sends them out of control 00043 qboolean bSaberBlockable;//lightsabers can deflect this projectile 00044 int iMuzzleFX; //index of Muzzle Effect 00045 int iModel; //handle to the model used by this projectile 00046 int iShotFX; //index of Shot Effect 00047 int iImpactFX; //index of Impact Effect 00048 int iG2MarkShaderHandle; //index of shader to use for G2 marks made on other models when hit by this projectile 00049 float fG2MarkSize;//size (diameter) of the ghoul2 mark 00050 int iLoopSound; //index of loopSound 00051 float fSpeed; //speed of projectile/range of traceline 00052 float fHoming; //0.0 = not homing, 0.5 = half vel to targ, half cur vel, 1.0 = all vel to targ 00053 float fHomingFOV; //missile will lose lock on if DotProduct of missile direction and direction to target ever drops below this (-1 to 1, -1 = never lose target, 0 = lose if ship gets behind missile, 1 = pretty much will lose it's target right away) 00054 int iLockOnTime; //0 = no lock time needed, else # of ms needed to lock on 00055 int iDamage; //damage done when traceline or projectile directly hits target 00056 int iSplashDamage;//damage done to ents in splashRadius of end of traceline or projectile origin on impact 00057 float fSplashRadius;//radius that ent must be in to take splashDamage (linear fall-off) 00058 int iAmmoPerShot; //how much "ammo" each shot takes 00059 int iHealth; //if non-zero, projectile can be shot, takes this much damage before being destroyed 00060 float fWidth; //width of traceline or bounding box of projecile (non-rotating!) 00061 float fHeight; //height of traceline or bounding box of projecile (non-rotating!) 00062 int iLifeTime; //removes itself after this amount of time 00063 qboolean bExplodeOnExpire; //when iLifeTime is up, explodes rather than simply removing itself 00064 } vehWeaponInfo_t; 00065 //NOTE: this MUST stay up to date with the number of variables in the vehFields table!!! 00066 #define NUM_VWEAP_PARMS 25 00067 00068 #define VWFOFS(x) ((int)&(((vehWeaponInfo_t *)0)->x)) 00069 00070 #define MAX_VEH_WEAPONS 16 //sigh... no more than 16 different vehicle weapons 00071 #define VEH_WEAPON_BASE 0 00072 #define VEH_WEAPON_NONE -1 00073 00074 #include "../namespace_begin.h" 00075 extern vehWeaponInfo_t g_vehWeaponInfo[MAX_VEH_WEAPONS]; 00076 extern int numVehicleWeapons; 00077 #include "../namespace_end.h" 00078 00079 //=========================================================================================================== 00080 //END VEHICLE WEAPONS 00081 //=========================================================================================================== 00082 00083 #define MAX_VEHICLE_MUZZLES 12 00084 #define MAX_VEHICLE_EXHAUSTS 12 00085 #define MAX_VEHICLE_WEAPONS 2 00086 #define MAX_VEHICLE_TURRETS 2 00087 #define MAX_VEHICLE_TURRET_MUZZLES 2 00088 00089 typedef struct 00090 { 00091 int iWeapon; //what vehWeaponInfo index to use 00092 int iDelay; //delay between turret muzzle shots 00093 int iAmmoMax; //how much ammo it has 00094 int iAmmoRechargeMS; //how many MS between every point of recharged ammo 00095 char *yawBone; //bone on ship that this turret uses to yaw 00096 char *pitchBone; //bone on ship that this turret uses to pitch 00097 int yawAxis; //axis on yawBone to which we should to apply the yaw angles 00098 int pitchAxis; //axis on pitchBone to which we should to apply the pitch angles 00099 float yawClampLeft; //how far the turret is allowed to turn left 00100 float yawClampRight; //how far the turret is allowed to turn right 00101 float pitchClampUp; //how far the turret is allowed to title up 00102 float pitchClampDown; //how far the turret is allowed to tilt down 00103 int iMuzzle[MAX_VEHICLE_TURRET_MUZZLES];//iMuzzle-1 = index of ship's muzzle to fire this turret's 1st and 2nd shots from 00104 char *gunnerViewTag;//Where to put the view origin of the gunner (name) 00105 float fTurnSpeed; //how quickly the turret can turn 00106 qboolean bAI; //whether or not the turret auto-targets enemies when it's not manned 00107 qboolean bAILead;//whether 00108 float fAIRange; //how far away the AI will look for enemies 00109 int passengerNum;//which passenger, if any, has control of this turret (overrides AI) 00110 } turretStats_t; 00111 00112 typedef struct 00113 { 00114 //*** IMPORTANT!!! *** See note at top of next structure!!! *** 00115 // Weapon stuff. 00116 int ID;//index into the weapon data 00117 // The delay between shots for each weapon. 00118 int delay; 00119 // Whether or not all the muzzles for each weapon can be linked together (linked delay = weapon delay * number of muzzles linked!) 00120 int linkable; 00121 // Whether or not to auto-aim the projectiles/tracelines at the thing under the crosshair when we fire 00122 qboolean aimCorrect; 00123 //maximum ammo 00124 int ammoMax; 00125 //ammo recharge rate - milliseconds per unit (minimum of 100, which is 10 ammo per second) 00126 int ammoRechargeMS; 00127 //sound to play when out of ammo (plays default "no ammo" sound if none specified) 00128 int soundNoAmmo; 00129 } vehWeaponStats_t; 00130 00131 typedef struct 00132 { 00133 //*** IMPORTANT!!! *** vehFields table correponds to this structure! 00134 char *name; //unique name of the vehicle 00135 00136 //general data 00137 vehicleType_t type; //what kind of vehicle 00138 int numHands; //if 2 hands, no weapons, if 1 hand, can use 1-handed weapons, if 0 hands, can use 2-handed weapons 00139 float lookPitch; //How far you can look up and down off the forward of the vehicle 00140 float lookYaw; //How far you can look left and right off the forward of the vehicle 00141 float length; //how long it is - used for body length traces when turning/moving? 00142 float width; //how wide it is - used for body length traces when turning/moving? 00143 float height; //how tall it is - used for body length traces when turning/moving? 00144 vec3_t centerOfGravity;//offset from origin: {forward, right, up} as a modifier on that dimension (-1.0f is all the way back, 1.0f is all the way forward) 00145 00146 //speed stats 00147 float speedMax; //top speed 00148 float turboSpeed; //turbo speed 00149 float speedMin; //if < 0, can go in reverse 00150 float speedIdle; //what speed it drifts to when no accel/decel input is given 00151 float accelIdle; //if speedIdle > 0, how quickly it goes up to that speed 00152 float acceleration; //when pressing on accelerator 00153 float decelIdle; //when giving no input, how quickly it drops to speedIdle 00154 float throttleSticks; //if true, speed stays at whatever you accel/decel to, unless you turbo or brake 00155 float strafePerc; //multiplier on current speed for strafing. If 1.0f, you can strafe at the same speed as you're going forward, 0.5 is half, 0 is no strafing 00156 00157 //handling stats 00158 float bankingSpeed; //how quickly it pitches and rolls (not under player control) 00159 float rollLimit; //how far it can roll to either side 00160 float pitchLimit; //how far it can roll forward or backward 00161 float braking; //when pressing on decelerator 00162 float mouseYaw; // The mouse yaw override. 00163 float mousePitch; // The mouse pitch override. 00164 float turningSpeed; //how quickly you can turn 00165 qboolean turnWhenStopped;//whether or not you can turn when not moving 00166 float traction; //how much your command input affects velocity 00167 float friction; //how much velocity is cut on its own 00168 float maxSlope; //the max slope that it can go up with control 00169 qboolean speedDependantTurning;//vehicle turns faster the faster it's going 00170 00171 //durability stats 00172 int mass; //for momentum and impact force (player mass is 10) 00173 int armor; //total points of damage it can take 00174 int shields; //energy shield damage points 00175 int shieldRechargeMS;//energy shield milliseconds per point recharged 00176 float toughness; //modifies incoming damage, 1.0 is normal, 0.5 is half, etc. Simulates being made of tougher materials/construction 00177 int malfunctionArmorLevel;//when armor drops to or below this point, start malfunctioning 00178 int surfDestruction; //can parts of this thing be torn off on impact? -rww 00179 00180 //individual "area" health -rww 00181 int health_front; 00182 int health_back; 00183 int health_right; 00184 int health_left; 00185 00186 //visuals & sounds 00187 char *model; //what model to use - if make it an NPC's primary model, don't need this? 00188 char *skin; //what skin to use - if make it an NPC's primary model, don't need this? 00189 int g2radius; //render radius for the ghoul2 model 00190 int riderAnim; //what animation the rider uses 00191 int radarIconHandle;//what icon to show on radar in MP 00192 int dmgIndicFrameHandle;//what image to use for the frame of the damage indicator 00193 int dmgIndicShieldHandle;//what image to use for the shield of the damage indicator 00194 int dmgIndicBackgroundHandle;//what image to use for the background of the damage indicator 00195 int iconFrontHandle;//what image to use for the front of the ship on the damage indicator 00196 int iconBackHandle; //what image to use for the back of the ship on the damage indicator 00197 int iconRightHandle;//what image to use for the right of the ship on the damage indicator 00198 int iconLeftHandle; //what image to use for the left of the ship on the damage indicator 00199 int crosshairShaderHandle;//what image to use for the left of the ship on the damage indicator 00200 int shieldShaderHandle;//What shader to use when drawing the shield shell 00201 char *droidNPC; //NPC to attach to *droidunit tag (if it exists in the model) 00202 00203 int soundOn; //sound to play when get on it 00204 int soundTakeOff; //sound to play when ship takes off 00205 int soundEngineStart;//sound to play when ship's thrusters first activate 00206 int soundLoop; //sound to loop while riding it 00207 int soundSpin; //sound to loop while spiraling out of control 00208 int soundTurbo; //sound to play when turbo/afterburner kicks in 00209 int soundHyper; //sound to play when ship lands 00210 int soundLand; //sound to play when ship lands 00211 int soundOff; //sound to play when get off 00212 int soundFlyBy; //sound to play when they buzz you 00213 int soundFlyBy2; //alternate sound to play when they buzz you 00214 int soundShift1; //sound to play when accelerating 00215 int soundShift2; //sound to play when accelerating 00216 int soundShift3; //sound to play when decelerating 00217 int soundShift4; //sound to play when decelerating 00218 00219 int iExhaustFX; //exhaust effect, played from "*exhaust" bolt(s) 00220 int iTurboFX; //turbo exhaust effect, played from "*exhaust" bolt(s) when ship is in "turbo" mode 00221 int iTurboStartFX; //turbo begin effect, played from "*exhaust" bolts when "turbo" mode begins 00222 int iTrailFX; //trail effect, played from "*trail" bolt(s) 00223 int iImpactFX; //impact effect, for when it bumps into something 00224 int iExplodeFX; //explosion effect, for when it blows up (should have the sound built into explosion effect) 00225 int iWakeFX; //effect it makes when going across water 00226 int iDmgFX; //effect to play on damage from a weapon or something 00227 int iInjureFX; 00228 int iNoseFX; //effect for nose piece flying away when blown off 00229 int iLWingFX; //effect for left wing piece flying away when blown off 00230 int iRWingFX; //effect for right wing piece flying away when blown off 00231 00232 //Weapon stats 00233 vehWeaponStats_t weapon[MAX_VEHICLE_WEAPONS]; 00234 00235 // Which weapon a muzzle fires (has to match one of the weapons this vehicle has). So 1 would be weapon 1, 00236 // 2 would be weapon 2 and so on. 00237 int weapMuzzle[MAX_VEHICLE_MUZZLES]; 00238 00239 //turrets (if any) on the vehicle 00240 turretStats_t turret[MAX_VEHICLE_TURRETS]; 00241 00242 // The max height before this ship (?) starts (auto)landing. 00243 float landingHeight; 00244 00245 //other misc stats 00246 int gravity; //normal is 800 00247 float hoverHeight; //if 0, it's a ground vehicle 00248 float hoverStrength; //how hard it pushes off ground when less than hover height... causes "bounce", like shocks 00249 qboolean waterProof; //can drive underwater if it has to 00250 float bouyancy; //when in water, how high it floats (1 is neutral bouyancy) 00251 int fuelMax; //how much fuel it can hold (capacity) 00252 int fuelRate; //how quickly is uses up fuel 00253 int turboDuration; //how long turbo lasts 00254 int turboRecharge; //how long turbo takes to recharge 00255 int visibility; //for sight alerts 00256 int loudness; //for sound alerts 00257 float explosionRadius;//range of explosion 00258 int explosionDamage;//damage of explosion 00259 00260 int maxPassengers; // The max number of passengers this vehicle may have (Default = 0). 00261 qboolean hideRider; // rider (and passengers?) should not be drawn 00262 qboolean killRiderOnDeath;//if rider is on vehicle when it dies, they should die 00263 qboolean flammable; //whether or not the vehicle should catch on fire before it explodes 00264 int explosionDelay; //how long the vehicle should be on fire/dying before it explodes 00265 //camera stuff 00266 qboolean cameraOverride; //whether or not to use all of the following 3rd person camera override values 00267 float cameraRange; //how far back the camera should be - normal is 80 00268 float cameraVertOffset;//how high over the vehicle origin the camera should be - normal is 16 00269 float cameraHorzOffset;//how far to left/right (negative/positive) of of the vehicle origin the camera should be - normal is 0 00270 float cameraPitchOffset;//a modifier on the camera's pitch (up/down angle) to the vehicle - normal is 0 00271 float cameraFOV; //third person camera FOV, default is 80 00272 float cameraAlpha; //fade out the vehicle to this alpha (0.1-1.0f) if it's in the way of the crosshair 00273 qboolean cameraPitchDependantVertOffset;//use the hacky AT-ST pitch dependant vertical offset 00274 00275 //NOTE: some info on what vehicle weapon to use? Like ATST or TIE bomber or TIE fighter or X-Wing...? 00276 00277 //===VEH_PARM_MAX======================================================================== 00278 //*** IMPORTANT!!! *** vehFields table correponds to this structure! 00279 00280 //THE FOLLOWING FIELDS are not in the vehFields table because they are internal variables, not read in from the .veh file 00281 int modelIndex; //set internally, not until this vehicle is spawned into the level 00282 00283 // NOTE: Please note that most of this stuff has been converted from C++ classes to generic C. 00284 // This part of the structure is used to simulate inheritance for vehicles. The basic idea is that all vehicle use 00285 // this vehicle interface since they declare their own functions and assign the function pointer to the 00286 // corresponding function. Meanwhile, the base logic can still call the appropriate functions. In C++ talk all 00287 // of these functions (pointers) are pure virtuals and this is an abstract base class (although it cannot be 00288 // inherited from, only contained and reimplemented (through an object and a setup function respectively)). -AReis 00289 00290 // Makes sure that the vehicle is properly animated. 00291 void (*AnimateVehicle)( Vehicle_t *pVeh ); 00292 00293 // Makes sure that the rider's in this vehicle are properly animated. 00294 void (*AnimateRiders)( Vehicle_t *pVeh ); 00295 00296 // Determine whether this entity is able to board this vehicle or not. 00297 qboolean (*ValidateBoard)( Vehicle_t *pVeh, bgEntity_t *pEnt ); 00298 00299 // Set the parent entity of this Vehicle NPC. 00300 void (*SetParent)( Vehicle_t *pVeh, bgEntity_t *pParentEntity ); 00301 00302 // Add a pilot to the vehicle. 00303 void (*SetPilot)( Vehicle_t *pVeh, bgEntity_t *pPilot ); 00304 00305 // Add a passenger to the vehicle (false if we're full). 00306 qboolean (*AddPassenger)( Vehicle_t *pVeh ); 00307 00308 // Animate the vehicle and it's riders. 00309 void (*Animate)( Vehicle_t *pVeh ); 00310 00311 // Board this Vehicle (get on). The first entity to board an empty vehicle becomes the Pilot. 00312 qboolean (*Board)( Vehicle_t *pVeh, bgEntity_t *pEnt ); 00313 00314 // Eject an entity from the vehicle. 00315 qboolean (*Eject)( Vehicle_t *pVeh, bgEntity_t *pEnt, qboolean forceEject ); 00316 00317 // Eject all the inhabitants of this vehicle. 00318 qboolean (*EjectAll)( Vehicle_t *pVeh ); 00319 00320 // Start a delay until the vehicle dies. 00321 void (*StartDeathDelay)( Vehicle_t *pVeh, int iDelayTime ); 00322 00323 // Update death sequence. 00324 void (*DeathUpdate)( Vehicle_t *pVeh ); 00325 00326 // Register all the assets used by this vehicle. 00327 void (*RegisterAssets)( Vehicle_t *pVeh ); 00328 00329 // Initialize the vehicle (should be called by Spawn?). 00330 qboolean (*Initialize)( Vehicle_t *pVeh ); 00331 00332 // Like a think or move command, this updates various vehicle properties. 00333 qboolean (*Update)( Vehicle_t *pVeh, const usercmd_t *pUcmd ); 00334 00335 // Update the properties of a Rider (that may reflect what happens to the vehicle). 00336 // 00337 // [return] bool True if still in vehicle, false if otherwise. 00338 qboolean (*UpdateRider)( Vehicle_t *pVeh, bgEntity_t *pRider, usercmd_t *pUcmd ); 00339 00340 // ProcessMoveCommands the Vehicle. 00341 void (*ProcessMoveCommands)( Vehicle_t *pVeh ); 00342 00343 // ProcessOrientCommands the Vehicle. 00344 void (*ProcessOrientCommands)( Vehicle_t *pVeh ); 00345 00346 // Attachs all the riders of this vehicle to their appropriate position/tag (*driver, *pass1, *pass2, whatever...). 00347 void (*AttachRiders)( Vehicle_t *pVeh ); 00348 00349 // Make someone invisible and un-collidable. 00350 void (*Ghost)( Vehicle_t *pVeh, bgEntity_t *pEnt ); 00351 00352 // Make someone visible and collidable. 00353 void (*UnGhost)( Vehicle_t *pVeh, bgEntity_t *pEnt ); 00354 00355 // Get the pilot of this vehicle. 00356 const bgEntity_t *(*GetPilot)( Vehicle_t *pVeh ); 00357 00358 // Whether this vehicle is currently inhabited (by anyone) or not. 00359 qboolean (*Inhabited)( Vehicle_t *pVeh ); 00360 } vehicleInfo_t; 00361 00362 00363 #define VFOFS(x) ((int)&(((vehicleInfo_t *)0)->x)) 00364 00365 #define MAX_VEHICLES 16 //sigh... no more than 64 individual vehicles 00366 #define VEHICLE_BASE 0 00367 #define VEHICLE_NONE -1 00368 00369 #include "../namespace_begin.h" 00370 extern vehicleInfo_t g_vehicleInfo[MAX_VEHICLES]; 00371 extern int numVehicles; 00372 #include "../namespace_end.h" 00373 00374 #define VEH_DEFAULT_SPEED_MAX 800.0f 00375 #define VEH_DEFAULT_ACCEL 10.0f 00376 #define VEH_DEFAULT_DECEL 10.0f 00377 #define VEH_DEFAULT_STRAFE_PERC 0.5f 00378 #define VEH_DEFAULT_BANKING_SPEED 0.5f 00379 #define VEH_DEFAULT_ROLL_LIMIT 60.0f 00380 #define VEH_DEFAULT_PITCH_LIMIT 90.0f 00381 #define VEH_DEFAULT_BRAKING 10.0f 00382 #define VEH_DEFAULT_TURNING_SPEED 1.0f 00383 #define VEH_DEFAULT_TRACTION 8.0f 00384 #define VEH_DEFAULT_FRICTION 1.0f 00385 #define VEH_DEFAULT_MAX_SLOPE 0.85f 00386 #define VEH_DEFAULT_MASS 200 00387 #define VEH_DEFAULT_MAX_ARMOR 200 00388 #define VEH_DEFAULT_TOUGHNESS 2.5f 00389 #define VEH_DEFAULT_GRAVITY 800 00390 #define VEH_DEFAULT_HOVER_HEIGHT 64.0f 00391 #define VEH_DEFAULT_HOVER_STRENGTH 10.0f 00392 #define VEH_DEFAULT_VISIBILITY 0 00393 #define VEH_DEFAULT_LOUDNESS 0 00394 #define VEH_DEFAULT_EXP_RAD 400.0f 00395 #define VEH_DEFAULT_EXP_DMG 1000 00396 #define VEH_MAX_PASSENGERS 10 00397 00398 #define MAX_STRAFE_TIME 2000.0f//FIXME: extern? 00399 #define MIN_LANDING_SPEED 200//equal to or less than this and close to ground = auto-slow-down to land 00400 #define MIN_LANDING_SLOPE 0.8f//must be pretty flat to land on the surf 00401 00402 #define VEH_MOUNT_THROW_LEFT -5 00403 #define VEH_MOUNT_THROW_RIGHT -6 00404 00405 00406 typedef enum 00407 { 00408 VEH_EJECT_LEFT, 00409 VEH_EJECT_RIGHT, 00410 VEH_EJECT_FRONT, 00411 VEH_EJECT_REAR, 00412 VEH_EJECT_TOP, 00413 VEH_EJECT_BOTTOM 00414 }; 00415 00416 // Vehicle flags. 00417 typedef enum 00418 { 00419 VEH_NONE = 0, VEH_FLYING = 0x00000001, VEH_CRASHING = 0x00000002, 00420 VEH_LANDING = 0x00000004, VEH_BUCKING = 0x00000010, VEH_WINGSOPEN = 0x00000020, 00421 VEH_GEARSOPEN = 0x00000040, VEH_SLIDEBREAKING = 0x00000080, VEH_SPINNING = 0x00000100, 00422 VEH_OUTOFCONTROL = 0x00000200, 00423 VEH_SABERINLEFTHAND = 0x00000400 00424 } vehFlags_t; 00425 00426 //defines for impact damage surface stuff 00427 #define SHIPSURF_FRONT 0 00428 #define SHIPSURF_BACK 1 00429 #define SHIPSURF_RIGHT 2 00430 #define SHIPSURF_LEFT 3 00431 00432 #define SHIPSURF_DAMAGE_FRONT_LIGHT 0 00433 #define SHIPSURF_DAMAGE_BACK_LIGHT 1 00434 #define SHIPSURF_DAMAGE_RIGHT_LIGHT 2 00435 #define SHIPSURF_DAMAGE_LEFT_LIGHT 3 00436 #define SHIPSURF_DAMAGE_FRONT_HEAVY 4 00437 #define SHIPSURF_DAMAGE_BACK_HEAVY 5 00438 #define SHIPSURF_DAMAGE_RIGHT_HEAVY 6 00439 #define SHIPSURF_DAMAGE_LEFT_HEAVY 7 00440 00441 //generic part bits 00442 #define SHIPSURF_BROKEN_A (1<<0) //gear 1 00443 #define SHIPSURF_BROKEN_B (1<<1) //gear 1 00444 #define SHIPSURF_BROKEN_C (1<<2) //wing 1 00445 #define SHIPSURF_BROKEN_D (1<<3) //wing 2 00446 #define SHIPSURF_BROKEN_E (1<<4) //wing 3 00447 #define SHIPSURF_BROKEN_F (1<<5) //wing 4 00448 #define SHIPSURF_BROKEN_G (1<<6) //front 00449 00450 typedef struct 00451 { 00452 //linked firing mode 00453 qboolean linked;//weapon 1's muzzles are in linked firing mode 00454 //current weapon ammo 00455 int ammo; 00456 //debouncer for ammo recharge 00457 int lastAmmoInc; 00458 //which muzzle will fire next 00459 int nextMuzzle; 00460 } vehWeaponStatus_t; 00461 00462 typedef struct 00463 { 00464 //current weapon ammo 00465 int ammo; 00466 //debouncer for ammo recharge 00467 int lastAmmoInc; 00468 //which muzzle will fire next 00469 int nextMuzzle; 00470 //which entity they're after 00471 int enemyEntNum; 00472 //how long to hold on to our current enemy 00473 int enemyHoldTime; 00474 } vehTurretStatus_t; 00475 // This is the implementation of the vehicle interface and any of the other variables needed. This 00476 // is what actually represents a vehicle. -AReis. 00477 typedef struct Vehicle_s 00478 { 00479 // The entity who pilots/drives this vehicle. 00480 // NOTE: This is redundant (since m_pParentEntity->owner _should_ be the pilot). This makes things clearer though. 00481 bgEntity_t *m_pPilot; 00482 00483 int m_iPilotTime; //if spawnflag to die without pilot and this < level.time then die. 00484 int m_iPilotLastIndex; //index to last pilot 00485 qboolean m_bHasHadPilot; //qtrue once the vehicle gets its first pilot 00486 00487 // The passengers of this vehicle. 00488 //bgEntity_t **m_ppPassengers; 00489 bgEntity_t *m_ppPassengers[VEH_MAX_PASSENGERS]; 00490 00491 //the droid unit NPC for this vehicle, if any 00492 bgEntity_t *m_pDroidUnit; 00493 00494 // The number of passengers currently in this vehicle. 00495 int m_iNumPassengers; 00496 00497 // The entity from which this NPC comes from. 00498 bgEntity_t *m_pParentEntity; 00499 00500 // If not zero, how long to wait before we can do anything with the vehicle (we're getting on still). 00501 // -1 = board from left, -2 = board from right, -3 = jump/quick board. -4 & -5 = throw off existing pilot 00502 int m_iBoarding; 00503 00504 // Used to check if we've just started the boarding process 00505 qboolean m_bWasBoarding; 00506 00507 // The speed the vehicle maintains while boarding occurs (often zero) 00508 vec3_t m_vBoardingVelocity; 00509 00510 // Time modifier (must only be used in ProcessMoveCommands() and ProcessOrientCommands() and is updated in Update()). 00511 float m_fTimeModifier; 00512 00513 // Ghoul2 Animation info. 00514 //int m_iDriverTag; 00515 int m_iLeftExhaustTag; 00516 int m_iRightExhaustTag; 00517 int m_iGun1Tag; 00518 int m_iGun1Bone; 00519 int m_iLeftWingBone; 00520 int m_iRightWingBone; 00521 00522 int m_iExhaustTag[MAX_VEHICLE_EXHAUSTS]; 00523 int m_iMuzzleTag[MAX_VEHICLE_MUZZLES]; 00524 int m_iDroidUnitTag; 00525 int m_iGunnerViewTag[MAX_VEHICLE_TURRETS];//Where to put the view origin of the gunner (index) 00526 00527 //this stuff is a little bit different from SP, because I am lazy -rww 00528 int m_iMuzzleTime[MAX_VEHICLE_MUZZLES]; 00529 // These are updated every frame and represent the current position and direction for the specific muzzle. 00530 vec3_t m_vMuzzlePos[MAX_VEHICLE_MUZZLES], m_vMuzzleDir[MAX_VEHICLE_MUZZLES]; 00531 00532 // This is how long to wait before being able to fire a specific muzzle again. This is based on the firing rate 00533 // so that a firing rate of 10 rounds/sec would make this value initially 100 miliseconds. 00534 int m_iMuzzleWait[MAX_VEHICLE_MUZZLES]; 00535 00536 // The user commands structure. 00537 usercmd_t m_ucmd; 00538 00539 // The direction an entity will eject from the vehicle towards. 00540 int m_EjectDir; 00541 00542 // Flags that describe the vehicles behavior. 00543 unsigned long m_ulFlags; 00544 00545 // NOTE: Vehicle Type ID, Orientation, and Armor MUST be transmitted over the net. 00546 00547 // The ID of the type of vehicle this is. 00548 int m_iVehicleTypeID; 00549 00550 // Current angles of this vehicle. 00551 //vec3_t m_vOrientation; 00552 float *m_vOrientation; 00553 //Yeah, since we use the SP code for vehicles, I want to use this value, but I'm going 00554 //to make it a pointer to a vec3_t in the playerstate for prediction's sake. -rww 00555 00556 // How long you have strafed left or right (increments every frame that you strafe to right, decrements every frame you strafe left) 00557 int m_fStrafeTime; 00558 00559 // Previous angles of this vehicle. 00560 vec3_t m_vPrevOrientation; 00561 00562 // Previous viewangles of the rider 00563 vec3_t m_vPrevRiderViewAngles; 00564 00565 // When control is lost on a speeder, current angular velocity is stored here and applied until landing 00566 float m_vAngularVelocity; 00567 00568 vec3_t m_vFullAngleVelocity; 00569 00570 // Current armor and shields of your vehicle (explodes if armor to 0). 00571 int m_iArmor; //hull strength - STAT_HEALTH on NPC 00572 int m_iShields; //energy shielding - STAT_ARMOR on NPC 00573 00574 //mp-specific 00575 int m_iHitDebounce; 00576 00577 // Timer for all cgame-FX...? ex: exhaust? 00578 int m_iLastFXTime; 00579 00580 // When to die. 00581 int m_iDieTime; 00582 00583 // This pointer is to a valid VehicleInfo (which could be an animal, speeder, fighter, whatever). This 00584 // contains the functions actually used to do things to this specific kind of vehicle as well as shared 00585 // information (max speed, type, etc...). 00586 vehicleInfo_t *m_pVehicleInfo; 00587 00588 // This trace tells us if we're within landing height. 00589 trace_t m_LandTrace; 00590 00591 // TEMP: The wing angles (used to animate it). 00592 vec3_t m_vWingAngles; 00593 00594 //amount of damage done last impact 00595 int m_iLastImpactDmg; 00596 00597 //bitflag of surfaces that have broken off 00598 int m_iRemovedSurfaces; 00599 00600 int m_iDmgEffectTime; 00601 00602 // the last time this vehicle fired a turbo burst 00603 int m_iTurboTime; 00604 00605 //how long it should drop like a rock for after freed from SUSPEND 00606 int m_iDropTime; 00607 00608 int m_iSoundDebounceTimer; 00609 00610 //last time we incremented the shields 00611 int lastShieldInc; 00612 00613 //so we don't hold it down and toggle it back and forth 00614 qboolean linkWeaponToggleHeld; 00615 00616 //info about our weapons (linked, ammo, etc.) 00617 vehWeaponStatus_t weaponStatus[MAX_VEHICLE_WEAPONS]; 00618 vehTurretStatus_t turretStatus[MAX_VEHICLE_TURRETS]; 00619 00620 //the guy who was previously the pilot 00621 bgEntity_t * m_pOldPilot; 00622 00623 } Vehicle_t; 00624 00625 #include "../namespace_begin.h" 00626 extern int BG_VehicleGetIndex( const char *vehicleName ); 00627 #include "../namespace_end.h" 00628 00629 #endif // __BG_VEHICLES_H