- mouse aiming cleanup.

Reverted this to a sane setting, as it was in the original games and in all other games I have ever seen, i.e. there is a global setting to enable mouse view, and a button to manually trigger it. The toggle can be easily handled by flipping the CVAR directly.
The main problem here was that it triggered a few cases for mouse-less gameplay in the default case with a mouse present, because the mouseaim CVAR was no longer what the game expected.
This misguided change seems to have originated in JFDuke but by now had propagated to all the other games as well, the code was in all 4 frontends.
This commit is contained in:
Christoph Oelckers 2019-12-05 01:08:35 +01:00
parent 525cf28d29
commit cb0538d0f2
17 changed files with 54 additions and 339 deletions

View file

@ -121,32 +121,8 @@ void ctrlGetInput(void)
D_ProcessEvents();
if (in_aimmode)
g_MyAimMode = 0;
if (buttonMap.ButtonDown(gamefunc_Mouse_Aiming))
{
if (in_aimmode)
g_MyAimMode = 1;
else
{
buttonMap.ClearButton(gamefunc_Mouse_Aiming);
g_MyAimMode = !g_MyAimMode;
if (g_MyAimMode)
{
if (!bSilentAim)
viewSetMessage("Mouse aiming ON");
}
else
{
if (!bSilentAim)
viewSetMessage("Mouse aiming OFF");
gInput.keyFlags.lookCenter = 1;
}
}
}
else if (in_aimmode)
gInput.keyFlags.lookCenter = 1;
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
if (!mouseaim) gInput.keyFlags.lookCenter = 1;
CONTROL_GetInput(&info);
@ -384,7 +360,7 @@ void ctrlGetInput(void)
strafe = ClipRange(strafe-(info.dx<<5), -2048, 2048);
if (g_MyAimMode)
if (mouseaim)
gInput.q16mlook = fix16_clamp(fix16_div(fix16_from_int(info.mousey), F16(128)), F16(-127)>>2, F16(127)>>2);
else
forward = ClipRange(forward - info.mousey, -2048, 2048);

View file

@ -1852,11 +1852,6 @@ void SetMouseFilterInput(CGameMenuItemZBool *pItem)
in_mousesmoothing = pItem->at20;
}
void SetMouseAimMode(CGameMenuItemZBool *pItem)
{
in_aimmode = pItem->at20;
}
void SetMouseVerticalAim(CGameMenuItemZBool *pItem)
{
in_mousemode = pItem->at20;
@ -1876,21 +1871,6 @@ void SetMouseDigitalAxis(CGameMenuItemZCycle *pItem)
{
}
void SetupMouseMenu(CGameMenuItemChain *pItem)
{
UNREFERENCED_PARAMETER(pItem);
itemOptionsControlMouseAimFlipped.at20 = in_mouseflip;
itemOptionsControlMouseFilterInput.at20 = in_mousesmoothing;
itemOptionsControlMouseAimMode.at20 = in_aimmode;
itemOptionsControlMouseVerticalAim.at20 = g_MyAimMode;
}
void PreDrawControlMouse(CGameMenuItem *pItem)
{
if (pItem == &itemOptionsControlMouseVerticalAim)
pItem->bEnable = !in_aimmode;
}
void SetMouseButton(CGameMenuItemZCycle *pItem)
{
}

View file

@ -78,6 +78,14 @@ CUSTOM_CVARD(Bool, cl_autorun, true, CVAR_ARCHIVE, "enable/disable autorun")
#endif
}
CVARD(Bool, cl_runmode, true, CVAR_ARCHIVE, "enable/disable modernized run key operation")
bool G_CheckAutorun(bool button)
{
if (cl_runmode) return button || cl_autorun;
else return button ^ !!cl_autorun;
}
CVARD(Bool, cl_autosave, true, CVAR_ARCHIVE, "enable/disable autosaves") // Not implemented for Blood (but looks like the other games never check it either.)
CVARD(Bool, cl_autosavedeletion, true, CVAR_ARCHIVE, "enable/disable automatic deletion of autosaves") // Not implemented for Blood
CVARD(Int, cl_maxautosaves, 8, CVAR_ARCHIVE, "number of autosaves to keep before deleting the oldest") // Not implemented for Blood
@ -124,12 +132,6 @@ CUSTOM_CVARD(Int, cl_autovote, 0, CVAR_ARCHIVE, "enable/disable automatic voting
if (self < 0 || self > 2) self = 0;
}
bool G_CheckAutorun(bool button)
{
if (cl_runmode) return button || cl_autorun;
else return button ^ !!cl_autorun;
}
// Demos
CVARD_NAMED(Bool, demorec_diffcompress, demorec_diffcompress_cvar, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "Compression for diffs")
@ -319,14 +321,19 @@ CUSTOM_CVARD(Bool, in_mouse, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCAL
CONTROL_MouseEnabled = (self && CONTROL_MousePresent);
}
// Does it even make sense to have this configurable? It is in the menu but can be switched around at will by the mouse input code.
int32_t g_MyAimMode = 1;
CUSTOM_CVARD(Bool, in_mousemode, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "toggles vertical mouse view")
CVARD(Bool, in_mousemode, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "toggles vertical mouse view")
CVAR(Bool, silentmouseaimtoggle, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CCMD(togglemouseaim)
{
g_MyAimMode = self; // Needs to be copied to a shadow variable because the input code messes around with this setting - but that should not affect the user's original choice.
in_mousemode = !in_mousemode;
if (!silentmouseaimtoggle)
{
gi->DoPrintMessage(PRINT_MEDIUM, in_mousemode? GStrings("TXT_MOUSEAIMON") : GStrings("TXT_MOUSEAIMOFF"));
}
}
CVARD(Bool, in_aimmode, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "0:toggle, 1:hold to aim")
CVARD(Bool, in_mouseflip, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "invert vertical mouse movement")
CUSTOM_CVARD(Int, in_mousebias, 0, CVAR_GLOBALCONFIG|CVAR_ARCHIVE, "emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time")

View file

@ -90,16 +90,15 @@ EXTERN_CVAR(Float, vid_brightness)
EXTERN_CVAR(Bool, in_joystick)
EXTERN_CVAR(Bool, in_mouse)
EXTERN_CVAR(Bool, in_aimmode)
EXTERN_CVAR(Int, in_mousebias)
EXTERN_CVAR(Int, in_mousedeadzone)
EXTERN_CVAR(Bool, in_mouseflip)
EXTERN_CVAR(Bool, in_mousemode)
EXTERN_CVAR(Bool, in_aimmode)
EXTERN_CVAR(Bool, in_mousesmoothing)
EXTERN_CVAR(Float, in_mousesensitivity)
EXTERN_CVAR(Float, in_mousescalex)
EXTERN_CVAR(Float, in_mousescaley)
extern int32_t g_MyAimMode;
EXTERN_CVAR(Bool, in_mousemode)
EXTERN_CVAR(String, wchoice)

View file

@ -5721,7 +5721,7 @@ static void P_SetupMiscInputSettings(void)
{
auto ps = g_player[myconnectindex].ps;
ps->aim_mode = in_aimmode;
ps->aim_mode = in_mousemode;
ps->auto_aim = cl_autoaim;
ps->weaponswitch = cl_weaponswitch;
}

View file

@ -1450,7 +1450,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int const lParm2)
case USERDEFS_MOUSEFLIP: labelNum = !in_mouseflip; break;
case USERDEFS_STATUSBARSCALE: labelNum = ud.statusbarscale; break;
case USERDEFS_DRAWWEAPON: labelNum = r_drawweapon; break;
case USERDEFS_MOUSEAIMING: labelNum = in_aimmode; break;
case USERDEFS_MOUSEAIMING: labelNum = in_mousemode; break;
case USERDEFS_WEAPONSWITCH: labelNum = cl_weaponswitch; break;
case USERDEFS_DEMOCAMS: labelNum = cl_democams; break;
case USERDEFS_COLOR: labelNum = playercolor; break;
@ -1643,7 +1643,7 @@ void __fastcall VM_SetUserdef(int const labelNum, int const lParm2, int32_t cons
case USERDEFS_MOUSEFLIP: in_mouseflip.SetGenericRepDefault(iSet, CVAR_Int); break;
case USERDEFS_STATUSBARSCALE: ud.statusbarscale = iSet; break;
case USERDEFS_DRAWWEAPON: r_drawweapon.SetGenericRepDefault(iSet, CVAR_Int); break;
case USERDEFS_MOUSEAIMING: in_aimmode.SetGenericRepDefault(iSet, CVAR_Int); break;
case USERDEFS_MOUSEAIMING: break; // the script code has no business whatsoever changing this!
case USERDEFS_WEAPONSWITCH: cl_weaponswitch.SetGenericRepDefault(iSet, CVAR_Int); break;
case USERDEFS_DEMOCAMS: cl_democams = iSet; break;
case USERDEFS_COLOR: /*playercolor.SetGenericRepDefault(iSet, CVAR_Int);*/ break; // the value range here does not match, so better leave the CVar alone.

View file

@ -653,11 +653,6 @@ static void Menu_Pre(MenuID_t cm)
MenuEntry_DisableOnCondition(&ME_JOYSTICK_DEFAULTS_PRO, !joystick.isGameController);
break;
#ifndef EDUKE32_SIMPLE_MENU
case MENU_MOUSESETUP:
MenuEntry_DisableOnCondition(&ME_MOUSESETUP_MOUSEAIMING, in_aimmode);
break;
#endif
case MENU_NETOPTIONS:
if (MEOSV_NetEpisodes[MEO_NETOPTIONS_EPISODE.currentOption] == MAXVOLUMES)
MEL_NETOPTIONS[2] = &ME_NETOPTIONS_USERMAP;

View file

@ -4799,7 +4799,7 @@ void Net_SendClientInfo(void)
l += 32;
tempnetbuf[l++] = 0;
tempnetbuf[l++] = g_player[myconnectindex].ps->aim_mode = in_aimmode;
tempnetbuf[l++] = g_player[myconnectindex].ps->aim_mode = in_mousemode;
tempnetbuf[l++] = g_player[myconnectindex].ps->auto_aim = cl_autoaim;
tempnetbuf[l++] = g_player[myconnectindex].ps->weaponswitch = cl_weaponswitch;
tempnetbuf[l++] = g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = G_CheckPlayerColor(playercolor);

View file

@ -2887,7 +2887,6 @@ enddisplayweapon:
#define MAXANGVEL 1024
#define MAXHORIZ 256
int32_t g_myAimStat = 0, g_oldAimStat = 0;
int32_t mouseyaxismode = -1;
void P_GetInput(int const playerNum)
@ -2910,19 +2909,7 @@ void P_GetInput(int const playerNum)
D_ProcessEvents();
if (in_aimmode)
g_MyAimMode = buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
else
{
g_oldAimStat = g_myAimStat;
g_myAimStat = buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
if (g_myAimStat > g_oldAimStat)
{
g_MyAimMode ^= 1;
P_DoQuote(QUOTE_MOUSE_AIMING_OFF + g_MyAimMode, pPlayer);
}
}
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
CONTROL_GetInput(&info);
@ -2950,7 +2937,7 @@ void P_GetInput(int const playerNum)
input.q16avel += fix16_from_int(info.dyaw) / analogExtent * (analogTurnAmount << 1);
}
if (g_MyAimMode)
if (mouseaim)
input.q16horz = fix16_div(fix16_from_int(info.mousey), F16(64));
else
input.fvel = -(info.mousey >> 6);
@ -3073,7 +3060,7 @@ void P_GetInput(int const playerNum)
localInput.bits |= buttonMap.ButtonDown(gamefunc_Quick_Kick) << SK_QUICK_KICK;
localInput.bits |= buttonMap.ButtonDown(gamefunc_TurnAround) << SK_TURNAROUND;
localInput.bits |= (g_MyAimMode << SK_AIMMODE);
localInput.bits |= (mouseaim << SK_AIMMODE);
localInput.bits |= (g_gameQuit << SK_GAMEQUIT);
localInput.bits |= inputState.GetKeyStatus(sc_Pause) << SK_PAUSE;
localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE;

View file

@ -7156,7 +7156,7 @@ static void P_SetupMiscInputSettings(void)
{
DukePlayer_t *ps = g_player[myconnectindex].ps;
ps->aim_mode = in_aimmode;
ps->aim_mode = in_mousemode;
ps->auto_aim = cl_autoaim;
ps->weaponswitch = cl_weaponswitch;
}

View file

@ -510,156 +510,6 @@ static MenuEntry_t *MEL_KEYBOARDSETUP[] = {
};
// There is no better way to do this than manually.
#define MENUMOUSEFUNCTIONS 12
static char const *MenuMouseNames[MENUMOUSEFUNCTIONS] = {
"Button 1",
"Double Button 1",
"Button 2",
"Double Button 2",
"Button 3",
"Double Button 3",
"Wheel Up",
"Wheel Down",
"Button 4",
"Double Button 4",
"Button 5",
"Double Button 5",
};
static int32_t MenuMouseDataIndex[MENUMOUSEFUNCTIONS][2] = {
{ 0, 0, },
{ 0, 1, },
{ 1, 0, },
{ 1, 1, },
{ 2, 0, },
{ 2, 1, },
// note the mouse wheel
{ 4, 0, },
{ 5, 0, },
{ 3, 0, },
{ 3, 1, },
{ 6, 0, },
{ 6, 1, },
};
static MenuOption_t MEO_MOUSEJOYSETUPBTNS_TEMPLATE = MAKE_MENUOPTION( &MF_Minifont, &MEOS_Gamefuncs, NULL );
static MenuOption_t MEO_MOUSESETUPBTNS[MENUMOUSEFUNCTIONS];
static MenuEntry_t ME_MOUSEJOYSETUPBTNS_TEMPLATE = MAKE_MENUENTRY( NULL, &MF_Minifont, &MEF_FuncList, NULL, Option );
static MenuRangeFloat_t MEO_MOUSESETUP_SENSITIVITY = MAKE_MENURANGE( &in_mousesensitivity, &MF_Redfont, .5f, 16.f, 0.f, 32, 1 );
static MenuEntry_t ME_MOUSESETUP_SENSITIVITY = MAKE_MENUENTRY( "Sensitivity:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSESETUP_SENSITIVITY, RangeFloat );
#ifndef EDUKE32_SIMPLE_MENU
static char const *MEOSN_MOUSESETUP_AIM_TYPE [] = { "Toggle", "Hold" };
static MenuOptionSet_t MEOS_MOUSESETUP_AIM_TYPE = MAKE_MENUOPTIONSET(MEOSN_MOUSESETUP_AIM_TYPE, NULL, 0x2);
static MenuOption_t MEO_MOUSESETUP_MOUSEAIMINGTYPE = MAKE_MENUOPTION(&MF_Redfont, &MEOS_MOUSESETUP_AIM_TYPE, &in_aimmode);
static MenuEntry_t ME_MOUSESETUP_MOUSEAIMINGTYPE = MAKE_MENUENTRY("Aiming type:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSESETUP_MOUSEAIMINGTYPE, Option);
static MenuOption_t MEO_MOUSESETUP_MOUSEAIMING = MAKE_MENUOPTION( &MF_Redfont, &MEOS_NoYes, &in_mousemode );
static MenuEntry_t ME_MOUSESETUP_MOUSEAIMING = MAKE_MENUENTRY( "Vertical aiming:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSESETUP_MOUSEAIMING, Option );
#endif
static MenuOption_t MEO_MOUSESETUP_INVERT = MAKE_MENUOPTION( &MF_Redfont, &MEOS_YesNo, &in_mouseflip );
static MenuEntry_t ME_MOUSESETUP_INVERT = MAKE_MENUENTRY( "Invert aiming:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSESETUP_INVERT, Option );
static MenuOption_t MEO_MOUSESETUP_SMOOTH = MAKE_MENUOPTION( &MF_Redfont, &MEOS_NoYes, &in_mousesmoothing );
static MenuEntry_t ME_MOUSESETUP_SMOOTH = MAKE_MENUENTRY( "Filter input:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSESETUP_SMOOTH, Option );
#ifndef EDUKE32_SIMPLE_MENU
static MenuLink_t MEO_MOUSESETUP_ADVANCED = { MENU_MOUSEADVANCED, MA_Advance, };
static MenuEntry_t ME_MOUSESETUP_ADVANCED = MAKE_MENUENTRY( "Advanced setup", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSESETUP_ADVANCED, Link );
#endif
static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEX = MAKE_MENURANGE(&in_mousescalex, &MF_Redfont, -262144, 262144, 65536, 161, 3);
static MenuEntry_t ME_MOUSEADVANCED_SCALEX = MAKE_MENUENTRY("X-Scale:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSEADVANCED_SCALEX, RangeInt32);
static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEY = MAKE_MENURANGE(&in_mousescaley, &MF_Redfont, -262144, 262144, 65536, 161, 3);
static MenuEntry_t ME_MOUSEADVANCED_SCALEY = MAKE_MENUENTRY("Y-Scale:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSEADVANCED_SCALEY, RangeInt32);
static MenuEntry_t *MEL_MOUSESETUP[] = {
&ME_MOUSESETUP_SENSITIVITY,
#ifdef EDUKE32_SIMPLE_MENU
&ME_MOUSEADVANCED_SCALEX,
&ME_MOUSEADVANCED_SCALEY,
#endif
&ME_Space2_Redfont,
&ME_MOUSESETUP_INVERT,
&ME_MOUSESETUP_SMOOTH,
#ifndef EDUKE32_SIMPLE_MENU
&ME_MOUSESETUP_MOUSEAIMINGTYPE,
&ME_MOUSESETUP_MOUSEAIMING,
&ME_MOUSESETUP_ADVANCED,
#endif
};
static MenuOption_t MEO_JOYSTICK_ENABLE = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &in_joystick );
static MenuEntry_t ME_JOYSTICK_ENABLE = MAKE_MENUENTRY( "Enable Gamepad:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_JOYSTICK_ENABLE, Option );
MAKE_MENU_TOP_ENTRYLINK( "Edit Buttons", MEF_CenterMenu, JOYSTICK_EDITBUTTONS, MENU_JOYSTICKBTNS );
MAKE_MENU_TOP_ENTRYLINK( "Edit Axes", MEF_CenterMenu, JOYSTICK_EDITAXES, MENU_JOYSTICKAXES );
static MenuEntry_t *MEL_JOYSTICKSETUP[] = {
&ME_JOYSTICK_ENABLE,
&ME_Space6_Redfont,
&ME_JOYSTICK_EDITBUTTONS,
&ME_JOYSTICK_EDITAXES,
};
#define MAXJOYBUTTONSTRINGLENGTH 32
static char MenuJoystickNames[MAXJOYBUTTONSANDHATS*2][MAXJOYBUTTONSTRINGLENGTH];
static MenuOption_t MEO_JOYSTICKBTNS[MAXJOYBUTTONSANDHATS*2];
static MenuEntry_t ME_JOYSTICKBTNS[MAXJOYBUTTONSANDHATS*2];
static MenuEntry_t *MEL_JOYSTICKBTNS[MAXJOYBUTTONSANDHATS*2];
static MenuLink_t MEO_JOYSTICKAXES = { MENU_JOYSTICKAXIS, MA_Advance, };
static MenuEntry_t ME_JOYSTICKAXES_TEMPLATE = MAKE_MENUENTRY( NULL, &MF_Redfont, &MEF_BigSliders, &MEO_JOYSTICKAXES, Link );
static MenuEntry_t ME_JOYSTICKAXES[MAXJOYAXES];
static char MenuJoystickAxes[MAXJOYAXES][MAXJOYBUTTONSTRINGLENGTH];
static MenuEntry_t *MEL_JOYSTICKAXES[MAXJOYAXES];
static MenuEntry_t *MEL_MOUSEADVANCED[] = {
&ME_MOUSEADVANCED_SCALEX,
&ME_MOUSEADVANCED_SCALEY,
};
static const char *MenuJoystickHatDirections[] = { "Up", "Right", "Down", "Left", };
static char const *MEOSN_JOYSTICKAXIS_ANALOG[] = { " -None-", "Turning", "Strafing", "Looking", "Moving", };
static int32_t MEOSV_JOYSTICKAXIS_ANALOG[] = { -1, analog_turning, analog_strafing, analog_lookingupanddown, analog_moving, };
static MenuOptionSet_t MEOS_JOYSTICKAXIS_ANALOG = MAKE_MENUOPTIONSET( MEOSN_JOYSTICKAXIS_ANALOG, MEOSV_JOYSTICKAXIS_ANALOG, 0x0 );
static MenuOption_t MEO_JOYSTICKAXIS_ANALOG = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_JOYSTICKAXIS_ANALOG, NULL );
static MenuEntry_t ME_JOYSTICKAXIS_ANALOG = MAKE_MENUENTRY( "Analog", &MF_Redfont, &MEF_BigSliders, &MEO_JOYSTICKAXIS_ANALOG, Option );
static MenuRangeInt32_t MEO_JOYSTICKAXIS_SCALE = MAKE_MENURANGE( NULL, &MF_Bluefont, -262144, 262144, 65536, 65, 3 );
static MenuEntry_t ME_JOYSTICKAXIS_SCALE = MAKE_MENUENTRY( "Scale", &MF_Redfont, &MEF_BigSliders, &MEO_JOYSTICKAXIS_SCALE, RangeInt32 );
static MenuRangeInt32_t MEO_JOYSTICKAXIS_DEAD = MAKE_MENURANGE( NULL, &MF_Bluefont, 0, 1000000, 0, 33, 2 );
static MenuEntry_t ME_JOYSTICKAXIS_DEAD = MAKE_MENUENTRY( "Dead Zone", &MF_Redfont, &MEF_BigSliders, &MEO_JOYSTICKAXIS_DEAD, RangeInt32 );
static MenuRangeInt32_t MEO_JOYSTICKAXIS_SATU = MAKE_MENURANGE( NULL, &MF_Bluefont, 0, 1000000, 0, 33, 2 );
static MenuEntry_t ME_JOYSTICKAXIS_SATU = MAKE_MENUENTRY( "Saturation", &MF_Redfont, &MEF_BigSliders, &MEO_JOYSTICKAXIS_SATU, RangeInt32 );
static MenuOption_t MEO_JOYSTICKAXIS_DIGITALNEGATIVE = MAKE_MENUOPTION( &MF_Minifont, &MEOS_Gamefuncs, NULL );
static MenuEntry_t ME_JOYSTICKAXIS_DIGITALNEGATIVE = MAKE_MENUENTRY( "Digital -", &MF_Bluefont, &MEF_BigSliders, &MEO_JOYSTICKAXIS_DIGITALNEGATIVE, Option );
static MenuOption_t MEO_JOYSTICKAXIS_DIGITALPOSITIVE = MAKE_MENUOPTION( &MF_Minifont, &MEOS_Gamefuncs, NULL );
static MenuEntry_t ME_JOYSTICKAXIS_DIGITALPOSITIVE = MAKE_MENUENTRY( "Digital +", &MF_Bluefont, &MEF_BigSliders, &MEO_JOYSTICKAXIS_DIGITALPOSITIVE, Option );
static MenuEntry_t *MEL_JOYSTICKAXIS[] = {
&ME_JOYSTICKAXIS_ANALOG,
&ME_JOYSTICKAXIS_SCALE,
&ME_JOYSTICKAXIS_DEAD,
&ME_JOYSTICKAXIS_SATU,
&ME_Space8_Redfont,
&ME_JOYSTICKAXIS_DIGITALNEGATIVE,
&ME_JOYSTICKAXIS_DIGITALPOSITIVE,
};
static MenuEntry_t *MEL_INTERNAL_JOYSTICKAXIS_DIGITAL[] = {
&ME_JOYSTICKAXIS_DIGITALNEGATIVE,
&ME_JOYSTICKAXIS_DIGITALPOSITIVE,
};
#ifdef USE_OPENGL
static MenuOption_t MEO_RENDERERSETUP_HIGHTILE = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_NoYes, &hw_hightile );

View file

@ -3427,7 +3427,7 @@ void Net_SendClientInfo(void)
l += 32;
tempbuf[l++] = 0;
tempbuf[l++] = g_player[myconnectindex].ps->aim_mode = in_aimmode;
tempbuf[l++] = g_player[myconnectindex].ps->aim_mode = in_mousemode;
tempbuf[l++] = g_player[myconnectindex].ps->auto_aim = cl_autoaim;
tempbuf[l++] = g_player[myconnectindex].ps->weaponswitch = cl_weaponswitch;
tempbuf[l++] = g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = G_CheckPlayerColor(playercolor);

View file

@ -2758,19 +2758,7 @@ void P_GetInput(int playerNum)
D_ProcessEvents();
if (in_aimmode)
g_MyAimMode = buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
else
{
g_oldAimStat = g_myAimStat;
g_myAimStat = buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
if (g_myAimStat > g_oldAimStat)
{
g_MyAimMode ^= 1;
P_DoQuote(QUOTE_MOUSE_AIMING_OFF + g_MyAimMode, pPlayer);
}
}
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
CONTROL_GetInput(&info);
@ -2800,7 +2788,7 @@ void P_GetInput(int playerNum)
input.q16avel += fix16_from_int(info.dyaw) / analogExtent * (analogTurnAmount << 1);
}
if (g_MyAimMode)
if (mouseaim)
input.q16horz = fix16_div(fix16_from_int(info.mousey), F16(64));
else
input.fvel = -(info.mousey >> 6);
@ -2965,7 +2953,7 @@ void P_GetInput(int playerNum)
localInput.bits |= buttonMap.ButtonDown(gamefunc_Quick_Kick) << SK_QUICK_KICK;
localInput.bits |= buttonMap.ButtonDown(gamefunc_TurnAround) << SK_TURNAROUND;
localInput.bits |= (g_MyAimMode << SK_AIMMODE);
localInput.bits |= (mouseaim << SK_AIMMODE);
localInput.bits |= (g_gameQuit << SK_GAMEQUIT);
localInput.bits |= inputState.GetKeyStatus(sc_Pause) << SK_PAUSE;
localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE;
@ -3044,19 +3032,7 @@ void P_GetInputMotorcycle(int playerNum)
D_ProcessEvents();
if (in_aimmode)
g_MyAimMode = buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
else
{
g_oldAimStat = g_myAimStat;
g_myAimStat = buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
if (g_myAimStat > g_oldAimStat)
{
g_MyAimMode ^= 1;
P_DoQuote(QUOTE_MOUSE_AIMING_OFF + g_MyAimMode, pPlayer);
}
}
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
CONTROL_GetInput(&info);
@ -3321,19 +3297,7 @@ void P_GetInputBoat(int playerNum)
D_ProcessEvents();
if (in_aimmode)
g_MyAimMode = buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
else
{
g_oldAimStat = g_myAimStat;
g_myAimStat = buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
if (g_myAimStat > g_oldAimStat)
{
g_MyAimMode ^= 1;
P_DoQuote(QUOTE_MOUSE_AIMING_OFF + g_MyAimMode, pPlayer);
}
}
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
CONTROL_GetInput(&info);

View file

@ -2772,8 +2772,6 @@ void InitPlayerGameSettings(void)
else
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
}
g_MyAimMode = in_aimmode;
}
@ -3518,29 +3516,23 @@ void getinput(SW_PACKET *loc)
// MAKE SURE THIS WILL GET SET
SET_LOC_KEY(loc->bits, SK_QUIT_GAME, MultiPlayQuitFlag);
if (in_aimmode)
g_MyAimMode = 0;
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
if (buttonMap.ButtonDown(gamefunc_Mouse_Aiming))
if (!CommEnabled)
{
if (in_aimmode)
g_MyAimMode = 1;
else
{
buttonMap.ClearButton(gamefunc_Mouse_Aiming);
g_MyAimMode = !g_MyAimMode;
if (g_MyAimMode)
{
PutStringInfo(pp, "Mouse Aiming Off");
}
else
{
PutStringInfo(pp, "Mouse Aiming On");
}
}
}
// Go back to the source to set this - the old code here was catastrophically bad.
// this needs to be fixed properly - as it is this can never be compatible with demo playback.
int const aimMode = TEST(pp->Flags, PF_MOUSE_AIMING_ON);
if (mouseaim)
SET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON);
else
RESET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON);
if (cl_autoaim)
SET(Player[myconnectindex].Flags, PF_AUTO_AIM);
else
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
}
ControlInfo info;
CONTROL_GetInput(&info);
@ -3646,7 +3638,7 @@ void getinput(SW_PACKET *loc)
angvel += info.dyaw * (turnamount << 1) / analogExtent;
}
if (true)//aimMode)
if (mouseaim)
aimvel = -info.mousey / 64;
else
vel = -(info.mousey >> 6);
@ -3758,7 +3750,6 @@ void getinput(SW_PACKET *loc)
SET_LOC_KEY(loc->bits, SK_LOOK_UP, buttonMap.ButtonDown(gamefunc_Look_Up));
SET_LOC_KEY(loc->bits, SK_LOOK_DOWN, buttonMap.ButtonDown(gamefunc_Look_Down));
for (i = 0; i < MAX_WEAPONS_KEYS; i++)
{
if (buttonMap.ButtonDown(gamefunc_Weapon_1 + i))

View file

@ -2252,7 +2252,6 @@ MNU_InitMenus(void)
buttonsettings[btn_bobbing] = cl_viewbob;
buttonsettings[btn_shadows] = r_shadows;
buttonsettings[btn_mouse_aim] = in_aimmode;
buttonsettings[btn_mouse_invert] = in_mouseflip;
buttonsettings[btn_sound] = snd_enabled;
buttonsettings[btn_music] = mus_enabled;
@ -3012,10 +3011,6 @@ void MNU_DoButton(MenuItem_p item, SWBOOL draw)
if (cl_autorun != last_value)
MenuButtonAutoRun = TRUE;
break;
case btn_mouse_aim:
last_value = in_aimmode;
in_aimmode = state = buttonsettings[item->button];
break;
case btn_mouse_invert:
in_mouseflip = state = buttonsettings[item->button];
break;
@ -3146,13 +3141,6 @@ void MNU_DoButton(MenuItem_p item, SWBOOL draw)
if (!draw)
return;
switch (item->button)
{
case btn_mouse_aim:
extra_text = in_aimmode ? "Momentary" : "Toggle";
break;
default: break;
}
state = buttonsettings[item->button];

View file

@ -1820,7 +1820,7 @@ PlayerAutoLook(PLAYERp pp)
if (!TEST(pp->Flags, PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING))
{
if (!g_MyAimMode && TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE)) // If the floor is sloped
if (!TEST(pp->Flags, PF_MOUSE_AIMING_ON) && TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE)) // If the floor is sloped
{
// Get a point, 512 units ahead of player's position
x = pp->posx + (sintable[(pp->pang + 512) & 2047] >> 5);
@ -2522,29 +2522,6 @@ MoveScrollMode2D(PLAYERp pp)
void
DoPlayerMenuKeys(PLAYERp pp)
{
if (!CommEnabled)
{
// Go back to the source to set this - the old code here was catastrophically bad.
// this needs to be fixed properly - as it is this can never be compatible with demo playback.
if (cl_autoaim)
SET(Player[myconnectindex].Flags, PF_AUTO_AIM);
else
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
#if 0
if (TEST_SYNC_KEY((pp), SK_AUTO_AIM))
{
if (FLAG_KEY_PRESSED(pp, SK_AUTO_AIM))
{
FLAG_KEY_RELEASE(pp, SK_AUTO_AIM);
FLIP(pp->Flags, PF_AUTO_AIM);
}
}
else
FLAG_KEY_RESET(pp, SK_AUTO_AIM);
#endif
}
}
void PlayerSectorBound(PLAYERp pp, int amt)

View file

@ -665,6 +665,8 @@ OptionMenu "ActionControlsMenu"// protected
StaticText ""
Control "$CNTRLMNU_MOUSELOOK" , "+mouse_aiming"
Control "$CNTRLMNU_MLOOKTOGGLE" , "togglemouseaim"
Control "$CNTRLMNU_AIMUP" , "+aim_up"
Control "$CNTRLMNU_AIMDOWN" , "+aim_down"
Control "$CNTRLMNU_LOOKUP" , "+look_up"
@ -902,7 +904,6 @@ OptionMenu "MouseOptions" //protected
StaticText ""
Option "$MOUSEMNU_ALWAYSMOUSELOOK", "in_mousemode", "OnOff"
Option "$MOUSEMNU_INVERTMOUSE", "in_mouseflip", "OnOff"
Option "$MOUSEMNU_LOOKSPRING", "in_aimmode", "OnOff" // Functionm exists but is very broken. Definitely needs fixing.
// Do we need this? Option "$MOUSEMNU_LOOKSTRAFE", "lookstrafe", "OnOff"
}