From edd5fd9cf588a40cba6f115d7174ce7f5f0c43ca Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sun, 11 Jun 2006 21:39:51 +0000 Subject: * Added DONT_WAIT spawnflag to func_plat * Added wait key to misc_particle_system * Triggering a trigger_teleport now enabled/disabled it --- misc/entities.def | 12 ++++++++++-- src/game/g_misc.c | 18 ++++++++++++++++-- src/game/g_mover.c | 4 ++++ src/game/g_trigger.c | 21 ++++++++++++++++++--- 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/misc/entities.def b/misc/entities.def index 9a1da2bd..5b30405d 100644 --- a/misc/entities.def +++ b/misc/entities.def @@ -495,8 +495,8 @@ Target this entity with a misc_model to have the model attached to the entity (s //============================================================================= -/*QUAKED func_plat (0 .5 .8) ? -Rising platform the player can ride to reach higher places. Plats must always be drawn in the raised position, so they will operate and be lighted correctly but they spawn in the lowered position. The plat will stay in the raised position until the player steps off. There are no proper sounds for this entity, only beep noises. It will spawn in the game and work properly but it sounds silly (see Notes). +/*QUAKED func_plat (0 .5 .8) ? DONT_WAIT +Rising platform the player can ride to reach higher places. Plats must always be drawn in the raised position, so they will operate and be lighted correctly but they spawn in the lowered position. The plat will stay in the raised position until the player steps off. There are no proper sounds for this entity, only beep noises. It will spawn in the game and work properly but it sounds silly (see Notes). If DONT_WAIT is set then the platform will not wait for a client to leave before returning to its original position. -------- KEYS -------- speed: determines how fast the plat moves (default 150). @@ -971,6 +971,14 @@ notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes. notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode). */ +/*QUAKED trigger_teleport (.5 .5 .5) ? SPECTATOR SPAWN_DISABLED +Allows client side prediction of teleportation events. +Must point at a target_position, which will be the teleport destination. + +If spectator is set, only spectators can use this teleport +Spectator teleporters are not normally placed in the editor, but are created +automatically near doors to allow spectators to move through them +*/ diff --git a/src/game/g_misc.c b/src/game/g_misc.c index 2cd2dd05..23a46a3b 100644 --- a/src/game/g_misc.c +++ b/src/game/g_misc.c @@ -235,6 +235,14 @@ void SP_misc_portal_camera( gentity_t *ent ) ====================================================================== */ +void SP_toggle_particle_system( gentity_t *self ) +{ + //toggle EF_NODRAW + self->s.eFlags ^= EF_NODRAW; + + self->nextthink = 0; +} + /* =============== SP_use_particle_system @@ -244,8 +252,13 @@ Use function for particle_system */ void SP_use_particle_system( gentity_t *self, gentity_t *other, gentity_t *activator ) { - //toggle EF_NODRAW - self->s.eFlags ^= EF_NODRAW; + SP_toggle_particle_system( self ); + + if( self->wait > 0.0f ) + { + self->think = SP_toggle_particle_system; + self->nextthink = level.time + (int)( self->wait * 1000 ); + } } /* @@ -262,6 +275,7 @@ void SP_misc_particle_system( gentity_t *self ) G_SetOrigin( self, self->s.origin ); G_SpawnString( "psName", "", &s ); + G_SpawnFloat( "wait", "0", &self->wait ); //add the particle system to the client precache list self->s.modelindex = G_ParticleSystemIndex( s ); diff --git a/src/game/g_mover.c b/src/game/g_mover.c index 8f7de418..268a25d7 100644 --- a/src/game/g_mover.c +++ b/src/game/g_mover.c @@ -1756,6 +1756,10 @@ Don't allow decent if a living player is on it */ void Touch_Plat( gentity_t *ent, gentity_t *other, trace_t *trace ) { + // DONT_WAIT + if( ent->spawnflags & 1 ) + return; + if( !other->client || other->client->ps.stats[ STAT_HEALTH ] <= 0 ) return; diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c index a79c12fe..a9ecd1a3 100644 --- a/src/game/g_trigger.c +++ b/src/game/g_trigger.c @@ -290,6 +290,9 @@ void trigger_teleporter_touch( gentity_t *self, gentity_t *other, trace_t *trace { gentity_t *dest; + if( self->s.eFlags & EF_NODRAW ) + return; + if( !other->client ) return; @@ -313,8 +316,18 @@ void trigger_teleporter_touch( gentity_t *self, gentity_t *other, trace_t *trace TeleportPlayer( other, dest->s.origin, dest->s.angles ); } +/* +=============== +trigger_teleport_use +=============== +*/ +void trigger_teleporter_use( gentity_t *ent, gentity_t *other, gentity_t *activator ) +{ + ent->s.eFlags ^= EF_NODRAW; +} + -/*QUAKED trigger_teleport (.5 .5 .5) ? SPECTATOR +/*QUAKED trigger_teleport (.5 .5 .5) ? SPECTATOR SPAWN_DISABLED Allows client side prediction of teleportation events. Must point at a target_position, which will be the teleport destination. @@ -333,11 +346,13 @@ void SP_trigger_teleport( gentity_t *self ) else self->r.svFlags &= ~SVF_NOCLIENT; - // make sure the client precaches this sound - G_SoundIndex( "sound/world/jumppad.wav" ); + // SPAWN_DISABLED + if( self->spawnflags & 2 ) + self->s.eFlags |= EF_NODRAW; self->s.eType = ET_TELEPORT_TRIGGER; self->touch = trigger_teleporter_touch; + self->use = trigger_teleporter_use; trap_LinkEntity( self ); } -- cgit