delete nonfunctional second mouse stuff

This commit is contained in:
Alug committed 2025-01-20 22:18:59 +01:00
1 parent 4e311ca279
commit da3bf945cb
14 files changed
+12 -476

No files matched your search

-4
View File
@@ -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?!");
-1
View File
@@ -25,7 +25,6 @@ typedef enum
ev_console,
ev_mouse,
ev_joystick,
ev_mouse2,
ev_joystick2,
ev_joystick3,
ev_joystick4,
+1 -29
View File
@@ -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++)
{
-7
View File
@@ -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;
-4
View File
@@ -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;
+1 -8
View File
@@ -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();
+1 -2
View File
@@ -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];
+1 -39
View File
@@ -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] =
+3 -9
View File
@@ -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];
+1 -1
View File
@@ -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();
}
-8
View File
@@ -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);
+4 -25
View File
@@ -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)
-337
View File
@@ -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<<j))
{
if (!(button & (1<<j))) //keyup
{
event.type = ev_keyup;
event.data1 = KEY_2MOUSE1+j;
D_PostEvent(&event);
om2b ^= 1 << j;
}
}
else
{
if (button & (1<<j))
{
event.type = ev_keydown;
event.data1 = KEY_2MOUSE1+j;
D_PostEvent(&event);
om2b ^= 1 << j;
}
}
}
event.data2 = ((SINT8)mdata[1])+((SINT8)mdata[3]);
event.data3 = ((SINT8)mdata[2])+((SINT8)mdata[4]);
if (event.data2 && event.data3)
{
event.type = ev_mouse2;
event.data1 = 0;
D_PostEvent(&event);
}
}
i = 0;
}
}
//
// I_ShutdownMouse2
//
static void I_ShutdownMouse2(void)
{
if (fdmouse2 != -1) close(fdmouse2);
mouse2_started = 0;
}
#elif defined (_WIN32)
static HANDLE mouse2filehandle = INVALID_HANDLE_VALUE;
static void I_ShutdownMouse2(void)
{
event_t event;
INT32 i;
if (mouse2filehandle == INVALID_HANDLE_VALUE)
return;
SetCommMask(mouse2filehandle, 0);
EscapeCommFunction(mouse2filehandle, CLRDTR);
EscapeCommFunction(mouse2filehandle, CLRRTS);
PurgeComm(mouse2filehandle, PURGE_TXABORT | PURGE_RXABORT |
PURGE_TXCLEAR | PURGE_RXCLEAR);
CloseHandle(mouse2filehandle);
// emulate the up of all mouse buttons
for (i = 0; i < MOUSEBUTTONS; i++)
{
event.type = ev_keyup;
event.data1 = KEY_2MOUSE1+i;
D_PostEvent(&event);
}
mouse2filehandle = INVALID_HANDLE_VALUE;
}
#define MOUSECOMBUFFERSIZE 256
static INT32 handlermouse2x,handlermouse2y,handlermouse2buttons;
static void I_PoolMouse2(void)
{
UINT8 buffer[MOUSECOMBUFFERSIZE];
COMSTAT ComStat;
DWORD dwErrorFlags;
DWORD dwLength;
char dx,dy;
static INT32 bytenum;
static UINT8 combytes[4];
DWORD i;
ClearCommError(mouse2filehandle, &dwErrorFlags, &ComStat);
dwLength = min(MOUSECOMBUFFERSIZE, ComStat.cbInQue);
if (dwLength <= 0)
return;
if (!ReadFile(mouse2filehandle, buffer, dwLength, &dwLength, NULL))
{
CONS_Alert(CONS_WARNING, "%s", M_GetText("Read Error on secondary mouse port\n"));
return;
}
// parse the mouse packets
for (i = 0; i < dwLength; i++)
{
if ((buffer[i] & 64)== 64)
bytenum = 0;
if (bytenum < 4)
combytes[bytenum] = buffer[i];
bytenum++;
if (bytenum == 1)
{
handlermouse2buttons &= ~3;
handlermouse2buttons |= ((combytes[0] & (32+16)) >> 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
//
-2
View File
@@ -1376,8 +1376,6 @@ void I_OsPolling(void)
I_GetJoystickEvents(i);
}
I_GetMouseEvents();
I_GetEvent();
mod = SDL_GetModState();