mirror of
https://github.com/HarbourMasters/2ship2harkinian.git
synced 2024-11-27 00:00:32 +00:00
[Enhancement] Instant Recall (#589)
* Instant Recall * clang it * Moved to Category "Equipment" * pr review feedback --------- Co-authored-by: Archez <archez39@me.com>
This commit is contained in:
parent
542feb038e
commit
d74699740e
@ -515,6 +515,12 @@ void DrawEnhancementsMenu() {
|
||||
if (UIWidgets::BeginMenu("Equipment")) {
|
||||
UIWidgets::CVarCheckbox("Fast Magic Arrow Equip Animation", "gEnhancements.Equipment.MagicArrowEquipSpeed",
|
||||
{ .tooltip = "Removes the animation for equipping Magic Arrows." });
|
||||
|
||||
UIWidgets::CVarCheckbox(
|
||||
"Instant Fin Boomerangs Recall", "gEnhancements.PlayerActions.InstantRecall",
|
||||
{ .tooltip =
|
||||
"Pressing B will instantly recall the fin boomerang back to Zora Link after they are thrown." });
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
@ -618,6 +624,7 @@ void DrawEnhancementsMenu() {
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (UIWidgets::BeginMenu("Player")) {
|
||||
UIWidgets::CVarSliderInt("Climb speed", "gEnhancements.Player.ClimbSpeed", 1, 5, 1,
|
||||
{ .tooltip = "Increases the speed at which Link climbs vines and ladders." });
|
||||
|
@ -28,6 +28,7 @@ void InitEnhancements() {
|
||||
|
||||
// Equipment
|
||||
RegisterSkipMagicArrowEquip();
|
||||
RegisterInstantRecall();
|
||||
|
||||
// Graphics
|
||||
RegisterDisableBlackBars();
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "Restorations/TatlISG.h"
|
||||
#include "Graphics/3DItemDrops.h"
|
||||
#include "Graphics/PlayAsKafei.h"
|
||||
#include "Equipment/InstantRecall.h"
|
||||
#include "Player/Player.h"
|
||||
#include "Songs/EnableSunsSong.h"
|
||||
#include "Songs/PauseOwlWarp.h"
|
||||
|
42
mm/2s2h/Enhancements/Equipment/InstantRecall.cpp
Normal file
42
mm/2s2h/Enhancements/Equipment/InstantRecall.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include <libultraship/bridge.h>
|
||||
#include "Enhancements/GameInteractor/GameInteractor.h"
|
||||
#include "InstantRecall.h"
|
||||
#include "src/overlays/actors/ovl_En_Boom/z_en_boom.h"
|
||||
|
||||
extern "C" {
|
||||
extern PlayState* gPlayState;
|
||||
}
|
||||
|
||||
static HOOK_ID onActorUpdateHookId = 0;
|
||||
|
||||
void Player_ReturnBoomerangs() {
|
||||
Player* player = GET_PLAYER(gPlayState);
|
||||
|
||||
if (player == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
EnBoom* boomerangs = (EnBoom*)player->boomerangActor;
|
||||
|
||||
// Kill both boomerangs
|
||||
if (boomerangs != NULL) {
|
||||
Actor_Kill(&boomerangs->actor);
|
||||
if (boomerangs->actor.child != NULL) {
|
||||
Actor_Kill(boomerangs->actor.child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RegisterInstantRecall() {
|
||||
GameInteractor::Instance->UnregisterGameHookForID<GameInteractor::OnActorUpdate>(onActorUpdateHookId);
|
||||
onActorUpdateHookId = 0;
|
||||
|
||||
onActorUpdateHookId = GameInteractor::Instance->RegisterGameHookForID<GameInteractor::OnActorUpdate>(
|
||||
ACTOR_EN_BOOM, [](Actor* outerActor) {
|
||||
if (CVarGetInteger("gEnhancements.PlayerActions.InstantRecall", 0)) {
|
||||
if (CHECK_BTN_ALL(gPlayState->state.input->press.button, BTN_B)) {
|
||||
Player_ReturnBoomerangs();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
6
mm/2s2h/Enhancements/Equipment/InstantRecall.h
Normal file
6
mm/2s2h/Enhancements/Equipment/InstantRecall.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef EQUIPMENT_INSTAND_RECALL_H
|
||||
#define EQUIPMENT_INSTAND_RECALL_H
|
||||
|
||||
void RegisterInstantRecall();
|
||||
|
||||
#endif // EQUIPMENT_INSTAND_RECALL_H
|
Loading…
Reference in New Issue
Block a user