From e1d5ebd53fcf58a1e57a96205e6b5dd88b0caf9e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 21 Jul 2003 11:03:14 +0000 Subject: minor edits to conform to rockbox standards git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3858 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/sliding_puzzle.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c index 73b1ae3b08..790e4ac501 100644 --- a/apps/plugins/sliding_puzzle.c +++ b/apps/plugins/sliding_puzzle.c @@ -5,7 +5,7 @@ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ - * $Id: puzzle.c,v 1.1 2003/01/19 00:19:56 + * $Id$ * * Copyright (C) 2002 Vicentini Martin * @@ -128,7 +128,8 @@ static unsigned char picture[20][32] = { }; /* draws a spot at the coordinates (x,y), range of p is 1-20 */ -static void draw_spot(int p, int x, int y) { +static void draw_spot(int p, int x, int y) +{ if (pic || p==20) { ptr = picture[p-1]; rb->lcd_bitmap (ptr, x, y, 16, 8, true); @@ -143,7 +144,8 @@ static void draw_spot(int p, int x, int y) { } /* check if the puzzle is solved */ -static bool puzzle_finished(void) { +static bool puzzle_finished(void) +{ int i; for (i=0; i<20; i++) if (spots[i] != (i+1)) @@ -152,7 +154,8 @@ static bool puzzle_finished(void) { } /* move a piece in any direction */ -static void move_spot(int x, int y) { +static void move_spot(int x, int y) +{ int i; spots[hole] = spots[hole-x-5*y]; hole -= (x+5*y); @@ -169,7 +172,8 @@ static void move_spot(int x, int y) { } /* initializes the puzzle */ -static void puzzle_init(void) { +static void puzzle_init(void) +{ int i, r, temp, tsp[20]; moves = 0; rb->lcd_clear_display(); @@ -178,7 +182,7 @@ static void puzzle_init(void) { rb->snprintf(s, sizeof(s), "%d", moves); rb->lcd_putsxy(85, 20, s); - // shuffle spots + /* shuffle spots */ for (i=19; i>=0; i--) { r = (*rb->current_tick % (i+1)); @@ -190,7 +194,7 @@ static void puzzle_init(void) { hole = i; } - // test if the puzzle is solvable + /* test if the puzzle is solvable */ for (i=0; i<20; i++) tsp[i] = spots[i]; r=0; @@ -205,7 +209,7 @@ static void puzzle_init(void) { } } - // if the random puzzle isn't solvable just change two spots + /* if the random puzzle isn't solvable just change two spots */ if (r%2 == 1) { if (spots[0]!=20 && spots[1]!=20) { temp = spots[0]; @@ -218,14 +222,15 @@ static void puzzle_init(void) { } } - // draw spots to the lcd + /* draw spots to the lcd */ for (i=0; i<20; i++) draw_spot(spots[i], (i%5)*16, (i/5)*16); rb->lcd_update(); } /* the main game loop */ -static int puzzle_loop(void) { +static int puzzle_loop(void) +{ int i; puzzle_init(); while(true) { -- cgit v1.2.3