/*QUAKED trigger_secret (.5 .5 .5) ? secret counter trigger sounds 1) secret 2) beep beep 3) 4) set "message" to text string */ void SP_trigger_secret( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } g_globalvars.total_secrets = g_globalvars.total_secrets + 1; self->wait = -1; if ( !self->s.v.message ) self->s.v.message = "You found a secret area!"; if ( !self->s.v.sounds ) self->s.v.sounds = 1; if ( self->s.v.sounds == 1 ) { trap_precache_sound( "misc/secret.wav" ); self->s.v.noise = "misc/secret.wav"; } else if ( self->s.v.sounds == 2 ) { trap_precache_sound( "misc/talk.wav" ); self->s.v.noise = "misc/talk.wav"; } SP_trigger_multiple( ); }
void SP_trap_spikeshooter() { SetMovedir(); self->use = ( func_t ) spikeshooter_use; if ( ( int ) ( self->s.v.spawnflags ) & SPAWNFLAG_LASER ) { trap_precache_model( "progs/laser.mdl" ); trap_precache_sound( "enforcer/enfire.wav" ); trap_precache_sound( "enforcer/enfstop.wav" ); } else trap_precache_sound( "weapons/spike2.wav" ); }
/*QUAKED trigger_teleport (.5 .5 .5) ? PLAYER_ONLY SILENT Any object touching this will be transported to the corresponding info_teleport_destination entity. You must set the "target" field, and create an object with a "targetname" field that matches. If the trigger_teleport has a targetname, it will only teleport entities when it has been fired. */ void SP_trigger_teleport( ) { vec3_t o; if ( !CheckExistence( ) ) { dremove( self ); return; } InitTrigger( ); self->s.v.touch = ( func_t ) teleport_touch; // find the destination if ( !self->s.v.target ) G_Error( "no target" ); self->s.v.use = ( func_t ) teleport_use; if ( !( ( int ) ( self->s.v.spawnflags ) & SILENT ) ) { trap_precache_sound( "ambience/hum1.wav" ); VectorAdd( self->s.v.mins, self->s.v.maxs, o ); VectorScale( o, 0.5, o ); //o = (self.mins + self.maxs)*0.5; trap_ambientsound( PASSVEC3( o ), "ambience/hum1.wav", 0.5, ATTN_STATIC ); } }
void FireAmbient() { trap_precache_sound( "ambience/fire1.wav" ); // attenuate fast trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/fire1.wav", 0.5, ATTN_STATIC ); }
void SP_misc_noisemaker() { trap_precache_sound( "enforcer/enfire.wav" ); trap_precache_sound( "enforcer/enfstop.wav" ); trap_precache_sound( "enforcer/sight1.wav" ); trap_precache_sound( "enforcer/sight2.wav" ); trap_precache_sound( "enforcer/sight3.wav" ); trap_precache_sound( "enforcer/sight4.wav" ); trap_precache_sound( "enforcer/pain1.wav" ); trap_precache_sound( "enforcer/pain2.wav" ); trap_precache_sound( "enforcer/death1.wav" ); trap_precache_sound( "enforcer/idle1.wav" ); self->s.v.nextthink = g_globalvars.time + 0.1 + g_random(); self->think = ( func_t ) noise_think; }
void SP_misc_explobox2( ) { float oldz; if ( !CheckExistence( ) ) { dremove( self ); return; } self->s.v.solid = SOLID_BBOX; self->s.v.movetype = MOVETYPE_NONE; trap_precache_model( "maps/b_exbox2.bsp" ); setmodel( self, "maps/b_exbox2.bsp" ); setsize( self, 0, 0, 0, 32, 32, 32 ); trap_precache_sound( "weapons/r_exp3.wav" ); self->s.v.health = 20; self->th_die = barrel_explode; self->s.v.takedamage = DAMAGE_AIM; self->s.v.origin[2] += 2; oldz = self->s.v.origin[2]; droptofloor( self ); if ( oldz - self->s.v.origin[2] > 250 ) { G_dprintf( "item fell out of level at '%f %f %f'\n", PASSVEC3( self->s.v.origin ) ); ent_remove( self ); } }
/*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE Pushes the player */ void SP_trigger_push() { InitTrigger(); trap_precache_sound( "ambience/windfly.wav" ); self->s.v.touch = ( func_t ) trigger_push_touch; if ( !self->speed ) self->speed = 1000; }
/*QUAKED light_fluorospark (0 1 0) (-8 -8 -8) (8 8 8) Non-displayed light. Default light value is 300 Default style is 10 Makes sparking, broken fluorescent sound */ void SP_light_fluorospark() { if ( !self->style ) self->style = 10; trap_precache_sound( "ambience/buzz1.wav" ); trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/buzz1.wav", 0.5, ATTN_STATIC ); }
/*QUAKED trigger_multiple (.5 .5 .5) ? notouch Variable sized repeatable trigger. Must be targeted at one or more entities. If "health" is set, the trigger must be killed to activate each time. If "delay" is set, the trigger waits some time after activating before firing. "wait" : Seconds between triggerings. (.2 default) If notouch is set, the trigger is only fired by other entities, not by touching. NOTOUCH has been obsoleted by trigger_relay! sounds 1) secret 2) beep beep 3) large switch 4) set "message" to text string */ void SP_trigger_multiple( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } if ( self->s.v.sounds == 1 ) { trap_precache_sound( "misc/secret.wav" ); self->s.v.noise = "misc/secret.wav"; } else if ( self->s.v.sounds == 2 ) { trap_precache_sound( "misc/talk.wav" ); self->s.v.noise = "misc/talk.wav"; } else if ( self->s.v.sounds == 3 ) { trap_precache_sound( "misc/trigger1.wav" ); self->s.v.noise = "misc/trigger1.wav"; } if ( !self->wait ) self->wait = 0.2; self->s.v.use = ( func_t ) multi_use; InitTrigger( ); if ( self->s.v.health ) { if ( ( int ) ( self->s.v.spawnflags ) & SPAWNFLAG_NOTOUCH ) G_Error( "health and notouch don't make sense\n" ); self->s.v.max_health = self->s.v.health; self->th_die = multi_killed; self->s.v.takedamage = DAMAGE_YES; self->s.v.solid = SOLID_BBOX; setorigin( self, PASSVEC3( self->s.v.origin ) ); // make sure it links into the world } else { if ( !( ( int ) ( self->s.v.spawnflags ) & SPAWNFLAG_NOTOUCH ) ) { self->s.v.touch = ( func_t ) multi_touch; } } }
void SP_func_door_secret() { if ( self->s.v.sounds == 0 ) self->s.v.sounds = 3; if ( self->s.v.sounds == 1 ) { trap_precache_sound( "doors/latch2.wav" ); trap_precache_sound( "doors/winch2.wav" ); trap_precache_sound( "doors/drclos4.wav" ); self->s.v.noise1 = "doors/latch2.wav"; self->s.v.noise2 = "doors/winch2.wav"; self->s.v.noise3 = "doors/drclos4.wav"; } if ( self->s.v.sounds == 2 ) { trap_precache_sound( "doors/airdoor1.wav" ); trap_precache_sound( "doors/airdoor2.wav" ); self->s.v.noise2 = "doors/airdoor1.wav"; self->s.v.noise1 = "doors/airdoor2.wav"; self->s.v.noise3 = "doors/airdoor2.wav"; } if ( self->s.v.sounds == 3 ) { trap_precache_sound( "doors/basesec1.wav" ); trap_precache_sound( "doors/basesec2.wav" ); self->s.v.noise2 = "doors/basesec1.wav"; self->s.v.noise1 = "doors/basesec2.wav"; self->s.v.noise3 = "doors/basesec2.wav"; } if ( self->dmg == 0 ) self->dmg = 2; // Magic formula... VectorCopy( self->s.v.angles, self->mangle ); SetVector( self->s.v.angles, 0, 0, 0 ); self->s.v.solid = SOLID_BSP; self->s.v.movetype = MOVETYPE_PUSH; self->s.v.classname = "door"; setmodel( self, self->s.v.model ); setorigin( self, PASSVEC3( self->s.v.origin ) ); self->s.v.touch = ( func_t ) secret_touch; self->s.v.blocked = ( func_t ) secret_blocked; self->speed = 50; self->s.v.use = ( func_t ) fd_secret_use; if ( !self->s.v.targetname || ( int ) ( self->s.v.spawnflags ) & SECRET_YES_SHOOT ) { self->s.v.health = 10000; self->s.v.takedamage = DAMAGE_YES; self->th_pain = fd_secret_use; } VectorCopy( self->s.v.origin, self->oldorigin ); // self.oldorigin = self.origin; if ( self->wait == 0 ) self->wait = 5; // 5 seconds before closing }
/*QUAKED ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void SP_ambient_comp_hum( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } trap_precache_sound( "ambience/comp1.wav" ); trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/comp1.wav", 1, ATTN_STATIC ); }
/*QUAKED ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void SP_ambient_swamp2( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } trap_precache_sound( "ambience/swamp2.wav" ); trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/swamp2.wav", 0.5, ATTN_STATIC ); }
/*QUAKED trigger_onlyregistered (.5 .5 .5) ? Only fires if playing the registered version, otherwise prints the message */ void SP_trigger_onlyregistered( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } trap_precache_sound( "misc/talk.wav" ); InitTrigger( ); self->s.v.touch = ( func_t ) trigger_onlyregistered_touch; }
void SP_misc_noisemaker( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } trap_precache_sound( "enforcer/enfire.wav" ); trap_precache_sound( "enforcer/enfstop.wav" ); trap_precache_sound( "enforcer/sight1.wav" ); trap_precache_sound( "enforcer/sight2.wav" ); trap_precache_sound( "enforcer/sight3.wav" ); trap_precache_sound( "enforcer/sight4.wav" ); trap_precache_sound( "enforcer/pain1.wav" ); trap_precache_sound( "enforcer/pain2.wav" ); trap_precache_sound( "enforcer/death1.wav" ); trap_precache_sound( "enforcer/idle1.wav" ); self->s.v.nextthink = g_globalvars.time + 0.1 + g_random( ); self->s.v.think = ( func_t ) noise_think; }
/*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE Pushes the player */ void SP_trigger_push( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } InitTrigger( ); trap_precache_sound( "ambience/windfly.wav" ); self->s.v.touch = ( func_t ) trigger_push_touch; if ( !self->speed ) self->speed = 1000; }
/*QUAKED light_fluorospark (0 1 0) (-8 -8 -8) (8 8 8) Non-displayed light. Default light value is 300 Default style is 10 Makes sparking, broken fluorescent sound */ void SP_light_fluorospark( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } if ( !self->style ) self->style = 10; trap_precache_sound( "ambience/buzz1.wav" ); trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/buzz1.wav", 0.5, ATTN_STATIC ); }
void trigger_jumper ( ) { if ( CheckExistence ( ) == 0 ) { dremove ( self); return; } InitTrigger ( ); trap_precache_sound ( "misc/boing.wav"); self->s.v.touch = ( func_t ) trigger_jumper_touch; if ( !self->speed ) self->speed = 1000; }
/*QUAKED light_fluoro (0 1 0) (-8 -8 -8) (8 8 8) START_OFF Non-displayed light. Default light value is 300 Default style is 0 If targeted, it will toggle between on or off. Makes steady fluorescent humming sound */ void SP_light_fluoro() { if ( self->style >= 32 ) { self->use = ( func_t ) light_use; if ( ( int ) self->s.v.spawnflags & START_OFF ) trap_lightstyle( self->style, "a" ); else trap_lightstyle( self->style, "m" ); } trap_precache_sound( "ambience/fl_hum1.wav" ); trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/fl_hum1.wav", 0.5, ATTN_STATIC ); }
void SP_item_health() { self->s.v.touch = ( func_t ) health_touch; if ( ( int ) self->s.v.spawnflags & H_ROTTEN ) { trap_precache_model( "maps/b_bh10.bsp" ); trap_precache_sound( "items/r_item1.wav" ); setmodel( self, "maps/b_bh10.bsp" ); self->s.v.noise = "items/r_item1.wav"; self->healamount = 15; self->healtype = 0; } else { if ( ( int ) self->s.v.spawnflags & H_MEGA ) { trap_precache_model( "maps/b_bh100.bsp" ); trap_precache_sound( "items/r_item2.wav" ); setmodel( self, "maps/b_bh100.bsp" ); self->s.v.noise = "items/r_item2.wav"; self->healamount = 100; self->healtype = 2; } else { trap_precache_model( "maps/b_bh25.bsp" ); trap_precache_sound( "items/health1.wav" ); setmodel( self, "maps/b_bh25.bsp" ); self->s.v.noise = "items/health1.wav"; self->healamount = 25; self->healtype = 1; } } setsize( self, 0, 0, 0, 32, 32, 56 ); StartItem( self ); }
/*QUAKED ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void SP_ambient_comp_hum() { trap_precache_sound( "ambience/comp1.wav" ); trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/comp1.wav", 1, ATTN_STATIC ); }
/*QUAKED ambient_light_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void SP_ambient_light_buzz() { trap_precache_sound( "ambience/fl_hum1.wav" ); trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/fl_hum1.wav", 0.5, ATTN_STATIC ); }
/*QUAKED ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void SP_ambient_swamp2() { trap_precache_sound( "ambience/swamp2.wav" ); trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/swamp2.wav", 0.5, ATTN_STATIC ); }
/*QUAKED func_button (0 .5 .8) ? When a button is touched, it moves some distance in the direction of it's angle, triggers all of it's targets, waits some time, then returns to it's original position where it can be triggered again. "angle" determines the opening direction "target" all entities with a matching targetname will be used "speed" override the default 40 speed "wait" override the default 1 second wait (-1 = never return) "lip" override the default 4 pixel lip remaining at end of move "health" if set, the button must be killed instead of touched "sounds" 0) steam metal 1) wooden clunk 2) metallic click 3) in-out */ void SP_func_button() { float ftemp; if ( self->s.v.sounds == 0 ) { trap_precache_sound( "buttons/airbut1.wav" ); self->s.v.noise = "buttons/airbut1.wav"; } if ( self->s.v.sounds == 1 ) { trap_precache_sound( "buttons/switch21.wav" ); self->s.v.noise = "buttons/switch21.wav"; } if ( self->s.v.sounds == 2 ) { trap_precache_sound( "buttons/switch02.wav" ); self->s.v.noise = "buttons/switch02.wav"; } if ( self->s.v.sounds == 3 ) { trap_precache_sound( "buttons/switch04.wav" ); self->s.v.noise = "buttons/switch04.wav"; } SetMovedir(); self->s.v.movetype = MOVETYPE_PUSH; self->s.v.solid = SOLID_BSP; setmodel( self, self->s.v.model ); self->s.v.blocked = ( func_t ) button_blocked; self->s.v.use = ( func_t ) button_use; if ( self->s.v.health ) { self->s.v.max_health = self->s.v.health; self->th_die = button_killed; self->s.v.takedamage = DAMAGE_YES; } else self->s.v.touch = ( func_t ) button_touch; if ( !self->speed ) self->speed = 40; if ( !self->wait ) self->wait = 1; if ( !self->lip ) self->lip = 4; self->state = STATE_BOTTOM; // self->pos1 = self->s.v.origin; VectorCopy( self->s.v.origin, self->pos1 ); ftemp = ( fabs( DotProduct( self->s.v.movedir, self->s.v.size ) ) - self->lip ); self->pos2[0] = self->pos1[0] + self->s.v.movedir[0] * ftemp; self->pos2[1] = self->pos1[1] + self->s.v.movedir[1] * ftemp; self->pos2[2] = self->pos1[2] + self->s.v.movedir[2] * ftemp; }
void SP_func_door() { float tmp; if ( world->worldtype == 0 ) { trap_precache_sound( "doors/medtry.wav" ); trap_precache_sound( "doors/meduse.wav" ); self->s.v.noise3 = "doors/medtry.wav"; self->noise4 = "doors/meduse.wav"; } else if ( world->worldtype == 1 ) { trap_precache_sound( "doors/runetry.wav" ); trap_precache_sound( "doors/runeuse.wav" ); self->s.v.noise3 = "doors/runetry.wav"; self->noise4 = "doors/runeuse.wav"; } else if ( world->worldtype == 2 ) { trap_precache_sound( "doors/basetry.wav" ); trap_precache_sound( "doors/baseuse.wav" ); self->s.v.noise3 = "doors/basetry.wav"; self->noise4 = "doors/baseuse.wav"; } else { G_Printf( "no worldtype set!\n" ); } if ( self->s.v.sounds == 0 ) { trap_precache_sound( "misc/null.wav" ); trap_precache_sound( "misc/null.wav" ); self->s.v.noise1 = "misc/null.wav"; self->s.v.noise2 = "misc/null.wav"; } if ( self->s.v.sounds == 1 ) { trap_precache_sound( "doors/drclos4.wav" ); trap_precache_sound( "doors/doormv1.wav" ); self->s.v.noise1 = "doors/drclos4.wav"; self->s.v.noise2 = "doors/doormv1.wav"; } if ( self->s.v.sounds == 2 ) { trap_precache_sound( "doors/hydro1.wav" ); trap_precache_sound( "doors/hydro2.wav" ); self->s.v.noise2 = "doors/hydro1.wav"; self->s.v.noise1 = "doors/hydro2.wav"; } if ( self->s.v.sounds == 3 ) { trap_precache_sound( "doors/stndr1.wav" ); trap_precache_sound( "doors/stndr2.wav" ); self->s.v.noise2 = "doors/stndr1.wav"; self->s.v.noise1 = "doors/stndr2.wav"; } if ( self->s.v.sounds == 4 ) { trap_precache_sound( "doors/ddoor1.wav" ); trap_precache_sound( "doors/ddoor2.wav" ); self->s.v.noise1 = "doors/ddoor2.wav"; self->s.v.noise2 = "doors/ddoor1.wav"; } SetMovedir(); self->s.v.max_health = self->s.v.health; self->s.v.solid = SOLID_BSP; self->s.v.movetype = MOVETYPE_PUSH; setorigin( self, PASSVEC3( self->s.v.origin ) ); setmodel( self, self->s.v.model ); self->s.v.classname = "door"; self->s.v.blocked = ( func_t ) door_blocked; self->s.v.use = ( func_t ) door_use; if ( ( int ) ( self->s.v.spawnflags ) & DOOR_SILVER_KEY ) self->s.v.items = IT_KEY1; if ( ( int ) ( self->s.v.spawnflags ) & DOOR_GOLD_KEY ) self->s.v.items = IT_KEY2; if ( !self->speed ) self->speed = 100; if ( !self->wait ) self->wait = 3; if ( !self->lip ) self->lip = 8; if ( !self->dmg ) self->dmg = 2; VectorCopy( self->s.v.origin, self->pos1 ); // tmp = fabs( DotProduct( self->s.v.movedir, self->s.v.size ) ) - self->lip; self->pos2[0] = self->pos1[0] + self->s.v.movedir[0] * tmp; self->pos2[1] = self->pos1[1] + self->s.v.movedir[1] * tmp; self->pos2[2] = self->pos1[2] + self->s.v.movedir[2] * tmp; // DOOR_START_OPEN is to allow an entity to be lighted in the closed position // but spawn in the open position if ( ( int ) ( self->s.v.spawnflags ) & DOOR_START_OPEN ) { setorigin( self, PASSVEC3( self->pos2 ) ); VectorCopy( self->pos1, self->pos2 ); VectorCopy( self->s.v.origin, self->pos1 ); } self->state = STATE_BOTTOM; if ( self->s.v.health ) { self->s.v.takedamage = DAMAGE_YES; self->th_die = door_killed; } if ( self->s.v.items ) self->wait = -1; self->s.v.touch = ( func_t ) door_touch; // LinkDoors can't be done until all of the doors have been spawned, so // the sizes can be detected properly. self->s.v.think = ( func_t ) LinkDoors; self->s.v.nextthink = self->s.v.ltime + 0.1; }
/*QUAKED ambient_flouro_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void SP_ambient_flouro_buzz() { trap_precache_sound( "ambience/buzz1.wav" ); trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/buzz1.wav", 1, ATTN_STATIC ); }
/*QUAKED trigger_onlyregistered (.5 .5 .5) ? Only fires if playing the registered version, otherwise prints the message */ void SP_trigger_onlyregistered() { trap_precache_sound( "misc/talk.wav" ); InitTrigger(); self->s.v.touch = ( func_t ) trigger_onlyregistered_touch; }
// called by SP_worldspawn void W_Precache() { trap_precache_sound( "weapons/r_exp3.wav" ); // new rocket explosion trap_precache_sound( "weapons/rocket1i.wav" ); // spike gun trap_precache_sound( "weapons/sgun1.wav" ); trap_precache_sound( "weapons/guncock.wav" ); // player shotgun trap_precache_sound( "weapons/ric1.wav" ); // ricochet (used in c code) trap_precache_sound( "weapons/ric2.wav" ); // ricochet (used in c code) trap_precache_sound( "weapons/ric3.wav" ); // ricochet (used in c code) trap_precache_sound( "weapons/spike2.wav" ); // super spikes trap_precache_sound( "weapons/tink1.wav" ); // spikes tink (used in c code) trap_precache_sound( "weapons/grenade.wav" ); // grenade launcher trap_precache_sound( "weapons/bounce.wav" ); // grenade bounce trap_precache_sound( "weapons/shotgn2.wav" ); // super shotgun }
/*QUAKED ambient_thunder (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void SP_ambient_thunder() { trap_precache_sound( "ambience/thunder1.wav" ); trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/thunder1.wav", 0.5, ATTN_STATIC ); }
/*QUAKED ambient_suck_wind (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void SP_ambient_suck_wind() { trap_precache_sound( "ambience/suck1.wav" ); trap_ambientsound( PASSVEC3( self->s.v.origin ), "ambience/suck1.wav", 1, ATTN_STATIC ); }