diff --git a/stepmania/src/BPMDisplay.cpp b/stepmania/src/BPMDisplay.cpp index 208cd9d0ca..432188ccac 100644 --- a/stepmania/src/BPMDisplay.cpp +++ b/stepmania/src/BPMDisplay.cpp @@ -104,8 +104,8 @@ void BPMDisplay::SetBPMRange( const DisplayBpms &bpms ) long int MaxBPM = INT_MIN; for( unsigned i = 0; i < BPMS.size(); ++i ) { - MinBPM = min( MinBPM, lroundf(BPMS[i]) ); - MaxBPM = max( MaxBPM, lroundf(BPMS[i]) ); + MinBPM = min( MinBPM, lrintf(BPMS[i]) ); + MaxBPM = max( MaxBPM, lrintf(BPMS[i]) ); } if( MinBPM == MaxBPM ) { diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index 88beebb6c0..b7837d2a58 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -191,7 +191,7 @@ void BitmapText::BuildChars() switch( m_VertAlign ) { case VertAlign_Top: iY = 0; break; - case VertAlign_Middle: iY = -lroundf(m_size.y/2.0f); break; + case VertAlign_Middle: iY = -lrintf(m_size.y/2.0f); break; case VertAlign_Bottom: iY = -(int)m_size.y; break; default: ASSERT( false ); } @@ -209,7 +209,7 @@ void BitmapText::BuildChars() switch( m_HorizAlign ) { case HorizAlign_Left: iX = 0; break; - case HorizAlign_Center: iX = -lroundf(iLineWidth/2.0f); break; + case HorizAlign_Center: iX = -lrintf(iLineWidth/2.0f); break; case HorizAlign_Right: iX = -iLineWidth; break; default: ASSERT( false ); } @@ -254,8 +254,8 @@ void BitmapText::DrawChars() return; const int iNumGlyphs = m_pTextures.size(); - int iStartGlyph = lroundf( SCALE( m_pTempState->crop.left, 0.f, 1.f, 0, (float) iNumGlyphs ) ); - int iEndGlyph = lroundf( SCALE( m_pTempState->crop.right, 0.f, 1.f, (float) iNumGlyphs, 0 ) ); + int iStartGlyph = lrintf( SCALE( m_pTempState->crop.left, 0.f, 1.f, 0, (float) iNumGlyphs ) ); + int iEndGlyph = lrintf( SCALE( m_pTempState->crop.right, 0.f, 1.f, (float) iNumGlyphs, 0 ) ); iStartGlyph = clamp( iStartGlyph, 0, iNumGlyphs ); iEndGlyph = clamp( iEndGlyph, 0, iNumGlyphs ); @@ -565,7 +565,7 @@ void BitmapText::DrawPrimitives() vector vGlyphJitter; if( m_bJitter ) { - int iSeed = lroundf( RageTimer::GetTimeSinceStartFast()*8 ); + int iSeed = lrintf( RageTimer::GetTimeSinceStartFast()*8 ); RandomGen rnd( iSeed ); for( unsigned i=0; iGetNumFrames(); i++ ) - aiFrameWidths[i] = lroundf( aiFrameWidths[i] * cfg.m_fScaleAllWidthsBy ); + aiFrameWidths[i] = lrintf( aiFrameWidths[i] * cfg.m_fScaleAllWidthsBy ); } m_iCharToGlyphNo = cfg.CharToGlyphNo; diff --git a/stepmania/src/NoteDataUtil.cpp b/stepmania/src/NoteDataUtil.cpp index 1e02caf5dc..2345586002 100644 --- a/stepmania/src/NoteDataUtil.cpp +++ b/stepmania/src/NoteDataUtil.cpp @@ -20,7 +20,7 @@ NoteType NoteDataUtil::GetSmallestNoteTypeForMeasure( const NoteData &n, int iMe for( nt=(NoteType)0; ntTrace("from %f (%i) to (%i)", FromBeat, FromRow, ToRow); -// const int ToRow = lroundf(FromRow * song.m_Timing.m_BPMSegments[0].m_fBPM / song.m_BPMSegments[seg].m_fBPM); +// const int ToRow = lrintf(FromRow * song.m_Timing.m_BPMSegments[0].m_fBPM / song.m_BPMSegments[seg].m_fBPM); // const int Rows = out.GetLastRow() - FromRow + 1; // int LastRow; // if(seg+1 < song.m_Timing.m_BPMSegments().size()) @@ -46,7 +46,7 @@ void KSFLoader::RemoveHoles( NoteData &out, const Song &song ) if( tn == TAP_EMPTY ) continue; - const int RealRow = lroundf(row * OrigBPM / CurBPM); + const int RealRow = lrintf(row * OrigBPM / CurBPM); if( RealRow == row ) continue; LOG->Trace("from %i to %i", row, RealRow); diff --git a/stepmania/src/NotesWriterDWI.cpp b/stepmania/src/NotesWriterDWI.cpp index 477e9071ba..1b8df6d76e 100644 --- a/stepmania/src/NotesWriterDWI.cpp +++ b/stepmania/src/NotesWriterDWI.cpp @@ -361,7 +361,7 @@ bool NotesWriterDWI::Write( RString sPath, const Song &out ) ASSERT( out.m_Timing.m_BPMSegments[0].m_iStartIndex == 0 ); f.PutLine( ssprintf("#FILE:%s;", DwiEscape(out.m_sMusicFile).c_str()) ); f.PutLine( ssprintf("#BPM:%.3f;", out.m_Timing.m_BPMSegments[0].GetBPM()) ); - f.PutLine( ssprintf("#GAP:%ld;", -lroundf( out.m_Timing.m_fBeat0OffsetInSeconds*1000 )) ); + f.PutLine( ssprintf("#GAP:%ld;", -lrintf( out.m_Timing.m_fBeat0OffsetInSeconds*1000 )) ); f.PutLine( ssprintf("#SAMPLESTART:%.3f;", out.m_fMusicSampleStartSeconds) ); f.PutLine( ssprintf("#SAMPLELENGTH:%.3f;", out.m_fMusicSampleLengthSeconds) ); if( out.m_sCDTitleFile.size() ) diff --git a/stepmania/src/OptionRow.cpp b/stepmania/src/OptionRow.cpp index f2b4642b86..ca32784b85 100644 --- a/stepmania/src/OptionRow.cpp +++ b/stepmania/src/OptionRow.cpp @@ -704,9 +704,9 @@ void OptionRow::GetWidthXY( PlayerNumber pn, int iChoiceOnRow, int &iWidthOut, i { const BitmapText &text = GetTextItemForRow( pn, iChoiceOnRow ); - iWidthOut = lroundf( text.GetZoomedWidth() ); - iXOut = lroundf( text.GetDestX() ); - iYOut = lroundf( m_Frame.GetDestY() ); + iWidthOut = lrintf( text.GetZoomedWidth() ); + iXOut = lrintf( text.GetDestX() ); + iYOut = lrintf( m_Frame.GetDestY() ); } diff --git a/stepmania/src/PlayerOptions.cpp b/stepmania/src/PlayerOptions.cpp index 7dde0655d3..0c368d6405 100644 --- a/stepmania/src/PlayerOptions.cpp +++ b/stepmania/src/PlayerOptions.cpp @@ -71,7 +71,7 @@ static void AddPart( vector &AddTo, float level, RString name ) if( level == 0 ) return; - const RString LevelStr = (level == 1)? RString(""): ssprintf( "%ld%% ", lroundf(level*100) ); + const RString LevelStr = (level == 1)? RString(""): ssprintf( "%ld%% ", lrintf(level*100) ); AddTo.push_back( LevelStr + name ); } diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 0ffb3e6857..72e9f8e0d9 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -528,10 +528,10 @@ static void CheckReversePackedPixels() void SetupExtensions() { const float fGLVersion = StringToFloat( (const char *) glGetString(GL_VERSION) ); - g_glVersion = lroundf( fGLVersion * 10 ); + g_glVersion = lrintf( fGLVersion * 10 ); const float fGLUVersion = StringToFloat( (const char *) gluGetString(GLU_VERSION) ); - g_gluVersion = lroundf( fGLUVersion * 10 ); + g_gluVersion = lrintf( fGLUVersion * 10 ); GLExt.Load( g_pWind ); diff --git a/stepmania/src/RageDisplay_OGL_Helpers.cpp b/stepmania/src/RageDisplay_OGL_Helpers.cpp index c68d8495b8..cbbd713018 100644 --- a/stepmania/src/RageDisplay_OGL_Helpers.cpp +++ b/stepmania/src/RageDisplay_OGL_Helpers.cpp @@ -208,7 +208,7 @@ void GLExt_t::Load( LowLevelWindow *pWind ) else { const float fVersion = StringToFloat( pzVersion ); - m_iShadingLanguageVersion = lroundf( fVersion * 100 ); + m_iShadingLanguageVersion = lrintf( 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/RageSurfaceUtils.cpp b/stepmania/src/RageSurfaceUtils.cpp index 18be46939f..5eeb7a80a5 100644 --- a/stepmania/src/RageSurfaceUtils.cpp +++ b/stepmania/src/RageSurfaceUtils.cpp @@ -876,13 +876,13 @@ RageSurface *RageSurfaceUtils::PalettizeToGrayscale( const RageSurface *src_surf if( Ivalues == 1 ) ScaledI = 255; // if only one intensity value, always fullbright else - ScaledI = clamp( lroundf(I * (255.0f / (Ivalues-1))), 0L, 255L ); + ScaledI = clamp( lrintf(I * (255.0f / (Ivalues-1))), 0L, 255L ); int ScaledA; if( Avalues == 1 ) ScaledA = 255; // if only one alpha value, always opaque else - ScaledA = clamp( lroundf(A * (255.0f / (Avalues-1))), 0L, 255L ); + ScaledA = clamp( lrintf(A * (255.0f / (Avalues-1))), 0L, 255L ); RageSurfaceColor c; c.r = uint8_t(ScaledI); diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 3ccb1ccea8..e1b34e40dd 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -559,8 +559,8 @@ void ScreenEvaluation::Init() RadarCategory_Jumps, RadarCategory_Holds, RadarCategory_Mines, RadarCategory_Hands, RadarCategory_Rolls }; const int ind = indeces[l]; - const int iActual = lroundf(STATSMAN->m_CurStageStats.m_player[p].m_radarActual[ind]); - const int iPossible = lroundf(STATSMAN->m_CurStageStats.m_player[p].m_radarPossible[ind]); + const int iActual = lrintf(STATSMAN->m_CurStageStats.m_player[p].m_radarActual[ind]); + const int iPossible = lrintf(STATSMAN->m_CurStageStats.m_player[p].m_radarPossible[ind]); m_textStatsText[l][p].SetText( ssprintf("%3d/%3d",iActual,iPossible) ); } diff --git a/stepmania/src/ScreenNameEntry.cpp b/stepmania/src/ScreenNameEntry.cpp index 63a80ee75b..a474fb0dec 100644 --- a/stepmania/src/ScreenNameEntry.cpp +++ b/stepmania/src/ScreenNameEntry.cpp @@ -67,7 +67,7 @@ void ScreenNameEntry::ScrollingText::Init( const RString &sName, const vectorm_fSongBeat; - const size_t iClosestIndex = lroundf( fFakeBeat ) % g_sNameChars.size(); + const size_t iClosestIndex = lrintf( fFakeBeat ) % g_sNameChars.size(); const float fClosestYOffset = GetClosestCharYOffset( fFakeBeat ); size_t iCharIndex = ( iClosestIndex - NUM_CHARS_TO_DRAW_BEHIND + g_sNameChars.size() ) % g_sNameChars.size(); @@ -103,7 +103,7 @@ void ScreenNameEntry::ScrollingText::DrawPrimitives() char ScreenNameEntry::ScrollingText::GetClosestChar( float fFakeBeat ) const { ASSERT( fFakeBeat >= 0.f ); - return g_sNameChars[lroundf(fFakeBeat) % g_sNameChars.size()]; + return g_sNameChars[lrintf(fFakeBeat) % g_sNameChars.size()]; } // return value is relative to gray arrows diff --git a/stepmania/src/SongOptions.cpp b/stepmania/src/SongOptions.cpp index a69cdb53d7..33bc1b1f3e 100644 --- a/stepmania/src/SongOptions.cpp +++ b/stepmania/src/SongOptions.cpp @@ -43,7 +43,7 @@ static void AddPart( vector &AddTo, float level, RString name ) if( level == 0 ) return; - const RString LevelStr = (level == 1)? RString(""): ssprintf( "%ld%% ", lroundf(level*100) ); + const RString LevelStr = (level == 1)? RString(""): ssprintf( "%ld%% ", lrintf(level*100) ); AddTo.push_back( LevelStr + name ); } diff --git a/stepmania/src/Trail.cpp b/stepmania/src/Trail.cpp index dcbf89bdf6..19766cc57b 100644 --- a/stepmania/src/Trail.cpp +++ b/stepmania/src/Trail.cpp @@ -112,7 +112,7 @@ int Trail::GetMeter() const float fMeter = GetTotalMeter() / (float)m_vEntries.size(); - return lroundf( fMeter ); + return lrintf( fMeter ); } int Trail::GetTotalMeter() const diff --git a/stepmania/src/Workout.cpp b/stepmania/src/Workout.cpp index 9f18ad60ab..50a64e8860 100644 --- a/stepmania/src/Workout.cpp +++ b/stepmania/src/Workout.cpp @@ -69,7 +69,7 @@ static int CalculateWorkoutProgramMeter( WorkoutProgram wp, int iAverageMeter, i case WorkoutProgram_FatBurn: { float fMeter = SCALE( iSongInBodyIndex % 4, 0.0f, 3.0f, (float)iMinMeter, (float)iMaxMeter ); - iMeter = lroundf( fMeter ); + iMeter = lrintf( fMeter ); } break; case WorkoutProgram_FitnessTest: @@ -92,7 +92,7 @@ static int CalculateWorkoutProgramMeter( WorkoutProgram wp, int iAverageMeter, i break; case 4: case 5: - iMeter = lroundf( SCALE( 0.5f, 0.0f, 1.0f, (float)iMinMeter, (float)iMaxMeter ) ); + iMeter = lrintf( SCALE( 0.5f, 0.0f, 1.0f, (float)iMinMeter, (float)iMaxMeter ) ); break; } } @@ -107,7 +107,7 @@ static int CalculateWorkoutProgramMeter( WorkoutProgram wp, int iAverageMeter, i float fMeter = SCALE( iSongInBodyIndex % 4, 0.0f, 3.0f, (float)iMinMeter, (float)iMaxMeter ); if( (iSongInBodyIndex % 8) >= 4 ) fMeter = SCALE( fMeter, (float)iMinMeter, (float)iMaxMeter, (float)iMaxMeter, (float)iMinMeter ); - iMeter = lroundf( fMeter ); + iMeter = lrintf( fMeter ); } break; case WorkoutProgram_Flat: diff --git a/stepmania/src/archutils/Darwin/DarwinThreadHelpers.cpp b/stepmania/src/archutils/Darwin/DarwinThreadHelpers.cpp index 16b9bd882e..e27e51db71 100644 --- a/stepmania/src/archutils/Darwin/DarwinThreadHelpers.cpp +++ b/stepmania/src/archutils/Darwin/DarwinThreadHelpers.cpp @@ -58,7 +58,7 @@ void SetThreadPrecedence( float prec ) // Real values are between 0 and 63. if( CLAMP(prec, 0.0f, 1.0f) ) LOG->Warn( "Thread precedence clamped to %f.", prec ); - thread_precedence_policy po = { integer_t( lroundf(prec * 63) ) }; + thread_precedence_policy po = { integer_t( lrintf(prec * 63) ) }; kern_return_t ret = thread_policy_set( mach_thread_self(), THREAD_PRECEDENCE_POLICY, (thread_policy_t)&po, THREAD_PRECEDENCE_POLICY_COUNT ); diff --git a/stepmania/src/global.h b/stepmania/src/global.h index df077ce6e5..0385abc0ee 100644 --- a/stepmania/src/global.h +++ b/stepmania/src/global.h @@ -208,11 +208,6 @@ inline float roundf( float f ) CONST_FUNCTION; float roundf( float f ) { if( f < 0.0f ) return truncf( f-0.5f ); return truncf( f+0.5f ); } #endif -#ifdef NEED_LROUNDF -inline long int lroundf( float f ) CONST_FUNCTION; -long int lroundf( float f ) { return (long int)roundf( f ); } -#endif - #ifdef NEED_STRTOF inline float strtof( const char *s, char **se ) { return (float) strtod( s, se ); } #endif