]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Working on crosshair tab for game settings menu (plus hittest stuff)
authorSamual Lenks <samual@xonotic.org>
Tue, 15 Oct 2013 19:28:17 +0000 (15:28 -0400)
committerSamual Lenks <samual@xonotic.org>
Tue, 15 Oct 2013 19:28:17 +0000 (15:28 -0400)
crosshairs.cfg
qcsrc/client/View.qc
qcsrc/client/autocvars.qh
qcsrc/menu/xonotic/dialog_settings_game.c
qcsrc/menu/xonotic/dialog_settings_game_crosshair.c

index c6a9e837b044ecb390bee079c8a811d475506454..365c22af2db9a82f6bde12d6ddaee13ad5817a78 100644 (file)
@@ -32,8 +32,9 @@ seta crosshair_hitindication_speed 5
 
 // hit testing/tracing for special effects for the crosshair
 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)"
-seta crosshair_hittest 1 "do a crosshair hit evaluation; also, the crosshair is scaled by the given number when aiming at an enemy, and blurred when aiming at a team mate"
+seta crosshair_hittest 1 "do a crosshair hit evaluation, applying effects from the _blur, _scale, and _showipact cvars"
 seta crosshair_hittest_blur 1 "blur the crosshair if the shot is obstructed"
+seta crosshair_hittest_scale 1.25 "enlarge crosshair if aiming at an enemy, shrink crosshair if shot is obstructed or aiming at a teammate"
 seta crosshair_hittest_showimpact 0 "move the crosshair to the actual impact location if obstructed"
 
 // change color based on special case
index 46920a4174db384323cdbf66f5119b2c1658e468..36b49bda977c520edeccde2ee486ad63ee609452 100644 (file)
@@ -1125,7 +1125,18 @@ void CSQC_UpdateView(float w, float h)
                        // wcross_origin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;
                        wcross_origin = project_3d_to_2d(view_origin + MAX_SHOT_DISTANCE * view_forward);
                        wcross_origin_z = 0;
-                       if(autocvar_crosshair_hittest)
+                       
+                       if(
+                               autocvar_crosshair_hittest
+                               &&
+                               (
+                                       autocvar_crosshair_hittest_blur
+                                       ||
+                                       autocvar_crosshair_hittest_scale
+                                       ||
+                                       autocvar_crosshair_hittest_showimpact
+                               )
+                       )
                        {
                                vector wcross_oldorigin;
                                wcross_oldorigin = wcross_origin;
@@ -1141,8 +1152,7 @@ void CSQC_UpdateView(float w, float h)
                                if(!autocvar_crosshair_hittest_showimpact)
                                        wcross_origin = wcross_oldorigin;
                        }
-                       else
-                               shottype = SHOTTYPE_HITWORLD;
+                       else { shottype = SHOTTYPE_HITWORLD; }
 
                        vector wcross_color = '0 0 0', wcross_size = '0 0 0';
                        string wcross_wep = "", wcross_name;
@@ -1300,9 +1310,9 @@ void CSQC_UpdateView(float w, float h)
                        }
 
                        if(shottype == SHOTTYPE_HITENEMY)
-                               wcross_scale *= autocvar_crosshair_hittest; // is not queried if hittest is 0
+                               wcross_scale *= autocvar_crosshair_hittest_scale; // is not queried if hittest is 0
                        if(shottype == SHOTTYPE_HITTEAM)
-                               wcross_scale /= autocvar_crosshair_hittest; // is not queried if hittest is 0
+                               wcross_scale /= autocvar_crosshair_hittest_scale; // is not queried if hittest is 0
 
                        f = fabs(autocvar_crosshair_effect_time);
                        if(wcross_scale != wcross_scale_goal_prev || wcross_alpha != wcross_alpha_goal_prev || wcross_color != wcross_color_goal_prev)
index 403792020ac7c7e08aa6a412f15abd5e98cffa9b..2012228f404db35c5fea8f36f674bf1d9f27eb1c 100644 (file)
@@ -113,6 +113,7 @@ string autocvar_crosshair_hitindication_per_weapon_color;
 float autocvar_crosshair_hitindication_speed;
 float autocvar_crosshair_hittest;
 float autocvar_crosshair_hittest_blur;
+var float autocvar_crosshair_hittest_scale = 1.25;
 float autocvar_crosshair_hittest_showimpact;
 float autocvar_crosshair_per_weapon;
 float autocvar_crosshair_pickup;
index bdbf1ccb6a542ce8f93dabed0325b6b6889c4e86..d38a87fb4a43978ffc74e9ebe3eb4c42cc1458f3 100644 (file)
@@ -49,55 +49,6 @@ void XonoticGameSettingsTab_fill(entity me)
 
        me.TR(me);
                me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_gentle", _("Disable gore effects and harsh language"))); // also set sv_gentle
-               
-       me.gotoRC(me, 2, 3); me.setFirstColumn(me, me.currentColumn);
-               me.TDempty(me, 0.5);
-               me.TD(me, 1, 2, e = makeXonoticButton(_("Crosshair"), '0 0 0'));
-                       e.onClick = DialogOpenButton_Click;
-                       e.onClickEntity = main.crosshairDialog;
-               setDependent(e, "crosshair_enabled", 1, 2);
-               // TODO: show status of crosshair dot and hittest and pickups and such here with text
-       me.TR(me);
-               me.TDempty(me, 0.5);
-               me.TD(me, 1, 2, e = makeXonoticButton(_("HUD"), '0 0 0'));
-                       e.onClick = DialogOpenButton_Click;
-                       e.onClickEntity = main.hudDialog;
-               // TODO: show hud config name with text here 
-       me.TR(me);
-               me.TDempty(me, 0.5);
-               me.TD(me, 1, 2, e = makeXonoticButton(_("Notification"), '0 0 0'));
-                       e.onClick = DialogOpenButton_Click;
-                       e.onClickEntity = main.notificationDialog;
-               // TODO: Show all the notification stuff here
-       me.TR(me);
-               me.TDempty(me, 0.5);
-               me.TD(me, 1, 2, e = makeXonoticButton(_("Playermodel"), '0 0 0'));
-                       e.onClick = DialogOpenButton_Click;
-                       e.onClickEntity = main.modelDialog;
-               // TODO: show csqc model settings like forcemyplayer and deglowing/ghosting bodies with text here
-       me.TR(me);
-               me.TDempty(me, 0.5);
-               me.TD(me, 1, 2, e = makeXonoticButton(_("View"), '0 0 0'));
-                       e.onClick = DialogOpenButton_Click;
-                       e.onClickEntity = main.viewDialog;
-               // TODO: show fov and other settings with text here
-       me.TR(me);
-               me.TDempty(me, 0.5);
-               me.TD(me, 1, 2, e = makeXonoticButton(_("Weapon"), '0 0 0'));
-                       e.onClick = DialogOpenButton_Click;
-                       e.onClickEntity = main.weaponsDialog;
-               // I don't really think this is useful as is, and especially it doesn't look very clean...
-               // In the future, if ALL of these buttons had some information, then it would be justified/clean
-               //me.TD(me, 1, 1, e0 = makeXonoticTextLabel(0, string_null)); 
-               //      e0.textEntity = main.weaponsDialog;
-               //      e0.allowCut = 1;
-
-       //me.gotoRC(me, me.rows - 1, 0);
-       //      me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "color -1 -1;name \"$_cl_name\";sendcvar cl_weaponpriority;sendcvar cl_autoswitch;sendcvar cl_forceplayermodels;sendcvar cl_forceplayermodelsfromxonotic;playermodel $_cl_playermodel;playerskin $_cl_playerskin", COMMANDBUTTON_APPLY));
-*/
-
-
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "sendcvar cl_gentle; sendcvar cl_allow_uidtracking; sendcvar cl_allow_uid2name;", COMMANDBUTTON_APPLY));
+       */
 }
 #endif
index 0a1875187f3ad1d68b13d76ef05f9a4905bc462e..fa5a2b82b758b1fb93e1f79ecf919d9e1f9ab47b 100644 (file)
@@ -28,7 +28,7 @@ void XonoticGameCrosshairSettingsTab_fill(entity me)
 {
        entity e;
        
-       me.TR(me);
+       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
                me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_dot", _("Enable center crosshair dot")));
                setDependent(e, "crosshair_enabled", 1, 2);
        me.TR(me);
@@ -55,41 +55,36 @@ void XonoticGameCrosshairSettingsTab_fill(entity me)
        me.TR(me);
        me.TR(me);
        me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Crosshair animations:")));
-       /*me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "crosshair_effect_scalefade", _("Smooth effects of crosshairs")));
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_ring", _("Use rings to indicate weapon status")));
+                       makeMulti(e, "crosshair_ring_reload");
                        setDependent(e, "crosshair_enabled", 1, 2);
        me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "crosshair_ring", _("Use rings to indicate weapon status")));
-                       makeMulti(e, "crosshair_ring_reload");
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(0.5, 0, "crosshair_hitindication", _("Animate crosshair when hitting an enemy")));
                        setDependent(e, "crosshair_enabled", 1, 2);
        me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(0.25, 0, "crosshair_pickup", _("Animate crosshair when picking up an item")));
+                       setDependent(e, "crosshair_enabled", 1, 2);
        me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Hit testing:")));
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_effect_scalefade", _("Smooth effects of crosshairs")));
+                       setDependent(e, "crosshair_enabled", 1, 2);
+       me.TR(me);
+       /*me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Hit testing:")));
                me.TD(me, 1, 2, e = makeXonoticTextSlider("crosshair_hittest"));
                        e.addValue(e, ZCTX(_("HTTST^Disabled")), "0");
                        e.addValue(e, ZCTX(_("HTTST^TrueAim")), "1");
                        e.addValue(e, ZCTX(_("HTTST^Enemies")), "1.25");
                        e.configureXonoticTextSliderValues(e);
-                       setDependent(e, "crosshair_enabled", 1, 2);
+                       setDependent(e, "crosshair_enabled", 1, 2);*/
+
        me.TR(me);
-               me.TDempty(me, 0.2);
                me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "crosshair_hittest_blur", _("Blur crosshair if the shot is obstructed")));
                        setDependentAND(e, "crosshair_hittest", 1, 100, "crosshair_enabled", 1, 2);
        me.TR(me);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(0.5, 0, "crosshair_hitindication", _("Animate when hitting an enemy")));
-                       setDependent(e, "crosshair_enabled", 1, 2);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(0.25, 0, "crosshair_pickup", _("Animate when picking up an item")));
-                       setDependent(e, "crosshair_enabled", 1, 2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(1.25, 0, "crosshair_hittest_scale", _("Enlarge crosshair if targeting an enemy")));
+                       setDependentAND(e, "crosshair_hittest", 1, 100, "crosshair_enabled", 1, 2);
                        
-       me.TR(me);
+       /*me.TR(me);
                        
        me.gotoRC(me, me.rows - 1, 0);
                me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));