codemp/game/bg_vehicleLoad.c File Reference

#include "g_local.h"
#include "..\Ratl\string_vs.h"

Go to the source code of this file.

Data Structures

struct  vehField_t

Defines

#define QAGAME
#define MAX_VEH_WEAPON_DATA_SIZE   0x4000
#define MAX_VEHICLE_DATA_SIZE   0x10000

Enumerations

enum  vehFieldType_t {
  VF_IGNORE, VF_INT, VF_FLOAT, VF_LSTRING,
  VF_VECTOR, VF_BOOL, VF_VEHTYPE, VF_ANIM,
  VF_WEAPON, VF_MODEL, VF_MODEL_CLIENT, VF_EFFECT,
  VF_EFFECT_CLIENT, VF_SHADER, VF_SHADER_NOMIP, VF_SOUND,
  VF_SOUND_CLIENT
}

Functions

void G_SetSharedVehicleFunctions (vehicleInfo_t *pVehInfo)
int G_ModelIndex (const char *name)
int G_SoundIndex (const char *name)
void BG_ClearVehicleParseParms (void)
void G_SetAnimalVehicleFunctions (vehicleInfo_t *pVehInfo)
void G_SetSpeederVehicleFunctions (vehicleInfo_t *pVehInfo)
void G_SetWalkerVehicleFunctions (vehicleInfo_t *pVehInfo)
void G_SetFighterVehicleFunctions (vehicleInfo_t *pVehInfo)
void BG_VehicleLoadParms (void)
int VEH_LoadVehWeapon (const char *vehWeaponName)
int VEH_VehWeaponIndexForName (const char *vehWeaponName)
void BG_SetSharedVehicleFunctions (vehicleInfo_t *pVehInfo)
void BG_VehicleSetDefaults (vehicleInfo_t *vehicle)
void BG_VehicleClampData (vehicleInfo_t *vehicle)
int VEH_LoadVehicle (const char *vehicleName)
int VEH_VehicleIndexForName (const char *vehicleName)
void BG_VehWeaponLoadParms (void)
int BG_VehicleGetIndex (const char *vehicleName)
void BG_GetVehicleModelName (char *modelname)
void BG_GetVehicleSkinName (char *skinname)

Variables

stringID_table_t animTable [MAX_ANIMATIONS+1]
char VehWeaponParms [MAX_VEH_WEAPON_DATA_SIZE]
char VehicleParms [MAX_VEHICLE_DATA_SIZE]
vehWeaponInfo_t g_vehWeaponInfo [MAX_VEH_WEAPONS]
int numVehicleWeapons = 1
vehicleInfo_t g_vehicleInfo [MAX_VEHICLES]
int numVehicles = 0
vehField_t vehWeaponFields [NUM_VWEAP_PARMS]
vehField_t vehicleFields []
stringID_table_t VehicleTable [VH_NUM_VEHICLES+1]


Define Documentation

#define MAX_VEH_WEAPON_DATA_SIZE   0x4000
 

Definition at line 72 of file bg_vehicleLoad.c.

Referenced by BG_VehWeaponLoadParms().

#define MAX_VEHICLE_DATA_SIZE   0x10000
 

Definition at line 73 of file bg_vehicleLoad.c.

Referenced by BG_VehicleLoadParms().

#define QAGAME
 

Definition at line 25 of file bg_vehicleLoad.c.


Enumeration Type Documentation

enum vehFieldType_t
 

Enumeration values:
VF_IGNORE 
VF_INT 
VF_FLOAT 
VF_LSTRING 
VF_VECTOR 
VF_BOOL 
VF_VEHTYPE 
VF_ANIM 
VF_WEAPON 
VF_MODEL 
VF_MODEL_CLIENT 
VF_EFFECT 
VF_EFFECT_CLIENT 
VF_SHADER 
VF_SHADER_NOMIP 
VF_SOUND 
VF_SOUND_CLIENT 

Definition at line 111 of file bg_vehicleLoad.c.

00111              {
00112         VF_IGNORE,
00113         VF_INT,
00114         VF_FLOAT,
00115         VF_LSTRING,     // string on disk, pointer in memory, TAG_LEVEL
00116         VF_VECTOR,
00117         VF_BOOL,
00118         VF_VEHTYPE,
00119         VF_ANIM,
00120         VF_WEAPON,      // take string, resolve into index into VehWeaponParms
00121         VF_MODEL,       // take the string, get the G_ModelIndex
00122         VF_MODEL_CLIENT,        // (cgame only) take the string, get the G_ModelIndex
00123         VF_EFFECT,      // take the string, get the G_EffectIndex
00124         VF_EFFECT_CLIENT,       // (cgame only) take the string, get the index
00125         VF_SHADER,      // (cgame only) take the string, call trap_R_RegisterShader
00126         VF_SHADER_NOMIP,// (cgame only) take the string, call trap_R_RegisterShaderNoMip
00127         VF_SOUND,       // take the string, get the G_SoundIndex
00128         VF_SOUND_CLIENT // (cgame only) take the string, get the index
00129 } vehFieldType_t;


Function Documentation

void BG_ClearVehicleParseParms void   ) 
 

Definition at line 79 of file bg_vehicleLoad.c.

References VehicleParms, and VehWeaponParms.

Referenced by G_InitGame().

00080 {
00081         //You can't strcat to these forever without clearing them!
00082         VehWeaponParms[0] = 0;
00083         VehicleParms[0] = 0;
00084 }

void BG_GetVehicleModelName char *  modelname  ) 
 

Definition at line 1599 of file bg_vehicleLoad.c.

References BG_VehicleGetIndex(), Com_Error(), ERR_DROP, g_vehicleInfo, strcpy(), and VEHICLE_NONE.

Referenced by CG_CacheG2AnimInfo(), CG_G2AnimEntModelLoad(), and SetupGameGhoul2Model().

01600 {
01601         char *vehName = &modelname[1];
01602         int vIndex = BG_VehicleGetIndex(vehName);
01603         assert(modelname[0] == '$');
01604         
01605         if (vIndex == VEHICLE_NONE)
01606         {
01607                 Com_Error(ERR_DROP, "BG_GetVehicleModelName:  couldn't find vehicle %s", vehName);
01608         }
01609 
01610     strcpy(modelname, g_vehicleInfo[vIndex].model);     
01611 }

void BG_GetVehicleSkinName char *  skinname  ) 
 

Definition at line 1613 of file bg_vehicleLoad.c.

References BG_VehicleGetIndex(), Com_Error(), ERR_DROP, g_vehicleInfo, vehicleInfo_t::skin, strcpy(), and VEHICLE_NONE.

Referenced by CG_CacheG2AnimInfo().

01614 {
01615         char *vehName = &skinname[1];
01616         int vIndex = BG_VehicleGetIndex(vehName);
01617         assert(skinname[0] == '$');
01618         
01619         if (vIndex == VEHICLE_NONE)
01620         {
01621                 Com_Error(ERR_DROP, "BG_GetVehicleSkinName:  couldn't find vehicle %s", vehName);
01622         }
01623 
01624     if ( !g_vehicleInfo[vIndex].skin 
01625                 || !g_vehicleInfo[vIndex].skin[0] )
01626         {
01627                 skinname[0] = 0;
01628         }
01629         else
01630         {
01631                 strcpy(skinname, g_vehicleInfo[vIndex].skin);   
01632         }
01633 }

void BG_SetSharedVehicleFunctions vehicleInfo_t pVehInfo  ) 
 

Definition at line 683 of file bg_vehicleLoad.c.

References G_SetAnimalVehicleFunctions(), G_SetFighterVehicleFunctions(), G_SetSharedVehicleFunctions(), G_SetSpeederVehicleFunctions(), G_SetWalkerVehicleFunctions(), vehicleInfo_t::type, VH_ANIMAL, VH_FIGHTER, VH_SPEEDER, and VH_WALKER.

Referenced by BG_VehicleLoadParms(), and VEH_LoadVehicle().

00684 {
00685 #ifdef QAGAME
00686         //only do the whole thing if we're on game
00687         G_SetSharedVehicleFunctions(pVehInfo);
00688 #endif
00689 
00690 #ifndef WE_ARE_IN_THE_UI
00691         switch( pVehInfo->type )
00692         {
00693                 case VH_SPEEDER:
00694                         G_SetSpeederVehicleFunctions( pVehInfo );
00695                         break;
00696                 case VH_ANIMAL:
00697                         G_SetAnimalVehicleFunctions( pVehInfo );
00698                         break;
00699                 case VH_FIGHTER:
00700                         G_SetFighterVehicleFunctions( pVehInfo );
00701                         break;
00702                 case VH_WALKER:
00703                         G_SetWalkerVehicleFunctions( pVehInfo );
00704                         break;
00705         }
00706 #endif
00707 }

void BG_VehicleClampData vehicleInfo_t vehicle  ) 
 

Definition at line 812 of file bg_vehicleLoad.c.

References vehicleInfo_t::centerOfGravity, vehicleInfo_t::maxPassengers, and VEH_MAX_PASSENGERS.

Referenced by BG_VehicleLoadParms(), and VEH_LoadVehicle().

00813 {//sanity check and clamp the vehicle's data
00814         int             i;
00815 
00816         for ( i = 0; i < 3; i++ )
00817         {
00818                 if ( vehicle->centerOfGravity[i] > 1.0f )
00819                 {
00820                         vehicle->centerOfGravity[i] = 1.0f;
00821                 }
00822                 else if ( vehicle->centerOfGravity[i] < -1.0f )
00823                 {
00824                         vehicle->centerOfGravity[i] = -1.0f;
00825                 }
00826         }
00827 
00828         // Validate passenger max.
00829         if ( vehicle->maxPassengers > VEH_MAX_PASSENGERS )
00830         {
00831                 vehicle->maxPassengers = VEH_MAX_PASSENGERS;
00832         }
00833         else if ( vehicle->maxPassengers < 0 )
00834         {
00835                 vehicle->maxPassengers = 0;
00836         }
00837 }

int BG_VehicleGetIndex const char *  vehicleName  ) 
 

Definition at line 1590 of file bg_vehicleLoad.c.

References VEH_VehicleIndexForName().

Referenced by BG_GetVehicleModelName(), BG_GetVehicleSkinName(), CG_G2AnimEntModelLoad(), G_CreateAnimalNPC(), G_CreateFighterNPC(), G_CreateSpeederNPC(), G_CreateWalkerNPC(), NPC_Spawn_Do(), and NPC_VehiclePrecache().

01591 {
01592         return (VEH_VehicleIndexForName( vehicleName ));
01593 }

void BG_VehicleLoadParms void   ) 
 

void BG_VehicleSetDefaults vehicleInfo_t vehicle  ) 
 

Definition at line 709 of file bg_vehicleLoad.c.

References memset().

Referenced by BG_VehicleLoadParms(), and VEH_LoadVehicle().

00710 {
00711         memset(vehicle, 0, sizeof(vehicleInfo_t));
00712 /*
00713 #if _JK2MP
00714         if (!vehicle->name)
00715         {
00716                 vehicle->name = (char *)BG_Alloc(1024);
00717         }
00718         strcpy(vehicle->name, "default");
00719 #else
00720         vehicle->name = G_NewString( "default" );
00721 #endif
00722 
00723         //general data
00724         vehicle->type = VH_SPEEDER;                             //what kind of vehicle
00725         //FIXME: no saber or weapons if numHands = 2, should switch to speeder weapon, no attack anim on player
00726         vehicle->numHands = 0;                                  //if 2 hands, no weapons, if 1 hand, can use 1-handed weapons, if 0 hands, can use 2-handed weapons
00727         vehicle->lookPitch = 0;                         //How far you can look up and down off the forward of the vehicle
00728         vehicle->lookYaw = 5;                                   //How far you can look left and right off the forward of the vehicle
00729         vehicle->length = 0;                                    //how long it is - used for body length traces when turning/moving?
00730         vehicle->width = 0;                                             //how wide it is - used for body length traces when turning/moving?
00731         vehicle->height = 0;                                    //how tall it is - used for body length traces when turning/moving?
00732         VectorClear( vehicle->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)
00733 
00734         //speed stats - note: these are DESIRED speed, not actual current speed/velocity
00735         vehicle->speedMax = VEH_DEFAULT_SPEED_MAX;      //top speed
00736         vehicle->turboSpeed = 0;                                        //turboBoost
00737         vehicle->speedMin = 0;                                          //if < 0, can go in reverse
00738         vehicle->speedIdle = 0;                                         //what speed it drifts to when no accel/decel input is given
00739         vehicle->accelIdle = 0;                                         //if speedIdle > 0, how quickly it goes up to that speed
00740         vehicle->acceleration = VEH_DEFAULT_ACCEL;      //when pressing on accelerator (1/2 this when going in reverse)
00741         vehicle->decelIdle = VEH_DEFAULT_DECEL;         //when giving no input, how quickly it desired speed drops to speedIdle
00742         vehicle->strafePerc = VEH_DEFAULT_STRAFE_PERC;//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
00743 
00744         //handling stats
00745         vehicle->bankingSpeed = VEH_DEFAULT_BANKING_SPEED;      //how quickly it pitches and rolls (not under player control)
00746         vehicle->rollLimit = VEH_DEFAULT_ROLL_LIMIT;            //how far it can roll to either side
00747         vehicle->pitchLimit = VEH_DEFAULT_PITCH_LIMIT;          //how far it can pitch forward or backward
00748         vehicle->braking = VEH_DEFAULT_BRAKING;                         //when pressing on decelerator (backwards)
00749         vehicle->turningSpeed = VEH_DEFAULT_TURNING_SPEED;      //how quickly you can turn
00750         vehicle->turnWhenStopped = qfalse;                                      //whether or not you can turn when not moving   
00751         vehicle->traction = VEH_DEFAULT_TRACTION;                       //how much your command input affects velocity
00752         vehicle->friction = VEH_DEFAULT_FRICTION;                       //how much velocity is cut on its own
00753         vehicle->maxSlope = VEH_DEFAULT_MAX_SLOPE;                      //the max slope that it can go up with control
00754 
00755         //durability stats
00756         vehicle->mass = VEH_DEFAULT_MASS;                       //for momentum and impact force (player mass is 10)
00757         vehicle->armor = VEH_DEFAULT_MAX_ARMOR;         //total points of damage it can take
00758         vehicle->toughness = VEH_DEFAULT_TOUGHNESS;     //modifies incoming damage, 1.0 is normal, 0.5 is half, etc.  Simulates being made of tougher materials/construction
00759         vehicle->malfunctionArmorLevel = 0;                     //when armor drops to or below this point, start malfunctioning
00760 
00761         //visuals & sounds
00762         //vehicle->model = "models/map_objects/ships/swoop.md3";        //what model to use - if make it an NPC's primary model, don't need this?
00763         if (!vehicle->model)
00764         {
00765                 vehicle->model = (char *)BG_Alloc(1024);
00766         }
00767         strcpy(vehicle->model, "models/map_objects/ships/swoop.md3");
00768 
00769         vehicle->modelIndex = 0;                                                        //set internally, not until this vehicle is spawned into the level
00770         vehicle->skin = NULL;                                                           //what skin to use - if make it an NPC's primary model, don't need this?
00771         vehicle->riderAnim = BOTH_GUNSIT1;                                      //what animation the rider uses
00772 
00773         vehicle->soundOn = NULL;                                                        //sound to play when get on it
00774         vehicle->soundLoop = NULL;                                                      //sound to loop while riding it
00775         vehicle->soundOff = NULL;                                                       //sound to play when get off
00776         vehicle->exhaustFX = NULL;                                                      //exhaust effect, played from "*exhaust" bolt(s)
00777         vehicle->trailFX = NULL;                                                        //trail effect, played from "*trail" bolt(s)
00778         vehicle->impactFX = NULL;                                                       //explosion effect, for when it blows up (should have the sound built into explosion effect)
00779         vehicle->explodeFX = NULL;                                                      //explosion effect, for when it blows up (should have the sound built into explosion effect)
00780         vehicle->wakeFX = NULL;                                                         //effect itmakes when going across water
00781 
00782         //other misc stats
00783         vehicle->gravity = VEH_DEFAULT_GRAVITY;                         //normal is 800
00784         vehicle->hoverHeight = 0;//VEH_DEFAULT_HOVER_HEIGHT;    //if 0, it's a ground vehicle
00785         vehicle->hoverStrength = 0;//VEH_DEFAULT_HOVER_STRENGTH;//how hard it pushes off ground when less than hover height... causes "bounce", like shocks
00786         vehicle->waterProof = qtrue;                                            //can drive underwater if it has to
00787         vehicle->bouyancy = 1.0f;                                                       //when in water, how high it floats (1 is neutral bouyancy)
00788         vehicle->fuelMax = 1000;                                                        //how much fuel it can hold (capacity)
00789         vehicle->fuelRate = 1;                                                          //how quickly is uses up fuel
00790         vehicle->visibility = VEH_DEFAULT_VISIBILITY;           //radius for sight alerts
00791         vehicle->loudness = VEH_DEFAULT_LOUDNESS;                       //radius for sound alerts
00792         vehicle->explosionRadius = VEH_DEFAULT_EXP_RAD;
00793         vehicle->explosionDamage = VEH_DEFAULT_EXP_DMG;
00794         vehicle->maxPassengers = 0;
00795 
00796         //new stuff
00797         vehicle->hideRider = qfalse;                                            // rider (and passengers?) should not be drawn
00798         vehicle->killRiderOnDeath = qfalse;                                     //if rider is on vehicle when it dies, they should die
00799         vehicle->flammable = qfalse;                                            //whether or not the vehicle should catch on fire before it explodes
00800         vehicle->explosionDelay = 0;                                            //how long the vehicle should be on fire/dying before it explodes
00801         //camera stuff
00802         vehicle->cameraOverride = qfalse;                                       //whether or not to use all of the following 3rd person camera override values
00803         vehicle->cameraRange = 0.0f;                                            //how far back the camera should be - normal is 80
00804         vehicle->cameraVertOffset = 0.0f;                                       //how high over the vehicle origin the camera should be - normal is 16
00805         vehicle->cameraHorzOffset = 0.0f;                                       //how far to left/right (negative/positive) of of the vehicle origin the camera should be - normal is 0
00806         vehicle->cameraPitchOffset = 0.0f;                                      //a modifier on the camera's pitch (up/down angle) to the vehicle - normal is 0
00807         vehicle->cameraFOV = 0.0f;                                                      //third person camera FOV, default is 80
00808         vehicle->cameraAlpha = qfalse;                                          //fade out the vehicle if it's in the way of the crosshair
00809 */
00810 }

void BG_VehWeaponLoadParms void   ) 
 

Definition at line 1396 of file bg_vehicleLoad.c.

References BG_TempAlloc(), BG_TempFree(), Com_Error(), Com_Printf(), ERR_DROP, fileHandle_t, FS_READ, MAX_VEH_WEAPON_DATA_SIZE, NULL, qtrue, strcat(), strlen(), trap_FS_FCloseFile(), trap_FS_FOpenFile(), trap_FS_GetFileList(), trap_FS_Read(), va(), and VehWeaponParms.

Referenced by BG_VehicleLoadParms().

01397 {
01398         int                     len, totallen, vehExtFNLen, mainBlockLen, fileCnt, i;
01399         char            *holdChar, *marker;
01400         char            vehWeaponExtensionListBuf[2048];                        //      The list of file names read in
01401         fileHandle_t    f;
01402         char            *tempReadBuffer;
01403 
01404         len = 0;
01405 
01406         //remember where to store the next one
01407         totallen = mainBlockLen = len;
01408         marker = VehWeaponParms+totallen;
01409         *marker = 0;
01410 
01411         //now load in the extra .veh extensions
01412 #ifdef _JK2MP
01413         fileCnt = trap_FS_GetFileList("ext_data/vehicles/weapons", ".vwp", vehWeaponExtensionListBuf, sizeof(vehWeaponExtensionListBuf) );
01414 #else
01415         fileCnt = gi.FS_GetFileList("ext_data/vehicles/weapons", ".vwp", vehWeaponExtensionListBuf, sizeof(vehWeaponExtensionListBuf) );
01416 #endif
01417 
01418         holdChar = vehWeaponExtensionListBuf;
01419 
01420 #ifdef _JK2MP
01421         tempReadBuffer = (char *)BG_TempAlloc(MAX_VEH_WEAPON_DATA_SIZE);
01422 #else
01423         tempReadBuffer = (char *)gi.Malloc( MAX_VEH_WEAPON_DATA_SIZE, TAG_G_ALLOC, qtrue );
01424 #endif
01425         
01426         // NOTE: Not use TempAlloc anymore...
01427         //Make ABSOLUTELY CERTAIN that BG_Alloc/etc. is not used before
01428         //the subsequent BG_TempFree or the pool will be screwed. 
01429 
01430         for ( i = 0; i < fileCnt; i++, holdChar += vehExtFNLen + 1 ) 
01431         {
01432                 vehExtFNLen = strlen( holdChar );
01433 
01434 //              Com_Printf( "Parsing %s\n", holdChar );
01435 
01436 #ifdef _JK2MP
01437                 len = trap_FS_FOpenFile(va( "ext_data/vehicles/weapons/%s", holdChar), &f, FS_READ);
01438 #else
01439 //              len = gi.FS_ReadFile( va( "ext_data/vehicles/weapons/%s", holdChar), (void **) &buffer );
01440                 len = gi.FS_FOpenFile(va( "ext_data/vehicles/weapons/%s", holdChar), &f, FS_READ);
01441 #endif
01442 
01443                 if ( len == -1 ) 
01444                 {
01445                         Com_Printf( "error reading file\n" );
01446                 }
01447                 else
01448                 {
01449 #ifdef _JK2MP
01450                         trap_FS_Read(tempReadBuffer, len, f);
01451                         tempReadBuffer[len] = 0;
01452 #else
01453                         gi.FS_Read(tempReadBuffer, len, f);
01454                         tempReadBuffer[len] = 0;
01455 #endif
01456 
01457                         // Don't let it end on a } because that should be a stand-alone token.
01458                         if ( totallen && *(marker-1) == '}' )
01459                         {
01460                                 strcat( marker, " " );
01461                                 totallen++;
01462                                 marker++; 
01463                         }
01464 
01465                         if ( totallen + len >= MAX_VEH_WEAPON_DATA_SIZE ) {
01466                                 Com_Error(ERR_DROP, "Vehicle Weapon extensions (*.vwp) are too large" );
01467                         }
01468                         strcat( marker, tempReadBuffer );
01469 #ifdef _JK2MP
01470                         trap_FS_FCloseFile( f );
01471 #else
01472                         gi.FS_FCloseFile( f );
01473 #endif
01474 
01475                         totallen += len;
01476                         marker = VehWeaponParms+totallen;
01477                 }
01478         }
01479 
01480 #ifdef _JK2MP
01481         BG_TempFree(MAX_VEH_WEAPON_DATA_SIZE);
01482 #else
01483         gi.Free(tempReadBuffer);        tempReadBuffer = NULL;
01484 #endif
01485 }

int G_ModelIndex const char *  name  ) 
 

Definition at line 108 of file g_utils.c.

Referenced by SP_misc_G2model().

00108                                      {
00109 #ifdef _DEBUG_MODEL_PATH_ON_SERVER
00110         //debug to see if we are shoving data into configstrings for models that don't exist, and if
00111         //so, where we are doing it from -rww
00112         fileHandle_t fh;
00113 
00114         trap_FS_FOpenFile(name, &fh, FS_READ);
00115         if (!fh)
00116         { //try models/ then, this is assumed for registering models
00117                 trap_FS_FOpenFile(va("models/%s", name), &fh, FS_READ);
00118                 if (!fh)
00119                 {
00120                         Com_Printf("ERROR: Server tried to modelindex %s but it doesn't exist.\n", name);
00121                 }
00122         }
00123 
00124         if (fh)
00125         {
00126                 trap_FS_FCloseFile(fh);
00127         }
00128 #endif
00129         return G_FindConfigstringIndex (name, CS_MODELS, MAX_MODELS, qtrue);
00130 }

void G_SetAnimalVehicleFunctions vehicleInfo_t pVehInfo  ) 
 

Definition at line 857 of file AnimalNPC.c.

References vehicleInfo_t::AnimateRiders, vehicleInfo_t::AnimateVehicle, vehicleInfo_t::AttachRiders, vehicleInfo_t::DeathUpdate, vehicleInfo_t::ProcessMoveCommands, vehicleInfo_t::ProcessOrientCommands, and vehicleInfo_t::Update.

Referenced by BG_SetSharedVehicleFunctions().

00858 {
00859 #ifdef QAGAME
00860         pVehInfo->AnimateVehicle                        =               AnimateVehicle;
00861         pVehInfo->AnimateRiders                         =               AnimateRiders;
00862 //      pVehInfo->ValidateBoard                         =               ValidateBoard;
00863 //      pVehInfo->SetParent                                     =               SetParent;
00864 //      pVehInfo->SetPilot                                      =               SetPilot;
00865 //      pVehInfo->AddPassenger                          =               AddPassenger;
00866 //      pVehInfo->Animate                                       =               Animate;
00867 //      pVehInfo->Board                                         =               Board;
00868 //      pVehInfo->Eject                                         =               Eject;
00869 //      pVehInfo->EjectAll                                      =               EjectAll;
00870 //      pVehInfo->StartDeathDelay                       =               StartDeathDelay;
00871         pVehInfo->DeathUpdate                           =               DeathUpdate;
00872 //      pVehInfo->RegisterAssets                        =               RegisterAssets;
00873 //      pVehInfo->Initialize                            =               Initialize;
00874         pVehInfo->Update                                        =               Update;
00875 //      pVehInfo->UpdateRider                           =               UpdateRider;
00876 #endif //QAGAME
00877         pVehInfo->ProcessMoveCommands           =               ProcessMoveCommands;
00878         pVehInfo->ProcessOrientCommands         =               ProcessOrientCommands;
00879 
00880 #ifndef QAGAME //cgame prediction attachment func
00881         pVehInfo->AttachRiders                          =               AttachRidersGeneric;
00882 #endif
00883 //      pVehInfo->AttachRiders                          =               AttachRiders;
00884 //      pVehInfo->Ghost                                         =               Ghost;
00885 //      pVehInfo->UnGhost                                       =               UnGhost;
00886 //      pVehInfo->Inhabited                                     =               Inhabited;
00887 }

void G_SetFighterVehicleFunctions vehicleInfo_t pVehInfo  ) 
 

Definition at line 1952 of file FighterNPC.c.

References vehicleInfo_t::AnimateRiders, vehicleInfo_t::AnimateVehicle, vehicleInfo_t::AttachRiders, vehicleInfo_t::Board, vehicleInfo_t::Eject, vehicleInfo_t::ProcessMoveCommands, vehicleInfo_t::ProcessOrientCommands, and vehicleInfo_t::Update.

Referenced by BG_SetSharedVehicleFunctions().

01953 {
01954 #ifdef QAGAME //ONLY in SP or on server, not cgame
01955         pVehInfo->AnimateVehicle                        =               AnimateVehicle;
01956         pVehInfo->AnimateRiders                         =               AnimateRiders;
01957 //      pVehInfo->ValidateBoard                         =               ValidateBoard;
01958 //      pVehInfo->SetParent                                     =               SetParent;
01959 //      pVehInfo->SetPilot                                      =               SetPilot;
01960 //      pVehInfo->AddPassenger                          =               AddPassenger;
01961 //      pVehInfo->Animate                                       =               Animate;
01962         pVehInfo->Board                                         =               Board;
01963         pVehInfo->Eject                                         =               Eject;
01964 //      pVehInfo->EjectAll                                      =               EjectAll;
01965 //      pVehInfo->StartDeathDelay                       =               StartDeathDelay;
01966 //      pVehInfo->DeathUpdate                           =               DeathUpdate;
01967 //      pVehInfo->RegisterAssets                        =               RegisterAssets;
01968 //      pVehInfo->Initialize                            =               Initialize;
01969         pVehInfo->Update                                        =               Update;
01970 //      pVehInfo->UpdateRider                           =               UpdateRider;
01971 #endif //game-only
01972         pVehInfo->ProcessMoveCommands           =               ProcessMoveCommands;
01973         pVehInfo->ProcessOrientCommands         =               ProcessOrientCommands;
01974 
01975 #ifndef QAGAME //cgame prediction attachment func
01976         pVehInfo->AttachRiders                          =               AttachRidersGeneric;
01977 #endif
01978 //      pVehInfo->AttachRiders                          =               AttachRiders;
01979 //      pVehInfo->Ghost                                         =               Ghost;
01980 //      pVehInfo->UnGhost                                       =               UnGhost;
01981 //      pVehInfo->Inhabited                                     =               Inhabited;
01982 }

void G_SetSharedVehicleFunctions vehicleInfo_t pVehInfo  ) 
 

Definition at line 3298 of file g_vehicles.c.

References vehicleInfo_t::AddPassenger, AddPassenger(), vehicleInfo_t::Animate, Animate(), vehicleInfo_t::AttachRiders, vehicleInfo_t::Board, Board(), vehicleInfo_t::DeathUpdate, vehicleInfo_t::Eject, Eject(), vehicleInfo_t::EjectAll, EjectAll(), vehicleInfo_t::Ghost, vehicleInfo_t::Inhabited, Inhabited(), vehicleInfo_t::Initialize, Initialize(), vehicleInfo_t::RegisterAssets, RegisterAssets(), vehicleInfo_t::SetParent, SetParent(), vehicleInfo_t::SetPilot, SetPilot(), vehicleInfo_t::StartDeathDelay, vehicleInfo_t::UnGhost, vehicleInfo_t::Update, vehicleInfo_t::UpdateRider, vehicleInfo_t::ValidateBoard, and ValidateBoard().

Referenced by BG_SetSharedVehicleFunctions().

03299 {
03300 //      pVehInfo->AnimateVehicle                                =               AnimateVehicle;
03301 //      pVehInfo->AnimateRiders                                 =               AnimateRiders;
03302         pVehInfo->ValidateBoard                                 =               ValidateBoard;
03303         pVehInfo->SetParent                                             =               SetParent;
03304         pVehInfo->SetPilot                                              =               SetPilot;
03305         pVehInfo->AddPassenger                                  =               AddPassenger;
03306         pVehInfo->Animate                                               =               Animate;
03307         pVehInfo->Board                                                 =               Board;
03308         pVehInfo->Eject                                                 =               Eject;
03309         pVehInfo->EjectAll                                              =               EjectAll;
03310         pVehInfo->StartDeathDelay                               =               StartDeathDelay;
03311         pVehInfo->DeathUpdate                                   =               DeathUpdate;
03312         pVehInfo->RegisterAssets                                =               RegisterAssets;
03313         pVehInfo->Initialize                                    =               Initialize;
03314         pVehInfo->Update                                                =               Update;
03315         pVehInfo->UpdateRider                                   =               UpdateRider;
03316 //      pVehInfo->ProcessMoveCommands                   =               ProcessMoveCommands;
03317 //      pVehInfo->ProcessOrientCommands                 =               ProcessOrientCommands;
03318         pVehInfo->AttachRiders                                  =               AttachRiders;
03319         pVehInfo->Ghost                                                 =               Ghost;
03320         pVehInfo->UnGhost                                               =               UnGhost;
03321         pVehInfo->Inhabited                                             =               Inhabited;
03322 }

void G_SetSpeederVehicleFunctions vehicleInfo_t pVehInfo  ) 
 

Definition at line 1044 of file SpeederNPC.c.

References vehicleInfo_t::AnimateRiders, AnimateRiders(), vehicleInfo_t::AnimateVehicle, AnimateVehicle(), vehicleInfo_t::AttachRiders, vehicleInfo_t::ProcessMoveCommands, vehicleInfo_t::ProcessOrientCommands, ProcessOrientCommands(), vehicleInfo_t::Update, and Update().

Referenced by BG_SetSharedVehicleFunctions().

01045 {
01046 #ifdef QAGAME
01047         pVehInfo->AnimateVehicle                        =               AnimateVehicle;
01048         pVehInfo->AnimateRiders                         =               AnimateRiders;
01049 //      pVehInfo->ValidateBoard                         =               ValidateBoard;
01050 //      pVehInfo->SetParent                                     =               SetParent;
01051 //      pVehInfo->SetPilot                                      =               SetPilot;
01052 //      pVehInfo->AddPassenger                          =               AddPassenger;
01053 //      pVehInfo->Animate                                       =               Animate;
01054 //      pVehInfo->Board                                         =               Board;
01055 //      pVehInfo->Eject                                         =               Eject;
01056 //      pVehInfo->EjectAll                                      =               EjectAll;
01057 //      pVehInfo->StartDeathDelay                       =               StartDeathDelay;
01058 //      pVehInfo->DeathUpdate                           =               DeathUpdate;
01059 //      pVehInfo->RegisterAssets                        =               RegisterAssets;
01060 //      pVehInfo->Initialize                            =               Initialize;
01061         pVehInfo->Update                                        =               Update;
01062 //      pVehInfo->UpdateRider                           =               UpdateRider;
01063 #endif
01064 
01065         //shared
01066         pVehInfo->ProcessMoveCommands           =               ProcessMoveCommands;
01067         pVehInfo->ProcessOrientCommands         =               ProcessOrientCommands;
01068 
01069 #ifndef QAGAME //cgame prediction attachment func
01070         pVehInfo->AttachRiders                          =               AttachRidersGeneric;
01071 #endif
01072 //      pVehInfo->AttachRiders                          =               AttachRiders;
01073 //      pVehInfo->Ghost                                         =               Ghost;
01074 //      pVehInfo->UnGhost                                       =               UnGhost;
01075 //      pVehInfo->Inhabited                                     =               Inhabited;
01076 }

void G_SetWalkerVehicleFunctions vehicleInfo_t pVehInfo  ) 
 

Definition at line 547 of file WalkerNPC.c.

References vehicleInfo_t::AnimateVehicle, AnimateVehicle(), vehicleInfo_t::AttachRiders, vehicleInfo_t::Board, Board(), vehicleInfo_t::ProcessMoveCommands, vehicleInfo_t::ProcessOrientCommands, ProcessOrientCommands(), vehicleInfo_t::RegisterAssets, and RegisterAssets().

Referenced by BG_SetSharedVehicleFunctions().

00548 {
00549 #ifdef QAGAME
00550         pVehInfo->AnimateVehicle                        =               AnimateVehicle;
00551 //      pVehInfo->AnimateRiders                         =               AnimateRiders;
00552 //      pVehInfo->ValidateBoard                         =               ValidateBoard;
00553 //      pVehInfo->SetParent                                     =               SetParent;
00554 //      pVehInfo->SetPilot                                      =               SetPilot;
00555 //      pVehInfo->AddPassenger                          =               AddPassenger;
00556 //      pVehInfo->Animate                                       =               Animate;
00557         pVehInfo->Board                                         =               Board;
00558 //      pVehInfo->Eject                                         =               Eject;
00559 //      pVehInfo->EjectAll                                      =               EjectAll;
00560 //      pVehInfo->StartDeathDelay                       =               StartDeathDelay;
00561 //      pVehInfo->DeathUpdate                           =               DeathUpdate;
00562         pVehInfo->RegisterAssets                        =               RegisterAssets;
00563 //      pVehInfo->Initialize                            =               Initialize;
00564 //      pVehInfo->Update                                        =               Update;
00565 //      pVehInfo->UpdateRider                           =               UpdateRider;
00566 #endif //QAGAME
00567         pVehInfo->ProcessMoveCommands           =               ProcessMoveCommands;
00568         pVehInfo->ProcessOrientCommands         =               ProcessOrientCommands;
00569 
00570 #ifndef QAGAME //cgame prediction attachment func
00571         pVehInfo->AttachRiders                          =               AttachRidersGeneric;
00572 #endif
00573 //      pVehInfo->AttachRiders                          =               AttachRiders;
00574 //      pVehInfo->Ghost                                         =               Ghost;
00575 //      pVehInfo->UnGhost                                       =               UnGhost;
00576 //      pVehInfo->Inhabited                                     =               Inhabited;
00577 }

int G_SoundIndex const char *  name  ) 
 

Definition at line 138 of file g_utils.c.

Referenced by NPC_BSGM_Attack(), Rancor_Attack(), and WP_ForcePowerStop().

00138                                      {
00139         assert(name && name[0]);
00140         return G_FindConfigstringIndex (name, CS_SOUNDS, MAX_SOUNDS, qtrue);
00141 }

int VEH_LoadVehicle const char *  vehicleName  ) 
 

Definition at line 983 of file bg_vehicleLoad.c.

References vehicleInfo_t::armor, BG_SetSharedVehicleFunctions(), BG_VehicleClampData(), BG_VehicleLoadParms(), BG_VehicleSetDefaults(), COM_BeginParseSession(), COM_ParseExt(), Com_Printf(), vehicleInfo_t::explosionDamage, vehicleInfo_t::flammable, G_EffectIndex(), G_ModelIndex(), G_SoundIndex(), g_vehicleInfo, vehicleInfo_t::health_back, vehicleInfo_t::health_front, vehicleInfo_t::health_left, vehicleInfo_t::health_right, vehicleInfo_t::hideRider, vehicleInfo_t::hoverHeight, vehicleInfo_t::model, vehicleInfo_t::modelIndex, NULL, numVehicles, Q_stricmp(), Q_strncpyz(), qtrue, S_COLOR_RED, vehicleInfo_t::skin, SkipBracedSection(), SkipRestOfLine(), trap_FX_RegisterEffect(), trap_R_RegisterModel(), trap_R_RegisterShader(), trap_R_RegisterShaderNoMip(), trap_R_RegisterSkin(), trap_S_RegisterSound(), va(), VEHICLE_NONE, and VehicleParms.

Referenced by VEH_VehicleIndexForName().

00984 {//load up specified vehicle and save in array: g_vehicleInfo
00985         const char      *token;
00986         //we'll assume that no parm name is longer than 128
00987         char            parmName[128] = { 0 };
00988         char            weap1[128] = { 0 }, weap2[128] = { 0 };
00989         char            weapMuzzle1[128] = { 0 };
00990         char            weapMuzzle2[128] = { 0 };
00991         char            weapMuzzle3[128] = { 0 };
00992         char            weapMuzzle4[128] = { 0 };
00993         char            weapMuzzle5[128] = { 0 };
00994         char            weapMuzzle6[128] = { 0 };
00995         char            weapMuzzle7[128] = { 0 };
00996         char            weapMuzzle8[128] = { 0 };
00997         char            weapMuzzle9[128] = { 0 };
00998         char            weapMuzzle10[128] = { 0 };
00999         char            *value = NULL;
01000         const char      *p = NULL;
01001         vehicleInfo_t   *vehicle = NULL;
01002 
01003         // Load the vehicle parms if no vehicles have been loaded yet.
01004         if ( numVehicles == 0 ) 
01005         {
01006                 BG_VehicleLoadParms();
01007         }
01008 
01009         //try to parse data out
01010         p = VehicleParms;
01011 
01012 #ifdef _JK2MP
01013         COM_BeginParseSession("vehicles");
01014 #else
01015         COM_BeginParseSession();
01016 #endif
01017 
01018         vehicle = &g_vehicleInfo[numVehicles];
01019         // look for the right vehicle
01020         while ( p ) 
01021         {
01022                 token = COM_ParseExt( &p, qtrue );
01023                 if ( token[0] == 0 )
01024                 {
01025                         return VEHICLE_NONE;
01026                 }
01027 
01028                 if ( !Q_stricmp( token, vehicleName ) ) 
01029                 {
01030                         break;
01031                 }
01032 
01033                 SkipBracedSection( &p );
01034         }
01035 
01036         if ( !p )
01037         {
01038                 return VEHICLE_NONE;
01039         }
01040 
01041         token = COM_ParseExt( &p, qtrue );
01042         if ( token[0] == 0 )
01043         {//barf
01044                 return VEHICLE_NONE;
01045         }
01046 
01047         if ( Q_stricmp( token, "{" ) != 0 ) 
01048         {
01049                 return VEHICLE_NONE;
01050         }
01051         
01052         BG_VehicleSetDefaults( vehicle );
01053         // parse the vehicle info block
01054         while ( 1 ) 
01055         {
01056                 SkipRestOfLine( &p );
01057                 token = COM_ParseExt( &p, qtrue );
01058                 if ( !token[0] ) 
01059                 {
01060                         Com_Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing Vehicle '%s'\n", vehicleName );
01061                         return VEHICLE_NONE;
01062                 }
01063 
01064                 if ( !Q_stricmp( token, "}" ) ) 
01065                 {
01066                         break;
01067                 }
01068                 Q_strncpyz( parmName, token, sizeof(parmName) );
01069                 value = COM_ParseExt( &p, qtrue );
01070                 if ( !value || !value[0] )
01071                 {
01072                         Com_Printf( S_COLOR_RED"ERROR: Vehicle token '%s' has no value!\n", parmName );
01073                 }
01074                 else if ( Q_stricmp( "weap1", parmName ) == 0 )
01075                 {//hmm, store this off because we don't want to call another one of these text parsing routines while we're in the middle of one...
01076                         Q_strncpyz( weap1, value, sizeof(weap1) );
01077                 }
01078                 else if ( Q_stricmp( "weap2", parmName ) == 0 )
01079                 {//hmm, store this off because we don't want to call another one of these text parsing routines while we're in the middle of one...
01080                         Q_strncpyz( weap2, value, sizeof(weap2) );
01081                 }
01082                 else if ( Q_stricmp( "weapMuzzle1", parmName ) == 0 )
01083                 {//hmm, store this off because we don't want to call another one of these text parsing routines while we're in the middle of one...
01084                         Q_strncpyz( weapMuzzle1, value, sizeof(weapMuzzle1) );
01085                 }
01086                 else if ( Q_stricmp( "weapMuzzle2", parmName ) == 0 )
01087                 {//hmm, store this off because we don't want to call another one of these text parsing routines while we're in the middle of one...
01088                         Q_strncpyz( weapMuzzle2, value, sizeof(weapMuzzle2) );
01089                 }
01090                 else if ( Q_stricmp( "weapMuzzle3", parmName ) == 0 )
01091                 {//hmm, store this off because we don't want to call another one of these text parsing routines while we're in the middle of one...
01092                         Q_strncpyz( weapMuzzle3, value, sizeof(weapMuzzle3) );
01093                 }
01094                 else if ( Q_stricmp( "weapMuzzle4", parmName ) == 0 )
01095                 {//hmm, store this off because we don't want to call another one of these text parsing routines while we're in the middle of one...
01096                         Q_strncpyz( weapMuzzle4, value, sizeof(weapMuzzle4) );
01097                 }
01098                 else if ( Q_stricmp( "weapMuzzle5", parmName ) == 0 )
01099                 {//hmm, store this off because we don't want to call another one of these text parsing routines while we're in the middle of one...
01100                         Q_strncpyz( weapMuzzle5, value, sizeof(weapMuzzle5) );
01101                 }
01102                 else if ( Q_stricmp( "weapMuzzle6", parmName ) == 0 )
01103                 {//hmm, store this off because we don't want to call another one of these text parsing routines while we're in the middle of one...
01104                         Q_strncpyz( weapMuzzle6, value, sizeof(weapMuzzle6) );
01105                 }
01106                 else if ( Q_stricmp( "weapMuzzle7", parmName ) == 0 )
01107                 {//hmm, store this off because we don't want to call another one of these text parsing routines while we're in the middle of one...
01108                         Q_strncpyz( weapMuzzle7, value, sizeof(weapMuzzle7) );
01109                 }
01110                 else if ( Q_stricmp( "weapMuzzle8", parmName ) == 0 )
01111                 {//hmm, store this off because we don't want to call another one of these text parsing routines while we're in the middle of one...
01112                         Q_strncpyz( weapMuzzle8, value, sizeof(weapMuzzle8) );
01113                 }
01114                 else if ( Q_stricmp( "weapMuzzle9", parmName ) == 0 )
01115                 {//hmm, store this off because we don't want to call another one of these text parsing routines while we're in the middle of one...
01116                         Q_strncpyz( weapMuzzle9, value, sizeof(weapMuzzle9) );
01117                 }
01118                 else if ( Q_stricmp( "weapMuzzle10", parmName ) == 0 )
01119                 {//hmm, store this off because we don't want to call another one of these text parsing routines while we're in the middle of one...
01120                         Q_strncpyz( weapMuzzle10, value, sizeof(weapMuzzle10) );
01121                 }
01122                 else
01123                 {
01124                         if ( !BG_ParseVehicleParm( vehicle, parmName, value ) )
01125                         {
01126 #ifndef FINAL_BUILD
01127                                 Com_Printf( S_COLOR_RED"ERROR: Unknown Vehicle key/value pair '%s', '%s'!\n", parmName, value );
01128 #endif
01129                         }
01130                 }
01131         }
01132         //NOW: if we have any weapons, go ahead and load them
01133         if ( weap1[0] )
01134         {
01135                 if ( !BG_ParseVehicleParm( vehicle, "weap1", weap1 ) )
01136                 {
01137 #ifndef FINAL_BUILD
01138                         Com_Printf( S_COLOR_RED"ERROR: Unknown Vehicle key/value pair 'weap1', '%s'!\n", weap1 );
01139 #endif
01140                 }
01141         }
01142         if ( weap2[0] )
01143         {
01144                 if ( !BG_ParseVehicleParm( vehicle, "weap2", weap2 ) )
01145                 {
01146 #ifndef FINAL_BUILD
01147                         Com_Printf( S_COLOR_RED"ERROR: Unknown Vehicle key/value pair 'weap2', '%s'!\n", weap2 );
01148 #endif
01149                 }
01150         }
01151         if ( weapMuzzle1[0] )
01152         {
01153                 if ( !BG_ParseVehicleParm( vehicle, "weapMuzzle1", weapMuzzle1 ) )
01154                 {
01155 #ifndef FINAL_BUILD
01156                         Com_Printf( S_COLOR_RED"ERROR: Unknown Vehicle key/value pair 'weapMuzzle1', '%s'!\n", weapMuzzle1 );
01157 #endif
01158                 }
01159         }
01160         if ( weapMuzzle2[0] )
01161         {
01162                 if ( !BG_ParseVehicleParm( vehicle, "weapMuzzle2", weapMuzzle2 ) )
01163                 {
01164 #ifndef FINAL_BUILD
01165                         Com_Printf( S_COLOR_RED"ERROR: Unknown Vehicle key/value pair 'weapMuzzle2', '%s'!\n", weapMuzzle2 );
01166 #endif
01167                 }
01168         }
01169         if ( weapMuzzle3[0] )
01170         {
01171                 if ( !BG_ParseVehicleParm( vehicle, "weapMuzzle3", weapMuzzle3 ) )
01172                 {
01173 #ifndef FINAL_BUILD
01174                         Com_Printf( S_COLOR_RED"ERROR: Unknown Vehicle key/value pair 'weapMuzzle3', '%s'!\n", weapMuzzle3 );
01175 #endif
01176                 }
01177         }
01178         if ( weapMuzzle4[0] )
01179         {
01180                 if ( !BG_ParseVehicleParm( vehicle, "weapMuzzle4", weapMuzzle4 ) )
01181                 {
01182 #ifndef FINAL_BUILD
01183                         Com_Printf( S_COLOR_RED"ERROR: Unknown Vehicle key/value pair 'weapMuzzle4', '%s'!\n", weapMuzzle4 );
01184 #endif
01185                 }
01186         }
01187         if ( weapMuzzle5[0] )
01188         {
01189                 if ( !BG_ParseVehicleParm( vehicle, "weapMuzzle5", weapMuzzle5 ) )
01190                 {
01191 #ifndef FINAL_BUILD
01192                         Com_Printf( S_COLOR_RED"ERROR: Unknown Vehicle key/value pair 'weapMuzzle5', '%s'!\n", weapMuzzle5 );
01193 #endif
01194                 }
01195         }
01196         if ( weapMuzzle6[0] )
01197         {
01198                 if ( !BG_ParseVehicleParm( vehicle, "weapMuzzle6", weapMuzzle6 ) )
01199                 {
01200 #ifndef FINAL_BUILD
01201                         Com_Printf( S_COLOR_RED"ERROR: Unknown Vehicle key/value pair 'weapMuzzle6', '%s'!\n", weapMuzzle6 );
01202 #endif
01203                 }
01204         }
01205         if ( weapMuzzle7[0] )
01206         {
01207                 if ( !BG_ParseVehicleParm( vehicle, "weapMuzzle7", weapMuzzle7 ) )
01208                 {
01209 #ifndef FINAL_BUILD
01210                         Com_Printf( S_COLOR_RED"ERROR: Unknown Vehicle key/value pair 'weapMuzzle7', '%s'!\n", weapMuzzle7 );
01211 #endif
01212                 }
01213         }
01214         if ( weapMuzzle8[0] )
01215         {
01216                 if ( !BG_ParseVehicleParm( vehicle, "weapMuzzle8", weapMuzzle8 ) )
01217                 {
01218 #ifndef FINAL_BUILD
01219                         Com_Printf( S_COLOR_RED"ERROR: Unknown Vehicle key/value pair 'weapMuzzle8', '%s'!\n", weapMuzzle8 );
01220 #endif
01221                 }
01222         }
01223         if ( weapMuzzle9[0] )
01224         {
01225                 if ( !BG_ParseVehicleParm( vehicle, "weapMuzzle9", weapMuzzle9 ) )
01226                 {
01227 #ifndef FINAL_BUILD
01228                         Com_Printf( S_COLOR_RED"ERROR: Unknown Vehicle key/value pair 'weapMuzzle9', '%s'!\n", weapMuzzle9 );
01229 #endif
01230                 }
01231         }
01232         if ( weapMuzzle10[0] )
01233         {
01234                 if ( !BG_ParseVehicleParm( vehicle, "weapMuzzle10", weapMuzzle10 ) )
01235                 {
01236 #ifndef FINAL_BUILD
01237                         Com_Printf( S_COLOR_RED"ERROR: Unknown Vehicle key/value pair 'weapMuzzle10', '%s'!\n", weapMuzzle10 );
01238 #endif
01239                 }
01240         }
01241 
01242 #ifdef _JK2MP
01243         //let's give these guys some defaults
01244         if (!vehicle->health_front)
01245         {
01246                 vehicle->health_front = vehicle->armor/4;
01247         }
01248         if (!vehicle->health_back)
01249         {
01250                 vehicle->health_back = vehicle->armor/4;
01251         }
01252         if (!vehicle->health_right)
01253         {
01254                 vehicle->health_right = vehicle->armor/4;
01255         }
01256         if (!vehicle->health_left)
01257         {
01258                 vehicle->health_left = vehicle->armor/4;
01259         }
01260 #endif
01261 
01262         if ( vehicle->model )
01263         {
01264 #ifdef QAGAME
01265                 vehicle->modelIndex = G_ModelIndex( va( "models/players/%s/model.glm", vehicle->model ) );
01266 #else
01267                 vehicle->modelIndex = trap_R_RegisterModel( va( "models/players/%s/model.glm", vehicle->model ) );
01268 #endif
01269         }
01270 
01271 #ifndef _JK2MP
01272         //SP
01273         if ( vehicle->skin
01274                 && vehicle->skin[0] )
01275         {
01276                 ratl::string_vs<256>                    skins(vehicle->skin);
01277                 for (ratl::string_vs<256>::tokenizer i = skins.begin("|"); i!=skins.end(); i++)
01278                 {
01279                         //this will just turn off surfs if there is a *off shader on a surf, the skin will actually get thrown away when cgame starts
01280                         gi.RE_RegisterSkin( va( "models/players/%s/model_%s.skin", vehicle->model, *i) );
01281                         //this is for the server-side call, it will propgate down to cgame with configstrings and register it at the same time as all the other skins for ghoul2 models
01282                         G_SkinIndex( va( "models/players/%s/model_%s.skin", vehicle->model, *i) );
01283                 }
01284         }
01285         else
01286         {
01287                 //this will just turn off surfs if there is a *off shader on a surf, the skin will actually get thrown away when cgame starts
01288                 gi.RE_RegisterSkin( va( "models/players/%s/model_default.skin", vehicle->model) );
01289                 //this is for the server-side call, it will propgate down to cgame with configstrings and register it at the same time as all the other skins for ghoul2 models
01290                 G_SkinIndex( va( "models/players/%s/model_default.skin", vehicle->model) );
01291         }
01292 #else
01293 #ifndef QAGAME
01294         if ( vehicle->skin
01295                 && vehicle->skin[0] )
01296         {
01297                 trap_R_RegisterSkin( va( "models/players/%s/model_%s.skin", vehicle->model, vehicle->skin) );
01298         }
01299 #endif
01300 #endif
01301         //sanity check and clamp the vehicle's data
01302         BG_VehicleClampData( vehicle );
01303         // Setup the shared function pointers.
01304         BG_SetSharedVehicleFunctions( vehicle );
01305         //misc effects... FIXME: not even used in MP, are they?
01306         if ( vehicle->explosionDamage )
01307         {
01308 #ifdef QAGAME
01309                 G_EffectIndex( "ships/ship_explosion_mark" );
01310 #elif CGAME
01311                 trap_FX_RegisterEffect( "ships/ship_explosion_mark" );
01312 #endif
01313         }
01314         if ( vehicle->flammable )
01315         {
01316 #ifdef QAGAME
01317                 G_SoundIndex( "sound/vehicles/common/fire_lp.wav" );
01318 #elif CGAME
01319                 trap_S_RegisterSound( "sound/vehicles/common/fire_lp.wav" );
01320 #else
01321                 trap_S_RegisterSound( "sound/vehicles/common/fire_lp.wav" );
01322 #endif
01323         }
01324 
01325         if ( vehicle->hoverHeight > 0 )
01326         {
01327 #ifndef _JK2MP
01328                 G_EffectIndex( "ships/swoop_dust" );
01329 #elif QAGAME
01330                 G_EffectIndex( "ships/swoop_dust" );
01331 #elif CGAME
01332                 trap_FX_RegisterEffect( "ships/swoop_dust" );
01333 #endif
01334         }
01335 
01336 #ifdef QAGAME
01337         G_EffectIndex( "volumetric/black_smoke" );
01338         G_EffectIndex( "ships/fire" );
01339         G_SoundIndex( "sound/vehicles/common/release.wav" );
01340 #elif CGAME
01341         trap_R_RegisterShader( "gfx/menus/radar/bracket" );
01342         trap_R_RegisterShader( "gfx/menus/radar/lead" );
01343         trap_R_RegisterShaderNoMip( "gfx/menus/radar/asteroid" );
01344         trap_S_RegisterSound( "sound/vehicles/common/impactalarm.wav" );
01345         trap_S_RegisterSound( "sound/vehicles/common/linkweaps.wav" );
01346         trap_S_RegisterSound( "sound/vehicles/common/release.wav" );
01347         trap_FX_RegisterEffect("effects/ships/dest_burning.efx");
01348         trap_FX_RegisterEffect("effects/ships/dest_destroyed.efx");
01349         trap_FX_RegisterEffect( "volumetric/black_smoke" );
01350         trap_FX_RegisterEffect( "ships/fire" );
01351         trap_FX_RegisterEffect("ships/hyperspace_stars");
01352 
01353         if ( vehicle->hideRider )
01354         {
01355                 trap_R_RegisterShaderNoMip( "gfx/menus/radar/circle_base" );
01356                 trap_R_RegisterShaderNoMip( "gfx/menus/radar/circle_base_frame" );
01357                 trap_R_RegisterShaderNoMip( "gfx/menus/radar/circle_base_shield" );
01358         }
01359 #endif
01360 
01361         return (numVehicles++);
01362 }

int VEH_LoadVehWeapon const char *  vehWeaponName  ) 
 

Definition at line 309 of file bg_vehicleLoad.c.

References COM_BeginParseSession(), COM_ParseExt(), Com_Printf(), vehWeaponInfo_t::fHoming, g_vehWeaponInfo, NULL, numVehicleWeapons, Q_stricmp(), Q_strncpyz(), qfalse, qtrue, S_COLOR_RED, SkipBracedSection(), SkipRestOfLine(), trap_S_RegisterSound(), VEH_WEAPON_NONE, and VehWeaponParms.

Referenced by VEH_VehWeaponIndexForName().

00310 {//load up specified vehWeapon and save in array: g_vehWeaponInfo
00311         const char      *token;
00312         char            parmName[128];//we'll assume that no parm name is longer than 128
00313         char            *value;
00314         const char      *p;
00315         vehWeaponInfo_t *vehWeapon = NULL;
00316 
00317         //BG_VehWeaponSetDefaults( &g_vehWeaponInfo[0] );//set the first vehicle to default data
00318 
00319         //try to parse data out
00320         p = VehWeaponParms;
00321 
00322 #ifdef _JK2MP
00323         COM_BeginParseSession("vehWeapons");
00324 #else
00325         COM_BeginParseSession();
00326 #endif
00327 
00328         vehWeapon = &g_vehWeaponInfo[numVehicleWeapons];
00329         // look for the right vehicle weapon
00330         while ( p ) 
00331         {
00332                 token = COM_ParseExt( &p, qtrue );
00333                 if ( token[0] == 0 )
00334                 {
00335                         return qfalse;
00336                 }
00337 
00338                 if ( !Q_stricmp( token, vehWeaponName ) ) 
00339                 {
00340                         break;
00341                 }
00342 
00343                 SkipBracedSection( &p );
00344         }
00345         if ( !p ) 
00346         {
00347                 return qfalse;
00348         }
00349 
00350         token = COM_ParseExt( &p, qtrue );
00351         if ( token[0] == 0 )
00352         {//barf
00353                 return VEH_WEAPON_NONE;
00354         }
00355 
00356         if ( Q_stricmp( token, "{" ) != 0 ) 
00357         {
00358                 return VEH_WEAPON_NONE;
00359         }
00360         
00361         // parse the vehWeapon info block
00362         while ( 1 ) 
00363         {
00364                 SkipRestOfLine( &p );
00365                 token = COM_ParseExt( &p, qtrue );
00366                 if ( !token[0] ) 
00367                 {
00368                         Com_Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing Vehicle Weapon '%s'\n", vehWeaponName );
00369                         return VEH_WEAPON_NONE;
00370                 }
00371 
00372                 if ( !Q_stricmp( token, "}" ) ) 
00373                 {
00374                         break;
00375                 }
00376                 Q_strncpyz( parmName, token, sizeof(parmName) );
00377                 value = COM_ParseExt( &p, qtrue );
00378                 if ( !value || !value[0] )
00379                 {
00380                         Com_Printf( S_COLOR_RED"ERROR: Vehicle Weapon token '%s' has no value!\n", parmName );
00381                 }
00382                 else
00383                 {
00384                         if ( !BG_ParseVehWeaponParm( vehWeapon, parmName, value ) )
00385                         {
00386                                 Com_Printf( S_COLOR_RED"ERROR: Unknown Vehicle Weapon key/value pair '%s','%s'!\n", parmName, value );
00387                         }
00388                 }
00389         }
00390         if ( vehWeapon->fHoming )
00391         {//all lock-on weapons use these 2 sounds
00392 #ifdef QAGAME
00393                 //Hmm, no need fo have server register this, is there?
00394                 //G_SoundIndex( "sound/weapons/torpedo/tick.wav" );
00395                 //G_SoundIndex( "sound/weapons/torpedo/lock.wav" );
00396 #elif CGAME
00397                 trap_S_RegisterSound( "sound/vehicles/weapons/common/tick.wav" );
00398                 trap_S_RegisterSound( "sound/vehicles/weapons/common/lock.wav" );
00399                 trap_S_RegisterSound( "sound/vehicles/common/lockalarm1.wav" );
00400                 trap_S_RegisterSound( "sound/vehicles/common/lockalarm2.wav" );
00401                 trap_S_RegisterSound( "sound/vehicles/common/lockalarm3.wav" );
00402 #else
00403                 trap_S_RegisterSound( "sound/vehicles/weapons/common/tick.wav" );
00404                 trap_S_RegisterSound( "sound/vehicles/weapons/common/lock.wav" );
00405                 trap_S_RegisterSound( "sound/vehicles/common/lockalarm1.wav" );
00406                 trap_S_RegisterSound( "sound/vehicles/common/lockalarm2.wav" );
00407                 trap_S_RegisterSound( "sound/vehicles/common/lockalarm3.wav" );
00408 #endif
00409         }
00410         return (numVehicleWeapons++);
00411 }

int VEH_VehicleIndexForName const char *  vehicleName  ) 
 

Definition at line 1364 of file bg_vehicleLoad.c.

References Com_Printf(), g_vehicleInfo, MAX_VEHICLES, name, vehicleInfo_t::name, numVehicles, Q_stricmp(), S_COLOR_RED, VEH_LoadVehicle(), VEHICLE_BASE, and VEHICLE_NONE.

Referenced by BG_VehicleGetIndex().

01365 {
01366         int v;
01367         if ( !vehicleName || !vehicleName[0] )
01368         {
01369                 Com_Printf( S_COLOR_RED"ERROR: Trying to read Vehicle with no name!\n" );
01370                 return VEHICLE_NONE;
01371         }
01372         for (  v = VEHICLE_BASE; v < numVehicles; v++ )
01373         {
01374                 if ( g_vehicleInfo[v].name
01375                         && Q_stricmp( g_vehicleInfo[v].name, vehicleName ) == 0 )
01376                 {//already loaded this one
01377                         return v;
01378                 }
01379         }
01380         //haven't loaded it yet
01381         if ( v >= MAX_VEHICLES )
01382         {//no more room!
01383                 Com_Printf( S_COLOR_RED"ERROR: Too many Vehicles (max 64), aborting load on %s!\n", vehicleName );
01384                 return VEHICLE_NONE;
01385         }
01386         //we have room for another one, load it up and return the index
01387         //HMM... should we not even load the .veh file until we want to?
01388         v = VEH_LoadVehicle( vehicleName ); 
01389         if ( v == VEHICLE_NONE )
01390         {
01391                 Com_Printf( S_COLOR_RED"ERROR: Could not find Vehicle %s!\n", vehicleName );
01392         }
01393         return v;
01394 }

int VEH_VehWeaponIndexForName const char *  vehWeaponName  ) 
 

Definition at line 413 of file bg_vehicleLoad.c.

References Com_Printf(), g_vehWeaponInfo, MAX_VEH_WEAPONS, name, vehWeaponInfo_t::name, numVehicleWeapons, Q_stricmp(), S_COLOR_RED, VEH_LoadVehWeapon(), VEH_WEAPON_BASE, and VEH_WEAPON_NONE.

00414 {
00415         int vw;
00416         if ( !vehWeaponName || !vehWeaponName[0] )
00417         {
00418                 Com_Printf( S_COLOR_RED"ERROR: Trying to read Vehicle Weapon with no name!\n" );
00419                 return VEH_WEAPON_NONE;
00420         }
00421         for ( vw = VEH_WEAPON_BASE; vw < numVehicleWeapons; vw++ )
00422         {
00423                 if ( g_vehWeaponInfo[vw].name
00424                         && Q_stricmp( g_vehWeaponInfo[vw].name, vehWeaponName ) == 0 )
00425                 {//already loaded this one
00426                         return vw;
00427                 }
00428         }
00429         //haven't loaded it yet
00430         if ( vw >= MAX_VEH_WEAPONS )
00431         {//no more room!
00432                 Com_Printf( S_COLOR_RED"ERROR: Too many Vehicle Weapons (max 16), aborting load on %s!\n", vehWeaponName );
00433                 return VEH_WEAPON_NONE;
00434         }
00435         //we have room for another one, load it up and return the index
00436         //HMM... should we not even load the .vwp file until we want to?
00437         vw = VEH_LoadVehWeapon( vehWeaponName );
00438         if ( vw == VEH_WEAPON_NONE )
00439         {
00440                 Com_Printf( S_COLOR_RED"ERROR: Could not find Vehicle Weapon %s!\n", vehWeaponName );
00441         }
00442         return vw;
00443 }


Variable Documentation

stringID_table_t animTable[MAX_ANIMATIONS+1]
 

Definition at line 68 of file bg_vehicleLoad.c.

vehicleInfo_t g_vehicleInfo[MAX_VEHICLES]
 

Definition at line 106 of file bg_vehicleLoad.c.

Referenced by BG_GetVehicleModelName(), BG_GetVehicleSkinName(), BG_VehicleLoadParms(), CG_G2AnimEntModelLoad(), G_CreateAnimalNPC(), G_CreateFighterNPC(), G_CreateSpeederNPC(), G_CreateWalkerNPC(), NPC_Spawn_Do(), NPC_VehiclePrecache(), Update(), VEH_LoadVehicle(), and VEH_VehicleIndexForName().

vehWeaponInfo_t g_vehWeaponInfo[MAX_VEH_WEAPONS]
 

Definition at line 103 of file bg_vehicleLoad.c.

Referenced by CG_BracketEntity(), CG_G2MarkEvent(), CG_VehicleWeaponImpact(), CG_VehMuzzleFireFX(), FireVehicleWeapon(), VEH_LoadVehWeapon(), VEH_TurretObeyPassengerControl(), VEH_TurretThink(), VEH_VehWeaponIndexForName(), and WP_FireVehicleWeapon().

int numVehicles = 0
 

Definition at line 107 of file bg_vehicleLoad.c.

Referenced by BG_VehicleLoadParms(), VEH_LoadVehicle(), and VEH_VehicleIndexForName().

int numVehicleWeapons = 1
 

Definition at line 104 of file bg_vehicleLoad.c.

Referenced by VEH_LoadVehWeapon(), and VEH_VehWeaponIndexForName().

vehField_t vehicleFields[]
 

Definition at line 445 of file bg_vehicleLoad.c.

char VehicleParms[MAX_VEHICLE_DATA_SIZE]
 

Definition at line 77 of file bg_vehicleLoad.c.

Referenced by BG_ClearVehicleParseParms(), BG_VehicleLoadParms(), and VEH_LoadVehicle().

stringID_table_t VehicleTable[VH_NUM_VEHICLES+1]
 

Initial value:

{
        ENUM2STRING(VH_NONE),
        ENUM2STRING(VH_WALKER),         
        ENUM2STRING(VH_FIGHTER),        
        ENUM2STRING(VH_SPEEDER),        
        ENUM2STRING(VH_ANIMAL),         
        ENUM2STRING(VH_FLIER),          
        0,      -1
}

Definition at line 671 of file bg_vehicleLoad.c.

vehField_t vehWeaponFields[NUM_VWEAP_PARMS]
 

Initial value:

 
{
        {"name", VWFOFS(name), VF_LSTRING},     
        {"projectile", VWFOFS(bIsProjectile), VF_BOOL}, 
        {"hasGravity", VWFOFS(bHasGravity), VF_BOOL},   
        {"ionWeapon", VWFOFS(bIonWeapon), VF_BOOL},     
        {"saberBlockable", VWFOFS(bSaberBlockable), VF_BOOL},   
        {"muzzleFX", VWFOFS(iMuzzleFX), VF_EFFECT_CLIENT},      
        {"model", VWFOFS(iModel), VF_MODEL_CLIENT},     
        {"shotFX", VWFOFS(iShotFX), VF_EFFECT_CLIENT},  
        {"impactFX", VWFOFS(iImpactFX), VF_EFFECT_CLIENT},      
        {"g2MarkShader", VWFOFS(iG2MarkShaderHandle), VF_SHADER},       
        {"g2MarkSize", VWFOFS(fG2MarkSize), VF_FLOAT},  
        {"loopSound", VWFOFS(iLoopSound), VF_SOUND_CLIENT},     
        {"speed", VWFOFS(fSpeed), VF_FLOAT},            
        {"homing", VWFOFS(fHoming), VF_FLOAT},          
        {"homingFOV", VWFOFS(fHomingFOV), VF_FLOAT},
        {"lockOnTime", VWFOFS(iLockOnTime), VF_INT},    
        {"damage", VWFOFS(iDamage), VF_INT},            
        {"splashDamage", VWFOFS(iSplashDamage), VF_INT},
        {"splashRadius", VWFOFS(fSplashRadius), VF_FLOAT},
        {"ammoPerShot", VWFOFS(iAmmoPerShot), VF_INT},
        {"health", VWFOFS(iHealth), VF_INT},            
        {"width", VWFOFS(fWidth), VF_FLOAT},            
        {"height", VWFOFS(fHeight), VF_FLOAT},          
        {"lifetime", VWFOFS(iLifeTime), VF_INT},        
        {"explodeOnExpire", VWFOFS(bExplodeOnExpire), VF_BOOL}, 
}

Definition at line 138 of file bg_vehicleLoad.c.

char VehWeaponParms[MAX_VEH_WEAPON_DATA_SIZE]
 

Definition at line 76 of file bg_vehicleLoad.c.

Referenced by BG_ClearVehicleParseParms(), BG_VehWeaponLoadParms(), and VEH_LoadVehWeapon().