diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp index b5fbc0b0f..e0c35ef75 100644 --- a/source/core/gameinput.cpp +++ b/source/core/gameinput.cpp @@ -28,41 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "build.h" -//--------------------------------------------------------------------------- -// -// code fron gameexec/conrun -// -//--------------------------------------------------------------------------- - -int getincangle(int a, int na) -{ - a &= 2047; - na &= 2047; - - if(abs(a-na) >= 1024) - { - if(na > 1024) na -= 2048; - if(a > 1024) a -= 2048; - } - - return na-a; -} - -binangle getincanglebam(binangle a, binangle na) -{ - int64_t cura = a.asbam(); - int64_t newa = na.asbam(); - - if(abs(cura-newa) > INT32_MAX) - { - if(newa > INT32_MAX) newa -= UINT32_MAX; - if(cura > INT32_MAX) cura -= UINT32_MAX; - } - - return bamang(uint32_t(newa-cura)); -} - - //--------------------------------------------------------------------------- // // Input scale helper functions. diff --git a/source/core/gameinput.h b/source/core/gameinput.h index 29fbb3942..27e99a79e 100644 --- a/source/core/gameinput.h +++ b/source/core/gameinput.h @@ -6,8 +6,15 @@ #include "gamestruct.h" #include "packet.h" -int getincangle(int a, int na); -binangle getincanglebam(binangle a, binangle na); +inline constexpr binangle getincanglebam(binangle a, binangle na) +{ + return na-a; +} + +inline constexpr int getincangle(int a, int na) +{ + return getincanglebam(buildang(a), buildang(na)).signedbuild(); +} struct PlayerHorizon {