[ScreenHowToPlay] Added CharacterName metric, which will force the Character that shows up.

This commit is contained in:
AJ Kelly
2010-12-27 00:08:52 -06:00
parent 4f5f4b92d0
commit 114e28a1d3
4 changed files with 31 additions and 24 deletions
+5
View File
@@ -13,6 +13,11 @@ _____________________________________________________________________________
sm-ssc v1.2 | 201012xx sm-ssc v1.2 | 201012xx
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
20101227
--------
* [ScreenHowToPlay] Added CharacterName metric, which will force the Character
that shows up. [freem]
20101226 20101226
-------- --------
* [ScreenEdit] Added GetEditState Lua binding. [freem] * [ScreenEdit] Added GetEditState Lua binding. [freem]
+1
View File
@@ -4006,6 +4006,7 @@ LifeMeterBarY=SCREEN_TOP+40
LifeMeterBarOnCommand=addy,-60;sleep,2.4;linear,0.2;addy,60 LifeMeterBarOnCommand=addy,-60;sleep,2.4;linear,0.2;addy,60
# #
UseCharacter=true UseCharacter=true
CharacterName=""
CharacterX=SCREEN_CENTER_X-200 CharacterX=SCREEN_CENTER_X-200
CharacterY=SCREEN_CENTER_Y+160 CharacterY=SCREEN_CENTER_Y+160
CharacterOnCommand=zoom,20;addy,-SCREEN_WIDTH;sleep,3.0;decelerate,0.4;addy,SCREEN_WIDTH CharacterOnCommand=zoom,20;addy,-SCREEN_WIDTH;sleep,3.0;decelerate,0.4;addy,SCREEN_WIDTH
+20 -16
View File
@@ -20,9 +20,10 @@
static const ThemeMetric<int> NUM_W2S ("ScreenHowToPlay","NumW2s"); static const ThemeMetric<int> NUM_W2S ("ScreenHowToPlay","NumW2s");
static const ThemeMetric<int> NUM_MISSES ("ScreenHowToPlay","NumMisses"); static const ThemeMetric<int> NUM_MISSES ("ScreenHowToPlay","NumMisses");
static const ThemeMetric<bool> USE_CHARACTER ("ScreenHowToPlay","UseCharacter"); static const ThemeMetric<bool> USE_CHARACTER ("ScreenHowToPlay","UseCharacter");
static const ThemeMetric<bool> USE_PAD ("ScreenHowToPlay","UsePad"); static const ThemeMetric<bool> USE_PAD ("ScreenHowToPlay","UsePad");
static const ThemeMetric<bool> USE_PLAYER ("ScreenHowToPlay","UsePlayer"); static const ThemeMetric<bool> USE_PLAYER ("ScreenHowToPlay","UsePlayer");
static const ThemeMetric<RString> CHARACTER_NAME("ScreenHowToPlay","CharacterName");
enum Animation enum Animation
{ {
@@ -47,7 +48,6 @@ static const RString anims[NUM_ANIMATIONS] =
"BeginnerHelper_step-jumplr.bones.txt" "BeginnerHelper_step-jumplr.bones.txt"
}; };
static RString GetAnimPath( Animation a ) static RString GetAnimPath( Animation a )
{ {
return RString("Characters/") + anims[a]; return RString("Characters/") + anims[a];
@@ -92,28 +92,32 @@ void ScreenHowToPlay::Init()
CHARMAN->GetCharacters( vpCharacters ); CHARMAN->GetCharacters( vpCharacters );
if( (bool)USE_CHARACTER && vpCharacters.size() && HaveAllCharAnimations() ) 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 != "" ) if( sModelPath != "" )
{ {
m_pmCharacter = new Model; m_pmCharacter = new Model;
m_pmCharacter->SetName( "Character" ); 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-LEFT", GetAnimPath( ANIM_LEFT ) );
m_pmCharacter->LoadMilkshapeAsciiBones( "Step-DOWN", GetAnimPath( ANIM_DOWN ) ); m_pmCharacter->LoadMilkshapeAsciiBones( "Step-DOWN", GetAnimPath( ANIM_DOWN ) );
m_pmCharacter->LoadMilkshapeAsciiBones( "Step-UP", GetAnimPath( ANIM_UP ) ); m_pmCharacter->LoadMilkshapeAsciiBones( "Step-UP", GetAnimPath( ANIM_UP ) );
m_pmCharacter->LoadMilkshapeAsciiBones( "Step-RIGHT", GetAnimPath( ANIM_RIGHT ) ); m_pmCharacter->LoadMilkshapeAsciiBones( "Step-RIGHT", GetAnimPath( ANIM_RIGHT ) );
m_pmCharacter->LoadMilkshapeAsciiBones( "Step-JUMPLR", GetAnimPath( ANIM_JUMPLR ) ); m_pmCharacter->LoadMilkshapeAsciiBones( "Step-JUMPLR", GetAnimPath( ANIM_JUMPLR ) );
RString sRestFile = rndchar->GetRestAnimationPath(); RString sRestFile = displayChar->GetRestAnimationPath();
ASSERT( !sRestFile.empty() ); ASSERT( !sRestFile.empty() );
m_pmCharacter->LoadMilkshapeAsciiBones( "rest",rndchar->GetRestAnimationPath() ); m_pmCharacter->LoadMilkshapeAsciiBones( "rest",displayChar->GetRestAnimationPath() );
m_pmCharacter->SetDefaultAnimation( "rest" ); 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 // xxx: hardcoded rotation -freem
m_pmCharacter->SetRotationX( 40 ); 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 ); LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_pmCharacter );
} }
} }
@@ -189,6 +193,7 @@ ScreenHowToPlay::~ScreenHowToPlay()
void ScreenHowToPlay::Step() void ScreenHowToPlay::Step()
{ {
// xxx: assumes dance. -freem
#define ST_LEFT 0x01 #define ST_LEFT 0x01
#define ST_DOWN 0x02 #define ST_DOWN 0x02
#define ST_UP 0x04 #define ST_UP 0x04
@@ -251,9 +256,9 @@ void ScreenHowToPlay::Update( float fDelta )
iLastNoteRowCounted = iCurNoteRow; iLastNoteRowCounted = iCurNoteRow;
} }
// once we hit the number of perfects we want, we want to fail. // Once we hit the number of perfects we want, we want to fail. Switch
// switch the controller to HUMAN. since we aren't taking input, // the controller to HUMAN. Since we aren't taking input, the steps will
// the steps will always be misses. // always be misses.
if( m_iW2s > m_iNumW2s ) if( m_iW2s > m_iNumW2s )
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_HUMAN; GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_HUMAN;
@@ -268,7 +273,7 @@ void ScreenHowToPlay::HandleScreenMessage( const ScreenMessage SM )
{ {
if( SM == SM_GainFocus ) if( SM == SM_GainFocus )
{ {
/* We do this ourself. */ // We do this ourself.
SOUND->HandleSongTimer( false ); SOUND->HandleSongTimer( false );
} }
else if( SM == SM_LoseFocus ) else if( SM == SM_LoseFocus )
@@ -282,7 +287,6 @@ void ScreenHowToPlay::HandleScreenMessage( const ScreenMessage SM )
ScreenAttract::HandleScreenMessage( SM ); ScreenAttract::HandleScreenMessage( SM );
} }
// lua start // lua start
#include "LuaBinding.h" #include "LuaBinding.h"
+3 -6
View File
@@ -18,20 +18,17 @@ public:
virtual void Update( float fDelta ); virtual void Update( float fDelta );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
//
// Lua // Lua
//
virtual void PushSelf( lua_State *L ); virtual void PushSelf( lua_State *L );
LifeMeterBar *m_pLifeMeterBar; LifeMeterBar *m_pLifeMeterBar;
protected: protected:
virtual void Step(); virtual void Step();
PlayerPlus m_Player; PlayerPlus m_Player;
Model *m_pmCharacter; Model *m_pmCharacter;
Model *m_pmDancePad; Model *m_pmDancePad;
int m_iW2s; int m_iW2s;
int m_iNumW2s; int m_iNumW2s;
Song m_Song; Song m_Song;
NoteData m_NoteData; NoteData m_NoteData;
float m_fFakeSecondsIntoSong; float m_fFakeSecondsIntoSong;