1 /* 2 =========================================================================== 3 Copyright (C) 2000 - 2013, Raven Software, Inc. 4 Copyright (C) 2001 - 2013, Activision, Inc. 5 Copyright (C) 2013 - 2015, OpenJK contributors 6 7 This file is part of the OpenJK source code. 8 9 OpenJK is free software; you can redistribute it and/or modify it 10 under the terms of the GNU General Public License version 2 as 11 published by the Free Software Foundation. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, see <http://www.gnu.org/licenses/>. 20 =========================================================================== 21 */ 22 23 #pragma once 24 25 #include "qcommon/q_shared.h" 26 27 typedef struct Vehicle_s Vehicle_t; 28 typedef struct bgEntity_s bgEntity_t; 29 30 typedef enum 31 { 32 VH_NONE = 0, //0 just in case anyone confuses VH_NONE and VEHICLE_NONE below 33 VH_WALKER, //something you ride inside of, it walks like you, like an AT-ST 34 VH_FIGHTER, //something you fly inside of, like an X-Wing or TIE fighter 35 VH_SPEEDER, //something you ride on that hovers, like a speeder or swoop 36 VH_ANIMAL, //animal you ride on top of that walks, like a tauntaun 37 VH_FLIER, //animal you ride on top of that flies, like a giant mynoc? 38 VH_NUM_VEHICLES 39 } vehicleType_t; 40 41 typedef enum 42 { 43 WPOSE_NONE = 0, 44 WPOSE_BLASTER, 45 WPOSE_SABERLEFT, 46 WPOSE_SABERRIGHT, 47 } EWeaponPose; 48 49 extern stringID_table_t VehicleTable[VH_NUM_VEHICLES+1]; 50 51 //=========================================================================================================== 52 //START VEHICLE WEAPONS 53 //=========================================================================================================== 54 typedef struct vehWeaponInfo_s { 55 //*** IMPORTANT!!! *** vWeapFields table correponds to this structure! 56 char *name; 57 qboolean bIsProjectile; //traceline or entity? 58 qboolean bHasGravity; //if a projectile, drops 59 qboolean bIonWeapon;//disables ship shields and sends them out of control 60 qboolean bSaberBlockable;//lightsabers can deflect this projectile 61 int iMuzzleFX; //index of Muzzle Effect 62 int iModel; //handle to the model used by this projectile 63 int iShotFX; //index of Shot Effect 64 int iImpactFX; //index of Impact Effect 65 int iG2MarkShaderHandle; //index of shader to use for G2 marks made on other models when hit by this projectile 66 float fG2MarkSize;//size (diameter) of the ghoul2 mark 67 int iLoopSound; //index of loopSound 68 float fSpeed; //speed of projectile/range of traceline 69 float fHoming; //0.0 = not homing, 0.5 = half vel to targ, half cur vel, 1.0 = all vel to targ 70 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) 71 int iLockOnTime; //0 = no lock time needed, else # of ms needed to lock on 72 int iDamage; //damage done when traceline or projectile directly hits target 73 int iSplashDamage;//damage done to ents in splashRadius of end of traceline or projectile origin on impact 74 float fSplashRadius;//radius that ent must be in to take splashDamage (linear fall-off) 75 int iAmmoPerShot; //how much "ammo" each shot takes 76 int iHealth; //if non-zero, projectile can be shot, takes this much damage before being destroyed 77 float fWidth; //width of traceline or bounding box of projecile (non-rotating!) 78 float fHeight; //height of traceline or bounding box of projecile (non-rotating!) 79 int iLifeTime; //removes itself after this amount of time 80 qboolean bExplodeOnExpire; //when iLifeTime is up, explodes rather than simply removing itself 81 } vehWeaponInfo_t; 82 83 #define VWFOFS(x) offsetof(vehWeaponInfo_t, x) 84 85 #define MAX_VEH_WEAPONS 16 //sigh... no more than 16 different vehicle weapons 86 #define VEH_WEAPON_BASE 0 87 #define VEH_WEAPON_NONE -1 88 89 extern vehWeaponInfo_t g_vehWeaponInfo[MAX_VEH_WEAPONS]; 90 extern int numVehicleWeapons; 91 92 //=========================================================================================================== 93 //END VEHICLE WEAPONS 94 //=========================================================================================================== 95 96 #define MAX_VEHICLE_MUZZLES 12 97 #define MAX_VEHICLE_EXHAUSTS 12 98 #define MAX_VEHICLE_WEAPONS 2 99 #define MAX_VEHICLE_TURRETS 2 100 #define MAX_VEHICLE_TURRET_MUZZLES 2 101 102 typedef struct turretStats_s { 103 int iWeapon; //what vehWeaponInfo index to use 104 int iDelay; //delay between turret muzzle shots 105 int iAmmoMax; //how much ammo it has 106 int iAmmoRechargeMS; //how many MS between every point of recharged ammo 107 char *yawBone; //bone on ship that this turret uses to yaw 108 char *pitchBone; //bone on ship that this turret uses to pitch 109 int yawAxis; //axis on yawBone to which we should to apply the yaw angles 110 int pitchAxis; //axis on pitchBone to which we should to apply the pitch angles 111 float yawClampLeft; //how far the turret is allowed to turn left 112 float yawClampRight; //how far the turret is allowed to turn right 113 float pitchClampUp; //how far the turret is allowed to title up 114 float pitchClampDown; //how far the turret is allowed to tilt down 115 int iMuzzle[MAX_VEHICLE_TURRET_MUZZLES];//iMuzzle-1 = index of ship's muzzle to fire this turret's 1st and 2nd shots from 116 char *gunnerViewTag;//Where to put the view origin of the gunner (name) 117 float fTurnSpeed; //how quickly the turret can turn 118 qboolean bAI; //whether or not the turret auto-targets enemies when it's not manned 119 qboolean bAILead;//whether 120 float fAIRange; //how far away the AI will look for enemies 121 int passengerNum;//which passenger, if any, has control of this turret (overrides AI) 122 } turretStats_t; 123 124 typedef struct vehWeaponStats_s { 125 //*** IMPORTANT!!! *** See note at top of next structure!!! *** 126 // Weapon stuff. 127 int ID;//index into the weapon data 128 // The delay between shots for each weapon. 129 int delay; 130 // Whether or not all the muzzles for each weapon can be linked together (linked delay = weapon delay * number of muzzles linked!) 131 int linkable; 132 // Whether or not to auto-aim the projectiles/tracelines at the thing under the crosshair when we fire 133 qboolean aimCorrect; 134 //maximum ammo 135 int ammoMax; 136 //ammo recharge rate - milliseconds per unit (minimum of 100, which is 10 ammo per second) 137 int ammoRechargeMS; 138 //sound to play when out of ammo (plays default "no ammo" sound if none specified) 139 int soundNoAmmo; 140 } vehWeaponStats_t; 141 142 typedef struct vehicleInfo_s { 143 //*** IMPORTANT!!! *** vehFields table correponds to this structure! 144 char *name; //unique name of the vehicle 145 146 //general data 147 vehicleType_t type; //what kind of vehicle 148 int numHands; //if 2 hands, no weapons, if 1 hand, can use 1-handed weapons, if 0 hands, can use 2-handed weapons 149 float lookPitch; //How far you can look up and down off the forward of the vehicle 150 float lookYaw; //How far you can look left and right off the forward of the vehicle 151 float length; //how long it is - used for body length traces when turning/moving? 152 float width; //how wide it is - used for body length traces when turning/moving? 153 float height; //how tall it is - used for body length traces when turning/moving? 154 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) 155 156 //speed stats 157 float speedMax; //top speed 158 float turboSpeed; //turbo speed 159 float speedMin; //if < 0, can go in reverse 160 float speedIdle; //what speed it drifts to when no accel/decel input is given 161 float accelIdle; //if speedIdle > 0, how quickly it goes up to that speed 162 float acceleration; //when pressing on accelerator 163 float decelIdle; //when giving no input, how quickly it drops to speedIdle 164 float throttleSticks; //if true, speed stays at whatever you accel/decel to, unless you turbo or brake 165 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 166 167 //handling stats 168 float bankingSpeed; //how quickly it pitches and rolls (not under player control) 169 float rollLimit; //how far it can roll to either side 170 float pitchLimit; //how far it can roll forward or backward 171 float braking; //when pressing on decelerator 172 float mouseYaw; // The mouse yaw override. 173 float mousePitch; // The mouse pitch override. 174 float turningSpeed; //how quickly you can turn 175 qboolean turnWhenStopped;//whether or not you can turn when not moving 176 float traction; //how much your command input affects velocity 177 float friction; //how much velocity is cut on its own 178 float maxSlope; //the max slope that it can go up with control 179 qboolean speedDependantTurning;//vehicle turns faster the faster it's going 180 181 //durability stats 182 int mass; //for momentum and impact force (player mass is 10) 183 int armor; //total points of damage it can take 184 int shields; //energy shield damage points 185 int shieldRechargeMS;//energy shield milliseconds per point recharged 186 float toughness; //modifies incoming damage, 1.0 is normal, 0.5 is half, etc. Simulates being made of tougher materials/construction 187 int malfunctionArmorLevel;//when armor drops to or below this point, start malfunctioning 188 int surfDestruction; //can parts of this thing be torn off on impact? -rww 189 190 //individual "area" health -rww 191 int health_front; 192 int health_back; 193 int health_right; 194 int health_left; 195 196 //visuals & sounds 197 char *model; //what model to use - if make it an NPC's primary model, don't need this? 198 char *skin; //what skin to use - if make it an NPC's primary model, don't need this? 199 int g2radius; //render radius for the ghoul2 model 200 int riderAnim; //what animation the rider uses 201 int radarIconHandle;//what icon to show on radar in MP 202 int dmgIndicFrameHandle;//what image to use for the frame of the damage indicator 203 int dmgIndicShieldHandle;//what image to use for the shield of the damage indicator 204 int dmgIndicBackgroundHandle;//what image to use for the background of the damage indicator 205 int iconFrontHandle;//what image to use for the front of the ship on the damage indicator 206 int iconBackHandle; //what image to use for the back of the ship on the damage indicator 207 int iconRightHandle;//what image to use for the right of the ship on the damage indicator 208 int iconLeftHandle; //what image to use for the left of the ship on the damage indicator 209 int crosshairShaderHandle;//what image to use for the left of the ship on the damage indicator 210 int shieldShaderHandle;//What shader to use when drawing the shield shell 211 char *droidNPC; //NPC to attach to *droidunit tag (if it exists in the model) 212 213 int soundOn; //sound to play when get on it 214 int soundTakeOff; //sound to play when ship takes off 215 int soundEngineStart;//sound to play when ship's thrusters first activate 216 int soundLoop; //sound to loop while riding it 217 int soundSpin; //sound to loop while spiraling out of control 218 int soundTurbo; //sound to play when turbo/afterburner kicks in 219 int soundHyper; //sound to play when ship lands 220 int soundLand; //sound to play when ship lands 221 int soundOff; //sound to play when get off 222 int soundFlyBy; //sound to play when they buzz you 223 int soundFlyBy2; //alternate sound to play when they buzz you 224 int soundShift1; //sound to play when accelerating 225 int soundShift2; //sound to play when accelerating 226 int soundShift3; //sound to play when decelerating 227 int soundShift4; //sound to play when decelerating 228 229 int iExhaustFX; //exhaust effect, played from "*exhaust" bolt(s) 230 int iTurboFX; //turbo exhaust effect, played from "*exhaust" bolt(s) when ship is in "turbo" mode 231 int iTurboStartFX; //turbo begin effect, played from "*exhaust" bolts when "turbo" mode begins 232 int iTrailFX; //trail effect, played from "*trail" bolt(s) 233 int iImpactFX; //impact effect, for when it bumps into something 234 int iExplodeFX; //explosion effect, for when it blows up (should have the sound built into explosion effect) 235 int iWakeFX; //effect it makes when going across water 236 int iDmgFX; //effect to play on damage from a weapon or something 237 int iInjureFX; 238 int iNoseFX; //effect for nose piece flying away when blown off 239 int iLWingFX; //effect for left wing piece flying away when blown off 240 int iRWingFX; //effect for right wing piece flying away when blown off 241 242 //Weapon stats 243 vehWeaponStats_t weapon[MAX_VEHICLE_WEAPONS]; 244 245 // Which weapon a muzzle fires (has to match one of the weapons this vehicle has). So 1 would be weapon 1, 246 // 2 would be weapon 2 and so on. 247 int weapMuzzle[MAX_VEHICLE_MUZZLES]; 248 249 //turrets (if any) on the vehicle 250 turretStats_t turret[MAX_VEHICLE_TURRETS]; 251 252 // The max height before this ship (?) starts (auto)landing. 253 float landingHeight; 254 255 //other misc stats 256 int gravity; //normal is 800 257 float hoverHeight; //if 0, it's a ground vehicle 258 float hoverStrength; //how hard it pushes off ground when less than hover height... causes "bounce", like shocks 259 qboolean waterProof; //can drive underwater if it has to 260 float bouyancy; //when in water, how high it floats (1 is neutral bouyancy) 261 int fuelMax; //how much fuel it can hold (capacity) 262 int fuelRate; //how quickly is uses up fuel 263 int turboDuration; //how long turbo lasts 264 int turboRecharge; //how long turbo takes to recharge 265 int visibility; //for sight alerts 266 int loudness; //for sound alerts 267 float explosionRadius;//range of explosion 268 int explosionDamage;//damage of explosion 269 270 int maxPassengers; // The max number of passengers this vehicle may have (Default = 0). 271 qboolean hideRider; // rider (and passengers?) should not be drawn 272 qboolean killRiderOnDeath;//if rider is on vehicle when it dies, they should die 273 qboolean flammable; //whether or not the vehicle should catch on fire before it explodes 274 int explosionDelay; //how long the vehicle should be on fire/dying before it explodes 275 //camera stuff 276 qboolean cameraOverride; //whether or not to use all of the following 3rd person camera override values 277 float cameraRange; //how far back the camera should be - normal is 80 278 float cameraVertOffset;//how high over the vehicle origin the camera should be - normal is 16 279 float cameraHorzOffset;//how far to left/right (negative/positive) of of the vehicle origin the camera should be - normal is 0 280 float cameraPitchOffset;//a modifier on the camera's pitch (up/down angle) to the vehicle - normal is 0 281 float cameraFOV; //third person camera FOV, default is 80 282 float cameraAlpha; //fade out the vehicle to this alpha (0.1-1.0f) if it's in the way of the crosshair 283 qboolean cameraPitchDependantVertOffset;//use the hacky AT-ST pitch dependant vertical offset 284 285 //NOTE: some info on what vehicle weapon to use? Like ATST or TIE bomber or TIE fighter or X-Wing...? 286 287 //===VEH_PARM_MAX======================================================================== 288 //*** IMPORTANT!!! *** vehFields table correponds to this structure! 289 290 //THE FOLLOWING FIELDS are not in the vehFields table because they are internal variables, not read in from the .veh file 291 int modelIndex; //set internally, not until this vehicle is spawned into the level 292 293 // NOTE: Please note that most of this stuff has been converted from C++ classes to generic C. 294 // This part of the structure is used to simulate inheritance for vehicles. The basic idea is that all vehicle use 295 // this vehicle interface since they declare their own functions and assign the function pointer to the 296 // corresponding function. Meanwhile, the base logic can still call the appropriate functions. In C++ talk all 297 // of these functions (pointers) are pure virtuals and this is an abstract base class (although it cannot be 298 // inherited from, only contained and reimplemented (through an object and a setup function respectively)). -AReis 299 300 // Makes sure that the vehicle is properly animated. 301 void (*AnimateVehicle)( Vehicle_t *pVeh ); 302 303 // Makes sure that the rider's in this vehicle are properly animated. 304 void (*AnimateRiders)( Vehicle_t *pVeh ); 305 306 // Determine whether this entity is able to board this vehicle or not. 307 qboolean (*ValidateBoard)( Vehicle_t *pVeh, bgEntity_t *pEnt ); 308 309 // Set the parent entity of this Vehicle NPC. 310 void (*SetParent)( Vehicle_t *pVeh, bgEntity_t *pParentEntity ); 311 312 // Add a pilot to the vehicle. 313 void (*SetPilot)( Vehicle_t *pVeh, bgEntity_t *pPilot ); 314 315 // Add a passenger to the vehicle (false if we're full). 316 qboolean (*AddPassenger)( Vehicle_t *pVeh ); 317 318 // Animate the vehicle and it's riders. 319 void (*Animate)( Vehicle_t *pVeh ); 320 321 // Board this Vehicle (get on). The first entity to board an empty vehicle becomes the Pilot. 322 qboolean (*Board)( Vehicle_t *pVeh, bgEntity_t *pEnt ); 323 324 // Eject an entity from the vehicle. 325 qboolean (*Eject)( Vehicle_t *pVeh, bgEntity_t *pEnt, qboolean forceEject ); 326 327 // Eject all the inhabitants of this vehicle. 328 qboolean (*EjectAll)( Vehicle_t *pVeh ); 329 330 // Start a delay until the vehicle dies. 331 void (*StartDeathDelay)( Vehicle_t *pVeh, int iDelayTime ); 332 333 // Update death sequence. 334 void (*DeathUpdate)( Vehicle_t *pVeh ); 335 336 // Register all the assets used by this vehicle. 337 void (*RegisterAssets)( Vehicle_t *pVeh ); 338 339 // Initialize the vehicle (should be called by Spawn?). 340 qboolean (*Initialize)( Vehicle_t *pVeh ); 341 342 // Like a think or move command, this updates various vehicle properties. 343 qboolean (*Update)( Vehicle_t *pVeh, const usercmd_t *pUcmd ); 344 345 // Update the properties of a Rider (that may reflect what happens to the vehicle). 346 // 347 // [return] bool True if still in vehicle, false if otherwise. 348 qboolean (*UpdateRider)( Vehicle_t *pVeh, bgEntity_t *pRider, usercmd_t *pUcmd ); 349 350 // ProcessMoveCommands the Vehicle. 351 void (*ProcessMoveCommands)( Vehicle_t *pVeh ); 352 353 // ProcessOrientCommands the Vehicle. 354 void (*ProcessOrientCommands)( Vehicle_t *pVeh ); 355 356 // Attachs all the riders of this vehicle to their appropriate position/tag (*driver, *pass1, *pass2, whatever...). 357 void (*AttachRiders)( Vehicle_t *pVeh ); 358 359 // Make someone invisible and un-collidable. 360 void (*Ghost)( Vehicle_t *pVeh, bgEntity_t *pEnt ); 361 362 // Make someone visible and collidable. 363 void (*UnGhost)( Vehicle_t *pVeh, bgEntity_t *pEnt ); 364 365 // Get the pilot of this vehicle. 366 const bgEntity_t *(*GetPilot)( Vehicle_t *pVeh ); 367 368 // Whether this vehicle is currently inhabited (by anyone) or not. 369 qboolean (*Inhabited)( Vehicle_t *pVeh ); 370 } vehicleInfo_t; 371 372 373 #define VFOFS(x) offsetof(vehicleInfo_t, x) 374 375 #define MAX_VEHICLES 16 //sigh... no more than 64 individual vehicles 376 #define VEHICLE_BASE 0 377 #define VEHICLE_NONE -1 378 379 extern vehicleInfo_t g_vehicleInfo[MAX_VEHICLES]; 380 extern int numVehicles; 381 382 #define VEH_DEFAULT_SPEED_MAX 800.0f 383 #define VEH_DEFAULT_ACCEL 10.0f 384 #define VEH_DEFAULT_DECEL 10.0f 385 #define VEH_DEFAULT_STRAFE_PERC 0.5f 386 #define VEH_DEFAULT_BANKING_SPEED 0.5f 387 #define VEH_DEFAULT_ROLL_LIMIT 60.0f 388 #define VEH_DEFAULT_PITCH_LIMIT 90.0f 389 #define VEH_DEFAULT_BRAKING 10.0f 390 #define VEH_DEFAULT_TURNING_SPEED 1.0f 391 #define VEH_DEFAULT_TRACTION 8.0f 392 #define VEH_DEFAULT_FRICTION 1.0f 393 #define VEH_DEFAULT_MAX_SLOPE 0.85f 394 #define VEH_DEFAULT_MASS 200 395 #define VEH_DEFAULT_MAX_ARMOR 200 396 #define VEH_DEFAULT_TOUGHNESS 2.5f 397 #define VEH_DEFAULT_GRAVITY 800 398 #define VEH_DEFAULT_HOVER_HEIGHT 64.0f 399 #define VEH_DEFAULT_HOVER_STRENGTH 10.0f 400 #define VEH_DEFAULT_VISIBILITY 0 401 #define VEH_DEFAULT_LOUDNESS 0 402 #define VEH_DEFAULT_EXP_RAD 400.0f 403 #define VEH_DEFAULT_EXP_DMG 1000 404 #define VEH_MAX_PASSENGERS 10 405 406 #define MAX_STRAFE_TIME 2000.0f//FIXME: extern? 407 #define MIN_LANDING_SPEED 200//equal to or less than this and close to ground = auto-slow-down to land 408 #define MIN_LANDING_SLOPE 0.8f//must be pretty flat to land on the surf 409 410 #define VEH_MOUNT_THROW_LEFT -5 411 #define VEH_MOUNT_THROW_RIGHT -6 412 413 414 typedef enum vehEject_e 415 { 416 VEH_EJECT_LEFT, 417 VEH_EJECT_RIGHT, 418 VEH_EJECT_FRONT, 419 VEH_EJECT_REAR, 420 VEH_EJECT_TOP, 421 VEH_EJECT_BOTTOM 422 } vehEject_t; 423 424 // Vehicle flags. 425 typedef enum 426 { 427 VEH_NONE = 0, VEH_FLYING = 0x00000001, VEH_CRASHING = 0x00000002, 428 VEH_LANDING = 0x00000004, VEH_BUCKING = 0x00000010, VEH_WINGSOPEN = 0x00000020, 429 VEH_GEARSOPEN = 0x00000040, VEH_SLIDEBREAKING = 0x00000080, VEH_SPINNING = 0x00000100, 430 VEH_OUTOFCONTROL = 0x00000200, 431 VEH_SABERINLEFTHAND = 0x00000400 432 } vehFlags_t; 433 434 //defines for impact damage surface stuff 435 #define SHIPSURF_FRONT 0 436 #define SHIPSURF_BACK 1 437 #define SHIPSURF_RIGHT 2 438 #define SHIPSURF_LEFT 3 439 440 #define SHIPSURF_DAMAGE_FRONT_LIGHT 0 441 #define SHIPSURF_DAMAGE_BACK_LIGHT 1 442 #define SHIPSURF_DAMAGE_RIGHT_LIGHT 2 443 #define SHIPSURF_DAMAGE_LEFT_LIGHT 3 444 #define SHIPSURF_DAMAGE_FRONT_HEAVY 4 445 #define SHIPSURF_DAMAGE_BACK_HEAVY 5 446 #define SHIPSURF_DAMAGE_RIGHT_HEAVY 6 447 #define SHIPSURF_DAMAGE_LEFT_HEAVY 7 448 449 //generic part bits 450 #define SHIPSURF_BROKEN_A (1<<0) //gear 1 451 #define SHIPSURF_BROKEN_B (1<<1) //gear 1 452 #define SHIPSURF_BROKEN_C (1<<2) //wing 1 453 #define SHIPSURF_BROKEN_D (1<<3) //wing 2 454 #define SHIPSURF_BROKEN_E (1<<4) //wing 3 455 #define SHIPSURF_BROKEN_F (1<<5) //wing 4 456 #define SHIPSURF_BROKEN_G (1<<6) //front 457 458 typedef struct vehWeaponStatus_s { 459 //linked firing mode 460 qboolean linked;//weapon 1's muzzles are in linked firing mode 461 //current weapon ammo 462 int ammo; 463 //debouncer for ammo recharge 464 int lastAmmoInc; 465 //which muzzle will fire next 466 int nextMuzzle; 467 } vehWeaponStatus_t; 468 469 typedef struct vehTurretStatus_s { 470 //current weapon ammo 471 int ammo; 472 //debouncer for ammo recharge 473 int lastAmmoInc; 474 //which muzzle will fire next 475 int nextMuzzle; 476 //which entity they're after 477 int enemyEntNum; 478 //how long to hold on to our current enemy 479 int enemyHoldTime; 480 } vehTurretStatus_t; 481 // This is the implementation of the vehicle interface and any of the other variables needed. This 482 // is what actually represents a vehicle. -AReis. 483 #ifdef __GNUC__ 484 struct Vehicle_s 485 #else 486 typedef struct Vehicle_s 487 #endif 488 { 489 // The entity who pilots/drives this vehicle. 490 // NOTE: This is redundant (since m_pParentEntity->owner _should_ be the pilot). This makes things clearer though. 491 bgEntity_t *m_pPilot; 492 493 int m_iPilotTime; //if spawnflag to die without pilot and this < level.time then die. 494 int m_iPilotLastIndex; //index to last pilot 495 qboolean m_bHasHadPilot; //qtrue once the vehicle gets its first pilot 496 497 // The passengers of this vehicle. 498 //bgEntity_t **m_ppPassengers; 499 bgEntity_t *m_ppPassengers[VEH_MAX_PASSENGERS]; 500 501 //the droid unit NPC for this vehicle, if any 502 bgEntity_t *m_pDroidUnit; 503 504 // The number of passengers currently in this vehicle. 505 int m_iNumPassengers; 506 507 // The entity from which this NPC comes from. 508 bgEntity_t *m_pParentEntity; 509 510 // If not zero, how long to wait before we can do anything with the vehicle (we're getting on still). 511 // -1 = board from left, -2 = board from right, -3 = jump/quick board. -4 & -5 = throw off existing pilot 512 int m_iBoarding; 513 514 // Used to check if we've just started the boarding process 515 qboolean m_bWasBoarding; 516 517 // The speed the vehicle maintains while boarding occurs (often zero) 518 vec3_t m_vBoardingVelocity; 519 520 // Time modifier (must only be used in ProcessMoveCommands() and ProcessOrientCommands() and is updated in Update()). 521 float m_fTimeModifier; 522 523 // Ghoul2 Animation info. 524 //int m_iDriverTag; 525 int m_iLeftExhaustTag; 526 int m_iRightExhaustTag; 527 int m_iGun1Tag; 528 int m_iGun1Bone; 529 int m_iLeftWingBone; 530 int m_iRightWingBone; 531 532 int m_iExhaustTag[MAX_VEHICLE_EXHAUSTS]; 533 int m_iMuzzleTag[MAX_VEHICLE_MUZZLES]; 534 int m_iDroidUnitTag; 535 int m_iGunnerViewTag[MAX_VEHICLE_TURRETS];//Where to put the view origin of the gunner (index) 536 537 //this stuff is a little bit different from SP, because I am lazy -rww 538 int m_iMuzzleTime[MAX_VEHICLE_MUZZLES]; 539 // These are updated every frame and represent the current position and direction for the specific muzzle. 540 vec3_t m_vMuzzlePos[MAX_VEHICLE_MUZZLES], m_vMuzzleDir[MAX_VEHICLE_MUZZLES]; 541 542 // This is how long to wait before being able to fire a specific muzzle again. This is based on the firing rate 543 // so that a firing rate of 10 rounds/sec would make this value initially 100 miliseconds. 544 int m_iMuzzleWait[MAX_VEHICLE_MUZZLES]; 545 546 // The user commands structure. 547 usercmd_t m_ucmd; 548 549 // The direction an entity will eject from the vehicle towards. 550 int m_EjectDir; 551 552 // Flags that describe the vehicles behavior. 553 unsigned long m_ulFlags; 554 555 // NOTE: Vehicle Type ID, Orientation, and Armor MUST be transmitted over the net. 556 557 // The ID of the type of vehicle this is. 558 int m_iVehicleTypeID; 559 560 // Current angles of this vehicle. 561 //vec3_t m_vOrientation; 562 float *m_vOrientation; 563 //Yeah, since we use the SP code for vehicles, I want to use this value, but I'm going 564 //to make it a pointer to a vec3_t in the playerstate for prediction's sake. -rww 565 566 // How long you have strafed left or right (increments every frame that you strafe to right, decrements every frame you strafe left) 567 int m_fStrafeTime; 568 569 // Previous angles of this vehicle. 570 vec3_t m_vPrevOrientation; 571 572 // Previous viewangles of the rider 573 vec3_t m_vPrevRiderViewAngles; 574 575 // When control is lost on a speeder, current angular velocity is stored here and applied until landing 576 float m_vAngularVelocity; 577 578 vec3_t m_vFullAngleVelocity; 579 580 // Current armor and shields of your vehicle (explodes if armor to 0). 581 int m_iArmor; //hull strength - STAT_HEALTH on NPC 582 int m_iShields; //energy shielding - STAT_ARMOR on NPC 583 584 //mp-specific 585 int m_iHitDebounce; 586 587 // Timer for all cgame-FX...? ex: exhaust? 588 int m_iLastFXTime; 589 590 // When to die. 591 int m_iDieTime; 592 593 // This pointer is to a valid VehicleInfo (which could be an animal, speeder, fighter, whatever). This 594 // contains the functions actually used to do things to this specific kind of vehicle as well as shared 595 // information (max speed, type, etc...). 596 vehicleInfo_t *m_pVehicleInfo; 597 598 // This trace tells us if we're within landing height. 599 trace_t m_LandTrace; 600 601 // TEMP: The wing angles (used to animate it). 602 vec3_t m_vWingAngles; 603 604 //amount of damage done last impact 605 int m_iLastImpactDmg; 606 607 //bitflag of surfaces that have broken off 608 int m_iRemovedSurfaces; 609 610 int m_iDmgEffectTime; 611 612 // the last time this vehicle fired a turbo burst 613 int m_iTurboTime; 614 615 //how long it should drop like a rock for after freed from SUSPEND 616 int m_iDropTime; 617 618 int m_iSoundDebounceTimer; 619 620 //last time we incremented the shields 621 int lastShieldInc; 622 623 //so we don't hold it down and toggle it back and forth 624 qboolean linkWeaponToggleHeld; 625 626 //info about our weapons (linked, ammo, etc.) 627 vehWeaponStatus_t weaponStatus[MAX_VEHICLE_WEAPONS]; 628 vehTurretStatus_t turretStatus[MAX_VEHICLE_TURRETS]; 629 630 //the guy who was previously the pilot 631 bgEntity_t * m_pOldPilot; 632 #if defined(__GNUC__) || defined(__GCC__) || defined(MINGW32) || defined(MACOS_X) 633 }; 634 #else 635 } Vehicle_t; 636 #endif 637 638 extern int BG_VehicleGetIndex( const char *vehicleName ); 639