make BeginnerHelper capable of handling turn modifiers.

This commit is contained in:
Thad Ward
2003-08-27 13:36:22 +00:00
parent 81d46e3178
commit 562aa9877b
3 changed files with 86 additions and 65 deletions
+56 -46
View File
@@ -37,7 +37,7 @@ BeginnerHelper::~BeginnerHelper()
LOG->Trace("BeginnerHelper::~BeginnerHelper()");
}
void BeginnerHelper::ShowStepCircle( int CSTEP )
void BeginnerHelper::ShowStepCircle( int pn, int CSTEP )
{
/*for( int ps=0; ps<NUM_PLAYERS; ps++ )
{
@@ -66,11 +66,18 @@ void BeginnerHelper::SetFlash( CString sFilename, float fX, float fY )
m_sFlash.SetY(fY);
}
void BeginnerHelper::Initialize( int iDancePadType, NoteData *pNotes )
void BeginnerHelper::AddPlayer( int pn, NoteData *pNotes )
{
// Copy the note data
ASSERT(pNotes != NULL);
m_NoteData.CopyAll(pNotes);
ASSERT( !m_bInitialized );
ASSERT( pNotes != NULL );
ASSERT( pn >= 0 && pn < NUM_PLAYERS);
m_NoteData[pn].CopyAll( pNotes );
}
void BeginnerHelper::Initialize( int iDancePadType )
{
ASSERT( !m_bInitialized );
// Load the StepCircle, Background, and flash animation
m_sBackground.Load( THEME->GetPathToG("BeginnerHelper background") );
@@ -173,36 +180,33 @@ void BeginnerHelper::DrawPrimitives()
DISPLAY->SetLighting( false );
}
void BeginnerHelper::Step( int CSTEP )
void BeginnerHelper::Step( int pn, int CSTEP )
{
LOG->Trace( "BeginnerHelper::Step()" );
for( int p=0; p<NUM_PLAYERS; p++ )
// First make sure this player is on beginner mode and enabled... The difficulty check may be redundant, tho.
if( (GAMESTATE->IsPlayerEnabled(pn)) && (GAMESTATE->m_PreferredDifficulty[pn] == DIFFICULTY_BEGINNER) )
{
// First make sure this player is on beginner mode and enabled... The difficulty check may be redundant, tho.
if( (GAMESTATE->IsPlayerEnabled(p)) && (GAMESTATE->m_PreferredDifficulty[p] == DIFFICULTY_BEGINNER) )
ShowStepCircle( pn, CSTEP);
m_mDancer[pn].StopTweening();
m_mDancer[pn].SetRotationY(0); // Make sure we're not still inside of a JUMPUD tween.
switch( CSTEP )
{
ShowStepCircle(CSTEP);
m_mDancer[p].StopTweening();
m_mDancer[p].SetRotationY(0); // Make sure we're not still inside of a JUMPUD tween.
switch( CSTEP )
{
case ST_LEFT: m_mDancer[p].PlayAnimation( "Step-LEFT" ); break;
case ST_RIGHT: m_mDancer[p].PlayAnimation( "Step-RIGHT" ); break;
case ST_UP: m_mDancer[p].PlayAnimation( "Step-UP" ); break;
case ST_DOWN: m_mDancer[p].PlayAnimation( "Step-DOWN" ); break;
case ST_JUMPLR: m_mDancer[p].PlayAnimation( "Step-JUMPLR" ); break;
case ST_JUMPUD:
// Until I can get an UP+DOWN jump animation, this will have to do.
m_mDancer[p].PlayAnimation( "Step-JUMPLR" );
m_mDancer[p].StopTweening();
m_mDancer[p].BeginTweening( GAMESTATE->m_fCurBPS /8, TWEEN_LINEAR );
m_mDancer[p].SetRotationY( 90 );
m_mDancer[p].BeginTweening( (1/GAMESTATE->m_fCurBPS) ); //sleep between jump-frames
m_mDancer[p].BeginTweening( GAMESTATE->m_fCurBPS /6, TWEEN_LINEAR );
m_mDancer[p].SetRotationY( 0 );
break;
}
case ST_LEFT: m_mDancer[pn].PlayAnimation( "Step-LEFT" ); break;
case ST_RIGHT: m_mDancer[pn].PlayAnimation( "Step-RIGHT" ); break;
case ST_UP: m_mDancer[pn].PlayAnimation( "Step-UP" ); break;
case ST_DOWN: m_mDancer[pn].PlayAnimation( "Step-DOWN" ); break;
case ST_JUMPLR: m_mDancer[pn].PlayAnimation( "Step-JUMPLR" ); break;
case ST_JUMPUD:
// Until I can get an UP+DOWN jump animation, this will have to do.
m_mDancer[pn].PlayAnimation( "Step-JUMPLR" );
m_mDancer[pn].StopTweening();
m_mDancer[pn].BeginTweening( GAMESTATE->m_fCurBPS /8, TWEEN_LINEAR );
m_mDancer[pn].SetRotationY( 90 );
m_mDancer[pn].BeginTweening( (1/GAMESTATE->m_fCurBPS) ); //sleep between jump-frames
m_mDancer[pn].BeginTweening( GAMESTATE->m_fCurBPS /6, TWEEN_LINEAR );
m_mDancer[pn].SetRotationY( 0 );
break;
}
}
}
@@ -214,23 +218,29 @@ void BeginnerHelper::Update( float fDeltaTime )
float beat = fDeltaTime * GAMESTATE->m_fCurBPS;
int iStep = 0;
if( (m_NoteData.IsThereATapAtRow( BeatToNoteRowNotRounded((GAMESTATE->m_fSongBeat+0.01f)) ) ) )
FlashOnce();
if((m_NoteData.IsThereATapAtRow( BeatToNoteRowNotRounded((GAMESTATE->m_fSongBeat+0.5f)))))
for(int pn = 0; pn < NUM_PLAYERS; pn++ )
{
for( int k=0; k<m_NoteData.GetNumTracks(); k++ )
if( m_NoteData.GetTapNote(k, BeatToNoteRowNotRounded((GAMESTATE->m_fSongBeat+0.5f)) ) == TAP_TAP )
{
switch(k)
if( (!GAMESTATE->IsPlayerEnabled(pn)) || (GAMESTATE->m_PreferredDifficulty[pn] != DIFFICULTY_BEGINNER) )
continue; // skip
int iStep = 0;
if( (m_NoteData[pn].IsThereATapAtRow( BeatToNoteRowNotRounded((GAMESTATE->m_fSongBeat+0.01f)) ) ) )
FlashOnce();
if((m_NoteData[pn].IsThereATapAtRow( BeatToNoteRowNotRounded((GAMESTATE->m_fSongBeat+0.5f)))))
{
for( int k=0; k<m_NoteData[pn].GetNumTracks(); k++ )
if( m_NoteData[pn].GetTapNote(k, BeatToNoteRowNotRounded((GAMESTATE->m_fSongBeat+0.5f)) ) == TAP_TAP )
{
case 0: iStep += 6; break;
case 1: iStep += 3; break;
case 2: iStep += 8; break;
case 3: iStep += 4; break;
};
}
Step( iStep );
switch(k)
{
case 0: iStep += 6; break;
case 1: iStep += 3; break;
case 2: iStep += 8; break;
case 3: iStep += 4; break;
};
}
Step( pn, iStep );
}
}
ActorFrame::Update( fDeltaTime );
+5 -4
View File
@@ -27,10 +27,11 @@ public:
ActorFrame m_afDancerSuite; // So we can easily rotate or whatever without disturbing the Background.
void FlashOnce();
void Initialize( int iDancePadType, NoteData *pNotes );
void Initialize( int iDancePadType );
void AddPlayer( int pn, NoteData *pNotes );
void SetFlash(CString sFilename, float fX, float fY);
void ShowStepCircle( int CSTEP );
void Step( int CSTEP );
void ShowStepCircle( int pn, int CSTEP );
void Step( int pn, int CSTEP );
void TurnFlashOff();
void TurnFlashOn();
@@ -38,7 +39,7 @@ public:
virtual void DrawPrimitives();
protected:
NoteData m_NoteData;
NoteData m_NoteData[NUM_PLAYERS];
Model m_mDancer[NUM_PLAYERS];
Model m_mDancePad;
Sprite m_sFlash;
+25 -15
View File
@@ -777,22 +777,32 @@ void ScreenGameplay::LoadNextSong()
/* Set up song-specific graphics. */
// Beginner steps are always the same on both players.. Just get the # of 1 player that's using the Beginner steps, and go on.
int pn = -1;
for( int pb=0; pb<NUM_PLAYERS; pb++ )
if( GAMESTATE->IsPlayerEnabled(pb) && GAMESTATE->m_PreferredDifficulty[pb] == DIFFICULTY_BEGINNER )
pn = pb;
/* TODO: fall back on m_Background if nobody is on beginner. */
if( PREFSMAN->m_bShowBeginnerHelper && pn != -1)
// Check to see if any players are in beginner mode.
// Note: steps can be different if turn modifiers are used.
if( PREFSMAN->m_bShowBeginnerHelper )
{
m_Background.Unload(); // BeginnerHelper has it's own BG control.
m_Background.StopAnimating();
//m_BeginnerHelper.m_bEnabled = true; // Not yet implemented
m_BeginnerHelper.Initialize( 2, &m_Player[pn] ); // Init for doubles
m_BeginnerHelper.SetX( CENTER_X );
m_BeginnerHelper.SetY( CENTER_Y );
bool anybeginners = false;
for( int pb=0; pb<NUM_PLAYERS; pb++ )
if( GAMESTATE->IsPlayerEnabled(pb) && GAMESTATE->m_PreferredDifficulty[pb] == DIFFICULTY_BEGINNER )
{
anybeginners = true;
m_BeginnerHelper.AddPlayer( pb, &m_Player[pb] );
}
if(anybeginners)
{
m_Background.Unload(); // BeginnerHelper has it's own BG control.
m_Background.StopAnimating();
m_BeginnerHelper.Initialize( 2 ); // Init for doubles
m_BeginnerHelper.SetX( CENTER_X );
m_BeginnerHelper.SetY( CENTER_Y );
}
else
{
m_Background.LoadFromSong( GAMESTATE->m_pCurSong );
}
}
else
{