mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- consolidated the joystick and mouse setup code.
This commit is contained in:
parent
b2d7179dbe
commit
249f6e9d62
21 changed files with 778 additions and 2002 deletions
|
@ -38,102 +38,6 @@ BEGIN_BLD_NS
|
|||
|
||||
#ifdef __SETUP__
|
||||
|
||||
static const char * mousedefaults[MAXMOUSEBUTTONS] =
|
||||
{
|
||||
"Weapon_Fire",
|
||||
"Weapon_Special_Fire",
|
||||
"",
|
||||
"",
|
||||
"Previous_Weapon",
|
||||
"Next_Weapon",
|
||||
};
|
||||
|
||||
|
||||
static const char * mouseclickeddefaults[MAXMOUSEBUTTONS] =
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
static const char * mouseanalogdefaults[MAXMOUSEAXES] =
|
||||
{
|
||||
"analog_turning",
|
||||
"analog_moving",
|
||||
};
|
||||
|
||||
|
||||
static const char * mousedigitaldefaults[MAXMOUSEDIGITAL] =
|
||||
{
|
||||
};
|
||||
|
||||
static const char * joystickdefaults[MAXJOYBUTTONSANDHATS] =
|
||||
{
|
||||
"Fire",
|
||||
"Strafe",
|
||||
"Run",
|
||||
"Open",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Aim_Down",
|
||||
"Look_Right",
|
||||
"Aim_Up",
|
||||
"Look_Left",
|
||||
};
|
||||
|
||||
|
||||
static const char * joystickclickeddefaults[MAXJOYBUTTONSANDHATS] =
|
||||
{
|
||||
"",
|
||||
"Inventory",
|
||||
"Jump",
|
||||
"Crouch",
|
||||
};
|
||||
|
||||
|
||||
static const char * joystickanalogdefaults[MAXJOYAXES] =
|
||||
{
|
||||
"analog_turning",
|
||||
"analog_moving",
|
||||
"analog_strafing",
|
||||
};
|
||||
|
||||
|
||||
static const char * joystickdigitaldefaults[MAXJOYDIGITAL] =
|
||||
{
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Run",
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -201,195 +201,11 @@ void CONFIG_SetDefaults(void)
|
|||
Bstrcpy(CommbatMacro[8], "Amateurs!");
|
||||
Bstrcpy(CommbatMacro[9], "Fool! You are already dead.");
|
||||
|
||||
memset(MouseFunctions, -1, sizeof(MouseFunctions));
|
||||
memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions));
|
||||
memset(JoystickFunctions, -1, sizeof(JoystickFunctions));
|
||||
memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions));
|
||||
for (int i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
MouseFunctions[i][0] = CONFIG_FunctionNameToNum(mousedefaults[i]);
|
||||
CONTROL_MapButton(MouseFunctions[i][0], i, 0, controldevice_mouse);
|
||||
if (i>=4) continue;
|
||||
MouseFunctions[i][1] = CONFIG_FunctionNameToNum(mouseclickeddefaults[i]);
|
||||
CONTROL_MapButton(MouseFunctions[i][1], i, 1, controldevice_mouse);
|
||||
}
|
||||
|
||||
for (int i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
MouseAnalogueScale[i] = DEFAULTMOUSEANALOGUESCALE;
|
||||
CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse);
|
||||
|
||||
MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2]);
|
||||
MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2+1]);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0, controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1, controldevice_mouse);
|
||||
|
||||
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]);
|
||||
CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
|
||||
}
|
||||
|
||||
for (int i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdefaults[i]);
|
||||
JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(joystickclickeddefaults[i]);
|
||||
CONTROL_MapButton(JoystickFunctions[i][0], i, 0, controldevice_joystick);
|
||||
CONTROL_MapButton(JoystickFunctions[i][1], i, 1, controldevice_joystick);
|
||||
}
|
||||
|
||||
for (int i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
JoystickAnalogueScale[i] = DEFAULTJOYSTICKANALOGUESCALE;
|
||||
JoystickAnalogueDead[i] = DEFAULTJOYSTICKANALOGUEDEAD;
|
||||
JoystickAnalogueSaturate[i] = DEFAULTJOYSTICKANALOGUESATURATE;
|
||||
CONTROL_SetAnalogAxisScale(i, JoystickAnalogueScale[i], controldevice_joystick);
|
||||
|
||||
JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2]);
|
||||
JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2+1]);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
|
||||
|
||||
JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(joystickanalogdefaults[i]);
|
||||
CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CONFIG_SetupMouse(void)
|
||||
{
|
||||
if (scripthandle < 0)
|
||||
return;
|
||||
|
||||
char str[80];
|
||||
char temp[80];
|
||||
|
||||
for (int i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
Bsprintf(str,"MouseButton%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle,"Controls", str,temp))
|
||||
MouseFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseButtonClicked%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle,"Controls", str,temp))
|
||||
MouseFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
}
|
||||
|
||||
// map over the axes
|
||||
for (int i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
Bsprintf(str,"MouseAnalogAxes%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_AnalogNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseDigitalAxes%d_0",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseDigitalAxes%d_1",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseAnalogScale%d",i);
|
||||
int32_t scale = MouseAnalogueScale[i];
|
||||
SCRIPT_GetNumber(scripthandle, "Controls", str, &scale);
|
||||
MouseAnalogueScale[i] = scale;
|
||||
}
|
||||
|
||||
for (int i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
CONTROL_MapButton(MouseFunctions[i][0], i, 0, controldevice_mouse);
|
||||
CONTROL_MapButton(MouseFunctions[i][1], i, 1, controldevice_mouse);
|
||||
}
|
||||
for (int i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0,controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1,controldevice_mouse);
|
||||
CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_SetupJoystick(void)
|
||||
{
|
||||
int32_t i;
|
||||
char str[80];
|
||||
char temp[80];
|
||||
int32_t scale;
|
||||
|
||||
if (scripthandle < 0) return;
|
||||
|
||||
for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
Bsprintf(str,"JoystickButton%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle,"Controls", str,temp))
|
||||
JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickButtonClicked%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle,"Controls", str,temp))
|
||||
JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
}
|
||||
|
||||
// map over the axes
|
||||
for (i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
Bsprintf(str,"JoystickAnalogAxes%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_AnalogNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickDigitalAxes%d_0",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickDigitalAxes%d_1",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickAnalogScale%d",i);
|
||||
scale = JoystickAnalogueScale[i];
|
||||
SCRIPT_GetNumber(scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogueScale[i] = scale;
|
||||
|
||||
Bsprintf(str,"JoystickAnalogDead%d",i);
|
||||
scale = JoystickAnalogueDead[i];
|
||||
SCRIPT_GetNumber(scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogueDead[i] = scale;
|
||||
|
||||
Bsprintf(str,"JoystickAnalogSaturate%d",i);
|
||||
scale = JoystickAnalogueSaturate[i];
|
||||
SCRIPT_GetNumber(scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogueSaturate[i] = scale;
|
||||
}
|
||||
|
||||
for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
CONTROL_MapButton(JoystickFunctions[i][0], i, 0, controldevice_joystick);
|
||||
CONTROL_MapButton(JoystickFunctions[i][1], i, 1, controldevice_joystick);
|
||||
}
|
||||
for (i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
|
||||
CONTROL_SetAnalogAxisScale(i, JoystickAnalogueScale[i], controldevice_joystick);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int CONFIG_ReadSetup(void)
|
||||
|
@ -516,190 +332,6 @@ void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.
|
|||
{
|
||||
}
|
||||
|
||||
void CONFIG_WriteSetup(uint32_t flags)
|
||||
{
|
||||
#if 0
|
||||
char buf[128];
|
||||
if (!setupread) return;
|
||||
|
||||
if (scripthandle < 0)
|
||||
scripthandle = SCRIPT_Init(SetupFilename);
|
||||
|
||||
//SCRIPT_PutNumber(scripthandle, "Misc", "Executions", ud.executions, FALSE, FALSE);
|
||||
|
||||
SCRIPT_PutNumber(scripthandle, "Setup", "ConfigVersion", BYTEVERSION, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Setup", "ForceSetup", gSetup.forcesetup, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Setup", "NoAutoLoad", gSetup.noautoload, FALSE, FALSE);
|
||||
|
||||
#ifdef POLYMER
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "Polymer", glrendmode == REND_POLYMER, FALSE, FALSE);
|
||||
#endif
|
||||
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "ScreenBPP", gSetup.bpp, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "ScreenHeight", gSetup.ydim, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "ScreenMode", gSetup.fullscreen, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "ScreenWidth", gSetup.xdim, FALSE, FALSE);
|
||||
|
||||
//if (g_grpNamePtr && !g_addonNum)
|
||||
// SCRIPT_PutString(scripthandle, "Setup", "SelectedGRP", g_grpNamePtr);
|
||||
|
||||
#ifdef STARTUP_SETUP_WINDOW
|
||||
if (gNoSetup == 0)
|
||||
SCRIPT_PutString(scripthandle, "Setup", "ModDir", &g_modDir[0]);
|
||||
#endif
|
||||
// exit early after only updating the values that can be changed from the startup window
|
||||
if (flags & 1)
|
||||
{
|
||||
SCRIPT_Save(scripthandle, SetupFilename);
|
||||
SCRIPT_Free(scripthandle);
|
||||
return;
|
||||
}
|
||||
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "MaxRefreshFreq", maxrefreshfreq, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "WindowPosX", windowx, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "WindowPosY", windowy, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Screen Setup", "WindowPositioning", windowpos, FALSE, FALSE);
|
||||
|
||||
//if (!NAM_WW2GI)
|
||||
//{
|
||||
// SCRIPT_PutNumber(scripthandle, "Screen Setup", "Out",ud.lockout,FALSE,FALSE);
|
||||
// SCRIPT_PutString(scripthandle, "Screen Setup", "Password",ud.pwlockout);
|
||||
//}
|
||||
|
||||
#ifdef _WIN32
|
||||
SCRIPT_PutNumber(scripthandle, "Updates", "CheckForUpdates", CheckForUpdates, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Updates", "LastUpdateCheck", LastUpdateCheck, FALSE, FALSE);
|
||||
#endif
|
||||
|
||||
if (in_mouse)
|
||||
{
|
||||
for (int i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
if (CONFIG_FunctionNumToName(MouseFunctions[i][0]))
|
||||
{
|
||||
Bsprintf(buf, "MouseButton%d", i);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseFunctions[i][0]));
|
||||
}
|
||||
|
||||
if (i >= (MAXMOUSEBUTTONS-2)) continue;
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseFunctions[i][1]))
|
||||
{
|
||||
Bsprintf(buf, "MouseButtonClicked%d", i);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseFunctions[i][1]));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
if (CONFIG_AnalogNumToName(MouseAnalogueAxes[i]))
|
||||
{
|
||||
Bsprintf(buf, "MouseAnalogAxes%d", i);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_AnalogNumToName(MouseAnalogueAxes[i]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseDigitalFunctions[i][0]))
|
||||
{
|
||||
Bsprintf(buf, "MouseDigitalAxes%d_0", i);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseDigitalFunctions[i][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseDigitalFunctions[i][1]))
|
||||
{
|
||||
Bsprintf(buf, "MouseDigitalAxes%d_1", i);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseDigitalFunctions[i][1]));
|
||||
}
|
||||
|
||||
if (MouseAnalogueScale[i] != DEFAULTMOUSEANALOGUESCALE)
|
||||
{
|
||||
Bsprintf(buf, "MouseAnalogScale%d", i);
|
||||
SCRIPT_PutNumber(scripthandle, "Controls", buf, MouseAnalogueScale[i], FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (in_joystick)
|
||||
{
|
||||
for (int dummy=0; dummy<MAXJOYBUTTONSANDHATS; dummy++)
|
||||
{
|
||||
if (CONFIG_FunctionNumToName(JoystickFunctions[dummy][0]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickButton%d", dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickFunctions[dummy][1]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickButtonClicked%d", dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickFunctions[dummy][1]));
|
||||
}
|
||||
}
|
||||
for (int dummy=0; dummy<MAXJOYAXES; dummy++)
|
||||
{
|
||||
if (CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickAnalogAxes%d", dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][0]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickDigitalAxes%d_0", dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][1]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickDigitalAxes%d_1", dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][1]));
|
||||
}
|
||||
|
||||
if (JoystickAnalogueScale[dummy] != DEFAULTJOYSTICKANALOGUESCALE)
|
||||
{
|
||||
Bsprintf(buf, "JoystickAnalogScale%d", dummy);
|
||||
SCRIPT_PutNumber(scripthandle, "Controls", buf, JoystickAnalogueScale[dummy], FALSE, FALSE);
|
||||
}
|
||||
|
||||
if (JoystickAnalogueDead[dummy] != DEFAULTJOYSTICKANALOGUEDEAD)
|
||||
{
|
||||
Bsprintf(buf, "JoystickAnalogDead%d", dummy);
|
||||
SCRIPT_PutNumber(scripthandle, "Controls", buf, JoystickAnalogueDead[dummy], FALSE, FALSE);
|
||||
}
|
||||
|
||||
if (JoystickAnalogueSaturate[dummy] != DEFAULTJOYSTICKANALOGUESATURATE)
|
||||
{
|
||||
Bsprintf(buf, "JoystickAnalogSaturate%d", dummy);
|
||||
SCRIPT_PutNumber(scripthandle, "Controls", buf, JoystickAnalogueSaturate[dummy], FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SCRIPT_PutString(scripthandle, "Comm Setup","PlayerName",&szPlayerName[0]);
|
||||
|
||||
//SCRIPT_PutString(scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
|
||||
|
||||
char commmacro[] = "CommbatMacro# ";
|
||||
|
||||
for (int dummy = 0; dummy < MAXRIDECULE; dummy++)
|
||||
{
|
||||
commmacro[13] = dummy+'0';
|
||||
SCRIPT_PutString(scripthandle, "Comm Setup",commmacro,&CommbatMacro[dummy][0]);
|
||||
}
|
||||
|
||||
///////
|
||||
SCRIPT_PutNumber(scripthandle, "Game Options", "WeaponsV10x", gWeaponsV10x, FALSE, FALSE);
|
||||
///////
|
||||
|
||||
SCRIPT_Save(scripthandle, SetupFilename);
|
||||
|
||||
if ((flags & 2) == 0)
|
||||
SCRIPT_Free(scripthandle);
|
||||
|
||||
OSD_Printf("Wrote %s\n",SetupFilename);
|
||||
CONFIG_WriteSettings();
|
||||
Bfflush(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -68,10 +68,7 @@ extern int gWeaponsV10x;
|
|||
//////
|
||||
|
||||
int CONFIG_ReadSetup(void);
|
||||
void CONFIG_WriteSetup(uint32_t flags);
|
||||
void CONFIG_SetDefaults(void);
|
||||
void CONFIG_SetupMouse(void);
|
||||
void CONFIG_SetupJoystick(void);
|
||||
|
||||
int32_t CONFIG_GetMapBestTime(char const *mapname, uint8_t const *mapmd4);
|
||||
int CONFIG_SetMapBestTime(uint8_t const *mapmd4, int32_t tm);
|
||||
|
|
|
@ -37,14 +37,6 @@ BEGIN_BLD_NS
|
|||
// config file name
|
||||
#define SETUPFILENAME APPBASENAME ".cfg"
|
||||
|
||||
// default mouse scale
|
||||
#define DEFAULTMOUSEANALOGUESCALE 65536
|
||||
|
||||
// default joystick settings
|
||||
|
||||
#define DEFAULTJOYSTICKANALOGUESCALE 65536
|
||||
#define DEFAULTJOYSTICKANALOGUEDEAD 1000
|
||||
#define DEFAULTJOYSTICKANALOGUESATURATE 9500
|
||||
|
||||
END_BLD_NS
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "keyboard.h"
|
||||
#include "control.h"
|
||||
#include "osd.h"
|
||||
#include "gamecontrol.h"
|
||||
|
||||
#define GAMENAME "Demolition"
|
||||
#define LASTRUNVERSION "1"
|
||||
|
@ -544,6 +545,7 @@ void G_SaveConfig()
|
|||
{
|
||||
GameConfig->ArchiveGlobalData();
|
||||
GameConfig->ArchiveGameData(GameName);
|
||||
CONFIG_WriteControllerSettings();
|
||||
GameConfig->WriteConfigFile();
|
||||
delete GameConfig;
|
||||
GameConfig = nullptr;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "sc_man.h"
|
||||
#include "c_cvars.h"
|
||||
#include "gameconfigfile.h"
|
||||
#include "gamecvars.h"
|
||||
#include "build.h"
|
||||
|
||||
struct GameFuncNameDesc
|
||||
|
@ -172,6 +173,8 @@ void CONFIG_Init()
|
|||
SetupButtonFunctions();
|
||||
CONTROL_ClearAssignments();
|
||||
CONFIG_SetDefaultKeys(cl_defaultconfiguration == 1 ? "demolition/origbinds.txt" : cl_defaultconfiguration == 2 ? "demolition/leftbinds.txt" : "demolition/defbinds.txt");
|
||||
CONFIG_InitMouseAndController();
|
||||
CONFIG_SetGameControllerDefaultsStandard();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -355,6 +358,103 @@ int32_t JoystickAnalogueDead[MAXJOYAXES];
|
|||
int32_t JoystickAnalogueSaturate[MAXJOYAXES];
|
||||
int32_t JoystickAnalogueInvert[MAXJOYAXES];
|
||||
|
||||
static const char* mousedefaults[MAXMOUSEBUTTONS] =
|
||||
{
|
||||
"Weapon_Fire",
|
||||
"Weapon_Special_Fire",
|
||||
"",
|
||||
"",
|
||||
"Previous_Weapon",
|
||||
"Next_Weapon",
|
||||
};
|
||||
|
||||
|
||||
static const char* mouseclickeddefaults[MAXMOUSEBUTTONS] =
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
static const char* mouseanalogdefaults[MAXMOUSEAXES] =
|
||||
{
|
||||
"analog_turning",
|
||||
"analog_moving",
|
||||
};
|
||||
|
||||
|
||||
static const char* mousedigitaldefaults[MAXMOUSEDIGITAL] =
|
||||
{
|
||||
};
|
||||
|
||||
static const char* joystickdefaults[MAXJOYBUTTONSANDHATS] =
|
||||
{
|
||||
"Fire",
|
||||
"Strafe",
|
||||
"Run",
|
||||
"Open",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Aim_Down",
|
||||
"Look_Right",
|
||||
"Aim_Up",
|
||||
"Look_Left",
|
||||
};
|
||||
|
||||
|
||||
static const char* joystickclickeddefaults[MAXJOYBUTTONSANDHATS] =
|
||||
{
|
||||
"",
|
||||
"Inventory",
|
||||
"Jump",
|
||||
"Crouch",
|
||||
};
|
||||
|
||||
|
||||
static const char* joystickanalogdefaults[MAXJOYAXES] =
|
||||
{
|
||||
"analog_turning",
|
||||
"analog_moving",
|
||||
"analog_strafing",
|
||||
};
|
||||
|
||||
|
||||
static const char* joystickdigitaldefaults[MAXJOYDIGITAL] =
|
||||
{
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Run",
|
||||
};
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -410,3 +510,604 @@ const char* CONFIG_AnalogNumToName(int32_t func)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void CONFIG_SetupMouse(void)
|
||||
{
|
||||
const char* val;
|
||||
FString section = currentGame + ".MouseSettings";
|
||||
if (!GameConfig->SetSection(section)) return;
|
||||
|
||||
for (int i = 0; i < MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
section.Format("MouseButton%d", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
MouseFunctions[i][0] = CONFIG_FunctionNameToNum(val);
|
||||
|
||||
section.Format("MouseButtonClicked%d", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
MouseFunctions[i][1] = CONFIG_FunctionNameToNum(val);
|
||||
}
|
||||
|
||||
// map over the axes
|
||||
for (int i = 0; i < MAXMOUSEAXES; i++)
|
||||
{
|
||||
section.Format("MouseAnalogAxes%d", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(val);
|
||||
|
||||
section.Format("MouseDigitalAxes%d_0", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(val);
|
||||
|
||||
section.Format("MouseDigitalAxes%d_1", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(val);
|
||||
|
||||
section.Format("MouseAnalogScale%d", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
MouseAnalogueScale[i] = (int32_t)strtoull(val, nullptr, 0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
CONTROL_MapButton(MouseFunctions[i][0], i, 0, controldevice_mouse);
|
||||
CONTROL_MapButton(MouseFunctions[i][1], i, 1, controldevice_mouse);
|
||||
}
|
||||
for (int i = 0; i < MAXMOUSEAXES; i++)
|
||||
{
|
||||
CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0, controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1, controldevice_mouse);
|
||||
CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_SetupJoystick(void)
|
||||
{
|
||||
const char* val;
|
||||
FString section = currentGame + ".ControllerSettings";
|
||||
if (!GameConfig->SetSection(section)) return;
|
||||
|
||||
for (int i = 0; i < MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
section.Format("ControllerButton%d", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(val);
|
||||
|
||||
section.Format("ControllerButtonClicked%d", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(val);
|
||||
}
|
||||
|
||||
// map over the axes
|
||||
for (int i = 0; i < MAXJOYAXES; i++)
|
||||
{
|
||||
section.Format("ControllerAnalogAxes%d", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(val);
|
||||
|
||||
section.Format("ControllerDigitalAxes%d_0", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(val);
|
||||
|
||||
section.Format("ControllerDigitalAxes%d_1", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(val);
|
||||
|
||||
section.Format("ControllerAnalogScale%d", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
JoystickAnalogueScale[i] = (int32_t)strtoull(val, nullptr, 0);
|
||||
|
||||
section.Format("ControllerAnalogInvert%d", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
JoystickAnalogueInvert[i] = (int32_t)strtoull(val, nullptr, 0);
|
||||
|
||||
section.Format("ControllerAnalogDead%d", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
JoystickAnalogueDead[i] = (int32_t)strtoull(val, nullptr, 0);
|
||||
|
||||
section.Format("ControllerAnalogSaturate%d", i);
|
||||
val = GameConfig->GetValueForKey(section);
|
||||
if (val)
|
||||
JoystickAnalogueSaturate[i] = (int32_t)strtoull(val, nullptr, 0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
CONTROL_MapButton(JoystickFunctions[i][0], i, 0, controldevice_joystick);
|
||||
CONTROL_MapButton(JoystickFunctions[i][1], i, 1, controldevice_joystick);
|
||||
}
|
||||
for (int i = 0; i < MAXJOYAXES; i++)
|
||||
{
|
||||
CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
|
||||
CONTROL_SetAnalogAxisScale(i, JoystickAnalogueScale[i], controldevice_joystick);
|
||||
CONTROL_SetAnalogAxisInvert(i, JoystickAnalogueInvert[i], controldevice_joystick);
|
||||
}
|
||||
}
|
||||
|
||||
static void CONFIG_SetJoystickButtonFunction(int i, int j, int function)
|
||||
{
|
||||
JoystickFunctions[i][j] = function;
|
||||
CONTROL_MapButton(function, i, j, controldevice_joystick);
|
||||
}
|
||||
static void CONFIG_SetJoystickAnalogAxisScale(int i, int scale)
|
||||
{
|
||||
JoystickAnalogueScale[i] = scale;
|
||||
CONTROL_SetAnalogAxisScale(i, scale, controldevice_joystick);
|
||||
}
|
||||
static void CONFIG_SetJoystickAnalogAxisInvert(int i, int invert)
|
||||
{
|
||||
JoystickAnalogueInvert[i] = invert;
|
||||
CONTROL_SetAnalogAxisInvert(i, invert, controldevice_joystick);
|
||||
}
|
||||
static void CONFIG_SetJoystickAnalogAxisDeadSaturate(int i, int dead, int saturate)
|
||||
{
|
||||
JoystickAnalogueDead[i] = dead;
|
||||
JoystickAnalogueSaturate[i] = saturate;
|
||||
joySetDeadZone(i, dead, saturate);
|
||||
}
|
||||
static void CONFIG_SetJoystickDigitalAxisFunction(int i, int j, int function)
|
||||
{
|
||||
JoystickDigitalFunctions[i][j] = function;
|
||||
CONTROL_MapDigitalAxis(i, function, j, controldevice_joystick);
|
||||
}
|
||||
static void CONFIG_SetJoystickAnalogAxisFunction(int i, int function)
|
||||
{
|
||||
JoystickAnalogueAxes[i] = function;
|
||||
CONTROL_MapAnalogAxis(i, function, controldevice_joystick);
|
||||
}
|
||||
|
||||
struct GameControllerButtonSetting
|
||||
{
|
||||
GameControllerButton button;
|
||||
int function;
|
||||
|
||||
void apply() const
|
||||
{
|
||||
CONFIG_SetJoystickButtonFunction(button, 0, function);
|
||||
}
|
||||
};
|
||||
struct GameControllerAnalogAxisSetting
|
||||
{
|
||||
GameControllerAxis axis;
|
||||
int function;
|
||||
|
||||
void apply() const
|
||||
{
|
||||
CONFIG_SetJoystickAnalogAxisFunction(axis, function);
|
||||
}
|
||||
};
|
||||
struct GameControllerDigitalAxisSetting
|
||||
{
|
||||
GameControllerAxis axis;
|
||||
int polarity;
|
||||
int function;
|
||||
|
||||
void apply() const
|
||||
{
|
||||
CONFIG_SetJoystickDigitalAxisFunction(axis, polarity, function);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void CONFIG_SetGameControllerDefaultsClear()
|
||||
{
|
||||
for (int i = 0; i < MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
CONFIG_SetJoystickButtonFunction(i, 0, -1);
|
||||
CONFIG_SetJoystickButtonFunction(i, 1, -1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXJOYAXES; i++)
|
||||
{
|
||||
CONFIG_SetJoystickAnalogAxisScale(i, DEFAULTJOYSTICKANALOGUESCALE);
|
||||
CONFIG_SetJoystickAnalogAxisInvert(i, 0);
|
||||
CONFIG_SetJoystickAnalogAxisDeadSaturate(i, DEFAULTJOYSTICKANALOGUEDEAD, DEFAULTJOYSTICKANALOGUESATURATE);
|
||||
|
||||
CONFIG_SetJoystickDigitalAxisFunction(i, 0, -1);
|
||||
CONFIG_SetJoystickDigitalAxisFunction(i, 1, -1);
|
||||
|
||||
CONFIG_SetJoystickAnalogAxisFunction(i, -1);
|
||||
}
|
||||
}
|
||||
|
||||
static void CONFIG_SetGameControllerAxesModern()
|
||||
{
|
||||
static GameControllerAnalogAxisSetting const analogAxes[] =
|
||||
{
|
||||
{ GAMECONTROLLER_AXIS_LEFTX, analog_strafing },
|
||||
{ GAMECONTROLLER_AXIS_LEFTY, analog_moving },
|
||||
{ GAMECONTROLLER_AXIS_RIGHTX, analog_turning },
|
||||
{ GAMECONTROLLER_AXIS_RIGHTY, analog_lookingupanddown },
|
||||
};
|
||||
|
||||
CONFIG_SetJoystickAnalogAxisScale(GAMECONTROLLER_AXIS_RIGHTX, 32768 + 16384);
|
||||
CONFIG_SetJoystickAnalogAxisScale(GAMECONTROLLER_AXIS_RIGHTY, 32768 + 16384);
|
||||
|
||||
for (auto const& analogAxis : analogAxes)
|
||||
analogAxis.apply();
|
||||
}
|
||||
|
||||
void CONFIG_SetGameControllerDefaultsStandard()
|
||||
{
|
||||
CONFIG_SetGameControllerDefaultsClear();
|
||||
CONFIG_SetGameControllerAxesModern();
|
||||
|
||||
static GameControllerButtonSetting const buttons[] =
|
||||
{
|
||||
{ GAMECONTROLLER_BUTTON_A, gamefunc_Jump },
|
||||
{ GAMECONTROLLER_BUTTON_B, gamefunc_Toggle_Crouch },
|
||||
{ GAMECONTROLLER_BUTTON_BACK, gamefunc_Map },
|
||||
{ GAMECONTROLLER_BUTTON_LEFTSTICK, gamefunc_Run },
|
||||
{ GAMECONTROLLER_BUTTON_RIGHTSTICK, gamefunc_Quick_Kick },
|
||||
{ GAMECONTROLLER_BUTTON_LEFTSHOULDER, gamefunc_Crouch },
|
||||
{ GAMECONTROLLER_BUTTON_RIGHTSHOULDER, gamefunc_Jump },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_UP, gamefunc_Previous_Weapon },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_DOWN, gamefunc_Next_Weapon },
|
||||
};
|
||||
|
||||
static GameControllerButtonSetting const buttonsDuke[] =
|
||||
{
|
||||
{ GAMECONTROLLER_BUTTON_X, gamefunc_Open },
|
||||
{ GAMECONTROLLER_BUTTON_Y, gamefunc_Inventory },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_LEFT, gamefunc_Inventory_Left },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_RIGHT, gamefunc_Inventory_Right },
|
||||
};
|
||||
|
||||
static GameControllerButtonSetting const buttonsFury[] =
|
||||
{
|
||||
{ GAMECONTROLLER_BUTTON_X, gamefunc_Steroids }, // Reload
|
||||
{ GAMECONTROLLER_BUTTON_Y, gamefunc_Open },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_LEFT, gamefunc_MedKit },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_RIGHT, gamefunc_NightVision }, // Radar
|
||||
};
|
||||
|
||||
static GameControllerDigitalAxisSetting const digitalAxes[] =
|
||||
{
|
||||
{ GAMECONTROLLER_AXIS_TRIGGERLEFT, 1, gamefunc_Alt_Fire },
|
||||
{ GAMECONTROLLER_AXIS_TRIGGERRIGHT, 1, gamefunc_Fire },
|
||||
};
|
||||
|
||||
for (auto const& button : buttons)
|
||||
button.apply();
|
||||
|
||||
/*
|
||||
if (FURY)
|
||||
{
|
||||
for (auto const& button : buttonsFury)
|
||||
button.apply();
|
||||
}
|
||||
else
|
||||
*/
|
||||
{
|
||||
for (auto const& button : buttonsDuke)
|
||||
button.apply();
|
||||
}
|
||||
|
||||
for (auto const& digitalAxis : digitalAxes)
|
||||
digitalAxis.apply();
|
||||
}
|
||||
|
||||
void CONFIG_SetGameControllerDefaultsPro()
|
||||
{
|
||||
CONFIG_SetGameControllerDefaultsClear();
|
||||
CONFIG_SetGameControllerAxesModern();
|
||||
|
||||
static GameControllerButtonSetting const buttons[] =
|
||||
{
|
||||
{ GAMECONTROLLER_BUTTON_A, gamefunc_Open },
|
||||
{ GAMECONTROLLER_BUTTON_B, gamefunc_Third_Person_View },
|
||||
{ GAMECONTROLLER_BUTTON_Y, gamefunc_Quick_Kick },
|
||||
{ GAMECONTROLLER_BUTTON_BACK, gamefunc_Map },
|
||||
{ GAMECONTROLLER_BUTTON_LEFTSTICK, gamefunc_Run },
|
||||
{ GAMECONTROLLER_BUTTON_RIGHTSTICK, gamefunc_Crouch },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_UP, gamefunc_Previous_Weapon },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_DOWN, gamefunc_Next_Weapon },
|
||||
};
|
||||
|
||||
static GameControllerButtonSetting const buttonsDuke[] =
|
||||
{
|
||||
{ GAMECONTROLLER_BUTTON_X, gamefunc_Inventory },
|
||||
{ GAMECONTROLLER_BUTTON_LEFTSHOULDER, gamefunc_Previous_Weapon },
|
||||
{ GAMECONTROLLER_BUTTON_RIGHTSHOULDER, gamefunc_Next_Weapon },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_LEFT, gamefunc_Inventory_Left },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_RIGHT, gamefunc_Inventory_Right },
|
||||
};
|
||||
|
||||
static GameControllerButtonSetting const buttonsFury[] =
|
||||
{
|
||||
{ GAMECONTROLLER_BUTTON_X, gamefunc_Steroids }, // Reload
|
||||
{ GAMECONTROLLER_BUTTON_LEFTSHOULDER, gamefunc_Crouch },
|
||||
{ GAMECONTROLLER_BUTTON_RIGHTSHOULDER, gamefunc_Alt_Fire },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_LEFT, gamefunc_MedKit },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_RIGHT, gamefunc_NightVision }, // Radar
|
||||
};
|
||||
|
||||
static GameControllerDigitalAxisSetting const digitalAxes[] =
|
||||
{
|
||||
{ GAMECONTROLLER_AXIS_TRIGGERLEFT, 1, gamefunc_Jump },
|
||||
{ GAMECONTROLLER_AXIS_TRIGGERRIGHT, 1, gamefunc_Fire },
|
||||
};
|
||||
|
||||
for (auto const& button : buttons)
|
||||
button.apply();
|
||||
|
||||
#if 0 // ouch...
|
||||
if (FURY)
|
||||
{
|
||||
for (auto const& button : buttonsFury)
|
||||
button.apply();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
for (auto const& button : buttonsDuke)
|
||||
button.apply();
|
||||
}
|
||||
|
||||
for (auto const& digitalAxis : digitalAxes)
|
||||
digitalAxis.apply();
|
||||
}
|
||||
|
||||
char const* CONFIG_GetGameFuncOnKeyboard(int gameFunc)
|
||||
{
|
||||
const char* string0 = KB_ScanCodeToString(KeyboardKeys[gameFunc][0]);
|
||||
return string0[0] == '\0' ? KB_ScanCodeToString(KeyboardKeys[gameFunc][1]) : string0;
|
||||
}
|
||||
|
||||
char const* CONFIG_GetGameFuncOnMouse(int gameFunc)
|
||||
{
|
||||
for (int j = 0; j < 2; ++j)
|
||||
for (int i = 0; i < joystick.numButtons; ++i)
|
||||
if (JoystickFunctions[i][j] == gameFunc)
|
||||
return joyGetName(1, i);
|
||||
|
||||
for (int i = 0; i < joystick.numAxes; ++i)
|
||||
for (int j = 0; j < 2; ++j)
|
||||
if (JoystickDigitalFunctions[i][j] == gameFunc)
|
||||
return joyGetName(0, i);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
char const* CONFIG_GetGameFuncOnJoystick(int gameFunc)
|
||||
{
|
||||
for (int j = 0; j < 2; ++j)
|
||||
for (int i = 0; i < joystick.numButtons; ++i)
|
||||
if (JoystickFunctions[i][j] == gameFunc)
|
||||
return joyGetName(1, i);
|
||||
|
||||
for (int i = 0; i < joystick.numAxes; ++i)
|
||||
for (int j = 0; j < 2; ++j)
|
||||
if (JoystickDigitalFunctions[i][j] == gameFunc)
|
||||
return joyGetName(0, i);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_InitMouseAndController()
|
||||
{
|
||||
memset(MouseFunctions, -1, sizeof(MouseFunctions));
|
||||
memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions));
|
||||
memset(JoystickFunctions, -1, sizeof(JoystickFunctions));
|
||||
memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions));
|
||||
|
||||
for (int i = 0; i < MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
MouseFunctions[i][0] = CONFIG_FunctionNameToNum(mousedefaults[i]);
|
||||
CONTROL_MapButton(MouseFunctions[i][0], i, 0, controldevice_mouse);
|
||||
if (i >= 4) continue;
|
||||
MouseFunctions[i][1] = CONFIG_FunctionNameToNum(mouseclickeddefaults[i]);
|
||||
CONTROL_MapButton(MouseFunctions[i][1], i, 1, controldevice_mouse);
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXMOUSEAXES; i++)
|
||||
{
|
||||
MouseAnalogueScale[i] = DEFAULTMOUSEANALOGUESCALE;
|
||||
CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse);
|
||||
|
||||
MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i * 2]);
|
||||
MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i * 2 + 1]);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0, controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1, controldevice_mouse);
|
||||
|
||||
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]);
|
||||
CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
|
||||
}
|
||||
CONFIG_SetupMouse();
|
||||
CONFIG_SetupJoystick();
|
||||
}
|
||||
|
||||
void CONFIG_PutNumber(const char* key, int number)
|
||||
{
|
||||
FStringf str("%d", number);
|
||||
GameConfig->SetValueForKey(key, str);
|
||||
}
|
||||
|
||||
void CONFIG_WriteControllerSettings()
|
||||
{
|
||||
FString buf;
|
||||
if (in_mouse)
|
||||
{
|
||||
FString section = currentGame + ".MouseSettings";
|
||||
GameConfig->SetSection(section);
|
||||
for (int i = 0; i < MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
if (CONFIG_FunctionNumToName(MouseFunctions[i][0]))
|
||||
{
|
||||
buf.Format("MouseButton%d", i);
|
||||
GameConfig->SetValueForKey(buf, CONFIG_FunctionNumToName(MouseFunctions[i][0]));
|
||||
}
|
||||
|
||||
if (i >= (MAXMOUSEBUTTONS - 2)) continue;
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseFunctions[i][1]))
|
||||
{
|
||||
buf.Format("MouseButtonClicked%d", i);
|
||||
GameConfig->SetValueForKey(buf, CONFIG_FunctionNumToName(MouseFunctions[i][1]));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXMOUSEAXES; i++)
|
||||
{
|
||||
if (CONFIG_AnalogNumToName(MouseAnalogueAxes[i]))
|
||||
{
|
||||
buf.Format("MouseAnalogAxes%d", i);
|
||||
GameConfig->SetValueForKey(buf, CONFIG_AnalogNumToName(MouseAnalogueAxes[i]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseDigitalFunctions[i][0]))
|
||||
{
|
||||
buf.Format("MouseDigitalAxes%d_0", i);
|
||||
GameConfig->SetValueForKey(buf, CONFIG_FunctionNumToName(MouseDigitalFunctions[i][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseDigitalFunctions[i][1]))
|
||||
{
|
||||
buf.Format("MouseDigitalAxes%d_1", i);
|
||||
GameConfig->SetValueForKey(buf, CONFIG_FunctionNumToName(MouseDigitalFunctions[i][1]));
|
||||
}
|
||||
|
||||
buf.Format("MouseAnalogScale%d", i);
|
||||
CONFIG_PutNumber(buf, MouseAnalogueScale[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (in_joystick)
|
||||
{
|
||||
FString section = currentGame + ".ControllerSettings";
|
||||
GameConfig->SetSection(section);
|
||||
for (int dummy = 0; dummy < MAXJOYBUTTONSANDHATS; dummy++)
|
||||
{
|
||||
if (CONFIG_FunctionNumToName(JoystickFunctions[dummy][0]))
|
||||
{
|
||||
buf.Format("ControllerButton%d", dummy);
|
||||
GameConfig->SetValueForKey(buf, CONFIG_FunctionNumToName(JoystickFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickFunctions[dummy][1]))
|
||||
{
|
||||
buf.Format("ControllerButtonClicked%d", dummy);
|
||||
GameConfig->SetValueForKey(buf, CONFIG_FunctionNumToName(JoystickFunctions[dummy][1]));
|
||||
}
|
||||
}
|
||||
for (int dummy = 0; dummy < MAXJOYAXES; dummy++)
|
||||
{
|
||||
if (CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]))
|
||||
{
|
||||
buf.Format("ControllerAnalogAxes%d", dummy);
|
||||
GameConfig->SetValueForKey(buf, CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][0]))
|
||||
{
|
||||
buf.Format("ControllerDigitalAxes%d_0", dummy);
|
||||
GameConfig->SetValueForKey(buf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][1]))
|
||||
{
|
||||
buf.Format("ControllerDigitalAxes%d_1", dummy);
|
||||
GameConfig->SetValueForKey(buf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][1]));
|
||||
}
|
||||
|
||||
buf.Format("ControllerAnalogScale%d", dummy);
|
||||
CONFIG_PutNumber(buf, JoystickAnalogueScale[dummy]);
|
||||
|
||||
buf.Format("ControllerAnalogInvert%d", dummy);
|
||||
CONFIG_PutNumber(buf, JoystickAnalogueInvert[dummy]);
|
||||
|
||||
buf.Format("ControllerAnalogDead%d", dummy);
|
||||
CONFIG_PutNumber(buf, JoystickAnalogueDead[dummy]);
|
||||
|
||||
buf.Format("ControllerAnalogSaturate%d", dummy);
|
||||
CONFIG_PutNumber(buf, JoystickAnalogueSaturate[dummy]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// todo
|
||||
|
||||
CONFIG_PutNumber("Misc", "Executions", ud.executions);
|
||||
|
||||
CONFIG_PutNumber("Setup", "ConfigVersion", BYTEVERSION_EDUKE32);
|
||||
CONFIG_PutNumber("Setup", "ForceSetup", ud.setup.forcesetup);
|
||||
CONFIG_PutNumber("Setup", "NoAutoLoad", ud.setup.noautoload);
|
||||
|
||||
CONFIG_PutNumber("Screen Setup", "ScreenBPP", ud.setup.bpp);
|
||||
CONFIG_PutNumber("Screen Setup", "ScreenDisplay", r_displayindex);
|
||||
CONFIG_PutNumber("Screen Setup", "ScreenHeight", ud.setup.ydim);
|
||||
CONFIG_PutNumber("Screen Setup", "ScreenMode", ud.setup.fullscreen);
|
||||
CONFIG_PutNumber("Screen Setup", "ScreenWidth", ud.setup.xdim);
|
||||
|
||||
if (g_grpNamePtr && !g_addonNum)
|
||||
GameConfig->SetValueForKey("Setup", "SelectedGRP", g_grpNamePtr);
|
||||
|
||||
#ifdef STARTUP_SETUP_WINDOW
|
||||
if (g_noSetup == 0)
|
||||
GameConfig->SetValueForKey("Setup", "ModDir", &g_modDir[0]);
|
||||
#endif
|
||||
// exit early after only updating the values that can be changed from the startup window
|
||||
if (flags & 1)
|
||||
{
|
||||
SCRIPT_Save(g_setupFileName);
|
||||
SCRIPT_Free(ud.config.scripthandle);
|
||||
return;
|
||||
}
|
||||
|
||||
CONFIG_PutNumber("Screen Setup", "MaxRefreshFreq", maxrefreshfreq);
|
||||
CONFIG_PutNumber("Screen Setup", "WindowPosX", windowx);
|
||||
CONFIG_PutNumber("Screen Setup", "WindowPosY", windowy);
|
||||
CONFIG_PutNumber("Screen Setup", "WindowPositioning", windowpos);
|
||||
|
||||
if (!NAM_WW2GI)
|
||||
{
|
||||
CONFIG_PutNumber("Screen Setup", "Out", ud.lockout);
|
||||
GameConfig->SetValueForKey("Screen Setup", "Password", ud.pwlockout);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
CONFIG_PutNumber("Updates", "CheckForUpdates", ud.config.CheckForUpdates);
|
||||
CONFIG_PutNumber("Updates", "LastUpdateCheck", ud.config.LastUpdateCheck);
|
||||
#endif
|
||||
|
||||
GameConfig->SetValueForKey("Comm Setup", "PlayerName", &szPlayerName[0]);
|
||||
|
||||
GameConfig->SetValueForKey("Comm Setup", "RTSName", &ud.rtsname[0]);
|
||||
|
||||
char commmacro[] = "CommbatMacro# ";
|
||||
|
||||
for (int dummy = 0; dummy < MAXRIDECULE; dummy++)
|
||||
{
|
||||
commmacro[13] = dummy + '0';
|
||||
GameConfig->SetValueForKey("Comm Setup", commmacro, &ud.ridecule[dummy][0]);
|
||||
}
|
||||
|
||||
SCRIPT_Save(g_setupFileName);
|
||||
|
||||
if ((flags & 2) == 0)
|
||||
SCRIPT_Free(ud.config.scripthandle);
|
||||
|
||||
OSD_Printf("Wrote %s\n", g_setupFileName);
|
||||
CONFIG_WriteSettings();
|
||||
Bfflush(NULL);
|
||||
|
||||
#endif
|
|
@ -112,6 +112,15 @@ void CONFIG_MapKey(int which, kb_scancode key1, kb_scancode oldkey1, kb_scancode
|
|||
#define MAXMOUSEAXES 2
|
||||
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
|
||||
|
||||
// default mouse scale
|
||||
#define DEFAULTMOUSEANALOGUESCALE 65536
|
||||
|
||||
// default joystick settings
|
||||
|
||||
#define DEFAULTJOYSTICKANALOGUESCALE 65536
|
||||
#define DEFAULTJOYSTICKANALOGUEDEAD 1000
|
||||
#define DEFAULTJOYSTICKANALOGUESATURATE 9500
|
||||
|
||||
|
||||
extern int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
|
||||
extern int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
|
||||
|
@ -127,3 +136,13 @@ extern int32_t JoystickAnalogueInvert[MAXJOYAXES];
|
|||
|
||||
int32_t CONFIG_AnalogNameToNum(const char* func);
|
||||
const char* CONFIG_AnalogNumToName(int32_t func);
|
||||
void CONFIG_SetupMouse(void);
|
||||
void CONFIG_SetupJoystick(void);
|
||||
void CONFIG_WriteControllerSettings();
|
||||
void CONFIG_InitMouseAndController();
|
||||
|
||||
void CONFIG_SetGameControllerDefaultsStandard();
|
||||
void CONFIG_SetGameControllerDefaultsPro();
|
||||
void CONFIG_SetGameControllerDefaultsClear();
|
||||
char const* CONFIG_GetGameFuncOnJoystick(int gameFunc);
|
||||
char const* CONFIG_GetGameFuncOnKeyboard(int gameFunc);
|
||||
|
|
|
@ -43,56 +43,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
BEGIN_DUKE_NS
|
||||
|
||||
|
||||
static void CONFIG_SetJoystickButtonFunction(int i, int j, int function)
|
||||
{
|
||||
JoystickFunctions[i][j] = function;
|
||||
CONTROL_MapButton(function, i, j, controldevice_joystick);
|
||||
}
|
||||
static void CONFIG_SetJoystickAnalogAxisScale(int i, int scale)
|
||||
{
|
||||
JoystickAnalogueScale[i] = scale;
|
||||
CONTROL_SetAnalogAxisScale(i, scale, controldevice_joystick);
|
||||
}
|
||||
static void CONFIG_SetJoystickAnalogAxisInvert(int i, int invert)
|
||||
{
|
||||
JoystickAnalogueInvert[i] = invert;
|
||||
CONTROL_SetAnalogAxisInvert(i, invert, controldevice_joystick);
|
||||
}
|
||||
static void CONFIG_SetJoystickAnalogAxisDeadSaturate(int i, int dead, int saturate)
|
||||
{
|
||||
JoystickAnalogueDead[i] = dead;
|
||||
JoystickAnalogueSaturate[i] = saturate;
|
||||
joySetDeadZone(i, dead, saturate);
|
||||
}
|
||||
static void CONFIG_SetJoystickDigitalAxisFunction(int i, int j, int function)
|
||||
{
|
||||
JoystickDigitalFunctions[i][j] = function;
|
||||
CONTROL_MapDigitalAxis(i, function, j, controldevice_joystick);
|
||||
}
|
||||
static void CONFIG_SetJoystickAnalogAxisFunction(int i, int function)
|
||||
{
|
||||
JoystickAnalogueAxes[i] = function;
|
||||
CONTROL_MapAnalogAxis(i, function, controldevice_joystick);
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_SetDefaults(void)
|
||||
{
|
||||
ud.config.scripthandle = -1;
|
||||
|
||||
#ifdef __ANDROID__
|
||||
droidinput.forward_sens = 5.f;
|
||||
droidinput.gameControlsAlpha = 0.5;
|
||||
droidinput.hideStick = 0;
|
||||
droidinput.pitch_sens = 5.f;
|
||||
droidinput.quickSelectWeapon = 1;
|
||||
droidinput.strafe_sens = 5.f;
|
||||
droidinput.toggleCrouch = 1;
|
||||
droidinput.yaw_sens = 5.f;
|
||||
|
||||
ud.setup.xdim = droidinfo.screen_width;
|
||||
ud.setup.ydim = droidinfo.screen_height;
|
||||
#else
|
||||
# if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
|
||||
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
|
||||
if (inited == 0)
|
||||
|
@ -112,13 +67,8 @@ void CONFIG_SetDefaults(void)
|
|||
ud.setup.xdim = 1024;
|
||||
ud.setup.ydim = 768;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
ud.setup.bpp = 32;
|
||||
#else
|
||||
ud.setup.bpp = 8;
|
||||
#endif
|
||||
|
||||
|
||||
ud.camera_time = 0;//4;
|
||||
|
@ -181,63 +131,6 @@ void CONFIG_SetDefaults(void)
|
|||
Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!");
|
||||
#endif
|
||||
|
||||
memset(MouseFunctions, -1, sizeof(MouseFunctions));
|
||||
memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions));
|
||||
memset(JoystickFunctions, -1, sizeof(JoystickFunctions));
|
||||
memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions));
|
||||
|
||||
for (int i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
MouseFunctions[i][0] = CONFIG_FunctionNameToNum(mousedefaults[i]);
|
||||
CONTROL_MapButton(MouseFunctions[i][0], i, 0, controldevice_mouse);
|
||||
if (i>=4) continue;
|
||||
MouseFunctions[i][1] = CONFIG_FunctionNameToNum(mouseclickeddefaults[i]);
|
||||
CONTROL_MapButton(MouseFunctions[i][1], i, 1, controldevice_mouse);
|
||||
}
|
||||
|
||||
for (int i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
MouseAnalogueScale[i] = DEFAULTMOUSEANALOGUESCALE;
|
||||
CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse);
|
||||
|
||||
MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2]);
|
||||
MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2+1]);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0, controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1, controldevice_mouse);
|
||||
|
||||
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]);
|
||||
CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
|
||||
}
|
||||
|
||||
#if !defined GEKKO
|
||||
CONFIG_SetGameControllerDefaultsStandard();
|
||||
#else
|
||||
for (int i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdefaults[i]);
|
||||
JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(joystickclickeddefaults[i]);
|
||||
CONTROL_MapButton(JoystickFunctions[i][0], i, 0, controldevice_joystick);
|
||||
CONTROL_MapButton(JoystickFunctions[i][1], i, 1, controldevice_joystick);
|
||||
}
|
||||
|
||||
for (int i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
JoystickAnalogueScale[i] = DEFAULTJOYSTICKANALOGUESCALE;
|
||||
JoystickAnalogueInvert[i] = 0;
|
||||
JoystickAnalogueDead[i] = DEFAULTJOYSTICKANALOGUEDEAD;
|
||||
JoystickAnalogueSaturate[i] = DEFAULTJOYSTICKANALOGUESATURATE;
|
||||
CONTROL_SetAnalogAxisScale(i, JoystickAnalogueScale[i], controldevice_joystick);
|
||||
CONTROL_SetAnalogAxisInvert(i, 0, controldevice_joystick);
|
||||
|
||||
JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2]);
|
||||
JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2+1]);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
|
||||
|
||||
JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(joystickanalogdefaults[i]);
|
||||
CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
|
||||
}
|
||||
#endif
|
||||
|
||||
VM_OnEvent(EVENT_SETDEFAULTS, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
}
|
||||
|
@ -245,329 +138,6 @@ void CONFIG_SetDefaults(void)
|
|||
|
||||
|
||||
|
||||
void CONFIG_SetupMouse(void)
|
||||
{
|
||||
if (ud.config.scripthandle < 0)
|
||||
return;
|
||||
|
||||
char str[80];
|
||||
char temp[80];
|
||||
|
||||
for (int i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
Bsprintf(str,"MouseButton%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
||||
MouseFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseButtonClicked%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
||||
MouseFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
}
|
||||
|
||||
// map over the axes
|
||||
for (int i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
Bsprintf(str,"MouseAnalogAxes%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseDigitalAxes%d_0",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseDigitalAxes%d_1",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseAnalogScale%d",i);
|
||||
int32_t scale = MouseAnalogueScale[i];
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str, &scale);
|
||||
MouseAnalogueScale[i] = scale;
|
||||
}
|
||||
|
||||
for (int i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
CONTROL_MapButton(MouseFunctions[i][0], i, 0, controldevice_mouse);
|
||||
CONTROL_MapButton(MouseFunctions[i][1], i, 1, controldevice_mouse);
|
||||
}
|
||||
for (int i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0,controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1,controldevice_mouse);
|
||||
CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_SetupJoystick(void)
|
||||
{
|
||||
int32_t i;
|
||||
char str[80];
|
||||
char temp[80];
|
||||
int32_t scale;
|
||||
|
||||
if (ud.config.scripthandle < 0) return;
|
||||
|
||||
for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
Bsprintf(str,"ControllerButton%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
||||
JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"ControllerButtonClicked%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
||||
JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
}
|
||||
|
||||
// map over the axes
|
||||
for (i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
Bsprintf(str,"ControllerAnalogAxes%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"ControllerDigitalAxes%d_0",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"ControllerDigitalAxes%d_1",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"ControllerAnalogScale%d",i);
|
||||
scale = JoystickAnalogueScale[i];
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogueScale[i] = scale;
|
||||
|
||||
Bsprintf(str,"ControllerAnalogInvert%d",i);
|
||||
scale = JoystickAnalogueInvert[i];
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogueInvert[i] = scale;
|
||||
|
||||
Bsprintf(str,"ControllerAnalogDead%d",i);
|
||||
scale = JoystickAnalogueDead[i];
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogueDead[i] = scale;
|
||||
|
||||
Bsprintf(str,"ControllerAnalogSaturate%d",i);
|
||||
scale = JoystickAnalogueSaturate[i];
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogueSaturate[i] = scale;
|
||||
}
|
||||
|
||||
for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
CONTROL_MapButton(JoystickFunctions[i][0], i, 0, controldevice_joystick);
|
||||
CONTROL_MapButton(JoystickFunctions[i][1], i, 1, controldevice_joystick);
|
||||
}
|
||||
for (i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
|
||||
CONTROL_SetAnalogAxisScale(i, JoystickAnalogueScale[i], controldevice_joystick);
|
||||
CONTROL_SetAnalogAxisInvert(i, JoystickAnalogueInvert[i], controldevice_joystick);
|
||||
}
|
||||
}
|
||||
|
||||
struct GameControllerButtonSetting
|
||||
{
|
||||
GameControllerButton button;
|
||||
int function;
|
||||
|
||||
void apply() const
|
||||
{
|
||||
CONFIG_SetJoystickButtonFunction(button, 0, function);
|
||||
}
|
||||
};
|
||||
struct GameControllerAnalogAxisSetting
|
||||
{
|
||||
GameControllerAxis axis;
|
||||
int function;
|
||||
|
||||
void apply() const
|
||||
{
|
||||
CONFIG_SetJoystickAnalogAxisFunction(axis, function);
|
||||
}
|
||||
};
|
||||
struct GameControllerDigitalAxisSetting
|
||||
{
|
||||
GameControllerAxis axis;
|
||||
int polarity;
|
||||
int function;
|
||||
|
||||
void apply() const
|
||||
{
|
||||
CONFIG_SetJoystickDigitalAxisFunction(axis, polarity, function);
|
||||
}
|
||||
};
|
||||
|
||||
static void CONFIG_SetGameControllerAxesModern()
|
||||
{
|
||||
static GameControllerAnalogAxisSetting const analogAxes[] =
|
||||
{
|
||||
{ GAMECONTROLLER_AXIS_LEFTX, analog_strafing },
|
||||
{ GAMECONTROLLER_AXIS_LEFTY, analog_moving },
|
||||
{ GAMECONTROLLER_AXIS_RIGHTX, analog_turning },
|
||||
{ GAMECONTROLLER_AXIS_RIGHTY, analog_lookingupanddown },
|
||||
};
|
||||
|
||||
CONFIG_SetJoystickAnalogAxisScale(GAMECONTROLLER_AXIS_RIGHTX, 32768+16384);
|
||||
CONFIG_SetJoystickAnalogAxisScale(GAMECONTROLLER_AXIS_RIGHTY, 32768+16384);
|
||||
|
||||
for (auto const & analogAxis : analogAxes)
|
||||
analogAxis.apply();
|
||||
}
|
||||
|
||||
void CONFIG_SetGameControllerDefaultsStandard()
|
||||
{
|
||||
CONFIG_SetGameControllerDefaultsClear();
|
||||
CONFIG_SetGameControllerAxesModern();
|
||||
|
||||
static GameControllerButtonSetting const buttons[] =
|
||||
{
|
||||
{ GAMECONTROLLER_BUTTON_A, gamefunc_Jump },
|
||||
{ GAMECONTROLLER_BUTTON_B, gamefunc_Toggle_Crouch },
|
||||
{ GAMECONTROLLER_BUTTON_BACK, gamefunc_Map },
|
||||
{ GAMECONTROLLER_BUTTON_LEFTSTICK, gamefunc_Run },
|
||||
{ GAMECONTROLLER_BUTTON_RIGHTSTICK, gamefunc_Quick_Kick },
|
||||
{ GAMECONTROLLER_BUTTON_LEFTSHOULDER, gamefunc_Crouch },
|
||||
{ GAMECONTROLLER_BUTTON_RIGHTSHOULDER, gamefunc_Jump },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_UP, gamefunc_Previous_Weapon },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_DOWN, gamefunc_Next_Weapon },
|
||||
};
|
||||
|
||||
static GameControllerButtonSetting const buttonsDuke[] =
|
||||
{
|
||||
{ GAMECONTROLLER_BUTTON_X, gamefunc_Open },
|
||||
{ GAMECONTROLLER_BUTTON_Y, gamefunc_Inventory },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_LEFT, gamefunc_Inventory_Left },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_RIGHT, gamefunc_Inventory_Right },
|
||||
};
|
||||
|
||||
static GameControllerButtonSetting const buttonsFury[] =
|
||||
{
|
||||
{ GAMECONTROLLER_BUTTON_X, gamefunc_Steroids }, // Reload
|
||||
{ GAMECONTROLLER_BUTTON_Y, gamefunc_Open },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_LEFT, gamefunc_MedKit },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_RIGHT, gamefunc_NightVision }, // Radar
|
||||
};
|
||||
|
||||
static GameControllerDigitalAxisSetting const digitalAxes[] =
|
||||
{
|
||||
{ GAMECONTROLLER_AXIS_TRIGGERLEFT, 1, gamefunc_Alt_Fire },
|
||||
{ GAMECONTROLLER_AXIS_TRIGGERRIGHT, 1, gamefunc_Fire },
|
||||
};
|
||||
|
||||
for (auto const & button : buttons)
|
||||
button.apply();
|
||||
|
||||
if (FURY)
|
||||
{
|
||||
for (auto const & button : buttonsFury)
|
||||
button.apply();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto const & button : buttonsDuke)
|
||||
button.apply();
|
||||
}
|
||||
|
||||
for (auto const & digitalAxis : digitalAxes)
|
||||
digitalAxis.apply();
|
||||
}
|
||||
|
||||
void CONFIG_SetGameControllerDefaultsPro()
|
||||
{
|
||||
CONFIG_SetGameControllerDefaultsClear();
|
||||
CONFIG_SetGameControllerAxesModern();
|
||||
|
||||
static GameControllerButtonSetting const buttons[] =
|
||||
{
|
||||
{ GAMECONTROLLER_BUTTON_A, gamefunc_Open },
|
||||
{ GAMECONTROLLER_BUTTON_B, gamefunc_Third_Person_View },
|
||||
{ GAMECONTROLLER_BUTTON_Y, gamefunc_Quick_Kick },
|
||||
{ GAMECONTROLLER_BUTTON_BACK, gamefunc_Map },
|
||||
{ GAMECONTROLLER_BUTTON_LEFTSTICK, gamefunc_Run },
|
||||
{ GAMECONTROLLER_BUTTON_RIGHTSTICK, gamefunc_Crouch },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_UP, gamefunc_Previous_Weapon },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_DOWN, gamefunc_Next_Weapon },
|
||||
};
|
||||
|
||||
static GameControllerButtonSetting const buttonsDuke[] =
|
||||
{
|
||||
{ GAMECONTROLLER_BUTTON_X, gamefunc_Inventory },
|
||||
{ GAMECONTROLLER_BUTTON_LEFTSHOULDER, gamefunc_Previous_Weapon },
|
||||
{ GAMECONTROLLER_BUTTON_RIGHTSHOULDER, gamefunc_Next_Weapon },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_LEFT, gamefunc_Inventory_Left },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_RIGHT, gamefunc_Inventory_Right },
|
||||
};
|
||||
|
||||
static GameControllerButtonSetting const buttonsFury[] =
|
||||
{
|
||||
{ GAMECONTROLLER_BUTTON_X, gamefunc_Steroids }, // Reload
|
||||
{ GAMECONTROLLER_BUTTON_LEFTSHOULDER, gamefunc_Crouch },
|
||||
{ GAMECONTROLLER_BUTTON_RIGHTSHOULDER, gamefunc_Alt_Fire },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_LEFT, gamefunc_MedKit },
|
||||
{ GAMECONTROLLER_BUTTON_DPAD_RIGHT, gamefunc_NightVision }, // Radar
|
||||
};
|
||||
|
||||
static GameControllerDigitalAxisSetting const digitalAxes[] =
|
||||
{
|
||||
{ GAMECONTROLLER_AXIS_TRIGGERLEFT, 1, gamefunc_Jump },
|
||||
{ GAMECONTROLLER_AXIS_TRIGGERRIGHT, 1, gamefunc_Fire },
|
||||
};
|
||||
|
||||
for (auto const & button : buttons)
|
||||
button.apply();
|
||||
|
||||
if (FURY)
|
||||
{
|
||||
for (auto const & button : buttonsFury)
|
||||
button.apply();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto const & button : buttonsDuke)
|
||||
button.apply();
|
||||
}
|
||||
|
||||
for (auto const & digitalAxis : digitalAxes)
|
||||
digitalAxis.apply();
|
||||
}
|
||||
|
||||
void CONFIG_SetGameControllerDefaultsClear()
|
||||
{
|
||||
for (int i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
CONFIG_SetJoystickButtonFunction(i, 0, -1);
|
||||
CONFIG_SetJoystickButtonFunction(i, 1, -1);
|
||||
}
|
||||
|
||||
for (int i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
CONFIG_SetJoystickAnalogAxisScale(i, DEFAULTJOYSTICKANALOGUESCALE);
|
||||
CONFIG_SetJoystickAnalogAxisInvert(i, 0);
|
||||
CONFIG_SetJoystickAnalogAxisDeadSaturate(i, DEFAULTJOYSTICKANALOGUEDEAD, DEFAULTJOYSTICKANALOGUESATURATE);
|
||||
|
||||
CONFIG_SetJoystickDigitalAxisFunction(i, 0, -1);
|
||||
CONFIG_SetJoystickDigitalAxisFunction(i, 1, -1);
|
||||
|
||||
CONFIG_SetJoystickAnalogAxisFunction(i, -1);
|
||||
}
|
||||
}
|
||||
|
||||
int CONFIG_ReadSetup(void)
|
||||
{
|
||||
char tempbuf[1024];
|
||||
|
@ -651,7 +221,6 @@ int CONFIG_ReadSetup(void)
|
|||
windowy = -1;
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.setup.bpp);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenDisplay", &r_displayindex);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight", &ud.setup.ydim);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode", &ud.setup.fullscreen);
|
||||
|
@ -684,213 +253,6 @@ void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.
|
|||
{
|
||||
}
|
||||
|
||||
void CONFIG_WriteSetup(uint32_t flags)
|
||||
{
|
||||
#if 0
|
||||
if (!ud.config.setupread) return;
|
||||
|
||||
if (ud.config.scripthandle < 0)
|
||||
ud.config.scripthandle = SCRIPT_Init(g_setupFileName);
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions", ud.executions, FALSE, FALSE);
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ConfigVersion", BYTEVERSION_EDUKE32, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup", ud.setup.forcesetup, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "NoAutoLoad", ud.setup.noautoload, FALSE, FALSE);
|
||||
|
||||
#ifdef POLYMER
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Polymer", glrendmode == REND_POLYMER, FALSE, FALSE);
|
||||
#endif
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", ud.setup.bpp, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenDisplay", r_displayindex, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight", ud.setup.ydim, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode", ud.setup.fullscreen, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth", ud.setup.xdim, FALSE, FALSE);
|
||||
|
||||
if (g_grpNamePtr && !g_addonNum)
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Setup", "SelectedGRP", g_grpNamePtr);
|
||||
|
||||
#ifdef STARTUP_SETUP_WINDOW
|
||||
if (g_noSetup == 0)
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Setup", "ModDir", &g_modDir[0]);
|
||||
#endif
|
||||
// exit early after only updating the values that can be changed from the startup window
|
||||
if (flags & 1)
|
||||
{
|
||||
SCRIPT_Save(ud.config.scripthandle, g_setupFileName);
|
||||
SCRIPT_Free(ud.config.scripthandle);
|
||||
return;
|
||||
}
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", maxrefreshfreq, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", windowx, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, FALSE, FALSE);
|
||||
|
||||
if (!NAM_WW2GI)
|
||||
{
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Out",ud.lockout,FALSE,FALSE);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "Password",ud.pwlockout);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, FALSE, FALSE);
|
||||
#endif
|
||||
|
||||
if (in_mouse)
|
||||
{
|
||||
for (int i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
if (CONFIG_FunctionNumToName(MouseFunctions[i][0]))
|
||||
{
|
||||
Bsprintf(buf, "MouseButton%d", i);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseFunctions[i][0]));
|
||||
}
|
||||
|
||||
if (i >= (MAXMOUSEBUTTONS-2)) continue;
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseFunctions[i][1]))
|
||||
{
|
||||
Bsprintf(buf, "MouseButtonClicked%d", i);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseFunctions[i][1]));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
if (CONFIG_AnalogNumToName(MouseAnalogueAxes[i]))
|
||||
{
|
||||
Bsprintf(buf, "MouseAnalogAxes%d", i);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(MouseAnalogueAxes[i]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseDigitalFunctions[i][0]))
|
||||
{
|
||||
Bsprintf(buf, "MouseDigitalAxes%d_0", i);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseDigitalFunctions[i][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseDigitalFunctions[i][1]))
|
||||
{
|
||||
Bsprintf(buf, "MouseDigitalAxes%d_1", i);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseDigitalFunctions[i][1]));
|
||||
}
|
||||
|
||||
Bsprintf(buf, "MouseAnalogScale%d", i);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, MouseAnalogueScale[i], FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (in_joystick)
|
||||
{
|
||||
for (int dummy=0; dummy<MAXJOYBUTTONSANDHATS; dummy++)
|
||||
{
|
||||
if (CONFIG_FunctionNumToName(JoystickFunctions[dummy][0]))
|
||||
{
|
||||
Bsprintf(buf, "ControllerButton%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickFunctions[dummy][1]))
|
||||
{
|
||||
Bsprintf(buf, "ControllerButtonClicked%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickFunctions[dummy][1]));
|
||||
}
|
||||
}
|
||||
for (int dummy=0; dummy<MAXJOYAXES; dummy++)
|
||||
{
|
||||
if (CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]))
|
||||
{
|
||||
Bsprintf(buf, "ControllerAnalogAxes%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][0]))
|
||||
{
|
||||
Bsprintf(buf, "ControllerDigitalAxes%d_0", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][1]))
|
||||
{
|
||||
Bsprintf(buf, "ControllerDigitalAxes%d_1", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][1]));
|
||||
}
|
||||
|
||||
Bsprintf(buf, "ControllerAnalogScale%d", dummy);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, JoystickAnalogueScale[dummy], FALSE, FALSE);
|
||||
|
||||
Bsprintf(buf, "ControllerAnalogInvert%d", dummy);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, JoystickAnalogueInvert[dummy], FALSE, FALSE);
|
||||
|
||||
Bsprintf(buf, "ControllerAnalogDead%d", dummy);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, JoystickAnalogueDead[dummy], FALSE, FALSE);
|
||||
|
||||
Bsprintf(buf, "ControllerAnalogSaturate%d", dummy);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, JoystickAnalogueSaturate[dummy], FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","PlayerName",&szPlayerName[0]);
|
||||
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
|
||||
|
||||
char commmacro[] = "CommbatMacro# ";
|
||||
|
||||
for (int dummy = 0; dummy < MAXRIDECULE; dummy++)
|
||||
{
|
||||
commmacro[13] = dummy+'0';
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
|
||||
}
|
||||
|
||||
SCRIPT_Save(ud.config.scripthandle, g_setupFileName);
|
||||
|
||||
if ((flags & 2) == 0)
|
||||
SCRIPT_Free(ud.config.scripthandle);
|
||||
|
||||
OSD_Printf("Wrote %s\n",g_setupFileName);
|
||||
CONFIG_WriteSettings();
|
||||
Bfflush(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
char const * CONFIG_GetGameFuncOnKeyboard(int gameFunc)
|
||||
{
|
||||
const char * string0 = KB_ScanCodeToString(KeyboardKeys[gameFunc][0]);
|
||||
return string0[0] == '\0' ? KB_ScanCodeToString(KeyboardKeys[gameFunc][1]) : string0;
|
||||
}
|
||||
|
||||
char const * CONFIG_GetGameFuncOnMouse(int gameFunc)
|
||||
{
|
||||
for (int j = 0; j < 2; ++j)
|
||||
for (int i = 0; i < joystick.numButtons; ++i)
|
||||
if (JoystickFunctions[i][j] == gameFunc)
|
||||
return joyGetName(1, i);
|
||||
|
||||
for (int i = 0; i < joystick.numAxes; ++i)
|
||||
for (int j = 0; j < 2; ++j)
|
||||
if (JoystickDigitalFunctions[i][j] == gameFunc)
|
||||
return joyGetName(0, i);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
char const * CONFIG_GetGameFuncOnJoystick(int gameFunc)
|
||||
{
|
||||
for (int j = 0; j < 2; ++j)
|
||||
for (int i = 0; i < joystick.numButtons; ++i)
|
||||
if (JoystickFunctions[i][j] == gameFunc)
|
||||
return joyGetName(1, i);
|
||||
|
||||
for (int i = 0; i < joystick.numAxes; ++i)
|
||||
for (int j = 0; j < 2; ++j)
|
||||
if (JoystickDigitalFunctions[i][j] == gameFunc)
|
||||
return joyGetName(0, i);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
static const char *CONFIG_GetMapEntryName(char m[], char const * const mapname)
|
||||
{
|
||||
|
|
|
@ -29,20 +29,10 @@ BEGIN_DUKE_NS
|
|||
|
||||
|
||||
int CONFIG_ReadSetup(void);
|
||||
void CONFIG_WriteSetup(uint32_t flags);
|
||||
void CONFIG_SetDefaults(void);
|
||||
void CONFIG_SetupMouse(void);
|
||||
void CONFIG_SetupJoystick(void);
|
||||
|
||||
void CONFIG_SetGameControllerDefaultsStandard(void);
|
||||
void CONFIG_SetGameControllerDefaultsPro(void);
|
||||
void CONFIG_SetGameControllerDefaultsClear(void);
|
||||
|
||||
int32_t CONFIG_GetMapBestTime(char const *mapname, uint8_t const *mapmd4);
|
||||
int CONFIG_SetMapBestTime(uint8_t const *mapmd4, int32_t tm);
|
||||
|
||||
const char * CONFIG_GetGameFuncOnKeyboard(int gameFunc);
|
||||
const char * CONFIG_GetGameFuncOnJoystick(int gameFunc);
|
||||
|
||||
END_DUKE_NS
|
||||
#endif
|
||||
|
|
|
@ -34,14 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
// config file name
|
||||
#define SETUPFILENAME APPBASENAME ".cfg"
|
||||
|
||||
// default mouse scale
|
||||
#define DEFAULTMOUSEANALOGUESCALE 65536
|
||||
|
||||
// default joystick settings
|
||||
|
||||
#define DEFAULTJOYSTICKANALOGUESCALE 65536
|
||||
#define DEFAULTJOYSTICKANALOGUEDEAD 2000
|
||||
#define DEFAULTJOYSTICKANALOGUESATURATE 9500
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -865,8 +865,6 @@ int32_t G_LoadPlayerMaybeMulti(savebrief_t & sv)
|
|||
|
||||
void G_SavePlayerMaybeMulti(savebrief_t & sv, bool isAutoSave)
|
||||
{
|
||||
CONFIG_WriteSetup(2);
|
||||
|
||||
if (g_netServer || ud.multimode > 1)
|
||||
{
|
||||
Bstrcpy(apStrings[QUOTE_RESERVED4], "Multiplayer Saving Not Yet Supported");
|
||||
|
|
|
@ -51,19 +51,6 @@ void CONFIG_SetDefaults(void)
|
|||
int32_t i;
|
||||
|
||||
ud.config.scripthandle = -1;
|
||||
#ifdef __ANDROID__
|
||||
droidinput.forward_sens = 5.f;
|
||||
droidinput.strafe_sens = 5.f;
|
||||
droidinput.pitch_sens = 5.f;
|
||||
droidinput.yaw_sens = 5.f;
|
||||
droidinput.hideStick = 0;
|
||||
droidinput.gameControlsAlpha = 0.5;
|
||||
droidinput.toggleCrouch = 1;
|
||||
droidinput.quickSelectWeapon = 1;
|
||||
|
||||
ud.setup.xdim = droidinfo.screen_width;
|
||||
ud.setup.ydim = droidinfo.screen_height;
|
||||
#else
|
||||
# if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
|
||||
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
|
||||
if (inited == 0)
|
||||
|
@ -83,13 +70,8 @@ void CONFIG_SetDefaults(void)
|
|||
ud.setup.xdim = 1024;
|
||||
ud.setup.ydim = 768;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
ud.setup.bpp = 32;
|
||||
#else
|
||||
ud.setup.bpp = 8;
|
||||
#endif
|
||||
g_player[0].ps->aim_mode = 1;
|
||||
ud.config.ShowOpponentWeapons = 0;
|
||||
ud.althud = 1;
|
||||
|
@ -166,200 +148,6 @@ void CONFIG_SetDefaults(void)
|
|||
Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!");
|
||||
//}
|
||||
|
||||
// JBF 20031211
|
||||
|
||||
memset(MouseFunctions, -1, sizeof(MouseFunctions));
|
||||
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
MouseFunctions[i][0] = CONFIG_FunctionNameToNum(mousedefaults[i]);
|
||||
CONTROL_MapButton(MouseFunctions[i][0], i, 0, controldevice_mouse);
|
||||
if (i>=4) continue;
|
||||
MouseFunctions[i][1] = CONFIG_FunctionNameToNum(mouseclickeddefaults[i]);
|
||||
CONTROL_MapButton(MouseFunctions[i][1], i, 1, controldevice_mouse);
|
||||
}
|
||||
|
||||
memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions));
|
||||
for (i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
MouseAnalogueScale[i] = DEFAULTMOUSEANALOGUESCALE;
|
||||
CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse);
|
||||
|
||||
MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2]);
|
||||
MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2+1]);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0, controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1, controldevice_mouse);
|
||||
|
||||
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]);
|
||||
CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
|
||||
}
|
||||
memset(JoystickFunctions, -1, sizeof(JoystickFunctions));
|
||||
for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdefaults[i]);
|
||||
JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(joystickclickeddefaults[i]);
|
||||
CONTROL_MapButton(JoystickFunctions[i][0], i, 0, controldevice_joystick);
|
||||
CONTROL_MapButton(JoystickFunctions[i][1], i, 1, controldevice_joystick);
|
||||
}
|
||||
|
||||
memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions));
|
||||
for (i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
JoystickAnalogueScale[i] = DEFAULTJOYSTICKANALOGUESCALE;
|
||||
JoystickAnalogueDead[i] = DEFAULTJOYSTICKANALOGUEDEAD;
|
||||
JoystickAnalogueSaturate[i] = DEFAULTJOYSTICKANALOGUESATURATE;
|
||||
CONTROL_SetAnalogAxisScale(i, JoystickAnalogueScale[i], controldevice_joystick);
|
||||
|
||||
JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2]);
|
||||
JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2+1]);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
|
||||
|
||||
JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(joystickanalogdefaults[i]);
|
||||
CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
|
||||
}
|
||||
}
|
||||
|
||||
void CONFIG_SetupMouse(void)
|
||||
{
|
||||
int32_t i;
|
||||
char str[80];
|
||||
char temp[80];
|
||||
int32_t scale;
|
||||
|
||||
if (ud.config.scripthandle < 0) return;
|
||||
|
||||
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
Bsprintf(str,"MouseButton%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
||||
MouseFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseButtonClicked%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
||||
MouseFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
}
|
||||
|
||||
// map over the axes
|
||||
for (i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
Bsprintf(str,"MouseAnalogAxes%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_AnalogNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseDigitalAxes%d_0",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseDigitalAxes%d_1",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseAnalogScale%d",i);
|
||||
scale = MouseAnalogueScale[i];
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
||||
MouseAnalogueScale[i] = scale;
|
||||
}
|
||||
|
||||
{
|
||||
tempbuf[0] = 0;
|
||||
SCRIPT_GetString(ud.config.scripthandle, "Controls","Mouse_Sensitivity",&tempbuf[0]);
|
||||
if (tempbuf[0]) in_mousesensitivity = atof(tempbuf);
|
||||
}
|
||||
|
||||
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
CONTROL_MapButton(MouseFunctions[i][0], i, 0, controldevice_mouse);
|
||||
CONTROL_MapButton(MouseFunctions[i][1], i, 1, controldevice_mouse);
|
||||
}
|
||||
for (i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0,controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1,controldevice_mouse);
|
||||
CONTROL_SetAnalogAxisScale(i, MouseAnalogueScale[i], controldevice_mouse);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CONFIG_SetupJoystick(void)
|
||||
{
|
||||
int32_t i;
|
||||
char str[80];
|
||||
char temp[80];
|
||||
int32_t scale;
|
||||
|
||||
if (ud.config.scripthandle < 0) return;
|
||||
|
||||
for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
Bsprintf(str,"JoystickButton%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
||||
JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickButtonClicked%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
||||
JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
}
|
||||
|
||||
// map over the axes
|
||||
for (i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
Bsprintf(str,"JoystickAnalogAxes%d",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_AnalogNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickDigitalAxes%d_0",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickDigitalAxes%d_1",i);
|
||||
temp[0] = 0;
|
||||
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
||||
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
||||
JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickAnalogScale%d",i);
|
||||
scale = JoystickAnalogueScale[i];
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogueScale[i] = scale;
|
||||
|
||||
Bsprintf(str,"JoystickAnalogDead%d",i);
|
||||
scale = JoystickAnalogueDead[i];
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogueDead[i] = scale;
|
||||
|
||||
Bsprintf(str,"JoystickAnalogSaturate%d",i);
|
||||
scale = JoystickAnalogueSaturate[i];
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogueSaturate[i] = scale;
|
||||
}
|
||||
|
||||
for (i=0; i<MAXJOYBUTTONSANDHATS; i++)
|
||||
{
|
||||
CONTROL_MapButton(JoystickFunctions[i][0], i, 0, controldevice_joystick);
|
||||
CONTROL_MapButton(JoystickFunctions[i][1], i, 1, controldevice_joystick);
|
||||
}
|
||||
for (i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
|
||||
CONTROL_SetAnalogAxisScale(i, JoystickAnalogueScale[i], controldevice_joystick);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -422,26 +210,21 @@ int32_t CONFIG_ReadSetup(void)
|
|||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ConfigVersion", &ud.configversion);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ForceSetup", &ud.setup.forcesetup);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "NoAutoLoad", &ud.setup.noautoload);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "CacheSize", &dummy);
|
||||
|
||||
if (g_noSetup == 0 && g_modDir[0] == '/')
|
||||
{
|
||||
struct Bstat st;
|
||||
SCRIPT_GetString(ud.config.scripthandle, "Setup","ModDir",&g_modDir[0]);
|
||||
|
||||
if (Bstat(g_modDir, &st))
|
||||
if (!buildvfs_isdir(g_modDir))
|
||||
{
|
||||
if ((st.st_mode & S_IFDIR) != S_IFDIR)
|
||||
{
|
||||
initprintf("Invalid mod dir in cfg!\n");
|
||||
Bsprintf(g_modDir,"/");
|
||||
}
|
||||
initprintf("Invalid mod dir in cfg!\n");
|
||||
Bsprintf(g_modDir,"/");
|
||||
}
|
||||
}
|
||||
|
||||
if (g_grpNamePtr == NULL && g_addonNum == 0)
|
||||
{
|
||||
SCRIPT_GetStringPtr(ud.config.scripthandle, "Setup","SelectedGRP",&g_grpNamePtr);
|
||||
SCRIPT_GetStringPtr(ud.config.scripthandle, "Setup", "SelectedGRP", &g_grpNamePtr);
|
||||
if (g_grpNamePtr && !Bstrlen(g_grpNamePtr))
|
||||
g_grpNamePtr = dup_filename(G_DefaultGrpFile());
|
||||
}
|
||||
|
@ -449,20 +232,17 @@ int32_t CONFIG_ReadSetup(void)
|
|||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Out",&ud.lockout);
|
||||
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup","Password",&ud.pwlockout[0]);
|
||||
|
||||
windowx = -1;
|
||||
windowy = -1;
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight", &ud.setup.ydim);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode", &ud.setup.fullscreen);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth", &ud.setup.xdim);
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", (int32_t *)&windowpos);
|
||||
|
||||
windowx = -1;
|
||||
windowy = -1;
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", (int32_t *)&windowx);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32_t *)&windowy);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", (int32_t *)&windowpos);
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.setup.bpp);
|
||||
|
||||
if (ud.setup.bpp < 8) ud.setup.bpp = 32;
|
||||
|
||||
#ifdef POLYMER
|
||||
|
@ -471,7 +251,7 @@ int32_t CONFIG_ReadSetup(void)
|
|||
glrendmode = (rendmode > 0) ? REND_POLYMER : REND_POLYMOST;
|
||||
#endif
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions", &ud.executions);
|
||||
|
||||
#ifdef _WIN32
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", &ud.config.CheckForUpdates);
|
||||
|
@ -487,185 +267,6 @@ void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.
|
|||
{
|
||||
}
|
||||
|
||||
void CONFIG_WriteSetup(uint32_t flags)
|
||||
{
|
||||
#if 0
|
||||
int32_t dummy;
|
||||
|
||||
if (!ud.config.setupread) return;
|
||||
|
||||
if (ud.config.scripthandle < 0)
|
||||
ud.config.scripthandle = SCRIPT_Init(g_setupFileName);
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions",ud.executions,FALSE,FALSE);
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup","ConfigVersion",BYTEVERSION_EDUKE32,FALSE,FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup", ud.setup.forcesetup, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "NoAutoLoad", ud.setup.noautoload, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "CacheSize", MAXCACHE1DSIZE, FALSE, FALSE);
|
||||
|
||||
#ifdef POLYMER
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Polymer",glrendmode == REND_POLYMER,FALSE,FALSE);
|
||||
#endif
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", ud.setup.bpp, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight", ud.setup.ydim, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode", ud.setup.fullscreen, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth", ud.setup.xdim, FALSE, FALSE);
|
||||
|
||||
if (g_grpNamePtr && !g_addonNum)
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",g_grpNamePtr);
|
||||
|
||||
#ifdef STARTUP_SETUP_WINDOW
|
||||
if (g_noSetup == 0)
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&g_modDir[0]);
|
||||
#endif
|
||||
// exit early after only updating the values that can be changed from the startup window
|
||||
if (flags & 1)
|
||||
{
|
||||
SCRIPT_Save(ud.config.scripthandle, g_setupFileName);
|
||||
SCRIPT_Free(ud.config.scripthandle);
|
||||
return;
|
||||
}
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", windowx, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", maxrefreshfreq, FALSE, FALSE);
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Out",ud.lockout,FALSE,FALSE);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "Password",ud.pwlockout);
|
||||
|
||||
#ifdef _WIN32
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, FALSE, FALSE);
|
||||
#endif
|
||||
|
||||
if (in_mouse)
|
||||
{
|
||||
for (dummy=0; dummy<MAXMOUSEBUTTONS; dummy++)
|
||||
{
|
||||
if (CONFIG_FunctionNumToName(MouseFunctions[dummy][0]))
|
||||
{
|
||||
Bsprintf(buf, "MouseButton%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (dummy >= (MAXMOUSEBUTTONS-2)) continue;
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseFunctions[dummy][1]))
|
||||
{
|
||||
Bsprintf(buf, "MouseButtonClicked%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseFunctions[dummy][1]));
|
||||
}
|
||||
}
|
||||
|
||||
for (dummy=0; dummy<MAXMOUSEAXES; dummy++)
|
||||
{
|
||||
if (CONFIG_AnalogNumToName(MouseAnalogueAxes[dummy]))
|
||||
{
|
||||
Bsprintf(buf, "MouseAnalogAxes%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(MouseAnalogueAxes[dummy]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseDigitalFunctions[dummy][0]))
|
||||
{
|
||||
Bsprintf(buf, "MouseDigitalAxes%d_0", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseDigitalFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(MouseDigitalFunctions[dummy][1]))
|
||||
{
|
||||
Bsprintf(buf, "MouseDigitalAxes%d_1", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseDigitalFunctions[dummy][1]));
|
||||
}
|
||||
|
||||
if (MouseAnalogueScale[dummy] != DEFAULTMOUSEANALOGUESCALE)
|
||||
{
|
||||
Bsprintf(buf, "MouseAnalogScale%d", dummy);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, MouseAnalogueScale[dummy], FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (in_joystick)
|
||||
{
|
||||
for (dummy=0; dummy<MAXJOYBUTTONSANDHATS; dummy++)
|
||||
{
|
||||
if (CONFIG_FunctionNumToName(JoystickFunctions[dummy][0]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickButton%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickFunctions[dummy][1]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickButtonClicked%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickFunctions[dummy][1]));
|
||||
}
|
||||
}
|
||||
for (dummy=0; dummy<MAXJOYAXES; dummy++)
|
||||
{
|
||||
if (CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickAnalogAxes%d", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][0]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickDigitalAxes%d_0", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][0]));
|
||||
}
|
||||
|
||||
if (CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][1]))
|
||||
{
|
||||
Bsprintf(buf, "JoystickDigitalAxes%d_1", dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[dummy][1]));
|
||||
}
|
||||
|
||||
if (JoystickAnalogueScale[dummy] != DEFAULTJOYSTICKANALOGUESCALE)
|
||||
{
|
||||
Bsprintf(buf, "JoystickAnalogScale%d", dummy);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, JoystickAnalogueScale[dummy], FALSE, FALSE);
|
||||
}
|
||||
|
||||
if (JoystickAnalogueDead[dummy] != DEFAULTJOYSTICKANALOGUEDEAD)
|
||||
{
|
||||
Bsprintf(buf, "JoystickAnalogDead%d", dummy);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, JoystickAnalogueDead[dummy], FALSE, FALSE);
|
||||
}
|
||||
|
||||
if (JoystickAnalogueSaturate[dummy] != DEFAULTJOYSTICKANALOGUESATURATE)
|
||||
{
|
||||
Bsprintf(buf, "JoystickAnalogSaturate%d", dummy);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, JoystickAnalogueSaturate[dummy], FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","PlayerName",&szPlayerName[0]);
|
||||
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
|
||||
|
||||
char commmacro[] = "CommbatMacro# ";
|
||||
|
||||
for (dummy = 0; dummy < MAXRIDECULE; dummy++)
|
||||
{
|
||||
commmacro[13] = dummy+'0';
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
|
||||
}
|
||||
|
||||
SCRIPT_Save(ud.config.scripthandle, g_setupFileName);
|
||||
|
||||
if ((flags & 2) == 0)
|
||||
SCRIPT_Free(ud.config.scripthandle);
|
||||
|
||||
OSD_Printf("Wrote %s\n",g_setupFileName);
|
||||
CONFIG_WriteSettings();
|
||||
Bfflush(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
static const char *CONFIG_GetMapEntryName(char m[], char const * const mapname)
|
||||
{
|
||||
|
@ -696,6 +297,7 @@ int32_t CONFIG_GetMapBestTime(char const * const mapname, uint8_t const * const
|
|||
return -1;
|
||||
|
||||
char m[37];
|
||||
|
||||
CONFIG_GetMD4EntryName(m, mapmd4);
|
||||
|
||||
int32_t t = -1;
|
||||
|
@ -703,21 +305,24 @@ int32_t CONFIG_GetMapBestTime(char const * const mapname, uint8_t const * const
|
|||
{
|
||||
// fall back to map filenames
|
||||
char m2[BMAX_PATH];
|
||||
char const * const p = CONFIG_GetMapEntryName(m2, mapname);
|
||||
auto p = CONFIG_GetMapEntryName(m2, mapname);
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "MapTimes", p, &t);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
int32_t CONFIG_SetMapBestTime(uint8_t const * const mapmd4, int32_t const tm)
|
||||
{
|
||||
if (ud.config.scripthandle < 0) ud.config.scripthandle = SCRIPT_Init(g_setupFileName);
|
||||
if (ud.config.scripthandle < 0) return -1;
|
||||
if (ud.config.scripthandle < 0 && (ud.config.scripthandle = SCRIPT_Init(g_setupFileName)) < 0)
|
||||
return -1;
|
||||
|
||||
char m[37];
|
||||
CONFIG_GetMD4EntryName(m, mapmd4);
|
||||
|
||||
CONFIG_GetMD4EntryName(m, mapmd4);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "MapTimes", m, tm, FALSE, FALSE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,6 @@ BEGIN_RR_NS
|
|||
|
||||
int32_t CONFIG_ReadSetup( void );
|
||||
void CONFIG_GetSetupFilename( void );
|
||||
void CONFIG_WriteSetup(uint32_t flags);
|
||||
void CONFIG_SetupMouse( void );
|
||||
void CONFIG_SetupJoystick( void );
|
||||
|
||||
int32_t CONFIG_GetMapBestTime(char const * mapname, uint8_t const * mapmd4);
|
||||
int32_t CONFIG_SetMapBestTime(uint8_t const * mapmd4, int32_t tm);
|
||||
|
|
|
@ -37,29 +37,6 @@ BEGIN_RR_NS
|
|||
// config file name
|
||||
#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 MAXJOYAXES 9
|
||||
#define MAXJOYDIGITAL (MAXJOYAXES*2)
|
||||
|
||||
// default mouse scale
|
||||
#define DEFAULTMOUSEANALOGUESCALE 65536
|
||||
|
||||
// default joystick settings
|
||||
|
||||
#if defined(GEKKO)
|
||||
#define DEFAULTJOYSTICKANALOGUESCALE 16384
|
||||
#define DEFAULTJOYSTICKANALOGUEDEAD 1000
|
||||
#define DEFAULTJOYSTICKANALOGUESATURATE 9500
|
||||
#else
|
||||
#define DEFAULTJOYSTICKANALOGUESCALE 65536
|
||||
#define DEFAULTJOYSTICKANALOGUEDEAD 1000
|
||||
#define DEFAULTJOYSTICKANALOGUESATURATE 9500
|
||||
#endif
|
||||
|
||||
END_RR_NS
|
||||
|
||||
#endif
|
||||
|
|
|
@ -581,8 +581,6 @@ int32_t G_LoadPlayerMaybeMulti(savebrief_t & sv)
|
|||
|
||||
void G_SavePlayerMaybeMulti(savebrief_t & sv, bool isAutoSave)
|
||||
{
|
||||
CONFIG_WriteSetup(2);
|
||||
|
||||
if (g_netServer || ud.multimode > 1)
|
||||
{
|
||||
Bstrcpy(apStrings[QUOTE_RESERVED4], "Multiplayer Saving Not Yet Supported");
|
||||
|
|
|
@ -55,7 +55,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
BEGIN_SW_NS
|
||||
|
||||
extern void ReadGameSetup(int32_t scripthandle);
|
||||
extern void WriteGameSetup(int32_t scripthandle);
|
||||
|
||||
//
|
||||
// Comm variables
|
||||
|
@ -71,18 +70,6 @@ int32_t NumberPlayers,CommPort,PortSpeed,IrqNumber,UartAddress;
|
|||
|
||||
int32_t UseMouse = 1, UseJoystick = 0;
|
||||
|
||||
int32_t MouseButtons[MAXMOUSEBUTTONS];
|
||||
int32_t MouseButtonsClicked[MAXMOUSEBUTTONS];
|
||||
int32_t MouseDigitalAxes[MAXMOUSEAXES][2];
|
||||
int32_t MouseAnalogAxes[MAXMOUSEAXES];
|
||||
int32_t MouseAnalogScale[MAXMOUSEAXES];
|
||||
int32_t JoystickButtons[MAXJOYBUTTONS];
|
||||
int32_t JoystickButtonsClicked[MAXJOYBUTTONS];
|
||||
int32_t JoystickDigitalAxes[MAXJOYAXES][2];
|
||||
int32_t JoystickAnalogAxes[MAXJOYAXES];
|
||||
int32_t JoystickAnalogScale[MAXJOYAXES];
|
||||
int32_t JoystickAnalogDead[MAXJOYAXES];
|
||||
int32_t JoystickAnalogSaturate[MAXJOYAXES];
|
||||
|
||||
//
|
||||
// Screen variables
|
||||
|
@ -154,40 +141,8 @@ void CONFIG_SetDefaults(void)
|
|||
Bstrcpy(WangBangMacro[8], MACRO9);
|
||||
Bstrcpy(WangBangMacro[9], MACRO10);
|
||||
|
||||
SetMouseDefaults(0);
|
||||
//SetMouseDefaults(0);
|
||||
|
||||
memset(MouseDigitalAxes, -1, sizeof(MouseDigitalAxes));
|
||||
for (i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
MouseAnalogScale[i] = 65536;
|
||||
|
||||
MouseDigitalAxes[i][0] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2]);
|
||||
MouseDigitalAxes[i][1] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2+1]);
|
||||
|
||||
MouseAnalogAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]);
|
||||
}
|
||||
in_mousesensitivity = float(gs.MouseSpeed); // [JM] Temporary !CHECKME!
|
||||
|
||||
memset(JoystickButtons, -1, sizeof(JoystickButtons));
|
||||
memset(JoystickButtonsClicked, -1, sizeof(JoystickButtonsClicked));
|
||||
for (i=0; i < (int32_t)(sizeof(joystickdefaults)/sizeof(char *)); i++)
|
||||
{
|
||||
JoystickButtons[i] = CONFIG_FunctionNameToNum(joystickdefaults[i]);
|
||||
JoystickButtonsClicked[i] = CONFIG_FunctionNameToNum(joystickclickeddefaults[i]);
|
||||
}
|
||||
|
||||
memset(JoystickDigitalAxes, -1, sizeof(JoystickDigitalAxes));
|
||||
for (i=0; i < MAXJOYAXES; i++)
|
||||
{
|
||||
JoystickAnalogScale[i] = 65536;
|
||||
JoystickAnalogDead[i] = 1024;
|
||||
JoystickAnalogSaturate[i] = 32767-1024;
|
||||
|
||||
JoystickDigitalAxes[i][0] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2]);
|
||||
JoystickDigitalAxes[i][1] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2+1]);
|
||||
|
||||
JoystickAnalogAxes[i] = CONFIG_AnalogNameToNum(joystickanalogdefaults[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -196,247 +151,6 @@ void SetDefaultKeyDefinitions(int style)
|
|||
CONFIG_SetDefaultKeys(style ? "demolition/defbinds.txt" : "demolition/origbinds.txt");
|
||||
}
|
||||
|
||||
void SetMouseDefaults(int style)
|
||||
{
|
||||
int nummousedefaults;
|
||||
const char **mousedefaultset, **mouseclickeddefaultset;
|
||||
int i;
|
||||
|
||||
if (style)
|
||||
{
|
||||
nummousedefaults = sizeof(mousedefaults_modern) / sizeof(char *);
|
||||
mousedefaultset = mousedefaults_modern;
|
||||
mouseclickeddefaultset = mouseclickeddefaults_modern;
|
||||
}
|
||||
else
|
||||
{
|
||||
nummousedefaults = sizeof(mousedefaults) / sizeof(char *);
|
||||
mousedefaultset = mousedefaults;
|
||||
mouseclickeddefaultset = mouseclickeddefaults;
|
||||
}
|
||||
|
||||
memset(MouseButtons, -1, sizeof(MouseButtons));
|
||||
memset(MouseButtonsClicked, -1, sizeof(MouseButtonsClicked));
|
||||
for (i=0; i < nummousedefaults; i++)
|
||||
{
|
||||
MouseButtons[i] = CONFIG_FunctionNameToNum(mousedefaultset[i]);
|
||||
CONTROL_MapButton(MouseButtons[i], i, FALSE, controldevice_mouse);
|
||||
|
||||
if (i<4) continue;
|
||||
|
||||
MouseButtonsClicked[i] = CONFIG_FunctionNameToNum(mouseclickeddefaultset[i]);
|
||||
CONTROL_MapButton(MouseButtonsClicked[i], i, TRUE, controldevice_mouse);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= CONFIG_ReadKeys
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void CONFIG_ReadKeys(int32_t scripthandle)
|
||||
{
|
||||
int32_t i;
|
||||
int32_t numkeyentries;
|
||||
int32_t function;
|
||||
char keyname1[80];
|
||||
char keyname2[80];
|
||||
kb_scancode key1,key2;
|
||||
|
||||
if (scripthandle < 0) return;
|
||||
|
||||
numkeyentries = SCRIPT_NumberEntries(scripthandle,"KeyDefinitions");
|
||||
|
||||
for (i=0; i<numkeyentries; i++)
|
||||
{
|
||||
function = CONFIG_FunctionNameToNum(SCRIPT_Entry(scripthandle,"KeyDefinitions", i));
|
||||
if (function != -1)
|
||||
{
|
||||
memset(keyname1,0,sizeof(keyname1));
|
||||
memset(keyname2,0,sizeof(keyname2));
|
||||
SCRIPT_GetDoubleString
|
||||
(
|
||||
scripthandle,
|
||||
"KeyDefinitions",
|
||||
SCRIPT_Entry(scripthandle, "KeyDefinitions", i),
|
||||
keyname1,
|
||||
keyname2
|
||||
);
|
||||
key1 = 0xff;
|
||||
key2 = 0xff;
|
||||
if (keyname1[0])
|
||||
{
|
||||
key1 = (uint8_t) KB_StringToScanCode(keyname1);
|
||||
}
|
||||
if (keyname2[0])
|
||||
{
|
||||
key2 = (uint8_t) KB_StringToScanCode(keyname2);
|
||||
}
|
||||
KeyboardKeys[function][0] = key1;
|
||||
KeyboardKeys[function][1] = key2;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<NUMGAMEFUNCTIONS; i++)
|
||||
{
|
||||
if (i == gamefunc_Show_Console)
|
||||
OSD_CaptureKey(KeyboardKeys[i][0]);
|
||||
#if 0
|
||||
// [JM] Needs to be re-done. !CHECKME!
|
||||
else
|
||||
CONTROL_MapKey(i, KeyboardKeys[i][0], KeyboardKeys[i][1]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= CONFIG_SetupMouse
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void CONFIG_SetupMouse(void)
|
||||
{
|
||||
int32_t i;
|
||||
char str[80];// , * p;
|
||||
char temp[80];
|
||||
int32_t function, scale;
|
||||
|
||||
if (scripthandle < 0) return;
|
||||
|
||||
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
Bsprintf(str,"MouseButton%d",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle,"Controls", str,temp))
|
||||
MouseButtons[i] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseButtonClicked%d",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle,"Controls", str,temp))
|
||||
MouseButtonsClicked[i] = CONFIG_FunctionNameToNum(temp);
|
||||
}
|
||||
|
||||
// map over the axes
|
||||
for (i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
Bsprintf(str,"MouseAnalogAxes%d",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
MouseAnalogAxes[i] = CONFIG_AnalogNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseDigitalAxes%d_0",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
MouseDigitalAxes[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseDigitalAxes%d_1",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
MouseDigitalAxes[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"MouseAnalogScale%d",i);
|
||||
scale = MouseAnalogScale[i];
|
||||
SCRIPT_GetNumber(scripthandle, "Controls", str,&scale);
|
||||
MouseAnalogScale[i] = scale;
|
||||
}
|
||||
|
||||
// 0 to 65536
|
||||
SCRIPT_GetNumber(scripthandle, "Controls","MouseSensitivity",&function);
|
||||
gs.MouseSpeed = function;
|
||||
|
||||
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
{
|
||||
CONTROL_MapButton(MouseButtons[i], i, FALSE, controldevice_mouse);
|
||||
CONTROL_MapButton(MouseButtonsClicked[i], i, TRUE, controldevice_mouse);
|
||||
}
|
||||
for (i=0; i<MAXMOUSEAXES; i++)
|
||||
{
|
||||
CONTROL_MapAnalogAxis(i, MouseAnalogAxes[i], controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalAxes[i][0], 0,controldevice_mouse);
|
||||
CONTROL_MapDigitalAxis(i, MouseDigitalAxes[i][1], 1,controldevice_mouse);
|
||||
CONTROL_SetAnalogAxisScale(i, MouseAnalogScale[i], controldevice_mouse);
|
||||
}
|
||||
|
||||
in_mousesensitivity = float(gs.MouseSpeed); // [JM] Temporary !CHECKME!
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= CONFIG_SetupJoystick
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void CONFIG_SetupJoystick(void)
|
||||
{
|
||||
int32_t i;
|
||||
char str[80];// , * p;
|
||||
char temp[80];
|
||||
int32_t /*function,*/ scale;
|
||||
|
||||
if (scripthandle < 0) return;
|
||||
|
||||
for (i=0; i<MAXJOYBUTTONS; i++)
|
||||
{
|
||||
Bsprintf(str,"JoystickButton%d",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle,"Controls", str,temp))
|
||||
JoystickButtons[i] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickButtonClicked%d",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle,"Controls", str,temp))
|
||||
JoystickButtonsClicked[i] = CONFIG_FunctionNameToNum(temp);
|
||||
}
|
||||
|
||||
// map over the axes
|
||||
for (i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
Bsprintf(str,"JoystickAnalogAxes%d",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
JoystickAnalogAxes[i] = CONFIG_AnalogNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickDigitalAxes%d_0",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
JoystickDigitalAxes[i][0] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickDigitalAxes%d_1",i); temp[0] = 0;
|
||||
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
|
||||
JoystickDigitalAxes[i][1] = CONFIG_FunctionNameToNum(temp);
|
||||
|
||||
Bsprintf(str,"JoystickAnalogScale%d",i);
|
||||
scale = JoystickAnalogScale[i];
|
||||
SCRIPT_GetNumber(scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogScale[i] = scale;
|
||||
|
||||
Bsprintf(str,"JoystickAnalogDead%d",i);
|
||||
scale = JoystickAnalogDead[i];
|
||||
SCRIPT_GetNumber(scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogDead[i] = scale;
|
||||
|
||||
Bsprintf(str,"JoystickAnalogSaturate%d",i);
|
||||
scale = JoystickAnalogSaturate[i];
|
||||
SCRIPT_GetNumber(scripthandle, "Controls", str,&scale);
|
||||
JoystickAnalogSaturate[i] = scale;
|
||||
}
|
||||
|
||||
for (i=0; i<MAXJOYBUTTONS; i++)
|
||||
{
|
||||
CONTROL_MapButton(JoystickButtons[i], i, FALSE, controldevice_joystick);
|
||||
CONTROL_MapButton(JoystickButtonsClicked[i], i, TRUE, controldevice_joystick);
|
||||
}
|
||||
for (i=0; i<MAXJOYAXES; i++)
|
||||
{
|
||||
CONTROL_MapAnalogAxis(i, JoystickAnalogAxes[i], controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalAxes[i][0], 0, controldevice_joystick);
|
||||
CONTROL_MapDigitalAxis(i, JoystickDigitalAxes[i][1], 1, controldevice_joystick);
|
||||
CONTROL_SetAnalogAxisScale(i, JoystickAnalogScale[i], controldevice_joystick);
|
||||
//CONTROL_SetJoyAxisDead(i, JoystickAnalogDead[i]);
|
||||
//CONTROL_SetJoyAxisSaturate(i, JoystickAnalogSaturate[i]);
|
||||
joySetDeadZone(i, JoystickAnalogDead[i], JoystickAnalogSaturate[i]); // [JM] !CHECKME!
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
|
@ -463,11 +177,6 @@ int32_t CONFIG_ReadSetup(void)
|
|||
// What was here is no longer needed with a globally stored config that's being read automatically.
|
||||
ReadGameSetup(scripthandle);
|
||||
|
||||
CONFIG_ReadKeys(scripthandle);
|
||||
|
||||
//CONFIG_SetupMouse(scripthandle);
|
||||
//CONFIG_SetupJoystick(scripthandle);
|
||||
|
||||
if (PlayerNameArg[0] != '\0')
|
||||
{
|
||||
strcpy(CommPlayerName, PlayerNameArg);
|
||||
|
@ -475,93 +184,4 @@ int32_t CONFIG_ReadSetup(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= CONFIG_WriteSetup
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void CONFIG_WriteSetup(void)
|
||||
{
|
||||
#if 0
|
||||
int32_t dummy;
|
||||
char buf[80];
|
||||
|
||||
if (scripthandle < 0)
|
||||
scripthandle = SCRIPT_Init(setupfilename);
|
||||
|
||||
// What was here is no longer needed with a globally stored config that's being written automatically.
|
||||
|
||||
|
||||
WriteGameSetup(scripthandle);
|
||||
|
||||
for (dummy=0; dummy<NUMGAMEFUNCTIONS; dummy++)
|
||||
{
|
||||
SCRIPT_PutDoubleString(scripthandle, "KeyDefinitions", CONFIG_FunctionNumToName(dummy),
|
||||
KB_ScanCodeToString(KeyboardKeys[dummy][0]), KB_ScanCodeToString(KeyboardKeys[dummy][1]));
|
||||
}
|
||||
|
||||
for (dummy=0; dummy<MAXMOUSEBUTTONS; dummy++)
|
||||
{
|
||||
Bsprintf(buf,"MouseButton%d",dummy);
|
||||
SCRIPT_PutString(scripthandle,"Controls", buf, CONFIG_FunctionNumToName(MouseButtons[dummy]));
|
||||
|
||||
if (dummy >= (MAXMOUSEBUTTONS-2)) continue; // scroll wheel
|
||||
|
||||
Bsprintf(buf,"MouseButtonClicked%d",dummy);
|
||||
SCRIPT_PutString(scripthandle,"Controls", buf, CONFIG_FunctionNumToName(MouseButtonsClicked[dummy]));
|
||||
}
|
||||
|
||||
for (dummy=0; dummy<MAXMOUSEAXES; dummy++)
|
||||
{
|
||||
Bsprintf(buf,"MouseAnalogAxes%d",dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_AnalogNumToName(MouseAnalogAxes[dummy]));
|
||||
|
||||
Bsprintf(buf,"MouseDigitalAxes%d_0",dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseDigitalAxes[dummy][0]));
|
||||
|
||||
Bsprintf(buf,"MouseDigitalAxes%d_1",dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(MouseDigitalAxes[dummy][1]));
|
||||
|
||||
Bsprintf(buf,"MouseAnalogScale%d",dummy);
|
||||
SCRIPT_PutNumber(scripthandle, "Controls", buf, MouseAnalogScale[dummy], FALSE, FALSE);
|
||||
}
|
||||
|
||||
for (dummy=0; dummy<MAXJOYBUTTONS; dummy++)
|
||||
{
|
||||
Bsprintf(buf,"JoystickButton%d",dummy);
|
||||
SCRIPT_PutString(scripthandle,"Controls", buf, CONFIG_FunctionNumToName(JoystickButtons[dummy]));
|
||||
|
||||
Bsprintf(buf,"JoystickButtonClicked%d",dummy);
|
||||
SCRIPT_PutString(scripthandle,"Controls", buf, CONFIG_FunctionNumToName(JoystickButtonsClicked[dummy]));
|
||||
}
|
||||
|
||||
for (dummy=0; dummy<MAXJOYAXES; dummy++)
|
||||
{
|
||||
Bsprintf(buf,"JoystickAnalogAxes%d",dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_AnalogNumToName(JoystickAnalogAxes[dummy]));
|
||||
|
||||
Bsprintf(buf,"JoystickDigitalAxes%d_0",dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickDigitalAxes[dummy][0]));
|
||||
|
||||
Bsprintf(buf,"JoystickDigitalAxes%d_1",dummy);
|
||||
SCRIPT_PutString(scripthandle, "Controls", buf, CONFIG_FunctionNumToName(JoystickDigitalAxes[dummy][1]));
|
||||
|
||||
Bsprintf(buf,"JoystickAnalogScale%d",dummy);
|
||||
SCRIPT_PutNumber(scripthandle, "Controls", buf, JoystickAnalogScale[dummy], FALSE, FALSE);
|
||||
|
||||
Bsprintf(buf,"JoystickAnalogDead%d",dummy);
|
||||
SCRIPT_PutNumber(scripthandle, "Controls", buf, JoystickAnalogDead[dummy], FALSE, FALSE);
|
||||
|
||||
Bsprintf(buf,"JoystickAnalogSaturate%d",dummy);
|
||||
SCRIPT_PutNumber(scripthandle, "Controls", buf, JoystickAnalogSaturate[dummy], FALSE, FALSE);
|
||||
}
|
||||
|
||||
SCRIPT_Save(scripthandle, setupfilename);
|
||||
SCRIPT_Free(scripthandle);
|
||||
#endif
|
||||
}
|
||||
|
||||
END_SW_NS
|
||||
|
|
|
@ -47,12 +47,14 @@ extern int32_t VesaBufferMode;
|
|||
extern int32_t ForceSetup;
|
||||
|
||||
|
||||
#if 0
|
||||
// comm externs
|
||||
extern int32_t ComPort;
|
||||
extern int32_t IrqNumber;
|
||||
extern int32_t UartAddress;
|
||||
extern int32_t PortSpeed;
|
||||
|
||||
|
||||
extern int32_t ToneDial;
|
||||
extern char ModemName[MAXMODEMSTRING];
|
||||
extern char InitString[MAXMODEMSTRING];
|
||||
|
@ -71,44 +73,17 @@ extern char UserLevel[MAXUSERLEVELNAMELENGTH];
|
|||
extern char RTSPath[MAXRTSPATHLENGTH];
|
||||
extern char UserPath[MAXUSERLEVELPATHLENGTH];
|
||||
|
||||
#endif
|
||||
// controller externs
|
||||
extern int32_t UseMouse, UseJoystick;
|
||||
extern int32_t JoystickPort;
|
||||
extern int32_t MouseSensitivity;
|
||||
extern int32_t MouseAiming;
|
||||
extern int32_t MouseAimingFlipped;
|
||||
|
||||
extern int32_t MouseButtons[MAXMOUSEBUTTONS];
|
||||
extern int32_t MouseButtonsClicked[MAXMOUSEBUTTONS];
|
||||
|
||||
extern int32_t JoystickButtons[MAXJOYBUTTONS];
|
||||
extern int32_t JoystickButtonsClicked[MAXJOYBUTTONS];
|
||||
|
||||
extern int32_t MouseAnalogAxes[MAXMOUSEAXES];
|
||||
extern int32_t JoystickAnalogAxes[MAXJOYAXES];
|
||||
extern int32_t MouseAnalogScale[MAXMOUSEAXES];
|
||||
extern int32_t JoystickAnalogScale[MAXJOYAXES];
|
||||
extern int32_t JoystickAnalogDead[MAXJOYAXES];
|
||||
extern int32_t JoystickAnalogSaturate[MAXJOYAXES];
|
||||
|
||||
extern int32_t EnableRudder;
|
||||
|
||||
extern int32_t MouseDigitalAxes[MAXMOUSEAXES][2];
|
||||
extern int32_t JoystickDigitalAxes[MAXJOYAXES][2];
|
||||
|
||||
extern char setupfilename[BMAX_PATH];
|
||||
extern char ExternalControlFilename[64];
|
||||
|
||||
//style=0: classic
|
||||
//style=1: modern
|
||||
void SetMouseDefaults(int style);
|
||||
void SetJoystickDefaults(void);
|
||||
void SetDefaultKeyDefinitions(int style);
|
||||
|
||||
int32_t CONFIG_ReadSetup(void);
|
||||
void CONFIG_SetupMouse(void);
|
||||
void CONFIG_SetupJoystick(void);
|
||||
void CONFIG_WriteSetup(void);
|
||||
void WriteCommitFile(int32_t gametype);
|
||||
void CONFIG_GetSetupFilename(void);
|
||||
|
||||
|
|
|
@ -5018,6 +5018,7 @@ getinput(SW_PACKET *loc)
|
|||
// MAKE SURE THIS WILL GET SET
|
||||
SET_LOC_KEY(loc->bits, SK_QUIT_GAME, MultiPlayQuitFlag);
|
||||
|
||||
#if 0 // What kind of crap is this...?
|
||||
if (gs.MouseAimingType == 1) // while held
|
||||
{
|
||||
if (BUTTON(gamefunc_Mouse_Aiming))
|
||||
|
@ -5066,6 +5067,7 @@ getinput(SW_PACKET *loc)
|
|||
CONTROL_MapAnalogAxis(1, mouseaxis, controldevice_mouse);
|
||||
MouseYAxisMode = mouseaxis;
|
||||
}
|
||||
#endif
|
||||
|
||||
CONTROL_GetInput(&info);
|
||||
|
||||
|
|
|
@ -1087,6 +1087,7 @@ static SWBOOL MNU_MouseButtonPostProcess(MenuItem_p item)
|
|||
|
||||
SWBOOL MNU_MouseButtonSetupCustom(UserCall call, MenuItem_p item)
|
||||
{
|
||||
#if 0
|
||||
static int currentfunc = 0;
|
||||
|
||||
if (call == uc_touchup)
|
||||
|
@ -1144,12 +1145,13 @@ SWBOOL MNU_MouseButtonSetupCustom(UserCall call, MenuItem_p item)
|
|||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static SWBOOL MNU_SetMouseButtonFunctions(MenuItem_p item)
|
||||
{
|
||||
#if 0
|
||||
int button, clicked, function;
|
||||
char *p;
|
||||
|
||||
|
@ -1179,6 +1181,7 @@ static SWBOOL MNU_SetMouseButtonFunctions(MenuItem_p item)
|
|||
*p = ' ';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1193,6 +1196,7 @@ static SWBOOL MNU_MouseDigitalPostProcess(MenuItem_p item)
|
|||
|
||||
static SWBOOL MNU_MouseDigitalSetupCustom(UserCall call, MenuItem_p item)
|
||||
{
|
||||
#if 0
|
||||
static int currentfunc = 0;
|
||||
|
||||
if (call == uc_touchup)
|
||||
|
@ -1235,12 +1239,13 @@ static SWBOOL MNU_MouseDigitalSetupCustom(UserCall call, MenuItem_p item)
|
|||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static SWBOOL MNU_SetAdvancedMouseFunctions(MenuItem_p item)
|
||||
{
|
||||
#if 0
|
||||
int axis;
|
||||
char *p;
|
||||
|
||||
|
@ -1260,6 +1265,7 @@ static SWBOOL MNU_SetAdvancedMouseFunctions(MenuItem_p item)
|
|||
*p = ' ';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1384,6 +1390,7 @@ static SWBOOL MNU_JoystickButtonPostProcess(MenuItem_p item)
|
|||
|
||||
static SWBOOL MNU_JoystickButtonSetupCustom(UserCall call, MenuItem *item)
|
||||
{
|
||||
#if 0
|
||||
static int currentfunc = 0;
|
||||
|
||||
if (call == uc_touchup)
|
||||
|
@ -1442,7 +1449,7 @@ static SWBOOL MNU_JoystickButtonSetupCustom(UserCall call, MenuItem *item)
|
|||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1457,6 +1464,7 @@ static SWBOOL MNU_JoystickButtonNextPage(void)
|
|||
|
||||
static SWBOOL MNU_SetJoystickButtonFunctions(MenuItem_p item)
|
||||
{
|
||||
#if 0
|
||||
int button, clicked, function;
|
||||
char *p;
|
||||
|
||||
|
@ -1485,6 +1493,7 @@ static SWBOOL MNU_SetJoystickButtonFunctions(MenuItem_p item)
|
|||
*p = ' ';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1493,6 +1502,7 @@ static MenuItem_p joystick_axis_item = NULL;
|
|||
|
||||
static SWBOOL MNU_JoystickAxesInitialise(MenuItem_p mitem)
|
||||
{
|
||||
#if 0
|
||||
if (!CONTROL_JoyPresent)
|
||||
{
|
||||
return TRUE;
|
||||
|
@ -1508,7 +1518,7 @@ static SWBOOL MNU_JoystickAxesInitialise(MenuItem_p mitem)
|
|||
slidersettings[sldr_joyaxisscale] = JoystickAnalogScale[JoystickAxisPage] >> 13;
|
||||
slidersettings[sldr_joyaxisdead] = JoystickAnalogDead[JoystickAxisPage] >> 10;
|
||||
slidersettings[sldr_joyaxissatur] = JoystickAnalogSaturate[JoystickAxisPage] >> 10;
|
||||
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1520,6 +1530,7 @@ static SWBOOL MNU_JoystickAxisPostProcess(MenuItem_p item)
|
|||
|
||||
static SWBOOL MNU_JoystickAxisSetupCustom(UserCall call, MenuItem *item)
|
||||
{
|
||||
#if 0
|
||||
static int currentfunc = 0;
|
||||
|
||||
if (call == uc_touchup)
|
||||
|
@ -1563,7 +1574,7 @@ static SWBOOL MNU_JoystickAxisSetupCustom(UserCall call, MenuItem *item)
|
|||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1578,6 +1589,7 @@ static SWBOOL MNU_JoystickAxisNextPage(void)
|
|||
|
||||
static SWBOOL MNU_SetJoystickAxisFunctions(MenuItem_p item)
|
||||
{
|
||||
#if 0
|
||||
int function;
|
||||
char *p;
|
||||
|
||||
|
@ -1595,6 +1607,7 @@ static SWBOOL MNU_SetJoystickAxisFunctions(MenuItem_p item)
|
|||
*p = ' ';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1872,15 +1885,15 @@ MNU_OrderCustom(UserCall call, MenuItem *item)
|
|||
|
||||
SWBOOL MNU_LoadModernDefaults(void)
|
||||
{
|
||||
SetDefaultKeyDefinitions(1);
|
||||
SetMouseDefaults(1);
|
||||
//SetDefaultKeyDefinitions(1);
|
||||
//SetMouseDefaults(1);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
SWBOOL MNU_LoadClassicDefaults(void)
|
||||
{
|
||||
SetDefaultKeyDefinitions(0);
|
||||
SetMouseDefaults(0);
|
||||
//SetDefaultKeyDefinitions(0);
|
||||
//SetMouseDefaults(0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -2253,8 +2266,8 @@ MNU_InitMenus(void)
|
|||
buttonsettings[btn_friendlyfire] = gs.NetHurtTeammate;
|
||||
buttonsettings[btn_parental] = gs.ParentalLock;
|
||||
|
||||
slidersettings[sldr_mousescalex] = MouseAnalogScale[0]>>13;
|
||||
slidersettings[sldr_mousescaley] = MouseAnalogScale[1]>>13;
|
||||
//slidersettings[sldr_mousescalex] = MouseAnalogScale[0]>>13;
|
||||
//slidersettings[sldr_mousescaley] = MouseAnalogScale[1]>>13;
|
||||
|
||||
slidersettings[sldr_joyaxisscale] = 0;
|
||||
slidersettings[sldr_joyaxisanalog] = 0;
|
||||
|
@ -3895,7 +3908,7 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
|
|||
if (slidersettings[item->slider] != offset)
|
||||
{
|
||||
slidersettings[item->slider] = offset;
|
||||
MouseAnalogScale[item->slider - sldr_mousescalex] = offset<<13;
|
||||
//MouseAnalogScale[item->slider - sldr_mousescalex] = offset<<13;
|
||||
CONTROL_SetAnalogAxisScale(item->slider - sldr_mousescalex, offset<<13, controldevice_mouse);
|
||||
}
|
||||
|
||||
|
@ -3916,7 +3929,7 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
|
|||
if (slidersettings[item->slider] != offset)
|
||||
{
|
||||
slidersettings[item->slider] = offset;
|
||||
JoystickAnalogScale[JoystickAxisPage] = offset<<13;
|
||||
//JoystickAnalogScale[JoystickAxisPage] = offset<<13;
|
||||
CONTROL_SetAnalogAxisScale(JoystickAxisPage, offset<<13, controldevice_joystick);
|
||||
}
|
||||
|
||||
|
@ -3940,7 +3953,7 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
|
|||
if (slidersettings[item->slider] != offset)
|
||||
{
|
||||
slidersettings[item->slider] = offset;
|
||||
JoystickAnalogAxes[JoystickAxisPage] = MNU_ControlAxisNum(offset);
|
||||
//JoystickAnalogAxes[JoystickAxisPage] = MNU_ControlAxisNum(offset);
|
||||
CONTROL_MapAnalogAxis(JoystickAxisPage, MNU_ControlAxisNum(offset), controldevice_joystick);
|
||||
}
|
||||
|
||||
|
@ -3967,16 +3980,16 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
|
|||
slidersettings[item->slider] = offset;
|
||||
if (item->slider == sldr_joyaxisdead)
|
||||
{
|
||||
JoystickAnalogDead[JoystickAxisPage] = min((offset<<10), 32767);
|
||||
//JoystickAnalogDead[JoystickAxisPage] = min((offset<<10), 32767);
|
||||
//CONTROL_SetJoyAxisDead(JoystickAxisPage, JoystickAnalogDead[JoystickAxisPage]);
|
||||
}
|
||||
else
|
||||
{
|
||||
JoystickAnalogSaturate[JoystickAxisPage] = min((offset<<10), 32767);
|
||||
//JoystickAnalogSaturate[JoystickAxisPage] = min((offset<<10), 32767);
|
||||
//CONTROL_SetJoyAxisSaturate(JoystickAxisPage, JoystickAnalogSaturate[JoystickAxisPage]);
|
||||
}
|
||||
|
||||
joySetDeadZone(JoystickAxisPage, JoystickAnalogDead[JoystickAxisPage], JoystickAnalogSaturate[JoystickAxisPage]); // [JM] !CHECKME!
|
||||
//joySetDeadZone(JoystickAxisPage, JoystickAnalogDead[JoystickAxisPage], JoystickAnalogSaturate[JoystickAxisPage]); // [JM] !CHECKME!
|
||||
}
|
||||
|
||||
sprintf(tmp_text, "%.2f%%", (float)(slidersettings[item->slider]<<10) / 32767.f);
|
||||
|
|
|
@ -109,7 +109,7 @@ void InitSetup(void)
|
|||
CONTROL_PrintAxes();
|
||||
}*/
|
||||
|
||||
RTS_Init(RTSName);
|
||||
//RTS_Init(RTSName);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -356,6 +356,6 @@ void WriteGameSetup(int32_t scripthandle)
|
|||
void TermSetup(void)
|
||||
{
|
||||
extern SWBOOL BotMode;
|
||||
CONFIG_WriteSetup();
|
||||
//CONFIG_WriteSetup();
|
||||
}
|
||||
END_SW_NS
|
||||
|
|
Loading…
Reference in a new issue