2005-06-25 01:58:14 +00:00
|
|
|
#include "global.h"
|
2005-06-25 20:16:01 +00:00
|
|
|
#include "ScreenEditCourse.h"
|
2005-06-25 01:58:14 +00:00
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "GameState.h"
|
|
|
|
|
#include "SongManager.h"
|
2005-06-25 20:16:01 +00:00
|
|
|
#include "CommonMetrics.h"
|
|
|
|
|
#include "GameManager.h"
|
|
|
|
|
#include "song.h"
|
2005-06-25 01:58:14 +00:00
|
|
|
|
2005-06-25 20:16:01 +00:00
|
|
|
enum EditCourseRow
|
2005-06-25 01:58:14 +00:00
|
|
|
{
|
2005-06-25 20:16:01 +00:00
|
|
|
ROW_TITLE,
|
|
|
|
|
ROW_STEPS_TYPE,
|
|
|
|
|
ROW_DIFFICULTY,
|
|
|
|
|
ROW_METER,
|
|
|
|
|
ROW_SONG_NUMBER,
|
|
|
|
|
ROW_SONG,
|
|
|
|
|
ROW_STEPS,
|
|
|
|
|
ROW_SET_MODS,
|
2005-06-25 01:58:14 +00:00
|
|
|
};
|
|
|
|
|
|
2005-06-25 20:16:01 +00:00
|
|
|
REGISTER_SCREEN_CLASS( ScreenEditCourse );
|
|
|
|
|
ScreenEditCourse::ScreenEditCourse( CString sName ) : ScreenOptions( sName )
|
2005-06-25 01:58:14 +00:00
|
|
|
{
|
2005-06-25 20:16:01 +00:00
|
|
|
LOG->Trace( "ScreenEditCourse::ScreenEditCourse()" );
|
2005-06-25 01:58:14 +00:00
|
|
|
}
|
|
|
|
|
|
2005-06-25 20:16:01 +00:00
|
|
|
void ScreenEditCourse::Init()
|
2005-06-25 01:58:14 +00:00
|
|
|
{
|
|
|
|
|
ScreenOptions::Init();
|
|
|
|
|
|
|
|
|
|
vector<OptionRowDefinition> vDefs;
|
|
|
|
|
vector<OptionRowHandler*> vHands;
|
|
|
|
|
|
|
|
|
|
OptionRowDefinition def;
|
|
|
|
|
def.layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
|
|
|
|
|
2005-06-25 20:16:01 +00:00
|
|
|
Course *pCourse = GAMESTATE->m_pCurCourse;
|
|
|
|
|
|
|
|
|
|
def.name = "Title";
|
2005-06-25 01:58:14 +00:00
|
|
|
def.choices.clear();
|
2005-06-25 20:16:01 +00:00
|
|
|
def.choices.push_back( pCourse->GetTranslitFullTitle() );
|
2005-06-25 01:58:14 +00:00
|
|
|
vDefs.push_back( def );
|
|
|
|
|
vHands.push_back( NULL );
|
|
|
|
|
|
2005-06-25 20:16:01 +00:00
|
|
|
def.name = "Steps Type";
|
|
|
|
|
def.choices.clear();
|
|
|
|
|
FOREACH_CONST( StepsType, STEPS_TYPES_TO_SHOW.GetValue(), st )
|
|
|
|
|
def.choices.push_back( GAMEMAN->StepsTypeToString(*st) );
|
|
|
|
|
vDefs.push_back( def );
|
|
|
|
|
vHands.push_back( NULL );
|
|
|
|
|
|
|
|
|
|
def.name = "Difficulty";
|
2005-06-25 01:58:14 +00:00
|
|
|
def.choices.clear();
|
|
|
|
|
def.choices.push_back( "" );
|
|
|
|
|
vDefs.push_back( def );
|
|
|
|
|
vHands.push_back( NULL );
|
|
|
|
|
|
2005-06-25 20:16:01 +00:00
|
|
|
def.name = "Meter";
|
|
|
|
|
def.choices.clear();
|
|
|
|
|
for( int i=MIN_METER; i<=MAX_METER; i++ )
|
|
|
|
|
def.choices.push_back( ssprintf("%d",i) );
|
|
|
|
|
vDefs.push_back( def );
|
|
|
|
|
vHands.push_back( NULL );
|
|
|
|
|
|
|
|
|
|
def.name = "Song Number";
|
2005-06-25 01:58:14 +00:00
|
|
|
def.choices.clear();
|
|
|
|
|
def.choices.push_back( "" );
|
|
|
|
|
vDefs.push_back( def );
|
|
|
|
|
vHands.push_back( NULL );
|
|
|
|
|
|
2005-06-25 20:16:01 +00:00
|
|
|
def.name = "Song";
|
|
|
|
|
def.choices.clear();
|
|
|
|
|
def.choices.push_back( "" );
|
|
|
|
|
vDefs.push_back( def );
|
|
|
|
|
vHands.push_back( NULL );
|
|
|
|
|
|
|
|
|
|
def.name = "Steps";
|
|
|
|
|
def.choices.clear();
|
|
|
|
|
def.choices.push_back( "" );
|
|
|
|
|
vDefs.push_back( def );
|
|
|
|
|
vHands.push_back( NULL );
|
|
|
|
|
|
|
|
|
|
def.name = "Set Mods";
|
|
|
|
|
def.choices.clear();
|
|
|
|
|
def.choices.push_back( "Set Mods" );
|
|
|
|
|
vDefs.push_back( def );
|
|
|
|
|
vHands.push_back( NULL );
|
|
|
|
|
|
2005-06-25 01:58:14 +00:00
|
|
|
ScreenOptions::InitMenu( INPUTMODE_SHARE_CURSOR, vDefs, vHands );
|
|
|
|
|
|
|
|
|
|
OnChange( GAMESTATE->m_MasterPlayerNumber );
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-25 20:16:01 +00:00
|
|
|
void ScreenEditCourse::HandleScreenMessage( const ScreenMessage SM )
|
2005-06-25 01:58:14 +00:00
|
|
|
{
|
|
|
|
|
ScreenOptions::HandleScreenMessage( SM );
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-25 20:16:01 +00:00
|
|
|
void ScreenEditCourse::OnChange( PlayerNumber pn )
|
2005-06-25 01:58:14 +00:00
|
|
|
{
|
|
|
|
|
ScreenOptions::OnChange( pn );
|
2005-06-25 20:16:01 +00:00
|
|
|
Course *pCourse = GAMESTATE->m_pCurCourse;
|
|
|
|
|
StepsType st = STEPS_TYPE_INVALID;
|
|
|
|
|
CourseDifficulty cd = DIFFICULTY_INVALID;
|
|
|
|
|
Trail *pTrail = NULL;
|
|
|
|
|
int iMeter = -1;
|
|
|
|
|
int iSongNumber = -1;
|
|
|
|
|
Song *pSong = NULL;
|
|
|
|
|
Steps *pSteps = NULL;
|
2005-06-25 01:58:14 +00:00
|
|
|
|
|
|
|
|
switch( m_iCurrentRow[pn] )
|
|
|
|
|
{
|
2005-06-25 20:16:01 +00:00
|
|
|
case ROW_STEPS_TYPE:
|
|
|
|
|
// export StepsType
|
2005-06-25 01:58:14 +00:00
|
|
|
{
|
2005-06-25 20:16:01 +00:00
|
|
|
OptionRow &row = *m_pRows[ROW_STEPS_TYPE];
|
|
|
|
|
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
|
|
|
|
st = STEPS_TYPES_TO_SHOW.GetValue()[iChoice];
|
2005-06-25 01:58:14 +00:00
|
|
|
}
|
2005-06-25 20:16:01 +00:00
|
|
|
// Refresh difficulties
|
2005-06-25 01:58:14 +00:00
|
|
|
{
|
2005-06-25 20:16:01 +00:00
|
|
|
OptionRow &row = *m_pRows[ROW_DIFFICULTY];
|
2005-06-25 01:58:14 +00:00
|
|
|
OptionRowDefinition def = row.GetRowDef();
|
|
|
|
|
def.choices.clear();
|
2005-06-25 20:16:01 +00:00
|
|
|
FOREACH_CONST( CourseDifficulty, COURSE_DIFFICULTIES_TO_SHOW.GetValue(), cd )
|
|
|
|
|
def.choices.push_back( CourseDifficultyToThemedString(*cd) );
|
2005-06-25 01:58:14 +00:00
|
|
|
row.Reload( def );
|
|
|
|
|
}
|
|
|
|
|
// fall through
|
2005-06-25 20:16:01 +00:00
|
|
|
case ROW_DIFFICULTY:
|
|
|
|
|
// export CouresDifficulty
|
2005-06-25 01:58:14 +00:00
|
|
|
{
|
2005-06-25 20:16:01 +00:00
|
|
|
OptionRow &row = *m_pRows[ROW_DIFFICULTY];
|
|
|
|
|
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
|
|
|
|
cd = COURSE_DIFFICULTIES_TO_SHOW.GetValue()[iChoice];
|
|
|
|
|
pTrail = pCourse->GetTrail( st, cd );
|
2005-06-25 01:58:14 +00:00
|
|
|
}
|
2005-06-25 20:16:01 +00:00
|
|
|
// refresh meter
|
2005-06-25 01:58:14 +00:00
|
|
|
{
|
2005-06-25 20:16:01 +00:00
|
|
|
OptionRow &row = *m_pRows[ROW_METER];
|
2005-06-25 01:58:14 +00:00
|
|
|
OptionRowDefinition def = row.GetRowDef();
|
2005-06-25 20:16:01 +00:00
|
|
|
row.SetOneSharedSelection( pTrail->GetMeter()-1 );
|
2005-06-25 01:58:14 +00:00
|
|
|
row.Reload( def );
|
|
|
|
|
}
|
|
|
|
|
// fall through
|
2005-06-25 20:16:01 +00:00
|
|
|
case ROW_METER:
|
|
|
|
|
// export meter
|
|
|
|
|
{
|
|
|
|
|
OptionRow &row = *m_pRows[ROW_METER];
|
|
|
|
|
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
|
|
|
|
iMeter = 1+iChoice;
|
|
|
|
|
}
|
|
|
|
|
// refresh song number
|
|
|
|
|
{
|
|
|
|
|
OptionRow &row = *m_pRows[ROW_SONG_NUMBER];
|
|
|
|
|
OptionRowDefinition def = row.GetRowDef();
|
|
|
|
|
row.SetOneSharedSelection( 0 );
|
|
|
|
|
row.Reload( def );
|
|
|
|
|
}
|
|
|
|
|
// fall through
|
|
|
|
|
case ROW_SONG_NUMBER:
|
|
|
|
|
// export song number
|
|
|
|
|
{
|
|
|
|
|
OptionRow &row = *m_pRows[ROW_SONG_NUMBER];
|
|
|
|
|
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
|
|
|
|
iSongNumber = 1+iChoice;
|
|
|
|
|
}
|
|
|
|
|
// refresh song
|
|
|
|
|
{
|
|
|
|
|
OptionRow &row = *m_pRows[ROW_SONG];
|
|
|
|
|
OptionRowDefinition def = row.GetRowDef();
|
|
|
|
|
row.SetOneSharedSelection( pTrail->GetMeter()-1 );
|
|
|
|
|
row.Reload( def );
|
|
|
|
|
}
|
|
|
|
|
// fall through
|
|
|
|
|
case ROW_SONG:
|
|
|
|
|
// export song
|
|
|
|
|
{
|
|
|
|
|
OptionRow &row = *m_pRows[ROW_SONG];
|
|
|
|
|
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
|
|
|
|
pSong = SONGMAN->GetAllSongs()[iChoice];
|
|
|
|
|
}
|
|
|
|
|
// fall through
|
|
|
|
|
case ROW_STEPS:
|
|
|
|
|
// export steps
|
|
|
|
|
{
|
|
|
|
|
OptionRow &row = *m_pRows[ROW_SONG];
|
|
|
|
|
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
|
|
|
|
pSteps = pSong->GetStepsByStepsType(st)[iChoice];
|
|
|
|
|
}
|
|
|
|
|
// fall through
|
|
|
|
|
case ROW_SET_MODS:
|
2005-06-25 01:58:14 +00:00
|
|
|
// fall through
|
|
|
|
|
default:
|
|
|
|
|
; // nothing left to do
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-25 20:16:01 +00:00
|
|
|
void ScreenEditCourse::ImportOptions( int row, const vector<PlayerNumber> &vpns )
|
2005-06-25 01:58:14 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-25 20:16:01 +00:00
|
|
|
void ScreenEditCourse::ExportOptions( int row, const vector<PlayerNumber> &vpns )
|
2005-06-25 01:58:14 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-25 20:16:01 +00:00
|
|
|
void ScreenEditCourse::GoToNextScreen()
|
2005-06-25 01:58:14 +00:00
|
|
|
{
|
2005-06-25 20:16:01 +00:00
|
|
|
SCREENMAN->SetNewScreen( "ScreenEditCourseMenu" );
|
|
|
|
|
}
|
2005-06-25 01:58:14 +00:00
|
|
|
|
2005-06-25 20:16:01 +00:00
|
|
|
void ScreenEditCourse::GoToPrevScreen()
|
|
|
|
|
{
|
2005-06-25 01:58:14 +00:00
|
|
|
|
2005-06-25 20:16:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenEditCourse::BeginFadingOut()
|
|
|
|
|
{
|
|
|
|
|
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
|
2005-06-25 01:58:14 +00:00
|
|
|
{
|
2005-06-25 20:16:01 +00:00
|
|
|
case ROW_TITLE:
|
2005-06-25 01:58:14 +00:00
|
|
|
break;
|
2005-06-25 20:16:01 +00:00
|
|
|
case ROW_STEPS_TYPE:
|
2005-06-25 01:58:14 +00:00
|
|
|
break;
|
2005-06-25 20:16:01 +00:00
|
|
|
case ROW_DIFFICULTY:
|
2005-06-25 01:58:14 +00:00
|
|
|
break;
|
2005-06-25 20:16:01 +00:00
|
|
|
case ROW_METER:
|
|
|
|
|
break;
|
|
|
|
|
case ROW_SONG_NUMBER:
|
|
|
|
|
break;
|
|
|
|
|
case ROW_SONG:
|
|
|
|
|
break;
|
|
|
|
|
case ROW_STEPS:
|
|
|
|
|
break;
|
|
|
|
|
case ROW_SET_MODS:
|
2005-06-25 01:58:14 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* (c) 2002-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.
|
|
|
|
|
*/
|