From 1fdb204eb2877a17167d11897cb6ce6bcbc077cf Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Tue, 10 Aug 2010 23:36:04 -0500 Subject: [PATCH] [ScreenNetEvaluation] * Replace hardcoded rainbow effect with UserTier02OrBetterCommand. * Added Difficulty and Steps param to UpdateNetEvalStats message. The beginning of custom-themable online stuff begins. [ScreenNetSelectMusic] * Started to port SampleMusicPreviewMode from ScreenSelectMusic. * Changed MusicWheel metrics to read from OnlineMusicWheel instead. * Added section, roulette, and random music (not used yet). * Stop the music when reaching a section. [others] * some theme file additions --- .../ScreenEvaluation SurvivedNumber.redir | 1 + .../ScreenEvaluation SurvivedFrame p1.redir | 1 + .../ScreenEvaluation SurvivedFrame p2.redir | 1 + .../ScreenMiniMenuContext header.redir | 1 + .../ScreenNetSelectMusic random music.redir | 1 + .../ScreenNetSelectMusic roulette music.redir | 1 + .../ScreenNetSelectMusic section music.redir | 1 + Themes/_fallback/metrics.ini | 12 +++++ .../ScreenEvaluation decorations/default.lua | 9 +++- Themes/default/metrics.ini | 6 +++ src/ScreenNetEvaluation.cpp | 18 ++++++- src/ScreenNetEvaluation.h | 5 +- src/ScreenNetSelectMusic.cpp | 50 ++++++++++++------- src/ScreenNetSelectMusic.h | 6 +++ 14 files changed, 89 insertions(+), 24 deletions(-) create mode 100644 Themes/_fallback/Fonts/ScreenEvaluation SurvivedNumber.redir create mode 100644 Themes/_fallback/Graphics/ScreenEvaluation SurvivedFrame p1.redir create mode 100644 Themes/_fallback/Graphics/ScreenEvaluation SurvivedFrame p2.redir create mode 100644 Themes/_fallback/Graphics/ScreenMiniMenuContext header.redir create mode 100644 Themes/_fallback/Sounds/ScreenNetSelectMusic random music.redir create mode 100644 Themes/_fallback/Sounds/ScreenNetSelectMusic roulette music.redir create mode 100644 Themes/_fallback/Sounds/ScreenNetSelectMusic section music.redir diff --git a/Themes/_fallback/Fonts/ScreenEvaluation SurvivedNumber.redir b/Themes/_fallback/Fonts/ScreenEvaluation SurvivedNumber.redir new file mode 100644 index 0000000000..5c6053f7f1 --- /dev/null +++ b/Themes/_fallback/Fonts/ScreenEvaluation SurvivedNumber.redir @@ -0,0 +1 @@ +Common Normal \ No newline at end of file diff --git a/Themes/_fallback/Graphics/ScreenEvaluation SurvivedFrame p1.redir b/Themes/_fallback/Graphics/ScreenEvaluation SurvivedFrame p1.redir new file mode 100644 index 0000000000..04b2ead777 --- /dev/null +++ b/Themes/_fallback/Graphics/ScreenEvaluation SurvivedFrame p1.redir @@ -0,0 +1 @@ +_blank \ No newline at end of file diff --git a/Themes/_fallback/Graphics/ScreenEvaluation SurvivedFrame p2.redir b/Themes/_fallback/Graphics/ScreenEvaluation SurvivedFrame p2.redir new file mode 100644 index 0000000000..04b2ead777 --- /dev/null +++ b/Themes/_fallback/Graphics/ScreenEvaluation SurvivedFrame p2.redir @@ -0,0 +1 @@ +_blank \ No newline at end of file diff --git a/Themes/_fallback/Graphics/ScreenMiniMenuContext header.redir b/Themes/_fallback/Graphics/ScreenMiniMenuContext header.redir new file mode 100644 index 0000000000..04b2ead777 --- /dev/null +++ b/Themes/_fallback/Graphics/ScreenMiniMenuContext header.redir @@ -0,0 +1 @@ +_blank \ No newline at end of file diff --git a/Themes/_fallback/Sounds/ScreenNetSelectMusic random music.redir b/Themes/_fallback/Sounds/ScreenNetSelectMusic random music.redir new file mode 100644 index 0000000000..dbc8088f01 --- /dev/null +++ b/Themes/_fallback/Sounds/ScreenNetSelectMusic random music.redir @@ -0,0 +1 @@ +ScreenSelectMusic random music \ No newline at end of file diff --git a/Themes/_fallback/Sounds/ScreenNetSelectMusic roulette music.redir b/Themes/_fallback/Sounds/ScreenNetSelectMusic roulette music.redir new file mode 100644 index 0000000000..0b3f51565b --- /dev/null +++ b/Themes/_fallback/Sounds/ScreenNetSelectMusic roulette music.redir @@ -0,0 +1 @@ +ScreenSelectMusic roulette music \ No newline at end of file diff --git a/Themes/_fallback/Sounds/ScreenNetSelectMusic section music.redir b/Themes/_fallback/Sounds/ScreenNetSelectMusic section music.redir new file mode 100644 index 0000000000..c585052134 --- /dev/null +++ b/Themes/_fallback/Sounds/ScreenNetSelectMusic section music.redir @@ -0,0 +1 @@ +ScreenSelectMusic section music \ No newline at end of file diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index dedd128606..ed40270483 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -793,6 +793,14 @@ ChoiceNonstop="sort,Nonstop;playmode,nonstop;mod,bar" ChoiceOni="sort,Oni;playmode,oni;mod,battery" ChoiceEndless="sort,Endless;playmode,endless;mod,bar" ChoiceSurvival="sort,Oni;playmode,oni;mod,lifetime" + +[OnlineMusicWheel] +Fallback="MusicWheel" +# roulette + online causes a sorting issue that should be hammered out first. -aj +ShowRoulette=false +ShowRandom=false +ShowPortal=false + [MusicWheelItem] WheelNotifyIconX=106 WheelNotifyIconY=0 @@ -3594,6 +3602,8 @@ ShowStyleIcon=false TimerSeconds= TimerStealth=true +SampleMusicPreviewMode='SampleMusicPreviewMode_Normal' + # huh? (probably leftovers from the old NetSelectBase) NumStylesShow=1 NumSongsShow=4 @@ -3780,6 +3790,8 @@ UsersBG2OffCommand= UserDeSelCommand=finishtweening;linear,0.1;zoom,0.75 UserSelCommand=finishtweening;linear,0.1;zoom,1.0 +UserTier02OrBetterCommand=rainbowscroll,true + UserDX=0 UserDY=24 UserOnCommand= diff --git a/Themes/default/BGAnimations/ScreenEvaluation decorations/default.lua b/Themes/default/BGAnimations/ScreenEvaluation decorations/default.lua index e66cd12a55..cc7a3233ee 100644 --- a/Themes/default/BGAnimations/ScreenEvaluation decorations/default.lua +++ b/Themes/default/BGAnimations/ScreenEvaluation decorations/default.lua @@ -78,8 +78,13 @@ end if ShowStandardDecoration("StepsDisplay") then for pn in ivalues(PlayerNumber) do local t2 = Def.StepsDisplay { - InitCommand=cmd(Load,"StepsDisplayEvaluation",pn;SetFromGameState,pn;); - }; + InitCommand=cmd(Load,"StepsDisplayEvaluation",pn;SetFromGameState,pn;); + UpdateNetEvalStatsMessageCommand=function(self,param) + if GAMESTATE:IsPlayerEnabled(pn) then + self:SetFromSteps(param.Steps) + end; + end; + }; t[#t+1] = StandardDecorationFromTable( "StepsDisplay" .. ToEnumShortString(pn), t2 ); t[#t+1] = StandardDecorationFromTable( "PercentScore" .. ToEnumShortString(pn), PercentScore(pn) ); end diff --git a/Themes/default/metrics.ini b/Themes/default/metrics.ini index 55de76e7f4..c7137db672 100644 --- a/Themes/default/metrics.ini +++ b/Themes/default/metrics.ini @@ -1820,6 +1820,10 @@ SmallBanner6X=SCREEN_CENTER_X+72 SmallBanner6Y=SCREEN_TOP+100+24 SmallBanner6OnCommand=zoom,0.5 SmallBanner6OffCommand= + +[ScreenNetEvaluation] +UserTier02OrBetterCommand=diffuseshift;effectperiod,0.75;effectcolor1,color("1,0.95,0.8,1");effectcolor2,color("0.8,0.95,1,1") + # arcade stuff [ScreenLogo] TimerSeconds=10 @@ -1860,6 +1864,7 @@ VersionInfoOnCommand=settext,ProductVersion();horizalign,right;vertalign,bottom; ScrollerOnCommand=visible,false; ArcadeOverlay.TextY=SCREEN_BOTTOM-128 + [ScreenDemonstration] SongMeterDisplayOnCommand=visible,false SongMeterDisplayP1OnCommand=visible,false @@ -1873,6 +1878,7 @@ StepsDisplayP2OnCommand=zoomy,0;linear,0.3;zoomy,1;sleep,3;smooth,0.5;y,SCREEN_B ShowBPMDisplay=false # PlayMusic=false + # sm-ssc helper screens [ScreenHowToInstallSongs] Class="ScreenSelectMaster" diff --git a/src/ScreenNetEvaluation.cpp b/src/ScreenNetEvaluation.cpp index 9d98f784c0..03fb4286fb 100644 --- a/src/ScreenNetEvaluation.cpp +++ b/src/ScreenNetEvaluation.cpp @@ -5,6 +5,8 @@ #include "ThemeManager.h" #include "GameState.h" #include "RageLog.h" +#include "Style.h" +#include "SongUtil.h" static const int NUM_SCORE_DIGITS = 9; @@ -147,12 +149,15 @@ void ScreenNetEvaluation::HandleScreenMessage( const ScreenMessage SM ) break; m_textUsers[i].SetText( NSMAN->m_PlayerNames[NSMAN->m_EvalPlayerData[i].name] ); + // Yes, hardcoded (I'd like to leave it that way) -CNLohr (in reference to Grade_Tier03) // Themes can read this differently. The correct solution depends... // TODO: make this a server-side variable, or just find out // the data from the theme? If we find out from the theme, people // will be using different themes so it means nothing. -aj - m_textUsers[i].SetRainbowScroll( NSMAN->m_EvalPlayerData[i].grade < Grade_Tier03 ); + if( NSMAN->m_EvalPlayerData[i].grade < Grade_Tier03 ) + m_textUsers[i].PlayCommand("Tier02OrBetter"); + ON_COMMAND( m_textUsers[i] ); LOG->Trace( "SMNETCheckpoint%d", i ); } @@ -186,11 +191,13 @@ void ScreenNetEvaluation::UpdateStats() m_textScore[m_pActivePlayer].SetTargetNumber( NSMAN->m_EvalPlayerData[m_iCurrentPlayer].score ); //Values greater than 6 will cause a crash - if ( NSMAN->m_EvalPlayerData[m_iCurrentPlayer].difficulty < 6 ) + /* + if( NSMAN->m_EvalPlayerData[m_iCurrentPlayer].difficulty < 6 ) { m_DifficultyIcon[m_pActivePlayer].SetPlayer( m_pActivePlayer ); m_DifficultyIcon[m_pActivePlayer].SetFromDifficulty( NSMAN->m_EvalPlayerData[m_iCurrentPlayer].difficulty ); } + */ for( int j=0; jm_EvalPlayerData[m_iCurrentPlayer].playerOptions ); + StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; + Difficulty dc = NSMAN->m_EvalPlayerData[m_iCurrentPlayer].difficulty; + Steps *pSteps = SongUtil::GetOneSteps( GAMESTATE->m_pCurSong, st, dc ); + // broadcast a message so themes know that the active player has changed. -aj Message msg("UpdateNetEvalStats"); msg.SetParam( "ActivePlayerIndex", m_pActivePlayer ); + msg.SetParam( "Difficulty", NSMAN->m_EvalPlayerData[m_iCurrentPlayer].difficulty ); + if( pSteps ) + msg.SetParam( "Steps", pSteps ); MESSAGEMAN->Broadcast(msg); } diff --git a/src/ScreenNetEvaluation.h b/src/ScreenNetEvaluation.h index 09ec2200b3..dfeedfea86 100644 --- a/src/ScreenNetEvaluation.h +++ b/src/ScreenNetEvaluation.h @@ -4,6 +4,7 @@ #include "BitmapText.h" #include "ScreenMessage.h" #include "DifficultyIcon.h" +#include "StepsDisplay.h" class ScreenNetEvaluation: public ScreenEvaluation { @@ -28,8 +29,10 @@ protected: private: // todo: Make this an AutoActor -aj Quad m_rectUsersBG; - // todo: Make this a DifficultyDisplay -aj + + // todo: Make this a StepsDisplay -aj DifficultyIcon m_DifficultyIcon[NUM_PLAYERS]; + //StepsDisplay m_StepsDisplays[NUM_PLAYERS]; vector m_textUsers; int m_iCurrentPlayer; diff --git a/src/ScreenNetSelectMusic.cpp b/src/ScreenNetSelectMusic.cpp index 4ab46f4445..6d36ef14af 100644 --- a/src/ScreenNetSelectMusic.cpp +++ b/src/ScreenNetSelectMusic.cpp @@ -49,6 +49,8 @@ void ScreenNetSelectMusic::Init() ScreenNetSelectBase::Init(); + SAMPLE_MUSIC_PREVIEW_MODE.Load( m_sName, "SampleMusicPreviewMode" ); + FOREACH_EnabledPlayer (p) { /* @@ -69,7 +71,7 @@ void ScreenNetSelectMusic::Init() } m_MusicWheel.SetName( "MusicWheel" ); - m_MusicWheel.Load( "MusicWheel" ); + m_MusicWheel.Load( "OnlineMusicWheel" ); LOAD_ALL_COMMANDS_AND_SET_XY( m_MusicWheel ); m_MusicWheel.BeginScreen(); ON_COMMAND( m_MusicWheel ); @@ -93,9 +95,12 @@ void ScreenNetSelectMusic::Init() this->AddChild( &m_ModIconRow[p] ); } - //Load SFX next + // Load SFX and music m_soundChangeOpt.Load( THEME->GetPathS(m_sName,"change opt") ); m_soundChangeSel.Load( THEME->GetPathS(m_sName,"change sel") ); + m_sSectionMusicPath = THEME->GetPathS(m_sName,"section music"); + m_sRouletteMusicPath = THEME->GetPathS(m_sName,"roulette music"); + m_sRandomMusicPath = THEME->GetPathS(m_sName,"random music"); NSMAN->ReportNSSOnOff(1); NSMAN->ReportPlayerOptions(); @@ -268,12 +273,12 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM ) } else if( SM == SM_BackFromPlayerOptions ) { - //XXX: HACK: This will causes ScreenSelectOptions to go back here. + // XXX HACK: This will cause ScreenSelectOptions to go back here. NSMAN->ReportNSSOnOff(1); GAMESTATE->m_EditMode = EditMode_Invalid; NSMAN->ReportPlayerOptions(); - //Update changes + // Update changes FOREACH_EnabledPlayer(p) m_ModIconRow[p].SetFromGameState(); } @@ -288,7 +293,7 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM ) { switch ( NSMAN->m_SMOnlinePacket.Read1() ) { - case 0: //Room title Change + case 0: // Room title Change { RString titleSub; titleSub = NSMAN->m_SMOnlinePacket.ReadNT() + "\n"; @@ -304,8 +309,8 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM ) } done: - //Must be at end, as so it is last resort for SMOnline packets. - //If it doens't know what to do, then it'll just remove them. + // Must be at end, as so it is last resort for SMOnline packets. + // If it doesn't know what to do, then it'll just remove them. ScreenNetSelectBase::HandleScreenMessage( SM ); } @@ -318,7 +323,7 @@ void ScreenNetSelectMusic::MenuLeft( const InputEventPlus &input ) bool bLeftAndRightPressed = bLeftPressed && bRightPressed; if ( bLeftAndRightPressed ) - m_MusicWheel.ChangeSort( SORT_MODE_MENU ); + m_MusicWheel.ChangeSort( SORT_MODE_MENU ); else m_MusicWheel.Move( -1 ); } @@ -346,11 +351,10 @@ void ScreenNetSelectMusic::MenuUp( const InputEventPlus &input ) void ScreenNetSelectMusic::MenuDown( const InputEventPlus &input ) { - /*Tricky: If we have a player on player 2, and there is only - player 2, allow them to use player 1's controls to change - their difficulty. */ - /* Why? Nothing else allows that. */ - // I agree that's a fucking stupid idea -aj + /* Tricky: If we have a player on player 2, and there is only player 2, + * allow them to use player 1's controls to change their difficulty. */ + /* Why? Nothing else allows that. (-who?) */ + // I agree, that's a stupid idea -aj PlayerNumber pn = input.pn; if ( GAMESTATE->IsPlayerEnabled( PLAYER_2 ) && @@ -384,14 +388,18 @@ void ScreenNetSelectMusic::MenuDown( const InputEventPlus &input ) break; } } - //If failed to go up, loop + // If failed to go up, loop if ( i == NUM_Difficulty ) + { for (i = 0;iStopMusic(); + // xxx: it should play the menu music instead. -aj return; } m_BPMDisplay.SetBpmFromSong( GAMESTATE->m_pCurSong ); @@ -559,13 +570,14 @@ void ScreenNetSelectMusic::MusicChanged() } UpdateDifficulties( pn ); } - //Copied from ScreenSelectMusic + + // Copied from ScreenSelectMusic + // TODO: Update me! -aj SOUND->StopMusic(); if( GAMESTATE->m_pCurSong->HasMusic() ) { if(SOUND->GetMusicPath().CompareNoCase(GAMESTATE->m_pCurSong->GetMusicPath())) // dont play the same sound over and over { - SOUND->StopMusic(); SOUND->PlayMusic( GAMESTATE->m_pCurSong->GetMusicPath(), diff --git a/src/ScreenNetSelectMusic.h b/src/ScreenNetSelectMusic.h index da8c5211b5..7f9e79abad 100644 --- a/src/ScreenNetSelectMusic.h +++ b/src/ScreenNetSelectMusic.h @@ -58,6 +58,12 @@ protected: void MusicChanged(); void TweenOffScreen(); + + ThemeMetric SAMPLE_MUSIC_PREVIEW_MODE; + RString m_sSectionMusicPath; + RString m_sRouletteMusicPath; + RString m_sRandomMusicPath; + private: MusicWheel m_MusicWheel;