diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index a4ba678cb9..964eb04199 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -971,159 +971,98 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1919,6 +1858,12 @@ + + + + + + @@ -2035,6 +1980,7 @@ + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index 56802a61b6..1adcb4b5c3 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -2829,466 +2829,193 @@ save yourself some time, copy this for undocumented things: - - Returns the value of the Alternate modifier. - - - Sets the value of the Alternate modifier. - - - Returns the status of the Attack Mines modifier. - - - Sets the Attack Mines modifier. - - - Returns true if the Backwards modifier is applied. - - - Sets the Backwards modifier. - - - Returns the value of the Beat modifier. - - - Sets the value for the Beat modifier. - - - Returns the status of the Big modifier. - - - Sets the Big modifier. - - - Returns the value of the Blind modifier. - - - Sets the value for the Blind modifier. - - - Returns the value of the Blink modifier. - - - Sets the value for the Blink modifier. - - - Returns the status of the BMRize modifier. - - - Sets the BMRize modifier. - - - Returns the value of the Boomerang modifier. - - - Sets the value for the Boomerang modifier. - - - Returns the value of the Boost modifier. - - - Sets the value for the Boost modifier. - - - Returns the value of the Brake modifier. - - - Sets the value for the Brake modifier. - - - Returns the value of the Bumpy modifier. - - - Sets the value for the Bumpy modifier. - - - Returns the value of the Centered modifier. - - - Sets the value for the Centered modifier. - - - Returns the player's C-mod. - - - Sets the player's C-mod to fCmod. - - - Returns the value of the Confusion modifier. - - - Sets the value for the Confusion modifier. - - - Returns the value of the Cover modifier. - - - Sets the value for the Cover modifier. - - - Returns the value of the Cross modifier. - - - Sets the value for the Cross modifier. - - - Returns the value of the Dark modifier. - - - Sets the value for the Dark modifier. - - - Returns the value of the Dizzy modifier. - - - Sets the value for the Dizzy modifier. - - - Returns the value of the Drunk modifier. - - - Sets the value for the Drunk modifier. - - - Returns the status of the Echo modifier. - - - Sets the Echo modifier. - - - Returns the value of the Expand modifier. - - - Sets the value for the Expand modifier. - - - Returns the value of the Flip modifier. - - - Sets the value for the Flip modifier. - - - Returns the status of the Floored modifier. - - - Sets the Floored modifier. - - - Returns the value of the Hidden modifier. - - - Sets the value for the Hidden modifier. - - - Returns the value of the Hidden Offset modifier. - - - Sets the value for the Hidden Offset modifier. - - - Returns true if Holds will be converted to Rolls. - - - If true, Holds will be converted to Rolls. - - - Returns the value of the Invert modifier. - - - Sets the value for the Invert modifier. - - - Returns the status of the Left modifier. - - - Sets the Left modifier. - - - Returns the status of the Little modifier. - - - Sets the Little modifier. - - - Returns the status of the Mines modifier. - - - Sets the Mines modifier. - - - Returns the value of the Mini modifier. - - - Sets the value for the Mini modifier. - - - Returns true if the Mirror modifier is applied. - - - Sets the Mirror modifier. - - - Returns the player's M-mod. - - - Sets the player's M-mod to fMmod. - - - Returns true if the game mutes an instrument track on errors. - - - Sets the Mute on Error modifier. - - - Returns the value of the No Attacks modifier. - - - Returns the status of the No Fakes modifier. - - - Sets the No Fakes modifier, removing all Fakes. - - - Returns the status of the No Hands modifier. - - - Sets the No Hands modifier, removing all Hands. - - - Returns the status of the No Holds modifier. - - - Sets the No Holds modifier, removing all Holds. - - - Returns the status of the No Jumps modifier. - - - Sets the No Jumps modifier, removing all Jumps. - - - Returns the status of the No Lifts modifier. - - - Sets the No Lifts modifier, removing all Lifts. - - - Returns the status of the No Mines modifier. - - - Sets the No Mines modifier, removing all Mines. - - - Returns the status of the No Quads modifier. - - - Sets the No Quads modifier, removing all Quads. - - - Returns the status of the No Rolls modifier. - - - Sets the No Rolls modifier, removing all Rolls. - - - Returns the status of the No Stretch modifier. - - - Sets the No Stretch modifier, removing all step combinations that require a large stretch. - - - Returns the current NoteSkin set in the PlayerOptions. - - - Changes the player's noteskin to noteskin. - - - Returns the value of the Passmark. - - - Sets the value for the Passmark. - - - Returns the status of the Planted modifier. - - - Sets the Planted modifier. - - - Returns the status of the Quick modifier. - - - Sets the Quick modifier. - - - Returns the value of the Random Attacks modifier. - - - Sets the value for the Random Attacks modifier. - - - Returns the value of the Random Speed modifier. - - - Sets the value for the Random Speed modifier. - - - Returns the value of the Random Vanish modifier. - - - Sets the value for the Random Vanish modifier. - - - Returns the value of the Reverse modifier. - - - Sets the value for the Reverse modifier. - - - Returns the amount of reverse applied to the specified column. - - - Returns the status of the Right modifier. - - - Sets the Right modifier. - - - Returns the value of the Roll modifier. - - - Sets the value for the Roll modifier. - - - Returns the status of the Shuffle modifier. - - - Sets the Shuffle modifier. - - - Returns the value of the NoteField skew. - - - Sets the NoteField skew. This is used to replicate the various - views. (Distant, Hallway, etc.) - - - Returns the status of the Skippy modifier. - - - Sets the Skippy modifier. - - - Returns the status of the Soft Shuffle modifier. - - - Sets the Soft Shuffle modifier. - - - This function is deprecated. Please use GetStepAttacks() instead. - - - - - - Returns the value of the Split modifier. - - - Sets the value for the Split modifier. - - - Returns the value of the Stealth modifier. - - - Sets the value for the Stealth modifier. - - - Returns the status of the Stomp modifier. - - - Sets the Stomp modifier. - - - Returns the value of the Sudden modifier. - - - Sets the value for the Sudden modifier. - - - Returns the value of the Sudden Offset modifier. - - - Sets the value for the Sudden Offset modifier. - - - Returns the status of the Super Shuffle modifier. - - - Sets the Super Shuffle modifier. - - - Returns the value of the Tiny modifier. - - - Sets the value for the Tiny modifier. - - - Returns the value of the Tipsy modifier. - - - Sets the value for the Tipsy modifier. - - - Returns the value of the Tornado modifier. - - - Sets the value for the Tornado modifier. - - - Returns the value of the Twirl modifier. - - - Sets the value for the Twirl modifier. - - - Returns the status of the Twister modifier. - - - Sets the Twister modifier. - - - Returns the value of the Wave modifier. - - - Sets the value for the Wave modifier. - - - Returns the status of the Wide modifier. - - - Sets the Wide modifier. - - - Returns the player's X-mod. - - - Sets the player's X-mod to fXmod. - - - Returns the value of X Mode. - + + Most options fall into one of two types: float or bool.
+ Float type options have this interface:
+ Option(value, approach_speed)
+ If value is a float, sets the TimeSpacing modifier to value.
+ If approach_speed is a float, sets the speed of the transition to approach_speed. Returns the previous values of both.
+ approach_speed is in units of n per second. value will be approached at the rate of approach_speed per second.
+ Note that the value and the approach speed arguments are both independently optional.
+ Example:
+ a,b= options:Boost() -- Sets a to the current value and b to the current approach_speed.
+ a,b= options:Boost(5, .5) -- Stores the previous values in a and b, NOT to 5 and .5. Sets the value to 5 and the approach speed to .5.
+ a,b= options:Boost(5) -- Sets a and b to the previous values, NOT to 5 and .5. Sets the value to 5 and leaves the approach speed at whatever it was.
+
+ Setting the approach speed only matters when modifying the PlayerOptions from ModsLevel_Song.
+ Bool type options have an almost identical interface, the difference is that they can not have an approach speed.
+ For brevity, the functions are only given a description if the option requires careful handling or does not follow the float or bool interfaces.
+
Returns true if the current PlayerOptions makes the current Course/Trail easier. Returns true if the current PlayerOptions makes the current Song/Steps easier. - - Sets the X Mode percentage to fXModeVal. + + TimeSpacing is one of the variables for controlling the speed mod.
+ Use CMod, XMod, or MMod to set the speed mod unless you have a good reason not to.
+ It controls whether the speed mod is in X mode or C mode. It should only be set to 0 or 1, and is only a float value to allow tweening between the two states.
+ + MaxScrollBPM is one of the variables for controlling the speed mod.
+ Use CMod, XMod, or MMod to set the speed mod unless you have a good reason not to.
+ It is the setting for the MMod.
+ MMods are not tweenable or settable on ScreenGameplay. Use XMods if you need such an effect. +
+ + ScrollSpeed is one of the variables for controlling the speed mod.
+ Use CMod, XMod, or MMod to set the speed mod unless you have a good reason not to.
+ It is the setting for the XMod. +
+ + ScrollBPM is one of the variables for controlling the speed mod.
+ Use CMod, XMod, or MMod to set the speed mod unless you have a good reason not to.
+ It is the setting for the CMod. +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tilt is one of the mods for controlling the perspective. Use Overhead, Distant, Incoming, Space, Distant, or Hallway for controlling the perspective in the old way.
+ Tilt tilts the note field forward and back. +
+ + Skew is one of the mods for controlling the perspective. Use Overhead, Distant, Incoming, Space, Distant, or Hallway for controlling the perspective in the old way.
+ Skew moves the vanishing point for the note field away from the center of the screen.
+ Skew has no effect in single mode if Center1Player is true.
+ Skew has no effect in double mode.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Returns true if the player is using reverse. (equivalent to GetReverse() == 1.0) + + Sets the NoteSkin to the named noteskin, unless name is nil or the noteskin does not exist. Returns the name of the previous noteskin and whether the set attempt succeeded.
+ Changing the noteskin during a song is not supported.
+ Example:
+ note_name= options:NoteSkin() -- Sets note_name to the player's current noteskin.
+ prev_note_name, succeeded= options:NoteSkin("cel") -- Sets prev_note_name to the noteskin the player had set, changes the current noteskin to "cel", sets succeeded to true if the the "cel" noteskin exists.
+
+ + Sets the for the player, if the optional argument is provided. Returns the that was previously set. + + + If the player has a CMod set, returns the value of that CMod and its associated approach speed. Returns nil otherwise.
+ If the optional first argument is passed, sets the CMod to the value and disables any XMod or MMod that is set.
+ If the optional second argument is passed, sets the speed at which the transition occurs. +
+ + If the player has a XMod set, returns the value of that XMod and its associated approach speed. Returns nil otherwise.
+ If the optional first argument is passed, sets the XMod to the value and disables any CMod or MMod that is set.
+ If the optional second argument is passed, sets the speed at which the transition occurs. +
+ + If the player has a MMod set, returns the value of that MMod and its associated approach speed. Returns nil otherwise.
+ If the optional first argument is passed, sets the MMod to the value and disables any CMod or XMod that is set.
+ If the optional second argument is passed, sets the speed at which the transition occurs.
+ MMods are not tweenable or settable on ScreenGameplay. Use XMods if you need such an effect. +
+ + If the player is using Overhead (0 tilt, 0 skew), returns true.
+ If true is passed, sets the tilt and skew to 0. +
+ + If the player is using Incoming ((positive skew and negative tilt) or (negative skew and positive tilt)), returns the value of skew and its approach_speed.
+ Returns nil otherwise.
+ If the optional first argument is passed, sets tilt to negative value and skew to value.
+ Pass in a positive value for the familiar meaning of Incoming.
+ If the optional second argument is passed, sets the approach_speed for skew and tilt to it. +
+ + If the player is using Space ((positive skew and positive tilt) or (negative skew and negative tilt)), returns the value of skew and its approach_speed.
+ Returns nil otherwise.
+ If the optional first argument is passed, sets tilt to value and skew to value.
+ If the optional second argument is passed, sets the approach_speed for skew and tilt to it. +
+ + If the player is using Hallway (zero skew and negative tilt), returns the value of tilt and its approach_speed.
+ Returns nil otherwise.
+ If the optional first argument is passed, sets tilt to negative value and skew to zero.
+ Pass in a positive value for the familiar meaning of Hallway.
+ If the optional second argument is passed, sets the approach_speed for skew and tilt to it. +
+ + If the player is using Distant (zero skew and positive tilt), returns the value of tilt and its approach_speed.
+ Returns nil otherwise.
+ If the optional first argument is passed, sets tilt to value and skew to zero.
+ If the optional second argument is passed, sets the approach_speed for skew and tilt to it. +
+ + Returns true if step attacks or random attacks are enabled. +
diff --git a/src/Background.cpp b/src/Background.cpp index 1dcccecb84..deddf700f9 100644 --- a/src/Background.cpp +++ b/src/Background.cpp @@ -868,7 +868,7 @@ bool BackgroundImpl::IsDangerAllVisible() { // The players are never in danger in FAIL_OFF. FOREACH_PlayerNumber( p ) - if( GAMESTATE->GetPlayerFailType(GAMESTATE->m_pPlayerState[p]) == PlayerOptions::FAIL_OFF ) + if( GAMESTATE->GetPlayerFailType(GAMESTATE->m_pPlayerState[p]) == FailType_Off ) return false; if( !g_bShowDanger ) return false; diff --git a/src/GameConstantsAndTypes.cpp b/src/GameConstantsAndTypes.cpp index 8bf50fc461..f9b366ab55 100644 --- a/src/GameConstantsAndTypes.cpp +++ b/src/GameConstantsAndTypes.cpp @@ -491,7 +491,15 @@ XToLocalizedString( CourseType ); LuaXType( CourseType ); LuaFunction( CourseTypeToLocalizedString, CourseTypeToLocalizedString( Enum::Check( L, 1 ) ) ); - +static const char *FailTypeNames[] = { + "Immediate", + "ImmediateContinue", + "EndOfSong", + "Off", +}; +XToString( FailType ); +XToLocalizedString( FailType ); +LuaXType( FailType ); /* * (c) 2001-2004 Chris Danford diff --git a/src/GameConstantsAndTypes.h b/src/GameConstantsAndTypes.h index 1729f90d15..6180b547cd 100644 --- a/src/GameConstantsAndTypes.h +++ b/src/GameConstantsAndTypes.h @@ -686,6 +686,21 @@ const RString& CourseTypeToString( CourseType i ); const RString& CourseTypeToLocalizedString( CourseType i ); LuaDeclareType( CourseType ); +/** @brief How can the Player fail a song? */ +enum FailType +{ + FailType_Immediate, /**< fail immediately when life touches 0 */ + FailType_ImmediateContinue, /**< Same as above, but allow playing the rest of the song */ + FailType_EndOfSong, /**< fail if life is at 0 when the song ends */ + FailType_Off, /**< never fail */ + NUM_FailType, + FailType_Invalid +}; + +const RString& FailTypeToString( FailType cat ); +const RString& FailTypeToLocalizedString( FailType cat ); +LuaDeclareType( FailType ); + #endif diff --git a/src/GameState.cpp b/src/GameState.cpp index f615558489..12554cb666 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -1534,10 +1534,10 @@ void setmax( T &a, const T &b ) a = max(a, b); } -PlayerOptions::FailType GameState::GetPlayerFailType( const PlayerState *pPlayerState ) const +FailType GameState::GetPlayerFailType( const PlayerState *pPlayerState ) const { PlayerNumber pn = pPlayerState->m_PlayerNumber; - PlayerOptions::FailType ft = pPlayerState->m_PlayerOptions.GetCurrent().m_FailType; + FailType ft = pPlayerState->m_PlayerOptions.GetCurrent().m_FailType; // If the player changed the fail mode explicitly, leave it alone. if( m_bChangedFailTypeOnScreenSongOptions ) @@ -1546,7 +1546,7 @@ PlayerOptions::FailType GameState::GetPlayerFailType( const PlayerState *pPlayer if( IsCourseMode() ) { if( PREFSMAN->m_bMinimum1FullSongInCourses && GetCourseSongIndex()==0 ) - ft = max( ft, PlayerOptions::FAIL_IMMEDIATE_CONTINUE ); // take the least harsh of the two FailTypes + ft = max( ft, FailType_ImmediateContinue ); // take the least harsh of the two FailTypes } else { @@ -1560,18 +1560,18 @@ PlayerOptions::FailType GameState::GetPlayerFailType( const PlayerState *pPlayer // Easy and beginner are never harder than FAIL_IMMEDIATE_CONTINUE. if( dc <= Difficulty_Easy ) - setmax( ft, PlayerOptions::FAIL_IMMEDIATE_CONTINUE ); + setmax( ft, FailType_ImmediateContinue ); if( dc <= Difficulty_Easy && bFirstStage && PREFSMAN->m_bFailOffForFirstStageEasy ) - setmax( ft, PlayerOptions::FAIL_OFF ); + setmax( ft, FailType_Off ); /* If beginner's steps were chosen, and this is the first stage, * turn off failure completely. */ if( dc == Difficulty_Beginner && bFirstStage ) - setmax( ft, PlayerOptions::FAIL_OFF ); + setmax( ft, FailType_Off ); if( dc == Difficulty_Beginner && PREFSMAN->m_bFailOffInBeginner ) - setmax( ft, PlayerOptions::FAIL_OFF ); + setmax( ft, FailType_Off ); } return ft; diff --git a/src/GameState.h b/src/GameState.h index 3f9f390d0b..2b971b6f32 100644 --- a/src/GameState.h +++ b/src/GameState.h @@ -306,7 +306,7 @@ public: bool CurrentOptionsDisqualifyPlayer( PlayerNumber pn ); bool PlayerIsUsingModifier( PlayerNumber pn, const RString &sModifier ); - PlayerOptions::FailType GetPlayerFailType( const PlayerState *pPlayerState ) const; + FailType GetPlayerFailType( const PlayerState *pPlayerState ) const; // character stuff Character* m_pCurCharacters[NUM_PLAYERS]; diff --git a/src/ModsGroup.cpp b/src/ModsGroup.cpp index 63b709d0e4..2e6f1513ee 100644 --- a/src/ModsGroup.cpp +++ b/src/ModsGroup.cpp @@ -7,6 +7,7 @@ static const char *ModsLevelNames[] = { "Preferred", "Stage", "Song", + "Current", }; XToString( ModsLevel ); LuaXType( ModsLevel ); diff --git a/src/ModsGroup.h b/src/ModsGroup.h index 7902eb8dac..0f102df442 100644 --- a/src/ModsGroup.h +++ b/src/ModsGroup.h @@ -9,6 +9,7 @@ enum 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 NUM_ModsLevel, ModsLevel_Invalid }; @@ -30,7 +31,6 @@ class ModsGroup { T m_[NUM_ModsLevel]; RageTimer m_Timer; - T m_Current; // approaches ModsLevel_Song public: void Init() @@ -43,15 +43,15 @@ public: // Don't let the mod approach speed be affected by Tab. // TODO: Find a more elegant way of handling this. fDelta = m_Timer.GetDeltaTime(); - m_Current.Approach( m_[ModsLevel_Song], fDelta ); + m_[ModsLevel_Current].Approach( m_[ModsLevel_Song], fDelta ); } template inline void Assign( ModsLevel level, U T::*member, const U &val ) { if( level != ModsLevel_Song ) - m_Current.*member = val; - for( ; level < NUM_ModsLevel; enum_add(level, 1) ) + m_[ModsLevel_Current].*member = val; + for( ; level < ModsLevel_Current; enum_add(level, 1) ) m_[level].*member = val; } @@ -60,45 +60,50 @@ public: { DEBUG_ASSERT( index < n ); if( level != ModsLevel_Song ) - (m_Current.*member)[index] = val; - for( ; level < NUM_ModsLevel; enum_add(level, 1) ) + (m_[ModsLevel_Current].*member)[index] = val; + for( ; level < ModsLevel_Current; enum_add(level, 1) ) (m_[level].*member)[index] = val; } void Assign( ModsLevel level, const T &val ) { if( level != ModsLevel_Song ) - m_Current = val; - for( ; level < NUM_ModsLevel; enum_add(level, 1) ) + m_[ModsLevel_Current] = val; + for( ; level < ModsLevel_Current; enum_add(level, 1) ) m_[level] = val; } void Call( ModsLevel level, void (T::*fun)() ) { if( level != ModsLevel_Song ) - (m_Current.*fun)(); - for( ; level < NUM_ModsLevel; enum_add(level, 1) ) + (m_[ModsLevel_Current].*fun)(); + for( ; level < ModsLevel_Current; enum_add(level, 1) ) (m_[level].*fun)(); } void FromString( ModsLevel level, const RString &str ) { if( level != ModsLevel_Song ) - m_Current.FromString( str ); - for( ; level < NUM_ModsLevel; enum_add(level, 1) ) + m_[ModsLevel_Current].FromString( str ); + for( ; level < ModsLevel_Current; enum_add(level, 1) ) m_[level].FromString( str ); } void SetCurrentToLevel( ModsLevel level ) { - m_Current = m_[level]; + m_[ModsLevel_Current] = m_[level]; } const T &Get( ModsLevel l ) const { return m_[l]; } - const T &GetPreferred() const { return m_[ModsLevel_Preferred]; } - const T &GetStage() const { return m_[ModsLevel_Stage]; } - const T &GetSong() const { return m_[ModsLevel_Song]; } - const T &GetCurrent() const { return m_Current; } + const T &GetPreferred() const { return m_[ModsLevel_Preferred]; } + const T &GetStage() const { return m_[ModsLevel_Stage]; } + const T &GetSong() const { return m_[ModsLevel_Song]; } + const T &GetCurrent() const { return m_[ModsLevel_Current]; } + T &Get( ModsLevel l ) { return m_[l]; } + T &GetPreferred() { return m_[ModsLevel_Preferred]; } + T &GetStage() { return m_[ModsLevel_Stage]; } + T &GetSong() { return m_[ModsLevel_Song]; } + T &GetCurrent() { return m_[ModsLevel_Current]; } }; #endif diff --git a/src/PlayerOptions.cpp b/src/PlayerOptions.cpp index a2f1a496fa..5564e83071 100644 --- a/src/PlayerOptions.cpp +++ b/src/PlayerOptions.cpp @@ -23,13 +23,19 @@ ThemeMetric RANDOM_EFFECT_CHANCE ( "PlayerOptions", "RandomEffectChance" ThemeMetric RANDOM_HIDDEN_CHANCE ( "PlayerOptions", "RandomHiddenChance" ); ThemeMetric RANDOM_SUDDEN_CHANCE ( "PlayerOptions", "RandomSuddenChance" ); +static const float CMOD_DEFAULT= 200.0f; +// Is there a better place for this? +// It needs to be a named constant because it's used in several places in +// this file, but nothing else has a named constant for its default value. +// -Kyz + void PlayerOptions::Init() { m_bSetScrollSpeed = false; m_fMaxScrollBPM = 0; m_SpeedfMaxScrollBPM = 1.0f; m_fTimeSpacing = 0; m_SpeedfTimeSpacing = 1.0f; m_fScrollSpeed = 1.0f; m_SpeedfScrollSpeed = 1.0f; - m_fScrollBPM = 200; m_SpeedfScrollBPM = 1.0f; + m_fScrollBPM = CMOD_DEFAULT; m_SpeedfScrollBPM = 1.0f; ZERO( m_fAccels ); ONE( m_SpeedfAccels ); ZERO( m_fEffects ); ONE( m_SpeedfEffects ); ZERO( m_fAppearances ); ONE( m_SpeedfAppearances ); @@ -40,7 +46,6 @@ void PlayerOptions::Init() m_fRandAttack = 0; m_SpeedfRandAttack = 1.0f; m_fNoAttack = 0; m_SpeedfNoAttack = 1.0f; m_fPlayerAutoPlay = 0; m_SpeedfPlayerAutoPlay = 1.0f; - m_bSetTiltOrSkew = false; m_fPerspectiveTilt = 0; m_SpeedfPerspectiveTilt = 1.0f; m_fSkew = 0; m_SpeedfSkew = 1.0f; m_fPassmark = 0; m_SpeedfPassmark = 1.0f; @@ -48,7 +53,7 @@ void PlayerOptions::Init() ZERO( m_bTurns ); ZERO( m_bTransforms ); m_bMuteOnError = false; - m_FailType = FAIL_IMMEDIATE; + m_FailType = FailType_Immediate; m_sNoteSkin = ""; } @@ -83,7 +88,6 @@ void PlayerOptions::Approach( const PlayerOptions& other, float fDeltaSeconds ) APPROACH( fRandomSpeed ); DO_COPY( m_bSetScrollSpeed ); - DO_COPY( m_bSetTiltOrSkew ); for( int i=0; i &AddTo, bool bForceNoteSkin ) const switch( m_FailType ) { - case FAIL_IMMEDIATE: break; - case FAIL_IMMEDIATE_CONTINUE: AddTo.push_back("FailImmediateContinue"); break; - case FAIL_AT_END: AddTo.push_back("FailAtEnd"); break; - case FAIL_OFF: AddTo.push_back("FailOff"); break; + case FailType_Immediate: break; + case FailType_ImmediateContinue: AddTo.push_back("FailImmediateContinue"); break; + case FailType_EndOfSong: AddTo.push_back("FailAtEnd"); break; + case FailType_Off: AddTo.push_back("FailOff"); break; default: FAIL_M(ssprintf("Invalid FailType: %i", m_FailType)); } - if( m_fSkew==0 && m_fPerspectiveTilt==0 ) { if( m_bSetTiltOrSkew ) AddTo.push_back( "Overhead" ); } + if( m_fSkew==0 && m_fPerspectiveTilt==0 ) + { + AddTo.push_back( "Overhead" ); + } else if( m_fSkew == 0 ) { if( m_fPerspectiveTilt > 0 ) @@ -346,7 +353,7 @@ bool PlayerOptions::FromOneModString( const RString &sOneMod, RString &sErrorOut else if( sscanf( sBit, "c%f", &level ) == 1 ) { if( !isfinite(level) || level <= 0.0f ) - level = 200.0f; // Just pick some value. + level = CMOD_DEFAULT; SET_FLOAT( fScrollBPM ) SET_FLOAT( fTimeSpacing ) m_fTimeSpacing = 1; @@ -359,7 +366,7 @@ bool PlayerOptions::FromOneModString( const RString &sOneMod, RString &sErrorOut // OpenITG doesn't have this block: /* if( !isfinite(level) || level <= 0.0f ) - level = 200.0f; + level = CMOD_DEFAULT; */ SET_FLOAT( fMaxScrollBPM ) m_fTimeSpacing = 0; @@ -376,7 +383,7 @@ bool PlayerOptions::FromOneModString( const RString &sOneMod, RString &sErrorOut SET_FLOAT(fTimeSpacing); level= 1.0f; SET_FLOAT(fScrollSpeed); - level= 200.0f; + level= CMOD_DEFAULT; SET_FLOAT(fScrollBPM) } else if( sBit == "boost" ) SET_FLOAT( fAccels[ACCEL_BOOST] ) @@ -448,20 +455,20 @@ bool PlayerOptions::FromOneModString( const RString &sOneMod, RString &sErrorOut else if( sBit == "noattacks" ) SET_FLOAT( fNoAttack ) else if( sBit == "playerautoplay" ) SET_FLOAT( fPlayerAutoPlay ) else if( sBit == "passmark" ) SET_FLOAT( fPassmark ) - else if( sBit == "overhead" ) { m_bSetTiltOrSkew = true; m_fSkew = 0; m_fPerspectiveTilt = 0; m_SpeedfSkew = m_SpeedfPerspectiveTilt = speed; } - else if( sBit == "incoming" ) { m_bSetTiltOrSkew = true; m_fSkew = level; m_fPerspectiveTilt = -level; m_SpeedfSkew = m_SpeedfPerspectiveTilt = speed; } - else if( sBit == "space" ) { m_bSetTiltOrSkew = true; m_fSkew = level; m_fPerspectiveTilt = +level; m_SpeedfSkew = m_SpeedfPerspectiveTilt = speed; } - else if( sBit == "hallway" ) { m_bSetTiltOrSkew = true; m_fSkew = 0; m_fPerspectiveTilt = -level; m_SpeedfSkew = m_SpeedfPerspectiveTilt = speed; } - else if( sBit == "distant" ) { m_bSetTiltOrSkew = true; m_fSkew = 0; m_fPerspectiveTilt = +level; m_SpeedfSkew = m_SpeedfPerspectiveTilt = speed; } + else if( sBit == "overhead" ) { m_fSkew = 0; m_fPerspectiveTilt = 0; m_SpeedfSkew = m_SpeedfPerspectiveTilt = speed; } + else if( sBit == "incoming" ) { m_fSkew = level; m_fPerspectiveTilt = -level; m_SpeedfSkew = m_SpeedfPerspectiveTilt = speed; } + else if( sBit == "space" ) { m_fSkew = level; m_fPerspectiveTilt = +level; m_SpeedfSkew = m_SpeedfPerspectiveTilt = speed; } + else if( sBit == "hallway" ) { m_fSkew = 0; m_fPerspectiveTilt = -level; m_SpeedfSkew = m_SpeedfPerspectiveTilt = speed; } + else if( sBit == "distant" ) { m_fSkew = 0; m_fPerspectiveTilt = +level; m_SpeedfSkew = m_SpeedfPerspectiveTilt = speed; } else if( NOTESKIN && NOTESKIN->DoesNoteSkinExist(sBit) ) m_sNoteSkin = sBit; else if( sBit == "noteskin" && !on ) /* "no noteskin" */ m_sNoteSkin = CommonMetrics::DEFAULT_NOTESKIN_NAME; else if( sBit == "randomspeed" ) SET_FLOAT( fRandomSpeed ) else if( sBit == "failarcade" || - sBit == "failimmediate" ) m_FailType = FAIL_IMMEDIATE; + sBit == "failimmediate" ) m_FailType = FailType_Immediate; else if( sBit == "failendofsong" || - sBit == "failimmediatecontinue" ) m_FailType = FAIL_IMMEDIATE_CONTINUE; - else if( sBit == "failatend" ) m_FailType = FAIL_AT_END; - else if( sBit == "failoff" ) m_FailType = FAIL_OFF; + sBit == "failimmediatecontinue" ) m_FailType = FailType_ImmediateContinue; + else if( sBit == "failatend" ) m_FailType = FailType_EndOfSong; + else if( sBit == "failoff" ) m_FailType = FailType_Off; else if( sBit == "faildefault" ) { PlayerOptions po; @@ -916,133 +923,381 @@ public: return 1; } + static float CheckedApproachSpeed(lua_State* L, float s) + { + if(s <= 0) + { + luaL_error(L, "Approach speed must be greater than zero."); + } + return s; + } + + // Functions are designed to combine Get and Set into one, to be less clumsy to use. -Kyz + // If a valid arg is passed, the value is set. + // The previous value is returned. +#define FLOAT_INTERFACE(func_name, member) \ + static int func_name(T* p, lua_State* L) \ + { \ + lua_pushnumber(L, p->m_f ## member); \ + lua_pushnumber(L, p->m_Speedf ## member); \ + if(lua_isnumber(L, 1)) \ + { \ + p->m_f ## member = FArg(1); \ + } \ + if(lua_isnumber(L, 2)) \ + { \ + p->m_Speedf ## member = CheckedApproachSpeed(L, FArg(2)); \ + } \ + return 2; \ + } +#define BOOL_INTERFACE(func_name, member) \ + static int func_name(T* p, lua_State* L) \ + { \ + lua_pushboolean(L, p->m_b ## member); \ + if(lua_isboolean(L, 1)) \ + { \ + p->m_b ## member = BArg(1); \ + } \ + return 1; \ + } + + // Direct control functions, for themes that can handle it. + + FLOAT_INTERFACE(TimeSpacing, TimeSpacing); + FLOAT_INTERFACE(MaxScrollBPM, MaxScrollBPM); + FLOAT_INTERFACE(ScrollSpeed, ScrollSpeed); + FLOAT_INTERFACE(ScrollBPM, ScrollBPM); + FLOAT_INTERFACE(Boost, Accels[PlayerOptions::ACCEL_BOOST]); + FLOAT_INTERFACE(Brake, Accels[PlayerOptions::ACCEL_BRAKE]); + FLOAT_INTERFACE(Wave, Accels[PlayerOptions::ACCEL_WAVE]); + FLOAT_INTERFACE(Expand, Accels[PlayerOptions::ACCEL_EXPAND]); + FLOAT_INTERFACE(Boomerang, Accels[PlayerOptions::ACCEL_BOOMERANG]); + FLOAT_INTERFACE(Drunk, Effects[PlayerOptions::EFFECT_DRUNK]); + FLOAT_INTERFACE(Dizzy, Effects[PlayerOptions::EFFECT_DIZZY]); + FLOAT_INTERFACE(Confusion, Effects[PlayerOptions::EFFECT_CONFUSION]); + FLOAT_INTERFACE(Mini, Effects[PlayerOptions::EFFECT_MINI]); + FLOAT_INTERFACE(Tiny, Effects[PlayerOptions::EFFECT_TINY]); + FLOAT_INTERFACE(Flip, Effects[PlayerOptions::EFFECT_FLIP]); + FLOAT_INTERFACE(Invert, Effects[PlayerOptions::EFFECT_INVERT]); + FLOAT_INTERFACE(Tornado, Effects[PlayerOptions::EFFECT_TORNADO]); + FLOAT_INTERFACE(Tipsy, Effects[PlayerOptions::EFFECT_TIPSY]); + FLOAT_INTERFACE(Bumpy, Effects[PlayerOptions::EFFECT_BUMPY]); + FLOAT_INTERFACE(Beat, Effects[PlayerOptions::EFFECT_BEAT]); + FLOAT_INTERFACE(Xmode, Effects[PlayerOptions::EFFECT_XMODE]); + FLOAT_INTERFACE(Twirl, Effects[PlayerOptions::EFFECT_TWIRL]); + FLOAT_INTERFACE(Roll, Effects[PlayerOptions::EFFECT_ROLL]); + FLOAT_INTERFACE(Hidden, Appearances[PlayerOptions::APPEARANCE_HIDDEN]); + FLOAT_INTERFACE(HiddenOffset, Appearances[PlayerOptions::APPEARANCE_HIDDEN_OFFSET]); + FLOAT_INTERFACE(Sudden, Appearances[PlayerOptions::APPEARANCE_SUDDEN]); + FLOAT_INTERFACE(SuddenOffset, Appearances[PlayerOptions::APPEARANCE_SUDDEN_OFFSET]); + FLOAT_INTERFACE(Stealth, Appearances[PlayerOptions::APPEARANCE_STEALTH]); + FLOAT_INTERFACE(Blink, Appearances[PlayerOptions::APPEARANCE_BLINK]); + FLOAT_INTERFACE(RandomVanish, Appearances[PlayerOptions::APPEARANCE_RANDOMVANISH]); + FLOAT_INTERFACE(Reverse, Scrolls[PlayerOptions::SCROLL_REVERSE]); + FLOAT_INTERFACE(Split, Scrolls[PlayerOptions::SCROLL_SPLIT]); + FLOAT_INTERFACE(Alternate, Scrolls[PlayerOptions::SCROLL_ALTERNATE]); + FLOAT_INTERFACE(Cross, Scrolls[PlayerOptions::SCROLL_CROSS]); + FLOAT_INTERFACE(Centered, Scrolls[PlayerOptions::SCROLL_CENTERED]); + FLOAT_INTERFACE(Dark, Dark); + FLOAT_INTERFACE(Blind, Blind); + FLOAT_INTERFACE(Cover, Cover); + FLOAT_INTERFACE(RandAttack, RandAttack); + FLOAT_INTERFACE(NoAttack, NoAttack); + FLOAT_INTERFACE(PlayerAutoPlay, PlayerAutoPlay); + FLOAT_INTERFACE(Skew, Skew); + FLOAT_INTERFACE(Tilt, PerspectiveTilt); + FLOAT_INTERFACE(Passmark, Passmark); // Passmark is not sanity checked to the [0, 1] range because LifeMeterBar::IsFailing is the only thing that uses it, and it's used in a <= test. Any theme passing a value outside the [0, 1] range probably expects the result they get. -Kyz + FLOAT_INTERFACE(RandomSpeed, RandomSpeed); + BOOL_INTERFACE(TurnNone, Turns[PlayerOptions::TURN_NONE]); + BOOL_INTERFACE(Mirror, Turns[PlayerOptions::TURN_MIRROR]); + BOOL_INTERFACE(Backwards, Turns[PlayerOptions::TURN_BACKWARDS]); + BOOL_INTERFACE(Left, Turns[PlayerOptions::TURN_LEFT]); + BOOL_INTERFACE(Right, Turns[PlayerOptions::TURN_RIGHT]); + BOOL_INTERFACE(Shuffle, Turns[PlayerOptions::TURN_SHUFFLE]); + BOOL_INTERFACE(SoftShuffle, Turns[PlayerOptions::TURN_SOFT_SHUFFLE]); + BOOL_INTERFACE(SuperShuffle, Turns[PlayerOptions::TURN_SUPER_SHUFFLE]); + BOOL_INTERFACE(NoHolds, Transforms[PlayerOptions::TRANSFORM_NOHOLDS]); + BOOL_INTERFACE(NoRolls, Transforms[PlayerOptions::TRANSFORM_NOROLLS]); + BOOL_INTERFACE(NoMines, Transforms[PlayerOptions::TRANSFORM_NOMINES]); + BOOL_INTERFACE(Little, Transforms[PlayerOptions::TRANSFORM_LITTLE]); + BOOL_INTERFACE(Wide, Transforms[PlayerOptions::TRANSFORM_WIDE]); + BOOL_INTERFACE(Big, Transforms[PlayerOptions::TRANSFORM_BIG]); + BOOL_INTERFACE(Quick, Transforms[PlayerOptions::TRANSFORM_QUICK]); + BOOL_INTERFACE(BMRize, Transforms[PlayerOptions::TRANSFORM_BMRIZE]); + BOOL_INTERFACE(Skippy, Transforms[PlayerOptions::TRANSFORM_SKIPPY]); + BOOL_INTERFACE(Mines, Transforms[PlayerOptions::TRANSFORM_MINES]); + BOOL_INTERFACE(AttackMines, Transforms[PlayerOptions::TRANSFORM_ATTACKMINES]); + BOOL_INTERFACE(Echo, Transforms[PlayerOptions::TRANSFORM_ECHO]); + BOOL_INTERFACE(Stomp, Transforms[PlayerOptions::TRANSFORM_STOMP]); + BOOL_INTERFACE(Planted, Transforms[PlayerOptions::TRANSFORM_PLANTED]); + BOOL_INTERFACE(Floored, Transforms[PlayerOptions::TRANSFORM_FLOORED]); + BOOL_INTERFACE(Twister, Transforms[PlayerOptions::TRANSFORM_TWISTER]); + BOOL_INTERFACE(HoldRolls, Transforms[PlayerOptions::TRANSFORM_HOLDROLLS]); + BOOL_INTERFACE(NoJumps, Transforms[PlayerOptions::TRANSFORM_NOJUMPS]); + BOOL_INTERFACE(NoHands, Transforms[PlayerOptions::TRANSFORM_NOHANDS]); + BOOL_INTERFACE(NoLifts, Transforms[PlayerOptions::TRANSFORM_NOLIFTS]); + BOOL_INTERFACE(NoFakes, Transforms[PlayerOptions::TRANSFORM_NOFAKES]); + BOOL_INTERFACE(NoQuads, Transforms[PlayerOptions::TRANSFORM_NOQUADS]); + BOOL_INTERFACE(NoStretch, Transforms[PlayerOptions::TRANSFORM_NOSTRETCH]); + BOOL_INTERFACE(MuteOnError, MuteOnError); + +#undef FLOAT_INTERFACE +#undef BOOL_INTERFACE + // NoteSkins - static int GetNoteSkin( T *p, lua_State *L ) + static int NoteSkin(T* p, lua_State* L) { if( p->m_sNoteSkin.empty() ) + { lua_pushstring( L, CommonMetrics::DEFAULT_NOTESKIN_NAME.GetValue() ); + } else + { lua_pushstring( L, p->m_sNoteSkin ); + } + if(lua_isstring(L, 1)) + { + if(NOTESKIN->DoesNoteSkinExist(SArg(1))) + { + p->m_sNoteSkin = SArg(1); + lua_pushboolean(L, true); + } + } + return 2; + } + + static int FailSetting(T* p, lua_State* L) + { + Enum::Push(L, p->m_FailType); + if(lua_isstring(L, 1)) + { + p->m_FailType= Enum::Check(L, 1); + } return 1; } - static int SetNoteSkin( T *p, lua_State *L ) + + static void SetSpeedModApproaches(T* p, float speed) { - if( NOTESKIN->DoesNoteSkinExist(SArg(1)) ) - p->m_sNoteSkin = SArg(1); - return 0; + p->m_SpeedfScrollBPM= speed; + p->m_SpeedfScrollSpeed= speed; + p->m_SpeedfMaxScrollBPM= speed; + p->m_SpeedfTimeSpacing= speed; } // Speed Mods - static int GetCMod( T *p, lua_State *L ) + // Sanity checked functions for speed mods, for themes that want to use the + // engine's enforcement of sane separation between speed mod types. + static int CMod(T* p, lua_State* L) { - if( p->m_fTimeSpacing ) - lua_pushnumber( L, p->m_fScrollBPM ); + if(p->m_fTimeSpacing) + { + lua_pushnumber(L, p->m_fScrollBPM); + lua_pushnumber(L, p->m_SpeedfScrollBPM); + } else + { lua_pushnil(L); - return 1; - } - static int SetCMod( T *p, lua_State *L ) - { - p->m_fTimeSpacing = FArg(1); - p->m_fTimeSpacing = 1; - p->m_fMaxScrollBPM = 0; - return 0; + lua_pushnil(L); + } + if(lua_isnumber(L, 1)) + { + float speed= FArg(1); + if(!isfinite(speed) || speed <= 0.0f) + { + luaL_error(L, "CMod speed must be finite and greater than 0."); + } + p->m_fScrollBPM= speed; + p->m_fTimeSpacing = 1; + p->m_fScrollSpeed = 1; + p->m_fMaxScrollBPM = 0; + } + if(lua_isnumber(L, 2)) + { + SetSpeedModApproaches(p, CheckedApproachSpeed(L, FArg(2))); + } + return 2; } - static int GetXMod( T *p, lua_State *L ) + static int XMod(T* p, lua_State* L) { - if( !p->m_fTimeSpacing ) - lua_pushnumber( L, p->m_fScrollSpeed ); + if(!p->m_fTimeSpacing) + { + lua_pushnumber(L, p->m_fScrollSpeed); + lua_pushnumber(L, p->m_SpeedfScrollSpeed); + } else + { lua_pushnil(L); - return 1; - } - static int SetXMod( T *p, lua_State *L ) - { - p->m_fScrollSpeed = FArg(1); - p->m_fTimeSpacing = 0; - p->m_fMaxScrollBPM = 0; - return 0; + lua_pushnil(L); + } + if(lua_isnumber(L, 1)) + { + p->m_fScrollSpeed = FArg(1); + p->m_fTimeSpacing = 0; + p->m_fScrollBPM= CMOD_DEFAULT; + p->m_fMaxScrollBPM = 0; + } + if(lua_isnumber(L, 2)) + { + SetSpeedModApproaches(p, CheckedApproachSpeed(L, FArg(2))); + } + return 2; } - static int GetMMod( T *p, lua_State *L ) + static int MMod(T* p, lua_State* L) { - if( !p->m_fTimeSpacing && p->m_fMaxScrollBPM ) + if(!p->m_fTimeSpacing && p->m_fMaxScrollBPM) + { lua_pushnumber(L, p->m_fMaxScrollBPM); + lua_pushnumber(L, p->m_SpeedfMaxScrollBPM); + } else + { lua_pushnil(L); + lua_pushnil(L); + } + if(lua_isnumber(L, 1)) + { + float speed= FArg(1); + if(!isfinite(speed) || speed <= 0.0f) + { + luaL_error(L, "MMod speed must be finite and greater than 0."); + } + p->m_fScrollBPM= CMOD_DEFAULT; + p->m_fTimeSpacing = 0; + p->m_fScrollSpeed= 1; + p->m_fMaxScrollBPM = speed; + } + if(lua_isnumber(L, 2)) + { + SetSpeedModApproaches(p, CheckedApproachSpeed(L, FArg(2))); + } + return 2; + } + static void SetPerspectiveApproach(T* p, lua_State* L, float speed) + { + p->m_SpeedfPerspectiveTilt= speed; + p->m_SpeedfSkew= speed; + } + + static int Overhead(T* p, lua_State* L) + { + lua_pushboolean(L, (p->m_fPerspectiveTilt == 0.0f && p->m_fSkew == 0.0f)); + if(lua_toboolean(L, 1)) + { + p->m_fPerspectiveTilt= 0; + p->m_fSkew= 0; + } + if(lua_isnumber(L, 2)) + { + SetPerspectiveApproach(p, L, CheckedApproachSpeed(L, FArg(2))); + } return 1; } - static int SetMMod( T *p, lua_State *L ) + + static int Incoming(T* p, lua_State* L) { - p->m_fMaxScrollBPM = FArg(1); - p->m_fTimeSpacing = 0; - return 0; + if((p->m_fSkew > 0.0f && p->m_fPerspectiveTilt < 0.0f) || + (p->m_fSkew < 0.0f && p->m_fPerspectiveTilt > 0.0f)) + { + lua_pushnumber(L, p->m_fSkew); + lua_pushnumber(L, p->m_SpeedfSkew); + } + else + { + lua_pushnil(L); + lua_pushnil(L); + } + if(lua_isnumber(L, 1)) + { + float value= FArg(1); + p->m_fPerspectiveTilt= -value; + p->m_fSkew= value; + } + if(lua_isnumber(L, 2)) + { + SetPerspectiveApproach(p, L, CheckedApproachSpeed(L, FArg(2))); + } + return 2; } - // Accel - DEFINE_METHOD( GetBoost, m_fAccels[PlayerOptions::ACCEL_BOOST] ) - static int SetBoost( T *p, lua_State *L ){ p->m_fAccels[PlayerOptions::ACCEL_BOOST] = FArg(1); return 0; } - DEFINE_METHOD( GetBrake, m_fAccels[PlayerOptions::ACCEL_BRAKE] ) - static int SetBrake( T *p, lua_State *L ){ p->m_fAccels[PlayerOptions::ACCEL_BRAKE] = FArg(1); return 0; } - DEFINE_METHOD( GetWave, m_fAccels[PlayerOptions::ACCEL_WAVE] ) - static int SetWave( T *p, lua_State *L ){ p->m_fAccels[PlayerOptions::ACCEL_WAVE] = FArg(1); return 0; } - DEFINE_METHOD( GetExpand, m_fAccels[PlayerOptions::ACCEL_EXPAND] ) - static int SetExpand( T *p, lua_State *L ){ p->m_fAccels[PlayerOptions::ACCEL_EXPAND] = FArg(1); return 0; } - DEFINE_METHOD( GetBoomerang, m_fAccels[PlayerOptions::ACCEL_BOOMERANG] ) - static int SetBoomerang( T *p, lua_State *L ){ p->m_fAccels[PlayerOptions::ACCEL_BOOMERANG] = FArg(1); return 0; } + static int Space(T* p, lua_State* L) + { + if((p->m_fSkew > 0.0f && p->m_fPerspectiveTilt > 0.0f) || + (p->m_fSkew < 0.0f && p->m_fPerspectiveTilt < 0.0f)) + { + lua_pushnumber(L, p->m_fSkew); + lua_pushnumber(L, p->m_SpeedfSkew); + } + else + { + lua_pushnil(L); + lua_pushnil(L); + } + if(lua_isnumber(L, 1)) + { + float value= FArg(1); + p->m_fPerspectiveTilt= value; + p->m_fSkew= value; + } + if(lua_isnumber(L, 2)) + { + SetPerspectiveApproach(p, L, CheckedApproachSpeed(L, FArg(2))); + } + return 2; + } - // Effect - DEFINE_METHOD( GetDrunk, m_fEffects[PlayerOptions::EFFECT_DRUNK] ) // MoonGyuHyuk - static int SetDrunk( T *p, lua_State *L ){ p->m_fEffects[PlayerOptions::EFFECT_DRUNK] = FArg(1); return 0; } - DEFINE_METHOD( GetDizzy, m_fEffects[PlayerOptions::EFFECT_DIZZY] ) - static int SetDizzy( T *p, lua_State *L ){ p->m_fEffects[PlayerOptions::EFFECT_DIZZY] = FArg(1); return 0; } - DEFINE_METHOD( GetConfusion, m_fEffects[PlayerOptions::EFFECT_CONFUSION] ) - static int SetConfusion( T *p, lua_State *L ){ p->m_fEffects[PlayerOptions::EFFECT_CONFUSION] = FArg(1); return 0; } - DEFINE_METHOD( GetMini, m_fEffects[PlayerOptions::EFFECT_MINI] ) - static int SetMini( T *p, lua_State *L ){ p->m_fEffects[PlayerOptions::EFFECT_MINI] = FArg(1); return 0; } - DEFINE_METHOD( GetTiny, m_fEffects[PlayerOptions::EFFECT_TINY] ) - static int SetTiny( T *p, lua_State *L ){ p->m_fEffects[PlayerOptions::EFFECT_TINY] = FArg(1); return 0; } - DEFINE_METHOD( GetFlip, m_fEffects[PlayerOptions::EFFECT_FLIP] ) - static int SetFlip( T *p, lua_State *L ){ p->m_fEffects[PlayerOptions::EFFECT_FLIP] = FArg(1); return 0; } - DEFINE_METHOD( GetInvert, m_fEffects[PlayerOptions::EFFECT_INVERT] ) - static int SetInvert( T *p, lua_State *L ){ p->m_fEffects[PlayerOptions::EFFECT_INVERT] = FArg(1); return 0; } - DEFINE_METHOD( GetTornado, m_fEffects[PlayerOptions::EFFECT_TORNADO] ) - static int SetTornado( T *p, lua_State *L ){ p->m_fEffects[PlayerOptions::EFFECT_TORNADO] = FArg(1); return 0; } - DEFINE_METHOD( GetTipsy, m_fEffects[PlayerOptions::EFFECT_TIPSY] ) - static int SetTipsy( T *p, lua_State *L ){ p->m_fEffects[PlayerOptions::EFFECT_TIPSY] = FArg(1); return 0; } - DEFINE_METHOD( GetBumpy, m_fEffects[PlayerOptions::EFFECT_BUMPY] ) - static int SetBumpy( T *p, lua_State *L ){ p->m_fEffects[PlayerOptions::EFFECT_BUMPY] = FArg(1); return 0; } - DEFINE_METHOD( GetBeat, m_fEffects[PlayerOptions::EFFECT_BEAT] ) - static int SetBeat( T *p, lua_State *L ){ p->m_fEffects[PlayerOptions::EFFECT_BEAT] = FArg(1); return 0; } - DEFINE_METHOD( GetXMode, m_fEffects[PlayerOptions::EFFECT_XMODE] ) - static int SetXMode( T *p, lua_State *L ){ p->m_fEffects[PlayerOptions::EFFECT_XMODE] = FArg(1); return 0; } - DEFINE_METHOD( GetTwirl, m_fEffects[PlayerOptions::EFFECT_TWIRL] ) - static int SetTwirl( T *p, lua_State *L ){ p->m_fEffects[PlayerOptions::EFFECT_TWIRL] = FArg(1); return 0; } - DEFINE_METHOD( GetRoll, m_fEffects[PlayerOptions::EFFECT_ROLL] ) - static int SetRoll( T *p, lua_State *L ){ p->m_fEffects[PlayerOptions::EFFECT_ROLL] = FArg(1); return 0; } + static int Hallway(T* p, lua_State* L) + { + if(p->m_fSkew == 0.0f && p->m_fPerspectiveTilt < 0.0f) + { + lua_pushnumber(L, -p->m_fPerspectiveTilt); + lua_pushnumber(L, p->m_SpeedfPerspectiveTilt); + } + else + { + lua_pushnil(L); + lua_pushnil(L); + } + if(lua_isnumber(L, 1)) + { + p->m_fPerspectiveTilt= -FArg(1); + p->m_fSkew= 0; + } + if(lua_isnumber(L, 2)) + { + SetPerspectiveApproach(p, L, CheckedApproachSpeed(L, FArg(2))); + } + return 2; + } + + static int Distant(T* p, lua_State* L) + { + if(p->m_fSkew == 0.0f && p->m_fPerspectiveTilt > 0.0f) + { + lua_pushnumber(L, p->m_fPerspectiveTilt); + lua_pushnumber(L, p->m_SpeedfPerspectiveTilt); + } + else + { + lua_pushnil(L); + lua_pushnil(L); + } + if(lua_isnumber(L, 1)) + { + p->m_fPerspectiveTilt= FArg(1); + p->m_fSkew= 0; + } + if(lua_isnumber(L, 2)) + { + SetPerspectiveApproach(p, L, CheckedApproachSpeed(L, FArg(2))); + } + return 2; + } - // Appearance - DEFINE_METHOD( GetHidden, m_fAppearances[PlayerOptions::APPEARANCE_HIDDEN] ) - static int SetHidden( T *p, lua_State *L ){ p->m_fAppearances[PlayerOptions::APPEARANCE_HIDDEN] = FArg(1); return 0; } - DEFINE_METHOD( GetHiddenOffset, m_fAppearances[PlayerOptions::APPEARANCE_HIDDEN_OFFSET] ) - static int SetHiddenOffset( T *p, lua_State *L ){ p->m_fAppearances[PlayerOptions::APPEARANCE_HIDDEN_OFFSET] = FArg(1); return 0; } - DEFINE_METHOD( GetSudden, m_fAppearances[PlayerOptions::APPEARANCE_SUDDEN] ) - static int SetSudden( T *p, lua_State *L ){ p->m_fAppearances[PlayerOptions::APPEARANCE_SUDDEN] = FArg(1); return 0; } - DEFINE_METHOD( GetSuddenOffset, m_fAppearances[PlayerOptions::APPEARANCE_SUDDEN_OFFSET] ) - static int SetSuddenOffset( T *p, lua_State *L ){ p->m_fAppearances[PlayerOptions::APPEARANCE_SUDDEN_OFFSET] = FArg(1); return 0; } - DEFINE_METHOD( GetStealth, m_fAppearances[PlayerOptions::APPEARANCE_STEALTH] ) - static int SetStealth( T *p, lua_State *L ){ p->m_fAppearances[PlayerOptions::APPEARANCE_STEALTH] = FArg(1); return 0; } - DEFINE_METHOD( GetBlink, m_fAppearances[PlayerOptions::APPEARANCE_BLINK] ) - static int SetBlink( T *p, lua_State *L ){ p->m_fAppearances[PlayerOptions::APPEARANCE_BLINK] = FArg(1); return 0; } - DEFINE_METHOD( GetRandomVanish, m_fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH] ) - static int SetRandomVanish( T *p, lua_State *L ){ p->m_fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH] = FArg(1); return 0; } + DEFINE_METHOD( UsingReverse, m_fScrolls[PlayerOptions::SCROLL_REVERSE] == 1.0f ); - // Scroll - DEFINE_METHOD( GetReverse, m_fScrolls[PlayerOptions::SCROLL_REVERSE] ) - static int SetReverse( T *p, lua_State *L ){ p->m_fScrolls[PlayerOptions::SCROLL_REVERSE] = FArg(1); return 0; } - DEFINE_METHOD( UsingReverse, m_fScrolls[PlayerOptions::SCROLL_REVERSE] == 1.0f ) static int GetReversePercentForColumn( T *p, lua_State *L ) { const int colNum = IArg(1); @@ -1056,284 +1311,114 @@ public: return 1; } - DEFINE_METHOD( GetSplit, m_fScrolls[PlayerOptions::SCROLL_SPLIT] ) - static int SetSplit( T *p, lua_State *L ){ p->m_fScrolls[PlayerOptions::SCROLL_SPLIT] = FArg(1); return 0; } - DEFINE_METHOD( GetAlternate, m_fScrolls[PlayerOptions::SCROLL_ALTERNATE] ) - static int SetAlternate( T *p, lua_State *L ){ p->m_fScrolls[PlayerOptions::SCROLL_ALTERNATE] = FArg(1); return 0; } - DEFINE_METHOD( GetCross, m_fScrolls[PlayerOptions::SCROLL_CROSS] ) - static int SetCross( T *p, lua_State *L ){ p->m_fScrolls[PlayerOptions::SCROLL_CROSS] = FArg(1); return 0; } - DEFINE_METHOD( GetCentered, m_fScrolls[PlayerOptions::SCROLL_CENTERED] ) - static int SetCentered( T *p, lua_State *L ){ p->m_fScrolls[PlayerOptions::SCROLL_CENTERED] = FArg(1); return 0; } - - // Turns - DEFINE_METHOD( GetMirror, m_bTurns[PlayerOptions::TURN_MIRROR] ) - static int SetMirror( T *p, lua_State *L ){ p->m_bTurns[PlayerOptions::TURN_MIRROR] = BArg(1); return 0; } - DEFINE_METHOD( GetBackwards, m_bTurns[PlayerOptions::TURN_BACKWARDS] ) - static int SetBackwards( T *p, lua_State *L ){ p->m_bTurns[PlayerOptions::TURN_BACKWARDS] = BArg(1); return 0; } - DEFINE_METHOD( GetLeft, m_bTurns[PlayerOptions::TURN_LEFT] ) - static int SetLeft( T *p, lua_State *L ){ p->m_bTurns[PlayerOptions::TURN_LEFT] = BArg(1); return 0; } - DEFINE_METHOD( GetRight, m_bTurns[PlayerOptions::TURN_RIGHT] ) - static int SetRight( T *p, lua_State *L ){ p->m_bTurns[PlayerOptions::TURN_RIGHT] = BArg(1); return 0; } - DEFINE_METHOD( GetShuffle, m_bTurns[PlayerOptions::TURN_SHUFFLE] ) - static int SetShuffle( T *p, lua_State *L ){ p->m_bTurns[PlayerOptions::TURN_SHUFFLE] = BArg(1); return 0; } - DEFINE_METHOD( GetSoftShuffle, m_bTurns[PlayerOptions::TURN_SOFT_SHUFFLE] ) - static int SetSoftShuffle( T *p, lua_State *L ){ p->m_bTurns[PlayerOptions::TURN_SOFT_SHUFFLE] = BArg(1); return 0; } - DEFINE_METHOD( GetSuperShuffle, m_bTurns[PlayerOptions::TURN_SUPER_SHUFFLE] ) - static int SetSuperShuffle( T *p, lua_State *L ){ p->m_bTurns[PlayerOptions::TURN_SUPER_SHUFFLE] = BArg(1); return 0; } - - // Transform - DEFINE_METHOD( GetNoHolds, m_bTransforms[PlayerOptions::TRANSFORM_NOHOLDS] ) - static int SetNoHolds( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_NOHOLDS] = BArg(1); return 0; } - DEFINE_METHOD( GetNoRolls, m_bTransforms[PlayerOptions::TRANSFORM_NOROLLS] ) - static int SetNoRolls( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_NOROLLS] = BArg(1); return 0; } - DEFINE_METHOD( GetNoMines, m_bTransforms[PlayerOptions::TRANSFORM_NOMINES] ) - static int SetNoMines( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_NOMINES] = BArg(1); return 0; } - DEFINE_METHOD( GetLittle, m_bTransforms[PlayerOptions::TRANSFORM_LITTLE] ) - static int SetLittle( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_LITTLE] = BArg(1); return 0; } - DEFINE_METHOD( GetWide, m_bTransforms[PlayerOptions::TRANSFORM_WIDE] ) - static int SetWide( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_WIDE] = BArg(1); return 0; } - DEFINE_METHOD( GetBig, m_bTransforms[PlayerOptions::TRANSFORM_BIG] ) - static int SetBig( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_BIG] = BArg(1); return 0; } - DEFINE_METHOD( GetQuick, m_bTransforms[PlayerOptions::TRANSFORM_QUICK] ) - static int SetQuick( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_QUICK] = BArg(1); return 0; } - DEFINE_METHOD( GetBMRize, m_bTransforms[PlayerOptions::TRANSFORM_BMRIZE] ) - static int SetBMRize( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_BMRIZE] = BArg(1); return 0; } - DEFINE_METHOD( GetSkippy, m_bTransforms[PlayerOptions::TRANSFORM_SKIPPY] ) - static int SetSkippy( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_SKIPPY] = BArg(1); return 0; } - DEFINE_METHOD( GetMines, m_bTransforms[PlayerOptions::TRANSFORM_MINES] ) - static int SetMines( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_MINES] = BArg(1); return 0; } - DEFINE_METHOD( GetAttackMines, m_bTransforms[PlayerOptions::TRANSFORM_ATTACKMINES] ) - static int SetAttackMines( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_ATTACKMINES] = BArg(1); return 0; } - DEFINE_METHOD( GetEcho, m_bTransforms[PlayerOptions::TRANSFORM_ECHO] ) - static int SetEcho( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_ECHO] = BArg(1); return 0; } - DEFINE_METHOD( GetStomp, m_bTransforms[PlayerOptions::TRANSFORM_STOMP] ) - static int SetStomp( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_STOMP] = BArg(1); return 0; } - DEFINE_METHOD( GetPlanted, m_bTransforms[PlayerOptions::TRANSFORM_PLANTED] ) - static int SetPlanted( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_PLANTED] = BArg(1); return 0; } - DEFINE_METHOD( GetFloored, m_bTransforms[PlayerOptions::TRANSFORM_FLOORED] ) - static int SetFloored( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_FLOORED] = BArg(1); return 0; } - DEFINE_METHOD( GetTwister, m_bTransforms[PlayerOptions::TRANSFORM_TWISTER] ) - static int SetTwister( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_TWISTER] = BArg(1); return 0; } - DEFINE_METHOD( GetHoldRolls, m_bTransforms[PlayerOptions::TRANSFORM_HOLDROLLS] ) - static int SetHoldRolls( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_HOLDROLLS] = BArg(1); return 0; } - DEFINE_METHOD( GetNoJumps, m_bTransforms[PlayerOptions::TRANSFORM_NOJUMPS] ) - static int SetNoJumps( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_NOJUMPS] = BArg(1); return 0; } - DEFINE_METHOD( GetNoHands, m_bTransforms[PlayerOptions::TRANSFORM_NOHANDS] ) - static int SetNoHands( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_NOHANDS] = BArg(1); return 0; } - DEFINE_METHOD( GetNoLifts, m_bTransforms[PlayerOptions::TRANSFORM_NOLIFTS] ) - static int SetNoLifts( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_NOLIFTS] = BArg(1); return 0; } - DEFINE_METHOD( GetNoFakes, m_bTransforms[PlayerOptions::TRANSFORM_NOFAKES] ) - static int SetNoFakes( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_NOFAKES] = BArg(1); return 0; } - DEFINE_METHOD( GetNoQuads, m_bTransforms[PlayerOptions::TRANSFORM_NOQUADS] ) - static int SetNoQuads( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_NOQUADS] = BArg(1); return 0; } - DEFINE_METHOD( GetNoStretch, m_bTransforms[PlayerOptions::TRANSFORM_NOSTRETCH] ) - static int SetNoStretch( T *p, lua_State *L ){ p->m_bTransforms[PlayerOptions::TRANSFORM_NOSTRETCH] = BArg(1); return 0; } - - // Others - DEFINE_METHOD( GetDark, m_fDark ) - static int SetDark( T *p, lua_State *L ) { p->m_fDark = FArg(1); return 0; } - DEFINE_METHOD( GetBlind, m_fBlind ) - static int SetBlind( T *p, lua_State *L ) { p->m_fBlind = FArg(1); return 0; } - DEFINE_METHOD( GetCover, m_fCover ) - static int SetCover( T *p, lua_State *L ) { p->m_fCover = FArg(1); return 0; } - DEFINE_METHOD( GetRandomAttacks, m_fRandAttack ) - static int SetRandomAttacks( T *p, lua_State *L ) { p->m_fRandAttack = FArg(1); return 0; } - DEFINE_METHOD( GetMuteOnError, m_bMuteOnError) - static int SetMuteOnError( T *p, lua_State *L ) { p->m_bMuteOnError = BArg(1); return 0; } static int GetStepAttacks( T *p, lua_State *L ) { lua_pushnumber(L, - (p->m_fNoAttack > 0 || p->m_fRandAttack > 0 ? 0 : 1 )); + (p->m_fNoAttack > 0 || p->m_fRandAttack > 0 ? false : true )); return 1; } - // This one is deprecated. - static int GetSongAttacks( T *p, lua_State *L ) { return GetStepAttacks(p, L); } - - DEFINE_METHOD( GetNoAttacks, m_fNoAttack ) - DEFINE_METHOD( GetSkew, m_fSkew ) - static int SetSkew( T *p, lua_State *L ) { p->m_fSkew = FArg(1); return 0; } - DEFINE_METHOD( GetPassmark, m_fPassmark ) - static int SetPassmark( T *p, lua_State *L ) { - const float fPassmark = FArg(1); - if( !(fPassmark < 0.00f) && fPassmark <= 1.0f ) - p->m_fPassmark = fPassmark; - return 0; - } - DEFINE_METHOD( GetRandomSpeed, m_fRandomSpeed ) - static int SetRandomSpeed( T *p, lua_State *L ){ p->m_fRandomSpeed = FArg(1); return 0; } LunaPlayerOptions() { ADD_METHOD( IsEasierForSongAndSteps ); ADD_METHOD( IsEasierForCourseAndTrail ); - ADD_METHOD( GetDark ); - ADD_METHOD( SetDark ); - ADD_METHOD( GetBlind ); - ADD_METHOD( SetBlind ); - ADD_METHOD( GetCover ); - ADD_METHOD( SetCover ); - ADD_METHOD( GetMuteOnError ); - ADD_METHOD( SetMuteOnError ); - ADD_METHOD( GetNoteSkin ); - ADD_METHOD( SetNoteSkin ); - // GetPerspectiveTilt, SetPerspectiveTilt - ADD_METHOD( GetPassmark ); - ADD_METHOD( SetPassmark ); - ADD_METHOD( GetRandomAttacks ); - ADD_METHOD( SetRandomAttacks ); - ADD_METHOD( GetRandomSpeed ); - ADD_METHOD( SetRandomSpeed ); - ADD_METHOD( GetSkew ); - ADD_METHOD( SetSkew ); - ADD_METHOD( GetSongAttacks ); - ADD_METHOD( GetStepAttacks ); - ADD_METHOD( GetNoAttacks ); + ADD_METHOD(TimeSpacing); + ADD_METHOD(MaxScrollBPM); + ADD_METHOD(ScrollSpeed); + ADD_METHOD(ScrollBPM); + ADD_METHOD(Boost); + ADD_METHOD(Brake); + ADD_METHOD(Wave); + ADD_METHOD(Expand); + ADD_METHOD(Boomerang); + ADD_METHOD(Drunk); + ADD_METHOD(Dizzy); + ADD_METHOD(Confusion); + ADD_METHOD(Mini); + ADD_METHOD(Tiny); + ADD_METHOD(Flip); + ADD_METHOD(Invert); + ADD_METHOD(Tornado); + ADD_METHOD(Tipsy); + ADD_METHOD(Bumpy); + ADD_METHOD(Beat); + ADD_METHOD(Xmode); + ADD_METHOD(Twirl); + ADD_METHOD(Roll); + ADD_METHOD(Hidden); + ADD_METHOD(HiddenOffset); + ADD_METHOD(Sudden); + ADD_METHOD(SuddenOffset); + ADD_METHOD(Stealth); + ADD_METHOD(Blink); + ADD_METHOD(RandomVanish); + ADD_METHOD(Reverse); + ADD_METHOD(Split); + ADD_METHOD(Alternate); + ADD_METHOD(Cross); + ADD_METHOD(Centered); + ADD_METHOD(Dark); + ADD_METHOD(Blind); + ADD_METHOD(Cover); + ADD_METHOD(RandAttack); + ADD_METHOD(NoAttack); + ADD_METHOD(PlayerAutoPlay); + ADD_METHOD(Tilt); + ADD_METHOD(Skew); + ADD_METHOD(Passmark); + ADD_METHOD(RandomSpeed); + ADD_METHOD(TurnNone); + ADD_METHOD(Mirror); + ADD_METHOD(Backwards); + ADD_METHOD(Left); + ADD_METHOD(Right); + ADD_METHOD(Shuffle); + ADD_METHOD(SoftShuffle); + ADD_METHOD(SuperShuffle); + ADD_METHOD(NoHolds); + ADD_METHOD(NoRolls); + ADD_METHOD(NoMines); + ADD_METHOD(Little); + ADD_METHOD(Wide); + ADD_METHOD(Big); + ADD_METHOD(Quick); + ADD_METHOD(BMRize); + ADD_METHOD(Skippy); + ADD_METHOD(Mines); + ADD_METHOD(AttackMines); + ADD_METHOD(Echo); + ADD_METHOD(Stomp); + ADD_METHOD(Planted); + ADD_METHOD(Floored); + ADD_METHOD(Twister); + ADD_METHOD(HoldRolls); + ADD_METHOD(NoJumps); + ADD_METHOD(NoHands); + ADD_METHOD(NoLifts); + ADD_METHOD(NoFakes); + ADD_METHOD(NoQuads); + ADD_METHOD(NoStretch); + ADD_METHOD(MuteOnError); + + ADD_METHOD(NoteSkin); + ADD_METHOD(FailSetting); // Speed - ADD_METHOD( GetCMod ); - ADD_METHOD( SetCMod ); - ADD_METHOD( GetXMod ); - ADD_METHOD( SetXMod ); - ADD_METHOD( GetMMod ); - ADD_METHOD( SetMMod ); + ADD_METHOD( CMod ); + ADD_METHOD( XMod ); + ADD_METHOD( MMod ); - // Accel - ADD_METHOD( GetBoost ); - ADD_METHOD( SetBoost ); - ADD_METHOD( GetBrake ); - ADD_METHOD( SetBrake ); - ADD_METHOD( GetWave ); - ADD_METHOD( SetWave ); - ADD_METHOD( GetExpand ); - ADD_METHOD( SetExpand ); - ADD_METHOD( GetBoomerang ); - ADD_METHOD( SetBoomerang ); + ADD_METHOD(Overhead); + ADD_METHOD(Incoming); + ADD_METHOD(Space); + ADD_METHOD(Hallway); + ADD_METHOD(Distant); - // Effect - ADD_METHOD( GetDrunk ); - ADD_METHOD( SetDrunk ); - ADD_METHOD( GetDizzy ); - ADD_METHOD( SetDizzy ); - ADD_METHOD( GetConfusion ); - ADD_METHOD( SetConfusion ); - ADD_METHOD( GetMini ); - ADD_METHOD( SetMini ); - ADD_METHOD( GetTiny ); - ADD_METHOD( SetTiny ); - ADD_METHOD( GetFlip ); - ADD_METHOD( SetFlip ); - ADD_METHOD( GetInvert ); - ADD_METHOD( SetInvert ); - ADD_METHOD( GetTornado ); - ADD_METHOD( SetTornado ); - ADD_METHOD( GetTipsy ); - ADD_METHOD( SetTipsy ); - ADD_METHOD( GetBumpy ); - ADD_METHOD( SetBumpy ); - ADD_METHOD( GetBeat ); - ADD_METHOD( SetBeat ); - ADD_METHOD( GetXMode ); - ADD_METHOD( SetXMode ); - ADD_METHOD( GetTwirl ); - ADD_METHOD( SetTwirl ); - ADD_METHOD( GetRoll ); - ADD_METHOD( SetRoll ); - - // Appearance - ADD_METHOD( GetHidden ); - ADD_METHOD( SetHidden ); - ADD_METHOD( GetHiddenOffset ); - ADD_METHOD( SetHiddenOffset ); - ADD_METHOD( GetSudden ); - ADD_METHOD( SetSudden ); - ADD_METHOD( GetSuddenOffset ); - ADD_METHOD( SetSuddenOffset ); - ADD_METHOD( GetStealth ); - ADD_METHOD( SetStealth ); - ADD_METHOD( GetBlink ); - ADD_METHOD( SetBlink ); - ADD_METHOD( GetRandomVanish ); - ADD_METHOD( SetRandomVanish ); - - // Scroll - ADD_METHOD( GetReverse ); - ADD_METHOD( SetReverse ); ADD_METHOD( UsingReverse ); ADD_METHOD( GetReversePercentForColumn ); - ADD_METHOD( GetSplit ); - ADD_METHOD( SetSplit ); - ADD_METHOD( GetAlternate ); - ADD_METHOD( SetAlternate ); - ADD_METHOD( GetCross ); - ADD_METHOD( SetCross ); - ADD_METHOD( GetCentered ); - ADD_METHOD( SetCentered ); - - // Turns - ADD_METHOD( GetMirror ); - ADD_METHOD( SetMirror ); - ADD_METHOD( GetBackwards ); - ADD_METHOD( SetBackwards ); - ADD_METHOD( GetLeft ); - ADD_METHOD( SetLeft ); - ADD_METHOD( GetRight ); - ADD_METHOD( SetRight ); - ADD_METHOD( GetShuffle ); - ADD_METHOD( SetShuffle ); - ADD_METHOD( GetSoftShuffle ); - ADD_METHOD( SetSoftShuffle ); - ADD_METHOD( GetSuperShuffle ); - ADD_METHOD( SetSuperShuffle ); - - // Transform - ADD_METHOD( GetNoHolds ); - ADD_METHOD( SetNoHolds ); - ADD_METHOD( GetNoRolls ); - ADD_METHOD( SetNoRolls ); - ADD_METHOD( GetNoMines ); - ADD_METHOD( SetNoMines ); - ADD_METHOD( GetLittle ); - ADD_METHOD( SetLittle ); - ADD_METHOD( GetWide ); - ADD_METHOD( SetWide ); - ADD_METHOD( GetBig ); - ADD_METHOD( SetBig ); - ADD_METHOD( GetQuick ); - ADD_METHOD( SetQuick ); - ADD_METHOD( GetBMRize ); - ADD_METHOD( SetBMRize ); - ADD_METHOD( GetSkippy ); - ADD_METHOD( SetSkippy ); - ADD_METHOD( GetMines ); - ADD_METHOD( SetMines ); - ADD_METHOD( GetAttackMines ); - ADD_METHOD( SetAttackMines ); - ADD_METHOD( GetEcho ); - ADD_METHOD( SetEcho ); - ADD_METHOD( GetStomp ); - ADD_METHOD( SetStomp ); - ADD_METHOD( GetPlanted ); - ADD_METHOD( SetPlanted ); - ADD_METHOD( GetFloored ); - ADD_METHOD( SetFloored ); - ADD_METHOD( GetTwister ); - ADD_METHOD( SetTwister ); - ADD_METHOD( GetHoldRolls ); - ADD_METHOD( SetHoldRolls ); - ADD_METHOD( GetNoJumps ); - ADD_METHOD( SetNoJumps ); - ADD_METHOD( GetNoHands ); - ADD_METHOD( SetNoHands ); - ADD_METHOD( GetNoLifts ); - ADD_METHOD( SetNoLifts ); - ADD_METHOD( GetNoFakes ); - ADD_METHOD( SetNoFakes ); - ADD_METHOD( GetNoQuads ); - ADD_METHOD( SetNoQuads ); - ADD_METHOD( GetNoStretch ); - ADD_METHOD( SetNoStretch ); + ADD_METHOD( GetStepAttacks ); } }; diff --git a/src/PlayerOptions.h b/src/PlayerOptions.h index ac32f86ee5..f923531880 100644 --- a/src/PlayerOptions.h +++ b/src/PlayerOptions.h @@ -30,12 +30,11 @@ public: m_fRandAttack(0), m_SpeedfRandAttack(1.0f), m_fNoAttack(0), m_SpeedfNoAttack(1.0f), m_fPlayerAutoPlay(0), m_SpeedfPlayerAutoPlay(1.0f), - m_bSetTiltOrSkew(false), m_fPerspectiveTilt(0), m_SpeedfPerspectiveTilt(1.0f), m_fSkew(0), m_SpeedfSkew(1.0f), m_fPassmark(0), m_SpeedfPassmark(1.0f), m_fRandomSpeed(0), m_SpeedfRandomSpeed(1.0f), - m_bMuteOnError(false), m_FailType(FAIL_IMMEDIATE) + m_bMuteOnError(false), m_FailType(FailType_Immediate) { m_sNoteSkin = ""; ZERO( m_fAccels ); ONE( m_SpeedfAccels ); @@ -172,7 +171,6 @@ public: float m_fRandAttack, m_SpeedfRandAttack; float m_fNoAttack, m_SpeedfNoAttack; float m_fPlayerAutoPlay, m_SpeedfPlayerAutoPlay; - bool m_bSetTiltOrSkew; // true if the tilt or skew was set by FromString float m_fPerspectiveTilt, m_SpeedfPerspectiveTilt; // -1 = near, 0 = overhead, +1 = space float m_fSkew, m_SpeedfSkew; // 0 = vanish point is in center of player, 1 = vanish point is in center of screen @@ -185,13 +183,6 @@ public: bool m_bTurns[NUM_TURNS]; bool m_bTransforms[NUM_TRANSFORMS]; bool m_bMuteOnError; - /** @brief How can the Player fail a song? */ - enum FailType { - FAIL_IMMEDIATE=0, /**< fail immediately when life touches 0 */ - FAIL_IMMEDIATE_CONTINUE, /**< Same as above, but allow playing the rest of the song */ - FAIL_AT_END, /**< fail if life is at 0 when the song ends */ - FAIL_OFF /**< never fail */ - }; /** @brief The method for which a player can fail a song. */ FailType m_FailType; diff --git a/src/PlayerState.cpp b/src/PlayerState.cpp index f8abd89f6c..19be5e40ec 100644 --- a/src/PlayerState.cpp +++ b/src/PlayerState.cpp @@ -232,8 +232,7 @@ public: static int GetPlayerOptions( T* p, lua_State *L ) { ModsLevel m = Enum::Check( L, 1 ); - PlayerOptions po = p->m_PlayerOptions.Get(m); - po.PushSelf(L); + p->m_PlayerOptions.Get(m).PushSelf(L); return 1; } static int GetPlayerOptionsArray( T* p, lua_State *L ) diff --git a/src/PrefsManager.cpp b/src/PrefsManager.cpp index 7f4340f379..2521b50054 100644 --- a/src/PrefsManager.cpp +++ b/src/PrefsManager.cpp @@ -125,17 +125,6 @@ XToString( CourseSortOrders ); StringToX( CourseSortOrders ); LuaXType( CourseSortOrders ); -// XXX: Fix fail bug? -/* static const char *DefaultFailTypeNames[] = { - "Immediate", - "ImmediateContinue", - "EndOfSong", - "Off", -}; -XToString( DefaultFailType ); -StringToX( DefaultFailType ); -LuaXType( DefaultFailType ); */ - bool g_bAutoRestart = false; #ifdef DEBUG # define TRUE_IF_DEBUG true diff --git a/src/PrefsManager.h b/src/PrefsManager.h index 95f684f1a6..6ce1acfd68 100644 --- a/src/PrefsManager.h +++ b/src/PrefsManager.h @@ -112,16 +112,6 @@ enum CourseSortOrders CourseSortOrders_Invalid }; -enum DefaultFailType -{ - FAIL_IMMEDIATE, - FAIL_IMMEDIATECONTINUE, - FAIL_ENDOFSONG, - FAIL_OFF, - NUM_DefaultFailType, - DefaultFailType_Invalid -}; - /** @brief Holds user-chosen preferences that are saved between sessions. */ class PrefsManager { diff --git a/src/ScreenEvaluation.cpp b/src/ScreenEvaluation.cpp index ed6688c541..aae94c0baf 100644 --- a/src/ScreenEvaluation.cpp +++ b/src/ScreenEvaluation.cpp @@ -297,7 +297,7 @@ void ScreenEvaluation::Init() vector v; PlayerOptions po = GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.GetPreferred(); if( PLAYER_OPTIONS_HIDE_FAIL_TYPE ) - po.m_FailType = (PlayerOptions::FailType)0; // blank out the fail type so that it won't show in the mods list + po.m_FailType = (FailType)0; // blank out the fail type so that it won't show in the mods list po.GetLocalizedMods( v ); RString sPO = join( PLAYER_OPTIONS_SEPARATOR, v ); m_textPlayerOptions[p].SetText( sPO ); diff --git a/src/ScreenGameplay.cpp b/src/ScreenGameplay.cpp index b7dde41bce..efae737af1 100644 --- a/src/ScreenGameplay.cpp +++ b/src/ScreenGameplay.cpp @@ -1085,7 +1085,7 @@ void ScreenGameplay::LoadNextSong() if( GAMESTATE->m_SongOptions.GetCurrent().m_LifeType == SongOptions::LIFE_BATTERY ) { FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi ) - PO_GROUP_ASSIGN( pi->GetPlayerState()->m_PlayerOptions, ModsLevel_Song, m_FailType, PlayerOptions::FAIL_IMMEDIATE ); + PO_GROUP_ASSIGN( pi->GetPlayerState()->m_PlayerOptions, ModsLevel_Song, m_FailType, FailType_Immediate ); } m_textSongOptions.SetText( GAMESTATE->m_SongOptions.GetCurrent().GetString() ); @@ -1579,7 +1579,7 @@ void ScreenGameplay::Update( float fDeltaTime ) { HealthState &hs = pi->GetPlayerState()->m_HealthState; HealthState OldHealthState = hs; - if( GAMESTATE->GetPlayerFailType(pi->GetPlayerState()) != PlayerOptions::FAIL_OFF && + if( GAMESTATE->GetPlayerFailType(pi->GetPlayerState()) != FailType_Off && pi->m_pLifeMeter && pi->m_pLifeMeter->IsFailing() ) { hs = HealthState_Dead; @@ -1588,7 +1588,7 @@ void ScreenGameplay::Update( float fDeltaTime ) { hs = HealthState_Hot; } - else if( GAMESTATE->GetPlayerFailType(pi->GetPlayerState()) != PlayerOptions::FAIL_OFF && + else if( GAMESTATE->GetPlayerFailType(pi->GetPlayerState()) != FailType_Off && pi->m_pLifeMeter && pi->m_pLifeMeter->IsInDanger() ) { hs = HealthState_Danger; @@ -1633,10 +1633,10 @@ void ScreenGameplay::Update( float fDeltaTime ) { PlayerNumber pn = pi->GetStepsAndTrailIndex(); - PlayerOptions::FailType ft = GAMESTATE->GetPlayerFailType( pi->GetPlayerState() ); + FailType ft = GAMESTATE->GetPlayerFailType( pi->GetPlayerState() ); SongOptions::LifeType lt = GAMESTATE->m_SongOptions.GetCurrent().m_LifeType; - if( ft == PlayerOptions::FAIL_OFF || ft == PlayerOptions::FAIL_AT_END ) + if( ft == FailType_Off || ft == FailType_EndOfSong ) continue; // check for individual fail @@ -1663,7 +1663,7 @@ void ScreenGameplay::Update( float fDeltaTime ) default: break; } - if( bAllowOniDie && ft == PlayerOptions::FAIL_IMMEDIATE ) + if( bAllowOniDie && ft == FailType_Immediate ) { if( !STATSMAN->m_CurStageStats.AllFailed() ) // if not the last one to fail { @@ -1681,18 +1681,18 @@ void ScreenGameplay::Update( float fDeltaTime ) bool bAllFailed = true; FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi ) { - PlayerOptions::FailType ft = GAMESTATE->GetPlayerFailType( pi->GetPlayerState() ); + FailType ft = GAMESTATE->GetPlayerFailType( pi->GetPlayerState() ); switch( ft ) { - case PlayerOptions::FAIL_IMMEDIATE: + case FailType_Immediate: if( pi->m_pLifeMeter == NULL || (pi->m_pLifeMeter && !pi->m_pLifeMeter->IsFailing()) ) bAllFailed = false; break; - case PlayerOptions::FAIL_IMMEDIATE_CONTINUE: - case PlayerOptions::FAIL_AT_END: + case FailType_ImmediateContinue: + case FailType_EndOfSong: bAllFailed = false; // wait until the end of the song to fail. break; - case PlayerOptions::FAIL_OFF: + case FailType_Off: bAllFailed = false; // never fail. break; default: @@ -1812,7 +1812,7 @@ void ScreenGameplay::Update( float fDeltaTime ) bool bAllHumanHaveBigMissCombo = true; FOREACH_EnabledPlayerNumberInfo( m_vPlayerInfo, pi ) { - if (pi->GetPlayerState()->m_PlayerOptions.GetCurrent().m_FailType == PlayerOptions::FAIL_OFF || + if (pi->GetPlayerState()->m_PlayerOptions.GetCurrent().m_FailType == FailType_Off || pi->GetPlayerState()->m_HealthState < HealthState_Dead ) { bAllHumanHaveBigMissCombo = false; @@ -2434,7 +2434,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi ) { // Mark failure. - if( GAMESTATE->GetPlayerFailType(pi->GetPlayerState()) != PlayerOptions::FAIL_OFF && + if( GAMESTATE->GetPlayerFailType(pi->GetPlayerState()) != FailType_Off && (pi->m_pLifeMeter && pi->m_pLifeMeter->IsFailing()) ) pi->GetPlayerStageStats()->m_bFailed = true; diff --git a/src/ScreenJukebox.cpp b/src/ScreenJukebox.cpp index f07e30c26f..6176a50ebe 100644 --- a/src/ScreenJukebox.cpp +++ b/src/ScreenJukebox.cpp @@ -221,7 +221,7 @@ void ScreenJukebox::Init() GAMESTATE->m_SongOptions.Assign( ModsLevel_Stage, so ); FOREACH_EnabledPlayer( p ) - PO_GROUP_ASSIGN( GAMESTATE->m_pPlayerState[p]->m_PlayerOptions, ModsLevel_Stage, m_FailType, PlayerOptions::FAIL_OFF ); + PO_GROUP_ASSIGN( GAMESTATE->m_pPlayerState[p]->m_PlayerOptions, ModsLevel_Stage, m_FailType, FailType_Off ); GAMESTATE->m_bDemonstrationOrJukebox = true; diff --git a/src/ScreenOptionsMasterPrefs.cpp b/src/ScreenOptionsMasterPrefs.cpp index d4fb9bf5e6..e8c36de2d4 100644 --- a/src/ScreenOptionsMasterPrefs.cpp +++ b/src/ScreenOptionsMasterPrefs.cpp @@ -500,14 +500,14 @@ static void DefaultFailType( int &sel, bool ToSel, const ConfOption *pConfOption switch( sel ) { - case 0: po.m_FailType = PlayerOptions::FAIL_IMMEDIATE; break; - case 1: po.m_FailType = PlayerOptions::FAIL_IMMEDIATE_CONTINUE; break; - case 2: po.m_FailType = PlayerOptions::FAIL_AT_END; break; - case 3: po.m_FailType = PlayerOptions::FAIL_OFF; break; + case 0: po.m_FailType = FailType_Immediate; break; + case 1: po.m_FailType = FailType_ImmediateContinue; break; + case 2: po.m_FailType = FailType_EndOfSong; break; + case 3: po.m_FailType = FailType_Off; break; default: { LOG->Warn("Invalid fail type %d! Going to use the default...", sel); - po.m_FailType = PlayerOptions::FAIL_IMMEDIATE; break; + po.m_FailType = FailType_Immediate; break; } } diff --git a/src/ScreenSongOptions.cpp b/src/ScreenSongOptions.cpp index 2b9287c232..c9ca58732e 100644 --- a/src/ScreenSongOptions.cpp +++ b/src/ScreenSongOptions.cpp @@ -25,7 +25,7 @@ void ScreenSongOptions::ExportOptions( int iRow, const vector &vpn { PlayerNumber pn = GAMESTATE->GetMasterPlayerNumber(); PlayerState *pPS = GAMESTATE->m_pPlayerState[pn]; - const PlayerOptions::FailType ft = pPS->m_PlayerOptions.GetPreferred().m_FailType; + const FailType ft = pPS->m_PlayerOptions.GetPreferred().m_FailType; ScreenOptionsMaster::ExportOptions( iRow, vpns );