From 260078c871baf3b57840f1a47031b7766d93597f Mon Sep 17 00:00:00 2001 From: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Date: Fri, 13 Oct 2023 19:13:17 -0400 Subject: [PATCH] [Cosmetic] Adds Bunny Hood to Cosmetic Editor (#3245) * Color and Invisible Checkbox GI model crashes when talking to mask salesman * Update z_player.c Co-authored-by: Garrett Cox * Update z_player.c Co-authored-by: Garrett Cox * Move bunny hood coloring to patch --------- Co-authored-by: Garrett Cox --- .../cosmetics/CosmeticsEditor.cpp | 22 +++++++++++++++++++ soh/soh/SohMenuBar.cpp | 2 ++ .../actors/ovl_player_actor/z_player.c | 6 ++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index 97b2921c6..548ffa60c 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -46,6 +46,7 @@ extern PlayState* gPlayState; #include "overlays/ovl_Boss_Ganon2/ovl_Boss_Ganon2.h" #include "objects/object_gjyo_objects/object_gjyo_objects.h" #include "textures/nintendo_rogo_static/nintendo_rogo_static.h" +#include "objects/object_gi_rabit_mask/object_gi_rabit_mask.h" void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction); void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const char* patchName, int destinationIndex, int sourceIndex); void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName); @@ -228,6 +229,7 @@ static std::map cosmeticOptions = { COSMETIC_OPTION("Equipment_BowHandle", "Bow Handle", GROUP_EQUIPMENT, ImVec4( 50, 150, 255, 255), false, true, true), COSMETIC_OPTION("Equipment_ChuFace", "Bombchu Face", GROUP_EQUIPMENT, ImVec4( 0, 100, 150, 255), false, true, true), COSMETIC_OPTION("Equipment_ChuBody", "Bombchu Body", GROUP_EQUIPMENT, ImVec4(180, 130, 50, 255), false, true, true), + COSMETIC_OPTION("Equipment_BunnyHood", "Bunny Hood", GROUP_EQUIPMENT, ImVec4(255, 235, 109, 255), false, true, true), COSMETIC_OPTION("Consumable_Hearts", "Hearts", GROUP_CONSUMABLE, ImVec4(255, 70, 50, 255), false, true, false), COSMETIC_OPTION("Consumable_HeartBorder", "Heart Border", GROUP_CONSUMABLE, ImVec4( 50, 40, 60, 255), false, true, true), @@ -916,6 +918,26 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gBombchuDL, "Equipment_ChuBody5", equipmentChuBody.changedCvar, 46, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } + static CosmeticOption& equipmentBunnyHood = cosmeticOptions.at("Equipment_BunnyHood"); + if (manualChange || CVarGetInteger(equipmentBunnyHood.rainbowCvar, 0)) { + static Color_RGBA8 defaultColor = {equipmentBunnyHood.defaultColor.x, equipmentBunnyHood.defaultColor.y, equipmentBunnyHood.defaultColor.z, equipmentBunnyHood.defaultColor.w}; + Color_RGBA8 color = CVarGetColor(equipmentBunnyHood.cvar, defaultColor); + PATCH_GFX(gGiBunnyHoodDL, "Equipment_BunnyHood1", equipmentBunnyHood.changedCvar, 5, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); + PATCH_GFX(gGiBunnyHoodDL, "Equipment_BunnyHood2", equipmentBunnyHood.changedCvar, 6, gsDPSetEnvColor(color.r / 3, color.g / 3, color.b / 3, 255)); + PATCH_GFX(gGiBunnyHoodDL, "Equipment_BunnyHood3", equipmentBunnyHood.changedCvar, 83, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); + PATCH_GFX(gGiBunnyHoodDL, "Equipment_BunnyHood4", equipmentBunnyHood.changedCvar, 84, gsDPSetEnvColor(color.r / 3, color.g / 3, color.b / 3, 255)); + PATCH_GFX(gLinkChildBunnyHoodDL, "Equipment_BunnyHood5", equipmentBunnyHood.changedCvar, 4, gsDPSetGrayscaleColor(color.r, color.g, color.b, 255)); + + if (manualChange) { + PATCH_GFX(gLinkChildBunnyHoodDL, "Equipment_BunnyHood6", equipmentBunnyHood.changedCvar, 13, gsSPGrayscale(true)); + if (CVarGetInteger(equipmentBunnyHood.changedCvar, 0)) { + ResourceMgr_PatchGfxByName(gLinkChildBunnyHoodDL, "Equipment_BunnyHood7", 125, gsSPBranchListOTRFilePath(gEndGrayscaleAndEndDlistDL)); + } else { + ResourceMgr_UnpatchGfxByName(gLinkChildBunnyHoodDL, "Equipment_BunnyHood7"); + } + } + } + static CosmeticOption& consumableGreenRupee = cosmeticOptions.at("Consumable_GreenRupee"); if (manualChange || CVarGetInteger(consumableGreenRupee.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {consumableGreenRupee.defaultColor.x, consumableGreenRupee.defaultColor.y, consumableGreenRupee.defaultColor.z, consumableGreenRupee.defaultColor.w}; diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index ec663c6b4..d2677ee77 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -897,6 +897,8 @@ void DrawEnhancementsMenu() { UIWidgets::Tooltip("Disables bombs always rotating to face the camera. To be used in conjunction with mods that want to replace bombs with 3D objects."); UIWidgets::PaddedEnhancementCheckbox("Disable Grotto Fixed Rotation", "gDisableGrottoRotation", true, false); UIWidgets::Tooltip("Disables grottos rotating with the camera. To be used in conjunction with mods that want to replace grottos with 3D objects."); + UIWidgets::PaddedEnhancementCheckbox("Invisible Bunny Hood", "gHideBunnyHood", true, false); + UIWidgets::Tooltip("Turns Bunny Hood invisible while still maintaining its effects."); ImGui::EndMenu(); } diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 25c8887c3..9b4fbd34f 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -11171,7 +11171,11 @@ void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, MATRIX_TOMTX(sp70); } - gSPDisplayList(POLY_OPA_DISP++, sMaskDlists[this->currentMask - 1]); + + if (this->currentMask != PLAYER_MASK_BUNNY || !CVarGetInteger("gHideBunnyHood", 0)) { + gSPDisplayList(POLY_OPA_DISP++, sMaskDlists[this->currentMask - 1]); + } + if (CVarGetInteger("gFixIceTrapWithBunnyHood", 1)) Matrix_Pop(); }