- All Games: Slight tidy up of gi->GetInput() functions.

This commit is contained in:
Mitchell Richters 2021-01-01 21:33:00 +11:00
parent 571583ca9c
commit 949e456018
3 changed files with 11 additions and 18 deletions

View file

@ -136,6 +136,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
if (packet)
{
*packet = localInput;
localInput = {};
}
}

View file

@ -854,15 +854,15 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
}
auto const p = &ps[myconnectindex];
bool const rrraVehicle = isRRRA() && (p->OnMotorcycle || p->OnBoat);
double const scaleAdjust = InputScale();
InputPacket input{};
if (isRRRA() && (p->OnMotorcycle || p->OnBoat))
{
processInputBits(p, hidInput);
if (rrraVehicle)
{
processVehicleInput(p, hidInput, input, scaleAdjust);
FinalizeInput(myconnectindex, input, true);
if (!SyncInput() && p->GetActor()->s.extra > 0)
{
@ -871,11 +871,11 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
}
else
{
processInputBits(p, hidInput);
processMovement(&input, &loc, hidInput, scaleAdjust, p->drink_amt);
FinalizeInput(myconnectindex, input, false);
}
FinalizeInput(myconnectindex, input, rrraVehicle);
if (!SyncInput())
{
if (p->GetActor()->s.extra > 0)
@ -893,12 +893,9 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
if (packet)
{
auto cos = p->angle.ang.bcos();
auto sin = p->angle.ang.bsin();
*packet = loc;
packet->fvel = mulscale9(loc.fvel, cos) + mulscale9(loc.svel, sin) + p->fric.x;
packet->svel = mulscale9(loc.fvel, sin) - mulscale9(loc.svel, cos) + p->fric.y;
packet->fvel = mulscale9(loc.fvel, p->angle.ang.bcos()) + mulscale9(loc.svel, p->angle.ang.bsin()) + p->fric.x;
packet->svel = mulscale9(loc.fvel, p->angle.ang.bsin()) - mulscale9(loc.svel, p->angle.ang.bcos()) + p->fric.y;
loc = {};
}
}

View file

@ -231,14 +231,9 @@ void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput)
if (packet)
{
auto const cos = pp->angle.ang.bcos();
auto const sin = pp->angle.ang.bsin();
*packet = loc;
packet->fvel = mulscale9(loc.fvel, cos) + mulscale9(loc.svel, sin);
packet->svel = mulscale9(loc.fvel, sin) - mulscale9(loc.svel, cos);
packet->fvel = mulscale9(loc.fvel, pp->angle.ang.bcos()) + mulscale9(loc.svel, pp->angle.ang.bsin());
packet->svel = mulscale9(loc.fvel, pp->angle.ang.bsin()) - mulscale9(loc.svel, pp->angle.ang.bcos());
loc = {};
}
}