summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIronClawTrem <louie.nutman@gmail.com>2019-12-22 20:47:10 +0000
committerIronClawTrem <louie.nutman@gmail.com>2019-12-22 20:47:10 +0000
commitdbd9e5f86c517d1532fa911b9187f8fcf3f9f790 (patch)
treec29e70388c5a73b4c9227af35ba0f6973e63e360
parent651dab523932856d58d97a9266ef96189fe9bd89 (diff)
remove knockback from everything but LC, barbs and nades
-rw-r--r--src/game/g_buildable.c2
-rw-r--r--src/game/g_combat.c44
-rw-r--r--src/game/g_local.h5
-rw-r--r--src/game/g_missile.c9
-rw-r--r--src/game/g_weapon.c8
5 files changed, 36 insertions, 32 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index b7bc386..461c2d0 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -2458,7 +2458,7 @@ void HSpawn_Blast( gentity_t *self )
//do some radius damage
G_RadiusDamage( self->s.pos.trBase, self, self->splashDamage,
- self->splashRadius, self, self->splashMethodOfDeath );
+ self->splashRadius, self, 0, self->splashMethodOfDeath );
self->think = freeBuildable;
self->nextthink = level.time + 100;
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 091040e..5350895 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -1138,7 +1138,7 @@ inflictor, attacker, dir, and point can be NULL for environmental effects
dflags these flags are used to control how T_Damage works
DAMAGE_RADIUS damage was indirect (from a nearby explosion)
DAMAGE_NO_ARMOR armor does not protect from this damage
- DAMAGE_NO_KNOCKBACK do not affect velocity, just view angles
+ DAMAGE_KNOCKBACK affect velocity, not just view angles
DAMAGE_NO_PROTECTION kills godmode, armor, everything
============
*/
@@ -1158,7 +1158,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
int take;
int save;
int asave = 0;
- int knockback;
+ int knockback = 0;
float damagemodifier=0.0;
int takeNoOverkill;
@@ -1200,32 +1200,32 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
}
if( !dir )
- dflags |= DAMAGE_NO_KNOCKBACK;
+ dflags &= ~DAMAGE_KNOCKBACK;
else
VectorNormalize( dir );
- knockback = damage;
-
- if( inflictor->s.weapon != WP_NONE )
+ if( dflags & DAMAGE_KNOCKBACK )
{
- knockback = (int)( (float)knockback *
- BG_FindKnockbackScaleForWeapon( inflictor->s.weapon ) );
- }
+ knockback = damage;
- if( targ->client )
- {
- knockback = (int)( (float)knockback *
- BG_FindKnockbackScaleForClass( targ->client->ps.stats[ STAT_PCLASS ] ) );
- }
+ if( inflictor->s.weapon != WP_NONE )
+ {
+ knockback = (int)( (float)knockback *
+ BG_FindKnockbackScaleForWeapon( inflictor->s.weapon ) );
+ }
- if( knockback > 200 )
- knockback = 200;
+ if( targ->client )
+ {
+ knockback = (int)( (float)knockback *
+ BG_FindKnockbackScaleForClass( targ->client->ps.stats[ STAT_PCLASS ] ) );
+ }
- if( targ->flags & FL_NO_KNOCKBACK )
- knockback = 0;
+ if( knockback > 200 )
+ knockback = 200;
- if( dflags & DAMAGE_NO_KNOCKBACK )
- knockback = 0;
+ if( targ->flags & FL_NO_KNOCKBACK )
+ knockback = 0;
+ }
// figure momentum add, even if the damage won't be taken
if( knockback && targ->client )
@@ -1649,7 +1649,7 @@ G_RadiusDamage
============
*/
qboolean G_RadiusDamage( vec3_t origin, gentity_t *attacker, float damage,
- float radius, gentity_t *ignore, int mod )
+ float radius, gentity_t *ignore, int dflags, int mod )
{
float points, dist;
gentity_t *ent;
@@ -1706,7 +1706,7 @@ qboolean G_RadiusDamage( vec3_t origin, gentity_t *attacker, float damage,
// get knocked into the air more
dir[ 2 ] += 24;
G_Damage( ent, NULL, attacker, dir, origin,
- (int)points, DAMAGE_RADIUS|DAMAGE_NO_LOCDAMAGE, mod );
+ (int)points, DAMAGE_RADIUS|DAMAGE_NO_LOCDAMAGE|dflags, mod );
}
}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 19b05c9..df16a84 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -181,6 +181,7 @@ struct gentity_s
qboolean takedamage;
int damage;
+ int dflags;
int splashDamage; // quad will increase this without increasing radius
int splashRadius;
int methodOfDeath;
@@ -999,7 +1000,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
void G_SelectiveDamage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_t dir,
vec3_t point, int damage, int dflags, int mod, int team );
qboolean G_RadiusDamage( vec3_t origin, gentity_t *attacker, float damage, float radius,
- gentity_t *ignore, int mod );
+ gentity_t *ignore, int dflags, int mod );
qboolean G_SelectiveRadiusDamage( vec3_t origin, gentity_t *attacker, float damage, float radius,
gentity_t *ignore, int mod, int team );
void G_Knockback( gentity_t *targ, vec3_t dir, int knockback );
@@ -1011,7 +1012,7 @@ void G_InitDamageLocations( void );
// damage flags
#define DAMAGE_RADIUS 0x00000001 // damage was indirect
#define DAMAGE_NO_ARMOR 0x00000002 // armour does not protect from this damage
-#define DAMAGE_NO_KNOCKBACK 0x00000004 // do not affect velocity, just view angles
+#define DAMAGE_KNOCKBACK 0x00000004 // affect velocity, not just view angles
#define DAMAGE_NO_PROTECTION 0x00000008 // armor, shields, invulnerability, and godmode have no effect
#define DAMAGE_NO_LOCDAMAGE 0x00000010 // do not apply locational damage
diff --git a/src/game/g_missile.c b/src/game/g_missile.c
index 6317636..26cb97e 100644
--- a/src/game/g_missile.c
+++ b/src/game/g_missile.c
@@ -92,7 +92,7 @@ void G_ExplodeMissile( gentity_t *ent )
// splash damage
if( ent->splashDamage )
G_RadiusDamage( ent->r.currentOrigin, ent->parent, ent->splashDamage,
- ent->splashRadius, ent, ent->splashMethodOfDeath );
+ ent->splashRadius, ent, ent->dflags, ent->splashMethodOfDeath );
trap_LinkEntity( ent );
}
@@ -199,7 +199,7 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace )
velocity[ 2 ] = 1; // stepped on a grenade
G_Damage( other, ent, attacker, velocity, ent->s.origin, ent->damage,
- 0, ent->methodOfDeath );
+ ent->dflags, ent->methodOfDeath );
}
}
@@ -231,7 +231,7 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace )
// splash damage (doesn't apply to person directly hit)
if( ent->splashDamage )
G_RadiusDamage( trace->endpos, ent->parent, ent->splashDamage, ent->splashRadius,
- other, ent->splashMethodOfDeath );
+ other, ent->dflags, ent->splashMethodOfDeath );
trap_LinkEntity( ent );
}
@@ -459,6 +459,7 @@ gentity_t *fire_luciferCannon( gentity_t *self, vec3_t start, vec3_t dir, int da
bolt->r.ownerNum = self->s.number;
bolt->parent = self;
bolt->damage = localDamage;
+ bolt->dflags = DAMAGE_KNOCKBACK;
bolt->splashDamage = localDamage / 2;
bolt->splashRadius = radius;
bolt->methodOfDeath = MOD_LCANNON;
@@ -501,6 +502,7 @@ gentity_t *launch_grenade( gentity_t *self, vec3_t start, vec3_t dir )
bolt->r.ownerNum = self->s.number;
bolt->parent = self;
bolt->damage = GRENADE_DAMAGE;
+ bolt->dflags = DAMAGE_KNOCKBACK;
bolt->splashDamage = GRENADE_DAMAGE;
bolt->splashRadius = GRENADE_RANGE;
bolt->methodOfDeath = MOD_GRENADE;
@@ -790,6 +792,7 @@ gentity_t *fire_bounceBall( gentity_t *self, vec3_t start, vec3_t dir )
bolt->r.ownerNum = self->s.number;
bolt->parent = self;
bolt->damage = LEVEL3_BOUNCEBALL_DMG;
+ bolt->dflags = DAMAGE_KNOCKBACK;
bolt->splashDamage = 0;
bolt->splashRadius = 0;
bolt->methodOfDeath = MOD_LEVEL3_BOUNCEBALL;
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index 92dddf2..ddad4af 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -262,7 +262,7 @@ void meleeAttack( gentity_t *ent, float range, float width, int damage, meansOfD
}
if( traceEnt->takedamage )
- G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, DAMAGE_NO_KNOCKBACK, mod );
+ G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, 0, mod );
}
/*
@@ -937,7 +937,7 @@ qboolean CheckVenomAttack( gentity_t *ent )
tent->s.generic1 = ent->s.generic1; //weaponMode
}
- G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, DAMAGE_NO_KNOCKBACK, MOD_LEVEL0_BITE );
+ G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, 0, MOD_LEVEL0_BITE );
return qtrue;
}
@@ -1292,7 +1292,7 @@ void G_UpdateZaps( int msec )
if( damage )
{
G_Damage( target, source, zap->creator, forward, target->s.origin,
- damage, DAMAGE_NO_KNOCKBACK | DAMAGE_NO_LOCDAMAGE, MOD_LEVEL2_ZAP );
+ damage, DAMAGE_NO_LOCDAMAGE, MOD_LEVEL2_ZAP );
zap->damageUsed += damage;
}
}
@@ -1407,7 +1407,7 @@ qboolean CheckPounceAttack( gentity_t *ent )
ent->client->pmext.pouncePayload = 0;
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage,
- DAMAGE_NO_KNOCKBACK|DAMAGE_NO_LOCDAMAGE, MOD_LEVEL3_POUNCE );
+ DAMAGE_NO_LOCDAMAGE, MOD_LEVEL3_POUNCE );
ent->client->allowedToPounce = qfalse;