From da3bf945cb11c84a9a1ebdcd39a49cd89562e86e Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 20 Jan 2025 22:02:08 +0100 Subject: [PATCH] delete nonfunctional second mouse stuff --- src/android/i_system.c | 4 - src/d_event.h | 1 - src/d_netcmd.c | 30 +--- src/d_netcmd.h | 7 - src/dummy/i_system.c | 4 - src/g_game.c | 9 +- src/g_game.h | 3 +- src/g_input.c | 40 +---- src/g_input.h | 12 +- src/hu_stuff.c | 2 +- src/i_system.h | 8 - src/m_menu.c | 29 +--- src/sdl/i_system.c | 337 ----------------------------------------- src/sdl/i_video.c | 2 - 14 files changed, 12 insertions(+), 476 deletions(-) diff --git a/src/android/i_system.c b/src/android/i_system.c index 3eddf6e20..4a598a452 100644 --- a/src/android/i_system.c +++ b/src/android/i_system.c @@ -184,8 +184,6 @@ void I_OutputMsg(const char *fmt, ...) void I_StartupMouse(void){} -void I_StartupMouse2(void){} - void I_StartupKeyboard(void){} INT32 I_GetKey(void) @@ -242,8 +240,6 @@ void I_GetJoystickEvents(void){} void I_GetJoystick2Events(void){} -void I_GetMouseEvents(void){} - char *I_GetEnv(const char *name) { LOGW("I_GetEnv() called?!"); diff --git a/src/d_event.h b/src/d_event.h index 8cbf8560d..b76e5c6a4 100644 --- a/src/d_event.h +++ b/src/d_event.h @@ -25,7 +25,6 @@ typedef enum ev_console, ev_mouse, ev_joystick, - ev_mouse2, ev_joystick2, ev_joystick3, ev_joystick4, diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f04affa99..23fe91bce 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -209,13 +209,6 @@ void SendWeaponPref3(void); void SendWeaponPref4(void); static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force"}, {0, NULL}}; -#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON) -static CV_PossibleValue_t mouse2port_cons_t[] = {{0, "/dev/gpmdata"}, {1, "/dev/ttyS0"}, - {2, "/dev/ttyS1"}, {3, "/dev/ttyS2"}, {4, "/dev/ttyS3"}, {0, NULL}}; -#else -static CV_PossibleValue_t mouse2port_cons_t[] = {{1, "COM1"}, {2, "COM2"}, {3, "COM3"}, {4, "COM4"}, - {0, NULL}}; -#endif #ifdef LJOYSTICK static CV_PossibleValue_t joyport_cons_t[] = {{1, "/dev/js0"}, {2, "/dev/js1"}, {3, "/dev/js2"}, @@ -298,7 +291,7 @@ consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, INT32 cv_debug; consvar_t cv_usemouse = {"use_mouse", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_usemouse2 = {"use_mouse2", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse2, 0, NULL, NULL, 0, 0, NULL}; + //WTF consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -331,12 +324,6 @@ consvar_t cv_joyscale[2] = { //Alam: Dummy for save {"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL} }; #endif -#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON) -consvar_t cv_mouse2port = {"mouse2port", "/dev/gpmdata", CV_SAVE, mouse2port_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_mouse2opt = {"mouse2opt", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else -consvar_t cv_mouse2port = {"mouse2port", "COM2", CV_SAVE, mouse2port_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif consvar_t cv_matchboxes = {"matchboxes", "Normal", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, matchboxes_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_specialrings = {"specialrings", "On", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -975,10 +962,6 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_showlocalskinmenus); - //CV_RegisterVar(&cv_alwaysfreelook); - //CV_RegisterVar(&cv_alwaysfreelook2); - //CV_RegisterVar(&cv_chasefreelook); - //CV_RegisterVar(&cv_chasefreelook2); CV_RegisterVar(&cv_replaysearchrate); CV_RegisterVar(&cv_showfocuslost); CV_RegisterVar(&cv_pauseifunfocused); @@ -1011,12 +994,6 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_addons_search_type); CV_RegisterVar(&cv_addons_search_case); - // WARNING: the order is important when initialising mouse2 - // we need the mouse2port - CV_RegisterVar(&cv_mouse2port); -#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON) - CV_RegisterVar(&cv_mouse2opt); -#endif CV_RegisterVar(&cv_controlperkey); CV_RegisterVar(&cv_turnsmooth); @@ -1028,15 +1005,10 @@ void D_RegisterClientCommands(void) } CV_RegisterVar(&cv_usemouse); - CV_RegisterVar(&cv_usemouse2); CV_RegisterVar(&cv_invertmouse); - CV_RegisterVar(&cv_invertmouse2); CV_RegisterVar(&cv_mousesens); - CV_RegisterVar(&cv_mousesens2); CV_RegisterVar(&cv_mouseysens); - CV_RegisterVar(&cv_mouseysens2); //CV_RegisterVar(&cv_mousemove); - //CV_RegisterVar(&cv_mousemove2); for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 87d96b40d..3cffcf4bc 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -50,13 +50,6 @@ extern consvar_t cv_joyport2; #endif extern consvar_t cv_joyscale[4]; //MAXSPLITSCREENPLAYERS -// splitscreen with second mouse -extern consvar_t cv_mouse2port; -extern consvar_t cv_usemouse2; -#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON) -extern consvar_t cv_mouse2opt; -#endif - // normally in p_mobj but the .h is not read extern consvar_t cv_itemrespawntime; extern consvar_t cv_itemrespawn; diff --git a/src/dummy/i_system.c b/src/dummy/i_system.c index a293a8d30..f5d6ca286 100644 --- a/src/dummy/i_system.c +++ b/src/dummy/i_system.c @@ -92,8 +92,6 @@ void I_OutputMsg(const char *error, ...) void I_StartupMouse(void){} -void I_StartupMouse2(void){} - void I_StartupKeyboard(void){} INT32 I_GetKey(void) @@ -146,8 +144,6 @@ void I_GetJoystickEvents(void){} void I_GetJoystick2Events(void){} -void I_GetMouseEvents(void){} - char *I_GetEnv(const char *name) { (void)name; diff --git a/src/g_game.c b/src/g_game.c index 2231b1148..0d7862564 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -397,13 +397,7 @@ consvar_t cv_growmusic = {"growmusic", "On", CV_SAVE, powermusic_cons_t, NULL, consvar_t cv_supermusic = {"supermusic", "On", CV_SAVE, powermusic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_invertmouse = {"invertmouse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_invertmouse2 = {"invertmouse2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -/*consvar_t cv_alwaysfreelook = {"alwaysmlook", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_alwaysfreelook2 = {"alwaysmlook2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_chasefreelook = {"chasemlook", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_chasefreelook2 = {"chasemlook2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_mousemove = {"mousemove", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_mousemove2 = {"mousemove2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};*/ +//consvar_t cv_mousemove = {"mousemove", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"}, {1, "Left X"}, {2, "Left Y"}, {-1, "Left X-"}, {-2, "Left Y-"}, @@ -1317,7 +1311,6 @@ static void G_DoLoadLevel(boolean resetplayer) joy4xmove[i] = joy4ymove[i] = 0; } mousex = mousey = 0; - mouse2x = mouse2y = 0; // clear hud messages remains (usually from game startup) CON_ClearHUD(); diff --git a/src/g_game.h b/src/g_game.h index 70f6e6ab4..6723e9ba6 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -115,8 +115,7 @@ extern consvar_t cv_songcredits; extern consvar_t cv_showfreeplay; extern consvar_t cv_growmusic, cv_supermusic; extern consvar_t cv_pauseifunfocused; -extern consvar_t cv_invertmouse/*, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove*/; -extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2*/; +extern consvar_t cv_invertmouse; extern consvar_t cv_turnaxis[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_moveaxis[MAXSPLITSCREENPLAYERS]; diff --git a/src/g_input.c b/src/g_input.c index 788d50ffb..959dc5416 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -33,9 +33,7 @@ static CV_PossibleValue_t turnsmooth_cons_t[] = {{2, "Slow"}, {1, "Fast"}, {0, " // mouse values are used once consvar_t cv_mousesens = {"mousesens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_mousesens2 = {"mousesens2", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_mouseysens = {"mouseysens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_mouseysens2 = {"mouseysens2", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_turnsmooth = {"turnsmoothing", "Slow", CV_SAVE, turnsmooth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -125,8 +123,6 @@ static void led_off_handle4(void) INT32 mousex, mousey; INT32 mlooky; // like mousey but with a custom sensitivity for mlook -INT32 mouse2x, mouse2y, mlook2y; - // joystick values are repeated INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET], joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET]; @@ -148,7 +144,6 @@ typedef struct } dclick_t; static dclick_t mousedclicks[MOUSEBUTTONS]; static dclick_t joydclicks[JOYBUTTONS + JOYHATS*4]; -static dclick_t mouse2dclicks[MOUSEBUTTONS]; static dclick_t joy2dclicks[JOYBUTTONS + JOYHATS*4]; static dclick_t joy3dclicks[JOYBUTTONS + JOYHATS*4]; static dclick_t joy4dclicks[JOYBUTTONS + JOYHATS*4]; @@ -233,14 +228,6 @@ void G_MapEventsToControls(event_t *ev) if (ev->data3 != INT32_MAX) joy4ymove[i] = ev->data3; break; - case ev_mouse2: // buttons are virtual keys - if (menuactive || CON_Ready() || chat_on) - break; - mouse2x = (INT32)(ev->data2*((cv_mousesens2.value*cv_mousesens2.value)/110.0f + 0.1f)); - mouse2y = (INT32)(ev->data3*((cv_mousesens2.value*cv_mousesens2.value)/110.0f + 0.1f)); - mlook2y = (INT32)(ev->data3*((cv_mouseysens2.value*cv_mousesens2.value)/110.0f + 0.1f)); - break; - default: break; } @@ -258,12 +245,6 @@ void G_MapEventsToControls(event_t *ev) gamekeydown[KEY_DBLJOY1+i] = flag; } - for (i = 0; i < MOUSEBUTTONS; i++) - { - flag = G_CheckDoubleClick(gamekeydown[KEY_2MOUSE1+i], &mouse2dclicks[i]); - gamekeydown[KEY_DBL2MOUSE1+i] = flag; - } - for (i = 0; i < JOYBUTTONS + JOYHATS*4; i++) { flag = G_CheckDoubleClick(gamekeydown[KEY_2JOY1+i], &joy2dclicks[i]); @@ -401,18 +382,8 @@ static keyname_t keynames[] = {KEY_MOUSE1+5,"MOUSE6"}, {KEY_MOUSE1+6,"MOUSE7"}, {KEY_MOUSE1+7,"MOUSE8"}, - {KEY_2MOUSE1+0,"SEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2 - {KEY_2MOUSE1+1,"SEC_MOUSE1"}, - {KEY_2MOUSE1+2,"SEC_MOUSE3"}, - {KEY_2MOUSE1+3,"SEC_MOUSE4"}, - {KEY_2MOUSE1+4,"SEC_MOUSE5"}, - {KEY_2MOUSE1+5,"SEC_MOUSE6"}, - {KEY_2MOUSE1+6,"SEC_MOUSE7"}, - {KEY_2MOUSE1+7,"SEC_MOUSE8"}, {KEY_MOUSEWHEELUP, "Wheel 1 UP"}, {KEY_MOUSEWHEELDOWN, "Wheel 1 Down"}, - {KEY_2MOUSEWHEELUP, "Wheel 2 UP"}, - {KEY_2MOUSEWHEELDOWN, "Wheel 2 Down"}, {KEY_JOY1+0, "JOY1"}, {KEY_JOY1+1, "JOY2"}, @@ -423,7 +394,7 @@ static keyname_t keynames[] = {KEY_JOY1+6, "JOY7"}, {KEY_JOY1+7, "JOY8"}, {KEY_JOY1+8, "JOY9"}, - + #if !defined (NOMOREJOYBTN_1S) // we use up to 32 buttons in DirectInput {KEY_JOY1+9, "JOY10"}, @@ -476,14 +447,6 @@ static keyname_t keynames[] = {KEY_DBLMOUSE1+5, "DBLMOUSE6"}, {KEY_DBLMOUSE1+6, "DBLMOUSE7"}, {KEY_DBLMOUSE1+7, "DBLMOUSE8"}, - {KEY_DBL2MOUSE1+0, "DBLSEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2 - {KEY_DBL2MOUSE1+1, "DBLSEC_MOUSE1"}, - {KEY_DBL2MOUSE1+2, "DBLSEC_MOUSE3"}, - {KEY_DBL2MOUSE1+3, "DBLSEC_MOUSE4"}, - {KEY_DBL2MOUSE1+4, "DBLSEC_MOUSE5"}, - {KEY_DBL2MOUSE1+5, "DBLSEC_MOUSE6"}, - {KEY_DBL2MOUSE1+6, "DBLSEC_MOUSE7"}, - {KEY_DBL2MOUSE1+7, "DBLSEC_MOUSE8"}, {KEY_DBLJOY1+0, "DBLJOY1"}, {KEY_DBLJOY1+1, "DBLJOY2"}, @@ -868,7 +831,6 @@ static keyname_t keynames[] = {KEY_DBL4HAT1+13, "DBLFOR_HATDOWN4"}, {KEY_DBL4HAT1+14, "DBLFOR_HATLEFT4"}, {KEY_DBL4HAT1+15, "DBLFOR_HATRIGHT4"}, - }; static const char *gamecontrolname[num_gamecontrols] = diff --git a/src/g_input.h b/src/g_input.h index 124734004..505d210f8 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -41,12 +41,10 @@ typedef enum KEY_DBLJOY1 = KEY_DBLMOUSE1 + MOUSEBUTTONS, KEY_DBLHAT1 = KEY_DBLJOY1 + JOYBUTTONS, - KEY_2MOUSE1 = KEY_DBLHAT1 + JOYHATS*4, - KEY_2JOY1 = KEY_2MOUSE1 + MOUSEBUTTONS, + KEY_2JOY1 = KEY_DBLHAT1 + MOUSEBUTTONS, KEY_2HAT1 = KEY_2JOY1 + JOYBUTTONS, - KEY_DBL2MOUSE1 = KEY_2HAT1 + JOYHATS*4, - KEY_DBL2JOY1 = KEY_DBL2MOUSE1 + MOUSEBUTTONS, + KEY_DBL2JOY1 = KEY_2HAT1 + MOUSEBUTTONS, KEY_DBL2HAT1 = KEY_DBL2JOY1 + JOYBUTTONS, KEY_3JOY1 = KEY_DBL2HAT1 + JOYHATS*4, @@ -63,10 +61,8 @@ typedef enum KEY_MOUSEWHEELUP = KEY_DBL4HAT1 + JOYHATS*4, KEY_MOUSEWHEELDOWN = KEY_MOUSEWHEELUP + 1, - KEY_2MOUSEWHEELUP = KEY_MOUSEWHEELDOWN + 1, - KEY_2MOUSEWHEELDOWN = KEY_2MOUSEWHEELUP + 1, - NUMINPUTS = KEY_2MOUSEWHEELDOWN + 1, + NUMINPUTS = KEY_MOUSEWHEELDOWN + 1, } key_input_e; typedef enum @@ -110,7 +106,6 @@ typedef enum // mouse values are used once extern consvar_t cv_mousesens, cv_mouseysens; -extern consvar_t cv_mousesens2, cv_mouseysens2; extern consvar_t cv_controlperkey, cv_turnsmooth; extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS]; @@ -118,7 +113,6 @@ extern consvar_t cv_ledpowerup[MAXSPLITSCREENPLAYERS]; extern INT32 mousex, mousey; extern INT32 mlooky; //mousey with mlookSensitivity -extern INT32 mouse2x, mouse2y, mlook2y; extern INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET], joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET]; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 9dc8d0df3..6cbc76624 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1154,7 +1154,7 @@ void HU_Ticker(void) || hu_redownloadinggamestate #endif ) - resynch_ticker++; //tic tic tic tic tic + resynch_ticker++; //tic tic tic tic tic HU_TickSongCredits(); } diff --git a/src/i_system.h b/src/i_system.h index 71c78efb8..3b6913c00 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -253,10 +253,6 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener); */ void I_StartupMouse(void); -/** \brief Startup the second mouse -*/ -void I_StartupMouse2(void); - /** \brief setup timer irq and user timer routine. */ void I_StartupTimer(void); @@ -319,10 +315,6 @@ const char *I_LocateWad(void); */ void I_GetJoystickEvents(UINT8 index); -/** \brief Mouses events -*/ -void I_GetMouseEvents(void); - char *I_GetEnv(const char *name); INT32 I_PutEnv(char *variable); diff --git a/src/m_menu.c b/src/m_menu.c index c18934f11..b31eb7f43 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -311,7 +311,7 @@ static void M_SetupMultiHandler(INT32 choice); // Split into multiple parts due to size // Controls menu_t OP_ControlsDef, OP_AllControlsDef; -menu_t OP_MouseOptionsDef, OP_Mouse2OptionsDef; +menu_t OP_MouseOptionsDef; menu_t OP_Joystick1Def, OP_Joystick2Def, OP_Joystick3Def, OP_Joystick4Def; menu_t OP_CustomCvarMenuDef; static void M_VideoModeMenu(INT32 choice); @@ -1374,15 +1374,12 @@ static menuitem_t OP_MouseOptionsMenu[] = { {IT_STRING | IT_CVAR, NULL, "Use Mouse", &cv_usemouse, 10}, - - //{IT_STRING | IT_CVAR, NULL, "First-Person MouseLook", &cv_alwaysfreelook, 30}, - //{IT_STRING | IT_CVAR, NULL, "Third-Person MouseLook", &cv_chasefreelook, 40}, - {IT_STRING | IT_CVAR, NULL, "Mouse Turning", &cv_mouseturn, 20}, + {IT_STRING | IT_CVAR, NULL, "Mouse Turning", &cv_mouseturn, 20}, {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 30}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse X Speed", &cv_mousesens, 40}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Mouse Y Speed", &cv_mouseysens, 50}, + NULL, "Mouse Y Speed", &cv_mouseysens, 50}, }; static const char* OP_MouseTooltips[] = @@ -1394,21 +1391,6 @@ static const char* OP_MouseTooltips[] = "Mouse vertical sensitivity.", }; -/*static menuitem_t OP_Mouse2OptionsMenu[] = -{ - {IT_STRING | IT_CVAR, NULL, "Use Mouse 2", &cv_usemouse2, 10}, - {IT_STRING | IT_CVAR, NULL, "Second Mouse Serial Port", - &cv_mouse2port, 20}, - {IT_STRING | IT_CVAR, NULL, "First-Person MouseLook", &cv_alwaysfreelook2, 30}, - {IT_STRING | IT_CVAR, NULL, "Third-Person MouseLook", &cv_chasefreelook2, 40}, - {IT_STRING | IT_CVAR, NULL, "Mouse Move", &cv_mousemove2, 50}, - {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse2, 60}, - {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Mouse X Speed", &cv_mousesens2, 70}, - {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Mouse Y Speed", &cv_mouseysens2, 80}, -};*/ - static menuitem_t OP_VideoOptionsMenu[] = { {IT_STRING | IT_CALL, NULL, "Set Resolution...", M_VideoModeMenu, 10}, @@ -4017,7 +3999,7 @@ boolean M_Responder(event_t *ev) else { // dirty hack: for customising controls, I want only buttons/keys, not moves - if (ev->type == ev_mouse || ev->type == ev_mouse2 || ev->type == ev_joystick + if (ev->type == ev_mouse || ev->type == ev_joystick || ev->type == ev_joystick2 || ev->type == ev_joystick3 || ev->type == ev_joystick4) return true; if (routine) @@ -12319,7 +12301,6 @@ static void M_ChangecontrolResponse(event_t *ev) { // ignore mouse/joy movements, just get buttons case ev_mouse: - case ev_mouse2: case ev_joystick: case ev_joystick2: case ev_joystick3: @@ -12352,8 +12333,6 @@ static void M_ChangecontrolResponse(event_t *ev) setupcontrols[control][found] = ch-KEY_MOUSE1+KEY_DBLMOUSE1; else if (ch >= KEY_JOY1 && ch <= KEY_JOY1+JOYBUTTONS) setupcontrols[control][found] = ch-KEY_JOY1+KEY_DBLJOY1; - else if (ch >= KEY_2MOUSE1 && ch <= KEY_2MOUSE1+MOUSEBUTTONS) - setupcontrols[control][found] = ch-KEY_2MOUSE1+KEY_DBL2MOUSE1; else if (ch >= KEY_2JOY1 && ch <= KEY_2JOY1+JOYBUTTONS) setupcontrols[control][found] = ch-KEY_2JOY1+KEY_DBL2JOY1; else if (ch >= KEY_3JOY1 && ch <= KEY_3JOY1+JOYBUTTONS) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 6be46fda6..fb6e54f8c 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -424,12 +424,6 @@ static INT32 joystick_started[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0}; */ SDLJoyInfo_t JoyInfo[MAXSPLITSCREENPLAYERS]; - -#ifdef HAVE_TERMIOS -static INT32 fdmouse2 = -1; -static INT32 mouse2_started = 0; -#endif - SDL_bool consolevent = SDL_FALSE; SDL_bool framebuffer = SDL_FALSE; @@ -1660,337 +1654,6 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener) #undef WINMUMBLE #endif // NOMUMBLE -#ifdef HAVE_TERMIOS - -void I_GetMouseEvents(void) -{ - static UINT8 mdata[5]; - static INT32 i = 0,om2b = 0; - INT32 di, j, mlp, button; - event_t event; - const INT32 mswap[8] = {0, 4, 1, 5, 2, 6, 3, 7}; - - if (!mouse2_started) return; - for (mlp = 0; mlp < 20; mlp++) - { - for (; i < 5; i++) - { - di = read(fdmouse2, mdata+i, 1); - if (di == -1) return; - } - if ((mdata[0] & 0xf8) != 0x80) - { - for (j = 1; j < 5; j++) - if ((mdata[j] & 0xf8) == 0x80) - for (i = 0; i < 5-j; i++) // shift - mdata[i] = mdata[i+j]; - if (i < 5) continue; - } - else - { - button = mswap[~mdata[0] & 0x07]; - for (j = 0; j < MOUSEBUTTONS; j++) - { - if (om2b & (1<> 4); - } - else if (bytenum == 3) - { - dx = (char)((combytes[0] & 3) << 6); - dy = (char)((combytes[0] & 12) << 4); - dx = (char)(dx + combytes[1]); - dy = (char)(dy + combytes[2]); - handlermouse2x+= dx; - handlermouse2y+= dy; - } - else if (bytenum == 4) // fourth UINT8 (logitech mouses) - { - if (buffer[i] & 32) - handlermouse2buttons |= 4; - else - handlermouse2buttons &= ~4; - } - } -} - -void I_GetMouseEvents(void) -{ - static UINT8 lastbuttons2 = 0; //mouse movement - event_t event; - - if (mouse2filehandle == INVALID_HANDLE_VALUE) - return; - - I_PoolMouse2(); - // post key event for buttons - if (handlermouse2buttons != lastbuttons2) - { - INT32 i, j = 1, k; - k = (handlermouse2buttons ^ lastbuttons2); // only changed bit to 1 - lastbuttons2 = (UINT8)handlermouse2buttons; - - for (i = 0; i < MOUSEBUTTONS; i++, j <<= 1) - if (k & j) - { - if (handlermouse2buttons & j) - event.type = ev_keydown; - else - event.type = ev_keyup; - event.data1 = KEY_2MOUSE1+i; - D_PostEvent(&event); - } - } - - if (handlermouse2x != 0 || handlermouse2y != 0) - { - event.type = ev_mouse2; - event.data1 = 0; -// event.data1 = buttons; // not needed - event.data2 = handlermouse2x << 1; - event.data3 = -handlermouse2y << 1; - handlermouse2x = 0; - handlermouse2y = 0; - - D_PostEvent(&event); - } -} -#else -void I_GetMouseEvents(void){}; -#endif - -// -// I_StartupMouse2 -// -void I_StartupMouse2(void) -{ -#ifdef HAVE_TERMIOS - struct termios m2tio; - size_t i; - INT32 dtr = -1, rts = -1;; - I_ShutdownMouse2(); - if (cv_usemouse2.value == 0) return; - if ((fdmouse2 = open(cv_mouse2port.string, O_RDONLY|O_NONBLOCK|O_NOCTTY)) == -1) - { - CONS_Printf(M_GetText("Error opening %s!\n"), cv_mouse2port.string); - return; - } - tcflush(fdmouse2, TCIOFLUSH); - m2tio.c_iflag = IGNBRK; - m2tio.c_oflag = 0; - m2tio.c_cflag = CREAD|CLOCAL|HUPCL|CS8|CSTOPB|B1200; - m2tio.c_lflag = 0; - m2tio.c_cc[VTIME] = 0; - m2tio.c_cc[VMIN] = 1; - tcsetattr(fdmouse2, TCSANOW, &m2tio); - for (i = 0; i < strlen(cv_mouse2opt.string); i++) - { - if (toupper(cv_mouse2opt.string[i]) == 'D') - { - if (cv_mouse2opt.string[i+1] == '-') - dtr = 0; - else - dtr = 1; - } - if (toupper(cv_mouse2opt.string[i]) == 'R') - { - if (cv_mouse2opt.string[i+1] == '-') - rts = 0; - else - rts = 1; - } - if (dtr != -1 || rts != -1) - { - INT32 c; - if (!ioctl(fdmouse2, TIOCMGET, &c)) - { - if (!dtr) - c &= ~TIOCM_DTR; - else if (dtr > 0) - c |= TIOCM_DTR; - } - if (!rts) - c &= ~TIOCM_RTS; - else if (rts > 0) - c |= TIOCM_RTS; - ioctl(fdmouse2, TIOCMSET, &c); - } - } - mouse2_started = 1; - I_AddExitFunc(I_ShutdownMouse2); -#elif defined (_WIN32) - DCB dcb; - - if (mouse2filehandle != INVALID_HANDLE_VALUE) - I_ShutdownMouse2(); - - if (cv_usemouse2.value == 0) - return; - - if (mouse2filehandle == INVALID_HANDLE_VALUE) - { - // COM file handle - mouse2filehandle = CreateFileA(cv_mouse2port.string, GENERIC_READ | GENERIC_WRITE, - 0, // exclusive access - NULL, // no security attrs - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - if (mouse2filehandle == INVALID_HANDLE_VALUE) - { - INT32 e = GetLastError(); - if (e == 5) - CONS_Alert(CONS_ERROR, M_GetText("Can't open %s: Access denied\n"), cv_mouse2port.string); - else - CONS_Alert(CONS_ERROR, M_GetText("Can't open %s: error %d\n"), cv_mouse2port.string, e); - return; - } - } - - // getevent when somthing happens - //SetCommMask(mouse2filehandle, EV_RXCHAR); - - // buffers - SetupComm(mouse2filehandle, MOUSECOMBUFFERSIZE, MOUSECOMBUFFERSIZE); - - // purge buffers - PurgeComm(mouse2filehandle, PURGE_TXABORT | PURGE_RXABORT - | PURGE_TXCLEAR | PURGE_RXCLEAR); - - // setup port to 1200 7N1 - dcb.DCBlength = sizeof (DCB); - - GetCommState(mouse2filehandle, &dcb); - - dcb.BaudRate = CBR_1200; - dcb.ByteSize = 7; - dcb.Parity = NOPARITY; - dcb.StopBits = ONESTOPBIT; - - dcb.fDtrControl = DTR_CONTROL_ENABLE; - dcb.fRtsControl = RTS_CONTROL_ENABLE; - - dcb.fBinary = TRUE; - dcb.fParity = TRUE; - - SetCommState(mouse2filehandle, &dcb); - I_AddExitFunc(I_ShutdownMouse2); -#endif -} - // // I_Tactile // diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 609afc30a..4f9549986 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1376,8 +1376,6 @@ void I_OsPolling(void) I_GetJoystickEvents(i); } - I_GetMouseEvents(); - I_GetEvent(); mod = SDL_GetModState();