strtof -> StringToFloat.

This commit is contained in:
Steve Checkoway
2006-06-12 06:42:25 +00:00
parent b61e1638dc
commit d2f3a14495
12 changed files with 52 additions and 52 deletions
+9 -9
View File
@@ -227,16 +227,16 @@ void Actor::LoadFromNode( const RString& sDir, const XNode* pNode )
}
// TODO: Remove these
else if( sKeyName == "BaseRotationXDegrees" ) SetBaseRotationX( strtof( sValue, NULL ) );
else if( sKeyName == "BaseRotationYDegrees" ) SetBaseRotationY( strtof( sValue, NULL ) );
else if( sKeyName == "BaseRotationZDegrees" ) SetBaseRotationZ( strtof( sValue, NULL ) );
else if( sKeyName == "BaseRotationXDegrees" ) SetBaseRotationX( StringToFloat(sValue) );
else if( sKeyName == "BaseRotationYDegrees" ) SetBaseRotationY( StringToFloat(sValue) );
else if( sKeyName == "BaseRotationZDegrees" ) SetBaseRotationZ( StringToFloat(sValue) );
else if( sKeyName == "BaseRotationX" ) SetBaseRotationX( strtof( sValue, NULL ) );
else if( sKeyName == "BaseRotationY" ) SetBaseRotationY( strtof( sValue, NULL ) );
else if( sKeyName == "BaseRotationZ" ) SetBaseRotationZ( strtof( sValue, NULL ) );
else if( sKeyName == "BaseZoomX" ) SetBaseZoomX( strtof( sValue, NULL ) );
else if( sKeyName == "BaseZoomY" ) SetBaseZoomY( strtof( sValue, NULL ) );
else if( sKeyName == "BaseZoomZ" ) SetBaseZoomZ( strtof( sValue, NULL ) );
else if( sKeyName == "BaseRotationX" ) SetBaseRotationX( StringToFloat(sValue) );
else if( sKeyName == "BaseRotationY" ) SetBaseRotationY( StringToFloat(sValue) );
else if( sKeyName == "BaseRotationZ" ) SetBaseRotationZ( StringToFloat(sValue) );
else if( sKeyName == "BaseZoomX" ) SetBaseZoomX( StringToFloat(sValue) );
else if( sKeyName == "BaseZoomY" ) SetBaseZoomY( StringToFloat(sValue) );
else if( sKeyName == "BaseZoomZ" ) SetBaseZoomZ( StringToFloat(sValue) );
else if( EndsWith(sKeyName,"Command") )
{
apActorCommands apac( new ActorCommands( sValue ) );
+1 -1
View File
@@ -188,7 +188,7 @@ int NoteSkinManager::GetMetricI( const RString &sButtonName, const RString &sVal
float NoteSkinManager::GetMetricF( const RString &sButtonName, const RString &sValueName )
{
return strtof( GetMetric(sButtonName,sValueName), NULL );
return StringToFloat( GetMetric(sButtonName,sValueName) );
}
bool NoteSkinManager::GetMetricB( const RString &sButtonName, const RString &sValueName )
+4 -4
View File
@@ -603,7 +603,7 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out )
if( GetTagFromMap( mapNameToData, "#bpm", sData ) )
{
BPMSegment newSeg( 0, strtof(sData, NULL) );
BPMSegment newSeg( 0, StringToFloat(sData) );
out.AddBPMSegment( newSeg );
LOG->Trace( "Inserting new BPM change at beat %f, BPM %f", NoteRowToBeat(newSeg.m_iStartIndex), newSeg.GetBPM() );
@@ -690,7 +690,7 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out )
RString sBPM;
if( GetTagFromMap( mapNameToData, sTagToLookFor, sBPM ) )
{
float fBPM = strtof( sBPM, NULL );
float fBPM = StringToFloat( sBPM );
BPMSegment newSeg;
newSeg.m_iStartIndex = BeatToNoteRow(fBeat);
@@ -710,7 +710,7 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out )
{
// find the BPM at the time of this freeze
float fBPS = out.m_Timing.GetBPMAtBeat(fBeat) / 60.0f;
float fBeats = strtof(sBeats,NULL) / 48.0f;
float fBeats = StringToFloat( sBeats ) / 48.0f;
float fFreezeSecs = fBeats / fBPS;
StopSegment newSeg( BeatToNoteRow(fBeat), fFreezeSecs );
@@ -736,7 +736,7 @@ void BMSLoader::ReadGlobalTags( const NameToData_t &mapNameToData, Song &out )
RString sTagToLookFor = ssprintf( "#bpm%02x", iBPMNo );
if( GetTagFromMap( mapNameToData, sTagToLookFor, sBPM ) )
{
float fBPM = strtof( sBPM, NULL );
float fBPM = StringToFloat( sBPM );
BPMSegment newSeg;
newSeg.m_iStartIndex = iStepIndex;
+7 -7
View File
@@ -346,9 +346,9 @@ float DWILoader::ParseBrokenDWITimestamp(const RString &arg1, const RString &arg
{
/* If the value contains a period, treat it as seconds; otherwise ms. */
if(arg1.find_first_of(".") != arg1.npos)
return strtof( arg1, NULL );
return StringToFloat( arg1 );
else
return strtof( arg1, NULL ) / 1000.f;
return StringToFloat( arg1 ) / 1000.f;
}
/* 2+ args */
@@ -404,7 +404,7 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out )
out.m_sCDTitleFile = sParams[1];
else if( 0==stricmp(sValueName,"BPM") )
out.AddBPMSegment( BPMSegment(0, strtof(sParams[1], NULL)) );
out.AddBPMSegment( BPMSegment(0, StringToFloat(sParams[1])) );
else if( 0==stricmp(sValueName,"DISPLAYBPM") )
{
@@ -454,8 +454,8 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out )
LOG->Warn( "Invalid FREEZE in '%s': '%s'", m_sLoadingFile.c_str(), arrayFreezeExpressions[f].c_str() );
continue;
}
int iFreezeRow = BeatToNoteRow( strtof( arrayFreezeValues[0],NULL ) / 4.0f );
float fFreezeSeconds = strtof( arrayFreezeValues[1], NULL ) / 1000.0f;
int iFreezeRow = BeatToNoteRow( StringToFloat(arrayFreezeValues[0]) / 4.0f );
float fFreezeSeconds = StringToFloat( arrayFreezeValues[1] ) / 1000.0f;
out.AddStopSegment( StopSegment(iFreezeRow, fFreezeSeconds) );
// LOG->Trace( "Adding a freeze segment: beat: %f, seconds = %f", fFreezeBeat, fFreezeSeconds );
@@ -478,8 +478,8 @@ bool DWILoader::LoadFromDWIFile( const RString &sPath, Song &out )
}
BPMSegment bs;
bs.m_iStartIndex = BeatToNoteRow( strtof( arrayBPMChangeValues[0],NULL ) / 4.0f );
bs.SetBPM( strtof( arrayBPMChangeValues[1], NULL ) );
bs.m_iStartIndex = BeatToNoteRow( StringToFloat(arrayBPMChangeValues[0]) / 4.0f );
bs.SetBPM( StringToFloat( arrayBPMChangeValues[1] ) );
out.AddBPMSegment( bs );
}
}
+6 -6
View File
@@ -282,17 +282,17 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
if( 0==stricmp(sValueName,"TITLE") )
LoadTags(sParams[1], out);
else if( 0==stricmp(sValueName,"BPM") )
out.AddBPMSegment( BPMSegment(0, strtof(sParams[1], NULL)) );
out.AddBPMSegment( BPMSegment(0, StringToFloat(sParams[1])) );
else if( 0==stricmp(sValueName,"BPM2") )
BPM2 = strtof( sParams[1], NULL );
BPM2 = StringToFloat( sParams[1] );
else if( 0==stricmp(sValueName,"BPM3") )
BPM3 = strtof( sParams[1], NULL );
BPM3 = StringToFloat( sParams[1] );
else if( 0==stricmp(sValueName,"BUNKI") )
BPMPos2 = strtof( sParams[1], NULL ) / 100.0f;
BPMPos2 = StringToFloat( sParams[1] ) / 100.0f;
else if( 0==stricmp(sValueName,"BUNKI2") )
BPMPos3 = strtof( sParams[1], NULL ) / 100.0f;
BPMPos3 = StringToFloat( sParams[1] ) / 100.0f;
else if( 0==stricmp(sValueName,"STARTTIME") )
out.m_Timing.m_fBeat0OffsetInSeconds = -strtof( sParams[1], NULL )/100;
out.m_Timing.m_fBeat0OffsetInSeconds = -StringToFloat( sParams[1] )/100;
else if( 0==stricmp(sValueName,"TICKCOUNT") ||
0==stricmp(sValueName,"STEP") ||
0==stricmp(sValueName,"DIFFICULTY"))
+13 -13
View File
@@ -53,7 +53,7 @@ void SMLoader::LoadFromSMTokens(
{
RadarValues v;
FOREACH_RadarCategory(rc)
v[rc] = strtof( saValues[rc], NULL );
v[rc] = StringToFloat( saValues[rc] );
out.SetCachedRadarValues( v );
}
@@ -95,7 +95,7 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out )
if( sValueName=="OFFSET" )
{
out.m_fBeat0OffsetInSeconds = strtof( sParams[1], NULL );
out.m_fBeat0OffsetInSeconds = StringToFloat( sParams[1] );
}
else if( sValueName=="STOPS" || sValueName=="FREEZES" )
{
@@ -115,8 +115,8 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out )
continue;
}
const float fFreezeBeat = strtof( arrayFreezeValues[0], NULL );
const float fFreezeSeconds = strtof( arrayFreezeValues[1], NULL );
const float fFreezeBeat = StringToFloat( arrayFreezeValues[0] );
const float fFreezeSeconds = StringToFloat( arrayFreezeValues[1] );
StopSegment new_seg;
new_seg.m_iStartRow = BeatToNoteRow(fFreezeBeat);
@@ -146,8 +146,8 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out )
continue;
}
const float fBeat = strtof( arrayBPMChangeValues[0], NULL );
const float fNewBPM = strtof( arrayBPMChangeValues[1], NULL );
const float fBeat = StringToFloat( arrayBPMChangeValues[0] );
const float fNewBPM = StringToFloat( arrayBPMChangeValues[1] );
BPMSegment new_seg;
new_seg.m_iStartIndex = BeatToNoteRow(fBeat);
@@ -212,13 +212,13 @@ bool LoadFromBGChangesString( BackgroundChange &change, const RString &sBGChange
change.m_sTransition = (atoi( aBGChangeValues[3] ) != 0) ? "CrossFade" : "";
// fall through
case 3:
change.m_fRate = strtof( aBGChangeValues[2], NULL );
change.m_fRate = StringToFloat( aBGChangeValues[2] );
// fall through
case 2:
change.m_def.m_sFile1 = aBGChangeValues[1];
// fall through
case 1:
change.m_fStartBeat = strtof( aBGChangeValues[0], NULL );
change.m_fStartBeat = StringToFloat( aBGChangeValues[0] );
// fall through
}
@@ -293,7 +293,7 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out )
{
if(!FromCache)
continue;
out.m_fMusicLengthSeconds = strtof( sParams[1], NULL );
out.m_fMusicLengthSeconds = StringToFloat( sParams[1] );
}
else if( sValueName=="MUSICBYTES" )
@@ -305,14 +305,14 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out )
{
if(!FromCache)
continue;
out.m_fFirstBeat = strtof( sParams[1], NULL );
out.m_fFirstBeat = StringToFloat( sParams[1] );
}
else if( sValueName=="LASTBEAT" )
{
if(!FromCache)
LOG->Trace("Ignored #LASTBEAT (cache only)");
out.m_fLastBeat = strtof( sParams[1], NULL );
out.m_fLastBeat = StringToFloat( sParams[1] );
}
else if( sValueName=="SONGFILENAME" )
{
@@ -344,11 +344,11 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out )
else
{
out.m_DisplayBPMType = Song::DISPLAY_SPECIFIED;
out.m_fSpecifiedBPMMin = strtof( sParams[1], NULL );
out.m_fSpecifiedBPMMin = StringToFloat( sParams[1] );
if( sParams[2].empty() )
out.m_fSpecifiedBPMMax = out.m_fSpecifiedBPMMin;
else
out.m_fSpecifiedBPMMax = strtof( sParams[2], NULL );
out.m_fSpecifiedBPMMax = StringToFloat( sParams[2] );
}
}
+1 -1
View File
@@ -242,7 +242,7 @@ void PlayerOptions::FromString( const RString &sOptions, bool bWarnOnInvalid )
if( s->Right(1) == "*" )
RageException::Throw("Invalid player options '%i*'; did you mean '*%i'?",
atoi(*s), atoi(*s) );
level = strtof( *s, NULL ) / 100.0f;
level = StringToFloat( *s ) / 100.0f;
}
else if( *s[0]=='*' )
{
+1 -1
View File
@@ -85,7 +85,7 @@ void RadarValues::FromString( RString sRadarValues )
}
FOREACH_RadarCategory(rc)
m_Values.f[rc] = strtof( saValues[rc], NULL );
m_Values.f[rc] = StringToFloat( saValues[rc] );
}
+2 -2
View File
@@ -574,10 +574,10 @@ static void CheckReversePackedPixels()
void SetupExtensions()
{
const float fGLVersion = strtof( (const char *) glGetString(GL_VERSION), NULL );
const float fGLVersion = StringToFloat( (const char *) glGetString(GL_VERSION) );
g_glVersion = int(roundf(fGLVersion * 10));
const float fGLUVersion = strtof( (const char *) gluGetString(GLU_VERSION), NULL );
const float fGLUVersion = StringToFloat( (const char *) gluGetString(GLU_VERSION) );
g_gluVersion = int(roundf(fGLUVersion * 10));
GLExt.Load( g_pWind );
+1 -1
View File
@@ -183,7 +183,7 @@ void GLExt_t::Load( LowLevelWindow *pWind )
}
else
{
const float fVersion = strtof( pzVersion, NULL );
const float fVersion = StringToFloat( pzVersion );
m_iShadingLanguageVersion = int(roundf(fVersion * 100));
/* The version string may contain extra information beyond the version number. */
LOG->Info( "OpenGL shading language: %s", pzVersion );
+5 -5
View File
@@ -2350,13 +2350,13 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
}
else if( SM == SM_BackFromBPMChange )
{
float fBPM = strtof( ScreenTextEntry::s_sLastAnswer, NULL );
float fBPM = StringToFloat( ScreenTextEntry::s_sLastAnswer );
if( fBPM > 0 )
m_pSong->SetBPMAtBeat( GAMESTATE->m_fSongBeat, fBPM );
}
else if( SM == SM_BackFromStopChange )
{
float fStop = strtof( ScreenTextEntry::s_sLastAnswer, NULL );
float fStop = StringToFloat( ScreenTextEntry::s_sLastAnswer );
if( fStop >= 0 )
m_pSong->m_Timing.SetStopAtBeat( GAMESTATE->m_fSongBeat, fStop );
}
@@ -2391,7 +2391,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
else if( SM == SM_BackFromInsertTapAttack )
{
int iDurationChoice = ScreenMiniMenu::s_viLastAnswers[0];
g_fLastInsertAttackDurationSeconds = strtof( g_InsertTapAttack.rows[0].choices[iDurationChoice], NULL );
g_fLastInsertAttackDurationSeconds = StringToFloat( g_InsertTapAttack.rows[0].choices[iDurationChoice] );
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertTapAttackPlayerOptions );
}
@@ -2422,7 +2422,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
int iAttack;
g_fLastInsertAttackPositionSeconds = m_pSong->GetElapsedTimeFromBeat( GAMESTATE->m_fSongBeat );
g_fLastInsertAttackDurationSeconds = strtof( g_InsertCourseAttack.rows[0].choices[iDurationChoice], NULL );
g_fLastInsertAttackDurationSeconds = StringToFloat( g_InsertCourseAttack.rows[0].choices[iDurationChoice] );
iAttack = FindAttackAtTime( ce.attacks, g_fLastInsertAttackPositionSeconds );
if( ScreenMiniMenu::s_iLastRowCode == ScreenEdit::remove )
@@ -3255,7 +3255,7 @@ void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, const vector<int> &iAns
}
newChange.m_fStartBeat = GAMESTATE->m_fSongBeat;
newChange.m_fRate = strtof( g_BackgroundChange.rows[rate].choices[iAnswers[rate]], NULL )/100.f;
newChange.m_fRate = StringToFloat( g_BackgroundChange.rows[rate].choices[iAnswers[rate]] )/100.f;
newChange.m_sTransition = g_BackgroundChange.rows[transition].choices[iAnswers[transition]];
newChange.m_def.m_sEffect = g_BackgroundChange.rows[effect].choices[iAnswers[effect]];
newChange.m_def.m_sColor1 = g_BackgroundChange.rows[color1].choices[iAnswers[color1]];
+2 -2
View File
@@ -547,14 +547,14 @@ RString XNode::GetXML() const
void XNode::GetValue( RString &out ) const { out = m_sValue; }
void XNode::GetValue( int &out ) const { out = atoi(m_sValue); }
void XNode::GetValue( float &out ) const { out = strtof(m_sValue, NULL); }
void XNode::GetValue( float &out ) const { out = StringToFloat(m_sValue); }
void XNode::GetValue( bool &out ) const { out = atoi(m_sValue) != 0; }
void XNode::GetValue( unsigned &out ) const { out = 0; sscanf(m_sValue,"%u",&out); }
void XNode::GetValue( DateTime &out ) const { out.FromString( m_sValue ); }
bool XNode::GetAttrValue( const RString &sName, RString &out ) const { const RString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = *pAttr; return true; }
bool XNode::GetAttrValue( const RString &sName, int &out ) const { const RString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = atoi(*pAttr); return true; }
bool XNode::GetAttrValue( const RString &sName, float &out ) const { const RString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = strtof(*pAttr, NULL); return true; }
bool XNode::GetAttrValue( const RString &sName, float &out ) const { const RString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = StringToFloat(*pAttr); return true; }
bool XNode::GetAttrValue( const RString &sName, bool &out ) const { const RString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = atoi(*pAttr) != 0; return true; }
bool XNode::GetAttrValue( const RString &sName, unsigned &out ) const { const RString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = 0; sscanf(*pAttr,"%u",&out); return true; }
bool XNode::GetAttrValue( const RString &sName, DateTime &out ) const { const RString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out.FromString( *pAttr ); return true; }