Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mm/2s2h/BenGui/BenMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1406,6 +1406,10 @@ void BenMenu::AddEnhancements() {
.Options(CheckboxOptions().Tooltip("Restores the appearance of Woodfall mountain to not look poisoned "
"when viewed from Termina Field after clearing Woodfall Temple\n\n"
"Requires a scene reload to take effect."));
AddWidget(path, "Bonk Collision", WIDGET_CVAR_CHECKBOX)
.CVar("gEnhancements.Restorations.BonkCollision")
.Options(
CheckboxOptions().Tooltip("Corrects rolls to allow bonking trees near the end of the roll, as in OoT."));
AddWidget(path, "Simulated Input Lag", WIDGET_CVAR_SLIDER_INT)
.CVar(CVAR_SIMULATED_INPUT_LAG)
.Options(IntSliderOptions()
Expand Down
20 changes: 20 additions & 0 deletions mm/2s2h/Enhancements/Restorations/BonkCollision.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <libultraship/bridge/consolevariablebridge.h>
#include "2s2h/GameInteractor/GameInteractor.h"
#include "2s2h/ShipInit.hpp"

#define CVAR_NAME "gEnhancements.Restorations.BonkCollision"
#define CVAR CVarGetInteger(CVAR_NAME, 0)

void RegisterBonkCollision() {
COND_VB_SHOULD(VB_SET_PLAYER_CYLINDER_OC_FLAGS, CVAR, {
Player* player = va_arg(args, Player*);
u32 dmgFlags = va_arg(args, u32);
if (dmgFlags == DMG_NORMAL_ROLL) {
// OR the new flags instead of directly assigning them
player->cylinder.base.ocFlags1 |= OC1_ON | OC1_TYPE_ALL;
*should = false;
}
});
}

static RegisterShipInitFunc initFunc(RegisterBonkCollision, { CVAR_NAME });
1 change: 1 addition & 0 deletions mm/2s2h/GameInteractor/GameInteractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ typedef enum {
VB_ENABLE_OBJECT_DEPENDENCY,
VB_OBJ_MURE2_SET_CHILD_ROOM,
VB_OBJ_MURE3_DROP_COLLECTIBLE,
VB_SET_PLAYER_CYLINDER_OC_FLAGS,
} GIVanillaBehavior;

typedef enum {
Expand Down
4 changes: 3 additions & 1 deletion mm/src/overlays/actors/ovl_player_actor/z_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -2903,7 +2903,9 @@ void Player_SetCylinderForAttack(Player* this, u32 dmgFlags, s32 damage, s32 rad
if (radius > 30) {
this->cylinder.base.ocFlags1 = OC1_NONE;
} else {
this->cylinder.base.ocFlags1 = OC1_ON | OC1_TYPE_ALL;
if (GameInteractor_Should(VB_SET_PLAYER_CYLINDER_OC_FLAGS, true, this, dmgFlags)) {
this->cylinder.base.ocFlags1 = OC1_ON | OC1_TYPE_ALL;
}
}

this->cylinder.elem.elemMaterial = ELEM_MATERIAL_UNK2;
Expand Down
Loading