summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorAntoine Cellerier <dionoea@videolan.org>2007-06-06 20:48:01 +0000
committerAntoine Cellerier <dionoea@videolan.org>2007-06-06 20:48:01 +0000
commit45cfca85c5039b353bfd9583586a41c23d47d6e0 (patch)
treefb6b11161c5f28e57426ac5c3135b4969af4a12b /apps
parentd49cf3180eca30fbdebc11b773cec63e451af414 (diff)
downloadrockbox-45cfca85c5039b353bfd9583586a41c23d47d6e0.tar.gz
rockbox-45cfca85c5039b353bfd9583586a41c23d47d6e0.zip
Yet some more optimisation and recorder/ondio related bug fixing for Xobox.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13576 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/xobox.c52
1 files changed, 19 insertions, 33 deletions
diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c
index e87005a9c7..93c2bb9249 100644
--- a/apps/plugins/xobox.c
+++ b/apps/plugins/xobox.c
@@ -160,8 +160,8 @@ PLUGIN_HEADER
160#define STARTING_QIXES 2 160#define STARTING_QIXES 2
161#define MAX_LEVEL 10 161#define MAX_LEVEL 10
162#define MAX_QIXES MAX_LEVEL+STARTING_QIXES 162#define MAX_QIXES MAX_LEVEL+STARTING_QIXES
163#define BOARD_W ((int)LCD_WIDTH/CUBE_SIZE) 163#define BOARD_W ((int)(LCD_WIDTH/CUBE_SIZE))
164#define BOARD_H ((int)LCD_HEIGHT/CUBE_SIZE) 164#define BOARD_H ((int)(LCD_HEIGHT/CUBE_SIZE))
165#define BOARD_X (LCD_WIDTH-BOARD_W*CUBE_SIZE)/2 165#define BOARD_X (LCD_WIDTH-BOARD_W*CUBE_SIZE)/2
166#define BOARD_Y (LCD_HEIGHT-BOARD_H*CUBE_SIZE)/2 166#define BOARD_Y (LCD_HEIGHT-BOARD_H*CUBE_SIZE)/2
167 167
@@ -259,7 +259,7 @@ static int percentage_cache;
259/*************************** STACK STUFF **********************/ 259/*************************** STACK STUFF **********************/
260 260
261/* the stack */ 261/* the stack */
262#define STACK_SIZE BOARD_W*BOARD_H 262#define STACK_SIZE (2*BOARD_W*BOARD_H)
263static struct pos 263static struct pos
264{ 264{
265 int x, y; /* position on board */ 265 int x, y; /* position on board */
@@ -355,22 +355,24 @@ static void init_board (void)
355 else 355 else
356 board[j][i] = EMPTIED; 356 board[j][i] = EMPTIED;
357 } 357 }
358
358 /* (level+2) is the number of qixes */ 359 /* (level+2) is the number of qixes */
359 for (j = 0; j < player.level + STARTING_QIXES; j++) { 360 for (j = 0; j < player.level + STARTING_QIXES; j++) {
360 qixes[j].velocity = t_rand (2) + 1; /* 1 or 2 pix-per-sec */ 361 qixes[j].velocity = t_rand (2) + 1; /* 1 or 2 pix-per-sec */
361 362
362 /* not on frame */ 363 /* not on frame */
363 qixes[j].x = 364 qixes[j].x = CUBE_SIZE*2 + 2*t_rand (((BOARD_W-4)*CUBE_SIZE)/2);
364 BOARD_X + t_rand (((BOARD_W - 4) * CUBE_SIZE) - 2 * CUBE_SIZE) + 365 qixes[j].y = CUBE_SIZE*2 + 2*t_rand (((BOARD_H-4)*CUBE_SIZE)/2);
365 2 * CUBE_SIZE;
366 qixes[j].y =
367 BOARD_Y + t_rand (((BOARD_H - 6) * CUBE_SIZE) - 2 * CUBE_SIZE) +
368 3 * CUBE_SIZE;
369 366
370 const int angle_table[] = { 367 const int angle_table[] = {
371 MOVE_UUR, MOVE_UR, MOVE_URR, MOVE_DRR, MOVE_DR, MOVE_DDR, 368 MOVE_UUR, MOVE_UR, MOVE_URR, MOVE_DRR, MOVE_DR, MOVE_DDR,
372 MOVE_UUL, MOVE_UL, MOVE_ULL, MOVE_DLL, MOVE_DL, MOVE_DDL }; 369 MOVE_UUL, MOVE_UL, MOVE_ULL, MOVE_DLL, MOVE_DL, MOVE_DDL };
373 qixes[j].angle = angle_table[t_rand (12)]; 370 qixes[j].angle = angle_table[t_rand (12)];
371#if CUBE_SIZE == 4
372 /* Work arround a nasty bug. FIXME */
373 if( qixes[j].angle & (DIR_LL|DIR_RR|DIR_UU|DIR_DD) )
374 qixes[j].velocity = 1;
375#endif
374 } 376 }
375 /*black_qix.velocity=1; 377 /*black_qix.velocity=1;
376 black_qix.x=BOARD_X+(BOARD_W*CUBE_SIZE)/2-CUBE_SIZE/2; 378 black_qix.x=BOARD_X+(BOARD_W*CUBE_SIZE)/2-CUBE_SIZE/2;
@@ -669,39 +671,23 @@ static void die (void)
669 */ 671 */
670static inline bool line_check_lt (int newx, int newy) 672static inline bool line_check_lt (int newx, int newy)
671{ 673{
672 int i = 0; 674 return getpixel (newx, newy + CUBE_SIZE/2-1) == FILLED
673 for (i = ((CUBE_SIZE/2)-1); i < CUBE_SIZE - ((CUBE_SIZE/2)-1); i++) { 675 && getpixel (newx, newy + CUBE_SIZE/2 ) == FILLED;
674 if (getpixel (newx, newy + i) != FILLED)
675 return false;
676 }
677 return true;
678} 676}
679static inline bool line_check_rt (int newx, int newy) 677static inline bool line_check_rt (int newx, int newy)
680{ 678{
681 int i = 0; 679 return getpixel (newx + CUBE_SIZE-1, newy + CUBE_SIZE/2-1) == FILLED
682 for (i = ((CUBE_SIZE/2)-1); i < CUBE_SIZE - ((CUBE_SIZE/2)-1); i++) { 680 && getpixel (newx + CUBE_SIZE-1, newy + CUBE_SIZE/2 ) == FILLED;
683 if (getpixel (newx + CUBE_SIZE - 1, newy + i) != FILLED)
684 return false;
685 }
686 return true;
687} 681}
688static inline bool line_check_up (int newx, int newy) 682static inline bool line_check_up (int newx, int newy)
689{ 683{
690 int i = 0; 684 return getpixel (newx + CUBE_SIZE/2-1, newy) == FILLED
691 for (i = ((CUBE_SIZE/2)-1); i < CUBE_SIZE - ((CUBE_SIZE/2)-1); i++) { 685 && getpixel (newx + CUBE_SIZE/2 , newy) == FILLED;
692 if (getpixel (newx + i, newy) != FILLED)
693 return false;
694 }
695 return true;
696} 686}
697static inline bool line_check_dn (int newx, int newy) 687static inline bool line_check_dn (int newx, int newy)
698{ 688{
699 int i = 0; 689 return getpixel (newx + CUBE_SIZE/2-1, newy + CUBE_SIZE-1) == FILLED
700 for (i = ((CUBE_SIZE/2)-1); i < CUBE_SIZE - ((CUBE_SIZE/2)-1); i++) { 690 && getpixel (newx + CUBE_SIZE/2 , newy + CUBE_SIZE-1) == FILLED;
701 if (getpixel (newx + i, newy + CUBE_SIZE - 1) != FILLED)
702 return false;
703 }
704 return true;
705} 691}
706 692
707static inline void move_qix (struct qix *q) 693static inline void move_qix (struct qix *q)