From e292e1bbfb1db32f8b184994a2b6a4edc17d675d Mon Sep 17 00:00:00 2001 From: Shpoike Date: Sat, 27 May 2023 18:00:32 +0100 Subject: [PATCH] Attempt to do a better job at internationaliation. --- CMakeLists.txt | 9 +++ engine/client/cl_main.c | 20 +++--- engine/client/cl_parse.c | 7 +- engine/client/console.c | 4 +- engine/client/image.c | 2 +- engine/client/m_download.c | 20 +++--- engine/client/m_items.c | 135 ++++++++++++++++++++----------------- engine/client/m_master.c | 72 ++++++++++---------- engine/client/m_multi.c | 62 ++++++++--------- engine/client/m_options.c | 9 +-- engine/client/m_single.c | 16 ++--- engine/client/menu.c | 17 +++-- engine/client/menu.h | 52 +++++++------- engine/client/p_script.c | 4 +- engine/client/renderer.c | 2 +- engine/client/textedit.c | 2 +- engine/common/cmd.c | 6 +- engine/common/fs.c | 2 +- engine/common/translate.c | 62 +++++++++++++---- engine/gl/gl_heightmap.c | 12 ++-- engine/qclib/qcc_pr_lex.c | 2 +- engine/server/sv_ccmds.c | 36 +++++----- imgtool.c | 9 +++ 23 files changed, 319 insertions(+), 243 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a2254040..9a420889d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -959,6 +959,15 @@ ELSE() TARGET_INCLUDE_DIRECTORIES(fteqw PUBLIC ${FTE_INCLUDES}) TARGET_LINK_LIBRARIES(fteqw ${FTE_LIBS}) SET(INSTALLTARGS ${INSTALLTARGS} fteqw) + + ADD_CUSTOM_TARGET(fteqw-i18n ALL + VERBATIM + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMAND xgettext --output=${CMAKE_CURRENT_BINARY_DIR}/fteqw.pot -k -kCon_TPrintf -kCon_SafeTPrintf -kNetchan_OutOfBandTPrintf:4 -kSV_OutOfBandTPrintf:4 -klangtext -kSV_TPrintToClient:3 -kSV_ClientTPrintf:3 -kSV_BroadcastTPrintf:2 -kCVARAFCD:6 -kCVARAFD:5 -kCVARFCD:5 -kCVARAD:4 -kCVARFD:4 -kCVARCD:4 -kCVARD:3 -kCmd_AddCommandD:3 -kCmd_AddCommandAD:4 -kMenu_Prompt:4:5:6 -kHost_EndGame ${FTE_ARCH_FILES} ${FTE_COMMON_FILES} ${FTE_CLIENT_FILES} ${FTE_SERVER_FILES} + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/fteqw.pot" + SOURCES + ${FTE_ARCH_FILES} ${FTE_COMMON_FILES} ${FTE_CLIENT_FILES} ${FTE_SERVER_FILES} + ) ENDIF() SET(FTE_ENGINE_SERVER_ONLY true CACHE BOOL "Compile fteqw-sv (server only) engine binary.") diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 84556aa18..1159b19e4 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -5512,7 +5512,7 @@ NORETURN void VARGS Host_EndGame (const char *message, ...) char string[1024]; va_start (argptr,message); - vsnprintf (string,sizeof(string)-1, message,argptr); + vsnprintf (string,sizeof(string)-1, localtext(message),argptr); va_end (argptr); COM_AssertMainThread(string); @@ -5552,7 +5552,7 @@ void VARGS Host_Error (const char *error, ...) inerror = true; va_start (argptr,error); - vsnprintf (string,sizeof(string)-1, error,argptr); + vsnprintf (string,sizeof(string)-1, localtext(error),argptr); va_end (argptr); COM_AssertMainThread(string); Con_TPrintf ("Host_Error: %s\n", string); @@ -6094,7 +6094,7 @@ done: else if (f->flags & HRF_MODEL) { if (!FS_FixupGamedirForExternalFile(f->fname, loadcommand, sizeof(loadcommand))) - Con_Printf("%s is not within the current gamedir\n", f->fname); + Con_TPrintf("%s is not within the current gamedir\n", f->fname); else Cbuf_AddText(va("modelviewer \"%s\"\n", loadcommand), RESTRICT_LOCAL); goto done; @@ -6121,7 +6121,7 @@ done: if (!(f->flags & HRF_ACTION)) { Key_Dest_Remove(kdm_console); - Menu_Prompt(Host_RunFilePrompted, f, va("Exec %s?\n", COM_SkipPath(f->fname)), "Yes", NULL, "Cancel", true); + Menu_Prompt(Host_RunFilePrompted, f, va(localtext("Exec %s?\n"), COM_SkipPath(f->fname)), "Yes", NULL, "Cancel", true); return; } if (f->flags & HRF_OPENED) @@ -6169,7 +6169,7 @@ done: if (!f->srcfile) { - Con_Printf("Unable to open %s\n", f->fname); + Con_TPrintf("Unable to open %s\n", f->fname); goto done; } @@ -6232,17 +6232,17 @@ done: Key_Dest_Remove(kdm_console); if (haschanged) { - Menu_Prompt(Host_RunFilePrompted, f, va("File already exists.\nWhat would you like to do?\n%s\n", displayname), "Overwrite", "Run old", "Cancel", true); + Menu_Prompt(Host_RunFilePrompted, f, va(localtext("File already exists.\nWhat would you like to do?\n%s\n"), displayname), "Overwrite", "Run old", "Cancel", true); return; } else if (isnew) { - Menu_Prompt(Host_RunFilePrompted, f, va("File appears new.\nWould you like to install\n%s\n", displayname), "Install!", "", "Cancel", true); + Menu_Prompt(Host_RunFilePrompted, f, va(localtext("File appears new.\nWould you like to install\n%s\n"), displayname), "Install!", "", "Cancel", true); return; } else { - Menu_Prompt(NULL, NULL, va("File is already installed\n%s\n", displayname), NULL, NULL, "Cancel", true); + Menu_Prompt(NULL, NULL, va(localtext("File is already installed\n%s\n"), displayname), NULL, NULL, "Cancel", true); f->flags |= HRF_ABORT; } } @@ -6411,7 +6411,7 @@ qboolean Host_RunFile(const char *fname, int nlen, vfsfile_t *file) if (file) f->flags |= HRF_OPENED; - Con_Printf("Opening external file: %s\n", f->fname); + Con_TPrintf("Opening external file: %s\n", f->fname); Host_DoRunFile(f); return true; @@ -7207,7 +7207,7 @@ void Host_FinishLoading(void) char *scheme = Sys_URIScheme_NeedsRegistering(); if (scheme) { - Menu_Prompt(Host_URIPrompt, NULL, va("The URI scheme %s:// is not configured.\nRegister now?", scheme), "Register", NULL, "No", true); + Menu_Prompt(Host_URIPrompt, NULL, va(localtext("The URI scheme %s:// is not configured.\nRegister now?"), scheme), "Register", NULL, "No", true); Z_Free(scheme); } } diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 2951724ca..3efcc9314 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -3772,11 +3772,12 @@ void CL_ParseEstablished(void) default: break; } if (NET_IsEncrypted(&cls.netchan.remote_address)) - security = "^["S_COLOR_GREEN"encrypted\\tip\\Any passwords will be sent securely, but will still be readable by the server admin^]"; + security = localtext("^["S_COLOR_GREEN"encrypted\\tip\\Any passwords will be sent securely, but will still be readable by the server admin^]"); else - security = "^["S_COLOR_RED"plain-text\\tip\\"CON_WARNING"Do not type passwords as they can potentially be seen by network sniffers^]"; + security = localtext("^["S_COLOR_RED"plain-text\\tip\\"CON_WARNING"Do not type passwords as they can potentially be seen by network sniffers^]"); - Con_TPrintf ("\rConnected to ^["S_COLOR_BLUE"%s\\type\\connect %s^] (%s).\n", cls.servername, cls.servername, security); + Con_Printf ("\r"); + Con_TPrintf ("Connected to ^["S_COLOR_BLUE"%s\\type\\connect %s^] (%s).\n", cls.servername, cls.servername, security); } } diff --git a/engine/client/console.c b/engine/client/console.c index ec1f1926d..94c84af44 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -1179,7 +1179,7 @@ void VARGS Con_TPrintf (translation_t text, ...) { va_list argptr; char msg[MAXPRINTMSG]; - const char *fmt = langtext(text, com_language); + const char *fmt = localtext(text); va_start (argptr,text); vsnprintf (msg,sizeof(msg), fmt,argptr); @@ -1193,7 +1193,7 @@ void VARGS Con_SafeTPrintf (translation_t text, ...) { va_list argptr; char msg[MAXPRINTMSG]; - const char *fmt = langtext(text, com_language); + const char *fmt = localtext(text); va_start (argptr,text); vsnprintf (msg,sizeof(msg), fmt,argptr); diff --git a/engine/client/image.c b/engine/client/image.c index 96e43cb82..c7f7a5a98 100644 --- a/engine/client/image.c +++ b/engine/client/image.c @@ -13390,7 +13390,7 @@ struct pendingtextureinfo *Image_LoadMipsFromMemory(int flags, const char *iname } #endif else - Con_Printf("Unable to read file %s (format unsupported)\n", fname); + Con_TPrintf("Unable to load file %s (format unsupported)\n", fname); BZ_Free(filedata); return NULL; diff --git a/engine/client/m_download.c b/engine/client/m_download.c index ac21bd209..f1f8154a9 100644 --- a/engine/client/m_download.c +++ b/engine/client/m_download.c @@ -2898,7 +2898,7 @@ static void PM_UpdatePackageList(qboolean autoupdate) else if (allowphonehome == -1) { if (doautoupdate) - Menu_Prompt(PM_AllowPackageListQuery_Callback, NULL, "Query updates list?\n", "Okay", NULL, "Nope", true); + Menu_Prompt(PM_AllowPackageListQuery_Callback, NULL, localtext("Query updates list?\n"), "Okay", NULL, "Nope", true); return; } @@ -3391,16 +3391,16 @@ static void PM_PackageEnabled(package_t *p) } #ifndef HAVE_CLIENT -#define Menu_Prompt(cb,ctx,msg,yes,no,cancel,highpri) Con_Printf(CON_WARNING msg "\n") +#define Menu_Prompt(cb,ctx,msg,yes,no,cancel,highpri) Con_Printf(CON_WARNING "%s\n", msg) #endif if (FS_NativePath(ef->name, p->fsroot, native, sizeof(native)) && Sys_SetUpdatedBinary(native)) { Q_strncpyz(enginerevision, p->version, sizeof(enginerevision)); //make sure 'revert' picks up the new binary... - Menu_Prompt(NULL, NULL, "Engine binary updated.\nRestart to use.", NULL, NULL, NULL, true); + Menu_Prompt(NULL, NULL, localtext("Engine binary updated.\nRestart to use."), NULL, NULL, NULL, true); } else - Menu_Prompt(NULL, NULL, "Engine update failed.\nManual update required.", NULL, NULL, NULL, true); + Menu_Prompt(NULL, NULL, localtext("Engine update failed.\nManual update required."), NULL, NULL, NULL, true); } #endif } @@ -4548,18 +4548,18 @@ static void PM_PromptApplyChanges(void) //lock it down, so noone can make any changes while this prompt is still displayed if (pkg_updating) { - Menu_Prompt(PM_PromptApplyChanges_Callback, NULL, "An update is already in progress\nPlease wait\n", NULL, NULL, "Cancel", true); + Menu_Prompt(PM_PromptApplyChanges_Callback, NULL, localtext("An update is already in progress\nPlease wait\n"), NULL, NULL, "Cancel", true); return; } pkg_updating = true; #endif - strcpy(text, "Really decline the following\nrecommended packages?\n\n"); + strcpy(text, localtext("Really decline the following\nrecommended packages?\n\n")); if (PM_DeclinedPackages(text+strlen(text), sizeof(text)-strlen(text))) Menu_Prompt(PM_PromptApplyDecline_Callback, NULL, text, NULL, "Confirm", "Cancel", true); else { - strcpy(text, "Apply the following changes?\n\n"); + strcpy(text, localtext("Apply the following changes?\n\n")); changes = PM_ChangeList(text+strlen(text), sizeof(text)-strlen(text)); if (!changes) { @@ -4651,7 +4651,7 @@ void PM_Command_f(void) else { #ifdef HAVE_CLIENT - Menu_Prompt(PM_AddSubList_Callback, Z_StrDup(Cmd_Argv(2)), va("Add updates source?\n%s", Cmd_Argv(2)), "Confirm", NULL, "Cancel", true); + Menu_Prompt(PM_AddSubList_Callback, Z_StrDup(Cmd_Argv(2)), va(localtext("Add updates source?\n%s"), Cmd_Argv(2)), "Confirm", NULL, "Cancel", true); #else PM_AddSubList(Cmd_Argv(2), "", SRCFL_USER|SRCFL_ENABLED); PM_WriteInstalledPackages(); @@ -5429,7 +5429,7 @@ static void MD_Draw (int x, int y, struct menucustom_s *c, struct emenu_s *m) { allowphonehome = false; #ifdef HAVE_CLIENT - Menu_Prompt(PM_AllowPackageListQuery_Callback, NULL, "Query updates list?\n", "Okay", NULL, "Nope", true); + Menu_Prompt(PM_AllowPackageListQuery_Callback, NULL, localtext("Query updates list?\n"), "Okay", NULL, "Nope", true); #endif } #endif @@ -6506,7 +6506,7 @@ qboolean PM_AreSourcesNew(qboolean doprompt) ret = true; //something is dirty. if (doprompt) { - const char *msg = va("Enable update source\n\n^x66F%s", (pm_source[i].flags&SRCFL_MANIFEST)?PrettyHostFromURL(pm_source[i].url):pm_source[i].url); + const char *msg = va(localtext("Enable update source\n\n^x66F%s"), (pm_source[i].flags&SRCFL_MANIFEST)?PrettyHostFromURL(pm_source[i].url):pm_source[i].url); pm_pendingprompts++; Menu_Prompt(PM_ConfirmSource, Z_StrDup(pm_source[i].url), msg, "Enable", "Configure", "Later", true); pm_source[i].flags |= SRCFL_PROMPTED; diff --git a/engine/client/m_items.c b/engine/client/m_items.c index ad34becec..1fb706ba3 100644 --- a/engine/client/m_items.c +++ b/engine/client/m_items.c @@ -357,10 +357,10 @@ void Draw_BigFontString(int x, int y, const char *text) R2D_ImageColours(1,1,1,1); } -char *menudotstyle; -int maxdots; -int mindot; -int dotofs; +static char *menudotstyle; +static int maxdots; +static int mindot; +static int dotofs; static void MenuTooltipChange(emenu_t *menu, const char *text) { @@ -795,9 +795,9 @@ static void MenuDrawItems(int xpos, int ypos, menuoption_t *option, emenu_t *men Draw_Character (x, y, 0xe081); #endif if (!menu->cursoritem && menu->selecteditem == option) - Draw_AltFunString (x, y, on ? "on" : "off"); + Draw_AltFunString (x, y, on ? localtext("on") : localtext("off")); else - Draw_FunString (x, y, on ? "on" : "off"); + Draw_FunString (x, y, on ? localtext("on") : localtext("off")); } break; case mt_edit: @@ -1005,7 +1005,7 @@ menutext_t *MC_AddRedText(emenu_t *menu, int lhs, int rhs, int y, const char *te return n; } -menubind_t *MC_AddBind(emenu_t *menu, int cx, int bx, int y, const char *caption, char *command, char *tooltip) +menubind_t *MC_AddBind(emenu_t *menu, int cx, int bx, int y, const char *caption, char *command, const char *tooltip) { menubind_t *n = Z_Malloc(sizeof(*n) + strlen(caption)+1 + strlen(command)+1 + (tooltip?strlen(tooltip)+1:0)); n->common.type = mt_bind; @@ -1031,7 +1031,7 @@ menubind_t *MC_AddBind(emenu_t *menu, int cx, int bx, int y, const char *caption return n; } -menupicture_t *MC_AddSelectablePicture(emenu_t *menu, int x, int y, int height, char *picname) +menupicture_t *MC_AddSelectablePicture(emenu_t *menu, int x, int y, int height, const char *picname) { char selname[MAX_QPATH]; menupicture_t *n; @@ -1060,7 +1060,7 @@ menupicture_t *MC_AddSelectablePicture(emenu_t *menu, int x, int y, int height, return n; } -menupicture_t *MC_AddPicture(emenu_t *menu, int x, int y, int width, int height, char *picname) +menupicture_t *MC_AddPicture(emenu_t *menu, int x, int y, int width, int height, const char *picname) { menupicture_t *n; if (qrenderer == QR_NONE) @@ -1083,7 +1083,7 @@ menupicture_t *MC_AddPicture(emenu_t *menu, int x, int y, int width, int height, return n; } -menupicture_t *MC_AddCenterPicture(emenu_t *menu, int y, int height, char *picname) +menupicture_t *MC_AddCenterPicture(emenu_t *menu, int y, int height, const char *picname) { int x; int width; @@ -1219,7 +1219,7 @@ menupicture_t *MC_AddCursor(emenu_t *menu, menuresel_t *reselection, int x, int return n; } -menuedit_t *MC_AddEdit(emenu_t *menu, int cx, int ex, int y, char *text, char *def) +menuedit_t *MC_AddEdit(emenu_t *menu, int cx, int ex, int y, const char *text, const char *def) { menuedit_t *n = Z_Malloc(sizeof(menuedit_t)+strlen(text)+1); n->slim = false; @@ -1240,7 +1240,7 @@ menuedit_t *MC_AddEdit(emenu_t *menu, int cx, int ex, int y, char *text, char *d return n; } -menuedit_t *MC_AddEditCvar(emenu_t *menu, int cx, int ex, int y, char *text, char *name, qboolean isslim) +menuedit_t *MC_AddEditCvar(emenu_t *menu, int cx, int ex, int y, const char *text, const char *name, qboolean isslim) { menuedit_t *n = Z_Malloc(sizeof(menuedit_t)+strlen(text)+1); cvar_t *cvar; @@ -1424,6 +1424,7 @@ menucombo_t *MC_AddCombo(emenu_t *menu, int tx, int cx, int y, const char *capti menucombo_t *n; char **newops; char *optbuf; + const char *o; int i; maxoptlen = 0; @@ -1432,7 +1433,9 @@ menucombo_t *MC_AddCombo(emenu_t *menu, int tx, int cx, int y, const char *capti optlen = 0; if (ops) while(ops[numopts]) { - optlen = strlen(ops[numopts]); + o = localtext(ops[numopts]); + + optlen = strlen(o); if (maxoptlen < optlen) maxoptlen = optlen; optbufsize += optlen+1+sizeof(char*); @@ -1459,7 +1462,9 @@ menucombo_t *MC_AddCombo(emenu_t *menu, int tx, int cx, int y, const char *capti n->numoptions = numopts; for (i = 0; i < numopts; i++) { - strcpy(optbuf, ops[i]); + o = localtext(ops[i]); + + strcpy(optbuf, o); newops[i] = optbuf; optbuf += strlen(optbuf)+1; } @@ -1484,7 +1489,7 @@ menucombo_t *MC_AddCvarCombo(emenu_t *menu, int tx, int cx, int y, const char *c char **newops; char **newvalues; char *optbuf; - const char *v; + const char *v, *o; int i; maxoptlen = 0; @@ -1493,8 +1498,9 @@ menucombo_t *MC_AddCvarCombo(emenu_t *menu, int tx, int cx, int y, const char *c for (i = 0; ops[i]; i++) { v = values?values[i]:va("%i", i); + o = localtext(ops[i]); - optlen = strlen(ops[i]); + optlen = strlen(o); if (maxoptlen < optlen) maxoptlen = optlen; optbufsize += optlen+1+sizeof(char*); @@ -1514,7 +1520,7 @@ menucombo_t *MC_AddCvarCombo(emenu_t *menu, int tx, int cx, int y, const char *c n->common.posy = y; n->common.height = 8; n->common.width = cx-tx + maxoptlen*8; - n->common.tooltip = cvar->description; + n->common.tooltip = localtext(cvar->description); n->captionwidth = cx-tx; strcpy(optbuf, caption); @@ -1537,11 +1543,12 @@ menucombo_t *MC_AddCvarCombo(emenu_t *menu, int tx, int cx, int y, const char *c for (i = 0; i < numopts; i++) { v = values?values[i]:va("%i", i); + o = localtext(ops[i]); if (!strcmp(v, cvar->string)) n->selectedoption = i; - strcpy(optbuf, ops[i]); + strcpy(optbuf, o); newops[i] = optbuf; optbuf += strlen(optbuf)+1; @@ -1613,15 +1620,15 @@ menubutton_t *MC_AddConsoleCommandHexen2BigFont(emenu_t *menu, int x, int y, con return n; } #endif -menubutton_t *MC_AddCommand(emenu_t *menu, int lhs, int rhs, int y, char *text, qboolean (*command) (union menuoption_s *,struct emenu_s *,int)) +menubutton_t *MC_AddCommand(emenu_t *menu, int lhs, int rhs, int y, const char *text, qboolean (*command) (union menuoption_s *,struct emenu_s *,int)) { - menubutton_t *n = Z_Malloc(sizeof(menubutton_t)); + menubutton_t *n = Z_Malloc(sizeof(menubutton_t)+strlen(text)+1); n->common.type = mt_button; n->common.iszone = true; n->common.posx = lhs; n->common.posy = y; n->rightalign = true; - n->text = text; + n->text = strcpy((char*)(n+1), text); n->command = NULL; n->key = command; n->common.height = 8; @@ -1734,6 +1741,8 @@ void MC_Slider_Key(menuslider_t *option, int key) void MC_CheckBox_Key(menucheck_t *option, emenu_t *menu, int key) { + if (key == K_DEL && option->var && !option->func) + Cvar_Set(option->var, option->var->defaultstr); if (key != K_ENTER && key != K_KP_ENTER && key != K_GP_START && key != K_GP_DIAMOND_CONFIRM && key != K_GP_DIAMOND_ALTCONFIRM && key != K_LEFTARROW && key != K_KP_LEFTARROW && key != K_GP_DPAD_LEFT && key != K_GP_LEFT_THUMB_LEFT && key != K_RIGHTARROW && key != K_KP_LEFTARROW && key != K_GP_DPAD_RIGHT && key != K_GP_LEFT_THUMB_RIGHT && key != K_MWHEELUP && key != K_MWHEELDOWN && key != K_MOUSE1 && key != K_TOUCHTAP) return; if (option->func) @@ -1800,7 +1809,9 @@ void MC_EditBox_Key(menuedit_t *edit, int key, unsigned int unicode) void MC_Combo_Key(menucombo_t *combo, int key) { - if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_RIGHTARROW || key == K_KP_RIGHTARROW || key == K_GP_DPAD_RIGHT || key == K_GP_LEFT_THUMB_RIGHT ||key == K_GP_DIAMOND_ALTCONFIRM || key == K_MWHEELDOWN || key == K_MOUSE1 || key == K_TOUCHTAP) + if (key == K_DEL && combo->cvar) + Cvar_Set(combo->cvar, combo->cvar->defaultstr); + else if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_RIGHTARROW || key == K_KP_RIGHTARROW || key == K_GP_DPAD_RIGHT || key == K_GP_LEFT_THUMB_RIGHT ||key == K_GP_DIAMOND_ALTCONFIRM || key == K_MWHEELDOWN || key == K_MOUSE1 || key == K_TOUCHTAP) { combo->selectedoption++; if (combo->selectedoption >= combo->numoptions) @@ -2349,24 +2360,24 @@ static int M_Main_AddExtraOptions(emenu_t *mainm, int y) if (Cmd_AliasExist("mod_menu", RESTRICT_LOCAL)) {MC_AddConsoleCommandQBigFont(mainm, 72, y, va("%-14s", Cvar_Get("mod_menu", "Mod Menu", 0, NULL)->string), "mod_menu\n"); y += 20;} if (Cmd_Exists("xmpp")) - {MC_AddConsoleCommandQBigFont(mainm, 72, y, "Social ", "xmpp\n"); y += 20;} + {MC_AddConsoleCommandQBigFont(mainm, 72, y, localtext("Social "), "xmpp\n"); y += 20;} if (Cmd_Exists("irc")) - {MC_AddConsoleCommandQBigFont(mainm, 72, y, "IRC ", "irc\n"); y += 20;} + {MC_AddConsoleCommandQBigFont(mainm, 72, y, localtext("IRC "), "irc\n"); y += 20;} if (Cmd_Exists("qi")) - {MC_AddConsoleCommandQBigFont(mainm, 72, y, "Quake Injector", "qi\n"); y += 20;} + {MC_AddConsoleCommandQBigFont(mainm, 72, y, localtext("Quake Injector"), "qi\n"); y += 20;} else if (PM_CanInstall("qi")) - {MC_AddConsoleCommandQBigFont(mainm, 72, y, "Get Quake Injector", "pkg reset; pkg add qi; pkg apply\n"); y += 20;} + {MC_AddConsoleCommandQBigFont(mainm, 72, y, localtext("Get Quake Injector"), "pkg reset; pkg add qi; pkg apply\n"); y += 20;} if (Cmd_Exists("menu_download")) { #ifdef WEBCLIENT - MC_AddConsoleCommandQBigFont(mainm, 72, y, "^bUpdates ", "menu_download\n"); y += 20; + MC_AddConsoleCommandQBigFont(mainm, 72, y, localtext("^bUpdates "), "menu_download\n"); y += 20; #else - MC_AddConsoleCommandQBigFont(mainm, 72, y, "^bPackages ", "menu_download\n"); y += 20; + MC_AddConsoleCommandQBigFont(mainm, 72, y, localtext("^bPackages "), "menu_download\n"); y += 20; #endif } if (Cmd_Exists("menu_mods")) { - MC_AddConsoleCommandQBigFont(mainm, 72, y, "Mods ", "menu_mods\n"); y += 20; + MC_AddConsoleCommandQBigFont(mainm, 72, y, localtext("Mods "), "menu_mods\n"); y += 20; y += 20; } @@ -2386,7 +2397,9 @@ void MC_Main_Predraw(emenu_t *menu) PM_AreSourcesNew(false)|| #endif !m_preset_chosen.ival; - b->text = (char*)(b+1) + (flash?0:2); + b->text = (char*)(b+1); + if (b->text[0] == '^' && b->text[1] == 'b' && !flash) + b->text += 2; } #ifdef PACKAGEMANAGER @@ -2394,7 +2407,9 @@ void MC_Main_Predraw(emenu_t *menu) if (b && b->text[0] && b->text[1]) { qboolean flash = PM_AreSourcesNew(false); - b->text = (char*)(b+1) + (flash?0:2); + b->text = (char*)(b+1); + if (b->text[0] == '^' && b->text[1] == 'b' && !flash) + b->text += 2; } #endif } @@ -2485,27 +2500,27 @@ void M_Menu_Main_f (void) #if defined(HAVE_SERVER) && defined(Q2SERVER) b = MC_AddConsoleCommand (mainm, 68, 320, 13, "", "menu_single\n"); - b->common.tooltip = "Singleplayer."; + b->common.tooltip = localtext("Singleplayer."); mainm->selecteditem = (menuoption_t *)b; b->common.width = 12*20; b->common.height = itemheight; #endif b = MC_AddConsoleCommand (mainm, 68, 320, 53, "", "menu_multi\n"); - b->common.tooltip = "Multiplayer."; + b->common.tooltip = localtext("Multiplayer."); if (!mainm->selecteditem) mainm->selecteditem = (menuoption_t *)b; b->common.width = 12*20; b->common.height = itemheight; b = MC_AddConsoleCommand (mainm, 68, 320, 93, "", "menu_options\n"); - b->common.tooltip = "Options."; + b->common.tooltip = localtext("Options."); b->common.width = 12*20; b->common.height = itemheight; b = MC_AddConsoleCommand (mainm, 68, 320, 133, "", "menu_video\n"); - b->common.tooltip = "Video Options."; + b->common.tooltip = localtext("Video Options."); b->common.width = 12*20; b->common.height = itemheight; b = MC_AddConsoleCommand (mainm, 68, 320, 173, "", "menu_quit\n"); - b->common.tooltip = "Quit to DOS."; + b->common.tooltip = localtext("Quit to DOS."); b->common.width = 12*20; b->common.height = itemheight; @@ -2528,37 +2543,37 @@ void M_Menu_Main_f (void) MC_AddCenterPicture(mainm, 0, 60, "gfx/menu/title0.lmp"); #ifndef CLIENTONLY - b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, y, "Single Player", "menu_single\n"); + b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, y, localtext("Single Player"), "menu_single\n"); mainm->selecteditem = (menuoption_t *)b; b->common.width = 12*20; b->common.height = 20; y += 20; #endif - b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, y, "MultiPlayer", "menu_multi\n"); + b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, y, localtext("MultiPlayer"), "menu_multi\n"); #ifdef CLIENTONLY mainm->selecteditem = (menuoption_t *)b; #endif b->common.width = 12*20; b->common.height = 20; y += 20; - b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, y, "^bOptions", "menu_options\n"); + b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, y, localtext("^bOptions"), "menu_options\n"); b->common.width = 12*20; b->common.height = 20; y += 20; if (m_helpismedia.value) - b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, y, "Media", "menu_media\n"); + b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, y, localtext("Media"), "menu_media\n"); else - b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, y, "Help", "help\n"); + b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, y, localtext("Help"), "help\n"); b->common.width = 12*20; b->common.height = 20; y += 20; - b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, y, "Mods", "menu_mods\n"); + b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, y, localtext("Mods"), "menu_mods\n"); b->common.width = 12*20; b->common.height = 20; y += 20; - b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, y, "Quit", "menu_quit\n"); + b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, y, localtext("Quit"), "menu_quit\n"); b->common.width = 12*20; b->common.height = 20; y += 20; @@ -2582,19 +2597,19 @@ void M_Menu_Main_f (void) y = 32; mainm->selecteditem = (menuoption_t *) #ifndef CLIENTONLY - MC_AddConsoleCommandQBigFont (mainm, 72, y, "Single ", "menu_single\n"); y += 20; + MC_AddConsoleCommandQBigFont (mainm, 72, y, localtext("Single "), "menu_single\n"); y += 20; #endif - MC_AddConsoleCommandQBigFont (mainm, 72, y, "Multiplayer ", "menu_multi\n"); y += 20; - MC_AddConsoleCommandQBigFont (mainm, 72, y,"^bOptions ", "menu_options\n"); y += 20; + MC_AddConsoleCommandQBigFont (mainm, 72, y, localtext("Multiplayer "), "menu_multi\n"); y += 20; + MC_AddConsoleCommandQBigFont (mainm, 72, y,localtext("^bOptions "), "menu_options\n"); y += 20; if (m_helpismedia.value) - {MC_AddConsoleCommandQBigFont(mainm, 72, y, "Media ", "menu_media\n"); y += 20;} + {MC_AddConsoleCommandQBigFont(mainm, 72, y, localtext("Media "), "menu_media\n"); y += 20;} else - {MC_AddConsoleCommandQBigFont(mainm, 72, y, "Help ", "help\n"); y += 20;} + {MC_AddConsoleCommandQBigFont(mainm, 72, y, localtext("Help "), "help\n"); y += 20;} y = M_Main_AddExtraOptions(mainm, y); #ifdef FTE_TARGET_WEB - MC_AddConsoleCommandQBigFont (mainm, 72, y, "Save Settings ", "menu_quit\n"); y += 20; + MC_AddConsoleCommandQBigFont (mainm, 72, y, localtext("Save Settings "), "menu_quit\n"); y += 20; #else - MC_AddConsoleCommandQBigFont (mainm, 72, y, "Quit ", "menu_quit\n"); y += 20; + MC_AddConsoleCommandQBigFont (mainm, 72, y, localtext("Quit "), "menu_quit\n"); y += 20; #endif mainm->cursoritem = (menuoption_t *)MC_AddCursor(mainm, &resel, 54, mainm->selecteditem->common.posy); @@ -2616,35 +2631,35 @@ void M_Menu_Main_f (void) MC_AddPicture(mainm, 72, 32, 240, 112, "gfx/mainmenu.lmp"); b=MC_AddConsoleCommand (mainm, 72, 312, 32, "", "menu_single\n"); - b->common.tooltip = "Start singleplayer Quake game."; + b->common.tooltip = localtext("Start singleplayer Quake game."); mainm->selecteditem = (menuoption_t *)b; b->common.width = width; b->common.height = 20; b=MC_AddConsoleCommand (mainm, 72, 312, 52, "", "menu_multi\n"); - b->common.tooltip = "Multiplayer menu."; + b->common.tooltip = localtext("Multiplayer menu."); b->common.width = width; b->common.height = 20; b=MC_AddConsoleCommand (mainm, 72, 312, 72, "", "menu_options\n"); - b->common.tooltip = "Options menu."; + b->common.tooltip = localtext("Options menu."); b->common.width = width; b->common.height = 20; if (m_helpismedia.value) { b=MC_AddConsoleCommand(mainm, 72, 312, 92, "", "menu_media\n"); - b->common.tooltip = "Media menu."; + b->common.tooltip = localtext("Media menu."); } else { b=MC_AddConsoleCommand(mainm, 72, 312, 92, "", "help\n"); - b->common.tooltip = "Help menu."; + b->common.tooltip = localtext("Help menu."); } b->common.width = width; b->common.height = 20; b=MC_AddConsoleCommand (mainm, 72, 312, 112, "", "menu_quit\n"); #ifdef FTE_TARGET_WEB - b->common.tooltip = "Save settings to local storage."; + b->common.tooltip = localtext("Save settings to local storage."); #else - b->common.tooltip = "Exit to DOS."; + b->common.tooltip = localtext("Exit to DOS."); #endif b->common.width = width; b->common.height = 20; @@ -2663,10 +2678,10 @@ void M_Menu_Main_f (void) y = 36; mainm->selecteditem = (menuoption_t *) //skip menu_single if we don't seem to have any content. - MC_AddConsoleCommandQBigFont (mainm, 72, y, "Join server", "menu_servers\n"); y += 20; - MC_AddConsoleCommandQBigFont (mainm, 72, y, "^bOptions", "menu_options\n"); y += 20; + MC_AddConsoleCommandQBigFont (mainm, 72, y, localtext("Join server"), "menu_servers\n"); y += 20; + MC_AddConsoleCommandQBigFont (mainm, 72, y, localtext("^bOptions"), "menu_options\n"); y += 20; y = M_Main_AddExtraOptions(mainm, y); - MC_AddConsoleCommandQBigFont (mainm, 72, y, "Quit", "menu_quit\n"); y += 20; + MC_AddConsoleCommandQBigFont (mainm, 72, y, localtext("Quit"), "menu_quit\n"); y += 20; mainm->cursoritem = (menuoption_t *)MC_AddCursor(mainm, &resel, 54, mainm->selecteditem->common.posy); } diff --git a/engine/client/m_master.c b/engine/client/m_master.c index da2f5fca8..19a7118c2 100644 --- a/engine/client/m_master.c +++ b/engine/client/m_master.c @@ -435,7 +435,7 @@ static void SL_PreDraw (emenu_t *menu) } info->numslots = Master_NumSorted(); - snprintf(info->refreshtext, sizeof(info->refreshtext), "Refresh - %u/%u/%u\n", info->numslots, Master_NumAlive(), Master_TotalCount()); + snprintf(info->refreshtext, sizeof(info->refreshtext), localtext("Refresh - %u/%u/%u\n"), info->numslots, Master_NumAlive(), Master_TotalCount()); } qboolean NET_SendPollPacket(int len, void *data, netadr_t to); static void SL_PostDraw (emenu_t *menu) @@ -587,7 +587,7 @@ static void SL_PostDraw (emenu_t *menu) x = lx; for (i = 0; i < countof(helpstrings); i++) { - Draw_FunStringWidth (x, y, helpstrings[i], w, false, false); + Draw_FunStringWidth (x, y, localtext(helpstrings[i]), w, false, false); y += 8; } } @@ -667,15 +667,15 @@ static void SL_PostDraw (emenu_t *menu) y += 8; } - Draw_FunStringWidth (lx, y, "^h(left/rightarrow for different info)", w, false, false); + Draw_FunStringWidth (lx, y, localtext("^h(left/rightarrow for different info)"), w, false, false); } #endif } else { Draw_ApproxTextBox(vid.width/2 - 100, vid.height/2 - 16, 200, 16*3); - Draw_FunStringWidth(vid.width/2 - 100, vid.height/2 - 8, "Querying server", 200, 2, false); - Draw_FunStringWidth(vid.width/2 - 100, vid.height/2 + 0, "Please wait", 200, 2, false); + Draw_FunStringWidth(vid.width/2 - 100, vid.height/2 - 8, localtext("Querying server"), 200, 2, false); + Draw_FunStringWidth(vid.width/2 - 100, vid.height/2 + 0, localtext("Please wait"), 200, 2, false); } if (server && (server->special & SS_PROTOCOLMASK) == SS_QUAKEWORLD) @@ -687,7 +687,7 @@ static void SL_PostDraw (emenu_t *menu) bw = w+16+12; bh = 24; // lx += bw-12; - bw = strlen("Observe")*8 + 24; + bw = strlen(localtext("Observe"))*8 + 24; bw = ((bw+15)/16) * 16; //width must be a multiple of 16 // lx -= bw; @@ -703,7 +703,7 @@ static void SL_PostDraw (emenu_t *menu) if (mousecursor_y >= specbutton.y && mousecursor_y < specbutton.y+specbutton.height) active = true; - Draw_FunStringWidth(lx, y + (bh-8)/2, "Observe", bw, 2, active);y+=8; + Draw_FunStringWidth(lx, y + (bh-8)/2, localtext("Observe"), bw, 2, active);y+=8; } { @@ -714,7 +714,7 @@ static void SL_PostDraw (emenu_t *menu) bw = w+16; bh = 24; lx += w-12; - bw = strlen("Join")*8 + 24; + bw = strlen(localtext("Join"))*8 + 24; bw = ((bw+15)/16) * 16; //width must be a multiple of 16 lx -= bw; @@ -731,37 +731,37 @@ static void SL_PostDraw (emenu_t *menu) if (mousecursor_y >= joinbutton.y && mousecursor_y < joinbutton.y+joinbutton.height) active = true; - Draw_FunStringWidth(lx, y + (bh-8)/2, "Join", bw, 2, active);y+=8; + Draw_FunStringWidth(lx, y + (bh-8)/2, localtext("Join"), bw, 2, active);y+=8; } } else if (isrefreshing) { R2D_ImageColours(1,1,1,1); Draw_ApproxTextBox(vid.width/2 - 100-4, vid.height/2 - 24, 200, 64); - Draw_FunStringWidth(vid.width/2 - 100, vid.height/2 - 8, "Refreshing, please wait", 200, 2, false); - Draw_FunStringWidth(vid.width/2 - 100, vid.height/2 + 0, va("%i of %i", Master_NumPolled(), Master_TotalCount()), 200, 2, false); + Draw_FunStringWidth(vid.width/2 - 100, vid.height/2 - 8, localtext("Refreshing, please wait"), 200, 2, false); + Draw_FunStringWidth(vid.width/2 - 100, vid.height/2 + 0, va(localtext("polling %i of %i"), Master_NumPolled(), Master_TotalCount()), 200, 2, false); } else if (!info->numslots) { R2D_ImageColours(1,1,1,1); if (!Master_TotalCount()) { - Draw_FunStringWidth(0, vid.height/2 - 8, "No servers found", vid.width, 2, false); + Draw_FunStringWidth(0, vid.height/2 - 8, localtext("No servers found"), vid.width, 2, false); #ifdef HAVE_PACKET - Draw_FunStringWidth(0, vid.height/2 + 0, "Check internet connection", vid.width, 2, false); + Draw_FunStringWidth(0, vid.height/2 + 0, localtext("Check internet connection"), vid.width, 2, false); #endif } else if (!Master_NumAlive()) { - Draw_FunStringWidth(0, vid.height/2 - 8, "No servers responding", vid.width, 2, false); + Draw_FunStringWidth(0, vid.height/2 - 8, localtext("No servers responding"), vid.width, 2, false); #ifdef HAVE_PACKET - Draw_FunStringWidth(0, vid.height/2 + 0, "Check udp internet connection", vid.width, 2, false); + Draw_FunStringWidth(0, vid.height/2 + 0, localtext("Check udp internet connection"), vid.width, 2, false); #endif } else { - Draw_FunStringWidth(0, vid.height/2 - 8, "All servers were filtered out", vid.width, 2, false); - Draw_FunStringWidth(0, vid.height/2 + 0, "Change filter settings", vid.width, 2, false); + Draw_FunStringWidth(0, vid.height/2 - 8, localtext("All servers were filtered out"), vid.width, 2, false); + Draw_FunStringWidth(0, vid.height/2 + 0, localtext("Change filter settings"), vid.width, 2, false); } } } @@ -980,7 +980,7 @@ static void SL_ServerPlayer (int x, int y, menucustom_t *ths, emenu_t *menu) { int i = ths->dint; if (selectedserver.detail->players[i].isspec&1) - Draw_FunStringWidth (x, y, "spectator", 32, false, false); + Draw_FunStringWidth (x, y, localtext("spectator"), 32, false, false); else { R2D_ImagePaletteColour (Sbar_ColorForMap(selectedserver.detail->players[i].topc), 1.0); @@ -1241,29 +1241,29 @@ void M_Menu_ServerList2_f(void) } } - strcpy(info->refreshtext, "Refresh"); + strcpy(info->refreshtext, localtext("Refresh Server List")); - MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*1, "Ping ", &sb_showping, 1); - MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*2, "Address ", &sb_showaddress, 1); - MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*3, "Map ", &sb_showmap, 1); - MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*4, "Gamedir ", &sb_showgamedir, 1); - MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*5, "Players ", &sb_showplayers, 1); - MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*6, "Fraglimit", &sb_showfraglimit, 1); - MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*7, "Timelimit", &sb_showtimelimit, 1); + MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*1, localtext("Ping "), &sb_showping, 1); + MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*2, localtext("Address "), &sb_showaddress, 1); + MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*3, localtext("Map "), &sb_showmap, 1); + MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*4, localtext("Gamedir "), &sb_showgamedir, 1); + MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*5, localtext("Players "), &sb_showplayers, 1); + MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*6, localtext("Fraglimit"), &sb_showfraglimit, 1); + MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*7, localtext("Timelimit"), &sb_showtimelimit, 1); #ifdef NQPROT if (M_GameType() == MGT_QUAKE1) { - MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*1, "Show NQ ", SL_ReFilter, SLFILTER_HIDENETQUAKE); - MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*2, "Show QW ", SL_ReFilter, SLFILTER_HIDEQUAKEWORLD); + MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*1, localtext("Show NQ "), SL_ReFilter, SLFILTER_HIDENETQUAKE); + MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*2, localtext("Show QW "), SL_ReFilter, SLFILTER_HIDEQUAKEWORLD); } #endif - MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*3, "Show Proxies", SL_ReFilter, SLFILTER_HIDEPROXIES); + MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*3, localtext("Show Proxies"), SL_ReFilter, SLFILTER_HIDEPROXIES); info->filtertext = - MC_AddEditCvar (menu, 128, 200, vid.height - 64+8*4, "Filter ", sb_filtertext.name, true); - MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*5, "Only Favs ", SL_ReFilter, SLFILTER_ONLYFAVOURITES); - MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*6, "Show Empty", SL_ReFilter, SLFILTER_HIDEEMPTY); - MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*7, "Show Full ", SL_ReFilter, SLFILTER_HIDEFULL); + MC_AddEditCvar (menu, 128, 200, vid.height - 64+8*4, localtext("Filter "), sb_filtertext.name, true); + MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*5, localtext("Only Favs "), SL_ReFilter, SLFILTER_ONLYFAVOURITES); + MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*6, localtext("Show Empty"), SL_ReFilter, SLFILTER_HIDEEMPTY); + MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*7, localtext("Show Full "), SL_ReFilter, SLFILTER_HIDEFULL); MC_AddCommand(menu, 64, 320, 0, info->refreshtext, SL_DoRefresh); @@ -1351,7 +1351,7 @@ static void M_QuickConnect_PreDraw(emenu_t *menu) if (best) { - Con_Printf("Quick connect found %s (gamedir %s, players %i/%i/%i, ping %ims)\n", best->name, best->gamedir, best->numhumans, best->players, best->maxplayers, best->ping); + Con_TPrintf("Quick connect found %s (gamedir %s, players %i/%i/%i, ping %ims)\n", best->name, best->gamedir, best->numhumans, best->players, best->maxplayers, best->ping); #ifdef NQPROT if ((best->special & SS_PROTOCOLMASK) == SS_QEPROT) @@ -1409,8 +1409,8 @@ void M_QuickConnect_f(void) cust->common.height = 8; cust->common.width = vid.width-8; - MC_AddCommand(menu, 64, 0, 128, "Refresh", SL_DoRefresh); - MC_AddCommand(menu, 64, 0, 136, "Cancel", M_QuickConnect_Cancel); + MC_AddCommand(menu, 64, 0, 128, localtext("Refresh"), SL_DoRefresh); + MC_AddCommand(menu, 64, 0, 136, localtext("Cancel"), M_QuickConnect_Cancel); } #endif diff --git a/engine/client/m_multi.c b/engine/client/m_multi.c index 0bbb3fecc..d398b1144 100644 --- a/engine/client/m_multi.c +++ b/engine/client/m_multi.c @@ -68,13 +68,13 @@ void M_Menu_MultiPlayer_f (void) mgt=32; menu->selecteditem = (menuoption_t*) - MC_AddConsoleCommandQBigFont (menu, 72, mgt, "Server List ", "menu_slist\n");mgt+=20; + MC_AddConsoleCommandQBigFont (menu, 72, mgt, localtext("Server List "), "menu_slist\n");mgt+=20; #ifdef HAVE_PACKET - MC_AddConsoleCommandQBigFont (menu, 72, mgt, "Quick Connect", "quickconnect qw\n");mgt+=20; + MC_AddConsoleCommandQBigFont (menu, 72, mgt, localtext("Quick Connect"), "quickconnect qw\n");mgt+=20; #endif - MC_AddConsoleCommandQBigFont (menu, 72, mgt, "New Server ", "menu_newmulti\n");mgt+=20; - MC_AddConsoleCommandQBigFont (menu, 72, mgt, "Player Setup", "menu_setup\n");mgt+=20; - MC_AddConsoleCommandQBigFont (menu, 72, mgt, "Demos ", "menu_demo\n");mgt+=20; + MC_AddConsoleCommandQBigFont (menu, 72, mgt, localtext("New Server "), "menu_newmulti\n");mgt+=20; + MC_AddConsoleCommandQBigFont (menu, 72, mgt, localtext("Player Setup"), "menu_setup\n");mgt+=20; + MC_AddConsoleCommandQBigFont (menu, 72, mgt, localtext("Demos "), "menu_demo\n");mgt+=20; menu->cursoritem = (menuoption_t*)MC_AddCursor(menu, &resel, 54, 32); return; @@ -106,13 +106,13 @@ void M_Menu_MultiPlayer_f (void) b->common.width = width; b = MC_AddConsoleCommand(menu, 72, 320, 92, "", "menu_demo\n"); - MC_AddWhiteText(menu, 72, 0, 92+20/2-6, "^aDemos", false); + MC_AddWhiteText(menu, 72, 0, 92+20/2-6, localtext("^aDemos"), false); b->common.height = 20; b->common.width = width; #ifdef HAVE_PACKET b = MC_AddConsoleCommand(menu, 72, 320, 112, "", "quickconnect qw\n"); - MC_AddWhiteText(menu, 72, 0, 112+20/2-6, "^aQuick Connect", false); + MC_AddWhiteText(menu, 72, 0, 112+20/2-6, localtext("^aQuick Connect"), false); b->common.height = 20; b->common.width = width; #endif @@ -463,8 +463,8 @@ void M_Menu_Setup_f (void) MC_AddCenterPicture(menu, 4, 24, "pics/m_banner_player_setup"); menu->selecteditem = (menuoption_t*) - (info->nameedit = MC_AddEdit(menu, 64, 160, 40, "Your name", name.string)); - (info->modeledit = MC_AddCvarCombo(menu, 64, 160,72, "model", &skin, (const char **)modeloptions, (const char **)modeloptions)); + (info->nameedit = MC_AddEdit(menu, 64, 160, 40, localtext("Your name"), name.string)); + (info->modeledit = MC_AddCvarCombo(menu, 64, 160,72, localtext("model"), &skin, (const char **)modeloptions, (const char **)modeloptions)); info->modeledit->selectedoption = !strncmp(skin.string, "female", 6); cu = MC_AddCustom(menu, 64, 88+16, NULL, 0, NULL); cu->draw = MSetupQ2_TransDraw; @@ -483,8 +483,8 @@ void M_Menu_Setup_f (void) y = 40; menu->selecteditem = (menuoption_t*) - (info->nameedit = MC_AddEdit(menu, 64, 160, y, "Your name", name.string)); y+= info->nameedit->common.height; - (info->teamedit = MC_AddEdit(menu, 64, 160, y, "Your team", team.string)); y+= info->teamedit->common.height; + (info->nameedit = MC_AddEdit(menu, 64, 160, y, localtext("Your name"), name.string)); y+= info->nameedit->common.height; + (info->teamedit = MC_AddEdit(menu, 64, 160, y, localtext("Your team"), team.string)); y+= info->teamedit->common.height; #ifdef HEXEN2 info->ticlass = -1; if (M_GameType() == MGT_HEXEN2) @@ -499,7 +499,7 @@ void M_Menu_Setup_f (void) NULL }; cvar_t *pc = Cvar_Get("cl_playerclass", "1", CVAR_USERINFO|CVAR_ARCHIVE, "Hexen2"); - (info->classedit = MC_AddCombo(menu, 64, 160, y, "Your class", (const char **)classnames, pc->ival-1)); y+= info->classedit->common.height; + (info->classedit = MC_AddCombo(menu, 64, 160, y, localtext("Your class"), (const char **)classnames, pc->ival-1)); y+= info->classedit->common.height; //trim options if the artwork is missing. while (info->classedit->numoptions && !COM_FCheckExists(va("gfx/menu/netp%i.lmp", info->classedit->numoptions))) @@ -511,23 +511,23 @@ void M_Menu_Setup_f (void) MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp"); MC_AddCenterPicture(menu, 4, 24, "gfx/p_multi.lmp"); - (info->skinedit = MC_AddEdit(menu, 64, 160, y, "Your skin", skin.string)); y+= info->skinedit->common.height; + (info->skinedit = MC_AddEdit(menu, 64, 160, y, localtext("Your skin"), skin.string)); y+= info->skinedit->common.height; } ci = MC_AddCustom(menu, 172+32, y, NULL, 0, NULL); ci->draw = MSetup_TransDraw; ci->key = NULL; - MC_AddCommand(menu, 64, 160, y+8, "Top colour", SetupMenuColour); - MC_AddCommand(menu, 64, 160, y+32, "Lower colour", SetupMenuColour); + MC_AddCommand(menu, 64, 160, y+8, localtext("Top colour"), SetupMenuColour); + MC_AddCommand(menu, 64, 160, y+32, localtext("Lower colour"), SetupMenuColour); y+= 16; y+=4; - b = MC_AddConsoleCommand(menu, 64, 204, 168, "Network Settings", "menu_network\n"); - b->common.tooltip = "Change network and client prediction settings."; + b = MC_AddConsoleCommand(menu, 64, 204, 168, localtext("Network Settings"), "menu_network\n"); + b->common.tooltip = localtext("Change network and client prediction settings."); y += b->common.height; - b = MC_AddConsoleCommand(menu, 64, 204, 176, "Teamplay Settings", "menu_teamplay\n"); - b->common.tooltip = "Change teamplay macro settings."; + b = MC_AddConsoleCommand(menu, 64, 204, 176, localtext("Teamplay Settings"), "menu_teamplay\n"); + b->common.tooltip = localtext("Change teamplay macro settings."); y += b->common.height; menu->cursoritem = (menuoption_t*)MC_AddCursorSmall(menu, &resel, 54); @@ -773,11 +773,11 @@ void M_Menu_GameOptions_f (void) // MC_AddPicture(menu, 72, 32, ("gfx/mp_menu.lmp") ); menu->selecteditem = (menuoption_t*) - MC_AddCommand (menu, 64, 160, y, "Start game", MultiBeginGame);y+=16; + MC_AddCommand (menu, 64, 160, y, localtext("Start game"), MultiBeginGame);y+=16; y+=4; - info->hostnameedit = MC_AddEdit (menu, 64, 160, y, "Hostname", name.string);y+=info->hostnameedit->common.height; - info->publicgame = MC_AddCombo (menu, 64, 160, y, "Public", publicoptions, bound(0, sv_public.ival+1, 4));y+=8; + info->hostnameedit = MC_AddEdit (menu, 64, 160, y, localtext("Hostname"), name.string);y+=info->hostnameedit->common.height; + info->publicgame = MC_AddCombo (menu, 64, 160, y, localtext("Public"), publicoptions, bound(0, sv_public.ival+1, 4));y+=8; #if !defined(FTE_TARGET_WEB) && defined(HAVE_DTLS) { static const char *encoptions[] = @@ -788,7 +788,7 @@ void M_Menu_GameOptions_f (void) "Require", NULL }; - MC_AddCvarCombo (menu, 64, 160, y, "DTLS Encryption", &net_enable_dtls, encoptions, NULL);y+=8; + MC_AddCvarCombo (menu, 64, 160, y, localtext("DTLS Encryption"), &net_enable_dtls, encoptions, NULL);y+=8; } #endif y+=4; @@ -799,15 +799,15 @@ void M_Menu_GameOptions_f (void) break; } - info->numplayers = MC_AddCombo (menu, 64, 160, y, "Max players", (const char **)numplayeroptions, players);y+=8; + info->numplayers = MC_AddCombo (menu, 64, 160, y, localtext("Max players"), (const char **)numplayeroptions, players);y+=8; - info->deathmatch = MC_AddCombo (menu, 64, 160, y, "Deathmatch", (const char **)deathmatchoptions, deathmatch.value);y+=8; - info->teamplay = MC_AddCombo (menu, 64, 160, y, "Teamplay", (!strcasecmp(FS_GetGamedir(true), "rogue")?(const char **)teamplayoptions_rogue:(const char **)teamplayoptions), teamplay.value);y+=8; - info->skill = MC_AddCombo (menu, 64, 160, y, "Skill", (const char **)skilloptions, skill.value);y+=8; - info->rundedicated = MC_AddCheckBox(menu, 64, 160, y, "dedicated", NULL, 0);y+=8; + info->deathmatch = MC_AddCombo (menu, 64, 160, y, localtext("Deathmatch"), (const char **)deathmatchoptions, deathmatch.value);y+=8; + info->teamplay = MC_AddCombo (menu, 64, 160, y, localtext("Teamplay"), (!strcasecmp(FS_GetGamedir(true), "rogue")?(const char **)teamplayoptions_rogue:(const char **)teamplayoptions), teamplay.value);y+=8; + info->skill = MC_AddCombo (menu, 64, 160, y, localtext("Skill"), (const char **)skilloptions, skill.value);y+=8; + info->rundedicated = MC_AddCheckBox(menu, 64, 160, y, localtext("dedicated"), NULL, 0);y+=8; y+=8; - info->timelimit = MC_AddCombo (menu, 64, 160, y, "Time Limit", (const char **)timelimitoptions, timelimit.value/5);y+=8; - info->fraglimit = MC_AddCombo (menu, 64, 160, y, "Frag Limit", (const char **)fraglimitoptions, fraglimit.value/10);y+=8; + info->timelimit = MC_AddCombo (menu, 64, 160, y, localtext("Time Limit"), (const char **)timelimitoptions, timelimit.value/5);y+=8; + info->fraglimit = MC_AddCombo (menu, 64, 160, y, localtext("Frag Limit"), (const char **)fraglimitoptions, fraglimit.value/10);y+=8; y+=8; //populate it with an appropriate default. its a shame it won't change with the deathmatch/coop options @@ -832,7 +832,7 @@ void M_Menu_GameOptions_f (void) COM_EnumerateFiles("maps/*.map.gz", M_Menu_GameOptions_AddMap, &mapopts); COM_EnumerateFiles("maps/*.cm", M_Menu_GameOptions_AddMap, &mapopts); COM_EnumerateFiles("maps/*.hmp", M_Menu_GameOptions_AddMap, &mapopts); - info->mapname = MC_AddCombo (menu, 64, 160, y, "Map", (const char **)mapopts.maps, 0);y+=8; + info->mapname = MC_AddCombo (menu, 64, 160, y, localtext("Map"), (const char **)mapopts.maps, 0);y+=8; y += 16; menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 54, 0, menu->selecteditem->common.posy, NULL, false); diff --git a/engine/client/m_options.c b/engine/client/m_options.c index 24c0cc7a1..4d92152e6 100644 --- a/engine/client/m_options.c +++ b/engine/client/m_options.c @@ -415,7 +415,7 @@ void M_Menu_Options_f (void) "3", NULL }; - MC_AddCvarCombo(menu, 16, 216, y, "Use Hud Plugin", &plug_sbar, hudplugopts, hudplugvalues); y += 8; + MC_AddCvarCombo(menu, 16, 216, y, localtext("Use Hud Plugin"), &plug_sbar, hudplugopts, hudplugvalues); y += 8; } #endif MC_AddFrameEnd(menu, framey); @@ -1303,17 +1303,18 @@ static void M_Menu_Preset_Predraw(emenu_t *menu) if (!strcmp(op->button.command, "menupop\n")) { if (m_preset_chosen.ival) - op->button.text = "^sAccept"; + op->button.text = localtext("^sAccept"); } else if (!strncmp(op->button.command, "fps_preset ", 11)) { - ((char*)op->button.text)[1] = (preset==0)?'m':'7'; + if (((char*)op->button.text)[0] == '^' && ((char*)op->button.text)[1] == ((preset!=0)?'m':'7')) + ((char*)op->button.text)[1] = (preset==0)?'m':'7'; preset--; } #if defined(WEBCLIENT) && defined(PACKAGEMANAGER) else if (!strcmp(op->button.command, "menu_download\n")) { - op->button.text = PM_AreSourcesNew(false)?"^bPackages (New!)":"Packages"; + op->button.text = PM_AreSourcesNew(false)?localtext("^bPackages (New!)"):localtext("Packages"); op->common.posx = op->common.next->common.posx; op->common.width = 216-op->common.posx; } diff --git a/engine/client/m_single.c b/engine/client/m_single.c index 670e2a4f3..220030df6 100644 --- a/engine/client/m_single.c +++ b/engine/client/m_single.c @@ -372,7 +372,7 @@ void M_Menu_SinglePlayer_f (void) #endif #if MAX_SPLITS > 1 - b = (menubutton_t*)MC_AddCvarCombo(menu, 72, 170, 96, "Splitscreen", &cl_splitscreen, splitopts, splitvals); + b = (menubutton_t*)MC_AddCvarCombo(menu, 72, 170, 96, localtext("Splitscreen"), &cl_splitscreen, splitopts, splitvals); #endif menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 48, 0, 40, NULL, false); @@ -412,7 +412,7 @@ void M_Menu_SinglePlayer_f (void) MC_AddCenterPicture(menu, 0, 60, "gfx/menu/title2.lmp"); if (cl_splitscreen.ival) - MC_AddBufferedText(menu, 80, 0, (y+=8)+12, va("Player %i\n", pnum), false, true); + MC_AddBufferedText(menu, 80, 0, (y+=8)+12, va(localtext("Player %i\n"), pnum), false, true); for (i = 0; i <= 4+havemp; i++) { @@ -501,7 +501,7 @@ void M_Menu_SinglePlayer_f (void) MC_AddConsoleCommandHexen2BigFont(menu, 80, y+=20, "Load Game", "menu_load\n"); #endif - MC_AddCvarCombo(menu, 72, 170, y+=20, "Splitscreen", &cl_splitscreen, splitopts, splitvals); + MC_AddCvarCombo(menu, 72, 170, y+=20, localtext("Splitscreen"), &cl_splitscreen, splitopts, splitvals); } menu->cursoritem = (menuoption_t *)MC_AddCursor(menu, &resel, 56, menu->selecteditem?menu->selecteditem->common.posy:0); @@ -566,7 +566,7 @@ void M_Menu_SinglePlayer_f (void) #if MAX_SPLITS > 1 b = (menubutton_t*)MC_AddCvarCombo(menu, 72, 72+width/2, 92, "", &cl_splitscreen, splitopts, splitvals); - MC_AddWhiteText(menu, 72, 0, 92, "^aSplitscreen", false); + MC_AddRedText(menu, 72, 0, 92, localtext("Splitscreen"), false); b->common.height = 20; b->common.width = width; #endif @@ -1084,7 +1084,7 @@ static void ShowDemoMenu (emenu_t *menu, const char *path) return //wut? don't confuse basedirs here... Z_Free(info->man->basedir); info->man->basedir = Z_StrDup(info->fs->path); - Menu_Prompt(FS_GameDirPrompted, &menu->menu, va("Use this directory?%s", info->fs->path), "Yes!", NULL, "No", true); + Menu_Prompt(FS_GameDirPrompted, &menu->menu, va(localtext("Use this directory?\n%s"), info->fs->path), "Yes!", NULL, "No", true); } } void M_Demo_Reselect(demomenu_t *info, const char *name) @@ -1170,7 +1170,7 @@ void M_Menu_Demos_f (void) info->ext[info->numext++] = archiveexts[u]; } - MC_AddWhiteText(menu, 24, 170, 8, "Choose a Demo", false); + MC_AddWhiteText(menu, 24, 170, 8, localtext("Choose a Demo"), false); MC_AddWhiteText(menu, 16, 170, 24, "^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f", false); info->list = MC_AddCustom(menu, 0, 32, NULL, 0, NULL); @@ -1237,7 +1237,7 @@ void M_Menu_MediaFiles_f (void) #endif #endif - MC_AddWhiteText(menu, 24, 170, 8, "Media List", false); + MC_AddWhiteText(menu, 24, 170, 8, localtext("Media List"), false); MC_AddWhiteText(menu, 16, 170, 24, "^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f", false); info->list = MC_AddCustom(menu, 0, 32, NULL, 0, NULL); @@ -1287,7 +1287,7 @@ void M_Menu_BasedirPrompt(ftemanifest_t *man) info->numext = 0; - MC_AddWhiteText(menu, 24, 170, 8, va("Where is %s installed?", man->formalname), false); + MC_AddWhiteText(menu, 24, 170, 8, va(localtext("Where is %s installed?"), man->formalname), false); MC_AddWhiteText(menu, 16, 170, 24, "^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f", false); info->list = MC_AddCustom(menu, 0, 32, NULL, 0, NULL); diff --git a/engine/client/menu.c b/engine/client/menu.c index 864590465..8489489a7 100644 --- a/engine/client/menu.c +++ b/engine/client/menu.c @@ -617,6 +617,13 @@ void Menu_Prompt (void (*callback)(void *, promptbutton_t), void *ctx, const cha char *t; conchar_t message[8192], *e; + if (optionyes) + optionyes = localtext(optionyes); + if (optionno) + optionno = localtext(optionno); + if (optioncancel) + optioncancel = localtext(optioncancel); + e = COM_ParseFunString(CON_WHITEMASK, messages, message, sizeof(message)-sizeof(conchar_t), false); m = (promptmenu_t*)Z_Malloc(sizeof(*m) + (e-message)*sizeof(conchar_t)+(optionyes?strlen(optionyes):0)+(optionno?strlen(optionno):0)+(optioncancel?strlen(optioncancel):0)+7); @@ -965,7 +972,7 @@ void M_Menu_Keys_f (void) "4" #endif }; - MC_AddCvarCombo(menu, 16, 170, y, "Force client", &cl_forceseat, (const char **)texts, (const char **)values); + MC_AddCvarCombo(menu, 16, 170, y, localtext("Force client"), &cl_forceseat, (const char **)texts, (const char **)values); y+=8; } #endif @@ -997,7 +1004,7 @@ void M_Menu_Keys_f (void) MC_AddFrameStart(menu, 48+8); while (bindnames->name) { - MC_AddBind(menu, 16, 170, y, bindnames->name, bindnames->command, NULL); + MC_AddBind(menu, 16, 170, y, localtext(bindnames->name), bindnames->command, NULL); y += 8; bindnames++; } @@ -1292,10 +1299,10 @@ void M_Menu_Quit_f (void) #endif break; case 2: - Menu_Prompt (M_Menu_DoQuitSave, NULL, "You have unsaved settings\nWould you like to\nsave them now?", "Yes", "No", "Cancel", true); + Menu_Prompt (M_Menu_DoQuitSave, NULL, localtext("You have unsaved settings\nWould you like to\nsave them now?"), "Yes", "No", "Cancel", true); break; case 1: - Menu_Prompt (M_Menu_DoQuit, NULL, quitMessage[rand()%countof(quitMessage)], "Quit", NULL, "Cancel", true); + Menu_Prompt (M_Menu_DoQuit, NULL, localtext(quitMessage[rand()%countof(quitMessage)]), "Quit", NULL, "Cancel", true); break; } } @@ -1303,7 +1310,7 @@ void M_Menu_Quit_f (void) #ifdef HAVE_LEGACY void M_Menu_Credits_f (void) { - Menu_Prompt (NULL, NULL, "That's all folks!\nTry a different mod now.", NULL, NULL, "Sure!", false); + Menu_Prompt (NULL, NULL, localtext("That's all folks!\nTry a different mod now."), NULL, NULL, "Sure!", false); } #endif diff --git a/engine/client/menu.h b/engine/client/menu.h index 21e99547f..6bba22985 100644 --- a/engine/client/menu.h +++ b/engine/client/menu.h @@ -347,11 +347,11 @@ struct emenu_s { menutext_t *MC_AddBufferedText(emenu_t *menu, int lhs, int rhs, int y, const char *text, int rightalign, qboolean red); menutext_t *MC_AddRedText(emenu_t *menu, int lhs, int rhs, int y, const char *text, int rightalign); menutext_t *MC_AddWhiteText(emenu_t *menu, int lhs, int rhs, int y, const char *text, int rightalign); -menubind_t *MC_AddBind(emenu_t *menu, int cx, int bx, int y, const char *caption, char *command, char *tooltip); +menubind_t *MC_AddBind(emenu_t *menu, int cx, int bx, int y, const char *caption, char *command, const char *tooltip); menubox_t *MC_AddBox(emenu_t *menu, int x, int y, int width, int height); -menupicture_t *MC_AddPicture(emenu_t *menu, int x, int y, int width, int height, char *picname); -menupicture_t *MC_AddSelectablePicture(emenu_t *menu, int x, int y, int height, char *picname); -menupicture_t *MC_AddCenterPicture(emenu_t *menu, int y, int height, char *picname); +menupicture_t *MC_AddPicture(emenu_t *menu, int x, int y, int width, int height, const char *picname); +menupicture_t *MC_AddSelectablePicture(emenu_t *menu, int x, int y, int height, const char *picname); +menupicture_t *MC_AddCenterPicture(emenu_t *menu, int y, int height, const char *picname); menupicture_t *MC_AddCursor(emenu_t *menu, menuresel_t *resel, int x, int y); menuoption_t *MC_AddCursorSmall(emenu_t *menu, menuresel_t *reselection, int x); menuslider_t *MC_AddSlider(emenu_t *menu, int tx, int sx, int y, const char *text, cvar_t *var, float min, float max, float delta); @@ -362,11 +362,11 @@ menubutton_t *MC_AddConsoleCommandQBigFont(emenu_t *menu, int x, int y, const ch mpic_t *QBigFontWorks(void); menubutton_t *MC_AddConsoleCommandHexen2BigFont(emenu_t *menu, int x, int y, const char *text, const char *command); menubutton_t *VARGS MC_AddConsoleCommandf(emenu_t *menu, int lhs, int rhs, int y, int rightalign, const char *text, char *command, ...); -menubutton_t *MC_AddCommand(emenu_t *menu, int lhs, int rhs, int y, char *text, qboolean (*command) (union menuoption_s *,struct emenu_s *,int)); +menubutton_t *MC_AddCommand(emenu_t *menu, int lhs, int rhs, int y, const char *text, qboolean (*command) (union menuoption_s *,struct emenu_s *,int)); menucombo_t *MC_AddCombo(emenu_t *menu, int tx, int cx, int y, const char *caption, const char **ops, int initialvalue); menucombo_t *MC_AddCvarCombo(emenu_t *menu, int tx, int cx, int y, const char *caption, cvar_t *cvar, const char **ops, const char **values); -menuedit_t *MC_AddEdit(emenu_t *menu, int cx, int ex, int y, char *text, char *def); -menuedit_t *MC_AddEditCvar(emenu_t *menu, int cx, int ex, int y, char *text, char *name, qboolean slim); +menuedit_t *MC_AddEdit(emenu_t *menu, int cx, int ex, int y, const char *text, const char *def); +menuedit_t *MC_AddEditCvar(emenu_t *menu, int cx, int ex, int y, const char *text, const char *name, qboolean slim); menucustom_t *MC_AddCustom(emenu_t *menu, int x, int y, void *dptr, int dint, const char *tooltip); menuframe_t *MC_AddFrameStart(emenu_t *menu, int y); //call before items are added menuframe_t *MC_AddFrameEnd(emenu_t *menu, int y); //and call AFTER that stuff with the same y. @@ -374,7 +374,7 @@ menuframe_t *MC_AddFrameEnd(emenu_t *menu, int y); //and call AFTER that stuff w typedef struct menubulk_s { menutype_t type; int variant; - char *text; + const char *text; const char *tooltip; char *consolecmd; // console command cvar_t *cvar; // check box, slider @@ -393,24 +393,24 @@ typedef struct menubulk_s { int spacing; // spacing } menubulk_t; -#define MB_CONSOLECMD(text, cmd, tip) {mt_button, 0, text, tip, cmd} -#define MB_CONSOLECMDRETURN(text, cmd, tip, ret) {mt_button, 0, text, tip, cmd, NULL, 0, NULL, 0, 0, 0, false, NULL, NULL, NULL, NULL, 0, (union menuoption_s **)&ret} -#define MB_CHECKBOXCVAR(text, cvar, cvarflag) {mt_checkbox, 0, text, NULL, NULL, &cvar, cvarflag} -#define MB_CHECKBOXCVARTIP(text, cvar, cvarflag, tip) {mt_checkbox, 0, text, tip, NULL, &cvar, cvarflag} -#define MB_CHECKBOXCVARRETURN(text, cvar, cvarflag, ret) {mt_checkbox, 0, text, NULL, NULL, &cvar, cvarflag, NULL, 0, 0, 0, false, NULL, NULL, NULL, NULL, 0, (union menuoption_s **)&ret} -#define MB_CHECKBOXFUNC(text, func, flags, tip) {mt_checkbox, 0, text, tip, NULL, NULL, flags, func} -#define MB_SLIDER(text, cvar, min, max, delta, tip) {mt_slider, 0, text, tip, NULL, &cvar, 0, NULL, min, max, delta} -#define MB_TEXT(text, align) {mt_text, 0, text, NULL, NULL, NULL, 0, NULL, 0, 0, 0, align} -#define MB_REDTEXT(text, align) {mt_text, 1, text, NULL, NULL, NULL, 0, NULL, 0, 0, 0, align} -#define MB_CMD(text, cmdfunc, tip) {mt_button, 1, text, tip, NULL, NULL, 0, NULL, 0, 0, 0, false, cmdfunc} -#define MB_EDITCVARTIP(text, cvarname, tip) {mt_edit, 0, text, tip, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname} -#define MB_EDITCVAR(text, cvarname) {mt_edit, 0, text, NULL, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname} -#define MB_EDITCVARSLIM(text, cvarname, tip) {mt_edit, 1, text, tip, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname} -#define MB_EDITCVARSLIMRETURN(text, cvarname, ret) {mt_edit, 1, text, NULL, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname, NULL, NULL, 0, (union menuoption_s **)&ret} -#define MB_COMBOCVAR(text, cvar, options, values, tip) {mt_combo, 0, text, tip, NULL, &cvar, 0, NULL, 0, 0, 0, false, NULL, NULL, options, values} -#define MB_COMBORETURN(text, options, selected, ret, tip) {mt_combo, 1, text, tip, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, NULL, options, NULL, selected, (union menuoption_s **)&ret} -#define MB_COMBOCVARRETURN(text, cvar, options, values, ret, tip) {mt_combo, 0, text, tip, NULL, &cvar, 0, NULL, 0, 0, 0, false, NULL, NULL, options, values, 0, (union menuoption_s **)&ret} -#define MB_SPACING(space) {mt_text, 2, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, NULL, NULL, NULL, 0, NULL, space} +#define MB_CONSOLECMD(text, cmd, tip) {mt_button, 0, localtext(text), localtext(tip), cmd} +#define MB_CONSOLECMDRETURN(text, cmd, tip, ret) {mt_button, 0, localtext(text), localtext(tip), cmd, NULL, 0, NULL, 0, 0, 0, false, NULL, NULL, NULL, NULL, 0, (union menuoption_s **)&ret} +#define MB_CHECKBOXCVAR(text, cvar, cvarflag) {mt_checkbox, 0, localtext(text), NULL, NULL, &cvar, cvarflag} +#define MB_CHECKBOXCVARTIP(text, cvar, cvarflag, tip) {mt_checkbox, 0, localtext(text), localtext(tip), NULL, &cvar, cvarflag} +#define MB_CHECKBOXCVARRETURN(text, cvar, cvarflag, ret) {mt_checkbox, 0, localtext(text), NULL, NULL, &cvar, cvarflag, NULL, 0, 0, 0, false, NULL, NULL, NULL, NULL, 0, (union menuoption_s **)&ret} +#define MB_CHECKBOXFUNC(text, func, flags, tip) {mt_checkbox, 0, localtext(text), localtext(tip), NULL, NULL, flags, func} +#define MB_SLIDER(text, cvar, min, max, delta, tip) {mt_slider, 0, localtext(text), localtext(tip), NULL, &cvar, 0, NULL, min, max, delta} +#define MB_TEXT(text, align) {mt_text, 0, localtext(text), NULL, NULL, NULL, 0, NULL, 0, 0, 0, align} +#define MB_REDTEXT(text, align) {mt_text, 1, localtext(text), NULL, NULL, NULL, 0, NULL, 0, 0, 0, align} +#define MB_CMD(text, cmdfunc, tip) {mt_button, 1, localtext(text), localtext(tip), NULL, NULL, 0, NULL, 0, 0, 0, false, cmdfunc} +#define MB_EDITCVARTIP(text, cvarname, tip) {mt_edit, 0, localtext(text), localtext(tip), NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname} +#define MB_EDITCVAR(text, cvarname) {mt_edit, 0, localtext(text), NULL, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname} +#define MB_EDITCVARSLIM(text, cvarname, tip) {mt_edit, 1, localtext(text), localtext(tip), NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname} +#define MB_EDITCVARSLIMRETURN(text, cvarname, ret) {mt_edit, 1, localtext(text), NULL, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname, NULL, NULL, 0, (union menuoption_s **)&ret} +#define MB_COMBOCVAR(text, cvar, options, values, tip) {mt_combo, 0, localtext(text), localtext(tip), NULL, &cvar, 0, NULL, 0, 0, 0, false, NULL, NULL, options, values} +#define MB_COMBORETURN(text, options, selected, ret, tip) {mt_combo, 1, localtext(text), localtext(tip), NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, NULL, options, NULL, selected, (union menuoption_s **)&ret} +#define MB_COMBOCVARRETURN(text, cvar, options, values, ret, tip) {mt_combo, 0, localtext(text), localtext(tip), NULL, &cvar, 0, NULL, 0, 0, 0, false, NULL, NULL, options, values, 0, (union menuoption_s **)&ret} +#define MB_SPACING(space) {mt_text, 2, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, NULL, NULL, NULL, 0, NULL, space} #define MB_END() {mt_text, -1} int MC_AddBulk(emenu_t *menu, menuresel_t *resel, menubulk_t *bulk, int xstart, int xtextend, int y); diff --git a/engine/client/p_script.c b/engine/client/p_script.c index a1994af69..641368ea6 100644 --- a/engine/client/p_script.c +++ b/engine/client/p_script.c @@ -2644,7 +2644,7 @@ static void P_ExportAllEffects_f(void) if (!outf) { FS_NativePath(fname, FS_GAMEONLY, effect, sizeof(effect)); - Con_Printf("Unable to open file %s\n", effect); + Con_TPrintf("Unable to open file %s\n", effect); return; } for (i = 0; i < numparticletypes; i++) @@ -3391,7 +3391,7 @@ static void P_ConvertEffectInfo_f(void) if (!outf) { FS_NativePath(fname, FS_GAMEONLY, effect, sizeof(effect)); - Con_Printf("Unable to open file %s\n", effect); + Con_TPrintf("Unable to open file %s\n", effect); return; } for (i = 0; i < numparticletypes; i++) diff --git a/engine/client/renderer.c b/engine/client/renderer.c index bfaab9a4c..a0ed606ef 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -2195,7 +2195,7 @@ void R_RestartRenderer (rendererstate_t *newr) rendererstate_t oldr; if (r_blockvidrestart) { - Con_Printf("Ignoring vid_restart from config\n"); + Con_TPrintf("Ignoring vid_restart from config\n"); return; } diff --git a/engine/client/textedit.c b/engine/client/textedit.c index de354583c..629615a96 100644 --- a/engine/client/textedit.c +++ b/engine/client/textedit.c @@ -850,7 +850,7 @@ qboolean Con_Editor_Close(console_t *con, qboolean force) { if (!strncmp(con->title, "MODIFIED: ", 10)) { - Menu_Prompt(Con_Editor_CloseCallback, con, va("Save changes?\n%s\n", con->name), "Yes", "No", "Cancel", true); + Menu_Prompt(Con_Editor_CloseCallback, con, va(localtext("Save changes?\n%s\n"), con->name), "Yes", "No", "Cancel", true); return false; } } diff --git a/engine/common/cmd.c b/engine/common/cmd.c index 3c9db2726..14bec520f 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -975,7 +975,7 @@ static void Cmd_Exec_f (void) else #endif { - Menu_Prompt(NULL, NULL, va("WARNING: nquake %s file detected. The file has been ignored.", name), NULL, NULL, "Argh", false); + Menu_Prompt(NULL, NULL, va(localtext("WARNING: nquake %s file detected. The file has been ignored."), name), NULL, NULL, "Argh", false); *s = 0; foundone = 0; } @@ -2366,8 +2366,8 @@ static void Cmd_Complete_CheckArg(const char *value, const char *desc, const cha char *p; char quoted[8192]; - if (!desc) //if no arg desc, use the command's. - desc = ctx->desc; + if (!desc && ctx->desc) //if no arg desc, use the command's. + desc = localtext(ctx->desc); if (strchr(value, ' ') || strchr(value, '\t') || strchr(value, '\"') || strchr(value, '\r') || strchr(value, '\n')) { diff --git a/engine/common/fs.c b/engine/common/fs.c index b3a23904c..c2e0077b5 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -7355,7 +7355,7 @@ static void FS_ModInstallGot(struct dl_download *dl) if (ctx->man && !strcmp(ctx->man->basedir, com_gamepath)) { //should probably show just the hostname for brevity. - Menu_Prompt(FS_ModInstallConfirmed, ctx, va("Install %s from\n%s ?", ctx->man->formalname, ctx->url), "Install", NULL, "Cancel", true); + Menu_Prompt(FS_ModInstallConfirmed, ctx, va(localtext("Install %s from\n%s ?"), ctx->man->formalname, ctx->url), "Install", NULL, "Cancel", true); return; } } diff --git a/engine/common/translate.c b/engine/common/translate.c index 02d9224c3..799fa8ed5 100644 --- a/engine/common/translate.c +++ b/engine/common/translate.c @@ -80,7 +80,7 @@ static int TL_LoadLanguage(char *lang) languages[j].name = strdup(lang); languages[j].po = NULL; -#ifndef COLOURUNTRANSLATEDSTRINGS +#if !defined(COLOURUNTRANSLATEDSTRINGS) && !defined(COLOURMISSINGSTRINGS) if (f) #endif { @@ -308,14 +308,45 @@ struct po_s }; static struct poline_s *PO_AddText(struct po_s *po, const char *orig, const char *trans) -{ +{ //input is assumed to be utf-8, but that's not always what quake uses. on the plus side we do have our own silly markup to handle unicode (and colours etc). size_t olen = strlen(orig)+1; - size_t tlen = strlen(trans)+1; - struct poline_s *line = Z_Malloc(sizeof(*line)+olen+tlen); + size_t tlen; + struct poline_s *line; + const char *s; + char temp[64]; + + //figure out the required length for the encoding we're actually going to use + if (com_parseutf8.ival != 1) + { + tlen = 0; + for (s = trans, tlen = 0; *s; ) + { + unsigned int err; + unsigned int chr = utf8_decode(&err, s, &s); + tlen += unicode_encode(temp, chr, sizeof(temp), true); + } + tlen++; + } + else + tlen = strlen(trans)+1; + + line = Z_Malloc(sizeof(*line)+olen+tlen); memcpy(line+1, orig, olen); orig = (const char*)(line+1); line->translated = (char*)(line+1)+olen; - memcpy(line->translated, trans, tlen); + if (com_parseutf8.ival != 1) + { + //do the loop again now we know we've got enough space for it. + for (s = trans, tlen = 0; *s; ) + { + unsigned int err; + unsigned int chr = utf8_decode(&err, s, &s); + tlen += unicode_encode(line->translated+tlen, chr, sizeof(temp), true); + } + line->translated[tlen] = 0; + } + else + memcpy(line->translated, trans, tlen); trans = (const char*)(line->translated); Hash_Add(&po->hash, orig, line, &line->buck); @@ -470,7 +501,7 @@ void PO_Close(struct po_s *po) const char *PO_GetText(struct po_s *po, const char *msg) { struct poline_s *line; - if (!po) + if (!po || !msg) return msg; line = Hash_Get(&po->hash, msg); @@ -479,17 +510,20 @@ const char *PO_GetText(struct po_s *po, const char *msg) { char temp[1024]; int i; - Q_snprintfz(temp, sizeof(temp), "%s", msg); - for (i = 0; temp[i]; i++) + const char *in = msg; + for (i = 0; *in && i < sizeof(temp)-1; ) { - if (temp[i] == '%') - { - while (temp[i] > ' ') - i++; + if (*in == '%') + { //don't mess up % formatting too much + while (*in > ' ' && i < sizeof(temp)-1) + temp[i++] = *in++; } - else if (temp[i] >= ' ') - temp[i] |= 0x80; + else if (in > ' ' && *in < 128) //otherwise force any ascii chars to the 0xe0XX range so it doesn't use any freetype fonts so its instantly recognisable as bad. + i += utf8_encode(temp+i, *in++|0xe080, sizeof(temp)-1-i); + else + temp[i++] = *in++; //don't mess with any c0/extended codepoints } + temp[i] = 0; line = PO_AddText(po, msg, temp); } #endif diff --git a/engine/gl/gl_heightmap.c b/engine/gl/gl_heightmap.c index f1011075b..ea112a065 100644 --- a/engine/gl/gl_heightmap.c +++ b/engine/gl/gl_heightmap.c @@ -5160,7 +5160,7 @@ void QCBUILTIN PF_terrain_edit(pubprogfuncs_t *prinst, struct globalvars_s *pr_g /* if (mod->type == mod_brush) { - Con_Printf("that model isn't a suitable worldmodel\n"); + Con_TPrintf("that model isn't a suitable worldmodel\n"); return; } else @@ -5168,7 +5168,7 @@ void QCBUILTIN PF_terrain_edit(pubprogfuncs_t *prinst, struct globalvars_s *pr_g FS_CreatePath(fname, FS_GAMEONLY); file = FS_OpenVFS(fname, "wb", FS_GAMEONLY); if (!file) - Con_Printf("unable to open %s\n", fname); + Con_TPrintf("unable to open %s\n", fname); else { Terr_WriteMapFile(file, mod); @@ -7968,7 +7968,7 @@ void Mod_Terrain_Save_f(void) FS_CreatePath(fname, FS_GAMEONLY); file = FS_OpenVFS(fname, "wb", FS_GAMEONLY); if (!file) - Con_Printf("unable to open %s\n", fname); + Con_TPrintf("unable to open %s\n", fname); else { const char *s = Mod_GetEntitiesString(mod); @@ -7982,7 +7982,7 @@ void Mod_Terrain_Save_f(void) FS_CreatePath(fname, FS_GAMEONLY); file = FS_OpenVFS(fname, "wb", FS_GAMEONLY); if (!file) - Con_Printf("unable to open %s\n", fname); + Con_TPrintf("unable to open %s\n", fname); else { Terr_WriteMapFile(file, mod); @@ -9005,12 +9005,12 @@ void Mod_Terrain_Create_f(void) FS_CreatePath(mname, FS_GAMEONLY); file = FS_OpenVFS(mname, "wb", FS_GAMEONLY); if (!file) - Con_Printf("unable to open %s\n", mname); + Con_TPrintf("unable to open %s\n", mname); else { Terr_WriteMapFile(file, &mod); VFS_CLOSE(file); - Con_Printf("Wrote %s\n", mname); + Con_TPrintf("Wrote %s\n", mname); FS_FlushFSHashWritten(mname); } Mod_SetEntitiesString(&mod, NULL, false); diff --git a/engine/qclib/qcc_pr_lex.c b/engine/qclib/qcc_pr_lex.c index e5624f29e..520dac8e9 100644 --- a/engine/qclib/qcc_pr_lex.c +++ b/engine/qclib/qcc_pr_lex.c @@ -1931,7 +1931,7 @@ forcequake: else if (c >= 0x80) { //FIXME: spit it out as ^{xxxxxx} instead - QCC_PR_ParseWarning(WARN_NOTUTF8, "Cannot convert character to quake's charset"); + QCC_PR_ParseWarning(WARN_NOTUTF8, "Cannot convert codepoint %#x to quake's charset", c); } forcebyte: diff --git a/engine/server/sv_ccmds.c b/engine/server/sv_ccmds.c index de3f034d9..37fefd3a6 100644 --- a/engine/server/sv_ccmds.c +++ b/engine/server/sv_ccmds.c @@ -948,7 +948,7 @@ void SV_Map_f (void) !strcmp(cmd, "map") && !startspot && !isDedicated && Cmd_ExecLevel==RESTRICT_LOCAL && !strchr(level, '.')) { - Menu_Prompt(SV_Map_DownloadPrompted, Z_StrDup(level), va("Download map %s from "S_COLOR_BLUE "%s" S_COLOR_WHITE"?", level, cl_download_mapsrc.string), "Download", NULL, "Cancel", true); + Menu_Prompt(SV_Map_DownloadPrompted, Z_StrDup(level), va(localtext("Download map %s from "S_COLOR_BLUE "%s" S_COLOR_WHITE"?"), level, cl_download_mapsrc.string), "Download", NULL, "Cancel", true); return; } #endif @@ -2245,7 +2245,7 @@ static void SV_Status_f (void) s = "direct"; else s = "private"; - Con_TPrintf("public : %s\n", s); + Con_TPrintf("public : %s\n", localtext(s)); switch(svs.gametype) { @@ -2270,29 +2270,29 @@ static void SV_Status_f (void) #endif #ifdef HAVE_DTLS if (net_enable_dtls.ival >= 3) - Con_Printf(" ^[DTLS-only\\tip\\Insecure clients (those without support for DTLS) will be barred from connecting.^]"); + Con_TPrintf(" ^[DTLS-only\\tip\\Insecure clients (those without support for DTLS) will be barred from connecting.^]"); else if (net_enable_dtls.ival) - Con_Printf(" ^[DTLS\\tip\\Clients may optionally connect via DTLS for added security^]"); + Con_TPrintf(" ^[DTLS\\tip\\Clients may optionally connect via DTLS for added security^]"); #endif Con_Printf("\n"); #if defined(TCPCONNECT) && !defined(CLIENTONLY) Con_TPrintf("tcp services :"); #if defined(HAVE_SSL) if (net_enable_tls.ival) - Con_Printf(" ^[TLS\\tip\\Clients are able to connect with Transport Layer Security for the other services, allowing for the use of tls://, wss:// or https:// schemes when their underlaying protocol is enabled.^]"); + Con_TPrintf(" ^[TLS\\tip\\Clients are able to connect with Transport Layer Security for the other services, allowing for the use of tls://, wss:// or https:// schemes when their underlaying protocol is enabled.^]"); #endif #ifdef HAVE_HTTPSV if (net_enable_http.ival) - Con_Printf(" ^[HTTP\\tip\\This server also acts as a web server. This might be useful to allow hosting demos or stats.^]"); + Con_TPrintf(" ^[HTTP\\tip\\This server also acts as a web server. This might be useful to allow hosting demos or stats.^]"); if (net_enable_rtcbroker.ival) - Con_Printf(" ^[RTC\\tip\\This server is set up to act as a webrtc broker, allowing clients+servers to locate each other instead of playing on this server.^]"); + Con_TPrintf(" ^[RTC\\tip\\This server is set up to act as a webrtc broker, allowing clients+servers to locate each other instead of playing on this server.^]"); if (net_enable_websockets.ival) - Con_Printf(" ^[WebSocket\\tip\\Clients can use the ws:// or possibly wss:// schemes to connect to this server, potentially from browser ports. This may be laggy.^]"); + Con_TPrintf(" ^[WebSocket\\tip\\Clients can use the ws:// or possibly wss:// schemes to connect to this server, potentially from browser ports. This may be laggy.^]"); #endif if (net_enable_qizmo.ival) - Con_Printf(" ^[Qizmo\\tip\\Compatible with the tcp connection feature of qizmo, equivelent to 'connect tcp://ip:port' in FTE.^]"); + Con_TPrintf(" ^[Qizmo\\tip\\Compatible with the tcp connection feature of qizmo, equivelent to 'connect tcp://ip:port' in FTE.^]"); if (net_enable_qtv.ival) - Con_Printf(" ^[QTV\\tip\\Allows receiving streamed mvd data from this server.^]"); + Con_TPrintf(" ^[QTV\\tip\\Allows receiving streamed mvd data from this server.^]"); Con_Printf("\n"); #endif break; @@ -2352,7 +2352,7 @@ static void SV_Status_f (void) { // most remote clients are 40 columns // 0123456789012345678901234567890123456789 - Con_Printf ( "name userid frags\n" + Con_TPrintf ( "name userid frags\n" " address rate ping drop\n" " ---------------- ---- ---- -----\n"); for (i=0,cl=svs.clients ; istate == cs_connected) { - Con_Printf ("CONNECTING\n"); + Con_TPrintf ("CONNECTING\n"); continue; } if (cl->state == cs_zombie || cl->state == cs_loadzombie) { - Con_Printf ("ZOMBIE\n"); + Con_TPrintf ("ZOMBIE\n"); continue; } Con_Printf ("%4i %4i %5.2f\n" @@ -2654,7 +2654,7 @@ void SV_Serverinfo_f (void) return; } - Con_Printf ("Can't set * keys\n"); + Con_TPrintf ("Can't set * keys\n"); return; } @@ -2664,11 +2664,11 @@ void SV_Serverinfo_f (void) char *data = FS_MallocFile(Cmd_Argv(2), FS_GAME, &fsize); if (!data) { - Con_Printf ("Unable to read %s\n", Cmd_Argv(2)); + Con_TPrintf ("Unable to read %s\n", Cmd_Argv(2)); return; } if (fsize > 64*1024*1024) - Con_Printf ("File is over 64mb\n"); + Con_TPrintf ("File is over 64mb\n"); else InfoBuf_SetStarBlobKey(&svs.info, Cmd_Argv(1), data, fsize); FS_FreeFile(data); @@ -2731,7 +2731,7 @@ static void SV_Localinfo_f (void) InfoBuf_Clear(&svs.localinfo, false); return; } - Con_Printf ("Can't set * keys\n"); + Con_TPrintf ("Can't set * keys\n"); return; } old = InfoBuf_ValueForKey(&svs.localinfo, Cmd_Argv(1)); @@ -2794,7 +2794,7 @@ void SV_User_f (void) while((cl = SV_GetClientForString(Cmd_Argv(1), &clnum))) { - Con_Printf("Userinfo (%i):\n", cl->userid); + Con_TPrintf("Userinfo (%i):\n", cl->userid); InfoBuf_Print (&cl->userinfo, " "); Con_Printf("[%u/%i, %u/%i]\n", (unsigned)cl->userinfo.totalsize, sv_userinfo_bytelimit.ival, (unsigned)cl->userinfo.numkeys, sv_userinfo_keylimit.ival); switch(cl->protocol) diff --git a/imgtool.c b/imgtool.c index 741f1becc..43e2e28da 100644 --- a/imgtool.c +++ b/imgtool.c @@ -29,6 +29,15 @@ void VARGS Con_Printf (const char *fmt, ...) va_end (argptr); fflush(stderr); } +void VARGS Con_TPrintf (const char *fmt, ...) +{ + va_list argptr; + + va_start (argptr,fmt); + vfprintf (stderr,fmt,argptr); + va_end (argptr); + fflush(stderr); +} void VARGS Con_DPrintf (const char *fmt, ...) { va_list argptr;