Commit graph

13341 commits

Author SHA1 Message Date
Robert Müller 6f03aabb34 Use std::shared_ptr for editor resources, fix crashes with brush
Simplify memory management of groups, layers, images, sounds and envelopes by using `std::shared_ptr` for all of them.

Clear brush when creating a new map to prevent crash due to unloaded textures being used in tile layer. Closes #6935.

Also fix crash when restoring a saved brush after removing an image that is being used by it.
2023-07-28 21:17:19 +02:00
marmare314 862c0ca2fc make point hitbox bigger 2023-07-28 17:47:28 +02:00
Robert Müller 5b10547aec
Merge pull request #6916 from Vy0x2/pr-poc-mv-clean
Minor improvements to Multi-View
2023-07-28 15:00:42 +00:00
Robert Müller ef5ffedee6 Rework base IO functions on Windows using HANDLE
Switch to using the Windows-specific `HANDLE` and Windows API functions instead of `FILE *` and standard library functions in all Windows IO function implementations.

Using `CreateFileW` instead of `_wfsopen` to open files is necessary, as only `CreateFileW` allows specifying all necessary sharing flags. The sharing flags `FILE_SHARE_READ` and `FILE_SHARE_WRITE` were previously already specified by using `_SH_DENYNO` with `_wfsopen`, but `FILE_SHARE_DELETE` can only be set when using `CreateFileW`. The flags are necessary so files which are in use by the game can still be opened by other processes. In particular, `FILE_SHARE_DELETE` allows deleting/renaming of open files, which was previously not possible. This was causing the smart editor saving process that renames files to fail if a map file is currently in use.

Because `CreateFileW` returns a `HANDLE` instead of a `FILE *` we have to use the `HANDLE`-based Windows IO functions everywhere.

See: https://devblogs.microsoft.com/oldnewthing/20211022-00/?p=105822

Closes #6922.
2023-07-28 16:55:47 +02:00
Robert Müller 88cf4c4ccb
Merge pull request #6923 from Marmare314/envelope_grid
Add grid to envelope editor
2023-07-28 14:42:53 +00:00
devdenn 1c231a0dbd Minor improvements to Multi-View
Dont save the Multi-View variables
Multi-View can not longer be activated again after already active
Fix cl_multiview_use_freeview variable config
Players who killed will be removed from Multi-View even if the spec mode is not active
Multi-View personal zoom will be reseted when enabling Multi-View
Fix bug where a kill in a team will be taken into account
Improve the solo player experience in Multi-View
2023-07-28 16:34:35 +02:00
marmare314 babdbc4b17 add grid to envelope editor 2023-07-28 16:18:56 +02:00
heinrich5991 a94b5c35bf ResetServerGameSettings → ResetGameSettings, remove flag argument
The old code looked pretty weird. It checked for `CFGFLAG_SERVER |
CFGFLAG_GAME` being set above, and then used the passed-in parameter to
find the command. I think it'd be better to just look for `CFGFLAG_GAME`
and then find the command using `CFGFLAG_GAME`.
2023-07-28 16:12:21 +02:00
heinrich5991 03fd1b440b
Merge pull request #5398 from AssassinTee/feature/elasticity-tuning
implement tuning values for elasticity
2023-07-28 13:58:42 +00:00
Marvin Winkens e1ba77d3dc implement tuning values for elasticity
implement tuning values for elasticity

add grounded check to movebox and give jump back when bouncing

fix styling issues

fix jumps being given back at ceilings
2023-07-28 15:35:45 +02:00
Robert Müller b33c9ca977
Merge pull request #6934 from Marmare314/zoom-reset-big-values
handle big value ranges on envelope zoom reset
2023-07-28 13:25:46 +00:00
Robert Müller c2379591e0
Merge pull request #6941 from Marmare314/zoom-adaption
improve offset adaption for envelope zoom
2023-07-28 12:16:56 +00:00
heinrich5991 8b0f317aa0
Merge pull request #6939 from Robyt3/Datafile-Data-Decompress-Check
Check for errors when reading and decompressing datafile data
2023-07-28 11:38:32 +00:00
Robert Müller 7069d74beb Check for errors when reading and decompressing datafile data
Check if datafile data cannot be read entirely (according to the data size specified in the header) and check for decompression errors. In case of errors, let `GetData` return `nullptr` and `GetDataSize` return `0` for the respective index.

Internally the decompressed size is set to `-1` for data which failed to load, so loading of those data will not be attempted again because it would only fail again and can cause additional log messages.
2023-07-28 13:19:40 +02:00
Robert Müller 8b209f036e
Merge pull request #6872 from Marmare314/envelope_contextmenu
Multiple selection in envelope editor
2023-07-28 11:11:02 +00:00
marmare314 f3353e8062 improve offset adaption for envelope zoom
The offset adaption was not correct. Close to the origin it was not really noticeable,
but further away the points shifted offscreen when zooming.
2023-07-28 12:50:12 +02:00
marmare314 62ee646283 allow multiple selection in envelope editor 2023-07-28 12:41:25 +02:00
heinrich5991 564a5958e1
Merge pull request #6940 from Robyt3/Graphics-Rect-Remove-Inverted-Corners
Remove inverted round rectangle corner drawing
2023-07-28 10:24:43 +00:00
Robert Müller c695fd750e Remove inverted round rectangle corner drawing
Rectangles with inverted round corners (`IGraphics::CORNER_I*`) are currently not used anywhere and also only supported when using `Draw4`.

They also feel clunky to use due to the inverted corners being drawn outside of the specified rectangle area.
2023-07-27 23:29:37 +02:00
Robert Müller 4233574085 Fix leak of map data when extracting map from demo fails 2023-07-27 21:27:39 +02:00
Robert Müller fd13ae5fd5
Merge pull request #6928 from sjrc6/pr-fix-gamesettings-crash
Fix client crash in ResetServerGameSettings
2023-07-27 18:45:41 +00:00
Tater 6bb2696c8b Fix crash in ResetServerGameSettings 2023-07-27 13:26:11 -05:00
marmare314 d964a3d327 handle big value ranges on envelope zoom reset 2023-07-27 19:47:06 +02:00
marmare314 873a8543df calculate zoom factor correctly for target zoom 2023-07-27 18:36:58 +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
Robert Müller 22bd19be06
Merge pull request #6920 from Marmare314/layer-drag-bug
reset layer dragging status if no buttons were pressed
2023-07-26 09:01:38 +00:00
marmare314 be861664bc reset layer dragging status if no buttons were pressed 2023-07-26 09:34:36 +02:00
marmare314 3010633099 improve envelope y offset on reset for small value ranges 2023-07-26 00:10:15 +02:00
Robert Müller 71500fd60c Improve server settings editor and status bar
Use icons for all server settings buttons. Rearrange and group buttons.

Show buttons in disabled state when they are not useable instead of hiding them.

Remove checker background from server settings list.

Overhaul hotkeys, also show hotkeys in the tooltips:
- Enter: add command
- Alt+Enter: update command (previously M)
- Alt+Up/Down: move command up/down (previously no hotkey)
- Delete: delete command

Don't activate command lineinput when selecting, moving or deleting elements, as this prevents the listbox from accepting the delete hotkey.

Fix server settings listbox being active while file dialog is open.

Ensure extra editor dragbar area matches the respective toolbar size.

Remove spacing on the left side of extra editors to improve alignment.

Increase status bar button sizes and make them consistent.

Use `enum` to track active extra editor instead of using multiple `bool`s.

Disable extra editor buttons when tile picker is shown, as the extra editors are not rendered in this case.
2023-07-25 21:21:54 +02:00
Robert Müller 177f7485c2 Render editor status bar except tooltip behind popups
So that buttons in the status bar cannot be used while a popup or the file dialog is open.

The tooltip still has to be rendered after popup menus, as popup menus can set the tooltip, which would otherwise not be shown.
2023-07-25 20:17:36 +02:00
Robert Müller b412153341 Ignore listbox hotkeys when modifier, shift or alt pressed
So other components can use these combinations together with a listbox.
2023-07-25 20:17:36 +02:00
Robert Müller d8c05115c9 Add constructor for CSetting and use emplace_back 2023-07-25 20:17:27 +02:00
Robert Müller 880dab7e69 Port JSON writer from upstream
Port the `CJsonWriter` utility class from upstream, which makes outputting correct JSON easier.

Add `CJsonWriter` as an abstract class that can write to different outputs. Two implementations `CJsonFileWriter` (writes to a file) and `CJsonStringWriter` (writes to an `std::string`) are added. Upstream `CJsonWriter` can only write to files.

The same tests are added for both implementations. Duplicate code is avoided by using typed tests with two separate test fixtures.
2023-07-25 15:05:25 +02:00
Robert Müller 31737d81e7 Fix test filenames when using typed tests
Typed tests have test names like "TestName/0" and "TestName/1", which would result in invalid filenames. Replace the string after the first slash with the name of the typed test and use hyphen instead of slash.
2023-07-25 15:05:25 +02:00
heinrich5991 ec55e2ff90 test: Make it easier to generate multiple temporary filenames 2023-07-25 15:05:24 +02:00
Tater 4fe7aaa43f execute CFGFLAG_GAME configs on the client 2023-07-24 19:15:29 -05:00
marmare314 d4110529e4 implement zoom and drag in envelope editor 2023-07-24 22:58:26 +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
heinrich5991 e6725a9668
Merge pull request #6907 from Robyt3/Editor-File-Save-Default-Value
Set default name when saving map under new name or as copy
2023-07-24 19:01:12 +00:00
Robert Müller 566324c1f8 Fix "Multiplication result converted to larger type" alerts
Introduced by #6899.
2023-07-24 20:06:08 +02:00
Robert Müller eb8619e104 Set default name when saving map under new name or as copy
When using "Save as" and "Save copy" set the default map name in the file dialog to the name of the current map.
2023-07-24 19:02:43 +02:00
Tater d2d273b6e0 Respect ALLOW_HOOK_COLL flag 2023-07-23 15:54:18 -05:00
Tater a998363978 Use local inputs for direction arrows and aim line toggle 2023-07-22 22:57:20 -05:00
Edgar d11048ad36
Merge pull request #6903 from Robyt3/Game-Console-Antistatic
Support selecting text in both consoles at the same time, refactoring
2023-07-22 19:25:10 +00:00
Robert Müller e174c0bc08 Support selecting text in both consoles at the same time
Change static variables to member variables and move member variables from overall console class to the console instance class, so selection is tracked separately for console instances.
2023-07-22 13:49:53 +02:00
Robert Müller db62f5b189 Use IClient::GlobalTime instead of CConsole::TimeNow
Both functions track the time in seconds that has passed since some instant as a `float`. The specific start time is not relevant for calculations, therefore `IClient::GlobalTime` can be used instead of `CConsole::TimeNow`.
2023-07-22 13:46:58 +02:00
Robert Müller d02904feea Fix inaccurate envelope calculation
Use `double` instead of `int` to represent the time in milliseconds in envelope calculation.

This fixes step-ladder patterns appearing with bezier curves and artifacts appearing when two points are very close together in time.
2023-07-21 17:45:44 +02:00
Robert Müller 58927cdc8d Use size_t more in engine graphics 2023-07-20 21:58:17 +02:00
Robert Müller 78e23062c9 Add assertions for graphics command buffer allocation
When memory for a command or data in the command buffer cannot be allocated in `CGraphics_Threaded::AddCmd` and `CGraphics_Threaded::AllocCommandBufferData` the command buffer is cleared so it should always be possible to allocated memory successfully on the second try. Therefore assertions are added and the return values and inconsistent checks of the functions are removed.

The usage of `AddCmd` is simplified by automatically deriving an error message based on the type of the template parameter.
2023-07-20 21:58:17 +02:00
Robert Müller a96242b850 Extract CGraphics_Threaded::FindFreeTextureIndex function
To reduce duplicate code.
2023-07-20 21:58:16 +02:00
Robert Müller 3134d42ce6 Extract CGraphics_Threaded::FreeTextureIndex function
To reduce duplicate code.
2023-07-20 21:58:16 +02:00
Robert Müller b432feb9b0 Add assertion in CGraphics_Threaded::LoadTextureRawSub
To check for invalid texture handle.
2023-07-20 21:58:16 +02:00
Robert Müller 21bbc8be61 Improve filename length check for images
Only add assertion to prevent empty filename, as this causes Valgrind to crash.

Handle empty filename used for special null-image separately in gameclient.
2023-07-20 21:58:16 +02:00
ChillerDragon 1c023772f3 Init variables used by goto_switch and goto_tele 2023-07-20 20:26:15 +02:00
marmare314 972fc717a6 keep selection when moving layers fixes #6787 2023-07-19 15:24:00 +02:00
marmare314 c9bd00b2ec make all quadpoints selectable with boxselect 2023-07-19 13:20:42 +02:00
heinrich5991 27b812287e
Merge pull request #6871 from Robyt3/UI-LastActiveItem-Cleanup
Remove usages of `CUI::LastActiveItem`
2023-07-19 10:54:07 +00:00
Robert Müller 3991d19966
Merge pull request #6887 from ChillerDragon/pr_goto_switch_tele
Add ``goto_switch`` and ``goto_tele``
2023-07-18 17:18:00 +00:00
ChillerDragon fb8d2a18d5 Add `goto_switch and goto_tele`
Set the clients view to a given teleporter or switch number
2023-07-18 14:34:51 +02:00
Robert Müller 6ee3928665 Fix ingame animations not using correct envelope points anymore
Add `CMapBasedEnvelopePointAccess::SetPointsRange` function so the start point and number of points that should be considered when using this envelope point storage can be configured. In the editor, this range always includes all points, as each envelope directly stores only its own points, so animations were rendered correctly there. However, all points are stored in one array when loading them from the map file (i.e. when rendering the map ingame), so the start point and number of points specified for the envelopes have to be considered when accessing their envelope points.

Closes #6886.
2023-07-18 12:43:31 +02:00
Robert Müller 47f4f21266 Remove usages of CUI::LastActiveItem
Use `CLineInput::GetActiveInput` and `CLineInput::IsActive` instead for consistency.

The last active item pointer is now only tracked internally in `CUI` to deactivate the active line input when it's no longer used in the UI.
2023-07-16 20:49:03 +02:00
Robert Müller 8abf9a7549 Use temporary file when saving editor map
Write the map to a temporary file first. When the map was saved to the temporary file successfully, first delete the existing map file having the real filename, then rename the temporary file to the real filename.

If deleting or renaming fails, show an error message popup and log an error message to the console.

The implementation is consistent with the way temporary files are utilized by Microsoft Word, so this should work on Windows.

See: https://support.microsoft.com/en-us/topic/description-of-how-word-creates-temporary-files-66b112fb-d2c0-8f40-a0be-70a367cc4c85

Different from #4482, this first deletes the old map file before renaming the temporary file. Although it appears that renaming a file would also override the target file, it could be that this does not work on all systems. Additionally, this adds descriptive error messages in the cases of failure.

Closes #4476.

Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2023-07-16 20:26:11 +02:00
Robert Müller a7f29568a2 Rename variable df to Writer 2023-07-16 19:26:01 +02:00
heinrich5991 9c0c7550ba Don't support loading RGB images ingame
They're essentially unused and not supporting them ingame probably
allows to keep that part of the map format unused.

See https://github.com/ddnet/ddnet/pull/5737#issuecomment-1538284956 or
https://github.com/teeworlds/teeworlds/issues/2812.
2023-07-16 15:26:00 +02:00
Dennis Felsing 8d12bceae4
Merge pull request #5737 from Robyt3/Map-Format-Port
Support bezier envelope curves in maps and editor, forward compatiblity for upstream map item changes
2023-07-16 12:27:10 +00:00
Robert Müller 1acb94ffbf Use lambdas for editor index modify and sort functions
For cleaner code with less global state variables.
2023-07-16 13:29:48 +02:00
Robert Müller 54df98be37 Support loading CMapItemImage version 2
This map item version adds the `m_Format` field, which specifies the image format for embedded images. The default value is `CImageInfo::FORMAT_RGBA` for map items of the previous version.
2023-07-16 12:46:34 +02:00
Robert Müller 4ae0928b47 Support bezier envelope curves in maps and editor
Port map and editor support for `CURVETYPE_BEZIER` from upstream, i.e. support bezier curves with configurable in- and out-tangents for every envelope point.

The in- and out-tangents are represented by triangles and can be dragged in the envelope editor like the envelope points.

Support reading and writing the bezier information as a separate UUID-based map item. If the bezier information is not found, bezier will default to linear behavior. Old clients will still be able to read the new maps and ignore the unknown map item. The unknown curvetype will also be handled as linear by old clients.

Allow reading upstream maps that use `CMapItemEnvelope` version 3. On upstream, a different struct is used to store all envelope points including bezier information, which broke compatibility to old clients.

Fix holding Ctrl for slow envelope point editing not working for vertical movement.

Highlight the currently selected element (envelope point or bezier tangent marker) which is being used with the value/time edit boxes.

Hide the value/time edit boxes when no element is selected.
2023-07-16 12:46:34 +02:00
Robert Müller 785f03e73a Report actual data sizes in CDataFileReader::GetDataSize
Previously it reported the internal file data size (compressed). This
made the `map_resave` tool do the wrong job.

Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2023-07-16 12:46:33 +02:00
Robert Müller 32f2fe936a Extract CMap::ExtractTiles with more validation
To reduce duplicate code and to add validation for tile skip everywhere.

Add separate `CMapItemLayerTilemap::TILE_SKIP_MIN_VERSION` constant and change `CMapItemVersion::CURRENT_VERSION` back to the previous version, as maps with tile skip can be loaded but skip is not used when saving.
2023-07-16 12:46:33 +02:00
Robert Müller a92ab45c3c Also support loading maps with tilemap skip in front layer 2023-07-16 12:46:33 +02:00
oy 9c4b0c03b4 Finished skip tile based map loading 2023-07-16 12:46:33 +02:00
oy 19d78b9f40 Made client/server check for correct map version on load 2023-07-16 12:46:32 +02:00
devdenn 7f100e2620 Fix bug, increase dump_log max seconds to 10min 2023-07-15 14:57:12 +00:00
Dennis Felsing 265eb69284 Destroy engine before graphics (fixes #6857) 2023-07-15 10:52:04 +00:00
Robert Müller 53fad543c0 Fix editor modified state not updated for server settings changes
Closes #6856.
2023-07-15 10:10:26 +00:00
Robert Müller 9788763ce8 Use member instead of static variables in CGameClient 2023-07-15 10:09:18 +00:00
Robert Müller ba94727a8d Use member instead of static variables for confirm popup buttons
Otherwise this would cause issues when showing multiple confirm popups at the same time.
2023-07-15 10:08:05 +00:00
Robert Müller dd06e9ae1c Initially keep server list scrolled to the top
When first launching the client, keep the server list scrolled to the top instead of scrolling to the selected server.

Closes #6845.
2023-07-15 09:30:54 +00:00
Robert Müller cfdc696315 Delay "Ingame moved" warning in editor
Delay showing the warning for ingame movement until the player has stopped moving while the editor is open, so the warning doesn't show immediately when the player performs an action (like jumping) and opens the editor shortly after.

Closes #6852.
2023-07-14 22:34:33 +00:00
Robert Müller 65a64b6fc4 Fix server browser filter highlighting of non-ASCII text
By calculating the correct length of the string matched in the haystack using the added `end` parameter of `str_utf8_find_nocase`.

Closes #6850.
2023-07-14 17:18:21 +00:00
Robert Müller d382e09f9c Add end output parameter to str_utf8_find_nocase, add tests
Add optional `end` output parameter to `str_utf8_find_nocase` which is set to a pointer into the haystack after the matched string.

This is necessary because there are pairs of matching upper case and lower case Unicode characters with different byte length (e.g. both `I` and `İ` map to `i`), so the byte length of the string matched in the haystack may not be identical to the length of the needle string.
2023-07-14 17:18:21 +00:00
Jupeyy 19263caf4a
Merge pull request #6836 from Robyt3/Graphics-Invalid-Texture-Invalid
Fix invalid texture being invalid and causing crash with Vulkan
2023-07-14 09:59:19 +00:00
marmare314 974255b3ea fix quadpoint moving on selection 2023-07-14 07:49:16 +02:00
bors[bot] fc6bf6545b
Merge #6824
6824: Improve Multi-View UX r=Robyt3 a=Vy0x2

- [x] You can now see who you are spectating in the spectator menu and even add/remove people from it (left mouse button)
- [x] Teleports are now being processed slower (more smoothly)
- [x] Workaround for starting multi-view from free-view (chooses now the nearest player to be the focus)
- [x] Added two more important variables to be able to customize it for specific scenarios (youtubers)

before:
![screenshot_2023-07-09_18-34-29](https://github.com/ddnet/ddnet/assets/24738662/a2ff8b77-c626-4ac2-b200-1eea70f85213)
after:
![screenshot_2023-07-09_18-32-49](https://github.com/ddnet/ddnet/assets/24738662/a54f0b06-b228-43ac-a1fc-eab95e7d9c20)

Edit: Thats the feedback i got from people. Hope its okay.

## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [x] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: devdenn <denispaul43@gmail.com>
2023-07-13 20:52:43 +00:00
devdenn 3f201a45e7 Improve Multi-View UX
keep a bit more care with who we choose to spectate when frozen
only show active team as clickable in the spec menu
enable switchting teams in Multi-View by closing the spec menu
make the whole spectator menu clickablefix naming
twerk symbols a bit
remove unused ui
add more multi-view variables
add slow acceleration when teleported, add indication in spec menu
make players clickable in spectator menu
change focus with the spectator menu
2023-07-13 18:10:34 +02:00
VoxelDoesCode 36d8dd587c Send KillMsg for started + unlocked teams 2023-07-13 11:39:07 -04:00
bors[bot] 8d9843d934
Merge #6840
6840: Fix enter not working in server browser when no server selected, fix enter not working in editor save dialog when no map selected r=def- a=Robyt3


## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-07-13 13:26:25 +00:00
Robert Müller 71ed093b9e Fix enter not working in editor save dialog when no map selected 2023-07-13 14:19:15 +02:00
Robert Müller 8fad911b8b Fix enter not working in server browser when no server selected 2023-07-13 14:19:00 +02:00
Robert Müller 6cfdbd9986 Handle editor input events in OnUpdate instead of OnRender
To make input handling consistent with the gameclient. Also skip input events that are not valid, same as in the gameclient, as this otherwise causes input events to be handled multiple times.
2023-07-12 17:27:37 +02:00
Robert Müller da2da7b36f Fix editor hotkeys triggering while some editboxes are active
Replace `CEditor::m_EditBoxActive` which only works with editboxes created from the editor with `CLineInput::GetActiveInput` which also works for editboxes which are created by generic UI functions, e.g. the value selector editboxes of color pickers.
2023-07-12 17:27:22 +02:00
Robert Müller 8e2411f477 Fix invalid texture being invalid and causing crash with Vulkan
When starting with `dbg_stress 1` the invalid texture was never actually getting loaded, which was causing the client to crash when using the Vulkan backend and starting with `dbg_stress 1`.

Additionally ensure that the invalid texture is 16x16 pixels large and loaded with the texture flags to support usage for tile rendering.

Closes #6504.
2023-07-11 23:41:16 +02:00
bors[bot] c8eae4c512
Merge #6834
6834: Support showing multiple different error messages in editor r=def- a=Robyt3

Previously the same message popup context was used for all error messages. While multiple message popups could be opened at the same time, the message would always be the same for all, as the same buffer was used for all popups.

This is fixed by creating and destroying the message popup contexts dynamically, so there can be any number of message popups with different messages. Additionally, if a popup with an identical message is already open, it will first be closed and then reopened at the new position, to prevent duplicate message popups.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-07-11 21:30:03 +00:00
Robert Müller fcd219bf22 Support showing multiple different error messages in editor
Previously the same message popup context was used for all error messages. While multiple message popups could be opened at the same time, the message would always be the same for all, as the same buffer was used for all popups.

This is fixed by creating and destroying the message popup contexts dynamically, so there can be any number of message popups with different messages. Additionally, if a popup with an identical message is already open, it will first be closed and then reopened at the new position, to prevent duplicate message popups.
2023-07-11 20:24:41 +02:00
bors[bot] 3e5daf0a68
Merge #6833
6833: Support deleting/renaming demo folders, improve demo popups r=def- a=Robyt3

Support deleting and renaming folders in the demo browser. Only empty folders can be deleted.

Ensure only files and folders in the save directory can be deleted and renamed.

Also check if a folder with a demo rename/render filename already exists.

Fix broken `m_DemolistSelectedIsDir` checks by using `m_vDemos[m_DemolistSelectedIndex].m_IsDir` instead.

Append `.mp4` file extension only internally instead of appending it to the render filename lineinput, as this causes the file extension to appear when rendering doesn't start due an error message.

Use more efficient `FileExists` instead of `FindFile` to check if rendered demo video file already exists.

Change popup preconditions to assertions.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-07-11 17:38:32 +00:00
Robert Müller 44bcbef0c1 Support deleting/renaming demo folders, improve demo popups
Support deleting and renaming folders in the demo browser. Only empty folders can be deleted.

Ensure only files and folders in the save directory can be deleted and renamed.

Also check if a folder with a demo rename/render filename already exists.

Fix broken `m_DemolistSelectedIsDir` checks by using `m_vDemos[m_DemolistSelectedIndex].m_IsDir` instead.

Append `.mp4` file extension only internally instead of appending it to the render filename lineinput, as this causes the file extension to appear when rendering doesn't start due an error message.

Use more efficient `FileExists` instead of `FindFile` to check if rendered demo video file already exists.

Change popup preconditions to assertions.
2023-07-11 18:58:40 +02: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
Robert Müller 3a5228bb8f Use DoButton_Ex instead of DoButton_Tab
Reduce duplicate code.
2023-07-11 18:08:32 +02:00
Robert Müller c7c44705e1 Refactor rendering of editor mentions and modebar 2023-07-11 18:08:32 +02:00
bors[bot] c9642e103f
Merge #6819
6819: Improve demo browser layout r=heinrich5991 a=Robyt3

Use separate columns for icons and spacing like in the server browser.

Always show scrollbar for more consistent layout.

Show ellipsis if filename is too long, also for the filename shown in the demo player.

Hide number of markers and length if the demo is invalid.

Screenshots:
- Browser:
   - Before:
![Browser old](https://github.com/ddnet/ddnet/assets/23437060/55f4de41-e225-43eb-b07d-435cb4f9292d)
   - After:
![Browser new2](https://github.com/ddnet/ddnet/assets/23437060/56005b8c-a4e9-47eb-80a3-50013a856852)
- Player:
   - Before:
![Player old](https://github.com/ddnet/ddnet/assets/23437060/ef74c873-a62a-4184-8f90-08289ab2b829)
   - After:
![Player new2](https://github.com/ddnet/ddnet/assets/23437060/54f06bfa-28a8-480a-9125-f5ff9ffc81e0)

## Checklist

- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-07-11 15:33:00 +00:00
Robert Müller ea219d9c15 Perform sanity check and show errors when loading map in editor
Add `CEditorMap::PerformSanityChecks` to perform additional sanity checks when loading a map in the editor.

In particular, the following is added: Check if there are any images with a width or height that is not divisible by 16 which are used in tile layers. Reset the image for these layers, to prevent crashes with some drivers.

Closes #6519.
2023-07-10 23:39:18 +02:00
bors[bot] 96cc09bad7
Merge #6827
6827: Fix hook-through not being fully removed when filling selection r=def- a=Robyt3

Closes #6782.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-07-10 19:39:03 +00:00
Robert Müller 756740e57e Fix hook-through not being fully removed when filling selection
Closes #6782.
2023-07-10 21:28:30 +02:00
Robert Müller e0cc11e617 Rename variables tile to Tile 2023-07-10 21:27:51 +02:00
Robert Müller 01e4eb1b8c Fix text wrapping with long Unicode strings
Rewind one unicode codepoint instead of rewinding only one character (byte) when text does not fit.

Closes #6810.
2023-07-10 17:50:24 +02:00
Robert Müller eb79b17308 Improve demo browser layout
Use separate columns for icons and spacing like in the server browser.

Always show scrollbar for more consistent layout.

Show ellipsis if filename is too long, also for the filename shown in the demo player.

Hide number of markers and length if the demo is invalid.
2023-07-09 10:47:04 +02:00
Robert Müller 9efab4964b Add parameter to force showing scrollbar with listbox 2023-07-09 10:47:04 +02:00
Dennis Felsing b376fbb331 Version 17.1.1 2023-07-09 00:15:42 +02:00
bors[bot] 0684d5e1a7
Merge #6820
6820: Improve demo (video) renderer UX r=def- a=Kaffeine

<!-- What is the motivation for the changes of this pull request? -->
In this MR I want to address three issues with video recorder:
1. A bug: if I start a rendering with 0.25x speed and click on 'Increase the speed' during the rendering, I expect to get the next speed (0.5x) but as the speed index is not set (kept default `4`), the speed is boosted to 1.25x.
2. Usecase: I want to adjust the camera (change position, decrease zoom, etc) for the demos and I don't want to use extra video editor to cut the first frames with the unwanted camera moves/setups from the demo. I came to a simple solution: start the rendering pre-paused to do the needed adjustments before anything is added to the video.
3. NotABug: All recorded video files have double `.demo.mp4` extension which is ugly.

Probably I have to change something to fit DDNet codebase. E.g. I don't know if `Localize("(paused)")` is acceptable here.

<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->

## Before
![image](https://github.com/ddnet/ddnet/assets/374839/7273dd5b-e3d1-4f73-87bd-e09493d106a0)

## After
![image](https://github.com/ddnet/ddnet/assets/374839/7d62028d-04bc-45af-babf-5a2e8cb243dc)

## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Alexander Akulich <akulichalexander@gmail.com>
2023-07-08 15:04:37 +00: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 7802dc2760 Client: Omit '.demo' extension from the video file name 2023-07-08 15:43:42 +03:00
bors[bot] 4260d51dd9
Merge #6823
6823: Mark `NETMSGTYPE_CL_STARTINFO` as `MSGFLAG_FLUSH` r=def- a=Robyt3

This makes the client connect to the server faster. It's especially noticeable on servers with a low ping.

Closes #6811.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-07-08 10:17:17 +00:00
Robert Müller 4ee75c8946 Mark NETMSGTYPE_CL_STARTINFO as MSGFLAG_FLUSH
This makes the client connect to the server faster. It's especially noticeable on servers with a low ping.

Closes #6811.
2023-07-08 12:00:49 +02:00
Robert Müller fa65e19c5d Close quad point popup when selected quad or quad index invalid 2023-07-08 11:43:07 +02:00
Robert Müller 2cc03a1444 Closes all popup menus when loading map in editor
The targets of many popup menus become invalid when loading or creating a new map with the editor hotkeys, so all popup menus have to be closed in this case, otherwise this can cause crashes with several different popups.
2023-07-08 11:42:46 +02:00
Robert Müller 8de39e769c Remove dead code of removed undo feature 2023-07-08 11:42:40 +02:00
Alexander Akulich c172b369b2 Client: Set the speed index on demo rendering (fix later speed changes) 2023-07-08 04:09:48 +03:00
Alexander Akulich f93c6c7659 IDemoPlayer: Make SetSpeedIndex() actually set index 2023-07-08 04:09:46 +03:00
Alexander Akulich 0a657225ce CDataFileWriter: Make it clear that Add methods do not modify the data 2023-07-08 02:44:53 +03:00
bors[bot] 74789f86dc
Merge #6818
6818: Fix HUD PlayerState weapons rendering r=def- a=Kaffeine

<!-- What is the motivation for the changes of this pull request? -->
The proper offset for the first available weapon is provided only for Hammer but sometimes (in some mods) the character has no hammer and the icons got a wrong left margin.

### Current code

83a2ad0e24/src/game/client/components/hud.cpp (L882-L895)

Notice the `x -= 3;` in the hammer rendering branch. It fixes the `x` offset for this and further weapons but it works only if the character has a hammer (other weapons has no such line).
`-3` is specific for the hammer, we need different "first item" offsets for other weapons.

## Before

![image](https://github.com/ddnet/ddnet/assets/374839/419f97be-d1e3-4eff-94a6-387e89d6ef64)
(the hammer offset is _correct_)

![image](https://github.com/ddnet/ddnet/assets/374839/400ab01f-02a2-4d2a-bd6f-97806e12cbef)
but if the character has no hammer then the things go _wrong_.

![image](https://github.com/ddnet/ddnet/assets/374839/262e45a5-cee8-45b9-bd8b-a982761a5dc5)
Shotgun/Grenade Launcher/Laser has just a small offset but the _wrong_ placement of katana indicator if very noticeable.

<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->

## After
![image](https://github.com/ddnet/ddnet/assets/374839/af24c361-228e-4461-b7ea-0b4531ffedf0)
(no difference in the hammer icon rendering)

![image](https://github.com/ddnet/ddnet/assets/374839/04b30b2e-5560-431d-a949-b37b63e27b9e)
(fixed gun offset)

![image](https://github.com/ddnet/ddnet/assets/374839/5abb5be3-212c-48b1-9c78-169441d6442e)
(fixed shotgun offset)

![image](https://github.com/ddnet/ddnet/assets/374839/918ef960-162e-4942-916f-b8eb9802c2e4)
(fixed grenade launcher offset)

![image](https://github.com/ddnet/ddnet/assets/374839/7a8e1257-590b-4589-877a-51f90298d6f7)
(fixed laser offset)

![image](https://github.com/ddnet/ddnet/assets/374839/157258b6-f7de-4411-8b63-140083b883c3)
(fixed katana offset)

## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Alexander Akulich <akulichalexander@gmail.com>
2023-07-07 18:45:19 +00:00
bors[bot] 6dcb2d1828
Merge #6663
6663: New spectate mode (multiview) r=def- a=Vy0x2

<!-- What is the motivation for the changes of this pull request? -->

Adding a new spectator mode, that can spectate a team by moving the camera in the middle and zooming in/out
Works with team 0 or any team, but you have to work with it a bit to get used to it. I tried to make it as intuitive as possible.
Pr is as ready as it can get, please test it.

![screenshot_2023-06-30_19-17-42](https://github.com/ddnet/ddnet/assets/24738662/0446d568-d34b-4d14-8682-dd077f121e91)

Youtube video:<a href="http://www.youtube.com/watch?feature=player_embedded&v=7GM6DA3EYAI" target="_blank">
 <img src="http://img.youtube.com/vi/7GM6DA3EYAI/maxresdefault.jpg" alt="Watch the video" width="192" height="108"/>
</a>


<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->

## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [x] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: devdenn <denispaul43@gmail.com>
Co-authored-by: Vy0x2 <denispaul43@gmail.com>
2023-07-07 18:24:44 +00:00
Alexander Akulich bf956c4c1c CHud::RenderPlayerState: Rework weapons rendering (+provide offsets) 2023-07-07 21:07:17 +03:00
Alexander Akulich ba7be6982d CHud::RenderPlayerState: Split ninja state rendering 2023-07-07 20:56:53 +03:00
Alexander Akulich a2ad543877 CHud: Refactor weapons rendering (1/3) 2023-07-07 20:56:50 +03:00
Robert Müller 7eb79fdcec Fix editor crash when filling entities layer with empty brush
The brush passed to `FillSelection` can be `nullptr` when the selection is empty.

Regression from #6648.

Closes #6815.
2023-07-07 19:22:16 +02:00
Dennis Felsing f3e7d55bfc Version 17.1 2023-07-07 00:28:55 +02:00
bors[bot] f63ff6237b
Merge #6809
6809: Fix text alignment in large confirmation popups with long text, increase buffer size for generic popup message  r=edg-l a=Robyt3

Closes #6806.

The message can contain a filename, so it should be large enough to contain that and the message itself.

Screenshots:
- Before: 
![screenshot_2023-07-04_18-09-12](https://github.com/ddnet/ddnet/assets/23437060/39cd4761-8cd0-4ac1-a24a-5115c8eed8c9)
- After:
![screenshot_2023-07-04_21-43-45](https://github.com/ddnet/ddnet/assets/23437060/c8f05f83-3f32-445a-8451-3a8be14a6007)
- Before (filename is truncated): 
![screenshot_2023-07-04_21-49-49](https://github.com/ddnet/ddnet/assets/23437060/16dfade5-f330-45b8-ac2f-1bc0d9a3fda1)
- After (full filename is shown):
![screenshot_2023-07-04_21-49-33](https://github.com/ddnet/ddnet/assets/23437060/eae1d789-f8e4-45c4-853e-ba655ab98168)

There is a separate issue with the text wrapping not working correctly with this long Unicode filename, which is causing the font size to decrease instead. See #6810.

## Checklist

- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-07-04 20:06:14 +00:00
Robert Müller 89a52812cd Increase buffer size for generic popup message
The message can contain a filename, so it should be large enough to contain that and the message itself.
2023-07-04 21:41:53 +02:00
Robert Müller 3f50729fc2 Fix text alignment in large confirmation popups with long text
Closes #6806.
2023-07-04 21:40:47 +02:00
Robert Müller ef7a8d6cc6 Fix online clan friends not being removable via UI 2023-07-04 18:16:18 +02:00
bors[bot] 06fe73619e
Merge #6752
6752: Ensure `ListDirectory/Info` entries are unique, support selecting storage location in demo browser and editor file browser r=def- a=Robyt3

Description in commits below. Screenshots/video:

- Storage location selection for demos:
![screenshot_2023-06-18_17-25-23](https://github.com/ddnet/ddnet/assets/23437060/bcc94977-50ba-494b-894d-7bd8fea7f91e)

- Storage location selection for maps:
![screenshot_2023-06-18_17-25-33](https://github.com/ddnet/ddnet/assets/23437060/2b8b7822-b4b9-409f-86eb-e44f5c072541)

- Link to "themes" folder:
![screenshot_2023-06-18_17-26-02](https://github.com/ddnet/ddnet/assets/23437060/eba661a6-0bee-4977-ab95-35e400b5b291)

- Video showing navigation between storages (`temp` is the save directory and `temp2`, `temp3` and `data` are other storages)

https://github.com/ddnet/ddnet/assets/23437060/5736d212-3848-44c2-aa81-7f2da9b98008

Closes #5496.

## Checklist

- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-07-03 19:05:42 +00:00
Robert Müller a4465ab8d6 Render editor pressed keys and saving message behind file dialog
The messages were previously rendered on top of the file dialog and popup menus.
2023-07-03 20:25:36 +02:00
Robert Müller f19d102f70 Support selecting storage location in editor file browser
Initially the file browser (maps, images, sound) shows the files from all storage locations combined like before when opening a file for reading. When saving a map, only the save storage location is shown and used like before.

The folder ".." is now also shown in the root folder, to navigate up to the storage location selection, if more than one storage location is present where a "maps"/"mapres" folder exists (whichever the dialog is currently showing). Only the locations where one of those folders exists are shown in the storage location selection. Additionally "All combined" can be selected to go back to the combined view.

The "Show directory" button behavior is adjusted so that the folder that contains the currently selected item is opened. When the storage location selection is shown, the button opens the selected storage location instead.

When navigating to the parent folder, the previous folder is now initially selected instead of resetting the selection.

Add a link to the "themes" folder same as the link to the "downloadedmaps" folder to allow easier access to the themes with the map editor.

The "folder tree" icon which is used for the ".." folder is now also used for the folder links in the storage location selection and for the links to the "downloadedmaps" and "themes" folders.

Always sort links above normal folders but below the ".." folder.

Fix alignment of font icons by using the correct flags.
2023-07-03 20:06:40 +02:00
Robert Müller e1035c3319 Support selecting storage location in demo browser
Initially the demo browser shows the demos from all storage locations combined like before.

The folder ".." is now also shown in the root folder, to navigate up to the storage location selection, if more than one storage location is present where a "demos" folder exists. Only the locations where one of those folders exists are shown in the storage location selection. Additionally "All combined" can be selected to go back to the combined view.

When navigating to the parent folder, the previous folder is now initially selected instead of resetting the selection.

The "Demos directory" button behavior is adjusted so that the folder that contains the currently selected item is opened. When the storage location selection is shown, the button opens the selected storage location instead.

The "folder tree" icon which is used for the ".." folder is now also for the folder links in the storage location selection.

Fix alignment of font icons by using the correct flags.

The config variable `ui_demo_selected` is removed and replaced with an internal buffer. The selected demo was always reset when restarting anyway and this would also not work with demos in subfolders either.
2023-07-03 20:06:40 +02:00
Robert Müller b5524d6c52 Ensure ListDirectory/Info entries are unique
When multiple files or folder have the same name in multiple storage locations, only pass the first entry (file or folder, whichever comes first) to the callback. To prevent files with the same name form being listed multiple times, e.g. in the demo browser, editor file browser, and asset lists.
2023-07-03 20:06:40 +02:00
Robert Müller 569753125e Add IStorage::NumPaths to get number of storage locations 2023-07-03 20:06:39 +02:00
Robert Müller 2b64a66dc6 Improve font scaling of long editor texts, improve ellipsis
For long editor texts (group name, layer name, image name, sound name, file names, tooltips) make use of the font scaling and ellipsis functionality implemented in `DoLabel` instead of implementing it separately in the editor.
2023-07-02 23:34:58 +02:00
Robert Müller 0a7361090f Add ellipsis flag to DoLabel, support stop-at-end with max width
Add `SLabelProperties::m_EllipsisAtEnd` to render an ellipsis when using `DoLabel`.

Fix `m_StopAtEnd` and `m_EllipsisAtEnd` not working together with the automatic font scaling. Now the stop-at-end and ellipsis flags will only have an effect when the automatic font scaling has reached the minimum font size already.

Add `SLabelProperties` argument to `DoLabelStreamed` and adjust usages in server browser. Font scaling now has to be disabled explicitly for the server name, gametype and map, as these should use the stop-at-end flag without the font-scaling.
2023-07-02 23:34:58 +02:00
devdenn f397ba4346 Minor fixes 2023-07-02 19:56:50 +02: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
Robert Müller e2ef536e43 Fix incorrect popup being closed when gametile popup used
When selecting a gametile the layer popup was being closed instead of the top-most gametile popup.

Regression from #6503.
2023-07-02 12:43:30 +02:00
Robert Müller b252e7402b Fix height of layer popup when automapper properties shown
Regression from #6755.
2023-07-02 12:42:45 +02:00
bors[bot] c955905662
Merge #6796
6796: CSound: Initialize all members (fixes #6795) r=Robyt3 a=def-

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2023-07-02 09:23:09 +00:00
trml 8335fdae79 Fix wrong predicted reload timer after ninja pickup 2023-07-02 02:22:12 +02:00
Dennis Felsing 69ba84e62c CSound: Initialize all members (fixes #6795) 2023-07-01 19:50:20 +02:00
bors[bot] 4bd14933b8
Merge #6790 #6793
6790: Prevent /swap with paused players r=def- a=Robyt3

Prevent swapping if either of the players is paused (i.e. their character is not in the gameworld), as this can cause them to be stuck in midair after swapping, which can be exploited to skip parts.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [X] Tested in combination with possibly related configuration options (servers with `sv_pauseable 0` were and are unaffected)
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


6793: Use `std::vector` and `std::deque` instead of most `std::list`s r=def- a=Robyt3

Use `std::vector` in cases where elements are only inserted at the end of the collection.

Use `std::deque` in cases where elements are only inserted/deleted at the beginning/end of the collection.

Use `std::list` in the remaining single case where elements are being removed from arbitrary positions and added at either the beginning or the end of the collection.

Adjust variables names. Don't use separate prefix for `std::deque`s and `std::list`s, as they are only used very rarely. Closes #6779.

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-07-01 16:04:13 +00:00
bors[bot] a2d2f32ded
Merge #6792
6792: Fix proximity radius of predicted pickups r=def- a=trml

Radius was set to 0 before this, so pickups were sometimes not predicted.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: trml <trml@users.noreply.github.com>
2023-07-01 15:44:57 +00:00