Fixes to Extra Stage

This commit is contained in:
Chris Danford
2002-08-01 13:42:56 +00:00
parent 0e0a328191
commit 4c12a0921b
31 changed files with 480 additions and 121 deletions
+7 -5
View File
@@ -70,6 +70,7 @@ void Course::LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs )
{
CString sSongDir = "Songs\\" + sParams[1] + "\\";
CString sNotesDescription = sParams[2];
CString sModifiers = sParams[3];
int i;
@@ -83,7 +84,7 @@ void Course::LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs )
if( pSong == NULL ) // we didn't find the Song
continue; // skip this song
AddStage( pSong, sNotesDescription );
AddStage( pSong, sNotesDescription, sModifiers );
}
else
@@ -110,7 +111,7 @@ void Course::CreateEndlessCourseFromGroupAndDifficultyClass( CString sGroupName,
for( int s=0; s<apSongsInGroup.GetSize(); s++ )
{
Song* pSong = apSongsInGroup[s];
AddStage( pSong, DifficultyClassToString(dc) );
AddStage( pSong, DifficultyClassToString(dc), "" );
}
}
@@ -144,19 +145,20 @@ Notes* Course::GetNotesForStage( int iStage )
}
void Course::GetSongAndNotesForCurrentStyle( CArray<Song*,Song*>& apSongsOut, CArray<Notes*,Notes*> apNotesOut[NUM_PLAYERS] )
void Course::GetSongAndNotesForCurrentStyle( CArray<Song*,Song*>& apSongsOut, CArray<Notes*,Notes*>& apNotesOut, CStringArray& asModifiersOut )
{
for( int i=0; i<m_iStages; i++ )
{
Song* pSong = m_apSongs[i];
Notes* pNotes = GetNotesForStage( i );
CString sModifiers = m_asModifiers[i];
if( pNotes == NULL )
continue; // skip
apSongsOut.Add( pSong );
for( int p=0; p<NUM_PLAYERS; p++ )
apNotesOut[p].Add( pNotes );
apNotesOut.Add( pNotes );
asModifiersOut.Add( sModifiers );
}
}
+4 -3
View File
@@ -41,10 +41,10 @@ public:
Song* m_apSongs[MAX_COURSE_STAGES];
CString m_asDescriptions[MAX_COURSE_STAGES];
Notes* GetNotesForStage( int iStage );
CString m_asModifiers[MAX_COURSE_STAGES]; // set player and song options from these
bool m_bRepeat; // repeat after last song?
bool m_bRandomize; // play the songs in a random order
int m_iLives; // -1 means use bar life meter
CString m_sModifiers; // contains player options and song options
int m_iExtra; // extra stage number...
void GetPlayerOptions( PlayerOptions* pPO_out );
@@ -53,15 +53,16 @@ public:
void LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs );
void CreateEndlessCourseFromGroupAndDifficultyClass( CString sGroupName, DifficultyClass dc, CArray<Song*,Song*> &apSongsInGroup );
void AddStage( Song* pSong, CString sDescription )
void AddStage( Song* pSong, CString sDescription, CString sModifiers )
{
ASSERT( m_iStages <= MAX_COURSE_STAGES - 1 );
m_apSongs[m_iStages] = pSong;
m_asDescriptions[m_iStages] = sDescription;
m_asModifiers[m_iStages] = sModifiers;
m_iStages++;
}
void GetSongAndNotesForCurrentStyle( CArray<Song*,Song*>& apSongsOut, CArray<Notes*,Notes*> apNotesOut[NUM_PLAYERS] );
void GetSongAndNotesForCurrentStyle( CArray<Song*,Song*>& apSongsOut, CArray<Notes*,Notes*>& apNotesOut, CStringArray& asModifiersOut );
D3DXCOLOR GetColor();
};
+26 -18
View File
@@ -34,24 +34,6 @@ LifeMeterBattery::LifeMeterBattery()
m_fBatteryBlinkTime = 0;
m_sprFrame.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_LIFEMETER_ONI) );
this->AddSubActor( &m_sprFrame );
m_sprBattery.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_LIFEMETER_BATTERY) );
m_sprBattery.StopAnimating();
this->AddSubActor( &m_sprBattery );
m_textNumLives.Load( THEME->GetPathTo(FONT_HEADER1) );
m_textNumLives.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // pink
m_textNumLives.SetZoom( 1.1f );
m_textNumLives.TurnShadowOff();
this->AddSubActor( &m_textNumLives );
m_textPercent.Load( THEME->GetPathTo(FONT_SCORE_NUMBERS) );
m_textPercent.TurnShadowOff();
m_textPercent.SetZoom( 0.7f );
m_textPercent.SetText( "00.0" );
this->AddSubActor( &m_textPercent );
m_soundGainLife.Load( THEME->GetPathTo(SOUND_GAMEPLAY_ONI_GAIN_LIFE) );
m_soundLoseLife.Load( THEME->GetPathTo(SOUND_GAMEPLAY_ONI_LOSE_LIFE) );
@@ -63,6 +45,32 @@ void LifeMeterBattery::Load( PlayerNumber pn )
{
LifeMeter::Load( pn );
bool bPlayerEnabled = GAMESTATE->IsPlayerEnabled(pn);
m_sprFrame.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_LIFEMETER_ONI) );
this->AddSubActor( &m_sprFrame );
m_sprBattery.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_LIFEMETER_BATTERY) );
m_sprBattery.StopAnimating();
if( bPlayerEnabled )
this->AddSubActor( &m_sprBattery );
m_textNumLives.Load( THEME->GetPathTo(FONT_HEADER1) );
m_textNumLives.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // pink
m_textNumLives.SetZoom( 1.1f );
m_textNumLives.TurnShadowOff();
if( bPlayerEnabled )
this->AddSubActor( &m_textNumLives );
m_textPercent.Load( THEME->GetPathTo(FONT_SCORE_NUMBERS) );
m_textPercent.TurnShadowOff();
m_textPercent.SetZoom( 0.7f );
m_textPercent.SetText( "00.0" );
if( bPlayerEnabled )
this->AddSubActor( &m_textPercent );
m_sprFrame.SetZoomX( pn==PLAYER_1 ? 1.0f : -1.0f );
m_sprBattery.SetZoomX( pn==PLAYER_1 ? 1.0f : -1.0f );
m_sprBattery.SetX( BATTERY_X[pn] );
+4 -2
View File
@@ -250,5 +250,7 @@ void MenuElements::StopTimer()
m_MenuTimer.StopTimer();
}
void MenuElements::OverrideCreditsMessage( PlayerNumber p, CString sNewString )
{
m_textCreditInfo[p].SetText( sNewString );
}
+2
View File
@@ -39,6 +39,8 @@ public:
void SetTimer( int iTimerSeconds );
void StopTimer();
void OverrideCreditsMessage( PlayerNumber p, CString sNewString );
void DrawTopLayer();
void DrawBottomLayer();
+46 -34
View File
@@ -376,41 +376,53 @@ MusicWheel::MusicWheel()
for( int so=0; so<NUM_SORT_ORDERS; so++ )
BuildWheelItemDatas( m_WheelItemDatas[so], SongSortOrder(so) );
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
{
m_bUseRandomExtra = true;
Course cCourse;
for( int i=0; i< SONGMAN->m_aExtraCourses.GetSize(); i++ )
// make the preferred group the group of the last song played.
if( GAMESTATE->m_sPreferredGroup == "ALL MUSIC" )
GAMESTATE->m_sPreferredGroup = GAMESTATE->m_pCurSong->m_sGroupName;
Song* pSong;
Notes* pNotes;
PlayerOptions po;
SongOptions so;
SONGMAN->GetExtraStageInfo(
GAMESTATE->IsExtraStage2(),
GAMESTATE->m_sPreferredGroup,
GAMESTATE->GetCurrentStyleDef()->m_NotesType,
pSong,
pNotes,
po,
so );
GAMESTATE->m_pCurSong = pSong;
for( int p=0; p<NUM_PLAYERS; p++ )
{
cCourse = SONGMAN->m_aExtraCourses[i];
if( cCourse.m_sName == GAMESTATE->m_sPreferredGroup )
if( GAMESTATE->IsPlayerEnabled(p) )
{
if( ( GAMESTATE->IsExtraStage() && cCourse.m_iExtra == 1 ) ||
( GAMESTATE->IsExtraStage2() && cCourse.m_iExtra == 2 ) || 1 ) // force extra whatever
{
GAMESTATE->m_pCurSong = SONGMAN->m_aExtraCourses[i].m_apSongs[0];
m_bUseRandomExtra = false;
break;
}
GAMESTATE->m_pCurNotes[p] = pNotes;
GAMESTATE->m_PlayerOptions[p] = po;
}
}
GAMESTATE->m_SongOptions = so;
}
// Select a song in case we can't find the last selected song below.
if( GAMESTATE->m_pCurSong == NULL && // if there is no currently selected song
SONGMAN->m_pSongs.GetSize() > 0 ) // and there is at least one song
// If there is no currently selected song, select one.
if( GAMESTATE->m_pCurSong == NULL )
{
CArray<Song*, Song*> arraySongs;
SONGMAN->GetSongsInGroup( GAMESTATE->m_sPreferredGroup, arraySongs );
// even tho separating these loops makes more code, in the end it'll be executed faster...
//else
if( arraySongs.GetSize() > 0 && GAMESTATE->m_pCurSong == NULL) // still nothing selected
GAMESTATE->m_pCurSong = arraySongs[0]; // select the first song
CStringArray asGroupNames;
SONGMAN->GetGroupNames( asGroupNames );
if( asGroupNames.GetSize() > 0 )
{
CArray<Song*, Song*> arraySongs;
SONGMAN->GetSongsInGroup( asGroupNames[0], arraySongs );
if( arraySongs.GetSize() > 0 ) // still nothing selected
GAMESTATE->m_pCurSong = arraySongs[0]; // select the first song
}
}
// Select the the previously selected song (if any)
if( GAMESTATE->m_pCurSong != NULL )
if( GAMESTATE->m_pCurSong )
{
for( int i=0; i<GetCurWheelItemDatas().GetSize(); i++ )
{
@@ -854,17 +866,17 @@ void MusicWheel::Update( float fDeltaTime )
m_fTimeLeftInState = 0;
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
{
if ( m_bUseRandomExtra )
{
MUSIC->Stop();
m_soundExpand.Play();
m_WheelState = STATE_ROULETTE_SPINNING;
m_SortOrder = SORT_GROUP;
m_MusicSortDisplay.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
m_MusicSortDisplay.SetEffectNone();
BuildWheelItemDatas( m_WheelItemDatas[SORT_GROUP], SORT_GROUP, true );
}
else
// if ( m_bUseRandomExtra )
// {
// MUSIC->Stop();
// m_soundExpand.Play();
// m_WheelState = STATE_ROULETTE_SPINNING;
// m_SortOrder = SORT_GROUP;
// m_MusicSortDisplay.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
// m_MusicSortDisplay.SetEffectNone();
// BuildWheelItemDatas( m_WheelItemDatas[SORT_GROUP], SORT_GROUP, true );
// }
// else
{
m_WheelState = STATE_LOCKED;
m_soundStart.Play();
+2 -2
View File
@@ -167,9 +167,9 @@ protected:
float m_fTimeLeftInState;
float m_fPositionOffsetFromSelection;
bool m_bUseRandomExtra;
// bool m_bUseRandomExtra;
// having sounds here causes a crash in Bass. What the heck!?!?!
// having sounds here causes a crash in BASS. What the heck!?!?!
RageSoundSample m_soundChangeMusic;
RageSoundSample m_soundChangeSort;
RageSoundSample m_soundExpand;
+12 -7
View File
@@ -791,24 +791,29 @@ int CompareNotesPointersByMeter(const void *arg1, const void *arg2)
return 1;
}
int CompareNotesPointersByDifficultyClass(const void *arg1, const void *arg2)
int CompareNotesPointersByDifficulty(Notes* pNotes1, Notes* pNotes2)
{
Notes* pNotes1 = *(Notes**)arg1;
Notes* pNotes2 = *(Notes**)arg2;
DifficultyClass class1 = pNotes1->m_DifficultyClass;
DifficultyClass class2 = pNotes2->m_DifficultyClass;
if( class1 < class2 )
return -1;
else if( class1 == class2 )
return CompareNotesPointersByMeter( arg1, arg2 );
return CompareNotesPointersByMeter( &pNotes1, &pNotes2 );
else
return 1;
}
void SortNotesArrayByDifficultyClass( CArray<Notes*,Notes*> &arraySteps )
int CompareNotesPointersByDifficulty2(const void *arg1, const void *arg2)
{
qsort( arraySteps.GetData(), arraySteps.GetSize(), sizeof(Notes*), CompareNotesPointersByDifficultyClass );
Notes* pNotes1 = *(Notes**)arg1;
Notes* pNotes2 = *(Notes**)arg2;
return CompareNotesPointersByDifficulty( pNotes1, pNotes2 );
}
void SortNotesArrayByDifficulty( CArray<Notes*,Notes*> &arraySteps )
{
qsort( arraySteps.GetData(), arraySteps.GetSize(), sizeof(Notes*), CompareNotesPointersByDifficulty2 );
}
+2 -1
View File
@@ -84,4 +84,5 @@ protected:
};
void SortNotesArrayByDifficultyClass( CArray<Notes*,Notes*> &arrayNotess );
int CompareNotesPointersByDifficulty(Notes* pNotes1, Notes* pNotes2);
void SortNotesArrayByDifficulty( CArray<Notes*,Notes*> &arrayNotess );
+68 -2
View File
@@ -17,8 +17,15 @@
CString PlayerOptions::GetString()
{
CString sReturn;
if( m_fArrowScrollSpeed != 1 )
sReturn += ssprintf( "%2.1fX, ", m_fArrowScrollSpeed );
{
CString s = ssprintf( "%2.2f", m_fArrowScrollSpeed );
if( s[s.GetLength()-1] == '0' )
s.Delete(s.GetLength()-1);
sReturn += s + "X, ";
}
switch( m_EffectType )
{
case EFFECT_NONE: break;
@@ -30,15 +37,17 @@ CString PlayerOptions::GetString()
case EFFECT_MINI: sReturn += "Mini, "; break;
default: ASSERT(0); // invalid EFFECT
}
switch( m_AppearanceType )
{
case APPEARANCE_VISIBLE: break;
case APPEARANCE_HIDDEN: sReturn += "Hidden, "; break;
case APPEARANCE_SUDDEN: sReturn += "Sudden, "; break;
case APPEARANCE_STEALTH: sReturn += "Stealth, "; break;
case APPEARANCE_BLINK: sReturn += "Blink, "; break;
case APPEARANCE_BLINK: sReturn += "Blink, "; break;
default: ASSERT(0); // invalid EFFECT
}
switch( m_TurnType )
{
case TURN_NONE: break;
@@ -48,11 +57,27 @@ CString PlayerOptions::GetString()
case TURN_SHUFFLE: sReturn += "Shuffle, "; break;
default: ASSERT(0); // invalid EFFECT
}
if( m_bLittle )
sReturn += "Little, ";
if( m_bReverseScroll )
sReturn += "Reverse, ";
switch( m_ColorType )
{
case COLOR_ARCADE: break;
case COLOR_NOTE: sReturn += "Note, "; break;
case COLOR_FLAT: sReturn += "Flat, "; break;
case COLOR_PLAIN: sReturn += "Plain, "; break;
};
if( !m_bHoldNotes )
sReturn += "NoHolds, ";
if( m_bDark )
sReturn += "Dark, ";
if( sReturn.GetLength() > 2 )
sReturn.Delete( sReturn.GetLength()-2, 2 ); // delete the trailing ", "
return sReturn;
@@ -60,4 +85,45 @@ CString PlayerOptions::GetString()
void PlayerOptions::FromString( CString sOptions )
{
Init();
sOptions.MakeLower();
CStringArray asBits;
split( sOptions, ",", asBits, true );
for( int i=0; i<asBits.GetSize(); i++ )
{
CString& sBit = asBits[i];
sBit.TrimLeft();
sBit.TrimRight();
if( sBit == "0.5x" ) m_fArrowScrollSpeed = 0.5f;
else if( sBit == "0.75x" ) m_fArrowScrollSpeed = 0.15f;
else if( sBit == "1.5x" ) m_fArrowScrollSpeed = 1.5f;
else if( sBit == "2.0x" ) m_fArrowScrollSpeed = 2.0f;
else if( sBit == "3.0x" ) m_fArrowScrollSpeed = 3.0f;
else if( sBit == "4.0x" ) m_fArrowScrollSpeed = 4.0f;
else if( sBit == "5.0x" ) m_fArrowScrollSpeed = 5.0f;
else if( sBit == "8.0x" ) m_fArrowScrollSpeed = 8.0f;
else if( sBit == "boost" ) m_EffectType = EFFECT_BOOST;
else if( sBit == "wave" ) m_EffectType = EFFECT_WAVE;
else if( sBit == "drunk" ) m_EffectType = EFFECT_DRUNK;
else if( sBit == "dizzy" ) m_EffectType = EFFECT_DIZZY;
else if( sBit == "space" ) m_EffectType = EFFECT_SPACE;
else if( sBit == "mini" ) m_EffectType = EFFECT_MINI;
else if( sBit == "hidden" ) m_AppearanceType = APPEARANCE_HIDDEN;
else if( sBit == "sudden" ) m_AppearanceType = APPEARANCE_SUDDEN;
else if( sBit == "stealth" ) m_AppearanceType = APPEARANCE_STEALTH;
else if( sBit == "mirror" ) m_TurnType = TURN_MIRROR;
else if( sBit == "left" ) m_TurnType = TURN_LEFT;
else if( sBit == "right" ) m_TurnType = TURN_RIGHT;
else if( sBit == "shuffle" ) m_TurnType = TURN_SHUFFLE;
else if( sBit == "little" ) m_bLittle = true;
else if( sBit == "reverse" ) m_bReverseScroll = true;
else if( sBit == "note" ) m_ColorType = COLOR_NOTE;
else if( sBit == "flat" ) m_ColorType = COLOR_FLAT;
else if( sBit == "plain" ) m_ColorType = COLOR_PLAIN;
else if( sBit == "noholds" ) m_bHoldNotes = false;
else if( sBit == "nofreeze" ) m_bHoldNotes = false;
else if( sBit == "dark" ) m_bDark = true;
}
}
+2 -1
View File
@@ -26,7 +26,8 @@ struct PlayerOptions
bool m_bHoldNotes;
bool m_bDark;
PlayerOptions()
PlayerOptions() { Init(); };
void Init()
{
m_fArrowScrollSpeed = 1.0f;
m_EffectType = EFFECT_NONE;
+7
View File
@@ -45,6 +45,13 @@ float TimeToSeconds( CString sHMS )
return fSeconds;
}
CString SecondsToTime( float fSecs )
{
int iMinsDisplay = (int)fSecs/60;
int iSecsDisplay = (int)fSecs - iMinsDisplay*60;
int iLeftoverDisplay = int( (fSecs - iMinsDisplay*60 - iSecsDisplay) * 100 );
return ssprintf( "%02d:%02d:%02d", iMinsDisplay, iSecsDisplay, iLeftoverDisplay );
}
//-----------------------------------------------------------------------------
// Name: ssprintf()
+1 -1
View File
@@ -107,7 +107,7 @@ inline float froundf( const float f, const float fRoundInterval )
bool IsAnInt( LPCTSTR s );
float TimeToSeconds( CString sHMS );
CString SecondsToTime( float fSecs );
CString ssprintf( LPCTSTR fmt, ...);
CString vssprintf( LPCTSTR fmt, va_list argList );
+1
View File
@@ -32,6 +32,7 @@ ScoreDisplayNormal::ScoreDisplayNormal()
m_fTrailingScore = 0;
SetScore( 0 );
Update(0);
}
+6 -5
View File
@@ -47,12 +47,13 @@ void ScoreDisplayOni::Update( float fDeltaTime )
void ScoreDisplayOni::Draw()
{
float fSecsIntoPlay = GAMESTATE->GetPlayerSurviveTime(m_PlayerNumber);
float fSecsIntoPlay;
if( GAMESTATE->IsPlayerEnabled(m_PlayerNumber) )
fSecsIntoPlay = GAMESTATE->GetPlayerSurviveTime(m_PlayerNumber);
else
fSecsIntoPlay = 0;
int iMinsDisplay = (int)fSecsIntoPlay/60;
int iSecsDisplay = (int)fSecsIntoPlay - iMinsDisplay*60;
int iLeftoverDisplay = int( (fSecsIntoPlay - iMinsDisplay*60 - iSecsDisplay) * 100 );
SetText( ssprintf( "%02d:%02d:%02d", iMinsDisplay, iSecsDisplay, iLeftoverDisplay ) );
SetText( SecondsToTime(fSecsIntoPlay) );
BitmapText::Draw();
}
+18 -2
View File
@@ -65,6 +65,7 @@ const CString HELP_TEXT =
" 4th / 8th / 12th / 16th / 12th or 16th\n"
"P: Play selected area\n"
"R: Record in selected area\n"
"T: Toggle Play/Record rate\n"
"X: Cut selected area\n"
"C: Copy selected area\n"
"V: Paste at current beat\n"
@@ -124,6 +125,8 @@ ScreenEdit::ScreenEdit()
m_fBeat = 0.0f;
GAMESTATE->m_fSongBeat = m_fBeat;
m_fMusicRate = 1;
GAMESTATE->m_PlayerOptions[PLAYER_1].m_fArrowScrollSpeed = 1;
GAMESTATE->m_PlayerOptions[PLAYER_1].m_ColorType = PlayerOptions::COLOR_NOTE;
@@ -309,6 +312,7 @@ void ScreenEdit::Update( float fDeltaTime )
"Snap = %s\n"
"Beat = %.2f\n"
"Selection = begin: %.2f, end: %.2f\n"
"Play/Record rate: %.1f\n"
"Difficulty = %s\n"
"Description = %s\n"
"Num notes tap: %d, hold: %d\n"
@@ -317,6 +321,7 @@ void ScreenEdit::Update( float fDeltaTime )
sNoteType,
m_fBeat,
m_NoteFieldEdit.m_fBeginMarker, m_NoteFieldEdit.m_fEndMarker,
m_fMusicRate,
DifficultyClassToString( m_pNotes->m_DifficultyClass ),
GAMESTATE->m_pCurNotes[PLAYER_1] ? GAMESTATE->m_pCurNotes[PLAYER_1]->m_sDescription : "no description",
iNumTapNotes, iNumHoldNotes,
@@ -580,7 +585,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
float fElapsedSeconds = max( 0, m_pSong->GetElapsedTimeFromBeat(m_fBeat) );
m_soundMusic.SetPositionSeconds( fElapsedSeconds );
m_soundMusic.Play();
m_soundMusic.SetPlaybackRate( 1.0f );
m_soundMusic.SetPlaybackRate( m_fMusicRate );
}
break;
case DIK_R:
@@ -607,9 +612,20 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
float fElapsedSeconds = max( 0, m_pSong->GetElapsedTimeFromBeat(m_fBeat) );
m_soundMusic.SetPositionSeconds( fElapsedSeconds );
m_soundMusic.Play();
m_soundMusic.SetPlaybackRate( 0.5f );
m_soundMusic.SetPlaybackRate( m_fMusicRate );
}
break;
case DIK_T:
if( m_fMusicRate == 1.0f ) m_fMusicRate = 0.9f;
else if( m_fMusicRate == 0.9f ) m_fMusicRate = 0.8f;
else if( m_fMusicRate == 0.8f ) m_fMusicRate = 0.7f;
else if( m_fMusicRate == 0.7f ) m_fMusicRate = 1.5f;
else if( m_fMusicRate == 1.5f ) m_fMusicRate = 1.4f;
else if( m_fMusicRate == 1.4f ) m_fMusicRate = 1.3f;
else if( m_fMusicRate == 1.3f ) m_fMusicRate = 1.2f;
else if( m_fMusicRate == 1.2f ) m_fMusicRate = 1.1f;
else if( m_fMusicRate == 1.1f ) m_fMusicRate = 1.0f;
break;
case DIK_INSERT:
case DIK_DELETE:
{
+2
View File
@@ -61,6 +61,8 @@ protected:
NoteData m_Clipboard;
float m_fMusicRate;
RageSoundSample m_soundChangeLine;
RageSoundSample m_soundChangeSnap;
RageSoundSample m_soundMarker;
+1 -1
View File
@@ -237,7 +237,7 @@ void ScreenEditMenu::OnNotesTypeChange()
m_pNotess.RemoveAll();
GetSelectedSong()->GetNotesThatMatch( GetSelectedNotesType(), m_pNotess );
SortNotesArrayByDifficultyClass( m_pNotess );
SortNotesArrayByDifficulty( m_pNotess );
m_pNotess.Add( NULL ); // marker for "(NEW)"
m_iSelectedNotes = 0;
+4 -2
View File
@@ -291,7 +291,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
//Less - D
//Fail - E
float fPercentDancePoints = iActualDancePoints[p] / (float)iPossibleDancePoints[p];
fPercentDancePoints = min( fPercentDancePoints, 0 );
fPercentDancePoints = max( fPercentDancePoints, 0 );
if ( fPercentDancePoints >= 1.00 ) grade[p] = GRADE_AAA;
else if( fPercentDancePoints >= 0.93 ) grade[p] = GRADE_AA;
@@ -767,8 +767,10 @@ void ScreenEvaluation::MenuStart( const PlayerNumber p )
{
if( m_bTryExtraStage )
m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic );
else if( m_ResultMode == RM_ARCADE_STAGE && GAMESTATE->m_iCurrentStageIndex >= PREFSMAN->m_iNumArcadeStages-1 )
else if( m_ResultMode == RM_ARCADE_STAGE && GAMESTATE->m_iCurrentStageIndex == PREFSMAN->m_iNumArcadeStages-1 )
m_Menu.TweenOffScreenToMenu( SM_GoToFinalEvaluation );
else if( m_ResultMode == RM_ARCADE_STAGE && GAMESTATE->m_iCurrentStageIndex != PREFSMAN->m_iNumArcadeStages-1 )
m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic );
else
m_Menu.TweenOffScreenToBlack( SM_GoToMusicScroll, false );
}
+63 -17
View File
@@ -61,6 +61,9 @@ const float DIFFICULTY_Y[NUM_PLAYERS] = { SCREEN_BOTTOM-70, SCREEN_BOTTOM-70 };
const float DEBUG_X = CENTER_X;
const float DEBUG_Y = CENTER_Y-70;
const float SURVIVE_TIME_X = CENTER_X;
const float SURVIVE_TIME_Y = CENTER_Y+100;
const float TIME_BETWEEN_DANCING_COMMENTS = 13;
@@ -111,12 +114,13 @@ ScreenGameplay::ScreenGameplay()
Course* pCourse = GAMESTATE->m_pCurCourse;
CArray<Song*,Song*> apSongs;
CArray<Notes*,Notes*> apNotes[NUM_PLAYERS];
pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes );
CArray<Notes*,Notes*> apNotes;
CStringArray asModifiers;
pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes, asModifiers );
for( int i=0; i<apNotes[p].GetSize(); i++ )
for( int i=0; i<apNotes.GetSize(); i++ )
{
apNotes[p][i]->GetNoteData( &notedata );
apNotes[i]->GetNoteData( &notedata );
int iPossibleDancePoints = notedata.GetPossibleDancePoints();
GAMESTATE->m_iPossibleDancePoints[p] += iPossibleDancePoints;
}
@@ -228,7 +232,8 @@ ScreenGameplay::ScreenGameplay()
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
for( int p=0; p<NUM_PLAYERS; p++ )
m_frameTop.AddSubActor( &m_textCourseSongNumber[p] );
if( GAMESTATE->IsPlayerEnabled(p) )
m_frameTop.AddSubActor( &m_textCourseSongNumber[p] );
break;
default:
ASSERT(0); // invalid GameMode
@@ -313,7 +318,7 @@ ScreenGameplay::ScreenGameplay()
float fDifficultyY = DIFFICULTY_Y[p];
if( GAMESTATE->m_PlayerOptions[p].m_bReverseScroll )
fDifficultyY = SCREEN_HEIGHT - DIFFICULTY_Y[p];
fDifficultyY = SCREEN_HEIGHT - DIFFICULTY_Y[p] -10; // HACK: move difficulty banner up 10 if reverse
m_DifficultyBanner[p].SetXY( DIFFICULTY_X[p], fDifficultyY );
this->AddSubActor( &m_DifficultyBanner[p] );
@@ -363,6 +368,14 @@ ScreenGameplay::ScreenGameplay()
this->AddSubActor( &m_Fade );
m_textSurviveTime.Load( THEME->GetPathTo(FONT_HEADER1) );
m_textSurviveTime.TurnShadowOff();
m_textSurviveTime.SetXY( SURVIVE_TIME_X, SURVIVE_TIME_Y );
m_textSurviveTime.SetText( "" );
m_textSurviveTime.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
this->AddSubActor( &m_textSurviveTime );
m_soundFail.Load( THEME->GetPathTo(SOUND_GAMEPLAY_FAILED) );
m_announcerReady.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_READY) );
@@ -429,8 +442,9 @@ bool ScreenGameplay::IsLastSong()
return false;
CArray<Song*,Song*> apSongs;
CArray<Notes*,Notes*> apNotes[NUM_PLAYERS];
pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes );
CArray<Notes*,Notes*> apNotes;
CStringArray asModifiers;
pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes, asModifiers );
return GAMESTATE->m_iSongsIntoCourse >= apSongs.GetSize(); // there are no more songs left
}
@@ -457,8 +471,9 @@ void ScreenGameplay::LoadNextSong( bool bFirstLoad )
Course* pCourse = GAMESTATE->m_pCurCourse;
CArray<Song*,Song*> apSongs;
CArray<Notes*,Notes*> apNotes[NUM_PLAYERS];
pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes );
CArray<Notes*,Notes*> apNotes;
CStringArray asModifiers;
pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes, asModifiers );
int iPlaySongIndex = -1;
if( pCourse->m_bRandomize )
@@ -468,7 +483,11 @@ void ScreenGameplay::LoadNextSong( bool bFirstLoad )
GAMESTATE->m_pCurSong = apSongs[iPlaySongIndex];
for( int p=0; p<NUM_PLAYERS; p++ )
GAMESTATE->m_pCurNotes[p] = apNotes[p][iPlaySongIndex];
{
GAMESTATE->m_pCurNotes[p] = apNotes[iPlaySongIndex];
if( asModifiers[iPlaySongIndex] != "" ) // some modifiers specified
GAMESTATE->m_PlayerOptions[p].FromString( asModifiers[iPlaySongIndex] ); // put them into effect
}
}
break;
default:
@@ -777,14 +796,18 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
if( MenuI.IsValid() &&
MenuI.button == MENU_BUTTON_BACK &&
type == IET_SLOW_REPEAT &&
m_DancingState != STATE_OUTRO &&
!m_Fade.IsClosing() )
{
SOUND->PlayOnceStreamed( THEME->GetPathTo(SOUND_MENU_BACK) );
m_soundMusic.Stop();
this->ClearMessageQueue();
m_Fade.CloseWipingLeft( SM_SaveChangedBeforeGoingBack );
if( (DeviceI.device==DEVICE_KEYBOARD && type==IET_SLOW_REPEAT) ||
(DeviceI.device!=DEVICE_KEYBOARD && type==IET_FAST_REPEAT) )
{
m_DancingState = STATE_OUTRO;
SOUND->PlayOnceStreamed( THEME->GetPathTo(SOUND_MENU_BACK) );
m_soundMusic.Stop();
this->ClearMessageQueue();
m_Fade.CloseWipingLeft( SM_SaveChangedBeforeGoingBack );
}
}
//
@@ -1079,8 +1102,10 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
{
m_bChangedOffsetOrBPM = false;
ShowSavePrompt( SM_GoToScreenAfterBack );
break;
}
else
this->SendScreenMessage( SM_GoToScreenAfterBack, 0 );
break;
case SM_GoToScreenAfterBack:
switch( GAMESTATE->m_PlayMode )
@@ -1110,6 +1135,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
m_DancingState = STATE_OUTRO;
m_soundMusic.Pause();
m_StarWipe.CloseWipingRight( SM_None );
this->SendScreenMessage( SM_ShowFailed, 0.2f );
break;
case SM_ShowFailed:
@@ -1130,6 +1156,20 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
m_sprFailed.SetTweenZoom( 1.0f ); // come to rest
m_sprFailed.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0.7f) ); // and fade in
// show the survive time if extra stage
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
{
float fMaxSurviveSeconds = -1;
for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) )
fMaxSurviveSeconds = max( fMaxSurviveSeconds, GAMESTATE->GetPlayerSurviveTime((PlayerNumber)p) );
ASSERT( fMaxSurviveSeconds != -1 );
m_textSurviveTime.SetText( "TIME " + SecondsToTime(fMaxSurviveSeconds) );
m_textSurviveTime.BeginTweening( 0.3f ); // sleep
m_textSurviveTime.BeginTweeningQueued( 0.3f ); // fade in
m_textSurviveTime.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) );
}
SCREENMAN->SendMessageToTopScreen( SM_PlayFailComment, 1.5f );
SCREENMAN->SendMessageToTopScreen( SM_HideFailed, 3.0f );
break;
@@ -1141,6 +1181,10 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
m_sprFailed.BeginTweening(1.0f);
m_sprFailed.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
m_textSurviveTime.BeginTweening( 0.5f ); // sleep
m_textSurviveTime.BeginTweeningQueued( 0.5f ); // fade out
m_textSurviveTime.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
SCREENMAN->SendMessageToTopScreen( SM_GoToScreenAfterFail, 1.5f );
break;
case SM_GoToScreenAfterFail:
@@ -1152,6 +1196,8 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
}
if( PREFSMAN->m_bEventMode )
this->SendScreenMessage( SM_GoToScreenAfterBack, 0 );
else if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
SCREENMAN->SetNewScreen( new ScreenEvaluation(true) );
else
SCREENMAN->SetNewScreen( new ScreenGameOver );
break;
+3
View File
@@ -103,6 +103,9 @@ private:
FocusingSprite m_sprCleared;
MotionBlurSprite m_sprFailed;
BitmapText m_textSurviveTime; // only shown in extra stage
Player m_Player[NUM_PLAYERS];
DifficultyBanner m_DifficultyBanner[NUM_PLAYERS];
+8 -6
View File
@@ -39,9 +39,9 @@ enum {
NUM_PLAYER_OPTIONS_LINES
};
OptionLineData g_PlayerOptionsLines[NUM_PLAYER_OPTIONS_LINES] = {
{ "Speed", 8, {"x0.5","x0.75","x1","x1.5","x2","x3","x5","x8"} },
{ "Speed", 9, {"x0.5","x0.75","x1","x1.5","x2","x3","x4","x5","x8"} },
{ "Effect", 7, {"OFF","BOOST","WAVE", "DRUNK", "DIZZY","SPACE","MINI"} },
{ "Appear", 5, {"VISIBLE","HIDDEN","SUDDEN","STEALTH", "BLINK"} },
{ "Appear", 4, {"VISIBLE","HIDDEN","SUDDEN","STEALTH"} },
{ "Turn", 5, {"OFF","MIRROR","LEFT","RIGHT","SHUFFLE"} },
{ "Little", 2, {"OFF","ON"} },
{ "Scroll", 2, {"STANDARD","REVERSE"} },
@@ -81,8 +81,9 @@ void ScreenPlayerOptions::ImportOptions()
else if( po.m_fArrowScrollSpeed == 1.5f ) m_iSelectedOption[p][PO_SPEED] = 3;
else if( po.m_fArrowScrollSpeed == 2.0f ) m_iSelectedOption[p][PO_SPEED] = 4;
else if( po.m_fArrowScrollSpeed == 3.0f ) m_iSelectedOption[p][PO_SPEED] = 5;
else if( po.m_fArrowScrollSpeed == 5.0f ) m_iSelectedOption[p][PO_SPEED] = 6;
else if( po.m_fArrowScrollSpeed == 8.0f ) m_iSelectedOption[p][PO_SPEED] = 7;
else if( po.m_fArrowScrollSpeed == 4.0f ) m_iSelectedOption[p][PO_SPEED] = 6;
else if( po.m_fArrowScrollSpeed == 5.0f ) m_iSelectedOption[p][PO_SPEED] = 7;
else if( po.m_fArrowScrollSpeed == 8.0f ) m_iSelectedOption[p][PO_SPEED] = 8;
else m_iSelectedOption[p][PO_SPEED] = 2;
m_iSelectedOption[p][PO_EFFECT] = po.m_EffectType;
@@ -110,8 +111,9 @@ void ScreenPlayerOptions::ExportOptions()
case 3: po.m_fArrowScrollSpeed = 1.5f; break;
case 4: po.m_fArrowScrollSpeed = 2.0f; break;
case 5: po.m_fArrowScrollSpeed = 3.0f; break;
case 6: po.m_fArrowScrollSpeed = 5.0f; break;
case 7: po.m_fArrowScrollSpeed = 8.0f; break;
case 6: po.m_fArrowScrollSpeed = 4.0f; break;
case 7: po.m_fArrowScrollSpeed = 5.0f; break;
case 8: po.m_fArrowScrollSpeed = 8.0f; break;
}
+6
View File
@@ -58,6 +58,12 @@ ScreenSelectGame::ScreenSelectGame() :
g_SelectGameLines[0].iNumOptions = arrayGameNames.GetSize();
// HACK: Chris: Temporarily disable EZ2Dancer. The EZ2 menus aren't working correctly,
// and I have to leave for California in 4 hours - not enough time to fix this and do a
// release.
g_SelectGameLines[0].iNumOptions = 2;
Init(
INPUTMODE_P1_ONLY,
g_SelectGameLines,
+3 -3
View File
@@ -1,7 +1,7 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
File: ScreenSelectGroup.cpp
Class: ScreenSelectGroup
Desc: See header.
@@ -447,7 +447,7 @@ void ScreenSelectGroup::MenuUp( const PlayerNumber p )
m_iSelection = m_iSelection-1 % m_arrayGroupNames.GetSize();
if( m_iSelection < 0 )
m_iSelection += m_arrayGroupNames.GetSize();
m_iSelection += min( m_arrayGroupNames.GetSize(), MAX_GROUPS );
AfterChange();
@@ -462,7 +462,7 @@ void ScreenSelectGroup::MenuDown( const PlayerNumber p )
BeforeChange();
m_iSelection = (m_iSelection+1) % m_arrayGroupNames.GetSize();
m_iSelection = (m_iSelection+1) % min( m_arrayGroupNames.GetSize(), MAX_GROUPS );
AfterChange();
+6 -2
View File
@@ -50,6 +50,8 @@ protected:
void AfterMusicChange();
void PlayMusicSample();
void UpdateOptionsDisplays();
CArray<Notes*, Notes*> m_arrayNotes;
int m_iSelection[NUM_PLAYERS];
@@ -59,6 +61,7 @@ protected:
Sprite m_sprDifficultyFrame;
DifficultyIcon m_DifficultyIcon[NUM_PLAYERS];
GrooveRadar m_GrooveRadar;
BitmapText m_textSongOptions;
Sprite m_sprMeterFrame;
FootMeter m_FootMeter[NUM_PLAYERS];
MusicWheel m_MusicWheel;
@@ -67,8 +70,9 @@ protected:
bool m_bGoToOptions;
BitmapText m_textHoldForOptions;
RandomSample m_soundSelect;
RandomSample m_soundChangeNotes;
RageSoundSample m_soundSelect;
RageSoundSample m_soundChangeNotes;
RageSoundSample m_soundLocked;
};
+1
View File
@@ -75,6 +75,7 @@ ScreenTitleMenu::ScreenTitleMenu()
PREFSMAN->ReadGamePrefsFromDisk();
INPUTMAPPER->ReadMappingsFromDisk();
int i;
m_sprBG.Load( THEME->GetPathTo(GRAPHIC_TITLE_MENU_BACKGROUND) );
+1 -1
View File
@@ -1286,7 +1286,7 @@ Grade Song::GetGradeForDifficultyClass( NotesType nt, DifficultyClass dc )
{
CArray<Notes*, Notes*> aNotes;
this->GetNotesThatMatch( nt, aNotes );
SortNotesArrayByDifficultyClass( aNotes );
SortNotesArrayByDifficulty( aNotes );
for( int i=0; i<aNotes.GetSize(); i++ )
{
+95 -3
View File
@@ -27,11 +27,11 @@ const CString g_sStatisticsFileName = "statistics.ini";
D3DXCOLOR GROUP_COLORS[] = {
// D3DXCOLOR( 0.9f, 0.0f, 0.2f, 1 ), // red
D3DXCOLOR( 0.7f, 0.0f, 0.5f, 1 ), // pink
D3DXCOLOR( 0.4f, 0.2f, 0.6f, 1 ), // purple
D3DXCOLOR( 0.8f, 0.1f, 0.6f, 1 ), // pink
D3DXCOLOR( 0.5f, 0.3f, 0.7f, 1 ), // purple
D3DXCOLOR( 0.0f, 0.4f, 0.8f, 1 ), // sky blue
D3DXCOLOR( 0.0f, 0.6f, 0.6f, 1 ), // sea green
D3DXCOLOR( 0.0f, 0.6f, 0.2f, 1 ), // green
D3DXCOLOR( 0.1f, 0.7f, 0.3f, 1 ), // green
D3DXCOLOR( 0.8f, 0.6f, 0.0f, 1 ), // orange
};
const int NUM_GROUP_COLORS = sizeof(GROUP_COLORS) / sizeof(D3DXCOLOR);
@@ -446,3 +446,95 @@ void SongManager::ReloadCourses()
{
}
void SongManager::GetExtraStageInfo( bool bExtra2, CString sPreferredGroup, NotesType nt,
Song*& pSongOut, Notes*& pNotesOut, PlayerOptions& po_out, SongOptions& so_out )
{
{
CString sCoursePath = "Songs\\" + sPreferredGroup + "\\" + (bExtra2 ? "extra2" : "extra1") + ".crs";
if( !DoesFileExist(sCoursePath) )
goto load_from_course_failed;
Course course;
course.LoadFromCRSFile( sCoursePath, m_pSongs );
if( course.m_iStages <= 0 )
goto load_from_course_failed;
pSongOut = course.m_apSongs[0];
pNotesOut = course.GetNotesForStage( 0 );
if( pNotesOut == NULL )
goto load_from_course_failed;
po_out.FromString( course.m_asModifiers[0] );
so_out.FromString( course.m_asModifiers[0] );
return;
}
load_from_course_failed:
// Choose a hard song for the extra stage
Song* pExtra1Song = NULL; // the absolute hardest Song and Notes. Use this for extra stage 1.
Notes* pExtra1Notes = NULL;
Song* pExtra2Song = NULL; // a medium-hard Song and Notes. Use this for extra stage 2.
Notes* pExtra2Notes = NULL;
CArray<Song*,Song*> apSongs;
SONGMAN->GetSongsInGroup( GAMESTATE->m_sPreferredGroup, apSongs );
for( int s=0; s<apSongs.GetSize(); s++ ) // foreach song
{
Song* pSong = apSongs[s];
CArray<Notes*,Notes*> apNotes;
pSong->GetNotesThatMatch( nt, apNotes );
for( int n=0; n<apNotes.GetSize(); n++ ) // foreach Notes
{
Notes* pNotes = apNotes[n];
if( pExtra1Notes == NULL || CompareNotesPointersByDifficulty(pExtra1Notes,pNotes) == -1 ) // pNotes is harder than pHardestNotes
{
pExtra1Song = pSong;
pExtra1Notes = pNotes;
}
// for extra 2, we don't want to choose the hardest notes possible. So, we'll disgard Notes with meter > 8
if( bExtra2 && pNotes->m_iMeter > 8 )
continue; // skip
if( pExtra2Notes == NULL || CompareNotesPointersByDifficulty(pExtra2Notes,pNotes) == -1 ) // pNotes is harder than pHardestNotes
{
pExtra2Song = pSong;
pExtra2Notes = pNotes;
}
}
}
if( pExtra2Song == NULL && pExtra1Song != NULL )
{
pExtra2Song = pExtra1Song;
pExtra2Notes = pExtra1Notes;
}
// If there are any notes at all that match this NotesType, everything should be filled out.
// Also, it's guaranteed that there is at least one Notes that matches the NotesType because the player
// had to play something before reaching the extra stage!
ASSERT( pExtra2Song && pExtra1Song && pExtra2Notes && pExtra1Notes );
pSongOut = (bExtra2 ? pExtra2Song : pExtra1Song);
pNotesOut = (bExtra2 ? pExtra2Notes : pExtra1Notes);
po_out.Init();
so_out.Init();
po_out.m_bReverseScroll = true;
po_out.m_fArrowScrollSpeed = 1.5f;
so_out.m_DrainType = (bExtra2 ? SongOptions::DRAIN_SUDDEN_DEATH : SongOptions::DRAIN_NO_RECOVER);
// should we do something fancy here, like turn on different effects?
int iSongHash = GetHashForString( pSongOut->m_sSongDir );
switch( iSongHash % 6 )
{
case 0: po_out.m_EffectType = PlayerOptions::EFFECT_DIZZY; break;
case 1: po_out.m_bDark = true; break;
case 2: po_out.m_EffectType = PlayerOptions::EFFECT_DRUNK; break;
case 3: po_out.m_EffectType = PlayerOptions::EFFECT_MINI; break;
case 4: po_out.m_EffectType = PlayerOptions::EFFECT_SPACE; break;
case 5: po_out.m_EffectType = PlayerOptions::EFFECT_WAVE; break;
default: ASSERT(0);
}
}
+2
View File
@@ -55,6 +55,8 @@ public:
void InitCoursesFromDisk();
void ReloadCourses();
void GetExtraStageInfo( bool bExtra2, CString sPreferredGroup, NotesType nt,
Song*& pSongOut, Notes*& pNotesOut, PlayerOptions& po_out, SongOptions& so_out );
protected:
void LoadStepManiaSongDir( CString sDir, void(*callback)() );
+72
View File
@@ -10,3 +10,75 @@
-----------------------------------------------------------------------------
*/
#include "SongOptions.h"
#include "RageUtil.h"
CString SongOptions::GetString()
{
CString sReturn;
switch( m_LifeType )
{
case LIFE_BAR:
switch( m_DrainType )
{
case DRAIN_NORMAL: break;
case DRAIN_NO_RECOVER: sReturn += "NoRecover, "; break;
case DRAIN_SUDDEN_DEATH: sReturn += "SuddenDeath, "; break;
}
break;
case LIFE_BATTERY:
sReturn += ssprintf( "%dLives, ", m_iBatteryLives );
break;
}
switch( m_FailType )
{
case FAIL_ARCADE: break;
case FAIL_END_OF_SONG: sReturn += "FailEndOfSong, "; break;
case FAIL_OFF: sReturn += "FailOff, "; break;
}
if( m_fMusicRate != 1 )
{
CString s = ssprintf( "%2.2fxMusic", m_fMusicRate );
if( s[s.GetLength()-1] == '0' )
s.Delete(s.GetLength());
sReturn += s + ", ";
}
if( sReturn.GetLength() > 2 )
sReturn.Delete( sReturn.GetLength()-2, 2 ); // delete the trailing ", "
return sReturn;
}
void SongOptions::FromString( CString sOptions )
{
Init();
sOptions.MakeLower();
CStringArray asBits;
split( sOptions, ",", asBits, true );
for( int i=0; i<asBits.GetSize(); i++ )
{
CString& sBit = asBits[i];
sBit.TrimLeft();
sBit.TrimRight();
if( sBit == "norecover" ) m_DrainType = DRAIN_NO_RECOVER;
else if( sBit == "suddendeath" ) m_DrainType = DRAIN_SUDDEN_DEATH;
else if( sBit == "power-drop" ) m_DrainType = DRAIN_NO_RECOVER;
else if( sBit == "death" ) m_DrainType = DRAIN_SUDDEN_DEATH;
else if( sBit == "0.7xmusic" ) m_fMusicRate = 0.7f;
else if( sBit == "0.8xmusic" ) m_fMusicRate = 0.8f;
else if( sBit == "0.9xmusic" ) m_fMusicRate = 0.9f;
else if( sBit == "1.0xmusic" ) m_fMusicRate = 1.0f;
else if( sBit == "1.1xmusic" ) m_fMusicRate = 1.1f;
else if( sBit == "1.2xmusic" ) m_fMusicRate = 1.2f;
else if( sBit == "1.3xmusic" ) m_fMusicRate = 1.3f;
else if( sBit == "1.4xmusic" ) m_fMusicRate = 1.4f;
else if( sBit == "1.5xmusic" ) m_fMusicRate = 1.5f;
}
}
+5 -3
View File
@@ -25,7 +25,9 @@ struct SongOptions
AssistType m_AssistType;
float m_fMusicRate;
SongOptions() {
SongOptions() { Init(); };
void Init()
{
m_LifeType = LIFE_BAR;
m_DrainType = DRAIN_NORMAL;
m_iBatteryLives = 4;
@@ -33,6 +35,6 @@ struct SongOptions
m_AssistType = ASSIST_NONE;
m_fMusicRate = 1.0f;
};
CString GetString() { return ""; };
void FromString( CString sOptions ) {};
CString GetString();
void FromString( CString sOptions );
};