+ grades to song plates
|
@ -29,6 +29,33 @@ local badgeImages = {
|
||||||
gfx.CreateSkinImage("song_select/medal/puc.png", 1),
|
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');
|
game.LoadSkinSample('song_wheel/cursor_change.wav');
|
||||||
|
|
||||||
local difficultyNumbers;
|
local difficultyNumbers;
|
||||||
|
@ -109,6 +136,21 @@ function getJacketImage(song)
|
||||||
return jacketCache[song.id];
|
return jacketCache[song.id];
|
||||||
end
|
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()
|
function drawBackground()
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.ImageRect(0, 0, desw, desh, backgroundImage, 1, 0)
|
gfx.ImageRect(0, 0, desw, desh, backgroundImage, 1, 0)
|
||||||
|
@ -117,7 +159,15 @@ end
|
||||||
function drawSong(song, y)
|
function drawSong(song, y)
|
||||||
local songX = desw/2+28
|
local songX = desw/2+28
|
||||||
local selectedSongDifficulty = song.difficulties[selectedDifficulty]
|
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
|
-- Draw the bg for the song plate
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
|
@ -150,10 +200,18 @@ function drawSong(song, y)
|
||||||
if bestScore then
|
if bestScore then
|
||||||
badgeImage = badgeImages[bestScore.badge+1];
|
badgeImage = badgeImages[bestScore.badge+1];
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.ImageRect(songX+282, y+44, 79, 69, badgeImage, 1, 0)
|
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
|
end
|
||||||
|
|
||||||
function drawSongList()
|
function drawSongList()
|
||||||
|
|
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 19 KiB |