Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Slight cleanup within PlayerAngle and PlayerHorizon structs fol…
…lowing 39fe9ef and bf2d807.
  • Loading branch information
mjr4077au committed Apr 1, 2021
1 parent dff6b2a commit ff0ad08
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions source/core/gameinput.h
Expand Up @@ -49,7 +49,7 @@ struct PlayerHorizon
if (!SyncInput() && !backup)
{
target = buildhoriz(value);
if (target.asq16() == 0) target = q16horiz(1);
if (!target.asq16()) target = q16horiz(1);
}
else
{
Expand All @@ -63,7 +63,7 @@ struct PlayerHorizon
if (!SyncInput() && !backup)
{
target = buildfhoriz(value);
if (target.asq16() == 0) target = q16horiz(1);
if (!target.asq16()) target = q16horiz(1);
}
else
{
Expand All @@ -77,7 +77,7 @@ struct PlayerHorizon
if (!SyncInput() && !backup)
{
target = value;
if (target.asq16() == 0) target = q16horiz(1);
if (!target.asq16()) target = q16horiz(1);
}
else
{
Expand All @@ -90,9 +90,13 @@ struct PlayerHorizon
{
if (target.asq16())
{
horiz += q16horiz(xs_CRoundToInt(scaleAdjust * (target - horiz).asq16()));
auto delta = (target - horiz).asq16();

if (abs((horiz - target).asq16()) < FRACUNIT)
if (abs(delta) > FRACUNIT)
{
horiz += q16horiz(xs_CRoundToInt(scaleAdjust * delta));
}
else
{
horiz = target;
target = q16horiz(0);
Expand Down Expand Up @@ -201,7 +205,7 @@ struct PlayerAngle
if (!SyncInput() && !backup)
{
target = buildang(value & 2047);
if (target.asbam() == 0) target = bamang(1);
if (!target.asbam()) target = bamang(1);
}
else
{
Expand All @@ -215,7 +219,7 @@ struct PlayerAngle
if (!SyncInput() && !backup)
{
target = buildfang(fmod(value, 2048));
if (target.asbam() == 0) target = bamang(1);
if (!target.asbam()) target = bamang(1);
}
else
{
Expand All @@ -229,7 +233,7 @@ struct PlayerAngle
if (!SyncInput() && !backup)
{
target = value;
if (target.asbam() == 0) target = bamang(1);
if (!target.asbam()) target = bamang(1);
}
else
{
Expand All @@ -242,9 +246,13 @@ struct PlayerAngle
{
if (target.asbam())
{
ang += bamang(xs_CRoundToUInt(scaleAdjust * getincanglebam(ang, target).asbam()));
auto delta = getincanglebam(ang, target).asbam();

if (getincanglebam(ang, target).asbam() < BAMUNIT)
if (delta > BAMUNIT)
{
ang += bamang(xs_CRoundToUInt(scaleAdjust * delta));
}
else
{
ang = target;
target = bamang(0);
Expand Down

0 comments on commit ff0ad08

Please sign in to comment.