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>
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.
- Use `IGraphics::CORNER_NONE` instead of `0`.
- Remove redundant usage of `Localize` for an already localized string.
- Remove redundant `HSplitBottom` with zero size.
6732: Split emoticon sending into nearby and global players r=def- a=Jupeyy
The reason for this rather overcomplicated solution is, that emotes are send to other players all the time. But just sending it to nearby players only would not work as the emoticon does not track animation time.
So sending the emoticon later would restart the emote client side.
A different fix, which we obviously don't want, is breaking compability with all older clients and move the emoticon into the snapshot.
I also changed the config vars to use milliseconds instead of seconds. I did not use ticks, since ticks are not a clear enough time unit.
**It is not clear if this will fix all network lags, as there might be other packets that also are sent to all players globally**
global means:
send them less often than nearby, but still send them. this makes players that are close to you but not in your view range still see your emote if they run into your view range with reasonably enough speed. We could also think about disabling global emoticons completely, if this fix is not good enough. the main idea was really that it doesn't look weird: e.g. if you start to spec a player and he has no emoticon
## 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>
6730: Try linking to ntdll (fixes#6725) r=Robyt3 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
- [ ] 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>
- 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.
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.
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.
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.
- 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.
6722: Add highlight color when hovering DDNet/KoG type/country filters 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>
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.
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.
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.
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.
6719: Fix escape not working in server browser and demo browser r=Jupeyy a=Robyt3
Closes#6718.
## 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>
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>
6715: Disallow multiple emotes in the same tick, respect high bandwidth setting r=Robyt3 a=Jupeyy
closes#6714
## 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>
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.
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>
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.
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.
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.