Commit graph

8983 commits

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