- consolidated the 4 sets of mouse and joystick configuration variables.

This commit is contained in:
Christoph Oelckers 2019-10-26 21:50:49 +02:00
parent 70a7d1bd82
commit b2d7179dbe
19 changed files with 312 additions and 483 deletions

View file

@ -55,16 +55,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
int32_t MouseAnalogueAxes[MAXMOUSEAXES];
int32_t MouseAnalogueScale[MAXMOUSEAXES];
int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2];
int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
int32_t JoystickAnalogueAxes[MAXJOYAXES];
int32_t JoystickAnalogueScale[MAXJOYAXES];
int32_t JoystickAnalogueDead[MAXJOYAXES];
int32_t JoystickAnalogueSaturate[MAXJOYAXES];
int32_t scripthandle; int32_t scripthandle;
int32_t setupread; int32_t setupread;
int32_t mus_restartonload; int32_t mus_restartonload;
@ -98,49 +88,6 @@ int gWeaponsV10x;
int32_t CONFIG_AnalogNameToNum(const char *func)
{
if (!func)
return -1;
if (!Bstrcasecmp(func,"analog_turning"))
{
return analog_turning;
}
if (!Bstrcasecmp(func,"analog_strafing"))
{
return analog_strafing;
}
if (!Bstrcasecmp(func,"analog_moving"))
{
return analog_moving;
}
if (!Bstrcasecmp(func,"analog_lookingupanddown"))
{
return analog_lookingupanddown;
}
return -1;
}
const char *CONFIG_AnalogNumToName(int32_t func)
{
switch (func)
{
case analog_turning:
return "analog_turning";
case analog_strafing:
return "analog_strafing";
case analog_moving:
return "analog_moving";
case analog_lookingupanddown:
return "analog_lookingupanddown";
}
return NULL;
}

View file

@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define config_public_h_ #define config_public_h_
#include "keyboard.h" #include "keyboard.h"
#include "gamecontrol.h"
#include "control.h" #include "control.h"
#include "_control.h" #include "_control.h"
#include "gamedefs.h" #include "gamedefs.h"
@ -38,18 +37,7 @@ BEGIN_BLD_NS
#define MAXRIDECULE 10 #define MAXRIDECULE 10
#define MAXRIDECULELENGTH 40 #define MAXRIDECULELENGTH 40
#define MAXPLAYERNAME 16 #define MAXPLAYERNAME 16
#define MAXMOUSEAXES 2
extern int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
extern int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
extern int32_t MouseAnalogueAxes[MAXMOUSEAXES];
extern int32_t MouseAnalogueScale[MAXMOUSEAXES];
extern int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2];
extern int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
extern int32_t JoystickAnalogueAxes[MAXJOYAXES];
extern int32_t JoystickAnalogueScale[MAXJOYAXES];
extern int32_t JoystickAnalogueDead[MAXJOYAXES];
extern int32_t JoystickAnalogueSaturate[MAXJOYAXES];
extern int32_t scripthandle; extern int32_t scripthandle;
extern int32_t setupread; extern int32_t setupread;
extern int32_t configversion; extern int32_t configversion;
@ -88,10 +76,6 @@ void CONFIG_SetupJoystick(void);
int32_t CONFIG_GetMapBestTime(char const *mapname, uint8_t const *mapmd4); int32_t CONFIG_GetMapBestTime(char const *mapname, uint8_t const *mapmd4);
int CONFIG_SetMapBestTime(uint8_t const *mapmd4, int32_t tm); int CONFIG_SetMapBestTime(uint8_t const *mapmd4, int32_t tm);
int32_t CONFIG_AnalogNameToNum(const char *func);
const char *CONFIG_AnalogNumToName(int32_t func);
END_BLD_NS END_BLD_NS
#endif #endif

View file

@ -37,32 +37,14 @@ BEGIN_BLD_NS
// config file name // config file name
#define SETUPFILENAME APPBASENAME ".cfg" #define SETUPFILENAME APPBASENAME ".cfg"
// KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp
#define MAXJOYBUTTONS 32
#define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4)
// KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp
#define MAXMOUSEAXES 2
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
// KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp
#define MAXJOYAXES 9
#define MAXJOYDIGITAL (MAXJOYAXES*2)
// default mouse scale // default mouse scale
#define DEFAULTMOUSEANALOGUESCALE 65536 #define DEFAULTMOUSEANALOGUESCALE 65536
// default joystick settings // default joystick settings
#if defined(GEKKO)
#define DEFAULTJOYSTICKANALOGUESCALE 16384
#define DEFAULTJOYSTICKANALOGUEDEAD 1000
#define DEFAULTJOYSTICKANALOGUESATURATE 9500
#else
#define DEFAULTJOYSTICKANALOGUESCALE 65536 #define DEFAULTJOYSTICKANALOGUESCALE 65536
#define DEFAULTJOYSTICKANALOGUEDEAD 1000 #define DEFAULTJOYSTICKANALOGUEDEAD 1000
#define DEFAULTJOYSTICKANALOGUESATURATE 9500 #define DEFAULTJOYSTICKANALOGUESATURATE 9500
#endif
END_BLD_NS END_BLD_NS

View file

@ -336,3 +336,77 @@ void CONFIG_SetDefaultKeys(const char *defbinds, bool lazy/*=false*/)
} }
} }
//==========================================================================
//
//
//
//==========================================================================
int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
int32_t MouseAnalogueAxes[MAXMOUSEAXES];
int32_t MouseAnalogueScale[MAXMOUSEAXES];
int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2];
int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
int32_t JoystickAnalogueAxes[MAXJOYAXES];
int32_t JoystickAnalogueScale[MAXJOYAXES];
int32_t JoystickAnalogueDead[MAXJOYAXES];
int32_t JoystickAnalogueSaturate[MAXJOYAXES];
int32_t JoystickAnalogueInvert[MAXJOYAXES];
//==========================================================================
//
//
//
//==========================================================================
int32_t CONFIG_AnalogNameToNum(const char* func)
{
if (!func)
return -1;
if (!Bstrcasecmp(func, "analog_turning"))
{
return analog_turning;
}
if (!Bstrcasecmp(func, "analog_strafing"))
{
return analog_strafing;
}
if (!Bstrcasecmp(func, "analog_moving"))
{
return analog_moving;
}
if (!Bstrcasecmp(func, "analog_lookingupanddown"))
{
return analog_lookingupanddown;
}
return -1;
}
//==========================================================================
//
//
//
//==========================================================================
const char* CONFIG_AnalogNumToName(int32_t func)
{
switch (func)
{
case analog_turning:
return "analog_turning";
case analog_strafing:
return "analog_strafing";
case analog_moving:
return "analog_moving";
case analog_lookingupanddown:
return "analog_lookingupanddown";
}
return NULL;
}

View file

@ -1,6 +1,8 @@
#pragma once #pragma once
#include "keyboard.h" #include "keyboard.h"
#include "control.h"
#include "_control.h"
// Order is that of EDuke32 by necessity because it exposes the key binds to scripting by index instead of by name. // Order is that of EDuke32 by necessity because it exposes the key binds to scripting by index instead of by name.
enum GameFunction_t enum GameFunction_t
@ -104,3 +106,24 @@ const char* CONFIG_FunctionNumToRealName(int32_t func);
void CONFIG_ReplaceButtonName(int num, const char* text); void CONFIG_ReplaceButtonName(int num, const char* text);
void CONFIG_DeleteButtonName(int num); void CONFIG_DeleteButtonName(int num);
void CONFIG_MapKey(int which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2); void CONFIG_MapKey(int which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2);
// I am not sure if anything below will survive for long...
#define MAXMOUSEAXES 2
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
extern int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
extern int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
extern int32_t MouseAnalogueAxes[MAXMOUSEAXES];
extern int32_t MouseAnalogueScale[MAXMOUSEAXES];
extern int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2];
extern int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
extern int32_t JoystickAnalogueAxes[MAXJOYAXES];
extern int32_t JoystickAnalogueScale[MAXJOYAXES];
extern int32_t JoystickAnalogueDead[MAXJOYAXES];
extern int32_t JoystickAnalogueSaturate[MAXJOYAXES];
extern int32_t JoystickAnalogueInvert[MAXJOYAXES];
int32_t CONFIG_AnalogNameToNum(const char* func);
const char* CONFIG_AnalogNumToName(int32_t func);

View file

@ -42,70 +42,36 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_DUKE_NS BEGIN_DUKE_NS
int32_t CONFIG_AnalogNameToNum(const char *func)
{
if (!func)
return -1;
else if (!Bstrcasecmp(func, "analog_turning"))
return analog_turning;
else if (!Bstrcasecmp(func, "analog_strafing"))
return analog_strafing;
else if (!Bstrcasecmp(func, "analog_moving"))
return analog_moving;
else if (!Bstrcasecmp(func, "analog_lookingupanddown"))
return analog_lookingupanddown;
else
return -1;
}
static char const * CONFIG_AnalogNumToName(int32_t func)
{
switch (func)
{
case analog_turning:
return "analog_turning";
case analog_strafing:
return "analog_strafing";
case analog_moving:
return "analog_moving";
case analog_lookingupanddown:
return "analog_lookingupanddown";
}
return "";
}
static void CONFIG_SetJoystickButtonFunction(int i, int j, int function) static void CONFIG_SetJoystickButtonFunction(int i, int j, int function)
{ {
ud.config.JoystickFunctions[i][j] = function; JoystickFunctions[i][j] = function;
CONTROL_MapButton(function, i, j, controldevice_joystick); CONTROL_MapButton(function, i, j, controldevice_joystick);
} }
static void CONFIG_SetJoystickAnalogAxisScale(int i, int scale) static void CONFIG_SetJoystickAnalogAxisScale(int i, int scale)
{ {
ud.config.JoystickAnalogueScale[i] = scale; JoystickAnalogueScale[i] = scale;
CONTROL_SetAnalogAxisScale(i, scale, controldevice_joystick); CONTROL_SetAnalogAxisScale(i, scale, controldevice_joystick);
} }
static void CONFIG_SetJoystickAnalogAxisInvert(int i, int invert) static void CONFIG_SetJoystickAnalogAxisInvert(int i, int invert)
{ {
ud.config.JoystickAnalogueInvert[i] = invert; JoystickAnalogueInvert[i] = invert;
CONTROL_SetAnalogAxisInvert(i, invert, controldevice_joystick); CONTROL_SetAnalogAxisInvert(i, invert, controldevice_joystick);
} }
static void CONFIG_SetJoystickAnalogAxisDeadSaturate(int i, int dead, int saturate) static void CONFIG_SetJoystickAnalogAxisDeadSaturate(int i, int dead, int saturate)
{ {
ud.config.JoystickAnalogueDead[i] = dead; JoystickAnalogueDead[i] = dead;
ud.config.JoystickAnalogueSaturate[i] = saturate; JoystickAnalogueSaturate[i] = saturate;
joySetDeadZone(i, dead, saturate); joySetDeadZone(i, dead, saturate);
} }
static void CONFIG_SetJoystickDigitalAxisFunction(int i, int j, int function) static void CONFIG_SetJoystickDigitalAxisFunction(int i, int j, int function)
{ {
ud.config.JoystickDigitalFunctions[i][j] = function; JoystickDigitalFunctions[i][j] = function;
CONTROL_MapDigitalAxis(i, function, j, controldevice_joystick); CONTROL_MapDigitalAxis(i, function, j, controldevice_joystick);
} }
static void CONFIG_SetJoystickAnalogAxisFunction(int i, int function) static void CONFIG_SetJoystickAnalogAxisFunction(int i, int function)
{ {
ud.config.JoystickAnalogueAxes[i] = function; JoystickAnalogueAxes[i] = function;
CONTROL_MapAnalogAxis(i, function, controldevice_joystick); CONTROL_MapAnalogAxis(i, function, controldevice_joystick);
} }
@ -215,32 +181,32 @@ void CONFIG_SetDefaults(void)
Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!"); Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!");
#endif #endif
memset(ud.config.MouseFunctions, -1, sizeof(ud.config.MouseFunctions)); memset(MouseFunctions, -1, sizeof(MouseFunctions));
memset(ud.config.MouseDigitalFunctions, -1, sizeof(ud.config.MouseDigitalFunctions)); memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions));
memset(ud.config.JoystickFunctions, -1, sizeof(ud.config.JoystickFunctions)); memset(JoystickFunctions, -1, sizeof(JoystickFunctions));
memset(ud.config.JoystickDigitalFunctions, -1, sizeof(ud.config.JoystickDigitalFunctions)); memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions));
for (int i=0; i<MAXMOUSEBUTTONS; i++) for (int i=0; i<MAXMOUSEBUTTONS; i++)
{ {
ud.config.MouseFunctions[i][0] = CONFIG_FunctionNameToNum(mousedefaults[i]); MouseFunctions[i][0] = CONFIG_FunctionNameToNum(mousedefaults[i]);
CONTROL_MapButton(ud.config.MouseFunctions[i][0], i, 0, controldevice_mouse); CONTROL_MapButton(MouseFunctions[i][0], i, 0, controldevice_mouse);
if (i>=4) continue; if (i>=4) continue;
ud.config.MouseFunctions[i][1] = CONFIG_FunctionNameToNum(mouseclickeddefaults[i]); MouseFunctions[i][1] = CONFIG_FunctionNameToNum(mouseclickeddefaults[i]);
CONTROL_MapButton(ud.config.MouseFunctions[i][1], i, 1, controldevice_mouse); CONTROL_MapButton(MouseFunctions[i][1], i, 1, controldevice_mouse);
} }
for (int i=0; i<MAXMOUSEAXES; i++) for (int i=0; i<MAXMOUSEAXES; i++)
{ {
ud.config.MouseAnalogueScale[i] = DEFAULTMOUSEANALOGUESCALE; MouseAnalogueScale[i] = DEFAULTMOUSEANALOGUESCALE;
CONTROL_SetAnalogAxisScale(i, ud.config.MouseAnalogueScale[i], controldevice_mouse); CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse);
ud.config.MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2]); MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2]);
ud.config.MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2+1]); MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2+1]);
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][0], 0, controldevice_mouse); CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0, controldevice_mouse);
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][1], 1, controldevice_mouse); CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1, controldevice_mouse);
ud.config.MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]); MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]);
CONTROL_MapAnalogAxis(i, ud.config.MouseAnalogueAxes[i], controldevice_mouse); CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
} }
#if !defined GEKKO #if !defined GEKKO
@ -248,28 +214,28 @@ void CONFIG_SetDefaults(void)
#else #else
for (int i=0; i<MAXJOYBUTTONSANDHATS; i++) for (int i=0; i<MAXJOYBUTTONSANDHATS; i++)
{ {
ud.config.JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdefaults[i]); JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdefaults[i]);
ud.config.JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(joystickclickeddefaults[i]); JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(joystickclickeddefaults[i]);
CONTROL_MapButton(ud.config.JoystickFunctions[i][0], i, 0, controldevice_joystick); CONTROL_MapButton(JoystickFunctions[i][0], i, 0, controldevice_joystick);
CONTROL_MapButton(ud.config.JoystickFunctions[i][1], i, 1, controldevice_joystick); CONTROL_MapButton(JoystickFunctions[i][1], i, 1, controldevice_joystick);
} }
for (int i=0; i<MAXJOYAXES; i++) for (int i=0; i<MAXJOYAXES; i++)
{ {
ud.config.JoystickAnalogueScale[i] = DEFAULTJOYSTICKANALOGUESCALE; JoystickAnalogueScale[i] = DEFAULTJOYSTICKANALOGUESCALE;
ud.config.JoystickAnalogueInvert[i] = 0; JoystickAnalogueInvert[i] = 0;
ud.config.JoystickAnalogueDead[i] = DEFAULTJOYSTICKANALOGUEDEAD; JoystickAnalogueDead[i] = DEFAULTJOYSTICKANALOGUEDEAD;
ud.config.JoystickAnalogueSaturate[i] = DEFAULTJOYSTICKANALOGUESATURATE; JoystickAnalogueSaturate[i] = DEFAULTJOYSTICKANALOGUESATURATE;
CONTROL_SetAnalogAxisScale(i, ud.config.JoystickAnalogueScale[i], controldevice_joystick); CONTROL_SetAnalogAxisScale(i, JoystickAnalogueScale[i], controldevice_joystick);
CONTROL_SetAnalogAxisInvert(i, 0, controldevice_joystick); CONTROL_SetAnalogAxisInvert(i, 0, controldevice_joystick);
ud.config.JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2]); JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2]);
ud.config.JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2+1]); JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2+1]);
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][0], 0, controldevice_joystick); CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][1], 1, controldevice_joystick); CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
ud.config.JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(joystickanalogdefaults[i]); JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(joystickanalogdefaults[i]);
CONTROL_MapAnalogAxis(i, ud.config.JoystickAnalogueAxes[i], controldevice_joystick); CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
} }
#endif #endif
@ -292,12 +258,12 @@ void CONFIG_SetupMouse(void)
Bsprintf(str,"MouseButton%d",i); Bsprintf(str,"MouseButton%d",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
ud.config.MouseFunctions[i][0] = CONFIG_FunctionNameToNum(temp); MouseFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"MouseButtonClicked%d",i); Bsprintf(str,"MouseButtonClicked%d",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
ud.config.MouseFunctions[i][1] = CONFIG_FunctionNameToNum(temp); MouseFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
} }
// map over the axes // map over the axes
@ -306,35 +272,35 @@ void CONFIG_SetupMouse(void)
Bsprintf(str,"MouseAnalogAxes%d",i); Bsprintf(str,"MouseAnalogAxes%d",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
ud.config.MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp); MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
Bsprintf(str,"MouseDigitalAxes%d_0",i); Bsprintf(str,"MouseDigitalAxes%d_0",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
ud.config.MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp); MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"MouseDigitalAxes%d_1",i); Bsprintf(str,"MouseDigitalAxes%d_1",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
ud.config.MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp); MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"MouseAnalogScale%d",i); Bsprintf(str,"MouseAnalogScale%d",i);
int32_t scale = ud.config.MouseAnalogueScale[i]; int32_t scale = MouseAnalogueScale[i];
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str, &scale); SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str, &scale);
ud.config.MouseAnalogueScale[i] = scale; MouseAnalogueScale[i] = scale;
} }
for (int i=0; i<MAXMOUSEBUTTONS; i++) for (int i=0; i<MAXMOUSEBUTTONS; i++)
{ {
CONTROL_MapButton(ud.config.MouseFunctions[i][0], i, 0, controldevice_mouse); CONTROL_MapButton(MouseFunctions[i][0], i, 0, controldevice_mouse);
CONTROL_MapButton(ud.config.MouseFunctions[i][1], i, 1, controldevice_mouse); CONTROL_MapButton(MouseFunctions[i][1], i, 1, controldevice_mouse);
} }
for (int i=0; i<MAXMOUSEAXES; i++) for (int i=0; i<MAXMOUSEAXES; i++)
{ {
CONTROL_MapAnalogAxis(i, ud.config.MouseAnalogueAxes[i], controldevice_mouse); CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][0], 0,controldevice_mouse); CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0,controldevice_mouse);
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][1], 1,controldevice_mouse); CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1,controldevice_mouse);
CONTROL_SetAnalogAxisScale(i, ud.config.MouseAnalogueScale[i], controldevice_mouse); CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse);
} }
} }
@ -353,12 +319,12 @@ void CONFIG_SetupJoystick(void)
Bsprintf(str,"ControllerButton%d",i); Bsprintf(str,"ControllerButton%d",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
ud.config.JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(temp); JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"ControllerButtonClicked%d",i); Bsprintf(str,"ControllerButtonClicked%d",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
ud.config.JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(temp); JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
} }
// map over the axes // map over the axes
@ -367,51 +333,51 @@ void CONFIG_SetupJoystick(void)
Bsprintf(str,"ControllerAnalogAxes%d",i); Bsprintf(str,"ControllerAnalogAxes%d",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
ud.config.JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp); JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
Bsprintf(str,"ControllerDigitalAxes%d_0",i); Bsprintf(str,"ControllerDigitalAxes%d_0",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
ud.config.JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp); JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"ControllerDigitalAxes%d_1",i); Bsprintf(str,"ControllerDigitalAxes%d_1",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
ud.config.JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp); JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"ControllerAnalogScale%d",i); Bsprintf(str,"ControllerAnalogScale%d",i);
scale = ud.config.JoystickAnalogueScale[i]; scale = JoystickAnalogueScale[i];
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale); SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
ud.config.JoystickAnalogueScale[i] = scale; JoystickAnalogueScale[i] = scale;
Bsprintf(str,"ControllerAnalogInvert%d",i); Bsprintf(str,"ControllerAnalogInvert%d",i);
scale = ud.config.JoystickAnalogueInvert[i]; scale = JoystickAnalogueInvert[i];
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale); SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
ud.config.JoystickAnalogueInvert[i] = scale; JoystickAnalogueInvert[i] = scale;
Bsprintf(str,"ControllerAnalogDead%d",i); Bsprintf(str,"ControllerAnalogDead%d",i);
scale = ud.config.JoystickAnalogueDead[i]; scale = JoystickAnalogueDead[i];
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale); SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
ud.config.JoystickAnalogueDead[i] = scale; JoystickAnalogueDead[i] = scale;
Bsprintf(str,"ControllerAnalogSaturate%d",i); Bsprintf(str,"ControllerAnalogSaturate%d",i);
scale = ud.config.JoystickAnalogueSaturate[i]; scale = JoystickAnalogueSaturate[i];
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale); SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
ud.config.JoystickAnalogueSaturate[i] = scale; JoystickAnalogueSaturate[i] = scale;
} }
for (i=0; i<MAXJOYBUTTONSANDHATS; i++) for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
{ {
CONTROL_MapButton(ud.config.JoystickFunctions[i][0], i, 0, controldevice_joystick); CONTROL_MapButton(JoystickFunctions[i][0], i, 0, controldevice_joystick);
CONTROL_MapButton(ud.config.JoystickFunctions[i][1], i, 1, controldevice_joystick); CONTROL_MapButton(JoystickFunctions[i][1], i, 1, controldevice_joystick);
} }
for (i=0; i<MAXJOYAXES; i++) for (i=0; i<MAXJOYAXES; i++)
{ {
CONTROL_MapAnalogAxis(i, ud.config.JoystickAnalogueAxes[i], controldevice_joystick); CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][0], 0, controldevice_joystick); CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][1], 1, controldevice_joystick); CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
CONTROL_SetAnalogAxisScale(i, ud.config.JoystickAnalogueScale[i], controldevice_joystick); CONTROL_SetAnalogAxisScale(i, JoystickAnalogueScale[i], controldevice_joystick);
CONTROL_SetAnalogAxisInvert(i, ud.config.JoystickAnalogueInvert[i], controldevice_joystick); CONTROL_SetAnalogAxisInvert(i, JoystickAnalogueInvert[i], controldevice_joystick);
} }
} }
@ -777,43 +743,43 @@ void CONFIG_WriteSetup(uint32_t flags)
{ {
for (int i=0; i<MAXMOUSEBUTTONS; i++) for (int i=0; i<MAXMOUSEBUTTONS; i++)
{ {
if (CONFIG_FunctionNumToName(ud.config.MouseFunctions[i][0])) if (CONFIG_FunctionNumToName(MouseFunctions[i][0]))
{ {
Bsprintf(buf, "MouseButton%d", i); Bsprintf(buf, "MouseButton%d", i);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseFunctions[i][0])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseFunctions[i][0]));
} }
if (i >= (MAXMOUSEBUTTONS-2)) continue; if (i >= (MAXMOUSEBUTTONS-2)) continue;
if (CONFIG_FunctionNumToName(ud.config.MouseFunctions[i][1])) if (CONFIG_FunctionNumToName(MouseFunctions[i][1]))
{ {
Bsprintf(buf, "MouseButtonClicked%d", i); Bsprintf(buf, "MouseButtonClicked%d", i);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseFunctions[i][1])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseFunctions[i][1]));
} }
} }
for (int i=0; i<MAXMOUSEAXES; i++) for (int i=0; i<MAXMOUSEAXES; i++)
{ {
if (CONFIG_AnalogNumToName(ud.config.MouseAnalogueAxes[i])) if (CONFIG_AnalogNumToName(MouseAnalogueAxes[i]))
{ {
Bsprintf(buf, "MouseAnalogAxes%d", i); Bsprintf(buf, "MouseAnalogAxes%d", i);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(ud.config.MouseAnalogueAxes[i])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(MouseAnalogueAxes[i]));
} }
if (CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[i][0])) if (CONFIG_FunctionNumToName(MouseDigitalFunctions[i][0]))
{ {
Bsprintf(buf, "MouseDigitalAxes%d_0", i); Bsprintf(buf, "MouseDigitalAxes%d_0", i);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[i][0])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseDigitalFunctions[i][0]));
} }
if (CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[i][1])) if (CONFIG_FunctionNumToName(MouseDigitalFunctions[i][1]))
{ {
Bsprintf(buf, "MouseDigitalAxes%d_1", i); Bsprintf(buf, "MouseDigitalAxes%d_1", i);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[i][1])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseDigitalFunctions[i][1]));
} }
Bsprintf(buf, "MouseAnalogScale%d", i); Bsprintf(buf, "MouseAnalogScale%d", i);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.MouseAnalogueScale[i], FALSE, FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, MouseAnalogueScale[i], FALSE, FALSE);
} }
} }
@ -821,49 +787,49 @@ void CONFIG_WriteSetup(uint32_t flags)
{ {
for (int dummy=0; dummy<MAXJOYBUTTONSANDHATS; dummy++) for (int dummy=0; dummy<MAXJOYBUTTONSANDHATS; dummy++)
{ {
if (CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][0])) if (CONFIG_FunctionNumToName(JoystickFunctions[dummy][0]))
{ {
Bsprintf(buf, "ControllerButton%d", dummy); Bsprintf(buf, "ControllerButton%d", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][0])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickFunctions[dummy][0]));
} }
if (CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][1])) if (CONFIG_FunctionNumToName(JoystickFunctions[dummy][1]))
{ {
Bsprintf(buf, "ControllerButtonClicked%d", dummy); Bsprintf(buf, "ControllerButtonClicked%d", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][1])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickFunctions[dummy][1]));
} }
} }
for (int dummy=0; dummy<MAXJOYAXES; dummy++) for (int dummy=0; dummy<MAXJOYAXES; dummy++)
{ {
if (CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[dummy])) if (CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]))
{ {
Bsprintf(buf, "ControllerAnalogAxes%d", dummy); Bsprintf(buf, "ControllerAnalogAxes%d", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[dummy])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]));
} }
if (CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[dummy][0])) if (CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][0]))
{ {
Bsprintf(buf, "ControllerDigitalAxes%d_0", dummy); Bsprintf(buf, "ControllerDigitalAxes%d_0", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[dummy][0])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][0]));
} }
if (CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[dummy][1])) if (CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][1]))
{ {
Bsprintf(buf, "ControllerDigitalAxes%d_1", dummy); Bsprintf(buf, "ControllerDigitalAxes%d_1", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[dummy][1])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][1]));
} }
Bsprintf(buf, "ControllerAnalogScale%d", dummy); Bsprintf(buf, "ControllerAnalogScale%d", dummy);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueScale[dummy], FALSE, FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, JoystickAnalogueScale[dummy], FALSE, FALSE);
Bsprintf(buf, "ControllerAnalogInvert%d", dummy); Bsprintf(buf, "ControllerAnalogInvert%d", dummy);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueInvert[dummy], FALSE, FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, JoystickAnalogueInvert[dummy], FALSE, FALSE);
Bsprintf(buf, "ControllerAnalogDead%d", dummy); Bsprintf(buf, "ControllerAnalogDead%d", dummy);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueDead[dummy], FALSE, FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, JoystickAnalogueDead[dummy], FALSE, FALSE);
Bsprintf(buf, "ControllerAnalogSaturate%d", dummy); Bsprintf(buf, "ControllerAnalogSaturate%d", dummy);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueSaturate[dummy], FALSE, FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, JoystickAnalogueSaturate[dummy], FALSE, FALSE);
} }
} }
@ -900,12 +866,12 @@ char const * CONFIG_GetGameFuncOnMouse(int gameFunc)
{ {
for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j)
for (int i = 0; i < joystick.numButtons; ++i) for (int i = 0; i < joystick.numButtons; ++i)
if (ud.config.JoystickFunctions[i][j] == gameFunc) if (JoystickFunctions[i][j] == gameFunc)
return joyGetName(1, i); return joyGetName(1, i);
for (int i = 0; i < joystick.numAxes; ++i) for (int i = 0; i < joystick.numAxes; ++i)
for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j)
if (ud.config.JoystickDigitalFunctions[i][j] == gameFunc) if (JoystickDigitalFunctions[i][j] == gameFunc)
return joyGetName(0, i); return joyGetName(0, i);
return ""; return "";
@ -915,12 +881,12 @@ char const * CONFIG_GetGameFuncOnJoystick(int gameFunc)
{ {
for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j)
for (int i = 0; i < joystick.numButtons; ++i) for (int i = 0; i < joystick.numButtons; ++i)
if (ud.config.JoystickFunctions[i][j] == gameFunc) if (JoystickFunctions[i][j] == gameFunc)
return joyGetName(1, i); return joyGetName(1, i);
for (int i = 0; i < joystick.numAxes; ++i) for (int i = 0; i < joystick.numAxes; ++i)
for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j)
if (ud.config.JoystickDigitalFunctions[i][j] == gameFunc) if (JoystickDigitalFunctions[i][j] == gameFunc)
return joyGetName(0, i); return joyGetName(0, i);
return ""; return "";

View file

@ -41,8 +41,6 @@ void CONFIG_SetGameControllerDefaultsClear(void);
int32_t CONFIG_GetMapBestTime(char const *mapname, uint8_t const *mapmd4); int32_t CONFIG_GetMapBestTime(char const *mapname, uint8_t const *mapmd4);
int CONFIG_SetMapBestTime(uint8_t const *mapmd4, int32_t tm); int CONFIG_SetMapBestTime(uint8_t const *mapmd4, int32_t tm);
int32_t CONFIG_AnalogNameToNum(const char *func);
const char * CONFIG_GetGameFuncOnKeyboard(int gameFunc); const char * CONFIG_GetGameFuncOnKeyboard(int gameFunc);
const char * CONFIG_GetGameFuncOnJoystick(int gameFunc); const char * CONFIG_GetGameFuncOnJoystick(int gameFunc);

View file

@ -6513,7 +6513,7 @@ int app_main(int argc, const char * const*argv)
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too // JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
for (int i=0; i<joystick.numAxes; i++) for (int i=0; i<joystick.numAxes; i++)
joySetDeadZone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]); joySetDeadZone(i,JoystickAnalogueDead[i],JoystickAnalogueSaturate[i]);
} }
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE

View file

@ -34,18 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// config file name // config file name
#define SETUPFILENAME APPBASENAME ".cfg" #define SETUPFILENAME APPBASENAME ".cfg"
// KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp
#define MAXJOYBUTTONS 32
#define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4)
// KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp
#define MAXMOUSEAXES 2
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
// KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp
#define MAXJOYAXES 9
#define MAXJOYDIGITAL (MAXJOYAXES*2)
// default mouse scale // default mouse scale
#define DEFAULTMOUSEANALOGUESCALE 65536 #define DEFAULTMOUSEANALOGUESCALE 65536

View file

@ -887,9 +887,9 @@ static MenuEntry_t ME_MOUSESETUP_SMOOTH = MAKE_MENUENTRY( "Filter input:", &MF_R
static MenuLink_t MEO_MOUSESETUP_ADVANCED = { MENU_MOUSEADVANCED, MA_Advance, }; static MenuLink_t MEO_MOUSESETUP_ADVANCED = { MENU_MOUSEADVANCED, MA_Advance, };
static MenuEntry_t ME_MOUSESETUP_ADVANCED = MAKE_MENUENTRY( "Advanced setup", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSESETUP_ADVANCED, Link ); static MenuEntry_t ME_MOUSESETUP_ADVANCED = MAKE_MENUENTRY( "Advanced setup", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSESETUP_ADVANCED, Link );
#endif #endif
static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEX = MAKE_MENURANGE(&ud.config.MouseAnalogueScale[0], &MF_Redfont, -262144, 262144, 65536, 161, 3); static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEX = MAKE_MENURANGE(&MouseAnalogueScale[0], &MF_Redfont, -262144, 262144, 65536, 161, 3);
static MenuEntry_t ME_MOUSEADVANCED_SCALEX = MAKE_MENUENTRY("X-Scale:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSEADVANCED_SCALEX, RangeInt32); static MenuEntry_t ME_MOUSEADVANCED_SCALEX = MAKE_MENUENTRY("X-Scale:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSEADVANCED_SCALEX, RangeInt32);
static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEY = MAKE_MENURANGE(&ud.config.MouseAnalogueScale[1], &MF_Redfont, -262144, 262144, 65536, 161, 3); static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEY = MAKE_MENURANGE(&MouseAnalogueScale[1], &MF_Redfont, -262144, 262144, 65536, 161, 3);
static MenuEntry_t ME_MOUSEADVANCED_SCALEY = MAKE_MENUENTRY("Y-Scale:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSEADVANCED_SCALEY, RangeInt32); static MenuEntry_t ME_MOUSEADVANCED_SCALEY = MAKE_MENUENTRY("Y-Scale:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSEADVANCED_SCALEY, RangeInt32);
static MenuEntry_t *MEL_MOUSESETUP[] = { static MenuEntry_t *MEL_MOUSESETUP[] = {
@ -1868,7 +1868,7 @@ void Menu_Init(void)
ME_MOUSESETUPBTNS[i].name = MenuMouseNames[i]; ME_MOUSESETUPBTNS[i].name = MenuMouseNames[i];
ME_MOUSESETUPBTNS[i].entry = &MEO_MOUSESETUPBTNS[i]; ME_MOUSESETUPBTNS[i].entry = &MEO_MOUSESETUPBTNS[i];
MEO_MOUSESETUPBTNS[i] = MEO_MOUSEJOYSETUPBTNS_TEMPLATE; MEO_MOUSESETUPBTNS[i] = MEO_MOUSEJOYSETUPBTNS_TEMPLATE;
MEO_MOUSESETUPBTNS[i].data = &ud.config.MouseFunctions[MenuMouseDataIndex[i][0]][MenuMouseDataIndex[i][1]]; MEO_MOUSESETUPBTNS[i].data = &MouseFunctions[MenuMouseDataIndex[i][0]][MenuMouseDataIndex[i][1]];
} }
for (i = 0; i < 2*joystick.numButtons + 8*joystick.numHats; ++i) for (i = 0; i < 2*joystick.numButtons + 8*joystick.numHats; ++i)
{ {
@ -1889,7 +1889,7 @@ void Menu_Init(void)
ME_JOYSTICKBTNS[i].name = MenuJoystickNames[i]; ME_JOYSTICKBTNS[i].name = MenuJoystickNames[i];
ME_JOYSTICKBTNS[i].entry = &MEO_JOYSTICKBTNS[i]; ME_JOYSTICKBTNS[i].entry = &MEO_JOYSTICKBTNS[i];
MEO_JOYSTICKBTNS[i] = MEO_MOUSEJOYSETUPBTNS_TEMPLATE; MEO_JOYSTICKBTNS[i] = MEO_MOUSEJOYSETUPBTNS_TEMPLATE;
MEO_JOYSTICKBTNS[i].data = &ud.config.JoystickFunctions[i>>1][i&1]; MEO_JOYSTICKBTNS[i].data = &JoystickFunctions[i>>1][i&1];
} }
M_JOYSTICKBTNS.numEntries = 2*joystick.numButtons + 8*joystick.numHats; M_JOYSTICKBTNS.numEntries = 2*joystick.numButtons + 8*joystick.numHats;
for (i = 0; i < joystick.numAxes; ++i) for (i = 0; i < joystick.numAxes; ++i)
@ -3157,13 +3157,13 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
case MENU_JOYSTICKAXES: case MENU_JOYSTICKAXES:
M_JOYSTICKAXIS.title = joyGetName(0, M_JOYSTICKAXES.currentEntry); M_JOYSTICKAXIS.title = joyGetName(0, M_JOYSTICKAXES.currentEntry);
MEO_JOYSTICKAXIS_ANALOG.data = &ud.config.JoystickAnalogueAxes[M_JOYSTICKAXES.currentEntry]; MEO_JOYSTICKAXIS_ANALOG.data = &JoystickAnalogueAxes[M_JOYSTICKAXES.currentEntry];
MEO_JOYSTICKAXIS_SCALE.variable = &ud.config.JoystickAnalogueScale[M_JOYSTICKAXES.currentEntry]; MEO_JOYSTICKAXIS_SCALE.variable = &JoystickAnalogueScale[M_JOYSTICKAXES.currentEntry];
MEO_JOYSTICKAXIS_INVERT.data = &ud.config.JoystickAnalogueInvert[M_JOYSTICKAXES.currentEntry]; MEO_JOYSTICKAXIS_INVERT.data = &JoystickAnalogueInvert[M_JOYSTICKAXES.currentEntry];
MEO_JOYSTICKAXIS_DEAD.variable = &ud.config.JoystickAnalogueDead[M_JOYSTICKAXES.currentEntry]; MEO_JOYSTICKAXIS_DEAD.variable = &JoystickAnalogueDead[M_JOYSTICKAXES.currentEntry];
MEO_JOYSTICKAXIS_SATU.variable = &ud.config.JoystickAnalogueSaturate[M_JOYSTICKAXES.currentEntry]; MEO_JOYSTICKAXIS_SATU.variable = &JoystickAnalogueSaturate[M_JOYSTICKAXES.currentEntry];
MEO_JOYSTICKAXIS_DIGITALNEGATIVE.data = &ud.config.JoystickDigitalFunctions[M_JOYSTICKAXES.currentEntry][0]; MEO_JOYSTICKAXIS_DIGITALNEGATIVE.data = &JoystickDigitalFunctions[M_JOYSTICKAXES.currentEntry][0];
MEO_JOYSTICKAXIS_DIGITALPOSITIVE.data = &ud.config.JoystickDigitalFunctions[M_JOYSTICKAXES.currentEntry][1]; MEO_JOYSTICKAXIS_DIGITALPOSITIVE.data = &JoystickDigitalFunctions[M_JOYSTICKAXES.currentEntry][1];
break; break;
case MENU_CHEATS: case MENU_CHEATS:

View file

@ -42,48 +42,6 @@ BEGIN_RR_NS
int32_t CONFIG_AnalogNameToNum(const char *func)
{
if (!func)
return -1;
if (!Bstrcasecmp(func,"analog_turning"))
{
return analog_turning;
}
if (!Bstrcasecmp(func,"analog_strafing"))
{
return analog_strafing;
}
if (!Bstrcasecmp(func,"analog_moving"))
{
return analog_moving;
}
if (!Bstrcasecmp(func,"analog_lookingupanddown"))
{
return analog_lookingupanddown;
}
return -1;
}
const char *CONFIG_AnalogNumToName(int32_t func)
{
switch (func)
{
case analog_turning:
return "analog_turning";
case analog_strafing:
return "analog_strafing";
case analog_moving:
return "analog_moving";
case analog_lookingupanddown:
return "analog_lookingupanddown";
}
return NULL;
}
@ -210,54 +168,54 @@ void CONFIG_SetDefaults(void)
// JBF 20031211 // JBF 20031211
memset(ud.config.MouseFunctions, -1, sizeof(ud.config.MouseFunctions)); memset(MouseFunctions, -1, sizeof(MouseFunctions));
for (i=0; i<MAXMOUSEBUTTONS; i++) for (i=0; i<MAXMOUSEBUTTONS; i++)
{ {
ud.config.MouseFunctions[i][0] = CONFIG_FunctionNameToNum(mousedefaults[i]); MouseFunctions[i][0] = CONFIG_FunctionNameToNum(mousedefaults[i]);
CONTROL_MapButton(ud.config.MouseFunctions[i][0], i, 0, controldevice_mouse); CONTROL_MapButton(MouseFunctions[i][0], i, 0, controldevice_mouse);
if (i>=4) continue; if (i>=4) continue;
ud.config.MouseFunctions[i][1] = CONFIG_FunctionNameToNum(mouseclickeddefaults[i]); MouseFunctions[i][1] = CONFIG_FunctionNameToNum(mouseclickeddefaults[i]);
CONTROL_MapButton(ud.config.MouseFunctions[i][1], i, 1, controldevice_mouse); CONTROL_MapButton(MouseFunctions[i][1], i, 1, controldevice_mouse);
} }
memset(ud.config.MouseDigitalFunctions, -1, sizeof(ud.config.MouseDigitalFunctions)); memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions));
for (i=0; i<MAXMOUSEAXES; i++) for (i=0; i<MAXMOUSEAXES; i++)
{ {
ud.config.MouseAnalogueScale[i] = DEFAULTMOUSEANALOGUESCALE; MouseAnalogueScale[i] = DEFAULTMOUSEANALOGUESCALE;
CONTROL_SetAnalogAxisScale(i, ud.config.MouseAnalogueScale[i], controldevice_mouse); CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse);
ud.config.MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2]); MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2]);
ud.config.MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2+1]); MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2+1]);
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][0], 0, controldevice_mouse); CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0, controldevice_mouse);
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][1], 1, controldevice_mouse); CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1, controldevice_mouse);
ud.config.MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]); MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]);
CONTROL_MapAnalogAxis(i, ud.config.MouseAnalogueAxes[i], controldevice_mouse); CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
} }
memset(ud.config.JoystickFunctions, -1, sizeof(ud.config.JoystickFunctions)); memset(JoystickFunctions, -1, sizeof(JoystickFunctions));
for (i=0; i<MAXJOYBUTTONSANDHATS; i++) for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
{ {
ud.config.JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdefaults[i]); JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdefaults[i]);
ud.config.JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(joystickclickeddefaults[i]); JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(joystickclickeddefaults[i]);
CONTROL_MapButton(ud.config.JoystickFunctions[i][0], i, 0, controldevice_joystick); CONTROL_MapButton(JoystickFunctions[i][0], i, 0, controldevice_joystick);
CONTROL_MapButton(ud.config.JoystickFunctions[i][1], i, 1, controldevice_joystick); CONTROL_MapButton(JoystickFunctions[i][1], i, 1, controldevice_joystick);
} }
memset(ud.config.JoystickDigitalFunctions, -1, sizeof(ud.config.JoystickDigitalFunctions)); memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions));
for (i=0; i<MAXJOYAXES; i++) for (i=0; i<MAXJOYAXES; i++)
{ {
ud.config.JoystickAnalogueScale[i] = DEFAULTJOYSTICKANALOGUESCALE; JoystickAnalogueScale[i] = DEFAULTJOYSTICKANALOGUESCALE;
ud.config.JoystickAnalogueDead[i] = DEFAULTJOYSTICKANALOGUEDEAD; JoystickAnalogueDead[i] = DEFAULTJOYSTICKANALOGUEDEAD;
ud.config.JoystickAnalogueSaturate[i] = DEFAULTJOYSTICKANALOGUESATURATE; JoystickAnalogueSaturate[i] = DEFAULTJOYSTICKANALOGUESATURATE;
CONTROL_SetAnalogAxisScale(i, ud.config.JoystickAnalogueScale[i], controldevice_joystick); CONTROL_SetAnalogAxisScale(i, JoystickAnalogueScale[i], controldevice_joystick);
ud.config.JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2]); JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2]);
ud.config.JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2+1]); JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2+1]);
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][0], 0, controldevice_joystick); CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][1], 1, controldevice_joystick); CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
ud.config.JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(joystickanalogdefaults[i]); JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(joystickanalogdefaults[i]);
CONTROL_MapAnalogAxis(i, ud.config.JoystickAnalogueAxes[i], controldevice_joystick); CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
} }
} }
@ -275,12 +233,12 @@ void CONFIG_SetupMouse(void)
Bsprintf(str,"MouseButton%d",i); Bsprintf(str,"MouseButton%d",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
ud.config.MouseFunctions[i][0] = CONFIG_FunctionNameToNum(temp); MouseFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"MouseButtonClicked%d",i); Bsprintf(str,"MouseButtonClicked%d",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
ud.config.MouseFunctions[i][1] = CONFIG_FunctionNameToNum(temp); MouseFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
} }
// map over the axes // map over the axes
@ -290,24 +248,24 @@ void CONFIG_SetupMouse(void)
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
if (CONFIG_AnalogNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1)) if (CONFIG_AnalogNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
ud.config.MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp); MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
Bsprintf(str,"MouseDigitalAxes%d_0",i); Bsprintf(str,"MouseDigitalAxes%d_0",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1)) if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
ud.config.MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp); MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"MouseDigitalAxes%d_1",i); Bsprintf(str,"MouseDigitalAxes%d_1",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1)) if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
ud.config.MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp); MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"MouseAnalogScale%d",i); Bsprintf(str,"MouseAnalogScale%d",i);
scale = ud.config.MouseAnalogueScale[i]; scale = MouseAnalogueScale[i];
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale); SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
ud.config.MouseAnalogueScale[i] = scale; MouseAnalogueScale[i] = scale;
} }
{ {
@ -318,15 +276,15 @@ void CONFIG_SetupMouse(void)
for (i=0; i<MAXMOUSEBUTTONS; i++) for (i=0; i<MAXMOUSEBUTTONS; i++)
{ {
CONTROL_MapButton(ud.config.MouseFunctions[i][0], i, 0, controldevice_mouse); CONTROL_MapButton(MouseFunctions[i][0], i, 0, controldevice_mouse);
CONTROL_MapButton(ud.config.MouseFunctions[i][1], i, 1, controldevice_mouse); CONTROL_MapButton(MouseFunctions[i][1], i, 1, controldevice_mouse);
} }
for (i=0; i<MAXMOUSEAXES; i++) for (i=0; i<MAXMOUSEAXES; i++)
{ {
CONTROL_MapAnalogAxis(i, ud.config.MouseAnalogueAxes[i], controldevice_mouse); CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][0], 0,controldevice_mouse); CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0,controldevice_mouse);
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][1], 1,controldevice_mouse); CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1,controldevice_mouse);
CONTROL_SetAnalogAxisScale(i, ud.config.MouseAnalogueScale[i], controldevice_mouse); CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse);
} }
} }
@ -345,12 +303,12 @@ void CONFIG_SetupJoystick(void)
Bsprintf(str,"JoystickButton%d",i); Bsprintf(str,"JoystickButton%d",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
ud.config.JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(temp); JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"JoystickButtonClicked%d",i); Bsprintf(str,"JoystickButtonClicked%d",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
ud.config.JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(temp); JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
} }
// map over the axes // map over the axes
@ -360,47 +318,47 @@ void CONFIG_SetupJoystick(void)
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
if (CONFIG_AnalogNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1)) if (CONFIG_AnalogNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
ud.config.JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp); JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
Bsprintf(str,"JoystickDigitalAxes%d_0",i); Bsprintf(str,"JoystickDigitalAxes%d_0",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1)) if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
ud.config.JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp); JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"JoystickDigitalAxes%d_1",i); Bsprintf(str,"JoystickDigitalAxes%d_1",i);
temp[0] = 0; temp[0] = 0;
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1)) if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
ud.config.JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp); JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"JoystickAnalogScale%d",i); Bsprintf(str,"JoystickAnalogScale%d",i);
scale = ud.config.JoystickAnalogueScale[i]; scale = JoystickAnalogueScale[i];
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale); SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
ud.config.JoystickAnalogueScale[i] = scale; JoystickAnalogueScale[i] = scale;
Bsprintf(str,"JoystickAnalogDead%d",i); Bsprintf(str,"JoystickAnalogDead%d",i);
scale = ud.config.JoystickAnalogueDead[i]; scale = JoystickAnalogueDead[i];
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale); SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
ud.config.JoystickAnalogueDead[i] = scale; JoystickAnalogueDead[i] = scale;
Bsprintf(str,"JoystickAnalogSaturate%d",i); Bsprintf(str,"JoystickAnalogSaturate%d",i);
scale = ud.config.JoystickAnalogueSaturate[i]; scale = JoystickAnalogueSaturate[i];
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale); SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
ud.config.JoystickAnalogueSaturate[i] = scale; JoystickAnalogueSaturate[i] = scale;
} }
for (i=0; i<MAXJOYBUTTONSANDHATS; i++) for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
{ {
CONTROL_MapButton(ud.config.JoystickFunctions[i][0], i, 0, controldevice_joystick); CONTROL_MapButton(JoystickFunctions[i][0], i, 0, controldevice_joystick);
CONTROL_MapButton(ud.config.JoystickFunctions[i][1], i, 1, controldevice_joystick); CONTROL_MapButton(JoystickFunctions[i][1], i, 1, controldevice_joystick);
} }
for (i=0; i<MAXJOYAXES; i++) for (i=0; i<MAXJOYAXES; i++)
{ {
CONTROL_MapAnalogAxis(i, ud.config.JoystickAnalogueAxes[i], controldevice_joystick); CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][0], 0, controldevice_joystick); CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][1], 1, controldevice_joystick); CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
CONTROL_SetAnalogAxisScale(i, ud.config.JoystickAnalogueScale[i], controldevice_joystick); CONTROL_SetAnalogAxisScale(i, JoystickAnalogueScale[i], controldevice_joystick);
} }
} }
@ -587,45 +545,45 @@ void CONFIG_WriteSetup(uint32_t flags)
{ {
for (dummy=0; dummy<MAXMOUSEBUTTONS; dummy++) for (dummy=0; dummy<MAXMOUSEBUTTONS; dummy++)
{ {
if (CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][0])) if (CONFIG_FunctionNumToName(MouseFunctions[dummy][0]))
{ {
Bsprintf(buf, "MouseButton%d", dummy); Bsprintf(buf, "MouseButton%d", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][0])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseFunctions[dummy][0]));
} }
if (dummy >= (MAXMOUSEBUTTONS-2)) continue; if (dummy >= (MAXMOUSEBUTTONS-2)) continue;
if (CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][1])) if (CONFIG_FunctionNumToName(MouseFunctions[dummy][1]))
{ {
Bsprintf(buf, "MouseButtonClicked%d", dummy); Bsprintf(buf, "MouseButtonClicked%d", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][1])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseFunctions[dummy][1]));
} }
} }
for (dummy=0; dummy<MAXMOUSEAXES; dummy++) for (dummy=0; dummy<MAXMOUSEAXES; dummy++)
{ {
if (CONFIG_AnalogNumToName(ud.config.MouseAnalogueAxes[dummy])) if (CONFIG_AnalogNumToName(MouseAnalogueAxes[dummy]))
{ {
Bsprintf(buf, "MouseAnalogAxes%d", dummy); Bsprintf(buf, "MouseAnalogAxes%d", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(ud.config.MouseAnalogueAxes[dummy])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(MouseAnalogueAxes[dummy]));
} }
if (CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[dummy][0])) if (CONFIG_FunctionNumToName(MouseDigitalFunctions[dummy][0]))
{ {
Bsprintf(buf, "MouseDigitalAxes%d_0", dummy); Bsprintf(buf, "MouseDigitalAxes%d_0", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[dummy][0])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseDigitalFunctions[dummy][0]));
} }
if (CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[dummy][1])) if (CONFIG_FunctionNumToName(MouseDigitalFunctions[dummy][1]))
{ {
Bsprintf(buf, "MouseDigitalAxes%d_1", dummy); Bsprintf(buf, "MouseDigitalAxes%d_1", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[dummy][1])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseDigitalFunctions[dummy][1]));
} }
if (ud.config.MouseAnalogueScale[dummy] != DEFAULTMOUSEANALOGUESCALE) if (MouseAnalogueScale[dummy] != DEFAULTMOUSEANALOGUESCALE)
{ {
Bsprintf(buf, "MouseAnalogScale%d", dummy); Bsprintf(buf, "MouseAnalogScale%d", dummy);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.MouseAnalogueScale[dummy], FALSE, FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, MouseAnalogueScale[dummy], FALSE, FALSE);
} }
} }
} }
@ -634,54 +592,54 @@ void CONFIG_WriteSetup(uint32_t flags)
{ {
for (dummy=0; dummy<MAXJOYBUTTONSANDHATS; dummy++) for (dummy=0; dummy<MAXJOYBUTTONSANDHATS; dummy++)
{ {
if (CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][0])) if (CONFIG_FunctionNumToName(JoystickFunctions[dummy][0]))
{ {
Bsprintf(buf, "JoystickButton%d", dummy); Bsprintf(buf, "JoystickButton%d", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][0])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickFunctions[dummy][0]));
} }
if (CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][1])) if (CONFIG_FunctionNumToName(JoystickFunctions[dummy][1]))
{ {
Bsprintf(buf, "JoystickButtonClicked%d", dummy); Bsprintf(buf, "JoystickButtonClicked%d", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][1])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickFunctions[dummy][1]));
} }
} }
for (dummy=0; dummy<MAXJOYAXES; dummy++) for (dummy=0; dummy<MAXJOYAXES; dummy++)
{ {
if (CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[dummy])) if (CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]))
{ {
Bsprintf(buf, "JoystickAnalogAxes%d", dummy); Bsprintf(buf, "JoystickAnalogAxes%d", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[dummy])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]));
} }
if (CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[dummy][0])) if (CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][0]))
{ {
Bsprintf(buf, "JoystickDigitalAxes%d_0", dummy); Bsprintf(buf, "JoystickDigitalAxes%d_0", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[dummy][0])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][0]));
} }
if (CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[dummy][1])) if (CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][1]))
{ {
Bsprintf(buf, "JoystickDigitalAxes%d_1", dummy); Bsprintf(buf, "JoystickDigitalAxes%d_1", dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[dummy][1])); SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][1]));
} }
if (ud.config.JoystickAnalogueScale[dummy] != DEFAULTJOYSTICKANALOGUESCALE) if (JoystickAnalogueScale[dummy] != DEFAULTJOYSTICKANALOGUESCALE)
{ {
Bsprintf(buf, "JoystickAnalogScale%d", dummy); Bsprintf(buf, "JoystickAnalogScale%d", dummy);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueScale[dummy], FALSE, FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, JoystickAnalogueScale[dummy], FALSE, FALSE);
} }
if (ud.config.JoystickAnalogueDead[dummy] != DEFAULTJOYSTICKANALOGUEDEAD) if (JoystickAnalogueDead[dummy] != DEFAULTJOYSTICKANALOGUEDEAD)
{ {
Bsprintf(buf, "JoystickAnalogDead%d", dummy); Bsprintf(buf, "JoystickAnalogDead%d", dummy);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueDead[dummy], FALSE, FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, JoystickAnalogueDead[dummy], FALSE, FALSE);
} }
if (ud.config.JoystickAnalogueSaturate[dummy] != DEFAULTJOYSTICKANALOGUESATURATE) if (JoystickAnalogueSaturate[dummy] != DEFAULTJOYSTICKANALOGUESATURATE)
{ {
Bsprintf(buf, "JoystickAnalogSaturate%d", dummy); Bsprintf(buf, "JoystickAnalogSaturate%d", dummy);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueSaturate[dummy], FALSE, FALSE); SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, JoystickAnalogueSaturate[dummy], FALSE, FALSE);
} }
} }
} }

View file

@ -38,8 +38,6 @@ void CONFIG_SetupJoystick( void );
int32_t CONFIG_GetMapBestTime(char const * mapname, uint8_t const * mapmd4); int32_t CONFIG_GetMapBestTime(char const * mapname, uint8_t const * mapmd4);
int32_t CONFIG_SetMapBestTime(uint8_t const * mapmd4, int32_t tm); int32_t CONFIG_SetMapBestTime(uint8_t const * mapmd4, int32_t tm);
int32_t CONFIG_AnalogNameToNum(const char *func);
const char *CONFIG_AnalogNumToName(int32_t func);
void CONFIG_SetDefaults(void); void CONFIG_SetDefaults(void);
END_RR_NS END_RR_NS

View file

@ -7894,7 +7894,7 @@ int app_main(int argc, char const * const * argv)
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too // JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
for (bssize_t i=0; i<joystick.numAxes; i++) for (bssize_t i=0; i<joystick.numAxes; i++)
joySetDeadZone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]); joySetDeadZone(i,JoystickAnalogueDead[i],JoystickAnalogueSaturate[i]);
} }
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE

View file

@ -194,19 +194,6 @@ typedef struct {
int32_t AutoAim; int32_t AutoAim;
int32_t ShowOpponentWeapons; int32_t ShowOpponentWeapons;
// JBF 20031211: Store the input settings because
// (currently) mact can't regurgitate them
int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
int32_t MouseAnalogueAxes[MAXMOUSEAXES];
int32_t MouseAnalogueScale[MAXMOUSEAXES];
int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2];
int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
int32_t JoystickAnalogueAxes[MAXJOYAXES];
int32_t JoystickAnalogueScale[MAXJOYAXES];
int32_t JoystickAnalogueDead[MAXJOYAXES];
int32_t JoystickAnalogueSaturate[MAXJOYAXES];
int32_t scripthandle; int32_t scripthandle;
int32_t setupread; int32_t setupread;

View file

@ -41,10 +41,6 @@ BEGIN_RR_NS
#define MAXJOYBUTTONS 32 #define MAXJOYBUTTONS 32
#define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4) #define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4)
// KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp
#define MAXMOUSEAXES 2
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
// KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp // KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp
#define MAXJOYAXES 9 #define MAXJOYAXES 9
#define MAXJOYDIGITAL (MAXJOYAXES*2) #define MAXJOYDIGITAL (MAXJOYAXES*2)

View file

@ -841,9 +841,9 @@ static MenuEntry_t ME_MOUSESETUP_SMOOTH = MAKE_MENUENTRY( "Filter input:", &MF_R
static MenuLink_t MEO_MOUSESETUP_ADVANCED = { MENU_MOUSEADVANCED, MA_Advance, }; static MenuLink_t MEO_MOUSESETUP_ADVANCED = { MENU_MOUSEADVANCED, MA_Advance, };
static MenuEntry_t ME_MOUSESETUP_ADVANCED = MAKE_MENUENTRY( "Advanced setup", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSESETUP_ADVANCED, Link ); static MenuEntry_t ME_MOUSESETUP_ADVANCED = MAKE_MENUENTRY( "Advanced setup", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSESETUP_ADVANCED, Link );
#endif #endif
static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEX = MAKE_MENURANGE(&ud.config.MouseAnalogueScale[0], &MF_Redfont, -262144, 262144, 65536, 161, 3); static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEX = MAKE_MENURANGE(&MouseAnalogueScale[0], &MF_Redfont, -262144, 262144, 65536, 161, 3);
static MenuEntry_t ME_MOUSEADVANCED_SCALEX = MAKE_MENUENTRY("X-Scale:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSEADVANCED_SCALEX, RangeInt32); static MenuEntry_t ME_MOUSEADVANCED_SCALEX = MAKE_MENUENTRY("X-Scale:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSEADVANCED_SCALEX, RangeInt32);
static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEY = MAKE_MENURANGE(&ud.config.MouseAnalogueScale[1], &MF_Redfont, -262144, 262144, 65536, 161, 3); static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEY = MAKE_MENURANGE(&MouseAnalogueScale[1], &MF_Redfont, -262144, 262144, 65536, 161, 3);
static MenuEntry_t ME_MOUSEADVANCED_SCALEY = MAKE_MENUENTRY("Y-Scale:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSEADVANCED_SCALEY, RangeInt32); static MenuEntry_t ME_MOUSEADVANCED_SCALEY = MAKE_MENUENTRY("Y-Scale:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSEADVANCED_SCALEY, RangeInt32);
static MenuEntry_t *MEL_MOUSESETUP[] = { static MenuEntry_t *MEL_MOUSESETUP[] = {
@ -923,13 +923,13 @@ 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 MenuOption_t MEO_MOUSEADVANCED_DAXES_UP = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_Gamefuncs, &MouseDigitalFunctions[1][0] );
static MenuEntry_t ME_MOUSEADVANCED_DAXES_UP = MAKE_MENUENTRY( "Digital Up", &MF_Redfont, &MEF_BigSliders, &MEO_MOUSEADVANCED_DAXES_UP, Option ); 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 MenuOption_t MEO_MOUSEADVANCED_DAXES_DOWN = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_Gamefuncs, &MouseDigitalFunctions[1][1] );
static MenuEntry_t ME_MOUSEADVANCED_DAXES_DOWN = MAKE_MENUENTRY( "Digital Down", &MF_Redfont, &MEF_BigSliders, &MEO_MOUSEADVANCED_DAXES_DOWN, Option ); 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 MenuOption_t MEO_MOUSEADVANCED_DAXES_LEFT = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_Gamefuncs, &MouseDigitalFunctions[0][0] );
static MenuEntry_t ME_MOUSEADVANCED_DAXES_LEFT = MAKE_MENUENTRY( "Digital Left", &MF_Redfont, &MEF_BigSliders, &MEO_MOUSEADVANCED_DAXES_LEFT, Option ); 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 MenuOption_t MEO_MOUSEADVANCED_DAXES_RIGHT = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_Gamefuncs, &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 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[] = {
@ -1763,7 +1763,7 @@ void Menu_Init(void)
ME_MOUSESETUPBTNS[i].name = MenuMouseNames[i]; ME_MOUSESETUPBTNS[i].name = MenuMouseNames[i];
ME_MOUSESETUPBTNS[i].entry = &MEO_MOUSESETUPBTNS[i]; ME_MOUSESETUPBTNS[i].entry = &MEO_MOUSESETUPBTNS[i];
MEO_MOUSESETUPBTNS[i] = MEO_MOUSEJOYSETUPBTNS_TEMPLATE; MEO_MOUSESETUPBTNS[i] = MEO_MOUSEJOYSETUPBTNS_TEMPLATE;
MEO_MOUSESETUPBTNS[i].data = &ud.config.MouseFunctions[MenuMouseDataIndex[i][0]][MenuMouseDataIndex[i][1]]; MEO_MOUSESETUPBTNS[i].data = &MouseFunctions[MenuMouseDataIndex[i][0]][MenuMouseDataIndex[i][1]];
} }
for (i = 0; i < 2*joystick.numButtons + 8*joystick.numHats; ++i) for (i = 0; i < 2*joystick.numButtons + 8*joystick.numHats; ++i)
{ {
@ -1784,7 +1784,7 @@ void Menu_Init(void)
ME_JOYSTICKBTNS[i].name = MenuJoystickNames[i]; ME_JOYSTICKBTNS[i].name = MenuJoystickNames[i];
ME_JOYSTICKBTNS[i].entry = &MEO_JOYSTICKBTNS[i]; ME_JOYSTICKBTNS[i].entry = &MEO_JOYSTICKBTNS[i];
MEO_JOYSTICKBTNS[i] = MEO_MOUSEJOYSETUPBTNS_TEMPLATE; MEO_JOYSTICKBTNS[i] = MEO_MOUSEJOYSETUPBTNS_TEMPLATE;
MEO_JOYSTICKBTNS[i].data = &ud.config.JoystickFunctions[i>>1][i&1]; MEO_JOYSTICKBTNS[i].data = &JoystickFunctions[i>>1][i&1];
} }
M_JOYSTICKBTNS.numEntries = 2*joystick.numButtons + 8*joystick.numHats; M_JOYSTICKBTNS.numEntries = 2*joystick.numButtons + 8*joystick.numHats;
for (i = 0; i < joystick.numAxes; ++i) for (i = 0; i < joystick.numAxes; ++i)
@ -3544,12 +3544,12 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
case MENU_JOYSTICKAXES: case MENU_JOYSTICKAXES:
M_JOYSTICKAXIS.title = joyGetName(0, M_JOYSTICKAXES.currentEntry); M_JOYSTICKAXIS.title = joyGetName(0, M_JOYSTICKAXES.currentEntry);
MEO_JOYSTICKAXIS_ANALOG.data = &ud.config.JoystickAnalogueAxes[M_JOYSTICKAXES.currentEntry]; MEO_JOYSTICKAXIS_ANALOG.data = &JoystickAnalogueAxes[M_JOYSTICKAXES.currentEntry];
MEO_JOYSTICKAXIS_SCALE.variable = &ud.config.JoystickAnalogueScale[M_JOYSTICKAXES.currentEntry]; MEO_JOYSTICKAXIS_SCALE.variable = &JoystickAnalogueScale[M_JOYSTICKAXES.currentEntry];
MEO_JOYSTICKAXIS_DEAD.variable = &ud.config.JoystickAnalogueDead[M_JOYSTICKAXES.currentEntry]; MEO_JOYSTICKAXIS_DEAD.variable = &JoystickAnalogueDead[M_JOYSTICKAXES.currentEntry];
MEO_JOYSTICKAXIS_SATU.variable = &ud.config.JoystickAnalogueSaturate[M_JOYSTICKAXES.currentEntry]; MEO_JOYSTICKAXIS_SATU.variable = &JoystickAnalogueSaturate[M_JOYSTICKAXES.currentEntry];
MEO_JOYSTICKAXIS_DIGITALNEGATIVE.data = &ud.config.JoystickDigitalFunctions[M_JOYSTICKAXES.currentEntry][0]; MEO_JOYSTICKAXIS_DIGITALNEGATIVE.data = &JoystickDigitalFunctions[M_JOYSTICKAXES.currentEntry][0];
MEO_JOYSTICKAXIS_DIGITALPOSITIVE.data = &ud.config.JoystickDigitalFunctions[M_JOYSTICKAXES.currentEntry][1]; MEO_JOYSTICKAXIS_DIGITALPOSITIVE.data = &JoystickDigitalFunctions[M_JOYSTICKAXES.currentEntry][1];
break; break;
case MENU_CHEATS: case MENU_CHEATS:

View file

@ -100,51 +100,6 @@ static int32_t scripthandle = -1;
/*
===================
=
= CONFIG_AnalogNameToNum
=
===================
*/
int32_t CONFIG_AnalogNameToNum(const char *func)
{
if (!Bstrcasecmp(func,"analog_turning"))
{
return analog_turning;
}
if (!Bstrcasecmp(func,"analog_strafing"))
{
return analog_strafing;
}
if (!Bstrcasecmp(func,"analog_moving"))
{
return analog_moving;
}
if (!Bstrcasecmp(func,"analog_lookingupanddown"))
{
return analog_lookingupanddown;
}
return -1;
}
const char *CONFIG_AnalogNumToName(int32_t func)
{
switch (func)
{
case analog_turning:
return "analog_turning";
case analog_strafing:
return "analog_strafing";
case analog_moving:
return "analog_moving";
case analog_lookingupanddown:
return "analog_lookingupanddown";
default: break;
}
return NULL;
}
/* /*
=================== ===================

View file

@ -112,8 +112,6 @@ void CONFIG_WriteSetup(void);
void WriteCommitFile(int32_t gametype); void WriteCommitFile(int32_t gametype);
void CONFIG_GetSetupFilename(void); void CONFIG_GetSetupFilename(void);
const char *CONFIG_AnalogNumToName(int32_t func);
int32_t CONFIG_AnalogNameToNum(const char *func);
END_SW_NS END_SW_NS
#endif #endif

View file

@ -55,17 +55,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
//#define MAXPLAYERS 8 //#define MAXPLAYERS 8
//#endif //#endif
// Number of Mouse buttons
//#define MAXMOUSEBUTTONS 6
// Number of JOY buttons
#define MAXJOYBUTTONS (32+4)
// Number of EXTERNAL buttons
//#define MAXEXTERNALBUTTONS 6
// max path+track length for waveform music files // max path+track length for waveform music files
#define MAXWAVEFORMTRACKLENGTH 256 #define MAXWAVEFORMTRACKLENGTH 256
@ -118,16 +107,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
// Number of Mouse Axes // Number of Mouse Axes
#define MAXMOUSEAXES 2
// Number of JOY axes
#define MAXJOYAXES 6
// Number of GAMEPAD axes
#define MAXGAMEPADAXES 2
#ifdef __FLAT__ #ifdef __FLAT__
#define CONTROLSHIFT 0 #define CONTROLSHIFT 0
#else #else
@ -153,10 +132,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#define MOUSECONTROLBASE ((1<<(15-CONTROLSHIFT))-1) #define MOUSECONTROLBASE ((1<<(15-CONTROLSHIFT))-1)
// DEFAULT mouse sensitivity scale
#define DEFAULTMOUSESENSITIVITY (1<<(15-CONTROLSHIFT))
enum enum
{ {
gametype_network=3, gametype_network=3,