Commit graph

12721 commits

Author SHA1 Message Date
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
ChillerDragon fd437e0f76 Apache RequestHeader needs the headers module 2023-04-01 16:35:09 +02:00
Dennis Felsing 5fa2fefd35 Remove unused DoFilter
Thanks to cheeser0613
2023-04-01 13:39:20 +02:00
bors[bot] 02086e4023
Merge #6268
6268: Quit when configured bindaddr cannot be resolved, quit client when failing to open network client for 25 times  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-31 15:44:26 +00: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
bors[bot] a9674afb02
Merge #6451 #6466
6451: Fix `console_enable_colors` not being used, save `console_output_level` and `console_enable_colors` variables r=def- a=Robyt3

Closes #6447.

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


6466: Fix rcon login when disconnecting dummy and when username used r=def- a=Robyt3

When connecting a dummy and then logging into rcon only the dummy is logged in. When disconnecting the dummy, the main client was not automatically logged in. When logging in with the main client and then connecting the dummy, the dummy was already authenticated automatically. Now the main client is also authenticated automatically when disconnecting an authenticated dummy.

This automatic authentication was also not working correctly if the login used a username, as only the password was stored. Now both username and password are stored to correctly authenticate the main or dummy client.

The stored username and password are completely cleared when disconnecting, so they are not stored in memory longer than necessary.

Closes #5586.

## 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-26 12:59:00 +00:00
bors[bot] 0cf6f15590
Merge #6461
6461: Check if HTTP request task is aborted in completion callback r=def- a=Robyt3

It's possible for the HTTP request task to be aborted after the curl request has finished, so the returned `State` will be `HTTP_DONE` but `m_Abort` is `true`. The `State` never changes to `HTTP_ABORTED`, because the progress callback is not called after the HTTP request has completed.

This causes the client to crash when a skin download is aborted after the HTTP request finished but before the completion callback is called.

This is fixed by checking if `m_Abort` is `true` and setting the `State` to `HTTP_ABORTED` at the beginning of the completion callback.

Closes #3567.

## 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-26 12:40:47 +00:00
Robert Müller 7bc17b2bd8 Fix rcon login when disconnecting dummy and when username used
When connecting a dummy and then logging into rcon only the dummy is logged in. When disconnecting the dummy, the main client was not automatically logged in. When logging in with the main client and then connecting the dummy, the dummy was already authenticated automatically. Now the main client is also authenticated automatically when disconnecting an authenticated dummy.

This automatic authentication was also not working correctly if the login used a username, as only the password was stored. Now both username and password are stored to correctly authenticate the main or dummy client.

The stored username and password are completely cleared when disconnecting, so they are not stored in memory longer than necessary.

Closes #5586.
2023-03-26 14:00:50 +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
Robert Müller fd98ed0295 Add IStorage::RemoveFolder
Wrapper for `fs_removedir`.
2023-03-25 16:58:51 +01:00
bors[bot] f2df34847b
Merge #6460
6460: Replace usage of `fmodf` with `std::fmod` r=heinrich5991 a=Robyt3

Leftover from #6372.

## 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-25 15:24:59 +00: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
Robert Müller aa0ad18f1b Refactor net_set_blocking and net_set_non_blocking
Reduce duplicate code by using loop and by merging implementation of `net_set_blocking` and `net_set_non_blocking`.
2023-03-25 15:36:50 +01:00
Ravie 705be7c6e3 Implement random skin button 2023-03-25 13:11:47 +01:00
Robert Müller ddb21ec49e Check if HTTP request task is aborted in completion callback
It's possible for the HTTP request task to be aborted after the curl request has finished, so the returned `State` will be `HTTP_DONE` but `m_Abort` is `true`. The `State` never changes to `HTTP_ABORTED`, because the progress callback is not called after the HTTP request has completed.

This causes the client to crash when a skin download is aborted after the HTTP request finished but before the completion callback is called.

This is fixed by checking if `m_Abort` is `true` and setting the `State` to `HTTP_ABORTED` at the beginning of the completion callback.

Closes #3567.
2023-03-25 12:43:19 +01:00
Robert Müller 3c3a8021d2 Replace usage of fmodf with std::fmod
Leftover from #6372.
2023-03-25 10:28:26 +01:00
bors[bot] 6808b62b74
Merge #6457
6457: Fix and improve twping tool 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-24 08:02:47 +00:00
Robert Müller f4ee220395 Show twping timeout if no ping response is received, add exit code
Return exit code `0` if ping successful. Return `1` if timeout. Return `-1` if incorrect argument.
2023-03-23 23:26:07 +01:00
Robert Müller 71976256d8 Refactor twping variables 2023-03-23 23:11:30 +01:00
Robert Müller fae9ed1b5e Add missing initialization to twping
The tool doesn't work without initializing secure random and network.
2023-03-23 23:07:47 +01:00
Robert Müller 7c7d3b7732 Use logger instead of <cstdio> in twping 2023-03-23 23:06:49 +01:00
Robert Müller 156a1e9d14 Quit client when failing to open network client for 25 times
Prevent endless loop when client fails to open network client forever, by quitting the client after 25 failed attempts.

As described in #5555, although it doesn't fix the actual issue.
2023-03-23 21:36:04 +01:00
Robert Müller 85f5e9c5f9 Quit when configured bindaddr cannot be resolved
Quit client and server if the configured bindaddr cannot be resolved.

Disable econ if configured bindaddr cannot be resolved.

To ensure that the configured bindaddr is not silently ignored.
2023-03-23 21:34:07 +01:00
Robert Müller 2c518f2778 Remove redundant return value and rename method
Rename `LoadData` to `LoadDebugFont` so it's clearer what the method does.

The return value that is always `1` and not checked in some cases is removed.
2023-03-23 21:07:22 +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
Dennis Felsing 5252667204 Round by millisecond, not centisecond (fixes #6453)
Some servers seem to allow times with millisecond precision, official
DDNet doesn't, so never noticed this issue.
2023-03-23 09:47:48 +01:00
Robert Müller 9f3c59000e Save console_output_level and console_enable_colors variables 2023-03-22 22:16:53 +01:00
Robert Müller 6760532491 Fix console_enable_colors not being used 2023-03-22 22:11:47 +01:00
bors[bot] 8057d591db
Merge #6449
6449: Select language on first start based on user locale r=heinrich5991 a=Robyt3

Closes #2459.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [X] Tested in combination with possibly related configuration options
- [X] Written a unit test (especially base/) or added coverage to integration test
- [X] Considered possible null pointers and out of bounds array indexing
- [X] Changed no physics that affect existing maps
- [ ] 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-21 20:52:04 +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 413227a5c1 Add os_locale_str to get user locale
This function determines the preferred user locale setting.
2023-03-21 21:17:40 +01:00
Robert Müller 8d4f851493 Fix console chain of inp_controller_guid
The console chain was broken due to `joystick_guid` being renamed to `inp_controller_guid`, so the active controller was not being updated when the GUID is changed via the console.
2023-03-20 22:20:09 +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 baa448580a Use str_format_v for log_log_impl
Reduces duplicate code. This also ensures that the log messages are properly zero-terminated and that they do not end with truncated unicode characters.
2023-03-19 12:50:28 +01: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
Robert Müller d0fe1087db Add str_format_v with va_list argument
So the string formatting can be reused in other places. Passing variadic arguments directly to another function is not possible.

The function must have a different name, as overloading `str_format` would cause the wrong function to be called when passing the `va_list`. The same naming with suffix `_v` is used for the logging functions.
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
marmare314 1ccd357f53 check for success when decoding audio 2023-03-17 10:39:17 +01:00
marmare314 115cd4c4a3 fix bug when loading invalid opus file 2023-03-17 09:12:15 +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
Robert Müller 1b1fc8de3e Save screenshot in separate thread to avoid lags
Encoding the image as PNG and saving it to a file comprises the majority of the time when taking a screenshot.

To avoid the client freezing while a screenshot is being saved, this task is moved to a separate background thread.
2023-03-11 13:19:57 +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
bors[bot] f5970645e8
Merge #6406
6406: Fix deprecation warning in ffmpeg 6 (fixes #6398) 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-10 19:59:05 +00:00
Robert Müller 3996ee01a7 Close process handle on Windows after process is killed
Prevent leak of process handle. Keep the handle open if the process could not be killed, so killing can be attempted again.
2023-03-10 18:02:39 +01: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
Dennis Felsing 3428968702 Fix deprecation warning in ffmpeg 6 (fixes #6398) 2023-03-10 14:38:37 +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
Robert Müller f7d7592cb7 Add CTextCursor::Height() to calculate actual height of cursor 2023-03-09 23:04:18 +01:00
Robert Müller a0f1b4118d Use round_to_int in text render
For positive numbers, which the text positions always are, the result of `(int)(x + 0.5f)` is identical to `round_to_int(x)`.
2023-03-09 23:04:18 +01:00
Robert Müller 92615617b2 Use mem_copy instead of memcpy for websockets
Replace all remaining usages of `memcpy`.
2023-03-09 13:16:49 +01:00
Panagiotis "Ivory" Vasilopoulos 776eabcc78 Replace leftover memcpy with mem_copy
This change was made as I was doing some tests for the Haiku port.
2023-03-09 11:50:15 +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
ChillerDragon 97ac4e791e Flush NETMSG_PING and NETMSG_PING_REPLY
The client measures the time difference between
ping send and ping reply receive.
Without MSGFLAG_FLUSH the server keeps the chunk
until the next flush which makes the ping dependend
on when the next flush happens.
2023-03-05 17:29:14 +01: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
bors[bot] a14f32cf47
Merge #6369
6369: Fix Move also requesting the current canvas size, which should report… r=Robyt3 a=Jupeyy

… a resize event

fixes #6368

For some reason KDE seems to set the current window'd size of the window (even if i use fullscreen)  for the window when its minimized. And ::Move re-requests the canvas size.

This resulted in the incorrect viewport.

Funnily enough for me under KDE this also means that the check for GotResized, to only notify the components when the canvas actually resized is now useless.

`@Robyt3` can you check if Windows is not doing this behavior? Else the previous patch is useless for the crash bug :D
On the other hand, this *could* have been part of the text container bug, tho I cannot imagine yet why

## 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-03-05 11:53:12 +00: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
ChillerDragon 20853793ee Fix server logfile error message 2023-03-02 09:44:27 +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
Jupeyy c7362ba6c4 Fix Move and SetWindowScreen also requesting the current canvas size, which should report a resize event 2023-02-26 13:56:37 +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
Dennis Felsing fa3675d328 Improve warning text in backend_sdl 2023-02-25 10:40:36 +01:00
Robert Müller aace33fc3c Support 4 and 8 digit RGBA color values in console
In addition to values in `$RGB` and `$RRGGBB` format, also support the `$RGBA` and `$RRGGBBAA` formats for color variables.
2023-02-24 20:32:44 +01:00
Robert Müller cd15b93517 Remove unnecessary temporary variables 2023-02-24 18:11:16 +01:00
Robert Müller f5221caf50 Mark ColorRGBA/ColorHSLA functions as const 2023-02-24 18:10:32 +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
bors[bot] ebe605ab2e
Merge #6355
6355: Mark absolute #includes as absolute r=def- a=heinrich5991

Also verify that absolute imports are done using `#include <>` in CI.

## 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: heinrich5991 <heinrich5991@gmail.com>
2023-02-23 15:26:02 +00:00
heinrich5991 1a2c82c0b1 Mark absolute #includes as absolute 2023-02-23 10:53:16 +01:00