From ba1ebe643d32508af9e576516f1a698758d3a88c Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Sun, 4 Jul 2010 10:05:27 -0500 Subject: [PATCH] add percent score on ScreenSelectMusic --- .../ScreenSelectMusic decorations/default.lua | 76 +++++++++++++++++- .../Graphics/_StepsType/Dance_Solo.png | Bin 366 -> 575 bytes .../Graphics/_StepsType/Techno_Single4.png | Bin 360 -> 371 bytes Themes/default/metrics.ini | 15 +++- 4 files changed, 86 insertions(+), 5 deletions(-) diff --git a/Themes/default/BGAnimations/ScreenSelectMusic decorations/default.lua b/Themes/default/BGAnimations/ScreenSelectMusic decorations/default.lua index 93e6e94d5c..18648aee0f 100644 --- a/Themes/default/BGAnimations/ScreenSelectMusic decorations/default.lua +++ b/Themes/default/BGAnimations/ScreenSelectMusic decorations/default.lua @@ -1,4 +1,5 @@ local t = LoadFallbackB(); + -- Legacy StepMania 4 Function local function StepsDisplay(pn) local function set(self, player) @@ -20,6 +21,71 @@ local function StepsDisplay(pn) return t; end t[#t+1] = StandardDecorationFromFileOptional("AlternateHelpDisplay","AlternateHelpDisplay"); + +local function PercentScore(pn) + local t = LoadFont("Common normal")..{ + InitCommand=cmd(zoom,0.7;shadowlength,1); + BeginCommand=cmd(playcommand,"Set"); + SetCommand=function(self) + local SongOrCourse, StepsOrTrail; + if GAMESTATE:IsCourseMode() then + SongOrCourse = GAMESTATE:GetCurrentCourse(); + StepsOrTrail = GAMESTATE:GetCurrentTrail(pn); + else + SongOrCourse = GAMESTATE:GetCurrentSong(); + StepsOrTrail = GAMESTATE:GetCurrentSteps(pn); + end; + + local profile, scorelist; + local text = ""; + if SongOrCourse and StepsOrTrail then + local st = StepsOrTrail:GetStepsType(); + local diff = StepsOrTrail:GetDifficulty(); + local courseType = GAMESTATE:IsCourseMode() and SongOrCourse:GetCourseType() or nil; + local cd = GetCustomDifficulty(st, diff, courseType); + self:diffuse(CustomDifficultyToColor(cd)); + self:shadowcolor(CustomDifficultyToDarkColor(cd)); + + if PROFILEMAN:IsPersistentProfile(pn) then + -- player profile + profile = PROFILEMAN:GetProfile(pn); + else + -- machine profile + profile = PROFILEMAN:GetMachineProfile(); + end; + + scorelist = profile:GetHighScoreList(SongOrCourse,StepsOrTrail); + assert(scorelist) + local scores = scorelist:GetHighScores(); + local topscore = scores[1]; + if topscore then + text = string.format("%.2f%%", topscore:GetPercentDP()*100.0); + -- 100% hack + if text == "100.00%" then + text = "100%"; + end; + else + text = string.format("%.2f%%", 0); + end; + else + text = ""; + end; + self:settext(text); + end; + CurrentSongChangesMessageCommand=cmd(playcommand,"Set"); + }; + + if pn == PLAYER_1 then + t.CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set"); + t.CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); + else + t.CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set"); + t.CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); + end + + return t; +end + -- Legacy StepMania 4 Function for pn in ivalues(PlayerNumber) do local MetricsName = "StepsDisplay" .. PlayerNumberToString(pn); @@ -30,14 +96,17 @@ for pn in ivalues(PlayerNumber) do self:visible(true); (cmd(zoom,0;bounceend,0.3;zoom,1))(self); end; - end; + end; PlayerUnjoinedMessageCommand=function(self, params) if params.Player == pn then self:visible(true); (cmd(bouncebegin,0.3;zoom,0))(self); end; - end; - }; + end; + }; + if ShowStandardDecoration("PercentScore"..ToEnumShortString(pn)) then + t[#t+1] = StandardDecorationFromTable("PercentScore"..ToEnumShortString(pn), PercentScore(pn)); + end; end t[#t+1] = StandardDecorationFromFileOptional("BannerFrame","BannerFrame"); @@ -45,6 +114,7 @@ t[#t+1] = StandardDecorationFromFileOptional("DifficultyList","DifficultyList"); t[#t+1] = StandardDecorationFromFileOptional("CourseContentsList","CourseContentsList"); t[#t+1] = StandardDecorationFromFileOptional("BPMDisplay","BPMDisplay"); t[#t+1] = StandardDecorationFromFileOptional("BPMLabel","BPMLabel"); + t[#t+1] = StandardDecorationFromFileOptional("SongTime","SongTime") .. { SetCommand=function(self) local curSelection = nil; diff --git a/Themes/default/Graphics/_StepsType/Dance_Solo.png b/Themes/default/Graphics/_StepsType/Dance_Solo.png index 21c41c2c82b8245c9d21808062cda48266ab2004..1aa776e3ac67d9eafbdc1c92b295e23c4a4e3c7e 100644 GIT binary patch delta 452 zcmV;#0XzQg0>1>1VhY*^1P&Az<mf! zDzvo0(b-Yg;uk1%>_>2L&`!<;KY<-er{GW;T+P@=CV7Pn2^5;aY#BsTUlXCwn!D5& ziXG~~LC8Np?*HD)aS!0XM+SS@Y&OO8V2T3eNe)h#f@)Uv9qh^+)e7?h=ns0VUKaa* zI4V9Ki~*duRxdZ8-May$WyG{D)8XzJ=W6X5YHW|(8;4ZT;+t@C2DTJC1AlG+?SeO6 z1~{psfKg%4o#=#?54jGi<!2aCk`t` z9zp9;A^inG0L5Z)^}JjzSGfr%WgsbkA_K1L!fZB6gMW)`8Yn9Kb=6xpu)giS?{C+D z=Xt-f`Y6z8s8+58e<`8B#Sw?9gBxJShcJ9qNp9%eZ#E6pGZ&s7TdSWf%Fi>8R&F#5 zdKx-9+}c+t*YBI?pdz~#!9KWF3n3xB?fR@ z&egB~RtnA# r8ns>@3m}bJua5#I_KsEDhSslimGSCVbWBPL|($*fNI@Umpv44dGsgAsY?f9ffb)ZVW?<+7mJN;G@RrFvt{OMK;)|F*=z625m$!CXGlN(ZdXA vBYKztZA3Ay8^bXT$21(%P}ThhSPTbm0-7oZZT;-~00000NkvXXu0mjfNUCof delta 234 zcmV85eftUyTpf7@$MJFD>PQ3M#}{K& zyi|~@BMsCaM*>&(+!#6{YWgH~BpbMI6m-rvLx|07*qoM6N<$g75lgzyJUM diff --git a/Themes/default/metrics.ini b/Themes/default/metrics.ini index 44a5b63067..e4c1b6c8a8 100644 --- a/Themes/default/metrics.ini +++ b/Themes/default/metrics.ini @@ -494,7 +494,7 @@ StepsTypeY=7 StepsTypeOnCommand=zoom,0.45 [StepsDisplayEdit] -Fallback="StepsDisplay" +Fallback="StepsDisplayGameplay" [StepsDisplayGameplay] Fallback="StepsDisplay" @@ -1194,7 +1194,18 @@ StepsDisplayP2Y=SCREEN_BOTTOM-60 StepsDisplayP2OnCommand=visible,THEME:GetMetric(Var "LoadingScreen","ShowStepsDisplayP2");addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y StepsDisplayP2OffCommand=bouncebegin,0.15;zoomx,0; # StepsDisplayP2CurrentStepsP2ChangedMessageCommand=stoptweening;zoom,1.2;decelerate,0.1;zoom,1 - +# +ShowPercentScoreP1=GAMESTATE:IsHumanPlayer(PLAYER_1) +PercentScoreP1X=SCREEN_CENTER_X-80 +PercentScoreP1Y=SCREEN_BOTTOM-60 +PercentScoreP1OnCommand=visible,THEME:GetMetric(Var "LoadingScreen","ShowPercentScoreP1");addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y +PercentScoreP1OffCommand=bouncebegin,0.15;zoomx,0; +# +ShowPercentScoreP2=GAMESTATE:IsHumanPlayer(PLAYER_2) +PercentScoreP2X=SCREEN_CENTER_X+160 +PercentScoreP2Y=SCREEN_BOTTOM-60 +PercentScoreP2OnCommand=visible,THEME:GetMetric(Var "LoadingScreen","ShowPercentScoreP2");addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y +PercentScoreP2OffCommand=bouncebegin,0.15;zoomx,0; [ScreenSelectCourse] #~ ScreenInitCommand=%function(self) \ #~ GAMESTATE:ApplyGameCommand("sort,AllCourses",PLAYER_1); \