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:
1 parent
4375844c84
commit
b31a28ebe9
19 files changed
+195
-101
No files matched your search
+14
-1
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user