diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 12fa4120e6..84186ca96a 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -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 ) ); diff --git a/stepmania/src/NoteSkinManager.cpp b/stepmania/src/NoteSkinManager.cpp index 25c2fb81df..1fa967595c 100644 --- a/stepmania/src/NoteSkinManager.cpp +++ b/stepmania/src/NoteSkinManager.cpp @@ -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 ) diff --git a/stepmania/src/NotesLoaderBMS.cpp b/stepmania/src/NotesLoaderBMS.cpp index 36bba3a662..56eebe764a 100644 --- a/stepmania/src/NotesLoaderBMS.cpp +++ b/stepmania/src/NotesLoaderBMS.cpp @@ -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; diff --git a/stepmania/src/NotesLoaderDWI.cpp b/stepmania/src/NotesLoaderDWI.cpp index ed32f59d6d..0871673d87 100644 --- a/stepmania/src/NotesLoaderDWI.cpp +++ b/stepmania/src/NotesLoaderDWI.cpp @@ -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 ); } } diff --git a/stepmania/src/NotesLoaderKSF.cpp b/stepmania/src/NotesLoaderKSF.cpp index ca0ed43d65..cf50ef575e 100644 --- a/stepmania/src/NotesLoaderKSF.cpp +++ b/stepmania/src/NotesLoaderKSF.cpp @@ -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")) diff --git a/stepmania/src/NotesLoaderSM.cpp b/stepmania/src/NotesLoaderSM.cpp index 01e06b658a..fd4c28095e 100644 --- a/stepmania/src/NotesLoaderSM.cpp +++ b/stepmania/src/NotesLoaderSM.cpp @@ -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] ); } } diff --git a/stepmania/src/PlayerOptions.cpp b/stepmania/src/PlayerOptions.cpp index ec784d8fb5..e6d3d786e0 100644 --- a/stepmania/src/PlayerOptions.cpp +++ b/stepmania/src/PlayerOptions.cpp @@ -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]=='*' ) { diff --git a/stepmania/src/RadarValues.cpp b/stepmania/src/RadarValues.cpp index feedda9298..5b9000ed42 100644 --- a/stepmania/src/RadarValues.cpp +++ b/stepmania/src/RadarValues.cpp @@ -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] ); } diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 6046710e3b..2ef35c1b42 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -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 ); diff --git a/stepmania/src/RageDisplay_OGL_Extensions.cpp b/stepmania/src/RageDisplay_OGL_Extensions.cpp index a916e61b3a..e3ca4abc12 100644 --- a/stepmania/src/RageDisplay_OGL_Extensions.cpp +++ b/stepmania/src/RageDisplay_OGL_Extensions.cpp @@ -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 ); diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index f45046de4f..dee8594144 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -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 &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]]; diff --git a/stepmania/src/XmlFile.cpp b/stepmania/src/XmlFile.cpp index 1407377863..f105d807dc 100644 --- a/stepmania/src/XmlFile.cpp +++ b/stepmania/src/XmlFile.cpp @@ -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; }