Skip to content

Commit

Permalink
Changed Song and ScreenEdit to not save a .sm file when split timing …
Browse files Browse the repository at this point in the history
…is used.
  • Loading branch information
kyzentun committed Oct 2, 2015
1 parent 751caba commit 2d64694
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Docs/Changelog_language.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Example:
This means that three strings were added to the "ScreenDebugOverlay" section,
"Mute actions", "Mute actions on", and "Mute actions off".

2015/10/02
----------
* [ScreenEdit] save_success_no_sm_split_timing

2015/07/09
----------
* [ScreenDebugOverlay] Show Recent Errors
Expand Down
4 changes: 4 additions & 0 deletions Docs/Changelog_sm5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ The StepMania 5 Changelog covers all post-sm-ssc changes. For a list of changes
from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt.
________________________________________________________________________________

2015/10/02
----------
* [Edit Mode] .sm files will no longer be saved when split timing is used
because per-chart timing cannot be done in the .sm format. [kyzentun]

2015/09/21
----------
Expand Down
1 change: 1 addition & 0 deletions Themes/_fallback/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,7 @@ No backgrounds available=No backgrounds available
EditHelpText=Up/Down:\n change beat\nLeft/Right:\n change snap\nNumber keys:\n add/remove\n tap note\nN and M keys:\n swap tap notes\nCtrl + N/M:\n swap cycled segment\nCtrl + ,/.:\n cycle segments\nCreate hold note:\n Hold a number\n while moving\n Up or Down\nCreate roll note:\n Hold Shift,\n then create a\n hold note.\nSpace bar: Set area\n marker\nT key: Switch Timing\nEnter: Area Menu\nA Key: Alter Menu\nEscape: Main Menu\nF4: Timing Menu\nF1: Show help\nQ/W: Change record hold time.\nE/R: Toggle record holds
PlayRecordHelpText=Press START to end
Save successful.=Save successful.
save_success_no_sm_split_timing=Save successful. No SM saved because split timing was used.
Saved as SM and DWI.=Saved as SM and DWI.
Saved as SM.=Saved as SM.
Switched to=Switched to
Expand Down
23 changes: 19 additions & 4 deletions src/ScreenEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ AutoScreenMessage( SM_DoSaveAndExit );
AutoScreenMessage( SM_DoExit );
AutoScreenMessage( SM_AutoSaveSuccessful );
AutoScreenMessage( SM_SaveSuccessful );
AutoScreenMessage( SM_SaveSuccessNoSM );
AutoScreenMessage( SM_SaveFailed );

static const char *EditStateNames[] = {
Expand Down Expand Up @@ -3596,6 +3597,7 @@ void ScreenEdit::HandleMessage( const Message &msg )

static LocalizedString SAVE_SUCCESSFUL ( "ScreenEdit", "Save successful." );
static LocalizedString AUTOSAVE_SUCCESSFUL ( "ScreenEdit", "Autosave successful." );
static LocalizedString SAVE_SUCCESS_NO_SM_SPLIT_TIMING("ScreenEdit", "save_success_no_sm_split_timing");

static LocalizedString ADD_NEW_MOD ("ScreenEdit", "Adding New Mod");
static LocalizedString ADD_NEW_ATTACK ("ScreenEdit", "Adding New Attack");
Expand Down Expand Up @@ -4311,17 +4313,27 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
break; // do nothing
}
}
else if( SM == SM_SaveSuccessful )
else if(SM == SM_SaveSuccessful || SM == SM_SaveSuccessNoSM)
{
LOG->Trace( "Save successful." );
CopyToLastSave();
SetDirty( false );
SONGMAN->Invalidate( GAMESTATE->m_pCurSong );

LocalizedString const* message= &SAVE_SUCCESSFUL;
if(SM == SM_SaveSuccessNoSM)
{
message= &SAVE_SUCCESS_NO_SM_SPLIT_TIMING;
}

if( m_CurrentAction == save_on_exit )
ScreenPrompt::Prompt( SM_DoExit, SAVE_SUCCESSFUL );
{
ScreenPrompt::Prompt( SM_DoExit, *message );
}
else
SCREENMAN->SystemMessage( SAVE_SUCCESSFUL );
{
SCREENMAN->SystemMessage( *message );
}
}
else if( SM == SM_AutoSaveSuccessful )
{
Expand Down Expand Up @@ -4425,8 +4437,11 @@ void ScreenEdit::PerformSave(bool autosave)
m_pSteps->m_Attacks = GAMESTATE->m_pCurSteps[PLAYER_1]->m_Attacks;
m_pSteps->m_sAttackString = GAMESTATE->m_pCurSteps[PLAYER_1]->m_Attacks.ToVectorString();

// If one of the charts uses split timing, then it cannot be accurately
// saved in the .sm format. So saving the .sm is disabled.
bool uses_split= m_pSong->AnyChartUsesSplitTiming();
const ScreenMessage save_message= autosave ? SM_AutoSaveSuccessful
: SM_SaveSuccessful;
: (uses_split ? SM_SaveSuccessNoSM : SM_SaveSuccessful);

switch( EDIT_MODE.GetValue() )
{
Expand Down
21 changes: 19 additions & 2 deletions src/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,12 @@ void Song::Save(bool autosave)
return;
}
SaveToCacheFile();
SaveToSMFile();
// If one of the charts uses split timing, then it cannot be accurately
// saved in the .sm format. So saving the .sm is disabled.
if(!AnyChartUsesSplitTiming())
{
SaveToSMFile();
}
//SaveToDWIFile();

/* We've safely written our files and created backups. Rename non-SM and
Expand Down Expand Up @@ -1884,6 +1889,18 @@ bool Song::IsStepsUsingDifferentTiming(Steps *pSteps) const
return !pSteps->m_Timing.empty();
}

bool Song::AnyChartUsesSplitTiming() const
{
FOREACH_CONST(Steps*, m_vpSteps, s)
{
if(!(*s)->m_Timing.empty())
{
return true;
}
}
return false;
}

bool Song::HasSignificantBpmChangesOrStops() const
{
if( m_SongTiming.HasStops() || m_SongTiming.HasDelays() )
Expand Down Expand Up @@ -2377,4 +2394,4 @@ LUA_REGISTER_CLASS( Song )
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
*/
1 change: 1 addition & 0 deletions src/Song.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ class Song
bool IsEditAlreadyLoaded( Steps* pSteps ) const;

bool IsStepsUsingDifferentTiming(Steps *pSteps ) const;
bool AnyChartUsesSplitTiming() const;

/**
* @brief An array of keysound file names (e.g. "beep.wav").
Expand Down

0 comments on commit 2d64694

Please sign in to comment.