]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/Main.qc
sv_db_saveasdump and cl_db_saveasdump cvars
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / Main.qc
index 1a6996ce666bebecedf9b82fd052cca27b0856bd..9c50d7a3442d7fd36585ad836d26ced8ea07f6e6 100644 (file)
@@ -136,6 +136,7 @@ void CSQC_Init(void)
 
        // precaches
        Projectile_Precache();
+       Hook_Precache();
        GibSplash_Precache();
        Casings_Precache();
        DamageInfo_Precache();
@@ -147,23 +148,6 @@ void CSQC_Init(void)
        }
        Tuba_Precache();
 
-#ifdef UID
-       {
-               // find the user ID
-               string uid;
-               registercvar("_cl_userid", "", CVAR_SAVE);
-               uid = cvar_string("_cl_userid");
-               if(strlen(uid) < 16)
-               {
-                       uid = "";
-                       for(i = 0; i < 4; ++i)
-                               uid = strcat(uid, substring(ftos(floor(10000 + random() * 10000)), 1, -1));
-               }
-               cvar_set("_cl_userid", uid);
-               localcmd(strcat("\ncmd uid ", uid, "\n"));
-       }
-#endif
-
        get_mi_min_max_texcoords(1); // try the CLEVER way first
        minimapname = strcat("gfx/", mi_shortname, "_radar.tga");
        shortmapname = mi_shortname;
@@ -183,6 +167,7 @@ void CSQC_Init(void)
        minimapname = strzone(minimapname);
 
        WarpZone_Init();
+       hud_configure_prev = -1;
 }
 
 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
@@ -201,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();
@@ -455,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()
 {
@@ -502,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;
        }
 }
 
@@ -922,6 +913,9 @@ void(float bIsNewEntity) CSQC_Ent_Update =
                case ENT_CLIENT_WARPZONE: WarpZone_Read(bIsNewEntity); break;
                case ENT_CLIENT_WARPZONE_CAMERA: WarpZone_Camera_Read(bIsNewEntity); break;
                case ENT_CLIENT_TRIGGER_MUSIC: Ent_ReadTriggerMusic(); break;
+               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;
                default:
                        error(strcat("unknown entity type in CSQC_Ent_Update: ", ftos(self.enttype), "\n"));
                        break;
@@ -1021,9 +1015,18 @@ void Ent_Init()
 
        nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
 
-       hook_shotorigin_x = ReadCoord();
-       hook_shotorigin_y = ReadCoord();
-       hook_shotorigin_z = ReadCoord();
+       hook_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
+       hook_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
+       hook_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
+       hook_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
+       electro_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
+       electro_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
+       electro_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
+       electro_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
+       gauntlet_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
+       gauntlet_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
+       gauntlet_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
+       gauntlet_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
 
        if(forcefog)
                strunzone(forcefog);
@@ -1036,6 +1039,9 @@ void Ent_Init()
        g_balance_grenadelauncher_secondary_bouncefactor = ReadCoord();
        g_balance_grenadelauncher_secondary_bouncestop = ReadCoord();
 
+       nex_scope = !ReadByte();
+       campingrifle_scope = !ReadByte();
+
        if(!postinit)
                PostInit();
 }
@@ -1223,13 +1229,13 @@ void Net_ReadPingPLReport()
 
 void Net_VoteDialog(float highlight) {
        if(highlight) {
-               vote_highlighted = ReadShort();
+               vote_highlighted = ReadByte();
                return;
        }
 
-       vote_yescount = ReadShort();
-       vote_nocount = ReadShort();
-       vote_needed = ReadShort();
+       vote_yescount = ReadByte();
+       vote_nocount = ReadByte();
+       vote_needed = ReadByte();
        vote_active = 1;
 }
 
@@ -1251,6 +1257,19 @@ void Net_Notify() {
        }
 }
 
+void Net_WeaponComplain() {
+       complain_weapon = ReadByte();
+
+       if(complain_weapon_name)
+               strunzone(complain_weapon_name);
+       complain_weapon_name = strzone(ReadString());
+
+       complain_weapon_type = ReadByte();
+
+       complain_weapon_time = time;
+       weapontime = time; // ping the weapon panel
+}
+
 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
 // You must ALWAYS first acquire the temporary ID, which is sent as a byte.
 // Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
@@ -1277,10 +1296,6 @@ float CSQC_Parse_TempEntity()
                        Net_ReadRace();
                        bHandled = true;
                        break;
-               case 13: // TE_BEAM
-                       Net_GrapplingHook();
-                       bHandled = true;
-                       break;
                case TE_CSQC_SPAWN:
                        Net_ReadSpawn();
                        bHandled = true;
@@ -1321,6 +1336,14 @@ float CSQC_Parse_TempEntity()
                        Net_Notify();
                        bHandled = true;
                        break;
+               case TE_CSQC_WEAPONCOMPLAIN:
+                       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;