mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-06-29 11:51:07 -04:00
[Enhancement] Improved Roll (#6604)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
#include "soh/ShipInit.hpp"
|
||||
#include "global.h"
|
||||
|
||||
extern "C" {
|
||||
void Player_SetupRoll(Player* player, PlayState* play);
|
||||
}
|
||||
|
||||
#define CVAR_ROLL_CHAIN CVAR_ENHANCEMENT("ImprovedRoll")
|
||||
#define CVAR_ROLL_STEER CVAR_ENHANCEMENT("ImprovedRollSteering")
|
||||
|
||||
void ImprovedRoll_Register() {
|
||||
COND_VB_SHOULD(VB_PLAYER_ROLL_CHAIN, CVarGetInteger(CVAR_ROLL_CHAIN, 0), {
|
||||
Player* player = va_arg(args, Player*);
|
||||
PlayState* play = va_arg(args, PlayState*);
|
||||
Input* controlInput = va_arg(args, Input*);
|
||||
s32 floorType = va_arg(args, s32);
|
||||
if ((player->skelAnime.curFrame >= 15.0f) && CHECK_BTN_ALL(controlInput->press.button, BTN_A) &&
|
||||
(floorType != 7)) {
|
||||
Player_SetupRoll(player, play);
|
||||
*should = true;
|
||||
}
|
||||
});
|
||||
|
||||
COND_VB_SHOULD(VB_PLAYER_ROLL_STEER, CVarGetInteger(CVAR_ROLL_CHAIN, 0) && CVarGetInteger(CVAR_ROLL_STEER, 0), {
|
||||
Player* player = va_arg(args, Player*);
|
||||
PlayState* play = va_arg(args, PlayState*);
|
||||
s16 yawTarget = (s16)va_arg(args, int);
|
||||
if (!CHECK_BTN_ALL(play->state.input[0].cur.button, BTN_Z)) {
|
||||
Math_ScaledStepToS(&player->actor.shape.rot.y, yawTarget, 0x200);
|
||||
}
|
||||
*should = false;
|
||||
});
|
||||
}
|
||||
|
||||
static RegisterShipInitFunc initFunc(ImprovedRoll_Register, { CVAR_ROLL_CHAIN, CVAR_ROLL_STEER });
|
||||
@@ -2028,6 +2028,27 @@ typedef enum {
|
||||
// - `*PlayState`
|
||||
VB_PLAYER_UPDATE_BOTTLE_HELD,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// false
|
||||
// ```
|
||||
// #### `args`
|
||||
// - `*Player`
|
||||
// - `*PlayState`
|
||||
// - `*Input` (sControlInput)
|
||||
// - `s32` (sFloorType)
|
||||
VB_PLAYER_ROLL_CHAIN,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// false
|
||||
// ```
|
||||
// #### `args`
|
||||
// - `*Player`
|
||||
// - `*PlayState`
|
||||
// - `s16 yawTarget` (stick world-space yaw, promoted to int in va_list)
|
||||
VB_PLAYER_ROLL_STEER,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// item == ITEM_SAW
|
||||
|
||||
@@ -462,6 +462,16 @@ void SohMenu::AddMenuEnhancements() {
|
||||
.CVar(CVAR_ENHANCEMENT("FastChests"))
|
||||
.Options(CheckboxOptions().Tooltip("Makes Link always kick the chest to open it, instead of doing the longer "
|
||||
"chest opening animation for major items."));
|
||||
AddWidget(path, "Improved Roll", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_ENHANCEMENT("ImprovedRoll"))
|
||||
.Options(CheckboxOptions().Tooltip(
|
||||
"Allows Link to chain a new roll by pressing A during a roll, maintaining maximum roll speed."));
|
||||
AddWidget(path, "Improved Roll Steering", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_ENHANCEMENT("ImprovedRollSteering"))
|
||||
.PreFunc([](WidgetInfo& info) { info.isHidden = !CVarGetInteger(CVAR_ENHANCEMENT("ImprovedRoll"), 0); })
|
||||
.Options(CheckboxOptions().Tooltip(
|
||||
"Allows slight directional steering with the control stick while rolling. "
|
||||
"Steering is automatically disabled while Z is held, preserving Z-target roll glitch setups."));
|
||||
AddWidget(path, "Skip Water Take Breath Animation", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_ENHANCEMENT("SkipSwimDeepEndAnim"))
|
||||
.Options(CheckboxOptions().Tooltip("Skips Link's taking breath animation after coming up from water. "
|
||||
|
||||
@@ -9834,6 +9834,10 @@ void Player_Action_Roll(Player* this, PlayState* play) {
|
||||
}
|
||||
}
|
||||
|
||||
if (GameInteractor_Should(VB_PLAYER_ROLL_CHAIN, false, this, play, sControlInput, sFloorType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((this->skelAnime.curFrame < 15.0f) || !Player_ActionHandler_7(this, play)) {
|
||||
if (this->skelAnime.curFrame >= 20.0f) {
|
||||
func_8083A060(this, play);
|
||||
@@ -9852,6 +9856,7 @@ void Player_Action_Roll(Player* this, PlayState* play) {
|
||||
speedTarget = 3.0f;
|
||||
}
|
||||
|
||||
GameInteractor_Should(VB_PLAYER_ROLL_STEER, false, this, play, yawTarget);
|
||||
func_8083DF68(this, speedTarget, this->actor.shape.rot.y);
|
||||
|
||||
if (func_8084269C(play, this)) {
|
||||
|
||||
Reference in New Issue
Block a user