diff --git a/apps/gobble1/gobble1.c b/apps/gobble1/gobble1.c index 5a61202..7a46447 100644 --- a/apps/gobble1/gobble1.c +++ b/apps/gobble1/gobble1.c @@ -25,7 +25,7 @@ typedef struct monster_struct static int8_t monster_find (monster_t *monsters, uint8_t num, - uint8_t x, uint8_t y) + uint8_t x, uint8_t y) { uint8_t i; diff --git a/apps/gobble6/gobble6.c b/apps/gobble6/gobble6.c index 1d8266f..a0f5fa2 100644 --- a/apps/gobble6/gobble6.c +++ b/apps/gobble6/gobble6.c @@ -1,7 +1,7 @@ /** @file gobble6.c @author M.P. Hayes @date 29 Sep 2013 - @brief + @brief A simple game where a monster has to capture `things' that run away. */ #include @@ -27,14 +27,13 @@ int main (void) { - uint16_t tick = 0; + uint16_t things_move_tick = 0; uint16_t navswitch_tick = 0; uint16_t monster_flash_tick = 0; bool running = 0; bool game_over = 1; int duration = 0; - system_init (); navswitch_init (); led_init (); @@ -47,7 +46,7 @@ int main (void) pacer_init (LOOP_RATE); - tinygl_text ("GOBBLE: PUSH TO START"); + tinygl_text ("GOBBLE6: PUSH TO START"); while (1) { @@ -70,13 +69,13 @@ int main (void) navswitch_update (); if (navswitch_push_event_p (NAVSWITCH_NORTH)) - monster_move (0, -1); + things_monster_move (0, -1); if (navswitch_push_event_p (NAVSWITCH_SOUTH)) - monster_move (0, 1); + things_monster_move (0, 1); if (navswitch_push_event_p (NAVSWITCH_EAST)) - monster_move (1, 0); + things_monster_move (1, 0); if (navswitch_push_event_p (NAVSWITCH_WEST)) - monster_move (-1, 0); + things_monster_move (-1, 0); /* Pause/resume things running around. */ if (navswitch_push_event_p (NAVSWITCH_PUSH)) @@ -108,10 +107,10 @@ int main (void) } /* Move the things. */ - tick++; - if (tick >= LOOP_RATE / MOVE_RATE) + things_move_tick++; + if (things_move_tick >= LOOP_RATE / MOVE_RATE) { - tick = 0; + things_move_tick = 0; if (running) { @@ -126,7 +125,7 @@ int main (void) { monster_flash_tick = 0; if (running) - monster_toggle (); + things_monster_toggle (); } } return 0; diff --git a/apps/gobble6/things.c b/apps/gobble6/things.c index 68edfed..54fd0f4 100644 --- a/apps/gobble6/things.c +++ b/apps/gobble6/things.c @@ -79,7 +79,7 @@ static bool thing_position_valid_p (tinygl_point_t pos) } -void monster_move (int8_t dx, int8_t dy) +void things_monster_move (int8_t dx, int8_t dy) { int8_t other; tinygl_point_t newpos; @@ -98,13 +98,12 @@ void monster_move (int8_t dx, int8_t dy) } -void monster_toggle (void) +void things_monster_toggle (void) { tinygl_pixel_set (things[0].pos, ! tinygl_pixel_get (things[0].pos)); } - static void thing_move (uint8_t this) { uint8_t i; diff --git a/apps/gobble6/things.h b/apps/gobble6/things.h index 8b83a46..e630e3e 100644 --- a/apps/gobble6/things.h +++ b/apps/gobble6/things.h @@ -9,8 +9,8 @@ void things_create (void); void things_move (void); -void monster_move (int8_t dx, int8_t dy); +void things_monster_move (int8_t dx, int8_t dy); -void monster_toggle (void); +void things_monster_toggle (void); #endif diff --git a/apps/gobble7/gobble7.c b/apps/gobble7/gobble7.c index 3726f66..b8b1d6e 100644 --- a/apps/gobble7/gobble7.c +++ b/apps/gobble7/gobble7.c @@ -1,7 +1,7 @@ /** @file gobble7.c @author M.P. Hayes @date 1 Oct 2013 - @brief + @brief A simple game where a monster has to capture `things' that run away. */ #include @@ -18,10 +18,10 @@ #define DISPLAY_RATE 200 -#define MOVE_RATE 10 - #define NAVSWITCH_RATE 50 +#define THINGS_MOVE_RATE 10 + #define MONSTER_FLASH_RATE 5 @@ -40,11 +40,11 @@ static void monster_flash_task (__unused__ void *data) { /* Flash the monster. */ if (running) - monster_toggle (); + things_monster_toggle (); } -static void things_task (__unused__ void *data) +static void things_move_task (__unused__ void *data) { /* Move the things. */ if (running) @@ -60,13 +60,13 @@ static void navswitch_task (__unused__ void *data) navswitch_update (); if (navswitch_push_event_p (NAVSWITCH_NORTH)) - monster_move (0, -1); + things_monster_move (0, -1); if (navswitch_push_event_p (NAVSWITCH_SOUTH)) - monster_move (0, 1); + things_monster_move (0, 1); if (navswitch_push_event_p (NAVSWITCH_EAST)) - monster_move (1, 0); + things_monster_move (1, 0); if (navswitch_push_event_p (NAVSWITCH_WEST)) - monster_move (-1, 0); + things_monster_move (-1, 0); /* Pause/resume things running around. */ if (navswitch_push_event_p (NAVSWITCH_PUSH)) @@ -104,7 +104,7 @@ int main (void) { {.func = display, .period = TASK_RATE / DISPLAY_RATE}, {.func = navswitch_task, .period = TASK_RATE / NAVSWITCH_RATE}, - {.func = things_task, .period = TASK_RATE / MOVE_RATE}, + {.func = things_move_task, .period = TASK_RATE / THINGS_MOVE_RATE}, {.func = monster_flash_task, .period = TASK_RATE / MONSTER_FLASH_RATE}, }; @@ -119,7 +119,7 @@ int main (void) tinygl_text_mode_set (TINYGL_TEXT_MODE_SCROLL); tinygl_text_dir_set (TINYGL_TEXT_DIR_ROTATE); - tinygl_text ("GOBBLE: PUSH TO START"); + tinygl_text ("GOBBLE7: PUSH TO START"); task_schedule (tasks, 4); diff --git a/apps/gobble7/things.c b/apps/gobble7/things.c index 68edfed..df1291d 100644 --- a/apps/gobble7/things.c +++ b/apps/gobble7/things.c @@ -79,7 +79,7 @@ static bool thing_position_valid_p (tinygl_point_t pos) } -void monster_move (int8_t dx, int8_t dy) +void things_monster_move (int8_t dx, int8_t dy) { int8_t other; tinygl_point_t newpos; @@ -98,7 +98,7 @@ void monster_move (int8_t dx, int8_t dy) } -void monster_toggle (void) +void things_monster_toggle (void) { tinygl_pixel_set (things[0].pos, ! tinygl_pixel_get (things[0].pos)); } diff --git a/apps/gobble7/things.h b/apps/gobble7/things.h index 8b83a46..e630e3e 100644 --- a/apps/gobble7/things.h +++ b/apps/gobble7/things.h @@ -9,8 +9,8 @@ void things_create (void); void things_move (void); -void monster_move (int8_t dx, int8_t dy); +void things_monster_move (int8_t dx, int8_t dy); -void monster_toggle (void); +void things_monster_toggle (void); #endif