Commit graph

5525 commits

Author SHA1 Message Date
TsFreddie 18ff7f9a5f
Fix Leak IP check 2024-09-25 18:01:24 +08:00
Robert Müller cb4a66aba8
Merge pull request #9031 from ChillerDragon/pr_cfg_layer_selector
Add ``ed_layer_selector`` config to to toggle layer selector feature
2024-09-25 09:02:15 +00:00
ChillerDragon d123aa6741 Add `ed_layer_selector` config to to toggle layer selector feature
Closed #9029
2024-09-25 09:24:52 +08:00
Robert Müller 24ebb54971 Use OpenGL ES graphics backend per default on Android
As Vulkan crashes immediately on launch on a lot of Android devices (for around 15% of users that commented on the Android beta on Discord).

The previous usage of the OpenGL backend in the shortcuts was incorrect, as this backend is not strictly available on Android and the GLES backend should be used instead, as this is also what is displayed in the graphics settings.
2024-09-24 14:26:09 +02:00
Robert Müller cc7aa4cb8e Add volume parameter to sound play functions, fix unused volume
The functions of the client component `CSounds` had a volume parameter which was unused. In some cases, the wrong value (`0`, presumably for the flags) was passed as the volume, which is now changed to `1.0f`. The player ground skid sound was previously set to play only at `0.25f` volume though this parameter was unused, which is also changed to `1.0f` to preserve the historic behavior.

A parameter is added to the engine sound play functions to directly set the volume without having to acquire the lock again.

Fix sound position not being respected for hook hit and ground jump sounds as the position parameter was ignored in the `CSounds::PlayAndRecord` function. Add TODOs for issues with this function for demo recording.

Parameters are ordered consistently and default parameter values are removed.

Duplicate code in the `CSounds` play functions is reduced by reusing the `PlaySample`/`PlaySampleAt` functions.
2024-09-23 21:48:23 +02:00
Robert Müller 986916400d Use vec2s for sound positions
Simply usage and readability of sound functions by using `vec2`s instead of two separate `float`s for positions.
2024-09-23 20:10:19 +02:00
Dennis Felsing f9df4a85be
Merge pull request #9016 from def-/pr-rere
Revert banning old client versions
2024-09-22 14:55:10 +00:00
Dennis Felsing 9c799e7394 Revert "Ban compromised old versions"
This reverts commit db0c83d433.
2024-09-22 16:36:31 +02:00
Dennis Felsing 804d85c7da Revert "Fix 0.7 clients being dropped"
This reverts commit e1b09787ae.
2024-09-22 16:36:26 +02:00
Robert Müller fd33f0fc1a Remove most clang-tidy parameter name exceptions
- `maxModes` --> `MaxModesAvailable` (`MaxModes` is already used differently)
- `numModes` --> `NumModesInserted` (`NumModes` is already used differently)
- `mode` --> `Mode`
- `rgb` --> `Color`
- `png_ptr` --> `pPngStruct`
- `error_msg` --> `pErrorMessage`
- `warning_msg` --> `pWarningMessage`
- `sw` --> `SubWidth`
- `sh` --> `SubHeight`
- `lhs` --> `Lhs`
- `rhs` --> `Rhs`
- `object` --> `pObject`
- `index` --> `pIndex`/`Index`
- `array` --> `pArray`
- `string` --> `pString`
- `integer` --> `pInteger`
- `boolean` --> `pBoolean`
- `p` --> `pObj`
- `id` --> `Id`/`Index`
- `width` --> `Width`
- `height` --> `Height`
- `ownId` --> `OwnId`
- `xoff` --> `OffsetX`
- `yoff` --> `OffsetY`
- `pos0` --> `Pos0`
- `pos1` --> `Pos1`
- `fnMatchCallback` --> `pfnMatchCallback`
- `dx` --> `DeltaX`
- `dy` --> `DeltaY`
- `wx`, `wy` --> `WorldPos` (`vec2` instead of two `float`s)
2024-09-22 15:47:31 +02:00
ChillerDragon e1b09787ae Fix 0.7 clients being dropped 2024-09-22 14:47:09 +08:00
Learath db0c83d433 Ban compromised old versions 2024-09-21 16:07:12 +02:00
Robert Müller e1a21f5a08 Fix toggle command always setting value to 1
Regression from #8971.
2024-09-20 14:35:14 +02:00
Dennis Felsing 6086a93bd6
Merge pull request #8995 from Robyt3/Snapshot-Builder-Size-Fix
Fix snapshot builder creating too large snapshots, do not add snap item if extended item type could not be added, fix snapshot handling when converting 0.7 demo snapshot fails
2024-09-19 14:49:21 +00:00
Edgar 14e2470780
Merge pull request #8994 from M0REKZ/pr_discord_mac
Enable mac arm64 Discord RPC
2024-09-19 14:33:57 +00:00
Robert Müller fd01e6c805 Fix snapshot handling when converting 0.7 demo snapshot fails
Only prevent demo recording of the snapshot instead of ignoring most of the snapshot by returning early when converting the snapshot for demo recording fails.
2024-09-19 16:24:19 +02:00
Robert Müller 2426d59ab5 Remove unnecessary checks in CSnapshotBuilder::Init7 function
The client now validates snapshots including their maximum size, so these additional checks for recording snapshots to demos are unnecessary.
2024-09-19 16:24:06 +02:00
Robert Müller ac9c66047c Extract pItem variable to avoid duplicate GetItem call 2024-09-19 16:24:03 +02:00
Robert Müller 9a380ff199 Do not add snap item if extended item type could not be added
The `CSnapshotBuilder::AddExtendedItemType` function can fail if the snapshot is already full. Previously, this was not handled, leading to `m_aExtendedItemTypes` being updated inconsistently with the real extended item types and the snap item being added without the extended item type. Now, the snap item is not added if its extended item type could not be added.
2024-09-19 16:23:44 +02:00
Robert Müller 67068ade90 Fix snapshot builder creating too large snapshots
The snapshot builder was only considering the size of the data and of the new item being created in the `NewItem` function but not the size of the `CSnapshot` class and the size of the offsets (one `int` for each item including the new one). This could lead to snapshots being too large, which could cause the server to crash when the snapshots were copied into buffers of size `CSnapshot::MAX_SIZE`. However, it should be unlikely for this to happen normally, as the maximum number of snap items (`CSnapshot::MAX_ITEMS`, which is `1024`) is usually reached before the maximum snapshot size.

Also check in the `CSnapshot::IsValid` function that the snapshot is not too large (`CSnapshot::MAX_SIZE`) and check that the number of items is not too large (`CSnapshot::MAX_ITEMS`).
2024-09-19 16:22:30 +02:00
Robert Müller a8424150a4
Merge pull request #8947 from KebsCS/pr-spectator-mouseclicks
Add mouse click functionality in spectator mode
2024-09-19 13:50:08 +00:00
Edgar 0c23eb0a8a
Merge pull request #8971 from Robyt3/Client-Color-Config-Handling
Improve color config variable handling
2024-09-19 13:46:11 +00:00
Dennis Felsing ff9196d841
Merge pull request #8993 from heinrich5991/pr_ddnet_info_finishes
info: "finishes" shouldn't be under "icon" either
2024-09-19 13:42:15 +00:00
heinrich5991 4dcc565e5d info: "finishes" shouldn't be under "icon" either
Actually moving to those new paths shouldn't be done until we get a
breaking change of this JSON, as it would otherwise unnecessarily break
old clients.

Once a new endpoint is created, the backward compatibility can be
removed.
2024-09-19 15:22:50 +02:00
+KZ d89cd13e85 Enable mac arm64 Discord RPC 2024-09-19 10:07:40 -03:00
Dennis Felsing 16adc7d645
Merge pull request #8989 from dobrykafe/pr-lan-page-message
Change LAN tab 'No servers found' message to include port range
2024-09-18 21:27:28 +00:00
dobrykafe 9b1a6ac26b better lan page no servers found message 2024-09-18 21:41:54 +02:00
Robert Müller a2e0ab2dbe
Merge pull request #8973 from furo321/improve-annoucements
Various improvements to announcements
2024-09-18 10:34:53 +00:00
Robert Müller 255694c061
Merge pull request #8975 from furo321/android-save-minimized
Save the config file when the app is minimized on Android
2024-09-18 10:29:09 +00:00
furo b475c67039 Various improvements to announcements 2024-09-18 12:16:29 +02:00
furo a266cd2f70 Save the config file when the app is minimized on Android 2024-09-18 12:10:25 +02:00
Dennis Felsing 96ad30eb21
Merge pull request #8978 from ChillerDragon/pr_spamprot
Describe what sv_spamprotection covers
2024-09-18 06:42:21 +00:00
ChillerDragon 984845b2a9 Describe what sv_spamprotection covers 2024-09-18 09:40:09 +08:00
Robert Müller aa5a24abc4 Improve color config variable handling
- Add separate `CFGFLAG_COLLIGHT7` for 0.7 color config variables, which use `61/255` as darkest lighting value. In comparison, `CFGFLAG_COLLIGHT` uses `0.5` darkest lighting, so the color values being shown for 0.7 color variables were incorrect. Closes #8775.
- Pass darkest lighting as parameter directly instead of using `bool`s to avoid duplicating the logic.
- Add `ColorHSLA::DARKEST_LGT7` constant to replace existing `CTeeInfo::ms_DarkestLGT7` and `CSkins7::DARKEST_COLOR_LGT` constants.
- Round color components before printing them in config variable command handler, as color components are generally also rounded before being packed and before rendering.
- Remove default value of `ColorHSLA::UnclampLighting` function, to avoid incorrect usage.
2024-09-17 12:27:10 +02:00
Robert Müller 3d746099fa Refactor image loading, saving and manipulation
Move `CImageInfo` from `engine/graphics.h` to own file `engine/image.h`. Also add 2-component image format to `CImageInfo::EImageFormat` for completeness, to replace the separate `EImageFormat` in `image_loader.h` with `CImageInfo::EImageFormat`.

Move `SetPixelColor`/`GetPixelColor` functions from editor to `CImageInfo` as member functions.

Replace `IGraphics::CopyTextureBufferSub` and `IGraphics::CopyTextureFromTextureBufferSub` functions with more versatile `CImageInfo::CopyRectFrom` function.

Make `IGraphics::LoadSpriteTexture` function more efficient by avoiding a copy of the image data by using the `LoadTextureRawMove` function. Remove unnecessary delegate function `CGraphics_Threaded::LoadSpriteTextureImpl` and temporary buffer `m_vSpriteHelper`.

Move `CEditorImage::DataEquals` function to `CImageInfo::DataEquals`. Use `mem_comp` to compare image data for more efficiency, instead of comparing each pixel individually.

Add another `IGraphics::LoadPng` function that loads image directly from memory and also handles the pnglite incompatibility warnings. This function will be used for more efficient loading of downloaded skin in the future.

Add convenience functions to load/save PNGs from/to `IOHANDLE` to reduce duplicate code when loading and saving images especially in the tools. These functions explicitly only allow loading images in RGBA and RGB format. Move general purpose image loading and saving functions to class `CImageLoader`.

Add more convenient `CByteBufferReader` and `CByteBufferWriter` classes for reading from and writing to a byte buffer while keeping track of the read/write position to replace existing `SImageByteBuffer`.

Extract `ConvertToGrayscale` utility function to reduce duplicate code when creating grayscale versions of skins, start menu images and community icons.

Move and rename `ConvertToRGBA` static function from graphics to `ConvertToRgba` in `image_manipulation.h/cpp`. Add `ConvertToRgbaAlloc` convenience function which allocates the target buffer. Add ``

Add `DilateImage`, `ResizeImage` and `ConvertToRgba` convenience functions that directly accept a `CImageInfo` argument that will be modified.

Remove unnecessary image size limitation in `map_replace_image` tool, which would only be relevant for 0.7 compatible maps. Adjust the maximum allowed image width/height in `map_convert_07` tool to be consistent with the actual limit that the 0.7 client has when loading images (`1 << 13 == 8192`).

Add doxygen comments for `CImageInfo`.

Pass `CImageInfo` by reference consistently, instead of sometimes passing a pointer.

Cleanup image loading and saving code. Improve error handling.
2024-09-16 17:49:18 +02:00
Robert Müller 5212d1d7ce Rename variables with PNG to Png 2024-09-16 15:45:30 +02:00
KebsCS 3fd0062fb7
Add mouse click functionality in spectator mode 2024-09-15 14:34:00 +02:00
Dennis Felsing 4b6f2e22a8
Merge pull request #8955 from furo321/url-master-parsing
Don't allow URLs without port from the masterserver
2024-09-15 09:28:43 +00:00
furo 7bbd51cf73 Don't allow URLs without port from the masterserver 2024-09-15 11:04:48 +02:00
ChillerDragon 7c2f058c40 Add BindNull to SQL api
Comes in handy in my downstream project
2024-09-15 09:14:00 +08:00
Dennis Felsing a09ce576ac
Merge pull request #8907 from KebsCS/pr-hotreload-dummy
Fix dummy disconnecting on hot reload
2024-09-13 15:36:05 +00:00
KebsCS 1477b8c69e
Fix dummy disconnecting on hot reload 2024-09-13 16:53:06 +02:00
Dennis Felsing 8d431f8feb
Merge pull request #8934 from sjrc6/pr_freeze_stars
Add client setting to restore old freeze stars
2024-09-12 12:31:54 +00:00
Tater 80e2de13da Add client side freeze stars 2024-09-12 04:48:46 -05:00
Jupeyy d5e81ca78d
Merge pull request #8932 from Robyt3/Client-Network-Before-Graphics
Initialize client networking before graphics
2024-09-11 18:07:20 +00:00
Robert Müller 128ffd2313 Initialize client networking before graphics
Avoid Vulkan crash if the backend is destroyed immediately after being created.

Slightly decreases time of initial black screen before loading menu is rendered.
2024-09-11 19:34:31 +02:00
Tim Schumacher 0ad1c08c22 Fixes a bug where econ was exposed publicly when ec_bindaddr was set to localhost
Also implements the original intention of 85f5e9c that is to disable
econ if ec_binaddr is invalid.
2024-09-11 18:28:07 +02:00
Robert Müller 32e9240634 Fix editor crash when saving maps with RGB mapres
Convert mapres to RGBA immediately when loading them, so the image data is always in RGBA format internally, instead of only converting when the map is saved (which was erroneously removed in #8670).

This means the `cl_editor_dilate` setting will now also be applied to converted RGB images.
2024-09-10 21:22:56 +02:00
Robert Müller 58ce5985d4 Use operator != instead of mem_comp for colors 2024-09-09 17:17:17 +02:00
Robert Müller a865354320
Merge pull request #8914 from Jupeyy/pr_cpy_into_fake_buffer
Add another row to do the copying for presented images in when pitch is bigger than width
2024-09-07 18:56:16 +00:00