MM Bunny Hood enhancement (#181)

Allow bunny hood in boss rooms

Use math instead of array

Allow other masks with enhancement because why not
This commit is contained in:
Sirius902 2022-04-17 08:26:49 -07:00 committed by GitHub
parent a11038f515
commit fe6dbd2a5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 7 deletions

View File

@ -61,6 +61,9 @@ namespace Game {
Settings.enhancements.minimal_ui = stob(Conf[EnhancementSection]["minimal_ui"]);
CVar_SetS32("gMinimalUI", Settings.enhancements.minimal_ui);
Settings.enhancements.mm_bunny_hood = stob(Conf[EnhancementSection]["mm_bunny_hood"]);
CVar_SetS32("gMMBunnyHood", Settings.enhancements.mm_bunny_hood);
// Audio
Settings.audio.master = Ship::stof(Conf[AudioSection]["master"]);
CVar_SetFloat("gGameMasterVolume", Settings.audio.master);
@ -152,6 +155,7 @@ namespace Game {
Conf[EnhancementSection]["disable_lod"] = std::to_string(Settings.enhancements.disable_lod);
Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu);
Conf[EnhancementSection]["minimal_ui"] = std::to_string(Settings.enhancements.minimal_ui);
Conf[EnhancementSection]["mm_bunny_hood"] = std::to_string(Settings.enhancements.mm_bunny_hood);
// Controllers
Conf[ControllerSection]["gyro_sensitivity"] = std::to_string(Settings.controller.gyro_sensitivity);

View File

@ -24,6 +24,7 @@ struct SoHConfigType {
bool disable_lod = false;
bool animated_pause_menu = false;
bool minimal_ui = false;
bool mm_bunny_hood = false;
} enhancements;
// Controller

View File

@ -413,6 +413,11 @@ namespace SohImGui {
needs_save = true;
}
if (ImGui::Checkbox("MM Bunny Hood", &Game::Settings.enhancements.mm_bunny_hood)) {
CVar_SetS32("gMMBunnyHood", Game::Settings.enhancements.mm_bunny_hood);
needs_save = true;
}
ImGui::Text("Graphics");
ImGui::Separator();
@ -639,4 +644,4 @@ namespace SohImGui {
ImTextureID GetTextureByName(const std::string& name) {
return GetTextureByID(DefaultAssets[name]->textureId);
}
}
}

View File

@ -919,7 +919,11 @@ void func_80083108(GlobalContext* globalCtx) {
if (interfaceCtx->restrictions.tradeItems != 0) {
for (i = 1; i < 4; i++) {
if ((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
if ((CVar_GetS32("gMMBunnyHood", 0) != 0)
&& (gSaveContext.equips.buttonItems[i] >= ITEM_MASK_KEATON)
&& (gSaveContext.equips.buttonItems[i] <= ITEM_MASK_TRUTH)) {
gSaveContext.buttonStatus[i] = BTN_ENABLED;
} else if ((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK)) {
if (gSaveContext.buttonStatus[i] == BTN_ENABLED) {
sp28 = 1;

View File

@ -1875,10 +1875,20 @@ void func_80833DF8(Player* this, GlobalContext* globalCtx) {
s32 i;
if (this->currentMask != PLAYER_MASK_NONE) {
maskActionParam = this->currentMask - 1 + PLAYER_AP_MASK_KEATON;
if (!func_80833C98(C_BTN_ITEM(0), maskActionParam) && !func_80833C98(C_BTN_ITEM(1), maskActionParam) &&
!func_80833C98(C_BTN_ITEM(2), maskActionParam)) {
this->currentMask = PLAYER_MASK_NONE;
if (CVar_GetS32("gMMBunnyHood", 0) != 0) {
s32 maskItem = this->currentMask - PLAYER_MASK_KEATON + ITEM_MASK_KEATON;
if (gSaveContext.equips.buttonItems[0] != maskItem && gSaveContext.equips.buttonItems[1] != maskItem &&
gSaveContext.equips.buttonItems[2] != maskItem && gSaveContext.equips.buttonItems[3] != maskItem) {
this->currentMask = PLAYER_MASK_NONE;
func_808328EC(this, NA_SE_PL_CHANGE_ARMS);
}
} else {
maskActionParam = this->currentMask - 1 + PLAYER_AP_MASK_KEATON;
if (!func_80833C98(C_BTN_ITEM(0), maskActionParam) && !func_80833C98(C_BTN_ITEM(1), maskActionParam) &&
!func_80833C98(C_BTN_ITEM(2), maskActionParam)) {
this->currentMask = PLAYER_MASK_NONE;
}
}
}
@ -5942,7 +5952,11 @@ void func_8083DFE0(Player* this, f32* arg1, s16* arg2) {
s16 yawDiff = this->currentYaw - *arg2;
if (this->swordState == 0) {
this->linearVelocity = CLAMP(this->linearVelocity, -(R_RUN_SPEED_LIMIT / 100.0f), (R_RUN_SPEED_LIMIT / 100.0f));
float maxSpeed = R_RUN_SPEED_LIMIT / 100.0f;
if (CVar_GetS32("gMMBunnyHood", 0) != 0 && this->currentMask == PLAYER_MASK_BUNNY) {
maxSpeed *= 1.5f;
}
this->linearVelocity = CLAMP(this->linearVelocity, -maxSpeed, maxSpeed);
}
if (ABS(yawDiff) > 0x6000) {
@ -7523,6 +7537,9 @@ void func_80842180(Player* this, GlobalContext* globalCtx) {
func_80837268(this, &sp2C, &sp2A, 0.018f, globalCtx);
if (!func_8083C484(this, &sp2C, &sp2A)) {
if (CVar_GetS32("gMMBunnyHood", 0) != 0 && this->currentMask == PLAYER_MASK_BUNNY) {
sp2C *= 1.5f;
}
func_8083DF68(this, sp2C, sp2A);
func_8083DDC8(this, globalCtx);