mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-25 20:14:43 +01:00
Plugins register modes (card, replaces, order, flag, players) and publish documents through reskate.throwdowns.ui: the setup page, the waiting card, HUD slots themed on the game's HUD_<theme>_* widgets, the match panel, flags and match restrictions. SmokeyDawg58's native plumbing (throwdown_menu.cpp and its .inl files) renders them and posts throwdown_ui events back. kit::flag is the one native flag registration. General services added for it: reskate.files, reskate.ui.dialog, reskate.skater push/hold/bone_cam, reskate.camera.pad_flight, reskate.physics competition, reskate.session.world, reskate.tricks feed/gesture, and world entities. His ten modes are now Lua in his plugin: the rules, referee and wire (td/rules, referee, wire), and every page and HUD document (td/ui*.lua). Extension/Modes and reskate.modes are gone, along with every race and 1-UP branch in the SDK. The plugin test drives each mode through kit events. A native setup page is never written to while it closes into flag placement: its rows are not republished, the stock page is put back once the exit is over, and the stock Players slider is left alone while a plugin flag is out. This fixes the crashes on the Deathrace button and on 1-UP's Confirm.
26 lines
1.1 KiB
C++
26 lines
1.1 KiB
C++
#pragma once
|
|
#include <cmath>
|
|
#include <optional>
|
|
namespace dingosdk::multiplayer {
|
|
// The native flag picker uses this movement ceiling independently of its
|
|
// ground validator. Retain the latest native value and restore only our edit:
|
|
// the registration asks for its own ceiling (kit::flag::Options::cursor_height).
|
|
class NativeFlagCursorHeight {
|
|
float previous{},raised{};bool owned{};
|
|
public:
|
|
std::optional<float> apply(float current,float wanted) noexcept {
|
|
if(!std::isfinite(wanted) || wanted<=0)return {};
|
|
if(owned && current==raised && raised==wanted)return {};
|
|
// A new ceiling replaces ours: the native value under it is still the one to restore.
|
|
if(owned && current==raised) {raised=wanted;return wanted;}
|
|
owned=false;
|
|
if(!std::isfinite(current) || current<0 || current>=wanted)return {};
|
|
previous=current;raised=wanted;owned=true;return wanted;
|
|
}
|
|
std::optional<float> restore(float current) noexcept {
|
|
const bool ours=owned && current==raised;owned=false;
|
|
return ours?std::optional{previous}:std::nullopt;
|
|
}
|
|
};
|
|
}
|