Commit graph

15437 commits

Author SHA1 Message Date
Dennis Felsing 2b2e57c2bb
Merge pull request #8308 from ChillerDragon/pr_team_enum
Use enum for teams (Closed #8306)
2024-05-05 03:59:35 +00:00
ChillerDragon f319ed239a Initialize all ghost item member (Closed #8297) 2024-05-05 11:47:05 +08:00
ChillerDragon 0b6bb8287a Use enum for teams (Closed #8306) 2024-05-05 11:38:29 +08:00
Dennis Felsing aafb4e2e09
Merge pull request #8304 from Zwelf/pr-teehistorian-finish-2
Store player names in teehistorian and Finish/TeamFinish v2
2024-05-05 01:34:57 +00:00
Dennis Felsing fdc929d2b1
Merge pull request #8293 from BlaiZephyr/add-team0-indicator
add team0mode indicator
2024-05-05 01:33:27 +00:00
Zwelf f14dab4cfa Increment teehistorian version_minor to 8
Allows easily distinguishing between Teehistorian extension from #8221
with wrong Tick (divided by 50) and this fixed one.
2024-05-04 21:40:06 +02:00
Zwelf af4da41c4c Record Player and Team finishes in Teehistorian 2024-05-04 21:40:06 +02:00
Zwelf fcd8aae388 Record player name in Teehistorian files 2024-05-04 20:44:20 +02:00
Dennis Felsing 2f22447d44
Merge pull request #8302 from Robyt3/Video-Refactoring
Video recorder: improve error handling and log messages, fix crashes, refactoring
2024-05-04 14:59:06 +00:00
Robert Müller e5927d9024 Fix crashes when video recording is not started successfully
Add additional checks to ensure that the `CVideo::Stop` function and the functions called by it will correctly stop the current video also if the video was not started successfully, i.e. if `CVideo::Start` returned `false` from any of the error branches.

In the `CVideo::Stop` function, iterate over the vectors of video and audio threads directly instead of using `m_VideoThreads` and `m_AudioThreads`, which do not reflect the actual count if the initialization failed before the threads were created.

In the `CVideo::Stop` function, only call `av_write_trailer` if the video recording was stated successfully, i.e. only if `avformat_write_header` was called successfully, as this will otherwise cause the client to crash. Closes #6375.

In the `CVideo::Stop` function, only call `avio_closep` if the format context was allocated.

In the `CVideo::FinishFrames` function, ensure that the codec has been allocated and opened, otherwise using it is not allowed.

Add assertions to the `CVideo::Start` and `Stop` functions to ensure that the same video is not started/stopped multiple times.
2024-05-04 13:55:35 +02:00
Robert Müller 3a0e2429d1 Assert that size of image data matches size of video
Crash with assertion when the size of the graphics is different from the video currently being rendered, instead of causing weirder bugs and a corrupted video file.
2024-05-04 13:55:35 +02:00
Robert Müller a0465b67dd Improve various variable and class names of the video recorder
- Rename variable `m_vBuffer` -> `m_vAudioBuffers`
- Rename class `SAudioBuffer` -> `CAudioBuffer`
- Rename variable `m_vPixelHelper` -> `m_vVideoBuffers`
- Add class `CVideoBuffer` as wrapper
- Remove unused variable `m_Vframe`
- Rename variable `m_ASeq` -> `m_AudioFrameIndex`
- Rename variable `m_VSeq` -> `m_VideoFrameIndex`
- Rename variable `m_vVideoThreads` -> `m_vpVideoThreads`
- Rename variable `m_vAudioThreads` -> `m_vpAudioThreads`
- Rename function `ReadRGBFromGL` -> `UpdateVideoBufferFromGraphics`
- Remove unnecessary `ALEN` definition
- Remove unused variable `NextPts`
- Rename class `OutputStream` -> `COutputStream`
- Rename variable `pSt` -> `m_pStream`
- Rename variable `pEnc` -> `m_pCodecContext`
- Rename variable `m_vpSwsCtxs` -> `m_vpSwsContexts`
- Rename variable `m_vpSwrCtxs` -> `m_vpSwrContexts`
- Rename variable `pOC` -> `pFormatContext`
- Rename class `SVideoRecorderThread` -> `CVideoRecorderThread`
- Rename class `SAudioRecorderThread` -> `CAudioRecorderThread`
2024-05-04 13:55:35 +02:00
Robert Müller 5f647b97eb Ensure correct sample and bit rate are used for video recording
The wrong sampling rate was being used for video recording if the client is not restarted after changing the `snd_rate` config variable.

Ensure that the correct bit rate is used if the sample rate was adjusted because the selected value is not supposed.
2024-05-04 13:15:54 +02:00
Robert Müller 9d2c11d7ee Improve error handling and logging of video recorder
Use `log_error` for all errors and consistently format all error messages.

Handle all ffmpeg errors and output the formatted ffmpeg error message when possible.

Register a log callback for ffmpeg log messages to delegate them to our logging system, to fix the log messages being interleaved with our log messages and not using the correct line breaks on Windows.

Stop video and demo immediately and show an error message popup if the video could not be started successfully.

Remove unnecessary debug output from ffmpeg.
2024-05-04 13:15:54 +02:00
Robert Müller e595545cd6 Fix duplicate file extension .mp4 for demos rendered from menu
The file extension is always added in `CClient::StartVideo` now.
2024-05-04 13:04:58 +02:00
Robert Müller 33c5bfb09b Fix indentation of comments 2024-05-04 13:04:58 +02:00
Robert Müller c78eebfc67 Use nullptr instead of 0 and NULL 2024-05-04 13:04:58 +02:00
Robert Müller c4c1518709 Remove dead code 2024-05-04 13:04:58 +02:00
Robert Müller 15bebb8fb6 Remove unnecessary downcast to CGraphics_Threaded 2024-05-04 13:04:58 +02:00
ChillerDragon 8b0b09fffd Improve skin name validation error message (Closed #8300) 2024-05-04 17:43:59 +08:00
Dennis Felsing 43c03c4d54
Merge pull request #8296 from ChillerDragon/pr_camel_tools
Remove tools camel case style exception
2024-05-04 05:20:30 +00:00
ChillerDragon fcbd1fb1b1 Fix worst local variable style offenses
Removed member prefix m_ used for local variables.
Removed all b, c, i hungarian notation prefixes for boolean, const and integers.
Fixed local variables using lower_snake_case instead of UpperCamelCase.
Renamed all ``float wSearch = TextRender()->TextWidth..`` to ``float SearchWidth = ..``.
2024-05-04 11:17:06 +08:00
ChillerDragon f788a04892 Remove tools camel case style exception 2024-05-04 10:56:33 +08:00
Robert Müller b745d75306 Fix alignment of vote option heap entries with remove_vote
When using the `remove_vote` command, the entire heap of vote options is allocated again without the entry being removed. This allocation was not considering the required alignment for `CVoteOptionServer` objects and potentially wasting space by aligning with `alignof(std::max_align_t)`. When allocating the entries with the `add_vote` command, the alignment is already specified correctly.
2024-05-03 18:22:33 +02:00
Dennis Felsing fc180562f6
Merge pull request #8151 from ChillerDragon/pr_tidy_camel
Enforce UpperCamelCase for local variables
2024-05-02 13:48:56 +00:00
meloƞ 9bbe238159 added team0mode indicator 2024-05-02 14:23:30 +02:00
ChillerDragon 63c8172d11 Enforce UpperCamelCase for local variables 2024-05-02 18:52:16 +08:00
heinrich5991 2dbcb9795a
Merge pull request #8139 from ChillerDragon/pr_cui_noop
Remove useless operation in CUIRect SplitMid
2024-05-02 06:14:34 +00:00
Dennis Felsing 7b97138202 Version 18.2 2024-05-02 11:15:02 +08:00
heinrich5991 213222b72b
Merge pull request #8289 from Robyt3/Client-Address-Check-Cleanup
Remove unnecessary check excluding packets from wrong server
2024-05-01 15:24:34 +00:00
Dennis Felsing 70785eb0dd
Merge pull request #8281 from ChillerDragon/pr_fix_triggeredevents7
Make sixup TriggeredEvents reliable
2024-05-01 15:16:29 +00:00
Robert Müller dd62cda8ba Remove CCommandProcessorFragment_GLBase::Resize delegate
Use `ResizeImage` function directly instead.
2024-05-01 14:56:34 +02:00
Robert Müller 20c28f78ce Remove unnecessary check excluding packets from wrong server
This is already checked for all connection-oriented packets when feeding the connection in

952d3f6631/src/engine/shared/network_conn.cpp (L260-L266)

Closes #8285.
2024-05-01 13:34:19 +02:00
heinrich5991 2cd877f0ce
Merge pull request #8272 from ChillerDragon/pr_fix_snap_uuid_register
Fix ddnet ex snap item registration (closed #8271)
2024-05-01 09:56:42 +00:00
ChillerDragon 3c45134c8d Fix ddnet ex snap item registration (closed #8271) 2024-05-01 09:45:42 +08:00
ChillerDragon 740aada779 Add str_isnum 2024-05-01 09:08:02 +08:00
Robert Müller 3fc6ee4349
Merge pull request #8284 from ChillerDragon/pr_newline_cursor
Always update text cursor y (closed #8282)
2024-04-30 16:10:14 +00:00
ChillerDragon 508b6d1615 Always update text cursor y (closed #8282) 2024-04-29 14:12:38 +08:00
Dennis Felsing 7e857ce37e
Merge pull request #8280 from Robyt3/Client-Redirect-Password-Fix
Fix wrong server address used in password popup when redirected, minor refactoring
2024-04-29 04:23:57 +00:00
ChillerDragon 5f784cbcda Make sixup TriggeredEvents reliable
Relevant upstream commit:
d2924b5ad6

Closes https://github.com/ChillerDragon/ddnet/issues/7

The snap item obj_character contains a field called m_TriggeredEvents
https://chillerdragon.github.io/teeworlds-protocol/07/snap_items.html#obj_character

It is responsible for effects and sounds. Those flags are set in the gamecore.
So if the servers gamecore ticks twice and resets the flags before a snap is
sent the client misses the information. Which is not too big of a
problem since the client has his own gamecore running (prediction) which
also sets those flags. But it is still wrong and teeworlds does always
include the triggered events in the snap.

So this commit fixes it using the same approach as teeworlds.
By not resetting the triggered events until a snap was sent.
2024-04-29 08:57:14 +08:00
Dennis Felsing d265057591
Merge pull request #8278 from Robyt3/Client-Move-Resize-Fixes
Revert screen mode config variables when change not accepted, update screen index config variable after moving window
2024-04-28 15:18:16 +00:00
Robert Müller 938d264c43 Fix wrong server address used in password popup when redirected
Always use the server address from the network client to reconnect to the correct server after being disconnected due to wrong password. The password popup is only shown after being disconnected, so the server address of the network client should always the address of the server which the client should reconnect to with the password. Using `ui_server_address` was causing the wrong address to be used after being redirected to another server and if the config variable is changed while the password popup is open.

Closes #8260.
2024-04-28 17:05:28 +02:00
Robert Müller d2139e4bec Use net_addr_str directly to format address including port 2024-04-28 16:45:56 +02:00
Robert Müller b3bcfd39bc Add no-op logger to fix leak of CFutureLogger pending messages
Fix leak of pending future logger log messages if the future logger is not set, in particular when the `logfile` config variable is not set or the file could not be opened, by setting a logger that discards all log messages in this case.

Closes #8265.
2024-04-28 16:32:24 +02:00
Robert Müller e4dddb95ce Update screen index config variable after moving window
The wrong screen was shown in the settings when moving the window to another screen while in windowed mode.
2024-04-28 15:29:05 +02:00
Robert Müller 86bf5424e3 Revert screen mode config variables when change not accepted
When changing the screen width, height or refresh rate config variables to 0 or negative values, which are not allowed by the backend, automatically revert the config variables to the actual values again to ensure that the config variables stay in sync with the state of the window. This fixes the client crashing in the graphics settings when setting the screen width and height to 0 via the console, which causes a division by zero when calculating the aspect ratio.
2024-04-28 15:25:31 +02:00
Dennis Felsing 516315e0e2
Merge pull request #8273 from Robyt3/Sound-Various-Fixes
Fix crashes and memory leaks related to editor map sounds and opus file decoding, refactoring
2024-04-27 15:45:55 +00:00
Robert Müller 4f94316c72 Make change_map parameter non-optional
The command confusingly assumed the empty string if no argument was passed.
2024-04-27 13:45:51 +02:00
Robert Müller 9cf3094934 Also check for incorrect sample index with assertion
Ensure the sample being allocated is not currently used also by checking its next free sample index.
2024-04-27 13:11:35 +02:00
Robert Müller d06f6d3370 Handle failure of op_pcm_total function
According to the documentation, this function returns `0` on success and a negative number (error code) otherwise, which would cause an allocation of an invalid size.
2024-04-27 13:11:35 +02:00
Robert Müller d0e27fdcd4 Fix memory leak of opus file structure
We were not calling `op_free` for `OggOpusFile *` after decoding opus files.
2024-04-27 13:04:05 +02:00
Robert Müller cfb5b15222 Log error code if opus file cannot be opened 2024-04-27 13:03:58 +02:00
Robert Müller 51012bcc1b Fix potential out-of-bounds writes on invalid opus files
The third parameter of the `op_read` function specifies the remaining size of the buffer, but we always passed the total size of the buffer without respecting the position at which the data is written into the buffer.
2024-04-27 13:03:18 +02:00
Robert Müller 4d37775c17 Only change sample variables when it was decoded successfully
Avoid changing the sample member variables until the sample was decoded successfully.
2024-04-27 13:02:36 +02:00
Robert Müller 1153507216 Fix double-free when reading opus file fails
Set the data pointer of the sample only when the sample has been loaded successfully, so the invalid sample data is not freed again when decoding fails.
2024-04-27 13:02:23 +02:00
Robert Müller 941a302c4d Ensure editor preview image and sound are unloaded properly
The preview image was previously not unloaded and the preview state was not reset.
2024-04-27 13:01:56 +02:00
Robert Müller 3b0d9cd6c9 Fix editor crash with sound preview when sound is not valid
This happens if a sound could not be loaded successfully.
2024-04-27 13:01:26 +02:00
Robert Müller 690912e209 Fix invalid sound index used when loading external sound fails
This should be highly unlikely because external sound mapres were never supported by the editor.
2024-04-27 13:00:54 +02:00
Dennis Felsing c22ba00b59
Merge pull request #8270 from Robyt3/Image-size_t
Use `size_t` for `CImageInfo::m_Width` and `m_Height`
2024-04-27 04:37:28 +00:00
Robert Müller c5a0d850d2 Use size_t for CImageInfo::m_Width and m_Height 2024-04-26 21:12:39 +02:00
Robert Müller caccf05455 Fix warning because of incorrect format argument for size_t 2024-04-26 19:59:47 +02:00
Dennis Felsing 0eb319a951
Merge pull request #8263 from ChillerDragon/pr_line_author
Use LineAuthor variable to cleanup chat code
2024-04-25 17:11:04 +00:00
Robert Müller 0cedcdc3a7
Merge pull request #8236 from ChillerDragon/pr_delta_dump
Add delta debug dump
2024-04-25 16:05:26 +00:00
ChillerDragon 1937145fdb Use LineAuthor variable to cleanup chat code 2024-04-25 09:43:29 +08:00
ChillerDragon 29f6cc67db Add delta debug dump 2024-04-25 08:44:49 +08:00
Dennis Felsing 1a397ad995
Merge pull request #8252 from ChillerDragon/pr_num_skinparts
Use NUM_SKINPARTS instead of magic number
2024-04-23 08:32:22 +00:00
ChillerDragon 38cae7edcf Use NUM_SKINPARTS instead of magic number 2024-04-23 16:09:34 +08:00
Robert Müller 5958e9e4c5 Reset last dummy state when disconnecting
Otherwise the snapshots may incorrectly be invalidated because a change of the `cl_dummy` variable is detected when connecting to another server after disconnecting while the dummy is active.
2024-04-22 19:54:21 +02:00
Robert Müller efdd55613c Avoid using cl_dummy for demo playback
The `cl_dummy` config variable is always `0` during demo playback. Using the config variable makes the code less readable.
2024-04-22 19:54:21 +02:00
Robert Müller c7403ef06d Check CNetClient::State instead of SecurityTokenUnknown
Send dummy ready and enter game when connection is online based on its state instead of when the security token is not unknown anymore, which should effectively be the same condition but more understandable. This is also how it's already done for the main connection so the `SecurityTokenUnknown` function can be removed as it's unused now.
2024-04-22 19:54:21 +02:00
Robert Müller 9ffa9d8e0a Do not unpack map data packet if no map download is progress
There is no need to unpack map data packets if the client receives any without expecting them.
2024-04-22 19:33:20 +02:00
Robert Müller b264570218 Ignore all packets from other servers instead of only snapshots
The client should only ever handle game-related packets from the server that it is currently connecting/connected to.
2024-04-22 19:33:11 +02:00
Robert Müller 87f9ccdb22 Improve readability by renaming variable and changing condition
Rename variable `i` to `Conn`. Check for `CONN_MAIN` and `CONN_DUMMY` explicitly instead of using numeric index.
2024-04-22 19:32:55 +02:00
Robert Müller 9e5369bc9d Mark dummy connecting functions as const 2024-04-22 19:32:46 +02:00
Robert Müller 51a624d95c Use array index 0 explicitly instead of using array as pointer 2024-04-22 19:32:36 +02:00
Robert Müller fbe559ea79 Fix console not keeping scroll position when backlog is full
The console was not keeping its current scoll position if entries from the backlog are removed due to being recycled when new entries are added. For this purpose, a callback function is added to the ringbuffer to handle popped items, so the scrolling position of the console can be updated based on the number of lines of the removed backlog entries.
2024-04-21 12:52:55 +02:00
Robert Müller 151b2854e3 Fix potential client crash when console backlog is full
Fix backlog corruption in `CConsole::PumpBacklogPending` when many backlog entries are allocated at the same time. When allocating many entries from the `m_Backlog` ringbuffer at the same time, the first entries being allocated may already have been recycled again, so the pointers to them being stored in the temporary vector of new backlog entries were pointing arbitrarily into the ringbuffer data, which could cause corruption of the structural and user data of the ringbuffer. Now, we iterate over the entire backlog and only update uninitialized entries instead of storing the new entries separately.

This was sometimes caught as a misaligned access with UBSan:

```
src/engine/shared/ringbuffer.cpp:160:14: runtime error: member access within misaligned address 0x00014126f4df for type 'struct CItem', which requires 8 byte alignment
0x00014126f4df: note: pointer points here
<memory cannot be printed>
    0 0x5825349a6a1c in CRingBufferBase::Prev(void*) src/engine/shared/ringbuffer.cpp:160
    1 0x5825334e8934 in CTypedRingBuffer<CGameConsole::CInstance::CBacklogEntry>::Prev(CGameConsole::CInstance::CBacklogEntry*) src/engine/shared/ringbuffer.h:59
    2 0x5825334d13e6 in CGameConsole::OnRender() src/game/client/components/console.cpp:1259
    3 0x582533bce058 in CGameClient::OnRender() src/game/client/gameclient.cpp:715
    4 0x582532f3cc44 in CClient::Render() src/engine/client/client.cpp:894
    5 0x582532f9d236 in CClient::Run() src/engine/client/client.cpp:2971
    6 0x582533002e5e in main src/engine/client/client.cpp:4523
```
2024-04-21 12:52:54 +02:00
Robert Müller 9be40e1782 Fix OOB accesses rendering ghosts, fix ghost hook collision line
Fix out-of-bounds accesses when rendering ghost players, which use the client ID `-2`. This was causing the hook collision line of ghost players to be affected by real players, which is not correct, as ghosts do not interact with other characters.

Closes #8239.
2024-04-20 23:28:37 +02:00
Dennis Felsing b35503273c
Merge pull request #8234 from ChillerDragon/pr_typo_reckoning
Fix reckoning typo in comment
2024-04-20 02:18:52 +00:00
ChillerDragon db627976e5 Fix reckoning typo in comment 2024-04-20 09:53:58 +08:00
Dennis Felsing 173e675ec1
Merge pull request #8203 from Robyt3/Graphics-LoadPng-Cleanup
Change `PNG` in function names to `Png`, pass `CImageInfo` by reference to `IGraphics::LoadPng`
2024-04-20 00:55:02 +00:00
Robert Müller d2c8132fb6 Add optional name argument to start_video command, refactoring
Add optional filename argument to `start_video` command, to start recording to a video file with a specific filename, instead of always using the current timestamp.

Add log messages to `start_video` and `stop_video` commands to indicate success and errors.

Make the `CClient::StartVideo` function non-`static` and reduce duplicate code in the `Con_StartVideo` function.

Determine the video filename outside of the `CVideo` constructor, same as for demos.
2024-04-19 20:09:20 +02:00
Robert Müller 93d5a8be32 Improve descriptions of demo-related console commands 2024-04-19 20:08:41 +02:00
Robert Müller 12d3c8245d Fix prediction errors and incorrect rendering after changing map
Fix game times and prediction not being updated when only exactly two snapshots have been received, due to the conditions `m_aReceivedSnapshots[...] >= 3`. These specific condition are not necessary and replaced with simpler checks whether the current snapshot is set. Some duplicate nested conditions are also removed.

Pump the network first in `CClient::Update` before updating anything else, to ensure that snapshots are received from the network client before the game times and prediction are being updated based on the current snapshots.

Fix current and previous game tick always being `0` on the first call of `IGameClient::OnNewSnapshot` when two snapshot have been received. Now, the game ticks are properly initialized from the two initial snapshots.

Fix old inputs sometimes being used in prediction after changing map because inputs with tick `-1` were not being ignored.

Ensure all snapshots and game times are properly cleared when entering the game.
2024-04-18 20:40:31 +02:00
Dennis Felsing da09087416
Merge pull request #8227 from Zwelf/pr-disable-practice-while-saving
Disallow activating /practice while save is in progress and improve messaging for when `/save`/`/load` command does nothing
2024-04-18 01:53:19 +00:00
Zwelf e1355dc891 Improve messaging to players why /load command does nothing 2024-04-17 22:10:40 +02:00
Zwelf f6f5629fd0 Disallow /load when practice mode is enabled 2024-04-17 22:10:40 +02:00
Zwelf 25f85afef5 Improve messaging to players why /save command does nothing 2024-04-17 22:10:40 +02:00
Zwelf da5a466ac3 Disallow enabling practice while save and load is in progress 2024-04-17 22:10:40 +02:00
Robert Müller 3ef00d465e Fix assertion on Windows when redirecting console output to nul
`GetConsoleMode` can fail with `ERROR_INVALID_HANDLE` when redirecting output to `nul`, which is considered a character file but cannot be used as a console.
2024-04-17 20:00:32 +02:00
Robert Müller 36db1e604f Fix freeze not working during first 50 server ticks
The purpose of this condition is to only update the freeze time every 50 ticks so the freeze bar keeps being refilled after one second when standing in freeze, but it incorrectly prevented freeze from being applied during the first 50 ticks after the map has been loaded. Now, freeze is also applied if not currently frozen, so the behavior directly after changing the map is identical to subsequent respawns.
2024-04-16 20:55:31 +02:00
Dennis Felsing d028756bbb Revert "Record player name in Teehistorian files"
This reverts commit 783f4e3093.
2024-04-16 12:41:14 +08:00
Dennis Felsing 6c9af4d2cc Revert "Record Player and Team finishes in Teehistorian"
This reverts commit ece1ec07f5.
2024-04-16 12:41:10 +08:00
Dennis Felsing 68a64b4ae1
Merge pull request #8219 from Robyt3/Client-Component-Setter-Cleanup
Remove unnecessary client component variables and setters
2024-04-16 01:40:12 +00:00
Dennis Felsing 5f45e218ef
Merge pull request #8221 from Zwelf/pr-teehistorian-finish
Store player names in teehistorian and Finish/TeamFinish
2024-04-16 01:11:16 +00:00
Dennis Felsing 88ff8204db
Merge pull request #8220 from Zwelf/pr-practice-disallow-save
Disallow `/save` on teams with practice enabled
2024-04-16 01:11:13 +00:00
Dennis Felsing 17110ace66
Merge pull request #8171 from Zwelf/pr-simplify-base-hook
Simplify and fix HookBase calculation
2024-04-16 01:11:11 +00:00
Zwelf ece1ec07f5 Record Player and Team finishes in Teehistorian 2024-04-16 00:50:05 +02:00
Zwelf 783f4e3093 Record player name in Teehistorian files 2024-04-16 00:50:05 +02:00
Zwelf 868e6e0975 Disallow /save on teams with practice enabled 2024-04-16 00:34:23 +02:00
Robert Müller 8817a69269 Remove unnecessary client component variables and setters
Use the gameclient to access other components instead.
2024-04-15 20:26:26 +02:00
Dennis Felsing 2e211c9a31
Merge pull request #8218 from dobrykafe/pr-align-friendslist
Fix alignment of labels in friends list
2024-04-15 01:31:55 +00:00
Dennis Felsing fe41f58197
Merge pull request #8164 from murpii/pr_teleport_reset_jumps
Refresh air jumps after teleporting
2024-04-15 01:31:50 +00:00
Dennis Felsing aca25cc802
Merge pull request #8216 from Robyt3/Demo-ServerInfo-Fix
Fix incorrect score kind in demos depending on last server
2024-04-15 01:31:38 +00:00
dobrykafe 19b19262a4 fix alignment of labels in friends list 2024-04-15 00:29:46 +02:00
Robert Müller 8a378da89b
Merge pull request #8217 from dobrykafe/pr-remove-conmode
Remove unused `ConMode` function
2024-04-14 21:07:58 +00:00
dobrykafe 3b7019d3f7 remove unused ConMode function 2024-04-14 22:48:20 +02:00
Robert Müller 47e4505193
Merge pull request #8215 from furo321/fix-timecp-mysql
Fix `/timecp` not working with MySQL
2024-04-14 20:23:18 +00:00
Robert Müller 2423e35fd2 Fix incorrect score kind in demos depending on last server
Clear current server info when playing demos to ensure that the score kind (points, time) is detected correctly. Previously, when playing a demo with points score kind and `cl_demo_assume_race 0`, the score was not shown as points when the last server that the client connected to had a race gametype.

Move the implementation for `cl_demo_assume_race` together with the rest of the demo server info initialization in the `CClient::DemoPlayer_Play` function.
2024-04-14 22:18:49 +02:00
furo cf6569029f Fix /timecp not working with MySQL 2024-04-14 19:51:09 +02:00
Dennis Felsing 06f1db98e6
Merge pull request #8213 from furo321/fix-gametiles-button
Fix bug where certain tiles would not work in `Game tiles` menu
2024-04-14 13:28:22 +00:00
furo 2545c14a5d Fix bug where certain tiles would not work in Game tiles menu 2024-04-14 15:05:10 +02:00
Robert Müller 9abe501f77 Fix duplicated rendering of popup menus in demo player
The popup menus are already rendered in the `CMenus::Render` function, also for the demo player since #8156.
2024-04-14 11:30:47 +02:00
Robert Müller 717cbef375 Fix demo player hotkeys not working when menu is inactive
The demo player needs to be rendered also when the menu is inactive, to handle the hotkeys for controlling the demo player and to render the play/pause and speed indicators.

Closes #8208.
2024-04-14 11:30:42 +02:00
Dennis Felsing 1b77cbc821
Merge pull request #8209 from dobrykafe/pr-votes
Allow the vote creator to cancel the vote + sixup vote fix
2024-04-14 03:58:29 +00:00
dobrykafe 8ca395c8be allow the vote creator to cancel the vote 2024-04-13 23:57:59 +02:00
dobrykafe b6a1a124fe fix votes for sixup 2024-04-13 23:56:40 +02:00
Robert Müller 5295ba3ded Improve readability by breaking early and reducing indentation
Remove unnecessary temporary variables and parenthesis.
2024-04-13 11:10:47 +02:00
Robert Müller 9cd51576d4 Rename static variable ActionTaken to s_ActionTaken 2024-04-13 11:10:45 +02:00
Robert Müller fd7a1600f6 Remove redundant checks of client state
These conditions are contained in an `if(State() == IClient::STATE_ONLINE)` branch and the state does not change while inside this branch, so these checks are unnecessary.
2024-04-13 11:10:25 +02:00
Robert Müller 507b097ad8 Remove unnecessary cleanup in CClient::LoadMap function
The number of received snapshots is already correctly reset in the `CClient::OnEnterGame` function for the main and dummy connections.
2024-04-13 11:07:19 +02:00
Robert Müller a743962b84 Pass CImageInfo by reference to IGraphics::LoadPng
For consistency with other graphics functions using `CImageInfo`.
2024-04-12 17:23:41 +02:00
Robert Müller 8f7055f694 Change PNG in function names to Png
- `LoadPNG` -> `LoadPng`
- `SavePNG` -> `SavePng`
- `LoadSkinPNG` -> `LoadSkinPng`
2024-04-12 17:23:18 +02:00
Robert Müller 5da64c54fd Fix tee briefly appearing at previous position when joining
Previously, when connecting to servers repeatedly, the local tee would appear at the position it had on the previous server for a short time when joining.

This (and potentially other bugs) are fixed by clearing all game related `CGameClient` member variables in the `OnReset` function. Additionally, the `OnReset` function is now used in the `OnInit` function to ensure everything is initialized correctly when starting the client and to avoid duplicating the code.

In particular, this bug was limited to use of `cl_predict 1`, because the predicted gameworlds were not being reset when disconnecting, causing the predicted world and character from the previous server to be used. This bug was introduced in version 15.6, which added the predicted gameworlds in #1620. Closes #4339.
2024-04-11 21:37:53 +02:00
Robert Müller e4fd16e6a5
Merge pull request #8200 from def-/pr-default-team0mode
Enable team0mode by default again
2024-04-11 18:21:26 +00:00
Dennis Felsing 1adae02291
Merge pull request #8199 from dobrykafe/pr-team0mode-fix
Prevent enabling `/team0mode` while practice mode is active
2024-04-11 16:45:22 +00:00
Dennis Felsing 387608a361 Enable team0mode by default again
Since we have https://github.com/ddnet/ddnet/pull/8199 now
2024-04-12 00:31:09 +08:00
dobrykafe 083f7ba7ab prevent enabling /team0mode while practice mode is active 2024-04-11 18:26:56 +02:00
Dennis Felsing e1ab2ea07e Add sv_team0mode 2024-04-12 00:15:38 +08:00
Robert Müller 01a995e5ec Track country/type filters separately for internet/favorites tabs
For the internet/favorite tabs, instead of combining the country/type filters of all communities in one view, track the country/type filters separately for these tabs using the new, reserved community name `all`. This should make the filters less confusing to use, as changing the country/type filters in one tab will not influence the other tabs anymore. Though the country/type filters of the internet and favorite tabs are still combined, as this is also the case for the community filter.

However, this made it possible to select country/type filters that exclude all servers, by first excluding some countries/types and then changing the selected communities so all selectable countries/types are excluded. To prevent this, the filters will now include all countries/types, if they would otherwise exclude all selectable countries/types.

To do this more efficiently, the community cache is moved from the menus to the engine serverbrowser. To avoid using the UI page in the engine serverbrowser, the serverbrowser type is instead used to detect if the community cache should be updated. This required additional changes in the menus to ensure that the UI page and the serverbrowser type stay in sync with each other, which would otherwise cause incorrect server entries to be shown for one frame when switching tabs. The serverbrowser type is now refreshed immediately when the menu page is changed with the `CMenus::SetMenuPage` function, which allowed removing duplicate code for the server browser tab buttons. The `CMenus::RefreshBrowserTab` function does not take the page to be refreshed as argument anymore, as it always was only used to refresh the current page. Instead, a `bool` argument is used to specify whether the refresh should be forced even if the server browser type has not changed.

Closes #8158.
2024-04-10 21:40:02 +02:00
Robert Müller 394ed87ac9 Avoid copy of CServerInfo in loop in IsRegistered 2024-04-10 21:08:29 +02:00
Dennis Felsing 67dfd7b434
Merge pull request #8193 from furo321/fix-typo
Fix typo in `/team0mode` description
2024-04-08 16:03:40 +00:00
furo 077d7c5afb Fix typo in /team0mode description 2024-04-08 17:01:15 +02:00
Dennis Felsing 8f58cbaea3
Merge pull request #8192 from dobrykafe/pr-conchain-bg-entities
Add console chain for `ClBackgroundEntities`
2024-04-08 12:39:00 +00:00
dobrykafe fd5d334cd1 add console chain for ClBackgroundEntities 2024-04-08 12:26:25 +02:00
furo 7fcac2adc2 Rename /flock to /team0mode 2024-04-07 18:48:39 +02:00
Dennis Felsing 3a75f838ac Address reviewer comment 2024-04-07 16:41:21 +08:00
dobrykafe 4c40e6c83f change /mode -> /flock 2024-04-07 16:39:27 +08:00
dobrykafe 672cfb6236 add /mode allowing teams to behave like team 0 2024-04-07 16:37:13 +08:00
Robert Müller 2e15b7d02f Let CUi::DoScrollbarOption return true if value changed
Reduce duplicate code when using the `CUi::DoScrollbarOption` function.
2024-04-04 21:00:26 +02:00
Dennis Felsing c20baa5035
Merge pull request #8186 from ChillerDragon/pr_optimize_demo_snap
Remove demo snap buffer and mem copy
2024-04-04 05:39:17 +00:00
ChillerDragon c5fb857893 Remove demo snap buffer and mem copy
Adding the snap to the demo is the last usage of `pTmpBuffer3`
all prior usages of it copy the data if needed.
So we can edit it in place. No need to copy it into a new buffer.
2024-04-04 07:38:52 +08:00
Robert Müller 3c6fce376d Remove unused CTextCursor variable 2024-04-03 22:01:10 +02:00
Dennis Felsing e263ce9bdc
Merge pull request #8181 from dobrykafe/pr-discord-activity
Show Discord activity when offline
2024-04-03 05:35:16 +00:00
Dennis Felsing 7286a05dd4
Merge pull request #8182 from furo321/ec-password
Specify that `ec_password` is required to be set for econ to be enabled
2024-04-03 05:34:40 +00:00
furo ff1b1ae7b0 Specify that ec_password is required to be set for econ to be enabled 2024-04-03 00:24:24 +02:00
dobrykafe 990bb9b1ef show discord activity when offline 2024-04-02 23:57:17 +02:00
Robert Müller 44cd59379d Improve layout of settings menus and restart message
Remove unnecessary, inconsistent margin at the top of all settings menus.

Reserve space for restart message and button only when necessary, so more height is available for settings menus per default.

Improve vertical alignment of restart message and button with settings menus.

Ensure consistent margin on all sides of settings menus.
2024-04-02 21:28:15 +02:00
Robert Müller 7727628eeb Improve layout of Appearance settings
Use consistent margins for all settings pages and titles.

Fix chat preview overlapping with the restart warning.

Simplify layout code. Remove array of `CButtonContainer`s with arbitrary size and use individual variables instead.
2024-04-02 21:28:15 +02:00
Robert Müller 1a9f15d11b Render loading popup also while loading demo files
As this can take a few seconds for large demos.
2024-04-01 16:44:10 +02:00
Zwelf 467a3187dc Simplify and fix HookBase calculation
Saw this while implementing TwGame. Increase teehistorian version_minor
to make replaying teehistorian files easier.
2024-04-01 12:58:41 +02:00
Dennis Felsing 9122080514
Merge pull request #8170 from Robyt3/Gameclient-Render-Checks
Improve performance when rendering menus
2024-04-01 03:58:07 +00:00
Dennis Felsing 295b095d29
Merge pull request #8167 from Robyt3/Client-Rcon-Username-State-Fix
Fix rcon username not reset when disconnecting while connecting
2024-04-01 03:06:10 +00:00
Dennis Felsing c9f0075330
Merge pull request #8166 from Robyt3/Browser-Favorite-Communities-Increase
Increase maximum number of favorite communities from 3 to 5
2024-04-01 03:00:26 +00:00
Robert Müller 2790530bbe Increase maximum number of favorite communities from 3 to 5
Simply hide the favorite community tabs in the offline server browser with screen resolutions where not enough width is available.

The ingame server browser can always show at least 5 favorite community tabs with all screen resolutions.
2024-03-31 20:17:51 +02:00
Robert Müller b730d9d890 Improve performance when rendering menus
Skip rendering various client components (players, ghosts, nameplates, HUD etc.) while not ingame to improve performance. This increases FPS when rendering the start menu by around 300-400 both in debug and release builds.

This also fixes potential crashes when components using the map data where rendered while the client is loading a new map.
2024-03-31 15:30:19 +02:00
Robert Müller a287669500 Reset tuning of dummy and main when disconnecting
Instead of only resetting the tuning for either one which is currently active.
2024-03-31 12:48:43 +02:00
Robert Müller 830e8fea8c Fix rcon username not reset when disconnecting while connecting
The rcon username requirement was not reset correctly when disconnecting from a server while connecting/loading, at which point the `NETMSG_RCONTYPE` message has already been received.

Closes #4170.
2024-03-31 11:17:29 +02:00
Edgar 8412d2be6e
Merge pull request #8160 from edg-l/incl_algo
include algorithm in jobs.cpp, try to fix #8159
2024-03-30 10:46:57 +00:00
murpii ed90392636 Refresh the jumps after teleporting 2024-03-29 13:40:45 +01:00
Edgar 78cb4d4373
include algorithm in jobs.cpp, try to fix #8159 2024-03-28 20:14:16 +01:00
Robert Müller 2b8af7f40f Pass arguments as CImageInfo to graphics functions
Pass `CImageInfo` arguments to various graphics and text render functions instead of passing the components (data pointer, width, height, format/pixel size) of the image info separately.

Pass texture/file name to loading functions when available to improve error/warning messages.
2024-03-27 21:12:02 +01:00
Robert Müller 8218dbb6f8 Add CImageInfo::DataSize convenience function
To calculate the size of the image data based on its width, height and pixel size.
2024-03-27 21:12:02 +01:00
Robert Müller b4a22e2fee Refactor client state handling in menus
Split menu rendering explicitly by client state. This makes the code more readable by not mixing code for rendering different states together as much and fixes issues where the menu was being rendered inconsistently for one frame when the state is changed, at the cost of some additional duplicated code.

The fullscreen popups shown when in the connecting and loading client states are now hard-coded for these states, instead of being mixed together with the other fullscreen popups, which can be shown when offline, ingame or during demo playback.

As a side effect of rendering the demo controls like the regular menu, the UI color will now also affect the demo controls menu background.

Move `CBackground::ChangePosition` calls inside functions to reduce duplicate code and improve readability.

Remove unnecessary `CMenus::m_ActivePage` variable.

Closes #7834.
2024-03-25 20:48:52 +01:00
Dennis Felsing 58ee780fa7
Merge pull request #8155 from ChillerDragon/pr_add_missing_includes
Add missing includes
2024-03-25 07:51:18 +00:00
ChillerDragon e4c136d324 Add missing includes 2024-03-25 14:24:08 +08:00
Robert Müller 015390a51e Fix recursive folder creation with mixed slashes and drive letters
The function `fs_makedir_rec_for` for recursively creating folders did not handle paths containing backslashes correctly and only created folders after every occurrence of a regular slash. This could cause the recursive folder creation to fail when a parent folder is not created before the child folder. For example when recursively creating folders for the path `D:\Games/DDNet\downloadedskins`, the `DDNet` folder was not being created because this path segment does not end in a forward slash. Now, backslashes are handled the same as regular slashes, which is consistent with the other filesystem functions.

Additionally, the function tried to create folders for drive letters on Windows (e.g. `C:` and `D:`). Trying to create a system drive as a folder will fail due to access being denied, whereas it seems to work for already existing non-system drives. For example when recursively creating folders for the path `C:/Games/DDNet/downloadedskins`, the `C:` "folder" could not be created which caused the entire operation to fail. Now, the function will not try to create folders for drive letters anymore, i.e. if the name of the to be created folder ends with `:`.

Closes #8148.
2024-03-24 12:33:56 +01:00
Dennis Felsing 7e8dc57194
Merge pull request #8150 from furo321/freezebar-fix
Fix freeze bar not being correct after returning from pause
2024-03-23 23:26:04 +00:00
Dennis Felsing a4aafb78bd
Merge pull request #8147 from dobrykafe/pr-fix-style
`fix_style.py`: check for newline at the end of source files
2024-03-23 23:24:02 +00:00
Dennis Felsing eefcb83a4f
Merge pull request #8144 from Robyt3/Client-Skin-Reset-Cleanup
Use `CTeeRenderInfo::Reset`
2024-03-23 23:22:44 +00:00
c0d3d3v ab3991f821 fix freeze bar not beeing correct after returning from pause
m_FreezeStart is now corrected by the ticks the character was paused
Possible physical changes: Until now it was possible if you sit inside freeze to re-freeze instant
after unpause. Now you re-freeze after the second that was dawned before
the pause. I do not excpect that this is used on any map, and it did not
bring any benifit.
2024-03-23 23:05:14 +01:00
dobrykafe 6175022e39 add missing newline at EOF 2024-03-23 16:01:16 +01:00
Robert Müller 134961015a Fix more variable names (GPU -> Gpu, ID -> Id) 2024-03-23 12:06:31 +01:00
Robert Müller 4d6a00d827 Use CTeeRenderInfo::Reset
To reduce duplicate code and ensure all members are reset.
2024-03-23 11:57:08 +01:00
ChillerDragon e2c02eaf7b Remove useless operation in CUIRect SplitMid 2024-03-22 15:50:38 +08:00
Robert Müller f05bbc226a Fix envelope points not clickable after opening bezier popup
Closes #8017.
2024-03-21 21:12:31 +01:00
Corantin H ad07be1492 Fix wrong array indexing in undo action label (fixes #8135)
`Result` was not the correct variable to use to index the operation names array, instead it should be what is returned from the selection popup.
2024-03-21 18:25:48 +01:00
Dennis Felsing 21d0d69bec
Merge pull request #8133 from dobrykafe/pr-more-settings
Include more options in appearance settings
2024-03-20 22:43:28 +00:00
dobrykafe 2a31ff1998 include more options in settings 2024-03-20 23:20:04 +01:00
Dennis Felsing f169899083 serverbrowser: communities->servers instead of communities->icon->servers 2024-03-20 12:28:41 +01:00
Robert Müller c9439eac36
Merge pull request #8102 from archimede67/editor-fix-save-missing-layers
Editor: allow saving empty quads & sounds layers
2024-03-18 22:13:34 +00:00
archimede67 95402b9559
Merge pull request #8126 from Robyt3/Engine-LineReader-UTF8-Check
Ensure line reader only returns lines which are valid UTF-8, refactoring
2024-03-18 21:19:37 +00:00
Corantin H a5a4d50237 Allow saving empty quads & sounds layers 2024-03-18 22:06:26 +01:00
Robert Müller 2a99c81721
Merge pull request #8123 from archimede67/editor-fix-autorules-crash
[Editor] Fix crash when trying to select autorule with arrow keys
2024-03-18 20:41:06 +00:00
Robert Müller 010d4dc673 Remove unnecessary UTF-8 check for config variables
Invalid UTF-8 will not be read from config files with `CLineReader` anymore and the local console never allowed entering invalid UTF-8, so this additional mangling of invalid UTF-8 string config variable values is unnecessary.
2024-03-18 21:29:43 +01:00
Robert Müller e0e6bbbbe2 Minor cleanup of CLineReader
- Use `nullptr` instead of `0`.
- Use `\0` instead of `0`.
- Move variable declaration.
2024-03-18 21:29:41 +01:00
Robert Müller 0f94d0d72c Ensure line reader only returns lines which are valid UTF-8
Skip lines containing invalid UTF-8 in `CLineReader::Get` function.
2024-03-18 21:29:34 +01:00
heinrich5991 3f70ae4b70
Merge pull request #8115 from Robyt3/Client-Mapimages-Refactoring
Various refactoring of `CMapImages`
2024-03-18 00:08:30 +00:00
Corantin H d506dc4fa9 Support navigating in selection popups with arrow keys 2024-03-17 19:44:12 +01:00
Corantin H 72029e4105 Prevent switching layer selection while popup is open 2024-03-17 15:35:32 +01:00
archimede67 47d77fad07
Merge pull request #8120 from Robyt3/UI-Color-Picker-Line-Improvement
Support clicking line color picker label to toggle checkbox
2024-03-17 10:56:31 +00:00
Robert Müller d7f3c4fb6d
Merge pull request #8118 from dobrykafe/pr-nameplates-strong
`ClNameplatesStrong` improvements
2024-03-17 10:43:24 +00:00
Robert Müller 67329acae9 Support clicking line color picker label to toggle checkbox
Closes #8117.
2024-03-17 11:37:40 +01:00
archimede67 d853a17f20
Merge pull request #8119 from Robyt3/UI-String-Fix
Fix replacement of `UI` with `Ui` in strings
2024-03-17 10:33:28 +00:00
Robert Müller bef399f296 Fix replacement of UI with Ui in strings 2024-03-17 11:16:14 +01:00
dobrykafe 19ea53998f show nameplates strong indicator from perspective of spectated player 2024-03-17 11:13:44 +01:00
dobrykafe 7f4974616a fix nameplates strong indicator 2024-03-17 11:11:51 +01:00
Robert Müller d57a2d490e Extract IsValidTile function 2024-03-17 10:48:08 +01:00
Dennis Felsing f3c246f622
Merge branch 'master' into pr_ddnet_http_age_crash 2024-03-16 23:23:35 +01:00
Robert Müller 033b659570 Avoid unnecessary calculations for invalid tiles
Only calculate offsets for valid tiles when the offsets will be used.
2024-03-16 22:33:58 +01:00
Robert Müller f1deec2c84 Rename variables i to ModType and n to LayerType 2024-03-16 22:33:58 +01:00
Robert Müller 29d924e061 Simplify handling of entities paths, remove unnecessary variables 2024-03-16 22:33:57 +01:00
Robert Müller c97c3ac7b1 Extract GetEntitiesModType function 2024-03-16 22:33:57 +01:00
Robert Müller 01daa919e8
Merge pull request #8113 from furo321/eye-emote
Remove `(until you die)` part from `/eyeemote off`
2024-03-16 20:46:43 +00:00
heinrich5991 790c73bffe
Merge pull request #8098 from Robyt3/Graphics-ImageInfo-Free
Replace `IGraphics::FreePNG` with `CImageInfo::Free`
2024-03-16 20:14:02 +00:00
heinrich5991 03aab986fe Fix crash when the serverlist request fails
We're not allowed to look at `ResultAgeSeconds` when the state is
`EHttpState::ERROR`.

Fixes #8107.
2024-03-16 21:12:47 +01:00
furo 7043a59bc3 Remove (until you die) part from /eyeemote off 2024-03-16 21:10:21 +01:00
Robert Müller 11aba0e38d Replace IGraphics::FreePNG with CImageInfo::Free
The engine graphics do not need to be involved with freeing image data.

The `Free` function now also ensures that all other member variables are cleared when freeing the image data.
2024-03-16 20:55:22 +01:00
Robert Müller 722b5f8d11 Comment out verbose serverbrowser HTTP log message
The `unknown address` log message got printed very often because many servers have 0.6 and 0.7 addresses but only 0.6 addresses are considered valid by the client.
2024-03-16 20:54:56 +01:00
Robert Müller 4f4284ba2a Fix typo in serverbrowser HTTP log context 2024-03-16 20:54:56 +01:00
Robert Müller 24caf08d84 Minor refactoring of net_addr_from_url
- Remove unnecessary branch and temporary variable usage at the end of the function.
- Move variable declarations closer to usages.
2024-03-15 18:40:03 +01:00
Robert Müller 6df1d251d7
Merge pull request #7947 from ChillerDragon/pr_coll_tele
Move tele vector init from gamecontroller to collision
2024-03-14 17:02:09 +00:00
Dennis Felsing 681b66b563 Version 18.1 2024-03-14 17:14:07 +01:00
heinrich5991 ff7b6ffe14 Take serverlist age into account when choosing master
Prefer masters with newer server lists, and try re-selecting the chosen
master if the result is older than 5 minutes.
2024-03-14 12:31:41 +01:00
heinrich5991 5603d284bf Parse Date and Last-Modified HTTP headers 2024-03-14 12:31:41 +01:00
heinrich5991 2d17097c91 Use log_* instead of Console()->Log() in HTTP serverbrowser 2024-03-14 11:19:32 +01:00
ChillerDragon 4da4ca5bdd Make tele getters const 2024-03-14 08:50:35 +08:00
ChillerDragon 552d466197 Move tele vector init from gamecontroller to collision 2024-03-14 08:46:22 +08:00
Robert Müller ae9a8fe3d4 Support overlapping scroll regions, always allow mouse scrolling
Support scrolling all scroll regions with the mouse wheel also while popup menus are open. Support overlapping scroll regions by always scrolling the top-most hovered scroll region on mouse wheel events.

The hot scroll region is now tracked separated by `CUi`, as tracking the IDs of all UI elements which are contained in scroll regions is not feasible. The separate active state for scroll regions is therefore unnecessary.

It's still necessary to disable `CListBox`es when popup menus are open, to ensure that only one list box consumes the key events.

Closes #8087. Supersedes #8090.
2024-03-12 22:15:20 +01:00
Robert Müller f291362d88 Revert name of enum literal Ui back to UI
This `enum` literal was accidentally included in the renaming of the `UI` function to `Ui`.
2024-03-12 21:49:00 +01:00
heinrich5991 8108cb04fd Inform HTTP map download of the map size 2024-03-11 17:50:51 +01:00
heinrich5991 dd5ddf07a4 Disconnect when we get map change with invalid parameters
This is the only sane thing we can do, the server will have changed its
map and we can't pretend to still be on the old one.
2024-03-11 17:50:12 +01:00
Dennis Felsing 3489131d78
Merge pull request #8085 from dobrykafe/pr-timecp
Improve `/timecp` chat command
2024-03-11 07:34:54 +00:00
Dennis Felsing 621b201acf
Merge pull request #8086 from furo321/browser-login-filter
Add a `No login required` filter
2024-03-11 07:33:21 +00:00
furo 40f641b0a6 Add a No login required filter 2024-03-11 02:09:16 +01:00
dobrykafe 35c45cf869 improve /timecp chat command 2024-03-11 00:36:07 +01:00
furo 1cee65a980 Document usage of ~ for /tpxy in help text. 2024-03-10 21:44:40 +01:00
heinrich5991 3805ffba86
Merge pull request #8073 from Robyt3/Gamecore-Str-Validation
Add validation for `StrToInts` and `IntsToStr`
2024-03-10 13:48:08 +00:00
Robert Müller 02f60421f9 Add validation for StrToInts and IntsToStr
Add strict validation for `StrToInts` function. Because this function should only be used with trusted internal strings, assertions are added to ensure that the string is not truncated. Some buffer sizes are adjusted accordingly, so truncation cannot happen.

Add less strict validation for `IntsToStr` function. An additional argument specifying the size of the output buffer is added to assert that the size of the output buffer is sufficient. However, because this function is used to decode data sent by the server and read from maps and ghosts, invalid input data should never result in crashes or invalid UTF-8 strings. The function will now unpack an empty string and return `false`, if the string contains invalid UTF-8.

The inline definition of the functions is not wanted, because it requires adding a `system.h` include in `gamecore.h`. Therefore the tools now have to depend on game-shared, which previously only worked because the functions were inline.

Tests are added to ensure the function still behaves the same as before for valid inputs and correctly handles invalid inputs.
2024-03-10 12:49:56 +01:00
Robert Müller bff5247746 Ensure commands executed via Econ are valid UTF-8
`CNetConsole` will now ignore received lines containing invalid UTF-8 codepoints. Previously, it was possible to crash the server on Windows with Econ commands like `exec <invalid UTF-8>`.
2024-03-10 11:23:42 +01:00
Robert Müller b67263107d Use uint8_t * consistently for raw image data
Previously, usage of `void *`, `unsigned char *` and `uint8_t *` was mixed in various places for pointers to raw image data and the pointers ended up being cast to `uint8_t *` at some point anyway. Now only `uint8_t *` is used consistently, which improves type safety and readability. Casts to `uint8_t *` are now only necessary when using `malloc` or when reading data from a map.
2024-03-09 13:31:53 +01:00
Robert Müller 3073934df1 Show completion options for bind key names in console
Show completion options for key names for all bind commands (`bind`, `binds`, `bind_reset`) in the local console.

At the moment this only works for completing the first key name but not for composite binds that use `+`, which would work differently than other console argument completion.

Unnamed keys (starting with `&`) are not shown as completion options.

Refactor console argument completion to reduce duplicate code.
2024-03-08 21:54:22 +01:00
heinrich5991 1afdf47362
Merge pull request #8072 from furo321/practice-helptext
List all practice commands when enabling `/practice`
2024-03-07 00:14:36 +00:00
furo 209df982f8 List all practice commands when enabling /practice 2024-03-07 00:57:21 +01:00
archimede67 de956c8db9
Merge pull request #8071 from dobrykafe/pr-popup-image-height
Editor: Make embedded image popup bigger at all times
2024-03-06 22:47:38 +00:00
dobrykafe 0b03bc7a16 make embedded image popup bigger at all times 2024-03-06 23:27:50 +01:00
Robert Müller 3656c95eca Ensure commands executed via FIFO are valid UTF-8 2024-03-06 22:01:10 +01:00
Dennis Felsing b6689bc012
Merge pull request #8068 from heinrich5991/pr_ddnet_job_atomics
Fix race conditions in job state handling
2024-03-05 21:57:11 +00:00
heinrich5991 e7717f2265 Fix race conditions in job state handling
We want to change the state of the job from `STATE_QUEUED` to
`STATE_RUNNING`, but not from `STATE_ABORTED`. Previously, the code
usedd `exchange` to change the state and compared non-atomically
afterwards. This led to `STATE_ABORTED` being replaced by
`STATE_RUNNING` in a race. With `compare_exchange_strong`, this can no
longer happen.

Fixes #8044.
2024-03-05 20:55:44 +01:00
Robert Müller 9323e18616 Fix HTTP client shutdown and deadlock on request error
Fix HTTP client effectively shutting down by entering the `ERROR` state when a request cannot be added. Now only the invalid request is aborted immediately. The `ERROR` state is now only entered when a curl function fails in a way where recovery is not possible.

Fix occasional deadlock when HTTP client is shutting down after entering the `ERROR` state, by also immediately aborting new requests when the HTTP client is already in the `ERROR` state.

Remove unused `CHttp::EState::STOPPING`.
2024-03-05 19:48:45 +01:00
Dennis Felsing f3de37d9d4
Merge pull request #8019 from heinrich5991/pr_ddnet_rename_variables
Rename all variables for strict camel-casing of abbreviations
2024-03-05 16:06:58 +00:00
heinrich5991 44bf0134f0
Merge pull request #8065 from dobrykafe/pr-solo-practice-bug
Fix practice mode not resetting after disconnect on solo servers
2024-03-05 15:20:34 +00:00
heinrich5991 17402cc43f Rename all variables for strict camel-casing of abbreviations
This is the strict version, ID → Id, UI → Ui, except DDNet which stays
DDNet.

This would fix #7750.

Done using a naive rename script (for bash, use `shopt -s globstar`):

```fish
sed -i \
	-e 's/\([a-z]_\?\)ID/\1Id/g' \
	-e 's/\([^ ]\)\<UI\>/\1Ui/g' \
	-e 's/UI()/Ui()/g' \
	-e 's/\<CUI\>/CUi/g' \
	-e 's/\([\ta-z.(&]\|[,=|] \)ID\>/\1Id/g' \
	-e 's/\<ID\>\([^ ").]\)/Id\1/g' \
	-e 's/\<ID\([0-9]\)/Id\1/g' \
	-e 's/\<ID\>\( [<=>:+*/-]\)/Id\1/g' \
	-e 's/int ID/int Id/g' \
	-e 's/\([a-z]_\?\)GPU/\1Gpu/g' \
	-e 's/\([a-z]_\?\)IP/\1Ip/g' \
	-e 's/\([a-z]_\?\)CID/\1Cid/g' \
	-e 's/\([a-z]_\?\)MySQL/\1Mysql/g' \
	-e 's/MySql/Mysql/g' \
	-e 's/\([a-xz]_\?\)SQL/\1Sql/g' \
	-e 's/DPMode/DpMode/g' \
	-e 's/TTWGraphics/TTwGraphics/g' \
	\
	-e 's/Ipointer/IPointer/g' \
	-e 's/\.vendorId/.vendorID/g' \
	-e 's/\.windowId/.windowID/g' \
	-e 's/SDL_GetWindowFromId/SDL_GetWindowFromID/g' \
	-e 's/SDL_AudioDeviceId/SDL_AudioDeviceID/g' \
	-e 's/SDL_JoystickId/SDL_JoystickID/g' \
	-e 's/SDL_JoystickInstanceId/SDL_JoystickInstanceID/g' \
	-e 's/AVCodecId/AVCodecID/g' \
	src/**/*.cpp src/**/*.h {datasrc,scripts}/**/*.py
git checkout -- src/engine/external
```

I like this option because it presents clear rules.

Still needs fixups because of the naive replacement, I'd do this if we
want this merged.
2024-03-05 15:44:09 +01:00
dobrykafe d94d020c25 fix practice mode not resetting after disconnect on solo servers 2024-03-05 14:08:30 +01:00
heinrich5991 c15733eda3
Merge pull request #8063 from heinrich5991/pr_ddnet_register_error
Show error from masterserver in console
2024-03-04 23:08:25 +00:00
heinrich5991 12409e545c Show error from masterserver in console
Allows people to see why masterserver registering failed.
2024-03-04 21:58:30 +01:00
Robert Müller dd94da67fb Hide tune_zone command in local console
Prevent the `tune_zone` command from being shown and used in the local console, which could cause issues with prediction, by only registering it as a game setting but not as a client command. The command callback is still correctly called when map settings are loaded in the `CGameClient::LoadMapSettings` function.
2024-03-04 21:26:47 +01:00
Robert Müller bfa5bc2b3c Remove remaining hard-coded server commands from client-side
Followup for #7919.
2024-03-04 21:26:41 +01:00
heinrich5991 e851c78e47 Don't show the git revision twice in server log
Previously:
```
2024-03-03 12:17:40 I git-revision: 885ae7ecae
2024-03-03 12:17:40 I server: version 18.0.3 on linux amd64
2024-03-03 12:17:40 I server: git revision hash: 885ae7ecae
```
2024-03-04 16:50:45 +01:00
Dennis Felsing 70eca3869a
Merge pull request #8051 from dobrykafe/pr-serverbrowser-friends-sort
Add sorting by number of friends to the server browser
2024-03-04 07:27:48 +00:00
Robert Müller 6b3e16ea82 Fix client crash due to truncated skin name 2024-03-03 18:18:49 +01:00
dobrykafe 13f324ccf4 add sort by number of friends to server browser 2024-03-03 02:01:28 +01:00
Dennis Felsing c0e4a4c3f2
Merge pull request #8002 from dobrykafe/pr-change-info-countdown
Show countdown message in player/tee settings for `sv_info_change_delay`
2024-03-02 13:02:06 +00:00
Dennis Felsing 968d08c716
Merge pull request #8026 from Robyt3/Base-Threading-Error-Handling
Add assertions to all thread and semaphore functions
2024-03-02 13:00:58 +00:00
Dennis Felsing 5d070ec5c3
Merge pull request #8043 from Robyt3/Editor-Envelope-Point-Color-Fix
Fix editor crash when right-clicking bezier control points
2024-03-02 12:50:42 +00:00
Robert Müller 350acae56b
Merge pull request #8041 from Jupeyy/pr_small_alloc_fix_vk
Search __most__ fitting allocation, not _first_ fitting
2024-03-02 12:36:48 +00:00
Robert Müller 6895cdc343 Fix editor crash when right-clicking bezier control points
The color selection should only be shown for normal envelope points but not for bezier control points, because it always changes the previously selected normal envelope point. This caused the client to crash when right-clicking a bezier control point when no normal envelope point was previously selected.

Closes #8020.
2024-03-02 13:16:26 +01:00
Jupeyy ec39742017 Search __most__ fitting allocation, not _first_ fitting 2024-03-02 13:12:58 +01:00
Robert Müller 209a367ab2 Fix editor color picker when Vulkan image blitting used
When image blitting is supported by the Vulkan backend, the color picker was reading incorrect pixel values, because the offset positions for the blitting region are the positions of the top-left and bottom-right corners, but instead the top-left offset and size (width, height) were passed as arguments.

Closes #8040.
2024-03-02 12:32:11 +01:00
Robert Müller 52da715858 Minor refactoring of CClient::SetState
- Rename parameter `s` to `State`.
- Only print debug message if new state is different from old state.
- Reduce indentation.
2024-03-01 18:58:41 +01:00
Robert Müller dd09834f32 Always build switch entities layers
Only building the switch entities layer when the current map has a switch layer (#8011) also does not work, because the entities textures are cached for each type and not reloaded unless the entities are changed manually. First joining a server with a map that does not have a switch layer will cause the textures for the type of that server to be built without the switch entities layer, so the switch entities texture will be missing when joining a server of that type with a map that does have a switch layer.

Instead, the switch entities layer textures are always built now, so the cached entities textures are can be used on all maps of the respective server type. This is expected to slightly increase the total memory usage after joining multiple servers of different types. As before, tiles which are unused are masked unless `m_DontMaskEntities` is set.
2024-02-29 21:45:53 +01:00
bencie 26cc7dde2f Refactor 2024-02-29 18:37:39 +01:00
bencie 2868b3cdf6 Let users pick background entities map without file extensions 2024-02-29 18:13:50 +01:00
Robert Müller be9411b262
Merge pull request #8031 from dobrykafe/pr-emotional-tees
fix incorrect usage of `SvEmotionalTees`
2024-02-29 16:06:43 +00:00
dobrykafe d2b2071bda fix incorrect usage of SvEmotionalTees 2024-02-29 16:47:58 +01:00
dobrykafe 720572ddda make chat command arguments case-insensitive when possible 2024-02-29 01:17:11 +01:00
heinrich5991 9620a9d3d9
Merge pull request #8029 from Robyt3/Menus-RenderPopupFullscreen-Function
Extract `CMenus::RenderPopupFullscreen` function
2024-02-28 22:39:29 +00:00
Robert Müller 6080cffcbb Extract CMenus::RenderPopupFullscreen function
Improve readability of the `CMenus::Render` function by extracting the code for rendering the fullscreen popups into a separate function.
2024-02-28 22:53:51 +01:00
Robert Müller 8d774fa48c Define Windows header macros only once in CMakeLists.txt
Instead of defining the macro `WIN32_LEAN_AND_MEAN` and sometimes also the macro `_WIN32_WINNT` in each file that directly or indirectly includes `<windows.h>`, only define these macros once consistently in `CMakeLists.txt`.

Also define `NTDDI_VERSION`, which is the new macro to specify the minimum Windows version starting with Windows Vista. This macro needs to be defined in addition to old `_WIN32_WINNT` macro, according to the documentation.

See https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers
2024-02-28 21:40:28 +01:00
Robert Müller 4ceb376969 Add assertions to all thread and semaphore functions
Assert on failures in all `thread_*` and `sphore_*` functions on all operating systems instead of only printing log messages on Unix, as these functions are only expected to fail when used with incorrect arguments or in some cases when a dead-lock is detected.

On macOS, `sphore_wait` was not correctly calling `sem_wait` in a loop to repeat the wait operation if it is interrupted by a signal.

On Windows, the AIO tests were failing with the additional assertions. The maximum count that semaphores on Windows could be incremented to was previously, arbitrarily limited to 10000, which was causing the `ReleaseSemaphore` call to fail as the AIO semaphore is signaled 65536 times (for each write operation) in multiple of the AIO tests.
2024-02-27 22:14:56 +01:00
Robert Müller ecfc18d129 Minor refactoring of bezier curve evaluation
- Remove `ValidateFCurve` function because it's small and only used once.
- Remove unnecessary checks in `SolveBezier`, as all of these conditions are already checked before the function is called.
- Remove unnecessary double negation of `InTang` to improve readability.
- Use `double` literals for `double` comparisons instead of `float` literals.
- Fix comments.
2024-02-26 20:43:35 +01:00
Robert Müller 47a8156ca8 Fix inaccurate evaluation of bezier curve envelopes
There is no need to divide the times by 1000 when evaluating bezier curves, as all times are relative and the division adds significant inaccuracy, to the point where evaluation of bezier curves goes completely wrong in some cases.

Closes #8005.
2024-02-26 20:43:21 +01:00
Robert Müller cc1d43e5a0 Fix division by zero when envelope point times overlap
Effectively skip envelope points whose start time is equal to the start time of the next envelope point.
2024-02-26 20:43:12 +01:00
Robert Müller 5aab9969ce Fix first envelope line segment not being rendered in editor
Rendering was started with the second line segment after one time step has already passed.
2024-02-26 20:42:58 +01:00
Robert Müller 7c4d51f111
Merge pull request #8016 from dobrykafe/pr-save-replay-improve
Improvements regarding `save_replay`
2024-02-26 18:39:20 +00:00
dobrykafe 91349e4cae add error handling for CDemoEdit job 2024-02-26 18:44:11 +01:00
dobrykafe 268b79cb61 handle invalid filename for save_replay 2024-02-26 18:43:51 +01:00
Robert Müller 2258cbca57
Merge pull request #8007 from heinrich5991/pr_ddnet_vital_ping
Respond to pings sent as vital messages with vital pongs
2024-02-26 12:22:46 +00:00
Robert Müller 6cdfa35727 Allow background jobs to be aborted, refactoring
Add `IJob::Abortable(bool)` function which jobs can call to specify whether they can be aborted. Jobs are not abortable per default. Abortable jobs may have their state set to `IJob::STATE_ABORTED` at any point if the job was aborted. The job state should be checked periodically in the `IJob::Run` function and the job should terminate at the earliest, safe opportunity when aborted. Scheduled jobs which are not abortable are guaranteed to fully complete before the job pool is shut down. However, if the job pool is already shutting down, no additional jobs will be enqueue anymore and abortable jobs will immediately be aborted.

In particular, the sound loading, community icon loading, master chooser and host lookup jobs are specified as being abortable. Conversely, the jobs saving replay demos, editor maps and screenshots are expected to finish before the client is shut down.

When the client is quitting/restarting, it will now disconnect from the current server first, before saving the config, to ensure that any actions that happen on disconnect (demo recorders being stopped etc.) happen first. The shutdown message is rendered before disconnecting and waiting for background jobs to finish.

The HTTP client is now initialized later during server launch, after the network initialization. Error handling is added and the server stops if the HTTP client could not be initialized, same as the client.

The `RunBlocking` functions are removed, as they are not used anymore after curl-multi was added.

The function `IJob::Status` is renamed to `State` and `IJob::STATE_PENDING` is renamed to `STATE_QUEUED` for consistency with naming of the HTTP client.

The member variables of the engine interface are encapsulated and the `jobs.h` include is removed from `engine.h`, which removes transitive includes of `system.h`.

Documentation for all job and job pool API is added.
2024-02-25 17:03:45 +01:00
Jupeyy 6bfd565a7c
Merge pull request #7995 from edg-l/some_updates
update ci actions, update rust edition to 2021 since our MSRV covers it
2024-02-25 15:11:54 +00:00
Edgar 0e0ebe9aea
update ci actions, update rust edition to 2021 since our MSRV covers it 2024-02-25 15:55:10 +01:00
archimede67 95e51db753
Merge pull request #8014 from furo321/case-insenstive-command-chat
Make chat commands completion case-insenstive
2024-02-24 18:30:43 +00:00
furo f3a277c365 Make chat commands completion case-insenstive 2024-02-24 18:11:26 +01:00
Dennis Felsing 59a734ce3f
Merge pull request #8010 from Robyt3/Map-Envelope-Render-Refactoring
Improve envelope evaluation and validation
2024-02-23 23:07:22 +00:00
Robert Müller 835001058b Always build switch entities layer when map has switch layer
Instead of only building the switch entities when the server uses the DDNet/DDrace type. Fix switch entities not being shown anymore on servers which do not mask entities. Regression from #7979.
2024-02-23 21:37:46 +01:00
Robert Müller ab3c6c4353 Improve envelope evaluation and validation
Call `EnvelopeEval` functions directly instead of passing them and their arguments to `CRenderTools::RenderTilemap` and `CRenderTools::RenderTileRectangle`.

Only evaluate color envelopes for tiles layers once instead of separately for the opaque and transparent passes.

Only evaluate relevant number of envelope channels instead of always evaluating all channels.

Avoid unnecessary calculations by only evaluating position envelopes for quads which are not fully transparent.

Fully ignore layer color and envelope color for entities layers, as these cannot be specified in the editor and should not be changeable.

Remove duplicate and insufficient checks for invalid envelope index before calling `EnvelopeEval`. Instead, set the correct default for all channels before calling `EnvelopeEval` and only change the result on success. Now, white color will consistently be assumed for invalid color envelopes, zero positions and rotations for invalid position envelopes, and full volume for invalid sound envelopes.

Validate number of envelope channels to prevent crashes. When loading maps containing envelopes with invalid number of channels (not equal to 1, 3 or 4), the number of channels of these envelopes is reset to 4 and an error message is displayed, so the mapper can examine all channels' data and transfer it to another envelope if necessary. Closes #7985.
2024-02-23 19:24:34 +01:00
Robert Müller 040d7673c6 Remove dead code 2024-02-23 18:21:18 +01:00
Robert Müller 73c3636f3b Add color4_base::Multiply function 2024-02-23 18:21:17 +01:00
Robert Müller 7d7a45663f Improve layout of General settings page, refactoring
Use consistent margins for all settings pages and titles (except the Appearance settings, which will be covered in the future).

Fix checkbox UI element ID variable `s_LowerRefreshRate` not being `static`.

Improve readability of layout code.
2024-02-22 22:14:54 +01:00
heinrich5991 e69ea46982 Respond to pings sent as vital messages with vital pongs
Matching the requester allows "reliable" and "unreliable" pings.
"Reliable" pings suffer from re-sends, thus might not accurately reflect
the latency, "unreliable" pings might not arrive at all.
2024-02-22 11:18:12 +01:00
Robert Müller e50f8cfaa0 Fix client crash if cl_race_ghost_save_best 1 deletes last ghost
If the own ghost is the last element in the vector and deleted due to using the `cl_race_ghost_save_best 1` setting then the following accesses with index `Own` were out-of-bounds. Closes #8003.
2024-02-21 23:38:43 +01:00
Dennis Felsing 99ee3f4fb9
Merge pull request #8004 from furo321/teamcolors-fixes
Small fixes to `cl_chat_teamcolors`
2024-02-21 11:29:34 +00:00
furo da02be4a9f Remove cl_chat_teamcolors check from info messages. 2024-02-21 12:03:42 +01:00
furo ba3a6b4262 Enable cl_chat_teamcolors by default 2024-02-21 12:02:51 +01:00
dobrykafe 40329b7d2e show countdown in player/tee settings for sv_info_change_delay 2024-02-20 21:41:20 +01:00
heinrich5991 87f3740a61
Merge pull request #8001 from Robyt3/Http-Android-Fix
Fix incorrect variable used in Android-specific code
2024-02-20 20:29:14 +00:00
Robert Müller aa7a614c36 Fix incorrect variable used in Android-specific code
The function `curl_easy_setopt` expects a `CURL *`, but `pHandle` is a `void *`.
2024-02-20 21:11:26 +01:00
Robert Müller 386b00f18d Add has_finishes attribute to community info
Add mandatory Boolean attribute `has_finishes` to every community info, which specifies whether finishes can be shown for the community, regardless of whether any finishes are currently available for the player.

The community info must be adjusted when/before merging this, by adding the attribute `has_finishes` to every community object, with the value `true` for DDNet and `false` for all other communities.

Closes #7957.
2024-02-20 20:34:21 +01:00
Dennis Felsing 99c982e3e0
Merge pull request #7998 from Robyt3/Client-Skin-Loading-Refactoring
Validate skin names when loading, refactor skin loading
2024-02-19 22:56:58 +00:00
heinrich5991 9a95f3b1fd Add return value docs to DoEditBox* 2024-02-19 22:51:55 +01:00
Robert Müller 8adfb2f2ec Fix unlikely cases of skin blood color being wrong
The check before calling `normalize` incorrectly excludes skins containing zero in any color component instead of excluding only skins with zero in all components. The check can be removed entirely, because it is already checked inside the `normalize` function whether the length of the `vec3` is zero, in which case a zero `vec3` will be returned.

For very large skins which use large color values in at least one component, the `int` used for calculating the blood color could overflow.
2024-02-19 22:09:59 +01:00
Robert Müller 4eb0ffd701 Validate skin names when loading, refactor loading
Prevent skins with invalid names from being loaded/downloaded.

Improve log messages when skins cannot be loaded.

Remove obsolete check for duplicate skins, as the storage handles duplicate files already.
2024-02-19 22:09:59 +01:00
Robert Müller 9a24cf4e10 Ensure placeholder skin always exists and has valid metrics
Instead of adding the placeholder skin to the list of skins only when no skins have been loaded, always create the placeholder skin and use it only when no other skin is available.

Use reasonable values for skin metrics of placeholder skin to improve its rendering.
2024-02-19 22:09:59 +01:00
heinrich5991 bf0f699b42 ClientEmptyClientSlotEmpty
Makes it clearer to me, didn't know what an empty client is supposed to
be.

CC #7968
2024-02-19 21:36:21 +01:00
bencie 2240380b0e Unfreeze on rcon undeep 2024-02-19 17:45:30 +01:00
archimede67 4760ff71c7
Merge pull request #7991 from Robyt3/Client-Loading-Indicators
Render loading message/indicator for vote options and rcon commands
2024-02-18 19:03:23 +00:00
archimede67 8a98e70172
Merge pull request #7992 from furo321/no-cmdlist-rcon
Don't tell user about `/cmdlist` in rcon when using an unknown command.
2024-02-18 18:15:02 +00:00
furo 19796cdce4 Don't tell user about /cmdlist in rcon when using an unknown command. 2024-02-18 18:42:22 +01:00
Robert Müller ce81f7b45f Render loading message/indicator when receiving rcon commands
Render a progress spinner and message in the remote console while receiving rcon commands.
2024-02-18 18:15:33 +01:00
Robert Müller 1d0bb0dfcf Render loading message/indicator when receiving vote options
Render a progress spinner and message on the "Change settings" tab while receiving vote options.
2024-02-18 18:11:58 +01:00
Edgar e041c0a870
Merge pull request #7977 from dobrykafe/pr-expire-invites
Expire team invites on player disconnect
2024-02-18 15:24:01 +00:00
Edgar ea0827b5bd
Merge pull request #7987 from dobrykafe/pr-showfps-render
Don't show fps during demo render
2024-02-18 15:23:16 +00:00
Edgar f7b3cc7179
Merge pull request #7988 from Robyt3/Editor-Button-Refactoring
Refactor editor button functions: replace/remove `DoButton_File`, `DoButton_ButtonDec/Inc` and `DoButton_Menu`
2024-02-18 15:22:08 +00:00
Robert Müller ca56aa0b4a Replace DoButton_Menu with DoButton_Ex
This adds highlighting color when hovering the main menu buttons (File, Tools, Settings), which was previously missing for these buttons. This also reduced duplicate code.

Extract font size for menu buttons into constant `MENU` in new namespace `EditorFontSizes`.
2024-02-18 15:56:19 +01:00
Robert Müller 0da1743143 Avoid while loop for calculating console Y offset 2024-02-18 13:14:02 +01:00
Robert Müller bb650b85c4 Minor refactoring of console rendering variables
Remove temporary variables. Mark variables as `const` when possible. Avoid duplicate calculations. Use `bool` instead of `int`.
2024-02-18 13:12:20 +01:00
Robert Müller af99f5ba57 Replace DoButton_ButtonDec/Inc with DoButton_FontIcon/Ex
Use `DoButton_FontIcon` with `FONT_ICON_MINUS`/`FONT_ICON_PLUS` consistently instead of using `DoButton_ButtonDec/Inc` with text labels `+`/`-`.

For yes/no buttons, use `DoButton_Ex` and specify the button corners explicitly instead of using `DoButton_ButtonDec/Inc`.
2024-02-18 12:32:51 +01:00
Robert Müller 929765e95e Remove unused DoButton_File 2024-02-18 12:32:46 +01:00
dobrykafe 3ad0e233ee dont show fps during demo render 2024-02-18 04:01:40 +01:00
Robert Müller aded3f70a2 Fix editor UI locking up when dragging groups/layers quickly
Reset dragging operation when the dragged button has been unset and reset dragged button when operation has been reset, to prevent the editor from being stuck in either of two inconsistent states. This could be reproduced easily by clicking very quickly while moving the mouse up and down over the groups/layers list.

Do not call `CheckActiveItem` on a UI element (the dragged button) which might not be in view, as this prevents the UI from detecting the invalid active item, when groups/layers are dragged very far and quickly outside the scrollregion.

Closes #6855.
2024-02-17 13:14:13 +01:00
Robert Müller 886b417ed4
Merge pull request #7983 from archimede67/editor-fix-quads-2
Editor: fix quad snapping when grid is enabled
2024-02-17 09:42:59 +00:00
Robert Müller a720bb0c29
Merge pull request #7976 from ChillerDragon/pr_ed_hover_tiles_vector
[vector] Move select layer to editor component
2024-02-17 09:34:28 +00:00
Corantin H 87155d4a82 Fix logic for preferring grid over quad snapping 2024-02-17 10:16:09 +01:00
ChillerDragon 9134e31800 Move select layer to editor component
closed #7943
closed #7612
2024-02-17 12:06:04 +08:00
Robert Müller c729ccad32 Abort new HTTP requests immediately when shutting down CHttp
Immediately cancel new HTTP requests instead of enqueuing them when already shutting down `CHttp`. Otherwise, `CChooseMaster` may wait forever for HTTP requests to be completed while the client is shutting down, if `CHttp` was shutdown while `CChooseMaster` is not waiting for an existing HTTP request.

Not directly caused by #7962, but it made it more likely to happen.

Closes #7980.
2024-02-16 17:33:50 +01:00
archimede67 aae674897a
Merge pull request #7975 from ChillerDragon/pr_ed_wasd_speed
[editor] Increase WASD pan speed when holding down shift
2024-02-16 12:50:10 +00:00
Robert Müller fdf427db15 Fix entities textures not being built for non-DDNet/DDRace types
The combined entities texture for all layers except the switch layer was only built when the gametype has a front, speedup, tele or tune layer, which is only the case for servers declaring DDNet or DDRace type in their gameinfo. Now this entities layer is always built, as the game layer is always present.
2024-02-15 21:51:53 +01:00
dobrykafe 5dc8fe81e3 expire team invites on player disconnect 2024-02-15 21:37:51 +01:00
Robert Müller ab3445967d Fix assertion due to double-free of transparent texture
The transparent texture is reused for multiple entity layers and should never be unloaded.
2024-02-15 20:49:55 +01:00
Robert Müller 0a776b9062 Cleanup select layer UI element handling
Expose UI element ID for the main map editor as member variable so the select layer by tile funtionality can correctly be enabled when the map editor is the hot item.
2024-02-14 22:03:25 +01:00
ChillerDragon 7ec182b498 Increase editor pan speed when holding down shift 2024-02-14 08:43:21 +08:00
Dennis Felsing 5cb37c2e4a
Merge pull request #7974 from Robyt3/Menus-Tabs-Tooltips
Add tooltips for all icon-based menu and browser tabs
2024-02-13 23:51:30 +00:00
Robert Müller 639a5879a6 Add tooltips for all icon-based menu and browser tabs 2024-02-13 22:26:28 +01:00
Robert Müller 6c27894a63
Merge pull request #7973 from ChillerDragon/pr_ed_igfx
Remove indirect Graphics() access in BrushSelecting()
2024-02-13 21:03:17 +00:00
ChillerDragon 2f2b8f32fa Remove indirect Graphics() access in BrushSelecting() 2024-02-13 16:01:18 +08:00
Robert Müller 73011529cd Document all shell, OS, secure random and related functions
Add/update doxygen comments for all `shell_*`, `os_*`, `secure_*`, `cmdline_*`, `windows_*` and related functions.

Move `open_link` and `open_file` declarations to shell group, to the same relative position as their function definitions.
2024-02-12 23:05:21 +01:00
bencie 997fe8fa3b Add /solo and /deep as practice commands 2024-02-12 17:17:55 +01:00
Dennis Felsing c85be52409
Merge pull request #7968 from Robyt3/Server-Mod-Message-Fix
Make it less likely that antibot message is sent from random tees
2024-02-11 21:58:01 +00:00
Robert Müller be98c17738 Make it less likely that antibot message is sent from random tees
Instead of sending the message from the first client which is not ingame, choose the first client which is fully empty, to make it less likely that the message is sent from a currently connecting client.
2024-02-11 22:12:15 +01:00
Robert Müller f0e71219a9 Add placeholder country/type for servers without community
Add a country "none" with tee flag (code `-1`) and a type "None" for all servers without community.

Previously, the country and type for these servers was unset and their handling special-cased, so any non-empty country/type filter would exclude servers without country/type information. Now individual countries/types can be excluded without also excluding all servers without community.

Closes #7961.
2024-02-11 17:55:53 +01:00
Robert Müller e4e4227709 Fix filter excluding all items when right-clicking the only entry
It was possible to create a community/country/type filter excluding all entries when the list only contains one entry and right-click is used to deselect it.
2024-02-11 17:41:15 +01:00
Dennis Felsing 6d3bd36877
Merge pull request #7964 from ChillerDragon/pr_doc_ui_doeditbox
Document `DoEditBox()`
2024-02-11 14:47:47 +00:00
Robert Müller 8e2195ce16
Merge pull request #7963 from bencie/flag-search
Add flag search
2024-02-11 14:43:47 +00:00
bencie b5960f3fc3 Track filtered flags directly instead of their indices 2024-02-11 15:16:40 +01:00
ChillerDragon 74a9c39650 Document DoEditBox() 2024-02-11 17:47:02 +08:00
bencie 206a36a02a Add searchbar to flags tab in settings 2024-02-11 04:05:35 +01:00
Robert Müller 9d1ebe726c Quit client faster by aborting HTTP requests earlier
Shutdown `CHttp`, i.e. abort all HTTP requests, as early as possible when quitting/restarting the client, after the config has been saved but before shutting down the gameclient. Previously, this was delayed until the engine shutdown, so the requests would often finish entirely instead of being aborted by the callback.

Previously, HTTP requests being aborted due to `CHttp` shutting down were considered `EHttpState::ERROR`, which sometimes causes deadlocks during engine shutdown or destruction of `CHttp`. The state is now set to `ABORTED` by passing `CURLE_ABORTED_BY_CALLBACK` to `OnCompletionInternal`. The otherwise unused handling of internal errors is removed.
2024-02-10 22:38:42 +01:00
Robert Müller b2041f5703 Fix assertion due to incorrect HTTP request state
Previously, it was assumed `ResultJson` would return `nullptr` for HTTP requests which have been aborted or failed with an error, which would trigger the newly added assertion error "Request not done".
2024-02-10 22:38:10 +01:00
Robert Müller 399ba63a2c Fix incorrect check for aborted server list GET request result
The HEAD request result has already been checked above.
2024-02-10 22:37:54 +01:00
Corantin H 93120b83cf Call FlagModified only when property can affect automapper (fixes #7959)
Handle more cases for undoing auto automap
2024-02-10 12:15:28 +01:00
Dennis Felsing a7bbcf00a6
Merge pull request #7956 from archimede67/editor-fix-quads
Editor: fix several quads related issues
2024-02-09 23:13:30 +00:00
Robert Müller fe5b9d2dc9 Encapsulate CInfoMessages members 2024-02-09 21:35:35 +01:00
Robert Müller dda86b4624 Refactor info message creation
Add `CInfoMessages::CreateInfoMsg` function to create fully initialized info messages, to reduce duplicate code when creating info messages.
2024-02-09 21:35:14 +01:00
Robert Müller 4be56bb87d Refactor info message rendering
Improve readability of flag rendering code.

Add `ROW_HEIGHT` and `FONT_SIZE` constants.
2024-02-09 21:35:07 +01:00
Robert Müller 9295993190 Remove redundant text width calculation
Directly use the bounding box which has already been calculated for the text containers, instead of calculating the text width again for every info message text.
2024-02-09 21:34:45 +01:00
Robert Müller ebe60738d9 Refactor CInfoMessages::AddInfoMsg usage
Reduce duplicate code by moving screen remapping and validation of the info message into the `AddInfoMsg` function.

Check for valid kill message before creating text containers, so they are not created and deleted unnecessarily.

Assign info message type directly instead of passing it as a separate parameter.
2024-02-09 21:33:47 +01:00
Robert Müller 109b6bfb8e Refactor info message text container creation
Combine `CreateNamesIfNotCreated` and `CreateFinishTextContainersIfNotCreated` functions to `CreateTextContainersIfNotCreated` function to reduce duplicate code on usage.

Extract duplicate code for determining name color in info messages as lambda function.
2024-02-09 21:33:27 +01:00
Robert Müller 1683304acd Ensure skin info of finish messages is valid 2024-02-09 21:33:14 +01:00
Robert Müller 289b7b08c7 Ensure finish info messages are initialized
Closes #7913.
2024-02-09 21:33:04 +01:00
Robert Müller cb0af02eae Extract CTeeRenderInfo::Valid function 2024-02-09 21:32:56 +01:00
Robert Müller 4cb0bb2744 Split CInfoMessages::OnMessage into separate functions
Improve readability by splitting long `OnMessage` function into separate functions for each individual message.
2024-02-09 21:32:48 +01:00
Robert Müller e350ceeb16 Extract SSkinTextures::Unload function 2024-02-09 21:32:44 +01:00
Corantin H f9ba9d819b Add more const qualifiers to editor methods 2024-02-09 21:13:28 +01:00
Robert Müller fbc4181809
Merge pull request #7937 from Peakies/switch_screen_pr
fix switch screen and blackscreen on opengl + window borderless
2024-02-09 19:47:42 +00:00
Peakies e8809f11a3 rename Modes 2024-02-09 23:01:09 +03:30
Corantin H bd5149c48c Prevent brush placing when paning editor view 2024-02-09 19:57:48 +01:00
Corantin H 9e724950d0 Fix quad grid snapping
Check for grid alignment before aligning quads to other quads
2024-02-09 19:57:43 +01:00
Corantin H 419bebf7ff Add const qualifier to interface getters in editor.h 2024-02-09 19:48:29 +01:00
Robert Müller 837ecb8708
Merge pull request #7946 from ChillerDragon/pr_ed_switch
Add "View" button to switch drop down in editor
2024-02-09 16:43:25 +00:00
ChillerDragon 3fc10d4a6c Add "View" button to switch drop down in editor
This allows mappers to find switchers by number.

see #7931
2024-02-09 16:28:24 +08:00
Dennis Felsing 9187c296a0
Merge pull request #7952 from Robyt3/Server-Sixup-Killmessages
Show kill messages also for sixup clients
2024-02-08 22:53:54 +00:00
bencie 177e8f07f1 Fix broken parameter in MoveCharacter 2024-02-08 22:34:38 +01:00
Robert Müller c0da15737d Show kill messages also for sixup clients
For consistency between 0.6 and 0.7 clients, also show kill messages for 0.7 clients, now that DDNet client also supports finish messages.

Closes #5623.
2024-02-08 20:30:31 +01:00
Dennis Felsing 7dc446e086
Merge pull request #7942 from Robyt3/Client-SoundInit-Warning
Use generic client warning for failed sound init
2024-02-08 14:00:16 +00:00
Peakies 01503af071 clear codes 2024-02-08 15:31:57 +03:30
ChillerDragon 860a472d5c Cleanup editor object comments 2024-02-08 15:59:26 +08:00
Robert Müller e4ea04950a Use generic client warning for failed sound init
Simplify code by using generic warning system instead of hard-coding the warning.
2024-02-07 23:55:00 +01:00
Robert Müller 272c8095d0 Show warnings after client close instead of preventing quitting
Instead of preventing the client from quitting/restarting while a warning is shown in the menus, add warnings that should be shown after quitting/restarting (i.e. the warning when the config could not be saved) to a separate list and show these warnings using an OS message box after the client has been closed. Otherwise, the client is prevented from closing if a warning is shown without being automatically hidden, which causes the client to hang indefinitely in the CI.

The message boxes for warnings must be shown after the client has already been completely shutdown, otherwise the regular shutdown with the Vulkan backend crashes because showing the message box has already partially deinitialized the backend.

The quitting/restarting client state is now checked after updating the FIFO component, so quitting/restarting initiated via FIFO is effective immediately, although this should have little effect in practice.

For completeness, a log message is added also for the case that the config was saved successfully.

The GitHub CI seems to automatically confirm/disable OS message boxes, so they should not block workflows.
2024-02-07 22:11:44 +01:00
Peakies d40038c679 remove unnecessary variables and loop 2024-02-07 02:31:06 +03:30
bencie 4baaf4f410 style 2024-02-06 15:43:46 +01:00
bencie 68d559ea46 Change i[x] i[y] to f[x] f[y] 2024-02-06 15:35:23 +01:00
bencie 5b2c35dc36 Fixed a bug with /tpxy where the parameters didn't take floats or negative numbers 2024-02-06 15:28:33 +01:00
Peakies 6691e2affa exclude rust_version 2024-02-06 13:50:35 +03:30
Robert Müller 78997e55d9 Ensure correct HTTP request state when getting result
Add assertions to ensure that the HTTP request result data and SHA256 are available when getting them instead of returning `nullptr` and `SHA256_ZEROED` when they are not.

Rename `CHttpRequest::Sha256` function to `ResultSha256`.
2024-02-05 21:58:01 +01:00
Robert Müller c5c9e6c983
Merge pull request #7897 from bencie/editor-buttons
Added plus/minus buttons to numeric value selectors in editor
2024-02-05 18:58:58 +00:00
bencie bb7662c3dc Added plus/minus buttons to numeric value selectors in editor 2024-02-05 19:15:52 +01:00
Peakies 6b7c8f1a28 fix switch screen and blackscreen on opengl + window borderless 2024-02-05 20:58:22 +03:30
Robert Müller bf3622e8f1 Fix and simplify check for maximum number of favorite communities
Because of incorrect index/size math, two favorite communities were removed when exceeding the maximum number of three favorite communities instead of only one. The check can be simplified because the maximum number of favorite communities can never be exceeded, so at most the first element needs to be removed from the vector.

Closes #7935.
2024-02-05 17:50:50 +01:00
Dennis Felsing 68ee8a758b
Merge pull request #7923 from Robyt3/Http-DDNet-Info-Sha-Check
Write DDNet info file only when it changed, initialize HTTP later on client launch, show message box on error, refactoring
2024-02-05 12:31:06 +00:00
Dennis Felsing d93615ed80
Merge pull request #7929 from ChillerDragon/pr_ed_view_tele
Add "View" button to tele drop down in editor
2024-02-05 12:29:48 +00:00
Dennis Felsing 8214e26132
Merge pull request #7924 from furo321/keep-scroll-during-selection
Keep console scrolling position during text selection
2024-02-05 12:16:34 +00:00
Dennis Felsing e2d16e6f78
Merge pull request #7925 from dobrykafe/pr-appearance-nameplate
Name plate appearance tab cleanup
2024-02-05 12:15:17 +00:00
ChillerDragon c9a3836a29 Add "View" button to tele drop down in editor
This allows mappers to find teles by number.

Partially fixed #2194
2024-02-05 18:35:42 +08:00
Dennis Felsing 5ddf6aefa1
Merge pull request #7926 from dobrykafe/pr-hud-teamlock
Add team-lock indicator to HUD
2024-02-05 10:22:50 +00:00
Dennis Felsing 8d46d61b47
Merge pull request #7927 from ChillerDragon/pr_ed_select_tile_para
Add parallax to layer selector (closed #7612)
2024-02-05 10:22:25 +00:00
ChillerDragon 0a82a2e759 Add doc comment for CUIRect::Draw() 2024-02-05 16:43:52 +08:00
ChillerDragon cdf69372d3 Add parallax to layer selector (closed #7612)
Also closed #5010

Offset was already supported but parallax was ignored.
Now it looks at offset and parallax when ctrl+right clicking a tile.
2024-02-05 14:22:16 +08:00
dobrykafe 01d87707ef add team-lock indicator to hud 2024-02-05 02:26:48 +01:00
dobrykafe 958bb7493e name plate appearance tab cleanup 2024-02-05 01:25:15 +01:00
furo b121734e6f Keep console scrolling position during text selection 2024-02-04 23:57:05 +01:00
Robert Müller f0deb129c0 Write DDNet info file only when it changed
Avoid many writes to disk each time the DDNet info is downloaded, i.e. each time the refresh button is pressed in the server browser, by first loading the DDNet info into memory and only writing it to disk when it differs from the current DDNet info based on the SHA256 hash.

The SHA256 is now also used to track whether the DDNet info was modified for the community filters and icons instead of using the current time for this purpose.

Closes #3941.
2024-02-04 23:29:11 +01:00
Robert Müller 535400d8a8 Initialize HTTP later on client launch, show message box on error
Initialize the HTTP client (start the HTTP thread) after initializing the network client instead of during the client interface construction. This ensures that config variables have been loaded already and the log output level is set correctly. This also means all library initialization log messages appear together in one block when starting the client.

Show an error message box and stop launching when the HTTP client could not be initialized, instead of launching but not being able to perform any HTTP requests, which causes bug reports about the serverlist being empty.
2024-02-04 23:29:05 +01:00
Robert Müller d6a20f271b Improve some variable names in CHttp 2024-02-04 23:29:05 +01:00
Robert Müller 987acfbba7 Use more specific log levels for HTTP requests 2024-02-04 23:27:40 +01:00
Robert Müller 6c6f058a8c Cleanup HTTP request cleanup
Ensure with assertion that file is closed when `CHttpRequest` is destructed.

Remove unnecessary assignments in destructor.
2024-02-04 23:25:56 +01:00
Robert Müller 48fad83681 Remove hard-coded commands from client-side
Both console and chat commands are sent to clients dynamically with respective messages, so the static lists of commands were only used for servers not making use of these messages. Instead of assuming potentially incorrect console and chat commands on those servers, the lists will now be empty for those servers.

Move the command registration from the `ddracecommands.h` and `ddracechat.h` header files to the `CGameContext::RegisterDDRaceCommands` and `CGameContext::RegisterChatCommands` functions and delete the header files. The `CHAT_COMMAND` and `CONSOLE_COMMAND` macros are removed, because they only add unnecessary indirection now. The strings `CHAT_COMMAND` and `CONSOLE_COMMAND` are simply replaced with `Console()->Register` and semicolons are added at the end of the lines.

Closes #7665.
2024-02-04 13:16:04 +01:00
Dennis Felsing f0da0aa4a0
Merge pull request #7915 from Robyt3/Browser-Community-Tabs
Add tabs for favorite communities, separate country/type filters
2024-02-03 23:08:24 +00:00
dobrykafe 71779385be allocate more space for DoLine_ColorPicker label 2024-02-03 22:47:29 +01:00
Robert Müller 7c9b1fbbb4 Add tabs for favorite communities, separate country/type filters
Support adding up to three communities as favorites in the server browser. Favorites can be changed with favorite buttons which are shown in the community filter on the Internet and Favorites tabs. The commands `add_favorite_community` and `remove_favorite_community` are added to change the favorite communities via the console and for saving the favorite communities to the config file. For the favorite communities, additional tabs using the communities' icons are shown in the server browser next to the Internet, LAN and Favorites tabs. Each community tab shows only the servers from the respective community, hence the community filters UI is not shown on the community tabs but only on the Internet and Favorites tabs. The country and type filters on community tabs cover only the countries and types from the respective community. Favorite communities are added from left to right. When more than three favorite communities are added, the oldest (leftmost) favorite community will be removed from the list.

When starting the client for the first time, i.e. with `cl_show_welcome 1`, the DDNet tab will be created as the only favorite community and selected initially. The community, country and type filters are unset when starting for the first time, so the Internet tab now shows all servers per default.

When starting with a `ui_page` for a favorite community that is not configured, the page is reset to the Internet tab. This also affects those who upgrade from versions with the old DDNet and KoG tabs. The server browser is now also correctly updated when changing `ui_page` via the console.

Track country and type filters for every community separately, to avoid filters resetting when switching between community tabs or changing the community filter. The commands `add_excluded_community`, `remove_excluded_community`, `add_excluded_country`, `remove_excluded_country`, `add_excluded_type` and `remove_excluded_type` are added to change the exclusion filters via the console and for saving the exclusion filters to the config file.

Render community filters above the toolbox (filter, info and friends) tabs when on the Internet and Favorites tab, so this setting is more visible and can be changed also when the other toolbox tabs are selected.

Add icon for the none community, based on the tee country flag color. This icon is hard-coded in the client, as the none community also is, so fetching the icon from the server would be inconvenient. Load community icons already when rendering the menu instead of only when rendering the server browser, so the icons are immediately available when using the start menu.

Find tutorial server by searching for community type "Tutorial" instead of searching for "(Tutorial)" in the server name.

Avoid cleaning favorite communities and filters when there are no communities, i.e. when the DDNet info failed to be loaded or does not contain any communities, to avoid losing all favorite communities and filters in this case.

Closes #7774.
2024-02-03 21:12:23 +01:00
Robert Müller a8f3b56850 Fix undefined behavior on loading empty PNG files
When empty PNG files are loaded, the `std::vector` for the file contents is resized to size 0, which results in undefined behavior when it is accessed with `front`.

When `io_tell` fails, i.e. returns `-1`, this was incorrectly cast to an `unsigned` and therefore caused a very large allocation and potentially crashes due to lack of memory.
2024-02-03 20:00:08 +01:00
Robert Müller 7d0e9e86c1 Extract CMenus::DoButton_Favorite function
To render star-icon favorite button like for favorite skins.
2024-02-03 20:00:03 +01:00
heinrich5991 78bd4970be
Merge pull request #7909 from furo321/set-correct-name-size
Set correct size of name column in SQL table
2024-02-03 16:19:29 +00:00
Dennis Felsing f7ceae5d29
Merge pull request #7910 from furo321/editor-sync-toggle
Use toggle button instead of checkbox for "Sync envelope button".
2024-02-03 07:55:06 +00:00
Dennis Felsing 739e104fbb
Merge pull request #7863 from furo321/hookcoll-inaccurate
Scale angles using MousePos with zoom
2024-02-03 07:45:31 +00:00
Dennis Felsing cd9cd97f38 Version 18.0.3 2024-02-03 08:53:27 +01:00
furo f6d093987f Use toggle button instead of checkbox for "Sync envelope button". 2024-02-03 01:10:54 +01:00
furo 5378fdc20b Set correct size of name column in SQL table 2024-02-03 00:21:42 +01:00
heinrich5991 7f85922d75
Merge pull request #7872 from Robyt3/Client-Dummy-Config-Desc
Minor improvement of dummy config variable descriptions
2024-02-02 21:55:14 +00:00
heinrich5991 1337e522da
Merge pull request #7907 from archimede67/editor-fix-quads-crash
Editor: fix crash when changing layer with UP or DOWN while quad popup is opened
2024-02-02 21:53:58 +00:00
heinrich5991 63e010b8e4
Merge pull request #7906 from furo321/limit-port-range
Set max limit for `sv_port` and `ec_port` to 65535
2024-02-02 21:53:27 +00:00
Corantin H d988b92b38 Check selected quad index when rendering quad popup (fixes #7904) 2024-02-02 22:15:05 +01:00
furo 2ed631b90a Set max limit for sv_port and ec_port to 65535 2024-02-02 22:08:56 +01:00
Robert Müller e8305ef111 Move CSnapIDPool to separate compilation unit 2024-02-02 20:33:43 +01:00
Robert Müller c40d809282 Refactor skin refreshing in gameclient, fix crash in skin settings
Add `CGameClient::RefreshSkins` function to refresh skins. This function reloads all skins by calling `CSkins::Refresh` and then notifies all gameclient components about the skins being refreshed by calling the new `CComponent::OnRefreshSkins` function, so the components can properly invalidate their current skin texture handles. The existing `RefindSkins` functions are changed to `OnRefreshSkins`.

Additionally, `OnRefreshSkins` is overridden in `CMenus` to set the flag so the skin list will be updated before it is rendered the next time, to fix the client crashing when changing skin related config variables via the console. Closes #7891.
2024-02-01 20:41:10 +01:00
Dennis Felsing 2ed899a259
Merge pull request #7890 from Robyt3/Voting-Hud-Improvement
Improve voting HUD, refactoring
2024-02-01 08:41:58 +00:00
Dennis Felsing 3133676abb
Merge pull request #7889 from bencie/master
Fix inconsistencies in appearance settings
2024-02-01 08:41:50 +00:00
Dennis Felsing dea3d170f0
Merge pull request #7888 from heinrich5991/pr_ddnet_mastersrv_charset
Accept `charset=*` in `Content-Type` for masterserver
2024-02-01 08:10:44 +00:00
Robert Müller 1955905a19 Improve voting HUD
Reduce height and empty space and make margins consistent. Slightly increase width for better round corner drawing and to support longer vote descriptions.

Auto-scale description and reason labels and show ellipsis if they don't fit.

Show circular progress indicator for remaining vote time.
2024-01-31 23:09:31 +01:00
Robert Müller fa62d3c360 Close voting HUD when remaining seconds are negative
Ensure voting HUD disappears when it should, in case the server does not announce that the vote has ended correctly.
2024-01-31 23:09:31 +01:00
Robert Müller dfc2e80701 Move voting rendering from CHud to CVoting 2024-01-31 23:09:31 +01:00
bencie 0972dc2bbe Move Show chat checkbox to Chat tab 2024-01-31 21:45:09 +01:00
bencie f34a583a4e Remove redundant Show kill messages checkbox 2024-01-31 21:44:16 +01:00
Robert Müller df95ca74ec Extract CVoting::RemoveOption function 2024-01-31 21:06:11 +01:00
Robert Müller c1549635c6 Cleanup CVoting::RenderBars function
The functionality to draw text on the voting bars is never used, so the parameter `Text` is always `false`.

Remove unused variable `PassArea`. The remaining area of the voting bars is unused.
2024-01-31 21:05:03 +01:00
heinrich5991 1d638707b2 Accept charset=* in Content-Type for masterserver
You should generally not send a `charset=*` parameter for `Content-Type:
application/json` because no parameters are defined for it:
https://datatracker.ietf.org/doc/html/rfc7158#section-11.

Fixes #6955.
2024-01-31 20:34:21 +01:00
Dennis Felsing 984457a48e
Merge pull request #7887 from furo321/add-conchain-skin-cmds
Add console chain for refreshing skins
2024-01-31 09:00:45 +00:00
Dennis Felsing c3e3ac5732
Merge pull request #7885 from furo321/practice-improvements
Small improvements to practice
2024-01-31 09:00:18 +00:00
Dennis Felsing a7097f1ae7
Merge pull request #7884 from furo321/cmdlist
Tell the user about `/cmdlist` when using an unknown chat command.
2024-01-31 08:59:36 +00:00
furo 5179850dbd Add console chain for refreshing skins 2024-01-31 01:57:55 +01:00
furo d149ab60e8 Remove unused ConAccept function 2024-01-31 00:51:50 +01:00
furo ec70556577 Don't print the team cannot finish anymore message when team is already in practice 2024-01-31 00:47:19 +01:00
furo c1fe1b49fa Allow joining started teams that have practice enabled 2024-01-31 00:39:00 +01:00
furo a9df61e1dd Tell the user about /cmdlist when using an unknown chat command. 2024-01-31 00:27:38 +01:00
Dennis Felsing 7f42b3a082
Merge pull request #7883 from Teero888/master
CMenus::RandomSkin() adjustments
2024-01-30 23:06:09 +00:00
Teero888 e3dc26a81b fix msvc complaining 2024-01-30 22:28:55 +01:00
Teero888 fda6a6760c remove redundant get() call on smart pointer 2024-01-30 22:05:44 +01:00
Teero888 cef4358560 CMenus::RandomSkin() adjustments
+ Dont randomise colors if UseCustomColor is false
+ Use all instead of only vanilla skins when randomising
2024-01-30 21:46:04 +01:00
Robert Müller 2e35250401 Improve client/server launch log messages
Use error log level for error messages. Use info log level explicitly instead of using `dbg_msg`.

Log time taken for initialization in trace level message.
2024-01-30 20:45:23 +01:00
ChillerDragon 40633d800a Fix 0.7 armor being snapped as health
Closed https://github.com/ZillyInsta/ddnet-insta/issues/91
2024-01-30 19:47:04 +08:00
ChillerDragon f375f20ffc Fix clang warning and UB when there is no game layer
clang 14.0.6 shows this:

```
[ 98%] Building CXX object CMakeFiles/game-client.dir/src/game/generated/client_data7.cpp.o
In file included from /usr/include/c++/12/bits/stl_tempbuf.h:60,
                 from /usr/include/c++/12/bits/stl_algo.h:61,
                 from /usr/include/c++/12/algorithm:61,
                 from /home/chiller/Desktop/git/ddnet/src/base/math.h:6,
                 from /home/chiller/Desktop/git/ddnet/src/base/color.h:5,
                 from /home/chiller/Desktop/git/ddnet/src/game/editor/popups.cpp:4:
In function ‘void std::_Construct(_Tp*, _Args&& ...) [with _Tp = CEditorActionTileChanges; _Args = {CEditor*&, int&, int&, const char (&)[20], map<int, map<int, STileStateChange, less<int>, allocator<pair<const int, STileStateChange> > >, less<int>, allocator<pair<const int, map<int, STileStateChange, less<int>, allocator<pair<const int, STileStateChange> > > > > >&}]’,
    inlined from ‘static void std::allocator_traits<std::allocator<void> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = CEditorActionTileChanges; _Args = {CEditor*&, int&, int&, const char (&)[20], std::map<int, std::map<int, STileStateChange, std::less<int>, std::allocator<std::pair<const int, STileStateChange> > >, std::less<int>, std::allocator<std::pair<const int, std::map<int, STileStateChange, std::less<int>, std::allocator<std::pair<const int, STileStateChange> > > > > >&}]’ at /usr/include/c++/12/bits/alloc_traits.h:635:19,
    inlined from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {CEditor*&, int&, int&, const char (&)[20], std::map<int, std::map<int, STileStateChange, std::less<int>, std::allocator<std::pair<const int, STileStateChange> > >, std::less<int>, std::allocator<std::pair<const int, std::map<int, STileStateChange, std::less<int>, std::allocator<std::pair<const int, STileStateChange> > > > > >&}; _Tp = CEditorActionTileChanges; _Alloc = std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/include/c++/12/bits/shared_ptr_base.h:604:39,
    inlined from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = CEditorActionTileChanges; _Alloc = std::allocator<void>; _Args = {CEditor*&, int&, int&, const char (&)[20], std::map<int, std::map<int, STileStateChange, std::less<int>, std::allocator<std::pair<const int, STileStateChange> > >, std::less<int>, std::allocator<std::pair<const int, std::map<int, STileStateChange, std::less<int>, std::allocator<std::pair<const int, STileStateChange> > > > > >&}; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/include/c++/12/bits/shared_ptr_base.h:971:16,
    inlined from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<void>; _Args = {CEditor*&, int&, int&, const char (&)[20], std::map<int, std::map<int, STileStateChange, std::less<int>, std::allocator<std::pair<const int, STileStateChange> > >, std::less<int>, std::allocator<std::pair<const int, std::map<int, STileStateChange, std::less<int>, std::allocator<std::pair<const int, STileStateChange> > > > > >&}; _Tp = CEditorActionTileChanges; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/include/c++/12/bits/shared_ptr_base.h:1712:14,
    inlined from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<void>; _Args = {CEditor*&, int&, int&, const char (&)[20], std::map<int, std::map<int, STileStateChange, std::less<int>, std::allocator<std::pair<const int, STileStateChange> > >, std::less<int>, std::allocator<std::pair<const int, std::map<int, STileStateChange, std::less<int>, std::allocator<std::pair<const int, STileStateChange> > > > > >&}; _Tp = CEditorActionTileChanges]’ at /usr/include/c++/12/bits/shared_ptr.h:464:59,
    inlined from ‘std::shared_ptr<typename std::enable_if<(! std::is_array< <template-parameter-1-1> >::value), _Tp>::type> std::make_shared(_Args&& ...) [with _Tp = CEditorActionTileChanges; _Args = {CEditor*&, int&, int&, const char (&)[20], map<int, map<int, STileStateChange, less<int>, allocator<pair<const int, STileStateChange> > >, less<int>, allocator<pair<const int, map<int, STileStateChange, less<int>, allocator<pair<const int, STileStateChange> > > > > >&}]’ at /usr/include/c++/12/bits/shared_ptr.h:1010:39,
    inlined from ‘static CUI::EPopupMenuFunctionResult CEditor::PopupGroup(void*, CUIRect, bool)’ at /home/chiller/Desktop/git/ddnet/src/game/editor/popups.cpp:450:85:
/usr/include/c++/12/bits/stl_construct.h:119:7: warning: ‘GameLayerIndex’ may be used uninitialized [-Wmaybe-uninitialized]
  119 |       ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/chiller/Desktop/git/ddnet/src/game/editor/popups.cpp: In static member function ‘static CUI::EPopupMenuFunctionResult CEditor::PopupGroup(void*, CUIRect, bool)’:
/home/chiller/Desktop/git/ddnet/src/game/editor/popups.cpp:408:29: note: ‘GameLayerIndex’ was declared here
  408 |                         int GameLayerIndex;
      |                             ^~~~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-nullability-completeness’ may have been intended to silence earlier diagnostics
```

Which makes sense. GameLayerIndex is only set in a loop if a condition is met.
And then its value is recorded for the undo feature.

The condition should never be false. Because a game layer is a strict requirement for a functional map.
But I still decided to avoid using an assert or silent ignore.
If this breaks logs would be nice.
If this breaks the editor should not crash.
The editor should never crash or quit to not lose unsaved changes.
2024-01-30 11:16:46 +08:00
Robert Müller dd44c6cd4d Minor improvement of dummy config variable descriptions 2024-01-28 20:12:22 +01:00
Learath 31b3ac71c2 Fix client/server updates 2024-01-28 19:34:30 +01:00
Dennis Felsing d60852a020
Merge pull request #7868 from Learath2/dd_pr_updater
Fix updater issue. Close #7867
2024-01-28 12:37:42 +00:00
Dennis Felsing 33ffd0f052 Version 18.0.2 2024-01-28 13:38:58 +01:00
Learath 2470e7489d Fix updater issue. Close #7867 2024-01-28 12:50:54 +01:00
heinrich5991 dcdc66d1df
Merge pull request #7869 from furo321/testcmds-error
Add a error message for when testing commands aren't allowed
2024-01-27 17:59:51 +00:00
furo 633330bcd8 Add a error message for when testing commands aren't allowed 2024-01-27 18:18:32 +01:00
heinrich5991 e3732928a9
Merge pull request #7862 from Robyt3/Menus-Refactoring-Various
Various minor refactoring of menus
2024-01-27 13:08:55 +00:00
Robert Müller 83942f9a50
Merge pull request #7866 from heinrich5991/pr_ddnet_redundant_utf8_checks
Remove redundant UTF-8 checks
2024-01-27 13:03:45 +00:00
heinrich5991 8157ea4ce4
Merge pull request #7865 from Robyt3/Demo-AddDemoMarker-Error-Messages
Show error messages in console when `add_demomarker` fails
2024-01-27 12:56:50 +00:00
heinrich5991 c16afc60ec
Merge pull request #7864 from infclass/kaffeine/teeinfo-kitties
TeeInfo: Fix blue and limekitty eyes and feet 0.6 -> 0.7 mapping
2024-01-27 12:49:06 +00:00
heinrich5991 4f06f3a797 Remove redundant UTF-8 checks
We already check for valid UTF-8 while unpacking strings.
2024-01-27 13:43:04 +01:00
Robert Müller 5d7f2c6e1b Show error messages in console when add_demomarker fails
When there are too many demo markers already or when the previous demo marker is too close.
2024-01-27 13:26:08 +01:00
Jupeyy 349eb38ebf
Merge pull request #7859 from Robyt3/Windows-ShellExecute-Fixes
Ensure client window is maximized and active after restarting, refactoring
2024-01-27 11:27:40 +00:00
Alexander Akulich e0e37d7f7b TeeInfo: Fix blue and limekitty eyes and feet 0.6 -> 0.7 mapping 2024-01-27 02:00:16 +03:00
furo e14123164b Scale angles using MousePos with zoom 2024-01-26 23:12:47 +01:00
Robert Müller 2b2d3b8dd2 Add enum EServerControlTab 2024-01-26 21:39:11 +01:00
Robert Müller 8982da4a32 Refactor usages of CMenus::DoButton_MenuTab
Use `IGraphics::CORNER_NONE` instead of `0`.

Use `nullptr` instead of `NULL`.

Remove arguments identical to defaults.

Use loops for tab bars with several tabs.
2024-01-26 21:39:11 +01:00
Robert Müller 7854a277c7 Use IGraphics::CORNER_NONE for CUIRect::Draw function 2024-01-26 21:39:11 +01:00
Robert Müller f13888b2cc Move variable declarations closer to usages 2024-01-26 21:39:11 +01:00
Robert Müller 53b5b3bc98 Remove unused m_Spacer variable 2024-01-26 21:39:11 +01:00
Robert Müller eb2aea22b8 Remove redundant condition
The function `CMenus::RenderInGameNetwork` is only called when the client has `STATE_ONLINE` so this condition is always `true`.
2024-01-26 21:39:11 +01:00
Robert Müller 350c1fc860 Remove temporary variable and rename parameter 2024-01-26 21:39:11 +01:00
Robert Müller a49ee14cb0 Remove unused return value of menus render functions 2024-01-26 21:39:11 +01:00
Robert Müller bd7ee904c0 Remove unused PAGE_SYSTEM enum literal 2024-01-26 21:39:11 +01:00
heinrich5991 70743331de
Merge pull request #7861 from furo321/toggle-infomessages
Store info messages even if they aren't enabled
2024-01-26 19:45:46 +00:00
furo d94c0384a6 Store infomessages even if they aren't enabled 2024-01-26 20:20:20 +01:00
Robert Müller d5c7488480 Ensure client window is maximized and active after restarting
Add parameter to `shell_execute` to either start the process in the foreground or background on Windows. Previously, all processes were started in the background, because this is desired when starting the server from the client. However, this causes the graphics initialization to fail when restarting the client after updating or with the `restart` command when using Vulkan with windowed and windowed fullscreen mode.

Closes #6578.
2024-01-25 20:52:17 +01:00
Robert Müller 4d206ffab3 Add documentation for shell_execute and kill_process functions 2024-01-25 20:24:07 +01:00
Robert Müller 725ebc929e Remove duplicate if branch 2024-01-25 20:23:53 +01:00
Robert Müller c4d512d86e
Merge pull request #7687 from archimede67/editor-better-map-settings
Editor: better map settings input (autocomplete, validation)
2024-01-24 18:17:19 +00:00
Robert Müller 1f8a60b8e1 Show extra "Reset filter" button when no servers match filter
Render an additional "Reset filter" button below the "No servers match your filter criteria" message to make it more obvious for new players how to restore the original view of servers, especially when the filter tab is not currently selected.
2024-01-23 20:20:32 +01:00
Corantin H 0cd002e08c Various fixes to map settings handling 2024-01-23 20:15:30 +01:00
Corantin H aca398f3c9 Added dialog to fix invalid map settings on load 2024-01-23 20:13:57 +01:00
Corantin H 9cc8a28305 Better map settings input (autocomplete, validation) 2024-01-23 20:13:56 +01:00
Robert Müller 6829cd6ef6
Merge pull request #7856 from archimede67/editor-undo-cleanup-game-times
Editor: made "Clean up game tiles" undoable
2024-01-23 18:34:14 +00:00
Corantin H af51fcccbb Editor: made "Clean up game tiles" undoable 2024-01-23 19:03:53 +01:00
Robert Müller 9c66a6a147 Remove unused parameter of SetWindowParams function
The `bool AllowResizing` parameter is only passed to other `SetWindowParams` functions but never used in the end, as whether or not resizing is allowed is separately determined based on the value of the `int FullscreenMode` parameter.
2024-01-23 17:49:55 +01:00
heinrich5991 a2c8869025
Merge pull request #7852 from Robyt3/Browser-Community-Filter-Fix
Fix countries/types filters excluding all servers
2024-01-23 08:56:34 +00:00
Dennis Felsing 4f18816b2b Version 18.0.1 2024-01-22 22:53:09 +01:00
Robert Müller 797db31aa1 Fix countries/types filters excluding all servers
Instead of cleaning the countries/types filters based on all available communities' countries/types, only consider the countries/types of currently selected communities. Ensure countries/types are always cleaned when updating the server browser filter in the UI. This fixes that countries/types which are not available for the selected communities were still affecting the server filtering, causing no servers to be shown in some cases.

Closes #7847.
2024-01-22 22:30:15 +01:00
Dennis Felsing 45ab8e911a
Merge pull request #7842 from k-i-o/patch-1
Update config_variables.h
2024-01-22 08:27:08 +00:00
Dennis Felsing de0bd3a78a Version 18.0 2024-01-22 09:29:47 +01:00
Samuele Radici 79cf3b4e17
Update config_variables.h
text error
2024-01-22 01:33:44 +01:00
Dennis Felsing 50dc9de991
Merge pull request #7839 from infclass/kaffeine/fix-move-restrictions-incapsulation
Character: Fix m_MoveRestrictions and m_Core incapsulation
2024-01-21 22:40:22 +00:00
Dennis Felsing fca6e0abe3
Merge pull request #7837 from Robyt3/Demo-Recorder-Improvements
Refactor demo recorder usage
2024-01-21 22:39:46 +00:00
Alexander Akulich d0f5ced546 Make http states a enum class and use it across the codebase 2024-01-22 01:06:59 +03:00
Robert Müller 9150f48562 Refactor demo recorder usage
To simplify the usage of the demo recorder, parameters are added to the `IDemoRecorder::Stop` function to control whether the demo file is removed or renamed when stopping the recording.

Ensure demo files of the replay recorder are always removed (except on crashes). The temporary replay demos were previously not removed when being disconnected from a server.

Fix auto demos being stopped and restarted when enabling replays in the settings menu. Now only the replay recorder is stopped/started when necessary.

Fix replay recorder being restarted when setting `cl_replay` variable with console without changing the value.

Remove unnecessary `CClient::m_ButtonRender` variable. Demo rendering is already stopped correctly when reaching the end of the demo without this additional variable.

Remove unused `CDemoRecorder::m_pMapData` variable.
2024-01-21 22:21:56 +01:00
Alexander Akulich 386935f5cf Character: Incapsulate m_MoveRestrictions and m_Core
Instead of leaking the m_MoveRestrictions to all classes which needs to
adjust the Character velocity, add a setter which takes into account those
restrictions.

The shotgun bug replication requires an access to the Velocity without the
restrictions applied (so we have to have this dirty setter).

Expose only *const* CCharacterCore to force the setters usage and prevent
incorrect write.
2024-01-21 20:59:50 +03:00
Robert Müller b89e4e8770 Finish CHttpRequest::OnCompletion before updating State()
Ensure that the `CHttpRequest::OnCompletion` function has finished before updating the state which is visible to other threads. Otherwise, threads may try to access the result of a completed HTTP request, before the result has been initialized/updated in the `OnCompletion` function.

Fixes warning due to invalid texture width/height being shown for downloaded skins, because the texture was loaded before the image data was initialized. Closes #7818.

Regression from #7683. Before this, the `OnCompletion` function could also modify the HTTP request's state, which was used to check if loading the skin PNG failed. Instead of doing this, a separate check is added for the skin download task to check that the PNG was loaded successfully.
2024-01-21 14:53:33 +01:00
Dennis Felsing 94931fadc0
Merge pull request #7832 from Robyt3/Base-Localtime-Threadlocal
Ensure uses of `localtime` function are thread-safe
2024-01-21 10:36:31 +00:00
Robert Müller 4b8dabcf5d Improve Windows logger, add virtual terminal support
Use [virtual terminal processing](https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences) for Windows console output when possible, using the existing async logger. Fallback to the old Windows logger when virtual terminal processing is not available. Do not set any logger when there is no console/file/pipe to output to.

This adds support for 24 bit RGB colors using ANSI escape codes (when Terminal emulator supports it) instead of only supporting 16 fixed colors.

Use the existing async logger also on Windows by converting the console standard output handle to an IOHANDLE. Avoid converting console output to UTF-16 by changing the console output codepage to UTF-8 and outputting that directly. Overall, this reduces the time until the loading screen first appears when launching the client from the console on Windows by around 70%, from 80-100ms down to 25ms.

Add support for `NO_COLOR` environment variable also on Windows.

Use the async logger also for writing output to files and pipes instead of using a Windows specific implementation for this, to reduce lags when redirecting the standard output.

Closes #3925. The client/server will not freeze anymore when entering selection mode in the console because we are using the async logger on Windows now.

Closes #1108. We were already using AIO on Windows to write the logfile, which was not causing any known issues. We are now also using AIO with the async loggers for console/files/pipes on Windows.
2024-01-20 18:19:08 +01:00
Robert Müller 93cbad485d
Merge pull request #7831 from BlaiZephyr/move-nameplate-button
moved nameplates from hud -> nameplates
2024-01-19 20:26:51 +00:00
Robert Müller c1a1720a08 Ensure uses of localtime function are thread-safe
On Windows, the result of the `localtime` function is thread-local, hence our uses of this function are already thread-safe.

On non-Windows, the `localtime` function is potentially not thread-safe, so the reentrant `localtime_r` function is used instead with a thread-local buffer for the result.

Closes #7788.
2024-01-19 21:26:50 +01:00
melon 5361637a55 fixed placement & spacing 2024-01-19 21:09:56 +01:00
melon abe6c1c4b5 moved nameplates from hud -> nameplates 2024-01-19 20:44:31 +01:00
ChillerDragon e59c9a6450 Only log http requests if `dbg_curl 1`
closed #7823
2024-01-19 12:38:53 +08:00
Robert Müller 6e4afd7c63 Remove unnecessary check for entities close to map border
When handling door and laser entities, all 8 adjacent tiles are checked for laser modifier tiles. When handling laser entities, the 8 tiles one further out are also checked for laser modifier tiles. If either of those 16 tiles is outside the map bounds, an error message was printed and the tiles are ignored. The error message is removed because it's unnecessary and misleading. Placing entities near or on the map border is not known to cause any issues.

Closes #7759.
2024-01-18 22:44:22 +01:00
Dennis Felsing 0bce368c77
Merge pull request #7824 from Robyt3/Client-FPS-Graph-Timebase
Add time scale to debug graphs for constant scrolling speed
2024-01-17 23:29:13 +00:00
Ravie 69a74963ce Allow finer editor grid 2024-01-17 23:36:09 +01:00
Robert Müller 4be76f0d08 Add time scale to debug graphs for constant scrolling speed
Store X value (time) for all graph entries in addition to the Y value (FPS, prediction margin etc.). The `CGraph::Add` function adds values to the graph at the current time. The `CGraph::InsertAt` function allows specifying arbitrary X values, as long as the values are inserted in increasing order.

The entries are kept in a ringbuffer and old entries are recycled when it's full. The size of the ringbuffer is configurable for each graph, as the FPS graph needs significantly more buffer because values are added more often.

The scrolling speed of the graphs is fixed by specifying the maximum size of the window of values which should be displayed. For this purpose, a parameter is added to the `CGraph::Scale` function to specify the size of the window which should be rendered in the `CGraph::Render` function. For the FPS graph only the last second is rendered, so small spikes are still noticeable. For prediction and gametime margin graphs the last five seconds are rendered, which should result in a similar scrolling speed as before this change. The debug tuning graph is a special case, where the X values set manually and fixed to 0-127, same as before, instead of being based on the current time.

The graph rendering is made much more efficient by precalculating when the vertex colors need to be updated, to avoid all unnecessary calls to `SetColorVertex`. Additionally, line items are bundled together in an array to avoid calling `LinesDraw` for every individual line item.
2024-01-17 20:43:19 +01:00
Robert Müller c90a52f51c Add CDynamicRingBuffer to avoid specifying size as template 2024-01-17 18:17:08 +01:00
heinrich5991 626b7ca805
Merge pull request #7795 from Robyt3/Menus-Browser-Tab-Icons
Use icons for Internet, LAN and Favorites server browser tabs, use star icon for favorite servers
2024-01-17 13:56:59 +00:00
heinrich5991 9bbceab2c4
Merge pull request #7814 from gerdoe-jr/stop-annoying-superteam
Don't warn about unfinishable map for super team
2024-01-17 13:55:07 +00:00
Dennis Felsing 7c4bde43b1
Merge pull request #7813 from gerdoe-jr/separate-cmds
Divide `/tp` into `/tpxy` and `/tpto`
2024-01-17 00:12:50 +00:00
Dennis Felsing 28cd6ad2a5 Fix style 2024-01-17 00:49:32 +01:00
Dennis Felsing 55c225726b
Merge pull request #7819 from Robyt3/Engine-Warning-Uninitialized
Fix warning title being uninitialized in some cases
2024-01-16 23:48:23 +00:00
Dennis Felsing 79bdd1a3bb
Merge pull request #7816 from Robyt3/Editor-Resize-Cursor-Alignment
Improve alignment of editor resize cursors
2024-01-16 23:47:09 +00:00
gerdoe-jr 1840519609
Check for characters wtih DDRACE_CHEAT instead of TEAM_SUPER 2024-01-16 23:16:19 +03:00
Vladislav Gerasimov c53e0af6ef
/tpto -> /tp and /teleport 2024-01-16 22:17:59 +03:00
Robert Müller 0512e65dbe Fix warning title being uninitialized in some cases
For some warnings a random title instead of the default title was shown because it was not initialized.
2024-01-16 20:12:25 +01:00
Corantin H 12514360b7 Add editor tooltips to recent features
Add tooltip when drawing tele brush (tele numbers adjust).
Add tooltips when dragging quad points (alignment)
2024-01-16 19:31:01 +01:00
Robert Müller b4ceffdc83 Improve alignment of editor resize cursors
Center the resize (V/H) cursors on the mouse position instead of aligning the top-left with the mouse position. This feels better to use and is consistent with the behavior for example on Windows.
2024-01-16 19:12:01 +01:00
gerdoe-jr 40ed4bb98f
Check for super character in team, don't annoy them more than expected 2024-01-16 20:28:40 +03:00
gerdoe-jr 7df3330c06
Divide /tp into /tpxy and /tpto 2024-01-16 20:04:39 +03:00
heinrich5991 bb3bd57c0e
Merge pull request #7683 from Learath2/dd_pr_curlmultifinal
Use curl-multi. Supersedes #5842
2024-01-15 21:54:24 +00:00
heinrich5991 0f653b9b76
Merge pull request #7794 from ChillerDragon/pr_master_team_change
Report team changes to master when teams are on
2024-01-15 15:36:46 +00:00
Corantin H d2ea9cbcf1 Fix multiple editor undo/redo issues
Fixed crash when runing tool 'Remove unused envelopes' and trying to undo the addition of an envelope (#7738)
Fixed issues where undo/redo would not work properly when changing a layer's order or group property
Added missing action for changing the position of a sound source
2024-01-14 19:45:20 +01:00
Learath2 f5910343e2 Fix CI 2024-01-14 15:37:44 +03:00
Corantin H a3115d76d2 Restore ability to move points of all selected quads 2024-01-14 11:09:12 +01:00
Dennis Felsing 8dee975d66
Merge pull request #7744 from Robyt3/Editor-Color-Palette-Pipette
Add color palette and pipette to editor
2024-01-13 22:55:16 +00:00
Dennis Felsing 3b10500e99
Merge pull request #7797 from Robyt3/Chat-Render-Improvements
Various minor refactoring of chat rendering, fix chat background size
2024-01-13 22:54:36 +00:00
Robert Müller a873485643 Fix multi-line text selection not rendered correctly anymore
The `CTextCursor::m_LineCount` variable is only updated after the cursor is rendered. For calculating the selection quads we need to check `LineCount` instead, which is updated while the cursor is being rendered. Regression from #7733.
2024-01-13 23:21:13 +01:00
Robert Müller d897573acc Fix chat background width calculation when scoreboard is open
The chat background width was too small when the scoreboard is open and the message text begins on a different line than the player name.
2024-01-13 22:41:50 +01:00
Robert Müller 4fded18644 Calculate chat message height using text render function 2024-01-13 22:41:42 +01:00
Robert Müller df12d586f4 Remove unnecessary default argument for TextEx 2024-01-13 22:41:38 +01:00
Robert Müller 5b2ef36fc3 Remove unnecessary temporary variables 2024-01-13 22:41:36 +01:00
Robert Müller 9b24820fd9 Fix potentially incorrect chat background for censored messages
The censored message was not being considered when calculating the size of chat messages.
2024-01-13 22:40:57 +01:00
Robert Müller 3e61d0dadc Extract local variable Line 2024-01-13 22:40:41 +01:00
Learath2 bcf86d81f3 Fix CRegister 2024-01-13 15:28:53 +03:00
Robert Müller 7544f97786 Use star icon for favorite servers, tweak favorite star color
Use yellow-orange star icon to mark favorite servers in the server browser instead of using the heart icon. The heart icon is now only used for servers with friends.

Tweak color of the star icon used for skin favorites so it's slightly more orange instead of pure yellow.
2024-01-13 13:00:31 +01:00
Robert Müller 89802396a7 Use icons for Internet, LAN and Favorites server browser tabs
Free up space for up to three more server browser tabs of the same size (on 5:4 resolutions), i.e. tabs for configurable communities.

Remove the additional server browser icon tab on the right side. Remove the purely visual Demo and News tabs which were only shown when the respective page is already active. Instead, always show all server browser tabs when offline.
2024-01-13 12:47:11 +01:00
ChillerDragon 78bc1f02f0 Report team changes to master when teams are on
https://github.com/ZillyInsta/ddnet-insta/issues/85
2024-01-13 18:33:30 +08:00
swarfeya 79bc3b2d3d use SetInitialAfk instead of SetAfk 2024-01-12 22:44:33 +01:00
swarfeya 495290e0b2 fix style 2024-01-12 22:04:08 +01:00
swarfeya 64a70ac7a7 Fix AFK being shown only for a split second when timing out 2024-01-12 22:01:25 +01:00
Learath2 6eb51239c9 Fix some clang-tidy issues and UB 2024-01-12 23:27:49 +03:00
Learath2 32e968335b Fix lots of weirdness in updater 2024-01-12 23:19:47 +03:00
Robert Müller 5e510cdbf4 Include limits instead of climits
Consistently use `std::numeric_limits` instead of `INT_MIN` and `INT_MAX`.
2024-01-11 22:24:37 +01:00
Robert Müller 3eeba01578 Remove duplicate cleanup when connecting
The `IClient::Disconnect` function is always called at the beginning of the `IClient::Connect` function. The `IClient::Disconnect` function calls `IClient::DisconnectWithReason`, if the client is not already offline, which performs cleanup of temporary commands and demo recorders already, so the same cleanup in the `Connect` function is unnecessary. An assertion is added to ensure that the client was properly disconnected before connecting. Connecting while the client is already quitting or restarting is now prevented, as the client state cannot be changed once set to quitting or restarting.
2024-01-10 21:48:09 +01:00
heinrich5991 035cb6eab8
Merge pull request #7784 from ChillerDragon/pr_256_welcome
Increase sv_welcome to 256
2024-01-10 16:57:59 +00:00
ChillerDragon 21f6af9d38 Increase sv_welcome to 256 2024-01-10 17:39:24 +01:00
heinrich5991 e40c02a6ff
Merge pull request #7783 from Robyt3/Tools-Dummy-Map-Sha-Pointer-Fix
Fix incorrect SHA256 logged in `dummy_map` tool
2024-01-09 19:41:13 +00:00
Robert Müller 36a6c1aaf7 Fix incorrect SHA256 logged in dummy_map tool
The SHA256 was being calculated over a pointer to the map data and random following memory instead of over the data itself.
2024-01-09 19:50:43 +01:00
Robert Müller 80a52cae95 Avoid including zlib.h in header file
By adding `CDataFileWriter::ECompressionLevel` to replace usage of zlib internal compression levels in the `CDataFileWriter` API.

Use `std::numeric_limits<int>::max()` instead of `INT_MAX` in one case where the latter was only declared by the transitive zlib include. The `limits` header is already included and its use is more fitting for C++ code.
2024-01-09 19:36:41 +01:00
Dennis Felsing 0dc9495e80
Merge pull request #7781 from HiRavie/master
Improve text outlines
2024-01-09 10:58:08 +00:00
heinrich5991 9de11a5ecd
Merge pull request #7780 from Robyt3/Serverbrowser-Community-Update-Fix
Fix community not set for servers with missing server info
2024-01-08 21:26:34 +00:00
Robert Müller 6bdc73ad3d Fix community not set for servers with missing server info
The server community was only initialized when receiving server info. This caused servers for which no server info is received to be hidden when using the community filter. Now the community filter also works correctly for servers for which no ordinary server info is received, by initializing the community already when adding server entries to the list.

Closes #7776.
2024-01-08 22:07:24 +01:00
Ravie 2e44c02bbc Improve text outlines 2024-01-08 21:52:14 +01:00
Jupeyy 1377af0921
Merge pull request #7771 from ChillerDragon/pr_routine
Typo routine
2024-01-07 22:19:32 +00:00
Chiller Dragon e36f2bf7bc
Fix comment grammar
Co-authored-by: Dennis Felsing <dennis@felsing.org>
2024-01-07 18:05:12 +01:00
Learath2 9b3ebf3f1b Remove debug statement, fix CI 2024-01-07 17:48:48 +03:00
Robert Müller a80d875e85 Improve error log messages when saving settings fails
Log separate messages for `io_sync` error, `io_close` error and general write errors.
2024-01-07 12:24:07 +01:00
Robert Müller 43b1e5cb1f Improve warning popup message when saving settings fails
The message was previously showing an incorrect filename.
2024-01-07 12:23:58 +01:00
ChillerDragon b10030391d Typo routine 2024-01-07 12:19:58 +01:00
Dennis Felsing fda996014b
Merge pull request #7767 from furo321/fix-hookcoll-spec
Fix hook collision line being incorrect while paused.
2024-01-07 00:15:23 +00:00
heinrich5991 7aba25d3f7
Merge pull request #7747 from Robyt3/Map-UUID-Unknown-Handling
Propagate unknown UUID-based map items in map tools
2024-01-06 22:18:30 +00:00
Robert Müller ce47d01998
Merge pull request #7761 from swarfeya/master
fix happy ddnet birthday broadcast (#7758)
2024-01-06 20:45:52 +00:00
Robert Müller 999119c60f Propagate unknown UUID-based map items in map tools
Adapt the `CDataFileReader::GetItem` function so it optionally also returns a `CUuid` for UUID-based map items, including for items with unknown UUIDs where the item type will be `-1`. Adapt the `CDataFileWriter::AddItem` function so it optionally also accepts a `CUuid` which will be used if the item type is `-1`.

The additional checks for invalid map item types in the map tools are removed again and instead the new UUID parameters are used so map items with unknown UUIDs are written back to maps correctly.

Closes #7701.
2024-01-06 21:25:15 +01:00
furo e025c184af Fix hook collision line being incorrect while paused. 2024-01-06 20:45:14 +01:00
swarfeya a9b19ff2a7 Increment m_SentSnaps inside of FakeSnap() 2024-01-06 16:02:43 +01:00
Robert Müller 1861e922b2 Fix files not being truncated when opening for writing on Windows
Files were not being truncated on Windows anymore when using `io_open` with `IOFLAG_WRITE` due to a regression from #7254. Instead, the existing file contents were kept and the file pointer was set to the beginning of the file.

This caused broken demo files to be created (#7349) when recording a shorter demo with the same filename as an existing longer demo. It also caused the map tools to produce maps with additional junk data at the end, if an existing map is overridden by a smaller map.

This is fixed by using the creation disposition `CREATE_ALWAYS` instead of `OPEN_EXISTING` with [`CreateFileW`](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew), which ensures that a file is always created and truncated.

A regression test case is added, which fails without this change.
2024-01-06 15:32:21 +01:00
Dennis Felsing c5d6389132
Merge pull request #7764 from heinrich5991/pr_ddnet_msg_groups
Group a couple of "list" messages
2024-01-05 18:34:39 +00:00
heinrich5991 ac041d7f34 Group CNetMsg_Sv_CommandInfo 2024-01-05 18:10:57 +01:00
heinrich5991 f81828e78e Group CNetMsg_Sv_VoteOptionListAdd 2024-01-05 18:10:57 +01:00
heinrich5991 c12835bc39 Group NETMSG_RCON_CMD_ADD 2024-01-05 18:10:57 +01:00
Robert Müller a55d49833e Use IStorage::FormatTmpPath function for editor map names 2024-01-05 17:46:26 +01:00
swarfeya d04cb7a36a actually fix happy ddnet message 2024-01-04 18:36:32 +01:00
Robert Müller 84f3bb5a4d Fix missing editor explanation for kill tile in front layer
The kill tile can also be used in the front layer and works as expected.
2024-01-04 17:42:53 +01:00
Dennis Felsing ca9c4f532a
Merge pull request #7757 from Robyt3/Graphics-LoadTexture-Move
Avoid copying texture memory when possible
2024-01-04 11:32:42 +00:00
Dennis Felsing 4f89a4d3fd
Merge pull request #7749 from archimede67/editor-fix-autosave-crash
Fix crash on editor autosave, add system method `timestamp_from_str`
2024-01-04 11:17:08 +00:00
Robert Müller abc7b602b2 Avoid copying texture memory when possible
Add separate `IGraphics::LoadTextureRawMove` function with non-`const` `void *pData` argument in addition to existing `LoadTextureRaw` function with `const void *pData` argument. The former function takes ownership of the data and avoids copying the texture data into an additional buffer, if the texture data is already in RGBA format. Non-RGBA texture data always needs to be converted and therefore also copied.

The `LoadTextureRaw` function is split into smaller functions to share common code with the `LoadTextureRawMove` function. Alternatively to this, a flag `TEXLOAD_MOVE_DATA` could have been added to the existing `LoadTextureRaw` function, which would have required the use of `const_cast` to free the texture data.
2024-01-03 23:03:04 +01:00
Corantin H 3c9294321e Fix crash on editor autosave
Add system method `timestamp_from_str` and add tests.
Replace `int64_t` with `time_t` to be more consistent.
2024-01-02 23:38:41 +01:00
heinrich5991 022cae6f20
Merge pull request #7753 from Robyt3/Client-Assertion-Handler-Crash-Fix
Fix crash in assertion handler after client/graphics destroyed
2024-01-02 18:42:15 +00:00
Robert Müller e27bf7b6c1 Fix crash in assertion handler after client/graphics destroyed
Unset the assertion handler before shutting down the kernel (including graphics) and client. Otherwise the assertion handler itself crashes when assertion errors happen after the graphics/client have been destroyed.
2024-01-02 19:20:57 +01:00
Robert Müller c99d77ab84 Fix wrong selection in vote menu when selected player leaves
The selection in the kickvote/specvote menu was reset to the first player when the previously selected player leaves or if the filter string does not match it. Now the selection is cleared in these cases, to prevent players from accidentally starting kickvotes/specvotes on the wrong player.

Remove unnecessary `static` variable. Improve readability by not nesting post-increment in another statement.
2024-01-02 18:10:48 +01:00
ChillerDragon 81c43ded42 Explicitly set all 0.7 dmg event fields 2024-01-02 13:40:13 +01:00
Corantin H 454b4e4a1e Respect corners when doing edit box when rendering value selector 2023-12-31 12:07:21 +01:00
Dennis Felsing 3defe8eb0e
Merge pull request #7703 from BlaiZephyr/fix-cmake-warning
change cast of pointer to uintptr_t
2023-12-30 23:11:53 +00:00
heinrich5991 04553d6798
Merge pull request #7706 from Robyt3/Menus-Player-Tee-Settings-Improvement
Improve player and tee settings menus
2023-12-30 22:51:44 +00:00
heinrich5991 fc825fb091
Merge pull request #7696 from ewancg/tp-coords
add x and y coords to /tp
2023-12-30 22:50:06 +00:00
melon 5d35cd8a66 change cast of pointer to uintptr-t 2023-12-30 22:54:47 +01:00
Ewan Green 124bbc429a add x and y coords to /tp 2023-12-30 14:50:48 -07:00
Robert Müller f5e7fa24d6 Add color palette and pipette to editor
Add color palette with up to 8 colors to editor toolbar. The palette colors work like regular color picker buttons, so they open a color picker popup on click and the value can be copied and pasted with Ctrl+Right click and Ctrl+Left click respectively. Less palette colors are shown when not enough space is available (with 5:4 resolutions).

Add color pipette which allows selecting any color displayed on the screen. Selecting a color with the pipette adds the new color to the palette and shifts the other colors to the right. The selected color is also copied to the clipboard immediately. The hotkey Ctrl+Shift+C is added to toggle the color pipette, which allows using the color pipette in popups and dialogs.

The implement this, the function `IGraphics::ReadPixel` and the command `SCommand_TrySwapAndReadPixel` are added to read a specified pixel's color from the backbuffer. Like the screenshot command, this command also requires a swap operation to be performed before the correct pixel color can be read with the Vulkan backend. The `ReadPixel` function therefore accepts a pointer to a `ColorRGBA` that will be filled after the next swap operation.

Closes #7430.
2023-12-30 13:17:30 +01:00
Dennis Felsing 9c8a081692
Merge pull request #7743 from furo321/hookduration-07
Fix players on 0.7 becoming invisible when `m_HookTick` is negative.
2023-12-29 22:58:38 +00:00
furo a918c61de8 Fix players on 0.7 becoming invisible when m_HookTick is negative. 2023-12-29 22:39:42 +01:00
Robert Müller 661339cc64 Optimize allocation of sound sample indices
Replace linear search for free sample index with free list. This brings sound sample index allocation down to constant complexity independent of the number of allocated sounds. On average the time to allocate sound samples is reduced by around 75% (843µs down to 223µs). For perspective, the time to load all default sounds on client launch is reduced by around 15ms (although this does not significantly affect launch time due to threaded loading).
2023-12-29 13:07:04 +01:00
Robert Müller 87191a380e Use sound lock when setting/getting current time of sample
The lock needs to be owned when accessing the sound voices. Calling `IsPlaying` is redundant, as the loops effectively check whether the sample is playing.
2023-12-29 12:35:45 +01:00
Robert Müller 7a84a746e0 Add CSample::TotalTime function 2023-12-29 12:25:39 +01:00
Dennis Felsing 0f1171a501
Merge pull request #7741 from furo321/translate-racefinish
Use 0.7 translation layer for `Sv_RaceFinish` netmessage.
2023-12-29 08:00:19 +00:00
furo 1a94aa6d8a Use 0.7 translation layer for Sv_RaceFinish netmessage. 2023-12-29 08:33:36 +01:00
Dennis Felsing ee2dd0ac1c
Merge pull request #7740 from Robyt3/UI-Mouse-Clamp
Fix mouse being outside of UI screen on right and bottom edges
2023-12-28 22:33:27 +00:00
dobrykafe 429b0c6fdb add restart button for restart warning label 2023-12-28 22:39:36 +01:00
Robert Müller 018529c683 Fix mouse being outside of UI screen on right and bottom edges
Ensure that the UI mouse position stays inside the UI screen rect. Previously, the mouse was not considered to be inside the UI screen when all the way at the right or bottom edge. This caused the map editor tooltip to not be shown when the mouse is all the way at the right side of the map editor view. This is a cleaner fix for #4553 which reverts the previous workaround from #6423.
2023-12-28 21:23:16 +01:00
Dennis Felsing 3820abaefb
Merge pull request #7739 from Robyt3/Editor-Toolbar-Anim-Grid-Icons
Improve editor toolbar anim and grid buttons, add dropdowns
2023-12-28 18:04:51 +00:00
Corantin H ffd7776147 Add cursor types and use resize cursor for dragbars 2023-12-28 18:35:23 +01:00
Corantin H c2ce2c9d1a Refactor editor dragbar, allow resize of layers panel 2023-12-28 18:35:22 +01:00
Robert Müller c9640459e4 Improve editor toolbar anim and grid buttons, add dropdowns
Add dropdown menus for changing animation and grid settings (i.e. animation speed and grid size) instead of conditionally showing more buttons for this directly in the menu bar. This frees up space in the menu bar, which is currently full on 5:4 resolutions.

The icons previously used for the default animation/grid buttons are now used for the main buttons that toggle animation/grid instead of using text.

Support setting lower animation speeds with the plus and minus buttons by adjusting the step size when the animation speed is low.

Support setting arbitrary animation speed by text input.
2023-12-28 17:43:09 +01:00
Dennis Felsing fedad1de6c
Merge pull request #7736 from archimede67/editor-fix-group-pos-props
Editor: fix group position properties not working correctly
2023-12-27 23:23:53 +00:00
Dennis Felsing 02331d1986
Merge pull request #7733 from Robyt3/Textrender-Selection-Quad-Reuse
More efficient text selection rendering
2023-12-27 23:13:49 +00:00
Corantin H 3d606847fd Fix group position properties not working correctly 2023-12-28 00:03:28 +01:00
Corantin H 83540ade5c Fix duplicate layers in popup layer context
Clear layers from context before adding any layer, preventing layers from being kept in the vector until only a single layer is selected. Fixes #4978.
2023-12-27 23:11:52 +01:00
Robert Müller 72019df288 More efficient text selection rendering
Render one quad for each line of the text selection instead of rendering one quad per selected character.

This increases the average FPS when the console is open and all text is selected by around 10% (from around 849 to around 943 FPS) (on my machine, in release mode).
2023-12-27 21:07:25 +01:00
Dennis Felsing 15e6e5eeab
Merge pull request #7730 from archimede67/editor-fix-picker
Fix broken selection in editor
2023-12-27 17:38:57 +00:00
Dennis Felsing f93573c55a
Merge pull request #7732 from archimede67/editor-fix-append
Editor: improve append (fixes #7625)
2023-12-27 17:38:40 +00:00
Corantin H f3fc85cfbb Improve editor append (fixes #7625)
Fix broken editor append.
Check for image data when image names are identical. In such case, appended image is renamed until its name is unique.
2023-12-27 18:09:39 +01:00
Corantin H b949a7de21 Fix broken selection in editor 2023-12-27 17:41:19 +01:00
Dennis Felsing dfb6967a47
Merge pull request #7722 from archimede67/autocomplete-console-refactor
Refactor argument autocompletion in console
2023-12-27 15:01:06 +00:00
Dennis Felsing a149d28649
Merge pull request #7728 from archimede67/editor-differentiate-cp-tele
Editor: differentiate between normal and checkpoint teles
2023-12-27 14:45:37 +00:00
Corantin H 42771ac42f Refactor argument autocompletion in console
Allows autocompletion of specific argument instead of the first argument only
2023-12-27 15:43:56 +01:00
Corantin H 84c2168650 Differentiate between normal and checkpoint teles 2023-12-27 15:23:57 +01:00
Robert Müller 32373c0559 Fix color rendering being inconsistent with displayed color values
When normalizing color components in the engine graphics, round the components to the nearest integer instead of rounding down. Otherwise the color that is rendered in color pickers may be off by 1 in any of its RGB components from the color that the color picker displays as text (hex string and individual components). The slightly incorrect color can be confirmed by creating a screenshot or otherwise reading the backbuffer (planned editor pipette feature).

This should not change map rendering, since maps already store quantized RGBA values on which the rounding mode should have no effect. It may however slightly change appearance of colors in all other places (at most +1 in every RGB component).
2023-12-27 13:49:55 +01:00
Robert Müller 6cc42aa58c Fix slightly incorrect color components shown in color pickers
The individual color components were rounded down when being displayed on their own in color pickers, whereas the components are rounded to the nearest integer when packing the colors into the hex string. This was causing minor discrepancies between the color being displayed/saved as hex and the individual components. Rounding the components when packing is necessary to reduce the error when converting between color spaces.
2023-12-27 13:47:03 +01:00
Dennis Felsing 269f276fee
Merge pull request #7726 from archimede67/allow-panning-outside-container
Editor: allow panning outside initial container
2023-12-27 12:20:34 +00:00
Dennis Felsing e549e67c95
Merge pull request #7725 from archimede67/editor-automap-include-fix
Only include `layer_tiles.h` in `auto_map.cpp`
2023-12-27 12:05:32 +00:00
Corantin H 4e10d55b36 Allow panning outside initial container 2023-12-27 12:57:36 +01:00
Corantin H d3ff602f62 Only include layer_tiles.h in auto_map.cpp 2023-12-27 12:29:25 +01:00
Robert Müller 04f4305165 Improve player and tee settings menus
Add tabs to player and tee settings pages to switch between player (main) and dummy settings instead of using a checkbox for this, to improve the usability.

Improve layout of tee settings page, especially with 5:4 resolutions, where the eye selector previously overlapped with other UI elements. Decrease size of eye selector and make better use of empty space overall. Use more space for skin selector instead of showing empty space when "Use custom colors" is disabled.

Show favorite skin buttons also when hovering list items to make it easier to discover the feature. Add small highlight color to favorite skin buttons when hovering them.
2023-12-27 11:56:35 +01:00
Robert Müller 4c2dfa24db Improve performance when rendering map overlay texts
The text color was previously set and reset for every individual number being rendered for non-empty tele, speedup, switch and tune tiles. The color is the same for all tiles from each entities layer, so most of these `TextColor` calls are unnecessary. Now the text color is only set and reset once when rendering each entities layer.
2023-12-27 11:51:18 +01:00
Dennis Felsing 453bc0f66a
Merge pull request #7720 from MrBlubberBut/patch-2
Fix automatic hammer on release when cl_dummy_control is set to 1
2023-12-27 09:01:45 +00:00
Dennis Felsing 9828da6f3e Fix formatting 2023-12-27 09:45:10 +01:00
Dennis Felsing 751b2a4a93
Merge pull request #7721 from archimede67/editor-better-tele-text
Editor: improve text rendering inside tele tiles
2023-12-27 08:44:04 +00:00
Corantin H fcc095b675 Improve text rendering inside tele tiles in editor 2023-12-27 00:16:44 +01:00
Dennis Felsing 90596e51ee
Merge pull request #7719 from archimede67/editor-adjust-special-tiles-shortcut
Editor: add shortcut to adjust special tiles numbers
2023-12-26 22:13:02 +00:00
Corantin H 166b27fc27 Use ctrl+f when brush is not empty to replace tile numbers with next free 2023-12-26 20:42:42 +01:00
Corantin H 643cdf8717 Add shortcut to change tele, switch and tune number of current brush (#5400) 2023-12-26 20:17:36 +01:00
MrBlubberBut 32e187f18e
Fix automatic hammer on release when cl_dummy_control is set to 1
Let's say you have this bind:

```bind x +toggle cl_dummy_hammer 1 0```

and you set cl_dummy_control to 1.

When you press the bind i mentioned above, and then release, the dummy will hammer where he is looking (not at you). So, in total, there will be two hammers. One hammer when you press down the button and the dummy hammers towards you, and then another hammer when you release the button and the dummy hammers where he is looking.

This fixes it, and also makes sure it does not conflict with cl_dummy_copy_moves (as if it is enabled and cl_dummy_control is enabled, the dummy will not copy fire, hook, or jump) so I made sure it keeps this functionality as it's pretty cool.

This does not fix any other bugs yet, maybe I will fix those in the future but we'll see. Any bug you may encounter with this change is also probably present in the main branch, such as resetonswitch not working perfectly with dummy_control, but if you do find something different then let me know.
2023-12-26 13:59:06 -05:00
Dennis Felsing 8ce103f04f
Merge pull request #7717 from archimede67/editor-unused-tiles-popup
Show unused tiles warning popup for all entities layer
2023-12-26 18:29:35 +00:00
Dennis Felsing 53dba33c21
Merge pull request #7715 from infclass/kaffeine/pr
RenderTools: Add const/static method qualifiers
2023-12-26 18:24:25 +00:00
Dennis Felsing 998dcaa393
Merge pull request #7716 from archimede67/quads-qol-buttons-fix
Remove checks when drawing quads QoL buttons
2023-12-26 18:13:53 +00:00
Corantin H e9958aca19 Show unused tiles warning popup for all entities layer 2023-12-26 19:11:36 +01:00
Alexander Akulich 43710fe541 Use CRenderTools::GetRenderTeeOffsetToRenderedTee via class name instead of instance
Fixes clang-tidy warning.
2023-12-26 21:08:50 +03:00
Corantin H 70d263a7d5 Remove ifs when drawing quads QoL buttons 2023-12-26 18:49:45 +01:00
Alexander Akulich 7e95d4be22 CGameClient::CClientData::Reset: Reset skin info 2023-12-26 19:37:21 +03:00
Alexander Akulich f396056425 CRenderTools: Mark some methods static and (some) const 2023-12-26 19:37:21 +03:00
Robert Müller 0a0e066535 Remove unused FlipImgData parameter from Vulkan backend
The parameter is always set to `false` so the code is unused.
2023-12-26 17:34:02 +01:00
Robert Müller c3689cd9b4 Remove unused VkBufferImageCopy Region variable
According to the Vulkan specification, the struct `VkBufferImageCopy` is used only for `vkCmdCopyBufferToImage` and `vkCmdCopyImageToBuffer`. The variable `Region` is only initialized but not passed to either of those functions.
2023-12-26 14:06:24 +01:00
Dennis Felsing a9c316055f
Merge pull request #7712 from furo321/rework-cfilecollection
Rework `CFileCollection`.
2023-12-26 08:02:40 +00:00
Dennis Felsing f12f789c3a
Merge pull request #7709 from furo321/server-demos-fixes
A few fixes and improvements to server-side auto demos.
2023-12-26 07:58:30 +00:00
Dennis Felsing 03ce78f781
Merge pull request #7711 from Robyt3/Textrender-Selection-Fix
Improve text line spacing and console text selection
2023-12-26 07:58:14 +00:00