void CG_DrawPickupItem( void ) { linkedList_t *node = NULL; float x = ICON_SIZE*0.25f, y = SCREEN_HEIGHT-ICON_SIZE*0.25f; int count = 0; trap->R_SetColor( NULL ); //First pass to remove expired items for ( node=cg.q3p.itemPickupRoot; node; node=LinkedList_Traverse( node ) ) { itemPickup_t *item = (itemPickup_t*)node->data; if ( item->pickupTime < cg.time - cg_itemPickupTime->integer ) {//Free this object free( item ); LinkedList_RemoveObject( &cg.q3p.itemPickupRoot, node ); node = cg.q3p.itemPickupRoot;//HACK: Return to start of list continue; } count++; } y -= ICON_SIZE*count; for ( node=cg.q3p.itemPickupRoot; node; node=LinkedList_Traverse( node ) ) { itemPickup_t *item = (itemPickup_t*)node->data; CG_RegisterItemVisuals( item->itemNum ); CG_DrawPic( x, y, ICON_SIZE, ICON_SIZE, cg_items[item->itemNum].icon ); y += ICON_SIZE; } }
void NPC_PrecacheWeapons( team_t playerTeam, int spawnflags, char *NPCtype ) { int weapons = NPC_WeaponsForTeam( playerTeam, spawnflags, NPCtype ); gitem_t *item; for ( int curWeap = WP_SABER; curWeap < WP_NUM_WEAPONS; curWeap++ ) { if ( (weapons & ( 1 << curWeap )) ) { item = FindItemForWeapon( ((weapon_t)(curWeap)) ); //precache the weapon CG_RegisterItemSounds( (item-bg_itemlist) ); CG_RegisterItemVisuals( (item-bg_itemlist) ); //precache the in-hand/in-world ghoul2 weapon model char weaponModel[64]; strcpy (weaponModel, weaponData[curWeap].weaponMdl); if (char *spot = strstr(weaponModel, ".md3") ) { *spot = 0; spot = strstr(weaponModel, "_w");//i'm using the in view weapon array instead of scanning the item list, so put the _w back on if (!spot) { strcat (weaponModel, "_w"); } strcat (weaponModel, ".glm"); //and change to ghoul2 } gi.G2API_PrecacheGhoul2Model( weaponModel ); // correct way is item->world_model } } }
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 cgi_GetGameState( &cgs.gameState ); // look up the individual string that was modified str = CG_ConfigString( num ); // do something with it if necessary if ( num == CS_ITEMS ) { int i; for ( i = 1 ; i < bg_numItems ; i++ ) { if ( str[ i ] == '1' ) { if (bg_itemlist[i].classname) { CG_RegisterItemSounds( i ); CG_RegisterItemVisuals( i ); } } } } else if ( num == CS_MUSIC ) { CG_StartMusic( qtrue ); } else if ( num == CS_SERVERINFO ) { CG_ParseServerinfo(); } else if ( num >= CS_MODELS && num < CS_MODELS+MAX_MODELS ) { cgs.model_draw[ num-CS_MODELS ] = cgi_R_RegisterModel( str ); // OutputDebugString(va("### CG_ConfigStringModified(): cgs.model_draw[%d] = \"%s\"\n",num-CS_MODELS,str)); // GHOUL2 Insert start } else if ( num >= CS_CHARSKINS && num < CS_CHARSKINS+MAX_CHARSKINS ) { cgs.skins[ num-CS_CHARSKINS ] = cgi_R_RegisterSkin( str ); // Ghoul2 Insert end } else if ( num >= CS_SOUNDS && num < CS_SOUNDS+MAX_SOUNDS ) { if ( str[0] != '*' ) { cgs.sound_precache[ num-CS_SOUNDS] = cgi_S_RegisterSound( str ); } } else if ( num >= CS_EFFECTS && num < CS_EFFECTS + MAX_FX ) { theFxScheduler.RegisterEffect( str ); } else if ( num >= CS_PLAYERS && num < CS_PLAYERS+MAX_CLIENTS ) { CG_NewClientinfo( num - CS_PLAYERS ); CG_RegisterClientModels( num - CS_PLAYERS ); } else if ( num >= CS_LIGHT_STYLES && num < CS_LIGHT_STYLES + (MAX_LIGHT_STYLES*3)) { CG_SetLightstyle(num - CS_LIGHT_STYLES); } else if ( num >= CS_WORLD_FX && num < CS_WORLD_FX + MAX_WORLD_FX ) { cgi_R_WorldEffectCommand( str ); } }
static void CG_DrawFlagsPowerUp(rectDef_t *rect) { int value; if (cgs.gametype < GT_FLAGS) { return; } value = cg.snap->ps.stats[STAT_PERSISTENT_POWERUP]; if ( value ) { CG_RegisterItemVisuals( value ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, cg_items[ value ].icon ); } }
static void CG_DrawPlayerItem( rectDef_t *rect, float scale, qboolean draw2D) { int value; vector3 origin, angles; value = cg.snap->ps.stats[STAT_HOLDABLE_ITEM]; if ( value ) { CG_RegisterItemVisuals( value ); if (qtrue) { CG_RegisterItemVisuals( value ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, cg_items[ value ].icon ); } else { VectorClear( &angles ); origin.x = 90; origin.y = 0; origin.z = -10; angles.yaw = ( cg.time & 2047 ) * 360 / 2048.0f; CG_Draw3DModel(rect->x, rect->y, rect->w, rect->h, cg_items[ value ].models[0], 0, &origin, &angles ); } } }
/* ================= 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; } if ( cgs.wDisable & (1<<weaponNum) ) 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 ) { trap->Error( ERR_DROP, "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 || weaponNum == WP_CONCUSSION) { strcpy( path, item->view_model ); COM_StripExtension( path, path, sizeof( 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, sizeof( 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/projectile" ); 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; } }
/* ================= 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] ); // 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->world_model[0] ); COM_StripExtension( path, path ); strcat( path, "_flash.md3" ); weaponInfo->flashModel = trap_R_RegisterModel( path ); strcpy( path, item->world_model[0] ); COM_StripExtension( path, path ); strcat( path, "_barrel.md3" ); weaponInfo->barrelModel = trap_R_RegisterModel( path ); strcpy( path, item->world_model[0] ); COM_StripExtension( path, path ); strcat( path, "_hand.md3" ); weaponInfo->handsModel = trap_R_RegisterModel( path ); if ( !weaponInfo->handsModel ) { weaponInfo->handsModel = trap_R_RegisterModel( "models/weapons2/shotgun/shotgun_hand.md3" ); } weaponInfo->loopFireSound = qfalse; switch ( weaponNum ) { case WP_GAUNTLET: MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f ); weaponInfo->firingSound = trap_S_RegisterSound( "sound/weapons/melee/fstrun.wav", qfalse ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav", qfalse ); break; case WP_LIGHTNING: MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f ); weaponInfo->readySound = trap_S_RegisterSound( "sound/weapons/melee/fsthum.wav", qfalse ); weaponInfo->firingSound = trap_S_RegisterSound( "sound/weapons/lightning/lg_hum.wav", qfalse ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/lightning/lg_fire.wav", qfalse ); cgs.media.lightningShader = trap_R_RegisterShader( "lightningBoltNew"); cgs.media.lightningExplosionModel = trap_R_RegisterModel( "models/weaphits/crackle.md3" ); cgs.media.sfx_lghit1 = trap_S_RegisterSound( "sound/weapons/lightning/lg_hit.wav", qfalse ); cgs.media.sfx_lghit2 = trap_S_RegisterSound( "sound/weapons/lightning/lg_hit2.wav", qfalse ); cgs.media.sfx_lghit3 = trap_S_RegisterSound( "sound/weapons/lightning/lg_hit3.wav", qfalse ); break; case WP_GRAPPLING_HOOK: MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f ); weaponInfo->missileModel = trap_R_RegisterModel( "models/ammo/rocket/rocket.md3" ); weaponInfo->missileTrailFunc = CG_GrappleTrail; weaponInfo->missileDlight = 200; weaponInfo->wiTrailTime = 2000; weaponInfo->trailRadius = 64; MAKERGB( weaponInfo->missileDlightColor, 1, 0.75f, 0 ); weaponInfo->readySound = trap_S_RegisterSound( "sound/weapons/melee/fsthum.wav", qfalse ); weaponInfo->firingSound = trap_S_RegisterSound( "sound/weapons/melee/fstrun.wav", qfalse ); break; case WP_MACHINEGUN: MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/machinegun/machgf1b.wav", qfalse ); weaponInfo->flashSound[1] = trap_S_RegisterSound( "sound/weapons/machinegun/machgf2b.wav", qfalse ); weaponInfo->flashSound[2] = trap_S_RegisterSound( "sound/weapons/machinegun/machgf3b.wav", qfalse ); weaponInfo->flashSound[3] = trap_S_RegisterSound( "sound/weapons/machinegun/machgf4b.wav", qfalse ); weaponInfo->ejectBrassFunc = CG_MachineGunEjectBrass; cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" ); break; case WP_SHOTGUN: MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/shotgun/sshotf1b.wav", qfalse ); weaponInfo->ejectBrassFunc = CG_ShotgunEjectBrass; break; case WP_ROCKET_LAUNCHER: weaponInfo->missileModel = trap_R_RegisterModel( "models/ammo/rocket/rocket.md3" ); weaponInfo->missileSound = trap_S_RegisterSound( "sound/weapons/rocket/rockfly.wav", qfalse ); weaponInfo->missileTrailFunc = CG_RocketTrail; weaponInfo->missileDlight = 200; weaponInfo->wiTrailTime = 2000; weaponInfo->trailRadius = 64; MAKERGB( weaponInfo->missileDlightColor, 1, 0.75f, 0 ); MAKERGB( weaponInfo->flashDlightColor, 1, 0.75f, 0 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/rocket/rocklf1a.wav", qfalse ); cgs.media.rocketExplosionShader = trap_R_RegisterShader( "rocketExplosion" ); break; case WP_GRENADE_LAUNCHER: weaponInfo->missileModel = trap_R_RegisterModel( "models/ammo/grenade1.md3" ); MAKERGB( weaponInfo->flashDlightColor, 1, 0.70f, 0 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/grenade/grenlf1a.wav", qfalse ); cgs.media.grenadeExplosionShader = trap_R_RegisterShader( "grenadeExplosion" ); break; case WP_PLASMAGUN: weaponInfo->missileTrailFunc = CG_PlasmaTrail; weaponInfo->missileSound = trap_S_RegisterSound( "sound/weapons/plasma/lasfly.wav", qfalse ); MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/plasma/hyprbf1a.wav", qfalse ); cgs.media.plasmaExplosionShader = trap_R_RegisterShader( "plasmaExplosion" ); cgs.media.railRingsShader = trap_R_RegisterShader( "railDisc" ); break; case WP_RAILGUN: weaponInfo->readySound = trap_S_RegisterSound( "sound/weapons/railgun/rg_hum.wav", qfalse ); MAKERGB( weaponInfo->flashDlightColor, 1, 0.5f, 0 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/railgun/railgf1a.wav", qfalse ); cgs.media.railExplosionShader = trap_R_RegisterShader( "railExplosion" ); cgs.media.railRingsShader = trap_R_RegisterShader( "railDisc" ); cgs.media.railCoreShader = trap_R_RegisterShader( "railCore" ); break; case WP_BFG: weaponInfo->readySound = trap_S_RegisterSound( "sound/weapons/bfg/bfg_hum.wav", qfalse ); MAKERGB( weaponInfo->flashDlightColor, 1, 0.7f, 1 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/bfg/bfg_fire.wav", qfalse ); cgs.media.bfgExplosionShader = trap_R_RegisterShader( "bfgExplosion" ); weaponInfo->missileModel = trap_R_RegisterModel( "models/weaphits/bfg.md3" ); weaponInfo->missileSound = trap_S_RegisterSound( "sound/weapons/rocket/rockfly.wav", qfalse ); break; default: MAKERGB( weaponInfo->flashDlightColor, 1, 1, 1 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/rocket/rocklf1a.wav", qfalse ); break; } }
/* ================= CG_RegisterGraphics This function may execute for a couple of minutes with a slow disk. ================= */ static void CG_RegisterGraphics( void ) { gitem_t *backpack; int i; char items[MAX_ITEMS+1]; static char *sb_nums[11] = { "gfx/2d/numbers/zero_32b", "gfx/2d/numbers/one_32b", "gfx/2d/numbers/two_32b", "gfx/2d/numbers/three_32b", "gfx/2d/numbers/four_32b", "gfx/2d/numbers/five_32b", "gfx/2d/numbers/six_32b", "gfx/2d/numbers/seven_32b", "gfx/2d/numbers/eight_32b", "gfx/2d/numbers/nine_32b", "gfx/2d/numbers/minus_32b", }; // clear any references to old media memset( &cg.refdef, 0, sizeof( cg.refdef ) ); trap_R_ClearScene(); CG_LoadingString( cgs.mapname ); trap_R_LoadWorldMap( cgs.mapname ); // precache status bar pics CG_LoadingString( "game media" ); for ( i=0 ; i<11 ; i++) { cgs.media.numberShaders[i] = trap_R_RegisterShader( sb_nums[i] ); } cgs.media.botSkillShaders[0] = trap_R_RegisterShader( "menu/art/skill1.tga" ); cgs.media.botSkillShaders[1] = trap_R_RegisterShader( "menu/art/skill2.tga" ); cgs.media.botSkillShaders[2] = trap_R_RegisterShader( "menu/art/skill3.tga" ); cgs.media.botSkillShaders[3] = trap_R_RegisterShader( "menu/art/skill4.tga" ); cgs.media.botSkillShaders[4] = trap_R_RegisterShader( "menu/art/skill5.tga" ); cgs.media.viewBloodShader = trap_R_RegisterShader( "viewBloodBlend" ); cgs.media.deferShader = trap_R_RegisterShaderNoMip( "gfx/2d/defer.tga" ); cgs.media.scoreboardName = trap_R_RegisterShaderNoMip( "menu/tab/name.tga" ); cgs.media.scoreboardPing = trap_R_RegisterShaderNoMip( "menu/tab/ping.tga" ); cgs.media.scoreboardScore = trap_R_RegisterShaderNoMip( "menu/tab/score.tga" ); cgs.media.scoreboardTime = trap_R_RegisterShaderNoMip( "menu/tab/time.tga" ); cgs.media.objectivesOverlay = trap_R_RegisterShaderNoMip( CG_ConfigString(CS_OBJECTIVESOVERLAY) ); cgs.media.objectivesUpdated = trap_R_RegisterShaderNoMip( "menu/objectives/updated.tga" ); cgs.media.objectivesUpdatedSound = trap_S_RegisterSound( "sound/misc/objective_update_01.wav", qfalse ); cgs.media.deathImage = trap_R_RegisterShaderNoMip( "menu/art/level_complete5" ); cgs.media.scoreShow = trap_S_RegisterSound( "sound/weapons/rocket/rocklx1a.wav", qfalse ); cgs.media.finalScoreShow = trap_S_RegisterSound( "sound/weapons/rocket/rocklx1a.wav", qfalse ); cgs.media.smokePuffShader = trap_R_RegisterShader( "smokePuff" ); cgs.media.smokePuffRageProShader = trap_R_RegisterShader( "smokePuffRagePro" ); cgs.media.shotgunSmokePuffShader = trap_R_RegisterShader( "shotgunSmokePuff" ); cgs.media.plasmaBallShader = trap_R_RegisterShader( "sprites/plasma1" ); cgs.media.bloodTrailShader = trap_R_RegisterShader( "bloodTrail" ); cgs.media.lagometerShader = trap_R_RegisterShader("lagometer" ); cgs.media.connectionShader = trap_R_RegisterShader( "disconnected" ); cgs.media.waterBubbleShader = trap_R_RegisterShader( "waterBubble" ); cgs.media.tracerShader = trap_R_RegisterShader( "gfx/misc/tracer" ); cgs.media.selectShader = trap_R_RegisterShader( "gfx/2d/select" ); for ( i = 0 ; i < NUM_CROSSHAIRS ; i++ ) { cgs.media.crosshairShader[i] = trap_R_RegisterShader( va("gfx/2d/crosshair%c", 'a'+i) ); } cgs.media.backTileShader = trap_R_RegisterShader( "gfx/2d/backtile" ); cgs.media.noammoShader = trap_R_RegisterShader( "icons/noammo" ); // powerup shaders cgs.media.quadShader = trap_R_RegisterShader("powerups/quad" ); cgs.media.quadWeaponShader = trap_R_RegisterShader("powerups/quadWeapon" ); cgs.media.battleSuitShader = trap_R_RegisterShader("powerups/battleSuit" ); cgs.media.battleWeaponShader = trap_R_RegisterShader("powerups/battleWeapon" ); cgs.media.invisShader = trap_R_RegisterShader("powerups/invisibility" ); cgs.media.regenShader = trap_R_RegisterShader("powerups/regen" ); cgs.media.hastePuffShader = trap_R_RegisterShader("hasteSmokePuff" ); if ( cg_buildScript.integer ) { cgs.media.redCubeModel = trap_R_RegisterModel( "models/powerups/orb/r_orb.md3" ); cgs.media.blueCubeModel = trap_R_RegisterModel( "models/powerups/orb/b_orb.md3" ); cgs.media.redCubeIcon = trap_R_RegisterShader( "icons/skull_red" ); cgs.media.blueCubeIcon = trap_R_RegisterShader( "icons/skull_blue" ); } if ( cg_buildScript.integer ) { cgs.media.redFlagModel = trap_R_RegisterModel( "models/flags/r_flag.md3" ); cgs.media.blueFlagModel = trap_R_RegisterModel( "models/flags/b_flag.md3" ); cgs.media.redFlagShader[0] = trap_R_RegisterShaderNoMip( "icons/iconf_red1" ); cgs.media.redFlagShader[1] = trap_R_RegisterShaderNoMip( "icons/iconf_red2" ); cgs.media.redFlagShader[2] = trap_R_RegisterShaderNoMip( "icons/iconf_red3" ); cgs.media.blueFlagShader[0] = trap_R_RegisterShaderNoMip( "icons/iconf_blu1" ); cgs.media.blueFlagShader[1] = trap_R_RegisterShaderNoMip( "icons/iconf_blu2" ); cgs.media.blueFlagShader[2] = trap_R_RegisterShaderNoMip( "icons/iconf_blu3" ); } cgs.media.dustPuffShader = trap_R_RegisterShader("hasteSmokePuff" ); if ( CG_IsTeamGame() || cg_buildScript.integer ) { cgs.media.friendShader = trap_R_RegisterShader( "sprites/foe" ); cgs.media.redQuadShader = trap_R_RegisterShader("powerups/blueflag" ); cgs.media.teamStatusBar = trap_R_RegisterShader( "gfx/2d/colorbar.tga" ); } cgs.media.armorModel = trap_R_RegisterModel( "models/powerups/armor/armor_yel.md3" ); cgs.media.armorIcon = trap_R_RegisterShaderNoMip( "icons/iconr_yellow" ); cgs.media.machinegunBrassModel = trap_R_RegisterModel( "models/weapons2/shells/m_shell.md3" ); cgs.media.shotgunBrassModel = trap_R_RegisterModel( "models/weapons2/shells/s_shell.md3" ); cgs.media.gibAbdomen = trap_R_RegisterModel( "models/gibs/abdomen.md3" ); cgs.media.gibArm = trap_R_RegisterModel( "models/gibs/arm.md3" ); cgs.media.gibChest = trap_R_RegisterModel( "models/gibs/chest.md3" ); cgs.media.gibFist = trap_R_RegisterModel( "models/gibs/fist.md3" ); cgs.media.gibFoot = trap_R_RegisterModel( "models/gibs/foot.md3" ); cgs.media.gibForearm = trap_R_RegisterModel( "models/gibs/forearm.md3" ); cgs.media.gibIntestine = trap_R_RegisterModel( "models/gibs/intestine.md3" ); cgs.media.gibLeg = trap_R_RegisterModel( "models/gibs/leg.md3" ); cgs.media.gibSkull = trap_R_RegisterModel( "models/gibs/skull.md3" ); cgs.media.gibBrain = trap_R_RegisterModel( "models/gibs/brain.md3" ); cgs.media.debrislight1 = trap_R_RegisterModel( "models/debris/concrete_b1.md3" ); cgs.media.debrislight2 = trap_R_RegisterModel( "models/debris/concrete_b2.md3" ); cgs.media.debrislight3 = trap_R_RegisterModel( "models/debris/concrete_b3.md3" ); cgs.media.debrislight4 = trap_R_RegisterModel( "models/debris/concrete_b4.md3" ); cgs.media.debrislight5 = trap_R_RegisterModel( "models/debris/concrete_b5.md3" ); cgs.media.debrislight6 = trap_R_RegisterModel( "models/debris/concrete_b6.md3" ); cgs.media.debrislight7 = trap_R_RegisterModel( "models/debris/concrete_b7.md3" ); cgs.media.debrislight8 = trap_R_RegisterModel( "models/debris/concrete_b8.md3" ); cgs.media.debrisdark1 = trap_R_RegisterModel( "models/debris/concrete_d1.md3" ); cgs.media.debrisdark2 = trap_R_RegisterModel( "models/debris/concrete_d2.md3" ); cgs.media.debrisdark3 = trap_R_RegisterModel( "models/debris/concrete_d3.md3" ); cgs.media.debrisdark4 = trap_R_RegisterModel( "models/debris/concrete_d4.md3" ); cgs.media.debrisdark5 = trap_R_RegisterModel( "models/debris/concrete_d5.md3" ); cgs.media.debrisdark6 = trap_R_RegisterModel( "models/debris/concrete_d6.md3" ); cgs.media.debrisdark7 = trap_R_RegisterModel( "models/debris/concrete_d7.md3" ); cgs.media.debrisdark8 = trap_R_RegisterModel( "models/debris/concrete_d8.md3" ); cgs.media.debrislightlarge1 = trap_R_RegisterModel( "models/debris/concrete_b1_large.md3" ); cgs.media.debrislightlarge2 = trap_R_RegisterModel( "models/debris/concrete_b2_large.md3" ); cgs.media.debrislightlarge3 = trap_R_RegisterModel( "models/debris/concrete_b3_large.md3" ); cgs.media.debrisdarklarge1 = trap_R_RegisterModel( "models/debris/wood_b1.md3" ); cgs.media.debrisdarklarge2 = trap_R_RegisterModel( "models/debris/wood_b1.md3" ); cgs.media.debrisdarklarge3 = trap_R_RegisterModel( "models/debris/wood_b1.md3" ); cgs.media.debriswood1 = trap_R_RegisterModel( "models/debris/wood_b1.md3" ); cgs.media.debriswood2 = trap_R_RegisterModel( "models/debris/wood_b2.md3" ); cgs.media.debriswood3 = trap_R_RegisterModel( "models/debris/wood_b3.md3" ); cgs.media.debriswood4 = trap_R_RegisterModel( "models/debris/wood_b4.md3" ); cgs.media.debriswood5 = trap_R_RegisterModel( "models/debris/wood_b5.md3" ); cgs.media.debrisglass1 = trap_R_RegisterModel( "models/debris/glass_1.md3" ); cgs.media.debrisglass2 = trap_R_RegisterModel( "models/debris/glass_2.md3" ); cgs.media.debrisglass3 = trap_R_RegisterModel( "models/debris/glass_3.md3" ); cgs.media.debrisglass4 = trap_R_RegisterModel( "models/debris/glass_4.md3" ); cgs.media.debrisglass5 = trap_R_RegisterModel( "models/debris/glass_5.md3" ); cgs.media.debrisglasslarge1 = trap_R_RegisterModel( "models/debris/glass_1_large.md3" ); cgs.media.debrisglasslarge2 = trap_R_RegisterModel( "models/debris/glass_2_large.md3" ); cgs.media.debrisglasslarge3 = trap_R_RegisterModel( "models/debris/glass_3_large.md3" ); cgs.media.debrisglasslarge4 = trap_R_RegisterModel( "models/debris/glass_4_large.md3" ); cgs.media.debrisglasslarge5 = trap_R_RegisterModel( "models/debris/glass_5_large.md3" ); cgs.media.debrisstone1 = trap_R_RegisterModel( "models/debris/stone_1.md3" ); cgs.media.debrisstone2 = trap_R_RegisterModel( "models/debris/stone_2.md3" ); cgs.media.debrisstone3 = trap_R_RegisterModel( "models/debris/stone_3.md3" ); cgs.media.debrisstone4 = trap_R_RegisterModel( "models/debris/stone_4.md3" ); cgs.media.debrisstone5 = trap_R_RegisterModel( "models/debris/stone_5.md3" ); cgs.media.sparkShader = trap_R_RegisterShaderNoMip("spark"); cgs.media.smoke2 = trap_R_RegisterModel( "models/weapons2/shells/s_shell.md3" ); cgs.media.balloonShader = trap_R_RegisterShader( "sprites/balloon3" ); cgs.media.bloodExplosionShader = trap_R_RegisterShader( "bloodExplosion" ); cgs.media.bulletFlashModel = trap_R_RegisterModel("models/weaphits/bullet.md3"); cgs.media.ringFlashModel = trap_R_RegisterModel("models/weaphits/ring02.md3"); cgs.media.dishFlashModel = trap_R_RegisterModel("models/weaphits/boom01.md3"); cgs.media.teleportEffectModel = trap_R_RegisterModel( "models/misc/telep.md3" ); cgs.media.teleportEffectShader = trap_R_RegisterShader( "teleportEffect" ); cgs.media.invulnerabilityPowerupModel = trap_R_RegisterModel( "models/powerups/shield/shield.md3" ); cgs.media.medalImpressive = trap_R_RegisterShaderNoMip( "medal_impressive" ); cgs.media.medalExcellent = trap_R_RegisterShaderNoMip( "medal_excellent" ); cgs.media.medalGauntlet = trap_R_RegisterShaderNoMip( "medal_gauntlet" ); cgs.media.medalDefend = trap_R_RegisterShaderNoMip( "medal_defend" ); cgs.media.medalAssist = trap_R_RegisterShaderNoMip( "medal_assist" ); cgs.media.medalCapture = trap_R_RegisterShaderNoMip( "medal_capture" ); memset( cg_items, 0, sizeof( cg_items ) ); memset( cg_weapons, 0, sizeof( cg_weapons ) ); // only register the items that the server says we need strcpy( items, CG_ConfigString( CS_ITEMS) ); for ( i = 1 ; i < bg_numItems ; i++ ) { if ( items[ i ] == '1' || cg_buildScript.integer ) { CG_LoadingItem( i ); CG_RegisterItemVisuals( i ); } } // wall marks cgs.media.bulletMarkShader = trap_R_RegisterShader( "gfx/damage/bullet_mrk" ); cgs.media.burnMarkShader = trap_R_RegisterShader( "gfx/damage/burn_med_mrk" ); cgs.media.holeMarkShader = trap_R_RegisterShader( "gfx/damage/hole_lg_mrk" ); cgs.media.energyMarkShader = trap_R_RegisterShader( "gfx/damage/plasma_mrk" ); cgs.media.shadowMarkShader = trap_R_RegisterShader( "markShadow" ); cgs.media.wakeMarkShader = trap_R_RegisterShader( "wake" ); cgs.media.bloodMarkShader = trap_R_RegisterShader( "bloodMark" ); // paintball mode marks cgs.media.bulletMarkPaintShader = trap_R_RegisterShader( "gfx/damage/bullet_mrk_paint" ); cgs.media.burnMarkPaintShader = trap_R_RegisterShader( "gfx/damage/burn_med_mrk_paint" ); cgs.media.holeMarkPaintShader = trap_R_RegisterShader( "gfx/damage/hole_lg_mrk_paint" ); cgs.media.energyMarkPaintShader = trap_R_RegisterShader( "gfx/damage/plasma_mrk_paint" ); // register the inline models cgs.numInlineModels = trap_CM_NumInlineModels(); for ( i = 1 ; i < cgs.numInlineModels ; i++ ) { char name[10]; vec3_t mins, maxs; int j; Com_sprintf( name, sizeof(name), "*%i", i ); cgs.inlineDrawModel[i] = trap_R_RegisterModel( name ); trap_R_ModelBounds( cgs.inlineDrawModel[i], mins, maxs ); for ( j = 0 ; j < 3 ; j++ ) { cgs.inlineModelMidpoints[i][j] = mins[j] + 0.5 * ( maxs[j] - mins[j] ); } } // register all the server specified models for (i=1 ; i<MAX_MODELS ; i++) { const char *modelName; modelName = CG_ConfigString( CS_MODELS+i ); if ( !modelName[0] ) { break; } cgs.gameModels[i] = trap_R_RegisterModel( modelName ); } CG_ClearParticles (); /* for (i=1; i<MAX_PARTICLES_AREAS; i++) { { int rval; rval = CG_NewParticleArea ( CS_PARTICLES + i); if (!rval) break; } } */ }
/* ================= CG_RegisterWeapon The server says this item is used on this level ================= */ void CG_RegisterWeapon( int weaponNum, int variation ) { weaponInfo_t *weaponInfo; const weaponData_t *weaponData; gitem_t *item/*, *ammo*/; char path[MAX_QPATH]; vec3_t mins, maxs; int i; if ( weaponNum == 0 ) { return; } weaponInfo = CG_WeaponInfoUnsafe (weaponNum, variation); if ( weaponInfo ) { // Non-null means the weapon exists. return; } weaponInfo = CG_NextFreeWeaponInfo(); if ( weaponInfo == NULL ) { trap->Error( ERR_DROP, "Max weapon info slots exceeded.\n" ); return; } #ifdef _DEBUG //trap->Print ("Registering weapon %d variation %d\n", weaponNum, variation); #endif memset( weaponInfo, 0, sizeof( *weaponInfo ) ); weaponInfo->registered = qtrue; weaponInfo->weaponNum = weaponNum; weaponInfo->variation = variation; for ( item = bg_itemlist + 1 ; item->classname ; item++ ) { if ( item->giType == IT_WEAPON && item->giTag == weaponNum ) { weaponInfo->item = item; break; } } if ( !item->classname ) { trap->Error( ERR_DROP, "Couldn't find weapon %i", weaponNum ); } CG_RegisterItemVisuals( item - bg_itemlist ); weaponData = GetWeaponData (weaponNum, variation); // load cmodel before model so filecache works if (weaponData->visuals.world_model[0] != '\0') { // Don't spam the console. weaponInfo->weaponModel = trap->R_RegisterModel(weaponData->visuals.world_model); } // load in-view model also weaponInfo->viewModel = NULL_HANDLE; if ( weaponInfo->g2ViewModel ) { trap->G2API_CleanGhoul2Models (&weaponInfo->g2ViewModel); weaponInfo->g2ViewModel = NULL; } if ( CG_IsGhoul2Model (weaponData->visuals.view_model) ) { CG_LoadViewWeapon (weaponInfo, weaponData->visuals.view_model); } else if (weaponData->visuals.view_model[0] != '\0') { weaponInfo->viewModel = trap->R_RegisterModel(weaponData->visuals.view_model); } // calc midpoint for rotation if (weaponInfo->weaponModel != NULL_HANDLE) { 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->hudIcon = trap->R_RegisterShaderNoMip (weaponData->visuals.icon); weaponInfo->hudNAIcon = trap->R_RegisterShaderNoMip (weaponData->visuals.icon_na); if (weaponNum != WP_SABER) { strcpy( path, weaponData->visuals.view_model ); COM_StripExtension( path, path, sizeof( path ) ); strcat( path, "_hand.md3" ); weaponInfo->handsModel = trap->R_RegisterModel( path ); } else { weaponInfo->handsModel = 0; } for(i = 0; i < weaponData->numFiringModes; i++) { // this only deals with them one at a time from now on --eez JKG_SetWeaponEventsHandler (weaponInfo, weaponData->visuals.visualFireModes[i].type, i); } JKG_LoadWeaponAssets (weaponInfo, weaponData); switch ( weaponNum ) { case WP_STUN_BATON: case WP_MELEE: 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" ); } 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_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; } }