- Add `CTeeRenderInfo::ApplyColors` function to reduce duplicate code.
- Use `CTeeRenderInfo::Apply` function in more cases.
- Use `CSkins::Find` function instead of implementing default skin handling manually with the `FindOrNullptr` function for chat settings preview.
- Remove redundant initialization of `CTeeRenderInfo::m_CustomColoredSkin` member.
- Replace empty client skin with `default` instead of checking for empty skin names later.
- Remove unnecessary check for empty skin name for ghost rendering. The `CSkins::Find` function will return the default skin for an empty skin name, which is more correct than invalidating the ghost skin render info.
Previously, skins not found in the `skins` folder were downloaded from the configured URL and saved to the `downloadedskins` folder, but the saved files were never used, leading to wasted downloads and write operations.
Now, if a skin to be downloaded already exists in the `downloadedskins` folder, the modified time of the skin file is determined and included in the HTTP GET request as `If-Modified-Since` header. If the file was not modified on the server since that time, the server will answer with status 304 Not Modified and an empty response body, in which case the existing skin file is loaded. If the skin file was modified, then it will be downloaded like usual. The download will also be retried without including the `If-Modified-Since` header, if the local file is more recent but it failed to be loaded. If a skin could not be downloaded when it should but a file already exists in the `downloadedskins` folder then that file will be loaded instead.
Instead of checking whether the number of skins is different to determine whether to reload the list of skins in the settings menus, the last time that the list of skins was refreshed is now saved and compared, which is more robust. The additional check to refresh the skin list while skins are being downloaded is unnecessary, as any updates to the skin list are now covered by checking the last refresh time.
If the sql statement does not contain placeholders
``NumParameters`` can be empty.
In that case accessing the first element will cause an asan error:
```
runtime error: reference binding to null pointer of type 'st_mysql_bind'
```
Add constant to replace the magic number `24` used for the size of skin names. Skin names in the server info/browser were sized `24 + 1` but the additional byte was unnecessary.
When the datafile is closed, only the `CDataFileReader::Open` and `CDataFileReader::Close` functions may be called. All other functions will now assert instead of returning some default-values if no file is open. The `CDataFileReader::Open` function will now assert if the file is already open instead of implicitly closing the previous one.
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.