mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-26 15:24:30 -04:00
Merge pull request #218 from TakaRikka/feature/transform-anywhere
Can transform Anywhere + Refactored checks to see if you can Quick Transform
This commit is contained in:
@@ -51,6 +51,7 @@ struct UserSettings {
|
||||
|
||||
// Cheats
|
||||
bool enableFastIronBoots;
|
||||
bool canTransformAnywhere;
|
||||
|
||||
// Technical
|
||||
bool restoreWiiGlitches;
|
||||
|
||||
@@ -19,28 +19,6 @@ void daAlink_c::handleQuickTransform() {
|
||||
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) {
|
||||
@@ -52,18 +30,46 @@ void daAlink_c::handleQuickTransform() {
|
||||
return;
|
||||
}
|
||||
|
||||
mDoCPd_c::getCpadInfo(PAD_1).mPressedButtonFlags = 0;
|
||||
|
||||
// Ensure that the Z Button is not dimmed
|
||||
if (meterDrawPtr->getButtonZAlpha() != 1.f) {
|
||||
Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// The game will crash if trying to quick transform while holding the Ball and Chain
|
||||
if (mEquipItem == dItemNo_IRONBALL_e) {
|
||||
Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Use the game's default checks for if the player can currently transform
|
||||
if (!m_midnaActor->checkMetamorphoseEnableBase()) {
|
||||
Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
bool canTransform = false;
|
||||
|
||||
if (mLinkAcch.ChkGroundHit() && !checkModeFlg(MODE_PLAYER_FLY) && !checkMagneBootsOn()) {
|
||||
if (!checkForestOldCentury()) {
|
||||
if (checkMidnaRide()) {
|
||||
if ((checkWolf() &&
|
||||
(checkModeFlg(MODE_UNK_1000) || dComIfGp_checkPlayerStatus0(0, 0x10))) ||
|
||||
(!checkWolf() &&
|
||||
(checkEventRun() || getMidnaActor()->checkMetamorphoseEnable()) &&
|
||||
(checkModeFlg(4) || dComIfGp_checkPlayerStatus0(0, 0x10))))
|
||||
{
|
||||
canTransform = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!canTransform)
|
||||
{
|
||||
Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3046,12 +3046,17 @@ void daMidna_c::setMidnaNoDrawFlg() {
|
||||
|
||||
BOOL daMidna_c::checkMetamorphoseEnableBase() {
|
||||
BOOL tmp;
|
||||
if (
|
||||
!daAlink_getAlinkActorClass()->checkMidnaRide() || (g_env_light.mEvilInitialized & 0x80) ||
|
||||
if (!daAlink_getAlinkActorClass()->checkMidnaRide() || (g_env_light.mEvilInitialized & 0x80) ||
|
||||
/* dSv_event_flag_c::M_077 - Main Event - Get shadow crystal (can now transform) */
|
||||
!dComIfGs_isEventBit(0xD04) ||
|
||||
#if TARGET_PC
|
||||
(fopAcIt_Judge((fopAcIt_JudgeFunc)daMidna_searchNpc, &tmp) &&
|
||||
!dusk::getSettings().game.canTransformAnywhere)
|
||||
#else
|
||||
fopAcIt_Judge((fopAcIt_JudgeFunc)daMidna_searchNpc, &tmp)
|
||||
) {
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@@ -85,6 +85,12 @@ namespace dusk {
|
||||
if (ImGui::BeginMenu("Cheats")) {
|
||||
ImGui::Checkbox("Fast Iron Boots", &getSettings().game.enableFastIronBoots);
|
||||
|
||||
ImGui::Checkbox("Can Transform Anywhere",
|
||||
&getSettings().game.canTransformAnywhere);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Allows you to transform between forms even if NPCs are looking");
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ UserSettings g_userSettings = {
|
||||
|
||||
// Cheats
|
||||
.enableFastIronBoots = false,
|
||||
.canTransformAnywhere = false,
|
||||
|
||||
// Technical
|
||||
.restoreWiiGlitches = false,
|
||||
|
||||
Reference in New Issue
Block a user