summaryrefslogtreecommitdiff
path: root/src/game/bg_misc.c
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2015-04-12 02:32:12 +0200
committerPaweł Redman <pawel.redman@gmail.com>2015-04-12 02:32:12 +0200
commit622ecb7bedeacaf4063dadc87764d3b66ad2f009 (patch)
tree6a936666d9d495d59bb7a0cc294b1077213550fe /src/game/bg_misc.c
parenteca487d693704aed6beb821222481724f3aeedd4 (diff)
Make force fields apply forces smoothly and continuously.
Diffstat (limited to 'src/game/bg_misc.c')
-rw-r--r--src/game/bg_misc.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index b1c7550..7971aa8 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -5449,3 +5449,40 @@ int cmdcmp( const void *a, const void *b )
{
return Q_stricmp( (const char *)a, ((dummyCmd_t *)b)->name );
}
+
+/*
+============
+BG_ForceFieldForEntity
+============
+*/
+qboolean BG_ForceFieldForEntity( playerState_t *ps, entityState_t *es, forceField_t *ff )
+{
+ if( es->eType == ET_BUILDABLE )
+ {
+ if( !( es->eFlags & EF_B_POWERED ) )
+ return qfalse;
+
+ if( !( es->eFlags & EF_B_SPAWNED ) )
+ return qfalse;
+
+ // health
+ if( es->generic1 <= 0 )
+ return qfalse;
+
+ switch( es->modelindex )
+ {
+ case BA_H_LIGHT: //force field
+ if( ps && ps->stats[ STAT_TEAM ] != TEAM_ALIENS )
+ return qfalse;
+
+ ff->type = 0;
+ VectorCopy( es->origin, ff->origin );
+ ff->range = LIGHT_RANGE;
+ ff->force = LIGHT_FORCE;
+
+ return qtrue;
+ }
+ }
+
+ return qfalse;
+}