From 9b111c9058d150a5f40f3830cfab7889732aaac3 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 12 Oct 2003 20:00:22 +0000 Subject: [PATCH] fix AV if character has no model --- stepmania/src/ScreenHowToPlay.cpp | 32 +++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/stepmania/src/ScreenHowToPlay.cpp b/stepmania/src/ScreenHowToPlay.cpp index b6b7cb6b1f..d19326b5e2 100644 --- a/stepmania/src/ScreenHowToPlay.cpp +++ b/stepmania/src/ScreenHowToPlay.cpp @@ -110,20 +110,24 @@ ScreenHowToPlay::ScreenHowToPlay( CString sName ) : ScreenAttract( sName ) { Character* rndchar = GAMESTATE->GetRandomCharacter(); - m_pmCharacter = new Model; - m_pmCharacter->LoadMilkshapeAscii( rndchar->GetModelPath() ); - m_pmCharacter->LoadMilkshapeAsciiBones( "Step-LEFT", GetAnimPath( ANIM_LEFT ) ); - m_pmCharacter->LoadMilkshapeAsciiBones( "Step-DOWN", GetAnimPath( ANIM_DOWN ) ); - m_pmCharacter->LoadMilkshapeAsciiBones( "Step-UP", GetAnimPath( ANIM_UP ) ); - m_pmCharacter->LoadMilkshapeAsciiBones( "Step-RIGHT", GetAnimPath( ANIM_RIGHT ) ); - m_pmCharacter->LoadMilkshapeAsciiBones( "Step-JUMPLR", GetAnimPath( ANIM_JUMPLR ) ); - m_pmCharacter->LoadMilkshapeAsciiBones( "rest",rndchar->GetRestAnimationPath() ); - m_pmCharacter->SetDefaultAnimation( "rest" ); - m_pmCharacter->PlayAnimation( "rest" ); - m_pmCharacter->m_bRevertToDefaultAnimation = true; // Stay bouncing after a step has finished animating. - - m_pmCharacter->SetRotationX( 40 ); - m_pmCharacter->Command( CHARACTERONCOMMAND ); + CString sModelPath = rndchar->GetModelPath(); + if( sModelPath != "" ) + { + m_pmCharacter = new Model; + m_pmCharacter->LoadMilkshapeAscii( rndchar->GetModelPath() ); + m_pmCharacter->LoadMilkshapeAsciiBones( "Step-LEFT", GetAnimPath( ANIM_LEFT ) ); + m_pmCharacter->LoadMilkshapeAsciiBones( "Step-DOWN", GetAnimPath( ANIM_DOWN ) ); + m_pmCharacter->LoadMilkshapeAsciiBones( "Step-UP", GetAnimPath( ANIM_UP ) ); + m_pmCharacter->LoadMilkshapeAsciiBones( "Step-RIGHT", GetAnimPath( ANIM_RIGHT ) ); + m_pmCharacter->LoadMilkshapeAsciiBones( "Step-JUMPLR", GetAnimPath( ANIM_JUMPLR ) ); + m_pmCharacter->LoadMilkshapeAsciiBones( "rest",rndchar->GetRestAnimationPath() ); + m_pmCharacter->SetDefaultAnimation( "rest" ); + m_pmCharacter->PlayAnimation( "rest" ); + m_pmCharacter->m_bRevertToDefaultAnimation = true; // Stay bouncing after a step has finished animating. + + m_pmCharacter->SetRotationX( 40 ); + m_pmCharacter->Command( CHARACTERONCOMMAND ); + } } // silly to use the lifebar without a player, since the player updates the lifebar