]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/Main.qc
Merge commit '683672ff5de2463c9c29cd27bc96b658e61bac98'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / Main.qc
index 3fe3bf2c2c836b05b6148ae572a2a94a9061877f..03cbd528a2cf3cbf983ef500bc57edcaf3addee3 100644 (file)
@@ -169,7 +169,9 @@ void CSQC_Init(void)
        minimapname = strzone(minimapname);
 
        WarpZone_Init();
+
        hud_configure_prev = -1;
+       tab_panel = -1;
 }
 
 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
@@ -592,6 +594,7 @@ void GameCommand(string msg)
             vote_prev = 0;
             cvar_set("cl_allow_uid2name", "1");
             vote_change = -9999;
+                       uid2name_dialog = 0;
         }
         else
         {
@@ -606,6 +609,7 @@ void GameCommand(string msg)
             vote_prev = 0;
             cvar_set("cl_allow_uid2name", "0");
             vote_change = -9999;
+                       uid2name_dialog = 0;
         }
         else
         {
@@ -805,6 +809,15 @@ void Ent_ClientData()
                race_laptime = 0;
                race_checkpointtime = 0;
        }
+       if (autocvar_hud_panel_healtharmor_progressbar_gfx)
+       {
+               if ( (spectatee_status == -1 && newspectatee_status > 0) //before observing, now spectating
+                 || (spectatee_status > 0 && newspectatee_status > 0 && spectatee_status != newspectatee_status) //changed spectated player
+               )
+                       prev_p_health = -1;
+               else if(spectatee_status && !newspectatee_status) //before observing/spectating, now playing
+                       prev_health = -1;
+       }
        spectatee_status = newspectatee_status;
 }
 
@@ -877,6 +890,41 @@ void Ent_ReadAccuracy(void)
        }
 }
 
+void Ent_ShowNames()
+{
+    float sf;
+
+    // entity init, TODO can this be done only once somehow?
+    self.the_entnum = ReadByte(); // TODO: fixme to only send once somehow
+    self.draw2d = Draw_ShowNames;
+    //self.movetype = MOVETYPE_FLY; // movetype needed so we can traceline?
+    self.mins = '-20 -20 -24';
+    self.maxs = '20 20 45';
+    self.classname = "shownames_tag";
+
+    sf = ReadByte();
+
+    if(sf & 1)
+    {
+        self.origin_x = ReadShort();
+        self.origin_y = ReadShort();
+        self.origin_z = ReadShort();
+    }
+    if(sf & 2)
+    {
+        self.healthvalue = ReadByte();
+    }
+    if(sf & 4)
+    {
+        self.armorvalue = ReadByte();
+    }
+
+    if(sf & 128) // same team
+        self.sameteam = TRUE;
+    else
+        self.sameteam = FALSE;
+}
+
 // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
 // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
 void Ent_RadarLink();
@@ -943,6 +991,7 @@ void(float bIsNewEntity) CSQC_Ent_Update =
                case ENT_CLIENT_LGBEAM: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_LGBEAM); break;
                case ENT_CLIENT_GAUNTLET: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_GAUNTLET); break;
                case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
+               case ENT_CLIENT_SHOWNAMES: Ent_ShowNames(); break;
                default:
                        //error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
                        error(sprintf(_("Unknown entity type in CSQC_Ent_Update (enttype: %d, edict: %d, classname: %s)\n"), self.enttype, num_for_edict(self), self.classname));
@@ -975,15 +1024,6 @@ void CSQC_Ent_Remove()
 
 void Gamemode_Init()
 {
-       if(gametype == GAME_ONSLAUGHT) {
-               print(strcat("Using ", minimapname, " as minimap.\n"));
-               precache_pic("gfx/ons-cp-neutral.tga");
-               precache_pic("gfx/ons-cp-red.tga");
-               precache_pic("gfx/ons-cp-blue.tga");
-               precache_pic("gfx/ons-frame.tga");
-               precache_pic("gfx/ons-frame-team.tga");
-       }
-
        if not(isdemo())
        {
                localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), "\n");
@@ -1392,7 +1432,7 @@ string getcommandkey(string text, string command)
        string keys;
        float n, j, k, l;
 
-       if (!hud_showbinds)
+       if (!autocvar_hud_showbinds)
                return text;
 
        keys = db_get(binddb, command);
@@ -1410,7 +1450,7 @@ string getcommandkey(string text, string command)
                                        keys = strcat(keys, ", ", keynumtostring(k));
 
                                ++l;
-                               if (hud_showbinds_limit > 0 && hud_showbinds_limit >= l) break;
+                               if (autocvar_hud_showbinds_limit > 0 && autocvar_hud_showbinds_limit >= l) break;
                        }
 
                }
@@ -1418,12 +1458,12 @@ string getcommandkey(string text, string command)
        }
 
        if ("" == keys) {
-               if (hud_showbinds > 1)
+               if (autocvar_hud_showbinds > 1)
                        return sprintf(_("%s (not bound)"), text);
                else
                        return text;
        }
-       else if (hud_showbinds > 1)
+       else if (autocvar_hud_showbinds > 1)
                return sprintf(_("%s (%s)"), text, keys);
        else
                return keys;