Commit graph

14078 commits

Author SHA1 Message Date
heinrich5991 da78cc0735
Merge pull request #7471 from ChillerDragon/pr_tele_controller
Move m_TeleOuts from ddr controller to game controller
2023-11-18 02:54:06 +00:00
heinrich5991 46679deddc
Merge pull request #7481 from Robyt3/Storage-UTF8-Check
Ensure filenames are valid UTF-8 on Unix
2023-11-18 02:51:55 +00:00
ChillerDragon 60e6025e7a Move m_TeleOuts from ddr controller to game controller
#7127
2023-11-17 23:52:31 +01:00
Dennis Felsing 0bf9e2dbb3
Merge pull request #7488 from Robyt3/Editor-GridFactor-Fix
Fix map grid factor always being shown as 1
2023-11-17 22:32:19 +00:00
heinrich5991 75f40ede45 Make gamecore.h not depend on console 2023-11-17 23:26:10 +01:00
Robert Müller dd907ab016 Fix map grid factor always being shown as 1 2023-11-17 21:52:39 +01:00
Robert Müller 7d69016b3a Fix nullptr access on dbg_assert with no global logger
Now it's also possible to use `dbg_assert` without/before having set a global logger.
2023-11-17 21:07:41 +01:00
Robert Müller 5c7bb58457 Ensure filenames are valid UTF-8 on Unix
On Unix, the encoding of filenames is unspecified, although UTF-8 is likely used in most cases. Detecting and converting from several possible encodings to UTF-8 would be too much effort, considering that most systems already use UTF-8 per default. Therefore, any filenames which are not valid UTF-8 will be ignored when listing directories with `fs_listdir(_fileinfo)`, `fs_storage_path` will fail if the storage location is not valid UTF-8 and `fs_getcwd` will fail if the current working directory is not valid UTF-8. Paths specified in `storage.cfg` must also be valid UTF-8.

On Windows, we already ensure that all filenames are converted to UTF-8.
2023-11-17 18:55:28 +01:00
Dennis Felsing 4e27299657
Merge pull request #7470 from furo321/remove-map-setting-msg
Don't print "tunes"/unknown commands from maps.
2023-11-16 23:34:22 +00:00
Robert Müller 88829a5080
Merge pull request #7483 from heinrich5991/pr_ddnet_pred_margin
Don't allow too large of a prediction margin
2023-11-16 21:33:34 +00:00
heinrich5991 24a74e373e Don't allow too large of a prediction margin 2023-11-16 22:18:15 +01:00
Robert Müller 32bd6f6526 Fix leak of community icons when jobs not finished
The community icon data loaded in background jobs was previously not freed when the client is quit before the community icon data is processed.
2023-11-16 21:47:27 +01:00
furo e3402cbf85 Don't print "tunes"/unknown commands from maps. 2023-11-16 01:02:22 +01:00
Dennis Felsing 55098cd313
Merge pull request #7469 from archimede67/pr-save-chat-input
Save current chat input when pressing UP. Prevent input clearing when pressing DOWN
2023-11-15 23:20:13 +00:00
Corantin H 06674ebecf Save current input when using UP arrow. Prevent DOWN arrow from clearing current input. 2023-11-15 23:52:02 +01:00
Dennis Felsing fcd7f135f0
Merge pull request #7466 from Robyt3/Editor-Parent-Folder-Fix
Fix parent folder not being shown in editor file browser, fix typo
2023-11-15 22:37:47 +00:00
heinrich5991 162258af3d
Merge pull request #7467 from furo321/case-insenstive-keys
Make KEY argument case-insensitive
2023-11-15 22:09:40 +00:00
furo 0042aec086 Make KEY argument case-insensitive 2023-11-15 22:51:41 +01:00
Robert Müller f54fc2e441 Fix parent folder not being shown in editor file browser, fix typo
The check for multiple storage locations was using the base path from the previous invocation of the file dialog instead of using the new base path.

Closes #7463.
2023-11-15 22:28:50 +01:00
Jupeyy dfbff0eb57
Merge pull request #7462 from furo321/update_textsize
Set size of text when changing slider of `cl_text_entities_size`.
2023-11-15 20:18:29 +00:00
furo 740049a454 Set size of text when changing slider of cl_text_entities_size. 2023-11-15 20:54:27 +01:00
dobrykafe 08a00cff6b update m_FileDialogFileNameInput when deleting a file 2023-11-15 18:24:20 +01:00
Dennis Felsing eb0392007b
Merge pull request #7458 from furo321/incorrect-usage
Correct usage of `demo_extract_chat` tool.
2023-11-15 14:33:11 +00:00
furo e27223a027 Correct usage of demo_extract_chat tool. 2023-11-15 15:08:30 +01:00
ChillerDragon 9e27a5a107 Fix unused variabled m_WasRecording 2023-11-15 12:11:58 +01:00
Axel Vestin 7c15514696 Use Escape to cancel OP_SCALE envelope 2023-11-14 21:17:07 +01:00
Robert Müller b8d38f7f49 Fix server crash on DDTeam message with lower sv_max_clients
When the `CGameContext::SendChatTeam` function is used to send a chat message to all members of a DDTeam (e.g. on completed /swap chat command), it was not checked whether the target players are online but only whether they belong to the specified team according to the teams core. However, the default team for unconnected/cleared players is 0 in the teams core, which is the same for players in team 0, so chat messages were being sent to client IDs not corresponding to connected clients when chat messages where supposed to be sent to players in team 0. This was causing the server to crash with the assertion error "erroneous client id" specifically when the server is started with `sv_max_clients` being less than the default, maximum 64.

Closes #7450.
2023-11-13 23:16:21 +01:00
Dennis Felsing 32f3f9e03a
Merge pull request #7449 from furo321/lasttp-save
Save entire character with `/lasttp`.
2023-11-12 23:14:12 +00:00
furo f9b9480291 Save entire character with /lasttp. 2023-11-12 23:48:36 +01:00
Dennis Felsing 76d27e734a
Merge pull request #7444 from Chairn/demo_filename
Update string when cutting demo to indicate file name
2023-11-12 22:45:26 +00:00
Chairn c6f78ea3c3 Update string when cutting demo to indicate file name 2023-11-12 23:29:32 +01:00
Jupeyy 39b3249bf5 Increase max zoom limit
To a limit that fits to the biggest maps
2023-11-12 21:36:20 +01:00
Dennis Felsing 4f1fc71f95
Merge pull request #7440 from Robyt3/Server-Credits-Update
Add new contributors to credits
2023-11-12 11:36:26 +00:00
Robert Müller 188462ea27 Add new contributors to credits
Thanks everyone!
2023-11-12 12:20:10 +01:00
Dennis Felsing e74e6770c3
Merge pull request #7325 from Robyt3/Browser-Community-Filter
Add community server filter and icons, remove DDNet and KoG tabs
2023-11-12 00:00:05 +00:00
Dennis Felsing d716210e31
Merge pull request #7408 from Jupeyy/pr_tile_border_shader
Switch to a fragment shader solution for border tile rendering
2023-11-11 23:02:34 +00:00
Dennis Felsing 79e244f166
Merge pull request #7433 from Robyt3/Editor-Color-Picker-Refactoring
Show color picker button for color envelope points
2023-11-11 22:14:41 +00:00
Dennis Felsing aefa52c6b9
Merge pull request #7432 from Robyt3/Base-Standard-Mutex-Wrapper
Add `CLock` wrapper for `std::mutex` to replace `lock_*` functions, use `CLock` instead of `std::mutex`, add thread-safety annotations
2023-11-11 22:07:02 +00:00
Robert Müller bd4c138107 Show color picker button for color envelope points
Simplify selecting envelope point colors by showing a color picker button that opens a color picker popup to change the color of the selected envelope point. The existing editbox to change only the selected channel's value is kept, as the color picker popup does not support the same precision to specify the individual color channel values.

Closes #7317.
2023-11-11 20:45:22 +01:00
Robert Müller d8452ad02c Extract ShowPopupEnvPoint local function 2023-11-11 20:45:22 +01:00
Robert Müller c48623de8f Extract CEditor::DoColorPickerButton function
Fix color not being updated while shift key is pressed, due to use of `else if`.
2023-11-11 20:45:22 +01:00
Robert Müller 37b0a5569d
Merge pull request #7427 from furo321/save-unknown-commands
Save unknown commands from `settings_ddnet.cfg`
2023-11-11 18:24:32 +00:00
Robert Müller 4a00332f59
Merge pull request #7434 from ChillerDragon/pr_ctrl_s_scale
Do not scale envelopes on ctrl+s
2023-11-11 18:22:56 +00:00
furo 6599b7e14b Save unknown commands from settings_ddnet.cfg 2023-11-11 19:09:13 +01:00
ChillerDragon e090d73784 Do not scale envelopes on ctrl+s
When using ctrl+s to test the current envelope it should not activate
the scale mode. This causes unexpected envelope changes on ctrl+s based
envelope fine tuning testing.
2023-11-11 18:56:09 +01:00
Robert Müller 8bde57a1ca
Merge pull request #7429 from dobrykafe/pr-show-directory
Hide `"Show directory"` when `"All combined"` selected
2023-11-11 15:15:34 +00:00
dobrykafe ca6b518383 remove ShowingRoot check 2023-11-11 14:08:41 +01:00
Robert Müller 10470046b7 Use CLock instead of std::mutex, add thread-safety annotations
Use `CLock` and `CLockScope` instead of `std::mutex` and add clang thread-safety analysis annotations everywhere except for usages in engine graphics and video, as those usages also involve `std::condition_variable`.

Fix lock not being unlocked on all code paths in `CFutureLogger::Log`, which is caught by the static analysis.
2023-11-11 00:09:17 +01:00
Robert Müller 3d858c28ee Add CLock wrapper for std::mutex to replace lock_* functions
Replace usages of platform specific `lock_*` functions with `std::mutex` through the wrapper class `CLock`. Move lock classes to `base/lock.h`.

The `CLock` wrapper class is only necessary because the clang thread-safety attributes are not available for `std::mutex` except when explicitly using libc++.
2023-11-11 00:04:57 +01:00
dobrykafe 73fac0c8d4 check StorageType instead of SelectedIndex 2023-11-10 21:45:45 +01:00
heinrich5991 de52ded86d
Merge pull request #7431 from Robyt3/Editor-Envelope-Accuracy
Fix inaccurate envelope point value rounding
2023-11-10 18:31:31 +00:00
Robert Müller 859727c1d3 Fix inaccurate envelope point value rounding
Round to nearest integer instead of truncating in `f2fx` to ensure correct round-trip with `fx2f`.

Add test to ensure correct round-trip with maximum `0.0005f` absolute error.
2023-11-10 19:11:10 +01:00
dobrykafe 41b63843ce hide "Show directory" when "All combined" selected 2023-11-09 22:16:07 +01:00
heinrich5991 962379d64d
Merge pull request #7428 from Robyt3/Editor-Entities-Explain-Assertion-Fix
Fix editor crash when showing explanation for custom entities
2023-11-09 18:41:53 +00:00
Robert Müller df664261bb Fix editor crash when showing explanation for custom entities
The failing assertion is removed because users can add custom entities images besides the predefined ones.

Reported by Mr.Gh0s7 on Discord.
2023-11-09 19:02:54 +01:00
Robert Müller fa8640bd35
Merge pull request #7425 from furo321/editor-correct-corners
Use correct corners for brush rotation buttons.
2023-11-08 19:13:34 +00:00
furo 3ebf0ef85d Use correct corners for brush rotation buttons. 2023-11-08 19:57:37 +01:00
furo 36bf22f1c4 Add button to rename images and sounds in editor. 2023-11-08 18:01:32 +01:00
Robert Müller b4423551d4 Fix client not quitting after graphics assertion
After the error message popup is shown for graphics assertions, the client window was destroyed but the process was not terminated properly. Now the graphics assertion error is handled like a normal assertion error, as those are also shown in an error message popup and correctly cause the client to break into the debugger or terminate.

However, calling `dbg_assert` while already owning the lock that `WaitForIdle` waits on will cause a deadlock, so error handling must be delayed until after the lock is released.

The buffer size for assertion messages is increased, as it was not sufficient for some graphics assertions.

The `ICommandProcessor::GetError` and `ICommandProcessor::GetWarning` functions are marked as `const`.
2023-11-06 23:34:05 +01:00
Jupeyy 50905325d8
Merge pull request #7417 from Robyt3/UI-ColorPicker-RGBA
Add mode selection to color picker popups (RGBA, HSVA, HSLA)
2023-11-05 13:10:08 +00:00
Robert Müller 78217c44d7 Add mode selection to color picker popups (RGBA, HSVA, HSLA)
Add buttons for selecting the color mode (RGBA, HSVA, HSLA) in color picker popups in menu and editor. Previously, the color picker popups always showed the color components in HSVA. Now the mode can be switched so the components are shown in either RGBA or HSLA. The hex color code is always RGBA, same as before.

In the editor, the RGBA mode is used per default, to prevent any loss of information due to color conversions, as the map format stores RGBA values. In the menus, the HSVA mode is the default, same as before, although the config actually stores HSLA values.

The HSVA color picker controls (1D slider for hue, 2D picker for saturation and value) are still shown for all modes.

As many color conversions as possible are avoided by only converting between color formats when necessary. Switching between color modes should not change the selected color. Changing the RGBA hex value in the editor will set the exact value also when another color mode is selected. However, changing the color with the other controls in HSVA/HSLA mode will cause a conversion and possible loss of information. The conversion directly from RGBA to HSVA and vice versa is also explicitly avoided, as this internally converts to HSLA first, which is done separately already.

Closes #7409.
2023-11-05 13:46:01 +01:00
Robert Müller 91e6fca2a5 Add parameter Enabled to DoButton_PopupMenu 2023-11-05 12:56:07 +01:00
Robert Müller 3e5a2888bc Support writing maps with more items/data
Previously, the client would crash with an assertion when writing more than 1024 items, 1024 data items or 64 extended item types to a map file. This arbitrary limitation is removed by using `std::vector`s, so much larger maps can be written. This was only a limitation when writing map files. Old clients can correctly read the map files having more items/data but will crash when the map is saved in the editor.
2023-11-04 22:54:18 +01:00
Robert Müller d39247f726 Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.

The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.

Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.

The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.

The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.

Closes #5654.
2023-11-04 15:32:27 +01:00
Robert Müller 7f694e8fc9 Add IStorage::CalculateHashes
To conveniently calculate the SHA256 and CRC32 hashes of a file without reading the entire file into memory at once.
2023-11-04 15:24:44 +01:00
Jupeyy 639a8c3c8b Switch to a fragment shader solution for border tile rendering 2023-11-04 14:51:39 +01:00
Robert Müller 367c7ba4e7 Fix some textures being loaded without mipmaps
Some calls to `LoadTextureRaw` where passing the image format also in place of the texture load flags. Since the image format would be RGBA most of the time, this was interpreted as the flag `IGraphics::TEXLOAD_NOMIPMAPS` causing various textures (all sprites textures, assets when shown in menus, menu images, menu theme icons) to be loaded without mipmaps.

This is fixed by passing `0` as the texture load flags and by replacing uses of `LoadPNG` and `LoadTextureRaw` with `LoadTexture`.
2023-11-04 12:54:09 +01:00
Robert Müller e12f59b445 Remove unused argument pUser of LoadAsset function 2023-11-04 12:54:09 +01:00
Robert Müller 82ba8e0bb8 Add CTextureHandle::IsNullTexture, rename InvalidTexture
Rename `InvalidTexture` to `NullTexture` to avoid confusion because the null texture is not invalid. The function `CTextureHandle::IsNullTexture` is added to make it easier to check the result of using `IGraphics::LoadTexture`, which returns the null texture on error instead of an invalid texture handle. An assertion is added to ensure that `IsNullTexture` works correctly.
2023-11-04 12:54:08 +01:00
Robert Müller fdaa343219 Fix check for invalid texture after LoadTextureRaw
The handle returned by `LoadTextureRaw` is either valid or invalid (i.e. `-1`) but never the invalid texture itself.

Additionally, ensure that the `LoadTexture` function returns the invalid texture also when `LoadTextureRaw` fails.
2023-11-04 12:54:08 +01:00
Robert Müller 07e336e0f4 Improve theme icon loading, fix flashing black screen
Load theme icons individually for all themes that have been loaded instead of doing a separate scan of the `themes` folder for the icons.

Fix screen occasionally flashing black when opening the general settings. This was caused by `UpdateAndSwap` randomly being called when theme loading takes longer than 1/60 seconds, which sometimes happens on the first start of the client after rebooting the machine. Now the loading popup is correctly rendered when theme loading takes longer than 500ms, which is consistent with the behavior when loading other files.

Minor improvements to log messages.
2023-11-04 12:54:06 +01:00
Robert Müller 77ba85732e Remove middle man in call chain
As `pSelf` is already a pointer to `CMenus` the additional access to the gameclient is unnecessary.
2023-11-04 12:53:04 +01:00
Alexander Akulich b886b93cf2 CPlayer: Remove unused variable 2023-11-03 21:36:33 +03:00
Alexander Akulich 17c90fc061 CCharacter::IsSnappingCharacterInView: Add missing const 2023-11-03 21:36:33 +03:00
Alexander Akulich cf754c4d60 CMenuBackground::GetThemes: Drop unused cast 2023-11-03 21:36:33 +03:00
furo 149e5b6864 Show AFK status in info tab 2023-11-02 13:18:00 +01:00
Dennis Felsing 80c4940b7f
Merge pull request #7403 from Robyt3/Datafile-Writer-Refactoring
Add more assertions to datafile writer, refactoring
2023-11-01 22:02:45 +00:00
Dennis Felsing 3ec5211866
Merge pull request #7404 from Robyt3/Server-Testing-Commands-Freeze-Unfreeze
Add `freeze`/`unfreeze` testing commands
2023-11-01 22:02:09 +00:00
Robert Müller ebe2ddea9f Add gameclient warnings to queue instead of overriding others
Using `CMenus::PopupWarning` will immediately set the popup and override the current warning, which can hide warnings when multiple are shown at the same time. Now all warnings are added to the queue with `IClient::AddWarning`.
2023-11-01 22:17:01 +01:00
Robert Müller 75debadd34 Add freeze/unfreeze testing commands
See #7370.
2023-11-01 17:26:29 +01:00
Robert Müller 9b8eb9d6fc Use for- instead of while-loop, improve comments 2023-11-01 14:07:36 +01:00
Robert Müller 7343ca224c Add CDatafileHeader::SizeOffset to replace magic 16 2023-11-01 14:07:36 +01:00
Robert Müller 64716075f9 Add assertion to ensure correct item IDs are written 2023-11-01 14:07:36 +01:00
Robert Müller 284390cc75 Add assertions to ensure correct map item/data sizes are written
Add assertions to prevent map items and data that are too large to be represented by the map format from being written to maps. Additionally, ensure that the size of the whole map file is not too large to be represented by the map header.

Prevent `malloc` of size 0, which is implementation defined and should be avoided, when adding items without data, which happens for example when adding an empty array of envelope points.
2023-11-01 14:06:28 +01:00
Robert Müller f7722eb016 Remove separate CDataFileWriter::Init/OpenFile functions
Simplify usage of datafile writer by removing duplicate functions for opening file.
2023-11-01 12:54:38 +01:00
Robert Müller 8482e9475c Show warning popup when map image/sound cannot be loaded
Show a warning popup when a map image or sound cannot be loaded for any reason. Only one generic warning popup is shown for images and sounds individually.
2023-10-31 21:21:09 +01:00
Robert Müller 525cc59927 Allow loading embedded images without valid image name
The image name is only required for external images. For embedded images it was only used in log messages. This fixes rendering with various maps that have embedded images with invalid names.
2023-10-31 21:19:49 +01:00
Dennis Felsing 7000b97425
Merge pull request #7396 from BurnyLlama/add-underline_top_five
Added back underline for `sv_regional_rankings 0`.
2023-10-30 23:10:50 +00:00
Dennis Felsing 2eff91083d
Merge pull request #7394 from furo321/fix-setafk
Fix afk timer not working.
2023-10-30 23:03:17 +00:00
BurnyLlama 817ef6eb58 Added back underline for sv_regional_rankings 0. 2023-10-30 22:40:04 +01:00
furo 0ecc50ae0f Fix afk timer not working. 2023-10-30 19:43:35 +01:00
Dennis Felsing 795a2699ef
Merge pull request #7391 from furo321/incorrect-ghost
Fix incorrect ghost being loaded with `cl_race_ghost_save_best`
2023-10-30 09:40:25 +00:00
Dennis Felsing 3235e3eac9
Merge pull request #7392 from furo321/fix-demo-ending-early
Delay server race demo ending by 1 second.
2023-10-30 09:40:00 +00:00
furo 7a7616773d Delay server race demo ending by 1 second. 2023-10-30 03:32:50 +01:00
furo 05e7c284ea Fix incorrect ghost being loaded with cl_race_ghost_save_best 2023-10-30 00:53:00 +01:00
Dennis Felsing 911880a982
Merge pull request #7390 from Patiga/remove-parallax-zoom-from-map
Remove Parallax Zoom from map file
2023-10-29 23:11:32 +00:00
Patiga a9fc2207ac Remove Parallax Zoom from map file
Parallax Zoom improves the appearance of maps visually when zooming.
Contrary to initial tests, it does not interfere with certain map
locations such as the shop on the map Timeshop.
The default value appears to be correct for all existing maps.

The value in the map file is non-trivial to manage, and provides little
benefit. See https://github.com/ddnet/ddnet/issues/6196 for further
discussion.
2023-10-29 23:43:19 +01:00
Dennis Felsing 1acdb6d800
Merge pull request #7389 from BurnyLlama/fix-docs-snd_buffer_size
Altered `snd_buffer_size` description. Fixes #7229
2023-10-29 22:42:46 +00:00
Dennis Felsing a88befb3ca
Merge pull request #7385 from Robyt3/Client-Mapres-Bounds-Checking
Fix client crash on maps with invalid image and sound indices
2023-10-29 22:40:17 +00:00
BurnyLlama c76352cb9f Altered snd_buffer_size description. Fixes #7229 2023-10-29 19:57:03 +01:00
Robert Müller 751343c846 Fix client crash on maps with invalid image and sound indices
Limit number of sounds being loaded in the client to 64, instead of writing sample indices out of bounds.

Check if sound indices are out of bounds. It was only checked whether the sound index is -1 but no other bounds checking was performed.

Check if image indices are out of bounds. It was not checked for all negative image indices, only -1 was considered.

Add popup message in the editor when trying to add more than 64 sounds, same as for images.

Limit number of images in `map_convert_07` tool, instead of writing out of bounds.
2023-10-29 17:55:20 +01:00
ChillerDragon 683c5bb37d Add sixup server triggered events translation
Fixes double jump effect not being rendered for other players.
This bug only affected 0.7 clients on ddnet servers
2023-10-29 14:56:09 +01:00
Robert Müller 110247f08f
Merge pull request #7383 from furo321/align-killmessages
Align kill messages properly in demos when using `cl_showpred`
2023-10-28 13:54:30 +00:00
furo d9beeaa8b4 Align kill messages properly in demos 2023-10-28 15:27:16 +02:00
Robert Müller 25a776cb23
Merge pull request #7382 from furo321/improve-ghosts-fixes
Small fixes to ghosts
2023-10-28 13:23:40 +00:00
furo e61ed1c3b4 Small fixes for cl_race_ghost_strict_map
- Better description
- Remove redudant map check
2023-10-28 14:54:35 +02:00
furo 2ca8330543 Render ghosts before players 2023-10-28 14:45:43 +02:00
Robert Müller e66fe2c70e Add event dates to time_season: easter, halloween, xmas
Add easter, halloween and xmas to `enum ETimeSeason` and `time_season` function. This unifies the logic for detecting these events and seasons in one function. This allows adding support for special easter, halloween and xmas theme maps in the future. The `localtime` function is not used outside `system.c` anymore. The code for detecting easter is taken from upstream.
2023-10-28 12:10:41 +02:00
Dennis Felsing 28f4739e46
Merge pull request #7375 from furo321/improve-ghosts
Various improvements to ghosts
2023-10-27 22:06:00 +00:00
furo dadb142f4e Add cl_race_ghost_alpha, add title for ghost settings. 2023-10-27 20:56:57 +02:00
furo b90995da06 Add option to always save ghosts, not only personal bests. 2023-10-27 20:55:35 +02:00
furo dc439a804b Ghost browser UI Improvements
- Use Refresh icon instead of text.
- Add button to open ghost directory.
- Button to (de)active all ghosts.
- Grey out ghosts that failed to load.
2023-10-27 20:55:33 +02:00
furo 4f6ce37b3a Add date column to ghost browser 2023-10-27 20:51:19 +02:00
furo c743ed5848 Increase MAX_ACTIVE_GHOSTS from 8 to 256 2023-10-27 20:51:19 +02:00
furo c79e4c2de5 Add option to disable ghost map hash check. 2023-10-27 20:51:17 +02:00
Robert Müller d167f0042a
Merge pull request #7371 from furo321/conf-argument-completion
Add argument completion for `reset`, `toggle`, `access_level`
2023-10-27 17:50:18 +00:00
Dennis Felsing 80cccaaae9
Merge pull request #7362 from furo321/SvRegionalRankings
Add option to disable printing of regional rankings.
2023-10-27 16:42:23 +00:00
furo 686948e659 Remove m_ArgumentCompletionFlagmask 2023-10-27 18:12:37 +02:00
Robert Müller 68e481945b Fix incorrect menu behavior when quitting/restarting
Only consider `STATE_ONLINE` and `STATE_DEMOPLAYBACK` as ingame.

Closes #7178.
2023-10-26 21:41:03 +02:00
Robert Müller 7312721743 Remove redundant server browser refresh on client start
The `RefreshBrowserTab` function already does the respective `ServerBrowser()->Refresh(...)` calls.
2023-10-26 21:26:34 +02:00
Dennis Felsing 24b75d17e9
Merge pull request #7372 from Robyt3/Engine-Demo-Update-File-Check
Fix use of closed demo file when playback stopped due to error
2023-10-25 22:53:43 +00:00
dobrykafe ec0380e683 fix requested changes 2023-10-25 21:35:26 +02:00
Robert Müller 4845639a00 Fix use of closed demo file when playback stopped due to error
Check whether the demo file has been closed due to a playback error when calling `DoTick` in loops, to prevent crashes on operating systems with assertions for correct C library usage. On Windows, `warning: Invalid parameter passed to C runtime function` was printed to the debug console in this case.
2023-10-25 20:10:15 +02:00
furo adc36e8215 Add argument completion for reset, toggle, access_level 2023-10-25 19:00:12 +02:00
dobrykafe 579005b98a add new tool demo_extract_chat 2023-10-25 16:03:24 +02:00
Dennis Felsing 92206044d1
Merge pull request #7366 from furo321/SoundsDetail
Remove "Detail" from sound layers.
2023-10-25 09:21:05 +00:00
Robert Müller a0d154a841 Bump maximum server password length from 128 to 256
Ensure server password can fit username and password separated by colon, so there is no discrepancy where some passwords work in rcon but not for reserved slots.
2023-10-24 21:44:53 +02:00
Robert Müller 3116fb4bcf Fix ec_output_level default/min/max values, update description
To ensure that all `*_output_level` variables have the same default, minimum and maximum values.
2023-10-24 20:17:09 +02:00
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
furo 18f389fb17 Remove "Detail" from sound layers. 2023-10-24 19:34:09 +02:00
Dennis Felsing 31031f5cc1
Merge pull request #7365 from Robyt3/Menus-Demo-Fixes
Fix crash when directly rendering demo after slicing, fix demo slice confirmation popup not being shown anymore
2023-10-23 22:00:06 +00:00
Robert Müller 61ff171fcd
Merge pull request #7364 from furo321/hookcollsize
Use correct max value for "Hook collision width" setting
2023-10-23 21:36:52 +00:00
Robert Müller 7c06553056 Fix crash when directly rendering demo after slicing
Use `m_aCurrentDemoSelectionName` and `m_DemolistStorageType` for the demo render popup instead of using `m_DemolistSelectedIndex`, which can be invalid when the demo render popup is not opened from the demo browser.

Closes #7347.
2023-10-23 23:30:20 +02:00
Robert Müller f32e8eb8de Fix demo slice confirmation popup not being shown anymore 2023-10-23 23:08:44 +02:00
furo 9b3f34a74f Use correct max value for "Hook collision width" setting 2023-10-23 22:49:51 +02:00
Robert Müller 565f9d1b59
Merge pull request #7363 from furo321/correct-chat-limit
Change chat input size to 256
2023-10-23 20:48:02 +00:00
furo 816fd751c7 Change chat input size to 256 2023-10-23 22:14:49 +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
furo bf98eec518 Add option to disable regional rankings.
Set config to true in tests

Add test for `´sv_regional_rankings`
2023-10-23 14:02:22 +02:00
dobrykafe 35e5c114ba stop sound preview in more places 2023-10-23 12:50:59 +02:00
dobrykafe c304b3eef8 extract CEditor::OnDialogClose 2023-10-23 12:48:53 +02:00
Robert Müller bea7aea431 Encapsulate CHostLookup member variables
The host lookup job is currently only used for the DNSBL lookup on the server-side and in tests.
2023-10-22 13:38:56 +02:00
Robert Müller f8af7542c6 Move CHostLookup to separate compilation unit
The host lookup job and the engine interface are independent so they are moved to separate files.

The include of `engine.h` in `client.h` is therefore unnecessary and other includes also had to be adjusted because of this.

The variable `m_VersionServeraddr` is unused and therefore removed. The host lookup job is currently not used on the client-side.
2023-10-22 13:38:35 +02:00
Robert Müller 1fde694565 Improve positioning of IME candidate window for multi-line text
Previously, the IME candidate window was aligned with the top-right corner of the text bounding box (when rendering the text until the caret offset). This does not work correctly for text spanning multiple lines, causing the IME candidate window to be displayed at the X position of the longest line instead. Additionally, text clipping in the chat was not considered, as `CLineInput` is not aware of the clipping implemented in `CChat`, causing the IME candidate window to be moved up too far.

This is fixed by getting the correct rendered position of the caret offset using `m_CursorRenderedPosition`. Vertical alignment is also changed so only one line of text is considered, which makes the behavior more consistent with Windows' native IME candidate window and avoids larger changes in `CLineInput` to make it aware of clipping.
2023-10-20 17:51:01 +02: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
Robert Müller 92e2e17f0f Validate ticks when reading demo chunk headers
Add checks to ensure that the ticks read from demo chunk headers are in the valid range (cf. `MIN_TICK` and `MAX_TICK` constants). Playing demos with invalid ticks is prevented entirely, as the invalid ticks would cause issues in other places. The server never uses ticks outside the valid range, so invalid ticks should never occur in correctly recorded demos.

Additionally, checks are added to detect if a tickmarker chunk with a tick delta occurs before a tickmarker chunk defining an initial tick. The tick delta is only meaningful when an initial tick has already been defined, so if this is not the case the demo is also considered invalid.
2023-10-19 21:41:20 +02:00
Robert Müller 6951795619 Add title to engine warnings and make auto-hiding optional
Make the title of warnings adjustable, with the default title being "Warning" to preserve existing code.

Make auto-hiding configurable, so the automatic closing of warning popups after 10 seconds can be toggled.
2023-10-19 21:40:55 +02:00
Robert Müller 60807b5de9 Fix io_skip return type and documentation
The function returns 0 on success and -1 on error, as it delegates to `io_seek`, instead of returning the number of bytes skipped, which the documentation previously suggested. The return type is changed from `unsigned` to `int`, as this is also the type of `io_seek` and this better handles -1 as a return value.
2023-10-19 21:40:35 +02:00
dobrykafe 697bd8980d stop sound preview in more places 2023-10-18 14:47:47 +02:00
dobrykafe aafee689ca stop/pause sound previews 2023-10-18 13:27:31 +02:00
Robert Müller 8fea5998aa Mark functions as const when possible 2023-10-17 20:27:58 +02:00
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 a0c0d7efba Fix incorrect minimum value of dbg_tuning velramp graph
This was causing the curve to clip outside the graph area.
2023-10-17 20:24:47 +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 f1e74c12e9 Remove unused IDemoPlayer::GetDemoType and enum literals
We only show the string value directly in the UI instead of using the demotype enum literals. There also should not be any reason to change any logic depending on whether the current demo is a server- or client-demo.
2023-10-16 22:06:28 +02:00
Robert Müller af4b1c9c97 Remove tick error debug message
This is shown every time demo playback ends when reaching the end of the file and it does not really help debugging.
2023-10-16 22:06:19 +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 f7b8738f91 Remove obsolete TODO about improving demo player map checking
We already use `CClient::LoadMapSearch` to load maps for demo playback, so maps in the `maps` folder are already considered. Using the map CRC is deprecated, we do not want to check it.
2023-10-16 21:53:37 +02:00
Robert Müller dbbae72ca7 Move variable declarations closer to usages 2023-10-16 21:53:37 +02:00
Robert Müller 9b68b9deef Use bool instead of int 2023-10-16 21:53:36 +02:00
Robert Müller 1333ac34f4 Use nullptr instead of 0 and NULL 2023-10-16 21:53:36 +02:00
Robert Müller 568177114f Remove unnecessary parentheses 2023-10-16 21:53:36 +02:00
Robert Müller 82d94faf28 Refactor GetDemoName using IStorage::StripPathAndExtension
The functions were effectively identical already.
2023-10-16 21:53:32 +02:00
Robert Müller c3b8c94212 Use std::vector for demo player keyframes
Using an `std::vector` is simpler and more readable than first allocating a linked list on a heap and later copying the list to an array.

The variable `m_SeekablePoints` is removed from `CPlaybackInfo`, as it does not need to be exposed outside of `CDemoPlayer` and can be replaced with the size of the vector.
2023-10-16 21:53:29 +02:00
Robert Müller cd4a13e74c Remove unnecessary check for open file in ReadChunkHeader
The function is only used internally and never called when the file is not open.
2023-10-16 20:50:43 +02:00
Dennis Felsing a60eb31ede
Merge pull request #7351 from Robyt3/Client-Snap-PlayerInfo-Crash-Fix
Fix client crash on player info snapshot item with invalid ID
2023-10-15 22:30:02 +00: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 22352316d8 Give jobpool worker threads different names based on index 2023-10-15 22:10:50 +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 2dcec6496f Use std::vector for jobpool threads
To simplify the usage and to support an arbitrary number of threads.
2023-10-15 22:00:25 +02:00
Robert Müller 97c1046104 Add assertions to ensure that thread_init is successful
Ensure that `pthread_create`/`CreateThread` are successful.
2023-10-15 21:59:42 +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 1a83a17db8 Fix client crash on player info snapshot item with invalid ID
The player info snapshot item (`CNetObj_PlayerInfo`) has its own `m_ClientID` member variable in addition to the generic snapshot item ID. The snapshot item ID was only used to set `m_Snap.m_LocalClientID` but without being checked for invalid values. Now it is checked that both IDs are identical and only `m_ClientID` is used consistently.
2023-10-15 17:06:12 +02:00
Robert Müller 60bb48c725 Fix map version checks in map_diff and map_extract tools
The map version was only checked if the version item is present, which is different from how client and editor load maps. Now a missing version item is considered an unsupported version. Additional log messages are also added to the tools.
2023-10-14 17:03:48 +02:00
Dennis Felsing 46c7229a22
Merge pull request #7345 from Robyt3/Tests-Swap-Endian
Add tests and documentation for `swap_endian` function
2023-10-14 12:02:30 +00:00
Robert Müller d9a7df0f92 Add tests and documentation for swap_endian function 2023-10-14 13:29:24 +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 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
Dennis Felsing 90466689d3
Merge pull request #7343 from Robyt3/Engine-Demo-Editor-Type-Preservation
Preserve demo type when slicing
2023-10-13 21:58:20 +00: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 172f316a40 Disable demo slice button while demo is being rendered
There is no reason to slice a demo while currently rendering it and it may cause issues because multiple demo players would access the same `IVideo` instance.
2023-10-13 22:06:17 +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
Robert Müller aeb1530966 Improve layout of demo render popup on 5:4 resolutions 2023-10-12 19:20:12 +02:00
Dennis Felsing 01958378f1
Merge pull request #7336 from Robyt3/Demo-Render-Popup-Android
Remove Android-specific layout code for demo render popup
2023-10-11 21:54:21 +00:00
dobrykafe ee115bf824 dont go below default zoom 2023-10-11 21:08:37 +02:00
Robert Müller 1dfdd752f8 Remove Android-specific layout code for demo render popup
The filename editbox and buttons of the demo render popup were rendered excessively large on Android. While too small buttons could be an issue with smaller screens, this should not be implemented solely this popup, if Android support is revived in the future, as it makes the UI layout code harder to maintain.
2023-10-11 18:20:11 +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