Skip to content

Commit

Permalink
Add CBHighlights to gameplay
Browse files Browse the repository at this point in the history
It's an option in the playeroptions screen
  • Loading branch information
poco0317 committed Feb 8, 2019
1 parent dceede9 commit 1fafdad
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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
Expand Down

This file was deleted.

26 changes: 26 additions & 0 deletions Themes/Til Death/Scripts/02 ThemePrefs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion Themes/Til Death/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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()"
Expand All @@ -453,6 +453,7 @@ LineLife="conf,LifeDifficulty"
LineJudge="conf,TimingWindowScale"
LineCW="lua,CustomEvalWindows()"
LineBackground="conf,BGBrightness"
LineCBHL="lua,CBHighlight()"

NextScreen="ScreenGameplay"

Expand Down

0 comments on commit 1fafdad

Please sign in to comment.