Skip to content

Commit

Permalink
- Tiny bit of abstraction in PlayerAngle struct.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjr4077au authored and coelckers committed Aug 3, 2023
1 parent 8fd0102 commit 8242ae1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/core/gameinput.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ struct PlayerAngle
DAngle interpolatedsum(double const smoothratio) { return interpolatedangle(osum(), sum(), smoothratio); }
DAngle interpolatedlookang(double const smoothratio) { return interpolatedangle(olook_ang, look_ang, smoothratio); }
DAngle interpolatedrotscrn(double const smoothratio) { return interpolatedangle(orotscrnang, rotscrnang, smoothratio); }
DAngle renderlookang(double const smoothratio) { return !SyncInput() ? look_ang : interpolatedlookang(smoothratio); }

// Ticrate playsim adjustment helpers.
void resetadjustment() { adjustment = nullAngle; }
Expand All @@ -154,8 +155,8 @@ struct PlayerAngle
bool movementlocked() { return targetset() || inputdisabled; }

// Draw code helpers. The logic where these are used rely heavily on Build's angle period.
double look_anghalf(double const smoothratio) { return (!SyncInput() ? look_ang : interpolatedlookang(smoothratio)).Normalized180().Buildfang() * 0.5; }
double looking_arc(double const smoothratio) { return fabs((!SyncInput() ? look_ang : interpolatedlookang(smoothratio)).Normalized180().Buildfang()) * (1. / 9.); }
double look_anghalf(double const smoothratio) { return renderlookang(smoothratio).Normalized180().Buildfang() * 0.5; }
double looking_arc(double const smoothratio) { return fabs(renderlookang(smoothratio).Normalized180().Buildfang() * (1. / 9.)); }

// Ticrate playsim adjustment setters and processor.
void addadjustment(const DAngle value)
Expand Down

0 comments on commit 8242ae1

Please sign in to comment.