Commit graph

13539 commits

Author SHA1 Message Date
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
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
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
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