Commit graph

3624 commits

Author SHA1 Message Date
David CARLIER
1ce09d7ef9 R_SetFrustum micro optimisation. 2023-06-16 13:06:05 +01:00
BjossiAlfreds
9ca5923082 T_Damage no longer modifies dir parameter 2023-06-10 18:19:37 +00:00
BjossiAlfreds
51bbb7da70 Fix for AI bug introduced by new makron jump code 2023-06-07 13:44:11 +00:00
Yamagi
4f04e7857a
Merge pull request #1016 from devnexen/netsocket_desc_leaks
network close descriptors on socket creation failure.
2023-06-05 19:16:23 +02:00
Yamagi
9212ded546
Merge pull request #1011 from devnexen/cl_setenv_overflow_fix
fix potential overflow on env vars settings.
2023-06-05 19:15:56 +02:00
Yamagi
0f696623f0
Merge pull request #1010 from BjossiAlfreds/makronjmp
Various fixes to makron jump sequence
2023-06-05 19:15:42 +02:00
Rykita
cd351a0602 Fixed vid_pauseonfocuslost, final. 2023-05-25 23:59:26 +02:00
Rykita
25333274c3
Merge pull request #1 from apartfromtime/Fix-pause/un-pause-on-window-focus-gain-or-lost-feature
Fix pause/un-pause on window focus gained or lost
Thank you: apartfromtime
2023-05-25 23:20:32 +02:00
apartfromtime
be1e6e1743 Fix pause/un-pause on window focus gained or lost
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.
2023-05-25 15:33:12 +10:00
Rykita
8cbbfaae9e Pause on Minimized/Focus Lost is now in the options menu 2023-05-24 16:42:36 +02:00
BjossiAlfreds
8d937b0a9c Various fixes to makron jump sequence 2023-05-21 16:43:07 +00:00
David CARLIER
c216eece9e network close descriptors on socket creation failure. 2023-05-21 15:24:28 +01:00
Daniel Gibson
218ac53ce9 GL3: Add hack to make lava glow, fix #1014
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.
2023-05-20 21:07:16 +02:00
Yamagi
51cdc80525 Fix game with older SDL versions.
The window `flags` must be returned always, otherwise there won't be
usable Window flags and the game doesn't start.
2023-05-20 16:26:02 +02:00
David CARLIER
07553f0980 fix potential overflow on env vars settings.
changing a bit Q_strlcpy flow as it can report wrong bytes copied
if src > buffer size.
2023-05-14 19:16:18 +01:00
Yamagi
5f03705c5d Update stb_image.h to v2.28. 2023-05-14 10:01:04 +02:00
Yamagi
dbc0fa12ec Update glad-gles3 to it's latest version. 2023-05-14 09:57:45 +02:00
Yamagi
83fd0d092e Update glad-gl3 to it's latest version. 2023-05-14 09:55:37 +02:00
Yamagi
a5560ff3a2 Implement high dpi awareness into the client and all renderers.
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.
2023-05-14 09:44:23 +02:00
Yamagi
e0dd7c9d00
Merge pull request #1008 from BjossiAlfreds/makrondeath-fix
Fixed despawning makron torso
2023-05-13 15:21:32 +02:00
BjossiAlfreds
f128c44e30 Fixed despawning makron torso 2023-05-09 18:37:15 +00:00
Yamagi
a241fd50e4
Merge pull request #999 from devnexen/gcc13_build_fixes
addressing few gcc 13 analyser warnings.
2023-05-08 21:16:55 +02:00
David Carlier
571f3f6fec addressing few gcc 13 analyser warnings. 2023-05-08 18:07:27 +01:00
Yamagi
5fcf2f8d3f
Merge pull request #1005 from BjossiAlfreds/makrondeath
Fixed ungibbable makron parts
2023-05-08 18:23:46 +02:00
Yamagi
040d17ef79
Merge pull request #1007 from BjossiAlfreds/parasitefoot
Fixed parasites ignoring g_monsterfootsteps
2023-05-08 18:16:30 +02:00
Yamagi
f74f61a76a
Merge pull request #1003 from BjossiAlfreds/intersight
Fixed monsters seeing players during intermissions
2023-05-08 18:08:48 +02:00
Yamagi
ff2206bf73
Merge pull request #997 from BjossiAlfreds/gladrange
Fixed stand-ground gladiators not attacking within a certain range
2023-05-08 18:07:24 +02:00
Yamagi
9816ff7712
Merge pull request #1004 from apartfromtime/ogg-pause-music-when-pause-game
Sound backend and ogg pause features
2023-05-08 18:06:22 +02:00
Yamagi
7370bfcde9
Merge pull request #998 from apartfromtime/master
Fix implicit declaration of SDL_GameControllerGetSensorDataRate avail…
2023-05-08 17:33:56 +02:00
BjossiAlfreds
3ea9d4e291 Fixed parasites ignoring g_monsterfootsteps 2023-05-07 15:15:28 +00:00
BjossiAlfreds
e720bc819d Fixed ungibbable makron parts 2023-05-03 13:51:48 +00:00
apartfromtime
bc5926be4f Sound backend and ogg pause features
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.
2023-04-29 13:27:38 +10:00
BjossiAlfreds
413781a334 Fixed monsters seeing players during intermissions 2023-04-25 00:02:32 +00:00
apartfromtime
0960984c91 Revert previous changes in 7d4cfd4acd
Implement @protocultors fix.
2023-04-23 17:52:45 +10:00
apartfromtime
7d4cfd4acd Fix implicit declaration of SDL_GameControllerGetSensorDataRate available since SDL 2.0.16 not 2.0.14 2023-04-23 14:31:53 +10:00
BjossiAlfreds
2582a23103 Fixed stand-ground gladiators not attacking within a certain range 2023-04-22 18:46:45 +00:00
Yamagi
22617d8812 Replace two more wcscat_s() overlooked in last commit. 2023-04-22 17:29:22 +02:00
Yamagi
df845e0f67 Avoid the use of wcscat_s() since it's unavailable under Win XP.
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.
2023-04-22 16:44:26 +02:00
Yamagi
f67b65c00a
Merge pull request #993 from devnexen/clang16_attr_fnptr
fix clang 16 build as C11 _NoReturn/noreturn attributes conflict.
2023-04-16 11:24:16 +02:00
Yamagi
cbe3ef4c76 Fix several whitespace errors introduced in the last merge. 2023-04-16 11:20:52 +02:00
Yamagi
51f3810fb7
Merge pull request #986 from apartfromtime/playback-features
Ogg Playback Features
2023-04-16 11:18:29 +02:00
Yamagi
a04809a66e Ensure that new empty console line are really empty.
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.
2023-04-16 10:26:07 +02:00
David CARLIER
5b895615a4 fix clang 16 build as C11 _NoReturn/noreturn attributes conflict.
And remove a handful of unused vars.
2023-04-16 08:19:33 +01:00
Yamagi
3a9b8de2ab Don't enforce a C standard in Makefile.
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...
2023-04-15 19:57:26 +02:00
Yamagi
11bea2a68b
Merge pull request #990 from protocultor/old_sdl_gyro_switch
Gyro aiming for Switch controllers with SDL < 2.0.14
2023-04-15 18:23:28 +02:00
Yamagi
eaab2cf11a
Merge pull request #992 from 0lvin/oggsizefix
Fix sound characteristics calculations
2023-04-15 18:15:28 +02:00
Jaime Moreira
9a18b39114 Simplified definition of NATIVE_SDL_GYRO
It is being used as a "boolean" anyway; the code only checks its
existence.
2023-04-14 18:16:16 -04:00
Denis Pauk
538aadb9dc Fix sound characteristics calculations
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
2023-04-14 18:22:12 +03:00
Jaime Moreira
61df6a74d5 Gyro aiming for Switch controllers on SDL < 2.0.14
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.
2023-03-28 23:06:34 -03:00
apartfromtime
f96deee197 Playback Features
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.
2023-03-26 14:43:28 +11:00