void UI_LoadPanel_RenderHeaderText(panel_button_t *button) { uiClientState_t cstate; char downloadName[MAX_INFO_VALUE]; trap_GetClientState(&cstate); trap_Cvar_VariableStringBuffer("cl_downloadName", downloadName, sizeof(downloadName)); if ((cstate.connState == CA_DISCONNECTED || cstate.connState == CA_CONNECTED) && *downloadName) { button->text = trap_TranslateString("DOWNLOADING..."); } else { button->text = trap_TranslateString("CONNECTING..."); } BG_PanelButtonsRender_Text(button); }
char* CG_TranslateString( const char *string ) { static char staticbuf[2][MAX_VA_STRING]; static int bufcount = 0; char *buf; buf = staticbuf[bufcount++ % 2]; trap_TranslateString( string, buf ); return buf; }
/** * @brief CG_TranslateString */ char *CG_TranslateString(const char *string) { static char staticbuf[2][MAX_VA_STRING]; static int bufcount = 0; char *buf; // some code expects this to return a copy always, even // if none is needed for translation, so always supply another buffer buf = staticbuf[bufcount++ % 2]; trap_TranslateString(string, buf); return buf; }
void UI_LoadPanel_RenderLoadingText(panel_button_t *button) { uiClientState_t cstate; char downloadName[MAX_INFO_VALUE]; char buff[2560]; char *p, *s = ""; float y; trap_GetClientState(&cstate); Com_sprintf(buff, sizeof(buff), trap_TranslateString("Connecting to:\n %s^*\n\n%s"), cstate.servername, Info_ValueForKey(cstate.updateInfoString, "motd")); if (trap_Cvar_VariableValue("com_updateavailable")) { Q_strcat(buff, sizeof(buff), "\n\nYour ET:L client is outdated. New update is available for download at www.etlegacy.com"); } trap_Cvar_VariableStringBuffer("cl_downloadName", downloadName, sizeof(downloadName)); if (!connect_ownerdraw) { if (!trap_Cvar_VariableValue("ui_connecting")) { switch (cstate.connState) { case CA_CONNECTING: s = va(trap_TranslateString("Awaiting connection...%i"), cstate.connectPacketCount); break; case CA_CHALLENGING: s = va(trap_TranslateString("Awaiting challenge...%i"), cstate.connectPacketCount); break; case CA_DISCONNECTED: case CA_CONNECTED: if (*downloadName || cstate.connState == CA_DISCONNECTED) { s = (char *)UI_DownloadInfo(downloadName); } else { s = trap_TranslateString("Awaiting gamestate..."); } break; case CA_LOADING: case CA_PRIMED: default: break; } } else if (trap_Cvar_VariableValue("ui_dl_running")) { // only toggle during a disconnected download s = (char *)UI_DownloadInfo(downloadName); } Q_strcat(buff, sizeof(buff), va("\n\n%s^*", s)); if (cstate.connState < CA_CONNECTED && *cstate.messageString) { Q_strcat(buff, sizeof(buff), va("\n\n%s^*", cstate.messageString)); } } BG_FitTextToWidth_Ext(buff, button->font->scalex, button->rect.w, sizeof(buff), button->font->font); //UI_DrawRect( button->rect.x, button->rect.y, button->rect.w, button->rect.h, colorRed ); y = button->rect.y + 12; s = p = buff; while (*p) { if (*p == '\n') { *p++ = '\0'; Text_Paint_Ext(button->rect.x + 4, y, button->font->scalex, button->font->scaley, button->font->colour, s, 0, 0, 0, button->font->font); y += 8; s = p; } else { p++; } } }
char* CG_TranslateString( const char *string ) { // dont even make the call if we're in english return trap_TranslateString( string ); }