Merge remote-tracking branch 'upstream/rando-next' into rando-navi-tips

This commit is contained in:
Sarge-117 2022-08-14 10:16:35 -07:00
commit fa19df9201
36 changed files with 531 additions and 357 deletions

View File

@ -1,39 +1,35 @@
#include "Console.h" #include "Console.h"
#include <iostream>
#include <sstream>
#include "Cvar.h" #include "Cvar.h"
#include "GlobalCtx2.h" #include "GlobalCtx2.h"
#include "ImGuiImpl.h" #include "ImGuiImpl.h"
#include "Lib/ImGui/imgui.h" #include "Lib/ImGui/imgui.h"
#include "Utils/StringHelper.h" #include "Utils/StringHelper.h"
#include "Lib/ImGui/imgui_internal.h" #include "Lib/ImGui/imgui_internal.h"
#include "Utils.h"
namespace Ship { namespace Ship {
std::map<ImGuiKey, std::string> Bindings; std::string BuildUsage(const CommandEntry& entry) {
std::map<ImGuiKey, std::string> BindingToggle; std::string usage;
for (const auto& arg : entry.arguments)
usage += StringHelper::Sprintf(arg.optional ? "[%s] " : "<%s> ", arg.info.c_str());
return usage;
}
static bool HelpCommand(const std::vector<std::string>&) { bool Console::HelpCommand(std::shared_ptr<Console> Console, const std::vector<std::string>& args) {
SohImGui::console->SendInfoMessage("SoH Commands:"); Console->SendInfoMessage("SoH Commands:");
for (const auto& cmd : SohImGui::console->Commands) { for (const auto& cmd : Console->Commands) {
SohImGui::console->SendInfoMessage(" - " + cmd.first); Console->SendInfoMessage(" - " + cmd.first);
} }
return CMD_SUCCESS; return CMD_SUCCESS;
} }
static bool ClearCommand(const std::vector<std::string>&) { bool Console::ClearCommand(std::shared_ptr<Console> Console, const std::vector<std::string>& args) {
SohImGui::console->Log[SohImGui::console->selected_channel].clear(); Console->ClearLogs(Console->GetCurrentChannel());
return CMD_SUCCESS; return CMD_SUCCESS;
} }
std::string toLowerCase(std::string in) { bool Console::BindCommand(std::shared_ptr<Console> Console, const std::vector<std::string>& args) {
std::string cpy(in);
std::transform(cpy.begin(), cpy.end(), cpy.begin(), ::tolower);
return cpy;
}
static bool BindCommand(const std::vector<std::string>& args) {
if (args.size() > 2) { if (args.size() > 2) {
const ImGuiIO* io = &ImGui::GetIO();; const ImGuiIO* io = &ImGui::GetIO();;
for (size_t k = 0; k < std::size(io->KeysData); k++) { for (size_t k = 0; k < std::size(io->KeysData); k++) {
@ -44,8 +40,8 @@ namespace Ship {
const char* const delim = " "; const char* const delim = " ";
std::ostringstream imploded; std::ostringstream imploded;
std::copy(args.begin() + 2, args.end(), std::ostream_iterator<std::string>(imploded, delim)); std::copy(args.begin() + 2, args.end(), std::ostream_iterator<std::string>(imploded, delim));
Bindings[k] = imploded.str(); Console->Bindings[k] = imploded.str();
SohImGui::console->SendInfoMessage("Binding '%s' to %s", args[1].c_str(), Bindings[k].c_str()); Console->SendInfoMessage("Binding '%s' to %s", args[1].c_str(), Console->Bindings[k].c_str());
break; break;
} }
} }
@ -53,15 +49,15 @@ namespace Ship {
return CMD_SUCCESS; return CMD_SUCCESS;
} }
static bool BindToggleCommand(const std::vector<std::string>& args) { bool Console::BindToggleCommand(std::shared_ptr<Console> Console, const std::vector<std::string>& args) {
if (args.size() > 2) { if (args.size() > 2) {
const ImGuiIO* io = &ImGui::GetIO();; const ImGuiIO* io = &ImGui::GetIO();;
for (size_t k = 0; k < std::size(io->KeysData); k++) { for (size_t k = 0; k < std::size(io->KeysData); k++) {
std::string key(ImGui::GetKeyName(k)); std::string key(ImGui::GetKeyName(k));
if (toLowerCase(args[1]) == toLowerCase(key)) { if (toLowerCase(args[1]) == toLowerCase(key)) {
BindingToggle[k] = args[2]; Console->BindingToggle[k] = args[2];
SohImGui::console->SendInfoMessage("Binding toggle '%s' to %s", args[1].c_str(), BindingToggle[k].c_str()); Console->SendInfoMessage("Binding toggle '%s' to %s", args[1].c_str(), Console->BindingToggle[k].c_str());
break; break;
} }
} }
@ -69,22 +65,15 @@ namespace Ship {
return CMD_SUCCESS; return CMD_SUCCESS;
} }
std::string BuildUsage(const CommandEntry& entry) {
std::string usage;
for (const auto& arg : entry.arguments)
usage += StringHelper::Sprintf(arg.optional ? "[%s] " : "<%s> ", arg.info.c_str());
return usage;
}
void Console::Init() { void Console::Init() {
this->InputBuffer = new char[MAX_BUFFER_SIZE]; this->inputBuffer = new char[MAX_BUFFER_SIZE];
strcpy(this->InputBuffer, ""); strcpy(this->inputBuffer, "");
this->FilterBuffer = new char[MAX_BUFFER_SIZE]; this->filterBuffer = new char[MAX_BUFFER_SIZE];
strcpy(this->FilterBuffer, ""); strcpy(this->filterBuffer, "");
this->Commands["help"] = { HelpCommand, "Shows all the commands" }; AddCommand("help", { HelpCommand, "Shows all the commands" });
this->Commands["clear"] = { ClearCommand, "Clear the console history" }; AddCommand("clear", { ClearCommand, "Clear the console history" });
this->Commands["bind"] = { BindCommand, "Binds key to commands" }; AddCommand("bind", { BindCommand, "Binds key to commands" });
this->Commands["bind-toggle"] = { BindToggleCommand, "Bind key as a bool toggle" }; AddCommand("bind-toggle", { BindToggleCommand, "Bind key as a bool toggle" });
} }
void Console::Update() { void Console::Update() {
@ -114,7 +103,7 @@ namespace Ship {
// SohImGui::ShowCursor(ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows | ImGuiHoveredFlags_RectOnly), SohImGui::Dialogues::dConsole); // SohImGui::ShowCursor(ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows | ImGuiHoveredFlags_RectOnly), SohImGui::Dialogues::dConsole);
// Renders autocomplete window // Renders autocomplete window
if (this->OpenAutocomplete) { if (this->openAutocomplete) {
ImGui::SetNextWindowSize(ImVec2(350, std::min(static_cast<int>(this->Autocomplete.size()), 3) * 20.f), ImGuiCond_Once); ImGui::SetNextWindowSize(ImVec2(350, std::min(static_cast<int>(this->Autocomplete.size()), 3) * 20.f), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(pos.x + 8, pos.y + size.y - 1)); ImGui::SetNextWindowPos(ImVec2(pos.x + 8, pos.y + size.y - 1));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(3, 3)); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(3, 3));
@ -129,16 +118,16 @@ namespace Ship {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(0);
if (ImGui::Selectable(preview.c_str())) { if (ImGui::Selectable(preview.c_str())) {
memset(this->InputBuffer, 0, MAX_BUFFER_SIZE); memset(this->inputBuffer, 0, MAX_BUFFER_SIZE);
memcpy(this->InputBuffer, autocomplete.c_str(), sizeof(char) * autocomplete.size()); memcpy(this->inputBuffer, autocomplete.c_str(), sizeof(char) * autocomplete.size());
this->OpenAutocomplete = false; this->openAutocomplete = false;
input_focus = true; input_focus = true;
} }
} }
ImGui::EndTable(); ImGui::EndTable();
} }
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) { if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
this->OpenAutocomplete = false; this->openAutocomplete = false;
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::EndChild(); ImGui::EndChild();
@ -148,7 +137,7 @@ namespace Ship {
if (ImGui::BeginPopupContextWindow("Context Menu")) { if (ImGui::BeginPopupContextWindow("Context Menu")) {
if (ImGui::MenuItem("Copy Text")) { if (ImGui::MenuItem("Copy Text")) {
ImGui::SetClipboardText(this->Log[this->selected_channel][this->selectedId].text.c_str()); ImGui::SetClipboardText(this->Log[this->currentChannel][this->selectedId].text.c_str());
this->selectedId = -1; this->selectedId = -1;
} }
ImGui::EndPopup(); ImGui::EndPopup();
@ -158,44 +147,44 @@ namespace Ship {
} }
// Renders top bar filters // Renders top bar filters
if (ImGui::Button("Clear")) this->Log[this->selected_channel].clear(); if (ImGui::Button("Clear")) this->Log[this->currentChannel].clear();
if (CVar_GetS32("gSinkEnabled", 0)) { if (CVar_GetS32("gSinkEnabled", 0)) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetNextItemWidth(150); ImGui::SetNextItemWidth(150);
if (ImGui::BeginCombo("##channel", this->selected_channel.c_str())) { if (ImGui::BeginCombo("##channel", this->currentChannel.c_str())) {
for (const auto& channel : log_channels) { for (const auto& channel : LogChannels) {
const bool is_selected = (channel == std::string(this->selected_channel)); const bool is_selected = (channel == std::string(this->currentChannel));
if (ImGui::Selectable(channel.c_str(), is_selected)) if (ImGui::Selectable(channel.c_str(), is_selected))
this->selected_channel = channel; this->currentChannel = channel;
if (is_selected) ImGui::SetItemDefaultFocus(); if (is_selected) ImGui::SetItemDefaultFocus();
} }
ImGui::EndCombo(); ImGui::EndCombo();
} }
} else { } else {
this->selected_channel = "Console"; this->currentChannel = "Console";
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetNextItemWidth(150); ImGui::SetNextItemWidth(150);
if (this->selected_channel != "Console") { if (this->currentChannel != "Console") {
if (ImGui::BeginCombo("##level", spdlog::level::to_string_view(this->level_filter).data())) { if (ImGui::BeginCombo("##level", spdlog::level::to_string_view(this->levelFilter).data())) {
for (const auto& priority_filter : priority_filters) { for (const auto& priority_filter : PriorityFilters) {
const bool is_selected = priority_filter == this->level_filter; const bool is_selected = priority_filter == this->levelFilter;
if (ImGui::Selectable(spdlog::level::to_string_view(priority_filter).data(), is_selected)) if (ImGui::Selectable(spdlog::level::to_string_view(priority_filter).data(), is_selected))
{ {
this->level_filter = priority_filter; this->levelFilter = priority_filter;
if (is_selected) ImGui::SetItemDefaultFocus(); if (is_selected) ImGui::SetItemDefaultFocus();
} }
} }
ImGui::EndCombo(); ImGui::EndCombo();
} }
} else { } else {
this->level_filter = spdlog::level::trace; this->levelFilter = spdlog::level::trace;
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushItemWidth(-1); ImGui::PushItemWidth(-1);
if (ImGui::InputTextWithHint("##input", "Filter", this->FilterBuffer, MAX_BUFFER_SIZE))this->filter = std::string(this->FilterBuffer); if (ImGui::InputTextWithHint("##input", "Filter", this->filterBuffer, MAX_BUFFER_SIZE))this->filter = std::string(this->filterBuffer);
ImGui::PopItemWidth(); ImGui::PopItemWidth();
// Renders console history // Renders console history
@ -209,16 +198,16 @@ namespace Ship {
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow))) if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow)))
if (this->selectedId > 0)--this->selectedId; if (this->selectedId > 0)--this->selectedId;
const std::vector<ConsoleLine> channel = this->Log[this->selected_channel]; const std::vector<ConsoleLine> channel = this->Log[this->currentChannel];
for (int i = 0; i < static_cast<int>(channel.size()); i++) { for (int i = 0; i < static_cast<int>(channel.size()); i++) {
ConsoleLine line = channel[i]; ConsoleLine line = channel[i];
if (!this->filter.empty() && line.text.find(this->filter) == std::string::npos) continue; if (!this->filter.empty() && line.text.find(this->filter) == std::string::npos) continue;
if (this->level_filter > line.priority) continue; if (this->levelFilter > line.priority) continue;
std::string id = line.text + "##" + std::to_string(i); std::string id = line.text + "##" + std::to_string(i);
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(0);
const bool is_selected = (this->selectedId == i) || std::find(this->selectedEntries.begin(), this->selectedEntries.end(), i) != this->selectedEntries.end(); const bool is_selected = (this->selectedId == i) || std::find(this->selectedEntries.begin(), this->selectedEntries.end(), i) != this->selectedEntries.end();
ImGui::PushStyleColor(ImGuiCol_Text, this->priority_colors[line.priority]); ImGui::PushStyleColor(ImGuiCol_Text, this->PriorityColours[line.priority]);
if (ImGui::Selectable(id.c_str(), is_selected)) { if (ImGui::Selectable(id.c_str(), is_selected)) {
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_LeftCtrl)) && !is_selected) if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_LeftCtrl)) && !is_selected)
this->selectedEntries.push_back(i); this->selectedEntries.push_back(i);
@ -236,25 +225,25 @@ namespace Ship {
ImGui::SetScrollHereY(1.0f); ImGui::SetScrollHereY(1.0f);
ImGui::EndChild(); ImGui::EndChild();
if (this->selected_channel == "Console") { if (this->currentChannel == "Console") {
// Renders input textfield // Renders input textfield
constexpr ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackEdit | constexpr ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackEdit |
ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory; ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory;
ImGui::PushItemWidth(-53); ImGui::PushItemWidth(-53);
if (ImGui::InputTextWithHint("##CMDInput", ">", this->InputBuffer, MAX_BUFFER_SIZE, flags, &Console::CallbackStub, this)) { if (ImGui::InputTextWithHint("##CMDInput", ">", this->inputBuffer, MAX_BUFFER_SIZE, flags, &Console::CallbackStub, this)) {
input_focus = true; input_focus = true;
if (this->InputBuffer[0] != '\0' && this->InputBuffer[0] != ' ') if (this->inputBuffer[0] != '\0' && this->inputBuffer[0] != ' ')
this->Dispatch(std::string(this->InputBuffer)); this->Dispatch(std::string(this->inputBuffer));
memset(this->InputBuffer, 0, MAX_BUFFER_SIZE); memset(this->inputBuffer, 0, MAX_BUFFER_SIZE);
} }
if (this->CMDHint != NULLSTR) { if (this->cmdHint != NULLSTR) {
if (ImGui::IsItemFocused()) { if (ImGui::IsItemFocused()) {
ImGui::SetNextWindowPos(ImVec2(pos.x, pos.y + size.y)); ImGui::SetNextWindowPos(ImVec2(pos.x, pos.y + size.y));
ImGui::SameLine(); ImGui::SameLine();
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::TextUnformatted(this->CMDHint.c_str()); ImGui::TextUnformatted(this->cmdHint.c_str());
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
@ -262,9 +251,9 @@ namespace Ship {
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 50); ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 50);
if (ImGui::Button("Submit") && !input_focus && this->InputBuffer[0] != '\0' && this->InputBuffer[0] != ' ') { if (ImGui::Button("Submit") && !input_focus && this->inputBuffer[0] != '\0' && this->inputBuffer[0] != ' ') {
this->Dispatch(std::string(this->InputBuffer)); this->Dispatch(std::string(this->inputBuffer));
memset(this->InputBuffer, 0, MAX_BUFFER_SIZE); memset(this->inputBuffer, 0, MAX_BUFFER_SIZE);
} }
ImGui::SetItemDefaultFocus(); ImGui::SetItemDefaultFocus();
@ -275,14 +264,16 @@ namespace Ship {
} }
void Console::Dispatch(const std::string& line) { void Console::Dispatch(const std::string& line) {
this->CMDHint = NULLSTR; this->cmdHint = NULLSTR;
this->History.push_back(line); this->History.push_back(line);
SendInfoMessage("> " + line); SendInfoMessage("> " + line);
const std::vector<std::string> cmd_args = StringHelper::Split(line, " "); const std::vector<std::string> cmd_args = StringHelper::Split(line, " ");
if (this->Commands.contains(cmd_args[0])) { if (this->Commands.contains(cmd_args[0])) {
const CommandEntry entry = this->Commands[cmd_args[0]]; const CommandEntry entry = this->Commands[cmd_args[0]];
if (!entry.handler(cmd_args) && !entry.arguments.empty()) if (!entry.handler(shared_from_this(), cmd_args) && !entry.arguments.empty()) {
SendErrorMessage("[SOH] Usage: " + cmd_args[0] + " " + BuildUsage(entry)); SendErrorMessage("[SOH] Usage: " + cmd_args[0] + " " + BuildUsage(entry));
}
return; return;
} }
SendErrorMessage("[SOH] Command not found"); SendErrorMessage("[SOH] Command not found");
@ -291,7 +282,7 @@ namespace Ship {
int Console::CallbackStub(ImGuiInputTextCallbackData* data) { int Console::CallbackStub(ImGuiInputTextCallbackData* data) {
const auto instance = static_cast<Console*>(data->UserData); const auto instance = static_cast<Console*>(data->UserData);
const bool empty_history = instance->History.empty(); const bool empty_history = instance->History.empty();
const int history_index = instance->HistoryIndex; const int history_index = instance->historyIndex;
std::string history; std::string history;
switch (data->EventKey) { switch (data->EventKey) {
@ -299,39 +290,39 @@ namespace Ship {
instance->Autocomplete.clear(); instance->Autocomplete.clear();
for (auto& [cmd, entry] : instance->Commands) for (auto& [cmd, entry] : instance->Commands)
if (cmd.find(std::string(data->Buf)) != std::string::npos) instance->Autocomplete.push_back(cmd); if (cmd.find(std::string(data->Buf)) != std::string::npos) instance->Autocomplete.push_back(cmd);
instance->OpenAutocomplete = !instance->Autocomplete.empty(); instance->openAutocomplete = !instance->Autocomplete.empty();
instance->CMDHint = NULLSTR; instance->cmdHint = NULLSTR;
break; break;
case ImGuiKey_UpArrow: case ImGuiKey_UpArrow:
if (empty_history) break; if (empty_history) break;
if (history_index < static_cast<int>(instance->History.size()) - 1) instance->HistoryIndex += 1; if (history_index < static_cast<int>(instance->History.size()) - 1) instance->historyIndex += 1;
data->DeleteChars(0, data->BufTextLen); data->DeleteChars(0, data->BufTextLen);
data->InsertChars(0, instance->History[instance->HistoryIndex].c_str()); data->InsertChars(0, instance->History[instance->historyIndex].c_str());
instance->CMDHint = NULLSTR; instance->cmdHint = NULLSTR;
break; break;
case ImGuiKey_DownArrow: case ImGuiKey_DownArrow:
if (empty_history) break; if (empty_history) break;
if (history_index > -1) instance->HistoryIndex -= 1; if (history_index > -1) instance->historyIndex -= 1;
data->DeleteChars(0, data->BufTextLen); data->DeleteChars(0, data->BufTextLen);
if (history_index >= 0) if (history_index >= 0)
data->InsertChars(0, instance->History[history_index].c_str()); data->InsertChars(0, instance->History[history_index].c_str());
instance->CMDHint = NULLSTR; instance->cmdHint = NULLSTR;
break; break;
case ImGuiKey_Escape: case ImGuiKey_Escape:
instance->HistoryIndex = -1; instance->historyIndex = -1;
data->DeleteChars(0, data->BufTextLen); data->DeleteChars(0, data->BufTextLen);
instance->OpenAutocomplete = false; instance->openAutocomplete = false;
instance->CMDHint = NULLSTR; instance->cmdHint = NULLSTR;
break; break;
default: default:
instance->OpenAutocomplete = false; instance->openAutocomplete = false;
for (auto& [cmd, entry] : instance->Commands) { for (auto& [cmd, entry] : instance->Commands) {
const std::vector<std::string> cmd_args = StringHelper::Split(std::string(data->Buf), " "); const std::vector<std::string> cmd_args = StringHelper::Split(std::string(data->Buf), " ");
if (data->BufTextLen > 2 && !cmd_args.empty() && cmd.find(cmd_args[0]) != std::string::npos) { if (data->BufTextLen > 2 && !cmd_args.empty() && cmd.find(cmd_args[0]) != std::string::npos) {
instance->CMDHint = cmd + " " + BuildUsage(entry); instance->cmdHint = cmd + " " + BuildUsage(entry);
break; break;
} }
instance->CMDHint = NULLSTR; instance->cmdHint = NULLSTR;
} }
} }
return 0; return 0;
@ -372,4 +363,30 @@ namespace Ship {
void Console::SendErrorMessage(const std::string& str) { void Console::SendErrorMessage(const std::string& str) {
Append("Console", spdlog::level::err, str.c_str()); Append("Console", spdlog::level::err, str.c_str());
} }
void Console::ClearLogs(std::string channel) {
Log[channel].clear();
}
void Console::ClearLogs() {
for (auto [key, var] : Log) {
var.clear();
}
}
bool Console::HasCommand(const std::string& command) {
for (const auto& Command : Commands) {
if (Command.first == command) {
return true;
}
}
return false;
}
void Console::AddCommand(const std::string& command, CommandEntry entry) {
if (!HasCommand(command)) {
Commands[command] = entry;
}
}
} }

View File

@ -16,7 +16,8 @@ namespace Ship {
#define MAX_BUFFER_SIZE 255 #define MAX_BUFFER_SIZE 255
#define NULLSTR "None" #define NULLSTR "None"
typedef std::function<bool(std::vector<std::string> args)> CommandHandler; class Console;
typedef std::function<bool(std::shared_ptr<Console> Console, std::vector<std::string> args)> CommandHandler;
enum class ArgumentType { enum class ArgumentType {
TEXT, NUMBER, PLAYER_POS, PLAYER_ROT TEXT, NUMBER, PLAYER_POS, PLAYER_ROT
@ -40,14 +41,35 @@ namespace Ship {
std::string channel = "Console"; std::string channel = "Console";
}; };
class Console { class Console : public std::enable_shared_from_this<Console> {
private:
static int CallbackStub(ImGuiInputTextCallbackData* data);
static bool ClearCommand(std::shared_ptr<Console> Console, const std::vector<std::string>& args);
static bool HelpCommand(std::shared_ptr<Console> Console, const std::vector<std::string>& args);
static bool BindCommand(std::shared_ptr<Console> Console, const std::vector<std::string>& args);
static bool BindToggleCommand(std::shared_ptr<Console> Console, const std::vector<std::string>& args);
bool opened = false;
int selectedId = -1; int selectedId = -1;
int historyIndex = -1;
std::vector<int> selectedEntries; std::vector<int> selectedEntries;
std::string filter; std::string filter;
spdlog::level::level_enum level_filter = spdlog::level::trace; std::string currentChannel = "Console";
std::vector<std::string> log_channels = { "Console", "Logs" }; bool openAutocomplete = false;
std::vector<spdlog::level::level_enum> priority_filters = { spdlog::level::off, spdlog::level::critical, spdlog::level::err, spdlog::level::warn, spdlog::level::info, spdlog::level::debug, spdlog::level::trace }; char* inputBuffer = nullptr;
std::vector<ImVec4> priority_colors = { char* filterBuffer = nullptr;
std::string cmdHint = NULLSTR;
spdlog::level::level_enum levelFilter = spdlog::level::trace;
std::vector<std::string> History;
std::vector<std::string> Autocomplete;
std::map<ImGuiKey, std::string> Bindings;
std::map<ImGuiKey, std::string> BindingToggle;
std::map<std::string, CommandEntry> Commands;
std::map<std::string, std::vector<ConsoleLine>> Log;
const std::vector<std::string> LogChannels = { "Console", "Logs" };
const std::vector<spdlog::level::level_enum> PriorityFilters = { spdlog::level::off, spdlog::level::critical, spdlog::level::err, spdlog::level::warn, spdlog::level::info, spdlog::level::debug, spdlog::level::trace };
const std::vector<ImVec4> PriorityColours = {
ImVec4(0.8f, 0.8f, 0.8f, 1.0f), // TRACE ImVec4(0.8f, 0.8f, 0.8f, 1.0f), // TRACE
ImVec4(0.9f, 0.9f, 0.9f, 1.0f), // DEBUG ImVec4(0.9f, 0.9f, 0.9f, 1.0f), // DEBUG
ImVec4(1.0f, 1.0f, 1.0f, 1.0f), // INFO ImVec4(1.0f, 1.0f, 1.0f, 1.0f), // INFO
@ -60,26 +82,23 @@ namespace Ship {
void Append(const std::string& channel, spdlog::level::level_enum priority, const char* fmt, va_list args); void Append(const std::string& channel, spdlog::level::level_enum priority, const char* fmt, va_list args);
public: public:
std::map<std::string, std::vector<ConsoleLine>> Log; void ClearLogs(std::string channel);
std::map<std::string, CommandEntry> Commands; void ClearLogs();
std::vector<std::string> Autocomplete;
std::vector<std::string> History;
std::string CMDHint = NULLSTR;
char* FilterBuffer = nullptr;
char* InputBuffer = nullptr;
bool OpenAutocomplete = false;
int HistoryIndex = -1;
std::string selected_channel = "Console";
bool opened = false;
void Init(); void Init();
void Update(); void Update();
void Draw(); void Draw();
void Dispatch(const std::string& line); void Dispatch(const std::string& line);
static int CallbackStub(ImGuiInputTextCallbackData* data);
void SendInfoMessage(const char* fmt, ...); void SendInfoMessage(const char* fmt, ...);
void SendErrorMessage(const char* fmt, ...); void SendErrorMessage(const char* fmt, ...);
void SendInfoMessage(const std::string& str); void SendInfoMessage(const std::string& str);
void SendErrorMessage(const std::string& str); void SendErrorMessage(const std::string& str);
void Append(const std::string& channel, spdlog::level::level_enum priority, const char* fmt, ...); void Append(const std::string& channel, spdlog::level::level_enum priority, const char* fmt, ...);
bool HasCommand(const std::string& command);
void AddCommand(const std::string& command, CommandEntry entry);
std::string GetCurrentChannel() { return currentChannel; }
bool IsOpened() { return opened; }
void Close() { opened = false; }
void Open() { opened = true; }
}; };
} }

View File

@ -9,7 +9,6 @@
#include "Cvar.h" #include "Cvar.h"
namespace Ship { namespace Ship {
uint8_t* controllerBits;
void ControlDeck::Init(uint8_t* bits) { void ControlDeck::Init(uint8_t* bits) {
ScanPhysicalDevices(); ScanPhysicalDevices();
@ -187,4 +186,9 @@ namespace Ship {
std::shared_ptr<Controller> ControlDeck::GetPhysicalDeviceFromVirtualSlot(int slot) { std::shared_ptr<Controller> ControlDeck::GetPhysicalDeviceFromVirtualSlot(int slot) {
return GetPhysicalDevice(GetVirtualDevice(slot)); return GetPhysicalDevice(GetVirtualDevice(slot));
} }
uint8_t* ControlDeck::GetControllerBits() {
return controllerBits;
}
} }

View File

@ -18,8 +18,10 @@ namespace Ship {
size_t GetNumPhysicalDevices(); size_t GetNumPhysicalDevices();
int GetVirtualDevice(int slot); int GetVirtualDevice(int slot);
size_t GetNumVirtualDevices(); size_t GetNumVirtualDevices();
uint8_t* GetControllerBits();
private: private:
std::vector<int> virtualDevices; std::vector<int> virtualDevices = {};
std::vector<std::shared_ptr<Controller>> physicalDevices = {}; std::vector<std::shared_ptr<Controller>> physicalDevices = {};
uint8_t* controllerBits = nullptr;
}; };
} }

View File

@ -9,6 +9,40 @@
#include "Utils/StringHelper.h" #include "Utils/StringHelper.h"
namespace Ship { namespace Ship {
bool OverlayCommand(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() < 3) {
return CMD_FAILED;
}
if (CVar_Get(args[2].c_str()) != nullptr) {
const char* key = args[2].c_str();
GameOverlay* overlay = SohImGui::overlay;
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);
}
else {
SohImGui::console->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);
}
else {
SohImGui::console->SendErrorMessage("Overlay not found: %s", key);
}
}
}
else {
SohImGui::console->SendErrorMessage("CVar {} does not exist", args[2].c_str());
}
return CMD_SUCCESS;
}
void GameOverlay::LoadFont(const std::string& name, const std::string& path, float fontSize) { void GameOverlay::LoadFont(const std::string& name, const std::string& path, float fontSize) {
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
std::shared_ptr<Archive> base = GlobalCtx2::GetInstance()->GetResourceManager()->GetArchive(); std::shared_ptr<Archive> base = GlobalCtx2::GetInstance()->GetResourceManager()->GetArchive();
@ -122,7 +156,8 @@ namespace Ship {
this->CurrentFont = DefaultFont; this->CurrentFont = DefaultFont;
} }
} }
SohImGui::console->Commands["overlay"] = { OverlayCommand, "Draw an overlay using a cvar value" };
SohImGui::console->AddCommand("overlay", { OverlayCommand, "Draw an overlay using a cvar value" });
} }
void GameOverlay::DrawSettings() { void GameOverlay::DrawSettings() {
@ -195,40 +230,4 @@ namespace Ship {
ImGui::End(); ImGui::End();
} }
bool OverlayCommand(const std::vector<std::string>& args) {
if (args.size() < 3) {
return CMD_FAILED;
}
if (CVar_Get(args[2].c_str()) != nullptr) {
const char* key = args[2].c_str();
GameOverlay* overlay = SohImGui::overlay;
if (args[1] == "add") {
if (!overlay->RegisteredOverlays.contains(key)) {
overlay->RegisteredOverlays[key] = new Overlay({ OverlayType::TEXT, ImStrdup(key), -1.0f });
SPDLOG_INFO("Added overlay: {} ", key);
SohImGui::console->SendInfoMessage("Added overlay: %s", key);
}
else {
SPDLOG_ERROR("Overlay already exists: {}", key);
}
}
else if (args[1] == "remove") {
if (overlay->RegisteredOverlays.contains(key)) {
overlay->RegisteredOverlays.erase(key);
SPDLOG_INFO("Removed overlay: {} ", key);
}
else {
SPDLOG_ERROR("Overlay not found: {}", key);
}
}
}
else {
SPDLOG_ERROR("CVar {} does not exist", args[2].c_str());
}
return CMD_SUCCESS;
}
} }

View File

@ -37,6 +37,4 @@ namespace Ship {
void CleanupNotifications(); void CleanupNotifications();
void LoadFont(const std::string& name, const std::string& path, float fontSize); void LoadFont(const std::string& name, const std::string& path, float fontSize);
}; };
bool OverlayCommand(const std::vector<std::string>& args);
} }

View File

@ -91,7 +91,7 @@ namespace SohImGui {
WindowImpl impl; WindowImpl impl;
ImGuiIO* io; ImGuiIO* io;
Console* console = new Console; std::shared_ptr<Console> console = std::make_shared<Console>();
GameOverlay* overlay = new GameOverlay; GameOverlay* overlay = new GameOverlay;
InputEditor* controller = new InputEditor; InputEditor* controller = new InputEditor;
static ImVector<ImRect> s_GroupPanelLabelStack; static ImVector<ImRect> s_GroupPanelLabelStack;
@ -141,7 +141,11 @@ namespace SohImGui {
Ship::RegisterHook<Ship::AudioInit>(UpdateAudio); Ship::RegisterHook<Ship::AudioInit>(UpdateAudio);
Ship::RegisterHook<Ship::GfxInit>([] { Ship::RegisterHook<Ship::GfxInit>([] {
gfx_get_current_rendering_api()->set_texture_filter((FilteringMode)CVar_GetS32("gTextureFilter", FILTER_THREE_POINT)); gfx_get_current_rendering_api()->set_texture_filter((FilteringMode)CVar_GetS32("gTextureFilter", FILTER_THREE_POINT));
SohImGui::console->opened = CVar_GetS32("gConsoleEnabled", 0); if (CVar_GetS32("gConsoleEnabled", 0)) {
console->Open();
} else {
console->Close();
}
SohImGui::controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0); SohImGui::controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0);
UpdateAudio(); UpdateAudio();
}); });
@ -857,13 +861,13 @@ namespace SohImGui {
if ((ImGui::IsKeyDown(ImGuiKey_LeftSuper) || if ((ImGui::IsKeyDown(ImGuiKey_LeftSuper) ||
ImGui::IsKeyDown(ImGuiKey_RightSuper)) && ImGui::IsKeyDown(ImGuiKey_RightSuper)) &&
ImGui::IsKeyPressed(ImGuiKey_R, false)) { ImGui::IsKeyPressed(ImGuiKey_R, false)) {
console->Commands["reset"].handler(emptyArgs); console->Dispatch("reset");
} }
#else #else
if ((ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || if ((ImGui::IsKeyDown(ImGuiKey_LeftCtrl) ||
ImGui::IsKeyDown(ImGuiKey_RightCtrl)) && ImGui::IsKeyDown(ImGuiKey_RightCtrl)) &&
ImGui::IsKeyPressed(ImGuiKey_R, false)) { ImGui::IsKeyPressed(ImGuiKey_R, false)) {
console->Commands["reset"].handler(emptyArgs); console->Dispatch("reset");
} }
#endif #endif
@ -891,7 +895,7 @@ namespace SohImGui {
"Ctrl+R" "Ctrl+R"
#endif #endif
)) { )) {
console->Commands["reset"].handler(emptyArgs); console->Dispatch("reset");
} }
ImGui::EndMenu(); ImGui::EndMenu();
} }
@ -1638,7 +1642,7 @@ namespace SohImGui {
CVar_SetS32("gEnableBetaQuest", betaQuestEnabled); CVar_SetS32("gEnableBetaQuest", betaQuestEnabled);
CVar_SetS32("gBetaQuestWorld", betaQuestWorld); CVar_SetS32("gBetaQuestWorld", betaQuestWorld);
console->Commands["reset"].handler(emptyArgs); console->Dispatch("reset");
needs_save = true; needs_save = true;
} }
@ -1695,7 +1699,11 @@ namespace SohImGui {
bool currentValue = CVar_GetS32("gConsoleEnabled", 0); bool currentValue = CVar_GetS32("gConsoleEnabled", 0);
CVar_SetS32("gConsoleEnabled", !currentValue); CVar_SetS32("gConsoleEnabled", !currentValue);
needs_save = true; needs_save = true;
console->opened = CVar_GetS32("gConsoleEnabled", 0); if(CVar_GetS32("gConsoleEnabled", 0)){
console->Open();
} else {
console->Close();
}
} }
Tooltip("Enables the console window, allowing you to input commands, type help for some examples"); Tooltip("Enables the console window, allowing you to input commands, type help for some examples");
InsertPadding(); InsertPadding();
@ -2261,7 +2269,7 @@ namespace SohImGui {
} }
void BindCmd(const std::string& cmd, CommandEntry entry) { void BindCmd(const std::string& cmd, CommandEntry entry) {
console->Commands[cmd] = std::move(entry); console->AddCommand(cmd, entry);
} }
void AddWindow(const std::string& category, const std::string& name, WindowDrawFunc drawFunc, bool isEnabled, bool isHidden) { void AddWindow(const std::string& category, const std::string& name, WindowDrawFunc drawFunc, bool isEnabled, bool isHidden) {

View File

@ -69,7 +69,7 @@ namespace SohImGui {
WindowDrawFunc drawFunc; WindowDrawFunc drawFunc;
} CustomWindow; } CustomWindow;
extern Ship::Console* console; extern std::shared_ptr<Ship::Console> console;
extern Ship::InputEditor* controller; extern Ship::InputEditor* controller;
extern Ship::GameOverlay* overlay; extern Ship::GameOverlay* overlay;
extern bool needs_save; extern bool needs_save;

View File

@ -41,7 +41,7 @@ protected:
} }
formatted.push_back('\0'); formatted.push_back('\0');
const char* msg_output = formatted.data(); const char* msg_output = formatted.data();
if (CVar_GetS32("gSinkEnabled", 0) && SohImGui::console->opened) { if (CVar_GetS32("gSinkEnabled", 0) && SohImGui::console->IsOpened()) {
SohImGui::console->Append("Logs", msg.level, "%s", msg_output); SohImGui::console->Append("Logs", msg.level, "%s", msg_output);
} }
} }

View File

@ -2,7 +2,7 @@
namespace Ship namespace Ship
{ {
Vertex::Vertex() ModelVertex::ModelVertex()
{ {
pos = Vec3f(0, 0, 0); pos = Vec3f(0, 0, 0);
normal = Vec3f(0, 0, 0); normal = Vec3f(0, 0, 0);
@ -10,7 +10,7 @@ namespace Ship
uv = Vec2f(0, 0); uv = Vec2f(0, 0);
} }
Vertex::Vertex(BinaryReader* reader) ModelVertex::ModelVertex(BinaryReader* reader)
{ {
pos = reader->ReadVec3f(); pos = reader->ReadVec3f();
normal = reader->ReadVec3f(); normal = reader->ReadVec3f();
@ -36,7 +36,7 @@ namespace Ship
uvCoords = reader->ReadUInt32(); uvCoords = reader->ReadUInt32();
boneWeights = reader->ReadUInt32(); boneWeights = reader->ReadUInt32();
Vertex* vtxData = new Vertex[numVerts]; ModelVertex* vtxData = new ModelVertex[numVerts];
uint32_t* indicesData = new uint32_t[numPolys]; uint32_t* indicesData = new uint32_t[numPolys];
if (vertices != 0) if (vertices != 0)

View File

@ -43,15 +43,15 @@ namespace Ship
void ParseFileBinary(BinaryReader* reader, Resource* res) override; void ParseFileBinary(BinaryReader* reader, Resource* res) override;
}; };
struct Vertex struct ModelVertex
{ {
Vec3f pos; Vec3f pos;
Vec3f normal; Vec3f normal;
Color3b color; Color3b color;
Vec2f uv; Vec2f uv;
Vertex(); ModelVertex();
Vertex(BinaryReader* reader); ModelVertex(BinaryReader* reader);
}; };
class Model : public Resource class Model : public Resource
@ -62,7 +62,7 @@ namespace Ship
uint32_t numVerts; uint32_t numVerts;
uint32_t numPolys; uint32_t numPolys;
Vertex* vertices; ModelVertex* vertices;
Vec2f* boneWeights; Vec2f* boneWeights;
uint32_t* indices; uint32_t* indices;
}; };

View File

@ -1,5 +1,6 @@
#include "Utils.h" #include "Utils.h"
#include <cstring> #include <cstring>
#include <algorithm>
#ifdef _MSC_VER #ifdef _MSC_VER
#define strdup _strdup #define strdup _strdup
@ -58,4 +59,10 @@ namespace Ship {
return args; return args;
} }
std::string toLowerCase(std::string in) {
std::string cpy(in);
std::transform(cpy.begin(), cpy.end(), cpy.begin(), ::tolower);
return cpy;
}
} }

View File

@ -10,4 +10,5 @@ namespace Ship {
} }
std::vector<std::string> SplitText(const std::string& text, char separator, bool keep_quotes); std::vector<std::string> SplitText(const std::string& text, char separator, bool keep_quotes);
std::string toLowerCase(std::string in);
} }

View File

@ -1055,6 +1055,7 @@ s32 Inventory_HasEmptyBottle(void);
s32 Inventory_HasSpecificBottle(u8 bottleItem); s32 Inventory_HasSpecificBottle(u8 bottleItem);
void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 cButton); void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 cButton);
s32 Inventory_ConsumeFairy(GlobalContext* globalCtx); s32 Inventory_ConsumeFairy(GlobalContext* globalCtx);
bool Inventory_HatchPocketCucco(GlobalContext* globalCtx);
void Interface_SetDoAction(GlobalContext* globalCtx, u16 action); void Interface_SetDoAction(GlobalContext* globalCtx, u16 action);
void Interface_SetNaviCall(GlobalContext* globalCtx, u16 naviCallState); void Interface_SetNaviCall(GlobalContext* globalCtx, u16 naviCallState);
void Interface_LoadActionLabelB(GlobalContext* globalCtx, u16 action); void Interface_LoadActionLabelB(GlobalContext* globalCtx, u16 action);

View File

@ -30,4 +30,7 @@ typedef struct {
#define GIMESSAGE_UNTRANSLATED(giid, iid, message) \ #define GIMESSAGE_UNTRANSLATED(giid, iid, message) \
{ giid, iid, message, message, message } { giid, iid, message, message, message }
#define GIMESSAGE_NO_GERMAN(giid, iid, english, french) \
{ giid, iid, english, english, french }
#endif #endif

View File

@ -5,6 +5,7 @@
#include "debugconsole.h" #include "debugconsole.h"
#include "../libultraship/ImGuiImpl.h" #include "../libultraship/ImGuiImpl.h"
#include "savestates.h" #include "savestates.h"
#include "Console.h"
#include <vector> #include <vector>
#include <string> #include <string>
@ -32,7 +33,7 @@ extern GlobalContext* gGlobalCtx;
#define CMD_REGISTER SohImGui::BindCmd #define CMD_REGISTER SohImGui::BindCmd
static bool ActorSpawnHandler(const std::vector<std::string>& args) { 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)) { if ((args.size() != 9) && (args.size() != 3) && (args.size() != 6)) {
SohImGui::console->SendErrorMessage("Not enough arguments passed to actorspawn"); SohImGui::console->SendErrorMessage("Not enough arguments passed to actorspawn");
return CMD_FAILED; return CMD_FAILED;
@ -82,13 +83,13 @@ static bool ActorSpawnHandler(const std::vector<std::string>& args) {
} }
static bool KillPlayerHandler([[maybe_unused]] const std::vector<std::string>&) { static bool KillPlayerHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>&) {
gSaveContext.health = 0; gSaveContext.health = 0;
SohImGui::console->SendInfoMessage("[SOH] You've met with a terrible fate, haven't you?"); SohImGui::console->SendInfoMessage("[SOH] You've met with a terrible fate, haven't you?");
return CMD_SUCCESS; return CMD_SUCCESS;
} }
static bool SetPlayerHealthHandler(const std::vector<std::string>& args) { static bool SetPlayerHealthHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() != 2) { if (args.size() != 2) {
SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed"); SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed");
return CMD_FAILED; return CMD_FAILED;
@ -115,7 +116,7 @@ static bool SetPlayerHealthHandler(const std::vector<std::string>& args) {
} }
static bool LoadSceneHandler(const std::vector<std::string>&) { static bool LoadSceneHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>&) {
gSaveContext.respawnFlag = 0; gSaveContext.respawnFlag = 0;
gSaveContext.seqId = 0xFF; gSaveContext.seqId = 0xFF;
gSaveContext.gameMode = 0; gSaveContext.gameMode = 0;
@ -123,7 +124,7 @@ static bool LoadSceneHandler(const std::vector<std::string>&) {
return CMD_SUCCESS; return CMD_SUCCESS;
} }
static bool RuppeHandler(const std::vector<std::string>& args) { static bool RuppeHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() < 2) if (args.size() < 2)
return CMD_FAILED; return CMD_FAILED;
@ -147,7 +148,7 @@ static bool RuppeHandler(const std::vector<std::string>& args) {
return CMD_SUCCESS; return CMD_SUCCESS;
} }
static bool SetPosHandler(const std::vector<std::string> args) { static bool SetPosHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string> args) {
if (gGlobalCtx == nullptr) { if (gGlobalCtx == nullptr) {
SohImGui::console->SendErrorMessage("GlobalCtx == nullptr"); SohImGui::console->SendErrorMessage("GlobalCtx == nullptr");
return CMD_FAILED; return CMD_FAILED;
@ -174,7 +175,7 @@ static bool SetPosHandler(const std::vector<std::string> args) {
return CMD_SUCCESS; return CMD_SUCCESS;
} }
static bool ResetHandler(std::vector<std::string> args) { static bool ResetHandler(std::shared_ptr<Ship::Console> Console, std::vector<std::string> args) {
if (gGlobalCtx == nullptr) { if (gGlobalCtx == nullptr) {
SohImGui::console->SendErrorMessage("GlobalCtx == nullptr"); SohImGui::console->SendErrorMessage("GlobalCtx == nullptr");
return CMD_FAILED; return CMD_FAILED;
@ -195,7 +196,7 @@ const static std::map<std::string, uint16_t> ammoItems{
{ "magic_beans", ITEM_BEAN }, { "magic_beans", ITEM_BEAN },
}; };
static bool AmmoHandler(const std::vector<std::string>& args) { static bool AmmoHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() != 3) { if (args.size() != 3) {
SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed"); SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed");
return CMD_FAILED; return CMD_FAILED;
@ -238,7 +239,7 @@ const static std::map<std::string, uint16_t> bottleItems{
{ "big_poe", ITEM_BIG_POE }, { "blue_fire", ITEM_BLUE_FIRE }, { "rutos_letter", ITEM_LETTER_RUTO }, { "big_poe", ITEM_BIG_POE }, { "blue_fire", ITEM_BLUE_FIRE }, { "rutos_letter", ITEM_LETTER_RUTO },
}; };
static bool BottleHandler(const std::vector<std::string>& args) { static bool BottleHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() != 3) { if (args.size() != 3) {
SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed"); SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed");
return CMD_FAILED; return CMD_FAILED;
@ -270,7 +271,7 @@ static bool BottleHandler(const std::vector<std::string>& args) {
return CMD_SUCCESS; return CMD_SUCCESS;
} }
static bool BHandler(const std::vector<std::string>& args) { static bool BHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() != 2) { if (args.size() != 2) {
SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed"); SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed");
return CMD_FAILED; return CMD_FAILED;
@ -280,7 +281,7 @@ static bool BHandler(const std::vector<std::string>& args) {
return CMD_SUCCESS; return CMD_SUCCESS;
} }
static bool ItemHandler(const std::vector<std::string>& args) { static bool ItemHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() != 3) { if (args.size() != 3) {
SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed"); SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed");
return CMD_FAILED; return CMD_FAILED;
@ -291,7 +292,7 @@ static bool ItemHandler(const std::vector<std::string>& args) {
return CMD_SUCCESS; return CMD_SUCCESS;
} }
static bool EntranceHandler(const std::vector<std::string>& args) { static bool EntranceHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() != 2) { if (args.size() != 2) {
SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed"); SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed");
return CMD_FAILED; return CMD_FAILED;
@ -312,7 +313,7 @@ static bool EntranceHandler(const std::vector<std::string>& args) {
gSaveContext.nextTransition = 11; gSaveContext.nextTransition = 11;
} }
static bool SaveStateHandler(const std::vector<std::string>& args) { static bool SaveStateHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot(); unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot();
const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::SAVE }); const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::SAVE });
@ -323,11 +324,10 @@ static bool SaveStateHandler(const std::vector<std::string>& args) {
case SaveStateReturn::FAIL_WRONG_GAMESTATE: case SaveStateReturn::FAIL_WRONG_GAMESTATE:
SohImGui::console->SendErrorMessage("[SOH] Can not save a state outside of \"GamePlay\""); SohImGui::console->SendErrorMessage("[SOH] Can not save a state outside of \"GamePlay\"");
return CMD_FAILED; return CMD_FAILED;
} }
} }
static bool LoadStateHandler(const std::vector<std::string>& args) { static bool LoadStateHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot(); unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot();
const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::LOAD }); const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::LOAD });
@ -348,7 +348,7 @@ static bool LoadStateHandler(const std::vector<std::string>& args) {
} }
static bool StateSlotSelectHandler(const std::vector<std::string>& args) { static bool StateSlotSelectHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() != 2) { if (args.size() != 2) {
SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed"); SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed");
return CMD_FAILED; return CMD_FAILED;
@ -404,7 +404,7 @@ static int CheckVarType(const std::string& input)
return result; return result;
} }
static bool SetCVarHandler(const std::vector<std::string>& args) { static bool SetCVarHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() < 3) if (args.size() < 3)
return CMD_FAILED; return CMD_FAILED;
@ -434,7 +434,7 @@ static bool SetCVarHandler(const std::vector<std::string>& args) {
} }
static bool GetCVarHandler(const std::vector<std::string>& args) { static bool GetCVarHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() < 2) if (args.size() < 2)
return CMD_FAILED; return CMD_FAILED;

View File

@ -533,15 +533,18 @@ void DrawBGSItemFlag(uint8_t itemID) {
ImGui::SameLine(); ImGui::SameLine();
int tradeIndex = itemID - ITEM_POCKET_EGG; int tradeIndex = itemID - ITEM_POCKET_EGG;
bool hasItem = (gSaveContext.adultTradeItems & (1 << tradeIndex)) != 0; bool hasItem = (gSaveContext.adultTradeItems & (1 << tradeIndex)) != 0;
ImGui::Checkbox(("##adultTradeFlag" + std::to_string(itemID)).c_str(), &hasItem); bool shouldHaveItem = hasItem;
if (hasItem) { ImGui::Checkbox(("##adultTradeFlag" + std::to_string(itemID)).c_str(), &shouldHaveItem);
gSaveContext.adultTradeItems |= (1 << tradeIndex); if (hasItem != shouldHaveItem) {
if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_NONE) { if (shouldHaveItem) {
INV_CONTENT(ITEM_TRADE_ADULT) = ITEM_POCKET_EGG + tradeIndex; gSaveContext.adultTradeItems |= (1 << tradeIndex);
if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_NONE) {
INV_CONTENT(ITEM_TRADE_ADULT) = ITEM_POCKET_EGG + tradeIndex;
}
} else {
gSaveContext.adultTradeItems &= ~(1 << tradeIndex);
Inventory_ReplaceItem(gGlobalCtx, itemID, Randomizer_GetNextAdultTradeItem());
} }
} else {
gSaveContext.adultTradeItems &= ~(1 << tradeIndex);
Inventory_ReplaceItem(gGlobalCtx, INV_CONTENT(ITEM_TRADE_ADULT), Randomizer_GetNextAdultTradeItem());
} }
} }
@ -586,6 +589,9 @@ void DrawInventoryTab() {
if (ImGui::BeginPopup(itemPopupPicker)) { if (ImGui::BeginPopup(itemPopupPicker)) {
if (ImGui::Button("##itemNonePicker", ImVec2(32.0f, 32.0f))) { if (ImGui::Button("##itemNonePicker", ImVec2(32.0f, 32.0f))) {
gSaveContext.inventory.items[selectedIndex] = ITEM_NONE; gSaveContext.inventory.items[selectedIndex] = ITEM_NONE;
if (selectedIndex == SLOT_TRADE_ADULT) {
gSaveContext.adultTradeItems = 0;
}
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
SetLastItemHoverText("None"); SetLastItemHoverText("None");
@ -616,17 +622,13 @@ void DrawInventoryTab() {
if (ImGui::ImageButton(SohImGui::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), if (ImGui::ImageButton(SohImGui::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f),
ImVec2(0, 0), ImVec2(1, 1), 0)) { ImVec2(0, 0), ImVec2(1, 1), 0)) {
gSaveContext.inventory.items[selectedIndex] = slotEntry.id; gSaveContext.inventory.items[selectedIndex] = slotEntry.id;
// Set adult trade item flag if you're playing adult trade shuffle in rando // Set adult trade item flag if you're playing adult trade shuffle in rando
if (gSaveContext.n64ddFlag && if (gSaveContext.n64ddFlag &&
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_ADULT_TRADE) && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_ADULT_TRADE);
selectedIndex == SLOT_TRADE_ADULT) { selectedIndex == SLOT_TRADE_ADULT &&
if (slotEntry.id == ITEM_NONE) { slotEntry.id >= ITEM_POCKET_EGG && slotEntry.id <= ITEM_CLAIM_CHECK) {
gSaveContext.adultTradeItems = 0; gSaveContext.adultTradeItems |= ADULT_TRADE_FLAG(slotEntry.id);
} else if (slotEntry.id >= ITEM_POCKET_EGG && slotEntry.id <= ITEM_CLAIM_CHECK) { }
uint32_t tradeID = slotEntry.id - ITEM_POCKET_EGG;
gSaveContext.adultTradeItems |= tradeID;
}
}
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
SetLastItemHoverText(SohUtils::GetItemName(slotEntry.id)); SetLastItemHoverText(SohUtils::GetItemName(slotEntry.id));

View File

@ -593,6 +593,13 @@ string_view kingZoraSpeedRandom = "King Zora will move out of the way in 1
string_view completeMaskDesc = "Once the happy mask shop is opened, all masks\n" // string_view completeMaskDesc = "Once the happy mask shop is opened, all masks\n" //
"will be available to be borrowed."; // "will be available to be borrowed."; //
/*------------------------------ // /*------------------------------ //
| ENABLE GLITCH CUTSCENES | //
------------------------------*/ //
string_view glitchCutscenesDesc = "The cutscenes of the Poes in Forest Temple and\n" //
"Darunia in Fire Temple will not be skipped.\n" //
"These cutscenes are only useful for glitched\n" //
"gameplay and can be safely skipped otherwise."; //
/*------------------------------ //
| QUICK TEXT | // | QUICK TEXT | //
------------------------------*/ // ------------------------------*/ //
string_view quickTextDesc0 = "Quick text will be unchanged, requiring\n" // string_view quickTextDesc0 = "Quick text will be unchanged, requiring\n" //

View File

@ -198,6 +198,8 @@ extern string_view kingZoraSpeedRandom;
extern string_view completeMaskDesc; extern string_view completeMaskDesc;
extern string_view glitchCutscenesDesc;
extern string_view quickTextDesc0; extern string_view quickTextDesc0;
extern string_view quickTextDesc1; extern string_view quickTextDesc1;
extern string_view quickTextDesc2; extern string_view quickTextDesc2;

View File

@ -191,7 +191,7 @@ namespace Settings {
//Shuffle Dungeon Items //Shuffle Dungeon Items
Option RandomizeDungeon = Option::Bool("Randomize Settings", {"No","Yes"}, {dungeonRandomize}, OptionCategory::Toggle); Option RandomizeDungeon = Option::Bool("Randomize Settings", {"No","Yes"}, {dungeonRandomize}, OptionCategory::Toggle);
Option MapsAndCompasses = Option::U8 ("Start with Maps/Compasses", {"Start With", "Vanilla", "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere"}, Option MapsAndCompasses = Option::U8 ("Maps/Compasses", {"Start With", "Vanilla", "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere"},
{mapCompassStartWith, mapCompassVanilla, mapCompassOwnDungeon, mapCompassAnyDungeon, mapCompassOverworld, mapCompassAnywhere}, OptionCategory::Setting, MAPSANDCOMPASSES_OWN_DUNGEON); {mapCompassStartWith, mapCompassVanilla, mapCompassOwnDungeon, mapCompassAnyDungeon, mapCompassOverworld, mapCompassAnywhere}, OptionCategory::Setting, MAPSANDCOMPASSES_OWN_DUNGEON);
Option Keysanity = Option::U8 ("Small Keys", {"Start With", "Vanilla", "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere"}, Option Keysanity = Option::U8 ("Small Keys", {"Start With", "Vanilla", "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere"},
{smallKeyStartWith, smallKeyVanilla, smallKeyOwnDungeon, smallKeyAnyDungeon, smallKeyOverworld, smallKeyAnywhere}, OptionCategory::Setting, KEYSANITY_OWN_DUNGEON); {smallKeyStartWith, smallKeyVanilla, smallKeyOwnDungeon, smallKeyAnyDungeon, smallKeyOverworld, smallKeyAnywhere}, OptionCategory::Setting, KEYSANITY_OWN_DUNGEON);
@ -265,6 +265,7 @@ namespace Settings {
Option NumRequiredCuccos = Option::U8 ("Cuccos to return", {NumOpts(0, 7)}, {numRequiredCuccosDesc}); Option NumRequiredCuccos = Option::U8 ("Cuccos to return", {NumOpts(0, 7)}, {numRequiredCuccosDesc});
Option KingZoraSpeed = Option::U8 ("King Zora Speed", {"Fast", "Vanilla", "Random"}, {kingZoraSpeedFast, kingZoraSpeedVanilla, kingZoraSpeedRandom}); Option KingZoraSpeed = Option::U8 ("King Zora Speed", {"Fast", "Vanilla", "Random"}, {kingZoraSpeedFast, kingZoraSpeedVanilla, kingZoraSpeedRandom});
Option CompleteMaskQuest = Option::Bool("Complete Mask Quest", {"Off", "On"}, {completeMaskDesc}); Option CompleteMaskQuest = Option::Bool("Complete Mask Quest", {"Off", "On"}, {completeMaskDesc});
Option EnableGlitchCutscenes = Option::Bool("Enable Glitch-Useful Cutscenes", {"Off", "On"}, {glitchCutscenesDesc});
Option QuickText = Option::U8 ("Quick Text", {"0: Vanilla", "1: Skippable", "2: Instant", "3: Turbo"}, {quickTextDesc0, quickTextDesc1, quickTextDesc2, quickTextDesc3}, OptionCategory::Setting, QUICKTEXT_INSTANT); Option QuickText = Option::U8 ("Quick Text", {"0: Vanilla", "1: Skippable", "2: Instant", "3: Turbo"}, {quickTextDesc0, quickTextDesc1, quickTextDesc2, quickTextDesc3}, OptionCategory::Setting, QUICKTEXT_INSTANT);
Option SkipSongReplays = Option::U8 ("Skip Song Replays", {"Don't Skip", "Skip (No SFX)", "Skip (Keep SFX)"}, {skipSongReplaysDesc}); Option SkipSongReplays = Option::U8 ("Skip Song Replays", {"Don't Skip", "Skip (No SFX)", "Skip (Keep SFX)"}, {skipSongReplaysDesc});
Option KeepFWWarpPoint = Option::Bool("Keep FW Warp Point", {"Off", "On"}, {keepFWWarpPointDesc}); Option KeepFWWarpPoint = Option::Bool("Keep FW Warp Point", {"Off", "On"}, {keepFWWarpPointDesc});
@ -281,6 +282,7 @@ namespace Settings {
&NumRequiredCuccos, &NumRequiredCuccos,
&KingZoraSpeed, &KingZoraSpeed,
&CompleteMaskQuest, &CompleteMaskQuest,
&EnableGlitchCutscenes,
&QuickText, &QuickText,
&SkipSongReplays, &SkipSongReplays,
&KeepFWWarpPoint, &KeepFWWarpPoint,
@ -1302,6 +1304,7 @@ namespace Settings {
ctx.numRequiredCuccos = NumRequiredCuccos.Value<uint8_t>(); ctx.numRequiredCuccos = NumRequiredCuccos.Value<uint8_t>();
ctx.kingZoraSpeed = KingZoraSpeed.Value<uint8_t>(); ctx.kingZoraSpeed = KingZoraSpeed.Value<uint8_t>();
ctx.completeMaskQuest = CompleteMaskQuest ? 1 : 0; ctx.completeMaskQuest = CompleteMaskQuest ? 1 : 0;
ctx.enableGlitchCutscenes = EnableGlitchCutscenes ? 1 : 0;
ctx.quickText = QuickText.Value<uint8_t>(); ctx.quickText = QuickText.Value<uint8_t>();
ctx.skipSongReplays = SkipSongReplays.Value<uint8_t>(); ctx.skipSongReplays = SkipSongReplays.Value<uint8_t>();
ctx.keepFWWarpPoint = KeepFWWarpPoint ? 1 : 0; ctx.keepFWWarpPoint = KeepFWWarpPoint ? 1 : 0;
@ -2572,6 +2575,8 @@ namespace Settings {
CompleteMaskQuest.SetSelectedIndex(cvarSettings[RSK_COMPLETE_MASK_QUEST]); CompleteMaskQuest.SetSelectedIndex(cvarSettings[RSK_COMPLETE_MASK_QUEST]);
EnableGlitchCutscenes.SetSelectedIndex(cvarSettings[RSK_ENABLE_GLITCH_CUTSCENES]);
NightGSExpectSuns.SetSelectedIndex(cvarSettings[RSK_SKULLS_SUNS_SONG]); NightGSExpectSuns.SetSelectedIndex(cvarSettings[RSK_SKULLS_SUNS_SONG]);
// RANDOTODO implement chest shuffle with keysanity // RANDOTODO implement chest shuffle with keysanity

View File

@ -440,6 +440,7 @@ typedef struct {
uint8_t numRequiredCuccos; uint8_t numRequiredCuccos;
uint8_t kingZoraSpeed; uint8_t kingZoraSpeed;
uint8_t completeMaskQuest; uint8_t completeMaskQuest;
uint8_t enableGlitchCutscenes;
uint8_t quickText; uint8_t quickText;
uint8_t skipSongReplays; uint8_t skipSongReplays;
uint8_t keepFWWarpPoint; uint8_t keepFWWarpPoint;
@ -942,6 +943,7 @@ void UpdateSettings(std::unordered_map<RandomizerSettingKey, uint8_t> cvarSettin
extern Option NumRequiredCuccos; extern Option NumRequiredCuccos;
extern Option KingZoraSpeed; extern Option KingZoraSpeed;
extern Option CompleteMaskQuest; extern Option CompleteMaskQuest;
extern Option EnableGlitchCutscenes;
extern Option QuickText; extern Option QuickText;
extern Option SkipSongReplays; extern Option SkipSongReplays;
extern Option KeepFWWarpPoint; extern Option KeepFWWarpPoint;

View File

@ -348,7 +348,8 @@ static void WriteSettings(const bool printAll = false) {
setting->GetName() == "Skip Epona Race" || setting->GetName() == "Skip Epona Race" ||
setting->GetName() == "Skip Tower Escape" || setting->GetName() == "Skip Tower Escape" ||
setting->GetName() == "Skip Child Stealth" || setting->GetName() == "Skip Child Stealth" ||
setting->GetName() == "Complete Mask Quest") { setting->GetName() == "Complete Mask Quest" ||
setting->GetName() == "Enable Glitch-Useful Cutscenes") {
std::string settingName = menu->name + ":" + setting->GetName(); std::string settingName = menu->name + ":" + setting->GetName();
jsonData["settings"][settingName] = setting->GetSelectedOptionText(); jsonData["settings"][settingName] = setting->GetSelectedOptionText();
} }

View File

@ -4,6 +4,7 @@
#include <z64.h> #include <z64.h>
#define ADULT_TRADE_FLAG(itemId) (1 << (itemId - ITEM_POCKET_EGG)) #define ADULT_TRADE_FLAG(itemId) (1 << (itemId - ITEM_POCKET_EGG))
#define PLAYER_HAS_SHUFFLED_ADULT_TRADE_ITEM(itemID) (gSaveContext.adultTradeItems & ADULT_TRADE_FLAG(itemID))
void Randomizer_ConsumeAdultTradeItem(GlobalContext* globalCtx, u8 itemId); void Randomizer_ConsumeAdultTradeItem(GlobalContext* globalCtx, u8 itemId);
u8 Randomizer_GetNextAdultTradeItem(); u8 Randomizer_GetNextAdultTradeItem();

View File

@ -1441,13 +1441,14 @@ std::unordered_map<std::string, RandomizerSettingKey> SpoilerfileSettingNameToEn
{ "Open Settings:Token Count", RSK_RAINBOW_BRIDGE_TOKEN_COUNT }, { "Open Settings:Token Count", RSK_RAINBOW_BRIDGE_TOKEN_COUNT },
{ "Open Settings:Random Ganon's Trials", RSK_RANDOM_TRIALS }, { "Open Settings:Random Ganon's Trials", RSK_RANDOM_TRIALS },
{ "Open Settings:Trial Count", RSK_TRIAL_COUNT }, { "Open Settings:Trial Count", RSK_TRIAL_COUNT },
{ "Shuffle Settings:Shuffle Gerudo Card", RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD },
{ "Shuffle Settings:Shuffle Cows", RSK_SHUFFLE_COWS }, { "Shuffle Settings:Shuffle Cows", RSK_SHUFFLE_COWS },
{ "Shuffle Settings:Tokensanity", RSK_SHUFFLE_TOKENS }, { "Shuffle Settings:Tokensanity", RSK_SHUFFLE_TOKENS },
{ "Shuffle Settings:Shuffle Adult Trade", RSK_SHUFFLE_ADULT_TRADE }, { "Shuffle Settings:Shuffle Adult Trade", RSK_SHUFFLE_ADULT_TRADE },
{ "Start with Deku Shield", RSK_STARTING_DEKU_SHIELD }, { "Start with Deku Shield", RSK_STARTING_DEKU_SHIELD },
{ "Start with Kokiri Sword", RSK_STARTING_KOKIRI_SWORD }, { "Start with Kokiri Sword", RSK_STARTING_KOKIRI_SWORD },
{ "Start with Fairy Ocarina", RSK_STARTING_OCARINA }, { "Start with Fairy Ocarina", RSK_STARTING_OCARINA },
{ "Shuffle Dungeon Items:Start with Maps/Compasses", RSK_STARTING_MAPS_COMPASSES }, { "Shuffle Dungeon Items:Maps/Compasses", RSK_STARTING_MAPS_COMPASSES },
{ "Shuffle Dungeon Items:Small Keys", RSK_KEYSANITY }, { "Shuffle Dungeon Items:Small Keys", RSK_KEYSANITY },
{ "Shuffle Dungeon Items:Gerudo Fortress Keys", RSK_GERUDO_KEYS }, { "Shuffle Dungeon Items:Gerudo Fortress Keys", RSK_GERUDO_KEYS },
{ "Shuffle Dungeon Items:Boss Keys", RSK_BOSS_KEYSANITY }, { "Shuffle Dungeon Items:Boss Keys", RSK_BOSS_KEYSANITY },
@ -1464,6 +1465,7 @@ std::unordered_map<std::string, RandomizerSettingKey> SpoilerfileSettingNameToEn
{ "Timesaver Settings:Skip Epona Race", RSK_SKIP_EPONA_RACE }, { "Timesaver Settings:Skip Epona Race", RSK_SKIP_EPONA_RACE },
{ "Timesaver Settings:Skip Tower Escape", RSK_SKIP_TOWER_ESCAPE }, { "Timesaver Settings:Skip Tower Escape", RSK_SKIP_TOWER_ESCAPE },
{ "Timesaver Settings:Complete Mask Quest", RSK_COMPLETE_MASK_QUEST }, { "Timesaver Settings:Complete Mask Quest", RSK_COMPLETE_MASK_QUEST },
{ "Timesaver Settings:Enable Glitch-Useful Cutscenes", RSK_ENABLE_GLITCH_CUTSCENES },
}; };
s32 Randomizer::GetItemIDFromGetItemID(s32 getItemId) { s32 Randomizer::GetItemIDFromGetItemID(s32 getItemId) {
@ -1678,12 +1680,14 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) {
numericValueString = it.value(); numericValueString = it.value();
gSaveContext.randoSettings[index].value = std::stoi(numericValueString); gSaveContext.randoSettings[index].value = std::stoi(numericValueString);
break; break;
case RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD:
case RSK_SHUFFLE_COWS: case RSK_SHUFFLE_COWS:
case RSK_SHUFFLE_ADULT_TRADE: case RSK_SHUFFLE_ADULT_TRADE:
case RSK_RANDOM_TRIALS: case RSK_RANDOM_TRIALS:
case RSK_STARTING_DEKU_SHIELD: case RSK_STARTING_DEKU_SHIELD:
case RSK_STARTING_KOKIRI_SWORD: case RSK_STARTING_KOKIRI_SWORD:
case RSK_COMPLETE_MASK_QUEST: case RSK_COMPLETE_MASK_QUEST:
case RSK_ENABLE_GLITCH_CUTSCENES:
if(it.value() == "Off") { if(it.value() == "Off") {
gSaveContext.randoSettings[index].value = 0; gSaveContext.randoSettings[index].value = 0;
} else if(it.value() == "On") { } else if(it.value() == "On") {
@ -2046,18 +2050,18 @@ GetItemID Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId)
return ogItemId; return ogItemId;
case RG_KOKIRI_SWORD: case RG_KOKIRI_SWORD:
return GI_SWORD_KOKIRI; return !CHECK_OWNED_EQUIP(EQUIP_SWORD, 0) ? GI_SWORD_KOKIRI : GI_RUPEE_BLUE;
case RG_GIANTS_KNIFE: case RG_GIANTS_KNIFE:
return GI_SWORD_KNIFE; return GI_SWORD_KNIFE;
case RG_BIGGORON_SWORD: case RG_BIGGORON_SWORD:
return GI_SWORD_BGS; return !CHECK_OWNED_EQUIP(EQUIP_SWORD, 2) ? GI_SWORD_BGS : GI_RUPEE_BLUE;
case RG_DEKU_SHIELD: case RG_DEKU_SHIELD:
return GI_SHIELD_DEKU; return GI_SHIELD_DEKU;
case RG_HYLIAN_SHIELD: case RG_HYLIAN_SHIELD:
return GI_SHIELD_HYLIAN; return GI_SHIELD_HYLIAN;
case RG_MIRROR_SHIELD: case RG_MIRROR_SHIELD:
return GI_SHIELD_MIRROR; return !CHECK_OWNED_EQUIP(EQUIP_SHIELD, 2) ? GI_SHIELD_MIRROR : GI_RUPEE_BLUE;
case RG_GORON_TUNIC: case RG_GORON_TUNIC:
return GI_TUNIC_GORON; return GI_TUNIC_GORON;
@ -2065,35 +2069,35 @@ GetItemID Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId)
return GI_TUNIC_ZORA; return GI_TUNIC_ZORA;
case RG_IRON_BOOTS: case RG_IRON_BOOTS:
return GI_BOOTS_IRON; return !CHECK_OWNED_EQUIP(EQUIP_BOOTS, 1) ? GI_BOOTS_IRON : GI_RUPEE_BLUE;
case RG_HOVER_BOOTS: case RG_HOVER_BOOTS:
return GI_BOOTS_HOVER; return !CHECK_OWNED_EQUIP(EQUIP_BOOTS, 2) ? GI_BOOTS_HOVER : GI_RUPEE_BLUE;
case RG_BOOMERANG: case RG_BOOMERANG:
return GI_BOOMERANG; return INV_CONTENT(ITEM_BOOMERANG) == ITEM_NONE ? GI_BOOMERANG : GI_RUPEE_BLUE;
case RG_LENS_OF_TRUTH: case RG_LENS_OF_TRUTH:
return GI_LENS; return INV_CONTENT(ITEM_LENS) == ITEM_NONE ? GI_LENS : GI_RUPEE_BLUE;
case RG_MEGATON_HAMMER: case RG_MEGATON_HAMMER:
return GI_HAMMER; return INV_CONTENT(ITEM_HAMMER) == ITEM_NONE ? GI_HAMMER : GI_RUPEE_BLUE;
case RG_STONE_OF_AGONY: case RG_STONE_OF_AGONY:
return GI_STONE_OF_AGONY; return GI_STONE_OF_AGONY;
case RG_DINS_FIRE: case RG_DINS_FIRE:
return GI_DINS_FIRE; return INV_CONTENT(ITEM_DINS_FIRE) == ITEM_NONE ? GI_DINS_FIRE : GI_RUPEE_BLUE;
case RG_FARORES_WIND: case RG_FARORES_WIND:
return GI_FARORES_WIND; return INV_CONTENT(ITEM_FARORES_WIND) == ITEM_NONE ? GI_FARORES_WIND : GI_RUPEE_BLUE;
case RG_NAYRUS_LOVE: case RG_NAYRUS_LOVE:
return GI_NAYRUS_LOVE; return INV_CONTENT(ITEM_NAYRUS_LOVE) == ITEM_NONE ? GI_NAYRUS_LOVE : GI_RUPEE_BLUE;
case RG_FIRE_ARROWS: case RG_FIRE_ARROWS:
return GI_ARROW_FIRE; return INV_CONTENT(ITEM_ARROW_FIRE) == ITEM_NONE ? GI_ARROW_FIRE : GI_RUPEE_BLUE;
case RG_ICE_ARROWS: case RG_ICE_ARROWS:
return GI_ARROW_ICE; return INV_CONTENT(ITEM_ARROW_ICE) == ITEM_NONE ? GI_ARROW_ICE : GI_RUPEE_BLUE;
case RG_LIGHT_ARROWS: case RG_LIGHT_ARROWS:
return GI_ARROW_LIGHT; return INV_CONTENT(ITEM_ARROW_LIGHT) == ITEM_NONE ? GI_ARROW_LIGHT : GI_RUPEE_BLUE;
case RG_GERUDO_MEMBERSHIP_CARD: case RG_GERUDO_MEMBERSHIP_CARD:
return GI_GERUDO_CARD; return GI_GERUDO_CARD;
@ -2104,7 +2108,7 @@ GetItemID Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId)
return GI_BEAN; //todo make it 10 of them return GI_BEAN; //todo make it 10 of them
case RG_DOUBLE_DEFENSE: case RG_DOUBLE_DEFENSE:
return GI_DOUBLE_DEFENSE; return !gSaveContext.doubleDefense ? GI_DOUBLE_DEFENSE : GI_RUPEE_BLUE;
case RG_WEIRD_EGG: case RG_WEIRD_EGG:
return GI_WEIRD_EGG; return GI_WEIRD_EGG;
@ -3582,6 +3586,7 @@ void GenerateRandomizerImgui() {
cvarSettings[RSK_SKIP_EPONA_RACE] = CVar_GetS32("gRandomizeSkipEponaRace", 0); cvarSettings[RSK_SKIP_EPONA_RACE] = CVar_GetS32("gRandomizeSkipEponaRace", 0);
cvarSettings[RSK_SKIP_TOWER_ESCAPE] = CVar_GetS32("gRandomizeSkipTowerEscape", 0); cvarSettings[RSK_SKIP_TOWER_ESCAPE] = CVar_GetS32("gRandomizeSkipTowerEscape", 0);
cvarSettings[RSK_COMPLETE_MASK_QUEST] = CVar_GetS32("gRandomizeCompleteMaskQuest", 0); cvarSettings[RSK_COMPLETE_MASK_QUEST] = CVar_GetS32("gRandomizeCompleteMaskQuest", 0);
cvarSettings[RSK_ENABLE_GLITCH_CUTSCENES] = CVar_GetS32("gRandomizeEnableGlitchCutscenes", 0);
cvarSettings[RSK_SKULLS_SUNS_SONG] = CVar_GetS32("gRandomizeGsExpectSunsSong", 0); cvarSettings[RSK_SKULLS_SUNS_SONG] = CVar_GetS32("gRandomizeGsExpectSunsSong", 0);
@ -4176,6 +4181,24 @@ void DrawRandoEditor(bool& open) {
SohImGui::EnhancementCombobox("gRandomizeShuffleDungeonReward", randoShuffleDungeonRewards, 4, 0); SohImGui::EnhancementCombobox("gRandomizeShuffleDungeonReward", randoShuffleDungeonRewards, 4, 0);
PaddedSeparator(); PaddedSeparator();
// Maps & Compasses
ImGui::Text(Settings::MapsAndCompasses.GetName().c_str());
InsertHelpHoverText(
"Start with - You will start with Maps & Compasses from all dungeons.\n"
"\n"
"Vanilla - Maps & Compasses will appear in their vanilla locations.\n"
"\n"
"Own dungeon - Maps & Compasses can only appear in their respective dungeon.\n"
"\n"
"Any dungeon - Maps & Compasses can only appear inside of any dungon.\n"
"\n"
"Overworld - Maps & Compasses can only appear outside of dungeons.\n"
"\n"
"Anywhere - Maps & Compasses can appear anywhere in the world."
);
SohImGui::EnhancementCombobox("gRandomizeStartingMapsCompasses", randoShuffleMapsAndCompasses, 6, 2);
PaddedSeparator();
// Keysanity // Keysanity
ImGui::Text(Settings::Keysanity.GetName().c_str()); ImGui::Text(Settings::Keysanity.GetName().c_str());
InsertHelpHoverText( InsertHelpHoverText(
@ -4242,24 +4265,6 @@ void DrawRandoEditor(bool& open) {
"Anywhere - Ganon's Boss Key Key can appear anywhere in the world." "Anywhere - Ganon's Boss Key Key can appear anywhere in the world."
); );
SohImGui::EnhancementCombobox("gRandomizeShuffleGanonBossKey", randoShuffleGanonsBossKey, 6, 1); SohImGui::EnhancementCombobox("gRandomizeShuffleGanonBossKey", randoShuffleGanonsBossKey, 6, 1);
PaddedSeparator();
// Start with Maps & Compasses
ImGui::Text(Settings::MapsAndCompasses.GetName().c_str());
InsertHelpHoverText(
"Start with - You will start with Maps & Compasses from all dungeons.\n"
"\n"
"Vanilla - Maps & Compasses will appear in their vanilla locations.\n"
"\n"
"Own dungeon - Maps & Compasses can only appear in their respective dungeon.\n"
"\n"
"Any dungeon - Maps & Compasses can only appear inside of any dungon.\n"
"\n"
"Overworld - Maps & Compasses can only appear outside of dungeons.\n"
"\n"
"Anywhere - Maps & Compasses can appear anywhere in the world."
);
SohImGui::EnhancementCombobox("gRandomizeStartingMapsCompasses", randoShuffleMapsAndCompasses, 6, 2);
ImGui::PopItemWidth(); ImGui::PopItemWidth();
ImGui::EndTable(); ImGui::EndTable();
@ -4347,6 +4352,14 @@ void DrawRandoEditor(bool& open) {
InsertHelpHoverText( InsertHelpHoverText(
"Once the happy mask shop is opened, all masks will be available to be borrowed." "Once the happy mask shop is opened, all masks will be available to be borrowed."
); );
PaddedSeparator();
// Enable Glitch-Useful Cutscenes
SohImGui::EnhancementCheckbox(Settings::EnableGlitchCutscenes.GetName().c_str(), "gRandomizeEnableGlitchCutscenes");
InsertHelpHoverText(
"The cutscenes of the Poes in Forest Temple and Darunia in Fire Temple will not be skipped. "
"These cutscenes are only useful for glitched gameplay and can be safely skipped otherwise."
);
// COLUMN 2 - HINT SETTINGS // COLUMN 2 - HINT SETTINGS
ImGui::TableNextColumn(); ImGui::TableNextColumn();
@ -4629,64 +4642,72 @@ void Randomizer::CreateCustomMessages() {
const std::vector<GetItemMessage> getItemMessages = { const std::vector<GetItemMessage> getItemMessages = {
GIMESSAGE(GI_ICE_TRAP, ITEM_NONE, "\x08\x06\x30You are a %bFOWL%w!\x0E\x20", GIMESSAGE(GI_ICE_TRAP, ITEM_NONE, "\x08\x06\x30You are a %bFOWL%w!\x0E\x20",
"\x08\x06\x15 Du bist ein %bDUMMKOPF%w!\x0E\x20", "\x08\x06\x50%bIDIOT%w\x0E\x20"), "\x08\x06\x15 Du bist ein %bDUMMKOPF%w!\x0E\x20", "\x08\x06\x50%bIDIOT%w\x0E\x20"),
GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_BLUE_FIRE, ITEM_BLUE_FIRE, GIMESSAGE_NO_GERMAN(GI_BOTTLE_WITH_BLUE_FIRE, ITEM_BLUE_FIRE,
"You got a %rBottle with Blue &Fire%w! Use it to melt Red Ice!"), "You got a %rBottle with Blue &Fire%w! Use it to melt Red Ice!",
GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_BIG_POE, ITEM_BIG_POE, "Vous obtenez une %rBouteille avec&une Flamme Bleue%w! Utilisez-la&pour faire fondre la %rGlace&Rouge%w!"),
"You got a %rBig Poe in a Bottle%w!&Sell it to the Ghost Shop!"), GIMESSAGE_NO_GERMAN(GI_BOTTLE_WITH_BIG_POE, ITEM_BIG_POE,
GIMESSAGE_UNTRANSLATED( "You got a %rBig Poe in a Bottle%w!&Sell it to the Ghost Shop!",
GI_BOTTLE_WITH_BLUE_POTION, ITEM_POTION_BLUE, "Vous obtenez une %rBouteille avec&une Âme%w! Vendez-la au Marchand&d'Âme"),
"You got a %rBottle of Blue Potion%w!&Drink it to replenish your&%ghealth%w and %bmagic%w!"), GIMESSAGE_NO_GERMAN(GI_BOTTLE_WITH_BLUE_POTION, ITEM_POTION_BLUE,
GIMESSAGE_UNTRANSLATED( "You got a %rBottle of Blue Potion%w!&Drink it to replenish your&%ghealth%w and %bmagic%w!",
GI_BOTTLE_WITH_FISH, ITEM_FISH, "Vous obtenez une %rBouteille avec&une Potion Bleue%w! Buvez-la pour&restaurer votre %rénergie vitale%w&ainsi que votre %gmagie%w!"),
"You got a %rFish in a Bottle%w!&It looks fresh and delicious!&They say Jabu-Jabu loves them!"), GIMESSAGE_NO_GERMAN(GI_BOTTLE_WITH_FISH, ITEM_FISH,
GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_BUGS, ITEM_BUG, "You got a %rFish in a Bottle%w!&It looks fresh and delicious!&They say Jabu-Jabu loves them!",
"You got a %rBug in a Bottle%w!&They love to burrow in&dirt holes!"), "Vous obtenez une %rBouteille avec&un Poisson%w! Il a l'air délicieux!&Il paraîtrait que %bJabu-Jabu %wen&serait friand!"),
GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_FAIRY, ITEM_FAIRY, "You got a %rFairy in a Bottle%w!&Use it wisely!"), GIMESSAGE_NO_GERMAN(GI_BOTTLE_WITH_BUGS, ITEM_BUG,
GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_RED_POTION, ITEM_POTION_RED, "You got a %rBug in a Bottle%w!&They love to burrow in&dirt holes!",
"You got a %rBottle of Red Potion%w!&Drink it to replenish your&%ghealth%w!"), "Vous obtenez une %rBouteille avec&des Insectes%w! Ils adorent creuser&dans la terre meuble!"),
GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_GREEN_POTION, ITEM_POTION_GREEN, GIMESSAGE_NO_GERMAN(GI_BOTTLE_WITH_FAIRY, ITEM_FAIRY,
"You got a %rBottle of Green Potion%w!&Drink it to replenish your&%bmagic%w!"), "You got a %rFairy in a Bottle%w!&Use it wisely!",
GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_POE, ITEM_POE, "Vous obtenez une %rBouteille avec&une Fée%w! Faites-en bon usage!"),
"You got a %rPoe in a Bottle%w!&That creepy Ghost Shop might&be interested in this..."), GIMESSAGE_NO_GERMAN(GI_BOTTLE_WITH_RED_POTION, ITEM_POTION_RED,
"You got a %rBottle of Red Potion%w!&Drink it to replenish your&%ghealth%w!",
"Vous obtenez une %rBouteille avec&une Potion Rouge%w! Buvez-la pour&restaurer votre %rénergie vitale%w!"),
GIMESSAGE_NO_GERMAN(GI_BOTTLE_WITH_GREEN_POTION, ITEM_POTION_GREEN,
"You got a %rBottle of Green Potion%w!&Drink it to replenish your&%bmagic%w!",
"Vous obtenez une %rBouteille avec&une Potion Verte%w! Buvez-la pour&restaurer votre %gmagie%w!"),
GIMESSAGE_NO_GERMAN(GI_BOTTLE_WITH_POE, ITEM_POE,
"You got a %rPoe in a Bottle%w!&That creepy Ghost Shop might&be interested in this...",
"Vous obtenez une %rBouteille avec&un Esprit%w! Ça intéresserait&peut-être le vendeur d'Âme "),
GIMESSAGE_UNTRANSLATED(GI_GERUDO_FORTRESS_SMALL_KEY, ITEM_KEY_SMALL, "You found a %yThieves Hideout &%wSmall Key!"), GIMESSAGE_NO_GERMAN(GI_GERUDO_FORTRESS_SMALL_KEY, ITEM_KEY_SMALL, "You found a %yThieves Hideout &%wSmall Key!", "Vous obtenez une %rPetite Clé %w&du %yRepaire des Voleurs%w!"),
GIMESSAGE_UNTRANSLATED(GI_FOREST_TEMPLE_SMALL_KEY, ITEM_KEY_SMALL, "You found a %gForest Temple &%wSmall Key!"), GIMESSAGE_NO_GERMAN(GI_FOREST_TEMPLE_SMALL_KEY, ITEM_KEY_SMALL, "You found a %gForest Temple &%wSmall Key!", "Vous obtenez une %rPetite Clé %w&du %gTemple de la Forêt%w!"),
GIMESSAGE_UNTRANSLATED(GI_FIRE_TEMPLE_SMALL_KEY, ITEM_KEY_SMALL, "You found a %rFire Temple &%wSmall Key!"), GIMESSAGE_NO_GERMAN(GI_FIRE_TEMPLE_SMALL_KEY, ITEM_KEY_SMALL, "You found a %rFire Temple &%wSmall Key!", "Vous obtenez une %rPetite Clé %w&du %rTemple du Feu%w!"),
GIMESSAGE_UNTRANSLATED(GI_WATER_TEMPLE_SMALL_KEY, ITEM_KEY_SMALL, "You found a %bWater Temple &%wSmall Key!"), GIMESSAGE_NO_GERMAN(GI_WATER_TEMPLE_SMALL_KEY, ITEM_KEY_SMALL, "You found a %bWater Temple &%wSmall Key!", "Vous obtenez une %rPetite Clé %w&du %bTemple de l'Eau%w!"),
GIMESSAGE_UNTRANSLATED(GI_SPIRIT_TEMPLE_SMALL_KEY, ITEM_KEY_SMALL, "You found a %ySpirit Temple &%wSmall Key!"), GIMESSAGE_NO_GERMAN(GI_SPIRIT_TEMPLE_SMALL_KEY, ITEM_KEY_SMALL, "You found a %ySpirit Temple &%wSmall Key!", "Vous obtenez une %rPetite Clé %w&du %yTemple de l'Esprit%w!"),
GIMESSAGE_UNTRANSLATED(GI_SHADOW_TEMPLE_SMALL_KEY, ITEM_KEY_SMALL, "You found a %pShadow Temple &%wSmall Key!"), GIMESSAGE_NO_GERMAN(GI_SHADOW_TEMPLE_SMALL_KEY, ITEM_KEY_SMALL, "You found a %pShadow Temple &%wSmall Key!", "Vous obtenez une %rPetite Clé %w&du %pTemple de l'Ombre%w!"),
GIMESSAGE_UNTRANSLATED(GI_BOTTOM_OF_THE_WELL_SMALL_KEY, ITEM_KEY_SMALL, "You found a %pBottom of the &Well %wSmall Key!"), GIMESSAGE_NO_GERMAN(GI_BOTTOM_OF_THE_WELL_SMALL_KEY, ITEM_KEY_SMALL, "You found a %pBottom of the &Well %wSmall Key!", "Vous obtenez une %rPetite Clé %w&du %Puits%w!"),
GIMESSAGE_UNTRANSLATED(GI_GERUDO_TRAINING_GROUNDS_SMALL_KEY, ITEM_KEY_SMALL, "You found a %yGerudo Training Grounds &%wSmall Key!"), GIMESSAGE_NO_GERMAN(GI_GERUDO_TRAINING_GROUNDS_SMALL_KEY, ITEM_KEY_SMALL, "You found a %yGerudo Training &Grounds %wSmall Key!", "Vous obtenez une %rPetite Clé %w&du %yGymnase Gerudo%w!"),
GIMESSAGE_UNTRANSLATED(GI_GANONS_CASTLE_SMALL_KEY, ITEM_KEY_SMALL, "You found a %rGanon's Castle &%wSmall Key!"), GIMESSAGE_NO_GERMAN(GI_GANONS_CASTLE_SMALL_KEY, ITEM_KEY_SMALL, "You found a %rGanon's Castle &%wSmall Key!", "Vous obtenez une %rPetite Clé %w&du %Château de Ganon%w!"),
GIMESSAGE_UNTRANSLATED(GI_FOREST_TEMPLE_BOSS_KEY, ITEM_KEY_BOSS, "You found the %gForest Temple &%wBoss Key!"), GIMESSAGE_NO_GERMAN(GI_FOREST_TEMPLE_BOSS_KEY, ITEM_KEY_BOSS, "You found the %gForest Temple &%wBoss Key!", "Vous obtenez la %rClé d'or %wdu&%gTemple de la Forêt%w!"),
GIMESSAGE_UNTRANSLATED(GI_FIRE_TEMPLE_BOSS_KEY, ITEM_KEY_BOSS, "You found the %rFire Temple &%wBoss Key!"), GIMESSAGE_NO_GERMAN(GI_FIRE_TEMPLE_BOSS_KEY, ITEM_KEY_BOSS, "You found the %rFire Temple &%wBoss Key!", "Vous obtenez la %rClé d'or %wdu&%rTemple du Feu%w!"),
GIMESSAGE_UNTRANSLATED(GI_WATER_TEMPLE_BOSS_KEY, ITEM_KEY_BOSS, "You found the %bWater Temple &%wBoss Key!"), GIMESSAGE_NO_GERMAN(GI_WATER_TEMPLE_BOSS_KEY, ITEM_KEY_BOSS, "You found the %bWater Temple &%wBoss Key!", "Vous obtenez la %rClé d'or %wdu&%bTemple de l'Eau%w!"),
GIMESSAGE_UNTRANSLATED(GI_SPIRIT_TEMPLE_BOSS_KEY, ITEM_KEY_BOSS, "You found the %ySpirit Temple &%wBoss Key!"), GIMESSAGE_NO_GERMAN(GI_SPIRIT_TEMPLE_BOSS_KEY, ITEM_KEY_BOSS, "You found the %ySpirit Temple &%wBoss Key!", "Vous obtenez la %rClé d'or %wdu&%yTemple de l'Esprit%w!"),
GIMESSAGE_UNTRANSLATED(GI_SHADOW_TEMPLE_BOSS_KEY, ITEM_KEY_BOSS, "You found the %pShadow Temple &%wBoss Key!"), GIMESSAGE_NO_GERMAN(GI_SHADOW_TEMPLE_BOSS_KEY, ITEM_KEY_BOSS, "You found the %pShadow Temple &%wBoss Key!", "Vous obtenez la %rClé d'or %wdu&%pTemple de l'Ombre%w!"),
GIMESSAGE_UNTRANSLATED(GI_GANONS_CASTLE_BOSS_KEY, ITEM_KEY_BOSS, "You found the %rGanon's Castle &%wBoss Key!"), GIMESSAGE_NO_GERMAN(GI_GANONS_CASTLE_BOSS_KEY, ITEM_KEY_BOSS, "You found the %rGanon's Castle &%wBoss Key!", "Vous obtenez la %rClé d'or %wdu&%rChâteau de Ganon%w!"),
GIMESSAGE_NO_GERMAN(GI_DEKU_TREE_MAP, ITEM_DUNGEON_MAP, "You found the %gDeku Tree &%wMap!", "Vous obtenez la %rCarte %wde&l'%gArbre Mojo%w!"),
GIMESSAGE_NO_GERMAN(GI_DODONGOS_CAVERN_MAP, ITEM_DUNGEON_MAP, "You found the %rDodongo's Cavern &%wMap!", "Vous obtenez la %rCarte %wde la&%rCaverne Dodongo%w!"),
GIMESSAGE_NO_GERMAN(GI_JABU_JABUS_BELLY_MAP, ITEM_DUNGEON_MAP, "You found the %bJabu Jabu's Belly &%wMap!", "Vous obtenez la %rCarte %wdu &%bVentre de Jabu-Jabu%w!"),
GIMESSAGE_NO_GERMAN(GI_FOREST_TEMPLE_MAP, ITEM_DUNGEON_MAP, "You found the %gForest Temple &%wMap!", "Vous obtenez la %rCarte %wdu &%gTemple de la Forêt%w!"),
GIMESSAGE_NO_GERMAN(GI_FIRE_TEMPLE_MAP, ITEM_DUNGEON_MAP, "You found the %rFire Temple &%wMap!", "Vous obtenez la %rCarte %wdu &%rTemple du Feu%w!"),
GIMESSAGE_NO_GERMAN(GI_WATER_TEMPLE_MAP, ITEM_DUNGEON_MAP, "You found the %bWater Temple &%wMap!", "Vous obtenez la %rCarte %wdu &%bTemple de l'Eau%w!"),
GIMESSAGE_NO_GERMAN(GI_SPIRIT_TEMPLE_MAP, ITEM_DUNGEON_MAP, "You found the %ySpirit Temple &%wMap!", "Vous obtenez la %rCarte %wdu &%yTemple de l'Esprit%w!"),
GIMESSAGE_NO_GERMAN(GI_SHADOW_TEMPLE_MAP, ITEM_DUNGEON_MAP, "You found the %pShadow Temple &%wMap!", "Vous obtenez la %rCarte %wdu &%pTemple de l'Ombre%w!"),
GIMESSAGE_NO_GERMAN(GI_BOTTOM_OF_THE_WELL_MAP, ITEM_DUNGEON_MAP, "You found the %pBottom of the &Well %wMap!", "Vous obtenez la %rCarte %wdu &%pPuits%w!"),
GIMESSAGE_NO_GERMAN(GI_ICE_CAVERN_MAP, ITEM_DUNGEON_MAP, "You found the %cIce Cavern &%wMap!", "Vous obtenez la %rCarte %wde &la %cCaverne Polaire%w!"),
GIMESSAGE_UNTRANSLATED(GI_DEKU_TREE_MAP, ITEM_DUNGEON_MAP, "You found the %gDeku Tree &%wMap!"), GIMESSAGE_NO_GERMAN(GI_DEKU_TREE_COMPASS, ITEM_COMPASS, "You found the %gDeku Tree &%wCompass!", "Vous obtenez la %rBoussole %wde&l'%gArbre Mojo%w!"),
GIMESSAGE_UNTRANSLATED(GI_DODONGOS_CAVERN_MAP, ITEM_DUNGEON_MAP, "You found the %rDodongo's Cavern &%wMap!"), GIMESSAGE_NO_GERMAN(GI_DODONGOS_CAVERN_COMPASS, ITEM_COMPASS, "You found the %rDodongo's Cavern &%wCompass!", "Vous obtenez la %rBoussole %wde la&%rCaverne Dodongo%w!"),
GIMESSAGE_UNTRANSLATED(GI_JABU_JABUS_BELLY_MAP, ITEM_DUNGEON_MAP, "You found the %bJabu Jabu's Belly &%wMap!"), GIMESSAGE_NO_GERMAN(GI_JABU_JABUS_BELLY_COMPASS, ITEM_COMPASS, "You found the %bJabu Jabu's Belly &%wCompass!", "Vous obtenez la %rBoussole %wdu &%bVentre de Jabu-Jabu%w!"),
GIMESSAGE_UNTRANSLATED(GI_FOREST_TEMPLE_MAP, ITEM_DUNGEON_MAP, "You found the %gForest Temple &%wMap!"), GIMESSAGE_NO_GERMAN(GI_FOREST_TEMPLE_COMPASS, ITEM_COMPASS, "You found the %gForest Temple &%wCompass!", "Vous obtenez la %rBoussole %wdu &%gTemple de la Forêt%w!"),
GIMESSAGE_UNTRANSLATED(GI_FIRE_TEMPLE_MAP, ITEM_DUNGEON_MAP, "You found the %rFire Temple &%wMap!"), GIMESSAGE_NO_GERMAN(GI_FIRE_TEMPLE_COMPASS, ITEM_COMPASS, "You found the %rFire Temple &%wCompass!", "Vous obtenez la %rBoussole %wdu &%rTemple du Feu%w!"),
GIMESSAGE_UNTRANSLATED(GI_WATER_TEMPLE_MAP, ITEM_DUNGEON_MAP, "You found the %bWater Temple &%wMap!"), GIMESSAGE_NO_GERMAN(GI_WATER_TEMPLE_COMPASS, ITEM_COMPASS, "You found the %bWater Temple &%wCompass!", "Vous obtenez la %rBoussole %wdu &%bTemple de l'Eau%w!"),
GIMESSAGE_UNTRANSLATED(GI_SPIRIT_TEMPLE_MAP, ITEM_DUNGEON_MAP, "You found the %ySpirit Temple &%wMap!"), GIMESSAGE_NO_GERMAN(GI_SPIRIT_TEMPLE_COMPASS, ITEM_COMPASS, "You found the %ySpirit Temple &%wCompass!", "Vous obtenez la %rBoussole %wdu &%yTemple de l'Esprit%w!"),
GIMESSAGE_UNTRANSLATED(GI_SHADOW_TEMPLE_MAP, ITEM_DUNGEON_MAP, "You found the %pShadow Temple &%wMap!"), GIMESSAGE_NO_GERMAN(GI_SHADOW_TEMPLE_COMPASS, ITEM_COMPASS, "You found the %pShadow Temple &%wCompass!", "Vous obtenez la %rBoussole %wdu &%pTemple de l'Ombre%w!"),
GIMESSAGE_UNTRANSLATED(GI_BOTTOM_OF_THE_WELL_MAP, ITEM_DUNGEON_MAP, "You found the %pBottom of the &Well %wMap!"), GIMESSAGE_NO_GERMAN(GI_BOTTOM_OF_THE_WELL_COMPASS, ITEM_COMPASS, "You found the %pBottom of the &Well %wCompass!", "Vous obtenez la %rBoussole %wdu &%pPuits%w!"),
GIMESSAGE_UNTRANSLATED(GI_ICE_CAVERN_MAP, ITEM_DUNGEON_MAP, "You found the %cIce Cavern &%wMap!"), GIMESSAGE_NO_GERMAN(GI_ICE_CAVERN_COMPASS, ITEM_COMPASS, "You found the %cIce Cavern &%wCompass!", "Vous obtenez la %rBoussole %wde &la %cCaverne Polaire%w!"),
GIMESSAGE_UNTRANSLATED(GI_DEKU_TREE_COMPASS, ITEM_COMPASS, "You found the %gDeku Tree &%wCompass!"),
GIMESSAGE_UNTRANSLATED(GI_DODONGOS_CAVERN_COMPASS, ITEM_COMPASS, "You found the %rDodongo's Cavern &%wCompass!"),
GIMESSAGE_UNTRANSLATED(GI_JABU_JABUS_BELLY_COMPASS, ITEM_COMPASS, "You found the %bJabu Jabu's Belly &%wCompass!"),
GIMESSAGE_UNTRANSLATED(GI_FOREST_TEMPLE_COMPASS, ITEM_COMPASS, "You found the %gForest Temple &%wCompass!"),
GIMESSAGE_UNTRANSLATED(GI_FIRE_TEMPLE_COMPASS, ITEM_COMPASS, "You found the %rFire Temple &%wCompass!"),
GIMESSAGE_UNTRANSLATED(GI_WATER_TEMPLE_COMPASS, ITEM_COMPASS, "You found the %bWater Temple &%wCompass!"),
GIMESSAGE_UNTRANSLATED(GI_SPIRIT_TEMPLE_COMPASS, ITEM_COMPASS, "You found the %ySpirit Temple &%wCompass!"),
GIMESSAGE_UNTRANSLATED(GI_SHADOW_TEMPLE_COMPASS, ITEM_COMPASS, "You found the %pShadow Temple &%wCompass!"),
GIMESSAGE_UNTRANSLATED(GI_BOTTOM_OF_THE_WELL_COMPASS, ITEM_COMPASS, "You found the %pBottom of the &Well %wCompass!"),
GIMESSAGE_UNTRANSLATED(GI_ICE_CAVERN_COMPASS, ITEM_COMPASS, "You found the %cIce Cavern &%wCompass!"),
}; };
CreateGetItemMessages(getItemMessages); CreateGetItemMessages(getItemMessages);
CreateScrubMessages(); CreateScrubMessages();

View File

@ -1006,6 +1006,7 @@ typedef enum {
RSK_SKIP_EPONA_RACE, RSK_SKIP_EPONA_RACE,
RSK_SKIP_TOWER_ESCAPE, RSK_SKIP_TOWER_ESCAPE,
RSK_COMPLETE_MASK_QUEST, RSK_COMPLETE_MASK_QUEST,
RSK_ENABLE_GLITCH_CUTSCENES,
RSK_SKULLS_SUNS_SONG, RSK_SKULLS_SUNS_SONG,
RSK_SHUFFLE_ADULT_TRADE RSK_SHUFFLE_ADULT_TRADE
} RandomizerSettingKey; } RandomizerSettingKey;

View File

@ -239,12 +239,17 @@ std::unordered_map<uint32_t, ItemTrackerMapEntry> equipTrackerMap = {
ITEM_TRACKER_MAP_ENTRY(ITEM_BOOTS_HOVER, 14), ITEM_TRACKER_MAP_ENTRY(ITEM_BOOTS_HOVER, 14),
}; };
bool IsValidSaveFile() {
bool validSave = gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2;
return validSave;
}
void DrawEquip(uint32_t itemId) { void DrawEquip(uint32_t itemId) {
const ItemTrackerMapEntry& entry = equipTrackerMap[itemId]; const ItemTrackerMapEntry& entry = equipTrackerMap[itemId];
bool hasEquip = (entry.bitMask & gSaveContext.inventory.equipment) != 0; bool hasEquip = (entry.bitMask & gSaveContext.inventory.equipment) != 0;
int iconSize = CVar_GetS32("gRandoTrackIconSize", 0); int iconSize = CVar_GetS32("gRandoTrackIconSize", 0);
ImGui::Image(SohImGui::GetTextureByName(hasEquip ? entry.name : entry.nameFaded), ImVec2(iconSize, iconSize), ImGui::Image(SohImGui::GetTextureByName(hasEquip && IsValidSaveFile() ? entry.name : entry.nameFaded),
ImVec2(0, 0), ImVec2(1, 1)); ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
SetLastItemHoverText(SohUtils::GetItemName(entry.id)); SetLastItemHoverText(SohUtils::GetItemName(entry.id));
} }
@ -264,8 +269,8 @@ void DrawQuest(uint32_t itemId) {
bool hasQuestItem = (entry.bitMask & gSaveContext.inventory.questItems) != 0; bool hasQuestItem = (entry.bitMask & gSaveContext.inventory.questItems) != 0;
int iconSize = CVar_GetS32("gRandoTrackIconSize", 0); int iconSize = CVar_GetS32("gRandoTrackIconSize", 0);
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Image(SohImGui::GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), ImVec2(iconSize, iconSize), ImGui::Image(SohImGui::GetTextureByName(hasQuestItem && IsValidSaveFile() ? entry.name : entry.nameFaded),
ImVec2(0, 0), ImVec2(1, 1)); ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
ImVec2 p = ImGui::GetCursorScreenPos(); ImVec2 p = ImGui::GetCursorScreenPos();
int estimatedTextWidth = 10; int estimatedTextWidth = 10;
@ -447,18 +452,29 @@ void DrawItem(uint32_t itemId) {
} }
} }
const ItemTrackerMapEntry& entry = itemTrackerMap[hasItem ? actualItemId : itemId]; const ItemTrackerMapEntry& entry = itemTrackerMap[hasItem && IsValidSaveFile() ? actualItemId : itemId];
int iconSize = CVar_GetS32("gRandoTrackIconSize", 0); int iconSize = CVar_GetS32("gRandoTrackIconSize", 0);
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Image(SohImGui::GetTextureByName(hasItem ? entry.name : entry.nameFaded), ImVec2(iconSize, iconSize), ImGui::Image(SohImGui::GetTextureByName(hasItem && IsValidSaveFile() ? entry.name : entry.nameFaded),
ImVec2(0, 0), ImVec2(1, 1)); ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
ImVec2 p = ImGui::GetCursorScreenPos(); ImVec2 p = ImGui::GetCursorScreenPos();
int estimatedTextWidth = 10; int estimatedTextWidth = 10;
int estimatedTextHeight = 10; int estimatedTextHeight = 10;
ImGui::SetCursorScreenPos(ImVec2(p.x - 5 + (iconSize / 2) - estimatedTextWidth, p.y - estimatedTextHeight)); ImGui::SetCursorScreenPos(ImVec2(p.x - 5 + (iconSize / 2) - estimatedTextWidth, p.y - estimatedTextHeight));
switch (actualItemId) { if (IsValidSaveFile()) {
DrawItemAmmo(actualItemId);
} else {
ImGui::Text(" ");
}
ImGui::EndGroup();
SetLastItemHoverText(SohUtils::GetItemName(entry.id));
}
void DrawItemAmmo(int itemId) {
switch (itemId) {
case ITEM_STICK: case ITEM_STICK:
if (CVar_GetS32("gItemTrackerAmmoDisplay", 0) == 1) { if (CVar_GetS32("gItemTrackerAmmoDisplay", 0) == 1) {
if (AMMO(ITEM_STICK) == CUR_CAPACITY(UPG_STICKS)) { if (AMMO(ITEM_STICK) == CUR_CAPACITY(UPG_STICKS)) {
@ -667,18 +683,15 @@ void DrawItem(uint32_t itemId) {
ImGui::Text(" "); ImGui::Text(" ");
break; break;
} }
ImGui::EndGroup();
SetLastItemHoverText(SohUtils::GetItemName(entry.id));
} }
void DrawBottle(uint32_t itemId, uint32_t bottleSlot) { void DrawBottle(uint32_t itemId, uint32_t bottleSlot) {
uint32_t actualItemId = gSaveContext.inventory.items[SLOT(itemId) + bottleSlot]; uint32_t actualItemId = gSaveContext.inventory.items[SLOT(itemId) + bottleSlot];
bool hasItem = actualItemId != ITEM_NONE; bool hasItem = actualItemId != ITEM_NONE;
const ItemTrackerMapEntry& entry = itemTrackerMap[hasItem ? actualItemId : itemId]; const ItemTrackerMapEntry& entry = itemTrackerMap[hasItem && IsValidSaveFile() ? actualItemId : itemId];
int iconSize = CVar_GetS32("gRandoTrackIconSize", 0); int iconSize = CVar_GetS32("gRandoTrackIconSize", 0);
ImGui::Image(SohImGui::GetTextureByName(hasItem ? entry.name : entry.nameFaded), ImVec2(iconSize, iconSize), ImGui::Image(SohImGui::GetTextureByName(hasItem && IsValidSaveFile() ? entry.name : entry.nameFaded),
ImVec2(0, 0), ImVec2(1, 1)); ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
SetLastItemHoverText(SohUtils::GetItemName(entry.id)); SetLastItemHoverText(SohUtils::GetItemName(entry.id));
}; };
@ -688,19 +701,26 @@ void DrawDungeonItem(uint32_t itemId, uint32_t scene) {
uint32_t bitMask = 1 << (entry.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential uint32_t bitMask = 1 << (entry.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential
int iconSize = CVar_GetS32("gRandoTrackIconSize", 0); int iconSize = CVar_GetS32("gRandoTrackIconSize", 0);
bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[scene]) != 0; bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[scene]) != 0;
bool hasSmallKey = (gSaveContext.inventory.dungeonKeys[scene]) >= 0;
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Image(SohImGui::GetTextureByName(hasItem ? entry.name : entry.nameFaded), ImVec2(iconSize, iconSize), if (itemId == ITEM_KEY_SMALL) {
ImVec2(0, 0), ImVec2(1, 1)); ImGui::Image(SohImGui::GetTextureByName(hasSmallKey && IsValidSaveFile() ? entry.name : entry.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
}
else {
ImGui::Image(SohImGui::GetTextureByName(hasItem && IsValidSaveFile() ? entry.name : entry.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
}
ImVec2 p = ImGui::GetCursorScreenPos(); ImVec2 p = ImGui::GetCursorScreenPos();
int estimatedTextWidth = 10; int estimatedTextWidth = 10;
int estimatedTextHeight = 10; int estimatedTextHeight = 10;
ImGui::SetCursorScreenPos(ImVec2(p.x - 5 + (iconSize / 2) - estimatedTextWidth, p.y - estimatedTextHeight)); ImGui::SetCursorScreenPos(ImVec2(p.x - 5 + (iconSize / 2) - estimatedTextWidth, p.y - estimatedTextHeight));
if (itemId == ITEM_KEY_SMALL) { if (itemId == ITEM_KEY_SMALL) { // This check there for small key is necessary to get the text position properly and can't be on the same ITEM_KEY chack from the top
if (gSaveContext.inventory.dungeonKeys[scene] == 0) { if (gSaveContext.inventory.dungeonKeys[scene] <= 0 || !IsValidSaveFile()) {
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(155, 155, 155, 255)); ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(155, 155, 155, 255));
ImGui::Text("%i", gSaveContext.inventory.dungeonKeys[scene]); ImGui::Text("0");
ImGui::PopStyleColor(); ImGui::PopStyleColor();
} }
else { else {
@ -756,7 +776,7 @@ std::unordered_map<int32_t, std::vector<ItemTrackerUpgradeEntry>> upgradeTracker
void DrawUpgrade(int32_t categoryId) { void DrawUpgrade(int32_t categoryId) {
int iconSize = CVar_GetS32("gRandoTrackIconSize", 0); int iconSize = CVar_GetS32("gRandoTrackIconSize", 0);
if (CUR_UPG_VALUE(categoryId) == 0) { if (CUR_UPG_VALUE(categoryId) == 0 || !IsValidSaveFile()) {
const ItemTrackerUpgradeEntry& entry = upgradeTrackerMap[categoryId][0]; const ItemTrackerUpgradeEntry& entry = upgradeTrackerMap[categoryId][0];
ImGui::Image(SohImGui::GetTextureByName(entry.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0), ImGui::Image(SohImGui::GetTextureByName(entry.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0),
ImVec2(1, 1)); ImVec2(1, 1));
@ -815,8 +835,8 @@ void DrawSong(int32_t songId) {
CVar_GetS32("gItemTrackeSongColor", 0) ? songTrackerMap[songId] : vanillaSongTrackerMap[songId]; CVar_GetS32("gItemTrackeSongColor", 0) ? songTrackerMap[songId] : vanillaSongTrackerMap[songId];
uint32_t bitMask = 1 << entry.id; uint32_t bitMask = 1 << entry.id;
bool hasSong = (bitMask & gSaveContext.inventory.questItems) != 0; bool hasSong = (bitMask & gSaveContext.inventory.questItems) != 0;
ImGui::Image(SohImGui::GetTextureByName(hasSong ? entry.name : entry.nameFaded), ImVec2(iconSize / 1.5, iconSize), ImGui::Image(SohImGui::GetTextureByName(hasSong && IsValidSaveFile() ? entry.name : entry.nameFaded),
ImVec2(0, 0), ImVec2(1, 1)); ImVec2(iconSize / 1.5, iconSize), ImVec2(0, 0), ImVec2(1, 1));
SetLastItemHoverText(SohUtils::GetQuestItemName(entry.id)); SetLastItemHoverText(SohUtils::GetQuestItemName(entry.id));
} }
@ -1273,7 +1293,7 @@ void DrawFloatingDungeons(int Icon_Cells_Size, int Icon_Spacing) {
DrawDungeonItem(ITEM_KEY_SMALL, SCENE_HAKADAN); DrawDungeonItem(ITEM_KEY_SMALL, SCENE_HAKADAN);
ImGui::SameLine(Icon_Cells_Size * 5); ImGui::SameLine(Icon_Cells_Size * 5);
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + Icon_Spacing * 5); ImGui::SetCursorPosX(ImGui::GetCursorPosX() + Icon_Spacing * 5);
DrawDungeonItem(ITEM_KEY_SMALL, SCENE_GANON); DrawDungeonItem(ITEM_KEY_SMALL, SCENE_GANONTIKA);
ImGui::EndGroup(); ImGui::EndGroup();
// BOSS KEYS FOR FOREST TO GANON // BOSS KEYS FOR FOREST TO GANON
ImGui::BeginGroup(); ImGui::BeginGroup();
@ -1340,7 +1360,7 @@ void DrawFloatingDungeons(int Icon_Cells_Size, int Icon_Spacing) {
DrawDungeonItem(ITEM_KEY_SMALL, SCENE_MEN); DrawDungeonItem(ITEM_KEY_SMALL, SCENE_MEN);
ImGui::SameLine(Icon_Cells_Size * 5); ImGui::SameLine(Icon_Cells_Size * 5);
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + Icon_Spacing * 5); ImGui::SetCursorPosX(ImGui::GetCursorPosX() + Icon_Spacing * 5);
DrawDungeonItem(ITEM_KEY_SMALL, SCENE_GANON); DrawDungeonItem(ITEM_KEY_SMALL, SCENE_GANONTIKA);
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::BeginGroup(); ImGui::BeginGroup();
DrawDungeonItem(ITEM_COMPASS, SCENE_JYASINZOU); DrawDungeonItem(ITEM_COMPASS, SCENE_JYASINZOU);
@ -1355,7 +1375,7 @@ void DrawFloatingDungeons(int Icon_Cells_Size, int Icon_Spacing) {
DrawDungeonItem(ITEM_COMPASS, SCENE_ICE_DOUKUTO); DrawDungeonItem(ITEM_COMPASS, SCENE_ICE_DOUKUTO);
ImGui::SameLine(Icon_Cells_Size * 5); ImGui::SameLine(Icon_Cells_Size * 5);
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + Icon_Spacing * 5); ImGui::SetCursorPosX(ImGui::GetCursorPosX() + Icon_Spacing * 5);
DrawDungeonItem(ITEM_KEY_BOSS, SCENE_GANONTIKA); DrawDungeonItem(ITEM_KEY_BOSS, SCENE_GANON);
ImGui::EndGroup(); ImGui::EndGroup();
} }
ImGui::BeginGroup(); ImGui::BeginGroup();
@ -1463,12 +1483,12 @@ void DrawItemTracker(bool& open) {
DrawFloatingDungeons(Icon_Cells_Size, Icon_Spacing); DrawFloatingDungeons(Icon_Cells_Size, Icon_Spacing);
EndFloatingWindows(); EndFloatingWindows();
} }
/*
if (CVar_GetS32("gItemTrackerNotes", 0)) { if (CVar_GetS32("gItemTrackerNotes", 0)) {
BeginFloatingWindows("ItemTracker_Theme_0_Notes"); BeginFloatingWindows("ItemTracker_Theme_0_Notes");
DrawFloatingNotes(Icon_Cells_Size, Icon_Spacing); DrawFloatingNotes(Icon_Cells_Size, Icon_Spacing);
EndFloatingWindows(); EndFloatingWindows();
} }*/
} else if (CVar_GetS32("gItemTrackerTheme", 0) == 1) { // Per groups elements N.1 } else if (CVar_GetS32("gItemTrackerTheme", 0) == 1) { // Per groups elements N.1
BeginFloatingWindows("ItemTracker_Theme_1_Inventory"); BeginFloatingWindows("ItemTracker_Theme_1_Inventory");
DrawFloatingInventory(Icon_Cells_Size, Icon_Spacing); DrawFloatingInventory(Icon_Cells_Size, Icon_Spacing);
@ -1491,12 +1511,12 @@ void DrawItemTracker(bool& open) {
DrawFloatingDungeons(Icon_Cells_Size, Icon_Spacing); DrawFloatingDungeons(Icon_Cells_Size, Icon_Spacing);
EndFloatingWindows(); EndFloatingWindows();
} }
/*
if (CVar_GetS32("gItemTrackerNotes", 0)) { if (CVar_GetS32("gItemTrackerNotes", 0)) {
BeginFloatingWindows("ItemTracker_Theme_1_Notes"); BeginFloatingWindows("ItemTracker_Theme_1_Notes");
DrawFloatingNotes(Icon_Cells_Size, Icon_Spacing); DrawFloatingNotes(Icon_Cells_Size, Icon_Spacing);
EndFloatingWindows(); EndFloatingWindows();
} }*/
} else if (CVar_GetS32("gItemTrackerTheme", 0) == 2) { // Per groups elements N.2 } else if (CVar_GetS32("gItemTrackerTheme", 0) == 2) { // Per groups elements N.2
BeginFloatingWindows("ItemTracker_Theme_2_Inventory"); BeginFloatingWindows("ItemTracker_Theme_2_Inventory");
DrawFloatingInventory(Icon_Cells_Size, Icon_Spacing); DrawFloatingInventory(Icon_Cells_Size, Icon_Spacing);
@ -1531,12 +1551,12 @@ void DrawItemTracker(bool& open) {
DrawFloatingDungeons(Icon_Cells_Size, Icon_Spacing); DrawFloatingDungeons(Icon_Cells_Size, Icon_Spacing);
EndFloatingWindows(); EndFloatingWindows();
} }
/*
if (CVar_GetS32("gItemTrackerNotes", 0)) { if (CVar_GetS32("gItemTrackerNotes", 0)) {
BeginFloatingWindows("ItemTracker_Theme_2_Notes"); BeginFloatingWindows("ItemTracker_Theme_2_Notes");
DrawFloatingNotes(Icon_Cells_Size, Icon_Spacing); DrawFloatingNotes(Icon_Cells_Size, Icon_Spacing);
EndFloatingWindows(); EndFloatingWindows();
} }*/
} }
} }
} }
@ -1570,6 +1590,10 @@ void DrawItemTrackerOptions(bool& open) {
ImGui::Text("Chroma Key"); ImGui::Text("Chroma Key");
auto flags = ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaBar | ImGuiColorEditFlags_NoLabel; auto flags = ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaBar | ImGuiColorEditFlags_NoLabel;
ImGui::ColorEdit4("Chroma Key Selection", (float*)&ChromaKeyBackground, flags); ImGui::ColorEdit4("Chroma Key Selection", (float*)&ChromaKeyBackground, flags);
CVar_SetFloat("gItemTrackerBgColorR", ChromaKeyBackground.x);
CVar_SetFloat("gItemTrackerBgColorG", ChromaKeyBackground.y);
CVar_SetFloat("gItemTrackerBgColorB", ChromaKeyBackground.z);
CVar_SetFloat("gItemTrackerBgColorA", ChromaKeyBackground.w);
const char* ItemsTrackerTheme[3] = { "One Block", "Grouped style n.1", "Grouped style n.2" }; const char* ItemsTrackerTheme[3] = { "One Block", "Grouped style n.1", "Grouped style n.2" };
ImGui::Text("Using theme :"); ImGui::Text("Using theme :");
@ -1590,8 +1614,8 @@ void DrawItemTrackerOptions(bool& open) {
ImGui::SetWindowPos("ItemTracker_Theme_0_Grouped", Default_Pos_Wnd_0); ImGui::SetWindowPos("ItemTracker_Theme_0_Grouped", Default_Pos_Wnd_0);
ImVec2 Default_Pos_Wnd_1 = { OriginPosition.x, OriginPosition.y + 175}; ImVec2 Default_Pos_Wnd_1 = { OriginPosition.x, OriginPosition.y + 175};
ImGui::SetWindowPos("ItemTracker_Theme_0_Dungeons", Default_Pos_Wnd_1); ImGui::SetWindowPos("ItemTracker_Theme_0_Dungeons", Default_Pos_Wnd_1);
ImVec2 Default_Pos_Wnd_2 = { OriginPosition.x + 100, OriginPosition.y}; //ImVec2 Default_Pos_Wnd_2 = { OriginPosition.x + 100, OriginPosition.y};
ImGui::SetWindowPos("ItemTracker_Theme_0_Notes", Default_Pos_Wnd_2); //ImGui::SetWindowPos("ItemTracker_Theme_0_Notes", Default_Pos_Wnd_2);
} else if (CVar_GetS32("gItemTrackerTheme", 0) == 1) { // Per groups elements N.1 } else if (CVar_GetS32("gItemTrackerTheme", 0) == 1) { // Per groups elements N.1
ImVec2 Default_Pos_Wnd_0 = { OriginPosition.x, OriginPosition.y }; ImVec2 Default_Pos_Wnd_0 = { OriginPosition.x, OriginPosition.y };
ImGui::SetWindowPos("ItemTracker_Theme_1_Inventory", Default_Pos_Wnd_0); ImGui::SetWindowPos("ItemTracker_Theme_1_Inventory", Default_Pos_Wnd_0);
@ -1603,8 +1627,8 @@ void DrawItemTrackerOptions(bool& open) {
ImGui::SetWindowPos("ItemTracker_Theme_1_Songs", Default_Pos_Wnd_3); ImGui::SetWindowPos("ItemTracker_Theme_1_Songs", Default_Pos_Wnd_3);
ImVec2 Default_Pos_Wnd_4 = { OriginPosition.x + 100, OriginPosition.y + 175}; ImVec2 Default_Pos_Wnd_4 = { OriginPosition.x + 100, OriginPosition.y + 175};
ImGui::SetWindowPos("ItemTracker_Theme_1_Dungeons", Default_Pos_Wnd_4); ImGui::SetWindowPos("ItemTracker_Theme_1_Dungeons", Default_Pos_Wnd_4);
ImVec2 Default_Pos_Wnd_5 = { OriginPosition.x - 100, OriginPosition.y}; //ImVec2 Default_Pos_Wnd_5 = { OriginPosition.x - 100, OriginPosition.y};
ImGui::SetWindowPos("ItemTracker_Theme_1_Notes", Default_Pos_Wnd_5); //ImGui::SetWindowPos("ItemTracker_Theme_1_Notes", Default_Pos_Wnd_5);
} else if (CVar_GetS32("gItemTrackerTheme", 0) == 2) { // Per groups elements N.2 } else if (CVar_GetS32("gItemTrackerTheme", 0) == 2) { // Per groups elements N.2
ImVec2 Default_Pos_Wnd_0 = { OriginPosition.x, OriginPosition.y }; ImVec2 Default_Pos_Wnd_0 = { OriginPosition.x, OriginPosition.y };
ImGui::SetWindowPos("ItemTracker_Theme_2_Inventory", Default_Pos_Wnd_0); ImGui::SetWindowPos("ItemTracker_Theme_2_Inventory", Default_Pos_Wnd_0);
@ -1622,8 +1646,8 @@ void DrawItemTrackerOptions(bool& open) {
ImGui::SetWindowPos("ItemTracker_Theme_2_Song", Default_Pos_Wnd_6); ImGui::SetWindowPos("ItemTracker_Theme_2_Song", Default_Pos_Wnd_6);
ImVec2 Default_Pos_Wnd_7 = { OriginPosition.x - 100, OriginPosition.y}; ImVec2 Default_Pos_Wnd_7 = { OriginPosition.x - 100, OriginPosition.y};
ImGui::SetWindowPos("ItemTracker_Theme_2_Dungeons", Default_Pos_Wnd_7); ImGui::SetWindowPos("ItemTracker_Theme_2_Dungeons", Default_Pos_Wnd_7);
ImVec2 Default_Pos_Wnd_8 = { OriginPosition.x - 100, OriginPosition.y + 170}; //ImVec2 Default_Pos_Wnd_8 = { OriginPosition.x - 100, OriginPosition.y + 170};
ImGui::SetWindowPos("ItemTracker_Theme_2_Notes", Default_Pos_Wnd_8); //ImGui::SetWindowPos("ItemTracker_Theme_2_Notes", Default_Pos_Wnd_8);
} }
} }
SohImGui::EnhancementCheckbox("Alternative medallions display", "gItemTrackerMedallionsPlacement"); SohImGui::EnhancementCheckbox("Alternative medallions display", "gItemTrackerMedallionsPlacement");
@ -1646,4 +1670,14 @@ void InitItemTracker() {
CVar_RegisterS32("gRandoTrackIconSize", 32); CVar_RegisterS32("gRandoTrackIconSize", 32);
SohImGui::AddWindow("Randomizer", "Item Tracker", DrawItemTracker); SohImGui::AddWindow("Randomizer", "Item Tracker", DrawItemTracker);
SohImGui::AddWindow("Randomizer", "Item Tracker Settings", DrawItemTrackerOptions); SohImGui::AddWindow("Randomizer", "Item Tracker Settings", DrawItemTrackerOptions);
float trackerBgR = CVar_GetFloat("gItemTrackerBgColorR", 0);
float trackerBgG = CVar_GetFloat("gItemTrackerBgColorG", 0);
float trackerBgB = CVar_GetFloat("gItemTrackerBgColorB", 0);
float trackerBgA = CVar_GetFloat("gItemTrackerBgColorA", 1);
ChromaKeyBackground = {
trackerBgR,
trackerBgG,
trackerBgB,
trackerBgA
}; // Float value, 1 = 255 in rgb value.
} }

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
void InitItemTracker(); void InitItemTracker();
void DrawItemTracker(bool& open); void DrawItemTracker(bool& open);
void DrawItemAmmo(int itemId);

View File

@ -4,7 +4,6 @@
#include "objects/gameplay_keep/gameplay_keep.h" #include "objects/gameplay_keep/gameplay_keep.h"
#include "objects/gameplay_field_keep/gameplay_field_keep.h" #include "objects/gameplay_field_keep/gameplay_field_keep.h"
#include "soh/frame_interpolation.h" #include "soh/frame_interpolation.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h"
typedef enum { typedef enum {
/* 0 */ LENS_FLARE_CIRCLE0, /* 0 */ LENS_FLARE_CIRCLE0,
@ -2049,21 +2048,6 @@ void Environment_PlaySceneSequence(GlobalContext* globalCtx) {
Audio_SetEnvReverb(globalCtx->roomCtx.curRoom.echo); Audio_SetEnvReverb(globalCtx->roomCtx.curRoom.echo);
} }
bool HatchPocketEgg(GlobalContext* globalCtx) {
if (!gSaveContext.n64ddFlag) {
return Inventory_ReplaceItem(globalCtx, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO);
}
if (!(gSaveContext.adultTradeItems & ADULT_TRADE_FLAG(ITEM_POCKET_EGG))) {
return 0;
}
gSaveContext.adultTradeItems &= ~ADULT_TRADE_FLAG(ITEM_POCKET_EGG);
gSaveContext.adultTradeItems |= ADULT_TRADE_FLAG(ITEM_POCKET_CUCCO);
Inventory_ReplaceItem(globalCtx, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO);
return 1;
}
// updates bgm/sfx and other things as the day progresses // updates bgm/sfx and other things as the day progresses
void func_80075B44(GlobalContext* globalCtx) { void func_80075B44(GlobalContext* globalCtx) {
switch (globalCtx->envCtx.unk_E0) { switch (globalCtx->envCtx.unk_E0) {
@ -2117,7 +2101,7 @@ void func_80075B44(GlobalContext* globalCtx) {
gSaveContext.dogIsLost = true; gSaveContext.dogIsLost = true;
func_80078884(NA_SE_EV_CHICKEN_CRY_M); func_80078884(NA_SE_EV_CHICKEN_CRY_M);
if ((Inventory_ReplaceItem(globalCtx, ITEM_WEIRD_EGG, ITEM_CHICKEN) || if ((Inventory_ReplaceItem(globalCtx, ITEM_WEIRD_EGG, ITEM_CHICKEN) ||
HatchPocketEgg(globalCtx)) && Inventory_HatchPocketCucco(globalCtx)) &&
globalCtx->csCtx.state == 0 && !Player_InCsMode(globalCtx)) { globalCtx->csCtx.state == 0 && !Player_InCsMode(globalCtx)) {
Message_StartTextbox(globalCtx, 0x3066, NULL); Message_StartTextbox(globalCtx, 0x3066, NULL);
} }

View File

@ -2573,6 +2573,21 @@ s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) {
return 0; return 0;
} }
bool Inventory_HatchPocketCucco(GlobalContext* globalCtx) {
if (!gSaveContext.n64ddFlag) {
return Inventory_ReplaceItem(globalCtx, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO);
}
if (!PLAYER_HAS_SHUFFLED_ADULT_TRADE_ITEM(ITEM_POCKET_EGG)) {
return 0;
}
gSaveContext.adultTradeItems &= ~ADULT_TRADE_FLAG(ITEM_POCKET_EGG);
gSaveContext.adultTradeItems |= ADULT_TRADE_FLAG(ITEM_POCKET_CUCCO);
Inventory_ReplaceItem(globalCtx, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO);
return 1;
}
void func_80086D5C(s32* buf, u16 size) { void func_80086D5C(s32* buf, u16 size) {
u16 i; u16 i;

View File

@ -398,7 +398,7 @@ void Gameplay_Init(GameState* thisx) {
gSaveContext.bgsDayCount++; gSaveContext.bgsDayCount++;
gSaveContext.dogIsLost = true; gSaveContext.dogIsLost = true;
if (Inventory_ReplaceItem(globalCtx, ITEM_WEIRD_EGG, ITEM_CHICKEN) || if (Inventory_ReplaceItem(globalCtx, ITEM_WEIRD_EGG, ITEM_CHICKEN) ||
Inventory_ReplaceItem(globalCtx, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO)) { Inventory_HatchPocketCucco(globalCtx)) {
Message_StartTextbox(globalCtx, 0x3066, NULL); Message_StartTextbox(globalCtx, 0x3066, NULL);
} }
gSaveContext.nextDayTime = 0xFFFE; gSaveContext.nextDayTime = 0xFFFE;

View File

@ -23,6 +23,8 @@
#include "overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h" #include "overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h"
#define ENTRANCE(scene, spawn, continueBgm, displayTitleCard, fadeIn, fadeOut) \ #define ENTRANCE(scene, spawn, continueBgm, displayTitleCard, fadeIn, fadeOut) \
{ \ { \
scene, spawn, \ scene, spawn, \
@ -2136,7 +2138,11 @@ void func_8009EE44(GlobalContext* globalCtx) {
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128);
if ((globalCtx->roomCtx.unk_74[0] == 0) && (INV_CONTENT(ITEM_COJIRO) == ITEM_COJIRO)) { bool playerHasCojiro = INV_CONTENT(ITEM_COJIRO) == ITEM_COJIRO;
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE)) {
playerHasCojiro = PLAYER_HAS_SHUFFLED_ADULT_TRADE_ITEM(ITEM_COJIRO);
}
if ((globalCtx->roomCtx.unk_74[0] == 0) && playerHasCojiro) {
if (globalCtx->roomCtx.unk_74[1] == 50) { if (globalCtx->roomCtx.unk_74[1] == 50) {
func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_EV_CHICKEN_CRY_M); func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_EV_CHICKEN_CRY_M);
globalCtx->roomCtx.unk_74[0] = 1; globalCtx->roomCtx.unk_74[0] = 1;

View File

@ -722,8 +722,9 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
gSaveContext.eventChkInf[4] |= 0x20; // master sword pulled gSaveContext.eventChkInf[4] |= 0x20; // master sword pulled
gSaveContext.eventChkInf[4] |= 0x8000; // entered master sword chamber gSaveContext.eventChkInf[4] |= 0x8000; // entered master sword chamber
gSaveContext.infTable[0] |= 1; gSaveContext.infTable[0] |= 1;
// RANDTODO: Don't skip this scene if Don't Skip Glitch Useful Cutscenes is enabled. if (!Randomizer_GetSettingValue(RSK_ENABLE_GLITCH_CUTSCENES)) {
gSaveContext.infTable[17] |= 0x400; // Darunia in Fire Temple gSaveContext.infTable[17] |= 0x400; // Darunia in Fire Temple
}
gSaveContext.cutsceneIndex = 0; gSaveContext.cutsceneIndex = 0;
Flags_SetEventChkInf(5); Flags_SetEventChkInf(5);

View File

@ -79,14 +79,25 @@ void EnHs_Init(Actor* thisx, GlobalContext* globalCtx) {
// "chicken shop (adult era)" // "chicken shop (adult era)"
osSyncPrintf(VT_FGCOL(CYAN) " ヒヨコの店(大人の時) \n" VT_RST); osSyncPrintf(VT_FGCOL(CYAN) " ヒヨコの店(大人の時) \n" VT_RST);
func_80A6E3A0(this, func_80A6E9AC); func_80A6E3A0(this, func_80A6E9AC);
bool shouldDespawn; bool shouldSpawn;
bool tradedMushroom = gSaveContext.itemGetInf[3] & 1; bool tradedMushroom = gSaveContext.itemGetInf[3] & 1;
if (gSaveContext.n64ddFlag) { if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE)) {
shouldDespawn = tradedMushroom && !(gSaveContext.adultTradeItems & ADULT_TRADE_FLAG(ITEM_COJIRO)); // To explain the logic because Fado and Grog are linked:
// - If you have Cojiro, then spawn Grog and not Fado.
// - If you don't have Cojiro but do have Odd Potion, spawn Fado and not Grog.
// - If you don't have either, spawn Grog if you haven't traded the Odd Mushroom.
// - If you don't have either but have traded the mushroom, don't spawn either.
if (PLAYER_HAS_SHUFFLED_ADULT_TRADE_ITEM(ITEM_COJIRO)) {
shouldSpawn = true;
} else if (PLAYER_HAS_SHUFFLED_ADULT_TRADE_ITEM(ITEM_ODD_POTION)) {
shouldSpawn = false;
} else {
shouldSpawn = !tradedMushroom;
}
} else { } else {
shouldDespawn = tradedMushroom; shouldSpawn = !tradedMushroom;
} }
if (shouldDespawn) { if (!shouldSpawn) {
// "chicken shop closed" // "chicken shop closed"
osSyncPrintf(VT_FGCOL(CYAN) " ヒヨコ屋閉店 \n" VT_RST); osSyncPrintf(VT_FGCOL(CYAN) " ヒヨコ屋閉店 \n" VT_RST);
Actor_Kill(&this->actor); Actor_Kill(&this->actor);

View File

@ -1026,7 +1026,20 @@ s32 EnKo_CanSpawn(EnKo* this, GlobalContext* globalCtx) {
} }
case SCENE_SPOT10: case SCENE_SPOT10:
return (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_ODD_POTION) ? true : false; if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE)) {
// To explain the logic because Fado and Grog are linked:
// - If you have Cojiro, then spawn Grog and not Fado.
// - If you don't have Cojiro but do have Odd Potion, spawn Fado and not Grog.
// - If you don't have either, spawn Grog if you haven't traded the Odd Mushroom.
// - If you don't have either but have traded the mushroom, don't spawn either.
if (PLAYER_HAS_SHUFFLED_ADULT_TRADE_ITEM(ITEM_COJIRO)) {
return false;
} else {
return PLAYER_HAS_SHUFFLED_ADULT_TRADE_ITEM(ITEM_ODD_POTION);
}
} else {
return (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_ODD_POTION) ? true : false;
}
default: default:
return false; return false;
} }

View File

@ -183,7 +183,7 @@ void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx) {
this->epoch++; this->epoch++;
// Skip Poe Intro Cutscene // Skip Poe Intro Cutscene
if (gSaveContext.n64ddFlag && thisx->params == 4124) { if (gSaveContext.n64ddFlag && thisx->params == 4124 && !Randomizer_GetSettingValue(RSK_ENABLE_GLITCH_CUTSCENES)) {
Flags_SetSwitch(globalCtx, 0x1B); Flags_SetSwitch(globalCtx, 0x1B);
Actor_Kill(thisx); Actor_Kill(thisx);
} }

View File

@ -354,8 +354,16 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
KaleidoScope_SetCursorVtx(pauseCtx, index, pauseCtx->itemVtx); KaleidoScope_SetCursorVtx(pauseCtx, index, pauseCtx->itemVtx);
if ((pauseCtx->debugState == 0) && (pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) { if ((pauseCtx->debugState == 0) && (pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) {
if (CVar_GetS32("gMaskSelect", 0) && (gSaveContext.eventChkInf[8] & 0x8000) && // only allow mask select when:
cursorSlot == SLOT_TRADE_CHILD && CHECK_BTN_ALL(input->press.button, BTN_A)) { // the shop is open:
// * zelda's letter check: gSaveContext.eventChkInf[4] & 1
// * kak gate check: gSaveContext.infTable[7] & 0x40
// and the mask quest is complete: gSaveContext.eventChkInf[8] & 0x8000
if (CVar_GetS32("gMaskSelect", 0) &&
(gSaveContext.eventChkInf[8] & 0x8000) &&
cursorSlot == SLOT_TRADE_CHILD && CHECK_BTN_ALL(input->press.button, BTN_A) &&
(gSaveContext.eventChkInf[4] & 1) &&
(gSaveContext.infTable[7] & 0x40)) {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
gSelectingMask = !gSelectingMask; gSelectingMask = !gSelectingMask;
} }