Files
itgmania212121/stepmania/src/ScreenOptionsEditProfile.cpp
T

174 lines
4.5 KiB
C++
Raw Normal View History

2005-07-13 19:25:39 +00:00
#include "global.h"
#include "ScreenOptionsEditProfile.h"
2005-07-20 09:48:19 +00:00
#include "ScreenManager.h"
2005-07-13 19:25:39 +00:00
#include "ProfileManager.h"
#include "ScreenTextEntry.h"
#include "ScreenPrompt.h"
#include "RageUtil.h"
#include "GameState.h"
#include "Profile.h"
#include "Character.h"
2005-08-14 21:58:13 +00:00
#include "CharacterManager.h"
2005-07-13 19:25:39 +00:00
enum EditProfileRow
{
ROW_CHARACTER,
};
REGISTER_SCREEN_CLASS( ScreenOptionsEditProfile );
ScreenOptionsEditProfile::ScreenOptionsEditProfile( CString sName ) :
ScreenOptions( sName )
{
}
void ScreenOptionsEditProfile::Init()
{
ScreenOptions::Init();
}
2005-07-13 19:25:39 +00:00
void ScreenOptionsEditProfile::BeginScreen()
{
2005-08-05 10:07:49 +00:00
m_Original = *GAMESTATE->GetEditLocalProfile();
2005-07-13 19:25:39 +00:00
vector<OptionRowDefinition> vDefs;
vector<OptionRowHandler*> vHands;
OptionRowDefinition def;
def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
def.m_bOneChoiceForAllPlayers = true;
def.m_bAllowThemeItems = false;
def.m_bAllowThemeTitles = false;
def.m_bAllowExplanation = false;
2005-08-05 10:07:49 +00:00
def.m_bExportOnChange = true;
2005-07-13 19:25:39 +00:00
2005-08-14 01:56:50 +00:00
Profile *pProfile = PROFILEMAN->GetLocalProfile( GAMESTATE->m_sEditLocalProfileID );
ASSERT( pProfile );
2005-07-13 19:25:39 +00:00
{
def.m_sName = "Character";
def.m_vsChoices.clear();
vector<Character*> vpCharacters;
2005-08-14 21:58:13 +00:00
CHARMAN->GetCharacters( vpCharacters );
2005-07-13 19:25:39 +00:00
FOREACH_CONST( Character*, vpCharacters, c )
2005-08-14 01:56:50 +00:00
def.m_vsChoices.push_back( (*c)->GetDisplayName() );
2005-07-13 19:25:39 +00:00
vDefs.push_back( def );
vHands.push_back( NULL );
}
2005-07-15 21:45:14 +00:00
InitMenu( vDefs, vHands );
ScreenOptions::BeginScreen();
2005-07-13 19:25:39 +00:00
}
ScreenOptionsEditProfile::~ScreenOptionsEditProfile()
{
}
void ScreenOptionsEditProfile::ImportOptions( int iRow, const vector<PlayerNumber> &vpns )
{
2005-08-14 01:56:50 +00:00
Profile *pProfile = PROFILEMAN->GetLocalProfile( GAMESTATE->m_sEditLocalProfileID );
ASSERT( pProfile );
2005-07-14 05:33:50 +00:00
OptionRow &row = *m_pRows[iRow];
2005-07-13 19:25:39 +00:00
switch( iRow )
{
case ROW_CHARACTER:
2005-08-14 01:56:50 +00:00
row.SetOneSharedSelectionIfPresent( pProfile->m_sCharacterID );
2005-07-13 19:25:39 +00:00
break;
}
}
void ScreenOptionsEditProfile::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
{
2005-08-14 01:56:50 +00:00
Profile *pProfile = PROFILEMAN->GetLocalProfile( GAMESTATE->m_sEditLocalProfileID );
ASSERT( pProfile );
2005-07-14 05:33:50 +00:00
OptionRow &row = *m_pRows[iRow];
int iIndex = row.GetOneSharedSelection( true );
CString sValue;
if( iIndex >= 0 )
sValue = row.GetRowDef().m_vsChoices[ iIndex ];
2005-07-13 19:25:39 +00:00
2005-07-14 05:33:50 +00:00
switch( iRow )
{
case ROW_CHARACTER:
2005-08-14 01:56:50 +00:00
pProfile->m_sCharacterID = sValue;
2005-07-14 05:33:50 +00:00
break;
}
2005-07-13 19:25:39 +00:00
}
void ScreenOptionsEditProfile::GoToNextScreen()
{
}
void ScreenOptionsEditProfile::GoToPrevScreen()
{
}
void ScreenOptionsEditProfile::HandleScreenMessage( const ScreenMessage SM )
{
2005-08-05 04:20:46 +00:00
if( SM == SM_GoToNextScreen )
{
PROFILEMAN->SaveLocalProfile( GAMESTATE->m_sEditLocalProfileID );
}
2005-08-05 10:07:49 +00:00
else if( SM == SM_GoToPrevScreen )
{
*GAMESTATE->GetEditLocalProfile() = m_Original;
}
2005-08-05 04:20:46 +00:00
2005-07-13 19:25:39 +00:00
ScreenOptions::HandleScreenMessage( SM );
}
2005-08-05 10:07:49 +00:00
void ScreenOptionsEditProfile::AfterChangeValueInRow( int iRow, PlayerNumber pn )
{
ScreenOptions::AfterChangeValueInRow( iRow, pn );
// cause the overlay to reload
GAMESTATE->m_sEditLocalProfileID.Set( GAMESTATE->m_sEditLocalProfileID );
}
void ScreenOptionsEditProfile::ProcessMenuStart( const InputEventPlus &input )
2005-07-13 19:25:39 +00:00
{
int iRow = GetCurrentRow();;
2005-08-15 07:49:38 +00:00
//OptionRow &row = *m_pRows[iRow];
2005-07-13 19:25:39 +00:00
switch( iRow )
{
case ROW_CHARACTER:
{
}
break;
2005-07-14 05:33:50 +00:00
default:
ScreenOptions::ProcessMenuStart( input );
2005-07-14 05:33:50 +00:00
break;
2005-07-13 19:25:39 +00:00
}
}
/*
* (c) 2003-2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/