From b540b7fcfcaca50ddaa42f9018232c8634cfd2fa Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Sun, 24 Apr 2022 16:50:41 +0200 Subject: [PATCH] Add Enhancement 3D Dropped Items (#144) * Add Enhancement 3D Dropped Items It will change most of dropped item to there 3D models variant, Exclude Rupee from Hyrule Castle (when you are child and in quest to see Zelda.) * Fix z_kaleido_scope_PAL.c L and R button color issues This fix an issue in IF and gDPSetPrimColor for button L & R icon. making it with an else to place the on hover and normal color properly in both button so they both have exact same colour * Fix quite a big logic issue for 3D item drops In short,case logic required to be different with break; old version make it all fucked up with improper values. * Clean Const that was present nor not. * Update z_kaleido_scope_PAL.c * Update z_kaleido_scope_PAL.c --- libultraship/libultraship/GameSettings.cpp | 4 + libultraship/libultraship/GameSettings.h | 1 + libultraship/libultraship/SohImGuiImpl.cpp | 6 + soh/soh/Enhancements/bootcommands.c | 2 + soh/src/code/z_en_item00.c | 326 ++++++++++++++++++--- 5 files changed, 293 insertions(+), 46 deletions(-) diff --git a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp index 2ce22d6f9..c056dec71 100644 --- a/libultraship/libultraship/GameSettings.cpp +++ b/libultraship/libultraship/GameSettings.cpp @@ -73,6 +73,9 @@ namespace Game { Settings.enhancements.mm_bunny_hood = stob(Conf[EnhancementSection]["mm_bunny_hood"]); CVar_SetS32("gMMBunnyHood", Settings.enhancements.mm_bunny_hood); + Settings.enhancements.newdrops = stob(Conf[EnhancementSection]["newdrops"]); + CVar_SetS32("gNewDrops", Settings.enhancements.newdrops); + // Audio Settings.audio.master = Ship::stof(Conf[AudioSection]["master"]); CVar_SetFloat("gGameMasterVolume", Settings.audio.master); @@ -178,6 +181,7 @@ namespace Game { Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu); Conf[EnhancementSection]["dynamic_wallet_icon"] = std::to_string(Settings.enhancements.dynamic_wallet_icon); Conf[EnhancementSection]["minimal_ui"] = std::to_string(Settings.enhancements.minimal_ui); + Conf[EnhancementSection]["newdrops"] = std::to_string(Settings.enhancements.newdrops); Conf[EnhancementSection]["visualagony"] = std::to_string(Settings.enhancements.visualagony); Conf[EnhancementSection]["mm_bunny_hood"] = std::to_string(Settings.enhancements.mm_bunny_hood); diff --git a/libultraship/libultraship/GameSettings.h b/libultraship/libultraship/GameSettings.h index 070bdce38..990132f4e 100644 --- a/libultraship/libultraship/GameSettings.h +++ b/libultraship/libultraship/GameSettings.h @@ -26,6 +26,7 @@ struct SoHConfigType { bool animated_pause_menu = false; bool dynamic_wallet_icon = false; bool minimal_ui = false; + bool newdrops = false; bool visualagony = false; bool mm_bunny_hood = false; diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 7355d16a2..72a44162e 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -431,8 +431,14 @@ namespace SohImGui { needs_save = true; } + if (ImGui::Checkbox("Enable 3D Dropped items", &Game::Settings.enhancements.newdrops)) { + CVar_SetS32("gNewDrops", Game::Settings.enhancements.newdrops); + needs_save = true; + } + if (ImGui::Checkbox("Dynamic Wallet Icon", &Game::Settings.enhancements.dynamic_wallet_icon)) { CVar_SetS32(const_cast("gDynamicWalletIcon"), Game::Settings.enhancements.dynamic_wallet_icon); + needs_save = true; } diff --git a/soh/soh/Enhancements/bootcommands.c b/soh/soh/Enhancements/bootcommands.c index c58a11b6b..f3ad9aaac 100644 --- a/soh/soh/Enhancements/bootcommands.c +++ b/soh/soh/Enhancements/bootcommands.c @@ -25,7 +25,9 @@ void BootCommands_Init() CVar_RegisterS32("gDebugEnabled", 0); CVar_RegisterS32("gPauseLiveLink", 0); CVar_RegisterS32("gMinimalUI", 0); + CVar_RegisterS32("gNewDrops", 0); CVar_RegisterS32("gVisualAgony", 0); + } //void BootCommands_ParseBootArgs(char* str) diff --git a/soh/src/code/z_en_item00.c b/soh/src/code/z_en_item00.c index 2693c4b0f..d0179a5e1 100644 --- a/soh/src/code/z_en_item00.c +++ b/soh/src/code/z_en_item00.c @@ -5,6 +5,9 @@ #define FLAGS 0 +//Used to force variable to be used in different function, feel free to correct me if you have a better way +static s16 DroppedItemRot = 0; + void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx); void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx); @@ -355,11 +358,34 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->actor.params) { case ITEM00_RUPEE_GREEN: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.3f); + this->scale = 0.3f; + yOffset = 50.0f; + shadowScale = 0.3f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_RUPEE_BLUE: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.3f); + this->scale = 0.3f; + yOffset = 50.0f; + shadowScale = 0.3f; + this->actor.world.rot.x = 0x4000; + } case ITEM00_RUPEE_RED: - Actor_SetScale(&this->actor, 0.015f); - this->scale = 0.015f; - yOffset = 750.0f; + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.3f); + this->scale = 0.3f; + yOffset = 50.0f; + shadowScale = 0.3f; + this->actor.world.rot.x = 0x4000; + } else { + Actor_SetScale(&this->actor, 0.015f); + this->scale = 0.015f; + yOffset = 750.0f; + } break; case ITEM00_SMALL_KEY: this->unk_158 = 0; @@ -374,10 +400,18 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->scale = 0.02f; break; case ITEM00_HEART: - this->actor.home.rot.z = Rand_CenteredFloat(65535.0f); - yOffset = 430.0f; - Actor_SetScale(&this->actor, 0.02f); - this->scale = 0.02f; + if (CVar_GetS32("gNewDrops", 0) !=0) { + this->actor.home.rot.z = Rand_CenteredFloat(65535.0f); + yOffset = 25.0f; + Actor_SetScale(&this->actor, 0.3f); + this->scale = 0.3f; + shadowScale = 0.5f; + } else { + this->actor.home.rot.z = Rand_CenteredFloat(65535.0f); + yOffset = 430.0f; + Actor_SetScale(&this->actor, 0.02f); + this->scale = 0.02f; + } break; case ITEM00_HEART_CONTAINER: yOffset = 430.0f; @@ -386,42 +420,154 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->scale = 0.02f; break; case ITEM00_ARROWS_SINGLE: - yOffset = 400.0f; - Actor_SetScale(&this->actor, 0.02f); - this->scale = 0.02f; - break; + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + } else { + yOffset = 400.0f; + Actor_SetScale(&this->actor, 0.02f); + this->scale = 0.02f; + } + break; case ITEM00_ARROWS_SMALL: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_ARROWS_MEDIUM: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_ARROWS_LARGE: - Actor_SetScale(&this->actor, 0.035f); - this->scale = 0.035f; - yOffset = 250.0f; - break; + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + } else { + Actor_SetScale(&this->actor, 0.035f); + this->scale = 0.035f; + yOffset = 250.0f; + } + break; case ITEM00_BOMBS_A: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_BOMBS_B: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_NUTS: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_STICK: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_MAGIC_SMALL: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_SEEDS: + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + break; + } case ITEM00_BOMBS_SPECIAL: - Actor_SetScale(&this->actor, 0.03f); - this->scale = 0.03f; - yOffset = 320.0f; - break; + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + } else { + Actor_SetScale(&this->actor, 0.03f); + this->scale = 0.03f; + yOffset = 320.0f; + } + break; case ITEM00_MAGIC_LARGE: - Actor_SetScale(&this->actor, 0.045 - 1e-10); - this->scale = 0.045 - 1e-10; - yOffset = 320.0f; - break; + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + yOffset = 50.0f; + shadowScale = 0.5f; + this->actor.world.rot.x = 0x4000; + } else { + Actor_SetScale(&this->actor, 0.045 - 1e-10); + this->scale = 0.045 - 1e-10; + yOffset = 320.0f; + } + break; case ITEM00_RUPEE_ORANGE: - Actor_SetScale(&this->actor, 0.045 - 1e-10); - this->scale = 0.045 - 1e-10; - yOffset = 750.0f; + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.45f); + this->scale = 0.45f; + yOffset = 50.0f; + shadowScale = 0.3f; + this->actor.world.rot.x = 0x4000; + } else { + Actor_SetScale(&this->actor, 0.045 - 1e-10); + this->scale = 0.045 - 1e-10; + yOffset = 750.0f; + } break; case ITEM00_RUPEE_PURPLE: - Actor_SetScale(&this->actor, 0.03f); - this->scale = 0.03f; - yOffset = 750.0f; + if (CVar_GetS32("gNewDrops", 0) !=0) { + Actor_SetScale(&this->actor, 0.4f); + this->scale = 0.4f; + yOffset = 50.0f; + shadowScale = 0.3f; + this->actor.world.rot.x = 0x4000; + } else { + Actor_SetScale(&this->actor, 0.03f); + this->scale = 0.03f; + yOffset = 750.0f; + } break; case ITEM00_FLEXIBLE: yOffset = 500.0f; @@ -558,6 +704,19 @@ void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) { + + if (CVar_GetS32("gNewDrops", 0) !=0) { //set the rotation system on selected model only :) + if ((this->actor.params == ITEM_RUPEE_GOLD) || (this->actor.params == ITEM_RUPEE_PURPLE) || + (this->actor.params == ITEM00_ARROWS_SINGLE) || (this->actor.params == ITEM00_ARROWS_SMALL) || + (this->actor.params == ITEM00_ARROWS_MEDIUM) || (this->actor.params == ITEM00_ARROWS_LARGE) || + (this->actor.params == ITEM00_BOMBS_A) || (this->actor.params == ITEM00_BOMBS_B) || + (this->actor.params == ITEM00_NUTS) || (this->actor.params == ITEM00_STICK) || + (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.shape.rot.y = DroppedItemRot; + } + } + if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk_15A < 0)) || (this->actor.params == ITEM00_HEART_PIECE)) { this->actor.shape.rot.y += 960; @@ -731,6 +890,10 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { EnItem00* this = (EnItem00*)thisx; s32 pad; + if (CVar_GetS32("gNewDrops", 0) !=0) { //Update 3D Model rotation on frame update :) + DroppedItemRot += 100; + } + if (this->unk_15A > 0) { this->unk_15A--; } @@ -934,15 +1097,35 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { EnItem00* this = (EnItem00*)thisx; f32 mtxScale; - + if (!(this->unk_156 & this->unk_158)) { switch (this->actor.params) { case ITEM00_RUPEE_GREEN: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_RUPEE_GREEN); + break; + } case ITEM00_RUPEE_BLUE: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_RUPEE_BLUE); + break; + } case ITEM00_RUPEE_RED: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_RUPEE_RED); + break; + } case ITEM00_RUPEE_ORANGE: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_RUPEE_GOLD); + break; + } case ITEM00_RUPEE_PURPLE: - EnItem00_DrawRupee(this, globalCtx); + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_RUPEE_PURPLE); + } else { + EnItem00_DrawRupee(this, globalCtx); + } break; case ITEM00_HEART_PIECE: EnItem00_DrawHeartPiece(this, globalCtx); @@ -951,34 +1134,85 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { EnItem00_DrawHeartContainer(this, globalCtx); break; case ITEM00_HEART: - if (this->unk_15A < 0) { - if (this->unk_15A == -1) { - s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART); - - if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) { - this->actor.objBankIndex = bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); - this->unk_15A = -2; - } - } else { - mtxScale = 16.0f; - Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); - GetItem_Draw(globalCtx, GID_HEART); - } - break; + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_HEART); + mtxScale = 16.0f; + Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); + break; + } else { + if (this->unk_15A < 0) { + if (this->unk_15A == -1) { + s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART); + + if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) { + this->actor.objBankIndex = bankIndex; + Actor_SetObjectDependency(globalCtx, &this->actor); + this->unk_15A = -2; + } + } else { + mtxScale = 16.0f; + Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); + GetItem_Draw(globalCtx, GID_HEART); + } + break; + } } case ITEM00_BOMBS_A: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_BOMB); + break; + } case ITEM00_BOMBS_B: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_BOMB); + break; + } case ITEM00_BOMBS_SPECIAL: case ITEM00_ARROWS_SINGLE: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_ARROWS_SMALL); + break; + } case ITEM00_ARROWS_SMALL: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_ARROWS_SMALL); + break; + } case ITEM00_ARROWS_MEDIUM: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_ARROWS_MEDIUM); + break; + } case ITEM00_ARROWS_LARGE: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_ARROWS_LARGE); + break; + } case ITEM00_NUTS: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_NUTS); + break; + } case ITEM00_STICK: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_STICK); + break; + } case ITEM00_MAGIC_LARGE: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_MAGIC_LARGE); + break; + } case ITEM00_MAGIC_SMALL: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_MAGIC_SMALL); + break; + } case ITEM00_SEEDS: + if (CVar_GetS32("gNewDrops", 0) !=0) { + GetItem_Draw(globalCtx, GID_SEEDS); + break; + } case ITEM00_SMALL_KEY: EnItem00_DrawCollectible(this, globalCtx); break;