]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/main.qc
etof: avoid tempstring
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / main.qc
index 1d543af2607457e97cf3fa85338116f72a5ce864..8e9e14a3a6ceaa57d2926bdfb31b9c60ec6116ff 100644 (file)
@@ -167,6 +167,7 @@ void Shutdown()
 .float has_team;
 float SetTeam(entity o, int Team)
 {
+       assert_once(Team);
        entity tm;
        if(teamplay)
        {
@@ -244,7 +245,7 @@ void Playerchecker_Think()
        for(i = 0; i < maxclients; ++i)
        {
                e = playerslots[i];
-               if(GetPlayerName(i) == "")
+               if(entcs_GetName(i) == "")
                {
                        if(e.sort_prev)
                        {
@@ -270,7 +271,8 @@ void Playerchecker_Think()
                                e.ping_packetloss = 0;
                                e.ping_movementloss = 0;
                                //e.gotscores = 0; // we might already have the scores...
-                               SetTeam(e, GetPlayerColor(i)); // will not hurt; later updates come with HUD_UpdatePlayerTeams
+                               int t = entcs_GetScoreTeam(i);
+                               if (t) SetTeam(e, t); // will not hurt; later updates come with HUD_UpdatePlayerTeams
                                RegisterPlayer(e);
                                HUD_UpdatePlayerPos(e);
                        }
@@ -327,47 +329,6 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
 // --------------------------------------------------------------------------
 // BEGIN OPTIONAL CSQC FUNCTIONS
 
-void Ent_RemoveEntCS()
-{
-       SELFPARAM();
-       entcs_receiver[this.sv_entnum] = NULL;
-}
-
-NET_HANDLE(ENT_CLIENT_ENTCS, bool isnew)
-{
-       make_pure(this);
-       this.classname = "entcs_receiver";
-       InterpolateOrigin_Undo();
-       int sf = ReadByte();
-
-       if(sf & BIT(0))
-               this.sv_entnum = ReadByte();
-       if (sf & BIT(1))
-       {
-               this.origin_x = ReadShort();
-               this.origin_y = ReadShort();
-               this.origin_z = ReadShort();
-               setorigin(this, this.origin);
-       }
-       if (sf & BIT(2))
-       {
-               this.angles_y = ReadByte() * 360.0 / 256;
-               this.angles_x = this.angles_z = 0;
-       }
-       if (sf & BIT(3))
-               this.healthvalue = ReadByte() * 10;
-       if (sf & BIT(4))
-               this.armorvalue = ReadByte() * 10;
-
-       return = true;
-
-       entcs_receiver[this.sv_entnum] = this;
-       this.entremove = Ent_RemoveEntCS;
-       this.iflags |= IFLAG_ORIGIN;
-
-       InterpolateOrigin_Note();
-}
-
 void Ent_Remove();
 
 void Ent_RemovePlayerScore()
@@ -398,7 +359,7 @@ NET_HANDLE(ENT_CLIENT_SCORES, bool isnew)
        if(!isNew && n != this.sv_entnum)
        {
                //print("A CSQC entity changed its owner!\n");
-               LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", num_for_edict(this), this.classname);
+               LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", etof(this), this.classname);
                isNew = true;
                Ent_Remove();
        }
@@ -713,7 +674,7 @@ NET_HANDLE(ENT_CLIENT_SPAWNEVENT, bool is_new)
 
                if(is_new)
                {
-                       float teamnum = GetPlayerColor(entnum - 1);
+                       float teamnum = entcs_GetTeam(entnum - 1);
 
                        if(autocvar_cl_spawn_event_particles)
                        {
@@ -768,7 +729,7 @@ void CSQC_Ent_Update(bool isnew)
        else
        {
                serverprevtime = time;
-               serverdeltatime = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
+               serverdeltatime = STAT(MOVEVARS_TICRATE) * STAT(MOVEVARS_TIMESCALE);
                time = serverprevtime + serverdeltatime;
        }
 
@@ -777,7 +738,7 @@ void CSQC_Ent_Update(bool isnew)
        {
                if (t != this.enttype || isnew)
                {
-                       LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", num_for_edict(this), this.entnum, this.enttype, t);
+                       LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", etof(this), this.entnum, this.enttype, t);
                        Ent_Remove();
                        clearentity(this);
                        isnew = true;
@@ -787,7 +748,7 @@ void CSQC_Ent_Update(bool isnew)
        {
                if (!isnew)
                {
-                       LOG_INFOF("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", num_for_edict(this), this.entnum, t);
+                       LOG_INFOF("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", etof(this), this.entnum, t);
                        isnew = true;
                }
        }
@@ -949,22 +910,10 @@ NET_HANDLE(ENT_CLIENT_INIT, bool isnew)
 
        armorblockpercent = ReadByte() / 255.0;
 
-       g_balance_mortar_bouncefactor = ReadCoord();
-       g_balance_mortar_bouncestop = ReadCoord();
-       g_balance_electro_secondary_bouncefactor = ReadCoord();
-       g_balance_electro_secondary_bouncestop = ReadCoord();
-
-       vortex_scope = !ReadByte();
-       rifle_scope = !ReadByte();
-
        serverflags = ReadByte();
 
-       minelayer_maxmines = ReadByte();
-
-       hagar_maxrockets = ReadByte();
-
        g_trueaim_minrange = ReadCoord();
-       g_balance_porto_secondary = ReadByte();
+
        return = true;
 
        MUTATOR_CALLHOOK(Ent_Init);
@@ -1115,7 +1064,7 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                                strunzone(grecordholder[pos-1]);
                        grecordholder[pos-1] = strzone(ReadString());
                        grecordtime[pos-1] = ReadInt24_t();
-                       if(grecordholder[pos-1] == GetPlayerName(player_localnum))
+                       if(grecordholder[pos-1] == entcs_GetName(player_localnum))
                                race_myrank = pos;
                        break;
                case RACE_NET_SERVER_STATUS:
@@ -1151,7 +1100,7 @@ NET_HANDLE(TE_CSQC_WEAPONCOMPLAIN, bool isNew)
 {
        complain_weapon = ReadByte();
        if (complain_weapon_name) strunzone(complain_weapon_name);
-       complain_weapon_name = strzone(WEP_NAME(complain_weapon));
+       complain_weapon_name = strzone(Weapons_from(complain_weapon).m_name);
        complain_weapon_type = ReadByte();
        return = true;