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>
6736: Fix editor save dialog entries not selectable with mouse anymore r=def- a=Robyt3
Regression from #6530.
## 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 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.
6735: Minor refactoring of `CUI` 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>
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.
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.