From 64745d3abc739bfa2aec63351796c5a17d7c5d3a Mon Sep 17 00:00:00 2001 From: Llennpie Date: Thu, 28 Oct 2021 19:45:56 -0400 Subject: [PATCH] Add option to remove Yoshi in settings --- src/game/behaviors/yoshi.inc.c | 12 +++++++++++- src/game/behaviors/yoshi.inc.h | 6 ++++++ src/moon/imgui/imgui_impl.cpp | 1 + src/moon/saturn/saturn.cpp | 9 +++++++++ src/moon/saturn/saturn.h | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/game/behaviors/yoshi.inc.h diff --git a/src/game/behaviors/yoshi.inc.c b/src/game/behaviors/yoshi.inc.c index 3ea3beff..9914c431 100644 --- a/src/game/behaviors/yoshi.inc.c +++ b/src/game/behaviors/yoshi.inc.c @@ -7,13 +7,15 @@ // so o->oHomeY is never updated. static s16 sYoshiHomeLocations[] = { 0, -5625, -1364, -5912, -1403, -4609, -1004, -5308 }; +u8 enableYoshi; + void bhv_yoshi_init(void) { o->oGravity = 2.0f; o->oFriction = 0.9f; o->oBuoyancy = 1.3f; o->oInteractionSubtype = INT_SUBTYPE_NPC; - if (save_file_get_total_star_count(gCurrSaveFileNum - 1, 0, 24) < 120 || sYoshiDead == TRUE) { + if (save_file_get_total_star_count(gCurrSaveFileNum - 1, 0, 24) < 120 || sYoshiDead == TRUE || enableYoshi == 0) { o->activeFlags = ACTIVE_FLAG_DEACTIVATED; } } @@ -22,6 +24,10 @@ void yoshi_walk_loop(void) { UNUSED s16 sp26; s16 sp24 = o->header.gfx.unk38.animFrame; + if (enableYoshi == 0) { + o->oAction = YOSHI_ACT_WALK_JUMP_OFF_ROOF; + } + o->oForwardVel = 10.0f; sp26 = object_step(); o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, o->oYoshiTargetYaw, 0x500); @@ -47,6 +53,10 @@ void yoshi_idle_loop(void) { s16 chosenHome; UNUSED s16 sp1C = o->header.gfx.unk38.animFrame; + if (enableYoshi == 0) { + o->oAction = YOSHI_ACT_WALK_JUMP_OFF_ROOF; + } + if (o->oTimer > 90) { chosenHome = random_float() * 3.99; diff --git a/src/game/behaviors/yoshi.inc.h b/src/game/behaviors/yoshi.inc.h new file mode 100644 index 00000000..03ef78a2 --- /dev/null +++ b/src/game/behaviors/yoshi.inc.h @@ -0,0 +1,6 @@ +#ifndef YoshiInc +#define YoshiInc + +extern u8 enableYoshi; + +#endif \ No newline at end of file diff --git a/src/moon/imgui/imgui_impl.cpp b/src/moon/imgui/imgui_impl.cpp index e336af1c..c6e47bfe 100644 --- a/src/moon/imgui/imgui_impl.cpp +++ b/src/moon/imgui/imgui_impl.cpp @@ -645,6 +645,7 @@ namespace MoonInternal { ImGui::SliderInt("###rumble_strength", (int*)&configRumbleStrength, 0, 50); ImGui::Checkbox("Precache Textures", &configPrecacheRes); ImGui::Checkbox("Skip Intro", &configSkipIntro); + ImGui::Checkbox("Enable Yoshi", &enable_yoshi); } ImGui::End(); diff --git a/src/moon/saturn/saturn.cpp b/src/moon/saturn/saturn.cpp index 4284d298..7aa9a32c 100644 --- a/src/moon/saturn/saturn.cpp +++ b/src/moon/saturn/saturn.cpp @@ -24,6 +24,8 @@ extern "C" { #include "game/level_update.h" #include "game/mario.h" #include "sm64.h" +#include "game/behavior_actions.h" +#include "game/behaviors/yoshi.inc.h" } bool camera_frozen; @@ -36,11 +38,13 @@ bool show_menu_bar; float camera_speed = 0.8f; bool enable_cap_logo; bool enable_overall_buttons; +bool enable_yoshi; // Second Check bool has_changed_cap_logo; bool has_changed_overall_buttons; +bool has_changed_yoshi; namespace MoonInternal { @@ -66,6 +70,7 @@ namespace MoonInternal { enable_shadows = true; enable_cap_logo = true; enable_overall_buttons = true; + enable_yoshi = false; MoonInternal::load_cc_directory(); @@ -142,6 +147,10 @@ namespace MoonInternal { saturn_toggle_m_buttons(); has_changed_overall_buttons = false; } + + // Yoshi + + enableYoshi = (enable_yoshi) ? 1 : 0; }}); } } diff --git a/src/moon/saturn/saturn.h b/src/moon/saturn/saturn.h index eb444057..6633eff8 100644 --- a/src/moon/saturn/saturn.h +++ b/src/moon/saturn/saturn.h @@ -17,5 +17,6 @@ extern bool show_menu_bar; extern float camera_speed; extern bool enable_cap_logo; extern bool enable_overall_buttons; +extern bool enable_yoshi; #endif \ No newline at end of file