#include "g_local.h"#include "..\Ratl\string_vs.h"Go to the source code of this file.
|
|
Definition at line 72 of file bg_vehicleLoad.c. Referenced by BG_VehWeaponLoadParms(). |
|
|
Definition at line 73 of file bg_vehicleLoad.c. Referenced by BG_VehicleLoadParms(). |
|
|
Definition at line 25 of file bg_vehicleLoad.c. |
|
|
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;
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 |