Commit graph

4378 commits

Author SHA1 Message Date
Robert Müller b33ce0f37d Change friend info text to Map | Mode | Country/Ping 2023-05-18 23:06:29 +02:00
Robert Müller a2cbc7fb24 Render tees for online friends in friends list
Closes #6614.
2023-05-18 22:03:43 +02:00
Robert Müller 15f839960a Port friends list UI from 0.7
Separate friends list into three groups, which can be expanded and collapsed: online players, online clanmates and offline friends.

Friends with the same name/clan are no longer grouped together. Instead, each individual player that is online and has name/clan matching a friend is shown in either the online players or online clanmates group. Friends for which no matching players are found are shown in the offline group.

Friends in the friend list can no longer be selected. Instead, left-clicking a friend selects the server that the friend is on. Double-clicking a friend joins the server that they are playing on.

Render small X button in top-right corner of every friend list entry to remove the respective friend instead of using one button that removes the selected friend.

Change "Add Friend" button to "Add Clan" when only clan is entered.

Remove excess empty space from layout.

Closes #6326.
2023-05-18 16:46:26 +02:00
bors[bot] 373595dec8
Merge #6608
6608: Support rendering tooltips with multiple lines of text, support overlapping tooltip activation rects, add alpha fade-in for tooltips  r=edg-l 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-05-18 11:24:25 +00:00
Robert Müller 47fca7683d Add alpha fade-in for tooltips
After 0.75 seconds of hovering the tooltip rect without rendering the tooltip, start fading in the tooltip for the remaining 0.25 seconds.
2023-05-18 13:22:52 +02:00
Robert Müller 13ed0e386a Use const when possible 2023-05-18 12:21:34 +02:00
Robert Müller fe359e2909 Combine Margin function calls
Both calls put a margin around the same rect but the intermediate result is never used, so both margins can be combined.

The variable `Screen` is also not necessary.
2023-05-18 12:20:53 +02:00
Robert Müller f60dd0d3c2 Fix name of static variable s_LastLoadRender 2023-05-18 12:19:10 +02:00
Robert Müller af67130dbd Use nullptr for unused UI rect splitting parameters 2023-05-18 12:18:22 +02:00
Robert Müller 05f2b19391 Remove unused SLabelProperties Props variable 2023-05-18 12:17:15 +02:00
Robert Müller 31304c4573 Support overlapping tooltip activation rects
When the activation rects for two tooltips overlap, this always causes the first tooltip to be rendered.

This is changed so the last active tooltip is rendered instead, to simplify the usage of the tooltip function.
2023-05-18 12:12:44 +02:00
Robert Müller ed09bba45a Support rendering tooltips with multiple lines of text
Render tooltip text correctly with multiple lines when the maximum tooltip width is limited.

Add missing padding when rendering multi-line tooltip.

Update doxygen documentation.
2023-05-18 12:12:26 +02:00
bors[bot] a38dea4454
Merge #6590
6590: Make text containers bit safer r=Robyt3 a=Jupeyy

From reading the code I couldn't understand how https://github.com/ddnet/ddnet/issues/5143#issuecomment-1546735484 could happen

either (checked = not the case):
 - [x] teini used an outdated client
 - [ ] i am blind
 - [ ] it was a name/clan -plate, scoreboard entry
 - [ ] it leaked somewhere in text.cpp or similar impl
 - [ ] it happened because of an outside write.

We don't really come further with this, so we should probably at least try it out?
`@Robyt3` your opinion? We can still always remove it again

## 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-05-14 19:16:16 +00:00
bors[bot] cca6d867cb
Merge #6588 #6589
6588: Add default argument to `CDataFileReader/IMap::GetItem` r=def- a=Robyt3

Add default value `nullptr` for `int *pType` and `int *pID` output parameters of `GetItem` functions.

Use `nullptr` instead of `0`.

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


6589: Fix heap-use-after-free when quitting/restarting r=def- a=Robyt3

Items and particles were also rendered in the client states quitting and restarting, which was causing accesses to the already freed map data.

Closes #6387 until further notice.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-05-14 18:58:08 +00:00
Jupeyy 370d37b8fd Add shared ptr to track usage 2023-05-14 20:21:59 +02:00
Robert Müller f3e8513477 Fix heap-use-after-free when quitting/restarting
Items and particles were also rendered in the client states quitting and restarting, which was causing accesses to the already freed map data.
2023-05-14 18:12:47 +02:00
Robert Müller d08626cf69 Add default argument to CDataFileReader/IMap::GetItem
Add default value `nullptr` for `int *pType` and `int *pID` output parameters of `GetItem` functions.

Use `nullptr` instead of `0`.
2023-05-14 16:39:46 +02:00
bors[bot] 03d17a98ed
Merge #6585
6585: Add client_score_kind field to serverinfo (followup) r=Robyt3 a=edg-l

followup on #5960 (fixes conflicts)

It specifies whether the scores are to be interpreted as times (string value starting with "time") or as points (string value starting with "points").

## 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: heinrich5991 <heinrich5991@gmail.com>
Co-authored-by: Edgar Luque <git@edgarluque.com>
2023-05-14 12:17:55 +00:00
bors[bot] ada7c4d597
Merge #6497
6497: Fix client crash/hang when launching without data directory r=edg-l a=Robyt3

Closes #4638.

## 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: Robert Müller <robytemueller@gmail.com>
2023-05-14 09:43:06 +00:00
Edgar 1ca7870bf2
fix conflicts 2023-05-14 11:22:06 +02:00
bors[bot] e9d08a15fd
Merge #6560
6560: Replace EntityEx with new netobjs r=edg-l a=trml

This is a proposal for replacing EntityEx with new netobjects, like suggested in #5860.
- Adds a new DDNetPickup that includes switch number
- a new DDNetProjectile that replaces the old one (which is renamed to DDRaceProjectile)
  - includes switch number, tunezone and velocity/speed (plus a flag that can be used to send velocitiy of player projectiles with full precision)
- switch number and subtype is added to DDNetLaser (to distinguish e.g. draggers with different strength)

The pr removes EntityEx from the server, but keeps compatibility in the client.

<!-- 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: trml <trml@users.noreply.github.com>
2023-05-14 08:43:02 +00:00
Edgar 1e319fa279
fix opacity for jumps 2023-05-11 23:04:05 +02:00
Edgar 0db2f6243f
fix nameplate related indicators opacity 2023-05-11 22:23:48 +02:00
Robert Müller d9307ca756 Use FileExists/fs_is_file instead of opening file
This is more concise and works more reliable e.g. on Windows.

See: https://devblogs.microsoft.com/oldnewthing/20071023-00/?p=24713
2023-05-10 21:04:02 +02:00
bors[bot] 7fff049471
Merge #6575
6575: Replace usages of `atan2f` and `atan2` with `std::atan2` r=def- a=Robyt3

Another 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-05-09 22:26:22 +00:00
Robert Müller 58184c2d67 Replace usages of atan2f and atan2 with std::atan2
Another leftover from #6372.
2023-05-09 22:38:44 +02:00
Jupeyy 0b1960c532 Fix Y Alignment by respecting cursor height independent of character height 2023-05-08 17:49:05 +02:00
Robert Müller 98a8507184 Fix division by zero when using random theme with no themes 2023-05-08 14:04:22 +02:00
bors[bot] 1112c9e6b7
Merge #6566
6566: Allow using rescue (/r) on health pickup r=heinrich5991 a=Robyt3

Check if character is in range of health pickup and don't set rescue position if that's the case, so rescue can be used to get out of the health pickup's freeze effect.

The existing `m_Core.m_IsInFreeze` is not set so this should not have any side-effects.

Closes #3330.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [X] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-05-08 11:31:39 +00:00
Robert Müller b590eff24e Add missing HUD text container deletion
See #5143.
2023-05-07 15:37:08 +02:00
Robert Müller 72c2ed062b Remove magic number 20.0f from pickup handling 2023-05-07 11:02:50 +02:00
Robert Müller 73091cdd83 Add CPickup::Type and CPickup::Subtype getters 2023-05-07 11:02:50 +02:00
Robert Müller 2596dac47a Remove dead code 2023-05-07 11:02:50 +02:00
Robert Müller ce4228e08a Simplify by calculating broadcast render offset in OnRender
And ensure that the render offset is recalculated after the window is resized.
2023-05-06 15:57:44 +02:00
Robert Müller bd20423de2 Wrap long broadcast text instead of stopping
Instead of stopping when a broadcast line exceeds the screen width, wrap the text to the next line. Otherwise one long line in a broadcast can end the rendering so following lines are skipped.
2023-05-06 15:56:34 +02:00
Robert Müller 5c78093da4 Fade out broadcast in last second, use text container
Fade the broadcast alpha to zero in the last second that the broadcast is shown.

Use text container to support the fade out and to make broadcast rendering more efficient.
2023-05-06 15:55:42 +02:00
Robert Müller 74c1f38ca0 Use str_next_token to reduce duplicate code
Instead of manually splitting a string at newline characters.
2023-05-06 15:54:33 +02:00
Robert Müller 00ed9d0ecd Fix horizontal centering of broadcast
The screen also needs to be mapped when calculating the width of the broadcast text, otherwise the width is not correct and so the text is not correctly centered horizontally.

The wrong text width was also being calculated when the text has multiple lines. Now `TextWidth` is used so the width is also correct for multi-line text.
2023-05-06 15:54:33 +02:00
Robert Müller 8617411bfa Render broadcast only when online or in demo playback 2023-05-06 15:54:32 +02:00
Robert Müller c2d0835743 Extract CBroadcast::RenderServerBroadcast function 2023-05-06 15:54:32 +02:00
Robert Müller 7afa11e92c Extract CBroadcast::OnBroadcastMessage function 2023-05-06 15:54:28 +02:00
Robert Müller 6d2e2788e2 Use DefaultTextColor and DefaultTextOutlineColor 2023-05-06 15:22:58 +02:00
Robert Müller 4b2ec2c202 Remove dead code 2023-05-06 15:22:58 +02:00
bors[bot] e16e271f17
Merge #6562
6562: Fix server password input not being activated automatically, always move cursor to end when selecting all text r=Jupeyy 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-05-05 15:10:59 +00:00
Robert Müller b4a7038fad Fix server password input not being activated automatically 2023-05-05 16:20:55 +02:00
Robert Müller 1be1c9780c Always move cursor to end when selecting all text 2023-05-05 16:20:54 +02:00
Robert Müller a443d99ccf Remove unused CMenus::setPopup function 2023-05-05 16:08:43 +02:00
Robert Müller 0c32eacbab Make text container index type-safe
Use `STextContainerIndex` wrapper instead of `int` for text container index for type-safety.

Add missing checks to ensure valid text container index before rendering FPS and finish time text containers.
2023-05-05 15:58:17 +02:00
trml e10f528215 Add net netobjs for projectile and pickup, extend ddnetlaser, remove EntityEx server-side 2023-05-04 23:43:05 +02:00
Jupeyy 54e013fa1a Fix alpha fading in hud 2023-05-01 12:33:47 +02:00