BeginnerHelper fixes:
change IsPlayerEnabled() to IsHumanPlayer() check to see if we can use the BeginnerHelper before attempting to use it. Disable BeginnerHelper for non-Dance game types.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include <math.h> // for fmodf
|
||||
#include "DancingCharacters.h"
|
||||
#include "arch/arch.h"
|
||||
#include "BeginnerHelper.h"
|
||||
|
||||
|
||||
const float FADE_SECONDS = 1.0f;
|
||||
@@ -68,16 +69,11 @@ Background::Background()
|
||||
bool bOneOrMoreChars = false;
|
||||
bool bShowingBeginnerHelper = false;
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
if( GAMESTATE->IsPlayerEnabled(p) )
|
||||
if( GAMESTATE->IsHumanPlayer(p) )
|
||||
{
|
||||
bOneOrMoreChars = true;
|
||||
|
||||
// if playing dance magic mode vs. the CPU, skip next condition
|
||||
if (GAMESTATE->m_PlayMode == PLAY_MODE_RAVE)
|
||||
continue;
|
||||
|
||||
//Disable dancing characters if BH will be showing.
|
||||
if( (PREFSMAN->m_bShowBeginnerHelper) || (GAMESTATE->m_pCurNotes[p]->GetDifficulty() == DIFFICULTY_BEGINNER ) )
|
||||
if( (PREFSMAN->m_bShowBeginnerHelper) && BeginnerHelper::CanUse() && (GAMESTATE->m_pCurNotes[p]->GetDifficulty() == DIFFICULTY_BEGINNER ) )
|
||||
bShowingBeginnerHelper = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,10 +77,20 @@ void BeginnerHelper::AddPlayer( int pn, NoteData *pNotes )
|
||||
m_NoteData[pn].CopyAll( pNotes );
|
||||
}
|
||||
|
||||
void BeginnerHelper::Initialize( int iDancePadType )
|
||||
bool BeginnerHelper::CanUse()
|
||||
{
|
||||
return ((GAMESTATE->m_CurGame == GAME_DANCE) &&
|
||||
(DoesFileExist("Characters" SLASH "DancePad-DDR.txt")) &&
|
||||
(DoesFileExist("Characters" SLASH "DancePads-DDR.txt")) );
|
||||
}
|
||||
|
||||
bool BeginnerHelper::Initialize( int iDancePadType )
|
||||
{
|
||||
ASSERT( !m_bInitialized );
|
||||
|
||||
if (!CanUse()) // if we can't be used, bail now.
|
||||
return false;
|
||||
|
||||
// Load the StepCircle, Background, and flash animation
|
||||
m_sBackground.Load( THEME->GetPathToG("BeginnerHelper background") );
|
||||
m_sBackground.SetXY( CENTER_X, CENTER_Y);
|
||||
@@ -97,21 +107,29 @@ void BeginnerHelper::Initialize( int iDancePadType )
|
||||
}*/
|
||||
|
||||
// Load the DancePad
|
||||
switch(iDancePadType)
|
||||
{
|
||||
case 0: break; // No pad
|
||||
case 1:
|
||||
if (!DoesFileExist("Characters" SLASH "DancePad-DDR.txt") )
|
||||
return false; // can't initialize without the required pad model. bail
|
||||
m_mDancePad.LoadMilkshapeAscii( "Characters" SLASH "DancePad-DDR.txt" );
|
||||
break;
|
||||
case 2:
|
||||
if (!DoesFileExist("Characters" SLASH "DancePads-DDR.txt") )
|
||||
return false; // can't initialize without the required pad model. bail
|
||||
m_mDancePad.LoadMilkshapeAscii( "Characters" SLASH "DancePads-DDR.txt" );
|
||||
break;
|
||||
}
|
||||
m_mDancePad.SetHorizAlign( align_left );
|
||||
m_mDancePad.SetRotationX( DANCEPAD_ANGLE );
|
||||
m_mDancePad.SetX(HELPER_X);
|
||||
m_mDancePad.SetY(HELPER_Y);
|
||||
m_mDancePad.SetZoom( 23 ); // Pad should always be 3 units bigger in zoom than the dancer.
|
||||
switch(iDancePadType)
|
||||
{
|
||||
case 0: break; // No pad
|
||||
case 1:m_mDancePad.LoadMilkshapeAscii( "Characters" SLASH "DancePad-DDR.txt" ); break;
|
||||
case 2:m_mDancePad.LoadMilkshapeAscii( "Characters" SLASH "DancePads-DDR.txt" ); break;
|
||||
}
|
||||
|
||||
for( int pl=0; pl<NUM_PLAYERS; pl++ ) // Load players
|
||||
{
|
||||
if( !GAMESTATE->IsPlayerEnabled(pl))
|
||||
if( !GAMESTATE->IsHumanPlayer(pl))
|
||||
continue;
|
||||
|
||||
// if there is no character set, try loading a random one.
|
||||
@@ -144,7 +162,7 @@ void BeginnerHelper::Initialize( int iDancePadType )
|
||||
}
|
||||
}
|
||||
|
||||
m_bInitialized = true;
|
||||
return (m_bInitialized = true);
|
||||
}
|
||||
|
||||
void BeginnerHelper::FlashOnce()
|
||||
@@ -178,7 +196,7 @@ void BeginnerHelper::DrawPrimitives()
|
||||
m_sStepCircle[scd].Draw(); // Should be drawn before the dancer, but after the pad, so it is drawn over the pad and under the dancer.
|
||||
|
||||
for( int pn=0; pn<NUM_PLAYERS; pn++ ) // Draw each dancer
|
||||
if( GAMESTATE->IsPlayerEnabled(pn) )
|
||||
if( GAMESTATE->IsHumanPlayer(pn) )
|
||||
m_mDancer[pn].Draw();
|
||||
|
||||
DISPLAY->SetLightOff( 0 );
|
||||
@@ -189,7 +207,7 @@ void BeginnerHelper::Step( int pn, int CSTEP )
|
||||
{
|
||||
LOG->Trace( "BeginnerHelper::Step()" );
|
||||
// First make sure this player is on beginner mode and enabled... The difficulty check may be redundant, tho.
|
||||
if( (GAMESTATE->IsPlayerEnabled(pn)) && (GAMESTATE->m_pCurNotes[pn]->GetDifficulty() == DIFFICULTY_BEGINNER) )
|
||||
if( (GAMESTATE->IsHumanPlayer(pn)) && (GAMESTATE->m_pCurNotes[pn]->GetDifficulty() == DIFFICULTY_BEGINNER) )
|
||||
{
|
||||
ShowStepCircle( pn, CSTEP);
|
||||
m_mDancer[pn].StopTweening();
|
||||
@@ -226,7 +244,7 @@ void BeginnerHelper::Update( float fDeltaTime )
|
||||
|
||||
for(int pn = 0; pn < NUM_PLAYERS; pn++ )
|
||||
{
|
||||
if( !( GAMESTATE->IsPlayerEnabled(pn) && GAMESTATE->m_pCurNotes[pn]->GetDifficulty() == DIFFICULTY_BEGINNER) )
|
||||
if( !( GAMESTATE->IsHumanPlayer(pn) && GAMESTATE->m_pCurNotes[pn]->GetDifficulty() == DIFFICULTY_BEGINNER) )
|
||||
continue; // skip
|
||||
|
||||
if( (m_NoteData[pn].IsThereATapAtRow( BeatToNoteRowNotRounded((GAMESTATE->m_fSongBeat+0.01f)) ) ) )
|
||||
@@ -261,7 +279,7 @@ void BeginnerHelper::Update( float fDeltaTime )
|
||||
|
||||
for( int pu=0; pu<NUM_PLAYERS; pu++ )
|
||||
{
|
||||
if(!GAMESTATE->IsPlayerEnabled(pu))
|
||||
if(!GAMESTATE->IsHumanPlayer(pu))
|
||||
continue;
|
||||
|
||||
m_mDancer[pu].Update( beat ); //Update dancers
|
||||
|
||||
@@ -27,7 +27,9 @@ public:
|
||||
ActorFrame m_afDancerSuite; // So we can easily rotate or whatever without disturbing the Background.
|
||||
|
||||
void FlashOnce();
|
||||
void Initialize( int iDancePadType );
|
||||
bool Initialize( int iDancePadType );
|
||||
bool IsInitialized() { return m_bInitialized; }
|
||||
static bool CanUse();
|
||||
void AddPlayer( int pn, NoteData *pNotes );
|
||||
void SetFlash(CString sFilename, float fX, float fY);
|
||||
void ShowStepCircle( int pn, int CSTEP );
|
||||
|
||||
@@ -779,25 +779,23 @@ void ScreenGameplay::LoadNextSong()
|
||||
|
||||
// Check to see if any players are in beginner mode.
|
||||
// Note: steps can be different if turn modifiers are used.
|
||||
if( PREFSMAN->m_bShowBeginnerHelper )
|
||||
if( PREFSMAN->m_bShowBeginnerHelper && BeginnerHelper::CanUse())
|
||||
{
|
||||
bool anybeginners = false;
|
||||
|
||||
for( int pb=0; pb<NUM_PLAYERS; pb++ )
|
||||
if( GAMESTATE->IsPlayerEnabled(pb) && GAMESTATE->m_pCurNotes[pb]->GetDifficulty() == DIFFICULTY_BEGINNER )
|
||||
if( GAMESTATE->IsHumanPlayer(pb) && GAMESTATE->m_pCurNotes[pb]->GetDifficulty() == DIFFICULTY_BEGINNER )
|
||||
{
|
||||
anybeginners = true;
|
||||
m_BeginnerHelper.AddPlayer( pb, &m_Player[pb] );
|
||||
}
|
||||
|
||||
if(anybeginners)
|
||||
if(anybeginners && m_BeginnerHelper.Initialize( 2 )) // Init for doubles
|
||||
{
|
||||
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 );
|
||||
m_Background.Unload(); // BeginnerHelper has it's own BG control.
|
||||
m_Background.StopAnimating();
|
||||
m_BeginnerHelper.SetX( CENTER_X );
|
||||
m_BeginnerHelper.SetY( CENTER_Y );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user