Commit graph

15504 commits

Author SHA1 Message Date
Dennis Felsing 7df1b24491
Merge pull request #8833 from furo321/vote-creator
Set `m_VoteCreator` when possible
2024-08-27 21:20:41 +00:00
dobrykafe 31ee6abe82 implement 0.7 skin save button 2024-08-27 23:18:43 +02:00
Dennis Felsing 3d6820ab68
Merge pull request #8831 from furo321/fix-crash-hotreload
Fix `double free or corruption` crash with `hot_reload`
2024-08-27 21:16:58 +00:00
Dennis Felsing 8b7e5dee4d
Merge pull request #8830 from dobrykafe/pr-conchain-07-tee
Add console chain for 0.7 tee
2024-08-27 21:16:37 +00:00
Dennis Felsing 76c44cfb40
Merge pull request #8829 from furo321/use-getmapname
Use `GetMapName()` when getting the map name
2024-08-27 21:16:12 +00:00
furo f407adc61c Set m_VoteCreator when using force_vote 2024-08-27 21:44:00 +02:00
furo 9fbbf5cde7 Fix using random_unfinished_map from rcon 2024-08-27 21:43:22 +02:00
furo 9a7bc70f76 Fix double free or corruption crash with hot_reload 2024-08-27 20:44:55 +02:00
furo 0e016f9732 Use GetMapName() when getting the map name 2024-08-27 20:41:43 +02:00
dobrykafe cb57aa82bf add console chain for 0.7 tee 2024-08-27 20:01:27 +02:00
Robert Müller 14f1b36dd1
Merge pull request #8825 from KebsCS/pr-ghost-sorting
Add ghost list sorting
2024-08-27 16:55:22 +00:00
KebsCS 906f75c13a
Add ghost list sorting 2024-08-27 18:34:26 +02:00
bencie c4ff37d9d9 Send result of random_unfinished_map to all clients 2024-08-27 16:37:15 +02:00
furo 358cd20183 Run editor auto-reload on any local address, and not just localhost 2024-08-27 13:05:52 +02:00
Dennis Felsing 9d920b3575
Merge pull request #8703 from sjrc6/pr_slider
Adjust slider handle size
2024-08-27 09:20:18 +00:00
Tater 5fb059ad92 Adjust slider handle size 2024-08-27 11:02:12 +02:00
Dennis Felsing 4b8dcc3315
Merge pull request #8811 from furo321/add-map-votes-directories
Add support for directories with `add_map_votes`
2024-08-27 08:59:25 +00:00
Dennis Felsing b30b493ab8
Merge pull request #8819 from Anime-pdf/master
speedup demo with mouse scroll only if menu is active
2024-08-27 07:15:38 +00:00
Dennis Felsing 29f3323735
Merge pull request #8813 from furo321/hot-reload-maps
Add `hot_reload` to reload map while preserving state
2024-08-27 07:03:05 +00:00
Paul 7c62b457b7 speedup demo with mouse scroll only if menu is active 2024-08-27 02:38:08 +03:00
furo 8b27a6e852 Add hot_reload to reload map while preserving state 2024-08-27 01:19:40 +02:00
Robert Müller 028bd148f3
Merge pull request #8806 from bencie/allow-reloading
Allow reloading current background entities map
2024-08-26 15:04:59 +00:00
Dennis Felsing 6e3b0910e1
Merge pull request #8800 from def-/pr-winarm
Add arm64 windows support
2024-08-26 12:08:22 +00:00
Dennis Felsing 9fd4adfb21
Merge pull request #8812 from dobrykafe/pr-popup-password
Show server info in password popup
2024-08-26 06:20:15 +00:00
dobrykafe d44c68a8a5 show server info in password popup 2024-08-26 01:32:47 +02:00
furo 8f6d5d453e Add support for directories with add_map_votes 2024-08-25 23:29:34 +02:00
Dennis Felsing 7ee1dac08b
Merge pull request #8809 from furo321/append-settings
Transfer server settings while using append
2024-08-25 21:13:50 +00:00
Dennis Felsing 2fc3f81725
Merge pull request #8808 from furo321/collapse-all-button-editor
Add button to collapse/expand all groups in editor
2024-08-25 21:13:27 +00:00
Dennis Felsing 8e16113428
Merge pull request #8807 from furo321/no-input-while-opening
Don't allow input in console while it is opening/closing
2024-08-25 20:59:00 +00:00
furo 7628783e95 Transfer server settings while using append 2024-08-25 20:20:13 +02:00
furo 59dd8735bf Add button to collapse/expand all groups in editor 2024-08-25 19:41:10 +02:00
furo 0b27a47553 Don't allow input in console while it is opening/closing 2024-08-25 19:09:09 +02:00
bencie d8e82bbb1d Allow reloading current background entities map 2024-08-25 18:23:25 +02:00
Robert Müller 77790f677e
Merge pull request #8803 from furo321/file-picker-entities
Add a popup for picking a map for background entities setting
2024-08-25 10:00:46 +00:00
Schrodinger ZHU Yifan 83c3b4ea89 Add arm64 windows support 2024-08-25 00:02:43 +02:00
furo 6c0e42987e Add a popup for picking a map for background entities setting 2024-08-24 22:32:13 +02:00
Dennis Felsing be2e49e1f6
Merge pull request #8801 from Robyt3/Client-Touch-Input-Emote-Spectate
Add touch support to emoticon selector and spectator menu, minor refactoring
2024-08-24 15:05:18 +00:00
Robert Müller ed9720f1be Minor refactoring of emoticon selector rendering
- Extract variable `ScreenCenter`.
- Rename variables `i` to `Emote`.
- Move variable declarations closer to their usages.
2024-08-24 13:23:23 +02:00
Robert Müller 3bda76ff1f Add touch support to emoticon selector and spectator menu
Support using emoticon selector and spectator menu with touch inputs. Touching in the emoticon selector activates the selected (eye) emote and closes the emoticon selector. The spectator menu is kept open when using it for more convenience. The emoticon selector and spectator menu can be closed by touching anywhere outside of them.

Additionally, the emoticon selector and specator menu can now be closed by pressing the Escape key (i.e. the back button on Android). This made it necessary to change the order of the components for input handling, so the ingame menu will handle the Escape key after the emoticon selector and spectator menu. This also means that the Escape key can now be used to close the selector/menu when they are stuck open, which was previously delayed until ingame menu or console were opened and closed.
2024-08-24 13:21:58 +02:00
Robert Müller 93675799e8 Fix inconsistent margin in ingame menu, minor refactoring
The additional margin left of the Spectate and Join game buttons is unnecessary.

Avoid reusing `s_SpectateButton` variable for different buttons.

Use `TEAM_RED` instead of `0` when joining game in non-team server.
2024-08-24 12:21:23 +02:00
Dennis Felsing 5dff5e9e81
Merge pull request #8795 from furo321/cjsonwriter-master
Use `CJsonWriter` for creating server info JSON
2024-08-23 18:25:44 +00:00
furo f897af8dbb Use CJsonWriter for creating server info JSON 2024-08-23 20:07:11 +02:00
Dennis Felsing 96beaf2eca
Merge pull request #8793 from furo321/proof-borders-desc
Improve "Proof borders" description
2024-08-23 17:52:11 +00:00
furo b9a794121a Don't keep m_DDRaceState and m_StartTime of teammate in team0mode after death 2024-08-23 18:40:15 +02:00
furo a01e5e7151 Improve "Proof borders" description 2024-08-23 17:06:59 +02:00
ChillerDragon 56b56ef2b9 Fix save code not being censored in streamer mode
Closed #8790
2024-08-23 19:20:15 +08:00
Robert Müller 4d09332b83 Add CUIRect::TopLeft and Size convenience functions 2024-08-22 21:52:27 +02:00
ChillerDragon 804a91ced0 Fix sounds being doubled in 0.6
Closed #8785
2024-08-22 19:41:14 +08:00
Dennis Felsing 5210d77f92
Merge pull request #8781 from def-/pr-fix
Disallow save with draggers
2024-08-22 09:38:46 +00:00
Dennis Felsing f796309cc8 Fix save/swap with draggers 2024-08-22 00:47:06 +02:00
Robert Müller 499ad48ee6 Revert "Quit if Android back-button is pressed 3 times within 1 second"
This reverts commit 91848f0be6.

This was prone to accidental usage. The user interface is now usable with touch input, so this additional method to quickly and cleanly quit the game is not necessary anymore.
2024-08-21 19:30:59 +02:00
Robert Müller 992f235f05 Use HSLA scrollbar color picker for 0.7 tee settings
Use the same HSLA scrollbar color picker for the 0.7 tee settings as for the 0.6 tee settings. Use the correct darkest lighting value for 0.7 skin color pickers instead of not clamping the lighting value in the color picker.
2024-08-21 18:05:51 +02:00
Robert Müller ce0e52851c Refactor CSkins7::GetColor function
Use existing color constructor to conditionally unpack the alpha component instead of doing this separately.

Make `DARKEST_COLOR_LGT` a `float` constant instead of using an `enum` to simplify the usage.
2024-08-21 17:57:56 +02:00
Robert Müller abf8fac568 Refactor HSLA scrollbar color picker rendering
Rename `CMenus::RenderHSLScrollbars` function to `RenderHslaScrollbars`.

Pass darkest light value as `float` to the `RenderHslaScrollbars` function to add support for different values, instead of enabling the clamping with a `bool` parameter. Previously, this parameter was always set to `true`, as this type of color picker is only used for skins.

Remove unnecessarily complicated code for rendering unclamped lighting scrollbar. The code can be simplified by considering the darkest lighting value as a variable.

Let the `RenderHslaScrollbars` function return `true` if the color was changed to simplify the usage. The function previously returned the color but this value was unused.

Use `IGraphics::SetColor4` function instead of `IGraphics::SetColorVertex` when possible. Rename variables `Array` to `aColorVertices`. Use `std::size` instead of hard-coding array sizes.
2024-08-21 17:57:56 +02:00
Robert Müller 01d2b3e3bc Highlight hovered and active color picker scrollbar handle
Add visual feedback to color picker scrollbar handle being hovered and active.
2024-08-21 17:57:56 +02:00
Dennis Felsing db9b5f5b61
Merge pull request #8782 from ChillerDragon/pr_fix_sixup_sounds
Fix sixup sounds
2024-08-21 15:07:33 +00:00
ChillerDragon dcd1fefa7e Never send sounds to sixup that are played on the client side
Closed #2523
2024-08-21 22:02:39 +08:00
ChillerDragon 00b9eab2ce Rename CHAT_SIX/SEVEN to more generic FLAG_SIX/SEVEN 2024-08-21 21:33:34 +08:00
ChillerDragon 99ae72c143 Fix editor properties not being clamped on + and - button click
Closed #8778
2024-08-21 19:48:10 +08:00
Robert Müller 839c511af4 Make macOS semaphore names more unique, improve assertion
On macOS, semaphore names are global and processes can open semaphores of other processes by using their name. It was possible that multiple client/server processes randomly tried to create semaphores with the same memory address, which would cause them to have the same name. In that case, `sem_open` would fail because `O_EXCL` prevents creating semaphores if the name is already used.

This is made more unlikely by also including the PID in the semaphore name. Additionally, the semaphore name is prefixed with `/` to more closely follow the construction rules for semaphore names. In particular, the behavior is implementation-defined if the name is not prefixed with a slash.

See https://pubs.opengroup.org/onlinepubs/9799919799/functions/sem_open.html

Closes #8773.

More details are added to the assertion error message in case this does not end up fixing the issue.
2024-08-20 20:25:56 +02:00
heinrich5991 87aa251d73 Don't show "you've been banned" for VPN bans
Players are supposed to turn of their VPN or complain to the admins if
they get banned for using a VPN. Calling this "banned" seems to be
confusing, as players ask for an unban even after they turned off the
VPN.
2024-08-20 16:51:37 +02:00
Robert Müller 30f49201e5
Merge pull request #8764 from ChillerDragon/pr_cfgcol_07_marking
Use color type for 0.7 marking configs
2024-08-20 05:53:33 +00:00
ChillerDragon ef2db30bef Make 0.7 skin color variables unsigned to get rid of the casts 2024-08-20 11:49:04 +08:00
ChillerDragon 15713d7859 Use color type for 0.7 marking configs 2024-08-20 11:23:26 +08:00
Robert Müller 40fbc2140b Use std::string for IInput::GetClipboardText
Simplify clipboard handling by returning an `std::string` and freeing the string returned by SDL immediately, so the clipboard data does not stay in memory unnecessarily after the clipboard has been used until the clipboard data is requested again.

Fix possible TOCTOU when pasting from the clipboard into a lineinput, due to the clipboard data being requested twice.
2024-08-19 19:03:49 +02:00
Dennis Felsing 89cc2d46a8
Merge pull request #8766 from Matodor/pr_inputs_missing_zoom_scale
Fixed missing TargetX/TargetY zoom scale apply in CControls::SnapInput
2024-08-19 06:55:54 +00:00
ChillerDragon 66e3f619c7 Add delete hotkey for 0.7 skins 2024-08-19 12:00:55 +08:00
Dennis Felsing 474dae5ead check 2024-08-18 23:55:08 +02:00
Matodor ddd13ba4fc fix: fixed missing TargetX/TargetY zoom scale apply in CControls::SnapInput 2024-08-19 00:52:36 +05:00
Dennis Felsing 8dd2b6e9e6
Merge pull request #8765 from Robyt3/Client-Menus7-Interactive-Tee-Fixes
Improve interactive tee in 0.7 tee settings
2024-08-18 10:33:27 +00:00
Robert Müller b9ab23405e
Merge pull request #8759 from Bamcane/client-sixup-fix
Fix client sixup translation context
2024-08-18 10:33:07 +00:00
Bamcane 5c2ab4cb92 Fix client sixup translation context
Co-authored-by: Robyt3 <robytemueller@gmail.com>
2024-08-18 18:14:27 +08:00
Robert Müller 2eff7ecb61 Improve interactive tee in 0.7 tee settings
- Fix value `0` being used for sound volume, so the tee sound was not audible.
- Use `DoButtonLogic` to trigger sound to ensure it does not play while other UI elements are active.
- Remove unnecessay `MousePosition` variable by using `MousePos` function instead.
2024-08-18 12:08:20 +02:00
Dennis Felsing ddfd4dbfb1
Merge pull request #8763 from ChillerDragon/pr_remove_ddnet_hotui
Remove ddnet_hotui hook
2024-08-18 07:22:22 +00:00
Dennis Felsing 21807c15bd
Merge pull request #8744 from ChillerDragon/pr_color_speed
Color speed in hud based on increase or decrease
2024-08-18 07:19:11 +00:00
ChillerDragon 789fee99df Remove ddnet_hotui hook 2024-08-18 15:02:33 +08:00
Dennis Felsing f569981eb5
Merge pull request #8755 from ChillerDragon/pr_delete_07_skins
Implement 0.7 delete skin button
2024-08-18 06:44:10 +00:00
Dennis Felsing 1758bfc7f9
Merge pull request #8730 from ChillerDragon/pr_07_separate_dummy_skins
Support different skin states for dummy and main in 0.7 connections
2024-08-18 06:42:24 +00:00
Dennis Felsing e008f40a19
Merge pull request #8761 from ChillerDragon/pr_race7_nullptr
Fix race 0.7 check null pointer dereference
2024-08-18 06:36:45 +00:00
Dennis Felsing b05ffeae3b
Merge pull request #8762 from ChillerDragon/pr_fix_dummy7_marking_alpha
Fix 0.7 dummy marking alpha being reset
2024-08-18 06:34:56 +00:00
Dennis Felsing 9fe2203a24
Merge pull request #8754 from ChillerDragon/pr_fix_06_demo_cutting
Fix cutting 0.6 demos
2024-08-18 06:29:33 +00:00
ChillerDragon 99fe6b09ed Fix 0.7 dummy marking alpha being reset
Closed #8757
2024-08-18 11:06:40 +08:00
ChillerDragon fa1ee98f1e Fix race 0.7 check null pointer dereference
Found by @fokkonaut in https://github.com/ddnet/ddnet/pull/8707

Co-authored-by: fokkonaut <35420825+fokkonaut@users.noreply.github.com>
2024-08-18 10:57:56 +08:00
ChillerDragon 64c7ab677d Color speed in hud based on increase or decrease 2024-08-18 10:32:00 +08:00
ChillerDragon 8d7c99fb96 Implement 0.7 delete skin button
See #8750
2024-08-18 10:17:13 +08:00
ChillerDragon e8fbb440b9 Fix cutting 0.6 demos
Closed #8748
2024-08-18 10:05:58 +08:00
Dennis Felsing b16bc401a8
Merge pull request #8716 from ChillerDragon/pr_hide_url_for_06
Hide address url for 0.6 ips (Closed #8712)
2024-08-17 17:42:30 +00:00
ChillerDragon 933a43bd0f Make render m_Sixup an array for dummy 2024-08-16 22:32:03 +08:00
ChillerDragon 7cffdf40b6 Make gameclient m_Sixup an array for dummy 2024-08-16 22:30:58 +08:00
heinrich5991 f057898ce0
Merge pull request #8745 from ChillerDragon/pr_07_hook_coll
Fix hook coll on vanilla 0.7 servers
2024-08-16 12:56:24 +00:00
ChillerDragon fac02650f1 Fix hook coll on vanilla 0.7 servers
Thanks to @fokkonaut for this F-Client commit

8ecd8c7f0a

Closed #8742
2024-08-16 19:12:42 +08:00
heinrich5991 aaf69542b6
Merge pull request #8739 from ChillerDragon/pr_log_error_crc
Use error log level for snap crc errors
2024-08-16 08:21:30 +00:00
Dennis Felsing 8d024be37c
Merge pull request #8738 from ChillerDragon/pr_increase_max_tmp_cmd_len
Increase max temp cmp length
2024-08-16 07:50:40 +00:00
Chiller Dragon 87aa664899
Lower the cmd length to 64
Co-authored-by: Dennis Felsing <dennis@felsing.org>
2024-08-16 15:32:53 +08:00
Dennis Felsing 6a4a70fddd
Merge pull request #8736 from ChillerDragon/pr_fix_06_chat_skins
Fix old 0.7 skins overwriting 0.6 skins in chat
2024-08-16 06:49:48 +00:00
Dennis Felsing de206b27d1
Merge pull request #8737 from ChillerDragon/pr_rm_setdtile
Remove unused function declaration SetDTile
2024-08-16 06:49:34 +00:00
ChillerDragon 1f0467b545 Use error log level for snap crc errors
A snapshot crc error should not happen.
If it does happen it will cause lags and it means something is really wrong.
2024-08-16 13:34:38 +08:00
ChillerDragon 04c141828f Increase max temp cmp length
Fixes long rcon commands being cut off on custom servers.
2024-08-16 13:01:35 +08:00
ChillerDragon a77895711b Remove unused function declaration SetDTile 2024-08-16 12:48:01 +08:00
ChillerDragon 81de29565d Fix old 0.7 skins overwriting 0.6 skins in chat
Closed #8731
2024-08-16 12:37:05 +08:00
Robert Müller 595f537625 Fix asset images not being freed if they fail ratio/format check 2024-08-15 21:44:07 +02:00
heinrich5991 438e04f785 Complain on higher log level that 0.7 support was disabled
Not sure why it was on debug level before.
2024-08-15 14:47:40 +02:00
heinrich5991 6754b5ff45
Merge pull request #8728 from Robyt3/Tools-Demo-Extract-Chat-Time
Print chat/broadcast times in `demo_extract_chat` tool
2024-08-14 17:49:47 +00:00
Robert Müller b4bd13c3aa
Merge pull request #8721 from Rei-Tw/improve-bans
Improve bans rcon command pagination
2024-08-14 17:29:31 +00:00
Robert Müller 17f13b9f97 Print chat/broadcast times in demo_extract_chat tool
This makes it easier to find the times of specific chat messages and broadcasts in demos.
2024-08-14 19:23:18 +02:00
Rei-Tw 035b4a1447 Make bans command better
Update src/engine/shared/netban.cpp

Remove the word "currently" for the empty ban list message.

Co-authored-by: Dennis Felsing <dennis@felsing.org>

Update src/engine/shared/netban.cpp

Text format refactor, adding "currently"

Co-authored-by: Dennis Felsing <dennis@felsing.org>
2024-08-14 15:29:42 +02:00
Jupeyy e3622f3532
Fix debug hud units 2024-08-14 14:11:04 +02:00
ChillerDragon 7fa2306138 Hide address url for 0.6 ips (Closed #8712) 2024-08-14 18:25:10 +08:00
heinrich5991 a48f502618
Merge pull request #8723 from Bamcane/map-sound
Add support for server play map sound
2024-08-14 09:27:12 +00:00
Bamcane 12057d9f6d Add map sound
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2024-08-14 16:48:22 +08:00
heinrich5991 1a0f28c5bd
Merge pull request #8568 from def-/pr-whispers
Add option to disable whispers
2024-08-14 08:21:57 +00:00
heinrich5991 e4bc5bde5d
Merge pull request #8682 from Robyt3/Client-RaceHelper-Refactoring
Refactor `CRaceHelper`, mark `CCollision` functions as `const` and add tile getters
2024-08-14 08:09:05 +00:00
heinrich5991 7de9242cb5
Merge pull request #8624 from Robyt3/Client-Nameplates-Refactoring
Refactor nameplate rendering, slightly improve performance
2024-08-14 08:08:03 +00:00
Dennis Felsing f14ae6bf13
Merge pull request #8725 from ChillerDragon/pr_fix_06_register
Fix 0.6 master server register (closed #8722)
2024-08-14 07:04:38 +00:00
ChillerDragon c16a38b4fa Fix 0.6 master server register (closed #8722) 2024-08-14 12:11:04 +08:00
Robert Müller 19105e224b Make CRaceHelper a member of CGameClient
Avoid static functions and global static variables for flag indices.

Avoid passing pointer to `CGameClient` separately to `IsStart` function.
2024-08-13 21:56:58 +02:00
Robert Müller 5ac3bb506c Mark CCollision functions const, add const tile getters
Mark remaining `CCollision` functions as `const` when possible.

Add remaining getter functions for all tile data and mark all tile getter functions as `const`.
2024-08-13 21:52:25 +02:00
Robert Müller 6dba8851a5 Refactor CRaceHelper::IsStart function
Avoid duplicate calculation by extraction result of `GetPureMapIndex` in variable.

Rename variable `Indices` to `Index`.

Include `vector` instead of `list`, as the former is used but the latter is not.
2024-08-13 21:50:25 +02:00
Dennis Felsing 171d5523de Add option to disable whispers
Since it's easy to abuse and impossible to moderate
2024-08-13 13:37:13 +02:00
Jupeyy b998937e91
Remove "Player Options"
See screenshots
2024-08-13 13:02:32 +02:00
heinrich5991 4cbdf2069c
Merge pull request #8577 from gerdoe-jr/scoreboard-spectator-clans
Scoreboard spectator clans
2024-08-13 10:19:14 +00:00
gerdoe-jr ae364942c8 Add spectator clans rendering in scoreboard
Show client ID before spectator clan
2024-08-13 12:00:57 +02:00
heinrich5991 4f09d3f7d4
Merge pull request #8701 from Robyt3/Client-Spectate-ClientIds
Improve `cl_show_ids`: support spectator menu, optimize, refactor
2024-08-13 09:50:12 +00:00
heinrich5991 585a36dd9d Distinguish birthday from finish events
This allows us to give birthdays a different effect in the future if we
want to.
2024-08-13 11:02:25 +02:00
heinrich5991 c0ec918721 Remove comments that just describe the next line 2024-08-13 11:01:06 +02:00
Dennis Felsing ef6fd80bc5
Merge pull request #8715 from furo321/birthday-confetti
Spawn a confetti when connecting on your DDNet birthday
2024-08-13 08:22:59 +00:00
Dennis Felsing a8219530b1
Merge pull request #8714 from def-/pr-spec-auth
server: Disallow moving authed players to spec
2024-08-12 21:39:53 +00:00
furo 1563b4a56a Spawn a confetti when connecting on your DDNet birthday 2024-08-12 23:14:07 +02:00
Robert Müller 594968fe07 Improve cl_show_ids: support spectator menu, optimize, refactor
Also show client IDs in the spectator menu when `cl_show_ids` is enabled. Previously, this setting applied to scoreboard and chat, although the setting and config variable descriptions were only mentioning the scoreboard.

Extract client ID formatting in `CGameClient::FormatClientId` function to reduce duplicate code and ensure it is consistent.

Correctly indent client IDs also when largest client ID is 100 or larger. Fix scoreboard spectator client ID buffer not being large enough for IDs 100 and larger.

Make client ID formatting more efficient by avoiding `str_format` except for formatting the number itself and appending text directly to the text cursor when possible.
2024-08-12 22:59:32 +02:00
Dennis Felsing 608fba82e0 server: Disallow moving authed players to spec 2024-08-12 19:33:50 +02:00
Dennis Felsing 043480b06e server: Handle dnsbl and other non-critical stuff only on new ticks
Less risk of causing microlags then, I think once per second is often enough since it has to iterate through all players
2024-08-12 18:49:17 +02:00
Dennis Felsing 96881defdf Show game menu buttons again, even in 5:4 2024-08-12 14:35:49 +02:00
Dennis Felsing bd92dbddf2
Merge pull request #8706 from Robyt3/Client-Skins7-Loading-Refactoring
Various refactoring of 0.7 skin loading
2024-08-11 22:12:35 +00:00
Dennis Felsing 960d2853bc
Merge pull request #8708 from ChillerDragon/pr_07_modern_is_ddnet_msg
Send the new is ddnet message in 0.7 connections
2024-08-11 22:12:00 +00:00
Robert Müller 570c2c857a Fix UDP socket creation/cleanup if opening IPv6 socket fails
Previously, the `net_udp_create` function returned whether the IPv6 socket in particular was created successfully. If an IPv4 socket or Websocket was created successfully before this, it was not used and also not closed properly, if the IPv6 socket could not be created.

Now, the `net_udp_create` function succeeds if the socket for at least one network type (IPv4, IPv6 or Websocket) could be created successfully.

Avoid reusing local variables and remove redundant comments. Also apply the same refactoring to `net_tcp_create`, which already has the behavior of succeeding if the socket for any network type (IPv4 or IPv6) was created successfully.
2024-08-11 17:09:09 +02:00
ChillerDragon 21507b51f1 Send the new is ddnet message in 0.7 connections
We already sent the legacy is ddnet message and so far the ddnet
protocol over 0.7 seems to work fine.

But for completeness and correctness it is now also sending the new
ddnet version net message.
2024-08-11 09:25:18 +08:00
Robert Müller 38b60b1d51 Various refactoring of 0.7 skin loading
- Only log successful log messages when `debug` is enabled, consistent with logging for regular skins.
- Use `IsImageFormatRgba` to check for RGBA image format, so this also shows a warning popup.
- Remove redundant logic for non-RGBA image data.
- Use `CheckImageDivisibility` instead of enforcing exact size of xmas hat and bot decoration images to allow higher resolution images.
- Fix image data not being freed if it has the wrong format or ratio.
- Fix potential integer overflow when calculating skin part blood color (same as for regular skins).
- Extract `LoadXmasHat` and `LoadBotDecoration` functions for readability.
2024-08-10 17:55:11 +02:00
ChillerDragon e0bc98e79a Add alpha support for 0.7 skins 2024-08-10 14:50:43 +02:00
ChillerDragon 53b01862d4 Remove netversion from demo editor init 2024-08-10 14:50:43 +02:00
ChillerDragon 399075c339 Display 0.7 skins in chat 2024-08-10 14:50:43 +02:00
ChillerDragon 8903f49716 Render skins in 0.7 demos 2024-08-10 14:50:43 +02:00
ChillerDragon be67622544 Resend 0.7 skin change if it got filtered by the server 2024-08-10 14:50:43 +02:00
Alexander Akulich fe99a346dd Improve 0.7 skins
skins7: Extract the skins dir to a macro
skins7: Look for the skins at 'skins7' dir
Data: Add 0.7 skins (diliated)
CMenus::RenderSkinSelection7: Fix the skins number (use 0.7 getter)
CSkins7::GetColorV3: Fix missing UnclampLighting
CRenderTools: Use stronger type for 0.7 colors
CSkins7::RandomizeSkin: Use enum value instead of hardcode+comment
CMenus::RenderSettingsTee7: Enable team skins validation
system: Add str_utf8_copy_num()
GameClient: Extract ApplySkin7InfoFromGameMsg()
GameClient: Add skin7 to CClientData (also process and validate it)
2024-08-10 14:50:43 +02:00
ChillerDragon bae37ab7df Add 0.7 client support
While keeping 0.6 fully working and untouched
This adds the option to connect via 0.7

0.7 servers are now mixed into the server browser list.
And users can also manually connect via 0.7
using a connection url like so:

    ./DDNet "connect tw-0.7+udp://127.0.0.1:8303"

This also adds a "Tee 0.7" section in the menu to pick a 0.7 skin.
The config variables are prefixed with player7_ like for example
player7_color_body
2024-08-10 14:50:42 +02:00
Robert Müller 2fa4c1f603 Remove clang-tidy static variable name exceptions
- Remove `readability-identifier-naming.StaticVariableIgnoredRegexp`.
- Mark `static` variables as `const` and use `UPPER_CASE` for names when possible.
- Use local variables instead of `static` variables when possible.
- Use member variables with correct name instead of `static` variables.
- Pass output buffer for `static` function `GetKeyBindModifiersName` by argument instead of returning pointer to `static` buffer.
2024-08-10 13:27:55 +02:00
Robert Müller 323ccf5a22 Show warning when connect address cannot be resolved
Show warning and disconnect instead of falling back to connecting to `localhost` when the connect address cannot be resolved.
2024-08-09 20:22:00 +02:00
Dennis Felsing 00586a0c4a Revert "Faster /rank, fixes test result"
This reverts commit c2a3444f87.
2024-08-08 18:59:20 +02:00
Dennis Felsing e3dd2895dd Revert "Fix /rank"
This reverts commit 49bef9c453.
2024-08-08 18:59:20 +02:00
Robert Müller 645a00551b Fix binds not being repeated when key held down
Closes #8699. Regression from #8685.
2024-08-08 18:14:59 +02:00
Dennis Felsing 49bef9c453 Fix /rank
minTime being NULL means no rank
2024-08-08 17:13:47 +02:00
Dennis Felsing 647abbd801
Merge pull request #8693 from def-/pr-optimize-query
Faster /rank, fixes test result
2024-08-08 14:39:13 +00:00
Dennis Felsing 9be9a902e7
Merge pull request #8697 from heinrich5991/pr_ddnet_to_ipv4_mapped
Use `Ipv6::to_ipv4_mapped` in mastersrv
2024-08-07 22:19:45 +00:00
heinrich5991 83a90c9a06
Merge pull request #8676 from Robyt3/Client-LineInput-Event-Handling-Consistency
Consistently return `true` from `OnInput` function for used events
2024-08-07 22:07:49 +00:00
heinrich5991 d42ae75a9e Use Ipv6::to_ipv4_mapped in mastersrv
Needs Rust 1.63.0, should be old enough at this point.
2024-08-08 00:00:41 +02:00
Robert Müller 2c7c391ff0 Only activate double-clicks with left mouse button again
Double-clicks could also be activated with other mouse buttons on some UI elements, which was unintentionally added by #8489.
2024-08-07 20:59:45 +02:00
Dennis Felsing c2a3444f87 Faster /rank, fixes test result 2024-08-07 18:10:36 +02:00
heinrich5991 e97b8e1818
Merge pull request #8690 from def-/pr-dnsbl-info
More dnsbl printing
2024-08-06 16:53:17 +00:00
Dennis Felsing 922e32be0c More dnsbl printing 2024-08-06 17:21:24 +02:00
Dennis Felsing 082580f586 Don't show ban time for vpn bans 2024-08-05 20:27:16 +02:00
heinrich5991 75ec6ed304
Merge pull request #8652 from def-/pr-vpn-ban-1min
Only ban VPNs for a minute
2024-08-05 16:19:50 +00:00
-StormAx 52a6b4d69f Fix https://github.com/ddnet/ddnet/issues/8668 2024-08-05 06:22:16 +03:00
Robert Müller 3eb8122eea Support composite binds with + commands
Previously, binding `+` commands like `+hook` to composite keys like `shift+x` or `ctrl+alt+mouse1` was not possible, as it would lead to stuck inputs when one of the modifiers is released first before the primary key. When binding `+` commands to composite binds the modifier was instead ignored to prevent this.

Now, binding `+` commands to composite keys is also possible. Active binds (key, modifier) are stored and when a modifier key is released all binds using that modifier are also released.

Closes #8314.
2024-08-04 22:23:30 +02:00
Robert Müller dc1a483b53 Make handling of F1-F24 keys binds consistent with regular binds
The handling of F1-F24 keys in `CBindsSpecial` was not correct for composite binds, leading to stuck inputs if modifier keys are released first. Now, the `CBindsSpecial::OnInput` function simply delegates to `CBinds::OnInput` for F-key presses/releases so the behavior is consistent with regular binds.
2024-08-04 22:10:15 +02:00
Robert Müller 12e5f7f1d3 Various minor refactoring of CBinds
- Use `UnbindAll` function in destructor to reduce duplicate code.
- Use appropriate constants instead of magic number `0`.
- Remove redundant comments.
- Remove redundant `else if` condition.
- Rename generic loop variables `i` and `j` to `Modifier` and `Key` for clarity.
2024-08-04 22:09:52 +02:00
Robert Müller 9f6cb92cb9 Add assertions to CBinds::Bind and Get functions 2024-08-04 22:09:47 +02:00
Robert Müller 8fd40efe36 Fix key names for composite binds with multiple modifiers
This was only affecting the key names displayed in the voting HUD, e.g. with `bind "ctrl+alt+f3" "vote yes"` the voting HUD previously showed `+f3` as the key name.
2024-08-04 22:09:29 +02:00
Robert Müller d2222f55e7 Add CBindSlot as return value for GetBindSlot function 2024-08-04 22:05:50 +02:00
Robert Müller b28bac89d4 Move CBinds::GetKeyId function to IInput::FindKeyByName 2024-08-04 22:05:34 +02:00
Corantin H 79ff930aaa Fix invalid team count in scoreboard for split teams
Refactor state variables into `CScoreboardRenderState`
2024-08-04 17:20:56 +02:00
Robert Müller bdd7784bbb Consistently return true from OnInput function for used events
The `OnInput` function should return `true` exactly for events that were handled. In case of line inputs, the function returned `true` when then line input was changed instead. For the consoles, the function did not return `true` for some events that were handled.
2024-08-03 11:58:15 +02:00
Robert Müller 924f8f582b Remove unused TEXLOAD_NOMIPMAPS and TEXLOAD_NO_COMPRESSION
The flag `TEXLOAD_NO_COMPRESSION` is entirely unused.

The flag `TEXLOAD_NOMIPMAPS` is unused and only the respective `CCommandBuffer::TEXFLAG_NOMIPMAPS` is used internally, so the former flag does not need to be exposed to users of `IGraphics`.
2024-08-02 18:16:26 +02:00
Robert Müller 273f3e5bfa Remove unused return value of IGraphics::UnloadTexture function 2024-08-02 18:16:15 +02:00
Robert Müller da8ec6bed9 Remove unused LoadTextureRawSub and CMD_TEXTURE_UPDATE
The `IGraphics::LoadTextureRawSub` function and the respective `CMD_TEXTURE_UPDATE` command are unused. Only text textures are updated after having been uploaded, but there is a separate `CMD_TEXT_TEXTURE_UPDATE` for that.
2024-08-02 18:15:55 +02:00
Robert Müller 9110d393dd Remove unused IGraphics::NullTexture function
It should not be necessary to access the null-texture directly. The `CTextureHandle::IsNullTexture` function can be used to check if a texture handle is the null-texture.
2024-08-02 18:15:34 +02:00
Robert Müller 7930eb9b79 Use != instead of < to future-proof sv_team
Assume that this branch should apply to all team modes except `SV_TEAM_FORCED_SOLO` also when new team modes would get added after `SV_TEAM_FORCED_SOLO` in the future, as the values will never be changed and there is no relation between the order of the numeric values and the behavior.
2024-08-01 21:33:53 +02:00
Robert Müller f676a8b9ad Add error message when trying to /swap on forced solo server
Previously, swapping on forced solo servers was already impossible, as this would require two players to join the same team, so it would always fail with the error `Player is on a different team` (or earlier). The check `g_Config.m_SvTeam != 3` was never reached. Also, this check was not using the constant `SV_TEAM_FORCED_SOLO`. Now, an earlier check is added to show a more specific error message when trying to use `/swap` on a forced solo server.
2024-08-01 21:33:48 +02:00
DynamoFox a013372be4 Fix game launch on Wayland-only systems with SDL2.30+ 2024-08-01 16:36:44 +02:00
ChillerDragon ef1d5fa78c Fix first typo 2024-08-01 11:47:46 +08:00
Dennis Felsing 2c61177745
Merge pull request #8669 from Robyt3/Client-Damageind-Refactoring
Refactor and optimize damage indicators, reset damage indicators when skipping in demo
2024-07-31 21:48:00 +00:00
Robert Müller fd1cc863b4 Remove unused code for saving embedded RGB map images
Only embedded images in RGBA format are loaded anymore, so the additional code for converting RGB to RGBA image data is not necessary.
2024-07-31 22:13:08 +02:00
Robert Müller 12aa79d6f8 Avoid duplicate calculation of damage indicator life
Only calculate the passed time once to adjust damage indicators' remaining life instead calculating the time separately for each damage indicator.
2024-07-31 20:36:48 +02:00
Robert Müller 782c9a54bf Remove separate CreateI and DestroyI functions
Improve readability by removing the indirection when creating and removing damage indicators.
2024-07-31 20:36:48 +02:00
Robert Müller 90562b5157 Make CDamageInd::OnReset function more efficient
There is no need to copy the items if we only want to delete all of them.
2024-07-31 20:36:47 +02:00
Robert Müller 690590ca03 Remove unnecessary m_StartAlpha variable
The `m_Color` variable already stores the initial alpha value and should not be modified, so the separate `m_StartAlpha` variable is unnecessary.
2024-07-31 20:36:47 +02:00
Robert Müller df0a9811d9 Remove unused m_Lastupdate variable 2024-07-31 20:36:47 +02:00
Robert Müller f14f00da09 Reset damage indicators when skipping in demo
Prevent old damage indicators still persisting in demo player after skipping.
2024-07-31 20:36:47 +02:00
Robert Müller cd2a20f1f4 Use OnReset function to reset damage indicators
The additional indirection with the `CEffects::ResetDamageIndicator` and `CDamageInd::Reset` functions to reset damage indicators is confusing and unnecessary. Always reset the damage indicators when disconnecting (in `OnReset`) instead of when entering the next game.
2024-07-31 20:36:47 +02:00
Robert Müller 7f59a159e4 Refactor, rename IGraphics::IsImageFormatRGBA
Rename `IGraphics::IsImageFormatRGBA` function to `IsImageFormatRgba`.

Rename parameter `pFileName` to `pContextName`, as this name does not necessarily describe a file.

Remove unnecessary check for parameter `pFileName` (now `pContextName`) being unset, which is and should never be the case.

Rename parameter `Img` to `Image` for consistency.
2024-07-30 19:58:53 +02:00
Robert Müller 82bf71e780 Refactor IGraphics::CheckImageDivisibility
Put the context name in quotation marks in the warning message.

Rename parameter `pFileName` to `pContextName`, as this name does not necessarily describe a file.

Rename parameter `Img` to `Image` for consistency.
2024-07-30 19:58:53 +02:00
Robert Müller 92b0b90b29 Remove unused CClient::DirectInput function
The function is unused and because the message is not flushed it would also not have worked correctly. The `NETMSG_INPUT` message is already packed and flushed in the `CClient::SendInput` function.

Closes #8408.
2024-07-29 21:43:50 +02:00
Robert Müller 5bd0b06c52 Fix menu checker background on wide resolutions and optimize it
The maximum width and height were swapped as the loop bounds, so the menu checker background did not have the correct width on very wide resolutions.

This was not noticed on common resolutions because twice as many quads as necessary were also being rendered for each row of the background. The bounds of the inner loop are adjusted and only every second x-value is iterated, which reduced the total number of quads for the checker background rendering by more than half.
2024-07-28 20:49:09 +02:00
Robert Müller 23fb01f9dd Smoother menu checker background scrolling on loading screens
Update global time also while rendering loading screens and shift the menu checker background based on the global time so it's smoother while loading.
2024-07-28 20:38:51 +02:00
Dennis Felsing 1d92b5acd6
Merge pull request #8658 from Robyt3/Client-Image-Non-Rgba-Leak
Fix memory leak of non-RGBA image data, clear all image info
2024-07-27 22:12:42 +00:00
Dennis Felsing 6911944c57
Merge pull request #8659 from Robyt3/Client-Dummy-Connecting-Improvement
Improve dummy connecting button and error handling
2024-07-27 22:11:47 +00:00
Robert Müller b61005d3e7 Improve dummy connecting button and error handling
Track whether the dummy is currently connecting separately so the dummy being disconnected due to errors can be detected. Show an error message as echo in the chat when the dummy could not be connected, e.g. when the server is full.

Use the global time for limiting the dummy connecting delay instead of using game ticks, so the delay also works correctly when having connection problems (i.e., when ticks do not advance). Handle the dummy connecting being delayed separately from the dummy currently connecting.

Add tooltips for the "Connect dummy"-button when it's disable due to dummy not being allow on the server or when connecting is delayed.

Add console error messages for `dummy_connect` command.
2024-07-27 22:44:15 +02:00
Robert Müller fb832b482c Fix memory leak of non-RGBA image data, clear all image info
The image data was not being freed when `IGraphics::LoadTextureRawMove` is used with images that are not in RGBA format as this falls back to using `IGraphics::LoadTextureRaw` which requires manually freeing the image data.

Also consistently clear all image info in `LoadTextureRawMove`. This makes it necessary to store the size of the preview image in the editor separately, as previously the width and height of the unloaded image info were being used to render the preview image.
2024-07-27 21:24:32 +02:00
Robert Müller 8a3929d48c Support IME composition strings of arbitrary length
Previously, IME composition strings were limited to at most 32 bytes, e.g. 10 Hiragana characters. Now, `SDL_TextEditingExtEvent` (`SDL_TEXTEDITING_EXT`) is supported, which uses heap-allocated composition strings of arbitrary length.

On the other hand, the buffer for input event text was larger than necessary, as SDL text events only contain at most 32 bytes (`SDL_TEXTINPUTEVENT_TEXT_SIZE` is not used directly to avoid the include). With the hint for extended IME handling enabled, long composition text will be sent as multiple text events (without breaking UTF-8).
2024-07-27 17:32:41 +02:00
ChillerDragon 3c5320aa90 Rename editor component Init to OnInit
This matches the naming convention used for client components and the
`GameServer()->OnInit()`
2024-07-27 22:07:56 +08:00
Robert Müller f79ea492fa Minor refactoring of ResizeImage and related functions
Avoid duplicate code by using arrays and loops.

Move local variable declarations closer to their usages.

Use `mem_copy` instead of for-loops.
2024-07-26 21:10:05 +02:00
Robert Müller bfc4902910 Minor refactoring of DilateImage and related functions
Add constants for BPP and alpha threshold during Dilate, as dilating only works for RGBA images and we only use a fixed alpha threshold.

Move local variable declarations closer to their usages.

Use `mem_copy` instead of for-loop.

Use `nullptr` instead of `NULL`.
2024-07-26 21:10:05 +02:00
Dennis Felsing 36b8d81d1a Only ban VPNs for a minute 2024-07-26 17:23:04 +02:00
archimede67 08f955bff0
Merge pull request #8651 from Robyt3/Client-Saves-File-Header-Fix
Fix CSV header being written multiple times to `ddnet-saves.txt`
2024-07-25 22:02:06 +00:00
Robert Müller 5e655615cb Fix CSV header being written multiple times to ddnet-saves.txt
It is implementation-defined whether the file position returned by `ftell` denotes the beginning or the end of the file when opening in append-mode. This was causing the condition `io_tell(File) == 0` to always be true, so the CSV header was also written to `ddnet-saves.txt` every time that a new save code is written. Now, we check if the file already exists before appending and only write the CSV header once when the file does not exist yet.
2024-07-25 20:27:09 +02:00
furo 8f96584f40 Remove servers_legacy support 2024-07-25 17:24:39 +02:00
Dennis Felsing cd81b1f253
Merge pull request #8645 from Robyt3/Client-HUD-Score-Team-Colors
Use same Red/Blue team colors for score HUD as for scoreboard
2024-07-24 16:46:53 +00:00
Robert Müller fddba0cc76
Merge pull request #8641 from def-/pr-formatting
Also trim search strings in highlights
2024-07-24 16:31:02 +00:00
Robert Müller eb956e72d1 Use same Red/Blue team colors for score HUD as for scoreboard 2024-07-24 18:29:00 +02:00
Learath2 90c4a552ed Try fix issue with savegames 2024-07-24 17:36:12 +02:00
Dennis Felsing 1c2d7262d0 Also trim search strings in highlights 2024-07-24 15:23:05 +02:00
Dennis Felsing a84a53c5fe
Merge pull request #8640 from Robyt3/Server-DNSBL-Ban-Only-New
Only apply DNSBL bans once when player joins
2024-07-24 11:08:40 +00:00
Robert Müller 7f2908d822 Only apply DNSBL bans once when player joins
Only ban DNSBL blacklisted players once when joining immediately after the DNSBL result is available, to prevent current players from having their runs ended when the `sv_dnsbl_ban` setting is enabled.

Note that enabling `sv_dnsbl` and `sv_dnsbl_ban` at the same time will still cause the players to be banned immediately. To prevent this, first enable `sv_dnsbl` for at least one tick, then enable `sv_dnsbl_ban`.

Closes #2640.
2024-07-24 12:50:06 +02:00
DynamoFox 9365e1453f Fix 'auto' GPU identification and display
* Refactors the previous code segment
* Fixes 'auto' GPU identification and display in DDNet Graphics tab of
  the settings. The 'auto' GPU is the best one encountered in the VK
  physical device enumeration array until we encounter one that is
  at least "integrated" when accessing them in increasing order
* Selects the first GPU that matches a name when using one by user
  specified name
2024-07-23 21:31:32 +02:00
Robert Müller 8b3e686fdb Fix text input rapidly activated/deactivated when closing console
Fixes virtual keyboard on Android flashing rapidly when the console is closed.
2024-07-23 12:51:36 +02:00
Corantin H 5f8e2742a6 Fix team number and team size rendering
Fix team number and team size rendering outside of the scoreboard when the team is rendered on both sides
Fix team number and team size alignment
2024-07-23 10:10:43 +02:00
Dennis Felsing 712aed780f Version 18.4 2024-07-22 17:56:21 +02:00
Dennis Felsing d8cee35f73
Merge pull request #8628 from Jupeyy/pr_gpu_if
Check API version before adding GPU to GPU list
2024-07-21 12:55:31 +00:00
Robert Müller 606212f2d0
Merge pull request #8629 from MilkeeyCat/pr_refactor_text_alignment_of_movement_information
Use text containers to render movement information
2024-07-21 12:05:59 +00:00
MilkeeyCat ec37efdcfd refactor: use text containers to render movement information
closes #8622
2024-07-21 14:43:22 +03:00
Jupeyy e96275943b
Check API version before adding GPU to GPU list
Signed-off-by: Jupeyy <jupjopjap@gmail.com>
2024-07-21 13:29:49 +02:00
Robert Müller 74426b05a3 Avoid copies of server info in CGameClient::OnNewSnapshot
Only copy the server info with the `GetServerInfo` function once, as it should not change within a call of the `CGameClient::OnNewSnapshot` function.
2024-07-21 12:53:29 +02:00
Robert Müller 3d804910e6 Minor refactoring of RenderNameplate
- Reduce duplicate code and dead stores for color and input data.
- Move variable declarations closer to their usages.
- Remove unnecessary `Graphics()->TextureClear` before `Graphics()->TextureSet`.
- Mark variables `const` and remove unnecessary temporary variables.
- Remove unnecessary default arguments of `Text` and `TextWidth` functions.
- Use `WithAlpha` for colors.
2024-07-20 13:32:14 +02:00
Robert Müller 3afdc20df2 Rename clan related variables, removing Name from name 2024-07-20 13:19:03 +02:00
Robert Müller 0222e4ae96 Avoid duplicate calculations of nameplate text width
Get name/clan bounding box size from the text container index instead of calculating it twice.
2024-07-20 13:18:41 +02:00
Robert Müller b30dde56b6 Extract variables to improve readability and reduce duplicate code 2024-07-20 13:18:17 +02:00
Robert Müller f0fb1fd196 Avoid using pointer for vec2, use in_range function 2024-07-20 13:18:02 +02:00
Robert Müller c24d0c0ace Remove unnecessary CNamePlates::RenderNameplate function
The client ID of `CNetObj_PlayerInfo` objects is validated prior to calling the `CNamePlates::RenderNameplate` function, so the additional checks and arguments to handle the client ID not being valid where never used.

Rename existing `RenderNameplatePos` function to `RenderNameplate`.
2024-07-20 13:17:49 +02:00
Robert Müller 36f19f491e Support touch input in engine, UI and console
Add support for touch input to the engine, UI and console. Ingame touch controls require more discussion and will be delivered separately based on this engine implementation.

Engine
------

The state of all currently pressed touch fingers is aggregated based on the SDL touch events and can be retrieved with the `IInput::TouchFingerStates` function. This design is less complex than an event-based system where the touch events are delivered to the individual client components, as each system would then have to keep track of the finger states individually. However, this means that only one component can handle touch fingers at any given time, which seems like a reasonable assumption for our use cases.

Obsolete code for relative mouse handling on Android is removed. Connecting a mouse to an Android device should now also work as expected, as more recent SDL/Android versions support relative mouse input natively.

User Interface
--------------

Support absolute mouse positioning and clicking in the user interfaces (menus, editor, demo player) with touch presses.

Support right clicking by pressing and holding one finger at roughly the same position for 0.5 seconds.

Support scrolling scroll regions up and down with a two finger swiping gesture. Fast scrolling via a two finger flinging gesture is not yet supported and would be a useful future extension.

The menus and demo player are fully usable with touch inputs. The editor is only fully usable with an external keyboard and/or mouse, as panning the map is not currently possible with only touch inputs, which is also left as a possible future extension.

Console
-------

The touch input logic for the user interface is reused for the console. Thereby, text selection in the console with touch input works, although the text can only be copied by pressing Ctrl+C with an external keyboard at the moment. In the future, we could add buttons to the console to activate the search and copy functionalities with touch inputs.

Support scrolling the console history up and down with a two finger swiping gesture.

The local/remote consoles can currently only be opened with an external keyboard. The ingame touch controls will also include buttons to open the consoles.
2024-07-19 13:36:04 +02:00
Dennis Felsing e74f17c939
Merge pull request #8614 from Robyt3/Video-Removed-Property-Fix
Fix assertion when rendering demo with updated ffmpeg library
2024-07-18 15:59:33 +00:00
Robert Müller c30a35a493 Fix assertion when rendering demo with updated ffmpeg library
The `in_channel_count` and `out_channel_count` properties of the `SwrContext` were already deprecated and have been removed in the most recent ffmpeg library version, hence rendering demos was causing an assertion error when these properties were set.

For newer ffmpeg versions, we now set the channel layout with the `in_chlayout` and `out_chlayout` properties instead of setting the number of channels.
2024-07-18 17:23:16 +02:00
Robert Müller ac95d73e31 Slightly increase size for score in scoreboard again
Did not consider in #8591 that the team and size would also need this space.
2024-07-17 20:23:04 +02:00
heinrich5991 f9a94fb5e0
Merge pull request #8609 from Robyt3/Android-No-Process-No-Server
Disable "Run server" button and process functions on Android
2024-07-17 15:46:56 +00:00
heinrich5991 f9c5d008ca
Merge pull request #8591 from Robyt3/Client-Scoreboard-Spectate-128
Add basic support for 128 players in scoreboard and spectator UI
2024-07-17 15:29:26 +00:00
Robert Müller 45f9161d43 Disable "Run server" button and process functions on Android
Starting the server on Android is currently not possible because a) the server executable is currently not compiled for Android b) launching the server executable with `fork` and `exec` is not supported on Android and may result in strange bugs like broken networking.

Running the server in a background service or in a separate process by using `Runtime.getRuntime().exec` from Java code might be feasible, but this is currently too much effort and may be done in the future.

For now, the "Run server" button as well as the process related system functions are disabled via conditional compilation on Android, to prevent the networking bug that would otherwise be triggered by pressing the "Run server" button.
2024-07-17 16:48:17 +02:00
MilkeeyCat 784333b2aa refactor: remove multi line chat support 2024-07-17 14:13:13 +03:00
Robert Müller 90c63746b4 Show skin name as tooltip in ingame player list 2024-07-16 20:38:47 +02:00
Dennis Felsing 3229a19fd5
Merge pull request #8601 from Robyt3/Client-Camera-ZoomAllowed-Function
Extract `CCamera::ZoomAllowed` function to reduce duplicate code
2024-07-16 16:49:40 +00:00
Dennis Felsing 7197b815a1
Merge pull request #8599 from Robyt3/Spectate-UI-Input-Refactoring
Refactor spectator UI input handling
2024-07-16 16:29:07 +00:00
Robert Müller f574f759d4 Extract CCamera::ZoomAllowed function to reduce duplicate code 2024-07-16 18:06:22 +02:00
Robert Müller 088f963c0d Readd separate localization strings for Red/blue team wins! 2024-07-16 17:40:57 +02:00
Robert Müller ed53b1c6dc Refactor spectator UI input handling
Use `IInput::KeyPress` instead of event callback for mouse presses. Remove subsequently unnecessary `m_Clicked` variable.
2024-07-16 17:12:58 +02:00
Robert Müller 846775c6b7 Avoid reusing Selected variable for different buttons 2024-07-16 17:12:48 +02:00
Robert Müller e8eb79e7fb Remove unused m_OldMouseX and m_OldMouseY variables 2024-07-16 17:12:45 +02:00
Robert Müller d4f47c2a55 Implement client restarting on Android
Restarting the client previously did not work, as the `shell_execute` function on Android uses `fork` which is not supported.

Now, the client is restarted by using an Android intent to restart the main activity. This is triggered by sending a user-defined message from the native code to the SDL main activity thread.
2024-07-16 12:52:19 +02:00
Robert Müller 78da9689f5 Add basic support for 128 players in scoreboard and spectator UI
Support showing up to 128 players in the scoreboard and the spectator UI. The 128 players are rendered in 3 columns of 43 players in the scoreboard and in 4 columns of 32 players in the spectator UI. Other lists like the server info (ingame and in the server browser) and the voting list already support showing any number of players.
2024-07-15 23:41:33 +02:00
Robert Müller 37756aa389 Ensure that sv_max_clients can only be set when starting server
Changing the `sv_max_clients` config variable while the server is running does not change the maximum number of clients that can connect, as this is determined only once when the `CNetServer` is initialized. The reserved slot check and the calculation of the number of player slots for the `protocol7::CNetMsg_Sv_ServerSettings` message were using the `sv_max_clients` config variable directly, which was causing them to be out-of-sync with the real number of maximum clients.

Existing uses of the `sv_max_clients` config variable, except for the `CNetServer` initialization, are replaced with `MaxClients()`. The config variable `sv_max_clients` is now marked as read-only after reading the initial config and command line argument, so changing it via the remote console is not possible and shows an error message. The unnecessary conchain for `sv_max_clients` is removed.
2024-07-15 14:37:11 +02:00
Robert Müller 325e22d2de Fix crashes with dbg_dummies and sv_max_clients
Use the real number of maximum clients returned by the `MaxClients()` function instead of the `MAX_CLIENTS` constant to calculate the debug dummy client IDs to fix a crash when `sv_max_clients` is below `MAX_CLIENTS`.

Ensure the `dbg_dummies` value does not exceed the maximum number of clients.
2024-07-15 14:36:50 +02:00
Dennis Felsing b0f0292fc9
Merge pull request #8588 from Robyt3/Snapshot-Usage-Cleanup
Simplify usage of `IClient::SnapGetItem` function, remove unnecessary `IClient::SnapGetItem` function
2024-07-14 12:49:07 +00:00
Learath ebd266c419 Reset and regenerate m_aPeerAddrStr appropriately
Hopefully fixes #8587
2024-07-14 14:11:19 +02:00
Robert Müller 2f6c3abc90 Remove unnecessary IClient::SnapItemSize function
The item data size is already returned by the `IClient::SnapGetItem` function and getting only the size is not currently useful, so the additional `IClient::SnapItemSize` function is unnecessary.
2024-07-14 13:18:30 +02:00
Robert Müller e9646ba157 Simplify usage of IClient::SnapGetItem function
Let the `IClient::SnapGetItem` function return an `IClient::CSnapItem` directly instead of passing it as a pointer. Add the item data pointer as a member variable to `IClient::CSnapItem` instead of returning it separately. Therefore, the separate data pointer of the class `CSnapEntities` is also not necessary anymore.

Consistently mark the snapshot items and data as `const`. The C-style cast to `void *` in the `IClient::SnapGetItem` function was previously implicitly casting away the `const` of the snapshot pointers.
2024-07-14 13:15:44 +02:00