XNode *HighScoreImpl::CreateNode() const { XNode *pNode = new XNode( "HighScore" ); const bool bWriteSimpleValues = RadarValues::WRITE_SIMPLE_VALIES; const bool bWriteComplexValues = RadarValues::WRITE_COMPLEX_VALIES; // TRICKY: Don't write "name to fill in" markers. pNode->AppendChild( "Name", IsRankingToFillIn(sName) ? RString("") : sName ); pNode->AppendChild( "Grade", GradeToString(grade) ); pNode->AppendChild( "Score", iScore ); pNode->AppendChild( "PercentDP", fPercentDP ); pNode->AppendChild( "SurviveSeconds", fSurviveSeconds ); pNode->AppendChild( "MaxCombo", iMaxCombo ); pNode->AppendChild( "StageAward", StageAwardToString(stageAward) ); pNode->AppendChild( "PeakComboAward", PeakComboAwardToString(peakComboAward) ); pNode->AppendChild( "Modifiers", sModifiers ); pNode->AppendChild( "DateTime", dateTime.GetString() ); pNode->AppendChild( "PlayerGuid", sPlayerGuid ); pNode->AppendChild( "MachineGuid", sMachineGuid ); pNode->AppendChild( "ProductID", iProductID ); XNode* pTapNoteScores = pNode->AppendChild( "TapNoteScores" ); FOREACH_ENUM( TapNoteScore, tns ) if( tns != TNS_None ) // HACK: don't save meaningless "none" count pTapNoteScores->AppendChild( TapNoteScoreToString(tns), iTapNoteScores[tns] ); XNode* pHoldNoteScores = pNode->AppendChild( "HoldNoteScores" ); FOREACH_ENUM( HoldNoteScore, hns ) if( hns != HNS_None ) // HACK: don't save meaningless "none" count pHoldNoteScores->AppendChild( HoldNoteScoreToString(hns), iHoldNoteScores[hns] ); pNode->AppendChild( radarValues.CreateNode(bWriteSimpleValues, bWriteComplexValues) ); pNode->AppendChild( "LifeRemainingSeconds", fLifeRemainingSeconds ); pNode->AppendChild( "Disqualified", bDisqualified); return pNode; }
void GradeDisplay::Load( RString sMetricsGroup ) { ASSERT( m_vSpr.empty() ); m_vSpr.resize( NUM_POSSIBLE_GRADES ); int i = 0; FOREACH_PossibleGrade( g ) { AutoActor &spr = m_vSpr[i]; spr.Load( THEME->GetPathG(sMetricsGroup,GradeToString(g)) ); spr->SetVisible( false ); this->AddChild( spr ); i++; } }
XNode* HighScoreList::CreateNode() const { XNode* pNode = new XNode( "HighScoreList" ); pNode->AppendChild( "NumTimesPlayed", iNumTimesPlayed ); pNode->AppendChild( "LastPlayed", dtLastPlayed.GetString() ); if( HighGrade != Grade_NoData ) pNode->AppendChild( "HighGrade", GradeToString(HighGrade) ); for( unsigned i=0; i<vHighScores.size(); i++ ) { const HighScore &hs = vHighScores[i]; pNode->AppendChild( hs.CreateNode() ); } return pNode; }
void GradeDisplay::SetGrade( Grade grade ) { size_t i = 0; FOREACH_PossibleGrade( g ) { if(i >= m_vSpr.size()) { LuaHelpers::ReportScriptError("GradeDisplay:SetGrade: No actor loaded for grade " + GradeToString(g)); } else { m_vSpr[i]->SetVisible( g == grade ); i++; } } }
XNode* Profile::SaveGeneralDataCreateNode() const { XNode* pGeneralDataNode = new XNode; pGeneralDataNode->name = "GeneralData"; // TRICKY: These are write-only elements that are never read again. This // data is required by other apps (like internet ranking), but is // redundant to the game app. pGeneralDataNode->AppendChild( "DisplayName", GetDisplayName() ); pGeneralDataNode->AppendChild( "IsMachine", IsMachine() ); pGeneralDataNode->AppendChild( "Guid", m_sGuid ); pGeneralDataNode->AppendChild( "UsingProfileDefaultModifiers", m_bUsingProfileDefaultModifiers ); pGeneralDataNode->AppendChild( "DefaultModifiers", m_sDefaultModifiers ); pGeneralDataNode->AppendChild( "SortOrder", SortOrderToString(m_SortOrder) ); pGeneralDataNode->AppendChild( "LastDifficulty", DifficultyToString(m_LastDifficulty) ); pGeneralDataNode->AppendChild( "LastCourseDifficulty", CourseDifficultyToString(m_LastCourseDifficulty) ); pGeneralDataNode->AppendChild( m_lastSong.CreateNode() ); pGeneralDataNode->AppendChild( m_lastCourse.CreateNode() ); pGeneralDataNode->AppendChild( "TotalPlays", m_iTotalPlays ); pGeneralDataNode->AppendChild( "TotalPlaySeconds", m_iTotalPlaySeconds ); pGeneralDataNode->AppendChild( "TotalGameplaySeconds", m_iTotalGameplaySeconds ); pGeneralDataNode->AppendChild( "CurrentCombo", m_iCurrentCombo ); pGeneralDataNode->AppendChild( "TotalCaloriesBurned", m_fTotalCaloriesBurned ); pGeneralDataNode->AppendChild( "LastPlayedMachineGuid", m_sLastPlayedMachineGuid ); pGeneralDataNode->AppendChild( "LastPlayedDate", m_LastPlayedDate ); pGeneralDataNode->AppendChild( "TotalDancePoints", m_iTotalDancePoints ); pGeneralDataNode->AppendChild( "NumExtraStagesPassed", m_iNumExtraStagesPassed ); pGeneralDataNode->AppendChild( "NumExtraStagesFailed", m_iNumExtraStagesFailed ); pGeneralDataNode->AppendChild( "NumToasties", m_iNumToasties ); pGeneralDataNode->AppendChild( "TotalTapsAndHolds", m_iTotalTapsAndHolds ); pGeneralDataNode->AppendChild( "TotalJumps", m_iTotalJumps ); pGeneralDataNode->AppendChild( "TotalHolds", m_iTotalHolds ); pGeneralDataNode->AppendChild( "TotalMines", m_iTotalMines ); pGeneralDataNode->AppendChild( "TotalHands", m_iTotalHands ); // Keep declared variables in a very local scope so they aren't // accidentally used where they're not intended. There's a lot of // copying and pasting in this code. { XNode* pUnlockedSongs = pGeneralDataNode->AppendChild("UnlockedSongs"); for( set<int>::const_iterator it = m_UnlockedSongs.begin(); it != m_UnlockedSongs.end(); ++it ) pUnlockedSongs->AppendChild( ssprintf("Unlock%i", *it) ); } { XNode* pNumSongsPlayedByPlayMode = pGeneralDataNode->AppendChild("NumSongsPlayedByPlayMode"); FOREACH_PlayMode( pm ) { /* Don't save unplayed PlayModes. */ if( !m_iNumSongsPlayedByPlayMode[pm] ) continue; pNumSongsPlayedByPlayMode->AppendChild( PlayModeToString(pm), m_iNumSongsPlayedByPlayMode[pm] ); } } { XNode* pNumSongsPlayedByStyle = pGeneralDataNode->AppendChild("NumSongsPlayedByStyle"); for( map<StyleID,int>::const_iterator iter = m_iNumSongsPlayedByStyle.begin(); iter != m_iNumSongsPlayedByStyle.end(); iter++ ) { const StyleID &s = iter->first; int iNumPlays = iter->second; XNode *pStyleNode = s.CreateNode(); pStyleNode->SetValue( iNumPlays ); pNumSongsPlayedByStyle->AppendChild( pStyleNode ); } } { XNode* pNumSongsPlayedByDifficulty = pGeneralDataNode->AppendChild("NumSongsPlayedByDifficulty"); FOREACH_Difficulty( dc ) { if( !m_iNumSongsPlayedByDifficulty[dc] ) continue; pNumSongsPlayedByDifficulty->AppendChild( DifficultyToString(dc), m_iNumSongsPlayedByDifficulty[dc] ); } } { XNode* pNumSongsPlayedByMeter = pGeneralDataNode->AppendChild("NumSongsPlayedByMeter"); for( int i=0; i<MAX_METER+1; i++ ) { if( !m_iNumSongsPlayedByMeter[i] ) continue; pNumSongsPlayedByMeter->AppendChild( ssprintf("Meter%d",i), m_iNumSongsPlayedByMeter[i] ); } } { XNode* pNumStagesPassedByGrade = pGeneralDataNode->AppendChild("NumStagesPassedByGrade"); FOREACH_Grade( g ) { if( !m_iNumStagesPassedByGrade[g] ) continue; pNumStagesPassedByGrade->AppendChild( GradeToString(g), m_iNumStagesPassedByGrade[g] ); } } { XNode* pNumStagesPassedByPlayMode = pGeneralDataNode->AppendChild("NumStagesPassedByPlayMode"); FOREACH_PlayMode( pm ) { /* Don't save unplayed PlayModes. */ if( !m_iNumStagesPassedByPlayMode[pm] ) continue; pNumStagesPassedByPlayMode->AppendChild( PlayModeToString(pm), m_iNumStagesPassedByPlayMode[pm] ); } } return pGeneralDataNode; }
void PrefsManager::SaveGlobalPrefsToDisk() const { IniFile ini; ini.SetValue( "Options", "CelShadeModels", m_bCelShadeModels ); ini.SetValue( "Options", "ConstantUpdateDeltaSeconds", m_fConstantUpdateDeltaSeconds ); ini.SetValue( "Options", "DisplayWidth", m_iDisplayWidth ); ini.SetValue( "Options", "DisplayHeight", m_iDisplayHeight ); ini.SetValue( "Options", "DisplayColorDepth", m_iDisplayColorDepth ); ini.SetValue( "Options", "TextureColorDepth", m_iTextureColorDepth ); ini.SetValue( "Options", "MovieColorDepth", m_iMovieColorDepth ); ini.SetValue( "Options", "MaxTextureResolution", m_iMaxTextureResolution ); ini.SetValue( "Options", "RefreshRate", m_iRefreshRate ); ini.SetValue( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons ); ini.SetValue( "Options", "ShowStats", m_bShowStats ); ini.SetValue( "Options", "ShowBanners", m_bShowBanners ); ini.SetValue( "Options", "BackgroundMode", m_BackgroundMode); ini.SetValue( "Options", "NumBackgrounds", m_iNumBackgrounds); ini.SetValue( "Options", "ShowDanger", m_bShowDanger ); ini.SetValue( "Options", "BGBrightness", m_fBGBrightness ); ini.SetValue( "Options", "MenuTimer", m_bMenuTimer ); ini.SetValue( "Options", "NumArcadeStages", m_iNumArcadeStages ); ini.SetValue( "Options", "EventMode", m_bEventMode ); ini.SetValue( "Options", "AutoPlay", m_bAutoPlay ); ini.SetValue( "Options", "JudgeWindowScale", m_fJudgeWindowScale ); ini.SetValue( "Options", "JudgeWindowAdd", m_fJudgeWindowAdd ); ini.SetValue( "Options", "JudgeWindowSecondsMarvelous", m_fJudgeWindowSecondsMarvelous ); ini.SetValue( "Options", "JudgeWindowSecondsPerfect", m_fJudgeWindowSecondsPerfect ); ini.SetValue( "Options", "JudgeWindowSecondsGreat", m_fJudgeWindowSecondsGreat ); ini.SetValue( "Options", "JudgeWindowSecondsGood", m_fJudgeWindowSecondsGood ); ini.SetValue( "Options", "JudgeWindowSecondsBoo", m_fJudgeWindowSecondsBoo ); ini.SetValue( "Options", "JudgeWindowSecondsOK", m_fJudgeWindowSecondsOK ); ini.SetValue( "Options", "JudgeWindowSecondsMine", m_fJudgeWindowSecondsMine ); ini.SetValue( "Options", "JudgeWindowSecondsAttack", m_fJudgeWindowSecondsAttack ); ini.SetValue( "Options", "LifeDifficultyScale", m_fLifeDifficultyScale ); ini.SetValue( "Options", "LifeDeltaPercentChangeMarvelous", m_fLifeDeltaPercentChangeMarvelous ); ini.SetValue( "Options", "LifeDeltaPercentChangePerfect", m_fLifeDeltaPercentChangePerfect ); ini.SetValue( "Options", "LifeDeltaPercentChangeGreat", m_fLifeDeltaPercentChangeGreat ); ini.SetValue( "Options", "LifeDeltaPercentChangeGood", m_fLifeDeltaPercentChangeGood ); ini.SetValue( "Options", "LifeDeltaPercentChangeBoo", m_fLifeDeltaPercentChangeBoo ); ini.SetValue( "Options", "LifeDeltaPercentChangeMiss", m_fLifeDeltaPercentChangeMiss ); ini.SetValue( "Options", "LifeDeltaPercentChangeHitMine", m_fLifeDeltaPercentChangeHitMine ); ini.SetValue( "Options", "LifeDeltaPercentChangeOK", m_fLifeDeltaPercentChangeOK ); ini.SetValue( "Options", "LifeDeltaPercentChangeNG", m_fLifeDeltaPercentChangeNG ); ini.SetValue( "Options", "TugMeterPercentChangeMarvelous", m_fTugMeterPercentChangeMarvelous ); ini.SetValue( "Options", "TugMeterPercentChangePerfect", m_fTugMeterPercentChangePerfect ); ini.SetValue( "Options", "TugMeterPercentChangeGreat", m_fTugMeterPercentChangeGreat ); ini.SetValue( "Options", "TugMeterPercentChangeGood", m_fTugMeterPercentChangeGood ); ini.SetValue( "Options", "TugMeterPercentChangeBoo", m_fTugMeterPercentChangeBoo ); ini.SetValue( "Options", "TugMeterPercentChangeMiss", m_fTugMeterPercentChangeMiss ); ini.SetValue( "Options", "TugMeterPercentChangeHitMine", m_fTugMeterPercentChangeHitMine ); ini.SetValue( "Options", "TugMeterPercentChangeOK", m_fTugMeterPercentChangeOK ); ini.SetValue( "Options", "TugMeterPercentChangeNG", m_fTugMeterPercentChangeNG ); ini.SetValue( "Options", "RegenComboAfterFail", m_iRegenComboAfterFail ); ini.SetValue( "Options", "RegenComboAfterMiss", m_iRegenComboAfterMiss ); ini.SetValue( "Options", "MaxRegenComboAfterFail", m_iMaxRegenComboAfterFail ); ini.SetValue( "Options", "MaxRegenComboAfterMiss", m_iMaxRegenComboAfterMiss ); ini.SetValue( "Options", "TwoPlayerRecovery", m_bTwoPlayerRecovery ); ini.SetValue( "Options", "MercifulDrain", m_bMercifulDrain ); ini.SetValue( "Options", "Minimum1FullSongInCourses", m_bMinimum1FullSongInCourses ); ini.SetValue( "Options", "PercentScoreWeightMarvelous", m_iPercentScoreWeightMarvelous ); ini.SetValue( "Options", "PercentScoreWeightPerfect", m_iPercentScoreWeightPerfect ); ini.SetValue( "Options", "PercentScoreWeightGreat", m_iPercentScoreWeightGreat ); ini.SetValue( "Options", "PercentScoreWeightGood", m_iPercentScoreWeightGood ); ini.SetValue( "Options", "PercentScoreWeightBoo", m_iPercentScoreWeightBoo ); ini.SetValue( "Options", "PercentScoreWeightMiss", m_iPercentScoreWeightMiss ); ini.SetValue( "Options", "PercentScoreWeightOK", m_iPercentScoreWeightOK ); ini.SetValue( "Options", "PercentScoreWeightNG", m_iPercentScoreWeightNG ); ini.SetValue( "Options", "PercentScoreWeightHitMine", m_iPercentScoreWeightHitMine ); ini.SetValue( "Options", "GradeWeightMarvelous", m_iGradeWeightMarvelous ); ini.SetValue( "Options", "GradeWeightPerfect", m_iGradeWeightPerfect ); ini.SetValue( "Options", "GradeWeightGreat", m_iGradeWeightGreat ); ini.SetValue( "Options", "GradeWeightGood", m_iGradeWeightGood ); ini.SetValue( "Options", "GradeWeightBoo", m_iGradeWeightBoo ); ini.SetValue( "Options", "GradeWeightMiss", m_iGradeWeightMiss ); ini.SetValue( "Options", "GradeWeightHitMine", m_iGradeWeightHitMine ); ini.SetValue( "Options", "GradeWeightOK", m_iGradeWeightOK ); ini.SetValue( "Options", "GradeWeightNG", m_iGradeWeightNG ); ini.SetValue( "Options", "NumGradeTiersUsed", m_iNumGradeTiersUsed ); for( int g=0; g<NUM_GRADE_TIERS; g++ ) { Grade grade = (Grade)g; CString s = GradeToString( grade ); ini.SetValue( "Options", "GradePercent"+s, m_fGradePercent[g] ); } ini.SetValue( "Options", "GradeTier02IsAllPerfects", m_bGradeTier02IsAllPerfects ); ini.SetValue( "Options", "SuperMeterPercentChangeMarvelous",m_fSuperMeterPercentChangeMarvelous ); ini.SetValue( "Options", "SuperMeterPercentChangePerfect", m_fSuperMeterPercentChangePerfect ); ini.SetValue( "Options", "SuperMeterPercentChangeGreat", m_fSuperMeterPercentChangeGreat ); ini.SetValue( "Options", "SuperMeterPercentChangeGood", m_fSuperMeterPercentChangeGood ); ini.SetValue( "Options", "SuperMeterPercentChangeBoo", m_fSuperMeterPercentChangeBoo ); ini.SetValue( "Options", "SuperMeterPercentChangeMiss", m_fSuperMeterPercentChangeMiss ); ini.SetValue( "Options", "SuperMeterPercentChangeHitMine", m_fSuperMeterPercentChangeHitMine ); ini.SetValue( "Options", "SuperMeterPercentChangeOK", m_fSuperMeterPercentChangeOK ); ini.SetValue( "Options", "SuperMeterPercentChangeNG", m_fSuperMeterPercentChangeNG ); ini.SetValue( "Options", "MercifulSuperMeter", m_bMercifulSuperMeter ); ini.SetValue( "Options", "DelayedEscape", m_bDelayedEscape ); ini.SetValue( "Options", "HiddenSongs", m_bHiddenSongs ); ini.SetValue( "Options", "Vsync", m_bVsync ); ini.SetValue( "Options", "Interlaced", m_bInterlaced ); ini.SetValue( "Options", "PAL", m_bPAL ); ini.SetValue( "Options", "HowToPlay", m_bInstructions ); ini.SetValue( "Options", "Caution", m_bShowDontDie ); ini.SetValue( "Options", "ShowSelectGroup", m_bShowSelectGroup ); ini.SetValue( "Options", "ShowNative", m_bShowNative ); ini.SetValue( "Options", "ArcadeOptionsNavigation", m_bArcadeOptionsNavigation ); ini.SetValue( "Options", "DelayedTextureDelete", m_bDelayedTextureDelete ); ini.SetValue( "Options", "TexturePreload", m_bTexturePreload ); ini.SetValue( "Options", "DelayedScreenLoad", m_bDelayedScreenLoad ); ini.SetValue( "Options", "DelayedModelDelete", m_bDelayedModelDelete ); ini.SetValue( "Options", "BannerCache", m_BannerCache ); ini.SetValue( "Options", "PalettedBannerCache", m_bPalettedBannerCache ); ini.SetValue( "Options", "FastLoad", m_bFastLoad ); ini.SetValue( "Options", "MusicWheelUsesSections", m_MusicWheelUsesSections ); ini.SetValue( "Options", "MusicWheelSwitchSpeed", m_iMusicWheelSwitchSpeed ); ini.SetValue( "Options", "EasterEggs", m_bEasterEggs ); ini.SetValue( "Options", "MarvelousTiming", m_iMarvelousTiming ); ini.SetValue( "Options", "CoinMode", m_iCoinMode ); ini.SetValue( "Options", "CoinsPerCredit", m_iCoinsPerCredit ); ini.SetValue( "Options", "Premium", m_Premium ); ini.SetValue( "Options", "DelayedCreditsReconcile", m_bDelayedCreditsReconcile ); ini.SetValue( "Options", "BoostAppPriority", m_iBoostAppPriority ); ini.SetValue( "Options", "PickExtraStage", m_bPickExtraStage ); ini.SetValue( "Options", "ComboContinuesBetweenSongs", m_bComboContinuesBetweenSongs ); ini.SetValue( "Options", "LongVerSeconds", m_fLongVerSongSeconds ); ini.SetValue( "Options", "MarathonVerSeconds", m_fMarathonVerSongSeconds ); ini.SetValue( "Options", "ShowSongOptions", m_ShowSongOptions ); ini.SetValue( "Options", "AllowUnacceleratedRenderer", m_bAllowUnacceleratedRenderer ); ini.SetValue( "Options", "ThreadedInput", m_bThreadedInput ); ini.SetValue( "Options", "ThreadedMovieDecode", m_bThreadedMovieDecode ); ini.SetValue( "Options", "ScreenTestMode", m_bScreenTestMode ); ini.SetValue( "Options", "MachineName", m_sMachineName ); ini.SetValue( "Options", "IgnoredMessageWindows", m_sIgnoredMessageWindows ); ini.SetValue( "Options", "SoloSingle", m_bSoloSingle ); ini.SetValue( "Options", "DancePointsForOni", m_bDancePointsForOni ); ini.SetValue( "Options", "PercentageScoring", m_bPercentageScoring ); ini.SetValue( "Options", "MinPercentageForMachineSongHighScore", m_fMinPercentageForMachineSongHighScore ); ini.SetValue( "Options", "MinPercentageForMachineCourseHighScore", m_fMinPercentageForMachineCourseHighScore ); ini.SetValue( "Options", "Disqualification", m_bDisqualification ); ini.SetValue( "Options", "ShowLyrics", m_bShowLyrics ); ini.SetValue( "Options", "AutogenSteps", m_bAutogenSteps ); ini.SetValue( "Options", "AutogenGroupCourses", m_bAutogenGroupCourses ); ini.SetValue( "Options", "BreakComboToGetItem", m_bBreakComboToGetItem ); ini.SetValue( "Options", "LockCourseDifficulties", m_bLockCourseDifficulties ); ini.SetValue( "Options", "ShowDancingCharacters", m_ShowDancingCharacters ); ini.SetValue( "Options", "UseUnlockSystem", m_bUseUnlockSystem ); ini.SetValue( "Options", "FirstRun", m_bFirstRun ); ini.SetValue( "Options", "AutoMapJoysticks", m_bAutoMapOnJoyChange ); ini.SetValue( "Options", "CpuClock", m_iCpuClock ); ini.SetValue( "Options", "CoursesToShowRanking", m_sCoursesToShowRanking ); ini.SetValue( "Options", "GetRankingName", m_iGetRankingName ); ini.SetValue( "Options", "SmoothLines", m_bSmoothLines ); ini.SetValue( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds ); ini.SetValue( "Options", "CourseSortOrder", m_iCourseSortOrder ); ini.SetValue( "Options", "MoveRandomToEnd", m_bMoveRandomToEnd ); ini.SetValue( "Options", "SubSortByNumSteps", m_bSubSortByNumSteps ); ini.SetValue( "Options", "ScoringType", m_iScoringType ); ini.SetValue( "Options", "ProgressiveLifebar", m_iProgressiveLifebar ); ini.SetValue( "Options", "ProgressiveStageLifebar", m_iProgressiveStageLifebar ); ini.SetValue( "Options", "ProgressiveNonstopLifebar", m_iProgressiveNonstopLifebar ); ini.SetValue( "Options", "ShowBeginnerHelper", m_bShowBeginnerHelper ); ini.SetValue( "Options", "Language", m_sLanguage ); ini.SetValue( "Options", "EndlessBreakEnabled", m_bEndlessBreakEnabled ); ini.SetValue( "Options", "EndlessStagesUntilBreak", m_iEndlessNumStagesUntilBreak ); ini.SetValue( "Options", "EndlessBreakLength", m_iEndlessBreakLength ); ini.SetValue( "Options", "DisableScreenSaver", m_bDisableScreenSaver ); ini.SetValue( "Options", "ProductID", m_iProductID ); FOREACH_PlayerNumber( p ) ini.SetValue( "Options", ssprintf("DefaultLocalProfileIDP%d",p+1), m_sDefaultLocalProfileID[p] ); ini.SetValue( "Options", "CenterImageTranslateX", m_iCenterImageTranslateX ); ini.SetValue( "Options", "CenterImageTranslateY", m_iCenterImageTranslateY ); ini.SetValue( "Options", "CenterImageScaleX", m_fCenterImageScaleX ); ini.SetValue( "Options", "CenterImageScaleY", m_fCenterImageScaleY ); ini.SetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency ); ini.SetValue( "Options", "AllowExtraStage", m_bAllowExtraStage ); ini.SetValue( "Options", "HideDefaultNoteSkin", m_bHideDefaultNoteSkin ); ini.SetValue( "Options", "MaxHighScoresPerListForMachine", m_iMaxHighScoresPerListForMachine ); ini.SetValue( "Options", "MaxHighScoresPerListForPlayer", m_iMaxHighScoresPerListForPlayer ); ini.SetValue( "Options", "PadStickSeconds", m_fPadStickSeconds ); ini.SetValue( "Options", "ForceMipMaps", m_bForceMipMaps ); ini.SetValue( "Options", "TrilinearFiltering", m_bTrilinearFiltering ); ini.SetValue( "Options", "AnisotropicFiltering", m_bAnisotropicFiltering ); ini.SetValue( "Options", "AutoRestart", g_bAutoRestart ); ini.SetValue( "Options", "SoundWriteAhead", m_iSoundWriteAhead ); /* Only write these if they aren't the default. This ensures that we can change * the default and have it take effect for everyone (except people who * tweaked this value). */ if(m_fSoundVolume != DEFAULT_SOUND_VOLUME) ini.SetValue( "Options", "SoundVolume", m_fSoundVolume ); ini.SetValue( "Options", "AdditionalSongFolders", m_sAdditionalSongFolders); ini.SetValue( "Options", "AdditionalFolders", m_sAdditionalFolders); ini.SetValue( "Debug", "LogToDisk", m_bLogToDisk ); ini.SetValue( "Debug", "ForceLogFlush", m_bForceLogFlush ); ini.SetValue( "Debug", "ShowLogOutput", m_bShowLogOutput ); ini.SetValue( "Debug", "Timestamping", m_bTimestamping ); ini.SetValue( "Debug", "LogSkips", m_bLogSkips ); ini.SetValue( "Debug", "LogCheckpoints", m_bLogCheckpoints ); ini.SetValue( "Debug", "ShowLoadingWindow", m_bShowLoadingWindow ); FOREACH_CONST( IPreference*, *g_pvpSubscribers, p ) (*p)->WriteTo( ini ); ini.WriteFile( STEPMANIA_INI_PATH ); }
Grade StageStats::GetGrade( PlayerNumber pn ) const { ASSERT( GAMESTATE->IsPlayerEnabled(pn) ); // shouldn't be calling this is player isn't joined! if( bFailedEarlier[pn] ) return GRADE_FAILED; /* XXX: This entire calculation should be in ScoreKeeper, but final evaluation * is tricky since at that point the ScoreKeepers no longer exist. * * See http://www.aaroninjapan.com/ddr2.html ("Regular play scoring") */ float Possible = 0, Actual = 0; FOREACH_TapNoteScore( tns ) { int iTapScoreValue; switch( tns ) { case TNS_NONE: iTapScoreValue = 0; break; case TNS_HIT_MINE: iTapScoreValue = PREFSMAN->m_iGradeWeightHitMine; break; case TNS_MISS: iTapScoreValue = PREFSMAN->m_iGradeWeightMiss; break; case TNS_BOO: iTapScoreValue = PREFSMAN->m_iGradeWeightBoo; break; case TNS_GOOD: iTapScoreValue = PREFSMAN->m_iGradeWeightGood; break; case TNS_GREAT: iTapScoreValue = PREFSMAN->m_iGradeWeightGreat; break; case TNS_PERFECT: iTapScoreValue = PREFSMAN->m_iGradeWeightPerfect; break; case TNS_MARVELOUS: iTapScoreValue = PREFSMAN->m_iGradeWeightMarvelous; break; default: FAIL_M( ssprintf("%i", tns) ); break; } Actual += iTapNoteScores[pn][tns] * iTapScoreValue; Possible += iTapNoteScores[pn][tns] * PREFSMAN->m_iGradeWeightMarvelous; } FOREACH_HoldNoteScore( hns ) { int iHoldScoreValue; switch( hns ) { case HNS_NONE: iHoldScoreValue = 0; break; case HNS_NG: iHoldScoreValue = PREFSMAN->m_iGradeWeightNG; break; case HNS_OK: iHoldScoreValue = PREFSMAN->m_iGradeWeightOK; break; default: FAIL_M( ssprintf("%i", hns) ); break; } Actual += iHoldNoteScores[pn][hns] * iHoldScoreValue; Possible += iHoldNoteScores[pn][hns] * PREFSMAN->m_iGradeWeightOK; } LOG->Trace( "GetGrade: Actual: %f, Possible: %f", Actual, Possible ); #define ROUNDING_ERROR 0.00001f Grade grade = GRADE_FAILED; float fPercent = (Possible == 0) ? 0 : Actual / Possible; FOREACH_Grade(g) { if( fPercent >= PREFSMAN->m_fGradePercent[g]-ROUNDING_ERROR ) { grade = g; break; } } LOG->Trace( "GetGrade: Grade: %s, %i", GradeToString(grade).c_str(), PREFSMAN->m_bGradeTier02IsAllPerfects ); if( PREFSMAN->m_bGradeTier02IsAllPerfects ) { if( iTapNoteScores[pn][TNS_MARVELOUS] > 0 && iTapNoteScores[pn][TNS_PERFECT] == 0 && iTapNoteScores[pn][TNS_GREAT] == 0 && iTapNoteScores[pn][TNS_GOOD] == 0 && iTapNoteScores[pn][TNS_BOO] == 0 && iTapNoteScores[pn][TNS_MISS] == 0 && iTapNoteScores[pn][TNS_HIT_MINE] == 0 && iHoldNoteScores[pn][HNS_NG] == 0 ) return GRADE_TIER_1; if( iTapNoteScores[pn][TNS_PERFECT] > 0 && iTapNoteScores[pn][TNS_GREAT] == 0 && iTapNoteScores[pn][TNS_GOOD] == 0 && iTapNoteScores[pn][TNS_BOO] == 0 && iTapNoteScores[pn][TNS_MISS] == 0 && iTapNoteScores[pn][TNS_HIT_MINE] == 0 && iHoldNoteScores[pn][HNS_NG] == 0 ) return GRADE_TIER_2; return max( grade, GRADE_TIER_3 ); } return grade; }