From: Freddy Date: Sun, 24 Jul 2016 00:21:23 +0000 (+0200) Subject: Give shotgun a circular pattern (same pattern as crylink) X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fdcdd3976c966730fd866ee13f52f423c04a0bab;p=xonotic%2Fxonotic-data.pk3dir.git Give shotgun a circular pattern (same pattern as crylink) --- diff --git a/bal-wep-xonotic.cfg b/bal-wep-xonotic.cfg index 779c7129c..7a6a72869 100644 --- a/bal-wep-xonotic.cfg +++ b/bal-wep-xonotic.cfg @@ -39,7 +39,8 @@ set g_balance_shotgun_primary_damage 4 set g_balance_shotgun_primary_force 15 set g_balance_shotgun_primary_refire 0.75 set g_balance_shotgun_primary_solidpenetration 3.8 -set g_balance_shotgun_primary_spread 0.12 +set g_balance_shotgun_primary_spread 0 +set g_balance_shotgun_primary_conespread 0.1 set g_balance_shotgun_reload_ammo 0 set g_balance_shotgun_reload_time 2 set g_balance_shotgun_secondary 1 diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 34d2e462c..156a60270 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -20,6 +20,7 @@ CLASS(Shotgun, Weapon) P(class, prefix, alt_animtime, float, SEC) \ P(class, prefix, alt_refire, float, SEC) \ P(class, prefix, ammo, float, PRI) \ + P(class, prefix, conespread, float, PRI) \ P(class, prefix, animtime, float, BOTH) \ P(class, prefix, bullets, float, PRI) \ P(class, prefix, damage, float, BOTH) \ @@ -66,8 +67,28 @@ void W_Shotgun_Attack(Weapon thiswep, entity actor, float isprimary) W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(shotgun, ammo)); W_SetupShot(actor, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets)); - for(sc = 0;sc < WEP_CVAR_PRI(shotgun, bullets);sc = sc + 1) - fireBullet(actor, w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0); + vector right = v_right; + vector up = v_up; + vector s; + + float mu = WEP_CVAR_PRI(shotgun, conespread); + float shots = WEP_CVAR_PRI(shotgun, bullets); + // fire one bullet straight + fireBullet(actor, w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0); + + for(sc = 1;sc < shots;++sc) + { + vector dir = w_shotdir; + + s = '0 0 0'; + makevectors('0 360 0' * (0.75 + (sc - 0.5) / (shots - 1))); + s.y = v_forward.x; + s.z = v_forward.y; + + s = s * mu; + dir += right * s.y + up * s.z; + fireBullet(actor, w_shotorg, dir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0); + } Send_Effect(EFFECT_SHOTGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, WEP_CVAR_PRI(shotgun, ammo));