[openjk] 15/24: Shared: Probable fix for Sys_QueEvent overflow spam
Simon McVittie
smcv at debian.org
Sat Jan 21 21:44:02 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository openjk.
commit 6161dac1bfc40fdc8689431b5376250740651f5b
Author: Ensiform <ensiform at gmail.com>
Date: Fri Dec 23 18:18:47 2016 -0600
Shared: Probable fix for Sys_QueEvent overflow spam
Based off of diff found in https://github.com/ioquake/ioq3/issues/191
Direct link to diff at:
https://github.com/ioquake/ioq3/files/378067/fix.txt
What this does is merges mouse movements into a single queued event.
The engine already handles deltas which allows this to work.
See comment number 2 on the above ioq3 issue for more details.
Refs jkanewmod/NewJK at f7cda44a1c07e4a2bad8f892f59226f10dc36a31
This is a better fix than just hiding the prints.
---
shared/sys/sys_event.cpp | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/shared/sys/sys_event.cpp b/shared/sys/sys_event.cpp
index 39dc5c5..268a772 100644
--- a/shared/sys/sys_event.cpp
+++ b/shared/sys/sys_event.cpp
@@ -91,6 +91,31 @@ void Sys_QueEvent( int time, sysEventType_t type, int value, int value2, int ptr
static bool printedWarning = false;
#endif
+ // try to combine all sequential mouse moves in one event
+ if ( type == SE_MOUSE )
+ {
+ // get previous event from queue
+ ev = &eventQue[ ( eventHead + MASK_QUED_EVENTS - 1 ) & MASK_QUED_EVENTS ];
+ if ( ev->evType == SE_MOUSE )
+ {
+ if ( eventTail == eventHead && eventTail )
+ {
+ ev->evValue = 0;
+ ev->evValue2 = 0;
+ eventTail--;
+ }
+
+ if ( time == 0 )
+ time = Sys_Milliseconds();
+
+ ev->evValue += value;
+ ev->evValue2 += value2;
+ ev->evTime = time;
+
+ return;
+ }
+ }
+
ev = &eventQue[ eventHead & MASK_QUED_EVENTS ];
if ( eventHead - eventTail >= MAX_QUED_EVENTS ) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git
More information about the Pkg-games-commits
mailing list