- moved all mouse button handling to the input state

Yet again an unbelievable piece of code working around how input works on modern systems to keep the old 90's code alive.
This commit is contained in:
Christoph Oelckers 2019-11-04 01:01:54 +01:00
parent b4f91de7d3
commit 29b7e1cf79
14 changed files with 194 additions and 211 deletions

View file

@ -46,7 +46,7 @@ int32_t ctrlCheckAllInput(void)
{ {
return ( return (
inputState.keyBufferWaiting() || inputState.keyBufferWaiting() ||
MOUSE_GetButtons() || inputState.MouseGetButtons() ||
JOYSTICK_GetButtons() JOYSTICK_GetButtons()
); );
} }
@ -55,7 +55,7 @@ void ctrlClearAllInput(void)
{ {
inputState.keyFlushChars(); inputState.keyFlushChars();
inputState.ClearKeysDown(); inputState.ClearKeysDown();
MOUSE_ClearAllButtons(); inputState.MouseClearAllButtonss();
JOYSTICK_ClearAllButtons(); JOYSTICK_ClearAllButtons();
} }

View file

@ -166,7 +166,7 @@ void CGameMenuMgr::Draw(void)
} }
int32_t mousestatus = mouseReadAbs(&m_mousepos, &g_mouseAbs); int32_t mousestatus = mouseReadAbs(&m_mousepos, &g_mouseAbs);
if (mousestatus && g_mouseClickState == MOUSE_PRESSED) if (mousestatus && inputState.mouseClickState() == MOUSE_PRESSED)
m_mousedownpos = m_mousepos; m_mousedownpos = m_mousepos;
int16_t mousetile = 1043; // red arrow int16_t mousetile = 1043; // red arrow
@ -207,7 +207,8 @@ void CGameMenuMgr::Draw(void)
} }
} }
else else
g_mouseClickState = MOUSE_IDLE; inputState.clearMouseClickState();
} }
void CGameMenuMgr::Clear(void) void CGameMenuMgr::Clear(void)
@ -480,36 +481,24 @@ bool CGameMenuItem::Event(CGameMenuEvent &event)
bool CGameMenuItem::MouseEvent(CGameMenuEvent &event) bool CGameMenuItem::MouseEvent(CGameMenuEvent &event)
{ {
event.at0 = kMenuEventNone; event.at0 = kMenuEventNone;
if (MOUSEINACTIVECONDITIONAL(MOUSE_GetButtons()&LEFT_MOUSE)) if (MOUSEINACTIVECONDITIONAL(inputState.MouseGetButtons()&LEFT_MOUSE))
{ {
event.at0 = kMenuEventEnter; event.at0 = kMenuEventEnter;
MOUSE_ClearButton(LEFT_MOUSE); inputState.MouseClearButton(LEFT_MOUSE);
} }
else if (MOUSE_GetButtons()&RIGHT_MOUSE) else if (inputState.MouseGetButtons()&RIGHT_MOUSE)
{ {
event.at0 = kMenuEventEscape; event.at0 = kMenuEventEscape;
MOUSE_ClearButton(RIGHT_MOUSE); inputState.MouseClearButton(RIGHT_MOUSE);
} }
#if 0 else if (inputState.MouseGetButtons()&WHEELUP_MOUSE)
else if (MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELUP_MOUSE)))
{ {
MOUSE_ClearButton(WHEELUP_MOUSE); inputState.MouseClearButton(WHEELUP_MOUSE);
event.bAutoAim = kMenuEventScrollLeft;
}
else if (MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELDOWN_MOUSE)))
{
MOUSE_ClearButton(WHEELDOWN_MOUSE);
event.bAutoAim = kMenuEventScrollRight;
}
#endif
else if (MOUSE_GetButtons()&WHEELUP_MOUSE)
{
MOUSE_ClearButton(WHEELUP_MOUSE);
event.at0 = kMenuEventUp; event.at0 = kMenuEventUp;
} }
else if (MOUSE_GetButtons()&WHEELDOWN_MOUSE) else if (inputState.MouseGetButtons()&WHEELDOWN_MOUSE)
{ {
MOUSE_ClearButton(WHEELDOWN_MOUSE); inputState.MouseClearButton(WHEELDOWN_MOUSE);
event.at0 = kMenuEventDown; event.at0 = kMenuEventDown;
} }
return event.at0 != kMenuEventNone; return event.at0 != kMenuEventNone;
@ -632,7 +621,7 @@ void CGameMenuItemZBool::Draw(void)
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
} }
if (!gGameMenuMgr.m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !gGameMenuMgr.MouseOutsideBounds(&gGameMenuMgr.m_mousedownpos, mx, my, mw, mh)) if (!gGameMenuMgr.m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !gGameMenuMgr.MouseOutsideBounds(&gGameMenuMgr.m_mousedownpos, mx, my, mw, mh))
{ {
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
@ -714,7 +703,7 @@ void CGameMenuItemChain::Draw(void)
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
} }
if (!gGameMenuMgr.m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !gGameMenuMgr.MouseOutsideBounds(&gGameMenuMgr.m_mousedownpos, x<<16, y<<16, width<<16, height<<16)) if (!gGameMenuMgr.m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !gGameMenuMgr.MouseOutsideBounds(&gGameMenuMgr.m_mousedownpos, x<<16, y<<16, width<<16, height<<16))
{ {
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
@ -1174,7 +1163,7 @@ void CGameMenuItemKeyList::Draw(void)
nNewFocus = k; nNewFocus = k;
} }
if (!gGameMenuMgr.m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !gGameMenuMgr.MouseOutsideBounds(&gGameMenuMgr.m_mousedownpos, mx, my, mw, mh)) if (!gGameMenuMgr.m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !gGameMenuMgr.MouseOutsideBounds(&gGameMenuMgr.m_mousedownpos, mx, my, mw, mh))
{ {
nNewFocus = k; nNewFocus = k;
bClick = true; bClick = true;
@ -1273,16 +1262,16 @@ bool CGameMenuItemKeyList::Event(CGameMenuEvent &event)
bool CGameMenuItemKeyList::MouseEvent(CGameMenuEvent &event) bool CGameMenuItemKeyList::MouseEvent(CGameMenuEvent &event)
{ {
event.at0 = kMenuEventNone; event.at0 = kMenuEventNone;
if (MOUSEACTIVECONDITIONAL(MOUSE_GetButtons()&WHEELUP_MOUSE)) if (MOUSEACTIVECONDITIONAL(inputState.MouseGetButtons()&WHEELUP_MOUSE))
{ {
gGameMenuMgr.m_mouselastactivity = (int)totalclock; gGameMenuMgr.m_mouselastactivity = (int)totalclock;
MOUSE_ClearButton(WHEELUP_MOUSE); inputState.MouseClearButton(WHEELUP_MOUSE);
event.at0 = kMenuEventScrollUp; event.at0 = kMenuEventScrollUp;
} }
else if (MOUSEACTIVECONDITIONAL(MOUSE_GetButtons()&WHEELDOWN_MOUSE)) else if (MOUSEACTIVECONDITIONAL(inputState.MouseGetButtons()&WHEELDOWN_MOUSE))
{ {
gGameMenuMgr.m_mouselastactivity = (int)totalclock; gGameMenuMgr.m_mouselastactivity = (int)totalclock;
MOUSE_ClearButton(WHEELDOWN_MOUSE); inputState.MouseClearButton(WHEELDOWN_MOUSE);
event.at0 = kMenuEventScrollDown; event.at0 = kMenuEventScrollDown;
} }
else else
@ -1413,7 +1402,7 @@ void CGameMenuItemSlider::Draw(void)
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
} }
if (!gGameMenuMgr.m_mousecaught && (g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD)) if (!gGameMenuMgr.m_mousecaught && (inputState.mouseClickState() == MOUSE_PRESSED || inputState.mouseClickState() == MOUSE_HELD))
{ {
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
@ -1491,31 +1480,31 @@ bool CGameMenuItemSlider::Event(CGameMenuEvent &event)
bool CGameMenuItemSlider::MouseEvent(CGameMenuEvent &event) bool CGameMenuItemSlider::MouseEvent(CGameMenuEvent &event)
{ {
event.at0 = kMenuEventNone; event.at0 = kMenuEventNone;
if (MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELUP_MOUSE))) if (MOUSEINACTIVECONDITIONAL((inputState.MouseGetButtons()&LEFT_MOUSE) && (inputState.MouseGetButtons()&WHEELUP_MOUSE)))
{ {
MOUSE_ClearButton(WHEELUP_MOUSE); inputState.MouseClearButton(WHEELUP_MOUSE);
event.at0 = kMenuEventLeft; event.at0 = kMenuEventLeft;
} }
else if (MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELDOWN_MOUSE))) else if (MOUSEINACTIVECONDITIONAL((inputState.MouseGetButtons()&LEFT_MOUSE) && (inputState.MouseGetButtons()&WHEELDOWN_MOUSE)))
{ {
MOUSE_ClearButton(WHEELDOWN_MOUSE); inputState.MouseClearButton(WHEELDOWN_MOUSE);
event.at0 = kMenuEventRight; event.at0 = kMenuEventRight;
} }
else if (MOUSE_GetButtons()&RIGHT_MOUSE) else if (inputState.MouseGetButtons()&RIGHT_MOUSE)
{ {
MOUSE_ClearButton(RIGHT_MOUSE); inputState.MouseClearButton(RIGHT_MOUSE);
event.at0 = kMenuEventEscape; event.at0 = kMenuEventEscape;
} }
else if (MOUSE_GetButtons()&WHEELUP_MOUSE) else if (inputState.MouseGetButtons()&WHEELUP_MOUSE)
{ {
MOUSE_ClearButton(WHEELUP_MOUSE); inputState.MouseClearButton(WHEELUP_MOUSE);
MOUSE_ClearButton(LEFT_MOUSE); inputState.MouseClearButton(LEFT_MOUSE);
event.at0 = kMenuEventUp; event.at0 = kMenuEventUp;
} }
else if (MOUSE_GetButtons()&WHEELDOWN_MOUSE) else if (inputState.MouseGetButtons()&WHEELDOWN_MOUSE)
{ {
MOUSE_ClearButton(WHEELDOWN_MOUSE); inputState.MouseClearButton(WHEELDOWN_MOUSE);
MOUSE_ClearButton(LEFT_MOUSE); inputState.MouseClearButton(LEFT_MOUSE);
event.at0 = kMenuEventDown; event.at0 = kMenuEventDown;
} }
return event.at0 != kMenuEventNone; return event.at0 != kMenuEventNone;
@ -1642,7 +1631,7 @@ void CGameMenuItemSliderFloat::Draw(void)
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
} }
if (!gGameMenuMgr.m_mousecaught && (g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD)) if (!gGameMenuMgr.m_mousecaught && (inputState.mouseClickState() == MOUSE_PRESSED || inputState.mouseClickState() == MOUSE_HELD))
{ {
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
@ -1817,7 +1806,7 @@ void CGameMenuItemZEdit::Draw(void)
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
} }
if (!gGameMenuMgr.m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !gGameMenuMgr.MouseOutsideBounds(&gGameMenuMgr.m_mousedownpos, mx, my, mw, mh)) if (!gGameMenuMgr.m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !gGameMenuMgr.MouseOutsideBounds(&gGameMenuMgr.m_mousedownpos, mx, my, mw, mh))
{ {
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
@ -2003,7 +1992,7 @@ void CGameMenuItemZEditBitmap::Draw(void)
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
} }
if (!gGameMenuMgr.m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !gGameMenuMgr.MouseOutsideBounds(&gGameMenuMgr.m_mousedownpos, mx, my, mw, mh)) if (!gGameMenuMgr.m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !gGameMenuMgr.MouseOutsideBounds(&gGameMenuMgr.m_mousedownpos, mx, my, mw, mh))
{ {
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
@ -2161,7 +2150,7 @@ void CGameMenuItemQAV::Draw(void)
gFrameClock = backFC; gFrameClock = backFC;
} }
if (bEnable && !gGameMenuMgr.m_mousecaught && g_mouseClickState == MOUSE_RELEASED) if (bEnable && !gGameMenuMgr.m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED)
{ {
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
@ -2288,7 +2277,7 @@ void CGameMenuItemZCycleSelect::Draw(void)
nNewFocus = k; nNewFocus = k;
} }
if (!gGameMenuMgr.m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !gGameMenuMgr.MouseOutsideBounds(&gGameMenuMgr.m_mousedownpos, mx, my, mw, mh)) if (!gGameMenuMgr.m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !gGameMenuMgr.MouseOutsideBounds(&gGameMenuMgr.m_mousedownpos, mx, my, mw, mh))
{ {
nNewFocus = k; nNewFocus = k;
bClick = true; bClick = true;
@ -2366,16 +2355,16 @@ bool CGameMenuItemZCycleSelect::Event(CGameMenuEvent &event)
bool CGameMenuItemZCycleSelect::MouseEvent(CGameMenuEvent &event) bool CGameMenuItemZCycleSelect::MouseEvent(CGameMenuEvent &event)
{ {
event.at0 = kMenuEventNone; event.at0 = kMenuEventNone;
if (MOUSEACTIVECONDITIONAL(MOUSE_GetButtons()&WHEELUP_MOUSE)) if (MOUSEACTIVECONDITIONAL(inputState.MouseGetButtons()&WHEELUP_MOUSE))
{ {
gGameMenuMgr.m_mouselastactivity = (int)totalclock; gGameMenuMgr.m_mouselastactivity = (int)totalclock;
MOUSE_ClearButton(WHEELUP_MOUSE); inputState.MouseClearButton(WHEELUP_MOUSE);
event.at0 = kMenuEventScrollUp; event.at0 = kMenuEventScrollUp;
} }
else if (MOUSEACTIVECONDITIONAL(MOUSE_GetButtons()&WHEELDOWN_MOUSE)) else if (MOUSEACTIVECONDITIONAL(inputState.MouseGetButtons()&WHEELDOWN_MOUSE))
{ {
gGameMenuMgr.m_mouselastactivity = (int)totalclock; gGameMenuMgr.m_mouselastactivity = (int)totalclock;
MOUSE_ClearButton(WHEELDOWN_MOUSE); inputState.MouseClearButton(WHEELDOWN_MOUSE);
event.at0 = kMenuEventScrollDown; event.at0 = kMenuEventScrollDown;
} }
else else
@ -2480,7 +2469,7 @@ void CGameMenuItemZCycle::Draw(void)
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
} }
if (!gGameMenuMgr.m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !gGameMenuMgr.MouseOutsideBounds(&gGameMenuMgr.m_mousedownpos, x<<16, y<<16, m_nWidth<<16, height<<16)) if (!gGameMenuMgr.m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !gGameMenuMgr.MouseOutsideBounds(&gGameMenuMgr.m_mousedownpos, x<<16, y<<16, m_nWidth<<16, height<<16))
{ {
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);
@ -2657,7 +2646,7 @@ void CGameMenuItemYesNoQuit::Draw(void)
} }
gMenuTextMgr.DrawText(m_pzText, m_nFont, x, m_nY, shade, 0, true); gMenuTextMgr.DrawText(m_pzText, m_nFont, x, m_nY, shade, 0, true);
if (bEnable && !gGameMenuMgr.m_mousecaught && g_mouseClickState == MOUSE_RELEASED) if (bEnable && !gGameMenuMgr.m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED)
{ {
pMenu->SetFocusItem(this); pMenu->SetFocusItem(this);

View file

@ -111,21 +111,12 @@ char CONSTEXPR const g_keyAsciiTableShift[128] = {
extern vec2_t g_mousePos; extern vec2_t g_mousePos;
extern vec2_t g_mouseAbs; extern vec2_t g_mouseAbs;
extern int32_t g_mouseBits; extern int32_t g_mouseBits;
extern uint8_t g_mouseClickState; extern uint8_t inputState.mouseClickState();
extern bool g_mouseGrabbed; extern bool g_mouseGrabbed;
extern bool g_mouseEnabled; extern bool g_mouseEnabled;
extern bool g_mouseInsideWindow; extern bool g_mouseInsideWindow;
extern bool g_mouseLockedToWindow; extern bool g_mouseLockedToWindow;
enum
{
MOUSE_IDLE = 0,
MOUSE_PRESSED,
MOUSE_HELD,
MOUSE_RELEASED,
};
extern int32_t mouseAdvanceClickState(void);
// joystick // joystick
typedef struct typedef struct
@ -160,13 +151,8 @@ void debugprintf(const char *,...) ATTRIBUTE((format(printf,1,2)));
int32_t handleevents(void); int32_t handleevents(void);
int32_t handleevents_peekkeys(void); int32_t handleevents_peekkeys(void);
extern void (*keypresscallback)(int32_t,int32_t);
extern void (*g_mouseCallback)(int32_t,int32_t);
int32_t initinput(void); int32_t initinput(void);
void uninitinput(void); void uninitinput(void);
void keySetCallback(void (*callback)(int32_t,int32_t));
void mouseSetCallback(void (*callback)(int32_t,int32_t));
void joySetCallback(void (*callback)(int32_t,int32_t)); void joySetCallback(void (*callback)(int32_t,int32_t));
const char *joyGetName(int32_t what, int32_t num); // what: 0=axis, 1=button, 2=hat const char *joyGetName(int32_t what, int32_t num); // what: 0=axis, 1=button, 2=hat
void joyScanDevices(void); void joyScanDevices(void);
@ -177,8 +163,6 @@ int32_t mouseReadAbs(vec2_t *pResult, vec2_t const *pInput);
void mouseGrabInput(bool grab); void mouseGrabInput(bool grab);
void mouseLockToWindow(char a); void mouseLockToWindow(char a);
void mouseMoveToCenter(void); void mouseMoveToCenter(void);
int32_t mouseReadButtons(void);
void mouseReadPos(int32_t *x, int32_t *y);
void joyReadButtons(int32_t *pResult); void joyReadButtons(int32_t *pResult);
void joySetDeadZone(int32_t axis, uint16_t dead, uint16_t satur); void joySetDeadZone(int32_t axis, uint16_t dead, uint16_t satur);

View file

@ -899,8 +899,6 @@ int32_t getsectordist(vec2_t const in, int const sectnum, vec2_t * const out = n
extern const int16_t *chsecptr_onextwall; extern const int16_t *chsecptr_onextwall;
int32_t checksectorpointer(int16_t i, int16_t sectnum); int32_t checksectorpointer(int16_t i, int16_t sectnum);
void mouseGetValues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) ATTRIBUTE((nonnull(1,2,3)));
#if !KRANDDEBUG && !defined LUNATIC #if !KRANDDEBUG && !defined LUNATIC
static FORCE_INLINE int32_t krand(void) static FORCE_INLINE int32_t krand(void)
{ {

View file

@ -28,27 +28,13 @@ char inputdevices = 0;
vec2_t g_mousePos; vec2_t g_mousePos;
vec2_t g_mouseAbs; vec2_t g_mouseAbs;
int32_t g_mouseBits;
uint8_t g_mouseClickState;
bool g_mouseEnabled; bool g_mouseEnabled;
bool g_mouseGrabbed; bool g_mouseGrabbed;
bool g_mouseInsideWindow = 1; bool g_mouseInsideWindow = 1;
bool g_mouseLockedToWindow = 1; bool g_mouseLockedToWindow = 1;
void (*g_mouseCallback)(int32_t, int32_t);
void mouseSetCallback(void(*callback)(int32_t, int32_t)) { g_mouseCallback = callback; }
int32_t mouseAdvanceClickState(void)
{
switch (g_mouseClickState)
{
case MOUSE_PRESSED: g_mouseClickState = MOUSE_HELD; return 1;
case MOUSE_RELEASED: g_mouseClickState = MOUSE_IDLE; return 1;
case MOUSE_HELD: return 1;
}
return 0;
}
void mouseReadPos(int32_t *x, int32_t *y) void mouseReadPos(int32_t *x, int32_t *y)
{ {
@ -78,11 +64,6 @@ int32_t mouseReadAbs(vec2_t * const pResult, vec2_t const * const pInput)
return 1; return 1;
} }
int32_t mouseReadButtons(void)
{
return (!g_mouseEnabled || !appactive || !g_mouseInsideWindow || (osd && osd->flags & OSD_CAPTURE)) ? 0 : g_mouseBits;
}
controllerinput_t joystick; controllerinput_t joystick;
void joySetCallback(void (*callback)(int32_t, int32_t)) { joystick.pCallback = callback; } void joySetCallback(void (*callback)(int32_t, int32_t)) { joystick.pCallback = callback; }

View file

@ -11656,16 +11656,6 @@ void rotatepoint(vec2_t const pivot, vec2_t p, int16_t const daang, vec2_t * con
} }
//
// getmousevalues
//
void mouseGetValues(int32_t *mousx, int32_t *mousy, int32_t *bstatus)
{
mouseReadPos(mousx, mousy);
*bstatus = mouseReadButtons();
}
#if KRANDDEBUG #if KRANDDEBUG
# include <execinfo.h> # include <execinfo.h>

View file

@ -1733,10 +1733,6 @@ int32_t handleevents_peekkeys(void)
return SDL_PeepEvents(NULL, 1, SDL_PEEKEVENT, SDL_KEYDOWN, SDL_KEYDOWN); return SDL_PeepEvents(NULL, 1, SDL_PEEKEVENT, SDL_KEYDOWN, SDL_KEYDOWN);
} }
void handleevents_updatemousestate(uint8_t state)
{
g_mouseClickState = state == SDL_RELEASED ? MOUSE_RELEASED : MOUSE_PRESSED;
}
// //
@ -1773,27 +1769,22 @@ int32_t handleevents_sdlcommon(SDL_Event *ev)
switch (ev->button.button) switch (ev->button.button)
{ {
default: j = -1; break; default: j = -1; break;
case SDL_BUTTON_LEFT: j = 0; handleevents_updatemousestate(ev->button.state); break; case SDL_BUTTON_LEFT: j = KEY_MOUSE1; break;
case SDL_BUTTON_RIGHT: j = 1; break; case SDL_BUTTON_RIGHT: j = KEY_MOUSE2; break;
case SDL_BUTTON_MIDDLE: j = 2; break; case SDL_BUTTON_MIDDLE: j = KEY_MOUSE3; break;
/* Thumb buttons. */ /* Thumb buttons. */
// On SDL2/Windows and SDL >= 2.0.?/Linux, everything is as it should be. // On SDL2/Windows and SDL >= 2.0.?/Linux, everything is as it should be.
// If anyone cares about old versions of SDL2 on Linux, patches welcome. // If anyone cares about old versions of SDL2 on Linux, patches welcome.
case SDL_BUTTON_X1: j = 3; break; case SDL_BUTTON_X1: j = KEY_MOUSE4; break;
case SDL_BUTTON_X2: j = 6; break; case SDL_BUTTON_X2: j = KEY_MOUSE5; break;
} }
if (j < 0) if (j < 0)
break; break;
if (ev->button.state == SDL_PRESSED) event_t ev = { (ev->button.state == SDL_PRESSED)? EV_KeyDown : EV_KeyUp, 0, j};
g_mouseBits |= (1 << j); D_PostEvent(ev);
else
g_mouseBits &= ~(1 << j);
if (g_mouseCallback)
g_mouseCallback(j+1, ev->button.state == SDL_PRESSED);
break; break;
} }
@ -2013,17 +2004,17 @@ int32_t handleevents_pollsdl(void)
case SDL_MOUSEWHEEL: case SDL_MOUSEWHEEL:
// initprintf("wheel y %d\n",ev.wheel.y); // initprintf("wheel y %d\n",ev.wheel.y);
// This never sends keyup events. For the current code that should suffice
if (ev.wheel.y > 0) if (ev.wheel.y > 0)
{ {
g_mouseBits |= 16; event_t ev = { EV_KeyDown, 0, (int16_t)KEY_MWHEELUP };
if (g_mouseCallback) D_PostEvent(&ev);
g_mouseCallback(5, 1);
} }
if (ev.wheel.y < 0) if (ev.wheel.y < 0)
{ {
g_mouseBits |= 32; event_t ev = { EV_KeyDown, 0, (int16_t)KEY_MWHEELDOWN };
if (g_mouseCallback) D_PostEvent(&ev);
g_mouseCallback(6, 1);
} }
break; break;
@ -2076,13 +2067,6 @@ int32_t handleevents(void)
if (inputchecked && g_mouseEnabled) if (inputchecked && g_mouseEnabled)
{ {
if (g_mouseCallback)
{
if (g_mouseBits & 16)
g_mouseCallback(5, 0);
if (g_mouseBits & 32)
g_mouseCallback(6, 0);
}
g_mouseBits &= ~(16 | 32); g_mouseBits &= ~(16 | 32);
} }

View file

@ -172,7 +172,7 @@ void D_PostEvent (const event_t *ev)
return; return;
} }
events[eventhead] = *ev; events[eventhead] = *ev;
#if 0 #if 0 // No idea if this can be made to work ever... For now, pass on the mouse movement event so that the input code can deal with them itself.
if (ev->type == EV_Mouse && menuactive == MENU_Off && ConsoleState != c_down && ConsoleState != c_falling && !primaryLevel->localEventManager->Responder(ev) && !paused) if (ev->type == EV_Mouse && menuactive == MENU_Off && ConsoleState != c_down && ConsoleState != c_falling && !primaryLevel->localEventManager->Responder(ev) && !paused)
{ {
if (Button_Mlook.bDown || freelook) if (Button_Mlook.bDown || freelook)

View file

@ -23,7 +23,6 @@ enum
{ {
NUMKEYS = 256, NUMKEYS = 256,
MAXMOUSEBUTTONS = 10, MAXMOUSEBUTTONS = 10,
}; };
extern int32_t CONTROL_ButtonFlags[NUMKEYS]; extern int32_t CONTROL_ButtonFlags[NUMKEYS];
@ -120,6 +119,26 @@ enum GameFunction_t
}; };
enum EMouseBits
{
LEFT_MOUSE = 1,
RIGHT_MOUSE = 2,
MIDDLE_MOUSE = 4,
THUMB_MOUSE = 8,
WHEELUP_MOUSE = 16,
WHEELDOWN_MOUSE= 32,
THUMB2_MOUSE = 64,
};
enum
{
MOUSE_IDLE = 0,
MOUSE_PRESSED,
MOUSE_HELD,
MOUSE_RELEASED,
};
class InputState class InputState
{ {
enum enum
@ -147,6 +166,8 @@ class InputState
kb_scancode KB_LastScan; kb_scancode KB_LastScan;
int g_mouseBits;
uint8_t g_mouseClickState;
public: public:
bool BUTTON(int x) bool BUTTON(int x)
@ -333,12 +354,67 @@ public:
ClearAllKeyStatus(); ClearAllKeyStatus();
} }
void mouseSetBit(int val, int state)
{
if (state) g_mouseBits |= val;
else g_mouseBits &=~val;
}
void handleevents_updatemousestate(uint8_t state)
{
g_mouseClickState = state == EV_KeyUp ? MOUSE_RELEASED : MOUSE_PRESSED;
}
void AddEvent(const event_t *ev) void AddEvent(const event_t *ev)
{ {
// Set the old mouseBits. Yet another piece of cruft that needs to go away.
if (ev->type == EV_KeyDown || ev->type == EV_KeyUp)
{
switch (ev->data1)
{
case KEY_MOUSE1 : mouseSetBit(LEFT_MOUSE, ev->type == EV_KeyDown); handleevents_updatemousestate(ev->type); break;
case KEY_MOUSE2 : mouseSetBit(RIGHT_MOUSE, ev->type == EV_KeyDown); break;
case KEY_MOUSE3 : mouseSetBit(MIDDLE_MOUSE, ev->type == EV_KeyDown); break;
case KEY_MOUSE4 : mouseSetBit(THUMB_MOUSE, ev->type == EV_KeyDown); break;
case KEY_MWHEELUP: mouseSetBit(WHEELUP_MOUSE, ev->type == EV_KeyDown); break;
case KEY_MWHEELDOWN: mouseSetBit(WHEELDOWN_MOUSE, ev->type == EV_KeyDown); break;
case KEY_MOUSE5: mouseSetBit(THUMB2_MOUSE, ev->type == EV_KeyDown); break;
default: break;
}
}
keySetState(ev->data1, ev->type == EV_KeyDown); keySetState(ev->data1, ev->type == EV_KeyDown);
if (ev->data2) keySetChar(ev->data2); if (ev->data2) keySetChar(ev->data2);
} }
int32_t mouseReadButtons(void)
{
return (!g_mouseEnabled || !appactive || !g_mouseInsideWindow || (osd && osd->flags & OSD_CAPTURE)) ? 0 : g_mouseBits;
}
int mouseClickState()
{
return g_mouseClickState;
}
void clearMouseClickState()
{
g_mouseClickState = MOUSE_IDLE;
}
int32_t mouseAdvanceClickState(void)
{
switch (g_mouseClickState)
{
case MOUSE_PRESSED: g_mouseClickState = MOUSE_HELD; return 1;
case MOUSE_RELEASED: g_mouseClickState = MOUSE_IDLE; return 1;
case MOUSE_HELD: return 1;
}
return 0;
}
static inline int32_t MouseGetButtons(void) { return mouseReadButtons(); }
static inline void MouseClearButton(int32_t b) { g_mouseBits &= ~b; }
static inline void MouseClearAllButtonss(void) { g_mouseBits = 0; }
}; };

View file

@ -4605,7 +4605,7 @@ static void Menu_RunScrollbar(Menu_t *cm, MenuMenuFormat_t const * const format,
rotatesprite_fs(scrollx + ((scrollwidth>>17)<<16) - ((tilesiz[scrollTileCursor].x>>1)*ud.menu_scrollcursorz), scrollregionstart + scale(scrollregionheight, *scrollPos, scrollPosMax), ud.menu_scrollcursorz, 0, scrollTileCursor, 0, 0, 26); rotatesprite_fs(scrollx + ((scrollwidth>>17)<<16) - ((tilesiz[scrollTileCursor].x>>1)*ud.menu_scrollcursorz), scrollregionstart + scale(scrollregionheight, *scrollPos, scrollPosMax), ud.menu_scrollcursorz, 0, scrollTileCursor, 0, 0, 26);
if (cm == m_currentMenu && !m_mousecaught && MOUSEACTIVECONDITIONAL(g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD)) if (cm == m_currentMenu && !m_mousecaught && MOUSEACTIVECONDITIONAL(inputState.mouseClickState() == MOUSE_PRESSED || inputState.mouseClickState() == MOUSE_HELD))
{ {
const int32_t scrolltilehalfheight = (tilesiz[scrollTileCursor].y>>1)*ud.menu_scrollcursorz; const int32_t scrolltilehalfheight = (tilesiz[scrollTileCursor].y>>1)*ud.menu_scrollcursorz;
const int32_t scrollregiony = scrollregionstart + scrolltilehalfheight; const int32_t scrollregiony = scrollregionstart + scrolltilehalfheight;
@ -4814,7 +4814,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
} }
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->get_yline())) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->get_yline()))
{ {
menu->currentEntry = e; menu->currentEntry = e;
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
@ -4859,7 +4859,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
} }
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->get_yline())) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->get_yline()))
{ {
menu->currentEntry = e; menu->currentEntry = e;
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
@ -4915,7 +4915,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
menu->currentColumn = 1; menu->currentColumn = 1;
} }
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[1], mousey, column1textsize.x, object->font->get_yline())) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[1], mousey, column1textsize.x, object->font->get_yline()))
{ {
menu->currentEntry = e; menu->currentEntry = e;
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
@ -4938,7 +4938,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
menu->currentColumn = 0; menu->currentColumn = 0;
} }
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[0], mousey, column0textsize.x, object->font->get_yline())) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[0], mousey, column0textsize.x, object->font->get_yline()))
{ {
menu->currentEntry = e; menu->currentEntry = e;
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
@ -5023,7 +5023,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
} }
if (!m_mousecaught && (g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD)) if (!m_mousecaught && (inputState.mouseClickState() == MOUSE_PRESSED || inputState.mouseClickState() == MOUSE_HELD))
{ {
const int32_t slidepointhalfwidth = mulscale16((((tilesiz[SLIDEBAR+1].x)*ud.menu_slidecursorz)>>2) + ud.menu_slidebarmargin, z); const int32_t slidepointhalfwidth = mulscale16((((tilesiz[SLIDEBAR+1].x)*ud.menu_slidecursorz)>>2) + ud.menu_slidebarmargin, z);
const int32_t slideregionx = slidebarx + slidepointhalfwidth; const int32_t slideregionx = slidebarx + slidepointhalfwidth;
@ -5122,7 +5122,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
} }
if (!m_mousecaught && (g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD)) if (!m_mousecaught && (inputState.mouseClickState() == MOUSE_PRESSED || inputState.mouseClickState() == MOUSE_HELD))
{ {
const int32_t slidepointhalfwidth = mulscale16((2+tilesiz[SLIDEBAR+1].x)<<15, z); const int32_t slidepointhalfwidth = mulscale16((2+tilesiz[SLIDEBAR+1].x)<<15, z);
const int32_t slideregionx = slidebarx + slidepointhalfwidth; const int32_t slideregionx = slidebarx + slidepointhalfwidth;
@ -5222,7 +5222,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
} }
if (!m_mousecaught && (g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD)) if (!m_mousecaught && (inputState.mouseClickState() == MOUSE_PRESSED || inputState.mouseClickState() == MOUSE_HELD))
{ {
const int32_t slidepointhalfwidth = mulscale16((2+tilesiz[SLIDEBAR+1].x)<<15, z); const int32_t slidepointhalfwidth = mulscale16((2+tilesiz[SLIDEBAR+1].x)<<15, z);
const int32_t slideregionx = slidebarx + slidepointhalfwidth; const int32_t slideregionx = slidebarx + slidepointhalfwidth;
@ -5295,7 +5295,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
} }
#ifndef EDUKE32_TOUCH_DEVICES #ifndef EDUKE32_TOUCH_DEVICES
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, mousewidth, h) && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, h)) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, mousewidth, h) && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, h))
#endif #endif
{ {
if (entry == currentry && object->editfield != NULL) if (entry == currentry && object->editfield != NULL)
@ -5423,7 +5423,7 @@ static void Menu_RunOptionList(Menu_t *cm, MenuEntry_t *entry, MenuOption_t *obj
object->options->currentEntry = e; object->options->currentEntry = e;
} }
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, object->options->font->get_yline())) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, object->options->font->get_yline()))
{ {
object->options->currentEntry = e; object->options->currentEntry = e;
@ -5446,7 +5446,7 @@ static void Menu_RunOptionList(Menu_t *cm, MenuEntry_t *entry, MenuOption_t *obj
static int32_t Menu_RunInput_MouseAdvance(void) static int32_t Menu_RunInput_MouseAdvance(void)
{ {
return MOUSEACTIVECONDITIONAL(!m_mousecaught && g_mouseClickState == MOUSE_RELEASED); return MOUSEACTIVECONDITIONAL(!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED);
} }
static int32_t Menu_RunInput_MouseReturn_status; static int32_t Menu_RunInput_MouseReturn_status;
@ -5491,10 +5491,10 @@ static int32_t Menu_RunInput_MouseReturn(void)
#if !defined EDUKE32_TOUCH_DEVICES #if !defined EDUKE32_TOUCH_DEVICES
Menu_RunInput_MouseReturn_status = 1; Menu_RunInput_MouseReturn_status = 1;
#else #else
Menu_RunInput_MouseReturn_status = (g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD); Menu_RunInput_MouseReturn_status = (inputState.mouseClickState() == MOUSE_PRESSED || inputState.mouseClickState() == MOUSE_HELD);
#endif #endif
return !m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, MouseReturnRegionX, 0, backbuttonbound.x, backbuttonbound.y); return !m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, MouseReturnRegionX, 0, backbuttonbound.x, backbuttonbound.y);
} }
Menu_RunInput_MouseReturn_status = 0; Menu_RunInput_MouseReturn_status = 0;
@ -5701,7 +5701,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin)
Menu_RunInput_FileSelect_MovementVerify(object); Menu_RunInput_FileSelect_MovementVerify(object);
} }
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, textdim.x, object->font[i]->get_yline())) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, textdim.x, object->font[i]->get_yline()))
{ {
object->findhigh[i] = dir; object->findhigh[i] = dir;
object->currentList = i; object->currentList = i;
@ -6919,7 +6919,7 @@ void M_DisplayMenus(void)
Menu_AnimateChange(MENU_QUIT, MA_Advance); Menu_AnimateChange(MENU_QUIT, MA_Advance);
int32_t mousestatus = mouseReadAbs(&m_mousepos, &g_mouseAbs); int32_t mousestatus = mouseReadAbs(&m_mousepos, &g_mouseAbs);
if (mousestatus && g_mouseClickState == MOUSE_PRESSED) if (mousestatus && inputState.mouseClickState() == MOUSE_PRESSED)
m_mousedownpos = m_mousepos; m_mousedownpos = m_mousepos;
Menu_RunInput(m_currentMenu); Menu_RunInput(m_currentMenu);
@ -7124,7 +7124,7 @@ void M_DisplayMenus(void)
} }
} }
else else
g_mouseClickState = MOUSE_IDLE; inputState.clearMouseClickState();
#endif #endif
if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU)

View file

@ -31,27 +31,8 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#define mouse_h_ #define mouse_h_
#include "baselayer.h" #include "baselayer.h"
#include "inputstate.h"
#define LEFT_MOUSE 1
#define RIGHT_MOUSE 2
#define MIDDLE_MOUSE 4
#define THUMB_MOUSE 8
#define WHEELUP_MOUSE 16
#define WHEELDOWN_MOUSE 32
#define LEFT_MOUSE_PRESSED(button) (((button)&LEFT_MOUSE) != 0)
#define RIGHT_MOUSE_PRESSED(button) (((button)&RIGHT_MOUSE) != 0)
#define MIDDLE_MOUSE_PRESSED(button) (((button)&MIDDLE_MOUSE) != 0)
static inline bool Mouse_Init(void)
{
mouseInit();
return ((inputdevices & 2) == 2);
}
static inline void MOUSE_Shutdown(void) { mouseUninit(); }
static inline int32_t MOUSE_GetButtons(void) { return mouseReadButtons(); }
static inline void MOUSE_ClearButton(int32_t b) { g_mouseBits &= ~b; }
static inline void MOUSE_ClearAllButtons(void) { g_mouseBits = 0; }
#endif /* __mouse_h */ #endif /* __mouse_h */

View file

@ -342,7 +342,7 @@ static void CONTROL_GetDeviceButtons(void)
if (CONTROL_MouseEnabled) if (CONTROL_MouseEnabled)
{ {
DoGetDeviceButtons( DoGetDeviceButtons(
MOUSE_GetButtons(), t, inputState.MouseGetButtons(), t,
CONTROL_NumMouseButtons, CONTROL_NumMouseButtons,
CONTROL_MouseButtonState, CONTROL_MouseButtonState,
CONTROL_MouseButtonClickedTime, CONTROL_MouseButtonClickedTime,
@ -636,10 +636,9 @@ bool CONTROL_Startup(controltype which, int32_t(*TimeFunction)(void), int32_t ti
if (initinput()) if (initinput())
return true; return true;
KB_Startup();
CONTROL_NumMouseButtons = MAXMOUSEBUTTONS; CONTROL_NumMouseButtons = MAXMOUSEBUTTONS;
CONTROL_MousePresent = Mouse_Init(); mouseInit();
CONTROL_MousePresent = ((inputdevices & 2) == 2);
CONTROL_MouseEnabled = CONTROL_MousePresent; CONTROL_MouseEnabled = CONTROL_MousePresent;
CONTROL_ResetJoystickValues(); CONTROL_ResetJoystickValues();
@ -654,7 +653,7 @@ void CONTROL_Shutdown(void)
if (!CONTROL_Started) if (!CONTROL_Started)
return; return;
MOUSE_Shutdown(); mouseUninit();
uninitinput(); uninitinput();
CONTROL_Started = FALSE; CONTROL_Started = FALSE;

View file

@ -36,14 +36,14 @@ int32_t I_CheckAllInput(void)
{ {
return return
inputState.keyBufferWaiting() inputState.keyBufferWaiting()
|| MOUSE_GetButtons() || inputState.MouseGetButtons()
|| JOYSTICK_GetButtons(); || JOYSTICK_GetButtons();
} }
void I_ClearAllInput(void) void I_ClearAllInput(void)
{ {
inputState.keyFlushChars(); inputState.keyFlushChars();
inputState.ClearKeysDown(); inputState.ClearKeysDown();
MOUSE_ClearAllButtons(); inputState.MouseClearAllButtonss();
JOYSTICK_ClearAllButtons(); JOYSTICK_ClearAllButtons();
inputState.ClearAllButtons(); inputState.ClearAllButtons();
} }
@ -54,7 +54,7 @@ int32_t I_TextSubmit(void)
return return
inputState.GetKeyStatus(sc_Enter) inputState.GetKeyStatus(sc_Enter)
|| inputState.GetKeyStatus(sc_kpad_Enter) || inputState.GetKeyStatus(sc_kpad_Enter)
//|| MOUSEINACTIVECONDITIONAL(MOUSE_GetButtons()&LEFT_MOUSE) //|| MOUSEINACTIVECONDITIONAL(inputState.MouseGetButtons()&LEFT_MOUSE)
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_A)); || (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_A));
} }
@ -63,7 +63,7 @@ void I_TextSubmitClear(void)
inputState.keyFlushChars(); inputState.keyFlushChars();
inputState.ClearKeyStatus(sc_kpad_Enter); inputState.ClearKeyStatus(sc_kpad_Enter);
inputState.ClearKeyStatus(sc_Enter); inputState.ClearKeyStatus(sc_Enter);
MOUSE_ClearButton(LEFT_MOUSE); inputState.MouseClearButton(LEFT_MOUSE);
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_A); JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_A);
} }
@ -84,7 +84,7 @@ int32_t I_ReturnTrigger(void)
{ {
return return
inputState.GetKeyStatus(sc_Escape) inputState.GetKeyStatus(sc_Escape)
|| (MOUSE_GetButtons()&RIGHT_MOUSE) || (inputState.MouseGetButtons()&RIGHT_MOUSE)
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_B)); || (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_B));
} }
@ -92,7 +92,7 @@ void I_ReturnTriggerClear(void)
{ {
inputState.keyFlushChars(); inputState.keyFlushChars();
inputState.ClearKeyStatus(sc_Escape); inputState.ClearKeyStatus(sc_Escape);
MOUSE_ClearButton(RIGHT_MOUSE); inputState.MouseClearButton(RIGHT_MOUSE);
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_B); JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_B);
} }
@ -138,7 +138,7 @@ int32_t I_MenuUp(void)
return return
inputState.GetKeyStatus(sc_UpArrow) inputState.GetKeyStatus(sc_UpArrow)
|| inputState.GetKeyStatus(sc_kpad_8) || inputState.GetKeyStatus(sc_kpad_8)
|| (MOUSE_GetButtons()&WHEELUP_MOUSE) || (inputState.MouseGetButtons()&WHEELUP_MOUSE)
|| inputState.BUTTON(gamefunc_Move_Forward) || inputState.BUTTON(gamefunc_Move_Forward)
|| (JOYSTICK_GetHat(0)&HAT_UP) || (JOYSTICK_GetHat(0)&HAT_UP)
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_UP)) || (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_UP))
@ -149,7 +149,7 @@ void I_MenuUpClear(void)
{ {
inputState.ClearKeyStatus(sc_UpArrow); inputState.ClearKeyStatus(sc_UpArrow);
inputState.ClearKeyStatus(sc_kpad_8); inputState.ClearKeyStatus(sc_kpad_8);
MOUSE_ClearButton(WHEELUP_MOUSE); inputState.MouseClearButton(WHEELUP_MOUSE);
inputState.ClearButton(gamefunc_Move_Forward); inputState.ClearButton(gamefunc_Move_Forward);
JOYSTICK_ClearHat(0); JOYSTICK_ClearHat(0);
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_UP); JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_UP);
@ -162,7 +162,7 @@ int32_t I_MenuDown(void)
return return
inputState.GetKeyStatus(sc_DownArrow) inputState.GetKeyStatus(sc_DownArrow)
|| inputState.GetKeyStatus(sc_kpad_2) || inputState.GetKeyStatus(sc_kpad_2)
|| (MOUSE_GetButtons()&WHEELDOWN_MOUSE) || (inputState.MouseGetButtons()&WHEELDOWN_MOUSE)
|| inputState.BUTTON(gamefunc_Move_Backward) || inputState.BUTTON(gamefunc_Move_Backward)
|| (JOYSTICK_GetHat(0)&HAT_DOWN) || (JOYSTICK_GetHat(0)&HAT_DOWN)
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_DOWN)) || (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_DOWN))
@ -174,7 +174,7 @@ void I_MenuDownClear(void)
inputState.ClearKeyStatus(sc_DownArrow); inputState.ClearKeyStatus(sc_DownArrow);
inputState.ClearKeyStatus(sc_kpad_2); inputState.ClearKeyStatus(sc_kpad_2);
inputState.ClearKeyStatus(sc_PgDn); inputState.ClearKeyStatus(sc_PgDn);
MOUSE_ClearButton(WHEELDOWN_MOUSE); inputState.MouseClearButton(WHEELDOWN_MOUSE);
inputState.ClearButton(gamefunc_Move_Backward); inputState.ClearButton(gamefunc_Move_Backward);
JOYSTICK_ClearHat(0); JOYSTICK_ClearHat(0);
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_DOWN); JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_DOWN);
@ -216,7 +216,7 @@ int32_t I_MenuRight(void)
|| (!inputState.ShiftPressed() && inputState.GetKeyStatus(sc_Tab)) || (!inputState.ShiftPressed() && inputState.GetKeyStatus(sc_Tab))
|| inputState.BUTTON(gamefunc_Turn_Right) || inputState.BUTTON(gamefunc_Turn_Right)
|| inputState.BUTTON(gamefunc_Strafe_Right) || inputState.BUTTON(gamefunc_Strafe_Right)
|| (MOUSE_GetButtons()&MIDDLE_MOUSE) || (inputState.MouseGetButtons()&MIDDLE_MOUSE)
|| (JOYSTICK_GetHat(0)&HAT_RIGHT) || (JOYSTICK_GetHat(0)&HAT_RIGHT)
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_RIGHT)) || (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_RIGHT))
|| CONTROL_GetGameControllerDigitalAxisPos(GAMECONTROLLER_AXIS_LEFTX) || CONTROL_GetGameControllerDigitalAxisPos(GAMECONTROLLER_AXIS_LEFTX)
@ -230,7 +230,7 @@ void I_MenuRightClear(void)
inputState.ClearKeyStatus(sc_Tab); inputState.ClearKeyStatus(sc_Tab);
inputState.ClearButton(gamefunc_Turn_Right); inputState.ClearButton(gamefunc_Turn_Right);
inputState.ClearButton(gamefunc_Strafe_Right); inputState.ClearButton(gamefunc_Strafe_Right);
MOUSE_ClearButton(MIDDLE_MOUSE); inputState.MouseClearButton(MIDDLE_MOUSE);
JOYSTICK_ClearHat(0); JOYSTICK_ClearHat(0);
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_RIGHT); JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_RIGHT);
CONTROL_ClearGameControllerDigitalAxisPos(GAMECONTROLLER_AXIS_LEFTX); CONTROL_ClearGameControllerDigitalAxisPos(GAMECONTROLLER_AXIS_LEFTX);
@ -278,7 +278,7 @@ int32_t I_SliderLeft(void)
return return
I_MenuLeft() I_MenuLeft()
#if !defined EDUKE32_TOUCH_DEVICES #if !defined EDUKE32_TOUCH_DEVICES
//|| MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELUP_MOUSE)) //|| MOUSEINACTIVECONDITIONAL((inputState.MouseGetButtons()&LEFT_MOUSE) && (inputState.MouseGetButtons()&WHEELUP_MOUSE))
#endif #endif
; ;
} }
@ -286,7 +286,7 @@ int32_t I_SliderLeft(void)
void I_SliderLeftClear(void) void I_SliderLeftClear(void)
{ {
I_MenuLeftClear(); I_MenuLeftClear();
MOUSE_ClearButton(WHEELUP_MOUSE); inputState.MouseClearButton(WHEELUP_MOUSE);
} }
@ -295,7 +295,7 @@ int32_t I_SliderRight(void)
return return
I_MenuRight() I_MenuRight()
#if !defined EDUKE32_TOUCH_DEVICES #if !defined EDUKE32_TOUCH_DEVICES
//|| MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELDOWN_MOUSE)) //|| MOUSEINACTIVECONDITIONAL((inputState.MouseGetButtons()&LEFT_MOUSE) && (inputState.MouseGetButtons()&WHEELDOWN_MOUSE))
#endif #endif
; ;
} }
@ -303,7 +303,7 @@ int32_t I_SliderRight(void)
void I_SliderRightClear(void) void I_SliderRightClear(void)
{ {
I_MenuRightClear(); I_MenuRightClear();
MOUSE_ClearButton(WHEELDOWN_MOUSE); inputState.MouseClearButton(WHEELDOWN_MOUSE);
} }

View file

@ -4897,7 +4897,7 @@ static void Menu_RunScrollbar(Menu_t *cm, MenuMenuFormat_t const * const format,
rotatesprite_fs(scrollx + (scrollwidth>>1) - ((tilesiz[scrollTileCursor].x*ud.menu_scrollcursorz)>>1), scrollregionstart + scale(scrollregionheight, *scrollPos, scrollPosMax), ud.menu_scrollcursorz, 0, scrollTileCursor, 0, 0, 26); rotatesprite_fs(scrollx + (scrollwidth>>1) - ((tilesiz[scrollTileCursor].x*ud.menu_scrollcursorz)>>1), scrollregionstart + scale(scrollregionheight, *scrollPos, scrollPosMax), ud.menu_scrollcursorz, 0, scrollTileCursor, 0, 0, 26);
if (cm == m_currentMenu && !m_mousecaught && MOUSEACTIVECONDITIONAL(g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD)) if (cm == m_currentMenu && !m_mousecaught && MOUSEACTIVECONDITIONAL(inputState.mouseClickState() == MOUSE_PRESSED || inputState.mouseClickState() == MOUSE_HELD))
{ {
const int32_t scrolltilehalfheight = (tilesiz[scrollTileCursor].y*ud.menu_scrollcursorz)>>1; const int32_t scrolltilehalfheight = (tilesiz[scrollTileCursor].y*ud.menu_scrollcursorz)>>1;
const int32_t scrollregiony = scrollregionstart + scrolltilehalfheight; const int32_t scrollregiony = scrollregionstart + scrolltilehalfheight;
@ -5106,7 +5106,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
} }
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->get_yline())) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->get_yline()))
{ {
menu->currentEntry = e; menu->currentEntry = e;
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
@ -5151,7 +5151,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
} }
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->get_yline())) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->get_yline()))
{ {
menu->currentEntry = e; menu->currentEntry = e;
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
@ -5201,7 +5201,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
menu->currentColumn = 1; menu->currentColumn = 1;
} }
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[1], mousey, column1textsize.x, object->font->get_yline())) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[1], mousey, column1textsize.x, object->font->get_yline()))
{ {
menu->currentEntry = e; menu->currentEntry = e;
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
@ -5224,7 +5224,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
menu->currentColumn = 0; menu->currentColumn = 0;
} }
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[0], mousey, column0textsize.x, object->font->get_yline())) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[0], mousey, column0textsize.x, object->font->get_yline()))
{ {
menu->currentEntry = e; menu->currentEntry = e;
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
@ -5310,7 +5310,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
} }
if (!m_mousecaught && (g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD)) if (!m_mousecaught && (inputState.mouseClickState() == MOUSE_PRESSED || inputState.mouseClickState() == MOUSE_HELD))
{ {
const int32_t slidepointhalfwidth = mulscale16((((tilesiz[cursorTile].x)*ud.menu_slidecursorz)>>2) + ud.menu_slidebarmargin, z); const int32_t slidepointhalfwidth = mulscale16((((tilesiz[cursorTile].x)*ud.menu_slidecursorz)>>2) + ud.menu_slidebarmargin, z);
const int32_t slideregionx = slidebarx + slidepointhalfwidth; const int32_t slideregionx = slidebarx + slidepointhalfwidth;
@ -5410,7 +5410,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
} }
if (!m_mousecaught && (g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD)) if (!m_mousecaught && (inputState.mouseClickState() == MOUSE_PRESSED || inputState.mouseClickState() == MOUSE_HELD))
{ {
const int32_t slidepointhalfwidth = mulscale16((2+tilesiz[cursorTile].x)<<15, z); const int32_t slidepointhalfwidth = mulscale16((2+tilesiz[cursorTile].x)<<15, z);
const int32_t slideregionx = slidebarx + slidepointhalfwidth; const int32_t slideregionx = slidebarx + slidepointhalfwidth;
@ -5511,7 +5511,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
Menu_RunInput_Menu_MovementVerify(menu); Menu_RunInput_Menu_MovementVerify(menu);
} }
if (!m_mousecaught && (g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD)) if (!m_mousecaught && (inputState.mouseClickState() == MOUSE_PRESSED || inputState.mouseClickState() == MOUSE_HELD))
{ {
const int32_t slidepointhalfwidth = mulscale16((2+tilesiz[cursorTile].x)<<15, z); const int32_t slidepointhalfwidth = mulscale16((2+tilesiz[cursorTile].x)<<15, z);
const int32_t slideregionx = slidebarx + slidepointhalfwidth; const int32_t slideregionx = slidebarx + slidepointhalfwidth;
@ -5584,7 +5584,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
} }
#ifndef EDUKE32_TOUCH_DEVICES #ifndef EDUKE32_TOUCH_DEVICES
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, mousewidth, h) && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, h)) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, mousewidth, h) && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, h))
#endif #endif
{ {
if (entry == currentry && object->editfield != NULL) if (entry == currentry && object->editfield != NULL)
@ -5655,7 +5655,7 @@ static void M_RunMenu_CdPlayer(Menu_t *cm, MenuMenu_t *menu, const vec2_t origin
if (MOUSEACTIVECONDITIONAL(cm == m_currentMenu && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, 8<<16, 8<<16))) if (MOUSEACTIVECONDITIONAL(cm == m_currentMenu && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, 8<<16, 8<<16)))
{ {
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED)
{ {
menu->currentEntry = e; menu->currentEntry = e;
@ -5692,7 +5692,7 @@ static void M_RunMenu_CdPlayer(Menu_t *cm, MenuMenu_t *menu, const vec2_t origin
const int32_t mousey = origin.y+(113<<16)-(8<<16); const int32_t mousey = origin.y+(113<<16)-(8<<16);
if (MOUSEACTIVECONDITIONAL(cm == m_currentMenu && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, 16<<16, 16<<16))) if (MOUSEACTIVECONDITIONAL(cm == m_currentMenu && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, 16<<16, 16<<16)))
{ {
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED)
{ {
mus_enabled = !mus_enabled; mus_enabled = !mus_enabled;
@ -5798,7 +5798,7 @@ static void Menu_RunOptionList(Menu_t *cm, MenuEntry_t *entry, MenuOption_t *obj
object->options->currentEntry = e; object->options->currentEntry = e;
} }
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, object->options->font->get_yline())) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, object->options->font->get_yline()))
{ {
object->options->currentEntry = e; object->options->currentEntry = e;
@ -5821,7 +5821,7 @@ static void Menu_RunOptionList(Menu_t *cm, MenuEntry_t *entry, MenuOption_t *obj
static int32_t Menu_RunInput_MouseAdvance(void) static int32_t Menu_RunInput_MouseAdvance(void)
{ {
return MOUSEACTIVECONDITIONAL(!m_mousecaught && g_mouseClickState == MOUSE_RELEASED); return MOUSEACTIVECONDITIONAL(!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED);
} }
static int32_t Menu_RunInput_MouseReturn_status; static int32_t Menu_RunInput_MouseReturn_status;
@ -5866,10 +5866,10 @@ static int32_t Menu_RunInput_MouseReturn(void)
#if !defined EDUKE32_TOUCH_DEVICES #if !defined EDUKE32_TOUCH_DEVICES
Menu_RunInput_MouseReturn_status = 1; Menu_RunInput_MouseReturn_status = 1;
#else #else
Menu_RunInput_MouseReturn_status = (g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD); Menu_RunInput_MouseReturn_status = (inputState.mouseClickState() == MOUSE_PRESSED || inputState.mouseClickState() == MOUSE_HELD);
#endif #endif
return !m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, MouseReturnRegionX, 0, backbuttonbound.x, backbuttonbound.y); return !m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, MouseReturnRegionX, 0, backbuttonbound.x, backbuttonbound.y);
} }
Menu_RunInput_MouseReturn_status = 0; Menu_RunInput_MouseReturn_status = 0;
@ -6068,7 +6068,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin)
Menu_RunInput_FileSelect_MovementVerify(object); Menu_RunInput_FileSelect_MovementVerify(object);
} }
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, textdim.x, object->font[i]->get_yline())) if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, textdim.x, object->font[i]->get_yline()))
{ {
object->findhigh[i] = dir; object->findhigh[i] = dir;
object->currentList = i; object->currentList = i;
@ -7472,7 +7472,7 @@ void M_DisplayMenus(void)
Menu_AnimateChange(MENU_QUIT, MA_Advance); Menu_AnimateChange(MENU_QUIT, MA_Advance);
int32_t mousestatus = mouseReadAbs(&m_mousepos, &g_mouseAbs); int32_t mousestatus = mouseReadAbs(&m_mousepos, &g_mouseAbs);
if (mousestatus && g_mouseClickState == MOUSE_PRESSED) if (mousestatus && inputState.mouseClickState() == MOUSE_PRESSED)
m_mousedownpos = m_mousepos; m_mousedownpos = m_mousepos;
Menu_RunInput(m_currentMenu); Menu_RunInput(m_currentMenu);
@ -7580,7 +7580,8 @@ void M_DisplayMenus(void)
} }
} }
else else
g_mouseClickState = MOUSE_IDLE; inputState.clearMouseClickState();
#endif #endif
if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU)