Handle a missing pad model gracefully
This commit is contained in:
@@ -62,15 +62,18 @@ ScreenHowToPlay::ScreenHowToPlay() : ScreenAttract("ScreenHowToPlay")
|
|||||||
m_LifeMeterBar.Command( LIFEBARONCOMMAND );
|
m_LifeMeterBar.Command( LIFEBARONCOMMAND );
|
||||||
m_LifeMeterBar.FillForHowToPlay( NUM_PERFECTS, NUM_MISSES );
|
m_LifeMeterBar.FillForHowToPlay( NUM_PERFECTS, NUM_MISSES );
|
||||||
|
|
||||||
if( USEPAD )
|
m_bUsingPad = (USEPAD && DoesFileExist("Characters" SLASH "DancePad-DDR.txt"));
|
||||||
|
|
||||||
|
if( m_bUsingPad )
|
||||||
{
|
{
|
||||||
m_mDancePad.LoadMilkshapeAscii("Characters" SLASH "DancePad-DDR.txt");
|
m_mDancePad.LoadMilkshapeAscii("Characters" SLASH "DancePad-DDR.txt");
|
||||||
m_mDancePad.SetRotationX( 35 );
|
m_mDancePad.SetRotationX( 35 );
|
||||||
m_mDancePad.Command( PADONCOMMAND );
|
m_mDancePad.Command( PADONCOMMAND );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display random character+pad
|
// Display random character
|
||||||
if( USECHARACTER && GAMESTATE->m_pCharacters.size() )
|
m_bUsingCharacter = (USECHARACTER && GAMESTATE->m_pCharacters.size());
|
||||||
|
if( m_bUsingCharacter )
|
||||||
{
|
{
|
||||||
Character* rndchar = GAMESTATE->GetRandomCharacter();
|
Character* rndchar = GAMESTATE->GetRandomCharacter();
|
||||||
|
|
||||||
@@ -161,69 +164,76 @@ ScreenHowToPlay::~ScreenHowToPlay()
|
|||||||
|
|
||||||
void ScreenHowToPlay::Update( float fDelta )
|
void ScreenHowToPlay::Update( float fDelta )
|
||||||
{
|
{
|
||||||
float rate = 1;
|
|
||||||
if(GAMESTATE->m_pCurSong != NULL)
|
if(GAMESTATE->m_pCurSong != NULL)
|
||||||
{
|
{
|
||||||
|
float rate = 1;
|
||||||
|
|
||||||
GAMESTATE->UpdateSongPosition( m_fFakeSecondsIntoSong );
|
GAMESTATE->UpdateSongPosition( m_fFakeSecondsIntoSong );
|
||||||
m_fFakeSecondsIntoSong += fDelta;
|
m_fFakeSecondsIntoSong += fDelta;
|
||||||
|
|
||||||
if( GAMESTATE->m_bFreeze )
|
// we want misses from beat 22.8 on out, so change to a HUMAN controller.
|
||||||
{
|
// since we aren't taking input from the user, the steps are always missed.
|
||||||
switch(int(GAMESTATE->m_fSongBeat))
|
if(GAMESTATE->m_fSongBeat > 22.8f)
|
||||||
{
|
GAMESTATE->m_PlayerController[PLAYER_1] = PC_HUMAN;
|
||||||
case 16: m_mCharacter.SetFrame(30); break;
|
|
||||||
case 18: m_mCharacter.SetFrame(85); break;
|
|
||||||
case 20: m_mCharacter.SetFrame(150); break;
|
|
||||||
case 22: m_mCharacter.SetFrame(270); break;
|
|
||||||
};
|
|
||||||
rate = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* HowToPlay animations.. This will be retimed soon to be a reasonable speed.
|
|
||||||
This was just a quick'n'dirty way of showing this screen correctly. */
|
|
||||||
// Until we get a better HowToPlay animation done, it has to be this way..
|
|
||||||
if( (GAMESTATE->m_fSongBeat >= 15.0f && GAMESTATE->m_fSongBeat <= 15.2f) )
|
|
||||||
{
|
|
||||||
m_mCharacter.SetFrame(1);
|
|
||||||
}
|
|
||||||
if( (GAMESTATE->m_fSongBeat >= 17.0f && GAMESTATE->m_fSongBeat <= 17.2f) )
|
|
||||||
{
|
|
||||||
m_mCharacter.SetFrame(55);
|
|
||||||
}
|
|
||||||
if( (GAMESTATE->m_fSongBeat >= 19.0f && GAMESTATE->m_fSongBeat <= 19.2f) )
|
|
||||||
{
|
|
||||||
m_mCharacter.SetFrame(120);
|
|
||||||
}
|
|
||||||
if( (GAMESTATE->m_fSongBeat >= 21.0f && GAMESTATE->m_fSongBeat <= 21.2f) )
|
|
||||||
{
|
|
||||||
m_mCharacter.SetFrame(240);
|
|
||||||
}
|
|
||||||
// ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
// we want misses from here on out, so change to a HUMAN controller.
|
if ( m_bUsingCharacter )
|
||||||
// since we aren't taking input from the user, the steps are always missed.
|
{
|
||||||
if(GAMESTATE->m_fSongBeat > 22.8f)
|
if( GAMESTATE->m_bFreeze )
|
||||||
GAMESTATE->m_PlayerController[PLAYER_1] = PC_HUMAN;
|
|
||||||
|
|
||||||
if( (GAMESTATE->m_fSongBeat >= 0.0f && GAMESTATE->m_fSongBeat <= 15.0f) ||
|
|
||||||
(GAMESTATE->m_fSongBeat >= 16.8f && GAMESTATE->m_fSongBeat <= 17.0f) ||
|
|
||||||
(GAMESTATE->m_fSongBeat >= 18.8f && GAMESTATE->m_fSongBeat <= 19.0f) ||
|
|
||||||
(GAMESTATE->m_fSongBeat >= 20.8f && GAMESTATE->m_fSongBeat <= 21.0f) ||
|
|
||||||
(GAMESTATE->m_fSongBeat >= 22.8f) )
|
|
||||||
{
|
{
|
||||||
if( (m_mCharacter.GetCurFrame() >=243) || (m_mCharacter.GetCurFrame() <=184) )
|
switch(int(GAMESTATE->m_fSongBeat))
|
||||||
m_mCharacter.SetFrame(184);
|
{
|
||||||
//Loop for HowToPlay static movement is 184~243
|
case 16: m_mCharacter.SetFrame(30); break;
|
||||||
} else
|
case 18: m_mCharacter.SetFrame(85); break;
|
||||||
// if we update at normal speed during a step animation, it is too slow and
|
case 20: m_mCharacter.SetFrame(150); break;
|
||||||
// doesn't finish in time.
|
case 22: m_mCharacter.SetFrame(270); break;
|
||||||
rate = 1.8f;
|
};
|
||||||
|
rate = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* HowToPlay animations.. This will be retimed soon to be a reasonable speed.
|
||||||
|
This was just a quick'n'dirty way of showing this screen correctly. */
|
||||||
|
// Until we get a better HowToPlay animation done, it has to be this way..
|
||||||
|
if( (GAMESTATE->m_fSongBeat >= 15.0f && GAMESTATE->m_fSongBeat <= 15.2f) )
|
||||||
|
{
|
||||||
|
m_mCharacter.SetFrame(1);
|
||||||
|
}
|
||||||
|
if( (GAMESTATE->m_fSongBeat >= 17.0f && GAMESTATE->m_fSongBeat <= 17.2f) )
|
||||||
|
{
|
||||||
|
m_mCharacter.SetFrame(55);
|
||||||
|
}
|
||||||
|
if( (GAMESTATE->m_fSongBeat >= 19.0f && GAMESTATE->m_fSongBeat <= 19.2f) )
|
||||||
|
{
|
||||||
|
m_mCharacter.SetFrame(120);
|
||||||
|
}
|
||||||
|
if( (GAMESTATE->m_fSongBeat >= 21.0f && GAMESTATE->m_fSongBeat <= 21.2f) )
|
||||||
|
{
|
||||||
|
m_mCharacter.SetFrame(240);
|
||||||
|
}
|
||||||
|
// ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
if( (GAMESTATE->m_fSongBeat >= 0.0f && GAMESTATE->m_fSongBeat <= 15.0f) ||
|
||||||
|
(GAMESTATE->m_fSongBeat >= 16.8f && GAMESTATE->m_fSongBeat <= 17.0f) ||
|
||||||
|
(GAMESTATE->m_fSongBeat >= 18.8f && GAMESTATE->m_fSongBeat <= 19.0f) ||
|
||||||
|
(GAMESTATE->m_fSongBeat >= 20.8f && GAMESTATE->m_fSongBeat <= 21.0f) ||
|
||||||
|
(GAMESTATE->m_fSongBeat >= 22.8f) )
|
||||||
|
{
|
||||||
|
if( (m_mCharacter.GetCurFrame() >=243) || (m_mCharacter.GetCurFrame() <=184) )
|
||||||
|
m_mCharacter.SetFrame(184);
|
||||||
|
//Loop for HowToPlay static movement is 184~243
|
||||||
|
} else
|
||||||
|
// if we update at normal speed during a step animation, it is too slow and
|
||||||
|
// doesn't finish in time.
|
||||||
|
rate = 1.8f;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_mCharacter.Update( fDelta * rate );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mCharacter.Update( fDelta * rate );
|
if( m_bUsingPad )
|
||||||
m_mDancePad.Update( fDelta );
|
m_mDancePad.Update( fDelta );
|
||||||
|
|
||||||
ScreenAttract::Update( fDelta );
|
ScreenAttract::Update( fDelta );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,19 +252,24 @@ void ScreenHowToPlay::DrawPrimitives()
|
|||||||
{
|
{
|
||||||
Screen::DrawPrimitives();
|
Screen::DrawPrimitives();
|
||||||
|
|
||||||
DISPLAY->SetLighting( true );
|
if( m_bUsingPad || m_bUsingCharacter )
|
||||||
DISPLAY->SetLightDirectional(
|
{
|
||||||
0,
|
DISPLAY->SetLighting( true );
|
||||||
RageColor(0.5,0.5,0.5,1),
|
DISPLAY->SetLightDirectional(
|
||||||
RageColor(1,1,1,1),
|
0,
|
||||||
RageColor(0,0,0,1),
|
RageColor(0.5,0.5,0.5,1),
|
||||||
RageVector3(0, 0, 1) );
|
RageColor(1,1,1,1),
|
||||||
|
RageColor(0,0,0,1),
|
||||||
|
RageVector3(0, 0, 1) );
|
||||||
|
|
||||||
m_mCharacter.Draw();
|
if( m_bUsingCharacter )
|
||||||
m_mDancePad.Draw();
|
m_mCharacter.Draw();
|
||||||
|
if( m_bUsingPad )
|
||||||
|
m_mDancePad.Draw();
|
||||||
|
|
||||||
DISPLAY->SetLightOff( 0 );
|
DISPLAY->SetLightOff( 0 );
|
||||||
DISPLAY->SetLighting( false );
|
DISPLAY->SetLighting( false );
|
||||||
|
}
|
||||||
|
|
||||||
m_Overlay.DrawPrimitives();
|
m_Overlay.DrawPrimitives();
|
||||||
m_In.DrawPrimitives();
|
m_In.DrawPrimitives();
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ protected:
|
|||||||
Player m_Player;
|
Player m_Player;
|
||||||
Model m_mCharacter;
|
Model m_mCharacter;
|
||||||
Model m_mDancePad;
|
Model m_mDancePad;
|
||||||
|
bool m_bUsingCharacter;
|
||||||
|
bool m_bUsingPad;
|
||||||
|
|
||||||
Song* m_pSong;
|
Song* m_pSong;
|
||||||
float m_fFakeSecondsIntoSong;
|
float m_fFakeSecondsIntoSong;
|
||||||
|
|||||||
Reference in New Issue
Block a user