Skip to content

Commit

Permalink
Move Notefield Filter & CB Highlights to Notefield Board
Browse files Browse the repository at this point in the history
should fix any issues related to perspective changes not properly affecting the filter and the cb highlights
  • Loading branch information
poco0317 committed Apr 6, 2020
1 parent 4e804dd commit a590605
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ end
local t = Def.ActorFrame {}
setMovableKeymode(getCurrentKeyMode())
t[#t + 1] = LoadActor("bg")
t[#t + 1] = LoadActor("ScreenFilter")
return t
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ end
local style = GAMESTATE:GetCurrentStyle()
local cols = style:ColumnsPerPlayer()

local numPlayers = GAMESTATE:GetNumPlayersEnabled()
local center1P = ((cols >= 6) or PREFSMAN:GetPreference("Center1Player"))

local styleType = ToEnumShortString(style:GetStyleType())
Expand All @@ -71,7 +70,6 @@ local function laneHighlight()
cbContainer = self
end
}
local xpos = getNoteFieldPos(pn)
local width = style:GetWidth(pn)
local colWidth = width/cols
local border = 4
Expand All @@ -83,8 +81,7 @@ local function laneHighlight()
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)
self:zoomto(getNoteFieldScale(pn) * (arrowWidth - 4) * noteFieldWidth, SCREEN_HEIGHT * 2)

local reverse = GAMESTATE:GetPlayerState(pn):GetCurrentPlayerOptions():UsingReverse()
local receptor = reverse and THEME:GetMetric("Player", "ReceptorArrowsYStandard") or THEME:GetMetric("Player", "ReceptorArrowsYReverse")
Expand All @@ -96,7 +93,7 @@ local function laneHighlight()
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:xy((-(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)
Expand Down Expand Up @@ -137,44 +134,42 @@ local t =
end
}

if numPlayers == 1 then
local player = GAMESTATE:GetMasterPlayerNumber()
local pNum = (player == PLAYER_1) and 1 or 2
local player = GAMESTATE:GetMasterPlayerNumber()
local pNum = (player == PLAYER_1) and 1 or 2

filterAlphas[player] = playerConfig:get_data(pn_to_profile_slot(player)).ScreenFilter
if filterAlphas[player] == nil then
filterAlphas[player] = 0
else
filterAlphas[player] = tonumber(filterAlphas[player])
end
filterAlphas[player] = playerConfig:get_data(pn_to_profile_slot(player)).ScreenFilter
if filterAlphas[player] == nil then
filterAlphas[player] = 0
else
filterAlphas[player] = tonumber(filterAlphas[player])
end

local pos
-- [ScreenGameplay] PlayerP#Player*Side(s)X
if center1P then
pos = SCREEN_CENTER_X
else
local metricName = string.format("PlayerP%i%sX", pNum, styleType)
pos = THEME:GetMetric("ScreenGameplay", metricName)
end
t[#t + 1] =
Def.Quad {
Name = "SinglePlayerFilter",
InitCommand = function(self)
self:x(pos)
self:CenterY()
self:zoomto(filterWidth * getNoteFieldScale(player) * noteFieldWidth, SCREEN_HEIGHT)
self:diffusecolor(filterColor)
self:diffusealpha(filterAlphas[player])
self:addx(notefieldX)
filter = self
end,
UpdateCommand = function(self)
local player = GAMESTATE:GetMasterPlayerNumber()
noteFieldWidth = MovableValues.NotefieldWidth
self:zoomto(filterWidth * getNoteFieldScale(player) * noteFieldWidth, SCREEN_HEIGHT)
end
}
t[#t+1] = laneHighlight()
local pos
-- [ScreenGameplay] PlayerP#Player*Side(s)X
if center1P then
pos = SCREEN_CENTER_X
else
local metricName = string.format("PlayerP%i%sX", pNum, styleType)
pos = THEME:GetMetric("ScreenGameplay", metricName)
end

t[#t + 1] =
Def.Quad {
Name = "SinglePlayerFilter",
InitCommand = function(self)
self:zoomto(filterWidth * getNoteFieldScale(player) * noteFieldWidth, SCREEN_HEIGHT * 2)
self:diffusecolor(filterColor)
self:diffusealpha(filterAlphas[player])
self:addx(notefieldX)
filter = self
end,
UpdateCommand = function(self)
local player = GAMESTATE:GetMasterPlayerNumber()
noteFieldWidth = MovableValues.NotefieldWidth
self:zoomto(filterWidth * getNoteFieldScale(player) * noteFieldWidth, SCREEN_HEIGHT * 2)
end
}

t[#t+1] = laneHighlight()

return t

0 comments on commit a590605

Please sign in to comment.