Added sounds

This commit is contained in:
Vladislav Khorev committed 2026-07-07 23:05:01 +03:00
1 parent c6ba8bd008
commit 124208f2a4
26 files changed
+210 -36

No files matched your search

+60 -1
View File
@@ -331,25 +331,32 @@ namespace ZL {
uiManager.replaceRoot(mainMenuRoot);
uiManager.setTextButtonCallback("menuStartButton", [this](const std::string&) {
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
enterGameplay();
});
uiManager.setTextButtonCallback("menuAboutButton", [this](const std::string&) {
showAboutScreen();
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
uiManager.setTextButtonCallback("menuSettingsButton", [this](const std::string&) {
showSettingsScreen();
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
uiManager.setTextButtonCallback("menuLanguageButton", [this](const std::string&) {
showLanguageScreen();
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
uiManager.setTextButtonCallback("menuLoadButton", [this](const std::string&) {
showLoadGameScreen();
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
#ifndef EMSCRIPTEN
uiManager.setTextButtonCallback("menuExitButton", [this](const std::string&) {
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
Environment::exitGameLoop = true;
});
#else
@@ -362,6 +369,7 @@ namespace ZL {
uiManager.setTextButtonCallback("aboutBackButton", [this](const std::string&) {
uiManager.popMenu();
uiManager.updateAllLayouts();
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
}
@@ -371,6 +379,7 @@ namespace ZL {
saveSettings();
uiManager.popMenu();
uiManager.updateAllLayouts();
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
// Set initial slider positions before registering callbacks so
@@ -456,6 +465,7 @@ namespace ZL {
uiManager.setTextButtonColor("musicToggleButton", on
? std::array<float, 4>{ 0.2f, 0.9f, 0.2f, 1.0f }
: std::array<float, 4>{ 0.9f, 0.2f, 0.2f, 1.0f });
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
uiManager.setTextButtonCallback("soundToggleButton", [this](const std::string&) {
audioPlayer_.setSoundEnabled(!audioPlayer_.isSoundEnabled());
@@ -464,10 +474,12 @@ namespace ZL {
uiManager.setTextButtonColor("soundToggleButton", on
? std::array<float, 4>{ 0.2f, 0.9f, 0.2f, 1.0f }
: std::array<float, 4>{ 0.9f, 0.2f, 0.2f, 1.0f });
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
uiManager.setTextButtonCallback("fullScreenToggleButton", [this, refreshFullscreenToggle](const std::string&) {
Environment::setFullscreen(!Environment::isFullscreen);
refreshFullscreenToggle();
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
}
@@ -477,14 +489,17 @@ namespace ZL {
saveSettings();
uiManager.popMenu();
uiManager.updateAllLayouts();
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
uiManager.setTextButtonCallback("languageRussianButton", [this](const std::string&) {
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
ZL::g_currentLanguage = ZL::Language::Russian;
reloadLocalizedGameContent();
saveSettings();
});
uiManager.setTextButtonCallback("languageEnglishButton", [this](const std::string&) {
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
ZL::g_currentLanguage = ZL::Language::English;
reloadLocalizedGameContent();
saveSettings();
@@ -528,6 +543,7 @@ namespace ZL {
uiManager.setTextButtonCallback("loadBackButton", [this](const std::string&) {
uiManager.popMenu();
uiManager.updateAllLayouts();
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
static const char* kSlotButtons[4] = {
@@ -543,6 +559,7 @@ namespace ZL {
uiManager.setTextButtonText(kSlotButtons[i], label);
}
uiManager.setTextButtonCallback(kSlotButtons[i], [this, slot](const std::string&) {
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
if (onLoadGame) onLoadGame(slot);
enterGameplay(true);
});
@@ -555,6 +572,7 @@ namespace ZL {
uiManager.setTextButtonCallback("saveBackButton", [this](const std::string&) {
uiManager.popMenu();
uiManager.updateAllLayouts();
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
static const char* kSlotButtons[4] = {
@@ -578,6 +596,7 @@ namespace ZL {
? "Empty"
: localizedLocationName[info.locationName][ZL::g_currentLanguage] + "\n" + info.savedAt;
uiManager.setTextButtonText(buttonName, label);
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
}
});
}
@@ -607,6 +626,7 @@ namespace ZL {
}
uiManager.setButtonCallback(btnName, [this, i](const std::string&) {
selectInventoryItem(i);
audioPlayer_.playSoundAsync("audio/sound_bag001.ogg");
});
} else {
uiManager.setNodeVisible(btnName, false);
@@ -617,6 +637,8 @@ namespace ZL {
if (!portrait && !items.empty()) {
selectInventoryItem(0);
}
audioPlayer_.playSoundAsync("audio/sound_bag_open.ogg");
}
void MenuManager::selectInventoryItem(int index) {
@@ -668,6 +690,7 @@ namespace ZL {
for (int i = 0; i < inventoryMenuStackDepth_; ++i) uiManager.popMenu();
inventoryMenuStackDepth_ = 0;
uiManager.updateAllLayouts();
audioPlayer_.playSoundAsync("audio/sound_bag_close.ogg");
}
void MenuManager::openQuestJournal() {
@@ -683,6 +706,7 @@ namespace ZL {
uiManager.setButtonCallback("journalExitButton", [this](const std::string&) {
closeQuestJournal();
audioPlayer_.playSoundAsync("audio/656126__itsthegoodstuff__paging-through-book.ogg");
});
static const char* kItemNames[9] = {
@@ -693,6 +717,7 @@ namespace ZL {
for (int i = 0; i < 9; ++i) {
uiManager.setTextButtonCallback(kItemNames[i], [this, i](const std::string&) {
selectQuestByIndex(i);
audioPlayer_.playSoundAsync("audio/255571__stradie__flipping-paper.ogg");
});
}
@@ -700,6 +725,8 @@ namespace ZL {
if (!portrait && !visibleQuestIds.empty()) {
selectQuestByIndex(0);
}
audioPlayer_.playSoundAsync("audio/255571__stradie__flipping-paper.ogg");
}
void MenuManager::closeQuestJournal() {
@@ -750,19 +777,24 @@ namespace ZL {
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneEntirely();
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
uiManager.setButtonCallback("phoneMessenger", [this](const std::string&) {
openPhoneMessenger();
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
uiManager.setButtonCallback("phoneBank", [this](const std::string&) {
openPhoneBank();
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
uiManager.setButtonCallback("phoneVideo", [this](const std::string&) {
openPhoneVideo();
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
uiManager.setButtonCallback("phoneTaxi", [this](const std::string&) {
openPhoneTaxi();
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
if (gameState_.isNight)
@@ -786,6 +818,8 @@ namespace ZL {
uiManager.setNodeVisible("phoneTimeNight", false);
uiManager.setNodeVisible("phoneTimeDawn", false);
}
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
}
void MenuManager::openPhoneMessenger() {
@@ -803,19 +837,23 @@ namespace ZL {
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneEntirely();
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
uiManager.setTextButtonCallback("chat1button", [this](const std::string&) {
gameState_.chatUnread[0] = false;
openPhoneChatFromList(0, isPortraitMode() ? verticalPhoneChat1Root : phoneChat1Root);
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
uiManager.setTextButtonCallback("chat2button", [this](const std::string&) {
gameState_.chatUnread[1] = false;
openPhoneChatFromList(1, isPortraitMode() ? verticalPhoneChat2Root : phoneChat2Root);
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
uiManager.setTextButtonCallback("chat3button", [this](const std::string&) {
gameState_.chatUnread[2] = false;
openPhoneChatFromList(2, isPortraitMode() ? verticalPhoneChat3Root : phoneChat3Root);
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
}
@@ -851,11 +889,13 @@ namespace ZL {
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneEntirely();
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
uiManager.setButtonCallback("buttonBack", [this](const std::string&) {
uiManager.popMenu();
uiManager.updateAllLayouts();
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
}
@@ -865,15 +905,16 @@ namespace ZL {
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneEntirely();
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
uiManager.setButtonCallback("buttonBack", [this](const std::string&) {
uiManager.popMenu();
uiManager.updateAllLayouts();
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
uiManager.setButtonCallback("videoSkip", [this](const std::string&) {
closePhoneEntirely();
if (gameState_.isNight)
{
startDialogueFunc("dialog_video002");
@@ -887,6 +928,7 @@ namespace ZL {
}
else
{
audioPlayer_.playSoundAsync("audio/78564__joedeshon__alarm_clock_ticking_02.ogg");
startNightTransitionFunc();
}
}
@@ -911,11 +953,13 @@ namespace ZL {
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneEntirely();
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
uiManager.setButtonCallback("buttonBack", [this](const std::string&) {
uiManager.popMenu();
uiManager.updateAllLayouts();
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
uiManager.setButtonCallback("mapGo", [this](const std::string&) {
gameState_.tutorialNeedOpenTaxiScreen = false;
@@ -927,7 +971,10 @@ namespace ZL {
gameState_.money -= 500;
closePhoneEntirely();
if (startDialogueFunc) startDialogueFunc("dialog_taxi002");
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
}
void MenuManager::openPhoneChatFromList(int chatIndex, std::shared_ptr<UiNode> chatRoot) {
@@ -967,10 +1014,12 @@ namespace ZL {
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneScreenFromChat();
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
uiManager.setTextButtonCallback("chatTitleButton", [this](const std::string&) {
returnToPhoneChatList();
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
});
if (chatOpenCallback) {
@@ -1054,30 +1103,37 @@ namespace ZL {
}
void MenuManager::showModalMenuScreen() {
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
uiManager.pushMenuFromSavedRoot(modalMenuRoot);
uiManager.setButtonCallback("modalExitButton", [this](const std::string&) {
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
uiManager.popMenu();
uiManager.updateAllLayouts();
});
uiManager.setButtonCallback("menuCloseButton", [this](const std::string&) {
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
uiManager.popMenu();
uiManager.updateAllLayouts();
});
uiManager.setButtonCallback("menuSaveButton", [this](const std::string&) {
showSaveGameScreen();
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
uiManager.setButtonCallback("menuLoadButton", [this](const std::string&) {
showLoadGameScreen();
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
uiManager.setButtonCallback("menuSettingsButton", [this](const std::string&) {
showSettingsScreen();
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
});
uiManager.setButtonCallback("menuExitButton", [this](const std::string&) {
audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
uiManager.popMenu();
showMainMenu();
});
@@ -1441,6 +1497,7 @@ namespace ZL {
uiManager.setButtonCallback("inventoryExitButton", [this](const std::string&) {
closePortraitInventoryItem();
audioPlayer_.playSoundAsync("audio/sound_bag001.ogg");
});
const auto& item = items[index];
@@ -1468,6 +1525,7 @@ namespace ZL {
uiManager.setButtonCallback("journalItemExitButton", [this](const std::string&) {
closePortraitJournalItem();
audioPlayer_.playSoundAsync("audio/255571__stradie__flipping-paper.ogg");
});
Quest::QuestState* quest = gameState_.questJournal.findQuest(visibleQuestIds[index]);
@@ -1656,6 +1714,7 @@ namespace ZL {
recomputePhoneChatPositions();
}
chatUiManager.startPopIn(nodeName, 300.0f);
audioPlayer_.playSoundAsync("audio/537061__imafoley__message-pop-sound.ogg");
}
void MenuManager::setDarklandsMode(bool enabled)