From b6b840187defee4fc61f79ff33bc6423990595a8 Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Fri, 2 May 2014 21:25:59 -0600 Subject: [PATCH] Made PlayerState:GetCurrentPlayerOptions safe to use. Added Docs/Themerdocs/modslevel.txt to explain what ModsLevel should be used by a theme using the new PlayerOptions interface. --- Docs/Themerdocs/modslevel.txt | 12 ++++++++++++ src/PlayerState.cpp | 3 +-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 Docs/Themerdocs/modslevel.txt diff --git a/Docs/Themerdocs/modslevel.txt b/Docs/Themerdocs/modslevel.txt new file mode 100644 index 0000000000..f95a1124ff --- /dev/null +++ b/Docs/Themerdocs/modslevel.txt @@ -0,0 +1,12 @@ +PlayerOptions are arranged by ModsLevel. +ModsLevel_Preferred, // user-chosen player options. Does not include any forced mods. +ModsLevel_Stage, // Preferred + forced stage mods +ModsLevel_Song, // Stage + forced attack mods +ModsLevel_Current, // Approaches Song + +The following applies to modifying the player options through the object fetched from PlayerState:GetPlayerOptions(mods_level). + +Changes to ModsLevel_Current on ScreenGameplay take effect immediately, but are quickly nullified as Current tweens toward Song. The approach speeds in Current are ignored. Changing Current when not on ScreenGameplay will have no effect. +Changes to ModsLevel_Song while on ScreenGameplay take effect over time, governed by an approach speed. ModsLevel_Song should only be modified by the theme on ScreenGameplay, because it is reset to the contents of Preferred when ScreenGameplay starts. +ModsLevel_Stage is a holding area the engine uses when building the active attacks a course or song forces on a player. It should not be used by a theme. +ModsLevel_Preferred is the user-chosen player options. Use this if you are building a custom replacement for ScreenPlayerOptions. Changes to ModsLevel_Preferred are applied to Stage, Song, and Current when ScreenGameplay starts. Approach speeds in ModsLevel_Preferred are ignored. diff --git a/src/PlayerState.cpp b/src/PlayerState.cpp index 19be5e40ec..bae87951e6 100644 --- a/src/PlayerState.cpp +++ b/src/PlayerState.cpp @@ -252,8 +252,7 @@ public: } static int GetCurrentPlayerOptions( T* p, lua_State *L ) { - PlayerOptions po = p->m_PlayerOptions.GetCurrent(); - po.PushSelf(L); + p->m_PlayerOptions.GetCurrent().PushSelf(L); return 1; } DEFINE_METHOD( GetHealthState, m_HealthState );