/* try to add a new block to play with (return true if gameover) */ static void new_block (void) { rockblox_status.cy = 1; rockblox_status.cx = 5; rockblox_status.cf = rockblox_status.nf; rockblox_status.co = 0; /* start at the same orientation all time */ rockblox_status.nf = t_rand (BLOCKS_NUM); rockblox_status.gameover = !canMoveTo (rockblox_status.cx, rockblox_status.cy, rockblox_status.co); draw_next_block (); }
static void init_rockblox (bool resume) { char score_name[50]; struct tm* tm; tm = rb->get_time(); rb->snprintf(score_name, sizeof(score_name), "%04d%02d%02d %02d%02d%02d", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); #ifdef HAVE_LCD_BITMAP rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT); #else /* HAVE_LCD_CHARCELLS */ pgfx_display (0, 0); pgfx_display_block (3, 0, 3, 1); pgfx_display_block (4, 0, 3, 0); rb->lcd_puts(4, 1, " "); pgfx_clear_display(); pgfx_fillrect (3, 0, 2, 14); pgfx_fillrect (15, 7, 2, 7); pgfx_update(); #endif if (!resume) { rockblox_status.level = 1; rockblox_status.lines = 0; rockblox_status.score = 0; rockblox_status.nf = t_rand(BLOCKS_NUM); init_board (); new_block (); } draw_next_block(); show_details (); #ifdef HIGH_SCORE_Y show_highscores (); #endif }