From d2508b3454ae9e0d13baaf878b0b6ce51fe43e07 Mon Sep 17 00:00:00 2001
From: Rudolf Polzer <divverent@xonotic.org>
Date: Fri, 10 Jun 2011 23:09:38 +0200
Subject: [PATCH] change default of cl_gunalign to "right only"; add "Center"
 item to the menu; allow Center choice by default

---
 defaultXonotic.cfg                                          | 6 +++---
 qcsrc/client/hook.qc                                        | 4 ++--
 qcsrc/menu/xonotic/dialog_multiplayer_playersetup_weapons.c | 6 ++++--
 qcsrc/server/g_hook.qc                                      | 4 ++--
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg
index 8cc42a7cae..c7432db18d 100644
--- a/defaultXonotic.cfg
+++ b/defaultXonotic.cfg
@@ -493,7 +493,7 @@ seta g_antilag 2	"AntiLag (0 = no AntiLag, 1 = verified client side hit scan, 2
 set g_trueaim_minrange 44 "TrueAim minimum range (TrueAim adjusts shots so they hit the crosshair point even though the gun is not at the screen center)"
 set g_antilag_nudge 0 "don't touch"
 set g_antilag_bullets 1 "Bullets AntiLag (0 = no AntiLag, 1 = server side hit scan in the past) - DO NOT TOUCH (severely changes weapon balance)"
-set g_shootfromclient 1 "let client decide if it has the gun left or right; if set to 2, center handedness is allowed, and defaulted to, too; see also cl_gunalign"
+set g_shootfromclient 2 "let client decide if it has the gun left or right; if set to 2, center handedness is allowed; see also cl_gunalign"
 set g_shootfromeye 0 "shots are fired from your eye/crosshair; visual gun position can still be influenced by cl_gunalign 1 and 2"
 set g_shootfromcenter 0 "weapon gets moved to the center, shots still come from the barrel of your weapon; visual gun position can still be influenced by cl_gunalign 1 and 2"
 set g_shootfromfixedorigin "" "if set to a string like 0 y z, the gun is moved to the given y and z coordinates. If set to a string like x y z, the whole shot origin is used"
@@ -909,7 +909,7 @@ r_shadow_realtime_world_lightmaps 1
 seta r_ambient 4
 cl_decals_fadetime 5
 cl_decals_time 2
-seta cl_gunalign 3 "Gun alignment; 1 = right, 2 = left, 3 = center or right, 4 = center or left"
+seta cl_gunalign 1 "Gun alignment; 1 = right, 2 = left, 3 = center (if allowed by g_shootfromclient) or right, 4 = center (if allowed by g_shootfromclient) or left"
 seta cl_nogibs 0 "reduce number of violence effects, or remove them totally"
 seta cl_particlegibs 0 "simpler gibs"
 seta cl_gibs_damageforcescale 3.5 "force to push around gibs"
@@ -1901,7 +1901,7 @@ seta cl_vehicle_spiderbot_cross_alpha 0.6
 seta cl_vehicle_spiderbot_cross_size 1
 
 //cl_gunalign calculator
-seta menu_cl_gunalign 3 "Gun alignment; 1 = right, 2 = left, 3 = center or right, 4 = center or left"
+seta menu_cl_gunalign 1 "Gun alignment; 1 = right, 2 = left, 3 = center (if allowed by g_shootfromclient) or right, 4 = center (if allowed by g_shootfromclient) or left"
 alias _gunalign_01 "cl_gunalign 1"
 alias _gunalign_02 "cl_gunalign 2"
 alias _gunalign_03 "cl_gunalign 3"
diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc
index 7ff5adeca4..c1a50c0108 100644
--- a/qcsrc/client/hook.qc
+++ b/qcsrc/client/hook.qc
@@ -66,8 +66,8 @@ void Draw_GrapplingHook()
 	InterpolateOrigin_Do();
 
 	s = autocvar_cl_gunalign;
-	if(s != 1 && s != 2 && s != 4)
-		s = 3; // default value
+	if(s != 2 && s != 3 && s != 4)
+		s = 1; // default value
 	--s;
 	switch(self.HookType)
 	{
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_playersetup_weapons.c b/qcsrc/menu/xonotic/dialog_multiplayer_playersetup_weapons.c
index d20a6483bb..233b5e7243 100644
--- a/qcsrc/menu/xonotic/dialog_multiplayer_playersetup_weapons.c
+++ b/qcsrc/menu/xonotic/dialog_multiplayer_playersetup_weapons.c
@@ -45,9 +45,11 @@ void XonoticWeaponsDialog_fill(entity me)
 		me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "r_drawviewmodel", _("Draw 1st person weapon model")));
 	me.TR(me);
 		me.TDempty(me, 0.2);
-		me.TD(me, 1, 1.4, e = makeXonoticRadioButton(1, "cl_gunalign", "4", _("Left align")));
+		me.TD(me, 1, 0.9, e = makeXonoticRadioButton(1, "cl_gunalign", "2", _("Left align")));
 			setDependent(e, "r_drawviewmodel", 1, 1);
-		me.TD(me, 1, 1.4, e = makeXonoticRadioButton(1, "cl_gunalign", "3", _("Right align")));
+		me.TD(me, 1, 0.9, e = makeXonoticRadioButton(1, "cl_gunalign", "3", _("Center")));
+			setDependent(e, "r_drawviewmodel", 1, 1);
+		me.TD(me, 1, 1.0, e = makeXonoticRadioButton(1, "cl_gunalign", "1", _("Right align")));
 			setDependent(e, "r_drawviewmodel", 1, 1);
 	me.TR(me);
 		me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "v_flipped", _("Flip view horizontally")));
diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc
index dd6d73effd..beb041cbbe 100644
--- a/qcsrc/server/g_hook.qc
+++ b/qcsrc/server/g_hook.qc
@@ -338,8 +338,8 @@ void FireGrapplingHook (void)
 	makevectors(self.v_angle);
 
 	s = self.cvar_cl_gunalign;
-	if(s != 1 && s != 2 && s != 4)
-		s = 3; // default value
+	if(s != 2 && s != 3 && s != 4)
+		s = 1; // default value
 	--s;
 	vs = hook_shotorigin[s];
 
-- 
2.39.5