drjaska [Tue, 3 Dec 2024 06:36:19 +0000 (08:36 +0200)]
Change the shade of Quake blue to make it readable (#217)
Commits:
- 465d2925 Revert "Change directory text colour in console from blue to
light cyan (https://github.com/DarkPlacesEngine/DarkPlaces/pull/197)"
This reverts commit
https://github.com/DarkPlacesEngine/DarkPlaces/commit/0c17657b4a2562f6c1d9e0a0707faff825dd8ce5.
This was a band-aid fix to a single issue and does not address the root
cause or any of the other issues where the Quake blue colour is not
readable.
This is my attempt at making the Quake blue more readable.
---
The changes can be tested for example via `echo
^1aaa^2aaa^3aaa^4aaa^5aaa^6aaa^7aaa^8aaa^9aaa` or `playdemo` tab
completion.
---
`gl_draw.c:862` has the colour definition of blue which is too dark to
be readable in several cases. It is currently set to `#0000FF` in hex,
pure blue. Changing this should be preferred over the change in
https://github.com/DarkPlacesEngine/DarkPlaces/pull/197 as directories
in the console are not the only issue and this avoids making all
directories have the colour of symlinks, breaking the decades long
default UNIX terminal colour theme.
The colour code which (if sys_colortranslation > 0) is output to the
stdout which is often visible on a terminal running the engine gets the
ANSI colour code from `console.c:1367` BUT the user's terminal decides
what colour the colour code is rendered as and thus this doesn't require
any change. If sys_colortranslation == 3 and the terminal supports 24bit
colours then terminal colours are not used but the RGBA colours.
It is worth noting that `cmd.c:669` already includes a hack:
```c
// Work around low brightness and poor legibility of Quake font
"r_textbrightness 0.25\n"
"r_textcontrast 1.25\n"
```
which may affect how your colours are drawn as these values are not the
default values. Mods may also set these. Xonotic uses a different font
and
```quake
r_textbrightness 0.2
r_textcontrast 0.8
```
which I guess is neutral with the math formula in `console.c`:
```c
bound(0, rgb[i] * r_textcontrast.value + r_textbrightness.value * 255, 255);
```
Note that the `r_textcontrast 1.25` hack which I think applies to
vanilla Quake 1 progs looks like it shouldn't actually accomplish
anything due to the 255 bounding except raise the brightness of the
"half brightness" colour. But for some reason changing `r_textcontrast`
to 2 causes a jump in brightness but 2 to 3 or any above ones do not. Is
there something halving the text colour in Quake 1 console? Though after
my change it does affect the shade of blue as it has values which are
not maxed at 1.0 or values like 0 which are not affected by the
multiplication. I would recommend considering removing it.
I would not recommend changing the colours globally as there are mods
and users who have already made their colours good and visible. Just
blanket adding 0.25 brightness to all colours causes Xonotic's colours
to look very washed out. Game specific fixes should be encouraged like
the Quake 1 progs and Xonotic ones as they all use different fonts and
lighting (text and screen).
---
I did also look at a patch which bakes in r_textbrightness 0.25 into the
base colours but chose not to include it due to the reasons in previous
chapter.
Rudolf Polzer [Wed, 20 Nov 2024 13:04:26 +0000 (14:04 +0100)]
Simplify decal system.
Removes the `freedecal` field, and as such, fixes some invariant violations
found in issue #216 that appear to lead to engine crashes.
Performance should remain unchanged, as the decal expiry process performed
full decal copies from end spots to unoccupied spots as part of its
"shuffling" loop anyway.
Rudolf Polzer [Fri, 1 Nov 2024 18:41:00 +0000 (14:41 -0400)]
Add missing opcode names to the disassembler.
Also fix instruction coloring and naming in disassembler.
- For some reason, all LOAD_ instructions are called FIELD_ now. Weren't
they called INDIRECT_ once? Well, anyway, not touching that, just
making it consistent with itself.
- Match new instructions in color to existing ones doing the same.
James O'Neill [Fri, 8 Nov 2024 13:18:34 +0000 (22:18 +0900)]
Add sv_gameplayfix_nosquashentities to control entity hitbox squashing (#170)
Adds new cvar `sv_gameplayfix_nosquashentities` which, when enabled,
will prevent entity hitboxes being resized when the entity is squashed
by a mover. This means the entity can continue to interact with pushers
and movers. Fixes #155.
uis246 [Fri, 8 Nov 2024 13:17:30 +0000 (16:17 +0300)]
Improve glsl shader performance (#211)
Most optimizations are done by abusing mathematical properties and
replacing slow on some hardware(e.g. Inetl) min and max with saturation.
For example dot product is in range [-1, 1], so `max(0, dot(...))` =
`sat(dot(...))`.
In places where this potentially can mess with HDR comments were added.
Rudolf Polzer [Mon, 23 Sep 2024 13:02:27 +0000 (15:02 +0200)]
Remove the `jumpabsolute` member from `mstatement_s`.
This reduces the struct from 20 to 16 bytes, and thus may save some
RAM. It also may improve CPU cache behavior by keeping more QC code in
L1 and L2 cache, and possibly also improve instruction processing inside
the CPU as all statements are aligned the same way.
On `srv04`, this speeds up Xonotic's `serverbench` from 58.92s real,
57.72s user to 57.72s real, 56.59s user (median of 25).
Since that cvar was implemented, unix time has grown too large to be
represented precisely by a float, causing FPS to be much lower than
configured. Should be using host.realtime (relative) here anyway.
Simplifies Curl_Select() and improves some debug messages.
So we can work around its bug (race condition) that makes start.bsp
unplayble sometimes because apparently DP is faster at connecting the
local client than some other engines, and this mod relies on it taking
longer.
host: make some startup errors non-fatal, related polishing and cleanup
It's annoying to abort DP just because of a bad menu progs or demo,
especially on Windows where accessing stdout is difficult so console
access is more important.
Shows a correct fallback message when the menu progs crashes (it's not
because of missing files).
Makes the missing files message more concise.
Performs a full cleanup after any QC crash, most importantly
progs->loaded is now false until that VM is restarted successfully.
Prevents menu failure interfering with more important VMs.
Removes the weird "early frame abort" jump point which is redundant now
because Host_Error, now the only code that ever aborts a frame, calls
Sys_Error instead of Host_AbortCurrentFrame during init.
Changes the framecount of the first frame from 0 to 1 so that when it's
>0 that means frame abort is now possible and safe.
When inactive/minimised with snd_mutewhenidle enabled, the audio capture
was unreliable and sound was sometimes output when it should have been
muted.
Closes https://gitlab.com/xonotic/darkplaces/-/issues/92
(the video issue was already fixed).
Timedemos now share the same mute implementation as snd_mutewhenidle.
Ignores refresh requests while a refresh is in progress.
This prevents live servers getting timed out, which sometimes happened
when Xonotic menu QC responded to a server list mouseover event.
Fixes incorrect types in timeout check and ping comparison.
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.
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.
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
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.
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.
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.
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.
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.
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
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
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.
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.
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.
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).
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.