]> git.rm.cloudns.org Git - xonotic/darkplaces.git/log
xonotic/darkplaces.git
10 months agoBatch multidraws into glMultiDrawElements uis/glmultidraw
uis [Sat, 30 Dec 2023 22:17:00 +0000 (01:17 +0300)]
Batch multidraws into glMultiDrawElements

10 months agoMakefile: misc cleanups and fixes
bones_was_here [Tue, 26 Dec 2023 09:53:50 +0000 (19:53 +1000)]
Makefile: misc cleanups and fixes

Mostly removing cruft, deduplicating, consolidating.

Defaults to system default compiler instead of gcc.
Fixes parallel builds which were broken in
8a9f7e9e336cede20ec7da6bebc0f81a86ab79db by insufficient RTFM.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agoMakefile: support explicit static linking of all configurable libraries
bones_was_here [Tue, 26 Dec 2023 07:45:26 +0000 (17:45 +1000)]
Makefile: support explicit static linking of all configurable libraries

Fixes a bug in df973c344562c8cadc2413d36dcaa03f8e9040c2 where
libd0_rijndael static linking only worked if
DP_LINK_CRYPTO_RIJNDAEL=static was read from the environment rather than
being passed as an override.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agoMakefile: support explicit static linking of libd0
bones_was_here [Sun, 24 Dec 2023 12:04:02 +0000 (22:04 +1000)]
Makefile: support explicit static linking of libd0

Allows a kludge to be removed in Xonotic.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agoMakefile: always run any clean targets before starting any build
bones_was_here [Sat, 23 Dec 2023 08:30:27 +0000 (18:30 +1000)]
Makefile: always run any clean targets before starting any build

Should fix occasional failures in Xonotic build system which specifies
multiple targets including clean and enables parallel jobs.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agoMerge PR 'Apply default lightstyle to to lightmap when using q3bsp'
bones_was_here [Sat, 23 Dec 2023 08:02:54 +0000 (18:02 +1000)]
Merge PR 'Apply default lightstyle to to lightmap when using q3bsp'

See https://github.com/DarkPlacesEngine/darkplaces/pull/111

Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/100

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agoREADME.md: add SDL version requirements
bones_was_here [Sat, 23 Dec 2023 07:01:06 +0000 (17:01 +1000)]
README.md: add SDL version requirements

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agocbuf: improve some warns, minor cleanup
bones_was_here [Fri, 15 Dec 2023 22:36:22 +0000 (08:36 +1000)]
cbuf: improve some warns, minor cleanup

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agocvar: use unsigned for flags and hashindex
bones_was_here [Thu, 21 Dec 2023 11:06:36 +0000 (21:06 +1000)]
cvar: use unsigned for flags and hashindex

Signed is too error-prone with bitwise operations.  The common pattern
of passing ~0 (all bits set) resulted in neededflags=-1 in a backtrace
on x86_64.

See also b8692b8cd73685794b59b0522e8caa4b9d9a2dac

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agocvar: remove from the hash table when deleting (`unset` command)
bones_was_here [Thu, 21 Dec 2023 10:08:38 +0000 (20:08 +1000)]
cvar: remove from the hash table when deleting (`unset` command)

Fixes https://gitlab.com/xonotic/darkplaces/-/issues/400

Refactors Cvar_FindVarLink() to return a hash link pointer pointer
instead of a cvar pointer to avoid passing extra pointer pointers.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agoAdd Baker's fix for spplying default lightstyle to q3bsp
James O'Neill [Tue, 19 Dec 2023 15:48:59 +0000 (00:48 +0900)]
Add Baker's fix for spplying default lightstyle to q3bsp

10 months agocmd: Move cprint command to cl_screen
Cloudwalk [Thu, 14 Dec 2023 04:26:53 +0000 (23:26 -0500)]
cmd: Move cprint command to cl_screen

Client code doesn't belong in a common subsystem

Signed-off-by: Cloudwalk <cloudwalk@icculus.org>
10 months agonet_slist: reduce worst-case time until any given server first appears
bones_was_here [Tue, 12 Dec 2023 10:13:26 +0000 (20:13 +1000)]
net_slist: reduce worst-case time until any given server first appears

Fixes sending multiple queries to servers that happen to be early in the
list before sending any to servers late in the list, when
net_slist_maxtries > 1, which was a side-effect of making
net_slist_maxtries work as described in
fe2b222e32752c408fbe5ccf4ac3fb546f8ff41a.

Slightly reduces the total real time and CPU time to query all servers.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agocvar: use better method of checking flags during registration
bones_was_here [Tue, 12 Dec 2023 06:17:54 +0000 (16:17 +1000)]
cvar: use better method of checking flags during registration

Should have done it this way in 3a58ad52e63635c93e95955f984fd6052156e56b

Also prevents callbacks for client-only cvars being registered on the
dedicated server.

Adds some debug prints.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agocmd: always register server-only commands, don't register client-only commands on...
bones_was_here [Tue, 12 Dec 2023 04:33:48 +0000 (14:33 +1000)]
cmd: always register server-only commands, don't register client-only commands on dedicated server

Fixes the lack of the `heartbeat` command on dedicated and listen, and
the presence of commands like `toggleconsole` on dedicated.

Similar to 3a58ad52e63635c93e95955f984fd6052156e56b this might reveal a
few commands that aren't flagged correctly.

Changes the bitmask vars to the correct type.
Renames cmd_flags to cmd_flagsmask for consistency.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agocmd: reinstate execution of aliases with the same name as a command
bones_was_here [Mon, 11 Dec 2023 12:02:55 +0000 (22:02 +1000)]
cmd: reinstate execution of aliases with the same name as a command

Fixes https://gitlab.com/xonotic/darkplaces/-/issues/397

Based on the div0-stable version of Cmd_ExecuteString().

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agocmd: misc cleanup
bones_was_here [Mon, 11 Dec 2023 15:31:04 +0000 (01:31 +1000)]
cmd: misc cleanup

Removes an unnecessary pointer stored in all the cbuf objects.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agocmd: inline Cmd_Arg* helper funcs in all compilation units
bones_was_here [Mon, 11 Dec 2023 15:18:57 +0000 (01:18 +1000)]
cmd: inline Cmd_Arg* helper funcs in all compilation units

ea7ad935aa214b3a52eb7079110e992fbfe750ee should have done this.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agocmd: add CON_WARN colour to various non-fatal cvar and command errors
bones_was_here [Sun, 10 Dec 2023 10:32:16 +0000 (20:32 +1000)]
cmd: add CON_WARN colour to various non-fatal cvar and command errors

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agocbuf: recycle node after it executes, clear commands on Host_Error()
bones_was_here [Sat, 9 Dec 2023 07:49:56 +0000 (17:49 +1000)]
cbuf: recycle node after it executes, clear commands on Host_Error()

This reverts 626658074c8dd5c2288becd836103e2efdb9b741 which looks like a
potentially racy or non-threadsafe approach, and instead prevents
problems by clearing the command buffers if Host_Error() is called and
doesn't shut down DP.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agobuild: enable strict aliasing optimisations
bones_was_here [Fri, 8 Dec 2023 07:08:44 +0000 (17:08 +1000)]
build: enable strict aliasing optimisations

Extensive code quality improvements have been made since this was last
tried, and compilers are smarter with better warnings now.

This doesn't change the Xonotic pipeline gameplay hash so it's highly
unlikely to cause any subtle regressions.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agoChange to the C99 standard method of testing for nan
bones_was_here [Fri, 8 Dec 2023 07:41:22 +0000 (17:41 +1000)]
Change to the C99 standard method of testing for nan

This fixes all remaining strict-aliasing rule warnings in GCC.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agoclient: improve server connection status messages
bones_was_here [Fri, 1 Dec 2023 06:18:45 +0000 (16:18 +1000)]
client: improve server connection status messages

Always logs various errors and rejections that previously were only
visible with developer cvar(s) set.  Among other things this fixes
silent failure when trying to join a full server.
Includes IP address in more messages.

Uses CON_ERROR and CON_WARN colours for various errors and warns.

Moves status message generation to the code that sets the relevant
states.  This allows more information to be included, makes the code
easier to follow and reduces polling.

Fixes some cases where a message was always clobbered before it could be
displayed.

Merges the built-in menu and loading screen connection status generation
and buffering.

Simplifies challenge request retry counting.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agoREADME.md: mention `make clean`, more specific build deps
bones_was_here [Fri, 24 Nov 2023 05:02:32 +0000 (15:02 +1000)]
README.md: mention `make clean`, more specific build deps

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agoRename sv_gameplayfix_customstats to sv_qcstats, improve description
bones_was_here [Thu, 23 Nov 2023 19:45:12 +0000 (05:45 +1000)]
Rename sv_gameplayfix_customstats to sv_qcstats, improve description

It's an API change not a gameplay change.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agoSys_Sleep overhaul
bones_was_here [Sun, 26 Nov 2023 01:17:53 +0000 (11:17 +1000)]
Sys_Sleep overhaul

One function to rule them all, and in the darkplaces sleep threads.

Makes sub-millisecond accuracy available on Windows.
Increases the number of sockets we can monitor on Windows.
Improves Curl_Select() a little.
Updates flags of some timing-related cvars.

Cleans up disorganised and duplicate code.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agocl_nettimesyncboundmode: use default if invalid
bones_was_here [Fri, 24 Nov 2023 05:18:57 +0000 (15:18 +1000)]
cl_nettimesyncboundmode: use default if invalid

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agocl_nolerp: use normal time synchronisation
bones_was_here [Tue, 21 Nov 2023 20:47:11 +0000 (06:47 +1000)]
cl_nolerp: use normal time synchronisation

Fixes constant packet discards on LAN and impossible pings online,
when FPS > ticrate.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agocl_netfps: reduce pings by synchronising when possible, related fixes
bones_was_here [Fri, 17 Nov 2023 01:30:14 +0000 (11:30 +1000)]
cl_netfps: reduce pings by synchronising when possible, related fixes

Fixes possibility of input frequency to exceed cl_netfps in certain
configurations.

Fixes possibility of rate limiting to reduce input frequency more than
it should.

Fixes timescale affecting input frequency (now consistent with client
FPS and server HZ being unaffected by timescale).

History of this code (most recent first):
1b6ea396b616e359cfe98d1e85e8e7a9ac571e91
528b92ffab3a9ab09770310e2796adbe5f0f1e20
79e332ad14e7ec9dbd2702a2d28127f7600f0678
663279ba8feeb4c114df0950bbc820f3bb32dcdc
21beb5fe4fa2e1f1b7591a4a1f6013b82186912f

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agocl_maxfps*: various adjustments
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.

Cleans up the cl_maxfps* code.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agonet_slist: add PGUP PGDN HOME END key support to builtin menu
bones_was_here [Fri, 1 Dec 2023 01:16:46 +0000 (11:16 +1000)]
net_slist: add PGUP PGDN HOME END key support to builtin menu

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agonet_slist: overhaul dpmaster and server pinging
bones_was_here [Tue, 31 Oct 2023 01:24:47 +0000 (11:24 +1000)]
net_slist: overhaul dpmaster and server pinging

Fixes https://gitlab.com/xonotic/darkplaces/-/issues/173
Fixes https://gitlab.com/xonotic/darkplaces/-/issues/211

Adds cvars net_slist_maxping, net_slist_interval, net_slist_debug.

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.

Fixes double-sending of QW favourite queries.

Minor cleanups/refactoring.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agonet_slist: update types, declarations
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.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agonet_slist: code style/formatting fixes
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.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agobuild: fix buildstring
bones_was_here [Mon, 6 Nov 2023 11:17:10 +0000 (21:17 +1000)]
build: fix buildstring

The revision was always "-", there was code duplication and
inconsistency, the meaning of some strings was unclear.

Frees up some space in the `status` "version:" line by moving
gamenetworkfiltername to "protocol:" which seems like a more relevant
section anyway.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agobuild: disallow use of VLAs
bones_was_here [Mon, 30 Oct 2023 00:18:48 +0000 (10:18 +1000)]
build: disallow use of VLAs

They're no longer allowed in Linux for safety and performance reasons.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agoPRVM: indicate which VM triggered some common string messages
bones_was_here [Fri, 27 Oct 2023 11:06:30 +0000 (21:06 +1000)]
PRVM: indicate which VM triggered some common string messages

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
11 months agoFix bug where +binds could get latched at low FPS
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.

Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/106

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agovid: move sound start/restart out of video start/restart
bones_was_here [Sat, 7 Oct 2023 03:40:26 +0000 (13:40 +1000)]
vid: move sound start/restart out of video start/restart

According to the comments in S_Restart_f() we must not restart sound
while running a map, but `vid_restart` did do that...

Also simplified/consolidated code paths a little.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agovid: add cvar vid_minimize_on_focus_loss
bones_was_here [Mon, 30 Oct 2023 01:15:36 +0000 (11:15 +1000)]
vid: add cvar vid_minimize_on_focus_loss

Default of 0 matches current SDL default behaviour.

If set, the environment variable SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS will
override the cvar.

Changes apply immediately.

Also makes changes to vid_mouse_clickthrough apply immediately.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agomacOS: update Info.plist
bones_was_here [Mon, 30 Oct 2023 13:19:45 +0000 (23:19 +1000)]
macOS: update Info.plist

Declares DP as a game to enable "Game Mode", see
https://gitlab.com/xonotic/xonotic/-/commit/7c57b3b0d8810e69094a338dd8e94ac8ca8a6f83

Includes the other changes from Xonotic.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoWindows: opt out of DPI scaling
bones_was_here [Mon, 6 Nov 2023 17:52:15 +0000 (03:52 +1000)]
Windows: opt out of DPI scaling

SDL >= 2.24.0 is required.

Fixes https://gitlab.com/xonotic/darkplaces/-/issues/32
Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/74

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoinput: activate DP_BUTTONCHAT if the window is hidden or loses focus
bones_was_here [Fri, 6 Oct 2023 11:50:56 +0000 (21:50 +1000)]
input: activate DP_BUTTONCHAT if the window is hidden or loses focus

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoinput: stop capturing mouse movement if window is hidden without first losing focus
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.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoGL: display a more useful error dialog if context creation fails
bones_was_here [Mon, 30 Oct 2023 11:25:11 +0000 (21:25 +1000)]
GL: display a more useful error dialog if context creation fails

There's no need to repeatedly retry if context creation fails, the
GPU and driver capabilities won't have changed.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoSDL: print version earlier, once only
bones_was_here [Mon, 30 Oct 2023 00:00:34 +0000 (10:00 +1000)]
SDL: print version earlier, once only

No need to print it again at every vid_restart, it can't change.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agovid: implement monitor selection with instant cvar changes
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.

Fixes https://gitlab.com/xonotic/darkplaces/-/issues/385

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agovid_vsync: fully support adaptive, remove polling, print better errors
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.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agovid: remove obsolete cvars
bones_was_here [Mon, 6 Nov 2023 15:14:10 +0000 (01:14 +1000)]
vid: remove obsolete cvars

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agovid: misc cleanups
bones_was_here [Sat, 14 Oct 2023 16:43:38 +0000 (02:43 +1000)]
vid: misc cleanups

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoSave cvars cl_rollangle and cl_rollspeed to config.cfg
bones_was_here [Fri, 3 Nov 2023 09:36:15 +0000 (19:36 +1000)]
Save cvars cl_rollangle and cl_rollspeed to config.cfg

Closes https://gitlab.com/xonotic/darkplaces/-/issues/393

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoMerge MR 'off-switch cvar for dlcache unload on server/map change'
bones_was_here [Fri, 3 Nov 2023 09:35:21 +0000 (09:35 +0000)]
Merge MR 'off-switch cvar for dlcache unload on server/map change'

See https://gitlab.com/xonotic/darkplaces/-/merge_requests/141

12 months agooff-switch cvar for dlcache unload on server/map change
Dr. Jaska [Fri, 3 Nov 2023 09:35:21 +0000 (09:35 +0000)]
off-switch cvar for dlcache unload on server/map change

12 months agoFix GCC 13 warns: ‘new_velocity[0]’ may be used uninitialized
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.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoWork around black texture bug on AMD's Windows driver
bones_was_here [Tue, 3 Oct 2023 14:46:10 +0000 (00:46 +1000)]
Work around black texture bug on AMD's Windows driver

Closes https://gitlab.com/xonotic/darkplaces/-/issues/228

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoSys_Error(): don't leave a dead window covering the OS UI or crash dialog
bones_was_here [Tue, 3 Oct 2023 09:49:24 +0000 (19:49 +1000)]
Sys_Error(): don't leave a dead window covering the OS UI or crash dialog

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoVID_Shutdown(): Delete OpenGL context
bones_was_here [Tue, 3 Oct 2023 09:31:22 +0000 (19:31 +1000)]
VID_Shutdown(): Delete OpenGL context

Destroying the window doesn't do this so for a cleaner vid_restart we need to.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoVID_InitModeGL(): fix clear to black of new window
bones_was_here [Tue, 3 Oct 2023 08:32:04 +0000 (18:32 +1000)]
VID_InitModeGL(): fix clear to black of new window

The window was left with whatever was already in the framebuffer.
Also we can perform the clear a bit earlier.

Changes initial state of vid_activewindow to match the logic that sets
it during normal frames.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoImplement OpenGL version checking, use it for occlusion queries
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.

Fixes https://gitlab.com/xonotic/darkplaces/-/issues/176

Moves GL function pointer initialisation to its own function to support
a workaround for NVIDIA's opinion about GL profiles.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoCleanup some legacy cruft in vid_sdl.c
bones_was_here [Sat, 7 Oct 2023 17:00:18 +0000 (03:00 +1000)]
Cleanup some legacy cruft in vid_sdl.c

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoMove QC extension reporting out of video initialisation
bones_was_here [Tue, 3 Oct 2023 04:52:17 +0000 (14:52 +1000)]
Move QC extension reporting out of video initialisation

Once at startup is enough, no need to do this during vid_restart (etc).

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoMerge PR 'Small fixes (indices out of bounds)'
bones_was_here [Sat, 28 Oct 2023 08:09:32 +0000 (18:09 +1000)]
Merge PR 'Small fixes (indices out of bounds)'

See https://github.com/DarkPlacesEngine/darkplaces/pull/92

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoMerge PR 'Fix some UB'
bones_was_here [Sat, 28 Oct 2023 08:02:33 +0000 (18:02 +1000)]
Merge PR 'Fix some UB'

See https://github.com/DarkPlacesEngine/darkplaces/pull/89

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
12 months agoFix yet more UB. Provide explanatory comments.
notcancername [Mon, 31 Jul 2023 20:21:56 +0000 (22:21 +0200)]
Fix yet more UB. Provide explanatory comments.

Signed-off-by: notcancername <notcancername@protomail.com>
12 months agoDelete (broken) cmake submodule that somehow got in from my cmake branch
Cloudwalk [Thu, 12 Oct 2023 16:55:52 +0000 (12:55 -0400)]
Delete (broken) cmake submodule that somehow got in from my cmake branch

Signed-off-by: Cloudwalk <cloudwalk@icculus.org>
12 months agohost: Move host cvar exports to host.h that don't belong in darkplaces.h
Cloudwalk [Thu, 12 Oct 2023 16:44:55 +0000 (12:44 -0400)]
host: Move host cvar exports to host.h that don't belong in darkplaces.h

Signed-off-by: Cloudwalk <cloudwalk@icculus.org>
12 months ago.gitignore: Exclude *.obj and *.tlog. Remove build artifacts
Cloudwalk [Thu, 12 Oct 2023 16:42:21 +0000 (12:42 -0400)]
.gitignore: Exclude *.obj and *.tlog. Remove build artifacts

Signed-off-by: Cloudwalk <cloudwalk@icculus.org>
13 months agoMerge PR 'Fix a bug on FreeBSD caused by assuming that short reads are errors'
bones_was_here [Mon, 2 Oct 2023 04:19:44 +0000 (14:19 +1000)]
Merge PR 'Fix a bug on FreeBSD caused by assuming that short reads are errors'

This also enables files larger than 2GiB to be accessed on all platforms.

See https://github.com/DarkPlacesEngine/darkplaces/pull/88

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
13 months agoFix a bug on FreeBSD caused by assuming that short reads are errors
cancername [Mon, 31 Jul 2023 19:40:31 +0000 (21:40 +0200)]
Fix a bug on FreeBSD caused by assuming that short reads are errors

Signed-off-by: notcancername <119271574+notcancername@users.noreply.github.com>
13 months agocvar: reset colours after printing values, clarify virtual/alias message
bones_was_here [Thu, 28 Sep 2023 09:04:12 +0000 (19:04 +1000)]
cvar: reset colours after printing values, clarify virtual/alias message

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
13 months agoMake `name` be a command or virtual cvar on a game-specific basis
bones_was_here [Thu, 28 Sep 2023 09:03:28 +0000 (19:03 +1000)]
Make `name` be a command or virtual cvar on a game-specific basis

This allows matching the client console behaviour of div0-stable in
games that want it.

Closes https://gitlab.com/xonotic/darkplaces/-/issues/337

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
13 months agocmd: inline Arg helper funcs
bones_was_here [Mon, 25 Sep 2023 08:09:39 +0000 (18:09 +1000)]
cmd: inline Arg helper funcs

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
13 months agocbuf: catch runaway command loops, respects -norunaway cmdline arg
bones_was_here [Mon, 25 Sep 2023 09:30:33 +0000 (19:30 +1000)]
cbuf: catch runaway command loops, respects -norunaway cmdline arg

Prevents DP from spinlocking permanently.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
13 months agocbuf: prepend keybind commands instead of appending to skip waits
bones_was_here [Mon, 25 Sep 2023 09:32:26 +0000 (19:32 +1000)]
cbuf: prepend keybind commands instead of appending to skip waits

This prevents user inputs being delayed by `wait` commands that other
sources may have added to the buffer.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
13 months agocbuf: fix a 1 frame delay of keybind inputs
bones_was_here [Mon, 25 Sep 2023 06:08:42 +0000 (16:08 +1000)]
cbuf: fix a 1 frame delay of keybind inputs

This was a regression (from div0-stable) introduced in the refactoring.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
13 months agocbuf: use standard parsing and buffering of deferred strings
bones_was_here [Mon, 25 Sep 2023 08:02:29 +0000 (18:02 +1000)]
cbuf: use standard parsing and buffering of deferred strings

Fixes https://gitlab.com/xonotic/darkplaces/-/issues/377

Matches div0-stable in that the deferred string is not parsed until
execution time and is printed verbatim in the pending command list.

Also fixes unsafe linked list removal and removes its workaround.

Slightly improves timing precsion and PRVM_64 / 32 support.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
13 months agocbuf: refactor and fix parsing of text blocks into the linked list
bones_was_here [Tue, 26 Sep 2023 04:40:22 +0000 (14:40 +1000)]
cbuf: refactor and fix parsing of text blocks into the linked list

Simplifies the parsing to a single loop with less state tracking.
Reorganises the code for readability.

Fixes https://gitlab.com/xonotic/darkplaces/-/issues/378

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
13 months agoFix occasional NaN sdev in server timing reports
bones_was_here [Tue, 19 Sep 2023 04:37:30 +0000 (14:37 +1000)]
Fix occasional NaN sdev in server timing reports

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
13 months agoAdd some physics-related comments
bones_was_here [Fri, 1 Sep 2023 09:36:36 +0000 (19:36 +1000)]
Add some physics-related comments

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
13 months agoSV_FlyMove(): defer SV_Impact() call until after ground detection
bones_was_here [Wed, 13 Sep 2023 20:30:31 +0000 (06:30 +1000)]
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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
13 months agoRework handling of stuck entities in engine movetypes
bones_was_here [Wed, 13 Sep 2023 19:38:04 +0000 (05:38 +1000)]
Rework handling of stuck entities in engine movetypes

Avoids most false positives and unnecessary work.
Mentions likely code path and cvar deprecations.

Fixes nades ending up where they shouldn't, which looked like:
Unstuck entity 450 (classname "ogre_grenade") with offset 0.000000 0.000000 28.000000.

Allows certain entities to move while stuck in the world (see comments).
Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/18

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
14 months agoAdd missing DP_QC_FINDCHAIN_TOFIELD declarations to CSQC defs
bones_was_here [Fri, 1 Sep 2023 10:30:51 +0000 (20:30 +1000)]
Add missing DP_QC_FINDCHAIN_TOFIELD declarations to CSQC defs

14 months agoFix potential index out of bounds
Johan Mattsson [Sat, 12 Aug 2023 22:49:42 +0000 (00:49 +0200)]
Fix potential index out of bounds

14 months agoFix potential index out of bounds
Johan Mattsson [Sat, 12 Aug 2023 22:48:20 +0000 (00:48 +0200)]
Fix potential index out of bounds

15 months agoFix mod_q1bsp_zero_hullsize_cutoff only applying to HLBSP in some cases
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 :)

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
15 months agoFix some UB
cancername [Mon, 31 Jul 2023 19:37:15 +0000 (21:37 +0200)]
Fix some UB

caused by shifting such that the value becomes unrepresentable and
overflow respectively

15 months agoImprove server lag detection and reporting
bones_was_here [Sun, 30 Jul 2023 18:24:04 +0000 (04:24 +1000)]
Improve server lag detection and reporting

On a dedicated server, significant lag is reported to players (so they
know it wasn't the network or their machine).

Cvar sv_lagreporting_strict logs even slight lag that was "recovered" to
console.

sv_lagreporting_always enables these for empty servers or singleplayer.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
15 months agoDeduct frame execution time from sleep time
bones_was_here [Sun, 30 Jul 2023 18:47:05 +0000 (04:47 +1000)]
Deduct frame execution time from sleep time

Fixes failure to sustain cl_maxfps/sys_ticrate when the system can
exceed it if unlimited, should improve frame pacing too.

Includes related refactoring. Actually this commit is mostly refactoring.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
15 months agoProperly reset server timers and perf stats after level change
bones_was_here [Sun, 30 Jul 2023 18:45:56 +0000 (04:45 +1000)]
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.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
15 months agoFix host.framecount
bones_was_here [Sat, 29 Jul 2023 10:36:21 +0000 (20:36 +1000)]
Fix host.framecount

It never incremented if sleep was called, and could have eventually
become negative.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
15 months agocurl: use much less conservative performance defaults
bones_was_here [Thu, 27 Jul 2023 09:22:21 +0000 (19:22 +1000)]
curl: use much less conservative performance defaults

Matches defaults used in Xonotic >= 0.8.2

Dedicated server throughput is still limited by ticrate to avoid a
reduction in frame pacing precision, see 025fbac31da7f654e296e20b3037b5ce88074f8b

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
15 months agoFix flags and naming of cvars needed by the dedicated server
bones_was_here [Thu, 27 Jul 2023 09:31:15 +0000 (19:31 +1000)]
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.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
15 months agostrcat(): update QC defs to match implementation
bones_was_here [Sat, 22 Jul 2023 09:27:29 +0000 (19:27 +1000)]
strcat(): update QC defs to match implementation

Xonotic was defining strcat1n to allow single-arg cases without
boilerplate...

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
15 months agocheckextension(): check libcurl is loaded before returning it's available
bones_was_here [Sat, 22 Jul 2023 06:36:14 +0000 (16:36 +1000)]
checkextension(): check libcurl is loaded before returning it's available

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
15 months agoFix flags and naming of Q3BSP curve collision cvars, related tidying
bones_was_here [Sat, 22 Jul 2023 06:12:52 +0000 (16:12 +1000)]
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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
15 months agoAdd some missing csprogs defs
bones_was_here [Fri, 21 Jul 2023 08:33:23 +0000 (18:33 +1000)]
Add some missing csprogs defs

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
15 months agomod() builtin: match gmqcc and fteqw
bones_was_here [Fri, 21 Jul 2023 08:34:28 +0000 (18:34 +1000)]
mod() builtin: match gmqcc and fteqw

Also catch div0, he escaped again

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
15 months agoAdd cvar mod_q1bsp_zero_hullsize_cutoff for games using "big" projectiles on Q1BSP
bones_was_here [Fri, 21 Jul 2023 08:28:04 +0000 (18:28 +1000)]
Add cvar mod_q1bsp_zero_hullsize_cutoff for games using "big" projectiles on Q1BSP

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
15 months agoMerge MR 'Fix inability to access non-ascii path under Windows with WTF-8'
bones_was_here [Fri, 21 Jul 2023 08:38:12 +0000 (08:38 +0000)]
Merge MR 'Fix inability to access non-ascii path under Windows with WTF-8'

See https://gitlab.com/xonotic/darkplaces/-/merge_requests/142

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
15 months agodedicated server: don't call CL_UpdateScreen() and SCR_BeginLoadingPlaque()
bones_was_here [Tue, 18 Jul 2023 03:39:47 +0000 (13:39 +1000)]
dedicated server: don't call CL_UpdateScreen() and SCR_BeginLoadingPlaque()