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

+14 -1
View File
@@ -22,6 +22,18 @@ namespace anm2ed::edit
}
}
// An event id from a choice: a built-in event not yet in the file is added (or found by name) first.
int event_id_resolve(Model& model, int id)
{
auto index = EVENT_BUILT_IN_ID_FIRST - id;
if (index < 0 || index >= (int)std::size(EVENT_BUILT_INS)) return id;
auto& events = model.content.events;
std::string name(EVENT_BUILT_INS[index]);
auto event = std::ranges::find(events, name, &Event::name);
if (event != events.end()) return event->id;
return events.emplace_back(Event{.id = item_next_id_get(events), .name = name}).id;
}
bool is_region_matched(const Region& region, const Frame& frame)
{
return glm::ivec2(region.crop) == glm::ivec2(frame.crop) && glm::ivec2(region.size) == glm::ivec2(frame.size) &&
@@ -332,7 +344,8 @@ namespace anm2ed::edit
{
for (auto& soundId : frame.soundIds)
soundId = id_remap(ElementType::SOUND_ELEMENT, soundId);
frame.eventId = id_remap(ElementType::EVENT_ELEMENT, frame.eventId);
for (auto& eventId : frame.eventIds)
eventId = id_remap(ElementType::EVENT_ELEMENT, eventId);
}
};
+1
View File
@@ -136,5 +136,6 @@ namespace anm2ed::edit
std::optional<resource::Image> spritesheet_pack(model::Model&, int, const resource::Image&, int);
std::optional<resource::Image> spritesheets_merge(model::Model&, const std::set<int>&, const ImageGet&, bool, bool,
bool, Origin);
int event_id_resolve(model::Model&, int);
bool file_merge(model::Model&, const std::filesystem::path&, const std::filesystem::path&, FileMergePreset);
}
+1 -1
View File
@@ -281,7 +281,7 @@ namespace anm2ed::edit
target.isChildRestart = source.isChildRestart;
break;
case FrameProperty::EVENT:
target.eventId = source.eventId;
target.eventIds = source.eventIds;
break;
case FrameProperty::SOUNDS:
target.soundIds = source.soundIds;