]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/Main.qc
Merge branch 'master' into mirceakitsune/damage_effects
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / Main.qc
index a097f071954555866bf9ef9350bb86cf284618f5..0c7643d0efa2019452f9eb1468cd572adf36fc9c 100644 (file)
@@ -47,7 +47,7 @@ void WaypointSprite_Load();
 void CSQC_Init(void)
 {
        prvm_language = cvar_string("prvm_language");
-       
+
 #ifdef USE_FTE
 #pragma target ID
        __engine_check = checkextension("DP_SV_WRITEPICTURE");
@@ -139,6 +139,9 @@ void CSQC_Init(void)
        GibSplash_Precache();
        Casings_Precache();
        DamageInfo_Precache();
+       Vehicles_Precache();
+       turrets_precache();
+
        if(autocvar_cl_announcer != cl_announcer_prev) {
                Announcer_Precache();
                if(cl_announcer_prev)
@@ -667,7 +670,7 @@ void Ent_ReadEntCS()
        sf = ReadByte();
 
        if(sf & 1)
-               self.sv_entnum = ReadByte() - 1;
+               self.sv_entnum = ReadByte();
        if(sf & 2)
        {
                self.origin_x = ReadShort();
@@ -679,6 +682,10 @@ void Ent_ReadEntCS()
                self.angles_y = ReadByte() * 360.0 / 256;
                self.angles_x = self.angles_z = 0;
        }
+       if(sf & 8)
+               self.healthvalue = ReadByte() * 10;
+       if(sf & 16)
+               self.armorvalue = ReadByte() * 10;
 
        entcs_receiver[self.sv_entnum] = self;
        self.entremove = Ent_RemoveEntCS;
@@ -820,8 +827,6 @@ void Ent_ClientData()
 
        if(newspectatee_status != spectatee_status)
        {
-               float i;
-
                // clear race stuff
                race_laptime = 0;
                race_checkpointtime = 0;
@@ -842,7 +847,27 @@ void Ent_Nagger()
 {
        float nags, i, j, b, f;
 
-       nags = ReadByte();
+       nags = ReadByte(); // NAGS NAGS NAGS NAGS NAGS NAGS NADZ NAGS NAGS NAGS
+
+       if(!(nags & 4))
+       {
+               if(vote_called_vote)
+                       strunzone(vote_called_vote);
+               vote_called_vote = string_null;
+               vote_active = 0;
+       }
+       else
+       {
+               vote_active = 1;
+       }
+
+       if(nags & 64)
+       {
+               vote_yescount = ReadByte();
+               vote_nocount = ReadByte();
+               vote_needed = ReadByte();
+               vote_highlighted = ReadChar();
+       }
 
        if(nags & 128)
        {
@@ -891,7 +916,7 @@ void Ent_ReadAccuracy(void)
                        weapon_accuracy[w] = -1;
                return;
        }
-       
+
        for(w = 0, f = 1; w <= WEP_LAST - WEP_FIRST; ++w, f *= 2)
        {
                if(sf & f)
@@ -907,36 +932,6 @@ 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.healthvalue = ReadByte() * 10;
-    }
-    if(sf & 2)
-    {
-        self.armorvalue = ReadByte() * 10;
-    }
-
-    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();
@@ -1003,7 +998,9 @@ 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;
+               case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
+               case ENT_CLIENT_TURRET: ent_turret(); break; 
+               case ENT_CLIENT_DAMAGEEFFECT: Ent_DamageEffect(); 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));
@@ -1122,7 +1119,7 @@ void Ent_Init()
        g_balance_electro_secondary_bouncestop = ReadCoord();
 
        nex_scope = !ReadByte();
-       sniperrifle_scope = !ReadByte();
+       rifle_scope = !ReadByte();
 
        serverflags = ReadByte();
 
@@ -1317,22 +1314,6 @@ void Net_ReadPingPLReport()
        playerslots[e].ping_movementloss = ml / 255.0;
 }
 
-void Net_VoteDialog(float highlight) {
-       if(highlight) {
-               vote_highlighted = ReadByte();
-               return;
-       }
-
-       vote_yescount = ReadByte();
-       vote_nocount = ReadByte();
-       vote_needed = ReadByte();
-       vote_active = 1;
-}
-
-void Net_VoteDialogReset() {
-       vote_active = 0;
-}
-
 void Net_Notify() {
        float type;
        type = ReadByte();
@@ -1345,6 +1326,17 @@ void Net_Notify() {
        {
                HUD_Centerprint(ReadString(), ReadString(), ReadShort(), ReadByte());
        }
+       else if(type == CSQC_CENTERPRINT_GENERIC)
+       {
+               float id;
+               string s;
+               id = ReadByte();
+               s = ReadString();
+               if (id != 0 && s != "")
+                       centerprint_generic(id, s, ReadByte(), ReadByte());
+               else
+                       centerprint_generic(id, s, 0, 0);
+       }
 }
 
 void Net_WeaponComplain() {
@@ -1402,14 +1394,6 @@ float CSQC_Parse_TempEntity()
                        Net_TeamNagger();
                        bHandled = true;
                        break;
-               case TE_CSQC_VOTE:
-                       Net_VoteDialog(ReadByte());
-                       bHandled = true;
-                       break;
-               case TE_CSQC_VOTERESET:
-                       Net_VoteDialogReset();
-                       bHandled = true;
-                       break;
                case TE_CSQC_LIGHTNINGARC:
                        Net_ReadLightningarc();
                        bHandled = true;
@@ -1430,6 +1414,10 @@ float CSQC_Parse_TempEntity()
                        Net_WeaponComplain();
                        bHandled = true;
                        break;
+        case TE_CSQC_VEHICLESETUP:
+            Net_VehicleSetup();
+            bHandled = true;
+            break;
                default:
                        // No special logic for this temporary entity; return 0 so the engine can handle it
                        bHandled = false;