X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fmain.qc;h=a1cb0c3ee0e877d06b5d352e47b184fb9e5f8900;hb=446aed55e6fb9668f5094100de43c76c38e8cce7;hp=4b4f5a68b9f77e35ee5be552708cf7ecec9271a3;hpb=2d79d9ed30444579f4a1e3205280eec945201b9f;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 4b4f5a68b..a1cb0c3ee 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -1,28 +1,26 @@ #include "main.qh" -#include "../common/effects/qc/all.qh" -#include "hook.qh" +#include #include "hud/all.qh" #include "mapvoting.qh" #include "mutators/events.qh" #include "quickmenu.qh" #include "scoreboard.qh" #include "shownames.qh" -#include "tuba.qh" -#include "t_items.qh" +#include #include "wall.qh" #include "weapons/projectile.qh" -#include "../common/deathtypes/all.qh" -#include "../common/items/all.qh" -#include "../common/mapinfo.qh" -#include "../common/minigames/cl_minigames.qh" -#include "../common/minigames/cl_minigames_hud.qh" -#include "../common/net_notice.qh" -#include "../common/triggers/include.qh" -#include "../common/vehicles/all.qh" -#include "../lib/csqcmodel/cl_model.qh" -#include "../lib/csqcmodel/interpolate.qh" -#include "../lib/warpzone/client.qh" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // -------------------------------------------------------------------------- // BEGIN REQUIRED CSQC FUNCTIONS @@ -42,13 +40,6 @@ void CSQC_Init() LOG_INFOF("^4CSQC Build information: ^1%s\n", WATERMARK); #endif - binddb = db_create(); - tempdb = db_create(); - ClientProgsDB = db_load("client.db"); - compressShortVector_init(); - - draw_endBoldFont(); - { int i = 0; for ( ; i < 255; ++i) @@ -57,6 +48,18 @@ void CSQC_Init() maxclients = i; } + // needs to be done so early because of the constants they create + static_init(); + static_init_late(); + static_init_precache(); + + binddb = db_create(); + tempdb = db_create(); + ClientProgsDB = db_load("client.db"); + compressShortVector_init(); + + draw_endBoldFont(); + //registercommand("hud_configure"); //registercommand("hud_save"); //registercommand("menu_action"); @@ -93,11 +96,6 @@ void CSQC_Init() GetTeam(NUM_SPECTATOR, true); // add specs first - // needs to be done so early because of the constants they create - static_init(); - static_init_late(); - static_init_precache(); - // precaches if(autocvar_cl_reticle) @@ -167,6 +165,7 @@ void Shutdown() .float has_team; float SetTeam(entity o, int Team) { + devassert_once(Team); entity tm; if(teamplay) { @@ -244,7 +243,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 +269,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); } @@ -357,7 +357,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(); } @@ -672,7 +672,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) { @@ -711,11 +711,10 @@ NET_HANDLE(ENT_CLIENT_SPAWNEVENT, bool is_new) // 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 CSQC_Ent_Update(float bIsNewEntity) +void CSQC_Ent_Update(bool isnew) { SELFPARAM(); - this.sourceLocLine = __LINE__; - this.sourceLocFile = __FILE__; + this.sourceLoc = __FILE__ ":" STR(__LINE__); int t = ReadByte(); // set up the "time" global for received entities to be correct for interpolation purposes @@ -727,44 +726,43 @@ void CSQC_Ent_Update(float bIsNewEntity) else { serverprevtime = time; - serverdeltatime = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE); + serverdeltatime = STAT(MOVEVARS_TICRATE) * STAT(MOVEVARS_TIMESCALE); time = serverprevtime + serverdeltatime; } #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED - if(this.enttype) + if (this.enttype) { - if(t != this.enttype || bIsNewEntity) + 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); - bIsNewEntity = 1; + isnew = true; } } else { - if(!bIsNewEntity) + 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); - bIsNewEntity = 1; + LOG_INFOF("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", etof(this), this.entnum, t); + isnew = true; } } #endif this.enttype = t; bool done = false; FOREACH(LinkedEntities, it.m_id == t, LAMBDA( - if (bIsNewEntity) this.classname = it.netname; + if (isnew) this.classname = it.netname; if (autocvar_developer_csqcentities) - LOG_INFOF("CSQC_Ent_Update(%d) with this=%i {.entnum=%d, .enttype=%d} t=%s (%d)\n", bIsNewEntity, this, this.entnum, this.enttype, it.netname, t); - done = it.m_read(this, bIsNewEntity); + LOG_INFOF("CSQC_Ent_Update(%d) at %f with this=%i {.entnum=%d, .enttype=%d} t=%s (%d)\n", isnew, savetime, this, this.entnum, this.enttype, this.classname, t); + done = it.m_read(this, NULL, isnew); break; )); time = savetime; if (!done) { - //error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), this.enttype)); - error(sprintf("Unknown entity type in CSQC_Ent_Update (enttype: %d, edict: %d, classname: %s)\n", this.enttype, num_for_edict(this), this.classname)); + LOG_FATALF("CSQC_Ent_Update(%d) at %f with this=%i {.entnum=%d, .enttype=%d} t=%s (%d)\n", isnew, savetime, this, this.entnum, this.enttype, this.classname, t); } } @@ -848,7 +846,7 @@ bool CSQC_Parse_TempEntity() FOREACH(TempEntities, it.m_id == nTEID, LAMBDA( if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_TempEntity() nTEID=%s (%d)\n", it.netname, nTEID); - return it.m_read(NULL, true); + return it.m_read(NULL, NULL, true); )); if (autocvar_developer_csqcentities) @@ -909,22 +907,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); @@ -1075,7 +1061,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: @@ -1110,8 +1096,6 @@ NET_HANDLE(TE_CSQC_PINGPLREPORT, bool isNew) 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_type = ReadByte(); return = true;