mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-21 05:43:42 -07:00
Cosmetics hotfixes (#640)
* Initial branch creation * Revert Main Game so it do not conflict later * should fix window build, made namespace for Cosmetics * forgot to edit one title * Ability to add hidden window (usefull for Rainbow) Fix building issues * Line break, unused bool remove
This commit is contained in:
parent
c25089b98f
commit
37bf9b36ad
4 changed files with 89 additions and 74 deletions
|
@ -79,6 +79,67 @@ ImVec4 menu_map_colors;
|
|||
ImVec4 menu_quest_colors;
|
||||
ImVec4 menu_save_colors;
|
||||
ImVec4 menu_gameover_colors;*/
|
||||
const char* RainbowColorCvarList[] = {
|
||||
//This is the list of possible CVars that has rainbow effect.
|
||||
"gTunic_Kokiri_", "gTunic_Goron_", "gTunic_Zora_",
|
||||
"gFireArrowCol", "gIceArrowCol", "gTunic_Zora_",
|
||||
"gFireArrowColEnv", "gIceArrowColEnv", "gLightArrowColEnv",
|
||||
"gCCHeartsPrim", "gDDCCHeartsPrim", "gLightArrowCol", "gCCDDHeartsPrim",
|
||||
"gCCABtnPrim", "gCCBBtnPrim", "gCCCBtnPrim", "gCCStartBtnPrim",
|
||||
"gCCCUBtnPrim", "gCCCLBtnPrim", "gCCCRBtnPrim", "gCCCDBtnPrim", "gCCDpadPrim",
|
||||
"gCCMagicBorderNormPrim", "gCCMagicBorderPrim", "gCCMagicPrim", "gCCMagicUsePrim",
|
||||
"gCCMinimapPrim", "gCCMinimapDGNPrim", "gCCMinimapCPPrim", "gCCMinimapLEPrim",
|
||||
"gCCRupeePrim", "gCCKeysPrim", "gDog1Col", "gDog2Col", "gCCVSOAPrim",
|
||||
"gKeese1_Ef_Prim","gKeese2_Ef_Prim","gKeese1_Ef_Env","gKeese2_Ef_Env",
|
||||
"gDF_Col", "gDF_Env",
|
||||
"gNL_Diamond_Col", "gNL_Diamond_Env", "gNL_Orb_Col", "gNL_Orb_Env",
|
||||
"gTrailCol", "gCharged1Col", "gCharged1ColEnv", "gCharged2Col", "gCharged2ColEnv",
|
||||
"gCCFileChoosePrim", "gCCFileChooseTextPrim", "gCCEquipmentsPrim", "gCCItemsPrim",
|
||||
"gCCMapsPrim", "gCCQuestsPrim", "gCCSavePrim", "gCCGameoverPrim",
|
||||
};
|
||||
void LoadRainbowColor(bool& open) {
|
||||
u8 arrayLength = sizeof(RainbowColorCvarList) / sizeof(*RainbowColorCvarList);
|
||||
for (u8 s = 0; s < arrayLength; s++) {
|
||||
std::string cvarName = RainbowColorCvarList[s];
|
||||
std::string Cvar_Red = cvarName;
|
||||
Cvar_Red += "R";
|
||||
std::string Cvar_Green = cvarName;
|
||||
Cvar_Green += "G";
|
||||
std::string Cvar_Blue = cvarName;
|
||||
Cvar_Blue += "B";
|
||||
std::string Cvar_RBM = cvarName;
|
||||
Cvar_RBM += "RBM";
|
||||
std::string RBM_HUE = cvarName;
|
||||
RBM_HUE += "Hue";
|
||||
f32 Canon = 10.f * s;
|
||||
ImVec4 NewColor;
|
||||
const f32 deltaTime = 1.0f / ImGui::GetIO().Framerate;
|
||||
f32 hue = CVar_GetFloat(RBM_HUE.c_str(), 0.0f);
|
||||
f32 newHue = hue + CVar_GetS32("gColorRainbowSpeed", 1) * 36.0f * deltaTime;
|
||||
if (newHue >= 360)
|
||||
newHue = 0;
|
||||
CVar_SetFloat(RBM_HUE.c_str(), newHue);
|
||||
f32 current_hue = CVar_GetFloat(RBM_HUE.c_str(), 0);
|
||||
u8 i = current_hue / 60 + 1;
|
||||
u8 a = (-current_hue / 60.0f + i) * 255;
|
||||
u8 b = (current_hue / 60.0f + (1 - i)) * 255;
|
||||
|
||||
switch (i) {
|
||||
case 1: NewColor.x = 255; NewColor.y = b; NewColor.z = 0; break;
|
||||
case 2: NewColor.x = a; NewColor.y = 255; NewColor.z = 0; break;
|
||||
case 3: NewColor.x = 0; NewColor.y = 255; NewColor.z = b; break;
|
||||
case 4: NewColor.x = 0; NewColor.y = a; NewColor.z = 255; break;
|
||||
case 5: NewColor.x = b; NewColor.y = 0; NewColor.z = 255; break;
|
||||
case 6: NewColor.x = 255; NewColor.y = 0; NewColor.z = a; break;
|
||||
}
|
||||
|
||||
if (CVar_GetS32(Cvar_RBM.c_str(), 0) != 0) {
|
||||
CVar_SetS32(Cvar_Red.c_str(), SohImGui::ClampFloatToInt(NewColor.x, 0, 255));
|
||||
CVar_SetS32(Cvar_Green.c_str(), SohImGui::ClampFloatToInt(NewColor.y, 0, 255));
|
||||
CVar_SetS32(Cvar_Blue.c_str(), SohImGui::ClampFloatToInt(NewColor.z, 0, 255));
|
||||
}
|
||||
}
|
||||
}
|
||||
void Table_InitHeader(bool has_header = true) {
|
||||
if (has_header) {
|
||||
ImGui::TableHeadersRow();
|
||||
|
@ -258,11 +319,11 @@ void Draw_ItemsSkills(){
|
|||
SohImGui::EnhancementColor("Level 2 color", "gCharged2ColEnv", charged2_colenv, ImVec4(255,100,0,255));
|
||||
ImGui::EndTable();
|
||||
}
|
||||
SohImGui::EnhancementCheckbox("Custom sword trails color", "gUseTrailsCol");
|
||||
SohImGui::EnhancementCheckbox("Custom trails color", "gUseTrailsCol");
|
||||
if (CVar_GetS32("gUseTrailsCol",0) && ImGui::BeginTable("tabletrails", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) {
|
||||
ImGui::TableSetupColumn("Custom Swords trails", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth);
|
||||
ImGui::TableSetupColumn("Custom Trails", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth);
|
||||
Table_InitHeader();
|
||||
Draw_HelpIcon("Affects Slash trails color");
|
||||
Draw_HelpIcon("Affects Swords slash, boomerang and Bombchu trails color");
|
||||
SohImGui::EnhancementColor("Trails color", "gTrailCol", trailscol, ImVec4(255,255,255,255));
|
||||
SohImGui::EnhancementSliderInt("Trails duration: %dx", "##TrailsMul", "gTrailDurantion", 1, 5, "");
|
||||
SohImGui::Tooltip("The longer the trails the weirder it become");
|
||||
|
@ -1044,6 +1105,10 @@ void DrawCosmeticsEditor(bool& open) {
|
|||
ImGui::End();
|
||||
}
|
||||
void InitCosmeticsEditor() {
|
||||
//This allow to hide a window without disturbing the player nor adding things in menu
|
||||
//LoadRainbowColor() will this way run in background once it's window is activated
|
||||
//ImGui::SetNextItemWidth(0.0f);
|
||||
SohImGui::AddWindow("Cosmetics", "Rainbowfunction", LoadRainbowColor, true, true);
|
||||
//Draw the bar in the menu.
|
||||
SohImGui::AddWindow("Cosmetics", "Cosmetics Editor", DrawCosmeticsEditor);
|
||||
}
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
#pragma once
|
||||
|
||||
void InitCosmeticsEditor();//Init the menu itself
|
||||
void LoadRainbowColor();
|
Loading…
Add table
Add a link
Reference in a new issue