Commit graph

13749 commits

Author SHA1 Message Date
Robert Müller 673b7facbe Remove unnecessary return value of net_init
The return value is unused and always 0, as the function fails with an assertion instead of returning an error value.
2023-09-16 13:37:53 +02:00
Robert Müller 3e548f0f66 Make listbox scrollbar width and margin adjustable 2023-09-16 13:24:19 +02:00
heinrich5991 286104cf08
Merge pull request #7181 from furo321/color-vote
Color vote if you have voted f3 or f4.
2023-09-16 10:40:15 +00:00
heinrich5991 b22956e7c6
Merge pull request #7188 from Robyt3/Server-Missing-Testing-Commands
Add `unninja`, `solo` and `deep` testing commands
2023-09-16 10:25:53 +00:00
furo b423ee59af Color text if you have voted f3 or f4
Add Sv_YourVote packet
2023-09-16 12:17:11 +02:00
Robert Müller 643a23aad3 Add unninja, solo and deep testing commands
Closes #7161.
2023-09-16 11:59:21 +02:00
Alexander Akulich 11a16f553f CMake: Revert versioning (move it back to version.h) 2023-09-16 12:48:36 +03:00
Robert Müller f42e39a9e2 Consistently name CScrollRegion and CListBox getters
Remove `Is` from the getter names for the same reason that removing `Get` from the name is preferred. The word `Is` was inconsistently used as a prefix in `CScrollRegion` but as an infix in `CListBox`.
2023-09-16 11:37:19 +02:00
Dennis Felsing 6b8997b64a
Merge pull request #7185 from furo321/editor-use-pack-functions
Use colour pack functions for editor
2023-09-15 22:37:03 +00:00
Dennis Felsing 15bdef32a1
Merge pull request #7136 from infclass/for-ddnet2
Refactor some core classes (step 1/xxx to shared CGameWorld)
2023-09-15 22:34:53 +00:00
furo 25c3e1616e Use colour pack functions for editor 2023-09-15 22:30:25 +02:00
Dennis Felsing 5e3d97f635
Merge pull request #7174 from Robyt3/Demo-Player-Skipping-Overhaul
Overhaul demo player skipping UI and UX
2023-09-15 20:12:44 +00:00
Robert Müller 350ba77a74 Minor refactoring of ingame server browser
- Remove unnecessary variable `Page`.
- Use `IGraphics::CORNER_NONE` instead of `0` and instead of the inconsistent-looking `CORNER_BR` for the KoG-button.
- Simplify UI rect layout.
2023-09-15 20:57:56 +02:00
dobrykafe 74567a1a62 ability to show local keypresses only 2023-09-15 20:34:23 +02:00
Alexander Akulich 3fd4e10def World cleanup 2023-09-15 18:04:29 +03:00
Alexander Akulich f58eef45b9 Server: Use the tuning params via GameWorld (like in prediction)
The world tuning is a part of the world. This way the entities implementation
use the same API as available on the client side.

This change is a step toward unified/shared world logic for client and server.
2023-09-15 18:04:29 +03:00
Alexander Akulich 77fc14f251 Server: Move player (ID) mapping update to GameContext
This way the GameWorld does not deal with CPlayer.
2023-09-15 18:04:29 +03:00
Alexander Akulich a244e2ced9 prediction/gameworld.h: Drop unneeded friendship with CCharacter 2023-09-15 18:04:29 +03:00
Alexander Akulich a1b7e0c37c Move alloc.h to game/ and use it in client/prediction/entity.h 2023-09-15 18:04:29 +03:00
Alexander Akulich 7dab9e430d CCharacterCore: Break the friendship with CCharacter 2023-09-15 18:04:29 +03:00
Alexander Akulich 4c55e83d91 Character (cli and srv): Access WorldCore via GameWorld() 2023-09-15 18:04:29 +03:00
Alexander Akulich 9eb4cf7508 CCoreCharacter: Add and use HookedPlayer() 2023-09-15 18:04:23 +03:00
furo 321622b66b Prevent editor shortcuts when a dialog is open 2023-09-15 11:15:22 +02:00
marmare314 e4ddbaff49 add export image button 2023-09-14 17:51:10 +02:00
Robert Müller 0ea4d6540a Overhaul demo player skipping UI and UX
Make the skipping duration adjustable with a dropdown menu. The dropdown menu includes the durations 1s, 5s, 10s, 30s, 1m, 5m and 10m. The default duration is 5s. Skipping durations longer than the current demo are not shown. The dropdown menu is only shown if two or more durations would be shown.

Add buttons for skipping the duration, which was previously only possible with the hotkeys.

Add Ctrl+Left/Right hotkeys for skipping to chapters.

Add Shift+Left/Right hotkeys for adjusting the skipping time.

The Left/Right arrow keys and the J/L keys work identically for all hotkeys now.

Ignore ctrl, shift and alt keys for demo speed changes with the mouse wheel, to better support actions like zooming being bound to alt+mousewheel etc.

Also handle keypad enter key for play/pause like the normal return key.

Use arrow up/down icon for speed adjustment buttons, so that the "backward/forward" icons can be used for duration skipping instead.

Closes #7064.
2023-09-13 21:03:04 +02:00
Robert Müller dcd86cb873 Use golden angle to generate unique, distinct DDTeam colors
The DDTeam colors were previously generated in HSL by taking the team index and multiplying it by 360/64° to calculate the hue, which results in team colors being evenly distributed over the entire color range like a rainbow. However, this causes colors of adjacent teams to be very similar and therefore hard to distinguish.

Now, the hue is calculated by multiplying the team index with the golden angle (~137.50776°) and taking the modulo 360° of that. Due to the properties of the golden angle, this can generate never repeating sequences of unique colors where the adjacent colors are very distinct.

Duplicate code is reduced by adding the `CGameClient::GetDDTeamColor` function.
2023-09-13 18:56:47 +02:00
furo 79c503ec0f Fix requested changes 2023-09-12 17:50:06 +02:00
furo 8f8c9a20c0 Add a popup for when video render is done. 2023-09-12 17:19:24 +02:00
heinrich5991 1bc250ba08
Merge pull request #7147 from infclass/for-ddnet
Server: Split the huge CGameContext::OnMessage()
2023-09-11 22:32:44 +00:00
Robert Müller 4ca86f1b05
Merge pull request #7166 from Jupeyy/pr_fix_skin_invalid
Make skin refind cleanup bit more aggressive
2023-09-11 15:22:48 +00:00
Dennis Felsing 2bac51fd33
Merge pull request #7164 from Robyt3/UI-Dropdown-Icon-Alignment
Improve dropdown menu button label alignment
2023-09-11 05:42:19 +00:00
Dennis Felsing 6ab04afd66
Merge pull request #7159 from Robyt3/CLineInput-Desync-Fix
Fix desynced lineinput cursor/selection on external buffer change
2023-09-11 05:38:04 +00:00
Jupeyy 47addc4175 Make skin refind bit more aggressive 2023-09-10 20:14:19 +02:00
Robert Müller 4fb44fc0e8 Improve dropdown menu button label alignment
Reduce the space reserved for the label by the space for the dropdown icon instead of rendering the label behind the icon.

This is more noticeable with smaller dropdown menu buttons, which will be used in the future.
2023-09-10 13:42:38 +02:00
Jupeyy 62c0d34129
Merge pull request #7163 from Robyt3/Editor-Vector-X
Render editor brush selection size with `⨯` instead of `,`
2023-09-10 10:22:17 +00:00
Robert Müller e19a96d0e5 Render editor brush selection size with instead of ,
For example, `20⨯10` instead of `20,10`.

This is the "vector" symbol, which makes the most sense in this context.
2023-09-10 11:59:27 +02:00
Robert Müller 36867df722
Merge pull request #7162 from Jupeyy/pr_fix_clipping_chat
Disable scissor for clearing the framebuffer
2023-09-10 08:44:27 +00:00
Robert Müller e8f17aade1
Merge pull request #7134 from infclass/for-ddnet3
Mod Support: Add NINJA_SKIN_FOR_FROZEN game info flag
2023-09-10 08:32:43 +00:00
Jupeyy ca2926335b Disable scissor for clearing the framebuffer 2023-09-10 09:44:32 +02:00
heinrich5991 96d7a9d0d9
Merge pull request #7158 from Robyt3/Friendlist-Conchain-Fix
Fix friendlist update conchain not working with optional argument
2023-09-09 12:03:30 +00:00
Alexander Akulich 41c83da699 CGameContext::OnMessage: Replace if-else with switch() 2023-09-09 14:49:52 +03:00
Alexander Akulich e6c7d0c96d GameContext: Extract all other messages 2023-09-09 14:49:10 +03:00
Alexander Akulich 3be79f568a GameContext: Extract OnStartInfoNetMessage() 2023-09-09 14:45:15 +03:00
Alexander Akulich 763541af5a GameContext: Extract OnEmoticonNetMessage() 2023-09-09 14:45:15 +03:00
Alexander Akulich 0a2cc3d84c GameContext: Extract OnChangeInfoNetMessage() 2023-09-09 14:45:15 +03:00
Alexander Akulich 9f668e20db GameContext::OnMessage: Move the check for World.Paused into OnSetTeam
1. Regardless of the pause the message is CL_SETTEAM and there is no
   reason to match it against other messages.
2. Another implementation can save the wanted team and apply it later.
2023-09-09 14:45:11 +03:00
Alexander Akulich ce5371b038 GameContext: Extract OnSetTeamNetMessage() 2023-09-09 14:45:04 +03:00
Alexander Akulich a1ec904596 GameContext: Extract OnSayNetMessage() 2023-09-09 14:45:02 +03:00
Robert Müller 84e3c081b4 Fix friendlist update conchain not working with optional argument
The clan argument is optional when using `add_friend` and `remove_friend`.
2023-09-09 13:31:27 +02:00
Robert Müller 21f7af59a0 Fix desynced lineinput cursor/selection on external buffer change
When the buffer of a lineinput is modified externally, the cursor offset and selection are not updated, which causes them to be rendered wrong and also causes the assertion error "Selection and cursor offset got desynchronized" when changing the selection of a lineinput.
2023-09-09 13:25:47 +02:00
Alexander Akulich 1074a5ff56 CMake: Use DDNet_VERSION to construct DDNET_VERSION_NUMBER 2023-09-08 23:13:00 +03:00
Alexander Akulich 88fc275d85 GameContext: Extract OnCallVote() and OnVote() from OnMessage() 2023-09-08 19:19:28 +03:00
Robert Müller f3eaa10d7a
Merge pull request #7102 from Marmare314/revert-6844
revert change to quad selection (resolves #7025)
2023-09-08 15:21:53 +00:00
Dennis Felsing a07fd521f7
Merge pull request #7148 from heinrich5991/pr_ddnet_mastersrv_rawvalue
mastersrv: Go to `RawValue` directly
2023-09-08 09:45:09 +00:00
heinrich5991 cbdd83f790 mastersrv: Go to RawValue directly
Instead of going through `String`.
2023-09-08 11:03:07 +02:00
Robert Müller e5e7e76ce5
Merge pull request #7146 from dobrykafe/pr-settings-player-scroll
Allow countryflag scrolling in player settings while name/clan input selected
2023-09-08 08:45:10 +00:00
Dennis Felsing ee1b8baab5
Merge pull request #7145 from infclass/for-ddnet4
Cleanup CMake, adjust the version variables
2023-09-08 08:09:56 +00:00
dobrykafe 53d0e3f851 allow flag scroll while input selected 2023-09-08 00:12:18 +02:00
Alexander Akulich d0ecb5f8dd CMake: Rework the versioning 2023-09-08 00:10:48 +03:00
Dennis Felsing 06146aa980
Merge pull request #7140 from furo321/render-cut-to-video
Add "render cut to video"
2023-09-07 12:09:07 +00:00
heinrich5991 2bf2850b20
Merge pull request #7128 from ChillerDragon/pr_sixup_slot_info
Fix 0.7 clients not being able to join after slot change
2023-09-06 23:15:43 +00:00
furo 50d0efb410 Add "render cut to demo" 2023-09-06 21:03:51 +02:00
marmare314 ae7eda1628 revert change to quad selection (resolves 7025)
Some refactorings are kept and rotation being bound to `R` is also
not reverted.
2023-09-06 19:30:06 +02:00
Robert Müller dd8b2cd88a Fix incorrect text height when maximum number of lines specified
Check if maximum number of lines has been reached before starting a new line, to prevent the text cursor from reporting the wrong number of lines and text height in that case.
2023-09-06 19:16:42 +02:00
Robert Müller fe95919f63 Support longer lines being rendered in console
Don't truncate console lines at 255 bytes anymore. Especially lines containing many Unicode characters would be adversely affected by this limitation.

Instead, truncate console lines after 10 wrapped lines are rendered. Rendering too many lines at once currently breaks the console scrolling. Rendering an ellipsis is currently not possible when rendering text with a maximum line count.

Increase buffer sizes to handle long (esp. invalid) command inputs.

Closes #7132.
2023-09-06 19:16:00 +02:00
Alexander Akulich 07d8d591c8 Add NO_SKIN_CHANGE_FOR_FROZEN game info flag
The flag is wanted for mods which use freeze state but need or want
to keep the player skins (the skin is critical for some mods).
2023-09-06 16:50:06 +03:00
furo f71a2e017a Add CTRL+F in load map prompt 2023-09-06 15:29:07 +02:00
ChillerDragon 5a8e67b323 Fix 0.7 clients not being able to join after slot change
If the player slots update the 0.7 clients have to be informed
about it. Otherwise the client can block the join button
if the outdated playerslots are filled already.
2023-09-06 12:50:16 +02:00
heinrich5991 1abd09fbc4
Merge pull request #7112 from Robyt3/UI-Tooltip-Fix
Fix some menus tooltips not working anymore
2023-09-06 10:35:20 +00:00
heinrich5991 d2a12e01c1
Merge pull request #7126 from Robyt3/Graphics-Format-PixelSize
Add `CImageInfo::PixelSize` function, use `enum EImageFormat`
2023-09-06 09:57:59 +00:00
heinrich5991 86e0e9539d
Merge pull request #7135 from Moiman/typos
Fix typos
2023-09-05 21:04:33 +00:00
Harri Nieminen 4d9ff1d904 Fix typos
Found by codespell
2023-09-05 22:32:09 +03:00
Dennis Felsing f44204da87
Merge pull request #7133 from Robyt3/Windows-Pipe-Refactoring
Improve Windows pipe (FIFO) support
2023-09-05 19:22:03 +00:00
Robert Müller 1604784669 Improve Windows pipe (FIFO) support
Use `WaitForPipeDrain` to deterministically wait for the pipe to drain instead of using `Start-Sleep`.

Use `Dispose` instead of `Close` to properly flush and close the pipe stream.

Add error handling for connection timeout and I/O errors.

Handle `ERROR_BROKEN_PIPE` separately when peeking at pipe, as this happens when the pipe is disconnected immediately after connecting it or after reading the previous message.

Don't ignore `ERROR_BAD_PIPE` anymore, as the pipe should never be in a disconnected (i.e. bad) state at this point of the function.
2023-09-05 19:15:09 +02:00
Robert Müller b4fa20599e Truncate IP with ellipsis in connecting popup 2023-09-04 21:16:27 +02:00
Robert Müller dde45f7a40 Add CImageInfo::PixelSize function, use enum EImageFormat
Use `enum EImageFormat` type for image format literals and variables.

Add `PixelSize` function to get the number of bytes/color channels per pixel for a specified image format.

Remove unused store format argument of texture loading functions. All textures are automatically being stored as RGBA, so the argument was unused. Also remove the therefore unused `FORMAT_AUTO`.

Rename variables consistently to `PixelSize` and use `size_t`, instead of mixing different names like `BPP` and `ColorChannelCount`.

Validate image format loaded from maps using `CImageInfo::ImageFormatFromInt`. Add `FORMAT_ERROR` to represent invalid formats.

Remove redundant `PixelSize` parameter from graphics backends and commands, which can be derived from the texture format.

Fix memory leak when RGB image data is being converted to RGBA format when saving map in editor.
2023-09-03 20:40:28 +02:00
Dennis Felsing 3ff799770c
Merge pull request #7125 from Vy0x2/pr-fix-mv-default-zoom
Remove setting default zoom after leaving multiview, fixes #7113
2023-09-02 20:00:47 +00:00
Dennis Felsing a17798aaa7
Merge pull request #7123 from Robyt3/ImageLoader-Refactoring
Minor refactoring of the image loader
2023-09-02 20:00:14 +00:00
devdenn 533d401ea5 Remove setting default zoom after leaving multiview 2023-09-02 16:57:24 +02:00
Robert Müller ab6262d7ce Use nullptr instead of NULL 2023-09-02 12:07:46 +02:00
Robert Müller 872d6c9e5e Move variable declarations closer to usage/definition 2023-09-02 12:05:31 +02:00
Robert Müller ead33ba05a Add debug messages for all error cases in LoadPNG 2023-09-02 12:01:06 +02:00
Robert Müller 16bc489afb Move editor automap .rules files to separate subfolder
For better organization of the `data/editor` folder.
2023-09-02 11:41:46 +02:00
Dennis Felsing 54134d6d38
Merge pull request #7119 from Robyt3/UI-Progress-Spinner-Editor
Add progress spinner to UI, show progress spinner while saving map in editor
2023-09-01 23:43:16 +02:00
Robert Müller 1ebd209f90
Merge pull request #7095 from Marmare314/refactor-a1
Refactor editor mapitems
2023-09-01 18:47:51 +00:00
Robert Müller eac1dc4533 Show progress spinner while saving map in editor 2023-09-01 19:26:34 +02:00
marmare314 59df1d86d4 move CEditorMap::HandleMapDrop to CEditor 2023-09-01 18:57:36 +02:00
marmare314 12d0608dfd let CEditorImage inherit CEditorComponent 2023-09-01 18:57:35 +02:00
marmare314 07fd8e6712 let CAutoMapper inherit CEditorComponent 2023-09-01 18:57:13 +02:00
Dennis Felsing 4c593bc222
Merge pull request #7117 from Robyt3/Chat-Clear-Fix
Fix chat history disappearing with `cl_showchat 1`
2023-09-01 07:27:07 +00:00
Robert Müller 147561e281 Add CUI::RenderProgressSpinner function 2023-08-31 22:40:09 +02:00
Robert Müller a4232198ed Add CUIRect::Center convenience function 2023-08-31 21:33:17 +02:00
Robert Müller 87a0461eb6 Disable server browser hotkeys when popup menu is open
Closes #7088.
2023-08-31 21:16:51 +02:00
Robert Müller ddb9cdd251 Use DefaultTextColor/DefaultTextOutlineColor 2023-08-31 20:14:10 +02:00
Robert Müller cfcc2ff9bc Remove unused include 2023-08-31 20:14:10 +02:00
Robert Müller 933b4ad2ab Fix chat history disappearing with cl_showchat 1
Closes #7115.
2023-08-31 20:14:10 +02:00
Robert Müller cbc1044b98 Fix some menus tooltips not working anymore
For some tooltips, the associated UI element ID was not being set as hot item, which is required for tooltips.

The tooltip for the "Dummy settings" checkbox was only present on the tee settings page but not on the player settings page.

Closes #7107.
2023-08-30 21:57:04 +02:00
Jupeyy 16115c204e
Merge pull request #7094 from Robyt3/Variable-Desc-Fixes
Remove `gfx_finish` config variable, remove `dbg_hitch` config variable, improve config variable descriptions, add missing descriptions
2023-08-30 18:28:25 +00:00
Robert Müller 98b3fe460a Fix typo in internal name of cl_assets_entities config variable
The name used in config is unchanged.
2023-08-30 20:07:12 +02:00
Robert Müller 943f98dc92 Improve config variable descriptions, add missing descriptions 2023-08-30 20:07:11 +02:00
Robert Müller 1028cedee3 Remove dbg_hitch config variable
This config variable was only settable in the server console but only read in the client, so it was effectively unusable. It also has no use case right now.
2023-08-30 20:07:11 +02:00
Robert Müller 31a80c976b Remove gfx_finish config variable
This config variable does not have any use case right now and only causes the rendering to be slowed down.
2023-08-30 20:07:11 +02:00
Dennis Felsing 7d6ec23437
Merge pull request #7109 from Robyt3/CLocConstString-Removal
Remove `CLocConstString`
2023-08-30 17:47:50 +00:00
Robert Müller bc82a450c3 Remove CLocConstString
This makes it more obvious where text is localized. This class was also broken for localized strings with context, since the member variable `m_ContextHash` was uninitialized.
2023-08-30 19:24:38 +02:00
Robert Müller 0a290bc501 Remove unused enum literals 2023-08-30 17:58:21 +02:00
Dennis Felsing 7231d8317f
Merge pull request #7100 from Robyt3/Lineinput-Selection-Desync
Fix lineinput selection getting desynchronized from cursor
2023-08-29 20:37:43 +00:00
marmare314 c3a07dd977 let CEditorSound inherit CEditorComponent 2023-08-29 22:28:07 +02:00
marmare314 d68029a252 extract CEditorSound into separate header file 2023-08-29 22:08:12 +02:00
marmare314 5f60d68e8b extract CEditorImage into separate header 2023-08-29 22:08:12 +02:00
marmare314 a1ea2f1ff1 Split up io.cpp 2023-08-29 22:08:07 +02:00
Robert Müller 95b1c7dc2b Hide client is not online log message except when using record
The log message is otherwise shown multiple times when starting the client.

Now it's only shown when the `record` command is used manually, i.e. not for automatically recorded demos anymore.
2023-08-29 22:05:16 +02:00
Robert Müller e3700ac4e4
Merge pull request #7016 from k-i-o/k-i-o-patch-1-3
Update gameclient.cpp
2023-08-29 16:10:39 +00:00
Robert Müller b7773d2b4c Fix lineinput selection getting desynchronized from cursor
When the text cursor/selection mode is set to calculate, values of `-1` are used when the selection is empty. These values were not being handled anymore due to a regression from #7028. This was causing the selection to be set to the last position instead, which was causing text to subsequently be inserted there instead of at the cursor position.

An assertion is added to ensure that the selection cannot be desynchronized from the cursor position anymore.

Closes #7099.
2023-08-29 18:01:09 +02:00
Samuele Radici 73f68c73f4 done i hope 2023-08-29 13:52:31 +00:00
Samuele Radici 6534728744 fix style 2023-08-29 11:01:58 +00:00
Samuele Radici d7d635881b I found out he didn't save himself... 2023-08-29 10:09:55 +00:00
Dennis Felsing 04f71333b0
Merge pull request #7096 from furo321/fix-demo-sorting
Fix demo sorting
2023-08-28 22:11:04 +00:00
heinrich5991 ee32ceb1da
Merge pull request #7092 from furo321/pr_fix_ipv4only_registering
Don't register to ipv6 when sv_ipv4only is enabled. (fixes #7091)
2023-08-28 21:09:59 +00:00
furo b24b11f48e Move sv_ipv4only check to OnConfigChange 2023-08-28 22:45:53 +02:00
furo 28fda865c5 Keep selection after sort 2023-08-28 21:47:48 +02:00
furo 2dcc0b9db3 Fix demo sorting 2023-08-28 21:11:12 +02:00
heinrich5991 812231449b
Merge pull request #7093 from HiRavie/master
Fix all envelopes being saved as bezier
2023-08-28 14:51:49 +00:00
Ravie 6705cccb72 Fix all envelopes being saved as bezier 2023-08-28 16:19:41 +02:00
Dennis Felsing ff1a2a44d3
Merge pull request #7076 from dobrykafe/pr-fix-map-drag-and-drop
Add warning for unsaved editor changes when dragging a map file into the game
2023-08-28 13:49:58 +00:00
Dennis Felsing baffa8d817
Merge pull request #7080 from heinrich5991/pr_ddnet_teehistorian_prev_game_uuid
Record previous game ID in teehistorian
2023-08-28 11:28:00 +00:00
Dennis Felsing c7f3be7d75
Merge pull request #7082 from Marmare314/editor-seperate-mapitems
extract code from editor mapitems into separate files
2023-08-28 10:23:17 +00:00
furo 8f73a9ea8c Fix style 2023-08-27 21:40:32 +02:00
furo 2b07832b9e Don't register to ipv6 when ipv4only is enabled. 2023-08-27 21:23:55 +02:00
Robert Müller 3988877e8e
Merge pull request #7002 from Marmare314/pixelart
Add pixelart tool to editor
2023-08-27 18:42:35 +00:00
heinrich5991 70bf739b6f Notify antibot of round start after initializing teehistorian
This allows the antibot to start pushing data into teehistorian
immediately.
2023-08-27 17:35:13 +02:00
heinrich5991 a48d14fac0 teehistorian: Omit "prev_game_uuid" instead of setting it to null 2023-08-27 16:11:45 +02:00
heinrich5991 cbdb3b1d2e Record previous game ID in teehistorian
This allows to trace a complete server execution.
2023-08-27 16:11:45 +02:00
heinrich5991 330d1ebaf6 Add possibility to persist game data past map changes 2023-08-27 16:11:45 +02:00
marmare314 946be50807 Add tileart tool to editor 2023-08-27 16:07:56 +02:00
marmare314 e19b1e4da6 extract code from editor mapitems into separate files 2023-08-27 16:04:53 +02:00
marmare314 605a93787e improve code style in proofmode, mapgrid and mapview 2023-08-27 11:38:15 +02:00
dobrykafe 758601c310 remove duplicate code 2023-08-26 22:28:19 +02:00
dobrykafe cb29ad2b4f dont switch to editor if loading fails 2023-08-26 22:13:13 +02:00
Dennis Felsing c9557b2ee9
Merge pull request #7069 from furo321/pr_demo_searchbar
Add a searchbar for demos.
2023-08-26 19:00:31 +00:00
Dennis Felsing 48d0228428
Merge pull request #7077 from infclass/ddnet-fix-pause
CGameClient::Predict: Disable prediction if the game is paused
2023-08-26 18:35:17 +00:00
furo ac775eca36 Fix style 2023-08-26 20:29:58 +02:00
Robert Müller 8effc201bd
Merge pull request #7075 from Marmare314/issue-7053
clamp value-range for color envelopes in popups
2023-08-26 18:14:06 +00:00
dobrykafe 8957ae99bd remove whitespace 2023-08-26 19:44:53 +02:00
Alexander Akulich ec7d1f89e1 CGameClient::Predict: Disable prediction if the game is paused
CGameClient::OnPredict() says "don't predict anything if we are paused"
and yet we predict different stuff based on CGameClient::Predict() result
which leads to flickering here and there (e.g. for projectiles and characters).
2023-08-26 20:37:55 +03:00
Alexander Akulich 63ed421e38 CGameClient: Move Predict() implementation to .cpp file and reformat it 2023-08-26 20:37:55 +03:00
dobrykafe 5e923adcc9 fix map drag and drop 2023-08-26 18:14:13 +02:00
furo 0ebc40ec80 Naming: Item -> pItem 2023-08-26 17:28:35 +02:00
marmare314 c5282682f7 clamp value-range for color envelopes in popups
fixes #7053
2023-08-26 17:23:37 +02:00
marmare314 c68350a08a reset operation status after creating envelope context menu
fixes #7050
2023-08-26 17:14:57 +02:00
furo 1b20a9640d Fix requested changes. 2023-08-26 13:13:12 +02:00
Robert Müller 6b6ee21338
Merge pull request #7017 from Marmare314/mapview
Add `CProofMode` and `CMapGrid` component
2023-08-26 08:54:38 +00:00
furo 4f3a4c4816 Whops 2023-08-26 02:10:54 +02:00
furo 6781717983 Ability to search for demos. 2023-08-26 01:55:30 +02:00
marmare314 467de92377 Add CProofMode and CMapGrid component
Also extract more code into `CMapView` and extend the `CEditorComponent`
interface.
2023-08-25 20:40:27 +02:00
Dennis Felsing 5ba1834eed
Merge pull request #7067 from Marmare314/vscpp-issue
fix CScorePlayerResult for visual c++ compiler
2023-08-25 17:57:40 +00:00
Marek B 5815f8c6c0 fix CScorePlayerResult for visual c++ compiler 2023-08-25 18:17:01 +02:00
Robert Müller b6f0c59b26 Refactor editor entities layer explanations
Use `enum`. Organize explanations in separate functions for DDNet, FNG and Vanilla.
2023-08-25 17:49:13 +02:00
Dennis Felsing 23ed630a4e
Merge pull request #7065 from heinrich5991/pr_ddnet_teehistorian_antibot
Allow antibot to record data into teehistorian
2023-08-25 15:08:35 +00:00
heinrich5991 84948adad1 Allow antibot to record data into teehistorian 2023-08-25 14:26:09 +02:00
heinrich5991 548f2f6021
Merge pull request #7058 from Robyt3/Demo-Player-Pause-Indicator
Show indicator when pausing/unpausing in demo player
2023-08-25 11:55:03 +00:00
Robert Müller ec0522d58f Show indicator when pausing/unpausing in demo player
Render a pause/play icon in the center of the screen when pausing/unpausing while the menu is not active.

The icon fades in and out over 0.5 seconds and slightly increases in size over that time.

When starting demo rendering with initial pause, the pause indicator is rendered continuous until playback is first started, to ensure that the initial pause state is communicated clearly to the user. The initial pause indicator is not included in the rendered demo, but pausing and unpausing later during demo rendering will cause it to be included in the video, same as other UI elements. Closes #7044.

The config variable `cl_demo_show_pause` (`0/1`, default `1`) is added to hide the pause indicator entirely, for example to render a demo with multiple pauses without the indicator.

The pause indicator and also the existing speed indicator are not rendered (anymore) while the menu is active, as the menu already contains this information.
2023-08-25 13:29:17 +02:00
heinrich5991 b739c18a86
Merge pull request #7056 from Robyt3/Base-Number-Format-Optimization
Add `str_from_int` function
2023-08-25 11:16:00 +00:00
heinrich5991 1f13a693a5
Merge pull request #6744 from Zwelf/pr-fix-teehistorian-mapchange
Fix JoinVer and Join teehistorian chunks missing in some conditions
2023-08-25 11:15:43 +00:00
Dennis Felsing e4278479b0 Version 17.2.1 2023-08-25 09:17:11 +02:00
Zwelf e356d12fbf Fix teehistorian test comment 2023-08-25 00:42:54 +02:00
Zwelf 3c2d8afff6 Create new teehistorian event for player rejoin 2023-08-25 00:42:54 +02:00
Robert Müller dfe91705c1 Improve alignment of demo icon buttons 2023-08-24 20:54:50 +02:00
Robert Müller 6ff860a2d7 Add color4_base::WithMultipliedAlpha 2023-08-24 20:54:50 +02:00
Robert Müller d2c9750c65 Add str_from_int function
Add more efficient function for formatting integer values as strings.

A benchmark shows that using this function is significantly faster than using `str_format`. It is faster by a factor of 220 with Clang 15.0 O2 (https://quick-bench.com/q/BlNoLnlyqxipf4jvsFTUxKMHDJU) and by a factor of 11 with GCC 12.2 O2 (https://quick-bench.com/q/Fxf9lDCTqXBF4pIa_IyZ5R0IqYg).

This increases FPS in the editor by ~25% when many numbers are rendered for switch/tele/speedup/tune layers or with "Show Info" being enabled.

The additional static analysis for `std::to_chars` revealed that the wrong size was used in `CHud` for `aScoreTeam[TEAM_RED]` and `aScoreTeam[TEAM_BLUE]`.

This requires incrementing the macOS deployment target from 10.13 to 10.15.
2023-08-24 20:54:17 +02:00
Teero888 cd66a8c1d2
fix #7062 2023-08-23 20:56:23 +02:00
heinrich5991 1c8a67f6f9
Merge pull request #7049 from Robyt3/Sqlite-Error-Assertion
Fix assertion failure when SQLite connection fails, Remove unused `IDbConnection::Copy`
2023-08-23 15:38:39 +00:00
Robert Müller 040731095e Fix assertion failure when SQLite connection fails
When connecting to the SQLite database fails, e.g. because the `.sqlite` file is corrupted, the server would crash with the assertion "Tried connecting while the connection is in use" when a player joins and performs any action.

This is fixed by resetting the use-flag when connecting to the SQLite database fails, which is the same behavior as for the MySQL database connection.
2023-08-22 20:40:36 +02:00
Robert Müller bb147328c2 Remove unused IDbConnection::Copy 2023-08-22 20:40:36 +02:00
ChillerDragon 796d79ad5b Replace 0.7 serverinfo magic number with enum 2023-08-22 13:53:08 +02:00
Dennis Felsing 55789819a3
Merge pull request #7026 from ChillerDragon/pr_auth_unused
NETMSG_AUTH_CHALLENGE is not used in 0.6 or 0.7
2023-08-22 09:59:58 +00:00
ChillerDragon 87640d7857 NETMSG_AUTH_CHALLENGE is not used in 0.6 or 0.7 2023-08-22 10:31:16 +02:00
Dennis Felsing dc7366f7a4
Merge pull request #7048 from Robyt3/Editor-Saved-Brush-No-Clear
Don't clear saved brushes when loading another map
2023-08-19 23:05:31 +00:00
Robert Müller a325245397 Don't clear saved brushes when loading another map
It was not actually necessary to clear the brushes to prevent the crashes. The crashes were fixed by not storing the texture handles for the layers anymore.

Closes #7024.
2023-08-19 20:46:14 +02:00
Robert Müller 6633e9af1d Add button to reload entities background, improve DDNet menu layout
Add a button to manually reload the entities background map instead of automatically reloading it when it's changed. As the background map was only reloaded every 10 seconds, sometimes changing the background map quickly had no effect.

Improve the layout of the DDNet settings menu. Align labels and UI elements and reduce unused empty space.
2023-08-19 17:44:58 +02:00
Robert Müller 7c1a667486
Merge pull request #7046 from infclass/kaffeine/drop-rendering-paused-by-default
Remove cl_video_pause_on_start; reset the pause option on popup opened
2023-08-19 11:42:54 +00:00
Dennis Felsing ae12d8d9f6
Merge pull request #7045 from Robyt3/Loglevel-Variable-Fixes
Save console output variables again, improve descriptions
2023-08-19 11:20:24 +00:00
Alexander Akulich 29688fb499 Remove cl_video_pause_on_start; reset the pause option on popup opened 2023-08-19 13:51:38 +03:00
Robert Müller db1452d0a8
Merge pull request #6988 from Marmare314/envelope-scale
implement scaling for envelope editor
2023-08-19 09:49:17 +00:00
Robert Müller 6ba328dfdb
Merge pull request #7009 from Possseidon/dev/multi-view-team
Allow automatic multi-view for players in a team
2023-08-19 09:01:10 +00:00
Robert Müller bfe1175558 Save console output variables again, improve descriptions
As #6451 was partially reverted by #5434.
2023-08-19 10:53:47 +02:00
Dennis Felsing a44bd9d3e1 Shut down db connection pool (fixes #7036) 2023-08-17 14:35:58 +02:00
Samuele Radici 4e1fbd71c8 Fixed, now my pc is alive xd 2023-08-17 00:32:44 +00:00
marmare314 23e2d9377d implement scaling for envelope editor 2023-08-16 15:06:41 +02:00
marmare314 fded5013eb Do not activate box selection when panning (fixes #7031 and #7030)
And do not pan while any other operation is in progress.
2023-08-16 12:17:06 +02:00
Dennis Felsing b52fa5e910
Merge pull request #7028 from Robyt3/Base-Str-Utf8-Offset-Functions
Add utility functions for converting UTF-8 bytes ↔ chars offsets
2023-08-15 21:10:38 +00:00
Zwelf d7164211e6 Rename OnClientEngineJoin and OnClientEngineDrop to make the name fit its usage 2023-08-15 22:22:42 +02:00
Zwelf b9458150e0 Fix JoinVer and Join teehistorian chunks missing in some conditions
vanilla 0.6 joins weren't recorded. Also after map change, for the
existing players these Join chunks were missing.  Just add these
message for existing players now and add OnClientEngineJoin in all
code paths with clients connecting.
2023-08-15 22:22:42 +02:00
Robert Müller af3870a64d Add utility functions for converting UTF-8 bytes ↔ chars offsets
Add `str_utf8_offset_bytes_to_chars` and `str_utf8_offset_chars_to_bytes` functions to base system to convert between byte and UTF-8 character offsets in UTF-8 strings.

Previously, this was separately implemented in the textrender and in the lineinput helper.

These textrender functions are entirely replaced by the new functions:

- `ITextRender::SelectionToUTF8OffSets` (by `str_utf8_offset_chars_to_bytes`)
- `ITextRender::UTF8OffToDecodedOff` (by `str_utf8_offset_bytes_to_chars`)
- `ITextRender::DecodedOffToUTF8Off` (by `str_utf8_offset_chars_to_bytes`)

These lineinput helper functions are reimplemented using the new functions:

- `CLineInput::OffsetFromActualToDisplay` (uses `str_utf8_offset_bytes_to_chars`)
- `CLineInput::OffsetFromDisplayToActual` (uses `str_utf8_offset_chars_to_bytes`)
2023-08-15 22:11:25 +02:00
Robert Müller 7168fb15d2 Move OnWindowResize listener to engine, handle editor
Register the `OnWindowResize` listener in the engine client instead of the game client and properly dispatch the event also to the editor, so text containers in the editor are cleared when the window is resized.

Closes #7018.
2023-08-15 20:17:27 +02:00
Robert Müller 5567c56d3a Reorder CClient interface pointers alphabetically 2023-08-15 19:47:52 +02:00
Robert Müller 15be3c3944 Remove unused m_DebugSoundIndex variable 2023-08-15 19:47:52 +02:00
Alexander Akulich 6555799e85 Cleanup declarations 2023-08-15 19:02:17 +03:00
Robert Müller f90e908c9d Reset text containers on language change
Fix text containers rendering broken text after the language is changed, as this cleared the glyph atlas without clearing the references to the glyph positions in the text containers. Now `OnWindowResize` is also called on language change to reset all text containers.

However, the glyph atlas is not cleared on normal window resize anymore, because this seems to be unnecessary.
2023-08-14 23:04:55 +02:00
Samuele Radici 0570465274 . 2023-08-14 17:21:03 +00:00
Samuele Radici 3ab4c52dd8
Update gameclient.cpp
I fixed the camera, when you were in multiview and you exited the pause mode the camera remained so dezoomed
2023-08-14 14:57:08 +02:00
Edgar 21d358434f
Merge pull request #7014 from Marmare314/mapview
Add CEditorComponent to moduralize editor
2023-08-14 08:44:31 +00:00
marmare314 77e36c5062 change interface and fix scalelength 2023-08-14 10:12:06 +02:00
marmare314 a46f320d24 remove unnecessary include 2023-08-14 09:03:03 +02:00
marmare314 7925f9fd45 format 2023-08-14 08:59:01 +02:00
marmare314 72b0fbfada format 2023-08-14 08:53:59 +02:00
marmare314 2bcfbae841 Add CEditorComponent to moduralize editor
Refactor CSmoothZoom and introduce CMapView
2023-08-14 08:36:02 +02:00
Possseidon 07e9c5a684 Allow automatic multi-view for players in a team 2023-08-13 15:38:36 +02:00
Dennis Felsing 255092ff92
Merge pull request #7003 from Robyt3/Scoreworker-Query-Size-Fix
Increase another SQL query buffer size
2023-08-12 21:24:07 +00:00
Dennis Felsing 84c6cf2333
Merge pull request #7004 from Vy0x2/pr-poc-mv-clean
Fix smooth zoom with zero causing problems with multiview
2023-08-12 21:20:06 +00:00
Robert Müller defd8f7c96 Increase another SQL query buffer size
The `INSERT INTO` query could be truncated when using a longer table name prefix.
2023-08-12 19:42:05 +02:00
Samuele Radici 5e1ef437d8
Update connection_pool.cpp 2023-08-12 18:40:33 +02:00
devdenn 9db53bd7a0 Fix smooth zoom with zero causing problems with multiview 2023-08-12 18:07:47 +02:00
Dennis Felsing 26f08a1903 Version 17.2 2023-08-12 16:43:37 +02:00
Robert Müller 0196470e01 Fix SQL query buffer sizes being too small
In `LoadPlayerData` exactly the `LIMIT 1` clause was getting truncated from the query due to the buffer size being insufficient. Depending on the length of the table name prefix the query could have been truncated at any other position resulting in syntax errors.

In `ShowTeamTop5` the buffer size is increased because it could cause truncation with a longer than default table name prefix.
2023-08-11 17:20:45 +02:00
Robert Müller 29871fd5f6 Fix scoreboard time being reset when using /timecp
Using `/timecp` with a player name that has no time on the current map incorrectly cleared the player score/time causing it to not be shown in the scoreboard anymore.
2023-08-11 16:41:42 +02:00
Edgar 984eb47c87
Merge pull request #6995 from Vy0x2/pr-poc-mv-clean
Increase lower limit for zoom smoothness (multiview), fixes #6981
2023-08-11 11:48:37 +00:00
Dennis Felsing 8eab94bcac
Merge pull request #6992 from Marmare314/selection-order-bug
Switch order in which envelope points are selected
2023-08-10 20:22:53 +00:00
Dennis Felsing 7f636329b2
Merge pull request #6993 from Marmare314/hidden-channel-bug
Ignore hidden channels when selecting envelopes
2023-08-10 20:22:07 +00:00
devdenn 9eb73c9990 Increase lower limit for zoom smoothness (multiview), remove rarely used variable 2023-08-10 20:09:43 +02:00
marmare314 93332af243 Disallow adding overlapping envelope points
Also now round is used to convert the mouse position to fixed
precision time which places the added point closer to the mouse position.
2023-08-10 08:38:10 +02:00
marmare314 3d400b13b5 Ignore hidden channels when selecting envelopes
When two envelope points overlap it can happen that the hidden
one will be marked as hot. Then neither can be selected.
2023-08-10 08:27:17 +02:00
marmare314 e1931d216a Switch order in which envelope points are selected
When multiple envelope points could be selected, switch the order
such that the one that is visible is selected first.
2023-08-10 08:16:15 +02:00
Dennis Felsing 2ea102ac9f
Merge pull request #6984 from Robyt3/Settings-Controls-Localizable
Use `Localizable` instead of `Localize` inside comment
2023-08-08 21:18:13 +00:00
Robert Müller bfb64a47e6 Improve dbg_tuning, refactor CDebugHud::RenderTuning
Use different colors to highlight tuning parameters when using `dbg_tuning`:
- red: value changed globally
- blue: value changed only in current zone
- green: value changed globally but reset to default by tune zone
- grey: value unchanged globally and in current zone

In addition to this, with `dbg_tuning 1` the unchanged parameters and the velramp graphs are not shown anymore. With `dbg_tuning 2` all parameters and graphs are shown as it was previously the case with `dbg_tuning 1`.

The position of the debug information is adjusted so it overlaps less with the HUD. When many tuning parameters are shown, the parameters now wrap to another column instead of extending beyond the height of the screen.

Headers are also added to each column.
2023-08-08 21:16:17 +02:00
Robert Müller 738187d94e Refactor CDebugHud::RenderNetCorrections, improve layout
Also show current tune zone.

Show value on every line instead of having some lines without a value.

Improve labels.

Reduce duplicate code and improve readability.
2023-08-08 20:31:48 +02:00
Robert Müller 51e1f9d88f Refactor CDebugHud::RenderHint
Replace magic numbers with constants.
2023-08-08 20:31:48 +02:00
Robert Müller 30d3d4f94c Rename GetTunes to GetTuning and return const pointer
No need to copy all tuning parameters. Consistent naming with prediction code where `GetTuning` is also used.
2023-08-08 20:31:48 +02:00
Robert Müller b98d519744 Use textrender for graphs, refactor CGraph::Render
Use textrender for rendering debug graph labels instead of using the debugging font and quad text.
2023-08-08 20:31:47 +02:00
Robert Müller be83d44470 Refactor CClient::DebugRender
Fix names of static variables. Remove dead code.
2023-08-08 20:31:47 +02:00
Robert Müller 262196bd2c Use Localizable instead of Localize inside comment 2023-08-08 20:26:56 +02:00
Edgar 43d3d6a876
avoid nullptr checks by initializing the pointers 2023-08-08 16:47:49 +02:00
Edgar 8d4f468edd
fix too long console commands not rendering help 2023-08-08 16:42:24 +02:00
Edgar 8d930dc8c7
Merge pull request #6980 from Robyt3/TextRender-Face-Uninitialized
Fix textrender variables being uninitialized
2023-08-07 19:09:33 +00:00
Robert Müller 0e161cf4d9 Fix textrender variables being uninitialized
Regression from #6952.
2023-08-07 17:53:54 +02:00
Edgar 50938a8a58
don't send empty chat messages 2023-08-07 17:07:12 +02:00
Zwelf 18dff9ef46 Fix /load from backup database
Saves were deleted without the team getting its state when /load and
/save both happened during mysql server not reachable.

Before this fix, the saves were only in the DDNet log output for
recovery, not in any database anymore.

`Write::BACKUP_FIRST` is 0 so always false, so the previous code
didn't harm other code paths (especially `Write::NORMAL`).
The saves were tried to retrieve two times from the database, therefore
at the second time it didn't exist anymore. One time erroneously in
`Write::BACKUP_FIRST` and the second time in `Write::NORMAL_FAILED`.

Fixes #6924
2023-08-07 15:35:39 +02:00
Robert Müller c4dcdad5cc Fix crash when using goto_tele in map without tele layer
The check for `goto_switch` is added for completeness but not strictly necessary, as this is also checked in `GetSwitchNumber`.
2023-08-06 23:41:15 +02:00
Dennis Felsing 42e16747a5
Merge pull request #6972 from Robyt3/Client-Vote-Option-Crash-Fix
Fix client crash with more than `MAX_VOTE_OPTIONS` vote options
2023-08-06 16:36:17 +00:00
Robert Müller 2ea82730ae Fix client crash with more than MAX_VOTE_OPTIONS vote options
The server does not allow adding more than `MAX_VOTE_OPTIONS` vote options, so the client will now also refuse to add more options than that.

Supersedes #6930.
2023-08-06 17:07:06 +02:00
ChillerDragon c5a4447fde Fix redirect release version
See #6969 (hihi)
2023-08-06 16:01:27 +02:00
Dennis Felsing 648d975571
Merge pull request #6937 from Robyt3/Base-Windows-File-HANDLE
Rework base IO functions on Windows using `HANDLE`
2023-08-06 12:11:13 +00:00
Robert Müller 75a368f552 Improve text rendering texture atlas utilization and performance
Replace skyline-based texture atlas algorithm with a rectangle packing algorithm that tracks empty atlas sections using `std::vector`s. The algorithm is very loosely inspired by https://github.com/TeamHypersomnia/rectpack2D.

Increases texture atlas utilization from ~70% to ~90-94%, i.e. less space in the atlas is unused.

Decreases the computational time to find suitable free regions in the atlas by factor 40x-164x (depending on atlas dimension and utilization). In absolute numbers, the computational time necessary for a glyph being added to the atlas is decreased from 0.0556ms-0.4679ms to 0.0013ms-0.0051ms (depending on atlas dimension and utilization).

The memory usage for the texture atlas algorithm increases from a maximum of ~128 KB to a maximum of ~3 MB.
2023-08-05 22:28:53 +02:00
Edgar 8c49c2ea4b
Merge pull request #6952 from Robyt3/TextRender-Font-Index-File
Add font index, support font family variants depending on language
2023-08-05 15:49:12 +00:00
Robert Müller 92dc3d4a0f Fix emotes sometimes being shown for others tees
The `Translate` function modifies the first argument, so the client ID keeps changing when the function is being used in a loop. Additionally, calling `Translate` manually is not necessary for messages, as client IDs in messages are already automatically translated when using `SendPackMsg`. Both faults can cause emoticons to appear on the wrong players when the emote spamprotection limits emotes to nearby players.
2023-08-05 15:54:04 +02:00
heinrich5991 8fc5549306
Merge pull request #6876 from ChillerDragon/pr_new_connection_string
Support master server address format in client
2023-08-05 08:49:12 +00:00
ChillerDragon f701e2eb16 Support master server address format in client
This still works

	$ ./DDNet "connect 127.0.0.1"

But now also this works

	$ ./DDNet "connect tw-0.6+udp://ger10.ddnet.org:8303"
	2023-07-16 14:07:50 I engine: running on unix-linux-amd64
	2023-07-16 14:07:50 I client: starting...
	2023-07-16 14:07:50 I client: version 17.1.1 on linux amd64
	2023-07-16 14:07:50 I client: git revision hash: 7f100e2620
	2023-07-16 14:07:50 I client: connecting to 'tw-0.6+udp://ger10.ddnet.org:8303'
	2023-07-16 14:07:50 I host_lookup: host='ger10.ddnet.org' port=8303 3
	2023-07-16 14:07:51 I client: connected, sending info
2023-08-04 12:32:02 +02:00
Robert Müller 43739ea9aa When quitting/restarting client clear screen and render message
When quitting or restarting the client, clear the screen and render a message "Quitting. Please wait…" or "Restarting. Please wait…" respectively.

Previously the last frame would keep getting shown while the client is busy with cleanup tasks. Rendering a final message before the client window stops being updated provides a cleaner user experience.
2023-08-03 17:24:09 +02:00
heinrich5991 26cd03bca1
Merge pull request #6914 from ChillerDragon/pr_redirect
Allow server to redirect clients
2023-08-03 09:19:26 +00:00
Robert Müller d642abd722 Add font index, support font family variants depending on language
Add `fonts/index.json` which specifies:

- List of all font files that should be loaded (filenames).
- Default font (specified by family name or by family and style name).
- Font variants for different languages, using the name of the language file as key.
- Fallback fonts.
- Icon font.

There are characters (e.g. all in `刃直海角骨入`) that look different depending on the language of the content being Japanese, Simplified Chinese, Traditional Chinese and Hangul, because Unicode uses the same codepoint for characters regardless of the language. To render these characters correctly, the active variant font is switched depending on the selected language.

The `ITextRender` interface is changed so the current language variant can be set using `SetFontLanguageVariant` and the default and icon fonts can be toggled using `SetFontPreset`. The class `CFont` is removed entirely.

The text render is restructured: The font faces and font atlas are now managed by a separate class `CGlyphMap` like on upstream. As the text fill and outline textures always have the same size, the texture skyline only needs to be stored once and free positions in the atlas only need to be calculated once for each glyph instead of separately for the fill and outline textures.

The font files and their licenses are also updated:

- Update Source Han Sans to version 2.001.
- Update Glow Sans Japanese Compressed to version 0.93.
- Update Deja Vu Sans to version 2.37.
- Update Font Awesome icons font to March 2023 version.

Closes #6881.
2023-08-01 19:30:25 +02:00
heinrich5991 406bc261fb
Merge pull request #6958 from Zwelf/pr-fix-crash-dnsbl
Fix stack overflow in destructor when dnsbl object is kept too long alive
2023-08-01 09:40:04 +00:00
Edgar 27e846f8db
Merge pull request #5434 from heinrich5991/pr_ddnet_loglevels
Add separate log levels for each output
2023-08-01 09:20:06 +00:00
Zwelf d682d24eb5 Fix stack overflow in destructor when dnsbl object is kept too long alive
`shared_ptr`s of `CServer::m_pDnsblLookup[ClientID]` are set, but not
cleaned up when done. Therefore the Job is kept alive until the player
disconnects and a new player joins on that slot. Currently this means
that the full linked list of jobs is kept alive.

When the Job is overwritten with a new job, all the remaining objects in
the list can be dropped. With enough jobs, that is causing a stack
overflow in the destructor.

This patch fixes this overflow by making the lifetime independent of the
previous Job. Jobs can get dropped after processing them, even when the
previous job is still alive.

Fixes #6954
2023-08-01 11:14:53 +02:00
Edgar b909cfadd8
Merge pull request #6943 from Robyt3/Editor-shared_ptr-Refactoring
Use `std::shared_ptr` for editor resources, fix crashes with brush
2023-08-01 09:13:59 +00:00
heinrich5991 c5e27b283b Delete fishy-looking assignment operator/copy constructor of IJob
Since they're not called anyway, they can go away.
2023-08-01 09:45:15 +02:00
devdenn 4ea46f2df9 Fix malformed lines in some translation files 2023-07-29 19:13:24 +02:00
Robert Müller 88bb44ac93
Merge pull request #6944 from Marmare314/boxselect-envelopes
add box selection to envelope editor
2023-07-29 13:47:38 +00:00
marmare314 93e95bbd38 add box selection to envelope editor 2023-07-29 15:10:14 +02:00
Robert Müller 3b273500c5
Merge pull request #6942 from heinrich5991/pr_ddnet_game_settings_cleanup
ResetServerGameSettings → ResetGameSettings, remove flag argument
2023-07-29 08:48:05 +00:00
Robert Müller 6f03aabb34 Use std::shared_ptr for editor resources, fix crashes with brush
Simplify memory management of groups, layers, images, sounds and envelopes by using `std::shared_ptr` for all of them.

Clear brush when creating a new map to prevent crash due to unloaded textures being used in tile layer. Closes #6935.

Also fix crash when restoring a saved brush after removing an image that is being used by it.
2023-07-28 21:17:19 +02:00
marmare314 862c0ca2fc make point hitbox bigger 2023-07-28 17:47:28 +02:00
Robert Müller 5b10547aec
Merge pull request #6916 from Vy0x2/pr-poc-mv-clean
Minor improvements to Multi-View
2023-07-28 15:00:42 +00:00
Robert Müller ef5ffedee6 Rework base IO functions on Windows using HANDLE
Switch to using the Windows-specific `HANDLE` and Windows API functions instead of `FILE *` and standard library functions in all Windows IO function implementations.

Using `CreateFileW` instead of `_wfsopen` to open files is necessary, as only `CreateFileW` allows specifying all necessary sharing flags. The sharing flags `FILE_SHARE_READ` and `FILE_SHARE_WRITE` were previously already specified by using `_SH_DENYNO` with `_wfsopen`, but `FILE_SHARE_DELETE` can only be set when using `CreateFileW`. The flags are necessary so files which are in use by the game can still be opened by other processes. In particular, `FILE_SHARE_DELETE` allows deleting/renaming of open files, which was previously not possible. This was causing the smart editor saving process that renames files to fail if a map file is currently in use.

Because `CreateFileW` returns a `HANDLE` instead of a `FILE *` we have to use the `HANDLE`-based Windows IO functions everywhere.

See: https://devblogs.microsoft.com/oldnewthing/20211022-00/?p=105822

Closes #6922.
2023-07-28 16:55:47 +02:00
Robert Müller 88cf4c4ccb
Merge pull request #6923 from Marmare314/envelope_grid
Add grid to envelope editor
2023-07-28 14:42:53 +00:00
devdenn 1c231a0dbd Minor improvements to Multi-View
Dont save the Multi-View variables
Multi-View can not longer be activated again after already active
Fix cl_multiview_use_freeview variable config
Players who killed will be removed from Multi-View even if the spec mode is not active
Multi-View personal zoom will be reseted when enabling Multi-View
Fix bug where a kill in a team will be taken into account
Improve the solo player experience in Multi-View
2023-07-28 16:34:35 +02:00
marmare314 babdbc4b17 add grid to envelope editor 2023-07-28 16:18:56 +02:00
heinrich5991 a94b5c35bf ResetServerGameSettings → ResetGameSettings, remove flag argument
The old code looked pretty weird. It checked for `CFGFLAG_SERVER |
CFGFLAG_GAME` being set above, and then used the passed-in parameter to
find the command. I think it'd be better to just look for `CFGFLAG_GAME`
and then find the command using `CFGFLAG_GAME`.
2023-07-28 16:12:21 +02:00
heinrich5991 03fd1b440b
Merge pull request #5398 from AssassinTee/feature/elasticity-tuning
implement tuning values for elasticity
2023-07-28 13:58:42 +00:00
Marvin Winkens e1ba77d3dc implement tuning values for elasticity
implement tuning values for elasticity

add grounded check to movebox and give jump back when bouncing

fix styling issues

fix jumps being given back at ceilings
2023-07-28 15:35:45 +02:00
Robert Müller b33c9ca977
Merge pull request #6934 from Marmare314/zoom-reset-big-values
handle big value ranges on envelope zoom reset
2023-07-28 13:25:46 +00:00
Robert Müller c2379591e0
Merge pull request #6941 from Marmare314/zoom-adaption
improve offset adaption for envelope zoom
2023-07-28 12:16:56 +00:00
heinrich5991 8b0f317aa0
Merge pull request #6939 from Robyt3/Datafile-Data-Decompress-Check
Check for errors when reading and decompressing datafile data
2023-07-28 11:38:32 +00:00
Robert Müller 7069d74beb Check for errors when reading and decompressing datafile data
Check if datafile data cannot be read entirely (according to the data size specified in the header) and check for decompression errors. In case of errors, let `GetData` return `nullptr` and `GetDataSize` return `0` for the respective index.

Internally the decompressed size is set to `-1` for data which failed to load, so loading of those data will not be attempted again because it would only fail again and can cause additional log messages.
2023-07-28 13:19:40 +02:00
Robert Müller 8b209f036e
Merge pull request #6872 from Marmare314/envelope_contextmenu
Multiple selection in envelope editor
2023-07-28 11:11:02 +00:00
marmare314 f3353e8062 improve offset adaption for envelope zoom
The offset adaption was not correct. Close to the origin it was not really noticeable,
but further away the points shifted offscreen when zooming.
2023-07-28 12:50:12 +02:00
marmare314 62ee646283 allow multiple selection in envelope editor 2023-07-28 12:41:25 +02:00
heinrich5991 564a5958e1
Merge pull request #6940 from Robyt3/Graphics-Rect-Remove-Inverted-Corners
Remove inverted round rectangle corner drawing
2023-07-28 10:24:43 +00:00
Robert Müller c695fd750e Remove inverted round rectangle corner drawing
Rectangles with inverted round corners (`IGraphics::CORNER_I*`) are currently not used anywhere and also only supported when using `Draw4`.

They also feel clunky to use due to the inverted corners being drawn outside of the specified rectangle area.
2023-07-27 23:29:37 +02:00
Robert Müller 4233574085 Fix leak of map data when extracting map from demo fails 2023-07-27 21:27:39 +02:00
Robert Müller fd13ae5fd5
Merge pull request #6928 from sjrc6/pr-fix-gamesettings-crash
Fix client crash in ResetServerGameSettings
2023-07-27 18:45:41 +00:00
Tater 6bb2696c8b Fix crash in ResetServerGameSettings 2023-07-27 13:26:11 -05:00
marmare314 d964a3d327 handle big value ranges on envelope zoom reset 2023-07-27 19:47:06 +02:00
marmare314 873a8543df calculate zoom factor correctly for target zoom 2023-07-27 18:36:58 +02:00
ChillerDragon e3afe0dba4 Allow server to redirect clients
This is a preperation for #6754 (redirect players on map vote)
And an implementation of #5662 (redirect players)
2023-07-27 11:30:11 +02:00
Robert Müller 22bd19be06
Merge pull request #6920 from Marmare314/layer-drag-bug
reset layer dragging status if no buttons were pressed
2023-07-26 09:01:38 +00:00
marmare314 be861664bc reset layer dragging status if no buttons were pressed 2023-07-26 09:34:36 +02:00
marmare314 3010633099 improve envelope y offset on reset for small value ranges 2023-07-26 00:10:15 +02:00
Robert Müller 71500fd60c Improve server settings editor and status bar
Use icons for all server settings buttons. Rearrange and group buttons.

Show buttons in disabled state when they are not useable instead of hiding them.

Remove checker background from server settings list.

Overhaul hotkeys, also show hotkeys in the tooltips:
- Enter: add command
- Alt+Enter: update command (previously M)
- Alt+Up/Down: move command up/down (previously no hotkey)
- Delete: delete command

Don't activate command lineinput when selecting, moving or deleting elements, as this prevents the listbox from accepting the delete hotkey.

Fix server settings listbox being active while file dialog is open.

Ensure extra editor dragbar area matches the respective toolbar size.

Remove spacing on the left side of extra editors to improve alignment.

Increase status bar button sizes and make them consistent.

Use `enum` to track active extra editor instead of using multiple `bool`s.

Disable extra editor buttons when tile picker is shown, as the extra editors are not rendered in this case.
2023-07-25 21:21:54 +02:00
Robert Müller 177f7485c2 Render editor status bar except tooltip behind popups
So that buttons in the status bar cannot be used while a popup or the file dialog is open.

The tooltip still has to be rendered after popup menus, as popup menus can set the tooltip, which would otherwise not be shown.
2023-07-25 20:17:36 +02:00
Robert Müller b412153341 Ignore listbox hotkeys when modifier, shift or alt pressed
So other components can use these combinations together with a listbox.
2023-07-25 20:17:36 +02:00
Robert Müller d8c05115c9 Add constructor for CSetting and use emplace_back 2023-07-25 20:17:27 +02:00
Robert Müller 880dab7e69 Port JSON writer from upstream
Port the `CJsonWriter` utility class from upstream, which makes outputting correct JSON easier.

Add `CJsonWriter` as an abstract class that can write to different outputs. Two implementations `CJsonFileWriter` (writes to a file) and `CJsonStringWriter` (writes to an `std::string`) are added. Upstream `CJsonWriter` can only write to files.

The same tests are added for both implementations. Duplicate code is avoided by using typed tests with two separate test fixtures.
2023-07-25 15:05:25 +02:00
Robert Müller 31737d81e7 Fix test filenames when using typed tests
Typed tests have test names like "TestName/0" and "TestName/1", which would result in invalid filenames. Replace the string after the first slash with the name of the typed test and use hyphen instead of slash.
2023-07-25 15:05:25 +02:00
heinrich5991 ec55e2ff90 test: Make it easier to generate multiple temporary filenames 2023-07-25 15:05:24 +02:00
Tater 4fe7aaa43f execute CFGFLAG_GAME configs on the client 2023-07-24 19:15:29 -05:00
marmare314 d4110529e4 implement zoom and drag in envelope editor 2023-07-24 22:58:26 +02:00
heinrich5991 4f103d5a4c Revert "Allow server to redirect clients"
Discussion wasn't finished:
https://github.com/ddnet/ddnet/pull/6757#issuecomment-1648565562.

This reverts commit 9d2f4318d5.
2023-07-24 22:51:27 +02:00
heinrich5991 85566fbe92 Add separate log levels for each output
`stdout_output_level` for printing to stdout, `console_output_level` for
printing to local console and remote console and `loglevel` for the log
file.

Keep the old log level filters 0 for info and more severe, 1 for debug
and more severe and 2 for trace and more severe, introducing -1 for
warn, and -2 for error. -3 will show no log messages at all.
2023-07-24 22:43:05 +02:00
heinrich5991 e432dbb750
Merge pull request #6757 from ChillerDragon/pr_redirect
Allow server to redirect clients
2023-07-24 20:21:21 +00:00
heinrich5991 e6725a9668
Merge pull request #6907 from Robyt3/Editor-File-Save-Default-Value
Set default name when saving map under new name or as copy
2023-07-24 19:01:12 +00:00
Robert Müller 566324c1f8 Fix "Multiplication result converted to larger type" alerts
Introduced by #6899.
2023-07-24 20:06:08 +02:00