From: Rudolf Polzer Date: Mon, 18 Apr 2011 19:41:23 +0000 (+0200) Subject: rifle code: make it have a _shots cvar too X-Git-Tag: xonotic-v0.5.0~264^2~31 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f2d298b588b2f4fa3e2590b2ca32677feaf102e4;p=xonotic%2Fxonotic-data.pk3dir.git rifle code: make it have a _shots cvar too --- diff --git a/balance25.cfg b/balance25.cfg index 482edc142..bcc374cd2 100644 --- a/balance25.cfg +++ b/balance25.cfg @@ -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 diff --git a/balanceLeeStricklin.cfg b/balanceLeeStricklin.cfg index 7232f876c..4de61dca0 100644 --- a/balanceLeeStricklin.cfg +++ b/balanceLeeStricklin.cfg @@ -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 diff --git a/balanceSamual.cfg b/balanceSamual.cfg index 4617606df..5da6f7778 100644 --- a/balanceSamual.cfg +++ b/balanceSamual.cfg @@ -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 diff --git a/balanceXonotic.cfg b/balanceXonotic.cfg index 55dde194b..e3e586232 100644 --- a/balanceXonotic.cfg +++ b/balanceXonotic.cfg @@ -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 diff --git a/balancetZork.cfg b/balancetZork.cfg index 72f938ba5..8886d5424 100644 --- a/balancetZork.cfg +++ b/balancetZork.cfg @@ -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 diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index d5652b775..85767d303 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -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; diff --git a/qcsrc/server/w_sniperrifle.qc b/qcsrc/server/w_sniperrifle.qc index f634993f5..0de47937e 100644 --- a/qcsrc/server/w_sniperrifle.qc +++ b/qcsrc/server/w_sniperrifle.qc @@ -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)