void ModeSwitcher::ChangeMode(PlayerNumber pn, int dir) { if( !strcmp(GAMESTATE->m_pCurGame->m_szName,"pump") ) { if(GAMESTATE->IsPlayerEnabled(pn)) { if(GAMESTATE->m_PreferredDifficulty[pn] != DIFFICULTY_CHALLENGE) { switch(GAMESTATE->m_PreferredDifficulty[pn]) { case DIFFICULTY_BEGINNER: GAMESTATE->m_PreferredDifficulty[pn] = DIFFICULTY_EASY; break; case DIFFICULTY_EASY: GAMESTATE->m_PreferredDifficulty[pn] = DIFFICULTY_MEDIUM; break; case DIFFICULTY_MEDIUM: GAMESTATE->m_PreferredDifficulty[pn] = DIFFICULTY_HARD; break; case DIFFICULTY_HARD: GAMESTATE->m_PreferredDifficulty[pn] = DIFFICULTY_CHALLENGE; break; } m_Stylename.SetText(GetStyleName()); m_Nextmode.SetText(GetNextStyleName()); m_Prevmode.SetText(GetPrevStyleName()); return; } else { if(GAMESTATE->IsPlayerEnabled(PLAYER_1)) GAMESTATE->m_PreferredDifficulty[PLAYER_1] = DIFFICULTY_CHALLENGE; if(GAMESTATE->IsPlayerEnabled(PLAYER_2)) GAMESTATE->m_PreferredDifficulty[PLAYER_2] = DIFFICULTY_CHALLENGE; } } // Make a list of all styles for the current Game. vector<const Style*> vPossibleStyles; GAMEMAN->GetStylesForGame( GAMESTATE->m_pCurGame, vPossibleStyles ); ASSERT( !vPossibleStyles.empty() ); int index = 0; vector<const Style*>::const_iterator iter = find(vPossibleStyles.begin(), vPossibleStyles.end(), GAMESTATE->m_pCurStyle ); if( iter != vPossibleStyles.end() ) { index = iter - vPossibleStyles.begin(); index += dir; wrap( index, vPossibleStyles.size() ); } GAMESTATE->m_pCurStyle = vPossibleStyles[index]; } m_Stylename.SetText(GetStyleName()); m_Nextmode.SetText(GetNextStyleName()); m_Prevmode.SetText(GetPrevStyleName()); }
ModeSwitcher::ModeSwitcher() { const CString sStyleNamesFontPath = THEME->GetPathToF("ModeSwitcher stylenames"); m_Nextmode.LoadFromFont( sStyleNamesFontPath ); m_Nextmode.SetXY(NEXTMODE_X,NEXTMODE_Y); m_Nextmode.SetZoom(NEXTMODE_ZOOM); m_Nextmode.SetText(GetNextStyleName()); m_Prevmode.LoadFromFont( sStyleNamesFontPath ); m_Prevmode.SetXY(PREVMODE_X,PREVMODE_Y); m_Prevmode.SetText(GetPrevStyleName()); m_Prevmode.SetZoom(PREVMODE_ZOOM); m_Stylename.LoadFromFont( sStyleNamesFontPath ); m_Stylename.SetXY(CURRMODE_X,CURRMODE_Y); m_Stylename.SetText(GetStyleName()); m_Stylename.SetZoom(CURRMODE_ZOOM); m_NextIcon.Load( THEME->GetPathToG("ModeSwitcher nexticon")); m_NextIcon.SetXY( NEXTICON_X, NEXTICON_Y); m_PrevIcon.Load( THEME->GetPathToG("ModeSwitcher previcon")); m_PrevIcon.SetXY( PREVICON_X, PREVICON_Y); this->AddChild( &m_NextIcon ); this->AddChild( &m_PrevIcon ); this->AddChild(&m_Stylename); this->AddChild(&m_Nextmode); this->AddChild(&m_Prevmode); }
ModeSwitcher::ModeSwitcher() { m_Nextmode.LoadFromFont( THEME->GetPathF("ModeSwitcher","stylenames") ); m_Nextmode.SetXY(NEXTMODE_X,NEXTMODE_Y); m_Nextmode.SetZoom(NEXTMODE_ZOOM); m_Nextmode.SetText(GetNextStyleName()); m_Prevmode.LoadFromFont( THEME->GetPathF("ModeSwitcher","stylenames") ); m_Prevmode.SetXY(PREVMODE_X,PREVMODE_Y); m_Prevmode.SetText(GetPrevStyleName()); m_Prevmode.SetZoom(PREVMODE_ZOOM); m_Stylename.LoadFromFont( THEME->GetPathF("ModeSwitcher","stylenames") ); m_Stylename.SetXY(CURRMODE_X,CURRMODE_Y); m_Stylename.SetText(GetStyleName()); m_Stylename.SetZoom(CURRMODE_ZOOM); m_NextIcon.Load( THEME->GetPathG("ModeSwitcher","nexticon")); m_NextIcon.SetXY( NEXTICON_X, NEXTICON_Y); m_PrevIcon.Load( THEME->GetPathG("ModeSwitcher","previcon")); m_PrevIcon.SetXY( PREVICON_X, PREVICON_Y); this->AddChild( &m_NextIcon ); this->AddChild( &m_PrevIcon ); this->AddChild(&m_Stylename); this->AddChild(&m_Nextmode); this->AddChild(&m_Prevmode); }