Merge pull request #1282 from briaguya-ai/z-to-rn

zhora -> rando-next
This commit is contained in:
briaguya 2022-08-23 21:25:13 -04:00 committed by GitHub
commit 438331a7e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
73 changed files with 2502 additions and 1803 deletions

View File

@ -60,7 +60,7 @@ To build you'll need to follow the instructions from the building section.
_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._
_Experimental: You can also use another build system entirely rathen than MSVC like [Ninja](https://ninja-build.org/) for possibly better performance._
_Experimental: You can also use another build system entirely rather than MSVC like [Ninja](https://ninja-build.org/) for possibly better performance._
### Generating the distributable

View File

@ -195,6 +195,11 @@ install(DIRECTORY ${CMAKE_BINARY_DIR}/assets
PERMISSIONS ${PROGRAM_PERMISSIONS_EXECUTE}
)
install(CODE "
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/soh-macos\" \"\" \"${dirs}\")
")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows|NintendoSwitch|CafeOS")

View File

@ -1,7 +1,5 @@
#pragma once
#include <cstdint>
struct Vec3f
{
float x, y, z;

View File

@ -10,7 +10,6 @@
#include <string>
#include <vector>
#include "Resource.h"
//#include "Lib/StrHash64.h"
#include "StormLib.h"

View File

@ -133,8 +133,6 @@ source_group("Source Files\\CustomImpl\\Utils" FILES ${Source_Files__CustomImpl_
set(Source_Files__Globals
"Cvar.cpp"
"Cvar.h"
"GlobalCtx2.cpp"
"GlobalCtx2.h"
"LUSMacros.h"
"Window.cpp"
"Window.h"
@ -569,6 +567,10 @@ target_include_directories(${PROJECT_NAME} PRIVATE
if(MSVC)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/Od;
/Oi-
>
$<$<CONFIG:Release>:
/std:c++latest;
/Oi;

View File

@ -1,12 +1,12 @@
#include "Console.h"
#include "Cvar.h"
#include "GlobalCtx2.h"
#include "ImGuiImpl.h"
#include "Lib/ImGui/imgui.h"
#include "Utils/StringHelper.h"
#include "Lib/ImGui/imgui_internal.h"
#include "Utils.h"
#include <sstream>
namespace Ship {
std::string BuildUsage(const CommandEntry& entry) {

View File

@ -6,8 +6,6 @@
#include <functional>
#include "Lib/ImGui/imgui.h"
#define NOGDI
#define WIN32_LEAN_AND_MEAN
#include "spdlog/spdlog.h"
namespace Ship {

View File

@ -96,7 +96,7 @@ namespace Ship {
#define NESTED(key, ...) StringHelper::Sprintf("Controllers.%s.Slot_%d." key, device->GetGuid().c_str(), virtualSlot, __VA_ARGS__)
void ControlDeck::LoadControllerSettings() {
std::shared_ptr<Mercury> Config = GlobalCtx2::GetInstance()->GetConfig();
std::shared_ptr<Mercury> Config = Window::GetInstance()->GetConfig();
for (auto const& val : Config->rjson["Controllers"]["Deck"].items()) {
int32_t slot = std::stoi(val.key().substr(5));
@ -182,7 +182,7 @@ namespace Ship {
}
void ControlDeck::SaveControllerSettings() {
std::shared_ptr<Mercury> Config = GlobalCtx2::GetInstance()->GetConfig();
std::shared_ptr<Mercury> Config = Window::GetInstance()->GetConfig();
for (size_t i = 0; i < virtualDevices.size(); i++) {
std::shared_ptr<Controller> backend = physicalDevices[virtualDevices[i]];

View File

@ -5,7 +5,7 @@
#include <memory>
#include <utility>
#include <Utils/File.h>
#include "GlobalCtx2.h"
#include "Window.h"
std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars;
@ -144,7 +144,7 @@ template <typename Numeric> bool is_number(const std::string& s) {
}
void CVar_LoadLegacy() {
auto cvarsConfig = Ship::GlobalCtx2::GetPathRelativeToAppDirectory("cvars.cfg");
auto cvarsConfig = Ship::Window::GetPathRelativeToAppDirectory("cvars.cfg");
if (File::Exists(cvarsConfig)) {
const auto lines = File::ReadAllLines(cvarsConfig);
@ -191,7 +191,7 @@ void CVar_LoadLegacy() {
extern "C" void CVar_Load() {
std::shared_ptr<Mercury> pConf = Ship::GlobalCtx2::GetInstance()->GetConfig();
std::shared_ptr<Mercury> pConf = Ship::Window::GetInstance()->GetConfig();
pConf->reload();
for (const auto& item : pConf->rjson["CVars"].items()) {
@ -235,7 +235,7 @@ extern "C" void CVar_Load() {
extern "C" void CVar_Save()
{
std::shared_ptr<Mercury> pConf = Ship::GlobalCtx2::GetInstance()->GetConfig();
std::shared_ptr<Mercury> pConf = Ship::Window::GetInstance()->GetConfig();
for (const auto& cvar : cvars) {
const std::string key = StringHelper::Sprintf("CVars.%s", cvar.first.c_str());

View File

@ -2,7 +2,8 @@
#include <string>
#include <memory>
#include "GlobalCtx2.h"
#include <mutex>
#include <condition_variable>
namespace Ship {
class Archive;

View File

@ -45,7 +45,7 @@ namespace Ship {
void GameOverlay::LoadFont(const std::string& name, const std::string& path, float fontSize) {
ImGuiIO& io = ImGui::GetIO();
std::shared_ptr<Archive> base = GlobalCtx2::GetInstance()->GetResourceManager()->GetArchive();
std::shared_ptr<Archive> base = Window::GetInstance()->GetResourceManager()->GetArchive();
std::shared_ptr<File> font = std::make_shared<File>();
base->LoadFile(path, false, font);
if (font->bIsLoaded) {

View File

@ -1,149 +0,0 @@
#include "GlobalCtx2.h"
#include <iostream>
#include <vector>
#include "ResourceMgr.h"
#include "Window.h"
#include "spdlog/async.h"
#include "spdlog/sinks/rotating_file_sink.h"
#include "spdlog/sinks/stdout_color_sinks.h"
#include "spdlog/sinks/sohconsole_sink.h"
#ifdef __APPLE__
#include "OSXFolderManager.h"
#elif defined(__SWITCH__)
#include "SwitchImpl.h"
#elif defined(__WIIU__)
#include "WiiUImpl.h"
#endif
namespace Ship {
std::weak_ptr<GlobalCtx2> GlobalCtx2::Context;
std::shared_ptr<GlobalCtx2> GlobalCtx2::GetInstance() {
return Context.lock();
}
std::shared_ptr<GlobalCtx2> GlobalCtx2::CreateInstance(const std::string& Name) {
if (Context.expired()) {
auto Shared = std::make_shared<GlobalCtx2>(Name);
Context = Shared;
Shared->InitWindow();
return Shared;
} else {
SPDLOG_DEBUG("Trying to create a context when it already exists.");
}
return GetInstance();
}
std::string GlobalCtx2::GetAppDirectoryPath() {
#ifdef __APPLE__
FolderManager folderManager;
std::string fpath = std::string(folderManager.pathForDirectory(NSApplicationSupportDirectory, NSUserDomainMask));
fpath.append("/com.shipofharkinian.soh");
return fpath;
#endif
return ".";
}
std::string GlobalCtx2::GetPathRelativeToAppDirectory(const char* path) {
return GlobalCtx2::GetAppDirectoryPath() + "/" + path;
}
GlobalCtx2::GlobalCtx2(std::string Name) : Name(std::move(Name)) {
}
GlobalCtx2::~GlobalCtx2() {
SPDLOG_INFO("destruct GlobalCtx2");
}
void GlobalCtx2::InitWindow() {
InitLogging();
Config = std::make_shared<Mercury>(GetPathRelativeToAppDirectory("shipofharkinian.json"));
MainPath = Config->getString("Game.Main Archive", GetPathRelativeToAppDirectory("oot.otr"));
PatchesPath = Config->getString("Game.Patches Archive", GetAppDirectoryPath() + "/mods");
ResMan = std::make_shared<ResourceMgr>(GetInstance(), MainPath, PatchesPath);
Win = std::make_shared<Window>(GetInstance());
if (!ResMan->DidLoadSuccessfully())
{
#ifdef _WIN32
MessageBox(nullptr, L"Main OTR file not found!", L"Uh oh", MB_OK);
#elif defined(__SWITCH__)
printf("Main OTR file not found!\n");
#elif defined(__WIIU__)
Ship::WiiU::ThrowMissingOTR(MainPath.c_str());
#else
SPDLOG_ERROR("Main OTR file not found!");
#endif
exit(1);
}
#ifdef __SWITCH__
Ship::Switch::Init(PostInitPhase);
#endif
}
void GlobalCtx2::InitLogging() {
try {
// Setup Logging
spdlog::init_thread_pool(8192, 1);
std::vector<spdlog::sink_ptr> Sinks;
auto SohConsoleSink = std::make_shared<spdlog::sinks::soh_sink_mt>();
SohConsoleSink->set_level(spdlog::level::trace);
Sinks.push_back(SohConsoleSink);
#if (!defined(_WIN32) && !defined(__WIIU__)) || defined(_DEBUG)
auto ConsoleSink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
ConsoleSink->set_level(spdlog::level::trace);
Sinks.push_back(ConsoleSink);
#endif
#ifndef __WIIU__
auto logPath = GetPathRelativeToAppDirectory(("logs/" + GetName() + ".log").c_str());
auto FileSink = std::make_shared<spdlog::sinks::rotating_file_sink_mt>(logPath, 1024 * 1024 * 10, 10);
FileSink->set_level(spdlog::level::trace);
Sinks.push_back(FileSink);
#endif
Logger = std::make_shared<spdlog::async_logger>(GetName(), Sinks.begin(), Sinks.end(), spdlog::thread_pool(), spdlog::async_overflow_policy::block);
GetLogger()->set_level(spdlog::level::trace);
#ifndef __WIIU__
GetLogger()->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%@] [%l] %v");
#else
GetLogger()->set_pattern("[%s:%#] [%l] %v");
#endif
spdlog::register_logger(GetLogger());
spdlog::set_default_logger(GetLogger());
}
catch (const spdlog::spdlog_ex& ex) {
std::cout << "Log initialization failed: " << ex.what() << std::endl;
}
}
void GlobalCtx2::WriteSaveFile(const std::filesystem::path& savePath, const uintptr_t addr, void* dramAddr, const size_t size) {
std::ofstream saveFile = std::ofstream(savePath, std::fstream::in | std::fstream::out | std::fstream::binary);
saveFile.seekp(addr);
saveFile.write((char*)dramAddr, size);
saveFile.close();
}
void GlobalCtx2::ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, void* dramAddr, size_t size) {
std::ifstream saveFile = std::ifstream(savePath, std::fstream::in | std::fstream::out | std::fstream::binary);
// If the file doesn't exist, initialize DRAM
if (saveFile.good()) {
saveFile.seekg(addr);
saveFile.read((char*)dramAddr, size);
} else {
memset(dramAddr, 0, size);
}
saveFile.close();
}
}

View File

@ -1,54 +0,0 @@
#ifndef GLOBAL_CTX_2
#define GLOBAL_CTX_2
#pragma once
#ifdef __cplusplus
#include <filesystem>
#include <memory>
#include <fstream>
#include "spdlog/spdlog.h"
#include "Lib/Mercury/Mercury.h"
namespace Ship {
class ResourceMgr;
class Window;
class GlobalCtx2 {
public:
static std::shared_ptr<GlobalCtx2> GetInstance();
static std::shared_ptr<GlobalCtx2> CreateInstance(const std::string& Name);
std::string GetName() { return Name; }
std::shared_ptr<Window> GetWindow() { return Win; }
std::shared_ptr<ResourceMgr> GetResourceManager() { return ResMan; }
std::shared_ptr<spdlog::logger> GetLogger() { return Logger; }
std::shared_ptr<Mercury> GetConfig() { return Config; }
static std::string GetAppDirectoryPath();
static std::string GetPathRelativeToAppDirectory(const char* path);
void WriteSaveFile(const std::filesystem::path& savePath, uintptr_t addr, void* dramAddr, size_t size);
void ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, void* dramAddr, size_t size);
GlobalCtx2(std::string Name);
~GlobalCtx2();
protected:
void InitWindow();
void InitLogging();
private:
static std::weak_ptr <GlobalCtx2> Context;
std::shared_ptr<spdlog::logger> Logger;
std::shared_ptr<Window> Win;
std::shared_ptr<Mercury> Config; // Config needs to be after the Window because we call the Window during it's destructor.
std::shared_ptr<ResourceMgr> ResMan;
std::string Name;
std::string MainPath;
std::string PatchesPath;
};
}
#endif
#endif

View File

@ -18,7 +18,6 @@
#include "Hooks.h"
#define IMGUI_DEFINE_MATH_OPERATORS
#include "Lib/ImGui/imgui_internal.h"
#include "GlobalCtx2.h"
#include "ResourceMgr.h"
#include "Window.h"
#include "Cvar.h"
@ -42,8 +41,10 @@
#if __APPLE__
#include <SDL_hints.h>
#include <SDL_video.h>
#else
#include <SDL2/SDL_hints.h>
#include <SDL2/SDL_video.h>
#endif
#ifdef __SWITCH__
@ -164,8 +165,14 @@ namespace SohImGui {
} else {
console->Close();
}
SohImGui::controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0);
UpdateAudio();
if (CVar_GetS32("gControllerConfigurationEnabled", 0)) {
controller->Open();
} else {
controller->Close();
}
UpdateAudio();
});
}
@ -338,6 +345,8 @@ namespace SohImGui {
switch (impl.backend) {
case Backend::DX11:
return true;
case Backend::SDL:
return true;
default:
return false;
}
@ -345,27 +354,27 @@ namespace SohImGui {
void ShowCursor(bool hide, Dialogues d) {
if (d == Dialogues::dLoadSettings) {
GlobalCtx2::GetInstance()->GetWindow()->ShowCursor(hide);
Window::GetInstance()->ShowCursor(hide);
return;
}
if (d == Dialogues::dConsole && CVar_GetS32("gOpenMenuBar", 0)) {
return;
}
if (!GlobalCtx2::GetInstance()->GetWindow()->IsFullscreen()) {
if (!Window::GetInstance()->IsFullscreen()) {
oldCursorState = false;
return;
}
if (oldCursorState != hide) {
oldCursorState = hide;
GlobalCtx2::GetInstance()->GetWindow()->ShowCursor(hide);
Window::GetInstance()->ShowCursor(hide);
}
}
void LoadTexture(const std::string& name, const std::string& path) {
GfxRenderingAPI* api = gfx_get_current_rendering_api();
const auto res = GlobalCtx2::GetInstance()->GetResourceManager()->LoadFile(path);
const auto res = Window::GetInstance()->GetResourceManager()->LoadFile(path);
const auto asset = new GameAsset{ api->new_texture() };
uint8_t* img_data = stbi_load_from_memory(reinterpret_cast<const stbi_uc*>(res->buffer.get()), res->dwBufferSize, &asset->width, &asset->height, nullptr, 4);
@ -401,7 +410,7 @@ namespace SohImGui {
void LoadResource(const std::string& name, const std::string& path, const ImVec4& tint) {
GfxRenderingAPI* api = gfx_get_current_rendering_api();
const auto res = static_cast<Ship::Texture*>(GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(path).get());
const auto res = static_cast<Ship::Texture*>(Window::GetInstance()->GetResourceManager()->LoadResource(path).get());
std::vector<uint8_t> texBuffer;
texBuffer.reserve(res->width * res->height * 4);
@ -466,7 +475,7 @@ namespace SohImGui {
io->DisplaySize.y = window_impl.gx2.height;
#endif
lastBackendID = GetBackendID(GlobalCtx2::GetInstance()->GetConfig());
lastBackendID = GetBackendID(Window::GetInstance()->GetConfig());
if (CVar_GetS32("gOpenMenuBar", 0) != 1) {
#if defined(__SWITCH__) || defined(__WIIU__)
SohImGui::overlay->TextDrawNotification(30.0f, true, "Press - to access enhancements menu");
@ -475,8 +484,8 @@ namespace SohImGui {
#endif
}
auto imguiIniPath = Ship::GlobalCtx2::GetPathRelativeToAppDirectory("imgui.ini");
auto imguiLogPath = Ship::GlobalCtx2::GetPathRelativeToAppDirectory("imgui_log.txt");
auto imguiIniPath = Ship::Window::GetPathRelativeToAppDirectory("imgui.ini");
auto imguiLogPath = Ship::Window::GetPathRelativeToAppDirectory("imgui_log.txt");
io->IniFilename = strcpy(new char[imguiIniPath.length() + 1], imguiIniPath.c_str());
io->LogFilename = strcpy(new char[imguiLogPath.length() + 1], imguiLogPath.c_str());
@ -500,7 +509,7 @@ namespace SohImGui {
#endif
Ship::RegisterHook<Ship::GfxInit>([] {
if (GlobalCtx2::GetInstance()->GetWindow()->IsFullscreen())
if (Window::GetInstance()->IsFullscreen())
ShowCursor(CVar_GetS32("gOpenMenuBar", 0), Dialogues::dLoadSettings);
LoadTexture("Game_Icon", "assets/ship_of_harkinian/icons/gSohIcon.png");
@ -600,13 +609,101 @@ namespace SohImGui {
ImGui::Text("%s", text);
}
void EnhancementCheckbox(const char* text, const char* cvarName)
void RenderCross(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float sz)
{
float thickness = ImMax(sz / 5.0f, 1.0f);
sz -= thickness * 0.5f;
pos += ImVec2(thickness * 0.25f, thickness * 0.25f);
draw_list->PathLineTo(ImVec2(pos.x, pos.y));
draw_list->PathLineTo(ImVec2(pos.x + sz, pos.y + sz));
draw_list->PathStroke(col, 0, thickness);
draw_list->PathLineTo(ImVec2(pos.x + sz, pos.y));
draw_list->PathLineTo(ImVec2(pos.x, pos.y + sz));
draw_list->PathStroke(col, 0, thickness);
}
bool CustomCheckbox(const char* label, bool* v, bool disabled, ImGuiCheckboxGraphics disabledGraphic) {
ImGuiWindow* window = ImGui::GetCurrentWindow();
if (window->SkipItems)
return false;
ImGuiContext& g = *GImGui;
const ImGuiStyle& style = g.Style;
const ImGuiID id = window->GetID(label);
const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
const float square_sz = ImGui::GetFrameHeight();
const ImVec2 pos = window->DC.CursorPos;
const ImRect total_bb(pos, pos + ImVec2(square_sz + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), label_size.y + style.FramePadding.y * 2.0f));
ImGui::ItemSize(total_bb, style.FramePadding.y);
if (!ImGui::ItemAdd(total_bb, id))
{
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
return false;
}
bool hovered, held;
bool pressed = ImGui::ButtonBehavior(total_bb, id, &hovered, &held);
if (pressed)
{
*v = !(*v);
ImGui::MarkItemEdited(id);
}
const ImRect check_bb(pos, pos + ImVec2(square_sz, square_sz));
ImGui::RenderNavHighlight(total_bb, id);
ImGui::RenderFrame(check_bb.Min, check_bb.Max, ImGui::GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding);
ImU32 check_col = ImGui::GetColorU32(ImGuiCol_CheckMark);
ImU32 cross_col = ImGui::GetColorU32(ImVec4(0.50f, 0.50f, 0.50f, 1.00f));
bool mixed_value = (g.LastItemData.InFlags & ImGuiItemFlags_MixedValue) != 0;
if (mixed_value)
{
// Undocumented tristate/mixed/indeterminate checkbox (#2644)
// This may seem awkwardly designed because the aim is to make ImGuiItemFlags_MixedValue supported by all widgets (not just checkbox)
ImVec2 pad(ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)), ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)));
window->DrawList->AddRectFilled(check_bb.Min + pad, check_bb.Max - pad, check_col, style.FrameRounding);
}
else if ((!disabled && *v) || (disabled && disabledGraphic == ImGuiCheckboxGraphics::Checkmark))
{
const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f));
ImGui::RenderCheckMark(window->DrawList, check_bb.Min + ImVec2(pad, pad), check_col, square_sz - pad * 2.0f);
}
else if (disabled && disabledGraphic == ImGuiCheckboxGraphics::Cross) {
const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f));
RenderCross(window->DrawList, check_bb.Min + ImVec2(pad, pad), cross_col, square_sz - pad * 2.0f);
}
ImVec2 label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y);
if (g.LogEnabled)
ImGui::LogRenderedText(&label_pos, mixed_value ? "[~]" : *v ? "[x]" : "[ ]");
if (label_size.x > 0.0f)
ImGui::RenderText(label_pos, label);
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
return pressed;
}
void EnhancementCheckbox(const char* text, const char* cvarName, bool disabled, const char* disabledTooltipText, ImGuiCheckboxGraphics disabledGraphic)
{
if (disabled) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
}
bool val = (bool)CVar_GetS32(cvarName, 0);
if (ImGui::Checkbox(text, &val)) {
if (CustomCheckbox(text, &val, disabled, disabledGraphic)) {
CVar_SetS32(cvarName, val);
needs_save = true;
}
if (disabled) {
ImGui::PopStyleVar(1);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && disabledTooltipText != "") {
ImGui::SetTooltip("%s", disabledTooltipText);
}
ImGui::PopItemFlag();
}
}
void EnhancementButton(const char* text, const char* cvarName)
@ -753,12 +850,7 @@ namespace SohImGui {
}
void RandomizeColor(const char* cvarName, ImVec4* colors) {
std::string Cvar_Red = cvarName;
Cvar_Red += "R";
std::string Cvar_Green = cvarName;
Cvar_Green += "G";
std::string Cvar_Blue = cvarName;
Cvar_Blue += "B";
Color_RGBA8 NewColors = {0,0,0,255};
std::string Cvar_RBM = cvarName;
Cvar_RBM += "RBM";
std::string MakeInvisible = "##";
@ -773,9 +865,10 @@ namespace SohImGui {
colors->x = (float)RND_R / 255;
colors->y = (float)RND_G / 255;
colors->z = (float)RND_B / 255;
CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(colors->x * 255, 0, 255));
CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(colors->y * 255, 0, 255));
CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(colors->z * 255, 0, 255));
NewColors.r = ClampFloatToInt(colors->x * 255, 0, 255);
NewColors.g = ClampFloatToInt(colors->y * 255, 0, 255);
NewColors.b = ClampFloatToInt(colors->z * 255, 0, 255);
CVar_SetRGBA(cvarName, NewColors);
CVar_SetS32(Cvar_RBM.c_str(), 0); //On click disable rainbow mode.
needs_save = true;
}
@ -802,16 +895,16 @@ namespace SohImGui {
MakeInvisible += cvarName;
MakeInvisible += "Reset";
if (ImGui::Button(MakeInvisible.c_str())) {
colors->x = defaultcolors.x / 255;
colors->y = defaultcolors.y / 255;
colors->z = defaultcolors.z / 255;
if (has_alpha) { colors->w = defaultcolors.w / 255; };
colors->x = defaultcolors.x;
colors->y = defaultcolors.y;
colors->z = defaultcolors.z;
if (has_alpha) { colors->w = defaultcolors.w; };
Color_RGBA8 colorsRGBA;
colorsRGBA.r = defaultcolors.x / 255;
colorsRGBA.g = defaultcolors.y / 255;
colorsRGBA.b = defaultcolors.z / 255;
if (has_alpha) { colorsRGBA.a = defaultcolors.w / 255; };
colorsRGBA.r = defaultcolors.x;
colorsRGBA.g = defaultcolors.y;
colorsRGBA.b = defaultcolors.z;
if (has_alpha) { colorsRGBA.a = defaultcolors.w; };
CVar_SetRGBA(cvarName, colorsRGBA);
CVar_SetS32(Cvar_RBM.c_str(), 0); //On click disable rainbow mode.
@ -883,8 +976,8 @@ namespace SohImGui {
ImGuiWMNewFrame();
ImGui::NewFrame();
const std::shared_ptr<Window> wnd = GlobalCtx2::GetInstance()->GetWindow();
const std::shared_ptr<Mercury> pConf = GlobalCtx2::GetInstance()->GetConfig();
const std::shared_ptr<Window> wnd = Window::GetInstance();
const std::shared_ptr<Mercury> pConf = Window::GetInstance()->GetConfig();
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoBackground |
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove |
@ -921,9 +1014,9 @@ namespace SohImGui {
bool menu_bar = CVar_GetS32("gOpenMenuBar", 0);
CVar_SetS32("gOpenMenuBar", !menu_bar);
needs_save = true;
GlobalCtx2::GetInstance()->GetWindow()->SetMenuBar(menu_bar);
Window::GetInstance()->SetMenuBar(menu_bar);
ShowCursor(menu_bar, Dialogues::dMenubar);
GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->SaveControllerSettings();
Window::GetInstance()->GetControlDeck()->SaveControllerSettings();
if (CVar_GetS32("gControlNav", 0) && CVar_GetS32("gOpenMenuBar", 0)) {
io->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad | ImGuiConfigFlags_NavEnableKeyboard;
} else {
@ -1009,7 +1102,11 @@ namespace SohImGui {
bool currentValue = CVar_GetS32("gControllerConfigurationEnabled", 0);
CVar_SetS32("gControllerConfigurationEnabled", !currentValue);
needs_save = true;
controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0);
if (CVar_GetS32("gControllerConfigurationEnabled", 0)) {
controller->Open();
} else {
controller->Close();
}
}
ImGui::PopStyleColor(1);
ImGui::PopStyleVar(3);
@ -1214,6 +1311,8 @@ namespace SohImGui {
Tooltip("The default response to Kaepora Gaebora is always that you understood what he said");
PaddedEnhancementCheckbox("Fast Ocarina Playback", "gFastOcarinaPlayback", true, false);
Tooltip("Skip the part where the Ocarina playback is called when you play a song");
PaddedEnhancementCheckbox("Skip Scarecrow Song", "gSkipScarecrow", true, false);
Tooltip("Pierre appears when Ocarina is pulled out. Requires learning scarecrow song.");
PaddedEnhancementCheckbox("Instant Putaway", "gInstantPutaway", true, false);
Tooltip("Allow Link to put items away without having to wait around");
PaddedEnhancementCheckbox("Instant Boomerang Recall", "gFastBoomerang", true, false);
@ -1268,6 +1367,8 @@ namespace SohImGui {
);
PaddedEnhancementCheckbox("No Random Drops", "gNoRandomDrops", true, false);
Tooltip("Disables random drops, except from the Goron Pot, Dampe, and bosses");
PaddedEnhancementCheckbox("Enable Bombchu Drops", "gBombchuDrops", true, false);
Tooltip("Bombchus will sometimes drop in place of bombs");
PaddedEnhancementCheckbox("No Heart Drops", "gNoHeartDrops", true, false);
Tooltip("Disables heart drops, but not heart placements, like from a Deku Scrub running off\nThis simulates Hero Mode from other games in the series");
PaddedEnhancementCheckbox("Always Win Goron Pot", "gGoronPot", true, false);
@ -1502,6 +1603,7 @@ namespace SohImGui {
Tooltip("Restores N64 Weird Frames allowing weirdshots to behave the same as N64");
PaddedEnhancementCheckbox("Bombchus out of bounds", "gBombchusOOB", true, false);
Tooltip("Allows bombchus to explode out of bounds\nSimilar to GameCube and Wii VC");
PaddedEnhancementCheckbox("Restore old Gold Skulltula cutscene", "gGsCutscene", true, false);
ImGui::EndMenu();
}
@ -2157,6 +2259,8 @@ namespace SohImGui {
CVar_SetS32("gNoRandomDrops", 0);
// No Heart Drops
CVar_SetS32("gNoHeartDrops", 0);
// Enable Bombchu Drops
CVar_SetS32("gBombchuDrops", 0);
// Always Win Goron Pot
CVar_SetS32("gGoronPot", 0);
@ -2288,6 +2392,7 @@ namespace SohImGui {
// Bombchus out of bounds
CVar_SetS32("gBombchusOOB", 0);
CVar_SetS32("gGsCutscene", 0);
// Autosave
CVar_SetS32("gAutosave", 0);
}
@ -2407,6 +2512,8 @@ namespace SohImGui {
CVar_SetS32("gVisualAgony", 1);
// Pull grave during the day
CVar_SetS32("gDayGravePull", 1);
// Pull out Ocarina to Summon Scarecrow
CVar_SetS32("gSkipScarecrow", 0);
// Pause link animation (0 to 16)
CVar_SetS32("gPauseLiveLink", 16);
@ -2418,8 +2525,18 @@ namespace SohImGui {
ImGui::Render();
ImGuiRenderDrawData(ImGui::GetDrawData());
if (UseViewports()) {
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindowsDefault();
if (impl.backend == Backend::SDL) {
SDL_Window* backup_current_window = SDL_GL_GetCurrentWindow();
SDL_GLContext backup_current_context = SDL_GL_GetCurrentContext();
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindowsDefault();
SDL_GL_MakeCurrent(backup_current_window, backup_current_context);
} else {
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindowsDefault();
}
}
}
@ -2650,11 +2767,11 @@ namespace SohImGui {
}
}
void PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop, bool padBottom) {
void PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop, bool padBottom, bool disabled, const char* disabledTooltipText, ImGuiCheckboxGraphics disabledGraphic) {
if (padTop) {
ImGui::Dummy(ImVec2(0.0f, 0.0f));
}
EnhancementCheckbox(text, cvarName);
EnhancementCheckbox(text, cvarName, disabled, disabledTooltipText, disabledGraphic);
if (padBottom) {
ImGui::Dummy(ImVec2(0.0f, 0.0f));
}

View File

@ -34,6 +34,14 @@ namespace SohImGui {
dLoadSettings,
};
// Enumeration for disabled checkbox graphics
enum class ImGuiCheckboxGraphics
{
Cross,
Checkmark,
None
};
typedef struct {
Backend backend;
union {
@ -86,7 +94,7 @@ namespace SohImGui {
void Tooltip(const char* text);
void EnhancementRadioButton(const char* text, const char* cvarName, int id);
void EnhancementCheckbox(const char* text, const char* cvarName);
void EnhancementCheckbox(const char* text, const char* cvarName, bool disabled = false, const char* disabledTooltipText = "", ImGuiCheckboxGraphics disabledGraphic = ImGuiCheckboxGraphics::Cross);
void EnhancementButton(const char* text, const char* cvarName);
void EnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = false);
void EnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage, bool PlusMinusButton = false);
@ -123,7 +131,7 @@ namespace SohImGui {
void InsertPadding(float extraVerticalPadding = 0.0f);
void PaddedSeparator(bool padTop = true, bool padBottom = true, float extraVerticalTopPadding = 0.0f, float extraVerticalBottomPadding = 0.0f);
void PaddedEnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = false, bool padTop = true, bool padBottom = true);
void PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop = true, bool padBottom = true);
void PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop = true, bool padBottom = true, bool disabled = false, const char* disabledTooltipText = "", ImGuiCheckboxGraphics disabledGraphic = ImGuiCheckboxGraphics::Cross);
void PaddedText(const char* text, bool padTop = true, bool padBottom = true);
std::string GetWindowButtonText(const char* text, bool menuOpen);
}

View File

@ -16,11 +16,11 @@ namespace Ship {
}
std::shared_ptr<Controller> GetControllerPerSlot(int slot) {
auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck();
auto controlDeck = Ship::Window::GetInstance()->GetControlDeck();
return controlDeck->GetPhysicalDeviceFromVirtualSlot(slot);
}
void InputEditor::DrawButton(const char* label, int n64Btn) {
void InputEditor::DrawButton(const char* label, int32_t n64Btn) {
const std::shared_ptr<Controller> backend = GetControllerPerSlot(CurrentPort);
float size = 40;
@ -85,7 +85,7 @@ namespace Ship {
}
void InputEditor::DrawControllerSchema() {
auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck();
auto controlDeck = Ship::Window::GetInstance()->GetControlDeck();
auto Backend = controlDeck->GetPhysicalDeviceFromVirtualSlot(CurrentPort);
auto profile = Backend->getProfile(CurrentPort);
bool IsKeyboard = Backend->GetGuid() == "Keyboard" || Backend->GetGuid() == "Auto" || !Backend->Connected();
@ -357,4 +357,16 @@ namespace Ship {
ImGui::End();
}
bool InputEditor::IsOpened() {
return Opened;
}
void InputEditor::Open() {
Opened = true;
}
void InputEditor::Close() {
Opened = false;
}
}

View File

@ -1,18 +1,22 @@
#pragma once
#include "stdint.h"
#include "Lib/ImGui/imgui.h"
namespace Ship {
class InputEditor {
int CurrentPort = 0;
int BtnReading = -1;
public:
int32_t CurrentPort = 0;
int32_t BtnReading = -1;
bool Opened = false;
public:
void Init();
void DrawButton(const char* label, int n64Btn);
void DrawButton(const char* label, int32_t n64Btn);
void DrawVirtualStick(const char* label, ImVec2 stick);
void DrawControllerSchema();
void DrawHud();
bool IsOpened();
void Open();
void Close();
};
}

View File

@ -7,7 +7,7 @@
#endif
#include "Hooks.h"
#include "GlobalCtx2.h"
#include "Window.h"
namespace Ship {
@ -70,7 +70,7 @@ namespace Ship {
});
if (find == Mappings.end()) return "Unknown";
const char* name = GlobalCtx2::GetInstance()->GetWindow()->GetKeyName(find->first);
const char* name = Window::GetInstance()->GetKeyName(find->first);
return strlen(name) == 0 ? "Unknown" : name;
}

View File

@ -16,7 +16,6 @@
#include "gfx_cc.h"
#include "gfx_rendering_api.h"
#include "../../GlobalCtx2.h"
#include "gfx_pc.h"
#include "gfx_wiiu.h"

View File

@ -44,7 +44,7 @@
#include "gfx_cc.h"
#include "gfx_rendering_api.h"
#include "../../ImGuiImpl.h"
#include "../../GlobalCtx2.h"
#include "../../Window.h"
#include "gfx_pc.h"
using namespace std;

View File

@ -15,6 +15,7 @@
#ifndef _LANGUAGE_C
#define _LANGUAGE_C
#endif
#include <PR/ultra64/types.h>
#include <PR/ultra64/gbi.h>
#include <PR/ultra64/gs2dex.h>
#include <string>
@ -36,6 +37,7 @@
#include "../../ResourceMgr.h"
#include "../../Utils.h"
// OTRTODO: fix header files for these
extern "C" {
const char* ResourceMgr_GetNameByCRC(uint64_t crc);
@ -2171,7 +2173,7 @@ static void gfx_run_dl(Gfx* cmd) {
uintptr_t mtxAddr = cmd->words.w1;
// OTRTODO: Temp way of dealing with gMtxClear. Need something more elegant in the future...
uint32_t gameVersion = Ship::GlobalCtx2::GetInstance()->GetResourceManager()->GetGameVersion();
uint32_t gameVersion = Ship::Window::GetInstance()->GetResourceManager()->GetGameVersion();
if (gameVersion == OOT_PAL_GC) {
if (mtxAddr == SEG_ADDR(0, 0x0FBC20)) {
mtxAddr = clearMtx;

View File

@ -8,6 +8,7 @@
#include <list>
#include <cstddef>
#include "U64/PR/ultra64/gbi.h"
#include "U64/PR/ultra64/types.h"
// TODO figure out why changing these to 640x480 makes the game only render in a quarter of the window

View File

@ -189,6 +189,7 @@ static void gfx_sdl_init(const char *game_name, bool start_in_fullscreen, uint32
}
#endif
SDL_GL_MakeCurrent(wnd, ctx);
SDL_GL_SetSwapInterval(1);
SohImGui::WindowImpl window_impl;

View File

@ -1,4 +1,5 @@
#include "Resource.h"
#include "StrHash.h"
namespace Ship
{

View File

@ -3,15 +3,14 @@
#include <stdint.h>
#include "Utils/BinaryReader.h"
#include "Utils/BinaryWriter.h"
#include "GlobalCtx2.h"
#include "StrHash.h"
#include "File.h"
#include "Lib/tinyxml2/tinyxml2.h"
#include "spdlog/spdlog.h"
namespace Ship
{
enum class ResourceType
{
namespace Ship {
class ResourceMgr;
enum class ResourceType {
Archive = 0x4F415243, // OARC (UNUSED)
Model = 0x4F4D444C, // OMDL (WIP)
Texture = 0x4F544558, // OTEX
@ -36,8 +35,7 @@ namespace Ship
AudioSequence = 0x4F534551, // OSEQ
};
enum class DataType
{
enum class DataType {
U8 = 0,
S8 = 1,
U16 = 2,
@ -51,8 +49,7 @@ namespace Ship
F64 = 10
};
enum class Version
{
enum class Version {
// BR
Deckard = 0,
Roy = 1,
@ -61,15 +58,13 @@ namespace Ship
// ...
};
struct Patch
{
struct Patch {
uint64_t crc;
uint32_t index;
uintptr_t origData;
};
class Resource
{
class Resource {
public:
ResourceMgr* resMgr;
uint64_t id; // Unique Resource ID
@ -81,8 +76,7 @@ namespace Ship
virtual ~Resource();
};
class ResourceFile
{
class ResourceFile {
public:
Endianness endianness; // 0x00 - Endianness of the file
uint32_t resourceType; // 0x01 - 4 byte MAGIC

View File

@ -9,13 +9,14 @@
namespace Ship {
ResourceMgr::ResourceMgr(std::shared_ptr<GlobalCtx2> Context, const std::string& MainPath, const std::string& PatchesPath) : Context(Context), bIsRunning(false), FileLoadThread(nullptr) {
ResourceMgr::ResourceMgr(std::shared_ptr<Window> Context, const std::string& MainPath, const std::string& PatchesPath) : Context(Context), bIsRunning(false), FileLoadThread(nullptr) {
OTR = std::make_shared<Archive>(MainPath, PatchesPath, false);
gameVersion = OOT_UNKNOWN;
if (OTR->IsMainMPQValid())
if (OTR->IsMainMPQValid()) {
Start();
}
}
ResourceMgr::~ResourceMgr() {
@ -87,10 +88,11 @@ namespace Ship {
OTR->LoadFile(ToLoad->path, true, ToLoad);
if (!ToLoad->bHasLoadError)
if (!ToLoad->bHasLoadError) {
FileCache[ToLoad->path] = ToLoad->bIsLoaded && !ToLoad->bHasLoadError ? ToLoad : nullptr;
}
SPDLOG_DEBUG("Loaded File {} on ResourceMgr thread", ToLoad->path);
SPDLOG_TRACE("Loaded File {} on ResourceMgr thread", ToLoad->path);
ToLoad->FileLoadNotifier.notify_all();
}
@ -123,12 +125,10 @@ namespace Ship {
}
}
if (!ToLoad->file->bHasLoadError)
{
if (!ToLoad->file->bHasLoadError) {
auto UnmanagedRes = ResourceLoader::LoadResource(ToLoad->file);
if (UnmanagedRes != nullptr)
{
if (UnmanagedRes != nullptr) {
UnmanagedRes->resMgr = this;
auto Res = std::shared_ptr<Resource>(UnmanagedRes);
@ -142,17 +142,14 @@ namespace Ship {
SPDLOG_DEBUG("Loaded Resource {} on ResourceMgr thread", ToLoad->file->path);
Res->file = nullptr;
}
else {
} else {
ToLoad->bHasResourceLoaded = false;
ToLoad->resource = nullptr;
SPDLOG_ERROR("Resource load FAILED {} on ResourceMgr thread", ToLoad->file->path);
}
}
}
else
{
} else {
ToLoad->bHasResourceLoaded = false;
ToLoad->resource = nullptr;
}
@ -163,13 +160,11 @@ namespace Ship {
SPDLOG_INFO("Resource Manager LoadResourceThread ended");
}
uint32_t ResourceMgr::GetGameVersion()
{
uint32_t ResourceMgr::GetGameVersion() {
return gameVersion;
}
void ResourceMgr::SetGameVersion(uint32_t newGameVersion)
{
void ResourceMgr::SetGameVersion(uint32_t newGameVersion) {
gameVersion = newGameVersion;
}
@ -206,24 +201,23 @@ namespace Ship {
auto resCacheFind = ResourceCache.find(FilePath);
if (resCacheFind != ResourceCache.end() &&
resCacheFind->second.use_count() > 0)
{
resCacheFind->second.use_count() > 0) {
return resCacheFind->second;
}
else
} else {
return nullptr;
}
}
std::shared_ptr<Resource> ResourceMgr::LoadResource(const char* FilePath) {
auto Res = LoadResourceAsync(FilePath);
if (std::holds_alternative<std::shared_ptr<Resource>>(Res))
if (std::holds_alternative<std::shared_ptr<Resource>>(Res)) {
return std::get<std::shared_ptr<Resource>>(Res);
}
auto& Promise = std::get<std::shared_ptr<ResourcePromise>>(Res);
if (!Promise->bHasResourceLoaded)
{
if (!Promise->bHasResourceLoaded) {
std::unique_lock<std::mutex> Lock(Promise->resourceLoadMutex);
while (!Promise->bHasResourceLoaded) {
Promise->resourceLoadNotifier.wait(Lock);
@ -234,8 +228,9 @@ namespace Ship {
}
std::variant<std::shared_ptr<Resource>, std::shared_ptr<ResourcePromise>> ResourceMgr::LoadResourceAsync(const char* FilePath) {
if (FilePath[0] == '_' && FilePath[1] == '_' && FilePath[2] == 'O' && FilePath[3] == 'T' && FilePath[4] == 'R' && FilePath[5] == '_' && FilePath[6] == '_')
if (FilePath[0] == '_' && FilePath[1] == '_' && FilePath[2] == 'O' && FilePath[3] == 'T' && FilePath[4] == 'R' && FilePath[5] == '_' && FilePath[6] == '_') {
FilePath += 7;
}
const std::lock_guard<std::mutex> ResLock(ResourceLoadMutex);
auto resCacheFind = ResourceCache.find(FilePath);
@ -248,21 +243,16 @@ namespace Ship {
std::shared_ptr<File> FileData = LoadFile(FilePath);
Promise->file = FileData;
if (Promise->file->bHasLoadError)
{
if (Promise->file->bHasLoadError) {
Promise->bHasResourceLoaded = true;
}
else
{
} else {
Promise->bHasResourceLoaded = false;
ResourceLoadQueue.push(Promise);
ResourceLoadNotifier.notify_all();
}
return Promise;
}
else
{
} else {
return resCacheFind->second;
}
}
@ -273,8 +263,7 @@ namespace Ship {
for (DWORD i = 0; i < fileList.size(); i++) {
auto resource = LoadResourceAsync(fileList.operator[](i).cFileName);
if (std::holds_alternative<std::shared_ptr<Resource>>(resource))
{
if (std::holds_alternative<std::shared_ptr<Resource>>(resource)) {
auto promise = std::make_shared<ResourcePromise>();
promise->bHasResourceLoaded = true;
promise->resource = std::get<std::shared_ptr<Resource>>(resource);
@ -304,8 +293,7 @@ namespace Ship {
return LoadedList;
}
std::shared_ptr<std::vector<std::shared_ptr<Resource>>> ResourceMgr::DirtyDirectory(std::string SearchMask)
{
std::shared_ptr<std::vector<std::shared_ptr<Resource>>> ResourceMgr::DirtyDirectory(const std::string& SearchMask) {
auto PromiseList = CacheDirectoryAsync(SearchMask);
auto LoadedList = std::make_shared<std::vector<std::shared_ptr<Resource>>>();
@ -317,8 +305,9 @@ namespace Ship {
Promise->resourceLoadNotifier.wait(Lock);
}
if (Promise->resource != nullptr)
if (Promise->resource != nullptr) {
Promise->resource->isDirty = true;
}
LoadedList->push_back(Promise->resource);
}
@ -326,8 +315,7 @@ namespace Ship {
return LoadedList;
}
std::shared_ptr<std::vector<std::string>> ResourceMgr::ListFiles(std::string SearchMask)
{
std::shared_ptr<std::vector<std::string>> ResourceMgr::ListFiles(std::string SearchMask) {
auto result = std::make_shared<std::vector<std::string>>();
auto fileList = OTR->ListFiles(SearchMask);

View File

@ -5,26 +5,26 @@
#include <thread>
#include <queue>
#include <variant>
#include "Window.h"
#include "Resource.h"
#include "GlobalCtx2.h"
#include "Archive.h"
#include "File.h"
namespace Ship
{
class Archive;
class File;
namespace Ship {
class Window;
// Resource manager caches any and all files it comes across into memory. This will be unoptimal in the future when modifications have gigabytes of assets.
// It works with the original game's assets because the entire ROM is 64MB and fits into RAM of any semi-modern PC.
class ResourceMgr {
public:
ResourceMgr(std::shared_ptr<GlobalCtx2> Context, const std::string& MainPath, const std::string& PatchesPath);
ResourceMgr(std::shared_ptr<Window> Context, const std::string& MainPath, const std::string& PatchesPath);
~ResourceMgr();
bool IsRunning();
bool DidLoadSuccessfully();
std::shared_ptr<Archive> GetArchive() { return OTR; }
std::shared_ptr<GlobalCtx2> GetContext() { return Context.lock(); }
std::shared_ptr<Window> GetContext() { return Context; }
const std::string* HashToString(uint64_t Hash) const;
@ -34,13 +34,13 @@ namespace Ship
void SetGameVersion(uint32_t newGameVersion);
std::shared_ptr<File> LoadFileAsync(const std::string& FilePath);
std::shared_ptr<File> LoadFile(const std::string& FilePath);
std::shared_ptr<Ship::Resource> GetCachedFile(const char* FilePath) const;
std::shared_ptr<Resource> GetCachedFile(const char* FilePath) const;
std::shared_ptr<Resource> LoadResource(const char* FilePath);
std::shared_ptr<Resource> LoadResource(const std::string& FilePath) { return LoadResource(FilePath.c_str()); }
std::variant<std::shared_ptr<Resource>, std::shared_ptr<ResourcePromise>> LoadResourceAsync(const char* FilePath);
std::shared_ptr<std::vector<std::shared_ptr<Resource>>> CacheDirectory(const std::string& SearchMask);
std::shared_ptr<std::vector<std::shared_ptr<ResourcePromise>>> CacheDirectoryAsync(const std::string& SearchMask);
std::shared_ptr<std::vector<std::shared_ptr<Resource>>> DirtyDirectory(std::string SearchMask);
std::shared_ptr<std::vector<std::shared_ptr<Resource>>> DirtyDirectory(const std::string& SearchMask);
std::shared_ptr<std::vector<std::string>> ListFiles(std::string SearchMask);
protected:
@ -50,7 +50,7 @@ namespace Ship
void LoadResourceThread();
private:
std::weak_ptr<GlobalCtx2> Context;
std::shared_ptr<Window> Context;
volatile bool bIsRunning;
std::unordered_map<std::string, std::shared_ptr<File>> FileCache;
std::unordered_map<std::string, std::shared_ptr<Resource>> ResourceCache;

View File

@ -1,5 +1,5 @@
#include "SDLController.h"
#include "GlobalCtx2.h"
#include "spdlog/spdlog.h"
#include "Window.h"
#include <Utils/StringHelper.h>

View File

@ -1,6 +1,5 @@
#ifdef __WIIU__
#include "WiiUController.h"
#include "GlobalCtx2.h"
#include "Window.h"
#include "ImGuiImpl.h"

View File

@ -1,6 +1,5 @@
#ifdef __WIIU__
#include "WiiUGamepad.h"
#include "GlobalCtx2.h"
#include "ImGuiImpl.h"
#include "WiiUImpl.h"

View File

@ -114,7 +114,7 @@ void Update() {
// rescan devices if connection state changed
if (rescan) {
Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->ScanPhysicalDevices();
Window::GetInstance()->GetControlDeck()->ScanPhysicalDevices();
}
}

View File

@ -1,23 +1,18 @@
#include <string>
#include <chrono>
#include <fstream>
#include <iostream>
#include "Window.h"
#include "spdlog/spdlog.h"
#include "KeyboardController.h"
#include "GlobalCtx2.h"
#include "DisplayList.h"
#include "Vertex.h"
#include "Array.h"
#include "ResourceMgr.h"
#include "KeyboardController.h"
#include "UltraController.h"
#include "DisplayList.h"
#include "Console.h"
#include "Array.h"
#include "Texture.h"
#include "Blob.h"
#include "Matrix.h"
#include "AudioPlayer.h"
#include "Hooks.h"
#include "UltraController.h"
#include <SDL2/SDL.h>
#include <string>
#include <chrono>
#include "Console.h"
#include "ImGuiImpl.h"
#include "PR/ultra64/gbi.h"
#include "Lib/Fast3D/gfx_pc.h"
#include "Lib/Fast3D/gfx_sdl.h"
#include "Lib/Fast3D/gfx_dxgi.h"
@ -27,12 +22,25 @@
#include "Lib/Fast3D/gfx_direct3d12.h"
#include "Lib/Fast3D/gfx_wiiu.h"
#include "Lib/Fast3D/gfx_gx2.h"
#include "Lib/Fast3D/gfx_rendering_api.h"
#include "Lib/Fast3D/gfx_window_manager_api.h"
#include <string>
#include <SDL2/SDL.h>
#include "ImGuiImpl.h"
#include "spdlog/async.h"
#include "spdlog/sinks/rotating_file_sink.h"
#include "spdlog/sinks/stdout_color_sinks.h"
#include "spdlog/sinks/sohconsole_sink.h"
#include "PR/ultra64/gbi.h"
#ifdef __APPLE__
#include "OSXFolderManager.h"
#elif defined(__SWITCH__)
#include "SwitchImpl.h"
#elif defined(__WIIU__)
#include "WiiUImpl.h"
#endif
#include <iostream>
#define LOAD_TEX(texPath) static_cast<Ship::Texture*>(Ship::GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(texPath).get());
#define LOAD_TEX(texPath) static_cast<Ship::Texture*>(Ship::Window::GetInstance()->GetResourceManager()->LoadResource(texPath).get());
extern "C" {
struct OSMesgQueue;
@ -59,7 +67,7 @@ extern "C" {
#endif
#endif
Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->Init(controllerBits);
Ship::Window::GetInstance()->GetControlDeck()->Init(controllerBits);
return 0;
}
@ -78,22 +86,22 @@ extern "C" {
pad->gyro_x = 0;
pad->gyro_y = 0;
if (SohImGui::controller->Opened) return;
if (SohImGui::controller->IsOpened()) return;
Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->WriteToPad(pad);
Ship::Window::GetInstance()->GetControlDeck()->WriteToPad(pad);
Ship::ExecuteHooks<Ship::ControllerRead>(pad);
}
const char* ResourceMgr_GetNameByCRC(uint64_t crc) {
const std::string* hashStr = Ship::GlobalCtx2::GetInstance()->GetResourceManager()->HashToString(crc);
const std::string* hashStr = Ship::Window::GetInstance()->GetResourceManager()->HashToString(crc);
return hashStr != nullptr ? hashStr->c_str() : nullptr;
}
Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc) {
const std::string* hashStr = Ship::GlobalCtx2::GetInstance()->GetResourceManager()->HashToString(crc);
const std::string* hashStr = Ship::Window::GetInstance()->GetResourceManager()->HashToString(crc);
if (hashStr != nullptr) {
auto res = std::static_pointer_cast<Ship::Array>(Ship::GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str()));
auto res = std::static_pointer_cast<Ship::Array>(Ship::Window::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str()));
return (Vtx*)res->vertices.data();
}
@ -101,10 +109,10 @@ extern "C" {
}
int32_t* ResourceMgr_LoadMtxByCRC(uint64_t crc) {
const std::string* hashStr = Ship::GlobalCtx2::GetInstance()->GetResourceManager()->HashToString(crc);
const std::string* hashStr = Ship::Window::GetInstance()->GetResourceManager()->HashToString(crc);
if (hashStr != nullptr) {
auto res = std::static_pointer_cast<Ship::Matrix>(Ship::GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str()));
auto res = std::static_pointer_cast<Ship::Matrix>(Ship::Window::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str()));
return (int32_t*)res->mtx.data();
}
@ -112,10 +120,10 @@ extern "C" {
}
Gfx* ResourceMgr_LoadGfxByCRC(uint64_t crc) {
const std::string* hashStr = Ship::GlobalCtx2::GetInstance()->GetResourceManager()->HashToString(crc);
const std::string* hashStr = Ship::Window::GetInstance()->GetResourceManager()->HashToString(crc);
if (hashStr != nullptr) {
auto res = std::static_pointer_cast<Ship::DisplayList>(Ship::GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str()));
auto res = std::static_pointer_cast<Ship::DisplayList>(Ship::Window::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str()));
return (Gfx*)&res->instructions[0];
} else {
return nullptr;
@ -123,7 +131,7 @@ extern "C" {
}
char* ResourceMgr_LoadTexByCRC(uint64_t crc) {
const std::string* hashStr = Ship::GlobalCtx2::GetInstance()->GetResourceManager()->HashToString(crc);
const std::string* hashStr = Ship::Window::GetInstance()->GetResourceManager()->HashToString(crc);
if (hashStr != nullptr) {
const auto res = LOAD_TEX(hashStr->c_str());
@ -137,11 +145,11 @@ extern "C" {
void ResourceMgr_RegisterResourcePatch(uint64_t hash, uint32_t instrIndex, uintptr_t origData)
{
const std::string* hashStr = Ship::GlobalCtx2::GetInstance()->GetResourceManager()->HashToString(hash);
const std::string* hashStr = Ship::Window::GetInstance()->GetResourceManager()->HashToString(hash);
if (hashStr != nullptr)
{
auto res = (Ship::Texture*)Ship::GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str()).get();
auto res = (Ship::Texture*)Ship::Window::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str()).get();
Ship::Patch patch;
patch.crc = hash;
@ -201,7 +209,7 @@ extern "C" {
}
char* ResourceMgr_LoadBlobByName(char* blobPath) {
auto res = (Ship::Blob*)Ship::GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(blobPath).get();
auto res = (Ship::Blob*)Ship::Window::GetInstance()->GetResourceManager()->LoadResource(blobPath).get();
return (char*)res->data.data();
}
@ -217,7 +225,26 @@ extern "C" {
namespace Ship {
Window::Window(std::shared_ptr<GlobalCtx2> Context) : Context(Context), APlayer(nullptr), ControllerApi(nullptr) {
std::weak_ptr<Window> Window::Context;
std::shared_ptr<Window> Window::GetInstance() {
return Context.lock();
}
std::shared_ptr<Window> Window::CreateInstance(const std::string Name) {
if (Context.expired()) {
auto Shared = std::make_shared<Window>(Name);
Context = Shared;
Shared->Initialize();
return Shared;
}
SPDLOG_DEBUG("Trying to create a context when it already exists. Returning existing.");
return GetInstance();
}
Window::Window(std::string Name) : Name(std::move(Name)), APlayer(nullptr), ControllerApi(nullptr), ResMan(nullptr), Logger(nullptr), Config(nullptr) {
WmApi = nullptr;
RenderingApi = nullptr;
bIsFullscreen = false;
@ -226,77 +253,91 @@ namespace Ship {
}
Window::~Window() {
SPDLOG_INFO("destruct window");
SPDLOG_DEBUG("destruct window");
}
void Window::CreateDefaults() {
const std::shared_ptr<Mercury> pConf = GlobalCtx2::GetInstance()->GetConfig();
if (pConf->isNewInstance) {
pConf->setInt("Window.Width", 640);
pConf->setInt("Window.Height", 480);
pConf->setBool("Window.Options", false);
pConf->setString("Window.GfxBackend", "");
if (GetConfig()->isNewInstance) {
GetConfig()->setInt("Window.Width", 640);
GetConfig()->setInt("Window.Height", 480);
GetConfig()->setBool("Window.Options", false);
GetConfig()->setString("Window.GfxBackend", "");
pConf->setBool("Window.Fullscreen.Enabled", false);
pConf->setInt("Window.Fullscreen.Width", 1920);
pConf->setInt("Window.Fullscreen.Height", 1080);
GetConfig()->setBool("Window.Fullscreen.Enabled", false);
GetConfig()->setInt("Window.Fullscreen.Width", 1920);
GetConfig()->setInt("Window.Fullscreen.Height", 1080);
pConf->setString("Game.SaveName", "");
pConf->setString("Game.Main Archive", "");
pConf->setString("Game.Patches Archive", "");
GetConfig()->setString("Game.SaveName", "");
GetConfig()->setString("Game.Main Archive", "");
GetConfig()->setString("Game.Patches Archive", "");
pConf->setInt("Shortcuts.Fullscreen", 0x044);
pConf->setInt("Shortcuts.Console", 0x029);
pConf->save();
GetConfig()->setInt("Shortcuts.Fullscreen", 0x044);
GetConfig()->setInt("Shortcuts.Console", 0x029);
GetConfig()->save();
}
}
void Window::Init() {
std::shared_ptr<Mercury> pConf = GlobalCtx2::GetInstance()->GetConfig();
void Window::Initialize() {
InitializeLogging();
InitializeConfiguration();
InitializeResourceManager();
CreateDefaults();
InitializeAudioPlayer();
InitializeControlDeck();
bIsFullscreen = pConf->getBool("Window.Fullscreen.Enabled", false);
bIsFullscreen = GetConfig()->getBool("Window.Fullscreen.Enabled", false);
if (bIsFullscreen) {
dwWidth = pConf->getInt("Window.Fullscreen.Width", 1920);
dwHeight = pConf->getInt("Window.Fullscreen.Height", 1080);
dwWidth = GetConfig()->getInt("Window.Fullscreen.Width", 1920);
dwHeight = GetConfig()->getInt("Window.Fullscreen.Height", 1080);
} else {
dwWidth = pConf->getInt("Window.Width", 640);
dwHeight = pConf->getInt("Window.Height", 480);
dwWidth = GetConfig()->getInt("Window.Width", 640);
dwHeight = GetConfig()->getInt("Window.Height", 480);
}
dwMenubar = pConf->getBool("Window.Options", false);
gfxBackend = pConf->getString("Window.GfxBackend");
dwMenubar = GetConfig()->getBool("Window.Options", false);
const std::string& gfx_backend = GetConfig()->getString("Window.GfxBackend");
InitializeWindowManager();
gfx_init(WmApi, RenderingApi, GetContext()->GetName().c_str(), bIsFullscreen, dwWidth, dwHeight);
gfx_init(WmApi, RenderingApi, GetName().c_str(), bIsFullscreen, dwWidth, dwHeight);
WmApi->set_fullscreen_changed_callback(OnFullscreenChanged);
WmApi->set_keyboard_callbacks(KeyDown, KeyUp, AllKeysUp);
Ship::RegisterHook<Ship::ExitGame>([this]() {
Ship::RegisterHook<ExitGame>([this]() {
ControllerApi->SaveControllerSettings();
});
}
std::string Window::GetAppDirectoryPath() {
#ifdef __APPLE__
FolderManager folderManager;
std::string fpath = std::string(folderManager.pathForDirectory(NSApplicationSupportDirectory, NSUserDomainMask));
fpath.append("/com.shipofharkinian.soh");
return fpath;
#endif
#ifdef __linux__
char* fpath = std::getenv("SHIP_HOME");
if (fpath != NULL)
return std::string(fpath);
#endif
return ".";
}
std::string Window::GetPathRelativeToAppDirectory(const char* path) {
return GetAppDirectoryPath() + "/" + path;
}
void Window::StartFrame() {
gfx_start_frame();
}
void Window::RunCommands(Gfx* Commands, const std::vector<std::unordered_map<Mtx*, MtxF>>& mtx_replacements) {
for (const auto& m : mtx_replacements) {
gfx_run(Commands, m);
gfx_end_frame();
}
}
void Window::SetTargetFps(int fps) {
void Window::SetTargetFps(int32_t fps) {
gfx_set_target_fps(fps);
}
void Window::SetMaximumFrameLatency(int latency) {
void Window::SetMaximumFrameLatency(int32_t latency) {
gfx_set_maximum_frame_latency(latency);
}
@ -329,17 +370,17 @@ namespace Ship {
void Window::MainLoop(void (*MainFunction)(void)) {
WmApi->main_loop(MainFunction);
}
bool Window::KeyUp(int32_t dwScancode) {
std::shared_ptr<Mercury> pConf = GlobalCtx2::GetInstance()->GetConfig();
if (dwScancode == pConf->getInt("Shortcuts.Fullscreen", 0x044)) {
GlobalCtx2::GetInstance()->GetWindow()->ToggleFullscreen();
bool Window::KeyUp(int32_t dwScancode) {
if (dwScancode == GetInstance()->GetConfig()->getInt("Shortcuts.Fullscreen", 0x044)) {
GetInstance()->ToggleFullscreen();
}
GlobalCtx2::GetInstance()->GetWindow()->SetLastScancode(-1);
GetInstance()->SetLastScancode(-1);
bool bIsProcessed = false;
auto controlDeck = GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck();
auto controlDeck = GetInstance()->GetControlDeck();
const auto pad = dynamic_cast<KeyboardController*>(controlDeck->GetPhysicalDevice(controlDeck->GetNumPhysicalDevices() - 2).get());
if (pad != nullptr) {
if (pad->ReleaseButton(dwScancode)) {
@ -352,7 +393,7 @@ namespace Ship {
bool Window::KeyDown(int32_t dwScancode) {
bool bIsProcessed = false;
auto controlDeck = GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck();
auto controlDeck = GetInstance()->GetControlDeck();
const auto pad = dynamic_cast<KeyboardController*>(controlDeck->GetPhysicalDevice(controlDeck->GetNumPhysicalDevices() - 2).get());
if (pad != nullptr) {
if (pad->PressButton(dwScancode)) {
@ -360,14 +401,14 @@ namespace Ship {
}
}
GlobalCtx2::GetInstance()->GetWindow()->SetLastScancode(dwScancode);
GetInstance()->SetLastScancode(dwScancode);
return bIsProcessed;
}
void Window::AllKeysUp(void) {
auto controlDeck = GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck();
auto controlDeck = Window::GetInstance()->GetControlDeck();
const auto pad = dynamic_cast<KeyboardController*>(controlDeck->GetPhysicalDevice(controlDeck->GetNumPhysicalDevices() - 2).get());
if (pad != nullptr) {
pad->ReleaseAllButtons();
@ -375,15 +416,13 @@ namespace Ship {
}
void Window::OnFullscreenChanged(bool bIsFullscreen) {
std::shared_ptr<Mercury> pConf = GlobalCtx2::GetInstance()->GetConfig();
std::shared_ptr<Mercury> pConf = Window::GetInstance()->GetConfig();
GlobalCtx2::GetInstance()->GetWindow()->bIsFullscreen = bIsFullscreen;
Window::GetInstance()->bIsFullscreen = bIsFullscreen;
pConf->setBool("Window.Fullscreen.Enabled", bIsFullscreen);
GlobalCtx2::GetInstance()->GetWindow()->ShowCursor(!bIsFullscreen);
Window::GetInstance()->ShowCursor(!bIsFullscreen);
}
uint32_t Window::GetCurrentWidth() {
WmApi->get_dimensions(&dwWidth, &dwHeight);
return dwWidth;
@ -453,4 +492,93 @@ namespace Ship {
void Window::InitializeControlDeck() {
ControllerApi = std::make_shared<ControlDeck>();
}
void Window::InitializeLogging() {
try {
// Setup Logging
spdlog::init_thread_pool(8192, 1);
std::vector<spdlog::sink_ptr> Sinks;
auto SohConsoleSink = std::make_shared<spdlog::sinks::soh_sink_mt>();
SohConsoleSink->set_level(spdlog::level::trace);
Sinks.push_back(SohConsoleSink);
#if (!defined(_WIN32) && !defined(__WIIU__)) || defined(_DEBUG)
auto ConsoleSink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
ConsoleSink->set_level(spdlog::level::trace);
Sinks.push_back(ConsoleSink);
#endif
#ifndef __WIIU__
auto logPath = GetPathRelativeToAppDirectory(("logs/" + GetName() + ".log").c_str());
auto FileSink = std::make_shared<spdlog::sinks::rotating_file_sink_mt>(logPath, 1024 * 1024 * 10, 10);
FileSink->set_level(spdlog::level::trace);
Sinks.push_back(FileSink);
#endif
Logger = std::make_shared<spdlog::async_logger>(GetName(), Sinks.begin(), Sinks.end(), spdlog::thread_pool(), spdlog::async_overflow_policy::block);
GetLogger()->set_level(spdlog::level::trace);
#ifndef __WIIU__
GetLogger()->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%@] [%l] %v");
#else
GetLogger()->set_pattern("[%s:%#] [%l] %v");
#endif
spdlog::register_logger(GetLogger());
spdlog::set_default_logger(GetLogger());
}
catch (const spdlog::spdlog_ex& ex) {
std::cout << "Log initialization failed: " << ex.what() << std::endl;
}
}
void Window::InitializeResourceManager() {
MainPath = Config->getString("Game.Main Archive", GetPathRelativeToAppDirectory("oot.otr"));
PatchesPath = Config->getString("Game.Patches Archive", GetAppDirectoryPath() + "/mods");
ResMan = std::make_shared<ResourceMgr>(GetInstance(), MainPath, PatchesPath);
if (!ResMan->DidLoadSuccessfully())
{
#ifdef _WIN32
MessageBox(nullptr, L"Main OTR file not found!", L"Uh oh", MB_OK);
#elif defined(__SWITCH__)
printf("Main OTR file not found!\n");
#elif defined(__WIIU__)
Ship::WiiU::ThrowMissingOTR(MainPath.c_str());
#else
SPDLOG_ERROR("Main OTR file not found!");
#endif
exit(1);
}
#ifdef __SWITCH__
Ship::Switch::Init(PostInitPhase);
#endif
}
void Window::InitializeConfiguration() {
Config = std::make_shared<Mercury>(GetPathRelativeToAppDirectory("shipofharkinian.json"));
}
void Window::WriteSaveFile(const std::filesystem::path& savePath, const uintptr_t addr, void* dramAddr, const size_t size) {
std::ofstream saveFile = std::ofstream(savePath, std::fstream::in | std::fstream::out | std::fstream::binary);
saveFile.seekp(addr);
saveFile.write((char*)dramAddr, size);
saveFile.close();
}
void Window::ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, void* dramAddr, size_t size) {
std::ifstream saveFile = std::ifstream(savePath, std::fstream::in | std::fstream::out | std::fstream::binary);
// If the file doesn't exist, initialize DRAM
if (saveFile.good()) {
saveFile.seekg(addr);
saveFile.read((char*)dramAddr, size);
}
else {
memset(dramAddr, 0, size);
}
saveFile.close();
}
}

View File

@ -1,27 +1,36 @@
#pragma once
#include <memory>
#include "PR/ultra64/gbi.h"
#include "Lib/Fast3D/gfx_pc.h"
#include "Controller.h"
#include "GlobalCtx2.h"
#include "ControlDeck.h"
#include <memory>
#include <filesystem>
#include "spdlog/spdlog.h"
#include "ControlDeck.h"
#include "AudioPlayer.h"
#include "Lib/Fast3D/gfx_window_manager_api.h"
#include "Lib/Mercury/Mercury.h"
struct GfxRenderingAPI;
struct GfxWindowManagerAPI;
namespace Ship {
class AudioPlayer;
class ResourceMgr;
class Window {
public:
Window(std::shared_ptr<GlobalCtx2> Context);
static std::shared_ptr<Window> GetInstance();
static std::shared_ptr<Window> CreateInstance(const std::string Name);
static std::string GetAppDirectoryPath();
static std::string GetPathRelativeToAppDirectory(const char* path);
Window(std::string Name);
~Window();
void WriteSaveFile(const std::filesystem::path& savePath, uintptr_t addr, void* dramAddr, size_t size);
void ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, void* dramAddr, size_t size);
void CreateDefaults();
void MainLoop(void (*MainFunction)(void));
void Init();
void Initialize();
void StartFrame();
void RunCommands(Gfx* Commands, const std::vector<std::unordered_map<Mtx*, MtxF>>& mtx_replacements);
void SetTargetFps(int fps);
void SetMaximumFrameLatency(int latency);
void SetTargetFps(int32_t fps);
void SetMaximumFrameLatency(int32_t latency);
void GetPixelDepthPrepare(float x, float y);
uint16_t GetPixelDepth(float x, float y);
void ToggleFullscreen();
@ -32,29 +41,39 @@ namespace Ship {
uint32_t GetCurrentHeight();
uint32_t GetMenuBar() { return dwMenubar; }
void SetMenuBar(uint32_t dwMenuBar) { this->dwMenubar = dwMenuBar; }
std::string GetName() { return Name; }
std::shared_ptr<ControlDeck> GetControlDeck() { return ControllerApi; };
std::shared_ptr<GlobalCtx2> GetContext() { return Context.lock(); }
std::shared_ptr<AudioPlayer> GetAudioPlayer() { return APlayer; }
const char* GetKeyName(int scancode) { return WmApi->get_key_name(scancode); }
int32_t GetLastScancode() { return lastScancode; };
void SetLastScancode(int32_t scanCode) { lastScancode = scanCode; };
std::shared_ptr<ResourceMgr> GetResourceManager() { return ResMan; }
std::shared_ptr<Mercury> GetConfig() { return Config; }
std::shared_ptr<spdlog::logger> GetLogger() { return Logger; }
const char* GetKeyName(int32_t scancode) { return WmApi->get_key_name(scancode); }
int32_t GetLastScancode() { return lastScancode; }
void SetLastScancode(int32_t scanCode) { lastScancode = scanCode; }
protected:
Window() = default;
private:
static bool KeyDown(int32_t dwScancode);
static bool KeyUp(int32_t dwScancode);
static void AllKeysUp(void);
static void OnFullscreenChanged(bool bIsNowFullscreen);
static std::weak_ptr<Window> Context;
void InitializeConfiguration();
void InitializeControlDeck();
void InitializeAudioPlayer();
void InitializeLogging();
void InitializeResourceManager();
void InitializeWindowManager();
std::weak_ptr<GlobalCtx2> Context;
std::shared_ptr<spdlog::logger> Logger;
std::shared_ptr<Mercury> Config; // Config needs to be after the Window because we call the Window during it's destructor.
std::shared_ptr<ResourceMgr> ResMan;
std::shared_ptr<AudioPlayer> APlayer;
std::shared_ptr<ControlDeck> ControllerApi;
std::string gfxBackend;
std::string gfxBackend;
GfxRenderingAPI* RenderingApi;
GfxWindowManagerAPI* WmApi;
bool bIsFullscreen;
@ -62,5 +81,8 @@ namespace Ship {
uint32_t dwHeight;
uint32_t dwMenubar;
int32_t lastScancode;
std::string Name;
std::string MainPath;
std::string PatchesPath;
};
}

View File

@ -5,14 +5,18 @@ export PATH="$HERE"/bin:"$HERE"/usr/bin:"$PATH"
export LD_LIBRARY_PATH="$HERE"/usr/lib:"$LD_LIBRARY_PATH"
export ZENITY=$(command -v zenity)
while [[ ! -e "$PWD"/oot.otr ]]; do
if [ -z ${SHIP_HOME+x} ]; then
export SHIP_HOME=$PWD
fi
while [[ ! -e "$SHIP_HOME"/oot.otr ]]; do
export ASSETDIR="$(mktemp -d /tmp/assets-XXXXX)"
ln -s "$HERE"/usr/bin/{assets,soh.elf,OTRGui} "$ASSETDIR"
export OLDPWD="$PWD"
mkdir -p "$ASSETDIR"/tmp
mkdir -p "$ASSETDIR"/Extract/assets
if [ -e "$PWD"/*.*64 ]; then
ln -s "$OLDPWD"/*.*64 "$ASSETDIR"/tmp/rom.z64
if [ -e "$SHIP_HOME"/*.*64 ]; then
ln -s "$SHIP_HOME"/*.*64 "$ASSETDIR"/tmp/rom.z64
cp -r "$ASSETDIR"/assets/game/ship_of_harkinian "$ASSETDIR"/Extract/assets/
cd "$ASSETDIR"
ROMHASH=$(sha1sum -b "$ASSETDIR"/tmp/rom.z64 | awk '{ print $1 }')
@ -36,22 +40,19 @@ while [[ ! -e "$PWD"/oot.otr ]]; do
echo "Processing..."
fi
assets/extractor/ZAPD.out ed -eh -i assets/extractor/xmls/"${ROM}" -b tmp/rom.z64 -fl assets/extractor/filelists -o placeholder -osf placeholder -gsf 1 -rconf assets/extractor/Config_"${ROM}".xml -se OTR > /dev/null 2>&1
cp "$ASSETDIR"/oot.otr "$OLDPWD"
cp "$ASSETDIR"/oot.otr "$SHIP_HOME"
echo "Restart $APPIMAGE to play!"
sleep 3
rm -r "$ASSETDIR"
break
else
if [ -n "$ZENITY" ]; then
zenity --error --timeout=5 --text="Place ROM in $OWD" --title="Missing ROM file" --width=500 --width=200
zenity --error --timeout=5 --text="Place ROM in $SHIP_HOME" --title="Missing ROM file" --width=500 --width=200
else
echo -e "\nPlace ROM in this folder\n"
fi
exit
fi
done
cd "$OWD"
ln -s "$HERE"/usr/bin/gamecontrollerdb.txt "$PWD"
"$HERE"/usr/bin/soh.elf
unlink "$PWD"/gamecontrollerdb.txt
(cd "$HERE/usr/bin"; ./soh.elf)
exit

View File

@ -1758,15 +1758,15 @@ if(MSVC)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/sdl-;
/w
/w;
/Od
>
$<$<CONFIG:Release>:
/Oi;
/sdl-;
/Gy;
/W3
>
/sdl-;
/permissive-;
/MP;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
@ -2003,14 +2003,6 @@ elseif(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "NintendoSwitch|CafeOS")
INSTALL(FILES ${CMAKE_BINARY_DIR}/gamecontrollerdb.txt DESTINATION . COMPONENT ship)
endif()
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
install(CODE "
include(InstallRequiredSystemLibraries)
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/soh-macos\" \"\" \"${dirs}\")
")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS")
if (NOT TARGET pathconf)
add_library(pathconf OBJECT platform/pathconf.c)

View File

@ -271,7 +271,8 @@ typedef enum {
/* 0x16 */ ITEM00_SHIELD_HYLIAN,
/* 0x17 */ ITEM00_TUNIC_ZORA,
/* 0x18 */ ITEM00_TUNIC_GORON,
/* 0x19 */ ITEM00_BOMBS_SPECIAL
/* 0x19 */ ITEM00_BOMBS_SPECIAL,
/* 0x20 */ ITEM00_BOMBCHU,
} Item00Type;
struct EnItem00;

View File

@ -359,7 +359,7 @@ typedef struct {
/* 0x00 */ s32 active;
/* 0x04 */ Vec3f tip;
/* 0x10 */ Vec3f base;
} WeaponInfo; // size = 0x1C\
} WeaponInfo; // size = 0x1C
typedef enum {
FLAG_NONE,

View File

@ -25,6 +25,7 @@ void BootCommands_Init()
CVar_RegisterS32("gDebugEnabled", 0);
CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French
CVar_RegisterS32("gHudColors", 1); //0 = N64 / 1 = NGC / 2 = Custom
CVar_RegisterS32("gInvertYAxis", 1);
#if defined(__SWITCH__) || defined(__WIIU__)
CVar_RegisterS32("gControlNav", 1); // always enable controller nav on switch/wii u
#endif

View File

@ -216,7 +216,27 @@ namespace GameControlEditor {
ImGui::EndTable();
}
void DrawUI(bool& open) {
void DrawCameraControlPanel() {
if (!ImGui::CollapsingHeader("Camera Controls")) {
return;
}
ImVec2 cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
SohImGui::PaddedEnhancementCheckbox("Invert Camera X Axis", "gInvertXAxis");
SohImGui::Tooltip("Inverts the Camera X Axis in:\n-Free camera\n-C-Up view\n-Weapon Aiming");
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
SohImGui::PaddedEnhancementCheckbox("Invert Camera Y Axis", "gInvertYAxis");
SohImGui::Tooltip("Inverts the Camera Y Axis in:\n-Free camera\n-C-Up view\n-Weapon Aiming");
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
SohImGui::PaddedEnhancementCheckbox("Right Stick Aiming", "gRightStickAiming");
SohImGui::Tooltip("Allows for aiming with the rights stick when:\n-Aiming in the C-Up view\n-Aiming with weapons");
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
SohImGui::PaddedEnhancementCheckbox("Auto-Center First Person View", "gAutoCenterView");
SohImGui::Tooltip("Prevents the C-Up view from auto-centering, allowing for Gyro Aiming");
}
void DrawUI(bool& open) {
if (!open) {
CVar_SetS32("gGameControlEditorEnabled", false);
return;
@ -225,6 +245,7 @@ namespace GameControlEditor {
ImGui::SetNextWindowSize(ImVec2(465, 430), ImGuiCond_FirstUseEver);
if (ImGui::Begin("Game Controls Configuration", &open)) {
DrawOcarinaControlPanel();
DrawCameraControlPanel();
}
ImGui::End();
}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,407 @@
#pragma once
#include "../libultraship/ImGuiImpl.h"
#define SECTION_SIZE(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
#define RANDOMIZE_32(Max) GetRandomValue(Max);
#define CATEGORY_NPC 0
#define CATEGORY_ITEMS 1
#define CATEGORY_MENU 2
#define CATEGORY_HUD 3
#define CATEGORY_MISC 4
typedef struct {
const std::string Name;
const std::string ToolTip;
const std::string CvarName;
ImVec4 ModifiedColor;
ImVec4 DefaultColor;
bool canRainbow;
bool hasAlpha;
bool sameLine;
} CosmeticsColorIndividual;
typedef struct {
CosmeticsColorIndividual* Element;
bool Nextcol;
bool NextLine;
} CosmeticsColorSection;
static float TablesCellsWidth = 300.0f;
static ImGuiTableColumnFlags FlagsTable = ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV;
static ImGuiTableColumnFlags FlagsCell = ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort;
static ImVec4 hearts_colors; static ImVec4 hearts_dd_colors; static ImVec4 hearts_ddi_colors;
static ImVec4 a_btn_colors; static ImVec4 b_btn_colors; static ImVec4 c_btn_colors; static ImVec4 start_btn_colors;
static ImVec4 c_btn_u_colors; static ImVec4 c_btn_l_colors; static ImVec4 c_btn_d_colors; static ImVec4 c_btn_r_colors;
static ImVec4 magic_border_colors; static ImVec4 magic_remaining_colors; static ImVec4 magic_use_colors;
static ImVec4 minimap_colors; static ImVec4 dgn_minimap_colors;
static ImVec4 cp_minimap_colors; static ImVec4 le_minimap_colors;
static ImVec4 rupee_colors; static ImVec4 smolekey_colors; static ImVec4 magic_bordern_colors;
static ImVec4 fileselect_colors; static ImVec4 fileselect_text_colors;
static ImVec4 kokiri_col; static ImVec4 goron_col; static ImVec4 zora_col;
static ImVec4 navi_idle_i_col; static ImVec4 navi_idle_o_col;
static ImVec4 navi_npc_i_col; static ImVec4 navi_npc_o_col;
static ImVec4 navi_enemy_i_col; static ImVec4 navi_enemy_o_col;
static ImVec4 navi_prop_i_col; static ImVec4 navi_prop_o_col;
static ImVec4 trailscol;
static ImVec4 crtfilter;
static ImVec4 firearrow_col; static ImVec4 icearrow_col; static ImVec4 lightarrow_col;
static ImVec4 firearrow_colenv; static ImVec4 icearrow_colenv; static ImVec4 lightarrow_colenv;
static ImVec4 charged1_col; static ImVec4 charged2_col;
static ImVec4 charged1_colenv; static ImVec4 charged2_colenv;
static ImVec4 Keese1_primcol; static ImVec4 Keese2_primcol;
static ImVec4 Keese1_envcol; static ImVec4 Keese2_envcol;
static ImVec4 doggo1col; static ImVec4 doggo2col;
static ImVec4 df_col; static ImVec4 df_colenv;
static ImVec4 nl_diam_col; static ImVec4 nl_diam_colenv;
static ImVec4 nl_orb_col; static ImVec4 nl_orb_colenv;
static ImVec4 tc_ou_colors; static ImVec4 tc_bu_colors;
static ImVec4 dpad_colors;
static ImVec4 visualagony_colors;
static ImVec4 tc_fire_colors; static ImVec4 tc_fire_colors_env;
/*ImVec4 menu_equips_colors;
ImVec4 menu_items_colors;
ImVec4 menu_map_colors;
ImVec4 menu_quest_colors;
ImVec4 menu_save_colors;
ImVec4 menu_gameover_colors;*/
//Navi
static CosmeticsColorIndividual Navi_Idle_Inner = { "Navi Idle (Primary)", "Inner color for Navi (idle flying around)", "gNavi_Idle_Inner_", navi_idle_i_col, ImVec4(255, 255, 255, 255), false, false, false };
static CosmeticsColorIndividual Navi_Idle_Outer = { "Navi Idle (Secondary)", "Outer color for Navi (idle flying around)", "gNavi_Idle_Outer_", navi_idle_o_col, ImVec4(0, 0, 255, 255), false, false, false };
static CosmeticsColorIndividual Navi_Npc_Inner = { "Navi NPC (Primary)", "Inner color for Navi (when Navi fly around NPCs)", "gNavi_NPC_Inner_", navi_npc_i_col, ImVec4(150, 150, 255, 255), false, false, false };
static CosmeticsColorIndividual Navi_Npc_Outer = { "Navi NPC (Secondary)", "Outer color for Navi (when Navi fly around NPCs)", "gNavi_NPC_Outer_", navi_npc_o_col, ImVec4(150, 150, 255, 255), false, false, false };
static CosmeticsColorIndividual Navi_Enemy_Inner = { "Navi Enemy (Primary)", "Inner color for Navi (when Navi fly around Enemies or Bosses)", "gNavi_Enemy_Inner_", navi_enemy_i_col, ImVec4(255, 255, 0, 255), false, false, false };
static CosmeticsColorIndividual Navi_Enemy_Outer = { "Navi Enemy (Secondary)", "Outer color for Navi (when Navi fly around Enemies or Bosses)", "gNavi_Enemy_Outer_", navi_enemy_o_col, ImVec4(220, 155, 0, 255), false, false, false };
static CosmeticsColorIndividual Navi_Prop_Inner = { "Navi Enemy (Primary)", "Inner color for Navi (when Navi fly around props (signs etc))", "gNavi_Prop_Inner_", navi_prop_i_col, ImVec4(0, 255, 0, 255), false, false, false };
static CosmeticsColorIndividual Navi_Prop_Outer = { "Navi Enemy (Secondary)", "Outer color for Navi (when Navi fly around props (signs etc))", "gNavi_Prop_Outer_", navi_prop_o_col, ImVec4(0, 255, 0, 255), false, false, false };
//Keese
static CosmeticsColorIndividual Keese1_prim = { "Fire Primary color", "Affects the primary color of the Fire itself of the Keese", "gKeese1_Ef_Prim", Keese1_primcol, ImVec4(255, 255, 100, 255), true, false, false };
static CosmeticsColorIndividual Keese2_prim = { "Ice Primary color", "Affects the primary color of the Ice itself of the Keese", "gKeese2_Ef_Prim", Keese2_primcol, ImVec4(100, 200, 255, 255), true, false, false };
static CosmeticsColorIndividual Keese1_env = { "Fire Secondary color", "Affects the secondary color of the Fire itself of the Keese", "gKeese1_Ef_Env", Keese1_envcol, ImVec4(255, 50, 0, 255), true, false, false };
static CosmeticsColorIndividual Keese2_env = { "Ice Secondary color", "Affects the secondary color of the Ice itself of the Keese", "gKeese2_Ef_Env", Keese2_envcol, ImVec4(0, 0, 255, 255), true, false, false };
//Good old Dogs, we all love them
static CosmeticsColorIndividual DogN1 = { "Dog white", "Affects the colors of the white dog", "gDog1Col", doggo1col, ImVec4(255,255,200,255), true, false, true };
static CosmeticsColorIndividual DogN2 = { "Dog brown", "Affects the colors of the brown dog", "gDog2Col", doggo2col, ImVec4(150,100,50,255), true, false, true };
//Tunics colors
static CosmeticsColorIndividual KokiriTunic = { "Kokiri Tunic", "Affects Kokiri Tunic color", "gTunic_Kokiri", kokiri_col, ImVec4(30, 105, 27, 255), true, false, true };
static CosmeticsColorIndividual GoronTunic = { "Goron Tunic", "Affects Goron Tunic color", "gTunic_Goron", goron_col, ImVec4(100, 20, 0, 255), true, false, true };
static CosmeticsColorIndividual ZoraTunic = { "Zora Tunic", "Affects Zora Tunic color", "gTunic_Zora", zora_col, ImVec4(0, 60, 100, 255), true, false, true };
//Arrows (Fire -> Ice -> Light)
static CosmeticsColorIndividual Fire_Arrow_Prim = { "Fire Arrows (primary)", "Affects Primary color", "gFireArrowCol", firearrow_col, ImVec4(255,200,0,255), true, false, false };
static CosmeticsColorIndividual Fire_Arrow_Env = { "Fire Arrows (Secondary)", "Affects Secondary color", "gFireArrowColEnv", firearrow_colenv, ImVec4(255,0,0,255), true, false, false };
static CosmeticsColorIndividual Ice_Arrow_Prim = { "Ice Arrows (Primary)", "Affects Primary color", "gIceArrowCol", icearrow_col, ImVec4(170,255,255,255), true, false, false };
static CosmeticsColorIndividual Ice_Arrow_Env = { "Ice Arrows (Secondary)", "Affects Secondary color", "gIceArrowColEnv", icearrow_colenv, ImVec4(0,0,255,255), true, false, false };
static CosmeticsColorIndividual Light_Arrow_Prim = { "Light Arrows (Primary)", "Affects Primary color", "gLightArrowCol", lightarrow_col, ImVec4(255,255,170,255), true, false, false };
static CosmeticsColorIndividual Light_Arrow_Env = { "Light Arrows (Secondary)", "Affects Secondary color", "gLightArrowColEnv", lightarrow_colenv, ImVec4(255,255,0,255), true, false, false };
//Spells
static CosmeticsColorIndividual Din_Fire_Prim = { "Din's Fire (primary)", "Affects Primary color", "gDF_Col", df_col, ImVec4(255,200,0,255), true, false, false };
static CosmeticsColorIndividual Din_Fire_Env = { "Din's Fire (Secondary)", "Affects Secondary color", "gDF_Env", df_colenv, ImVec4(255,0,0,255), true, false, false };
static CosmeticsColorIndividual Nayru_Diamond_Prim = { "Nayru's Love Diamond (primary)", "Affects Primary color", "gNL_Diamond_Col", nl_diam_col, ImVec4(170,255,255,255), true, false, false };
static CosmeticsColorIndividual Nayru_Diamond_Env = { "Nayru's Love Diamond (Secondary)", "Affects Secondary color", "gNL_Diamond_Env", nl_diam_colenv, ImVec4(100,255,128,255), true, false, false };
static CosmeticsColorIndividual Nayru_Orb_Prim = { "Nayru's Love Orb (primary)", "Affects Primary color", "gNL_Orb_Col", nl_orb_col, ImVec4(170,255,255,255), true, false, false };
static CosmeticsColorIndividual Nayru_Orb_Env = { "Nayru's Love Orb (Secondary)", "Affects Secondary color", "gNL_Orb_Env", nl_orb_colenv, ImVec4(150,255,255,255), true, false, false };
//Spin attacks colors
static CosmeticsColorIndividual Spin_Lv1_Prim = { "Level 1 (primary)", "Affects Primary color", "gCharged1Col", charged1_col, ImVec4(170,255,255,255), true, false, false };
static CosmeticsColorIndividual Spin_Lv1_Env = { "Level 1 (Secondary)", "Affects Secondary color", "gCharged1ColEnv", charged1_colenv, ImVec4(0,100,255,255), true, false, false };
static CosmeticsColorIndividual Spin_Lv2_Prim = { "Level 2 (primary)", "Affects Primary color", "gCharged2Col", charged2_col, ImVec4(255,255,170,255), true, false, false };
static CosmeticsColorIndividual Spin_Lv2_Env = { "Level 2 (Secondary)", "Affects Secondary color", "gCharged2ColEnv", charged2_colenv, ImVec4(255,100,0,255), true, false, false };
//Trails
static CosmeticsColorIndividual Trails_col = { "Trails color", "Affects Swords slash, boomerang and Bombchu trails color", "gTrailCol", trailscol, ImVec4(255,255,255,255), true, false, false };
//Menus - File Choose
static CosmeticsColorIndividual FileChoose_Background = { "Main menu color", "Affects the File Select menu background.", "gCCFileChoosePrim", fileselect_colors, ImVec4(100, 150, 255, 255), true, false, false };
static CosmeticsColorIndividual FileChoose_BottomText = { "Bottom texts color", "Affects the File Select texts.", "gCCFileChooseTextPrim", fileselect_text_colors, ImVec4(100, 255, 255, 255), true, false, false };
//Hud Stuff (Dpad, Buttons etc)
static CosmeticsColorIndividual A_Btn = { "A Button", "Affects the A button colors (and various cursors that use the same theme)", "gCCABtnPrim", a_btn_colors, ImVec4(0, 200, 50, 255), true, false, false };
static CosmeticsColorIndividual B_Btn = { "B Button", "Affects the B button color", "gCCBBtnPrim", b_btn_colors, ImVec4(255, 30, 30, 255), true, false, false };
static CosmeticsColorIndividual C_Btn = { "C-Buttons", "Affects the C Buttons' color (if not using separate colors)\nAnd various cursor that use C-Buttons colors", "gCCCBtnPrim", c_btn_colors, ImVec4(255, 160, 0, 255), true, false, false };
static CosmeticsColorIndividual C_Btn_U = { "C-Buttons Up", "Affects C-Buttons Up colors, but not C cursor colors\nTo edit C Cursor check C-Buttons color on top", "gCCCUBtnPrim", c_btn_u_colors, ImVec4(255,160,0,255), true, false, false };
static CosmeticsColorIndividual C_Btn_D = { "C-Buttons Down", "Affects C-Buttons Down colors, but not C cursor colors\nTo edit C Cursor check C-Buttons color on top", "gCCCDBtnPrim", c_btn_d_colors, ImVec4(255,160,0,255), true, false, false };
static CosmeticsColorIndividual C_Btn_L = { "C-Buttons Left", "Affects C-Buttons Left colors, but not C cursor colors\nTo edit C Cursor check C-Buttons color on top", "gCCCLBtnPrim", c_btn_l_colors, ImVec4(255,160,0,255), true, false, false };
static CosmeticsColorIndividual C_Btn_R = { "C-Buttons Right", "Affects C-Buttons Right colors, but not C cursor colors\nTo edit C Cursor check C-Buttons color on top", "gCCCRBtnPrim", c_btn_r_colors, ImVec4(255,160,0,255), true, false, false };
static CosmeticsColorIndividual Start_btn = { "Start Button", "Affects the Start button color", "gCCStartBtnPrim", start_btn_colors, ImVec4(200, 0, 0, 255), true, false, false };
static CosmeticsColorIndividual DPad_Items = { "DPad background", "DPad background color, White is the default value", "gCCDpadPrim", dpad_colors, ImVec4(255, 255, 255, 255), true, false, false };
//Hearts colors
static CosmeticsColorIndividual Hearts_NInner = { "Inner (Normal)", "Affects the inner color", "gCCHeartsPrim", hearts_colors, ImVec4(255,70,50,255), true, false, false };
static CosmeticsColorIndividual Hearts_DDInner = { "Inner (Double defense)", "Affects the inner color", "gCCDDHeartsPrim", hearts_ddi_colors, ImVec4(255,70,50,255), true, false, false };
static CosmeticsColorIndividual Hearts_DDOutline = { "Outline (Double defense)", "Affects the outline color of hearts when you have Double Defense\nWhite is the default value", "gDDCCHeartsPrim", hearts_dd_colors, ImVec4(255,255,255,255), true, false, false };
//Magic Meter colors
static CosmeticsColorIndividual Magic_Borders = { "Borders", "Affects the border of the magic meter\nWhite is the default value, color change only when used one time", "gCCMagicBorderNormPrim", magic_bordern_colors, ImVec4(255,255,255,255), false, false, false };
static CosmeticsColorIndividual Magic_InUse_Borders = { "Borders in use", "Affects the border of the magic meter when being used\nWhite is the default value", "gCCMagicBorderPrim", magic_border_colors, ImVec4(255,255,255,255), false, false, false };
static CosmeticsColorIndividual Magic_Meter = { "Main color", "Affects the magic meter color\nGreen is the default value", "gCCMagicPrim", magic_remaining_colors, ImVec4(0,200,0,255), true, false, false };
static CosmeticsColorIndividual Magic_InUse_Meter = { "Main color in use", "Affects the magic meter when being used\nYellow is the default value", "gCCMagicUsePrim", magic_use_colors, ImVec4(250,250,0,255), true, false, false };
//Minimap and it's arrow colors
static CosmeticsColorIndividual Minimap_OW = { "Overworlds", "Affects the Overworld minimaps", "gCCMinimapPrim", minimap_colors, ImVec4(0, 255, 255, 255), true, false, false };
static CosmeticsColorIndividual Minimap_DG = { "Dungeons", "Affects the Dungeon minimaps", "gCCMinimapDGNPrim", dgn_minimap_colors, ImVec4(100, 255, 255, 255), true, false, false };
static CosmeticsColorIndividual Minimap_CP = { "Current position arrow", "Affects the current position arrow on the minimap\nYellow is the default value", "gCCMinimapCPPrim", cp_minimap_colors, ImVec4(200, 255, 0, 255), true, false, false };
static CosmeticsColorIndividual Minimap_LE = { "Last entrance arrow", "Affects the last entrance position arrow on the minimap\nRed is the default value", "gCCMinimapLEPrim", le_minimap_colors, ImVec4(200, 0, 0, 255), true, false, false };
//Title Cards colors
static CosmeticsColorIndividual TitleCards_OW = { "Main color (Overworld)", "Affects all the overworld title cards color, white is the default value", "gCCTC_OW_U_Prim", tc_ou_colors, ImVec4(255, 255, 255, 255), false, false, false };
static CosmeticsColorIndividual TitleCards_DG = { "Main color (Dungeon)", "Affects all the bosses title cards color, white is the default value", "gCCTC_B_U_Prim", tc_bu_colors, ImVec4(255, 255, 255, 255), false, false, false };
//Misc. colors, the one I have no clue where to put nor that aren't that important
#ifdef MASTER_QUEST
static CosmeticsColorIndividual TitleScreen_fire_Prim = { "Opening logo fire (Primary)", "Affects the fire behind the title screen logo", "gCCTCFirePrim", tc_fire_colors, ImVec4(170, 255, 255, 255), false, false, false };
static CosmeticsColorIndividual TitleScreen_fire_Env = { "Opening logo fire (Secondary)", "Affects the fire behind the title screen logo", "gCCTCFireEnv", tc_fire_colors_env, ImVec4(200, 255, 0, 255), false, false, false };
#else
static CosmeticsColorIndividual TitleScreen_fire_Prim = { "Opening logo fire (Primary)", "Affects the fire behind the title screen logo", "gCCTCFirePrim", tc_fire_colors, ImVec4(255, 255, 170, 255), false, false, false };
static CosmeticsColorIndividual TitleScreen_fire_Env = { "Opening logo fire (Secondary)", "Affects the fire behind the title screen logo", "gCCTCFireEnv", tc_fire_colors_env, ImVec4(255, 100, 0, 255), false, false, false };
#endif
static CosmeticsColorIndividual Rupee_Icon = { "Rupee icon", "Affects the Rupee icon on interface\nGreen is the default value", "gCCRupeePrim", rupee_colors, ImVec4(200, 255, 100, 255), true, false, false };
static CosmeticsColorIndividual SmallKeys_Icon = { "Small Keys icon", "Affects the Small keys icon on interface\nGray is the default value", "gCCKeysPrim", smolekey_colors, ImVec4(200, 230, 255, 255), true, false, false };
static CosmeticsColorIndividual VSOA_Icon = { "Visual Stone of agony icon", "Affects the Stone of Agony icon on interface\nWhite is the default value\nRequire room reload or activation", "gCCVSOAPrim", visualagony_colors, ImVec4(255, 255, 255, 255), true, false, false };
//Sections creation, here I regroup them in some sort of a Theme, all navi stuff together etc. It will be used to create the menu.
static CosmeticsColorSection Navi_Section[] = {
{ &Navi_Idle_Inner, false, false },
{ &Navi_Idle_Outer, true, false },
{ &Navi_Npc_Inner, false, true },
{ &Navi_Npc_Outer, true, false },
{ &Navi_Enemy_Inner, false, true },
{ &Navi_Enemy_Outer, true, false },
{ &Navi_Prop_Inner, false, true },
{ &Navi_Prop_Outer, true, false }
};
static CosmeticsColorSection Keese_Section[] = {
{ &Keese1_prim, false, false },
{ &Keese2_prim, true, false },
{ &Keese1_env, false, true },
{ &Keese2_env, true, false }
};
static CosmeticsColorSection Dogs_Section[] = {
{ &DogN1, false, false },
{ &DogN2, true, false }
};
static CosmeticsColorSection Tunics_Section[] = {
{ &KokiriTunic, false, false },
{ &GoronTunic, true, false },
{ &ZoraTunic, true, false }
};
static CosmeticsColorSection Arrows_section[] = {
{ &Fire_Arrow_Prim, false, false },
{ &Fire_Arrow_Env, true, false },
{ &Ice_Arrow_Prim, false, true },
{ &Ice_Arrow_Env, true, false },
{ &Light_Arrow_Prim, false, true },
{ &Light_Arrow_Env, true, false }
};
static CosmeticsColorSection Spells_section[] = {
{ &Din_Fire_Prim, false, false },
{ &Din_Fire_Env, true, false },
{ &Nayru_Diamond_Prim, false, true },
{ &Nayru_Diamond_Env, true, false },
{ &Nayru_Orb_Prim, false, true },
{ &Nayru_Orb_Env, true, false }
};
static CosmeticsColorSection SpinAtk_section[] = {
{ &Spin_Lv1_Prim, false, false },
{ &Spin_Lv1_Env, true, false },
{ &Spin_Lv2_Prim, false, true },
{ &Spin_Lv2_Env, true, false }
};
static CosmeticsColorSection Trails_section[] = {
{ &Trails_col, false, false }
};
static CosmeticsColorSection FileChoose_section[] = {
{ &FileChoose_Background, false, false },
{ &FileChoose_BottomText, true, false }
};
static CosmeticsColorSection A_Btn_section[] = {
{ &A_Btn, false, false }
};
static CosmeticsColorSection B_Btn_section[] = {
{ &B_Btn, false, false }
};
static CosmeticsColorSection C_Btn_Unified_section[] = {
{ &C_Btn, false, false }
};
static CosmeticsColorSection C_Btn_Separated_section[] = {
{ &C_Btn_U, false, false },
{ &C_Btn_D, false, true },
{ &C_Btn_L, false, true },
{ &C_Btn_R, false, true }
};
static CosmeticsColorSection Start_Btn_section[] = {
{ &Start_btn, false, false }
};
static CosmeticsColorSection DPad_section[] = {
{ &DPad_Items, false, false }
};
static CosmeticsColorSection Hearts_section[] = {
{ &Hearts_NInner, false, false },
{ &Hearts_DDInner, true, false },
{ &Hearts_DDOutline, true, false }
};
static CosmeticsColorSection Magic_Meter_section[] = {
{ &Magic_Borders, false, false },
{ &Magic_InUse_Borders, true, false },
{ &Magic_Meter, false, true },
{ &Magic_InUse_Meter, true, false }
};
static CosmeticsColorSection Minimap_section[] = {
{ &Minimap_OW, false, false },
{ &Minimap_DG, false, true },
{ &Minimap_CP, false, true },
{ &Minimap_LE, false, true }
};
static CosmeticsColorSection TitleCards_section[] = {
{ &TitleCards_OW, false, false },
{ &TitleCards_DG, true, false }
};
static CosmeticsColorSection Misc_section[] = {
{ &Rupee_Icon, false, false },
{ &SmallKeys_Icon, false, true },
{ &VSOA_Icon, false, true },
{ &TitleScreen_fire_Prim, false, true },
{ &TitleScreen_fire_Env, false, true }
};
//Randomizer specific stuff (by randomizer I mean within cosmetics, these section are there just for the purpose of randomizing their colors)
static CosmeticsColorSection Everything_Section[] = {
{ &TitleScreen_fire_Prim, false, true },
{ &TitleScreen_fire_Env, false, true },
{ &Navi_Idle_Inner, false, false },
{ &Navi_Idle_Outer, true, false },
{ &Navi_Npc_Inner, false, true },
{ &Navi_Npc_Outer, true, false },
{ &Navi_Enemy_Inner, false, true },
{ &Navi_Enemy_Outer, true, false },
{ &Navi_Prop_Inner, false, true },
{ &Navi_Prop_Outer, true, false },
{ &Keese1_prim, false, false },
{ &Keese2_prim, true, false },
{ &Keese1_env, false, true },
{ &Keese2_env, true, false },
{ &DogN1, false, false },
{ &DogN2, true, false },
{ &KokiriTunic, false, false },
{ &GoronTunic, true, false },
{ &ZoraTunic, true, false },
{ &Fire_Arrow_Prim, false, false },
{ &Fire_Arrow_Env, true, false },
{ &Ice_Arrow_Prim, false, true },
{ &Ice_Arrow_Env, true, false },
{ &Light_Arrow_Prim, false, true },
{ &Light_Arrow_Env, true, false },
{ &Din_Fire_Prim, false, false },
{ &Din_Fire_Env, true, false },
{ &Nayru_Diamond_Prim, false, true },
{ &Nayru_Diamond_Env, true, false },
{ &Nayru_Orb_Prim, false, true },
{ &Nayru_Orb_Env, true, false },
{ &Spin_Lv1_Prim, false, false },
{ &Spin_Lv1_Env, true, false },
{ &Spin_Lv2_Prim, false, true },
{ &Spin_Lv2_Env, true, false },
{ &Trails_col, false, false },
{ &FileChoose_Background, false, false },
{ &FileChoose_BottomText, true, false },
{ &A_Btn, false, false },
{ &B_Btn, false, false },
{ &C_Btn, false, false },
{ &C_Btn_U, false, false },
{ &C_Btn_D, false, true },
{ &C_Btn_L, false, true },
{ &C_Btn_R, false, true },
{ &Start_btn, false, false },
{ &DPad_Items, false, false },
{ &Hearts_NInner, false, false },
{ &Hearts_DDInner, true, false },
{ &Hearts_DDOutline, true, false },
{ &Magic_Borders, false, false },
{ &Magic_InUse_Borders, true, false },
{ &Magic_Meter, false, true },
{ &Magic_InUse_Meter, true, false },
{ &Minimap_OW, false, false },
{ &Minimap_DG, false, true },
{ &Minimap_CP, false, true },
{ &Minimap_LE, false, true },
{ &TitleCards_OW, false, false },
{ &TitleCards_DG, true, false },
{ &Rupee_Icon, false, false },
{ &SmallKeys_Icon, false, true },
{ &VSOA_Icon, false, true }
};
static CosmeticsColorSection Buttons_section[]{
{ &DPad_Items, false, false },
{ &C_Btn_U, false, false },
{ &C_Btn_D, false, true },
{ &C_Btn_L, false, true },
{ &C_Btn_R, false, true },
{ &C_Btn, false, false },
{ &B_Btn, false, false },
{ &A_Btn, false, false },
{ &Start_btn, false, false }
};
static CosmeticsColorSection Misc_Interface_section[]{
{ &Hearts_NInner, false, false },
{ &Hearts_DDInner, true, false },
{ &Hearts_DDOutline, true, false },
{ &Magic_Borders, false, false },
{ &Magic_InUse_Borders, true, false },
{ &Magic_Meter, false, true },
{ &Magic_InUse_Meter, true, false },
{ &Minimap_OW, false, false },
{ &Minimap_DG, false, true },
{ &Minimap_CP, false, true },
{ &Minimap_LE, false, true },
{ &TitleCards_OW, false, false },
{ &TitleCards_DG, true, false },
{ &Rupee_Icon, false, false },
{ &SmallKeys_Icon, false, true },
{ &VSOA_Icon, false, true },
{ &TitleScreen_fire_Prim, false, true },
{ &TitleScreen_fire_Env, false, true }
};
static CosmeticsColorSection NPCs_section[]{
{ &Navi_Idle_Inner, false, false },
{ &Navi_Idle_Outer, true, false },
{ &Navi_Npc_Inner, false, true },
{ &Navi_Npc_Outer, true, false },
{ &Navi_Enemy_Inner, false, true },
{ &Navi_Enemy_Outer, true, false },
{ &Navi_Prop_Inner, false, true },
{ &Navi_Prop_Outer, true, false },
{ &Keese1_prim, false, false },
{ &Keese2_prim, true, false },
{ &Keese1_env, false, true },
{ &Keese2_env, true, false },
{ &DogN1, false, false },
{ &DogN2, true, false }
};
static CosmeticsColorSection AllItemsSkills_section[]{
{ &KokiriTunic, false, false },
{ &GoronTunic, true, false },
{ &ZoraTunic, true, false },
{ &Fire_Arrow_Prim, false, false },
{ &Fire_Arrow_Env, true, false },
{ &Ice_Arrow_Prim, false, true },
{ &Ice_Arrow_Env, true, false },
{ &Light_Arrow_Prim, false, true },
{ &Light_Arrow_Env, true, false },
{ &Din_Fire_Prim, false, false },
{ &Din_Fire_Env, true, false },
{ &Nayru_Diamond_Prim, false, true },
{ &Nayru_Diamond_Env, true, false },
{ &Nayru_Orb_Prim, false, true },
{ &Nayru_Orb_Env, true, false },
{ &Spin_Lv1_Prim, false, false },
{ &Spin_Lv1_Env, true, false },
{ &Spin_Lv2_Prim, false, true },
{ &Spin_Lv2_Env, true, false },
{ &Trails_col, false, false }
};
void InitCosmeticsEditor();//Init the menu itself
void LoadRainbowColor();

View File

@ -1,7 +1,3 @@
#ifdef _MSC_VER
#define NOGDI
#endif
#include "debugconsole.h"
#include "../libultraship/ImGuiImpl.h"
#include "savestates.h"
@ -313,6 +309,69 @@ static bool EntranceHandler(std::shared_ptr<Ship::Console> Console, const std::v
gSaveContext.nextTransition = 11;
}
static bool VoidHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (gGlobalCtx != nullptr) {
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = gGlobalCtx->actorCtx.flags.tempSwch;
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = gGlobalCtx->actorCtx.flags.tempCollect;
gSaveContext.respawnFlag = 1;
gGlobalCtx->sceneLoadFlag = 0x14;
gGlobalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex;
gGlobalCtx->fadeTransition = 2;
gSaveContext.nextTransition = 2;
} else {
SohImGui::console->SendErrorMessage("gGlobalCtx == nullptr");
return CMD_FAILED;
}
return CMD_SUCCESS;
}
static bool ReloadHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (gGlobalCtx != nullptr) {
gGlobalCtx->nextEntranceIndex = gSaveContext.entranceIndex;
gGlobalCtx->sceneLoadFlag = 0x14;
gGlobalCtx->fadeTransition = 11;
gSaveContext.nextTransition = 11;
} else {
SohImGui::console->SendErrorMessage("gGlobalCtx == nullptr");
return CMD_FAILED;
}
return CMD_SUCCESS;
}
static bool FWHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (gGlobalCtx != nullptr) {
if (gSaveContext.respawn[RESPAWN_MODE_TOP].data > 0) {
gGlobalCtx->sceneLoadFlag = 0x14;
gGlobalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex;
gGlobalCtx->fadeTransition = 5;
} else {
SohImGui::console->SendErrorMessage("Farore's wind not set!");
}
}
else {
SohImGui::console->SendErrorMessage("gGlobalCtx == nullptr");
return CMD_FAILED;
}
return CMD_SUCCESS;
}
static bool FileSelectHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (gGlobalCtx != nullptr) {
SET_NEXT_GAMESTATE(&gGlobalCtx->state, FileChoose_Init, FileChooseContext);
gGlobalCtx->state.running = 0;
} else {
SohImGui::console->SendErrorMessage("gGlobalCtx == nullptr");
return CMD_FAILED;
}
return CMD_SUCCESS;
}
static bool QuitHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
gGlobalCtx->state.running = 0;
return CMD_SUCCESS;
}
static bool SaveStateHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot();
const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::SAVE });
@ -500,6 +559,11 @@ void DebugConsole_Init(void) {
CMD_REGISTER("entrance", { EntranceHandler,
"Sends player to the entered entrance (hex)",
{ { "entrance", Ship::ArgumentType::NUMBER } } });
CMD_REGISTER("void", {VoidHandler, "Voids out of the current map.",});
CMD_REGISTER("reload", {ReloadHandler, "Reloads the current map.",});
CMD_REGISTER("file_select", {FileSelectHandler, "Returns to the file select.",});
CMD_REGISTER("fw", {FWHandler,"Spawns the player where Farore's Wind is set.", });
CMD_REGISTER("quit", {QuitHandler, "Quits the game.",});
CMD_REGISTER("save_state", { SaveStateHandler, "Save a state." });
CMD_REGISTER("load_state", { LoadStateHandler, "Load a state." });

View File

@ -6,9 +6,7 @@
#include "rando_main.hpp"
// #include <soh/Enhancements/randomizer.h>
#include <Cvar.h>
#define NOGDI
#define WIN32_LEAN_AND_MEAN
#include <GlobalCtx2.h>
#include <Window.h>
#include <PR/ultra64/types.h>
#define TICKS_PER_SEC 268123480.0
@ -21,10 +19,10 @@ void RandoMain::GenerateRando(std::unordered_map<RandomizerSettingKey, u8> cvarS
// std::string settingsFileName = "./randomizer/latest_settings.json";
// CVar_SetString("gLoadedPreset", settingsFileName.c_str());
std::string fileName = Ship::GlobalCtx2::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings, excludedLocations).c_str());
std::string fileName = Ship::Window::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings, excludedLocations).c_str());
CVar_SetString("gSpoilerLog", fileName.c_str());
CVar_Save();
CVar_Load();
CVar_SetS32("gNewSeedGenerated", 1);
}
}

View File

@ -26,9 +26,7 @@
#include <filesystem>
#include <variables.h>
#define NOGDI
#define WIN32_LEAN_AND_MEAN
#include "GlobalCtx2.h"
#include "Window.h"
using json = nlohmann::json;
@ -728,12 +726,12 @@ const char* SpoilerLog_Write(int language) {
//WriteShuffledEntrances(spoilerLog);
WriteAllLocations(language);
if (!std::filesystem::exists(Ship::GlobalCtx2::GetPathRelativeToAppDirectory("Randomizer"))) {
std::filesystem::create_directory(Ship::GlobalCtx2::GetPathRelativeToAppDirectory("Randomizer"));
if (!std::filesystem::exists(Ship::Window::GetPathRelativeToAppDirectory("Randomizer"))) {
std::filesystem::create_directory(Ship::Window::GetPathRelativeToAppDirectory("Randomizer"));
}
std::string jsonString = jsonData.dump(4);
std::ofstream jsonFile(Ship::GlobalCtx2::GetPathRelativeToAppDirectory(
std::ofstream jsonFile(Ship::Window::GetPathRelativeToAppDirectory(
(std::string("Randomizer/") + std::string(Settings::seed) + std::string(".json")).c_str()));
jsonFile << std::setw(4) << jsonString << std::endl;
jsonFile.close();

View File

@ -3,8 +3,8 @@
#include <iostream>
#include <algorithm>
#include <filesystem>
#include <locale>
#include "GlobalCtx2.h"
#include <fstream>
#include "ResourceMgr.h"
#include "DisplayList.h"
#include "PlayerAnimation.h"
@ -42,6 +42,9 @@
#include "Hooks.h"
#include <soh/Enhancements/custom-message/CustomMessageManager.h>
#include "Lib/Fast3D/gfx_pc.h"
#include "Lib/Fast3D/gfx_rendering_api.h"
#ifdef __APPLE__
#include <SDL_scancode.h>
#else
@ -65,10 +68,9 @@ CustomMessageManager* CustomMessageManager::Instance;
ItemTableManager* ItemTableManager::Instance;
OTRGlobals::OTRGlobals() {
context = Ship::GlobalCtx2::CreateInstance("Ship of Harkinian");
context = Ship::Window::CreateInstance("Ship of Harkinian");
gSaveStateMgr = std::make_shared<SaveStateMgr>();
gRandomizer = std::make_shared<Randomizer>();
context->GetWindow()->Init();
}
OTRGlobals::~OTRGlobals() {
@ -380,14 +382,14 @@ extern "C" uint64_t GetPerfCounter() {
// C->C++ Bridge
extern "C" void Graph_ProcessFrame(void (*run_one_game_iter)(void)) {
OTRGlobals::Instance->context->GetWindow()->MainLoop(run_one_game_iter);
OTRGlobals::Instance->context->MainLoop(run_one_game_iter);
}
extern "C" void Graph_StartFrame() {
#ifndef __WIIU__
// Why -1?
int32_t dwScancode = OTRGlobals::Instance->context->GetWindow()->GetLastScancode();
OTRGlobals::Instance->context->GetWindow()->SetLastScancode(-1);
int32_t dwScancode = OTRGlobals::Instance->context->GetLastScancode();
OTRGlobals::Instance->context->SetLastScancode(-1);
switch (dwScancode - 1) {
case SDL_SCANCODE_F5: {
@ -443,7 +445,14 @@ extern "C" void Graph_StartFrame() {
}
}
#endif
OTRGlobals::Instance->context->GetWindow()->StartFrame();
OTRGlobals::Instance->context->StartFrame();
}
void RunCommands(Gfx* Commands, const std::vector<std::unordered_map<Mtx*, MtxF>>& mtx_replacements) {
for (const auto& m : mtx_replacements) {
gfx_run(Commands, m);
gfx_end_frame();
}
}
// C->C++ Bridge
@ -484,12 +493,12 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
time -= fps;
OTRGlobals::Instance->context->GetWindow()->SetTargetFps(fps);
OTRGlobals::Instance->context->SetTargetFps(fps);
int threshold = CVar_GetS32("gExtraLatencyThreshold", 80);
OTRGlobals::Instance->context->GetWindow()->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1);
OTRGlobals::Instance->context->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1);
OTRGlobals::Instance->context->GetWindow()->RunCommands(commands, mtx_replacements);
RunCommands(commands, mtx_replacements);
last_fps = fps;
last_update_rate = R_UPDATE_RATE;
@ -502,19 +511,19 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
}
// OTRTODO: FIGURE OUT END FRAME POINT
/* if (OTRGlobals::Instance->context->GetWindow()->lastScancode != -1)
OTRGlobals::Instance->context->GetWindow()->lastScancode = -1;*/
/* if (OTRGlobals::Instance->context->lastScancode != -1)
OTRGlobals::Instance->context->lastScancode = -1;*/
}
float divisor_num = 0.0f;
extern "C" void OTRGetPixelDepthPrepare(float x, float y) {
OTRGlobals::Instance->context->GetWindow()->GetPixelDepthPrepare(x, y);
OTRGlobals::Instance->context->GetPixelDepthPrepare(x, y);
}
extern "C" uint16_t OTRGetPixelDepth(float x, float y) {
return OTRGlobals::Instance->context->GetWindow()->GetPixelDepth(x, y);
return OTRGlobals::Instance->context->GetPixelDepth(x, y);
}
extern "C" uint32_t ResourceMgr_GetGameVersion()
@ -1326,7 +1335,7 @@ extern "C" s32* ResourceMgr_LoadCSByName(const char* path)
}
std::filesystem::path GetSaveFile(std::shared_ptr<Mercury> Conf) {
const std::string fileName = Conf->getString("Game.SaveName", Ship::GlobalCtx2::GetPathRelativeToAppDirectory("oot_save.sav"));
const std::string fileName = Conf->getString("Game.SaveName", Ship::Window::GetPathRelativeToAppDirectory("oot_save.sav"));
std::filesystem::path saveFile = std::filesystem::absolute(fileName);
if (!exists(saveFile.parent_path())) {
@ -1457,15 +1466,15 @@ extern "C" void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(vo
}
extern "C" uint32_t OTRGetCurrentWidth() {
return OTRGlobals::Instance->context->GetWindow()->GetCurrentWidth();
return OTRGlobals::Instance->context->GetCurrentWidth();
}
extern "C" uint32_t OTRGetCurrentHeight() {
return OTRGlobals::Instance->context->GetWindow()->GetCurrentHeight();
return OTRGlobals::Instance->context->GetCurrentHeight();
}
extern "C" void OTRControllerCallback(ControllerCallback* controller) {
auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck();
auto controlDeck = Ship::Window::GetInstance()->GetControlDeck();
for (int i = 0; i < controlDeck->GetNumVirtualDevices(); ++i) {
auto physicalDevice = controlDeck->GetPhysicalDeviceFromVirtualSlot(i);
@ -1497,33 +1506,33 @@ extern "C" int16_t OTRGetRectDimensionFromRightEdge(float v) {
}
extern "C" bool AudioPlayer_Init(void) {
if (OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer() != nullptr) {
return OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer()->Init();
if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) {
return OTRGlobals::Instance->context->GetAudioPlayer()->Init();
}
return false;
}
extern "C" int AudioPlayer_Buffered(void) {
if (OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer() != nullptr) {
return OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer()->Buffered();
if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) {
return OTRGlobals::Instance->context->GetAudioPlayer()->Buffered();
}
}
extern "C" int AudioPlayer_GetDesiredBuffered(void) {
if (OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer() != nullptr) {
return OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer()->GetDesiredBuffered();
if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) {
return OTRGlobals::Instance->context->GetAudioPlayer()->GetDesiredBuffered();
}
}
extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) {
if (OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer() != nullptr) {
OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer()->Play(buf, len);
if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) {
OTRGlobals::Instance->context->GetAudioPlayer()->Play(buf, len);
}
}
extern "C" int Controller_ShouldRumble(size_t i) {
auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck();
auto controlDeck = Ship::Window::GetInstance()->GetControlDeck();
for (int i = 0; i < controlDeck->GetNumVirtualDevices(); ++i) {
auto physicalDevice = controlDeck->GetPhysicalDeviceFromVirtualSlot(i);
@ -1604,7 +1613,7 @@ extern "C" CustomMessageEntry Randomizer_GetHintFromCheck(RandomizerCheck check)
}
extern "C" GetItemEntry ItemTable_Retrieve(int16_t getItemID) {
GetItemEntry giEntry = ItemTableManager::Instance->RetrieveItemEntry(MOD_NONE, getItemID);
GetItemEntry giEntry = ItemTableManager::Instance->RetrieveItemEntry(OTRGlobals::Instance->getItemModIndex, getItemID);
return giEntry;
}
@ -1635,12 +1644,12 @@ extern "C" GetItemEntry Randomizer_GetItemFromKnownCheck(RandomizerCheck randomi
return ItemTable_RetrieveEntry(getItemModIndex, itemID);
}
extern "C" u32 Randomizer_ObtainedFreestandingIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId, Actor* actor) {
extern "C" bool Randomizer_ObtainedFreestandingIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId, Actor* actor) {
return gSaveContext.n64ddFlag && (actor->parent != NULL) &&
Randomizer_GetItemFromKnownCheck(randomizerCheck, ogId).getItemId == RG_ICE_TRAP;
}
extern "C" u32 Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId) {
extern "C" bool Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId) {
return gSaveContext.n64ddFlag && Randomizer_GetItemFromKnownCheck(randomizerCheck, ogId).getItemId == RG_ICE_TRAP;
}

View File

@ -3,11 +3,11 @@
#pragma once
#include "GlobalCtx2.h"
#include "SaveManager.h"
#include <soh/Enhancements/item-tables/ItemTableTypes.h>
#ifdef __cplusplus
#include "Window.h"
#include "Enhancements/savestates.h"
#include "Enhancements/randomizer/randomizer.h"
@ -18,7 +18,7 @@ class OTRGlobals
public:
static OTRGlobals* Instance;
std::shared_ptr<Ship::GlobalCtx2> context;
std::shared_ptr<Ship::Window> context;
std::shared_ptr<SaveStateMgr> gSaveStateMgr;
std::shared_ptr<Randomizer> gRandomizer;
uint16_t getItemModIndex;

View File

@ -16,7 +16,7 @@
extern "C" SaveContext gSaveContext;
std::filesystem::path SaveManager::GetFileName(int fileNum) {
const std::filesystem::path sSavePath(Ship::GlobalCtx2::GetPathRelativeToAppDirectory("Save"));
const std::filesystem::path sSavePath(Ship::Window::GetPathRelativeToAppDirectory("Save"));
return sSavePath / ("file" + std::to_string(fileNum + 1) + ".sav");
}
@ -137,10 +137,10 @@ void SaveManager::SaveRandomizer() {
}
void SaveManager::Init() {
const std::filesystem::path sSavePath(Ship::GlobalCtx2::GetPathRelativeToAppDirectory("Save"));
const std::filesystem::path sSavePath(Ship::Window::GetPathRelativeToAppDirectory("Save"));
const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav");
auto sOldSavePath = Ship::GlobalCtx2::GetPathRelativeToAppDirectory("oot_save.sav");
auto sOldBackupSavePath = Ship::GlobalCtx2::GetPathRelativeToAppDirectory("oot_save.bak");
auto sOldSavePath = Ship::Window::GetPathRelativeToAppDirectory("oot_save.sav");
auto sOldBackupSavePath = Ship::Window::GetPathRelativeToAppDirectory("oot_save.bak");
// If the save directory does not exist, create it
if (!std::filesystem::exists(sSavePath)) {

View File

@ -69,7 +69,7 @@ void OTRGameplay_InitScene(GlobalContext* globalCtx, s32 spawn) {
gSaveContext.worldMapArea = 0;
OTRScene_ExecuteCommands(globalCtx, globalCtx->sceneSegment);
Gameplay_InitEnvironment(globalCtx, globalCtx->skyboxId);
/* auto data = static_cast<Ship::Vertex*>(Ship::GlobalCtx2::GetInstance()
/* auto data = static_cast<Ship::Vertex*>(Ship::Window::GetInstance()
->GetResourceManager()
->LoadResource("object_link_child\\object_link_childVtx_01FE08")
.get());

View File

@ -1009,20 +1009,15 @@ void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCt
}
void TitleCard_Update(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
s16* TitleCard_Colors[3] = {255,255,255};
if (titleCtx->isBossCard && CVar_GetS32("gHudColors", 1) == 2) {//Bosses cards.
TitleCard_Colors[0] = CVar_GetS32("gCCTC_B_U_PrimR", 255);
TitleCard_Colors[1] = CVar_GetS32("gCCTC_B_U_PrimG", 255);
TitleCard_Colors[2] = CVar_GetS32("gCCTC_B_U_PrimB", 255);
} else if (!titleCtx->isBossCard && CVar_GetS32("gHudColors", 1) == 2) {
TitleCard_Colors[0] = CVar_GetS32("gCCTC_OW_U_PrimR", 255);
TitleCard_Colors[1] = CVar_GetS32("gCCTC_OW_U_PrimG", 255);
TitleCard_Colors[2] = CVar_GetS32("gCCTC_OW_U_PrimB", 255);
} else {
TitleCard_Colors[0] = 255;
TitleCard_Colors[1] = 255;
TitleCard_Colors[2] = 255;
}
const Color_RGB8 TitleCard_Colors_ori = {255,255,255};
Color_RGB8 TitleCard_Colors = {255,255,255};
if (titleCtx->isBossCard && CVar_GetS32("gHudColors", 1) == 2) {//Bosses cards.
TitleCard_Colors = CVar_GetRGB("gCCTC_B_U_Prim", TitleCard_Colors_ori);
} else if (!titleCtx->isBossCard && CVar_GetS32("gHudColors", 1) == 2) {
TitleCard_Colors = CVar_GetRGB("gCCTC_OW_U_Prim", TitleCard_Colors_ori);
} else {
TitleCard_Colors = TitleCard_Colors_ori;
}
if (DECR(titleCtx->delayTimer) == 0) {
if (DECR(titleCtx->durationTimer) == 0) {
@ -1032,9 +1027,9 @@ void TitleCard_Update(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
Math_StepToS(&titleCtx->intensityB, 0, 70);
} else {
Math_StepToS(&titleCtx->alpha, 255, 10);
Math_StepToS(&titleCtx->intensityR, TitleCard_Colors[0], 20);
Math_StepToS(&titleCtx->intensityG, TitleCard_Colors[1], 20);
Math_StepToS(&titleCtx->intensityB, TitleCard_Colors[2], 20);
Math_StepToS(&titleCtx->intensityR, TitleCard_Colors.r, 20);
Math_StepToS(&titleCtx->intensityG, TitleCard_Colors.g, 20);
Math_StepToS(&titleCtx->intensityB, TitleCard_Colors.b, 20);
}
}
}
@ -1195,7 +1190,8 @@ void Actor_Init(Actor* actor, GlobalContext* globalCtx) {
actor->uncullZoneDownward = 700.0f;
if (CVar_GetS32("gDisableDrawDistance", 0) != 0 && actor->id != ACTOR_EN_TORCH2 && actor->id != ACTOR_EN_BLKOBJ // Extra check for Dark Link and his room
&& actor->id != ACTOR_EN_HORSE // Check for Epona, else if we call her she will spawn at the other side of the map + we can hear her during the title screen sequence
&& actor->id != ACTOR_EN_HORSE_GANON && actor->id != ACTOR_EN_HORSE_ZELDA) { // check for Zelda's and Ganondorf's horses that will always be scene during cinematic whith camera paning
&& actor->id != ACTOR_EN_HORSE_GANON && actor->id != ACTOR_EN_HORSE_ZELDA // check for Zelda's and Ganondorf's horses that will always be scene during cinematic whith camera paning
&& (globalCtx->sceneNum != SCENE_DDAN && actor->id != ACTOR_EN_ZF)) { // Check for DC and Lizalfos for the case where the miniboss music would still play under certains conditions and changing room
actor->uncullZoneForward = 32767.0f;
actor->uncullZoneScale = 32767.0f;
actor->uncullZoneDownward = 32767.0f;
@ -2840,7 +2836,8 @@ s32 func_800314D4(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3)
if (CVar_GetS32("gDisableDrawDistance", 0) != 0 && actor->id != ACTOR_EN_TORCH2 && actor->id != ACTOR_EN_BLKOBJ // Extra check for Dark Link and his room
&& actor->id != ACTOR_EN_HORSE // Check for Epona, else if we call her she will spawn at the other side of the map + we can hear her during the title screen sequence
&& actor->id != ACTOR_EN_HORSE_GANON && actor->id != ACTOR_EN_HORSE_ZELDA) { // check for Zelda's and Ganondorf's horses that will always be scene during cinematic whith camera paning
&& actor->id != ACTOR_EN_HORSE_GANON && actor->id != ACTOR_EN_HORSE_ZELDA // check for Zelda's and Ganondorf's horses that will always be scene during cinematic whith camera paning
&& (globalCtx->sceneNum != SCENE_DDAN && actor->id != ACTOR_EN_ZF)) { // Check for DC and Lizalfos for the case where the miniboss music would still play under certains conditions and changing room
return true;
}

View File

@ -1488,8 +1488,8 @@ s32 Camera_Free(Camera* camera) {
f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f;
f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f;
camera->globalCtx->camX += newCamX;
camera->globalCtx->camY += newCamY;
camera->globalCtx->camX += newCamX * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1);
camera->globalCtx->camY += newCamY * (CVar_GetS32("gInvertYAxis", 0) ? 1 : -1);
if (camera->globalCtx->camY > 0x32A4) {
camera->globalCtx->camY = 0x32A4;

View File

@ -3,6 +3,8 @@
#include "soh/frame_interpolation.h"
const Color_RGB8 Trails_Color_ori = {255,255,255};
void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) {
EffectBlureElement* elem;
s32 numElements;
@ -198,6 +200,7 @@ s32 EffectBlure_Update(void* thisx) {
s16 GreenColor;
s16 BlueColor;
s16 TrailDuration;
Color_RGB8 Trails_col = CVar_GetRGB("gTrailCol", Trails_Color_ori);
if (this == NULL) {
return 0;
@ -208,16 +211,17 @@ s32 EffectBlure_Update(void* thisx) {
}
if (CVar_GetS32("gUseTrailsCol", 0) !=0) {
RedColor = CVar_GetS32("gTrailColR",255);
GreenColor = CVar_GetS32("gTrailColG",255);
BlueColor = CVar_GetS32("gTrailColB",255);
TrailDuration = 4.0f*CVar_GetS32("gTrailDurantion",1);
RedColor = Trails_col.r;
GreenColor = Trails_col.g;
BlueColor = Trails_col.b;
TrailDuration = 4.0f * CVar_GetS32("gTrailDurantion",1);
} else {
RedColor = 255;
GreenColor = 255;
BlueColor = 255;
RedColor = Trails_Color_ori.r;
GreenColor = Trails_Color_ori.g;
BlueColor = Trails_Color_ori.b;
TrailDuration=4.0f;
}
this->p1StartColor.r = RedColor;
this->p2StartColor.r = RedColor;
this->p1EndColor.r = RedColor;

View File

@ -70,6 +70,7 @@ static void* sItemDropTex[] = {
gDropRecoveryHeartTex, gDropBombTex, gDropArrows1Tex, gDropArrows2Tex,
gDropArrows3Tex, gDropBombTex, gDropDekuNutTex, gDropDekuStickTex,
gDropMagicLargeTex, gDropMagicSmallTex, gDropDekuSeedsTex, gDropKeySmallTex,
// OTRTODO: use 2D bombchu texture
};
static u8 sItemDropIds[] = {
@ -390,6 +391,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_RUPEE_ORANGE:
case ITEM00_RUPEE_PURPLE:
case ITEM00_FLEXIBLE:
case ITEM00_BOMBCHU:
yOffset = 500.0f;
Actor_SetScale(&this->actor, 0.01f);
this->scale = 0.01f;
@ -507,6 +509,9 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_TUNIC_GORON:
case ITEM00_BOMBS_SPECIAL:
break;
case ITEM00_BOMBCHU:
Item_Give(globalCtx, ITEM_BOMBCHUS_5);
break;
}
if (!Actor_HasParent(&this->actor, globalCtx)) {
@ -537,7 +542,8 @@ void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) {
(this->actor.params == ITEM00_HEART_PIECE)) {
this->actor.shape.rot.y += 960;
} else {
if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL)) {
if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL) &&
(this->actor.params != ITEM00_BOMBCHU)) {
if (this->unk_15A == -1) {
if (Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x - 0x4000, 2, 3000, 1500) ==
0) {
@ -640,7 +646,8 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) {
if (this->actor.params <= ITEM00_RUPEE_RED) {
this->actor.shape.rot.y += 960;
} else if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL)) {
} else if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL) &&
(this->actor.params != ITEM00_BOMBCHU)) {
this->actor.world.rot.x -= 700;
this->actor.shape.rot.y += 400;
this->actor.shape.rot.x = this->actor.world.rot.x - 0x4000;
@ -722,7 +729,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
EnItem00* this = (EnItem00*)thisx;
s32 pad;
if (CVar_GetS32("gNewDrops", 0)) { //set the rotation system on selected model only :)
// OTRTODO: remove special case for bombchu when its 2D drop is implemented
if (CVar_GetS32("gNewDrops", 0) || this->actor.params == ITEM00_BOMBCHU) { //set the rotation system on selected model only :)
if ((this->actor.params == ITEM00_RUPEE_GREEN) || (this->actor.params == ITEM00_RUPEE_BLUE) ||
(this->actor.params == ITEM00_RUPEE_RED) || (this->actor.params == ITEM00_ARROWS_SINGLE) ||
(this->actor.params == ITEM00_ARROWS_SMALL) || (this->actor.params == ITEM00_ARROWS_MEDIUM) ||
@ -730,7 +738,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
(this->actor.params == ITEM00_BOMBS_B) || (this->actor.params == ITEM00_NUTS) ||
(this->actor.params == ITEM00_MAGIC_SMALL) || (this->actor.params == ITEM00_SEEDS) ||
(this->actor.params == ITEM00_MAGIC_LARGE) || (this->actor.params == ITEM00_HEART) ||
(this->actor.params == ITEM00_BOMBS_SPECIAL) || this->actor.params == ITEM00_HEART_PIECE) {
(this->actor.params == ITEM00_BOMBS_SPECIAL) || this->actor.params == ITEM00_HEART_PIECE ||
(this->actor.params == ITEM00_BOMBCHU)) {
this->actor.shape.rot.y += 960;
}
if (this->actor.params == ITEM00_SMALL_KEY && !gSaveContext.n64ddFlag) {
@ -891,6 +900,9 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
break;
case ITEM00_BOMBS_SPECIAL:
break;
case ITEM00_BOMBCHU:
Item_Give(globalCtx, ITEM_BOMBCHUS_5);
break;
}
params = &this->actor.params;
@ -1212,6 +1224,15 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnItem00_DrawCollectible(this, globalCtx);
break;
}
case ITEM00_BOMBCHU:
// OTRTODO: Stop forcing chu drops to be 3D when the texture is added
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(globalCtx, GID_BOMBCHU);
break;
case ITEM00_SHIELD_DEKU:
GetItem_Draw(globalCtx, GID_SHIELD_DEKU);
break;
@ -1370,6 +1391,9 @@ void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx) {
if (this->actor.params == ITEM00_BOMBS_SPECIAL) {
texIndex = 1;
// OTRTODO: 2D bombchu drops
//} else if (this->actor.params == ITEM00_BOMBCHU) {
// texIndex = 12;
} else if (this->actor.params >= ITEM00_ARROWS_SMALL) {
texIndex -= 3;
}
@ -1435,6 +1459,36 @@ void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx) {
}
}
/**
* Sometimes convert the given drop ID into a bombchu.
* Returns the new drop type ID.
*/
s16 EnItem00_ConvertBombDropToBombchu(s16 dropId) {
if (INV_CONTENT(ITEM_BOMBCHU) == ITEM_NONE) {
return dropId;
}
if (INV_CONTENT(ITEM_BOMB) == ITEM_NONE) {
return ITEM00_BOMBCHU;
}
if (AMMO(ITEM_BOMB) <= 15) {
// Player needs bombs and might need chus, so drop whichever has less
if (AMMO(ITEM_BOMB) <= AMMO(ITEM_BOMBCHU)) {
return dropId;
} else {
return ITEM00_BOMBCHU;
}
} else {
// Player has enough bombs, so drop chus if they need some, else it's 50/50
if (AMMO(ITEM_BOMBCHU) <= 15) {
return ITEM00_BOMBCHU;
} else {
return Rand_Next() % 2 ? dropId : ITEM00_BOMBCHU;
}
}
}
/**
* Converts a given drop type ID based on link's current age, health and owned items.
* Returns a new drop type ID or -1 to cancel the drop.
@ -1452,6 +1506,11 @@ s16 func_8001F404(s16 dropId) {
}
}
if (CVar_GetS32("gBombchuDrops", 0) &&
(dropId == ITEM00_BOMBS_A || dropId == ITEM00_BOMBS_B || dropId == ITEM00_BOMBS_SPECIAL)) {
dropId = EnItem00_ConvertBombDropToBombchu(dropId);
}
// This is convoluted but it seems like it must be a single condition to match
// clang-format off
if (((dropId == ITEM00_BOMBS_A || dropId == ITEM00_BOMBS_SPECIAL || dropId == ITEM00_BOMBS_B) && INV_CONTENT(ITEM_BOMB) == ITEM_NONE) ||

View File

@ -112,9 +112,12 @@ static s16 sHeartsDDEnvFactors[3][3] = {
};
// Current colors for the double defense hearts
s16 HeartInner[3] = {HEARTS_PRIM_R,HEARTS_PRIM_G,HEARTS_PRIM_B};
s16 HeartDDOutline[3] = {HEARTS_DD_PRIM_R,HEARTS_DD_PRIM_G,HEARTS_DD_PRIM_B};
s16 HeartDDInner[3] = {HEARTS_DD_ENV_R,HEARTS_DD_ENV_G,HEARTS_DD_ENV_B};
Color_RGB8 HeartInner_ori = {HEARTS_PRIM_R,HEARTS_PRIM_G,HEARTS_PRIM_B};
Color_RGB8 HeartDDOutline_ori = {HEARTS_DD_PRIM_R,HEARTS_DD_PRIM_G,HEARTS_DD_PRIM_B};
Color_RGB8 HeartDDInner_ori = {HEARTS_DD_ENV_R,HEARTS_DD_ENV_G,HEARTS_DD_ENV_B};
Color_RGB8 HeartInner;
Color_RGB8 HeartDDOutline;
Color_RGB8 HeartDDInner;
s16 sBeatingHeartsDDPrim[3];
s16 sBeatingHeartsDDEnv[3];
s16 sHeartsDDPrim[2][3];
@ -123,19 +126,13 @@ s16 sHeartsDDEnv[2][3];
void HealthMeter_Init(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
if (CVar_GetS32("gHudColors", 1) == 2) {
HeartInner[0] = CVar_GetS32("gCCHeartsPrimR", 90);
HeartInner[1] = CVar_GetS32("gCCHeartsPrimG", 90);
HeartInner[2] = CVar_GetS32("gCCHeartsPrimB", 90);
HeartDDOutline[0] = CVar_GetS32("gDDCCHeartsPrimR", 90);
HeartDDOutline[1] = CVar_GetS32("gDDCCHeartsPrimG", 90);
HeartDDOutline[2] = CVar_GetS32("gDDCCHeartsPrimB", 90);
HeartInner = CVar_GetRGB("gCCHeartsPrim", HeartInner_ori);
HeartDDInner = CVar_GetRGB("gCCDDHeartsPrim", HeartDDInner_ori);
HeartDDOutline = CVar_GetRGB("gDDCCHeartsPrim", HeartDDOutline_ori);
} else {
HeartInner[0] = HEARTS_PRIM_R;
HeartInner[1] = HEARTS_PRIM_G;
HeartInner[2] = HEARTS_PRIM_B;
HeartDDOutline[0] = HEARTS_DD_PRIM_R;
HeartDDOutline[1] = HEARTS_DD_PRIM_G;
HeartDDOutline[2] = HEARTS_DD_PRIM_B;
HeartInner = HeartInner_ori;
HeartDDInner = HeartDDInner_ori;
HeartDDOutline = HeartDDOutline_ori;
}
interfaceCtx->unk_228 = 0x140;
@ -143,33 +140,33 @@ void HealthMeter_Init(GlobalContext* globalCtx) {
interfaceCtx->unk_22A = interfaceCtx->unk_1FE = 0;
interfaceCtx->unk_22C = interfaceCtx->unk_200 = 0;
interfaceCtx->heartsPrimR[0] = HeartInner[0];
interfaceCtx->heartsPrimG[0] = HeartInner[1];
interfaceCtx->heartsPrimB[0] = HeartInner[2];
interfaceCtx->heartsPrimR[0] = HeartInner.r;
interfaceCtx->heartsPrimG[0] = HeartInner.g;
interfaceCtx->heartsPrimB[0] = HeartInner.b;
interfaceCtx->heartsEnvR[0] = HEARTS_ENV_R;
interfaceCtx->heartsEnvG[0] = HEARTS_ENV_G;
interfaceCtx->heartsEnvB[0] = HEARTS_ENV_B;
interfaceCtx->heartsPrimR[1] = HeartInner[0];
interfaceCtx->heartsPrimG[1] = HeartInner[1];
interfaceCtx->heartsPrimB[1] = HeartInner[2];
interfaceCtx->heartsPrimR[1] = HeartInner.r;
interfaceCtx->heartsPrimG[1] = HeartInner.g;
interfaceCtx->heartsPrimB[1] = HeartInner.b;
interfaceCtx->heartsEnvR[1] = HEARTS_ENV_R;
interfaceCtx->heartsEnvG[1] = HEARTS_ENV_G;
interfaceCtx->heartsEnvB[1] = HEARTS_ENV_B;
sHeartsDDPrim[0][0] = sHeartsDDPrim[1][0] = HeartDDOutline[0];
sHeartsDDPrim[0][1] = sHeartsDDPrim[1][1] = HeartDDOutline[1];
sHeartsDDPrim[0][2] = sHeartsDDPrim[1][2] = HeartDDOutline[2];
sHeartsDDPrim[0][0] = sHeartsDDPrim[1][0] = HeartDDOutline.r;
sHeartsDDPrim[0][1] = sHeartsDDPrim[1][1] = HeartDDOutline.b;
sHeartsDDPrim[0][2] = sHeartsDDPrim[1][2] = HeartDDOutline.b;
// sHeartsDDPrim[2][0] = HeartInner[0];
// sHeartsDDPrim[2][1] = HeartInner[1];
// sHeartsDDPrim[2][2] = HeartInner[2];
sHeartsDDEnv[0][0] = sHeartsDDEnv[1][0] = HeartDDInner[0];
sHeartsDDEnv[0][1] = sHeartsDDEnv[1][1] = HeartDDInner[1];
sHeartsDDEnv[0][2] = sHeartsDDEnv[1][2] = HeartDDInner[2];
sHeartsDDEnv[0][0] = sHeartsDDEnv[1][0] = HeartDDInner.r;
sHeartsDDEnv[0][1] = sHeartsDDEnv[1][1] = HeartDDInner.g;
sHeartsDDEnv[0][2] = sHeartsDDEnv[1][2] = HeartDDInner.b;
}
void HealthMeter_Update(GlobalContext* globalCtx) {
@ -188,19 +185,13 @@ void HealthMeter_Update(GlobalContext* globalCtx) {
Bottom_LM_Margin = CVar_GetS32("gHUDMargin_B", 0);
if (CVar_GetS32("gHudColors", 1) == 2) {
HeartInner[0] = CVar_GetS32("gCCHeartsPrimR", sHeartsPrimColors[0][0]);
HeartInner[1] = CVar_GetS32("gCCHeartsPrimG", sHeartsPrimColors[0][1]);
HeartInner[2] = CVar_GetS32("gCCHeartsPrimB", sHeartsPrimColors[0][2]);
HeartDDOutline[0] = CVar_GetS32("gDDCCHeartsPrimR", sHeartsDDPrim[0][0]);
HeartDDOutline[1] = CVar_GetS32("gDDCCHeartsPrimG", sHeartsDDPrim[0][1]);
HeartDDOutline[2] = CVar_GetS32("gDDCCHeartsPrimB", sHeartsDDPrim[0][2]);
HeartInner = CVar_GetRGB("gCCHeartsPrim", HeartInner_ori);
HeartDDInner = CVar_GetRGB("gCCDDHeartsPrim", HeartDDInner_ori);
HeartDDOutline = CVar_GetRGB("gDDCCHeartsPrim", HeartDDOutline_ori);
} else {
HeartInner[0] = HEARTS_PRIM_R;
HeartInner[1] = HEARTS_PRIM_G;
HeartInner[2] = HEARTS_PRIM_B;
HeartDDOutline[0] = HEARTS_DD_PRIM_R;
HeartDDOutline[1] = HEARTS_DD_PRIM_G;
HeartDDOutline[2] = HEARTS_DD_PRIM_B;
HeartInner = HeartInner_ori;
HeartDDInner = HeartDDInner_ori;
HeartDDOutline = HeartDDOutline_ori;
}
if (interfaceCtx->unk_200 != 0) {
@ -219,18 +210,18 @@ void HealthMeter_Update(GlobalContext* globalCtx) {
ddFactor = factor;
interfaceCtx->heartsPrimR[0] = HeartInner[0];
interfaceCtx->heartsPrimG[0] = HeartInner[1];
interfaceCtx->heartsPrimB[0] = HeartInner[2];
interfaceCtx->heartsPrimR[0] = HeartInner.r;
interfaceCtx->heartsPrimG[0] = HeartInner.g;
interfaceCtx->heartsPrimB[0] = HeartInner.b;
interfaceCtx->heartsEnvR[0] = HEARTS_ENV_R;
interfaceCtx->heartsEnvG[0] = HEARTS_ENV_G;
interfaceCtx->heartsEnvB[0] = HEARTS_ENV_B;
if (CVar_GetS32("gHudColors", 1) == 2) {
interfaceCtx->heartsPrimR[1] = HeartInner[0];
interfaceCtx->heartsPrimG[1] = HeartInner[1];
interfaceCtx->heartsPrimB[1] = HeartInner[2];
interfaceCtx->heartsPrimR[1] = HeartInner.r;
interfaceCtx->heartsPrimG[1] = HeartInner.g;
interfaceCtx->heartsPrimB[1] = HeartInner.b;
} else {
interfaceCtx->heartsPrimR[1] = sHeartsPrimColors[type][0];
interfaceCtx->heartsPrimG[1] = sHeartsPrimColors[type][1];
@ -245,9 +236,9 @@ void HealthMeter_Update(GlobalContext* globalCtx) {
gFactor = sHeartsPrimFactors[0][1] * factor;
bFactor = sHeartsPrimFactors[0][2] * factor;
interfaceCtx->beatingHeartPrim[0] = (u8)(rFactor + HeartInner[0]) & 0xFF;
interfaceCtx->beatingHeartPrim[1] = (u8)(gFactor + HeartInner[1]) & 0xFF;
interfaceCtx->beatingHeartPrim[2] = (u8)(bFactor + HeartInner[2]) & 0xFF;
interfaceCtx->beatingHeartPrim[0] = (u8)(rFactor + HeartInner.r) & 0xFF;
interfaceCtx->beatingHeartPrim[1] = (u8)(gFactor + HeartInner.g) & 0xFF;
interfaceCtx->beatingHeartPrim[2] = (u8)(bFactor + HeartInner.b) & 0xFF;
rFactor = sHeartsEnvFactors[0][0] * factor;
gFactor = sHeartsEnvFactors[0][1] * factor;
@ -259,50 +250,48 @@ void HealthMeter_Update(GlobalContext* globalCtx) {
ddType = type;
sHeartsDDPrim[0][0] = HeartDDOutline[0];
sHeartsDDPrim[0][1] = HeartDDOutline[1];
sHeartsDDPrim[0][2] = HeartDDOutline[2];
sHeartsDDPrim[0][0] = HeartDDOutline.r;
sHeartsDDPrim[0][1] = HeartDDOutline.g;
sHeartsDDPrim[0][2] = HeartDDOutline.b;
sHeartsDDEnv[0][0] = HeartDDInner[0];
sHeartsDDEnv[0][1] = HeartDDInner[1];
sHeartsDDEnv[0][2] = HeartDDInner[2];
sHeartsDDEnv[0][0] = HeartDDInner.r;
sHeartsDDEnv[0][1] = HeartDDInner.g;
sHeartsDDEnv[0][2] = HeartDDInner.b;
if (CVar_GetS32("gHudColors", 1) == 2) {
sHeartsDDPrim[2][0] = CVar_GetS32("gCCDDHeartsPrimR", 255);
sHeartsDDPrim[2][1] = CVar_GetS32("gCCDDHeartsPrimG", 70);
sHeartsDDPrim[2][2] = CVar_GetS32("gCCDDHeartsPrimB", 50);
sHeartsDDPrim[2][0] = HeartDDInner.r;
sHeartsDDPrim[2][1] = HeartDDInner.g;
sHeartsDDPrim[2][2] = HeartDDInner.b;
sHeartsDDPrim[1][0] = HeartDDOutline[0];
sHeartsDDPrim[1][1] = HeartDDOutline[1];
sHeartsDDPrim[1][2] = HeartDDOutline[2];
sHeartsDDPrim[1][0] = HeartDDOutline.r;
sHeartsDDPrim[1][1] = HeartDDOutline.g;
sHeartsDDPrim[1][2] = HeartDDOutline.b;
sHeartsDDEnv[1][0] = CVar_GetS32("gCCDDHeartsPrimR", 255);
sHeartsDDEnv[1][1] = CVar_GetS32("gCCDDHeartsPrimG", 70);
sHeartsDDEnv[1][2] = CVar_GetS32("gCCDDHeartsPrimB", 50);
sHeartsDDEnv[1][0] = HeartDDInner.r;
sHeartsDDEnv[1][1] = HeartDDInner.g;
sHeartsDDEnv[1][2] = HeartDDInner.b;
HeartDDInner[0] = CVar_GetS32("gCCDDHeartsPrimR", 255);
HeartDDInner[1] = CVar_GetS32("gCCDDHeartsPrimG", 70);
HeartDDInner[2] = CVar_GetS32("gCCDDHeartsPrimB", 50);
HeartDDInner = CVar_GetRGB("gCCDDHeartsPrim", HeartDDInner_ori);
sHeartsDDEnv[0][0] = CVar_GetS32("gCCDDHeartsPrimR", 255);
sHeartsDDEnv[0][1] = CVar_GetS32("gCCDDHeartsPrimG", 70);
sHeartsDDEnv[0][2] = CVar_GetS32("gCCDDHeartsPrimB", 0);
sHeartsDDEnv[0][0] = HeartDDInner.r;
sHeartsDDEnv[0][1] = HeartDDInner.g;
sHeartsDDEnv[0][2] = HeartDDInner.b;
rFactor = sHeartsDDPrimFactors[ddType][0] * ddFactor;
gFactor = sHeartsDDPrimFactors[ddType][1] * ddFactor;
bFactor = sHeartsDDPrimFactors[ddType][2] * ddFactor;
sBeatingHeartsDDPrim[0] = (u8)(rFactor + HeartDDOutline[0]) & 0xFF;
sBeatingHeartsDDPrim[1] = (u8)(gFactor + HeartDDOutline[1]) & 0xFF;
sBeatingHeartsDDPrim[2] = (u8)(bFactor + HeartDDOutline[2]) & 0xFF;
sBeatingHeartsDDPrim[0] = (u8)(rFactor + HeartDDOutline.r) & 0xFF;
sBeatingHeartsDDPrim[1] = (u8)(gFactor + HeartDDOutline.g) & 0xFF;
sBeatingHeartsDDPrim[2] = (u8)(bFactor + HeartDDOutline.b) & 0xFF;
rFactor = sHeartsDDEnvFactors[ddType][0] * ddFactor;
gFactor = sHeartsDDEnvFactors[ddType][1] * ddFactor;
bFactor = sHeartsDDEnvFactors[ddType][2] * ddFactor;
sBeatingHeartsDDEnv[0] = (u8)(rFactor + HeartDDInner[0]) & 0xFF;
sBeatingHeartsDDEnv[1] = (u8)(gFactor + HeartDDInner[1]) & 0xFF;
sBeatingHeartsDDEnv[2] = (u8)(bFactor + HeartDDInner[2]) & 0xFF;
sBeatingHeartsDDEnv[0] = (u8)(rFactor + HeartDDInner.r) & 0xFF;
sBeatingHeartsDDEnv[1] = (u8)(gFactor + HeartDDInner.g) & 0xFF;
sBeatingHeartsDDEnv[2] = (u8)(bFactor + HeartDDInner.b) & 0xFF;
} else {
sHeartsDDPrim[0][0] = HEARTS_DD_PRIM_R;
sHeartsDDPrim[0][1] = HEARTS_DD_PRIM_G;
@ -413,6 +402,12 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
s32 curCombineModeSet = 0;
u8* curBgImgLoaded = NULL;
s32 ddHeartCountMinusOne = gSaveContext.inventory.defenseHearts - 1;
float HeartsScale = 0.7f;
if (CVar_GetS32("gHeartsCountPosType", 0) != 0) {
HeartsScale = CVar_GetFloat("gHeartsCountScale", 0.7f);
}
static u32 epoch = 0;
epoch++;
OPEN_DISPS(gfxCtx);
@ -433,14 +428,14 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
s16 PosX_original = OTRGetDimensionFromLeftEdge(0.0f)+X_Margins;
s16 PosY_original = 0.0f+Y_Margins;
if (CVar_GetS32("gHeartsCountPosType", 0) != 0) {
offsetY = CVar_GetS32("gHeartsPosY", 0)+Y_Margins;
offsetY = CVar_GetS32("gHeartsCountPosY", 0)+Y_Margins+(HeartsScale*15);
if (CVar_GetS32("gHeartsCountPosType", 0) == 1) {//Anchor Left
offsetX = OTRGetDimensionFromLeftEdge(CVar_GetS32("gHeartsPosX", 0)+X_Margins);
offsetX = OTRGetDimensionFromLeftEdge(CVar_GetS32("gHeartsCountPosX", 0)+X_Margins+70.0f);
} else if (CVar_GetS32("gHeartsCountPosType", 0) == 2) {//Anchor Right
X_Margins = Right_LM_Margin;
offsetX = OTRGetDimensionFromRightEdge(CVar_GetS32("gHeartsPosX", 0)+X_Margins);
offsetX = OTRGetDimensionFromRightEdge(CVar_GetS32("gHeartsCountPosX", 0)+X_Margins+70.0f);
} else if (CVar_GetS32("gHeartsCountPosType", 0) == 3) {//Anchor None
offsetX = CVar_GetS32("gHeartsPosX", 0);
offsetX = CVar_GetS32("gHeartsCountPosX", 0)+70.0f;
} else if (CVar_GetS32("gHeartsCountPosType", 0) == 4) {//Hidden
offsetX = -9999;
}
@ -568,16 +563,27 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
}
}
temp3 = 26.0f + offsetY;
temp2 = 30.0f + offsetX;
temp4 = 1.0f;
temp4 /= 0.68f;
temp3 = offsetY;
temp2 = offsetX;
temp4 = 1.0f;//Heart texture size
temp4 /= 0.68f; //Hearts Scaled size
temp4 *= 1 << 10;
temp1 = 8.0f;
temp1 *= 0.68f;
gSPWideTextureRectangle(OVERLAY_DISP++, (s32)((temp2 - temp1) * 4), (s32)((temp3 - temp1) * 4),
/*gSPWideTextureRectangle(OVERLAY_DISP++, (s32)((temp2 - temp1) * 4), (s32)((temp3 - temp1) * 4),
(s32)((temp2 + temp1) * 4), (s32)((temp3 + temp1) * 4), G_TX_RENDERTILE, 0, 0,
(s32)temp4, (s32)temp4);
(s32)temp4, (s32)temp4);*/
Mtx* matrix = Graph_Alloc(gfxCtx, sizeof(Mtx));
Matrix_SetTranslateScaleMtx2(matrix,
HeartsScale, //Scale X
HeartsScale, //Scale Y
HeartsScale, //Scale Z
-130+offsetX, //Pos X
(-94+offsetY) *-1, //Pos Y
0.0f); //Pos Z
gSPMatrix(OVERLAY_DISP++, matrix, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPVertex(OVERLAY_DISP++, sp154, 4, 0);
gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0);
} else {
if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) {
if (curCombineModeSet != 2) {
@ -597,28 +603,33 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
{
Mtx* matrix = Graph_Alloc(gfxCtx, sizeof(Mtx));
Matrix_SetTranslateScaleMtx2(matrix, 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144),
1.0f - (0.32f * sp144), -130.0f + offsetX,
94.5f - offsetY, 0.0f);
Matrix_SetTranslateScaleMtx2(matrix,
HeartsScale+(HeartsScale/3) - ((HeartsScale/3) * sp144),
HeartsScale+(HeartsScale/3) - ((HeartsScale/3) * sp144),
HeartsScale+(HeartsScale/3) - ((HeartsScale/3) * sp144),
-130+offsetX, //Pos X
(-94+offsetY) *-1, //Pos Y
0.0f);
gSPMatrix(OVERLAY_DISP++, matrix, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPVertex(OVERLAY_DISP++, sp154, 4, 0);
gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0);
}
}
offsetX += 10.0f;
//offsetX += 10.0f;
offsetX += (HeartsScale*14.5f);
if (i == 9) {
PosX_original = OTRGetDimensionFromLeftEdge(0.0f)+X_Margins;
PosY_original = 10.0f+Y_Margins;
PosY_original = (HeartsScale*15)+Y_Margins;
if (CVar_GetS32("gHeartsCountPosType", 0) != 0) {
offsetY = CVar_GetS32("gHeartsPosY", 0)+Y_Margins+10.0f;
offsetY = CVar_GetS32("gHeartsCountPosY", 0)+((HeartsScale*15)*2)+Y_Margins;
if (CVar_GetS32("gHeartsCountPosType", 0) == 1) {//Anchor Left
offsetX = OTRGetDimensionFromLeftEdge(CVar_GetS32("gHeartsPosX", 0)+X_Margins);
offsetX = OTRGetDimensionFromLeftEdge(CVar_GetS32("gHeartsCountPosX", 0)+X_Margins+70.0f);
} else if (CVar_GetS32("gHeartsCountPosType", 0) == 2) {//Anchor Right
X_Margins = Right_LM_Margin;
offsetX = OTRGetDimensionFromRightEdge(CVar_GetS32("gHeartsPosX", 0)+X_Margins);
offsetX = OTRGetDimensionFromRightEdge(CVar_GetS32("gHeartsCountPosX", 0)+X_Margins+70.0f);
} else if (CVar_GetS32("gHeartsCountPosType", 0) == 3) {//Anchor None
offsetX = CVar_GetS32("gHeartsPosX", 0);
offsetX = CVar_GetS32("gHeartsCountPosX", 0)+70.0f;
} else if (CVar_GetS32("gHeartsCountPosType", 0) == 4) {//Hidden
offsetX = -9999;
}

View File

@ -601,6 +601,8 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
s32 pad;
Player* player = GET_PLAYER(globalCtx);
s16 tempX, tempZ;
const Color_RGB8 LastEntrance_arrow = { 200, 0, 0 };
const Color_RGB8 CurrentPosition_arrow = { 200, 255, 0 };
s16 X_Margins_Minimap;
s16 Y_Margins_Minimap;
if (CVar_GetS32("gMinimapUseMargins", 0) != 0) {
@ -658,9 +660,9 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, CVar_GetS32("gCCMinimapCPPrimR", 200), CVar_GetS32("gCCMinimapCPPrimG", 255), CVar_GetS32("gCCMinimapCPPrimB", 0), 255);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, CVar_GetRGB("gCCMinimapCPPrim", CurrentPosition_arrow).r, CVar_GetRGB("gCCMinimapCPPrim", CurrentPosition_arrow).g, CVar_GetRGB("gCCMinimapCPPrim", CurrentPosition_arrow).b, 255);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, 200, 255, 0, 255);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, CurrentPosition_arrow.r, CurrentPosition_arrow.g, CurrentPosition_arrow.b, 255);
}
gSPDisplayList(OVERLAY_DISP++, gCompassArrowDL);
@ -699,9 +701,9 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, CVar_GetS32("gCCMinimapLEPrimR", 200), CVar_GetS32("gCCMinimapLEPrimG", 0), CVar_GetS32("gCCMinimapLEPrimB", 0), 255);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, CVar_GetRGB("gCCMinimapLEPrim", LastEntrance_arrow).r,CVar_GetRGB("gCCMinimapLEPrim", LastEntrance_arrow).g,CVar_GetRGB("gCCMinimapLEPrim", LastEntrance_arrow).b, 255);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, 200, 0, 0, 255);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, LastEntrance_arrow.r, LastEntrance_arrow.g, LastEntrance_arrow.b, 255);
}
gSPDisplayList(OVERLAY_DISP++, gCompassArrowDL);
}
@ -713,6 +715,8 @@ void Minimap_Draw(GlobalContext* globalCtx) {
s32 pad[2];
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
s32 mapIndex = gSaveContext.mapIndex;
const Color_RGB8 Dungeon_minimap = {100, 255, 255};
const Color_RGB8 Overworld_minimap = {R_MINIMAP_COLOR(0), R_MINIMAP_COLOR(1), R_MINIMAP_COLOR(2)};
OPEN_DISPS(globalCtx->state.gfxCtx);
@ -751,9 +755,9 @@ void Minimap_Draw(GlobalContext* globalCtx) {
if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, mapIndex)) {
if (CVar_GetS32("gHudColors", 1) == 2) { //Dungeon minimap
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCMinimapDGNPrimR", R_MINIMAP_COLOR(0)), CVar_GetS32("gCCMinimapDGNPrimG", R_MINIMAP_COLOR(1)), CVar_GetS32("gCCMinimapDGNPrimB", R_MINIMAP_COLOR(2)), interfaceCtx->minimapAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCMinimapDGNPrim", Dungeon_minimap).r,CVar_GetRGB("gCCMinimapDGNPrim", Dungeon_minimap).g,CVar_GetRGB("gCCMinimapDGNPrim", Dungeon_minimap).b, interfaceCtx->minimapAlpha);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 255, 255, interfaceCtx->minimapAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, Dungeon_minimap.r, Dungeon_minimap.g, Dungeon_minimap.b, interfaceCtx->minimapAlpha);
}
gSPInvalidateTexCache(OVERLAY_DISP++, interfaceCtx->mapSegment);
@ -826,9 +830,9 @@ void Minimap_Draw(GlobalContext* globalCtx) {
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
if (CVar_GetS32("gHudColors", 1) == 2) {//Overworld minimap
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCMinimapPrimR", R_MINIMAP_COLOR(0)), CVar_GetS32("gCCMinimapPrimG", R_MINIMAP_COLOR(1)), CVar_GetS32("gCCMinimapPrimB", R_MINIMAP_COLOR(2)), interfaceCtx->minimapAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCMinimapPrim", Overworld_minimap).r,CVar_GetRGB("gCCMinimapPrim", Overworld_minimap).g,CVar_GetRGB("gCCMinimapPrim", Overworld_minimap).b, interfaceCtx->minimapAlpha);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_MINIMAP_COLOR(0), R_MINIMAP_COLOR(1), R_MINIMAP_COLOR(2), interfaceCtx->minimapAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, Overworld_minimap.r, Overworld_minimap.g, Overworld_minimap.b, interfaceCtx->minimapAlpha);
}
gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->mapSegment, G_IM_FMT_IA,
@ -858,7 +862,7 @@ void Minimap_Draw(GlobalContext* globalCtx) {
0, 1 << 10, 1 << 10);
if (CVar_GetS32("gHudColors", 1) != 2) {//This need to be added else it will color dungeon entrance icon too. (it re-init prim color to default color)
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_MINIMAP_COLOR(0), R_MINIMAP_COLOR(1), R_MINIMAP_COLOR(2), interfaceCtx->minimapAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, Overworld_minimap.r, Overworld_minimap.g, Overworld_minimap.b, interfaceCtx->minimapAlpha);
}
if (((globalCtx->sceneNum != SCENE_SPOT01) && (globalCtx->sceneNum != SCENE_SPOT04) &&

View File

@ -166,9 +166,8 @@ static u16 sCUpTimer = 0;
s16 gSpoilingItems[] = { ITEM_ODD_MUSHROOM, ITEM_FROG, ITEM_EYEDROPS };
s16 gSpoilingItemReverts[] = { ITEM_COJIRO, ITEM_PRESCRIPTION, ITEM_PRESCRIPTION };
static s16 sMagicBorderR = 255;
static s16 sMagicBorderG = 255;
static s16 sMagicBorderB = 255;
static Color_RGB8 sMagicBorder = {255,255,255};
static Color_RGB8 sMagicBorder_ori = {255,255,255};
static s16 sExtraItemBases[] = {
ITEM_STICK, ITEM_STICK, ITEM_NUT, ITEM_NUT, ITEM_BOMB, ITEM_BOMB, ITEM_BOMB, ITEM_BOMB, ITEM_BOW,
@ -2964,23 +2963,27 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
{ 255, 255, 150 },
{ 255, 255, 50 },
};
Color_RGB8 MagicBorder_0 = { 255, 255, 255 };
Color_RGB8 MagicBorder_1 = { 150, 150, 150 };
Color_RGB8 MagicBorder_2 = { 255, 255, 150 };
Color_RGB8 MagicBorder_3 = { 255, 255, 50 };
if (CVar_GetS32("gHudColors", 1) == 2) { //This will make custom color based on users selected colors.
sMagicBorderColors[0][0] = CVar_GetS32("gCCMagicBorderPrimR", 255);
sMagicBorderColors[0][1] = CVar_GetS32("gCCMagicBorderPrimG", 255);
sMagicBorderColors[0][2] = CVar_GetS32("gCCMagicBorderPrimB", 255);
sMagicBorderColors[0][0] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_0).r;
sMagicBorderColors[0][1] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_0).g;
sMagicBorderColors[0][2] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_0).b;
sMagicBorderColors[1][0] = CVar_GetS32("gCCMagicBorderPrimR", 255)/2;
sMagicBorderColors[1][1] = CVar_GetS32("gCCMagicBorderPrimG", 255)/2;
sMagicBorderColors[1][2] = CVar_GetS32("gCCMagicBorderPrimB", 255)/2;
sMagicBorderColors[1][0] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_1).r/2;
sMagicBorderColors[1][1] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_1).g/2;
sMagicBorderColors[1][2] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_1).b/2;
sMagicBorderColors[2][0] = CVar_GetS32("gCCMagicBorderPrimR", 255)/3;
sMagicBorderColors[2][1] = CVar_GetS32("gCCMagicBorderPrimG", 255)/3;
sMagicBorderColors[2][2] = CVar_GetS32("gCCMagicBorderPrimB", 255)/3;
sMagicBorderColors[2][0] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_2).r/2.5;
sMagicBorderColors[2][1] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_2).g/2.5;
sMagicBorderColors[2][2] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_2).b/2.5;
sMagicBorderColors[3][0] = CVar_GetS32("gCCMagicBorderPrimR", 255)/2;
sMagicBorderColors[3][1] = CVar_GetS32("gCCMagicBorderPrimG", 255)/2;
sMagicBorderColors[3][2] = CVar_GetS32("gCCMagicBorderPrimB", 255)/2;
sMagicBorderColors[3][0] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_3).r/3;
sMagicBorderColors[3][1] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_3).g/3;
sMagicBorderColors[3][2] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_3).b/3;
}
static s16 sMagicBorderIndexes[] = { 0, 1, 1, 0 };
@ -3041,53 +3044,49 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
gSaveContext.magic = 0;
gSaveContext.unk_13F0 = 3;
if (CVar_GetS32("gHudColors", 1) == 2) {
sMagicBorderR = CVar_GetS32("gCCMagicBorderNormPrimR", 255);
sMagicBorderG = CVar_GetS32("gCCMagicBorderNormPrimG", 255);
sMagicBorderB = CVar_GetS32("gCCMagicBorderNormPrimB", 255);
sMagicBorder = CVar_GetRGB("gCCMagicBorderNormPrim", sMagicBorder_ori);
} else {
sMagicBorderR = sMagicBorderG = sMagicBorderB = 255;
sMagicBorder = sMagicBorder_ori;
}
} else if (gSaveContext.magic == gSaveContext.unk_13F8) {
gSaveContext.unk_13F0 = 3;
if (CVar_GetS32("gHudColors", 1) == 2) {
sMagicBorderR = CVar_GetS32("gCCMagicBorderNormPrimR", 255);
sMagicBorderG = CVar_GetS32("gCCMagicBorderNormPrimG", 255);
sMagicBorderB = CVar_GetS32("gCCMagicBorderNormPrimB", 255);
sMagicBorder = CVar_GetRGB("gCCMagicBorderNormPrim", sMagicBorder_ori);
} else {
sMagicBorderR = sMagicBorderG = sMagicBorderB = 255;
sMagicBorder = sMagicBorder_ori;
}
}
case 3:
case 4:
case 6:
temp = sMagicBorderIndexes[sMagicBorderStep];
borderChangeR = ABS(sMagicBorderR - sMagicBorderColors[temp][0]) / sMagicBorderRatio;
borderChangeG = ABS(sMagicBorderG - sMagicBorderColors[temp][1]) / sMagicBorderRatio;
borderChangeB = ABS(sMagicBorderB - sMagicBorderColors[temp][2]) / sMagicBorderRatio;
borderChangeR = ABS(sMagicBorder.r - sMagicBorderColors[temp][0]) / sMagicBorderRatio;
borderChangeG = ABS(sMagicBorder.g - sMagicBorderColors[temp][1]) / sMagicBorderRatio;
borderChangeB = ABS(sMagicBorder.b - sMagicBorderColors[temp][2]) / sMagicBorderRatio;
if (sMagicBorderR >= sMagicBorderColors[temp][0]) {
sMagicBorderR -= borderChangeR;
if (sMagicBorder.r >= sMagicBorderColors[temp][0]) {
sMagicBorder.r -= borderChangeR;
} else {
sMagicBorderR += borderChangeR;
sMagicBorder.r += borderChangeR;
}
if (sMagicBorderG >= sMagicBorderColors[temp][1]) {
sMagicBorderG -= borderChangeG;
if (sMagicBorder.g >= sMagicBorderColors[temp][1]) {
sMagicBorder.g -= borderChangeG;
} else {
sMagicBorderG += borderChangeG;
sMagicBorder.g += borderChangeG;
}
if (sMagicBorderB >= sMagicBorderColors[temp][2]) {
sMagicBorderB -= borderChangeB;
if (sMagicBorder.b >= sMagicBorderColors[temp][2]) {
sMagicBorder.b -= borderChangeB;
} else {
sMagicBorderB += borderChangeB;
sMagicBorder.b += borderChangeB;
}
sMagicBorderRatio--;
if (sMagicBorderRatio == 0) {
sMagicBorderR = sMagicBorderColors[temp][0];
sMagicBorderG = sMagicBorderColors[temp][1];
sMagicBorderB = sMagicBorderColors[temp][2];
sMagicBorder.r = sMagicBorderColors[temp][0];
sMagicBorder.g = sMagicBorderColors[temp][1];
sMagicBorder.b = sMagicBorderColors[temp][2];
sMagicBorderRatio = YREG(40 + sMagicBorderStep);
sMagicBorderStep++;
if (sMagicBorderStep >= 4) {
@ -3098,11 +3097,9 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
case 5:
if (CVar_GetS32("gHudColors", 1) == 2) {
sMagicBorderR = CVar_GetS32("gCCMagicBorderNormPrimR", 255);
sMagicBorderG = CVar_GetS32("gCCMagicBorderNormPrimG", 255);
sMagicBorderB = CVar_GetS32("gCCMagicBorderNormPrimB", 255);
sMagicBorder = CVar_GetRGB("gCCMagicBorderNormPrim", sMagicBorder_ori);
} else {
sMagicBorderR = sMagicBorderG = sMagicBorderB = 255;
sMagicBorder = sMagicBorder_ori;
}
gSaveContext.unk_13F0 = 0;
break;
@ -3126,11 +3123,9 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
&D_801333E8);
gSaveContext.unk_13F0 = 0;
if (CVar_GetS32("gHudColors", 1) == 2) {
sMagicBorderR = CVar_GetS32("gCCMagicBorderNormPrimR", 255);
sMagicBorderG = CVar_GetS32("gCCMagicBorderNormPrimG", 255);
sMagicBorderB = CVar_GetS32("gCCMagicBorderNormPrimB", 255);
sMagicBorder = CVar_GetRGB("gCCMagicBorderNormPrim", sMagicBorder_ori);
} else {
sMagicBorderR = sMagicBorderG = sMagicBorderB = 255;
sMagicBorder = sMagicBorder_ori;
}
break;
}
@ -3143,33 +3138,33 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
}
temp = sMagicBorderIndexes[sMagicBorderStep];
borderChangeR = ABS(sMagicBorderR - sMagicBorderColors[temp][0]) / sMagicBorderRatio;
borderChangeG = ABS(sMagicBorderG - sMagicBorderColors[temp][1]) / sMagicBorderRatio;
borderChangeB = ABS(sMagicBorderB - sMagicBorderColors[temp][2]) / sMagicBorderRatio;
borderChangeR = ABS(sMagicBorder.r - sMagicBorderColors[temp][0]) / sMagicBorderRatio;
borderChangeG = ABS(sMagicBorder.g - sMagicBorderColors[temp][1]) / sMagicBorderRatio;
borderChangeB = ABS(sMagicBorder.b - sMagicBorderColors[temp][2]) / sMagicBorderRatio;
if (sMagicBorderR >= sMagicBorderColors[temp][0]) {
sMagicBorderR -= borderChangeR;
if (sMagicBorder.r >= sMagicBorderColors[temp][0]) {
sMagicBorder.r -= borderChangeR;
} else {
sMagicBorderR += borderChangeR;
sMagicBorder.r += borderChangeR;
}
if (sMagicBorderG >= sMagicBorderColors[temp][1]) {
sMagicBorderG -= borderChangeG;
if (sMagicBorder.g >= sMagicBorderColors[temp][1]) {
sMagicBorder.g -= borderChangeG;
} else {
sMagicBorderG += borderChangeG;
sMagicBorder.g += borderChangeG;
}
if (sMagicBorderB >= sMagicBorderColors[temp][2]) {
sMagicBorderB -= borderChangeB;
if (sMagicBorder.b >= sMagicBorderColors[temp][2]) {
sMagicBorder.b -= borderChangeB;
} else {
sMagicBorderB += borderChangeB;
sMagicBorder.b += borderChangeB;
}
sMagicBorderRatio--;
if (sMagicBorderRatio == 0) {
sMagicBorderR = sMagicBorderColors[temp][0];
sMagicBorderG = sMagicBorderColors[temp][1];
sMagicBorderB = sMagicBorderColors[temp][2];
sMagicBorder.r = sMagicBorderColors[temp][0];
sMagicBorder.g = sMagicBorderColors[temp][1];
sMagicBorder.b = sMagicBorderColors[temp][2];
sMagicBorderRatio = YREG(40 + sMagicBorderStep);
sMagicBorderStep++;
if (sMagicBorderStep >= 4) {
@ -3197,6 +3192,8 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
void Interface_DrawMagicBar(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
s16 magicBarY;
Color_RGB8 magicbar_yellow = {250,250,0}; //Magic bar being used
Color_RGB8 magicbar_green = {R_MAGIC_FILL_COLOR(0),R_MAGIC_FILL_COLOR(1),R_MAGIC_FILL_COLOR(2)}; //Magic bar fill
OPEN_DISPS(globalCtx->state.gfxCtx);
@ -3265,7 +3262,7 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) {
} else {
gDPSetEnvColor(OVERLAY_DISP++, 100, 50, 50, 255);
}
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sMagicBorderR, sMagicBorderG, sMagicBorderB, interfaceCtx->magicAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sMagicBorder.r, sMagicBorder.g, sMagicBorder.b, interfaceCtx->magicAlpha);
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gMagicBarEndTex, 8, 16, PosX_Start, magicBarY, 8, 16, 1 << 10, 1 << 10);
@ -3286,9 +3283,9 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) {
if (gSaveContext.unk_13F0 == 4) {
// Yellow part of the bar indicating the amount of magic to be subtracted
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCMagicUsePrimR", 250), CVar_GetS32("gCCMagicUsePrimG", 250), CVar_GetS32("gCCMagicUsePrimB", 0), interfaceCtx->magicAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCMagicUsePrim", magicbar_yellow).r, CVar_GetRGB("gCCMagicUsePrim", magicbar_yellow).g, CVar_GetRGB("gCCMagicUsePrim", magicbar_yellow).b, interfaceCtx->magicAlpha);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 250, 250, 0, interfaceCtx->magicAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, magicbar_yellow.r, magicbar_yellow.g, magicbar_yellow.b, interfaceCtx->magicAlpha);
}
gDPLoadMultiBlock_4b(OVERLAY_DISP++, gMagicBarFillTex, 0, G_TX_RENDERTILE, G_IM_FMT_I, 16, 16, 0,
@ -3302,9 +3299,9 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) {
// Fill the rest of the bar with the normal magic color
gDPPipeSync(OVERLAY_DISP++);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCMagicPrimR", 0), CVar_GetS32("gCCMagicPrimG", 200), CVar_GetS32("gCCMagicPrimB", 0), interfaceCtx->magicAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCMagicPrim", magicbar_green).r, CVar_GetRGB("gCCMagicPrim", magicbar_green).g, CVar_GetRGB("gCCMagicPrim", magicbar_green).b, interfaceCtx->magicAlpha);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), R_MAGIC_FILL_COLOR(2), interfaceCtx->magicAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, magicbar_green.r, magicbar_green.g, magicbar_green.b, interfaceCtx->magicAlpha);
}
gSPWideTextureRectangle(OVERLAY_DISP++, rMagicFillX << 2, (magicBarY + 3) << 2,
@ -3313,9 +3310,9 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) {
} else {
// Fill the whole bar with the normal magic color
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCMagicPrimR", 0), CVar_GetS32("gCCMagicPrimG", 200), CVar_GetS32("gCCMagicPrimB", 0), interfaceCtx->magicAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCMagicPrim", magicbar_green).r, CVar_GetRGB("gCCMagicPrim", magicbar_green).g, CVar_GetRGB("gCCMagicPrim", magicbar_green).b, interfaceCtx->magicAlpha);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), R_MAGIC_FILL_COLOR(2), interfaceCtx->magicAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, magicbar_green.r, magicbar_green.g, magicbar_green.b, interfaceCtx->magicAlpha);
}
gDPLoadMultiBlock_4b(OVERLAY_DISP++, gMagicBarFillTex, 0, G_TX_RENDERTILE, G_IM_FMT_I, 16, 16, 0,
@ -3389,10 +3386,28 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
s16 dxdy;
s16 width;
s16 height;
Color_RGB8 A_button_ori = {R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2)};
Color_RGB8 A_button = CVar_GetRGB("gCCABtnPrim", A_button_ori);
Color_RGB8 B_button_ori = {R_B_BTN_COLOR(0), R_B_BTN_COLOR(1), R_B_BTN_COLOR(2)};
Color_RGB8 B_button = CVar_GetRGB("gCCBBtnPrim", B_button_ori);
Color_RGB8 Start_button_ori = {120, 120, 120};
Color_RGB8 Start_button = CVar_GetRGB("gCCStartBtnPrim", Start_button_ori);
Color_RGB8 C_button_ori = {R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2)};
Color_RGB8 C_button_uni = CVar_GetRGB("gCCCBtnPrim", C_button_ori);
Color_RGB8 C_button_U = CVar_GetRGB("gCCCUBtnPrim", C_button_ori);
Color_RGB8 C_button_D = CVar_GetRGB("gCCCDBtnPrim", C_button_ori);
Color_RGB8 C_button_L = CVar_GetRGB("gCCCLBtnPrim", C_button_ori);
Color_RGB8 C_button_R = CVar_GetRGB("gCCCRBtnPrim", C_button_ori);
//B Button
s16 X_Margins_BtnB;
s16 Y_Margins_BtnB;
s16 BBtn_Size = 32;
int BBtnScaled = BBtn_Size * 0.95f;
if (CVar_GetS32("gBBtnPosType", 0) != 0) {
BBtnScaled = BBtn_Size * CVar_GetFloat("gBBtnScale", 0.95f);
}
int BBtn_factor = (1 << 10) * BBtn_Size / BBtnScaled;
if (CVar_GetS32("gBBtnUseMargins", 0) != 0) {
if (CVar_GetS32("gBBtnPosType", 0) == 0) {X_Margins_BtnB = Right_HUD_Margin;};
Y_Margins_BtnB = (Top_HUD_Margin*-1);
@ -3435,49 +3450,40 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
}
s16 StartBtn_Icon_H = 32;
s16 StartBtn_Icon_W = 32;
int StartBTN_H_Scaled = StartBtn_Icon_H * 0.75f;
int StartBTN_W_Scaled = StartBtn_Icon_W * 0.75f;
float Start_BTN_Scale = 0.75f;
if (CVar_GetS32("gStartBtnPosType", 0) != 0) {
Start_BTN_Scale = CVar_GetFloat("gStartBtnScale", 0.75f);
}
int StartBTN_H_Scaled = StartBtn_Icon_H * Start_BTN_Scale;
int StartBTN_W_Scaled = StartBtn_Icon_W * Start_BTN_Scale;
int StartBTN_W_factor = (1 << 10) * StartBtn_Icon_W / StartBTN_W_Scaled;
int StartBTN_H_factor = (1 << 10) * StartBtn_Icon_H / StartBTN_H_Scaled;
const s16 rStartLabelX_ori = OTRGetRectDimensionFromRightEdge(R_START_LABEL_X(gSaveContext.language)+X_Margins_StartBtn);
const s16 rStartLabelY_ori = R_START_LABEL_Y(gSaveContext.language)+Y_Margins_StartBtn;
const s16 PosX_StartBtn_ori = OTRGetRectDimensionFromRightEdge(startButtonLeftPos[gSaveContext.language]+X_Margins_StartBtn);
const s16 PosY_StartBtn_ori = 16+Y_Margins_StartBtn;
s16 StartBTN_Label_W = DO_ACTION_TEX_WIDTH();
s16 StartBTN_Label_H = DO_ACTION_TEX_HEIGHT();
int StartBTN_Label_H_Scaled = StartBTN_Label_H * 1.0f;
int StartBTN_Label_W_Scaled = StartBTN_Label_W * 1.0f;
int StartBTN_Label_W_factor = (1 << 10) * StartBTN_Label_W / StartBTN_Label_W_Scaled;
int StartBTN_Label_H_factor = (1 << 10) * StartBTN_Label_H / StartBTN_Label_H_Scaled;
const s16 StartBtn_Label_W_ori = StartBTN_Label_W / (R_START_LABEL_DD(gSaveContext.language) / 100.0f);
const s16 StartBtn_Label_H_ori = StartBTN_Label_H / (R_START_LABEL_DD(gSaveContext.language) / 100.0f);
s16 PosX_StartBtn;
s16 PosY_StartBtn;
s16 rStartLabelX;
s16 rStartLabelY;
if (CVar_GetS32("gStartBtnPosType", 0) != 0) {
PosY_StartBtn = CVar_GetS32("gStartBtnPosY", 0)+Y_Margins_StartBtn;
rStartLabelY = CVar_GetS32("gStartBtnPosY", 0)+Y_Margins_StartBtn+3;
PosY_StartBtn = CVar_GetS32("gStartBtnPosY", 0)-(Start_BTN_Scale*13)+Y_Margins_StartBtn;
if (CVar_GetS32("gStartBtnPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gStartBtnUseMargins", 0) != 0) {X_Margins_StartBtn = Left_HUD_Margin;};
PosX_StartBtn = OTRGetDimensionFromLeftEdge(CVar_GetS32("gStartBtnPosX", 0)+X_Margins_StartBtn);
rStartLabelX = OTRGetDimensionFromLeftEdge(CVar_GetS32("gStartBtnPosX", 0)+X_Margins_StartBtn-12);
PosX_StartBtn = OTRGetDimensionFromLeftEdge(CVar_GetS32("gStartBtnPosX", 0)-(Start_BTN_Scale*13)+X_Margins_StartBtn);
} else if (CVar_GetS32("gStartBtnPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gStartBtnUseMargins", 0) != 0) {X_Margins_StartBtn = Right_HUD_Margin;};
PosX_StartBtn = OTRGetDimensionFromRightEdge(CVar_GetS32("gStartBtnPosX", 0)+X_Margins_StartBtn);
rStartLabelX = OTRGetDimensionFromRightEdge(CVar_GetS32("gStartBtnPosX", 0)+X_Margins_StartBtn-12);
PosX_StartBtn = OTRGetDimensionFromRightEdge(CVar_GetS32("gStartBtnPosX", 0)-(Start_BTN_Scale*13)+X_Margins_StartBtn);
} else if (CVar_GetS32("gStartBtnPosType", 0) == 3) {//Anchor None
PosX_StartBtn = CVar_GetS32("gStartBtnPosX", 0);
rStartLabelX = CVar_GetS32("gStartBtnPosX", 0)-12;
} else if (CVar_GetS32("gStartBtnPosType", 0) == 4) {//Hidden
PosX_StartBtn = -9999;
rStartLabelX = -9999;
}
} else {
StartBTN_H_Scaled = StartBtn_Icon_H * 0.75f;
StartBTN_W_Scaled = StartBtn_Icon_W * 0.75f;
StartBTN_W_factor = (1 << 10) * StartBtn_Icon_W / StartBTN_W_Scaled;
StartBTN_H_factor = (1 << 10) * StartBtn_Icon_H / StartBTN_H_Scaled;
PosY_StartBtn = PosY_StartBtn_ori;
PosX_StartBtn = PosX_StartBtn_ori;
rStartLabelY = rStartLabelY_ori;
rStartLabelX = rStartLabelX_ori;
}
//C Buttons position
s16 X_Margins_CL;
@ -3527,6 +3533,13 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
s16 C_Up_BTN_Pos[2];
s16 C_Down_BTN_Pos[2];
//C button Left
s16 C_Left_BTN_Size = 32;
float CLeftScale = CVar_GetFloat("gCBtnLScale", 0.87f);
int CLeftScaled = C_Left_BTN_Size * 0.87f;
if (CVar_GetS32("gCBtnLPosType", 0) != 0) {
CLeftScaled = C_Left_BTN_Size * CLeftScale;
}
int CLeft_factor = (1 << 10) * C_Left_BTN_Size / CLeftScaled;
if (CVar_GetS32("gCBtnLPosType", 0) != 0) {
C_Left_BTN_Pos[1] = CVar_GetS32("gCBtnLPosY", 0)+Y_Margins_CL;
if (CVar_GetS32("gCBtnLPosType", 0) == 1) {//Anchor Left
@ -3545,6 +3558,13 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
C_Left_BTN_Pos[0] = OTRGetRectDimensionFromRightEdge(C_Left_BTN_Pos_ori[0]);
}
//C button Right
s16 C_Right_BTN_Size = 32;
float CRightScale = CVar_GetFloat("gCBtnRScale", 0.87f);
int CRightScaled = C_Right_BTN_Size * 0.87f;
if (CVar_GetS32("gCBtnRPosType", 0) != 0) {
CRightScaled = C_Right_BTN_Size * CRightScale;
}
int CRight_factor = (1 << 10) * C_Right_BTN_Size / CRightScaled;
if (CVar_GetS32("gCBtnRPosType", 0) != 0) {
C_Right_BTN_Pos[1] = CVar_GetS32("gCBtnRPosY", 0)+Y_Margins_CR;
if (CVar_GetS32("gCBtnRPosType", 0) == 1) {//Anchor Left
@ -3563,16 +3583,23 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
C_Right_BTN_Pos[0] = OTRGetRectDimensionFromRightEdge(C_Right_BTN_Pos_ori[0]);
}
//C Button Up
s16 C_Up_BTN_Size = 32;
int CUpScaled = C_Up_BTN_Size * 0.5f;
float CUpScale = CVar_GetFloat("gCBtnUScale", 0.5f);
if (CVar_GetS32("gCBtnUPosType", 0) != 0) {
C_Up_BTN_Pos[1] = CVar_GetS32("gCBtnUPosY", 0)+Y_Margins_CU;
CUpScaled = C_Up_BTN_Size * CUpScale;
}
int CUp_factor = (1 << 10) * C_Up_BTN_Size / CUpScaled;
if (CVar_GetS32("gCBtnUPosType", 0) != 0) {
C_Up_BTN_Pos[1] = CVar_GetS32("gCBtnUPosY", 0)-(CUpScale*13)+Y_Margins_CU;
if (CVar_GetS32("gCBtnUPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gCBtnUUseMargins", 0) != 0) {X_Margins_CU = Left_HUD_Margin;};
C_Up_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnUPosX", 0)+X_Margins_CU);
C_Up_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnUPosX", 0)-(CUpScale*13)+X_Margins_CU);
} else if (CVar_GetS32("gCBtnUPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gCBtnUUseMargins", 0) != 0) {X_Margins_CU = Right_HUD_Margin;};
C_Up_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnUPosX", 0)+X_Margins_CU);
C_Up_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnUPosX", 0)-(CUpScale*13)+X_Margins_CU);
} else if (CVar_GetS32("gCBtnUPosType", 0) == 3) {//Anchor None
C_Up_BTN_Pos[0] = CVar_GetS32("gCBtnUPosX", 0);
C_Up_BTN_Pos[0] = CVar_GetS32("gCBtnUPosX", 0)-(CUpScale*13);
} else if (CVar_GetS32("gCBtnUPosType", 0) == 4) {//Hidden
C_Up_BTN_Pos[0] = -9999;
}
@ -3581,16 +3608,24 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
C_Up_BTN_Pos[0] = OTRGetRectDimensionFromRightEdge(C_Up_BTN_Pos_ori[0]);
}
//C Button down
s16 C_Down_BTN_Size = 32;
float CDownScale = CVar_GetFloat("gCBtnDScale", 0.87f);
if (CVar_GetS32("gCBtnDPosType", 0) == 0) {
CDownScale = 0.87f;
}
int CDownScaled = C_Down_BTN_Size * CDownScale;
int CDown_factor = (1 << 10) * C_Down_BTN_Size / CDownScaled;
int PositionAdjustment = CDownScaled/2;
if (CVar_GetS32("gCBtnDPosType", 0) != 0) {
C_Down_BTN_Pos[1] = CVar_GetS32("gCBtnDPosY", 0)+Y_Margins_CD;
C_Down_BTN_Pos[1] = CVar_GetS32("gCBtnDPosY", 0)-PositionAdjustment+Y_Margins_CD;
if (CVar_GetS32("gCBtnDPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Left_HUD_Margin;};
C_Down_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD);
C_Down_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnDPosX", 0)-PositionAdjustment+X_Margins_CD);
} else if (CVar_GetS32("gCBtnDPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Right_HUD_Margin;};
C_Down_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD);
C_Down_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnDPosX", 0)-PositionAdjustment+X_Margins_CD);
} else if (CVar_GetS32("gCBtnDPosType", 0) == 3) {//Anchor None
C_Down_BTN_Pos[0] = CVar_GetS32("gCBtnDPosX", 0);
C_Down_BTN_Pos[0] = CVar_GetS32("gCBtnDPosX", 0)-PositionAdjustment;
} else if (CVar_GetS32("gCBtnDPosType", 0) == 4) {//Hidden
C_Down_BTN_Pos[0] = -9999;
}
@ -3608,59 +3643,59 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
if (CVar_GetS32("gHudColors", 1) == 0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 150, 0, interfaceCtx->bAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_B_BTN_COLOR(0), R_B_BTN_COLOR(1), R_B_BTN_COLOR(2), interfaceCtx->bAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, B_button_ori.r,B_button_ori.g,B_button_ori.b, interfaceCtx->bAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCBBtnPrimR", R_B_BTN_COLOR(0)), CVar_GetS32("gCCBBtnPrimG", R_B_BTN_COLOR(1)), CVar_GetS32("gCCBBtnPrimB", R_B_BTN_COLOR(2)), interfaceCtx->bAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, B_button.r,B_button.g,B_button.b, interfaceCtx->bAlpha);
}
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255);
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gButtonBackgroundTex, 32, 32, PosX_BtnB, PosY_BtnB, R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_DD(0) << 1, R_ITEM_BTN_DD(0) << 1);
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gButtonBackgroundTex, BBtn_Size, BBtn_Size, PosX_BtnB, PosY_BtnB, BBtnScaled, BBtnScaled, BBtn_factor, BBtn_factor);
// C-Left Button Color & Texture
gDPPipeSync(OVERLAY_DISP++);
if (CVar_GetS32("gHudColors", 1) == 0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cLeftAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cLeftAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cLeftAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cLeftAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated",0)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cLeftAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, interfaceCtx->cLeftAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated",0)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCLBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCLBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCLBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cLeftAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_L.r, C_button_L.g, C_button_L.b, interfaceCtx->cLeftAlpha);
}
gSPWideTextureRectangle(OVERLAY_DISP++, C_Left_BTN_Pos[0] << 2, C_Left_BTN_Pos[1] << 2,
(C_Left_BTN_Pos[0] + R_ITEM_BTN_WIDTH(1)) << 2,
(C_Left_BTN_Pos[1] + R_ITEM_BTN_WIDTH(1)) << 2,
G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(1) << 1, R_ITEM_BTN_DD(1) << 1);
(C_Left_BTN_Pos[0] + CLeftScaled) << 2,
(C_Left_BTN_Pos[1] + CLeftScaled) << 2,
G_TX_RENDERTILE, 0, 0, CLeft_factor, CLeft_factor);
// C-Down Button Color & Texture
if (CVar_GetS32("gHudColors", 1) == 0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cDownAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cDownAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cDownAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cDownAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated",0)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cDownAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, interfaceCtx->cDownAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated",0)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCDBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCDBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCDBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cDownAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_D.r, C_button_D.g, C_button_D.b, interfaceCtx->cDownAlpha);
}
gSPWideTextureRectangle(OVERLAY_DISP++, C_Down_BTN_Pos[0] << 2, C_Down_BTN_Pos[1] << 2,
(C_Down_BTN_Pos[0] + R_ITEM_BTN_WIDTH(2)) << 2,
(C_Down_BTN_Pos[1] + R_ITEM_BTN_WIDTH(2)) << 2,
G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(2) << 1, R_ITEM_BTN_DD(2) << 1);
(C_Down_BTN_Pos[0] + CDownScaled) << 2,
(C_Down_BTN_Pos[1] + CDownScaled) << 2,
G_TX_RENDERTILE, 0, 0, CDown_factor, CDown_factor);
// C-Right Button Color & Texture
if (CVar_GetS32("gHudColors", 1) == 0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cRightAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cRightAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cRightAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cRightAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated",0)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cRightAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, interfaceCtx->cRightAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated",0)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCRBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCRBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCRBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cRightAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_R.r, C_button_R.g, C_button_R.b, interfaceCtx->cRightAlpha);
}
gSPWideTextureRectangle(OVERLAY_DISP++, C_Right_BTN_Pos[0] << 2, C_Right_BTN_Pos[1] << 2,
(C_Right_BTN_Pos[0] + R_ITEM_BTN_WIDTH(3)) << 2,
(C_Right_BTN_Pos[1] + R_ITEM_BTN_WIDTH(3)) << 2,
G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(3) << 1, R_ITEM_BTN_DD(3) << 1);
(C_Right_BTN_Pos[0] + CRightScaled) << 2,
(C_Right_BTN_Pos[1] + CRightScaled) << 2,
G_TX_RENDERTILE, 0, 0, CRight_factor, CRight_factor);
if ((pauseCtx->state < 8) || (pauseCtx->state >= 18)) {
if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) {
@ -3670,9 +3705,9 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
if (CVar_GetS32("gHudColors", 1) == 0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 0, 0, interfaceCtx->startAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 120, 120, interfaceCtx->startAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, Start_button_ori.r, Start_button_ori.g, Start_button_ori.b, interfaceCtx->startAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCStartBtnPrimR", 120), CVar_GetS32("gCCStartBtnPrimG", 120), CVar_GetS32("gCCStartBtnPrimB", 120), interfaceCtx->startAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, Start_button.r, Start_button.g, Start_button.b, interfaceCtx->startAlpha);
}
gSPWideTextureRectangle(OVERLAY_DISP++, PosX_StartBtn << 2, PosY_StartBtn << 2,
(PosX_StartBtn + StartBTN_W_Scaled) << 2, (PosY_StartBtn + StartBTN_H_Scaled) << 2,
@ -3707,11 +3742,19 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
DO_ACTION_TEX_WIDTH(), DO_ACTION_TEX_HEIGHT(), 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
//const s16 rStartLabelX = OTRGetRectDimensionFromRightEdge(R_START_LABEL_X(gSaveContext.language)+Right_HUD_Margin);
gSPWideTextureRectangle(
OVERLAY_DISP++, rStartLabelX << 2, rStartLabelY << 2,
(rStartLabelX + StartBTN_Label_W) << 2,
(rStartLabelY + StartBTN_Label_H) << 2, G_TX_RENDERTILE, 0, 0, StartBTN_Label_W_factor, StartBTN_Label_H_factor);
gDPPipeSync(OVERLAY_DISP++);
gSPSetGeometryMode(OVERLAY_DISP++, G_CULL_BACK);
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->startAlpha);
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0);
Matrix_Translate(PosX_StartBtn-160+((Start_BTN_Scale+Start_BTN_Scale/3)*11.5f), (PosY_StartBtn-120+((Start_BTN_Scale+Start_BTN_Scale/3)*11.5f)) * -1, 1.0f, MTXMODE_NEW);
Matrix_Scale(Start_BTN_Scale+(Start_BTN_Scale/3), Start_BTN_Scale+(Start_BTN_Scale/3), Start_BTN_Scale+(Start_BTN_Scale/3), MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[4], 4, 0);
Interface_DrawActionLabel(globalCtx->state.gfxCtx, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE() * 2);
gDPPipeSync(OVERLAY_DISP++);
}
}
@ -3731,13 +3774,13 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
}
if (CVar_GetS32("gHudColors", 1) == 0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), temp);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, temp);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), temp);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, temp);
} else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated",0)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), temp);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, temp);
} else if (CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated",0)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCUBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCUBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCUBtnPrimB", R_C_BTN_COLOR(2)), temp);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_U.r, C_button_U.g, C_button_U.b, temp);
}
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gSPWideTextureRectangle(OVERLAY_DISP++, C_Up_BTN_Pos[0] << 2, C_Up_BTN_Pos[1] << 2, (C_Up_BTN_Pos[0] + 16) << 2,
@ -3796,6 +3839,11 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
X_Margins_CD = 0;
Y_Margins_CD = 0;
}
const s16 ItemIconWidthFactor[3][2] = {
{ CLeftScaled, CLeft_factor },
{ CDownScaled, CDown_factor },
{ CRightScaled, CRight_factor },
};
const s16 ItemIconPos_ori[3][2] = {
{ R_ITEM_ICON_X(1)+X_Margins_CL, R_ITEM_ICON_Y(1)+Y_Margins_CL },
{ R_ITEM_ICON_X(2)+X_Margins_CD, R_ITEM_ICON_Y(2)+Y_Margins_CD },
@ -3858,40 +3906,34 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
}
if (temp == 1) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2),
interfaceCtx->cLeftAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cLeftAlpha);
} else if (temp == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2),
interfaceCtx->cDownAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cDownAlpha);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2),
interfaceCtx->cRightAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cRightAlpha);
}
if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cRightAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, interfaceCtx->cRightAlpha);
} else if (temp == 1 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCLBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCLBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCLBtnPrimB", R_C_BTN_COLOR(2)),
interfaceCtx->cLeftAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_L.r, C_button_L.g, C_button_L.b, interfaceCtx->cLeftAlpha);
} else if (temp == 2 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCDBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCDBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCDBtnPrimB", R_C_BTN_COLOR(2)),
interfaceCtx->cDownAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_D.r, C_button_D.g, C_button_D.b, interfaceCtx->cDownAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCRBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCRBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCRBtnPrimB", R_C_BTN_COLOR(2)),
interfaceCtx->cRightAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_R.r, C_button_R.g, C_button_R.b, interfaceCtx->cRightAlpha);
}
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, ((u8*)gButtonBackgroundTex), 32, 32,
ItemIconPos[temp-1][0], ItemIconPos[temp-1][1], R_ITEM_BTN_WIDTH(temp),
R_ITEM_BTN_WIDTH(temp), R_ITEM_BTN_DD(temp) << 1, R_ITEM_BTN_DD(temp) << 1);
ItemIconPos[temp-1][0], ItemIconPos[temp-1][1], ItemIconWidthFactor[temp-1][0],
ItemIconWidthFactor[temp-1][0], ItemIconWidthFactor[temp-1][1], ItemIconWidthFactor[temp-1][1]);
const char* cButtonIcons[] = { gButtonBackgroundTex, gEquippedItemOutlineTex, gEmptyCLeftArrowTex,
gEmptyCDownArrowTex, gEmptyCRightArrowTex
};
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, cButtonIcons[(temp + 1)], 32, 32,
ItemIconPos[temp-1][0], ItemIconPos[temp-1][1], R_ITEM_BTN_WIDTH(temp),
R_ITEM_BTN_WIDTH(temp), R_ITEM_BTN_DD(temp) << 1, R_ITEM_BTN_DD(temp) << 1);
ItemIconPos[temp-1][0], ItemIconPos[temp-1][1], ItemIconWidthFactor[temp-1][0],
ItemIconWidthFactor[temp-1][0], ItemIconWidthFactor[temp-1][1], ItemIconWidthFactor[temp-1][1]);
}
}
@ -3903,6 +3945,8 @@ int16_t gItemIconDD[] = { 550, 680, 680, 680, 1024, 1024, 1024, 1024 };
void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 button) {
OPEN_DISPS(globalCtx->state.gfxCtx);
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
s16 X_Margins_CL;
s16 X_Margins_CR;
s16 X_Margins_CD;
@ -3948,15 +3992,52 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16
X_Margins_DPad_Items = 0;
Y_Margins_DPad_Items = 0;
}
const float ItemsScale_offset[8][2] = {
// Y X
{ 104.0f, 144.0f }, //B
{ 108.0f, 148.0f }, //C L
{ 108.0f, 148.0f }, //C D
{ 108.0f, 148.0f }, //C R
{ 112.0f, 152.0f }, //Dpad ^
{ 112.0f, 152.0f }, //Dpad V
{ 112.0f, 152.0f }, //Dpad <
{ 112.0f, 152.0f } //Dpad >
};
float ItemScale_ori[8] = {
1.0f, //B BTN
0.87f, 0.87f, 0.87f, //C BTNs L / D / R
0.6f, 0.6f, 0.6f, 0.6f //Dpad U/D/L/R
};
const s16 ItemIconPos_ori[8][2] = {
{ B_BUTTON_X+X_Margins_BtnB, B_BUTTON_Y+Y_Margins_BtnB },
{ C_LEFT_BUTTON_X+X_Margins_CL, C_LEFT_BUTTON_Y+Y_Margins_CL },
{ C_DOWN_BUTTON_X+X_Margins_CD, C_DOWN_BUTTON_Y+Y_Margins_CD },
{ C_RIGHT_BUTTON_X+X_Margins_CR, C_RIGHT_BUTTON_Y+Y_Margins_CR },
{ DPAD_UP_X+X_Margins_DPad_Items, DPAD_UP_Y+Y_Margins_DPad_Items },
{ DPAD_DOWN_X+X_Margins_DPad_Items, DPAD_DOWN_Y+Y_Margins_DPad_Items },
{ DPAD_LEFT_X+X_Margins_DPad_Items, DPAD_LEFT_Y+Y_Margins_DPad_Items },
{ DPAD_RIGHT_X+X_Margins_DPad_Items, DPAD_RIGHT_Y+Y_Margins_DPad_Items }
{ B_BUTTON_X+X_Margins_BtnB-ItemsScale_offset[0][1], B_BUTTON_Y+Y_Margins_BtnB-ItemsScale_offset[0][0] },
{ C_LEFT_BUTTON_X+X_Margins_CL-ItemsScale_offset[1][1], C_LEFT_BUTTON_Y+Y_Margins_CL-ItemsScale_offset[1][0] },
{ C_DOWN_BUTTON_X+X_Margins_CD-ItemsScale_offset[2][1], C_DOWN_BUTTON_Y+Y_Margins_CD-ItemsScale_offset[2][0] },
{ C_RIGHT_BUTTON_X+X_Margins_CR-ItemsScale_offset[3][1], C_RIGHT_BUTTON_Y+Y_Margins_CR-ItemsScale_offset[3][0] },
{ DPAD_UP_X+X_Margins_DPad_Items-ItemsScale_offset[4][1], DPAD_UP_Y+Y_Margins_DPad_Items-ItemsScale_offset[4][0] },
{ DPAD_DOWN_X+X_Margins_DPad_Items-ItemsScale_offset[5][1], DPAD_DOWN_Y+Y_Margins_DPad_Items-ItemsScale_offset[5][0] },
{ DPAD_LEFT_X+X_Margins_DPad_Items-ItemsScale_offset[6][1], DPAD_LEFT_Y+Y_Margins_DPad_Items-ItemsScale_offset[6][0] },
{ DPAD_RIGHT_X+X_Margins_DPad_Items-ItemsScale_offset[7][1], DPAD_RIGHT_Y+Y_Margins_DPad_Items-ItemsScale_offset[7][0] }
};
float ItemScale[8] = {
CVar_GetFloat("gBBtnScale", 1.0f),
CVar_GetFloat("gCBtnLScale", 0.87f),
CVar_GetFloat("gCBtnDScale", 0.87f),
CVar_GetFloat("gCBtnRScale", 0.87f),
CVar_GetFloat("gDPadScale", 0.425f),
CVar_GetFloat("gDPadScale", 0.425f),
CVar_GetFloat("gDPadScale", 0.425f),
CVar_GetFloat("gDPadScale", 0.425f),
};
float ItemScaleCurrent[8]; //Hold the array with modified scale
u16 ItemsSlotsAlpha[8] = {
interfaceCtx->bAlpha,
interfaceCtx->cLeftAlpha,
interfaceCtx->cRightAlpha,
interfaceCtx->cDownAlpha,
interfaceCtx->dpadUpAlpha,
interfaceCtx->dpadDownAlpha,
interfaceCtx->dpadLeftAlpha,
interfaceCtx->dpadRightAlpha
};
s16 DPad_ItemsOffset[4][2] = {
{ 7,-8},//Up
@ -3967,6 +4048,10 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16
s16 ItemIconPos[8][2]; //(X,Y)
//DPadItems
if (CVar_GetS32("gDPadPosType", 0) != 0) {
ItemScaleCurrent[4] = ItemScale[4];
ItemScaleCurrent[5] = ItemScale[5];
ItemScaleCurrent[6] = ItemScale[6];
ItemScaleCurrent[7] = ItemScale[7];
ItemIconPos[4][1] = CVar_GetS32("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[0][1];//Up
ItemIconPos[5][1] = CVar_GetS32("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[1][1];//Down
ItemIconPos[6][1] = CVar_GetS32("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[2][1];//Left
@ -3995,6 +4080,10 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16
ItemIconPos[7][0] = -9999;
}
} else {
ItemScaleCurrent[4] = ItemScale_ori[4];
ItemScaleCurrent[5] = ItemScale_ori[5];
ItemScaleCurrent[6] = ItemScale_ori[6];
ItemScaleCurrent[7] = ItemScale_ori[7];
ItemIconPos[4][0] = OTRGetDimensionFromRightEdge(ItemIconPos_ori[4][0]);
ItemIconPos[5][0] = OTRGetDimensionFromRightEdge(ItemIconPos_ori[5][0]);
ItemIconPos[6][0] = OTRGetDimensionFromRightEdge(ItemIconPos_ori[6][0]);
@ -4006,73 +4095,81 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16
}
//B Button
if (CVar_GetS32("gBBtnPosType", 0) != 0) {
ItemIconPos[0][1] = CVar_GetS32("gBBtnPosY", 0)+Y_Margins_BtnB;
ItemScaleCurrent[0] = ItemScale[0];
ItemIconPos[0][1] = CVar_GetS32("gBBtnPosY", 0)+Y_Margins_BtnB-ItemsScale_offset[0][0];
if (CVar_GetS32("gBBtnPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gBBtnUseMargins", 0) != 0) {X_Margins_BtnB = Left_HUD_Margin;};
ItemIconPos[0][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gBBtnPosX", 0)+X_Margins_BtnB);
ItemIconPos[0][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gBBtnPosX", 0)+X_Margins_BtnB-ItemsScale_offset[0][1]);
} else if (CVar_GetS32("gBBtnPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gBBtnUseMargins", 0) != 0) {X_Margins_BtnB = Right_HUD_Margin;};
ItemIconPos[0][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gBBtnPosX", 0)+X_Margins_BtnB);
ItemIconPos[0][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gBBtnPosX", 0)+X_Margins_BtnB-ItemsScale_offset[0][1]);
} else if (CVar_GetS32("gBBtnPosType", 0) == 3) {//Anchor None
ItemIconPos[0][0] = CVar_GetS32("gBBtnPosX", 0);
ItemIconPos[0][0] = CVar_GetS32("gBBtnPosX", 0)-ItemsScale_offset[0][1];
} else if (CVar_GetS32("gBBtnPosType", 0) == 4) {//Hidden
ItemIconPos[0][0] = -9999;
}
} else {
ItemScaleCurrent[0] = ItemScale_ori[0];
ItemIconPos[0][0] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[0][0]);
ItemIconPos[0][1] = ItemIconPos_ori[0][1];
}
//C button Left
if (CVar_GetS32("gCBtnLPosType", 0) != 0) {
ItemIconPos[1][1] = CVar_GetS32("gCBtnLPosY", 0)+Y_Margins_CL;
ItemScaleCurrent[1] = ItemScale[1];
ItemIconPos[1][1] = CVar_GetS32("gCBtnLPosY", 0)+Y_Margins_CL-ItemsScale_offset[1][0];
if (CVar_GetS32("gCBtnLPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Left_HUD_Margin;};
ItemIconPos[1][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnLPosX", 0)+X_Margins_CL);
ItemIconPos[1][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnLPosX", 0)+X_Margins_CL-ItemsScale_offset[1][1]);
} else if (CVar_GetS32("gCBtnLPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Right_HUD_Margin;};
ItemIconPos[1][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnLPosX", 0)+X_Margins_CL);
ItemIconPos[1][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnLPosX", 0)+X_Margins_CL-ItemsScale_offset[1][1]);
} else if (CVar_GetS32("gCBtnLPosType", 0) == 3) {//Anchor None
ItemIconPos[1][0] = CVar_GetS32("gCBtnLPosX", 0);
ItemIconPos[1][0] = CVar_GetS32("gCBtnLPosX", 0)-ItemsScale_offset[1][1];
} else if (CVar_GetS32("gCBtnLPosType", 0) == 4) {//Hidden
ItemIconPos[1][0] = -9999;
}
} else {
ItemScaleCurrent[1] = ItemScale_ori[1];
ItemIconPos[1][0] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[1][0]);
ItemIconPos[1][1] = ItemIconPos_ori[1][1];
}
//C Button down
if (CVar_GetS32("gCBtnDPosType", 0) != 0) {
ItemIconPos[2][1] = CVar_GetS32("gCBtnDPosY", 0)+Y_Margins_CD;
ItemScaleCurrent[2] = ItemScale[2];
ItemIconPos[2][1] = CVar_GetS32("gCBtnDPosY", 0)+Y_Margins_CD-ItemsScale_offset[2][0];
if (CVar_GetS32("gCBtnDPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Left_HUD_Margin;};
ItemIconPos[2][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD);
ItemIconPos[2][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD-ItemsScale_offset[2][1]);
} else if (CVar_GetS32("gCBtnDPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Right_HUD_Margin;};
ItemIconPos[2][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD);
ItemIconPos[2][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD-ItemsScale_offset[2][1]);
} else if (CVar_GetS32("gCBtnDPosType", 0) == 3) {//Anchor None
ItemIconPos[2][0] = CVar_GetS32("gCBtnDPosX", 0);
ItemIconPos[2][0] = CVar_GetS32("gCBtnDPosX", 0)-ItemsScale_offset[2][1];
} else if (CVar_GetS32("gCBtnDPosType", 0) == 4) {//Hidden
ItemIconPos[2][0] = -9999;
}
} else {
ItemScaleCurrent[2] = ItemScale_ori[2];
ItemIconPos[2][0] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[2][0]);
ItemIconPos[2][1] = ItemIconPos_ori[2][1];
}
//C button Right
if (CVar_GetS32("gCBtnRPosType", 0) != 0) {
ItemIconPos[3][1] = CVar_GetS32("gCBtnRPosY", 0)+Y_Margins_CR;
ItemScaleCurrent[3] = ItemScale[3];
ItemIconPos[3][1] = CVar_GetS32("gCBtnRPosY", 0)+Y_Margins_CR-ItemsScale_offset[3][0];
if (CVar_GetS32("gCBtnRPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Left_HUD_Margin;};
ItemIconPos[3][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnRPosX", 0)+X_Margins_CR);
ItemIconPos[3][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnRPosX", 0)+X_Margins_CR-ItemsScale_offset[3][1]);
} else if (CVar_GetS32("gCBtnRPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Right_HUD_Margin;};
ItemIconPos[3][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnRPosX", 0)+X_Margins_CR);
ItemIconPos[3][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnRPosX", 0)+X_Margins_CR-ItemsScale_offset[3][1]);
} else if (CVar_GetS32("gCBtnRPosType", 0) == 3) {//Anchor None
ItemIconPos[3][0] = CVar_GetS32("gCBtnRPosX", 0);
ItemIconPos[3][0] = CVar_GetS32("gCBtnRPosX", 0)-ItemsScale_offset[3][1];
} else if (CVar_GetS32("gCBtnRPosType", 0) == 4) {//Hidden
ItemIconPos[3][0] = -9999;
}
} else {
ItemScaleCurrent[3] = ItemScale_ori[3];
ItemIconPos[3][0] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[3][0]);
ItemIconPos[3][1] = ItemIconPos_ori[3][1];
}
@ -4080,10 +4177,23 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16
gDPLoadTextureBlock(OVERLAY_DISP++, texture, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPWideTextureRectangle(OVERLAY_DISP++, ItemIconPos[button][0] << 2, ItemIconPos[button][1] << 2,
(ItemIconPos[button][0] + gItemIconWidth[button]) << 2,
(ItemIconPos[button][1] + gItemIconWidth[button]) << 2, G_TX_RENDERTILE, 0, 0,
gItemIconDD[button] << 1, gItemIconDD[button] << 1);
gDPPipeSync(OVERLAY_DISP++);
gSPSetGeometryMode(OVERLAY_DISP++, G_CULL_BACK);
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, ItemsSlotsAlpha[button]);
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0);
Matrix_Translate(
ItemIconPos[button][0],
ItemIconPos[button][1] * -1, 1.0f, MTXMODE_NEW);
Matrix_Scale(
ItemScaleCurrent[button]/1,
ItemScaleCurrent[button]/1,
ItemScaleCurrent[button]/1, MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[0], 4, 0);
gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0);
gDPPipeSync(OVERLAY_DISP++);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
@ -4495,7 +4605,12 @@ void Interface_Draw(GlobalContext* globalCtx) {
{ 0x82, 0x82, 0xFF }, // Adult's Wallet (Blue)
{ 0xFF, 0x64, 0x64 }, // Giant's Wallet (Red)
};
s16 rColor[3] = { 200, 255, 100 };
Color_RGB8 rColor_ori = { 200, 255, 100 };
Color_RGB8 rColor;
Color_RGB8 keyColor_ori = { 200, 230, 255 };
Color_RGB8 keyColor;
Color_RGB8 DPad_colors_ori = {255, 255, 255};
Color_RGB8 DPad_colors = CVar_GetRGB("gCCDpadPrim", DPad_colors_ori);
static s16 spoilingItemEntrances[] = { 0x01AD, 0x0153, 0x0153 };
static f32 D_80125B54[] = { -40.0f, -35.0f }; // unused
static s16 D_80125B5C[] = { 91, 91 }; // unused
@ -4542,25 +4657,23 @@ void Interface_Draw(GlobalContext* globalCtx) {
//Custom Color is on but check if Dynamic Wallet is on.
if (CVar_GetS32("gDynamicWalletIcon", 0) != 0) {
//if on let's use Dynamic Colors
rColor[0] = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][0];
rColor[1] = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][1];
rColor[2] = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][2];
rColor.r = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][0];
rColor.g = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][1];
rColor.b = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][2];
} else {
//else use our custom color
rColor[0] = CVar_GetS32("gCCRupeePrimR", &rupeeWalletColors[0][0]);
rColor[1] = CVar_GetS32("gCCRupeePrimG", &rupeeWalletColors[0][1]);
rColor[2] = CVar_GetS32("gCCRupeePrimB", &rupeeWalletColors[0][2]);
rColor = CVar_GetRGB("gCCRupeePrim", rColor_ori);
}
} else {
//Custom colors is off so check if Dynamic Wallet is on.
if (CVar_GetS32("gDynamicWalletIcon", 0) != 0) {
rColor[0] = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][0];
rColor[1] = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][1];
rColor[2] = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][2];
rColor.r = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][0];
rColor.g = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][1];
rColor.b = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][2];
} else {
rColor[0] = rupeeWalletColors[0][0];
rColor[1] = rupeeWalletColors[0][1];
rColor[2] = rupeeWalletColors[0][2];
rColor.r = rupeeWalletColors[0][0];
rColor.g = rupeeWalletColors[0][1];
rColor.b = rupeeWalletColors[0][2];
}
}
if (CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gDynamicWalletIcon", 0) != 1) {
@ -4598,7 +4711,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
PosY_RC = PosY_RC_ori;
PosX_RC = PosX_RC_ori;
}
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, rColor[0], rColor[1], rColor[2], interfaceCtx->magicAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, rColor.r, rColor.g, rColor.b, interfaceCtx->magicAlpha);
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gRupeeCounterIconTex, 16, 16, PosX_RC, PosY_RC, 16, 16, 1 << 10, 1 << 10);
switch (globalCtx->sceneNum) {
@ -4651,10 +4764,10 @@ void Interface_Draw(GlobalContext* globalCtx) {
gDPPipeSync(OVERLAY_DISP++);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCKeysPrimR", 200), CVar_GetS32("gCCKeysPrimG", 230), CVar_GetS32("gCCKeysPrimB", 255), interfaceCtx->magicAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCKeysPrim", keyColor_ori).r,CVar_GetRGB("gCCKeysPrim", keyColor_ori).g,CVar_GetRGB("gCCKeysPrim", keyColor_ori).b, interfaceCtx->magicAlpha);
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255); //We reset this here so it match user color :)
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 230, 255, interfaceCtx->magicAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, keyColor_ori.r, keyColor_ori.g, keyColor_ori.b, interfaceCtx->magicAlpha);
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 20, 255);
}
OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gSmallKeyCounterIconTex, 16, 16, PosX_SKC, PosY_SKC, 16, 16,
@ -4909,9 +5022,9 @@ void Interface_Draw(GlobalContext* globalCtx) {
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCDpadPrimR", 255), CVar_GetS32("gCCDpadPrimG", 255), CVar_GetS32("gCCDpadPrimB", 255), dpadAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, DPad_colors.r,DPad_colors.g,DPad_colors.b, dpadAlpha);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, dpadAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, DPad_colors_ori.r,DPad_colors_ori.g,DPad_colors_ori.b, dpadAlpha);
}
if (fullUi) {
gDPLoadTextureBlock(OVERLAY_DISP++, ResourceMgr_LoadFileRaw("assets/ship_of_harkinian/buttons/dpad.bin"),
@ -4969,6 +5082,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
// A Button
func_80094A14(globalCtx->state.gfxCtx);
const Color_RGB8 A_Button_Colors = {R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2)};
s16 X_Margins_BtnA;
s16 Y_Margins_BtnA;
if (CVar_GetS32("gABtnUseMargins", 0) != 0) {
@ -5015,9 +5129,9 @@ void Interface_Draw(GlobalContext* globalCtx) {
if (CVar_GetS32("gHudColors", 1) == 0) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 90, 90, 255, interfaceCtx->aAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2), interfaceCtx->aAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, A_Button_Colors.r, A_Button_Colors.g, A_Button_Colors.b, interfaceCtx->aAlpha);
} else if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", R_A_BTN_COLOR(0)), CVar_GetS32("gCCABtnPrimG", R_A_BTN_COLOR(1)), CVar_GetS32("gCCABtnPrimB", R_A_BTN_COLOR(2)), interfaceCtx->aAlpha);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCABtnPrim", A_Button_Colors).r,CVar_GetRGB("gCCABtnPrim", A_Button_Colors).g,CVar_GetRGB("gCCABtnPrim", A_Button_Colors).b, interfaceCtx->aAlpha);
}
if (fullUi) {
Interface_DrawActionButton(globalCtx, PosX_BtnA, PosY_BtnA);

View File

@ -415,6 +415,13 @@ void Gameplay_Init(GameState* thisx) {
PreRender_SetValues(&globalCtx->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
gTrnsnUnkState = 0;
globalCtx->transitionMode = 0;
if (CVar_GetS32("gSceneTransitions", 255)!= 255){
globalCtx->transitionMode = CVar_GetS32("gSceneTransitions", 0);
gSaveContext.nextTransition = CVar_GetS32("gSceneTransitions", 0);
globalCtx->fadeTransition = CVar_GetS32("gSceneTransitions", 0);
}
FrameAdvance_Init(&globalCtx->frameAdvCtx);
Rand_Seed((u32)osGetTime());
Matrix_Init(&globalCtx->state);

View File

@ -194,6 +194,10 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) {
u32 stateFrames;
EnArrow* arrow;
Actor* tranform;
Color_RGB8 Arrow_env_ori = {255,0,0};
Color_RGB8 Arrow_col_ori = {255,200,0};
Color_RGB8 Arrow_env = CVar_GetRGB("gFireArrowColEnv", Arrow_env_ori);
Color_RGB8 Arrow_col = CVar_GetRGB("gFireArrowCol", Arrow_col_ori);
stateFrames = globalCtx->state.frames;
arrow = (EnArrow*)this->actor.parent;
@ -214,9 +218,9 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) {
POLY_XLU_DISP = func_800937C0(POLY_XLU_DISP);
if (CVar_GetS32("gUseArrowsCol", 0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0,
(s32)(CVar_GetS32("gFireArrowColEnvR", 40) * this->unk_15C) & 0xFF,
(s32)(CVar_GetS32("gFireArrowColEnvG", 0) * this->unk_15C) & 0xFF,
(s32)(CVar_GetS32("gFireArrowColEnvB", 0) * this->unk_15C) & 0xFF,
(s32)(Arrow_env.r * this->unk_15C) & 0xFF,
(s32)(Arrow_env.g * this->unk_15C) & 0xFF,
(s32)(Arrow_env.b * this->unk_15C) & 0xFF,
(s32)(30.0f * this->unk_15C) & 0xFF); //Intentionnally made Alpha lower.
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s32)(40.0f * this->unk_15C) & 0xFF, 0, 0,
@ -230,11 +234,11 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) {
// Draw fire on the arrow
func_80093D84(globalCtx->state.gfxCtx);
if (CVar_GetS32("gUseArrowsCol", 0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, CVar_GetS32("gFireArrowColR", 255), CVar_GetS32("gFireArrowColG", 200), CVar_GetS32("gFireArrowColB", 0), this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetS32("gFireArrowColEnvR", 255), CVar_GetS32("gFireArrowColEnvG", 0), CVar_GetS32("gFireArrowColEnvB", 0), 128);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col.r, Arrow_col.g, Arrow_col.b, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env.r, Arrow_env.g, Arrow_env.b, 128);
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col_ori.r, Arrow_col_ori.g, Arrow_col_ori.b, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env_ori.r, Arrow_env_ori.g, Arrow_env_ori.b, 128);
}
Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY);
if (this->timer != 0) {

View File

@ -195,6 +195,10 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
Actor* tranform;
u32 stateFrames = globalCtx->state.frames;
EnArrow* arrow = (EnArrow*)this->actor.parent;
Color_RGB8 Arrow_env_ori = {0,0,255};
Color_RGB8 Arrow_col_ori = {170, 255, 255};
Color_RGB8 Arrow_env = CVar_GetRGB("gIceArrowColEnv", Arrow_env_ori);
Color_RGB8 Arrow_col = CVar_GetRGB("gIceArrowCol", Arrow_col_ori);
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {
tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
@ -212,9 +216,9 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
POLY_XLU_DISP = func_800937C0(POLY_XLU_DISP);
if (CVar_GetS32("gUseArrowsCol", 0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0,
(s32)(CVar_GetS32("gIceArrowColEnvR", 0) * this->unk_164) & 0xFF,
(s32)(CVar_GetS32("gIceArrowColEnvG", 10) * this->unk_164) & 0xFF,
(s32)(CVar_GetS32("gIceArrowColEnvB", 50) * this->unk_164) & 0xFF,
(s32)(Arrow_env.r * this->unk_164) & 0xFF,
(s32)(Arrow_env.g * this->unk_164) & 0xFF,
(s32)(Arrow_env.b * this->unk_164) & 0xFF,
(s32)(30.0f * this->unk_164) & 0xFF); //Intentionnally made Alpha lower.
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, (s32)(10.0f * this->unk_164) & 0xFF,
@ -228,11 +232,11 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
// Draw ice on the arrow
func_80093D84(globalCtx->state.gfxCtx);
if (CVar_GetS32("gUseArrowsCol", 0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, CVar_GetS32("gIceArrowColR", 170), CVar_GetS32("gIceArrowColG", 255), CVar_GetS32("gIceArrowColB", 255), this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetS32("gIceArrowColEnvR", 0), CVar_GetS32("gIceArrowColEnvG", 0), CVar_GetS32("gIceArrowColEnvB", 255), 128);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col.r, Arrow_col.g, Arrow_col.b, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env.r, Arrow_env.g, Arrow_env.b, 128);
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 170, 255, 255, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 128);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col_ori.r, Arrow_col_ori.g, Arrow_col_ori.b, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env_ori.r, Arrow_env_ori.g, Arrow_env_ori.b, 128);
}
Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY);
if (this->timer != 0) {

View File

@ -193,6 +193,10 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
u32 stateFrames = globalCtx->state.frames;
EnArrow* arrow = (EnArrow*)this->actor.parent;
Actor* tranform;
Color_RGB8 Arrow_env_ori = {255, 255, 0};
Color_RGB8 Arrow_col_ori = {255, 255, 170};
Color_RGB8 Arrow_env = CVar_GetRGB("gLightArrowColEnv", Arrow_env_ori);
Color_RGB8 Arrow_col = CVar_GetRGB("gLightArrowCol", Arrow_col_ori);
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {
tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
@ -210,9 +214,9 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
POLY_XLU_DISP = func_800937C0(POLY_XLU_DISP);
if (CVar_GetS32("gUseArrowsCol", 0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0,
(s32)(CVar_GetS32("gLightArrowColEnvR", 30) * this->unk_164) & 0xFF,
(s32)(CVar_GetS32("gLightArrowColEnvG", 40) * this->unk_164) & 0xFF,
(s32)(CVar_GetS32("gLightArrowColEnvB", 0) * this->unk_164) & 0xFF,
(s32)(Arrow_env.r * this->unk_164) & 0xFF,
(s32)(Arrow_env.g * this->unk_164) & 0xFF,
(s32)(Arrow_env.b * this->unk_164) & 0xFF,
(s32)(30.0f * this->unk_164) & 0xFF); //Intentionnally made Alpha lower.
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s32)(30.0f * this->unk_164) & 0xFF,
@ -226,11 +230,11 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
// Draw light on the arrow
func_80093D84(globalCtx->state.gfxCtx);
if (CVar_GetS32("gUseArrowsCol", 0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, CVar_GetS32("gLightArrowColR", 255), CVar_GetS32("gLightArrowColG", 255), CVar_GetS32("gLightArrowColB", 170), this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetS32("gLightArrowColEnvR", 255), CVar_GetS32("gLightArrowColEnvG", 255), CVar_GetS32("gLightArrowColEnvB", 0), 128);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col.r, Arrow_col.g, Arrow_col.b, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env.r, Arrow_env.g, Arrow_env.b, 128);
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 128);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col_ori.r, Arrow_col_ori.g, Arrow_col_ori.b, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env_ori.r, Arrow_env_ori.g, Arrow_env_ori.b, 128);
}
Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY);
if (this->timer != 0) {

View File

@ -472,6 +472,10 @@ void EnDog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
void EnDog_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnDog* this = (EnDog*)thisx;
Color_RGBA8 colors[] = { { 255, 255, 200, 0 }, { 150, 100, 50, 0 } };
Color_RGB8 Dog1_ori = {colors[0].r, colors[0].g, colors[0].b};
Color_RGB8 Dog2_ori = {colors[1].r, colors[1].g, colors[1].b};
Color_RGB8 Dog1 = CVar_GetRGB("gDog1Col", Dog1_ori);
Color_RGB8 Dog2 = CVar_GetRGB("gDog2Col", Dog2_ori);
OPEN_DISPS(globalCtx->state.gfxCtx);
@ -479,19 +483,19 @@ void EnDog_Draw(Actor* thisx, GlobalContext* globalCtx) {
gDPPipeSync(POLY_OPA_DISP++);
if (CVar_GetS32("gUseDogsCol",0)) {
colors[0].r = CVar_GetS32("gDog1ColR", 255);
colors[0].g = CVar_GetS32("gDog1ColG", 255);
colors[0].b = CVar_GetS32("gDog1ColB", 200);
colors[1].r = CVar_GetS32("gDog2ColR", 150);
colors[1].g = CVar_GetS32("gDog2ColG", 100);
colors[1].b = CVar_GetS32("gDog2ColB", 50);
colors[0].r = Dog1.r;
colors[0].g = Dog1.g;
colors[0].b = Dog1.b;
colors[1].r = Dog2.r;
colors[1].g = Dog2.g;
colors[1].b = Dog2.b;
} else {
colors[0].r = 255;
colors[0].g = 255;
colors[0].b = 200;
colors[1].r = 150;
colors[1].g = 100;
colors[1].b = 50;
colors[0].r = Dog1_ori.r;
colors[0].g = Dog1_ori.g;
colors[0].b = Dog1_ori.b;
colors[1].r = Dog2_ori.r;
colors[1].g = Dog2_ori.g;
colors[1].b = Dog2_ori.b;
}
gDPSetEnvColor(POLY_OPA_DISP++, colors[this->actor.params & 0xF].r, colors[this->actor.params & 0xF].g,
colors[this->actor.params & 0xF].b, colors[this->actor.params & 0xF].a);

View File

@ -735,6 +735,11 @@ void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList
static Color_RGBA8 fireAuraEnvColor = { 255, 50, 0, 0 };
static Color_RGBA8 iceAuraPrimColor = { 100, 200, 255, 255 };
static Color_RGBA8 iceAuraEnvColor = { 0, 0, 255, 0 };
static Color_RGB8 fireAuraPrimColor_ori = { 255, 255, 100 };
static Color_RGB8 fireAuraEnvColor_ori = { 255, 50, 0 };
static Color_RGB8 iceAuraPrimColor_ori = { 100, 200, 255 };
static Color_RGB8 iceAuraEnvColor_ori = { 0, 0, 255 };
static Vec3f effVelocity = { 0.0f, 0.5f, 0.0f };
static Vec3f effAccel = { 0.0f, 0.5f, 0.0f };
static Vec3f limbSrc = { 0.0f, 0.0f, 0.0f };
@ -747,20 +752,20 @@ void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList
s16 effLife;
EnFirefly* this = (EnFirefly*)thisx;
if (CVar_GetS32("gUseKeeseCol", 0)) {
Color_RGBA8 fireAuraPrimColor_custom = { CVar_GetS32("gKeese1_Ef_PrimR", 255), CVar_GetS32("gKeese1_Ef_PrimG", 255), CVar_GetS32("gKeese1_Ef_PrimB", 100), 255 };
Color_RGBA8 fireAuraEnvColor_custom = { CVar_GetS32("gKeese1_Ef_EnvR", 255), CVar_GetS32("gKeese1_Ef_Env", 50), CVar_GetS32("gKeese1_Ef_EnvB", 0), 0 };
Color_RGBA8 iceAuraPrimColor_custom = { CVar_GetS32("gKeese2_Ef_PrimR", 100), CVar_GetS32("gKeese2_Ef_PrimG", 200), CVar_GetS32("gKeese2_Ef_PrimB", 255), 255 };
Color_RGBA8 iceAuraEnvColor_custom = { CVar_GetS32("gKeese2_Ef_EnvR", 0), CVar_GetS32("gKeese2_Ef_Env", 0), CVar_GetS32("gKeese2_Ef_EnvB", 255), 0 };
Color_RGBA8 fireAuraPrimColor_custom = { CVar_GetRGB("gKeese1_Ef_Prim", fireAuraPrimColor_ori).r,CVar_GetRGB("gKeese1_Ef_Prim", fireAuraPrimColor_ori).g,CVar_GetRGB("gKeese1_Ef_Prim", fireAuraPrimColor_ori).b, 255 };
Color_RGBA8 fireAuraEnvColor_custom = { CVar_GetRGB("gKeese1_Ef_Env", fireAuraEnvColor_ori).r,CVar_GetRGB("gKeese1_Ef_Env", fireAuraEnvColor_ori).g,CVar_GetRGB("gKeese1_Ef_Env", fireAuraEnvColor_ori).b, 0 };
Color_RGBA8 iceAuraPrimColor_custom = { CVar_GetRGB("gKeese2_Ef_Prim", iceAuraPrimColor_ori).r,CVar_GetRGB("gKeese2_Ef_Prim", iceAuraPrimColor_ori).g,CVar_GetRGB("gKeese2_Ef_Prim", iceAuraPrimColor_ori).b, 255 };
Color_RGBA8 iceAuraEnvColor_custom = { CVar_GetRGB("gKeese2_Ef_Env", iceAuraEnvColor_ori).r,CVar_GetRGB("gKeese2_Ef_Env", iceAuraEnvColor_ori).g,CVar_GetRGB("gKeese2_Ef_Env", iceAuraEnvColor_ori).b, 0 };
fireAuraPrimColor = fireAuraPrimColor_custom;
fireAuraEnvColor = fireAuraEnvColor_custom;
iceAuraPrimColor = iceAuraPrimColor_custom;
iceAuraEnvColor = iceAuraEnvColor_custom;
} else {
//Original colors are back there
Color_RGBA8 fireAuraPrimColor_custom = { 255, 255, 100, 255 };
Color_RGBA8 fireAuraEnvColor_custom = { 255, 50, 0, 0 };
Color_RGBA8 iceAuraPrimColor_custom = { 100, 200, 255, 255 };
Color_RGBA8 iceAuraEnvColor_custom = { 0, 0, 255, 0 };
Color_RGBA8 fireAuraPrimColor_custom = { fireAuraPrimColor_ori.r, fireAuraPrimColor_ori.g, fireAuraPrimColor_ori.b, 255 };
Color_RGBA8 fireAuraEnvColor_custom = { fireAuraEnvColor_ori.r, fireAuraEnvColor_ori.g, fireAuraEnvColor_ori.b, 0 };
Color_RGBA8 iceAuraPrimColor_custom = { iceAuraPrimColor_ori.r, iceAuraPrimColor_ori.g, iceAuraPrimColor_ori.b, 255 };
Color_RGBA8 iceAuraEnvColor_custom = { iceAuraEnvColor_ori.r, iceAuraEnvColor_ori.g, iceAuraEnvColor_ori.b, 0 };
fireAuraPrimColor = fireAuraPrimColor_custom;
fireAuraEnvColor = fireAuraEnvColor_custom;
iceAuraPrimColor = iceAuraPrimColor_custom;

View File

@ -118,9 +118,10 @@ void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) {
this->unk_194++;
if ((BREG(1) != 0) && (this->actor.xzDistToPlayer < this->maxSpawnDistance.x) &&
(fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < this->maxSpawnDistance.y)) {
if (((BREG(1) != 0) || ((CVar_GetS32("gSkipScarecrow", 0) != 0) &&
(globalCtx->msgCtx.ocarinaAction == OCARINA_ACTION_FREE_PLAY) && gSaveContext.scarecrowSpawnSongSet)) &&
(this->actor.xzDistToPlayer < this->maxSpawnDistance.x) &&
(fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < this->maxSpawnDistance.y)){
this->actor.draw = func_80A90948;
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);

View File

@ -341,7 +341,8 @@ void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) {
switch (this->unk_1C6) {
case 0:
if (CVar_GetS32("gUseChargedCol",0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetS32("gCharged2ColR",255), CVar_GetS32("gCharged2ColG",255), CVar_GetS32("gCharged2ColB",170), (u8)(this->unk_1B0 * 255));
Color_RGB8 SpinColor = {255, 255, 170};
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetRGB("gCharged2Col", SpinColor).r, CVar_GetRGB("gCharged2Col", SpinColor).g, CVar_GetRGB("gCharged2Col", SpinColor).b, (u8)(this->unk_1B0 * 255));
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 170, (u8)(this->unk_1B0 * 255));
}
@ -350,7 +351,8 @@ void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) {
break;
case 1:
if (CVar_GetS32("gUseChargedCol",0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetS32("gCharged1ColR",170), CVar_GetS32("gCharged1ColG",255), CVar_GetS32("gCharged1ColB",255), (u8)(this->unk_1B0 * 255));
Color_RGB8 SpinColor = {255, 255, 170};
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetRGB("gCharged1Col", SpinColor).r, CVar_GetRGB("gCharged1Col", SpinColor).g, CVar_GetRGB("gCharged1Col", SpinColor).b, (u8)(this->unk_1B0 * 255));
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, (u8)(this->unk_1B0 * 255));
}
@ -382,8 +384,10 @@ void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) {
if (this->unk_1B8 >= 0.85f) {
phi_f14 = (D_80AA046C[(globalCtx->gameplayFrames & 7)] * 6.0f) + 1.0f;
if (CVar_GetS32("gUseChargedCol",0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetS32("gCharged2ColR",255), CVar_GetS32("gCharged2ColG",255), CVar_GetS32("gCharged2ColB",170), this->unk_1C8);
gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetS32("gCharged2ColEnvR",255), CVar_GetS32("gCharged2ColEnvG",100), CVar_GetS32("gCharged2ColEnvB",0), 128);
Color_RGB8 SpinColor1 = {255, 255, 170};
Color_RGB8 SpinColor2 = {255, 100, 0};
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetRGB("gCharged2Col", SpinColor1).r, CVar_GetRGB("gCharged2Col", SpinColor1).g, CVar_GetRGB("gCharged2Col", SpinColor1).b, this->unk_1C8);
gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetRGB("gCharged2ColEnv", SpinColor2).r, CVar_GetRGB("gCharged2ColEnv", SpinColor2).g, CVar_GetRGB("gCharged2ColEnv", SpinColor2).b, 128);
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 170, this->unk_1C8);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 100, 0, 128);
@ -393,8 +397,10 @@ void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) {
} else {
phi_f14 = (D_80AA046C[globalCtx->gameplayFrames & 7] * 2.0f) + 1.0f;
if (CVar_GetS32("gUseChargedCol",0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetS32("gCharged1ColR",170), CVar_GetS32("gCharged1ColG",255), CVar_GetS32("gCharged1ColB",255), this->unk_1C8);
gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetS32("gCharged1ColEnvR",0), CVar_GetS32("gCharged1ColEnvG",100), CVar_GetS32("gCharged1ColEnvB",255), 128);
Color_RGB8 SpinColor1 = {170, 255, 255};
Color_RGB8 SpinColor2 = {20, 100, 255};
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetRGB("gCharged1Col", SpinColor1).r, CVar_GetRGB("gCharged1Col", SpinColor1).g, CVar_GetRGB("gCharged1Col", SpinColor1).b, this->unk_1C8);
gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetRGB("gCharged1ColEnv", SpinColor2).r, CVar_GetRGB("gCharged1ColEnv", SpinColor2).g, CVar_GetRGB("gCharged1ColEnv", SpinColor2).b, 128);
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, this->unk_1C8);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 128);

View File

@ -101,6 +101,8 @@ void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) {
#else
void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) {
EnMag* this = (EnMag*)thisx;
Color_RGB8 Original_Prim = { 255, 255, 170 };
Color_RGB8 Original_Env = { 255, 100, 0 };
YREG(1) = 63;
YREG(3) = 80;
@ -127,12 +129,21 @@ void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) {
this->effectScroll = 0;
this->unk_E30C = 0;
this->effectPrimColor[0] = 0.0f;
this->effectPrimColor[1] = 100.0f;
this->effectPrimColor[2] = 170.0f;
this->effectEnvColor[0] = 0.0f;
this->effectEnvColor[1] = 100.0f;
this->effectEnvColor[2] = 0.0f;
if (CVar_GetS32("gHudColors",0) == 2 ){
this->effectPrimColor[0] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).r;
this->effectPrimColor[1] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).g;
this->effectPrimColor[2] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).b;
this->effectEnvColor[0] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).r;
this->effectEnvColor[1] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).g;
this->effectEnvColor[2] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).b;
} else {
this->effectPrimColor[0] = 0.0f;
this->effectPrimColor[1] = 100.0f;
this->effectPrimColor[2] = 170.0f;
this->effectEnvColor[0] = 0.0f;
this->effectEnvColor[1] = 100.0f;
this->effectEnvColor[2] = 0.0f;
}
this->effectFadeInTimer = 40;
@ -147,11 +158,21 @@ void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) {
this->effectPrimLodFrac = 128.0f;
this->effectAlpha = 255.0f;
this->effectPrimColor[0] = 255.0f;
this->effectPrimColor[1] = 255.0f;
this->effectPrimColor[2] = 170;
this->effectEnvColor[0] = 255.0f;
this->effectEnvColor[1] = 100;
if (CVar_GetS32("gHudColors",0) == 2 ){
this->effectPrimColor[0] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).r;
this->effectPrimColor[1] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).g;
this->effectPrimColor[2] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).b;
this->effectEnvColor[0] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).r;
this->effectEnvColor[1] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).g;
this->effectEnvColor[2] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).b;
} else {
this->effectPrimColor[0] = (float)Original_Prim.r;
this->effectPrimColor[1] = (float)Original_Prim.g;
this->effectPrimColor[2] = (float)Original_Prim.b;
this->effectEnvColor[0] = (float)Original_Env.r;
this->effectEnvColor[1] = (float)Original_Env.g;
this->effectEnvColor[2] = (float)Original_Env.b;
}
gSaveContext.unk_13E7 = 0;
this->globalState = MAG_STATE_DISPLAY;
@ -336,6 +357,8 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad[2];
EnMag* this = (EnMag*)thisx;
Color_RGB8 Original_Prim = { 255, 255, 170 };
Color_RGB8 Original_Env = { 255, 100, 0 };
if (gSaveContext.fileNum != 0xFEDC) {
if (this->globalState < MAG_STATE_DISPLAY) {
@ -352,11 +375,21 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) {
this->effectPrimLodFrac = 128.0f;
this->effectAlpha = 255.0f;
this->effectPrimColor[0] = 255.0f;
this->effectPrimColor[1] = 255.0f;
this->effectPrimColor[2] = 170;
this->effectEnvColor[0] = 255.0f;
this->effectEnvColor[1] = 100;
if (CVar_GetS32("gHudColors",0) == 2 ){
this->effectPrimColor[0] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).r;
this->effectPrimColor[1] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).g;
this->effectPrimColor[2] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).b;
this->effectEnvColor[0] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).r;
this->effectEnvColor[1] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).g;
this->effectEnvColor[2] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).b;
} else {
this->effectPrimColor[0] = (float)Original_Prim.r;
this->effectPrimColor[1] = (float)Original_Prim.g;
this->effectPrimColor[2] = (float)Original_Prim.b;
this->effectEnvColor[0] = (float)Original_Env.r;
this->effectEnvColor[1] = (float)Original_Env.g;
this->effectEnvColor[2] = (float)Original_Env.b;
}
this->globalState = MAG_STATE_DISPLAY;
sDelayTimer = 20;
@ -395,11 +428,13 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) {
this->effectAlpha += 6.375f;
this->effectPrimLodFrac += 0.8f;
this->effectPrimColor[0] += 6.375f;
this->effectPrimColor[1] += 3.875f;
this->effectPrimColor[2] += 2.125f;
this->effectEnvColor[0] += 6.375f;
this->effectEnvColor[1] += 3.875f;
if (CVar_GetS32("gHudColors",0) != 2 ){
this->effectPrimColor[0] += 6.375f;
this->effectPrimColor[1] += 3.875f;
this->effectPrimColor[2] += 2.125f;
this->effectEnvColor[0] += 6.375f;
this->effectEnvColor[1] += 3.875f;
}
this->effectFadeInTimer--;
@ -407,18 +442,22 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) {
this->effectPrimLodFrac = 32.0f;
this->effectAlpha = 255.0f;
this->effectPrimColor[0] = 255.0f;
this->effectPrimColor[1] = 255.0f;
this->effectPrimColor[2] = 255.0f;
this->effectEnvColor[0] = 255.0f;
this->effectEnvColor[1] = 255.0f;
if (CVar_GetS32("gHudColors",0) != 2 ){
this->effectPrimColor[0] = 255.0f;
this->effectPrimColor[1] = 255.0f;
this->effectPrimColor[2] = 255.0f;
this->effectEnvColor[0] = 255.0f;
this->effectEnvColor[1] = 255.0f;
}
this->effectFadeInTimer = 40;
this->effectFadeInState = 1;
}
} else if (this->effectFadeInState == 1) {
this->effectPrimColor[2] += -2.125f;
this->effectEnvColor[1] += -3.875f;
if (CVar_GetS32("gHudColors",0) != 2 ){
this->effectPrimColor[2] += -2.125f;
this->effectEnvColor[1] += -3.875f;
}
this->effectPrimLodFrac += 2.4f;
@ -427,8 +466,17 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->effectFadeInTimer == 0) {
this->effectPrimLodFrac = 128.0f;
this->effectPrimColor[2] = 170.0f;
this->effectEnvColor[1] = 100.0f;
if (CVar_GetS32("gHudColors",0) == 2 ){
this->effectPrimColor[0] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).r;
this->effectPrimColor[1] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).g;
this->effectPrimColor[2] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).b;
this->effectEnvColor[0] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).r;
this->effectEnvColor[1] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).g;
this->effectEnvColor[2] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).b;
} else {
this->effectPrimColor[2] = 170.0f;
this->effectEnvColor[1] = 100.0f;
}
this->effectFadeInTimer = 32;
this->effectFadeInState = 2;

View File

@ -1875,6 +1875,8 @@ void EnOssan_UpdateItemSelectedProperty(EnOssan* this) {
}
void EnOssan_UpdateCursorAnim(EnOssan* this) {
Color_RGB8 A_button_ori = {0,255,80};
Color_RGB8 A_button = CVar_GetRGB("gCCABtnPrim", A_button_ori);
f32 t;
t = this->cursorAnimTween;
@ -1896,13 +1898,13 @@ void EnOssan_UpdateCursorAnim(EnOssan* this) {
this->cursorColorG = ColChanMix(80, 80.0f, t);
this->cursorColorB = ColChanMix(255, 0.0f, t);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
this->cursorColorR = ColChanMix(0, 0.0f, t);
this->cursorColorG = ColChanMix(255, 80.0f, t);
this->cursorColorB = ColChanMix(80, 0.0f, t);
this->cursorColorR = ColChanMix(A_button_ori.r, 0.0f, t);
this->cursorColorG = ColChanMix(A_button_ori.b, 80.0f, t);
this->cursorColorB = ColChanMix(A_button_ori.r, 0.0f, t);
} else if (CVar_GetS32("gHudColors", 1) == 2) {
this->cursorColorR = ColChanMix(CVar_GetS32("gCCABtnPrimR", 90), ((CVar_GetS32("gCCABtnPrimR", 90)/255)*100), t);
this->cursorColorG = ColChanMix(CVar_GetS32("gCCABtnPrimG", 90), ((CVar_GetS32("gCCABtnPrimG", 90)/255)*100), t);
this->cursorColorB = ColChanMix(CVar_GetS32("gCCABtnPrimB", 90), ((CVar_GetS32("gCCABtnPrimB", 90)/255)*100), t);
this->cursorColorR = ColChanMix(A_button.r, ((A_button.r/255)*100), t);
this->cursorColorG = ColChanMix(A_button.g, ((A_button.g/255)*100), t);
this->cursorColorB = ColChanMix(A_button.b, ((A_button.b/255)*100), t);
}
this->cursorColorA = ColChanMix(255, 0.0f, t);
this->cursorAnimTween = t;

View File

@ -331,6 +331,9 @@ s32 func_80B0C9F0(EnSw* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_DAMAGE);
return true;
}
if(CVar_GetS32("gGsCutscene", 0)) {
OnePointCutscene_Init(globalCtx, 2200, 90, &this->actor, MAIN_CAM);
}
Enemy_StartFinishingBlow(globalCtx, &this->actor);
if (((this->actor.params & 0xE000) >> 0xD) != 0) {
this->skelAnime.playSpeed = 8.0f;

View File

@ -2492,4 +2492,4 @@ void EnXc_Reset(void) {
sEnXcFlameSpawned = false;
D_80B41DA8 = 1;
D_80B41DAC = 1;
}
}

View File

@ -198,6 +198,10 @@ void MagicDark_DiamondDraw(Actor* thisx, GlobalContext* globalCtx) {
MagicDark* this = (MagicDark*)thisx;
s32 pad;
u16 gameplayFrames = globalCtx->gameplayFrames;
Color_RGB8 Spell_env_ori = {0, 100, 255};
Color_RGB8 Spell_col_ori = {170, 255, 255};
Color_RGB8 Spell_env = CVar_GetRGB("gNL_Diamond_Env", Spell_env_ori);
Color_RGB8 Spell_col = CVar_GetRGB("gNL_Diamond_Col", Spell_col_ori);
OPEN_DISPS(globalCtx->state.gfxCtx);
@ -221,8 +225,8 @@ void MagicDark_DiamondDraw(Actor* thisx, GlobalContext* globalCtx) {
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (CVar_GetS32("gUseSpellsCol",0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetS32("gNL_Diamond_ColR",170), CVar_GetS32("gNL_Diamond_ColG",255), CVar_GetS32("gNL_Diamond_ColB",255), (s32)(this->primAlpha * 0.6f) & 0xFF);
gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetS32("gNL_Diamond_EnvR",100), CVar_GetS32("gNL_Diamond_EnvG",100), CVar_GetS32("gNL_Diamond_EnvB",255), 128);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, Spell_col.r, Spell_col.g, Spell_col.b, (s32)(this->primAlpha * 0.6f) & 0xFF);
gDPSetEnvColor(POLY_XLU_DISP++, Spell_env.r, Spell_env.g, Spell_env.b, 128);
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 255, 255, (s32)(this->primAlpha * 0.6f) & 0xFF);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 128);

View File

@ -216,7 +216,11 @@ void MagicFire_Draw(Actor* thisx, GlobalContext* globalCtx) {
s32 pad2;
s32 i;
u8 alpha;
Color_RGB8 Spell_env_ori = {255, 0, 0};
Color_RGB8 Spell_col_ori = {255, 200, 0};
Color_RGB8 Spell_env = CVar_GetRGB("gDF_Env", Spell_env_ori);
Color_RGB8 Spell_col = CVar_GetRGB("gDF_Col", Spell_col_ori);
if (this->action > 0) {
OPEN_DISPS(globalCtx->state.gfxCtx);
POLY_XLU_DISP = func_800937C0(POLY_XLU_DISP);
@ -228,11 +232,11 @@ void MagicFire_Draw(Actor* thisx, GlobalContext* globalCtx) {
gDPFillRectangle(POLY_XLU_DISP++, 0, 0, 319, 239);
func_80093D84(globalCtx->state.gfxCtx);
if (CVar_GetS32("gUseSpellsCol",0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetS32("gDF_ColR",255), CVar_GetS32("gDF_ColG",200), CVar_GetS32("gDF_ColB",0), (u8)(this->alphaMultiplier * 255));
gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetS32("gDF_EnvR",255), CVar_GetS32("gDF_EnvG",0), CVar_GetS32("gDF_EnvB",0), (u8)(this->alphaMultiplier * 255));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, Spell_col.r, Spell_col.g, Spell_col.b, (u8)(this->alphaMultiplier * 255));
gDPSetEnvColor(POLY_XLU_DISP++, Spell_env.r, Spell_env.g, Spell_env.b, (u8)(this->alphaMultiplier * 255));
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, 255, 200, 0, (u8)(this->alphaMultiplier * 255));
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, (u8)(this->alphaMultiplier * 255));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, Spell_col_ori.r, Spell_col_ori.g, Spell_col_ori.b, (u8)(this->alphaMultiplier * 255));
gDPSetEnvColor(POLY_XLU_DISP++, Spell_env_ori.r, Spell_env_ori.g, Spell_env_ori.b, (u8)(this->alphaMultiplier * 255));
}
Matrix_Scale(0.15f, 0.15f, 0.15f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),

View File

@ -10372,6 +10372,7 @@ void func_80848EF8(Player* this, GlobalContext* globalCtx) {
/*Prevent it on horse, while jumping and on title screen.
If you fly around no stone of agony for you! */
Color_RGB8 StoneOfAgony_ori = { 255, 255, 255 };
if (CVar_GetS32("gVisualAgony", 0) !=0 && !this->stateFlags1) {
s16 Top_Margins = (CVar_GetS32("gHUDMargin_T", 0)*-1);
s16 Left_Margins = CVar_GetS32("gHUDMargin_L", 0);
@ -10417,30 +10418,34 @@ void func_80848EF8(Player* this, GlobalContext* globalCtx) {
gDPPipeSync(OVERLAY_DISP++);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCVSOAPrimR", 255), CVar_GetS32("gCCVSOAPrimG", 255), CVar_GetS32("gCCVSOAPrimB", 255), DefaultIconA);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).r,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).g,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).b, DefaultIconA);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, DefaultIconA);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, StoneOfAgony_ori.r, StoneOfAgony_ori.g, StoneOfAgony_ori.b, DefaultIconA);
}
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
if (this->unk_6A0 > 4000000.0f) {
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCVSOAPrimR", 255), CVar_GetS32("gCCVSOAPrimG", 255), CVar_GetS32("gCCVSOAPrimB", 255), 255);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).r,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).g,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).b, 255);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, StoneOfAgony_ori.r, StoneOfAgony_ori.g, StoneOfAgony_ori.b, 255);
}
} else {
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCVSOAPrimR", 255), CVar_GetS32("gCCVSOAPrimG", 255), CVar_GetS32("gCCVSOAPrimB", 255), DefaultIconA);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).r,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).g,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).b, DefaultIconA);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, DefaultIconA);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, StoneOfAgony_ori.r, StoneOfAgony_ori.g, StoneOfAgony_ori.b, DefaultIconA);
}
}
if (temp == 0 || temp <= 0.1f) {
/*Fail check, it is used to draw off the icon when
link is standing out range but do not refresh unk_6A0.
Also used to make a default value in my case.*/
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, DefaultIconA);
/*Fail check, it is used to draw off the icon when
link is standing out range but do not refresh unk_6A0.
Also used to make a default value in my case.*/
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).r,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).g,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).b, DefaultIconA);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, StoneOfAgony_ori.r, StoneOfAgony_ori.g, StoneOfAgony_ori.b, DefaultIconA);
}
}
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255);
gDPSetOtherMode(OVERLAY_DISP++, G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_IA16 | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2);
@ -11182,42 +11187,83 @@ void Player_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
s16 func_8084ABD8(GlobalContext* globalCtx, Player* this, s32 arg2, s16 arg3) {
s32 temp1;
s16 temp2;
s16 temp3;
s32 temp1;
s16 temp2;
s16 temp3;
if (!func_8002DD78(this) && !func_808334B4(this) && (arg2 == 0)) {
temp2 = sControlInput->rel.stick_y * 240.0f;
Math_SmoothStepToS(&this->actor.focus.rot.x, temp2, 14, 4000, 30);
if (!func_8002DD78(this) && !func_808334B4(this) && (arg2 == 0)) {
if (CVar_GetS32("gAutoCenterView", 0) != 0) {
temp2 = sControlInput->rel.stick_y * 240.0f * (CVar_GetS32("gInvertYAxis", 0) ? -1 : 1);
Math_SmoothStepToS(&this->actor.focus.rot.x, temp2, 14, 4000, 30);
temp2 = sControlInput->rel.stick_x * -16.0f;
temp2 = CLAMP(temp2, -3000, 3000);
this->actor.focus.rot.y += temp2;
}
else {
temp1 = (this->stateFlags1 & PLAYER_STATE1_23) ? 3500 : 14000;
temp3 = ((sControlInput->rel.stick_y >= 0) ? 1 : -1) *
(s32)((1.0f - Math_CosS(sControlInput->rel.stick_y * 200)) * 1500.0f);
this->actor.focus.rot.x += temp3;
temp2 = sControlInput->rel.stick_x * -16.0f * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1);
temp2 = CLAMP(temp2, -3000, 3000);
this->actor.focus.rot.y += temp2;
} else {
temp1 = (this->stateFlags1 & PLAYER_STATE1_23) ? 3500 : 14000;
temp3 = ((sControlInput->rel.stick_y >= 0) ? 1 : -1) *
(s32)((1.0f - Math_CosS(sControlInput->rel.stick_y * 200)) * 1500.0f * (CVar_GetS32("gInvertYAxis", 0) ? 1 : -1));
this->actor.focus.rot.x += temp3;
if (fabsf(sControlInput->cur.gyro_x) > 0.01f) {
this->actor.focus.rot.x -= (sControlInput->cur.gyro_x) * 750.0f;
}
if (fabsf(sControlInput->cur.gyro_x) > 0.01f) {
this->actor.focus.rot.x -= (sControlInput->cur.gyro_x) * 750.0f;
}
if (fabsf(sControlInput->cur.right_stick_y) > 15.0f && CVar_GetS32("gRightStickAiming", 0) != 0) {
this->actor.focus.rot.x -= (sControlInput->cur.right_stick_y) * 10.0f * (CVar_GetS32("gInvertYAxis", 0) ? -1 : 1);
}
this->actor.focus.rot.x = CLAMP(this->actor.focus.rot.x, -temp1, temp1);
this->actor.focus.rot.x = CLAMP(this->actor.focus.rot.x, -temp1, temp1);
temp1 = 19114;
temp2 = this->actor.focus.rot.y - this->actor.shape.rot.y;
temp3 = ((sControlInput->rel.stick_x >= 0) ? 1 : -1) *
(s32)((1.0f - Math_CosS(sControlInput->rel.stick_x * 200)) * -1500.0f);
temp2 += temp3;
temp1 = 19114;
temp2 = this->actor.focus.rot.y - this->actor.shape.rot.y;
temp3 = ((sControlInput->rel.stick_x >= 0) ? 1 : -1) *
(s32)((1.0f - Math_CosS(sControlInput->rel.stick_x * 200)) * -1500.0f * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1));
temp2 += temp3;
this->actor.focus.rot.y = CLAMP(temp2, -temp1, temp1) + this->actor.shape.rot.y;
this->actor.focus.rot.y = CLAMP(temp2, -temp1, temp1) + this->actor.shape.rot.y;
if (fabsf(sControlInput->cur.gyro_y) > 0.01f) {
this->actor.focus.rot.y += (sControlInput->cur.gyro_y) * 750.0f;
}
}
if (fabsf(sControlInput->cur.gyro_y) > 0.01f) {
this->actor.focus.rot.y += (sControlInput->cur.gyro_y) * 750.0f;
}
if (fabsf(sControlInput->cur.right_stick_x) > 15.0f && CVar_GetS32("gRightStickAiming", 0) != 0) {
this->actor.focus.rot.y += (sControlInput->cur.right_stick_x) * 10.0f * (CVar_GetS32("gInvertXAxis", 0) ? 1 : -1);
}
}
}
else {
temp1 = (this->stateFlags1 & PLAYER_STATE1_23) ? 3500 : 14000;
temp3 = ((sControlInput->rel.stick_y >= 0) ? 1 : -1) *
(s32)((1.0f - Math_CosS(sControlInput->rel.stick_y * 200)) * 1500.0f * (CVar_GetS32("gInvertYAxis", 0) ? 1 : -1));
this->actor.focus.rot.x += temp3;
if (fabsf(sControlInput->cur.gyro_x) > 0.01f) {
this->actor.focus.rot.x -= (sControlInput->cur.gyro_x) * 750.0f;
}
if (fabsf(sControlInput->cur.right_stick_y) > 15.0f && CVar_GetS32("gRightStickAiming", 0) != 0) {
this->actor.focus.rot.x -= (sControlInput->cur.right_stick_y) * 10.0f * (CVar_GetS32("gInvertYAxis", 0) ? -1 : 1);
}
this->actor.focus.rot.x = CLAMP(this->actor.focus.rot.x, -temp1, temp1);
temp1 = 19114;
temp2 = this->actor.focus.rot.y - this->actor.shape.rot.y;
temp3 = ((sControlInput->rel.stick_x >= 0) ? 1 : -1) *
(s32)((1.0f - Math_CosS(sControlInput->rel.stick_x * 200)) * -1500.0f * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1));
temp2 += temp3;
this->actor.focus.rot.y = CLAMP(temp2, -temp1, temp1) + this->actor.shape.rot.y;
if (fabsf(sControlInput->cur.gyro_y) > 0.01f) {
this->actor.focus.rot.y += (sControlInput->cur.gyro_y) * 750.0f;
}
if (fabsf(sControlInput->cur.right_stick_x) > 15.0f && CVar_GetS32("gRightStickAiming", 0) != 0) {
this->actor.focus.rot.y += (sControlInput->cur.right_stick_x) * 10.0f * (CVar_GetS32("gInvertXAxis", 0) ? 1 : -1);
}
}
this->unk_6AE |= 2;
return func_80836AB8(this, (globalCtx->shootingGalleryStatus != 0) || func_8002DD78(this) || func_808334B4(this)) -
@ -12604,6 +12650,7 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) {
giEntry.itemId == RG_MAGIC_DOUBLE) {
Audio_PlayFanfare(NA_BGM_HEART_GET | 0x900);
} else {
// Just in case something weird happens with MOD_INDEX
Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900);
}
} else {

View File

@ -1155,6 +1155,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
s16 quadVtxIndex;
s16 isActive;
s16 pad;
Color_RGB8 Background_Color = { this->windowColor[0], this->windowColor[1], this->windowColor[2] };
OPEN_DISPS(this->state.gfxCtx);
@ -1187,11 +1188,9 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
gDPPipeSync(POLY_OPA_DISP++);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
CVar_GetS32("gCCFileChoosePrimB", 255), this->fileInfoAlpha[fileIndex]);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->fileInfoAlpha[fileIndex]);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->fileInfoAlpha[fileIndex]);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, Background_Color.r, Background_Color.g, Background_Color.b, this->fileInfoAlpha[fileIndex]);
}
gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[temp], 20, 0);
@ -1210,8 +1209,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
isActive = 0;
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
CVar_GetS32("gCCFileChoosePrimB", 255), this->fileButtonAlpha[i]);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->fileButtonAlpha[i]);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1],
sWindowContentColors[isActive][2], this->fileButtonAlpha[i]);
@ -1224,8 +1222,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
// draw file name box
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
CVar_GetS32("gCCFileChoosePrimB", 255), this->nameBoxAlpha[i]);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->nameBoxAlpha[i]);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1],
sWindowContentColors[isActive][2], this->nameBoxAlpha[i]);
@ -1239,9 +1236,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
// draw disk label for 64DD
if (Save_GetSaveMetaInfo(i)->randoSave) {
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100),
CVar_GetS32("gCCFileChoosePrimG", 150), CVar_GetS32("gCCFileChoosePrimB", 255),
this->nameAlpha[i]);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->nameAlpha[i]);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0],
sWindowContentColors[isActive][1], sWindowContentColors[isActive][2],
@ -1255,9 +1250,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
// draw connectors
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100),
CVar_GetS32("gCCFileChoosePrimG", 150), CVar_GetS32("gCCFileChoosePrimB", 255),
this->connectorAlpha[i]);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->connectorAlpha[i]);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1],
sWindowContentColors[isActive][2], this->connectorAlpha[i]);
@ -1289,8 +1282,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
gDPPipeSync(POLY_OPA_DISP++);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
CVar_GetS32("gCCFileChoosePrimB", 255), this->actionButtonAlpha[i]);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->actionButtonAlpha[i]);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->actionButtonAlpha[i]);
@ -1308,8 +1300,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
temp = this->confirmButtonTexIndices[i];
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
CVar_GetS32("gCCFileChoosePrimB", 255), this->confirmButtonAlpha[i]);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->confirmButtonAlpha[i]);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->confirmButtonAlpha[i]);
@ -1324,8 +1315,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
gDPPipeSync(POLY_OPA_DISP++);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
CVar_GetS32("gCCFileChoosePrimB", 255), this->optionButtonAlpha);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->optionButtonAlpha);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->optionButtonAlpha);
@ -1346,9 +1336,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
PRIMITIVE, 0);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 155),
CVar_GetS32("gCCFileChoosePrimG", 255), CVar_GetS32("gCCFileChoosePrimB", 255),
this->highlightColor[3]);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->highlightColor[3]);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->highlightColor[0], this->highlightColor[1],
this->highlightColor[2], this->highlightColor[3]);
@ -1383,6 +1371,7 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
f32 eyeX;
f32 eyeY;
f32 eyeZ;
Color_RGB8 Background_Color = {this->windowColor[0], this->windowColor[1], this->windowColor[2]};
OPEN_DISPS(this->state.gfxCtx);
gDPPipeSync(POLY_OPA_DISP++);
@ -1409,8 +1398,7 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
CVar_GetS32("gCCFileChoosePrimB", 255), this->windowAlpha);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->windowAlpha);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->windowAlpha);
@ -1447,8 +1435,7 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
CVar_GetS32("gCCFileChoosePrimB", 255), this->windowAlpha);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->windowAlpha);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->windowAlpha);
@ -1481,8 +1468,7 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
CVar_GetS32("gCCFileChoosePrimB", 255), this->windowAlpha);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->windowAlpha);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->windowAlpha);
@ -1819,6 +1805,7 @@ void FileChoose_SelectModeDraw(GameState* thisx) {
f32 eyeX;
f32 eyeY;
f32 eyeZ;
Color_RGB8 Background_Color = { this->windowColor[0], this->windowColor[1], this->windowColor[2] };
OPEN_DISPS(this->state.gfxCtx);
@ -1842,8 +1829,7 @@ void FileChoose_SelectModeDraw(GameState* thisx) {
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
CVar_GetS32("gCCFileChoosePrimB", 255), this->windowAlpha);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->windowAlpha);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->windowAlpha);
@ -1892,6 +1878,7 @@ void FileChoose_Main(GameState* thisx) {
gFileSelControlsGERTex,
gFileSelControlsFRATex,
};
Color_RGB8 Text_Color = { 100, 255, 255 };
FileChooseContext* this = (FileChooseContext*)thisx;
Input* input = &this->state.input[0];
@ -2028,11 +2015,9 @@ void FileChoose_Main(GameState* thisx) {
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChooseTextPrimR", 100),
CVar_GetS32("gCCFileChooseTextPrimG", 255), CVar_GetS32("gCCFileChooseTextPrimB", 255),
this->controlsAlpha);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChooseTextPrim", Text_Color).r, CVar_GetRGB("gCCFileChooseTextPrim", Text_Color).g, CVar_GetRGB("gCCFileChooseTextPrim", Text_Color).b, this->controlsAlpha);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 255, 255, this->controlsAlpha);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, Text_Color.r, Text_Color.g, Text_Color.b, this->controlsAlpha);
}
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
gDPLoadTextureBlock(POLY_OPA_DISP++, controlsTextures[gSaveContext.language], G_IM_FMT_IA, G_IM_SIZ_8b, 144, 16,

View File

@ -5,6 +5,14 @@
extern const char* digitTextures[];
void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfxCtx) {
Color_RGB8 A_button_ori = {80, 255, 150};
Color_RGB8 A_button = CVar_GetRGB("gCCABtnPrim", A_button_ori);
Color_RGB8 C_button_ori = {255, 255, 50};
Color_RGB8 C_button_uni = CVar_GetRGB("gCCCBtnPrim", C_button_ori);
Color_RGB8 C_button_U = CVar_GetRGB("gCCCUBtnPrim", C_button_ori);
Color_RGB8 C_button_D = CVar_GetRGB("gCCCDBtnPrim", C_button_ori);
Color_RGB8 C_button_L = CVar_GetRGB("gCCCLBtnPrim", C_button_ori);
Color_RGB8 C_button_R = CVar_GetRGB("gCCCRBtnPrim", C_button_ori);
static s16 D_8082A070[][4] = {
{ 255, 0, 0, 255 },
{ 255, 70, 0, 150 },
@ -493,29 +501,30 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
gDPPipeSync(POLY_KAL_DISP++);
s16 Notes_alpha = D_8082A150[sp218];
if (D_8082A124[sp218] == 0) {
if (CVar_GetS32("gHudColors", 1) == 0) { // A Button notes
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 150, 255, D_8082A150[sp218]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 150, 255, Notes_alpha);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 255, 150, D_8082A150[sp218]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button_ori.r, A_button_ori.g, A_button_ori.b, Notes_alpha);
} else if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", 80), CVar_GetS32("gCCABtnPrimG", 255), CVar_GetS32("gCCABtnPrimB", 150), D_8082A150[sp218]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button.r, A_button.g, A_button.b, Notes_alpha);
}
} else {
if (CVar_GetS32("gHudColors", 1) == 0) { // C Buttons notes
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 50, D_8082A150[sp218]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, Notes_alpha);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 50, D_8082A150[sp218]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, Notes_alpha);
} else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", 255), CVar_GetS32("gCCCBtnPrimG", 160), CVar_GetS32("gCCCBtnPrimB", 0), D_8082A150[sp218]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, Notes_alpha);
} else if (D_8082A124[sp218] == OCARINA_NOTE_D5 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCUBtnPrimR", 255), CVar_GetS32("gCCCUBtnPrimG", 160), CVar_GetS32("gCCCUBtnPrimB", 0), D_8082A150[sp218]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_U.r, C_button_U.g, C_button_U.b, Notes_alpha);
} else if (D_8082A124[sp218] == OCARINA_NOTE_B4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCLBtnPrimR", 255), CVar_GetS32("gCCCLBtnPrimG", 160), CVar_GetS32("gCCCLBtnPrimB", 0), D_8082A150[sp218]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_L.r, C_button_L.g, C_button_L.b, Notes_alpha);
} else if (D_8082A124[sp218] == OCARINA_NOTE_A4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCRBtnPrimR", 255), CVar_GetS32("gCCCRBtnPrimG", 160), CVar_GetS32("gCCCRBtnPrimB", 0), D_8082A150[sp218]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_R.r, C_button_R.g, C_button_R.b, Notes_alpha);
} else if (D_8082A124[sp218] == OCARINA_NOTE_F4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCDBtnPrimR", 255), CVar_GetS32("gCCCDBtnPrimG", 160), CVar_GetS32("gCCCDBtnPrimB", 0), D_8082A150[sp218]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_D.r, C_button_D.g, C_button_D.b, Notes_alpha);
}
}
@ -543,29 +552,30 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
gDPPipeSync(POLY_KAL_DISP++);
if (pauseCtx->unk_1E4 == 8) {
s16 Notes_alpha = 200;
if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == 0) {
if (CVar_GetS32("gHudColors", 1) == 0) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 150, 255, 200);
if (CVar_GetS32("gHudColors", 1) == 0) { // A Button notes
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 150, 255, Notes_alpha);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 255, 150, 200);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button_ori.r, A_button_ori.g, A_button_ori.b, Notes_alpha);
} else if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", 80), CVar_GetS32("gCCABtnPrimG", 255), CVar_GetS32("gCCABtnPrimB", 150), 200);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button.r, A_button.g, A_button.b, Notes_alpha);
}
} else {
if (CVar_GetS32("gHudColors", 1) == 0) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 50, 200);
if (CVar_GetS32("gHudColors", 1) == 0) { // C Buttons notes
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, Notes_alpha);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 50, 200);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, Notes_alpha);
} else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", 255), CVar_GetS32("gCCCBtnPrimG", 160), CVar_GetS32("gCCCBtnPrimB", 0), 200);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, Notes_alpha);
} else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_D5 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCUBtnPrimR", 255), CVar_GetS32("gCCCUBtnPrimG", 160), CVar_GetS32("gCCCUBtnPrimB", 0), 200);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_U.r, C_button_U.g, C_button_U.b, Notes_alpha);
} else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_B4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCLBtnPrimR", 255), CVar_GetS32("gCCCLBtnPrimG", 160), CVar_GetS32("gCCCLBtnPrimB", 0), 200);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_L.r, C_button_L.g, C_button_L.b, Notes_alpha);
} else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_A4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCRBtnPrimR", 255), CVar_GetS32("gCCCRBtnPrimG", 160), CVar_GetS32("gCCCRBtnPrimB", 0), 200);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_R.r, C_button_R.g, C_button_R.b, Notes_alpha);
} else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_F4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCDBtnPrimR", 255), CVar_GetS32("gCCCDBtnPrimG", 160), CVar_GetS32("gCCCDBtnPrimB", 0), 200);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_D.r, C_button_D.g, C_button_D.b, Notes_alpha);
}
}
} else {
@ -618,27 +628,28 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
gDPPipeSync(POLY_KAL_DISP++);
s16 Notes_alpha = D_8082A150[phi_s3];
if (D_8082A124[phi_s3] == 0) {
if (CVar_GetS32("gHudColors", 1) == 0) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 150, 255, 200);
if (CVar_GetS32("gHudColors", 1) == 0) { // A Button notes
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 150, 255, Notes_alpha);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 255, 150, D_8082A150[phi_s3]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button_ori.r, A_button_ori.g, A_button_ori.b, Notes_alpha);
} else if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", 80), CVar_GetS32("gCCABtnPrimG", 255), CVar_GetS32("gCCABtnPrimB", 150), D_8082A150[phi_s3]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button.r, A_button.g, A_button.b, Notes_alpha);
}
} else {
if (CVar_GetS32("gHudColors", 1) == 0) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 50, 200);
if (CVar_GetS32("gHudColors", 1) == 0) { // C Buttons notes
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, Notes_alpha);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, Notes_alpha);
} else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", 255), CVar_GetS32("gCCCBtnPrimG", 255), CVar_GetS32("gCCCBtnPrimB", 0), D_8082A150[phi_s3]);
} else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_D5 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCUBtnPrimR", 255), CVar_GetS32("gCCCUBtnPrimG", 255), CVar_GetS32("gCCCUBtnPrimB", 0), D_8082A150[phi_s3]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, Notes_alpha);
} else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_B4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCLBtnPrimR", 255), CVar_GetS32("gCCCLBtnPrimG", 255), CVar_GetS32("gCCCLBtnPrimB", 0), D_8082A150[phi_s3]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_L.r, C_button_L.g, C_button_L.b, Notes_alpha);
} else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_A4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCRBtnPrimR", 255), CVar_GetS32("gCCCRBtnPrimG", 255), CVar_GetS32("gCCCRBtnPrimB", 0), D_8082A150[phi_s3]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_R.r, C_button_R.g, C_button_R.b, Notes_alpha);
} else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_F4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCDBtnPrimR", 255), CVar_GetS32("gCCCDBtnPrimG", 255), CVar_GetS32("gCCCDBtnPrimB", 0), D_8082A150[phi_s3]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_D.r, C_button_D.g, C_button_D.b, Notes_alpha);
}
}

View File

@ -761,6 +761,13 @@ static s16 sCursorColors[][3] = {
{ 0, 255, 50 },
};
const Color_RGB8 Cursor_ABTN_ori = {0, 255, 50};
const Color_RGB8 Cursor_ABTNN64_ori = {0, 50, 255};
const Color_RGB8 Cursor_CBTN_ori = {255, 255, 0};
const Color_RGB8 Cursor_StartBTN_ori = {255, 255, 255};
Color_RGB8 Cursor_ABTN;
Color_RGB8 Cursor_CBTN;
static void* sSavePromptTexs[] = {
gPauseSavePromptENGTex,
gPauseSavePromptGERTex,
@ -987,26 +994,27 @@ void KaleidoScope_DrawCursor(GlobalContext* globalCtx, u16 pageIndex) {
temp = pauseCtx->unk_1E4;
if (CVar_GetS32("gHudColors", 1) == 0) {
sCursorColors[1][0] = 255;
sCursorColors[1][1] = 255;
sCursorColors[1][2] = 0;
sCursorColors[2][0] = 0;
sCursorColors[2][1] = 50;
sCursorColors[2][2] = 255;
//Will be converted to ColorRGB later.
sCursorColors[1][0] = Cursor_CBTN_ori.r;
sCursorColors[1][1] = Cursor_CBTN_ori.g;
sCursorColors[1][2] = Cursor_CBTN_ori.b;
sCursorColors[2][0] = Cursor_ABTNN64_ori.r;
sCursorColors[2][1] = Cursor_ABTNN64_ori.g;
sCursorColors[2][2] = Cursor_ABTNN64_ori.b;
} else if (CVar_GetS32("gHudColors", 1) == 1) {
sCursorColors[1][0] = 255;
sCursorColors[1][1] = 255;
sCursorColors[1][2] = 0;
sCursorColors[2][0] = 0;
sCursorColors[2][1] = 255;
sCursorColors[2][2] = 50;
sCursorColors[1][0] = Cursor_CBTN_ori.r;
sCursorColors[1][1] = Cursor_CBTN_ori.g;
sCursorColors[1][2] = Cursor_CBTN_ori.b;
sCursorColors[2][0] = Cursor_ABTN_ori.r;
sCursorColors[2][1] = Cursor_ABTN_ori.g;
sCursorColors[2][2] = Cursor_ABTN_ori.b;
} else if (CVar_GetS32("gHudColors", 1) == 2) {
sCursorColors[1][0] = CVar_GetS32("gCCCBtnPrimR", 255);
sCursorColors[1][1] = CVar_GetS32("gCCCBtnPrimG", 255);
sCursorColors[1][2] = CVar_GetS32("gCCCBtnPrimB", 0);
sCursorColors[2][0] = CVar_GetS32("gCCABtnPrimR", 0);
sCursorColors[2][1] = CVar_GetS32("gCCABtnPrimG", 255);
sCursorColors[2][2] = CVar_GetS32("gCCABtnPrimB", 50);
sCursorColors[1][0] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).r;
sCursorColors[1][1] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).g;
sCursorColors[1][2] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).b;
sCursorColors[2][0] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).r;
sCursorColors[2][1] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).g;
sCursorColors[2][2] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).b;
}
if ((((pauseCtx->unk_1E4 == 0) || (temp == 8)) && (pauseCtx->state == 6)) ||
@ -1079,45 +1087,46 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) {
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 255, 255, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 255, 255, 0 }, { 0, 255, 50 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 255, 50 },
};
const Color_RGB8 A_BTN_ori = {100, 255, 100};
if (CVar_GetS32("gHudColors", 1) == 0) {
D_8082ACF4[4][0] = 255;
D_8082ACF4[4][1] = 255;
D_8082ACF4[4][2] = 0;
D_8082ACF4[7][0] = 255;
D_8082ACF4[7][1] = 255;
D_8082ACF4[7][2] = 0;
D_8082ACF4[8][0] = 0;
D_8082ACF4[8][1] = 50;
D_8082ACF4[8][2] = 255;
D_8082ACF4[11][0] = 0;
D_8082ACF4[11][1] = 50;
D_8082ACF4[11][2] = 255;
D_8082ACF4[4][0] = Cursor_CBTN_ori.r;
D_8082ACF4[4][1] = Cursor_CBTN_ori.g;
D_8082ACF4[4][2] = Cursor_CBTN_ori.b;
D_8082ACF4[7][0] = Cursor_CBTN_ori.r;
D_8082ACF4[7][1] = Cursor_CBTN_ori.g;
D_8082ACF4[7][2] = Cursor_CBTN_ori.b;
D_8082ACF4[8][0] = Cursor_ABTNN64_ori.r;
D_8082ACF4[8][1] = Cursor_ABTNN64_ori.g;
D_8082ACF4[8][2] = Cursor_ABTNN64_ori.b;
D_8082ACF4[11][0] = Cursor_ABTNN64_ori.r;
D_8082ACF4[11][1] = Cursor_ABTNN64_ori.g;
D_8082ACF4[11][2] = Cursor_ABTNN64_ori.b;
} else if (CVar_GetS32("gHudColors", 1) == 1) {
D_8082ACF4[4][0] = 255;
D_8082ACF4[4][1] = 255;
D_8082ACF4[4][2] = 0;
D_8082ACF4[7][0] = 255;
D_8082ACF4[7][1] = 255;
D_8082ACF4[7][2] = 0;
D_8082ACF4[8][0] = 0;
D_8082ACF4[8][1] = 255;
D_8082ACF4[8][2] = 50;
D_8082ACF4[11][0] = 0;
D_8082ACF4[11][1] = 255;
D_8082ACF4[11][2] = 50;
D_8082ACF4[4][0] = Cursor_CBTN_ori.r;
D_8082ACF4[4][1] = Cursor_CBTN_ori.g;
D_8082ACF4[4][2] = Cursor_CBTN_ori.b;
D_8082ACF4[7][0] = Cursor_CBTN_ori.r;
D_8082ACF4[7][1] = Cursor_CBTN_ori.g;
D_8082ACF4[7][2] = Cursor_CBTN_ori.b;
D_8082ACF4[8][0] = Cursor_ABTN_ori.r;
D_8082ACF4[8][1] = Cursor_ABTN_ori.g;
D_8082ACF4[8][2] = Cursor_ABTN_ori.b;
D_8082ACF4[11][0] = Cursor_ABTN_ori.r;
D_8082ACF4[11][1] = Cursor_ABTN_ori.g;
D_8082ACF4[11][2] = Cursor_ABTN_ori.b;
} else if (CVar_GetS32("gHudColors", 1) == 2) {
D_8082ACF4[4][0] = CVar_GetS32("gCCCBtnPrimR", 255);
D_8082ACF4[4][1] = CVar_GetS32("gCCCBtnPrimG", 255);
D_8082ACF4[4][2] = CVar_GetS32("gCCCBtnPrimB", 0);
D_8082ACF4[7][0] = CVar_GetS32("gCCCBtnPrimR", 255);
D_8082ACF4[7][1] = CVar_GetS32("gCCCBtnPrimG", 255);
D_8082ACF4[7][2] = CVar_GetS32("gCCCBtnPrimB", 0);
D_8082ACF4[8][0] = CVar_GetS32("gCCABtnPrimR", 0);
D_8082ACF4[8][1] = CVar_GetS32("gCCABtnPrimG", 255);
D_8082ACF4[8][2] = CVar_GetS32("gCCABtnPrimB", 50);
D_8082ACF4[11][0] = CVar_GetS32("gCCABtnPrimR", 0);
D_8082ACF4[11][1] = CVar_GetS32("gCCABtnPrimG", 255);
D_8082ACF4[11][2] = CVar_GetS32("gCCABtnPrimB", 50);
D_8082ACF4[4][0] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).r;
D_8082ACF4[4][1] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).g;
D_8082ACF4[4][2] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).b;
D_8082ACF4[7][0] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).r;
D_8082ACF4[7][1] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).g;
D_8082ACF4[7][2] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).b;
D_8082ACF4[8][0] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).r;
D_8082ACF4[8][1] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).g;
D_8082ACF4[8][2] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).b;
D_8082ACF4[11][0] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).r;
D_8082ACF4[11][1] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).g;
D_8082ACF4[11][2] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).b;
}
static s16 D_8082AD3C = 20;
static s16 D_8082AD40 = 0;
@ -1499,7 +1508,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) {
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 100, 255, 100, VREG(61));
} else if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", 100), CVar_GetS32("gCCABtnPrimG", 255), CVar_GetS32("gCCABtnPrimB", 100), VREG(61)); //Save prompt cursor colour
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetRGB("gCCABtnPrim", A_BTN_ori).r, CVar_GetRGB("gCCABtnPrim", A_BTN_ori).g, CVar_GetRGB("gCCABtnPrim", A_BTN_ori).b, VREG(61)); //Save prompt cursor colour
}
if (pauseCtx->promptChoice == 0) {
@ -1563,6 +1572,14 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
{ 0, 255, 100, 255 },//Gamecube
{ 0, 100, 255, 255 },//Original N64
};
Color_RGB8 A_button_ori = {gABtnTexColour[0][0],gABtnTexColour[0][1],gABtnTexColour[0][2]};
Color_RGB8 A_button = CVar_GetRGB("gCCABtnPrim", A_button_ori);
Color_RGB8 C_button_ori = {R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2)};
Color_RGB8 C_button_uni = CVar_GetRGB("gCCCBtnPrim", C_button_ori);
Color_RGB8 C_button_U = CVar_GetRGB("gCCCUBtnPrim", C_button_ori);
Color_RGB8 C_button_D = CVar_GetRGB("gCCCDBtnPrim", C_button_ori);
Color_RGB8 C_button_L = CVar_GetRGB("gCCCLBtnPrim", C_button_ori);
Color_RGB8 C_button_R = CVar_GetRGB("gCCCRBtnPrim", C_button_ori);
static const void* sToEquipTextures[3] = {
gPauseToEquipENGTex,
gPauseToEquipGERTex,
@ -1889,11 +1906,11 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
pauseCtx->infoPanelVtx[21].v.tc[0] = pauseCtx->infoPanelVtx[23].v.tc[0] = D_8082ADE0[gSaveContext.language]
<< 5;
if (CVar_GetS32("gHudColors", 1) == 0) {//A icon to decide in save prompt
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, gABtnTexColour[1][0], gABtnTexColour[1][1], gABtnTexColour[1][2], gABtnTexColour[1][3]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, gABtnTexColour[1][0], gABtnTexColour[1][1], gABtnTexColour[1][2], gABtnTexColour[1][3]);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, gABtnTexColour[0][0], gABtnTexColour[0][1], gABtnTexColour[0][2], gABtnTexColour[0][3]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, gABtnTexColour[0][0], gABtnTexColour[0][1], gABtnTexColour[0][2], gABtnTexColour[0][3]);
} else if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", gABtnTexColour[0][0]), CVar_GetS32("gCCABtnPrimG", gABtnTexColour[0][1]), CVar_GetS32("gCCABtnPrimB", gABtnTexColour[0][2]), gABtnTexColour[0][3]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button.r, A_button.g, A_button.b, gABtnTexColour[0][3]);
}
//gSPDisplayList(POLY_KAL_DISP++, gAButtonIconDL);//This is changed to load the texture only so we can prim color it.
gDPLoadTextureBlock(POLY_KAL_DISP++, gABtnSymbolTex, G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 4, 4, G_TX_NOLOD, G_TX_NOLOD);
@ -1962,17 +1979,17 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
int height_factor = (1 << 10) * icon_h / height;
int width_factor = (1 << 10) * icon_w / width;
if (CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), 255);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, 255);
for (s16 i=0; i < 3; i++) {
if (i == 0) {
icon_x_offset = width_crop*3-3;
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCRBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCRBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCRBtnPrimB", R_C_BTN_COLOR(2)), 255);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_R.r, C_button_R.g, C_button_R.b, 255);
} else if (i == 1) {
icon_x_offset = width_crop*2-3;
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCDBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCDBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCDBtnPrimB", R_C_BTN_COLOR(2)), 255);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_D.r, C_button_D.g, C_button_D.b, 255);
} else if (i == 2) {
icon_x_offset = width_crop;
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCLBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCLBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCLBtnPrimB", R_C_BTN_COLOR(2)), 255);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_L.r, C_button_L.g, C_button_L.b, 255);
}
gDPLoadTextureBlock(POLY_KAL_DISP++, gCBtnSymbolsTex, G_IM_FMT_IA, G_IM_SIZ_8b, icon_w, icon_h, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
//gSPScisTextureRectangle(POLY_KAL_DISP++,PosX << 2, PosY << 2, (PosX + icon_x_offset) << 2, (PosY + height) << 2, G_TX_RENDERTILE, 0, 0, width_factor, height_factor);
@ -1980,11 +1997,11 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
}
} else {
if (CVar_GetS32("gHudColors", 1) == 0) {//To equip text C button icon
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), 255);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, 255);
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), 255);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, 255);
} else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated", 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), 255);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, 255);
}
gDPLoadTextureBlock(POLY_KAL_DISP++, gCBtnSymbolsTex, G_IM_FMT_IA, G_IM_SIZ_8b, icon_w, icon_h, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPWideTextureRectangle(POLY_KAL_DISP++, PosX << 2, PosY << 2, (PosX + width) << 2, (PosY + height) << 2, G_TX_RENDERTILE, 0, 0, width_factor, height_factor);
@ -2025,7 +2042,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, gABtnTexColour[0][0], gABtnTexColour[0][1], gABtnTexColour[0][2], gABtnTexColour[0][3]);
} else if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", gABtnTexColour[0][0]), CVar_GetS32("gCCABtnPrimG", gABtnTexColour[0][1]), CVar_GetS32("gCCABtnPrimB", gABtnTexColour[0][2]), gABtnTexColour[0][3]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button.r, A_button.g, A_button.b, gABtnTexColour[0][3]);
}
//gSPDisplayList(POLY_KAL_DISP++, gAButtonIconDL);
gDPLoadTextureBlock(POLY_KAL_DISP++, gABtnSymbolTex, G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 4, 4, G_TX_NOLOD, G_TX_NOLOD);
@ -2065,7 +2082,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
} else if (CVar_GetS32("gHudColors", 1) == 1) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, gABtnTexColour[0][0], gABtnTexColour[0][1], gABtnTexColour[0][2], gABtnTexColour[0][3]);
} else if (CVar_GetS32("gHudColors", 1) == 2) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", gABtnTexColour[0][0]), CVar_GetS32("gCCABtnPrimG", gABtnTexColour[0][1]), CVar_GetS32("gCCABtnPrimB", gABtnTexColour[0][2]), gABtnTexColour[0][3]);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button.r, A_button.g, A_button.b, gABtnTexColour[0][3]);
}
gDPLoadTextureBlock(POLY_KAL_DISP++, gABtnSymbolTex, G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 4, 4, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_KAL_DISP++, 0, 2, 3, 1, 0);