mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-06 03:44:30 -04:00
bd9b81f700
* Untie existing mouse logic from gyro * A bit more mouse cleanup before I start building off it * Rebase and last bit of cleanup * Fix rebase mistake, don't apply invertFirstPerson to gyro or mouse input * Remove the deprecated ImGui toast system * Add Mouse Camera option in preparation for its use * WIP, add mouse controls for the third-person camera * Various helpText revisions * Enable free camera on horseback * Untie mouse camera and free camera options Either being enabled now allows the underlying freecam logic to run * Allow simultaneous C-stick and mouse input * Combine mouse sensitivities for both aim and camera * Add option for inverting mouse Y * Refactor cursor visibility handling * Tighten aim capture condition and constrain cursor to window region * Tidying my trash * Last bit of housekeeping so I'm satisfied * Don't write code while sleep deprived * Fix my sloppy merge and a few helpText updates * Disable control stick aim when mouse aim is active * Use same conditions for cursor grabbing as for capture
178 lines
5.5 KiB
C++
178 lines
5.5 KiB
C++
#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"
|
|
|
|
void daAlink_c::handleWolfHowl() {
|
|
if (checkWolf()) {
|
|
if (!dusk::getSettings().game.sunsSong) {
|
|
return;
|
|
}
|
|
|
|
// Check to see if Link has the ability to transform.
|
|
if (!dComIfGs_isEventBit(dSv_event_flag_c::M_077)) {
|
|
return;
|
|
}
|
|
|
|
// 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 link is not in a cutscene.
|
|
if (checkEventRun()) {
|
|
Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
|
|
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;
|
|
}
|
|
|
|
bool canHowl = false;
|
|
|
|
if (mLinkAcch.ChkGroundHit() && !checkModeFlg(MODE_PLAYER_FLY) && !checkMagneBootsOn()) {
|
|
if (checkMidnaRide()) {
|
|
if ((checkWolf() &&
|
|
(checkModeFlg(MODE_UNK_1000) || dComIfGp_checkPlayerStatus0(0, 0x10))) ||
|
|
(!checkWolf() &&
|
|
(checkEventRun() || getMidnaActor()->checkMetamorphoseEnable()) &&
|
|
(checkModeFlg(4) || dComIfGp_checkPlayerStatus0(0, 0x10))))
|
|
{
|
|
canHowl = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!canHowl) {
|
|
Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
|
|
return;
|
|
}
|
|
|
|
getWolfHowlMgrP()->setCorrectCurve(9);
|
|
procWolfHowlDemoInit();
|
|
}
|
|
}
|
|
|
|
void daAlink_c::handleQuickTransform() {
|
|
if (!dusk::getSettings().game.enableQuickTransform) {
|
|
return;
|
|
}
|
|
|
|
// Check to see if Link has the ability to transform.
|
|
if (!dComIfGs_isEventBit(dSv_event_flag_c::M_077)) {
|
|
return;
|
|
}
|
|
|
|
// 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 link is not in a cutscene.
|
|
if (checkEventRun()) {
|
|
Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
|
|
return;
|
|
}
|
|
|
|
mDoCPd_c::getCpadInfo(PAD_1).mPressedButtonFlags = 0;
|
|
|
|
// Don't allow quick transform while in the STAR tent.
|
|
if (checkStageName("R_SP161")) {
|
|
Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
|
|
return;
|
|
}
|
|
|
|
// 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 (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;
|
|
}
|
|
|
|
OSReport("Running quick transform!");
|
|
procCoMetamorphoseInit();
|
|
}
|
|
|
|
bool daAlink_c::checkAimContext() {
|
|
switch (mProcID) {
|
|
case PROC_SUBJECTIVITY:
|
|
case PROC_SWIM_SUBJECTIVITY:
|
|
case PROC_HORSE_SUBJECTIVITY:
|
|
case PROC_CANOE_SUBJECTIVITY:
|
|
case PROC_BOARD_SUBJECTIVITY:
|
|
case PROC_WOLF_ROPE_SUBJECTIVITY:
|
|
case PROC_BOW_SUBJECT:
|
|
case PROC_BOOMERANG_SUBJECT:
|
|
case PROC_COPY_ROD_SUBJECT:
|
|
case PROC_HAWK_SUBJECT:
|
|
case PROC_HOOKSHOT_SUBJECT:
|
|
case PROC_SWIM_HOOKSHOT_SUBJECT:
|
|
case PROC_HORSE_BOW_SUBJECT:
|
|
case PROC_HORSE_BOOMERANG_SUBJECT:
|
|
case PROC_HORSE_HOOKSHOT_SUBJECT:
|
|
case PROC_CANOE_BOW_SUBJECT:
|
|
case PROC_CANOE_BOOMERANG_SUBJECT:
|
|
case PROC_CANOE_HOOKSHOT_SUBJECT:
|
|
case PROC_HOOKSHOT_ROOF_WAIT:
|
|
case PROC_HOOKSHOT_ROOF_SHOOT:
|
|
case PROC_HOOKSHOT_WALL_WAIT:
|
|
case PROC_HOOKSHOT_WALL_SHOOT:
|
|
return true;
|
|
case PROC_IRON_BALL_SUBJECT:
|
|
return itemButton() && mItemVar0.field_0x3018 == 2;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|