Skip to content

Commit

Permalink
Lots of changes to make RStrings and some other variables be passed b…
Browse files Browse the repository at this point in the history
…y reference.
  • Loading branch information
xwidghet committed Oct 15, 2016
1 parent 5ae7aa7 commit dac3888
Show file tree
Hide file tree
Showing 200 changed files with 564 additions and 567 deletions.
26 changes: 13 additions & 13 deletions src/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ void Actor::ResetEffectTimeIfDifferent(Effect new_effect)
}
}

void Actor::SetEffectDiffuseBlink( float fEffectPeriodSeconds, RageColor c1, RageColor c2 )
void Actor::SetEffectDiffuseBlink( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 )
{
ASSERT( fEffectPeriodSeconds > 0 );
// todo: account for SSC_FUTURES -aj
Expand All @@ -1141,7 +1141,7 @@ void Actor::SetEffectDiffuseBlink( float fEffectPeriodSeconds, RageColor c1, Rag
m_effectColor2 = c2;
}

void Actor::SetEffectDiffuseShift( float fEffectPeriodSeconds, RageColor c1, RageColor c2 )
void Actor::SetEffectDiffuseShift( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 )
{
ASSERT( fEffectPeriodSeconds > 0 );
// todo: account for SSC_FUTURES -aj
Expand All @@ -1151,7 +1151,7 @@ void Actor::SetEffectDiffuseShift( float fEffectPeriodSeconds, RageColor c1, Rag
m_effectColor2 = c2;
}

void Actor::SetEffectDiffuseRamp( float fEffectPeriodSeconds, RageColor c1, RageColor c2 )
void Actor::SetEffectDiffuseRamp( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 )
{
ASSERT( fEffectPeriodSeconds > 0 );
// todo: account for SSC_FUTURES -aj
Expand All @@ -1161,7 +1161,7 @@ void Actor::SetEffectDiffuseRamp( float fEffectPeriodSeconds, RageColor c1, Rage
m_effectColor2 = c2;
}

void Actor::SetEffectGlowBlink( float fEffectPeriodSeconds, RageColor c1, RageColor c2 )
void Actor::SetEffectGlowBlink( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 )
{
ASSERT( fEffectPeriodSeconds > 0 );
// todo: account for SSC_FUTURES -aj
Expand All @@ -1171,7 +1171,7 @@ void Actor::SetEffectGlowBlink( float fEffectPeriodSeconds, RageColor c1, RageCo
m_effectColor2 = c2;
}

void Actor::SetEffectGlowShift( float fEffectPeriodSeconds, RageColor c1, RageColor c2 )
void Actor::SetEffectGlowShift( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 )
{
ASSERT( fEffectPeriodSeconds > 0 );
// todo: account for SSC_FUTURES -aj
Expand All @@ -1181,7 +1181,7 @@ void Actor::SetEffectGlowShift( float fEffectPeriodSeconds, RageColor c1, RageCo
m_effectColor2 = c2;
}

void Actor::SetEffectGlowRamp( float fEffectPeriodSeconds, RageColor c1, RageColor c2 )
void Actor::SetEffectGlowRamp( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 )
{
ASSERT( fEffectPeriodSeconds > 0 );
// todo: account for SSC_FUTURES -aj
Expand All @@ -1199,7 +1199,7 @@ void Actor::SetEffectRainbow( float fEffectPeriodSeconds )
SetEffectPeriod( fEffectPeriodSeconds );
}

void Actor::SetEffectWag( float fPeriod, RageVector3 vect )
void Actor::SetEffectWag( float fPeriod, const RageVector3 &vect )
{
ASSERT( fPeriod > 0 );
// todo: account for SSC_FUTURES -aj
Expand All @@ -1208,7 +1208,7 @@ void Actor::SetEffectWag( float fPeriod, RageVector3 vect )
m_vEffectMagnitude = vect;
}

void Actor::SetEffectBounce( float fPeriod, RageVector3 vect )
void Actor::SetEffectBounce( float fPeriod, const RageVector3 &vect )
{
ASSERT( fPeriod > 0 );
// todo: account for SSC_FUTURES -aj
Expand All @@ -1218,7 +1218,7 @@ void Actor::SetEffectBounce( float fPeriod, RageVector3 vect )
m_fSecsIntoEffect = 0;
}

void Actor::SetEffectBob( float fPeriod, RageVector3 vect )
void Actor::SetEffectBob( float fPeriod, const RageVector3 &vect )
{
ASSERT( fPeriod > 0 );
// todo: account for SSC_FUTURES -aj
Expand All @@ -1231,14 +1231,14 @@ void Actor::SetEffectBob( float fPeriod, RageVector3 vect )
m_vEffectMagnitude = vect;
}

void Actor::SetEffectSpin( RageVector3 vect )
void Actor::SetEffectSpin( const RageVector3 &vect )
{
// todo: account for SSC_FUTURES -aj
m_Effect = spin;
m_vEffectMagnitude = vect;
}

void Actor::SetEffectVibrate( RageVector3 vect )
void Actor::SetEffectVibrate( const RageVector3 &vect )
{
// todo: account for SSC_FUTURES -aj
m_Effect = vibrate;
Expand Down Expand Up @@ -1325,7 +1325,7 @@ float Actor::GetTweenTimeLeft() const
* we can simply say eg. "for x in states(Actor) do x.SetDiffuseColor(c) end".
* However, we'd then have to give every TweenState a userdata in Lua while it's
* being manipulated, which would add overhead ... */
void Actor::SetGlobalDiffuseColor( RageColor c )
void Actor::SetGlobalDiffuseColor( const RageColor &c )
{
for( int i=0; i<NUM_DIFFUSE_COLORS; i++ ) // color, not alpha
{
Expand All @@ -1344,7 +1344,7 @@ void Actor::SetGlobalDiffuseColor( RageColor c )
}
}

void Actor::SetDiffuseColor( RageColor c )
void Actor::SetDiffuseColor( const RageColor &c )
{
for( int i=0; i<NUM_DIFFUSE_COLORS; i++ )
{
Expand Down
56 changes: 28 additions & 28 deletions src/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,25 +451,25 @@ class Actor : public MessageSubscriber
void SetFadeRight( float percent ) { DestTweenState().fade.right = percent; }
void SetFadeBottom( float percent ) { DestTweenState().fade.bottom = percent; }

void SetGlobalDiffuseColor( RageColor c );
void SetGlobalDiffuseColor( const RageColor &c );

virtual void SetDiffuse( RageColor c ) { for(int i=0; i<NUM_DIFFUSE_COLORS; i++) DestTweenState().diffuse[i] = c; };
virtual void SetDiffuse( const RageColor &c ) { for(int i=0; i<NUM_DIFFUSE_COLORS; i++) DestTweenState().diffuse[i] = c; };
virtual void SetDiffuseAlpha( float f ) { for(int i = 0; i < NUM_DIFFUSE_COLORS; ++i) { RageColor c = GetDiffuses( i ); c.a = f; SetDiffuses( i, c ); } }
float GetCurrentDiffuseAlpha() const { return m_current.diffuse[0].a; }
void SetDiffuseColor( RageColor c );
void SetDiffuses( int i, RageColor c ) { DestTweenState().diffuse[i] = c; };
void SetDiffuseUpperLeft( RageColor c ) { DestTweenState().diffuse[0] = c; };
void SetDiffuseUpperRight( RageColor c ) { DestTweenState().diffuse[1] = c; };
void SetDiffuseLowerLeft( RageColor c ) { DestTweenState().diffuse[2] = c; };
void SetDiffuseLowerRight( RageColor c ) { DestTweenState().diffuse[3] = c; };
void SetDiffuseTopEdge( RageColor c ) { DestTweenState().diffuse[0] = DestTweenState().diffuse[1] = c; };
void SetDiffuseRightEdge( RageColor c ) { DestTweenState().diffuse[1] = DestTweenState().diffuse[3] = c; };
void SetDiffuseBottomEdge( RageColor c ) { DestTweenState().diffuse[2] = DestTweenState().diffuse[3] = c; };
void SetDiffuseLeftEdge( RageColor c ) { DestTweenState().diffuse[0] = DestTweenState().diffuse[2] = c; };
void SetDiffuseColor( const RageColor &c );
void SetDiffuses( int i, const RageColor &c ) { DestTweenState().diffuse[i] = c; };
void SetDiffuseUpperLeft( const RageColor &c ) { DestTweenState().diffuse[0] = c; };
void SetDiffuseUpperRight( const RageColor &c ) { DestTweenState().diffuse[1] = c; };
void SetDiffuseLowerLeft( const RageColor &c ) { DestTweenState().diffuse[2] = c; };
void SetDiffuseLowerRight( const RageColor &c ) { DestTweenState().diffuse[3] = c; };
void SetDiffuseTopEdge( const RageColor &c ) { DestTweenState().diffuse[0] = DestTweenState().diffuse[1] = c; };
void SetDiffuseRightEdge( const RageColor &c ) { DestTweenState().diffuse[1] = DestTweenState().diffuse[3] = c; };
void SetDiffuseBottomEdge( const RageColor &c ) { DestTweenState().diffuse[2] = DestTweenState().diffuse[3] = c; };
void SetDiffuseLeftEdge( const RageColor &c ) { DestTweenState().diffuse[0] = DestTweenState().diffuse[2] = c; };
RageColor GetDiffuse() const { return DestTweenState().diffuse[0]; };
RageColor GetDiffuses( int i ) const { return DestTweenState().diffuse[i]; };
float GetDiffuseAlpha() const { return DestTweenState().diffuse[0].a; };
void SetGlow( RageColor c ) { DestTweenState().glow = c; };
void SetGlow( const RageColor &c ) { DestTweenState().glow = c; };
RageColor GetGlow() const { return DestTweenState().glow; };

void SetAux( float f ) { DestTweenState().aux = f; }
Expand Down Expand Up @@ -527,8 +527,8 @@ class Actor : public MessageSubscriber
float GetEffectDelta() const { return m_fEffectDelta; }

// todo: account for SSC_FUTURES by adding an effect as an arg to each one -aj
void SetEffectColor1( RageColor c ) { m_effectColor1 = c; }
void SetEffectColor2( RageColor c ) { m_effectColor2 = c; }
void SetEffectColor1( const RageColor &c ) { m_effectColor1 = c; }
void SetEffectColor2( const RageColor &c ) { m_effectColor2 = c; }
void RecalcEffectPeriod();
void SetEffectPeriod( float fTime );
float GetEffectPeriod() const { return m_effect_period; }
Expand All @@ -539,23 +539,23 @@ class Actor : public MessageSubscriber
void SetEffectClock( EffectClock c ) { m_EffectClock = c; }
void SetEffectClockString( const RString &s ); // convenience

void SetEffectMagnitude( RageVector3 vec ) { m_vEffectMagnitude = vec; }
void SetEffectMagnitude( const RageVector3 &vec ) { m_vEffectMagnitude = vec; }
RageVector3 GetEffectMagnitude() const { return m_vEffectMagnitude; }

void ResetEffectTimeIfDifferent(Effect new_effect);
void SetEffectDiffuseBlink( float fEffectPeriodSeconds, RageColor c1, RageColor c2 );
void SetEffectDiffuseShift( float fEffectPeriodSeconds, RageColor c1, RageColor c2 );
void SetEffectDiffuseRamp( float fEffectPeriodSeconds, RageColor c1, RageColor c2 );
void SetEffectGlowBlink( float fEffectPeriodSeconds, RageColor c1, RageColor c2 );
void SetEffectGlowShift( float fEffectPeriodSeconds, RageColor c1, RageColor c2 );
void SetEffectGlowRamp( float fEffectPeriodSeconds, RageColor c1, RageColor c2 );
void SetEffectDiffuseBlink( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 );
void SetEffectDiffuseShift( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 );
void SetEffectDiffuseRamp( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 );
void SetEffectGlowBlink( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 );
void SetEffectGlowShift( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 );
void SetEffectGlowRamp( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 );
void SetEffectRainbow( float fEffectPeriodSeconds );
void SetEffectWag( float fPeriod, RageVector3 vect );
void SetEffectBounce( float fPeriod, RageVector3 vect );
void SetEffectBob( float fPeriod, RageVector3 vect );
void SetEffectWag( float fPeriod, const RageVector3 &vect );
void SetEffectBounce( float fPeriod, const RageVector3 &vect );
void SetEffectBob( float fPeriod, const RageVector3 &vect );
void SetEffectPulse( float fPeriod, float fMinZoom, float fMaxZoom );
void SetEffectSpin( RageVector3 vect );
void SetEffectVibrate( RageVector3 vect );
void SetEffectSpin( const RageVector3 &vect );
void SetEffectVibrate( const RageVector3 &vect );


// other properties
Expand All @@ -567,7 +567,7 @@ class Actor : public MessageSubscriber
void SetShadowLength( float fLength ) { m_fShadowLengthX = fLength; m_fShadowLengthY = fLength; }
void SetShadowLengthX( float fLengthX ) { m_fShadowLengthX = fLengthX; }
void SetShadowLengthY( float fLengthY ) { m_fShadowLengthY = fLengthY; }
void SetShadowColor( RageColor c ) { m_ShadowColor = c; }
void SetShadowColor( const RageColor &c ) { m_ShadowColor = c; }
// TODO: Implement hibernate as a tween type?
void SetHibernate( float fSecs ) { m_fHibernateSecondsLeft = fSecs; }
void SetDrawOrder( int iOrder ) { m_iDrawOrder = iOrder; }
Expand Down
8 changes: 4 additions & 4 deletions src/ActorFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ class ActorFrame : public Actor
void SetVanishPoint( float fX, float fY) { m_fVanishX = fX; m_fVanishY = fY; }

void SetCustomLighting( bool bCustomLighting ) { m_bOverrideLighting = bCustomLighting; }
void SetAmbientLightColor( RageColor c ) { m_ambientColor = c; }
void SetDiffuseLightColor( RageColor c ) { m_diffuseColor = c; }
void SetSpecularLightColor( RageColor c ) { m_specularColor = c; }
void SetLightDirection( RageVector3 vec ) { m_lightDirection = vec; }
void SetAmbientLightColor( const RageColor &c ) { m_ambientColor = c; }
void SetDiffuseLightColor( const RageColor &c ) { m_diffuseColor = c; }
void SetSpecularLightColor( const RageColor &c ) { m_specularColor = c; }
void SetLightDirection( const RageVector3 &vec ) { m_lightDirection = vec; }

virtual void SetPropagateCommands( bool b );

Expand Down
4 changes: 2 additions & 2 deletions src/ActorMultiVertex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void ActorMultiVertex::SetTexture( RageTexture *Texture )
}
}

void ActorMultiVertex::LoadFromTexture( RageTextureID ID )
void ActorMultiVertex::LoadFromTexture( const RageTextureID &ID )
{
RageTexture *Texture = NULL;
if( _Texture && _Texture->GetID() == ID )
Expand Down Expand Up @@ -204,7 +204,7 @@ void ActorMultiVertex::SetVertexPos( int index, float x, float y, float z )
AMV_DestTweenState().vertices[index].p = RageVector3( x, y, z );
}

void ActorMultiVertex::SetVertexColor( int index, RageColor c )
void ActorMultiVertex::SetVertexColor( int index, const RageColor &c )
{
AMV_DestTweenState().vertices[index].c = c;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ActorMultiVertex.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class ActorMultiVertex: public Actor

void SetTexture( RageTexture *Texture );
RageTexture* GetTexture() { return _Texture; };
void LoadFromTexture( RageTextureID ID );
void LoadFromTexture( const RageTextureID &ID );

void UnloadTexture();
void SetNumVertices( size_t n );
Expand All @@ -107,7 +107,7 @@ class ActorMultiVertex: public Actor
size_t GetNumVertices() { return AMV_DestTweenState().vertices.size(); }

void SetVertexPos( int index , float x , float y , float z );
void SetVertexColor( int index , RageColor c );
void SetVertexColor( int index , const RageColor &c );
void SetVertexCoords( int index , float TexCoordX , float TexCoordY );

inline void SetVertsFromSplinesInternal(size_t num_splines, size_t start_vert);
Expand Down
12 changes: 6 additions & 6 deletions src/AnnouncerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void AnnouncerManager::GetAnnouncerNames( vector<RString>& AddTo )
AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 );
}

bool AnnouncerManager::DoesAnnouncerExist( RString sAnnouncerName )
bool AnnouncerManager::DoesAnnouncerExist( const RString &sAnnouncerName )
{
if( sAnnouncerName == "" )
return true;
Expand All @@ -55,12 +55,12 @@ bool AnnouncerManager::DoesAnnouncerExist( RString sAnnouncerName )
return false;
}

RString AnnouncerManager::GetAnnouncerDirFromName( RString sAnnouncerName )
RString AnnouncerManager::GetAnnouncerDirFromName( const RString &sAnnouncerName )
{
return ANNOUNCERS_DIR + sAnnouncerName + "/";
}

void AnnouncerManager::SwitchAnnouncer( RString sNewAnnouncerName )
void AnnouncerManager::SwitchAnnouncer( const RString &sNewAnnouncerName )
{
if( !DoesAnnouncerExist(sNewAnnouncerName) )
m_sCurAnnouncerName = "";
Expand Down Expand Up @@ -108,7 +108,7 @@ static const char *aliases[][2] = {
* then all aliases above. Ignore directories that are empty, since we might
* have "select difficulty intro" with sounds and an empty "ScreenSelectDifficulty
* intro". */
RString AnnouncerManager::GetPathTo( RString sAnnouncerName, RString sFolderName )
RString AnnouncerManager::GetPathTo( const RString &sAnnouncerName, const RString &sFolderName )
{
if(sAnnouncerName == "")
return RString(); /* announcer disabled */
Expand Down Expand Up @@ -142,12 +142,12 @@ RString AnnouncerManager::GetPathTo( RString sAnnouncerName, RString sFolderName
return RString();
}

RString AnnouncerManager::GetPathTo( RString sFolderName )
RString AnnouncerManager::GetPathTo( const RString &sFolderName )
{
return GetPathTo(m_sCurAnnouncerName, sFolderName);
}

bool AnnouncerManager::HasSoundsFor( RString sFolderName )
bool AnnouncerManager::HasSoundsFor( const RString &sFolderName )
{
return !DirectoryIsEmpty( GetPathTo(sFolderName) );
}
Expand Down
12 changes: 6 additions & 6 deletions src/AnnouncerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ class AnnouncerManager
* @brief Determine if the specified announcer exists.
* @param sAnnouncerName the announcer we're checking for.
* @return true if it exists, false otherwise. */
bool DoesAnnouncerExist( RString sAnnouncerName );
bool DoesAnnouncerExist( const RString &sAnnouncerName );
/**
* @brief Switch to a new specified announcer.
* @param sNewAnnouncerName the new announcer the Player will be listening to. */
void SwitchAnnouncer( RString sNewAnnouncerName );
void SwitchAnnouncer( const RString &sNewAnnouncerName );
/**
* @brief Retrieve the current announcer's name.
* @return the current announcer's name. */
RString GetCurAnnouncerName() const { return m_sCurAnnouncerName; };
void NextAnnouncer();

RString GetPathTo( RString sFolderName );
bool HasSoundsFor( RString sFolderName );
RString GetPathTo( const RString &sFolderName );
bool HasSoundsFor( const RString &sFolderName );

// Lua
void PushSelf( lua_State *L );

protected:
static RString GetAnnouncerDirFromName( RString sAnnouncerName );
RString GetPathTo( RString AnnouncerPath, RString sFolderName );
static RString GetAnnouncerDirFromName( const RString &sAnnouncerName );
RString GetPathTo( const RString &AnnouncerPath, const RString &sFolderName );
/** @brief the current announcer's name. */
RString m_sCurAnnouncerName;
};
Expand Down
2 changes: 1 addition & 1 deletion src/BackgroundUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct BackgroundDef
* @param effect the intended effect.
* @param f1 the primary filename for the definition.
* @param f2 the secondary filename (optional). */
BackgroundDef(RString effect, RString f1, RString f2):
BackgroundDef(const RString &effect, const RString &f1, const RString &f2):
m_sEffect(effect), m_sFile1(f1), m_sFile2(f2),
m_sColor1(""), m_sColor2("") {}
};
Expand Down
2 changes: 1 addition & 1 deletion src/Banner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void Banner::LoadMode()
m_bScrolling = (bool)SCROLL_MODE;
}

void Banner::LoadFromSongGroup( RString sSongGroup )
void Banner::LoadFromSongGroup( const RString &sSongGroup )
{
RString sGroupBannerPath = SONGMAN->GetSongGroupBannerPath( sSongGroup );
if( sGroupBannerPath != "" ) Load( sGroupBannerPath );
Expand Down
4 changes: 2 additions & 2 deletions src/Banner.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Banner : public Sprite
virtual Banner *Copy() const;

void Load( RageTextureID ID, bool bIsBanner );
virtual void Load( RageTextureID ID ) { Load( ID, true ); }
virtual void Load( const RageTextureID &ID ) { Load( ID, true ); }
void LoadFromCachedBanner( const RString &sPath );

virtual void Update( float fDeltaTime );
Expand All @@ -31,7 +31,7 @@ class Banner : public Sprite
*/
void LoadFromSong( Song* pSong );
void LoadMode();
void LoadFromSongGroup( RString sSongGroup );
void LoadFromSongGroup( const RString &sSongGroup );
void LoadFromCourse( const Course *pCourse );
void LoadCardFromCharacter( const Character *pCharacter );
void LoadIconFromCharacter( const Character *pCharacter );
Expand Down
Loading

0 comments on commit dac3888

Please sign in to comment.