Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit ca429cb

Browse files
committed
Apply faction BuyMenu theme when the faction is set as the native tech
1 parent 75a5697 commit ca429cb

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

Activities/GameActivity.cpp

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -920,15 +920,38 @@ int GameActivity::Start()
920920
m_pBuyGUI[player] = new BuyMenuGUI;
921921
m_pBuyGUI[player]->Create(&m_PlayerController[player]);
922922

923+
int techModuleID = g_PresetMan.GetModuleID(GetTeamTech(GetTeamOfPlayer(player)));
924+
const DataModule *techModule = g_PresetMan.GetDataModule(techModuleID);
925+
if (techModuleID > 0 && (techModule && techModule->IsFaction())) {
926+
const DataModule::BuyMenuTheme &techBuyMenuTheme = techModule->GetFactionBuyMenuTheme();
927+
928+
// Match the ObjectPicker skin and background color with the BuyMenu for consistency.
929+
if (!techBuyMenuTheme.SkinFilePath.empty()) {
930+
m_pBuyGUI[player]->SetSkin(techBuyMenuTheme.SkinFilePath);
931+
m_pEditorGUI[player]->SetObjectPickerSkin(techBuyMenuTheme.SkinFilePath);
932+
933+
// Changing the skin resets the images that the GUICollectionBoxes of the banner and logo show. If no custom banner or logo were specified reset to default here otherwise they will be missing.
934+
if (techBuyMenuTheme.BannerImagePath.empty()) { m_pBuyGUI[player]->SetDefaultBannerImage(); }
935+
if (techBuyMenuTheme.LogoImagePath.empty()) { m_pBuyGUI[player]->SetDefaultLogoImage(); }
936+
}
937+
if (techBuyMenuTheme.BackgroundColorIndex >= 0) {
938+
m_pBuyGUI[player]->SetBackgroundColor(techBuyMenuTheme.BackgroundColorIndex);
939+
m_pEditorGUI[player]->SetObjectPickerBackgroundColor(techBuyMenuTheme.BackgroundColorIndex);
940+
}
941+
if (!techBuyMenuTheme.BannerImagePath.empty()) {
942+
m_pBuyGUI[player]->SetBannerImage(techBuyMenuTheme.BannerImagePath);
943+
}
944+
if (!techBuyMenuTheme.LogoImagePath.empty()) { m_pBuyGUI[player]->SetLogoImage(techBuyMenuTheme.LogoImagePath); }
945+
}
946+
923947
// Load correct loadouts into buy menu if we're starting a non meta-game activity
924-
if (m_pBuyGUI[player]->GetMetaPlayer() == Players::NoPlayer)
925-
{
926-
m_pBuyGUI[player]->SetNativeTechModule(g_PresetMan.GetModuleID(GetTeamTech(GetTeamOfPlayer(player))));
948+
if (m_pBuyGUI[player]->GetMetaPlayer() == Players::NoPlayer) {
949+
m_pBuyGUI[player]->SetNativeTechModule(techModuleID);
927950
m_pBuyGUI[player]->SetForeignCostMultiplier(1.0);
928951
m_pBuyGUI[player]->LoadAllLoadoutsFromFile();
929952

930953
// Change Editor GUI native tech module so it could load and show correct deployment prices
931-
m_pEditorGUI[player]->SetNativeTechModule(g_PresetMan.GetModuleID(GetTeamTech(GetTeamOfPlayer(player))));
954+
m_pEditorGUI[player]->SetNativeTechModule(techModuleID);
932955
}
933956

934957
////////////////////////////////////

0 commit comments

Comments
 (0)