The whole idea behind custom sounds was to use them as replacement for
built-in sounds (depending on the gameplay). We have to use the same channels
instead of the MAP (aka 'ambient') channel to have the same volume for both
sets of messages.
Otherwise we have situation of players reporting 'no sound' because they have
`snd_ambient_volume 0` in the configs.
NETMSGTYPE_SV_MAPSOUNDGLOBAL is NETMSGTYPE_SV_SOUNDGLOBAL which uses map
assets as the sounds container. Use the same CSounds::CHN_GLOBAL to make
the sound messages equivalent.
NETEVENTTYPE_MAPSOUNDWORLD is NETEVENTTYPE_SOUNDWORLD which uses map assets
as the sounds container. Use the same CSounds::CHN_WORLD to make the sound
events equivalent.
It is compared to 0 in gamecontext.cpp but it is never explicitly set to 0.
```C++
if(pPlayer->GetTeam() == pMsg->m_Team || (g_Config.m_SvSpamprotection && pPlayer->m_LastSetTeam && pPlayer->m_LastSetTeam + Server()->TickSpeed() * g_Config.m_SvTeamChangeDelay > Server()->Tick()))
return;
```
Use the new `avcodec_get_supported_config` function instead of the deprecated `sample_fmts` and `supported_samplerates` members with libavcodec 61.13.100 and newer.
See 76eb3e5ff3/doc/APIchanges (L53-L56)Closes#9085.
There are two interfaces for score worker data:
There is ``ISqlResult`` and every class inheriting from it should have
the suffix ``Result``
Then there is ``ISqlData`` and every class inheriting from it should
have the suffix ``Data`` if it is data that should be written in an
INSERT statement. Or ``Request`` if it is used to perform a read
operation and will be used in a SELECT statament.
The convention was mostly established alreay. In this commit the last
three classes that broke this convention got fixed.
Specifically:
* Ignore freeze, deep freeze, deep unfreeze, live freeze, and live unfreeze tiles
* Ignore also the switched variants of those tiles
* Allow movement when deep and live frozen
* Ignore death tiles
* Ignore red tele, blue tele, red checkpoint tele, and blue checkpoint tele tiles
* Unlimited jumps
* Disable /rescue
Switches, doors, draggers, etc. are not disabled for invincible players in this patch
This commit adds the rcon command "invincible" which toggles the new m_Invincible variable on CCharacterCore. The feature is supposed to be an alterantive to super that is safe for /practice mode. The state of m_Invincible is synchronized to the client via the DDNetCharacter net object. Future commits will change checks for m_Super to check for m_Invincible as well in places where this is safe such as e.g. preventing freezing of the player. The ability to interact with players that are in other teams will remain exclusive to super.
Specifically, SetSuper(false) followed by SetSuper(false) should not change teams. The following commit relies on this, but it is generally a good idea to remove this footgun.
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.
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.
Fix incorrect panning value (`1.0f`) being set for GUI and Global sound channels after sound volume is changed, whereas the panning value is initialized to `0.0f`. Now the panning value is set to `0.0f` consistently. This should not have had any effect, as GUI and Global sounds do not have a position which would be affected by the panning value.
Show error messages when loading maps, when exporting images/sounds and when embedding images, if images/sounds could not be loaded. Images and sounds not being loaded is supported so the editor can be used to fix maps by removing/replacing the images/sounds.
Saving maps is prevented if embedded images/sounds could not be loaded, as the data is required to save the map.
Always convert image data to RGBA and dilate if enabled also for external images, as images may be embedded later and should therefore always be in RGBA format.
Add separate UI element IDs for the quick action buttons in the prompt dialog, to ensure that the UI element IDs are different from the IDs used for the regular menu buttons. Otherwise, some buttons could not be activated with clicks because the menu button with the same ID was rendered first.
Closes#8998.
The `sx` and `sy` parameters are unnecessary, as they are always set to zero.
The checks in the `SelectSprite` functions are changed to assertions, as passing a wrong sprite ID is a programming error.
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
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.
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.
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`).
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.
- 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.
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.
Events with flag `FLAG_RELEASE` must always be forwarded to all components so keys being released can be handled in all components also after some components have been disabled.
Closes#8901.
Scrollbars are now also set as the hot item when the rail is hovered and the rail clicking function is now only enabled for the scrollbar that is the hot item.
Closes#8954.
- Show Player/Dummy tabs at the top instead of using checkbox for dummy settings like in regular skin settings.
- Show Basic/Custom tabs instead of using button to toggle custom skin settings.
- Move Skin directory and Refresh icon buttons to right side like in regular skin settings. Refreshing 0.7 skins and parts is not implemented yet though.
- Render 0.7 skin entries like entries of the regular skin list, i.e. with more space and with only four skins per row.
- Move the Random skin button next to the Custom colors checkbox and make it an icon button like in the regular skin settings.
- Move skin preview to the right side of the Player/Dummy/Basic/Custom tabs to reduce unused empty space.
- Remove most overlapping and unnecessarily dark backgrounds.
- Improve layout of skin part tabs by only using colors for the first and last buttons.
- Localize skin part tab names again but properly capitalize the names being shown in the UI.