Unify names

This commit is contained in:
Michael Hayes
2013-10-02 13:54:26 +13:00
parent ca45283558
commit 0c1e6433cf
7 changed files with 31 additions and 33 deletions
+11 -12
View File
@@ -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 <stdio.h>
@@ -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;
+2 -3
View File
@@ -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;
+2 -2
View File
@@ -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