From ad89ed6df5fd1ba5329e3e27c25d6c1c0af200e9 Mon Sep 17 00:00:00 2001 From: Ian C Date: Wed, 4 May 2011 11:59:28 +0000 Subject: Made impossible checks optional in play mode. --- dbox.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/dbox.c b/dbox.c index 6fe8fd5..2827083 100644 --- a/dbox.c +++ b/dbox.c @@ -136,7 +136,7 @@ static sig_atomic_t g_signal; static void *Grab(size_t p_size); static void *Copy(const void *p_source, size_t p_size); -static void Interactive(const level_t *p_level, int p_play); +static void Interactive(const level_t *p_level, int p_play, int p_check); static level_t *Load(const char *p_path); @@ -170,6 +170,7 @@ int main(int argc, char *argv[]) { int interact = FALSE; int play = FALSE; + int check = TRUE; int base; int f; int verbose = FALSE; @@ -191,6 +192,12 @@ int main(int argc, char *argv[]) play = TRUE; break; + case 'P': + interact = TRUE; + play = TRUE; + check = FALSE; + break; + case 'v': verbose = TRUE; break; @@ -203,7 +210,7 @@ int main(int argc, char *argv[]) if (!argv[base]) { - fprintf(stderr,"%s: usage %s [-v|-i|-p] file [file2 ...]\n", + fprintf(stderr,"%s: usage %s [-v|-i|-p|-P] file [file2 ...]\n", g_name, g_name); return EXIT_FAILURE; } @@ -223,7 +230,7 @@ int main(int argc, char *argv[]) { if (interact) { - Interactive(level, play); + Interactive(level, play, check); } else { @@ -1231,7 +1238,7 @@ static void CursesDisplay(const level_t *p_level, } -static void Interactive(const level_t *p_level, int p_play) +static void Interactive(const level_t *p_level, int p_play, int p_check) { int quit; route_t route = {0}; @@ -1329,7 +1336,7 @@ static void Interactive(const level_t *p_level, int p_play) case KEY_LEFT: if (p_play && !s->left && StateDepth(s) < MAX_ROUTE) { - s->left = CreateState(DIR_LEFT, FALSE, p_level, s, TRUE); + s->left = CreateState(DIR_LEFT, FALSE, p_level, s, p_check); } if (s->left) @@ -1346,7 +1353,8 @@ static void Interactive(const level_t *p_level, int p_play) case KEY_RIGHT: if (p_play && !s->right && StateDepth(s) < MAX_ROUTE) { - s->right = CreateState(DIR_RIGHT, FALSE, p_level, s, TRUE); + s->right = CreateState(DIR_RIGHT, FALSE, p_level, + s, p_check); } if (s->right) @@ -1363,7 +1371,7 @@ static void Interactive(const level_t *p_level, int p_play) case KEY_DOWN: if (p_play && !s->down && StateDepth(s) < MAX_ROUTE) { - s->down = CreateState(DIR_DOWN, FALSE, p_level, s, TRUE); + s->down = CreateState(DIR_DOWN, FALSE, p_level, s, p_check); } if (s->down) @@ -1380,7 +1388,7 @@ static void Interactive(const level_t *p_level, int p_play) case KEY_UP: if (p_play && !s->up && StateDepth(s) < MAX_ROUTE) { - s->up = CreateState(DIR_UP, FALSE, p_level, s, TRUE); + s->up = CreateState(DIR_UP, FALSE, p_level, s, p_check); } if (s->up) -- cgit v1.2.3