Combine mouse movement events in event queue

Fixes 'Com_QueueEvent: overflow' spam after hitch / map load.

Based on patch by @ec-.
This commit is contained in:
Zack Middleton 2017-08-21 19:48:44 -05:00
parent e793c0c37c
commit be1c71d363

View file

@ -1961,6 +1961,19 @@ void Com_QueueEvent( int time, sysEventType_t type, int value, int value2, int p
{ {
sysEvent_t *ev; sysEvent_t *ev;
// combine mouse movement with previous mouse event
if ( type == SE_MOUSE && eventHead != eventTail )
{
ev = &eventQueue[ ( eventHead + MAX_QUEUED_EVENTS - 1 ) & MASK_QUEUED_EVENTS ];
if ( ev->evType == SE_MOUSE )
{
ev->evValue += value;
ev->evValue2 += value2;
return;
}
}
ev = &eventQueue[ eventHead & MASK_QUEUED_EVENTS ]; ev = &eventQueue[ eventHead & MASK_QUEUED_EVENTS ];
if ( eventHead - eventTail >= MAX_QUEUED_EVENTS ) if ( eventHead - eventTail >= MAX_QUEUED_EVENTS )