Commit graph

20504 commits

Author SHA1 Message Date
Robert Müller 3d746099fa Refactor image loading, saving and manipulation
Move `CImageInfo` from `engine/graphics.h` to own file `engine/image.h`. Also add 2-component image format to `CImageInfo::EImageFormat` for completeness, to replace the separate `EImageFormat` in `image_loader.h` with `CImageInfo::EImageFormat`.

Move `SetPixelColor`/`GetPixelColor` functions from editor to `CImageInfo` as member functions.

Replace `IGraphics::CopyTextureBufferSub` and `IGraphics::CopyTextureFromTextureBufferSub` functions with more versatile `CImageInfo::CopyRectFrom` function.

Make `IGraphics::LoadSpriteTexture` function more efficient by avoiding a copy of the image data by using the `LoadTextureRawMove` function. Remove unnecessary delegate function `CGraphics_Threaded::LoadSpriteTextureImpl` and temporary buffer `m_vSpriteHelper`.

Move `CEditorImage::DataEquals` function to `CImageInfo::DataEquals`. Use `mem_comp` to compare image data for more efficiency, instead of comparing each pixel individually.

Add another `IGraphics::LoadPng` function that loads image directly from memory and also handles the pnglite incompatibility warnings. This function will be used for more efficient loading of downloaded skin in the future.

Add convenience functions to load/save PNGs from/to `IOHANDLE` to reduce duplicate code when loading and saving images especially in the tools. These functions explicitly only allow loading images in RGBA and RGB format. Move general purpose image loading and saving functions to class `CImageLoader`.

Add more convenient `CByteBufferReader` and `CByteBufferWriter` classes for reading from and writing to a byte buffer while keeping track of the read/write position to replace existing `SImageByteBuffer`.

Extract `ConvertToGrayscale` utility function to reduce duplicate code when creating grayscale versions of skins, start menu images and community icons.

Move and rename `ConvertToRGBA` static function from graphics to `ConvertToRgba` in `image_manipulation.h/cpp`. Add `ConvertToRgbaAlloc` convenience function which allocates the target buffer. Add ``

Add `DilateImage`, `ResizeImage` and `ConvertToRgba` convenience functions that directly accept a `CImageInfo` argument that will be modified.

Remove unnecessary image size limitation in `map_replace_image` tool, which would only be relevant for 0.7 compatible maps. Adjust the maximum allowed image width/height in `map_convert_07` tool to be consistent with the actual limit that the 0.7 client has when loading images (`1 << 13 == 8192`).

Add doxygen comments for `CImageInfo`.

Pass `CImageInfo` by reference consistently, instead of sometimes passing a pointer.

Cleanup image loading and saving code. Improve error handling.
2024-09-16 17:49:18 +02:00
Robert Müller 5212d1d7ce Rename variables with PNG to Png 2024-09-16 15:45:30 +02:00
Dennis Felsing 67eb609452
Merge pull request #8964 from furo321/fix-dragger-crash
Fix crash while attached to dragger during `hot_reload`
2024-09-16 13:06:01 +00:00
furo ad0fc8898f Fix crash while attached to dragger during hot_reload 2024-09-16 13:52:49 +02:00
Robert Müller 0a3a095479
Merge pull request #8958 from dobrykafe/pr-filter-skin-parts
Make 0.7 skin filter apply to skin parts
2024-09-16 08:45:12 +00:00
Dennis Felsing ce245f479a
Merge pull request #8963 from ChillerDragon/pr_fix_hilite
Fix name in chat not being highlighted (Closed #2190)
2024-09-16 07:35:48 +00:00
ChillerDragon ac0621a062 Fix name in chat not being highlighted (Closed #2190)
The message "xfoo foo" did not highlight for player "foo" now it does.
2024-09-16 12:39:35 +08:00
Dennis Felsing 20cb02048d
Merge pull request #8957 from Robyt3/Client-Binds-Composite-Chat-Console-Menus-Fix
Fix composite binds that open chat, console or menus
2024-09-15 21:43:19 +00:00
Dennis Felsing a5138c078e
Merge pull request #8949 from MilkeeyCat/pr_fix_color_speed_values
Fix colored speed values after connecting to a server
2024-09-15 21:42:02 +00:00
dobrykafe bf442a9f95 make 0.7 skin filter apply to skin parts 2024-09-15 23:11:11 +02:00
Robert Müller 0d93b1add7 Fix composite binds that open chat, console or menus
Events with flag `FLAG_RELEASE` must always be forwarded to all components so keys being released can be handled in all components also after some components have been disabled.

Closes #8901.
2024-09-15 14:54:03 +02:00
Dennis Felsing 0f12044fcd
Merge pull request #8956 from Robyt3/UI-Scrollbar-Rail-HotItem
Fix scrollbar rail clicking being active while popups open
2024-09-15 10:21:41 +00:00
Robert Müller 8f2c288698 Fix scrollbar rail clicking being active while popups open
Scrollbars are now also set as the hot item when the rail is hovered and the rail clicking function is now only enabled for the scrollbar that is the hot item.

Closes #8954.
2024-09-15 11:45:22 +02:00
MilkeeyCat 9963a3e3db Pass color to RenderMovementInformationTextContainer function 2024-09-15 12:40:17 +03:00
Dennis Felsing 4b6f2e22a8
Merge pull request #8955 from furo321/url-master-parsing
Don't allow URLs without port from the masterserver
2024-09-15 09:28:43 +00:00
furo 7bbd51cf73 Don't allow URLs without port from the masterserver 2024-09-15 11:04:48 +02:00
Dennis Felsing dcd02b50bb
Merge pull request #8953 from ChillerDragon/pr_bind_null
Add BindNull to SQL api
2024-09-15 06:31:43 +00:00
Dennis Felsing 4fe956dffc
Merge pull request #8951 from furo321/fix-capture-count
Fix captures not being counted for certain names
2024-09-15 06:13:40 +00:00
ChillerDragon 7c2f058c40 Add BindNull to SQL api
Comes in handy in my downstream project
2024-09-15 09:14:00 +08:00
furo 6bf4a016ba Fix captures not being counted for certain names 2024-09-15 00:51:39 +02:00
Dennis Felsing 0feee9aa3e
Merge pull request #8948 from Robyt3/Client-Chat-TeeRenderInfo-Cleanup
Store `CTeeRenderInfo` instead of members for chat lines, extract `CTeeRenderInfo::Apply(const CSkin *)` function
2024-09-14 21:39:46 +00:00
MilkeeyCat d5be8d1633 Fix colored speed values after connecting to a server 2024-09-14 23:18:28 +03:00
Robert Müller 65cf776846 Extract CTeeRenderInfo::Apply(const CSkin *) function
Add function to apply information of `CSkin` to a `CTeeRenderInfo` to reduce duplicate code.
2024-09-14 21:12:43 +02:00
Robert Müller 62075d22e3 Store CTeeRenderInfo instead of members for chat lines
Avoid code to convert from `CTeeRenderInfo` to chat-internal representation and back to `CTeeRenderInfo`.
2024-09-14 21:12:25 +02:00
Robert Müller 0369946156
Merge pull request #8946 from MilkeeyCat/pr_fix_callvote_map_change
Don't add `/` if the directory is empty
2024-09-14 17:11:22 +00:00
MilkeeyCat 232018de23 Don't add / if the directory is empty 2024-09-14 19:49:01 +03:00
Dennis Felsing 868c513c0c Version 18.5.1 2024-09-14 15:55:22 +02:00
Dennis Felsing 5a4d8e26e6
Merge pull request #8941 from Robyt3/Client-Skin07-Dummy-Skin-Name
Fix dummy 0.7 tee skin name not being used, fix some unused config variables not being detected
2024-09-13 21:30:19 +00:00
Robert Müller ffabdee953 Fix some unused config variables not being detected
Unused config variables were not detected if they were the prefix of a longer config variable which is used.
2024-09-13 21:37:25 +02:00
Robert Müller 7e1881263d Fix dummy 0.7 tee skin name not being used
The dummy 0.7 skin name was not being updated and used, causing the wrong skin to be selected when switching between player and dummy settings.
2024-09-13 21:36:31 +02:00
Dennis Felsing bf5add67ec
Merge pull request #8940 from Robyt3/Client-Skin07-Settings-Refactoring
Rework 0.7 tee settings layout and code
2024-09-13 15:37:01 +00:00
Dennis Felsing a09ce576ac
Merge pull request #8907 from KebsCS/pr-hotreload-dummy
Fix dummy disconnecting on hot reload
2024-09-13 15:36:05 +00:00
Robert Müller 6af07a78b3 Rework 0.7 tee settings layout and code
- Show Player/Dummy tabs at the top instead of using checkbox for dummy settings like in regular skin settings.
- Show Basic/Custom tabs instead of using button to toggle custom skin settings.
- Move Skin directory and Refresh icon buttons to right side like in regular skin settings. Refreshing 0.7 skins and parts is not implemented yet though.
- Render 0.7 skin entries like entries of the regular skin list, i.e. with more space and with only four skins per row.
- Move the Random skin button next to the Custom colors checkbox and make it an icon button like in the regular skin settings.
- Move skin preview to the right side of the Player/Dummy/Basic/Custom tabs to reduce unused empty space.
- Remove most overlapping and unnecessarily dark backgrounds.
- Improve layout of skin part tabs by only using colors for the first and last buttons.
- Localize skin part tab names again but properly capitalize the names being shown in the UI.
2024-09-13 17:01:41 +02:00
KebsCS 1477b8c69e
Fix dummy disconnecting on hot reload 2024-09-13 16:53:06 +02:00
Dennis Felsing 8d431f8feb
Merge pull request #8934 from sjrc6/pr_freeze_stars
Add client setting to restore old freeze stars
2024-09-12 12:31:54 +00:00
Tater 80e2de13da Add client side freeze stars 2024-09-12 04:48:46 -05:00
Dennis Felsing 66fb5d5d7f
Merge pull request #8933 from Robyt3/UI-EditText-Searchable
Extract `CUi::DoEditBox_Search` function for quick search
2024-09-11 21:55:25 +00:00
Robert Müller d3f0c2a156 Extract CUi::DoEditBox_Search function for quick search
Reduce duplicate and inconsistent code for rendering quick search for the demo browser, ingame vote list, player flag, skin, skin 0.7 and asset search.

The quick search and exclude in the server browser are not refactored, as they have additional labels and different alignment, which would make a general function complicated.
2024-09-11 21:33:08 +02:00
Jupeyy d5e81ca78d
Merge pull request #8932 from Robyt3/Client-Network-Before-Graphics
Initialize client networking before graphics
2024-09-11 18:07:20 +00:00
Robert Müller 128ffd2313 Initialize client networking before graphics
Avoid Vulkan crash if the backend is destroyed immediately after being created.

Slightly decreases time of initial black screen before loading menu is rendered.
2024-09-11 19:34:31 +02:00
Dennis Felsing af1b32d296
Merge pull request #8930 from timakro/pr-fix-econ-listening-publicly
Fixes a bug where econ was exposed publicly when ec_bindaddr was set to localhost
2024-09-11 16:50:42 +00:00
Tim Schumacher 0ad1c08c22 Fixes a bug where econ was exposed publicly when ec_bindaddr was set to localhost
Also implements the original intention of 85f5e9c that is to disable
econ if ec_binaddr is invalid.
2024-09-11 18:28:07 +02:00
Dennis Felsing 9f278979e5
Merge pull request #8926 from Robyt3/Editor-RGB-Mapres-Fix
Fix editor crash when saving maps with RGB mapres
2024-09-10 22:01:35 +00:00
Robert Müller 32e9240634 Fix editor crash when saving maps with RGB mapres
Convert mapres to RGBA immediately when loading them, so the image data is always in RGBA format internally, instead of only converting when the map is saved (which was erroneously removed in #8670).

This means the `cl_editor_dilate` setting will now also be applied to converted RGB images.
2024-09-10 21:22:56 +02:00
Dennis Felsing b5d662622c
Merge pull request #8918 from Robyt3/Cleanup-Color-mem_comp
Use operator `!=` instead of `mem_comp` for colors
2024-09-09 16:14:43 +00:00
Robert Müller 58ce5985d4 Use operator != instead of mem_comp for colors 2024-09-09 17:17:17 +02:00
Dennis Felsing 46acbdd6bf
Merge pull request #8916 from Robyt3/Android-API-Version-Building-Fix
Fix minimum Android API version and linking errors
2024-09-08 16:41:58 +00:00
Robert Müller d536bceed6 Fix minimum Android API version and linking errors
The minimum supported API version must be specified when building the native libraries, otherwise this may cause linking errors when launching the app.

The minimum API level is increased to 24 (Android 7.0, covering 97.2% of usages) because:

- Vulkan is only available from API 24+ on ARM64 and x64.
- curl only compiles with API 23+.
- The NDK version we use supports only API 21+.

Ensure that the C++/Linker flags are set when building Android libraries, which was causing errors due to `-fPIC` not being set for all libraries.
2024-09-08 17:59:41 +02:00
Dennis Felsing 337d5c7ab3
Merge pull request #8915 from Robyt3/Base-Detect-ARM-Redefinition-Fix
Fix redefinition of `CONF_ARCH_STRING` for ARM architectures
2024-09-07 21:03:40 +00:00
Robert Müller 8e45d0a71a Fix redefinition of CONF_ARCH_STRING for ARM architectures
The macro `__ARM_ARCH` is defined both for 32-bit and 64-bit ARM so it cannot be used to identify ARM64. Now `__ARM_ARCH_ISA_A64` is used instead, which should only be defined for ARM64. This caused a warning due to the macro `CONF_ARCH_STRING` being redefined when compiling for Android. Furthermore, support for detecting big-endian ARM64 with the `__ARM_BIG_ENDIAN` macro is added.

See https://developer.arm.com/documentation/dui0774/g/chr1383660321827
2024-09-07 21:16:09 +02:00