mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-03 17:32:26 +00:00
- moved m_joy to common.
This commit is contained in:
parent
5896f24eba
commit
666b6b7007
3 changed files with 7 additions and 6 deletions
|
@ -846,7 +846,6 @@ set (PCH_SOURCES
|
||||||
hu_scores.cpp
|
hu_scores.cpp
|
||||||
i_net.cpp
|
i_net.cpp
|
||||||
m_cheat.cpp
|
m_cheat.cpp
|
||||||
m_joy.cpp
|
|
||||||
m_misc.cpp
|
m_misc.cpp
|
||||||
playsim/p_acs.cpp
|
playsim/p_acs.cpp
|
||||||
playsim/p_actionfunctions.cpp
|
playsim/p_actionfunctions.cpp
|
||||||
|
@ -1114,6 +1113,7 @@ set (PCH_SOURCES
|
||||||
common/engine/renderstyle.cpp
|
common/engine/renderstyle.cpp
|
||||||
common/engine/v_colortables.cpp
|
common/engine/v_colortables.cpp
|
||||||
common/engine/serializer.cpp
|
common/engine/serializer.cpp
|
||||||
|
common/engine/m_joy.cpp
|
||||||
common/engine/m_random.cpp
|
common/engine/m_random.cpp
|
||||||
common/objects/dobject.cpp
|
common/objects/dobject.cpp
|
||||||
common/objects/dobjgc.cpp
|
common/objects/dobjgc.cpp
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
// HEADER FILES ------------------------------------------------------------
|
// HEADER FILES ------------------------------------------------------------
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include "vectors.h"
|
||||||
#include "m_joy.h"
|
#include "m_joy.h"
|
||||||
#include "gameconfigfile.h"
|
#include "gameconfigfile.h"
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
|
@ -56,7 +57,7 @@ EXTERN_CVAR(Bool, joy_xinput)
|
||||||
|
|
||||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
// 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
|
#ifdef _WIN32
|
||||||
joy_ps2raw.Callback();
|
joy_ps2raw.Callback();
|
||||||
|
@ -269,14 +270,14 @@ int Joy_XYAxesToButtons(double x, double y)
|
||||||
double rad = atan2(y, x);
|
double rad = atan2(y, x);
|
||||||
if (rad < 0)
|
if (rad < 0)
|
||||||
{
|
{
|
||||||
rad += 2*M_PI;
|
rad += 2*pi::pi();
|
||||||
}
|
}
|
||||||
// The circle is divided into eight segments for corresponding
|
// The circle is divided into eight segments for corresponding
|
||||||
// button combinations. Each segment is pi/4 radians wide. We offset
|
// button combinations. Each segment is pi/4 radians wide. We offset
|
||||||
// by half this so that the segments are centered around the ideal lines
|
// by half this so that the segments are centered around the ideal lines
|
||||||
// their buttons represent instead of being right on the lines.
|
// their buttons represent instead of being right on the lines.
|
||||||
rad += M_PI/8; // Offset
|
rad += pi::pi()/8; // Offset
|
||||||
rad *= 4/M_PI; // Convert range from [0,2pi) to [0,8)
|
rad *= 4/pi::pi(); // Convert range from [0,2pi) to [0,8)
|
||||||
return JoyAngleButtons[int(rad) & 7];
|
return JoyAngleButtons[int(rad) & 7];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef M_JOY_H
|
#ifndef M_JOY_H
|
||||||
#define M_JOY_H
|
#define M_JOY_H
|
||||||
|
|
||||||
#include "doomtype.h"
|
#include "basics.h"
|
||||||
#include "tarray.h"
|
#include "tarray.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
|
|
Loading…
Reference in a new issue