From: Lyberta Date: Sat, 17 Feb 2018 05:21:25 +0000 (+0300) Subject: Merge branch 'master' into Lyberta/OffhandBlaster X-Git-Tag: xonotic-v0.8.5~2303^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fmerge-requests%2F534%2Fhead;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into Lyberta/OffhandBlaster --- 91819987a61f7675e34866edcb0fe3671a9b1ba4 diff --cc qcsrc/common/mutators/mutator/overkill/sv_overkill.qc index cb790afc1,20216f928..e91062394 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.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); } } diff --cc qcsrc/common/weapons/weapon/blaster.qc index 9ca40be75,ec1f070e3..e3d713d47 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@@ -193,17 -195,6 +195,17 @@@ METHOD(Blaster, wr_killmessage, Notific return WEAPON_BLASTER_MURDER; } +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_HACK(blaster, actor, weaponentity); ++ BLASTER_SECONDARY_ATTACK(blaster, actor, weaponentity); +} + #endif #ifdef CSQC diff --cc qcsrc/common/weapons/weapon/blaster.qh index 9d28e7377,0a0e7c17d..7efbdf7a5 --- a/qcsrc/common/weapons/weapon/blaster.qh +++ b/qcsrc/common/weapons/weapon/blaster.qh @@@ -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 diff --cc qcsrc/common/weapons/weapon/vaporizer.qc index 0cb3883f4,c2a9491be..7dae1b3f7 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@@ -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);