]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/Main.qc
Merge remote branch 'origin/master' into fruitiex/cl_vyes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / Main.qc
index 0bcb9c46d3e5c27620f944e2930d90f9572a5cda..de87c0d747c66e0ce1f49f1474e74a0d74fb8b1c 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("vyes\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("vno\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;
 
@@ -917,6 +896,8 @@ void Ent_ReadAccuracy(void)
                        b = ReadByte();
                        if(b == 0)
                                weapon_accuracy[w] = -1;
+                       else if(b == 255)
+                               weapon_accuracy[w] = 1.0; // no better error handling yet, sorry
                        else
                                weapon_accuracy[w] = (b - 1.0) / 100.0;
                }