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.
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.
Ogg file has incorrectly calculated size and samples as
result calculation of volume and timings have used
incorrect test samples for sterio sound.
Checked with compare ogg and wav samples from 25th
Anniversary mod:
```
ffmpeg -i 25acu/sound/world/goreshit.wav 25acu/sound/world/goreshit-ogg.wav
```
Soundlist:
```
]/soundlist
(16b) 1404340(2 ch) world/goreshit.wav -11.7 dB 351.1s:15.0..0.3..1.1..2.0
(16b) 1404340(2 ch) world/goreshit-ogg.wav -11.5 dB 351.1s:15.0..18.4..1.4..2.0
```
Fixes:
* https://github.com/glhrmfrts/q25_game/issues/8
* https://github.com/yquake2/yquake2/issues/991
dkms-hid-nintendo can expose the IMU sensors of a Switch controller
as a "second joystick", which makes possible to use gyro aiming on a
system without SDL 2.0.14 available (the minimum required to read
controller sensors like gyro and accelerometer).
This commit makes both "sensor" and "joystick reading" to coexist.
"Sensor" is still the preferred method when available.
Playback features outlined in issue #729.
Added shuffle playback parameters:
default - Ogg track currently active repeats. This is the quake2 default behaviour.
play once - Ogg track currently active plays once then stops.
sequential - Ogg tracks play in numerical order, from the currently playing track and like default repeats.
random - Ogg tracks play randomly, but never the same track twice.
Ogg tracks can be played from a full-screen console and tracks played will adhere to the shuffle parameter.
Loading a game map the map cd-track takes precedence as the first played track then subsequent playback of tracks will adhere to the shuffle parameter.
Any currently playing track can be overridden from the console with "ogg play <track>" command and subsequent playback of tracks will adhere to the shuffle parameter.
If a sound restart occurs the ogg backend will attempt to save and recover the currently playing track, though some data in the audio queue may be lost in the process.
the HunkAlloc size calculated in calTexinfoAndFacesSize() was too
small because that map has a *massive* water poly.
Unfortunately it's not feasible to calculate the correct size
(it depends on the size of the poly, for which I'd need the vertex
coordinates, but to get them I'd have to load them first, which requires
the allocation...), but allocating 5MB extra (instead of 1) made it work
Haptic maximum effect distance value, By default this cvar is `100.0`.
Any positive value is valid. E.g. effect of shot near barrel to barrel
has 58 points.
In Quake I this coould be used to filter messages by priority. id
Software never implemented it for Quake II, it's just a left-over.
Remove it.
The `msg` cvar was exploited in attacks against the client. A malicious
server send a `msg` cvar as stufftext -> it gets saved into the config
-> since it's retrivable over the network through the userinfo stuff
this can be used to track users, etc.
Patchwork from df399576 no longer needed, deleted
Joysticks open with error checking
Slight optimization for gyro aiming
Better console messages in game controller init
`s_info->samples' is very big, even for short wave files. Multiply it by
1000 has a very high chance of flowing over and it is a wonder that so
far no one noticed it. Fix the overflow by working on 64 bit integers.
Closes#931.
A cool effect used in 'mine2' map ("train2"), ruined 'train' map; fixed
Player pain readjusted by type, resulting intensity is now almost equal for all
instead of the "higher health" ones being bigger, which didn't make sense
Quake II has two palettes. One static palette used for the world and one
dynamic palette used by cinematics. Switching from the cinematic back to
the world palette is handled by putting up the loading plaque. Since a
cinematic always ends with loading somehting else this generally works.
Unfortunatly setting `developer 1` skips the loading plaque. The palette
never gets reset and the world looks like a bad LSD trip. ;) A correct
fix is complicated, because the loading plaque logic is messed up and
working by luck. Reworking the logic has a high propability breaking
corner cased exploited by mods.
Therefor take the easy route and uncoditionally switch to the world
palette when bringing up the loading plaque with `developer 1`.
Closes#925.
commit 93e9633382 "Port step smoothing code from r1q2." ported
r1q2 stair step smoothing for ranges that are equivalent to 8, 12 and 16
units/step.
Later in commit 7f996cc "Don't smooth half height steps" we removed
step sizes 8 and 12, because it appeared to make an elevator in hangar2
(over the water, after jump'n'run sequency) stutter.
However, in reality what made them stutter was the broken comparison
for velocity with an illegal cast, that we later fixed in
e30f82494 "Don't cast the array itself but it's content."
So now restore the smoothing for step sizes 8 and 12, which hopefully
fixes bug #923, and definitely does *not* break the elevater in hangar2.
Fixes crash when entering "multiplayer" -> "player setup" menu with a skin name len > 16
Fixes "playermodels" cmd, which showed "(null)" as a final skin for every model
Enabled by default, can be disabled via s_reverb 0. Also by default
picks preset automatically out of 7 presets based on surrounding
size, this function can be disabled via s_reverb_preset_autopick 0.
Presets can be set manually via s_reverb_preset (0-113).
Cherrypick of ac7be51e94