mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
- mouse turning works.
This commit is contained in:
parent
2da4294ba5
commit
200f54ad47
1 changed files with 48 additions and 14 deletions
|
@ -3981,8 +3981,30 @@ void getinput(SW_PACKET *loc)
|
||||||
|
|
||||||
CONTROL_GetInput(&info);
|
CONTROL_GetInput(&info);
|
||||||
|
|
||||||
info.dz = (info.dz * move_scale)>>8;
|
if (in_mousedeadzone)
|
||||||
info.dyaw = (info.dyaw * turn_scale)>>8;
|
{
|
||||||
|
if (info.mousey > 0)
|
||||||
|
info.mousey = max(info.mousey - in_mousedeadzone, 0);
|
||||||
|
else if (info.mousey < 0)
|
||||||
|
info.mousey = min(info.mousey + in_mousedeadzone, 0);
|
||||||
|
|
||||||
|
if (info.mousex > 0)
|
||||||
|
info.mousex = max(info.mousex - in_mousedeadzone, 0);
|
||||||
|
else if (info.mousex < 0)
|
||||||
|
info.mousex = min(info.mousex + in_mousedeadzone, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_mousebias)
|
||||||
|
{
|
||||||
|
if (klabs(info.mousex) > klabs(info.mousey))
|
||||||
|
info.mousey = tabledivide32_noinline(info.mousey, in_mousebias);
|
||||||
|
else
|
||||||
|
info.mousex = tabledivide32_noinline(info.mousex, in_mousebias);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//info.dz = (info.dz * move_scale)>>8;
|
||||||
|
//info.dyaw = (info.dyaw * turn_scale)>>8;
|
||||||
|
|
||||||
PauseKey(pp);
|
PauseKey(pp);
|
||||||
|
|
||||||
|
@ -4043,26 +4065,38 @@ void getinput(SW_PACKET *loc)
|
||||||
|
|
||||||
SET_LOC_KEY(loc->bits, SK_SPACE_BAR, ((!!inputState.GetKeyStatus(KEYSC_SPACE)) | buttonMap.ButtonDown(gamefunc_Open)));
|
SET_LOC_KEY(loc->bits, SK_SPACE_BAR, ((!!inputState.GetKeyStatus(KEYSC_SPACE)) | buttonMap.ButtonDown(gamefunc_Open)));
|
||||||
|
|
||||||
running = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run));
|
running = false;// G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run));
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop)
|
int const keyMove = running ? (NORMALKEYMOVE << 1) : NORMALKEYMOVE;
|
||||||
svel = -info.dyaw;
|
constexpr int const analogExtent = 32767; // KEEPINSYNC sdlayer.cpp
|
||||||
|
constexpr int const analogTurnAmount = (NORMALTURN << 1);
|
||||||
|
|
||||||
|
if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop)
|
||||||
|
{
|
||||||
|
static int strafeyaw;
|
||||||
|
|
||||||
|
svel = -(info.mousex + strafeyaw) >> 3;
|
||||||
|
strafeyaw = (info.mousex + strafeyaw) % 8;
|
||||||
|
|
||||||
|
svel -= info.dyaw * keyMove / analogExtent;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (info.dyaw > 0)
|
angvel = fix16_div(fix16_from_int(info.mousex), F16(32));
|
||||||
angvel = labs((-info.dyaw));
|
angvel += fix16_from_int(info.dyaw) / analogExtent * (analogTurnAmount << 1);
|
||||||
else
|
|
||||||
angvel = info.dyaw;
|
angvel >>= 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
aimvel = info.dpitch;
|
aimvel = fix16_div(fix16_from_int(info.mousey), F16(64));
|
||||||
aimvel = min(127, aimvel);
|
|
||||||
aimvel = max(-128, aimvel);
|
|
||||||
if (in_mouseflip)
|
if (in_mouseflip)
|
||||||
aimvel = -aimvel;
|
aimvel = -aimvel;
|
||||||
|
|
||||||
svel -= info.dx;
|
aimvel -= fix16_from_int(info.dpitch) / analogExtent * analogTurnAmount;
|
||||||
vel = -info.dz;
|
|
||||||
|
svel -= info.dx * keyMove / analogExtent;
|
||||||
|
vel -= info.dz * keyMove / analogExtent;
|
||||||
|
|
||||||
if (running)
|
if (running)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue