diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index 6dc057dfb3..e9ccf1cc69 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -8,6 +8,17 @@ ________________________________________________________________________________ StepMania 5.0 Preview 2 | 20110??? -------------------------------------------------------------------------------- +2011/06/06 +---------- +* [PlayerOptions] Removed the ScoreDisplay mod choices. Use lua to make your + own scoring formulas that work in reverse instead. [Wolfman2000] +* [ScreenGameplay] Fix an assist tick bug if there was no Player 1. Note that + this changes the behavior slightly: it is the first enabled player, or + master player, that gets the ticks now. A better solution will be looked at + in the future. [Wolfman2000] +* [NoteDataUtil] Fix a radar issue involving hands. Unfortunately, this means + yet another cache reload for accuracy purposes. [Wolfman2000] + 2011/06/04 ---------- * Changed default MusicWheelSwitchSpeed to 15 (was 10). [AJ] diff --git a/Themes/_fallback/Scripts/02 Branches.lua b/Themes/_fallback/Scripts/02 Branches.lua index f10f448946..f4b1a09950 100644 --- a/Themes/_fallback/Scripts/02 Branches.lua +++ b/Themes/_fallback/Scripts/02 Branches.lua @@ -33,11 +33,7 @@ end Branch = { Init = function() - if GAMESTATE:GetCoinMode() == 'CoinMode_Home' then - return "ScreenInit" - else - return "ScreenInit" - end + return "ScreenInit" end, AfterInit = function() if GAMESTATE:GetCoinMode() == 'CoinMode_Home' then diff --git a/Themes/_fallback/Scripts/03 ProductivityHelpers.lua b/Themes/_fallback/Scripts/03 ProductivityHelpers.lua index eb2d64bb9d..0d9fbd2816 100644 --- a/Themes/_fallback/Scripts/03 ProductivityHelpers.lua +++ b/Themes/_fallback/Scripts/03 ProductivityHelpers.lua @@ -224,10 +224,10 @@ end; --[[ ----------------------------------------------------------------------- ]] --[[ profile stuff ]] --- Profile(pn) +-- GetPlayerOrMachineProfile(pn) -- This returns a profile, preferably a player one. -- If there isn't one, we fall back on the machine profile. -function Profile(pn) +function GetPlayerOrMachineProfile(pn) if PROFILEMAN:IsPersistentProfile(pn) then -- player profile return PROFILEMAN:GetProfile(pn); diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 195bd35e1f..18712e9a16 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -2510,8 +2510,8 @@ CursorOnCommand=visible,false Class="ScreenOptionsMaster" Fallback="ScreenOptionsSimpleService" # -NextScreen=Branch.Init() -PrevScreen=Branch.Init() +NextScreen=Branch.AfterInit() +PrevScreen=Branch.AfterInit() LineNames="SystemDirection,KeyConfig,GameType,6,8,Reload,Credits,MoreOptions" # LineNames="SystemDirection,1,2,Sync,13,3,10,11,4,12,6,5,Theme,8,9" @@ -2884,7 +2884,6 @@ Line11="list,Attacks" Line12="list,PlayerAutoPlay" Line13="list,Hide" Line14="list,Persp" -Line15="list,ScoreDisplay" Line16="list,Steps" Line17="list,Characters" diff --git a/Themes/default/Graphics/LifeMeterBattery lives 1x4.png b/Themes/default/Graphics/LifeMeterBattery lives 1x4.png index 87a32d19d2..1267376f69 100644 Binary files a/Themes/default/Graphics/LifeMeterBattery lives 1x4.png and b/Themes/default/Graphics/LifeMeterBattery lives 1x4.png differ diff --git a/Themes/default/Graphics/ScreenTitleMenu logo/_multi.png b/Themes/default/Graphics/ScreenTitleMenu logo/_multi.png deleted file mode 100644 index 35a26da8e2..0000000000 Binary files a/Themes/default/Graphics/ScreenTitleMenu logo/_multi.png and /dev/null differ diff --git a/Themes/default/Graphics/ScreenTitleMenu logo/_text.png b/Themes/default/Graphics/ScreenTitleMenu logo/_text.png deleted file mode 100644 index e5af33ba36..0000000000 Binary files a/Themes/default/Graphics/ScreenTitleMenu logo/_text.png and /dev/null differ diff --git a/Themes/default/Graphics/ScreenTitleMenu logo/default.lua b/Themes/default/Graphics/ScreenTitleMenu logo/default.lua index c44247f181..d15b1bc77c 100644 --- a/Themes/default/Graphics/ScreenTitleMenu logo/default.lua +++ b/Themes/default/Graphics/ScreenTitleMenu logo/default.lua @@ -3,21 +3,6 @@ -- this file are in metrics.ini ([ScreenTitleMenu] ShowLogo, etc.) local t = Def.ActorFrame{ -- [BGAnimation] LoadActor("_logo"); -- [Layer1] Type=0 File=_ball.png - LoadActor("_logo")..{ -- [Layer2] Type=0 File=_ball.png - }; - --[[LoadActor("_text")..{ -- [Layer3] Type=0 File=_text.png - InitCommand=cmd(y,48;hide_if,GAMESTATE:GetMultiplayer()); -- Command=y,48 - }; - LoadActor("_multi")..{ -- [Layer4] Type=0 File=_multi.png - InitCommand=cmd(y,60;hide_if,not GAMESTATE:GetMultiplayer()); -- Command=y,48 - -- the hide_if command would be similar to Condition=, which also exists. - -- Condition=GAMESTATE:GetMultiplayer(); is the equivalent code. - };]] - LoadFont("Common normal")..{ - Text="sm-ssc Multiplayer"; - InitCommand=cmd(y,5;shadowlength,0;strokecolor,color("0,0,0,0.375");diffusebottomedge,color("#D6DBDD");); - BeginCommand=cmd(hide_if,not GAMESTATE:GetMultiplayer()); - }; }; return t; diff --git a/Themes/default/Graphics/_StepsType/Dance_Double.png b/Themes/default/Graphics/_StepsType/Dance_Double.png index 06440ad36d..8eb15da47d 100644 Binary files a/Themes/default/Graphics/_StepsType/Dance_Double.png and b/Themes/default/Graphics/_StepsType/Dance_Double.png differ diff --git a/Themes/default/Graphics/_StepsType/Pump_Double.png b/Themes/default/Graphics/_StepsType/Pump_Double.png index 4d60abdb89..50113c23ea 100644 Binary files a/Themes/default/Graphics/_StepsType/Pump_Double.png and b/Themes/default/Graphics/_StepsType/Pump_Double.png differ diff --git a/Themes/default/Graphics/_StepsType/Techno_Double4.png b/Themes/default/Graphics/_StepsType/Techno_Double4.png index 02cf899f8f..3d76ce3074 100644 Binary files a/Themes/default/Graphics/_StepsType/Techno_Double4.png and b/Themes/default/Graphics/_StepsType/Techno_Double4.png differ diff --git a/Themes/default/Graphics/_StepsType/Techno_Double5.png b/Themes/default/Graphics/_StepsType/Techno_Double5.png index 55ecd8434c..0b6732ba1a 100644 Binary files a/Themes/default/Graphics/_StepsType/Techno_Double5.png and b/Themes/default/Graphics/_StepsType/Techno_Double5.png differ diff --git a/Themes/default/metrics.ini b/Themes/default/metrics.ini index 65558ea9ca..85ecd68ca8 100644 --- a/Themes/default/metrics.ini +++ b/Themes/default/metrics.ini @@ -1216,7 +1216,7 @@ ItemsLongRowSharedX=SCREEN_CENTER_X [ScreenTestInput] [ScreenOptionsSystemDirection] -LineNames="1,2,3,4,5,6,7,8,9,FlashyCombo,RollCombo,10,11,12,13,14,15,16,LF,17,18,19,20,21,22" +LineNames="1,2,3,4,5,6,7,8,9,FlashyCombo,RollCombo,10,11,12,13,14,16,LF,17,18,19,20,21,22" LineLF="lua,UserPrefLongFail()" LineRollCombo="lua,UserPrefComboOnRolls()" LineFlashyCombo="lua,UserPrefFlashyCombo()" @@ -1224,7 +1224,7 @@ LineFlashyCombo="lua,UserPrefFlashyCombo()" [ScreenOptionsGraphicsSound] [ScreenOptionsAdvanced] -LineNames="Score,3,4,8,11,13,14,15,16,28,29,30,RollCombo" +LineNames="Score,3,4,8,11,13,14,16,28,29,30,RollCombo" LineRollCombo="lua,UserPrefComboOnRolls()" [ScreenAppearanceOptions] diff --git a/src/AutoKeysounds.cpp b/src/AutoKeysounds.cpp index 79ec773973..068036bd69 100644 --- a/src/AutoKeysounds.cpp +++ b/src/AutoKeysounds.cpp @@ -49,7 +49,7 @@ void AutoKeysounds::LoadAutoplaySoundsInto( RageSoundReader_Chain *pChain ) * Add all current autoplay sounds in both players to the chain. If a sound is * common to both players, don't pan it; otherwise pan it to that player's side. */ - int iNumTracks = m_ndAutoKeysoundsOnly[GAMESTATE->m_MasterPlayerNumber].GetNumTracks(); + int iNumTracks = m_ndAutoKeysoundsOnly[GAMESTATE->GetMasterPlayerNumber()].GetNumTracks(); for( int t = 0; t < iNumTracks; t++ ) { int iRow = -1; @@ -297,7 +297,7 @@ void AutoKeysounds::FinishLoading() apSounds.push_back( m_pPlayerSounds[1] ); } - if( GAMESTATE->GetNumPlayersEnabled() == 1 && GAMESTATE->m_MasterPlayerNumber == PLAYER_2 ) + if( GAMESTATE->GetNumPlayersEnabled() == 1 && GAMESTATE->GetMasterPlayerNumber() == PLAYER_2 ) swap( m_pPlayerSounds[PLAYER_1], m_pPlayerSounds[PLAYER_2] ); if( apSounds.size() > 1 ) diff --git a/src/CourseContentsList.cpp b/src/CourseContentsList.cpp index ee4b99cb2f..2566465c15 100644 --- a/src/CourseContentsList.cpp +++ b/src/CourseContentsList.cpp @@ -42,9 +42,9 @@ void CourseContentsList::SetFromGameState() { RemoveAllChildren(); - if( GAMESTATE->m_MasterPlayerNumber == PlayerNumber_Invalid ) + if( GAMESTATE->GetMasterPlayerNumber() == PlayerNumber_Invalid ) return; - const Trail *pMasterTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber]; + const Trail *pMasterTrail = GAMESTATE->m_pCurTrail[GAMESTATE->GetMasterPlayerNumber()]; if( pMasterTrail == NULL ) return; unsigned uNumEntriesToShow = pMasterTrail->m_vEntries.size(); diff --git a/src/GameState.cpp b/src/GameState.cpp index dbca4fc9a3..a720dcbd89 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -190,6 +190,16 @@ GameState::~GameState() SAFE_DELETE( g_pImpl ); } +PlayerNumber GameState::GetMasterPlayerNumber() const +{ + return this->masterPlayerNumber; +} + +void GameState::SetMasterPlayerNumber(const PlayerNumber p) +{ + this->masterPlayerNumber = p; +} + void GameState::ApplyGameCommand( const RString &sCommand, PlayerNumber pn ) { GameCommand m; @@ -244,7 +254,7 @@ void GameState::ResetPlayer( PlayerNumber pn ) void GameState::Reset() { - m_MasterPlayerNumber = PLAYER_INVALID; // must initialize for UnjoinPlayer + this->SetMasterPlayerNumber(PLAYER_INVALID); // must initialize for UnjoinPlayer FOREACH_PlayerNumber( pn ) UnjoinPlayer( pn ); @@ -334,14 +344,14 @@ void GameState::JoinPlayer( PlayerNumber pn ) * give the new player the same number of stage tokens that the old player * has. */ if( GetCoinMode() == CoinMode_Pay && GetPremium() == Premium_2PlayersFor1Credit && GetNumSidesJoined() == 1 ) - m_iPlayerStageTokens[pn] = m_iPlayerStageTokens[m_MasterPlayerNumber]; + m_iPlayerStageTokens[pn] = m_iPlayerStageTokens[this->GetMasterPlayerNumber()]; else m_iPlayerStageTokens[pn] = PREFSMAN->m_iSongsPerPlay; m_bSideIsJoined[pn] = true; - if( m_MasterPlayerNumber == PLAYER_INVALID ) - m_MasterPlayerNumber = pn; + if( this->GetMasterPlayerNumber() == PLAYER_INVALID ) + this->SetMasterPlayerNumber(pn); // if first player to join, set start time if( GetNumSidesJoined() == 1 ) @@ -385,8 +395,8 @@ void GameState::UnjoinPlayer( PlayerNumber pn ) ResetPlayer( pn ); - if( m_MasterPlayerNumber == pn ) - m_MasterPlayerNumber = GetFirstHumanPlayer(); + if( this->GetMasterPlayerNumber() == pn ) + this->SetMasterPlayerNumber(GetFirstHumanPlayer()); /* Unjoin STATSMAN first, so steps used by this player are released * and can be released by PROFILEMAN. */ @@ -398,7 +408,7 @@ void GameState::UnjoinPlayer( PlayerNumber pn ) MESSAGEMAN->Broadcast( msg ); // If there are no players left, reset some non-player-specific stuff, too. - if( m_MasterPlayerNumber == PLAYER_INVALID ) + if( this->GetMasterPlayerNumber() == PLAYER_INVALID ) { SongOptions so; GetDefaultSongOptions( so ); @@ -635,8 +645,8 @@ int GameState::GetNumStagesForCurrentSongAndStepsOrCourse() const if( pStyle == NULL ) { const Steps *pSteps = NULL; - if( m_MasterPlayerNumber != PlayerNumber_Invalid ) - pSteps = m_pCurSteps[m_MasterPlayerNumber]; + if( this->GetMasterPlayerNumber() != PlayerNumber_Invalid ) + pSteps = m_pCurSteps[this->GetMasterPlayerNumber()]; // Don't call GetFirstCompatibleStyle if numSidesJoined == 0. // This happens because on SContinue when players are unjoined, // pCurSteps will still be set while no players are joined. -Chris @@ -994,9 +1004,9 @@ bool GameState::IsFinalStageForAnyHumanPlayer() const bool GameState::IsAnExtraStage() const { - if( m_MasterPlayerNumber == PlayerNumber_Invalid ) + if( this->GetMasterPlayerNumber() == PlayerNumber_Invalid ) return false; - return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[m_MasterPlayerNumber] > 0; + return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[this->GetMasterPlayerNumber()] > 0; } static ThemeMetric LOCK_EXTRA_STAGE_SELECTION("GameState","LockExtraStageSelection"); @@ -1007,16 +1017,16 @@ bool GameState::IsAnExtraStageAndSelectionLocked() const bool GameState::IsExtraStage() const { - if( m_MasterPlayerNumber == PlayerNumber_Invalid ) + if( this->GetMasterPlayerNumber() == PlayerNumber_Invalid ) return false; - return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[m_MasterPlayerNumber] == 1; + return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[this->GetMasterPlayerNumber()] == 1; } bool GameState::IsExtraStage2() const { - if( m_MasterPlayerNumber == PlayerNumber_Invalid ) + if( this->GetMasterPlayerNumber() == PlayerNumber_Invalid ) return false; - return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[m_MasterPlayerNumber] == 2; + return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[this->GetMasterPlayerNumber()] == 2; } Stage GameState::GetCurrentStage() const @@ -1059,7 +1069,7 @@ int GameState::GetCourseSongIndex() const } else { - return STATSMAN->m_CurStageStats.m_player[m_MasterPlayerNumber].m_iSongsPlayed-1; + return STATSMAN->m_CurStageStats.m_player[this->GetMasterPlayerNumber()].m_iSongsPlayed-1; } } @@ -1131,7 +1141,7 @@ void GameState::SetCurrentStyle( const Style *pStyle ) if( INPUTMAPPER ) { if( GetCurrentStyle() && GetCurrentStyle()->m_StyleType == StyleType_OnePlayerTwoSides ) - INPUTMAPPER->SetJoinControllers( m_MasterPlayerNumber ); + INPUTMAPPER->SetJoinControllers( this->GetMasterPlayerNumber() ); else INPUTMAPPER->SetJoinControllers( PLAYER_INVALID ); } @@ -1192,7 +1202,7 @@ bool GameState::IsHumanPlayer( PlayerNumber pn ) const return true; case StyleType_OnePlayerOneSide: case StyleType_OnePlayerTwoSides: - return pn == m_MasterPlayerNumber; + return pn == this->GetMasterPlayerNumber(); default: ASSERT(0); // invalid style type return false; @@ -1276,7 +1286,7 @@ EarnedExtraStage GameState::CalculateEarnedExtraStage() const if( GetSmallestNumStagesLeftForAnyHumanPlayer() > 0 ) return EarnedExtraStage_No; - if( m_iAwardedExtraStages[m_MasterPlayerNumber] >= 2 ) + if( m_iAwardedExtraStages[this->GetMasterPlayerNumber()] >= 2 ) return EarnedExtraStage_No; FOREACH_EnabledPlayer( pn ) @@ -2124,7 +2134,7 @@ public: DEFINE_METHOD( IsPlayerEnabled, IsPlayerEnabled(Enum::Check(L, 1)) ) DEFINE_METHOD( IsHumanPlayer, IsHumanPlayer(Enum::Check(L, 1)) ) DEFINE_METHOD( GetPlayerDisplayName, GetPlayerDisplayName(Enum::Check(L, 1)) ) - DEFINE_METHOD( GetMasterPlayerNumber, m_MasterPlayerNumber ) + DEFINE_METHOD( GetMasterPlayerNumber, GetMasterPlayerNumber() ) DEFINE_METHOD( GetMultiplayer, m_bMultiplayer ) static int SetMultiplayer( T* p, lua_State *L ) { diff --git a/src/GameState.h b/src/GameState.h index 5e925e05ff..79618aa711 100644 --- a/src/GameState.h +++ b/src/GameState.h @@ -35,6 +35,8 @@ class Trail; /** @brief Holds game data that is not saved between sessions. */ class GameState { + /** @brief The player number used with Styles where one player controls both sides. */ + PlayerNumber masterPlayerNumber; public: /** @brief Set up the GameState with initial values. */ GameState(); @@ -91,8 +93,6 @@ public: * to get one credit, only to have to put in another four coins to get * the three credits needed to begin the game. */ BroadcastOnChange m_iCoins; - /** @brief The player number used with Styles where one player controls both sides. */ - PlayerNumber m_MasterPlayerNumber; bool m_bMultiplayer; int m_iNumMultiplayerNoteFields; bool DifficultiesLocked() const; @@ -139,6 +139,16 @@ public: PlayerNumber GetFirstDisabledPlayer() const; bool IsCpuPlayer( PlayerNumber pn ) const; bool AnyPlayersAreCpu() const; + + /** + * @brief Retrieve the present master player number. + * @return The master player number. */ + PlayerNumber GetMasterPlayerNumber() const; + + /** + * @brief Set the master player number. + * @param p the master player number. */ + void SetMasterPlayerNumber(const PlayerNumber p); bool IsCourseMode() const; bool IsBattleMode() const; // not Rave diff --git a/src/MusicWheel.cpp b/src/MusicWheel.cpp index 77303f5286..e8e4c76353 100644 --- a/src/MusicWheel.cpp +++ b/src/MusicWheel.cpp @@ -969,7 +969,7 @@ void MusicWheel::FilterWheelItemDatas(vector &aUnFilteredD } /* If the song has no steps for the current style, remove it. */ - if( !pSong->HasStepsType(GAMESTATE->GetCurrentStyle()->m_StepsType) ) + if( !CommonMetrics::AUTO_SET_STYLE && !pSong->HasStepsType(GAMESTATE->GetCurrentStyle()->m_StepsType) ) { aiRemove[i] = true; continue; diff --git a/src/NoteDataUtil.cpp b/src/NoteDataUtil.cpp index 022691c700..ccb9faf2b4 100644 --- a/src/NoteDataUtil.cpp +++ b/src/NoteDataUtil.cpp @@ -886,7 +886,7 @@ void NoteDataUtil::CalculateRadarValues( const NoteData &in, float fSongSeconds, case RadarCategory_Jumps: out[rc] = (float) stats.jumps; break; case RadarCategory_Holds: out[rc] = (float) in.GetNumHoldNotes(); break; case RadarCategory_Mines: out[rc] = (float) in.GetNumMines(); break; - case RadarCategory_Hands: out[rc] = (float) stats.hands; break; + case RadarCategory_Hands: out[rc] = (float) in.GetNumHands(); break; case RadarCategory_Rolls: out[rc] = (float) in.GetNumRolls(); break; case RadarCategory_Lifts: out[rc] = (float) in.GetNumLifts(); break; case RadarCategory_Fakes: out[rc] = (float) in.GetNumFakes(); break; diff --git a/src/NoteField.cpp b/src/NoteField.cpp index 60b0d9b6be..84dc4aae63 100644 --- a/src/NoteField.cpp +++ b/src/NoteField.cpp @@ -303,7 +303,7 @@ void NoteField::Update( float fDeltaTime ) // TODO: Remove use of PlayerNumber. PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - if( pn == GAMESTATE->m_MasterPlayerNumber ) + if( pn == GAMESTATE->GetMasterPlayerNumber() ) NoteDisplay::Update( fDeltaTime ); } diff --git a/src/OptionRow.cpp b/src/OptionRow.cpp index ee043f65df..4f50268542 100644 --- a/src/OptionRow.cpp +++ b/src/OptionRow.cpp @@ -196,7 +196,7 @@ RString OptionRow::GetRowTitle() const if( GAMESTATE->m_pCurCourse ) { - const Trail* pTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber]; + const Trail* pTrail = GAMESTATE->m_pCurTrail[GAMESTATE->GetMasterPlayerNumber()]; ASSERT( pTrail != NULL ); const int iNumCourseEntries = pTrail->m_vEntries.size(); if( iNumCourseEntries > CommonMetrics::MAX_COURSE_ENTRIES_BEFORE_VARIOUS ) @@ -417,8 +417,8 @@ void OptionRow::AfterImportOptions( PlayerNumber pn ) // we need to copy p2 to p1, not p1 to p2. if( m_pHand->m_Def.m_bOneChoiceForAllPlayers ) { - PlayerNumber pnCopyFrom = GAMESTATE->m_MasterPlayerNumber; - if( GAMESTATE->m_MasterPlayerNumber == PLAYER_INVALID ) + PlayerNumber pnCopyFrom = GAMESTATE->GetMasterPlayerNumber(); + if( GAMESTATE->GetMasterPlayerNumber() == PLAYER_INVALID ) pnCopyFrom = PLAYER_1; FOREACH_PlayerNumber( p ) m_vbSelected[p] = m_vbSelected[pnCopyFrom]; diff --git a/src/PercentageDisplay.cpp b/src/PercentageDisplay.cpp index 502f8f6989..503f153eb7 100644 --- a/src/PercentageDisplay.cpp +++ b/src/PercentageDisplay.cpp @@ -137,26 +137,6 @@ void PercentageDisplay::Refresh() else { float fPercentDancePoints = m_pPlayerStageStats->GetPercentDancePoints(); - float fCurMaxPercentDancePoints = m_pPlayerStageStats->GetCurMaxPercentDancePoints(); - - if( m_bApplyScoreDisplayOptions ) - { - switch( m_pPlayerState->m_PlayerOptions.GetCurrent().m_ScoreDisplay ) - { - case PlayerOptions::SCORING_ADD: - // nothing to do - break; - case PlayerOptions::SCORING_SUBTRACT: - fPercentDancePoints = 1.0f - ( fCurMaxPercentDancePoints - fPercentDancePoints ); - break; - case PlayerOptions::SCORING_AVERAGE: - if( fCurMaxPercentDancePoints == 0.0f ) // don't divide by zero fats - fPercentDancePoints = 0.0f; - else - fPercentDancePoints = fPercentDancePoints / fCurMaxPercentDancePoints; - break; - } - } // clamp percentage - feedback is that negative numbers look weird here. CLAMP( fPercentDancePoints, 0.f, 1.f ); diff --git a/src/Player.cpp b/src/Player.cpp index 5bd48778f8..6179b16d83 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -1375,7 +1375,7 @@ void Player::DrawPrimitives() // May have both players in doubles (for battle play); only draw primary player. if( GAMESTATE->GetCurrentStyle()->m_StyleType == StyleType_OnePlayerTwoSides && - pn != GAMESTATE->m_MasterPlayerNumber ) + pn != GAMESTATE->GetMasterPlayerNumber() ) return; // Draw these below everything else. diff --git a/src/PlayerOptions.cpp b/src/PlayerOptions.cpp index 363851cd6a..965acfd223 100644 --- a/src/PlayerOptions.cpp +++ b/src/PlayerOptions.cpp @@ -45,7 +45,6 @@ void PlayerOptions::Init() ZERO( m_bTransforms ); m_bMuteOnError = false; m_FailType = FAIL_IMMEDIATE; - m_ScoreDisplay = SCORING_ADD; m_sNoteSkin = ""; } @@ -85,7 +84,6 @@ void PlayerOptions::Approach( const PlayerOptions& other, float fDeltaSeconds ) for( int i=0; iGetDefaultPlayerOptions( po ); m_FailType = po.m_FailType; } - else if( sBit == "addscore" ) m_ScoreDisplay = SCORING_ADD; - else if( sBit == "subtractscore" ) m_ScoreDisplay = SCORING_SUBTRACT; - else if( sBit == "averagescore" ) m_ScoreDisplay = SCORING_AVERAGE; else if( sBit == "muteonerror" ) m_bMuteOnError = on; else if( sBit == "random" ) ChooseRandomModifiers(); // deprecated mods/left in for compatibility @@ -653,7 +648,6 @@ bool PlayerOptions::operator==( const PlayerOptions &other ) const COMPARE(m_fScrollSpeed); COMPARE(m_fScrollBPM); COMPARE(m_fRandomSpeed); - COMPARE(m_ScoreDisplay); COMPARE(m_FailType); COMPARE(m_bMuteOnError); COMPARE(m_fDark); @@ -798,7 +792,6 @@ RString PlayerOptions::GetSavedPrefsString() const SAVE( m_bTransforms[TRANSFORM_NOSTRETCH] ); SAVE( m_bTransforms[TRANSFORM_NOLIFTS] ); SAVE( m_bTransforms[TRANSFORM_NOFAKES] ); - SAVE( m_ScoreDisplay ); SAVE( m_bMuteOnError ); SAVE( m_sNoteSkin ); #undef SAVE diff --git a/src/PlayerOptions.h b/src/PlayerOptions.h index c6ea986160..9f4017bc42 100644 --- a/src/PlayerOptions.h +++ b/src/PlayerOptions.h @@ -34,8 +34,7 @@ public: 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_ScoreDisplay(SCORING_ADD) + m_bMuteOnError(false), m_FailType(FAIL_IMMEDIATE) { m_sNoteSkin = ""; ZERO( m_fAccels ); ONE( m_SpeedfAccels ); @@ -151,12 +150,6 @@ public: SCROLL_CENTERED, NUM_SCROLLS }; - enum ScoreDisplay { - SCORING_ADD=0, - SCORING_SUBTRACT, - SCORING_AVERAGE, - NUM_SCOREDISPLAYS - }; float GetReversePercentForColumn( int iCol ) const; // accounts for all Directions @@ -198,7 +191,6 @@ public: }; /** @brief The method for which a player can fail a song. */ FailType m_FailType; - ScoreDisplay m_ScoreDisplay; /** * @brief The Noteskin to use. diff --git a/src/PlayerState.cpp b/src/PlayerState.cpp index 9d7b652851..c30805daf9 100644 --- a/src/PlayerState.cpp +++ b/src/PlayerState.cpp @@ -162,7 +162,7 @@ void PlayerState::RebuildPlayerOptionsFromActiveAttacks() so.FromString( m_ActiveAttacks[s].sModifiers ); } m_PlayerOptions.Assign( ModsLevel_Song, po ); - if( m_PlayerNumber == GAMESTATE->m_MasterPlayerNumber ) + if( m_PlayerNumber == GAMESTATE->GetMasterPlayerNumber() ) GAMESTATE->m_SongOptions.Assign( ModsLevel_Song, so ); int iSumOfAttackLevels = GetSumOfActiveAttackLevels(); diff --git a/src/RageInputDevice.cpp b/src/RageInputDevice.cpp index 084a1ed9e5..544943bf84 100644 --- a/src/RageInputDevice.cpp +++ b/src/RageInputDevice.cpp @@ -63,6 +63,8 @@ static void InitNames() g_mapNamesToString[KEY_LSUPER] = "left super"; g_mapNamesToString[KEY_RSUPER] = "right super"; g_mapNamesToString[KEY_MENU] = "menu"; + + g_mapNamesToString[KEY_FN] = "function"; g_mapNamesToString[KEY_NUMLOCK] = "num lock"; g_mapNamesToString[KEY_SCRLLOCK] = "scroll lock"; diff --git a/src/RageInputDevice.h b/src/RageInputDevice.h index a81401e6a3..c8591b202f 100644 --- a/src/RageInputDevice.h +++ b/src/RageInputDevice.h @@ -221,6 +221,8 @@ enum DeviceButton KEY_LSUPER, KEY_RSUPER, KEY_MENU, + + KEY_FN, // Laptop function keys. KEY_NUMLOCK, KEY_SCRLLOCK, diff --git a/src/ScoreDisplayNormal.cpp b/src/ScoreDisplayNormal.cpp index f34613a1d9..dad9eeed02 100644 --- a/src/ScoreDisplayNormal.cpp +++ b/src/ScoreDisplayNormal.cpp @@ -46,36 +46,6 @@ void ScoreDisplayNormal::SetScore( int iNewScore ) { float fScore = (float)iNewScore; - // TODO: Remove use of PlayerNumber. - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - - // Play some games to display the correct score -- the actual internal - // score does not change at all but the displayed one can (ie: displayed - // score for subtractive is MaxScore - score). - - int iMaxScore = STATSMAN->m_CurStageStats.m_player[pn].m_iMaxScore; - int iCurMaxScore = STATSMAN->m_CurStageStats.m_player[pn].m_iCurMaxScore; - - switch( m_pPlayerState->m_PlayerOptions.GetCurrent().m_ScoreDisplay ) - { - case PlayerOptions::SCORING_ADD: - // nothing to do - break; - case PlayerOptions::SCORING_SUBTRACT: - fScore = iMaxScore - ( iCurMaxScore - fScore ); - break; - case PlayerOptions::SCORING_AVERAGE: - if( iCurMaxScore == 0 ) // don't divide by zero fats - { - fScore = 0; - } - else - { - float fScoreRatio = fScore / (float)iCurMaxScore; - fScore = fScoreRatio * iMaxScore; - } - } - m_text.SetTargetNumber( fScore ); } diff --git a/src/ScoreKeeperShared.cpp b/src/ScoreKeeperShared.cpp index 95a28a8599..6686adf4f2 100644 --- a/src/ScoreKeeperShared.cpp +++ b/src/ScoreKeeperShared.cpp @@ -16,7 +16,7 @@ void ScoreKeeperShared::Load( const vector &apSteps, const vector &asModifiers ) { - if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() ) return; ScoreKeeperNormal::Load( apSongs, apSteps, asModifiers ); } @@ -24,63 +24,63 @@ void ScoreKeeperShared::Load( // These ScoreKeepers don't get to draw. void ScoreKeeperShared::DrawPrimitives() { - if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() ) return; ScoreKeeperNormal::DrawPrimitives(); } void ScoreKeeperShared::Update( float fDelta ) { - if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() ) return; ScoreKeeperNormal::Update( fDelta ); } void ScoreKeeperShared::OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ) { - if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() ) return; ScoreKeeperNormal::OnNextSong( iSongInCourseIndex, pSteps, pNoteData ); } void ScoreKeeperShared::HandleTapScore( const TapNote &tn ) { - if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() ) return; ScoreKeeperNormal::HandleTapScore( tn ); } void ScoreKeeperShared::HandleTapRowScore( const NoteData &nd, int iRow ) { - if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() ) return; ScoreKeeperNormal::HandleTapRowScore( nd, iRow ); } void ScoreKeeperShared::HandleHoldScore( const TapNote &tn ) { - if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() ) return; ScoreKeeperNormal::HandleHoldScore( tn ); } void ScoreKeeperShared::HandleHoldActiveSeconds( float fMusicSecondsHeld ) { - if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() ) return; ScoreKeeperNormal::HandleHoldActiveSeconds( fMusicSecondsHeld ); } void ScoreKeeperShared::HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow ) { - if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() ) return; ScoreKeeperNormal::HandleHoldCheckpointScore( nd, iRow, iNumHoldsHeldThisRow, iNumHoldsMissedThisRow ); } void ScoreKeeperShared::HandleTapScoreNone() { - if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() ) return; ScoreKeeperNormal::HandleTapScoreNone(); } diff --git a/src/ScreenDebugOverlay.cpp b/src/ScreenDebugOverlay.cpp index b65b0efc7d..dd8a50b27b 100644 --- a/src/ScreenDebugOverlay.cpp +++ b/src/ScreenDebugOverlay.cpp @@ -598,8 +598,8 @@ class DebugLineAutoplay : public IDebugLine virtual bool IsEnabled() { return GamePreferences::m_AutoPlay.Get() != PC_HUMAN; } virtual void DoAndLog( RString &sMessageOut ) { - ASSERT( GAMESTATE->m_MasterPlayerNumber != PLAYER_INVALID ); - PlayerController pc = GAMESTATE->m_pPlayerState[GAMESTATE->m_MasterPlayerNumber]->m_PlayerController; + ASSERT( GAMESTATE->GetMasterPlayerNumber() != PLAYER_INVALID ); + PlayerController pc = GAMESTATE->m_pPlayerState[GAMESTATE->GetMasterPlayerNumber()]->m_PlayerController; bool bHoldingShift = INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT) ) || INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT) ); @@ -639,7 +639,7 @@ class DebugLineAssist : public IDebugLine virtual bool IsEnabled() { return GAMESTATE->m_SongOptions.GetSong().m_bAssistClap || GAMESTATE->m_SongOptions.GetSong().m_bAssistMetronome; } virtual void DoAndLog( RString &sMessageOut ) { - ASSERT( GAMESTATE->m_MasterPlayerNumber != PLAYER_INVALID ); + ASSERT( GAMESTATE->GetMasterPlayerNumber() != PLAYER_INVALID ); bool bHoldingShift = INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT) ); bool b; if( bHoldingShift ) diff --git a/src/ScreenEvaluation.cpp b/src/ScreenEvaluation.cpp index 1f87fe4b97..654f1d0bb5 100644 --- a/src/ScreenEvaluation.cpp +++ b/src/ScreenEvaluation.cpp @@ -99,7 +99,7 @@ void ScreenEvaluation::Init() ss.m_Stage = Stage_1st; enum_add( ss.m_Stage, rand()%3 ); ss.m_EarnedExtraStage = (EarnedExtraStage)(rand() % NUM_EarnedExtraStage); - GAMESTATE->m_MasterPlayerNumber = PLAYER_1; + GAMESTATE->SetMasterPlayerNumber(PLAYER_1); GAMESTATE->m_pCurSong.Set( SONGMAN->GetRandomSong() ); ss.m_vpPlayedSongs.push_back( GAMESTATE->m_pCurSong ); ss.m_vpPossibleSongs.push_back( GAMESTATE->m_pCurSong ); @@ -635,7 +635,7 @@ void ScreenEvaluation::Init() { case PLAY_MODE_BATTLE: { - bool bWon = GAMESTATE->GetStageResult(GAMESTATE->m_MasterPlayerNumber) == RESULT_WIN; + bool bWon = GAMESTATE->GetStageResult(GAMESTATE->GetMasterPlayerNumber()) == RESULT_WIN; if( bWon ) SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("evaluation win") ); else diff --git a/src/ScreenGameplay.cpp b/src/ScreenGameplay.cpp index ef55cd02c7..c4a6ccaeca 100644 --- a/src/ScreenGameplay.cpp +++ b/src/ScreenGameplay.cpp @@ -776,7 +776,7 @@ void ScreenGameplay::InitSongQueues() ASSERT( pCourse ); m_apSongsQueue.clear(); - PlayerNumber pnMaster = GAMESTATE->m_MasterPlayerNumber; + PlayerNumber pnMaster = GAMESTATE->GetMasterPlayerNumber(); Trail *pTrail = GAMESTATE->m_pCurTrail[pnMaster]; ASSERT( pTrail ); FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e ) @@ -1227,7 +1227,7 @@ void ScreenGameplay::LoadNextSong() FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi ) { RageSoundReader *pPlayerSound = m_AutoKeysounds.GetPlayerSound(pi->m_pn); - if( pPlayerSound == NULL && pi->m_pn == GAMESTATE->m_MasterPlayerNumber ) + if( pPlayerSound == NULL && pi->m_pn == GAMESTATE->GetMasterPlayerNumber() ) pPlayerSound = m_AutoKeysounds.GetSharedSound(); pi->m_SoundEffectControl.SetSoundReader( pPlayerSound ); } @@ -1393,7 +1393,7 @@ void ScreenGameplay::PlayTicks() /* TODO: Allow all players to have ticks. Not as simple as it looks. * If a loop takes place, it could make one player's ticks come later * than intended. Any help here would be appreciated. -Wolfman2000 */ - Player &player = *m_vPlayerInfo[0].m_pPlayer; + Player &player = *m_vPlayerInfo[GAMESTATE->GetMasterPlayerNumber()].m_pPlayer; const NoteData &nd = player.GetNoteData(); m_GameplayAssist.PlayTicks( nd, player.GetPlayerState() ); } diff --git a/src/ScreenGameplayShared.cpp b/src/ScreenGameplayShared.cpp index b7f179f078..21b656648e 100644 --- a/src/ScreenGameplayShared.cpp +++ b/src/ScreenGameplayShared.cpp @@ -11,7 +11,7 @@ REGISTER_SCREEN_CLASS( ScreenGameplayShared ); void ScreenGameplayShared::FillPlayerInfo( vector &vPlayerInfoOut ) { - const PlayerNumber master = GAMESTATE->m_MasterPlayerNumber; + const PlayerNumber master = GAMESTATE->GetMasterPlayerNumber(); const PlayerNumber other = (master == PLAYER_1? PLAYER_2:PLAYER_1); /* The master player is where all of the real work takes place. The other player exists @@ -23,7 +23,7 @@ void ScreenGameplayShared::FillPlayerInfo( vector &vPlayerInfoOut ) PlayerInfo &ScreenGameplayShared::GetPlayerInfoForInput( const InputEventPlus& iep ) { - return m_vPlayerInfo[GAMESTATE->m_MasterPlayerNumber]; + return m_vPlayerInfo[GAMESTATE->GetMasterPlayerNumber()]; } /* diff --git a/src/ScreenHowToPlay.cpp b/src/ScreenHowToPlay.cpp index 81e8d73d6b..b38848bb7d 100644 --- a/src/ScreenHowToPlay.cpp +++ b/src/ScreenHowToPlay.cpp @@ -172,7 +172,7 @@ void ScreenHowToPlay::Init() // Don't show judgment PO_GROUP_ASSIGN( GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions, ModsLevel_Stage, m_fBlind, 1.0f ); - GAMESTATE->m_MasterPlayerNumber = PLAYER_1; + GAMESTATE->SetMasterPlayerNumber(PLAYER_1); GAMESTATE->m_bDemonstrationOrJukebox = true; } diff --git a/src/ScreenInstallOverlay.cpp b/src/ScreenInstallOverlay.cpp index 7453d08ddc..25561e7d8d 100644 --- a/src/ScreenInstallOverlay.cpp +++ b/src/ScreenInstallOverlay.cpp @@ -375,7 +375,7 @@ void ScreenInstallOverlay::Update( float fDeltaTime ) GAMEMAN->GetStylesForGame( GAMESTATE->m_pCurGame, vpStyle, false ); GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR ); GAMESTATE->m_bSideIsJoined[0] = true; - GAMESTATE->m_MasterPlayerNumber = PLAYER_1; + GAMESTATE->SetMasterPlayerNumber(PLAYER_1); GAMESTATE->m_pCurStyle.Set( vpStyle[0] ); GAMESTATE->m_pCurSong.Set( pSong ); GAMESTATE->m_pPreferredSong = pSong; diff --git a/src/ScreenJukebox.cpp b/src/ScreenJukebox.cpp index 07f293bfe3..eb1769c040 100644 --- a/src/ScreenJukebox.cpp +++ b/src/ScreenJukebox.cpp @@ -179,7 +179,7 @@ void ScreenJukebox::Init() // ASSERT( GAMESTATE->m_pCurSong ); - GAMESTATE->m_MasterPlayerNumber = PLAYER_1; + GAMESTATE->SetMasterPlayerNumber(PLAYER_1); // choose some cool options int Benchmark = 0; diff --git a/src/ScreenMiniMenu.cpp b/src/ScreenMiniMenu.cpp index da3ff924b0..0d68986a97 100644 --- a/src/ScreenMiniMenu.cpp +++ b/src/ScreenMiniMenu.cpp @@ -107,7 +107,7 @@ void ScreenMiniMenu::AfterChangeValueOrRow( PlayerNumber pn ) OptionRow &optrow = *m_pRows[i]; optrow.GetRowDef().m_vEnabledForPlayers.clear(); if( mr.pfnEnabled() ) - optrow.GetRowDef().m_vEnabledForPlayers.insert( GAMESTATE->m_MasterPlayerNumber ); + optrow.GetRowDef().m_vEnabledForPlayers.insert( GAMESTATE->GetMasterPlayerNumber() ); } m_pRows[i]->UpdateEnabledDisabled(); } diff --git a/src/ScreenNameEntry.cpp b/src/ScreenNameEntry.cpp index b4eeeed4cc..b7faaa4fc1 100644 --- a/src/ScreenNameEntry.cpp +++ b/src/ScreenNameEntry.cpp @@ -118,7 +118,7 @@ ScreenNameEntry::ScreenNameEntry() { GAMESTATE->m_bSideIsJoined[PLAYER_1] = true; GAMESTATE->m_bSideIsJoined[PLAYER_2] = true; - GAMESTATE->m_MasterPlayerNumber = PLAYER_1; + GAMESTATE->SetMasterPlayerNumber(PLAYER_1); GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR ); GAMESTATE->SetCurrentStyle( GAMEMAN->GameAndStringToStyle( GAMEMAN->GetDefaultGame(),"versus") ); StageStats ss; diff --git a/src/ScreenNameEntryTraditional.cpp b/src/ScreenNameEntryTraditional.cpp index 3663641412..c685531180 100644 --- a/src/ScreenNameEntryTraditional.cpp +++ b/src/ScreenNameEntryTraditional.cpp @@ -22,7 +22,7 @@ void ScreenNameEntryTraditional::Init() { GAMESTATE->m_bSideIsJoined[PLAYER_1] = true; GAMESTATE->m_bSideIsJoined[PLAYER_2] = true; - GAMESTATE->m_MasterPlayerNumber = PLAYER_1; + GAMESTATE->SetMasterPlayerNumber(PLAYER_1); GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR ); GAMESTATE->SetCurrentStyle( GAMEMAN->GameAndStringToStyle( GAMEMAN->GetDefaultGame(),"versus") ); for( int z = 0; z < 3; ++z ) diff --git a/src/ScreenOptions.cpp b/src/ScreenOptions.cpp index 4cf574d9b5..e783125e00 100644 --- a/src/ScreenOptions.cpp +++ b/src/ScreenOptions.cpp @@ -531,7 +531,7 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM ) return; // already transitioning // If the selected option sets a screen, honor it. - RString sThisScreen = GetNextScreenForFocusedItem( GAMESTATE->m_MasterPlayerNumber ); + RString sThisScreen = GetNextScreenForFocusedItem( GAMESTATE->GetMasterPlayerNumber() ); if( sThisScreen != "" ) m_sNextScreen = sThisScreen; diff --git a/src/ScreenOptionsCourseOverview.cpp b/src/ScreenOptionsCourseOverview.cpp index 0003ab7b2a..cefd327d1c 100644 --- a/src/ScreenOptionsCourseOverview.cpp +++ b/src/ScreenOptionsCourseOverview.cpp @@ -119,7 +119,7 @@ void ScreenOptionsCourseOverview::HandleScreenMessage( const ScreenMessage SM ) } else if( SM == SM_GoToNextScreen ) { - int iRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; + int iRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; switch( iRow ) { case CourseOverviewRow_Play: @@ -191,7 +191,7 @@ void ScreenOptionsCourseOverview::ProcessMenuStart( const InputEventPlus &input if( IsTransitioning() ) return; - int iRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; + int iRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; switch( iRow ) { case CourseOverviewRow_Play: diff --git a/src/ScreenOptionsEditCourse.cpp b/src/ScreenOptionsEditCourse.cpp index 6e108856ba..6f5c6aa111 100644 --- a/src/ScreenOptionsEditCourse.cpp +++ b/src/ScreenOptionsEditCourse.cpp @@ -488,7 +488,7 @@ void ScreenOptionsEditCourse::ProcessMenuStart( const InputEventPlus &input ) if( IsTransitioning() ) return; - int iRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; + int iRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; unsigned iSongCount = GAMESTATE->m_pCurCourse->m_vEntries.size(); diff --git a/src/ScreenOptionsExportPackage.cpp b/src/ScreenOptionsExportPackage.cpp index eda77e4ac9..1ff29e1f0c 100644 --- a/src/ScreenOptionsExportPackage.cpp +++ b/src/ScreenOptionsExportPackage.cpp @@ -147,7 +147,7 @@ void ScreenOptionsExportPackage::ProcessMenuStart( const InputEventPlus &input ) if( IsTransitioning() ) return; - int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; + int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit ) { ScreenOptions::ProcessMenuStart( input ); diff --git a/src/ScreenOptionsManageCourses.cpp b/src/ScreenOptionsManageCourses.cpp index c3f61721eb..40a0bbcdfa 100644 --- a/src/ScreenOptionsManageCourses.cpp +++ b/src/ScreenOptionsManageCourses.cpp @@ -143,18 +143,18 @@ void ScreenOptionsManageCourses::BeginScreen() if( iter != m_vpCourses.end() ) { iIndex = iter - m_vpCourses.begin(); - this->MoveRowAbsolute( GAMESTATE->m_MasterPlayerNumber, 1 + iIndex ); + this->MoveRowAbsolute( GAMESTATE->GetMasterPlayerNumber(), 1 + iIndex ); } } - AfterChangeRow( GAMESTATE->m_MasterPlayerNumber ); + AfterChangeRow( GAMESTATE->GetMasterPlayerNumber() ); } void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM ) { if( SM == SM_GoToNextScreen ) { - int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; + int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; if( iCurRow == 0 ) // "create new" { @@ -218,7 +218,7 @@ void ScreenOptionsManageCourses::ProcessMenuStart( const InputEventPlus &input ) if( IsTransitioning() ) return; - int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; + int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; if( iCurRow == 0 ) // "create new" { @@ -259,7 +259,7 @@ void ScreenOptionsManageCourses::ExportOptions( int iRow, const vectorm_MasterPlayerNumber]; + int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; if( iCurRow == 0 ) return NULL; else if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit ) diff --git a/src/ScreenOptionsManageEditSteps.cpp b/src/ScreenOptionsManageEditSteps.cpp index 6a4e416c9d..62d58bdfee 100644 --- a/src/ScreenOptionsManageEditSteps.cpp +++ b/src/ScreenOptionsManageEditSteps.cpp @@ -125,7 +125,7 @@ void ScreenOptionsManageEditSteps::HandleScreenMessage( const ScreenMessage SM ) { if( SM == SM_GoToNextScreen ) { - int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; + int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; if( iCurRow == 0 ) // "create new" { @@ -245,7 +245,7 @@ void ScreenOptionsManageEditSteps::ProcessMenuStart( const InputEventPlus &input if( IsTransitioning() ) return; - int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; + int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; if( iCurRow == 0 ) // "create new" { @@ -292,7 +292,7 @@ void ScreenOptionsManageEditSteps::ExportOptions( int iRow, const vectorm_MasterPlayerNumber]; + int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; if( iCurRow == 0 ) return NULL; else if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit ) diff --git a/src/ScreenOptionsManageProfiles.cpp b/src/ScreenOptionsManageProfiles.cpp index f3bae8fe78..140177c9c2 100644 --- a/src/ScreenOptionsManageProfiles.cpp +++ b/src/ScreenOptionsManageProfiles.cpp @@ -167,7 +167,7 @@ void ScreenOptionsManageProfiles::HandleScreenMessage( const ScreenMessage SM ) { if( SM == SM_GoToNextScreen ) { - int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; + int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; OptionRow &row = *m_pRows[iCurRow]; if( row.GetRowType() == OptionRow::RowType_Exit ) { @@ -337,7 +337,7 @@ void ScreenOptionsManageProfiles::ProcessMenuStart( const InputEventPlus &input if( IsTransitioning() ) return; - int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; + int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; OptionRow &row = *m_pRows[iCurRow]; if( SHOW_CREATE_NEW && iCurRow == 0 ) // "create new" @@ -405,7 +405,7 @@ void ScreenOptionsManageProfiles::ExportOptions( int iRow, const vectorm_MasterPlayerNumber]; + int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; OptionRow &row = *m_pRows[iCurRow]; if( SHOW_CREATE_NEW && iCurRow == 0 ) // "create new" diff --git a/src/ScreenOptionsMemoryCard.cpp b/src/ScreenOptionsMemoryCard.cpp index 8aab5b16d5..c0bfa6351b 100644 --- a/src/ScreenOptionsMemoryCard.cpp +++ b/src/ScreenOptionsMemoryCard.cpp @@ -111,7 +111,7 @@ void ScreenOptionsMemoryCard::AfterChangeRow( PlayerNumber pn ) } else { - int iRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; + int iRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; m_textOsMountDir.SetText( m_CurrentUsbStorageDevices[iRow].sOsMountDir ); } } @@ -124,7 +124,7 @@ void ScreenOptionsMemoryCard::HandleMessage( const Message &msg ) { /* Remember the old mountpoint. */ const vector &v = m_CurrentUsbStorageDevices; - int iRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; + int iRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; RString sOldMountPoint; if( iRow < int(v.size()) ) { @@ -158,7 +158,7 @@ void ScreenOptionsMemoryCard::ExportOptions( int iRow, const vectorm_MasterPlayerNumber; + PlayerNumber pn = GAMESTATE->GetMasterPlayerNumber(); if( m_iCurrentRow[pn] == iRow ) { const vector &v = m_CurrentUsbStorageDevices; @@ -192,7 +192,7 @@ void ScreenOptionsMemoryCard::ProcessMenuStart( const InputEventPlus &input ) if( IsTransitioning() ) return; - int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; + int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; const vector &v = m_CurrentUsbStorageDevices; if( iCurRow < int(v.size()) ) // a card diff --git a/src/ScreenSMOnlineLogin.cpp b/src/ScreenSMOnlineLogin.cpp index 80d0c40b1d..5cf0e61cb1 100644 --- a/src/ScreenSMOnlineLogin.cpp +++ b/src/ScreenSMOnlineLogin.cpp @@ -155,7 +155,7 @@ void ScreenSMOnlineLogin::HandleScreenMessage(const ScreenMessage SM) { LOG->Trace("[ScreenSMOnlineLogin::HandleScreenMessage] GoToNextScreen"); vector v; - v.push_back( GAMESTATE->m_MasterPlayerNumber ); + v.push_back( GAMESTATE->GetMasterPlayerNumber() ); for( unsigned r=0; rm_MasterPlayerNumber != PlayerNumber_Invalid ); - int iMastersIndex = this->GetSelectionIndex( GAMESTATE->m_MasterPlayerNumber ); + ASSERT( GAMESTATE->GetMasterPlayerNumber() != PlayerNumber_Invalid ); + int iMastersIndex = this->GetSelectionIndex( GAMESTATE->GetMasterPlayerNumber() ); bool bAllPlayersChoseTheSame = true; FOREACH_HumanPlayer( p ) { diff --git a/src/ScreenSelectMaster.cpp b/src/ScreenSelectMaster.cpp index 0e50f5ccbf..3c3a80a4b9 100644 --- a/src/ScreenSelectMaster.cpp +++ b/src/ScreenSelectMaster.cpp @@ -294,7 +294,7 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM ) if( SM == SM_PlayPostSwitchPage ) { - int iNewChoice = m_iChoice[ GAMESTATE->m_MasterPlayerNumber ]; + int iNewChoice = m_iChoice[ GAMESTATE->GetMasterPlayerNumber() ]; Page newPage = GetPage( iNewChoice ); Message msg("PostSwitchPage"); @@ -516,7 +516,7 @@ void ScreenSelectMaster::MenuDown( const InputEventPlus &input ) bool ScreenSelectMaster::ChangePage( int iNewChoice ) { - Page oldPage = GetPage( m_iChoice[GAMESTATE->m_MasterPlayerNumber] ); + Page oldPage = GetPage( m_iChoice[GAMESTATE->GetMasterPlayerNumber()] ); Page newPage = GetPage( iNewChoice ); // If anyone has already chosen, don't allow changing of pages @@ -710,8 +710,8 @@ bool ScreenSelectMaster::ChangeSelection( PlayerNumber pn, MenuDir dir, int iNew PlayerNumber ScreenSelectMaster::GetSharedPlayer() { - if( GAMESTATE->m_MasterPlayerNumber != PLAYER_INVALID ) - return GAMESTATE->m_MasterPlayerNumber; + if( GAMESTATE->GetMasterPlayerNumber() != PLAYER_INVALID ) + return GAMESTATE->GetMasterPlayerNumber(); return PLAYER_1; } diff --git a/src/ScreenSelectMusic.cpp b/src/ScreenSelectMusic.cpp index 1ee3c116a4..4251ae73ab 100644 --- a/src/ScreenSelectMusic.cpp +++ b/src/ScreenSelectMusic.cpp @@ -68,7 +68,7 @@ void ScreenSelectMusic::Init() GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR ); GAMESTATE->SetCurrentStyle( GAMEMAN->GameAndStringToStyle(GAMEMAN->GetDefaultGame(),"versus") ); GAMESTATE->JoinPlayer( PLAYER_1 ); - GAMESTATE->m_MasterPlayerNumber = PLAYER_1; + GAMESTATE->SetMasterPlayerNumber(PLAYER_1); } SAMPLE_MUSIC_DELAY_INIT.Load( m_sName, "SampleMusicDelayInit" ); @@ -1020,7 +1020,7 @@ void ScreenSelectMusic::HandleMessage( const Message &msg ) // TODO: Invalidate the CurSteps only if they are no longer playable. // That way, after music change will clamp to the nearest in the StepsDisplayList. - GAMESTATE->m_pCurSteps[GAMESTATE->m_MasterPlayerNumber].SetWithoutBroadcast( NULL ); + GAMESTATE->m_pCurSteps[GAMESTATE->GetMasterPlayerNumber()].SetWithoutBroadcast( NULL ); FOREACH_ENUM( PlayerNumber, p ) GAMESTATE->m_pCurSteps[p].SetWithoutBroadcast( NULL ); @@ -1392,7 +1392,7 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input ) if( pStyle == NULL ) { StepsType stCurrent; - PlayerNumber pn = GAMESTATE->m_MasterPlayerNumber; + PlayerNumber pn = GAMESTATE->GetMasterPlayerNumber(); if( GAMESTATE->IsCourseMode() ) { ASSERT( GAMESTATE->m_pCurTrail[pn] ); @@ -1615,7 +1615,7 @@ void ScreenSelectMusic::SwitchToPreferredDifficulty() if( GAMESTATE->DifficultiesLocked() ) { FOREACH_HumanPlayer( p ) - m_iSelection[p] = m_iSelection[GAMESTATE->m_MasterPlayerNumber]; + m_iSelection[p] = m_iSelection[GAMESTATE->GetMasterPlayerNumber()]; } } diff --git a/src/ScreenSongOptions.cpp b/src/ScreenSongOptions.cpp index 5006b43ac3..2b9287c232 100644 --- a/src/ScreenSongOptions.cpp +++ b/src/ScreenSongOptions.cpp @@ -23,7 +23,7 @@ void ScreenSongOptions::Init() void ScreenSongOptions::ExportOptions( int iRow, const vector &vpns ) { - PlayerNumber pn = GAMESTATE->m_MasterPlayerNumber; + PlayerNumber pn = GAMESTATE->GetMasterPlayerNumber(); PlayerState *pPS = GAMESTATE->m_pPlayerState[pn]; const PlayerOptions::FailType ft = pPS->m_PlayerOptions.GetPreferred().m_FailType; diff --git a/src/Song.cpp b/src/Song.cpp index cc57bccd9b..62696a93e2 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -41,7 +41,7 @@ * @brief The internal version of the cache for StepMania. * * Increment this value to invalidate the current cache. */ -const int FILE_CACHE_VERSION = 178; +const int FILE_CACHE_VERSION = 179; /** @brief How long does a song sample last by default? */ const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f; diff --git a/src/SongUtil.cpp b/src/SongUtil.cpp index 3d83420167..b188a0c108 100644 --- a/src/SongUtil.cpp +++ b/src/SongUtil.cpp @@ -927,7 +927,9 @@ void SongUtil::GetPlayableStepsTypes( const Song *pSong, set &vOut ) iNumPlayers = max( iNumPlayers, 1 ); const Style *pStyle = GAMEMAN->GetFirstCompatibleStyle( GAMESTATE->m_pCurGame, iNumPlayers, *st ); - bool bEnoughStages = GAMESTATE->IsAnExtraStage() || GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer() >= GAMESTATE->GetNumStagesForSongAndStyleType(pSong, pStyle->m_StyleType); + bool bEnoughStages = GAMESTATE->IsAnExtraStage() || + GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer() >= + GAMESTATE->GetNumStagesForSongAndStyleType(pSong, pStyle->m_StyleType); if( bShowThisStepsType && bEnoughStages ) vOut.insert( *st ); diff --git a/src/StatsManager.cpp b/src/StatsManager.cpp index 99a95a10c7..96e91409a5 100644 --- a/src/StatsManager.cpp +++ b/src/StatsManager.cpp @@ -275,7 +275,7 @@ void StatsManager::CommitStatsToProfiles( const StageStats *pSS ) { if( pSS->m_multiPlayer[mp].m_HighScore.IsEmpty() ) continue; - recent->AppendChild( MakeRecentScoreNode( *pSS, GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber], pSS->m_multiPlayer[mp], mp ) ); + recent->AppendChild( MakeRecentScoreNode( *pSS, GAMESTATE->m_pCurTrail[GAMESTATE->GetMasterPlayerNumber()], pSS->m_multiPlayer[mp], mp ) ); } }