From 9666bb0ae2b476e5d2977b90ad94ad5b0c765b41 Mon Sep 17 00:00:00 2001 From: Dan Guzek Date: Mon, 9 Dec 2019 19:45:57 -0500 Subject: [PATCH 1/2] change a few global Lua variables to be local Running StepMania with the command line argument of --ExportLuaInformation while the current 5.1's default theme (Lambda) was selected added some seemingly stray Lua variables to the Constants table in ./Docs/Luadoc/Lua.xml. I spotted them here: http://dguzek.github.io/Lua-For-SM5/LuaAPI#Constants I'm assuming num, bPreference, and bCategory don't need global scope, so I added the local keyword where appropriate. --- Themes/_fallback/Scripts/03 CustomSpeedMods.lua | 2 +- Themes/default/Scripts/03 Gameplay.lua | 10 +++++----- Themes/legacy/Scripts/03 Gameplay.lua | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Themes/_fallback/Scripts/03 CustomSpeedMods.lua b/Themes/_fallback/Scripts/03 CustomSpeedMods.lua index f044e8db5a..f858110565 100644 --- a/Themes/_fallback/Scripts/03 CustomSpeedMods.lua +++ b/Themes/_fallback/Scripts/03 CustomSpeedMods.lua @@ -70,7 +70,7 @@ end -- Parses a speed mod and returns the pair (type, number) or nil if parsing -- failed. local function CanonicalizeMod(mod) - num = tonumber(mod:match("^(%d+.?%d*)[xX]$")) + local num = tonumber(mod:match("^(%d+.?%d*)[xX]$")) if num ~= nil then return "x", num end diff --git a/Themes/default/Scripts/03 Gameplay.lua b/Themes/default/Scripts/03 Gameplay.lua index 503b604323..bffc81b145 100644 --- a/Themes/default/Scripts/03 Gameplay.lua +++ b/Themes/default/Scripts/03 Gameplay.lua @@ -12,11 +12,11 @@ local tNotePositions = { } function GetTapPosition( sType ) - bCategory = (sType == 'Standard') and 1 or 2 + local bCategory = (sType == 'Standard') and 1 or 2 -- true: Normal -- false: Lower - bPreference = ThemePrefs.Get("NotePosition") and "Normal" or "Lower" - tNotePos = tNotePositions[bPreference] + local bPreference = ThemePrefs.Get("NotePosition") and "Normal" or "Lower" + local tNotePos = tNotePositions[bPreference] return tNotePos[bCategory] end @@ -74,13 +74,13 @@ end function ScreenSelectStylePositions(count) local poses= {} local choice_size = 192 - + for i= 1, count do local start_x = _screen.cx + ( (choice_size / 1.5) * ( i - math.ceil(count/2) ) ) -- The Y position depends on if the icon's index is even or odd. local start_y = i % 2 == 0 and _screen.cy / 0.8 or (_screen.cy / 0.8) - (choice_size / 1.5) poses[#poses+1] = {start_x, start_y} end - + return poses end \ No newline at end of file diff --git a/Themes/legacy/Scripts/03 Gameplay.lua b/Themes/legacy/Scripts/03 Gameplay.lua index 1235c302b6..f67db90ea6 100644 --- a/Themes/legacy/Scripts/03 Gameplay.lua +++ b/Themes/legacy/Scripts/03 Gameplay.lua @@ -12,11 +12,11 @@ local tNotePositions = { } function GetTapPosition( sType ) - bCategory = (sType == 'Standard') and 1 or 2 + local bCategory = (sType == 'Standard') and 1 or 2 -- true: Normal -- false: Lower - bPreference = ThemePrefs.Get("NotePosition") and "Normal" or "Lower" - tNotePos = tNotePositions[bPreference] + local bPreference = ThemePrefs.Get("NotePosition") and "Normal" or "Lower" + local tNotePos = tNotePositions[bPreference] return tNotePos[bCategory] end From 95122bbccbaa5ecbf770c120bdf46f038d94f5c0 Mon Sep 17 00:00:00 2001 From: dinsfire64 Date: Mon, 16 Dec 2019 20:44:02 -0600 Subject: [PATCH 2/2] restore autogen lights --- src/PrefsManager.cpp | 2 +- src/ScreenGameplay.cpp | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/PrefsManager.cpp b/src/PrefsManager.cpp index 4cefde812a..a8c911c58b 100644 --- a/src/PrefsManager.cpp +++ b/src/PrefsManager.cpp @@ -275,7 +275,7 @@ PrefsManager::PrefsManager() : m_iSoundDevice ( "SoundDevice", "" ), m_iRageSoundSampleCountClamp ("RageSoundSampleCountClamp", 0), //some sound drivers mask the sample location number, the most popular number for this is 2^27, this causes lockup after ~50 minutes at 44.1khz sample rate m_iSoundPreferredSampleRate ( "SoundPreferredSampleRate", 0 ), - m_sLightsStepsDifficulty ( "LightsStepsDifficulty", "medium" ), + m_sLightsStepsDifficulty ( "LightsStepsDifficulty", "hard,medium" ), m_bAllowUnacceleratedRenderer ( "AllowUnacceleratedRenderer", false ), m_bThreadedInput ( "ThreadedInput", true ), m_bThreadedMovieDecode ( "ThreadedMovieDecode", true ), diff --git a/src/ScreenGameplay.cpp b/src/ScreenGameplay.cpp index ec4e7d492f..075639c600 100644 --- a/src/ScreenGameplay.cpp +++ b/src/ScreenGameplay.cpp @@ -1452,6 +1452,27 @@ void ScreenGameplay::LoadLights() NoteData TapNoteData1; pSteps->GetNoteData( TapNoteData1 ); + //taken from oitg, restores arrow -> marquee/bass light mapping. + if( asDifficulties.size() > 1 ) + { + Difficulty d2 = StringToDifficulty( asDifficulties[1] ); + + Steps *pSteps2; + + pSteps2 = SongUtil::GetClosestNotes( GAMESTATE->m_pCurSong, st, d2 ); + + if(pSteps2 != nullptr) + { + NoteData TapNoteData2; + pSteps2->GetNoteData( TapNoteData2 ); + + NoteDataUtil::LoadTransformedLightsFromTwo( TapNoteData1, TapNoteData2, m_CabinetLightsNoteData ); + return; + } + + /* fall through */ + } + NoteDataUtil::LoadTransformedLights( TapNoteData1, m_CabinetLightsNoteData, GAMEMAN->GetStepsTypeInfo(StepsType_lights_cabinet).iNumTracks ); }