From 9bea3951b65191014c8195111d0d82f2d53784bc Mon Sep 17 00:00:00 2001 From: Chris Gomez Date: Tue, 25 Feb 2003 11:20:45 +0000 Subject: [PATCH] Add option to view dance points instead of percentage score in oni courses. Eval screen numbers are probably going to overflow off the left side until we get a new number skin. Apparently arcade behavior is to *not* dim the extra digits for dance points, but I think this looks cleaner. --- stepmania/Themes/default/metrics.ini | 3 ++ stepmania/src/LifeMeterBattery.cpp | 44 ++++++++++++++++------- stepmania/src/PrefsManager.cpp | 3 ++ stepmania/src/PrefsManager.h | 1 + stepmania/src/ScreenAppearanceOptions.cpp | 4 +++ stepmania/src/ScreenEvaluation.cpp | 41 ++++++++++++--------- 6 files changed, 68 insertions(+), 28 deletions(-) diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 4967e5e5b6..a525b0e068 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -402,7 +402,9 @@ GradeP1X=94 GradeP2X=546 GradeY=100 PercentBaseP1X=120 +PercentBaseDPP1X=170 PercentBaseP2X=572 +PercentBaseDPP2X=622 PercentBaseY=134 JudgeLabelsX=320 MarvelousP1X=230 @@ -821,6 +823,7 @@ Theme=Choose from this list of installed theme packs.::For more information abou NoteSkin=Choose from this list of installed note skins.::For more information about creating a note skin, see the README. HowToPlay=Toggle whether the How To Play screen is shown. Caution=Toggle whether the Caution screen is shown. +OniScoreDisplay=Toggle whether the score in Oni mode displays Dance Points or the Dance Percent. SongGroup=Toggle whether the Select Group screen is shown. WheelSections=ALWAYS means sections in group + ABC; NEVER means no sections;::ABC ONLY shows sections in just ABC sort Translations=Choose whether to displays song titles in their native::language (日本語), or to transliterate when possible diff --git a/stepmania/src/LifeMeterBattery.cpp b/stepmania/src/LifeMeterBattery.cpp index 0a14c7ef4a..f68c293b51 100644 --- a/stepmania/src/LifeMeterBattery.cpp +++ b/stepmania/src/LifeMeterBattery.cpp @@ -27,6 +27,8 @@ const float PERCENT_Y = 0; const float BATTERY_BLINK_TIME = 1.2f; +const int NUM_DANCE_POINT_DIGITS = 5; + LifeMeterBattery::LifeMeterBattery() { @@ -61,10 +63,20 @@ void LifeMeterBattery::Load( PlayerNumber pn ) if( bPlayerEnabled ) this->AddChild( &m_textNumLives ); - m_textPercent.LoadFromNumbers( THEME->GetPathTo("Numbers","gameplay battery percent numbers") ); - m_textPercent.TurnShadowOff(); - m_textPercent.SetZoom( 0.7f ); - m_textPercent.SetText( "00.0%" ); + if(PREFSMAN->m_bDancePointsForOni) + { + m_textPercent.LoadFromNumbers( THEME->GetPathTo("Numbers","gameplay battery dance point numbers") ); + m_textPercent.TurnShadowOff(); + m_textPercent.SetZoom( 0.7f ); + m_textPercent.SetText( " " ); + } + else + { + m_textPercent.LoadFromNumbers( THEME->GetPathTo("Numbers","gameplay battery percent numbers") ); + m_textPercent.TurnShadowOff(); + m_textPercent.SetZoom( 0.7f ); + m_textPercent.SetText( "00.0%" ); + } if( bPlayerEnabled ) this->AddChild( &m_textPercent ); @@ -149,16 +161,24 @@ void LifeMeterBattery::ChangeLife( HoldNoteScore score, TapNoteScore tscore ) void LifeMeterBattery::OnDancePointsChange() { int iActualDancePoints = GAMESTATE->m_CurStageStats.iActualDancePoints[m_PlayerNumber]; - int iPossibleDancePoints = GAMESTATE->m_CurStageStats.iPossibleDancePoints[m_PlayerNumber]; - iPossibleDancePoints = max( 1, iPossibleDancePoints ); - float fPercentDancePoints = iActualDancePoints / (float)iPossibleDancePoints + 0.00001f; // correct for rounding errors + CString sNumToDisplay; + + if(!PREFSMAN->m_bDancePointsForOni) + { + int iPossibleDancePoints = GAMESTATE->m_CurStageStats.iPossibleDancePoints[m_PlayerNumber]; + iPossibleDancePoints = max( 1, iPossibleDancePoints ); + float fPercentDancePoints = iActualDancePoints / (float)iPossibleDancePoints + 0.00001f; // correct for rounding errors -// LOG->Trace( "Actual %d, Possible %d, Percent %f\n", iActualDancePoints, iPossibleDancePoints, fPercentDancePoints ); + // LOG->Trace( "Actual %d, Possible %d, Percent %f\n", iActualDancePoints, iPossibleDancePoints, fPercentDancePoints ); + + float fNumToDisplay = MAX( 0, fPercentDancePoints*100 ); + sNumToDisplay = ssprintf("%03.1f%%", fNumToDisplay); + if( sNumToDisplay.GetLength() == 4 ) + sNumToDisplay = "0" + sNumToDisplay; + } + else + sNumToDisplay = ssprintf( "%*d", NUM_DANCE_POINT_DIGITS , iActualDancePoints ); - float fNumToDisplay = MAX( 0, fPercentDancePoints*100 ); - CString sNumToDisplay = ssprintf("%03.1f%%", fNumToDisplay); - if( sNumToDisplay.GetLength() == 4 ) - sNumToDisplay = "0" + sNumToDisplay; m_textPercent.SetText( sNumToDisplay ); } diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 98081e2aed..134b1c7af1 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -86,6 +86,7 @@ PrefsManager::PrefsManager() m_bShowSongOptions = true; m_DefaultFailType = SongOptions::FAIL_ARCADE; m_bDDRExtremeDifficultySelect = false; + m_bDancePointsForOni = false; //DDR-Extreme style dance points instead of max2 percent /* DDR Extreme-style extra stage support. * Default off so people used to the current behavior (or those with extra @@ -178,6 +179,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame ) ini.GetValueI( "Options", "DefaultFailType", (int&)m_DefaultFailType ); ini.GetValueB( "Options", "bAllowSoftwareRenderer", m_bAllowSoftwareRenderer ); ini.GetValueB( "Options", "DDRExtremeDifficultySelect", m_bDDRExtremeDifficultySelect ); + ini.GetValueB( "Options", "DancePointsForOni", m_bDancePointsForOni ); m_asAdditionalSongFolders.clear(); @@ -253,6 +255,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() ini.SetValueI( "Options", "DefaultFailType", (int&)m_DefaultFailType ); ini.SetValueB( "Options", "bAllowSoftwareRenderer", m_bAllowSoftwareRenderer ); ini.SetValueB( "Options", "DDRExtremeDifficultySelect", m_bDDRExtremeDifficultySelect ); + ini.SetValueB( "Options", "DancePointsForOni", m_bDancePointsForOni ); /* Only write these if they aren't the default. This ensures that we can change diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index a74b7d445a..e8d63de78a 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -70,6 +70,7 @@ public: float m_fMarathonVerSongSeconds; bool m_bShowSongOptions; SongOptions::FailType m_DefaultFailType; + bool m_bDancePointsForOni; /* 0 = no; 1 = yes; -1 = auto (do whatever is appropriate for the arch). */ int m_iBoostAppPriority; diff --git a/stepmania/src/ScreenAppearanceOptions.cpp b/stepmania/src/ScreenAppearanceOptions.cpp index 940dc2a635..31b31c6d97 100644 --- a/stepmania/src/ScreenAppearanceOptions.cpp +++ b/stepmania/src/ScreenAppearanceOptions.cpp @@ -33,6 +33,7 @@ enum { AO_SKIN, AO_INSTRUCTIONS, AO_CAUTION, + AO_DANCE_POINTS_FOR_ONI, AO_SELECT_GROUP, AO_WHEEL_SECTIONS, AO_SHOW_TRANSLATIONS, @@ -46,6 +47,7 @@ OptionRowData g_AppearanceOptionsLines[NUM_APPEARANCE_OPTIONS_LINES] = { { "Note\nSkin", 0, {""} }, // fill this in on ImportOptions() { "How To\nPlay", 2, {"SKIP","SHOW"} }, { "Caution", 2, {"SKIP","SHOW"} }, + { "Oni Score\nDisplay", 2, {"PERCENT","DANCE POINTS"} }, { "Song\nGroup", 2, {"ALL MUSIC","CHOOSE"} }, { "Wheel\nSections", 3, {"NEVER","ALWAYS", "ABC ONLY"} }, { "Translations", 2, {"NATIVE","TRANSLITERATE"} }, @@ -160,6 +162,7 @@ void ScreenAppearanceOptions::ImportOptions() m_iSelectedOption[0][AO_INSTRUCTIONS] = PREFSMAN->m_bInstructions? 1:0; m_iSelectedOption[0][AO_CAUTION] = PREFSMAN->m_bShowDontDie? 1:0; // m_iSelectedOption[0][AO_DIFF_SELECT] = PREFSMAN->m_bDDRExtremeDifficultySelect? 1:0; + m_iSelectedOption[0][AO_DANCE_POINTS_FOR_ONI] = PREFSMAN->m_bDancePointsForOni? 1:0; m_iSelectedOption[0][AO_SELECT_GROUP] = PREFSMAN->m_bShowSelectGroup? 1:0; m_iSelectedOption[0][AO_WHEEL_SECTIONS] = (int)PREFSMAN->m_MusicWheelUsesSections; m_iSelectedOption[0][AO_SHOW_TRANSLATIONS] = PREFSMAN->m_bShowTranslations; @@ -190,6 +193,7 @@ void ScreenAppearanceOptions::ExportOptions() PREFSMAN->m_bShowSelectGroup = !!m_iSelectedOption[0][AO_SELECT_GROUP]; (int&)PREFSMAN->m_MusicWheelUsesSections = m_iSelectedOption[0][AO_WHEEL_SECTIONS]; PREFSMAN->m_bShowTranslations = !!m_iSelectedOption[0][AO_SHOW_TRANSLATIONS]; + PREFSMAN->m_bDancePointsForOni = !!m_iSelectedOption[0][AO_DANCE_POINTS_FOR_ONI]; PREFSMAN->SaveGamePrefsToDisk(); PREFSMAN->SaveGlobalPrefsToDisk(); diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index b3dfbaa4d0..72166a77e9 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -37,6 +37,7 @@ #define GRADE_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("GradeP%dX",p+1)) #define GRADE_Y THEME->GetMetricF("ScreenEvaluation","GradeY") #define PERCENT_BASE_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("PercentBaseP%dX",p+1)) +#define PERCENT_BASE_DP_X( p ) THEME->GetMetricF("ScreenEvaluation",ssprintf("PercentBaseDPP%dX",p+1)) #define PERCENT_BASE_Y THEME->GetMetricF("ScreenEvaluation","PercentBaseY") #define JUDGE_LABELS_X THEME->GetMetricF("ScreenEvaluation","JudgeLabelsX") #define MARVELOUS_X(o,p) THEME->GetMetricF("ScreenEvaluation",ssprintf("Marvelous%sP%dX",o?"Oni":"",p+1)) @@ -327,28 +328,36 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) m_textOniPercentLarge[p].LoadFromNumbers( THEME->GetPathTo("Numbers","evaluation percent numbers") ); m_textOniPercentLarge[p].TurnShadowOff(); - m_textOniPercentLarge[p].SetXY( PERCENT_BASE_X(p), PERCENT_BASE_Y ); + m_textOniPercentLarge[p].SetXY( (PREFSMAN->m_bDancePointsForOni ? PERCENT_BASE_DP_X(p) : PERCENT_BASE_X(p) ), PERCENT_BASE_Y ); m_textOniPercentLarge[p].SetHorizAlign( Actor::align_right ); m_textOniPercentLarge[p].SetVertAlign( Actor::align_bottom ); m_textOniPercentLarge[p].SetEffectGlowShift( 2.5f ); this->AddChild( &m_textOniPercentLarge[p] ); - m_textOniPercentSmall[p].LoadFromNumbers( THEME->GetPathTo("Numbers","evaluation percent numbers") ); - m_textOniPercentSmall[p].TurnShadowOff(); - m_textOniPercentSmall[p].SetZoom( 0.5f ); - m_textOniPercentSmall[p].SetXY( PERCENT_BASE_X(p), PERCENT_BASE_Y ); - m_textOniPercentSmall[p].SetHorizAlign( Actor::align_left ); - m_textOniPercentSmall[p].SetVertAlign( Actor::align_bottom ); - m_textOniPercentSmall[p].SetEffectGlowShift( 2.5f ); - this->AddChild( &m_textOniPercentSmall[p] ); + if(!PREFSMAN->m_bDancePointsForOni) + { + m_textOniPercentSmall[p].LoadFromNumbers( THEME->GetPathTo("Numbers","evaluation percent numbers") ); + m_textOniPercentSmall[p].TurnShadowOff(); + m_textOniPercentSmall[p].SetZoom( 0.5f ); + m_textOniPercentSmall[p].SetXY( PERCENT_BASE_X(p), PERCENT_BASE_Y ); + m_textOniPercentSmall[p].SetHorizAlign( Actor::align_left ); + m_textOniPercentSmall[p].SetVertAlign( Actor::align_bottom ); + m_textOniPercentSmall[p].SetEffectGlowShift( 2.5f ); + this->AddChild( &m_textOniPercentSmall[p] ); + } - stageStats.iPossibleDancePoints[p] = max( 1, stageStats.iPossibleDancePoints[p] ); - float fPercentDancePoints = stageStats.iActualDancePoints[p] / (float)stageStats.iPossibleDancePoints[p] + 0.0001f; // correct for rounding errors - fPercentDancePoints = max( fPercentDancePoints, 0 ); - int iPercentDancePointsLarge = int(fPercentDancePoints*100); - int iPercentDancePointsSmall = int( (fPercentDancePoints*100 - int(fPercentDancePoints*100)) * 10 ); - m_textOniPercentLarge[p].SetText( ssprintf("%02d", iPercentDancePointsLarge) ); - m_textOniPercentSmall[p].SetText( ssprintf(".%01d%%", iPercentDancePointsSmall) ); + if(PREFSMAN->m_bDancePointsForOni) + m_textOniPercentLarge[p].SetText( ssprintf("%d", stageStats.iActualDancePoints[p]) ); + else + { + stageStats.iPossibleDancePoints[p] = max( 1, stageStats.iPossibleDancePoints[p] ); + float fPercentDancePoints = stageStats.iActualDancePoints[p] / (float)stageStats.iPossibleDancePoints[p] + 0.0001f; // correct for rounding errors + fPercentDancePoints = max( fPercentDancePoints, 0 ); + int iPercentDancePointsLarge = int(fPercentDancePoints*100); + int iPercentDancePointsSmall = int( (fPercentDancePoints*100 - int(fPercentDancePoints*100)) * 10 ); + m_textOniPercentLarge[p].SetText( ssprintf("%02d", iPercentDancePointsLarge) ); + m_textOniPercentSmall[p].SetText( ssprintf(".%01d%%", iPercentDancePointsSmall) ); + } // StageInfo stuff m_sprCourseFrame[p].Load( THEME->GetPathTo("Graphics","evaluation stage frame 2x1") );