Skip to content

Commit

Permalink
Merge branch 'theming' of https://github.com/youneuoy/M2TWEOP-library
Browse files Browse the repository at this point in the history
…into theming
  • Loading branch information
EddieEldridge committed Nov 10, 2023
2 parents ef87856 + a97c224 commit e7628f2
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 55 deletions.
35 changes: 25 additions & 10 deletions M2TWEOP Code/M2TWEOP GUI/modSettingsUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ namespace modSettingsUI
ImVec2 textSize = ImGui::CalcTextSize("Readme Teutonic");
ImGui::PushItemWidth(textSize.x);
ImGui::Combo("Config Files", &selectedItem, &items[0], items.size());
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("The mod config file you want EOP to read when it launches the game");}

if (selectedItem != -1)
{
Expand All @@ -150,6 +151,8 @@ namespace modSettingsUI
ImGui::SameLine();

ImGui::Checkbox("Use standard config", &dataG::data.modData.useVanillaConfig);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("Don't use any mod specific config when launching the game");}

ImGui::NewLine();

if (!helpers::verifyModPath(helpers::checkCfgFileForMod(path + "\\" + dataG::data.modData.configName)))
Expand All @@ -161,9 +164,10 @@ namespace modSettingsUI
}
}
ImGui::Checkbox("Use M2TWEOP", &dataG::data.modData.useM2TWEOP);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("Enable EOP when launching the mod");}

ImGui::Checkbox("Hide launcher on startup", &dataG::data.modData.hideLauncherAtStart);

if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("Hide the launcher when starting up. Can be shown again in eopData/uiCfg.json");}
}

void drawLauncherSettigs()
Expand All @@ -179,7 +183,10 @@ namespace modSettingsUI
dataG::data.audio.bkgMusic.music->play();
}
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("Enabled music in the EOP Launcher");}

ImGui::Checkbox("Discord Rich Presence", &dataG::data.gameData.isDiscordRichPresenceEnabled);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("Update your Discord status/presence with details about what mod you are playing");}

if (ImGui::SliderInt("Music volume", &dataG::data.audio.bkgMusic.musicVolume, 0, 100))
{
Expand All @@ -201,6 +208,7 @@ namespace modSettingsUI
ImVec2 textSize = ImGui::CalcTextSize("Launcher Theme: ");
ImGui::PushItemWidth(textSize.x);
ImGui::Combo("Launcher Theme: ", &selectedItem, &items[0], items.size());
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("Allows you to select a custom EOP theme for the launcher");}
}

void drawRulesSettings()
Expand All @@ -210,27 +218,34 @@ namespace modSettingsUI

void drawHsSettings()
{
ImGui::Checkbox("Automatically generate hotseat battles", &dataG::data.battlesData.isGenerationNeeded);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
{
ImGui::SetTooltip("For hotseat online play");
}
ImGui::Checkbox("Automatically generate hotseat/historical battles", &dataG::data.battlesData.isGenerationNeeded);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("Enable if you want to generate a historical battle each time you start a battle");}

ImGui::Checkbox("Automatically generate battle result files", &dataG::data.battlesData.isGenerationNeeded);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
{
ImGui::SetTooltip("");
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("Enable if you want to generate a results file from an online battle");}

ImGui::Checkbox("Planned retreat route", &dataG::data.battlesData.isPlannedRetreatRoute);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("Experimental: Allows you to set the location where armies will retreat to when attacked ");}
}

void drawGameSettings()
{
ImGui::Checkbox("Stratmap context menu", &dataG::data.modulesData.isContextMenuNeeded);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("Enable the strategy/campaign map while pressing MMB");}

ImGui::Checkbox("Tactical map viewer", &dataG::data.modulesData.isTacticalMapViewerNeeded);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("Enable the tactical map viewer which allows you to view battlemaps before a battle");}

ImGui::Checkbox("M2TWEOP developer mode", &dataG::data.modulesData.isDeveloperModeNeeded);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("Enable to quickly debug battle maps and .worldpackage files");}

ImGui::Checkbox("Block modification launch without EOP", &dataG::data.gameData.isBlockLaunchWithoutEop);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("Prevent your mod from starting without EOP enabled. See FAQ for more details.");}

ImGui::Checkbox("Override battle camera and controls", &dataG::data.gameData.IsOverrideBattleCamera);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("For hotseat online play");}
}

void drawModSettingsUI(bool* isOpen)
{
ImGuiIO& io = ImGui::GetIO();
Expand Down
10 changes: 5 additions & 5 deletions M2TWEOP Code/M2TWEOP library.sln
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A2353BF6-5423-46E0-91EB-608BB5ACBFF8}.Debug|Any CPU.ActiveCfg = Debug|x64
{A2353BF6-5423-46E0-91EB-608BB5ACBFF8}.Debug|Any CPU.Build.0 = Debug|x64
{A2353BF6-5423-46E0-91EB-608BB5ACBFF8}.Debug|Any CPU.ActiveCfg = Debug|Win32
{A2353BF6-5423-46E0-91EB-608BB5ACBFF8}.Debug|Any CPU.Build.0 = Debug|Win32
{A2353BF6-5423-46E0-91EB-608BB5ACBFF8}.Debug|x64.ActiveCfg = Debug|x64
{A2353BF6-5423-46E0-91EB-608BB5ACBFF8}.Debug|x64.Build.0 = Debug|x64
{A2353BF6-5423-46E0-91EB-608BB5ACBFF8}.Debug|x86.ActiveCfg = Debug|Win32
{A2353BF6-5423-46E0-91EB-608BB5ACBFF8}.Debug|x86.Build.0 = Debug|Win32
{A2353BF6-5423-46E0-91EB-608BB5ACBFF8}.Debug|x86.Build.0 = Debug|Win32
{A2353BF6-5423-46E0-91EB-608BB5ACBFF8}.Release|Any CPU.ActiveCfg = Release|x64
{A2353BF6-5423-46E0-91EB-608BB5ACBFF8}.Release|Any CPU.Build.0 = Release|x64
{A2353BF6-5423-46E0-91EB-608BB5ACBFF8}.Release|x64.ActiveCfg = Release|x64
Expand All @@ -61,8 +61,8 @@ Global
{86A4EA9B-4B06-4EEE-ABC5-3B3F8B848E8C}.Release|x64.ActiveCfg = Release|Win32
{86A4EA9B-4B06-4EEE-ABC5-3B3F8B848E8C}.Release|x86.ActiveCfg = Release|Win32
{86A4EA9B-4B06-4EEE-ABC5-3B3F8B848E8C}.Release|x86.Build.0 = Release|Win32
{D5F3609B-70D1-4DC8-A37B-C9BF490C5E4B}.Debug|Any CPU.ActiveCfg = Debug|x64
{D5F3609B-70D1-4DC8-A37B-C9BF490C5E4B}.Debug|Any CPU.Build.0 = Debug|x64
{D5F3609B-70D1-4DC8-A37B-C9BF490C5E4B}.Debug|Any CPU.ActiveCfg = Debug|Win32
{D5F3609B-70D1-4DC8-A37B-C9BF490C5E4B}.Debug|Any CPU.Build.0 = Debug|Win32
{D5F3609B-70D1-4DC8-A37B-C9BF490C5E4B}.Debug|x64.ActiveCfg = Debug|x64
{D5F3609B-70D1-4DC8-A37B-C9BF490C5E4B}.Debug|x64.Build.0 = Debug|x64
{D5F3609B-70D1-4DC8-A37B-C9BF490C5E4B}.Debug|x86.ActiveCfg = Debug|Win32
Expand Down
78 changes: 39 additions & 39 deletions M2TWEOP Code/M2TWEOP library/ContextMenuStrat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,57 @@
#include "PlannedRetreatRoute.h"
ContextMenuStrat::ContextMenuStrat()
{
ctxItems.insert(std::make_pair("TacticMapView", ContextMenuItem(
[]()
{
if (ImGui::Button("View tactical map"))
if (dataG::data.battlesData.isPlannedRetreatRoute == true)
{
ctxItems.insert(std::make_pair("TacticMapView", ContextMenuItem(
[]()
{
int posAtMap[2]{};

fastFuncts::GetGameTileCoordsWithCursor(posAtMap[0], posAtMap[1]);
fastFuncts::ViewTacticalMap(posAtMap[0], posAtMap[1]);

return true;
}

return false;
},
[](int posAtMap[2])
{
return true;
}
)));
if (ImGui::Button("View tactical map"))
{
int posAtMap[2]{};

fastFuncts::GetGameTileCoordsWithCursor(posAtMap[0], posAtMap[1]);
fastFuncts::ViewTacticalMap(posAtMap[0], posAtMap[1]);

return true;
}

ctxItems.insert(std::make_pair("RetreatPlanner", ContextMenuItem(
[]()
{
if (ImGui::Button("Set planned retreat route"))
return false;
},
[](int posAtMap[2])
{
int posAtMap[2]{};

fastFuncts::GetGameTileCoordsWithCursor(posAtMap[0], posAtMap[1]);
PlannedRetreatRoute::StartWork(posAtMap[0], posAtMap[1]);

return true;
}

return false;
},
[](int posAtMap[2])
{
if (fastFuncts::findArmy(posAtMap[0], posAtMap[1]) != nullptr)
)));
}

if (dataG::data.battlesData.isPlannedRetreatRoute == true)
{
ctxItems.insert(std::make_pair("RetreatPlanner", ContextMenuItem(
[]()
{
return true;
}
if (ImGui::Button("Set planned retreat route"))
{
int posAtMap[2]{};

return false;
}
)));
fastFuncts::GetGameTileCoordsWithCursor(posAtMap[0], posAtMap[1]);
PlannedRetreatRoute::StartWork(posAtMap[0], posAtMap[1]);

return true;
}

return false;
},
[](int posAtMap[2])
{
if (fastFuncts::findArmy(posAtMap[0], posAtMap[1]) != nullptr)
{
return true;
}

return false;
})));
}
}
void ContextMenuStrat::Draw()
{
Expand Down
2 changes: 1 addition & 1 deletion M2TWEOP Code/M2TWEOP library/onlineThings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace battleCreator
{
json.at("enableAutoGeneration").get_to(data.isGenerationNeeded);
json.at("enableResultsTransfer").get_to(data.isResultTransferNeeded);
//json.at("isPlannedRetreatRoute").get_to(data.isPlannedRetreatRoute);
json.at("isPlannedRetreatRoute").get_to(data.isPlannedRetreatRoute);
}
catch (jsn::json::type_error& e)
{
Expand Down

0 comments on commit e7628f2

Please sign in to comment.