shithub: orca

Download patch

ref: 1a65a4931e18af58b517a263621220654689e6f5
parent: e29a3d1b28272f318b44a0c66dc9c44c3e8e84c7
parent: ce9aabaf757997dbc547625accc14f55e44d5c5e
author: Nicola Pisanti <nicola@npisanti.com>
date: Tue May 21 04:48:00 EDT 2019

Merge pull request #33 from npisanti/master

adds step port to L

--- a/sim.c
+++ b/sim.c
@@ -556,7 +556,9 @@
 
 BEGIN_OPERATOR(loop)
   LOWERCASE_REQUIRES_BANG;
+  PORT(0, -2, IN | PARAM);
   PORT(0, -1, IN | PARAM);
+  Usz rate = index_of(PEEK(0, -2));
   Usz len = safe_index_of(PEEK(0, -1));
   if (len > width - x - 1)
     len = width - x - 1;
@@ -566,13 +568,13 @@
   }
   if (len == 0)
     return;
+  rate = rate % len;
   Glyph buff[Glyphs_index_count];
   Glyph* gs = gbuffer + y * width + x + 1;
-  Glyph hopped = *gs;
   for (Usz i = 0; i < len; ++i) {
-    buff[i] = gs[i + 1];
+    Usz offset = (i + rate) % len;
+    buff[i] = gs[offset];
   }
-  buff[len - 1] = hopped;
   for (Usz i = 0; i < len; ++i) {
     gs[i] = buff[i];
   }