2002-07-27 19:29:51 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: SongOptions
|
|
|
|
|
|
|
|
|
|
Desc: See header.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
2002-08-01 13:42:56 +00:00
|
|
|
#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;
|
|
|
|
|
}
|
|
|
|
|
|
2003-02-12 23:11:37 +00:00
|
|
|
|
|
|
|
|
switch( m_FailType )
|
|
|
|
|
{
|
|
|
|
|
case FAIL_ARCADE: break;
|
|
|
|
|
case FAIL_END_OF_SONG: sReturn += "FailEndOfSong, "; break;
|
|
|
|
|
case FAIL_OFF: sReturn += "FailOff, "; break;
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-01 13:42:56 +00:00
|
|
|
if( m_fMusicRate != 1 )
|
|
|
|
|
{
|
2002-08-03 18:40:09 +00:00
|
|
|
CString s = ssprintf( "%2.2f", m_fMusicRate );
|
2002-08-01 13:42:56 +00:00
|
|
|
if( s[s.GetLength()-1] == '0' )
|
2003-01-03 05:29:45 +00:00
|
|
|
s.erase(s.GetLength()-1);
|
2002-08-03 18:40:09 +00:00
|
|
|
sReturn += s + "xMusic, ";
|
2002-08-01 13:42:56 +00:00
|
|
|
}
|
|
|
|
|
|
2003-01-11 08:55:21 +00:00
|
|
|
if( m_bAutoSync )
|
|
|
|
|
sReturn += "AutoSync, ";
|
2002-10-01 01:55:07 +00:00
|
|
|
|
2002-08-01 13:42:56 +00:00
|
|
|
if( sReturn.GetLength() > 2 )
|
2003-01-03 05:29:45 +00:00
|
|
|
sReturn.erase( sReturn.GetLength()-2 ); // delete the trailing ", "
|
2002-08-01 13:42:56 +00:00
|
|
|
return sReturn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SongOptions::FromString( CString sOptions )
|
|
|
|
|
{
|
|
|
|
|
Init();
|
|
|
|
|
sOptions.MakeLower();
|
|
|
|
|
CStringArray asBits;
|
|
|
|
|
split( sOptions, ",", asBits, true );
|
|
|
|
|
|
2002-10-31 03:16:02 +00:00
|
|
|
for( unsigned i=0; i<asBits.size(); i++ )
|
2002-08-01 13:42:56 +00:00
|
|
|
{
|
|
|
|
|
CString& sBit = asBits[i];
|
2002-10-31 08:05:13 +00:00
|
|
|
TrimLeft(sBit);
|
|
|
|
|
TrimRight(sBit);
|
2002-08-01 13:42:56 +00:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|