Example #1
0
/*
* G_Fire_Gunblade_Blast
*/
static edict_t *G_Fire_Gunblade_Blast( vec3_t origin, vec3_t angles, firedef_t *firedef, edict_t *owner, int seed )
{
	int speed, knockback, stun, minDamage, minKnockback, radius, mod;
	float damage;
	int timeDelta;

	timeDelta = 0;
	if( owner && owner->r.client )
		timeDelta = owner->r.client->timeDelta;

	if( firedef->spread )
		G_LocalSpread( angles, firedef->spread, seed );

	mod = ( firedef->fire_mode == FIRE_MODE_STRONG ) ? MOD_GUNBLADE_S : MOD_GUNBLADE_W;
	speed = firedef->speed;
	damage = firedef->damage;
	knockback = firedef->knockback;
	stun = firedef->stun;
	minDamage = firedef->mindamage;
	minKnockback = firedef->minknockback;
	radius = firedef->splash_radius;

	if( is_quad )
	{
		damage *= QUAD_DAMAGE_SCALE;
		knockback *= QUAD_KNOCKBACK_SCALE;
	}

	return W_Fire_GunbladeBlast( owner, origin, angles, damage, minKnockback, knockback, stun, minDamage,
		radius, speed, firedef->timeout, mod, timeDelta );
}
Example #2
0
/*
* G_Fire_Gunblade_Blast
*/
static edict_t *G_Fire_Gunblade_Blast( vec3_t origin, vec3_t angles, firedef_t *firedef, edict_t *owner, int seed )
{
	int speed, knockback, stun, minDamage, minKnockback, radius, mod;
	float damage;
	int timeDelta;
	float power;

	timeDelta = 0;
	if( owner && owner->r.client )
		timeDelta = owner->r.client->timeDelta;

	if( firedef->spread )
		G_LocalSpread( angles, firedef->spread, seed );

	mod = ( firedef->fire_mode == FIRE_MODE_STRONG ) ? MOD_GUNBLADE_S : MOD_GUNBLADE_W;
	speed = firedef->speed;
	damage = firedef->damage;
	knockback = firedef->knockback;
	stun = firedef->stun;
	minDamage = firedef->mindamage;
	minKnockback = firedef->minknockback;
	radius = firedef->splash_radius;

	// hackish : scale by power fraction
	if( owner && owner->r.client )
	{
		power = (float)owner->r.client->ps.inventory[firedef->ammo_id] /(float)firedef->ammo_max;
		damage *= power;
		knockback *= power;
		radius *= power;
	}

	if( is_quad )
	{
		damage *= QUAD_DAMAGE_SCALE;
		knockback *= QUAD_KNOCKBACK_SCALE;
	}

	// scale by power fraction
	if( damage < firedef->mindamage )
		damage = firedef->mindamage;
	if( minDamage < firedef->mindamage )
		minDamage = firedef->mindamage;

	// hackish : every shot wastes all player power
	if( owner && owner->r.client && firedef->ammo_id )
	{
		owner->r.client->ps.inventory[firedef->ammo_id] = min( firedef->ammo_pickup * 2, firedef->ammo_max );
		owner->r.client->resp.gunbladeChargeTimeStamp = level.time;
	}

	return W_Fire_GunbladeBlast( owner, origin, angles, damage, minKnockback, knockback, stun, minDamage,
		radius, speed, firedef->timeout, mod, timeDelta );
}