Commit graph

1077 commits

Author SHA1 Message Date
Robert Müller f1e8d4bae3 Remove length limitation when packing server/rcon password
There is no need to limit the length of server password, rcon username, rcon password and rcon commands when packing them into their respective messages. The source buffers for these strings are already limited in length and the message packer ensures that the maximum packet size is not exceeded.
2023-10-24 20:10:42 +02:00
Robert Müller bade6f78fb Reduce duplicate code for sending messages for dummy
Add parameter `int Conn` to `SendInfo` and `SendReady` functions and use existing `SendEnterGame` function to reduce duplicate code for sending the same messages for main and dummy connections.
2023-10-24 20:10:18 +02:00
Robert Müller fec7e89b00
Merge pull request #7356 from dobrykafe/pr-editor-stop-sound-preview
Editor: stop/pause sound previews
2023-10-23 16:52:32 +00:00
Robert Müller 0e4f174f78 Check for all file errors in demo player, show demo error popup
Handle the return values of all uses of the `io_read`, `io_skip` and `io_tell` functions in `CDemoPlayer`, to handle truncated demo files and other unexpected file reading and seeking errors during demo playback.

Show more detailed error message popups when demos cannot be loaded due to errors and when demo playback is stopped unexpectedly due to errors. Previously, only a generic message "Error loading demo" was shown when loading failed and no error message was shown when demo playback is stopped due to errors.
2023-10-19 21:48:04 +02:00
dobrykafe aafee689ca stop/pause sound previews 2023-10-18 13:27:31 +02:00
Robert Müller d92b7b5c5f Add enum for CSmoothTime adjust direction 2023-10-17 20:24:38 +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
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 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 b81fb37f82 Fix clang-tidy modernize-use-emplace 2023-10-06 14:06:20 +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 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 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
furo 25101d2cb0 Add missing descriptions of commands. 2023-09-24 23:21:10 +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
furo 597350010f Add console chain for screen resolution commands. 2023-09-20 11:01:43 +02:00
Dennis Felsing e33b747a4c Increase password size limit from 32 to 128 2023-09-17 14:32:23 +02:00
heinrich5991 d2a12e01c1
Merge pull request #7126 from Robyt3/Graphics-Format-PixelSize
Add `CImageInfo::PixelSize` function, use `enum EImageFormat`
2023-09-06 09:57:59 +00:00
Harri Nieminen 4d9ff1d904 Fix typos
Found by codespell
2023-09-05 22:32:09 +03:00
Robert Müller dde45f7a40 Add CImageInfo::PixelSize function, use enum EImageFormat
Use `enum EImageFormat` type for image format literals and variables.

Add `PixelSize` function to get the number of bytes/color channels per pixel for a specified image format.

Remove unused store format argument of texture loading functions. All textures are automatically being stored as RGBA, so the argument was unused. Also remove the therefore unused `FORMAT_AUTO`.

Rename variables consistently to `PixelSize` and use `size_t`, instead of mixing different names like `BPP` and `ColorChannelCount`.

Validate image format loaded from maps using `CImageInfo::ImageFormatFromInt`. Add `FORMAT_ERROR` to represent invalid formats.

Remove redundant `PixelSize` parameter from graphics backends and commands, which can be derived from the texture format.

Fix memory leak when RGB image data is being converted to RGBA format when saving map in editor.
2023-09-03 20:40:28 +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 95b1c7dc2b Hide client is not online log message except when using record
The log message is otherwise shown multiple times when starting the client.

Now it's only shown when the `record` command is used manually, i.e. not for automatically recorded demos anymore.
2023-08-29 22:05:16 +02:00
dobrykafe cb29ad2b4f dont switch to editor if loading fails 2023-08-26 22:13:13 +02:00
dobrykafe 5e923adcc9 fix map drag and drop 2023-08-26 18:14:13 +02:00
Alexander Akulich 29688fb499 Remove cl_video_pause_on_start; reset the pause option on popup opened 2023-08-19 13:51:38 +03:00
Robert Müller 7168fb15d2 Move OnWindowResize listener to engine, handle editor
Register the `OnWindowResize` listener in the engine client instead of the game client and properly dispatch the event also to the editor, so text containers in the editor are cleared when the window is resized.

Closes #7018.
2023-08-15 20:17:27 +02:00
Robert Müller 5567c56d3a Reorder CClient interface pointers alphabetically 2023-08-15 19:47:52 +02:00
Robert Müller b98d519744 Use textrender for graphs, refactor CGraph::Render
Use textrender for rendering debug graph labels instead of using the debugging font and quad text.
2023-08-08 20:31:47 +02:00
Robert Müller be83d44470 Refactor CClient::DebugRender
Fix names of static variables. Remove dead code.
2023-08-08 20:31:47 +02:00
Edgar 8c49c2ea4b
Merge pull request #6952 from Robyt3/TextRender-Font-Index-File
Add font index, support font family variants depending on language
2023-08-05 15:49:12 +00:00
heinrich5991 8fc5549306
Merge pull request #6876 from ChillerDragon/pr_new_connection_string
Support master server address format in client
2023-08-05 08:49:12 +00:00
ChillerDragon f701e2eb16 Support master server address format in client
This still works

	$ ./DDNet "connect 127.0.0.1"

But now also this works

	$ ./DDNet "connect tw-0.6+udp://ger10.ddnet.org:8303"
	2023-07-16 14:07:50 I engine: running on unix-linux-amd64
	2023-07-16 14:07:50 I client: starting...
	2023-07-16 14:07:50 I client: version 17.1.1 on linux amd64
	2023-07-16 14:07:50 I client: git revision hash: 7f100e2620
	2023-07-16 14:07:50 I client: connecting to 'tw-0.6+udp://ger10.ddnet.org:8303'
	2023-07-16 14:07:50 I host_lookup: host='ger10.ddnet.org' port=8303 3
	2023-07-16 14:07:51 I client: connected, sending info
2023-08-04 12:32:02 +02:00
heinrich5991 26cd03bca1
Merge pull request #6914 from ChillerDragon/pr_redirect
Allow server to redirect clients
2023-08-03 09:19:26 +00:00
Robert Müller d642abd722 Add font index, support font family variants depending on language
Add `fonts/index.json` which specifies:

- List of all font files that should be loaded (filenames).
- Default font (specified by family name or by family and style name).
- Font variants for different languages, using the name of the language file as key.
- Fallback fonts.
- Icon font.

There are characters (e.g. all in `刃直海角骨入`) that look different depending on the language of the content being Japanese, Simplified Chinese, Traditional Chinese and Hangul, because Unicode uses the same codepoint for characters regardless of the language. To render these characters correctly, the active variant font is switched depending on the selected language.

The `ITextRender` interface is changed so the current language variant can be set using `SetFontLanguageVariant` and the default and icon fonts can be toggled using `SetFontPreset`. The class `CFont` is removed entirely.

The text render is restructured: The font faces and font atlas are now managed by a separate class `CGlyphMap` like on upstream. As the text fill and outline textures always have the same size, the texture skyline only needs to be stored once and free positions in the atlas only need to be calculated once for each glyph instead of separately for the fill and outline textures.

The font files and their licenses are also updated:

- Update Source Han Sans to version 2.001.
- Update Glow Sans Japanese Compressed to version 0.93.
- Update Deja Vu Sans to version 2.37.
- Update Font Awesome icons font to March 2023 version.

Closes #6881.
2023-08-01 19:30:25 +02:00
ChillerDragon e3afe0dba4 Allow server to redirect clients
This is a preperation for #6754 (redirect players on map vote)
And an implementation of #5662 (redirect players)
2023-07-27 11:30:11 +02:00
heinrich5991 4f103d5a4c Revert "Allow server to redirect clients"
Discussion wasn't finished:
https://github.com/ddnet/ddnet/pull/6757#issuecomment-1648565562.

This reverts commit 9d2f4318d5.
2023-07-24 22:51:27 +02:00
heinrich5991 85566fbe92 Add separate log levels for each output
`stdout_output_level` for printing to stdout, `console_output_level` for
printing to local console and remote console and `loglevel` for the log
file.

Keep the old log level filters 0 for info and more severe, 1 for debug
and more severe and 2 for trace and more severe, introducing -1 for
warn, and -2 for error. -3 will show no log messages at all.
2023-07-24 22:43:05 +02:00
heinrich5991 e432dbb750
Merge pull request #6757 from ChillerDragon/pr_redirect
Allow server to redirect clients
2023-07-24 20:21:21 +00:00
Dennis Felsing 265eb69284 Destroy engine before graphics (fixes #6857) 2023-07-15 10:52:04 +00:00
Robert Müller 43109bec3c Show message in editor when player is moved ingame
Show a short message below the existing chat mentions message that is shown in the top left area of the editor above the layers/images/sounds button when the player character is moved ingame while the editor is open. The messages are cleared when the editor is activated and when the client is disconnected.

Closes #1993.
2023-07-11 18:19:27 +02:00
Alexander Akulich 5ba2a21528 Client: Make it possible to start demo rendering pre-paused
The pause can be useful e.g. to adjust the camera position and zoom
right on the first video frame.
2023-07-08 15:43:42 +03:00
Alexander Akulich c172b369b2 Client: Set the speed index on demo rendering (fix later speed changes) 2023-07-08 04:09:48 +03:00
ChillerDragon 9d2f4318d5 Allow server to redirect clients
This is a preperation for #6754 (redirect players on map vote)
And an implementation of #5662 (redirect players)
2023-07-02 14:05:11 +02:00