mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-24 21:46:18 +02:00
A mod's item (or one of the game's own a mod changes) keeps three empty description lines, so the game's item card, which grows upward from a fixed bottom edge, always has room in the same place; the overlay draws the mod there: its icon (decoded off the render thread into a fourth texture slot, the last 32 kept), a MOD or CHANGED BY MOD tag, its name, author, version and how many items it has. The card is placed as the game places its own, measured at many window sizes: by the smaller of its scales, a 21:9 frame centred on wider screens (the search bar follows it too). The warning sign the game's focus script gives any description is taken off that notice each tick while it shows the reserved lines. The merge's item list records each mod's version and folder (an older list falls back to the mods loaded at launch). The item grids now run every client tick instead of at the 500 ms customization pace, follow the highlight between their 40 ms passes, and let go of a grid as soon as its screen closes, so the card, the search bar and favorites keep up with the player.
32 lines
1.5 KiB
C++
32 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
// Which mod each cosmetic item came from, so its card in the customization menu can say so:
|
|
// Mods/.reskate/reskate-items.json. The merge writes it from the items the store-copy check reads
|
|
// in every mod (mod_store_copies.h); the game reads it when it builds its item catalogue.
|
|
namespace dingosdk::mods {
|
|
|
|
inline constexpr char item_sources_file[] = "reskate-items.json";
|
|
|
|
struct ItemSource {
|
|
std::string mod; // its folder name
|
|
std::string title, author, version; // as its manifest gives them
|
|
std::string folder; // where it is, from Mods/ ("x" or ".reskate-official/x"), with its icon.png
|
|
std::vector<std::string> keys; // the items it adds or changes, lower case
|
|
};
|
|
|
|
// Highest priority first, as the merge orders the mods: where two list one item, the game uses
|
|
// the first one's, so that is where it is from. Empty when there is no file or it cannot be read.
|
|
[[nodiscard]] std::vector<ItemSource> read_item_sources(const std::filesystem::path& file) noexcept;
|
|
// Throws when the file cannot be written.
|
|
void write_item_sources(const std::filesystem::path& file, const std::vector<ItemSource>& sources);
|
|
|
|
// How a card names the mod: its title (Thunderstore names have underscores for spaces), and who
|
|
// made it when its manifest says: "ReSkate FPV Drone by zeex64".
|
|
[[nodiscard]] std::string item_source_name(const ItemSource& source);
|
|
|
|
} // namespace dingosdk::mods
|