summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2017-07-31 00:32:04 -0400
committerJune McEnroe <june@causal.agency>2017-07-31 00:32:04 -0400
commit7ae0b16aec82ae6ae4023bfd23ddef8ba6965b3a (patch)
tree01e1176bbc6f0a799fea753a94ca1579e3f897f3
parentHandle large moves (diff)
downloadtorus-7ae0b16aec82ae6ae4023bfd23ddef8ba6965b3a.tar.gz
torus-7ae0b16aec82ae6ae4023bfd23ddef8ba6965b3a.zip
Adjust move speed in client
Diffstat (limited to '')
-rwxr-xr-xclient.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/client.c b/client.c
index 1e2ea69..72c21c9 100755
--- a/client.c
+++ b/client.c
@@ -104,6 +104,8 @@ static void swapCell(int8_t dx, int8_t dy) {
     clientPut(aColor, aCell);
 }
 
+static int8_t moveSpeed = 1;
+
 static void readInput(void) {
     int c = getch();
 
@@ -168,14 +170,17 @@ static void readInput(void) {
         case 'x': clientPut(CH_COLOR(inch()), ' '); break;
         case '~': clientPut(inputColor, inch() & 0x7F); clientMove(1, 0); break;
 
-        case 'h': clientMove(-1,  0); break;
-        case 'j': clientMove( 0,  1); break;
-        case 'k': clientMove( 0, -1); break;
-        case 'l': clientMove( 1,  0); break;
-        case 'y': clientMove(-1, -1); break;
-        case 'u': clientMove( 1, -1); break;
-        case 'b': clientMove(-1,  1); break;
-        case 'n': clientMove( 1,  1); break;
+        case '[': if (moveSpeed > 1) moveSpeed--; break;
+        case ']': if (moveSpeed < 4) moveSpeed++; break;
+
+        case 'h': clientMove(-moveSpeed,          0); break;
+        case 'j': clientMove(         0,  moveSpeed); break;
+        case 'k': clientMove(         0, -moveSpeed); break;
+        case 'l': clientMove( moveSpeed,          0); break;
+        case 'y': clientMove(-moveSpeed, -moveSpeed); break;
+        case 'u': clientMove( moveSpeed, -moveSpeed); break;
+        case 'b': clientMove(-moveSpeed,  moveSpeed); break;
+        case 'n': clientMove( moveSpeed,  moveSpeed); break;
 
         case 'H': swapCell(-1,  0); break;
         case 'J': swapCell( 0,  1); break;