Mouse Support (#4673)
* mouse * (mouse) small fix * "fix" implicit declaration * LUS 1.2 * empty commit to force CI re-run * include new mouse LUS * deleted: soh/soh/Enhancements/controls/GameControlEditor.cpp * [mouse]LUS * fix input viewer header * Bump LUS for mouse support * Mouse Support * Comment cleanup * Adding the actual mouse enhancement files * Fix (?) Windows and Mac builds * Maybe fix MacOS now * Why was it compiling with this?? * Mouse input viewer handling * [Mouse] LUS bump * [mouse] LUS * (Mouse) bump LUS for dxgi fix * F2 mouse notif * Update soh/soh/Enhancements/controls/Mouse.h Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> * Update soh/soh/Enhancements/controls/Mouse.cpp Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> * Fix mouse shield ranges to match control stick behavior * Use early returns in Mouse_HandleQuickspin * newline cleanup * cleanup * rename BUTTON_COLOR_MOUSE_BEIGE to BUTTON_COLOR_MOUSE_GRAY * 'Enable Mouse' tooltip * Fix includes * Comments re mouse quickspin * bullshit * Hook handler for cursor recentering on shield * Hook handler for first person mouse aiming * Hook handlers for mouse quickspin * Hook handlers for mouse shield control * Hook registration conditions * Enable Mouse -> Enable Mouse Controls --------- Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/controls/Mouse.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
@@ -317,6 +318,8 @@ void PadMgr_HandleRetraceMsg(PadMgr* padMgr) {
|
||||
osRecvMesg(queue, NULL, OS_MESG_BLOCK);
|
||||
osContGetReadData(padMgr->pads);
|
||||
|
||||
Mouse_UpdateAll();
|
||||
|
||||
for (i = 0; i < __osMaxControllers; i++) {
|
||||
padMgr->padStatus[i].status = Controller_ShouldRumble(i);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
|
||||
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include "soh/Enhancements/controls/Mouse.h"
|
||||
|
||||
s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags);
|
||||
s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags);
|
||||
@@ -1422,6 +1423,8 @@ s32 SetCameraManual(Camera* camera) {
|
||||
f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f;
|
||||
f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f;
|
||||
|
||||
Mouse_HandleThirdPerson(&newCamX, &newCamY);
|
||||
|
||||
if ((fabsf(newCamX) >= 15.0f || fabsf(newCamY) >= 15.0f) && camera->play->manualCamera == false) {
|
||||
camera->play->manualCamera = true;
|
||||
|
||||
@@ -1485,8 +1488,17 @@ s32 Camera_Free(Camera* camera) {
|
||||
|
||||
camera->animState = 0;
|
||||
|
||||
f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f * (CVarGetFloat(CVAR_SETTING("FreeLook.CameraSensitivity.X"), 1.0f));
|
||||
f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f * (CVarGetFloat(CVAR_SETTING("FreeLook.CameraSensitivity.Y"), 1.0f));
|
||||
f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f;
|
||||
f32 newCamY = +D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f;
|
||||
|
||||
/* Disable mouse movement when holding down the shield */
|
||||
if (!(camera->player->stateFlags1 & 0x400000)) {
|
||||
Mouse_HandleThirdPerson(&newCamX, &newCamY);
|
||||
}
|
||||
|
||||
newCamX *= (CVarGetFloat(CVAR_SETTING("FreeLook.CameraSensitivity.X"), 1.0f));
|
||||
newCamY *= (CVarGetFloat(CVAR_SETTING("FreeLook.CameraSensitivity.Y"), 1.0f));
|
||||
|
||||
bool invertXAxis = (CVarGetInteger(CVAR_SETTING("FreeLook.InvertXAxis"), 0) && !CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) || (!CVarGetInteger(CVAR_SETTING("FreeLook.InvertXAxis"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0));
|
||||
|
||||
camera->play->camX += newCamX * (invertXAxis ? -1 : 1);
|
||||
|
||||
@@ -2082,6 +2082,8 @@ void Player_ProcessControlStick(PlayState* play, Player* this) {
|
||||
direction = (u16)((s16)(sControlStickWorldYaw - this->actor.shape.rot.y) + 0x2000) >> 14;
|
||||
}
|
||||
|
||||
GameInteractor_ExecuteOnPlayerProcessStick();
|
||||
|
||||
this->controlStickSpinAngles[this->controlStickDataIndex] = spinAngle;
|
||||
this->controlStickDirections[this->controlStickDataIndex] = direction;
|
||||
}
|
||||
@@ -4281,6 +4283,10 @@ s32 Player_CanSpinAttack(Player* this) {
|
||||
iter = &this->controlStickSpinAngles[0];
|
||||
iter2 = &sp3C[0];
|
||||
|
||||
if (GameInteractor_Should(VB_SHOULD_QUICKSPIN, false, iter2, sp3C)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++, iter++, iter2++) {
|
||||
if ((*iter2 = *iter) < 0) {
|
||||
return false;
|
||||
@@ -6432,6 +6438,8 @@ s32 Player_ActionHandler_11(Player* this, PlayState* play) {
|
||||
Player_DetachHeldActor(play, this);
|
||||
|
||||
if (Player_SetupAction(play, this, Player_Action_80843188, 0)) {
|
||||
GameInteractor_ExecuteOnPlayerHoldUpShield();
|
||||
|
||||
this->stateFlags1 |= PLAYER_STATE1_SHIELDING;
|
||||
|
||||
if (!Player_IsChildWithHylianShield(this)) {
|
||||
@@ -9260,6 +9268,7 @@ void Player_Action_80843188(Player* this, PlayState* play) {
|
||||
sp54 = sControlInput->rel.stick_y * 100 * (CVarGetInteger(CVAR_SETTING("Controls.InvertShieldAimingYAxis"), 1) ? 1 : -1);
|
||||
sp50 = sControlInput->rel.stick_x * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? 120 : -120) * (CVarGetInteger(CVAR_SETTING("Controls.InvertShieldAimingXAxis"), 0) ? -1 : 1);
|
||||
sp4E = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play));
|
||||
GameInteractor_ExecuteOnPlayerShieldControl(&sp50, &sp54);
|
||||
|
||||
sp40 = Math_CosS(sp4E);
|
||||
sp4C = (Math_SinS(sp4E) * sp50) + (sp54 * sp40);
|
||||
@@ -12658,6 +12667,8 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) {
|
||||
f32 xAxisMulti = CVarGetFloat(CVAR_SETTING("FirstPersonCameraSensitivity.X"), 1.0f);
|
||||
f32 yAxisMulti = CVarGetFloat(CVAR_SETTING("FirstPersonCameraSensitivity.Y"), 1.0f);
|
||||
|
||||
GameInteractor_ExecuteOnPlayerFirstPersonControl(this);
|
||||
|
||||
if (!func_8002DD78(this) && !func_808334B4(this) && (arg2 == 0)) { // First person without weapon
|
||||
// Y Axis
|
||||
if (!CVarGetInteger(CVAR_SETTING("MoveInFirstPerson"), 0)) {
|
||||
|
||||
Reference in New Issue
Block a user