Merge remote branch 'origin/master' into samual/hagar_secondary_autorelease
authorSamual <samual@xonotic.org>
Mon, 26 Sep 2011 16:51:08 +0000 (12:51 -0400)
committerSamual <samual@xonotic.org>
Mon, 26 Sep 2011 16:51:08 +0000 (12:51 -0400)
Conflicts:
qcsrc/server/w_hagar.qc

1  2 
balanceXonotic.cfg
qcsrc/server/w_hagar.qc

diff --combined balanceXonotic.cfg
index 5c3138a61f6b874f700e6cdce9071dab7af67ed9,182e66cb1ccb486be92967163d2036a128321033..4046379f2597619670e38279cfb2d331ed82944f
@@@ -144,7 -144,7 +144,7 @@@ set g_balance_fuel_limit 99
  // }}}
  
  // {{{ misc
- set g_balance_selfdamagepercent 0.75
+ set g_balance_selfdamagepercent 0.65
  set g_balance_weaponswitchdelay 0.15
  set g_weaponspeedfactor 1 "weapon projectile speed multiplier"
  set g_weaponratefactor 1 "weapon fire rate multiplier"
@@@ -286,13 -286,13 +286,13 @@@ set g_balance_uzi_burst_force 2
  set g_balance_uzi_burst_ammo 3
  
  set g_balance_uzi_first 1
- set g_balance_uzi_first_damage 16
+ set g_balance_uzi_first_damage 14
  set g_balance_uzi_first_force 5
  set g_balance_uzi_first_spread 0.03
- set g_balance_uzi_first_refire 0.2
+ set g_balance_uzi_first_refire 0.4
  set g_balance_uzi_first_ammo 1
  
- set g_balance_uzi_sustained_damage 14
+ set g_balance_uzi_sustained_damage 12
  set g_balance_uzi_sustained_force 5
  set g_balance_uzi_sustained_spread 0.04
  set g_balance_uzi_sustained_refire 0.1
@@@ -332,8 -332,9 +332,9 @@@ set g_balance_grenadelauncher_secondary
  set g_balance_grenadelauncher_secondary_speed_up 150
  set g_balance_grenadelauncher_secondary_speed_z 0
  set g_balance_grenadelauncher_secondary_spread 0.02
- set g_balance_grenadelauncher_secondary_lifetime 1
- set g_balance_grenadelauncher_secondary_lifetime2 0
+ set g_balance_grenadelauncher_secondary_lifetime 5
+ set g_balance_grenadelauncher_secondary_lifetime_bounce 0.5
+ set g_balance_grenadelauncher_secondary_lifetime_stick 0
  set g_balance_grenadelauncher_secondary_refire 0.7
  set g_balance_grenadelauncher_secondary_animtime 0.3
  set g_balance_grenadelauncher_secondary_ammo 2
@@@ -479,8 -480,8 +480,8 @@@ set g_balance_crylink_reload_time 
  // {{{ nex
  set g_balance_nex_primary_damage 90
  set g_balance_nex_primary_force 400
- set g_balance_nex_primary_refire 1.25
- set g_balance_nex_primary_animtime 0.3
+ set g_balance_nex_primary_refire 1.5
+ set g_balance_nex_primary_animtime 0.4
  set g_balance_nex_primary_ammo 6
  set g_balance_nex_primary_damagefalloff_mindist 0 // 1000    For tZork ;3
  set g_balance_nex_primary_damagefalloff_maxdist 0 // 3000
@@@ -529,11 -530,11 +530,11 @@@ set g_balance_minstanex_reload_ammo 0 /
  set g_balance_minstanex_reload_time 2
  // }}}
  // {{{ hagar
- set g_balance_hagar_primary_damage 30
- set g_balance_hagar_primary_edgedamage 15
+ set g_balance_hagar_primary_damage 25
+ set g_balance_hagar_primary_edgedamage 12.5
  set g_balance_hagar_primary_force 50
- set g_balance_hagar_primary_radius 70
- set g_balance_hagar_primary_spread 0.05
+ set g_balance_hagar_primary_radius 60
+ set g_balance_hagar_primary_spread 0.04
  set g_balance_hagar_primary_speed 2000
  set g_balance_hagar_primary_lifetime 5
  set g_balance_hagar_primary_refire 0.15
@@@ -541,15 -542,17 +542,17 @@@ set g_balance_hagar_primary_ammo 
  set g_balance_hagar_secondary 1
  set g_balance_hagar_secondary_load 1
  set g_balance_hagar_secondary_load_speed 0.5
+ set g_balance_hagar_secondary_load_spread 0.075
+ set g_balance_hagar_secondary_load_spread_bias 0.5
  set g_balance_hagar_secondary_load_max 4
 -set g_balance_hagar_secondary_load_hold 1
 +set g_balance_hagar_secondary_load_hold 2.5
  set g_balance_hagar_secondary_load_releasedeath 0
  set g_balance_hagar_secondary_load_abort 1
  set g_balance_hagar_secondary_damage 40
  set g_balance_hagar_secondary_edgedamage 20
  set g_balance_hagar_secondary_force 50
  set g_balance_hagar_secondary_radius 80
- set g_balance_hagar_secondary_spread 0.05
+ set g_balance_hagar_secondary_spread 0.06
  set g_balance_hagar_secondary_speed 2000
  set g_balance_hagar_secondary_lifetime_min 10
  set g_balance_hagar_secondary_lifetime_rand 0
@@@ -562,7 -565,7 +565,7 @@@ set g_balance_hagar_reload_time 
  set g_balance_rocketlauncher_damage 80
  set g_balance_rocketlauncher_edgedamage 40
  set g_balance_rocketlauncher_force 400
- set g_balance_rocketlauncher_radius 100
+ set g_balance_rocketlauncher_radius 110
  set g_balance_rocketlauncher_speed 1500
  set g_balance_rocketlauncher_speedaccel 1500
  set g_balance_rocketlauncher_speedstart 800
@@@ -580,7 -583,7 +583,7 @@@ set g_balance_rocketlauncher_guidedela
  set g_balance_rocketlauncher_guidestop 0 // stop guiding when firing again
  set g_balance_rocketlauncher_remote_damage 70
  set g_balance_rocketlauncher_remote_edgedamage 35
- set g_balance_rocketlauncher_remote_radius 100
+ set g_balance_rocketlauncher_remote_radius 110
  set g_balance_rocketlauncher_remote_force 400
  set g_balance_rocketlauncher_reload_ammo 0 //default: 25
  set g_balance_rocketlauncher_reload_time 2
@@@ -653,8 -656,8 +656,8 @@@ set g_balance_hlac_reload_time 
  set g_balance_rifle_bursttime 0
  set g_balance_rifle_primary_tracer 1
  set g_balance_rifle_primary_shots 1
- set g_balance_rifle_primary_damage 30
- set g_balance_rifle_primary_headshotaddeddamage 30
+ set g_balance_rifle_primary_damage 40
+ set g_balance_rifle_primary_headshotaddeddamage 40
  set g_balance_rifle_primary_spread 0
  set g_balance_rifle_primary_force 100
  set g_balance_rifle_primary_speed 40000
@@@ -670,8 -673,8 +673,8 @@@ set g_balance_rifle_secondary_reload 
  set g_balance_rifle_secondary_tracer 0
  set g_balance_rifle_secondary_shots 4
  set g_balance_rifle_secondary_damage 10
- set g_balance_rifle_secondary_headshotaddeddamage 10
- set g_balance_rifle_secondary_spread 0.02
+ set g_balance_rifle_secondary_headshotaddeddamage 20
+ set g_balance_rifle_secondary_spread 0.04
  set g_balance_rifle_secondary_force 50
  set g_balance_rifle_secondary_speed 20000
  set g_balance_rifle_secondary_lifetime 5
@@@ -694,6 -697,7 +697,7 @@@ set g_balance_tuba_damage 
  set g_balance_tuba_edgedamage 0
  set g_balance_tuba_radius 200
  set g_balance_tuba_force 40
+ set g_balance_tuba_pitchstep 6
  // }}}
  // {{{ fireball // this is a superweapon -- lets make it behave as one. 
  set g_balance_fireball_primary_ammo 20
diff --combined qcsrc/server/w_hagar.qc
index cca71f7d4770a66f9b90789e1af1efacc9b38f0f,080eea39e453fe7ed7a7704bc1d6d8aae3321e45..147613afb304f1774c564934a9769e7f0eb563cb
@@@ -47,7 -47,7 +47,7 @@@ void W_Hagar_Attack (void
  
        W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_hagar_primary_ammo, autocvar_g_balance_hagar_reload_ammo);
  
-       W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CHAN_WEAPON, autocvar_g_balance_hagar_primary_damage);
+       W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, autocvar_g_balance_hagar_primary_damage);
  
        pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
  
@@@ -82,7 -82,7 +82,7 @@@ void W_Hagar_Attack2 (void
  
        W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_hagar_secondary_ammo, autocvar_g_balance_hagar_reload_ammo);
  
-       W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CHAN_WEAPON, autocvar_g_balance_hagar_secondary_damage);
+       W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, autocvar_g_balance_hagar_secondary_damage);
  
        pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
  
@@@ -118,7 -118,7 +118,7 @@@ void W_Hagar_Attack2_Load_Release (void
        // time to release the rockets we've loaded
  
        local entity missile;
-       local float counter, shots;
+       local float counter, shots, spread_pershot;
        local vector s;
        vector forward, right, up;
  
  
        weapon_prepareattack_do(1, autocvar_g_balance_hagar_secondary_refire);
  
-       W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CHAN_WEAPON, autocvar_g_balance_hagar_secondary_damage);
+       W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, autocvar_g_balance_hagar_secondary_damage);
        pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
  
        forward = v_forward;
                setorigin (missile, w_shotorg);
                setsize(missile, '0 0 0', '0 0 0');
                missile.movetype = MOVETYPE_FLY;
+               
+               // per-shot spread calculation: the more shots there are, the less spread is applied (based on the bias cvar)
+               spread_pershot = ((shots - 1) / (autocvar_g_balance_hagar_secondary_load_max - 1)); 
+               spread_pershot = (1 - (spread_pershot * autocvar_g_balance_hagar_secondary_load_spread_bias));
+               spread_pershot = (autocvar_g_balance_hagar_secondary_spread * spread_pershot * g_weaponspreadfactor);
+               
+               // pattern spread calculation
                s = '0 0 0';
                if (counter == 0)
                        s = '0 0 0';
                        s_y = v_forward_x;
                        s_z = v_forward_y;
                }
-               s = s * cvar("g_balance_hagar_secondary_spread") * g_weaponspreadfactor;
-               W_SetupProjectileVelocityEx(missile, w_shotdir + right * s_y + up * s_z, v_up, cvar("g_balance_hagar_secondary_speed"), 0, 0, 0, FALSE);
+               s = s * autocvar_g_balance_hagar_secondary_load_spread * g_weaponspreadfactor;
+               
+               W_SetupProjectileVelocityEx(missile, w_shotdir + right * s_y + up * s_z, v_up, autocvar_g_balance_hagar_secondary_speed, 0, 0, spread_pershot, FALSE);
  
                missile.angles = vectoangles (missile.velocity);
                missile.flags = FL_PROJECTILE;
        }
  
        weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hagar_secondary_refire, w_ready);
-       self.hagar_loadstep = time + autocvar_g_balance_hagar_secondary_refire;
+       self.hagar_loadstep = time + autocvar_g_balance_hagar_secondary_refire * W_WeaponRateFactor();
        self.hagar_load = 0;
  }
  
@@@ -201,12 -208,13 +208,13 @@@ void W_Hagar_Attack2_Load (void
                        if(self.hagar_load)
                        {
                                // if we pressed primary fire while loading, unload all rockets and abort
+                               self.weaponentity.state = WS_READY;
                                W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_hagar_secondary_ammo * self.hagar_load * -1, autocvar_g_balance_hagar_reload_ammo); // give back ammo
                                self.hagar_load = 0;
-                               sound(self, CHAN_WEAPON, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM);
+                               sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM);
  
                                // pause until we can load rockets again, once we re-press the alt fire button
-                               self.hagar_loadstep = time + autocvar_g_balance_hagar_secondary_load_speed;
+                               self.hagar_loadstep = time + autocvar_g_balance_hagar_secondary_load_speed * W_WeaponRateFactor();
  
                                // require letting go of the alt fire button before we can load again
                                self.hagar_loadblock = TRUE;
                                if(!self.hagar_loadblock && self.hagar_loadstep < time)
                                {
                                        W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_hagar_secondary_ammo, autocvar_g_balance_hagar_reload_ammo);
+                                       self.weaponentity.state = WS_INUSE;
                                        self.hagar_load += 1;
-                                       sound(self, CHAN_WEAPON2, "weapons/hagar_load.wav", VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most
 -                                      sound(self, CH_WEAPON_B, "weapons/hagar_load.wav", VOL_BASE, ATTN_NORM);
++                                      sound(self, CH_WEAPON_B, "weapons/hagar_load.wav", VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most
  
 -                                      self.hagar_loadstep = time + autocvar_g_balance_hagar_secondary_load_speed * W_WeaponRateFactor();
 +                                      if (self.hagar_load >= autocvar_g_balance_hagar_secondary_load_max)
-                                               self.hagar_loadstep = time + autocvar_g_balance_hagar_secondary_load_hold;
++                                              self.hagar_loadstep = time + autocvar_g_balance_hagar_secondary_load_hold * W_WeaponRateFactor();
 +                                      else
-                                               self.hagar_loadstep = time + autocvar_g_balance_hagar_secondary_load_speed;
++                                              self.hagar_loadstep = time + autocvar_g_balance_hagar_secondary_load_speed * W_WeaponRateFactor();
                                }
                        }
                        else if(!self.hagar_loadbeep && self.hagar_load) // prevents the beep from playing each frame
                        {
                                // if this is the last rocket we can load, play a beep sound to notify the player
-                               sound(self, CHAN_WEAPON, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM);
+                               sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM);
                                self.hagar_loadbeep = TRUE;
                        }
                }
  
        if(self.hagar_load)
        {
-               self.weapon_forbidchange = TRUE;
 -              if(!self.BUTTON_ATCK2 || ((loaded || !enough_ammo) && self.hagar_loadstep < time && !autocvar_g_balance_hagar_secondary_load_hold))
 +              if(!self.BUTTON_ATCK2 || ((loaded || !enough_ammo) && self.hagar_loadstep < time && autocvar_g_balance_hagar_secondary_load_hold >= 0))
+               {
+                       self.weaponentity.state = WS_READY;
                        W_Hagar_Attack2_Load_Release();
+               }
        }
        else
        {
-               self.weapon_forbidchange = FALSE;
                self.hagar_loadbeep = FALSE;
        }
  
        // we aren't checking ammo during an attack, so we must do it here
        if not(weapon_action(self.weapon, WR_CHECKAMMO1) + weapon_action(self.weapon, WR_CHECKAMMO2))
        {
+               // note: this doesn't force the switch
                W_SwitchToOtherWeapon(self);
                return;
        }
@@@ -305,6 -313,15 +316,15 @@@ float w_hagar(float req
                        }
                }
        }
+       else if (req == WR_GONETHINK)
+       {
+               // we lost the weapon and want to prepare switching away
+               if(self.hagar_load)
+               {
+                       self.weaponentity.state = WS_READY;
+                       W_Hagar_Attack2_Load_Release();
+               }
+       }
        else if (req == WR_PRECACHE)
        {
                precache_model ("models/weapons/g_hagar.md3");
@@@ -368,11 -385,11 +388,11 @@@ float w_hagar(float req
                if(!w_issilent)
                {
                        if (w_random<0.15)
-                               sound(self, CHAN_PROJECTILE, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM);
+                               sound(self, CH_SHOTS, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM);
                        else if (w_random<0.7)
-                               sound(self, CHAN_PROJECTILE, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM);
+                               sound(self, CH_SHOTS, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM);
                        else
-                               sound(self, CHAN_PROJECTILE, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
+                               sound(self, CH_SHOTS, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
                }
        }
        else if(req == WR_PRECACHE)