X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fimpulse.qc;h=f066615f326b270e81b4e98b8161aeb4312c689a;hb=969dc49d01d650a812706aba16c765af488605d0;hp=49685d49d7ec088c9a3a5a83c993dadbb7f89bbf;hpb=e0012447bfce1b551df3dc01b043655aa93dafad;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/impulse.qc b/qcsrc/server/impulse.qc index 49685d49d..f066615f3 100644 --- a/qcsrc/server/impulse.qc +++ b/qcsrc/server/impulse.qc @@ -4,11 +4,14 @@ #include "weapons/throwing.qh" #include "command/common.qh" #include "cheats.qh" +#include "client.qh" #include "clientkill.qh" #include "weapons/selection.qh" #include "weapons/tracing.qh" #include "weapons/weaponsystem.qh" +#include + #include #include "../common/minigames/sv_minigames.qh" @@ -149,7 +152,7 @@ X(9, next) for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) \ { \ .entity weaponentity = weaponentities[slot]; \ - W_SwitchWeapon_TryOthers(this, Weapons_from(WEP_FIRST + i), weaponentity); \ + W_SwitchWeapon_TryOthers(this, REGISTRY_GET(Weapons, WEP_FIRST + i), weaponentity); \ if(autocvar_g_weaponswitch_debug != 1) \ break; \ } \ @@ -320,13 +323,19 @@ IMPULSE(weapon_drop) { if (this.vehicle) return; if (IS_DEAD(this)) return; + bool is_dualwielding = W_DualWielding(this); for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { .entity weaponentity = weaponentities[slot]; - W_ThrowWeapon(this, weaponentity, W_CalculateProjectileVelocity(this, this.velocity, v_forward * 750, false), '0 0 0', true); - - if(autocvar_g_weaponswitch_debug != 1) - break; + vector md = this.(weaponentity).movedir; + vector vecs = ((md.x > 0) ? md : '0 0 0'); + vector dv = v_right * -vecs.y; + if(!is_dualwielding) + dv = '0 0 0'; // don't override! + W_ThrowWeapon(this, weaponentity, W_CalculateProjectileVelocity(this, this.velocity, v_forward * 750, false), dv, true); + + if(autocvar_g_weaponswitch_debug == 2) + break; // in this mode, the off-hand weapon is selected based on the primary weapon, don't drop it twice! } }