Skip to content
Open
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
24 changes: 24 additions & 0 deletions soh/soh/Enhancements/ExtraModes/BounceOffWalls.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <libultraship/bridge.h>
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/ShipInit.hpp"

extern "C" {
#include "macros.h"
#include "functions.h"
extern PlayState* gPlayState;
}

#define CVAR_BOUNCE_OFF_WALLS_NAME CVAR_ENHANCEMENT("BounceOffWalls")
#define CVAR_BOUNCE_OFF_WALLS_VALUE CVarGetInteger(CVAR_BOUNCE_OFF_WALLS_NAME, 0)

static RegisterShipInitFunc initFunc(
[]() {
COND_HOOK(OnPlayerUpdate, CVAR_BOUNCE_OFF_WALLS_VALUE, []() {
Player* player = GET_PLAYER(gPlayState);
if (player->actor.bgCheckFlags & 0x08 && ABS(player->linearVelocity) > 15.0f) {
Copy link
Contributor

@serprex serprex Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (player->actor.bgCheckFlags & 0x08 && ABS(player->linearVelocity) > 15.0f) {
if ((player->actor.bgCheckFlags & 0x08) && ABS(player->linearVelocity) > 15.0f) {

(not semantically necessary)

player->yaw = ((player->actor.wallYaw - player->yaw) + player->actor.wallYaw) - 0x8000;
Player_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT);
}
});
},
{ CVAR_BOUNCE_OFF_WALLS_NAME });
5 changes: 5 additions & 0 deletions soh/soh/SohGui/SohMenuEnhancements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1535,6 +1535,11 @@ void SohMenu::AddMenuEnhancements() {
AddSidebarEntry("Enhancements", path.sidebarName, 3);
path.column = SECTION_COLUMN_1;

AddWidget(path, "Bounce off Walls", WIDGET_CVAR_CHECKBOX)
.CVar(CVAR_ENHANCEMENT("BounceOffWalls"))
.Options(
CheckboxOptions().Tooltip("Allows Link to bounce off walls when linear velocity is high enough, this is "
"relevant when frequently being knocked back by traps, CC, or in Anchor."));
AddWidget(path, "Mirrored World", WIDGET_CVAR_COMBOBOX)
.CVar(CVAR_ENHANCEMENT("MirroredWorldMode"))
.Options(
Expand Down
Loading