1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00

Ability to use random progress bar

This commit is contained in:
George King 2025-01-08 00:16:55 +01:00 committed by GitHub
parent 905eac24ae
commit f3d48ecc3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -694,6 +694,15 @@ CLoadingScreen::CLoadingScreen(ImagePath background)
CCS->musich->stopMusic(5000);
const auto& conf = CMainMenuConfig::get().getConfig()["loading"];
const auto& nameConfig = conf["name"];
AnimationPath animationPath;
if (nameConfig.isVector() && !nameConfig.Vector().empty())
animationPath = AnimationPath::fromJson(*RandomGeneratorUtil::nextItem(nameConfig.Vector(), CRandomGenerator::getDefault()));
if (nameConfig.isString())
animationPath = AnimationPath::fromJson(nameConfig);
if (conf.isStruct())
{
const int posx = conf["x"].Integer();
@ -703,7 +712,7 @@ CLoadingScreen::CLoadingScreen(ImagePath background)
for (int i = 0; i < blocksAmount; ++i)
{
progressBlocks.push_back(std::make_shared<CAnimImage>(AnimationPath::fromJson(conf["name"]), i, 0, posx + i * blockSize, posy));
progressBlocks.push_back(std::make_shared<CAnimImage>(animationPath, i, 0, posx + i * blockSize, posy));
progressBlocks.back()->deactivate();
progressBlocks.back()->visible = false;
}