summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-02-04 17:01:59 +0100
committerPaweł Redman <pawel.redman@gmail.com>2018-02-04 17:01:59 +0100
commit5c0caf1fb9548749f9140772ae1f26b515c4bb21 (patch)
treeebca1fcb9eb5ea552bbfe224ada213b2ce543511
parent852c451bc1e4a760c699c7ba9953dad10fdc84c1 (diff)
Remove knockback from everything but LC and barbs.
-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_main.c2
-rw-r--r--src/game/g_missile.c8
-rw-r--r--src/game/g_weapon.c10
6 files changed, 37 insertions, 34 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index f6a98f6..a65f2a0 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -2607,7 +2607,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 81a5345..d8eef62 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -1233,7 +1233,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
============
*/
@@ -1252,7 +1252,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
gclient_t *client;
int take;
int asave = 0;
- int knockback;
+ int knockback = 0;
float damagemodifier=0.0;
int takeNoOverkill;
@@ -1294,32 +1294,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 )
@@ -1882,7 +1882,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;
@@ -1939,7 +1939,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 6547741..46bc31d 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -168,6 +168,7 @@ struct gentity_s
qboolean takedamage;
int damage;
+ int dflags;
int splashDamage; // quad will increase this without increasing radius
int splashRadius;
int methodOfDeath;
@@ -1014,7 +1015,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 );
@@ -1026,7 +1027,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_main.c b/src/game/g_main.c
index 99079e8..7e72b87 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -3239,7 +3239,7 @@ static void G_CheckVampireDeathBuildables( void )
ent->health -= damage;
else
G_Damage( ent, NULL, NULL, NULL, NULL, damage,
- DAMAGE_NO_ARMOR|DAMAGE_NO_KNOCKBACK|DAMAGE_NO_PROTECTION|DAMAGE_NO_LOCDAMAGE, MOD_SUICIDE );
+ DAMAGE_NO_ARMOR|DAMAGE_NO_PROTECTION|DAMAGE_NO_LOCDAMAGE, MOD_SUICIDE );
}
}
diff --git a/src/game/g_missile.c b/src/game/g_missile.c
index 71b5432..680f49d 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;
@@ -816,6 +817,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 bc1491b..8ab005e 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -258,7 +258,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 );
}
/*
@@ -644,7 +644,7 @@ void painSawFire( gentity_t *ent )
}
if( traceEnt->takedamage )
- G_Damage( traceEnt, ent, ent, forward, tr.endpos, PAINSAW_DAMAGE, DAMAGE_NO_KNOCKBACK, MOD_PAINSAW );
+ G_Damage( traceEnt, ent, ent, forward, tr.endpos, PAINSAW_DAMAGE, 0, MOD_PAINSAW );
}
/*
@@ -929,7 +929,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;
}
@@ -1287,7 +1287,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 );
if( g_modAlienRate.integer > 0 )
damage = damage * 100 / g_modAlienRate.integer;
zap->damageUsed += damage;
@@ -1404,7 +1404,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;