diff --git a/Themes/Til Death/BGAnimations/ScreenGameplay overlay/WifeJudgmentSpotting.lua b/Themes/Til Death/BGAnimations/ScreenGameplay overlay/WifeJudgmentSpotting.lua index d3a9c95e26..9629c3fb3b 100644 --- a/Themes/Til Death/BGAnimations/ScreenGameplay overlay/WifeJudgmentSpotting.lua +++ b/Themes/Til Death/BGAnimations/ScreenGameplay overlay/WifeJudgmentSpotting.lua @@ -101,7 +101,10 @@ t[#t+1] = LoadActor("lanecover") Point differential to AA. ]] --- Clientside now. All we do is listen for broadcasts for values calculated by the game and then display them. +-- Mostly clientside now. We set our desired target goal and listen to the results rather than calculating ourselves. +local target = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).TargetGoal +GAMESTATE:GetPlayerState(PLAYER_1):SetTargetGoal(target/100) + d = Def.ActorFrame{ Def.Quad{InitCommand=cmd(xy,60 + mpOffset,(SCREEN_HEIGHT*0.62)-90;zoomto,60,16;diffuse,color("0,0,0,0.4");horizalign,left;vertalign,top)}, -- Displays your current percentage score @@ -117,18 +120,21 @@ d = Def.ActorFrame{ }, } +-- We can save space by wrapping the personal best and set percent trackers into one function, however +-- this would make the actor needlessly cumbersome and unnecessarily punish those who don't use the +-- personal best tracker (although everything is efficient enough now it probably wouldn't matter) if playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).TargetTrackerMode == 0 then d[#d+1] = LoadFont("Common Normal")..{ - Name = "93% Differential", + Name = "Set Percent Differential", InitCommand=cmd(xy,CenterX+26,SCREEN_CENTER_Y+30;zoom,0.4;halign,0;valign,1), JudgmentMessageCommand=function(self,msg) - tDiff = msg.WifeDifferential + local tDiff = msg.WifeDifferential if tDiff >= 0 then diffuse(self,positive) else diffuse(self,negative) end - self:settextf("%5.2f", tDiff) + self:settextf("%5.2f (%i%%)", tDiff, target) end } else @@ -136,13 +142,24 @@ if playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).TargetTrackerMode == 0 th Name = "PB Differential", InitCommand=cmd(xy,CenterX+26,SCREEN_CENTER_Y+30;zoom,0.4;halign,0;valign,1), JudgmentMessageCommand=function(self,msg) - tDiff = msg.WifePBDifferential - if tDiff >= 0 then - diffuse(self,color("#00ff00")) + local tDiff = msg.WifePBDifferential + if tDiff then + local pbtarget = msg.WifePBGoal + if tDiff >= 0 then + diffuse(self,color("#00ff00")) + else + diffuse(self,negative) + end + self:settextf("%5.2f (%5.2f%%)", tDiff, pbtarget*100) else - diffuse(self,negative) - end - self:settextf("%5.2f", tDiff) + tDiff = msg.WifeDifferential + if tDiff >= 0 then + diffuse(self,positive) + else + diffuse(self,negative) + end + self:settextf("%5.2f (%i%%)", tDiff, target) + end end } end diff --git a/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/score.lua b/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/score.lua index 30a32ae2d6..fbad513aa5 100644 --- a/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/score.lua +++ b/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/score.lua @@ -156,39 +156,39 @@ t[#t+1] = LoadFont("Common Normal")..{ } -- Rescoring stuff -t[#t+1] = LoadFont("Common Normal")..{ - Name="Score", - InitCommand=cmd(xy,frameX+offsetX+155,frameY+offsetY+14;zoom,0.5;halign,0), - SetCommand=function(self) - if score ~= nil then - if score:GetWifeScore() == 0 then - self:settextf("NA (%s)", "Wife") - else - self:settextf("%05.2f%% (%s)", notShit.floor(score:RescoreToWifeJudge(4)*10000)/100, "Wife J4") - end - else - self:settextf("00.00%% (%s)", "Wife") - end - end, - ScoreUpdateMessageCommand=cmd(queuecommand,"Set") -} +-- t[#t+1] = LoadFont("Common Normal")..{ + -- Name="Score", + -- InitCommand=cmd(xy,frameX+offsetX+155,frameY+offsetY+14;zoom,0.5;halign,0), + -- SetCommand=function(self) + -- if score ~= nil then + -- if score:GetWifeScore() == 0 then + -- self:settextf("NA (%s)", "Wife") + -- else + -- self:settextf("%05.2f%% (%s)", notShit.floor(score:RescoreToWifeJudge(4)*10000)/100, "Wife J4") + -- end + -- else + -- self:settextf("00.00%% (%s)", "Wife") + -- end + -- end, + -- ScoreUpdateMessageCommand=cmd(queuecommand,"Set") +-- } -t[#t+1] = LoadFont("Common Normal")..{ - Name="Score", - InitCommand=cmd(xy,frameX+offsetX+155,frameY+offsetY+28;zoom,0.5;halign,0), - SetCommand=function(self) - if score ~= nil then - if score:GetWifeScore() == 0 then - self:settextf("NA (%s)", "Wife") - else - self:settextf("%05.2f%% (%s)", notShit.floor(score:RescoreToDPJudge(4)*10000)/100, "DP J4") - end - else - self:settextf("00.00%% (%s)", "Wife") - end - end, - ScoreUpdateMessageCommand=cmd(queuecommand,"Set") -} +-- t[#t+1] = LoadFont("Common Normal")..{ + -- Name="Score", + -- InitCommand=cmd(xy,frameX+offsetX+155,frameY+offsetY+28;zoom,0.5;halign,0), + -- SetCommand=function(self) + -- if score ~= nil then + -- if score:GetWifeScore() == 0 then + -- self:settextf("NA (%s)", "Wife") + -- else + -- self:settextf("%05.2f%% (%s)", notShit.floor(score:RescoreToDPJudge(4)*10000)/100, "DP J4") + -- end + -- else + -- self:settextf("00.00%% (%s)", "Wife") + -- end + -- end, + -- ScoreUpdateMessageCommand=cmd(queuecommand,"Set") +-- } t[#t+1] = LoadFont("Common Normal")..{ Name="ClearType", diff --git a/Themes/Til Death/Languages/en.ini b/Themes/Til Death/Languages/en.ini index 1418ca0ef7..f8858fba52 100644 --- a/Themes/Til Death/Languages/en.ini +++ b/Themes/Til Death/Languages/en.ini @@ -83,15 +83,12 @@ DivideByZero=DivideByZero (Noteskin) 2.4x=2.4x 2.5x=2.5x -93% = 93% -39% Mini= 39% Mini -40% Mini= 40% Mini -No Mini= No Mini [OptionTitles] ReceptorSize = Receptor Size JudgeType=Judge Count JudgmentText = Judgment Text TargetTracker = Goal Tracker +TargetGoal = Tracker Goal TargetTrackerMode = Tracker mode JudgeCounter = Judge Counter ErrorBar=Error Bar @@ -128,7 +125,8 @@ ReceptorSize = Scale the size of the receptors and notes. This will also indirec JudgeType = Set Judgecount Type. JudgmentText = Show or hide text associated with judgments. 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. -TargetTrackerMode = Toggle tracker mode between 93% and your personal best. If no PB is available it will default to 93%. +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. JudgeCounter = Enable Judge Counter. Displays your currently obtained judgment counts. This has a moderate impact on performance. Expect about a 10% penalty to average fps. ErrorBar = Enable Error Bar. Visual representation of your judgments' deviation from the intended mark. This is about as taxing as the judge counter performance-wise, though more useful. ErrorBarLoc = Set the positioning of the error bar to center or bottom. diff --git a/Themes/Til Death/Scripts/01 player_config.lua b/Themes/Til Death/Scripts/01 player_config.lua index d96c485c4c..898427e35b 100644 --- a/Themes/Til Death/Scripts/01 player_config.lua +++ b/Themes/Til Death/Scripts/01 player_config.lua @@ -3,8 +3,8 @@ local defaultConfig = { JudgeType = 1, AvgScoreType = 0, GhostScoreType = 1, - GhostTarget = 93, TargetTracker = true, + TargetGoal = 93, TargetTrackerMode = 0, JudgeCounter = true, ErrorBar = true, diff --git a/Themes/Til Death/Scripts/02 ThemePrefs.lua b/Themes/Til Death/Scripts/02 ThemePrefs.lua index 63965b3a97..1d25f568c3 100644 --- a/Themes/Til Death/Scripts/02 ThemePrefs.lua +++ b/Themes/Til Death/Scripts/02 ThemePrefs.lua @@ -131,6 +131,47 @@ function TargetTracker() return t end +local tChoices = {} +for i=1,99 do + tChoices[i] = tostring(i)..'%' +end +for i=1,3 do + tChoices[99+i] = tostring(99+i*0.25)..'%' +end +for i=1,4 do + tChoices[#tChoices+1] = tostring(99.96 + i*0.01)..'%' +end +function TargetGoal() + local t = { + Name = "TargetGoal", + LayoutType = "ShowAllInRow", + SelectType = "SelectOne", + OneChoiceForAllPlayers = false, + ExportOnChange = true, + Choices = tChoices, + LoadSelections = function(self, list, pn) + local prefs = playerConfig:get_data(pn_to_profile_slot(pn)).TargetGoal + list[prefs] = true + end, + SaveSelections = function(self, list, pn) + local found = false + for i=1,#list do + if not found then + if list[i] == true then + local value = i + playerConfig:get_data(pn_to_profile_slot(pn)).TargetGoal = value + found = true + end + end + end + playerConfig:set_dirty(pn_to_profile_slot(pn)) + playerConfig:save(pn_to_profile_slot(pn)) + end + } + setmetatable( t, t ) + return t +end + function TargetTrackerMode() local t = { Name = "TargetTrackerMode", @@ -138,7 +179,7 @@ function TargetTrackerMode() SelectType = "SelectOne", OneChoiceForAllPlayers = false, ExportOnChange = true, - Choices = { THEME:GetString('OptionNames','93%'),'PB'}, + Choices = {'Set Percent','Personal Best'}, LoadSelections = function(self, list, pn) local pref = playerConfig:get_data(pn_to_profile_slot(pn)).TargetTrackerMode list[pref+1] = true diff --git a/Themes/Til Death/metrics.ini b/Themes/Til Death/metrics.ini index ea8cf23ece..c1c83ba61a 100644 --- a/Themes/Til Death/metrics.ini +++ b/Themes/Til Death/metrics.ini @@ -361,10 +361,11 @@ StepsTypeSetCommand=%function(self,param) \ end; \ [ScreenPlayerOptions] -LineNames="1,Rate,8,4,RS,14,5,7,10,13,JT,TT,TTM,JC,EB,PI,FB,MB,SF,LC,NPS,16,BG,Fail,Score" +LineNames="1,Rate,8,4,RS,14,5,7,10,13,JT,TT,TG,TTM,JC,EB,PI,FB,MB,SF,LC,NPS,16,BG,Fail,Score" LineRS="lua,ReceptorSize()" LineJT="lua,JudgmentText()" LineTT="lua,TargetTracker()" +LineTG="lua,TargetGoal()" LineTTM="lua,TargetTrackerMode()" LineJC="lua,JudgeCounter()" LineEB="lua,ErrorBar()" diff --git a/src/Player.cpp b/src/Player.cpp index 3b9ad1eaac..3463f04ab4 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -680,8 +680,8 @@ void Player::Load() Profile *pProfile = PROFILEMAN->GetProfile(pn); wifescorepersonalbest = pProfile->GetWifePBByKey(GAMESTATE->m_pCurSteps[pn]->GetChartKey()); if (wifescorepersonalbest == 0) - wifescorepersonalbest = 0.93f; - + wifescorepersonalbest = m_pPlayerState->playertargetgoal; + if (m_pPlayerStageStats) m_pPlayerStageStats->m_fTimingScale = m_fTimingWindowScale; @@ -3144,9 +3144,12 @@ void Player::SetMineJudgment( TapNoteScore tns , int iTrack ) curwifescore -= 8.f; msg.SetParam("WifePercent", 100 * curwifescore / maxwifescore); - msg.SetParam("WifeDifferential", curwifescore - maxwifescore*0.93f); - msg.SetParam("WifePBDifferential", curwifescore - maxwifescore*wifescorepersonalbest); + msg.SetParam("WifeDifferential", curwifescore - maxwifescore * m_pPlayerState->playertargetgoal); msg.SetParam("TotalPercent", 100 * curwifescore / totalwifescore); + if (wifescorepersonalbest != m_pPlayerState->playertargetgoal) { + msg.SetParam("WifePBDifferential", curwifescore - maxwifescore * wifescorepersonalbest); + msg.SetParam("WifePBGoal", wifescorepersonalbest); + } m_pPlayerStageStats->m_fWifeScore = curwifescore / totalwifescore; MESSAGEMAN->Broadcast( msg ); @@ -3188,9 +3191,12 @@ void Player::SetJudgment( int iRow, int iTrack, const TapNote &tn, TapNoteScore maxwifescore += 2; msg.SetParam("WifePercent", 100*curwifescore/maxwifescore); - msg.SetParam("WifeDifferential", curwifescore - maxwifescore*0.93f); - msg.SetParam("WifePBDifferential", curwifescore - maxwifescore*wifescorepersonalbest); + msg.SetParam("WifeDifferential", curwifescore - maxwifescore * m_pPlayerState->playertargetgoal); msg.SetParam("TotalPercent", 100 * curwifescore / totalwifescore); + if (wifescorepersonalbest != m_pPlayerState->playertargetgoal) { + msg.SetParam("WifePBDifferential", curwifescore - maxwifescore * wifescorepersonalbest); + msg.SetParam("WifePBGoal", wifescorepersonalbest); + } if (m_pPlayerStageStats) { m_pPlayerStageStats->m_fWifeScore = curwifescore / totalwifescore; @@ -3254,9 +3260,13 @@ void Player::SetHoldJudgment( TapNote &tn, int iTrack ) curwifescore -= 6.f; msg.SetParam("WifePercent", 100 * curwifescore / maxwifescore); - msg.SetParam("WifeDifferential", curwifescore - maxwifescore*0.93f); - msg.SetParam("WifePBDifferential", curwifescore - maxwifescore*wifescorepersonalbest); + msg.SetParam("WifeDifferential", curwifescore - maxwifescore * m_pPlayerState->playertargetgoal); msg.SetParam("TotalPercent", 100 * curwifescore / totalwifescore); + if (wifescorepersonalbest != m_pPlayerState->playertargetgoal) { + msg.SetParam("WifePBDifferential", curwifescore - maxwifescore * wifescorepersonalbest); + msg.SetParam("WifePBGoal", wifescorepersonalbest); + } + m_pPlayerStageStats->m_fWifeScore = curwifescore / totalwifescore; } diff --git a/src/Player.h b/src/Player.h index 0e56d7c390..bc70b3979a 100644 --- a/src/Player.h +++ b/src/Player.h @@ -133,7 +133,7 @@ class Player: public ActorFrame void SetLife(float value); bool m_inside_lua_set_life; - // Mina temp stuff + // Mina perma-temp stuff vector nerv; // the non empty row vector where we are somehwere in size_t nervpos = 0; // where we are in the non-empty row vector float maxwifescore = 0.0001f; // hurr /0 - Mina diff --git a/src/PlayerState.cpp b/src/PlayerState.cpp index ae1403888b..8a1b635c0c 100644 --- a/src/PlayerState.cpp +++ b/src/PlayerState.cpp @@ -268,6 +268,10 @@ class LunaPlayerState: public Luna } DEFINE_METHOD( GetHealthState, m_HealthState ); DEFINE_METHOD( GetSuperMeterLevel, m_fSuperMeter ); + static int SetTargetGoal(T* p, lua_State *L) { + p->playertargetgoal = FArg(1); + return 1; + } LunaPlayerState() { @@ -283,6 +287,7 @@ class LunaPlayerState: public Luna ADD_METHOD( GetSongPosition ); ADD_METHOD( GetHealthState ); ADD_METHOD( GetSuperMeterLevel ); + ADD_METHOD( SetTargetGoal ); } }; diff --git a/src/PlayerState.h b/src/PlayerState.h index 33ab60d2ae..c2e3faf275 100644 --- a/src/PlayerState.h +++ b/src/PlayerState.h @@ -132,6 +132,7 @@ class PlayerState /* why is the slow getstyles function called every time to get number of columns in places where it can't change? - Mina */ + float playertargetgoal = 0.93f; int m_NumCols; void SetNumCols(int ncol) { m_NumCols = ncol; }; int GetNumCols() { return m_NumCols; };