]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
rifle code: make it have a _shots cvar too
authorRudolf Polzer <divVerent@xonotic.org>
Mon, 18 Apr 2011 19:41:23 +0000 (21:41 +0200)
committerRudolf Polzer <divVerent@xonotic.org>
Mon, 18 Apr 2011 19:43:37 +0000 (21:43 +0200)
balance25.cfg
balanceLeeStricklin.cfg
balanceSamual.cfg
balanceXonotic.cfg
balancetZork.cfg
qcsrc/server/autocvars.qh
qcsrc/server/w_sniperrifle.qc

index 482edc1426a19159d5719dd8262a7b859721bf48..bcc374cd289c118e510219cb2c2eee484773f3ca 100644 (file)
@@ -645,6 +645,7 @@ set g_balance_hlac_reload_time 2
 // {{{ sniperrifle
 set g_balance_sniperrifle_bursttime 0
 set g_balance_sniperrifle_primary_tracer 0
+set g_balance_sniperrifle_primary_shots 1
 set g_balance_sniperrifle_primary_damage 60
 set g_balance_sniperrifle_primary_headshotaddeddamage 100
 set g_balance_sniperrifle_primary_spread 0
@@ -660,6 +661,7 @@ set g_balance_sniperrifle_primary_bullethail 0 // empty magazine on shot
 set g_balance_sniperrifle_secondary 1
 set g_balance_sniperrifle_secondary_reload 0
 set g_balance_sniperrifle_secondary_tracer 0
+set g_balance_sniperrifle_secondary_shots 1
 set g_balance_sniperrifle_secondary_damage 35
 set g_balance_sniperrifle_secondary_headshotaddeddamage 15 // 50 damage only on head
 set g_balance_sniperrifle_secondary_spread 0.008
index 7232f876ce61ee24989c7449ad54f2cb02df6dd4..4de61dca0fb87afaddce978c393162d66722f142 100644 (file)
@@ -645,6 +645,7 @@ set g_balance_hlac_reload_time 2
 // {{{ sniperrifle
 set g_balance_sniperrifle_bursttime 0.85 // 0.35 - 0.1 + 0.35 - 0.1 + 0.35 = three secondaries
 set g_balance_sniperrifle_primary_tracer 0
+set g_balance_sniperrifle_primary_shots 1
 set g_balance_sniperrifle_primary_damage 75
 set g_balance_sniperrifle_primary_headshotaddeddamage 90
 set g_balance_sniperrifle_primary_spread 0
@@ -660,6 +661,7 @@ set g_balance_sniperrifle_primary_bullethail 0 // empty magazine on shot
 set g_balance_sniperrifle_secondary 1
 set g_balance_sniperrifle_secondary_reload 0
 set g_balance_sniperrifle_secondary_tracer 0
+set g_balance_sniperrifle_secondary_shots 1
 set g_balance_sniperrifle_secondary_damage 40
 set g_balance_sniperrifle_secondary_headshotaddeddamage 20
 set g_balance_sniperrifle_secondary_spread 0.008
index 4617606df484005cd43069f38f6bf8a4b83749a9..5da6f7778dec903b4d5af451f8455ab5ac15bd1a 100644 (file)
@@ -645,6 +645,7 @@ set g_balance_hlac_reload_time 2
 // {{{ sniperrifle
 set g_balance_sniperrifle_bursttime 0
 set g_balance_sniperrifle_primary_tracer 1
+set g_balance_sniperrifle_primary_shots 1
 set g_balance_sniperrifle_primary_damage 60
 set g_balance_sniperrifle_primary_headshotaddeddamage 50
 set g_balance_sniperrifle_primary_spread 0
@@ -660,6 +661,7 @@ set g_balance_sniperrifle_primary_bullethail 0 // empty magazine on shot
 set g_balance_sniperrifle_secondary 0 // Nex and sniper rifle should never be on the same map, so this (zoom on secondary) is okay 
 set g_balance_sniperrifle_secondary_reload 0
 set g_balance_sniperrifle_secondary_tracer 0
+set g_balance_sniperrifle_secondary_shots 1
 set g_balance_sniperrifle_secondary_damage 25
 set g_balance_sniperrifle_secondary_headshotaddeddamage 35
 set g_balance_sniperrifle_secondary_spread 0.01
index 55dde194b70e3fbf88d8ff2ea3621570dceb0ddc..e3e586232103c2e98059f3fd819ea13a9fd2ff49 100644 (file)
@@ -645,6 +645,7 @@ set g_balance_hlac_reload_time 2
 // {{{ sniperrifle
 set g_balance_sniperrifle_bursttime 0
 set g_balance_sniperrifle_primary_tracer 1
+set g_balance_sniperrifle_primary_shots 1
 set g_balance_sniperrifle_primary_damage 60
 set g_balance_sniperrifle_primary_headshotaddeddamage 60
 set g_balance_sniperrifle_primary_spread 0
@@ -660,6 +661,7 @@ set g_balance_sniperrifle_primary_bullethail 0 // empty magazine on shot
 set g_balance_sniperrifle_secondary 1
 set g_balance_sniperrifle_secondary_reload 1
 set g_balance_sniperrifle_secondary_tracer 0
+set g_balance_sniperrifle_secondary_shots 1
 set g_balance_sniperrifle_secondary_damage 42
 set g_balance_sniperrifle_secondary_headshotaddeddamage 42
 set g_balance_sniperrifle_secondary_spread 0
index 72f938ba523498858ec55520caa9169f314d6c6d..8886d5424d397d21936acbc2cd55b6ea5bee323a 100644 (file)
@@ -644,6 +644,7 @@ set g_balance_hlac_reload_time 2
 // {{{ sniperrifle
 set g_balance_sniperrifle_bursttime 0
 set g_balance_sniperrifle_primary_tracer 1
+set g_balance_sniperrifle_primary_shots 1
 set g_balance_sniperrifle_primary_damage 40
 set g_balance_sniperrifle_primary_headshotaddeddamage 100
 set g_balance_sniperrifle_primary_spread 0
@@ -659,6 +660,7 @@ set g_balance_sniperrifle_primary_bullethail 0 // empty magazine on shot
 set g_balance_sniperrifle_secondary 1
 set g_balance_sniperrifle_secondary_reload 0
 set g_balance_sniperrifle_secondary_tracer 0
+set g_balance_sniperrifle_secondary_shots 1
 set g_balance_sniperrifle_secondary_damage 50
 set g_balance_sniperrifle_secondary_headshotaddeddamage 50 // 50 damage only on head
 set g_balance_sniperrifle_secondary_spread 0
index d5652b775e4620b3831c96b0ae44d16ba1f737b8..85767d3039fc22bcac34b1fcd155815700f8c493 100644 (file)
@@ -93,6 +93,7 @@ float autocvar_g_balance_sniperrifle_primary_force;
 float autocvar_g_balance_sniperrifle_primary_headshotaddeddamage;
 float autocvar_g_balance_sniperrifle_primary_lifetime;
 float autocvar_g_balance_sniperrifle_primary_refire;
+float autocvar_g_balance_sniperrifle_primary_shots;
 float autocvar_g_balance_sniperrifle_primary_speed;
 float autocvar_g_balance_sniperrifle_primary_spread;
 float autocvar_g_balance_sniperrifle_primary_tracer;
@@ -108,6 +109,7 @@ float autocvar_g_balance_sniperrifle_secondary_headshotaddeddamage;
 float autocvar_g_balance_sniperrifle_secondary_lifetime;
 float autocvar_g_balance_sniperrifle_secondary_reload;
 float autocvar_g_balance_sniperrifle_secondary_refire;
+float autocvar_g_balance_sniperrifle_secondary_shots;
 float autocvar_g_balance_sniperrifle_secondary_speed;
 float autocvar_g_balance_sniperrifle_secondary_spread;
 float autocvar_g_balance_sniperrifle_secondary_tracer;
index f634993f5ad7ea6c2565c4e60eb7fc9b56f54aaf..0de47937ed1b26ab69252c6826227e1ab2ab3ce5 100644 (file)
@@ -2,20 +2,16 @@
 REGISTER_WEAPON(SNIPERRIFLE, w_sniperrifle, IT_NAILS, 7, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_MID, "campingrifle", "sniperrifle", _("Sniper Rifle"))
 #else
 #ifdef SVQC
-//Sniper rifle Primary mode: manually operated bolt*, Secondary: full automatic**
-//* Manually operating the bolt means that all the power of the gas is used to propell the bullet. In this mode the bolt is prevented from moving backwards in response to the firing of the bullet.
-//** In fully automatic mode some of the gas is used to extract and reload the next cartrige, thus there is less power and range.
 
 .float sniperrifle_accumulator;
 
-void W_SniperRifle_FireBullet(float pSpread, float pDamage, float pHeadshotAddedDamage, float pForce, float pSpeed, float pLifetime, float pAmmo, float deathtype, float pBulletConstant)
+void W_SniperRifle_FireBullet(float pSpread, float pDamage, float pHeadshotAddedDamage, float pForce, float pSpeed, float pLifetime, float pAmmo, float deathtype, float pBulletConstant, float pTracer, float pShots, string pSound)
 {
+       float i;
+
        W_DecreaseAmmo(ammo_nails, pAmmo, autocvar_g_balance_sniperrifle_reload_ammo);
 
-       if(deathtype & HITTYPE_SECONDARY)
-               W_SetupShot (self, autocvar_g_antilag_bullets && pSpeed >= autocvar_g_antilag_bullets, 2, "weapons/campingrifle_fire2.wav", CHAN_WEAPON, autocvar_g_balance_sniperrifle_secondary_damage + autocvar_g_balance_sniperrifle_secondary_headshotaddeddamage);
-       else
-               W_SetupShot (self, autocvar_g_antilag_bullets && pSpeed >= autocvar_g_antilag_bullets, 2, "weapons/campingrifle_fire.wav", CHAN_WEAPON, autocvar_g_balance_sniperrifle_primary_damage + autocvar_g_balance_sniperrifle_primary_headshotaddeddamage);
+       W_SetupShot (self, autocvar_g_antilag_bullets && pSpeed >= autocvar_g_antilag_bullets, 2, pSound, CHAN_WEAPON, pDamage + pHeadshotAddedDamage);
 
        pointparticles(particleeffectnum("sniperrifle_muzzleflash"), w_shotorg, w_shotdir * 2000, 1);
 
@@ -25,10 +21,8 @@ void W_SniperRifle_FireBullet(float pSpread, float pDamage, float pHeadshotAdded
                w_shotorg = self.origin + self.view_ofs + ((w_shotorg - self.origin - self.view_ofs) * v_forward) * v_forward;
        }
 
-       if(deathtype & HITTYPE_SECONDARY)
-               fireBallisticBullet(w_shotorg, w_shotdir, pSpread, pSpeed, pLifetime, pDamage, pHeadshotAddedDamage / pDamage, pForce, deathtype, (autocvar_g_balance_sniperrifle_secondary_tracer ? EF_RED : EF_BLUE), 1, pBulletConstant);
-       else
-               fireBallisticBullet(w_shotorg, w_shotdir, pSpread, pSpeed, pLifetime, pDamage, pHeadshotAddedDamage / pDamage, pForce, deathtype, (autocvar_g_balance_sniperrifle_primary_tracer ? EF_RED : EF_BLUE), 1, pBulletConstant);
+       for(i = 0; i < pShots; ++i)
+               fireBallisticBullet(w_shotorg, w_shotdir, pSpread, pSpeed, pLifetime, pDamage, pHeadshotAddedDamage / pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE), 1, pBulletConstant);
        endFireBallisticBullet();
 
        if (autocvar_g_casings >= 2)
@@ -37,12 +31,12 @@ void W_SniperRifle_FireBullet(float pSpread, float pDamage, float pHeadshotAdded
 
 void W_SniperRifle_Attack()
 {
-       W_SniperRifle_FireBullet(autocvar_g_balance_sniperrifle_primary_spread, autocvar_g_balance_sniperrifle_primary_damage, autocvar_g_balance_sniperrifle_primary_headshotaddeddamage, autocvar_g_balance_sniperrifle_primary_force, autocvar_g_balance_sniperrifle_primary_speed, autocvar_g_balance_sniperrifle_primary_lifetime, autocvar_g_balance_sniperrifle_primary_ammo, WEP_SNIPERRIFLE, autocvar_g_balance_sniperrifle_primary_bulletconstant);
+       W_SniperRifle_FireBullet(autocvar_g_balance_sniperrifle_primary_spread, autocvar_g_balance_sniperrifle_primary_damage, autocvar_g_balance_sniperrifle_primary_headshotaddeddamage, autocvar_g_balance_sniperrifle_primary_force, autocvar_g_balance_sniperrifle_primary_speed, autocvar_g_balance_sniperrifle_primary_lifetime, autocvar_g_balance_sniperrifle_primary_ammo, WEP_SNIPERRIFLE, autocvar_g_balance_sniperrifle_primary_bulletconstant, autocvar_g_balance_sniperrifle_primary_tracer, autocvar_g_balance_sniperrifle_primary_shots, "weapons/campingrifle_fire.wav");
 }
 
 void W_SniperRifle_Attack2()
 {
-       W_SniperRifle_FireBullet(autocvar_g_balance_sniperrifle_secondary_spread, autocvar_g_balance_sniperrifle_secondary_damage, autocvar_g_balance_sniperrifle_secondary_headshotaddeddamage, autocvar_g_balance_sniperrifle_secondary_force, autocvar_g_balance_sniperrifle_secondary_speed, autocvar_g_balance_sniperrifle_secondary_lifetime, autocvar_g_balance_sniperrifle_secondary_ammo, WEP_SNIPERRIFLE | HITTYPE_SECONDARY, autocvar_g_balance_sniperrifle_secondary_bulletconstant);
+       W_SniperRifle_FireBullet(autocvar_g_balance_sniperrifle_secondary_spread, autocvar_g_balance_sniperrifle_secondary_damage, autocvar_g_balance_sniperrifle_secondary_headshotaddeddamage, autocvar_g_balance_sniperrifle_secondary_force, autocvar_g_balance_sniperrifle_secondary_speed, autocvar_g_balance_sniperrifle_secondary_lifetime, autocvar_g_balance_sniperrifle_secondary_ammo, WEP_SNIPERRIFLE | HITTYPE_SECONDARY, autocvar_g_balance_sniperrifle_secondary_bulletconstant, autocvar_g_balance_sniperrifle_secondary_tracer, autocvar_g_balance_sniperrifle_secondary_shots, "weapons/campingrifle_fire2.wav");
 }
 
 void spawnfunc_weapon_sniperrifle (void)