Add bounce off walls toggle (#6110)
This commit is contained in:
24
soh/soh/Enhancements/ExtraModes/BounceOffWalls.cpp
Normal file
24
soh/soh/Enhancements/ExtraModes/BounceOffWalls.cpp
Normal file
@@ -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) {
|
||||||
|
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 });
|
||||||
@@ -1555,6 +1555,11 @@ void SohMenu::AddMenuEnhancements() {
|
|||||||
AddSidebarEntry("Enhancements", path.sidebarName, 3);
|
AddSidebarEntry("Enhancements", path.sidebarName, 3);
|
||||||
path.column = SECTION_COLUMN_1;
|
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)
|
AddWidget(path, "Mirrored World", WIDGET_CVAR_COMBOBOX)
|
||||||
.CVar(CVAR_ENHANCEMENT("MirroredWorldMode"))
|
.CVar(CVAR_ENHANCEMENT("MirroredWorldMode"))
|
||||||
.Options(
|
.Options(
|
||||||
|
|||||||
Reference in New Issue
Block a user