Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds option to lock a cosmetic from being randomized #1812

Merged
merged 1 commit into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ void GetRandomColorRGB(CosmeticsColorSection* ColorSection, int SectionSize){
ImVec4 colors = Element->ModifiedColor;
Color_RGBA8 NewColors = { 0, 0, 0, 255 };
std::string cvarName = Element->CvarName;
std::string cvarLock = cvarName + "Lock";
if(CVar_GetS32(cvarLock.c_str(), 0)) {
continue;
}
std::string Cvar_RBM = cvarName + "RBM";
colors = RANDOMIZE_32(255);
NewColors.r = fmin(fmax(colors.x * 255, 0), 255);
Expand Down Expand Up @@ -893,7 +897,7 @@ void Draw_Placements(){
}
}
void Draw_HUDButtons(){
if (CVar_GetS32("gHudColors",0) ==2 ){
if (CVar_GetS32("gHudColors",0) == 2){
DrawRandomizeResetButton("every buttons", Buttons_section, SECTION_SIZE(Buttons_section));
if (ImGui::CollapsingHeader("A Button colors & A Cursors")) {
if (ImGui::BeginTable("tableBTN_A", 1, FlagsTable)) {
Expand Down
10 changes: 10 additions & 0 deletions soh/soh/UIWidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,15 @@ namespace UIWidgets {
return changed;
}

void DrawLockColorCheckbox(const char* cvarName) {
std::string Cvar_Lock = cvarName;
Cvar_Lock += "Lock";
s32 lock = CVar_GetS32(Cvar_Lock.c_str(), 0);
std::string FullName = "Lock##" + Cvar_Lock;
EnhancementCheckbox(FullName.c_str(), Cvar_Lock.c_str());
Tooltip("Prevents this color from being changed upon selecting \"Randomize all\"");
}

void RainbowColor(const char* cvarName, ImVec4* colors) {
std::string Cvar_RBM = cvarName;
Cvar_RBM += "RBM";
Expand Down Expand Up @@ -546,6 +555,7 @@ namespace UIWidgets {
}
RainbowColor(cvarName, &ColorRGBA);
}
DrawLockColorCheckbox(cvarName);
ImGui::NewLine();
ImGui::PopItemWidth();

Expand Down