- 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) if (packet)
{ {
*packet = localInput; *packet = localInput;
localInput = {};
} }
} }

View file

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

View file

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