summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rwxr-xr-xapps/plugins/bubbles.c114
1 files changed, 68 insertions, 46 deletions
diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c
index de0863b1a3..9ff9c9a2d2 100755
--- a/apps/plugins/bubbles.c
+++ b/apps/plugins/bubbles.c
@@ -41,9 +41,9 @@ PLUGIN_HEADER
41/* play board dimension */ 41/* play board dimension */
42#define BB_HEIGHT 12 42#define BB_HEIGHT 12
43#define BB_WIDTH 8 43#define BB_WIDTH 8
44#define BB_LEVEL_HEIGHT BB_HEIGHT-2 44#define BB_LEVEL_HEIGHT 10
45 45
46/* various amount */ 46/* various amounts */
47#define NUM_SCORES 10 47#define NUM_SCORES 10
48#define NUM_LEVELS 100 48#define NUM_LEVELS 100
49#define NUM_QUEUE 2 49#define NUM_QUEUE 2
@@ -105,7 +105,7 @@ PLUGIN_HEADER
105#define EMBLEM_SZ 16 105#define EMBLEM_SZ 16
106#define XOFS 72 106#define XOFS 72
107#define ROW_HEIGHT 18 107#define ROW_HEIGHT 18
108#define ROW_INDENT 13 108#define ROW_INDENT 11
109#define MAX_FPS 40 109#define MAX_FPS 40
110 110
111/* 16x16 bubbles (H300, iPod Color) */ 111/* 16x16 bubbles (H300, iPod Color) */
@@ -1173,12 +1173,14 @@ char level[NUM_LEVELS][BB_LEVEL_HEIGHT][BB_WIDTH] = {
1173/* the tile struct 1173/* the tile struct
1174 * type is the bubble number 0-7 1174 * type is the bubble number 0-7
1175 * fallx is the x axis movement for the falling bubble 1175 * fallx is the x axis movement for the falling bubble
1176 * fallvel is the initial upward velocity for the falling bubble
1176 * ingroup denotes a bubble that is part of a group to be removed 1177 * ingroup denotes a bubble that is part of a group to be removed
1177 * anchored denotes a bubble that is anchored to the ceiling 1178 * anchored denotes a bubble that is anchored to the ceiling
1178 */ 1179 */
1179struct tile { 1180struct tile {
1180 int type; 1181 int type;
1181 int fallx; 1182 int fallx;
1183 int fallvel;
1182 bool ingroup; 1184 bool ingroup;
1183 bool anchored; 1185 bool anchored;
1184 bool delete; 1186 bool delete;
@@ -1207,6 +1209,7 @@ struct highscore {
1207 * queue is the circular buffer of bubbles to be fired 1209 * queue is the circular buffer of bubbles to be fired
1208 * elapsedlvl is level elapsed time in 1/100s of seconds 1210 * elapsedlvl is level elapsed time in 1/100s of seconds
1209 * elapsedshot is the shot elapsed time in 1/100s of seconds 1211 * elapsedshot is the shot elapsed time in 1/100s of seconds
1212 * startedshot is when the current shot began
1210 * resume denotes whether to resume the currently loaded game 1213 * resume denotes whether to resume the currently loaded game
1211 * dirty denotes whether the high scores are out of sync with the saved file 1214 * dirty denotes whether the high scores are out of sync with the saved file
1212 * playboard is the game playing board 1215 * playboard is the game playing board
@@ -1225,6 +1228,7 @@ struct game_context {
1225 int queue[NUM_QUEUE]; 1228 int queue[NUM_QUEUE];
1226 long elapsedlvl; 1229 long elapsedlvl;
1227 long elapsedshot; 1230 long elapsedshot;
1231 long startedshot;
1228 bool resume; 1232 bool resume;
1229 bool dirty; 1233 bool dirty;
1230 struct tile playboard[BB_HEIGHT][BB_WIDTH]; 1234 struct tile playboard[BB_HEIGHT][BB_WIDTH];
@@ -1314,7 +1318,8 @@ static bool bubbles_loadgame(struct game_context* bb);
1314static void bubbles_savegame(struct game_context* bb); 1318static void bubbles_savegame(struct game_context* bb);
1315static void bubbles_setcolors(void); 1319static void bubbles_setcolors(void);
1316static void bubbles_callback(void* param); 1320static void bubbles_callback(void* param);
1317static int bubbles_handlebuttons(struct game_context* bb, bool animblock); 1321static int bubbles_handlebuttons(struct game_context* bb, bool animblock,
1322 int timeout);
1318static int bubbles(struct game_context* bb); 1323static int bubbles(struct game_context* bb);
1319 1324
1320/***************************************************************************** 1325/*****************************************************************************
@@ -1469,10 +1474,10 @@ static void bubbles_drawboard(struct game_context* bb) {
1469 1474
1470 /* display bubble to be shot */ 1475 /* display bubble to be shot */
1471 rb->lcd_bitmap_part(bubbles_emblem, 1476 rb->lcd_bitmap_part(bubbles_emblem,
1472 0, EMBLEM_SZ*bb->queue[bb->nextinq], EMBLEM_SZ, 1477 0, EMBLEM_SZ*bb->queue[bb->nextinq], EMBLEM_SZ,
1473 SHOTX+(BUBBLE_SZ-EMBLEM_SZ)/2, 1478 SHOTX+(BUBBLE_SZ-EMBLEM_SZ)/2,
1474 SHOTY+(BUBBLE_SZ-EMBLEM_SZ)/2, 1479 SHOTY+(BUBBLE_SZ-EMBLEM_SZ)/2,
1475 EMBLEM_SZ, EMBLEM_SZ); 1480 EMBLEM_SZ, EMBLEM_SZ);
1476 rb->lcd_set_drawmode(DRMODE_FG); 1481 rb->lcd_set_drawmode(DRMODE_FG);
1477 rb->lcd_mono_bitmap((const unsigned char *)bubbles_bubble, 1482 rb->lcd_mono_bitmap((const unsigned char *)bubbles_bubble,
1478 SHOTX, SHOTY, 1483 SHOTX, SHOTY,
@@ -1481,10 +1486,10 @@ static void bubbles_drawboard(struct game_context* bb) {
1481 1486
1482 /* display next bubble to be shot */ 1487 /* display next bubble to be shot */
1483 rb->lcd_bitmap_part(bubbles_emblem, 1488 rb->lcd_bitmap_part(bubbles_emblem,
1484 0, EMBLEM_SZ*bb->queue[(bb->nextinq+1)%NUM_QUEUE], EMBLEM_SZ, 1489 0, EMBLEM_SZ*bb->queue[(bb->nextinq+1)%NUM_QUEUE], EMBLEM_SZ,
1485 XOFS/2-BUBBLE_SZ/2+(BUBBLE_SZ-EMBLEM_SZ)/2, 1490 XOFS/2-BUBBLE_SZ/2+(BUBBLE_SZ-EMBLEM_SZ)/2,
1486 SHOTY+(BUBBLE_SZ-EMBLEM_SZ)/2, 1491 SHOTY+(BUBBLE_SZ-EMBLEM_SZ)/2,
1487 EMBLEM_SZ, EMBLEM_SZ); 1492 EMBLEM_SZ, EMBLEM_SZ);
1488 rb->lcd_set_drawmode(DRMODE_FG); 1493 rb->lcd_set_drawmode(DRMODE_FG);
1489 rb->lcd_mono_bitmap((const unsigned char *)bubbles_bubble, 1494 rb->lcd_mono_bitmap((const unsigned char *)bubbles_bubble,
1490 XOFS/2-BUBBLE_SZ/2, SHOTY, 1495 XOFS/2-BUBBLE_SZ/2, SHOTY,
@@ -1579,7 +1584,8 @@ static int bubbles_fire(struct game_context* bb) {
1579 shotxofs += 2*((XOFS<<10)-(((SHOTX)<<10)+shotxofs)); 1584 shotxofs += 2*((XOFS<<10)-(((SHOTX)<<10)+shotxofs));
1580 shotxdirec *= -1; 1585 shotxdirec *= -1;
1581 } else if(SHOTX+(shotxofs>>10) > XOFS+(BB_WIDTH-1)*BUBBLE_SZ) { 1586 } else if(SHOTX+(shotxofs>>10) > XOFS+(BB_WIDTH-1)*BUBBLE_SZ) {
1582 shotxofs -= 2*((((SHOTX)<<10)+shotxofs)-((XOFS<<10)+(((BB_WIDTH-1)*BUBBLE_SZ)<<10))); 1587 shotxofs -= 2*((((SHOTX)<<10)+shotxofs)-
1588 ((XOFS<<10)+(((BB_WIDTH-1)*BUBBLE_SZ)<<10)));
1583 shotxdirec *= -1; 1589 shotxdirec *= -1;
1584 } 1590 }
1585 1591
@@ -1640,7 +1646,7 @@ static int bubbles_fire(struct game_context* bb) {
1640 } 1646 }
1641 1647
1642 /* handle button events */ 1648 /* handle button events */
1643 buttonres = bubbles_handlebuttons(bb, true); 1649 buttonres = bubbles_handlebuttons(bb, true, 0);
1644 if(buttonres != BB_NONE) return buttonres; 1650 if(buttonres != BB_NONE) return buttonres;
1645 1651
1646 /* framerate limiting */ 1652 /* framerate limiting */
@@ -1693,7 +1699,8 @@ static bool bubbles_collision(struct game_context* bb, int y, int x,
1693 if(nearcol-1+adj >= 0) { 1699 if(nearcol-1+adj >= 0) {
1694 if(nearrow-1 >= 0) { 1700 if(nearrow-1 >= 0) {
1695 if(bb->playboard[nearrow-1][nearcol-1+adj].type >= 0) { 1701 if(bb->playboard[nearrow-1][nearcol-1+adj].type >= 0) {
1696 nx = XOFS+((nearrow-1)%2 ? ROW_INDENT : 0)+BUBBLE_SZ*(nearcol-1+adj); 1702 nx = XOFS+((nearrow-1)%2 ? ROW_INDENT : 0)+
1703 BUBBLE_SZ*(nearcol-1+adj);
1697 ny = ROW_HEIGHT*(nearrow-1)+bb->compress*ROW_HEIGHT; 1704 ny = ROW_HEIGHT*(nearrow-1)+bb->compress*ROW_HEIGHT;
1698 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;
1699 } 1706 }
@@ -1701,7 +1708,8 @@ static bool bubbles_collision(struct game_context* bb, int y, int x,
1701 1708
1702 if(nearrow+1 < BB_HEIGHT) { 1709 if(nearrow+1 < BB_HEIGHT) {
1703 if(bb->playboard[nearrow+1][nearcol-1+adj].type >= 0) { 1710 if(bb->playboard[nearrow+1][nearcol-1+adj].type >= 0) {
1704 nx = XOFS+((nearrow+1)%2 ? ROW_INDENT : 0)+BUBBLE_SZ*(nearcol-1+adj); 1711 nx = XOFS+((nearrow+1)%2 ? ROW_INDENT : 0)+
1712 BUBBLE_SZ*(nearcol-1+adj);
1705 ny = ROW_HEIGHT*(nearrow+1)+bb->compress*ROW_HEIGHT; 1713 ny = ROW_HEIGHT*(nearrow+1)+bb->compress*ROW_HEIGHT;
1706 if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; 1714 if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true;
1707 } 1715 }
@@ -1711,7 +1719,8 @@ static bool bubbles_collision(struct game_context* bb, int y, int x,
1711 if(nearcol+adj >= 0) { 1719 if(nearcol+adj >= 0) {
1712 if(nearrow-1 >= 0) { 1720 if(nearrow-1 >= 0) {
1713 if(bb->playboard[nearrow-1][nearcol+adj].type >= 0) { 1721 if(bb->playboard[nearrow-1][nearcol+adj].type >= 0) {
1714 nx = XOFS+((nearrow-1)%2 ? ROW_INDENT : 0)+BUBBLE_SZ*(nearcol+adj); 1722 nx = XOFS+((nearrow-1)%2 ? ROW_INDENT : 0)+
1723 BUBBLE_SZ*(nearcol+adj);
1715 ny = ROW_HEIGHT*(nearrow-1)+bb->compress*ROW_HEIGHT; 1724 ny = ROW_HEIGHT*(nearrow-1)+bb->compress*ROW_HEIGHT;
1716 if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; 1725 if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true;
1717 } 1726 }
@@ -1719,7 +1728,8 @@ static bool bubbles_collision(struct game_context* bb, int y, int x,
1719 1728
1720 if(nearrow+1 < BB_HEIGHT) { 1729 if(nearrow+1 < BB_HEIGHT) {
1721 if(bb->playboard[nearrow+1][nearcol+adj].type >= 0) { 1730 if(bb->playboard[nearrow+1][nearcol+adj].type >= 0) {
1722 nx = XOFS+((nearrow+1)%2 ? ROW_INDENT : 0)+BUBBLE_SZ*(nearcol+adj); 1731 nx = XOFS+((nearrow+1)%2 ? ROW_INDENT : 0)+
1732 BUBBLE_SZ*(nearcol+adj);
1723 ny = ROW_HEIGHT*(nearrow+1)+bb->compress*ROW_HEIGHT; 1733 ny = ROW_HEIGHT*(nearrow+1)+bb->compress*ROW_HEIGHT;
1724 if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true; 1734 if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true;
1725 } 1735 }
@@ -1874,7 +1884,7 @@ static int bubbles_remove(struct game_context* bb) {
1874 for(i=0; i<BB_HEIGHT; i++) { 1884 for(i=0; i<BB_HEIGHT; i++) {
1875 for(j=0; j<BB_WIDTH; j++) { 1885 for(j=0; j<BB_WIDTH; j++) {
1876 if(bb->playboard[i][j].type >= 0 && 1886 if(bb->playboard[i][j].type >= 0 &&
1877 (!bb->playboard[i][j].anchored || bb->playboard[i][j].ingroup)) { 1887 (!bb->playboard[i][j].anchored || bb->playboard[i][j].ingroup)) {
1878 bb->playboard[i][j].delete = true; 1888 bb->playboard[i][j].delete = true;
1879 } 1889 }
1880 } 1890 }
@@ -2018,6 +2028,7 @@ static int bubbles_fall(struct game_context* bb) {
2018 for(j=0; j<BB_WIDTH; j++) { 2028 for(j=0; j<BB_WIDTH; j++) {
2019 if(bb->playboard[i][j].delete) { 2029 if(bb->playboard[i][j].delete) {
2020 bb->playboard[i][j].fallx = rb->rand()%25 - 12; 2030 bb->playboard[i][j].fallx = rb->rand()%25 - 12;
2031 bb->playboard[i][j].fallvel = rb->rand()%5 + 6;
2021 } 2032 }
2022 } 2033 }
2023 } 2034 }
@@ -2036,23 +2047,27 @@ static int bubbles_fall(struct game_context* bb) {
2036 if(bb->playboard[i][j].delete) { 2047 if(bb->playboard[i][j].delete) {
2037 indent = (i%2 ? ROW_INDENT : 0); 2048 indent = (i%2 ? ROW_INDENT : 0);
2038 xofs = ((bb->playboard[i][j].fallx*count)*BUBBLE_SZ)/48; 2049 xofs = ((bb->playboard[i][j].fallx*count)*BUBBLE_SZ)/48;
2039 yofs = ((count*count - 8*count)*BUBBLE_SZ)/20; 2050 yofs = ((count*count - bb->playboard[i][j].fallvel*count)*
2051 BUBBLE_SZ)/20;
2040 2052
2041 /* draw bubble if it is still on the screen */ 2053 /* draw bubble if it is still on the screen */
2042 if(ROW_HEIGHT*i+bb->compress*ROW_HEIGHT+yofs <= LCD_HEIGHT) { 2054 if(ROW_HEIGHT*i+bb->compress*ROW_HEIGHT+yofs
2055 <= LCD_HEIGHT) {
2043 onscreen = true; 2056 onscreen = true;
2044 2057
2045 rb->lcd_bitmap_part(bubbles_emblem, 2058 rb->lcd_bitmap_part(bubbles_emblem, 0,
2046 0, EMBLEM_SZ*bb->playboard[i][j].type, EMBLEM_SZ, 2059 EMBLEM_SZ*bb->playboard[i][j].type, EMBLEM_SZ,
2047 XOFS+indent+BUBBLE_SZ*j+(BUBBLE_SZ-EMBLEM_SZ)/2+xofs, 2060 XOFS+indent+BUBBLE_SZ*j+
2048 ROW_HEIGHT*i+(BUBBLE_SZ-EMBLEM_SZ)/2+bb->compress*ROW_HEIGHT+yofs, 2061 (BUBBLE_SZ-EMBLEM_SZ)/2+xofs,
2049 EMBLEM_SZ, EMBLEM_SZ); 2062 ROW_HEIGHT*i+(BUBBLE_SZ-EMBLEM_SZ)/2+
2063 bb->compress*ROW_HEIGHT+yofs,
2064 EMBLEM_SZ, EMBLEM_SZ);
2050 rb->lcd_set_drawmode(DRMODE_FG); 2065 rb->lcd_set_drawmode(DRMODE_FG);
2051 rb->lcd_mono_bitmap( 2066 rb->lcd_mono_bitmap(
2052 (const unsigned char *)bubbles_bubble, 2067 (const unsigned char *)bubbles_bubble,
2053 XOFS+indent+BUBBLE_SZ*j+xofs, 2068 XOFS+indent+BUBBLE_SZ*j+xofs,
2054 ROW_HEIGHT*i+bb->compress*ROW_HEIGHT+yofs, 2069 ROW_HEIGHT*i+bb->compress*ROW_HEIGHT+yofs,
2055 BUBBLE_SZ, BUBBLE_SZ); 2070 BUBBLE_SZ, BUBBLE_SZ);
2056 rb->lcd_set_drawmode(DRMODE_SOLID); 2071 rb->lcd_set_drawmode(DRMODE_SOLID);
2057 } 2072 }
2058 } 2073 }
@@ -2065,7 +2080,7 @@ static int bubbles_fall(struct game_context* bb) {
2065 if(!onscreen) break; 2080 if(!onscreen) break;
2066 2081
2067 /* handle button events */ 2082 /* handle button events */
2068 buttonres = bubbles_handlebuttons(bb, true); 2083 buttonres = bubbles_handlebuttons(bb, true, 0);
2069 if(buttonres != BB_NONE) return buttonres; 2084 if(buttonres != BB_NONE) return buttonres;
2070 2085
2071 /* framerate limiting */ 2086 /* framerate limiting */
@@ -2290,11 +2305,12 @@ static void bubbles_callback(void* param) {
2290/***************************************************************************** 2305/*****************************************************************************
2291* bubbles_handlebuttons() handles button events during a game. 2306* bubbles_handlebuttons() handles button events during a game.
2292******************************************************************************/ 2307******************************************************************************/
2293static int bubbles_handlebuttons(struct game_context* bb, bool animblock) { 2308static int bubbles_handlebuttons(struct game_context* bb, bool animblock,
2309 int timeout) {
2294 int button; 2310 int button;
2295 int buttonres; 2311 int buttonres;
2296 2312
2297 button = rb->button_get(false); 2313 button = rb->button_get_w_tmo(timeout);
2298 switch(button){ 2314 switch(button){
2299 case (BUBBLES_LEFT|BUTTON_REPEAT): 2315 case (BUBBLES_LEFT|BUTTON_REPEAT):
2300 if(bb->angle > MIN_ANGLE) bb->angle -= 4; 2316 if(bb->angle > MIN_ANGLE) bb->angle -= 4;
@@ -2310,11 +2326,13 @@ static int bubbles_handlebuttons(struct game_context* bb, bool animblock) {
2310 2326
2311 case BUBBLES_SELECT: /* fire the shot */ 2327 case BUBBLES_SELECT: /* fire the shot */
2312 if(!animblock) { 2328 if(!animblock) {
2329 bb->elapsedlvl += bb->elapsedshot;
2313 bb->elapsedshot = 0; 2330 bb->elapsedshot = 0;
2314 buttonres = bubbles_fire(bb); 2331 buttonres = bubbles_fire(bb);
2315 if(buttonres != BB_NONE) return buttonres; 2332 if(buttonres != BB_NONE) return buttonres;
2316 buttonres = bubbles_checklevel(bb); 2333 buttonres = bubbles_checklevel(bb);
2317 if(buttonres != BB_NONE) return buttonres; 2334 if(buttonres != BB_NONE) return buttonres;
2335 bb->startedshot = *rb->current_tick;
2318 } 2336 }
2319 break; 2337 break;
2320 2338
@@ -2361,7 +2379,7 @@ static int bubbles(struct game_context* bb) {
2361 char *title = "Bubbles"; 2379 char *title = "Bubbles";
2362 bool startgame = false; 2380 bool startgame = false;
2363 bool showscores = false; 2381 bool showscores = false;
2364 long lasttick, currenttick; 2382 long timeout;
2365 2383
2366 bubbles_setcolors(); 2384 bubbles_setcolors();
2367 2385
@@ -2412,7 +2430,8 @@ static int bubbles(struct game_context* bb) {
2412 rb->lcd_puts(0, 7, "LEFT/RIGHT to aim"); 2430 rb->lcd_puts(0, 7, "LEFT/RIGHT to aim");
2413 rb->lcd_puts(0, 8, "UP/DOWN to change level"); 2431 rb->lcd_puts(0, 8, "UP/DOWN to change level");
2414#endif 2432#endif
2415 rb->snprintf(str, 28, "Start on level %d of %d", startlevel+1, bb->highlevel+1); 2433 rb->snprintf(str, 28, "Start on level %d of %d", startlevel+1,
2434 bb->highlevel+1);
2416 rb->lcd_puts(0, 10, str); 2435 rb->lcd_puts(0, 10, str);
2417 rb->lcd_puts(0, 12, "High Score:"); 2436 rb->lcd_puts(0, 12, "High Score:");
2418 rb->snprintf(str, 30, "%d, Lvl %d", 2437 rb->snprintf(str, 30, "%d, Lvl %d",
@@ -2496,35 +2515,38 @@ static int bubbles(struct game_context* bb) {
2496 /********************** 2515 /**********************
2497 * play * 2516 * play *
2498 **********************/ 2517 **********************/
2499 lasttick = *rb->current_tick; 2518 bb->startedshot = *rb->current_tick;
2500 2519
2501 while(true) { 2520 while(true) {
2502 /* refresh the board */ 2521 /* refresh the board */
2503 bubbles_drawboard(bb); 2522 bubbles_drawboard(bb);
2504 rb->lcd_update(); 2523 rb->lcd_update();
2505 2524
2525 /* manange idle framerate */
2526 bb->elapsedshot = *rb->current_tick-bb->startedshot;
2527
2528 if(MAX_SHOTTIME-bb->elapsedshot < HZ/2) {
2529 timeout = MAX_SHOTTIME-bb->elapsedshot;
2530 } else {
2531 timeout = HZ/2;
2532 }
2533
2506 /* handle button events */ 2534 /* handle button events */
2507 buttonres = bubbles_handlebuttons(bb, false); 2535 buttonres = bubbles_handlebuttons(bb, false, timeout);
2508 if(buttonres != BB_NONE) return buttonres; 2536 if(buttonres != BB_NONE) return buttonres;
2509 2537
2510 /* handle timing */ 2538 /* handle timing */
2511 bb->elapsedlvl += (HZ*3)/(MAX_FPS*4); 2539 bb->elapsedshot = *rb->current_tick-bb->startedshot;
2512 bb->elapsedshot += (HZ*3)/(MAX_FPS*4);
2513 2540
2514 if(bb->elapsedshot > MAX_SHOTTIME) { 2541 if(bb->elapsedshot > MAX_SHOTTIME) {
2542 bb->elapsedlvl += bb->elapsedshot;
2515 bb->elapsedshot = 0; 2543 bb->elapsedshot = 0;
2516 buttonres = bubbles_fire(bb); 2544 buttonres = bubbles_fire(bb);
2517 if(buttonres != BB_NONE) return buttonres; 2545 if(buttonres != BB_NONE) return buttonres;
2518 buttonres = bubbles_checklevel(bb); 2546 buttonres = bubbles_checklevel(bb);
2519 if(buttonres != BB_NONE) return buttonres; 2547 if(buttonres != BB_NONE) return buttonres;
2548 bb->startedshot = *rb->current_tick;
2520 } 2549 }
2521
2522 /* framerate limiting */
2523 currenttick = *rb->current_tick;
2524 if(currenttick-lasttick < HZ/MAX_FPS) {
2525 rb->sleep((HZ/MAX_FPS)-(currenttick-lasttick));
2526 }
2527 lasttick = currenttick;
2528 } 2550 }
2529} 2551}
2530 2552