]> git.rm.cloudns.org Git - xonotic/darkplaces.git/log
xonotic/darkplaces.git
3 months agoserver: fix the save command's checks for multiplayer/dedicated
bones_was_here [Sun, 25 Aug 2024 10:17:29 +0000 (20:17 +1000)]
server: fix the save command's checks for multiplayer/dedicated

Also makes the save and load messages nicer.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
3 months agoserver: don't report lag during intermission
bones_was_here [Sun, 25 Aug 2024 07:18:17 +0000 (17:18 +1000)]
server: don't report lag during intermission

Some games do memory or cpu intensive things then.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
3 months agosys: make TimeString thread-safe
bones_was_here [Sat, 24 Aug 2024 18:22:08 +0000 (04:22 +1000)]
sys: make TimeString thread-safe

Also avoids copying to an intermediate buffer in the warmer paths.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
3 months agomathlib: rename some macro parameters for clarity
bones_was_here [Fri, 23 Aug 2024 11:00:16 +0000 (21:00 +1000)]
mathlib: rename some macro parameters for clarity

So I don't have to keep looking up which is which.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoPRVM: reset GETTIME_FRAMESTART at VM startup, improve documentation
bones_was_here [Fri, 23 Aug 2024 09:26:31 +0000 (19:26 +1000)]
PRVM: reset GETTIME_FRAMESTART at VM startup, improve documentation

Avoids precision issues on servers with long GETTIME_UPTIME.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoFix documentation in vid and PRVM headers
bones_was_here [Tue, 20 Aug 2024 19:34:15 +0000 (05:34 +1000)]
Fix documentation in vid and PRVM headers

Also fixes a trivial warning.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agobuild: set stack limit on Windows and Emscripten to match other platforms
bones_was_here [Sun, 18 Aug 2024 20:12:07 +0000 (06:12 +1000)]
build: set stack limit on Windows and Emscripten to match other platforms

Linux, FreeBSD, macOS all default to 8MB for the main thread. MSVC
defaulted to 1MB, MinGW GCC to 2MB.

Optimises Emscripten build slightly and replaces its deprecated
TOTAL_STACK setting.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoMerge PR 'Only use BoxTouchingVisibleLeafs when not using r_novis'
James O'Neill [Thu, 15 Aug 2024 14:09:14 +0000 (23:09 +0900)]
Merge PR 'Only use BoxTouchingVisibleLeafs when not using r_novis'

Updates the entity visibility check in `R_View_UpdateEntityVisible` so
that with `r_novis 1` entities are rendered when the player is outside
of the level.

Resolves https://github.com/DarkPlacesEngine/DarkPlaces/issues/188

See https://github.com/DarkPlacesEngine/DarkPlaces/pull/192

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoFix some pedantic compiler stuff and a warning off-by-1
bones_was_here [Thu, 15 Aug 2024 14:01:51 +0000 (00:01 +1000)]
Fix some pedantic compiler stuff and a warning off-by-1

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoMerge PR 'Added Webassembly support and fixed GLES2 (somewhat)'
Lockl00p [Sun, 11 Aug 2024 17:43:09 +0000 (12:43 -0500)]
Merge PR 'Added Webassembly support and fixed GLES2 (somewhat)'

Webassembly version doesn’t work online and screen flashes on GLES2 are
opaque.

See https://github.com/DarkPlacesEngine/DarkPlaces/pull/169

---------

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Co-authored-by: James O'Neill <hemebond@gmail.com>
Co-authored-by: bones_was_here <bones_was_here@xonotic.au>
4 months agonet_slist: improve warnings and debug messages
bones_was_here [Sun, 11 Aug 2024 13:46:50 +0000 (23:46 +1000)]
net_slist: improve warnings and debug messages

Detects out-of-order packets in dpmaster replies.
Hides IPv6 master timeouts by default.
Adds more info to some messages.
Uses consistent VM warnings for all the QC builtins.

Also some nitpicking.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoMerge MR 'Reduce the amount of unnecessary messages shown in the game chat'
bones_was_here [Wed, 7 Aug 2024 17:33:15 +0000 (17:33 +0000)]
Merge MR 'Reduce the amount of unnecessary messages shown in the game chat'

See merge request https://gitlab.com/xonotic/darkplaces/-/merge_requests/155

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoReduce the amount of unnecessary messages shown in the game chat
Mario [Wed, 7 Aug 2024 17:33:15 +0000 (17:33 +0000)]
Reduce the amount of unnecessary messages shown in the game chat

Some engine messages are being printed to chat in scenarios where they may obscure regular game chat.

To help with this, I've adjusted the visibility of them:
- "unconnected changed name to BOT" and "BOT left the game" showing in chat have been disabled by only allowing such messages to show for real clients
  Bots will still show that they've been dropped in the console and Xonotic still shows a (dis)connect message
- Verbose "Server lag report" messages (most commonly seen during map votes) have been moved to the console

4 months agoMerge MR 'Update AMD Windows black texture bug fix hack to work on newer GPUs'
bones_was_here [Wed, 7 Aug 2024 16:16:00 +0000 (16:16 +0000)]
Merge MR 'Update AMD Windows black texture bug fix hack to work on newer GPUs'

See merge request https://gitlab.com/xonotic/darkplaces/-/merge_requests/157

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoMerge MR 'sv_sendentities_csqc_randomize_order: send CSQC entities in somewhat random...
bones_was_here [Wed, 7 Aug 2024 15:50:46 +0000 (15:50 +0000)]
Merge MR 'sv_sendentities_csqc_randomize_order: send CSQC entities in somewhat randomized order.'

See merge request https://gitlab.com/xonotic/darkplaces/-/merge_requests/151

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoUpdate AMD Windows black texture bug fix hack to work on newer GPUs
Mario [Wed, 7 Aug 2024 05:10:57 +0000 (15:10 +1000)]
Update AMD Windows black texture bug fix hack to work on newer GPUs

4 months agosv_sendentities_csqc_randomize_order: send entities in somewhat randomized order.
Rudolf Polzer [Tue, 25 Jun 2024 19:13:46 +0000 (15:13 -0400)]
sv_sendentities_csqc_randomize_order: send entities in somewhat randomized order.

Should improve CSQC networking at low rates or high byte rate sending
mods.

No impact if sv_sendentities_csqc_randomize_order is 0. No impact to
non-CSQC entities (these already have a superior priority system).

Enabled by default; let's see how well this works.

4 months agoCLVM: improve getstati() warning
bones_was_here [Tue, 6 Aug 2024 04:01:06 +0000 (14:01 +1000)]
CLVM: improve getstati() warning

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agonudgeoutofsolid: implement fallback for when cliphulls are in use
bones_was_here [Mon, 5 Aug 2024 15:50:34 +0000 (01:50 +1000)]
nudgeoutofsolid: implement fallback for when cliphulls are in use

Fixes sv_gameplayfix_droptofloorstartsolid_nudgetocorrect and
DP_QC_NUDGEOUTOFSOLID doing nothing on Q1BSP.

Fixes the Q1BSP condition in PHYS_NudgeOutOfSolid() to handle the exact
issue (so mod_q1bsp_polygoncollisions is properly supported).

Migrates unsticking code from server-specific to common.

Updates documentation.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoedict: fix escape parsing and make exceptions configurable
bones_was_here [Sun, 4 Aug 2024 10:49:40 +0000 (20:49 +1000)]
edict: fix escape parsing and make exceptions configurable

In 312123ecffc7e3dd892c7df754c911b47b9cdfaa a bug was introduced where
newlines were no longer supported in string fields.
This patch supports them again, which requires exceptions be
reintroduced to fully support some buggy maps, but this time there's a
cvar for documentation and adjustment.  The other notes and fixes in
https://github.com/DarkPlacesEngine/darkplaces/pull/185 still apply.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoMerge MR 'Don't apply special default client cvar values in dedicated server'
bones_was_here [Mon, 5 Aug 2024 16:49:44 +0000 (16:49 +0000)]
Merge MR 'Don't apply special default client cvar values in dedicated server'

See merge request https://gitlab.com/xonotic/darkplaces/-/merge_requests/156

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoDon't apply special default client cvar values in dedicated server, client cvars...
terencehill [Mon, 29 Jul 2024 21:37:04 +0000 (23:37 +0200)]
Don't apply special default client cvar values in dedicated server, client cvars don't exist

Signed-off-by: terencehill <piuntn@gmail.com>
4 months agocvar: remove remaining uses of legacy internal functions
bones_was_here [Thu, 1 Aug 2024 09:19:50 +0000 (19:19 +1000)]
cvar: remove remaining uses of legacy internal functions

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agocvar: add sv_dedicated for clean detection in scripts and SVQC
bones_was_here [Thu, 1 Aug 2024 06:14:35 +0000 (16:14 +1000)]
cvar: add sv_dedicated for clean detection in scripts and SVQC

To replace hacky methods like checking if the (QW-specific) qport cvar
is registered (which prints an error when it's not) in default.cfg.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agocl_net: fix two subtle flaws and simplify logic
bones_was_here [Fri, 26 Jul 2024 10:36:27 +0000 (20:36 +1000)]
cl_net: fix two subtle flaws and simplify logic

The code introduced in 42e86ab7892c3d8f5373402a714b73b2e040d81b had two
separate modes which was more complex than necessary and less robust in
high ping high jitter scenarios.

The 0ms packet check didn't work when the cause was aggressive time
synchronisation and a ping spike.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agophysics: fix a subtle prediction regression
bones_was_here [Wed, 31 Jul 2024 11:11:42 +0000 (21:11 +1000)]
physics: fix a subtle prediction regression

In 3d8f1ca7b142c0a9fd8c3b4a494b62dcce39ab71 a horizontal player speed
calculation was changed to include the vertical velocity and to no
longer be the speed, by use of the wrong macro.
This patch reverts those changes and adds a macro for this calculation.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoscr: update the centreprint buffer for the empty message
bones_was_here [Thu, 1 Aug 2024 12:17:14 +0000 (22:17 +1000)]
scr: update the centreprint buffer for the empty message

Fixes a bug introduced by me in
https://github.com/DarkPlacesEngine/darkplaces/pull/159 where a
`svc_finale` message with the empty string could cause a
previously displayed engine centreprint to appear again.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agofs: add `game` as alias of `gamedir` command
bones_was_here [Thu, 25 Jul 2024 11:26:26 +0000 (21:26 +1000)]
fs: add `game` as alias of `gamedir` command

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoMerge MR 'Fix monsters that do not use MOVETYPE_STEP appearing choppy'
bones_was_here [Thu, 1 Aug 2024 17:52:36 +0000 (17:52 +0000)]
Merge MR 'Fix monsters that do not use MOVETYPE_STEP appearing choppy'

See merge request https://gitlab.com/xonotic/darkplaces/-/merge_requests/154

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
4 months agoFix monsters that do not use MOVETYPE_STEP appearing choppy
Mario [Thu, 1 Aug 2024 17:52:36 +0000 (17:52 +0000)]
Fix monsters that do not use MOVETYPE_STEP appearing choppy

Resolves https://github.com/DarkPlacesEngine/darkplaces/issues/82

Makes monster interpolation always apply to engine-networked entities with the FL_MONSTER flag.

5 months agocom: fix loop/crash in dpvsnprintf() error handling
bones_was_here [Tue, 23 Jul 2024 21:32:50 +0000 (07:32 +1000)]
com: fix loop/crash in dpvsnprintf() error handling

Somehow I didn't notice Sys_Printf() calls dpvsnprintf(), see
21fa9010ae6de8792f36cca08cb77aaa95d4b928.

Also fixes a minor bug where Sys_Print() could output more bytes than it
should, introduced in 01642af37128bffc1accbf2e92cb2428ea570720.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
5 months agoPRVM: fix incorrect tempstring length in VM_tokenizebyseparator()
bones_was_here [Tue, 23 Jul 2024 15:35:18 +0000 (01:35 +1000)]
PRVM: fix incorrect tempstring length in VM_tokenizebyseparator()

This caused memcpy() in PRVM_SetTempString() to copy too many bytes,
when the source string had the maximum length it could read past the end
and trigger a segfault.
Bug was introduced in 26a665ff43052862131df3c63785f91861989fc8 and looks
to be specific to that builtin.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
5 months agoVM_parseentitydata: parse backslash escapes
bones_was_here [Tue, 23 Jul 2024 05:49:36 +0000 (15:49 +1000)]
VM_parseentitydata: parse backslash escapes

Because VM_writetofile() will include them by calling the same code as
SV_Savegame_to().
Missed this in 312123ecffc7e3dd892c7df754c911b47b9cdfaa.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
5 months agoPRVM: remove redundant VM name from some warnings
bones_was_here [Mon, 22 Jul 2024 06:07:16 +0000 (16:07 +1000)]
PRVM: remove redundant VM name from some warnings

Prolly should have included this in
17601b9cff2eea0e32d1520d9f69d02c1bb41d26.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
5 months agoProperly unescape escaped characters in save file when loading (#185)
ITdevkc [Mon, 22 Jul 2024 20:27:37 +0000 (16:27 -0400)]
Properly unescape escaped characters in save file when loading (#185)

Modified PRVM_ED_ParseEdict to determine whether it is loading a save or
not, and unescape variables if loading a save.
Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/81

---------

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Co-authored-by: bones_was_here <bones_was_here@xonotic.au>
5 months agoReduce stack usage by Con_CenterPrintf uis/centerprint
uis [Tue, 25 Jun 2024 20:44:53 +0000 (23:44 +0300)]
Reduce stack usage by Con_CenterPrintf

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
5 months agoMerge MR 'Reduce RAM usage in various structures'
bones_was_here [Sat, 20 Jul 2024 10:48:31 +0000 (20:48 +1000)]
Merge MR 'Reduce RAM usage in various structures'

As I understand in BIH_UNORDERED only children array is used, while front, back, min and max are never written. Opposite true for other node types.

On side note sizes should be explicitly added to ints.

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
5 months agomodel_brush: slightly change bih math
uis [Mon, 13 May 2024 17:02:51 +0000 (20:02 +0300)]
model_brush: slightly change bih math

5 months agoSlightly improve branching performance for BIH collision
uis [Sat, 11 May 2024 02:16:42 +0000 (05:16 +0300)]
Slightly improve branching performance for BIH collision

5 months agoDo a little precalculation when traversing BIH
uis [Fri, 10 May 2024 22:32:57 +0000 (01:32 +0300)]
Do a little precalculation when traversing BIH

5 months agoUse lines instead of columns for some BIH tracing code
bones_was_here [Mon, 3 Jun 2024 15:19:22 +0000 (01:19 +1000)]
Use lines instead of columns for some BIH tracing code

See https://gitlab.com/xonotic/darkplaces/-/merge_requests/149 comments.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
5 months agoMove CRC tables to rodata section
uis [Sun, 21 Apr 2024 16:04:18 +0000 (19:04 +0300)]
Move CRC tables to rodata section

5 months agoReduce BIH node size by 32 bytes
uis [Sun, 21 Apr 2024 00:59:09 +0000 (03:59 +0300)]
Reduce BIH node size by 32 bytes

5 months agoMerge MR 'fix failure to load data from non-ASCII path on Windows'
bones_was_here [Sat, 20 Jul 2024 10:28:08 +0000 (20:28 +1000)]
Merge MR 'fix failure to load data from non-ASCII path on Windows'

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
5 months agofix can't load data on windows if data is in non-ascii path (introduced by 1f4743e9...
NaitLee [Sat, 6 Jul 2024 19:00:14 +0000 (03:00 +0800)]
fix can't load data on windows if data is in non-ascii path (introduced by 1f4743e9), refactor windows unicode support

6 months agoCSQC: disable lighting in R_EndPolygon()
bones_was_here [Sun, 2 Jun 2024 13:23:17 +0000 (23:23 +1000)]
CSQC: disable lighting in R_EndPolygon()

It's not supported and causes visual problems.

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
6 months agoImprove robustness of Con_CenterPrintf()
bones_was_here [Tue, 28 May 2024 20:19:11 +0000 (06:19 +1000)]
Improve robustness of Con_CenterPrintf()

This code was OK, but if someone were to change the buffer size(s) such
that line[] were smaller than msg[], or were to call Con_CenterPrintf()
with a maxLineLength > 40, then a buffer overflow would have become
possible.  This patch prevents it.

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
6 months agocvar: misc description fixes, allow vsync to a fraction of refresh rate
bones_was_here [Fri, 10 May 2024 13:05:58 +0000 (23:05 +1000)]
cvar: misc description fixes, allow vsync to a fraction of refresh rate

Refresh rate fractions are supported by SDL2 for positive and negative
(adaptive) values, and by emscripten for positive values.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
6 months agoPrint centerprint messages to the console (#159)
James O'Neill [Tue, 28 May 2024 10:28:16 +0000 (19:28 +0900)]
Print centerprint messages to the console (#159)

Add new function `Con_CenterPrint` which can be used to print messages
to the console, without showing onscreen, and with a "horizontal rule"
above and below. Use `Con_CenterPrint` to log centerprint messages to
the console.

![image](https://github.com/DarkPlacesEngine/darkplaces/assets/424218/8ef0bdc4-7481-4f11-b0a3-d46e4d451c74)

Fixes #98

---------

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Co-authored-by: bones_was_here <bones_was_here@xonotic.au>
7 months agosys: work around incomplete POSIX support in MacOS
bones_was_here [Fri, 17 May 2024 08:47:33 +0000 (18:47 +1000)]
sys: work around incomplete POSIX support in MacOS

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agoRefactor game/mod cvar defaults
bones_was_here [Wed, 8 May 2024 21:16:53 +0000 (07:16 +1000)]
Refactor game/mod cvar defaults

Adds gamegroup defaults.
This avoids the need to specify the same Quake defaults for every Quake
expansion/mod.
Fixes newly-added Quake mods (quake15, ad) having global defaults
instead of Quake defaults.

Moves comments in front of the cvars they refer to, some were unclear.

Removes redundant cvars, they're no longer needed because global
defaults and Quake defaults are correctly restored when switching
gamedirs, see 32c99c7b0a58545b273fa713d81d6bbfb3b8ebe6 and
205931f2f5b7333523ca4f6c3cae7974a8f516c8.

See also: 34e819a626f6a7ff2ad190a8e7d42e38ca8cef0e

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agosbar: add cvar scr_sbarscale for mod compatibility
bones_was_here [Tue, 7 May 2024 19:49:14 +0000 (05:49 +1000)]
sbar: add cvar scr_sbarscale for mod compatibility

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agoparticles: fix bugs in cl_particles_quake
bones_was_here [Tue, 7 May 2024 16:30:09 +0000 (02:30 +1000)]
particles: fix bugs in cl_particles_quake

There was a segfault when CL_NewQuakeParticle->CL_NewParticle returned
NULL, and a missing break; in case pt_snow: in R_RenderParticles causing
fall-through to pt_explode.
Introduced in 58dc7879146968c2c07e1ffd2c521487a5e768d9, I missed them in
code review, oops.

Could have just added checks for NULL in CL_ParticleExplosion but these
kinds of exceptions can get messy if several accumulate so it seemed
better to merge them into the API which also made NULL checks redundant.

Changes the particle_t comments to doxygen comments.
Fixes indenting.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agoRecognise mod Arcane Dimensions
bones_was_here [Tue, 7 May 2024 09:14:18 +0000 (19:14 +1000)]
Recognise mod Arcane Dimensions

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agoCLVM: add cvar to support mods wanting low resolution 2D
bones_was_here [Tue, 7 May 2024 08:29:09 +0000 (18:29 +1000)]
CLVM: add cvar to support mods wanting low resolution 2D

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agomisc: engine version string polishing
bones_was_here [Tue, 7 May 2024 04:34:30 +0000 (14:34 +1000)]
misc: engine version string polishing

Updates engineversion when changing gamedirs, sets it earlier so it's
more likely to be included in crash logs.
Includes compiler in buildstring.

Makes sure the engine can always be identified as DarkPlaces (many
gamename values don't include it) by CSQC and in the console.

Logs which API is in use when loading a csprogs.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agoPVS: dynamically allocate all FatPVS buffers
bones_was_here [Tue, 7 May 2024 01:23:16 +0000 (11:23 +1000)]
PVS: dynamically allocate all FatPVS buffers

Some were dynamic, others weren't...

Fixes invisible entities and monsters ignoring the player on big/complex
maps, and undefined behaviour (reading past the end of the buffer).
Fixes https://gitlab.com/xonotic/darkplaces/-/issues/322

Adds Mem_Size() for retrieving the size of an allocation.

Simplifies some checks (we can check the pointer now so we dont need to
store byte counts just to see if there's any data).

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agosprites: fix misaligned memory access while loading (v2)
bones_was_here [Mon, 6 May 2024 01:15:40 +0000 (11:15 +1000)]
sprites: fix misaligned memory access while loading (v2)

This reverts commit 0d5f8f0edd073d7ff233bde3995b529c0fcb67ff, that
approach didn't solve it for the other code path (used in mod "quake15")
so we need to memcpy each struct.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agonet: fix UB in VM_CL_getstati() and when sending the `items` stat
bones_was_here [Sun, 5 May 2024 19:13:34 +0000 (05:13 +1000)]
net: fix UB in VM_CL_getstati() and when sending the `items` stat

Simplifies the shifting in VM_CL_getstati() to avoid signed integer
overflow when the high bits are read with the arguments 23 and 9 (as
done in "quake15" and "ad" mods).

Refactors VM_CL_getstati() slightly, returns 0 when the index is out of
range (instead of whatever happened to be in that memory).

Masks off the bits that will overflow when packing the `items` stat for
sending (otherwise corruption of the low bits could occur on x86).

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agoQ3BSP: fix UB when loading certain maps
bones_was_here [Sun, 5 May 2024 14:14:52 +0000 (00:14 +1000)]
Q3BSP: fix UB when loading certain maps

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agosys: fix "typo" in a3dac3bcfd962ee3b7ebcdb7afb777560679c29a
bones_was_here [Sun, 5 May 2024 04:09:01 +0000 (14:09 +1000)]
sys: fix "typo" in a3dac3bcfd962ee3b7ebcdb7afb777560679c29a

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agoCONTRIBUTING: Fix typos
Cloudwalk [Sat, 4 May 2024 06:11:26 +0000 (02:11 -0400)]
CONTRIBUTING: Fix typos

7 months agomakefile: demote -Werror=c++-compat to a warning
Cloudwalk [Sat, 4 May 2024 05:54:37 +0000 (01:54 -0400)]
makefile: demote -Werror=c++-compat to a warning

Also edited CONTRIBUTING.md and a comment in common.h accordingly to reflect this change.

7 months agoconsole: improve default text legibility and background alpha behaviour
bones_was_here [Thu, 2 May 2024 21:59:11 +0000 (07:59 +1000)]
console: improve default text legibility and background alpha behaviour

With the Quake font and some mod fonts the text was too dim and hard to
read by default.

Makes the dropdown console always have the configured alpha (even at the
menu with no demos playing).

Uses a tiny bit of alpha by default.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agoDisable mod_bsp_portalize by default
bones_was_here [Tue, 30 Apr 2024 14:08:33 +0000 (00:08 +1000)]
Disable mod_bsp_portalize by default

The cost is too high when loading fancy modern maps, and
r_useportalculling often doesn't improve perf (or even hurts it).

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agodemos: Add cvar cl_startdemos, allow longer startdemos arguments
bones_was_here [Tue, 30 Apr 2024 07:16:33 +0000 (17:16 +1000)]
demos: Add cvar cl_startdemos, allow longer startdemos arguments

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agoRecognise mods Quake 1.5 and Quake Combat+
bones_was_here [Sun, 28 Apr 2024 00:17:22 +0000 (10:17 +1000)]
Recognise mods Quake 1.5 and Quake Combat+

Their instructions both say "-game quake15" so they're currently
indistinguishable, but currently both require the same workarounds.

Closes https://github.com/DarkPlacesEngine/darkplaces/issues/164

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agophysics: add a workaround cvar for mods relying on the id1 fiends bug
bones_was_here [Sat, 27 Apr 2024 23:23:56 +0000 (09:23 +1000)]
physics: add a workaround cvar for mods relying on the id1 fiends bug

Also checks for teleport by QC in both code paths (forgot to do that in
e62e6f563b475060fca315b875aa672c692ad052).

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agoQ1BSP: add a workaround cvar for the Rogue lava men, use it when playing Rogue
bones_was_here [Sat, 27 Apr 2024 20:30:37 +0000 (06:30 +1000)]
Q1BSP: add a workaround cvar for the Rogue lava men, use it when playing Rogue

This doesn't fix them, it just changes the behaviour of the map bug so
that they're stuck like in the original Quake engine. Fixing them
properly requires moving them, a .ent file is convenient for that.

Closes https://github.com/DarkPlacesEngine/darkplaces/issues/109

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agoMisc gamedir-related fixes
bones_was_here [Tue, 30 Apr 2024 10:19:59 +0000 (20:19 +1000)]
Misc gamedir-related fixes

Fixes two cvars being writable that shouldn't be.

Fixes MVM getgamedirinfo() builtin returning stale data (wasn't updated
by fs_rescan).

Fixes `startdemos` not working when changing to a mod that uses it,
after previously having had a map loaded.

Fixes `menu_main` being unavailable to quake.rc when changing to a mod
that uses it instead of `startdemos`.

Fixes `menu_restart` not performing the full MR_Init() (updates video
modes etc).

Fixes a race where it was possible to segfault by handling keyboard
events meant for MENU QC after MR_Shutdown() but before MR_Init() (by
calling directly instead of adding `menu_restart` to the cbuf).

Fixes an inconsistent extern declaration found by ubsan.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agofs: recognise mods by -game cmdline args, deduplicate gamedirs, refactoring
bones_was_here [Sun, 28 Apr 2024 03:03:12 +0000 (13:03 +1000)]
fs: recognise mods by -game cmdline args, deduplicate gamedirs, refactoring

Players often start mods using -game even when they have their own
cmdline option, and modders often provide scripts which use -game.

This was already implemented but only for the `gamedir` command.
Refactoring was required to avoid chicken vs egg problems when doing it
with cmdline gamedirs too.

Fixes a bug: the first gamedir (in the cmdline or `gamedir` args) was
used to identify the mod but it needs to be the last one that matches
because the last gamedir is the primary (first in the search path, and
where files are saved).

Includes supported game and mod directories in the main gamedir list for
interface consistency, less special cases, and to support deduplication.
Refactoring was required in the menu modlist where there was also an
opportunity to simplify.

Fixes inability to change from a supported mod (eg rogue) back to id1.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
7 months agophysics: fix and refactor unsticking
bones_was_here [Fri, 26 Apr 2024 03:05:42 +0000 (13:05 +1000)]
physics: fix and refactor unsticking

Closes https://github.com/DarkPlacesEngine/darkplaces/issues/165

Bugs came from 270f020888c5a03b98cc7752957243e6123c1132 trying to use
NudgeOutOfSolid on Q1BSP which currently isn't possible, combined with
a map bug on alk_caustic, and unsticking unfortunately being an
essential part of Q1BSP player physics.

Adjusts cvar defaults to match Quake behaviour.
Improves documentation.

Merges SV_UnstickEntity() and SV_CheckStuck().

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agoMerge PR 'Use the text from modinfo.txt as the mod menu entry'
James O'Neill [Sun, 21 Apr 2024 17:25:00 +0000 (02:25 +0900)]
Merge PR 'Use the text from modinfo.txt as the mod menu entry'

Copies the text from the `modinfo.txt` into the name field for the mod
list entry. If there is no text the mod directory name is used as
before.

![image](https://github.com/DarkPlacesEngine/darkplaces/assets/424218/b6b5da57-7590-407e-920c-21bca23ef2bb)

Fixes Alkaline 1.2 failing to appear in the mod list (its dir is
`alk1.2`).

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

---------

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Co-authored-by: bones_was_here <bones_was_here@xonotic.au>
8 months agofs: use current working dir as basedir if not otherwise specified
bones_was_here [Sun, 21 Apr 2024 16:11:56 +0000 (02:11 +1000)]
fs: use current working dir as basedir if not otherwise specified

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agoAccept "ctrl" + "=" for increasing console text size (#167)
James O'Neill [Sun, 21 Apr 2024 15:28:29 +0000 (00:28 +0900)]
Accept "ctrl" + "=" for increasing console text size (#167)

Can't use the "=+" key to increase the console text size because the
code only wants "+"; ctrl+shift+= also does not work. Keypad + works.
This patch makes it accept the = key as well as +.

Fixes #110 .

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agoMerge PR 'Compare Q1BSP sky textures properly when loading'
James O'Neill [Sun, 21 Apr 2024 15:07:23 +0000 (00:07 +0900)]
Merge PR 'Compare Q1BSP sky textures properly when loading'

Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/58 by loading sky textures with CRC checking, previously they
were always considered duplicates by `R_SkinFrame_LoadInternalBGRA`
because they reuse the same names.

Closes https://github.com/DarkPlacesEngine/darkplaces/issues/105

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

---------

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agoMerge PR 'Add support for a "give a" command to give player armour'
James O'Neill [Sun, 21 Apr 2024 14:44:09 +0000 (23:44 +0900)]
Merge PR 'Add support for a "give a" command to give player armour'

Allows the command `give a #` to give the player armour, just like the
other `give` commands. Based on the example code provided by Baker7.
Fixes #132 .

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agomenu: update video settings
bones_was_here [Sat, 20 Apr 2024 19:28:02 +0000 (05:28 +1000)]
menu: update video settings

Adds display selection, desktop fullscreen, adaptive vsync, 1600x900
resolution, and improves refresh rate configuration in the built-in
Quake menu.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agovid: overhaul modesetting
bones_was_here [Sun, 14 Apr 2024 14:38:33 +0000 (00:38 +1000)]
vid: overhaul modesetting

Implements hardware refresh rate modesetting, this wasn't implemented
yet for SDL2 (although it was partially supported in
c03b106680122333189e42294c4fb3c385307631).

Implements colour depth modesetting but leaves it disabled because
almost all display hardware supports 24bpp only.

Properly integrates desktopfullscreen and display selection into the
modesetting design.

Changes the modesetting design to better suit SDL2 (see comments),
using the code for immediately applying cvar changes in the startup path
too.

Disables immediate-apply of display cvar changes when hardware
modesetting is active and the player is accessing a menu, because
traditional menu designs don't support it: they make players scroll
through a list of resolutions, setting the cvars at each step.

Enables modesetting on Linux: turns out it does still work in SDL2 even
though exclusive fullscreen support was removed.  SDL2 replaced
exclusive fullscreen with desktopfullscreen combined with an xrandr
modeset (behaves like desktopfullscreen IF the mode is the same
as the desktop one).

Replaces the 640x480 modesetting fallback with desktopfullscreen, should
be nicer and should always work (the old fallback is still there but
should never be reached).

Adds a debug print of all modes supported by the display (at startup).

Updates modesetting console prints.

Works around an SDL bug when increasing hardware resolution.

Works around an SDL bug where it doesn't set the error string in
SDL_GetClosestDisplayMode() so SDL_GetError would return some unrelated
message.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agovid: remove cvar vid_userefreshrate
bones_was_here [Mon, 15 Apr 2024 23:01:37 +0000 (09:01 +1000)]
vid: remove cvar vid_userefreshrate

It's unnecessary and other Quake engines don't have it.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agovid: clean up some globals
bones_was_here [Mon, 15 Apr 2024 20:06:54 +0000 (06:06 +1000)]
vid: clean up some globals

Fixes vid_stick_mouse assuming window width and height couldn't change

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agovid: refactor VID_Mode() calling
bones_was_here [Mon, 15 Apr 2024 21:35:28 +0000 (07:35 +1000)]
vid: refactor VID_Mode() calling

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agovid: consolidate mode structures
bones_was_here [Mon, 15 Apr 2024 20:46:54 +0000 (06:46 +1000)]
vid: consolidate mode structures

This uses a viddef_mode_t `vid.mode` in the global viddef_t `vid`
instead of having a separate declaration of each var there, makes
copying it more efficient.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agovid: refactor modesetting fallbacks
bones_was_here [Mon, 15 Apr 2024 01:21:18 +0000 (11:21 +1000)]
vid: refactor modesetting fallbacks

Moves setting of cvars from VID_Mode into VID_Restart_f because we only
need to do it if a vid_restart fails after changes were made, during
normal startup the only source of config changes is the fallbacks cvar
array which already sets them as they're tested.
This avoids unnecessary clobbering and callbacks under normal
circumstances and makes vid_restart code more self-contained.

Refers to cvars by pointer instead of string for robustness.

Removes persistent storage of last known good mode, it's only needed in
VID_Restart_f and it would be verbose and error-prone to keep it updated
as well as the current mode when applying cvar changes and SDL events.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agobuild: minor adjustments
bones_was_here [Thu, 11 Apr 2024 17:55:08 +0000 (03:55 +1000)]
build: minor adjustments

VS2019: get more of the targets to build (needed to specify modern C
standard for all of them, and SDK "10.0" seems to mean "use latest
version installed").
VS2019: improve README.md instructions.

Makefile: fix PEDANTIC=1 test builds and warning spam.

sys: properly fix warnings related to SDL's wrapping of main() for all
platforms.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agoMerge PR 'Make particles solid squares when cl_particles_quake is set to 2'
James O'Neill [Fri, 12 Apr 2024 12:53:38 +0000 (21:53 +0900)]
Merge PR 'Make particles solid squares when cl_particles_quake is set to 2'

This creates a new function, CL_NewQuakeParticle, that is used instead of CL_NewParticle when cl_particles_quake is enabled. The function calls CL_NewParticle with a some hardcoded defaults to make the particle texture a disc, or solid square, based on the value of cl_particles_quake.

Improves particle function documentation.

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

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agobuild: get Visual Studio 2019 to compile
bones_was_here [Thu, 11 Apr 2024 14:50:16 +0000 (00:50 +1000)]
build: get Visual Studio 2019 to compile

Adds basic instructions to README.md

Updates SDL2 NuGet package.

Updates .gitignore to exclude all generated build objects and the
downloaded NuGet packages (VS downloads them automatically if missing,
seems better than storing old versions here).

Removes files from legacy VS versions.

The resulting build isn't usable for playing (see README.md).
Maybe someone who uses this platform can fix it.

Closes https://github.com/DarkPlacesEngine/darkplaces/issues/129

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agovid: apply vid_width and vid_height cvar changes immediately
bones_was_here [Wed, 10 Apr 2024 19:39:17 +0000 (05:39 +1000)]
vid: apply vid_width and vid_height cvar changes immediately

This uses an SDL feature to avoid a bogus hardware modesets (eg when one
cvar is changed before the other).

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agovid: [Windows] enable vid_ignore_taskbar by default
bones_was_here [Wed, 10 Apr 2024 18:45:38 +0000 (04:45 +1000)]
vid: [Windows] enable vid_ignore_taskbar by default

When this Windows-specific cvar is disabled, a strange horizontal offset
of the window occurs, at least on Windows 20 22H2.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agovid: misc updates to comments, console prints, func naming
bones_was_here [Wed, 10 Apr 2024 18:44:34 +0000 (04:44 +1000)]
vid: misc updates to comments, console prints, func naming

The bug where SDL returns incorrect display layout after hotplug events
doesn't seem to occur on Windows 10 22H2.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agovid: don't overwrite vid_width and vid_height when using vid_desktopfullscreen
bones_was_here [Wed, 10 Apr 2024 15:35:45 +0000 (01:35 +1000)]
vid: don't overwrite vid_width and vid_height when using vid_desktopfullscreen

This allows the player's windowed mode preferences to be saved by
default.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agovid: enable vid_resizable by default
bones_was_here [Wed, 10 Apr 2024 13:06:09 +0000 (23:06 +1000)]
vid: enable vid_resizable by default

It works well and is convenient.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agovid: [Windows] don't r_restart for window resize events
bones_was_here [Wed, 10 Apr 2024 13:02:44 +0000 (23:02 +1000)]
vid: [Windows] don't r_restart for window resize events

This workaround was added for SDL 1.2 and is no longer necessary.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agovid: [Windows] fix disabling of OS DPI scaling
bones_was_here [Wed, 10 Apr 2024 12:58:26 +0000 (22:58 +1000)]
vid: [Windows] fix disabling of OS DPI scaling

d33a1d0ffb434270de498c386271e484f90e6716 didn't actually work cos I
hadn't found where the good SDL documentation was, and didn't have a
high DPI Windows test machine.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agosys: [Linux] remove/replace obsolete timing and sleep syscalls, slightly improve...
bones_was_here [Tue, 9 Apr 2024 16:27:45 +0000 (02:27 +1000)]
sys: [Linux] remove/replace obsolete timing and sleep syscalls, slightly improve timing

Uses CLOCK_MONOTONIC_RAW on Linux, this is unaffected by synchronisation
adjustments and is used by SDL_GetPerformanceCounter() (we'll use it
directly to support dedicated servers without SDL).

Removes gettimeofday() and usleep() which were marked obsolete and
removed in POSIX.1-2008 so the old comment // FIXME improve this check
was impossible to address. The gettimeofday() replacement is very well
tested now (sys_useclockgettime 1 is default even in div0-stable).

Removes host_maxwait as the problems it worked around were fixed.

Tidies up a little.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agosys: [Windows] use more precise timing and sleeping
bones_was_here [Tue, 9 Apr 2024 14:25:39 +0000 (00:25 +1000)]
sys: [Windows] use more precise timing and sleeping

Achieved sleep behaviour is still worse than on Linux, but it's now the
best Windows can do.

Enables sys_usequeryperformancecounter by default. Most modern games use
this. Very old machines or Windows VMs may benefit from disabling it.

Fixes sys_usequeryperformancecounter issue where if enabled at startup,
timer precision was only 15.625ms.

Removes workaround for compilers that don't support 64 bit integers.

Updates documentation.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agosys: [Windows] fix spinning instead of sleeping
bones_was_here [Mon, 8 Apr 2024 00:41:52 +0000 (10:41 +1000)]
sys: [Windows] fix spinning instead of sleeping

For 231beb2c234914f942166eb152c44e55b5b01f86 I tested incorrectly, using
Task Manager inside the VM which reports low CPU load even when spinning.
DP's `status` command showed the correct result.

Changes the default path from select() to: usleep() on POSIX, Sleep() on
Windows.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agoPRVM: minimise impact of GC on benchmark results
bones_was_here [Sun, 7 Apr 2024 15:15:14 +0000 (01:15 +1000)]
PRVM: minimise impact of GC on benchmark results

Previously GC could cost hundreds of FPS in certain Xonotic tests
because the CPU workload increased as the FPS did.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agoFix CSQC garbage collection crash, support GC in CSQC_SIMPLE mode
bones_was_here [Sat, 6 Apr 2024 20:16:17 +0000 (06:16 +1000)]
Fix CSQC garbage collection crash, support GC in CSQC_SIMPLE mode

Caused by a "typo" in 3f9fdd41aec12c0832ed07f2ba0239383a3801d4

Closes https://github.com/DarkPlacesEngine/darkplaces/issues/161

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agoRemove CF_ARCHIVE bit from r_q1bsp_lightmap_updates_enabled
bones_was_here [Thu, 4 Apr 2024 10:46:16 +0000 (20:46 +1000)]
Remove CF_ARCHIVE bit from r_q1bsp_lightmap_updates_enabled

Disabling this breaks rendering so it doesn't make sense to leave it
enabled after testing.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>