Phase 1: Separate ImGui Drawing From LUS (#1310)

* Update LUS imported paths

* Introduce GameMenuBar

* Fix imports after LUS import paths change

* Move Randomizer

* Replace needs_save

* Migrate Developer Tools

* Migrate Cheats

* Migrate Enhancements

* Separate UIWidgets

* Add missing Hooks.cpp file

* Migrate Settings

* Remove UI methods from LUS

* Cleanup imports and exposed properties

* Cleanup more methods

* Fix project generation

* Fix CI compilation

* Remove resolved TODO
pull/1385/head
David Chavez 9 months ago committed by GitHub
parent 64aca78450
commit 0ce0ab1260
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -121,6 +121,7 @@ set(Source_Files__CustomImpl
source_group("Source Files\\CustomImpl" FILES ${Source_Files__CustomImpl})
set(Source_Files__CustomImpl__Hooks
"Hooks.cpp"
"Hooks.h"
)
source_group("Source Files\\CustomImpl\\Hooks" FILES ${Source_Files__CustomImpl__Hooks})

@ -16,28 +16,28 @@ namespace Ship {
if (CVar_Get(args[2].c_str()) != nullptr) {
const char* key = args[2].c_str();
GameOverlay* overlay = SohImGui::overlay;
GameOverlay* overlay = SohImGui::GetGameOverlay();
if (args[1] == "add") {
if (!overlay->RegisteredOverlays.contains(key)) {
overlay->RegisteredOverlays[key] = new Overlay({ OverlayType::TEXT, ImStrdup(key), -1.0f });
SohImGui::console->SendInfoMessage("Added overlay: %s", key);
SohImGui::GetConsole()->SendInfoMessage("Added overlay: %s", key);
}
else {
SohImGui::console->SendErrorMessage("Overlay already exists: %s", key);
SohImGui::GetConsole()->SendErrorMessage("Overlay already exists: %s", key);
}
}
else if (args[1] == "remove") {
if (overlay->RegisteredOverlays.contains(key)) {
overlay->RegisteredOverlays.erase(key);
SohImGui::console->SendInfoMessage("Removed overlay: %s", key);
SohImGui::GetConsole()->SendInfoMessage("Removed overlay: %s", key);
}
else {
SohImGui::console->SendErrorMessage("Overlay not found: %s", key);
SohImGui::GetConsole()->SendErrorMessage("Overlay not found: %s", key);
}
}
}
else {
SohImGui::console->SendErrorMessage("CVar {} does not exist", args[2].c_str());
SohImGui::GetConsole()->SendErrorMessage("CVar {} does not exist", args[2].c_str());
}
return CMD_SUCCESS;
@ -124,7 +124,7 @@ namespace Ship {
else
text_display_end = text_end;
GameOverlay* overlay = SohImGui::overlay;
GameOverlay* overlay = SohImGui::GetGameOverlay();
ImFont* font = overlay->CurrentFont == "Default" ? g.Font : overlay->Fonts[overlay->CurrentFont];
const float font_size = font->FontSize;
@ -157,7 +157,7 @@ namespace Ship {
}
}
SohImGui::console->AddCommand("overlay", { OverlayCommand, "Draw an overlay using a cvar value" });
SohImGui::GetConsole()->AddCommand("overlay", { OverlayCommand, "Draw an overlay using a cvar value" });
}
void GameOverlay::DrawSettings() {
@ -167,7 +167,7 @@ namespace Ship {
if (ImGui::Selectable(name.c_str(), name == this->CurrentFont)) {
this->CurrentFont = name;
CVar_SetString("gOverlayFont", ImStrdup(name.c_str()));
SohImGui::needs_save = true;
SohImGui::RequestCvarSaveOnNextTick();
}
}

File diff suppressed because it is too large Load Diff

@ -1,14 +1,5 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void enableBetaQuest();
void disableBetaQuest();
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
#include "GameOverlay.h"
#include "Lib/ImGui/imgui.h"
@ -34,14 +25,6 @@ namespace SohImGui {
dLoadSettings,
};
// Enumeration for disabled checkbox graphics
enum class ImGuiCheckboxGraphics
{
Cross,
Checkmark,
None
};
typedef struct {
Backend backend;
union {
@ -76,8 +59,6 @@ namespace SohImGui {
} gx2;
} EventImpl;
extern WindowImpl impl;
using WindowDrawFunc = void(*)(bool& enabled);
typedef struct {
@ -85,55 +66,49 @@ namespace SohImGui {
WindowDrawFunc drawFunc;
} CustomWindow;
extern std::shared_ptr<Ship::Console> console;
extern Ship::InputEditor* controller;
extern Ship::GameOverlay* overlay;
extern bool needs_save;
void Init(WindowImpl window_impl);
void Update(EventImpl event);
void Tooltip(const char* text);
void EnhancementRadioButton(const char* text, const char* cvarName, int id);
void EnhancementCheckbox(const char* text, const char* cvarName, bool disabled = false, const char* disabledTooltipText = "", ImGuiCheckboxGraphics disabledGraphic = ImGuiCheckboxGraphics::Cross);
void EnhancementButton(const char* text, const char* cvarName);
void EnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = false);
void EnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage, bool PlusMinusButton = false);
void EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue);
void EnhancementColor(const char* text, const char* cvarName, ImVec4 ColorRGBA, ImVec4 default_colors, bool allow_rainbow = true, bool has_alpha=false, bool TitleSameLine=false);
void EnhancementCombo(const std::string& name, const char* cvarName, const std::vector<std::string>& items, int defaultValue = 0);
void applyEnhancementPresets(void);
void applyEnhancementPresetDefault(void);
void applyEnhancementPresetVanillaPlus(void);
void applyEnhancementPresetEnhanced(void);
void applyEnhancementPresetRandomizer(void);
void DrawMainMenuAndCalculateGameSize(void);
void RegisterMenuDrawMethod(std::function<void(void)> drawMethod);
void AddSetupHooksDelegate(std::function<void(void)> setupHooksMethod);
void DrawFramebufferAndGameInput(void);
void Render(void);
void CancelFrame(void);
void ShowCursor(bool hide, Dialogues w);
void BindCmd(const std::string& cmd, Ship::CommandEntry entry);
void AddWindow(const std::string& category, const std::string& name, WindowDrawFunc drawFunc, bool isEnabled=false, bool isHidden=false);
void LoadResource(const std::string& name, const std::string& path, const ImVec4& tint = ImVec4(1, 1, 1, 1));
void LoadPickersColors(ImVec4& ColorArray, const char* cvarname, const ImVec4& default_colors, bool has_alpha=false);
int ClampFloatToInt(float value, int min, int max);
void RandomizeColor(const char* cvarName, ImVec4* colors);
void RainbowColor(const char* cvarName, ImVec4* colors);
void ResetColor(const char* cvarName, ImVec4* colors, ImVec4 defaultcolors, bool has_alpha);
void DrawSettings();
Backend WindowBackend();
float WindowRefreshRate();
std::pair<const char*, const char*>* GetAvailableRenderingBackends();
std::pair<const char*, const char*> GetCurrentRenderingBackend();
void SetCurrentRenderingBackend(uint8_t index, std::pair<const char*, const char*>);
const char** GetSupportedTextureFilters();
void SetResolutionMultiplier(float multiplier);
void SetMSAALevel(uint32_t value);
void AddWindow(const std::string& category, const std::string& name, WindowDrawFunc drawFunc, bool isEnabled = false, bool isHidden = false);
void EnableWindow(const std::string& name, bool isEnabled = true);
Ship::GameOverlay* GetGameOverlay();
Ship::InputEditor* GetInputEditor();
void ToggleInputEditorWindow(bool isOpen = true);
void ToggleStatisticsWindow(bool isOpen = true);
std::shared_ptr<Ship::Console> GetConsole();
void ToggleConsoleWindow(bool isOpen = true);
void DispatchConsoleCommand(const std::string& line);
void RequestCvarSaveOnNextTick();
ImTextureID GetTextureByID(int id);
ImTextureID GetTextureByName(const std::string& name);
void LoadResource(const std::string& name, const std::string& path, const ImVec4& tint = ImVec4(1, 1, 1, 1));
void ShowCursor(bool hide, Dialogues w);
void BeginGroupPanel(const char* name, const ImVec2 & size = ImVec2(0.0f, 0.0f));
void EndGroupPanel(float minHeight = 0.0f);
std::string BreakTooltip(const char* text, int lineLength = 60);
std::string BreakTooltip(const std::string& text, int lineLength = 60);
void InsertPadding(float extraVerticalPadding = 0.0f);
void PaddedSeparator(bool padTop = true, bool padBottom = true, float extraVerticalTopPadding = 0.0f, float extraVerticalBottomPadding = 0.0f);
void PaddedEnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = false, bool padTop = true, bool padBottom = true);
void PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop = true, bool padBottom = true, bool disabled = false, const char* disabledTooltipText = "", ImGuiCheckboxGraphics disabledGraphic = ImGuiCheckboxGraphics::Cross);
void PaddedText(const char* text, bool padTop = true, bool padBottom = true);
std::string GetWindowButtonText(const char* text, bool menuOpen);
}
#endif

@ -41,8 +41,8 @@ protected:
}
formatted.push_back('\0');
const char* msg_output = formatted.data();
if (CVar_GetS32("gSinkEnabled", 0) && SohImGui::console->IsOpened()) {
SohImGui::console->Append("Logs", msg.level, "%s", msg_output);
if (CVar_GetS32("gSinkEnabled", 0) && SohImGui::GetConsole()->IsOpened()) {
SohImGui::GetConsole()->Append("Logs", msg.level, "%s", msg_output);
}
}
@ -57,4 +57,4 @@ private:
using soh_sink_mt = sohconsole_sink<std::mutex>;
using soh_sink_st = sohconsole_sink<details::null_mutex>;
} // namespace sinks
} // namespace spdlog
} // namespace spdlog

@ -86,7 +86,7 @@ extern "C" {
pad->gyro_x = 0;
pad->gyro_y = 0;
if (SohImGui::controller->IsOpened()) return;
if (SohImGui::GetInputEditor()->IsOpened()) return;
Ship::Window::GetInstance()->GetControlDeck()->WriteToPad(pad);
Ship::ExecuteHooks<Ship::ControllerRead>(pad);

@ -162,6 +162,7 @@ set(Header_Files__soh__Enhancements__controls
)
source_group("Header Files\\soh\\Enhancements\\controls" FILES ${Header_Files__soh__Enhancements__controls})
set(Header_Files__soh__Enhancements__cosmetics
"soh/Enhancements/cosmetics/CosmeticsEditor.h"
)
@ -172,7 +173,6 @@ set(Header_Files__soh__Enhancements__debugger
"soh/Enhancements/debugger/colViewer.h"
"soh/Enhancements/debugger/debugger.h"
"soh/Enhancements/debugger/debugSaveEditor.h"
"soh/Enhancements/debugger/ImGuiHelpers.h"
)
source_group("Header Files\\soh\\Enhancements\\debugger" FILES ${Header_Files__soh__Enhancements__debugger})
@ -251,6 +251,10 @@ set(Source_Files__soh
"soh/z_message_OTR.cpp"
"soh/z_play_otr.cpp"
"soh/z_scene_otr.cpp"
"soh/GameMenuBar.hpp"
"soh/GameMenuBar.cpp"
"soh/UIWidgets.hpp"
"soh/UIWidgets.cpp"
)
source_group("Source Files\\soh" FILES ${Source_Files__soh})
@ -277,7 +281,6 @@ set(Source_Files__soh__Enhancements__debugger
"soh/Enhancements/debugger/colViewer.cpp"
"soh/Enhancements/debugger/debugger.cpp"
"soh/Enhancements/debugger/debugSaveEditor.cpp"
"soh/Enhancements/debugger/ImGuiHelpers.cpp"
)
source_group("Source Files\\soh\\Enhancements\\debugger" FILES ${Source_Files__soh__Enhancements__debugger})
@ -1669,14 +1672,13 @@ set(SDL2-INCLUDE ${SDL2_INCLUDE_DIRS})
target_include_directories(${PROJECT_NAME} PRIVATE assets
${CMAKE_CURRENT_SOURCE_DIR}/include/
${CMAKE_CURRENT_SOURCE_DIR}/src/
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/libjpeg/include/
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/spdlog/include/
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/Fast3D/U64/PR
${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/Fast3D/U64
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/Fast3D/U64/PR
${SDL2-INCLUDE}
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/
${CMAKE_CURRENT_SOURCE_DIR}/assets/
.
)

@ -6,7 +6,7 @@
#include "macros.h"
#include "soh/OTRGlobals.h"
#include "soh/Enhancements/gameconsole.h"
#include "Cvar.h"
#include <libultraship/Cvar.h>

@ -1,7 +1,7 @@
#ifndef MACROS_H
#define MACROS_H
#include "endianness.h"
#include <libultraship/endianness.h>
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
#define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0]))

@ -26,7 +26,7 @@
#include "z64interface.h"
#include "sequence.h"
#include "sfx.h"
#include "color.h"
#include <libultraship/color.h>
#include "ichain.h"
#include "regs.h"

@ -1,7 +1,7 @@
#ifndef Z64_AUDIO_H
#define Z64_AUDIO_H
#include "endianness.h"
#include <libultraship/endianness.h>
#define MK_CMD(b0,b1,b2,b3) ((((b0) & 0xFF) << 0x18) | (((b1) & 0xFF) << 0x10) | (((b2) & 0xFF) << 0x8) | (((b3) & 0xFF) << 0))
@ -815,7 +815,7 @@ typedef struct {
/* 0x0E */ u8 ttl; // duration after which the DMA can be discarded
} SampleDma; // size = 0x10
#include <PR/ultra64/abi.h>
#include <ultra64/abi.h>
typedef struct {
/* 0x0000 */ char unk_0000;
@ -1122,4 +1122,4 @@ float Audio_GetGameVolume(int player_id);
#ifdef __cplusplus
}
#endif
#endif
#endif

@ -1,7 +1,7 @@
#ifndef Z64EFFECT_H
#define Z64EFFECT_H
#include "color.h"
#include <libultraship/color.h>
struct GraphicsContext;
struct GlobalContext;

@ -4,7 +4,7 @@
#include "ultra64.h"
#include "ultra64/gbi.h"
#include "z64math.h"
#include "color.h"
#include <libultraship/color.h>
typedef struct {
/* 0x0 */ s16 x;

@ -2,7 +2,7 @@
#define Z64TRANSITION_H
#include "ultra64.h"
#include "color.h"
#include <libultraship/color.h>
typedef struct {
f32 unk_0;

@ -6,12 +6,14 @@
#include <utility>
#include <iterator>
#include "Lib/ImGui/imgui.h"
#include "Lib/ImGui/imgui_internal.h"
#include "Cvar.h"
#include "UltraController.h"
#include "Utils/StringHelper.h"
#include "../libultraship/ImGuiImpl.h"
#include <ImGui/imgui.h>
#include <ImGui/imgui_internal.h>
#include <libultraship/Cvar.h>
#include <libultraship/UltraController.h>
#include <Utils/StringHelper.h>
#include <libultraship/ImGuiImpl.h>
#include "../../UIWidgets.hpp"
namespace GameControlEditor {
const ImGuiTableFlags PANEL_TABLE_FLAGS =
@ -50,7 +52,11 @@ namespace GameControlEditor {
// place the ? button to the most of the right side of the cell it is using.
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 15);
ImGui::SmallButton("?");
SohImGui::Tooltip(helptext.c_str());
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("%s", helptext.c_str());
}
if (sameline) {
//I do not use ImGui::SameLine(); because it make some element vanish.
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 22);
@ -119,7 +125,7 @@ namespace GameControlEditor {
preview = "Unknown";
}
SohImGui::InsertPadding();
UIWidgets::Spacer(0);
ImVec2 cursorPos = ImGui::GetCursorPos();
ImVec2 textSize = ImGui::CalcTextSize(mapping.label);
ImGui::SetCursorPosY(cursorPos.y + textSize.y / 4);
@ -140,7 +146,7 @@ namespace GameControlEditor {
}
ImGui::EndCombo();
}
SohImGui::InsertPadding();
UIWidgets::Spacer(0);
}
void DrawOcarinaControlPanel() {
@ -157,7 +163,7 @@ namespace GameControlEditor {
ImVec2 cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
SohImGui::EnhancementCheckbox("Customize Ocarina Controls", "gCustomOcarinaControls");
UIWidgets::EnhancementCheckbox("Customize Ocarina Controls", "gCustomOcarinaControls");
if (CVar_GetS32("gCustomOcarinaControls", 0) == 1) {
if (ImGui::BeginTable("tableCustomMainOcarinaControls", 2, ImGuiTableFlags_SizingStretchProp)) {
@ -194,10 +200,10 @@ namespace GameControlEditor {
ImGui::EndTable();
}
} else {
SohImGui::InsertPadding();
UIWidgets::Spacer(0);
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
ImGui::TextWrapped("To modify the main ocarina controls, select the \"Customize Ocarina Controls\" checkbox.");
SohImGui::InsertPadding();
UIWidgets::Spacer(0);
}
SohImGui::BeginGroupPanel("Alternate controls", ImGui::GetContentRegionAvail());
@ -206,9 +212,9 @@ namespace GameControlEditor {
ImGui::TableSetupColumn("Right stick", PANEL_TABLE_COLUMN_FLAGS);
TableHelper::InitHeader(false);
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
SohImGui::EnhancementCheckbox("Play with D-pad", "gDpadOcarina");
UIWidgets::EnhancementCheckbox("Play with D-pad", "gDpadOcarina");
TableHelper::NextCol();
SohImGui::EnhancementCheckbox("Play with camera stick", "gRStickOcarina");
UIWidgets::EnhancementCheckbox("Play with camera stick", "gRStickOcarina");
ImGui::EndTable();
}
SohImGui::EndGroupPanel();
@ -223,17 +229,17 @@ namespace GameControlEditor {
ImVec2 cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
SohImGui::PaddedEnhancementCheckbox("Invert Camera X Axis", "gInvertXAxis");
SohImGui::Tooltip("Inverts the Camera X Axis in:\n-Free camera\n-C-Up view\n-Weapon Aiming");
UIWidgets::PaddedEnhancementCheckbox("Invert Camera X Axis", "gInvertXAxis");
UIWidgets::Tooltip("Inverts the Camera X Axis in:\n-Free camera\n-C-Up view\n-Weapon Aiming");
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
SohImGui::PaddedEnhancementCheckbox("Invert Camera Y Axis", "gInvertYAxis");
SohImGui::Tooltip("Inverts the Camera Y Axis in:\n-Free camera\n-C-Up view\n-Weapon Aiming");
UIWidgets::PaddedEnhancementCheckbox("Invert Camera Y Axis", "gInvertYAxis");
UIWidgets::Tooltip("Inverts the Camera Y Axis in:\n-Free camera\n-C-Up view\n-Weapon Aiming");
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
SohImGui::PaddedEnhancementCheckbox("Right Stick Aiming", "gRightStickAiming");
SohImGui::Tooltip("Allows for aiming with the rights stick when:\n-Aiming in the C-Up view\n-Aiming with weapons");
UIWidgets::PaddedEnhancementCheckbox("Right Stick Aiming", "gRightStickAiming");
UIWidgets::Tooltip("Allows for aiming with the rights stick when:\n-Aiming in the C-Up view\n-Aiming with weapons");
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
SohImGui::PaddedEnhancementCheckbox("Auto-Center First Person View", "gAutoCenterView");
SohImGui::Tooltip("Prevents the C-Up view from auto-centering, allowing for Gyro Aiming");
UIWidgets::PaddedEnhancementCheckbox("Auto-Center First Person View", "gAutoCenterView");
UIWidgets::Tooltip("Prevents the C-Up view from auto-centering, allowing for Gyro Aiming");
}
void DrawUI(bool& open) {

@ -1,11 +1,13 @@
#include "CosmeticsEditor.h"
#include "../libultraship/ImGuiImpl.h"
#include <libultraship/ImGuiImpl.h>
#include <string>
#include <Cvar.h>
#include <libultraship/Cvar.h>
#include <random>
#include <algorithm>
#include <PR/ultra64/types.h>
#include <ultra64/types.h>
#include "../../UIWidgets.hpp"
const char* RainbowColorCvarList[] = {
//This is the list of possible CVars that has rainbow effect.
@ -51,9 +53,9 @@ void GetRandomColorRGB(CosmeticsColorSection* ColorSection, int SectionSize){
std::string cvarName = Element->CvarName;
std::string Cvar_RBM = cvarName + "RBM";
colors = RANDOMIZE_32(255);
NewColors.r = SohImGui::ClampFloatToInt(colors.x * 255, 0, 255);
NewColors.g = SohImGui::ClampFloatToInt(colors.y * 255, 0, 255);
NewColors.b = SohImGui::ClampFloatToInt(colors.z * 255, 0, 255);
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);
Element->ModifiedColor = colors;
CVar_SetRGBA(cvarName.c_str(), NewColors);
CVar_SetS32(Cvar_RBM.c_str(), 0);
@ -149,9 +151,9 @@ void LoadRainbowColor(bool& open) {
case 6: NewColor.x = 255; NewColor.y = 0; NewColor.z = a; break;
}
Color_RGBA8 NewColorRGB = {
SohImGui::ClampFloatToInt(NewColor.x, 0, 255),
SohImGui::ClampFloatToInt(NewColor.y, 0, 255),
SohImGui::ClampFloatToInt(NewColor.z, 0, 255),
fmin(fmax(NewColor.x, 0), 255),
fmin(fmax(NewColor.y, 0), 255),
fmin(fmax(NewColor.z, 0), 255),
255
};
if (CVar_GetS32(Cvar_RBM.c_str(), 0) != 0) {
@ -187,7 +189,7 @@ void Draw_HelpIcon(const std::string& helptext, bool sameline = true, int Pos =
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x-60);
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 15);
ImGui::SmallButton("?");
SohImGui::Tooltip(helptext.c_str());
UIWidgets::Tooltip(helptext.c_str());
if (sameline) {
//I do not use ImGui::SameLine(); because it make some element vanish.
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 22);
@ -197,96 +199,96 @@ void Draw_HelpIcon(const std::string& helptext, bool sameline = true, int Pos =
void DrawUseMarginsSlider(const std::string ElementName, const std::string CvarName){
std::string CvarLabel = CvarName + "UseMargins";
std::string Label = ElementName + " use margins";
SohImGui::EnhancementCheckbox(Label.c_str(), CvarLabel.c_str());
SohImGui::Tooltip("Using this allow you move the element with General margins sliders");
UIWidgets::EnhancementCheckbox(Label.c_str(), CvarLabel.c_str());
UIWidgets::Tooltip("Using this allow you move the element with General margins sliders");
}
void DrawPositionsRadioBoxes(const std::string CvarName, bool NoAnchorEnabled = true){
std::string CvarLabel = CvarName + "PosType";
SohImGui::EnhancementRadioButton("Original position", CvarLabel.c_str(), 0);
SohImGui::Tooltip("This will use original intended elements position");
SohImGui::EnhancementRadioButton("Anchor to the left", CvarLabel.c_str(), 1);
SohImGui::Tooltip("This will make your elements follow the left side of your game window");
SohImGui::EnhancementRadioButton("Anchor to the right", CvarLabel.c_str(), 2);
SohImGui::Tooltip("This will make your elements follow the right side of your game window");
UIWidgets::EnhancementRadioButton("Original position", CvarLabel.c_str(), 0);
UIWidgets::Tooltip("This will use original intended elements position");
UIWidgets::EnhancementRadioButton("Anchor to the left", CvarLabel.c_str(), 1);
UIWidgets::Tooltip("This will make your elements follow the left side of your game window");
UIWidgets::EnhancementRadioButton("Anchor to the right", CvarLabel.c_str(), 2);
UIWidgets::Tooltip("This will make your elements follow the right side of your game window");
if (NoAnchorEnabled) {
SohImGui::EnhancementRadioButton("No anchors", CvarLabel.c_str(), 3);
SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements");
UIWidgets::EnhancementRadioButton("No anchors", CvarLabel.c_str(), 3);
UIWidgets::Tooltip("This will make your elements to not follow any side\nBetter used for center elements");
}
SohImGui::EnhancementRadioButton("Hidden", CvarLabel.c_str(), 4);
SohImGui::Tooltip("This will make your elements hidden");
UIWidgets::EnhancementRadioButton("Hidden", CvarLabel.c_str(), 4);
UIWidgets::Tooltip("This will make your elements hidden");
}
void DrawTransitions(const std::string CvarName){
SohImGui::EnhancementRadioButton("Really slow fade (white)", CvarName.c_str(), 8);
UIWidgets::EnhancementRadioButton("Really slow fade (white)", CvarName.c_str(), 8);
Table_NextCol();
SohImGui::EnhancementRadioButton("Really slow fade (black)", CvarName.c_str(), 7);
UIWidgets::EnhancementRadioButton("Really slow fade (black)", CvarName.c_str(), 7);
Table_NextLine();
SohImGui::EnhancementRadioButton("Slow fade (white)", CvarName.c_str(), 10);
UIWidgets::EnhancementRadioButton("Slow fade (white)", CvarName.c_str(), 10);
Table_NextCol();
SohImGui::EnhancementRadioButton("Slow fade (black)", CvarName.c_str(), 9);
UIWidgets::EnhancementRadioButton("Slow fade (black)", CvarName.c_str(), 9);
Table_NextLine();
SohImGui::EnhancementRadioButton("Normal fade (white)", CvarName.c_str(), 3);
UIWidgets::EnhancementRadioButton("Normal fade (white)", CvarName.c_str(), 3);
Table_NextCol();
SohImGui::EnhancementRadioButton("Normal fade (black)", CvarName.c_str(), 2);
UIWidgets::EnhancementRadioButton("Normal fade (black)", CvarName.c_str(), 2);
Table_NextLine();
SohImGui::EnhancementRadioButton("Fast fade (white)", CvarName.c_str(), 5);
UIWidgets::EnhancementRadioButton("Fast fade (white)", CvarName.c_str(), 5);
Table_NextCol();
SohImGui::EnhancementRadioButton("Fast fade (black)", CvarName.c_str(), 4);
UIWidgets::EnhancementRadioButton("Fast fade (black)", CvarName.c_str(), 4);
Table_NextLine();
SohImGui::EnhancementRadioButton("Fast circle (white)", CvarName.c_str(), 40);
UIWidgets::EnhancementRadioButton("Fast circle (white)", CvarName.c_str(), 40);
Table_NextCol();
SohImGui::EnhancementRadioButton("Normal circle (black)", CvarName.c_str(), 32);
UIWidgets::EnhancementRadioButton("Normal circle (black)", CvarName.c_str(), 32);
Table_NextLine();
SohImGui::EnhancementRadioButton("Slow circle (white)", CvarName.c_str(), 41);
UIWidgets::EnhancementRadioButton("Slow circle (white)", CvarName.c_str(), 41);
Table_NextCol();
SohImGui::EnhancementRadioButton("Slow circle (black)", CvarName.c_str(), 33);
UIWidgets::EnhancementRadioButton("Slow circle (black)", CvarName.c_str(), 33);
Table_NextLine();
SohImGui::EnhancementRadioButton("Fast noise circle (white)", CvarName.c_str(), 42);
UIWidgets::EnhancementRadioButton("Fast noise circle (white)", CvarName.c_str(), 42);
Table_NextCol();
SohImGui::EnhancementRadioButton("Fast noise circle (black)", CvarName.c_str(), 34);
UIWidgets::EnhancementRadioButton("Fast noise circle (black)", CvarName.c_str(), 34);
Table_NextLine();
SohImGui::EnhancementRadioButton("Slow noise circle (white)", CvarName.c_str(), 43);
UIWidgets::EnhancementRadioButton("Slow noise circle (white)", CvarName.c_str(), 43);
Table_NextCol();
SohImGui::EnhancementRadioButton("Slow noise circle (black)", CvarName.c_str(), 35);
UIWidgets::EnhancementRadioButton("Slow noise circle (black)", CvarName.c_str(), 35);
Table_NextLine();
SohImGui::EnhancementRadioButton("Normal waves circle (white)", CvarName.c_str(), 44);
UIWidgets::EnhancementRadioButton("Normal waves circle (white)", CvarName.c_str(), 44);
Table_NextCol();
SohImGui::EnhancementRadioButton("Normal waves circle (black)", CvarName.c_str(), 36);
UIWidgets::EnhancementRadioButton("Normal waves circle (black)", CvarName.c_str(), 36);
Table_NextLine();
SohImGui::EnhancementRadioButton("Slow waves circle (white)", CvarName.c_str(), 45);
UIWidgets::EnhancementRadioButton("Slow waves circle (white)", CvarName.c_str(), 45);
Table_NextCol();
SohImGui::EnhancementRadioButton("Slow waves circle (black)", CvarName.c_str(), 37);
UIWidgets::EnhancementRadioButton("Slow waves circle (black)", CvarName.c_str(), 37);
Table_NextLine();
SohImGui::EnhancementRadioButton("Normal close circle (white)", CvarName.c_str(), 46);
UIWidgets::EnhancementRadioButton("Normal close circle (white)", CvarName.c_str(), 46);
Table_NextCol();
SohImGui::EnhancementRadioButton("Normal close circle (black)", CvarName.c_str(), 38);
UIWidgets::EnhancementRadioButton("Normal close circle (black)", CvarName.c_str(), 38);
Table_NextLine();
SohImGui::EnhancementRadioButton("Slow close circle (white)", CvarName.c_str(), 47);
UIWidgets::EnhancementRadioButton("Slow close circle (white)", CvarName.c_str(), 47);
Table_NextCol();
SohImGui::EnhancementRadioButton("Slow close circle (black)", CvarName.c_str(), 39);
UIWidgets::EnhancementRadioButton("Slow close circle (black)", CvarName.c_str(), 39);
Table_NextLine();
SohImGui::EnhancementRadioButton("Super fast circle (white)", CvarName.c_str(), 56);
UIWidgets::EnhancementRadioButton("Super fast circle (white)", CvarName.c_str(), 56);
Table_NextCol();
SohImGui::EnhancementRadioButton("Super fast circle (black)", CvarName.c_str(), 58);
UIWidgets::EnhancementRadioButton("Super fast circle (black)", CvarName.c_str(), 58);
Table_NextLine();
SohImGui::EnhancementRadioButton("Super fast noise circle (white)", CvarName.c_str(), 57);
UIWidgets::EnhancementRadioButton("Super fast noise circle (white)", CvarName.c_str(), 57);
Table_NextCol();
SohImGui::EnhancementRadioButton("Super fast noise circle (black)", CvarName.c_str(), 59);
UIWidgets::EnhancementRadioButton("Super fast noise circle (black)", CvarName.c_str(), 59);
}
void DrawPositionSlider(const std::string CvarName, int MinY, int MaxY, int MinX, int MaxX){
std::string PosXCvar = CvarName+"PosX";
std::string PosYCvar = CvarName+"PosY";
std::string InvisibleLabelX = "##"+PosXCvar;
std::string InvisibleLabelY = "##"+PosYCvar;
SohImGui::EnhancementSliderInt("Up <-> Down : %d", InvisibleLabelY.c_str(), PosYCvar.c_str(), MinY, MaxY, "", 0, true);
SohImGui::Tooltip("This slider is used to move Up and Down your elements.");
SohImGui::EnhancementSliderInt("Left <-> Right : %d", InvisibleLabelX.c_str(), PosXCvar.c_str(), MinX, MaxX, "", 0, true);
SohImGui::Tooltip("This slider is used to move Left and Right your elements.");
UIWidgets::EnhancementSliderInt("Up <-> Down : %d", InvisibleLabelY.c_str(), PosYCvar.c_str(), MinY, MaxY, "", 0, true);
UIWidgets::Tooltip("This slider is used to move Up and Down your elements.");
UIWidgets::EnhancementSliderInt("Left <-> Right : %d", InvisibleLabelX.c_str(), PosXCvar.c_str(), MinX, MaxX, "", 0, true);
UIWidgets::Tooltip("This slider is used to move Left and Right your elements.");
}
void DrawScaleSlider(const std::string CvarName,float DefaultValue){
std::string InvisibleLabel = "##"+CvarName;
std::string CvarLabel = CvarName+"Scale";
//Disabled for now. feature not done and several fixes needed to be merged.
//SohImGui::EnhancementSliderFloat("Scale : %dx", InvisibleLabel.c_str(), CvarLabel.c_str(), 0.1f, 3.0f,"",DefaultValue,true,true);
//UIWidgets::EnhancementSliderFloat("Scale : %dx", InvisibleLabel.c_str(), CvarLabel.c_str(), 0.1f, 3.0f,"",DefaultValue,true,true);
}
void DrawColorSection(CosmeticsColorSection* ColorSection, int SectionSize) {
for (s16 i = 0; i < SectionSize; i++) {
@ -308,7 +310,7 @@ void DrawColorSection(CosmeticsColorSection* ColorSection, int SectionSize) {
Table_NextLine();
}
Draw_HelpIcon(Tooltip.c_str());
SohImGui::EnhancementColor(Name.c_str(), Cvar.c_str(), ModifiedColor, DefaultColor, canRainbow, hasAlpha, sameLine);
UIWidgets::EnhancementColor(Name.c_str(), Cvar.c_str(), ModifiedColor, DefaultColor, canRainbow, hasAlpha, sameLine);
}
}
void DrawRandomizeResetButton(const std::string Identifier, CosmeticsColorSection* ColorSection, int SectionSize, bool isAllCosmetics = false){
@ -335,21 +337,21 @@ void DrawRandomizeResetButton(const std::string Identifier, CosmeticsColorSectio
CVar_SetS32("gCCparated", 1);
GetRandomColorRGB(ColorSection, SectionSize);
}
SohImGui::Tooltip(Tooltip_RNG.c_str());
UIWidgets::Tooltip(Tooltip_RNG.c_str());
Table_NextCol();
if(ImGui::Button(Reset_BtnText.c_str(), ImVec2( ImGui::GetContentRegionAvail().x, 20.0f))){
GetDefaultColorRGB(ColorSection, SectionSize);
}
SohImGui::Tooltip("Enable/Disable custom Link's tunics colors\nIf disabled you will have original colors for Link's tunics.");
SohImGui::Tooltip(Tooltip_RNG.c_str());
UIWidgets::Tooltip("Enable/Disable custom Link's tunics colors\nIf disabled you will have original colors for Link's tunics.");
UIWidgets::Tooltip(Tooltip_RNG.c_str());
ImGui::EndTable();
}
}
void Draw_Npcs(){
DrawRandomizeResetButton("all NPCs", NPCs_section, SECTION_SIZE(NPCs_section));
SohImGui::EnhancementCheckbox("Custom colors for Navi", "gUseNaviCol");
SohImGui::Tooltip("Enable/Disable custom Navi colors\nIf disabled, default colors will be used\nColors go into effect when Navi goes back into your pockets");
UIWidgets::EnhancementCheckbox("Custom colors for Navi", "gUseNaviCol");
UIWidgets::Tooltip("Enable/Disable custom Navi colors\nIf disabled, default colors will be used\nColors go into effect when Navi goes back into your pockets");
if (CVar_GetS32("gUseNaviCol",0)) {
DrawRandomizeResetButton("Navi's", Navi_Section, SECTION_SIZE(Navi_Section));
};
@ -360,8 +362,8 @@ void Draw_Npcs(){
DrawColorSection(Navi_Section, SECTION_SIZE(Navi_Section));
ImGui::EndTable();
}
SohImGui::EnhancementCheckbox("Custom colors for Keese", "gUseKeeseCol");
SohImGui::Tooltip("Enable/Disable custom Keese element colors\nIf disabled, default element colors will be used\nColors go into effect when Keese respawn (or when the room is reloaded)");
UIWidgets::EnhancementCheckbox("Custom colors for Keese", "gUseKeeseCol");
UIWidgets::Tooltip("Enable/Disable custom Keese element colors\nIf disabled, default element colors will be used\nColors go into effect when Keese respawn (or when the room is reloaded)");
if (CVar_GetS32("gUseKeeseCol",0) && ImGui::BeginTable("tableKeese", 2, FlagsTable)) {
ImGui::TableSetupColumn("Fire colors##Keese", FlagsCell, TablesCellsWidth/2);
ImGui::TableSetupColumn("Ice colors##Keese", FlagsCell, TablesCellsWidth/2);
@ -369,8 +371,8 @@ void Draw_Npcs(){
DrawColorSection(Keese_Section, SECTION_SIZE(Keese_Section));
ImGui::EndTable();
}
SohImGui::EnhancementCheckbox("Custom colors for Dogs", "gUseDogsCol");
SohImGui::Tooltip("Enable/Disable custom colors for the two Dog variants\nIf disabled, default colors will be used");
UIWidgets::EnhancementCheckbox("Custom colors for Dogs", "gUseDogsCol");
UIWidgets::Tooltip("Enable/Disable custom colors for the two Dog variants\nIf disabled, default colors will be used");
if (CVar_GetS32("gUseDogsCol",0) && ImGui::BeginTable("tableDogs", 2, FlagsTable)) {
ImGui::TableSetupColumn("White Dog color", FlagsCell, TablesCellsWidth/2);
ImGui::TableSetupColumn("Brown Dog color", FlagsCell, TablesCellsWidth/2);
@ -381,8 +383,8 @@ void Draw_Npcs(){
}
void Draw_ItemsSkills(){
DrawRandomizeResetButton("all skills and items", AllItemsSkills_section, SECTION_SIZE(AllItemsSkills_section));
SohImGui::EnhancementCheckbox("Custom tunics color", "gUseTunicsCol");
SohImGui::Tooltip("Enable/Disable custom Link's tunics colors\nIf disabled you will have original colors for Link's tunics.");
UIWidgets::EnhancementCheckbox("Custom tunics color", "gUseTunicsCol");
UIWidgets::Tooltip("Enable/Disable custom Link's tunics colors\nIf disabled you will have original colors for Link's tunics.");
if (CVar_GetS32("gUseTunicsCol",0)) {
DrawRandomizeResetButton("Link's tunics", Tunics_Section, SECTION_SIZE(Tunics_Section));
};
@ -394,7 +396,7 @@ void Draw_ItemsSkills(){
DrawColorSection(Tunics_Section, SECTION_SIZE(Tunics_Section));
ImGui::EndTable();
}
SohImGui::EnhancementCheckbox("Custom arrows colors", "gUseArrowsCol");
UIWidgets::EnhancementCheckbox("Custom arrows colors", "gUseArrowsCol");
if (CVar_GetS32("gUseArrowsCol",0)) {
DrawRandomizeResetButton("elemental arrows", Arrows_section, SECTION_SIZE(Arrows_section));
}
@ -405,7 +407,7 @@ void Draw_ItemsSkills(){
DrawColorSection(Arrows_section, SECTION_SIZE(Arrows_section));
ImGui::EndTable();
}
SohImGui::EnhancementCheckbox("Custom spells colors", "gUseSpellsCol");
UIWidgets::EnhancementCheckbox("Custom spells colors", "gUseSpellsCol");
if (CVar_GetS32("gUseSpellsCol",0)) {
DrawRandomizeResetButton("spells", Spells_section, SECTION_SIZE(Spells_section));
}
@ -416,7 +418,7 @@ void Draw_ItemsSkills(){
DrawColorSection(Spells_section, SECTION_SIZE(Spells_section));
ImGui::EndTable();
}
SohImGui::EnhancementCheckbox("Custom spin attack colors", "gUseChargedCol");
UIWidgets::EnhancementCheckbox("Custom spin attack colors", "gUseChargedCol");
if (CVar_GetS32("gUseChargedCol",0)) {
DrawRandomizeResetButton("spins attack", SpinAtk_section, SECTION_SIZE(SpinAtk_section));
}
@ -427,13 +429,13 @@ void Draw_ItemsSkills(){
DrawColorSection(SpinAtk_section, SECTION_SIZE(SpinAtk_section));
ImGui::EndTable();
}
SohImGui::EnhancementCheckbox("Custom trails color", "gUseTrailsCol");
UIWidgets::EnhancementCheckbox("Custom trails color", "gUseTrailsCol");
if (CVar_GetS32("gUseTrailsCol",0) && ImGui::BeginTable("tabletrails", 1, FlagsTable)) {
ImGui::TableSetupColumn("Custom Trails", FlagsCell, TablesCellsWidth);
Table_InitHeader();
DrawColorSection(Trails_section, SECTION_SIZE(Trails_section));
SohImGui::EnhancementSliderInt("Trails duration: %dx", "##TrailsMul", "gTrailDurantion", 1, 5, "");
SohImGui::Tooltip("The longer the trails the weirder it become");
UIWidgets::EnhancementSliderInt("Trails duration: %dx", "##TrailsMul", "gTrailDurantion", 1, 5, "");
UIWidgets::Tooltip("The longer the trails the weirder it become");
ImGui::NewLine();
ImGui::EndTable();
}
@ -455,18 +457,18 @@ void Draw_Placements(){
if (ImGui::BeginTable("tableMargins", 1, FlagsTable)) {
ImGui::TableSetupColumn("General margins settings", FlagsCell, TablesCellsWidth);
Table_InitHeader();
SohImGui::EnhancementSliderInt("Top : %dx", "##UIMARGINT", "gHUDMargin_T", (ImGui::GetWindowViewport()->Size.y/2)*-1, 25, "", 0, true);
SohImGui::EnhancementSliderInt("Left: %dx", "##UIMARGINL", "gHUDMargin_L", -25, ImGui::GetWindowViewport()->Size.x, "", 0, true);
SohImGui::EnhancementSliderInt("Right: %dx", "##UIMARGINR", "gHUDMargin_R", (ImGui::GetWindowViewport()->Size.x)*-1, 25, "", 0, true);
SohImGui::EnhancementSliderInt("Bottom: %dx", "##UIMARGINB", "gHUDMargin_B", (ImGui::GetWindowViewport()->Size.y/2)*-1, 25, "", 0, true);
UIWidgets::EnhancementSliderInt("Top : %dx", "##UIMARGINT", "gHUDMargin_T", (ImGui::GetWindowViewport()->Size.y/2)*-1, 25, "", 0, true);
UIWidgets::EnhancementSliderInt("Left: %dx", "##UIMARGINL", "gHUDMargin_L", -25, ImGui::GetWindowViewport()->Size.x, "", 0, true);
UIWidgets::EnhancementSliderInt("Right: %dx", "##UIMARGINR", "gHUDMargin_R", (ImGui::GetWindowViewport()->Size.x)*-1, 25, "", 0, true);
UIWidgets::EnhancementSliderInt("Bottom: %dx", "##UIMARGINB", "gHUDMargin_B", (ImGui::GetWindowViewport()->Size.y/2)*-1, 25, "", 0, true);
SetMarginAll("All margins on",true);
SohImGui::Tooltip("Set most of the element to use margin\nSome elements with default position will not be affected\nElements without Archor or Hidden will not be turned on");
UIWidgets::Tooltip("Set most of the element to use margin\nSome elements with default position will not be affected\nElements without Archor or Hidden will not be turned on");
ImGui::SameLine();
SetMarginAll("All margins off",false);
SohImGui::Tooltip("Set all of the element to not use margin");
UIWidgets::Tooltip("Set all of the element to not use margin");
ImGui::SameLine();
ResetPositionAll();
SohImGui::Tooltip("Revert every element to use their original position and no margins");
UIWidgets::Tooltip("Revert every element to use their original position and no margins");
ImGui::NewLine();
ImGui::EndTable();
}
@ -775,7 +777,7 @@ void Draw_HUDButtons(){
DrawColorSection(C_Btn_Unified_section, SECTION_SIZE(C_Btn_Unified_section));
ImGui::EndTable();
}
SohImGui::EnhancementCheckbox("C-Buttons use separate colors", "gCCparated");
UIWidgets::EnhancementCheckbox("C-Buttons use separate colors", "gCCparated");
if (CVar_GetS32("gCCparated",0) && ImGui::CollapsingHeader("C Button individual colors")) {
if (ImGui::BeginTable("tableBTN_CSep", 1, FlagsTable)) {
ImGui::TableSetupColumn("C-Buttons individual colors", FlagsCell, TablesCellsWidth);
@ -813,19 +815,19 @@ void Draw_General(){
ImGui::TableSetupColumn("Custom Schemes", FlagsCell, TablesCellsWidth);
Table_InitHeader();
Draw_HelpIcon("Change interface color to N64 style");
SohImGui::EnhancementRadioButton("N64 Colors", "gHudColors", 0);
UIWidgets::EnhancementRadioButton("N64 Colors", "gHudColors", 0);
Table_NextCol();
Draw_HelpIcon("Change interface color to GameCube style");
SohImGui::EnhancementRadioButton("GCN Colors", "gHudColors", 1);
UIWidgets::EnhancementRadioButton("GCN Colors", "gHudColors", 1);
Table_NextCol();
Draw_HelpIcon("Lets you change every interface color to your liking");
SohImGui::EnhancementRadioButton("Custom Colors", "gHudColors", 2);
UIWidgets::EnhancementRadioButton("Custom Colors", "gHudColors", 2);
ImGui::EndTable();
}
if (CVar_GetS32("gHudColors",0) ==2 ){
DrawRandomizeResetButton("interface (excluding buttons)", Misc_Interface_section, SECTION_SIZE(Misc_Interface_section));
if (ImGui::CollapsingHeader("Hearts colors")) {
SohImGui::Tooltip("Hearts colors in general\nDD stand for Double Defense");
UIWidgets::Tooltip("Hearts colors in general\nDD stand for Double Defense");
if (ImGui::BeginTable("tableHearts", 3, FlagsTable | ImGuiTableFlags_Hideable)) {
ImGui::TableSetupColumn("Hearts (normal)", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable, TablesCellsWidth/3);
ImGui::TableSetupColumn("Hearts (DD)", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable, TablesCellsWidth/3);
@ -874,25 +876,25 @@ void Draw_General(){
ImGui::TableSetupColumn("transitionother1", FlagsCell, TablesCellsWidth/2);
ImGui::TableSetupColumn("transitionother2", FlagsCell, TablesCellsWidth/2);
Table_InitHeader(false);
SohImGui::EnhancementRadioButton("Originals", "gSceneTransitions", 255);
SohImGui::Tooltip("This will make the game use original scenes transitions");
UIWidgets::EnhancementRadioButton("Originals", "gSceneTransitions", 255);
UIWidgets::Tooltip("This will make the game use original scenes transitions");
Table_NextCol();
SohImGui::EnhancementRadioButton("None", "gSceneTransitions", 11);
SohImGui::Tooltip("This will make the game use no any scenes transitions");
UIWidgets::EnhancementRadioButton("None", "gSceneTransitions", 11);
UIWidgets::Tooltip("This will make the game use no any scenes transitions");
Table_NextLine();
SohImGui::EnhancementRadioButton("Desert mode (persistant)", "gSceneTransitions", 14);
SohImGui::Tooltip("This will make the game use the sand storm scenes transitions that will persist in map");
UIWidgets::EnhancementRadioButton("Desert mode (persistant)", "gSceneTransitions", 14);
UIWidgets::Tooltip("This will make the game use the sand storm scenes transitions that will persist in map");
Table_NextCol();
SohImGui::EnhancementRadioButton("Desert mode (non persistant)", "gSceneTransitions", 15);
SohImGui::Tooltip("This will make the game use the sand storm scenes transitions");
UIWidgets::EnhancementRadioButton("Desert mode (non persistant)", "gSceneTransitions", 15);
UIWidgets::Tooltip("This will make the game use the sand storm scenes transitions");
Table_NextLine();
SohImGui::EnhancementRadioButton("Normal fade (green)", "gSceneTransitions", 18);
SohImGui::Tooltip("This will make the game use a greenish fade in/out scenes transitions");
UIWidgets::EnhancementRadioButton("Normal fade (green)", "gSceneTransitions", 18);
UIWidgets::Tooltip("This will make the game use a greenish fade in/out scenes transitions");
Table_NextCol();
SohImGui::EnhancementRadioButton("Normal fade (blue)", "gSceneTransitions", 19);
SohImGui::Tooltip("This will make the game use a blue fade in/out scenes transitions");
UIWidgets::EnhancementRadioButton("Normal fade (blue)", "gSceneTransitions", 19);
UIWidgets::Tooltip("This will make the game use a blue fade in/out scenes transitions");
Table_NextLine();
SohImGui::EnhancementRadioButton("Triforce", "gSceneTransitions", 1);
UIWidgets::EnhancementRadioButton("Triforce", "gSceneTransitions", 1);
ImGui::EndTable();
}
if (ImGui::BeginTable("tabletransitionCol", 2, FlagsTable | ImGuiTableFlags_Hideable)) {
@ -948,6 +950,7 @@ 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
@ -955,4 +958,4 @@ void InitCosmeticsEditor() {
SohImGui::AddWindow("Enhancements", "Rainbowfunction", LoadRainbowColor, true, true);
//Draw the bar in the menu.
SohImGui::AddWindow("Enhancements", "Cosmetics Editor", DrawCosmeticsEditor);
}
}

@ -1,5 +1,5 @@
#pragma once
#include "../libultraship/ImGuiImpl.h"
#include <libultraship/ImGuiImpl.h>
#define SECTION_SIZE(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
#define RANDOMIZE_32(Max) GetRandomValue(Max);
#define CATEGORY_NPC 0
@ -405,4 +405,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);
void NewSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0);

@ -1,7 +1,7 @@
#include "debugconsole.h"
#include "../libultraship/ImGuiImpl.h"
#include <libultraship/ImGuiImpl.h>
#include "savestates.h"
#include "Console.h"
#include <libultraship/Console.h>
#include <vector>
#include <string>
@ -12,8 +12,8 @@
#define PATH_HACK
#include <Utils/StringHelper.h>
#include "Window.h"
#include "Lib/ImGui/imgui_internal.h"
#include <libultraship/Window.h>
#include <ImGui/imgui_internal.h>
#undef PATH_HACK
#undef Path
@ -25,18 +25,18 @@ extern "C" {
extern GlobalContext* gGlobalCtx;
}
#include "Cvar.h"
#include <libultraship/Cvar.h>
#define CMD_REGISTER SohImGui::BindCmd
#define CMD_REGISTER SohImGui::GetConsole()->AddCommand
static bool ActorSpawnHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if ((args.size() != 9) && (args.size() != 3) && (args.size() != 6)) {
SohImGui::console->SendErrorMessage("Not enough arguments passed to actorspawn");
SohImGui::GetConsole()->SendErrorMessage("Not enough arguments passed to actorspawn");
return CMD_FAILED;
}
if (gGlobalCtx == nullptr) {
SohImGui::console->SendErrorMessage("GlobalCtx == nullptr");
SohImGui::GetConsole()->SendErrorMessage("GlobalCtx == nullptr");
return CMD_FAILED;
}
@ -72,7 +72,7 @@ static bool ActorSpawnHandler(std::shared_ptr<Ship::Console> Console, const std:
if (Actor_Spawn(&gGlobalCtx->actorCtx, gGlobalCtx, actorId, spawnPoint.pos.x, spawnPoint.pos.y, spawnPoint.pos.z,
spawnPoint.rot.x, spawnPoint.rot.y, spawnPoint.rot.z, params) == NULL) {
SohImGui::console->SendErrorMessage("Failed to spawn actor. Actor_Spawn returned NULL");
SohImGui::GetConsole()->SendErrorMessage("Failed to spawn actor. Actor_Spawn returned NULL");
return CMD_FAILED;
}
return CMD_SUCCESS;
@ -81,13 +81,13 @@ static bool ActorSpawnHandler(std::shared_ptr<Ship::Console> Console, const std:
static bool KillPlayerHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>&) {
gSaveContext.health = 0;
SohImGui::console->SendInfoMessage("[SOH] You've met with a terrible fate, haven't you?");
SohImGui::GetConsole()->SendInfoMessage("[SOH] You've met with a terrible fate, haven't you?");
return CMD_SUCCESS;
}
static bool SetPlayerHealthHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() != 2) {
SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed");
SohImGui::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed");
return CMD_FAILED;
}
@ -96,18 +96,18 @@ static bool SetPlayerHealthHandler(std::shared_ptr<Ship::Console> Console, const
try {
health = std::stoi(args[1]);
} catch (std::invalid_argument const& ex) {
SohImGui::console->SendErrorMessage("[SOH] Health value must be an integer.");
SohImGui::GetConsole()->SendErrorMessage("[SOH] Health value must be an integer.");
return CMD_FAILED;
}
if (health < 0) {
SohImGui::console->SendErrorMessage("[SOH] Health value must be a positive integer");
SohImGui::GetConsole()->SendErrorMessage("[SOH] Health value must be a positive integer");
return CMD_SUCCESS;
}
gSaveContext.health = health * 0x10;
SohImGui::console->SendInfoMessage("[SOH] Player health updated to %d", health);
SohImGui::GetConsole()->SendInfoMessage("[SOH] Player health updated to %d", health);
return CMD_SUCCESS;
}
@ -129,31 +129,31 @@ static bool RuppeHandler(std::shared_ptr<Ship::Console> Console, const std::vect
rupeeAmount = std::stoi(args[1]);
}
catch (std::invalid_argument const& ex) {
SohImGui::console->SendErrorMessage("[SOH] Rupee count must be an integer.");
SohImGui::GetConsole()->SendErrorMessage("[SOH] Rupee count must be an integer.");
return CMD_FAILED;
}
if (rupeeAmount < 0) {
SohImGui::console->SendErrorMessage("[SOH] Rupee count must be positive");
SohImGui::GetConsole()->SendErrorMessage("[SOH] Rupee count must be positive");
return CMD_FAILED;
}
gSaveContext.rupees = rupeeAmount;
SohImGui::console->SendInfoMessage("Set rupee count to %u", rupeeAmount);
SohImGui::GetConsole()->SendInfoMessage("Set rupee count to %u", rupeeAmount);
return CMD_SUCCESS;
}
static bool SetPosHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string> args) {
if (gGlobalCtx == nullptr) {
SohImGui::console->SendErrorMessage("GlobalCtx == nullptr");
SohImGui::GetConsole()->SendErrorMessage("GlobalCtx == nullptr");
return CMD_FAILED;
}
Player* player = GET_PLAYER(gGlobalCtx);
if (args.size() == 1) {
SohImGui::console->SendInfoMessage("Player position is [ %.2f, %.2f, %.2f ]", player->actor.world.pos.x,
SohImGui::GetConsole()->SendInfoMessage("Player position is [ %.2f, %.2f, %.2f ]", player->actor.world.pos.x,
player->actor.world.pos.y,
player->actor.world.pos.z);
return CMD_SUCCESS;
@ -165,7 +165,7 @@ static bool SetPosHandler(std::shared_ptr<Ship::Console> Console, const std::vec
player->actor.world.pos.y = std::stof(args[2]);
player->actor.world.pos.z = std::stof(args[3]);
SohImGui::console->SendInfoMessage("Set player position to [ %.2f, %.2f, %.2f ]", player->actor.world.pos.x,
SohImGui::GetConsole()->SendInfoMessage("Set player position to [ %.2f, %.2f, %.2f ]", player->actor.world.pos.x,
player->actor.world.pos.y,
player->actor.world.pos.z);
return CMD_SUCCESS;
@ -173,7 +173,7 @@ static bool SetPosHandler(std::shared_ptr<Ship::Console> Console, const std::vec
static bool ResetHandler(std::shared_ptr<Ship::Console> Console, std::vector<std::string> args) {
if (gGlobalCtx == nullptr) {
SohImGui::console->SendErrorMessage("GlobalCtx == nullptr");
SohImGui::GetConsole()->SendErrorMessage("GlobalCtx == nullptr");
return CMD_FAILED;
}
@ -194,7 +194,7 @@ const static std::map<std::string, uint16_t> ammoItems{
static bool AmmoHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() != 3) {
SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed");
SohImGui::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed");
return CMD_FAILED;
}
@ -203,19 +203,19 @@ static bool AmmoHandler(std::shared_ptr<Ship::Console> Console, const std::vecto
try {
count = std::stoi(args[2]);
} catch (std::invalid_argument const& ex) {
SohImGui::console-