working on new course edit screens
This commit is contained in:
@@ -73,10 +73,7 @@ CString CourseEntry::GetTextDescription() const
|
||||
vsEntryDescription.push_back( "Sort: %d" + SongSortToThemedString(songSort) );
|
||||
if( songSort != SongSort_Randomize && iChooseIndex != 0 )
|
||||
vsEntryDescription.push_back( "Choose " + FormatNumberAndSuffix(iChooseIndex) + " match" );
|
||||
int iNumModChanges = 0;
|
||||
if( !sModifiers.empty() )
|
||||
iNumModChanges++;
|
||||
iNumModChanges += attacks.size();
|
||||
int iNumModChanges = GetNumModChanges();
|
||||
if( iNumModChanges != 0 )
|
||||
vsEntryDescription.push_back( ssprintf("%d mod changes", iNumModChanges) );
|
||||
if( fGainSeconds != 0 )
|
||||
@@ -86,6 +83,15 @@ CString CourseEntry::GetTextDescription() const
|
||||
return s;
|
||||
}
|
||||
|
||||
int CourseEntry::GetNumModChanges() const
|
||||
{
|
||||
int iNumModChanges = 0;
|
||||
if( !sModifiers.empty() )
|
||||
iNumModChanges++;
|
||||
iNumModChanges += attacks.size();
|
||||
return iNumModChanges;
|
||||
}
|
||||
|
||||
|
||||
Course::Course()
|
||||
{
|
||||
|
||||
@@ -96,6 +96,7 @@ public:
|
||||
}
|
||||
|
||||
CString GetTextDescription() const;
|
||||
int GetNumModChanges() const;
|
||||
};
|
||||
|
||||
class Course
|
||||
|
||||
@@ -2039,6 +2039,8 @@ public:
|
||||
}
|
||||
static int GetCurrentGame( T* p, lua_State *L ) { const_cast<Game*>(p->GetCurrentGame())->PushSelf( L ); return 1; }
|
||||
static int GetLastSelectedProfileID( T* p, lua_State *L ) { lua_pushstring(L, p->m_sLastSelectedProfileID ); return 1; }
|
||||
static int GetEditCourseEntryIndex( T* p, lua_State *L ) { lua_pushnumber(L, p->m_iEditCourseEntryIndex ); return 1; }
|
||||
|
||||
static void Register(lua_State *L)
|
||||
{
|
||||
ADD_METHOD( IsPlayerEnabled )
|
||||
@@ -2092,6 +2094,7 @@ public:
|
||||
ADD_METHOD( IsWinner )
|
||||
ADD_METHOD( GetCurrentGame )
|
||||
ADD_METHOD( GetLastSelectedProfileID )
|
||||
ADD_METHOD( GetEditCourseEntryIndex )
|
||||
|
||||
Luna<T>::Register( L );
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ ScreenCenterImage.cpp ScreenCenterImage.h ScreenCredits.cpp ScreenCredits.h \
|
||||
ScreenDebugOverlay.cpp ScreenDebugOverlay.h \
|
||||
ScreenDemonstration.cpp ScreenDemonstration.h ScreenDimensions.h \
|
||||
ScreenEdit.cpp ScreenEdit.h \
|
||||
ScreenEditCourseMods.cpp ScreenEditCourseMods.h \
|
||||
ScreenEditMenu.cpp ScreenEditMenu.h ScreenEnding.cpp ScreenEnding.h \
|
||||
ScreenEvaluation.cpp ScreenEvaluation.h ScreenExit.cpp ScreenExit.h ScreenNetEvaluation.cpp ScreenNetEvaluation.h \
|
||||
ScreenNetSelectMusic.cpp ScreenNetSelectMusic.h ScreenNetSelectBase.cpp ScreenNetSelectBase.h ScreenNetRoom.cpp ScreenNetRoom.h \
|
||||
|
||||
@@ -586,7 +586,6 @@ void ScreenEdit::Init()
|
||||
|
||||
m_pSong = GAMESTATE->m_pCurSong;
|
||||
m_pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||
m_pAttacksFromCourse = NULL;
|
||||
m_bReturnToRecordMenuAfterPlay = false;
|
||||
m_fBeatToReturnTo = 0;
|
||||
|
||||
@@ -1571,7 +1570,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
|
||||
if( bUsesThisSong )
|
||||
{
|
||||
g_CourseMode.rows[0].choices.push_back( crs->GetDisplayFullTitle() );
|
||||
if( crs == m_pAttacksFromCourse )
|
||||
if( crs == GAMESTATE->m_pCurCourse )
|
||||
g_CourseMode.rows[0].iDefaultChoice = g_CourseMode.rows[0].choices.size()-1;
|
||||
}
|
||||
}
|
||||
@@ -2154,12 +2153,13 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
|
||||
else if( SM == SM_BackFromCourseModeMenu )
|
||||
{
|
||||
const int num = ScreenMiniMenu::s_viLastAnswers[0];
|
||||
m_pAttacksFromCourse = NULL;
|
||||
GAMESTATE->m_pCurCourse.Set( NULL );
|
||||
if( num != 0 )
|
||||
{
|
||||
const CString name = g_CourseMode.rows[0].choices[num];
|
||||
m_pAttacksFromCourse = SONGMAN->FindCourse( name );
|
||||
ASSERT( m_pAttacksFromCourse );
|
||||
Course *pCourse = SONGMAN->FindCourse( name );
|
||||
GAMESTATE->m_pCurCourse.Set( pCourse );
|
||||
ASSERT( GAMESTATE->m_pCurCourse );
|
||||
}
|
||||
}
|
||||
else if( SM == SM_BackFromOptions )
|
||||
@@ -3036,17 +3036,17 @@ void ScreenEdit::SetupCourseAttacks()
|
||||
GAMESTATE->RemoveActiveAttacksForPlayer( PLAYER_1 );
|
||||
|
||||
|
||||
if( m_pAttacksFromCourse )
|
||||
if( GAMESTATE->m_pCurCourse )
|
||||
{
|
||||
m_pAttacksFromCourse->LoadFromCRSFile( m_pAttacksFromCourse->m_sPath );
|
||||
GAMESTATE->m_pCurCourse->LoadFromCRSFile( GAMESTATE->m_pCurCourse->m_sPath );
|
||||
|
||||
AttackArray Attacks;
|
||||
for( unsigned e = 0; e < m_pAttacksFromCourse->m_vEntries.size(); ++e )
|
||||
for( unsigned e = 0; e < GAMESTATE->m_pCurCourse->m_vEntries.size(); ++e )
|
||||
{
|
||||
if( m_pAttacksFromCourse->m_vEntries[e].pSong != m_pSong )
|
||||
if( GAMESTATE->m_pCurCourse->m_vEntries[e].pSong != m_pSong )
|
||||
continue;
|
||||
|
||||
Attacks = m_pAttacksFromCourse->m_vEntries[e].attacks;
|
||||
Attacks = GAMESTATE->m_pCurCourse->m_vEntries[e].attacks;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -240,7 +240,6 @@ protected:
|
||||
Player m_Player;
|
||||
Background m_Background;
|
||||
Foreground m_Foreground;
|
||||
Course *m_pAttacksFromCourse;
|
||||
bool m_bReturnToRecordMenuAfterPlay;
|
||||
|
||||
// for MODE_RECORD and MODE_PLAY
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#include "global.h"
|
||||
#include "ScreenEditCourseMods.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenEditCourseMods );
|
||||
ScreenEditCourseMods::ScreenEditCourseMods( CString sName ) : ScreenEdit( sName )
|
||||
{
|
||||
LOG->Trace( "ScreenEditCourseMods::ScreenEditCourseMods()" );
|
||||
}
|
||||
|
||||
void ScreenEditCourseMods::Init()
|
||||
{
|
||||
ScreenEdit::Init();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2002-2005 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.
|
||||
*/
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef ScreenEditCourseMods_H
|
||||
#define ScreenEditCourseMods_H
|
||||
|
||||
#include "ScreenEdit.h"
|
||||
|
||||
class ScreenEditCourseMods : public ScreenEdit
|
||||
{
|
||||
public:
|
||||
ScreenEditCourseMods( CString sName );
|
||||
|
||||
void Init();
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (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.
|
||||
*/
|
||||
@@ -894,7 +894,7 @@ void ScreenOptions::ProcessMenuStart( PlayerNumber pn, const InputEventType type
|
||||
if( row.GetFirstItemGoesDown() )
|
||||
{
|
||||
// move to the first choice in the row
|
||||
ChangeValueInRow( pn, -row.GetChoiceInRowWithFocus(pn), type != IET_FIRST_PRESS );
|
||||
ChangeValueInRowRelative( m_iCurrentRow[pn], pn, -row.GetChoiceInRowWithFocus(pn), type != IET_FIRST_PRESS );
|
||||
}
|
||||
}
|
||||
else // data.selectType != SELECT_MULTIPLE
|
||||
@@ -918,9 +918,9 @@ void ScreenOptions::ProcessMenuStart( PlayerNumber pn, const InputEventType type
|
||||
row.SetOneSelection( pn, iChoiceInRow );
|
||||
}
|
||||
if( row.GetFirstItemGoesDown() )
|
||||
ChangeValueInRow( pn, -row.GetChoiceInRowWithFocus(pn), type != IET_FIRST_PRESS ); // move to the first choice
|
||||
ChangeValueInRowRelative( m_iCurrentRow[pn], pn, -row.GetChoiceInRowWithFocus(pn), type != IET_FIRST_PRESS ); // move to the first choice
|
||||
else
|
||||
ChangeValueInRow( pn, 0, type != IET_FIRST_PRESS );
|
||||
ChangeValueInRowRelative( m_iCurrentRow[pn], pn, 0, type != IET_FIRST_PRESS );
|
||||
break;
|
||||
case NAV_THREE_KEY_MENU:
|
||||
/* Don't accept START to go to the next screen if we're still transitioning in. */
|
||||
@@ -951,13 +951,28 @@ void ScreenOptions::StoreFocus( PlayerNumber pn )
|
||||
}
|
||||
|
||||
/* Left/right */
|
||||
void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
|
||||
void ScreenOptions::ChangeValueInRowAbsolute( int iRow, PlayerNumber pn, int iChoiceIndex, bool bRepeat )
|
||||
{
|
||||
const int iCurRow = m_iCurrentRow[pn];
|
||||
if( iCurRow == -1 ) // no row selected
|
||||
if( iRow == -1 ) // no row selected
|
||||
return; // don't allow a move
|
||||
|
||||
OptionRow &row = *m_pRows[iCurRow];
|
||||
OptionRow &row = *m_pRows[iRow];
|
||||
|
||||
const int iNumChoices = row.GetRowDef().m_vsChoices.size();
|
||||
ASSERT( iNumChoices >= 0 && iChoiceIndex < iNumChoices );
|
||||
|
||||
int iCurrentChoiceWithFocus = row.GetChoiceInRowWithFocus(pn);
|
||||
int iDelta = iChoiceIndex - iCurrentChoiceWithFocus;
|
||||
|
||||
ChangeValueInRowRelative( iRow, pn, iDelta, bRepeat );
|
||||
}
|
||||
|
||||
void ScreenOptions::ChangeValueInRowRelative( int iRow, PlayerNumber pn, int iDelta, bool bRepeat )
|
||||
{
|
||||
if( iRow == -1 ) // no row selected
|
||||
return; // don't allow a move
|
||||
|
||||
OptionRow &row = *m_pRows[iRow];
|
||||
|
||||
const int iNumChoices = row.GetRowDef().m_vsChoices.size();
|
||||
|
||||
@@ -968,14 +983,14 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
|
||||
*
|
||||
* XXX: Only allow repeats if the opposite key isn't pressed; otherwise, holding both
|
||||
* directions will repeat in place continuously, which is weird. */
|
||||
MoveRowRelative( pn, iDelta, Repeat );
|
||||
MoveRowRelative( pn, iDelta, bRepeat );
|
||||
return;
|
||||
}
|
||||
|
||||
if( iNumChoices <= 1 ) // nowhere to move
|
||||
return;
|
||||
|
||||
if( Repeat && !ALLOW_REPEATING_CHANGE_VALUE_INPUT )
|
||||
if( bRepeat && !ALLOW_REPEATING_CHANGE_VALUE_INPUT )
|
||||
return;
|
||||
|
||||
bool bOneChanged = false;
|
||||
@@ -983,7 +998,6 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
|
||||
|
||||
int iCurrentChoiceWithFocus = row.GetChoiceInRowWithFocus(pn);
|
||||
int iNewChoiceWithFocus = iCurrentChoiceWithFocus + iDelta;
|
||||
ASSERT( iNumChoices > 0 );
|
||||
wrap( iNewChoiceWithFocus, iNumChoices );
|
||||
|
||||
if( iCurrentChoiceWithFocus != iNewChoiceWithFocus )
|
||||
@@ -1049,9 +1063,9 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
|
||||
}
|
||||
}
|
||||
|
||||
UpdateText( iCurRow );
|
||||
UpdateText( iRow );
|
||||
|
||||
this->AfterChangeValueInRow( pn );
|
||||
this->AfterChangeValueInRow( iRow, pn );
|
||||
|
||||
if( m_OptionsNavigation != NAV_THREE_KEY_MENU )
|
||||
m_SoundChangeCol.Play();
|
||||
@@ -1061,11 +1075,11 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
|
||||
vector<PlayerNumber> vpns;
|
||||
FOREACH_HumanPlayer( p )
|
||||
vpns.push_back( p );
|
||||
ExportOptions( iCurRow, vpns );
|
||||
ExportOptions( iRow, vpns );
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenOptions::AfterChangeValueInRow( PlayerNumber pn )
|
||||
void ScreenOptions::AfterChangeValueInRow( int iRow, PlayerNumber pn )
|
||||
{
|
||||
AfterChangeValueOrRow( pn );
|
||||
}
|
||||
|
||||
@@ -66,15 +66,16 @@ protected:
|
||||
|
||||
virtual void BeginFadingOut() { this->PostScreenMessage( SM_BeginFadingOut, 0 ); }
|
||||
|
||||
void ChangeValueInRow( PlayerNumber pn, int iDelta, bool bRepeat );
|
||||
virtual void AfterChangeValueInRow( PlayerNumber pn ); // override this to detect when the value in a row has changed
|
||||
void ChangeValueInRowRelative( int iRow, PlayerNumber pn, int iDelta, bool bRepeat );
|
||||
void ChangeValueInRowAbsolute( int iRow, PlayerNumber pn, int iChoiceIndex, bool bRepeat );
|
||||
virtual void AfterChangeValueInRow( int iRow, PlayerNumber pn ); // override this to detect when the value in a row has changed
|
||||
void MoveRowRelative( PlayerNumber pn, int iDir, bool bRepeat );
|
||||
void MoveRowAbsolute( PlayerNumber pn, int iRow, bool bRepeat );
|
||||
virtual void AfterChangeRow( PlayerNumber pn ); // override this to detect when the row has changed
|
||||
virtual void AfterChangeValueOrRow( PlayerNumber pn );
|
||||
|
||||
void MenuLeft( PlayerNumber pn, const InputEventType type ) { ChangeValueInRow(pn,-1,type != IET_FIRST_PRESS); }
|
||||
void MenuRight( PlayerNumber pn, const InputEventType type ) { ChangeValueInRow(pn,+1,type != IET_FIRST_PRESS); }
|
||||
void MenuLeft( PlayerNumber pn, const InputEventType type ) { ChangeValueInRowRelative(m_iCurrentRow[pn],pn,-1,type != IET_FIRST_PRESS); }
|
||||
void MenuRight( PlayerNumber pn, const InputEventType type ) { ChangeValueInRowRelative(m_iCurrentRow[pn],pn,+1,type != IET_FIRST_PRESS); }
|
||||
void MenuUp( PlayerNumber pn, const InputEventType type );
|
||||
void MenuDown( PlayerNumber pn, const InputEventType type );
|
||||
void MenuSelect( PlayerNumber pn, const InputEventType type );
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "CommonMetrics.h"
|
||||
#include "GameManager.h"
|
||||
#include "song.h"
|
||||
#include "FontCharAliases.h"
|
||||
#include "Steps.h"
|
||||
|
||||
enum EditCourseEntryRow
|
||||
{
|
||||
@@ -24,6 +24,26 @@ enum EditCourseEntryRow
|
||||
};
|
||||
#define FOREACH_EditCourseEntryRow( i ) FOREACH_ENUM( EditCourseEntryRow, NUM_EditCourseEntryRow, i )
|
||||
|
||||
static void FillSongsAndChoices( const CString &sSongGroup, vector<Song*> &vpSongsOut, vector<CString> &vsChoicesOut )
|
||||
{
|
||||
vpSongsOut.clear();
|
||||
vsChoicesOut.clear();
|
||||
|
||||
if( sSongGroup.empty() )
|
||||
SONGMAN->GetSongs( vpSongsOut );
|
||||
else
|
||||
SONGMAN->GetSongs( vpSongsOut, sSongGroup );
|
||||
vpSongsOut.insert( vpSongsOut.begin(), NULL );
|
||||
|
||||
FOREACH_CONST( Song*, vpSongsOut, s )
|
||||
{
|
||||
if( *s == NULL )
|
||||
vsChoicesOut.push_back( "(any)" );
|
||||
else
|
||||
vsChoicesOut.push_back( (*s)->GetTranslitFullTitle() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenOptionsEditCourseEntry );
|
||||
ScreenOptionsEditCourseEntry::ScreenOptionsEditCourseEntry( CString sName ) : ScreenOptions( sName )
|
||||
@@ -38,7 +58,8 @@ void ScreenOptionsEditCourseEntry::Init()
|
||||
|
||||
// save a backup that we'll use if we revert.
|
||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
m_Original = pCourse->m_vEntries[ GAMESTATE->m_iEditCourseEntryIndex ];
|
||||
const CourseEntry &ce = pCourse->m_vEntries[ GAMESTATE->m_iEditCourseEntryIndex ];
|
||||
m_Original = ce;
|
||||
|
||||
|
||||
vector<OptionRowDefinition> vDefs;
|
||||
@@ -59,9 +80,7 @@ void ScreenOptionsEditCourseEntry::Init()
|
||||
|
||||
def.m_sName = "Song";
|
||||
def.m_vsChoices.clear();
|
||||
CString sStart = "&Start;";
|
||||
FontCharAliases::ReplaceMarkers( sStart );
|
||||
def.m_vsChoices.push_back( sStart );
|
||||
FillSongsAndChoices( ce.sSongGroup, m_vpDisplayedSongs, def.m_vsChoices );
|
||||
vDefs.push_back( def );
|
||||
vHands.push_back( NULL );
|
||||
|
||||
@@ -105,7 +124,8 @@ void ScreenOptionsEditCourseEntry::Init()
|
||||
|
||||
def.m_sName = "Set Mods";
|
||||
def.m_vsChoices.clear();
|
||||
def.m_vsChoices.push_back( "Set Mods" );
|
||||
CString s = ssprintf( "%d mod changes", ce.GetNumModChanges() );
|
||||
def.m_vsChoices.push_back( s );
|
||||
vDefs.push_back( def );
|
||||
vHands.push_back( NULL );
|
||||
|
||||
@@ -115,12 +135,12 @@ void ScreenOptionsEditCourseEntry::Init()
|
||||
void ScreenOptionsEditCourseEntry::BeginScreen()
|
||||
{
|
||||
ScreenOptions::BeginScreen();
|
||||
|
||||
ImportAllOptions();
|
||||
}
|
||||
|
||||
void ScreenOptionsEditCourseEntry::HandleScreenMessage( const ScreenMessage SM )
|
||||
{
|
||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
|
||||
if( SM == SM_GoToNextScreen )
|
||||
{
|
||||
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
|
||||
@@ -133,7 +153,20 @@ void ScreenOptionsEditCourseEntry::HandleScreenMessage( const ScreenMessage SM )
|
||||
case ROW_CHOOSE_INDEX:
|
||||
break;
|
||||
case ROW_SET_MODS:
|
||||
SCREENMAN->SetNewScreen( "ScreenEditCourseMods" );
|
||||
{
|
||||
Trail *pTrail = pCourse->GetTrail( STEPS_TYPE_DANCE_SINGLE );
|
||||
TrailEntry *pTrailEntry = &pTrail->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex];
|
||||
Song *pSong = pTrailEntry->pSong;
|
||||
Steps *pSteps = pTrailEntry->pSteps;
|
||||
|
||||
// Set up for ScreenEdit
|
||||
const Style *pStyle = GAMEMAN->GetEditorStyleForStepsType(pSteps->m_StepsType);
|
||||
GAMESTATE->m_pCurStyle.Set( pStyle );
|
||||
GAMESTATE->m_pCurSong.Set( pSong );
|
||||
GAMESTATE->m_pCurSteps[PLAYER_1].Set( pSteps );
|
||||
|
||||
SCREENMAN->SetNewScreen( "ScreenEditCourseMods" );
|
||||
}
|
||||
break;
|
||||
case ROW_DONE:
|
||||
SCREENMAN->SetNewScreen( "ScreenOptionsEditCourse" );
|
||||
@@ -144,7 +177,6 @@ void ScreenOptionsEditCourseEntry::HandleScreenMessage( const ScreenMessage SM )
|
||||
else if( SM == SM_GoToPrevScreen )
|
||||
{
|
||||
// revert
|
||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
pCourse->m_vEntries[ GAMESTATE->m_iEditCourseEntryIndex ] = m_Original;
|
||||
|
||||
SCREENMAN->SetNewScreen( "ScreenOptionsEditCourse" );
|
||||
@@ -154,16 +186,132 @@ void ScreenOptionsEditCourseEntry::HandleScreenMessage( const ScreenMessage SM )
|
||||
ScreenOptions::HandleScreenMessage( SM );
|
||||
}
|
||||
|
||||
void ScreenOptionsEditCourseEntry::AfterChangeValueInRow( PlayerNumber pn )
|
||||
void ScreenOptionsEditCourseEntry::AfterChangeValueInRow( int iRow, PlayerNumber pn )
|
||||
{
|
||||
ScreenOptions::AfterChangeValueInRow( pn );
|
||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
CourseEntry &ce = pCourse->m_vEntries[ GAMESTATE->m_iEditCourseEntryIndex ];
|
||||
ScreenOptions::AfterChangeValueInRow( iRow, pn );
|
||||
|
||||
switch( m_iCurrentRow[pn] )
|
||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
int iEntryIndex = GAMESTATE->m_iEditCourseEntryIndex;
|
||||
ASSERT( iEntryIndex >= 0 && iEntryIndex < pCourse->m_vEntries.size() );
|
||||
CourseEntry &ce = pCourse->m_vEntries[ iEntryIndex ];
|
||||
|
||||
switch( iRow )
|
||||
{
|
||||
case ROW_SONG_GROUP:
|
||||
// refresh songs
|
||||
{
|
||||
vector<PlayerNumber> vpns;
|
||||
vpns.push_back( PLAYER_1 );
|
||||
ExportOptions( ROW_SONG_GROUP, vpns );
|
||||
|
||||
OptionRow &row = *m_pRows[ROW_SONG];
|
||||
OptionRowDefinition def = row.GetRowDef();
|
||||
FillSongsAndChoices( ce.sSongGroup, m_vpDisplayedSongs, def.m_vsChoices );
|
||||
|
||||
row.Reload( def );
|
||||
|
||||
vector<Song*>::const_iterator iter = find( m_vpDisplayedSongs.begin(), m_vpDisplayedSongs.end(), ce.pSong );
|
||||
if( iter == m_vpDisplayedSongs.end() )
|
||||
{
|
||||
this->ChangeValueInRowAbsolute( ROW_SONG, PLAYER_1, 0, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
int iSongIndex = iter - m_vpDisplayedSongs.begin();
|
||||
this->ChangeValueInRowAbsolute( ROW_SONG, PLAYER_1, iSongIndex, false );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenOptionsEditCourseEntry::ImportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
||||
{
|
||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
int iEntryIndex = GAMESTATE->m_iEditCourseEntryIndex;
|
||||
ASSERT( iEntryIndex >= 0 && iEntryIndex < pCourse->m_vEntries.size() );
|
||||
CourseEntry &ce = pCourse->m_vEntries[ iEntryIndex ];
|
||||
|
||||
OptionRow &row = *m_pRows[iRow];
|
||||
|
||||
switch( iRow )
|
||||
{
|
||||
case ROW_SONG_GROUP:
|
||||
FOREACH_CONST( CString, row.GetRowDef().m_vsChoices, s )
|
||||
{
|
||||
if( *s == ce.sSongGroup )
|
||||
{
|
||||
int iChoice = s - row.GetRowDef().m_vsChoices.begin();
|
||||
row.SetOneSharedSelection( iChoice );
|
||||
AfterChangeValueInRow( iRow, GAMESTATE->m_MasterPlayerNumber );
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ROW_SONG:
|
||||
{
|
||||
vector<Song*>::const_iterator iter = find( m_vpDisplayedSongs.begin(), m_vpDisplayedSongs.end(), ce.pSong );
|
||||
int iChoice = 0;
|
||||
if( iter != m_vpDisplayedSongs.end() )
|
||||
iChoice = iter - m_vpDisplayedSongs.begin();
|
||||
OptionRow &row = *m_pRows[ROW_SONG];
|
||||
row.SetOneSharedSelection( iChoice );
|
||||
}
|
||||
break;
|
||||
case ROW_BASE_DIFFICULTY:
|
||||
{
|
||||
vector<Difficulty>::const_iterator iter = find( DIFFICULTIES_TO_SHOW.GetValue().begin(), DIFFICULTIES_TO_SHOW.GetValue().end(), ce.baseDifficulty );
|
||||
int iChoice = 0;
|
||||
if( iter != DIFFICULTIES_TO_SHOW.GetValue().end() )
|
||||
iChoice = iter - DIFFICULTIES_TO_SHOW.GetValue().begin() + 1;
|
||||
OptionRow &row = *m_pRows[ROW_BASE_DIFFICULTY];
|
||||
row.SetOneSharedSelection( iChoice );
|
||||
}
|
||||
break;
|
||||
case ROW_LOW_METER:
|
||||
{
|
||||
int iChoice = 0;
|
||||
if( ce.iLowMeter != -1 )
|
||||
iChoice = ce.iLowMeter;
|
||||
OptionRow &row = *m_pRows[ROW_LOW_METER];
|
||||
row.SetOneSharedSelection( iChoice );
|
||||
}
|
||||
break;
|
||||
case ROW_HIGH_METER:
|
||||
{
|
||||
int iChoice = 0;
|
||||
if( ce.iHighMeter != -1 )
|
||||
iChoice = ce.iHighMeter;
|
||||
OptionRow &row = *m_pRows[ROW_HIGH_METER];
|
||||
row.SetOneSharedSelection( iChoice );
|
||||
}
|
||||
break;
|
||||
case ROW_SORT:
|
||||
{
|
||||
int iChoice = ce.songSort;
|
||||
OptionRow &row = *m_pRows[ROW_SORT];
|
||||
row.SetOneSharedSelection( iChoice );
|
||||
}
|
||||
break;
|
||||
case ROW_CHOOSE_INDEX:
|
||||
{
|
||||
int iChoice = ce.iChooseIndex;
|
||||
OptionRow &row = *m_pRows[ROW_CHOOSE_INDEX];
|
||||
row.SetOneSharedSelection( iChoice );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenOptionsEditCourseEntry::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
||||
{
|
||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
int iEntryIndex = GAMESTATE->m_iEditCourseEntryIndex;
|
||||
ASSERT( iEntryIndex >= 0 && iEntryIndex < pCourse->m_vEntries.size() );
|
||||
CourseEntry &ce = pCourse->m_vEntries[ iEntryIndex ];
|
||||
|
||||
switch( iRow )
|
||||
{
|
||||
case ROW_SONG_GROUP:
|
||||
// export song group
|
||||
{
|
||||
OptionRow &row = *m_pRows[ROW_SONG_GROUP];
|
||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
||||
@@ -172,53 +320,25 @@ void ScreenOptionsEditCourseEntry::AfterChangeValueInRow( PlayerNumber pn )
|
||||
else
|
||||
ce.sSongGroup = row.GetRowDef().m_vsChoices[ iChoice ];
|
||||
}
|
||||
// refresh songs
|
||||
{
|
||||
OptionRow &row = *m_pRows[ROW_SONG];
|
||||
OptionRowDefinition def = row.GetRowDef();
|
||||
def.m_vsChoices.clear();
|
||||
def.m_vsChoices.push_back( "(any)" );
|
||||
vector<Song*> vpSongs;
|
||||
if( ce.sSongGroup.empty() )
|
||||
SONGMAN->GetSongs( vpSongs );
|
||||
else
|
||||
SONGMAN->GetSongs( vpSongs, ce.sSongGroup );
|
||||
FOREACH_CONST( Song*, vpSongs, s )
|
||||
def.m_vsChoices.push_back( (*s)->GetTranslitFullTitle() );
|
||||
vector<Song*>::const_iterator iter = find( vpSongs.begin(), vpSongs.end(), ce.pSong );
|
||||
if( iter != vpSongs.end() )
|
||||
{
|
||||
int iSongIndex = iter - vpSongs.begin();
|
||||
row.SetOneSharedSelection( iSongIndex+1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
row.SetOneSharedSelection( 0 );
|
||||
}
|
||||
row.Reload( def );
|
||||
}
|
||||
// fall through
|
||||
break;
|
||||
case ROW_SONG:
|
||||
// export song
|
||||
{
|
||||
OptionRow &row = *m_pRows[ROW_SONG];
|
||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
||||
if( iChoice == 0 )
|
||||
ce.pSong = NULL;
|
||||
else
|
||||
ce.pSong = SONGMAN->GetAllSongs()[iChoice-1];
|
||||
ce.pSong = m_vpDisplayedSongs[iChoice-1];
|
||||
}
|
||||
// fall through
|
||||
break;
|
||||
case ROW_BASE_DIFFICULTY:
|
||||
// export difficulty
|
||||
{
|
||||
OptionRow &row = *m_pRows[ROW_BASE_DIFFICULTY];
|
||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
||||
ce.baseDifficulty = DIFFICULTIES_TO_SHOW.GetValue()[iChoice];
|
||||
}
|
||||
// fall through
|
||||
break;
|
||||
case ROW_LOW_METER:
|
||||
// export low meter
|
||||
{
|
||||
OptionRow &row = *m_pRows[ROW_LOW_METER];
|
||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
||||
@@ -227,9 +347,8 @@ void ScreenOptionsEditCourseEntry::AfterChangeValueInRow( PlayerNumber pn )
|
||||
else
|
||||
ce.iLowMeter = iChoice;
|
||||
}
|
||||
// fall through
|
||||
break;
|
||||
case ROW_HIGH_METER:
|
||||
// export high meter
|
||||
{
|
||||
OptionRow &row = *m_pRows[ROW_HIGH_METER];
|
||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
||||
@@ -238,108 +357,24 @@ void ScreenOptionsEditCourseEntry::AfterChangeValueInRow( PlayerNumber pn )
|
||||
else
|
||||
ce.iHighMeter = iChoice;
|
||||
}
|
||||
// fall through
|
||||
break;
|
||||
case ROW_SORT:
|
||||
// export sort
|
||||
{
|
||||
OptionRow &row = *m_pRows[ROW_SORT];
|
||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
||||
ce.songSort = (SongSort)iChoice;
|
||||
}
|
||||
// fall through
|
||||
break;
|
||||
case ROW_CHOOSE_INDEX:
|
||||
// export choose index
|
||||
{
|
||||
OptionRow &row = *m_pRows[ROW_CHOOSE_INDEX];
|
||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
||||
ce.iChooseIndex = iChoice;
|
||||
}
|
||||
// fall through
|
||||
case ROW_SET_MODS:
|
||||
// fall through
|
||||
default:
|
||||
; // nothing left to do
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenOptionsEditCourseEntry::ImportAllOptions()
|
||||
{
|
||||
// fill choices before importing
|
||||
AfterChangeValueInRow( GAMESTATE->m_MasterPlayerNumber );
|
||||
|
||||
|
||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
CourseEntry &ce = pCourse->m_vEntries[ GAMESTATE->m_iEditCourseEntryIndex ];
|
||||
|
||||
// import song group
|
||||
{
|
||||
OptionRow &row = *m_pRows[ROW_SONG_GROUP];
|
||||
FOREACH_CONST( CString, row.GetRowDef().m_vsChoices, s )
|
||||
{
|
||||
if( *s == ce.sSongGroup )
|
||||
{
|
||||
int iChoice = s - row.GetRowDef().m_vsChoices.begin();
|
||||
row.SetOneSharedSelection( iChoice );
|
||||
AfterChangeValueInRow( GAMESTATE->m_MasterPlayerNumber );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// import song
|
||||
{
|
||||
vector<Song*> vpSongs;
|
||||
SONGMAN->GetSongs( vpSongs, ce.sSongGroup );
|
||||
vector<Song*>::const_iterator iter = find( vpSongs.begin(), vpSongs.end(), ce.pSong );
|
||||
int iChoice = 0;
|
||||
if( iter != vpSongs.end() )
|
||||
iChoice = iter - vpSongs.begin() + 1;
|
||||
OptionRow &row = *m_pRows[ROW_SONG];
|
||||
row.SetOneSharedSelection( iChoice );
|
||||
}
|
||||
// import base difficulty
|
||||
{
|
||||
vector<Difficulty>::const_iterator iter = find( DIFFICULTIES_TO_SHOW.GetValue().begin(), DIFFICULTIES_TO_SHOW.GetValue().end(), ce.baseDifficulty );
|
||||
int iChoice = 0;
|
||||
if( iter != DIFFICULTIES_TO_SHOW.GetValue().end() )
|
||||
iChoice = iter - DIFFICULTIES_TO_SHOW.GetValue().begin() + 1;
|
||||
OptionRow &row = *m_pRows[ROW_BASE_DIFFICULTY];
|
||||
row.SetOneSharedSelection( iChoice );
|
||||
}
|
||||
// import low meter
|
||||
{
|
||||
int iChoice = 0;
|
||||
if( ce.iLowMeter != -1 )
|
||||
iChoice = ce.iLowMeter;
|
||||
OptionRow &row = *m_pRows[ROW_LOW_METER];
|
||||
row.SetOneSharedSelection( iChoice );
|
||||
}
|
||||
// import high meter
|
||||
{
|
||||
int iChoice = 0;
|
||||
if( ce.iHighMeter != -1 )
|
||||
iChoice = ce.iHighMeter;
|
||||
OptionRow &row = *m_pRows[ROW_HIGH_METER];
|
||||
row.SetOneSharedSelection( iChoice );
|
||||
}
|
||||
// import sort
|
||||
{
|
||||
int iChoice = ce.songSort;
|
||||
OptionRow &row = *m_pRows[ROW_SORT];
|
||||
row.SetOneSharedSelection( iChoice );
|
||||
}
|
||||
// import choose index
|
||||
{
|
||||
int iChoice = ce.iChooseIndex;
|
||||
OptionRow &row = *m_pRows[ROW_CHOOSE_INDEX];
|
||||
row.SetOneSharedSelection( iChoice );
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenOptionsEditCourseEntry::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ScreenOptionsEditCourseEntry::ProcessMenuStart( PlayerNumber pn, const InputEventType type )
|
||||
{
|
||||
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
|
||||
@@ -359,6 +394,7 @@ void ScreenOptionsEditCourseEntry::ProcessMenuStart( PlayerNumber pn, const Inpu
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2002-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "ScreenOptions.h"
|
||||
#include "Course.h"
|
||||
class Song;
|
||||
|
||||
class ScreenOptionsEditCourseEntry : public ScreenOptions
|
||||
{
|
||||
@@ -15,15 +16,16 @@ public:
|
||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||
|
||||
protected:
|
||||
virtual void ImportOptions( int iRow, const vector<PlayerNumber> &vpns ) {}
|
||||
|
||||
virtual void ImportOptions( int iRow, const vector<PlayerNumber> &vpns );
|
||||
virtual void ExportOptions( int iRow, const vector<PlayerNumber> &vpns );
|
||||
|
||||
virtual void AfterChangeValueInRow( PlayerNumber pn );
|
||||
virtual void AfterChangeValueInRow( int iRow, PlayerNumber pn );
|
||||
virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type );
|
||||
|
||||
void ImportAllOptions();
|
||||
vector<Song*> m_vpDisplayedSongs; // corresponds with the choices in the Song row
|
||||
|
||||
CourseEntry m_Original;
|
||||
CourseEntry m_Original; // use this to revert when cancelling
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -303,6 +303,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath="ScreenEdit.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScreenEditCourseMods.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScreenEditCourseMods.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenEditMenu.cpp">
|
||||
</File>
|
||||
|
||||
@@ -62,7 +62,7 @@ IntDir=.\../Debug6
|
||||
TargetDir=\cvs\stepmania\Program
|
||||
TargetName=StepMania-debug
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -99,7 +99,7 @@ IntDir=.\../Release6
|
||||
TargetDir=\cvs\stepmania\Program
|
||||
TargetName=StepMania
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -2542,6 +2542,14 @@ SOURCE=.\ScreenEdit.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenEditCourseMods.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenEditCourseMods.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenEditMenu.cpp
|
||||
|
||||
!IF "$(CFG)" == "StepMania - Win32 Debug"
|
||||
|
||||
@@ -283,6 +283,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath="ScreenEdit.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenEditCourseMods.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenEditCourseMods.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenEditMenu.cpp">
|
||||
</File>
|
||||
|
||||
Reference in New Issue
Block a user