Page 1 of 1

client viewangles at spawn

Posted: Tue Jan 29, 2013 5:57 pm
by qbism
I'm experiencing a weird bug in super8... the first time the client spawns in single-player, viewangles are wrong, possibly zeroed-out. But restarting the map (or any map) sets viewangles correctly. As the next step I'll track messages during and right after sign-on in case it's a protocol error.

What makes the very first sign-on different from later sign-ons?

Anyone ever come across this behavior?

Re: client viewangles at spawn

Posted: Tue Jan 29, 2013 6:17 pm
by mh
I got that before but can't remember how I fixed it. Seem to recall it might be something to do with auto-centering of the mouse following a movement, and the window position/size not being updated correctly, but that's the best I can do. If you've been working on any of the globals stored all over the place recently (window_center_x and friends) some of this may sound familiar.

Re: client viewangles at spawn

Posted: Tue Jan 29, 2013 7:46 pm
by r00k
qbism wrote:I'm experiencing a weird bug in super8... the first time the client spawns in single-player, viewangles are wrong, possibly zeroed-out. But restarting the map (or any map) sets viewangles correctly. As the next step I'll track messages during and right after sign-on in case it's a protocol error.

What makes the very first sign-on different from later sign-ons?

Anyone ever come across this behavior?
This happens to me when i load singleplayer and the m_raw_input is initialized. Only with that.
U can veifiy this by turning off raw input then restarting the map, mostly i spawn at '-80 0 0', i suspect the -80 is forced due to client limitations, ya know.
Image

Re: client viewangles at spawn

Posted: Wed Jan 30, 2013 4:23 am
by qbism
Thanks, the idea of centering based on window and raw mouse input might be related. The screenshot is exactly what I'm getting. High and to the left. I don't have "m_raw" but "m_filtered" cvar and "newmouseparams" array which I changed to disable mouse acceleration (or at least request that).

Mouse-centering based on a bogus resolution may be occurring before the screen dims are calculated. I don't know but that's what I'll check.

Re: client viewangles at spawn

Posted: Wed Jan 30, 2013 4:59 am
by qbism
Getting warmer...

This is the view on 1st map load (1st single player client spawn):
Image

View if SetCursorPos is commented out in function IN_ActivateMouse:
Image

View after second map load/ spawn, the correct view (45 degree rotation):
Image

Re: client viewangles at spawn

Posted: Wed Jan 30, 2013 7:41 am
by mankrip
There's a fix for that in Makaqu 1.6.

Re: client viewangles at spawn

Posted: Wed Jan 30, 2013 8:59 am
by mh
High and to the left seems to suggest I'm on the right track with my recollection. If your window rect was stored as {0, 0, w, h} that would happen in windowed modes; it would also happen if w and h had values that were too small (this would be valid for both windowed or fullscreen modes). I'm willing to bet that if you did a GetWindowRect each frame and updated these globals based on that, this problem would go away (GetWindowRect should be very fast so this shouldn't be a performance problem). Maybe set a breakpoint on that SetCursorPos call and see what values window_center_x and window_center_y have. Also check your ClipCursor call.

Re: client viewangles at spawn

Posted: Thu Jan 31, 2013 1:57 am
by qbism
Great, I've been looking forward to the new Makaqu! I'll also look at GetWindowRect, may solve certain other occasional view direction glitches.

Re: client viewangles at spawn

Posted: Thu Jan 31, 2013 2:48 am
by qbism

Code: Select all

...
	window_width = vid.width;
	window_height = vid.height;
	VID_UpdateWindowStatus ();
	if (host_initialized) // mankrip
		SetCursorPos (window_center_x, window_center_y); // mankrip - center the mouse, to avoid false movement detection
	CDAudio_Resume ();
...
Sweet mercy, that did it. Thanks!

Re: client viewangles at spawn

Posted: Thu Jan 31, 2013 10:24 pm
by metlslime
this bug has annoyed me forever. Glad it's finally been tracked down!