From 5afed9c413c1940ba3a80e53de23347bd1440567 Mon Sep 17 00:00:00 2001 From: Thad Ward Date: Fri, 29 Aug 2003 09:41:11 +0000 Subject: [PATCH] Don't even bother creating DancingCharacters if we are going to be using the BeginnerHelper Check pointers to make sure they are not null before dereferencing them. --- stepmania/src/Background.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 0c4b5909cc..3ae21851a8 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -22,6 +22,7 @@ #include "ThemeManager.h" #include "PrefsManager.h" #include "NoteTypes.h" +#include "Steps.h" #include // for fmodf #include "DancingCharacters.h" #include "arch/arch.h" @@ -65,21 +66,23 @@ Background::Background() m_quadBorder[3].SetDiffuse( RageColor(0,0,0,1) ); bool bOneOrMoreChars = false; + bool bShowingBeginnerHelper = false; for( int p=0; pIsPlayerEnabled(p) ) + { bOneOrMoreChars = true; - if( bOneOrMoreChars ) + //Disable dancing characters if BH will be showing. + if( (PREFSMAN->m_bShowBeginnerHelper) || (GAMESTATE->m_pCurNotes[p]->GetDifficulty() == DIFFICULTY_BEGINNER ) ) + bShowingBeginnerHelper = true; + } + + if( bOneOrMoreChars && !bShowingBeginnerHelper ) { m_pDancingCharacters = new DancingCharacters; m_pDancingCharacters->LoadNextSong(); } else m_pDancingCharacters = NULL; - - if( PREFSMAN->m_bShowBeginnerHelper ) //Disable dancing characters if BH will be showing. - for( int pc=0; pcm_PreferredDifficulty[pc] == DIFFICULTY_BEGINNER ) - m_pDancingCharacters = NULL; } Background::~Background() @@ -379,7 +382,8 @@ void Background::LoadFromSong( Song* pSong ) TEXTUREMAN->EnableOddDimensionWarning(); - m_pDancingCharacters->LoadNextSong(); + if( m_pDancingCharacters ) + m_pDancingCharacters->LoadNextSong(); } @@ -479,9 +483,7 @@ void Background::DrawPrimitives() } if( m_pDancingCharacters ) - { m_pDancingCharacters->Draw(); - } m_quadBGBrightness.Draw(); for( int i=0; i<4; i++ )