bones_was_here [Sat, 11 Nov 2023 10:47:50 +0000 (20:47 +1000)]
cl_maxfps*: various adjustments
Ensures minimum FPS of 10 even while idle to prevent weird issues
(networking assumes at least 10).
If you want to save more resources, hide the game window (disables
rendering entirely) such as by using vid_minimize_on_focus_loss 1.
Disables cl_maxfps_alwayssleep by default, on modern systems with
accurate timers and higher FPS this has a significant impact.
Allows cl_maxfps_alwayssleep to be used with cl_maxfps 0, this was
requested some time ago.
Switches from cl_maxidlefps to cl_maxfps when querying servers to give
pings representative of what can be expected when playing on them.
Simplifies state tracking, ping is now either valid or not set (0) and
isn't abused to store state.
Includes a hash-verified timestamp in pings, fixes impossible pings
(happened when querytime was updated before response arrived) and the
ability to add servers to a client's list with unsolicited packets
(abusing the LAN support).
Checks that DP/QW master server list packets originate from a configured
master (cvar net_sourceaddresscheck).
Fixes unreliable LAN support.
Significantly reduces the total time to complete a full query cycle for
DP servers by improving the logic as well as turning up some cvars.
Prints warnings if DP or QW master server queries time out.
Makes net_slist_maxtries actually give better ping reports like its
description says.
Makes net_slist_pause completely pause (QC builtin resorthostcache()
used by Xonotic and Nexuiz bypassed it), clarifies description, uses a
callback instead of polling to handle changes.
Changes sv_masters[] and sv_qwmasters[] iteration to a more idiomatic
pattern pattern (numeric limit instead of a "null cvar" terminator).
Checks that sockets are open before writing to them in
NetConn_QueryQueueFrame() to avoid crashing in case we ever close a
lower numbered socket while a higher numbered one is still open.
Separates QW master list parsing into a func (like DP list parsing).
Fixes sending a DP master query string to the QW masters if the first
socket is an IPv6 one.
bones_was_here [Fri, 3 Nov 2023 09:15:06 +0000 (19:15 +1000)]
net_slist: update types, declarations
Mostly this changes array indices and externally-sourced data that
should never trigger signed overflow to unsigned,
and changes to lhnetaddresstype_t where applicable.
Fixes an old bug in the DP Quake server list where if there are less
servers than the most that could fit onscreen, the list jumps around
and/or duplicates entries when moving the cursor down.
bones_was_here [Fri, 3 Nov 2023 07:55:44 +0000 (17:55 +1000)]
net_slist: code style/formatting fixes
I wouldn't normally nitpick this stuff but the random tabs mixed into
code and comment lines were too annoying and fixing it later commits
would make their diff too noisy.
bones_was_here [Sun, 12 Nov 2023 12:33:10 +0000 (22:33 +1000)]
Fix bug where +binds could get latched at low FPS
This was introduced in 6b21c467a83808e3becf61afe7b67a88f870b502 which
didn't ensure the -bind would be executed after the +bind when the
keydown and keyup events are processed in the same frame.
bones_was_here [Thu, 5 Oct 2023 18:44:37 +0000 (04:44 +1000)]
input: stop capturing mouse movement if window is hidden without first losing focus
Fixes players looking all around after they alt+tabbed.
Moves the logic for selecting the mouse mode out of screen drawing and
into SDL event handling where it's unaffected if we early-out of drawing
the frame.
Prevents mouse "grab" (raw/relative mode + cursor hiding) in a few
"loading" situations.
bones_was_here [Wed, 4 Oct 2023 16:43:12 +0000 (02:43 +1000)]
vid: implement monitor selection with instant cvar changes
Adds cvars: vid_display, vid_info_displaycount
Prints the monitors detected at startup and on hotplug.
Requires SDL headers >= 2.0.18 at build time.
At runtime older versions should still work but may lack some functionality.
May not work properly or at all if vid_desktopfullscreen is 0.
May require vid_restart after hotplug events.
---
Changes existing cvars vid_fullscreen, vid_desktopfullscreen, vid_resizable,
vid_borderless to apply instantly.
Also (for windowed mode) works around window managers that move the
window after SDL creates and centres it (typically when adding a
titlebar), so the crosshair is always at the centre of the monitor.
Adds some missing SDL_WINDOWEVENT enumerations.
Changes the GL viewport size retrieval from screen coordinates to
pixels, which is a prerequisite for "HIGHDPI" aka "Apple Retina"
support.
bones_was_here [Tue, 3 Oct 2023 17:24:44 +0000 (03:24 +1000)]
vid_vsync: fully support adaptive, remove polling, print better errors
Adaptive vsync was partially supported: it worked if set before window
creation but not if toggled on afterwards, and wasn't mentioned in the
cvar description.
The immediate application of `vid_vsync` cvar changes was implented by
polling, which was ok for one cvar but I'll be making more vid_ cvars
apply immediately (no vid_restart needed), and don't want to poll for
things that rarely change every frame.
SDL is now queried for the current state of vsync instead of storing
what we believe to be the current state.
If the setting can't be applied the reason (as reported by SDL) is now
printed.
bones_was_here [Fri, 27 Oct 2023 15:47:55 +0000 (01:47 +1000)]
Fix GCC 13 warns: ‘new_velocity[0]’ may be used uninitialized
Pretty sure this was a false positive, for it to happen `numplanes`
would have to be <= 0 in the loop which sets `new_velocity` which should
be impossible. Declaring `numplanes` as unsigned placates the compiler,
and these ints should be unsigned anyway because they index an array.
bones_was_here [Tue, 3 Oct 2023 02:36:16 +0000 (12:36 +1000)]
Implement OpenGL version checking, use it for occlusion queries
This allows DP to use core features added after 3.2 without crashing,
in this case query buffer objects.
In div0-stable GL_ARB_query_buffer_object was checked but that extension
was written against 4.3 and became part of core in 4.4 so we can just
check for 4.4.
SV_FlyMove(): defer SV_Impact() call until after ground detection
Quake didn't use SV_PushEntity in SV_FlyMove() and id1 fiends depend on
the original behaviour of setting ONGROUND (etc) before calling
SV_Impact().
Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/94
bones_was_here [Sat, 5 Aug 2023 08:20:44 +0000 (18:20 +1000)]
Fix mod_q1bsp_zero_hullsize_cutoff only applying to HLBSP in some cases
In 0dfd32e1e2bb2c1bd5e58b3202271c391be423de in one code path this
applied to Q1BSP and HLBSP, but the other code path was slightly
different and there it only applied to HLBSP. Oops :)
Properly reset server timers and perf stats after level change
This prevents the server running "catchup" physics frames immediately
after level change (when sv_maxphysicsframesperserverframe > 1) and
makes accurate stats available almost immediately (all 0 before that).
Moves perf stats from persistent to temporary storage.
Fix flags and naming of cvars needed by the dedicated server
The cl_curl* cvars also apply to the dedicated server so not
registering them in 3a58ad52e63635c93e95955f984fd6052156e56b broke HTTP.
These now have aliases for backwards compat (eg Xonotic, Nexuiz menus).
cl_maxphysicsframesperserverframe is server-specific and was also used
by the dedicated server for "catch up" if it got behind.
Fix flags and naming of Q3BSP curve collision cvars, related tidying
r_subdivisions_collision* were marked as client-only, so not registering
them in the dedicated server in 3a58ad52e63635c93e95955f984fd6052156e56b
broke Q3BSP curve collisions. Renamed to mod_q3bsp_curves_subdivisions*
for consistency.
Removed 3 obsolete mod_q3bsp cvars, moved r_fxaa to gl_rmain.c
droptofloor(): refactor and use correct conditions for each BSP format
Behaviour changes:
Although startsolid is used by Q3 and Q2, it's too strict for Quake
which used allsolid, so we now use the correct conditions for each BSP
format.
The downtrace endpoint is now calculated after
sv_gameplayfix_droptofloorstartsolid_nudgetocorrect.
The downtrace endpoint is now offset when using the
sv_gameplayfix_droptofloorstartsolid fallback path, otherwise it would
trace a diagonal line for entities whose origin is not horizontally centred
in their bbox.
droptofloor(): add/improve warnings for badly placed entities
In the past, sv_gameplayfix_droptofloorstartsolid and
sv_gameplayfix_droptofloorstartsolid_nudgetocorrect were enabled by
default when playing Quake, which seems to have led to some maps
depending on them.
These need to be off by default in Quake to avoid gameplay changes,
but we can at least warn people about map entity issues.
With the expansion approach we need to compare to separation to make
"good location" detection reliable, partly to avoid float precision
problems, partly to avoid compatibility problems with normal TraceBox.
For example: we drop an entity to floor successfully with TraceBox, but
then NudgeOutOfSolid decides it's in solid.
Also updated the startsolid conditions to suit the 2-pass approach.