Merge branch 'master' into Lyberta/OffhandBlaster 534/head
authorLyberta <lyberta@lyberta.net>
Sat, 17 Feb 2018 05:21:25 +0000 (08:21 +0300)
committerLyberta <lyberta@lyberta.net>
Sat, 17 Feb 2018 05:21:25 +0000 (08:21 +0300)
1  2 
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/blaster.qh
qcsrc/common/weapons/weapon/vaporizer.qc

@@@ -144,7 -144,20 +144,7 @@@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink
                        if(player.(weaponentity).m_weapon == WEP_Null && slot != 0)
                                continue;
  
-                       BLASTER_SECONDARY_ATTACK_HACK(vaporizer, player, weaponentity);
 -                      W_Blaster_Attack(
 -                              player,
 -                              weaponentity,
 -                              WEP_BLASTER.m_id | HITTYPE_SECONDARY,
 -                              WEP_CVAR_SEC(vaporizer, shotangle),
 -                              WEP_CVAR_SEC(vaporizer, damage),
 -                              WEP_CVAR_SEC(vaporizer, edgedamage),
 -                              WEP_CVAR_SEC(vaporizer, radius),
 -                              WEP_CVAR_SEC(vaporizer, force),
 -                              WEP_CVAR_SEC(vaporizer, speed),
 -                              WEP_CVAR_SEC(vaporizer, spread),
 -                              WEP_CVAR_SEC(vaporizer, delay),
 -                              WEP_CVAR_SEC(vaporizer, lifetime)
 -                      );
++                      BLASTER_SECONDARY_ATTACK(vaporizer, player, weaponentity);
                }
        }
  
@@@ -193,17 -195,6 +195,17 @@@ METHOD(Blaster, wr_killmessage, Notific
      return WEAPON_BLASTER_MURDER;
  }
  
-       BLASTER_SECONDARY_ATTACK_HACK(blaster, actor, weaponentity);
 +METHOD(OffhandBlaster, offhand_think, void(OffhandBlaster this, entity actor, bool key_pressed))
 +{
 +      if (!key_pressed || (time < actor.jump_interval))
 +      {
 +              return;
 +      }
 +      actor.jump_interval = time + WEP_CVAR_SEC(blaster, refire) * W_WeaponRateFactor(actor);
 +      .entity weaponentity = weaponentities[1];
++      BLASTER_SECONDARY_ATTACK(blaster, actor, weaponentity);
 +}
 +
  #endif
  #ifdef CSQC
  
@@@ -59,24 -55,4 +59,22 @@@ OffhandBlaster OFFHAND_BLASTER; STATIC_
  .float blaster_force;
  .float blaster_lifetime;
  
- #define BLASTER_SECONDARY_ATTACK_HACK(weapon_name, actor, weaponentity) \
++// Will be demacroed after WEP_CVAR macros are also demacroed.
++#define BLASTER_SECONDARY_ATTACK(weapon_name, actor, weaponentity) \
 +      makevectors(actor.v_angle); \
-       Weapon oldwep = actor.(weaponentity).m_weapon; \
-       actor.(weaponentity).m_weapon = WEP_BLASTER; \
 +      W_Blaster_Attack( \
 +              actor, \
 +              weaponentity, \
 +              WEP_BLASTER.m_id | HITTYPE_SECONDARY, \
 +              WEP_CVAR_SEC(weapon_name, shotangle), \
 +              WEP_CVAR_SEC(weapon_name, damage), \
 +              WEP_CVAR_SEC(weapon_name, edgedamage), \
 +              WEP_CVAR_SEC(weapon_name, radius), \
 +              WEP_CVAR_SEC(weapon_name, force), \
 +              WEP_CVAR_SEC(weapon_name, speed), \
 +              WEP_CVAR_SEC(weapon_name, spread), \
 +              WEP_CVAR_SEC(weapon_name, delay), \
 +              WEP_CVAR_SEC(weapon_name, lifetime) \
-       ); \
-       actor.(weaponentity).m_weapon = oldwep;
++      );
 +
  #endif
@@@ -342,7 -338,22 +338,7 @@@ METHOD(Vaporizer, wr_think, void(entit
              if(WEP_CVAR_SEC(vaporizer, ammo))
                  W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(vaporizer, ammo), weaponentity);
  
-             BLASTER_SECONDARY_ATTACK_HACK(vaporizer, actor, weaponentity);
 -            // ugly instagib hack to reuse the fire mode of the laser
 -            makevectors(actor.v_angle);
 -            W_Blaster_Attack(
 -                actor,
 -                weaponentity,
 -                WEP_BLASTER.m_id | HITTYPE_SECONDARY,
 -                WEP_CVAR_SEC(vaporizer, shotangle),
 -                WEP_CVAR_SEC(vaporizer, damage),
 -                WEP_CVAR_SEC(vaporizer, edgedamage),
 -                WEP_CVAR_SEC(vaporizer, radius),
 -                WEP_CVAR_SEC(vaporizer, force),
 -                WEP_CVAR_SEC(vaporizer, speed),
 -                WEP_CVAR_SEC(vaporizer, spread),
 -                WEP_CVAR_SEC(vaporizer, delay),
 -                WEP_CVAR_SEC(vaporizer, lifetime)
 -            );
++            BLASTER_SECONDARY_ATTACK(vaporizer, actor, weaponentity);
  
              // now do normal refire
              weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);