Commit graph

18463 commits

Author SHA1 Message Date
furo 36bf22f1c4 Add button to rename images and sounds in editor. 2023-11-08 18:01:32 +01:00
Dennis Felsing c3c4b482a7
Merge pull request #7421 from apelsin21/master
Changes python -> python3 for Debian dependency
2023-11-08 12:47:07 +00:00
axel 9fc63582e1 Changes python -> python3 for Debian dependency 2023-11-08 12:26:09 +01:00
Jupeyy 670f4e167a
Merge pull request #7416 from Robyt3/Graphics-Assertion-Cleanup
Fix client not quitting after graphics assertion
2023-11-07 16:36:46 +00: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
Jupeyy dfb99e1532
Merge pull request #7415 from Robyt3/Datafile-Writer-Unlimited
Support writing maps with more items/data
2023-11-05 12:55:54 +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
Dennis Felsing b60b14bf61
Merge pull request #7412 from Robyt3/Graphics-Invalid-TexLoad-Flags
Fix flashing black screen when loading menu themes, fix some textures being loaded without mipmaps, refactoring
2023-11-04 13:24:24 +00: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
Dennis Felsing 1d9369593e
Merge pull request #7411 from infclass/for-ddnet
Fix displayed version (drop patch version if == 0), do some random little cleanup
2023-11-03 21:46:32 +00: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
Alexander Akulich 80a4ad5293 CMake: Filter out project patch version == '0' 2023-11-03 21:33:49 +03:00
Dennis Felsing dbfe8887a9
Merge pull request #7406 from furo321/afk-color-info-tab
Show AFK status in info tab
2023-11-02 13:10:54 +00: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
Dennis Felsing 9b75f85bb5
Merge pull request #7405 from Robyt3/Client-Warning-Queue
Add gameclient warnings to queue instead of overriding others
2023-11-01 22:01:22 +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
Dennis Felsing 03400f6ff3
Merge pull request #7400 from Robyt3/Client-Map-Loading-Warning
Allow loading embedded images without valid image name, show warning popup when map image/sound cannot be loaded
2023-10-31 22:50:58 +00: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