aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/main.c b/main.c
index 25b1142..18b8d96 100644
--- a/main.c
+++ b/main.c
@@ -153,12 +153,15 @@ int main(int argc, char **argv) {
case 'l': map_offset_x -= 2; break;
case 'j': map_offset_y -= 1; break;
case 'k': map_offset_y += 1; break;
+
case 'H': clear(); map_offset_x += 20; break;
case 'L': clear(); map_offset_x -= 20; break;
case 'J': clear(); map_offset_y -= 10; break;
case 'K': clear(); map_offset_y += 10; break;
+
case 'z': clear(); map_offset_x = 2; map_offset_y = 1; break; /* Move to top left corner */
case 'x': clear(); map_offset_x = - width * 2 + COLS - 2; map_offset_y = - height + LINES - 2; break; /* Move to bottom right corner */
+
case 'g':
switch (getch()) {
case 's':
@@ -173,18 +176,19 @@ int main(int argc, char **argv) {
break;
}
break;
+
case 'a': anim = !anim; break;
+
case 'y':
case 'o':
case 'u':
case 'i':
if(is_maze) {
switch (c) {
- /* TODO: handle if it's zero */
- case 'y': mwidth -= 1; break;
+ case 'y': if (mwidth > 1) mwidth -= 1; break;
case 'o': mwidth += 1; break;
case 'u': mheight += 1; break;
- case 'i': mheight -= 1; break;
+ case 'i': if (mheight > 1) mheight -= 1; break;
}
map_free(map, height);
visited_free(visited, height);
@@ -200,6 +204,7 @@ int main(int argc, char **argv) {
path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim);
}
break;
+
case 's':
message(height, "Filename: ");
/* TODO: figure out how to show the cursor and echo the characters */
@@ -213,6 +218,7 @@ int main(int argc, char **argv) {
message(height, "Saved to %s", filename);
getch();
break;
+
case 'n':
if (is_maze) {
map_free(map, height);
@@ -221,6 +227,7 @@ int main(int argc, char **argv) {
path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim);
}
break;
+
case 'e':
is_maze = 0;
visited_free(visited, height);
@@ -232,7 +239,9 @@ int main(int argc, char **argv) {
visited = visited_new(width, height);
path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim);
break;
+
case KEY_RESIZE: clear(); break;
+
case 'q': map_free(map, height); path_free(path, height); endwin(); return 0;
}
}