- restrict keyboard input to the actual tic in SW as well.

Also fixed the blocking of the strafe key with sector objects - this must have gotten lost somewhere.
This commit is contained in:
Christoph Oelckers 2020-09-14 21:25:53 +02:00
parent 1f4594b450
commit eb4e0b1b83

View file

@ -199,7 +199,7 @@ static void processWeapon(PLAYERp const pp)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool const mouseaim) static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool const mouseaim, bool allowkeys)
{ {
double const scaleAdjust = InputScale(); double const scaleAdjust = InputScale();
bool const strafeKey = buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop; bool const strafeKey = buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop;
@ -239,17 +239,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool
svel -= xs_CRoundToInt(scaleAdjust * (hidInput->dx * keymove)); svel -= xs_CRoundToInt(scaleAdjust * (hidInput->dx * keymove));
fvel -= xs_CRoundToInt(scaleAdjust * (hidInput->dz * keymove)); fvel -= xs_CRoundToInt(scaleAdjust * (hidInput->dz * keymove));
if (strafeKey) if (strafeKey || pp->sop)
{
if (abs(svel) < keymove)
{
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
svel += keymove;
if (buttonMap.ButtonDown(gamefunc_Turn_Right))
svel -= keymove;
}
}
else
{ {
if (buttonMap.ButtonDown(gamefunc_Turn_Left) || (buttonMap.ButtonDown(gamefunc_Strafe_Left) && pp->sop)) if (buttonMap.ButtonDown(gamefunc_Turn_Left) || (buttonMap.ButtonDown(gamefunc_Strafe_Left) && pp->sop))
{ {
@ -267,21 +257,39 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool
} }
} }
if (abs(loc.svel) < keymove) if (allowkeys)
{ {
if (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !pp->sop) if (!pp->sop)
svel += keymove; {
if (strafeKey)
{
if (abs(svel) < keymove)
{
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
svel += keymove;
if (buttonMap.ButtonDown(gamefunc_Turn_Right))
svel -= keymove;
}
}
if (buttonMap.ButtonDown(gamefunc_Strafe_Right) && !pp->sop) if (abs(loc.svel) < keymove)
svel -= keymove; {
} if (buttonMap.ButtonDown(gamefunc_Strafe_Left))
if (abs(loc.fvel) < keymove) svel += keymove;
{
if (buttonMap.ButtonDown(gamefunc_Move_Forward))
fvel += keymove;
if (buttonMap.ButtonDown(gamefunc_Move_Backward)) if (buttonMap.ButtonDown(gamefunc_Strafe_Right))
fvel -= keymove; svel -= keymove;
}
}
if (abs(loc.fvel) < keymove)
{
if (buttonMap.ButtonDown(gamefunc_Move_Forward))
fvel += keymove;
if (buttonMap.ButtonDown(gamefunc_Move_Backward))
fvel -= keymove;
}
} }
if (!cl_syncinput) if (!cl_syncinput)
@ -358,7 +366,7 @@ void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput)
bool mouseaim; bool mouseaim;
processInputBits(pp, hidInput, &mouseaim); processInputBits(pp, hidInput, &mouseaim);
processMovement(pp, hidInput, mouseaim); processMovement(pp, hidInput, mouseaim, packet != nullptr);
processWeapon(pp); processWeapon(pp);
if (packet) if (packet)