From a178ef1ff631a2593fdd99f17421e996b3d9caf4 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 14 Sep 2022 22:15:24 +1000 Subject: [PATCH] - Duke: Floatify `player_struct::fric`. --- source/games/duke/src/actors.cpp | 8 ++++---- source/games/duke/src/input.cpp | 4 ++-- source/games/duke/src/types.h | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 3e3662353..6680f099d 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -4254,8 +4254,8 @@ void handle_se26(DDukeActor* actor) for (int p = connecthead; p >= 0; p = connectpoint2[p]) if (ps[p].GetActor()->sector() == actor->sector() && ps[p].on_ground) { - ps[p].fric.X += int(vect.X * 512); - ps[p].fric.Y += int(vect.Y * 512); + ps[p].fric.X += vect.X; + ps[p].fric.Y += vect.Y; ps[p].pos.Z += zvel; } @@ -4378,8 +4378,8 @@ void handle_se24(DDukeActor *actor, bool scroll, int shift) { if (abs(ps[p].pos.Z - ps[p].truefz) < gs.playerheight + 9) { - ps[p].fric.X += x << 3; - ps[p].fric.Y += y << 3; + ps[p].fric.X += x * (1. / 64.); + ps[p].fric.Y += y * (1. / 64.); } } } diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 77941c31a..c4fd9b84f 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -852,8 +852,8 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju if (packet) { *packet = loc; - packet->fvel = MulScale(loc.fvel, p->angle.ang.Cos() * (1 << 14), 9) - MulScale(loc.svel, p->angle.ang.Sin() * (1 << 14), 9) + p->fric.X; - packet->svel = MulScale(loc.fvel, p->angle.ang.Sin() * (1 << 14), 9) + MulScale(loc.svel, p->angle.ang.Cos() * (1 << 14), 9) + p->fric.Y; + packet->fvel = MulScale(loc.fvel, p->angle.ang.Cos() * (1 << 14), 9) - MulScale(loc.svel, p->angle.ang.Sin() * (1 << 14), 9) + p->fric.X * 512.; + packet->svel = MulScale(loc.fvel, p->angle.ang.Sin() * (1 << 14), 9) + MulScale(loc.svel, p->angle.ang.Cos() * (1 << 14), 9) + p->fric.Y * 512.; loc = {}; } } diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index d3f331cff..c796e551f 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -205,6 +205,7 @@ struct player_struct DVector3 vel; DVector3 pos, opos; DVector2 bobpos; + DVector2 fric; // player's horizon and angle structs. PlayerHorizon horizon; @@ -218,7 +219,7 @@ struct player_struct PalEntry pals; // this was a global variable originally. - vec2_t fric, exit, loogie[64]; + vec2_t exit, loogie[64]; // weapon drawer variables and their interpolation counterparts. int weapon_sway;