This mostly reverts #6937 by making our `IOHANDLE` effectively `FILE *` on all systems again. We still use `CreateFileW` to open a `HANDLE` initially so we can specify the necessary flag so the file can be moved/deleted while open, which we can't do with the `FILE *` based `fopen` functions on Windows. This brings back the automatic I/O buffering on Windows, causing significantly less system calls when saving files. Closes#7226.
Simplify the handling of free texture indices by using `-1` only for indices which are currently in use, whereas the size of the vector is now used to indicate the last free index. Otherwise the assertions incorrectly detect the last texture index always being in use because `-1` was used for both states.
Previously, if the demo header strings did not contain zero-termination, the client would render the strings and any following non-zero memory from the demo header.
Now, demos will not be loaded, if any string in the header is not zero-terminated or not valid UTF-8.
When using `auth_remove`, the key indices for the default helper, mod and admin passwords were not properly adjusted, causing the wrong passwords to be used for the username-less logins.
The key indices for connected clients were also not properly adjusted, causing the wrong identity to be shown for currently authenticated clients when using the `status` command.
Closes#6427.
Most variables used in the sound engine were static globals, as they are used in the static sound mixing function. The global variables are replaced by member variables, by passing the sound interface as user-data for the SDL mixing callback. The `Mix` function is made a public member function of `ISound` instead of being exposed using `ISoundMixFunc GetSoundMixFunc()`.
This allows to remove the direct dependency of the engine sound on the engine video, by instead passing the sound mixing function as a lambda to the engine video in the engine client.
The old WavPack reader function interface does support passing a user-data pointer to the callback function, so global variables are still used here.
Respect the intratick when displaying the player position, speed and angle, to fix this information always being shown for the next tick. See #6417. This does not resolve the issue yet, as there are more HUD and player elements that need to make use of the intratick.
Fix highlighted text of server browser entries not being refresh correctly when switching tabs.
This also reduces lag when switching tabs, as the UI elements for all tabs are now cached and don't need to be recreated when switching.
Regression from #7203.
Replace existing hard-coded support for two "networks" with support for a dynamic list of "communities" which are indexed by a string-ID, though right now the DDNet and KoG communities are still hard-coded. The communities now also support an arbitrary number of associated countries, types and servers. This is a refactoring to prepare for getting the list of communities dynamically from the server and removing the DDNet and KoG tabs from the serverbrowser.
New UI elements were being created for every server info after refreshing the server list. At the same time, old UI elements were not being deleted when the server info objects are deleted. The use of `mutable` for this purpose was also rather unclean.
Now, a separate `std::vector` of UI elements is kept for all server browser entries, instead of associating the UI elements directly with the server info.
Move the "Filter", "Info" and "Friends" tabs to the top, above the tab content. Use icons instead of text for the tabs. Use animator to animate the tabs on mouse-over. Closes#6613.
Make spacings, corners and font sizes used in the filter, details and friends tabs more consistent.
Remove some unnecessary dark UI rect backgrounds.
Improve alignment of the number of friends with the heart icon for entries in the server list.
Improve layout of countries and types filters. Make the filters scrollable when there are many entries.
Refactor most of the server browser in preparation for replacing the DDNet and KoG tabs with a community filter, which will work like the countries and types filters. Split rendering of different server browser sections into multiple functions to improve readability. Reduce duplicate code for the countries and types filters.
Remove `Is` from the getter names for the same reason that removing `Get` from the name is preferred. The word `Is` was inconsistently used as a prefix in `CScrollRegion` but as an infix in `CListBox`.
- Remove unnecessary variable `Page`.
- Use `IGraphics::CORNER_NONE` instead of `0` and instead of the inconsistent-looking `CORNER_BR` for the KoG-button.
- Simplify UI rect layout.
The world tuning is a part of the world. This way the entities implementation
use the same API as available on the client side.
This change is a step toward unified/shared world logic for client and server.
Make the skipping duration adjustable with a dropdown menu. The dropdown menu includes the durations 1s, 5s, 10s, 30s, 1m, 5m and 10m. The default duration is 5s. Skipping durations longer than the current demo are not shown. The dropdown menu is only shown if two or more durations would be shown.
Add buttons for skipping the duration, which was previously only possible with the hotkeys.
Add Ctrl+Left/Right hotkeys for skipping to chapters.
Add Shift+Left/Right hotkeys for adjusting the skipping time.
The Left/Right arrow keys and the J/L keys work identically for all hotkeys now.
Ignore ctrl, shift and alt keys for demo speed changes with the mouse wheel, to better support actions like zooming being bound to alt+mousewheel etc.
Also handle keypad enter key for play/pause like the normal return key.
Use arrow up/down icon for speed adjustment buttons, so that the "backward/forward" icons can be used for duration skipping instead.
Closes#7064.
The DDTeam colors were previously generated in HSL by taking the team index and multiplying it by 360/64° to calculate the hue, which results in team colors being evenly distributed over the entire color range like a rainbow. However, this causes colors of adjacent teams to be very similar and therefore hard to distinguish.
Now, the hue is calculated by multiplying the team index with the golden angle (~137.50776°) and taking the modulo 360° of that. Due to the properties of the golden angle, this can generate never repeating sequences of unique colors where the adjacent colors are very distinct.
Duplicate code is reduced by adding the `CGameClient::GetDDTeamColor` function.
Reduce the space reserved for the label by the space for the dropdown icon instead of rendering the label behind the icon.
This is more noticeable with smaller dropdown menu buttons, which will be used in the future.
1. Regardless of the pause the message is CL_SETTEAM and there is no
reason to match it against other messages.
2. Another implementation can save the wanted team and apply it later.
When the buffer of a lineinput is modified externally, the cursor offset and selection are not updated, which causes them to be rendered wrong and also causes the assertion error "Selection and cursor offset got desynchronized" when changing the selection of a lineinput.