Commit graph

14984 commits

Author SHA1 Message Date
Robert Müller 908ebc65ee Remove Spectate label from HUD, show Following {player} instead 2024-06-18 21:49:06 +02:00
Robert Müller 6df4ff3a44 Move CGameConsole::Dump function to CGameConsole::CInstance
Avoid the `int Type` parameter by making `CGameConsole::Dump` a member function of `CGameConsole::CInstance`.

Use `log_*` functions instead of `IConsole` for logging.
2024-06-17 22:36:25 +02:00
meloƞ b05620d1eb update practice help text 2024-06-15 04:14:53 +02:00
Robert Müller 4852dc435d Move double-click handling from engine input to UI
Instead of relying on SDL to determine when a click is a double-click, implement double-click handling specifically for the UI, as double-clicks are only supposed to be used there. This allows us to ensure that double-clicks only activate UI elements if both clicks were performed on the same UI element. Previously, only the position of the second click was considered, so UI element would incorrectly activate when double-clicking close to them as long as the second click starts and ends on them.

Implementing double-clicking handling separately is also necessary to support double-clicking in the UI with touch events, as SDL does not provide the double-click information for touch events.

The newly added `CUi::DoDoubleClickLogic` function should be called after a UI element has been clicked. It will return `true` if the current click should be interpreted as a double-click, i.e. if the same UI element was clicked, the click was within 0.5 seconds of the previous click (the default duration for SDL and Windows) and the distance from the previous click is within 32 screen pixels (the default distance for SDL).
2024-06-14 23:34:38 +02:00
Robert Müller 264df1f035 Improve envelope editor double-click handling
Only handle the double-click on the envelope editor when the second click is released instead of when it is pressed down already.

Remove unnecessary UI element `s_BoxSelectId`, the temporary activation of which was causing the tooltip to be missing for one frame when clicking the envelope editor.
2024-06-14 23:24:23 +02:00
Jupeyy f061dfdc84
Merge pull request #8480 from TylerStocks1/master
Readd is not a word, Reload makes more sense and is easier readablility.
2024-06-14 12:44:04 +00:00
Dennis Felsing ec42dea161 Version 18.3 2024-06-14 13:09:57 +08:00
Dennis Felsing b422c3cb26
Merge pull request #8486 from Robyt3/Server-Tile-Handling-Fix
Fix tiles being handled in same tick for dead tees in some cases
2024-06-14 04:31:51 +00:00
Tyler Stocks 249c8572ae
Update popups.cpp 2024-06-14 01:04:19 +01:00
Robert Müller cf6296c170
Merge pull request #8350 from ChillerDragon/pr_fix_button_overlap_teams
Fix in game menu buttons overlapping on team based gametypes
2024-06-13 19:58:47 +00:00
Robert Müller fbb2243a05 Fix tiles being handled in same tick for dead tees in some cases
The `CGameControllerDDRace::HandleCharacterTiles` function can kill the tee if the conditions for starting the race are not satisfied when touching a start tile. In this case, no further tiles should be handled in the `CCharacter::HandleTiles` function, else the effects of those tiles being handled may incorrectly be applied after the tee has respawned.
2024-06-13 21:26:03 +02:00
ChillerDragon 9a29c029a5 Fix in game menu buttons overlapping on team based gametypes
The ddnet buttons kill and pause do not fit in anymore if there is also
a join red/blue button.

This commit fixes that by hiding the buttons if
there is not enough space anymore.

Related prior work https://github.com/ddnet/ddnet/pull/2720
2024-06-13 09:34:16 +08:00
Dennis Felsing 0a243eea94
Merge pull request #8482 from Robyt3/UI-AntiStatic
Fix UI issues when switching between menus and editor
2024-06-12 01:30:26 +00:00
Robert Müller 71b3c8a35b Force default char to be signed on all architectures
We assume that `char` is `signed` in various places in the code. In particular, the `Str.StrToInts` test will fail when `char` is not `signed` and names containing special characters will be displayed incorrectly on servers.

Therefore, the compiler flag `-fsigned-char` is set unconditionally instead of only for ARM and ARM64, as we expect `char` to be `signed` on all architectures.

A static assertion is added to ensure at compile time that `char` is `signed` independently from the flag added in `CMakeLists.txt`.

This is necessary at least for ARM, ARM64, PPC, PPC64, and PPC64LE. According to some sources, `char` may also be `unsigned` by default when compiling for Android, although this could not be confirmed with the current Android NDK using Clang.

For the PowerPC architectures, Compiler Explorer can be used to confirm that `char` is not `signed` by default by checking whether the static assertion compiles (see https://godbolt.org/z/9rn5Mrf59) and that the assembly is different with the `-fsigned-char` flag (see https://godbolt.org/z/138zTj3Wa).

Closes #8386.
2024-06-11 23:37:46 +02:00
Robert Müller 7e9769c2c7 Fix UI issues when switching between menus and editor
Fix button logic being stuck when holding mouse button on UI elements with button logic in the menus/editor, switching between menus and editor with Ctrl+Shift+E, then using a UI element with button logic in the editor/menus and switching back.

Fix value selector text mode of color picker popups being deactivated when switching between menus and editor while the color picker popup is open in both.

Only update progress spinners once per frame in `CUi::Update` to ensure consistent rotation speed. Progress spinners in menus and editor now rotate independently.

In general, all `static` non-`const` variables in `CUi` are replaced with member variables, as the `static` variables are shared between the two `CUi` instances of the menus and the editor, causing the above issues.
2024-06-11 20:21:25 +02:00
Tyler Stocks 544f564044 Changed var name to match 2024-06-10 23:08:06 +01:00
Tyler Stocks c451289254 Readd is not a word, I think it meant re-add but Reload better fits its usecase 2024-06-10 21:25:07 +01:00
Robert Müller cef994d688 Fix demo seekbar tooltip not showing correct hovered time
Regression from #8318.
2024-06-10 18:44:08 +02:00
Robert Müller da25863cd2 Fix percentage not being used for console command progress spinner
The percentage of received console commands was not being shown with the progress spinner because the variable `ProgressProps` was not passed to the `RenderProgressSpinner` function.
2024-06-09 21:29:56 +02:00
archimede67 7741309ad8
Merge pull request #8447 from Robyt3/UI-ValueSelector-Consistency-DoubleClick
Consistent value selector behavior, support double-clicking
2024-06-09 11:52:22 +00:00
Emilcha 24ea8d8977 Consistancy, #8468 2024-06-08 19:28:06 +02:00
Emilcha 13fea24da3 Sort Compare Not Case Sensitive 2024-06-08 16:57:33 +02:00
Dennis Felsing 5a09da0782
Merge pull request #8465 from Robyt3/Client-Localize-Context-Fix
Fix wrong context value being used for translation lookup
2024-06-08 10:59:56 +00:00
Robert Müller f5de30ee88 Fix wrong context value being used for translation lookup
The trailing `]` was not being removed from the context anymore due to an off-by-one error introduced in #8430. Closes #8464.
2024-06-08 12:42:03 +02:00
Dennis Felsing 62f0849ca7 Update credits 2024-06-08 10:11:03 +08:00
Robert Müller fa58909dfe
Merge pull request #8459 from def-/pr-time-cp-diff
Add cl_showhud_time_cp_diff
2024-06-07 17:35:45 +00:00
Dennis Felsing 112e34fefe Add cl_showhud_time_cp_diff 2024-06-08 00:31:08 +08:00
Robert Müller 989a3765f7
Merge pull request #8342 from ChillerDragon/pr_multiview_pvp
Keep respawned players in multi view list on pvp servers
2024-06-06 20:49:43 +00:00
Robert Müller f494826dcf
Merge pull request #8154 from ChillerDragon/pr_worst_style_offenders
Fix worst local variable style offenses
2024-06-06 20:18:19 +00:00
Robert Müller ef7bebc73e Remove CUi::MouseButtonReleased function
Replace the last remaining usage of the `CUi::MouseButtonReleased` function with `!MouseButton(...)`. The `pMouseSelection->m_Selecting` flag is only set to `true` when the mouse button is already pressed down, so the additional check of `MouseButtonReleased` is unnecessary in this case. In general, this function is an anti-pattern in our UI, as only checking for the mouse button to be released does not guarantee that the mouse was also pressed down over the respective UI element. The `DoButtonLogic` function or similar code should be used instead of only handling the press or release of a mouse button.
2024-06-06 21:41:50 +02:00
Robert Müller 3bb60267f9 Consistent value selector behavior, support double-clicking
Make value selector behavior consistent with the generic button logic. Consistently check for completed mouse clicks on the value selector UI element instead of handling some mouse down and mouse up events separately. Fix text mode being activated when moving the mouse over value selectors with held down mouse button. Fix text mode being deactivated immediately when the mouse leaves text area while holding down the mouse button, which is inconvenient when selecting text. Remove unnecessary usage of `CUi::MouseButtonReleased` function.

Support double-clicking value selectors to enter text edit mode in addition to right-clicking. This feels more intuitive to use and also makes it usable without a second mouse button.

Select all text when entering text mode also in the editor, which was previously only a feature in the menus.

Fix value selector edit state being `EDITING` by default instead of `NONE` in the editor and fix maps being marked as modified immediately when a value selector text input is activated. The map will now be marked as modified only when the editing operation is completed, which should be synchonized with the undo history action being added.

Use the `CUi::ConsumeHotkey` function instead of checking the enter keys manually.

Remove unnecessary and unused `CUi::m_ValueSelectorTextMode` variable and its accessors as well as the equivalent `s_TextMode` variable in the editor. This separate flag is unnecessary as we can use the existing `s_pLastTextId` variable instead.
2024-06-06 21:41:50 +02:00
Dennis Felsing 85888c3aa3
Merge pull request #8456 from Robyt3/Editor-UI-MouseHandling
Unify editor UI mouse handling with `CUi`
2024-06-06 04:22:00 +00:00
archimede67 80228caddd
Merge pull request #8457 from Robyt3/Client-Warning-Button-Localize
Fix Ok-button of warning popup not being localized
2024-06-05 20:07:10 +00:00
Robert Müller f8e84216fc Fix Ok-button of warning popup not being localized 2024-06-05 21:48:52 +02:00
Robert Müller ca89162b06 Fix wrong file extension being removed in demo cut popup
The `.demo` extension is supposed to be removed from the target filename when slicing demos, but anything after the last dot was being removed instead, e.g. `test.abc.def` was incorrectly replaced with `test.abc`.
2024-06-05 21:11:50 +02:00
Robert Müller 60f3b5fb55 Unify editor UI mouse handling with CUi
Remove separate handling of UI mouse position and delta in the editor and use the UI directly for this like in the gameclient. Raw cursor movements are redirected to the UI with the `CUi::OnCursorMove` function. The editor separately updates its world positions and delta after the mouse position was changed. The mouse world position for the editor is passed to the UI with the `CUi::Update` funtion as before, whereas the world position is unused in the gameclient.

Use `vec2`s for mouse positions and deltas instead of two separate floats.
2024-06-05 20:13:42 +02:00
Learath e9d568db5b Fix console search highlighting. Close #8451 2024-06-05 18:01:42 +02:00
Robert Müller 0d9f673b03 Include types.h instead of system.h in input.h 2024-06-04 22:02:49 +02:00
Robert Müller 248225c7c4 Refactor client input event handling
Add `IInput::ConsumeEvents` function accepting a consumer `std::function` to replace the duplicate usage of the `IInput::NumEvents`, `IInput::GetEvent` and `IInput::IsEventValid` functions.

Use an `std::vector` to store the current input events to support any number of input events per client update instead of at most 32.

Use full `uint32_t` range for input counter instead of only using the range 0..0xFFFF. If the range is artificially reduced, then this can result in inputs being handled multiple times with high refresh rates, so the increased range should add future proofing for extremely fast devices.

Split `CInput::AddEvent` function into `CInput::AddKeyEvent` and `CInput::AddTextEvent` functions for readability and to make it easier to add additional input events (i.e. touch events).

Ensure double-click state is cleared at the end of each frame to prevent the double-click from being stored when no UI element consumes it.

Move member variables from `IInput` interface to `CInput` implementation.

Remove separate `CEditor::DispatchInputEvents` function.
2024-06-04 22:01:54 +02:00
Dennis Felsing 4f22468bf8
Merge pull request #8443 from Robyt3/Client-Controls-Minor-Refactoring
Minor refactoring of `CControls`
2024-06-04 02:46:49 +00:00
Robert Müller 4ec5b04a2e Use vec2 instead of two separate variables 2024-06-03 21:43:49 +02:00
Robert Müller 1fcb8a5469 Add GetMinMouseDistance function, remove variable MinDistance 2024-06-03 21:43:49 +02:00
Robert Müller 01be442280 Rename variable MDistance to MouseDistance 2024-06-03 21:43:49 +02:00
Robert Müller f94053bd66 Rename variable w to Weapon 2024-06-03 21:43:48 +02:00
Robert Müller 2904c4a2e8 Restructure input send checks without ifs 2024-06-03 21:43:48 +02:00
Andriy 950bbf31af
Make "Tee" tab name localisable 2024-06-03 22:24:31 +03:00
Robert Müller 178a0dabfa Remove dead code and unused variables 2024-06-03 20:55:39 +02:00
Robert Müller b7579b0f0f Ensure last input send time is reset when disconnecting
Reset send time when disconnecting so input sending should always behave consistently like on the first connection.
2024-06-03 20:54:57 +02:00
Robert Müller a7229e9892 Use array of size NUM_DUMMIES instead of two variables
Reduce duplicate code and improve clarity.

Remove unnecessary casts to `void *`.
2024-06-03 20:54:49 +02:00
Robert Müller 64f4ea1512
Merge pull request #7588 from ChillerDragon/pr_stop_demo_on_reset
Stop demo when gameworld is reset
2024-06-02 17:14:57 +00:00