mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-26 01:58:51 -05:00
Cosmetics editor fixes (#1538)
* Fixes randomize all and randomize section buttons. * Fixes individual randomize cosmetics buttons * Fixes Navi Colors * Inits srand(time(NULL)) for each individual randomize buttons
This commit is contained in:
parent
d47746eab1
commit
784cb98d7f
@ -40,8 +40,13 @@ const char* MarginCvarList[] {
|
||||
ImVec4 GetRandomValue(int MaximumPossible){
|
||||
ImVec4 NewColor;
|
||||
unsigned long range = 255 - 0;
|
||||
#ifndef __SWITCH__
|
||||
std::random_device rd;
|
||||
std::mt19937 rng(rd());
|
||||
#else
|
||||
size_t seed = std::hash<std::string>{}(std::to_string(rand()));
|
||||
std::mt19937_64 rng(seed);
|
||||
#endif
|
||||
std::uniform_int_distribution<int> dist(0, 255 - 1);
|
||||
|
||||
NewColor.x = (float)(dist(rng)) / 255;
|
||||
@ -50,6 +55,9 @@ ImVec4 GetRandomValue(int MaximumPossible){
|
||||
return NewColor;
|
||||
}
|
||||
void GetRandomColorRGB(CosmeticsColorSection* ColorSection, int SectionSize){
|
||||
#ifdef __SWITCH__
|
||||
srand(time(NULL));
|
||||
#endif
|
||||
for (int i = 0; i < SectionSize; i++){
|
||||
CosmeticsColorIndividual* Element = ColorSection[i].Element;
|
||||
ImVec4 colors = Element->ModifiedColor;
|
||||
|
@ -67,14 +67,14 @@ ImVec4 menu_save_colors;
|
||||
ImVec4 menu_gameover_colors;*/
|
||||
|
||||
//Navi
|
||||
static CosmeticsColorIndividual Navi_Idle_Inner = { "Navi Idle (Primary)", "Inner color for Navi (idle flying around)", "gNavi_Idle_Inner_", navi_idle_i_col, ImVec4(255, 255, 255, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Idle_Outer = { "Navi Idle (Secondary)", "Outer color for Navi (idle flying around)", "gNavi_Idle_Outer_", navi_idle_o_col, ImVec4(0, 0, 255, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Npc_Inner = { "Navi NPC (Primary)", "Inner color for Navi (when Navi fly around NPCs)", "gNavi_NPC_Inner_", navi_npc_i_col, ImVec4(150, 150, 255, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Npc_Outer = { "Navi NPC (Secondary)", "Outer color for Navi (when Navi fly around NPCs)", "gNavi_NPC_Outer_", navi_npc_o_col, ImVec4(150, 150, 255, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Enemy_Inner = { "Navi Enemy (Primary)", "Inner color for Navi (when Navi fly around Enemies or Bosses)", "gNavi_Enemy_Inner_", navi_enemy_i_col, ImVec4(255, 255, 0, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Enemy_Outer = { "Navi Enemy (Secondary)", "Outer color for Navi (when Navi fly around Enemies or Bosses)", "gNavi_Enemy_Outer_", navi_enemy_o_col, ImVec4(220, 155, 0, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Prop_Inner = { "Navi Enemy (Primary)", "Inner color for Navi (when Navi fly around props (signs etc))", "gNavi_Prop_Inner_", navi_prop_i_col, ImVec4(0, 255, 0, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Prop_Outer = { "Navi Enemy (Secondary)", "Outer color for Navi (when Navi fly around props (signs etc))", "gNavi_Prop_Outer_", navi_prop_o_col, ImVec4(0, 255, 0, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Idle_Inner = { "Navi Idle (Primary)", "Inner color for Navi (idle flying around)", "gNavi_Idle_Inner", navi_idle_i_col, ImVec4(255, 255, 255, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Idle_Outer = { "Navi Idle (Secondary)", "Outer color for Navi (idle flying around)", "gNavi_Idle_Outer", navi_idle_o_col, ImVec4(0, 0, 255, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Npc_Inner = { "Navi NPC (Primary)", "Inner color for Navi (when Navi fly around NPCs)", "gNavi_NPC_Inner", navi_npc_i_col, ImVec4(150, 150, 255, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Npc_Outer = { "Navi NPC (Secondary)", "Outer color for Navi (when Navi fly around NPCs)", "gNavi_NPC_Outer", navi_npc_o_col, ImVec4(150, 150, 255, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Enemy_Inner = { "Navi Enemy (Primary)", "Inner color for Navi (when Navi fly around Enemies or Bosses)", "gNavi_Enemy_Inner", navi_enemy_i_col, ImVec4(255, 255, 0, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Enemy_Outer = { "Navi Enemy (Secondary)", "Outer color for Navi (when Navi fly around Enemies or Bosses)", "gNavi_Enemy_Outer", navi_enemy_o_col, ImVec4(220, 155, 0, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Prop_Inner = { "Navi Enemy (Primary)", "Inner color for Navi (when Navi fly around props (signs etc))", "gNavi_Prop_Inner", navi_prop_i_col, ImVec4(0, 255, 0, 255), false, false, false };
|
||||
static CosmeticsColorIndividual Navi_Prop_Outer = { "Navi Enemy (Secondary)", "Outer color for Navi (when Navi fly around props (signs etc))", "gNavi_Prop_Outer", navi_prop_o_col, ImVec4(0, 255, 0, 255), false, false, false };
|
||||
|
||||
//Keese
|
||||
static CosmeticsColorIndividual Keese1_prim = { "Fire Primary color", "Affects the primary color of the Fire itself of the Keese", "gKeese1_Ef_Prim", Keese1_primcol, ImVec4(255, 255, 100, 255), true, false, false };
|
||||
@ -494,3 +494,4 @@ static CosmeticsColorSection AllItemsSkills_section[]{
|
||||
void InitCosmeticsEditor();//Init the menu itself
|
||||
void LoadRainbowColor();
|
||||
void NewSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0);
|
||||
ImVec4 GetRandomValue(int MaximumPossible);
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <libultraship/Cvar.h>
|
||||
|
||||
#include <ultra64/types.h>
|
||||
#include "soh/Enhancements/cosmetics/CosmeticsEditor.h"
|
||||
|
||||
namespace UIWidgets {
|
||||
|
||||
@ -438,15 +439,16 @@ namespace UIWidgets {
|
||||
std::string FullName = "Random";
|
||||
FullName += MakeInvisible;
|
||||
if (ImGui::Button(FullName.c_str())) {
|
||||
s16 RND_R = rand() % (255 - 0);
|
||||
s16 RND_G = rand() % (255 - 0);
|
||||
s16 RND_B = rand() % (255 - 0);
|
||||
colors->x = (float)RND_R / 255;
|
||||
colors->y = (float)RND_G / 255;
|
||||
colors->z = (float)RND_B / 255;
|
||||
NewColors.r = fmin(fmax(colors->x, 0), 255);
|
||||
NewColors.g = fmin(fmax(colors->y, 0), 255);
|
||||
NewColors.b = fmin(fmax(colors->z, 0), 255);
|
||||
#ifdef __SWITCH__
|
||||
srand(time(NULL));
|
||||
#endif
|
||||
ImVec4 color = GetRandomValue(255);
|
||||
colors->x = color.x;
|
||||
colors->y = color.y;
|
||||
colors->z = color.z;
|
||||
NewColors.r = fmin(fmax(colors->x * 255, 0), 255);
|
||||
NewColors.g = fmin(fmax(colors->y * 255, 0), 255);
|
||||
NewColors.b = fmin(fmax(colors->z * 255, 0), 255);
|
||||
CVar_SetRGBA(cvarName, NewColors);
|
||||
CVar_SetS32(Cvar_RBM.c_str(), 0); // On click disable rainbow mode.
|
||||
SohImGui::RequestCvarSaveOnNextTick();
|
||||
|
Loading…
Reference in New Issue
Block a user