mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-23 19:56:00 +02:00
reskate.throwdowns.mode{...} adds a mode to the game's own Throwdowns page: a card on
the picker, the real Spot Battle setup page relabelled with the mode's name, logo,
description, players, timer and rows (sliders, choices, buttons), and the native start
flag. The plugin hears throwdown_mode events (opened, setting, button, placed with the
flag's position and heading, start, leave, cancelled) and runs the mode itself;
release_flag takes the flag down. The flag's queue never starts a Spot Battle: its
waiting card's Start goes to the plugin, MaxPlayers is held at 10 and it is never
relayed as a drop. After SmokeyDawg58's one_up_menu and one_up_placement
(reskate-custom-mods), generalised over a mode registry.
The page is his 4-column logo grid whether or not a plugin has a mode. Its widgets and
grid records, and the game assets it uses that only some levels load, ship in
ReSkate.dll as the throwdown_menu built-in pack, taken from his asset mod's FBMOD
(dingosdk_ebx_pick trims the asset list in place). A mode's logo is a texture path in
its own mod, so no mod edits the shared list. The FPV drone is no longer a built-in pack.
Native menu data: text initialization, change-only writes, retained array publication,
owned-model rollback. Tests: registry and setup helpers, the plugin API, a test plugin
with two modes.
26 lines
1.2 KiB
C++
26 lines
1.2 KiB
C++
#pragma once
|
|
#include <functional>
|
|
#include <type_traits>
|
|
|
|
namespace dingosdk::multiplayer::menu_data {
|
|
// A byte snapshot of a native row still borrows its strings, delegates and
|
|
// nested arrays. Native array publication resizes/destroys destination rows
|
|
// before it copies replacements. Retain the complete source into an owned
|
|
// temporary first, and release that temporary only after publication returns.
|
|
template<class Acquire, class Stage, class Publish, class Release>
|
|
void publish_retained_array(Acquire&& acquire, Stage&& stage, Publish&& publish, Release&& release) {
|
|
auto owner = std::invoke(acquire);
|
|
using Owner = decltype(owner);
|
|
static_assert(std::is_nothrow_invocable_v<Release&, Owner&>, "Native transient array release must not throw.");
|
|
struct Guard {
|
|
Owner& owner;
|
|
Release& release;
|
|
~Guard() noexcept { std::invoke(release, owner); }
|
|
} guard{owner, release};
|
|
// Acquisition does not resolve/copy fields: the guard must already exist
|
|
// if validation or a partially completed native typed copy fails.
|
|
std::invoke(stage, owner);
|
|
std::invoke(publish, owner);
|
|
}
|
|
} // namespace dingosdk::multiplayer::menu_data
|