From 4e47b24597d41eb536acf123182228dd5af6e7b9 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 16 Oct 2011 13:22:26 -0400 Subject: [PATCH 01/11] New branch: [backwards] Goal: implement a proper backwards mod to allow for both actions on games where backwards != mirror. --- src/NoteDataUtil.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/NoteDataUtil.h b/src/NoteDataUtil.h index 167d2955f7..3aef94ca1a 100644 --- a/src/NoteDataUtil.h +++ b/src/NoteDataUtil.h @@ -111,7 +111,20 @@ namespace NoteDataUtil void RemoveStretch( NoteData &inout, StepsType st, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ); void RemoveAllButOneTap( NoteData &inout, int row ); void RemoveAllButPlayer( NoteData &inout, PlayerNumber pn ); - enum TrackMapping { left, right, mirror, shuffle, soft_shuffle, super_shuffle, stomp, NUM_TRACK_MAPPINGS }; + /** @brief The types of transformations available for the NoteData. */ + enum TrackMapping + { + left, /**< The NoteData is arranged as if the player was facing to the left. */ + right, /**< The NoteData is arranged as if the player was facing to the right. */ + mirror, /**< The NoteData is arranged as if facing a straight mirror. */ + backwards, /**< The NoteData is arranged as if the player was facing backwards. + This is NOT always the same as mirror. */ + shuffle, + soft_shuffle, + super_shuffle, + stomp, + NUM_TRACK_MAPPINGS + }; void Turn( NoteData &inout, StepsType st, TrackMapping tt, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ); void Little( NoteData &inout, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ); void Wide( NoteData &inout, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ); From e8f95dd28ef83bf38a429955535018350e4c6b92 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 16 Oct 2011 15:34:29 -0400 Subject: [PATCH 02/11] [backwards] Prepare PlayerOptions version. --- src/NoteDataUtil.cpp | 1 + src/PlayerOptions.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/NoteDataUtil.cpp b/src/NoteDataUtil.cpp index 2aeb12bc91..664c6bff50 100644 --- a/src/NoteDataUtil.cpp +++ b/src/NoteDataUtil.cpp @@ -2332,6 +2332,7 @@ void NoteDataUtil::TransformNoteData( NoteData &nd, const PlayerOptions &po, Ste // Apply turns and shuffles last so that they affect inserts. if( po.m_bTurns[PlayerOptions::TURN_MIRROR] ) NoteDataUtil::Turn( nd, st, NoteDataUtil::mirror, iStartIndex, iEndIndex ); + if( po.m_bTurns[PlayerOptions::TURN_BACKWARDS] ) NoteDataUtil::Turn( nd, st, NoteDataUtil::backwards, iStartIndex, iEndIndex ); if( po.m_bTurns[PlayerOptions::TURN_LEFT] ) NoteDataUtil::Turn( nd, st, NoteDataUtil::left, iStartIndex, iEndIndex ); if( po.m_bTurns[PlayerOptions::TURN_RIGHT] ) NoteDataUtil::Turn( nd, st, NoteDataUtil::right, iStartIndex, iEndIndex ); if( po.m_bTurns[PlayerOptions::TURN_SHUFFLE] ) NoteDataUtil::Turn( nd, st, NoteDataUtil::shuffle, iStartIndex, iEndIndex ); diff --git a/src/PlayerOptions.h b/src/PlayerOptions.h index 0166af9c4e..d3292d1280 100644 --- a/src/PlayerOptions.h +++ b/src/PlayerOptions.h @@ -109,6 +109,7 @@ public: enum Turn { TURN_NONE=0, /**< No turning of the arrows is performed. */ TURN_MIRROR, /**< The arrows are mirrored from their normal position. */ + TURN_BACKWARDS, /**< The arrows are turned 180 degrees. This does NOT always equal mirror. */ TURN_LEFT, /**< The arrows are turned 90 degrees to the left. */ TURN_RIGHT, /**< The arrows are turned 90 degress to the right. */ TURN_SHUFFLE, /**< Some of the arrow columns are changed throughout the whole song. */ From 0181d46225cf20896d8a06b0c74a99492ba1caba Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 16 Oct 2011 15:37:28 -0400 Subject: [PATCH 03/11] [backwards] ScreenEdit can go Backwards. Interestingly, en.ini already has this entry. --- src/ScreenEdit.cpp | 3 ++- src/ScreenEdit.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index c6f947008b..7c5580af68 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -549,7 +549,7 @@ static MenuDef g_AlterMenu( EditMode_Practice, true, true, 0, "4th","8th","12th","16th","24th","32nd","48th","64th","192nd"), MenuRowDef(ScreenEdit::turn, "Turn", true, - EditMode_Practice, true, true, 0, "Left","Right","Mirror","Shuffle","SuperShuffle" ), + EditMode_Practice, true, true, 0, "Left","Right","Mirror","Backwards","Shuffle","SuperShuffle" ), MenuRowDef(ScreenEdit::transform, "Transform", true, EditMode_Practice, true, true, 0, "NoHolds","NoMines","Little","Wide", "Big","Quick","Skippy","Mines","Echo","Stomp","Planted","Floored", @@ -3986,6 +3986,7 @@ void ScreenEdit::HandleAlterMenuChoice(AlterMenuChoice c, const vector &iAn case left: NoteDataUtil::Turn( m_Clipboard, st, NoteDataUtil::left ); break; case right: NoteDataUtil::Turn( m_Clipboard, st, NoteDataUtil::right ); break; case mirror: NoteDataUtil::Turn( m_Clipboard, st, NoteDataUtil::mirror ); break; + case backwards: NoteDataUtil::Turn( m_Clipboard, st, NoteDataUtil::backwards ); break; case shuffle: NoteDataUtil::Turn( m_Clipboard, st, NoteDataUtil::shuffle ); break; case super_shuffle: NoteDataUtil::Turn( m_Clipboard, st, NoteDataUtil::super_shuffle ); break; } diff --git a/src/ScreenEdit.h b/src/ScreenEdit.h index 0749344f05..d6853bf56e 100644 --- a/src/ScreenEdit.h +++ b/src/ScreenEdit.h @@ -456,7 +456,8 @@ public: { left, /**< Turn the notes as if you were facing to the left. */ right, /**< Turn the notes as if you were facing to the right. */ - mirror, /**< Turn the notes as if you were facing away from the machine. */ + mirror, /**< Flip the notes vertically. */ + backwards, /**< Turn the notes as if you were facing away from the machine. */ shuffle, /**< Replace one column with another column. */ super_shuffle, /**< Replace each note individually. */ NUM_TURN_TYPES From 9e486bec32a592bd1cad560dd5aebb201832d20b Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 16 Oct 2011 15:41:26 -0400 Subject: [PATCH 04/11] [backwards] Add option, Lua call GetBackwards(). --- Docs/Luadoc/Lua.xml | 1 + Docs/Luadoc/LuaDocumentation.xml | 3 +++ src/PlayerOptions.cpp | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index 1f9ee43352..e22eff351b 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -939,6 +939,7 @@ + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index 436c602a5d..6f2baf83d1 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -2484,6 +2484,9 @@ + + + Returns true if the backwards mod is applied, false otherwise. diff --git a/src/PlayerOptions.cpp b/src/PlayerOptions.cpp index 68239afa33..914178a8a2 100644 --- a/src/PlayerOptions.cpp +++ b/src/PlayerOptions.cpp @@ -195,6 +195,7 @@ void PlayerOptions::GetMods( vector &AddTo, bool bForceNoteSkin ) const AddPart( AddTo, m_fRandomSpeed, "RandomSpeed" ); if( m_bTurns[TURN_MIRROR] ) AddTo.push_back( "Mirror" ); + if( m_bTurns[TURN_BACKWARDS] ) AddTo.push_back( "Backwards" ); if( m_bTurns[TURN_LEFT] ) AddTo.push_back( "Left" ); if( m_bTurns[TURN_RIGHT] ) AddTo.push_back( "Right" ); if( m_bTurns[TURN_SHUFFLE] ) AddTo.push_back( "Shuffle" ); @@ -389,6 +390,7 @@ bool PlayerOptions::FromOneModString( const RString &sOneMod, RString &sErrorOut else if( sBit == "randomvanish" ) SET_FLOAT( fAppearances[APPEARANCE_RANDOMVANISH] ) else if( sBit == "turn" && !on ) ZERO( m_bTurns ); /* "no turn" */ else if( sBit == "mirror" ) m_bTurns[TURN_MIRROR] = on; + else if( sBit == "backwards" ) m_bTurns[TURN_BACKWARDS] = on; else if( sBit == "left" ) m_bTurns[TURN_LEFT] = on; else if( sBit == "right" ) m_bTurns[TURN_RIGHT] = on; else if( sBit == "shuffle" ) m_bTurns[TURN_SHUFFLE] = on; @@ -963,6 +965,7 @@ public: // Turns DEFINE_METHOD( GetMirror, m_bTurns[PlayerOptions::TURN_MIRROR] ) + DEFINE_METHOD( GetBackwards, m_bTurns[PlayerOptions::TURN_BACKWARDS] ) DEFINE_METHOD( GetLeft, m_bTurns[PlayerOptions::TURN_LEFT] ) DEFINE_METHOD( GetRight, m_bTurns[PlayerOptions::TURN_RIGHT] ) DEFINE_METHOD( GetShuffle, m_bTurns[PlayerOptions::TURN_SHUFFLE] ) @@ -1088,6 +1091,7 @@ public: // Turns ADD_METHOD( GetMirror ); + ADD_METHOD( GetBackwards ); ADD_METHOD( GetLeft ); ADD_METHOD( GetRight ); ADD_METHOD( GetShuffle ); From e98ba68f2fa7bcc8824f78ca97eef80a79926729 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 16 Oct 2011 15:44:44 -0400 Subject: [PATCH 05/11] [backwards] CodeDetector access. By default, there is no code for Backwards. Let the themers decide this one. --- Themes/_fallback/metrics.ini | 2 ++ src/CodeDetector.cpp | 2 ++ src/CodeDetector.h | 1 + 3 files changed, 5 insertions(+) diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 50a4275c58..3c15bcdc88 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -323,6 +323,8 @@ SaveScreenshot1=GetCodeForGame("SaveScreenshot1") SaveScreenshot2=GetCodeForGame("SaveScreenshot2") # on the player options menu. CancelAllPlayerOptions=GetCodeForGame("CancelAllPlayerOptions") +# unused codes: +Backwards="" # deprecated codes: NextTheme="" NextTheme2="" diff --git a/src/CodeDetector.cpp b/src/CodeDetector.cpp index 5630894b91..d35a3a00c2 100644 --- a/src/CodeDetector.cpp +++ b/src/CodeDetector.cpp @@ -23,6 +23,7 @@ const char *CodeNames[] = { "ModeMenu1", "ModeMenu2", "Mirror", + "Backwards", "Left", "Right", "Shuffle", @@ -200,6 +201,7 @@ bool CodeDetector::DetectAndAdjustMusicOptions( GameController controller ) switch( code ) { case CODE_MIRROR: po.ToggleOneTurn( PlayerOptions::TURN_MIRROR ); break; + case CODE_BACKWARDS: po.ToggleOneTurn( PlayerOptions::TURN_BACKWARDS ); break; case CODE_LEFT: po.ToggleOneTurn( PlayerOptions::TURN_LEFT ); break; case CODE_RIGHT: po.ToggleOneTurn( PlayerOptions::TURN_RIGHT ); break; case CODE_SHUFFLE: po.ToggleOneTurn( PlayerOptions::TURN_SHUFFLE ); break; diff --git a/src/CodeDetector.h b/src/CodeDetector.h index e636a8830c..d9b6089fbb 100644 --- a/src/CodeDetector.h +++ b/src/CodeDetector.h @@ -17,6 +17,7 @@ enum Code { CODE_MODE_MENU1, CODE_MODE_MENU2, CODE_MIRROR, + CODE_BACKWARDS, CODE_LEFT, CODE_RIGHT, CODE_SHUFFLE, From 23832ac653de7189b7282ea684a424912b0a79fc Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 16 Oct 2011 15:48:50 -0400 Subject: [PATCH 06/11] [backwards] Compile fix: two "backwards" here. --- src/ScreenEdit.cpp | 2 +- src/ScreenEdit.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index 7c5580af68..9d5cf5c843 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -3986,7 +3986,7 @@ void ScreenEdit::HandleAlterMenuChoice(AlterMenuChoice c, const vector &iAn case left: NoteDataUtil::Turn( m_Clipboard, st, NoteDataUtil::left ); break; case right: NoteDataUtil::Turn( m_Clipboard, st, NoteDataUtil::right ); break; case mirror: NoteDataUtil::Turn( m_Clipboard, st, NoteDataUtil::mirror ); break; - case backwards: NoteDataUtil::Turn( m_Clipboard, st, NoteDataUtil::backwards ); break; + case turn_backwards: NoteDataUtil::Turn( m_Clipboard, st, NoteDataUtil::backwards ); break; case shuffle: NoteDataUtil::Turn( m_Clipboard, st, NoteDataUtil::shuffle ); break; case super_shuffle: NoteDataUtil::Turn( m_Clipboard, st, NoteDataUtil::super_shuffle ); break; } diff --git a/src/ScreenEdit.h b/src/ScreenEdit.h index d6853bf56e..bb68c9d523 100644 --- a/src/ScreenEdit.h +++ b/src/ScreenEdit.h @@ -457,7 +457,7 @@ public: left, /**< Turn the notes as if you were facing to the left. */ right, /**< Turn the notes as if you were facing to the right. */ mirror, /**< Flip the notes vertically. */ - backwards, /**< Turn the notes as if you were facing away from the machine. */ + turn_backwards, /**< Turn the notes as if you were facing away from the machine. */ shuffle, /**< Replace one column with another column. */ super_shuffle, /**< Replace each note individually. */ NUM_TURN_TYPES From 142a62aa6e5993a1a8befc898336c98a0dcb6a4f Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 16 Oct 2011 15:50:13 -0400 Subject: [PATCH 07/11] [backwards] Have Backwards fallback to Mirror. Not all gametypes require Backwards: they will fall through to Mirror. Otherwise, catch it here. --- src/NoteDataUtil.cpp | 99 ++++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/src/NoteDataUtil.cpp b/src/NoteDataUtil.cpp index 664c6bff50..fd98b53272 100644 --- a/src/NoteDataUtil.cpp +++ b/src/NoteDataUtil.cpp @@ -1208,57 +1208,58 @@ static void GetTrackMapping( StepsType st, NoteDataUtil::TrackMapping tt, int Nu } break; + case NoteDataUtil::backwards: + { + // If a Pump game type, treat differently. Otherwise, send to mirror. + switch (st) + { + case StepsType_pump_single: + case StepsType_pump_couple: + { + iTakeFromTrack[0] = 3; + iTakeFromTrack[1] = 4; + iTakeFromTrack[2] = 2; + iTakeFromTrack[3] = 0; + iTakeFromTrack[4] = 1; + iTakeFromTrack[5] = 8; + iTakeFromTrack[6] = 9; + iTakeFromTrack[7] = 2; + iTakeFromTrack[8] = 5; + iTakeFromTrack[9] = 6; + break; + } + case StepsType_pump_double: + case StepsType_pump_routine: + { + iTakeFromTrack[0] = 8; + iTakeFromTrack[1] = 9; + iTakeFromTrack[2] = 7; + iTakeFromTrack[3] = 5; + iTakeFromTrack[4] = 6; + iTakeFromTrack[5] = 3; + iTakeFromTrack[6] = 4; + iTakeFromTrack[7] = 2; + iTakeFromTrack[8] = 0; + iTakeFromTrack[9] = 1; + break; + } + case StepsType_pump_halfdouble: + { + iTakeFromTrack[0] = 5; + iTakeFromTrack[1] = 3; + iTakeFromTrack[2] = 4; + iTakeFromTrack[3] = 1; + iTakeFromTrack[4] = 2; + iTakeFromTrack[5] = 0; + break; + } + default:; + } + } case NoteDataUtil::mirror: { - switch (st) - { - case StepsType_pump_single: - case StepsType_pump_couple: - { - iTakeFromTrack[0] = 3; - iTakeFromTrack[1] = 4; - iTakeFromTrack[2] = 2; - iTakeFromTrack[3] = 0; - iTakeFromTrack[4] = 1; - iTakeFromTrack[5] = 8; - iTakeFromTrack[6] = 9; - iTakeFromTrack[7] = 2; - iTakeFromTrack[8] = 5; - iTakeFromTrack[9] = 6; - break; - } - case StepsType_pump_double: - case StepsType_pump_routine: - { - iTakeFromTrack[0] = 8; - iTakeFromTrack[1] = 9; - iTakeFromTrack[2] = 7; - iTakeFromTrack[3] = 5; - iTakeFromTrack[4] = 6; - iTakeFromTrack[5] = 3; - iTakeFromTrack[6] = 4; - iTakeFromTrack[7] = 2; - iTakeFromTrack[8] = 0; - iTakeFromTrack[9] = 1; - break; - } - case StepsType_pump_halfdouble: - { - iTakeFromTrack[0] = 5; - iTakeFromTrack[1] = 3; - iTakeFromTrack[2] = 4; - iTakeFromTrack[3] = 1; - iTakeFromTrack[4] = 2; - iTakeFromTrack[5] = 0; - break; - } - default: - { - for( int t=0; t Date: Sun, 16 Oct 2011 15:52:16 -0400 Subject: [PATCH 08/11] [backwards] Activate Mirror on the theme. --- Themes/_fallback/metrics.ini | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 3c15bcdc88..8d533c73e0 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -2201,14 +2201,15 @@ Appearance,4="mod,blink;name,Blink" # Appearance,5="mod,blink;name,Blink" # Appearance,6="mod,randomvanish;name,R.Vanish" -Turn="6;selectmultiple" +Turn="7;selectmultiple" TurnDefault="mod,no turn" Turn,1="mod,mirror;name,Mirror" -Turn,2="mod,left;name,Left" -Turn,3="mod,right;name,Right" -Turn,4="mod,shuffle;name,Shuffle" -Turn,5="mod,supershuffle;name,SuperShuffle" -Turn,6="mod,softshuffle;name,SoftShuffle" +Turn,2="mod,backwards;name,Backwards" +Turn,3="mod,left;name,Left" +Turn,4="mod,right;name,Right" +Turn,5="mod,shuffle;name,Shuffle" +Turn,6="mod,supershuffle;name,SuperShuffle" +Turn,7="mod,softshuffle;name,SoftShuffle" # Turn="6" # TurnDefault="mod,no turn" From 68061b13c5fe3f874052df665b232d15759cb7df Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 16 Oct 2011 16:33:33 -0400 Subject: [PATCH 09/11] [backwards] Add appropriate comment for devs. --- src/NoteDataUtil.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/NoteDataUtil.cpp b/src/NoteDataUtil.cpp index fd98b53272..76f87befb8 100644 --- a/src/NoteDataUtil.cpp +++ b/src/NoteDataUtil.cpp @@ -1125,6 +1125,7 @@ void NoteDataUtil::RemoveAllButPlayer( NoteData &inout, PlayerNumber pn ) } } +// TODO: Perform appropriate matrix calculations for everything instead. static void GetTrackMapping( StepsType st, NoteDataUtil::TrackMapping tt, int NumTracks, int *iTakeFromTrack ) { // Identity transform for cases not handled below. From 1f024cd739c5b0971b7618434cd166cc55ed62b9 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 16 Oct 2011 16:43:20 -0400 Subject: [PATCH 10/11] [backwards] Switches in switches: need a break. --- src/NoteDataUtil.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/NoteDataUtil.cpp b/src/NoteDataUtil.cpp index 76f87befb8..f8ec088a67 100644 --- a/src/NoteDataUtil.cpp +++ b/src/NoteDataUtil.cpp @@ -1212,6 +1212,7 @@ static void GetTrackMapping( StepsType st, NoteDataUtil::TrackMapping tt, int Nu case NoteDataUtil::backwards: { // If a Pump game type, treat differently. Otherwise, send to mirror. + bool needsBackwards = true; switch (st) { case StepsType_pump_single: @@ -1254,8 +1255,10 @@ static void GetTrackMapping( StepsType st, NoteDataUtil::TrackMapping tt, int Nu iTakeFromTrack[5] = 0; break; } - default:; + default: + needsBackwards = false; } + if (needsBackwards) break; } case NoteDataUtil::mirror: { From 56b68ed502bd5f53572bde880ea30ec60c2f69a5 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 16 Oct 2011 16:46:24 -0400 Subject: [PATCH 11/11] The usual changelog entry. --- Docs/Changelog_sm5.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index f46fd8875e..cf7ce28394 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -8,6 +8,13 @@ ________________________________________________________________________________ StepMania 5.0 $next | 2011xxxx -------------------------------------------------------------------------------- +2011/10/16 +---------- +* [NoteDataUtil] Add the Backwards mod for games where the intended + definition of Mirror is different. Regarding Pump gameplay, what was + called Mirror in Preview 4 is considered Backwards now, and the original + Mirror is back in its old position. [Wolfman2000] + 2011/10/12 ---------- * [Steps] Fix a bug where e.g. ".SM" ".DWI" ".Sm" ".sM" files