diff --git a/Docs/Changelog_sm-ssc.txt b/Docs/Changelog_sm-ssc.txt index b6dd95661a..df9f984ddc 100644 --- a/Docs/Changelog_sm-ssc.txt +++ b/Docs/Changelog_sm-ssc.txt @@ -9,9 +9,19 @@ Not all changes are documented, for various reasons. supported but exist anyways.) _____________________________________________________________________________ +20100612 +-------- +* sm4svn r28359-r28364. [Chris Danford] + Notable commit logs: + * r28359: "fix BackgroundChange color values being written with commas. + Commas are a reserved character that seprate values in a tag. + Caret was used to separate RGBA values in a color in this case and + NotesLoaderSM already handles that." + * r28361: "normalize colors in BGCHANGES to HTML colors, to fix weird escaping" + 20100610 -------- -* Allow Rave and Battle to work again. +* Fix Rave/Battle crashes, allowing it to work again. * Chris Danford changed galopin's code for detecting pump mats. * [Actor] add basezoom, basezoomz, GetBaseZoomY(), GetBaseZoomZ(), and GetGlow() Lua bindings diff --git a/src/Background.cpp b/src/Background.cpp index 2636e5d1c0..93ed8a532e 100644 --- a/src/Background.cpp +++ b/src/Background.cpp @@ -168,8 +168,8 @@ void BackgroundImpl::Init() if( !USE_STATIC_BG ) { - m_StaticBackgroundDef.m_sColor1 = "0,0,0,0"; - m_StaticBackgroundDef.m_sColor2 = "0,0,0,0"; + m_StaticBackgroundDef.m_sColor1 = "#00000000"; + m_StaticBackgroundDef.m_sColor2 = "#00000000"; } // load transitions @@ -343,8 +343,8 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun ASSERT( !sEffect.empty() ); // Set Lua color globals - LuaThreadVariable sColor1( "Color1", bd.m_sColor1.empty() ? RString("1,1,1,1") : bd.m_sColor1 ); - LuaThreadVariable sColor2( "Color2", bd.m_sColor2.empty() ? RString("1,1,1,1") : bd.m_sColor2 ); + LuaThreadVariable sColor1( "Color1", bd.m_sColor1.empty() ? RString("#FFFFFFFF") : bd.m_sColor1 ); + LuaThreadVariable sColor2( "Color2", bd.m_sColor2.empty() ? RString("#FFFFFFFF") : bd.m_sColor2 ); // Resolve the effect file. RString sEffectFile; diff --git a/src/BackgroundUtil.cpp b/src/BackgroundUtil.cpp index 8c96ed5461..a66a27dbf2 100644 --- a/src/BackgroundUtil.cpp +++ b/src/BackgroundUtil.cpp @@ -60,7 +60,7 @@ RString BackgroundChange::GetTextDescription() const if( !m_def.m_sEffect.empty() ) vsParts.push_back( m_def.m_sEffect ); if( !m_def.m_sColor1.empty() ) vsParts.push_back( m_def.m_sColor1 ); if( !m_def.m_sColor2.empty() ) vsParts.push_back( m_def.m_sColor2 ); - + if( vsParts.empty() ) vsParts.push_back( "(empty)" ); @@ -118,7 +118,7 @@ void BackgroundUtil::GetBackgroundEffects( const RString &_sName, vectorGetSongDir()+sMatch, vsPathsOut, true, true ); } - + vsNamesOut.clear(); FOREACH_CONST( RString, vsPathsOut, s ) vsNamesOut.push_back( Basename(*s) ); @@ -217,7 +217,7 @@ static void GetFilterToFileNames( const RString sBaseDir, const Song *pSong, set IniFile ini; RString sPath = sBaseDir+pSong->m_sGroupName+"/"+"BackgroundMapping.ini"; ini.ReadFile( sPath ); - + RString sSection; bool bSuccess = ini.GetValue( "GenreToSection", pSong->m_sGenre, sSection ); if( !bSuccess ) @@ -269,15 +269,13 @@ void BackgroundUtil::GetGlobalRandomMovies( GetDirListing( RANDOMMOVIES_DIR+sMatch, vsPathsOut, false, true ); if( !vsPathsOut.empty() ) goto found_files; - + if( sMatch != NO_SONG_BG_FILE ) LOG->Warn( "Background missing: %s", sMatch.c_str() ); return; } - // // Search for the most appropriate background - // { set ssFileNameWhitelist; if( bTryInsideOfSongGroupAndGenreFirst && pSong && !pSong->m_sGenre.empty() ) @@ -300,20 +298,18 @@ void BackgroundUtil::GetGlobalRandomMovies( if( !ssFileNameWhitelist.empty() ) { - vector vsFiltered = vsPathsOut; - for( unsigned i=0; i vsMatches; + FOREACH_CONST( RString, vsPathsOut, s ) { - RString sBasename = Basename( vsPathsOut[i] ); + RString sBasename = Basename( *s ); bool bFound = ssFileNameWhitelist.find(sBasename) != ssFileNameWhitelist.end(); - if( !bFound ) - { - vsPathsOut.erase( vsPathsOut.begin()+i ); - i--; - } + if( bFound ) + vsMatches.push_back(*s); } - // If we filtered every movie out then this was a bad whitelist, so ignore the whitelist. - if( !vsFiltered.empty() ) - vsPathsOut = vsFiltered; + // If we found any that match the whitelist, use only them. + // If none match the whitelist, ignore the whitelist.. + if( !vsMatches.empty() ) + vsPathsOut = vsMatches; } if( !vsPathsOut.empty() ) diff --git a/src/NotesLoaderSM.cpp b/src/NotesLoaderSM.cpp index f79e284c79..a0c414c1f2 100644 --- a/src/NotesLoaderSM.cpp +++ b/src/NotesLoaderSM.cpp @@ -24,7 +24,8 @@ static void LoadFromSMTokens( Steps &out ) { - out.SetSavedToDisk( true ); // we're loading from disk, so this is by definintion already saved + // we're loading from disk, so this is by definition already saved: + out.SetSavedToDisk( true ); Trim( sStepsType ); Trim( sDescription ); @@ -38,14 +39,18 @@ static void LoadFromSMTokens( out.SetDescription( sDescription ); out.SetDifficulty( DwiCompatibleStringToDifficulty(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 ); + // Handle hacks that originated back when StepMania didn't have + // Difficulty_Challenge. (At least v1.64, possibly v3.0 final...) + if( out.GetDifficulty() == Difficulty_Hard ) + { + // HACK: SMANIAC used to be Difficulty_Hard with a special description. + if( sDescription.CompareNoCase("smaniac") == 0 ) + out.SetDifficulty( Difficulty_Challenge ); + + // HACK: CHALLENGE used to be Difficulty_Hard with a special description. + if( sDescription.CompareNoCase("challenge") == 0 ) + out.SetDifficulty( Difficulty_Challenge ); + } out.SetMeter( atoi(sMeter) ); vector saValues; @@ -88,9 +93,10 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) out.m_fBeat0OffsetInSeconds = 0; out.m_BPMSegments.clear(); out.m_StopSegments.clear(); - //out.m_WarpSegments.clear(); + out.m_WarpSegments.clear(); - //vector arrayWarpsFromNegativeBPMs; + vector arrayWarpsFromNegativeBPMs; + //vector arrayWarpsFromNegativeStops; for( unsigned i=0; iTrace( "Adding a freeze segment: beat: %f, seconds = %f", new_seg.m_fStartBeat, new_seg.m_fStopSeconds ); - - out.AddStopSegment( new_seg ); + if(fFreezeSeconds > 0.0f) + { + // LOG->Trace( "Adding a freeze segment: beat: %f, seconds = %f", new_seg.m_fStartBeat, new_seg.m_fStopSeconds ); + out.AddStopSegment( new_seg ); + } + else + { + // negative stops (hi JS!) -aj + if( PREFSMAN->m_bQuirksMode ) + { + // LOG->Trace( "Adding a negative freeze segment: beat: %f, seconds = %f", new_seg.m_fStartBeat, new_seg.m_fStopSeconds ); + out.AddStopSegment( new_seg ); + } + else + LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid stop at beat %f, length %f.", fFreezeBeat, fFreezeSeconds ); + } } } else if( sValueName=="DELAYS" ) @@ -153,7 +171,10 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) // LOG->Trace( "Adding a delay segment: beat: %f, seconds = %f", new_seg.m_fStartBeat, new_seg.m_fStopSeconds ); - out.AddStopSegment( new_seg ); + if(fFreezeSeconds > 0.0f) + out.AddStopSegment( new_seg ); + else + LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid delay at beat %f, length %f.", fFreezeBeat, fFreezeSeconds ); } } @@ -178,7 +199,6 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) const float fNewBPM = StringToFloat( arrayBPMChangeValues[1] ); // convert negative BPMs into Warp segments - /* if( fNewBPM < 0.0f ) { vector arrayNextBPMChangeValues; @@ -194,7 +214,6 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) float fWarpToBeat = fNextPositiveBeat + fDeltaBeat; WarpSegment wsTemp(BeatToNoteRow(fBeat),BeatToNoteRow(fWarpToBeat)); arrayWarpsFromNegativeBPMs.push_back(wsTemp); - */ /* LOG->Trace( ssprintf("==NotesLoSM negbpm==\nfnextposbeat = %f, fnextposbpm = %f,\nfdelta = %f, fwarpto = %f", fNextPositiveBeat, @@ -217,24 +236,20 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) fDeltaBeat,(fNextPositiveBPM/60.0f),abs(fNewBPM/60.0f),BeatToNoteRow(fNextPositiveBeat),BeatToNoteRow(fBeat)) ); */ - /* } else { // last BPM is a negative one? ugh. -aj (MAX_NOTE_ROW exists btw) } } - */ - if( PREFSMAN->m_bQuirksMode ) - { - // in quirks mode, accept all BPMs, not just positives. - // xxx: make this work for decent simfiles only? (lol) -aj + if(fNewBPM > 0.0f) out.AddBPMSegment( BPMSegment(BeatToNoteRow(fBeat), fNewBPM) ); - } else { - if( fNewBPM > 0.0f ) + out.m_bHasNegativeBpms = true; + // only add Negative BPMs in quirks mode -aj + if( PREFSMAN->m_bQuirksMode ) out.AddBPMSegment( BPMSegment(BeatToNoteRow(fBeat), fNewBPM) ); else LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid BPM change at beat %f, BPM %f.", fBeat, fNewBPM ); @@ -323,23 +338,21 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) } } } + */ // We should not support files that contain both Negative BPMs & Warps. // If Warps have been populated from Negative BPMs, then go through that // instead of using the data in the Warps tag. This should be above, // but it breaks compiling so... + if(arrayWarpsFromNegativeBPMs.size() > 0) { - if(arrayWarpsFromNegativeBPMs.size() > 0) + // zomg we already have some warps... + for( unsigned i=0; i