Files
itgmania212121/stepmania/src/ScreenAppearanceOptions.cpp
T

193 lines
5.7 KiB
C++
Raw Normal View History

2003-02-16 04:01:45 +00:00
#include "global.h"
2002-07-11 19:02:26 +00:00
/*
-----------------------------------------------------------------------------
Class: ScreenAppearanceOptions
Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ScreenAppearanceOptions.h"
#include "RageTextureManager.h"
#include "RageUtil.h"
2003-01-02 07:54:28 +00:00
#include "RageSoundManager.h"
2002-07-11 19:02:26 +00:00
#include "ScreenManager.h"
#include "PrefsManager.h"
#include "GameConstantsAndTypes.h"
#include "StepMania.h"
2002-07-23 01:41:40 +00:00
#include "PrefsManager.h"
2002-07-11 19:02:26 +00:00
#include "RageLog.h"
#include "AnnouncerManager.h"
#include "NoteSkinManager.h"
2002-07-23 01:41:40 +00:00
#include "GameState.h"
#include "ThemeManager.h"
2002-07-11 19:02:26 +00:00
enum {
AO_ANNOUNCER = 0,
2002-07-23 01:41:40 +00:00
AO_THEME,
AO_SKIN,
AO_INSTRUCTIONS,
AO_CAUTION,
AO_DANCE_POINTS_FOR_ONI,
AO_SELECT_GROUP,
2002-12-30 21:42:14 +00:00
AO_WHEEL_SECTIONS,
2003-02-12 00:14:53 +00:00
AO_SHOW_TRANSLATIONS,
AO_SHOW_LYRICS,
2002-07-11 19:02:26 +00:00
NUM_APPEARANCE_OPTIONS_LINES
};
OptionRow g_AppearanceOptionsLines[NUM_APPEARANCE_OPTIONS_LINES] = {
OptionRow( "Announcer" ),
OptionRow( "Theme" ),
OptionRow( "Default\nNoteSkin" ),
2003-04-05 03:49:03 +00:00
OptionRow( "Instructions", "SKIP","SHOW"),
OptionRow( "Caution", "SKIP","SHOW"),
OptionRow( "Oni Score\nDisplay","PERCENT","DANCE POINTS"),
OptionRow( "Song\nGroup", "ALL MUSIC","CHOOSE"),
OptionRow( "Wheel\nSections", "NEVER","ALWAYS", "ABC ONLY"),
OptionRow( "Translations", "NATIVE","TRANSLITERATE"),
OptionRow( "Lyrics", "HIDE","SHOW"),
2002-07-11 19:02:26 +00:00
};
ScreenAppearanceOptions::ScreenAppearanceOptions() :
2003-03-09 00:55:49 +00:00
ScreenOptions("ScreenAppearanceOptions",false)
2002-07-11 19:02:26 +00:00
{
LOG->Trace( "ScreenAppearanceOptions::ScreenAppearanceOptions()" );
2002-07-11 19:02:26 +00:00
Init(
INPUTMODE_BOTH,
g_AppearanceOptionsLines,
NUM_APPEARANCE_OPTIONS_LINES,
false, true );
2003-03-11 21:33:11 +00:00
m_Menu.m_MenuTimer.Disable();
2002-08-27 16:53:25 +00:00
SOUNDMAN->PlayMusic( THEME->GetPathToS("ScreenAppearanceOptions music") );
2002-07-11 19:02:26 +00:00
}
void ScreenAppearanceOptions::ImportOptions()
{
unsigned i;
2002-07-23 01:41:40 +00:00
//
2002-07-11 19:02:26 +00:00
// fill in announcer names
2002-07-23 01:41:40 +00:00
//
2002-07-11 19:02:26 +00:00
CStringArray arrayAnnouncerNames;
ANNOUNCER->GetAnnouncerNames( arrayAnnouncerNames );
m_OptionRow[AO_ANNOUNCER].choices.clear();
m_OptionRow[AO_ANNOUNCER].choices.push_back( "OFF" );
for( i=0; i<arrayAnnouncerNames.size() && i<MAX_OPTIONS_PER_LINE; i++ )
{
m_OptionRow[AO_ANNOUNCER].choices.push_back( arrayAnnouncerNames[i] );
}
2002-07-11 19:02:26 +00:00
// highlight currently selected announcer
m_iSelectedOption[0][AO_ANNOUNCER] = 0;
for( i=1; i<m_OptionRow[AO_ANNOUNCER].choices.size(); i++ )
if( 0==stricmp(m_OptionRow[AO_ANNOUNCER].choices[i], ANNOUNCER->GetCurAnnouncerName()) )
2002-07-11 19:02:26 +00:00
m_iSelectedOption[0][AO_ANNOUNCER] = i;
2002-07-23 01:41:40 +00:00
//
// fill in theme names
//
CStringArray arrayThemeNames;
THEME->GetThemeNames( arrayThemeNames );
2002-07-23 01:41:40 +00:00
m_OptionRow[AO_THEME].choices.clear();
2002-07-23 01:41:40 +00:00
for( i=0; i<arrayThemeNames.size() && i<MAX_OPTIONS_PER_LINE; i++ )
{
m_OptionRow[AO_THEME].choices.push_back( arrayThemeNames[i] );
}
2002-07-23 01:41:40 +00:00
// highlight currently selected theme
m_iSelectedOption[0][AO_THEME] = 0;
for( i=0; i<m_OptionRow[AO_THEME].choices.size(); i++ )
if( 0==stricmp(m_OptionRow[AO_THEME].choices[i], THEME->GetCurThemeName()) )
2002-07-23 01:41:40 +00:00
m_iSelectedOption[0][AO_THEME] = i;
2002-07-23 01:41:40 +00:00
//
// fill in skin names
//
CStringArray arraySkinNames;
NOTESKIN->GetNoteSkinNames( arraySkinNames );
m_OptionRow[AO_SKIN].choices.clear();
for( i=0; i<arraySkinNames.size() && i<MAX_OPTIONS_PER_LINE; i++ )
{
arraySkinNames[i].MakeUpper();
m_OptionRow[AO_SKIN].choices.push_back( arraySkinNames[i] );
}
// highlight currently selected skin
m_iSelectedOption[0][AO_SKIN] = 0;
for( i=0; i<m_OptionRow[AO_SKIN].choices.size(); i++ )
if( 0==stricmp(m_OptionRow[AO_SKIN].choices[i], PREFSMAN->m_sDefaultNoteSkin) )
m_iSelectedOption[0][AO_SKIN] = i;
2003-02-12 00:14:53 +00:00
m_iSelectedOption[0][AO_INSTRUCTIONS] = PREFSMAN->m_bInstructions? 1:0;
m_iSelectedOption[0][AO_CAUTION] = PREFSMAN->m_bShowDontDie? 1:0;
m_iSelectedOption[0][AO_DANCE_POINTS_FOR_ONI] = PREFSMAN->m_bDancePointsForOni? 1:0;
m_iSelectedOption[0][AO_SELECT_GROUP] = PREFSMAN->m_bShowSelectGroup? 1:0;
m_iSelectedOption[0][AO_WHEEL_SECTIONS] = (int)PREFSMAN->m_MusicWheelUsesSections;
2003-05-20 04:44:41 +00:00
m_iSelectedOption[0][AO_SHOW_TRANSLATIONS] = PREFSMAN->m_bShowNative? 0:1;
m_iSelectedOption[0][AO_SHOW_LYRICS] = PREFSMAN->m_bShowLyrics;
2002-07-11 19:02:26 +00:00
}
void ScreenAppearanceOptions::ExportOptions()
{
PREFSMAN->SaveGamePrefsToDisk();
PREFSMAN->SaveGlobalPrefsToDisk();
2002-07-11 19:02:26 +00:00
int iSelectedAnnouncer = m_iSelectedOption[0][AO_ANNOUNCER];
CString sNewAnnouncer = m_OptionRow[AO_ANNOUNCER].choices[iSelectedAnnouncer];
2002-07-11 19:02:26 +00:00
if( iSelectedAnnouncer == 0 )
sNewAnnouncer = "";
ANNOUNCER->SwitchAnnouncer( sNewAnnouncer );
2002-07-23 01:41:40 +00:00
int iSelectedTheme = m_iSelectedOption[0][AO_THEME];
CString sNewTheme = m_OptionRow[AO_THEME].choices[iSelectedTheme];
2002-07-23 01:41:40 +00:00
THEME->SwitchTheme( sNewTheme );
2003-04-18 23:55:20 +00:00
TEXTUREMAN->DoDelayedDelete(); // delete all textures that don't have references
2002-07-23 01:41:40 +00:00
int iSelectedSkin = m_iSelectedOption[0][AO_SKIN];
CString sNewSkin = m_OptionRow[AO_SKIN].choices[iSelectedSkin];
PREFSMAN->m_sDefaultNoteSkin = sNewSkin;
PREFSMAN->m_bInstructions = !!m_iSelectedOption[0][AO_INSTRUCTIONS];
PREFSMAN->m_bShowDontDie = !!m_iSelectedOption[0][AO_CAUTION];
PREFSMAN->m_bShowSelectGroup = !!m_iSelectedOption[0][AO_SELECT_GROUP];
(int&)PREFSMAN->m_MusicWheelUsesSections = m_iSelectedOption[0][AO_WHEEL_SECTIONS];
2003-05-20 04:44:41 +00:00
PREFSMAN->m_bShowNative = !m_iSelectedOption[0][AO_SHOW_TRANSLATIONS];
PREFSMAN->m_bShowLyrics = !!m_iSelectedOption[0][AO_SHOW_LYRICS];
PREFSMAN->m_bDancePointsForOni = !!m_iSelectedOption[0][AO_DANCE_POINTS_FOR_ONI];
2002-09-04 22:58:14 +00:00
PREFSMAN->SaveGamePrefsToDisk();
PREFSMAN->SaveGlobalPrefsToDisk();
2002-07-11 19:02:26 +00:00
}
void ScreenAppearanceOptions::GoToPrevState()
{
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
2002-07-11 19:02:26 +00:00
}
void ScreenAppearanceOptions::GoToNextState()
{
2002-07-27 19:29:51 +00:00
PREFSMAN->SaveGamePrefsToDisk();
GoToPrevState();
2002-07-11 19:02:26 +00:00
}