summaryrefslogtreecommitdiff
path: root/src/game/g_target.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2004-06-29 22:20:59 +0000
committerTim Angus <tim@ngus.net>2004-06-29 22:20:59 +0000
commit6348ee0e272b0d662ec19462ad46dfc1446e639e (patch)
tree2478cfd2b62200c0fd5606e8f8801937ac444992 /src/game/g_target.c
parentb4227be79cccc641a4dd471ff8fb367b79ac84b1 (diff)
* Added a bunch of map entities: trigger_buildable, trigger_class,
trigger_equipment, trigger_heal, trigger_ammo, triggerable func_trains, target_rumble, trigger_gravity
Diffstat (limited to 'src/game/g_target.c')
-rw-r--r--src/game/g_target.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/game/g_target.c b/src/game/g_target.c
index ee2d096f..64a3f33e 100644
--- a/src/game/g_target.c
+++ b/src/game/g_target.c
@@ -320,3 +320,73 @@ void SP_target_location( gentity_t *self )
G_SetOrigin( self, self->s.origin );
}
+
+/*
+===============
+target_rumble_think
+===============
+*/
+void target_rumble_think( gentity_t *self )
+{
+ int i;
+ gentity_t *ent;
+
+ if( self->last_move_time < level.time )
+ self->last_move_time = level.time + 0.5;
+
+ for( i = 0, ent = g_entities + i; i < level.num_entities; i++, ent++ )
+ {
+ if( !ent->inuse )
+ continue;
+
+ if( !ent->client )
+ continue;
+
+ if( ent->client->ps.groundEntityNum == ENTITYNUM_NONE )
+ continue;
+
+ ent->client->ps.groundEntityNum = ENTITYNUM_NONE;
+ ent->client->ps.velocity[ 0 ] += crandom( ) * 150;
+ ent->client->ps.velocity[ 1 ] += crandom( ) * 150;
+ ent->client->ps.velocity[ 2 ] = self->speed;
+ }
+
+ if( level.time < self->timestamp )
+ self->nextthink = level.time + FRAMETIME;
+}
+
+/*
+===============
+target_rumble_use
+===============
+*/
+void target_rumble_use( gentity_t *self, gentity_t *other, gentity_t *activator )
+{
+ self->timestamp = level.time + ( self->count * FRAMETIME );
+ self->nextthink = level.time + FRAMETIME;
+ self->activator = activator;
+ self->last_move_time = 0;
+}
+
+/*
+===============
+SP_target_rumble
+===============
+*/
+void SP_target_rumble( gentity_t *self )
+{
+ if( !self->targetname )
+ {
+ G_Printf( S_COLOR_YELLOW "WARNING: untargeted %s at %s\n", self->classname,
+ vtos( self->s.origin ) );
+ }
+
+ if( !self->count )
+ self->count = 10;
+
+ if( !self->speed )
+ self->speed = 100;
+
+ self->think = target_rumble_think;
+ self->use = target_rumble_use;
+}