Patches #1959

xonotic-data.pk3dir:Mario/weaponswitch_fixes: a S merge request: Fixes a bug that's been bothering lots of duelers (nex zooming in after ...

Added by git-manager 4 months ago. Updated 2 months ago.

Status:ClosedStart date:05/08/2014
Priority:NormalDue date:
Assignee:Mario% Done:

100%

Category:-
Target version:-

Description

Fixes a bug that's been bothering lots of duelers (nex zooming in after pressing the switchweapon button).

Repository: xonotic/xonotic-data.pk3dir.git
Commit: c7ffae8bf3ca917162ee631f6e120759d93e8109
Branch: Mario/weaponswitch_fixes

Merge commands:

cd data/xonotic-data.pk3dir
git checkout master
git reset --hard origin/master
git pull && git diff 'c7ffae8bf3ca917162ee631f6e120759d93e8109'..'origin/Mario/weaponswitch_fixes'

# please check that the diff you just saw did not contain anything complex that
# needs a new merge request, and review these changes

git merge --edit --log --no-ff 'origin/Mario/weaponswitch_fixes'

# please make sure this merge worked, and if not, fix merge conflicts and git
# commit BEFORE the next command
#
# also, THIS is the point to do final pre-merge testing
#
# use git reset --hard origin/master to bail out

git push && git push --delete origin 'Mario/weaponswitch_fixes'

Diffstat:

 qcsrc/client/View.qc       |    2 +-
 qcsrc/server/cl_weapons.qc |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Revision log:

commit c7ffae8bf3ca917162ee631f6e120759d93e8109
Author: Mario <mario.mario@y7mail.com>
Commit: Mario <mario.mario@y7mail.com>

    Fix nex still zooming after pressing the switchweapon button

User agreed to the license.

Diff:

diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc
index 85dfe54..ecbadae 100644
--- a/qcsrc/client/View.qc
+++ b/qcsrc/client/View.qc
@@ -104,7 +104,7 @@ vector GetCurrentFov(float fov)

     zoomdir = button_zoom;
     if(hud == HUD_NORMAL)
-    if((activeweapon == WEP_NEX && nex_scope) || (activeweapon == WEP_RIFLE && rifle_scope)) // do NOT use switchweapon here
+    if((activeweapon == WEP_NEX && switchweapon == activeweapon && nex_scope) || (activeweapon == WEP_RIFLE && rifle_scope)) // do NOT use switchweapon here -- why not?
         zoomdir += button_attack2;
     if(spectatee_status > 0 || isdemo())
     {
diff --git a/qcsrc/server/cl_weapons.qc b/qcsrc/server/cl_weapons.qc
index 2885e6d..f3bae2c 100644
--- a/qcsrc/server/cl_weapons.qc
+++ b/qcsrc/server/cl_weapons.qc
@@ -478,7 +478,7 @@ void W_WeaponFrame()
         v_right = ri;
         v_up = up;

-        if(w)
+        if(w && self.weapon == self.switchweapon)
             weapon_action(self.weapon, WR_THINK);
         else
             weapon_action(self.weapon, WR_GONETHINK);

History

#1 Updated by divVerent 4 months ago

  • Status changed from New to Feedback

Is the WR_GONETHINK change actually safe? It was designed to run only when you've thrown away the gun.

Please test for interference of:
reload vs switch
hook vs switch
holding a tuba note vs switch
firing electro secondary with electro_count == 3 vs switch

#2 Updated by divVerent 4 months ago

Some background: WR_THINK was also intended to be able to delay weapon switching by starting a weapon action. Switching then waits for the action's animtime to finish. Changing this sounds dangerous.

#3 Updated by Samual 4 months ago

I changed how this is handled in samual/weapons and it should already be fixed there... if not, fix it in that branch instead as that has new handling of zooming.

#4 Updated by divVerent 3 months ago

  • Assignee set to Mario

Please check in samual/weapons.

If it's fixed there, we'll apply this fix here, and merge it together with a revert into samual/weapons.

If not, we need this fix ported there too, as it'll likely conflict.

#5 Updated by Mario 3 months ago

The nex zoom bug is not fixed in samual/weapons, I also can't find a reason to keep the WR_GONETHINK check.

Creating a new branch Mario/nex_zoom_fix based on samual/weapons.

#6 Updated by Mario 2 months ago

  • Status changed from Feedback to Closed
  • % Done changed from 0 to 100

Closing for now. A new request will be made when the weapons system updates are in.

Also available in: Atom PDF