Commit graph

13048 commits

Author SHA1 Message Date
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