From 56deb1cf64d1a96dd24f33ecb432b9247f96a6fb Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sat, 30 Sep 2023 09:55:11 -0400 Subject: [PATCH] unbreakable/always on fire deku stick (#3192) * Adds Ultra Deku Stick Cheat Author: Vexus * implement the stuff * move enum to a resonable spot * Apply suggestions from code review * Update soh/src/overlays/actors/ovl_player_actor/z_player.c * i thought i could do everything through the gh web ui but fine i'll fix it locally --------- Co-authored-by: Vexus --- soh/soh/Enhancements/enhancementTypes.h | 6 +++++ soh/soh/SohMenuBar.cpp | 3 +++ .../actors/ovl_player_actor/z_player.c | 24 +++++++++++++------ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/soh/soh/Enhancements/enhancementTypes.h b/soh/soh/Enhancements/enhancementTypes.h index 7620d3fd8..529ebed81 100644 --- a/soh/soh/Enhancements/enhancementTypes.h +++ b/soh/soh/Enhancements/enhancementTypes.h @@ -68,3 +68,9 @@ typedef enum { BONK_DAMAGE_8_HEARTS, BONK_DAMAGE_OHKO, } BonkDamage; + +typedef enum { + DEKU_STICK_NORMAL, + DEKU_STICK_UNBREAKABLE, + DEKU_STICK_UNBREAKABLE_AND_ALWAYS_ON_FIRE, +} DekuStickType; diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index bf14317bf..f2f62c1cf 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -83,6 +83,7 @@ std::string GetWindowButtonText(const char* text, bool menuOpen) { static const char* autosaveLabels[6] = { "Off", "New Location + Major Item", "New Location + Any Item", "New Location", "Major Item", "Any Item" }; static const char* DebugSaveFileModes[3] = { "Off", "Vanilla", "Maxed" }; static const char* FastFileSelect[5] = { "File N.1", "File N.2", "File N.3", "Zelda Map Select (require OoT Debug Mode)", "File select" }; + static const char* DekuStickCheat[3] = { "Normal", "Unbreakable", "Unbreakable + Always on Fire" }; static const char* bonkDamageValues[8] = { "No Damage", "0.25 Heart", @@ -1251,6 +1252,8 @@ void DrawCheatsMenu() { UIWidgets::Tooltip("This allows you to put up your shield with any two-handed weapon in hand except for Deku Sticks"); UIWidgets::PaddedEnhancementCheckbox("Time Sync", "gTimeSync", true, false); UIWidgets::Tooltip("This syncs the ingame time with the real world time"); + ImGui::Text("Deku Sticks:"); + UIWidgets::EnhancementCombobox("gDekuStickCheat", DekuStickCheat, DEKU_STICK_NORMAL); UIWidgets::PaddedEnhancementCheckbox("No ReDead/Gibdo Freeze", "gNoRedeadFreeze", true, false); UIWidgets::Tooltip("Prevents ReDeads and Gibdos from being able to freeze you with their scream"); UIWidgets::Spacer(2.0f); 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 d0c4b362e..25c8887c3 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -7998,13 +7998,15 @@ void func_80842A28(PlayState* play, Player* this) { } void func_80842A88(PlayState* play, Player* this) { - Inventory_ChangeAmmo(ITEM_STICK, -1); - func_80835F44(play, this, ITEM_NONE); + if (CVarGetInteger("gDekuStickCheat", DEKU_STICK_NORMAL) == DEKU_STICK_NORMAL) { + Inventory_ChangeAmmo(ITEM_STICK, -1); + func_80835F44(play, this, ITEM_NONE); + } } s32 func_80842AC4(PlayState* play, Player* this) { if ((this->heldItemAction == PLAYER_IA_DEKU_STICK) && (this->unk_85C > 0.5f)) { - if (AMMO(ITEM_STICK) != 0) { + if (AMMO(ITEM_STICK) != 0 && CVarGetInteger("gDekuStickCheat", DEKU_STICK_NORMAL) == DEKU_STICK_NORMAL) { EffectSsStick_Spawn(play, &this->bodyPartsPos[PLAYER_BODYPART_R_HAND], this->actor.shape.rot.y + 0x8000); this->unk_85C = 0.5f; @@ -10352,20 +10354,28 @@ static Color_RGBA8 D_808547C0 = { 255, 50, 0, 0 }; void func_80848A04(PlayState* play, Player* this) { f32 temp; - if (this->unk_85C == 0.0f) { + if (CVarGetInteger("gDekuStickCheat", DEKU_STICK_NORMAL) == DEKU_STICK_UNBREAKABLE_AND_ALWAYS_ON_FIRE) { + f32 temp2 = 1.0f; // Secondary temporary variable to use with the alleged draw flame function + this->unk_860 = 200; // Keeps the stick's flame lit + this->unk_85C = 1.0f; // Ensures the stick is the proper length + func_8002836C(play, &this->meleeWeaponInfo[0].tip, &D_808547A4, &D_808547B0, &D_808547BC, &D_808547C0, temp2 * 200.0f, + 0, 8); // I believe this draws the flame effect + } + + if (this->unk_85C == 0.0f && CVarGetInteger("gDekuStickCheat", DEKU_STICK_NORMAL) == DEKU_STICK_NORMAL) { func_80835F44(play, this, 0xFF); return; } temp = 1.0f; - if (DECR(this->unk_860) == 0) { + if (DECR(this->unk_860) == 0 && CVarGetInteger("gDekuStickCheat", DEKU_STICK_NORMAL) == DEKU_STICK_NORMAL) { Inventory_ChangeAmmo(ITEM_STICK, -1); this->unk_860 = 1; temp = 0.0f; this->unk_85C = temp; } else if (this->unk_860 > 200) { temp = (210 - this->unk_860) / 10.0f; - } else if (this->unk_860 < 20) { + } else if (this->unk_860 < 20 && CVarGetInteger("gDekuStickCheat", DEKU_STICK_NORMAL) == DEKU_STICK_NORMAL) { temp = this->unk_860 / 20.0f; this->unk_85C = temp; } @@ -10627,7 +10637,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { func_808473D4(play, this); func_80836BEC(this, play); - if ((this->heldItemAction == PLAYER_IA_DEKU_STICK) && (this->unk_860 != 0)) { + if ((this->heldItemAction == PLAYER_IA_DEKU_STICK) && ((this->unk_860 != 0) || CVarGetInteger("gDekuStickCheat", DEKU_STICK_NORMAL) == DEKU_STICK_UNBREAKABLE_AND_ALWAYS_ON_FIRE)) { func_80848A04(play, this); } else if ((this->heldItemAction == PLAYER_IA_FISHING_POLE) && (this->unk_860 < 0)) { this->unk_860++;