]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
proper uid2name frontend, fixes to backend
authorFruitieX <rasse@rasse-laptop.(none)>
Tue, 26 Oct 2010 13:51:09 +0000 (16:51 +0300)
committerFruitieX <rasse@rasse-laptop.(none)>
Tue, 26 Oct 2010 13:51:09 +0000 (16:51 +0300)
qcsrc/client/Main.qc
qcsrc/client/hud.qc

index c20d45f3c1a456501ea252089503ac067bbf2ced..60aa6b90b1a4cb33fbf241f484db8ade81cd4c1a 100644 (file)
@@ -624,18 +624,9 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
        local float bSkipKey;
        bSkipKey = false;
 
-       if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
-               return true;
-
-       if (MapVote_InputEvent(bInputType, nPrimary, nSecondary))
-               return true;
-
-       if(menu_visible)
-               if(menu_action(bInputType, nPrimary, nSecondary))
-                       return TRUE;
-
-       if(autocvar_cl_allow_uid2name == -1 && gametype == GAME_CTS || gametype == GAME_RACE && panel_fg_alpha) // don't lock keys before we actually see what's going on
+       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");
@@ -644,10 +635,12 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
                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;
+                               return TRUE;
                        }
                }
 
@@ -660,12 +653,44 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
                {
                        if(nPrimary == stof(argv(i)))
                        {
+                               vote_active = 0;
                                cvar_set("cl_allow_uid2name", "0");
-                               return true;
+                               return TRUE;
                        }
                }
+               */ // If only I could grab F1-F12 in CSQC... but no
+
+               print(ftos(nPrimary), "\n");
+
+               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;
+               }
+               else if(nPrimary == 27) // ascii value for esc
+               {
+                       return FALSE;
+               }
+               return TRUE; // capture all other keys to get more attention
        }
 
+       if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
+               return true;
+
+       if (MapVote_InputEvent(bInputType, nPrimary, nSecondary))
+               return true;
+
+       if(menu_visible)
+               if(menu_action(bInputType, nPrimary, nSecondary))
+                       return TRUE;
+
        return bSkipKey;
 }
 
index 2a9560552fd73586540ac33750cbf70b04f0a32d..e3ef718e1ce422b89aa8a979774a3a55c33239f1 100644 (file)
@@ -3767,10 +3767,10 @@ float vote_change; // "time" when vote_active changed
 
 void HUD_VoteWindow(void) 
 {
-       if(autocvar_cl_allow_uid2name == -1 && gametype == GAME_CTS || gametype == GAME_RACE)
+       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
        {
                vote_active = 1;
-               vote_called_vote = "This allows your name to be identified in stats instead of \"Unregistered player\"";
+               vote_called_vote = "^2Name ^7instead of \"^1Unregistered player\" ^7in stats";
        }
 
        if(!autocvar_hud_panel_vote && !autocvar__hud_configure)
@@ -3778,6 +3778,11 @@ void HUD_VoteWindow(void)
 
        active_panel = HUD_PANEL_VOTE;
        HUD_Panel_UpdateCvars(vote);
+       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
+       {
+               panel_pos = eX * 0.3 * vid_conwidth + eY * 0.1 * vid_conheight;
+               panel_size = eX * 0.4 * vid_conwidth + eY * 0.3 * vid_conheight;
+       }
        vector pos, mySize;
        pos = panel_pos;
        mySize = panel_size;
@@ -3843,18 +3848,22 @@ 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(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
                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.75/8), stringwidth_colors);
+       s = textShortenToWidth(vote_called_vote, mySize_x, '1 1 0' * mySize_y * (1/8), stringwidth_colors);
        if(autocvar__hud_configure)
                s = "^1Configure the HUD";
        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)");
        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)");
        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