[Loc]: Put function here (#868)
This commit is contained in:
parent
cb24ddabf2
commit
3ae5e7aea8
@ -1,6 +1,7 @@
|
||||
#include <STDInclude.hpp>
|
||||
#include <Utils/InfoString.hpp>
|
||||
|
||||
#include "Modules/ArenaLength.hpp"
|
||||
#include "Modules/Bans.hpp"
|
||||
#include "Modules/Bots.hpp"
|
||||
#include "Modules/Branding.hpp"
|
||||
|
@ -73,7 +73,6 @@ namespace Components
|
||||
#include "Modules/UIScript.hpp"
|
||||
#include "Modules/ZoneBuilder.hpp"
|
||||
|
||||
#include "Modules/ArenaLength.hpp"
|
||||
#include "Modules/AssetHandler.hpp"
|
||||
#include "Modules/Dedicated.hpp"
|
||||
#include "Modules/Events.hpp"
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <STDInclude.hpp>
|
||||
#include "ArenaLength.hpp"
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
@ -438,7 +438,7 @@ namespace Components
|
||||
if (!Friends::IsOnline(user.lastTime)) return "Online";
|
||||
if (user.server.getType() == Game::NA_BAD) return "Playing IW4x";
|
||||
if (user.serverName.empty()) return Utils::String::VA("Playing on %s", user.server.getCString());
|
||||
return Utils::String::VA("Playing %s on %s", Game::UI_LocalizeMapName(user.mapname.data()), user.serverName.data());
|
||||
return Utils::String::VA("Playing %s on %s", Localization::LocalizeMapName(user.mapname.data()), user.serverName.data());
|
||||
}
|
||||
|
||||
default:
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <STDInclude.hpp>
|
||||
#include "ArenaLength.hpp"
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -330,6 +331,25 @@ namespace Components
|
||||
return pszString;
|
||||
}
|
||||
|
||||
const char* Localization::LocalizeMapName(const char* mapName)
|
||||
{
|
||||
for (int i = 0; i < *Game::arenaCount; ++i)
|
||||
{
|
||||
if (!_stricmp(ArenaLength::NewArenas[i].mapName, mapName))
|
||||
{
|
||||
auto* uiName = &ArenaLength::NewArenas[i].uiName[0];
|
||||
if ((uiName[0] == 'M' && uiName[1] == 'P') || (uiName[0] == 'P' && uiName[1] == 'A')) // MPUI/PATCH
|
||||
{
|
||||
return Get(uiName);
|
||||
}
|
||||
|
||||
return uiName;
|
||||
}
|
||||
}
|
||||
|
||||
return mapName;
|
||||
}
|
||||
|
||||
Localization::Localization()
|
||||
{
|
||||
SetCredits();
|
||||
|
@ -14,6 +14,8 @@ namespace Components
|
||||
static std::optional<std::string> PrefixOverride;
|
||||
static void ParseOutput(const std::function<void(Game::LocalizeEntry*)>& callback);
|
||||
|
||||
static const char* LocalizeMapName(const char* mapName);
|
||||
|
||||
private:
|
||||
static std::recursive_mutex LocalizeMutex;
|
||||
static std::unordered_map<std::string, Game::LocalizeEntry*> LocalizeMap;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
#include "ArenaLength.hpp"
|
||||
#include "FastFiles.hpp"
|
||||
#include "RawFiles.hpp"
|
||||
#include "StartupMessages.hpp"
|
||||
@ -659,7 +660,7 @@ namespace Components
|
||||
if (error)
|
||||
{
|
||||
Logger::Error(Game::ERR_DISCONNECT, "Missing DLC pack {} ({}) containing map {} ({}).\nPlease download it to play this map.",
|
||||
pack.name, pack.index, Game::UI_LocalizeMapName(mapname.data()), mapname);
|
||||
pack.name, pack.index, Localization::LocalizeMapName(mapname.data()), mapname);
|
||||
}
|
||||
|
||||
return dlcIsTrue;
|
||||
|
@ -64,7 +64,7 @@ namespace Components
|
||||
Dvar::Var("uiSi_KillCam").set("@MENU_NO");
|
||||
Dvar::Var("uiSi_ffType").set("@MENU_DISABLED");
|
||||
Dvar::Var("uiSi_MapName").set(serverInfo->mapname);
|
||||
Dvar::Var("uiSi_MapNameLoc").set(Game::UI_LocalizeMapName(serverInfo->mapname.data()));
|
||||
Dvar::Var("uiSi_MapNameLoc").set(Localization::LocalizeMapName(serverInfo->mapname.data()));
|
||||
Dvar::Var("uiSi_GameType").set(Game::UI_LocalizeGameType(serverInfo->gametype.data()));
|
||||
Dvar::Var("uiSi_ModName").set("");
|
||||
Dvar::Var("uiSi_aimAssist").set(serverInfo->aimassist ? "@MENU_YES" : "@MENU_NO");
|
||||
@ -261,7 +261,7 @@ namespace Components
|
||||
Dvar::Var("uiSi_Hardcore").set(info.get("g_hardcore") == "0" ? "@MENU_DISABLED" : "@MENU_ENABLED");
|
||||
Dvar::Var("uiSi_KillCam").set(info.get("scr_game_allowkillcam") == "0" ? "@MENU_NO" : "@MENU_YES");
|
||||
Dvar::Var("uiSi_MapName").set(info.get("mapname"));
|
||||
Dvar::Var("uiSi_MapNameLoc").set(Game::UI_LocalizeMapName(info.get("mapname").data()));
|
||||
Dvar::Var("uiSi_MapNameLoc").set(Localization::LocalizeMapName(info.get("mapname").data()));
|
||||
Dvar::Var("uiSi_GameType").set(Game::UI_LocalizeGameType(info.get("g_gametype").data()));
|
||||
Dvar::Var("uiSi_ModName").set("");
|
||||
Dvar::Var("uiSi_aimAssist").set(info.get("aimAssist") == "0" ? "@MENU_DISABLED" : "@MENU_ENABLED");
|
||||
|
@ -118,13 +118,13 @@ namespace Components
|
||||
{
|
||||
if (!sorting && !Maps::CheckMapInstalled(server->mapname))
|
||||
{
|
||||
return Utils::String::VA("^1%s", Game::UI_LocalizeMapName(server->mapname.data()));
|
||||
return Utils::String::VA("^1%s", Localization::LocalizeMapName(server->mapname.data()));
|
||||
}
|
||||
|
||||
return Game::UI_LocalizeMapName(server->mapname.data());
|
||||
return Localization::LocalizeMapName(server->mapname.data());
|
||||
}
|
||||
|
||||
return Utils::String::VA("^3%s", Game::UI_LocalizeMapName(server->mapname.data()));
|
||||
return Utils::String::VA("^3%s", Localization::LocalizeMapName(server->mapname.data()));
|
||||
}
|
||||
|
||||
case Column::Players:
|
||||
|
@ -311,7 +311,7 @@ namespace Components
|
||||
if (item < Demos.size())
|
||||
{
|
||||
auto info = Demos.at(item);
|
||||
return Utils::String::VA("%s on %s", Game::UI_LocalizeGameType(info.gametype.data()), Game::UI_LocalizeMapName(info.mapname.data()));
|
||||
return Utils::String::VA("%s on %s", Game::UI_LocalizeGameType(info.gametype.data()), Localization::LocalizeMapName(info.mapname.data()));
|
||||
}
|
||||
|
||||
return "";
|
||||
@ -330,7 +330,7 @@ namespace Components
|
||||
asctime_s(buffer, sizeof buffer, &time);
|
||||
|
||||
Dvar::Var("ui_demo_mapname").set(info.mapname);
|
||||
Dvar::Var("ui_demo_mapname_localized").set(Game::UI_LocalizeMapName(info.mapname.data()));
|
||||
Dvar::Var("ui_demo_mapname_localized").set(Localization::LocalizeMapName(info.mapname.data()));
|
||||
Dvar::Var("ui_demo_gametype").set(Game::UI_LocalizeGameType(info.gametype.data()));
|
||||
Dvar::Var("ui_demo_length").set(Utils::String::FormatTimeSpan(info.length));
|
||||
Dvar::Var("ui_demo_author").set(info.author);
|
||||
|
@ -290,7 +290,7 @@ namespace Components
|
||||
return maps.at(index).data();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (IsDebuggerPresent())
|
||||
{
|
||||
__debugbreak();
|
||||
|
@ -399,25 +399,6 @@ namespace Game
|
||||
return value;
|
||||
}
|
||||
|
||||
const char* UI_LocalizeMapName(const char* mapName)
|
||||
{
|
||||
for (int i = 0; i < *arenaCount; ++i)
|
||||
{
|
||||
if (!_stricmp(Components::ArenaLength::NewArenas[i].mapName, mapName))
|
||||
{
|
||||
char* uiName = &Components::ArenaLength::NewArenas[i].uiName[0];
|
||||
if ((uiName[0] == 'M' && uiName[1] == 'P') || (uiName[0] == 'P' && uiName[1] == 'A')) // MPUI/PATCH
|
||||
{
|
||||
return SEH_StringEd_GetString(uiName);
|
||||
}
|
||||
|
||||
return uiName;
|
||||
}
|
||||
}
|
||||
|
||||
return mapName;
|
||||
}
|
||||
|
||||
const char* UI_LocalizeGameType(const char* gameType)
|
||||
{
|
||||
if (!gameType || !*gameType)
|
||||
|
@ -737,7 +737,6 @@ namespace Game
|
||||
void Menu_SetNextCursorItem(UiContext* ctx, menuDef_t* currentMenu, int unk = 1);
|
||||
void Menu_SetPrevCursorItem(UiContext* ctx, menuDef_t* currentMenu, int unk = 1);
|
||||
const char* TableLookup(StringTable* stringtable, int row, int column);
|
||||
const char* UI_LocalizeMapName(const char* mapName);
|
||||
const char* UI_LocalizeGameType(const char* gameType);
|
||||
float UI_GetScoreboardLeft(void*);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user