diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt
index 36e5a4dcf6..64fdd5115f 100644
--- a/Docs/Changelog_sm5.txt
+++ b/Docs/Changelog_sm5.txt
@@ -8,7 +8,12 @@ ________________________________________________________________________________
----------
* [EditMode] Play whole song and play from current beat will now play until
either the music or the notes end, whichever is greater. [kyzentun]
+ The screens used for setting the options used to play the screen and for
+ adding attacks can be set through the "OptionsScreen" and "SetModScreen"
+ metrics in the ScreenEdit section.
+* [GameState] ApplyPreferredSongOptionsToOtherLevels function added. [kyzentun]
* [Player] "ComboBreakOnImmediateHoldLetGo" theme metric added. [sillybear]
+* [PlayerState] ApplyPreferredOptionsToOtherLevels function added. [kyzentun]
2014/12/03
----------
diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml
index cfd1706a79..0500f90ab0 100644
--- a/Docs/Luadoc/Lua.xml
+++ b/Docs/Luadoc/Lua.xml
@@ -748,6 +748,7 @@
+
@@ -1162,6 +1163,7 @@
+
diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml
index 63d2514b33..421749d111 100644
--- a/Docs/Luadoc/LuaDocumentation.xml
+++ b/Docs/Luadoc/LuaDocumentation.xml
@@ -2257,6 +2257,9 @@ save yourself some time, copy this for undocumented things:
Applies the specified modifiers for the specified player's preferred modifier set.
+
+ Applies the song options of ModsLevel_Preferred to the other ModsLevels.
+
Applies the specified modifiers for the specified player for the current stage.
@@ -3369,6 +3372,9 @@ save yourself some time, copy this for undocumented things:
+
+ Applies the player options of ModsLevel_Preferred to the other ModsLevels.
+
Returns the current PlayerOptions for this PlayerState.
diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini
index bb275b869c..3f1143290c 100644
--- a/Themes/_fallback/metrics.ini
+++ b/Themes/_fallback/metrics.ini
@@ -4007,6 +4007,9 @@ PlayRecordHelpX=SCREEN_LEFT+20
PlayRecordHelpY=SCREEN_BOTTOM-20
PlayRecordHelpOnCommand=halign,0;valign,0;shadowlength,1
+SetModScreen="ScreenPlayerOptions"
+OptionsScreen="ScreenEditOptions"
+
LoopOnChartEnd=true
CurrentBeatFormat="%s:\n %.3f\n"
diff --git a/src/GameState.cpp b/src/GameState.cpp
index 02c7707747..8444616d4a 100644
--- a/src/GameState.cpp
+++ b/src/GameState.cpp
@@ -2470,6 +2470,12 @@ public:
lua_pushstring(L, so.GetString());
return 1;
}
+ static int ApplyPreferredSongOptionsToOtherLevels(T* p, lua_State* L)
+ {
+ p->m_SongOptions.Assign(ModsLevel_Preferred,
+ p->m_SongOptions.Get(ModsLevel_Preferred));
+ return 0;
+ }
static int ApplyStageModifiers( T* p, lua_State *L )
{
p->ApplyStageModifiers( Enum::Check(L, 1), SArg(2) );
@@ -2862,6 +2868,7 @@ public:
ADD_METHOD( GetSongOptions );
ADD_METHOD( GetSongOptionsObject );
ADD_METHOD( GetDefaultSongOptions );
+ ADD_METHOD( ApplyPreferredSongOptionsToOtherLevels );
ADD_METHOD( ApplyPreferredModifiers );
ADD_METHOD( ApplyStageModifiers );
ADD_METHOD( ClearStageModifiersIllegalForCourse );
diff --git a/src/PlayerState.cpp b/src/PlayerState.cpp
index bae87951e6..e5849d35de 100644
--- a/src/PlayerState.cpp
+++ b/src/PlayerState.cpp
@@ -213,6 +213,12 @@ const TimingData &PlayerState::GetDisplayedTiming() const
class LunaPlayerState: public Luna
{
public:
+ static int ApplyPreferredOptionsToOtherLevels(T* p, lua_State* L)
+ {
+ p->m_PlayerOptions.Assign(ModsLevel_Preferred,
+ p->m_PlayerOptions.Get(ModsLevel_Preferred));
+ return 0;
+ }
DEFINE_METHOD( GetPlayerNumber, m_PlayerNumber );
static int GetSongPosition( T* p, lua_State *L )
{
@@ -260,6 +266,7 @@ public:
LunaPlayerState()
{
+ ADD_METHOD( ApplyPreferredOptionsToOtherLevels );
ADD_METHOD( GetPlayerNumber );
ADD_METHOD( GetMultiPlayerNumber );
ADD_METHOD( GetPlayerController );
diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp
index 16421b3944..8949929298 100644
--- a/src/ScreenEdit.cpp
+++ b/src/ScreenEdit.cpp
@@ -59,6 +59,9 @@ const float RECORD_HOLD_SECONDS = 0.3f;
#define PLAY_RECORD_HELP_TEXT THEME->GetString(m_sName,"PlayRecordHelpText")
#define EDIT_HELP_TEXT THEME->GetString(m_sName,"EditHelpText")
+#define SET_MOD_SCREEN THEME->GetMetric("ScreenEdit", "SetModScreen")
+#define OPTIONS_SCREEN THEME->GetMetric("ScreenEdit", "OptionsScreen")
+
AutoScreenMessage( SM_UpdateTextInfo );
AutoScreenMessage( SM_BackFromMainMenu );
AutoScreenMessage( SM_BackFromAreaMenu );
@@ -2722,7 +2725,7 @@ bool ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
g_fLastInsertAttackPositionSeconds = start;
g_fLastInsertAttackDurationSeconds = end - start;
toEdit.Assign( ModsLevel_Stage, po );
- SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions );
+ SCREENMAN->AddNewScreenToTop( SET_MOD_SCREEN, SM_BackFromInsertStepAttackPlayerOptions );
return true;
}
case EDIT_BUTTON_ADD_COURSE_MODS:
@@ -2758,7 +2761,7 @@ bool ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
g_fLastInsertAttackPositionSeconds = fStart;
g_fLastInsertAttackDurationSeconds = fEnd - fStart;
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.Assign( ModsLevel_Stage, po );
- SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertCourseAttackPlayerOptions );
+ SCREENMAN->AddNewScreenToTop( SET_MOD_SCREEN, SM_BackFromInsertCourseAttackPlayerOptions );
}
return true;
@@ -3739,7 +3742,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
int iDurationChoice = ScreenMiniMenu::s_viLastAnswers[0];
g_fLastInsertAttackDurationSeconds = StringToFloat( g_InsertTapAttack.rows[0].choices[iDurationChoice] );
- SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertTapAttackPlayerOptions );
+ SCREENMAN->AddNewScreenToTop( SET_MOD_SCREEN, SM_BackFromInsertTapAttackPlayerOptions );
}
else if( SM == SM_BackFromInsertTapAttackPlayerOptions )
{
@@ -3973,7 +3976,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
po.FromString(attacks[iAttack].sModifiers);
toEdit.Assign( ModsLevel_Preferred, po );
- SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions );
+ SCREENMAN->AddNewScreenToTop( SET_MOD_SCREEN, SM_BackFromInsertStepAttackPlayerOptions );
}
SetDirty(true);
}
@@ -4003,7 +4006,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
po.FromString( ce.attacks[iAttack].sModifiers );
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.Assign( ModsLevel_Preferred, po );
- SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertCourseAttackPlayerOptions );
+ SCREENMAN->AddNewScreenToTop( SET_MOD_SCREEN, SM_BackFromInsertCourseAttackPlayerOptions );
}
}
else if (SM == SM_BackFromInsertStepAttackPlayerOptions)
@@ -4646,7 +4649,7 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector &iAns
ScreenPrompt::Prompt( SM_DoRevertFromDisk, REVERT_FROM_DISK.GetValue() + "\n\n" + DESTROY_ALL_UNSAVED_CHANGES.GetValue(), PROMPT_YES_NO, ANSWER_NO );
break;
case options:
- SCREENMAN->AddNewScreenToTop( "ScreenEditOptions", SM_BackFromOptions );
+ SCREENMAN->AddNewScreenToTop( OPTIONS_SCREEN, SM_BackFromOptions );
break;
case edit_song_info:
{
@@ -5049,7 +5052,7 @@ void ScreenEdit::HandleAlterMenuChoice(AlterMenuChoice c, const vector &iAn
po.FromString(attacks[iAttack].sModifiers);
toEdit.Assign( ModsLevel_Preferred, po );
- SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions );
+ SCREENMAN->AddNewScreenToTop( SET_MOD_SCREEN, SM_BackFromInsertStepAttackPlayerOptions );
SetDirty(true);
break;
}