#include "g_local.h"
Include dependency graph for g_trigger.c:

Go to the source code of this file.
|
|
Definition at line 160 of file g_trigger.c. References entityShared_t::absmax, entityShared_t::absmin, G_FreeEntity(), g_gravity, G_PickTarget(), gentity_t, height, entityState_s::origin, entityState_s::origin2, gentity_s::r, gentity_s::s, sqrt(), gentity_s::target, time(), vmCvar_t::value, vec3_t, VectorAdd, VectorNormalize(), VectorScale, and VectorSubtract. 00160 {
00161 gentity_t *ent;
00162 vec3_t origin;
00163 float height, gravity, time, forward;
00164 float dist;
00165
00166 VectorAdd( self->r.absmin, self->r.absmax, origin );
00167 VectorScale ( origin, 0.5, origin );
00168
00169 ent = G_PickTarget( self->target );
00170 if ( !ent ) {
00171 G_FreeEntity( self );
00172 return;
00173 }
00174
00175 height = ent->s.origin[2] - origin[2];
00176 gravity = g_gravity.value;
00177 time = sqrt( height / ( .5 * gravity ) );
00178 if ( !time ) {
00179 G_FreeEntity( self );
00180 return;
00181 }
00182
00183 // set s.origin2 to the push velocity
00184 VectorSubtract ( ent->s.origin, origin, self->s.origin2 );
00185 self->s.origin2[2] = 0;
00186 dist = VectorNormalize( self->s.origin2);
00187
00188 forward = dist / time;
00189 VectorScale( self->s.origin2, forward, self->s.origin2 );
00190
00191 self->s.origin2[2] = time * gravity;
00192 }
|
Here is the call graph for this function:

|
|
Definition at line 426 of file g_trigger.c. References gentity_s::activator, crandom, G_UseTargets(), gentity_t, level, and level_locals_t::time. Referenced by func_timer_use(). 00426 {
00427 G_UseTargets (self, self->activator);
00428 // set time before next firing
00429 self->nextthink = level.time + 1000 * ( self->wait + crandom() * self->random );
00430 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 432 of file g_trigger.c. References func_timer_think(), gentity_t, and gentity_s::nextthink. 00432 {
00433 self->activator = activator;
00434
00435 // if on, turn it off
00436 if ( self->nextthink ) {
00437 self->nextthink = 0;
00438 return;
00439 }
00440
00441 // turn it on
00442 func_timer_think (self);
00443 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 354 of file g_trigger.c. References CHAN_AUTO, gentity_s::damage, G_Damage(), G_Sound(), gentity_t, level, MOD_TRIGGER_HURT, gentity_s::noise_index, NULL, gentity_s::takedamage, and level_locals_t::time. 00354 {
00355 int dflags;
00356
00357 if ( !other->takedamage ) {
00358 return;
00359 }
00360
00361 if ( self->timestamp > level.time ) {
00362 return;
00363 }
00364
00365 if ( self->spawnflags & 16 ) {
00366 self->timestamp = level.time + 1000;
00367 } else {
00368 self->timestamp = level.time + FRAMETIME;
00369 }
00370
00371 // play sound
00372 if ( !(self->spawnflags & 4) ) {
00373 G_Sound( other, CHAN_AUTO, self->noise_index );
00374 }
00375
00376 if (self->spawnflags & 8)
00377 dflags = DAMAGE_NO_PROTECTION;
00378 else
00379 dflags = 0;
00380 G_Damage (other, self, self, NULL, NULL, self->damage, dflags, MOD_TRIGGER_HURT);
00381 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 346 of file g_trigger.c. References gentity_t, trap_LinkEntity(), and trap_UnlinkEntity(). 00346 {
00347 if ( self->r.linked ) {
00348 trap_UnlinkEntity( self );
00349 } else {
00350 trap_LinkEntity( self );
00351 }
00352 }
|
Here is the call graph for this function:

|
|
Definition at line 26 of file g_trigger.c. References entityState_s::angles, G_SetMovedir(), gentity_t, gentity_s::model, gentity_s::movedir, gentity_s::s, trap_SetBrushModel(), vec3_origin, and VectorCompare(). Referenced by SP_trigger_hurt(), SP_trigger_multiple(), SP_trigger_push(), and SP_trigger_teleport(). 00026 {
00027 if (!VectorCompare (self->s.angles, vec3_origin))
00028 G_SetMovedir (self->s.angles, self->movedir);
00029
00030 trap_SetBrushModel( self, self->model );
00031 self->r.contents = CONTENTS_TRIGGER; // replaces the -1 from trap_SetBrushModel
00032 self->r.svFlags = SVF_NOCLIENT;
00033 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 45 of file g_trigger.c. References gentity_s::activator, gentity_s::client, crandom, G_UseTargets(), gentity_t, level, gentity_s::nextthink, gentity_s::random, gclient_s::sess, clientSession_t::sessionTeam, gentity_s::spawnflags, gentity_s::think, level_locals_t::time, gentity_s::touch, and gentity_s::wait. Referenced by Touch_Multi(), and Use_Multi(). 00045 {
00046 ent->activator = activator;
00047 if ( ent->nextthink ) {
00048 return; // can't retrigger until the wait is over
00049 }
00050
00051 if ( activator->client ) {
00052 if ( ( ent->spawnflags & 1 ) &&
00053 activator->client->sess.sessionTeam != TEAM_RED ) {
00054 return;
00055 }
00056 if ( ( ent->spawnflags & 2 ) &&
00057 activator->client->sess.sessionTeam != TEAM_BLUE ) {
00058 return;
00059 }
00060 }
00061
00062 G_UseTargets (ent, ent->activator);
00063
00064 if ( ent->wait > 0 ) {
00065 ent->think = multi_wait;
00066 ent->nextthink = level.time + ( ent->wait + ent->random * crandom() ) * 1000;
00067 } else {
00068 // we can't just remove (self) here, because this is a touch function
00069 // called while looping through area links...
00070 ent->touch = 0;
00071 ent->nextthink = level.time + FRAMETIME;
00072 ent->think = G_FreeEntity;
00073 }
00074 }
|
Here is the call graph for this function:

|
|
Definition at line 37 of file g_trigger.c. References gentity_t, and gentity_s::nextthink. 00037 {
00038 ent->nextthink = 0;
00039 }
|
|
|
Definition at line 445 of file g_trigger.c. References G_Printf(), G_SpawnFloat(), gentity_t, level, gentity_s::nextthink, entityState_s::origin, gentity_s::random, gentity_s::s, gentity_s::think, level_locals_t::time, gentity_s::use, vtos(), and gentity_s::wait. 00445 {
00446 G_SpawnFloat( "random", "1", &self->random);
00447 G_SpawnFloat( "wait", "1", &self->wait );
00448
00449 self->use = func_timer_use;
00450 self->think = func_timer_think;
00451
00452 if ( self->random >= self->wait ) {
00453 self->random = self->wait - FRAMETIME;
00454 G_Printf( "func_timer at %s has random >= wait\n", vtos( self->s.origin ) );
00455 }
00456
00457 if ( self->spawnflags & 1 ) {
00458 self->nextthink = level.time + FRAMETIME;
00459 self->activator = self;
00460 }
00461
00462 self->r.svFlags = SVF_NOCLIENT;
00463 }
|
Here is the call graph for this function:

|
|
Definition at line 242 of file g_trigger.c. References entityShared_t::absmax, entityShared_t::absmin, entityState_s::angles, G_SetMovedir(), G_SoundIndex(), gentity_t, level, entityState_s::origin, entityState_s::origin2, gentity_s::r, gentity_s::s, gentity_s::speed, level_locals_t::time, VectorCopy, and VectorScale. 00242 {
00243 if (!self->speed) {
00244 self->speed = 1000;
00245 }
00246 G_SetMovedir (self->s.angles, self->s.origin2);
00247 VectorScale (self->s.origin2, self->speed, self->s.origin2);
00248
00249 if ( self->spawnflags & 1 ) {
00250 self->noise_index = G_SoundIndex("sound/world/jumppad.wav");
00251 } else {
00252 self->noise_index = G_SoundIndex("sound/misc/windfly.wav");
00253 }
00254 if ( self->target ) {
00255 VectorCopy( self->s.origin, self->r.absmin );
00256 VectorCopy( self->s.origin, self->r.absmax );
00257 self->think = AimAtTarget;
00258 self->nextthink = level.time + FRAMETIME;
00259 }
00260 self->use = Use_target_push;
00261 }
|
Here is the call graph for this function:

|
|
Definition at line 128 of file g_trigger.c. References gentity_t, level, gentity_s::nextthink, gentity_s::think, and level_locals_t::time. 00128 {
00129 // we must have some delay to make sure our use targets are present
00130 ent->nextthink = level.time + 300;
00131 ent->think = trigger_always_think;
00132 }
|
|
|
Definition at line 383 of file g_trigger.c. References G_SoundIndex(), gentity_t, InitTrigger(), and trap_LinkEntity(). 00383 {
00384 InitTrigger (self);
00385
00386 self->noise_index = G_SoundIndex( "sound/world/electro.wav" );
00387 self->touch = hurt_touch;
00388
00389 if ( !self->damage ) {
00390 self->damage = 5;
00391 }
00392
00393 self->r.contents = CONTENTS_TRIGGER;
00394
00395 if ( self->spawnflags & 2 ) {
00396 self->use = hurt_use;
00397 }
00398
00399 // link in to the world if starting active
00400 if ( ! (self->spawnflags & 1) ) {
00401 trap_LinkEntity (self);
00402 }
00403 }
|
Here is the call graph for this function:

|
|
Definition at line 94 of file g_trigger.c. References G_Printf(), G_SpawnFloat(), gentity_t, InitTrigger(), gentity_s::random, gentity_s::touch, trap_LinkEntity(), gentity_s::use, and gentity_s::wait. 00094 {
00095 G_SpawnFloat( "wait", "0.5", &ent->wait );
00096 G_SpawnFloat( "random", "0", &ent->random );
00097
00098 if ( ent->random >= ent->wait && ent->wait >= 0 ) {
00099 ent->random = ent->wait - FRAMETIME;
00100 G_Printf( "trigger_multiple has random >= wait\n" );
00101 }
00102
00103 ent->touch = Touch_Multi;
00104 ent->use = Use_Multi;
00105
00106 InitTrigger( ent );
00107 trap_LinkEntity (ent);
00108 }
|
Here is the call graph for this function:

|
|
Definition at line 199 of file g_trigger.c. References G_SoundIndex(), gentity_t, InitTrigger(), level, level_locals_t::time, and trap_LinkEntity(). 00199 {
00200 InitTrigger (self);
00201
00202 // unlike other triggers, we need to send this one to the client
00203 self->r.svFlags &= ~SVF_NOCLIENT;
00204
00205 // make sure the client precaches this sound
00206 G_SoundIndex("sound/world/jumppad.wav");
00207
00208 self->s.eType = ET_PUSH_TRIGGER;
00209 self->touch = trigger_push_touch;
00210 self->think = AimAtTarget;
00211 self->nextthink = level.time + FRAMETIME;
00212 trap_LinkEntity (self);
00213 }
|
Here is the call graph for this function:

|
|
Definition at line 305 of file g_trigger.c. References entityState_s::eType, G_SoundIndex(), gentity_t, InitTrigger(), gentity_s::r, entityShared_t::s, entityShared_t::svFlags, and trap_LinkEntity(). 00305 {
00306 InitTrigger (self);
00307
00308 // unlike other triggers, we need to send this one to the client
00309 // unless is a spectator trigger
00310 if ( self->spawnflags & 1 ) {
00311 self->r.svFlags |= SVF_NOCLIENT;
00312 } else {
00313 self->r.svFlags &= ~SVF_NOCLIENT;
00314 }
00315
00316 // make sure the client precaches this sound
00317 G_SoundIndex("sound/world/jumppad.wav");
00318
00319 self->s.eType = ET_TELEPORT_TRIGGER;
00320 self->touch = trigger_teleporter_touch;
00321
00322 trap_LinkEntity (self);
00323 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 80 of file g_trigger.c. References gentity_s::client, gentity_t, and multi_trigger(). 00080 {
00081 if( !other->client ) {
00082 return;
00083 }
00084 multi_trigger( self, other );
00085 }
|
Here is the call graph for this function:

|
|
Definition at line 120 of file g_trigger.c. References G_FreeEntity(), G_UseTargets(), and gentity_t. 00120 {
00121 G_UseTargets(ent, ent);
00122 G_FreeEntity( ent );
00123 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 143 of file g_trigger.c. References BG_TouchJumpPad(), gentity_s::client, gentity_t, gclient_s::ps, and gentity_s::s. 00143 {
00144
00145 if ( !other->client ) {
00146 return;
00147 }
00148
00149 BG_TouchJumpPad( &other->client->ps, &self->s );
00150 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 271 of file g_trigger.c. References entityState_s::angles, gentity_s::client, G_PickTarget(), G_Printf(), gentity_t, entityState_s::origin, playerState_s::pm_type, gclient_s::ps, gentity_s::s, gclient_s::sess, clientSession_t::sessionTeam, gentity_s::target, and TeleportPlayer(). 00271 {
00272 gentity_t *dest;
00273
00274 if ( !other->client ) {
00275 return;
00276 }
00277 if ( other->client->ps.pm_type == PM_DEAD ) {
00278 return;
00279 }
00280 // Spectators only?
00281 if ( ( self->spawnflags & 1 ) &&
00282 other->client->sess.sessionTeam != TEAM_SPECTATOR ) {
00283 return;
00284 }
00285
00286
00287 dest = G_PickTarget( self->target );
00288 if (!dest) {
00289 G_Printf ("Couldn't find teleporter destination\n");
00290 return;
00291 }
00292
00293 TeleportPlayer( other, dest->s.origin, dest->s.angles );
00294 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 76 of file g_trigger.c. References gentity_t, and multi_trigger(). 00076 {
00077 multi_trigger( ent, activator );
00078 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 216 of file g_trigger.c. References CHAN_AUTO, gentity_s::client, gentity_s::fly_sound_debounce_time, G_Sound(), gentity_t, level, gentity_s::noise_index, entityState_s::origin2, playerState_s::pm_type, playerState_s::powerups, gclient_s::ps, gentity_s::s, level_locals_t::time, VectorCopy, and playerState_s::velocity. 00216 {
00217 if ( !activator->client ) {
00218 return;
00219 }
00220
00221 if ( activator->client->ps.pm_type != PM_NORMAL ) {
00222 return;
00223 }
00224 if ( activator->client->ps.powerups[PW_FLIGHT] ) {
00225 return;
00226 }
00227
00228 VectorCopy (self->s.origin2, activator->client->ps.velocity);
00229
00230 // play fly sound every 1.5 seconds
00231 if ( activator->fly_sound_debounce_time < level.time ) {
00232 activator->fly_sound_debounce_time = level.time + 1500;
00233 G_Sound( activator, CHAN_AUTO, self->noise_index );
00234 }
00235 }
|
Here is the call graph for this function:

1.3.9.1