- in_mouse and in_joystick

This commit is contained in:
Christoph Oelckers 2019-10-23 00:41:28 +02:00
parent 8f06f0748d
commit 7501120dc8
17 changed files with 30 additions and 74 deletions

View file

@ -273,17 +273,10 @@ void CONFIG_SetDefaults(void)
#else
gSetup.bpp = 8;
#endif
#ifdef GEKKO
gSetup.usejoystick = 1;
#else
gSetup.usejoystick = 0;
#endif
gSetup.forcesetup = 1;
gSetup.noautoload = 1;
gSetup.fullscreen = 1;
gSetup.usemouse = 1;
//snd_ambience = 1;
//ud.config.AutoAim = 1;
@ -829,7 +822,7 @@ void CONFIG_WriteSetup(uint32_t flags)
SCRIPT_PutNumber(scripthandle, "Updates", "LastUpdateCheck", LastUpdateCheck, FALSE, FALSE);
#endif
if (gSetup.usemouse)
if (in_mouse)
{
for (int i=0; i<MAXMOUSEBUTTONS; i++)
{
@ -876,7 +869,7 @@ void CONFIG_WriteSetup(uint32_t flags)
}
}
if (gSetup.usejoystick)
if (in_joystick)
{
for (int dummy=0; dummy<MAXJOYBUTTONSANDHATS; dummy++)
{

View file

@ -77,8 +77,8 @@ void ctrlInit(void)
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
CONTROL_JoystickEnabled = (gSetup.usejoystick && CONTROL_JoyPresent);
CONTROL_MouseEnabled = (gSetup.usemouse && CONTROL_MousePresent);
CONTROL_JoystickEnabled = (in_joystick && CONTROL_JoyPresent);
CONTROL_MouseEnabled = (in_mouse && CONTROL_MousePresent);
CONTROL_SmoothMouse = SmoothInput;
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too

View file

@ -28,8 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS
typedef struct {
int32_t usejoystick;
int32_t usemouse;
int32_t fullscreen;
int32_t xdim;
int32_t ydim;

View file

@ -952,7 +952,7 @@ static MenuEntry_t *MEL_TOUCHSENS [] = {
};
#endif
static MenuOption_t MEO_JOYSTICK_ENABLE = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.setup.usejoystick );
static MenuOption_t MEO_JOYSTICK_ENABLE = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &in_joystick.Value );
static MenuEntry_t ME_JOYSTICK_ENABLE = MAKE_MENUENTRY( "Enable Gamepad:", &MF_Redfont, &MEF_BigOptionsRtSections, &MEO_JOYSTICK_ENABLE, Option );
MAKE_MENU_TOP_ENTRYLINK( "Edit Buttons", MEF_BigOptionsRtSections, JOYSTICK_EDITBUTTONS, MENU_JOYSTICKBTNS );

View file

@ -790,14 +790,6 @@ static int osdcmd_cvar_set_game(osdcmdptr_t parm)
r_ambientlightrecip = 256.f;
else r_ambientlightrecip = 1.f/r_ambientlight;
}
else if (!Bstrcasecmp(parm->name, "in_mouse"))
{
CONTROL_MouseEnabled = (gSetup.usemouse && CONTROL_MousePresent);
}
else if (!Bstrcasecmp(parm->name, "in_joystick"))
{
CONTROL_JoystickEnabled = (gSetup.usejoystick && CONTROL_JoyPresent);
}
else if (!Bstrcasecmp(parm->name, "vid_gamma"))
{
gBrightness = GAMMA_CALC;

View file

@ -3,6 +3,7 @@
#include "fx_man.h"
#include "baselayer.h"
#include "gameconfigfile.h"
#include "control.h"
/* Notes
@ -219,6 +220,16 @@ CUSTOM_CVARD(Int, r_fov, 90, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "change the field o
CVARD(Bool, r_horizcenter, false, CVAR_ARCHIVE|CVAR_FRONTEND_BLOOD, "enable/disable centered horizon line") // only present in Blood, maybe add to others?
CUSTOM_CVARD(Bool, in_joystick, false, CVAR_ARCHIVE|CVAR_NOINITCALL, "enables input from the joystick if it is present")
{
CONTROL_JoystickEnabled = (self && CONTROL_JoyPresent);
}
CUSTOM_CVARD(Bool, in_mouse, true, CVAR_ARCHIVE|CVAR_NOINITCALL, "enables input from the mouse if it is present")
{
CONTROL_MouseEnabled = (self && CONTROL_MousePresent);
}
#if 0
@ -226,9 +237,6 @@ CVARD(Bool, r_horizcenter, false, CVAR_ARCHIVE|CVAR_FRONTEND_BLOOD, "enable/disa
static osdcvardata_t cvars_game[] =
{
{ "in_joystick","enables input from the joystick if it is present",(void *)&ud.setup.usejoystick, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
{ "in_mouse","enables input from the mouse if it is present",(void *)&ud.setup.usemouse, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
{ "in_aimmode", "0:toggle, 1:hold to aim", (void *)&ud.mouseaiming, CVAR_BOOL, 0, 1 },
{
"in_mousebias", "emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time",
@ -280,10 +288,6 @@ CVARD(Bool, r_horizcenter, false, CVAR_ARCHIVE|CVAR_FRONTEND_BLOOD, "enable/disa
static osdcvardata_t cvars_game[] =
{
{ "in_joystick","enables input from the joystick if it is present",(void *)&ud.setup.usejoystick, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
{ "in_mouse","enables input from the mouse if it is present",(void *)&ud.setup.usemouse, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
{ "in_aimmode", "0:toggle, 1:hold to aim", (void *)&ud.mouseaiming, CVAR_BOOL, 0, 1 },
{
"in_mousebias", "emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time",
@ -338,9 +342,6 @@ int32_t registerosdcommands(void)
char buffer[256];
static osdcvardata_t cvars_game[] =
{
{ "in_joystick","enables input from the joystick if it is present",(void *)&gSetup.usejoystick, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
{ "in_mouse","enables input from the mouse if it is present",(void *)&gSetup.usemouse, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
{ "in_aimmode", "0:toggle, 1:hold to aim", (void *)&gMouseAiming, CVAR_BOOL, 0, 1 },
{
"in_mousebias", "emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time",

View file

@ -58,6 +58,9 @@ EXTERN_CVAR(Int, r_fov)
EXTERN_CVAR(r_horizcenter)
EXTERN_CVAR(in_joystick)
EXTERN_CVAR(in_mouse)
extern int hud_statusbarrange; // will be set by the game's configuration setup.
bool G_ChangeHudLayout(int direction);
bool G_CheckAutorun(bool button);

View file

@ -230,17 +230,12 @@ void CONFIG_SetDefaults(void)
ud.camera_time = 4;
#endif
// currently settings.cfg is only read after the startup window launches the game,
// and rereading binds might be fickle so just enable this
ud.setup.usejoystick = 1;
g_myAimMode = 1;
g_player[0].ps->aim_mode = 1;
ud.setup.forcesetup = 1;
ud.setup.noautoload = 1;
ud.setup.fullscreen = 1;
ud.setup.usemouse = 1;
ud.althud = 1;
ud.angleinterpolation = 0;
@ -971,7 +966,7 @@ void CONFIG_WriteSetup(uint32_t flags)
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, FALSE, FALSE);
#endif
if (ud.setup.usemouse)
if (in_mouse)
{
for (int i=0; i<MAXMOUSEBUTTONS; i++)
{
@ -1015,7 +1010,7 @@ void CONFIG_WriteSetup(uint32_t flags)
}
}
if (ud.setup.usejoystick)
if (in_joystick)
{
for (int dummy=0; dummy<MAXJOYBUTTONSANDHATS; dummy++)
{

View file

@ -6563,8 +6563,8 @@ int app_main(int argc, const char * const*argv)
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
CONTROL_JoystickEnabled = (ud.setup.usejoystick && CONTROL_JoyPresent);
CONTROL_MouseEnabled = (ud.setup.usemouse && CONTROL_MousePresent);
CONTROL_JoystickEnabled = (in_joystick && CONTROL_JoyPresent);
CONTROL_MouseEnabled = (in_mouse && CONTROL_MousePresent);
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
for (int i=0; i<joystick.numAxes; i++)

View file

@ -159,8 +159,6 @@ extern camera_t g_camera;
// KEEPINSYNC lunatic/_defs_game.lua
typedef struct {
int32_t usejoystick;
int32_t usemouse;
int32_t fullscreen;
int32_t xdim;
int32_t ydim;

View file

@ -951,7 +951,7 @@ static MenuEntry_t *MEL_TOUCHSENS [] = {
};
#endif
static MenuOption_t MEO_JOYSTICK_ENABLE = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.setup.usejoystick );
static MenuOption_t MEO_JOYSTICK_ENABLE = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &in_joystick.Value );
static MenuEntry_t ME_JOYSTICK_ENABLE = MAKE_MENUENTRY( "Enable Gamepad:", &MF_Redfont, &MEF_BigOptionsRtSections, &MEO_JOYSTICK_ENABLE, Option );
MAKE_MENU_TOP_ENTRYLINK( "Edit Buttons", MEF_BigOptionsRtSections, JOYSTICK_EDITBUTTONS, MENU_JOYSTICKBTNS );

View file

@ -1457,14 +1457,6 @@ static int osdcmd_cvar_set_game(osdcmdptr_t parm)
r_ambientlightrecip = 256.f;
else r_ambientlightrecip = 1.f/r_ambientlight;
}
else if (!Bstrcasecmp(parm->name, "in_mouse"))
{
CONTROL_MouseEnabled = (ud.setup.usemouse && CONTROL_MousePresent);
}
else if (!Bstrcasecmp(parm->name, "in_joystick"))
{
CONTROL_JoystickEnabled = (ud.setup.usejoystick && CONTROL_JoyPresent);
}
else if (!Bstrcasecmp(parm->name, "vid_gamma"))
{
ud.brightness = GAMMA_CALC;

View file

@ -253,16 +253,10 @@ void CONFIG_SetDefaults(void)
ud.team = 0;
cl_weaponswitch = 3; // new+empty
ud.angleinterpolation = 0;
#ifdef GEKKO
ud.setup.usejoystick = 1;
#else
ud.setup.usejoystick = 0;
#endif
ud.setup.forcesetup = 1;
ud.setup.noautoload = 1;
ud.setup.fullscreen = 1;
ud.setup.usemouse = 1;
snd_speech = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM
ud.display_bonus_screen = 1;
@ -801,7 +795,7 @@ void CONFIG_WriteSetup(uint32_t flags)
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, FALSE, FALSE);
#endif
if (ud.setup.usemouse)
if (in_mouse)
{
for (dummy=0; dummy<MAXMOUSEBUTTONS; dummy++)
{
@ -848,7 +842,7 @@ void CONFIG_WriteSetup(uint32_t flags)
}
}
if (ud.setup.usejoystick)
if (in_joystick)
{
for (dummy=0; dummy<MAXJOYBUTTONSANDHATS; dummy++)
{

View file

@ -7944,8 +7944,8 @@ int app_main(int argc, char const * const * argv)
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
CONTROL_JoystickEnabled = (ud.setup.usejoystick && CONTROL_JoyPresent);
CONTROL_MouseEnabled = (ud.setup.usemouse && CONTROL_MousePresent);
CONTROL_JoystickEnabled = (in_joystick && CONTROL_JoyPresent);
CONTROL_MouseEnabled = (in_mouse && CONTROL_MousePresent);
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
for (bssize_t i=0; i<joystick.numAxes; i++)

View file

@ -140,8 +140,6 @@ void A_DeleteSprite(int spriteNum);
// KEEPINSYNC lunatic/_defs_game.lua
typedef struct {
int32_t usejoystick;
int32_t usemouse;
int32_t fullscreen;
int32_t xdim;
int32_t ydim;

View file

@ -2092,7 +2092,7 @@ static void Menu_Pre(MenuID_t cm)
case MENU_OPTIONS:
MenuEntry_DisableOnCondition(&ME_OPTIONS_PLAYERSETUP, ud.recstat == 1);
MenuEntry_HideOnCondition(&ME_OPTIONS_JOYSTICKSETUP, !ud.setup.usejoystick || CONTROL_JoyPresent == 0);
MenuEntry_HideOnCondition(&ME_OPTIONS_JOYSTICKSETUP, !in_joystick || CONTROL_JoyPresent == 0);
break;
case MENU_COLCORR:

View file

@ -1244,14 +1244,6 @@ static int osdcmd_cvar_set_game(osdcmdptr_t parm)
r_ambientlightrecip = 256.f;
else r_ambientlightrecip = 1.f/r_ambientlight;
}
else if (!Bstrcasecmp(parm->name, "in_mouse"))
{
CONTROL_MouseEnabled = (ud.setup.usemouse && CONTROL_MousePresent);
}
else if (!Bstrcasecmp(parm->name, "in_joystick"))
{
CONTROL_JoystickEnabled = (ud.setup.usejoystick && CONTROL_JoyPresent);
}
else if (!Bstrcasecmp(parm->name, "vid_gamma"))
{
ud.brightness = GAMMA_CALC;