Example #1
0
static bool HaveAllCharAnimations()
{
	for( int i = ANIM_UP; i < NUM_ANIMATIONS; ++i )
		if( !DoesFileExist( GetAnimPath( (Animation) i ) ) )
			return false;
	return true;
}
Example #2
0
bool BeginnerHelper::CanUse()
{
	for (int i=0; i<NUM_ANIMATIONS; ++i )
		if( !DoesFileExist(GetAnimPath((Animation)i)) )
			return false;

	return GAMESTATE->GetCurrentStyle()->m_bCanUseBeginnerHelper;
}
Example #3
0
bool BeginnerHelper::CanUse(PlayerNumber pn)
{
	for (int i=0; i<NUM_ANIMATIONS; ++i )
		if( !DoesFileExist(GetAnimPath((Animation)i)) )
			return false;

	// This does not pass PLAYER_INVALID to GetCurrentStyle because that would
	// only check the first non-nullptr style.  Both styles need to be checked. -Kyz
	if(pn == PLAYER_INVALID)
	{
		return GAMESTATE->GetCurrentStyle(PLAYER_1)->m_bCanUseBeginnerHelper ||
			GAMESTATE->GetCurrentStyle(PLAYER_2)->m_bCanUseBeginnerHelper;
	}
	return GAMESTATE->GetCurrentStyle(pn)->m_bCanUseBeginnerHelper;
}
Example #4
0
bool BeginnerHelper::Init( int iDancePadType )
{
	ASSERT( !m_bInitialized );
	if( !CanUse() )
		return false;

	// If no players were successfully added, bail.
	{
		bool bAnyLoaded = false;
		for( int pn=0; pn<NUM_PLAYERS; pn++ )
			if( m_bPlayerEnabled[pn] )
				bAnyLoaded = true;

		if( !bAnyLoaded )
			return false;
	}

	// Load the Background and flash. Flash only shows if the BG does.
	if( m_bShowBackground )
	{
		m_sBackground.Load( THEME->GetPathG("BeginnerHelper","background") );
		this->AddChild( m_sBackground );
		//m_sBackground.SetXY( 1, 1 );

		m_sFlash.Load( THEME->GetPathG("BeginnerHelper","flash") );
		m_sFlash.SetXY( 0, 0 );
		m_sFlash.SetDiffuseAlpha( 0 );
	}

	// Load StepCircle graphics
	for( int lsc=0; lsc<NUM_PLAYERS; lsc++ )
	{
		for( int lsce=0; lsce<4; lsce++ )
		{
			m_sStepCircle[lsc][lsce].Load( THEME->GetPathG("BeginnerHelper","stepcircle") );
			m_sStepCircle[lsc][lsce].SetZoom( 0 );	// Hide until needed.
			this->AddChild(&m_sStepCircle[lsc][lsce]);

			// Set StepCircle coordinates
			switch( lsce )
			{
			case 0: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)-80),HELPER_Y);	break;	// Left
			case 1: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)+80),HELPER_Y);	break;	// Right
			case 2: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y-60));	break;	// Up
			case 3: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y+60));	break;	// Down
			}
		}
	}

	SHOW_DANCE_PAD.Load( "BeginnerHelper","ShowDancePad" );
	// Load the DancePad
	if( SHOW_DANCE_PAD )
	{
		switch( iDancePadType )
		{
		case 0: break; // No pad
		case 1: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PAD)); break;
		case 2: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PADS)); break;
		}

		m_pDancePad->SetName("DancePad");
		m_pDancePad->SetX( HELPER_X );
		m_pDancePad->SetY( HELPER_Y );
		ActorUtil::LoadAllCommands( m_pDancePad, "BeginnerHelper" );
	}

	for( int pl=0; pl<NUM_PLAYERS; pl++ )	// Load players
	{
		// Skip if not enabled
		if( !m_bPlayerEnabled[pl] )
			continue;

		// Load character data
		const Character *Character = GAMESTATE->m_pCurCharacters[pl];
		ASSERT( Character != NULL );

		m_pDancer[pl]->SetName( ssprintf("PlayerP%d",pl+1) );

		// Load textures
		m_pDancer[pl]->LoadMilkshapeAscii( Character->GetModelPath() );

		// Load needed animations
		m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-LEFT",	GetAnimPath(ANIM_LEFT) );
		m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-DOWN",	GetAnimPath(ANIM_DOWN) );
		m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-UP", 	GetAnimPath(ANIM_UP) );
		m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-RIGHT", 	GetAnimPath(ANIM_RIGHT) );
		m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-JUMPLR", 	GetAnimPath(ANIM_JUMPLR) );
		m_pDancer[pl]->LoadMilkshapeAsciiBones( "rest",		Character->GetRestAnimationPath() );
		m_pDancer[pl]->SetDefaultAnimation( "rest" );		// Stay bouncing after a step has finished animating
		m_pDancer[pl]->PlayAnimation( "rest" );
		m_pDancer[pl]->SetX( HELPER_X+PLAYER_X(pl) );
		m_pDancer[pl]->SetY( HELPER_Y+10 );
		ActorUtil::LoadAllCommandsAndOnCommand( m_pDancer[pl], "BeginnerHelper" );
		// many of the models floating around have the vertex order flipped, so force this.
		m_pDancer[pl]->SetCullMode( CULL_NONE );
	}

	m_bInitialized = true;
	return true;
}
Example #5
0
void ScreenHowToPlay::Init()
{
	ScreenAttract::Init();

	if( (bool)USE_PAD && DoesFileExist( GetAnimPath(ANIM_DANCE_PAD) ) )
	{
		m_pmDancePad = new Model;
		m_pmDancePad->SetName( "Pad" );
		m_pmDancePad->LoadMilkshapeAscii( GetAnimPath(ANIM_DANCE_PAD) );
		m_pmDancePad->SetRotationX( 35 );
		LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_pmDancePad );
	}
	
	// Display random character
	vector<Character*> vpCharacters;
	CHARMAN->GetCharacters( vpCharacters );
	if( (bool)USE_CHARACTER && vpCharacters.size() && HaveAllCharAnimations() )
	{
		Character* rndchar = CHARMAN->GetRandomCharacter();

		RString sModelPath = rndchar->GetModelPath();
		if( sModelPath != "" )
		{
			m_pmCharacter = new Model;
			m_pmCharacter->SetName( "Character" );
			m_pmCharacter->LoadMilkshapeAscii( rndchar->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();
			ASSERT( !sRestFile.empty() );
			m_pmCharacter->LoadMilkshapeAsciiBones( "rest",rndchar->GetRestAnimationPath() );
			m_pmCharacter->SetDefaultAnimation( "rest" );
			m_pmCharacter->PlayAnimation( "rest" );				// Stay bouncing after a step has finished animating.
			
			m_pmCharacter->SetRotationX( 40 );
			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 );
		}
	}
	
	GAMESTATE->SetCurrentStyle( GAMEMAN->GetHowToPlayStyleForGame(GAMESTATE->m_pCurGame) );

	if( USE_PLAYER )
	{
		m_pLifeMeterBar = new LifeMeterBar;
		m_pLifeMeterBar->SetName("LifeMeterBar");
		m_pLifeMeterBar->Load( GAMESTATE->m_pPlayerState[PLAYER_1], &STATSMAN->m_CurStageStats.m_player[PLAYER_1] );
		LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_pLifeMeterBar );
		m_pLifeMeterBar->FillForHowToPlay( NUM_W2S, NUM_MISSES );


		SMLoader::LoadFromSMFile( THEME->GetPathO(m_sName, "steps"), m_Song, false );
		m_Song.AddAutoGenNotes();

		const Style* pStyle = GAMESTATE->GetCurrentStyle();
		
		Steps *pSteps = SongUtil::GetStepsByDescription( &m_Song, pStyle->m_StepsType, "" );
		ASSERT_M( pSteps != NULL, ssprintf("%i", pStyle->m_StepsType) );

		NoteData tempNoteData;
		pSteps->GetNoteData( tempNoteData );
		pStyle->GetTransformedNoteDataForStyle( PLAYER_1, tempNoteData, m_NoteData );

		GAMESTATE->m_pCurSong.Set( &m_Song );
		GAMESTATE->m_bGameplayLeadIn.Set( false );
		GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_AUTOPLAY;

		m_Player->Init( 
			"Player",
			GAMESTATE->m_pPlayerState[PLAYER_1], 
			NULL,
			m_pLifeMeterBar, 
			NULL, 
			NULL, 
			NULL, 
			NULL, 
			NULL, 
			NULL );
		m_Player.Load( m_NoteData );
		m_Player->SetName( "Player" );
		this->AddChild( m_Player );
		LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_Player );

		// Don't show judgement
		PO_GROUP_ASSIGN( GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions, ModsLevel_Stage, m_fBlind, 1.0f );
		GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
		GAMESTATE->m_bDemonstrationOrJukebox = true;
	}

	// deferred until after the player, so the notes go under it
	if( m_pLifeMeterBar )
		this->AddChild( m_pLifeMeterBar );
	if( m_pmDancePad )
		this->AddChild( m_pmDancePad );
	if( m_pmCharacter )
		this->AddChild( m_pmCharacter );

	m_fFakeSecondsIntoSong = 0;

	this->MoveToTail( &m_In );
	this->MoveToTail( &m_Out );
}
Example #6
0
bool BeginnerHelper::Initialize( int iDancePadType )
{
	ASSERT( !m_bInitialized );
	if(!CanUse())
		return false;

	// If no players were successfully added, bail.
	{
		bool bAnyLoaded = false;
		for(int pn=0; pn<NUM_PLAYERS; pn++)
			if(m_bPlayerEnabled[pn])
				bAnyLoaded = true;

		if(!bAnyLoaded)
			return false;
	}
	
	// Load the Background and flash.. Flash only shows if the BG does.
	if(m_bShowBackground)
	{
		m_sBackground.Load( THEME->GetPathG("BeginnerHelper","background") );
		this->AddChild(&m_sBackground);
		m_sBackground.SetXY(1,1);
		m_sFlash.Load(THEME->GetPathG("BeginnerHelper","flash"));
		m_sFlash.SetXY(0,0);
		m_sFlash.SetDiffuseAlpha(0);
	}
	
	// Load StepCircle graphics
	for(int lsc=0; lsc<NUM_PLAYERS; lsc++)
		for(int lsce=0; lsce<4; lsce++)
		{
			m_sStepCircle[lsc][lsce].Load(THEME->GetPathG("BeginnerHelper","stepcircle"));
			m_sStepCircle[lsc][lsce].SetZoom(0);	// Hide until needed.
			this->AddChild(&m_sStepCircle[lsc][lsce]);
			
			// Set coordinates of StepCircle
			switch(lsce)
			{
				case 0: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)-80),HELPER_Y);	break;	// Left
				case 1: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)+80),HELPER_Y);	break;	// Right
				case 2: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y-60));	break;	// Up
				case 3: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y+60));	break;	// Down
			}
		}

	// Load the DancePad
	switch(iDancePadType)
	{
		case 0: break; // No pad
		case 1: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PAD)); break;
		case 2: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PADS)); break;
	}
	
	m_pDancePad->SetHorizAlign( align_left );
	m_pDancePad->SetRotationX( DANCEPAD_ANGLE );
	m_pDancePad->SetX(HELPER_X);
	m_pDancePad->SetY(HELPER_Y);
	m_pDancePad->SetZoom(23);	// Pad should always be 3 units bigger in zoom than the dancer.

	for( int pl=0; pl<NUM_PLAYERS; pl++ )	// Load players
	{
		// Skip if not enabled
		if(!m_bPlayerEnabled[pl])
			continue;

		// Load character data
		const Character *Character = GAMESTATE->m_pCurCharacters[pl];
		ASSERT( Character != NULL );

		// Load textures
		m_pDancer[pl]->SetHorizAlign( align_left );
		m_pDancer[pl]->LoadMilkshapeAscii( Character->GetModelPath() );

		// Load needed animations
		m_pDancer[pl]->LoadMilkshapeAsciiBones("Step-LEFT",		GetAnimPath(ANIM_LEFT));
		m_pDancer[pl]->LoadMilkshapeAsciiBones("Step-DOWN",		GetAnimPath(ANIM_DOWN));
		m_pDancer[pl]->LoadMilkshapeAsciiBones("Step-UP", 		GetAnimPath(ANIM_UP));
		m_pDancer[pl]->LoadMilkshapeAsciiBones("Step-RIGHT", 	GetAnimPath(ANIM_RIGHT));
		m_pDancer[pl]->LoadMilkshapeAsciiBones("Step-JUMPLR", 	GetAnimPath(ANIM_JUMPLR));
		m_pDancer[pl]->LoadMilkshapeAsciiBones("rest",			Character->GetRestAnimationPath());
		m_pDancer[pl]->SetDefaultAnimation("rest");
		m_pDancer[pl]->PlayAnimation("rest");
		m_pDancer[pl]->SetRotationX(PLAYER_ANGLE);
		m_pDancer[pl]->SetX(HELPER_X+PLAYER_X(pl));
		m_pDancer[pl]->SetY(HELPER_Y+10);
		m_pDancer[pl]->SetZoom(20);
		m_pDancer[pl]->SetCullMode(CULL_NONE);	// many of the DDR PC character models have the vertex order flipped
		m_pDancer[pl]->m_bRevertToDefaultAnimation = true;		// Stay bouncing after a step has finished animating->
	}

	m_bInitialized = true;
	return true;
}