void SP_trigger_teleport( edict_t *ent ) { if( !ent->target ) { if( developer->integer ) G_Printf( "teleporter without a target.\n" ); G_FreeEdict( ent ); return; } if( st.noise ) { ent->noise_index = trap_SoundIndex( st.noise ); G_PureSound( st.noise ); } // gameteam field from editor if( st.gameteam >= TEAM_SPECTATOR && st.gameteam < GS_MAX_TEAMS ) { ent->s.team = st.gameteam; } else { ent->s.team = TEAM_SPECTATOR; } InitTrigger( ent ); ent->touch = old_teleporter_touch; }
void SP_trigger_push( edict_t *self ) { InitTrigger( self ); if( st.noise && Q_stricmp( st.noise, "default" ) ) { if( Q_stricmp( st.noise, "silent" ) ) { self->moveinfo.sound_start = trap_SoundIndex( st.noise ); G_PureSound( st.noise ); } } else self->moveinfo.sound_start = trap_SoundIndex( S_JUMPPAD ); // gameteam field from editor if( st.gameteam >= TEAM_SPECTATOR && st.gameteam < GS_MAX_TEAMS ) self->s.team = st.gameteam; else self->s.team = TEAM_SPECTATOR; self->touch = trigger_push_touch; self->think = trigger_push_setup; self->nextThink = level.time + 1; self->r.svflags &= ~SVF_NOCLIENT; self->s.type = ET_PUSH_TRIGGER; self->r.svflags |= SVF_TRANSMITORIGIN2; GClip_LinkEntity( self ); // ET_PUSH_TRIGGER gets exceptions at linking so it's added for prediction self->timeStamp = level.time; if( !self->wait ) self->wait = MIN_TRIGGER_PUSH_REBOUNCE_TIME * 0.001f; }
void SP_trigger_hurt( edict_t *self ) { InitTrigger( self ); if( self->dmg > 300 ) // HACK: force KILL spawnflag for big damages self->spawnflags |= 32; if( self->spawnflags & 4 ) // SILENT { self->noise_index = 0; } else if( st.noise ) { self->noise_index = trap_SoundIndex( st.noise ); G_PureSound( st.noise ); } else if( self->spawnflags & 32 || self->spawnflags & 64 ) // KILL or FALL { self->noise_index = trap_SoundIndex( S_PLAYER_FALLDEATH ); } else { self->noise_index = 0; } // gameteam field from editor if( st.gameteam >= TEAM_SPECTATOR && st.gameteam < GS_MAX_TEAMS ) { self->s.team = st.gameteam; } else { self->s.team = TEAM_SPECTATOR; } self->touch = hurt_touch; if( !self->dmg ) self->dmg = 5; if( self->spawnflags & 16 || !self->wait ) self->wait = 0.1f; if( self->spawnflags & 1 ) self->r.solid = SOLID_NOT; else self->r.solid = SOLID_TRIGGER; if( self->spawnflags & 2 ) self->use = hurt_use; }
void SP_target_speaker( edict_t *ent ) { char buffer[MAX_QPATH]; if( !st.noise ) { if( developer->integer ) G_Printf( "target_speaker with no noise set at %s\n", vtos( ent->s.origin ) ); return; } Q_strncpyz( buffer, st.noise, sizeof( buffer ) ); ent->noise_index = trap_SoundIndex( buffer ); G_PureSound( buffer ); if( ent->attenuation == -1 || ent->spawnflags & 4 ) // use -1 so 0 defaults to ATTN_NONE ent->attenuation = ATTN_NONE; else if( !ent->attenuation ) ent->attenuation = ATTN_NORM; if( ent->attenuation == ATTN_NONE ) ent->r.svflags |= SVF_BROADCAST; if( ent->spawnflags & 16 ) ent->r.svflags |= SVF_ONLYOWNER; // check for prestarted looping sound if( ent->spawnflags & 1 ) { ent->s.sound = ent->noise_index; ent->r.svflags &= ~SVF_NOCLIENT; } ent->use = Use_Target_Speaker; // must link the entity so we get areas and clusters so // the server can determine who to send updates to GClip_LinkEntity( ent ); }
void SP_trigger_multiple( edict_t *ent ) { GClip_SetBrushModel( ent, ent->model ); G_PureModel( ent->model ); if( st.noise ) { ent->noise_index = trap_SoundIndex( st.noise ); G_PureSound( st.noise ); } // gameteam field from editor if( st.gameteam >= TEAM_SPECTATOR && st.gameteam < GS_MAX_TEAMS ) ent->s.team = st.gameteam; else ent->s.team = TEAM_SPECTATOR; if( !ent->wait ) ent->wait = 0.2f; ent->touch = Touch_Multi; ent->movetype = MOVETYPE_NONE; ent->r.svflags |= SVF_NOCLIENT; if( ent->spawnflags & 4 ) { ent->r.solid = SOLID_NOT; ent->use = trigger_enable; } else { ent->r.solid = SOLID_TRIGGER; ent->use = Use_Multi; } GClip_LinkEntity( ent ); }
//QUAKED misc_particles (.6 .7 .7) (-8 -8 -8) (8 8 8) SPHERICAL SOLID GRAVITY LIGHT EXPAND_EFFECT SHRINK_EFFECT START_OFF //-------- KEYS -------- //angles: direction in which particles will be thrown. //shader : particleShader void SP_misc_particles( edict_t *ent ) { ent->r.svflags &= ~SVF_NOCLIENT; ent->r.svflags |= SVF_BROADCAST; ent->r.solid = SOLID_NOT; ent->s.type = ET_PARTICLES; if( st.noise ) { ent->s.sound = trap_SoundIndex( st.noise ); G_PureSound( st.noise ); } if( st.gameteam >= TEAM_ALPHA && st.gameteam < GS_MAX_TEAMS ) ent->s.team = st.gameteam; else ent->s.team = 0; if( ent->speed > 0 ) ent->particlesInfo.speed = ((int)ent->speed) & 255; if( ent->count > 0 ) ent->particlesInfo.frequency = ent->count & 255; if( st.shaderName ) ent->particlesInfo.shaderIndex = trap_ImageIndex( st.shaderName ); else ent->particlesInfo.shaderIndex = trap_ImageIndex( "particle" ); if( st.size ) ent->particlesInfo.size = st.size & 255; else ent->particlesInfo.size = 16; ent->particlesInfo.time = ent->delay; if( !ent->particlesInfo.time ) ent->particlesInfo.time = 4; if( ent->spawnflags & 1 ) // SPHERICAL ent->particlesInfo.spherical = true; if( ent->spawnflags & 2 ) // BOUNCE ent->particlesInfo.bounce = true; if( ent->spawnflags & 4 ) // GRAVITY ent->particlesInfo.gravity = true; if( ent->spawnflags & 8 ) // LIGHT { ent->s.light = COLOR_RGB( (qbyte)(ent->color[0] * 255), (qbyte)(ent->color[1] * 255), (qbyte)(ent->color[2] * 255) ); if( !ent->s.light ) ent->s.light = COLOR_RGB( 255, 255, 255 ); } if( ent->spawnflags & 16 ) // EXPAND_EFFECT ent->particlesInfo.expandEffect = true; if( ent->spawnflags & 32 ) // SHRINK_EFFECT ent->particlesInfo.shrinkEffect = true; if( ent->spawnflags & 64 ) // START_OFF ent->r.svflags |= SVF_NOCLIENT; if( st.radius > 0 ) { ent->particlesInfo.spread = st.radius; clamp( ent->particlesInfo.spread, 0, 255 ); } ent->think = SP_misc_particles_finish; ent->nextThink = level.time + 1; ent->use = SP_misc_particles_use; GClip_LinkEntity( ent ); }