Several events per trigger, built-in stop and done events

A trigger holds a list of events (Frame Properties lists them like sounds);
the first stays its EventId, the rest are <Event Id> children in the
editor's copy, and the Isaac warning counts the dropped ones. In extended
documents, stop and done are offered as built-in events: listed in italics
at the top of Events, locked from renaming, and added to the file when a
trigger first uses one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-08 17:35:11 -04:00
1 parent 4375844c84
commit b31a28ebe9
19 files changed
+195 -101

No files matched your search

+12 -3
View File
@@ -1,9 +1,11 @@
#pragma once
#include <algorithm>
#include <filesystem>
#include <memory>
#include <set>
#include <string>
#include <string_view>
#include <unordered_map>
#include <utility>
#include <variant>
@@ -36,7 +38,7 @@ namespace anm2ed::model
bool operator==(const Extras&) const = default;
};
// A keyframe; on a triggers track the same struct is a trigger (atFrame, eventId, soundIds).
// A keyframe; on a triggers track the same struct is a trigger (atFrame, eventIds, soundIds).
struct Frame
{
std::uint64_t uid{util::uid_next()};
@@ -54,7 +56,7 @@ namespace anm2ed::model
Interpolation interpolation{Interpolation::NONE};
int regionId{-1};
int shaderId{-1};
int depth{}; // a layer frame draws this many layers above (or below) its place in the timeline; editor-only
int depth{}; // a layer frame draws this many layers above (or below) its place in the timeline; editor-only
float blur{}; // Flash's BlurFilter at quality 1: one box blur this many canvas pixels wide; editor-only
// On an animation layer: the child animation (empty for the layer's own) and how it plays; editor-only.
std::string childAnimation{};
@@ -63,7 +65,7 @@ namespace anm2ed::model
bool isChildStartRandom{};
bool isChildRestart{};
int atFrame{-1};
int eventId{-1};
std::vector<int> eventIds{};
std::vector<int> soundIds{};
Extras extras{};
@@ -289,6 +291,13 @@ namespace anm2ed::model
bool operator==(const Animations&) const = default;
};
// Events the editor knows by name: shown locked in Events, and added to a file when a trigger first uses one. A
// choice of one not yet in the file has id EVENT_BUILT_IN_ID_FIRST - its index.
inline constexpr std::string_view EVENT_BUILT_INS[] = {"stop", "done"};
inline constexpr int EVENT_BUILT_IN_ID_FIRST = -2;
inline bool is_event_built_in(std::string_view name) { return std::ranges::contains(EVENT_BUILT_INS, name); }
// Content item lookup by file id (layers, nulls, events, sounds, spritesheets, shaders, regions).
template <class Items> auto item_get(Items& items, int id) -> decltype(&items.front())
{