Commit graph

14078 commits

Author SHA1 Message Date
Dennis Felsing 35f071b021
Merge pull request #7513 from Robyt3/ImageLoader-Greyscale-Fix
Handle all color channel counts in image loader, refactoring
2023-11-20 21:55:00 +00:00
Robert Müller 29a32b7acc Use const char * instead of char const * consistently
Both are equivalent. Seems to already be used consistently for all other types.
2023-11-20 22:26:19 +01:00
Robert Müller bcae7da6b4 Handle all color channel counts in image loader
Greyscale images with alpha channel (i.e. channel count = 2) were incorrectly handled as RGBA images, causing the client to crash when loading such images. Now the images can successfully be loaded with the image loader, but the client still only supports loading RGB and RGBA images like before.
2023-11-20 21:58:29 +01:00
Robert Müller f0a17435e6 Ensure freed image buffer is not propagated
The image data is freed when the image format is unsupported, but `CImageInfo::m_pData` would still point to the freed memory, so double-frees were possible.
2023-11-20 21:58:29 +01:00
Robert Müller 82b75ddfe0 Improve error log messages for PNG loading 2023-11-20 21:58:29 +01:00
Robert Müller 0427dfff2e Use bool instead of int 2023-11-20 21:58:29 +01:00
Robert Müller 15e4f9a886 Remove remaining obsolete // ignore_convention comments 2023-11-20 21:58:29 +01:00
Dennis Felsing 375dd7da8b
Merge pull request #7511 from furo321/telecursor-fixes
Account for zoom when teleporting to cursor.
2023-11-20 12:25:54 +00:00
furo c2d02ad45c Account for zoom when teleporting to cursor. 2023-11-20 12:33:08 +01:00
Dennis Felsing d11a271f45
Merge pull request #7506 from trml/pr_predmargin_simplify
Make prediction margin take effect instantanously
2023-11-19 21:56:40 +00:00
Dennis Felsing 472c9f070b
Merge pull request #7507 from dobrykafe/pr-replace-sizeof
replace `sizeof x` with `sizeof(x)`
2023-11-19 21:56:15 +00:00
Dennis Felsing c15e9b17fa
Merge pull request #7505 from Chairn/pr_wastelefalse
Init vec2 members to 0 and small cleanup
2023-11-19 21:55:09 +00:00
dobrykafe 904abae6ac replace sizeof x with sizeof(x) 2023-11-19 22:36:47 +01:00
trml 717aad2677 Make prediction margin take effect immediately 2023-11-19 19:52:39 +01:00
Chairn 2dcbaf605e Small cleanup: simplify member type and computation 2023-11-19 17:36:17 +01:00
Chairn 5b27062ded Remove unused members 2023-11-19 17:36:16 +01:00
Chairn d6c7bcdbdc Init vec2 members to 0 following #6256 2023-11-19 17:36:16 +01:00
heinrich5991 b4567d6e25
Merge pull request #7502 from Robyt3/Browser-CommunityFilter-Fixes
Prevent community filters excluding all elements, fix server browser update on community filter change via console
2023-11-19 16:24:52 +00:00
Dennis Felsing 44d378c667
Merge pull request #7503 from ChillerDragon/pr_score_controller
Move `m_pLoadBestTimeResult` to `IGameController`
2023-11-19 15:56:41 +00:00
ChillerDragon 16c5a60b53 Move m_pLoadBestTimeResult to IGameController
Gets rid of more CGameControllerDDRace casts.
Those did not show up during compile time only during runtime
of another active controller when asan is active.
2023-11-19 16:23:17 +01:00
Robert Müller ccc470ecc9 Fix server browser update on community filter change via console
Also update server browser filtering/sorting when changing the community/country/type filter config variables with the console.

Clean the filter config variables when they are changed instead of only when the community filter is rendered.
2023-11-19 15:34:50 +01:00
Robert Müller aba67f46ee Prevent community filters excluding all elements
Ensure that community/country/type filters do not exclude all allowed elements, which can happen when a previously selected community is not available anymore or when arbitrary community filter values are set with the console.
2023-11-19 15:34:33 +01:00
heinrich5991 a5b72fef42 Allow antibot to kick people 2023-11-19 14:59:14 +01:00
Robert Müller 2e7cb9e4bc Add missing <cstring> include for memset to system.h
Fix compilation with MinGW due to `memset` call added to `system.h` in #6256.
2023-11-19 13:04:04 +01:00
heinrich5991 28b00892f6 Allow more complex interaction with the antibot via the console
Allows the antibot to receive arbitrary console commands.
2023-11-19 04:41:56 +01:00
heinrich5991 9b024fcf97
Merge pull request #7476 from ChillerDragon/pr_const_char
Overload GetCharacter with const version
2023-11-19 03:08:03 +00:00
heinrich5991 d4713cbfe2
Merge pull request #7475 from ChillerDragon/pr_gametype_mod
Add sv_gametype and sample mod
2023-11-19 03:07:24 +00:00
ChillerDragon becffb9377 Add sv_gametype and sample mod 2023-11-19 03:00:21 +01:00
ChillerDragon d42513e843 Overload GetCharacter() with const version
Allows to do this

```C++
for(const CPlayer *pPlayer : GameServer()->m_apPlayers)
{
	if(!pPlayer)
		continue;
	if(!pPlayer->GetCharacter())
		continue;

	// your code that does not change the character state
}
```
2023-11-19 02:00:28 +01:00
Dennis Felsing 6c935eee91 Version 17.4 2023-11-19 00:50:29 +01:00
heinrich5991 8e75998138
Merge pull request #7451 from apelsin21/master
Appending in editor checks for duplicate images
2023-11-18 23:24:32 +00:00
Axel Vestin 1b7cee3888 Fixes duplicate images when appending maps in the editor 2023-11-19 00:07:31 +01:00
Dennis Felsing 4d40106818
Merge pull request #7337 from dobrykafe/pr-multi-view-qol
multi-view: dont zoom below `cl_default_zoom`
2023-11-18 23:04:27 +00:00
Dennis Felsing 97d64cdfea
Merge pull request #6256 from heinrich5991/pr_ddnet_typesafe_mem_zero
Typesafe `mem_zero` function
2023-11-18 23:00:48 +00:00
Chairn 5cdae502b8 Fix code scanning && clang-tidy false positive? 2023-11-18 22:55:17 +01:00
heinrich5991 0cba06d80f Don't use Mersenne Twister 2023-11-18 22:55:17 +01:00
heinrich5991 b951734c03 Don't allow mem_zero for nontrivial types
Initialize nontrivial types with a constructor instead. Make the
compiler aware that some of our constructors are indeed trivial.

This allows `mem_zero` calls to actually always zero the memory.
2023-11-18 22:55:17 +01:00
Robert Müller ddf935795d Fix inverted community parsing conditions 2023-11-18 22:55:08 +01:00
Chairn 6e629e1deb Type safe mem_zero function (fixes #5228)
Partially replaces #5690.
POD types are just memset. Other types are either destructed if not
trivial and/or constructed if not trivial. Types need to have a default
constructor.
Virtual classes can be mem_zeroed only if they already have been
constructed, otherwise it is UB.
2023-11-18 22:47:22 +01:00
Robert Müller ee04cd4dda
Merge pull request #7459 from heinrich5991/pr_ddnet_community_json
Add icon URL, remove `servers-key`/`ranks-key` from community JSON
2023-11-18 21:08:23 +00:00
heinrich5991 c7cd281aff Add icon URL, remove servers-key/ranks-key from community JSON
Previously:

```json
{
  "ddnet": {
    "name": "DDraceNetwork",
    "servers-key": "servers",
    "ranks-key": "maps",
    "icon-sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b"
  }
}
```

Now:
```json
[
  {
    "id": "ddnet",
    "name": "DDraceNetwork",
    "icon": {
      "sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b",
      "url": "https://info.ddnet.org/icons/ddnet.png"
    },
    "ranks": [
      …
    ],
    "servers": {
      …
    }
  }
]
```

Special case `ddnet` to look for the `servers`, `maps` in the top-level
and `kog` to look for `servers-kog` in the top-level.
2023-11-18 21:52:51 +01:00
Dennis Felsing ccd767aea4
Merge pull request #7474 from ChillerDragon/pr_mod_crash
Fix crash in mod controller
2023-11-18 19:59:22 +00:00
Robert Müller fcddc165b2 Remove unnecessary mem_zero of ringbuffer memory
Zeroing the entire ringbuffer memory is unnecessary and inefficient. Only the first item in the ringbuffer has to be initialized properly.

It's unlikely that existing code depends on allocated memory being zeroed, as recycled ringbuffer items where never zeroed.
2023-11-18 17:40:36 +01:00
Robert Müller e05ec66043 Fix dead lock when printing log entry while rendering console line
Previously, the client would hang due to recursive usage of the console backlog lock when a log line is printed via the logger functions while already owning the backlog lock. This could happen when the text render causes log messages to be printed while the console backlog is rendered.

This is fixed by introducing a separate pending backlog to which new log lines are initially added and which is protected by a lock. The pending backlog entries are pumped into the normal backlog before the normal backlog is used, so accesses to the normal backlog do not need to be locked anymore. This means the console backlog lock is not owned when calling any functions that could print log messages, which should prevent the dead lock.
2023-11-18 16:28:29 +01:00
ChillerDragon f0aae73b1f Fix crash in mod controller
When creating a non ddrace controller and it uses `IGameController::GetMaskForPlayerWorldEvent`
it will crash:

 #0  0x00007ffff72ac83c in ?? () from /usr/lib/libc.so.6
 #1  0x00007ffff725c668 in raise () from /usr/lib/libc.so.6
 #2  0x00007ffff72444b8 in abort () from /usr/lib/libc.so.6
 #3  0x00007ffff749ca6f in __gnu_cxx::__verbose_terminate_handler () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
 #4  0x00007ffff74b011c in __cxxabiv1::__terminate (handler=<optimized out>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
 #5  0x00007ffff74b0189 in std::terminate () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
 #6  0x00007ffff74b03ed in __cxxabiv1::__cxa_throw (obj=<optimized out>, tinfo=0x7ffff766c0e8 <typeinfo for std::out_of_range>, dest=0x7ffff74c85c0 <std::out_of_range::~out_of_range()>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_throw.cc:98
 #7  0x00007ffff74a025f in std::__throw_out_of_range_fmt (__fmt=<optimized out>) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/functexcept.cc:101
 #8  0x00005555555bd4a3 in std::bitset<64ul>::_M_check (this=0x7fffffffbb90, __position=0xffffffffffffffff, __s=0x5555557a9881 "bitset::reset") at /usr/include/c++/13.2.1/bitset:823
 #9  0x00005555555f83e0 in std::bitset<64ul>::reset (this=0x7fffffffbb90, __position=0xffffffffffffffff) at /usr/include/c++/13.2.1/bitset:1196
 #10 0x000055555560262a in IGameController::GetMaskForPlayerWorldEvent (this=0x555555b113d0, Asker=0x0, ExceptID=0xffffffff) at /home/chiller/Desktop/git/ddnet/src/game/server/gamecontroller.cpp:728
 #11 0x000055555560be0f in CPlayer::TryRespawn (this=0x55555592e500 <gs_PoolDataCPlayer>) at /home/chiller/Desktop/git/ddnet/src/game/server/player.cpp:695
 #12 0x000055555560a1a6 in CPlayer::Tick (this=0x55555592e500 <gs_PoolDataCPlayer>) at /home/chiller/Desktop/git/ddnet/src/game/server/player.cpp:249
 #13 0x00005555555e174b in CGameContext::OnTick (this=0x7ffff477d010) at /home/chiller/Desktop/git/ddnet/src/game/server/gamecontext.cpp:964
 #14 0x00005555555a7e34 in CServer::Run (this=0x7ffff57d5010) at /home/chiller/Desktop/git/ddnet/src/engine/server/server.cpp:2893
 #15 0x0000555555592a2b in main (argc=0x1, argv=0x7fffffffd178) at /home/chiller/Desktop/git/ddnet/src/engine/server/main.cpp:197
2023-11-18 15:56:10 +01:00
heinrich5991 2dbfc72a4d
Merge pull request #7464 from ChillerDragon/pr_use_ddr_wrapper
Use GetDDRaceTeam() and move m_Teams to igamecontroller
2023-11-18 13:41:45 +00:00
ChillerDragon 83af6c0a36 Move m_Teams to IGameController
Also increase usage of the `GetDDRaceTeam()` method.
Instead of reimplementing it in place everywhere.

move `m_Teams` from the ddrace controller to `IGameController`
so the ddrace controller casts can go away

This will enable creating another controller instead of the ddrace
controller. Which is useful for community forks.

Also make `m_Teams` private and define a getter for it.
This makes future refactors smoother.
2023-11-18 13:55:48 +01:00
Dennis Felsing 8ab9e72240
Merge pull request #7491 from furo321/fix-lastkickvote
Fix some issues with `sv_vote_kick_delay`.
2023-11-18 12:31:35 +00:00
furo 045915eab5 Fix some issues with sv_vote_kick_delay. 2023-11-18 13:09:13 +01:00
Dennis Felsing 7495b23b24
Merge pull request #7490 from heinrich5991/pr_ddnet_tuning_noconsole
Make gamecore.h not depend on console
2023-11-18 03:09:10 +00:00
heinrich5991 da78cc0735
Merge pull request #7471 from ChillerDragon/pr_tele_controller
Move m_TeleOuts from ddr controller to game controller
2023-11-18 02:54:06 +00:00
heinrich5991 46679deddc
Merge pull request #7481 from Robyt3/Storage-UTF8-Check
Ensure filenames are valid UTF-8 on Unix
2023-11-18 02:51:55 +00:00
ChillerDragon 60e6025e7a Move m_TeleOuts from ddr controller to game controller
#7127
2023-11-17 23:52:31 +01:00
Dennis Felsing 0bf9e2dbb3
Merge pull request #7488 from Robyt3/Editor-GridFactor-Fix
Fix map grid factor always being shown as 1
2023-11-17 22:32:19 +00:00
heinrich5991 75f40ede45 Make gamecore.h not depend on console 2023-11-17 23:26:10 +01:00
Robert Müller dd907ab016 Fix map grid factor always being shown as 1 2023-11-17 21:52:39 +01:00
Robert Müller 7d69016b3a Fix nullptr access on dbg_assert with no global logger
Now it's also possible to use `dbg_assert` without/before having set a global logger.
2023-11-17 21:07:41 +01:00
Robert Müller 5c7bb58457 Ensure filenames are valid UTF-8 on Unix
On Unix, the encoding of filenames is unspecified, although UTF-8 is likely used in most cases. Detecting and converting from several possible encodings to UTF-8 would be too much effort, considering that most systems already use UTF-8 per default. Therefore, any filenames which are not valid UTF-8 will be ignored when listing directories with `fs_listdir(_fileinfo)`, `fs_storage_path` will fail if the storage location is not valid UTF-8 and `fs_getcwd` will fail if the current working directory is not valid UTF-8. Paths specified in `storage.cfg` must also be valid UTF-8.

On Windows, we already ensure that all filenames are converted to UTF-8.
2023-11-17 18:55:28 +01:00
Dennis Felsing 4e27299657
Merge pull request #7470 from furo321/remove-map-setting-msg
Don't print "tunes"/unknown commands from maps.
2023-11-16 23:34:22 +00:00
Robert Müller 88829a5080
Merge pull request #7483 from heinrich5991/pr_ddnet_pred_margin
Don't allow too large of a prediction margin
2023-11-16 21:33:34 +00:00
heinrich5991 24a74e373e Don't allow too large of a prediction margin 2023-11-16 22:18:15 +01:00
Robert Müller 32bd6f6526 Fix leak of community icons when jobs not finished
The community icon data loaded in background jobs was previously not freed when the client is quit before the community icon data is processed.
2023-11-16 21:47:27 +01:00
furo e3402cbf85 Don't print "tunes"/unknown commands from maps. 2023-11-16 01:02:22 +01:00
Dennis Felsing 55098cd313
Merge pull request #7469 from archimede67/pr-save-chat-input
Save current chat input when pressing UP. Prevent input clearing when pressing DOWN
2023-11-15 23:20:13 +00:00
Corantin H 06674ebecf Save current input when using UP arrow. Prevent DOWN arrow from clearing current input. 2023-11-15 23:52:02 +01:00
Dennis Felsing fcd7f135f0
Merge pull request #7466 from Robyt3/Editor-Parent-Folder-Fix
Fix parent folder not being shown in editor file browser, fix typo
2023-11-15 22:37:47 +00:00
heinrich5991 162258af3d
Merge pull request #7467 from furo321/case-insenstive-keys
Make KEY argument case-insensitive
2023-11-15 22:09:40 +00:00
furo 0042aec086 Make KEY argument case-insensitive 2023-11-15 22:51:41 +01:00
Robert Müller f54fc2e441 Fix parent folder not being shown in editor file browser, fix typo
The check for multiple storage locations was using the base path from the previous invocation of the file dialog instead of using the new base path.

Closes #7463.
2023-11-15 22:28:50 +01:00
Jupeyy dfbff0eb57
Merge pull request #7462 from furo321/update_textsize
Set size of text when changing slider of `cl_text_entities_size`.
2023-11-15 20:18:29 +00:00
furo 740049a454 Set size of text when changing slider of cl_text_entities_size. 2023-11-15 20:54:27 +01:00
dobrykafe 08a00cff6b update m_FileDialogFileNameInput when deleting a file 2023-11-15 18:24:20 +01:00
Dennis Felsing eb0392007b
Merge pull request #7458 from furo321/incorrect-usage
Correct usage of `demo_extract_chat` tool.
2023-11-15 14:33:11 +00:00
furo e27223a027 Correct usage of demo_extract_chat tool. 2023-11-15 15:08:30 +01:00
ChillerDragon 9e27a5a107 Fix unused variabled m_WasRecording 2023-11-15 12:11:58 +01:00
Axel Vestin 7c15514696 Use Escape to cancel OP_SCALE envelope 2023-11-14 21:17:07 +01:00
Robert Müller b8d38f7f49 Fix server crash on DDTeam message with lower sv_max_clients
When the `CGameContext::SendChatTeam` function is used to send a chat message to all members of a DDTeam (e.g. on completed /swap chat command), it was not checked whether the target players are online but only whether they belong to the specified team according to the teams core. However, the default team for unconnected/cleared players is 0 in the teams core, which is the same for players in team 0, so chat messages were being sent to client IDs not corresponding to connected clients when chat messages where supposed to be sent to players in team 0. This was causing the server to crash with the assertion error "erroneous client id" specifically when the server is started with `sv_max_clients` being less than the default, maximum 64.

Closes #7450.
2023-11-13 23:16:21 +01:00
Dennis Felsing 32f3f9e03a
Merge pull request #7449 from furo321/lasttp-save
Save entire character with `/lasttp`.
2023-11-12 23:14:12 +00:00
furo f9b9480291 Save entire character with /lasttp. 2023-11-12 23:48:36 +01:00
Dennis Felsing 76d27e734a
Merge pull request #7444 from Chairn/demo_filename
Update string when cutting demo to indicate file name
2023-11-12 22:45:26 +00:00
Chairn c6f78ea3c3 Update string when cutting demo to indicate file name 2023-11-12 23:29:32 +01:00
Jupeyy 39b3249bf5 Increase max zoom limit
To a limit that fits to the biggest maps
2023-11-12 21:36:20 +01:00
Dennis Felsing 4f1fc71f95
Merge pull request #7440 from Robyt3/Server-Credits-Update
Add new contributors to credits
2023-11-12 11:36:26 +00:00
Robert Müller 188462ea27 Add new contributors to credits
Thanks everyone!
2023-11-12 12:20:10 +01:00
Dennis Felsing e74e6770c3
Merge pull request #7325 from Robyt3/Browser-Community-Filter
Add community server filter and icons, remove DDNet and KoG tabs
2023-11-12 00:00:05 +00:00
Dennis Felsing d716210e31
Merge pull request #7408 from Jupeyy/pr_tile_border_shader
Switch to a fragment shader solution for border tile rendering
2023-11-11 23:02:34 +00:00
Dennis Felsing 79e244f166
Merge pull request #7433 from Robyt3/Editor-Color-Picker-Refactoring
Show color picker button for color envelope points
2023-11-11 22:14:41 +00:00
Dennis Felsing aefa52c6b9
Merge pull request #7432 from Robyt3/Base-Standard-Mutex-Wrapper
Add `CLock` wrapper for `std::mutex` to replace `lock_*` functions, use `CLock` instead of `std::mutex`, add thread-safety annotations
2023-11-11 22:07:02 +00:00
Robert Müller bd4c138107 Show color picker button for color envelope points
Simplify selecting envelope point colors by showing a color picker button that opens a color picker popup to change the color of the selected envelope point. The existing editbox to change only the selected channel's value is kept, as the color picker popup does not support the same precision to specify the individual color channel values.

Closes #7317.
2023-11-11 20:45:22 +01:00
Robert Müller d8452ad02c Extract ShowPopupEnvPoint local function 2023-11-11 20:45:22 +01:00
Robert Müller c48623de8f Extract CEditor::DoColorPickerButton function
Fix color not being updated while shift key is pressed, due to use of `else if`.
2023-11-11 20:45:22 +01:00
Robert Müller 37b0a5569d
Merge pull request #7427 from furo321/save-unknown-commands
Save unknown commands from `settings_ddnet.cfg`
2023-11-11 18:24:32 +00:00
Robert Müller 4a00332f59
Merge pull request #7434 from ChillerDragon/pr_ctrl_s_scale
Do not scale envelopes on ctrl+s
2023-11-11 18:22:56 +00:00
furo 6599b7e14b Save unknown commands from settings_ddnet.cfg 2023-11-11 19:09:13 +01:00
ChillerDragon e090d73784 Do not scale envelopes on ctrl+s
When using ctrl+s to test the current envelope it should not activate
the scale mode. This causes unexpected envelope changes on ctrl+s based
envelope fine tuning testing.
2023-11-11 18:56:09 +01:00
Robert Müller 8bde57a1ca
Merge pull request #7429 from dobrykafe/pr-show-directory
Hide `"Show directory"` when `"All combined"` selected
2023-11-11 15:15:34 +00:00
dobrykafe ca6b518383 remove ShowingRoot check 2023-11-11 14:08:41 +01:00
Robert Müller 10470046b7 Use CLock instead of std::mutex, add thread-safety annotations
Use `CLock` and `CLockScope` instead of `std::mutex` and add clang thread-safety analysis annotations everywhere except for usages in engine graphics and video, as those usages also involve `std::condition_variable`.

Fix lock not being unlocked on all code paths in `CFutureLogger::Log`, which is caught by the static analysis.
2023-11-11 00:09:17 +01:00
Robert Müller 3d858c28ee Add CLock wrapper for std::mutex to replace lock_* functions
Replace usages of platform specific `lock_*` functions with `std::mutex` through the wrapper class `CLock`. Move lock classes to `base/lock.h`.

The `CLock` wrapper class is only necessary because the clang thread-safety attributes are not available for `std::mutex` except when explicitly using libc++.
2023-11-11 00:04:57 +01:00
dobrykafe 73fac0c8d4 check StorageType instead of SelectedIndex 2023-11-10 21:45:45 +01:00
heinrich5991 de52ded86d
Merge pull request #7431 from Robyt3/Editor-Envelope-Accuracy
Fix inaccurate envelope point value rounding
2023-11-10 18:31:31 +00:00
Robert Müller 859727c1d3 Fix inaccurate envelope point value rounding
Round to nearest integer instead of truncating in `f2fx` to ensure correct round-trip with `fx2f`.

Add test to ensure correct round-trip with maximum `0.0005f` absolute error.
2023-11-10 19:11:10 +01:00
dobrykafe 41b63843ce hide "Show directory" when "All combined" selected 2023-11-09 22:16:07 +01:00
heinrich5991 962379d64d
Merge pull request #7428 from Robyt3/Editor-Entities-Explain-Assertion-Fix
Fix editor crash when showing explanation for custom entities
2023-11-09 18:41:53 +00:00
Robert Müller df664261bb Fix editor crash when showing explanation for custom entities
The failing assertion is removed because users can add custom entities images besides the predefined ones.

Reported by Mr.Gh0s7 on Discord.
2023-11-09 19:02:54 +01:00
Robert Müller fa8640bd35
Merge pull request #7425 from furo321/editor-correct-corners
Use correct corners for brush rotation buttons.
2023-11-08 19:13:34 +00:00
furo 3ebf0ef85d Use correct corners for brush rotation buttons. 2023-11-08 19:57:37 +01:00
furo 36bf22f1c4 Add button to rename images and sounds in editor. 2023-11-08 18:01:32 +01:00
Robert Müller b4423551d4 Fix client not quitting after graphics assertion
After the error message popup is shown for graphics assertions, the client window was destroyed but the process was not terminated properly. Now the graphics assertion error is handled like a normal assertion error, as those are also shown in an error message popup and correctly cause the client to break into the debugger or terminate.

However, calling `dbg_assert` while already owning the lock that `WaitForIdle` waits on will cause a deadlock, so error handling must be delayed until after the lock is released.

The buffer size for assertion messages is increased, as it was not sufficient for some graphics assertions.

The `ICommandProcessor::GetError` and `ICommandProcessor::GetWarning` functions are marked as `const`.
2023-11-06 23:34:05 +01:00
Jupeyy 50905325d8
Merge pull request #7417 from Robyt3/UI-ColorPicker-RGBA
Add mode selection to color picker popups (RGBA, HSVA, HSLA)
2023-11-05 13:10:08 +00:00
Robert Müller 78217c44d7 Add mode selection to color picker popups (RGBA, HSVA, HSLA)
Add buttons for selecting the color mode (RGBA, HSVA, HSLA) in color picker popups in menu and editor. Previously, the color picker popups always showed the color components in HSVA. Now the mode can be switched so the components are shown in either RGBA or HSLA. The hex color code is always RGBA, same as before.

In the editor, the RGBA mode is used per default, to prevent any loss of information due to color conversions, as the map format stores RGBA values. In the menus, the HSVA mode is the default, same as before, although the config actually stores HSLA values.

The HSVA color picker controls (1D slider for hue, 2D picker for saturation and value) are still shown for all modes.

As many color conversions as possible are avoided by only converting between color formats when necessary. Switching between color modes should not change the selected color. Changing the RGBA hex value in the editor will set the exact value also when another color mode is selected. However, changing the color with the other controls in HSVA/HSLA mode will cause a conversion and possible loss of information. The conversion directly from RGBA to HSVA and vice versa is also explicitly avoided, as this internally converts to HSLA first, which is done separately already.

Closes #7409.
2023-11-05 13:46:01 +01:00
Robert Müller 91e6fca2a5 Add parameter Enabled to DoButton_PopupMenu 2023-11-05 12:56:07 +01:00
Robert Müller 3e5a2888bc Support writing maps with more items/data
Previously, the client would crash with an assertion when writing more than 1024 items, 1024 data items or 64 extended item types to a map file. This arbitrary limitation is removed by using `std::vector`s, so much larger maps can be written. This was only a limitation when writing map files. Old clients can correctly read the map files having more items/data but will crash when the map is saved in the editor.
2023-11-04 22:54:18 +01:00
Robert Müller d39247f726 Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.

The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.

Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.

The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.

The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.

Closes #5654.
2023-11-04 15:32:27 +01:00
Robert Müller 7f694e8fc9 Add IStorage::CalculateHashes
To conveniently calculate the SHA256 and CRC32 hashes of a file without reading the entire file into memory at once.
2023-11-04 15:24:44 +01:00
Jupeyy 639a8c3c8b Switch to a fragment shader solution for border tile rendering 2023-11-04 14:51:39 +01:00
Robert Müller 367c7ba4e7 Fix some textures being loaded without mipmaps
Some calls to `LoadTextureRaw` where passing the image format also in place of the texture load flags. Since the image format would be RGBA most of the time, this was interpreted as the flag `IGraphics::TEXLOAD_NOMIPMAPS` causing various textures (all sprites textures, assets when shown in menus, menu images, menu theme icons) to be loaded without mipmaps.

This is fixed by passing `0` as the texture load flags and by replacing uses of `LoadPNG` and `LoadTextureRaw` with `LoadTexture`.
2023-11-04 12:54:09 +01:00
Robert Müller e12f59b445 Remove unused argument pUser of LoadAsset function 2023-11-04 12:54:09 +01:00
Robert Müller 82ba8e0bb8 Add CTextureHandle::IsNullTexture, rename InvalidTexture
Rename `InvalidTexture` to `NullTexture` to avoid confusion because the null texture is not invalid. The function `CTextureHandle::IsNullTexture` is added to make it easier to check the result of using `IGraphics::LoadTexture`, which returns the null texture on error instead of an invalid texture handle. An assertion is added to ensure that `IsNullTexture` works correctly.
2023-11-04 12:54:08 +01:00
Robert Müller fdaa343219 Fix check for invalid texture after LoadTextureRaw
The handle returned by `LoadTextureRaw` is either valid or invalid (i.e. `-1`) but never the invalid texture itself.

Additionally, ensure that the `LoadTexture` function returns the invalid texture also when `LoadTextureRaw` fails.
2023-11-04 12:54:08 +01:00
Robert Müller 07e336e0f4 Improve theme icon loading, fix flashing black screen
Load theme icons individually for all themes that have been loaded instead of doing a separate scan of the `themes` folder for the icons.

Fix screen occasionally flashing black when opening the general settings. This was caused by `UpdateAndSwap` randomly being called when theme loading takes longer than 1/60 seconds, which sometimes happens on the first start of the client after rebooting the machine. Now the loading popup is correctly rendered when theme loading takes longer than 500ms, which is consistent with the behavior when loading other files.

Minor improvements to log messages.
2023-11-04 12:54:06 +01:00
Robert Müller 77ba85732e Remove middle man in call chain
As `pSelf` is already a pointer to `CMenus` the additional access to the gameclient is unnecessary.
2023-11-04 12:53:04 +01:00
Alexander Akulich b886b93cf2 CPlayer: Remove unused variable 2023-11-03 21:36:33 +03:00
Alexander Akulich 17c90fc061 CCharacter::IsSnappingCharacterInView: Add missing const 2023-11-03 21:36:33 +03:00
Alexander Akulich cf754c4d60 CMenuBackground::GetThemes: Drop unused cast 2023-11-03 21:36:33 +03:00
furo 149e5b6864 Show AFK status in info tab 2023-11-02 13:18:00 +01:00
Dennis Felsing 80c4940b7f
Merge pull request #7403 from Robyt3/Datafile-Writer-Refactoring
Add more assertions to datafile writer, refactoring
2023-11-01 22:02:45 +00:00
Dennis Felsing 3ec5211866
Merge pull request #7404 from Robyt3/Server-Testing-Commands-Freeze-Unfreeze
Add `freeze`/`unfreeze` testing commands
2023-11-01 22:02:09 +00:00
Robert Müller ebe2ddea9f Add gameclient warnings to queue instead of overriding others
Using `CMenus::PopupWarning` will immediately set the popup and override the current warning, which can hide warnings when multiple are shown at the same time. Now all warnings are added to the queue with `IClient::AddWarning`.
2023-11-01 22:17:01 +01:00
Robert Müller 75debadd34 Add freeze/unfreeze testing commands
See #7370.
2023-11-01 17:26:29 +01:00
Robert Müller 9b8eb9d6fc Use for- instead of while-loop, improve comments 2023-11-01 14:07:36 +01:00
Robert Müller 7343ca224c Add CDatafileHeader::SizeOffset to replace magic 16 2023-11-01 14:07:36 +01:00
Robert Müller 64716075f9 Add assertion to ensure correct item IDs are written 2023-11-01 14:07:36 +01:00
Robert Müller 284390cc75 Add assertions to ensure correct map item/data sizes are written
Add assertions to prevent map items and data that are too large to be represented by the map format from being written to maps. Additionally, ensure that the size of the whole map file is not too large to be represented by the map header.

Prevent `malloc` of size 0, which is implementation defined and should be avoided, when adding items without data, which happens for example when adding an empty array of envelope points.
2023-11-01 14:06:28 +01:00
Robert Müller f7722eb016 Remove separate CDataFileWriter::Init/OpenFile functions
Simplify usage of datafile writer by removing duplicate functions for opening file.
2023-11-01 12:54:38 +01:00
Robert Müller 8482e9475c Show warning popup when map image/sound cannot be loaded
Show a warning popup when a map image or sound cannot be loaded for any reason. Only one generic warning popup is shown for images and sounds individually.
2023-10-31 21:21:09 +01:00
Robert Müller 525cc59927 Allow loading embedded images without valid image name
The image name is only required for external images. For embedded images it was only used in log messages. This fixes rendering with various maps that have embedded images with invalid names.
2023-10-31 21:19:49 +01:00
Dennis Felsing 7000b97425
Merge pull request #7396 from BurnyLlama/add-underline_top_five
Added back underline for `sv_regional_rankings 0`.
2023-10-30 23:10:50 +00:00
Dennis Felsing 2eff91083d
Merge pull request #7394 from furo321/fix-setafk
Fix afk timer not working.
2023-10-30 23:03:17 +00:00
BurnyLlama 817ef6eb58 Added back underline for sv_regional_rankings 0. 2023-10-30 22:40:04 +01:00
furo 0ecc50ae0f Fix afk timer not working. 2023-10-30 19:43:35 +01:00
Dennis Felsing 795a2699ef
Merge pull request #7391 from furo321/incorrect-ghost
Fix incorrect ghost being loaded with `cl_race_ghost_save_best`
2023-10-30 09:40:25 +00:00
Dennis Felsing 3235e3eac9
Merge pull request #7392 from furo321/fix-demo-ending-early
Delay server race demo ending by 1 second.
2023-10-30 09:40:00 +00:00
furo 7a7616773d Delay server race demo ending by 1 second. 2023-10-30 03:32:50 +01:00
furo 05e7c284ea Fix incorrect ghost being loaded with cl_race_ghost_save_best 2023-10-30 00:53:00 +01:00
Dennis Felsing 911880a982
Merge pull request #7390 from Patiga/remove-parallax-zoom-from-map
Remove Parallax Zoom from map file
2023-10-29 23:11:32 +00:00
Patiga a9fc2207ac Remove Parallax Zoom from map file
Parallax Zoom improves the appearance of maps visually when zooming.
Contrary to initial tests, it does not interfere with certain map
locations such as the shop on the map Timeshop.
The default value appears to be correct for all existing maps.

The value in the map file is non-trivial to manage, and provides little
benefit. See https://github.com/ddnet/ddnet/issues/6196 for further
discussion.
2023-10-29 23:43:19 +01:00
Dennis Felsing 1acdb6d800
Merge pull request #7389 from BurnyLlama/fix-docs-snd_buffer_size
Altered `snd_buffer_size` description. Fixes #7229
2023-10-29 22:42:46 +00:00
Dennis Felsing a88befb3ca
Merge pull request #7385 from Robyt3/Client-Mapres-Bounds-Checking
Fix client crash on maps with invalid image and sound indices
2023-10-29 22:40:17 +00:00
BurnyLlama c76352cb9f Altered snd_buffer_size description. Fixes #7229 2023-10-29 19:57:03 +01:00