diff --git a/Themes/Til Death/BGAnimations/ScreenGameplay underlay/ScreenFilter.lua b/Themes/Til Death/BGAnimations/ScreenGameplay underlay/ScreenFilter.lua index 3013558900..1553ef6dc9 100644 --- a/Themes/Til Death/BGAnimations/ScreenGameplay underlay/ScreenFilter.lua +++ b/Themes/Til Death/BGAnimations/ScreenGameplay underlay/ScreenFilter.lua @@ -15,41 +15,40 @@ local rPressed = false local tPressed = false local noteFieldWidth = MovableValues.NotefieldWidth local notefieldX = MovableValues.NotefieldX +local oldWidth = noteFieldWidth local filter +local cbContainer local function input(event) if getAutoplay() ~= 0 then -- not touching this currently, its fully bound with the notefield ones and doesnt have a message if Movable.current == "DeviceButton_r" and event.type ~= "InputEventType_Release" then if event.DeviceInput.button == "DeviceButton_left" then filter:addx(-3) + cbContainer:addx(-3) end if event.DeviceInput.button == "DeviceButton_right" then filter:addx(3) + cbContainer:addx(3) end end if Movable.current == "DeviceButton_t" and event.type ~= "InputEventType_Release" then if event.DeviceInput.button == "DeviceButton_left" then + oldWidth = noteFieldWidth noteFieldWidth = noteFieldWidth - 0.01 filter:playcommand("Update") + cbContainer:playcommand("Update") end if event.DeviceInput.button == "DeviceButton_right" then + oldWidth = noteFieldWidth noteFieldWidth = noteFieldWidth + 0.01 filter:playcommand("Update") + cbContainer:playcommand("Update") end end end return false end -local t = - Def.ActorFrame { - OnCommand = function() - if (allowedCustomization) then - SCREENMAN:GetTopScreen():AddInputCallback(input) - end - end -} - local style = GAMESTATE:GetCurrentStyle() local cols = style:ColumnsPerPlayer() @@ -59,6 +58,91 @@ local center1P = ((cols >= 6) or PREFSMAN:GetPreference("Center1Player")) local styleType = ToEnumShortString(style:GetStyleType()) local filterWidth = (arrowWidth * cols) + padding +local judgeThreshold = Enum.Reverse(TapNoteScore)[ComboContinue()] +local enabled = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).CBHighlight + +local alpha = 0.8 + + +local function laneHighlight() + local pn = PLAYER_1 + local r = Def.ActorFrame { + InitCommand = function(self) + cbContainer = self + end + } + local xpos = getNoteFieldPos(pn) + local width = style:GetWidth(pn) + local colWidth = width/cols + local border = 4 + + for i=1,cols do + r[#r+1] = Def.Quad{ + InitCommand = function(self) + self:zoomto(getNoteFieldScale(pn) * (arrowWidth - 4) * noteFieldWidth, SCREEN_HEIGHT) + self:valign(0) + + local reverse = GAMESTATE:GetPlayerState(pn):GetCurrentPlayerOptions():UsingReverse() + local receptor = reverse and THEME:GetMetric("Player", "ReceptorArrowsYStandard") or THEME:GetMetric("Player", "ReceptorArrowsYReverse") + + if i > cols or not enabled then + self:visible(false) + self:hibernate(math.huge) + end + + self:diffusealpha(alpha) + local thewidth + if noteFieldWidth >= 1 then + thewidth = math.abs(1-noteFieldWidth) + else + thewidth = noteFieldWidth - 1 + end + self:xy((xpos - (arrowWidth * (cols / 2) * getNoteFieldScale(pn)) + ((i - 1) * arrowWidth * getNoteFieldScale(pn)) +(getNoteFieldScale(pn) * arrowWidth / 2)) + (i-(cols/2)-(1/2))*colWidth*(thewidth),-receptor) + self:fadebottom(0.6):fadetop(0.6) + self:addx(notefieldX) + self:visible(false) + end, + JudgmentMessageCommand=function(self,params) + if not enabled then + self:visible(false) + self:hibernate(math.huge) + return + end + local notes = params.Notes + local firstTrack = params.FirstTrack+1 + if params.Player == pn and params.TapNoteScore then + local enum = Enum.Reverse(TapNoteScore)[params.TapNoteScore] + if enum < judgeThreshold and enum > 3 and i == firstTrack then + self:stoptweening() + self:visible(true) + self:diffuse(byJudgment(params.TapNoteScore)) + self:diffusealpha(alpha) + self:tween(0.25, "TweenType_Bezier",{0,0,0.5,0,1,1,1,1}) + self:diffusealpha(0) + end + end + end, + UpdateCommand = function(self) + noteFieldWidth = MovableValues.NotefieldWidth + self:zoomtowidth((colWidth-border) * noteFieldWidth) + self:addx((i-(cols/2)-(1/2))*colWidth * (noteFieldWidth - oldWidth)) + end + } + end + + return r +end + +local t = + Def.ActorFrame { + OnCommand = function() + if (allowedCustomization) then + SCREENMAN:GetTopScreen():AddInputCallback(input) + end + end, + laneHighlight() +} + if numPlayers == 1 then local player = GAMESTATE:GetMasterPlayerNumber() local pNum = (player == PLAYER_1) and 1 or 2 diff --git a/Themes/Til Death/BGAnimations/ScreenGameplay underlay/cbHighlight.lua b/Themes/Til Death/BGAnimations/ScreenGameplay underlay/cbHighlight.lua deleted file mode 100644 index c7959ded74..0000000000 --- a/Themes/Til Death/BGAnimations/ScreenGameplay underlay/cbHighlight.lua +++ /dev/null @@ -1,85 +0,0 @@ ---Highlights the lane in which a combo break has occured. - ---Should be moved to colors.lua -local highlightColor = { - -- Colors of Judgment highlights - TapNoteScore_W1 = color("0.2,0.773,0.953"), - TapNoteScore_W2 = color("1,0.8,0"), - TapNoteScore_W3 = color("0.4,0.8,0.4"), - TapNoteScore_W4 = color("0.35,0.46,0.73"), - TapNoteScore_W5 = color("0.78,0.48,1"), - TapNoteScore_Miss = color("0.85,0.33,0.33"), - TapNoteScore_HitMine = color("0.85,0.33,0.33") -} - -local enabled = { - PlayerNumber_P1 = GAMESTATE:IsPlayerEnabled(PLAYER_1) and - playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).CBHighlight, - PlayerNumber_P2 = GAMESTATE:IsPlayerEnabled(PLAYER_2) and - playerConfig:get_data(pn_to_profile_slot(PLAYER_2)).CBHighlight -} - -local arrowWidth = 64 -- until noteskin metrics are implemented... -local alpha = 0.75 - -local style = GAMESTATE:GetCurrentStyle() -local cols = style:ColumnsPerPlayer() -local styleType = ToEnumShortString(style:GetStyleType()) - -local numPlayers = GAMESTATE:GetNumPlayersEnabled() -local center1P = ((cols >= 6) or PREFSMAN:GetPreference("Center1Player")) - -local cbThreshold = Enum.Reverse(TapNoteScore)[ComboContinue()] - -local function laneHighlight(pn) - local t = Def.ActorFrame {} - local xpos = getNoteFieldPos(pn) - - for i = 1, cols do - t[#t + 1] = - Def.Quad { - InitCommand = function(self) - self:xy( - xpos - (arrowWidth * (cols / 2) * getNoteFieldScale(pn)) + ((i - 1) * arrowWidth * getNoteFieldScale(pn)) + - (getNoteFieldScale(pn) * arrowWidth / 2), - 0 - ):zoomto(getNoteFieldScale(pn) * (arrowWidth - 4), SCREEN_HEIGHT / 4.5):valign(0):diffusealpha(0) - end, - BeginCommand = function(self) - self:fadeleft(0.2) - self:faderight(0.2) - end, - JudgmentMessageCommand = function(self, params) - local notes = params.Notes - if params.Player == pn and params.TapNoteScore and notes ~= nil and notes[i] ~= nil then - if - Enum.Reverse(TapNoteScore)[params.TapNoteScore] < cbThreshold and params.TapNoteScore ~= "TapNoteScore_None" and - params.TapNoteScore ~= "TapNoteScore_AvoidMine" and - params.TapNoteScore ~= "TapNoteScore_CheckpointMiss" - then - self:stoptweening() - self:visible(true) - self:diffusealpha(0) - self:linear(0.1) - self:diffuse(highlightColor[params.TapNoteScore]) - self:diffusealpha(alpha) - self:linear(0.25) - self:diffusealpha(0) - end - end - end - } - end - - return t -end - -local t = Def.ActorFrame {} - -for _, pn in pairs({PLAYER_1, PLAYER_2}) do - if enabled[pn] then - t[#t + 1] = laneHighlight(pn) - end -end - -return t diff --git a/Themes/Til Death/Scripts/02 ThemePrefs.lua b/Themes/Til Death/Scripts/02 ThemePrefs.lua index 7a6f1edcb1..38c7c9eb98 100644 --- a/Themes/Til Death/Scripts/02 ThemePrefs.lua +++ b/Themes/Til Death/Scripts/02 ThemePrefs.lua @@ -297,6 +297,32 @@ function PlayerInfo() return t end +function CBHighlight() + local t = { + Name = "CBHighlight", + LayoutType = "ShowAllInRow", + SelectType = "SelectOne", + OneChoiceForAllPlayers = false, + ExportOnChange = true, + Choices = {THEME:GetString("OptionNames", "Off"), THEME:GetString("OptionNames", "On")}, + LoadSelections = function(self, list, pn) + local pref = playerConfig:get_data(pn_to_profile_slot(pn)).CBHighlight + if pref then + list[2] = true + else + list[1] = true + end + end, + SaveSelections = function(self, list, pn) + playerConfig:get_data(pn_to_profile_slot(pn)).CBHighlight = list[2] + playerConfig:set_dirty(pn_to_profile_slot(pn)) + playerConfig:save(pn_to_profile_slot(pn)) + end + } + setmetatable(t, t) + return t +end + function CustomizeGameplay() local t = { Name = "CustomizeGameplay", diff --git a/Themes/Til Death/metrics.ini b/Themes/Til Death/metrics.ini index df5a0773da..8af0f0c53e 100644 --- a/Themes/Til Death/metrics.ini +++ b/Themes/Til Death/metrics.ini @@ -426,7 +426,7 @@ StepsTypeSetCommand=%function(self,param) \ end; \ [ScreenPlayerOptions] -LineNames="1,Rate,8,4,CG,PRAC,RS,14,5,7,10,13,JT,DP,TT,TG,TTM,JC,EB,PI,FBP,LEADB,FB,MB,SF,LC,NPS,16,BG,Life,Judge,CW,Background,Fail,Center,Score" +LineNames="1,Rate,8,4,CG,PRAC,RS,14,5,7,10,13,CBHL,JT,DP,TT,TG,TTM,JC,EB,PI,FBP,LEADB,FB,MB,SF,LC,NPS,16,BG,Life,Judge,CW,Background,Fail,Center,Score" LineCenter="conf,Center1Player" LineCG="lua,CustomizeGameplay()" LineRS="lua,ReceptorSize()" @@ -453,6 +453,7 @@ LineLife="conf,LifeDifficulty" LineJudge="conf,TimingWindowScale" LineCW="lua,CustomEvalWindows()" LineBackground="conf,BGBrightness" +LineCBHL="lua,CBHighlight()" NextScreen="ScreenGameplay"