From 64914067dc27b6b129227ad2f96a70bef7228e36 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 9 Apr 2020 07:46:39 +0200 Subject: [PATCH] option ..| to specify animations with sharp changes --- util.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/util.cpp b/util.cpp index 139690a2..c6a93a6c 100644 --- a/util.cpp +++ b/util.cpp @@ -340,15 +340,21 @@ cld exp_parser::parse(int prio) { while(true) { #if CAP_ANIMATIONS if(next() == '.' && next(1) == '.' && prio == 0) { - vector rest = { res }; + vector> rest = { {res, res} }; while(next() == '.' && next(1) == '.') { - at += 2; rest.push_back(parse(10)); + if(next(2) == '|') { + at += 3; + rest.back().second = parse(10); + } + at += 2; + auto val = parse(10); + rest.emplace_back(val, val); } ld v = ticks * (isize(rest)-1.) / anims::period; int vf = v; v -= vf; vf %= (isize(rest)-1); - res = rest[vf] + (rest[vf+1] - rest[vf]) * v; + res = rest[vf].second + (rest[vf+1].first - rest[vf].second) * v; return res; } else