Commit graph

5117 commits

Author SHA1 Message Date
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
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
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
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
heinrich5991 c12835bc39 Group NETMSG_RCON_CMD_ADD 2024-01-05 18:10:57 +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
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
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
melon 5d35cd8a66 change cast of pointer to uintptr-t 2023-12-30 22:54:47 +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
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
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
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 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
furo 5b5ead8356 Rework CFileCollection.
- Use existing functions from `system.h`
- Use sorting from `<algorithm>`
- Don't recall `ListDirectory` for every removal, which caused the client to hang previously with a lot of files.
2023-12-26 03:31:06 +01:00
Robert Müller 4c223a0002 Improve text line spacing and console text selection
Consider line spacing to belong to the previous line when calculating and rendering text selection. Instead of handling spacing between entries separately in the console, also include line spacing for the last line in the height calculation. Pixel align the line spacing in addition to the font size, as previously some gaps between the entries were larger than others due to missing pixel alignment. This allows rendering the text selection in the console smoothly without any gaps between the console entries/lines.

Closes #7617.
2023-12-25 19:11:42 +01:00
furo b1f9137e34 Change path to demos/auto/server. Use same filename format as client. 2023-12-25 17:31:25 +01:00
furo 1c098c2941 Don't use the same demo recorder for auto and manual demos. 2023-12-25 17:29:39 +01:00
Robert Müller c31f82a9e9 Refactor graphics SetColor functions
Reduce duplicate code.

Replace `clampf` function with `NormalizeColorComponent` function that convert color component from `float` to `unsigned char`.

Use `size_t` instead of `int`.
2023-12-23 17:56:52 +01:00
Robert Müller 45ced1f499 Avoid duplicate calculation in QuadsTex3DDrawTL
Only calculate `CurIndex` value once outside of loop instead of calculating it every iteration.
2023-12-21 22:04:40 +01:00
Edgar 2b344f4a01
Merge pull request #7647 from Robyt3/Server-Votes-Config-Improvement
Improve vote config variable descriptions and value range
2023-12-20 10:41:17 +00:00
Dennis Felsing 173345df74
Merge pull request #7673 from Jupeyy/pr_fix_ms_sample_accuracy
Fix multi sampling accuracy
2023-12-18 07:52:17 +00:00
Jupeyy caecb31751 Fix multi sampling accuracy 2023-12-17 10:39:28 +01:00
Dennis Felsing e689441d14
Merge pull request #7668 from Robyt3/Engine-Notifications-Interface
Add `INotifications` kernel interface
2023-12-16 23:17:18 +00:00
Dennis Felsing 0ce8413570
Merge pull request #7671 from Robyt3/Server-Config-Flags-Cleanup
Remove `CFGFLAG_SAVE` when `CFGFLAG_SERVER` used
2023-12-16 23:16:51 +00:00
Robert Müller eb222ae02a Remove CFGFLAG_SAVE when CFGFLAG_SERVER used
Server variables are currently not saved.
2023-12-16 21:21:03 +01:00
Robert Müller 5f9d6b208c
Merge pull request #7667 from furo321/rest-of-string
Use rest of string parameter for `save_replay`
2023-12-16 18:39:04 +00:00
furo d2efc936cf Use rest of string parameter for save_replay 2023-12-16 19:02:56 +01:00
Robert Müller 013b8dffa5 Add INotifications kernel interface
Add a proper kernel interface `INotifications` for the notifications component instead of using a C style interface.

Add parameter for the application name when initializing notifications to avoid hardcoding the application name.

The implementation for macOS is kept in Objective-C and a TODO is added, as the API we are currently using appears to be deprecated.
2023-12-16 18:15:43 +01:00
Robert Müller b067ccafc6 Improve vote config variable descriptions and value range
Closes #7584.
2023-12-16 18:01:06 +01:00
archimede67 5dbd5a1f49 Added quad alignment/snapping to other quads/points 2023-12-16 01:29:09 +01:00
Edgar 8be0ba3a84
Merge pull request #7655 from def-/pr-discord-build
Fix discord build
2023-12-15 09:32:28 +00:00