mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- Move input vector rotation for Duke and SW into the playsim.
* The next commit needs this to ensure the vector is rotated using the most current angle.
This commit is contained in:
parent
15b101870d
commit
9437ea9622
5 changed files with 14 additions and 6 deletions
|
@ -88,6 +88,7 @@ void GameInterface::Ticker()
|
|||
p->pals.a--;
|
||||
|
||||
hud_input(i);
|
||||
processinputvel(i);
|
||||
fi.processinput(i);
|
||||
fi.checksectors(i);
|
||||
}
|
||||
|
|
|
@ -352,4 +352,12 @@ inline int monsterCheatCheck(DDukeActor* self)
|
|||
return false;
|
||||
}
|
||||
|
||||
inline void processinputvel(int snum)
|
||||
{
|
||||
const auto p = &ps[snum];
|
||||
const auto velvect = DVector2(p->sync.fvel, p->sync.svel).Rotated(p->GetActor()->spr.Angles.Yaw) + p->fric;
|
||||
p->sync.fvel = (float)velvect.X;
|
||||
p->sync.svel = (float)velvect.Y;
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -843,9 +843,6 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
|
|||
if (packet)
|
||||
{
|
||||
*packet = loc;
|
||||
auto velvect = DVector2(loc.fvel, loc.svel).Rotated(p->GetActor()->spr.Angles.Yaw) + p->fric;
|
||||
packet->fvel = (float)velvect.X;
|
||||
packet->svel = (float)velvect.Y;
|
||||
loc = {};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,9 +204,6 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
|
|||
if (packet)
|
||||
{
|
||||
*packet = loc;
|
||||
auto velvect = DVector2(loc.fvel, loc.svel).Rotated(pp->actor->spr.Angles.Yaw);
|
||||
packet->fvel = (float)velvect.X;
|
||||
packet->svel = (float)velvect.Y;
|
||||
loc = {};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6996,6 +6996,11 @@ void domovethings(void)
|
|||
// disable synchronised input if set by game.
|
||||
resetForcedSyncInput();
|
||||
|
||||
// convert fvel/svel into a vector before performing actions.
|
||||
const auto velvect = DVector2(pp->input.fvel, pp->input.svel).Rotated(pp->actor->spr.Angles.Yaw);
|
||||
pp->input.fvel = (float)velvect.X;
|
||||
pp->input.svel = (float)velvect.Y;
|
||||
|
||||
if (pp->DoPlayerAction) pp->DoPlayerAction(pp);
|
||||
|
||||
UpdatePlayerSprite(pp);
|
||||
|
|
Loading…
Reference in a new issue