summaryrefslogtreecommitdiff
path: root/tools/seq_compiler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/seq_compiler.cc')
-rw-r--r--tools/seq_compiler.cc45
1 files changed, 42 insertions, 3 deletions
diff --git a/tools/seq_compiler.cc b/tools/seq_compiler.cc
index 45cfc1a..7ac921f 100644
--- a/tools/seq_compiler.cc
+++ b/tools/seq_compiler.cc
@@ -467,13 +467,52 @@ int main(int argc, char* argv[]) {
<< ": EFFECT found outside of SEQUENCE\n";
return 1;
}
- std::string class_name, start, end, priority;
- if (!(ss >> class_name >> start >> end >> priority)) {
+ std::string priority_mod, class_name, start, end;
+ if (!(ss >> priority_mod >> class_name >> start >> end)) {
std::cerr << "Error line " << line_num
- << ": EFFECT requires <Class> <start> <end> <priority>\n";
+ << ": EFFECT requires <+|=|-> <Class> <start> <end>\n";
return 1;
}
+ // Validate priority modifier
+ if (priority_mod != "+" && priority_mod != "=" && priority_mod != "-") {
+ std::cerr << "Error line " << line_num
+ << ": Priority modifier must be '+', '=', or '-', got: " << priority_mod << "\n";
+ return 1;
+ }
+
+ // Calculate priority based on modifier and sequence state
+ static int current_priority = 0;
+ static bool first_in_sequence = true;
+ static const SequenceEntry* last_seq = nullptr;
+
+ // Reset priority tracking for new sequence
+ if (current_seq != last_seq) {
+ current_priority = 0;
+ first_in_sequence = true;
+ last_seq = current_seq;
+ }
+
+ // Handle first effect in sequence
+ if (first_in_sequence) {
+ if (priority_mod == "-") {
+ current_priority = -1; // Background layer
+ } else {
+ current_priority = 0; // Default start (+ or =)
+ }
+ first_in_sequence = false;
+ } else {
+ // Update priority based on modifier for subsequent effects
+ if (priority_mod == "+") {
+ current_priority++;
+ } else if (priority_mod == "-") {
+ current_priority--;
+ }
+ // '=' keeps current_priority unchanged
+ }
+
+ std::string priority = std::to_string(current_priority);
+
// Convert beat notation to time
std::string start_time = convert_to_time(start, bpm);
std::string end_time = convert_to_time(end, bpm);