void highscore_add(int highscore_nn, char *name) { int i, j; HIGHSCORE hs; j = 0; for (i = 0; i < HIGHSCORE_CAP; i++) { if (highscore_table[i].score < highscore_table[j].score) j = i; } if (highscore_table[i].score >= score) return; highscore_table[j].score = highscore_nn; sprintf(highscore_table[j].name, "%s", name); for (i = 0; i < HIGHSCORE_CAP; i++) { for (j = i; j > 0 && highscore_table[j].score > highscore_table[j - 1].score; j--) { hs = highscore_table[j]; highscore_table[j] = highscore_table[j - 1]; highscore_table[j - 1] = hs; } } highscore_save(); return; }
void leave(){ timer_unsubscribe_int(); kb_unsubscribe_int(); mouse_unsubscribe_int(); empty_out_buf(); vg_exit(); highscore_save(); options_save(); exit(0); }
enum plugin_status plugin_start(const void* parameter) { (void)parameter; configfile_load(CONFIG_FILE_NAME, config, 1, 0); highscore_load(SCORE_FILE, highscores, NUM_SCORES); rb->lcd_clear_display(); ingame = false; while(snake_game_loop() == 0) ; configfile_save(CONFIG_FILE_NAME, config, 1, 0); highscore_save(SCORE_FILE, highscores, NUM_SCORES); return PLUGIN_OK; }
enum plugin_status plugin_start (const void *parameter) { (void) parameter; rb->srand (*rb->current_tick); /* Load HighScore if any */ highscore_load(SCORE_FILE, highscores, NUM_SCORES); #if LCD_DEPTH > 1 rb->lcd_set_backdrop(NULL); #endif #ifdef HAVE_LCD_BITMAP rb->lcd_setfont (FONT_SYSFIXED); #else if (!pgfx_init(4, 2)) { rb->splash(HZ*2, "Old LCD :("); return PLUGIN_OK; } #endif /* Turn off backlight timeout */ backlight_ignore_timeout(); load_game(); resume_file = resume; while(!rockblox_loop()) { if(!resume) { int position = highscore_update(rockblox_status.score, rockblox_status.level, "", highscores, NUM_SCORES); if (position != -1) { if (position == 0) rb->splash(HZ*2, "New High Score"); highscore_show(position, highscores, NUM_SCORES, true); } } } #ifndef HAVE_LCD_BITMAP pgfx_release(); #endif /* Save user's HighScore */ highscore_save(SCORE_FILE, highscores, NUM_SCORES); backlight_use_settings(); return PLUGIN_OK; }
enum plugin_status plugin_start(const void* parameter) { (void)(parameter); /* Lets use the default font */ rb->lcd_setfont(FONT_SYSFIXED); #if LCD_DEPTH > 1 rb->lcd_set_backdrop(NULL); #endif load_all_levels(); if (num_levels == 0) { rb->splash(HZ*2, "Failed loading levels!"); return PLUGIN_OK; } highscore_load(SCORE_FILE, highscores, NUM_SCORES); while(quit==0) { game_init(); if(quit) break; rb->lcd_clear_display(); frames=1; init_snake(); /*Start Game:*/ game(); } highscore_save(SCORE_FILE, highscores, NUM_SCORES); return (quit==1) ? PLUGIN_OK : PLUGIN_USB_CONNECTED; }
int main(int argc, char **argv) { //puzzletube setup srand(time(NULL)); settings_load(); highscore_load(); //Language setup spReadPossibleLanguages("./translations/languages.txt"); spBundlePointer translation = spLoadBundle("./translations/translations.txt",1); /* //counting all hashes: spTextPointer mom = translation->firstText; int mesh[257]; memset(mesh,0,257*4); int count = 0; while (mom) { if (mom->hash >= 0 && mom->hash < 256) { mesh[mom->hash]++; } else mesh[256]++; count++; mom = mom->next; } int i,j; for (i = 0; i < 16; i++) { for (j = 0; j < 16; j++) { printf(" %3i",mesh[i+j*16]); } printf("\n"); } printf("Invalid hash: %i\n",mesh[256]); printf("Total hash: %i\n",count);*/ settings_set_translation(translation); //sparrow3D Init //spSetDefaultWindowSize( 800, 480 ); spInitCore(); spInitNet(); spSetAffineTextureHack(0); //We don't need it :) spInitMath(); //Setup screen = spCreateDefaultWindow(); resize(screen->w,screen->h); run_splashscreen(resize); spSetCulling(0); init_music(); prepare_game_objects(1); change_music("Midnight Mediation","Nick May"); highscore_save(); init_c4a(); run_menu(resize); quit_c4a(); delete_game_objects(); spDeleteBundle(translation,0); spFontDelete(font); spFontDelete(small_font); spFontDelete(middle_font); quit_music(); spQuitNet(); spQuitCore(); return 0; }