diff options
author | Mikko Tiusanen <ams@daug.net> | 2014-07-25 23:56:53 +0300 |
---|---|---|
committer | Mikko Tiusanen <ams@daug.net> | 2014-07-25 23:56:53 +0300 |
commit | 73fa3f4498b3b477233f3aa0b2cc2d0a2cc726be (patch) | |
tree | ba28e9e235701af93737b96d91e83377c6ad44f5 /src/game/g_missile.c | |
parent | 4c26da913161e0bc3d5a912c6b154e33c38d9546 (diff) |
Added lasgun portable shield secondary fire functionality.
Diffstat (limited to 'src/game/g_missile.c')
-rw-r--r-- | src/game/g_missile.c | 104 |
1 files changed, 54 insertions, 50 deletions
diff --git a/src/game/g_missile.c b/src/game/g_missile.c index 3fea37b..0cf7c5d 100644 --- a/src/game/g_missile.c +++ b/src/game/g_missile.c @@ -1032,86 +1032,90 @@ void G_LasgunPush( gentity_t *self ) VectorAdd( self->r.currentOrigin, range, maxs ); VectorSubtract( self->r.currentOrigin, range, mins ); - num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); - - for( i = 0; i < num; i++ ) + if (self->count++ > LASGUN_PUSH_COUNT) { - enemy = &g_entities[ entityList[ i ] ]; - - if( enemy->flags & FL_NOTARGET ) - continue; - - if( !G_Visible( self, enemy, CONTENTS_SOLID ) ) - continue; - - if( enemy->client && enemy->client->ps.stats[ STAT_TEAM ] != TEAM_HUMANS ) - { - if (!enemy->client) - continue; - - if (enemy == self->parent) - continue; - - if (!enemy->takedamage) - continue; + num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); - active = qtrue; - break; - } - } - - if (active) - { for( i = 0; i < num; i++ ) { enemy = &g_entities[ entityList[ i ] ]; - + if( enemy->flags & FL_NOTARGET ) continue; if( !G_Visible( self, enemy, CONTENTS_SOLID ) ) continue; - if( enemy->client && enemy->client->ps.stats[ STAT_TEAM ] != TEAM_NONE ) + if( enemy->client && enemy->client->ps.stats[ STAT_TEAM ] != TEAM_HUMANS ) { if (!enemy->client) continue; - + if (enemy == self->parent) continue; if (!enemy->takedamage) continue; - if ( enemy->client->ps.stats[ STAT_CLASS ] == PCL_ALIEN_LEVEL5 ) - force = LASGUN_PUSH_FORCE; - else - force = LASGUN_WEAK_FORCE; + active = qtrue; + break; + } + } - VectorSubtract( enemy->r.currentOrigin, self->r.currentOrigin, dir); - VectorNormalize( dir ); - VectorScale( dir, force, enemy->client->ps.velocity ); + if (active) + { + for( i = 0; i < num; i++ ) + { + enemy = &g_entities[ entityList[ i ] ]; + + if( enemy->flags & FL_NOTARGET ) + continue; + + if( !G_Visible( self, enemy, CONTENTS_SOLID ) ) + continue; + + if( enemy->client && enemy->client->ps.stats[ STAT_TEAM ] != TEAM_NONE ) + { + if (!enemy->client) + continue; + + if (enemy == self->parent) + continue; + + if (!enemy->takedamage) + continue; + + if ( enemy->client->ps.stats[ STAT_CLASS ] == PCL_ALIEN_LEVEL5 ) + force = LASGUN_PUSH_FORCE; + else + force = LASGUN_WEAK_FORCE; + + VectorSubtract( enemy->r.currentOrigin, self->r.currentOrigin, dir); + VectorNormalize( dir ); + VectorScale( dir, force, enemy->client->ps.velocity ); + } } } - } + self->count = 0; /* - if( enemy->client && enemy->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) - { + if( enemy->client && enemy->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) + { // start the attack animation G_AddEvent( self, EV_FORCE_FIELD, DirToByte( self->s.origin2 ) ); if( level.time >= self->timestamp + 500 ) - { - self->timestamp = level.time; - G_SetBuildableAnim( self, BANIM_ATTACK1, qfalse ); - } - return; + { + self->timestamp = level.time; + G_SetBuildableAnim( self, BANIM_ATTACK1, qfalse ); + } + return; + } } - } */ - if( level.time >= self->timestamp ) { - self->freeAfterEvent = qtrue; - self->parent->parentNode = NULL; + if( level.time >= self->timestamp ) { + self->freeAfterEvent = qtrue; + self->parent->parentNode = NULL; + } } trap_LinkEntity( self ); } |