Commit graph

15086 commits

Author SHA1 Message Date
Robert Müller 8b3e686fdb Fix text input rapidly activated/deactivated when closing console
Fixes virtual keyboard on Android flashing rapidly when the console is closed.
2024-07-23 12:51:36 +02:00
Corantin H 5f8e2742a6 Fix team number and team size rendering
Fix team number and team size rendering outside of the scoreboard when the team is rendered on both sides
Fix team number and team size alignment
2024-07-23 10:10:43 +02:00
Dennis Felsing 712aed780f Version 18.4 2024-07-22 17:56:21 +02:00
Dennis Felsing d8cee35f73
Merge pull request #8628 from Jupeyy/pr_gpu_if
Check API version before adding GPU to GPU list
2024-07-21 12:55:31 +00:00
Robert Müller 606212f2d0
Merge pull request #8629 from MilkeeyCat/pr_refactor_text_alignment_of_movement_information
Use text containers to render movement information
2024-07-21 12:05:59 +00:00
MilkeeyCat ec37efdcfd refactor: use text containers to render movement information
closes #8622
2024-07-21 14:43:22 +03:00
Jupeyy e96275943b
Check API version before adding GPU to GPU list
Signed-off-by: Jupeyy <jupjopjap@gmail.com>
2024-07-21 13:29:49 +02:00
Robert Müller 74426b05a3 Avoid copies of server info in CGameClient::OnNewSnapshot
Only copy the server info with the `GetServerInfo` function once, as it should not change within a call of the `CGameClient::OnNewSnapshot` function.
2024-07-21 12:53:29 +02:00
Robert Müller 36f19f491e Support touch input in engine, UI and console
Add support for touch input to the engine, UI and console. Ingame touch controls require more discussion and will be delivered separately based on this engine implementation.

Engine
------

The state of all currently pressed touch fingers is aggregated based on the SDL touch events and can be retrieved with the `IInput::TouchFingerStates` function. This design is less complex than an event-based system where the touch events are delivered to the individual client components, as each system would then have to keep track of the finger states individually. However, this means that only one component can handle touch fingers at any given time, which seems like a reasonable assumption for our use cases.

Obsolete code for relative mouse handling on Android is removed. Connecting a mouse to an Android device should now also work as expected, as more recent SDL/Android versions support relative mouse input natively.

User Interface
--------------

Support absolute mouse positioning and clicking in the user interfaces (menus, editor, demo player) with touch presses.

Support right clicking by pressing and holding one finger at roughly the same position for 0.5 seconds.

Support scrolling scroll regions up and down with a two finger swiping gesture. Fast scrolling via a two finger flinging gesture is not yet supported and would be a useful future extension.

The menus and demo player are fully usable with touch inputs. The editor is only fully usable with an external keyboard and/or mouse, as panning the map is not currently possible with only touch inputs, which is also left as a possible future extension.

Console
-------

The touch input logic for the user interface is reused for the console. Thereby, text selection in the console with touch input works, although the text can only be copied by pressing Ctrl+C with an external keyboard at the moment. In the future, we could add buttons to the console to activate the search and copy functionalities with touch inputs.

Support scrolling the console history up and down with a two finger swiping gesture.

The local/remote consoles can currently only be opened with an external keyboard. The ingame touch controls will also include buttons to open the consoles.
2024-07-19 13:36:04 +02:00
Dennis Felsing e74f17c939
Merge pull request #8614 from Robyt3/Video-Removed-Property-Fix
Fix assertion when rendering demo with updated ffmpeg library
2024-07-18 15:59:33 +00:00
Robert Müller c30a35a493 Fix assertion when rendering demo with updated ffmpeg library
The `in_channel_count` and `out_channel_count` properties of the `SwrContext` were already deprecated and have been removed in the most recent ffmpeg library version, hence rendering demos was causing an assertion error when these properties were set.

For newer ffmpeg versions, we now set the channel layout with the `in_chlayout` and `out_chlayout` properties instead of setting the number of channels.
2024-07-18 17:23:16 +02:00
Robert Müller ac95d73e31 Slightly increase size for score in scoreboard again
Did not consider in #8591 that the team and size would also need this space.
2024-07-17 20:23:04 +02:00
heinrich5991 f9a94fb5e0
Merge pull request #8609 from Robyt3/Android-No-Process-No-Server
Disable "Run server" button and process functions on Android
2024-07-17 15:46:56 +00:00
heinrich5991 f9c5d008ca
Merge pull request #8591 from Robyt3/Client-Scoreboard-Spectate-128
Add basic support for 128 players in scoreboard and spectator UI
2024-07-17 15:29:26 +00:00
Robert Müller 45f9161d43 Disable "Run server" button and process functions on Android
Starting the server on Android is currently not possible because a) the server executable is currently not compiled for Android b) launching the server executable with `fork` and `exec` is not supported on Android and may result in strange bugs like broken networking.

Running the server in a background service or in a separate process by using `Runtime.getRuntime().exec` from Java code might be feasible, but this is currently too much effort and may be done in the future.

For now, the "Run server" button as well as the process related system functions are disabled via conditional compilation on Android, to prevent the networking bug that would otherwise be triggered by pressing the "Run server" button.
2024-07-17 16:48:17 +02:00
MilkeeyCat 784333b2aa refactor: remove multi line chat support 2024-07-17 14:13:13 +03:00
Robert Müller 90c63746b4 Show skin name as tooltip in ingame player list 2024-07-16 20:38:47 +02:00
Dennis Felsing 3229a19fd5
Merge pull request #8601 from Robyt3/Client-Camera-ZoomAllowed-Function
Extract `CCamera::ZoomAllowed` function to reduce duplicate code
2024-07-16 16:49:40 +00:00
Dennis Felsing 7197b815a1
Merge pull request #8599 from Robyt3/Spectate-UI-Input-Refactoring
Refactor spectator UI input handling
2024-07-16 16:29:07 +00:00
Robert Müller f574f759d4 Extract CCamera::ZoomAllowed function to reduce duplicate code 2024-07-16 18:06:22 +02:00
Robert Müller 088f963c0d Readd separate localization strings for Red/blue team wins! 2024-07-16 17:40:57 +02:00
Robert Müller ed53b1c6dc Refactor spectator UI input handling
Use `IInput::KeyPress` instead of event callback for mouse presses. Remove subsequently unnecessary `m_Clicked` variable.
2024-07-16 17:12:58 +02:00
Robert Müller 846775c6b7 Avoid reusing Selected variable for different buttons 2024-07-16 17:12:48 +02:00
Robert Müller e8eb79e7fb Remove unused m_OldMouseX and m_OldMouseY variables 2024-07-16 17:12:45 +02:00
Robert Müller d4f47c2a55 Implement client restarting on Android
Restarting the client previously did not work, as the `shell_execute` function on Android uses `fork` which is not supported.

Now, the client is restarted by using an Android intent to restart the main activity. This is triggered by sending a user-defined message from the native code to the SDL main activity thread.
2024-07-16 12:52:19 +02:00
Robert Müller 78da9689f5 Add basic support for 128 players in scoreboard and spectator UI
Support showing up to 128 players in the scoreboard and the spectator UI. The 128 players are rendered in 3 columns of 43 players in the scoreboard and in 4 columns of 32 players in the spectator UI. Other lists like the server info (ingame and in the server browser) and the voting list already support showing any number of players.
2024-07-15 23:41:33 +02:00
Robert Müller 37756aa389 Ensure that sv_max_clients can only be set when starting server
Changing the `sv_max_clients` config variable while the server is running does not change the maximum number of clients that can connect, as this is determined only once when the `CNetServer` is initialized. The reserved slot check and the calculation of the number of player slots for the `protocol7::CNetMsg_Sv_ServerSettings` message were using the `sv_max_clients` config variable directly, which was causing them to be out-of-sync with the real number of maximum clients.

Existing uses of the `sv_max_clients` config variable, except for the `CNetServer` initialization, are replaced with `MaxClients()`. The config variable `sv_max_clients` is now marked as read-only after reading the initial config and command line argument, so changing it via the remote console is not possible and shows an error message. The unnecessary conchain for `sv_max_clients` is removed.
2024-07-15 14:37:11 +02:00
Robert Müller 325e22d2de Fix crashes with dbg_dummies and sv_max_clients
Use the real number of maximum clients returned by the `MaxClients()` function instead of the `MAX_CLIENTS` constant to calculate the debug dummy client IDs to fix a crash when `sv_max_clients` is below `MAX_CLIENTS`.

Ensure the `dbg_dummies` value does not exceed the maximum number of clients.
2024-07-15 14:36:50 +02:00
Dennis Felsing b0f0292fc9
Merge pull request #8588 from Robyt3/Snapshot-Usage-Cleanup
Simplify usage of `IClient::SnapGetItem` function, remove unnecessary `IClient::SnapGetItem` function
2024-07-14 12:49:07 +00:00
Learath ebd266c419 Reset and regenerate m_aPeerAddrStr appropriately
Hopefully fixes #8587
2024-07-14 14:11:19 +02:00
Robert Müller 2f6c3abc90 Remove unnecessary IClient::SnapItemSize function
The item data size is already returned by the `IClient::SnapGetItem` function and getting only the size is not currently useful, so the additional `IClient::SnapItemSize` function is unnecessary.
2024-07-14 13:18:30 +02:00
Robert Müller e9646ba157 Simplify usage of IClient::SnapGetItem function
Let the `IClient::SnapGetItem` function return an `IClient::CSnapItem` directly instead of passing it as a pointer. Add the item data pointer as a member variable to `IClient::CSnapItem` instead of returning it separately. Therefore, the separate data pointer of the class `CSnapEntities` is also not necessary anymore.

Consistently mark the snapshot items and data as `const`. The C-style cast to `void *` in the `IClient::SnapGetItem` function was previously implicitly casting away the `const` of the snapshot pointers.
2024-07-14 13:15:44 +02:00
Robert Müller a31d6a571a Cleanup snapshot member variables in demo_extract_chat tool
Using `CSnapshotStorage::CHolder`s in the `demo_extract_chat` tool is not necessary, as only the member variable `m_pAltSnap` is being used in this tool. The regular snapshot data was copied into `m_pSnap` but never read. The other member variables were initialized but never read.
2024-07-13 22:51:31 +02:00
Robert Müller e277131cf8 Fix incorrect scoreboard size if blue team used without teams flag
When `GAMEFLAG_TEAMS` is not set, only the players of the red team are rendered in the scoreboard, but the size of the scoreboard was incorrectly calculated based on the size of the larger team (red or blue), which should only be done when `GAMEFLAG_TEAMS` is set.
2024-07-12 21:44:16 +02:00
Robert Müller 7cbfe1623d Avoid duplicate distance calculation
Add variable `NewVelLength` to avoid calculating `length(NewVel)` twice.
2024-07-11 18:02:51 +02:00
Robert Müller 660c1de8f2 Remove unnecessary use of this
The same variable `m_HookHitDisabled` is also being accessed without `this`.
2024-07-11 18:02:24 +02:00
Robert Müller 998adfcefc Remove redundant distance checks
The check `Distance > 0.0f` is redundant because the same check already exists in the outer if-statement and the variable `Distance` is never modified.

The check `D >= 0.0f` is redundant because mathematically any distance is greater or equal to zero.
2024-07-11 17:54:51 +02:00
Robert Müller aeee2f561d Remove dead code and obsolete TODO
It seems unlikely we that would want to introduce a variable to tweak the hook behavior at this point, so the TODO is removed.
2024-07-11 17:54:41 +02:00
Robert Müller 8e83049054
Merge pull request #8352 from ChillerDragon/pr_multi_cmd_helptext
Show help text when chaining multiple commands
2024-07-10 16:46:47 +00:00
Dennis Felsing 108d0dc715 Make FillAntibot faster 2024-07-10 15:06:16 +02:00
Learath 7fa0ef56f3 Include port 2024-07-09 20:27:40 +02:00
Learath 3cb390c6e6 net_addr_str only once 2024-07-09 20:17:34 +02:00
Robert Müller 350a57df60 Fix multiple redirected clients not dropped in the same tick
Closes #8551.
2024-07-09 18:10:42 +02:00
ChillerDragon 7b540ddb16 Remove support for space separation 2024-07-09 08:30:59 +08:00
Dennis Felsing 9143f2eac7
Merge pull request #8571 from Robyt3/Tools-Map-Extract-Refactoring
Improve `map_extract` tool: fix crash when opus file cannot be opened, improve logging, refactoring
2024-07-08 21:44:05 +00:00
Robert Müller 526251293c Use static_cast and const pointers for map items 2024-07-08 22:21:51 +02:00
Robert Müller 4c702395db Split map_extract tool into separate functions
Improve readability by splitting the `map_extract` tool into multiple functions.
2024-07-08 22:21:28 +02:00
Robert Müller b81ac61556 Unload image and sound data in map_extract tool sooner
Reduce the memory footprint of the tool by unloading the map data as soon as possible instead of only implicitly when the `CDataFileReader` is destructed.
2024-07-08 22:21:14 +02:00
Robert Müller c9467454d3 Improve logging of map_extract tool
Use `log_info` and `log_error` instead of `dbg_msg`.

Add error messages when output files cannot be opened for writing.

Move log messages regarding files being written so they are only printed when the files are actually being written.
2024-07-08 22:20:57 +02:00
Robert Müller 4c4b2e9edc Fix map_extract tool crashing if opus file cannot be opened 2024-07-08 22:20:51 +02:00