Commit graph

1875 commits

Author SHA1 Message Date
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
Robert Müller 668e6fb14e Use member variables for demo player snapshot data
Use member instead of static variables for demo player snapshot data. The static variables would otherwise cause issues when multiple demo players are playing at the same time, especially demo players used in background jobs for replay demo slicing. This hopefully closes #7068.
2023-10-14 10:51:45 +02:00
Robert Müller 3af7de307a Preserve demo type when slicing
Previously all sliced demos used type "client", even if the original demo had type "server". Now the type of the original demo is copied when slicing.
2023-10-13 22:11:49 +02:00
Robert Müller 9030c5b155 Refactor CDemoEditor, fix clang-tidy NOLINT
Use composition instead of inheritance for demo player listener to avoid temporarily storing a pointer to a local variable in a member variable.

Fix demo player file not being closed when demo recorder file cannot be opened during demo slicing.
2023-10-13 20:46:08 +02:00
Robert Müller a0b708a0b2 Assert that demo recording/playback are properly started/stopped
Add assertions to check that demo recording/playback is not started when already running.

Add assertions to check that demo recording/playback is stopped before the respective demo recorder/player is destroyed.
2023-10-13 20:45:22 +02:00
Robert Müller 543e63ee71 Use IO_MAX_PATH_LENGTH for demo recorder/player filenames 2023-10-13 20:45:07 +02:00
Robert Müller 7a624d7911 Ensure demo player listener is initialized
Using `SetListener` is optional.
2023-10-13 20:02:13 +02:00
Robert Müller a19c51f545 Remove unused CHUNKFLAG_BIGSIZE 2023-10-13 20:02:13 +02:00
furo f39792f330 Show correct max length in help text for MACRO_CONFIG_STR 2023-10-09 00:53:28 +02:00
Robert Müller 076a902684 Overhaul demo browser UI
Improve layout of demo browser buttons, search and checkbox. Use icons for most buttons. Decrease size of UI elements.

Move demo details from below the file browser to a side panel on the right, which is the same size as the server browser side panel. Use ellipsis to truncate the SHA256 instead of rendering only half of it with reduced font size. Show "map not included" instead of "0.00 KiB" for the map size of demos that don't include a map.

Remove the "Markers" column, as it is not very useful to see for all demos and sort by.

Closes #7275.
2023-10-06 21:46:13 +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 7acf2c1573 Add functions for reading/writing strings from/to datafile
Simplify the usage of datafile reader and writer by adding utility functions to read and write zero-terminated UTF-8 strings.

Improve validation of string data read from datafiles. It is ensure that string data is null-terminated, has no internal NUL-characters and is valid UTF-8.

Fix loading of external sounds in the editor. The wrong path variable was being used, so the sound files would not be loaded from correct folder.

Add tests for new datafile reader/writer functions.
2023-10-03 16:07:15 +02:00
Robert Müller 106b04ee79 Add assertion for Index argument of ReplaceData function 2023-10-03 15:58:58 +02:00
Robert Müller 4716791c6d Add missing IMap::FindItemIndex delegate function 2023-10-03 15:58:58 +02:00
Robert Müller 6a5752d71e Use bool instead of int for Swap parameter 2023-10-03 15:58:58 +02:00
Robert Müller e68caafc07 Consistently order CDataFileReader and IMap functions 2023-10-03 15:58:58 +02:00
Robert Müller 9096b089b9 Ensure current map is not corrupted when loading another fails
When `IMap::Load` fails, other components will continue to use the old map. However, if `IMap::Load` failed after the map was already successfully read with the datafile reader then other components kept their pointers to the old, invalid datafile reader items and data, causing random crashes in collision code. This is fixed by using a separate datafile reader to read the new map and only applying the datafile reader globally when loading was entirely successfully.

An error message is added for the case that a map has an unsupported version, which is currently the only case where a map can fail to load after the datafile was read successfully.

In particular, the block maps `blmapPepe`, `blmapV5` and `blmapDT-UPTU` did not have a version map item and were fixed separately.

Closes #7218. Regression from #5737.
2023-10-03 14:27:11 +02:00
Dennis Felsing c8401aa38f
Merge pull request #7271 from furo321/afk-optional
Make IsAfk attribute optional
2023-09-30 18:22:09 +00:00
furo 3b2389daa4 Make IsAfk attribute optional 2023-09-30 19:56:01 +02:00
Robert Müller dcff6d92f0 Add name for enum EClientScoreKind 2023-09-30 13:29:28 +02:00
Dennis Felsing 3e2893e638
Merge pull request #7182 from dobrykafe/pr-show-direction
Ability to show local keypresses only
2023-09-30 09:35:20 +00:00
Robert Müller 06948ddecd Remove remains of dbg_stress from server
Using `dbg_stress 1` on a server made clients always auto-join team 0 and nothing else, which is not useful on its own for stress testing.
2023-09-28 20:14:23 +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
Dennis Felsing 5d220e337c
Merge pull request #7244 from furo321/suicide-penalty
Remove unused config, `sv_suicide_penalty`
2023-09-23 22:17:43 +00:00
furo 436c977f7e Remove unused config, sv_suicide_penalty 2023-09-23 23:51:16 +02:00
Robert Müller 2d4bac8c0c Ensure strings in demo header are zero-terminated and valid UTF-8
Previously, if the demo header strings did not contain zero-termination, the client would render the strings and any following non-zero memory from the demo header.

Now, demos will not be loaded, if any string in the header is not zero-terminated or not valid UTF-8.
2023-09-23 22:14:34 +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
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
dobrykafe 7c710ddb96 add another value instead of new variable 2023-09-20 22:47:09 +02:00
Robert Müller 2973eee036 Refactor json parser usage in CServerInfo2::FromJsonRaw 2023-09-18 17:37:21 +02:00
Dennis Felsing e33b747a4c Increase password size limit from 32 to 128 2023-09-17 14:32:23 +02:00
dobrykafe 74567a1a62 ability to show local keypresses only 2023-09-15 20:34:23 +02:00
Robert Müller fe95919f63 Support longer lines being rendered in console
Don't truncate console lines at 255 bytes anymore. Especially lines containing many Unicode characters would be adversely affected by this limitation.

Instead, truncate console lines after 10 wrapped lines are rendered. Rendering too many lines at once currently breaks the console scrolling. Rendering an ellipsis is currently not possible when rendering text with a maximum line count.

Increase buffer sizes to handle long (esp. invalid) command inputs.

Closes #7132.
2023-09-06 19:16:00 +02:00
Robert Müller 1604784669 Improve Windows pipe (FIFO) support
Use `WaitForPipeDrain` to deterministically wait for the pipe to drain instead of using `Start-Sleep`.

Use `Dispose` instead of `Close` to properly flush and close the pipe stream.

Add error handling for connection timeout and I/O errors.

Handle `ERROR_BROKEN_PIPE` separately when peeking at pipe, as this happens when the pipe is disconnected immediately after connecting it or after reading the previous message.

Don't ignore `ERROR_BAD_PIPE` anymore, as the pipe should never be in a disconnected (i.e. bad) state at this point of the function.
2023-09-05 19:15:09 +02:00
Robert Müller 98b3fe460a Fix typo in internal name of cl_assets_entities config variable
The name used in config is unchanged.
2023-08-30 20:07:12 +02:00
Robert Müller 943f98dc92 Improve config variable descriptions, add missing descriptions 2023-08-30 20:07:11 +02:00
Robert Müller 1028cedee3 Remove dbg_hitch config variable
This config variable was only settable in the server console but only read in the client, so it was effectively unusable. It also has no use case right now.
2023-08-30 20:07:11 +02:00
Robert Müller 31a80c976b Remove gfx_finish config variable
This config variable does not have any use case right now and only causes the rendering to be slowed down.
2023-08-30 20:07:11 +02:00
Dennis Felsing 23ed630a4e
Merge pull request #7065 from heinrich5991/pr_ddnet_teehistorian_antibot
Allow antibot to record data into teehistorian
2023-08-25 15:08:35 +00:00
heinrich5991 84948adad1 Allow antibot to record data into teehistorian 2023-08-25 14:26:09 +02:00
heinrich5991 548f2f6021
Merge pull request #7058 from Robyt3/Demo-Player-Pause-Indicator
Show indicator when pausing/unpausing in demo player
2023-08-25 11:55:03 +00:00
Robert Müller ec0522d58f Show indicator when pausing/unpausing in demo player
Render a pause/play icon in the center of the screen when pausing/unpausing while the menu is not active.

The icon fades in and out over 0.5 seconds and slightly increases in size over that time.

When starting demo rendering with initial pause, the pause indicator is rendered continuous until playback is first started, to ensure that the initial pause state is communicated clearly to the user. The initial pause indicator is not included in the rendered demo, but pausing and unpausing later during demo rendering will cause it to be included in the video, same as other UI elements. Closes #7044.

The config variable `cl_demo_show_pause` (`0/1`, default `1`) is added to hide the pause indicator entirely, for example to render a demo with multiple pauses without the indicator.

The pause indicator and also the existing speed indicator are not rendered (anymore) while the menu is active, as the menu already contains this information.
2023-08-25 13:29:17 +02:00
heinrich5991 b739c18a86
Merge pull request #7056 from Robyt3/Base-Number-Format-Optimization
Add `str_from_int` function
2023-08-25 11:16:00 +00:00
heinrich5991 1f13a693a5
Merge pull request #6744 from Zwelf/pr-fix-teehistorian-mapchange
Fix JoinVer and Join teehistorian chunks missing in some conditions
2023-08-25 11:15:43 +00:00
Zwelf 3c2d8afff6 Create new teehistorian event for player rejoin 2023-08-25 00:42:54 +02:00
Robert Müller d2c9750c65 Add str_from_int function
Add more efficient function for formatting integer values as strings.

A benchmark shows that using this function is significantly faster than using `str_format`. It is faster by a factor of 220 with Clang 15.0 O2 (https://quick-bench.com/q/BlNoLnlyqxipf4jvsFTUxKMHDJU) and by a factor of 11 with GCC 12.2 O2 (https://quick-bench.com/q/Fxf9lDCTqXBF4pIa_IyZ5R0IqYg).

This increases FPS in the editor by ~25% when many numbers are rendered for switch/tele/speedup/tune layers or with "Show Info" being enabled.

The additional static analysis for `std::to_chars` revealed that the wrong size was used in `CHud` for `aScoreTeam[TEAM_RED]` and `aScoreTeam[TEAM_BLUE]`.

This requires incrementing the macOS deployment target from 10.13 to 10.15.
2023-08-24 20:54:17 +02:00
Dennis Felsing 55789819a3
Merge pull request #7026 from ChillerDragon/pr_auth_unused
NETMSG_AUTH_CHALLENGE is not used in 0.6 or 0.7
2023-08-22 09:59:58 +00:00
ChillerDragon 87640d7857 NETMSG_AUTH_CHALLENGE is not used in 0.6 or 0.7 2023-08-22 10:31:16 +02:00
Robert Müller bfe1175558 Save console output variables again, improve descriptions
As #6451 was partially reverted by #5434.
2023-08-19 10:53:47 +02:00