void StepsID::LoadFromNode( const XNode* pNode ) { ASSERT( pNode->GetName() == "Steps" ); RString sTemp; pNode->GetAttrValue( "StepsType", sTemp ); st = GAMEMAN->StringToStepsType( sTemp ); pNode->GetAttrValue( "Difficulty", sTemp ); dc = StringToDifficulty( sTemp ); if( dc == Difficulty_Edit ) { pNode->GetAttrValue( "Description", sDescription ); pNode->GetAttrValue( "Hash", uHash ); } else { sDescription = ""; uHash = 0; } m_Cache.Unset(); }
void Steps::TidyUpData() { // Don't set the StepsType to dance single if it's invalid. That just // causes unrecognized charts to end up where they don't belong. // Leave it as StepsType_Invalid so the Song can handle it specially. This // is a forwards compatibility feature, so that if a future version adds a // new style, editing a simfile with unrecognized Steps won't silently // delete them. -Kyz if( m_StepsType == StepsType_Invalid ) { LOG->Warn("Detected steps with unknown style '%s' in '%s'", m_StepsTypeStr.c_str(), m_pSong->m_sSongFileName.c_str()); } else if(m_StepsTypeStr == "") { m_StepsTypeStr= GAMEMAN->GetStepsTypeInfo(m_StepsType).szName; } if( GetDifficulty() == Difficulty_Invalid ) SetDifficulty( StringToDifficulty(GetDescription()) ); if( GetDifficulty() == Difficulty_Invalid ) { if( GetMeter() == 1 ) SetDifficulty( Difficulty_Beginner ); else if( GetMeter() <= 3 ) SetDifficulty( Difficulty_Easy ); else if( GetMeter() <= 6 ) SetDifficulty( Difficulty_Medium ); else SetDifficulty( Difficulty_Hard ); } if( GetMeter() < 1) // meter is invalid SetMeter( int(PredictMeter()) ); }
void ThemeMetricDifficultiesToShow::Read() { ASSERT( GetName().Right(6) == "ToShow" ); ThemeMetric<RString>::Read(); m_v.clear(); vector<RString> v; split( ThemeMetric<RString>::GetValue(), ",", v ); if(v.empty()) { LuaHelpers::ReportScriptError("DifficultiesToShow must have at least one entry."); return; } FOREACH_CONST( RString, v, i ) { Difficulty d = StringToDifficulty( *i ); if( d == Difficulty_Invalid ) { LuaHelpers::ReportScriptErrorFmt("Unknown difficulty \"%s\" in CourseDifficultiesToShow.", i->c_str()); } else { m_v.push_back( d ); } }
void TrailID::LoadFromNode( const XNode* pNode ) { ASSERT( pNode->GetName() == "Trail" ); RString sTemp; pNode->GetAttrValue( "StepsType", sTemp ); st = GAMEMAN->StringToStepsType( sTemp ); pNode->GetAttrValue( "CourseDifficulty", sTemp ); cd = StringToDifficulty( sTemp ); m_Cache.Unset(); }
void SMLoader::LoadFromSMTokens( CString sStepsType, CString sDescription, CString sDifficulty, CString sMeter, CString sRadarValues, CString sNoteData, CString sAttackData, Steps &out ) { TrimLeft(sStepsType); TrimRight(sStepsType); TrimLeft(sDescription); TrimRight(sDescription); TrimLeft(sDifficulty); TrimRight(sDifficulty); // LOG->Trace( "Steps::LoadFromSMTokens()" ); out.m_StepsType = GameManager::StringToStepsType(sStepsType); out.SetDescription(sDescription); out.SetDifficulty(StringToDifficulty( sDifficulty )); // HACK: We used to store SMANIAC as DIFFICULTY_HARD with special description. // Now, it has its own DIFFICULTY_CHALLENGE if( sDescription.CompareNoCase("smaniac") == 0 ) out.SetDifficulty( DIFFICULTY_CHALLENGE ); // HACK: We used to store CHALLENGE as DIFFICULTY_HARD with special description. // Now, it has its own DIFFICULTY_CHALLENGE if( sDescription.CompareNoCase("challenge") == 0 ) out.SetDifficulty( DIFFICULTY_CHALLENGE ); out.SetMeter(atoi(sMeter)); CStringArray saValues; split( sRadarValues, ",", saValues, true ); if( saValues.size() == NUM_RADAR_CATEGORIES ) { RadarValues v; FOREACH_RadarCategory(rc) v[rc] = strtof( saValues[rc], NULL ); out.SetRadarValues( v ); } out.SetSMNoteData(sNoteData, sAttackData); out.TidyUpData(); }
void ThemeMetricDifficultiesToShow::Read() { ThemeMetric<CString>::Read(); m_v.clear(); CStringArray v; split( ThemeMetric<CString>::GetValue(), ",", v ); ASSERT( v.size() > 0 ); FOREACH_CONST( CString, v, i ) { Difficulty d = StringToDifficulty( *i ); if( d == DIFFICULTY_INVALID ) RageException::Throw( "Unknown difficulty \"%s\" in CourseDifficultiesToShow", i->c_str() ); m_v.push_back( d ); }
void Profile::LoadGeneralDataFromNode( const XNode* pNode ) { ASSERT( pNode->name == "GeneralData" ); CString s; const XNode* pTemp; pNode->GetChildValue( "Guid", m_sGuid ); pNode->GetChildValue( "UsingProfileDefaultModifiers", m_bUsingProfileDefaultModifiers ); pNode->GetChildValue( "DefaultModifiers", m_sDefaultModifiers ); pNode->GetChildValue( "SortOrder", s ); m_SortOrder = StringToSortOrder( s ); pNode->GetChildValue( "LastDifficulty", s ); m_LastDifficulty = StringToDifficulty( s ); pNode->GetChildValue( "LastCourseDifficulty", s ); m_LastCourseDifficulty = StringToCourseDifficulty( s ); pTemp = pNode->GetChild( "Song" ); if( pTemp ) m_lastSong.LoadFromNode( pTemp ); pTemp = pNode->GetChild( "Course" ); if( pTemp ) m_lastCourse.LoadFromNode( pTemp ); pNode->GetChildValue( "TotalPlays", m_iTotalPlays ); pNode->GetChildValue( "TotalPlaySeconds", m_iTotalPlaySeconds ); pNode->GetChildValue( "TotalGameplaySeconds", m_iTotalGameplaySeconds ); pNode->GetChildValue( "CurrentCombo", m_iCurrentCombo ); pNode->GetChildValue( "TotalCaloriesBurned", m_fTotalCaloriesBurned ); pNode->GetChildValue( "LastPlayedMachineGuid", m_sLastPlayedMachineGuid ); pNode->GetChildValue( "LastPlayedDate", m_LastPlayedDate ); pNode->GetChildValue( "TotalDancePoints", m_iTotalDancePoints ); pNode->GetChildValue( "NumExtraStagesPassed", m_iNumExtraStagesPassed ); pNode->GetChildValue( "NumExtraStagesFailed", m_iNumExtraStagesFailed ); pNode->GetChildValue( "NumToasties", m_iNumToasties ); pNode->GetChildValue( "TotalTapsAndHolds", m_iTotalTapsAndHolds ); pNode->GetChildValue( "TotalJumps", m_iTotalJumps ); pNode->GetChildValue( "TotalHolds", m_iTotalHolds ); pNode->GetChildValue( "TotalMines", m_iTotalMines ); pNode->GetChildValue( "TotalHands", m_iTotalHands ); { const XNode* pUnlockedSongs = pNode->GetChild("UnlockedSongs"); if( pUnlockedSongs ) { FOREACH_Node( pUnlockedSongs, song ) { int iUnlock; if( sscanf(song->name.c_str(),"Unlock%d",&iUnlock) == 1 ) m_UnlockedSongs.insert( iUnlock ); } } }
void Steps::TidyUpData() { if( m_StepsType == StepsType_Invalid ) m_StepsType = StepsType_dance_single; if( GetDifficulty() == Difficulty_Invalid ) SetDifficulty( StringToDifficulty(GetDescription()) ); if( GetDifficulty() == Difficulty_Invalid ) { if( GetMeter() == 1 ) SetDifficulty( Difficulty_Beginner ); else if( GetMeter() <= 3 ) SetDifficulty( Difficulty_Easy ); else if( GetMeter() <= 6 ) SetDifficulty( Difficulty_Medium ); else SetDifficulty( Difficulty_Hard ); } if( GetMeter() < 1) // meter is invalid SetMeter( int(PredictMeter()) ); }
void ThemeMetricDifficultiesToShow::Read() { ASSERT( GetName().Right(6) == "ToShow" ); ThemeMetric<RString>::Read(); m_v.clear(); vector<RString> v; split( ThemeMetric<RString>::GetValue(), ",", v ); ASSERT( v.size() > 0 ); FOREACH_CONST( RString, v, i ) { Difficulty d = StringToDifficulty( *i ); if( d == Difficulty_Invalid ) RageException::Throw( "Unknown difficulty \"%s\" in CourseDifficultiesToShow.", i->c_str() ); m_v.push_back( d ); }
ScreenRanking::ScreenRanking( CString sClassName ) : ScreenAttract( sClassName ) { // init Actors for category and course { m_Banner.SetName( "Banner" ); m_Banner.SetHidden( true ); this->AddChild( &m_Banner ); m_sprBannerFrame.SetName( "BannerFrame" ); m_sprBannerFrame.SetHidden( true ); this->AddChild( &m_sprBannerFrame ); m_textCategory.SetName( "Category" ); m_textCategory.LoadFromFont( THEME->GetPathToF("ScreenRanking category") ); m_textCategory.SetShadowLength( 0 ); m_textCategory.SetHidden( true ); this->AddChild( &m_textCategory ); m_textCourseTitle.SetName( "CourseTitle" ); m_textCourseTitle.LoadFromFont( THEME->GetPathToF("ScreenRanking course title") ); m_textCourseTitle.SetShadowLength( 0 ); m_textCourseTitle.SetHidden( true ); this->AddChild( &m_textCourseTitle ); m_textStepsType.SetName( "StepsType" ); m_textStepsType.LoadFromFont( THEME->GetPathToF("ScreenRanking steps type") ); m_textStepsType.SetShadowLength( 0 ); m_textStepsType.SetHidden( true ); this->AddChild( &m_textStepsType ); for( int l=0; l<NUM_RANKING_LINES; l++ ) { m_sprBullets[l].SetName( ssprintf("Bullet%d",l+1) ); m_sprBullets[l].Load( THEME->GetPathToG( ssprintf("ScreenRanking bullets 1x%d",NUM_RANKING_LINES) ) ); m_sprBullets[l].SetState( l ); m_sprBullets[l].StopAnimating(); m_sprBullets[l].SetHidden( true ); this->AddChild( &m_sprBullets[l] ); m_textNames[l].SetName( ssprintf("Name%d",l+1) ); m_textNames[l].LoadFromFont( THEME->GetPathToF("ScreenRanking name") ); m_textNames[l].SetHidden( true ); this->AddChild( &m_textNames[l] ); m_textScores[l].SetName( ssprintf("Score%d",l+1) ); m_textScores[l].LoadFromFont( THEME->GetPathToF("ScreenRanking score") ); m_textScores[l].SetHidden( true ); this->AddChild( &m_textScores[l] ); m_textPoints[l].SetName( ssprintf("Points%d",l+1) ); m_textPoints[l].LoadFromFont( THEME->GetPathToF("ScreenRanking points") ); m_textPoints[l].SetHidden( true ); this->AddChild( &m_textPoints[l] ); m_textTime[l].SetName( ssprintf("Time%d",l+1) ); m_textTime[l].LoadFromFont( THEME->GetPathToF("ScreenRanking time") ); m_textTime[l].SetHidden( true ); this->AddChild( &m_textTime[l] ); // TODO: Think of a better way to handle this if( PREFSMAN->m_sCoursesToShowRanking == "" ) PREFSMAN->m_sCoursesToShowRanking = THEME->GetMetric("ScreenRanking","CoursesToShow"); } } // make the list of difficulties to show { vector<CString> sShowDiffs; split( DIFFICULTIES_TO_SHOW, ",", sShowDiffs, true ); for( vector<CString>::const_iterator iter = sShowDiffs.begin(); iter != sShowDiffs.end(); iter++ ) { m_vDiffsToShow.push_back( StringToDifficulty( *iter ) ); } } // init Actors for all_steps { FOREACH_Difficulty( d ) { bool bShowThis = find(m_vDiffsToShow.begin(), m_vDiffsToShow.end(), d) != m_vDiffsToShow.end(); if( !bShowThis ) continue; // skip m_sprDifficulty[d].Load( THEME->GetPathG(m_sName,"difficulty "+DifficultyToString(d)) ); m_sprDifficulty[d]->SetName( ssprintf("Difficulty%d",d) ); m_sprDifficulty[d]->SetHidden( true ); this->AddChild( m_sprDifficulty[d] ); } const unsigned num_songs = SONGMAN->GetAllSongs().size(); for( unsigned s=0; s<num_songs; s++ ) { Song *pSong = SONGMAN->GetAllSongs()[s]; if( UNLOCKMAN->SongIsLocked(pSong) ) continue; if( !pSong->ShowInDemonstrationAndRanking() ) continue; StepsScoreRowItem* pStepsScoreRowItem = new StepsScoreRowItem; pStepsScoreRowItem ->m_pSong = pSong; pStepsScoreRowItem->m_sprSongFrame.SetName( "SongFrame" ); pStepsScoreRowItem->m_sprSongFrame.SetHidden( true ); pStepsScoreRowItem->m_sprSongFrame.Load( THEME->GetPathToG("ScreenRanking song frame") ); pStepsScoreRowItem->AddChild( &pStepsScoreRowItem->m_sprSongFrame ); pStepsScoreRowItem->m_textSongTitle.SetName( "SongTitle" ); pStepsScoreRowItem->m_textSongTitle.SetHidden( true ); pStepsScoreRowItem->m_textSongTitle.LoadFromFont( THEME->GetPathToF("ScreenRanking song title") ); pStepsScoreRowItem->AddChild( &pStepsScoreRowItem->m_textSongTitle ); for( int d=0; d<NUM_DIFFICULTIES; d++ ) { pStepsScoreRowItem->m_textStepsScore[d].SetName( "StepsScore" ); pStepsScoreRowItem->m_textStepsScore[d].LoadFromFont( THEME->GetPathToF("ScreenRanking steps score") ); pStepsScoreRowItem->m_textStepsScore[d].SetHidden( true ); pStepsScoreRowItem->AddChild( &pStepsScoreRowItem->m_textStepsScore[d] ); } m_vpStepsScoreRowItem.push_back( pStepsScoreRowItem ); } m_ListScoreRowItems.SetName( "ListScoreRowItems" ); this->AddChild( &m_ListScoreRowItems ); m_ListScoreRowItems.SetXY( CENTER_X, CENTER_Y ); } { // for all_courses: FOREACH_ShownCourseDifficulty(d) { CString cd = CourseDifficultyToString(d); m_sprCourseDifficulty[d].Load( THEME->GetPathG(m_sName,"CourseDifficulty "+cd) ); m_sprCourseDifficulty[d]->SetName( ssprintf("CourseDifficulty%s",cd.c_str()) ); m_sprCourseDifficulty[d]->SetHidden( true ); this->AddChild( m_sprCourseDifficulty[d] ); } vector<Course*> courses; SONGMAN->GetAllCourses( courses, false ); LOG->Trace("rankings: adding %u courses", unsigned(courses.size())); for( unsigned s=0; s<courses.size(); s++ ) { if( UNLOCKMAN->CourseIsLocked(courses[s]) ) continue; CourseScoreRowItem* pCourseScoreRowItem = new CourseScoreRowItem; pCourseScoreRowItem->m_pCourse = courses[s]; pCourseScoreRowItem->m_sprSongFrame.SetName( "CourseListFrame" ); pCourseScoreRowItem->m_sprSongFrame.SetHidden( true ); pCourseScoreRowItem->m_sprSongFrame.Load( THEME->GetPathToG("ScreenRanking course frame") ); pCourseScoreRowItem->AddChild( &pCourseScoreRowItem->m_sprSongFrame ); pCourseScoreRowItem->m_textSongTitle.SetName( "CourseListTitle" ); pCourseScoreRowItem->m_textSongTitle.SetHidden( true ); pCourseScoreRowItem->m_textSongTitle.LoadFromFont( THEME->GetPathToF("ScreenRanking course list title") ); pCourseScoreRowItem->AddChild( &pCourseScoreRowItem->m_textSongTitle ); FOREACH_ShownCourseDifficulty(d) { pCourseScoreRowItem->m_textStepsScore[d].SetName( "CourseListScore" ); pCourseScoreRowItem->m_textStepsScore[d].LoadFromFont( THEME->GetPathToF("ScreenRanking course list score") ); pCourseScoreRowItem->m_textStepsScore[d].SetHidden( true ); pCourseScoreRowItem->AddChild( &pCourseScoreRowItem->m_textStepsScore[d] ); } m_vpCourseScoreRowItem.push_back( pCourseScoreRowItem ); } m_ListCourseRowItems.SetName( "ListCourseRowItems" ); this->AddChild( &m_ListCourseRowItems ); m_ListCourseRowItems.SetXY( CENTER_X, CENTER_Y ); } // calculate which StepsTypes to show vector<StepsType> aStepsTypesToShow; { GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, aStepsTypesToShow ); // subtract hidden StepsTypes { vector<CString> asStepsTypesToHide; split( STEPS_TYPES_TO_HIDE, ",", asStepsTypesToHide, true ); for( unsigned i=0; i<asStepsTypesToHide.size(); i++ ) { StepsType st = GameManager::StringToStepsType(asStepsTypesToHide[i]); if( st != STEPS_TYPE_INVALID ) { const vector<StepsType>::iterator iter = find( aStepsTypesToShow.begin(), aStepsTypesToShow.end(), st ); if( iter != aStepsTypesToShow.end() ) aStepsTypesToShow.erase( iter ); } } } } // // fill m_vPagesToShow // if( SHOW_CATEGORIES ) { for( unsigned i=0; i<aStepsTypesToShow.size(); i++ ) { for( int c=0; c<NUM_RANKING_CATEGORIES; c++ ) { PageToShow pts; pts.type = PAGE_TYPE_CATEGORY; pts.colorIndex = i; pts.category = (RankingCategory)c; pts.nt = aStepsTypesToShow[i]; m_vPagesToShow.push_back( pts ); } } } { vector<CString> asCoursePaths; split( COURSES_TO_SHOW, ",", asCoursePaths, true ); for( unsigned i=0; i<aStepsTypesToShow.size(); i++ ) { for( unsigned c=0; c<asCoursePaths.size(); c++ ) { PageToShow pts; pts.type = PAGE_TYPE_TRAIL; pts.colorIndex = i; pts.nt = aStepsTypesToShow[i]; pts.pCourse = SONGMAN->GetCourseFromPath( asCoursePaths[c] ); if( pts.pCourse == NULL ) continue; pts.pTrail = pts.pCourse->GetTrail( pts.nt ); if( pts.pTrail == NULL ) continue; m_vPagesToShow.push_back( pts ); } } } if( SHOW_ALL_STEPS_SCORES ) { vector<Song*> vpSongs = SONGMAN->GetAllSongs(); if( !vpSongs.empty() ) { for( unsigned i=0; i<aStepsTypesToShow.size(); i++ ) { PageToShow pts; pts.type = PAGE_TYPE_ALL_STEPS; pts.colorIndex = i; pts.nt = aStepsTypesToShow[i]; m_vPagesToShow.push_back( pts ); } } } if( SHOW_ALL_COURSE_SCORES ) { vector<Course*> courses; SONGMAN->GetAllCourses( courses, false ); if( !courses.empty() ) { for( unsigned i=0; i<aStepsTypesToShow.size(); i++ ) { PageToShow pts; pts.type = PAGE_TYPE_ALL_COURSES; pts.colorIndex = i; pts.nt = aStepsTypesToShow[i]; m_vPagesToShow.push_back( pts ); } } } this->ClearMessageQueue( SM_BeginFadingOut ); // ignore ScreenAttract's SecsToShow this->PostScreenMessage( SM_ShowNextPage, 0.5f ); }
void ConditionalBGA::Load(const CString &szScreenName) { RageFile file; CString szConditionalBGAFile = THEME->GetCurThemeDir() + szScreenName + " ConditionalBGA.ini"; // char filepath[512]; // strcpy(filepath,""); // empty the path first // strcpy(filepath,szConditionalBGAFile.c_str()); LOG->Trace("ConditionalBGA Load:%s",szConditionalBGAFile.c_str()); bool loaded = file.Open(szConditionalBGAFile,RageFile::READ); // FILE* fp = NULL; // fp = fopen(filepath,"r"); if(!loaded) { LOG->Trace("ConditionalBGA File Not Found"); return; } else { CString currentline; int bgano=0; while(!file.AtEOF()) { file.GetLine(currentline); // get the current line // kill any possible comments CStringArray asKillComments; asKillComments.clear(); // get rid of anything in there split(currentline, "#",asKillComments); // A comment starting with # if(!asKillComments.empty()) { currentline = asKillComments[0]; // there was some commentstuff here, take the first bit to be the actual data } asKillComments.clear(); // get rid of anything in there split(currentline, "/",asKillComments); // A comment starting with // or /* if(!asKillComments.empty()) { currentline = asKillComments[0]; // there was some commentstuff here, take the first bit to be the actual data } TrimRight(currentline); // nuke trailing whitespace // start parsing the data if(currentline.c_str()[0] == '[') // we found a new bganimation { if(!m_bgainfo.empty()) // last one wasnt empty { CheckBgaRequirements(m_bgainfo[bgano]); bgano++; } BgaCondInfo temp; m_bgainfo.push_back(temp); ClearINFO(bgano); // wipe out the old info structure. CStringArray asSplitLine; split(currentline,"[",asSplitLine); split(asSplitLine[0],"]",asSplitLine); if(!asSplitLine.empty() && asSplitLine.size() >= 1) m_bgainfo[bgano].bganame = asSplitLine[asSplitLine.size() - 1]; } else { CStringArray asSplitLine; split(currentline,":",asSplitLine); if(asSplitLine.empty()) continue; if(!asSplitLine[0].CompareNoCase("clear") && asSplitLine.size() > 1) { if(!asSplitLine[1].CompareNoCase("true") || !asSplitLine[1].CompareNoCase("cleared") || !asSplitLine[1].CompareNoCase("clear")) // true / clear (any clear condition) m_bgainfo[bgano].cleared = CBGA_CSCLEARED; else if(!asSplitLine[1].CompareNoCase("false") || !asSplitLine[1].CompareNoCase("failed")) // false / failed m_bgainfo[bgano].cleared = CBGA_CSFAILED; else if(!asSplitLine[1].CompareNoCase("maxcombo") || !asSplitLine[1].CompareNoCase("fullcombo")) // passed with maxcombo m_bgainfo[bgano].cleared = CBGA_CSMAXCOMBO; else if(!asSplitLine[1].CompareNoCase("brokencombo")) // passed with a broken combo m_bgainfo[bgano].cleared = CBGA_CSBROKECOMBO; // LOG->Trace("Clear Conditon: %d",info.cleared); } if(!asSplitLine[0].CompareNoCase("songtitle") && asSplitLine.size() > 1) { m_bgainfo[bgano].songtitle = asSplitLine[1]; // LOG->Trace("SongTitle: %s",info.songtitle.c_str()); } if(!asSplitLine[0].CompareNoCase("songartist") && asSplitLine.size() > 1) { m_bgainfo[bgano].songartist = asSplitLine[1]; // LOG->Trace("SongArtist: %s",info.songartist.c_str()); } if(!asSplitLine[0].CompareNoCase("songday") && asSplitLine.size() > 1) { CStringArray asDays; split( asSplitLine[1], ",", asDays ); for( unsigned d=0; d<asDays.size(); d++ ) { int dn = atoi(asDays[d].c_str()); if(!(dn < 1 || dn > 32)) // ignore if date is out of range { m_bgainfo[bgano].songdays.push_back(dn); } } // for(d=0; d<info.songdays.size(); d++) // { // LOG->Trace("SongDay: %d",info.songdays[d]); // } } if(!asSplitLine[0].CompareNoCase("songmonth") && asSplitLine.size() > 1) { CStringArray asMonths; split( asSplitLine[1], ",", asMonths ); for( unsigned d=0; d<asMonths.size(); d++ ) { int dn = atoi(asMonths[d].c_str()); if(!(dn < 1 || dn > 12)) // ignore if date is out of range { m_bgainfo[bgano].songmonths.push_back(dn); } } // for(d=0; d<info.songmonths.size(); d++) // { // LOG->Trace("SongMonth: %d",info.songmonths[d]); // } } // foot meter ratings if(!asSplitLine[0].CompareNoCase("songdifficulty") && asSplitLine.size() > 1) { CStringArray asDifficulties; split( asSplitLine[1], ",", asDifficulties ); for(unsigned d=0;d<asDifficulties.size();d++) { // check to see if the last character is a + bool bHandled = false; if(asDifficulties[d].c_str()[strlen(asDifficulties[d].c_str())-1] == '+') { bHandled = true; CStringArray asVal; split(asDifficulties[d],"+",asVal); int temp=0; temp = 0 - atoi(asVal[0].c_str()); // negative numbers will indicate 'greater than' for this system m_bgainfo[bgano].songmeters.push_back(temp); } if(!bHandled) // didnt find the + (gt) so find a - (range) { bool isarange=false; for(unsigned b=0; b<strlen(asDifficulties[d].c_str());b++) { if(asDifficulties[d].c_str()[b] == '-') { bHandled = isarange = true; break; } } if(isarange) { CStringArray asVal; split(asDifficulties[d],"-",asVal); int imin=0,imax=0,itmp=0; imin=atoi(asVal[0].c_str()); imax=atoi(asVal[1].c_str()); itmp=imin; while(itmp<=imax) // fill in the values between the min and max range inclusive { m_bgainfo[bgano].songmeters.push_back(itmp); itmp++; } } } if(!bHandled) // its not a range so must be a value on its own { int tmp = atoi(asDifficulties[d].c_str()); m_bgainfo[bgano].songmeters.push_back(tmp); } } } // mods that mustn't be present if(!asSplitLine[0].CompareNoCase("moddisallow") && asSplitLine.size() > 1) { m_bgainfo[bgano].dpoused = true; m_bgainfo[bgano].disallowedpo.FromString(asSplitLine[1]); } // heavy, light e.t.c. if(!asSplitLine[0].CompareNoCase("songrating") && asSplitLine.size() > 1) { CStringArray asDifficulties; split( asSplitLine[1], ",", asDifficulties ); for( unsigned d=0; d<asDifficulties.size(); d++ ) { m_bgainfo[bgano].difficulties.push_back(StringToDifficulty(asDifficulties[d])); } // for(d=0; d<info.difficulties.size(); d++) // { // LOG->Trace("Difficulty: %d",info.difficulties[d]); // } } if(!asSplitLine[0].CompareNoCase("grade") && asSplitLine.size() > 1) { CStringArray asGrades; split( asSplitLine[1], ",", asGrades ); for( unsigned d=0; d<asGrades.size(); d++ ) { m_bgainfo[bgano].grades.push_back(StringToGrade(asGrades[d])); } } if(!asSplitLine[0].CompareNoCase("style") && asSplitLine.size() > 1) { LOG->Info("Comparing Styles"); CStringArray asStyles; split( asSplitLine[1], ",", asStyles ); for( unsigned d=0; d<asStyles.size(); d++ ) { LOG->Info( "Style:%s", asStyles[d].c_str() ); m_bgainfo[bgano].styles.push_back(GAMEMAN->GameAndStringToStyle(GAMESTATE->m_pCurGame,asStyles[d])); } } } } if(bganimtouse.CompareNoCase("")!=0) { LOG->Info("Best Match BGA Was: %s",bganimtouse.c_str()); bganim.LoadFromAniDir( THEME->GetPathToB(bganimtouse) ); } } file.Close(); }