Make C buttons work for moving the first person player camera
This commit is contained in:
parent
256539a925
commit
6e38084cf9
|
@ -69,18 +69,28 @@ static void first_person_camera_update(void) {
|
||||||
s16 invY = camera_config_is_y_inverted() ? 1 : -1;
|
s16 invY = camera_config_is_y_inverted() ? 1 : -1;
|
||||||
|
|
||||||
if (mouse_relative_enabled) {
|
if (mouse_relative_enabled) {
|
||||||
|
// hack: make c buttons work for moving the camera
|
||||||
|
s16 extStickX = m->controller->extStickX;
|
||||||
|
s16 extStickY = m->controller->extStickY;
|
||||||
|
if (extStickX == 0) {
|
||||||
|
extStickX = (CLAMP(m->controller->buttonDown & R_CBUTTONS, 0, 1) - CLAMP(m->controller->buttonDown & L_CBUTTONS, 0, 1)) * 32;
|
||||||
|
}
|
||||||
|
if (extStickY == 0) {
|
||||||
|
extStickY = (CLAMP(m->controller->buttonDown & U_CBUTTONS, 0, 1) - CLAMP(m->controller->buttonDown & D_CBUTTONS, 0, 1)) * 24;
|
||||||
|
}
|
||||||
|
|
||||||
// update pitch
|
// update pitch
|
||||||
if (!gFirstPersonCamera.forcePitch) {
|
if (!gFirstPersonCamera.forcePitch) {
|
||||||
gFirstPersonCamera.pitch -= sensY * (invY * m->controller->extStickY - 1.5f * mouse_y);
|
gFirstPersonCamera.pitch -= sensY * (invY * extStickY - 1.5f * mouse_y);
|
||||||
gFirstPersonCamera.pitch = CLAMP(gFirstPersonCamera.pitch, -0x3F00, 0x3F00);
|
gFirstPersonCamera.pitch = CLAMP(gFirstPersonCamera.pitch, -0x3F00, 0x3F00);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update yaw
|
// update yaw
|
||||||
if (!gFirstPersonCamera.forceYaw) {
|
if (!gFirstPersonCamera.forceYaw) {
|
||||||
if (m->controller->buttonPressed & L_TRIG && gFirstPersonCamera.centerL) {
|
if (m->controller->buttonDown & L_TRIG && gFirstPersonCamera.centerL) {
|
||||||
gFirstPersonCamera.yaw = m->faceAngle[1] + 0x8000;
|
gFirstPersonCamera.yaw = m->faceAngle[1] + 0x8000;
|
||||||
} else {
|
} else {
|
||||||
gFirstPersonCamera.yaw += sensX * (invX * m->controller->extStickX - 1.5f * mouse_x);
|
gFirstPersonCamera.yaw += sensX * (invX * extStickX - 1.5f * mouse_x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue