Commit graph

9217 commits

Author SHA1 Message Date
Robert Müller 6decf14137 Use Text instead of TextEx for popup labels
To reduce duplicate code and ensure that the same flags are used with `TextWidth` and when actually rendering the text.
2023-04-09 20:10:44 +02:00
Robert Müller 9bb9c7ce6b Replace usages of TextLineCount with TextWidth
Calculate text height for popups with `TextWidth` instead of using `TextLineCount`, which can be incorrect if the aligned font size differs from the normal one.
2023-04-09 20:10:44 +02:00
Robert Müller 9693d4beac Fix vertical centering of multi-line UI labels
Also calculate text height in `TextWidth`.

Use calculated text height to verically center UI labels.

The text cursor flags (in particular, the `TEXTFLAG_STOP_AT_END` flag) must also be passed to `TextWidth`. Otherwise, for example, when `TEXTFLAG_STOP_AT_END` is missing, the wrong text height is calculated, as text is rendered over multiple lines instead of stopping at the end of the first line.

Closes #5396.
2023-04-09 20:10:09 +02:00
Robert Müller 07c59d130b Minor refactoring of DoLabel functions 2023-04-09 20:10:09 +02:00
Robert Müller ede3e5631f Move generic popup handling to UI (port from editor and upstream)
Support using editor popup rendering in game client.

Support unlimited number of popup menus instead of maximum of 8.

Fix non-active popups handling key events. Add `Active` parameter to popup function, so key events are only processed by the active (top-most) popup. Previously the "New folder" popup could be confirmed with enter while an error message is shown, which causes multiple error messages to stack.

Allow popups to close without closing their child popups. Previously a popup could not open another popup and close itself immediately afterwards, as this was causing the newly opened popup to be closed instead.

Support using return/enter keys to confirm binary choice popups and to close message popups for more convenient usage.
2023-04-07 17:16:16 +02:00
bors[bot] fdcb2668e8
Merge #6502
6502: Improve editor file browser button layout when screen width is low r=def- a=Robyt3

Move "Map details" button from editor file browser to file menu.

Decrease button spacing in editor file browser when screen width is low (4:3 and 5:4 resolutions).

Screenshots:
- File menu:
   - Before: 
![file-menu old](https://user-images.githubusercontent.com/23437060/230586902-079a042d-0223-4a97-b228-ec8a4fae43d1.png)
   - After:
![file-menu new](https://user-images.githubusercontent.com/23437060/230589757-ef18d6d8-f8f0-4a2b-bc35-219349d6a7e7.png)
- File browser (800x600):
   - Before:
![save 800x600 old](https://user-images.githubusercontent.com/23437060/230591373-11b3e0c8-ce3f-4e8e-9fd1-297f8276de28.png)
   - After:
![save 800x600 new](https://user-images.githubusercontent.com/23437060/230591387-162de3fc-95e9-41ea-94a8-9b7b46ac97cb.png)
- File browser (1280x1024):
   - Before:
![save 1280x1024 old](https://user-images.githubusercontent.com/23437060/230591411-5dddd9de-4773-4dc9-a77b-61d5d4de4dc6.png)
   - After:
![save 1280x1024 new](https://user-images.githubusercontent.com/23437060/230591422-1ee8c941-9eb2-4e13-9268-de591b5b72f5.png)
- File browser (1920x1080):
   - Before:
![save 1920x1080 old](https://user-images.githubusercontent.com/23437060/230591437-146e961a-3e55-463f-988e-0d7eef92b439.png)
   - After:
![save 1920x1080 new](https://user-images.githubusercontent.com/23437060/230591445-931718f4-81fb-4c87-a018-f377a5c473df.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
- [ ] 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-04-07 11:12:40 +00:00
Robert Müller 5fb9f5db5b Decrease button spacing in editor file browser when screen width low
To prevent the buttons from overlapping in 4:3 and 5:4 resolutions.
2023-04-07 12:00:09 +02:00
Robert Müller b7e8168e4b Move "Map details" button from editor file browser to file menu
There is not enought space for the button in the file browser on 4:3 and 5:4 resolutions.

The button fits in the file menu, as it allows to adjust the map details which are specific to the current map file.
2023-04-07 12:00:09 +02:00
Robert Müller 72775f236b Let CUI::Screen return a const pointer
Callers should never modify the UI screen.
2023-04-07 11:50:48 +02:00
Robert Müller eaa4e19188 Fix image/sound readding broken by error messages
When an image/sound is readded, this reuses the `ReplaceImage/Sound` callback functions. The added error handling to prevent duplicate images/sounds was causing this to not work, as the image/sound being readded was already present. The implementation is separated from the callback functions and an additional parameter is added to toggle the duplicate name check.

Previously this was hard to notice, as the error message popup was not shown due to the top-most popup being closed immediately. This will be fixed separately by a larger refactoring, so a popup can close itself immediately after opening another popup without closing the child popup instead.

Closes #6500.
2023-04-07 10:58:57 +02:00
bors[bot] b4c114450c
Merge #6492
6492: Refactor editor popups, improve layout of new folder, map details and event popups r=def- a=Robyt3

- New folder popup:
   - Before: 
![new_folder old](https://user-images.githubusercontent.com/23437060/229349012-66aa4156-7f2c-4132-9cf3-da7451f93b09.png)
   - After:
![new_folder new](https://user-images.githubusercontent.com/23437060/229349015-d53a07f8-baa4-46f6-af7d-50d302e5d784.png)
- Map details popup:
   - Before: 
![map_details old](https://user-images.githubusercontent.com/23437060/229349023-0febb078-0948-4820-bda5-98a8e560ffb8.png)
   - After:
![map_details new](https://user-images.githubusercontent.com/23437060/229349027-8cdcc47d-e71b-43f2-9f7c-533993772afd.png)
- New map event popup:
   - Before: 
![new_map old](https://user-images.githubusercontent.com/23437060/229349034-dea63fb4-0f2c-4a93-8235-ab06224d0a89.png)
   - After:
![new_map new](https://user-images.githubusercontent.com/23437060/229349039-863451ba-8154-427f-a30b-7c7e542aa0b5.png)
- Load current map popup:
   - Before: 
![load_map_current old](https://user-images.githubusercontent.com/23437060/229349045-fe8eabed-2a64-46cf-b0d7-e71c2297e0ac.png)
   - After:
![load_map_current new](https://user-images.githubusercontent.com/23437060/229349051-1877c1ec-713e-41da-b52e-19ba004b467e.png)
- Large layer popup:
   - Before: 
![large_layer old](https://user-images.githubusercontent.com/23437060/229349053-93301856-5f96-4c42-b7e1-d79afeaa9281.png)
   - After:
![large_layer new](https://user-images.githubusercontent.com/23437060/229349369-5c42c3ae-619c-4ff8-9b78-515415703bf4.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
- [ ] 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-04-06 21:47:11 +00:00
Valentin Bashkirov 85485d23ce highlight game type 2023-04-05 20:02:25 +02:00
Robert Müller aa08cfabc2 Fix swapping with dragger beams and plasmas
The client ID referenced by dragger beams and plasmas must also be swapped when two clients are swapped, as those entities should refer to the same character entity as before the swap.

For dragger beams, swapping previously caused the active beams to switch target to another character.

For plasmas, swapping previously caused already shot plasmas to not have an effect on their original target character.

Closes #5865.
2023-04-04 20:07:17 +02:00
Dennis Felsing 90861d9dda Get rid of unused warning 2023-04-04 09:08:38 +02:00
VoxelDoesCode df48c44e78 Bring every Font Icon unicode into a namespace
Fix namespace hopefully
2023-04-03 20:25:28 -04:00
VoxelDoesCode 0dfced4ca4 Bring Team logic into teams.cpp
MsgPlus -> Msg
2023-04-02 21:40:39 -04:00
Robert Müller 3c841f7ad8 Refactor CEditor::PopupEntities 2023-04-02 13:16:15 +02:00
Robert Müller 9391155360 Refactor CEditor::PopupColorPicker 2023-04-02 13:16:14 +02:00
Robert Müller 8bdf2cf7a9 Refactor CEditor::PopupGoto 2023-04-02 13:16:14 +02:00
Robert Müller d5a24d718b Refactor CEditor::PopupTune 2023-04-02 13:16:14 +02:00
Robert Müller c4b2531bb1 Refactor CEditor::PopupSwitch 2023-04-02 13:16:14 +02:00
Robert Müller b839c68350 Refactor CEditor::PopupSpeedup 2023-04-02 13:16:13 +02:00
Robert Müller 04c1e06e71 Refactor CEditor::PopupSelectConfigAutoMap 2023-04-02 13:16:13 +02:00
Robert Müller 03e7cfc9e4 Refactor CEditor::PopupSelectGametileOp 2023-04-02 13:16:13 +02:00
Robert Müller c730cd490a Refactor CEditor::PopupSelectSound 2023-04-02 13:16:12 +02:00
Robert Müller f3f44ca6b2 Refactor CEditor::PopupSelectImage 2023-04-02 13:16:12 +02:00
Robert Müller b20cf7865c Refactor CEditor::PopupEvent and improve layout
Swap buttons so confirm button is on the right and cancel button is on the left consistently.

Decrease empty space and popup size.

Add missing title for `POPEVENT_LOADCURRENT` (caught by the added assertion).

Improve messages by adding additional empty line for existing line breaks.
2023-04-02 13:16:12 +02:00
Robert Müller 91ce99b65b Refactor CEditor::PopupSound 2023-04-02 12:54:36 +02:00
Robert Müller 7289f7d504 Refactor CEditor::PopupImage 2023-04-02 12:54:36 +02:00
Robert Müller e09a771937 Refactor CEditor::PopupPoint 2023-04-02 12:54:36 +02:00
Robert Müller 04d9e2b54a Refactor CEditor::PopupMapInfo and improve layout
Swap buttons so confirm button is on the right and cancel button is on the left consistently.

Decrease empty space and popup size.
2023-04-02 12:54:36 +02:00
Robert Müller 141571cc55 Refactor CEditor::PopupNewFolder and improve layout
Swap buttons so confirm button is on the right and cancel button is on the left consistently.

Decrease empty space and popup size.
2023-04-02 12:54:35 +02:00
Robert Müller 5cfecdb42f Refactor CEditor::PopupSource 2023-04-02 12:54:35 +02:00
Robert Müller 2146d7bd92 Refactor CEditor::PopupQuad 2023-04-02 12:54:35 +02:00
Robert Müller 9f5de0c884 Refactor CEditor::PopupLayer 2023-04-02 12:54:35 +02:00
Robert Müller eda808e385 Refactor CEditor::PopupGroup 2023-04-02 12:54:35 +02:00
Robert Müller c1ffc8bf12 Refactor CEditor::PopupMenuFile 2023-04-02 12:54:34 +02:00
Robert Müller df91bb9b43 Refactor layer properties functions 2023-04-02 12:54:34 +02:00
Robert Müller c6d14e5fa1 Move all editor popup function definitions to popups.cpp
Editor code for the popups should be located in `popups.cpp`.
2023-04-02 12:52:37 +02:00
Robert Müller caac7b06e2 Fix static usage of POPEVENT_* enum literals
The `POPEVENT_*` enum literals should be used in a static manner.
2023-04-02 12:52:37 +02:00
Robert Müller 3d343c8758 Remove unnecessary popup debug message 2023-04-02 12:52:37 +02:00
Robert Müller f4c3fee617 Use ShowFileDialogError instead of ShowPopupMessage
To reduce duplicate code.
2023-04-02 12:52:37 +02:00
Dennis Felsing 1b1f2a0621 Version 16.9 2023-04-02 12:03:41 +02:00
bors[bot] 3bd24f322f
Merge #6490
6490: Improve collision entity access error message r=Chairn a=Robyt3

See #6489.

## 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-04-01 22:29:29 +00:00
Robert Müller ed26be0917 Improve collision entity access error message
See #6489.
2023-04-02 00:03:30 +02:00
Robert Müller ab73cc718f Refactor entity bounds check 2023-04-02 00:01:17 +02:00
Dennis Felsing 5fa2fefd35 Remove unused DoFilter
Thanks to cheeser0613
2023-04-01 13:39:20 +02:00
Jupeyy ffe3d26e59 fix start size of freezing flakes particles & vel of player death 2023-03-28 21:33:48 +02:00
bors[bot] a27dbb1219
Merge #6435
6435: add proof mode for menu backgrounds closes #3009 r=def- a=Marmare314


![backgroundproof](https://user-images.githubusercontent.com/49279081/225979288-3fb43d41-79f7-477e-8479-6b3d106fbd5b.gif)

## 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-03-27 14:48:18 +00:00
marmare314 927c80167f update selected layer correctly after dragging 2023-03-27 09:13:39 +02:00
marmare314 93d204f0ca show duplicate positions in tooltip 2023-03-27 08:51:02 +02:00
VoxelDoesCode 5b1a716aa2 Simplify KillMsgTeams NetMsg, fixing bugs
Clang format before squash

Split apart OnMessage() before squash

forgot something
2023-03-26 23:32:34 -04:00
bors[bot] e3575b1ae8
Merge #6469
6469: Add new contributor 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>
2023-03-26 16:14:00 +00:00
bors[bot] b207826df1
Merge #6470
6470: Fix ninja not getting predicted r=heinrich5991 a=Zwelf

Fixes #6464

This was regressed by #6246 by the wrong transformation of `if(!m_FreezeTime)` to `if(m_FreezeTime != 0)` instead of the correct `if(m_FreezeTime == 0)`.

And take additional measure to never set m_FreezeTime to a negative number in client prediction code.

## 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: Zwelf <zwelf@strct.cc>
2023-03-26 14:50:25 +00:00
Zwelf d40ff12d9a Fix ninja dash not getting predicted correctly
Fixes #6464

This was regressed by #6246 by the wrong transformation of `if(!m_FreezeTime)`
to `if(m_FreezeTime != 0)` instead of the correct `if(m_FreezeTime == 0)`.

And take additional measure to never set m_FreezeTime to a negative
number in client prediction code.
2023-03-26 16:42:31 +02:00
Dennis Felsing 6b0656ff85 Add new contributor 2023-03-26 16:28:06 +02:00
Robert Müller 1b19895204 Ensure texture is cleared when rendering MOTD background
Seems like there are cases where the texture is not cleared when the MOTD background is rendered, so part of the font texture is used for the round rect.
2023-03-26 13:15:36 +02:00
bors[bot] 214053ec9a
Merge #6459
6459: Add random skin button r=def- a=HiRavie

Adds a button for generating a random skin in tee settings. The logic generates handsome tees more often than not.
Intentionally didn't add a console command so it's not possible to make annoying skin change binds with this.
![random_skin](https://user-images.githubusercontent.com/65019210/227658839-5e8f3a4b-4e7c-4561-90c9-21a267d61a3a.png)

## 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: Ravie <65019210+HiRavie@users.noreply.github.com>
2023-03-25 23:08:15 +00:00
Robert Müller fda8507d03 Add "Delete" button to editor file browser
To delete files and empty folders from the user's save directory.

Only files and folders from the user's save directory can be deleted. Only empty folders can be deleted.

Error message popups are shown when the deletion fails.

Closes #6272.
2023-03-25 16:59:02 +01:00
Robert Müller 6f1533ee18 Group UI code of right and left editor file dialog buttons
Move UI code for "New folder" button close to the code the "Map details" button.
2023-03-25 16:58:51 +01:00
Ravie 20ac914e0e Tooltip ID 2023-03-25 16:13:29 +01:00
Ravie eb41ecf3d7 Icon button, tooltip and various fixes 2023-03-25 15:43:25 +01:00
Ravie 705be7c6e3 Implement random skin button 2023-03-25 13:11:47 +01:00
Robert Müller 880ced2de0 Fix dummy tee being able to ping main tee in chat
Main and dummy tee cannot ping each other anymore. Other main and dummy tees can still ping your own main and dummy tees.

We must ensure to only use `m_aLocalIDs[1]` when the dummy is connected, as this ID is not updated when no dummy is connected, so it can refer to another client if you disconnect your dummy and another client subsequently takes its client ID.

Closes #3699.
2023-03-23 20:24:28 +01:00
bors[bot] 971b166488
Merge #6439
6439: Refactor `random` functions r=heinrich5991 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-03-23 12:56:55 +00:00
Robert Müller a91b51c8a2 Select language on first start based on user locale
On first client start (when `cl_show_welcome` is `1`), determine the user locale with `os_locale_str` and initially select the most fitting language for this locale.

For this the language index must also be loaded immediately on client launch, before the initial language is loaded.
2023-03-21 21:17:40 +01:00
Robert Müller cddbc78592 Add RFC 3066 language tags to language index
Add RFC 3066 language tags to language index in order to identify the language to select when first starting the game based on the user's locale.

Multiple language tags can be specified per entry separated with a semicolon, as some languages have different tags that do not share a unique prefix (e.g., Simplified and Traditional Chinese).
2023-03-21 21:17:40 +01:00
Robert Müller 481698c7d0 Move CLanguage and LoadLanguageIndexfile to localization
The `CLanguage` class and `LoadLanguageIndexfile` function are more appropriately located in the file for the other localization functions.
2023-03-21 21:17:40 +01:00
Robert Müller a4b489aa87 Fix incorrect sixup detection when snapping pickups
For 0.7 clients the client version is not `VERSION_NONE`, so `IsSixup` was never called for them, which leads to version 0.6 pickups being snapped for 0.7 clients. This causes snapshot CRC errors for the 0.7 clients, as the 0.6 and 0.7 pickup structs have different sizes.

Now the version is no longer checked before calling `IsSixup`, which is the case in all other locations where the function is called and was also the case before this bug was introduced by #6330.
2023-03-20 19:01:44 +01:00
bors[bot] 8a9489292e
Merge #6443
6443: Reveal selection when scrolling layer list with up/down arrow keys r=def- a=Robyt3

Closes #6441.

## 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-03-19 13:19:54 +00:00
Robert Müller 0c6c52e8d9 Reveal selection when scrolling layer list with up/down arrow keys
Closes #6441.
2023-03-19 12:34:50 +01:00
bors[bot] 854445d4e1
Merge #6434
6434: Show popups in editor when loading/saving file fails, fix minor issues with preview image r=def- a=Robyt3

![screenshot_2023-03-17_13-00-59](https://user-images.githubusercontent.com/23437060/225899583-fb264a56-ad9d-455e-b80b-885aad2fbd51.png)

![screenshot_2023-03-17_13-00-46](https://user-images.githubusercontent.com/23437060/225899589-d143d9db-ccaf-47d6-92cf-dea3dd49ab80.png)

![screenshot_2023-03-17_13-00-38](https://user-images.githubusercontent.com/23437060/225899590-527bb926-a244-4a55-ab3b-69953b836cf3.png)

![screenshot_2023-03-17_13-00-16](https://user-images.githubusercontent.com/23437060/225899598-abfa9c44-d2c5-4261-8459-2a4d612d480f.png)

![screenshot_2023-03-19_11-12-28](https://user-images.githubusercontent.com/23437060/226169030-e4d33cb1-238f-4e7d-a57d-1cf0a8bb18ea.png)

![screenshot_2023-03-17_12-59-42](https://user-images.githubusercontent.com/23437060/225899607-3613b4b6-2ef8-45c9-8803-61380ef675a7.png)

When using Ctrl+S:

![screenshot_2023-03-17_12-59-31](https://user-images.githubusercontent.com/23437060/225899610-44dbda9d-1207-4456-8219-a5a4947691fe.png)

Closes #6430.

## 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-03-19 11:21:51 +00:00
Robert Müller 99ef97a0f8 Use variadic arguments for ShowFileDialogError formatting
Reduces duplicate code when calling the function.

Also increase the size of the message popup message, as it was not large enough for all paths.
2023-03-19 11:48:39 +01:00
VoxelDoesCode 929675be68 Make team kills condensed in killfeed
Clang + Formatting test before merge
2023-03-18 23:27:59 -04:00
bors[bot] 22b7e5eaf4
Merge #6438
6438: Fix incorrect tee blood color being shown in settings r=def- a=Robyt3

When the tee color lighting is set to 0, the blood color was shown as black instead of the actual tee blood color. The blood color used ingame is already correct and now matches the color shown in the settings.

## 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-03-18 22:14:29 +00:00
Robert Müller c5f2727a3f Fix inconsistent slow mouse in editor
The mouse slow flag must be reset at the beginning of the render function in the editor instead of at the beginning of the update function, as it otherwise only works very inconsistently.
2023-03-18 22:26:43 +01:00
Robert Müller 484df7fc79 Support holding shift for slow mouse with color pickers
When picking a color with a color picker also support holding shift to move the mouse slowly (at 5% normal speed) like for scrollbars.
2023-03-18 22:24:46 +01:00
Robert Müller a9ef757475 Add random_float functions with min and max arguments
Add `random_float(float min, float max)` to generate a random `float` between `min` and `max`.

Add `random_float(float max)` to generate a random `float` between `0.0f` and `max`.
2023-03-18 12:09:37 +01:00
Robert Müller 0cf5dd7ad3 Add random_direction function
Replace existing `RandomDir` with this function. This function was biased towards the corners, as it first generates a random `vec2` with `x` and `y` in `[-0.5f;0.5f]` and then normalizes it, which doesn't result in a uniform distribution of directions. Now the random direction is generated by taking a random angle and then converting it to a direction which is per definition already normalized.
2023-03-18 12:09:37 +01:00
Robert Müller ea6e267d98 Add random_angle function
To generate a random angle in the range `[0.0f;2.0f * pi[`. This ensures that the random angle cannot be `2.0f * pi`, which would be identical to the angle `0.0f` and therefore cause the random angle to be less uniformly selected.

Note that this first casts `RAND_MAX` to a `float` and then uses `std::nextafter` to get the next larger `float`. Using `RAND_MAX + 1` would cause an integer overflow on systems where `RAND_MAX == INT_MAX` (e.g. Ubuntu and macOS).
2023-03-18 12:07:52 +01:00
Robert Müller d2bd863c79 Fix incorrect tee blood color being shown in settings
When the tee color lighting is set to 0, the blood color was shown as black instead of the actual tee blood color. The blood color used ingame is already correct and now matches the color shown in the settings.
2023-03-18 11:09:49 +01:00
marmare314 7f0c0523fd fix formatting 2023-03-18 08:19:52 +01:00
marmare314 0cbc725235 fix formatting and include array 2023-03-18 08:07:25 +01:00
marmare314 8e2869e280 add tooltips 2023-03-18 07:53:18 +01:00
marmare314 9537656e57 use array again and consider checkpoints 2023-03-17 19:25:50 +01:00
marmare314 0ce70f863b add proof mode for menu backgrounds closes #3009 2023-03-17 18:37:55 +01:00
Robert Müller 3ab0fa7653 Fix editor preview image not being updated after searching
The preview image was not being updated after the search term is changed. Changing the search term causes the selected image to be changed, so the preview image also needs to be updated.
2023-03-17 12:58:25 +01:00
Robert Müller 9b8d8e4965 Don't reload editor preview image every frame if it's invalid
If the preview image in the "Add image" dialog could not be loaded it was retried every frame, which causes a debug message to be printed each time.

Now a tristate variable is used to ensure that the image is not reloaded after is previously failed to load.
2023-03-17 12:58:25 +01:00
Robert Müller 0c67d033ea Show popups in editor when loading/saving file fails
Show error message in a popup at the current mouse position when a file operation fails. Also works when pressing Ctrl+S to save.

When replacing images/sounds also first check if an image/sound with that name already exists.

When replacing sounds also first check whether the replacement sound could be loaded and don't replace existing sound with invalid sound on failure.

Replace existing error message for "Create folder" dialog with the new mechanism.

Closes #6430.
2023-03-17 12:58:24 +01:00
bors[bot] 5e2e1e25e3
Merge #6433
6433: add show directory button in filedialog closes #6422 r=Robyt3 a=Marmare314

## 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
- [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-03-17 11:30:35 +00:00
marmare314 b477173b8a add show directory button in filedialog 2023-03-17 12:17:31 +01:00
marmare314 fe221dab23 implement draggable layers 2023-03-17 11:28:08 +01:00
bors[bot] cc612a7e18
Merge #6423
6423: Always enable editor panning and zooming when GUI is hidden r=heinrich5991 a=Robyt3

The `UI()->MouseInside(&View)` check does work when the mouse is all the way at the right or bottom side. Changing the `MouseInside` functions introduces other problems due to UI element and mouse positions being floating point numbers and not corresponding to exact pixels.

As a workaround to enable unlimited editor panning in all direction when the GUI is hidden the check is omitted, as the map editor encompasses the entire view and so the check is not necessary in this case.

Closes #4553.

## 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-03-16 20:51:17 +00:00
bors[bot] 5241c4ce5f
Merge #6425
6425: Don't add duplicate consecutive commands to console history r=heinrich5991 a=Robyt3

Don't add entered command to console history, if the last console history entry is identical to this command. For example, entering the commands `1`, `2`, `3`, `3`, `2`, `1` adds 5 entries to the history, i.e. only one entry for the command `3`.

## 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-03-16 20:29:33 +00:00
Robert Müller 66ad9536fe Extend CScrollRegion to support scrolling when mouse at edge
Add `ScrollRelative` function to initiate relative scrolling programmatically, to realise scroll regions that scroll when the mouse is being dragged at the edge.

Add `DoEdgeScrolling` to encapsulate all the necessary edge scrolling logic based on the position of the mouse. The edge scrolling starts at a fixed distance from the edges. The scrolling speed is dependent on the distance of the mouse from this border.
2023-03-16 13:07:04 +01:00
Robert Müller d08f784a97 Don't add duplicate consecutive commands to console history
Don't add entered command to console history, if the last console history entry is identical to this command. For example, entering the commands `1`, `2`, `3`, `3`, `2`, `1` adds 5 entries to the history, i.e. only one entry for the command `3`.
2023-03-14 23:33:06 +01:00
Robert Müller 3808a23bc7 Always enable editor panning and zooming when GUI is hidden
The `UI()->MouseInside(&View)` check does work when the mouse is all the way at the right or bottom side. Changing the `MouseInside` functions introduces other problems due to UI element and mouse positions being floating point numbers and not corresponding to exact pixels.

As a workaround to enable unlimited editor panning in all direction when the GUI is hidden the check is omitted, as the map editor encompasses the entire view and so the check is not necessary in this case.

Closes #4553.
2023-03-14 22:19:40 +01:00
bors[bot] 762f1a1262
Merge #6421
6421: ignore tiles that dont use ids in ContainsElementWithId r=Robyt3 a=Marmare314

See #5908. As far as I can tell this function is only used in the popup, so this should not break anything.

## 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: marmare314 <49279081+Marmare314@users.noreply.github.com>
2023-03-14 20:02:14 +00:00
bors[bot] 5f7f30d009
Merge #6419
6419: add sorting by name and time modified to filedialog r=Robyt3 a=Marmare314

As suggested in #4508 it would be nice to have at least some basic sorting ability in the filedialog. This PR implements at least the two most important sorting criteria: filename and time modified. Also the time modified is now displayed.
At the moment the characters ▲ and ▼ are used to indicate the sorting direction. Maybe there is a nicer way to display this.
![file_dialog_1](https://user-images.githubusercontent.com/49279081/224561567-d3335ca0-d9c9-4d44-ab97-31ce177d287e.png)
![dialog_2](https://user-images.githubusercontent.com/49279081/224561570-4182ba16-bfe0-42d7-b2ee-0f49895fec85.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-03-14 18:55:19 +00:00
marmare314 71c8aad8d4 ignore tiles that dont use ids in ContainsElementWithId 2023-03-14 18:39:12 +01:00
marmare314 223813e519 reset timemodified sort 2023-03-14 17:17:24 +01:00
Robert Müller 1e74e06908 Fix slash removal when multiple slashes are pasted in editor
When pasting text containing multiple consecutive (back)slashes in the editor save dialog not all slashes where removed. For example with the text `/a//bb/\/ccc////dddd//\//`.
2023-03-14 13:32:06 +01:00
marmare314 fb5cb3e131 fix formatting 2023-03-12 19:57:46 +01:00
marmare314 c338eca199 ignore time for links and root folder 2023-03-12 19:41:58 +01:00
marmare314 e2449ac3b8 use str_timestamp_ex and fix codestyle 2023-03-12 18:54:57 +01:00
marmare314 9540d27a10 fix formatting issues and clean up indicator selection 2023-03-12 18:39:11 +01:00
marmare314 f012716af6 add sorting by name and time modified to filedialog 2023-03-12 18:10:22 +01:00
bors[bot] 20ae11567f
Merge #6416
6416: use ValueSelector for envelope selection #3598 r=def- a=Marmare314

Allow choosing envelopes by typing its ID.

## 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
- [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-03-12 15:29:12 +00:00
marmare314 05204bbcb8 use ValueSelector for envelope selection closes #3598 2023-03-12 15:58:38 +01:00
bors[bot] 2323359ea5
Merge #6409
6409: Refactor server process launching from client 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-03-10 23:20:28 +00:00
Robert Müller 128d3e4758 Handle return value of kill_process
Only clear process handle if the process was actually killed.
2023-03-10 17:59:36 +01:00
Robert Müller a0c61a1b60 Add INVALID_PROCESS to represent invalid PROCESS value 2023-03-10 17:39:24 +01:00
Robert Müller 4834cfdac9 Rename CServerProcess::Process to CServerProcess::m_Process 2023-03-10 17:38:04 +01:00
Robert Müller 8d225fd3e7 Remove unused CServerProcess members 2023-03-10 17:36:33 +01:00
Robert Müller 4a94ab340f Fix some potentially undefined editor member variables
See #6407.
2023-03-10 17:18:24 +01:00
Robert Müller e07d9ae724 Use std::size(g_Config.m_SvMotd) instead of magic number 900
The size of the `sv_motd` config variable is also `900`.
2023-03-10 00:32:51 +01:00
Robert Müller de99fecaa0 Use text container for ingame server info MOTD
Optimize MOTD rendering in ingame menu by caching the text.

Use the correct text height based on the aligned font size instead of the original font size, to fix the discrepancy between the scrollable height and the text height.
2023-03-09 23:48:31 +01:00
Robert Müller c286f32b17 Use text and quad containers for ingame MOTD, refactor variables
Optimize MOTD rendering by caching the round rect and the text.

Align font and rect sizes so exactly 24 lines of text fit in the MOTD rect with margins on all sizes.
2023-03-09 23:04:19 +01:00
Robert Müller a02738bd2e Mark CMotd::IsActive as const 2023-03-09 23:04:19 +01:00
Robert Müller 53635deb35 Encapsulate CMotd::m_aServerMotd with getter 2023-03-09 23:04:18 +01:00
bors[bot] 0fd284a6f3
Merge #6392
6392: Add missing default value for custom parallax zoom property r=def- a=Robyt3

The "Custom Zoom" property was not initialized when creating a new layer group, leading to the property editor not working correctly and an undefined value being saved to the map file.

![property-editor](https://user-images.githubusercontent.com/23437060/223575784-81ce5eeb-992e-4084-985b-183b4389090c.png)

## 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-03-07 23:22:28 +00:00
Robert Müller 96ccfbb4c2 Add missing default value for custom parallax zoom property
The "Custom Zoom" property was not initialized when creating a new layer group, leading to the property editor not working correctly and an undefined value being saved to the map file.
2023-03-08 00:15:15 +01:00
Robert Müller da08533adf Revert "When GUI inactive, unlock mouse and don't render popup menus"
This reverts commit 0e476dfd70.
2023-03-07 22:51:56 +01:00
Robert Müller d69084ca0d Revert "Close editor popups and prevent popups from opening when GUI hidden"
This reverts commit 5c4d5fb571.
2023-03-07 22:43:35 +01:00
Robert Müller 5c4d5fb571 Close editor popups and prevent popups from opening when GUI hidden
Prevent editor popups (quad point, quad pivot, sound source) from being opened while the editor GUI is hidden. The opened popups would not be visible, which results in multiple identical popups being opened at the same time. This cannot happen while the GUI is shown, as the already opened popup takes focus so no second identical popup can be opened at the same time.

Additionally, all opened popups are now closed when the GUI is hidden. Otherwise this results in crashes, as the already opened popups reference the current layer and quad selection, which can change or become invalidated while the GUI is hidden.

Closes #6383.
2023-03-07 00:31:31 +01:00
bors[bot] 5107b38d04
Merge #6324 #6345
6324: Optimize client ids map update r=def- a=0xfaulty

I have launched support for 128 players in testing mode on my server, it's means it's time for another step in this direction here. Perhaps not all changes will be clear, I am ready to answer/discuss them as usual. Let me know if I forgot or didn't take anything into account.

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


6345: Set constant and uniform names for the server and client CMake targets r=def- a=Kaffeine

This MR set the server and client CMake target names to `game-server` and `game-client` which are uniform with other targets such as `engine-gfx`, `engine-shared`, and `game-shared`.

Set uniform names for the targets to:
1. Avoid long rebuilds on the target _executable_ name changed
2. Provide the same name for different executables and/or different setup (use-cases are `cmake --build . --target game-server` and various CMake target lookups in IDEs)

Those changes are necessary but not enough to allow CI for custom app name on all platforms.

Personally this 'll allow me switch to between DDNet and Infclass branches faster and without breaking the targets configuration (e.g. with that patchset I can have `game-client` as an active target in both branches), and also reduces the conflicts in `CMakeLists.txt`.
Easier to switch between the forks => easier to contribute.

Co-authored-by: Valentin Bashkirov <valenteen3d@ya.ru>
Co-authored-by: Valentin Bashkirov <v.bashkirov@dev.tassta.com>
Co-authored-by: Alexander Akulich <akulichalexander@gmail.com>
2023-03-05 16:53:37 +00:00
Dennis Felsing 0ff19c617a Fix color in json (fixes remaining #6366 hopefully) 2023-03-05 15:43:15 +01:00
Dennis Felsing 38933d319f Fix invalid json (partially fixes #6366) 2023-03-05 15:43:15 +01:00
Dennis Felsing d6f617debd Version 16.8 2023-03-05 15:41:26 +01:00
Robert Müller 75d371743e Disable editor file browser hotkeys while another popup is open
Prevent enter, escape, up/down and F5 keys from manipulating the editor file browser while a popup menu (map details, new folder) is open.
2023-03-03 22:28:56 +01:00
Robert Müller dc2601f335 Fix opening file in editor with enter not working after searching
The filename of the selected file is tracked separately and was not updated when the search term in the Open File dialog is changed.
2023-03-03 22:28:08 +01:00
bors[bot] 0f5d4d8bec
Merge #6372
6372: Check in CI that no C standard headers are used, replace all usages of C standard headers with C++ headers, replace usages of C math functions r=def- a=Robyt3

Closes #6334.

## 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-03-01 22:34:26 +00:00
Robert Müller db4ec4a12d Replace usages of C math functions
Replacing the C standard headers with the C++ standard headers causes various `error: call to 'floor' promotes float to double [performance-type-promotion-in-math-fn,-warnings-as-errors]`, which are fixed by using the C++ std math functions or our own math functions instead of the C math functions.

- Use `absolute` instead of `abs` and `fabs`.
- Use `std::floor` instead of `floor` and `floorf`.
- Use `std::ceil` instead of `ceil`, `ceilf` and `round_ceil`.
- Use `std::round` instead of `round` and `roundf`.
- Use `std::sin` instead of `sin` and `sinf`.
- Use `std::asin` instead of `asin` and `asinf`.
- Use `std::cos` instead of `cos` and `cosf`.
- Use `std::acos` instead of `acos` and `acosf`.
- Use `std::tan` instead of `tan` and `tanf`.
- Use `std::atan` instead of `atan` and `atanf`.
- Use `std::pow` instead of `pow` and `powf`.
- Use `std::log` instead of `log` and `logf`.
- Use `std::log2` instead of `log2` and `log2f`.
- Use `std::log10` instead of `log10` and `log10f`.
- Use `std::pow` instead of `pow` and `powf`.
- Use `std::sqrt` instead of `sqrt` and `sqrtf`.
- Use `std::fmod` instead of `fmod` and `fmodf`.
- Use `direction(Angle)` instead of `vec2(std::cos(Angle), std::sin(Angle))`.
- Use `length(vec2(x, y))` instead of `std::sqrt(x * x + y * y)`.
- Remove unused `NormalizeAngular` and `AngularDistance` functions.
2023-03-01 19:26:53 +01:00
Robert Müller a76fb9b99a Replace all usages of C standard headers with C++ headers 2023-03-01 19:26:51 +01:00
Robert Müller 24fd7e626d Fix client crash when cl_chat_old config is used
The graphics are not initialised when `RebuildChat` is called by `ConchainChatOld`, which causes the client to crash if `cl_chat_old` is present in the user's config or used as a command line argument.
2023-02-28 21:43:21 +01:00
Valentin Bashkirov 287d36c4d1 fixed comments 2023-02-28 13:06:50 +01:00
bors[bot] e992089d02
Merge #6364
6364: Fix incorrect text wrapping in ingame server info r=def- a=Robyt3

The maximum width for the server info and game info text was too small, which previously didn't matter, because the manual newlines broke text wrapping in this case, but with the fix from #6353 this now causes the text to break after the colons already.

This is fixed by using the maximum available width for the text instead of a too small magic number (`250.0f`).

For completeness, the maximum width for the title texts is unset (`-1.0f`), because they should never wrap, which is consistent with the MOTD title text.

Before:

![screenshot_2023-02-26_11-46-26](https://user-images.githubusercontent.com/23437060/221405841-30c0a57a-d7ce-44c5-8c2e-958d67c801a4.png)

After:

![screenshot_2023-02-26_11-41-24](https://user-images.githubusercontent.com/23437060/221405844-faf9095f-07d9-4dde-bfd5-9e44197d1fce.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
- [ ] 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-02-26 11:52:18 +00:00
Robert Müller d1a9f0a76a Fix erratic smooth scrolling when scroll time is changed
Remember the maximum animation time when initiating a smooth scroll, so the smooth scrolling does not change erratically when `ui_smooth_scroll_time` is changed while smooth scrolling is in progress.
2023-02-26 12:12:08 +01:00
Robert Müller ffa4801220 Fix incorrect text wrapping in ingame server info
The maximum width for the server info and game info text was too small, which previously didn't matter, because the manual newlines broke text wrapping in this case, but with the fix from #6353 this now causes the text to break after the colons already.

This is fixed by using the maximum available width for the text instead of a too small magic number (`250.0f`).

For completeness, the maximum width for the title texts is unset (`-1.0f`), because they should never wrap, which is consistent with the MOTD title text.
2023-02-26 11:43:55 +01:00
Jupeyy 9530077588 Only call onresize events if actual size changed
clearify difference between resize and window property change for resolution list
2023-02-25 16:02:38 +01:00
bors[bot] 931ea6d828
Merge #6351
6351: Fix client crash when echoing client message to chat, use em dash for client messages in chat like on upstream r=def- a=Robyt3

![client-message](https://user-images.githubusercontent.com/23437060/220452193-1ce5cc5b-b79b-4632-a675-5ca70c37e7f0.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
- [ ] 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-02-24 08:25:43 +00:00
Robert Müller a1821986fa Align color picker buttons on right side
Align the color picker selection and reset buttons on the right side instead of the left side dependent on the label width.

Closes #6237.

The `UseCheckBox` argument is removed and instead `pCheckBoxValue != nullptr` is used.
2023-02-23 22:32:04 +01:00
Robert Müller 541115022a Fix client crash when echoing client message to chat
The client crashes when printing a client message to the chat from a config file or from the command line, as the graphics have not been initialized at that point.

Closes #6350.
2023-02-23 21:49:56 +01:00
Robert Müller 284f3326a7 Use em dash for client messages in chat like on upstream 2023-02-23 21:49:56 +01:00
heinrich5991 1a2c82c0b1 Mark absolute #includes as absolute 2023-02-23 10:53:16 +01:00
Robert Müller 61bf48c1ed Add chat message constants from upstream, remove redundant comments
Add `CLIENT_MSG = -2` and `SERVER_MSG = -1` constants from upstream.

Remove comments for self-documenting code.
2023-02-21 20:46:17 +01:00
Robert Müller 8286105804 Use RecreateTextContainer, reorder parameters
The `RecreateTextContainer` function calls `DeleteTextContainer` and then `CreateTextContainer`.

The arguments of `RecreateTextContainer` and `RecreateTextContainerSoft` are reordered so all functions take the text container as their first argument.
2023-02-20 23:39:43 +01:00
Robert Müller f386eff45c Remove unused argument of Text/TextWidth/TextLineCount
The `void *pFontSetV` argument is unused and all invocations except one were already passing `0`, `0x0` or `nullptr` for this argument.
2023-02-20 20:06:17 +01:00
bors[bot] d347bfcbe9
Merge #6339
6339: Update menus_browser.cpp r=def- a=Sedonya

The first change concerning S-DDRace

## 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: Sedonya_ <danilshalaginov829@gmail.com>
2023-02-20 10:42:12 +00:00
Robert Müller ec7f5560a3 Fix possible integer overflows using mem_* functions 2023-02-19 13:45:48 +01:00
Alexander Akulich bb5f0f8894 Cleanup unused or not defined functions 2023-02-18 20:05:52 +03:00
Sedonya_ c0b39628aa Update menus_browser.cpp 2023-02-17 00:48:31 +05:00
bors[bot] 95a65f5695
Merge #6338
6338: Reset graphics container indices after deletion r=Jupeyy a=Robyt3

Reduce duplicate code and improve correctness by passing indices of quad, buffer and text containers by reference and always setting them to `-1` after they are deleted.

Also check if index is `-1` before trying to delete it to reduce duplicate code when calling the methods.

## 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-02-16 10:24:41 +00:00
bors[bot] 9941bda313
Merge #6333
6333: Add `CFGFLAG_SAVE` flag to save prediction margin (fixes #6332) r=def- a=Chairn

I guess when you have a bad connection, it stays the same during several days, so it makes sense to save prediction margin

## 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: Chairn <chairn.nq@hotmail.fr>
2023-02-15 20:36:29 +00:00
Robert Müller 3280f1824f Reset graphics container indices after deletion
Reduce duplicate code and improve correctness by passing indices of quad, buffer and text containers by reference and always setting them to `-1` after they are deleted.

Also check if index is `-1` before trying to delete it to reduce duplicate code when calling the methods.
2023-02-15 21:05:15 +01:00
bors[bot] 3fcabec30b
Merge #6328
6328: Remove `bytes_be_to_int` and `int_to_bytes_be`, static assert size of `int` and `unsigned`, refactoring r=heinrich5991 a=Robyt3

Supersedes #6263.

## 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-02-14 22:11:05 +00:00
Chairn 3f050f5e6a Add CFGFLAG_SAVE flag to save prediction margin (fixes #6332) 2023-02-13 21:24:10 +01:00
Robert Müller be6862e997 Use sizeof(int32_t) instead of 4 2023-02-11 13:59:08 +01:00
Alexander Akulich 3a9e4ee067 Extract SnapPickup() to CGameContext helpers 2023-02-10 23:12:26 +03:00
Alexander Akulich 2ad5c020e0 Add a simpler IServer::SnapNewItem() API based on some more generated data 2023-02-10 23:12:24 +03:00
Alexander Akulich cc43d402d3 Extract SnapLaserObject() from entities to CGameContext helpers 2023-02-10 23:07:07 +03:00
Alexander Akulich f5d7174c36 GameContext: Use SERVER_DEMO_CLIENT instead of a magic number 2023-02-10 23:04:01 +03:00
Alexander Akulich 971e1b0093 server/pickup: Use enum values and struct size instead of magic numbers 2023-02-10 23:04:01 +03:00
bors[bot] 911bd0e69a
Merge #6282
6282: Add a refresh button to the editor file browser r=heinrich5991 a=Robyt3

![screenshot_2023-01-13_22-51-07](https://user-images.githubusercontent.com/23437060/212426385-f8c03e58-8e5d-4c47-9f19-865946c5be9c.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
- [ ] 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-02-04 11:16:09 +00:00
Robert Müller 624f7df217 Fix memory leak of editor preview image texture and data
The texture of the previous preview image was not unloaded before loading the texture of the new image.

The PNG data was never freed either. It's not necessary to keep this data loaded after loading the texture.
2023-02-04 11:28:13 +01:00
Robert Müller 218e6f7985 Remove bytes_be_to_int and int_to_bytes_be
Use `bytes_be_to_uint` and `uint_to_bytes_be` instead.

As casting between `int` and `unsigned` preserves the bit representation of the value, it's not necessary to apply additional tricks to convert between `char` arrays and `int`.
2023-02-04 01:24:03 +01:00
Valentin Bashkirov 934546e9c5 skip pMap filling on new versions 2023-02-02 12:12:48 +01:00
Valentin Bashkirov 63fe1e29d2 rewrote pMap filling 2023-02-01 22:37:17 +01:00
bors[bot] 9bd43795c8
Merge #6293
6293: rewrite int64_t to bitset for clients mask r=Robyt3 a=0xfaulty

Alternative version for PR [#6292](https://github.com/ddnet/ddnet/pull/6292) with bitset used.
I did the naming as I would like, but I can change it if there is a more suitable one, typedef is just for shortening, can be removed.

## 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: Valentin Bashkirov <v.bashkirov@dev.tassta.com>
Co-authored-by: Valentin Bashkirov <valenteen3d@ya.ru>
2023-01-31 17:06:49 +00:00
Valentin Bashkirov 1bb7b5b44a use length_squared 2023-01-31 00:46:39 +01:00
Robert Müller 52aa8ac22a Use str_copy instead of str_format
Using `str_format` without format arguments is equivalent to `str_copy`, but using the latter is more efficient and readable.

As `str_format` also returns the result `str_utf8_fix_truncation`, i.e. the potentially truncated string length, the return value is also added to `str_copy` so existing invocations don't need to be adjusted.
2023-01-28 16:37:33 +01:00
Robert Müller 34ef28c6b6 Fix empty chat message being sent when using moderate
When activating `moderate` on a server that already has another active moderator, `aBuf` contained undefined values and the empty or undefined message was sent to the clients.

Clients ignore empty chat messages and don't display or log them, but the empty message can be seen in the server console.

Now no buffer is used anymore, so no empty message can be sent.
2023-01-28 16:36:03 +01:00
Robert Müller 854dc47cf7 Replace unnecessary char buffers with pointers 2023-01-28 16:35:29 +01:00
Valentin Bashkirov d61fcbaba2 optimize map update 2023-01-26 20:21:42 +01:00
Valentin Bashkirov 79f72a5d55 move typedef to protocol.h 2023-01-26 11:56:48 +01:00
Robert Müller 9054eb15aa Add buttons to move envelopes left and right, use unicode icons
Closes #4129.
2023-01-25 20:05:06 +01:00
Robert Müller b997fe97bc Decrease buffer size 2023-01-25 20:05:06 +01:00
Robert Müller 385fa4d36c Slightly decrease width of name editbox if total width is low 2023-01-25 20:05:06 +01:00
Robert Müller 2514f1d521 Align the editbox labels in the envelope editor with the editboxes 2023-01-25 20:05:06 +01:00
Robert Müller 27790be784 Reserve same space for all envelope channel buttons
Keep all the UI elements in the envelope editor at the same position, independent from the number of channels of the selected envelope.

Previously the UI elements changed their position due to different numbers of channels of the different envelope types. Now the space for the maximum number of channels is always reserved and the UI elements don't move around.
2023-01-25 20:05:06 +01:00
Robert Müller 7ce143bd9e Add CEnvPoint::MAX_CHANNELS constant 2023-01-25 20:05:05 +01:00
Robert Müller 3c42b224f5 Add margin to point value/time editboxes for low screen width
The labels for the editboxes are not shown when the screen width is low, but the spacing should still be applied to the editboxes in that case.
2023-01-25 20:05:05 +01:00
Robert Müller d6d8739031 Remove unnecessary temporary CUIRect 2023-01-25 20:05:05 +01:00
Robert Müller c62cc979cb Remove dead commented code 2023-01-25 20:05:05 +01:00
Robert Müller c9d8fedcee Use IGraphics::CORNER_NONE instead of 0 2023-01-25 20:05:05 +01:00
Robert Müller 3b4d2910ef Rename envelope Synchronized checkbox to Sync.
To gain more width of other controls.
2023-01-25 20:05:04 +01:00
Robert Müller 5b61691f25 Pass nullptr to CUIRect functions when result is unused 2023-01-25 20:05:04 +01:00
Robert Müller c86ef06c5c Add tooltip support for editboxes in editor
Add tooltips for envelope name, point value and point time.
2023-01-25 20:05:04 +01:00
Zwelf 010d545fac Fix Crash in CSafeTeam::Safe/Load
Fixes #6304

`pEnt` is freed after removing, so must not be used in the next loop
iteration.
2023-01-25 18:47:03 +01:00
Valentin Bashkirov 1cd9eac7ae rewrite int64_t to CClientMask 2023-01-24 09:27:29 +01:00
Dennis Felsing 1af3c2274a More minimal clang-tidy 15 run
Alternative to #6294

The only remaining problems are:
/home/deen/git/ddnet/src/engine/client/backend/glsl_shader_compiler.cpp:22:26: warning: unnecessary temporary object created while calling emplace_back [modernize-use-emplace]
        m_vDefines.emplace_back(SGLSLCompilerDefine(DefineName, DefineValue));
                                ^~~~~~~~~~~~~~~~~~~~                       ~
2023-01-23 11:20:05 +01:00
Robert Müller 29b61fc438 Refactor CEditor:::PopupLayer, remove CEditor::IsSpecialLayer
- Use `pCurrentLayer` instead of `pEditor->GetSelectedLayer(0)` everywhere.
- Remove unnecessary null-checks of `pCurrentLayer`.
- Use `CLayer::IsEntitiesLayer` instead of `CEditor::IsSpecialLayer` and remove the latter function.
- Restructure UI layout code and variables.
2023-01-22 11:58:37 +01:00
Robert Müller c7819841f8 Remove dead code, update documentation for LAYERTYPE_GAME
This layer type was never used when saving maps.
Game layers were always identified by their flags.
In any case the check in the popup handler is unnecessary, as the group property cannot be changed for game layers, so this code is never used.
2023-01-22 11:58:37 +01:00
Robert Müller 50ecfb178f Add CLayer::IsEntitiesLayer to reduce duplicate code 2023-01-22 11:58:30 +01:00
bors[bot] cd13871053
Merge #6215
6215: Don't count (connecting) players for voting 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: def <dennis@felsin9.de>
2023-01-21 12:41:02 +00:00
Dennis Felsing f3867d677f Version 16.7.2 2023-01-18 23:20:15 +01:00
Robert Müller 0948a1dc4c Fix layout of kick/spec vote list items
The tee and label were overlapping due to a regression from #6240.
2023-01-16 15:37:58 +01:00
bors[bot] 4c639a5965
Merge #6286
6286: Add tooltip to demo seekbar showing the currently hovered time r=Chairn a=Robyt3

When hovering the demo seekbar, show a tooltip with the time at the hovered position.

![screenshot](https://user-images.githubusercontent.com/23437060/212565749-a38951a3-1f08-43a6-b607-02f379b28c52.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
- [ ] 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-01-15 21:07:54 +00:00
Robert Müller d662c7e9fd Add tooltip to demo seekbar showing the currently hovered time
When hovering the demo seekbar, show a tooltip with the time at the hovered position.
2023-01-15 21:31:45 +01:00
Robert Müller 315e52fb99 Refactor demo seekbar width calculation 2023-01-15 21:31:21 +01:00
Robert Müller a127890e2d Clear editor file browser search term when entering folder
Closes #5620.
2023-01-15 20:46:10 +01:00
Robert Müller aa23873af8 Add a refresh button to the editor file browser 2023-01-13 22:54:29 +01:00
Robert Müller 6b873cab1a Use sizeof for array sizes that should equal other array sizes 2023-01-13 22:07:21 +01:00
Robert Müller d1712f30e6 Support longer file/folder names in editor 2023-01-13 22:07:20 +01:00
Jupeyy c820ac22d3 Merge most entity textures again 2023-01-13 15:25:38 +01:00
Dennis Felsing 007bba9313 Version 16.7.1 2023-01-13 10:48:36 +01:00
Dennis Felsing c7e54d2462 Version 16.7 2023-01-10 23:47:53 +01:00
Robert Müller bbd20cde2b Add ui_smooth_scroll_time variable to adjust smooth scrolling
This variable adjusts the time for smooth scrolling of all scrollregions and listboxes in the menus and editor.

The value `0` disables smooth scrolling entirely.
2023-01-10 18:19:06 +01:00
bors[bot] 1347101a32
Merge #6249
6249: Fix DoLabelStreamed by using offsets, instead of rebuilding when x,y changes r=Robyt3 a=Jupeyy

<!-- 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: Jupeyy <jupjopjap@gmail.com>
2023-01-08 14:43:13 +00:00
Robert Müller 8845a15f14 Allow navigating listboxes when no item is currently selected
It was no longer possible to navigate listboxes (e.g. the server browser) by using keyboard hotkeys when no item is currently selected due to a regression from #6240.

Additionally, it was not possible even before #6240 to start navigating the server browser with the keyboard afer manually clearing the server address input, which is now possible as well.
2023-01-08 14:48:30 +01:00
bors[bot] bda61e586e
Merge #6251
6251: Always assume there could potentially be a skin in serverbrowser's pl… r=def- a=Jupeyy

…ayer list

<!-- 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: Jupeyy <jupjopjap@gmail.com>
2023-01-08 13:09:11 +00:00
Jupeyy ed1af6edb9 Always assume there could potentially be a skin in serverbrowser's player list 2023-01-08 13:42:18 +01:00
Robert Müller a0d4a55023 Fix server browser selection not being updated based an address input
The selected server browser entry was not being updated anymore when the server address input is changed manually by the user or when selecting an entry in the LAN server list and then switching back to the Internet list.

Regression from #6240.
2023-01-08 11:06:57 +01:00
Jupeyy 7815be7b75 Fix DoLabelStreamed by using offsets, instead of rebuilding when x,y changes 2023-01-07 11:51:48 +01:00
Jupeyy 1182180e23 Add skin to serverbrowser player list 2023-01-07 09:20:25 +01:00
bors[bot] 73ce7598fa
Merge #6240
6240: Port `CListBox` from upstream, smooth scrolling for all lists r=def- a=Robyt3

Replace existing listbox implementations (`CMenus::UiDoListbox*` and `HandleListInputs` functions) with `CListBox` from upstream.

Reimplement additional feature that was already present in ddnet: page up/down, home and end key handling.

Affects the following lists:

- server browser
  - see screenshots for scoreboard
- server browser scoreboard
  - before:
![server-browser-scoreboard old](https://user-images.githubusercontent.com/23437060/211005067-3a08f874-bcb5-40e1-84e8-3f3e8e3133c9.png)
  - after:
![server-browser-scoreboard new](https://user-images.githubusercontent.com/23437060/211005074-5d113fd3-e541-45e6-95d1-4d7f633b4d12.png)
- server browser friends
  - before:
![server-browser-friends old](https://user-images.githubusercontent.com/23437060/211005039-13ef4bda-5be4-4be4-8561-19cde9f487aa.png)
  - after:
![server-browser-friends new](https://user-images.githubusercontent.com/23437060/211005048-d9f74d13-e93d-4a35-b848-bee0c84ea047.png)
- country / region selection popup (server browser filter)
  - before:
![country-popup old](https://user-images.githubusercontent.com/23437060/211004344-04651e63-7931-4e82-8f6b-c0afa6f0ed33.png)
  - after:
![country-popup new](https://user-images.githubusercontent.com/23437060/211004353-866f081b-2444-4184-8194-9468c15460f0.png)
- player skin list
  - before:
![player-skins old](https://user-images.githubusercontent.com/23437060/211004903-88864d5d-17d8-4b23-836a-1ae24a9f36ac.png)
  - after:
![player-skins new](https://user-images.githubusercontent.com/23437060/211004909-a096b98e-e754-4e76-94ff-571a7462ba81.png)
- player country / region list
  - before:
![player-country old](https://user-images.githubusercontent.com/23437060/211004564-fbd7320b-95b5-4d0a-9629-9e511ff70f34.png)
  - after:
![player-country new](https://user-images.githubusercontent.com/23437060/211004571-4f3e1aed-b878-4b84-aa81-fe8edbee6ebd.png)
- theme list
  - before:
![themes new](https://user-images.githubusercontent.com/23437060/211005196-0692fcd1-770f-45a3-9290-2ac1af75e097.png)
  - after:
![themes old](https://user-images.githubusercontent.com/23437060/211005187-48a4436f-df54-43de-a15e-bf4920d99c85.png)
- assets list
  - before:
![assets old](https://user-images.githubusercontent.com/23437060/211004237-41b71b0d-c030-4ea6-9c6b-7be4aae0836b.png)
  - after:
![assets new](https://user-images.githubusercontent.com/23437060/211004251-9be08d8d-4b16-487f-82cc-a40c7e17bc48.png)
- graphics resolutions list
  - before:
![resolutions-dropdown old](https://user-images.githubusercontent.com/23437060/211004941-23105a96-815e-4ee9-b39a-de24dcd9e4e3.png)
  - after:
![resolutions-dropdown new](https://user-images.githubusercontent.com/23437060/211004947-e251ff3e-ece6-4c59-b62c-39ca277461b5.png)
- dropdown menus (e.g. graphics fullscreen mode)
  - see screenshots for graphics resolutions list
- ingame player list
  - before:
![players old](https://user-images.githubusercontent.com/23437060/211004612-f79e892c-2712-4904-9f5e-8ee7909c4a56.png)
  - after:
![players new](https://user-images.githubusercontent.com/23437060/211004632-b6b73c8e-3c14-4d72-8178-a1562bf968f9.png)
  - before (low number): 
![players-few old](https://user-images.githubusercontent.com/23437060/211004760-cd82b93f-b978-484b-a893-a9af2b881848.png)
  - after (low number):
![players-few new](https://user-images.githubusercontent.com/23437060/211004768-b844a98d-19d7-4519-883d-939ca9b4ef89.png)
- vote options list
  - before:
![vote-options old](https://user-images.githubusercontent.com/23437060/211005215-e9db81f2-24f2-48cd-9293-99a957fa372b.png)
  - after:
![vote-options new](https://user-images.githubusercontent.com/23437060/211005229-e9285a12-efb3-4236-9317-377ae0daf834.png)
- kick/specvote lists
  - before:
![kick-spec-vote old](https://user-images.githubusercontent.com/23437060/211004518-d6ed6869-6dda-46a4-a83f-b370c58a5727.png)
  - after:
![kick-spec-vote new](https://user-images.githubusercontent.com/23437060/211004527-5844caf8-6983-49e6-b309-c717a26de0c9.png)
- ghost list
  - before:
![ghosts old](https://user-images.githubusercontent.com/23437060/211004481-7be7d338-77fe-499d-9fba-3721e2d00215.png)
  - after:
![ghosts new](https://user-images.githubusercontent.com/23437060/211004490-d875eaf7-9fb0-4a29-9bbd-0226c7997434.png)
- language list (in settings and in popup on first launch)
  - settings:
    - before: 
![languages-setting old](https://user-images.githubusercontent.com/23437060/211007012-85d16464-6bd6-4444-bd32-57385afeb2c6.png)
    - after:
![languages-setting new](https://user-images.githubusercontent.com/23437060/211007018-faafdb88-9a0c-4e80-9955-0871c7cc4107.png)
  - popup:
    - before:
![languages-popup old](https://user-images.githubusercontent.com/23437060/211006181-2faa36be-3a4c-467b-91c2-2b0b9ea8eed2.png)
    - after:
![languages-popup new](https://user-images.githubusercontent.com/23437060/211006210-f91234f0-9d70-44a2-902d-0c049c63b2ba.png)
- demo browser
  - before:
![demos old](https://user-images.githubusercontent.com/23437060/211004399-c0f49652-cd0d-478c-8b2b-328512d6367b.png)
  - after:
![demos new](https://user-images.githubusercontent.com/23437060/211004406-ee1d2637-4d69-4aec-ba0b-26750bb5bf44.png)
- editor file browser (saving, loading, adding images / sounds)
  - before:
![editor old](https://user-images.githubusercontent.com/23437060/211004451-1d989358-f811-42ba-834f-0344e5e3f280.png)
  - after:
![editor new](https://user-images.githubusercontent.com/23437060/211004459-12c7abc7-4cc5-4610-b7e0-dfc546754c24.png)
  - The search / filename input is also improved so navigating a filtered list works correctly by porting the logic from upstream.

There are minor changes to the visual appearance of some lists, due to changed margins.

The vertical alignment of some list item texts is improved so the text is centered vertically.

Closes #5791.

## 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-01-06 23:40:55 +00:00
bors[bot] 45557c69e3
Merge #6247
6247: Remove projectiles on team change r=def- a=Zwelf

## 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
- [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: Zwelf <zwelf@strct.cc>
2023-01-06 23:18:08 +00:00
bors[bot] f79412c59c
Merge #6244 #6245 #6246
6244: Minor base refactoring 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)


6245: Add ingame and browser buttons to copy server info to clipboard r=def- a=Robyt3

Add "Copy info" buttons to server browser and ingame menu to copy the server info of the selected/current server to the clipboard.

The margins around the server browser details are improved.

Closes #5440.

Screenshots:
- browser (old):
![browser old](https://user-images.githubusercontent.com/23437060/211093742-b877f1e2-6be0-4827-b1c8-0fd209f697aa.png)
- browser (new):
![browser new](https://user-images.githubusercontent.com/23437060/211093750-f0b3e2c2-8f95-42e1-94bf-ec8b9da4132f.png)
- ingame: 
![ingame](https://user-images.githubusercontent.com/23437060/211093736-04569b8e-96d6-40ab-a37e-8c581f2d8aea.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
- [ ] 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)


6246: Remove dead freeze code r=def- a=Zwelf

Remove unused `m_FreezeTime == -1` state

Reduces code complexity. Both `g_Config.m_SvFreezeDelay`[[1]] and `GetSwitchDelay(int Index)`[[2]] can only return non-negative numbers, therefore this is currently dead code and can be removed.

The last time it was possible to pass a negative number was removed in 561ce64666 (diff-29ffe32916052e1066eed938021aadfeb29f855d7c63d9c1ca3350aceffb79f3L1624)

[1]: c8ea372d98/src/engine/shared/config_variables.h (L213)
[2]: c8ea372d98/src/game/mapitems.h (L467)

## 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>
Co-authored-by: Zwelf <zwelf@strct.cc>
2023-01-06 22:56:49 +00:00
Zwelf 0ef312d739 Remove unused m_HookState assignments 2023-01-06 23:11:19 +01:00
Zwelf e4157a744b Remove unused m_FreezeTime == -1 state
Reduces code complexity. Both `g_Config.m_SvFreezeDelay`[[1]] and `GetSwitchDelay(int Index)`[[2]] can only return non-negative numbers, therefore this is currently dead code and can be removed.

The last time it was possible to pass a negative number was removed in 561ce64666 (diff-29ffe32916052e1066eed938021aadfeb29f855d7c63d9c1ca3350aceffb79f3L1624)

[1]: c8ea372d98/src/engine/shared/config_variables.h (L213)
[2]: c8ea372d98/src/game/mapitems.h (L467)
2023-01-06 23:09:01 +01:00
Robert Müller fc7c376738 Add ingame and browser buttons to copy server info to clipboard
Add "Copy info" buttons to server browser and ingame menu to copy the server info of the selected/current server to the clipboard.

The margins around the server browser details are improved.

Closes #5440.
2023-01-06 21:23:33 +01:00
Robert Müller 91a23f00cb Port CListBox from upstream, smooth scrolling for all lists
Replace existing listbox implementations (`CMenus::UiDoListbox*` and `HandleListInputs` functions) with `CListBox` from upstream.

Reimplement additional feature that was already present in ddnet: page up/down, home and end key handling.

Affects the following lists:

- server browser
- server browser scoreboard
- server browser friends
- country / region selection popup (server browser filter)
- player skin list
- player country / region list
- theme list
- assets list
- graphics resolutions list
- dropdown menus (e.g. graphics fullscreen mode)
- ingame player list
- vote options list
- kick/specvote lists
- ghost list
- language list (in settings and in popup on first launch)
- demo browser
- editor file browser (saving, loading, adding images / sounds)
  - The search / filename input is also improved so navigating a filtered list works correctly by porting the logic from upstream.

There are minor changes to the visual appearance of some lists, due to changed margins.

The vertical alignment of some list item texts is improved so the text is centered vertically.
2023-01-06 12:46:16 +01:00
Robert Müller f79daac222 Add page up/down, home, end hotkeys to UI 2023-01-06 00:52:46 +01:00
Zwelf 877ab41dd7 Remove projectiles on team change 2023-01-04 21:08:47 +01:00
bors[bot] c7192d703e
Merge #6226 #6230
6226: Remove projectiles on save and load r=def- a=Zwelf

Restructured CSaveTeam a bit, because I also needed access to CGameWorld. I don't store pointer to IGameController in CSaveTeam anymore, because we pass CSaveTeam to the database thread. If it would be accessed there, it could cause a race conditions.

## 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
- [x] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


6230: For integrated and discrete GPUs always prefer what comes first in the list r=def- a=Jupeyy

fixes #6200

## 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: Zwelf <zwelf@strct.cc>
Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2023-01-04 18:03:11 +00:00
bors[bot] f3fca968f1
Merge #6158
6158: Add F-DDrace gametype color r=def- a=fokkonaut

Been using this color already since a while. I'd like to keep it.

![image](https://user-images.githubusercontent.com/35420825/208289135-e8f5ba01-f487-47f2-929c-f1029ddfbab5.png)
![image](https://user-images.githubusercontent.com/35420825/208289140-2b807ef3-4b0f-4917-9485-c47977d95aa2.png)


## 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: fokkonaut <35420825+fokkonaut@users.noreply.github.com>
2023-01-04 10:26:06 +00:00
Robert Müller 21636912c0 Refactor team state unpacking 2023-01-03 23:55:26 +01:00
Zwelf 73b5d885fa Remove projectiles on save and load
Restructured CSaveTeam a bit, because I also needed access to CGameWorld. I don't store pointer to IGameController in CSaveTeam anymore, because we pass CSaveTeam to the database thread. If it would be accessed there, it could cause a race conditions.
2023-01-03 23:38:58 +01:00
Robert Müller dfe0ec3385 Restart client race demo when round is restarted 2023-01-03 23:38:37 +01:00
Robert Müller dd4e2d615b Send updated teams state to clients after resetting round 2023-01-03 22:40:03 +01:00
bors[bot] 6d3af742dd
Merge #6180
6180: Implement exact matches in search and exclude strings r=Robyt3 a=def-

Thanks to bencie for discussion

<!-- 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-01-03 18:16:03 +00:00
bors[bot] b36726bbca
Merge #6156
6156: Swap times should be per player, not per team (fixes #6155) r=Learath2 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: def <dennis@felsin9.de>
2023-01-03 15:59:25 +00:00
Robert Müller 706eb0d015 Remove unnecessary include in protocol, move definitions to cpp file
The include of `base/system.h` in `src/engine/shared/protocol.h` is not required and only used transitively in `teamscore.h` for `dbg_assert`.

To avoid adding back the include in `teamscore.h`, the function definitions are moved to the cpp file. Both definitions are moved for consistency.
2023-01-03 14:10:58 +01:00
bors[bot] 5282c8e2e5
Merge #6216
6216: Follow-up fix to scoreboard showing wrong best time r=Zwelf a=def-

Forgot the call in constructor in https://github.com/ddnet/ddnet/pull/6213/

Thus best time was not displayed initially. Thanks to spur for report

<!-- 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: def <dennis@felsin9.de>
2023-01-02 13:24:07 +00:00
bors[bot] b252f2e344
Merge #6199
6199: Register protocol and file extensions on client launch on Windows r=def- a=Robyt3

When launching the client on Windows, associate the protocol `ddnet` and the file extensions `.map` and `.demo` with the client executable.

See #6072.

## 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-01-02 12:58:15 +00:00
def 2a48533aa5 Follow-up fix to scoreboard showing wrong best time
Forgot the call in constructor in https://github.com/ddnet/ddnet/pull/6213/

Thus best time was not displayed initially. Thanks to spur for report
2023-01-02 12:29:11 +01:00
def 39b34bf40c Don't count (connecting) players for voting 2023-01-02 11:25:13 +01:00
def 25e371fa8a Don't load best time when already in progress 2023-01-01 12:18:29 +01:00
def 8452d8d028 Don't duplicate type in same line 2022-12-31 13:04:21 +01:00
def 694b9cd67d Fix scoreboard showing wrong best time
by requesting the best time again when it initially failed. This is
still not perfectly accurate since a player on another server can get a
better time, which will not get updated when the current server had no
database problems.

As reported by thekid36 on Discord:

> The best time shown on the scoreboard on the turkish server on a
> ddmax.Next map (mapname: 42) is 30min..while the best time should be 4
> min (it's correct on ger2 server)

So the way it works is that the best time is loaded from database when
loading map. Additionally it gets updated when a new finish is done. If
the initial load failed, but a finish with 30 min is done on the server,
we get this result
2022-12-31 12:36:03 +01:00
Zwelf e3147ce53d Simplify ninja code
Reasoning this change is correct:

* `OldPos` is set to `m_Pos` in line 260
* `m_Pos` is not modified in between line 260 and 272 (only `m_Core.m_Pos` gets modified)
* Therefore line 269 `Dir = m_Pos - OldPos` is always `vec2(0.0, 0.0)`.
* And line 271 `Center = OldPos + Dir * 0.5 = OldPos`.

So we can pass `OldPos` to `FindEntities` in line 272. Using `OldPos` here instead of `m_Pos` makes it clear, that we use the position before the move, even though `m_Pos` also still holds the old value.
2022-12-30 18:23:26 +01:00
Robert Müller a61eec8f1e Add DDNet settings button to unregister protocol and file extensions
Add a button to the Miscellaneous DDNet settings to manually unregister the protocol and file extension handlers.
2022-12-29 18:03:08 +01:00
Zwelf fb9e430f78 Log more errors in sql code
Log whether deleting ranks from _backup tables fails due to locking issues in sqlite.
2022-12-26 12:27:29 +01:00
Zwelf bc194a577d Fix teamranks not getting removed or moved out of _backup table 2022-12-26 11:57:03 +01:00
Zwelf f5dc372d79 Add more debug info to teamrace to figure out how duplicate ranks occur 2022-12-26 01:52:43 +01:00
Robert Müller 92567ced7b Fix issues when closing multiple editor popups at the same time
When using `UiClosePopupMenus` in a popup handler, the number of popups was first set to `0` and then decremented to `-1` due to the popup itself being closed, which causes the next popup to not open correctly and may also cause a crash due to an out-of-bounds access.

The `UiClosePopupMenus` function is adjusted so the number of open popups never goes below `0`.

Another check is added to ensure that `UI()->SetActiveItem(nullptr)` is only called when a popup is open, so the currently active item is not reset if no popup is open.

Duplicate code in `UiDoPopupMenu` is reduced by calling the `UiClosePopupMenus` function to only close the top-most popup.

This also fixes the same issue when a popup is closed by the popup handler and the escape key in the same frame, by only handling the escape key for closing the top-most popup when the popup was not already closed by the handler.

Lastly, the explicit escape key handling is removed from the event popup, as this also caused the above issue and is not necessary, as the escape key is already handled implicitly for all popups.
2022-12-24 11:57:06 +01:00
Dennis Felsing 68625dd370 Implement exact matches in search and exclude strings
Thanks to bencie for discussion
2022-12-23 23:25:11 +01:00
bors[bot] 50d0ecfda8
Merge #6177
6177: Deactivate editor hotkeys while dialog or editbox is active, fix other minor issues 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>
2022-12-23 09:22:15 +00:00
Robert Müller 4439cbd7a1 Persist AFK state of players on map change
Store AFK state of players in `CPersistentClientData` and restore it when a client is connected.

In order for this to work, `m_LastPlaytime` must be adjusted as well to ensure that the AFK state is not reset again automatically by the `AfkTimer` function.

The AFK state is encapsulated using `IsAfk` and `GetAfk`.

Closes #1966.
2022-12-23 00:13:10 +01:00
Robert Müller 6723910d38 Fix players always being considered AFK with sv_max_afk_time 0
The value `0` should disable the AFK feature, but players are initially considered as AFK, so their AFK state was never updated correctly.
2022-12-23 00:03:12 +01:00