Save timesplits colour to cvar and reload it on init. (#4572)

* save timesplits colour to cvar and reload it

* fix mac and match cosmetics with the color conversion

* more stupid other platform fixes
This commit is contained in:
Pepper0ni 2024-11-22 17:28:10 +00:00 committed by GitHub
parent f0e5b9c22b
commit eda97653d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 7 deletions

View File

@ -220,7 +220,7 @@ static const ALIGN_ASSET(2) char gLinkChildDL_18580[] = dgLinkChildDL_18580;
static const ALIGN_ASSET(2) char gLinkChildBottle2DL[] = dgLinkChildBottle2DL; static const ALIGN_ASSET(2) char gLinkChildBottle2DL[] = dgLinkChildBottle2DL;
#define dgLinkChildSlinghotStringDL "__OTR__objects/object_link_child/gLinkChildSlinghotStringDL" #define dgLinkChildSlinghotStringDL "__OTR__objects/object_link_child/gLinkChildSlinghotStringDL"
static const ALIGN_ASSET(2) char gLinkChildSlinghotStringDL[] = dgLinkChildSlinghotStringDL; static const ALIGN_ASSET(2) char gLinkChildSlingshotStringDL[] = dgLinkChildSlinghotStringDL;
#define dgLinkChildDekuShieldDL "__OTR__objects/object_link_child/gLinkChildDekuShieldDL" #define dgLinkChildDekuShieldDL "__OTR__objects/object_link_child/gLinkChildDekuShieldDL"
static const ALIGN_ASSET(2) char gLinkChildDekuShieldDL[] = dgLinkChildDekuShieldDL; static const ALIGN_ASSET(2) char gLinkChildDekuShieldDL[] = dgLinkChildDekuShieldDL;

View File

@ -851,7 +851,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) {
Color_RGBA8 color = CVarGetColor(equipmentSlingshotString.cvar, defaultColor); Color_RGBA8 color = CVarGetColor(equipmentSlingshotString.cvar, defaultColor);
PATCH_GFX(gGiSlingshotDL, "Equipment_SlingshotString1",equipmentSlingshotString.changedCvar, 75, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); PATCH_GFX(gGiSlingshotDL, "Equipment_SlingshotString1",equipmentSlingshotString.changedCvar, 75, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255));
PATCH_GFX(gGiSlingshotDL, "Equipment_SlingshotString2",equipmentSlingshotString.changedCvar, 76, gsDPSetEnvColor(color.r / 2, color.g / 2, color.b / 2, 255)); PATCH_GFX(gGiSlingshotDL, "Equipment_SlingshotString2",equipmentSlingshotString.changedCvar, 76, gsDPSetEnvColor(color.r / 2, color.g / 2, color.b / 2, 255));
PATCH_GFX(gLinkChildSlinghotStringDL, "Equipment_SlingshotString3",equipmentSlingshotString.changedCvar, 9, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); PATCH_GFX(gLinkChildSlingshotStringDL, "Equipment_SlingshotString3",equipmentSlingshotString.changedCvar, 9, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255));
} }
static CosmeticOption& equipmentBowTips = cosmeticOptions.at("Equipment.BowTips"); static CosmeticOption& equipmentBowTips = cosmeticOptions.at("Equipment.BowTips");

View File

@ -745,14 +745,18 @@ void TimeSplitsDrawOptionsMenu() {
ImGui::SeparatorText("Window Options"); ImGui::SeparatorText("Window Options");
if (ImGui::ColorEdit4("Background Color", (float*)&windowColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel)) { if (ImGui::ColorEdit4("Background Color", (float*)&windowColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel)) {
Color_RGBA8 color; Color_RGBA8 color;
color.r = windowColor.x; color.r = windowColor.x * 255.0;
color.g = windowColor.y; color.g = windowColor.y * 255.0;
color.b = windowColor.z; color.b = windowColor.z * 255.0;
color.a = windowColor.w; color.a = windowColor.w * 255.0;
CVarSetColor("TimeSplits.WindowColor", color);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Reset")) { if (ImGui::Button("Reset")) {
windowColor = { 0.0f, 0.0f, 0.0f, 1.0f }; windowColor = { 0.0f, 0.0f, 0.0f, 1.0f };
CVarSetColor("TimeSplits.WindowColor", {0, 0, 0, 1});
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
if (UIWidgets::PaddedEnhancementSliderFloat("Window Size: %.1fx", "##windowSize", if (UIWidgets::PaddedEnhancementSliderFloat("Window Size: %.1fx", "##windowSize",
@ -914,6 +918,9 @@ static bool initialized = false;
void TimeSplitWindow::DrawElement() { void TimeSplitWindow::DrawElement() {
ImGui::SetWindowFontScale(timeSplitsWindowSize); ImGui::SetWindowFontScale(timeSplitsWindowSize);
if (!initialized) { if (!initialized) {
Color_RGBA8 defaultColour = {0, 0, 0, 255};
Color_RGBA8 color = CVarGetColor("TimeSplits.WindowColor", defaultColour);
windowColor = {(float)color.r / 255.0f, (float)color.g / 255.0f, (float)color.b / 255.0f, (float)color.a / 255.0f};
InitializeSplitDataFile(); InitializeSplitDataFile();
initialized = true; initialized = true;
} }

View File

@ -1753,7 +1753,7 @@ Vec3f sLeftHandArrowVec3 = { 398.0f, 1419.0f, 244.0f };
BowStringData sBowStringData[] = { BowStringData sBowStringData[] = {
{ gLinkAdultBowStringDL, { 0.0f, -360.4f, 0.0f } }, // bow { gLinkAdultBowStringDL, { 0.0f, -360.4f, 0.0f } }, // bow
{ gLinkChildSlinghotStringDL, { 606.0f, 236.0f, 0.0f } }, // slingshot { gLinkChildSlingshotStringDL, { 606.0f, 236.0f, 0.0f } }, // slingshot
}; };
Vec3f sRightHandLimbModelShieldQuadVertices[] = { Vec3f sRightHandLimbModelShieldQuadVertices[] = {