Use defaultBold instead of bank on asian langs
This commit is contained in:
parent
0225505661
commit
e28dd09cba
@ -5,6 +5,7 @@
|
||||
#include "console.hpp"
|
||||
#include "localized_strings.hpp"
|
||||
#include "mods.hpp"
|
||||
#include "language.hpp"
|
||||
|
||||
#include "game/game.hpp"
|
||||
|
||||
@ -25,20 +26,6 @@ namespace filesystem
|
||||
return search_paths;
|
||||
}
|
||||
|
||||
bool is_fallback_lang()
|
||||
{
|
||||
static auto* loc_language = game::Dvar_FindVar("loc_language");
|
||||
const auto id = loc_language->current.integer;
|
||||
return id == 5 || id == 6 || id == 8 || id == 9 || id == 10 || id == 11 || id == 12 || id == 13 || id == 15 || id == 17;
|
||||
}
|
||||
|
||||
bool is_polrus_lang()
|
||||
{
|
||||
static auto* loc_language = game::Dvar_FindVar("loc_language");
|
||||
const auto id = loc_language->current.integer;
|
||||
return id == 5 || id == 6 || id == 12 || id == 13 || id == 17;
|
||||
}
|
||||
|
||||
void fs_startup_stub(const char* name)
|
||||
{
|
||||
console::info("[FS] Startup\n");
|
||||
@ -68,12 +55,12 @@ namespace filesystem
|
||||
|
||||
paths.push_back(path);
|
||||
|
||||
if (is_fallback_lang())
|
||||
if (language::is_non_latin())
|
||||
{
|
||||
paths.push_back(path / "fallback");
|
||||
}
|
||||
|
||||
if (is_polrus_lang())
|
||||
if (language::is_polrus() || language::is_arabic())
|
||||
{
|
||||
paths.push_back(path / "polrus");
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "console.hpp"
|
||||
#include "filesystem.hpp"
|
||||
#include "command.hpp"
|
||||
#include "language.hpp"
|
||||
|
||||
#include "game/game.hpp"
|
||||
#include "game/dvars.hpp"
|
||||
@ -138,9 +139,21 @@ namespace fonts
|
||||
return ui_get_font_handle_hook.invoke<game::Font_s*>(a1, font_index);
|
||||
}
|
||||
|
||||
game::Font_s* get_bank_font()
|
||||
{
|
||||
if (language::is_asian())
|
||||
{
|
||||
return game::R_RegisterFont("fonts/defaultBold.otf", 32);
|
||||
}
|
||||
else
|
||||
{
|
||||
return game::R_RegisterFont("fonts/bank.ttf", 32);
|
||||
}
|
||||
}
|
||||
|
||||
void* ui_asset_cache_stub()
|
||||
{
|
||||
bank_font = game::R_RegisterFont("fonts/bank.ttf", 32);
|
||||
bank_font = get_bank_font();
|
||||
return ui_asset_cache_hook.invoke<void*>();
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include "game/game.hpp"
|
||||
#include "game/dvars.hpp"
|
||||
|
||||
#include "language.hpp"
|
||||
|
||||
#include "localized_strings.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
@ -16,6 +14,37 @@ namespace language
|
||||
{
|
||||
namespace
|
||||
{
|
||||
std::unordered_set<game::language_t> non_latin_languages =
|
||||
{
|
||||
{game::LANGUAGE_RUSSIAN},
|
||||
{game::LANGUAGE_POLISH},
|
||||
{game::LANGUAGE_JAPANESE_FULL},
|
||||
{game::LANGUAGE_JAPANESE_PARTIAL},
|
||||
{game::LANGUAGE_TRADITIONAL_CHINESE},
|
||||
{game::LANGUAGE_SIMPLIFIED_CHINESE},
|
||||
{game::LANGUAGE_ARABIC},
|
||||
{game::LANGUAGE_CZECH},
|
||||
{game::LANGUAGE_KOREAN},
|
||||
{game::LANGUAGE_RUSSIAN_PARTIAL},
|
||||
};
|
||||
|
||||
std::unordered_set<game::language_t> cyrillic_languages =
|
||||
{
|
||||
game::LANGUAGE_RUSSIAN,
|
||||
game::LANGUAGE_POLISH,
|
||||
game::LANGUAGE_CZECH,
|
||||
game::LANGUAGE_RUSSIAN_PARTIAL,
|
||||
};
|
||||
|
||||
|
||||
std::unordered_set<game::language_t> asian_languages =
|
||||
{
|
||||
game::LANGUAGE_JAPANESE_FULL,
|
||||
game::LANGUAGE_JAPANESE_PARTIAL,
|
||||
game::LANGUAGE_TRADITIONAL_CHINESE,
|
||||
game::LANGUAGE_SIMPLIFIED_CHINESE,
|
||||
};
|
||||
|
||||
const char* get_loc_language_string()
|
||||
{
|
||||
if (!utils::io::file_exists(LANGUAGE_FILE))
|
||||
@ -30,6 +59,32 @@ namespace language
|
||||
}
|
||||
}
|
||||
|
||||
game::language_t current()
|
||||
{
|
||||
static auto* loc_language = game::Dvar_FindVar("loc_language");
|
||||
return static_cast<game::language_t>(loc_language->current.integer);
|
||||
}
|
||||
|
||||
bool is_non_latin()
|
||||
{
|
||||
return non_latin_languages.contains(current());
|
||||
}
|
||||
|
||||
bool is_polrus()
|
||||
{
|
||||
return cyrillic_languages.contains(current());
|
||||
}
|
||||
|
||||
bool is_arabic()
|
||||
{
|
||||
return current() == game::LANGUAGE_ARABIC;
|
||||
}
|
||||
|
||||
bool is_asian()
|
||||
{
|
||||
return asian_languages.contains(current());
|
||||
}
|
||||
|
||||
void set(const std::string& lang)
|
||||
{
|
||||
utils::io::write_file(LANGUAGE_FILE, lang, false);
|
||||
|
@ -1,7 +1,15 @@
|
||||
#pragma once
|
||||
#include "game/game.hpp"
|
||||
#include "game/dvars.hpp"
|
||||
|
||||
namespace language
|
||||
{
|
||||
void set(const std::string& language);
|
||||
void set_from_index(const int index);
|
||||
|
||||
game::language_t current();
|
||||
bool is_non_latin();
|
||||
bool is_polrus();
|
||||
bool is_arabic();
|
||||
bool is_asian();
|
||||
}
|
||||
|
@ -1595,6 +1595,29 @@ namespace game
|
||||
char __pad0[0x8];
|
||||
};
|
||||
|
||||
enum language_t
|
||||
{
|
||||
LANGUAGE_ENGLISH = 0,
|
||||
LANGUAGE_FRENCH = 1,
|
||||
LANGUAGE_GERMAN = 2,
|
||||
LANGUAGE_ITALIAN = 3,
|
||||
LANGUAGE_SPANISH = 4,
|
||||
LANGUAGE_RUSSIAN = 5,
|
||||
LANGUAGE_POLISH = 6,
|
||||
LANGUAGE_PORTUGUESE = 7,
|
||||
LANGUAGE_JAPANESE_FULL = 8,
|
||||
LANGUAGE_JAPANESE_PARTIAL = 9,
|
||||
LANGUAGE_TRADITIONAL_CHINESE = 10,
|
||||
LANGUAGE_SIMPLIFIED_CHINESE = 11,
|
||||
LANGUAGE_ARABIC = 12,
|
||||
LANGUAGE_CZECH = 13,
|
||||
LANGUAGE_SPANISHNA = 14,
|
||||
LANGUAGE_KOREAN = 15,
|
||||
LANGUAGE_ENGLISH_SAFE = 16,
|
||||
LANGUAGE_RUSSIAN_PARTIAL = 17,
|
||||
LANGUAGE_COUNT
|
||||
};
|
||||
|
||||
struct rectDef_s
|
||||
{
|
||||
float x;
|
||||
|
Loading…
Reference in New Issue
Block a user