From acda44238db9c33a15b43d9b4ef8da4596fc0cc8 Mon Sep 17 00:00:00 2001 From: Kyzentun Keeslala Date: Sun, 7 Feb 2016 15:35:05 -0700 Subject: [PATCH 1/8] Replace RageFastSin and RageFastCos with standard library versions because the standard library is faster. Use fmod in spline evaluation. --- src/Actor.cpp | 16 ++--- src/ArrowEffects.cpp | 18 +++--- src/CubicSpline.cpp | 4 +- src/GraphDisplay.cpp | 4 +- src/GrooveRadar.cpp | 8 +-- src/NoteField.cpp | 4 +- src/RageDisplay.cpp | 4 +- src/RageMath.cpp | 143 +++++++++++++------------------------------ src/RageMath.h | 3 - src/Tween.cpp | 2 +- 10 files changed, 71 insertions(+), 135 deletions(-) diff --git a/src/Actor.cpp b/src/Actor.cpp index 1173ea82c8..fd48a0564f 100644 --- a/src/Actor.cpp +++ b/src/Actor.cpp @@ -470,7 +470,7 @@ void Actor::PreDraw() // calculate actor properties ssprintf("PercentThroughEffect: %f", fPercentThroughEffect) ); bool bBlinkOn = fPercentThroughEffect > 0.5f; - float fPercentBetweenColors = RageFastSin( (fPercentThroughEffect + 0.25f) * 2 * PI ) / 2 + 0.5f; + float fPercentBetweenColors = std::sin( (fPercentThroughEffect + 0.25f) * 2 * PI ) / 2 + 0.5f; ASSERT_M( fPercentBetweenColors >= 0 && fPercentBetweenColors <= 1, ssprintf("PercentBetweenColors: %f, PercentThroughEffect: %f", fPercentBetweenColors, fPercentThroughEffect) ); float fOriginalAlpha = tempState.diffuse[0].a; @@ -516,15 +516,15 @@ void Actor::PreDraw() // calculate actor properties break; case rainbow: tempState.diffuse[0] = RageColor( - RageFastCos( fPercentBetweenColors*2*PI ) * 0.5f + 0.5f, - RageFastCos( fPercentBetweenColors*2*PI + PI * 2.0f / 3.0f ) * 0.5f + 0.5f, - RageFastCos( fPercentBetweenColors*2*PI + PI * 4.0f / 3.0f) * 0.5f + 0.5f, + std::cos( fPercentBetweenColors*2*PI ) * 0.5f + 0.5f, + std::cos( fPercentBetweenColors*2*PI + PI * 2.0f / 3.0f ) * 0.5f + 0.5f, + std::cos( fPercentBetweenColors*2*PI + PI * 4.0f / 3.0f) * 0.5f + 0.5f, fOriginalAlpha ); for( int i=1; im_PlayerNumber]; - float fExpandMultiplier = SCALE( RageFastCos(data.m_fExpandSeconds*EXPAND_MULTIPLIER_FREQUENCY), + float fExpandMultiplier = SCALE( std::cos(data.m_fExpandSeconds*EXPAND_MULTIPLIER_FREQUENCY), EXPAND_MULTIPLIER_SCALE_FROM_LOW, EXPAND_MULTIPLIER_SCALE_FROM_HIGH, EXPAND_MULTIPLIER_SCALE_TO_LOW, EXPAND_MULTIPLIER_SCALE_TO_HIGH ); fScrollSpeed *= SCALE( fAccels[PlayerOptions::ACCEL_EXPAND], @@ -495,7 +495,7 @@ float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float float fRads = acosf( fPositionBetween ); fRads += fYOffset * TORNADO_OFFSET_FREQUENCY / SCREEN_HEIGHT; - const float fAdjustedPixelOffset = SCALE( RageFastCos(fRads), TORNADO_OFFSET_SCALE_FROM_LOW, TORNADO_OFFSET_SCALE_FROM_HIGH, + const float fAdjustedPixelOffset = SCALE( std::cos(fRads), TORNADO_OFFSET_SCALE_FROM_LOW, TORNADO_OFFSET_SCALE_FROM_HIGH, data.m_fMinTornadoX[iColNum], data.m_fMaxTornadoX[iColNum] ); fPixelOffsetFromCenter += (fAdjustedPixelOffset - fRealPixelOffset) * fEffects[PlayerOptions::EFFECT_TORNADO]; @@ -503,7 +503,7 @@ float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float if( fEffects[PlayerOptions::EFFECT_DRUNK] != 0 ) fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_DRUNK] * - ( RageFastCos( RageTimer::GetTimeSinceStartFast() + iColNum*DRUNK_COLUMN_FREQUENCY + ( std::cos( RageTimer::GetTimeSinceStartFast() + iColNum*DRUNK_COLUMN_FREQUENCY + fYOffset*DRUNK_OFFSET_FREQUENCY/SCREEN_HEIGHT) * ARROW_SIZE*DRUNK_ARROW_MAGNITUDE ); if( fEffects[PlayerOptions::EFFECT_FLIP] != 0 ) { @@ -520,7 +520,7 @@ float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float if( fEffects[PlayerOptions::EFFECT_BEAT] != 0 ) { - const float fShift = data.m_fBeatFactor*RageFastSin( fYOffset / BEAT_OFFSET_HEIGHT + PI/BEAT_PI_HEIGHT ); + const float fShift = data.m_fBeatFactor*std::sin( fYOffset / BEAT_OFFSET_HEIGHT + PI/BEAT_PI_HEIGHT ); fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_BEAT] * fShift; } @@ -715,7 +715,7 @@ float ArrowGetPercentVisible(float fYPosWithoutReverse) fVisibleAdjust -= fAppearances[PlayerOptions::APPEARANCE_STEALTH]; if( fAppearances[PlayerOptions::APPEARANCE_BLINK] != 0 ) { - float f = RageFastSin(RageTimer::GetTimeSinceStartFast()*10); + float f = std::sin(RageTimer::GetTimeSinceStartFast()*10); f = Quantize( f, BLINK_MOD_FREQUENCY ); fVisibleAdjust += SCALE( f, 0, 1, -1, 0 ); } @@ -783,7 +783,7 @@ float ArrowEffects::GetZPos(int iCol, float fYOffset) const float* fEffects = curr_options->m_fEffects; if( fEffects[PlayerOptions::EFFECT_BUMPY] != 0 ) - fZPos += fEffects[PlayerOptions::EFFECT_BUMPY] * 40*RageFastSin( fYOffset/16.0f ); + fZPos += fEffects[PlayerOptions::EFFECT_BUMPY] * 40*std::sin( fYOffset/16.0f ); return fZPos; } diff --git a/src/CubicSpline.cpp b/src/CubicSpline.cpp index 443d995f10..d4dce0ccc6 100644 --- a/src/CubicSpline.cpp +++ b/src/CubicSpline.cpp @@ -413,8 +413,8 @@ void CubicSpline::p_and_tfrac_from_t(float t, bool loop, size_t& p, float& tfrac if(loop) { float max_t= static_cast(m_points.size()); - while(t >= max_t) { t-= max_t; } - while(t < 0.0f) { t+= max_t; } + t= std::fmod(t, max_t); + if(t < 0.0f) { t+= max_t; } p= static_cast(t); tfrac= t - static_cast(p); } diff --git a/src/GraphDisplay.cpp b/src/GraphDisplay.cpp index a5b8ee4c73..11100a30cb 100644 --- a/src/GraphDisplay.cpp +++ b/src/GraphDisplay.cpp @@ -51,8 +51,8 @@ public: for( int i = 0; i < iSubdivisions+1; ++i ) { const float fRotation = float(i) / iSubdivisions * 2*PI; - const float fX = RageFastCos(fRotation) * fRadius; - const float fY = -RageFastSin(fRotation) * fRadius; + const float fX = std::cos(fRotation) * fRadius; + const float fY = -std::sin(fRotation) * fRadius; pVerts[1+i] = v; pVerts[1+i].p.x += fX; pVerts[1+i].p.y += fY; diff --git a/src/GrooveRadar.cpp b/src/GrooveRadar.cpp index 93deafef8a..28b3e18a44 100644 --- a/src/GrooveRadar.cpp +++ b/src/GrooveRadar.cpp @@ -170,8 +170,8 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() const float fDistFromCenter = ( m_fValuesOld[c] * (1-m_PercentTowardNew) + m_fValuesNew[c] * m_PercentTowardNew + 0.07f ) * fRadius; const float fRotation = RADAR_VALUE_ROTATION(i); - const float fX = RageFastCos(fRotation) * fDistFromCenter; - const float fY = -RageFastSin(fRotation) * fDistFromCenter; + const float fX = std::cos(fRotation) * fDistFromCenter; + const float fY = -std::sin(fRotation) * fDistFromCenter; v[1+i].p = RageVector3( fX, fY, 0 ); v[1+i].c = v[1].c; @@ -186,8 +186,8 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() const float fDistFromCenter = ( m_fValuesOld[c] * (1-m_PercentTowardNew) + m_fValuesNew[c] * m_PercentTowardNew + 0.07f ) * fRadius; const float fRotation = RADAR_VALUE_ROTATION(i); - const float fX = RageFastCos(fRotation) * fDistFromCenter; - const float fY = -RageFastSin(fRotation) * fDistFromCenter; + const float fX = std::cos(fRotation) * fDistFromCenter; + const float fY = -std::sin(fRotation) * fDistFromCenter; v[i].p = RageVector3( fX, fY, 0 ); v[i].c = this->m_pTempState->diffuse[0]; diff --git a/src/NoteField.cpp b/src/NoteField.cpp index a7836695a4..cf73dfe11c 100644 --- a/src/NoteField.cpp +++ b/src/NoteField.cpp @@ -830,7 +830,7 @@ void NoteField::DrawPrimitives() ASSERT(GAMESTATE->m_pCurSong != NULL); const TimingData &timing = *pTiming; - const RageColor text_glow= RageColor(1,1,1,RageFastCos(RageTimer::GetTimeSinceStartFast()*2)/2+0.5f); + const RageColor text_glow= RageColor(1,1,1,std::cos(RageTimer::GetTimeSinceStartFast()*2)/2+0.5f); float horiz_align= align_right; float side_sign= 1; @@ -1014,7 +1014,7 @@ void NoteField::DrawPrimitives() *m_FieldRenderArgs.selection_end_marker != -1) { m_FieldRenderArgs.selection_glow= SCALE( - RageFastCos(RageTimer::GetTimeSinceStartFast()*2), -1, 1, 0.1f, 0.3f); + std::cos(RageTimer::GetTimeSinceStartFast()*2), -1, 1, 0.1f, 0.3f); } m_FieldRenderArgs.fade_before_targets= FADE_BEFORE_TARGETS_PERCENT; diff --git a/src/RageDisplay.cpp b/src/RageDisplay.cpp index 292d00e35c..e593a4f82a 100644 --- a/src/RageDisplay.cpp +++ b/src/RageDisplay.cpp @@ -233,8 +233,8 @@ void RageDisplay::DrawCircleInternal( const RageSpriteVertex &p, float radius ) for(int i = 0; i < subdivisions+1; ++i) { const float fRotation = float(i) / subdivisions * 2*PI; - const float fX = RageFastCos(fRotation) * radius; - const float fY = -RageFastSin(fRotation) * radius; + const float fX = std::cos(fRotation) * radius; + const float fY = -std::sin(fRotation) * radius; v[1+i] = v[0]; v[1+i].p.x += fX; v[1+i].p.y += fY; diff --git a/src/RageMath.cpp b/src/RageMath.cpp index 4f403e34d5..a014831c2b 100644 --- a/src/RageMath.cpp +++ b/src/RageMath.cpp @@ -246,10 +246,10 @@ void RageMatrixRotationX( RageMatrix* pOut, float theta ) theta *= PI/180; RageMatrixIdentity(pOut); - pOut->m[1][1] = RageFastCos(theta); + pOut->m[1][1] = std::cos(theta); pOut->m[2][2] = pOut->m[1][1]; - pOut->m[2][1] = RageFastSin(theta); + pOut->m[2][1] = std::sin(theta); pOut->m[1][2] = -pOut->m[2][1]; } @@ -258,10 +258,10 @@ void RageMatrixRotationY( RageMatrix* pOut, float theta ) theta *= PI/180; RageMatrixIdentity(pOut); - pOut->m[0][0] = RageFastCos(theta); + pOut->m[0][0] = std::cos(theta); pOut->m[2][2] = pOut->m[0][0]; - pOut->m[0][2] = RageFastSin(theta); + pOut->m[0][2] = std::sin(theta); pOut->m[2][0] = -pOut->m[0][2]; } @@ -270,10 +270,10 @@ void RageMatrixRotationZ( RageMatrix* pOut, float theta ) theta *= PI/180; RageMatrixIdentity(pOut); - pOut->m[0][0] = RageFastCos(theta); + pOut->m[0][0] = std::cos(theta); pOut->m[1][1] = pOut->m[0][0]; - pOut->m[0][1] = RageFastSin(theta); + pOut->m[0][1] = std::sin(theta); pOut->m[1][0] = -pOut->m[0][1]; } @@ -286,12 +286,12 @@ void RageMatrixRotationXYZ( RageMatrix* pOut, float rX, float rY, float rZ ) rY *= PI/180; rZ *= PI/180; - const float cX = RageFastCos(rX); - const float sX = RageFastSin(rX); - const float cY = RageFastCos(rY); - const float sY = RageFastSin(rY); - const float cZ = RageFastCos(rZ); - const float sZ = RageFastSin(rZ); + const float cX = std::cos(rX); + const float sX = std::sin(rX); + const float cY = std::cos(rY); + const float sY = std::sin(rY); + const float cZ = std::cos(rZ); + const float sZ = std::sin(rZ); /* * X*Y: @@ -333,8 +333,8 @@ void RageMatrixRotationXYZ( RageMatrix* pOut, float rX, float rY, float rZ ) void RageAARotate(RageVector3* inret, RageVector3 const* axis, float angle) { float ha= angle/2.0f; - float ca2= RageFastCos(ha); - float sa2= RageFastSin(ha); + float ca2= std::cos(ha); + float sa2= std::sin(ha); RageVector4 quat(axis->x * sa2, axis->y * sa2, axis->z * sa2, ca2); RageVector4 quatc(-quat.x, -quat.y, -quat.z, ca2); RageVector4 point(inret->x, inret->y, inret->z, 0.0f); @@ -374,8 +374,8 @@ RageVector4 RageQuatFromH(float theta ) theta *= PI/180.0f; theta /= 2.0f; theta *= -1; - const float c = RageFastCos(theta); - const float s = RageFastSin(theta); + const float c = std::cos(theta); + const float s = std::sin(theta); return RageVector4(0, s, 0, c); } @@ -385,8 +385,8 @@ RageVector4 RageQuatFromP(float theta ) theta *= PI/180.0f; theta /= 2.0f; theta *= -1; - const float c = RageFastCos(theta); - const float s = RageFastSin(theta); + const float c = std::cos(theta); + const float s = std::sin(theta); return RageVector4(s, 0, 0, c); } @@ -396,8 +396,8 @@ RageVector4 RageQuatFromR(float theta ) theta *= PI/180.0f; theta /= 2.0f; theta *= -1; - const float c = RageFastCos(theta); - const float s = RageFastSin(theta); + const float c = std::cos(theta); + const float s = std::sin(theta); return RageVector4(0, 0, s, c); } @@ -412,12 +412,12 @@ void RageQuatFromHPR(RageVector4* pOut, RageVector3 hpr ) hpr /= 180.0f; hpr /= 2.0f; - const float sX = RageFastSin(hpr.x); - const float cX = RageFastCos(hpr.x); - const float sY = RageFastSin(hpr.y); - const float cY = RageFastCos(hpr.y); - const float sZ = RageFastSin(hpr.z); - const float cZ = RageFastCos(hpr.z); + const float sX = std::sin(hpr.x); + const float cX = std::cos(hpr.x); + const float sY = std::sin(hpr.y); + const float cY = std::cos(hpr.y); + const float sZ = std::sin(hpr.z); + const float cZ = std::cos(hpr.z); pOut->w = cX * cY * cZ + sX * sY * sZ; pOut->x = sX * cY * cZ - cX * sY * sZ; @@ -440,12 +440,12 @@ void RageQuatFromPRH(RageVector4* pOut, RageVector3 prh ) /* Set cX to the cosine of the angle we want to rotate on the X axis, * and so on. Here, hpr.z (roll) rotates on the Z axis, hpr.x (heading) * on Y, and hpr.y (pitch) on X. */ - const float sX = RageFastSin(prh.y); - const float cX = RageFastCos(prh.y); - const float sY = RageFastSin(prh.x); - const float cY = RageFastCos(prh.x); - const float sZ = RageFastSin(prh.z); - const float cZ = RageFastCos(prh.z); + const float sX = std::sin(prh.y); + const float cX = std::cos(prh.y); + const float sY = std::sin(prh.x); + const float cY = std::cos(prh.x); + const float sZ = std::sin(prh.z); + const float cZ = std::cos(prh.z); pOut->w = cX * cY * cZ + sX * sY * sZ; pOut->x = sX * cY * cZ - cX * sY * sZ; @@ -506,9 +506,9 @@ void RageQuatSlerp(RageVector4 *pOut, const RageVector4 &from, const RageVector4 { // standard case (slerp) float omega = acosf(cosom); - float sinom = RageFastSin(omega); - scale0 = RageFastSin((1.0f - t) * omega) / sinom; - scale1 = RageFastSin(t * omega) / sinom; + float sinom = std::sin(omega); + scale0 = std::sin((1.0f - t) * omega) / sinom; + scale1 = std::sin(t * omega) / sinom; } else { @@ -566,12 +566,12 @@ void RageMatrixAngles( RageMatrix* pOut, const RageVector3 &angles ) { const RageVector3 angles_radians( angles * 2*PI / 360 ); - const float sy = RageFastSin( angles_radians[2] ); - const float cy = RageFastCos( angles_radians[2] ); - const float sp = RageFastSin( angles_radians[1] ); - const float cp = RageFastCos( angles_radians[1] ); - const float sr = RageFastSin( angles_radians[0] ); - const float cr = RageFastCos( angles_radians[0] ); + const float sy = std::sin( angles_radians[2] ); + const float cy = std::cos( angles_radians[2] ); + const float sp = std::sin( angles_radians[1] ); + const float cp = std::cos( angles_radians[1] ); + const float sr = std::sin( angles_radians[0] ); + const float cr = std::cos( angles_radians[0] ); RageMatrixIdentity( pOut ); @@ -595,67 +595,6 @@ void RageMatrixTranspose( RageMatrix* pOut, const RageMatrix* pIn ) pOut->m[j][i] = pIn->m[i][j]; } -float RageFastSin( float x ) -{ - // from 0 to PI - // sizeof(table) == 4096 == one page of memory in Windows - static float table[1024]; - - static bool bInited = false; - if( !bInited ) - { - bInited = true; - for( unsigned i=0; i=0 && fRemainder<=1 ); - - float fValue[ARRAYLEN(iSampleIndex)]; - for( unsigned i=0; i= int(ARRAYLEN(table)) ) // PI <= iSample < 2*PI - { - // sin(x) == -sin(PI+x) - iSample -= ARRAYLEN(table); - DEBUG_ASSERT( iSample>=0 && iSample Date: Sun, 7 Feb 2016 21:04:10 -0700 Subject: [PATCH 2/8] Reinstate RageFastSin because it's faster on Windows. --- src/Actor.cpp | 16 +++--- src/ArrowEffects.cpp | 18 +++--- src/GraphDisplay.cpp | 4 +- src/GrooveRadar.cpp | 8 +-- src/NoteField.cpp | 4 +- src/RageDisplay.cpp | 4 +- src/RageMath.cpp | 130 +++++++++++++++++++++++++++++-------------- src/RageMath.h | 3 + src/Tween.cpp | 2 +- 9 files changed, 120 insertions(+), 69 deletions(-) diff --git a/src/Actor.cpp b/src/Actor.cpp index fd48a0564f..55016f2ddb 100644 --- a/src/Actor.cpp +++ b/src/Actor.cpp @@ -470,7 +470,7 @@ void Actor::PreDraw() // calculate actor properties ssprintf("PercentThroughEffect: %f", fPercentThroughEffect) ); bool bBlinkOn = fPercentThroughEffect > 0.5f; - float fPercentBetweenColors = std::sin( (fPercentThroughEffect + 0.25f) * 2 * PI ) / 2 + 0.5f; + float fPercentBetweenColors = RageFastSin( (fPercentThroughEffect + 0.25f) * 2 * PI ) / 2 + 0.5f; ASSERT_M( fPercentBetweenColors >= 0 && fPercentBetweenColors <= 1, ssprintf("PercentBetweenColors: %f, PercentThroughEffect: %f", fPercentBetweenColors, fPercentThroughEffect) ); float fOriginalAlpha = tempState.diffuse[0].a; @@ -516,15 +516,15 @@ void Actor::PreDraw() // calculate actor properties break; case rainbow: tempState.diffuse[0] = RageColor( - std::cos( fPercentBetweenColors*2*PI ) * 0.5f + 0.5f, - std::cos( fPercentBetweenColors*2*PI + PI * 2.0f / 3.0f ) * 0.5f + 0.5f, - std::cos( fPercentBetweenColors*2*PI + PI * 4.0f / 3.0f) * 0.5f + 0.5f, + RageFastCos( fPercentBetweenColors*2*PI ) * 0.5f + 0.5f, + RageFastCos( fPercentBetweenColors*2*PI + PI * 2.0f / 3.0f ) * 0.5f + 0.5f, + RageFastCos( fPercentBetweenColors*2*PI + PI * 4.0f / 3.0f) * 0.5f + 0.5f, fOriginalAlpha ); for( int i=1; im_PlayerNumber]; - float fExpandMultiplier = SCALE( std::cos(data.m_fExpandSeconds*EXPAND_MULTIPLIER_FREQUENCY), + float fExpandMultiplier = SCALE( RageFastCos(data.m_fExpandSeconds*EXPAND_MULTIPLIER_FREQUENCY), EXPAND_MULTIPLIER_SCALE_FROM_LOW, EXPAND_MULTIPLIER_SCALE_FROM_HIGH, EXPAND_MULTIPLIER_SCALE_TO_LOW, EXPAND_MULTIPLIER_SCALE_TO_HIGH ); fScrollSpeed *= SCALE( fAccels[PlayerOptions::ACCEL_EXPAND], @@ -495,7 +495,7 @@ float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float float fRads = acosf( fPositionBetween ); fRads += fYOffset * TORNADO_OFFSET_FREQUENCY / SCREEN_HEIGHT; - const float fAdjustedPixelOffset = SCALE( std::cos(fRads), TORNADO_OFFSET_SCALE_FROM_LOW, TORNADO_OFFSET_SCALE_FROM_HIGH, + const float fAdjustedPixelOffset = SCALE( RageFastCos(fRads), TORNADO_OFFSET_SCALE_FROM_LOW, TORNADO_OFFSET_SCALE_FROM_HIGH, data.m_fMinTornadoX[iColNum], data.m_fMaxTornadoX[iColNum] ); fPixelOffsetFromCenter += (fAdjustedPixelOffset - fRealPixelOffset) * fEffects[PlayerOptions::EFFECT_TORNADO]; @@ -503,7 +503,7 @@ float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float if( fEffects[PlayerOptions::EFFECT_DRUNK] != 0 ) fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_DRUNK] * - ( std::cos( RageTimer::GetTimeSinceStartFast() + iColNum*DRUNK_COLUMN_FREQUENCY + ( RageFastCos( RageTimer::GetTimeSinceStartFast() + iColNum*DRUNK_COLUMN_FREQUENCY + fYOffset*DRUNK_OFFSET_FREQUENCY/SCREEN_HEIGHT) * ARROW_SIZE*DRUNK_ARROW_MAGNITUDE ); if( fEffects[PlayerOptions::EFFECT_FLIP] != 0 ) { @@ -520,7 +520,7 @@ float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float if( fEffects[PlayerOptions::EFFECT_BEAT] != 0 ) { - const float fShift = data.m_fBeatFactor*std::sin( fYOffset / BEAT_OFFSET_HEIGHT + PI/BEAT_PI_HEIGHT ); + const float fShift = data.m_fBeatFactor*RageFastSin( fYOffset / BEAT_OFFSET_HEIGHT + PI/BEAT_PI_HEIGHT ); fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_BEAT] * fShift; } @@ -715,7 +715,7 @@ float ArrowGetPercentVisible(float fYPosWithoutReverse) fVisibleAdjust -= fAppearances[PlayerOptions::APPEARANCE_STEALTH]; if( fAppearances[PlayerOptions::APPEARANCE_BLINK] != 0 ) { - float f = std::sin(RageTimer::GetTimeSinceStartFast()*10); + float f = RageFastSin(RageTimer::GetTimeSinceStartFast()*10); f = Quantize( f, BLINK_MOD_FREQUENCY ); fVisibleAdjust += SCALE( f, 0, 1, -1, 0 ); } @@ -783,7 +783,7 @@ float ArrowEffects::GetZPos(int iCol, float fYOffset) const float* fEffects = curr_options->m_fEffects; if( fEffects[PlayerOptions::EFFECT_BUMPY] != 0 ) - fZPos += fEffects[PlayerOptions::EFFECT_BUMPY] * 40*std::sin( fYOffset/16.0f ); + fZPos += fEffects[PlayerOptions::EFFECT_BUMPY] * 40*RageFastSin( fYOffset/16.0f ); return fZPos; } diff --git a/src/GraphDisplay.cpp b/src/GraphDisplay.cpp index 11100a30cb..a5b8ee4c73 100644 --- a/src/GraphDisplay.cpp +++ b/src/GraphDisplay.cpp @@ -51,8 +51,8 @@ public: for( int i = 0; i < iSubdivisions+1; ++i ) { const float fRotation = float(i) / iSubdivisions * 2*PI; - const float fX = std::cos(fRotation) * fRadius; - const float fY = -std::sin(fRotation) * fRadius; + const float fX = RageFastCos(fRotation) * fRadius; + const float fY = -RageFastSin(fRotation) * fRadius; pVerts[1+i] = v; pVerts[1+i].p.x += fX; pVerts[1+i].p.y += fY; diff --git a/src/GrooveRadar.cpp b/src/GrooveRadar.cpp index 28b3e18a44..93deafef8a 100644 --- a/src/GrooveRadar.cpp +++ b/src/GrooveRadar.cpp @@ -170,8 +170,8 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() const float fDistFromCenter = ( m_fValuesOld[c] * (1-m_PercentTowardNew) + m_fValuesNew[c] * m_PercentTowardNew + 0.07f ) * fRadius; const float fRotation = RADAR_VALUE_ROTATION(i); - const float fX = std::cos(fRotation) * fDistFromCenter; - const float fY = -std::sin(fRotation) * fDistFromCenter; + const float fX = RageFastCos(fRotation) * fDistFromCenter; + const float fY = -RageFastSin(fRotation) * fDistFromCenter; v[1+i].p = RageVector3( fX, fY, 0 ); v[1+i].c = v[1].c; @@ -186,8 +186,8 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() const float fDistFromCenter = ( m_fValuesOld[c] * (1-m_PercentTowardNew) + m_fValuesNew[c] * m_PercentTowardNew + 0.07f ) * fRadius; const float fRotation = RADAR_VALUE_ROTATION(i); - const float fX = std::cos(fRotation) * fDistFromCenter; - const float fY = -std::sin(fRotation) * fDistFromCenter; + const float fX = RageFastCos(fRotation) * fDistFromCenter; + const float fY = -RageFastSin(fRotation) * fDistFromCenter; v[i].p = RageVector3( fX, fY, 0 ); v[i].c = this->m_pTempState->diffuse[0]; diff --git a/src/NoteField.cpp b/src/NoteField.cpp index cf73dfe11c..a7836695a4 100644 --- a/src/NoteField.cpp +++ b/src/NoteField.cpp @@ -830,7 +830,7 @@ void NoteField::DrawPrimitives() ASSERT(GAMESTATE->m_pCurSong != NULL); const TimingData &timing = *pTiming; - const RageColor text_glow= RageColor(1,1,1,std::cos(RageTimer::GetTimeSinceStartFast()*2)/2+0.5f); + const RageColor text_glow= RageColor(1,1,1,RageFastCos(RageTimer::GetTimeSinceStartFast()*2)/2+0.5f); float horiz_align= align_right; float side_sign= 1; @@ -1014,7 +1014,7 @@ void NoteField::DrawPrimitives() *m_FieldRenderArgs.selection_end_marker != -1) { m_FieldRenderArgs.selection_glow= SCALE( - std::cos(RageTimer::GetTimeSinceStartFast()*2), -1, 1, 0.1f, 0.3f); + RageFastCos(RageTimer::GetTimeSinceStartFast()*2), -1, 1, 0.1f, 0.3f); } m_FieldRenderArgs.fade_before_targets= FADE_BEFORE_TARGETS_PERCENT; diff --git a/src/RageDisplay.cpp b/src/RageDisplay.cpp index e593a4f82a..292d00e35c 100644 --- a/src/RageDisplay.cpp +++ b/src/RageDisplay.cpp @@ -233,8 +233,8 @@ void RageDisplay::DrawCircleInternal( const RageSpriteVertex &p, float radius ) for(int i = 0; i < subdivisions+1; ++i) { const float fRotation = float(i) / subdivisions * 2*PI; - const float fX = std::cos(fRotation) * radius; - const float fY = -std::sin(fRotation) * radius; + const float fX = RageFastCos(fRotation) * radius; + const float fY = -RageFastSin(fRotation) * radius; v[1+i] = v[0]; v[1+i].p.x += fX; v[1+i].p.y += fY; diff --git a/src/RageMath.cpp b/src/RageMath.cpp index a014831c2b..5e85551cb2 100644 --- a/src/RageMath.cpp +++ b/src/RageMath.cpp @@ -246,10 +246,10 @@ void RageMatrixRotationX( RageMatrix* pOut, float theta ) theta *= PI/180; RageMatrixIdentity(pOut); - pOut->m[1][1] = std::cos(theta); + pOut->m[1][1] = RageFastCos(theta); pOut->m[2][2] = pOut->m[1][1]; - pOut->m[2][1] = std::sin(theta); + pOut->m[2][1] = RageFastSin(theta); pOut->m[1][2] = -pOut->m[2][1]; } @@ -258,10 +258,10 @@ void RageMatrixRotationY( RageMatrix* pOut, float theta ) theta *= PI/180; RageMatrixIdentity(pOut); - pOut->m[0][0] = std::cos(theta); + pOut->m[0][0] = RageFastCos(theta); pOut->m[2][2] = pOut->m[0][0]; - pOut->m[0][2] = std::sin(theta); + pOut->m[0][2] = RageFastSin(theta); pOut->m[2][0] = -pOut->m[0][2]; } @@ -270,10 +270,10 @@ void RageMatrixRotationZ( RageMatrix* pOut, float theta ) theta *= PI/180; RageMatrixIdentity(pOut); - pOut->m[0][0] = std::cos(theta); + pOut->m[0][0] = RageFastCos(theta); pOut->m[1][1] = pOut->m[0][0]; - pOut->m[0][1] = std::sin(theta); + pOut->m[0][1] = RageFastSin(theta); pOut->m[1][0] = -pOut->m[0][1]; } @@ -286,12 +286,12 @@ void RageMatrixRotationXYZ( RageMatrix* pOut, float rX, float rY, float rZ ) rY *= PI/180; rZ *= PI/180; - const float cX = std::cos(rX); - const float sX = std::sin(rX); - const float cY = std::cos(rY); - const float sY = std::sin(rY); - const float cZ = std::cos(rZ); - const float sZ = std::sin(rZ); + const float cX = RageFastCos(rX); + const float sX = RageFastSin(rX); + const float cY = RageFastCos(rY); + const float sY = RageFastSin(rY); + const float cZ = RageFastCos(rZ); + const float sZ = RageFastSin(rZ); /* * X*Y: @@ -333,8 +333,8 @@ void RageMatrixRotationXYZ( RageMatrix* pOut, float rX, float rY, float rZ ) void RageAARotate(RageVector3* inret, RageVector3 const* axis, float angle) { float ha= angle/2.0f; - float ca2= std::cos(ha); - float sa2= std::sin(ha); + float ca2= RageFastCos(ha); + float sa2= RageFastSin(ha); RageVector4 quat(axis->x * sa2, axis->y * sa2, axis->z * sa2, ca2); RageVector4 quatc(-quat.x, -quat.y, -quat.z, ca2); RageVector4 point(inret->x, inret->y, inret->z, 0.0f); @@ -374,8 +374,8 @@ RageVector4 RageQuatFromH(float theta ) theta *= PI/180.0f; theta /= 2.0f; theta *= -1; - const float c = std::cos(theta); - const float s = std::sin(theta); + const float c = RageFastCos(theta); + const float s = RageFastSin(theta); return RageVector4(0, s, 0, c); } @@ -385,8 +385,8 @@ RageVector4 RageQuatFromP(float theta ) theta *= PI/180.0f; theta /= 2.0f; theta *= -1; - const float c = std::cos(theta); - const float s = std::sin(theta); + const float c = RageFastCos(theta); + const float s = RageFastSin(theta); return RageVector4(s, 0, 0, c); } @@ -396,8 +396,8 @@ RageVector4 RageQuatFromR(float theta ) theta *= PI/180.0f; theta /= 2.0f; theta *= -1; - const float c = std::cos(theta); - const float s = std::sin(theta); + const float c = RageFastCos(theta); + const float s = RageFastSin(theta); return RageVector4(0, 0, s, c); } @@ -412,12 +412,12 @@ void RageQuatFromHPR(RageVector4* pOut, RageVector3 hpr ) hpr /= 180.0f; hpr /= 2.0f; - const float sX = std::sin(hpr.x); - const float cX = std::cos(hpr.x); - const float sY = std::sin(hpr.y); - const float cY = std::cos(hpr.y); - const float sZ = std::sin(hpr.z); - const float cZ = std::cos(hpr.z); + const float sX = RageFastSin(hpr.x); + const float cX = RageFastCos(hpr.x); + const float sY = RageFastSin(hpr.y); + const float cY = RageFastCos(hpr.y); + const float sZ = RageFastSin(hpr.z); + const float cZ = RageFastCos(hpr.z); pOut->w = cX * cY * cZ + sX * sY * sZ; pOut->x = sX * cY * cZ - cX * sY * sZ; @@ -440,12 +440,12 @@ void RageQuatFromPRH(RageVector4* pOut, RageVector3 prh ) /* Set cX to the cosine of the angle we want to rotate on the X axis, * and so on. Here, hpr.z (roll) rotates on the Z axis, hpr.x (heading) * on Y, and hpr.y (pitch) on X. */ - const float sX = std::sin(prh.y); - const float cX = std::cos(prh.y); - const float sY = std::sin(prh.x); - const float cY = std::cos(prh.x); - const float sZ = std::sin(prh.z); - const float cZ = std::cos(prh.z); + const float sX = RageFastSin(prh.y); + const float cX = RageFastCos(prh.y); + const float sY = RageFastSin(prh.x); + const float cY = RageFastCos(prh.x); + const float sZ = RageFastSin(prh.z); + const float cZ = RageFastCos(prh.z); pOut->w = cX * cY * cZ + sX * sY * sZ; pOut->x = sX * cY * cZ - cX * sY * sZ; @@ -506,9 +506,9 @@ void RageQuatSlerp(RageVector4 *pOut, const RageVector4 &from, const RageVector4 { // standard case (slerp) float omega = acosf(cosom); - float sinom = std::sin(omega); - scale0 = std::sin((1.0f - t) * omega) / sinom; - scale1 = std::sin(t * omega) / sinom; + float sinom = RageFastSin(omega); + scale0 = RageFastSin((1.0f - t) * omega) / sinom; + scale1 = RageFastSin(t * omega) / sinom; } else { @@ -566,12 +566,12 @@ void RageMatrixAngles( RageMatrix* pOut, const RageVector3 &angles ) { const RageVector3 angles_radians( angles * 2*PI / 360 ); - const float sy = std::sin( angles_radians[2] ); - const float cy = std::cos( angles_radians[2] ); - const float sp = std::sin( angles_radians[1] ); - const float cp = std::cos( angles_radians[1] ); - const float sr = std::sin( angles_radians[0] ); - const float cr = std::cos( angles_radians[0] ); + const float sy = RageFastSin( angles_radians[2] ); + const float cy = RageFastCos( angles_radians[2] ); + const float sp = RageFastSin( angles_radians[1] ); + const float cp = RageFastCos( angles_radians[1] ); + const float sr = RageFastSin( angles_radians[0] ); + const float cr = RageFastCos( angles_radians[0] ); RageMatrixIdentity( pOut ); @@ -595,6 +595,54 @@ void RageMatrixTranspose( RageMatrix* pOut, const RageMatrix* pIn ) pOut->m[j][i] = pIn->m[i][j]; } +static const unsigned int sine_table_size= 1024; +static const unsigned int sine_index_mod= sine_table_size * 2; +static const double sine_table_index_mult= static_cast(sine_index_mod) / (PI*2); +static float sine_table[sine_table_size]; +struct sine_initter +{ + sine_initter() + { + for(unsigned int i= 0; i < sine_table_size; ++i) + { + float angle= SCALE(i, 0, sine_table_size, 0.0f, PI); + sine_table[i]= sinf(angle); + } + } +}; +static sine_initter sinner; + +float RageFastSin(float angle) +{ + if(angle == 0) { return 0; } + float index= angle * sine_table_index_mult; + int first_index= static_cast(index); + int second_index= (first_index + 1) % sine_index_mod; + float remainder= index - first_index; + first_index%= sine_index_mod; + float first= 0.0f; + float second= 0.0f; +#define SET_SAMPLE(sample) \ + if(sample##_index >= sine_table_size) \ + { \ + sample= -sine_table[sample##_index - sine_table_size]; \ + } \ + else \ + { \ + sample= sine_table[sample##_index]; \ + } + SET_SAMPLE(first); + SET_SAMPLE(second); +#undef SET_SAMPLE + float result= lerp(remainder, first, second); + return result; +} + +float RageFastCos( float x ) +{ + return RageFastSin( x + 0.5f*PI ); +} + float RageQuadratic::Evaluate( float fT ) const { // optimized (m_fA * fT*fT*fT) + (m_fB * fT*fT) + (m_fC * fT) + m_fD; diff --git a/src/RageMath.h b/src/RageMath.h index b92f080111..12b91fe556 100644 --- a/src/RageMath.h +++ b/src/RageMath.h @@ -53,6 +53,9 @@ RageMatrix RageLookAt( void RageMatrixAngles( RageMatrix* pOut, const RageVector3 &angles ); void RageMatrixTranspose( RageMatrix* pOut, const RageMatrix* pIn ); +float RageFastSin( float x ) CONST_FUNCTION; +float RageFastCos( float x ) CONST_FUNCTION; + class RageQuadratic { public: diff --git a/src/Tween.cpp b/src/Tween.cpp index 9c1b547639..99828d29f6 100644 --- a/src/Tween.cpp +++ b/src/Tween.cpp @@ -33,7 +33,7 @@ struct TweenDecelerate: public ITween }; struct TweenSpring: public ITween { - float Tween( float f ) const { return 1 - std::cos( f*PI*2.5f )/(1+f*3); } + float Tween( float f ) const { return 1 - RageFastCos( f*PI*2.5f )/(1+f*3); } ITween *Copy() const { return new TweenSpring(*this); } }; From 9fe6f49a55c7ea68bb63c3cf0e0b8b692b60388f Mon Sep 17 00:00:00 2001 From: Kyzentun Keeslala Date: Wed, 10 Feb 2016 17:14:17 -0700 Subject: [PATCH 3/8] Shut up various Trace calls that were clogging the log file uselessly. --- src/BannerCache.cpp | 10 +++++----- src/NotesLoaderSM.cpp | 2 +- src/NotesLoaderSSC.cpp | 2 +- src/RageBitmapTexture.cpp | 8 ++++---- src/RageTextureManager.cpp | 2 +- src/ScreenManager.cpp | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/BannerCache.cpp b/src/BannerCache.cpp index 6adee95b59..e7dad900eb 100644 --- a/src/BannerCache.cpp +++ b/src/BannerCache.cpp @@ -129,7 +129,7 @@ void BannerCache::LoadBanner( RString sBannerPath ) { /* The file doesn't exist. It's possible that the banner cache file is * missing, so try to create it. Don't do this first, for efficiency. */ - LOG->Trace( "Cached banner load of '%s' ('%s') failed, trying to cache ...", sBannerPath.c_str(), sCachePath.c_str() ); + //LOG->Trace( "Cached banner load of '%s' ('%s') failed, trying to cache ...", sBannerPath.c_str(), sCachePath.c_str() ); /* Skip the up-to-date check; it failed to load, so it can't be up * to date. */ @@ -138,7 +138,7 @@ void BannerCache::LoadBanner( RString sBannerPath ) } else { - LOG->Trace( "Cached banner load of '%s' ('%s') failed", sBannerPath.c_str(), sCachePath.c_str() ); + //LOG->Trace( "Cached banner load of '%s' ('%s') failed", sBannerPath.c_str(), sCachePath.c_str() ); return; } } @@ -272,7 +272,7 @@ RageTextureID BannerCache::LoadCachedBanner( RString sBannerPath ) if( sBannerPath == "" ) return ID; - LOG->Trace( "BannerCache::LoadCachedBanner(%s): %s", sBannerPath.c_str(), ID.filename.c_str() ); + //LOG->Trace( "BannerCache::LoadCachedBanner(%s): %s", sBannerPath.c_str(), ID.filename.c_str() ); /* Hack: make sure Banner::Load doesn't change our return value and end up * reloading. */ @@ -308,8 +308,8 @@ RageTextureID BannerCache::LoadCachedBanner( RString sBannerPath ) if( TEXTUREMAN->IsTextureRegistered(ID) ) return ID; /* It's all set. */ - LOG->Trace( "Loading banner texture %s; src %ix%i; image %ix%i", - ID.filename.c_str(), iSourceWidth, iSourceHeight, pImage->w, pImage->h ); + //LOG->Trace( "Loading banner texture %s; src %ix%i; image %ix%i", + // ID.filename.c_str(), iSourceWidth, iSourceHeight, pImage->w, pImage->h ); RageTexture *pTexture = new BannerTexture( ID, pImage, iSourceWidth, iSourceHeight ); ID.Policy = RageTextureID::TEX_VOLATILE; diff --git a/src/NotesLoaderSM.cpp b/src/NotesLoaderSM.cpp index 0338fccf02..2300a3095a 100644 --- a/src/NotesLoaderSM.cpp +++ b/src/NotesLoaderSM.cpp @@ -1102,7 +1102,7 @@ bool SMLoader::LoadNoteDataFromSimfile( const RString &path, Steps &out ) bool SMLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache ) { - LOG->Trace( "Song::LoadFromSMFile(%s)", sPath.c_str() ); + //LOG->Trace( "Song::LoadFromSMFile(%s)", sPath.c_str() ); MsdFile msd; if( !msd.ReadFile( sPath, true ) ) // unescape diff --git a/src/NotesLoaderSSC.cpp b/src/NotesLoaderSSC.cpp index d44fbccb0e..a66c1ef363 100644 --- a/src/NotesLoaderSSC.cpp +++ b/src/NotesLoaderSSC.cpp @@ -940,7 +940,7 @@ bool SSCLoader::LoadNoteDataFromSimfile( const RString & cachePath, Steps &out ) bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache ) { - LOG->Trace( "Song::LoadFromSSCFile(%s)", sPath.c_str() ); + //LOG->Trace( "Song::LoadFromSSCFile(%s)", sPath.c_str() ); MsdFile msd; if( !msd.ReadFile( sPath, true ) ) diff --git a/src/RageBitmapTexture.cpp b/src/RageBitmapTexture.cpp index 3654431f88..79b19b64dd 100644 --- a/src/RageBitmapTexture.cpp +++ b/src/RageBitmapTexture.cpp @@ -348,10 +348,10 @@ void RageBitmapTexture::Create() if( actualID.bStretch ) sProperties += "stretch "; if( actualID.bDither ) sProperties += "dither "; sProperties.erase( sProperties.size()-1 ); - LOG->Trace( "RageBitmapTexture: Loaded '%s' (%ux%u); %s, source %d,%d; image %d,%d.", - actualID.filename.c_str(), GetTextureWidth(), GetTextureHeight(), - sProperties.c_str(), m_iSourceWidth, m_iSourceHeight, - m_iImageWidth, m_iImageHeight ); + //LOG->Trace( "RageBitmapTexture: Loaded '%s' (%ux%u); %s, source %d,%d; image %d,%d.", + // actualID.filename.c_str(), GetTextureWidth(), GetTextureHeight(), + // sProperties.c_str(), m_iSourceWidth, m_iSourceHeight, + // m_iImageWidth, m_iImageHeight ); } void RageBitmapTexture::Destroy() diff --git a/src/RageTextureManager.cpp b/src/RageTextureManager.cpp index 7c13995945..a5bad909f4 100644 --- a/src/RageTextureManager.cpp +++ b/src/RageTextureManager.cpp @@ -233,7 +233,7 @@ void RageTextureManager::UnloadTexture( RageTexture *t ) void RageTextureManager::DeleteTexture( RageTexture *t ) { ASSERT( t->m_iRefCount == 0 ); - LOG->Trace( "RageTextureManager: deleting '%s'.", t->GetID().filename.c_str() ); + //LOG->Trace( "RageTextureManager: deleting '%s'.", t->GetID().filename.c_str() ); map::iterator id_entry= m_texture_ids_by_pointer.find(t); diff --git a/src/ScreenManager.cpp b/src/ScreenManager.cpp index 9df8a92115..0d52c6c0f8 100644 --- a/src/ScreenManager.cpp +++ b/src/ScreenManager.cpp @@ -642,7 +642,7 @@ void ScreenManager::PrepareScreen( const RString &sScreenName ) } */ - TEXTUREMAN->DiagnosticOutput(); + //TEXTUREMAN->DiagnosticOutput(); } void ScreenManager::GroupScreen( const RString &sScreenName ) From aa0e8690b75e6e22b8c38cecfb0fa013cbe34da3 Mon Sep 17 00:00:00 2001 From: Naftuli Tzvi Kay Date: Fri, 12 Feb 2016 12:07:38 -0800 Subject: [PATCH 4/8] Compile dependencies statically into the binary. On Linux when building this under RPM, RPM insisted on linking in standard system libraries like libpng, libjpeg-turbo, libGLEW, Lua, etc. This patch causes all dependencies to be statically compiled into the binary, which is ideal as the alternative is segfaulting because of incompatible library changes. StepMania also uses a modified Lua library which exports functions that don't exist in any standard Lua library, so there's no easy way around this. --- extern/CMakeProject-glew.cmake | 2 +- extern/CMakeProject-json.cmake | 2 +- extern/CMakeProject-lua.cmake | 2 +- extern/CMakeProject-mad.cmake | 2 +- extern/CMakeProject-ogg.cmake | 2 +- extern/CMakeProject-png.cmake | 2 +- extern/CMakeProject-tomcrypt.cmake | 2 +- extern/CMakeProject-tommath.cmake | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/extern/CMakeProject-glew.cmake b/extern/CMakeProject-glew.cmake index 1608bb5770..413238286a 100644 --- a/extern/CMakeProject-glew.cmake +++ b/extern/CMakeProject-glew.cmake @@ -2,7 +2,7 @@ set(GLEW_SRC "glew-1.5.8/src/glew.c") source_group("" FILES ${GLEW_SRC}) -add_library("glew" ${GLEW_SRC}) +add_library("glew" STATIC ${GLEW_SRC}) set_property(TARGET "glew" PROPERTY FOLDER "External Libraries") diff --git a/extern/CMakeProject-json.cmake b/extern/CMakeProject-json.cmake index d0ca5cadac..5d35a9608e 100644 --- a/extern/CMakeProject-json.cmake +++ b/extern/CMakeProject-json.cmake @@ -16,7 +16,7 @@ list(APPEND JSON_HPP source_group("" FILES ${JSON_SRC} ${JSON_HPP}) -add_library("jsoncpp" ${JSON_SRC} ${JSON_HPP}) +add_library("jsoncpp" STATIC ${JSON_SRC} ${JSON_HPP}) set_property(TARGET "jsoncpp" PROPERTY FOLDER "External Libraries") diff --git a/extern/CMakeProject-lua.cmake b/extern/CMakeProject-lua.cmake index 9da0c100f2..4fe3984807 100644 --- a/extern/CMakeProject-lua.cmake +++ b/extern/CMakeProject-lua.cmake @@ -58,7 +58,7 @@ set(LUA_HPP source_group("" FILES ${LUA_SRC}) source_group("" FILES ${LUA_HPP}) -add_library("lua-5.1" ${LUA_SRC} ${LUA_HPP}) +add_library("lua-5.1" STATIC ${LUA_SRC} ${LUA_HPP}) set_property(TARGET "lua-5.1" PROPERTY FOLDER "External Libraries") diff --git a/extern/CMakeProject-mad.cmake b/extern/CMakeProject-mad.cmake index 28d0342977..1efcca537d 100644 --- a/extern/CMakeProject-mad.cmake +++ b/extern/CMakeProject-mad.cmake @@ -43,7 +43,7 @@ source_group("Source Files" FILES ${MAD_SRC}) source_group("Header Files" FILES ${MAD_HPP}) source_group("Data Files" FILES ${MAD_DAT}) -add_library("mad" ${MAD_SRC} ${MAD_HPP} ${MAD_DAT}) +add_library("mad" STATIC ${MAD_SRC} ${MAD_HPP} ${MAD_DAT}) set_property(TARGET "mad" PROPERTY FOLDER "External Libraries") diff --git a/extern/CMakeProject-ogg.cmake b/extern/CMakeProject-ogg.cmake index 8e4633ff6a..cf61849f9e 100644 --- a/extern/CMakeProject-ogg.cmake +++ b/extern/CMakeProject-ogg.cmake @@ -14,7 +14,7 @@ list(APPEND OGG_HPP source_group("Source Files" FILES ${OGG_SRC}) source_group("Header Files" FILES ${OGG_HPP}) -add_library("ogg" ${OGG_SRC} ${OGG_HPP} ${OGG_DAT}) +add_library("ogg" STATIC ${OGG_SRC} ${OGG_HPP} ${OGG_DAT}) set_property(TARGET "ogg" PROPERTY FOLDER "External Libraries") diff --git a/extern/CMakeProject-png.cmake b/extern/CMakeProject-png.cmake index 9c9633458b..1f9ca89dec 100644 --- a/extern/CMakeProject-png.cmake +++ b/extern/CMakeProject-png.cmake @@ -30,7 +30,7 @@ set(PNG_HPP source_group("" FILES ${PNG_SRC}) source_group("" FILES ${PNG_HPP}) -add_library("png" ${PNG_SRC} ${PNG_HPP}) +add_library("png" STATIC ${PNG_SRC} ${PNG_HPP}) set_property(TARGET "png" PROPERTY FOLDER "External Libraries") diff --git a/extern/CMakeProject-tomcrypt.cmake b/extern/CMakeProject-tomcrypt.cmake index bc86daa1dd..73b895e469 100644 --- a/extern/CMakeProject-tomcrypt.cmake +++ b/extern/CMakeProject-tomcrypt.cmake @@ -265,7 +265,7 @@ list(APPEND TOMCRYPT_HPP source_group("headers" FILES ${TOMCRYPT_HPP}) -add_library("tomcrypt" ${TOMCRYPT_SRC} ${TOMCRYPT_HPP}) +add_library("tomcrypt" STATIC ${TOMCRYPT_SRC} ${TOMCRYPT_HPP}) set_property(TARGET "tomcrypt" PROPERTY FOLDER "External Libraries") diff --git a/extern/CMakeProject-tommath.cmake b/extern/CMakeProject-tommath.cmake index 5d32d47808..9dd9fc1f05 100644 --- a/extern/CMakeProject-tommath.cmake +++ b/extern/CMakeProject-tommath.cmake @@ -131,7 +131,7 @@ list(APPEND TOMMATH_HPP source_group("" FILES ${TOMMATH_SRC}) source_group("" FILES ${TOMMATH_HPP}) -add_library("tommath" ${TOMMATH_SRC} ${TOMMATH_HPP}) +add_library("tommath" STATIC ${TOMMATH_SRC} ${TOMMATH_HPP}) set_property(TARGET "tommath" PROPERTY FOLDER "External Libraries") From 203189a98ca1b92c6f19bf70646bf841cc2f27ab Mon Sep 17 00:00:00 2001 From: Naftuli Tzvi Kay Date: Fri, 12 Feb 2016 12:21:19 -0800 Subject: [PATCH 5/8] Compile FFMPEG in PIC when configured as such. When the CMake flag is specified for position independent code, FFMPEG will be compiled with the --enable-pic flag. --- CMake/SetupFfmpeg.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMake/SetupFfmpeg.cmake b/CMake/SetupFfmpeg.cmake index b700b6753a..f10c7c14dd 100644 --- a/CMake/SetupFfmpeg.cmake +++ b/CMake/SetupFfmpeg.cmake @@ -22,6 +22,10 @@ list(APPEND FFMPEG_CONFIGURE "--enable-static" ) +if(CMAKE_POSITION_INDEPENDENT_CODE) + list(APPEND FFMPEG_CONFIGURE "--enable-pic") +endif() + if(MACOSX) # TODO: Remove these two items when Mac OS X StepMania builds in 64-bit. list(APPEND FFMPEG_CONFIGURE From b34f07e10f80ed3e7ee12735213c97454b7834eb Mon Sep 17 00:00:00 2001 From: Kyzentun Keeslala Date: Sat, 13 Feb 2016 10:11:22 -0700 Subject: [PATCH 6/8] Check whether InitialScreen is valid before using it after changing themes. --- src/GameLoop.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/GameLoop.cpp b/src/GameLoop.cpp index 7b1366e46a..f88d9c1609 100644 --- a/src/GameLoop.cpp +++ b/src/GameLoop.cpp @@ -169,6 +169,10 @@ namespace new_screen= after_screen; } } + if(!SCREENMAN->IsScreenNameValid(new_screen)) + { + new_screen= "ScreenInitialScreenIsInvalid"; + } SCREENMAN->SetNewScreen(new_screen); g_NewTheme = RString(); From 7cce462dd13fd960c8e6c7d14408a1d63d100461 Mon Sep 17 00:00:00 2001 From: Kyzentun Keeslala Date: Mon, 15 Feb 2016 16:58:36 -0700 Subject: [PATCH 7/8] Start event devices at JOY10 so that they won't overlap with joystick devices. --- src/arch/InputHandler/InputHandler_Linux_Event.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arch/InputHandler/InputHandler_Linux_Event.cpp b/src/arch/InputHandler/InputHandler_Linux_Event.cpp index 6ea2baa374..fc3b34a6f4 100644 --- a/src/arch/InputHandler/InputHandler_Linux_Event.cpp +++ b/src/arch/InputHandler/InputHandler_Linux_Event.cpp @@ -272,7 +272,7 @@ EventDevice::~EventDevice() InputHandler_Linux_Event::InputHandler_Linux_Event() { - m_NextDevice = DEVICE_JOY1; + m_NextDevice = DEVICE_JOY10; m_bDevicesChanged = false; if(LINUXINPUT == NULL) LINUXINPUT = new LinuxInputManager; From 84e7c7b124626d2c6360bf2fda8715209aad0923 Mon Sep 17 00:00:00 2001 From: JOELwindows7 Date: Sat, 20 Feb 2016 22:27:51 +0700 Subject: [PATCH 8/8] Add Bahasa Indonesia to default theme Bahasa Indonesia now was added to the default theme --- Themes/default/Languages/id.ini | 266 ++++++++++++++++++++++++++++++++ 1 file changed, 266 insertions(+) create mode 100644 Themes/default/Languages/id.ini diff --git a/Themes/default/Languages/id.ini b/Themes/default/Languages/id.ini new file mode 100644 index 0000000000..3588dbb2d6 --- /dev/null +++ b/Themes/default/Languages/id.ini @@ -0,0 +1,266 @@ +[Screen] +HelpText=&BACK; Keluar &START; Select &SELECT; Pilihan &MENULEFT;&MENURIGHT;&MENUUP;&MENUDOWN; Pindah + +[ScreenWithMenuElements] +HelpText=&BACK; Keluar &START; Select &MENULEFT;&MENURIGHT; Pindah +StageCounter=%s Stage +EventStageCounter=Stage %03i + +[ScreenTitleMenu] +HelpText=&BACK; Keluar &START; Select &MENUUP;&MENUDOWN; Pindah +Network OK=Jaringan OK +Offline=Luring +Connected to %s=Tersambung ke %s +CurrentGametype=Sedang bermain: %s +LifeDifficulty=Kesulitan Nyawa: %s +TimingDifficulty=Kesulitan Timing: %s +%i Lagu (%i Grup), %i Courses=%i Lagu (%i Grup), %i Kursus + +[ScreenTitleJoin] +HelpText=Tekan &START; untuk Bermain +HelpTextJoin=Tekan &START; untuk Bermain +HelpTextWait=Masukan Kredit! +EventMode=Modus Acara +JointPremiumMain=Joint Premium +JointPremiumSecondary=Dua pemain dapat bermain dengan satu kredit! +DoublesPremiumMain=Premium Dobel +DoublesPremiumSecondary=Bermain Dobel untuk satu kredit! + +[ScreenCaution] +HelpText=&START; Lanjut + +[ScreenDemonstration] +Demonstration=Demonstrasi +%s - %s [dari %s]=%s - %s\n[dari %s] + +[ScreenQuickSetupOverview] +Explanation=Setup Cepat memberikan cara mudah untuk mengatur ubahan-umum dan preferensi-preferensi berguna. + +[ScreenProfileLoad] +HelpText=... Memuat profile, silahkan tunggu ... + +[ScreenSelectProfile] +%d Lagu Dimainkan=%d Lagu telah dimainkan +%d Lagu Dimainkan=%d Lagu telah dimainkan +PressStart=Tekan &START; untuk bergabung. +HelpText=&MENUUP;&MENUDOWN; Ganti Profil &START; Pilih/Gabung &BACK; Cabut + +[ScreenSelectMaster] +HelpText=&BACK; Keluar &START; Pilih / Gabung &MENULEFT;&MENURIGHT; Pindah + +[ScreenSelectPlayMode] +HelpText=&BACK; Keluar &START; Pilih / Gabung &MENULEFT;&MENURIGHT; Pindah +EasyExplanation=Sebuah modus untuk Pemula. +HardExplanation= Untuk ahli. +OldNormalExplanation=Tak terlalu gampang, tak terlalu sulit. +NormalExplanation=Mainkan semua lagu favorit-mu! +RaveExplanation=Bertarung antar teman atau musuh. +NonstopExplanation=Beberapa lagu berturut-turut +OniExplanation=Sebuah tes skil yang sejati. +EndlessExplanation=Tak berhenti, terus berjalan. + +[ScreenSelectPlayStyle] +HelpText=&BACK; Keluar &START; Pilih &MENULEFT;&MENURIGHT; Pindah + +[ScreenGameInformation] +HelpText=&BACK; Keluar &START; Lewati + +[ScreenSelectMusic] +NEW!=BARU! +Press Start For Options=Tekan &START; untuk Pilihan +Entering Options=Memasuki Pilihan +HelpText=&BACK; Keluar &START; Pilih / Gabung &SELECT; Kode Ajaib &MENULEFT;&MENURIGHT; Pindah::&AUXWHITE;+[KEY] Sortir ke [KEY] +AlternateHelpText=&SELECT;+&MENULEFT;&MENURIGHT; Ubah Kesulitan &SELECT;+&START; Sortir Cepat + +[ScreenSelectCourse] +HelpText=&BACK; Keluar &START; Pilih / Gabung &SELECT; Kode Ajaib &MENULEFT;&MENURIGHT; Pindah::&UP;&DOWN;&UP;&DOWN; untuk tipe course yang lain + +[ScreenOptions] +HelpText=&BACK; Keluar &START; Pilih &SELECT; Ke Atas &MENULEFT;&MENURIGHT;&MENUUP;&MENUDOWN; Pindah +Disqualified=Skor akan didiskualifikasi! + +[ScreenStageInformation] +HelpText= + +[ScreenGameplay] +GiveUpAbortedText= +GiveUpStartText=Tekan dua kali &START; untuk mengakses menu +GiveUpBackText=Tekan dua kali &BACK; untuk mengakses menu +SkipSongText=Tekan dua kali &SELECT; untuk mengakses menu +HelpText= + +[PauseMenu] +continue_playing=Lanjutkan Bermain +end_course=Akhiri Course +forfeit_course=Tinggalkan Course +forfeit_song=Tinggalkan lagu +pause_count=Hitungan Tunda +restart_song=Mulai ulang Lagu +skip_song=Lewati Lagu + +[ScreenHeartEntry] +Enter Heart Rate=Masukan Detak Jantung +Song Length=Panjang Lagu +Heart Rate=Detak Jantung + +[ScreenEvaluation] +HelpText=&BACK; Keluar &START; Lanjutkan &MENULEFT;+&MENURIGHT; atau &SELECT; Ambil Gambar +LifeDifficulty=Kesulitan Nyawa: %s +TimingDifficulty=Kesulitan Timing: %s +MachineRecord=Rekor Mesin #%i! +PersonalRecord=Rekor Personal #%i! +ITG DP:=ITG DP: +MIGS DP:=MIGS DP: + +[ScreenContinue] +HelpText=&START; Advance Timer + +[OptionTitles] +AutoSetStyle=Auto Set Style +NotePosition=Posisi Not +ComboOnRolls=Rolls Increment Combo +ComboUnderField=Combo Under Field + +GameplayShowScore=Tunjukan Skor +GameplayShowStepsDisplay=Tunjukan Steps +ShowLotsaOptions=Kepadatan Opsi +LongFail=Panjang Kegagalan +FlashyCombo=Kombo Berkedip-kedip +GameplayFooter=Gameplay Footer +FancyUIBG=Latar Belakang UI Indah +TimingDisplay=Layar Timing + +[OptionExplanations] +AutoSetStyle=Memperbolehkan game untuk mengumpulan seluruh modus 1P dan 2P daripada satu style saja. Ini mungkin membutuhkan mulai ulang Stepmania (atau tekan Shift+F2). +NotePosition=Menentukan dimana reseptor panah diletakan pada saat bermain. +ComboOnRolls=Pilih apabila Gulir (Rolls) akan menambah Kombo atau tidak. Jika Anda mengubah pilihan ini, Anda butuh memuat ulang metrics-nya (via Shift+F2) supaya efek ini berlaku. +ComboUnderField=Menentukan Apabila Kombo harus terletak dibawah not atau tidak. + +GameplayShowScore=Tunjukan atau Sembunyikan layar skor saat bermain. +GameplayShowStepsDisplay=Tunjukan atau Sembunyikan Informasi step saat bermain. +ShowLotsaOptions=Pilih Berapa banyak garis/baris pilihan untuk dipilih dari. &oq;Few&cq; Tetapkan daftar menjadi minimal. &oq;Many&cq; tambah berbagai mod-mod pamer. +LongFail=Pilih antara gagal sm-scc "Panjang" orisinil atau gagal "Pendek" diadopsi nanti. +FlashyCombo=Menentukan apabila kilat kombo harus ditunjukan atau tidak. +GameplayFooter=Jika menyala, Munculkan footer yang menghalangi penglihatan akan datangnya panah untuk di beberapa negara (Bingkai skor DDR). +FancyUIBG=Mati/Nyalakan latar belakang UI indah. "Mati (Off)" disarankan untuk komputer yang lama. Ubahan akan berlaku pada layar awal. +TimingDisplay=Mati/Nyalakan layar segmen timing pada meteran progres lagu. + +ScoringType=Menetapkan metode skoring mana untuk digunakan. Jika Istimewa dipilih, Anda dapat memilih Modus Penskoran Istimewa (Special Scoring Mode) pada Opsi Tema. + +Speed=Atur kelajuan panah berjalan terhadap target. +Accel=Ubah cara panah mendekati target. +Effect=Ubah ukuran atau gerakan dari panah dan/atau target. +Appearance=Kontrol penglihatan dari panah. +Turn=Ubah koreografi step dengan mengatur posisi panah. +Insert=Tambah not injak kedalam koreografi step. +Holds=Ubah beberapa not injak menjadi not tahan. +Mines=Tambah atau singkirkan not ranjau. +PlayerAutoPlay=Notefield bermain dengan sendirinya. +ScoreDisplay=Ubah cara skor terlihat. +ProTiming=Ubah cara Judgement terlihat. +Scroll=Atur arah aliran panah untuk menemui target. +NoteSkins=Pilih tampilan panah-panah yang berbeda. +Handicap=Menyingkirkan not-not. Penggunaan ini akan membatalkan skor tertinggi. +Hide=Gelap (Dark) menyembunyikan reseptor. Buta (Blind) menyembunyikan judgement. Tirai (Cover) menyembunyikan latar belakang. +Persp=Ubah sudut pandang dari aliran panah. +Steps=Atur tingkat kesulitan dari step-step. +Characters=Orang-orang berdansa. +SaveToProfileHelp=Membutuhkan profil atau kartu memori (memory card). +MusicRateHelp=Mainkan musik pada tingkat yang lebih cepat. + +[StepsListDisplayRow StepsType] +Dance_Single=4 +Dance_Double=8 +Dance_Couple=8 +Dance_Solo=6 +Dance_Routine=8 +Dance_Threepanel=3 +Pump_Single=5 +Pump_Double=10 +Pump_Halfdouble=6 +Pump_Couple=5 +Pump_Routine=10 +Kb7_Single=7 +Ez2_Single=ES +Ez2_Double=ED +Ez2_Real=ER +Para_Single=PS +Ds3ddx_Single=XS +Bm_Single5=5 +Bm_Double5=10 +Bm_Single7=7 +Bm_Double7=14 +Maniax_Single=MS +Maniax_Double=MD +Techno_Single4=4 +Techno_Single5=5 +Techno_Single8=8 +Techno_Double4=D4 +Techno_Double5=D5 +Techno_Double8=D8 +Pnm_Five=5 +Pnm_Nine=9 +Guitar_Five=5 +Karaoke=V +Lights_Cabinet=! + +[ScreenHowToInstallSongs] +BodyHeader=Cara Mendapatkan dan Memasang Lagu untuk Stepmania +Finding Songs=Dimana untuk Mencari Lagu +Installing Songs=Cara Memasang Lagu +Importing Songs=Mengimpor dari instalasi2 Stepmania yang ada +Reload Songs=Muat ulang Lagu +Exit=Kembali ke Menu Awal + +Explanation-WhereToFind=Luncurkan sebuah laman web dengan informasi dalam mencari lagu untuk digunakan pada Stepmania. +Explanation-HowToInstall=Luncurkan sebuah Laman web dengan instruksi-instruksi pemasangan lagu. +Explanation-AdditionalFolders=Apabila anda memiliki instalasi Stepmania yang lain, Anda dapat menggunakan preferensi AdditionalFolders untuk memuatnya pada Stepmania 5. +Explanation-ReloadSongs=Muat ulang lagu-lagu. Ini dibutuhkan apabila Anda telah menambahkan/mengubah/menghapus lagu selagi Stepmania sedang berjalan. +Explanation-Exit=Kembali ke menu awal. + +[OptionNames] +Custom=Istimewa (Special) +Many=Banyak (Many) +Few=Sedikit (Few) +Normal=Normal +Lower=Rendah (Lower) +Short=Pendek (Short) +Long=Panjang (Long) + +[ScreenTestInput] +HelpText=Tahan &BACK; atau &START; untuk Keluar. + +[PaneDisplay] +Taps=Injak +Jumps=Loncat +Holds=Tahan +Mines=Ranjau +Hands=Tangan +Rolls=Gulir +Lifts=Angkat +Fakes=Palsu +S=S +V=V +A=A +F=F +C=C + +[ScreenMapControllers] +Exit=Keluar + +[ScreenGameOver] +GAME OVER=GAME OVER (Permainan Tamat) +Play again soon!=Main lagi nanti! + +[ScreenHowToPlay] +How To Play StepMania=Cara bermain StepMania +Information=Informasi + +Feet=Kaki Anda digungakan untuk bermain! +Tap=Saat panah menaik pada titik ini,\ninjak panel yang sesuai. +Jump=Injak pada kedua panel jika dua panah\nberbeda muncul bersamaan! +Miss=Jika Anda kelewat step-nya berulang kali, meteran \ndance Anda akan berkurang sampai\npermainan sudah tamat (Game Over)! + + +[Protiming] +MS=MD