From 666b6b700713195051d1e558cc6a471e9b3ef47c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 8 Jun 2020 21:03:45 +0200 Subject: [PATCH] - moved m_joy to common. --- src/CMakeLists.txt | 2 +- src/{ => common/engine}/m_joy.cpp | 9 +++++---- src/{ => common/engine}/m_joy.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) rename src/{ => common/engine}/m_joy.cpp (97%) rename src/{ => common/engine}/m_joy.h (98%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b24a76e0b..e0e39bb43 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -846,7 +846,6 @@ set (PCH_SOURCES hu_scores.cpp i_net.cpp m_cheat.cpp - m_joy.cpp m_misc.cpp playsim/p_acs.cpp playsim/p_actionfunctions.cpp @@ -1114,6 +1113,7 @@ set (PCH_SOURCES common/engine/renderstyle.cpp common/engine/v_colortables.cpp common/engine/serializer.cpp + common/engine/m_joy.cpp common/engine/m_random.cpp common/objects/dobject.cpp common/objects/dobjgc.cpp diff --git a/src/m_joy.cpp b/src/common/engine/m_joy.cpp similarity index 97% rename from src/m_joy.cpp rename to src/common/engine/m_joy.cpp index 151b3b4ed..107560d4d 100644 --- a/src/m_joy.cpp +++ b/src/common/engine/m_joy.cpp @@ -33,6 +33,7 @@ // HEADER FILES ------------------------------------------------------------ #include +#include "vectors.h" #include "m_joy.h" #include "gameconfigfile.h" #include "d_event.h" @@ -56,7 +57,7 @@ EXTERN_CVAR(Bool, joy_xinput) // PUBLIC DATA DEFINITIONS ------------------------------------------------- -CUSTOM_CVAR(Bool, use_joystick, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL) +CUSTOM_CVARD(Bool, use_joystick, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL, "enables input from the joystick if it is present") { #ifdef _WIN32 joy_ps2raw.Callback(); @@ -269,14 +270,14 @@ int Joy_XYAxesToButtons(double x, double y) double rad = atan2(y, x); if (rad < 0) { - rad += 2*M_PI; + rad += 2*pi::pi(); } // The circle is divided into eight segments for corresponding // button combinations. Each segment is pi/4 radians wide. We offset // by half this so that the segments are centered around the ideal lines // their buttons represent instead of being right on the lines. - rad += M_PI/8; // Offset - rad *= 4/M_PI; // Convert range from [0,2pi) to [0,8) + rad += pi::pi()/8; // Offset + rad *= 4/pi::pi(); // Convert range from [0,2pi) to [0,8) return JoyAngleButtons[int(rad) & 7]; } diff --git a/src/m_joy.h b/src/common/engine/m_joy.h similarity index 98% rename from src/m_joy.h rename to src/common/engine/m_joy.h index 042a59686..016aa78d6 100644 --- a/src/m_joy.h +++ b/src/common/engine/m_joy.h @@ -1,7 +1,7 @@ #ifndef M_JOY_H #define M_JOY_H -#include "doomtype.h" +#include "basics.h" #include "tarray.h" #include "c_cvars.h"