|
|
@@ -92,25 +92,38 @@ CSelectionBase::CSelectionBase(ESelectionScreen type)
|
|
|
pos.h = 584;
|
|
|
if(screenType == ESelectionScreen::campaignList)
|
|
|
{
|
|
|
- setBackground(ImagePath::builtin("CamCust.bmp"));
|
|
|
+ //setBackground(ImagePath::builtin("CamCust.bmp"));
|
|
|
+
|
|
|
+ const JsonNode& gameSelectConfig = CMainMenuConfig::get().getConfig()["campaign-selection"];
|
|
|
+ const JsonVector& bgNames = gameSelectConfig["background"].Vector();
|
|
|
+
|
|
|
+ setBackground(ImagePath::fromJson(*RandomGeneratorUtil::nextItem(bgNames, CRandomGenerator::getDefault())));
|
|
|
+
|
|
|
pos = background->center();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+
|
|
|
const JsonNode& gameSelectConfig = CMainMenuConfig::get().getConfig()["scenario-selection"];
|
|
|
- const JsonVector& bgNames = gameSelectConfig["background"].Vector();
|
|
|
+ const JsonVector* bgNames = nullptr;
|
|
|
|
|
|
- setBackground(ImagePath::fromJson(*RandomGeneratorUtil::nextItem(bgNames, CRandomGenerator::getDefault())));
|
|
|
+ if (!gameSelectConfig.isStruct())
|
|
|
+ bgNames = &CMainMenuConfig::get().getConfig()["game-select"].Vector(); // Fallback for 1.6 mods
|
|
|
+ else
|
|
|
+ bgNames = &gameSelectConfig["background"].Vector();
|
|
|
+
|
|
|
+
|
|
|
+ setBackground(ImagePath::fromJson(*RandomGeneratorUtil::nextItem(*bgNames, CRandomGenerator::getDefault())));
|
|
|
pos = background->center();
|
|
|
|
|
|
// Set logo
|
|
|
const auto& logoConfig = gameSelectConfig["logo"];
|
|
|
- if (!logoConfig.isNull() && logoConfig["name"].isVector() && !logoConfig["name"].Vector().empty())
|
|
|
+ if (!logoConfig["name"].Vector().empty())
|
|
|
logo = std::make_shared<CPicture>(ImagePath::fromJson(*RandomGeneratorUtil::nextItem(logoConfig["name"].Vector(), CRandomGenerator::getDefault())), Point(logoConfig["x"].Integer(), logoConfig["y"].Integer()));
|
|
|
-
|
|
|
+
|
|
|
// Set sublogo
|
|
|
const auto& sublogoConfig = gameSelectConfig["sublogo"];
|
|
|
- if (!sublogoConfig.isNull() && sublogoConfig["name"].isVector() && !sublogoConfig["name"].Vector().empty())
|
|
|
+ if (!logoConfig["name"].Vector().empty())
|
|
|
sublogo = std::make_shared<CPicture>(ImagePath::fromJson(*RandomGeneratorUtil::nextItem(sublogoConfig["name"].Vector(), CRandomGenerator::getDefault())), Point(sublogoConfig["x"].Integer(), sublogoConfig["y"].Integer()));
|
|
|
}
|
|
|
|