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
This commit is contained in:
David Chavez 2022-09-03 06:00:04 +02:00 committed by GitHub
parent 64aca78450
commit 0ce0ab1260
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 2719 additions and 2552 deletions

View File

@ -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})

View File

@ -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

View File

@ -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

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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}/../ZAPDTR/ZAPDUtils
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/Fast3D/U64
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/Fast3D/U64/PR
${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils
${SDL2-INCLUDE}
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/
${CMAKE_CURRENT_SOURCE_DIR}/assets/
.
)

View File

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

View File

@ -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]))

View File

@ -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"

View File

@ -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;

View File

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

View File

@ -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;

View File

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

View File

@ -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) {

View File

@ -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

View File

@ -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

View File

@ -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->SendErrorMessage("Ammo count must be an integer");
SohImGui::GetConsole()->SendErrorMessage("Ammo count must be an integer");
return CMD_FAILED;
}
if (count < 0) {
SohImGui::console->SendErrorMessage("Ammo count must be positive");
SohImGui::GetConsole()->SendErrorMessage("Ammo count must be positive");
return CMD_FAILED;
}
const auto& it = ammoItems.find(args[1]);
if (it == ammoItems.end()) {
SohImGui::console->SendErrorMessage("Invalid item passed");
SohImGui::GetConsole()->SendErrorMessage("Invalid item passed");
return CMD_FAILED;
}
@ -237,7 +237,7 @@ const static std::map<std::string, uint16_t> bottleItems{
static bool BottleHandler(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;
}
@ -245,19 +245,19 @@ static bool BottleHandler(std::shared_ptr<Ship::Console> Console, const std::vec
try {
slot = std::stoi(args[2]);
} catch (std::invalid_argument const& ex) {
SohImGui::console->SendErrorMessage("[SOH] Bottle slot must be an integer.");
SohImGui::GetConsole()->SendErrorMessage("[SOH] Bottle slot must be an integer.");
return CMD_FAILED;
}
if ((slot < 1) || (slot > 4)) {
SohImGui::console->SendErrorMessage("Invalid slot passed");
SohImGui::GetConsole()->SendErrorMessage("Invalid slot passed");
return CMD_FAILED;
}
const auto& it = bottleItems.find(args[1]);
if (it == bottleItems.end()) {
SohImGui::console->SendErrorMessage("Invalid item passed");
SohImGui::GetConsole()->SendErrorMessage("Invalid item passed");
return CMD_FAILED;
}
@ -269,7 +269,7 @@ static bool BottleHandler(std::shared_ptr<Ship::Console> Console, const std::vec
static bool BHandler(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;
}
@ -279,7 +279,7 @@ static bool BHandler(std::shared_ptr<Ship::Console> Console, const std::vector<s
static bool ItemHandler(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;
}
@ -290,7 +290,7 @@ static bool ItemHandler(std::shared_ptr<Ship::Console> Console, const std::vecto
static bool EntranceHandler(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;
}
@ -299,7 +299,7 @@ static bool EntranceHandler(std::shared_ptr<Ship::Console> Console, const std::v
try {
entrance = std::stoi(args[1], nullptr, 16);
} catch (std::invalid_argument const& ex) {
SohImGui::console->SendErrorMessage("[SOH] Entrance value must be a Hex number.");
SohImGui::GetConsole()->SendErrorMessage("[SOH] Entrance value must be a Hex number.");
return CMD_FAILED;
}
@ -319,7 +319,7 @@ static bool VoidHandler(std::shared_ptr<Ship::Console> Console, const std::vecto
gGlobalCtx->fadeTransition = 2;
gSaveContext.nextTransition = 2;
} else {
SohImGui::console->SendErrorMessage("gGlobalCtx == nullptr");
SohImGui::GetConsole()->SendErrorMessage("gGlobalCtx == nullptr");
return CMD_FAILED;
}
return CMD_SUCCESS;
@ -332,7 +332,7 @@ static bool ReloadHandler(std::shared_ptr<Ship::Console> Console, const std::vec
gGlobalCtx->fadeTransition = 11;
gSaveContext.nextTransition = 11;
} else {
SohImGui::console->SendErrorMessage("gGlobalCtx == nullptr");
SohImGui::GetConsole()->SendErrorMessage("gGlobalCtx == nullptr");
return CMD_FAILED;
}
return CMD_SUCCESS;
@ -345,11 +345,11 @@ static bool FWHandler(std::shared_ptr<Ship::Console> Console, const std::vector<
gGlobalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex;
gGlobalCtx->fadeTransition = 5;
} else {
SohImGui::console->SendErrorMessage("Farore's wind not set!");
SohImGui::GetConsole()->SendErrorMessage("Farore's wind not set!");
}
}
else {
SohImGui::console->SendErrorMessage("gGlobalCtx == nullptr");
SohImGui::GetConsole()->SendErrorMessage("gGlobalCtx == nullptr");
return CMD_FAILED;
}
@ -361,7 +361,7 @@ static bool FileSelectHandler(std::shared_ptr<Ship::Console> Console, const std:
SET_NEXT_GAMESTATE(&gGlobalCtx->state, FileChoose_Init, FileChooseContext);
gGlobalCtx->state.running = 0;
} else {
SohImGui::console->SendErrorMessage("gGlobalCtx == nullptr");
SohImGui::GetConsole()->SendErrorMessage("gGlobalCtx == nullptr");
return CMD_FAILED;
}
return CMD_SUCCESS;
@ -378,10 +378,10 @@ static bool SaveStateHandler(std::shared_ptr<Ship::Console> Console, const std::
switch (rtn) {
case SaveStateReturn::SUCCESS:
SohImGui::console->SendInfoMessage("[SOH] Saved state to slot %u", slot);
SohImGui::GetConsole()->SendInfoMessage("[SOH] Saved state to slot %u", slot);
return CMD_SUCCESS;
case SaveStateReturn::FAIL_WRONG_GAMESTATE:
SohImGui::console->SendErrorMessage("[SOH] Can not save a state outside of \"GamePlay\"");
SohImGui::GetConsole()->SendErrorMessage("[SOH] Can not save a state outside of \"GamePlay\"");
return CMD_FAILED;
}
}
@ -392,16 +392,16 @@ static bool LoadStateHandler(std::shared_ptr<Ship::Console> Console, const std::
switch (rtn) {
case SaveStateReturn::SUCCESS:
SohImGui::console->SendInfoMessage("[SOH] Loaded state from slot (%u)", slot);
SohImGui::GetConsole()->SendInfoMessage("[SOH] Loaded state from slot (%u)", slot);
return CMD_SUCCESS;
case SaveStateReturn::FAIL_INVALID_SLOT:
SohImGui::console->SendErrorMessage("[SOH] Invalid State Slot Number (%u)", slot);
SohImGui::GetConsole()->SendErrorMessage("[SOH] Invalid State Slot Number (%u)", slot);
return CMD_FAILED;
case SaveStateReturn::FAIL_STATE_EMPTY:
SohImGui::console->SendErrorMessage("[SOH] State Slot (%u) is empty", slot);
SohImGui::GetConsole()->SendErrorMessage("[SOH] State Slot (%u) is empty", slot);
return CMD_FAILED;
case SaveStateReturn::FAIL_WRONG_GAMESTATE:
SohImGui::console->SendErrorMessage("[SOH] Can not load a state outside of \"GamePlay\"");
SohImGui::GetConsole()->SendErrorMessage("[SOH] Can not load a state outside of \"GamePlay\"");
return CMD_FAILED;
}
@ -409,7 +409,7 @@ static bool LoadStateHandler(std::shared_ptr<Ship::Console> Console, const std::
static bool StateSlotSelectHandler(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;
}
int slot;
@ -417,17 +417,17 @@ static bool StateSlotSelectHandler(std::shared_ptr<Ship::Console> Console, const
try {
slot = std::stoi(args[1], nullptr, 10);
} catch (std::invalid_argument const& ex) {
SohImGui::console->SendErrorMessage("[SOH] SaveState slot value must be a number.");
SohImGui::GetConsole()->SendErrorMessage("[SOH] SaveState slot value must be a number.");
return CMD_FAILED;
}
if (slot < 0) {
SohImGui::console->SendErrorMessage("[SOH] Invalid slot passed. Slot must be between 0 and 2");
SohImGui::GetConsole()->SendErrorMessage("[SOH] Invalid slot passed. Slot must be between 0 and 2");
return CMD_FAILED;
}
OTRGlobals::Instance->gSaveStateMgr->SetCurrentSlot(slot);
SohImGui::console->SendInfoMessage("[SOH] Slot %u selected",
SohImGui::GetConsole()->SendInfoMessage("[SOH] Slot %u selected",
OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot());
return CMD_SUCCESS;
}
@ -488,7 +488,7 @@ static bool SetCVarHandler(std::shared_ptr<Ship::Console> Console, const std::ve
CVar_Save();
//SohImGui::console->SendInfoMessage("[SOH] Updated player position to [ %.2f, %.2f, %.2f ]", pos.x, pos.y, pos.z);
//SohImGui::GetConsole()->SendInfoMessage("[SOH] Updated player position to [ %.2f, %.2f, %.2f ]", pos.x, pos.y, pos.z);
return CMD_SUCCESS;
}
@ -502,17 +502,17 @@ static bool GetCVarHandler(std::shared_ptr<Ship::Console> Console, const std::ve
if (cvar != nullptr)
{
if (cvar->type == CVarType::S32)
SohImGui::console->SendInfoMessage("[SOH] Variable %s is %i", args[1].c_str(), cvar->value.valueS32);
SohImGui::GetConsole()->SendInfoMessage("[SOH] Variable %s is %i", args[1].c_str(), cvar->value.valueS32);
else if (cvar->type == CVarType::Float)
SohImGui::console->SendInfoMessage("[SOH] Variable %s is %f", args[1].c_str(), cvar->value.valueFloat);
SohImGui::GetConsole()->SendInfoMessage("[SOH] Variable %s is %f", args[1].c_str(), cvar->value.valueFloat);
else if (cvar->type == CVarType::String)
SohImGui::console->SendInfoMessage("[SOH] Variable %s is %s", args[1].c_str(), cvar->value.valueStr);
SohImGui::GetConsole()->SendInfoMessage("[SOH] Variable %s is %s", args[1].c_str(), cvar->value.valueStr);
else if (cvar->type == CVarType::RGBA)
SohImGui::console->SendInfoMessage("[SOH] Variable %s is %08X", args[1].c_str(), cvar->value.valueRGBA);
SohImGui::GetConsole()->SendInfoMessage("[SOH] Variable %s is %08X", args[1].c_str(), cvar->value.valueRGBA);
}
else
{
SohImGui::console->SendInfoMessage("[SOH] Could not find variable %s", args[1].c_str());
SohImGui::GetConsole()->SendInfoMessage("[SOH] Could not find variable %s", args[1].c_str());
}

View File

@ -1,22 +0,0 @@
#include "ImGuiHelpers.h"
#include "../../../../libultraship/libultraship/ImGuiImpl.h"
// Adds a text tooltip for the previous ImGui item
void SetLastItemHoverText(const std::string& text) {
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::Text(SohImGui::BreakTooltip(text, 60).c_str());
ImGui::EndTooltip();
}
}
// Adds a "?" next to the previous ImGui item with a custom tooltip
void InsertHelpHoverText(const std::string& text) {
ImGui::SameLine();
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "?");
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::Text(SohImGui::BreakTooltip(text, 60).c_str());
ImGui::EndTooltip();
}
}

View File

@ -1,8 +0,0 @@
#pragma once
#include "../libultraship/Lib/ImGui/imgui.h"
#include <string>
void SetLastItemHoverText(const std::string& text);
void InsertHelpHoverText(const std::string& text);

View File

@ -1,13 +1,13 @@
#include "actorViewer.h"
#include "../../util.h"
#include "../libultraship/ImGuiImpl.h"
#include "ImGuiHelpers.h"
#include "../../UIWidgets.hpp"
#include <libultraship/ImGuiImpl.h>
#include <array>
#include <bit>
#include <map>
#include <string>
#include <Cvar.h>
#include <libultraship/Cvar.h>
extern "C" {
#include <z64.h>
@ -632,7 +632,7 @@ void DrawActorViewer(bool& open) {
if (display.category == ACTORCAT_BOSS || display.category == ACTORCAT_ENEMY) {
ImGui::InputScalar("Enemy Health", ImGuiDataType_U8, &display.colChkInfo.health);
InsertHelpHoverText("Some actors might not use this!");
UIWidgets::InsertHelpHoverText("Some actors might not use this!");
}
if (ImGui::Button("Refresh")) {
@ -667,7 +667,7 @@ void DrawActorViewer(bool& open) {
rm = TARGET;
}
}
InsertHelpHoverText("Grabs actor with target arrow above it. You might need C-Up for enemies");
UIWidgets::InsertHelpHoverText("Grabs actor with target arrow above it. You might need C-Up for enemies");
if (ImGui::Button("Fetch from Held")) {
Player* player = GET_PLAYER(gGlobalCtx);
fetch = player->heldActor;
@ -678,7 +678,7 @@ void DrawActorViewer(bool& open) {
rm = HELD;
}
}
InsertHelpHoverText("Grabs actor that Link is holding");
UIWidgets::InsertHelpHoverText("Grabs actor that Link is holding");
if (ImGui::Button("Fetch from Interaction")) {
Player* player = GET_PLAYER(gGlobalCtx);
fetch = player->interactRangeActor;
@ -689,7 +689,7 @@ void DrawActorViewer(bool& open) {
rm = INTERACT;
}
}
InsertHelpHoverText("Grabs actor from \"interaction range\"");
UIWidgets::InsertHelpHoverText("Grabs actor from \"interaction range\"");
ImGui::TreePop();
}

View File

@ -1,12 +1,12 @@
#include "colViewer.h"
#include "../libultraship/ImGuiImpl.h"
#include "ImGuiHelpers.h"
#include <libultraship/ImGuiImpl.h>
#include "../../frame_interpolation.h"
#include "../../UIWidgets.hpp"
#include <vector>
#include <string>
#include <cmath>
#include <Cvar.h>
#include <libultraship/Cvar.h>
extern "C" {
#include <z64.h>
@ -62,42 +62,42 @@ void DrawColViewerWindow(bool& open) {
ImGui::End();
return;
}
SohImGui::EnhancementCheckbox("Enabled", "gColViewerEnabled");
UIWidgets::EnhancementCheckbox("Enabled", "gColViewerEnabled");
SohImGui::EnhancementCombo("Scene", "gColViewerScene", ColRenderSettingNames);
SohImGui::EnhancementCombo("Bg Actors", "gColViewerBgActors", ColRenderSettingNames);
SohImGui::EnhancementCombo("Col Check", "gColViewerColCheck", ColRenderSettingNames);
SohImGui::EnhancementCombo("Waterbox", "gColViewerWaterbox", ColRenderSettingNames);
UIWidgets::EnhancementCombo("Scene", "gColViewerScene", ColRenderSettingNames);
UIWidgets::EnhancementCombo("Bg Actors", "gColViewerBgActors", ColRenderSettingNames);
UIWidgets::EnhancementCombo("Col Check", "gColViewerColCheck", ColRenderSettingNames);
UIWidgets::EnhancementCombo("Waterbox", "gColViewerWaterbox", ColRenderSettingNames);
SohImGui::EnhancementCheckbox("Apply as decal", "gColViewerDecal");
InsertHelpHoverText("Applies the collision as a decal display. This can be useful if there is z-fighting occuring "
UIWidgets::EnhancementCheckbox("Apply as decal", "gColViewerDecal");
UIWidgets::InsertHelpHoverText("Applies the collision as a decal display. This can be useful if there is z-fighting occuring "
"with the scene geometry, but can cause other artifacts.");
SohImGui::EnhancementCheckbox("Shaded", "gColViewerShaded");
InsertHelpHoverText("Applies the scene's shading to the collision display.");
UIWidgets::EnhancementCheckbox("Shaded", "gColViewerShaded");
UIWidgets::InsertHelpHoverText("Applies the scene's shading to the collision display.");
// This has to be duplicated in both code paths due to the nature of ImGui::IsItemHovered()
const std::string colorHelpText = "View and change the colors used for collision display.";
if (ImGui::TreeNode("Colors")) {
InsertHelpHoverText(colorHelpText);
UIWidgets::InsertHelpHoverText(colorHelpText);
SohImGui::EnhancementColor("Normal", "gColViewerColorNormal", scene_col, ImVec4(255, 255, 255, 255), false);
SohImGui::EnhancementColor("Hookshot", "gColViewerColorHookshot", hookshot_col, ImVec4(128, 128, 255, 255),
UIWidgets::EnhancementColor("Normal", "gColViewerColorNormal", scene_col, ImVec4(255, 255, 255, 255), false);
UIWidgets::EnhancementColor("Hookshot", "gColViewerColorHookshot", hookshot_col, ImVec4(128, 128, 255, 255),
false);
SohImGui::EnhancementColor("Entrance", "gColViewerColorEntrance", entrance_col, ImVec4(0, 255, 0, 255), false);
SohImGui::EnhancementColor("Special Surface (Grass/Sand/Etc)", "gColViewerColorSpecialSurface",
UIWidgets::EnhancementColor("Entrance", "gColViewerColorEntrance", entrance_col, ImVec4(0, 255, 0, 255), false);
UIWidgets::EnhancementColor("Special Surface (Grass/Sand/Etc)", "gColViewerColorSpecialSurface",
specialSurface_col, ImVec4(192, 255, 192, 255), false);
SohImGui::EnhancementColor("Interactable (Vines/Crawlspace/Etc)", "gColViewerColorInteractable",
UIWidgets::EnhancementColor("Interactable (Vines/Crawlspace/Etc)", "gColViewerColorInteractable",
interactable_col, ImVec4(192, 0, 192, 255), false);
SohImGui::EnhancementColor("Slope", "gColViewerColorSlope", slope_col, ImVec4(255, 255, 128, 255), false);
SohImGui::EnhancementColor("Void", "gColViewerColorVoid", void_col, ImVec4(255, 0, 0, 255), false);
SohImGui::EnhancementColor("OC", "gColViewerColorOC", oc_col, ImVec4(255, 255, 255, 255), false);
SohImGui::EnhancementColor("AC", "gColViewerColorAC", ac_col, ImVec4(0, 0, 255, 255), false);
SohImGui::EnhancementColor("AT", "gColViewerColorAT", at_col, ImVec4(255, 0, 0, 255), false);
SohImGui::EnhancementColor("Waterbox", "gColViewerColorWaterbox", waterbox_col, ImVec4(0, 0, 255, 255), false);
UIWidgets::EnhancementColor("Slope", "gColViewerColorSlope", slope_col, ImVec4(255, 255, 128, 255), false);
UIWidgets::EnhancementColor("Void", "gColViewerColorVoid", void_col, ImVec4(255, 0, 0, 255), false);
UIWidgets::EnhancementColor("OC", "gColViewerColorOC", oc_col, ImVec4(255, 255, 255, 255), false);
UIWidgets::EnhancementColor("AC", "gColViewerColorAC", ac_col, ImVec4(0, 0, 255, 255), false);
UIWidgets::EnhancementColor("AT", "gColViewerColorAT", at_col, ImVec4(255, 0, 0, 255), false);
UIWidgets::EnhancementColor("Waterbox", "gColViewerColorWaterbox", waterbox_col, ImVec4(0, 0, 255, 255), false);
ImGui::TreePop();
} else {
InsertHelpHoverText(colorHelpText);
UIWidgets::InsertHelpHoverText(colorHelpText);
}
ImGui::End();

View File

@ -1,13 +1,13 @@
#include "debugSaveEditor.h"
#include "../../util.h"
#include "../libultraship/ImGuiImpl.h"
#include "ImGuiHelpers.h"
#include <libultraship/ImGuiImpl.h>
#include "../../UIWidgets.hpp"
#include <array>
#include <bit>
#include <map>
#include <string>
#include <Cvar.h>
#include <libultraship/Cvar.h>
extern "C" {
#include <z64.h>
@ -309,7 +309,7 @@ void DrawInfoTab() {
ImGui::PushItemWidth(ImGui::GetFontSize() * 6);
ImGui::Text("Name: %s", name.c_str());
InsertHelpHoverText("Player Name");
UIWidgets::InsertHelpHoverText("Player Name");
std::string nameID;
for (int i = 0; i < 8; i++) {
nameID = z2ASCII(i);
@ -326,7 +326,7 @@ void DrawInfoTab() {
if (ImGui::IsItemDeactivated()) {
gSaveContext.healthCapacity = healthIntermediary;
}
InsertHelpHoverText("Maximum health. 16 units per full heart");
UIWidgets::InsertHelpHoverText("Maximum health. 16 units per full heart");
if (gSaveContext.health > gSaveContext.healthCapacity) {
gSaveContext.health = gSaveContext.healthCapacity; // Clamp health to new max
}
@ -335,7 +335,7 @@ void DrawInfoTab() {
const uint16_t healthMax = gSaveContext.healthCapacity;
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15);
ImGui::SliderScalar("Health", ImGuiDataType_S16, &gSaveContext.health, &healthMin, &healthMax);
InsertHelpHoverText("Current health. 16 units per full heart");
UIWidgets::InsertHelpHoverText("Current health. 16 units per full heart");
bool doubleDefense = gSaveContext.doubleDefense != 0;
if (ImGui::Checkbox("Double Defense", &doubleDefense)) {
@ -343,7 +343,7 @@ void DrawInfoTab() {
gSaveContext.inventory.defenseHearts =
gSaveContext.doubleDefense ? 20 : 0; // Set to get the border drawn in the UI
}
InsertHelpHoverText("Is double defense unlocked?");
UIWidgets::InsertHelpHoverText("Is double defense unlocked?");
std::string magicName;
if (gSaveContext.magicLevel == 2) {
@ -373,7 +373,7 @@ void DrawInfoTab() {
ImGui::EndCombo();
}
InsertHelpHoverText("Current magic level");
UIWidgets::InsertHelpHoverText("Current magic level");
gSaveContext.unk_13F4 = gSaveContext.magicLevel * 0x30; // Set to get the bar drawn in the UI
if (gSaveContext.magic > gSaveContext.unk_13F4) {
gSaveContext.magic = gSaveContext.unk_13F4; // Clamp magic to new max
@ -383,16 +383,16 @@ void DrawInfoTab() {
const uint8_t magicMax = gSaveContext.unk_13F4;
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15);
ImGui::SliderScalar("Magic", ImGuiDataType_S8, &gSaveContext.magic, &magicMin, &magicMax);
InsertHelpHoverText("Current magic. 48 units per magic level");
UIWidgets::InsertHelpHoverText("Current magic. 48 units per magic level");
ImGui::InputScalar("Rupees", ImGuiDataType_S16, &gSaveContext.rupees);
InsertHelpHoverText("Current rupees");
UIWidgets::InsertHelpHoverText("Current rupees");
const uint16_t dayTimeMin = 0;
const uint16_t dayTimeMax = 0xFFFF;
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15);
ImGui::SliderScalar("Time", ImGuiDataType_U16, &gSaveContext.dayTime, &dayTimeMin, &dayTimeMax);
InsertHelpHoverText("Time of day");
UIWidgets::InsertHelpHoverText("Time of day");
if (ImGui::Button("Dawn")) {
gSaveContext.dayTime = 0x4000;
}
@ -410,43 +410,43 @@ void DrawInfoTab() {
}
ImGui::InputScalar("Total Days", ImGuiDataType_S32, &gSaveContext.totalDays);
InsertHelpHoverText("Total number of days elapsed since the start of the game");
UIWidgets::InsertHelpHoverText("Total number of days elapsed since the start of the game");
ImGui::InputScalar("Deaths", ImGuiDataType_U16, &gSaveContext.deaths);
InsertHelpHoverText("Total number of deaths");
UIWidgets::InsertHelpHoverText("Total number of deaths");
bool bgsFlag = gSaveContext.bgsFlag != 0;
if (ImGui::Checkbox("Has BGS", &bgsFlag)) {
gSaveContext.bgsFlag = bgsFlag;
}
InsertHelpHoverText("Is Biggoron sword unlocked? Replaces Giant's knife");
UIWidgets::InsertHelpHoverText("Is Biggoron sword unlocked? Replaces Giant's knife");
ImGui::InputScalar("Sword Health", ImGuiDataType_U16, &gSaveContext.swordHealth);
InsertHelpHoverText("Giant's knife health. Default is 8. Must be >0 for Biggoron sword to work");
UIWidgets::InsertHelpHoverText("Giant's knife health. Default is 8. Must be >0 for Biggoron sword to work");
ImGui::InputScalar("Bgs Day Count", ImGuiDataType_S32, &gSaveContext.bgsDayCount);
InsertHelpHoverText("Total number of days elapsed since giving Biggoron the claim check");
UIWidgets::InsertHelpHoverText("Total number of days elapsed since giving Biggoron the claim check");
ImGui::InputScalar("Entrance Index", ImGuiDataType_S32, &gSaveContext.entranceIndex);
InsertHelpHoverText("From which entrance did Link arrive?");
UIWidgets::InsertHelpHoverText("From which entrance did Link arrive?");
ImGui::InputScalar("Cutscene Index", ImGuiDataType_S32, &gSaveContext.cutsceneIndex);
InsertHelpHoverText("Which cutscene is this?");
UIWidgets::InsertHelpHoverText("Which cutscene is this?");
ImGui::InputScalar("Navi Timer", ImGuiDataType_U16, &gSaveContext.naviTimer);
InsertHelpHoverText("Navi wants to talk at 600 units, decides not to at 3000.");
UIWidgets::InsertHelpHoverText("Navi wants to talk at 600 units, decides not to at 3000.");
ImGui::InputScalar("Timer 1 State", ImGuiDataType_S16, &gSaveContext.timer1State);
InsertHelpHoverText("Heat timer, race timer, etc. Has white font");
UIWidgets::InsertHelpHoverText("Heat timer, race timer, etc. Has white font");
ImGui::InputScalar("Timer 1 Value", ImGuiDataType_S16, &gSaveContext.timer1Value, &one, NULL);
InsertHelpHoverText("Time, in seconds");
UIWidgets::InsertHelpHoverText("Time, in seconds");
ImGui::InputScalar("Timer 2 State", ImGuiDataType_S16, &gSaveContext.timer2State);
InsertHelpHoverText("Trade timer, Ganon collapse timer, etc. Has yellow font");
UIWidgets::InsertHelpHoverText("Trade timer, Ganon collapse timer, etc. Has yellow font");
ImGui::InputScalar("Timer 2 Value", ImGuiDataType_S16, &gSaveContext.timer2Value, &one, NULL);
InsertHelpHoverText("Time, in seconds");
UIWidgets::InsertHelpHoverText("Time, in seconds");
const char* audioName;
switch (gSaveContext.audioSetting) {
@ -481,13 +481,13 @@ void DrawInfoTab() {
ImGui::EndCombo();
}
InsertHelpHoverText("Sound setting");
UIWidgets::InsertHelpHoverText("Sound setting");
bool n64DDFlag = gSaveContext.n64ddFlag != 0;
if (ImGui::Checkbox("64 DD file?", &n64DDFlag)) {
gSaveContext.n64ddFlag = n64DDFlag;
}
InsertHelpHoverText("WARNING! If you save, your file may be locked! Use caution!");
UIWidgets::InsertHelpHoverText("WARNING! If you save, your file may be locked! Use caution!");
if (ImGui::BeginCombo("Z Target Mode", gSaveContext.zTargetSetting ? "Hold" : "Switch")) {
if (ImGui::Selectable("Switch")) {
@ -498,7 +498,7 @@ void DrawInfoTab() {
}
ImGui::EndCombo();
}
InsertHelpHoverText("Z-Targeting behavior");
UIWidgets::InsertHelpHoverText("Z-Targeting behavior");
ImGui::PushItemWidth(ImGui::GetFontSize() * 10);
@ -529,7 +529,7 @@ void DrawInventoryTab() {
static bool restrictToValid = true;
ImGui::Checkbox("Restrict to valid items", &restrictToValid);
InsertHelpHoverText("Restricts items and ammo to only what is possible to legally acquire in-game");
UIWidgets::InsertHelpHoverText("Restricts items and ammo to only what is possible to legally acquire in-game");
for (int32_t y = 0; y < 4; y++) {
for (int32_t x = 0; x < 6; x++) {
@ -568,7 +568,7 @@ void DrawInventoryTab() {
gSaveContext.inventory.items[selectedIndex] = ITEM_NONE;
ImGui::CloseCurrentPopup();
}
SetLastItemHoverText("None");
UIWidgets::SetLastItemHoverText("None");
std::vector<ItemMapEntry> possibleItems;
if (restrictToValid) {
@ -598,7 +598,7 @@ void DrawInventoryTab() {
gSaveContext.inventory.items[selectedIndex] = slotEntry.id;
ImGui::CloseCurrentPopup();
}
SetLastItemHoverText(SohUtils::GetItemName(slotEntry.id));
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(slotEntry.id));
}
ImGui::EndPopup();
@ -682,7 +682,7 @@ void DrawFlagsTab() {
DrawGroupWithBorder([&]() {
ImGui::Text("Switch");
InsertHelpHoverText("Permanently-saved switch flags");
UIWidgets::InsertHelpHoverText("Permanently-saved switch flags");
DrawFlagArray32("Switch", act->flags.swch);
});
@ -690,13 +690,13 @@ void DrawFlagsTab() {
DrawGroupWithBorder([&]() {
ImGui::Text("Temp Switch");
InsertHelpHoverText("Temporary switch flags. Unset on scene transitions");
UIWidgets::InsertHelpHoverText("Temporary switch flags. Unset on scene transitions");
DrawFlagArray32("Temp Switch", act->flags.tempSwch);
});
DrawGroupWithBorder([&]() {
ImGui::Text("Clear");
InsertHelpHoverText("Permanently-saved room-clear flags");
UIWidgets::InsertHelpHoverText("Permanently-saved room-clear flags");
DrawFlagArray32("Clear", act->flags.clear);
});
@ -704,13 +704,13 @@ void DrawFlagsTab() {
DrawGroupWithBorder([&]() {
ImGui::Text("Temp Clear");
InsertHelpHoverText("Temporary room-clear flags. Unset on scene transitions");
UIWidgets::InsertHelpHoverText("Temporary room-clear flags. Unset on scene transitions");
DrawFlagArray32("Temp Clear", act->flags.tempClear);
});
DrawGroupWithBorder([&]() {
ImGui::Text("Collect");
InsertHelpHoverText("Permanently-saved collect flags");
UIWidgets::InsertHelpHoverText("Permanently-saved collect flags");
DrawFlagArray32("Collect", act->flags.collect);
});
@ -718,13 +718,13 @@ void DrawFlagsTab() {
DrawGroupWithBorder([&]() {
ImGui::Text("Temp Collect");
InsertHelpHoverText("Temporary collect flags. Unset on scene transitions");
UIWidgets::InsertHelpHoverText("Temporary collect flags. Unset on scene transitions");
DrawFlagArray32("Temp Collect", act->flags.tempCollect);
});
DrawGroupWithBorder([&]() {
ImGui::Text("Chest");
InsertHelpHoverText("Permanently-saved chest flags");
UIWidgets::InsertHelpHoverText("Permanently-saved chest flags");
DrawFlagArray32("Chest", act->flags.chest);
});
@ -738,7 +738,7 @@ void DrawFlagsTab() {
act->flags.collect = gSaveContext.sceneFlags[gGlobalCtx->sceneNum].collect;
act->flags.chest = gSaveContext.sceneFlags[gGlobalCtx->sceneNum].chest;
}
SetLastItemHoverText("Load flags from saved scene flags. Normally happens on scene load");
UIWidgets::SetLastItemHoverText("Load flags from saved scene flags. Normally happens on scene load");
if (ImGui::Button("Save Flags")) {
gSaveContext.sceneFlags[gGlobalCtx->sceneNum].swch = act->flags.swch;
@ -746,7 +746,7 @@ void DrawFlagsTab() {
gSaveContext.sceneFlags[gGlobalCtx->sceneNum].collect = act->flags.collect;
gSaveContext.sceneFlags[gGlobalCtx->sceneNum].chest = act->flags.chest;
}
SetLastItemHoverText("Save current scene flags. Normally happens on scene exit");
UIWidgets::SetLastItemHoverText("Save current scene flags. Normally happens on scene exit");
ImGui::EndGroup();
} else {
@ -776,12 +776,12 @@ void DrawFlagsTab() {
if (ImGui::Button("Current")) {
selectedSceneFlagMap = gGlobalCtx->sceneNum;
}
SetLastItemHoverText("Open flags for current scene");
UIWidgets::SetLastItemHoverText("Open flags for current scene");
}
DrawGroupWithBorder([&]() {
ImGui::Text("Switch");
InsertHelpHoverText("Switch flags");
UIWidgets::InsertHelpHoverText("Switch flags");
DrawFlagArray32("Switch", gSaveContext.sceneFlags[selectedSceneFlagMap].swch);
});
@ -789,13 +789,13 @@ void DrawFlagsTab() {
DrawGroupWithBorder([&]() {
ImGui::Text("Clear");
InsertHelpHoverText("Room-clear flags");
UIWidgets::InsertHelpHoverText("Room-clear flags");
DrawFlagArray32("Clear", gSaveContext.sceneFlags[selectedSceneFlagMap].clear);
});
DrawGroupWithBorder([&]() {
ImGui::Text("Collect");
InsertHelpHoverText("Collect flags");
UIWidgets::InsertHelpHoverText("Collect flags");
DrawFlagArray32("Collect", gSaveContext.sceneFlags[selectedSceneFlagMap].collect);
});
@ -803,13 +803,13 @@ void DrawFlagsTab() {
DrawGroupWithBorder([&]() {
ImGui::Text("Chest");
InsertHelpHoverText("Chest flags");
UIWidgets::InsertHelpHoverText("Chest flags");
DrawFlagArray32("Chest", gSaveContext.sceneFlags[selectedSceneFlagMap].chest);
});
DrawGroupWithBorder([&]() {
ImGui::Text("Rooms");
InsertHelpHoverText("Flags for visted rooms");
UIWidgets::InsertHelpHoverText("Flags for visted rooms");
DrawFlagArray32("Rooms", gSaveContext.sceneFlags[selectedSceneFlagMap].rooms);
});
@ -817,7 +817,7 @@ void DrawFlagsTab() {
DrawGroupWithBorder([&]() {
ImGui::Text("Floors");
InsertHelpHoverText("Flags for visted floors");
UIWidgets::InsertHelpHoverText("Flags for visted floors");
DrawFlagArray32("Floors", gSaveContext.sceneFlags[selectedSceneFlagMap].floors);
});
@ -870,7 +870,7 @@ void DrawFlagsTab() {
static bool keepGsCountUpdated = true;
ImGui::Checkbox("Keep GS Count Updated", &keepGsCountUpdated);
InsertHelpHoverText("Automatically adjust the number of gold skulltula tokens acquired based on set flags");
UIWidgets::InsertHelpHoverText("Automatically adjust the number of gold skulltula tokens acquired based on set flags");
int32_t gsCount = 0;
if (keepGsCountUpdated) {
for (int32_t gsFlagIndex = 0; gsFlagIndex < 6; gsFlagIndex++) {
@ -883,85 +883,85 @@ void DrawFlagsTab() {
if (ImGui::TreeNode("Event Check Inf Flags")) {
DrawGroupWithBorder([&]() {
ImGui::Text("0");
InsertHelpHoverText("Mostly Kokiri Forest related");
UIWidgets::InsertHelpHoverText("Mostly Kokiri Forest related");
DrawFlagArray16("eci0", gSaveContext.eventChkInf[0]);
});
DrawGroupWithBorder([&]() {
ImGui::Text("1");
InsertHelpHoverText("Mostly Lon Lon Ranch related");
UIWidgets::InsertHelpHoverText("Mostly Lon Lon Ranch related");
DrawFlagArray16("eci1", gSaveContext.eventChkInf[1]);
});
DrawGroupWithBorder([&]() {
ImGui::Text("2");
InsertHelpHoverText("Dodongo Related?");
UIWidgets::InsertHelpHoverText("Dodongo Related?");
DrawFlagArray16("eci2", gSaveContext.eventChkInf[2]);
});
DrawGroupWithBorder([&]() {
ImGui::Text("3");
InsertHelpHoverText("Mostly Zora related");
UIWidgets::InsertHelpHoverText("Mostly Zora related");
DrawFlagArray16("eci3", gSaveContext.eventChkInf[3]);
});
DrawGroupWithBorder([&]() {
ImGui::Text("4");
InsertHelpHoverText("Random");
UIWidgets::InsertHelpHoverText("Random");
DrawFlagArray16("eci4", gSaveContext.eventChkInf[4]);
});
DrawGroupWithBorder([&]() {
ImGui::Text("5");
InsertHelpHoverText("Mostly song learning related");
UIWidgets::InsertHelpHoverText("Mostly song learning related");
DrawFlagArray16("eci5", gSaveContext.eventChkInf[5]);
});
DrawGroupWithBorder([&]() {
ImGui::Text("6");
InsertHelpHoverText("Random");
UIWidgets::InsertHelpHoverText("Random");
DrawFlagArray16("eci6", gSaveContext.eventChkInf[6]);
});
DrawGroupWithBorder([&]() {
ImGui::Text("7");
InsertHelpHoverText("Boss Battle related");
UIWidgets::InsertHelpHoverText("Boss Battle related");
DrawFlagArray16("eci7", gSaveContext.eventChkInf[7]);
});
DrawGroupWithBorder([&]() {
ImGui::Text("8");
InsertHelpHoverText("Mask related?");
UIWidgets::InsertHelpHoverText("Mask related?");
DrawFlagArray16("eci8", gSaveContext.eventChkInf[8]);
});
DrawGroupWithBorder([&]() {
ImGui::Text("9");
InsertHelpHoverText("Mostly carpenter related");
UIWidgets::InsertHelpHoverText("Mostly carpenter related");
DrawFlagArray16("eci9", gSaveContext.eventChkInf[9]);
});
DrawGroupWithBorder([&]() {
ImGui::Text("A");
InsertHelpHoverText("First-time overworld entrance cs related");
UIWidgets::InsertHelpHoverText("First-time overworld entrance cs related");
DrawFlagArray16("eci10", gSaveContext.eventChkInf[10]);
});
DrawGroupWithBorder([&]() {
ImGui::Text("B");
InsertHelpHoverText("First-time dungeon entrance cs/trial cs related");
UIWidgets::InsertHelpHoverText("First-time dungeon entrance cs/trial cs related");
DrawFlagArray16("eci11", gSaveContext.eventChkInf[11]);
});
DrawGroupWithBorder([&]() {
ImGui::Text("C");
InsertHelpHoverText("Random");
UIWidgets::InsertHelpHoverText("Random");
DrawFlagArray16("eci12", gSaveContext.eventChkInf[12]);
});
DrawGroupWithBorder([&]() {
ImGui::Text("D");
InsertHelpHoverText("Frog songs/GS rewards");
UIWidgets::InsertHelpHoverText("Frog songs/GS rewards");
DrawFlagArray16("eci13", gSaveContext.eventChkInf[13]);
});
@ -1014,7 +1014,7 @@ void DrawUpgrade(const std::string& categoryName, int32_t categoryId, const std:
ImGui::EndCombo();
}
ImGui::PopID();
SetLastItemHoverText(categoryName.c_str());
UIWidgets::SetLastItemHoverText(categoryName.c_str());
}
// Draws a combo that lets you choose and upgrade value from a popup grid of icons
@ -1039,7 +1039,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
}
ImGui::PopStyleVar();
ImGui::PopStyleColor();
SetLastItemHoverText(categoryName.c_str());
UIWidgets::SetLastItemHoverText(categoryName.c_str());
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
if (ImGui::BeginPopup(upgradePopupPicker)) {
@ -1053,7 +1053,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
Inventory_ChangeUpgrade(categoryId, pickerIndex);
ImGui::CloseCurrentPopup();
}
SetLastItemHoverText("None");
UIWidgets::SetLastItemHoverText("None");
} else {
const ItemMapEntry& slotEntry = itemMapping[items[pickerIndex]];
if (ImGui::ImageButton(SohImGui::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
@ -1061,7 +1061,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
Inventory_ChangeUpgrade(categoryId, pickerIndex);
ImGui::CloseCurrentPopup();
}
SetLastItemHoverText(SohUtils::GetItemName(slotEntry.id));
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(slotEntry.id));
}
}
@ -1103,7 +1103,7 @@ void DrawEquipmentTab() {
}
ImGui::PopStyleColor();
ImGui::PopID();
SetLastItemHoverText(SohUtils::GetItemName(entry.id));
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(entry.id));
}
const std::vector<uint8_t> bulletBagValues = {
@ -1193,7 +1193,7 @@ void DrawQuestItemButton(uint32_t item) {
}
}
ImGui::PopStyleColor();
SetLastItemHoverText(SohUtils::GetQuestItemName(entry.id));
UIWidgets::SetLastItemHoverText(SohUtils::GetQuestItemName(entry.id));
}
// Draws a toggleable icon for a dungeon item that is faded when disabled
@ -1211,7 +1211,7 @@ void DrawDungeonItemButton(uint32_t item, uint32_t scene) {
}
}
ImGui::PopStyleColor();
SetLastItemHoverText(SohUtils::GetItemName(entry.id));
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(entry.id));
}
void DrawQuestStatusTab() {
@ -1258,11 +1258,11 @@ void DrawQuestStatusTab() {
}
}
ImGui::PopStyleColor();
SetLastItemHoverText(SohUtils::GetQuestItemName(entry.id));
UIWidgets::SetLastItemHoverText(SohUtils::GetQuestItemName(entry.id));
}
ImGui::InputScalar("GS Count", ImGuiDataType_S16, &gSaveContext.inventory.gsTokens);
InsertHelpHoverText("Number of gold skulltula tokens aquired");
UIWidgets::InsertHelpHoverText("Number of gold skulltula tokens aquired");
uint32_t bitMask = 1 << QUEST_SKULL_TOKEN;
bool gsUnlocked = (bitMask & gSaveContext.inventory.questItems) != 0;
@ -1273,7 +1273,7 @@ void DrawQuestStatusTab() {
gSaveContext.inventory.questItems &= ~bitMask;
}
}
InsertHelpHoverText("If unlocked, enables showing the gold skulltula count in the quest status menu");
UIWidgets::InsertHelpHoverText("If unlocked, enables showing the gold skulltula count in the quest status menu");
int32_t pohCount = (gSaveContext.inventory.questItems & 0xF0000000) >> 28;
if (ImGui::BeginCombo("PoH count", std::to_string(pohCount).c_str())) {
@ -1285,7 +1285,7 @@ void DrawQuestStatusTab() {
}
ImGui::EndCombo();
}
InsertHelpHoverText("The number of pieces of heart acquired towards the next heart container");
UIWidgets::InsertHelpHoverText("The number of pieces of heart acquired towards the next heart container");
DrawGroupWithBorder([&]() {
ImGui::Text("Dungeon Items");
@ -1410,7 +1410,7 @@ void DrawPlayerTab() {
DrawGroupWithBorder([&]() {
ImGui::Text("Link's Rotation");
InsertHelpHoverText("For Link's rotation in relation to the world");
UIWidgets::InsertHelpHoverText("For Link's rotation in relation to the world");
ImGui::InputScalar("X Rot", ImGuiDataType_S16, &player->actor.world.rot.x);
ImGui::SameLine();
ImGui::InputScalar("Y Rot", ImGuiDataType_S16, &player->actor.world.rot.y);
@ -1420,7 +1420,7 @@ void DrawPlayerTab() {
DrawGroupWithBorder([&]() {
ImGui::Text("Link's Model Rotation");
InsertHelpHoverText("For Link's actual model");
UIWidgets::InsertHelpHoverText("For Link's actual model");
ImGui::InputScalar("X ModRot", ImGuiDataType_S16, &player->actor.shape.rot.x);
ImGui::SameLine();
ImGui::InputScalar("Y ModRot", ImGuiDataType_S16, &player->actor.shape.rot.y);
@ -1429,19 +1429,19 @@ void DrawPlayerTab() {
});
ImGui::InputScalar("Linear Velocity", ImGuiDataType_Float, &player->linearVelocity);
InsertHelpHoverText("Link's speed along the XZ plane");
UIWidgets::InsertHelpHoverText("Link's speed along the XZ plane");
ImGui::InputScalar("Y Velocity", ImGuiDataType_Float, &player->actor.velocity.y);
InsertHelpHoverText("Link's speed along the Y plane. Caps at -20");
UIWidgets::InsertHelpHoverText("Link's speed along the Y plane. Caps at -20");
ImGui::InputScalar("Wall Height", ImGuiDataType_Float, &player->wallHeight);
InsertHelpHoverText("Height used to determine whether Link can climb or grab a ledge at the top");
UIWidgets::InsertHelpHoverText("Height used to determine whether Link can climb or grab a ledge at the top");
ImGui::InputScalar("Invincibility Timer", ImGuiDataType_S8, &player->invincibilityTimer);
InsertHelpHoverText("Can't take damage while this is nonzero");
UIWidgets::InsertHelpHoverText("Can't take damage while this is nonzero");
ImGui::InputScalar("Gravity", ImGuiDataType_Float, &player->actor.gravity);
InsertHelpHoverText("Rate at which Link falls. Default -4.0f");
UIWidgets::InsertHelpHoverText("Rate at which Link falls. Default -4.0f");
if (ImGui::BeginCombo("Link Age on Load", gGlobalCtx->linkAgeOnLoad == 0 ? "Adult" : "Child")) {
if (ImGui::Selectable("Adult")) {
@ -1453,7 +1453,7 @@ void DrawPlayerTab() {
ImGui::EndCombo();
}
InsertHelpHoverText("This will change Link's age when you load a map");
UIWidgets::InsertHelpHoverText("This will change Link's age when you load a map");
ImGui::Separator();

View File

@ -3,7 +3,7 @@
#include <ultra64.h>
#include <z64.h>
#include "Cvar.h"
#include <libultraship/Cvar.h>
#define MAX_CVARS 2048

View File

@ -14,7 +14,7 @@
#include <utility>
#include <set>
#include <map>
#include <Lib/spdlog/include/spdlog/spdlog.h>
#include <spdlog/spdlog.h>
std::list<EntranceOverride> entranceOverrides = {};
bool noRandomEntrances = false;

View File

@ -17,7 +17,7 @@
#include <vector>
#include <list>
#include <Lib/spdlog/include/spdlog/spdlog.h>
#include <spdlog/spdlog.h>
using namespace CustomMessages;
using namespace Logic;

View File

@ -12,7 +12,7 @@
#include "trial.hpp"
#include "entrance.hpp"
#include "z64item.h"
#include <Lib/spdlog/include/spdlog/spdlog.h>
#include <spdlog/spdlog.h>
using namespace CustomMessages;
using namespace Logic;

View File

@ -6,7 +6,7 @@
#include "shops.hpp"
#include "debug.hpp"
#include "keys.hpp"
#include <Lib/spdlog/include/spdlog/spdlog.h>
#include <spdlog/spdlog.h>
//Location definitions
static std::array<ItemLocation, KEY_ENUM_MAX> locationTable;

View File

@ -9,7 +9,7 @@
#include "settings.hpp"
#include "spoiler_log.hpp"
#include "z64item.h"
#include <Lib/spdlog/include/spdlog/spdlog.h>
#include <spdlog/spdlog.h>
using namespace Settings;

View File

@ -13,8 +13,8 @@
#include "spoiler_log.hpp"
#include "location_access.hpp"
#include "debug.hpp"
#include <Lib/spdlog/include/spdlog/spdlog.h>
#include "soh/Enhancements/randomizer/randomizerTypes.h"
#include <spdlog/spdlog.h>
#include "../../randomizer/randomizerTypes.h"
namespace {
bool seedChanged;

View File

@ -5,9 +5,9 @@
#include "location_access.hpp"
#include "rando_main.hpp"
// #include <soh/Enhancements/randomizer.h>
#include <Cvar.h>
#include <Window.h>
#include <PR/ultra64/types.h>
#include <libultraship/Cvar.h>
#include <libultraship/Window.h>
#include <ultra64/types.h>
#define TICKS_PER_SEC 268123480.0

View File

@ -11,7 +11,7 @@
#include "utils.hpp"
#include "shops.hpp"
#include "hints.hpp"
#include "Lib/nlohmann/json.hpp"
#include <nlohmann/json.hpp>
#include <cstdio>
#include <cstdlib>
@ -26,7 +26,7 @@
#include <filesystem>
#include <variables.h>
#include "Window.h"
#include <libultraship/Window.h>
using json = nlohmann::json;

View File

@ -1,21 +1,21 @@
#include "randomizer.h"
#include "Lib/nlohmann/json.hpp"
#include <nlohmann/json.hpp>
#include <fstream>
#include <variables.h>
#include <macros.h>
#include <objects/gameplay_keep/gameplay_keep.h>
#include <functions.h>
#include <Cvar.h>
#include <libultraship/Cvar.h>
#include <textures/icon_item_static/icon_item_static.h>
#include <textures/icon_item_24_static/icon_item_24_static.h>
#include "../libultraship/ImGuiImpl.h"
#include <libultraship/ImGuiImpl.h>
#include <thread>
#include "3drando/rando_main.hpp"
#include <soh/Enhancements/debugger/ImGuiHelpers.h>
#include "Lib/ImGui/imgui_internal.h"
#include <soh/Enhancements/custom-message/CustomMessageManager.h>
#include <soh/Enhancements/custom-message/CustomMessageTypes.h>
#include <soh/Enhancements/item-tables/ItemTableManager.h>
#include "../../UIWidgets.hpp"
#include <ImGui/imgui_internal.h>
#include "../custom-message/CustomMessageManager.h"
#include "../custom-message/CustomMessageTypes.h"
#include "../item-tables/ItemTableManager.h"
#include <stdexcept>
using json = nlohmann::json;
@ -3364,7 +3364,7 @@ void DrawRandoEditor(bool& open) {
ImGui::PushStyleVar(ImGuiStyleVar_Alpha,
ImGui::GetStyle().Alpha * disableEditingRandoSettings ? 0.5f : 1.0f);
SohImGui::EnhancementCheckbox("Enable Randomizer", "gRandomizer");
UIWidgets::EnhancementCheckbox("Enable Randomizer", "gRandomizer");
if (CVar_GetS32("gRandomizer", 0) == 1) {
if (ImGui::Button("Generate Seed")) {
@ -3404,17 +3404,17 @@ void DrawRandoEditor(bool& open) {
ImGui::Text("Forest");
switch (CVar_GetS32("gRandomizeForest", 1)) {
case 1:
InsertHelpHoverText("Mido no longer blocks the path to the Deku Tree\n"
UIWidgets::InsertHelpHoverText("Mido no longer blocks the path to the Deku Tree\n"
"The Kokiri boy no longer blocks the path out of the forest.");
break;
case 2:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"The Kokiri boy no longer blocks the path out of the forest\nMido "
"still blocks the path to the Deku Tree, requiring the Kokiri Sword "
"and a Deku Shield to access the Deku Tree.");
break;
case 0:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"Beating Deku Tree is logically required to leave the forest area "
"(Kokiri Forest / Lost Woods / Sacred Forest Meadow / Deku Tree) "
"while the Kokiri Sword and a Deku Shield are required to access the "
@ -3422,125 +3422,125 @@ void DrawRandoEditor(bool& open) {
"forest area.\nThis setting is incompatible with starting as adult.");
break;
}
SohImGui::EnhancementCombobox("gRandomizeForest", randoForest, 3, 1);
UIWidgets::EnhancementCombobox("gRandomizeForest", randoForest, 3, 1);
ImGui::Separator();
// Kakariko Gate
ImGui::Text("Kakariko Gate");
switch (CVar_GetS32("gRandomizeKakarikoGate", 0)) {
case 0:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"The gate and the Happy Mask Shop both remain closed until showing "
"Zelda's Letter to the guard in Kakariko.");
break;
case 1:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"The gate is always open instead of needing Zelda's Letter.\nThe Happy Mask Shop "
"opens upon obtaining Zelda's Letter without needing to show it to the guard.");
break;
}
SohImGui::EnhancementCombobox("gRandomizeKakarikoGate", randoKakarikoGate, 2, 1);
UIWidgets::EnhancementCombobox("gRandomizeKakarikoGate", randoKakarikoGate, 2, 1);
ImGui::Separator();
// Door of Time
ImGui::Text("Door of Time");
switch (CVar_GetS32("gRandomizeDoorOfTime", 0)) {
case 0:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"The Door of Time starts opened instead of needing to play the Song of Time.");
break;
case 1:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"Only an Ocarina and the Song of Time need to be found to open the Door of Time.");
break;
case 2:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"The Ocarina of Time, the Song of Time and all Spiritual Stones need to "
"be found to open the Door of Time.");
break;
}
SohImGui::EnhancementCombobox("gRandomizeDoorOfTime", randoDoorOfTime, 3, 0);
UIWidgets::EnhancementCombobox("gRandomizeDoorOfTime", randoDoorOfTime, 3, 0);
ImGui::Separator();
// Zora's Fountain
ImGui::Text("Zora's Fountain");
switch (CVar_GetS32("gRandomizeZorasFountain", 0)) {
case 0:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"King Zora obstructs the way to Zora's Fountain.\nRuto's Letter must be "
"shown as child in order to move him from both eras.");
break;
case 1:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"King Zora is always moved in the adult era.\nThis means Ruto's Letter is "
"only required to access Zora's fountain as child.");
break;
case 2:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"King Zora starts as moved in both the child and adult eras.\nThis also "
"removes Ruto's Letter from the pool since it can't be used.");
break;
}
SohImGui::EnhancementCombobox("gRandomizeZorasFountain", randoZorasFountain, 3, 0);
UIWidgets::EnhancementCombobox("gRandomizeZorasFountain", randoZorasFountain, 3, 0);
ImGui::Separator();
// Gerudo Fortress
ImGui::Text("Gerudo Fortress");
switch (CVar_GetS32("gRandomizeGerudoFortress", 0)) {
case 0:
InsertHelpHoverText("All 4 carpenters can be rescued.");
UIWidgets::InsertHelpHoverText("All 4 carpenters can be rescued.");
break;
case 1:
InsertHelpHoverText("Only the bottom left carpenter must be rescued.");
UIWidgets::InsertHelpHoverText("Only the bottom left carpenter must be rescued.");
break;
case 2:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"The carpenters are rescued from the start of the game and if \"Shuffle "
"Gerudo Card\" is disabled, the player starts with the Gerudo Card in "
"the inventory allowing access to Gerudo Training Grounds.");
break;
}
SohImGui::EnhancementCombobox("gRandomizeGerudoFortress", randoGerudoFortress, 3, 1);
UIWidgets::EnhancementCombobox("gRandomizeGerudoFortress", randoGerudoFortress, 3, 1);
ImGui::Separator();
// Rainbow Bridge
ImGui::Text("Rainbow Bridge");
SohImGui::EnhancementCombobox("gRandomizeRainbowBridge", randoRainbowBridge, 7, 3);
UIWidgets::EnhancementCombobox("gRandomizeRainbowBridge", randoRainbowBridge, 7, 3);
switch (CVar_GetS32("gRandomizeRainbowBridge", 3)) {
case 1:
InsertHelpHoverText("The Rainbow Bridge requires Shadow and Spirit Medallions as well "
UIWidgets::InsertHelpHoverText("The Rainbow Bridge requires Shadow and Spirit Medallions as well "
"as Light Arrows.");
break;
case 2:
InsertHelpHoverText("The Rainbow Bridge requires collecting a configurable number of "
UIWidgets::InsertHelpHoverText("The Rainbow Bridge requires collecting a configurable number of "
"Spiritual Stones.");
SohImGui::EnhancementSliderInt("Stone Count: %d", "##RandoStoneCount",
UIWidgets::EnhancementSliderInt("Stone Count: %d", "##RandoStoneCount",
"gRandomizeStoneCount", 0, 3, "");
SetLastItemHoverText(
UIWidgets::SetLastItemHoverText(
"Sets the number of Spiritual Stones required to spawn the Rainbow Bridge.");
break;
case 3:
SohImGui::EnhancementSliderInt("Medallion Count: %d", "##RandoMedallionCount",
UIWidgets::EnhancementSliderInt("Medallion Count: %d", "##RandoMedallionCount",
"gRandomizeMedallionCount", 0, 6, "", 6);
SetLastItemHoverText(
UIWidgets::SetLastItemHoverText(
"The Rainbow Bridge requires collecting a configurable number of Medallions.");
break;
case 4:
SohImGui::EnhancementSliderInt("Reward Count: %d", "##RandoRewardCount",
UIWidgets::EnhancementSliderInt("Reward Count: %d", "##RandoRewardCount",
"gRandomizeRewardCount", 0, 9, "");
SetLastItemHoverText("The Rainbow Bridge requires collecting a configurable number of "
UIWidgets::SetLastItemHoverText("The Rainbow Bridge requires collecting a configurable number of "
"Dungeon Rewards.");
break;
case 5:
SohImGui::EnhancementSliderInt("Dungeon Count: %d", "##RandoDungeonCount",
UIWidgets::EnhancementSliderInt("Dungeon Count: %d", "##RandoDungeonCount",
"gRandomizeDungeonCount", 0, 8, "");
SetLastItemHoverText(
UIWidgets::SetLastItemHoverText(
"The Rainbow Bridge requires completing a configurable number of Dungeons.\nDungeons "
"are considered complete when Link steps into the blue warp at the end of them.");
break;
case 6:
SohImGui::EnhancementSliderInt("Token Count: %d", "##RandoTokenCount",
UIWidgets::EnhancementSliderInt("Token Count: %d", "##RandoTokenCount",
"gRandomizeTokenCount", 0, 100, "");
SetLastItemHoverText("The Rainbow Bridge requires collecting a configurable number of "
UIWidgets::SetLastItemHoverText("The Rainbow Bridge requires collecting a configurable number of "
"Gold Skulltula Tokens.");
break;
}
@ -3557,8 +3557,8 @@ void DrawRandoEditor(bool& open) {
// "gRandomizeGanonTrialCount", 0, 6, "");
//InsertHelpHoverText("Set the number of trials required to enter Ganon's Tower.");
// RANDTODO: Switch back to slider when pre-completing some of Ganon's Trials is properly implemnted.
SohImGui::EnhancementCheckbox("Skip Ganon's Trials", "gRandomizeGanonTrialCount");
InsertHelpHoverText(
UIWidgets::EnhancementCheckbox("Skip Ganon's Trials", "gRandomizeGanonTrialCount");
UIWidgets::InsertHelpHoverText(
"Sets whether or not Ganon's Castle Trials are required to enter Ganon's Tower.");
// }
@ -3698,23 +3698,23 @@ void DrawRandoEditor(bool& open) {
ImGui::Text("Shuffle Dungeon Rewards");
switch (CVar_GetS32("gRandomizeShuffleDungeonReward", 0)) {
case 0:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"Medallions and Spiritual Stones will be given as rewards for beating dungeons.\n"
"This setting will force Link's Pocket to be a Medallion or a Spiritual Stone.");
break;
case 1:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"Medallions and Spiritual Stones can only appear inside of dungeons.");
break;
case 2:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"Medallions and Spiritual Stones can only appear outside dungeons.");
break;
case 3:
InsertHelpHoverText("Medallions and Spiritual Stones can appear anywhere.");
UIWidgets::InsertHelpHoverText("Medallions and Spiritual Stones can appear anywhere.");
break;
}
SohImGui::EnhancementCombobox("gRandomizeShuffleDungeonReward", randoShuffleDungeonRewards, 4,
UIWidgets::EnhancementCombobox("gRandomizeShuffleDungeonReward", randoShuffleDungeonRewards, 4,
0);
// todo: support non dungeon rewards for link's pocket
@ -3748,10 +3748,10 @@ void DrawRandoEditor(bool& open) {
ImGui::Text("Shuffle Songs");
switch (CVar_GetS32("gRandomizeShuffleSongs", 0)) {
case 0:
InsertHelpHoverText("Songs will only appear at locations that normally teach songs.");
UIWidgets::InsertHelpHoverText("Songs will only appear at locations that normally teach songs.");
break;
case 1:
InsertHelpHoverText("Songs appear at the end of dungeons.\nFor major dungeons, they "
UIWidgets::InsertHelpHoverText("Songs appear at the end of dungeons.\nFor major dungeons, they "
"will be at the boss heart container location.\nThe remaining 4 "
"songs are placed at:\n- Zelda's Lullaby location\n"
"- Ice Cavern's Serenade of Water Location\n"
@ -3759,10 +3759,10 @@ void DrawRandoEditor(bool& open) {
"- Gerudo Training Ground's Ice Arrow Location.");
break;
case 2:
InsertHelpHoverText("Songs can appear in any location");
UIWidgets::InsertHelpHoverText("Songs can appear in any location");
break;
}
SohImGui::EnhancementCombobox("gRandomizeShuffleSongs", randoShuffleSongs, 3, 0);
UIWidgets::EnhancementCombobox("gRandomizeShuffleSongs", randoShuffleSongs, 3, 0);
ImGui::Separator();
// todo implement shops
@ -3863,19 +3863,19 @@ void DrawRandoEditor(bool& open) {
if(CVar_GetS32("gRandomizeStartingKokiriSword", 0) == 0) {
// Shuffle Kokiri Sword
ImGui::Text("Shuffle Kokiri Sword");
InsertHelpHoverText("Enabling this shuffles the Kokiri Sword into the item pool.\nThis will "
UIWidgets::InsertHelpHoverText("Enabling this shuffles the Kokiri Sword into the item pool.\nThis will "
"require extensive use of sticks until the sword is found.");
SohImGui::EnhancementCombobox("gRandomizeShuffleKokiriSword", randoShuffleKokiriSword, 2, 0);
UIWidgets::EnhancementCombobox("gRandomizeShuffleKokiriSword", randoShuffleKokiriSword, 2, 0);
ImGui::Separator();
}
if(CVar_GetS32("gRandomizeStartingOcarina", 0) == 0) {
// Shuffle Ocarinas
ImGui::Text("Shuffle Ocarinas");
InsertHelpHoverText("Enabling this shuffles the Fairy Ocarina and the Ocarina of time into "
UIWidgets::InsertHelpHoverText("Enabling this shuffles the Fairy Ocarina and the Ocarina of time into "
"the item pool.\n"
"This will require finding an Ocarina before being able to play songs.");
SohImGui::EnhancementCombobox("gRandomizeShuffleOcarinas", randoShuffleOcarinas, 2, 0);
UIWidgets::EnhancementCombobox("gRandomizeShuffleOcarinas", randoShuffleOcarinas, 2, 0);
ImGui::Separator();
}
@ -3883,22 +3883,22 @@ void DrawRandoEditor(bool& open) {
if(CVar_GetS32("gRandomizeSkipChildZelda", 0) == 0) {
// Shuffle Weird Egg
ImGui::Text("Shuffle Weird Egg");
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"Enabling this shuffles the Weird Egg from Malon into the item pool.\nThis "
"will require finding the Weird Egg to talk to Zelda in Hyrule Castle which "
"in turn unlocks rewards from Impa, Saria, Malon and Talon as well as the "
"Happy Mask Sidequest.\nThe Weird egg is also required for Zelda's Letter to "
"unlock the Kakariko Gate as child which can lock some progression.");
SohImGui::EnhancementCombobox("gRandomizeShuffleWeirdEgg", randoShuffleWeirdEgg, 2, 0);
UIWidgets::EnhancementCombobox("gRandomizeShuffleWeirdEgg", randoShuffleWeirdEgg, 2, 0);
ImGui::Separator();
}
// Shuffle Gerudo Membership Card
ImGui::Text("Shuffle Gerudo Membership Card");
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"Enabling this shuffles the Gerudo Membership Card into the item pool.\nThe Gerudo "
"Token is required to enter the Gerudo Training Ground.");
SohImGui::EnhancementCombobox("gRandomizeShuffleGerudoToken", randoShuffleGerudoToken, 2, 0);
UIWidgets::EnhancementCombobox("gRandomizeShuffleGerudoToken", randoShuffleGerudoToken, 2, 0);
ImGui::Separator();
// todo implement magic bean 10 pack
@ -3939,14 +3939,14 @@ void DrawRandoEditor(bool& open) {
ImGui::PopItemWidth();
ImGui::TableNextColumn();
SohImGui::EnhancementCheckbox("Start with Fairy Ocarina", "gRandomizeStartingOcarina");
SohImGui::EnhancementCheckbox("Start with Kokiri Sword", "gRandomizeStartingKokiriSword");
SohImGui::EnhancementCheckbox("Start with Deku Shield", "gRandomizeStartingDekuShield");
SohImGui::EnhancementCheckbox("Start with Maps/Compasses", "gRandomizeStartingMapsCompasses");
SohImGui::EnhancementCheckbox("Skip Child Zelda", "gRandomizeSkipChildZelda");
SohImGui::EnhancementCheckbox("Start with Consumables", "gRandomizeStartingConsumables");
SohImGui::EnhancementCheckbox("Full Wallets", "gRandomizeFullWallets");
InsertHelpHoverText("Start with a full wallet. All wallet upgrades come filled with rupees.");
UIWidgets::EnhancementCheckbox("Start with Fairy Ocarina", "gRandomizeStartingOcarina");
UIWidgets::EnhancementCheckbox("Start with Kokiri Sword", "gRandomizeStartingKokiriSword");
UIWidgets::EnhancementCheckbox("Start with Deku Shield", "gRandomizeStartingDekuShield");
UIWidgets::EnhancementCheckbox("Start with Maps/Compasses", "gRandomizeStartingMapsCompasses");
UIWidgets::EnhancementCheckbox("Skip Child Zelda", "gRandomizeSkipChildZelda");
UIWidgets::EnhancementCheckbox("Start with Consumables", "gRandomizeStartingConsumables");
UIWidgets::EnhancementCheckbox("Full Wallets", "gRandomizeFullWallets");
UIWidgets::InsertHelpHoverText("Start with a full wallet. All wallet upgrades come filled with rupees.");
// todo dungeon items stuff (more details in commented out block)
// ImGui::TableNextColumn();
@ -4088,19 +4088,19 @@ void DrawRandoEditor(bool& open) {
// Ganon's Boss Key
ImGui::PushItemWidth(-FLT_MIN);
ImGui::Text("Ganon's Boss Key");
SohImGui::EnhancementCombobox("gRandomizeShuffleGanonBossKey", randoShuffleGanonsBossKey, 3,
UIWidgets::EnhancementCombobox("gRandomizeShuffleGanonBossKey", randoShuffleGanonsBossKey, 3,
0);
switch (CVar_GetS32("gRandomizeShuffleGanonBossKey", 0)) {
case 0:
SetLastItemHoverText(
UIWidgets::SetLastItemHoverText(
"Ganon's Boss Key is given to you from the start and you don't "
"have to worry about finding it.");
break;
case 1:
SetLastItemHoverText("Ganon's Boss Key will appear in the vanilla location.");
UIWidgets::SetLastItemHoverText("Ganon's Boss Key will appear in the vanilla location.");
break;
case 2:
SetLastItemHoverText("Ganon's Boss Key will appear somewhere inside Ganon's Castle.");
UIWidgets::SetLastItemHoverText("Ganon's Boss Key will appear somewhere inside Ganon's Castle.");
break;
// case 0:
// SetLastItemHoverText(
@ -4219,30 +4219,30 @@ void DrawRandoEditor(bool& open) {
// ImGui::Separator();
// Cuccos to return
SohImGui::EnhancementSliderInt("Cuccos to return: %d", "##RandoCuccosToReturn",
UIWidgets::EnhancementSliderInt("Cuccos to return: %d", "##RandoCuccosToReturn",
"gRandomizeCuccosToReturn", 0, 7, "", 7);
InsertHelpHoverText("The cucco Lady will give a reward for returning this many of her cuccos to the pen.");
UIWidgets::InsertHelpHoverText("The cucco Lady will give a reward for returning this many of her cuccos to the pen.");
ImGui::Separator();
// // Big Poe Target Count
SohImGui::EnhancementSliderInt("Big Poe Target Count: %d", "##RandoBigPoeTargetCount",
UIWidgets::EnhancementSliderInt("Big Poe Target Count: %d", "##RandoBigPoeTargetCount",
"gRandomizeBigPoeTargetCount", 1, 10, "", 10);
InsertHelpHoverText("The Poe buyer will give a reward for turning in the chosen number of Big Poes.");
UIWidgets::InsertHelpHoverText("The Poe buyer will give a reward for turning in the chosen number of Big Poes.");
ImGui::Separator();
// // Skip child stealth
SohImGui::EnhancementCheckbox("Skip Child Stealth", "gRandomizeSkipChildStealth");
InsertHelpHoverText("The crawlspace into Hyrule Castle goes straight to Zelda, skipping the guards.");
UIWidgets::EnhancementCheckbox("Skip Child Stealth", "gRandomizeSkipChildStealth");
UIWidgets::InsertHelpHoverText("The crawlspace into Hyrule Castle goes straight to Zelda, skipping the guards.");
ImGui::Separator();
// Skip Epona race
SohImGui::EnhancementCheckbox("Skip Epona Race", "gRandomizeSkipEponaRace");
InsertHelpHoverText("Epona can be summoned with Epona's Song without needing to race Ingo.");
UIWidgets::EnhancementCheckbox("Skip Epona Race", "gRandomizeSkipEponaRace");
UIWidgets::InsertHelpHoverText("Epona can be summoned with Epona's Song without needing to race Ingo.");
ImGui::Separator();
// Skip tower escape
SohImGui::EnhancementCheckbox("Skip Tower Escape", "gRandomizeSkipTowerEscape");
InsertHelpHoverText("The tower escape sequence between Ganondorf and Ganon will be skipped.");
UIWidgets::EnhancementCheckbox("Skip Tower Escape", "gRandomizeSkipTowerEscape");
UIWidgets::InsertHelpHoverText("The tower escape sequence between Ganondorf and Ganon will be skipped.");
ImGui::Separator();
// todo implement complete mask quest
@ -4275,53 +4275,53 @@ void DrawRandoEditor(bool& open) {
ImGui::PushItemWidth(-FLT_MIN);
// Gossip Stone Hints
ImGui::Text("Gossip Stone Hints");
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"Gossip Stones can be made to give hints about where items can be found.\nDifferent settings can "
"be chosen to decide which item is needed to speak to Gossip Stones. \nChoosing to stick with the "
"Mask of Truth will make the hints very difficult to obtain.\nHints for \"on the way of the "
"hero\" are locations that contain items that are required to beat the game.");
SohImGui::EnhancementCombobox("gRandomizeGossipStoneHints", randoGossipStoneHints, 4, 1);
UIWidgets::EnhancementCombobox("gRandomizeGossipStoneHints", randoGossipStoneHints, 4, 1);
if (CVar_GetS32("gRandomizeGossipStoneHints", 1) != 0) {
// Hint Clarity
ImGui::Indent();
ImGui::Text("Hint Clarity");
switch (CVar_GetS32("gRandomizeHintClarity", 2)) {
case 0:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"Sets the difficulty of hints.\nObscure: Hints are unique for each thing, but the "
"writing may be confusing.\nEx: Kokiri Sword > a butter knife");
break;
case 1:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"Sets the difficulty of hints.\nAmbiguous: Hints are clearly written, "
"but may refer to more than one thing.\nEx: Kokiri Sword > a sword");
break;
case 2:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"Sets the difficulty of hints.\nClear: Hints are clearly written and "
"are unique for each thing.\nEx: Kokiri Sword > the Kokiri Sword");
break;
}
SohImGui::EnhancementCombobox("gRandomizeHintClarity", randoHintClarity, 3, 2);
UIWidgets::EnhancementCombobox("gRandomizeHintClarity", randoHintClarity, 3, 2);
// Hint Distribution
ImGui::Text("Hint Distribution");
switch (CVar_GetS32("gRandomizeHintDistribution", 1)) {
case 0:
InsertHelpHoverText("Only junk hints.");
UIWidgets::InsertHelpHoverText("Only junk hints.");
break;
case 1:
InsertHelpHoverText("Recommended hint spread.");
UIWidgets::InsertHelpHoverText("Recommended hint spread.");
break;
case 2:
InsertHelpHoverText("More useful hints.");
UIWidgets::InsertHelpHoverText("More useful hints.");
break;
case 3:
InsertHelpHoverText("Many powerful hints.");
UIWidgets::InsertHelpHoverText("Many powerful hints.");
break;
}
SohImGui::EnhancementCombobox("gRandomizeHintDistribution", randoHintDistribution, 4, 1);
UIWidgets::EnhancementCombobox("gRandomizeHintDistribution", randoHintDistribution, 4, 1);
ImGui::Unindent();
}
ImGui::Separator();
@ -4375,43 +4375,43 @@ void DrawRandoEditor(bool& open) {
ImGui::Text("Item Pool");
switch (CVar_GetS32("gRandomizeItemPool", 1)) {
case 0:
InsertHelpHoverText("Extra major items are added to the pool.");
UIWidgets::InsertHelpHoverText("Extra major items are added to the pool.");
break;
case 1:
InsertHelpHoverText("Original item pool.");
UIWidgets::InsertHelpHoverText("Original item pool.");
break;
case 2:
InsertHelpHoverText("Some excess items are removed, including health upgrades.");
UIWidgets::InsertHelpHoverText("Some excess items are removed, including health upgrades.");
break;
case 3:
InsertHelpHoverText("Most excess items are removed.");
UIWidgets::InsertHelpHoverText("Most excess items are removed.");
break;
}
SohImGui::EnhancementCombobox("gRandomizeItemPool", randoItemPool, 4, 1);
UIWidgets::EnhancementCombobox("gRandomizeItemPool", randoItemPool, 4, 1);
ImGui::Separator();
// // Ice Traps
ImGui::Text("Ice Traps");
switch (CVar_GetS32("gRandomizeIceTraps", 1)) {
case 0:
InsertHelpHoverText("All Ice Traps are removed.");
UIWidgets::InsertHelpHoverText("All Ice Traps are removed.");
break;
case 1:
InsertHelpHoverText("Only Ice Traps from the base item pool are placed.");
UIWidgets::InsertHelpHoverText("Only Ice Traps from the base item pool are placed.");
break;
case 2:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"Chance to add extra Ice Traps when junk items are added to the item pool.");
break;
case 3:
InsertHelpHoverText("All added junk items will be Ice Traps.");
UIWidgets::InsertHelpHoverText("All added junk items will be Ice Traps.");
break;
case 4:
InsertHelpHoverText(
UIWidgets::InsertHelpHoverText(
"All junk items will be replaced by Ice Traps, even those in the base pool.");
break;
}
SohImGui::EnhancementCombobox("gRandomizeIceTraps", randoIceTraps, 5, 1);
UIWidgets::EnhancementCombobox("gRandomizeIceTraps", randoIceTraps, 5, 1);
ImGui::Separator();
// todo implement double defense getitem
@ -4450,17 +4450,17 @@ void DrawRandoEditor(bool& open) {
ImGui::TableNextColumn();
// COLUMN 2 - OPEN EXCLUDE LOCATIONS
ImGui::NewLine();
SohImGui::EnhancementCheckbox("Deku Theater Mask of Truth", "gRandomizeExcludeDekuTheaterMaskOfTruth");
UIWidgets::EnhancementCheckbox("Deku Theater Mask of Truth", "gRandomizeExcludeDekuTheaterMaskOfTruth");
ImGui::NewLine();
SohImGui::EnhancementCheckbox("10 Skulltula Reward", "gRandomizeExcludeKak10SkullReward");
UIWidgets::EnhancementCheckbox("10 Skulltula Reward", "gRandomizeExcludeKak10SkullReward");
ImGui::NewLine();
SohImGui::EnhancementCheckbox("20 Skulltula Reward", "gRandomizeExcludeKak20SkullReward");
UIWidgets::EnhancementCheckbox("20 Skulltula Reward", "gRandomizeExcludeKak20SkullReward");
ImGui::NewLine();
SohImGui::EnhancementCheckbox("30 Skulltula Reward", "gRandomizeExcludeKak30SkullReward");
UIWidgets::EnhancementCheckbox("30 Skulltula Reward", "gRandomizeExcludeKak30SkullReward");
ImGui::NewLine();
SohImGui::EnhancementCheckbox("40 Skulltula Reward", "gRandomizeExcludeKak40SkullReward");
UIWidgets::EnhancementCheckbox("40 Skulltula Reward", "gRandomizeExcludeKak40SkullReward");
ImGui::NewLine();
SohImGui::EnhancementCheckbox("50 Skulltula Reward", "gRandomizeExcludeKak50SkullReward");
UIWidgets::EnhancementCheckbox("50 Skulltula Reward", "gRandomizeExcludeKak50SkullReward");
// ImGui::TableNextColumn();
// // COLUMN 3 - LOGICAL TRICKS
// ImGui::NewLine();

View File

@ -1,13 +1,13 @@
#include "randomizer_item_tracker.h"
#include "../../util.h"
#include "../libultraship/ImGuiImpl.h"
#include <soh/Enhancements/debugger/ImGuiHelpers.h>
#include <libultraship/ImGuiImpl.h>
#include "../../UIWidgets.hpp"
#include <array>
#include <bit>
#include <map>
#include <string>
#include <Cvar.h>
#include <libultraship/Cvar.h>
extern "C" {
#include <z64.h>
@ -20,6 +20,7 @@ extern GlobalContext* gGlobalCtx;
#include "textures/icon_item_24_static/icon_item_24_static.h"
}
typedef struct {
uint32_t id;
std::string name;
@ -252,7 +253,7 @@ void DrawEquip(uint32_t itemId) {
ImGui::Image(SohImGui::GetTextureByName(hasEquip ? entry.name : entry.nameFaded), ImVec2(iconSize, iconSize),
ImVec2(0, 0), ImVec2(1, 1));
SetLastItemHoverText(SohUtils::GetItemName(entry.id));
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(entry.id));
}
std::unordered_map<uint32_t, ItemTrackerMapEntry> questTrackerMap = {
@ -300,7 +301,7 @@ void DrawQuest(uint32_t itemId) {
ImGui::EndGroup();
SetLastItemHoverText(SohUtils::GetQuestItemName(entry.id));
UIWidgets::SetLastItemHoverText(SohUtils::GetQuestItemName(entry.id));
};
std::unordered_map<uint32_t, ItemTrackerMapEntry> itemTrackerMap = {
@ -677,7 +678,7 @@ void DrawItem(uint32_t itemId) {
}
ImGui::EndGroup();
SetLastItemHoverText(SohUtils::GetItemName(entry.id));
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(entry.id));
}
void DrawBottle(uint32_t itemId, uint32_t bottleSlot) {
@ -688,7 +689,7 @@ void DrawBottle(uint32_t itemId, uint32_t bottleSlot) {
ImGui::Image(SohImGui::GetTextureByName(hasItem ? entry.name : entry.nameFaded), ImVec2(iconSize, iconSize),
ImVec2(0, 0), ImVec2(1, 1));
SetLastItemHoverText(SohUtils::GetItemName(entry.id));
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(entry.id));
};
typedef struct {
@ -733,12 +734,12 @@ void DrawUpgrade(int32_t categoryId) {
const ItemTrackerUpgradeEntry& entry = upgradeTrackerMap[categoryId][0];
ImGui::Image(SohImGui::GetTextureByName(entry.nameFaded), ImVec2(iconSize, iconSize),
ImVec2(0, 0), ImVec2(1, 1));
SetLastItemHoverText(SohUtils::GetItemName(entry.id));
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(entry.id));
} else {
const ItemTrackerUpgradeEntry& entry = upgradeTrackerMap[categoryId][CUR_UPG_VALUE(categoryId) - 1];
ImGui::Image(SohImGui::GetTextureByName(entry.name), ImVec2(iconSize, iconSize),
ImVec2(0, 0), ImVec2(1, 1));
SetLastItemHoverText(SohUtils::GetItemName(entry.id));
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(entry.id));
}
}
@ -804,7 +805,7 @@ void DrawSong(int32_t songId) {
bool hasSong = (bitMask & gSaveContext.inventory.questItems) != 0;
ImGui::Image(SohImGui::GetTextureByName(hasSong ? entry.name : entry.nameFaded), ImVec2(iconSize/1.5, iconSize),
ImVec2(0, 0), ImVec2(1, 1));
SetLastItemHoverText(SohUtils::GetQuestItemName(entry.id));
UIWidgets::SetLastItemHoverText(SohUtils::GetQuestItemName(entry.id));
}
void DrawItemTracker(bool& open) {
@ -983,12 +984,12 @@ void DrawItemTracker(bool& open) {
} else {
minimalSpacingX = 32;
}
SohImGui::EnhancementCheckbox("Display \"Ammo/MaxAmo\"", "gItemTrackerAmmoDisplay");
SohImGui::EnhancementCheckbox("Randomizer colors for Songs", "gItemTrackeSongColor");
SohImGui::Tooltip("Will display non-warp songs with randomizer colors instead of pure white");
SohImGui::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", "gRandoTrackIconSize", 32, 128, "");
UIWidgets::EnhancementCheckbox("Display \"Ammo/MaxAmo\"", "gItemTrackerAmmoDisplay");
UIWidgets::EnhancementCheckbox("Randomizer colors for Songs", "gItemTrackeSongColor");
UIWidgets::Tooltip("Will display non-warp songs with randomizer colors instead of pure white");
UIWidgets::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", "gRandoTrackIconSize", 32, 128, "");
SohImGui::EnhancementSliderInt("X spacing : %dpx", "##ITEMTRACKERSPACINGX", "gRandoTrackIconSpacingX", minimalSpacingX, 256,
UIWidgets::EnhancementSliderInt("X spacing : %dpx", "##ITEMTRACKERSPACINGX", "gRandoTrackIconSpacingX", minimalSpacingX, 256,
"");
// SohImGui::EnhancementSliderInt("Y Spacing : %dpx", "##ITEMTRACKERSPACINGY", "gRandoTrackIconSpacingY", 0,
// 16, "");

View File

@ -1,6 +1,6 @@
#include "savestates.h"
#include "GameVersions.h"
#include <libultraship/GameVersions.h>
#include <cstdio> // std::sprintf
@ -9,7 +9,7 @@
#include <soh/OTRGlobals.h>
#include <soh/OTRAudio.h>
#include <ImGuiImpl.h>
#include <libultraship/ImGuiImpl.h>
#include "z64.h"
#include "z64save.h"
@ -823,7 +823,7 @@ extern "C" void ProcessSaveStateRequests(void) {
}
void SaveStateMgr::SetCurrentSlot(unsigned int slot) {
SohImGui::overlay->TextDrawNotification(1.0f, true, "slot %u set", slot);
SohImGui::GetGameOverlay()->TextDrawNotification(1.0f, true, "slot %u set", slot);
this->currentSlot = slot;
}
@ -841,12 +841,12 @@ void SaveStateMgr::ProcessSaveStateRequests(void) {
this->states[request.slot] = std::make_shared<SaveState>(OTRGlobals::Instance->gSaveStateMgr, request.slot);
}
this->states[request.slot]->Save();
SohImGui::overlay->TextDrawNotification(1.0f, true, "saved state %u", request.slot);
SohImGui::GetGameOverlay()->TextDrawNotification(1.0f, true, "saved state %u", request.slot);
break;
case RequestType::LOAD:
if (this->states.contains(request.slot)) {
this->states[request.slot]->Load();
SohImGui::overlay->TextDrawNotification(1.0f, true, "loaded state %u", request.slot);
SohImGui::GetGameOverlay()->TextDrawNotification(1.0f, true, "loaded state %u", request.slot);
} else {
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
}
@ -862,7 +862,7 @@ void SaveStateMgr::ProcessSaveStateRequests(void) {
SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
if (gGlobalCtx == nullptr) {
SPDLOG_ERROR("[SOH] Can not save or load a state outside of \"GamePlay\"");
SohImGui::overlay->TextDrawNotification(1.0f, true, "states not available here", request.slot);
SohImGui::GetGameOverlay()->TextDrawNotification(1.0f, true, "states not available here", request.slot);
return SaveStateReturn::FAIL_WRONG_GAMESTATE;
}
@ -876,7 +876,7 @@ SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
return SaveStateReturn::SUCCESS;
} else {
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
SohImGui::overlay->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot);
SohImGui::GetGameOverlay()->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot);
return SaveStateReturn::FAIL_INVALID_SLOT;
}
[[unlikely]] default:

1367
soh/soh/GameMenuBar.cpp Normal file

File diff suppressed because it is too large Load Diff

27
soh/soh/GameMenuBar.hpp Normal file
View File

@ -0,0 +1,27 @@
//
// GameMenuBar.hpp
// soh
//
// Created by David Chavez on 24.08.22.
//
#ifndef GameMenuBar_hpp
#define GameMenuBar_hpp
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
void enableBetaQuest();
void disableBetaQuest();
#ifdef __cplusplus
}
#endif
namespace GameMenuBar {
void SetupHooks();
void Draw();
}
#endif /* GameMenuBar_hpp */

View File

@ -5,45 +5,45 @@
#include <filesystem>
#include <fstream>
#include "ResourceMgr.h"
#include "DisplayList.h"
#include "PlayerAnimation.h"
#include "Skeleton.h"
#include "Window.h"
#include <libultraship/ResourceMgr.h>
#include <libultraship/DisplayList.h>
#include <libultraship/PlayerAnimation.h>
#include <libultraship/Skeleton.h>
#include <libultraship/Window.h>
#include "z64animation.h"
#include "z64bgcheck.h"
#include "Enhancements/gameconsole.h"
#include <ultra64/gbi.h>
#include <Animation.h>
#include <libultraship/Animation.h>
#ifdef _WIN32
#include <Windows.h>
#else
#include <time.h>
#endif
#include <CollisionHeader.h>
#include <Array.h>
#include <Cutscene.h>
#include "Lib/stb/stb_image.h"
#include <libultraship/CollisionHeader.h>
#include <libultraship/Array.h>
#include <libultraship/Cutscene.h>
#include <stb/stb_image.h>
#define DRMP3_IMPLEMENTATION
#include "Lib/dr_libs/mp3.h"
#include <dr_libs/mp3.h>
#define DRWAV_IMPLEMENTATION
#include "Lib/dr_libs/wav.h"
#include "AudioPlayer.h"
#include <dr_libs/wav.h>
#include <libultraship/AudioPlayer.h>
#include "Enhancements/controls/GameControlEditor.h"
#include "Enhancements/cosmetics/CosmeticsEditor.h"
#include "Enhancements/debugconsole.h"
#include "Enhancements/debugger/debugger.h"
#include <soh/Enhancements/randomizer/randomizer_item_tracker.h>
#include "Enhancements/randomizer/randomizer_item_tracker.h"
#include "Enhancements/n64_weird_frame_data.inc"
#include "soh/frame_interpolation.h"
#include "frame_interpolation.h"
#include "variables.h"
#include "macros.h"
#include <Utils/StringHelper.h>
#include "Hooks.h"
#include <soh/Enhancements/custom-message/CustomMessageManager.h>
#include <libultraship/Hooks.h>
#include "Enhancements/custom-message/CustomMessageManager.h"
#include "Lib/Fast3D/gfx_pc.h"
#include "Lib/Fast3D/gfx_rendering_api.h"
#include <Fast3D/gfx_pc.h>
#include <Fast3D/gfx_rendering_api.h>
#ifdef __APPLE__
#include <SDL_scancode.h>
@ -52,15 +52,16 @@
#endif
#ifdef __SWITCH__
#include "SwitchImpl.h"
#include <libultraship/SwitchImpl.h>
#elif defined(__WIIU__)
#include "WiiUImpl.h"
#include <libultraship/WiiUImpl.h>
#endif
#include <Audio.h>
#include <soh/Enhancements/custom-message/CustomMessageTypes.h>
#include <libultraship/Audio.h>
#include "Enhancements/custom-message/CustomMessageTypes.h"
#include <functions.h>
#include <soh/Enhancements/item-tables/ItemTableManager.h>
#include "Enhancements/item-tables/ItemTableManager.h"
#include "GameMenuBar.hpp"
OTRGlobals* OTRGlobals::Instance;
SaveManager* SaveManager::Instance;
@ -321,6 +322,9 @@ extern "C" void InitOTR() {
#elif defined(__WIIU__)
Ship::WiiU::Init();
#endif
SohImGui::AddSetupHooksDelegate(GameMenuBar::SetupHooks);
SohImGui::RegisterMenuDrawMethod(GameMenuBar::Draw);
OTRGlobals::Instance = new OTRGlobals();
SaveManager::Instance = new SaveManager();
CustomMessageManager::Instance = new CustomMessageManager();

View File

@ -7,7 +7,7 @@
#include <soh/Enhancements/item-tables/ItemTableTypes.h>
#ifdef __cplusplus
#include "Window.h"
#include <libultraship/Window.h>
#include "Enhancements/savestates.h"
#include "Enhancements/randomizer/randomizer.h"

View File

@ -4,7 +4,7 @@
#include "z64.h"
#include "functions.h"
#include "macros.h"
#include "Cvar.h"
#include <libultraship/Cvar.h>
#define NOGDI // avoid various windows defines that conflict with things in z64.h
#include "spdlog/spdlog.h"

View File

@ -23,7 +23,7 @@ typedef struct {
#include <vector>
#include <filesystem>
#include "Lib/nlohmann/json.hpp"
#include <nlohmann/json.hpp>
class SaveManager {
public:

523
soh/soh/UIWidgets.cpp Normal file
View File

@ -0,0 +1,523 @@
//
// UIWidgets.cpp
// soh
//
// Created by David Chavez on 25.08.22.
//
#include "UIWidgets.hpp"
#define IMGUI_DEFINE_MATH_OPERATORS
#include <ImGui/imgui_internal.h>
#include <libultraship/ImGuiImpl.h>
#include <libultraship/Cvar.h>
#include <ultra64/types.h>
namespace UIWidgets {
// MARK: - Layout Helper
// Automatically adds newlines to break up text longer than a specified number of characters
// Manually included newlines will still be respected and reset the line length
// If line is midword when it hits the limit, text should break at the last encountered space
char* WrappedText(const char* text, unsigned int charactersPerLine) {
std::string newText(text);
const size_t tipLength = newText.length();
int lastSpace = -1;
size_t currentLineLength = 0;
for (unsigned int currentCharacter = 0; currentCharacter < tipLength; currentCharacter++) {
if (newText[currentCharacter] == '\n') {
currentLineLength = 0;
lastSpace = -1;
continue;
} else if (newText[currentCharacter] == ' ') {
lastSpace = currentCharacter;
}
if ((currentLineLength >= charactersPerLine) && (lastSpace >= 0)) {
newText[lastSpace] = '\n';
currentLineLength = currentCharacter - lastSpace - 1;
lastSpace = -1;
}
currentLineLength++;
}
return strdup(newText.c_str());
}
char* WrappedText(const std::string& text, unsigned int charactersPerLine) {
return WrappedText(text.c_str(), charactersPerLine);
}
void LoadPickersColors(ImVec4& ColorArray, const char* cvarname, const ImVec4& default_colors, bool has_alpha)
{
Color_RGBA8 defaultColors;
defaultColors.r = default_colors.x;
defaultColors.g = default_colors.y;
defaultColors.b = default_colors.z;
defaultColors.a = default_colors.w;
Color_RGBA8 cvarColor = CVar_GetRGBA(cvarname, defaultColors);
ColorArray.x = cvarColor.r / 255.0;
ColorArray.y = cvarColor.g / 255.0;
ColorArray.z = cvarColor.b / 255.0;
ColorArray.w = cvarColor.a / 255.0;
}
void SetLastItemHoverText(const std::string& text) {
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::Text("%s", WrappedText(text, 60));
ImGui::EndTooltip();
}
}
// Adds a "?" next to the previous ImGui item with a custom tooltip
void InsertHelpHoverText(const std::string& text) {
ImGui::SameLine();
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "?");
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::Text("%s", WrappedText(text, 60));
ImGui::EndTooltip();
}
}
// MARK: - UI Elements
void Tooltip(const char* text) {
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("%s", WrappedText(text));
}
}
void Spacer(float height) {
ImGui::Dummy(ImVec2(0.0f, height));
}
void PaddedSeparator(bool padTop, bool padBottom, float extraVerticalTopPadding, float extraVerticalBottomPadding) {
if (padTop)
Spacer(0);
ImGui::Separator();
if (padBottom)
Spacer(0);
}
void RenderCross(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float sz) {
float thickness = ImMax(sz / 5.0f, 1.0f);
sz -= thickness * 0.5f;
pos += ImVec2(thickness * 0.25f, thickness * 0.25f);
draw_list->PathLineTo(ImVec2(pos.x, pos.y));
draw_list->PathLineTo(ImVec2(pos.x + sz, pos.y + sz));
draw_list->PathStroke(col, 0, thickness);
draw_list->PathLineTo(ImVec2(pos.x + sz, pos.y));
draw_list->PathLineTo(ImVec2(pos.x, pos.y + sz));
draw_list->PathStroke(col, 0, thickness);
}
bool CustomCheckbox(const char* label, bool* v, bool disabled, CheckboxGraphics disabledGraphic) {
ImGuiWindow* window = ImGui::GetCurrentWindow();
if (window->SkipItems)
return false;
ImGuiContext& g = *GImGui;
const ImGuiStyle& style = g.Style;
const ImGuiID id = window->GetID(label);
const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
const float square_sz = ImGui::GetFrameHeight();
const ImVec2 pos = window->DC.CursorPos;
const ImRect total_bb(pos, pos + ImVec2(square_sz + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), label_size.y + style.FramePadding.y * 2.0f));
ImGui::ItemSize(total_bb, style.FramePadding.y);
if (!ImGui::ItemAdd(total_bb, id)) {
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
return false;
}
bool hovered, held;
bool pressed = ImGui::ButtonBehavior(total_bb, id, &hovered, &held);
if (pressed) {
*v = !(*v);
ImGui::MarkItemEdited(id);
}
const ImRect check_bb(pos, pos + ImVec2(square_sz, square_sz));
ImGui::RenderNavHighlight(total_bb, id);
ImGui::RenderFrame(check_bb.Min, check_bb.Max, ImGui::GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding);
ImU32 check_col = ImGui::GetColorU32(ImGuiCol_CheckMark);
ImU32 cross_col = ImGui::GetColorU32(ImVec4(0.50f, 0.50f, 0.50f, 1.00f));
bool mixed_value = (g.LastItemData.InFlags & ImGuiItemFlags_MixedValue) != 0;
if (mixed_value) {
// Undocumented tristate/mixed/indeterminate checkbox (#2644)
// This may seem awkwardly designed because the aim is to make ImGuiItemFlags_MixedValue supported by all widgets (not just checkbox)
ImVec2 pad(ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)), ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)));
window->DrawList->AddRectFilled(check_bb.Min + pad, check_bb.Max - pad, check_col, style.FrameRounding);
} else if ((!disabled && *v) || (disabled && disabledGraphic == CheckboxGraphics::Checkmark)) {
const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f));
ImGui::RenderCheckMark(window->DrawList, check_bb.Min + ImVec2(pad, pad), check_col, square_sz - pad * 2.0f);
} else if (disabled && disabledGraphic == CheckboxGraphics::Cross) {
const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f));
RenderCross(window->DrawList, check_bb.Min + ImVec2(pad, pad), cross_col, square_sz - pad * 2.0f);
}
ImVec2 label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y);
if (g.LogEnabled)
ImGui::LogRenderedText(&label_pos, mixed_value ? "[~]" : *v ? "[x]" : "[ ]");
if (label_size.x > 0.0f)
ImGui::RenderText(label_pos, label);
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
return pressed;
}
void EnhancementCheckbox(const char* text, const char* cvarName, bool disabled, const char* disabledTooltipText, CheckboxGraphics disabledGraphic) {
if (disabled) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
}
bool val = (bool)CVar_GetS32(cvarName, 0);
if (CustomCheckbox(text, &val, disabled, disabledGraphic)) {
CVar_SetS32(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
}
if (disabled) {
ImGui::PopStyleVar(1);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && strcmp(disabledTooltipText, "") != 0) {
ImGui::SetTooltip("%s", disabledTooltipText);
}
ImGui::PopItemFlag();
}
}
void PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop, bool padBottom, bool disabled, const char* disabledTooltipText, CheckboxGraphics disabledGraphic) {
if (padTop) Spacer(0);
EnhancementCheckbox(text, cvarName, disabled, disabledTooltipText, disabledGraphic);
if (padBottom) Spacer(0);
}
void EnhancementCombo(const std::string& name, const char* cvarName, const std::vector<std::string>& items, int defaultValue) {
if (ImGui::BeginCombo(name.c_str(), items[static_cast<int>(CVar_GetS32(cvarName, defaultValue))].c_str())) {
for (int settingIndex = 0; settingIndex < (int) items.size(); settingIndex++) {
if (ImGui::Selectable(items[settingIndex].c_str())) {
CVar_SetS32(cvarName, settingIndex);
SohImGui::RequestCvarSaveOnNextTick();
}
}
ImGui::EndCombo();
}
}
void EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue) {
if (FirstTimeValue <= 0) {
FirstTimeValue = 0;
}
uint8_t selected = CVar_GetS32(name, FirstTimeValue);
uint8_t DefaultValue = selected;
std::string comboName = std::string("##") + std::string(name);
if (ImGui::BeginCombo(comboName.c_str(), ComboArray[DefaultValue])) {
for (uint8_t i = 0; i < arraySize; i++) {
if (strlen(ComboArray[i]) > 1) {
if (ImGui::Selectable(ComboArray[i], i == selected)) {
CVar_SetS32(name, i);
selected = i;
SohImGui::RequestCvarSaveOnNextTick();
}
}
}
ImGui::EndCombo();
}
}
void PaddedText(const char* text, bool padTop, bool padBottom) {
if (padTop)
Spacer(0);
ImGui::Text("%s", text);
if (padBottom)
Spacer(0);
}
void EnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue, bool PlusMinusButton) {
int val = CVar_GetS32(cvarName, defaultValue);
ImGui::Text(text, val);
if(PlusMinusButton) {
std::string MinusBTNName = " - ##";
MinusBTNName += cvarName;
if (ImGui::Button(MinusBTNName.c_str())) {
val--;
CVar_SetS32(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
}
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
}
if (ImGui::SliderInt(id, &val, min, max, format))
{
CVar_SetS32(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
}
if(PlusMinusButton) {
std::string PlusBTNName = " + ##";
PlusBTNName += cvarName;
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
if (ImGui::Button(PlusBTNName.c_str())) {
val++;
CVar_SetS32(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
}
}
if (val < min)
{
val = min;
CVar_SetS32(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
}
if (val > max)
{
val = max;
CVar_SetS32(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
}
}
void EnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage, bool PlusMinusButton) {
float val = CVar_GetFloat(cvarName, defaultValue);
if (!isPercentage)
ImGui::Text(text, val);
else
ImGui::Text(text, static_cast<int>(100 * val));
Spacer(0);
if(PlusMinusButton) {
std::string MinusBTNName = " - ##";
MinusBTNName += cvarName;
if (ImGui::Button(MinusBTNName.c_str())) {
if (!isPercentage)
val -= 0.1f;
else
val -= 0.01f;
CVar_SetFloat(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
}
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
}
if (PlusMinusButton) {
#ifdef __WIIU__
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 79.0f * 2);
#else
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 79.0f);
#endif
}
if (ImGui::SliderFloat(id, &val, min, max, format))
{
CVar_SetFloat(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
}
if (PlusMinusButton) {
ImGui::PopItemWidth();
}
if(PlusMinusButton) {
std::string PlusBTNName = " + ##";
PlusBTNName += cvarName;
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
if (ImGui::Button(PlusBTNName.c_str())) {
if (!isPercentage)
val += 0.1f;
else
val += 0.01f;
CVar_SetFloat(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
}
}
if (val < min)
{
val = min;
CVar_SetFloat(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
}
if (val > max)
{
val = max;
CVar_SetFloat(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
}
}
void PaddedEnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue, bool PlusMinusButton, bool padTop, bool padBottom) {
if (padTop)
Spacer(0);
EnhancementSliderInt(text, id, cvarName, min, max, format, defaultValue, PlusMinusButton);
if (padBottom)
Spacer(0);
}
void EnhancementRadioButton(const char* text, const char* cvarName, int id) {
/*Usage :
EnhancementRadioButton("My Visible Name","gMyCVarName", MyID);
First arg is the visible name of the Radio button
Second is the cvar name where MyID will be saved.
Note: the CVar name should be the same to each Buddies.
Example :
EnhancementRadioButton("English", "gLanguages", 0);
EnhancementRadioButton("German", "gLanguages", 1);
EnhancementRadioButton("French", "gLanguages", 2);
*/
std::string make_invisible = "##";
make_invisible += text;
make_invisible += cvarName;
int val = CVar_GetS32(cvarName, 0);
if (ImGui::RadioButton(make_invisible.c_str(), id == val)) {
CVar_SetS32(cvarName, id);
SohImGui::RequestCvarSaveOnNextTick();
}
ImGui::SameLine();
ImGui::Text("%s", text);
}
void ResetColor(const char* cvarName, ImVec4* colors, ImVec4 defaultcolors, bool has_alpha) {
std::string Cvar_RBM = cvarName;
Cvar_RBM += "RBM";
std::string MakeInvisible = "Reset";
MakeInvisible += "##";
MakeInvisible += cvarName;
MakeInvisible += "Reset";
if (ImGui::Button(MakeInvisible.c_str())) {
colors->x = defaultcolors.x;
colors->y = defaultcolors.y;
colors->z = defaultcolors.z;
if (has_alpha) { colors->w = defaultcolors.w; };
Color_RGBA8 colorsRGBA;
colorsRGBA.r = defaultcolors.x;
colorsRGBA.g = defaultcolors.y;
colorsRGBA.b = defaultcolors.z;
if (has_alpha) { colorsRGBA.a = defaultcolors.w; };
CVar_SetRGBA(cvarName, colorsRGBA);
CVar_SetS32(Cvar_RBM.c_str(), 0); //On click disable rainbow mode.
SohImGui::RequestCvarSaveOnNextTick();
}
Tooltip("Revert colors to the game's original colors (GameCube version)\nOverwrites previously chosen color");
}
void RandomizeColor(const char* cvarName, ImVec4* colors) {
Color_RGBA8 NewColors = {0,0,0,255};
std::string Cvar_RBM = cvarName;
Cvar_RBM += "RBM";
std::string MakeInvisible = "##";
MakeInvisible += cvarName;
MakeInvisible += "Random";
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);
CVar_SetRGBA(cvarName, NewColors);
CVar_SetS32(Cvar_RBM.c_str(), 0); // On click disable rainbow mode.
SohImGui::RequestCvarSaveOnNextTick();
}
Tooltip("Chooses a random color\nOverwrites previously chosen color");
}
void RainbowColor(const char* cvarName, ImVec4* colors) {
std::string Cvar_RBM = cvarName;
Cvar_RBM += "RBM";
std::string MakeInvisible = "Rainbow";
MakeInvisible += "##";
MakeInvisible += cvarName;
MakeInvisible += "Rainbow";
EnhancementCheckbox(MakeInvisible.c_str(), Cvar_RBM.c_str());
Tooltip("Cycles through colors on a timer\nOverwrites previously chosen color");
}
void EnhancementColor(const char* text, const char* cvarName, ImVec4 ColorRGBA, ImVec4 default_colors, bool allow_rainbow, bool has_alpha, bool TitleSameLine) {
LoadPickersColors(ColorRGBA, cvarName, default_colors, has_alpha);
ImGuiColorEditFlags flags = ImGuiColorEditFlags_None;
if (!TitleSameLine) {
ImGui::Text("%s", text);
flags = ImGuiColorEditFlags_NoLabel;
}
ImGui::PushID(cvarName);
if (!has_alpha) {
if (ImGui::ColorEdit3(text, (float*)&ColorRGBA, flags))
{
Color_RGBA8 colors;
colors.r = ColorRGBA.x * 255.0;
colors.g = ColorRGBA.y * 255.0;
colors.b = ColorRGBA.z * 255.0;
colors.a = ColorRGBA.w * 255.0;
CVar_SetRGBA(cvarName, colors);
SohImGui::RequestCvarSaveOnNextTick();
}
}
else
{
if (ImGui::ColorEdit4(text, (float*)&ColorRGBA, flags))
{
Color_RGBA8 colors;
colors.r = ColorRGBA.x / 255;
colors.g = ColorRGBA.y / 255;
colors.b = ColorRGBA.z / 255;
colors.a = ColorRGBA.w / 255;
CVar_SetRGBA(cvarName, colors);
SohImGui::RequestCvarSaveOnNextTick();
}
}
ImGui::PopID();
//ImGui::SameLine(); // Removing that one to gain some width spacing on the HUD editor
ImGui::PushItemWidth(-FLT_MIN);
ResetColor(cvarName, &ColorRGBA, default_colors, has_alpha);
ImGui::SameLine();
RandomizeColor(cvarName, &ColorRGBA);
if (allow_rainbow) {
if (ImGui::GetContentRegionAvail().x > 185) {
ImGui::SameLine();
}
RainbowColor(cvarName, &ColorRGBA);
}
ImGui::NewLine();
ImGui::PopItemWidth();
}
}

49
soh/soh/UIWidgets.hpp Normal file
View File

@ -0,0 +1,49 @@
//
// UIWidgets.hpp
// soh
//
// Created by David Chavez on 25.08.22.
//
#ifndef UIWidgets_hpp
#define UIWidgets_hpp
#include <string>
#include <vector>
#include <stdint.h>
#include <ImGui/imgui.h>
namespace UIWidgets {
// MARK: - Enums
enum class CheckboxGraphics {
Cross,
Checkmark,
None
};
char* WrappedText(const char* text, unsigned int charactersPerLine = 60);
char* WrappedText(const std::string& text, unsigned int charactersPerLine);
void SetLastItemHoverText(const std::string& text);
void InsertHelpHoverText(const std::string& text);
void Tooltip(const char* text);
void Spacer(float height);
void PaddedSeparator(bool padTop = true, bool padBottom = true, float extraVerticalTopPadding = 0.0f, float extraVerticalBottomPadding = 0.0f);
void EnhancementCheckbox(const char* text, const char* cvarName, bool disabled = false, const char* disabledTooltipText = "", CheckboxGraphics disabledGraphic = CheckboxGraphics::Cross);
void PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop = true, bool padBottom = true, bool disabled = false, const char* disabledTooltipText = "", CheckboxGraphics disabledGraphic = CheckboxGraphics::Cross);
void EnhancementCombo(const std::string& name, const char* cvarName, const std::vector<std::string>& items, int defaultValue = 0);
void EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue);
void PaddedText(const char* text, bool padTop = true, bool padBottom = true);
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 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 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 EnhancementRadioButton(const char* text, const char* cvarName, int id);
void EnhancementColor(const char* text, const char* cvarName, ImVec4 ColorRGBA, ImVec4 default_colors, bool allow_rainbow = true, bool has_alpha=false, bool TitleSameLine=false);
}
#endif /* UIWidgets_hpp */

View File

@ -1,4 +1,4 @@
#include "Cvar.h"
#include <libultraship/Cvar.h>
#include <vector>
#include <map>

View File

@ -1,13 +1,13 @@
#include "OTRGlobals.h"
#include "ResourceMgr.h"
#include "Scene.h"
#include "Utils/StringHelper.h"
#include <libultraship/ResourceMgr.h>
#include <libultraship/Scene.h>
#include <Utils/StringHelper.h>
#include "global.h"
#include "vt.h"
#include <Text.h>
#include <libultraship/Text.h>
#include <message_data_static.h>
#include <soh/Enhancements/custom-message/CustomMessageManager.h>
#include <soh/Enhancements/custom-message/CustomMessageTypes.h>
#include "Enhancements/custom-message/CustomMessageManager.h"
#include "Enhancements/custom-message/CustomMessageTypes.h"
extern "C" MessageTableEntry* sNesMessageEntryTablePtr;
extern "C" MessageTableEntry* sGerMessageEntryTablePtr;

View File

@ -1,10 +1,10 @@
#include "OTRGlobals.h"
#include "ResourceMgr.h"
#include "Scene.h"
#include "Utils/StringHelper.h"
#include "OTRGlobals.h"
#include <libultraship/ResourceMgr.h>
#include <libultraship/Scene.h>
#include <Utils/StringHelper.h>
#include "global.h"
#include "vt.h"
#include "Vertex.h"
#include <libultraship/Vertex.h>
extern "C" void Gameplay_InitScene(GlobalContext * globalCtx, s32 spawn);
extern "C" void Gameplay_InitEnvironment(GlobalContext * globalCtx, s16 skyboxId);

View File

@ -1,15 +1,15 @@
#include "OTRGlobals.h"
#include "ResourceMgr.h"
#include "Scene.h"
#include "Utils/StringHelper.h"
#include "OTRGlobals.h"
#include <libultraship/ResourceMgr.h>
#include <libultraship/Scene.h>
#include <Utils/StringHelper.h>
#include "global.h"
#include "vt.h"
#include <CollisionHeader.h>
#include <DisplayList.h>
#include <Cutscene.h>
#include <Path.h>
#include <Text.h>
#include <Blob.h>
#include <libultraship/CollisionHeader.h>
#include <libultraship/DisplayList.h>
#include <libultraship/Cutscene.h>
#include <libultraship/Path.h>
#include <libultraship/Text.h>
#include <libultraship/Blob.h>
extern Ship::Resource* OTRGameplay_LoadFile(GlobalContext* globalCtx, const char* fileName);
extern "C" s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId);

View File

@ -1,5 +1,5 @@
#include "global.h"
#include "Cvar.h"
#include <libultraship/Cvar.h>
extern bool gUseLegacySD;

View File

@ -1,6 +1,6 @@
#include "ultra64.h"
#include "global.h"
#include "mixer.h"
#include <libultraship/mixer.h>
#define DEFAULT_LEN_1CH 0x1A0
#define DEFAULT_LEN_2CH 0x340

View File

@ -1,7 +1,7 @@
#include "ultra64.h"
#include "global.h"
#include "ultra64/abi.h"
#include "mixer.h"
#include <ultra64/abi.h>
#include <libultraship/mixer.h>
typedef struct {
u8 unk_0;

View File

@ -4,7 +4,7 @@
#include <string.h>
#include "soh/Enhancements/gameconsole.h"
#include "../libultraship/ImGuiImpl.h"
#include <libultraship/ImGuiImpl.h>
#include "soh/frame_interpolation.h"
#include <time.h>

View File

@ -10,7 +10,7 @@
#include "alloca.h"
#include "textures/nintendo_rogo_static/nintendo_rogo_static.h"
#include <soh/Enhancements/bootcommands.h>
#include "GameVersions.h"
#include <libultraship/GameVersions.h>
#include <soh/SaveManager.h>
const char* GetGameVersionString();