Commit graph

13595 commits

Author SHA1 Message Date
Robert Müller 7fe854d861 Reduce indentation, rename variables in Mix function 2023-09-21 23:52:40 +02:00
Robert Müller 07e18ebecb Replace most global variables in engine sound with member variables
Most variables used in the sound engine were static globals, as they are used in the static sound mixing function. The global variables are replaced by member variables, by passing the sound interface as user-data for the SDL mixing callback. The `Mix` function is made a public member function of `ISound` instead of being exposed using `ISoundMixFunc GetSoundMixFunc()`.

This allows to remove the direct dependency of the engine sound on the engine video, by instead passing the sound mixing function as a lambda to the engine video in the engine client.

The old WavPack reader function interface does support passing a user-data pointer to the callback function, so global variables are still used here.
2023-09-21 23:52:13 +02:00
Robert Müller a2de08a8db Add UpdateVolume function, remove unnecessary lock usage
Using the lock is not necessary, as the volume is already an atomic variable.
2023-09-21 23:44:59 +02:00
Robert Müller beaf263f3d Reorder SetChannel and SetListenerPos functions 2023-09-21 23:44:58 +02:00
Robert Müller b0356aea13 Rename argument, reduce indentation of SetVoiceTimeOffset 2023-09-21 23:44:58 +02:00
Robert Müller f169ce1c8c Use nullptr instead of 0, 0x0 and NULL 2023-09-21 23:44:58 +02:00
furo f23e5ceb6f Correct value of TeamSize. 2023-09-21 23:15:42 +02:00
Dennis Felsing 2c8a798f3f
Merge pull request #7230 from furo321/practice-lasttp
Add /lasttp
2023-09-21 20:51:41 +00:00
furo a7ef9c7c6f Add /lasttp 2023-09-21 21:02:55 +02:00
furo 992a26c7ca Add ability to swap without a name when team only has 2 players. 2023-09-21 19:40:37 +02:00
Dennis Felsing 545852b7f1
Merge pull request #7224 from Robyt3/Demo-Hud-Intratick
Fix 1-tick delay of player position, speed, angle HUD
2023-09-20 22:45:51 +00:00
dobrykafe 7c710ddb96 add another value instead of new variable 2023-09-20 22:47:09 +02:00
Robert Müller cd37c2d5b3
Merge pull request #7223 from furo321/preview-only-friends
Chat preview respect cl_show_chat_friends
2023-09-20 19:56:21 +00:00
Robert Müller b7cbbb48be
Merge pull request #7222 from furo321/update-server-browser
Update server browser when adding friends from ingame.
2023-09-20 19:49:00 +00:00
Robert Müller ed9a95ac23 Fix 1-tick delay of player position, speed, angle HUD
Respect the intratick when displaying the player position, speed and angle, to fix this information always being shown for the next tick. See #6417. This does not resolve the issue yet, as there are more HUD and player elements that need to make use of the intratick.
2023-09-20 21:39:42 +02:00
furo 4e9556e3da Chat preview respect cl_show_chat_friends 2023-09-20 21:32:13 +02:00
Robert Müller cf0df5bc03 Use GameTickSpeed instead of 50 and SERVER_TICK_SPEED 2023-09-20 21:17:12 +02:00
furo 5a4e3b1c2d Update server browser when adding friends from ingame. 2023-09-20 18:32:34 +02:00
Dennis Felsing 4dda7949d1
Merge pull request #7221 from Robyt3/Serverbrowser-Filter-Background-Fix
Fix background color in ingame server browser filter tab
2023-09-20 16:22:46 +00:00
Robert Müller 23cb2ff8c8 Fix background color in ingame server browser filter tab
Make background color of the tab content consistent with the color of the tab bar.

Regression from #7190.
2023-09-20 17:52:42 +02:00
Dennis Felsing fb6f04e9dc
Merge pull request #7220 from Robyt3/UI-Label-Streamed-Fixes
Track UI elements separately for each server browser tab
2023-09-20 15:48:25 +00:00
Robert Müller da47ebe0b5 Track UI elements separately for each server browser tab
Fix highlighted text of server browser entries not being refresh correctly when switching tabs.

This also reduces lag when switching tabs, as the UI elements for all tabs are now cached and don't need to be recreated when switching.

Regression from #7203.
2023-09-20 17:23:34 +02:00
Robert Müller 5d4affac55 Fix text containers always being recreated for empty text
Because text containers are not created for empty text, it was being tried again every frame.
2023-09-20 17:22:16 +02:00
Robert Müller 2c7df07fd7
Merge pull request #7196 from furo321/add-optional-arguments
Add optional argument to movement commands
2023-09-20 15:04:54 +00:00
Robert Müller 61a9095fc3 Remove unused IServerBrowser::TYPE_NONE, add NUM_TYPES 2023-09-20 17:03:24 +02:00
Robert Müller 48671dc866 Remove unnecessary temporary variables 2023-09-20 17:03:24 +02:00
Dennis Felsing 60de0f191e
Merge pull request #7217 from furo321/gfx-screen-conchain
Add console chain for screen resolution commands.
2023-09-20 09:25:14 +00:00
furo 597350010f Add console chain for screen resolution commands. 2023-09-20 11:01:43 +02:00
trml b62754915a Add flag to ddnetlaser for enabling prediction, let server control starttick 2023-09-19 23:22:15 +02:00
Jupeyy fcbe429d4c Decrease descriptor pool's current size when descriptor is freed 2023-09-19 18:28:48 +02:00
Robert Müller ce65d57f2e Support dynamic list of "communities" in engine serverbrowser
Replace existing hard-coded support for two "networks" with support for a dynamic list of "communities" which are indexed by a string-ID, though right now the DDNet and KoG communities are still hard-coded. The communities now also support an arbitrary number of associated countries, types and servers. This is a refactoring to prepare for getting the list of communities dynamically from the server and removing the DDNet and KoG tabs from the serverbrowser.
2023-09-18 19:37:04 +02:00
Robert Müller 2973eee036 Refactor json parser usage in CServerInfo2::FromJsonRaw 2023-09-18 17:37:21 +02:00
Robert Müller ca1bec5bac Refactor json parser usage in CServerBrowser::LoadDDNetRanks 2023-09-18 17:37:15 +02:00
Robert Müller e82e197109 Use NUM_LOCS as static assertion for array size 2023-09-18 17:29:43 +02:00
Edgar c6f666bee2
Merge pull request #7209 from Robyt3/Server-Mutes-Maximum-Increase
Increase maximum number of mutes and vote mutes
2023-09-18 14:53:05 +00:00
Robert Müller ce8e47ee63 Increase maximum number of mutes and vote mutes 2023-09-18 16:22:51 +02:00
marmare314 3f21597b6c check if quadpoint is selected and not if quad is selected
fixes #7199 (partially?)
2023-09-18 10:24:16 +02:00
Dennis Felsing a706074c82
Merge pull request #7203 from Robyt3/Serverbrowser-Memory-Leak
Fix memory leak of server browser entry UI elements
2023-09-17 20:13:01 +00:00
Robert Müller 816f1a5a01 Fix memory leak of server browser entry UI elements
New UI elements were being created for every server info after refreshing the server list. At the same time, old UI elements were not being deleted when the server info objects are deleted. The use of `mutable` for this purpose was also rather unclean.

Now, a separate `std::vector` of UI elements is kept for all server browser entries, instead of associating the UI elements directly with the server info.
2023-09-17 21:37:36 +02:00
Robert Müller 8dfa0b2198 Rename UpdateFilteredPlayers, remove mutable variable 2023-09-17 21:37:32 +02:00
Robert Müller ca308cccd8
Merge pull request #7195 from def-/pr-password-128
Increase password size limit from 32 to 128
2023-09-17 15:56:11 +00:00
furo 107af9c902 Add optional argument tiles to movement commands
Add optional argument to movement and console page commands

Remove optional argument to console page commands
2023-09-17 17:19:40 +02:00
Dennis Felsing 971fa6d024
Merge pull request #7186 from infclass/for-ddnet2
CMake: Revert versioning (move it back to version.h)
2023-09-17 14:51:47 +00:00
Dennis Felsing e33b747a4c Increase password size limit from 32 to 128 2023-09-17 14:32:23 +02:00
Dennis Felsing de8d373215
Merge pull request #7194 from furo321/fix-swap
Fix everyones swap getting reset when someone swaps
2023-09-17 12:29:11 +00:00
furo 77840a9c97 Fix everyones swap getting reset when someone swaps 2023-09-17 13:49:52 +02:00
Dennis Felsing a598831361
Merge pull request #7190 from Robyt3/Browser-Layout-Overhaul
Overhaul server browser filter, details and friends tabs
2023-09-16 22:17:38 +00:00
furo 67e753bd6b Don't include .demo in demo slice input 2023-09-16 22:09:26 +02:00
Robert Müller 0b57d56f48 Overhaul server browser filter, details and friends tabs
Move the "Filter", "Info" and "Friends" tabs to the top, above the tab content. Use icons instead of text for the tabs. Use animator to animate the tabs on mouse-over. Closes #6613.

Make spacings, corners and font sizes used in the filter, details and friends tabs more consistent.

Remove some unnecessary dark UI rect backgrounds.

Improve alignment of the number of friends with the heart icon for entries in the server list.

Improve layout of countries and types filters. Make the filters scrollable when there are many entries.

Refactor most of the server browser in preparation for replacing the DDNet and KoG tabs with a community filter, which will work like the countries and types filters. Split rendering of different server browser sections into multiple functions to improve readability. Reduce duplicate code for the countries and types filters.
2023-09-16 13:45:52 +02:00
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
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