diff --git a/stepmania/src/NoteTypes.h b/stepmania/src/NoteTypes.h index 0af3d49ed4..620ba705a6 100644 --- a/stepmania/src/NoteTypes.h +++ b/stepmania/src/NoteTypes.h @@ -88,7 +88,7 @@ struct HoldNote }; -inline int BeatToNoteRow( float fBeatNum ) { return int( fBeatNum * ROWS_PER_BEAT + 0.5f); }; // round +inline int BeatToNoteRow( float fBeatNum ) { return (int) roundf( fBeatNum * ROWS_PER_BEAT); }; inline int BeatToNoteRowNotRounded( float fBeatNum ) { return (int)( fBeatNum * ROWS_PER_BEAT ); }; inline float NoteRowToBeat( float fNoteIndex ) { return fNoteIndex / (float)ROWS_PER_BEAT; }; inline float NoteRowToBeat( int iNoteIndex ) { return NoteRowToBeat( (float)iNoteIndex ); }; diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index 2e88998931..37b3f4f212 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -119,19 +119,6 @@ inline float randomf( const float low=-1.0f, const float high=1.0f ) return low + ( high - low ) * ( (float)rand() ) / RAND_MAX; } -/* XXX: These are C99 functions (except for the roundf(double) overload); what's - * the C99 define we can test for? XXX autoconf */ -#if defined(WIN32) -inline double trunc( double f ) { return float(int(f)); }; -#else -#include -#endif -#if defined(NEED_TRUNCF) -inline float truncf( float f ) { return float(int(f)); }; -#endif -#if defined(NEED_ROUNDF) -inline float roundf( float f ) { if(f < 0) return truncf(f-0.5f); return truncf(f+0.5f); }; -#endif inline float froundf( const float f, const float fRoundInterval ) { return int( (f + fRoundInterval/2)/fRoundInterval ) * fRoundInterval; diff --git a/stepmania/src/global.h b/stepmania/src/global.h index 6032012bd3..9ea622cd8f 100644 --- a/stepmania/src/global.h +++ b/stepmania/src/global.h @@ -136,6 +136,14 @@ inline float cosf(float x) { return float(cos(double(x))); } inline float acosf(float x) { return float(acos(double(x))); } #endif +#ifdef NEED_TRUNCF +inline float truncf( float f ) { return float(int(f)); }; +#endif + +#ifdef NEED_ROUNDF +inline float roundf( float f ) { if(f < 0) return truncf(f-0.5f); return truncf(f+0.5f); }; +#endif + #ifdef _XBOX #include #include