/* ------------------------- NPC_Mark1_Precache ------------------------- */ void NPC_Mark1_Precache(void) { G_SoundIndex( "sound/chars/mark1/misc/mark1_wakeup"); G_SoundIndex( "sound/chars/mark1/misc/shutdown"); G_SoundIndex( "sound/chars/mark1/misc/walk"); G_SoundIndex( "sound/chars/mark1/misc/run"); G_SoundIndex( "sound/chars/mark1/misc/death1"); G_SoundIndex( "sound/chars/mark1/misc/death2"); G_SoundIndex( "sound/chars/mark1/misc/anger"); G_SoundIndex( "sound/chars/mark1/misc/mark1_fire"); G_SoundIndex( "sound/chars/mark1/misc/mark1_pain"); G_SoundIndex( "sound/chars/mark1/misc/mark1_explo"); // G_EffectIndex( "small_chunks"); G_EffectIndex( "env/med_explode2"); G_EffectIndex( "explosions/probeexplosion1"); G_EffectIndex( "blaster/smoke_bolton"); G_EffectIndex( "bryar/muzzle_flash"); G_EffectIndex( "explosions/droidexplosion1" ); RegisterItem( FindItemForAmmo( AMMO_METAL_BOLTS)); RegisterItem( FindItemForAmmo( AMMO_BLASTER )); RegisterItem( FindItemForWeapon( WP_BOWCASTER )); RegisterItem( FindItemForWeapon( WP_BRYAR_PISTOL )); }
//--------------------------------------------- void SP_misc_model_ammo_rack( gentity_t *ent ) { // If BLASTER is checked...or nothing is checked then we'll do blasters if (( ent->spawnflags & RACK_BLASTER ) || !(ent->spawnflags & ( RACK_BLASTER | RACK_METAL_BOLTS | RACK_ROCKETS | RACK_PWR_CELL ))) { if ( ent->spawnflags & RACK_WEAPONS ) { RegisterItem( FindItemForWeapon( WP_BLASTER )); } RegisterItem( FindItemForAmmo( AMMO_BLASTER )); } if (( ent->spawnflags & RACK_METAL_BOLTS )) { if ( ent->spawnflags & RACK_WEAPONS ) { RegisterItem( FindItemForWeapon( WP_REPEATER )); } RegisterItem( FindItemForAmmo( AMMO_METAL_BOLTS )); } if (( ent->spawnflags & RACK_ROCKETS )) { if ( ent->spawnflags & RACK_WEAPONS ) { RegisterItem( FindItemForWeapon( WP_ROCKET_LAUNCHER )); } RegisterItem( FindItemForAmmo( AMMO_ROCKETS )); } if (( ent->spawnflags & RACK_PWR_CELL )) { RegisterItem( FindItemForAmmo( AMMO_POWERCELL )); } if (( ent->spawnflags & RACK_HEALTH )) { RegisterItem( FindItem( "item_medpak_instant" )); } ent->e_ThinkFunc = thinkF_spawn_rack_goods; ent->nextthink = level.time + 100; G_SetOrigin( ent, ent->s.origin ); G_SetAngles( ent, ent->s.angles ); ent->contents = CONTENTS_SHOTCLIP|CONTENTS_PLAYERCLIP|CONTENTS_MONSTERCLIP|CONTENTS_BOTCLIP;//CONTENTS_SOLID;//so use traces can go through them gi.linkentity( ent ); }
void NPC_Mark2_Precache( void ) { G_SoundIndex( "sound/chars/mark2/misc/mark2_explo" );// blows up on death G_SoundIndex( "sound/chars/mark2/misc/mark2_pain" ); G_SoundIndex( "sound/chars/mark2/misc/mark2_fire" ); G_SoundIndex( "sound/chars/mark2/misc/mark2_move_lp" ); G_EffectIndex( "droidexplosion1" ); G_EffectIndex( "env/med_explode2" ); G_EffectIndex( "blaster/smoke_bolton" ); G_EffectIndex( "bryar/muzzle_flash" ); RegisterItem( FindItemForWeapon( WP_BRYAR_PISTOL )); RegisterItem( FindItemForAmmo( AMMO_METAL_BOLTS)); RegisterItem( FindItemForAmmo( AMMO_POWERCELL )); RegisterItem( FindItemForAmmo( AMMO_BLASTER )); }
void NPC_Probe_Precache(void) { for ( int i = 1; i < 4; i++) { G_SoundIndex( va( "sound/chars/probe/misc/probetalk%d", i ) ); } G_SoundIndex( "sound/chars/probe/misc/probedroidloop" ); G_SoundIndex("sound/chars/probe/misc/anger1"); G_SoundIndex("sound/chars/probe/misc/fire"); G_EffectIndex( "chunks/probehead" ); G_EffectIndex( "env/med_explode2" ); G_EffectIndex( "explosions/probeexplosion1"); G_EffectIndex( "bryar/muzzle_flash" ); RegisterItem( FindItemForAmmo( AMMO_BLASTER )); RegisterItem( FindItemForWeapon( WP_BRYAR_PISTOL ) ); }
/* ------------------------- NPC_Sentry_Precache ------------------------- */ void NPC_Sentry_Precache(void) { G_SoundIndex( "sound/chars/sentry/misc/sentry_explo" ); G_SoundIndex( "sound/chars/sentry/misc/sentry_pain" ); G_SoundIndex( "sound/chars/sentry/misc/sentry_shield_open" ); G_SoundIndex( "sound/chars/sentry/misc/sentry_shield_close" ); G_SoundIndex( "sound/chars/sentry/misc/sentry_hover_1_lp" ); G_SoundIndex( "sound/chars/sentry/misc/sentry_hover_2_lp" ); for ( int i = 1; i < 4; i++) { G_SoundIndex( va( "sound/chars/sentry/misc/talk%d", i ) ); } G_EffectIndex( "bryar/muzzle_flash"); G_EffectIndex( "env/med_explode"); RegisterItem( FindItemForAmmo( AMMO_BLASTER )); }
// AMMO RACK!! void spawn_rack_goods( gentity_t *ent ) { float v_off = 0; gitem_t *blaster = NULL, *metal_bolts = NULL, *rockets = NULL, *it = NULL; gitem_t *am_blaster = NULL, *am_metal_bolts = NULL, *am_rockets = NULL, *am_pwr_cell = NULL; gitem_t *health = NULL; int pos = 0, ct = 0; gitem_t *itemList[4]; // allocating 4, but we only use 3. done so I don't have to validate that the array isn't full before I add another gi.unlinkentity( ent ); // If BLASTER is checked...or nothing is checked then we'll do blasters if (( ent->spawnflags & RACK_BLASTER ) || !(ent->spawnflags & ( RACK_BLASTER | RACK_METAL_BOLTS | RACK_ROCKETS | RACK_PWR_CELL ))) { if ( ent->spawnflags & RACK_WEAPONS ) { blaster = FindItemForWeapon( WP_BLASTER ); } am_blaster = FindItemForAmmo( AMMO_BLASTER ); } if (( ent->spawnflags & RACK_METAL_BOLTS )) { if ( ent->spawnflags & RACK_WEAPONS ) { metal_bolts = FindItemForWeapon( WP_REPEATER ); } am_metal_bolts = FindItemForAmmo( AMMO_METAL_BOLTS ); } if (( ent->spawnflags & RACK_ROCKETS )) { if ( ent->spawnflags & RACK_WEAPONS ) { rockets = FindItemForWeapon( WP_ROCKET_LAUNCHER ); } am_rockets = FindItemForAmmo( AMMO_ROCKETS ); } if (( ent->spawnflags & RACK_PWR_CELL )) { am_pwr_cell = FindItemForAmmo( AMMO_POWERCELL ); } if (( ent->spawnflags & RACK_HEALTH )) { health = FindItem( "item_medpak_instant" ); RegisterItem( health ); } //---------Ammo types if ( am_blaster ) { itemList[ct++] = am_blaster; } if ( am_metal_bolts ) { itemList[ct++] = am_metal_bolts; } if ( am_pwr_cell ) { itemList[ct++] = am_pwr_cell; } if ( am_rockets ) { itemList[ct++] = am_rockets; } if ( !(ent->spawnflags & RACK_NO_FILL) && ct ) //double negative..should always have at least one item on there, but just being safe { for ( ; ct < 3 ; ct++ ) { itemList[ct] = itemList[0]; // first item ALWAYS propagates to fill up the shelf } } // now actually add the items to the shelf...validate that we have a list to add if ( ct ) { for ( int i = 0; i < ct; i++ ) { GunRackAddItem( itemList[i], ent->s.origin, ent->s.angles, crandom() * 0.5f, (i-1)* 8, 7.0f ); } } // -----Weapon option if ( ent->spawnflags & RACK_WEAPONS ) { if ( !(ent->spawnflags & ( RACK_BLASTER | RACK_METAL_BOLTS | RACK_ROCKETS | RACK_PWR_CELL ))) { // nothing was selected, so we assume blaster pack it = blaster; } else { // if weapon is checked...and so are one or more ammo types, then pick a random weapon to display..always give weaker weapons first if ( blaster ) { it = blaster; v_off = 25.5f; } else if ( metal_bolts ) { it = metal_bolts; v_off = 27.0f; } else if ( rockets ) { it = rockets; v_off = 28.0f; } } if ( it ) { // since we may have to put up a health pack on the shelf, we should know where we randomly put // the gun so we don't put the pack on the same spot..so pick either the left or right side pos = ( random() > .5 ) ? -1 : 1; GunRackAddItem( it, ent->s.origin, ent->s.angles, crandom() * 2, ( random() * 6 + 4 ) * pos, v_off ); } } // ------Medpack if (( ent->spawnflags & RACK_HEALTH ) && health ) { if ( !pos ) { // we haven't picked a side already... pos = ( random() > .5 ) ? -1 : 1; } else { // switch to the opposite side pos *= -1; } GunRackAddItem( health, ent->s.origin, ent->s.angles, crandom() * 0.5f, ( random() * 4 + 4 ) * pos, 24 ); } ent->s.modelindex = G_ModelIndex( "models/map_objects/kejim/weaponsrung.md3" ); G_SetOrigin( ent, ent->s.origin ); G_SetAngles( ent, ent->s.angles ); gi.linkentity( ent ); }