diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-08-02 20:26:25 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-08-02 20:26:25 +0000 |
commit | 4654b3c90b1a552bec22899285dfba85017c2543 (patch) | |
tree | 32b9da969bf9c403326d635292a746f58ff338d8 /apps/plugins/bubbles.c | |
parent | e21081040c27fd6cb3723e8bebde9e0729cd80c0 (diff) | |
download | rockbox-4654b3c90b1a552bec22899285dfba85017c2543.tar.gz rockbox-4654b3c90b1a552bec22899285dfba85017c2543.zip |
New bubbles background for 176x220 (Sansa e200), heavily based off a mockup provided by Marianne Arnold.
Also implement some custom text positioning which is needed to display the text boxes horizontally.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22120 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/bubbles.c')
-rw-r--r-- | apps/plugins/bubbles.c | 114 |
1 files changed, 78 insertions, 36 deletions
diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c index 9454fd14a3..2e8aaaac9c 100644 --- a/apps/plugins/bubbles.c +++ b/apps/plugins/bubbles.c | |||
@@ -143,8 +143,20 @@ enum { | |||
143 | 143 | ||
144 | /* 16x16 bubbles (Sansa E200) */ | 144 | /* 16x16 bubbles (Sansa E200) */ |
145 | #elif (LCD_HEIGHT == 220) && (LCD_WIDTH == 176) | 145 | #elif (LCD_HEIGHT == 220) && (LCD_WIDTH == 176) |
146 | #define XOFS 48 | 146 | #define XOFS 24 |
147 | #define MAX_FPS 30 | 147 | #define MAX_FPS 30 |
148 | #define YOFS 45 | ||
149 | |||
150 | /* custom text positioning */ | ||
151 | #define LEVEL_TXT_X 24 | ||
152 | #define LEVEL_TXT_WIDTH 31 | ||
153 | #define LEVEL_TXT_Y 5 | ||
154 | #define SCORE_TXT_X 58 | ||
155 | #define SCORE_TXT_WIDTH 31 | ||
156 | #define SCORE_TXT_Y 5 | ||
157 | #define NEXT_BB_X 112 | ||
158 | #define NEXT_BB_WIDTH 31 | ||
159 | #define NEXT_BB_Y 3 | ||
148 | 160 | ||
149 | /* 12x12 bubbles (iPod Nano) */ | 161 | /* 12x12 bubbles (iPod Nano) */ |
150 | #elif (LCD_HEIGHT == 132) && (LCD_WIDTH == 176) | 162 | #elif (LCD_HEIGHT == 132) && (LCD_WIDTH == 176) |
@@ -195,9 +207,13 @@ enum { | |||
195 | 207 | ||
196 | #define TEXT_LINES (LCD_HEIGHT/8) | 208 | #define TEXT_LINES (LCD_HEIGHT/8) |
197 | 209 | ||
210 | #ifndef YOFS | ||
211 | #define YOFS 0 | ||
212 | #endif | ||
213 | |||
198 | /* shot position */ | 214 | /* shot position */ |
199 | #define SHOTX XOFS+ROW_INDENT+BUBBLE_WIDTH*3 | 215 | #define SHOTX XOFS+ROW_INDENT+BUBBLE_WIDTH*3 |
200 | #define SHOTY ROW_HEIGHT*(BB_HEIGHT-1)+BUBBLE_HEIGHT/2 | 216 | #define SHOTY (YOFS+ROW_HEIGHT*(BB_HEIGHT-1)+BUBBLE_HEIGHT/2) |
201 | 217 | ||
202 | /* collision distance squared */ | 218 | /* collision distance squared */ |
203 | #define MIN_DISTANCE ((BUBBLE_WIDTH*8)/10)*((BUBBLE_HEIGHT*8)/10) | 219 | #define MIN_DISTANCE ((BUBBLE_WIDTH*8)/10)*((BUBBLE_HEIGHT*8)/10) |
@@ -1393,7 +1409,7 @@ static void bubbles_getonboard(struct game_context* bb) { | |||
1393 | ******************************************************************************/ | 1409 | ******************************************************************************/ |
1394 | static void bubbles_drawboard(struct game_context* bb) { | 1410 | static void bubbles_drawboard(struct game_context* bb) { |
1395 | int i, j; | 1411 | int i, j; |
1396 | int w, h; | 1412 | int w1, w2, h; |
1397 | int colmax, indent; | 1413 | int colmax, indent; |
1398 | int tipx, tipy; | 1414 | int tipx, tipy; |
1399 | bool evenline = false; | 1415 | bool evenline = false; |
@@ -1405,7 +1421,8 @@ static void bubbles_drawboard(struct game_context* bb) { | |||
1405 | 1421 | ||
1406 | /* clear screen */ | 1422 | /* clear screen */ |
1407 | rb->lcd_clear_display(); | 1423 | rb->lcd_clear_display(); |
1408 | 1424 | int font = rb->screens[SCREEN_MAIN]->getfont(); | |
1425 | h = rb->font_get(font)->height + 1; | ||
1409 | /* draw background */ | 1426 | /* draw background */ |
1410 | #ifdef HAVE_LCD_COLOR | 1427 | #ifdef HAVE_LCD_COLOR |
1411 | rb->lcd_bitmap(bubbles_background, 0, 0, LCD_WIDTH, LCD_HEIGHT); | 1428 | rb->lcd_bitmap(bubbles_background, 0, 0, LCD_WIDTH, LCD_HEIGHT); |
@@ -1427,12 +1444,12 @@ static void bubbles_drawboard(struct game_context* bb) { | |||
1427 | rb->lcd_bitmap_part(bubbles_emblem, | 1444 | rb->lcd_bitmap_part(bubbles_emblem, |
1428 | 0, EMBLEM_HEIGHT*bb->playboard[i][j].type, EMBLEM_WIDTH, | 1445 | 0, EMBLEM_HEIGHT*bb->playboard[i][j].type, EMBLEM_WIDTH, |
1429 | XOFS+indent+BUBBLE_WIDTH*j+(BUBBLE_WIDTH-EMBLEM_WIDTH)/2, | 1446 | XOFS+indent+BUBBLE_WIDTH*j+(BUBBLE_WIDTH-EMBLEM_WIDTH)/2, |
1430 | ROW_HEIGHT*i+(BUBBLE_HEIGHT-EMBLEM_HEIGHT)/2+bb->compress*ROW_HEIGHT, | 1447 | YOFS+ROW_HEIGHT*i+(BUBBLE_HEIGHT-EMBLEM_HEIGHT)/2+bb->compress*ROW_HEIGHT, |
1431 | EMBLEM_WIDTH, EMBLEM_HEIGHT); | 1448 | EMBLEM_WIDTH, EMBLEM_HEIGHT); |
1432 | rb->lcd_set_drawmode(DRMODE_FG); | 1449 | rb->lcd_set_drawmode(DRMODE_FG); |
1433 | rb->lcd_mono_bitmap((const unsigned char *)bubbles_bubble, | 1450 | rb->lcd_mono_bitmap((const unsigned char *)bubbles_bubble, |
1434 | XOFS+indent+BUBBLE_WIDTH*j, | 1451 | XOFS+indent+BUBBLE_WIDTH*j, |
1435 | ROW_HEIGHT*i+bb->compress*ROW_HEIGHT, | 1452 | YOFS+ROW_HEIGHT*i+bb->compress*ROW_HEIGHT, |
1436 | BUBBLE_WIDTH, BUBBLE_HEIGHT); | 1453 | BUBBLE_WIDTH, BUBBLE_HEIGHT); |
1437 | rb->lcd_set_drawmode(DRMODE_SOLID); | 1454 | rb->lcd_set_drawmode(DRMODE_SOLID); |
1438 | } | 1455 | } |
@@ -1452,6 +1469,7 @@ static void bubbles_drawboard(struct game_context* bb) { | |||
1452 | rb->lcd_set_drawmode(DRMODE_SOLID); | 1469 | rb->lcd_set_drawmode(DRMODE_SOLID); |
1453 | 1470 | ||
1454 | /* display next bubble to be shot */ | 1471 | /* display next bubble to be shot */ |
1472 | #ifndef NEXT_BB_X | ||
1455 | rb->lcd_bitmap_part(bubbles_emblem, | 1473 | rb->lcd_bitmap_part(bubbles_emblem, |
1456 | 0, EMBLEM_HEIGHT*bb->queue[(bb->nextinq+1)%NUM_QUEUE], EMBLEM_WIDTH, | 1474 | 0, EMBLEM_HEIGHT*bb->queue[(bb->nextinq+1)%NUM_QUEUE], EMBLEM_WIDTH, |
1457 | XOFS/2-BUBBLE_WIDTH/2+(BUBBLE_WIDTH-EMBLEM_WIDTH)/2, | 1475 | XOFS/2-BUBBLE_WIDTH/2+(BUBBLE_WIDTH-EMBLEM_WIDTH)/2, |
@@ -1462,15 +1480,27 @@ static void bubbles_drawboard(struct game_context* bb) { | |||
1462 | XOFS/2-BUBBLE_WIDTH/2, SHOTY, | 1480 | XOFS/2-BUBBLE_WIDTH/2, SHOTY, |
1463 | BUBBLE_WIDTH, BUBBLE_HEIGHT); | 1481 | BUBBLE_WIDTH, BUBBLE_HEIGHT); |
1464 | rb->lcd_set_drawmode(DRMODE_SOLID); | 1482 | rb->lcd_set_drawmode(DRMODE_SOLID); |
1483 | #else | ||
1484 | rb->lcd_bitmap_part(bubbles_emblem, | ||
1485 | 0, EMBLEM_HEIGHT*bb->queue[(bb->nextinq+1)%NUM_QUEUE], EMBLEM_WIDTH, | ||
1486 | NEXT_BB_X + NEXT_BB_WIDTH/2-BUBBLE_WIDTH/2+(BUBBLE_WIDTH-EMBLEM_WIDTH)/2, | ||
1487 | NEXT_BB_Y + (BUBBLE_HEIGHT-EMBLEM_HEIGHT)/2 + h, | ||
1488 | EMBLEM_WIDTH, EMBLEM_HEIGHT); | ||
1489 | rb->lcd_set_drawmode(DRMODE_FG); | ||
1490 | rb->lcd_mono_bitmap((const unsigned char *)bubbles_bubble, | ||
1491 | NEXT_BB_X + NEXT_BB_WIDTH/2-BUBBLE_WIDTH/2, NEXT_BB_Y + h, | ||
1492 | BUBBLE_WIDTH, BUBBLE_HEIGHT); | ||
1493 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
1494 | #endif | ||
1465 | 1495 | ||
1466 | /* draw bounding lines */ | 1496 | /* draw bounding lines */ |
1467 | #ifndef HAVE_LCD_COLOR | 1497 | #ifndef HAVE_LCD_COLOR |
1468 | rb->lcd_vline(XOFS-1, 0, LCD_HEIGHT); | 1498 | rb->lcd_vline(XOFS-1, 0, LCD_HEIGHT); |
1469 | rb->lcd_vline(XOFS+BUBBLE_WIDTH*BB_WIDTH, 0, LCD_HEIGHT); | 1499 | rb->lcd_vline(XOFS+BUBBLE_WIDTH*BB_WIDTH, 0, LCD_HEIGHT); |
1470 | #endif | 1500 | #endif |
1471 | rb->lcd_hline(XOFS, XOFS+BUBBLE_WIDTH*BB_WIDTH-1, bb->compress*ROW_HEIGHT-1); | 1501 | rb->lcd_hline(XOFS, XOFS+BUBBLE_WIDTH*BB_WIDTH-1, YOFS+bb->compress*ROW_HEIGHT-1); |
1472 | rb->lcd_hline(XOFS, XOFS+BUBBLE_WIDTH*BB_WIDTH-1, | 1502 | rb->lcd_hline(XOFS, XOFS+BUBBLE_WIDTH*BB_WIDTH-1, |
1473 | ROW_HEIGHT*(BB_HEIGHT-2)+BUBBLE_HEIGHT); | 1503 | YOFS+ROW_HEIGHT*(BB_HEIGHT-2)+BUBBLE_HEIGHT); |
1474 | 1504 | ||
1475 | /* draw arrow */ | 1505 | /* draw arrow */ |
1476 | tipx = SHOTX+BUBBLE_WIDTH/2+(((fp14_sin(bb->angle)>>4)*BUBBLE_WIDTH*3/2)>>10); | 1506 | tipx = SHOTX+BUBBLE_WIDTH/2+(((fp14_sin(bb->angle)>>4)*BUBBLE_WIDTH*3/2)>>10); |
@@ -1486,26 +1516,39 @@ static void bubbles_drawboard(struct game_context* bb) { | |||
1486 | tipy-(((fp14_cos(bb->angle+135)>>4)*BUBBLE_HEIGHT/3)>>10)); | 1516 | tipy-(((fp14_cos(bb->angle+135)>>4)*BUBBLE_HEIGHT/3)>>10)); |
1487 | 1517 | ||
1488 | /* draw text */ | 1518 | /* draw text */ |
1489 | rb->lcd_getstringsize(level, &w, &h); | ||
1490 | rb->lcd_putsxy(XOFS/2-w/2, 2, level); | ||
1491 | |||
1492 | rb->snprintf(str, 4, "%d", bb->level); | 1519 | rb->snprintf(str, 4, "%d", bb->level); |
1493 | rb->lcd_getstringsize(str, &w, &h); | 1520 | rb->lcd_getstringsize(level, &w1, NULL); |
1494 | rb->lcd_putsxy(XOFS/2-w/2, 11, str); | 1521 | rb->lcd_getstringsize(str, &w2, NULL); |
1495 | 1522 | #ifndef LEVEL_TXT_X | |
1496 | rb->lcd_getstringsize(score, &w, &h); | 1523 | rb->lcd_putsxy(XOFS/2-w1/2, 2, level); |
1497 | rb->lcd_putsxy(XOFS/2-w/2, 29, score); | 1524 | rb->lcd_putsxy(XOFS/2-w2/2, 2+h, str); |
1525 | #else | ||
1526 | rb->lcd_putsxy(LEVEL_TXT_X+(LEVEL_TXT_WIDTH/2-w1/2), LEVEL_TXT_Y, level); | ||
1527 | rb->lcd_putsxy(LEVEL_TXT_X+(LEVEL_TXT_WIDTH/2-w2/2), LEVEL_TXT_Y+h, str); | ||
1528 | #endif | ||
1498 | 1529 | ||
1499 | rb->snprintf(str, 10, "%d", bb->score); | 1530 | rb->snprintf(str, 10, "%d", bb->score); |
1500 | rb->lcd_getstringsize(str, &w, &h); | 1531 | rb->lcd_getstringsize(score, &w1,NULL); |
1501 | rb->lcd_putsxy(XOFS/2-w/2, 38, str); | 1532 | rb->lcd_getstringsize(str, &w2, NULL); |
1533 | #ifndef SCORE_TXT_X | ||
1534 | rb->lcd_putsxy(XOFS/2-w1/2, 29, score); | ||
1535 | rb->lcd_putsxy(XOFS/2-w2/2, 29+h, str); | ||
1536 | #else | ||
1537 | rb->lcd_putsxy(SCORE_TXT_X+(SCORE_TXT_WIDTH/2-w1/2), SCORE_TXT_Y, score); | ||
1538 | rb->lcd_putsxy(SCORE_TXT_X+(SCORE_TXT_WIDTH/2-w2/2), SCORE_TXT_Y+h, str); | ||
1539 | #endif | ||
1502 | 1540 | ||
1503 | rb->lcd_getstringsize(next, &w, &h); | 1541 | rb->lcd_getstringsize(next, &w1, NULL); |
1504 | rb->lcd_putsxy(XOFS/2-w/2, SHOTY-9, next); | 1542 | #ifndef NEXT_BB_X |
1543 | rb->lcd_putsxy(XOFS/2-w/2, SHOTY-h, next); | ||
1544 | #else | ||
1545 | rb->lcd_putsxy(NEXT_BB_X+(NEXT_BB_WIDTH/2-w1/2), NEXT_BB_Y, next); | ||
1546 | #endif | ||
1547 | |||
1505 | 1548 | ||
1506 | if(bb->elapsedshot >= (MAX_SHOTTIME*7)/10) { | 1549 | if(bb->elapsedshot >= (MAX_SHOTTIME*7)/10) { |
1507 | rb->lcd_getstringsize(hurry, &w, &h); | 1550 | rb->lcd_getstringsize(hurry, &w1, &h); |
1508 | rb->lcd_putsxy(LCD_WIDTH/2-w/2, LCD_HEIGHT/2-h/2, hurry); | 1551 | rb->lcd_putsxy(LCD_WIDTH/2-w1/2, LCD_HEIGHT/2-h/2, hurry); |
1509 | } | 1552 | } |
1510 | } | 1553 | } |
1511 | 1554 | ||
@@ -1574,7 +1617,7 @@ static int bubbles_fire(struct game_context* bb) { | |||
1574 | 1617 | ||
1575 | /* find nearest position */ | 1618 | /* find nearest position */ |
1576 | nearrow = ((SHOTY+tempyofs)- | 1619 | nearrow = ((SHOTY+tempyofs)- |
1577 | (bb->compress*ROW_HEIGHT)+ | 1620 | (YOFS+bb->compress*ROW_HEIGHT)+ |
1578 | (ROW_HEIGHT/2))/ROW_HEIGHT; | 1621 | (ROW_HEIGHT/2))/ROW_HEIGHT; |
1579 | if(nearrow >= BB_HEIGHT) nearrow = BB_HEIGHT-1; | 1622 | if(nearrow >= BB_HEIGHT) nearrow = BB_HEIGHT-1; |
1580 | 1623 | ||
@@ -1600,14 +1643,14 @@ static int bubbles_fire(struct game_context* bb) { | |||
1600 | lastcol = nearcol; | 1643 | lastcol = nearcol; |
1601 | 1644 | ||
1602 | /* if collision with neighbor then attach shot */ | 1645 | /* if collision with neighbor then attach shot */ |
1603 | if(bubbles_collision(bb, SHOTY+tempyofs, SHOTX+tempxofs, | 1646 | if(bubbles_collision(bb, YOFS+SHOTY+tempyofs, SHOTX+tempxofs, |
1604 | nearrow, nearcol)) { | 1647 | nearrow, nearcol)) { |
1605 | bb->playboard[nearrow][nearcol].type = bubblecur; | 1648 | bb->playboard[nearrow][nearcol].type = bubblecur; |
1606 | break; | 1649 | break; |
1607 | } | 1650 | } |
1608 | 1651 | ||
1609 | /* if at top then attach shot to the ceiling */ | 1652 | /* if at top then attach shot to the ceiling */ |
1610 | if(nearrow == 0 && SHOTY+tempyofs <= bb->compress*ROW_HEIGHT) { | 1653 | if(nearrow == 0 && SHOTY+tempyofs <= YOFS+bb->compress*ROW_HEIGHT) { |
1611 | bb->playboard[nearrow][nearcol].type = bubblecur; | 1654 | bb->playboard[nearrow][nearcol].type = bubblecur; |
1612 | break; | 1655 | break; |
1613 | } | 1656 | } |
@@ -1658,7 +1701,7 @@ static bool bubbles_collision(struct game_context* bb, int y, int x, | |||
1658 | if(nearcol-1 >= 0) { | 1701 | if(nearcol-1 >= 0) { |
1659 | if(bb->playboard[nearrow][nearcol-1].type >= 0) { | 1702 | if(bb->playboard[nearrow][nearcol-1].type >= 0) { |
1660 | nx = XOFS+(nearrow%2 ? ROW_INDENT : 0)+BUBBLE_WIDTH*(nearcol-1); | 1703 | nx = XOFS+(nearrow%2 ? ROW_INDENT : 0)+BUBBLE_WIDTH*(nearcol-1); |
1661 | ny = ROW_HEIGHT*nearrow+bb->compress*ROW_HEIGHT; | 1704 | ny = YOFS+ROW_HEIGHT*nearrow+bb->compress*ROW_HEIGHT; |
1662 | if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; | 1705 | if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; |
1663 | } | 1706 | } |
1664 | } | 1707 | } |
@@ -1668,7 +1711,7 @@ static bool bubbles_collision(struct game_context* bb, int y, int x, | |||
1668 | if(bb->playboard[nearrow-1][nearcol-1+adj].type >= 0) { | 1711 | if(bb->playboard[nearrow-1][nearcol-1+adj].type >= 0) { |
1669 | nx = XOFS+((nearrow-1)%2 ? ROW_INDENT : 0)+ | 1712 | nx = XOFS+((nearrow-1)%2 ? ROW_INDENT : 0)+ |
1670 | BUBBLE_WIDTH*(nearcol-1+adj); | 1713 | BUBBLE_WIDTH*(nearcol-1+adj); |
1671 | ny = ROW_HEIGHT*(nearrow-1)+bb->compress*ROW_HEIGHT; | 1714 | ny = YOFS+ROW_HEIGHT*(nearrow-1)+bb->compress*ROW_HEIGHT; |
1672 | if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; | 1715 | if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; |
1673 | } | 1716 | } |
1674 | } | 1717 | } |
@@ -1677,7 +1720,7 @@ static bool bubbles_collision(struct game_context* bb, int y, int x, | |||
1677 | if(bb->playboard[nearrow+1][nearcol-1+adj].type >= 0) { | 1720 | if(bb->playboard[nearrow+1][nearcol-1+adj].type >= 0) { |
1678 | nx = XOFS+((nearrow+1)%2 ? ROW_INDENT : 0)+ | 1721 | nx = XOFS+((nearrow+1)%2 ? ROW_INDENT : 0)+ |
1679 | BUBBLE_WIDTH*(nearcol-1+adj); | 1722 | BUBBLE_WIDTH*(nearcol-1+adj); |
1680 | ny = ROW_HEIGHT*(nearrow+1)+bb->compress*ROW_HEIGHT; | 1723 | ny = YOFS+ROW_HEIGHT*(nearrow+1)+bb->compress*ROW_HEIGHT; |
1681 | if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; | 1724 | if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; |
1682 | } | 1725 | } |
1683 | } | 1726 | } |
@@ -1688,7 +1731,7 @@ static bool bubbles_collision(struct game_context* bb, int y, int x, | |||
1688 | if(bb->playboard[nearrow-1][nearcol+adj].type >= 0) { | 1731 | if(bb->playboard[nearrow-1][nearcol+adj].type >= 0) { |
1689 | nx = XOFS+((nearrow-1)%2 ? ROW_INDENT : 0)+ | 1732 | nx = XOFS+((nearrow-1)%2 ? ROW_INDENT : 0)+ |
1690 | BUBBLE_WIDTH*(nearcol+adj); | 1733 | BUBBLE_WIDTH*(nearcol+adj); |
1691 | ny = ROW_HEIGHT*(nearrow-1)+bb->compress*ROW_HEIGHT; | 1734 | ny = YOFS+ROW_HEIGHT*(nearrow-1)+bb->compress*ROW_HEIGHT; |
1692 | if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; | 1735 | if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; |
1693 | } | 1736 | } |
1694 | } | 1737 | } |
@@ -1697,7 +1740,7 @@ static bool bubbles_collision(struct game_context* bb, int y, int x, | |||
1697 | if(bb->playboard[nearrow+1][nearcol+adj].type >= 0) { | 1740 | if(bb->playboard[nearrow+1][nearcol+adj].type >= 0) { |
1698 | nx = XOFS+((nearrow+1)%2 ? ROW_INDENT : 0)+ | 1741 | nx = XOFS+((nearrow+1)%2 ? ROW_INDENT : 0)+ |
1699 | BUBBLE_WIDTH*(nearcol+adj); | 1742 | BUBBLE_WIDTH*(nearcol+adj); |
1700 | ny = ROW_HEIGHT*(nearrow+1)+bb->compress*ROW_HEIGHT; | 1743 | ny = YOFS+ROW_HEIGHT*(nearrow+1)+bb->compress*ROW_HEIGHT; |
1701 | if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; | 1744 | if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; |
1702 | } | 1745 | } |
1703 | } | 1746 | } |
@@ -1706,7 +1749,7 @@ static bool bubbles_collision(struct game_context* bb, int y, int x, | |||
1706 | if(nearcol+1 < BB_WIDTH-adj) { | 1749 | if(nearcol+1 < BB_WIDTH-adj) { |
1707 | if(bb->playboard[nearrow][nearcol+1].type >= 0) { | 1750 | if(bb->playboard[nearrow][nearcol+1].type >= 0) { |
1708 | nx = XOFS+(nearrow%2 ? ROW_INDENT : 0)+BUBBLE_WIDTH*(nearcol+1); | 1751 | nx = XOFS+(nearrow%2 ? ROW_INDENT : 0)+BUBBLE_WIDTH*(nearcol+1); |
1709 | ny = ROW_HEIGHT*nearrow+bb->compress*ROW_HEIGHT; | 1752 | ny = YOFS+ROW_HEIGHT*nearrow+bb->compress*ROW_HEIGHT; |
1710 | if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; | 1753 | if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; |
1711 | } | 1754 | } |
1712 | } | 1755 | } |
@@ -2018,7 +2061,7 @@ static int bubbles_fall(struct game_context* bb) { | |||
2018 | BUBBLE_HEIGHT)/20; | 2061 | BUBBLE_HEIGHT)/20; |
2019 | 2062 | ||
2020 | /* draw bubble if it is still on the screen */ | 2063 | /* draw bubble if it is still on the screen */ |
2021 | if(ROW_HEIGHT*i+bb->compress*ROW_HEIGHT+yofs | 2064 | if(YOFS+ROW_HEIGHT*i+bb->compress*ROW_HEIGHT+yofs |
2022 | <= LCD_HEIGHT) { | 2065 | <= LCD_HEIGHT) { |
2023 | onscreen = true; | 2066 | onscreen = true; |
2024 | 2067 | ||
@@ -2026,14 +2069,14 @@ static int bubbles_fall(struct game_context* bb) { | |||
2026 | EMBLEM_HEIGHT*bb->playboard[i][j].type, EMBLEM_WIDTH, | 2069 | EMBLEM_HEIGHT*bb->playboard[i][j].type, EMBLEM_WIDTH, |
2027 | XOFS+indent+BUBBLE_WIDTH*j+ | 2070 | XOFS+indent+BUBBLE_WIDTH*j+ |
2028 | (BUBBLE_WIDTH-EMBLEM_WIDTH)/2+xofs, | 2071 | (BUBBLE_WIDTH-EMBLEM_WIDTH)/2+xofs, |
2029 | ROW_HEIGHT*i+(BUBBLE_HEIGHT-EMBLEM_HEIGHT)/2+ | 2072 | YOFS+ROW_HEIGHT*i+(BUBBLE_HEIGHT-EMBLEM_HEIGHT)/2+ |
2030 | bb->compress*ROW_HEIGHT+yofs, | 2073 | bb->compress*ROW_HEIGHT+yofs, |
2031 | EMBLEM_WIDTH, EMBLEM_HEIGHT); | 2074 | EMBLEM_WIDTH, EMBLEM_HEIGHT); |
2032 | rb->lcd_set_drawmode(DRMODE_FG); | 2075 | rb->lcd_set_drawmode(DRMODE_FG); |
2033 | rb->lcd_mono_bitmap( | 2076 | rb->lcd_mono_bitmap( |
2034 | (const unsigned char *)bubbles_bubble, | 2077 | (const unsigned char *)bubbles_bubble, |
2035 | XOFS+indent+BUBBLE_WIDTH*j+xofs, | 2078 | XOFS+indent+BUBBLE_WIDTH*j+xofs, |
2036 | ROW_HEIGHT*i+bb->compress*ROW_HEIGHT+yofs, | 2079 | YOFS+ROW_HEIGHT*i+bb->compress*ROW_HEIGHT+yofs, |
2037 | BUBBLE_WIDTH, BUBBLE_HEIGHT); | 2080 | BUBBLE_WIDTH, BUBBLE_HEIGHT); |
2038 | rb->lcd_set_drawmode(DRMODE_SOLID); | 2081 | rb->lcd_set_drawmode(DRMODE_SOLID); |
2039 | } | 2082 | } |
@@ -2205,7 +2248,6 @@ static void bubbles_savegame(struct game_context* bb) { | |||
2205 | } | 2248 | } |
2206 | 2249 | ||
2207 | rb->close(fd); | 2250 | rb->close(fd); |
2208 | |||
2209 | } | 2251 | } |
2210 | 2252 | ||
2211 | /***************************************************************************** | 2253 | /***************************************************************************** |