Commit graph

3539 commits

Author SHA1 Message Date
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
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
Daniel Gibson
c2d80c64ee Fix crash in DDays "wake" map, #978
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
2023-03-25 19:18:35 +01:00
Yamagi
373164bebc
Merge pull request #980 from devnexen/keyboard_warning_build_fix
console fix warning build.
2023-03-25 17:10:06 +01:00
David CARLIER
038848b246 console fix warning build. 2023-03-17 17:17:32 +00:00
Yamagi
6faa03a59d
Merge pull request #977 from devnexen/curl_client_type_fix
CURL client fix on error with CURLMcode.
2023-03-11 20:40:13 +01:00
Yamagi
e91851a939
Merge pull request #975 from devnexen/cmake_build_fox
cmake build fix adding missing compilation unit.
2023-03-11 20:39:56 +01:00
David CARLIER
5adf5175c4 CURL client fix on error with CURLMcode. 2023-03-11 15:02:59 +00:00
David Carlier
7775257121 cmake build fix adding missing compilation unit. 2023-02-16 19:35:27 +00:00
Yamagi
3fe9630ed7
Merge pull request #972 from 0lvin/reverb_fix
openal: Fix reverb slot configuration
2023-02-06 18:46:31 +01:00
Denis Pauk
6c9c81e2f7 openal: Fix reverb slot configuration 2023-02-05 16:19:38 +02:00
Yamagi
74bb325deb
Merge pull request #970 from devnexen/silent_analyzers
silencing static analysis warnings.
2023-02-04 17:42:37 +01:00
Yamagi
6c6aa62032
Merge pull request #968 from devnexen/riscv_build_fix
cpu pause instruction for RISV-64 compatible gcc/clang.
2023-02-04 17:41:09 +01:00
Daniel Gibson
d3f748c03a Fix special case in filesystem when game is reset to baseq2, #969
When running a mod/addon and then switching back to baseq2,
FS_BuildGameSpecificSearchPath() is called and sets fs_gamedir
(amongst other things). Unfortunately it used fs_baseSearchPaths->path
to set it, and in the -portable case, the top base search path is
pak2.pak, i.e. not a normal directory, so fs_baseSearchPaths->path is ""
and fs_gamedir is set to "" => later Sys_Mkdir(fs_gamedir) fails.

Now fs_gamedir is set to the correct directory, based on fs_rawPath
2023-02-04 17:38:35 +01:00
David Carlier
2e51a9f72f silencing static analysis warnings. 2023-01-31 06:47:04 +00:00
David Carlier
a5ee9c9d4f cpu pause instruction for RISV-64 compatible gcc/clang. 2023-01-22 21:00:04 +00:00
Yamagi
2e939b10e9
Merge pull request #932 from 0lvin/shared_models_logic
Shared models logic
2023-01-21 18:07:54 +01:00
Denis Pauk
16395a15d9 Fix m32 load code 2023-01-21 18:31:18 +02:00
Denis Pauk
0cd2eed28b Share R_CullBox and R_SetFrustum 2023-01-21 18:31:16 +02:00
Denis Pauk
32ab1e1815 Share R_MarkLights 2023-01-21 18:24:55 +02:00
Denis Pauk
d326b1be51 Share R_AreaVisible 2023-01-21 18:24:55 +02:00
Denis Pauk
c17210b34a Share R_TextureAnimation 2023-01-21 18:24:55 +02:00
Denis Pauk
42bfb2014c Share Mod_PointInLeaf 2023-01-21 18:24:55 +02:00
Denis Pauk
442fe10f27 Share Mod_Load* functions 2023-01-21 18:24:55 +02:00
Denis Pauk
4463e1fcd7 Share mnode_t and mleaf_t struct between renders. 2023-01-21 18:24:55 +02:00
Yamagi
54949d59ce
Merge pull request #960 from DanielGibson/cmake-msvc
Fix build with VisualC++'s internal CMake
2023-01-21 16:55:46 +01:00
Yamagi
6566a2ae7d Handle case that ResizeSTB() failed.
This unlikely, however the compiler printed a warning that `image` may
be used uninitialized.
2023-01-21 16:43:27 +01:00
Yamagi
e17d4f5dc0 Solve warning regarding deprecated curl macros.
These are deprecated since curl 7.31 and 7.50. Even Debian Stretch
(oldoldstable) ships with 7.52.
2023-01-21 16:31:02 +01:00
Yamagi
548b7ff37f Implement gl_polyblend for GL3.
Closes #965.
2023-01-21 16:24:02 +01:00
Yamagi
c5c2af0320 Rename gl1_polyblend to gl_polyblend.
An upcoming commit will implement it for GL3.
2023-01-21 16:19:18 +01:00
Yamagi
c48ff63b50
Merge pull request #957 from SirYodaJedi/master
Change icon color to teal
2023-01-21 15:24:59 +01:00
Yamagi
fac2313774
Merge pull request #955 from devnexen/fix_windows_hidden
introduces a new cl_unpaused_scvis cvar to unpause the cli.
2023-01-21 15:16:14 +01:00
Yamagi
a3d45fef19
Merge pull request #948 from HAMM3REXTREME/patch-1
Seperated mapfixes text from monster footstep text
2023-01-21 15:15:28 +01:00
Daniel Gibson
651503d48a Fix build with VisualC++'s internal CMake
.. which doesn't set CMAKE_GENERATOR_PLATFORM

so set YQ2ARCH in src/common/header/common.h when building with MSVC
2023-01-16 06:02:26 +01:00
HAMM3REXTREME
b6e5518049
Update 020_installation.md 2023-01-15 01:24:54 -05:00
SirYodaJedi
8163324b8f Quake2.ico - change to teal to improve visibility 2023-01-09 15:02:40 -05:00
SirYodaJedi
712600c931 Quake2.png - change to teal to improve visibility 2023-01-09 14:59:08 -05:00