Commit graph

20145 commits

Author SHA1 Message Date
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
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
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
Robert Müller 78cbb45d49
Merge pull request #8656 from ChillerDragon/pr_editor_oninit
Rename editor component `Init` to `OnInit`
2024-07-27 14:26:27 +00: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
Dennis Felsing 9b08eda763
Merge pull request #8655 from Robyt3/Android-Manifest-Vulkan-OGL
Update Vulkan and OpenGL ES versions specified in Android manifest
2024-07-27 12:10:28 +00:00
Robert Müller 2b3ae2425d Update Vulkan and OpenGL ES versions specified in Android manifest
Specify that Vulkan 1.1.0 is used if supported.

Remove explicit requirement of OpenGL ES 3.0 as OpenGL ES 1.0 is also supported as fallback and the client should pick the highest supported version.
2024-07-27 12:06:39 +02:00
Dennis Felsing a1ef70c114
Merge pull request #8654 from Robyt3/Image-Manipulation-Minor-Refactoring
Minor refactoring of `DilateImage`, `ResizeImage` and related functions
2024-07-26 22:41:00 +00: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
Dennis Felsing 27ca58f257
Merge pull request #8649 from furo321/remove-servers_legacy
Remove `servers_legacy` support
2024-07-25 15:48:02 +00:00
furo 8f96584f40 Remove servers_legacy support 2024-07-25 17:24:39 +02:00