]> 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 320ed94727aed077678eda54eade821b53ece437..de87c0d747c66e0ce1f49f1474e74a0d74fb8b1c 100644 (file)
@@ -186,7 +186,10 @@ void CSQC_Shutdown(void)
        remove(players);
        db_close(binddb);
        db_close(tempdb);
-       db_save(ClientProgsDB, "client.db");
+       if(cvar("cl_db_saveasdump"))
+               db_dump(ClientProgsDB, "client.db");
+       else
+               db_save(ClientProgsDB, "client.db");
        db_close(ClientProgsDB);
 
        cvar_clientsettemp_restore();
@@ -440,7 +443,9 @@ void ShotOrg_Draw()
        self.angles = view_angles;
        self.angles_x = -self.angles_x;
        if not(self.cnt)
-               R_AddEntity(self);
+               self.drawmask = MASK_NORMAL;
+       else
+               self.drawmask = 0;
 }
 void ShotOrg_Draw2D()
 {
@@ -487,11 +492,12 @@ void DrawDebugModel()
        if(time - floor(time) > 0.5)
        {
                PolyDrawModel(self);
+               self.drawmask = 0;
        }
        else
        {
                self.renderflags = 0;
-               R_AddEntity(self);
+               self.drawmask = MASK_NORMAL;
        }
 }
 
@@ -602,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");
@@ -630,6 +665,7 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
        if(menu_visible)
                if(menu_action(bInputType, nPrimary, nSecondary))
                        return TRUE;
+
        return bSkipKey;
 }
 
@@ -791,11 +827,6 @@ void Ent_ClientData()
        if(newspectatee_status != spectatee_status)
        {
                float i;
-               // clear the weapon accuracy stats
-               for(i = WEP_FIRST; i <= WEP_LAST; ++i) {
-                       weapon_hits[i] = 0;
-                       weapon_fired[i] = 0;
-               }
 
                // clear race stuff
                race_laptime = 0;
@@ -847,6 +878,32 @@ void Ent_RandomSeed()
        psrandom(s);
 }
 
+void Ent_ReadAccuracy(void)
+{
+       float sf, f, w, b;
+       sf = ReadInt24_t();
+       if(sf == 0)
+       {
+               for(w = 0; w <= WEP_LAST - WEP_FIRST; ++w)
+                       weapon_accuracy[w] = -1;
+               return;
+       }
+       
+       for(w = 0, f = 1; w <= WEP_LAST - WEP_FIRST; ++w, f *= 2)
+       {
+               if(sf & f)
+               {
+                       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;
+               }
+       }
+}
+
 // 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();
@@ -910,6 +967,7 @@ void(float bIsNewEntity) CSQC_Ent_Update =
                case ENT_CLIENT_HOOK: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_HOOK); break;
                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;
                default:
                        error(strcat("unknown entity type in CSQC_Ent_Update: ", ftos(self.enttype), "\n"));
                        break;
@@ -1030,12 +1088,16 @@ void Ent_Init()
 
        g_weaponswitchdelay = ReadByte() / 255.0;
 
-       g_balance_grenadelauncher_secondary_bouncefactor = ReadCoord();
-       g_balance_grenadelauncher_secondary_bouncestop = ReadCoord();
+       g_balance_grenadelauncher_bouncefactor = ReadCoord();
+       g_balance_grenadelauncher_bouncestop = ReadCoord();
+       g_balance_electro_secondary_bouncefactor = ReadCoord();
+       g_balance_electro_secondary_bouncestop = ReadCoord();
 
        nex_scope = !ReadByte();
        campingrifle_scope = !ReadByte();
 
+       serverflags = ReadByte();
+
        if(!postinit)
                PostInit();
 }
@@ -1334,6 +1396,10 @@ float CSQC_Parse_TempEntity()
                        Net_WeaponComplain();
                        bHandled = true;
                        break;
+               case TE_CSQC_CR_MAXBULLETS:
+                       cr_maxbullets = ReadByte();
+                       bHandled = true;
+                       break;
                default:
                        // No special logic for this temporary entity; return 0 so the engine can handle it
                        bHandled = false;