]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Give shotgun a star pattern
authorFreddy <schro.sb@gmail.com>
Sun, 24 Jul 2016 10:23:59 +0000 (12:23 +0200)
committerFreddy <schro.sb@gmail.com>
Sun, 24 Jul 2016 10:23:59 +0000 (12:23 +0200)
bal-wep-xonotic.cfg
qcsrc/common/weapons/weapon/shotgun.qc

index 7a6a728696e06cefca27c08595adc60727ddaa19..d798ea4272531baa4e23f241043bf7d29380c44e 100644 (file)
@@ -34,13 +34,14 @@ set g_balance_blaster_weaponthrowable 0
 // {{{ #2: Shotgun
 set g_balance_shotgun_primary_ammo 1
 set g_balance_shotgun_primary_animtime 0.2
-set g_balance_shotgun_primary_bullets 12
+set g_balance_shotgun_primary_bullets 5
 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
-set g_balance_shotgun_primary_conespread 0.1
+set g_balance_shotgun_primary_conespread 0.3
+set g_balance_shotgun_primary_numcircles 2
 set g_balance_shotgun_reload_ammo 0
 set g_balance_shotgun_reload_time 2
 set g_balance_shotgun_secondary 1
index 156a602700ad793efcb657e340176c08679e4976..ec964add3c844e56510539e2f7e1743e6ac4fb6b 100644 (file)
@@ -21,6 +21,7 @@ CLASS(Shotgun, Weapon)
                P(class, prefix, alt_refire, float, SEC) \
                P(class, prefix, ammo, float, PRI) \
                P(class, prefix, conespread, float, PRI) \
+               P(class, prefix, numcircles, float, PRI) \
                P(class, prefix, animtime, float, BOTH) \
                P(class, prefix, bullets, float, PRI) \
                P(class, prefix, damage, float, BOTH) \
@@ -61,33 +62,37 @@ spawnfunc(weapon_shotgun) { weapon_defaultspawnfunc(this, WEP_SHOTGUN); }
 
 void W_Shotgun_Attack(Weapon thiswep, entity actor, float isprimary)
 {
-       float   sc;
+       float   sc, cc;
        entity flash;
 
        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));
+       float shots = WEP_CVAR_PRI(shotgun, bullets);
+       W_SetupShot(actor, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * shots);
        vector right = v_right;
        vector up = v_up;
        vector s;
 
        float mu = WEP_CVAR_PRI(shotgun, conespread);
-       float shots = WEP_CVAR_PRI(shotgun, bullets);
+       float numcircles = WEP_CVAR_PRI(shotgun, numcircles);
        // 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)
+       for(sc = 0;sc < shots;++sc)
        {
-               vector dir = w_shotdir;
+               vector dir;
 
                s = '0 0 0';
-               makevectors('0 360 0' * (0.75 + (sc - 0.5) / (shots - 1)));
+               makevectors('0 360 0' * (0.75 + sc/shots));
                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);
+               for(cc = 1; cc <= numcircles; ++cc)
+               {
+                       s = s * mu * cc/numcircles;
+                       dir = w_shotdir + 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));