From: Samual Lenks Date: Tue, 14 May 2013 18:56:26 +0000 (-0400) Subject: Fix weirdness with weapon_nextthink frame time on switching X-Git-Tag: xonotic-v0.7.0~47^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3d0be38bad51672e476815598ea48734baa20da8;p=xonotic%2Fxonotic-data.pk3dir.git Fix weirdness with weapon_nextthink frame time on switching --- diff --git a/qcsrc/server/cl_weapons.qc b/qcsrc/server/cl_weapons.qc index 44227fda6..34f17a613 100644 --- a/qcsrc/server/cl_weapons.qc +++ b/qcsrc/server/cl_weapons.qc @@ -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 } diff --git a/qcsrc/server/cl_weaponsystem.qc b/qcsrc/server/cl_weaponsystem.qc index cda4dc72c..26af874e2 100644 --- a/qcsrc/server/cl_weaponsystem.qc +++ b/qcsrc/server/cl_weaponsystem.qc @@ -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)