]> git.rm.cloudns.org Git - xonotic/darkplaces.git/log
xonotic/darkplaces.git
4 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>
4 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

4 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

4 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

4 months agocl_demo: write all client stats not just a fixed list
Des [Mon, 5 Aug 2024 11:59:13 +0000 (08:59 -0300)]
cl_demo: write all client stats not just a fixed list

4 months agoAdd resendcsqcents command to ask server to resend all csqc entities, used in demo...
Des [Mon, 5 Aug 2024 11:59:10 +0000 (08:59 -0300)]
Add resendcsqcents command to ask server to resend all csqc entities, used in demo record restarting.

4 months agoIf already connected keep csprog data since downloading messages were already kept...
Des [Mon, 5 Aug 2024 11:59:04 +0000 (08:59 -0300)]
If already connected keep csprog data since downloading messages were already kept in demo_head variables.

4 months agoCrude port from demo rerecording code from quakespasm/proquake. Outputs a working...
Des [Mon, 5 Aug 2024 11:58:59 +0000 (08:58 -0300)]
Crude port from demo rerecording code from quakespasm/proquake. Outputs a working demo, with problems (no hud?, mby more).

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>
8 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>
8 months agoImplement CSQC_SIMPLE aka hud-only CSQC, improve compatibility
bones_was_here [Tue, 2 Apr 2024 14:35:20 +0000 (00:35 +1000)]
Implement CSQC_SIMPLE aka hud-only CSQC, improve compatibility

This should match the behaviours of engines with minimal CSQC support,
allowing DP to run any csprogs made for them.

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

Updates dpdefs to include compatible parameter names.

Adds VM-specific code for checking required functions during QC program
loading.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agoREADME.md: various doc adjustments
bones_was_here [Tue, 2 Apr 2024 07:57:03 +0000 (17:57 +1000)]
README.md: various doc adjustments

GitHub happy splits `-rogue` over two lines...
OS X Carbon is long gone (along with GLX and WGL).

8 months agomenuqc: declare localcmd() and deduplicate it
bones_was_here [Tue, 2 Apr 2024 07:03:40 +0000 (17:03 +1000)]
menuqc: declare localcmd() and deduplicate it

It's awkward having a different name for the same builtin in a different
VM, Xonotic was working around it (for code sharing) with a macro.

8 months agoClarify documentation of gamedirs, add to README.md
bones_was_here [Mon, 1 Apr 2024 12:40:00 +0000 (22:40 +1000)]
Clarify documentation of gamedirs, add to README.md

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agoRevert "fs: save files in the correct place when gamedir(s) are in use"
bones_was_here [Mon, 1 Apr 2024 11:37:16 +0000 (21:37 +1000)]
Revert "fs: save files in the correct place when gamedir(s) are in use"

This reverts commit 5db369bea3d0cdd3dbd3b5b8038a399f0dbf84b6.

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agoFix r_glsl_dumpshader segfault
James O'Neill [Mon, 18 Mar 2024 12:06:22 +0000 (21:06 +0900)]
Fix r_glsl_dumpshader segfault

In 05bc75558afbdf80289fddf9a330dd7382a07d0d only i should have been
changed to unsigned to prevent the warning.

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
8 months agoPRVM: fix null ptr deref in VM_getkeybind()
bones_was_here [Sun, 31 Mar 2024 19:21:01 +0000 (05:21 +1000)]
PRVM: fix null ptr deref in VM_getkeybind()

Breaking commit was 26a665ff43052862131df3c63785f91861989fc8

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agovid_vsync: work around Wayland-specific init bug
bones_was_here [Tue, 12 Mar 2024 14:22:14 +0000 (00:22 +1000)]
vid_vsync: work around Wayland-specific init bug

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoNudgeOutOfSolid: fix moving entities out of the world in complex cases
bones_was_here [Mon, 11 Mar 2024 23:29:15 +0000 (09:29 +1000)]
NudgeOutOfSolid: fix moving entities out of the world in complex cases

Renames a var for clarity.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agomap command: recognise Q3BSP variants IBSP47 and IBSP48
bones_was_here [Mon, 11 Mar 2024 18:13:28 +0000 (04:13 +1000)]
map command: recognise Q3BSP variants IBSP47 and IBSP48

Quake Live and Iron Grip, already supported by the loader.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoUnderwater sound filter: an optimisation from terencehill
bones_was_here [Mon, 11 Mar 2024 17:36:42 +0000 (03:36 +1000)]
Underwater sound filter: an optimisation from terencehill

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoMerge PR 'Muffle sounds when the player is under water'
bones_was_here [Sun, 10 Mar 2024 16:23:03 +0000 (02:23 +1000)]
Merge PR 'Muffle sounds when the player is under water'

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoUnderwater sound filter: simplify code, improve cvar description
bones_was_here [Sun, 10 Mar 2024 16:10:57 +0000 (02:10 +1000)]
Underwater sound filter: simplify code, improve cvar description

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoUnderwater sound filter: fix warning and code style, add function docstring
James O'Neill [Mon, 4 Mar 2024 03:24:07 +0000 (12:24 +0900)]
Underwater sound filter: fix warning and code style, add function docstring

9 months agoAdd underwater sound filter
Daft Mugi [Thu, 29 Feb 2024 10:37:37 +0000 (04:37 -0600)]
Add underwater sound filter

Enabled by default. Use 'snd_waterfx 0' to disable it.

Adapted code from Ironwail so that it works in this engine.

Cherry-picked from daftmugi/wrath-darkplaces

9 months agoREADME.md: add a section about downloading and running DP
bones_was_here [Fri, 8 Mar 2024 02:28:33 +0000 (12:28 +1000)]
README.md: add a section about downloading and running DP

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoMerge PR 'Use Github actions to compile Linux builds'
bones_was_here [Fri, 8 Mar 2024 02:05:37 +0000 (12:05 +1000)]
Merge PR 'Use Github actions to compile Linux builds'

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoNew Github workflow file
James O'Neill [Mon, 4 Mar 2024 12:04:12 +0000 (21:04 +0900)]
New Github workflow file

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agosys: allow the platform to handle crashes after DP does
bones_was_here [Thu, 7 Mar 2024 20:31:33 +0000 (06:31 +1000)]
sys: allow the platform to handle crashes after DP does

As suggested by divVerent in chat.
In SDL builds (including when using -dedicated on the cmdline) the OS
handler runs after the user clicks OK on the SDL dialog.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoWork around incomplete C11 support in Microsoft's stddef.h
bones_was_here [Thu, 7 Mar 2024 19:27:14 +0000 (05:27 +1000)]
Work around incomplete C11 support in Microsoft's stddef.h

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoMake the Sys_Error() message more informative
bones_was_here [Thu, 7 Mar 2024 18:32:06 +0000 (04:32 +1000)]
Make the Sys_Error() message more informative

Re: 24550510e6ff331c1749707df7fad608f618bdd3 as discussed in chat, there
was a good reason to change this word: it indicates DP deliberately
stopped execution, whereas "Error" is generic (most problems that can
happen on a computer are some form of error).  Also "Engine Error"
makes it sound like there's a bug in DP, which isn't necessarily the
case: there are several scenarios where user error can trigger this.
This message was already different from Quake's "Quake Error".

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoRevert renamings from 591877ee0c64958303dcbb4f2af3d343a420cf6a
Cloudwalk [Sat, 2 Mar 2024 17:06:12 +0000 (12:06 -0500)]
Revert renamings from 591877ee0c64958303dcbb4f2af3d343a420cf6a

Pragmatically speaking, absent any good reason otherwise, naming conventions for functions like Sys_Error should remain consistent with Quake for developer sanity.

9 months agoMerge PR 'Force C syntax for qc and qh files on Github'
bones_was_here [Fri, 1 Mar 2024 09:33:45 +0000 (19:33 +1000)]
Merge PR 'Force C syntax for qc and qh files on Github'

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoForce C syntax for qc and qh files on Github
James O'Neill [Fri, 1 Mar 2024 09:18:42 +0000 (18:18 +0900)]
Force C syntax for qc and qh files on Github

9 months agosys: prevent loops in signal handlers
bones_was_here [Mon, 26 Feb 2024 18:53:26 +0000 (04:53 +1000)]
sys: prevent loops in signal handlers

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

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoREADME: add some build notes
bones_was_here [Mon, 26 Feb 2024 15:39:23 +0000 (01:39 +1000)]
README: add some build notes

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agorcon: return the error message when authentication fails
bones_was_here [Mon, 26 Feb 2024 14:55:11 +0000 (00:55 +1000)]
rcon: return the error message when authentication fails

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoCLVM: remove more cruft
bones_was_here [Mon, 26 Feb 2024 11:54:39 +0000 (21:54 +1000)]
CLVM: remove more cruft

These macros were functional originally (see
715bf430b1612f5a4527968b683db80de14f10f9) but are redundant now.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoCLVM: remove cruft
bones_was_here [Mon, 26 Feb 2024 11:40:17 +0000 (21:40 +1000)]
CLVM: remove cruft

Having more than one var tracking one state can lead to bugs.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoPRVM: update program loading messages
bones_was_here [Mon, 26 Feb 2024 10:54:08 +0000 (20:54 +1000)]
PRVM: update program loading messages

This was missed in cfee52a1ec9db338098789cae89ae5cf1f7a6fbf

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoPRVM: refactor error handling
bones_was_here [Sun, 11 Feb 2024 13:54:39 +0000 (23:54 +1000)]
PRVM: refactor error handling

Cleans up PRVM_Crash() calling and removes redundant code.
Directs menu errors to stderr instead of stdout.
Aborts if a loop is detected in MVM_error_cmd(), matching Host_Error().
Prevents QC's CSQC_Shutdown() being called when CSQC crashes.
Makes cvar prvm_errordump ignore MENUQC crashes.
Improves some messages and comments.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
9 months agoPRVM: don't break csqc when menuqc has a problem
bones_was_here [Sun, 25 Feb 2024 22:27:35 +0000 (08:27 +1000)]
PRVM: don't break csqc when menuqc has a problem

Fixes a regression in 3d84db99ed9d8234809d237512f44cfa6d7ce1a0 caused by
moving this line such that it executes even for MVM errors. We don't
need it because it's done by Host_Error->CL_DisconnectEx->CL_VM_ShutDown

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agoMVM: fix endless loop when a command causes an error
bones_was_here [Sun, 25 Feb 2024 22:34:08 +0000 (08:34 +1000)]
MVM: fix endless loop when a command causes an error

7e1f7d12f57c064a6855d9850d28387ca6092c45 should have included this.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agoFix changing of player name during a game
bones_was_here [Fri, 9 Feb 2024 08:12:34 +0000 (18:12 +1000)]
Fix changing of player name during a game

Name changes applied when connecting or when the map changed, but not
during the game.
I broke it in 74b49d6e5412af206448119963e0a4b3617e8ca4 by not
noticing the user-visible name of the cvar is used to determine which
command (if any) is sent.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agoFix two memory allocation issues
bones_was_here [Fri, 9 Feb 2024 09:14:59 +0000 (19:14 +1000)]
Fix two memory allocation issues

In fa06dd40f48b20d738b6bd604758c81defd76cfd I misunderstood the
subdivision code, causing sentinel2 to be written past the end of the
buffer... somehow many maps and games worked fine despite this. This
commit reverts the bad line from that commit.

A very old (div0-stable) bug when loading Q1BSP meant we didn't allocate
enough texture memory when a "sky" texture name wasn't all lowercase,
causing a crash when loading custom map e2m9.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agoCLVM: set mapname global correctly (matching SVVM)
bones_was_here [Fri, 9 Feb 2024 07:09:14 +0000 (17:09 +1000)]
CLVM: set mapname global correctly (matching SVVM)

This is an old bug but the code Nexuiz and Xonotic used to work around
it still gives correct results when the prefix and suffix are already
stripped.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
10 months agochangelevel: start a map even if none is running
bones_was_here [Fri, 9 Feb 2024 06:53:14 +0000 (16:53 +1000)]
changelevel: start a map even if none is running

Implements https://gitlab.com/xonotic/darkplaces/-/issues/408

Although the original implementation of this convenience
688396cea66f09e7ce20d3e3b077261dd1d3db7e labeled it as a hack, it was
robust, simple and worked fine in div0-stable, so removing it in
cb11bdeed238603b11d8dac4908cfdbabe298079 was a regression.

Also removes some redundant string copying.

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