Separate X/Y axis sensitivity sliders (#2472)

* Update z_camera.c

* Update GameControlEditor.cpp

* Update GameControlEditor.cpp

* Update GameControlEditor.cpp

Adding Sliders for first person X and Y axis

* Update z_player.c

Modified variables to allowed separate sensitivity settings for x and y axis
This commit is contained in:
Bigs 2023-02-16 12:12:21 +10:30 committed by GitHub
parent 8934274c67
commit d275740c88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 11 deletions

View File

@ -244,8 +244,10 @@ namespace GameControlEditor {
DrawHelpIcon("Prevents the C-Up view from auto-centering, allowing for Gyro Aiming"); DrawHelpIcon("Prevents the C-Up view from auto-centering, allowing for Gyro Aiming");
UIWidgets::PaddedEnhancementCheckbox("Enable Custom Aiming/First-Person sensitivity", "gEnableFirstPersonSensitivity", true, false); UIWidgets::PaddedEnhancementCheckbox("Enable Custom Aiming/First-Person sensitivity", "gEnableFirstPersonSensitivity", true, false);
if (CVarGetInteger("gEnableFirstPersonSensitivity", 0)) { if (CVarGetInteger("gEnableFirstPersonSensitivity", 0)) {
UIWidgets::EnhancementSliderFloat("Aiming/First-Person Sensitivity: %d %%", "##FirstPersonSensitivity", UIWidgets::EnhancementSliderFloat("Aiming/First-Person Horizontal Sensitivity: %d %%", "##FirstPersonSensitivity Horizontal",
"gFirstPersonCameraSensitivity", 0.01f, 5.0f, "", 1.0f, true, true); "gFirstPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true, true);
UIWidgets::EnhancementSliderFloat("Aiming/First-Person Vertical Sensitivity: %d %%", "##FirstPersonSensitivity Vertical",
"gFirstPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true, true);
} else { } else {
CVarSetFloat("gFirstPersonCameraSensitivity", 1.0f); CVarSetFloat("gFirstPersonCameraSensitivity", 1.0f);
} }
@ -261,8 +263,10 @@ namespace GameControlEditor {
DrawHelpIcon("Inverts the Camera X Axis in:\n-Free camera"); DrawHelpIcon("Inverts the Camera X Axis in:\n-Free camera");
UIWidgets::PaddedEnhancementCheckbox("Invert Camera Y Axis", "gInvertYAxis"); UIWidgets::PaddedEnhancementCheckbox("Invert Camera Y Axis", "gInvertYAxis");
DrawHelpIcon("Inverts the Camera Y Axis in:\n-Free camera"); DrawHelpIcon("Inverts the Camera Y Axis in:\n-Free camera");
UIWidgets::EnhancementSliderFloat("Third-Person Sensitivity: %d %%", "##ThirdPersonSensitivity", + UIWidgets::EnhancementSliderFloat("Third-Person Horizontal Sensitivity: %d %%", "##ThirdPersonSensitivity Horizontal",
"gThirdPersonCameraSensitivity", 0.01f, 5.0f, "", 1.0f, true, true); + "gThirdPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true, true);
+ UIWidgets::EnhancementSliderFloat("Third-Person Vertical Sensitivity: %d %%", "##ThirdPersonSensitivity Vertical",
+ "gThirdPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true, true);
UIWidgets::EnhancementSliderInt("Camera Distance: %d", "##CamDist", UIWidgets::EnhancementSliderInt("Camera Distance: %d", "##CamDist",
"gFreeCameraDistMax", 100, 900, "", 185, true); "gFreeCameraDistMax", 100, 900, "", 185, true);
UIWidgets::EnhancementSliderInt("Camera Transition Speed: %d", "##CamTranSpeed", UIWidgets::EnhancementSliderInt("Camera Transition Speed: %d", "##CamTranSpeed",

View File

@ -1485,8 +1485,8 @@ s32 Camera_Free(Camera* camera) {
camera->animState = 0; camera->animState = 0;
f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f * (CVarGetFloat("gThirdPersonCameraSensitivity", 1.0f)); f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f * (CVarGetFloat("gThirdPersonCameraSensitivityX", 1.0f));
f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f * (CVarGetFloat("gThirdPersonCameraSensitivity", 1.0f)); f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f * (CVarGetFloat("gThirdPersonCameraSensitivityY", 1.0f));
camera->play->camX += newCamX * (CVarGetInteger("gInvertXAxis", 0) ? -1 : 1); camera->play->camX += newCamX * (CVarGetInteger("gInvertXAxis", 0) ? -1 : 1);
camera->play->camY += newCamY * (CVarGetInteger("gInvertYAxis", 1) ? 1 : -1); camera->play->camY += newCamY * (CVarGetInteger("gInvertYAxis", 1) ? 1 : -1);

View File

@ -11281,14 +11281,14 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) {
temp2 = sControlInput->rel.stick_y * 240.0f * (CVarGetInteger("gInvertAimingYAxis", 1) ? 1 : -1); // Sensitivity not applied here because higher than default sensitivies will allow the camera to escape the autocentering, and glitch out massively temp2 = sControlInput->rel.stick_y * 240.0f * (CVarGetInteger("gInvertAimingYAxis", 1) ? 1 : -1); // Sensitivity not applied here because higher than default sensitivies will allow the camera to escape the autocentering, and glitch out massively
Math_SmoothStepToS(&this->actor.focus.rot.x, temp2, 14, 4000, 30); Math_SmoothStepToS(&this->actor.focus.rot.x, temp2, 14, 4000, 30);
temp2 = sControlInput->rel.stick_x * -16.0f * (CVarGetInteger("gInvertAimingXAxis", 0) ? -1 : 1) * (CVarGetFloat("gFirstPersonCameraSensitivity", 1.0f)); temp2 = sControlInput->rel.stick_x * -16.0f * (CVarGetInteger("gInvertAimingXAxis", 0) ? -1 : 1) * (CVarGetFloat("gFirstPersonCameraSensitivityX", 1.0f));
temp2 = CLAMP(temp2, -3000, 3000); temp2 = CLAMP(temp2, -3000, 3000);
this->actor.focus.rot.y += temp2; this->actor.focus.rot.y += temp2;
} else { } else {
temp1 = (this->stateFlags1 & PLAYER_STATE1_23) ? 3500 : 14000; temp1 = (this->stateFlags1 & PLAYER_STATE1_23) ? 3500 : 14000;
temp3 = ((sControlInput->rel.stick_y >= 0) ? 1 : -1) * temp3 = ((sControlInput->rel.stick_y >= 0) ? 1 : -1) *
(s32)((1.0f - Math_CosS(sControlInput->rel.stick_y * 200)) * 1500.0f * (s32)((1.0f - Math_CosS(sControlInput->rel.stick_y * 200)) * 1500.0f *
(CVarGetInteger("gInvertAimingYAxis", 1) ? 1 : -1)) * (CVarGetFloat("gFirstPersonCameraSensitivity", 1.0f)); (CVarGetInteger("gInvertAimingYAxis", 1) ? 1 : -1)) * (CVarGetFloat("gFirstPersonCameraSensitivityY", 1.0f));
this->actor.focus.rot.x += temp3; this->actor.focus.rot.x += temp3;
if (fabsf(sControlInput->cur.gyro_x) > 0.01f) { if (fabsf(sControlInput->cur.gyro_x) > 0.01f) {
@ -11297,7 +11297,7 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) {
if (fabsf(sControlInput->cur.right_stick_y) > 15.0f && CVarGetInteger("gRightStickAiming", 0) != 0) { if (fabsf(sControlInput->cur.right_stick_y) > 15.0f && CVarGetInteger("gRightStickAiming", 0) != 0) {
this->actor.focus.rot.x -= this->actor.focus.rot.x -=
(sControlInput->cur.right_stick_y) * 10.0f * (CVarGetInteger("gInvertAimingYAxis", 1) ? -1 : 1) * (CVarGetFloat("gFirstPersonCameraSensitivity", 1.0f)); (sControlInput->cur.right_stick_y) * 10.0f * (CVarGetInteger("gInvertAimingYAxis", 1) ? -1 : 1) * (CVarGetFloat("gFirstPersonCameraSensitivityY", 1.0f));
} }
this->actor.focus.rot.x = CLAMP(this->actor.focus.rot.x, -temp1, temp1); this->actor.focus.rot.x = CLAMP(this->actor.focus.rot.x, -temp1, temp1);
@ -11306,7 +11306,7 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) {
temp2 = this->actor.focus.rot.y - this->actor.shape.rot.y; temp2 = this->actor.focus.rot.y - this->actor.shape.rot.y;
temp3 = ((sControlInput->rel.stick_x >= 0) ? 1 : -1) * temp3 = ((sControlInput->rel.stick_x >= 0) ? 1 : -1) *
(s32)((1.0f - Math_CosS(sControlInput->rel.stick_x * 200)) * -1500.0f * (s32)((1.0f - Math_CosS(sControlInput->rel.stick_x * 200)) * -1500.0f *
(CVarGetInteger("gInvertAimingXAxis", 0) ? -1 : 1)) * (CVarGetFloat("gFirstPersonCameraSensitivity", 1.0f)); (CVarGetInteger("gInvertAimingXAxis", 0) ? -1 : 1)) * (CVarGetFloat("gFirstPersonCameraSensitivityX", 1.0f));
temp2 += temp3; temp2 += temp3;
this->actor.focus.rot.y = CLAMP(temp2, -temp1, temp1) + this->actor.shape.rot.y; this->actor.focus.rot.y = CLAMP(temp2, -temp1, temp1) + this->actor.shape.rot.y;
@ -11317,7 +11317,7 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) {
if (fabsf(sControlInput->cur.right_stick_x) > 15.0f && CVarGetInteger("gRightStickAiming", 0) != 0) { if (fabsf(sControlInput->cur.right_stick_x) > 15.0f && CVarGetInteger("gRightStickAiming", 0) != 0) {
this->actor.focus.rot.y += this->actor.focus.rot.y +=
(sControlInput->cur.right_stick_x) * 10.0f * (CVarGetInteger("gInvertAimingXAxis", 0) ? 1 : -1) * (CVarGetFloat("gFirstPersonCameraSensitivity", 1.0f)); (sControlInput->cur.right_stick_x) * 10.0f * (CVarGetInteger("gInvertAimingXAxis", 0) ? 1 : -1) * (CVarGetFloat("gFirstPersonCameraSensitivityX", 1.0f));
} }
} }