]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote branch 'origin/fruitiex/cl_vyes'
authorRudolf Polzer <divverent@alientrap.org>
Wed, 1 Dec 2010 20:14:31 +0000 (21:14 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Wed, 1 Dec 2010 20:14:31 +0000 (21:14 +0100)
defaultXonotic.cfg
keybinds.txt
qcsrc/client/Defs.qc
qcsrc/client/Main.qc
qcsrc/client/hud.qc
qcsrc/server/cl_client.qc
qcsrc/server/playerstats.qc

index 8a241f75a121dd140669fef42089d9b715e19019..1f977fc67e0aae71f08e9547ebf339ac37c6e15a 100644 (file)
@@ -1071,8 +1071,8 @@ alias vstop "cmd vote stop"
 alias vmaster "cmd vote master"
 alias vlogin "cmd vote login $*"
 alias vdo "cmd vote do $*"
-alias vyes "cmd vote yes"
-alias vno "cmd vote no"
+alias vyes "cl_cmd vyes"
+alias vno "cl_cmd vno"
 alias vdontcare "cmd vote dontcare"
 alias vabstain "cmd vote abstain"
 
index 028547ac27ac68b76f66c1c3696228247888e659..453e09165fe5fe7ea0914d71750bf1fc3b53f20a 100644 (file)
@@ -31,7 +31,6 @@
 ""                                      "View"
 "+zoom"                                 "zoom"
 "+showscores"                           "show scores"
-"+showaccuracy"                                "show accuracy"
 "screenshot"                            "screen shot"
 ""                                      ""
 ""                                      "Communicate"
index 8e47e6fa5bd880bc815444ae80c154985793ca6a..2d780381eedced49f15c67549f6455c535ae3a67 100644 (file)
@@ -271,3 +271,5 @@ string weaponorder_bypriority;
 float nex_charge_movingavg;
 
 float serverflags;
+
+float uid2name_dialog;
index ef220acefac5e4d960c8e7d7bc69faebedae5c72..24b230c8468b9c85c19de2415048848f1b132247 100644 (file)
@@ -608,6 +608,35 @@ void GameCommand(string msg)
                e.draw = DrawDebugModel;
                e.classname = "debugmodel";
        }
+    else if(cmd == "vyes")
+    {
+        if(uid2name_dialog)
+        {
+            vote_active = 0; // force the panel to disappear right as we have selected the value (to prevent it from fading out in the normal vote panel pos)
+            vote_prev = 0;
+            cvar_set("cl_allow_uid2name", "1");
+            vote_change = -9999;
+        }
+        else
+        {
+            localcmd("cmd vote yes\n");
+        }
+    }
+    else if(cmd == "vno")
+    {
+        if(uid2name_dialog)
+        {
+            vote_active = 0;
+            vote_prev = 0;
+            cvar_set("cl_allow_uid2name", "0");
+            vote_change = -9999;
+        }
+        else
+        {
+            localcmd("cmd vote no\n");
+        }
+    }
+
        else
        {
                print("Invalid command. For a list of supported commands, try cl_cmd help.\n");
@@ -627,56 +656,6 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
        local float bSkipKey;
        bSkipKey = false;
 
-       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE) && panel_fg_alpha && !scoreboard_active) // don't lock keys before we actually see what's going on
-       {
-               /*
-               string vyes_keys;
-               float keys;
-               vyes_keys = findkeysforcommand("vyes");
-               keys = tokenize(vyes_keys);
-
-               float i;
-               for (i = 0; i < keys; ++i)
-               {
-                       print(ftos(nPrimary), " ", argv(i), "\n"); 
-                       if(nPrimary == stof(argv(i)))
-                       {
-                               vote_active = 0;
-                               cvar_set("cl_allow_uid2name", "1");
-                               return TRUE;
-                       }
-               }
-
-               string vno_keys;
-               vno_keys = findkeysforcommand("vno");
-               keys = tokenize(vno_keys);
-
-               float i;
-               for (i = 0; i < keys; ++i)
-               {
-                       if(nPrimary == stof(argv(i)))
-                       {
-                               vote_active = 0;
-                               cvar_set("cl_allow_uid2name", "0");
-                               return TRUE;
-                       }
-               }
-               */ // If only I could grab F1-F12 in CSQC... but no
-
-               if(nPrimary == 121) // ascii value for y
-               {
-                       vote_active = 0;
-                       cvar_set("cl_allow_uid2name", "1");
-                       return TRUE;
-               }
-               else if(nPrimary == 110) // ascii value for n
-               {
-                       vote_active = 0;
-                       cvar_set("cl_allow_uid2name", "0");
-                       return TRUE;
-               }
-       }
-
        if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
                return true;
 
index f66e417489ba815bcd3fedfe40be2a600739f082..398df4f0164ddfb504c5cdcf90b86074dda590db 100644 (file)
@@ -3906,10 +3906,12 @@ float vote_change; // "time" when vote_active changed
 
 void HUD_VoteWindow(void) 
 {
+    uid2name_dialog = 0;
        if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
        {
                vote_active = 1;
                vote_called_vote = strzone(strcat("^2Name ^7instead of \"^1Unregistered player\"", " ^7in stats"));
+        uid2name_dialog = 1;
        }
 
        if(!autocvar_hud_panel_vote && !autocvar__hud_configure)
@@ -3950,16 +3952,18 @@ void HUD_VoteWindow(void)
 
        active_panel = HUD_PANEL_VOTE;
        HUD_Panel_UpdateCvars(vote);
-       vector pos, mySize;
-       pos = panel_pos;
-       mySize = panel_size;
 
-       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
+       if(uid2name_dialog)
        {
                panel_pos = eX * 0.3 * vid_conwidth + eY * 0.1 * vid_conheight;
                panel_size = eX * 0.4 * vid_conwidth + eY * 0.3 * vid_conheight;
        }
 
+    // these must be below above block
+       vector pos, mySize;
+       pos = panel_pos;
+       mySize = panel_size;
+
        a = vote_alpha * bound(cvar("hud_panel_vote_alreadyvoted_alpha"), 1 - vote_highlighted, 1);
        HUD_Panel_DrawBg(a);
        a = panel_fg_alpha * a;
@@ -3989,7 +3993,7 @@ void HUD_VoteWindow(void)
        mySize = newSize;
 
        s = "A vote has been called for:";
-       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
+       if(uid2name_dialog)
                s = "Allow servers to store and display your name?";
        drawstring_aspect(pos, s, eX * mySize_x + eY * (2/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL);
        s = textShortenToWidth(vote_called_vote, mySize_x, '1 1 0' * mySize_y * (1/8), stringwidth_colors);
@@ -3998,13 +4002,9 @@ void HUD_VoteWindow(void)
        drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize_y, s, eX * mySize_x + eY * (1.75/8) * mySize_y, a, DRAWFLAG_NORMAL);
 
        // print the yes/no counts
-       s = strcat("Yes (", getcommandkey("vyes", "vyes"), "): ", ftos(vote_yescount));
-       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
-               s = strcat("Yes: (press y)");
+    s = strcat("Yes (", getcommandkey("vyes", "vyes"), "): ", ftos(vote_yescount));
        drawstring_aspect(pos + eY * (4/8) * mySize_y, s, eX * 0.5 * mySize_x + eY * (1.5/8) * mySize_y, '0 1 0', a, DRAWFLAG_NORMAL);
-       s = strcat("No (", getcommandkey("vno", "vno"), "): ", ftos(vote_nocount));
-       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
-               s = strcat("No: (press n)");
+    s = strcat("No (", getcommandkey("vno", "vno"), "): ", ftos(vote_nocount));
        drawstring_aspect(pos + eX * 0.5 * mySize_x + eY * (4/8) * mySize_y, s, eX * 0.5 * mySize_x + eY * (1.5/8) * mySize_y, '1 0 0', a, DRAWFLAG_NORMAL);
 
        // draw the progress bar backgrounds
index 4eb3d585858498994c0f5d3b928557bd1798e78e..a1a8c4f900ad0a959e5993c09746868d8cb955a1 100644 (file)
@@ -3065,7 +3065,7 @@ void PlayerPostThink (void)
 
        playerdemo_write();
 
-       if((g_cts || g_race) && self.cvar_cl_allow_uid2name)
+       if((g_cts || g_race) && self.cvar_cl_allow_uid2name == 1)
        {
                if(!self.stored_netname)
                        self.stored_netname = strzone(uid2name(self.crypto_idfp));
index 829fe5767c68d7abad6bb2f41f13b7b8ee9f29d6..0ac40ee0579f64730d850225da6ecbda52e4d21e 100644 (file)
@@ -150,6 +150,6 @@ void PlayerStats_AddGlobalInfo(entity p)
        if(p.alivetime)
                PlayerStats_Event(p, PLAYERSTATS_ALIVETIME, time - p.alivetime);
        
-       if(p.cvar_cl_allow_uid2name)
+       if(p.cvar_cl_allow_uid2name == 1)
                db_put(playerstats_db, sprintf("%s:_netname", p.crypto_idfp), p.netname);
 }