Added music

This commit is contained in:
Vladislav Khorev committed 2026-06-21 21:27:27 +03:00
1 parent 7db9ca8f70
commit 84f9fa37a8
13 files changed
+118 -8

No files matched your search

+13 -3
View File
@@ -74,8 +74,8 @@ namespace ZL
Game::Game()
: newTickCount(0)
, lastTickCount(0)
, menuManager(renderer, gameState)
, audioPlayer(std::make_unique<AudioPlayerAsync>())
, menuManager(renderer, gameState, *audioPlayer)
{
}
@@ -327,14 +327,13 @@ namespace ZL
menuManager.startGameFunc = [this]() {
gameState.currentLocationName = "location_dorm";
currentLocation()->scriptEngine.callLocationEnterCallback();
this->audioPlayer->playMusicAsync("audio/obshaga.ogg");
};
menuManager.onSaveGame = [this](int slot) { saveGame(slot); };
menuManager.onLoadGame = [this](int slot) { loadGame(slot); };
menuManager.getSlotInfoFunc = [this](int slot) { return readSlotInfo(slot); };
loadingCompleted = true;
if (audioPlayer->init()) {
audioPlayer->setMusicVolume(100);
audioPlayer->setSoundVolume(80);
@@ -344,6 +343,11 @@ namespace ZL
std::cout << "Audio initialization failed" << std::endl;
}
audioPlayer->playMusicAsync("audio/main menu final.ogg");
loadingCompleted = true;
}
void Game::createLocations()
@@ -448,6 +452,12 @@ namespace ZL
}
}
gameState.locations["uni_interior"]->requestDarklandsPlayBattleMusic = [this]() {
audioPlayer->playMusicAsync("audio/bishkek fight.ogg");
};
gameState.locations["uni_interior"]->requestDarklandsPlayNormalMusic = [this]() {
audioPlayer->playMusicAsync("audio/bishkek fight calm.ogg");
};
LocationSetup uniExteriorParams = uniInteriorParams;
uniExteriorParams.gameObjectsJsonPath = "resources/config2/gameobjects_uni_exterior_x.json";
uniExteriorParams.interactiveObjectsJsonPath = "resources/config2/interactive_objects_uni_exterior_x.json";