Commit graph

110 commits

Author SHA1 Message Date
Yamagi
53b738f77b
Merge pull request #1128 from protocultor/ref_gles1
OpenGL ES 1.0 renderer
2024-08-12 09:02:40 +02:00
Yamagi
8cc3361730 Hardcode the SDL audio driver (again) to directsound under Windows.
Windows defaults to `wassapi`, which is a sensible choice. But WASAPI
only guarantees 32 bit float samples, anything else only works if the
driver or something supports it and YQ2 requires 16 bit samples. That
can be worked around by having SDL recode the audio, but I don't want
such a invasive change right before a release.

Another part of #1132.
2024-08-08 18:43:03 +02:00
Yamagi
b3c47df0c8 Don't overwrite SDLs audio driver selection.
Hardcoding default driver for some of the supported platform is a
remnant of SDL 1.2 and hasn't been necessary since SDL 2.0 a long
time ago. In fact it has a high properbility to break things, SDL
could easily end up with a non working driver.

When `s_sdldriver` is set to the newly introduced value `auto` the
driver is selected by SDL. In all other cases the string is the
driver name which SDL will be forced to.

This doesn't fix existing configs. Since the OpenAL sound backend has
been the default for nearly 15 years and we haven't received bug reports
for some other problem with the SDL sound backend in the past, I'm half
sure that there are next to users out there. These can reset the cvar
by hand if necessary.

Closes #1132.
2024-08-07 12:04:54 +02:00
Jaime Moreira
26f578212a Deleted unused variable in R_RegenAllLightmaps()
Static arrays there have their dimensions swapped, they make more sense now.
Added important detail in gl1_lightmapcopies doc.
Also added doc for gl_polyblend, just because of its "popularity".
2024-07-28 12:14:17 -04:00
Jaime Moreira
b72c465214 GLES1 renderer: lightmap copies
Available in both GL1 and GLES1. Keep multiple copies of "the same"
lightmap on video memory; they are actually different, because they're
used in different frames. This is a workaround for the usage of
glTexSubImage2D() for dynamic lighting, since modifying textures used
recently causes slowdown in embedded/mobile devices.
Controlled by gl1_lightmapcopies cvar; default in GL1 is `0`, while
in GLES1 is `1`.
2024-07-27 23:22:41 -04:00
Jaime Moreira
0596d23e4c GLES1 renderer: discard framebuffer
Available only on GLES1, allows to use a "performance hint" to the
GPU to discard the contents of depth and stencil buffers after each
frame. Some hardware might want to reuse them, but Quake 2 doesn't
work that way.
Controlled by gl1_discardfb cvar, default `1`.
2024-07-27 23:18:06 -04:00
Jaime Moreira
03227f1ed6 OpenGL ES 1.0 refresher (GLES1 for friends)
Variant of GL1, meant for embedded/mobile devices only.
Build it with "make with_gles1".
For Windows, you'll need MSYS2 and a decent ANGLE implementation
(probably not worth the trouble).
Building with CMake only works in Linux, so it has been commented out.
2024-07-27 23:15:12 -04:00
Yamagi
eef7db91d8
Merge pull request #1124 from protocultor/gl1_buffer
Grouped draw calls for improved performance with GL1
2024-07-20 09:24:23 +02:00
Yamagi
4b9b8e14a4 Switch g_quick_weap to 1 by default.
It's a nice to have convenience feature that most players will never
notice. Die hard traditionalists can switch it off.
2024-07-15 21:42:15 +02:00
Jaime Moreira
15a1ebdd74 Deleted gl1_biglightmaps
glTexSubImage2D() calls are very slow, and are even slower when
the texture is big. Dynamic lighting changes are small compared
to the huge 512x512 size of the lightmap this option provided,
so it was detrimental to performance.
Original logic remains underneath if there's a need of a comeback.
2024-07-15 12:45:15 -04:00
Yamagi
1a1b32961b Refactor the download filter.
The first try didn't take into account that an evil server could
override the filter list by sending a stuff command. Fix this by
hardcoding the filters for .dll, .dylib and .so. Make sure that the
filters are always applied, either when the download is requested
through the `download` command or because game data is missing.

This is just a poor mans fix, trying to rule out an obvious way to
inject code into the client.
2024-06-24 11:56:11 +02:00
Yamagi
468f90ad48 Implement a simple download filter.
`cl_nodownload_list` is a whitespace seperated list of strings, files
containing one of these strings in their name are never downloaded. Set
to `.dll .dylib .so` by default to prevent downloading libraries which
can be injected into client.

Closes #1114.
2024-06-22 16:56:42 +02:00
Yamagi
d5c7845271 Fix formating of the cvarlist. 2024-06-22 16:50:54 +02:00
Jaime Moreira
c4271848df gl1_multitexture doc update 2024-06-04 16:21:10 -04:00
Jaime Moreira
24b03b61f8 Gyro tightening
A practical way to avoid a noisy gyro signal, or shaky hands.
Unlike a deadzone, inputs below the threshold are "squeezed towards
zero", so they are not completely ignored. Source:
http://gyrowiki.jibbsmart.com/blog:good-gyro-controls-part-1:the-gyro-is-a-mouse#toc9
2024-06-04 15:48:42 -04:00
Jaime Moreira
0f307cc9c1 GL1 scrap/atlas configurable size
Controlled by gl1_biglightmaps cvar, works like new lightmaps.
Max size is 384x384; a bigger size is not justified.
Added a transparent border so colors from one picture don't bleed
into the next.
2024-05-11 18:20:13 -04:00
Jaime Moreira
81fd2c1027 Increased lightmap size in GL1
Controlled by new cvar, gl1_biglightmaps.
Size is now up to 512x512, for a max quantity of 8 lightmaps.
Should reduce rebinding of them, and reduce the number of calls
to glTexSubImage2D(), although it may increase data transfer on
each call.
2024-05-11 18:18:28 -04:00
Jaime Moreira
86528d7812 GL1 multitexture, first version
Unlike the old, buggy one, this implementation follows the
texture chain, just like the standard execution path. It also
avoids doing the lightmap chains, since it has already done it
in the second TMU; there's no duplicated work for lightmaps.
No errors appear in the lava on the "boss1" map either.
It's still slow when having an overdraw of dynamic lights.
Further work is needed.
2024-04-23 12:25:38 -04:00
Yamagi
8a9e31ab86 Clearify vid_gamma in the GL1 renderer. 2024-04-07 11:01:45 +02:00
Yamagi
e61d9444c9 Bump default renderer to GL3...
...and alter the render finding and fallback sequences to include GLES3
as the first fallback. This should have been done years ago, when GL3
became the clear better option above GL1.
2024-04-07 11:01:45 +02:00
Yamagi
af82cfe978 Switch the default for vid_highdpiaware to 1 when build against SDL3.
With SDL3 the high dpi support is in much better shape than with SDL2.
And for Wayland the experience on high dpi displays is generally better
when the application is high dpi aware.
2024-04-07 11:01:45 +02:00
BjossiAlfreds
c134d0127d Added cvar cl_laseralpha and documentation in cvarlist 2024-03-31 10:45:31 +00:00
Feels Duck Man
086084b507 Added documentation for 'cl_showspeed' in 040_cvarlist.md 2024-03-18 21:21:59 -05:00
Jaime Moreira
fb46007bc3 Fixed gl1_overbrightbits limiter, for real now
Allowed values are 0, 1, 2 and 4 only.
Updated documentation, again.
2024-01-06 13:32:48 -03:00
Jaime Moreira
9eca08fd92 Faster "weapprev" and "weapnext" behavior
These commands can now "count" how many times they have been called,
similar to how "cycleweap" operates after #865.
This allows for changing to different weapons, instead of just going
"one down" or "one up".
New cvar "g_quick_swap" allows to enable/disable this behavior.
2023-12-07 23:57:19 -03:00
Jaime Moreira
fa218c9f4c Fixed gl1_overbrightbits limiter
Allows values between 0 and 4. Updated documentation.
2023-10-18 20:35:51 -03:00
Yamagi
fe715f3d76 Document vid_pauseonfocuslost. 2023-09-16 16:36:19 +02:00
Jaime Moreira
9821c4b0a2 Show correct replacement for gl_lightmap cvar
Typos corrected
2023-08-26 19:18:24 -04:00
Jaime Moreira
a94e9dca81 Snappier "g_swap_speed" behaviour
Player is no longer forced to go through the last frame of activation
or deactivation of a weapon before changing its state.
2023-06-29 11:14:58 -04:00
Jaime Moreira
c5e2d51fd7 Cheat cvar "g_swap_speed" implemented
Allows to skip frames of "putting down weapon" and
"raising weapon" animations, speeding them up.
2023-06-28 15:28:40 -04: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
David Carlier
f394209c75 introduces a new cl_unpaused_scvis cvar to unpause the cli. 2023-01-08 10:14:09 +00:00
Yamagi
6c18d819d3
Merge pull request #947 from devnexen/sound_pause_option
Introduces new cvar cl_audiopaused to control if the audio loop
2023-01-08 10:45:55 +01:00
David Carlier
7616880b96 Introduces new cvar cl_audiopaused to control if the audio loop
ought to go on or not when the game pauses.
2023-01-07 20:16:24 +00:00
Denis Pauk
02358e2457 Add joy_haptic_filter description 2023-01-07 21:47:21 +02:00
Denis Pauk
633c50177a Haptic: Fix comments 2023-01-07 21:30:21 +02:00
Denis Pauk
4e36b66654 Add joy_haptic_distance cvar.
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.
2023-01-07 21:30:21 +02:00
Denis Pauk
e1aed62201 Haptic code cleanup 2023-01-07 21:30:21 +02:00
Denis Pauk
66523aa98e Restore haptic feedback functionality.
Rumble feedback will be default.
Checked in both modes with:
* LibSDL2: 2.24.2+dfsg-1 (debian testing)
* Microntek USB Joystick (DragonRise hid-dr.ko)
2023-01-07 21:30:21 +02:00
Yamagi
f03906e91f Explain were to get the optional monster footsteps assets from. 2022-10-09 10:46:49 +02:00
Yamagi
294c4d1175
Merge pull request #896 from protocultor/gyro_invert
Options to invert gyro axes
2022-10-08 15:08:14 +02:00
Jaime Moreira
9de55c603d Classic cvar 'in_initjoy' resurrected
Added myself to credits
2022-09-19 11:36:23 -03:00
Denis Pauk
61f4540617 Fix documentation for model preview.
All default players models have 84-94 frames for salute.
So value will be same for `cyborg`/`female`/`male`.
2022-09-18 12:39:50 +03:00
Denis Pauk
3b583a7143 Bumb game version value
New code has exported monster footsteps sounds function.

Fixes typos.
2022-09-18 12:39:50 +03:00
Denis Pauk
93c6c76b0e sound: cleanup reverb code 2022-09-18 12:39:50 +03:00
SkacikPL
66f1bc9a33 Add simple sound occusion based on YQ2 AL EFX code
Can be disabled via s_occlusion 0, strength is modified
via s_occlusion_strength (higher values are actually less occlusion).

Cherrypick of b557494e14
2022-09-18 12:39:50 +03:00
SkacikPL
cfb86acc81 game: Implement monster footsteps.
Better tracking of enemies complementing the audio changes.

Cherrypick of 74edb966a2
2022-09-18 12:39:50 +03:00
Yamagi
1053b5dfb1
Merge pull request #871 from 0lvin/new_commands
Add new cheats spawn commands
2022-09-17 17:17:02 +02:00
Denis Pauk
5cddd2110c client: add multiplayer model preview animation 2022-09-04 23:40:55 +03:00
Jaime Moreira
c6dd713c89 Smooth rotation for Flick Stick
Added cvar to change maximum rotation angle that will be smoothed
2022-08-24 19:37:25 -04:00