--vmp3 by mrafenne



mov1 = 0
mov2 = 0

star1=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star1.png")
star2=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star2.png")
star3=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star3.png")
star4=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star4.png")
star5=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star5.png")
star6=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star6.png")
star7=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star7.png")
star8=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star8.png")
--star9=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star9.png")
--star10=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star10.png")
--star11=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star11.png")
--star12=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star12.png")
--star13=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star13.png")
--star14=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star14.png")
--star15=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star15.png")
--star16=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star16.png")
--star17=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star17.png")
--star19=Image.load("ms0:/PSP/GAME/vmp3 v1/images/star19.png")
flocon = {}
for a = 0,20 do
flocon[a] = {x = math.random(0,480),y = 0}
end
for b = 20,40 do
flocon[b] = {x = math.random(0,480),y = -20}
end
for c = 40,60 do
flocon[c] = {x = math.random(0,480),y = -40}
end
for d = 60,80 do
flocon[d] = {x = math.random(0,480),y = -60}
end
for d = 80,100 do
flocon[d] = {x = math.random(0,480),y = -80}
end
for e = 100,120 do
flocon[e] = {x = math.random(0,480),y = -100}
end
for e = 120,140 do
flocon[e] = {x = math.random(0,480),y = -120}
end
for f = 140,160 do
flocon[f] = {x = math.random(0,480),y = -140}
end
for g = 160,180 do
flocon[g] = {x = math.random(0,480),y = -160}
end
for g = 180,200 do
flocon[g] = {x = math.random(0,480),y = -180}
end
for h = 200,220 do
flocon[h] = {x = math.random(0,480),y = -200}
end
for i = 220,240 do
flocon[i] = {x = math.random(0,480),y = -220}
end


function nomvis1()
mov2 = 0
if preiw == "fasle" and next == "fasle" then
if mov1 <= 251 and mov1 >= 0 then
mov1 = mov1 +8
end
end
end


statut = "defaut"

function exitMenu()
star1 = nil
star2 = nil
star3 = nil
star4 = nil
star5 = nil
star6 = nil
star7 = nil
star8 = nil
mov1 = nil
mov2 = nil
collectgarbage()
end


statut = "defaut"

while true do
screen:clear()

if pad:circle() then
statut = "affiche"
end

if statut == "affiche" then
nomvis1() 
screen:fillRect(40,mov1,400,1,white)
screen:fillRect(40,mov1,Mp3me.percent()*4,1,green)
screen:fontPrint(font,mov1+120,253,Mp3me.gettime(),green)
screen:fontPrint(font,mov1+120,270,Mp3me.songTime(),white)
screen:fontPrint(font,mov1-215,253,Mp3me.title(),white)
screen:fontPrint(font,mov1-215,270,Mp3me.album(),white)


end
if pad:square() then
statut = "defaut"
end

  if Mp3me.vis(0) <= 130 then
   star = star1
   end
      if Mp3me.vis(0) <= 120 then
   star = star2
   end
      if Mp3me.vis(0) <= 100 then
   star = star3
   end
      if Mp3me.vis(0) <= 90 then
   star = star4
   end
      if Mp3me.vis(0) <= 80 then
   star = star5
   end
      if Mp3me.vis(0) <= 70 then
   star = star6
   end
    if Mp3me.vis(0) <= 60 then
   star = star7
   end
    if Mp3me.vis(0) <= 50 then
   star = star8
   end

for a = 0,240 do
flocon[a].y = flocon[a].y +5+math.random(0,2)
if flocon[a].y >=235 then
flocon[a].y = 0
end
screen:blit(flocon[a].x,flocon[a].y,star)
end

pad = Controls.read()

if pad:r() and not oldpad:r() then
if fbrowser.s < (fbrowser.nf + 1) then
i = fbrowser.s + 1
if i < (fbrowser.nf + 1) then
if string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".mp3" or
string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".MP3" then
fbrowser.s = fbrowser.s + 1
Mp3me.stop()
screen:clear()
Mp3me.load(fbrowser.fl[fbrowser.s].name)
Mp3me.play()
end
end
end
end

if pad:l() and not oldpad:l() then
if fbrowser.s < (fbrowser.nf + 1) and fbrowser.s > 2 then
i = fbrowser.s - 1
if i < (fbrowser.nf + 1) and i > 2 then
if string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".mp3" or
string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".MP3" then
Mp3me.stop()
screen:clear()
fbrowser.s = fbrowser.s - 1
Mp3me.load(fbrowser.fl[fbrowser.s].name)
Mp3me.play()
end
end
end
end

if pad:cross() and not oldpad:cross() then
Mp3me.pause()
end

if pad:left() then
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/Ibis/vmp315.lua")
exitMenu()
end

if pad:right() then
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/Ibis/vmp317.lua")
exitMenu()
end

if pad:triangle() then
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/menu.lua")
exitMenu()
end


if pad:start() then 
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/script1.lua")
exitMenu()
end


screen.waitVblankStart()
screen.flip()
oldpad = pad
end


