From 562aa9877b64702e65d8ccbc1e08e877ebb5e8a8 Mon Sep 17 00:00:00 2001 From: Thad Ward Date: Wed, 27 Aug 2003 13:36:22 +0000 Subject: [PATCH] make BeginnerHelper capable of handling turn modifiers. --- stepmania/src/BeginnerHelper.cpp | 102 +++++++++++++++++-------------- stepmania/src/BeginnerHelper.h | 9 +-- stepmania/src/ScreenGameplay.cpp | 40 +++++++----- 3 files changed, 86 insertions(+), 65 deletions(-) diff --git a/stepmania/src/BeginnerHelper.cpp b/stepmania/src/BeginnerHelper.cpp index b52564a541..dced3688f9 100644 --- a/stepmania/src/BeginnerHelper.cpp +++ b/stepmania/src/BeginnerHelper.cpp @@ -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= 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; pIsPlayerEnabled(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; km_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; km_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 ); diff --git a/stepmania/src/BeginnerHelper.h b/stepmania/src/BeginnerHelper.h index 52ec3c4b76..d194d99e81 100644 --- a/stepmania/src/BeginnerHelper.h +++ b/stepmania/src/BeginnerHelper.h @@ -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; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 7eda30e3c9..c90c399277 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -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; pbIsPlayerEnabled(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; pbIsPlayerEnabled(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 {