]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix weirdness with weapon_nextthink frame time on switching
authorSamual Lenks <samual@xonotic.org>
Tue, 14 May 2013 18:56:26 +0000 (14:56 -0400)
committerSamual Lenks <samual@xonotic.org>
Tue, 14 May 2013 18:56:26 +0000 (14:56 -0400)
qcsrc/server/cl_weapons.qc
qcsrc/server/cl_weaponsystem.qc

index 44227fda6bd7dd3ea777ba43e3a70ed3849464ff..34f17a613a7f438f566b6d47859463f50729ac4b 100644 (file)
@@ -421,6 +421,7 @@ void W_WeaponFrame()
                        // VorteX: add player model weapon select frame here
                        // setcustomframe(PlayerWeaponRaise);
                        weapon_thinkf(WFRAME_IDLE, cvar(sprintf("g_balance_%s_switchdelay_raise", newwep.netname)), w_ready);
+                       //print(sprintf("W_WeaponFrame(): cvar: %s, value: %f\n", sprintf("g_balance_%s_switchdelay_raise", newwep.netname), cvar(sprintf("g_balance_%s_switchdelay_raise", newwep.netname))));
                        weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');
                }
                else if (self.weaponentity.state == WS_DROP)
@@ -443,6 +444,7 @@ void W_WeaponFrame()
                        self.weaponentity.state = WS_DROP;
                        // set up weapon switch think in the future, and start drop anim
                        weapon_thinkf(WFRAME_DONTCHANGE, cvar(sprintf("g_balance_%s_switchdelay_drop", oldwep.netname)), w_clear);
+                       //print(sprintf("W_WeaponFrame(): cvar: %s, value: %f\n", sprintf("g_balance_%s_switchdelay_drop", oldwep.netname), cvar(sprintf("g_balance_%s_switchdelay_drop", oldwep.netname))));
                        weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);
 #ifndef INDEPENDENT_ATTACK_FINISHED
                        }
index cda4dc72c423e2ed21b85dea1f5b2596d1c755a8..26af874e2afdb88abe26f2532a55a89b79622969 100644 (file)
@@ -542,17 +542,19 @@ void CL_Weaponentity_Think()
 
        self.angles = '0 0 0';
        
-       float f;
+       float f = (self.owner.weapon_nextthink - time);
        if (self.state == WS_RAISE && !intermission_running)
        {
                entity newwep = get_weaponinfo(self.owner.switchweapon);
-               f = (self.owner.weapon_nextthink - time) * g_weaponratefactor / cvar(sprintf("g_balance_%s_switchdelay_raise", newwep.netname));
+               f = f * g_weaponratefactor / max(f, cvar(sprintf("g_balance_%s_switchdelay_raise", newwep.netname)));
+               //print(sprintf("CL_Weaponentity_Think(): cvar: %s, value: %f, nextthink: %f\n", sprintf("g_balance_%s_switchdelay_raise", newwep.netname), cvar(sprintf("g_balance_%s_switchdelay_raise", newwep.netname)), (self.owner.weapon_nextthink - time)));
                self.angles_x = -90 * f * f;
        }
        else if (self.state == WS_DROP && !intermission_running)
        {
                entity oldwep = get_weaponinfo(self.owner.weapon);
-               f = 1 - (self.owner.weapon_nextthink - time) * g_weaponratefactor / cvar(sprintf("g_balance_%s_switchdelay_drop", oldwep.netname));
+               f = 1 - f * g_weaponratefactor / max(f, cvar(sprintf("g_balance_%s_switchdelay_drop", oldwep.netname)));
+               //print(sprintf("CL_Weaponentity_Think(): cvar: %s, value: %f, nextthink: %f\n", sprintf("g_balance_%s_switchdelay_drop", oldwep.netname), cvar(sprintf("g_balance_%s_switchdelay_drop", oldwep.netname)), (self.owner.weapon_nextthink - time)));
                self.angles_x = -90 * f * f;
        }
        else if (self.state == WS_CLEAR)