Skip to content

Commit

Permalink
Merge PR HarbourMasters#695 from HarbourMasters/2ship2harkinian
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Sep 23, 2024
2 parents a779b0d + 443adc6 commit ad4a204
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 12 deletions.
4 changes: 2 additions & 2 deletions mm/2s2h/BenGui/BenMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,8 @@ void DrawEnhancementsMenu() {
}
UIWidgets::CVarCheckbox("Instant Putaway", "gEnhancements.Player.InstantPutaway",
{ .tooltip = "Allows Link to instantly puts away held item without waiting." });
UIWidgets::CVarCheckbox("Fierce Deity Putaway", "gEnhancements.Player.FierceDeityPutaway",
{ .tooltip = "Allows Fierce Deity Link to put away his sword." });
UIWidgets::CVarCheckbox("Manual Jump", "gEnhancements.Player.ManualJump",
{ .tooltip = "Z + A to Jump and B while midair to Jump Attack" });
ImGui::EndMenu();
}

Expand Down
2 changes: 1 addition & 1 deletion mm/2s2h/Enhancements/Enhancements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void InitEnhancements() {
RegisterClimbSpeed();
RegisterFastFlowerLaunch();
RegisterInstantPutaway();
RegisterFierceDeityPutaway();
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 @@ -36,6 +36,7 @@
#include "Graphics/PlayAsKafei.h"
#include "Equipment/InstantRecall.h"
#include "Player/Player.h"
#include "Player/ManualJump.h"
#include "Songs/EnableSunsSong.h"
#include "Songs/PauseOwlWarp.h"
#include "Songs/ZoraEggCount.h"
Expand Down
2 changes: 1 addition & 1 deletion mm/2s2h/Enhancements/GameInteractor/GameInteractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ typedef enum {
GI_VB_FLIP_HOP_VARIABLE,
GI_VB_DISABLE_LETTERBOX,
GI_VB_CLOCK_TOWER_OPENING_CONSIDER_THIS_FIRST_CYCLE,
GI_VB_ENABLE_HOOKSHOT_ANYWHERE,
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
2 changes: 1 addition & 1 deletion mm/2s2h/Enhancements/Player/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
void RegisterClimbSpeed();
void RegisterFastFlowerLaunch();
void RegisterInstantPutaway();
void RegisterFierceDeityPutaway();
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 @@ -7917,7 +7917,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 @@ -7979,12 +7979,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 @@ -7993,16 +7994,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

0 comments on commit ad4a204

Please sign in to comment.