Merge branch 'master' of github.com:FajsiEx/exceed

This commit is contained in:
Hersi 2021-11-20 20:27:32 +01:00
commit b25d92bf5c
3 changed files with 111 additions and 64 deletions

Binary file not shown.

View File

@ -86,11 +86,15 @@ local specialFolders = {
-- AUDIO -- AUDIO
game.LoadSkinSample('song_wheel/cursor_change.wav'); game.LoadSkinSample('song_wheel/cursor_change.wav');
game.LoadSkinSample('filter_wheel/open_close.wav');
local resx, resy = game.GetResolution() local resx, resy = game.GetResolution()
local desw, desh = 1080, 1920 local desw, desh = 1080, 1920
local scale = 1; local scale = 1;
local isFilterWheelActive = false;
local previousActiveState = false; -- for open/close sounds
local selectionMode = 'folders'; local selectionMode = 'folders';
local selectedFolder = 1; local selectedFolder = 1;
local selectedLevel = 1; local selectedLevel = 1;
@ -99,9 +103,9 @@ local transitionScrollScale = 0;
local transitionScrollOffsetY = 0; local transitionScrollOffsetY = 0;
local scrollingUp = false; local scrollingUp = false;
local transitionEnterReverse = false; local transitionLeaveScale = 1;
local transitionEnterScale = 0; local transitionLeaveReappearTimer = 0;
local transitionEnterOffsetY = 0; local TRANSITION_LEAVE_DURATION = 0.1;
function resetLayoutInformation() function resetLayoutInformation()
resx, resy = game.GetResolution() resx, resy = game.GetResolution()
@ -185,6 +189,8 @@ end
function drawFolder(label, y) function drawFolder(label, y)
if (not label) then return end if (not label) then return end
gfx.LoadSkinFont('NotoSans-Regular.ttf')
local x = desw / 2 + 0 local x = desw / 2 + 0
local folderData = getFolderData(label) local folderData = getFolderData(label)
@ -204,6 +210,8 @@ function drawFolder(label, y)
end end
function drawFolderList() function drawFolderList()
gfx.GlobalAlpha(1-transitionLeaveScale)
local numOfItemsAround = 7; local numOfItemsAround = 7;
local selectedIndex = 1; local selectedIndex = 1;
local folderList = filters.folder; local folderList = filters.folder;
@ -216,7 +224,7 @@ function drawFolderList()
folderList = filters.level; folderList = filters.level;
end end
yOffset = transitionEnterOffsetY + transitionScrollOffsetY; local yOffset = transitionScrollOffsetY;
local i = 1; local i = 1;
while (i <= numOfItemsAround) do while (i <= numOfItemsAround) do
@ -236,9 +244,13 @@ function drawFolderList()
desh / 2 - ITEM_HEIGHT / 2 + ITEM_HEIGHT * i + yOffset) desh / 2 - ITEM_HEIGHT / 2 + ITEM_HEIGHT * i + yOffset)
i = i + 1; i = i + 1;
end end
gfx.GlobalAlpha(1);
end end
function drawCursor() function drawCursor()
if not isFilterWheelActive or transitionLeaveScale ~= 0 then return end
gfx.BeginPath() gfx.BeginPath()
local cursorImageIndex = game.GetSkinSetting('_gaugeType') local cursorImageIndex = game.GetSkinSetting('_gaugeType')
@ -285,24 +297,26 @@ function tickTransitions(deltaTime)
-ITEM_HEIGHT; -ITEM_HEIGHT;
end end
-- ENTRY TRANSITION -- LEAVE TRANSITION
if transitionEnterReverse then if (not isFilterWheelActive) then
if transitionEnterScale > 0 then if transitionLeaveScale < 1 then
transitionEnterScale = transitionEnterScale - deltaTime / 0.5 -- transition should last for that time in seconds transitionLeaveScale = transitionLeaveScale + deltaTime / TRANSITION_LEAVE_DURATION -- transition should last for that time in seconds
else else
transitionEnterScale = 0 transitionLeaveScale = 1
end end
transitionLeaveReappearTimer = 1;
else else
if transitionEnterScale < 1 then if (transitionLeaveReappearTimer == 1) then
transitionEnterScale = transitionEnterScale + deltaTime / 0.5 -- transition should last for that time in seconds -- This stuff happens right after filterwheel is deactivated
else end
transitionEnterScale = 1
transitionLeaveReappearTimer = transitionLeaveReappearTimer - deltaTime / (TRANSITION_LEAVE_DURATION + 0.05) -- same reasoning as in the songwheel
if (transitionLeaveReappearTimer <= 0) then
transitionLeaveScale = 0;
transitionLeaveReappearTimer = 0;
end end
end end
transitionEnterOffsetY = -Easing.inOutQuad(1 - transitionEnterScale) *
(desh + ITEM_HEIGHT * 2 + 145 +
(transitionEnterReverse and -4 or 0));
end end
function drawFilterWheel(deltatime) function drawFilterWheel(deltatime)
@ -315,20 +329,13 @@ function drawFilterWheel(deltatime)
end end
render = function(deltatime, shown) render = function(deltatime, shown)
isFilterWheelActive = shown;
drawFilterWheel(deltatime)
if not shown then if not shown then
game.SetSkinSetting('_songWheelOverlayActive', 0); game.SetSkinSetting('_songWheelOverlayActive', 0);
transitionEnterReverse = true
if (transitionEnterScale > 0) then
drawFilterWheel(deltatime)
else
game.SetSkinSetting('_songWheelDespawnSelectorElements', 0);
end
else else
transitionEnterReverse = false
game.SetSkinSetting('_songWheelOverlayActive', 1); game.SetSkinSetting('_songWheelOverlayActive', 1);
game.SetSkinSetting('_songWheelDespawnSelectorElements', 1);
drawFilterWheel(deltatime)
end end
game.SetSkinSetting('_songWheelActiveFolderLabel', getFolderData(filters.folder[selectedFolder]).label); game.SetSkinSetting('_songWheelActiveFolderLabel', getFolderData(filters.folder[selectedFolder]).label);
@ -340,14 +347,20 @@ render = function(deltatime, shown)
SongSelectHeader.draw(deltatime); SongSelectHeader.draw(deltatime);
Footer.draw(deltatime); Footer.draw(deltatime);
if (isFilterWheelActive ~= previousActiveState) then
game.PlaySample('filter_wheel/open_close.wav');
previousActiveState = isFilterWheelActive;
end
-- Debug text -- Debug text
gfx.BeginPath(); gfx.BeginPath();
gfx.FontSize(18) gfx.FontSize(18)
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.FillColor(255, 255, 255, 255); gfx.FillColor(255, 255, 255, 255);
-- gfx.Text('S_M: ' .. selectionMode .. ' // S_F: ' .. selectedFolder .. -- gfx.Text('S_M: ' .. selectionMode .. ' // S_F: ' .. selectedFolder ..
-- ' // S_L: ' .. selectedLevel .. ' // T_E_S: ' .. -- ' // S_L: ' .. selectedLevel .. ' // L_TS: ' ..
-- transitionEnterScale, 8, 1870); -- transitionLeaveScale .. ' // L_TRT: ' .. transitionLeaveReappearTimer, 8, 1870);
end end
set_selection = function(newIndex, isFolder) set_selection = function(newIndex, isFolder)

View File

@ -49,6 +49,12 @@ local badgeImages = {
gfx.CreateSkinImage("song_select/medal/puc.png", 1), gfx.CreateSkinImage("song_select/medal/puc.png", 1),
} }
local cursorImages = {
gfx.CreateSkinImage("song_select/cursor.png", 1), -- Effective rate or fallback
gfx.CreateSkinImage("song_select/cursor_exc.png", 1), -- Excessive rate
gfx.CreateSkinImage("song_select/cursor_perm.png", 1), -- Premissive rate
gfx.CreateSkinImage("song_select/cursor_blast.png", 1), -- Blastive rate
}
local gradeCutoffs = { local gradeCutoffs = {
D = 0000000, D = 0000000,
C = 7000000, C = 7000000,
@ -131,9 +137,10 @@ local transitionLaserY = 0;
local transitionFlashScale = 0; local transitionFlashScale = 0;
local transitionFlashAlpha = 1; local transitionFlashAlpha = 1;
local transitionLeaveReverse = false; local isFilterWheelActive = false;
local transitionLeaveScale = 0; local transitionLeaveScale = 0;
local transitionLeaveOffsetY = 0; local transitionLeaveReappearTimer = 0;
local TRANSITION_LEAVE_DURATION = 0.1;
function resetLayoutInformation() function resetLayoutInformation()
resx, resy = game.GetResolution() resx, resy = game.GetResolution()
@ -234,28 +241,31 @@ end
function drawBackground(deltaTime) function drawBackground(deltaTime)
Background.draw(deltaTime) Background.draw(deltaTime)
-- If the score for song exists
local song = songwheel.songs[selectedIndex]; local song = songwheel.songs[selectedIndex];
local diff = song and song.difficulties[selectedDifficulty] or false; local diff = song and song.difficulties[selectedDifficulty] or false;
if song and diff then
local jacketImage = getJacketImage(song); if (not isFilterWheelActive and transitionLeaveReappearTimer == 0) then
gfx.BeginPath() -- If the score for song exists
gfx.ImageRect(transitionJacketBgScrollPosX, 0, 900, 900, jacketImage or defaultJacketImage, transitionJacketBgScrollAlpha, 0) if song and diff then
local jacketImage = getJacketImage(song);
gfx.BeginPath()
gfx.ImageRect(transitionJacketBgScrollPosX, 0, 900, 900, jacketImage or defaultJacketImage, transitionJacketBgScrollAlpha, 0)
gfx.BeginPath(); gfx.BeginPath();
gfx.FillColor(0,0,0,math.floor(transitionJacketBgScrollAlpha*64)); gfx.FillColor(0,0,0,math.floor(transitionJacketBgScrollAlpha*64));
gfx.Rect(0,0,900,900); gfx.Rect(0,0,900,900);
gfx.Fill(); gfx.Fill();
gfx.ClosePath(); gfx.ClosePath();
gfx.BeginPath(); end
end end
gfx.BeginPath();
gfx.ImageRect(0, 0, desw, desh, dataPanelImage, 1, 0) gfx.ImageRect(0, 0, desw, desh, dataPanelImage, 1, 0)
drawLaserAnim() drawLaserAnim()
if song and diff then if song and diff and (not isFilterWheelActive and transitionLeaveReappearTimer == 0) then
gfx.BeginPath() gfx.BeginPath()
gfx.ImageRect(0, 0, desw, desh, dataGlowOverlayImage, transitionAfterscrollDataOverlayAlpha, 0) gfx.ImageRect(0, 0, desw, desh, dataGlowOverlayImage, transitionAfterscrollDataOverlayAlpha, 0)
gfx.BeginPath() gfx.BeginPath()
@ -351,9 +361,11 @@ function drawSong(song, y)
end end
function drawSongList() function drawSongList()
gfx.GlobalAlpha(1-transitionLeaveScale);
local numOfSongsAround = 7; -- How many songs should be up and how many should be down of the selected one local numOfSongsAround = 7; -- How many songs should be up and how many should be down of the selected one
local yOffset = transitionLeaveOffsetY + transitionScrollOffsetY; local yOffset = transitionScrollOffsetY;
local i=1; local i=1;
while (i <= numOfSongsAround) do while (i <= numOfSongsAround) do
@ -371,10 +383,15 @@ function drawSongList()
drawSong(songwheel.songs[songIndex], desh/2-songPlateHeight/2+songPlateHeight*i + yOffset) drawSong(songwheel.songs[songIndex], desh/2-songPlateHeight/2+songPlateHeight*i + yOffset)
i=i+1; i=i+1;
end; end;
gfx.GlobalAlpha(1);
end end
local scoreNumbers = load_number_image("score_num"); local scoreNumbers = load_number_image("score_num");
function drawData() -- Draws the song data on the left panel function drawData() -- Draws the song data on the left panel
if isFilterWheelActive or transitionLeaveReappearTimer ~= 0 then return false end;
local song = songwheel.songs[selectedIndex]; local song = songwheel.songs[selectedIndex];
local diff = song and song.difficulties[selectedDifficulty] or false; local diff = song and song.difficulties[selectedDifficulty] or false;
local bestScore = diff and diff.scores[1]; local bestScore = diff and diff.scores[1];
@ -524,6 +541,8 @@ function drawData() -- Draws the song data on the left panel
end end
function drawFilterInfo(deltatime) function drawFilterInfo(deltatime)
gfx.LoadSkinFont('NotoSans-Regular.ttf')
gfx.BeginPath() gfx.BeginPath()
gfx.ImageRect(5, 95, 417*0.85, 163*0.85, filterInfoBgImage, 1, 0) gfx.ImageRect(5, 95, 417*0.85, 163*0.85, filterInfoBgImage, 1, 0)
@ -547,6 +566,17 @@ function drawFilterInfo(deltatime)
gfx.Text(sortOptionLabel or '', desw-150, 130); gfx.Text(sortOptionLabel or '', desw-150, 130);
end end
function drawCursor()
if isFilterWheelActive or transitionLeaveScale ~= 0 then return false end
gfx.BeginPath()
local cursorImageIndex = game.GetSkinSetting('_gaugeType')
local cursorImage = cursorImages[cursorImageIndex or 1];
gfx.ImageRect(desw / 2 - 14, desh / 2 - 213 / 2, 555, 213, cursorImage, 1, 0)
end
function drawSearch() function drawSearch()
if (not songwheel.searchInputActive) then if (not songwheel.searchInputActive) then
return; return;
@ -689,21 +719,28 @@ function tickTransitions(deltaTime)
transitionFlashAlpha = 1+transitionFlashAlpha*0.5 transitionFlashAlpha = 1+transitionFlashAlpha*0.5
-- Leave transition -- Leave transition
if (transitionLeaveReverse) then if (isFilterWheelActive) then
if transitionLeaveScale > 0 then
transitionLeaveScale = transitionLeaveScale - deltaTime / 0.5 -- transition should last for that time in seconds
else
transitionLeaveScale = 0
end
else
if transitionLeaveScale < 1 then if transitionLeaveScale < 1 then
transitionLeaveScale = transitionLeaveScale + deltaTime / 0.5 -- transition should last for that time in seconds transitionLeaveScale = transitionLeaveScale + deltaTime / TRANSITION_LEAVE_DURATION -- transition should last for that time in seconds
else else
transitionLeaveScale = 1 transitionLeaveScale = 1
end end
end transitionLeaveReappearTimer = 1;
transitionAfterscrollScale = 0; -- Keep songwheel in the "afterscroll" state while the filterwheel is active
transitionJacketBgScrollScale = 0; -- Same thing here, just with the jacket bg
else
if (transitionLeaveReappearTimer ~= 0) then
transitionAfterscrollScale = 0; -- Keep songwheel in the "afterscroll" state while we're waiting on filter wheel to fade out
transitionJacketBgScrollScale = 0; -- Same thing here, just with the jacket bg
end
transitionLeaveOffsetY = Easing.inOutQuad(transitionLeaveScale) * (desh+songPlateHeight*2+145); transitionLeaveReappearTimer = transitionLeaveReappearTimer - deltaTime / (TRANSITION_LEAVE_DURATION + 0.05) -- 0.05s is a few frames between the completetion of the fade out and songs reappearing in the AC
if (transitionLeaveReappearTimer <= 0) then
transitionLeaveScale = 0;
transitionLeaveReappearTimer = 0;
end
end
end end
@ -720,24 +757,21 @@ render = function (deltaTime)
drawSongList() drawSongList()
isFilterWheelActive = game.GetSkinSetting('_songWheelOverlayActive') == 1;
drawData() drawData()
drawCursor()
drawFilterInfo(deltaTime) drawFilterInfo(deltaTime)
drawSearch(); drawSearch();
if (game.GetSkinSetting('_songWheelOverlayActive') ~= 1) then
transitionLeaveReverse = true;
else
transitionLeaveReverse = false;
end
gfx.BeginPath(); gfx.BeginPath();
gfx.FontSize(18) gfx.FontSize(18)
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
local debugScrollingUp= "FALSE" local debugScrollingUp= "FALSE"
if scrollingUp then debugScrollingUp = "TRUE" end; if scrollingUp then debugScrollingUp = "TRUE" end;
-- gfx.Text('S_I: ' .. selectedIndex .. ' // S_D: ' .. selectedDifficulty .. ' // S_UP: ' .. debugScrollingUp .. ' // AC_TS: ' .. transitionAfterscrollScale, 8, 8); -- gfx.Text('S_I: ' .. selectedIndex .. ' // S_D: ' .. selectedDifficulty .. ' // S_UP: ' .. debugScrollingUp .. ' // AC_TS: ' .. transitionAfterscrollScale .. ' // L_TS: ' .. transitionLeaveScale, 8, 8);
end end
songs_changed = function (withAll) songs_changed = function (withAll)