Commit graph

20665 commits

Author SHA1 Message Date
-StormAx 52a6b4d69f Fix https://github.com/ddnet/ddnet/issues/8668 2024-08-05 06:22:16 +03:00
Dennis Felsing 8d609b9202
Merge pull request #8685 from Robyt3/Client-Binds-Fixes
Support composite binds with `+` commands, fix handling of composite binds with F1-F24 keys, fix incorrect key names with multiple modifiers, refactoring
2024-08-04 20:44:40 +00: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
heinrich5991 585615a7cd
Merge pull request #8683 from archimede67/fix-teamcount-sb
Fix invalid team count in scoreboard for split teams
2024-08-04 15:42:59 +00: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
Jupeyy 00d941a309
Merge pull request #8675 from Robyt3/Graphics-Interface-Cleanup
Remove unused graphics functions, flags and command
2024-08-03 07:14:45 +00: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
Dennis Felsing c532aba4e5
Merge pull request #8673 from Robyt3/Server-Swap-Solo-Message
Add error message when trying to `/swap` on forced solo server, minor cleanup
2024-08-01 22:18:00 +00: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
Jupeyy 44ff68a22e
Merge pull request #8671 from ChillerDragon/pr_fix_furst
Fix first typo
2024-08-01 05:57:43 +00: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
Dennis Felsing 0831aad325
Merge pull request #8670 from Robyt3/Editor-Image-RGB-Cleanup
Remove unused code for saving embedded RGB map images
2024-07-31 21:47:58 +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
Dennis Felsing 3ff3802867
Merge pull request #8667 from Robyt3/Client-Graphics-Image-Checks-Refactoring
Refactor `IGraphics::CheckImageDivisibility` and `IsImageFormatRGBA` functions
2024-07-30 21:26:27 +00: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
Dennis Felsing dac12c7afd
Merge pull request #8665 from Robyt3/Client-DirectInput-Removal
Remove unused `CClient::DirectInput` function
2024-07-29 21:47:36 +00: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
Dennis Felsing 83c9b6cae6
Merge pull request #8663 from Robyt3/Menus-Checker-Fix-Optimization
Smoother menu checker background scrolling on loading screens, fix menu checker background on wide resolutions and optimize it
2024-07-28 22:19:19 +00: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
Jupeyy 26b9d16e05
Merge pull request #8662 from Robyt3/Android-Manifest-Required-Attribute
Add `required` attributes to Android manifest
2024-07-28 17:56:53 +00:00
Robert Müller 0983e813d0 Add required attributes to Android manifest
Fix incorrect default value for Vulkan, which is not required.
2024-07-28 19:38:37 +02:00
Dennis Felsing a898604d03
Merge pull request #8660 from n0Ketchp/patch-20
Update spanish.txt
2024-07-28 12:22:33 +00:00
noKetchup 38773e39a8
Update spanish.txt 2024-07-28 00:29:15 -04: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
Dennis Felsing 3a7d66c971
Merge pull request #8657 from Robyt3/Input-IME-Extended
Support IME composition strings of arbitrary length
2024-07-27 22:02:35 +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