Commit graph

19988 commits

Author SHA1 Message Date
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
archimede67 abc7d05fca
Merge pull request #8455 from Robyt3/Client-Demo-Cut-Filename-Fix
Fix wrong file extension being removed in demo cut popup
2024-06-05 20:06:58 +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
Dennis Felsing 151956294d
Merge pull request #8454 from Learath2/dd_pr_fixsearchhilite
Fix console search highlighting. Close #8451
2024-06-05 16:20:53 +00:00
Learath e9d568db5b Fix console search highlighting. Close #8451 2024-06-05 18:01:42 +02:00
Dennis Felsing c7dc7b6a94
Merge pull request #8448 from EGYT5453/uapdte
Remake of Ukrainian l10n
2024-06-05 05:46:52 +00:00
Dennis Felsing 5eda5e9fe3
Merge pull request #8395 from Robyt3/Client-Input-Event-Refactoring
Refactor client input event handling
2024-06-05 05:26:23 +00:00
Andriy 97623c3002
Remake Ukrainian l10n 2024-06-04 23:28:45 +03: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
heinrich5991 82c2ecd91b
Merge pull request #8444 from EGYT5453/tee-tab-l10n
Make "Tee" tab name localisable
2024-06-03 21:10:33 +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
ChillerDragon 05d97cafb2 Stop demo when gameworld is reset
Currently the per tee demos are only stopped when a character dies.
But the Reset() method in the gameworld destroys characters without
killing them.

This allows to do world resets without calling gamecontext shutdown
while sv_player_demo_record is active. Which is nice for round based
game modes.

```C++
void CGameWorld::Reset()
{
	// reset all entities
	for(auto *pEnt : m_apFirstEntityTypes)
		for(; pEnt;)
		{
			m_pNextTraverseEntity = pEnt->m_pNextTypeEntity;
			pEnt->Reset();
			pEnt = m_pNextTraverseEntity;
		}
	RemoveEntities();

	GameServer()->m_pController->OnReset();
	RemoveEntities();

	m_ResetRequested = false;

	GameServer()->CreateAllEntities(false);
}
```
2024-06-02 21:35:05 +08:00
Dennis Felsing 19b704d600
Merge pull request #8433 from Robyt3/Scoreboard-Recording-Notification-Refactoring
Fix truncated scoreboard recording notification, refactoring
2024-06-02 11:30:53 +00:00
Dennis Felsing 9986eaf6e9
Merge pull request #8435 from Robyt3/Translations-Ellipsis-Consistency
Consistently use `…` instead of `...` in translations
2024-06-02 11:28:15 +00:00
Dennis Felsing 3ba9fee8a8
Merge pull request #8430 from Robyt3/Localization-Fixes
Fix language file being loaded twice when starting, improve error handling for invalid translation files
2024-06-02 11:20:59 +00:00
Dennis Felsing da0df30497
Merge pull request #8356 from furo321/split-practice-commands
Add `/practicecmdlist`
2024-06-02 11:19:06 +00:00
Dennis Felsing bcc7412847
Merge pull request #8406 from l-ouis/master
Add confetti particles on finish
2024-06-02 11:15:16 +00:00
Robert Müller 37abc9039a Consistently use instead of ... in translations 2024-06-02 12:57:15 +02:00
Robert Müller cc7d6c393d Fix truncated scoreboard recording notification, refactoring
With some languages the buffers for the scoreboard recording notification were not large enough when recording all 4 types of demos at the same time.

Reduce duplicate code. Avoid unnecessary, slow `str_format` for concatenation. Use UI functions for drawing the background and text.
2024-06-02 11:54:23 +02:00
Robert Müller bbf54ec625
Merge pull request #8318 from ChillerDragon/pr_clang_tidy_19
Add support for clang tidy 19
2024-06-02 08:52:47 +00:00
Robert Müller 6cfe54b9c5
Merge pull request #8338 from ChillerDragon/pr_goto_tele_refactor
Fix `goto_tele` not finding all teleporters
2024-06-02 08:47:30 +00:00
Robert Müller 94325cdf78 Improve error handling for invalid translation files
Fix crash when reading a translation file that ends unexpectedly after a context line.

Make error messages about malformed translation files more detailed.

Fix incorrect line numbers in the error message because context lines were not counted.

Use `log_error` for error messages.
2024-06-02 10:36:00 +02:00
Louis Geer 9492ca574b Add confetti particles on finish
Add confetti particles on finish

added common base to finish netevent

review fixes

change netevent to ddnet.org
2024-06-02 11:00:06 +09:00
Robert Müller f762e2364f Fix language file being loaded twice when starting
Ignore language file config variable being set initially in the conchain (i.e. when `GlobalTime` still returns zero) and check whether the value changed before reloading the language.
2024-06-01 22:24:05 +02:00
heinrich5991 64fec2cd37
Merge pull request #8427 from Robyt3/Translation-Brazilian-Portuguese-Fix
Fix invalid format string in Brazilian Portuguese translation
2024-06-01 20:02:59 +00:00
Robert Müller 3a12c16dac Fix invalid format string in Brazilian Portuguese translation 2024-06-01 21:31:09 +02:00
furo 4e552d0f98 Add /practicecmdlist 2024-06-01 18:51:53 +02:00
Dennis Felsing cb563bf267
Merge pull request #8425 from gerdoe-jr/patch-4
Small changes in `russian.txt`
2024-06-01 16:29:58 +00:00
gerdoe 8ad414bd8c
small changes in russian.txt 2024-06-01 19:12:22 +03:00
Dennis Felsing f1c2d10cd7
Merge pull request #8424 from Robyt3/Cleanup-str_copy
Consistently use `str_copy` instead of `mem_copy` for strings
2024-06-01 15:18:37 +00:00
Dennis Felsing 3233492fd3
Merge pull request #8423 from Robyt3/Client-Mapdownload-Speed-Localize
Make map download progress and speed label translatable
2024-06-01 15:18:35 +00:00
Robert Müller 24d12e4820 Consistently use str_copy instead of mem_copy for strings 2024-06-01 13:55:20 +02:00
Robert Müller 2a3cc8fd55 Make map download progress and speed label translatable 2024-06-01 13:01:37 +02:00
Robert Müller 7f5330b7d1
Merge pull request #8421 from Robyt3/Android-Unused-Flag-Cleanup
Remove unnecessary `DDNET_TEST_NO_LINK=1` in Android build
2024-05-31 16:05:03 +00:00