void LISTfree( Linked_List list ) { Link p, q = list->mark->next; for( p = q->next; p != list->mark; q = p, p = p->next ) { LINK_destroy( q ); } if( q != list->mark ) { LINK_destroy( q ); } LINK_destroy( list->mark ); LIST_destroy( list ); }
void sub_music_draw(SDL_Surface * screen) { if (music_stage == 1) /* move left */ { if (!music_xmb_offset_tx) { music_xmb_offset_ox = music_xmb_offset_x; music_xmb_offset_tx = -LIST_columnWidth(); } music_xmb_offset_x -= rint(LIST_columnWidth() / ((float) (XMBMOVEDELAY)) * (SDL_GetTicks() - music_animtimer)); } else if (music_stage == 2) /* move right */ { if (!music_xmb_offset_tx) { music_xmb_offset_ox = music_xmb_offset_x; music_xmb_offset_tx = LIST_columnWidth(); } music_xmb_offset_x += rint(LIST_columnWidth() / ((float) (XMBMOVEDELAY)) * (SDL_GetTicks() - music_animtimer)); } else if (music_stage == 3) /* move left (inital) */ { if (!music_xmb_offset_tx) { music_xmb_offset_ox = music_xmb_offset_x; music_xmb_offset_tx = -LIST_columnWidth(); } music_xmb_offset_x -= rint(LIST_columnWidth() / ((float) (XMBMOVEDELAY)) * (SDL_GetTicks() - music_animtimer)); } else if (music_stage == 4) /* move right (final) */ { if (!music_xmb_offset_tx) { music_xmb_offset_ox = music_xmb_offset_x; music_xmb_offset_tx = LIST_columnWidth(); } music_xmb_offset_x += rint(LIST_columnWidth() / ((float) (XMBMOVEDELAY)) * (SDL_GetTicks() - music_animtimer)); } else if (music_stage == 5) { music_stage++; } else if (music_stage == 6) { sub_music_browse(); music_stage = 0; } if (SDL_GetTicks() - music_animtimer_b > XMBMOVEDELAY && music_stage) { if (music_stage == 1 || music_stage == 3) { LIST_setEmptyMsg("Please Wait..."); music_stage = 5; } if (music_stage == 4 && music_levels == -1) { music_xmb_offset_x = 0; LIST_destroy(); sub_music_destroy(); submenu = NULL; sub_music_playing = 0; return; } if (music_stage <= 5) { music_xmb_offset_x = music_xmb_offset_ox + music_xmb_offset_tx; music_xmb_offset_tx = 0; music_xmb_offset_ox = 0; } if (music_stage > 0 && music_stage < 5) music_stage = 0; } music_animtimer = SDL_GetTicks(); if (music_stage != MUS_FULLSCREEN) { if (music_stage != 3 && music_stage != 4) { LIST_draw(screen, (int) music_xmb_offset_x + ICONSCALE_X - 5, 0); } } else if (sub_music_playing) { tlistitem *sel; SDL_Rect wrect; char textstr[16]; int minutes = 0, seconds = 0, tmin = 0, tsec = 0; textstr[0] = '\0'; wrect.x = screen->w - 210; wrect.y = screen->h - 14; wrect.w = 200; wrect.h = 4; SDL_FillRect(screen, &wrect, SDL_MapRGB(screen->format, 255, 255, 255)); wrect.w *= mus_getpos() / (float) mus_getlength(); wrect.w = ceil(wrect.w); SDL_FillRect(screen, &wrect, SDL_MapRGB(screen->format, 0, 130, 180)); #ifdef TREMOR minutes = ((mus_getpos() / 1000) / 60); seconds = ((mus_getpos() / 1000) % 60); tmin = ((mus_getlength() / 1000) / 60); tsec = ((mus_getlength() / 1000) % 60); #else minutes = ((mus_getpos()) / 60); seconds = ((mus_getpos()) % 60); tmin = ((mus_getlength()) / 60); tsec = ((mus_getlength()) % 60); #endif sprintf(textstr, "%02i:%02i / %02i:%02i", minutes, seconds, tmin, tsec); gfx_draw_text(screen, font_monospace, 215, 210, USESHADOW, NOGLOW, textstr); sel = LIST_getSelected(); gfx_draw_image(sel->icon, 25, 102, screen); gfx_draw_text(screen, font_normal, 71, 100, USESHADOW, NOGLOW, sel->title); gfx_draw_text(screen, font_small, 71, 126, USESHADOW, NOGLOW, sel->subtitle); if (mus_eof()) { if (LIST_down()) { mus_stop(); while (!mus_ready()); sub_music_playsel(); } else { sub_music_handle_input(GP2X_BUTTON_B); } } } }