summaryrefslogtreecommitdiff
path: root/apps/plugins/brickmania.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/brickmania.c')
-rw-r--r--apps/plugins/brickmania.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c
index 1dd74f35cd..8d01917c2e 100644
--- a/apps/plugins/brickmania.c
+++ b/apps/plugins/brickmania.c
@@ -901,11 +901,11 @@ enum paddle_type
901 901
902enum intersection 902enum intersection
903{ 903{
904 INTERSECTION_NONE = 0,
905 INTERSECTION_TOP, 904 INTERSECTION_TOP,
906 INTERSECTION_BOTTOM, 905 INTERSECTION_BOTTOM,
907 INTERSECTION_LEFT, 906 INTERSECTION_LEFT,
908 INTERSECTION_RIGHT, 907 INTERSECTION_RIGHT,
908 INTERSECTION_ALL,
909}; 909};
910 910
911struct brick 911struct brick
@@ -1147,8 +1147,13 @@ static int check_rect(struct line *line, struct rect *rect,
1147 1147
1148 break; 1148 break;
1149 } 1149 }
1150 default: 1150 case INTERSECTION_ALL: /* Test hit on all edges */
1151 return 0; /* shouldn't reach here */ 1151 {
1152 return (check_rect(line, rect, INTERSECTION_TOP, hitp) ||
1153 check_rect(line, rect, INTERSECTION_BOTTOM, hitp) ||
1154 check_rect(line, rect, INTERSECTION_LEFT, hitp) ||
1155 check_rect(line, rect, INTERSECTION_RIGHT, hitp));
1156 }
1152 } 1157 }
1153 1158
1154 return check_lines(line, &edge, hitp); 1159 return check_lines(line, &edge, hitp);
@@ -1516,8 +1521,8 @@ static int brickmania_game_loop(void)
1516 int sec_count=0; 1521 int sec_count=0;
1517 int end; 1522 int end;
1518 1523
1519 /* pad_line used for powerup/ball checks */ 1524 /* pad_rect used for powerup/ball checks */
1520 struct line pad_line; 1525 struct rect pad_rect;
1521 /* This is used for various lines that are checked (ball and powerup) */ 1526 /* This is used for various lines that are checked (ball and powerup) */
1522 struct line misc_line; 1527 struct line misc_line;
1523 1528
@@ -1602,11 +1607,11 @@ static int brickmania_game_loop(void)
1602 brick_on_board--; 1607 brick_on_board--;
1603 1608
1604 /* Setup the pad line-later used in intersection test */ 1609 /* Setup the pad line-later used in intersection test */
1605 pad_line.p1.x = pad_pos_x; 1610 pad_rect.top_left.x = pad_pos_x;
1606 pad_line.p1.y = PAD_POS_Y; 1611 pad_rect.top_left.y = PAD_POS_Y;
1607 1612
1608 pad_line.p2.x = pad_pos_x + pad_width; 1613 pad_rect.bottom_right.x = pad_pos_x + pad_width;
1609 pad_line.p2.y = PAD_POS_Y; 1614 pad_rect.bottom_right.y = PAD_POS_Y + PAD_HEIGHT;
1610 1615
1611 if (game_state!=ST_PAUSE) 1616 if (game_state!=ST_PAUSE)
1612 { 1617 {
@@ -1668,7 +1673,8 @@ static int brickmania_game_loop(void)
1668 misc_line.p2.y += SPEED_POWER; 1673 misc_line.p2.y += SPEED_POWER;
1669 1674
1670 /* Check if the powerup will hit the paddle */ 1675 /* Check if the powerup will hit the paddle */
1671 if (check_lines(&misc_line, &pad_line, &pt_hit)) 1676 if (check_rect(&misc_line, &pad_rect, INTERSECTION_ALL,
1677 &pt_hit))
1672 { 1678 {
1673 1679
1674 /* power hit paddle */ 1680 /* power hit paddle */
@@ -2051,7 +2057,8 @@ static int brickmania_game_loop(void)
2051 /* Did the ball hit the paddle? Depending on where the ball 2057 /* Did the ball hit the paddle? Depending on where the ball
2052 * Hit set the x/y speed appropriately. 2058 * Hit set the x/y speed appropriately.
2053 */ 2059 */
2054 if(check_lines(&misc_line, &pad_line, &pt_hit) ) 2060 if(check_rect(&misc_line, &pad_rect, INTERSECTION_TOP,
2061 &pt_hit) )
2055 { 2062 {
2056 /* Re-position ball based on collision */ 2063 /* Re-position ball based on collision */
2057 ball[k].tempy = ON_PAD_POS_Y; 2064 ball[k].tempy = ON_PAD_POS_Y;