Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Manual Jump from Patcher64+ #695

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions mm/2s2h/BenGui/BenMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,8 @@ void DrawEnhancementsMenu() {
}
UIWidgets::CVarCheckbox("Instant Putaway", "gEnhancements.Player.InstantPutaway",
{ .tooltip = "Allows Link to instantly puts away held item without waiting." });
UIWidgets::CVarCheckbox("Manual Jump", "gEnhancements.Player.ManualJump",
{ .tooltip = "Z + A to Jump and B while midair to Jump Attack" });
ImGui::EndMenu();
}

Expand Down
1 change: 1 addition & 0 deletions mm/2s2h/Enhancements/Enhancements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ void InitEnhancements() {
RegisterClimbSpeed();
RegisterFastFlowerLaunch();
RegisterInstantPutaway();
RegisterManualJump();

// Songs
RegisterEnableSunsSong();
Expand Down
1 change: 1 addition & 0 deletions mm/2s2h/Enhancements/Enhancements.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "Restorations/TatlISG.h"
#include "Graphics/PlayAsKafei.h"
#include "Player/Player.h"
#include "Player/ManualJump.h"
#include "Songs/EnableSunsSong.h"
#include "Saving/SavingEnhancements.h"
#include "Graphics/DisableBlackBars.h"
Expand Down
1 change: 1 addition & 0 deletions mm/2s2h/Enhancements/GameInteractor/GameInteractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ typedef enum {
GI_VB_FLIP_HOP_VARIABLE,
GI_VB_DISABLE_LETTERBOX,
GI_VB_CLOCK_TOWER_OPENING_CONSIDER_THIS_FIRST_CYCLE,
GI_VB_MANUAL_JUMP,
} GIVanillaBehavior;

typedef enum {
Expand Down
10 changes: 10 additions & 0 deletions mm/2s2h/Enhancements/Player/ManualJump.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <libultraship/bridge.h>
#include "Enhancements/GameInteractor/GameInteractor.h"

void RegisterManualJump() {
REGISTER_VB_SHOULD(GI_VB_MANUAL_JUMP, {
if (CVarGetInteger("gEnhancements.Player.ManualJump", 0)) {
*should = false;
}
});
}
6 changes: 6 additions & 0 deletions mm/2s2h/Enhancements/Player/ManualJump.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef PLAYER_MANUAL_JUMP_H
#define PLAYER_MANUAL_JUMP_H

void RegisterManualJump();

#endif // PLAYER_MANUAL_JUMP_H
1 change: 1 addition & 0 deletions mm/2s2h/Enhancements/Player/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
void RegisterClimbSpeed();
void RegisterFastFlowerLaunch();
void RegisterInstantPutaway();
void RegisterManualJump();

#endif // PLAYER_H
33 changes: 26 additions & 7 deletions mm/src/overlays/actors/ovl_player_actor/z_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -1631,7 +1631,7 @@ PlayerAnimationHeader* D_8085BE84[PLAYER_ANIMGROUP_MAX][PLAYER_ANIMTYPE_MAX] = {
&gPlayerAnim_sude_nwait,
}
};

// Animations while on Z-Target
struct_8085C2A4 D_8085C2A4[] = {
/* 0 / Forward */
{
Expand Down Expand Up @@ -7907,7 +7907,7 @@ s32 func_80839800(Player* this, PlayState* play) {
}
return false;
}

// Side Hops and Backflip
void func_80839860(Player* this, PlayState* play, s32 arg2) {
s32 pad;
f32 speed = (!(arg2 & 1) ? 5.8f : 3.5f);
Expand Down Expand Up @@ -7969,12 +7969,13 @@ s32 func_80839A84(PlayState* play, Player* this) {
return true;
}

// Z target but doesn't activate when you're swimming
s32 Player_ActionChange_10(Player* this, PlayState* play) {
if (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A) &&
(play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (sPlayerFloorType != FLOOR_TYPE_7) &&
(sPlayerFloorEffect != FLOOR_EFFECT_1)) {
s32 temp_a2 = this->unk_AE3[this->unk_ADE];

// covers when link is staying put and when link is moving forward
if (temp_a2 <= 0) {
if (func_8082FBE8(this)) {
if (this->actor.category != ACTORCAT_PLAYER) {
Expand All @@ -7983,16 +7984,34 @@ s32 Player_ActionChange_10(Player* this, PlayState* play) {
} else {
func_80836B3C(play, this, 0.0f);
}
} else if (!(this->stateFlags1 & PLAYER_STATE1_8000000) &&
(Player_GetMeleeWeaponHeld(this) != PLAYER_MELEEWEAPON_NONE) &&
Player_CanUpdateItems(this) && (this->transformation != PLAYER_FORM_GORON)) {
func_808395F0(play, this, PLAYER_MWA_JUMPSLASH_START, 5.0f, 5.0f);
}
// Jump/Leap (Was jump slash)
else if (!(this->stateFlags1 & PLAYER_STATE1_8000000) &&
(Player_GetMeleeWeaponHeld(this) != PLAYER_MELEEWEAPON_NONE) && Player_CanUpdateItems(this) &&
(this->transformation != PLAYER_FORM_GORON)) {
if (!GameInteractor_Should(GI_VB_MANUAL_JUMP, true, NULL)) {
if (this->transformation == PLAYER_FORM_ZORA) {
func_808395F0(play, this, PLAYER_MWA_JUMPSLASH_START, 5.0f, 5.0f);
}
// Leap
else if (temp_a2 == 0) {
func_80834D50(play, this, D_8085C2A4[0].unk_0, 5.8f, NA_SE_VO_LI_SWORD_N);
}
// Jump
else {
func_80834DB8(this, &gPlayerAnim_link_normal_jump, REG(69) / 100.0f, play);
}
} else {
func_808395F0(play, this, PLAYER_MWA_JUMPSLASH_START, 5.0f, 5.0f);
}

} else if (!func_80839A84(play, this)) {
func_80836B3C(play, this, 0.0f);
}

return true;
}
// covers when link is backflipping or sidehopping
} else {
func_80839860(this, play, temp_a2);
return true;
Expand Down