diff --git a/scripts/songselect/songwheel.lua b/scripts/songselect/songwheel.lua index bd6157b..2dff4a4 100644 --- a/scripts/songselect/songwheel.lua +++ b/scripts/songselect/songwheel.lua @@ -29,6 +29,33 @@ local badgeImages = { gfx.CreateSkinImage("song_select/medal/puc.png", 1), } +local gradeCutoffs = { + D = 0000000, + C = 7000000, + B = 8000000, + A = 8700000, + A_P = 9000000, + AA = 9300000, + AA_P = 9500000, + AAA = 9700000, + AAA_P = 9800000, + S = 9900000, +} + +local gradeImages = { + S = gfx.CreateSkinImage("common/grades/S.png", 0), + AAA_P = gfx.CreateSkinImage("common/grades/AAA+.png", 0), + AAA = gfx.CreateSkinImage("common/grades/AAA.png", 0), + AA_P = gfx.CreateSkinImage("common/grades/AA+.png", 0), + AA = gfx.CreateSkinImage("common/grades/AA.png", 0), + A_P = gfx.CreateSkinImage("common/grades/A+.png", 0), + A = gfx.CreateSkinImage("common/grades/A.png", 0), + B = gfx.CreateSkinImage("common/grades/B.png", 0), + C = gfx.CreateSkinImage("common/grades/C.png", 0), + D = gfx.CreateSkinImage("common/grades/D.png", 0), + none = gfx.CreateSkinImage("common/grades/none.png", 0), +} + game.LoadSkinSample('song_wheel/cursor_change.wav'); local difficultyNumbers; @@ -109,6 +136,21 @@ function getJacketImage(song) return jacketCache[song.id]; end +function getGradeImageForScore(score) + local gradeImage = gradeImages.none; + local bestGradeCutoff = 0; + for gradeName, scoreCutoff in pairs(gradeCutoffs) do + if scoreCutoff <= score then + if scoreCutoff > bestGradeCutoff then + gradeImage = gradeImages[gradeName]; + bestGradeCutoff = scoreCutoff; + end + end + end + + return gradeImage; +end + function drawBackground() gfx.BeginPath() gfx.ImageRect(0, 0, desw, desh, backgroundImage, 1, 0) @@ -117,7 +159,15 @@ end function drawSong(song, y) local songX = desw/2+28 local selectedSongDifficulty = song.difficulties[selectedDifficulty] - local bestScore = selectedSongDifficulty.scores[1] or nil; + + if not selectedSongDifficulty then + return; + end + + local bestScore; + if selectedSongDifficulty.scores then + bestScore = selectedSongDifficulty.scores[1]; + end -- Draw the bg for the song plate gfx.BeginPath() @@ -150,10 +200,18 @@ function drawSong(song, y) if bestScore then badgeImage = badgeImages[bestScore.badge+1]; end - - gfx.BeginPath() gfx.ImageRect(songX+282, y+44, 79, 69, badgeImage, 1, 0) + + -- Draw grade + local gradeImage = gradeImages.none; + if bestScore then + gradeImage = getGradeImageForScore(bestScore.score) + end + + gfx.BeginPath(); + gfx.ImageRect(songX+390, y+47, 60, 60, gradeImage, 1, 0); + end function drawSongList() diff --git a/textures/common/grades/none.png b/textures/common/grades/none.png new file mode 100644 index 0000000..00ddb47 Binary files /dev/null and b/textures/common/grades/none.png differ diff --git a/textures/gameplay/gauges/effective/gauge_back.png b/textures/gameplay/gauges/effective/gauge_back.png index 1043588..4eb48ff 100644 Binary files a/textures/gameplay/gauges/effective/gauge_back.png and b/textures/gameplay/gauges/effective/gauge_back.png differ diff --git a/textures/gameplay/gauges/excessive/gauge_back.png b/textures/gameplay/gauges/excessive/gauge_back.png index c2eaf91..f2772e1 100644 Binary files a/textures/gameplay/gauges/excessive/gauge_back.png and b/textures/gameplay/gauges/excessive/gauge_back.png differ diff --git a/textures/gameplay/gauges/excessive_ars/gauge_back.png b/textures/gameplay/gauges/excessive_ars/gauge_back.png index 8110815..39f5e26 100644 Binary files a/textures/gameplay/gauges/excessive_ars/gauge_back.png and b/textures/gameplay/gauges/excessive_ars/gauge_back.png differ diff --git a/textures/gameplay/gauges/permissive/gauge_back.png b/textures/gameplay/gauges/permissive/gauge_back.png index fea0b4c..a6e3e4f 100644 Binary files a/textures/gameplay/gauges/permissive/gauge_back.png and b/textures/gameplay/gauges/permissive/gauge_back.png differ