Commit graph

13560 commits

Author SHA1 Message Date
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
Robert Müller bc73ea30c7 Use std::vector and std::deque instead of most std::lists
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.
2023-07-01 15:44:35 +02:00
trml 678e3cad0c Set physsize of predicted pickups 2023-07-01 14:07:03 +02:00
Robert Müller 8d890e6773 Remove unused GraphicsThread/GraphicsThreadProxy declarations 2023-07-01 13:41:49 +02:00
Robert Müller c6b4302b21 Prevent /swap with paused players
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.
2023-07-01 11:01:18 +02:00
Dennis Felsing 9ea16f660b Add new contributors for 17.1 2023-07-01 09:43:00 +02:00
Vy0x2 0b8ed51614
Merge branch 'master' into pr-poc-mv-clean 2023-06-30 18:07:12 +02:00
devdenn d16fb877dc Add multi view 2023-06-30 18:03:24 +02:00
bors[bot] 3d60334d10
Merge #6786
6786: Fix inconsistent size and corners of connect button r=def- a=Robyt3

The connect button had `5.0f` units less width, which was causing the corners of the refresh and connect buttons to look differently.

Screenshots:
- Before: 
![connect-button old](https://github.com/ddnet/ddnet/assets/23437060/1ed567b9-d108-4a7a-9141-c43fab89d4aa)
- After:
![connect-button new](https://github.com/ddnet/ddnet/assets/23437060/e054018d-cd2d-4257-96c4-e1d57e111c68)

## 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-06-30 14:00:03 +00:00
Robert Müller 3159cc58fb Fix inconsistent size and corners of connect button
The connect button had `5.0f` units less width, which was causing the corners of the refresh and connect buttons to look differently.
2023-06-30 15:52:24 +02:00
bors[bot] b6eb2eb3eb
Merge #6776
6776: Allow 'bind x' to be used like 'binds x' r=def- a=ArijanJ

<!-- What is the motivation for the changes of this pull request? -->
This makes the 'bind' command optionally take only one argument, in which case it behaves like 'binds x'. This falls in line with how most popular games do it, and may prevent confusion in the future.

![image](https://github.com/ddnet/ddnet/assets/56356662/893508af-2b64-405f-be2c-da65387063aa)

This introduces a tiny bit of duplication though, because I just copied the if statement from 'binds', but it should be fine.

<!-- 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: ArijanJ <ajakshik@gmail.com>
2023-06-30 07:42:34 +00:00
Jupeyy 251edfd756 Continue sleeping, with cl_refresh_rate if packet waked client up 2023-06-28 21:02:41 +02:00
bors[bot] 05ddfba954
Merge #6755
6755: Remove individual RGBA sliders from editor color picker, add shift+rightclick/leftclick to copy/paste color in editor r=Jupeyy a=Robyt3

Remove the individual RGBA sliders for editor color pickers and only show one button that opens the color picker popup instead.

Decrease size of layer and point popups that previously had color properties which need less space now.

Support shift-rightclicking color picker buttons to copy the color to the clipboard in RRGGBBAA hex format.

Support shift-leftclicking color picker buttons to paste a color from the clipboard in RGB, RGBA, RRGGBB or RRGGBBAA format with optional leading `#` or `$`.

Screenshots:
- Before:
![screenshot_2023-06-20_20-39-43](https://github.com/ddnet/ddnet/assets/23437060/4a8b230c-a66b-4e2a-9744-cb5f80f6a799)
- After:
![screenshot_2023-06-20_20-40-00](https://github.com/ddnet/ddnet/assets/23437060/517f90cf-06a5-4332-9eb8-6a87cbc91b32)
- After (color picker open):
![screenshot_2023-06-25_17-35-55](https://github.com/ddnet/ddnet/assets/23437060/30320b56-e4cb-4e93-bf7b-8cfc8d96620b)


Suggested by `@HiRavie` in https://github.com/ddnet/ddnet/pull/6743#issuecomment-1593886873, though it was easier and also looks better to me when the color picker button has exactly the same size as the other value selectors.

## 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-06-27 19:29:43 +00:00
ArijanJ 7e3ad335be Allow 'bind x' to be used like 'binds x' 2023-06-27 09:46:32 +02:00
bors[bot] 67ddd93401
Merge #6772
6772: Various minor demo player usability improvements r=def- a=Robyt3

- Also skip to beginning and end when there are no demo markers. Previously the buttons to skip to the next/previous demo marker were skipping to the end/beginning respectively, if there is no next/previous marker, but only if there were any map markers. Now the button immediately skip to the beginning/end also when there are no demo markers at all.
- Fix demo seeking not working at beginning and end.
- Pause demo playback when skipping to end. It's otherwise inconvenient when the playback continues, as it will immediate rewind to the beginning when reaching the end.
- Allow right-clicking slice buttons to reset cut beginning/end.

## 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-06-26 21:36:48 +00:00
bors[bot] 5d89b975be
Merge #6763
6763: Autosave copy of current editor map periodically to `auto` folder, use separate thread to finish saving maps, add saving indicator r=def- a=Robyt3

A copy of the map currently open in the editor is saved every 10 minutes to the `maps/auto` folder (interval configurable, see below). The automatically saved map uses the filename of the original map with an additional timestamp. Per map name 10 autosaves are kept in the `auto` folder before old autosaves will be deleted (number configurable, see below).

Add config variable `ed_autosave_interval` (0 - 240, default 10) to configure the interval in minutes at which a copy of the current editor map is automatically saved to the 'auto' folder.

Add config variable `ed_autosave_max` (0 - 1000, default 10) to configure the maximum number of autosaves that are kept per map name (0 = no limit).

Autosaving will not take place in the 5 seconds immediately after the map was last modified by the user, to avoid interrupting the user with the autosave.
This will only delay autosaving for up to 1 minute though, so autosaves are not prevented entirely, should the user continuously edit the map.

When the editor is reopened after being closed for more than 10 seconds, the autosave timer will be adjusted to compensate for the time that was not spent on editing in the editor.

When the map is saved manually by the user the autosave file is also updated, if it's outdated by at least half of the configured autosave interval. This ensures that autosaves are always available as a periodic backup of the map.

When a copy of the current map is saved, this does not update the autosave and will also no longer reset the modified state. The modified state should reflect whether changes have been made that are not saved to the current map file. As saving a copy does not update the current file, the modified state should not be reset in this case.

Closes #6693.

Compressing the data with zlib takes the majority of the time when saving a datafile. Therefore, compressing is now delayed until the `CDataFileWriter::Finish` function is called. This function is then off-loaded to another thread to make saving maps in the editor not block the rendering.

A message "Saving…" is shown in the bottom right of the editor view while a job to save a map is running in the background.

While a map is being finished in a background thread another save for the same filename cannot be initiated to prevent multiples accesses to the same file.

Closes #6762.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [X] Tested in combination with possibly related configuration options
- [X] 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: Robert Müller <robytemueller@gmail.com>
2023-06-26 21:13:01 +00:00
Robert Müller d519ad194b Remove dead code
Checking `m_DemoPlayerState` is only necessary inside the demo player but not in the demo file browser.
2023-06-26 22:40:40 +02:00
Robert Müller ff454f6dc5 Allow right-clicking slice buttons to reset cut beginning/end 2023-06-26 22:40:31 +02:00
Robert Müller d9c737673a Pause demo playback when skipping to end
It's otherwise inconvenient when the playback continues, as it will immediate rewind to the beginning when reaching the end.
2023-06-26 22:40:23 +02:00
Robert Müller 84457980e9 Fix demo seeking not working at beginning and end 2023-06-26 22:40:16 +02:00
Robert Müller 5501a33148 Also skip to beginning and end when there are no demo markers
Previously the buttons to skip to the next/previous demo marker were skipping to the end/beginning respectively, if there is no next/previous marker, but only if there were any map markers. Now the button immediately skip to the beginning/end also when there are no demo markers at all.
2023-06-26 22:39:52 +02:00
Robert Müller 01b99f668a Fix images/sounds not being loaded with correct file extension
Regression from #6764.
2023-06-26 22:37:00 +02:00
Robert Müller 2126d8570f Use separate thread to finish saving maps, add saving indicator
Compressing the data with zlib takes the majority of the time when saving a datafile. Therefore, compressing is now delayed until the `CDataFileWriter::Finish` function is called. This function is then off-loaded to another thread to make saving maps in the editor not block the rendering.

A message "Saving…" is shown in the bottom right of the editor view while a job to save a map is running in the background.

While a map is being finished in a background thread another save for the same filename cannot be initiated to prevent multiples accesses to the same file.

Closes #6762.
2023-06-26 21:58:04 +02:00
Robert Müller 5c3e5bf67c Extract CEditor::RenderMousePointer function 2023-06-26 21:58:04 +02:00
Robert Müller 525c33f1b8 Extract CEditor::RenderPressedKeys function 2023-06-26 21:58:04 +02:00
Robert Müller 1810d972f4 Autosave copy of current editor map periodically to auto folder
A copy of the map currently open in the editor is saved every 10 minutes to the `maps/auto` folder (interval configurable, see below). The automatically saved map uses the filename of the original map with an additional timestamp. Per map name 10 autosaves are kept in the `auto` folder before old autosaves will be deleted (number configurable, see below).

Add config variable `ed_autosave_interval` (0 - 240, default 10) to configure the interval in minutes at which a copy of the current editor map is automatically saved to the 'auto' folder.

Add config variable `ed_autosave_max` (0 - 1000, default 10) to configure the maximum number of autosaves that are kept per map name (0 = no limit).

Autosaving will not take place in the 5 seconds immediately after the map was last modified by the user, to avoid interrupting the user with the autosave.
This will only delay autosaving for up to 1 minute though, so autosaves are not prevented entirely, should the user continuously edit the map.

When the editor is reopened after being closed for more than 10 seconds, the autosave timer will be adjusted to compensate for the time that was not spent on editing in the editor.

When the map is saved manually by the user the autosave file is also updated, if it's outdated by at least half of the configured autosave interval. This ensures that autosaves are always available as a periodic backup of the map.

When a copy of the current map is saved, this does not update the autosave and will also no longer reset the modified state. The modified state should reflect whether changes have been made that are not saved to the current map file. As saving a copy does not update the current file, the modified state should not be reset in this case.

Closes #6693.
2023-06-26 21:58:04 +02:00
bors[bot] d840233951
Merge #6765
6765: Add play/stop button and duration label for editor sounds  r=def- a=Robyt3

Add button to play/stop audio preview and label showing selected sound duration in editor sound list and sound file browser.

Show error message instead of preview in editor image/sound file browser when selected file cannot be loaded.

Screenshots:
- ![screenshot_2023-06-25_21-53-14](https://github.com/ddnet/ddnet/assets/23437060/a2eb810c-e132-4fa8-9d0d-730b78088651)
- ![screenshot_2023-06-25_21-53-01](https://github.com/ddnet/ddnet/assets/23437060/1a742abc-51f9-4526-aada-d941d42e481d)
- ![screenshot_2023-06-25_21-53-05](https://github.com/ddnet/ddnet/assets/23437060/bf500772-ab6b-409f-8cc4-1bfbaeae55eb)


## 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
- [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: Robert Müller <robytemueller@gmail.com>
2023-06-26 08:48:05 +00:00
Robert Müller af9c271a85 Fix editor save dialog filename showing file extension
Which was causing the listbox selection to be cleared when activating the filename editbox, as the filename search expects names without the file extension.
2023-06-25 21:51:36 +02:00
Robert Müller 030ffc10bb Add fs_split_file_extension to separate filename and extension 2023-06-25 21:51:36 +02:00
Robert Müller 2d70a38436 Add fs_filename to extract file/folder name from path 2023-06-25 21:51:36 +02:00
Robert Müller f8a4cee979 Add play/stop button and duration label for editor sounds
Add button to play/stop audio preview and label showing selected sound duration in editor sound list and sound file browser.

Show error message instead of preview in editor image/sound file browser when selected file cannot be loaded.
2023-06-25 21:41:12 +02:00
Robert Müller c25d20047b Add storage parameter to sound loading functions
So the storage type can be specified when loading sound files directly from the storage.
2023-06-25 21:25:34 +02:00
Robert Müller 72fbfaad46 Fix save copy callback not called when confirmation popup used
When using "Save Copy" to save a copy of the current map to a new file and selecting a file that already exists, a confirmation popup is shown. However, this confirmation popup did not differentiate between regular saving and saving a copy, so the regular save callback was always called.
2023-06-25 11:01:14 +02:00
Robert Müller e04eee9d44 Extract CEditor::HandleCursorMovement function 2023-06-25 11:01:14 +02:00
Robert Müller 4372932480 Remove unnecessary storage argument of CEditorMap::Load/Save
The editor map has a pointer to the editor, which has a pointer to the storage, so it's not necessary to pass the storage separately.
2023-06-25 10:50:06 +02:00
Robert Müller 34df022c79 Use IO_MAX_PATH_LENGTH for editor map saving and loading 2023-06-25 10:50:02 +02:00
Robert Müller 9ecb010579 Use IO_MAX_PATH_LENGTH in CFileCollection 2023-06-25 10:49:57 +02:00
Dennis Felsing e320c85fdd Fix bind crashes (fixes #6758) 2023-06-23 17:55:36 +02:00
Robert Müller c966b5d752 Show circle icon next to editor filename when unsaved changes
Show a circle icon next to the filename in the editor menu bar when there are unsaved changes in the current map.
2023-06-22 19:34:17 +02:00
Robert Müller 7d9f4e1cfb Increase size of info in editor menu bar, show X/Y decimal places
When the text is slightly longer (e.g. X and Y positions having multiple digits), the font size of the info text in the menubar decreases because not enough space is available.

Show one decimal place also for the current world X and Y position of the mouse, which allows to determine the position of the mouse inside the currently hovered tile.
2023-06-22 19:34:17 +02:00
Robert Müller 7b9823688f Add shift+rightclick/leftclick to copy/paste color in editor
Support shift-rightclicking color picker buttons to copy the color to the clipboard in RRGGBBAA hex format.

Support shift-leftclicking color picker buttons to paste a color from the clipboard in RGB, RGBA, RRGGBB or RRGGBBAA format with optional leading `#` or `$`.
2023-06-20 23:30:30 +02:00
Robert Müller 2db569374d Add color_parse function to parse strings as colors
Parses RGB, RGBA, RRGGBB and RRGGBBAA hex color formats into any `color4_base`.

Reuse code from color parsing in console.
2023-06-20 23:22:33 +02:00
Robert Müller f30682be04 Add color4_base::PackAlphaLast and UnpackAlphaLast
So pack and unpack colors as 4 byte unsigned values with the alpha component last. Existing functions assume that alpha is the first component.
2023-06-20 23:22:33 +02:00
Robert Müller 0aa55e224c Add str_isallnum_hex
To check if string contains only `[0-9a-zA-Z]`.
2023-06-20 23:01:55 +02:00
Robert Müller bb5e203f3a Remove individual RGBA sliders from editor color picker
Remove the individual RGBA sliders for editor color pickers and only show one button that opens the color picker popup instead.

Decrease size of layer and point popups that previously had color properties which need less space now.
2023-06-20 20:51:31 +02:00
bors[bot] e22e0c9777
Merge #6750
6750: Select new demo file after renaming and slicing demo, scroll to selected demo when sorting, refreshing etc. 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-06-16 22:07:53 +00:00
Robert Müller 4ac3358e8e Scroll to selected demo when sorting, refreshing etc. 2023-06-16 22:44:25 +02:00
Robert Müller abfd9333b0 Select new demo file after renaming and slicing demo 2023-06-16 22:43:51 +02:00
bors[bot] 96927e1b6a
Merge #6747
6747: Fix uninitialized `CLineInput` member variables r=def- a=Robyt3

Closes #6745.

## 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-06-16 20:26:27 +00:00
bors[bot] 9ebcdf4b15
Merge #6748 #6749
6748: When all DDNet filter entries selected, deselect with right click r=def- a=Robyt3

Allow deselecting just one filter entry by right clicking the entry (country or game type) when all entries are currently selected (i.e. none are excluded). Previously the first right click always deselected all filters except the clicked one (same as the left click).

Closes #6746.

## 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)


6749: Fix alignment of font icon buttons in editor, use font icon for editor proof mode selection button r=def- a=Robyt3

Before:
![screenshot_2023-06-16_18-00-17](https://github.com/ddnet/ddnet/assets/23437060/65cb056a-eadc-4037-83b1-ad50af0980a3)

After:
![screenshot_2023-06-16_17-59-17](https://github.com/ddnet/ddnet/assets/23437060/c17ae4ed-971c-49ed-a430-951614e553bc)

## 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-06-16 19:57:40 +00:00
Robert Müller fa787d354e When all DDNet filter entries selected, deselect with right click
Allow deselecting just one filter entry by right clicking the entry (country or game type) when all entries are currently selected (i.e. none are excluded). Previously the first right click always deselected all filters except the clicked one (same as the left click).

Closes #6746.
2023-06-16 17:53:44 +02:00
Robert Müller 5b3efaa4cd Fix uninitialized CLineInput member variables
Closes #6745.
2023-06-16 17:39:44 +02:00
Robert Müller e51fe4a86e Use font icon for editor proof mode selection button 2023-06-14 23:14:24 +02:00
Robert Müller d172d63815 Fix alignment of font icon buttons in editor 2023-06-14 23:14:23 +02:00
Robert Müller 34c2e5649b Improve editor color picker popup
By replacing the editor specific color picker popup with the generic UI color picker popup.

Improve layout of the editor color picker button. Improve spacing and ensure that the button is square. Slightly enlarge button on mouse hover.
2023-06-14 20:36:06 +02:00
Robert Müller 7ce9fd9949 Refactor UI color picker
- Improve variable names.
- Use `ColorHSVA` instead of `unsigned int`.
- Allow `m_pHslaColor` to be `nullptr` when HSLA color unused.
2023-06-14 20:17:27 +02:00
bors[bot] b938202ade
Merge #6742
6742: Run MysqlUninit later (fixes #6571) r=def- a=def-

Otherwise the mysql thread can still be running in the background while we uninitialize it.

## 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-06-14 11:35:21 +00:00
Dennis Felsing 021837fa60 thread_init_and_detach shouldn't return thread since you can't access it anymore anyway 2023-06-14 13:19:36 +02:00
Dennis Felsing 7e82bf3a53 Run MysqlUninit later (fixes #6571) 2023-06-14 13:12:48 +02:00
Dennis Felsing 35e4a2b311 Actually use AntibotFlags 2023-06-14 11:25:26 +02:00
bors[bot] 6cfac056ec
Merge #6740
6740: Don't remove the `.map` suffix in editor file dialog r=def- a=Robyt3

This otherwise breaks file loading because the file extension is expected in this input buffer even when the input is not rendered.

Regression from #6736.

## 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-06-13 23:44:52 +00:00
Robert Müller 090433bc5e Don't remove the .map suffix in editor file dialog
This otherwise breaks file loading because the file extension is expected in this input buffer even when the input is not rendered.

Regression from #6736.
2023-06-14 00:43:35 +02:00
Robert Müller 3ad581aeb8 Ensure proper buffer size is used with DDNet server filter
By passing the buffer size when calling `DDNetFilterAdd` and `DDNetFilterRem`.

Mark functions and pointer parameters as `const`.
2023-06-14 00:04:01 +02:00
Robert Müller 3069733b86 Add tests for str_append and for templated str_copy 2023-06-14 00:04:01 +02:00
Robert Müller 410ccda1c7 Move templated str_copy next to basic function
The functions were only separated because we previously had a large `extern "C"` block.
2023-06-14 00:04:01 +02:00
Robert Müller 9a57def5a6 Add templated str_append function for arrays with fixed size 2023-06-14 00:04:01 +02:00
bors[bot] 183086700f
Merge #6737
6737: Refactor `str_copy` usages and buffer sizes in editor r=def- a=Robyt3

Use templated `str_copy` function in most cases to specify the correct buffer size.

Fixes two cases where the buffer size was hard-coded to a number.

Fix buffer size not being checked when copying auto mapper configuration name. Loading an auto mapper configuration with a name longer than 128 bytes could cause an out-of-bounds write.

Increase sizes of some text buffers that were potentially too small.

## 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-06-13 20:50:34 +00:00
Robert Müller bbe9f23a9c Refactor str_copy usages and buffer sizes in editor
Use templated `str_copy` function in most cases to specify the correct buffer size.

Fixes two cases where the buffer size was hard-coded to a number.

Fix buffer size not being checked when copying auto mapper configuration name. Loading an auto mapper configuration with a name longer than 128 bytes could cause an out-of-bounds write.

Increase sizes of some text buffers that were potentially too small.
2023-06-13 20:45:51 +02:00
Robert Müller b13e8076dc Fix editor save dialog entries not selectable with mouse anymore
Regression from #6530.
2023-06-13 19:51:54 +02:00
Robert Müller 40db5d3c1e Improve UI debug information
Move debug text from the top left to the bottom left, so it does not overlap with the other debug information.

Also render UI element address of next hot item.

Add labels for UI element addresses.
2023-06-12 19:48:54 +02:00
Robert Müller aa937d4fba Refactor CUI::Screen
Remove unnecessary temporary variables.

Remove unnecessary assignment of width and height values in constructor, which will always be overwritten.
2023-06-12 19:48:45 +02:00
Robert Müller 6eb30b00e2 Use nullptr instead of 0 2023-06-12 19:48:44 +02:00
Robert Müller b46a47f14b Remove unused active tooltip item variable 2023-06-12 19:48:42 +02:00
bors[bot] 4d0247a24c
Merge #6734
6734: Use `DoLabel` instead of `Text`/`TextEx` in menus, other minor refactoring of menus 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-06-11 20:36:46 +00:00
Robert Müller 2fb4a39e10 Refactor CMenus::RenderSettings
Use correct enum literal `SETTINGS_LENGTH` as array size for button containers instead of the `sizeof(apTabs)`, which does not consider the size of the array elements.

Use code for dynamic size calculation directly instead of putting it in comments.
2023-06-11 21:55:36 +02:00
Robert Müller 8d65e0ac34 Minor refactoring of settings menus
- Use `IGraphics::CORNER_NONE` instead of `0`.
- Remove redundant usage of `Localize` for an already localized string.
- Remove redundant `HSplitBottom` with zero size.
2023-06-11 21:55:36 +02:00
Robert Müller 16fd3401e2 Use DoLabel instead of Text/TextEx in menus
Reduce duplicate code for text alignment and automatic sizing.
2023-06-11 21:54:46 +02:00
Jupeyy 845ba50842 Split emoticon sending into nearby and global players 2023-06-11 13:31:50 +02:00
bors[bot] 6a53d72b35
Merge #6721
6721: Improve selection popups and dropdown menus, add dropdown menus to select screen and active controller r=def- a=Robyt3

Screenshots:
- Controls settings:
   - Before: 
![controls old](https://github.com/ddnet/ddnet/assets/23437060/8907c38a-d483-4766-84ad-49464b9760a0)
   - After: 
![controls new](https://github.com/ddnet/ddnet/assets/23437060/f021e961-ce90-4557-aef0-a1e1a4bc7ca4)
- Graphics settings (collapsed):
   - Before: 
![graphics_collapsed old](https://github.com/ddnet/ddnet/assets/23437060/d895c8d8-a72f-4da2-aa57-93d5f08be648)
   - After: 
![graphics_collapsed new](https://github.com/ddnet/ddnet/assets/23437060/e594a599-1210-4ba0-87f2-b2a824043dc4)
- Graphics settings (expanded):
   - Before: 
![graphics_expanded old](https://github.com/ddnet/ddnet/assets/23437060/cce1d8cb-4dff-4d43-a9f0-af2dbfeff27d)
   - After: 
![graphics_expanded_1 new](https://github.com/ddnet/ddnet/assets/23437060/c99c24cb-3398-4a80-9b99-3281ed62f6a7)
![graphics_expanded_2 new](https://github.com/ddnet/ddnet/assets/23437060/83fc2522-0da6-40d8-ad2b-3e3159b74308)
![graphics_expanded_3 new](https://github.com/ddnet/ddnet/assets/23437060/b00b30c4-411b-43a0-97f0-ecd47ebea516)
- The maximum dropdown menu height is limited to 40% of the screen height. The content will begin to scroll if this is exceeded:
![scrolling](https://github.com/ddnet/ddnet/assets/23437060/ac576819-f24f-4fed-82cd-a05d87f9ad71)
- If there is not enough space below the dropdown button to open the dropdown menu popup, then the popup opens to the top instead:
![alignment](https://github.com/ddnet/ddnet/assets/23437060/2f61ea30-996d-4def-8f5d-300b5008c666)

## 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
- [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: Robert Müller <robytemueller@gmail.com>
2023-06-10 14:01:38 +00:00
bors[bot] 5c3a3cefa6
Merge #6726
6726: Fix top alignment of some popup messages r=def- a=Robyt3

The popup message has to be top- and not middle-aligned in some popups:

- First launch
- Existing player for nickname
- Warning

Likely a regression introduced by #6511.

Before:

![screenshot_2023-06-09_14-23-56](https://github.com/ddnet/ddnet/assets/23437060/0a7250d4-4522-4924-b056-463eaa67f546)

After:

![screenshot_2023-06-09_14-23-21](https://github.com/ddnet/ddnet/assets/23437060/40776b1a-6571-4e8d-bb5a-6c11a5a5dbb9)

## 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-06-10 13:30:19 +00:00
Robert Müller 883fb8818c Minor refactoring of CAnimState and tee rendering functions
- Use `nullptr` instead of `0`.
- Remove dead code.
- Mark functions and pointers as `const` when possible.
- Remove unused argument of `CRenderTools::GetRenderTeeAnimScaleAndBaseSize` function.
- Copy tee render info when rendering emote wheel instead of modifying global render info.
- Fix names of static variables.
2023-06-10 13:10:26 +02:00
Robert Müller 1172be1f80 Fix undefined player vote/team change time
The time of the last kick vote and the time of the last team change are initially in an undefined state, which causes the kick vote and team change to fail due to the delay incorrectly being applied.

Closes #6723.
2023-06-10 10:23:27 +02:00
Robert Müller 7af1fe3b52 Fix top alignment of some popup messages
The popup message has to be top- and not middle-aligned in some popups:

- First launch
- Existing player for nickname
- Warning

Likely a regression introduced by #6511.
2023-06-09 14:22:21 +02:00
Robert Müller 5b3f6e8ffd Use dropdown menu to select game controller
Instead of using one button to cycle through all controllers.
2023-06-09 14:04:35 +02:00
Robert Müller 387a71ab0d Add dropdown to select screen and show screen name 2023-06-09 14:04:34 +02:00
Robert Müller a8b54192ab Use generic selection popup for drop down menus
Move `CMenus::RenderDropDown` to `CUI::DoDropDown` and refactor by using a generic selection popup to implement the drop down menu.

This improves the usability and layout, as the drop down is now rendered as a popup above the rest of the menu, instead of taking space from the menu that holds the drop down button. The latter could cause issues when several drop down menus are open at the same time and with drop down buttons at the bottom of the menu, as the drop down cannot scroll properly.
2023-06-09 14:04:34 +02:00
Robert Müller 082c8b8a7d Extend generic selection popup
- Support scrolling. Limit maximum height to 40% of screen height.
- Allow message to be empty.
- Use `std::vector` instead of `std::set` for entries to keep the user-defined order of entries.
- Add `m_SelectionIndex` in addition to `m_pSelection` to get selected item more conveniently for some use-cases.
- Make entry height, entry padding, entry spacing, font size, and popup width configurable.
- Allow alignment of selection popup with the top/bottom of another UI element.
- Support transparent selection buttons.
2023-06-09 14:04:20 +02:00
Robert Müller f0bb4a45d0 Allow adjusting popup border/background color
Add `SPopupMenuProperties` parameter object for `DoPopupMenu`.
2023-06-09 14:02:47 +02:00
Robert Müller bc70726b1c Add highlight color when hovering DDNet/KoG type/country filters 2023-06-08 16:10:58 +02:00
Robert Müller 60f56f4dce Support arbitrary number of type/country filter buttons 2023-06-08 16:10:28 +02:00
Robert Müller 09835ed342 Add scroll region parameter to disable right margin
In case that a margin on the right side already exists, this allows creating a symmetric margin around the scrollbar.
2023-06-08 12:52:35 +02:00
Robert Müller f16974d1a9 Extract CScrollRegion::HEIGHT_MAGIC_FIX
Currently this must be added when calculating the required height of a UI rect for a scroll region to get a perfect fit.

It is extracted into a constant so it can be used in other parts to get list boxes with the perfect size.
2023-06-08 12:52:35 +02:00
Robert Müller abfafa314a Add IGraphics::GetScreenName
To get the screen name for each screen index.
2023-06-08 12:52:34 +02:00
Robert Müller 4c9230999c Use DoScrollbarOption instead of DoScrollbarH for settings
Reduce duplicate code for handling label format, value scaling and special infinity value.

The current value is now shown for all settings. Previously it was not shown for some settings, e.g. the sound volumes.

The infinity-value is now all the way on the right side of the settings scrollbars, which makes more sense, as the values get larger when going to the right. This is also more convenient, as previously it was necessary to pass the lowest value before going to infinity, which would e.g. temporarily lag the client when selecting a low refresh rate.

Use logarithmic scrollbar for sounds volumes.

Hide scrollbar options that are disabled by checkboxes consistently. Previously this was only done for some checkboxes.
2023-06-08 11:01:57 +02:00
Robert Müller e0bdad8e4c Remove DoScrollbarOptionLabeled
Labeled scrollbar options are inconvenient to use.

For two values: use two buttons.

For three or more values: use a dropdown menu.
2023-06-08 10:41:42 +02:00
Robert Müller 651cfd9400 Improve joystick settings UI especially on 5:4 and 4:3 resolutions
Replaced labeled scrollbar option for selecting ingame controller mode with two button for relative and absolute controller mode.

Make better use of space for controller axis picker. Replace left column with just the axis number. Fix checkbox labels being very small on 5:4 and 4:3 resolutions.
2023-06-08 10:41:41 +02:00
Robert Müller 8bdffee5ca Improve scrollbar option UI
Split space for label and scrollbar in middle for consistent layout. Previously the label was just as large as it needed to be, which was causing differently sized scrollbars for all settings. Now the scrollbars have a consistent size.

Fix minimum scrollbar option value not being selectable when `Min > 0` and `SCROLLBAR_OPTION_INFINITE`.

Add optional suffix parameter to `DoScrollbarOption` to specify units/scales like `Hz` and `%`.

Support combining `SCROLLBAR_OPTION_INFINITE` and `SCROLLBAR_OPTION_NOCLAMPVALUE` flags.

Add `SCROLLBAR_OPTION_MULTILINE` flag for multi line scrollbar options where the label is above the scrollbar.
2023-06-08 10:41:41 +02:00
Robert Müller a3abc27b9a Fix escape not working in server browser and demo browser
Closes #6718.
2023-06-08 09:46:19 +02:00
bors[bot] 632b6216be
Merge #6716 #6717
6716: Improve usage of `CCountryFlags::Render` function r=def- a=Robyt3

Pass color by value instead of pointer to simplify usage.

Add separate function that accepts a country flag directly instead of an index.

## 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)


6717: Simplify list box activation handling, more highlighting fixes when popups are open r=def- a=Robyt3

Store the list box active state inside `CListBox` instead of tracking it separately with a pointer.

Allow activating list boxes by clicking the scrollbar. Previously it was only possible to activate list boxes by selecting an item.

Fix country selection list box in players settings not being deactivated properly when name/clan edit boxes are active, because wrong UI element IDs were being used.

Fix highlighting of menu tab buttons while popup open.

Fix highlighting of scroll region scroll bars while popup open.

## 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-06-07 20:09:13 +00:00
Robert Müller 55726e8da3 Simplify list box activation handling
Store the list box active state inside `CListBox` instead of tracking it separately with a pointer.

Allow activating list boxes by clicking the scrollbar. Previously it was only possible to activate list boxes by selecting an item.

Fix country selection list box in players settings not being deactivated properly when name/clan edit boxes are active, because wrong UI element IDs were being used.
2023-06-07 20:46:10 +02:00
Robert Müller de44e59bef Improve usage of CCountryFlags::Render function
Pass color by value instead of pointer to simplify usage.

Add separate function that accepts a country flag directly instead of an index.
2023-06-07 19:04:53 +02:00
Robert Müller 161f8442b7 Fix highlighting of scroll region scroll bars while popup open 2023-06-07 18:41:55 +02:00
Robert Müller e4909fba9e Fix highlighting of menu tab buttons while popup open 2023-06-07 18:41:45 +02:00
Jupeyy e3d825f119 Disallow multiple emotes in the same tick, respect high bandwidth setting 2023-06-06 19:05:31 +02:00
bors[bot] 17c06423d2
Merge #6711 #6712
6711: Improve color picker popup in settings (use new popup system, add alpha support, support mouse locking) r=def- a=Robyt3

Use the popup system ported from the editor to reimplement the color picker popup.

- Before: 
![screenshot_2023-06-05_21-57-46](https://github.com/ddnet/ddnet/assets/23437060/52d6adfa-7d62-4323-b6df-8d18a26b6cc6)
- After:
![screenshot_2023-06-05_21-57-26](https://github.com/ddnet/ddnet/assets/23437060/773115db-178c-48ab-a750-35b136a4fb30)

Remove special handling necessary for the hard-coded color picker.

Add alpha support to the color picker popup.

Support locking mouse position when dragging value selectors also in menus (color pickers), which improves usability of value selectors. Previously this was only supported in the editor.

Replace large HSLA scrollbar color picker for UI color setting with inline color picker popup:
- Before:
![screenshot_2023-06-05_21-57-57](https://github.com/ddnet/ddnet/assets/23437060/bb6cee4d-5438-40a3-b602-90abccc959ee)
- After:
![screenshot_2023-06-05_21-57-01](https://github.com/ddnet/ddnet/assets/23437060/e0a565a6-2956-403f-9fc0-4ab11a764400)


## 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)


6712: Fix crash when enabling `dbg_dummies` on running server r=def- a=Robyt3

The server normally needs to be reloaded to spawn the debug dummies, so this code was not checking if a debug dummy player exists. Decreasing the number of debug dummies while the server is running also causes them to simply not be snapped instead of completely destroying them.

For debugging any number of dummies can be useful, so the maximum number of debug dummies is increased to the maximum number of clients.

See #6702.

## 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: Robert Müller <robytemueller@gmail.com>
2023-06-05 21:56:58 +00:00
Robert Müller b21e98a227 Use color picker popup for UI color setting
Replace large HSLA scrollbar color picker for UI color setting with inline color picker popup.
2023-06-05 22:37:27 +02:00
Robert Müller e50bd4bb6c Add generic color picker popup to UI, add alpha support
Use the popup system ported from the editor to reimplement the color picker popup.

Remove special handling necessary for the hard-coded color picker.

Add alpha support to the color picker popup.
2023-06-05 22:37:27 +02:00
Robert Müller 938c57e03a Support mouse position locking in menus UI
Support locking mouse position when dragging value selectors also in menus (color pickers), which improves usability of value selectors.

Previously this was only supported in the editor.

When enabling locked mouse a UI element ID must be specified. The mouse lock is stopped when this element is no longer active. This ensures that the mouse doesn't gets stuck in this state when the value selector isn't active anymore.
2023-06-05 22:37:26 +02:00
Robert Müller ef217b69c9 Track updated mouse position in UI instead of menus
Simplify the UI usage for the menu by keeping the calculated mouse position variable together with the other mouse handling in `CUI`.
2023-06-05 22:37:26 +02:00
Robert Müller 68ea55e232 Move DoValueSelector to UI and refactor
Move `CMenus::DoValueSelector` to `CUI`.

Add parameter object `SValueSelectorProperties` for optional parameters to improve usability.
2023-06-05 22:37:26 +02:00
Robert Müller 4c80af7bd9 Fix crash when enabling dbg_dummies on running server
The server normally needs to be reloaded to spawn the debug dummies, so this code was not checking if a debug dummy player exists. Decreasing the number of debug dummies while the server is running also causes them to simply not be snapped instead of completely destroying them.
2023-06-05 22:30:52 +02:00
Robert Müller a5f94ecf80 Allow maximum number of debug dummies
For debugging any number of dummies can be useful.
2023-06-05 22:27:42 +02:00
Robert Müller 351dc88b21 Disable resolution list box when popup is open
So hotkeys are not used by the list box before popup menus.
2023-06-05 21:09:58 +02:00
Robert Müller 2359e38913 Add CLineInputNumber::GetInteger64/SetInteger64, add prefix
Support entering `int64_t` with line inputs.

Add argument to specify length of zero-prefix for hexadecimal numbers.
2023-06-05 21:09:22 +02:00
Robert Müller dd3dd4e3ca Add PRIX64 define for MinGW
For printing an `int64_t` as hexadecimal on MinGW.
2023-06-05 21:09:09 +02:00
Robert Müller 2be3ecfd4f Add str_toint64_base
To convert a string to an `int64_t`.
2023-06-05 21:07:30 +02:00
Robert Müller 9ce76a1713 Use real instead of display string for number line inputs
Set input string if it's not identical to the real input string instead of comparing to the display string, which would be incorrect for hidden number inputs.
2023-06-05 19:13:20 +02:00
Robert Müller 6aa03c878e Fix escape not working in settings menu anymore
The color picker was always consuming the escape hotkey even when already disabled. Regression from #6705 due to changed order of hotkey consumption.
2023-06-05 16:56:07 +02:00
bors[bot] 3524a8f0d2
Merge #6708
6708: Add logappend setting r=heinrich5991 a=def-

To append to log file instead of overwriting it. To use you can create an autoexec_client.cfg with:
```
logfile "client.log"
logappend 1
```
I'm not sure if it should be the default.

## Checklist

- [x] Tested the change ingame
- [ ] 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
- [ ] 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-06-05 12:28:07 +00:00
Dennis Felsing 07032ab0d0 Add logappend setting
To append to log file instead of overwriting it. To use you can create a
data/autoexec_client.cfg with:

logfile "client.log"
logappend 1

Enabled by default
2023-06-05 11:52:15 +02:00
bors[bot] f178bdf325
Merge #6706
6706: Fix `color_cast` between `ColorHSLA` and `ColorHSVA` losing alpha, add test 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
- [X] 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-06-04 22:51:30 +00:00
Robert Müller 265f16e23a Fix UI element check with m_HintCanChangePositionOrSize
It was incorrectly checked for `UIElement.Rect(0)->m_Y != pRect->h`, so any UI rect using `m_HintCanChangePositionOrSize` would be updated every frame (although, no UI element currently uses this hint).

Additionally, checks for changed rounding size and corners are added so UI elements are updated when those are changed.
2023-06-05 00:11:54 +02:00
Robert Müller 85bfe19cbe Add test to ensure that color_casts keep the same alpha value 2023-06-04 23:37:18 +02:00
Robert Müller 40327454f6 Fix color_cast between ColorHSLA and ColorHSVA losing alpha 2023-06-04 23:25:30 +02:00
bors[bot] 72108c42a7
Merge #6703 #6704
6703: Only highlight hovered edit boxes when they are the hot item r=def- a=Robyt3

Prevent highlighting when edit box hovered but behind a popup menu.

## 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)


6704: Extract `CMenus::UpdateColors` and `CUI::DebugRender` functions to improve readability of `CMenus::OnRender` 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-06-04 18:27:22 +00:00
Robert Müller 455d2e5ccb Handle escape to go to start menu after popup menus
Popup menus should be closed before escape is used to navigate back to the start menu.
2023-06-04 17:33:45 +02:00
Robert Müller 1c16d0e799 Extract CUI::DebugRender function 2023-06-04 17:27:42 +02:00
Robert Müller 322e06e4a5 Extract CMenus::UpdateColors function 2023-06-04 17:26:32 +02:00
Robert Müller efea2de9d5 Only highlight hovered edit boxes when they are the hot item
Prevent highlighting when edit box hovered but behind a popup menu.
2023-06-04 17:25:12 +02:00
Dennis Felsing 878eedeed7 Version 17.0.3 2023-06-03 23:47:34 +02:00
bors[bot] c227ed4bc5
Merge #6684 #6685 #6699
6684: Make server settings editor height adjustable by dragging r=heinrich5991 a=Robyt3

Same as for the envelope editor. Extract `RenderExtraEditorDragBar` function to reduce duplicate code.

Fix height being changed by repeated clicking on the draggable element by also resetting `s_Operation` when `Clicked` is `true`.

## 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)


6685: Support dragging demo player controls to move them, fix minor related issues r=heinrich5991 a=Robyt3

Allow dragging the demo player controls anywhere on the screen. The controls can't be moved outside of the screen. Round corners are automatically disabled when the controls are on the edge of the screen.

https://github.com/ddnet/ddnet/assets/23437060/72510c1f-4fd2-426b-a631-3a78db5f7b8b

## 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)


6699: Add dragger prediction r=def- a=trml

..for servers with the new ddnetlaser. Tested this locally and on Fun server, and seems to work.

Also adjusted the criteria for when to send the original dragger id slightly, to improve prediction in some edge cases when going through solo/unsolo while being dragged.

## 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>
Co-authored-by: trml <trml@users.noreply.github.com>
2023-06-03 20:46:26 +00:00
Jupeyy 44039c2b39 Revert "make sure it's not modifying memory"
This reverts commit bc006dbf08.
2023-06-03 22:04:28 +02:00
Jupeyy 9be2a78356 Fix killmessages might drop text container indices, if a killmsg was invalid
initially caused by #3430, probably triggered more often since our team kill msgs
2023-06-03 22:02:09 +02:00
trml 49c0bf95bd Slightly broader condition for snapping dragger id 2023-06-03 20:39:11 +02:00
trml 8121abf877 Add dragger prediction 2023-06-03 20:39:06 +02:00
Robert Müller b6cdbfbb2f Remove redundant CImageInfo variable
It's a POD object that is only zeroed and otherwise unused, so it's redundant.
2023-06-03 12:42:02 +02:00
Robert Müller f2d8bad506 Fix potential OOB write in CGraphics_Threaded::GetVideoModes
If `MaxModes` is smaller than `sizeof(g_aFakeModes)` then this caused more video modes to be copied to the output array than it can hold.
2023-06-03 12:41:44 +02:00
heinrich5991 ebacc0fb96 Change to username:password for reserved slots
This is a more common syntax.
2023-06-03 00:25:33 +02:00
bors[bot] 2d3221492d
Merge #6695
6695: Improve snapping of draggers r=def- a=trml

These are some things i noticed could be improved while attempting to add prediction for draggers:

Sets dragger owner to be the dragged player (this also means alpha will be applied).

It also ensures that the dragger that is sent for the players own team always has the same netobject id, and additionally that an idle dragger is always sent if no one in the players owns team is dragged (before it used to be that an idle dragger wasn't sent if _any_ player was dragged, including other teams visible to the player). The first one helps with keeping track of the dragger between snapshots (and simplifies prediction), while the second one ensures that a player still sees a dragger after show_other_alpha is applied to other teams.

Also fixes snapped order of to/from pos.

## 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-06-01 22:22:14 +00:00
trml 71d45b6926 Send dragger target (as owner), use original dragger id when sending dragger beam for a team 2023-06-01 23:29:51 +02:00
trml 348748f444 Fix snapping of dragger target pos 2023-06-01 23:29:46 +02:00
Robert Müller 81d7b9f890 Add "No server selected" message to server details
Otherwise the tab is completely empty when no server is selected.
2023-06-01 22:29:14 +02:00
bors[bot] ba852a4c61
Merge #6692
6692: Add script to check for unused config variables to CI, remove unused config variables r=def- a=Robyt3

Add `scripts/check_config_variables.py` which checks if config variables defined in `src/game/variables.h` and `src/engine/shared/config_variables.h` are unused.

Remove unnecessary usage of the preprocessor that was causing false positives for the check.

Remove unused config variables:

- `dbg_focus`
- `gfx_tune_overlay`
- `sv_external_port`
- `dbg_pref`
- `dbg_stress_network`
- `sv_score_folder`
- `sv_rank_cheats`

## 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-06-01 18:43:31 +00:00
Robert Müller 75227ed5ad Remove unused config variables:
- `dbg_focus`
- `gfx_tune_overlay`
- `sv_external_port`
- `dbg_pref`
- `dbg_stress_network`
- `sv_score_folder`
- `sv_rank_cheats`
2023-06-01 20:25:41 +02:00
Robert Müller 5963a7ae42 Remove unnecessary usage of preprocessor
Using the preprocessor here doesn't reduce any duplicate code and it adds false positives for the unused config variable check.
2023-06-01 20:25:41 +02:00
Dennis Felsing 4785ac3298 Version 17.0.2 2023-06-01 11:39:59 +02:00
Robert Müller cde1143528 Regenerate key lists with latest SDL version
Update `SDL_scancode.h` which is used by `gen_keys.py` to generate the list of keys enum (`keys.h`) and the list of key names (`keynames.h`) and regenerate the lists.

This adds support for 6 uncommonly used keys (audiorewind, audiofastforward, softleft, softright, call, endcall).
2023-05-30 23:39:47 +02:00
bors[bot] 8659578798
Merge #6657
6657: Allow rcon users access to reserved slots r=def- a=Learath2

<!-- What is the motivation for the changes of this pull request? -->
The password for the reserved slots keep getting leaked. Hopefully this will fix the issue.

<!-- 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
- [ ] 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
- [ ] 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: Learath <learath2@gmail.com>
2023-05-30 10:40:20 +00:00
bors[bot] eb63cb3c2b
Merge #6686
6686: Fix switch prediction on solo server r=def- a=trml

Fixes #6644 by sending switch state for team 0 on sv_solo_server 1 to match the team of the clients own character, and by not predicting other characters/entities when in solo.

<!-- 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
- [ ] 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-05-29 21:09:12 +00:00
Robert Müller d0333f10b0 Fix flashing window not working with newer SDL versions
Minimum SDL version 2.0.16 is required for `SDL_FlashWindow`. The SDL version schema changes after version 2.0.22 to 2.24.0 etc. (minor version is used instead of patchlevel) which was causing the condition that checks for minimum version 2.0.16 to not work correctly with newer SDL versions.

Closes #6687.
2023-05-29 19:43:45 +02:00
trml ed89ba543a Send team 0 for switchers as well on solo server 2023-05-29 16:05:53 +02:00
trml a090ba8cb3 Don't predict other players in solo 2023-05-29 15:01:38 +02:00
bors[bot] 6c7f6a4494
Merge #6665
6665: Fix ordering of unfinished/unconnected tees r=heinrich5991 a=Learath2

<!-- What is the motivation for the changes of this pull request? -->
I thought there was initially a strict weak ordering issue here but upon further inspection noticed it's fine.
However, people with negative score were getting sorted undeterministically, basically every unfinished tee was treated as equal since `!comp(a, b) && !comp(b, a)`. Sorting them by name was the intention.

I also got rid of the old `INT_MIN` "hack", it was only there to make the code shorter and it's no longer possible with the newly flipped sign without flipping it back on the client which is ugly.

Also made `ScoreKind` `const`, not sure if any compiler optimizes on that but why not? If we ever move to C++20 this could be a generic lambda instead where we can template `ScoreKind` and make sure it gets optimized properly.

Tidbit: I treated score 0 as a normal score, I'm not sure what it implies. 

<!-- 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
- [ ] 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: Learath <learath2@gmail.com>
2023-05-29 11:02:52 +00:00
Robert Müller 3130649721 Support dragging demo player controls to move them
Allow dragging the demo player controls anywhere on the screen. The controls can't be moved outside of the screen. Round corners are automatically disabled when the controls are on the edge of the screen.
2023-05-29 12:35:23 +02:00
Robert Müller 6aa7d3dc63 Delay menu (de)activation until end of render call
The escape key was previously always causing the menus to be toggled in addition to the normal key handling.

Now the menu is activated/deactivated by using the same UI hotkey system as in the rest of the menus. By checking for the escape hotkey last in the render call, other parts of the menu, especially popup menus, can use the hotkey first.

Fixes escape key in the demo player closing demo controls and slice popup at the same time. Now the popup is closed first.
2023-05-29 12:30:17 +02:00
Robert Müller bbe2430be9 Fix tooltips being active behind popups and outside clipping rects
Ensure that tooltips are only activated when the associated UI element is currently the hot item. This prevents tooltips from being activated for UI elements that are currently not enabled due to them being behind a popup or outside of a clipping rect.
2023-05-29 12:29:02 +02:00
Robert Müller 90ae59a666 Make server settings editor height adjustable by dragging
Same as for the envelope editor. Extract `RenderExtraEditorDragBar` function to reduce duplicate code.

Fix height being changed by repeated clicking on the draggable element by also resetting `s_Operation` when `Clicked` is `true`.
2023-05-29 12:26:04 +02:00
Robert Müller d9b5a8c3c4 Use X icon for demo close button, remove DoButton_DemoPlayer 2023-05-28 21:53:04 +02:00
Robert Müller 6feb46183e Improve demo slice popup
Show begin time, end time and length of demo cut in popup.

Replace demo slice error/confirm messages with generic popups.

Improve layout. Remove unnecessary empty space.
2023-05-28 15:03:52 +02:00
Robert Müller 1667861857 Use nullptr instead of 0 2023-05-28 14:59:46 +02:00
Robert Müller 6ff418322b Support rendering generic popup menus in demo player
Due to different code paths for the demo player, the `RenderPopupMenus` funtion needs to be called separately.
2023-05-28 14:59:46 +02:00
Robert Müller be8a601e9e Render demo popups above/after other demo controls
Prevent using other demo controls while a demo popup is open.
2023-05-28 14:59:45 +02:00
Robert Müller 20ce930765 Move variable declarations closer to usages 2023-05-28 14:59:45 +02:00
Robert Müller b01e8b7bc5 Extract CMenus::RenderDemoPlayerSliceSavePopup function 2023-05-28 14:59:45 +02:00
Robert Müller 1015176ae1 Fix inconsistent width/height calculation for generic popups
Sometimes the calculated popup width and height do not perfectly match the width and height when the text is rendered, so a small nudge value is added to prevent cases where this was noticeable.
2023-05-28 14:59:45 +02:00
Robert Müller 4ec4560679 Show error instead of replacing existing demo when renaming
Renaming a demo to the name of another demo would overwrite the target demo. Now an error message popup is shown instead to prevent this.

After a demo rename error popup is shown, return to the demo rename popup instead of closing the popup.
2023-05-28 14:02:08 +02:00
bors[bot] d433a2fd1d
Merge #6677
6677: Use icons for refresh and connect buttons, refactor `DoButtonMenu` r=def- a=Robyt3

Use less space for refresh and connect buttons to improve layout with 5:4 and 4:3 resolutions. Closes #5605. Closes #5878.

The "Refreshing..." text is replaced with combined refresh and ellipsis icons.

Alpha and saturation of the green color of the connect button are increased.

Move `CMenus::DoButtonMenu` to `CUI::DoButton_Menu`. Simplify usage by adding `SMenuButtonProperties` parameter object for all optional arguments. Remove unused `ColorHot` parameter.

Screenshots:
- Before:
![screenshot_2023-05-27_19-52-37](https://github.com/ddnet/ddnet/assets/23437060/3bf27f53-b034-4147-97ee-5c24a5b68457)
- After:
![screenshot_2023-05-27_19-51-07](https://github.com/ddnet/ddnet/assets/23437060/702a9c1c-be07-4cd6-94b5-b4b0fd9b4fa1)
- After (when refreshing):
![screenshot_2023-05-27_19-56-15](https://github.com/ddnet/ddnet/assets/23437060/0a456467-6550-4ce7-b756-56e3bbbc4f43)


## 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-05-27 19:53:09 +00:00
bors[bot] 9dfcbd9ff4
Merge #6678
6678: Fix undefined behavior in `CSnapshotDelta::DiffItem` r=Chairn a=Robyt3

Cast `int`s to `unsigned` before subtracting to ensure that integer wrapping is being used instead of causing undefined behavior. Same as in `UndiffItem`.

```
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/master/src/base/math.h:16:40 in
src/master/src/engine/shared/snapshot.cpp:206:21: runtime error: signed integer overflow: 256 - -2147483648 cannot be represented in type 'int'
    0 0x7650b7 in CSnapshotDelta::DiffItem(int const*, int const*, int*, int) src/master/src/engine/shared/snapshot.cpp:206:21
    1 0x765cea in CSnapshotDelta::CreateDelta(CSnapshot*, CSnapshot*, void*) src/master/src/engine/shared/snapshot.cpp:323:7
    2 0x51a0e2 in CServer::DoSnapshot() src/master/src/engine/server/server.cpp:964:36
    3 0x537486 in CServer::Run() src/master/src/engine/server/server.cpp:2818:6
    4 0x4feeb7 in main src/master/src/engine/server/main.cpp:190:21
    5 0x7fc51ec27d09 in __libc_start_main csu/../csu/libc-start.c:308:16
    6 0x4c3819 in _start (servers/DDNet-Server-ubsan+0x4c3819)

src/master/src/engine/shared/snapshot.cpp:206:21: runtime error: signed integer overflow: 1645289600 - -2139062144 cannot be represented in type 'int'
    0 0x7650b7 in CSnapshotDelta::DiffItem(int const*, int const*, int*, int) src/master/src/engine/shared/snapshot.cpp:206:21
    1 0x765cea in CSnapshotDelta::CreateDelta(CSnapshot*, CSnapshot*, void*) src/master/src/engine/shared/snapshot.cpp:323:7
    2 0x51a0e2 in CServer::DoSnapshot() src/master/src/engine/server/server.cpp:964:36
    3 0x537486 in CServer::Run() src/master/src/engine/server/server.cpp:2818:6
    4 0x4feeb7 in main src/master/src/engine/server/main.cpp:190:21
    5 0x7efd50c4ed09 in __libc_start_main csu/../csu/libc-start.c:308:16
    6 0x4c3819 in _start (servers/DDNet-Server-ubsan+0x4c3819)
```

See #6650.

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

<!-- 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
- [ ] 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-05-27 19:29:12 +00:00
Dennis Felsing 7cdc92859e Version 17.0.1 2023-05-27 21:27:35 +02:00
Robert Müller 36dd5c5075 Fix undefined behavior in CSnapshotDelta::DiffItem
Cast `int`s to `unsigned` before subtracting to ensure that integer wrapping is being used instead of causing undefined behavior. Same as in `UndiffItem`.

```
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/master/src/base/math.h:16:40 in
src/master/src/engine/shared/snapshot.cpp:206:21: runtime error: signed integer overflow: 256 - -2147483648 cannot be represented in type 'int'
    0 0x7650b7 in CSnapshotDelta::DiffItem(int const*, int const*, int*, int) src/master/src/engine/shared/snapshot.cpp:206:21
    1 0x765cea in CSnapshotDelta::CreateDelta(CSnapshot*, CSnapshot*, void*) src/master/src/engine/shared/snapshot.cpp:323:7
    2 0x51a0e2 in CServer::DoSnapshot() src/master/src/engine/server/server.cpp:964:36
    3 0x537486 in CServer::Run() src/master/src/engine/server/server.cpp:2818:6
    4 0x4feeb7 in main src/master/src/engine/server/main.cpp:190:21
    5 0x7fc51ec27d09 in __libc_start_main csu/../csu/libc-start.c:308:16
    6 0x4c3819 in _start (servers/DDNet-Server-ubsan+0x4c3819)

src/master/src/engine/shared/snapshot.cpp:206:21: runtime error: signed integer overflow: 1645289600 - -2139062144 cannot be represented in type 'int'
    0 0x7650b7 in CSnapshotDelta::DiffItem(int const*, int const*, int*, int) src/master/src/engine/shared/snapshot.cpp:206:21
    1 0x765cea in CSnapshotDelta::CreateDelta(CSnapshot*, CSnapshot*, void*) src/master/src/engine/shared/snapshot.cpp:323:7
    2 0x51a0e2 in CServer::DoSnapshot() src/master/src/engine/server/server.cpp:964:36
    3 0x537486 in CServer::Run() src/master/src/engine/server/server.cpp:2818:6
    4 0x4feeb7 in main src/master/src/engine/server/main.cpp:190:21
    5 0x7efd50c4ed09 in __libc_start_main csu/../csu/libc-start.c:308:16
    6 0x4c3819 in _start (servers/DDNet-Server-ubsan+0x4c3819)
```

See #6650.
2023-05-27 20:57:05 +02:00
Robert Müller 08e0a87ff1 Use icons for refresh and connect buttons, refactor DoButtonMenu
Use less space for refresh and connect buttons to improve layout with 5:4 and 4:3 resolutions. Closes #5605. Closes #5878.

The "Refreshing..." text is replaced with combined refresh and ellipsis icons.

Alpha and saturation of the green color of the connect button are increased.

Move `CMenus::DoButtonMenu` to `CUI::DoButton_Menu`. Simplify usage by adding `SMenuButtonProperties` parameter object for all optional arguments. Remove unused `ColorHot` parameter.
2023-05-27 19:48:32 +02:00
bors[bot] ba7b82258e
Merge #6673 #6676
6673: Clear Victim Team render info on skin changes r=Robyt3 a=Jupeyy

fixes #6662

This should fix the issue, I guess, by simply clearing the render info. I can't find an easy way to restore the original skins of the team members as we don't save their IDs.
I couldn't directly trigger the assert, but I could certainly see the skin getting invalid when killen the team and switch to "vanilla only skins". (Edit: When triggering it a few times I got the assert)

The code generally looks a bit hacky. Maybe the original author can refactor it a bit

## 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)


6676: Show GPU info (if available) in assert r=Robyt3 a=Jupeyy

first part of #6672

![image](https://github.com/ddnet/ddnet/assets/6654924/0e9aec5a-528a-4e7a-a3fa-93108e55597e)



## 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: Jupeyy <jupjopjap@gmail.com>
2023-05-27 09:01:26 +00:00
Jupeyy 70d48140f0 Show GPU info (if available) in assert 2023-05-27 09:51:22 +02:00
Jupeyy ad40156a3b Wait for graphics thread's current execution to end before triggering the assert dialog 2023-05-27 09:34:21 +02:00
Jupeyy fe20459138 Clear Victim Team render info on skin changes 2023-05-27 09:10:39 +02:00
bors[bot] 144bb1dd7f
Merge #6671
6671: Ensure line inputs are deactivated when they are not rendered r=def- a=Robyt3

Check if the active line input was not rendered and deactivate it in that case.

This can happen e.g. when an input in the ingame menu is active and the menu is closed or when switching between menu and editor with an active input.

This was causing the IME candidate list to be rendered ingame after closing the menu. Closes #6666.

## 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-05-26 22:26:18 +00:00
Robert Müller 71c56f1e70 Ensure line inputs are deactivated when they are not rendered
Check if the active line input was not rendered and deactivate it in that case.

This can happen e.g. when an input in the ingame menu is active and the menu is closed or when switching between menu and editor with an active input.

This was causing the IME candidate list to be rendered ingame after closing the menu. Closes #6666.
2023-05-26 23:58:04 +02:00
bors[bot] 4070a9587a
Merge #6670
6670: Delete selection with backspace/delete regardless of word mode r=def- a=Robyt3

Also delete the lineinput selection when pressing backspace/delete and the key for skipping words (Ctrl/GUI key, Alt on macOS) is held. This is consistent with the behavior in other applications.

## 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-05-26 21:46:52 +00:00
Robert Müller b0c4d3fcde Delete selection with backspace/delete regardless of word mode
Also delete the lineinput selection when pressing backspace/delete and the key for skipping words (Ctrl/GUI key, Alt on macOS) is held. This is consistent with the behavior in other applications.
2023-05-26 23:32:17 +02:00
Jupeyy 52d61244cd Remove inp_mouseold config
Because it causes trouble with newer SDL2 versions
`https://github.com/libsdl-org/SDL/issues/7159`
2023-05-26 22:44:32 +02:00
Robert Müller 448a39768b Add inp_ime_native_ui to toggle native IME UI on Windows
Add `inp_ime_native_ui` on Windows to use native IME UI instead of rendering the candidate list in the client.

Always set the SDL hint to use native UI on non-Windows, as we cannot determine the list of candidates on those systems.
2023-05-26 15:39:28 +02:00
Learath a63404409b Fix ordering of unfinished/unconnected tees 2023-05-26 01:43:42 +02:00
Dennis Felsing a5332f0b11 Version 17.0 2023-05-25 12:09:12 +02:00
Robert Müller 34b66d2107 Pass nullptr instead of unused UI rect 2023-05-24 21:16:13 +02:00
Robert Müller 60ac3b3d48 Remove settings checkbox for cl_threadsoundloading
The default value `1` should be fine for most users and this setting is not likely to be changed very often, so it doesn't need a checkbox in the settings menu.
2023-05-24 21:12:44 +02:00
Robert Müller b5637df2bf Enable threaded sound loading per default again
Change `cl_threadsoundloading` default to `1` again. The default was previously set to `0` in 1287cc3f20 because the setting may have caused crashes. Now that `mem_alloc` is replaced with `malloc` and therefore thread-safe we can enable this setting again per default.
2023-05-24 21:12:43 +02:00
Robert Müller 70b5e4b5bd Remove settings edit box for snd_rate
The default setting `48000` should be fine for the majority of the users so it's not necessary to be able to change this in the settings menu.
2023-05-24 21:12:43 +02:00
Robert Müller 460cda85d7 Set minimum/maximum values for snd_rate
Hopefully prevent crashes that some users are experiencing when using very unreasonable `snd_rate` values.
2023-05-24 21:12:43 +02:00
Robert Müller fd0e9b18b4 Remove unused snd_device config variable 2023-05-24 21:12:43 +02:00
bors[bot] 03a5dde418
Merge #6639
6639: Fix- Replaced usage of m_ProofBorders and m_MenuProofBorders with enum EProofBorder r=Robyt3 a=tarunsamanta2k20

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

Changes requested.
closes #6609 

<!-- 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
- [x] 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
- [x] 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: Tarun Samanta <tarunsamanta77@gmail.com>
Co-authored-by: Tarun Samanta <55488549+tarunsamanta2k20@users.noreply.github.com>
2023-05-24 18:30:44 +00:00
Robert Müller ff51edec2d Fix incorrect swapping with draggers
There is another member variable `CDragger::m_aTargetIdInTeam` that contains for every team the client ID of the team member currently being dragged by this dragger.

The client IDs in this array also need to be swapped accordingly or the dragger will not switch target correctly when swapping.

Closes #5865.
2023-05-24 17:47:09 +02:00
Learath 6f9c387e95 Add config option. Make it untidy per clang-tidy 2023-05-24 16:01:21 +02:00
Learath f1cee7475b Allow rcon users access to reserved slots 2023-05-24 15:19:09 +02:00
bors[bot] 422ff844b8
Merge #6656
6656: Fix crash with super (fixes #6654) r=Learath2 a=def-

CClientMask has size MAX_CLIENTS, so it can't be used for super team

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

<!-- 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

- [ ] 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-05-24 12:04:25 +00:00
Dennis Felsing 3dd1d784d6 Fix crash with super (fixes #6654)
CClientMask has size MAX_CLIENTS, so it can't be used for super team
2023-05-24 13:34:38 +02:00
Tarun Samanta f982dd77c1 fixing linting issue 2023-05-24 01:27:57 +05:30
Tarun Samanta e8a33cfade fiing linting issue 2023-05-23 23:57:08 +05:30
Tarun Samanta 050bf4a9b8 Made sugested changes 2023-05-23 23:46:42 +05:30
Dennis Felsing bdc916faa9 Fix swapping with dragger beams (fixes #6597) 2023-05-23 00:42:04 +02:00
Robert Müller 23d8acd96c Replace country server filter fullscreen popup with smaller popup
Replace the large hard-coded popup to select the country for the server filter with a small overlay popup for better usability.
2023-05-22 20:32:15 +02:00
Robert Müller 83c19a1e96 Add highlight color when hovering country button of server filter 2023-05-22 20:32:15 +02:00
Robert Müller 4dcb80e462 Enable country button also when filter not enabled
Selecting a flag will also enable the filter in this case.
2023-05-22 20:32:14 +02:00
Robert Müller f16f77ce26 Slightly decrease size of country flag in server filter 2023-05-22 20:32:14 +02:00
Robert Müller 9be72db36a Remove unnecessary margin on left side of server filter
To improve layout. The "Filter connecting players" checkbox can now use the original font size without being resized.
2023-05-22 20:31:02 +02:00
Robert Müller 0d0f9ed232 Remove dead code 2023-05-22 20:31:02 +02:00
Robert Müller 59fafdbf4e Only activate server browser list box when no popup is open
To support popup menus over the server browser.
2023-05-22 20:30:06 +02:00
Tarun Samanta fcaab778ca modified some files as asked 2023-05-22 23:50:45 +05:30
Robert Müller e175c0a79f Remove duplicate enter hotkey used for connecting to server
The list box already takes care of the enter hotkey for connecting. Furthermore, the list box can be inactive, whereas the now removed hotkey was always active.

Minor refactoring of `DoButtonMenu` usage.
2023-05-22 20:09:33 +02:00
Robert Müller 808d604579 Propagate list box active state to underlying scroll region
Fix inactive list box still consuming mouse scroll events.
2023-05-22 20:09:32 +02:00
bors[bot] b2eacf7f09
Merge #6648
6648: Fix filling switch layer not setting switch number 0, clear unused switch/tele properties when filling selection r=def- a=Robyt3

Closes #5464.

## 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-05-22 17:25:35 +00:00
Robert Müller 6ca74ec39e Clear unused switch/tele properties when filling selection
Set switch number/delay/flags to 0 when unused for a specific tile.

Set tele number to 255 when unused for a specific tile.
2023-05-22 17:46:50 +02:00
Robert Müller d5e4597012 Fix filling switch layer not setting switch number 0
Closes #5464.
2023-05-22 17:46:50 +02:00
Robert Müller a068034e61 Extract duplicate expressions into variables 2023-05-22 17:46:50 +02:00
Edgar a4abc1fdd9
factor out scorekind backwards compat gametype check 2023-05-22 17:22:52 +02:00
Edgar 1d30462e50
clean time score handling, with positive time values 2023-05-22 16:36:46 +02:00
Tarun Samanta ef78e36c6f replaced second enum 2023-05-22 18:16:25 +05:30
Edgar 8a3d8fc53f
fix time score info on server detail 2023-05-22 13:53:23 +02:00
Tarun Samanta 79d8928a03 made requested changes 2023-05-22 01:51:13 +05:30
Robert Müller 1b6be5e10b Use different color for offline clanmates in friends list
Closes #6643.
2023-05-21 22:06:56 +02:00
Tarun Samanta e74c60d9a5 Modified some files 2023-05-22 00:56:23 +05:30
Tarun Samanta f23f74ee9e fixing some error 2023-05-21 22:42:53 +05:30
Tarun Samanta 61ef6210d1 Modifications in three files 2023-05-21 21:30:41 +05:30
Tarun Samanta 523a3c4450 fix- Replaced usage of m_ProofBorders and m_MenuProofBorders with enum EProofBorder 2023-05-21 14:47:27 +05:30
Robert Müller 68d2d466d5 Fix use of invalid text container index for finish message HUD 2023-05-20 19:20:48 +02:00
bors[bot] fb2d5e35dc
Merge #6630
6630: Remove unused `sv_sql_bindaddr` config variable r=edg-l a=Robyt3

Closes #6456.

## 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-05-19 19:55:21 +00:00
Robert Müller ed554368ec Remove unused sv_sql_bindaddr config variable
Closes #6456.
2023-05-19 21:02:39 +02:00
bors[bot] 4ab55bd722
Merge #6626 #6629
6626: Remove popup for unofficial servers r=Robyt3 a=def-

Via https://github.com/ddnet/ddnet/pull/6618/files#r1199072246

Thoughts?

## 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)


6629: Remove unused `CMenus::DoToolTip` declaration r=def- a=Robyt3



## 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>
Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-05-19 18:55:32 +00:00
Dennis Felsing 3593cce9b4 Revert "Add popup to confirm connecting to friend on non-official server"
This reverts commit 2e46460302.
2023-05-19 20:31:59 +02:00
Robert Müller 3d9d18c511 Remove unused CMenus::DoToolTip declaration 2023-05-19 19:40:46 +02:00
Robert Müller 56d1c8e560 Slightly increase font size of friend name 2023-05-19 19:22:11 +02:00
Dennis Felsing cca040274f Remove popup for unofficial servers
Via https://github.com/ddnet/ddnet/pull/6618/files#r1199072246

Thoughts?
2023-05-19 17:09:01 +02:00
bors[bot] d4582fb08e
Merge #6618
6618: Render tees for online friends in friends list, change friend info text to `Map | Mode | Country/Ping`, show official server icon, show confirmation popup r=edg-l a=Robyt3

Closes #6614.

![friends](https://github.com/ddnet/ddnet/assets/23437060/946cd095-a1f3-420c-b158-2e66687e7806)

Show race disconnect confirmation when joining friend. Closes #6622.

Add popup to confirm connecting to friend on non-official server:

![popup](https://github.com/ddnet/ddnet/assets/23437060/cb702277-93a5-4d90-9369-0f3dbff7cca3)


## 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-05-19 14:03:37 +00:00
Robert Müller 2e46460302 Add popup to confirm connecting to friend on non-official server 2023-05-19 15:51:05 +02:00
Robert Müller 1bea7a2cd5 Show race disconnect confirmation when joining friend
Closes #6622.
2023-05-19 15:16:32 +02:00
Robert Müller fc3583a18e Show official server icon in friends list
Show the official server icon for online friends who are currently on official servers.
2023-05-19 15:15:44 +02:00
Robert Müller 637f7fd736 Reduce duplicate UI spacing code 2023-05-19 15:14:46 +02:00
bors[bot] dcb67cb17a
Merge #6617
6617: Add /unsolo and /undeep practice commands r=def- a=hus3h

Related: https://github.com/ddnet/ddnet/issues/6318#issuecomment-1498626132 and #2391

Unsolo is often needed especially in maps with death tiles and solo part spawns, undeep can also be useful for some parts.

Some notes:

- didn't use `CFGFLAG_SERVER` for the commands as it resulted in a conflict with the registered `unsolo` and `undeep` super team console commands, not entirely sure if that's okay
- `/help unsolo` and `/help undeep` will print the help text of the super team commands, not the new chat commands. The texts are currently the same, but it's still a sign of possible conflicts
- prevented `/unsolo` on solo servers by checking for `SV_TEAM_FORBIDDEN` and `SV_TEAM_FORCED_SOLO`, let me know if that's not enough (Tutorial map?)
- no server message is sent on `/unsolo` (as opposed to going through unsolo tiles), didn't seem like it's needed here even if it feels different at first

 If the conflicts are problematic enough, the easiest fix might be using new unique commands instead of `unsolo` and `undeep`, I couldn't think of something that would fit as well though.

## Checklist

- [x] Tested the change ingame
- [ ] 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: hus3h <39054982+hus3h@users.noreply.github.com>
2023-05-19 12:25:53 +00:00
Robert Müller b33ce0f37d Change friend info text to Map | Mode | Country/Ping 2023-05-18 23:06:29 +02:00
bors[bot] 2d5321d8b7
Merge #6615
6615: Fix logging (fixes #6611) r=Robyt3 a=def-

`@heinrich5991` Was the atomic important? Could we have a lock instead if so?

Seems a bit annoying since atomic can't have a shared_ptr inside

![Screenshot 2023-05-18 at 18 02 32](https://github.com/ddnet/ddnet/assets/2335377/2f8bcc57-2301-4a65-ada2-0e51f2b8c200)

## 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: Dennis Felsing <dennis@felsin9.de>
2023-05-18 20:43:30 +00:00
Robert Müller a2cbc7fb24 Render tees for online friends in friends list
Closes #6614.
2023-05-18 22:03:43 +02:00
Dennis Felsing bf1954b389 Fix logging (fixes #6611)
@heinrich5991 Was the atomic important? Could we have a lock instead if so?

Seems a bit annoying since atomic can't have a shared_ptr inside
2023-05-18 21:54:30 +02:00
bors[bot] 7790937fa8
Merge #6616
6616: fix timescore r=Robyt3 a=edg-l

Fixes the time displayed, this time i tested it quite thoroughly, i could reproduce the wrong ordering in scoreboard and the time not updating before, and fixed it now.

The previous way also had a issue with times that ended up with a value of -1, which is fixed now too

## 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
- [x] 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: Edgar Luque <git@edgarluque.com>
2023-05-18 19:36:06 +00:00
Edgar 48feb2abbb
fix test 2023-05-18 21:11:04 +02:00
hus3h 939f2f7d50 Add /unsolo and /undeep practice commands 2023-05-18 22:08:58 +03:00
Edgar 654ee03b67
fix timescore 2023-05-18 20:49:22 +02:00
Robert Müller 15f839960a Port friends list UI from 0.7
Separate friends list into three groups, which can be expanded and collapsed: online players, online clanmates and offline friends.

Friends with the same name/clan are no longer grouped together. Instead, each individual player that is online and has name/clan matching a friend is shown in either the online players or online clanmates group. Friends for which no matching players are found are shown in the offline group.

Friends in the friend list can no longer be selected. Instead, left-clicking a friend selects the server that the friend is on. Double-clicking a friend joins the server that they are playing on.

Render small X button in top-right corner of every friend list entry to remove the respective friend instead of using one button that removes the selected friend.

Change "Add Friend" button to "Add Clan" when only clan is entered.

Remove excess empty space from layout.

Closes #6326.
2023-05-18 16:46:26 +02:00
bors[bot] 6525e9e5dd
Merge #6604
6604: Clean up CServerLogger (fixes #6598) r=edg-l a=def-

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

<!-- 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
- [ ] 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-05-18 11:46:59 +00:00
bors[bot] 373595dec8
Merge #6608
6608: Support rendering tooltips with multiple lines of text, support overlapping tooltip activation rects, add alpha fade-in for tooltips  r=edg-l 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-05-18 11:24:25 +00:00
Robert Müller 47fca7683d Add alpha fade-in for tooltips
After 0.75 seconds of hovering the tooltip rect without rendering the tooltip, start fading in the tooltip for the remaining 0.25 seconds.
2023-05-18 13:22:52 +02:00
bors[bot] ac820ce62d
Merge #6607
6607: Minor refactoring of `CMenus::RenderLoading` r=Learath2 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-05-18 10:52:23 +00:00
Robert Müller 13ed0e386a Use const when possible 2023-05-18 12:21:34 +02:00
Robert Müller fe359e2909 Combine Margin function calls
Both calls put a margin around the same rect but the intermediate result is never used, so both margins can be combined.

The variable `Screen` is also not necessary.
2023-05-18 12:20:53 +02:00
Robert Müller f60dd0d3c2 Fix name of static variable s_LastLoadRender 2023-05-18 12:19:10 +02:00
Robert Müller af67130dbd Use nullptr for unused UI rect splitting parameters 2023-05-18 12:18:22 +02:00
Robert Müller 05f2b19391 Remove unused SLabelProperties Props variable 2023-05-18 12:17:15 +02:00
Robert Müller 31304c4573 Support overlapping tooltip activation rects
When the activation rects for two tooltips overlap, this always causes the first tooltip to be rendered.

This is changed so the last active tooltip is rendered instead, to simplify the usage of the tooltip function.
2023-05-18 12:12:44 +02:00
Robert Müller ed09bba45a Support rendering tooltips with multiple lines of text
Render tooltip text correctly with multiple lines when the maximum tooltip width is limited.

Add missing padding when rendering multi-line tooltip.

Update doxygen documentation.
2023-05-18 12:12:26 +02:00
VoxelDoesCode 2222612412 Only run KillTeam() when team has more than 1 tee
Clang format #6606
2023-05-17 16:12:10 -04:00
bors[bot] 20032b5a24
Merge #6546
6546: move some editor buttons into menus r=Robyt3 a=Marmare314

The entities and unused buttons are now in a new "Settings" menu.
![menu_settings](https://user-images.githubusercontent.com/49279081/235301689-a1375024-9233-432b-9ab3-4545f982711f.png)

The border and goto buttons got moved to the "Tools" menu.
![tools_menu](https://user-images.githubusercontent.com/49279081/235301690-6883e6a7-0afe-4b2f-826c-3fb48694f7f4.png)


## 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
- [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: marmare314 <49279081+Marmare314@users.noreply.github.com>
2023-05-17 15:59:42 +00:00
marmare314 76eac08783 fix padding of buttons in settings 2023-05-17 17:25:21 +02:00
Dennis Felsing caa76249d8 Clean up CServerLogger (fixes #6598) 2023-05-17 01:04:06 +02:00
bors[bot] 2901c19bed
Merge #6602
6602: Revert "Delay disconnecting until after render call" r=def- a=Robyt3

This reverts commit 5c90fd2b83.

Delaying the disconnecting causes issues when the client automatically disconnects immediately before connecting to another server or starting demo playback.

It's not necessary to delay the disconnecting to deal with #6387, as #6589 is already enough. It's easier to revert this instead of rewriting the client so connecting and starting demo playback are also delayed.

Closes #6595.

## 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-05-16 22:43:29 +00:00
marmare314 37791ada99 enable brush coloring -> brush coloring 2023-05-16 22:24:26 +02:00
bors[bot] 065149ebe9
Merge #6600 #6601
6600: Compare against correct enum in dummy connect r=heinrich5991 a=ChillerDragon

Why did we allow connecting dummy in state pending? Maybe because state online did not match because the wrong enum was used?

```C++
int CNetClient::State()
{
	if(m_Connection.State() == NET_CONNSTATE_ONLINE)
		return NETSTATE_ONLINE;
	if(m_Connection.State() == NET_CONNSTATE_OFFLINE)
		return NETSTATE_OFFLINE;
	return NETSTATE_CONNECTING;
}
```

We map from NET_CONNSTATE_  to NETSTATE_ so it should also be compared against NETSTATE_

<!-- 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
- [ ] 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)


6601: try to fix broken score r=heinrich5991 a=edg-l

not sure if this is the fix, but -9999 is wrong, and -1 is set on reset

## 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: ChillerDragon <chillerdragon@gmail.com>
Co-authored-by: Edgar Luque <git@edgarluque.com>
2023-05-16 17:43:03 +00:00
Robert Müller 5ecd025d1d Revert "Delay disconnecting until after render call"
This reverts commit 5c90fd2b83.

Delaying the disconnecting causes issues when the client automatically disconnects immediately before connecting to another server or starting demo playback.

It's not necessary to delay the disconnecting to deal with #6387, as #6589 is already enough. It's easier to revert this instead of rewriting the client so connecting and starting demo playback are also delayed.

Closes #6595.
2023-05-16 19:34:21 +02:00
Edgar 8c298413bd try to fix broken score 2023-05-16 16:42:08 +02:00
ChillerDragon c5eb15d9f6 Compare against correct enum in dummy connect 2023-05-16 16:38:55 +02:00
bors[bot] 22df50c9bd
Merge #6592
6592: Minor refactoring of map and datafile r=def- a=Robyt3



## 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-05-15 21:45:22 +00:00
Robert Müller dd7cf38be5 Fix uninitialized field causing assertion error with MSVC
The modified time was uninitialized for the editor file browser entry corresponding to the downloadedmaps-link. The time is never rendered for links, but the uninitialized time value was still passed to `str_timestamp_ex`, which results in an assertion error due to an incorrect time value being used when compiling with MSVC.

This is fixed by properly initializing the field and also by only calling `str_timestamp_ex` when the time value will be rendered.

Closes #6579.
2023-05-15 22:07:37 +02:00
Robert Müller 2f2c86ced3 Move variable declarations closer to usages 2023-05-15 20:56:17 +02:00
Robert Müller cbde0bb7c6 Use nullptr instead of 0 2023-05-15 20:48:02 +02:00
Robert Müller cd9d0e5e16 Add default parameter values to CMap::GetItem 2023-05-15 20:48:01 +02:00
Robert Müller 7273574d68 Add missing CMap::NumData delegate function 2023-05-15 20:47:59 +02:00
Robert Müller 5e215f6ee3 Mark map and datafile functions as const when possible 2023-05-15 20:47:38 +02:00
Robert Müller 6b37c3dbf4 Reorder map and datafile functions 2023-05-15 20:46:50 +02:00
Robert Müller 52e1494347 Remove unused CDataFileReader::Unload function declaration 2023-05-15 20:28:39 +02:00
Edgar e75a763454
add unit test for updating teamranks 2023-05-15 09:07:29 +02:00
bors[bot] a38dea4454
Merge #6590
6590: Make text containers bit safer r=Robyt3 a=Jupeyy

From reading the code I couldn't understand how https://github.com/ddnet/ddnet/issues/5143#issuecomment-1546735484 could happen

either (checked = not the case):
 - [x] teini used an outdated client
 - [ ] i am blind
 - [ ] it was a name/clan -plate, scoreboard entry
 - [ ] it leaked somewhere in text.cpp or similar impl
 - [ ] it happened because of an outside write.

We don't really come further with this, so we should probably at least try it out?
`@Robyt3` your opinion? We can still always remove it again

## 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: Jupeyy <jupjopjap@gmail.com>
2023-05-14 19:16:16 +00:00
bors[bot] cca6d867cb
Merge #6588 #6589
6588: Add default argument to `CDataFileReader/IMap::GetItem` r=def- a=Robyt3

Add default value `nullptr` for `int *pType` and `int *pID` output parameters of `GetItem` functions.

Use `nullptr` instead of `0`.

## 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)


6589: Fix heap-use-after-free when quitting/restarting r=def- a=Robyt3

Items and particles were also rendered in the client states quitting and restarting, which was causing accesses to the already freed map data.

Closes #6387 until further notice.

## 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-05-14 18:58:08 +00:00
Jupeyy 370d37b8fd Add shared ptr to track usage 2023-05-14 20:21:59 +02:00
Jupeyy bc006dbf08 make sure it's not modifying memory 2023-05-14 19:26:48 +02:00
Robert Müller f3e8513477 Fix heap-use-after-free when quitting/restarting
Items and particles were also rendered in the client states quitting and restarting, which was causing accesses to the already freed map data.
2023-05-14 18:12:47 +02:00