/* ------------------------- FX_BryarHitWall ------------------------- */ void FX_BryarHitWall( vec3_t origin, vec3_t normal ) { trap_FX_PlayEffectID( cgs.effects.bryarWallImpactEffect, origin, normal ); //Boot: /*if (Q_irand(0, 4) > 2) {*/ trap_FX_PlayEffectID(trap_FX_RegisterEffect("smoke_alot.efx"), origin, normal); trap_FX_PlayEffectID(trap_FX_RegisterEffect("blaster/intense_sparks.efx"), origin, normal); //} }
/* ------------------------- FX_BryarAltHitWall ------------------------- */ void FX_BryarAltHitWall( vec3_t origin, vec3_t normal, int power ) { switch( power ) { case 4: case 5: trap_FX_PlayEffectID( cgs.effects.bryarWallImpactEffect3, origin, normal ); break; case 2: case 3: trap_FX_PlayEffectID( cgs.effects.bryarWallImpactEffect2, origin, normal ); break; default: trap_FX_PlayEffectID( cgs.effects.bryarWallImpactEffect, origin, normal ); break; } trap_FX_PlayEffectID(trap_FX_RegisterEffect("smoke_alot.efx"), origin, normal); trap_FX_PlayEffectID(trap_FX_RegisterEffect("blaster/intense_sparks.efx"), origin, normal); }
void CG_MiscModelExplosion( vector3 *mins, vector3 *maxs, int size, material_t chunkType ) { int ct = 13; float r; vector3 org, mid, dir; char *effect = NULL, *effect2 = NULL; int eID1, eID2 = 0; int i; VectorAdd( mins, maxs, &mid ); VectorScale( &mid, 0.5f, &mid ); switch( chunkType ) { default: break; case MAT_GLASS: effect = "chunks/glassbreak"; ct = 5; break; case MAT_GLASS_METAL: effect = "chunks/glassbreak"; effect2 = "chunks/metalexplode"; ct = 5; break; case MAT_ELECTRICAL: case MAT_ELEC_METAL: effect = "chunks/sparkexplode"; ct = 5; break; case MAT_METAL: case MAT_METAL2: case MAT_METAL3: case MAT_CRATE1: case MAT_CRATE2: effect = "chunks/metalexplode"; ct = 2; break; case MAT_GRATE1: effect = "chunks/grateexplode"; ct = 8; break; case MAT_ROPE: ct = 20; effect = "chunks/ropebreak"; break; case MAT_WHITE_METAL: //not sure what this crap is really supposed to be.. case MAT_DRK_STONE: case MAT_LT_STONE: case MAT_GREY_STONE: case MAT_SNOWY_ROCK: switch( size ) { case 2: effect = "chunks/rockbreaklg"; break; case 1: default: effect = "chunks/rockbreakmed"; break; } } if ( !effect ) { return; } ct += 7 * size; // FIXME: real precache .. VERify that these need to be here...don't think they would because the effects should be registered in g_breakable //rww - No they don't.. indexed effects gameside get precached on load clientside, as server objects are setup before client asset load time. //However, we need to index them, so.. eID1 = trap_FX_RegisterEffect( effect ); if ( effect2 && effect2[0] ) { // FIXME: real precache eID2 = trap_FX_RegisterEffect( effect2 ); } // spawn chunk roughly in the bbox of the thing.. for ( i = 0; i < ct; i++ ) { int j; for( j = 0; j < 3; j++ ) { r = random() * 0.8f + 0.1f; org.data[j] = ( r * mins->data[j] + ( 1 - r ) * maxs->data[j] ); } // shoot effect away from center VectorSubtract( &org, &mid, &dir ); VectorNormalize( &dir ); if ( effect2 && effect2[0] && ( rand() & 1 )) trap_FX_PlayEffectID( eID2, &org, &dir, -1, -1 ); else trap_FX_PlayEffectID( eID1, &org, &dir, -1, -1 ); } }
/* ================ CG_ConfigStringModified ================ */ static void CG_ConfigStringModified( void ) { const char *str; int num; num = atoi( CG_Argv( 1 ) ); // get the gamestate from the client system, which will have the // new configstring already integrated trap_GetGameState( &cgs.gameState ); // look up the individual string that was modified str = CG_ConfigString( num ); // do something with it if necessary if ( num == CS_MUSIC ) { CG_StartMusic( qtrue ); } else if ( num == CS_SERVERINFO ) { CG_ParseServerinfo(); } else if ( num == CS_WARMUP ) { CG_ParseWarmup(); } else if ( num == CS_SCORES1 ) { cgs.scores1 = atoi( str ); } else if ( num == CS_SCORES2 ) { cgs.scores2 = atoi( str ); } else if ( num == CS_CLIENT_JEDIMASTER ) { cgs.jediMaster = atoi ( str ); } else if ( num == CS_CLIENT_DUELWINNER ) { cgs.duelWinner = atoi ( str ); } else if ( num == CS_CLIENT_DUELISTS ) { char buf[64]; int c = 0; int i = 0; while (str[i] && str[i] != '|') { buf[c] = str[i]; c++; i++; } buf[c] = 0; cgs.duelist1 = atoi ( buf ); c = 0; i++; while (str[i]) { buf[c] = str[i]; c++; i++; } buf[c] = 0; cgs.duelist2 = atoi ( buf ); } else if ( num == CS_LEVEL_START_TIME ) { cgs.levelStartTime = atoi( str ); } else if ( num == CS_VOTE_TIME ) { cgs.voteTime = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_YES ) { cgs.voteYes = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_NO ) { cgs.voteNo = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_STRING ) { Q_strncpyz( cgs.voteString, str, sizeof( cgs.voteString ) ); } else if ( num >= CS_TEAMVOTE_TIME && num <= CS_TEAMVOTE_TIME + 1) { cgs.teamVoteTime[num-CS_TEAMVOTE_TIME] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_TIME] = qtrue; } else if ( num >= CS_TEAMVOTE_YES && num <= CS_TEAMVOTE_YES + 1) { cgs.teamVoteYes[num-CS_TEAMVOTE_YES] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_YES] = qtrue; } else if ( num >= CS_TEAMVOTE_NO && num <= CS_TEAMVOTE_NO + 1) { cgs.teamVoteNo[num-CS_TEAMVOTE_NO] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_NO] = qtrue; } else if ( num >= CS_TEAMVOTE_STRING && num <= CS_TEAMVOTE_STRING + 1) { Q_strncpyz( cgs.teamVoteString[num-CS_TEAMVOTE_STRING], str, sizeof( cgs.teamVoteString ) ); } else if ( num == CS_INTERMISSION ) { cg.intermissionStarted = atoi( str ); } else if ( num >= CS_MODELS && num < CS_MODELS+MAX_MODELS ) { cgs.gameModels[ num-CS_MODELS ] = trap_R_RegisterModel( str ); // GHOUL2 Insert start } else if ( num >= CS_CHARSKINS && num < CS_CHARSKINS+MAX_CHARSKINS ) { cgs.skins[ num-CS_CHARSKINS ] = trap_R_RegisterSkin( str ); // Ghoul2 Insert end } else if ( num >= CS_SOUNDS && num < CS_SOUNDS+MAX_SOUNDS ) { if ( str[0] != '*' ) { // player specific sounds don't register here cgs.gameSounds[ num-CS_SOUNDS] = trap_S_RegisterSound( str ); } } else if ( num >= CS_EFFECTS && num < CS_SOUNDS+MAX_SOUNDS ) { if ( str[0] != '*' ) { // player specific sounds don't register here cgs.gameEffects[ num-CS_EFFECTS] = trap_FX_RegisterEffect( str ); } } else if ( num >= CS_PLAYERS && num < CS_PLAYERS+MAX_CLIENTS ) { CG_NewClientInfo( num - CS_PLAYERS, qtrue); CG_BuildSpectatorString(); } else if ( num == CS_FLAGSTATUS ) { if( cgs.gametype == GT_CTF || cgs.gametype == GT_CTY ) { // format is rb where its red/blue, 0 is at base, 1 is taken, 2 is dropped cgs.redflag = str[0] - '0'; cgs.blueflag = str[1] - '0'; } } else if ( num == CS_SHADERSTATE ) { CG_ShaderStateChanged(); } else if ( num >= CS_LIGHT_STYLES && num < CS_LIGHT_STYLES + (MAX_LIGHT_STYLES * 3)) { CG_SetLightstyle(num - CS_LIGHT_STYLES); } }
static void CG_ConfigStringModified( void ) { const char *str; int num; num = atoi( CG_Argv( 1 ) ); // get the gamestate from the client system, which will have the // new configstring already integrated trap_GetGameState( &cgs.gameState ); // look up the individual string that was modified str = CG_ConfigString( num ); // do something with it if necessary if ( num == CS_MUSIC ) { CG_StartMusic( qtrue ); } else if ( num == CS_SERVERINFO ) { CG_ParseServerinfo(); } else if ( num == CS_WARMUP ) { CG_ParseWarmup(); } else if ( num == CS_SCORES1 ) { cgs.scores1 = atoi( str ); } else if ( num == CS_SCORES2 ) { cgs.scores2 = atoi( str ); } else if ( num == CS_CLIENT_JEDIMASTER ) { cgs.jediMaster = atoi ( str ); } else if ( num == CS_CLIENT_DUELWINNER ) { cgs.duelWinner = atoi ( str ); } else if ( num == CS_CLIENT_DUELISTS ) { char buf[64]; int c = 0; int i = 0; while (str[i] && str[i] != '|') { buf[c] = str[i]; c++; i++; } buf[c] = 0; cgs.duelist1 = atoi ( buf ); c = 0; i++; while (str[i] && str[i] != '|') { buf[c] = str[i]; c++; i++; } buf[c] = 0; cgs.duelist2 = atoi ( buf ); if (str[i]) { c = 0; i++; while (str[i]) { buf[c] = str[i]; c++; i++; } buf[c] = 0; cgs.duelist3 = atoi(buf); } } else if ( num == CS_CLIENT_DUELHEALTHS ) { // nmckenzie: DUEL_HEALTH SetDuelistHealthsFromConfigString(str); } else if ( num == CS_LEVEL_START_TIME ) { cgs.levelStartTime = atoi( str ); } else if ( num == CS_VOTE_TIME ) { cgs.voteTime = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_YES ) { cgs.voteYes = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_NO ) { cgs.voteNo = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_STRING ) { Q_strncpyz( cgs.voteString, str, sizeof( cgs.voteString ) ); } else if ( num >= CS_TEAMVOTE_TIME && num <= CS_TEAMVOTE_TIME + 1) { cgs.teamVoteTime[num-CS_TEAMVOTE_TIME] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_TIME] = qtrue; } else if ( num >= CS_TEAMVOTE_YES && num <= CS_TEAMVOTE_YES + 1) { cgs.teamVoteYes[num-CS_TEAMVOTE_YES] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_YES] = qtrue; } else if ( num >= CS_TEAMVOTE_NO && num <= CS_TEAMVOTE_NO + 1) { cgs.teamVoteNo[num-CS_TEAMVOTE_NO] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_NO] = qtrue; } else if ( num >= CS_TEAMVOTE_STRING && num <= CS_TEAMVOTE_STRING + 1) { Q_strncpyz( cgs.teamVoteString[num-CS_TEAMVOTE_STRING], str, sizeof( cgs.teamVoteString ) ); } else if ( num == CS_INTERMISSION ) { cg.intermissionStarted = atoi( str ); } else if ( num >= CS_MODELS && num < CS_MODELS+MAX_MODELS ) { char modelName[MAX_QPATH]; strcpy(modelName, str); if (strstr(modelName, ".glm") || modelName[0] == '$') { //Check to see if it has a custom skin attached. CG_HandleAppendedSkin(modelName); CG_CacheG2AnimInfo(modelName); } if (modelName[0] != '$' && modelName[0] != '@') { //don't register vehicle names and saber names as models. cgs.gameModels[ num-CS_MODELS ] = trap_R_RegisterModel( modelName ); } else { cgs.gameModels[ num-CS_MODELS ] = 0; } // GHOUL2 Insert start /* } else if ( num >= CS_CHARSKINS && num < CS_CHARSKINS+MAX_CHARSKINS ) { cgs.skins[ num-CS_CHARSKINS ] = trap_R_RegisterSkin( str ); */ //rww - removed and replaced with CS_G2BONES // Ghoul2 Insert end } else if ( num >= CS_SOUNDS && num < CS_SOUNDS+MAX_SOUNDS ) { if ( str[0] != '*' ) { // player specific sounds don't register here cgs.gameSounds[ num-CS_SOUNDS] = trap_S_RegisterSound( str ); } else if (str[1] == '$') { //an NPC soundset CG_PrecacheNPCSounds(str); } } else if ( num >= CS_EFFECTS && num < CS_EFFECTS+MAX_FX ) { if (str[0] == '*') { //it's a special global weather effect CG_ParseWeatherEffect(str); cgs.gameEffects[ num-CS_EFFECTS] = 0; } else { cgs.gameEffects[ num-CS_EFFECTS] = trap_FX_RegisterEffect( str ); } } else if ( num >= CS_SIEGE_STATE && num < CS_SIEGE_STATE+1 ) { if (str[0]) { CG_ParseSiegeState(str); } } else if ( num >= CS_SIEGE_WINTEAM && num < CS_SIEGE_WINTEAM+1 ) { if (str[0]) { cg_siegeWinTeam = atoi(str); } } else if ( num >= CS_SIEGE_OBJECTIVES && num < CS_SIEGE_OBJECTIVES+1 ) { CG_ParseSiegeObjectiveStatus(str); } else if (num >= CS_SIEGE_TIMEOVERRIDE && num < CS_SIEGE_TIMEOVERRIDE+1) { cg_beatingSiegeTime = atoi(str); CG_SetSiegeTimerCvar ( cg_beatingSiegeTime ); } else if ( num >= CS_PLAYERS && num < CS_PLAYERS+MAX_CLIENTS ) { CG_NewClientInfo( num - CS_PLAYERS, qtrue); CG_BuildSpectatorString(); } else if ( num == CS_FLAGSTATUS ) { if( cgs.gametype == GT_CTF || cgs.gametype == GT_CTY ) { // format is rb where its red/blue, 0 is at base, 1 is taken, 2 is dropped cgs.redflag = str[0] - '0'; cgs.blueflag = str[1] - '0'; } } else if ( num == CS_SHADERSTATE ) { CG_ShaderStateChanged(); } else if ( num >= CS_LIGHT_STYLES && num < CS_LIGHT_STYLES + (MAX_LIGHT_STYLES * 3)) { CG_SetLightstyle(num - CS_LIGHT_STYLES); } }
/* ================= CG_RegisterWeapon The server says this item is used on this level ================= */ void CG_RegisterWeapon( int weaponNum) { weaponInfo_t *weaponInfo; gitem_t *item, *ammo; char path[MAX_QPATH]; vec3_t mins, maxs; int i; weaponInfo = &cg_weapons[weaponNum]; if ( weaponNum == 0 ) { return; } if ( weaponInfo->registered ) { return; } memset( weaponInfo, 0, sizeof( *weaponInfo ) ); weaponInfo->registered = qtrue; for ( item = bg_itemlist + 1 ; item->classname ; item++ ) { if ( item->giType == IT_WEAPON && item->giTag == weaponNum ) { weaponInfo->item = item; break; } } if ( !item->classname ) { CG_Error( "Couldn't find weapon %i", weaponNum ); } CG_RegisterItemVisuals( item - bg_itemlist ); // load cmodel before model so filecache works weaponInfo->weaponModel = trap_R_RegisterModel( item->world_model[0] ); // load in-view model also weaponInfo->viewModel = trap_R_RegisterModel(item->view_model); // calc midpoint for rotation trap_R_ModelBounds( weaponInfo->weaponModel, mins, maxs ); for ( i = 0 ; i < 3 ; i++ ) { weaponInfo->weaponMidpoint[i] = mins[i] + 0.5 * ( maxs[i] - mins[i] ); } weaponInfo->weaponIcon = trap_R_RegisterShader( item->icon ); weaponInfo->ammoIcon = trap_R_RegisterShader( item->icon ); for ( ammo = bg_itemlist + 1 ; ammo->classname ; ammo++ ) { if ( ammo->giType == IT_AMMO && ammo->giTag == weaponNum ) { break; } } if ( ammo->classname && ammo->world_model[0] ) { weaponInfo->ammoModel = trap_R_RegisterModel( ammo->world_model[0] ); } // strcpy( path, item->view_model ); // COM_StripExtension( path, path ); // strcat( path, "_flash.md3" ); weaponInfo->flashModel = 0;//trap_R_RegisterModel( path ); if (weaponNum == WP_DISRUPTOR || weaponNum == WP_FLECHETTE || weaponNum == WP_REPEATER || weaponNum == WP_ROCKET_LAUNCHER) { strcpy( path, item->view_model ); COM_StripExtension( path, path ); strcat( path, "_barrel.md3" ); weaponInfo->barrelModel = trap_R_RegisterModel( path ); } else if (weaponNum == WP_STUN_BATON) { //only weapon with more than 1 barrel.. trap_R_RegisterModel("models/weapons2/stun_baton/baton_barrel.md3"); trap_R_RegisterModel("models/weapons2/stun_baton/baton_barrel2.md3"); trap_R_RegisterModel("models/weapons2/stun_baton/baton_barrel3.md3"); } else { weaponInfo->barrelModel = 0; } if (weaponNum != WP_SABER) { strcpy( path, item->view_model ); COM_StripExtension( path, path ); strcat( path, "_hand.md3" ); weaponInfo->handsModel = trap_R_RegisterModel( path ); } else { weaponInfo->handsModel = 0; } // if ( !weaponInfo->handsModel ) { // weaponInfo->handsModel = trap_R_RegisterModel( "models/weapons2/shotgun/shotgun_hand.md3" ); // } switch ( weaponNum ) { case WP_STUN_BATON: case WP_MELEE: /* MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f ); weaponInfo->firingSound = trap_S_RegisterSound( "sound/weapons/saber/saberhum.wav" ); // weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav" ); */ //trap_R_RegisterShader( "gfx/effects/stunPass" ); trap_FX_RegisterEffect( "stunBaton/flesh_impact" ); if (weaponNum == WP_STUN_BATON) { trap_S_RegisterSound( "sound/weapons/baton/idle.wav" ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/baton/fire.mp3" ); weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/baton/fire.mp3" ); } else { /* int j = 0; while (j < 4) { weaponInfo->flashSound[j] = trap_S_RegisterSound( va("sound/weapons/melee/swing%i", j+1) ); weaponInfo->altFlashSound[j] = weaponInfo->flashSound[j]; j++; } */ //No longer needed, animsound config plays them for us } break; case WP_SABER: MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f ); weaponInfo->firingSound = trap_S_RegisterSound( "sound/weapons/saber/saberhum1.wav" ); weaponInfo->missileModel = trap_R_RegisterModel( "models/weapons2/saber/saber_w.glm" ); break; case WP_CONCUSSION: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/concussion/select.wav"); weaponInfo->flashSound[0] = NULL_SOUND; weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "concussion/muzzle_flash" ); weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; //weaponInfo->missileDlightColor= {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_ConcussionProjectileThink; weaponInfo->altFlashSound[0] = NULL_SOUND; weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = trap_S_RegisterSound( "sound/weapons/bryar/altcharge.wav"); weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "concussion/altmuzzle_flash" ); weaponInfo->altMissileModel = NULL_HANDLE; weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; //weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = FX_ConcussionProjectileThink; cgs.effects.disruptorAltMissEffect = trap_FX_RegisterEffect( "disruptor/alt_miss" ); cgs.effects.concussionShotEffect = trap_FX_RegisterEffect( "concussion/shot" ); cgs.effects.concussionImpactEffect = trap_FX_RegisterEffect( "concussion/explosion" ); trap_R_RegisterShader("gfx/effects/blueLine"); trap_R_RegisterShader("gfx/misc/whiteline2"); break; case WP_BRYAR_PISTOL: case WP_BRYAR_OLD: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/bryar/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/bryar/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "bryar/muzzle_flash" ); weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; //weaponInfo->missileDlightColor= {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_BryarProjectileThink; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/bryar/alt_fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = trap_S_RegisterSound( "sound/weapons/bryar/altcharge.wav"); weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "bryar/muzzle_flash" ); weaponInfo->altMissileModel = NULL_HANDLE; weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; //weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = FX_BryarAltProjectileThink; cgs.effects.bryarShotEffect = trap_FX_RegisterEffect( "bryar/shot" ); cgs.effects.bryarPowerupShotEffect = trap_FX_RegisterEffect( "bryar/crackleShot" ); cgs.effects.bryarWallImpactEffect = trap_FX_RegisterEffect( "bryar/wall_impact" ); cgs.effects.bryarWallImpactEffect2 = trap_FX_RegisterEffect( "bryar/wall_impact2" ); cgs.effects.bryarWallImpactEffect3 = trap_FX_RegisterEffect( "bryar/wall_impact3" ); cgs.effects.bryarFleshImpactEffect = trap_FX_RegisterEffect( "bryar/flesh_impact" ); cgs.effects.bryarDroidImpactEffect = trap_FX_RegisterEffect( "bryar/droid_impact" ); cgs.media.bryarFrontFlash = trap_R_RegisterShader( "gfx/effects/bryarFrontFlash" ); // Note these are temp shared effects trap_FX_RegisterEffect("blaster/wall_impact.efx"); trap_FX_RegisterEffect("blaster/flesh_impact.efx"); break; case WP_BLASTER: case WP_EMPLACED_GUN: //rww - just use the same as this for now.. weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/blaster/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/blaster/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "blaster/muzzle_flash" ); weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_BlasterProjectileThink; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/blaster/alt_fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = NULL_SOUND; weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "blaster/muzzle_flash" ); weaponInfo->altMissileModel = NULL_HANDLE; weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = FX_BlasterProjectileThink; trap_FX_RegisterEffect( "blaster/deflect" ); cgs.effects.blasterShotEffect = trap_FX_RegisterEffect( "blaster/shot" ); cgs.effects.blasterWallImpactEffect = trap_FX_RegisterEffect( "blaster/wall_impact" ); cgs.effects.blasterFleshImpactEffect = trap_FX_RegisterEffect( "blaster/flesh_impact" ); cgs.effects.blasterDroidImpactEffect = trap_FX_RegisterEffect( "blaster/droid_impact" ); break; case WP_DISRUPTOR: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/disruptor/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/disruptor/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "disruptor/muzzle_flash" ); weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = 0; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/disruptor/alt_fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = trap_S_RegisterSound("sound/weapons/disruptor/altCharge.wav"); weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "disruptor/muzzle_flash" ); weaponInfo->altMissileModel = NULL_HANDLE; weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = 0; cgs.effects.disruptorRingsEffect = trap_FX_RegisterEffect( "disruptor/rings" ); cgs.effects.disruptorProjectileEffect = trap_FX_RegisterEffect( "disruptor/shot" ); cgs.effects.disruptorWallImpactEffect = trap_FX_RegisterEffect( "disruptor/wall_impact" ); cgs.effects.disruptorFleshImpactEffect = trap_FX_RegisterEffect( "disruptor/flesh_impact" ); cgs.effects.disruptorAltMissEffect = trap_FX_RegisterEffect( "disruptor/alt_miss" ); cgs.effects.disruptorAltHitEffect = trap_FX_RegisterEffect( "disruptor/alt_hit" ); trap_R_RegisterShader( "gfx/effects/redLine" ); trap_R_RegisterShader( "gfx/misc/whiteline2" ); trap_R_RegisterShader( "gfx/effects/smokeTrail" ); trap_S_RegisterSound("sound/weapons/disruptor/zoomstart.wav"); trap_S_RegisterSound("sound/weapons/disruptor/zoomend.wav"); // Disruptor gun zoom interface cgs.media.disruptorMask = trap_R_RegisterShader( "gfx/2d/cropCircle2"); cgs.media.disruptorInsert = trap_R_RegisterShader( "gfx/2d/cropCircle"); cgs.media.disruptorLight = trap_R_RegisterShader( "gfx/2d/cropCircleGlow" ); cgs.media.disruptorInsertTick = trap_R_RegisterShader( "gfx/2d/insertTick" ); cgs.media.disruptorChargeShader = trap_R_RegisterShaderNoMip("gfx/2d/crop_charge"); cgs.media.disruptorZoomLoop = trap_S_RegisterSound( "sound/weapons/disruptor/zoomloop.wav" ); break; case WP_BOWCASTER: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/bowcaster/select.wav"); weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/bowcaster/fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = NULL_SOUND; weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "bowcaster/muzzle_flash" ); weaponInfo->altMissileModel = NULL_HANDLE; weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor = {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = FX_BowcasterProjectileThink; weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/bowcaster/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = trap_S_RegisterSound( "sound/weapons/bowcaster/altcharge.wav"); weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "bowcaster/muzzle_flash" ); weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor= {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_BowcasterAltProjectileThink; cgs.effects.bowcasterShotEffect = trap_FX_RegisterEffect( "bowcaster/shot" ); cgs.effects.bowcasterImpactEffect = trap_FX_RegisterEffect( "bowcaster/explosion" ); trap_FX_RegisterEffect( "bowcaster/deflect" ); cgs.media.greenFrontFlash = trap_R_RegisterShader( "gfx/effects/greenFrontFlash" ); break; case WP_REPEATER: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/repeater/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/repeater/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "repeater/muzzle_flash" ); weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_RepeaterProjectileThink; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/repeater/alt_fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = NULL_SOUND; weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "repeater/muzzle_flash" ); weaponInfo->altMissileModel = NULL_HANDLE; weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = FX_RepeaterAltProjectileThink; cgs.effects.repeaterProjectileEffect = trap_FX_RegisterEffect( "repeater/projectile" ); cgs.effects.repeaterAltProjectileEffect = trap_FX_RegisterEffect( "repeater/alt_projectile" ); cgs.effects.repeaterWallImpactEffect = trap_FX_RegisterEffect( "repeater/wall_impact" ); cgs.effects.repeaterFleshImpactEffect = trap_FX_RegisterEffect( "repeater/flesh_impact" ); //cgs.effects.repeaterAltWallImpactEffect = trap_FX_RegisterEffect( "repeater/alt_wall_impact" ); cgs.effects.repeaterAltWallImpactEffect = trap_FX_RegisterEffect( "repeater/concussion" ); break; case WP_DEMP2: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/demp2/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound("sound/weapons/demp2/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect("demp2/muzzle_flash"); weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_DEMP2_ProjectileThink; weaponInfo->altFlashSound[0] = trap_S_RegisterSound("sound/weapons/demp2/altfire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = trap_S_RegisterSound("sound/weapons/demp2/altCharge.wav"); weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect("demp2/muzzle_flash"); weaponInfo->altMissileModel = NULL_HANDLE; weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = 0; cgs.effects.demp2ProjectileEffect = trap_FX_RegisterEffect( "demp2/projectile" ); cgs.effects.demp2WallImpactEffect = trap_FX_RegisterEffect( "demp2/wall_impact" ); cgs.effects.demp2FleshImpactEffect = trap_FX_RegisterEffect( "demp2/flesh_impact" ); cgs.media.demp2Shell = trap_R_RegisterModel( "models/items/sphere.md3" ); cgs.media.demp2ShellShader = trap_R_RegisterShader( "gfx/effects/demp2shell" ); cgs.media.lightningFlash = trap_R_RegisterShader("gfx/misc/lightningFlash"); break; case WP_FLECHETTE: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/flechette/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/flechette/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "flechette/muzzle_flash" ); weaponInfo->missileModel = trap_R_RegisterModel("models/weapons2/golan_arms/projectileMain.md3"); weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_FlechetteProjectileThink; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/flechette/alt_fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = NULL_SOUND; weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "flechette/muzzle_flash" ); weaponInfo->altMissileModel = trap_R_RegisterModel( "models/weapons2/golan_arms/projectile.md3" ); weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = FX_FlechetteAltProjectileThink; cgs.effects.flechetteShotEffect = trap_FX_RegisterEffect( "flechette/shot" ); cgs.effects.flechetteAltShotEffect = trap_FX_RegisterEffect( "flechette/alt_shot" ); cgs.effects.flechetteWallImpactEffect = trap_FX_RegisterEffect( "flechette/wall_impact" ); cgs.effects.flechetteFleshImpactEffect = trap_FX_RegisterEffect( "flechette/flesh_impact" ); break; case WP_ROCKET_LAUNCHER: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/rocket/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/rocket/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = trap_FX_RegisterEffect( "rocket/muzzle_flash" ); //trap_FX_RegisterEffect( "rocket/muzzle_flash2" ); //flash2 still looks crappy with the fx bolt stuff. Because the fx bolt stuff doesn't work entirely right. weaponInfo->missileModel = trap_R_RegisterModel( "models/weapons2/merr_sonn/projectile.md3" ); weaponInfo->missileSound = trap_S_RegisterSound( "sound/weapons/rocket/missleloop.wav"); weaponInfo->missileDlight = 125; VectorSet(weaponInfo->missileDlightColor, 1.0, 1.0, 0.5); weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_RocketProjectileThink; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/rocket/alt_fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = NULL_SOUND; weaponInfo->altMuzzleEffect = trap_FX_RegisterEffect( "rocket/altmuzzle_flash" ); weaponInfo->altMissileModel = trap_R_RegisterModel( "models/weapons2/merr_sonn/projectile.md3" ); weaponInfo->altMissileSound = trap_S_RegisterSound( "sound/weapons/rocket/missleloop.wav"); weaponInfo->altMissileDlight = 125; VectorSet(weaponInfo->altMissileDlightColor, 1.0, 1.0, 0.5); weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = FX_RocketAltProjectileThink; cgs.effects.rocketShotEffect = trap_FX_RegisterEffect( "rocket/shot" ); cgs.effects.rocketExplosionEffect = trap_FX_RegisterEffect( "rocket/explosion" ); trap_R_RegisterShaderNoMip( "gfx/2d/wedge" ); trap_R_RegisterShaderNoMip( "gfx/2d/lock" ); trap_S_RegisterSound( "sound/weapons/rocket/lock.wav" ); trap_S_RegisterSound( "sound/weapons/rocket/tick.wav" ); break; case WP_THERMAL: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/thermal/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/thermal/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = trap_S_RegisterSound( "sound/weapons/thermal/charge.wav"); weaponInfo->muzzleEffect = NULL_FX; weaponInfo->missileModel = trap_R_RegisterModel( "models/weapons2/thermal/thermal_proj.md3" ); weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = 0; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/thermal/fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = trap_S_RegisterSound( "sound/weapons/thermal/charge.wav"); weaponInfo->altMuzzleEffect = NULL_FX; weaponInfo->altMissileModel = trap_R_RegisterModel( "models/weapons2/thermal/thermal_proj.md3" ); weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = 0; cgs.effects.thermalExplosionEffect = trap_FX_RegisterEffect( "thermal/explosion" ); cgs.effects.thermalShockwaveEffect = trap_FX_RegisterEffect( "thermal/shockwave" ); cgs.media.grenadeBounce1 = trap_S_RegisterSound( "sound/weapons/thermal/bounce1.wav" ); cgs.media.grenadeBounce2 = trap_S_RegisterSound( "sound/weapons/thermal/bounce2.wav" ); trap_S_RegisterSound( "sound/weapons/thermal/thermloop.wav" ); trap_S_RegisterSound( "sound/weapons/thermal/warning.wav" ); break; case WP_TRIP_MINE: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/detpack/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/laser_trap/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = NULL_FX; weaponInfo->missileModel = 0;//trap_R_RegisterModel( "models/weapons2/laser_trap/laser_trap_w.md3" ); weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = 0; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/laser_trap/fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = NULL_SOUND; weaponInfo->altMuzzleEffect = NULL_FX; weaponInfo->altMissileModel = 0;//trap_R_RegisterModel( "models/weapons2/laser_trap/laser_trap_w.md3" ); weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = 0; cgs.effects.tripmineLaserFX = trap_FX_RegisterEffect("tripMine/laserMP.efx"); cgs.effects.tripmineGlowFX = trap_FX_RegisterEffect("tripMine/glowbit.efx"); trap_FX_RegisterEffect( "tripMine/explosion" ); // NOTENOTE temp stuff trap_S_RegisterSound( "sound/weapons/laser_trap/stick.wav" ); trap_S_RegisterSound( "sound/weapons/laser_trap/warning.wav" ); break; case WP_DET_PACK: weaponInfo->selectSound = trap_S_RegisterSound("sound/weapons/detpack/select.wav"); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/detpack/fire.wav"); weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = NULL_FX; weaponInfo->missileModel = trap_R_RegisterModel( "models/weapons2/detpack/det_pack.md3" ); weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; // weaponInfo->missileDlightColor = {0,0,0}; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = 0; weaponInfo->altFlashSound[0] = trap_S_RegisterSound( "sound/weapons/detpack/fire.wav"); weaponInfo->altFiringSound = NULL_SOUND; weaponInfo->altChargeSound = NULL_SOUND; weaponInfo->altMuzzleEffect = NULL_FX; weaponInfo->altMissileModel = trap_R_RegisterModel( "models/weapons2/detpack/det_pack.md3" ); weaponInfo->altMissileSound = NULL_SOUND; weaponInfo->altMissileDlight = 0; // weaponInfo->altMissileDlightColor= {0,0,0}; weaponInfo->altMissileHitSound = NULL_SOUND; weaponInfo->altMissileTrailFunc = 0; trap_R_RegisterModel( "models/weapons2/detpack/det_pack.md3" ); trap_S_RegisterSound( "sound/weapons/detpack/stick.wav" ); trap_S_RegisterSound( "sound/weapons/detpack/warning.wav" ); trap_S_RegisterSound( "sound/weapons/explosions/explode5.wav" ); break; case WP_TURRET: weaponInfo->flashSound[0] = NULL_SOUND; weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = NULL_HANDLE; weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_TurretProjectileThink; trap_FX_RegisterEffect("effects/blaster/wall_impact.efx"); trap_FX_RegisterEffect("effects/blaster/flesh_impact.efx"); break; default: MAKERGB( weaponInfo->flashDlightColor, 1, 1, 1 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/rocket/rocklf1a.wav" ); break; } }
void TurretClientRun(centity_t *ent) { if (!ent->ghoul2) { weaponInfo_t *weaponInfo; trap_G2API_InitGhoul2Model(&ent->ghoul2, CG_ConfigString( CS_MODELS+ent->currentState.modelindex ), 0, 0, 0, 0, 0); if (!ent->ghoul2) { //bad return; } ent->torsoBolt = trap_G2API_AddBolt( ent->ghoul2, 0, "*flash02" ); trap_G2API_SetBoneAngles( ent->ghoul2, 0, "bone_hinge", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Y, POSITIVE_Z, POSITIVE_X, NULL, 100, cg.time ); trap_G2API_SetBoneAngles( ent->ghoul2, 0, "bone_gback", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Y, POSITIVE_Z, POSITIVE_X, NULL, 100, cg.time ); trap_G2API_SetBoneAngles( ent->ghoul2, 0, "bone_barrel", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Y, POSITIVE_Z, POSITIVE_X, NULL, 100, cg.time ); trap_G2API_SetBoneAnim( ent->ghoul2, 0, "model_root", 0, 11, BONE_ANIM_OVERRIDE_FREEZE, 0.8f, cg.time, 0, 0 ); ent->turAngles[ROLL] = 0; ent->turAngles[PITCH] = 90; ent->turAngles[YAW] = 0; weaponInfo = &cg_weapons[WP_TURRET]; if ( !weaponInfo->registered ) { memset( weaponInfo, 0, sizeof( *weaponInfo ) ); weaponInfo->flashSound[0] = NULL_SOUND; weaponInfo->firingSound = NULL_SOUND; weaponInfo->chargeSound = NULL_SOUND; weaponInfo->muzzleEffect = NULL_HANDLE; weaponInfo->missileModel = NULL_HANDLE; weaponInfo->missileSound = NULL_SOUND; weaponInfo->missileDlight = 0; weaponInfo->missileHitSound = NULL_SOUND; weaponInfo->missileTrailFunc = FX_TurretProjectileThink; cgs.effects.turretShotEffect = trap_FX_RegisterEffect( "turret/shot" ); trap_FX_RegisterEffect("effects/blaster/wall_impact.efx"); trap_FX_RegisterEffect("effects/blaster/flesh_impact.efx"); weaponInfo->registered = qtrue; } } if (ent->currentState.fireflag == 2) { //I'm about to blow if (ent->turAngles) { trap_G2API_SetBoneAngles( ent->ghoul2, 0, "bone_hinge", ent->turAngles, BONE_ANGLES_REPLACE, NEGATIVE_Y, NEGATIVE_Z, NEGATIVE_X, NULL, 100, cg.time ); } return; } else if (ent->currentState.fireflag && ent->bolt4 != ent->currentState.fireflag) { vec3_t muzzleOrg, muzzleDir; mdxaBone_t boltMatrix; trap_G2API_GetBoltMatrix(ent->ghoul2, 0, ent->torsoBolt, &boltMatrix, /*ent->lerpAngles*/vec3_origin, ent->lerpOrigin, cg.time, cgs.gameModels, ent->modelScale); trap_G2API_GiveMeVectorFromMatrix(&boltMatrix, ORIGIN, muzzleOrg); trap_G2API_GiveMeVectorFromMatrix(&boltMatrix, NEGATIVE_X, muzzleDir); trap_FX_PlayEffectID(trap_FX_RegisterEffect("effects/turret/muzzle_flash.efx"), muzzleOrg, muzzleDir); ent->bolt4 = ent->currentState.fireflag; } else if (!ent->currentState.fireflag) { ent->bolt4 = 0; } if (ent->currentState.bolt2 != ENTITYNUM_NONE) { //turn toward the enemy centity_t *enemy = &cg_entities[ent->currentState.bolt2]; if (enemy) { vec3_t enAng; vec3_t enPos; VectorCopy(enemy->currentState.pos.trBase, enPos); VectorSubtract(enPos, ent->lerpOrigin, enAng); VectorNormalize(enAng); vectoangles(enAng, enAng); enAng[ROLL] = 0; enAng[PITCH] += 90; CreepToPosition(enAng, ent->turAngles); } } else { vec3_t idleAng; float turnAmount; if (ent->turAngles[YAW] > 360) { ent->turAngles[YAW] -= 361; } if (!ent->dustTrailTime) { ent->dustTrailTime = cg.time; } turnAmount = (cg.time-ent->dustTrailTime)*0.03; if (turnAmount > 360) { turnAmount = 360; } idleAng[PITCH] = 90; idleAng[ROLL] = 0; idleAng[YAW] = ent->turAngles[YAW] + turnAmount; ent->dustTrailTime = cg.time; CreepToPosition(idleAng, ent->turAngles); } if (cg.time < ent->frame_minus1_refreshed) { ent->frame_minus1_refreshed = cg.time; return; } ent->frame_minus1_refreshed = cg.time; trap_G2API_SetBoneAngles( ent->ghoul2, 0, "bone_hinge", ent->turAngles, BONE_ANGLES_REPLACE, NEGATIVE_Y, NEGATIVE_Z, NEGATIVE_X, NULL, 100, cg.time ); }
qboolean WP_SaberParseParms( const char *SaberName, saberInfo_t *saber ) { const char *token; const char *value; const char *p; char useSaber[1024]; float f; int n; qboolean triedDefault = qfalse; if ( !saber ) { return qfalse; } //Set defaults so that, if it fails, there's at least something there WP_SaberSetDefaults( saber ); if ( !SaberName || !SaberName[0] ) { strcpy(useSaber, DEFAULT_SABER); //default triedDefault = qtrue; } else { strcpy(useSaber, SaberName); } //try to parse it out p = SaberParms; COM_BeginParseSession("saberinfo"); // look for the right saber while ( p ) { token = COM_ParseExt( &p, qtrue ); if ( token[0] == 0 ) { if (!triedDefault) { //fall back to default and restart, should always be there p = SaberParms; COM_BeginParseSession("saberinfo"); strcpy(useSaber, DEFAULT_SABER); triedDefault = qtrue; } else { return qfalse; } } if ( !Q_stricmp( token, useSaber ) ) { break; } SkipBracedSection( &p ); } if ( !p ) { //even the default saber isn't found? return qfalse; } //got the name we're using for sure strcpy(saber->name, useSaber); if ( BG_ParseLiteral( &p, "{" ) ) { return qfalse; } // parse the saber info block while ( 1 ) { token = COM_ParseExt( &p, qtrue ); if ( !token[0] ) { Com_Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", useSaber ); return qfalse; } if ( !Q_stricmp( token, "}" ) ) { break; } //saber fullName if ( !Q_stricmp( token, "name" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } strcpy(saber->fullName, value); continue; } //saber type if ( !Q_stricmp( token, "saberType" ) ) { int saberType; if ( COM_ParseString( &p, &value ) ) { continue; } saberType = GetIDForString( SaberTable, value ); if ( saberType >= SABER_SINGLE && saberType <= NUM_SABERS ) { saber->type = (saberType_t)saberType; } continue; } //saber hilt if ( !Q_stricmp( token, "saberModel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } strcpy(saber->model, value); continue; } if ( !Q_stricmp( token, "customSkin" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->skin = trap_R_RegisterSkin(value); continue; } //on sound if ( !Q_stricmp( token, "soundOn" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->soundOn = BG_SoundIndex( (char *)value ); continue; } //loop sound if ( !Q_stricmp( token, "soundLoop" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->soundLoop = BG_SoundIndex( (char *)value ); continue; } //off sound if ( !Q_stricmp( token, "soundOff" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->soundOff = BG_SoundIndex( (char *)value ); continue; } if ( !Q_stricmp( token, "numBlades" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n >= MAX_BLADES ) { Com_Error(ERR_DROP, "WP_SaberParseParms: saber %s has illegal number of blades (%d) max: %d", useSaber, n, MAX_BLADES ); continue; } saber->numBlades = n; continue; } // saberColor if ( !Q_stricmpn( token, "saberColor", 10 ) ) { if (strlen(token)==10) { n = -1; } else if (strlen(token)==11) { n = atoi(&token[10])-1; if (n > 7 || n < 1 ) { #ifndef FINAL_BUILD Com_Printf( S_COLOR_YELLOW"WARNING: bad saberColor '%s' in %s\n", token, useSaber ); #endif continue; } } else { #ifndef FINAL_BUILD Com_Printf( S_COLOR_YELLOW"WARNING: bad saberColor '%s' in %s\n", token, useSaber ); #endif continue; } if ( COM_ParseString( &p, &value ) ) //read the color { continue; } if (n==-1) {//NOTE: this fills in the rest of the blades with the same color by default saber_colors_t color = TranslateSaberColor( value ); for ( n = 0; n < MAX_BLADES; n++ ) { saber->blade[n].color = color; } } else { saber->blade[n].color = TranslateSaberColor( value ); } continue; } //saber length if ( !Q_stricmpn( token, "saberLength", 11 ) ) { if (strlen(token)==11) { n = -1; } else if (strlen(token)==12) { n = atoi(&token[11])-1; if (n > 7 || n < 1 ) { #ifndef FINAL_BUILD Com_Printf( S_COLOR_YELLOW"WARNING: bad saberLength '%s' in %s\n", token, useSaber ); #endif continue; } } else { #ifndef FINAL_BUILD Com_Printf( S_COLOR_YELLOW"WARNING: bad saberLength '%s' in %s\n", token, useSaber ); #endif continue; } if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } if (n==-1) {//NOTE: this fills in the rest of the blades with the same length by default for ( n = 0; n < MAX_BLADES; n++ ) { saber->blade[n].lengthMax = f; } } else { saber->blade[n].lengthMax = f; } continue; } //blade radius if ( !Q_stricmpn( token, "saberRadius", 11 ) ) { if (strlen(token)==11) { n = -1; } else if (strlen(token)==12) { n = atoi(&token[11])-1; if (n > 7 || n < 1 ) { #ifndef FINAL_BUILD Com_Printf( S_COLOR_YELLOW"WARNING: bad saberRadius '%s' in %s\n", token, useSaber ); #endif continue; } } else { #ifndef FINAL_BUILD Com_Printf( S_COLOR_YELLOW"WARNING: bad saberRadius '%s' in %s\n", token, useSaber ); #endif continue; } if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } if (n==-1) {//NOTE: this fills in the rest of the blades with the same length by default for ( n = 0; n < MAX_BLADES; n++ ) { saber->blade[n].radius = f; } } else { saber->blade[n].radius = f; } continue; } //locked saber style if ( !Q_stricmp( token, "saberStyle" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->style = TranslateSaberStyle( value ); continue; } //maxChain if ( !Q_stricmp( token, "maxChain" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->maxChain = n; continue; } //lockable if ( !Q_stricmp( token, "lockable" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->lockable = ((qboolean)(n!=0)); continue; } //throwable if ( !Q_stricmp( token, "throwable" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->throwable = ((qboolean)(n!=0)); continue; } //disarmable if ( !Q_stricmp( token, "disarmable" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->disarmable = ((qboolean)(n!=0)); continue; } //active blocking if ( !Q_stricmp( token, "blocking" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->activeBlocking = ((qboolean)(n!=0)); continue; } //twoHanded if ( !Q_stricmp( token, "twoHanded" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->twoHanded = ((qboolean)(n!=0)); continue; } //force power restrictions if ( !Q_stricmp( token, "forceRestrict" ) ) { int fp; if ( COM_ParseString( &p, &value ) ) { continue; } fp = GetIDForString( FPTable, value ); if ( fp >= FP_FIRST && fp < NUM_FORCE_POWERS ) { saber->forceRestrictions |= (1<<fp); } continue; } //lockBonus if ( !Q_stricmp( token, "lockBonus" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->lockBonus = n; continue; } //parryBonus if ( !Q_stricmp( token, "parryBonus" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->parryBonus = n; continue; } //breakParryBonus if ( !Q_stricmp( token, "breakParryBonus" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->breakParryBonus = n; continue; } //disarmBonus if ( !Q_stricmp( token, "disarmBonus" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->disarmBonus = n; continue; } //single blade saber style if ( !Q_stricmp( token, "singleBladeStyle" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->singleBladeStyle = TranslateSaberStyle( value ); continue; } //single blade throwable if ( !Q_stricmp( token, "singleBladeThrowable" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->singleBladeThrowable = ((qboolean)(n!=0)); continue; } //broken replacement saber1 (right hand) if ( !Q_stricmp( token, "brokenSaber1" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } //saber->brokenSaber1 = G_NewString( value ); continue; } //broken replacement saber2 (left hand) if ( !Q_stricmp( token, "brokenSaber2" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } //saber->brokenSaber2 = G_NewString( value ); continue; } //spins and does damage on return from saberthrow if ( !Q_stricmp( token, "returnDamage" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->returnDamage = ((qboolean)(n!=0)); continue; } //stops the saber from drawing marks on the world (good for real-sword type mods) if ( !Q_stricmp( token, "noWallMarks" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->noWallMarks = ((qboolean)(n!=0)); continue; } //stops the saber from drawing a dynamic light (good for real-sword type mods) if ( !Q_stricmp( token, "noDlight" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->noDlight = ((qboolean)(n!=0)); continue; } //stops the saber from drawing a blade (good for real-sword type mods) if ( !Q_stricmp( token, "noBlade" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->noBlade = ((qboolean)(n!=0)); continue; } //default (0) is normal, 1 is a motion blur and 2 is no trail at all (good for real-sword type mods) if ( !Q_stricmp( token, "trailStyle" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->trailStyle = n; continue; } //if set, the game will use this shader for marks on enemies instead of the default "gfx/damage/saberglowmark" if ( !Q_stricmp( token, "g2MarksShader" ) ) { if ( COM_ParseString( &p, &value ) ) { SkipRestOfLine( &p ); continue; } #ifdef QAGAME//cgame-only cares about this #elif defined CGAME saber->g2MarksShader = trap_R_RegisterShader( value ); #endif continue; } //if non-zero, uses damage done to calculate an appropriate amount of knockback if ( !Q_stricmp( token, "knockbackScale" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } saber->knockbackScale = f; continue; } //scale up or down the damage done by the saber if ( !Q_stricmp( token, "damageScale" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } saber->damageScale = f; continue; } //if non-zero, the saber never does dismemberment (good for pointed/blunt melee weapons) if ( !Q_stricmp( token, "noDismemberment" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->noDismemberment = ((qboolean)(n!=0)); continue; } //if non-zero, the saber will not do damage or any effects when it is idle (not in an attack anim). (good for real-sword type mods) if ( !Q_stricmp( token, "noIdleEffect" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->noIdleEffect = ((qboolean)(n!=0)); continue; } //spin sound (when thrown) if ( !Q_stricmp( token, "spinSound" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->spinSound = BG_SoundIndex( (char *)value ); continue; } //swing sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "swingSound1" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->swingSound[0] = BG_SoundIndex( (char *)value ); continue; } //swing sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "swingSound2" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->swingSound[1] = BG_SoundIndex( (char *)value ); continue; } //swing sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "swingSound3" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->swingSound[2] = BG_SoundIndex( (char *)value ); continue; } //hit sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "hitSound1" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->hitSound[0] = BG_SoundIndex( (char *)value ); continue; } //hit sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "hitSound2" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->hitSound[1] = BG_SoundIndex( (char *)value ); continue; } //hit sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "hitSound3" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->hitSound[2] = BG_SoundIndex( (char *)value ); continue; } //block sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "blockSound1" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->blockSound[0] = BG_SoundIndex( (char *)value ); continue; } //block sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "blockSound2" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->blockSound[1] = BG_SoundIndex( (char *)value ); continue; } //block sound - NOTE: must provide all 3!!! if ( !Q_stricmp( token, "blockSound3" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } saber->blockSound[2] = BG_SoundIndex( (char *)value ); continue; } //block effect - when saber/sword hits another saber/sword if ( !Q_stricmp( token, "blockEffect" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } #ifdef QAGAME//cgame-only cares about this #elif defined CGAME saber->blockEffect = trap_FX_RegisterEffect( (char *)value ); #endif continue; } //hit person effect - when saber/sword hits a person if ( !Q_stricmp( token, "hitPersonEffect" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } #ifdef QAGAME//cgame-only cares about this #elif defined CGAME saber->hitPersonEffect = trap_FX_RegisterEffect( (char *)value ); #endif continue; } //hit other effect - when saber/sword hits sopmething else damagable if ( !Q_stricmp( token, "hitOtherEffect" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } #ifdef QAGAME//cgame-only cares about this #elif defined CGAME saber->hitOtherEffect = trap_FX_RegisterEffect( (char *)value ); #endif continue; } //if non-zero, the saber will not do the big, white clash flare with other sabers if ( !Q_stricmp( token, "noClashFlare" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } saber->noClashFlare = ((qboolean)(n!=0)); continue; } if ( !Q_stricmp( token, "notInMP" ) ) {//ignore this SkipRestOfLine( &p ); continue; } //FIXME: saber sounds (on, off, loop) #ifdef _DEBUG Com_Printf( "WARNING: unknown keyword '%s' while parsing '%s'\n", token, useSaber ); #endif SkipRestOfLine( &p ); } //FIXME: precache the saberModel(s)? return qtrue; }