X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2FMain.qc;h=21ccb217ce6c04858f4914de03d278fb8935e25a;hb=d08048788ea59b6c5f425ca720dc99ac0a41663b;hp=044569fb5c373b49011389d5daf6adf141791f40;hpb=7a8e4ad81bf523a53882ef97822b0641e424730c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 044569fb5..21ccb217c 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -27,7 +27,7 @@ void cvar_clientsettemp_restore() void() menu_show_error = { - drawstring('0 200 0', "ERROR - MENU IS VISIBLE BUT NO MENU WAS DEFINED!", '8 8 0', '1 0 0', 1, 0); + drawstring('0 200 0', _("ERROR - MENU IS VISIBLE BUT NO MENU WAS DEFINED!"), '8 8 0', '1 0 0', 1, 0); }; // CSQC_Init : Called every time the CSQC code is initialized (essentially at map load) @@ -46,22 +46,24 @@ string cl_announcer_prev; 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"); if(!__engine_check) { - print("^3Your engine build is outdated\n^3This Server uses a newer QC VM. Please update!\n"); + 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 - print("^4CSQC Build information: ", WATERMARK(), "\n"); + print(sprintf(_("^4CSQC Build information: %s\n"), WATERMARK())); #endif float i; @@ -134,6 +136,8 @@ void CSQC_Init(void) WaypointSprite_Load(); // precaches + precache_sound("misc/hit.wav"); + precache_sound("misc/typehit.wav"); Projectile_Precache(); Hook_Precache(); GibSplash_Precache(); @@ -147,6 +151,9 @@ void CSQC_Init(void) } Tuba_Precache(); + if(autocvar_cl_reticle_item_normal) precache_pic("gfx/reticle_normal"); + if(autocvar_cl_reticle_item_nex) precache_pic("gfx/reticle_nex"); + get_mi_min_max_texcoords(1); // try the CLEVER way first minimapname = strcat("gfx/", mi_shortname, "_radar.tga"); shortmapname = mi_shortname; @@ -166,7 +173,9 @@ void CSQC_Init(void) minimapname = strzone(minimapname); WarpZone_Init(); + hud_configure_prev = -1; + tab_panel = -1; } // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc) @@ -222,7 +231,7 @@ float SetTeam(entity o, float Team) default: if(GetTeam(Team, false) == NULL) { - print("trying to switch to unsupported team ", ftos(Team), "\n"); + print(sprintf(_("trying to switch to unsupported team %d\n"), Team)); Team = COLOR_SPECTATOR; } break; @@ -238,7 +247,7 @@ float SetTeam(entity o, float Team) default: if(GetTeam(Team, false) == NULL) { - print("trying to switch to unsupported team ", ftos(Team), "\n"); + print(sprintf(_("trying to switch to unsupported team %d\n"), Team)); Team = COLOR_SPECTATOR; } break; @@ -248,7 +257,6 @@ float SetTeam(entity o, float Team) { if(o.has_team) { - //print("(DISCONNECT) leave team ", ftos(o.team), "\n"); tm = GetTeam(o.team, false); tm.team_size -= 1; o.has_team = 0; @@ -259,7 +267,6 @@ float SetTeam(entity o, float Team) { if not(o.has_team) { - //print("(CONNECT) enter team ", ftos(o.team), "\n"); o.team = Team; tm = GetTeam(Team, true); tm.team_size += 1; @@ -268,11 +275,9 @@ float SetTeam(entity o, float Team) } else if(Team != o.team) { - //print("(CHANGE) leave team ", ftos(o.team), "\n"); tm = GetTeam(o.team, false); tm.team_size -= 1; o.team = Team; - //print("(CHANGE) enter team ", ftos(o.team), "\n"); tm = GetTeam(Team, true); tm.team_size += 1; return TRUE; @@ -292,7 +297,6 @@ void Playerchecker_Think() { if(e.sort_prev) { - //print("playerchecker: KILL KILL KILL\n"); // player disconnected SetTeam(e, -1); RemovePlayer(e); @@ -304,7 +308,6 @@ void Playerchecker_Think() { if not(e.sort_prev) { - //print("playerchecker: SPAWN SPAWN SPAWN\n"); // player connected if not(e) playerslots[i] = e = spawn(); @@ -326,7 +329,6 @@ void Porto_Init(); void TrueAim_Init(); void PostInit(void) { - print(strcat("PostInit\n maxclients = ", ftos(maxclients), "\n")); localcmd(strcat("\nscoreboard_columns_set ", autocvar_scoreboard_columns, ";\n")); entity playerchecker; @@ -361,8 +363,8 @@ float CSQC_ConsoleCommand(string strMessage) return true; } else if(strCmd == "hud_save") { // save hud config if(argv(1) == "" || argv(2)) { - print("Usage:\n"); - print("hud_save configname (saves to hud_skinname_configname.cfg)\n"); + print(_("Usage:\n")); + print(_("hud_save configname (saves to hud_skinname_configname.cfg)\n")); } else HUD_Panel_ExportCfg(argv(1)); @@ -509,10 +511,10 @@ void GameCommand(string msg) if(argv(0) == "help" || argc == 0) { - print("Usage: cl_cmd COMMAND..., where possible commands are:\n"); - print(" settemp cvar value\n"); - print(" scoreboard_columns_set ...\n"); - print(" scoreboard_columns_help\n"); + print(_("Usage: cl_cmd COMMAND..., where possible commands are:\n")); + print(_(" settemp cvar value\n")); + print(_(" scoreboard_columns_set ...\n")); + print(_(" scoreboard_columns_help\n")); GameCommand_Generic("help"); return; } @@ -615,6 +617,7 @@ void GameCommand(string msg) vote_prev = 0; cvar_set("cl_allow_uid2name", "1"); vote_change = -9999; + uid2name_dialog = 0; } else { @@ -629,6 +632,7 @@ void GameCommand(string msg) vote_prev = 0; cvar_set("cl_allow_uid2name", "0"); vote_change = -9999; + uid2name_dialog = 0; } else { @@ -717,7 +721,7 @@ void Ent_ReadPlayerScore() #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED if(!isNew && n != self.sv_entnum) { - print("A CSQC entity changed its owner!\n"); + print(_("A CSQC entity changed its owner!\n")); isNew = true; Ent_Remove(); self.enttype = ENT_CLIENT_SCORES; @@ -831,6 +835,15 @@ void Ent_ClientData() race_laptime = 0; race_checkpointtime = 0; } + if (autocvar_hud_panel_healtharmor_progressbar_gfx) + { + if ( (spectatee_status == -1 && newspectatee_status > 0) //before observing, now spectating + || (spectatee_status > 0 && newspectatee_status > 0 && spectatee_status != newspectatee_status) //changed spectated player + ) + prev_p_health = -1; + else if(spectatee_status && !newspectatee_status) //before observing/spectating, now playing + prev_health = -1; + } spectatee_status = newspectatee_status; } @@ -903,6 +916,37 @@ 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'; + + sf = ReadByte(); + + if(sf & 1) + { + self.origin_x = ReadShort(); + self.origin_y = ReadShort(); + self.origin_z = ReadShort(); + } + if(sf & 2) + { + self.healthvalue = ReadByte(); + self.armorvalue = ReadByte(); + } + + 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(); @@ -931,7 +975,7 @@ void(float bIsNewEntity) CSQC_Ent_Update = if(self.enttype) if(t != self.enttype) { - print("A CSQC entity changed its type!\n"); + print(_("A CSQC entity changed its type!\n")); Ent_Remove(); bIsNewEntity = 1; } @@ -967,8 +1011,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; default: - error(strcat("unknown entity type in CSQC_Ent_Update: ", ftos(self.enttype), "\n")); + error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype)); break; } @@ -998,15 +1043,6 @@ void CSQC_Ent_Remove() void Gamemode_Init() { - if(gametype == GAME_ONSLAUGHT) { - print(strcat("Using ", minimapname, " as minimap.\n")); - precache_pic("gfx/ons-cp-neutral.tga"); - precache_pic("gfx/ons-cp-red.tga"); - precache_pic("gfx/ons-cp-blue.tga"); - precache_pic("gfx/ons-frame.tga"); - precache_pic("gfx/ons-frame-team.tga"); - } - if not(isdemo()) { localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), "\n"); @@ -1097,7 +1133,7 @@ void Ent_Init() serverflags = ReadByte(); - cr_maxbullets = ReadByte(); + minelayer_maxmines = ReadByte(); g_trueaim_minrange = ReadCoord(); @@ -1413,7 +1449,7 @@ string getcommandkey(string text, string command) string keys; float n, j, k, l; - if (!hud_showbinds) + if (!autocvar_hud_showbinds) return text; keys = db_get(binddb, command); @@ -1431,7 +1467,7 @@ string getcommandkey(string text, string command) keys = strcat(keys, ", ", keynumtostring(k)); ++l; - if (hud_showbinds_limit > 0 && hud_showbinds_limit >= l) break; + if (autocvar_hud_showbinds_limit > 0 && autocvar_hud_showbinds_limit >= l) break; } } @@ -1439,13 +1475,13 @@ string getcommandkey(string text, string command) } if ("" == keys) { - if (hud_showbinds > 1) - return strcat(text, " (not bound)"); + if (autocvar_hud_showbinds > 1) + return sprintf(_("%s (not bound)"), text); else return text; } - else if (hud_showbinds > 1) - return strcat(text, " (", keys, ")"); + else if (autocvar_hud_showbinds > 1) + return sprintf(_("%s (%s)"), text, keys); else return keys; }