Working more on translations, fixing tree bugs

This commit is contained in:
Vladislav Khorev committed 2026-07-07 19:03:58 +03:00
1 parent e7dc3279ae
commit cdaebc3c0c
23 files changed
+542 -487

No files matched your search

+6 -13
View File
@@ -251,23 +251,15 @@ namespace ZL
createLocations();
renderer.textureManager.LoadFromPng("resources/w/ui/img/toast/item_received001.png", CONST_ZIP_FILE, true);
renderer.textureManager.LoadFromPng("resources/w/ui/img/toast/item_removed001.png", CONST_ZIP_FILE, true);
mobileRotateTexture = renderer.textureManager.LoadFromPng(
"resources/rotateYourDevice.png", CONST_ZIP_FILE, true);
// Wire inventory callbacks: tutorial tracking + toast notifications.
gameState.inventory.onItemAdded = [this](const std::string& itemId) {
menuManager.onItemPickedUp(itemId);
const Item* item = ItemRegistry::instance().findById(itemId);
if (item) menuManager.showToast("resources/w/ui/img/toast/item_received001.png", item->name);
if (item) menuManager.showToast(menuManager.toastTextureItemAdded, item->name);
};
gameState.inventory.onItemRemoved = [this](const std::string& itemId) {
const Item* item = ItemRegistry::instance().findById(itemId);
if (item) menuManager.showToast("resources/w/ui/img/toast/item_removed001.png", item->name);
if (item) menuManager.showToast(menuManager.toastTextureItemRemoved, item->name);
};
// Wire phone dialogue start function so MenuManager can trigger dialogues.
@@ -472,15 +464,16 @@ namespace ZL
uniExteriorParams.interactiveObjectsJsonPath = "resources/config/interactive_objects_uni_exterior_x.json";
//uniExteriorParams.navigationJsonPaths = {"resources/navigation/uni_exterior3_all.json"};
/*
uniExteriorParams.navigationJsonPaths = {
"resources/navigation/uni_exterior3_trees_car.json",
"resources/navigation/uni_exterior3_trees.json",
};
/*
};*/
uniExteriorParams.navigationJsonPaths = {
"resources/navigation/uni_exterior3_trees_car.txt",
"resources/navigation/uni_exterior3_trees.txt",
};*/
};
uniExteriorParams.teleportsJsonPath = "resources/config/teleports_uni_exterior.json";
uniExteriorParams.triggerZonesJsonPath = "resources/config/trigger_zones_uni_exterior.json";
+2 -2
View File
@@ -148,11 +148,11 @@ namespace ZL {
void drawDarklandsFlash();
// Portrait-mode overlay (mobile / portrait browsers)
std::shared_ptr<Texture> mobileRotateTexture;
/*std::shared_ptr<Texture> mobileRotateTexture;
VertexRenderStruct mobileRotateMesh;
float mobileRotateMeshLastW = -1.0f;
float mobileRotateMeshLastH = -1.0f;
*/
//void drawMobilePortraitOverlay();
int64_t newTickCount;
+42 -11
View File
@@ -84,6 +84,13 @@ namespace ZL {
result += digits[i];
}
if (negative) result = "-" + result;
if (g_currentLanguage == Language::English)
{
return result + " som";
}
return result + " сом";
}
@@ -124,6 +131,20 @@ namespace ZL {
return loadUiFromFile(basePath, renderer, zipFile);
}
std::shared_ptr<Texture> MenuManager::loadLocalizedTexture(const std::string& basePath, const std::string& zipFile) {
static const std::string marker = "resources/w/ui/";
if (basePath.rfind(marker, 0) == 0) {
const std::string localizedPath = "resources/w/ui_" + languageToCode(g_currentLanguage) + "/" + basePath.substr(marker.size());
try {
return renderer.textureManager.LoadFromPng(localizedPath, zipFile, true);
}
catch (const std::exception&) {
// Localized screen not available — fall back to the base path below.
}
}
return renderer.textureManager.LoadFromPng(basePath, zipFile, true);
}
void MenuManager::loadUiRoots(const std::string& zipFile) {
hudRoot = loadLocalizedUi("resources/w/ui/hud_step0.json", zipFile);
hudStep1Root = loadLocalizedUi("resources/w/ui/hud_step1.json", zipFile);
@@ -197,26 +218,29 @@ namespace ZL {
texObjectiveCompleted_ = renderer.textureManager.LoadFromPng("resources/w/ui/img/journal/quest_objective_completed.png", zipFile, true);
texObjectiveBlank_ = renderer.textureManager.LoadFromPng("resources/w/ui/img/journal/quest_objective_blank.png", zipFile, true);
texItemSelected_ = renderer.textureManager.LoadFromPng("resources/w/ui/img/journal/ButtonBkg001.png", zipFile, true);
texItemTransparent_ = renderer.textureManager.LoadFromPng("resources/w/ui/img/journal/ButtonBkgTransparent001.png", zipFile, true);
gameState_.questJournal.loadFromFile("resources/config/quests.json", zipFile);
renderer.textureManager.LoadFromPng("resources/w/ui/img/toast/quest_new001.png", zipFile, true);
renderer.textureManager.LoadFromPng("resources/w/ui/img/toast/quest_completed001.png", zipFile, true);
renderer.textureManager.LoadFromPng("resources/w/ui/img/toast/quest_failed001.png", zipFile, true);
toastTextureQuestNew = loadLocalizedTexture("resources/w/ui/img/toast/quest_new001.png", zipFile);
toastTextureQuestCompleted = loadLocalizedTexture("resources/w/ui/img/toast/quest_completed001.png", zipFile);
toastTextureQuestFailed = loadLocalizedTexture("resources/w/ui/img/toast/quest_failed001.png", zipFile);
toastTextureItemAdded = loadLocalizedTexture("resources/w/ui/img/toast/item_received001.png", zipFile);
toastTextureItemRemoved = loadLocalizedTexture("resources/w/ui/img/toast/item_removed001.png", zipFile);
gameState_.questJournal.onQuestUnlocked = [this](const std::string& id) {
const Quest::QuestState* q = gameState_.questJournal.findQuest(id);
if (q) showToast("resources/w/ui/img/toast/quest_new001.png", q->definition.title);
if (q) showToast(toastTextureQuestNew, q->definition.title);
};
gameState_.questJournal.onQuestCompleted = [this](const std::string& id) {
const Quest::QuestState* q = gameState_.questJournal.findQuest(id);
if (q) showToast("resources/w/ui/img/toast/quest_completed001.png", q->definition.title);
if (q) showToast(toastTextureQuestCompleted, q->definition.title);
};
gameState_.questJournal.onQuestFailed = [this](const std::string& id) {
const Quest::QuestState* q = gameState_.questJournal.findQuest(id);
if (q) showToast("resources/w/ui/img/toast/quest_failed001.png", q->definition.title);
if (q) showToast(toastTextureQuestFailed, q->definition.title);
};
const std::string imgDir = "resources/w/ui/img/phone/";
@@ -465,6 +489,13 @@ namespace ZL {
loadUiRoots(CONST_ZIP_FILE);
toastTextureQuestNew = loadLocalizedTexture("resources/w/ui/img/toast/quest_new001.png", CONST_ZIP_FILE);
toastTextureQuestCompleted = loadLocalizedTexture("resources/w/ui/img/toast/quest_completed001.png", CONST_ZIP_FILE);
toastTextureQuestFailed = loadLocalizedTexture("resources/w/ui/img/toast/quest_failed001.png", CONST_ZIP_FILE);
toastTextureItemAdded = loadLocalizedTexture("resources/w/ui/img/toast/item_received001.png", CONST_ZIP_FILE);
toastTextureItemRemoved = loadLocalizedTexture("resources/w/ui/img/toast/item_removed001.png", CONST_ZIP_FILE);
showMainMenu();
}
@@ -1722,14 +1753,14 @@ namespace ZL {
return 0.0f;
}
void MenuManager::showToast(const std::string& iconPath, const std::string& text) {
void MenuManager::showToast(std::shared_ptr<Texture> toastTexture, const std::string& text) {
if (activeToasts_.size() < 3) {
ToastEntry e;
e.iconPath = iconPath;
e.toastTexture = toastTexture;
e.text = text;
activeToasts_.push_back(std::move(e));
} else {
toastQueue_.push_back({ iconPath, text });
toastQueue_.push_back({ toastTexture, text });
}
applyToastsToUi();
}
@@ -1758,7 +1789,7 @@ namespace ZL {
// Promote queued messages into free slots
while (!toastQueue_.empty() && activeToasts_.size() < 3) {
ToastEntry e;
e.iconPath = toastQueue_.front().iconPath;
e.toastTexture = toastQueue_.front().toastTexture;
e.text = toastQueue_.front().text;
toastQueue_.pop_front();
activeToasts_.push_back(std::move(e));
@@ -1782,7 +1813,7 @@ namespace ZL {
auto tv = uiManager.findTextView(txtNames[i]);
if (img) {
img->texture = renderer.textureManager.LoadFromPng(e.iconPath, CONST_ZIP_FILE, true);
img->texture = e.toastTexture;
img->alpha = a;
}
if (tv) {
+11 -3
View File
@@ -108,9 +108,15 @@ namespace ZL {
void loadSettings();
// Toast notification system
void showToast(const std::string& iconPath, const std::string& text);
void showToast(std::shared_ptr<Texture> toastTexture, const std::string& text);
void update(float deltaMs);
std::shared_ptr<Texture> toastTextureQuestNew;
std::shared_ptr<Texture> toastTextureQuestCompleted;
std::shared_ptr<Texture> toastTextureQuestFailed;
std::shared_ptr<Texture> toastTextureItemAdded;
std::shared_ptr<Texture> toastTextureItemRemoved;
protected:
Renderer& renderer;
@@ -123,6 +129,7 @@ namespace ZL {
void refreshQuestJournalUi();
void reloadLocalizedGameContent();
std::shared_ptr<UiNode> loadLocalizedUi(const std::string& basePath, const std::string& zipFile);
std::shared_ptr<Texture> loadLocalizedTexture(const std::string& basePath, const std::string& zipFile);
void loadUiRoots(const std::string& zipFile);
void selectQuestByIndex(int index);
void refreshItemPickupHud();
@@ -157,13 +164,13 @@ namespace ZL {
// Toast internals
struct ToastEntry {
std::string iconPath;
std::shared_ptr<Texture> toastTexture;
std::string text;
float timer = 0.0f;
enum class State { FadeIn, Visible, FadeOut } state = State::FadeIn;
float currentAlpha() const;
};
struct ToastMessage { std::string iconPath; std::string text; };
struct ToastMessage { std::shared_ptr<Texture> toastTexture; std::string text; };
void updateToasts(float deltaMs);
void applyToastsToUi();
@@ -257,6 +264,7 @@ namespace ZL {
std::shared_ptr<Texture> texItemSelected_;
std::shared_ptr<Texture> texItemTransparent_;
void applyCurrentHealthBar();
bool isPortraitMode() const;
+23 -1
View File
@@ -402,8 +402,30 @@ namespace ZL {
std::cerr << "[script] set_chat_unread: callback not wired\n";
return;
}
const std::string msg = previewMsg.is<std::string>()
std::string msg = previewMsg.is<std::string>()
? previewMsg.as<std::string>() : "";
//Some translations:
//See start_uni_interior.lua for more details
//CONST_MSG_EMPTY = "(пусто)"
//CONST_MSG_WHERE = "Бекзат, ты где? Я жду..."
if (msg == "(пусто)")
{
if (g_currentLanguage == Language::English)
{
msg = "(empty)";
}
}
else if (msg == "Бекзат, ты где? Я жду...")
{
if (g_currentLanguage == Language::English)
{
msg = "Bekzat, where are you? ...";
}
}
loc->requestSetChatUnread(chatIndex, unread, msg);
});