From 114e28a1d3c426a5d1b26f7dae50ae5f96fbabea Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Mon, 27 Dec 2010 00:08:52 -0600 Subject: [PATCH] [ScreenHowToPlay] Added CharacterName metric, which will force the Character that shows up. --- Docs/Changelog_sm-ssc.txt | 5 +++++ Themes/_fallback/metrics.ini | 1 + src/ScreenHowToPlay.cpp | 38 ++++++++++++++++++++---------------- src/ScreenHowToPlay.h | 11 ++++------- 4 files changed, 31 insertions(+), 24 deletions(-) diff --git a/Docs/Changelog_sm-ssc.txt b/Docs/Changelog_sm-ssc.txt index d6fdf13946..c145598a62 100644 --- a/Docs/Changelog_sm-ssc.txt +++ b/Docs/Changelog_sm-ssc.txt @@ -13,6 +13,11 @@ _____________________________________________________________________________ sm-ssc v1.2 | 201012xx -------------------------------------------------------------------------------- +20101227 +-------- +* [ScreenHowToPlay] Added CharacterName metric, which will force the Character + that shows up. [freem] + 20101226 -------- * [ScreenEdit] Added GetEditState Lua binding. [freem] diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 339c442eee..3f6de4c871 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -4006,6 +4006,7 @@ LifeMeterBarY=SCREEN_TOP+40 LifeMeterBarOnCommand=addy,-60;sleep,2.4;linear,0.2;addy,60 # UseCharacter=true +CharacterName="" CharacterX=SCREEN_CENTER_X-200 CharacterY=SCREEN_CENTER_Y+160 CharacterOnCommand=zoom,20;addy,-SCREEN_WIDTH;sleep,3.0;decelerate,0.4;addy,SCREEN_WIDTH diff --git a/src/ScreenHowToPlay.cpp b/src/ScreenHowToPlay.cpp index 5b621e136d..1429e1b077 100644 --- a/src/ScreenHowToPlay.cpp +++ b/src/ScreenHowToPlay.cpp @@ -20,9 +20,10 @@ static const ThemeMetric NUM_W2S ("ScreenHowToPlay","NumW2s"); static const ThemeMetric NUM_MISSES ("ScreenHowToPlay","NumMisses"); -static const ThemeMetric USE_CHARACTER ("ScreenHowToPlay","UseCharacter"); -static const ThemeMetric USE_PAD ("ScreenHowToPlay","UsePad"); -static const ThemeMetric USE_PLAYER ("ScreenHowToPlay","UsePlayer"); +static const ThemeMetric USE_CHARACTER ("ScreenHowToPlay","UseCharacter"); +static const ThemeMetric USE_PAD ("ScreenHowToPlay","UsePad"); +static const ThemeMetric USE_PLAYER ("ScreenHowToPlay","UsePlayer"); +static const ThemeMetric CHARACTER_NAME("ScreenHowToPlay","CharacterName"); enum Animation { @@ -47,7 +48,6 @@ static const RString anims[NUM_ANIMATIONS] = "BeginnerHelper_step-jumplr.bones.txt" }; - static RString GetAnimPath( Animation a ) { return RString("Characters/") + anims[a]; @@ -86,34 +86,38 @@ void ScreenHowToPlay::Init() m_pmDancePad->SetRotationX( 35 ); LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_pmDancePad ); } - + // Display random character vector vpCharacters; CHARMAN->GetCharacters( vpCharacters ); if( (bool)USE_CHARACTER && vpCharacters.size() && HaveAllCharAnimations() ) { - Character* rndchar = CHARMAN->GetRandomCharacter(); + Character* displayChar; + if( !CHARACTER_NAME.GetValue().empty() && CHARMAN->GetCharacterFromID(CHARACTER_NAME) ) + displayChar = CHARMAN->GetCharacterFromID(CHARACTER_NAME); + else + displayChar = CHARMAN->GetRandomCharacter(); - RString sModelPath = rndchar->GetModelPath(); + RString sModelPath = displayChar->GetModelPath(); if( sModelPath != "" ) { m_pmCharacter = new Model; m_pmCharacter->SetName( "Character" ); - m_pmCharacter->LoadMilkshapeAscii( rndchar->GetModelPath() ); + m_pmCharacter->LoadMilkshapeAscii( displayChar->GetModelPath() ); m_pmCharacter->LoadMilkshapeAsciiBones( "Step-LEFT", GetAnimPath( ANIM_LEFT ) ); m_pmCharacter->LoadMilkshapeAsciiBones( "Step-DOWN", GetAnimPath( ANIM_DOWN ) ); m_pmCharacter->LoadMilkshapeAsciiBones( "Step-UP", GetAnimPath( ANIM_UP ) ); m_pmCharacter->LoadMilkshapeAsciiBones( "Step-RIGHT", GetAnimPath( ANIM_RIGHT ) ); m_pmCharacter->LoadMilkshapeAsciiBones( "Step-JUMPLR", GetAnimPath( ANIM_JUMPLR ) ); - RString sRestFile = rndchar->GetRestAnimationPath(); + RString sRestFile = displayChar->GetRestAnimationPath(); ASSERT( !sRestFile.empty() ); - m_pmCharacter->LoadMilkshapeAsciiBones( "rest",rndchar->GetRestAnimationPath() ); + m_pmCharacter->LoadMilkshapeAsciiBones( "rest",displayChar->GetRestAnimationPath() ); m_pmCharacter->SetDefaultAnimation( "rest" ); - m_pmCharacter->PlayAnimation( "rest" ); // Stay bouncing after a step has finished animating. + m_pmCharacter->PlayAnimation( "rest" ); // Stay bouncing after a step has finished animating. // xxx: hardcoded rotation -freem m_pmCharacter->SetRotationX( 40 ); - m_pmCharacter->SetCullMode( CULL_NONE ); // many of the models floating around have the vertex order flipped + m_pmCharacter->SetCullMode( CULL_NONE ); // many of the models floating around have the vertex order flipped LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_pmCharacter ); } } @@ -189,6 +193,7 @@ ScreenHowToPlay::~ScreenHowToPlay() void ScreenHowToPlay::Step() { +// xxx: assumes dance. -freem #define ST_LEFT 0x01 #define ST_DOWN 0x02 #define ST_UP 0x04 @@ -251,9 +256,9 @@ void ScreenHowToPlay::Update( float fDelta ) iLastNoteRowCounted = iCurNoteRow; } - // once we hit the number of perfects we want, we want to fail. - // switch the controller to HUMAN. since we aren't taking input, - // the steps will always be misses. + // Once we hit the number of perfects we want, we want to fail. Switch + // the controller to HUMAN. Since we aren't taking input, the steps will + // always be misses. if( m_iW2s > m_iNumW2s ) GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_HUMAN; @@ -268,7 +273,7 @@ void ScreenHowToPlay::HandleScreenMessage( const ScreenMessage SM ) { if( SM == SM_GainFocus ) { - /* We do this ourself. */ + // We do this ourself. SOUND->HandleSongTimer( false ); } else if( SM == SM_LoseFocus ) @@ -282,7 +287,6 @@ void ScreenHowToPlay::HandleScreenMessage( const ScreenMessage SM ) ScreenAttract::HandleScreenMessage( SM ); } - // lua start #include "LuaBinding.h" diff --git a/src/ScreenHowToPlay.h b/src/ScreenHowToPlay.h index 55acfd43c9..d3eb7a6a65 100644 --- a/src/ScreenHowToPlay.h +++ b/src/ScreenHowToPlay.h @@ -14,24 +14,21 @@ public: ScreenHowToPlay(); virtual void Init(); ~ScreenHowToPlay(); - + virtual void Update( float fDelta ); virtual void HandleScreenMessage( const ScreenMessage SM ); - // // Lua - // virtual void PushSelf( lua_State *L ); - - LifeMeterBar *m_pLifeMeterBar; + protected: virtual void Step(); PlayerPlus m_Player; Model *m_pmCharacter; Model *m_pmDancePad; - int m_iW2s; - int m_iNumW2s; + int m_iW2s; + int m_iNumW2s; Song m_Song; NoteData m_NoteData; float m_fFakeSecondsIntoSong;