summaryrefslogtreecommitdiff
path: root/apps/plugins/spacerocks.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/spacerocks.c')
-rw-r--r--apps/plugins/spacerocks.c83
1 files changed, 47 insertions, 36 deletions
diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c
index 0143af97b7..879a5696da 100644
--- a/apps/plugins/spacerocks.c
+++ b/apps/plugins/spacerocks.c
@@ -120,17 +120,17 @@ static struct plugin_api* rb; /* global api struct pointer */
120#define AST_FIRE_REP BUTTON_SELECT | BUTTON_REPEAT 120#define AST_FIRE_REP BUTTON_SELECT | BUTTON_REPEAT
121 121
122#elif (CONFIG_KEYPAD == SANSA_E200_PAD) 122#elif (CONFIG_KEYPAD == SANSA_E200_PAD)
123#define AST_PAUSE BUTTON_SELECT 123#define AST_PAUSE BUTTON_REC
124#define AST_QUIT BUTTON_POWER 124#define AST_QUIT BUTTON_POWER
125#define AST_THRUST_REP BUTTON_UP | BUTTON_RIGHT 125#define AST_THRUST_REP (BUTTON_UP | BUTTON_REPEAT)
126#define AST_THRUST BUTTON_UP 126#define AST_THRUST BUTTON_UP
127#define AST_HYPERSPACE BUTTON_DOWN 127#define AST_HYPERSPACE BUTTON_DOWN
128#define AST_LEFT BUTTON_LEFT 128#define AST_LEFT BUTTON_LEFT
129#define AST_LEFT_REP BUTTON_LEFT | BUTTON_RIGHT 129#define AST_LEFT_REP (BUTTON_LEFT | BUTTON_REPEAT)
130#define AST_RIGHT BUTTON_RIGHT 130#define AST_RIGHT BUTTON_RIGHT
131#define AST_RIGHT_REP (BUTTON_RIGHT | BUTTON_RIGHT) 131#define AST_RIGHT_REP (BUTTON_RIGHT | BUTTON_REPEAT)
132#define AST_FIRE BUTTON_SELECT 132#define AST_FIRE BUTTON_SELECT
133#define AST_FIRE_REP BUTTON_SELECT | BUTTON_RIGHT 133#define AST_FIRE_REP (BUTTON_SELECT | BUTTON_REPEAT)
134 134
135#elif (CONFIG_KEYPAD == IRIVER_H10_PAD) 135#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
136#define AST_PAUSE BUTTON_PLAY 136#define AST_PAUSE BUTTON_PLAY
@@ -161,7 +161,8 @@ static struct plugin_api* rb; /* global api struct pointer */
161 (CONFIG_KEYPAD == IPOD_4G_PAD) || \ 161 (CONFIG_KEYPAD == IPOD_4G_PAD) || \
162 (CONFIG_KEYPAD == GIGABEAT_PAD)|| \ 162 (CONFIG_KEYPAD == GIGABEAT_PAD)|| \
163 (CONFIG_KEYPAD == ARCHOS_AV300_PAD)|| \ 163 (CONFIG_KEYPAD == ARCHOS_AV300_PAD)|| \
164 (CONFIG_KEYPAD == IRIVER_H10_PAD) 164 (CONFIG_KEYPAD == IRIVER_H10_PAD)|| \
165 (CONFIG_KEYPAD == SANSA_E200_PAD)
165 #define ENEMY_MISSILE_SURVIVAL_LENGTH 140 166 #define ENEMY_MISSILE_SURVIVAL_LENGTH 140
166 #define MISSILE_SURVIVAL_LENGTH 40 167 #define MISSILE_SURVIVAL_LENGTH 40
167 #define ASTEROID_SPEED 15 168 #define ASTEROID_SPEED 15
@@ -595,7 +596,7 @@ void create_trail_blaze(int colour, struct Point* position)
595 yadd = ship.position.y; 596 yadd = ship.position.y;
596 } 597 }
597 598
598 //give the point a random countdown timer, so they dissapears at different times 599 /* give the point a random countdown timer, so they dissapears at different times */
599 tpoint = trailPoints; 600 tpoint = trailPoints;
600 n = NUM_TRAIL_POINTS; 601 n = NUM_TRAIL_POINTS;
601 while(--n) 602 while(--n)
@@ -603,9 +604,9 @@ void create_trail_blaze(int colour, struct Point* position)
603 if(tpoint->alive <= 0 && numtoadd) 604 if(tpoint->alive <= 0 && numtoadd)
604 { 605 {
605 numtoadd--; 606 numtoadd--;
606 //take a random x point anywhere between 607 /* take a random x point anywhere between bottom two points of ship. */
607 //bottom two points of ship. 608 /* ship.position.x; */
608 tpoint->position.x = (ship.vertices[2].x + (rb->rand()%18000)-9000) + position->x; //ship.position.x; 609 tpoint->position.x = (ship.vertices[2].x + (rb->rand()%18000)-9000) + position->x;
609 tpoint->position.y = (ship.vertices[2].y + (rb->rand()%18000)-9000) + position->y; 610 tpoint->position.y = (ship.vertices[2].y + (rb->rand()%18000)-9000) + position->y;
610 611
611 switch(colour) 612 switch(colour)
@@ -643,9 +644,9 @@ void create_trail_blaze(int colour, struct Point* position)
643 tpoint->dec = 4; 644 tpoint->dec = 4;
644 break; 645 break;
645 } 646 }
646 //add a proportional bit to the x and y based on dx and dy 647 /* add a proportional bit to the x and y based on dx and dy */
647 648
648 //give the points a speed based on direction of travel - i.e. opposite 649 /* give the points a speed based on direction of travel - i.e. opposite */
649 tpoint->position.dx += position->dx; 650 tpoint->position.dx += position->dx;
650 tpoint->position.dy += position->dy; 651 tpoint->position.dy += position->dy;
651 652
@@ -653,17 +654,17 @@ void create_trail_blaze(int colour, struct Point* position)
653 } 654 }
654 tpoint++; 655 tpoint++;
655 } 656 }
656 //find a space in the array of trail_points that is NULL or DEAD or whatever. 657 /* find a space in the array of trail_points that is NULL or DEAD or whatever.
657 //and place this one here. 658 and place this one here. */
658 659
659} 660}
660 661
661void draw_trail_blaze(void) 662void draw_trail_blaze(void)
662{ 663{
663 struct TrailPoint* tpoint; 664 struct TrailPoint* tpoint;
664 //loop through, if alive then move and draw. 665 /* loop through, if alive then move and draw.
665 //when drawn, countdown it's timer. 666 when drawn, countdown it's timer.
666 //if zero kill it! 667 if zero kill it! */
667 tpoint = trailPoints; 668 tpoint = trailPoints;
668 int n = NUM_TRAIL_POINTS; 669 int n = NUM_TRAIL_POINTS;
669 670
@@ -677,7 +678,7 @@ void draw_trail_blaze(void)
677 move_point(&(tpoint->position)); 678 move_point(&(tpoint->position));
678 } 679 }
679 #ifdef HAVE_LCD_COLOR 680 #ifdef HAVE_LCD_COLOR
680 //intensity = tpoint->alive/2; 681 /* intensity = tpoint->alive/2; */
681 if(tpoint->r>0)tpoint->r-=tpoint->dec; 682 if(tpoint->r>0)tpoint->r-=tpoint->dec;
682 if(tpoint->g>0)tpoint->g-=tpoint->dec; 683 if(tpoint->g>0)tpoint->g-=tpoint->dec;
683 if(tpoint->b>0)tpoint->b-=tpoint->dec; 684 if(tpoint->b>0)tpoint->b-=tpoint->dec;
@@ -875,8 +876,8 @@ void draw_and_move_enemy(void)
875 else 876 else
876 { 877 {
877 878
878 //animate_and_draw_explosion(enemy.vertices, NUM_ENEMY_VERTICES, 879 /* animate_and_draw_explosion(enemy.vertices, NUM_ENEMY_VERTICES,
879 // enemy_x, enemy.position.y/SCALE); 880 enemy_x, enemy.position.y/SCALE); */
880 if(game_state != PAUSE_MODE) 881 if(game_state != PAUSE_MODE)
881 { 882 {
882 enemy.explode_countdown--; 883 enemy.explode_countdown--;
@@ -1002,7 +1003,7 @@ bool is_point_within_enemy(struct Point* point)
1002 current_score += 5; 1003 current_score += 5;
1003 /*enemy_missile.survived = 0;*/ 1004 /*enemy_missile.survived = 0;*/
1004 enemy.explode_countdown = EXPLOSION_LENGTH; 1005 enemy.explode_countdown = EXPLOSION_LENGTH;
1005 // initialise_explosion(enemy.vertices, NUM_ENEMY_VERTICES); 1006 /* initialise_explosion(enemy.vertices, NUM_ENEMY_VERTICES); */
1006 create_trail_blaze(ENEMY_EXPLOSION_COLOUR, &enemy.position); 1007 create_trail_blaze(ENEMY_EXPLOSION_COLOUR, &enemy.position);
1007 return true; 1008 return true;
1008 } 1009 }
@@ -1092,7 +1093,7 @@ void check_collisions(void)
1092 { 1093 {
1093 /*blow up ship*/ 1094 /*blow up ship*/
1094 ship.explode_countdown = EXPLOSION_LENGTH; 1095 ship.explode_countdown = EXPLOSION_LENGTH;
1095 // initialise_explosion(ship.vertices, NUM_SHIP_VERTICES); 1096 /* initialise_explosion(ship.vertices, NUM_SHIP_VERTICES); */
1096 create_trail_blaze(SHIP_EXPLOSION_COLOUR, &ship.position); 1097 create_trail_blaze(SHIP_EXPLOSION_COLOUR, &ship.position);
1097 } 1098 }
1098 1099
@@ -1130,7 +1131,7 @@ void check_collisions(void)
1130 if(is_point_within_enemy(&ship.position)) 1131 if(is_point_within_enemy(&ship.position))
1131 { 1132 {
1132 ship.explode_countdown = EXPLOSION_LENGTH; 1133 ship.explode_countdown = EXPLOSION_LENGTH;
1133 //initialise_explosion(ship.vertices, NUM_SHIP_VERTICES); 1134 /* initialise_explosion(ship.vertices, NUM_SHIP_VERTICES); */
1134 create_trail_blaze(SHIP_EXPLOSION_COLOUR, &ship.position); 1135 create_trail_blaze(SHIP_EXPLOSION_COLOUR, &ship.position);
1135 create_trail_blaze(ENEMY_EXPLOSION_COLOUR, &enemy.position); 1136 create_trail_blaze(ENEMY_EXPLOSION_COLOUR, &enemy.position);
1136 } 1137 }
@@ -1157,7 +1158,7 @@ void check_collisions(void)
1157 enemy_missile.position.y - ship.position.y)) 1158 enemy_missile.position.y - ship.position.y))
1158 { 1159 {
1159 ship.explode_countdown = EXPLOSION_LENGTH; 1160 ship.explode_countdown = EXPLOSION_LENGTH;
1160 //initialise_explosion(ship.vertices, NUM_SHIP_VERTICES); 1161 /* initialise_explosion(ship.vertices, NUM_SHIP_VERTICES); */
1161 create_trail_blaze(SHIP_EXPLOSION_COLOUR, &ship.position); 1162 create_trail_blaze(SHIP_EXPLOSION_COLOUR, &ship.position);
1162 enemy_missile.survived = 0; 1163 enemy_missile.survived = 0;
1163 enemy_missile.position.x = enemy_missile.position.y = 0; 1164 enemy_missile.position.x = enemy_missile.position.y = 0;
@@ -1304,7 +1305,11 @@ void draw_lives(void)
1304{ 1305{
1305 int n; 1306 int n;
1306 int px = (LCD_WIDTH - num_lives*4 - 1); 1307 int px = (LCD_WIDTH - num_lives*4 - 1);
1308 #if(LARGE_LCD)
1309 int py = (LCD_HEIGHT-6);
1310 #else
1307 int py = (LCD_HEIGHT-4); 1311 int py = (LCD_HEIGHT-4);
1312 #endif
1308 1313
1309 SET_FG(COL_PLAYER); 1314 SET_FG(COL_PLAYER);
1310 1315
@@ -1312,7 +1317,11 @@ void draw_lives(void)
1312 while(--n) 1317 while(--n)
1313 { 1318 {
1314 draw_polygon(lives_points, px, py, NUM_SHIP_VERTICES); 1319 draw_polygon(lives_points, px, py, NUM_SHIP_VERTICES);
1320 #if(LARGE_LCD)
1321 px += 8;
1322 #else
1315 px += 6; 1323 px += 6;
1324 #endif
1316 } 1325 }
1317} 1326}
1318 1327
@@ -1402,9 +1411,9 @@ void initialise_asteroid(struct Asteroid* asteroid, enum asteroid_type type)
1402 1411
1403 asteroid->radius += 6*SCALE; 1412 asteroid->radius += 6*SCALE;
1404 if(asteroid->type == SMALL) 1413 if(asteroid->type == SMALL)
1405 asteroid->radius /= 3;//2 1414 asteroid->radius /= 3;/*2*/
1406 else if(asteroid->type == LARGE) 1415 else if(asteroid->type == LARGE)
1407 asteroid->radius += 3*SCALE;//2 1416 asteroid->radius += 3*SCALE;/*2*/
1408 b = true; 1417 b = true;
1409 while(b) 1418 while(b)
1410 { 1419 {
@@ -1520,9 +1529,9 @@ void draw_and_move_ship(void)
1520 } 1529 }
1521 else 1530 else
1522 { 1531 {
1523 // animate_and_draw_explosion(ship.vertices, NUM_SHIP_VERTICES, 1532 /* animate_and_draw_explosion(ship.vertices, NUM_SHIP_VERTICES,
1524 // ship.position.x/SCALE, 1533 ship.position.x/SCALE,
1525 // ship.position.y/SCALE); 1534 ship.position.y/SCALE); */
1526 if(game_state != PAUSE_MODE) 1535 if(game_state != PAUSE_MODE)
1527 { 1536 {
1528 ship.explode_countdown--; 1537 ship.explode_countdown--;
@@ -1550,8 +1559,9 @@ void thrust_ship(void)
1550 { 1559 {
1551 ship.position.dx += ( ship.vertices[0].x - ship.vertices[2].x )/20; 1560 ship.position.dx += ( ship.vertices[0].x - ship.vertices[2].x )/20;
1552 ship.position.dy += ( ship.vertices[0].y - ship.vertices[2].y )/20; 1561 ship.position.dy += ( ship.vertices[0].y - ship.vertices[2].y )/20;
1553 /*if dx and dy are below a certain threshold, then set 'em to 0*/ 1562 /*if dx and dy are below a certain threshold, then set 'em to 0
1554 //but to do this we need to ascertain if the spacehip as moved on screen for more than a certain amount. 1563 but to do this we need to ascertain if the spacehip as moved on screen
1564 for more than a certain amount. */
1555 1565
1556 create_trail_blaze(THRUST_COLOUR, &ship.position); 1566 create_trail_blaze(THRUST_COLOUR, &ship.position);
1557 } 1567 }
@@ -1620,10 +1630,10 @@ void draw_and_move_asteroids(void)
1620 } 1630 }
1621 else if(asteroid->explode_countdown) 1631 else if(asteroid->explode_countdown)
1622 { 1632 {
1623 // animate_and_draw_explosion(asteroid->vertices, 1633 /* animate_and_draw_explosion(asteroid->vertices,
1624 // NUM_ASTEROID_VERTICES, 1634 NUM_ASTEROID_VERTICES,
1625 // asteroid->position.x/SCALE, 1635 asteroid->position.x/SCALE,
1626 // asteroid->position.y/SCALE); 1636 asteroid->position.y/SCALE); */
1627 asteroid->explode_countdown--; 1637 asteroid->explode_countdown--;
1628 } 1638 }
1629 } 1639 }
@@ -1655,7 +1665,8 @@ void create_stars(void)
1655 } 1665 }
1656 1666
1657 1667
1658 //give the point a random countdown timer, so they dissapears at different times 1668 /* give the point a random countdown timer, so they dissapears at different
1669 times */
1659 tpoint = trailPoints; 1670 tpoint = trailPoints;
1660 n = NUM_TRAIL_POINTS; 1671 n = NUM_TRAIL_POINTS;
1661 while(--n) 1672 while(--n)