"digital axis shit based on mouse movement should be eliminated"

git-svn-id: https://svn.eduke32.com/eduke32@8127 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/duke3d/src/menus.cpp
This commit is contained in:
terminx 2019-09-19 12:02:11 +00:00 committed by Christoph Oelckers
parent 97fd50e1ec
commit 701c67eb9e
3 changed files with 2 additions and 128 deletions

View file

@ -1002,30 +1002,9 @@ static char MenuJoystickAxes[MAXJOYAXES][MAXJOYBUTTONSTRINGLENGTH];
static MenuEntry_t *MEL_JOYSTICKAXES[MAXJOYAXES]; static MenuEntry_t *MEL_JOYSTICKAXES[MAXJOYAXES];
static MenuOption_t MEO_MOUSEADVANCED_DAXES_UP = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_Gamefuncs, &ud.config.MouseDigitalFunctions[1][0] );
static MenuEntry_t ME_MOUSEADVANCED_DAXES_UP = MAKE_MENUENTRY( "Digital Up", &MF_Redfont, &MEF_BigSliders, &MEO_MOUSEADVANCED_DAXES_UP, Option );
static MenuOption_t MEO_MOUSEADVANCED_DAXES_DOWN = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_Gamefuncs, &ud.config.MouseDigitalFunctions[1][1] );
static MenuEntry_t ME_MOUSEADVANCED_DAXES_DOWN = MAKE_MENUENTRY( "Digital Down", &MF_Redfont, &MEF_BigSliders, &MEO_MOUSEADVANCED_DAXES_DOWN, Option );
static MenuOption_t MEO_MOUSEADVANCED_DAXES_LEFT = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_Gamefuncs, &ud.config.MouseDigitalFunctions[0][0] );
static MenuEntry_t ME_MOUSEADVANCED_DAXES_LEFT = MAKE_MENUENTRY( "Digital Left", &MF_Redfont, &MEF_BigSliders, &MEO_MOUSEADVANCED_DAXES_LEFT, Option );
static MenuOption_t MEO_MOUSEADVANCED_DAXES_RIGHT = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_Gamefuncs, &ud.config.MouseDigitalFunctions[0][1] );
static MenuEntry_t ME_MOUSEADVANCED_DAXES_RIGHT = MAKE_MENUENTRY( "Digital Right", &MF_Redfont, &MEF_BigSliders, &MEO_MOUSEADVANCED_DAXES_RIGHT, Option );
static MenuEntry_t *MEL_MOUSEADVANCED[] = { static MenuEntry_t *MEL_MOUSEADVANCED[] = {
&ME_MOUSEADVANCED_SCALEX, &ME_MOUSEADVANCED_SCALEX,
&ME_MOUSEADVANCED_SCALEY, &ME_MOUSEADVANCED_SCALEY,
&ME_Space8_Redfont,
&ME_MOUSEADVANCED_DAXES_UP,
&ME_MOUSEADVANCED_DAXES_DOWN,
&ME_MOUSEADVANCED_DAXES_LEFT,
&ME_MOUSEADVANCED_DAXES_RIGHT,
};
static MenuEntry_t *MEL_INTERNAL_MOUSEADVANCED_DAXES[] = {
&ME_MOUSEADVANCED_DAXES_UP,
&ME_MOUSEADVANCED_DAXES_DOWN,
&ME_MOUSEADVANCED_DAXES_LEFT,
&ME_MOUSEADVANCED_DAXES_RIGHT,
}; };
static const char *MenuJoystickHatDirections[] = { "Up", "Right", "Down", "Left", }; static const char *MenuJoystickHatDirections[] = { "Up", "Right", "Down", "Left", };
@ -2398,17 +2377,6 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
} }
break; break;
case MENU_MOUSEADVANCED:
{
for (auto & i : MEL_INTERNAL_MOUSEADVANCED_DAXES)
if (entry == i)
{
mgametextcenter(origin.x, origin.y + (162<<16), "Digital axes are not for mouse look\n"
"or for aiming up and down");
}
}
break;
case MENU_RESETPLAYER: case MENU_RESETPLAYER:
videoFadeToBlack(1); videoFadeToBlack(1);
Bsprintf(tempbuf, "Load last game:\n\"%s\"", g_quickload->name); Bsprintf(tempbuf, "Load last game:\n\"%s\"", g_quickload->name);
@ -3442,13 +3410,6 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption)
CONTROL_MapButton(newOption, MenuMouseDataIndex[M_MOUSEBTNS.currentEntry][0], MenuMouseDataIndex[M_MOUSEBTNS.currentEntry][1], controldevice_mouse); CONTROL_MapButton(newOption, MenuMouseDataIndex[M_MOUSEBTNS.currentEntry][0], MenuMouseDataIndex[M_MOUSEBTNS.currentEntry][1], controldevice_mouse);
CONTROL_FreeMouseBind(MenuMouseDataIndex[M_MOUSEBTNS.currentEntry][0]); CONTROL_FreeMouseBind(MenuMouseDataIndex[M_MOUSEBTNS.currentEntry][0]);
break; break;
case MENU_MOUSEADVANCED:
{
for (int i = 0; i < ARRAY_SSIZE(MEL_INTERNAL_MOUSEADVANCED_DAXES); i++)
if (entry == MEL_INTERNAL_MOUSEADVANCED_DAXES[i])
CONTROL_MapDigitalAxis(i>>1, newOption, i&1, controldevice_mouse);
}
break;
case MENU_JOYSTICKBTNS: case MENU_JOYSTICKBTNS:
CONTROL_MapButton(newOption, M_JOYSTICKBTNS.currentEntry>>1, M_JOYSTICKBTNS.currentEntry&1, controldevice_joystick); CONTROL_MapButton(newOption, M_JOYSTICKBTNS.currentEntry>>1, M_JOYSTICKBTNS.currentEntry&1, controldevice_joystick);
break; break;

View file

@ -69,11 +69,6 @@ extern "C" {
//#define MAXMOUSEBUTTONS 10 //#define MAXMOUSEBUTTONS 10
// Number of Mouse Axes
// KEEPINSYNC duke3d/src/gamedefs.h, build/src/sdlayer.cpp
#define MAXMOUSEAXES 2
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
// Number of JOY buttons // Number of JOY buttons
// KEEPINSYNC duke3d/src/gamedefs.h, build/src/sdlayer.cpp // KEEPINSYNC duke3d/src/gamedefs.h, build/src/sdlayer.cpp
#define MAXJOYBUTTONS 32 #define MAXJOYBUTTONS 32

View file

@ -33,7 +33,6 @@ LastSeenInput CONTROL_LastSeenInput;
float CONTROL_MouseSensitivity = DEFAULTMOUSESENSITIVITY; float CONTROL_MouseSensitivity = DEFAULTMOUSESENSITIVITY;
static int32_t CONTROL_NumMouseButtons = 0; static int32_t CONTROL_NumMouseButtons = 0;
static int32_t CONTROL_NumMouseAxes = 0;
static int32_t CONTROL_NumJoyButtons = 0; static int32_t CONTROL_NumJoyButtons = 0;
static int32_t CONTROL_NumJoyAxes = 0; static int32_t CONTROL_NumJoyAxes = 0;
@ -41,11 +40,7 @@ static controlflags CONTROL_Flags[CONTROL_NUM_FLAGS];
// static controlkeymaptype CONTROL_KeyMapping[CONTROL_NUM_FLAGS]; // static controlkeymaptype CONTROL_KeyMapping[CONTROL_NUM_FLAGS];
static controlaxismaptype CONTROL_MouseAxesMap[MAXMOUSEAXES]; // maps physical axes onto virtual ones static int32_t CONTROL_MouseAxesScale[2];
static controlaxistype CONTROL_MouseAxes[MAXMOUSEAXES]; // physical axes
static controlaxistype CONTROL_LastMouseAxes[MAXMOUSEAXES];
static int32_t CONTROL_MouseAxesScale[MAXMOUSEAXES];
static int8_t CONTROL_MouseAxesInvert[MAXMOUSEAXES];
static controlaxismaptype CONTROL_JoyAxesMap[MAXJOYAXES]; static controlaxismaptype CONTROL_JoyAxesMap[MAXJOYAXES];
static controlaxistype CONTROL_JoyAxes[MAXJOYAXES]; static controlaxistype CONTROL_JoyAxes[MAXJOYAXES];
@ -235,14 +230,6 @@ void CONTROL_PrintAxes(void)
{ {
int32_t i; int32_t i;
initprintf("nummouseaxes=%d\n", CONTROL_NumMouseAxes);
for (i=0; i<CONTROL_NumMouseAxes; i++)
{
initprintf("axis=%d analog=%d digital1=%d digital2=%d\n",
i, CONTROL_MouseAxesMap[i].analogmap,
CONTROL_MouseAxesMap[i].minmap, CONTROL_MouseAxesMap[i].maxmap);
}
initprintf("numjoyaxes=%d\n", CONTROL_NumJoyAxes); initprintf("numjoyaxes=%d\n", CONTROL_NumJoyAxes);
for (i=0; i<CONTROL_NumJoyAxes; i++) for (i=0; i<CONTROL_NumJoyAxes; i++)
{ {
@ -305,17 +292,6 @@ void CONTROL_MapAnalogAxis(int whichaxis, int whichanalog, controldevice device)
switch (device) switch (device)
{ {
case controldevice_mouse:
if ((unsigned)whichaxis >= (unsigned)MAXMOUSEAXES)
{
//Error("CONTROL_MapAnalogAxis: axis %d out of valid range for %d mouse axes.",
// whichaxis, MAXMOUSEAXES);
return;
}
set = CONTROL_MouseAxesMap;
break;
case controldevice_joystick: case controldevice_joystick:
if ((unsigned)whichaxis >= (unsigned)MAXJOYAXES) if ((unsigned)whichaxis >= (unsigned)MAXJOYAXES)
{ {
@ -342,7 +318,7 @@ void CONTROL_SetAnalogAxisScale(int32_t whichaxis, int32_t axisscale, controldev
switch (device) switch (device)
{ {
case controldevice_mouse: case controldevice_mouse:
if ((unsigned) whichaxis >= (unsigned) MAXMOUSEAXES) if ((unsigned) whichaxis >= ARRAY_SIZE(CONTROL_MouseAxesScale))
{ {
//Error("CONTROL_SetAnalogAxisScale: axis %d out of valid range for %d mouse axes.", //Error("CONTROL_SetAnalogAxisScale: axis %d out of valid range for %d mouse axes.",
// whichaxis, MAXMOUSEAXES); // whichaxis, MAXMOUSEAXES);
@ -377,17 +353,6 @@ void CONTROL_SetAnalogAxisInvert(int32_t whichaxis, int32_t invert, controldevic
switch (device) switch (device)
{ {
case controldevice_mouse:
if ((unsigned) whichaxis >= (unsigned) MAXMOUSEAXES)
{
//Error("CONTROL_SetAnalogAxisInvert: axis %d out of valid range for %d mouse axes.",
// whichaxis, MAXMOUSEAXES);
return;
}
set = CONTROL_MouseAxesInvert;
break;
case controldevice_joystick: case controldevice_joystick:
if ((unsigned) whichaxis >= (unsigned) MAXJOYAXES) if ((unsigned) whichaxis >= (unsigned) MAXJOYAXES)
{ {
@ -415,17 +380,6 @@ void CONTROL_MapDigitalAxis(int32_t whichaxis, int32_t whichfunction, int32_t di
switch (device) switch (device)
{ {
case controldevice_mouse:
if ((unsigned) whichaxis >= (unsigned) MAXMOUSEAXES)
{
//Error("CONTROL_MapDigitalAxis: axis %d out of valid range for %d mouse axes.",
// whichaxis, MAXMOUSEAXES);
return;
}
set = CONTROL_MouseAxesMap;
break;
case controldevice_joystick: case controldevice_joystick:
if ((unsigned) whichaxis >= (unsigned) MAXJOYAXES) if ((unsigned) whichaxis >= (unsigned) MAXJOYAXES)
{ {
@ -465,10 +419,6 @@ void CONTROL_ClearAssignments(void)
memset(CONTROL_JoyButtonMapping, BUTTONUNDEFINED, sizeof(CONTROL_JoyButtonMapping)); memset(CONTROL_JoyButtonMapping, BUTTONUNDEFINED, sizeof(CONTROL_JoyButtonMapping));
// memset(CONTROL_KeyMapping, KEYUNDEFINED, sizeof(CONTROL_KeyMapping)); // memset(CONTROL_KeyMapping, KEYUNDEFINED, sizeof(CONTROL_KeyMapping));
memset(CONTROL_LastJoyAxes, 0, sizeof(CONTROL_LastJoyAxes)); memset(CONTROL_LastJoyAxes, 0, sizeof(CONTROL_LastJoyAxes));
memset(CONTROL_LastMouseAxes, 0, sizeof(CONTROL_LastMouseAxes));
memset(CONTROL_MouseAxes, 0, sizeof(CONTROL_MouseAxes));
memset(CONTROL_MouseAxesInvert, 0, sizeof(CONTROL_MouseAxesInvert));
memset(CONTROL_MouseAxesMap, AXISUNDEFINED, sizeof(CONTROL_MouseAxesMap));
memset(CONTROL_MouseButtonMapping, BUTTONUNDEFINED, sizeof(CONTROL_MouseButtonMapping)); memset(CONTROL_MouseButtonMapping, BUTTONUNDEFINED, sizeof(CONTROL_MouseButtonMapping));
for (int & i : CONTROL_MouseAxesScale) for (int & i : CONTROL_MouseAxesScale)
@ -574,11 +524,6 @@ static int CONTROL_DigitizeAxis(int axis, controldevice device)
switch (device) switch (device)
{ {
case controldevice_mouse:
set = CONTROL_MouseAxes;
lastset = CONTROL_LastMouseAxes;
break;
case controldevice_joystick: case controldevice_joystick:
set = CONTROL_JoyAxes; set = CONTROL_JoyAxes;
lastset = CONTROL_LastJoyAxes; lastset = CONTROL_LastJoyAxes;
@ -629,12 +574,6 @@ static void CONTROL_ScaleAxis(int axis, controldevice device)
switch (device) switch (device)
{ {
case controldevice_mouse:
set = CONTROL_MouseAxes;
scale = CONTROL_MouseAxesScale;
invert = CONTROL_MouseAxesInvert;
break;
case controldevice_joystick: case controldevice_joystick:
set = CONTROL_JoyAxes; set = CONTROL_JoyAxes;
scale = CONTROL_JoyAxesScale; scale = CONTROL_JoyAxesScale;
@ -655,11 +594,6 @@ static void CONTROL_ApplyAxis(int axis, ControlInfo *info, controldevice device)
switch (device) switch (device)
{ {
case controldevice_mouse:
set = CONTROL_MouseAxes;
map = CONTROL_MouseAxesMap;
break;
case controldevice_joystick: case controldevice_joystick:
set = CONTROL_JoyAxes; set = CONTROL_JoyAxes;
map = CONTROL_JoyAxesMap; map = CONTROL_JoyAxesMap;
@ -689,19 +623,7 @@ static void CONTROL_PollDevices(ControlInfo *info)
#endif #endif
if (CONTROL_MouseEnabled) if (CONTROL_MouseEnabled)
{
Bmemcpy(CONTROL_LastMouseAxes, CONTROL_MouseAxes, sizeof(CONTROL_MouseAxes));
memset(CONTROL_MouseAxes, 0, sizeof(CONTROL_MouseAxes));
CONTROL_GetMouseDelta(info); CONTROL_GetMouseDelta(info);
for (int i=MAXMOUSEAXES-1; i>=0; i--)
{
CONTROL_DigitizeAxis(i, controldevice_mouse);
CONTROL_ScaleAxis(i, controldevice_mouse);
LIMITCONTROL(&CONTROL_MouseAxes[i].analog);
CONTROL_ApplyAxis(i, info, controldevice_mouse);
}
}
if (CONTROL_JoystickEnabled) if (CONTROL_JoystickEnabled)
{ {
@ -748,9 +670,6 @@ static int CONTROL_HandleAxisFunction(int32_t *p1, controlaxistype *axes, contro
static void CONTROL_AxisFunctionState(int32_t *p1) static void CONTROL_AxisFunctionState(int32_t *p1)
{ {
if (CONTROL_NumMouseAxes)
CONTROL_HandleAxisFunction(p1, CONTROL_MouseAxes, CONTROL_MouseAxesMap, CONTROL_NumMouseAxes);
if (CONTROL_NumJoyAxes) if (CONTROL_NumJoyAxes)
{ {
if (CONTROL_HandleAxisFunction(p1, CONTROL_JoyAxes, CONTROL_JoyAxesMap, CONTROL_NumJoyAxes)) if (CONTROL_HandleAxisFunction(p1, CONTROL_JoyAxes, CONTROL_JoyAxesMap, CONTROL_NumJoyAxes))
@ -960,7 +879,6 @@ bool CONTROL_Startup(controltype which, int32_t(*TimeFunction)(void), int32_t ti
KB_Startup(); KB_Startup();
CONTROL_NumMouseAxes = MAXMOUSEAXES;
CONTROL_NumMouseButtons = MAXMOUSEBUTTONS; CONTROL_NumMouseButtons = MAXMOUSEBUTTONS;
CONTROL_MousePresent = Mouse_Init(); CONTROL_MousePresent = Mouse_Init();
CONTROL_MouseEnabled = CONTROL_MousePresent; CONTROL_MouseEnabled = CONTROL_MousePresent;