1
0
Fork 0

Add logic in mouse driver to ignore button events that are out of sequence. Fixes International Rugby Challenge when clicking to lock the mouse.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4214
This commit is contained in:
ripsaw8080 2019-04-20 22:50:31 +00:00
parent bbea47d541
commit 911cc38865

View file

@ -525,18 +525,21 @@ void Mouse_ButtonPressed(Bit8u button) {
switch (button) {
#if (MOUSE_BUTTONS >= 1)
case 0:
if (mouse.buttons&1) return;
mouse.buttons|=1;
Mouse_AddEvent(MOUSE_LEFT_PRESSED);
break;
#endif
#if (MOUSE_BUTTONS >= 2)
case 1:
if (mouse.buttons&2) return;
mouse.buttons|=2;
Mouse_AddEvent(MOUSE_RIGHT_PRESSED);
break;
#endif
#if (MOUSE_BUTTONS >= 3)
case 2:
if (mouse.buttons&4) return;
mouse.buttons|=4;
Mouse_AddEvent(MOUSE_MIDDLE_PRESSED);
break;
@ -553,18 +556,21 @@ void Mouse_ButtonReleased(Bit8u button) {
switch (button) {
#if (MOUSE_BUTTONS >= 1)
case 0:
if (!(mouse.buttons&1)) return;
mouse.buttons&=~1;
Mouse_AddEvent(MOUSE_LEFT_RELEASED);
break;
#endif
#if (MOUSE_BUTTONS >= 2)
case 1:
if (!(mouse.buttons&2)) return;
mouse.buttons&=~2;
Mouse_AddEvent(MOUSE_RIGHT_RELEASED);
break;
#endif
#if (MOUSE_BUTTONS >= 3)
case 2:
if (!(mouse.buttons&4)) return;
mouse.buttons&=~4;
Mouse_AddEvent(MOUSE_MIDDLE_RELEASED);
break;
@ -698,6 +704,8 @@ static void Mouse_Reset(void) {
mouse.mickey_x = 0;
mouse.mickey_y = 0;
mouse.buttons = 0;
for (Bit16u but=0; but<MOUSE_BUTTONS; but++) {
mouse.times_pressed[but] = 0;
mouse.times_released[but] = 0;