X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2FMain.qc;h=fe9fd6dd38a5b4aa8e736136864f40c0416e8d8e;hb=cfdec7de4f6fff90a2142be820eaeb43a5f7f572;hp=a57888e7065e4a65b467bfbc707554e097e7e8c8;hpb=7e957e97bcf2f9c6b773d9e1f6cf78041f538500;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index a57888e70..fe9fd6dd3 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -2,6 +2,19 @@ // BEGIN REQUIRED CSQC FUNCTIONS //include "main.qh" +entity clearentity_ent; +void clearentity(entity e) +{ + if not(clearentity_ent) + { + clearentity_ent = spawn(); + clearentity_ent.classname = "clearentity"; + } + float n = e.entnum; + copyentity(clearentity_ent, e); + e.entnum = n; +} + #define DP_CSQC_ENTITY_REMOVE_IS_B0RKED void menu_show_error() { @@ -139,7 +152,9 @@ void CSQC_Init(void) GetTeam(COLOR_SPECTATOR, true); // add specs first + // needs to be done so early because of the constants they create RegisterWeapons(); + RegisterGametypes(); WaypointSprite_Load(); @@ -163,7 +178,7 @@ void CSQC_Init(void) DamageInfo_Precache(); Vehicles_Precache(); turrets_precache(); - Announcer_Precache(); + Announcer_Precache(); Tuba_Precache(); if(autocvar_cl_reticle) @@ -194,11 +209,12 @@ void CSQC_Init(void) hud_configure_prev = -1; tab_panel = -1; + + draw_currentSkin = strzone(strcat("gfx/menu/", cvar_string("menu_skin"))); } // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc) -float cvar_clientsettemp_restore(); -void CSQC_Shutdown(void) +void Shutdown(void) { #ifdef USE_FTE #pragma TARGET id @@ -219,8 +235,6 @@ void CSQC_Shutdown(void) db_save(ClientProgsDB, "client.db"); db_close(ClientProgsDB); - cvar_clientsettemp_restore(); - if(camera_active) cvar_set("chase_active",ftos(chase_active_backup)); @@ -705,6 +719,7 @@ void CSQC_Ent_Update(float bIsNewEntity) //print(_("A CSQC entity changed its type!\n")); print(sprintf(_("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n"), num_for_edict(self), self.entnum, self.enttype, t)); Ent_Remove(); + clearentity(self); bIsNewEntity = 1; } } @@ -751,7 +766,7 @@ void CSQC_Ent_Update(float bIsNewEntity) case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break; case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break; case ENT_CLIENT_TURRET: ent_turret(); break; - case ENT_CLIENT_MODEL: CSQCModel_Read(); break; + case ENT_CLIENT_MODEL: CSQCModel_Read(bIsNewEntity); 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)); @@ -777,6 +792,11 @@ void Ent_Remove() // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(self) as well. void CSQC_Ent_Remove() { + if(wasfreed(self)) + { + print("WARNING: CSQC_Ent_Remove called for already removed entity. Packet loss?\n"); + return; + } if(self.enttype) Ent_Remove(); remove(self); @@ -786,7 +806,8 @@ void Gamemode_Init() { if not(isdemo()) { - localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), "\n"); + if(!(calledhooks & HOOK_START)) + localcmd("\n_cl_hook_gamestart ", MapInfo_Type_ToString(gametype), "\n"); calledhooks |= HOOK_START; } } @@ -822,7 +843,7 @@ void Ent_ScoresInfo() { float i; self.classname = "ent_client_scores_info"; - gametype = ReadByte(); + gametype = ReadInt24_t(); for(i = 0; i < MAX_SCORE; ++i) { scores_label[i] = strzone(ReadString()); @@ -879,6 +900,7 @@ void Ent_Init() hagar_maxrockets = ReadByte(); g_trueaim_minrange = ReadCoord(); + g_balance_porto_secondary = ReadByte(); if(!postinit) PostInit(); @@ -1159,6 +1181,14 @@ float CSQC_Parse_TempEntity() Net_VehicleSetup(); bHandled = true; break; + case TE_CSQC_SVNOTICE: + cl_notice_read(); + bHandled = true; + break; + case TE_CSQC_SHOCKWAVEPARTICLE: + Net_ReadShockwaveParticle(); + bHandled = true; + break; default: // No special logic for this temporary entity; return 0 so the engine can handle it bHandled = false;