diff --git a/src/camera.h b/src/camera.h index 9d6d140..e3a8de6 100644 --- a/src/camera.h +++ b/src/camera.h @@ -418,7 +418,7 @@ struct Camera : ICamera { float d = 3.0f * Core::deltaTime; vec2 L = Input::joy[cameraIndex].L; - if (L.length() < JOY_DEAD_ZONE) L = vec2(0.0f); + L = L.normal() * max(0.0f, L.length() - INPUT_JOY_DZ_STICK) / (1.0f - INPUT_JOY_DZ_STICK); lookAngle.x += L.y * d; lookAngle.y += L.x * d; @@ -539,7 +539,7 @@ struct Camera : ICamera { viewTarget = NULL; } - Input::Joystick &specJoy = Input::joy[cameraIndex]; + Input::Joystick &specJoy = Input::joy[Core::settings.controls[cameraIndex].joyIndex]; if (specJoy.down[jkL] && specJoy.down[jkR]) { specTimer += Core::deltaTime; @@ -564,6 +564,11 @@ struct Camera : ICamera { float U = specJoy.RT; float D = specJoy.LT; + L = L.normal() * max(0.0f, L.length() - INPUT_JOY_DZ_STICK) / (1.0f - INPUT_JOY_DZ_STICK); + R = R.normal() * max(0.0f, R.length() - INPUT_JOY_DZ_STICK) / (1.0f - INPUT_JOY_DZ_STICK); + U = max(0.0f, U - INPUT_JOY_DZ_TRIGGER) / (1.0f - INPUT_JOY_DZ_TRIGGER); + D = max(0.0f, D - INPUT_JOY_DZ_TRIGGER) / (1.0f - INPUT_JOY_DZ_TRIGGER); + // apply dead zone if (L.length() < 0.05f) L = vec2(0.0f); if (R.length() < 0.05f) R = vec2(0.0f); @@ -591,16 +596,15 @@ struct Camera : ICamera { mViewInv.rotateX(specRotSmooth.x); mViewInv.rotateZ(specRotSmooth.z); - level->getSector(specRoom, specPos); - /* for (int i = 0; i < level->roomsCount; i++) { TR::Room &room = level->rooms[i]; if (room.contains(specPos)) { - eye.room = i; + specRoom = i; break; } } - */ + + level->getSector(specRoom, specPos); } if (Core::settings.detail.stereo == Core::Settings::STEREO_VR) diff --git a/src/gapi/gl.h b/src/gapi/gl.h index 9ed2e83..0581f4e 100644 --- a/src/gapi/gl.h +++ b/src/gapi/gl.h @@ -1244,7 +1244,7 @@ namespace GAPI { support.VAO = GLES3 || extSupport(ext, "_vertex_array_object"); support.depthTexture = GLES3 || extSupport(ext, "_depth_texture"); support.shadowSampler = _GL_EXT_shadow_samplers || _GL_ARB_shadow; - support.discardFrame = extSupport(ext, "_discard_framebuffer") && (glDiscardFramebufferEXT != NULL); + support.discardFrame = extSupport(ext, "_discard_framebuffer"); support.texNPOT = GLES3 || extSupport(ext, "_texture_npot") || extSupport(ext, "_texture_non_power_of_two"); support.texRG = GLES3 || extSupport(ext, "_texture_rg "); // hope that isn't last extension in string ;) support.texMaxLevel = GLES3 || extSupport(ext, "_texture_max_level"); diff --git a/src/input.h b/src/input.h index ac0cc33..f22cc60 100644 --- a/src/input.h +++ b/src/input.h @@ -4,9 +4,11 @@ #include "core.h" #include "utils.h" -#define INPUT_JOY_COUNT 4 -#define MAX_PLAYERS COUNT(Core::settings.controls) -#define JOY_DEAD_ZONE 0.3f +#define MAX_PLAYERS COUNT(Core::settings.controls) + +#define INPUT_JOY_COUNT 4 +#define INPUT_JOY_DZ_STICK 0.2f +#define INPUT_JOY_DZ_TRIGGER 0.01f namespace Input { InputKey lastKey; diff --git a/src/lara.h b/src/lara.h index 936078d..30222b4 100644 --- a/src/lara.h +++ b/src/lara.h @@ -3109,7 +3109,7 @@ struct Lara : Character { vec2 L = joy.L; - if (L.length() < JOY_DEAD_ZONE) L = vec2(0.0f); // dead zone + if (L.length() < INPUT_JOY_DZ_STICK) L = vec2(0.0f); // dead zone if (!((state == STATE_STOP || state == STATE_SURF_TREAD || state == STATE_HANG) && fabsf(L.x) < 0.5f && fabsf(L.y) < 0.5f)) { bool moving = state == STATE_RUN || state == STATE_WALK || state == STATE_BACK || state == STATE_FAST_BACK || state == STATE_SURF_SWIM || state == STATE_SURF_BACK || state == STATE_FORWARD_JUMP; diff --git a/src/platform/nx/main.cpp b/src/platform/nx/main.cpp index 57958fc..8ddf62f 100644 --- a/src/platform/nx/main.cpp +++ b/src/platform/nx/main.cpp @@ -211,7 +211,7 @@ void joyInit() { void joyUpdate() { const static u64 keys[jkMAX] = { 0, KEY_B, KEY_A, KEY_Y, KEY_X, KEY_L, KEY_R, KEY_PLUS, KEY_MINUS, - 0, 0, KEY_ZL, KEY_ZR, + KEY_LSTICK, KEY_RSTICK, KEY_ZL, KEY_ZR, KEY_DLEFT, KEY_DRIGHT, KEY_DUP, KEY_DDOWN, };