Quake's mouse code is written stupidly
Moderator: InsideQC Admins
18 posts
• Page 2 of 2 • 1, 2
Re: Quake's mouse code is written stupidly
Spike wrote:q3 supposedly has a much cleaned up input system. events are shoved into a queue by whatever windowing system code is active, and handled in a single unified place. instead of different input code on every single platform.
which reminds me that I need to do the same thing myself some time. hrmph.
Interesting. I hate working on the input code on multiple (video is usually easy, but the input portion is always highly different and usually its own source file for no reason).
This has been an extremely useful thread bump.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Re: Quake's mouse code is written stupidly
Im kinda confused why in vid_svga.c we have
while in vid_x11 we have this
Then in vid_glx.c I have this
UGH!
is i tried this for testing
What's the difference? I really cant tell...
- Code: Select all
if (m_filter.value)
{
mouse_x = (mx + old_mouse_x) * 0.5;
mouse_y = (my + old_mouse_y) * 0.5;
}
else
{
mouse_x = mx;
mouse_y = my;
}
old_mouse_x = mx;
old_mouse_y = my;
mx = my = 0; // clear for next update
while in vid_x11 we have this
- Code: Select all
tx = mouse_x;
ty = mouse_y;
if (m_filter.value)
{
mouse_x = (mouse_x + old_mouse_x) * 0.5;
mouse_y = (mouse_y + old_mouse_y) * 0.5;
}
old_mouse_x = mouse_x;
old_mouse_y = mouse_y;
Then in vid_glx.c I have this
- Code: Select all
tx = mouse_x;
ty = mouse_y;
if (m_filter.value)
{
mouse_x = (tx + old_mouse_x) * 0.5;
mouse_y = (ty + old_mouse_y) * 0.5;
}
old_mouse_x = tx;
old_mouse_y = ty;
UGH!
is i tried this for testing
- Code: Select all
if (m_filter.value)
{
mouse_x = ((float)mx + (float)old_mouse_x) * 0.5f;
mouse_y = ((float)my + (float)old_mouse_y) * 0.5f;
if (m_filter.value == 1)
{
old_mouse_x = mx;
old_mouse_y = my;
}
else
{
old_mouse_x = mouse_x;
old_mouse_y = mouse_y;
}
}
else
{
mouse_x = mx;
mouse_y = my;
}
What's the difference? I really cant tell...
Last edited by r00k on Tue Jul 24, 2012 2:28 pm, edited 2 times in total.
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
Re: Quake's mouse code is written stupidly
Things that affect the input state (is mouse on or off. Can also affect keyboard)
ActiveApp - Is the application active
Minimized - Is the application minimized
key_dest - is the key (input) destination the console or menu (mouse is released in windowed mode)
con_forcedup - key_dest might be key_game, but cl.worldmodel is null or cls.signon isn't completed (so we get console)
scr_disabled_for_loading ... because we don't draw the console no matter what (key_dest and conforcedup don't matter)
[except I think this should allow drawing the console anyway if key_dest really is key_console?]
Windowed - To know if we are in windowed mode
_windowed_mouse - If mouse is even supposed to be available in _windowed_mode
Command line params: -nomouse, -nojoy, -dinput
Other circumstances: pre-initialization, shutdown
Extra: Video mode restart, m_directinput cvar if an engine supports that
Mouseclip region has to be updated if window is moved, resized.
Connection state. If not running a map or connected to a server, DirectInput isn't run meaning mouse messages (mouse wheel in particular) is lost.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
18 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 1 guest