Merge pull request #598 from AL2009man/PerfectQuakeDark

Mouse Sensitivity follows id Tech/Source sens scale
This commit is contained in:
fgsfds authored and GitHub committed 2025-04-27 13:46:01 +02:00
commit fc7141d0f2
2 files changed
+24 -28

No files matched your search

+20 -24
View File
@@ -88,8 +88,8 @@ static s32 mouseLockMode = MLOCK_AUTO;
static u64 mouseCursorTime = 0;
static s32 mouseShowCursor = 1;
static f32 mouseSensX = 1.5f;
static f32 mouseSensY = 1.5f;
static f32 mouseSensX = 2.5f;
static f32 mouseSensY = 2.5f;
static s32 lastKey = 0;
static char lastChar = 0;
@@ -1239,32 +1239,28 @@ void inputMouseGetRawDelta(s32 *dx, s32 *dy)
if (dy) *dy = mouseDY;
}
void inputMouseGetScaledDelta(f32 *dx, f32 *dy)
void inputMouseGetScaledDelta(f32* dx, f32* dy)
{
f32 mdx, mdy;
if (mouseLocked) {
mdx = mouseSensX * (f32)mouseDX / 100.0f;
mdy = mouseSensY * (f32)mouseDY / 100.0f;
} else {
mdx = 0.f;
mdy = 0.f;
}
if (dx) *dx = mdx;
if (dy) *dy = mdy;
f32 mdx = 0.f, mdy = 0.f;
if (mouseLocked) {
mdx = mouseSensX * ((f32)mouseDX / 3.5f) * 0.022f;
mdy = mouseSensY * ((f32)mouseDY / 3.5f) * 0.022f;
}
if (dx) *dx = mdx;
if (dy) *dy = mdy;
}
void inputMouseGetAbsScaledDelta(f32 *dx, f32 *dy)
void inputMouseGetAbsScaledDelta(f32* dx, f32* dy)
{
f32 mdx, mdy;
if (mouseLocked) {
mdx = fabsf(mouseSensX) * (f32)mouseDX / 100.0f;
mdy = fabsf(mouseSensY) * (f32)mouseDY / 100.0f;
} else {
mdx = 0.f;
mdy = 0.f;
}
if (dx) *dx = mdx;
if (dy) *dy = mdy;
f32 mdx = 0.f, mdy = 0.f;
if (mouseLocked) {
mdx = fabsf(mouseSensX) * ((f32)mouseDX / 3.5f) * 0.022f;
mdy = fabsf(mouseSensY) * ((f32)mouseDY / 3.5f) * 0.022f;
}
if (dx) *dx = mdx;
if (dy) *dy = mdy;
}
void inputMouseGetSpeed(f32 *x, f32 *y)
+4 -4
View File
@@ -3667,15 +3667,15 @@ void playerTick(bool arg0)
f32 mdx, mdy;
inputMouseGetScaledDelta(&mdx, &mdy);
if (mdx || mdy) {
mdx *= 48.f;
mdy *= 48.f;
mdx *= 0.022f;
mdy *= 0.022f;
mdx = (mdx < -128.f) ? -128.f : (mdx > 127.f) ? 127.f : mdx;
mdy = (mdy < -128.f) ? -128.f : (mdy > 127.f) ? 127.f : mdy;
if (g_Vars.currentplayerstats && !optionsGetForwardPitch(g_Vars.currentplayerstats->mpindex)) {
mdy = -mdy;
}
sp178 += mdy * 0.00025f;
sp174 -= mdx * 0.00025f;
sp178 += mdy;
sp174 -= mdx;
}
}
#endif