Skip to content

Commit

Permalink
til death add display mean
Browse files Browse the repository at this point in the history
this uses comma as a binding. probably bad idea
  • Loading branch information
poco0317 committed Feb 25, 2023
1 parent b0ea31b commit e1e78dd
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ local dvCur
local jdgCur -- Note: only for judgments with OFFSETS, might reorganize a bit later
local tDiff
local wifey
local curMeanSum = 0
local curMeanCount = 0
local judgect
local pbtarget
local positive = getMainColor("positive")
Expand Down Expand Up @@ -146,6 +148,7 @@ local enabledMiniBar = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).MiniP
local enabledFullBar = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).FullProgressBar
local enabledTargetTracker = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).TargetTracker
local enabledDisplayPercent = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).DisplayPercent
local enabledDisplayMean = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).DisplayMean
local enabledJudgeCounter = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).JudgeCounter
local leaderboardEnabled = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).leaderboardEnabled and DLMAN:IsLoggedIn()
local isReplay = GAMESTATE:GetPlayerState():GetPlayerController() == "PlayerController_Replay"
Expand Down Expand Up @@ -247,6 +250,10 @@ local t =
jdgct = msg.Val
if msg.Offset ~= nil then
dvCur = msg.Offset
if not msg.HoldNoteScore and msg.Offset < 1000 then
curMeanSum = curMeanSum + msg.Offset
curMeanCount = curMeanCount + 1
end
else
dvCur = nil
end
Expand All @@ -263,6 +270,8 @@ local t =
jdgct = 0
dvCur = nil
jdgCur = nil
curMeanSum = 0
curMeanCount = 0
self:playcommand("SpottedOffset")
end
}
Expand Down Expand Up @@ -426,6 +435,58 @@ if enabledDisplayPercent then
t[#t + 1] = cp
end

--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Display Mean**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Displays the current mean for the score.
]]
local dpm = Def.ActorFrame {
Name = "DisplayMean",
InitCommand = function(self)
if (allowedCustomization) then
Movable.DeviceButton_comma.element = self
Movable.DeviceButton_m.element = self
Movable.DeviceButton_comma.condition = enabledDisplayMean
Movable.DeviceButton_m.condition = enabledDisplayMean
Movable.DeviceButton_comma.Border = self:GetChild("Border")
Movable.DeviceButton_m.Border = self:GetChild("Border")
end
self:zoom(MovableValues.DisplayMeanZoom):x(MovableValues.DisplayMeanX):y(MovableValues.DisplayMeanY)
end,
Def.Quad {
InitCommand = function(self)
self:zoomto(60, 13):diffuse(color("0,0,0,0.4")):halign(1):valign(0)
end
},
-- Displays your current mean score
LoadFont("Common Large") .. {
Name = "DisplayPercent",
InitCommand = function(self)
self:zoom(0.3):halign(1):valign(0)
end,
OnCommand = function(self)
if allowedCustomization then
self:settextf("%5.2fms", -10000)
setBorderAlignment(self:GetParent():GetChild("Border"), 1, 0)
setBorderToText(self:GetParent():GetChild("Border"), self)
end
self:settextf("%5.2fms", 0)
end,
SpottedOffsetCommand = function(self)
local mean = curMeanSum / curMeanCount
if curMeanCount == 0 then
mean = 0
end
self:settextf("%5.2fms", mean)
end
},
MovableBorder(100, 13, 1, 0, 0)
}

if enabledDisplayMean then
t[#t + 1] = dpm
end

--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Player judgment counter (aka pa counter)**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 4 additions & 0 deletions Themes/Til Death/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ JudgeType=Judge Count
JudgmentText = Judgment Text
ComboText = Combo Text
DisplayPercent = Current Percent
DisplayMean = Current Mean
TargetTracker = Goal Tracker
TargetGoal = Tracker Goal
TargetTrackerMode = Tracker mode
Expand Down Expand Up @@ -137,6 +138,7 @@ JudgeType = Set Judgecount Type.
JudgmentText = Show or hide text associated with judgments.
ComboText = Show or hide text associated with your combo.
DisplayPercent = Displays the current percent for your score.
DisplayMean = Displays the current mean for your score.
TargetTracker = Enable Goal Tracker. Displays the differential between your current score and 93% of the maximum score obtainable, or pits you against your personal best.
TargetGoal = Set the percentage goal for the target tracker.
TargetTrackerMode = Toggle tracker mode between a set percentage and your personal best. If no PB is available it will default to your set target goal.
Expand Down Expand Up @@ -216,6 +218,8 @@ FullProgressBarSize=Full Progress Bar Size
MiniProgressBarPosition=Mini Progress Bar Position
DisplayPercentPosition=Display Percent Text Position
DisplayPercentSize=Display Percent Text Size
DisplayMeanPosition=Display Mean Text Position
DisplayMeanSize=Display Mean Text Size
NotefieldPosition=Notefield Position
NotefieldSize=Notefield Size
NPSDisplayPosition=NPS Display Text Position
Expand Down
4 changes: 4 additions & 0 deletions Themes/Til Death/Scripts/01 player_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ local defaultGameplayCoordinates = {
JudgeCounterY = SCREEN_CENTER_Y,
DisplayPercentX = SCREEN_CENTER_X - 170,
DisplayPercentY = SCREEN_CENTER_Y - 60,
DisplayMeanX = SCREEN_CENTER_X - 170,
DisplayMeanY = SCREEN_CENTER_Y - 75,
NPSDisplayX = 5,
NPSDisplayY = SCREEN_BOTTOM - 175,
NPSGraphX = 0,
Expand Down Expand Up @@ -46,6 +48,7 @@ local defaultGameplaySizes = {
FullProgressBarWidth = 1.0,
FullProgressBarHeight = 1.0,
DisplayPercentZoom = 1,
DisplayMeanZoom = 1,
NPSDisplayZoom = 0.4,
NPSGraphWidth = 1.0,
NPSGraphHeight = 1.0,
Expand All @@ -71,6 +74,7 @@ local defaultConfig = {
AvgScoreType = 0,
GhostScoreType = 1,
DisplayPercent = true,
DisplayMean = false,
TargetTracker = true,
TargetGoal = 93,
TargetTrackerMode = 0,
Expand Down
42 changes: 42 additions & 0 deletions Themes/Til Death/Scripts/02 CustomizeGameplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ local function loadValuesTable()
MovableValues.DisplayPercentX = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).GameplayXYCoordinates[keymode].DisplayPercentX
MovableValues.DisplayPercentY = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).GameplayXYCoordinates[keymode].DisplayPercentY
MovableValues.DisplayPercentZoom = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).GameplaySizes[keymode].DisplayPercentZoom
MovableValues.DisplayMeanX = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).GameplayXYCoordinates[keymode].DisplayMeanX
MovableValues.DisplayMeanY = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).GameplayXYCoordinates[keymode].DisplayMeanY
MovableValues.DisplayMeanZoom = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).GameplaySizes[keymode].DisplayMeanZoom
MovableValues.NotefieldX = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).GameplayXYCoordinates[keymode].NotefieldX
MovableValues.NotefieldY = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).GameplayXYCoordinates[keymode].NotefieldY
MovableValues.NotefieldWidth = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).GameplaySizes[keymode].NotefieldWidth
Expand Down Expand Up @@ -862,6 +865,45 @@ Movable = {
inc = -1
},
},
DeviceButton_m = {
name = "DisplayMean",
textHeader = "Current Mean Position:",
element = {},
properties = {"X", "Y"},
elementTree = "GameplayXYCoordinates",
DeviceButton_up = {
property = "Y",
inc = -5
},
DeviceButton_down = {
property = "Y",
inc = 5
},
DeviceButton_left = {
property = "X",
inc = -5
},
DeviceButton_right = {
property = "X",
inc = 5
}
},
DeviceButton_comma = {
name = "DisplayMean",
textHeader = "Current Mean Size:",
element = {},
properties = {"Zoom"},
elementTree = "GameplaySizes",
DeviceButton_up = {
property = "Zoom",
inc = 0.01
},
DeviceButton_down = {
property = "Zoom",
inc = -0.01
}
}

}

local function updatetext(button)
Expand Down
2 changes: 1 addition & 1 deletion Themes/Til Death/Scripts/02 OptionsMenu.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function getPlayerOptionsList(itemSet)
local Items = {
["Main"] = "Speed,RateList,NoteSk,RS,PRAC,CG,ScrollDir,Center,Persp,LC,BG,SF,Background,Judge,Life,Fail,Assist,Score",
["Theme"] = "CBHL,JT,CT,DP,TT,TG,TTM,JC,EB,EBC,PI,FBP,FB,MB,LEADB,NPS",
["Theme"] = "CBHL,JT,CT,DP,DM,TT,TG,TTM,JC,EB,EBC,PI,FBP,FB,MB,LEADB,NPS",
["Effect"] = "Persp,App,GHO,SHO,Acc,Hide,Effect1,Effect2,Scroll,Turn,Insert,R1,R2,Holds,Mines"
}
return Items[itemSet] .. ",NextScr"
Expand Down
28 changes: 28 additions & 0 deletions Themes/Til Death/Scripts/02 ThemePrefs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,34 @@ function DisplayPercent()
return t
end

function DisplayMean()
local t = {
Name = "DisplayMean",
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)).DisplayMean
if pref then
list[2] = true
else
list[1] = true
end
end,
SaveSelections = function(self, list, pn)
local value
value = list[2]
playerConfig:get_data(pn_to_profile_slot(pn)).DisplayMean = value
playerConfig:set_dirty(pn_to_profile_slot(pn))
playerConfig:save(pn_to_profile_slot(pn))
end
}
setmetatable(t, t)
return t
end

function TargetTracker()
local t = {
Name = "TargetTracker",
Expand Down
1 change: 1 addition & 0 deletions Themes/Til Death/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ LineCBHL="lua,CBHighlight()"
LineJT="lua,JudgmentText()"
LineCT="lua,ComboText()"
LineDP="lua,DisplayPercent()"
LineDM="lua,DisplayMean()"
LineTT="lua,TargetTracker()"
LineTG="lua,TargetGoal()"
LineTTM="lua,TargetTrackerMode()"
Expand Down

0 comments on commit e1e78dd

Please sign in to comment.