diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 4c91cc00a6..32527a7d76 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -476,15 +476,23 @@ bool ThemeManager::GetMetricB( CString sClassName, CString sValueName ) RageColor ThemeManager::GetMetricC( CString sClassName, CString sValueName ) { - float r=1,b=1,g=1,a=1; // initialize in case sscanf fails + float r=1,b=1,g=1,a=1; CString sValue = GetMetricRaw(sClassName,sValueName); int result = sscanf( GetMetricRaw(sClassName,sValueName), "%f,%f,%f,%f", &r, &g, &b, &a ); - if( result != 4 ) - { - LOG->Warn( "The color value '%s' for NoteSkin metric '%s : %s' is invalid.", GetMetricRaw(sClassName,sValueName).c_str(), sClassName.c_str(), sValueName.c_str() ); - } + if( result == 4 ) + return RageColor(r,g,b,a); - return RageColor(r,g,b,a); + int ir=255,ib=255,ig=255,ia=255; + result = sscanf( GetMetricRaw(sClassName,sValueName), "#%2x%2x%2x%2x", &ir, &ig, &ib, &ia ); + if( result == 4 ) + return RageColor(ir / 255.0f, ig / 255.0f, ib / 255.0f, ia / 255.0f); + + result = sscanf( GetMetricRaw(sClassName,sValueName), "#%2x%2x%2x", &ir, &ig, &ib ); + if( result == 3 ) + return RageColor(ir / 255.0f, ig / 255.0f, ib / 255.0f, 1); + + LOG->Warn( "The color value '%s' for NoteSkin metric '%s : %s' is invalid.", GetMetricRaw(sClassName,sValueName).c_str(), sClassName.c_str(), sValueName.c_str() ); + return RageColor(1,1,1,1); } void ThemeManager::NextTheme()