+ grades to song plates

This commit is contained in:
FajsiEx 2021-07-31 18:43:17 +02:00
parent 683e72c52e
commit d9012021ef
6 changed files with 61 additions and 3 deletions

View File

@ -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()

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 19 KiB