Restore mods after setting #ATTACKS.

This commit is contained in:
Jason Felds
2011-07-12 22:27:14 -04:00
parent 1eb9d636bb
commit 36a5cd03c4
3 changed files with 20 additions and 4 deletions
+3
View File
@@ -14,6 +14,9 @@ StepMania 5.0 ????????? | 20110???
StepsUseChartName. Use this if you want your charts to have a unique name StepsUseChartName. Use this if you want your charts to have a unique name
in the options menu. If there is no #CHARTNAME or it is "Blank", it reverts in the options menu. If there is no #CHARTNAME or it is "Blank", it reverts
to the original behavior. This metric is false by default. [Wolfman2000] to the original behavior. This metric is false by default. [Wolfman2000]
* [ScreenEdit] Fixed a bug involving #ATTACKS. Now when you set an attack,
the mods are reverted back to how they were prior to the attack being set.
[Wolfman2000]
2011/07/09 2011/07/09
---------- ----------
+14 -4
View File
@@ -885,6 +885,8 @@ void ScreenEdit::Init()
} }
m_PlayerStateEdit.m_PlayerOptions.FromString( ModsLevel_Stage, EDIT_MODIFIERS ); m_PlayerStateEdit.m_PlayerOptions.FromString( ModsLevel_Stage, EDIT_MODIFIERS );
this->originalPlayerOptions.FromString(ModsLevel_Stage, EDIT_MODIFIERS);
m_pSteps->GetNoteData( m_NoteDataEdit ); m_pSteps->GetNoteData( m_NoteDataEdit );
m_NoteFieldEdit.SetXY( EDIT_X, EDIT_Y ); m_NoteFieldEdit.SetXY( EDIT_X, EDIT_Y );
m_NoteFieldEdit.SetZoom( 0.5f ); m_NoteFieldEdit.SetZoom( 0.5f );
@@ -2253,9 +2255,11 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
} }
} }
ModsGroup<PlayerOptions> &toEdit = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions;
this->originalPlayerOptions.Assign(ModsLevel_Preferred, toEdit.GetPreferred());
g_fLastInsertAttackPositionSeconds = start; g_fLastInsertAttackPositionSeconds = start;
g_fLastInsertAttackDurationSeconds = end - start; g_fLastInsertAttackDurationSeconds = end - start;
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.Assign( ModsLevel_Stage, po ); toEdit.Assign( ModsLevel_Stage, po );
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions ); SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions );
break; break;
} }
@@ -3172,11 +3176,13 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
} }
else else
{ {
ModsGroup<PlayerOptions> &toEdit = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions;
this->originalPlayerOptions.Assign(ModsLevel_Preferred, toEdit.GetPreferred());
PlayerOptions po; PlayerOptions po;
if (iAttack >= 0) if (iAttack >= 0)
po.FromString(attacks[iAttack].sModifiers); po.FromString(attacks[iAttack].sModifiers);
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.Assign( ModsLevel_Preferred, po ); toEdit.Assign( ModsLevel_Preferred, po );
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions ); SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions );
} }
} }
@@ -3211,7 +3217,8 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
} }
else if (SM == SM_BackFromInsertStepAttackPlayerOptions) else if (SM == SM_BackFromInsertStepAttackPlayerOptions)
{ {
PlayerOptions poChosen = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetPreferred(); ModsGroup<PlayerOptions> &toRestore = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions;
PlayerOptions poChosen = toRestore.GetPreferred();
RString mods = poChosen.GetString(); RString mods = poChosen.GetString();
if (g_fLastInsertAttackPositionSeconds >= 0) if (g_fLastInsertAttackPositionSeconds >= 0)
@@ -3229,6 +3236,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
else else
attacks.push_back(a); attacks.push_back(a);
} }
toRestore.Assign(ModsLevel_Preferred, this->originalPlayerOptions.GetPreferred());
} }
else if( SM == SM_BackFromInsertCourseAttackPlayerOptions ) else if( SM == SM_BackFromInsertCourseAttackPlayerOptions )
{ {
@@ -4139,11 +4147,13 @@ void ScreenEdit::HandleAlterMenuChoice(AlterMenuChoice c, const vector<int> &iAn
m_pSteps->m_Attacks : m_pSong->m_Attacks; m_pSteps->m_Attacks : m_pSong->m_Attacks;
int iAttack = FindAttackAtTime(attacks, start); int iAttack = FindAttackAtTime(attacks, start);
ModsGroup<PlayerOptions> &toEdit = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions;
this->originalPlayerOptions.Assign(ModsLevel_Preferred, toEdit.GetPreferred());
PlayerOptions po; PlayerOptions po;
if (iAttack >= 0) if (iAttack >= 0)
po.FromString(attacks[iAttack].sModifiers); po.FromString(attacks[iAttack].sModifiers);
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.Assign( ModsLevel_Preferred, po ); toEdit.Assign( ModsLevel_Preferred, po );
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions ); SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions );
SetDirty(true); SetDirty(true);
break; break;
+3
View File
@@ -266,6 +266,9 @@ protected:
BitmapText m_textInputTips; BitmapText m_textInputTips;
/** @brief The player options before messing with attacks. */
ModsGroup<PlayerOptions> originalPlayerOptions;
/** /**
* @brief Keep a backup of the present Step TimingData when * @brief Keep a backup of the present Step TimingData when
* entering a playing or recording state. * entering a playing or recording state.