From f3bb67917cb028398484aab4178289021bdf294c Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 21 Dec 2008 09:18:36 +0000 Subject: [PATCH] CustomDifficulty fixup --- .../ScreenHighScores decorations/default.lua | 7 +++-- .../ScreenHighScores underlay/default.lua | 4 --- .../ScreenHowToPlay decorations/default.lua | 2 +- .../ScreenHighScores ScrollerItem/default.lua | 21 +++++++------- stepmania/Themes/default/Scripts/Other.lua | 11 ++++--- stepmania/Themes/default/metrics.ini | 29 +++++++++++-------- stepmania/src/Difficulty.cpp | 6 +++- stepmania/src/StepsDisplay.cpp | 13 +++++---- 8 files changed, 49 insertions(+), 44 deletions(-) delete mode 100644 stepmania/Themes/default/BGAnimations/ScreenHighScores underlay/default.lua diff --git a/stepmania/Themes/default/BGAnimations/ScreenHighScores decorations/default.lua b/stepmania/Themes/default/BGAnimations/ScreenHighScores decorations/default.lua index 313159df52..d9ced2f5e2 100644 --- a/stepmania/Themes/default/BGAnimations/ScreenHighScores decorations/default.lua +++ b/stepmania/Themes/default/BGAnimations/ScreenHighScores decorations/default.lua @@ -14,10 +14,11 @@ for i=1,NumColumns do InitCommand=cmd(x,SCREEN_CENTER_X-60 + 80 * (i-1);y,SCREEN_CENTER_Y-154;); }; - local d = THEME:GetMetric(Var "LoadingScreen","ColumnDifficulty" .. i); local st = THEME:GetMetric(Var "LoadingScreen","ColumnStepsType" .. i); + local dc = THEME:GetMetric(Var "LoadingScreen","ColumnDifficulty" .. i); + local s = GetCustomDifficulty( st, dc ); t[#t+1] = LoadFont("_venacti Bold 13px") .. { - InitCommand=cmd(settext,"EASY";diffuse,color("#FFFF00");x,SCREEN_CENTER_X-60 + 80 * (i-1);y,SCREEN_CENTER_Y-158;shadowlength,0;); + InitCommand=cmd(uppercase,true;settext,GetLocalizedCustomDifficulty(s);diffuse,CustomDifficultyToColor(s);x,SCREEN_CENTER_X-60 + 80 * (i-1);y,SCREEN_CENTER_Y-158;shadowlength,0;); }; end @@ -26,6 +27,6 @@ t[#t+1] = LoadFont("_terminator two 24px") .. { }; t[#t+1] = LoadFont("_terminator two 30px") .. { - InitCommand=cmd(settext,"Best Ranking";uppercase,true;diffuse,color("#FFFFFF");x,SCREEN_CENTER_X-130;y,SCREEN_CENTER_Y-206;shadowlength,0;strokecolor,color("#3b009c44");); + InitCommand=cmd(settext,"Best Scores";uppercase,true;diffuse,color("#FFFFFF");x,SCREEN_CENTER_X-130;y,SCREEN_CENTER_Y-206;shadowlength,0;strokecolor,color("#3b009c44");); }; return t; \ No newline at end of file diff --git a/stepmania/Themes/default/BGAnimations/ScreenHighScores underlay/default.lua b/stepmania/Themes/default/BGAnimations/ScreenHighScores underlay/default.lua deleted file mode 100644 index afe47defed..0000000000 --- a/stepmania/Themes/default/BGAnimations/ScreenHighScores underlay/default.lua +++ /dev/null @@ -1,4 +0,0 @@ -return LoadFont("common normal") .. { - Text = "Best Ranking", - InitCommand = cmd(horizalign,'HorizAlign_Left';x,SCREEN_LEFT+48;y,SCREEN_TOP+32;shadowlength,0) -} diff --git a/stepmania/Themes/default/BGAnimations/ScreenHowToPlay decorations/default.lua b/stepmania/Themes/default/BGAnimations/ScreenHowToPlay decorations/default.lua index 2153b86551..41af83aecc 100644 --- a/stepmania/Themes/default/BGAnimations/ScreenHowToPlay decorations/default.lua +++ b/stepmania/Themes/default/BGAnimations/ScreenHowToPlay decorations/default.lua @@ -32,7 +32,7 @@ end return Def.ActorFrame { LoadActor("how to play") .. { - OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;diffusealpha,0;zoom,4;sleep,0.0;linear,0.5;diffusealpha,1;zoom,1.5;sleep,1.7;linear,0.5;zoom,1;addx,160;addy,-150;draworder,1;); + OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;diffusealpha,0;zoom,4;sleep,0.0;linear,0.3;diffusealpha,1;zoom,1.8;sleep,1.7;linear,0.3;zoom,1;addx,160;addy,-150;draworder,1;); }; ExplanationText( "When the arrows rise to this point, step on the matching panels.", 5, 9 ); diff --git a/stepmania/Themes/default/Graphics/ScreenHighScores ScrollerItem/default.lua b/stepmania/Themes/default/Graphics/ScreenHighScores ScrollerItem/default.lua index 42a9809bde..afd7106e45 100644 --- a/stepmania/Themes/default/Graphics/ScreenHighScores ScrollerItem/default.lua +++ b/stepmania/Themes/default/Graphics/ScreenHighScores ScrollerItem/default.lua @@ -8,7 +8,7 @@ t[#t+1] = LoadActor("frame") .. { t[#t+1] = Def.TextBanner { - InitCommand=cmd(x,-224;y,0;Load,"TextBanner";); + InitCommand=cmd(x,-196;y,0;Load,"TextBannerHighScores";); SetCommand=function(self, params) if params.Song then self:SetFromSong( params.Song ); @@ -59,9 +59,9 @@ Scores.SetCommand=function(self, params) for name, child in pairs(c) do child:visible(false); end - --for idx=1,NumColumns do - -- c[idx .. "Empty"]:visible(true); - --end + for idx=1,NumColumns do + c[idx .. "Empty"]:visible(true); + end local Current = params.Song or params.Course; if Current then @@ -81,17 +81,16 @@ Scores.SetCommand=function(self, params) --assert( c[sNameType], sNameType ); --assert( c[sScoreType], sScoreType ); + name:visible( true ); + score:visible( true ); + filled:visible( true ); + empty:visible( false ); if hs and #hs > 0 then - name:visible( true ); - score:visible( true ); - filled:visible( true ); - empty:visible( false ); name:settext( hs[1]:GetName() ); score:settext( FormatPercentScore( hs[1]:GetPercentDP() ) ); else - empty:visible( true ); - --name:settext( sNoScoreName ); - --score:settext( FormatPercentScore( 0 ) ); + name:settext( sNoScoreName ); + score:settext( FormatPercentScore( 0 ) ); end end end; diff --git a/stepmania/Themes/default/Scripts/Other.lua b/stepmania/Themes/default/Scripts/Other.lua index ef207d3434..2469e87c12 100644 --- a/stepmania/Themes/default/Scripts/Other.lua +++ b/stepmania/Themes/default/Scripts/Other.lua @@ -110,16 +110,15 @@ function TextBannerAfterSet(self,param) local Title=self:GetChild("Title"); local Subtitle=self:GetChild("Subtitle"); --local Artist=self:GetChild("Artist"); - local edge_x = 120; if Subtitle:GetText() == "" then - (cmd(maxwidth,300;x,edge_x;y,0;zoom,1.1;))(Title); + (cmd(maxwidth,300;y,0;zoom,1.1;))(Title); (cmd(visible,false))(Subtitle); - --(cmd(zoom,0.66;maxwidth,300;x,edge_x;y,7))(Artist); + --(cmd(zoom,0.66;maxwidth,300;y,7))(Artist); else -- subtitle below - (cmd(zoom,1;x,edge_x;y,-6;zoom,1.0;))(Title); - (cmd(visible,true;zoom,0.6;x,edge_x;y,7))(Subtitle); - --(cmd(zoom,0.66;maxwidth,300;x,edge_x;y,9))(Artist); + (cmd(zoom,1;y,-6;zoom,1.0;))(Title); + (cmd(visible,true;zoom,0.6;y,7))(Subtitle); + --(cmd(zoom,0.66;maxwidth,300;y,9))(Artist); end end diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 164f11675d..1a92755441 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -903,11 +903,11 @@ ScoreFrameX=SCREEN_CENTER_X ScoreFrameY=SCREEN_BOTTOM ScoreFrameOnCommand=vertalign,bottom;addy,100;linear,0.5;addy,-100;draworder,2 ScoreFrameOffCommand=linear,0.5;addy,100 -ScoreP1X=SCREEN_CENTER_X-226 +ScoreP1X=SCREEN_CENTER_X-220 ScoreP1Y=SCREEN_CENTER_Y+200 ScoreP1OnCommand=addy,100;linear,1;addy,-100;draworder,109; ScoreP1OffCommand=linear,1;addy,100; -ScoreP2X=SCREEN_CENTER_X+226 +ScoreP2X=SCREEN_CENTER_X+220 ScoreP2Y=SCREEN_CENTER_Y+200 ScoreP2OnCommand=addy,100;linear,1;addy,-100;draworder,109; ScoreP2OffCommand=linear,1;addy,100; @@ -2017,13 +2017,13 @@ FrameX=0 FrameY=0 FrameOnCommand= FrameLoadCommand=%function(self,param) local bFlip = param.PlayerState and param.PlayerState:GetPlayerNumber() ~= PLAYER_1; self:zoomx(bFlip and -1 or 1); end -FrameSetCommand=%function(self,param) if param.Difficulty then self:diffuse(DifficultyDisplayTypeToColor(param.DifficultyDisplayType)) end end +FrameSetCommand=%function(self,param) if param.Difficulty then self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)) end end NumTicks=10 MaxTicks=14 TicksX=0 TicksY=0 TicksOnCommand=shadowlength,0;stoke -TicksSetCommand=%function(self,param) self:diffuse(DifficultyDisplayTypeToColor(param.DifficultyDisplayType)) if param.Meter > 9 then self:glowshift() else self:stopeffect() end end +TicksSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)) if param.Meter > 9 then self:glowshift() else self:stopeffect() end end ShowTicks=false ShowMeter=true ZeroMeterString="?" @@ -2063,7 +2063,7 @@ FrameOnCommand= ShowTicks=true NumTicks=13 MaxTicks=13 -TicksSetCommand=%function(self,param) self:diffuse(DifficultyDisplayTypeToColor(param.DifficultyDisplayType)); end +TicksSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); end TicksX=0 TicksY=0 TicksOnCommand=shadowlength,0;shadowcolor,color("#FFFFFF"); @@ -2072,15 +2072,15 @@ ZeroMeterString="?" MeterX=92 MeterY=-1 MeterOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077"); -MeterSetCommand=%function(self,param) self:diffuse(DifficultyDisplayTypeToColor(param.DifficultyDisplayType)); end +MeterSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); end ShowDescription=true DescriptionX=-110 DescriptionY=-1 DescriptionOnCommand=uppercase,true;shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077");maxwidth,150; -DescriptionSetCommand=%function(self,param) self:diffuse(DifficultyDisplayTypeToColor(param.DifficultyDisplayType)); end +DescriptionSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); end AutogenX=102 AutogenOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077"); -AutogenSetCommand=%function(self,param) self:diffuse(DifficultyDisplayTypeToColor(param.DifficultyDisplayType)); end +AutogenSetCommand=%function(self,param) self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); end [StepsDisplayGameplay] Fallback="StepsDisplay" @@ -2547,8 +2547,8 @@ HoldJudgmentHeldCommand=shadowlength,0;diffusealpha,1;zoom,1.25;linear,0.3;zoomx [Combo] ShowComboAt=2 -LabelOnCommand=x,SCREEN_CENTER_X-314;y,SCREEN_CENTER_Y-220;shadowlength,0;HorizAlign,left;vertalign,bottom -NumberOnCommand=y,SCREEN_CENTER_Y-216;shadowlength,0;HorizAlign,right;vertalign,bottom +LabelOnCommand=x,SCREEN_CENTER_X-314;y,SCREEN_CENTER_Y-220;shadowlength,0;horizalign,left;vertalign,bottom +NumberOnCommand=y,SCREEN_CENTER_Y-216;shadowlength,0;horizalign,right;vertalign,bottom NumberMinZoom=0.5 NumberMaxZoom=0.8 NumberMaxZoomAt=200 @@ -3521,12 +3521,17 @@ LineNames="1" Line1="lua,OptionsRowTest()" [TextBanner] -TitleOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");horizalign,right -SubtitleOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");horizalign,right +TitleOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");horizalign,right;x,120; +SubtitleOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");horizalign,right;x,120; ArtistOnCommand=visible,false ArtistPrependString="/" AfterSetCommand=%TextBannerAfterSet +[TextBannerHighScores] +Fallback="TextBanner" +TitleOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");horizalign,center; +SubtitleOnCommand=shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#000000");horizalign,center; + [TextBannerCourseEntry] Fallback="TextBanner" TitleX=-90 diff --git a/stepmania/src/Difficulty.cpp b/stepmania/src/Difficulty.cpp index 9b5c4cffb8..5872a6a4bc 100644 --- a/stepmania/src/Difficulty.cpp +++ b/stepmania/src/Difficulty.cpp @@ -105,7 +105,7 @@ RString GetCustomDifficulty( StepsType st, Difficulty dc ) if( DIFFICULTY == Difficulty_Invalid || dc == DIFFICULTY ) // match { ThemeMetric STRING("CustomDifficulty",(*sName)+"String"); - return STRING; + return STRING.GetValue(); } } } @@ -118,11 +118,15 @@ RString GetCustomDifficulty( StepsType st, Difficulty dc ) } } +LuaFunction( GetCustomDifficulty, GetCustomDifficulty(Enum::Check(L,1),Enum::Check(L, 2)) ); + RString GetLocalizedCustomDifficulty( const RString &sCustomDifficulty ) { return THEME->GetString( "CustomDifficulty", sCustomDifficulty ); } +LuaFunction( GetLocalizedCustomDifficulty, GetLocalizedCustomDifficulty(SArg(1)) ); + /* * (c) 2001-2004 Chris Danford diff --git a/stepmania/src/StepsDisplay.cpp b/stepmania/src/StepsDisplay.cpp index fdcf1d8fb8..b784c8cdf6 100644 --- a/stepmania/src/StepsDisplay.cpp +++ b/stepmania/src/StepsDisplay.cpp @@ -181,10 +181,6 @@ void StepsDisplay::SetFromStepsTypeAndMeterAndCourseDifficulty( StepsType st, in void StepsDisplay::SetInternal( const SetParams ¶ms ) { - RString sCustomDifficulty ; - if( params.st != StepsType_Invalid ) - sCustomDifficulty = GetCustomDifficulty( params.st, params.dc ); - Message msg( "Set" ); if( params.pSteps ) msg.SetParam( "Steps", LuaReference::CreateFromPush(*(Steps*)params.pSteps) ); @@ -195,7 +191,12 @@ void StepsDisplay::SetInternal( const SetParams ¶ms ) msg.SetParam( "Difficulty", params.dc ); msg.SetParam( "IsCourseDifficulty", params.bIsCourseDifficulty ); msg.SetParam( "Description", params.sDescription ); - msg.SetParam( "CustomDifficulty", sCustomDifficulty ); + RString sCustomDifficulty; + if( params.st != StepsType_Invalid ) + { + sCustomDifficulty = GetCustomDifficulty( params.st, params.dc ); + msg.SetParam( "CustomDifficulty", sCustomDifficulty ); + } m_sprFrame->HandleMessage( msg ); @@ -236,7 +237,7 @@ void StepsDisplay::SetInternal( const SetParams ¶ms ) { if( params.pSteps && params.pSteps->IsAnEdit() ) s = params.sDescription; - else + else if( !sCustomDifficulty.empty() ) s = GetLocalizedCustomDifficulty( sCustomDifficulty ); }