twhl-community / halflife-updated

Half-Life SDK updated to compile under VS2019 and 2022. Check README.md for more information.
Other
382 stars 146 forks source link

Fix anglemod function in pm_math.cpp #226

Open consolethinks opened 1 year ago

consolethinks commented 1 year ago

When compiled with GCC, the result of anglemod is incorrect, probably due to the way (360.0 / 65536) and (65536 / 360.0) are pre-calculated when using the C++17 standard.

This results in the yaw of the viewmodel being incorrectly rotated.

https://github.com/SamVanheer/halflife-updated/assets/32138106/7eca5aea-29c4-47c1-a611-200f3ebe97e1

By explicitly typecasting, the problem can be avoided.