Restructured every menu to properly translate into the client's language.

This commit is contained in:
Greyscale
2009-07-27 17:02:49 -07:00
parent 70e5c93a2e
commit 5ee1395fb1
9 changed files with 112 additions and 82 deletions

View File

@ -49,15 +49,16 @@ bool:WeaponsMenuMain(client)
SetGlobalTransTarget(client);
SetMenuTitle(menu_weapons_main, "%t\n ", "Weapons menu restrict main title");
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:restrict[MENU_LINE_SMALL_LENGTH];
decl String:zmarket[MENU_LINE_SMALL_LENGTH];
Format(title, sizeof(title), "%t\n ", "Weapons menu restrict main title");
Format(restrict, sizeof(restrict), "%t", "Weapons menu restrict main restrict");
Format(zmarket, sizeof(zmarket), "%t", "Weapons menu restrict main market");
// Draw items, make unselectable if module is disabled.
SetMenuTitle(menu_weapons_main, title);
AddMenuItem(menu_weapons_main, "restrict", restrict, MenuGetItemDraw(GetConVarBool(g_hCvarsList[CVAR_WEAPONS_RESTRICT])));
AddMenuItem(menu_weapons_main, "zmarket", zmarket, MenuGetItemDraw(GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET])));
@ -126,7 +127,9 @@ WeaponsMenuTypes(client)
SetGlobalTransTarget(client);
SetMenuTitle(menu_weapons_types, "%t\n ", "Weapons menu restrict types title");
decl String:title[MENU_LINE_TITLE_LENGTH];
Format(title, sizeof(title), "%t\n ", "Weapons menu restrict types title");
SetMenuTitle(menu_weapons_types, title);
decl String:typename[WEAPONS_MAX_LENGTH];
@ -144,6 +147,8 @@ WeaponsMenuTypes(client)
// If there are no weapons, add an "(Empty)" line.
if (size == 0)
{
SetGlobalTransTarget(client);
decl String:empty[MENU_LINE_SMALL_LENGTH];
Format(empty, sizeof(empty), "%t", "Menu empty");
@ -204,15 +209,16 @@ WeaponsMenuTypeWeapons(client)
decl String:typename[WEAPONS_MAX_LENGTH];
RestrictWeaponTypeGetName(g_iWeaponsCurType[client], typename, sizeof(typename));
SetMenuTitle(menu_weapons_typeweapons, "%t\n ", "Weapons menu restrict types weapon type title", typename);
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:restrictall[MENU_LINE_REG_LENGTH];
decl String:unrestrictall[MENU_LINE_REG_LENGTH];
Format(title, sizeof(title), "%t\n ", "Weapons menu restrict types weapon type title", typename);
Format(restrictall, sizeof(restrictall), "%t", "Weapons menu restrict types restrict all", typename);
Format(unrestrictall, sizeof(unrestrictall), "%t\n ", "Weapons menu restrict types unrestrict all", typename);
// Draw items as selectable only if not all weapons within the type are restricted or unrestricted.
SetMenuTitle(menu_weapons_typeweapons, title);
AddMenuItem(menu_weapons_typeweapons, "restrictall", restrictall, MenuGetItemDraw(!RestrictIsTypeUniform(true, g_iWeaponsCurType[client])));
AddMenuItem(menu_weapons_typeweapons, "unrestrictall", unrestrictall, MenuGetItemDraw(!RestrictIsTypeUniform(false, g_iWeaponsCurType[client])));
@ -352,18 +358,20 @@ WeaponsMenuZMarket(client)
// Create menu handle.
new Handle:menu_weapons_market = CreateMenu(WeaponsMenuZMarketHandle);
SetGlobalTransTarget(client);
SetMenuTitle(menu_weapons_market, "%t\n ", "Weapons menu restrict zmarket title");
decl String:buyzone[MENU_LINE_REG_LENGTH];
decl String:buyzonesetting[8];
// Get "yes" or "no" settings from respective cvar.
decl String:buyzonesetting[8];
ConfigBoolToSetting(GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]), buyzonesetting, sizeof(buyzonesetting));
SetGlobalTransTarget(client);
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:buyzone[MENU_LINE_REG_LENGTH];
// Add options to menu.
Format(title, sizeof(title), "%t\n ", "Weapons menu restrict zmarket title");
Format(buyzone, sizeof(buyzone), "%t", "Weapons menu restrict zmarket buyzone", buyzonesetting);
SetMenuTitle(menu_weapons_market, title);
AddMenuItem(menu_weapons_market, "buyzone", buyzone);
// Create a "Back" button to the weapons main menu.

View File

@ -250,14 +250,12 @@ bool:ZMarketMenuMain(client)
// Set translation target as client.
SetGlobalTransTarget(client);
// Set menu title.
SetMenuTitle(menu_zmarket_main, "%t\n ", "Weapons menu zmarket main title");
// If rebuy is enabled, then add it to the menu.
new bool:zmarketrebuy = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_REBUY]);
new bool:zmarketrebuyauto = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_REBUY_AUTO]);
// Add "Get Current Loadout" option.
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:getloadout[MENU_LINE_REG_LENGTH];
decl String:viewloadout[MENU_LINE_REG_LENGTH];
decl String:rebuy[MENU_LINE_REG_LENGTH];
@ -269,6 +267,7 @@ bool:ZMarketMenuMain(client)
ConfigBoolToSetting(CookiesGetClientCookieBool(client, g_hZMarketAutoRebuyCookie), rebuyautosetting, sizeof(rebuyautosetting));
// Format menu options.
Format(title, sizeof(title), "%t\n ", "Weapons menu zmarket main title");
Format(getloadout, sizeof(getloadout), "%t", "Weapons menu zmarket main get loadout");
Format(viewloadout, sizeof(viewloadout), "%t", "Weapons menu zmarket main view loadout");
Format(rebuy, sizeof(rebuy), "%t", "Weapons menu zmarket main rebuy");
@ -276,6 +275,7 @@ bool:ZMarketMenuMain(client)
Format(weaponslist, sizeof(weaponslist), "%t", "Weapons menu zmarket main weapons list");
// Add formatted options to menu.
SetMenuTitle(menu_zmarket_main, title);
AddMenuItem(menu_zmarket_main, "Get Loadout", getloadout, MenuGetItemDraw(zmarketrebuy || zmarketrebuyauto));
AddMenuItem(menu_zmarket_main, "View Loadout", viewloadout, MenuGetItemDraw(zmarketrebuy || zmarketrebuyauto));
AddMenuItem(menu_zmarket_main, "Rebuy", rebuy, MenuGetItemDraw(zmarketrebuy || zmarketrebuyauto));
@ -373,12 +373,6 @@ bool:ZMarketMenuLoadout(client)
// Create menu handle.
new Handle:menu_zmarket_loadout = CreateMenu(ZMarketMenuLoadoutHandle);
// Set translation target as client.
SetGlobalTransTarget(client);
// Set menu title.
SetMenuTitle(menu_zmarket_loadout, "%t\n ", "Weapons menu zmarket loadout title");
decl String:primaryweapon[WEAPONS_MAX_LENGTH];
decl String:secondaryweapon[WEAPONS_MAX_LENGTH];
decl String:meleeweapon[WEAPONS_MAX_LENGTH];
@ -398,6 +392,8 @@ bool:ZMarketMenuLoadout(client)
WeaponsClassnameToDisplay(rebuyweapons[Slot_Explosive], sizeof(rebuyweapons[]), explosiveweapon, sizeof(explosiveweapon));
WeaponsClassnameToDisplay(rebuyweapons[Slot_NVGs], sizeof(rebuyweapons[]), nvgsweapon, sizeof(nvgsweapon));
SetGlobalTransTarget(client);
// Get the empty translation.
decl String:empty[MENU_LINE_SMALL_LENGTH];
Format(empty, sizeof(empty), "%t", "Weapons menu zmarket loadout empty");
@ -428,6 +424,7 @@ bool:ZMarketMenuLoadout(client)
decl String:nvgsbool[8];
ConfigBoolToSetting(bool:nvgsweapon[0], nvgsbool, sizeof(nvgsbool));
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:primary[MENU_LINE_REG_LENGTH];
decl String:secondary[MENU_LINE_REG_LENGTH];
decl String:melee[MENU_LINE_REG_LENGTH];
@ -436,6 +433,7 @@ bool:ZMarketMenuLoadout(client)
decl String:nvgs[MENU_LINE_REG_LENGTH];
// Format all the lines of the menu.
Format(title, sizeof(title), "%t\n ", "Weapons menu zmarket loadout title");
Format(primary, sizeof(primary), "%t", "Weapons menu zmarket loadout primary", primaryweapon);
Format(secondary, sizeof(secondary), "%t", "Weapons menu zmarket loadout secondary", secondaryweapon);
Format(melee, sizeof(melee), "%t", "Weapons menu zmarket loadout melee", meleeweapon);
@ -444,6 +442,7 @@ bool:ZMarketMenuLoadout(client)
Format(nvgs, sizeof(nvgs), "%t", "Weapons menu zmarket loadout nvgs", nvgsbool);
// Add formatted options to menu.
SetMenuTitle(menu_zmarket_loadout, title);
AddMenuItem(menu_zmarket_loadout, "0", primary, MenuGetItemDraw(!StrEqual(primaryweapon, empty)));
AddMenuItem(menu_zmarket_loadout, "1", secondary, MenuGetItemDraw(!StrEqual(secondaryweapon, empty)));
AddMenuItem(menu_zmarket_loadout, "2", melee, MenuGetItemDraw(!StrEqual(meleeweapon, empty)));
@ -504,10 +503,10 @@ ZMarketMenuTypes(client)
new Handle:menu_zmarket_types = CreateMenu(ZMarketMenuTypesHandle);
// Set translation target as client.
SetGlobalTransTarget(client);
// Set menu title.
SetMenuTitle(menu_zmarket_types, "%t\n ", "Weapons menu zmarket types title");
decl String:title[MENU_LINE_TITLE_LENGTH];
Format(title, sizeof(title), "%t\n ", "Weapons menu zmarket types title");
SetMenuTitle(menu_zmarket_types, title);
decl String:typename[WEAPONS_MAX_LENGTH];
@ -525,6 +524,8 @@ ZMarketMenuTypes(client)
// If there are no weapons, add an "(Empty)" line.
if (size == 0)
{
SetGlobalTransTarget(client);
decl String:empty[MENU_LINE_SMALL_LENGTH];
Format(empty, sizeof(empty), "%t", "Menu empty");
@ -601,9 +602,7 @@ ZMarketMenuTypeWeapons(client)
decl String:typename[WEAPONS_MAX_LENGTH];
RestrictWeaponTypeGetName(g_iZMarketCurType[client], typename, sizeof(typename));
// Set menu title.
SetMenuTitle(menu_zmarket_typeweapons, "%t\n ", "Weapons menu zmarket types weapon type title", typename);
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:typeweapon[WEAPONS_MAX_LENGTH];
decl String:typeweapondisplay[MENU_LINE_REG_LENGTH];
decl String:display[MENU_LINE_BIG_LENGTH];
@ -612,6 +611,8 @@ ZMarketMenuTypeWeapons(client)
new Handle:arrayTypeWeapons;
new count = RestrictGetTypeWeapons(g_iZMarketCurType[client], arrayTypeWeapons);
SetGlobalTransTarget(client);
// x = Array index.
for (new x = 0; x < count; x++)
{
@ -695,6 +696,9 @@ ZMarketMenuTypeWeapons(client)
AddMenuItem(menu_zmarket_typeweapons, typeweapon, display, MenuGetItemDraw(itemdraw));
}
Format(title, sizeof(title), "%t\n ", "Weapons menu zmarket types weapon type title", typename);
SetMenuTitle(menu_zmarket_typeweapons, title);
// Destroy the array handle.
CloseHandle(arrayTypeWeapons);