Fixed pause/un-pause on window focus gained or lost in pull request #1017.
Fixed ogg playback when switching video options, missed in #1004.
Fixed ogg playback when the last menu closed, misplaced in #1004.
Normal warping surfaces (SURF_DRAWTURB) with water etc should use
brightness 0.5*intensity (like they did before), but those with lava
should be brighter, so use 1.0*intensity in the shader.
The reason that intensity needs to be scaled down is that these surfaces
have no lightmaps, so they'd be rendered fullbright otherwise.
I'm using the simple heuristic of texturename contains "lava" to
detect lava textures.
Over the last years high dpi displays became increasingly popular. We
already implemented very basic high dpi support for Windows several
years ago by setting the "please don't scale us" option. Linux (and
all other unixoid platforms) hadn't a real understandig of high dpi
and everything involved until the advent of Wayland and finally the
*fractional-scale-v1* protocol last autumn.
Since then SDL (even bevore the protocol was finalized) and all three
common Wayland compositors (Gnome, KDE and wlroots) have grown support
for the protocol and are now high dpi aware. In a high dpi aware world
the choice is scale yourself or get scaled by the compositor. The later
option isn't so good for fast paced games like Quake II, it introduces
blur and slugishness. Therefore implement hig dpi awareness through SDL.
This isn't perfect right now:
* SDL is still getting high dpi awareness fixes with every release. High
dpi awareness in YQ2 is currently limited to at least SDL 2.26 and we
may rise the required version even more if necessary.
* There are stll bugs in the compositors. For example Gnome 44.1 has a
tedency to misscalculate the space occupied by the fullscreen window,
the game ends up wit a white bar on top. sway even misscalculates
some scaling factors: https://github.com/swaywm/sway/issues/7463
* SDL hasn't got a reliable way to get the real non scales desktop
resolution.
Because of this:
* High dpi awareness is currently restricted to Wayland. Let's get one
platform right before we implement it for everything else.
* It's hidden behind `vid_highdpiawareness` and disabled by default.
High dpi awareness is implemented by setting `SDL_WINDOW_ALLOW_HIGHDPI`
on the window. After the window and rendering context are created
`SDL_GL_GetDrawableSize()` or `SDL_GetRendererOutputSize()` are used
to query the actual drawable size and the internal representation is
overwritten with it.
This would scale the fullscreen window over the full screen, no matter
what resolution was selected. Some work arounds are implemented to
(mostly) keep the old behaviour were resoltions lower than the desktop
resolution weren't scaled. There is one inconsistency: While the non
high dpi aware soft renderer always scaled over the full screen, the
high dpi aware variant doesn't. This is a restriction by SDL Renderer.
Setting native fullscreen was broken before when running on high dpi
displays and it's not fixed. This is caused by SDL being unable to
determine the real resolution (or whatever the compositor thinks the
real resolution is). Depending on the compositor or if the client is
high dpi aware the correct resolution must be set by hand **or** auto
setting with `r_mode -2` must be used. Resolution detection was switched
to `SDL_GetCurrentDisplayMode()` because it's somewhat less problematic
than `SDL_GetCDesktopDisplayMode()`.
The renderer API was extended by one function pointer `*GetDrawableSize`
used to communicate the actual drawable size between renderer and
client. The API version was bumped to 6. I'll fix ref_vk before pushing
this change to master.
Playback features outlined in issue #715 .
Reintroduce activate\deactivate sound backend when window focus in changed.
Added "windowed_pauseonfocuslost" cvar to allowing user control of pause when the window changes focus.
Added "ogg_pausewithgame" cvar to allow user control of ogg playback whenever the game is paused.
Introduced ogg playback command "mute" as an additional playback option for the console, command buffer and key binds.
If the window focus is changed all sound playback will stop and resume as expected.
Setting "window_pauseonfocuslost" to 1 will force the game to pause when the window focus is lost, "cl_paused" is ignored in multiplayer.
Setting "ogg_pausewithgame" to 1 will force ogg playback to pause whenever the game is paused.
Toggling ogg mute through "ogg mute" sets the volume to 0 while playback resumes.
Code around it by using `wcsncpy()` and `wcscat()` combined with a
manual length check. This should be enough to make YQ2 working on Win
XP again. Please note, that we don't support any Windows older than
10. However we still try to avoid breaking them.
Based on an idea by @ carlo-bramini, closes#994.
This fixes a corner case: When the client is in state `ca_disconnected`
and the user presses repeatedly return, there is a chance that a older
line is erroneously printed again. This is caused by spinning through
the console history buffer, when an old line is the current line a the
frame were the console refreshs it's printed. Work around that by
clearing every line as soon as it becomes the current line.
Closes#987.
This matches the behavior of cmake. Besides that we have some optional
C11 code and it should be used if the compiler has support for it. And
C99 as default is a remnant from the old times were we didn't want C11
in the standard code path, because several old Linux distros didn't
support it...