]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a field to handle dual wielding status of a player's weapons
authorMario <mario@smbclan.net>
Fri, 28 Apr 2017 04:52:29 +0000 (14:52 +1000)
committerMario <mario@smbclan.net>
Fri, 28 Apr 2017 04:52:29 +0000 (14:52 +1000)
qcsrc/server/client.qc
qcsrc/server/defs.qh
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/weaponsystem.qc

index 168ca84968c5e6fc75422b18fc777880874b3c12..72ee5a7cd4c486d641370481f3797c27b7c5f20b 100644 (file)
@@ -338,6 +338,7 @@ void PutObserverInServer(entity this)
 
        this.items = 0;
        this.weapons = '0 0 0';
+       this.dual_weapons = '0 0 0';
        this.drawonlytoclient = this;
 
        this.weaponmodel = "";
@@ -1694,6 +1695,7 @@ void SpectateCopy(entity this, entity spectatee)
        this.superweapons_finished = spectatee.superweapons_finished;
        STAT(PRESSED_KEYS, this) = STAT(PRESSED_KEYS, spectatee);
        this.weapons = spectatee.weapons;
+       this.dual_weapons = spectatee.dual_weapons;
        this.vortex_charge = spectatee.vortex_charge;
        this.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo;
        this.hagar_load = spectatee.hagar_load;
index ccb361ea6908d573a09c173dac06098d0341cefa..e210151dce99f3a6e8a5cb1dd9531ebc489c51c1 100644 (file)
@@ -418,6 +418,8 @@ const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI;
 
 .void(entity this, entity player) init_for_player;
 
+.WepSet dual_weapons;
+
 IntrusiveList g_monsters;
 STATIC_INIT(g_monsters) { g_monsters = IL_NEW(); }
 
index e8b8d9a4b293c9732c7dafe777327d626c8a2d54..895c65ae29b0ab7def236c753c9fce930c3288b4 100644 (file)
@@ -61,7 +61,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
                        sprint(this, "Invalid weapon\n");
                return false;
        }
-       if (autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0 && !(wpn.spawnflags & WEP_FLAG_DUALWIELD))
+       if (autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0 && !(wpn.spawnflags & WEP_FLAG_DUALWIELD) && !(this.dual_weapons & wpn.m_wepset))
                return false; // no complaints needed
        if (this.weapons & WepSet_FromWeapon(wpn))
        {
index 1605db39d2228550b50bce4ab04041b7349e3cbe..2e4e160b3e16f1727a810cf3418a8d41b1a81b1e 100644 (file)
@@ -457,7 +457,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
                .entity wepe1 = weaponentities[0];
                entity wep1 = actor.(wepe1);
                this.m_switchweapon = wep1.m_switchweapon;
-               if(!(this.m_switchweapon.spawnflags & WEP_FLAG_DUALWIELD))
+               if(!(this.m_switchweapon.spawnflags & WEP_FLAG_DUALWIELD) && !(actor.dual_weapons & wep1.m_switchweapon.m_wepset))
                {
                        this.m_weapon = WEP_Null;
                        this.m_switchingweapon = WEP_Null;