mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-20 14:44:24 -04:00
Merge pull request #193 from TakaRikka/26-04-01-quick-transform
Implement Quick Transform from Rando
This commit is contained in:
@@ -1332,6 +1332,7 @@ set(DOLPHIN_FILES
|
||||
|
||||
set(DUSK_FILES
|
||||
include/dusk/endian_gx.hpp
|
||||
src/d/actor/d_a_alink_dusk.cpp
|
||||
src/dusk/asserts.cpp
|
||||
src/dusk/logging.cpp
|
||||
src/dusk/layout.cpp
|
||||
|
||||
@@ -4547,6 +4547,10 @@ public:
|
||||
/* 0x03848 */ cXyz* field_0x3848;
|
||||
/* 0x0384C */ cXyz* field_0x384c;
|
||||
/* 0x03850 */ daAlink_procFunc mpProcFunc;
|
||||
|
||||
#if TARGET_PC
|
||||
void handleQuickTransform();
|
||||
#endif
|
||||
}; // Size: 0x385C
|
||||
|
||||
class daAlinkHIO_data_c : public JORReflexible {
|
||||
|
||||
@@ -148,6 +148,12 @@ public:
|
||||
void setEmphasisB(u8 param_0) { field_0x762 = param_0; }
|
||||
u8 getInsideObjCheck() { return field_0x772; }
|
||||
|
||||
#if TARGET_PC
|
||||
constexpr f32 getButtonZAlpha() const {
|
||||
return mButtonZAlpha;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
/* 0x004 */ item_params mItemParams[4];
|
||||
/* 0x074 */ JKRExpHeap* heap;
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
#include "d/actor/d_a_alink.h"
|
||||
#include "d/actor/d_a_midna.h"
|
||||
#include "d/d_meter2.h"
|
||||
#include "d/d_meter2_draw.h"
|
||||
#include "d/d_meter2_info.h"
|
||||
#include "dusk/imgui/ImGuiMenuEnhancements.hpp"
|
||||
|
||||
void daAlink_c::handleQuickTransform() {
|
||||
if (!dusk::ImGuiMenuEnhancements::m_enhancements.quickTransform) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure that link is not in a cutscene.
|
||||
if (checkEventRun()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check to see if Link has the ability to transform.
|
||||
if (!dComIfGs_isEventBit(dSv_event_flag_c::M_077)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure Link isn't riding anything (horse, boar, etc.)
|
||||
if (checkRide()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (mProcID) {
|
||||
// Make sure Link is not underwater or talking to someone.
|
||||
case PROC_TALK:
|
||||
case PROC_SWIM_UP:
|
||||
case PROC_SWIM_DIVE:
|
||||
return;
|
||||
// If Link is targeting or pulling a chain, we don't want to remove the ability to use items in combat accidently.
|
||||
case PROC_ATN_ACTOR_MOVE:
|
||||
case PROC_ATN_ACTOR_WAIT:
|
||||
case PROC_WOLF_ATN_AC_MOVE:
|
||||
break;
|
||||
default:
|
||||
// Disable the input that was just pressed, as sometimes it could cause items to be used or Wolf Link to dig.
|
||||
mDoCPd_c::getCpadInfo(PAD_1).mPressedButtonFlags = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
// Ensure there is a proper pointer to the mMeterClass and mpMeterDraw structs in g_meter2_info.
|
||||
const auto meterClassPtr = g_meter2_info.getMeterClass();
|
||||
if (!meterClassPtr) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto meterDrawPtr = meterClassPtr->getMeterDrawPtr();
|
||||
if (!meterDrawPtr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure that the Z Button is not dimmed
|
||||
if (meterDrawPtr->getButtonZAlpha() != 1.f) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The game will crash if trying to quick transform while holding the Ball and Chain
|
||||
if (mEquipItem == dItemNo_IRONBALL_e) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Use the game's default checks for if the player can currently transform
|
||||
if (!m_midnaActor->checkMetamorphoseEnableBase()) {
|
||||
return;
|
||||
}
|
||||
|
||||
OSReport("Running quick transform!");
|
||||
procCoMetamorphoseInit();
|
||||
}
|
||||
@@ -22,6 +22,7 @@ namespace dusk {
|
||||
if (ImGui::BeginMenu("Quality of Life")) {
|
||||
ImGui::Checkbox("Fast Iron Boots", &m_enhancements.fastIronBoots);
|
||||
ImGui::Checkbox("Invert Camera X Axis", &m_enhancements.invertCameraXAxis);
|
||||
ImGui::Checkbox("Quick Transform (R+Y)", &m_enhancements.quickTransform);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace dusk {
|
||||
struct EnhancementsSettings {
|
||||
bool fastIronBoots;
|
||||
bool invertCameraXAxis;
|
||||
bool quickTransform;
|
||||
bool restoreWiiGlitches;
|
||||
bool enableBloom;
|
||||
bool useWaterProjectionOffset;
|
||||
|
||||
@@ -732,6 +732,14 @@ void fapGm_Execute() {
|
||||
JUTDbPrint::getManager()->setCharColor(g_HIO.mColor);
|
||||
#endif
|
||||
|
||||
#if TARGET_PC
|
||||
if (mDoCPd_c::getHoldR(PAD_1) && mDoCPd_c::getTrigY(PAD_1)) {
|
||||
if (const auto link = g_dComIfG_gameInfo.play.getPlayer(0)) {
|
||||
dynamic_cast<daAlink_c*>(link)->handleQuickTransform();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
fpcM_Management(NULL, fapGm_After);
|
||||
cCt_Counter(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user