X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2FMain.qc;h=e9591e51d8a40bc99a9f98d2f53b11da42ff60a7;hp=c0e37ae62177b536a0d60a085ae6b056684241b8;hb=a08620064dbe59abd194f302768d65934b87b6df;hpb=90efb5467fe733b53d89c0b32da3dca8252e7f19 diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index c0e37ae621..e9591e51d8 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -10,7 +10,7 @@ void clearentity(entity e) clearentity_ent = spawn(); clearentity_ent.classname = "clearentity"; } - float n = e.entnum; + int n = e.entnum; copyentity(clearentity_ent, e); e.entnum = n; } @@ -28,40 +28,18 @@ void menu_sub_null() { } -#ifdef USE_FTE -float __engine_check; -#endif - string forcefog; void WaypointSprite_Load(); void ConsoleCommand_macro_init(); void CSQC_Init(void) { prvm_language = cvar_string("prvm_language"); -#ifdef USE_FTE -#pragma target ID - __engine_check = checkextension("DP_SV_WRITEPICTURE"); - if(!__engine_check) - { - print(_("^3Your engine build is outdated\n^3This Server uses a newer QC VM. Please update!\n")); - localcmd("\ndisconnect\n"); - return; - } -#pragma target FTE -#endif - - check_unacceptable_compiler_bugs(); #ifdef WATERMARK - printf(_("^4CSQC Build information: ^1%s\n"), WATERMARK); + dprintf("^4CSQC Build information: ^1%s\n", WATERMARK); #endif - float i; - -#ifdef COMPAT_XON050_ENGINE - // old engine lacks implementation of player_localnum - player_localnum = player_localentnum - 1; -#endif + int i; binddb = db_create(); tempdb = db_create(); @@ -69,7 +47,7 @@ void CSQC_Init(void) compressShortVector_init(); draw_endBoldFont(); - menu_visible = FALSE; + menu_visible = false; menu_show = menu_show_error; menu_action = func_null; @@ -96,6 +74,8 @@ void CSQC_Init(void) for(i = 0; i < MAX_HUD_FIELDS; ++i) hud_title[i] = strzone("(null)"); + Cmd_HUD_SetFields(0); + postinit = false; calledhooks = 0; @@ -125,7 +105,6 @@ void CSQC_Init(void) Hook_Precache(); GibSplash_Precache(); Casings_Precache(); - DamageInfo_Precache(); Vehicles_Precache(); turrets_precache(); Tuba_Precache(); @@ -133,8 +112,8 @@ void CSQC_Init(void) if(autocvar_cl_reticle) { - if(autocvar_cl_reticle_item_normal) { precache_pic("gfx/reticle_normal"); } - if(autocvar_cl_reticle_item_nex) { precache_pic("gfx/reticle_nex"); } + precache_pic("gfx/reticle_normal"); + // weapon reticles are precached in weapon files } get_mi_min_max_texcoords(1); // try the CLEVER way first @@ -166,13 +145,6 @@ void CSQC_Init(void) // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc) void Shutdown(void) { -#ifdef USE_FTE -#pragma TARGET id - if(!__engine_check) - return 0; -#pragma TARGET fte -#endif - WarpZone_Shutdown(); remove(teams); @@ -202,7 +174,7 @@ void Shutdown(void) } .float has_team; -float SetTeam(entity o, float Team) +float SetTeam(entity o, int Team) { entity tm; if(teamplay) @@ -247,7 +219,7 @@ float SetTeam(entity o, float Team) tm = GetTeam(o.team, false); tm.team_size -= 1; o.has_team = 0; - return TRUE; + return true; } } else @@ -258,7 +230,7 @@ float SetTeam(entity o, float Team) tm = GetTeam(Team, true); tm.team_size += 1; o.has_team = 1; - return TRUE; + return true; } else if(Team != o.team) { @@ -267,15 +239,15 @@ float SetTeam(entity o, float Team) o.team = Team; tm = GetTeam(Team, true); tm.team_size += 1; - return TRUE; + return true; } } - return FALSE; + return false; } void Playerchecker_Think() { - float i; + int i; entity e; for(i = 0; i < maxclients; ++i) { @@ -316,8 +288,6 @@ void Porto_Init(); void TrueAim_Init(); void PostInit(void) { - localcmd(strcat("\nscoreboard_columns_set ", autocvar_scoreboard_columns, ";\n")); - entity playerchecker; playerchecker = spawn(); playerchecker.think = Playerchecker_Think; @@ -329,8 +299,6 @@ void PostInit(void) postinit = true; } -float button_zoom; - // CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client. // Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine. // All keys are in ascii. @@ -351,7 +319,7 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary) if(menu_visible && menu_action) if(menu_action(bInputType, nPrimary, nSecondary)) - return TRUE; + return true; return bSkipKey; } @@ -367,7 +335,7 @@ void Ent_RemoveEntCS() } void Ent_ReadEntCS() { - float sf; + int sf; InterpolateOrigin_Undo(); self.classname = "entcs_receiver"; @@ -416,8 +384,8 @@ void Ent_RemovePlayerScore() void Ent_ReadPlayerScore() { - float i, n; - float isNew; + int i, n; + bool isNew; entity o; // damnit -.- don't want to go change every single .sv_entnum in hud.qc AGAIN @@ -448,7 +416,7 @@ void Ent_ReadPlayerScore() // RegisterPlayer(o); //playerchecker will do this for us later, if it has not already done so - float sf, lf; + int sf, lf; #if MAX_SCORE <= 8 sf = ReadByte(); lf = ReadByte(); @@ -456,7 +424,7 @@ void Ent_ReadPlayerScore() sf = ReadShort(); lf = ReadShort(); #endif - float p; + int p; for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2) if(sf & p) { @@ -474,13 +442,13 @@ void Ent_ReadPlayerScore() void Ent_ReadTeamScore() { - float i; + int i; entity o; self.team = ReadByte(); o = self.owner = GetTeam(self.team, true); // these team numbers can always be trusted - float sf, lf; + int sf, lf; #if MAX_TEAMSCORE <= 8 sf = ReadByte(); lf = ReadByte(); @@ -488,7 +456,7 @@ void Ent_ReadTeamScore() sf = ReadShort(); lf = ReadShort(); #endif - float p; + int p; for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2) if(sf & p) { @@ -503,10 +471,9 @@ void Ent_ReadTeamScore() void Ent_ClientData() { - float f; float newspectatee_status; - f = ReadByte(); + int f = ReadByte(); scoreboard_showscores_force = (f & 1); @@ -548,14 +515,14 @@ void Ent_ClientData() } spectatee_status = newspectatee_status; - // non-COMPAT_XON050_ENGINE: we could get rid of spectatee_status, and derive it from player_localentnum and player_localnum + // we could get rid of spectatee_status, and derive it from player_localentnum and player_localnum } void Ent_Nagger() { - float nags, i, j, b, f; + int i, j, b, f; - nags = ReadByte(); // NAGS NAGS NAGS NAGS NAGS NAGS NADZ NAGS NAGS NAGS + int nags = ReadByte(); // NAGS NAGS NAGS NAGS NAGS NAGS NADZ NAGS NAGS NAGS if(!(nags & 4)) { @@ -606,6 +573,27 @@ void Ent_Nagger() warmup_stage = (nags & 16); } +void Ent_EliminatedPlayers() +{ + int i, j, b, f; + + int sf = ReadByte(); + if(sf & 1) + { + for(j = 0; j < maxclients; ++j) + if(playerslots[j]) + playerslots[j].eliminated = 1; + for(i = 1; i <= maxclients; i += 8) + { + f = ReadByte(); + for(j = i-1, b = 1; b < 256; b *= 2, ++j) + if (!(f & b)) + if(playerslots[j]) + playerslots[j].eliminated = 0; + } + } +} + void Ent_RandomSeed() { float s; @@ -616,8 +604,8 @@ void Ent_RandomSeed() void Ent_ReadAccuracy(void) { - float sf, f, w, b; - sf = ReadInt24_t(); + int f, w; + int sf = ReadInt24_t(); if(sf == 0) { for(w = 0; w <= WEP_LAST - WEP_FIRST; ++w) @@ -629,7 +617,7 @@ void Ent_ReadAccuracy(void) { if(sf & f) { - b = ReadByte(); + int b = ReadByte(); if(b == 0) weapon_accuracy[w] = -1; else if(b == 255) @@ -739,7 +727,7 @@ void Ent_ReadSpawnEvent(float is_new) if(autocvar_cl_unpress_zoom_on_spawn) { localcmd("-zoom\n"); - button_zoom = FALSE; + button_zoom = false; } } @@ -804,6 +792,7 @@ void CSQC_Ent_Update(float bIsNewEntity) case ENT_CLIENT_RAINSNOW: Ent_RainOrSnow(); break; case ENT_CLIENT_LASER: Ent_Laser(); break; case ENT_CLIENT_NAGGER: Ent_Nagger(); break; + case ENT_CLIENT_ELIMINATEDPLAYERS: Ent_EliminatedPlayers(); break; case ENT_CLIENT_WAYPOINT: Ent_WaypointSprite(); break; case ENT_CLIENT_RADARLINK: Ent_RadarLink(); break; case ENT_CLIENT_PROJECTILE: Ent_Projectile(); break; @@ -823,8 +812,7 @@ void CSQC_Ent_Update(float bIsNewEntity) case ENT_CLIENT_WARPZONE_TELEPORTED: WarpZone_Teleported_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; + case ENT_CLIENT_ARC_BEAM: Ent_ReadArcBeam(bIsNewEntity); break; case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break; case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break; case ENT_CLIENT_TURRET: ent_turret(); break; @@ -838,7 +826,7 @@ void CSQC_Ent_Update(float bIsNewEntity) 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)); + error(sprintf("Unknown entity type in CSQC_Ent_Update (enttype: %d, edict: %d, classname: %s)\n", self.enttype, num_for_edict(self), self.classname)); break; } @@ -936,17 +924,21 @@ void Fog_Force() void Gamemode_Init(); void Ent_ScoresInfo() { - float i; + int i; self.classname = "ent_client_scores_info"; gametype = ReadInt24_t(); HUD_ModIcons_SetFunc(); for(i = 0; i < MAX_SCORE; ++i) { + if(scores_label[i]) + strunzone(scores_label[i]); scores_label[i] = strzone(ReadString()); scores_flags[i] = ReadByte(); } for(i = 0; i < MAX_TEAMSCORE; ++i) { + if(teamscores_label[i]) + strunzone(teamscores_label[i]); teamscores_label[i] = strzone(ReadString()); teamscores_flags[i] = ReadByte(); } @@ -964,14 +956,10 @@ void Ent_Init() 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()); + arc_shotorigin[0] = decompressShotOrigin(ReadInt24_t()); + arc_shotorigin[1] = decompressShotOrigin(ReadInt24_t()); + arc_shotorigin[2] = decompressShotOrigin(ReadInt24_t()); + arc_shotorigin[3] = decompressShotOrigin(ReadInt24_t()); if(forcefog) strunzone(forcefog); @@ -979,12 +967,12 @@ void Ent_Init() armorblockpercent = ReadByte() / 255.0; - g_balance_grenadelauncher_bouncefactor = ReadCoord(); - g_balance_grenadelauncher_bouncestop = ReadCoord(); + g_balance_mortar_bouncefactor = ReadCoord(); + g_balance_mortar_bouncestop = ReadCoord(); g_balance_electro_secondary_bouncefactor = ReadCoord(); g_balance_electro_secondary_bouncestop = ReadCoord(); - nex_scope = !ReadByte(); + vortex_scope = !ReadByte(); rifle_scope = !ReadByte(); serverflags = ReadByte(); @@ -1102,13 +1090,13 @@ void Net_ReadRace() race_speedaward_alltimebest_holder = strzone(ReadString()); break; case RACE_NET_SERVER_RANKINGS: - float pos, prevpos, del; - pos = ReadShort(); + float prevpos, del; + int pos = ReadShort(); prevpos = ReadShort(); del = ReadShort(); // move other rankings out of the way - float i; + int i; if (prevpos) { for (i=prevpos-1;i>pos-1;--i) { grecordtime[i] = grecordtime[i-1]; @@ -1163,7 +1151,7 @@ void Net_TeamNagger() void Net_ReadPingPLReport() { - float e, pi, pl, ml; + int e, pi, pl, ml; e = ReadByte(); pi = ReadShort(); pl = ReadByte(); @@ -1181,7 +1169,7 @@ void Net_WeaponComplain() if(complain_weapon_name) strunzone(complain_weapon_name); - complain_weapon_name = strzone(ReadString()); + complain_weapon_name = strzone(WEP_NAME(complain_weapon)); complain_weapon_type = ReadByte(); @@ -1225,16 +1213,16 @@ float CSQC_Parse_TempEntity() Net_ReadRace(); bHandled = true; break; - case TE_CSQC_NEXGUNBEAMPARTICLE: - Net_ReadNexgunBeamParticle(); + case TE_CSQC_VORTEXBEAMPARTICLE: + Net_ReadVortexBeamParticle(); bHandled = true; break; case TE_CSQC_TEAMNAGGER: Net_TeamNagger(); bHandled = true; break; - case TE_CSQC_LIGHTNINGARC: - Net_ReadLightningarc(); + case TE_CSQC_ARC: + Net_ReadArc(); bHandled = true; break; case TE_CSQC_PINGPLREPORT: @@ -1253,6 +1241,10 @@ float CSQC_Parse_TempEntity() 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; @@ -1302,7 +1294,7 @@ string getcommandkey(string text, string command) return text; } else if (autocvar_hud_showbinds > 1) - return sprintf(_("%s (%s)"), text, keys); + return sprintf("%s (%s)", text, keys); else return keys; }