Commit graph

2601 commits

Author SHA1 Message Date
Robert Müller 59b5fd2793 Fix graphs initially rendering incorrect values
Ensure only valid graph entries are used to render curve line segments.
2023-10-17 20:27:31 +02:00
Robert Müller 11423b88b1 Use full graph width for rendering curve
Previously, roughly one percent of the graph width was not used for the curve values.
2023-10-17 20:25:35 +02:00
Robert Müller 1a01d7657f Remove unused m_Graph member of CSmoothTime 2023-10-17 20:25:32 +02:00
Robert Müller e187bda620 Use bool instead of int 2023-10-17 20:24:45 +02:00
Robert Müller d92b7b5c5f Add enum for CSmoothTime adjust direction 2023-10-17 20:24:38 +02:00
Robert Müller fb96217147 Fix first value in graphs being incorrect
As the index was incremented before setting the value, the value at index 0 was not set correctly until the ringbuffer wraps around.
2023-10-17 20:23:35 +02:00
Robert Müller dc7fa1fbb2 Use ColorRGBA for CGraph entry color 2023-10-17 20:23:16 +02:00
Robert Müller 912355f9ec Move CSmoothTime class to separate compilation unit 2023-10-17 20:23:07 +02:00
Robert Müller ee51cac9e6 Move CGraph class to separate compilation unit 2023-10-17 20:22:48 +02:00
Robert Müller ed92a9e8c7 Remove redundant checks for missing SHA256 when recording demo
The SHA256 was effectively not optional anymore when recording demos, as it and the SHA256 extension UUID were always written to the demo file without checking for `nullptr`. Therefore the SHA256 is now passed by const reference instead of by pointer and redundant checks for `nullptr` are removed.
2023-10-16 21:53:37 +02:00
Dennis Felsing 042a04d610
Merge pull request #7353 from Robyt3/Engine-Jobpool-Refactoring
Minor refactoring of engine jobpool
2023-10-15 22:29:33 +00:00
Robert Müller ba5a974353 Increase jobpool thread count based on hardware concurrency
The client/server jobpools were previously only using a fixed number of 2 threads. Now the pools use `2 * hardware-concurrency + 2` threads, which should provide better performance overall, as we expect threads to often wait on I/O.
2023-10-15 22:10:49 +02:00
Robert Müller 9cbbc0aca6 Replace static variables in MouseRelative with member variable
Avoid using a global variable for last mouse position on Android.
2023-10-15 20:36:59 +02:00
Robert Müller d00283e885 Enable use of video recording for each demo player individually
Previously all demo players checked `IVideo::Current` to render a video, which would cause issues when rendering a demo while a demo slicing background job is running. Now video rendering can be toggled for each demo player individually and is only enabled for the main demo player.
2023-10-14 10:52:24 +02:00
heinrich5991 5fbf02ae91
Merge pull request #7333 from Robyt3/Clang-Tidy-Remove-Nolint
Remove obsolete clang-tidy `NOLINT` comments
2023-10-11 15:49:46 +00:00
Robert Müller aa03aa0f60 Remove obsolete clang-tidy NOLINT comments
The TODO in the `Dilate` function is removed, as the code already appears to be safe without additional checks. The variable `k` is at most `(w * h - 1) * BPP`, as `ix` and `iy` are clamped to maximum `w - 1` and `h - 1` respectively. Because `p < BPP - 1` the index `k + p` is therefore always valid for the buffers. (The caller must ensure that the source and destination buffers are of size `w * h * BPP`.)
2023-10-11 17:22:59 +02:00
Dennis Felsing 60fa51ff13
Merge pull request #7309 from infclass/kaffeine/merge-client-data-structs
Extract client 'six' data types and use them for 'seven' data
2023-10-10 21:55:55 +00:00
Dennis Felsing 1f5a764cf5 Make sure notification object exists 2023-10-08 14:01:02 +02:00
Robert Müller d4fed2360e
Merge pull request #7208 from dobrykafe/pr-editor-toolbar-sounds
Enhance editor toolbar sounds
2023-10-08 09:06:15 +00:00
dobrykafe 8adbbc433c fix requested changes 2023-10-07 14:49:51 +02:00
Alexander Akulich b6470e5a43 Use client 'six' data structs for client 'seven' data 2023-10-06 18:14:38 +03:00
dobrykafe 6e2ddfbeaf use nullptr instead of 0, add missing return statement 2023-10-06 17:09:20 +02:00
dobrykafe ca517f27b8 enhance editor toolbar sounds 2023-10-06 17:09:19 +02:00
Robert Müller fb7669ebb0 Fix clang-tidy modernize-use-override 2023-10-06 14:06:52 +02:00
Robert Müller b81fb37f82 Fix clang-tidy modernize-use-emplace 2023-10-06 14:06:20 +02:00
Robert Müller 6f1e08b6f4 Encapsulate/move IClient member variables 2023-10-03 17:56:17 +02:00
Robert Müller b1d90aaaf2 Store number of filtered players when filtering
Only update total number of filtered players when the filter is updated instead of calculating it every frame.
2023-10-01 20:53:29 +02:00
Dennis Felsing e0d906d9e1
Merge pull request #7272 from furo321/afk-optional2
Don't run `GET_INT` on afk attribute in `ProcessServerInfo`
2023-09-30 20:43:37 +00:00
furo a3064ae105 Don't run GET_INT on afk attribute in ProcessServerInfo 2023-09-30 20:51:20 +02:00
Robert Müller cf35594fa4 Extract UpdateServerFriends function, cache friends on server
Calculate the number of friends on each server when refreshing the friend state of the server info instead of every time the server entry is rendered.
2023-09-30 13:32:36 +02:00
Robert Müller 7e8442d394 Move and rename UpdateFilteredPlayers function, mark as const 2023-09-30 13:29:28 +02:00
Robert Müller 28d4451057 Add local variable Info to reduce duplicate code 2023-09-30 13:29:28 +02:00
Robert Müller 034962ae24 Add enum ERankState to replace magic numbers 2023-09-30 13:29:28 +02:00
Robert Müller 721a55c603 Remove game menus includes in engine
Use config manager to reset `ui_page` to the default, instead of using `CMenus::PAGE_DDNET` directly (which is the default).

Check current type of serverbrowser instead of checking the current `ui_page` against `CMenus::PAGE_DDNET` and `CMenus::PAGE_KOG`.
2023-09-30 13:29:28 +02:00
Robert Müller 6753e37772 Move function definitions to remove and organize includes 2023-09-30 13:29:27 +02:00
Robert Müller e78305e1cd Remove unused m_aFilter(Gametype)String variables 2023-09-30 13:29:27 +02:00
Robert Müller c64ec0f677 Limit effects of dbg_stress to features useful for debugging
Using `dbg_stress 1` now only does the following (in debug build):

- Randomly send inputs.
- Randomly send chat messages.
- Randomly connect/disconnect to server configured with `dbg_stress_server` (`localhost` by default).

Previously it also did the following, which is not useful for this debugging feature and only complicates the code unnecessarily:

- Cause images and sounds not to be loaded.
- Render only every tenth frame.
- Always use inactive graphics refresh rate.
2023-09-28 20:14:54 +02:00
Robert Müller 247ce38094 Remove unused variables m_RenderFrameTimeLow/High 2023-09-28 20:12:55 +02:00
Robert Müller 74192b9051 Add CSnapshot::EmptySnapshot, mark pointer arguments as const
Instead of keeping track of a permanently empty `CSnapshot` object in client and server separately, add `CSnapshot::EmptySnapshot` to access a singleton empty `CSnapshot`.

Mark pointer parameters of snapshot functions as `const` when possible.
2023-09-26 20:13:27 +02:00
Jupeyy 958676ae84
Merge pull request #7251 from Robyt3/Graphics-Texture-Index-DoubleFree-Assertion
Add assertion when double-freeing texture index, ensure OpenGL texture vectors are large enough
2023-09-25 18:51:04 +00:00
furo 25101d2cb0 Add missing descriptions of commands. 2023-09-24 23:21:10 +02:00
Robert Müller 96a68455ca Ensure OpenGL texture vectors are large enough
In the unlikely case that the wanted texture slot is larger than twice the size of the original texture vector.
2023-09-24 22:27:16 +02:00
Robert Müller 99cee23de4 Add assertion when double-freeing texture index
Simplify the handling of free texture indices by using `-1` only for indices which are currently in use, whereas the size of the vector is now used to indicate the last free index. Otherwise the assertions incorrectly detect the last texture index always being in use because `-1` was used for both states.
2023-09-24 22:24:51 +02:00
VoxelDoesCode c4d325e09b Show if your friend is AFK through friends list
resolve mege conflict

AFK -> Afk (for consistency)
2023-09-23 00:54:13 +02:00
Dennis Felsing c042835c1d
Merge pull request #7234 from Robyt3/Input-PumpEvents
Fix double-click handling with `gfx_asyncrender_old 0`
2023-09-22 15:38:17 +00:00
Robert Müller 98bfed7859 Fix double-click handling with gfx_asyncrender_old 0
We need to call `SDL_PumpEvents()` to ensure that we have the latest keyboard, mouse and joystick state before we use it.

See:
- https://wiki.libsdl.org/SDL2/SDL_GetKeyboardState
- https://wiki.libsdl.org/SDL3/SDL_GetMouseState#code-examples

Closes #7052.
2023-09-22 17:09:39 +02:00
Robert Müller b9951dd411 Refactor and reorder RateConvert, DecodeOpus, DecodeWV
Pass sample by reference instead of by index, as the functions are only used internally and a valid sample is assured.
2023-09-21 23:52:44 +02:00
Robert Müller 7fe854d861 Reduce indentation, rename variables in Mix function 2023-09-21 23:52:40 +02:00
Robert Müller 07e18ebecb Replace most global variables in engine sound with member variables
Most variables used in the sound engine were static globals, as they are used in the static sound mixing function. The global variables are replaced by member variables, by passing the sound interface as user-data for the SDL mixing callback. The `Mix` function is made a public member function of `ISound` instead of being exposed using `ISoundMixFunc GetSoundMixFunc()`.

This allows to remove the direct dependency of the engine sound on the engine video, by instead passing the sound mixing function as a lambda to the engine video in the engine client.

The old WavPack reader function interface does support passing a user-data pointer to the callback function, so global variables are still used here.
2023-09-21 23:52:13 +02:00
Robert Müller a2de08a8db Add UpdateVolume function, remove unnecessary lock usage
Using the lock is not necessary, as the volume is already an atomic variable.
2023-09-21 23:44:59 +02:00