const fixes
This commit is contained in:
+33
-37
@@ -444,31 +444,28 @@ void Actor::ScaleTo( const RectF &rect, StretchType st )
|
||||
SetZoom( fNewZoom );
|
||||
}
|
||||
|
||||
void Actor::SetHorizAlign( CString s )
|
||||
void Actor::SetHorizAlign( const CString &s )
|
||||
{
|
||||
s.MakeLower();
|
||||
if (s=="left") SetHorizAlign( align_left ); /* call derived */
|
||||
else if(s=="center") SetHorizAlign( align_center );
|
||||
else if(s=="right") SetHorizAlign( align_right );
|
||||
if (s.CompareNoCase("left")==0) SetHorizAlign( align_left ); /* call derived */
|
||||
else if(s.CompareNoCase("center")==0) SetHorizAlign( align_center );
|
||||
else if(s.CompareNoCase("right")==0) SetHorizAlign( align_right );
|
||||
else ASSERT(0);
|
||||
}
|
||||
|
||||
void Actor::SetVertAlign( CString s )
|
||||
void Actor::SetVertAlign( const CString &s )
|
||||
{
|
||||
s.MakeLower();
|
||||
if (s=="top") SetVertAlign( align_top ); /* call derived */
|
||||
else if(s=="middle") SetVertAlign( align_middle );
|
||||
else if(s=="bottom") SetVertAlign( align_bottom );
|
||||
if (s.CompareNoCase("top")==0) SetVertAlign( align_top ); /* call derived */
|
||||
else if(s.CompareNoCase("middle")==0) SetVertAlign( align_middle );
|
||||
else if(s.CompareNoCase("bottom")==0) SetVertAlign( align_bottom );
|
||||
else ASSERT(0);
|
||||
}
|
||||
|
||||
void Actor::SetEffectClock( CString s )
|
||||
void Actor::SetEffectClock( const CString &s )
|
||||
{
|
||||
s.MakeLower();
|
||||
if (s=="timer") SetEffectClock( CLOCK_TIMER );
|
||||
else if(s=="beat") SetEffectClock( CLOCK_BGM_BEAT );
|
||||
else if(s=="music") SetEffectClock( CLOCK_BGM_TIME );
|
||||
else if(s=="bgm") SetEffectClock( CLOCK_BGM_BEAT ); // compat, deprecated
|
||||
if (s.CompareNoCase("timer")==0) SetEffectClock( CLOCK_TIMER );
|
||||
else if(s.CompareNoCase("beat")==0) SetEffectClock( CLOCK_BGM_BEAT );
|
||||
else if(s.CompareNoCase("music")==0) SetEffectClock( CLOCK_BGM_TIME );
|
||||
else if(s.CompareNoCase("bgm")==0) SetEffectClock( CLOCK_BGM_BEAT ); // compat, deprecated
|
||||
else ASSERT(0);
|
||||
}
|
||||
|
||||
@@ -619,12 +616,15 @@ void Actor::AddRotationR( float rot )
|
||||
RageQuatMultiply( &DestTweenState().quat, DestTweenState().quat, RageQuatFromR(rot) );
|
||||
}
|
||||
|
||||
void Actor::Command( CString sCommands )
|
||||
void Actor::Command( const CString &sCommands )
|
||||
{
|
||||
sCommands.MakeLower();
|
||||
// Convert to lower so we can do case insensitive compared later.
|
||||
// TODO: Is this the best place to convert?
|
||||
CString sCommandsLower = sCommands;
|
||||
sCommandsLower.MakeLower();
|
||||
|
||||
vector<ParsedCommand> vCommands;
|
||||
ParseCommands( sCommands, vCommands );
|
||||
ParseCommands( sCommandsLower, vCommands );
|
||||
|
||||
for( unsigned i=0; i<vCommands.size(); i++ )
|
||||
this->HandleCommand( vCommands[i] );
|
||||
@@ -760,10 +760,10 @@ void Actor::HandleCommand( const ParsedCommand &command )
|
||||
CheckHandledParams;
|
||||
}
|
||||
|
||||
float Actor::GetCommandLength( CString command )
|
||||
float Actor::GetCommandLengthSeconds( const CString &sCommands )
|
||||
{
|
||||
Actor temp;
|
||||
temp.Command(command);
|
||||
temp.Command(sCommands);
|
||||
|
||||
return temp.GetTweenTimeLeft();
|
||||
}
|
||||
@@ -862,32 +862,28 @@ void Actor::TweenState::MakeWeightedAverage( TweenState& average_out, const Twee
|
||||
average_out.glow = ts1.glow + (ts2.glow - ts1.glow )*fPercentBetween;
|
||||
}
|
||||
|
||||
void Actor::SetBlendMode( CString s )
|
||||
void Actor::SetBlendMode( const CString &s )
|
||||
{
|
||||
s.MakeLower();
|
||||
if (s=="normal") SetBlendMode( BLEND_NORMAL );
|
||||
else if(s=="add") SetBlendMode( BLEND_ADD );
|
||||
else if(s=="noeffect") SetBlendMode( BLEND_NO_EFFECT );
|
||||
if (s.CompareNoCase("normal")==0) SetBlendMode( BLEND_NORMAL );
|
||||
else if(s.CompareNoCase("add")==0) SetBlendMode( BLEND_ADD );
|
||||
else if(s.CompareNoCase("noeffect")==0) SetBlendMode( BLEND_NO_EFFECT );
|
||||
else ASSERT(0);
|
||||
}
|
||||
|
||||
void Actor::SetCullMode( CString s )
|
||||
void Actor::SetCullMode( const CString &s )
|
||||
{
|
||||
s.MakeLower();
|
||||
if (s=="back") SetCullMode( CULL_BACK );
|
||||
else if(s=="front") SetCullMode( CULL_FRONT );
|
||||
else if(s=="none") SetCullMode( CULL_NONE );
|
||||
if (s.CompareNoCase("back")==0) SetCullMode( CULL_BACK );
|
||||
else if(s.CompareNoCase("front")==0) SetCullMode( CULL_FRONT );
|
||||
else if(s.CompareNoCase("none")==0) SetCullMode( CULL_NONE );
|
||||
else ASSERT(0);
|
||||
}
|
||||
|
||||
void Actor::SetZTestMode( CString s )
|
||||
void Actor::SetZTestMode( const CString &s )
|
||||
{
|
||||
s.MakeLower();
|
||||
|
||||
// for metrics backward compatibility
|
||||
if(s=="off") SetZTestMode( ZTEST_OFF );
|
||||
else if(s=="writeonpass") SetZTestMode( ZTEST_WRITE_ON_PASS );
|
||||
else if(s=="writeonfail") SetZTestMode( ZTEST_WRITE_ON_FAIL );
|
||||
if(s.CompareNoCase("off")==0) SetZTestMode( ZTEST_OFF );
|
||||
else if(s.CompareNoCase("writeonpass")==0) SetZTestMode( ZTEST_WRITE_ON_PASS );
|
||||
else if(s.CompareNoCase("writeonfail")==0) SetZTestMode( ZTEST_WRITE_ON_FAIL );
|
||||
else ASSERT(0);
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -72,13 +72,13 @@ public:
|
||||
|
||||
CString m_sName, m_sID;
|
||||
|
||||
CString GetName() const { return m_sName; };
|
||||
CString GetID() const { return m_sID; };
|
||||
/* m_sName is the name actors use to look up internal metrics for themselves, and for
|
||||
* filenames. m_sID is the name parents use to look up their own metrics for an actor
|
||||
* (usually via ActorUtil). (This is experimental; see DifficultyMeter.cpp for more
|
||||
* information.) */
|
||||
void SetName( const CString &sName, const CString &sID = "" ) { m_sName = sName; m_sID = (sID.size()? sID:sName); };
|
||||
const CString &GetName() const { return m_sName; }
|
||||
const CString &GetID() const { return m_sID.empty() ? m_sName : m_sID; }
|
||||
void SetName( const CString &sName, const CString &sID = "" ) { m_sName = sName; m_sID = sID; }
|
||||
|
||||
|
||||
|
||||
@@ -212,11 +212,11 @@ public:
|
||||
//
|
||||
enum HorizAlign { align_left, align_center, align_right };
|
||||
virtual void SetHorizAlign( HorizAlign ha ) { m_HorizAlign = ha; }
|
||||
virtual void SetHorizAlign( CString s );
|
||||
virtual void SetHorizAlign( const CString &s );
|
||||
|
||||
enum VertAlign { align_top, align_middle, align_bottom };
|
||||
virtual void SetVertAlign( VertAlign va ) { m_VertAlign = va; }
|
||||
virtual void SetVertAlign( CString s );
|
||||
virtual void SetVertAlign( const CString &s );
|
||||
|
||||
|
||||
//
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
void SetEffectDelay( float fTime ) { m_fEffectDelay = fTime; }
|
||||
void SetEffectOffset( float fPercent ) { m_fEffectOffset = fPercent; }
|
||||
void SetEffectClock( EffectClock c ) { m_EffectClock = c; }
|
||||
void SetEffectClock( CString s );
|
||||
void SetEffectClock( const CString &s );
|
||||
|
||||
void SetEffectMagnitude( RageVector3 vec ) { m_vEffectMagnitude = vec; }
|
||||
|
||||
@@ -289,22 +289,22 @@ public:
|
||||
// render states
|
||||
//
|
||||
void SetBlendMode( BlendMode mode ) { m_BlendMode = mode; }
|
||||
void SetBlendMode( CString );
|
||||
void SetBlendMode( const CString &s );
|
||||
void SetTextureWrapping( bool b ) { m_bTextureWrapping = b; }
|
||||
void SetClearZBuffer( bool b ) { m_bClearZBuffer = b; }
|
||||
void SetUseZBuffer( bool b ) { SetZTestMode(b?ZTEST_WRITE_ON_PASS:ZTEST_OFF); SetZWrite(b); }
|
||||
virtual void SetZTestMode( ZTestMode mode ) { m_ZTestMode = mode; }
|
||||
virtual void SetZTestMode( CString );
|
||||
virtual void SetZTestMode( const CString &s );
|
||||
virtual void SetZWrite( bool b ) { m_bZWrite = b; }
|
||||
virtual void SetCullMode( CullMode mode ) { m_CullMode = mode; }
|
||||
virtual void SetCullMode( CString );
|
||||
virtual void SetCullMode( const CString &s );
|
||||
|
||||
//
|
||||
// Commands
|
||||
//
|
||||
void Command( CString sCommands ); // return length in seconds to execute command
|
||||
void Command( const CString &sCommands );
|
||||
virtual void HandleCommand( const ParsedCommand &command ); // derivable
|
||||
static float GetCommandLength( CString command );
|
||||
static float GetCommandLengthSeconds( const CString &sCommands );
|
||||
|
||||
//
|
||||
// Animation
|
||||
|
||||
@@ -16,11 +16,11 @@ struct ParsedCommandToken
|
||||
// and the next 3 params are the other components.
|
||||
bool bColorIsValid;
|
||||
|
||||
operator const CString () const { return s; };
|
||||
operator const CString &() const { return s; };
|
||||
operator const float () const { return f; };
|
||||
operator const int () const { return (int)f; };
|
||||
operator const bool () const { return ((int)f)!=0; };
|
||||
operator const RageColor () const { return c; };
|
||||
operator const RageColor &() const { return c; };
|
||||
};
|
||||
|
||||
struct ParsedCommand
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
|
||||
|
||||
Actor* LoadFromActorFile( CString sIniPath, CString sLayer )
|
||||
Actor* LoadFromActorFile( const CString &sIniPath, const CString &sLayer )
|
||||
{
|
||||
// TODO: Check for recursive loading
|
||||
IniFile ini;
|
||||
@@ -234,7 +234,7 @@ retry:
|
||||
return pActor;
|
||||
}
|
||||
|
||||
Actor* MakeActor( RageTextureID ID )
|
||||
Actor* MakeActor( const RageTextureID &ID )
|
||||
{
|
||||
CString sExt = GetExtension( ID.filename );
|
||||
sExt.MakeLower();
|
||||
@@ -275,13 +275,13 @@ Actor* MakeActor( RageTextureID ID )
|
||||
ID.filename.c_str(), sExt.c_str() );
|
||||
}
|
||||
|
||||
void UtilSetXY( Actor& actor, CString sClassName )
|
||||
void UtilSetXY( Actor& actor, const CString &sClassName )
|
||||
{
|
||||
ASSERT( !actor.GetID().empty() );
|
||||
actor.SetXY( THEME->GetMetricF(sClassName,actor.GetID()+"X"), THEME->GetMetricF(sClassName,actor.GetID()+"Y") );
|
||||
}
|
||||
|
||||
void UtilCommand( Actor& actor, CString sClassName, CString sCommandName )
|
||||
void UtilCommand( Actor& actor, const CString &sClassName, const CString &sCommandName )
|
||||
{
|
||||
// If Actor is hidden, it won't get updated or drawn, so don't bother tweening.
|
||||
/* ... but we might be unhiding it, or setting state for when we unhide it later */
|
||||
@@ -305,13 +305,13 @@ void UtilCommand( Actor& actor, CString sClassName, CString sCommandName )
|
||||
actor.Command( THEME->GetMetric(sClassName,actor.GetID()+sCommandName+"Command") );
|
||||
}
|
||||
|
||||
void AutoActor::Load( CString sPath )
|
||||
void AutoActor::Load( const CString &sPath )
|
||||
{
|
||||
Unload();
|
||||
m_pActor = MakeActor( sPath );
|
||||
}
|
||||
|
||||
void AutoActor::LoadAndSetName( CString sScreenName, CString sActorName )
|
||||
void AutoActor::LoadAndSetName( const CString &sScreenName, const CString &sActorName )
|
||||
{
|
||||
Load( THEME->GetPathG(sScreenName,sActorName) );
|
||||
m_pActor->SetName( sActorName );
|
||||
|
||||
+14
-14
@@ -12,29 +12,29 @@
|
||||
#define COMMAND( actor, command_name ) UtilCommand( actor, m_sName, command_name )
|
||||
|
||||
|
||||
void UtilSetXY( Actor& actor, CString sClassName );
|
||||
inline void UtilSetXY( Actor* pActor, CString sClassName ) { UtilSetXY( *pActor, sClassName ); }
|
||||
void UtilSetXY( Actor& actor, const CString &sClassName );
|
||||
inline void UtilSetXY( Actor* pActor, const CString &sClassName ) { UtilSetXY( *pActor, sClassName ); }
|
||||
|
||||
|
||||
void UtilCommand( Actor& actor, CString sClassName, CString sCommandName );
|
||||
void UtilCommand( Actor& actor, const CString &sClassName, const CString &sCommandName );
|
||||
|
||||
inline void UtilOnCommand( Actor& actor, CString sClassName ) { UtilCommand( actor, sClassName, "On" ); }
|
||||
inline void UtilOffCommand( Actor& actor, CString sClassName ) { UtilCommand( actor, sClassName, "Off" ); }
|
||||
inline void UtilSetXYAndOnCommand( Actor& actor, CString sClassName )
|
||||
inline void UtilOnCommand( Actor& actor, const CString &sClassName ) { UtilCommand( actor, sClassName, "On" ); }
|
||||
inline void UtilOffCommand( Actor& actor, const CString &sClassName ) { UtilCommand( actor, sClassName, "Off" ); }
|
||||
inline void UtilSetXYAndOnCommand( Actor& actor, const CString &sClassName )
|
||||
{
|
||||
UtilSetXY( actor, sClassName );
|
||||
UtilOnCommand( actor, sClassName );
|
||||
}
|
||||
|
||||
/* convenience */
|
||||
inline void UtilCommand( Actor* pActor, CString sClassName, CString sCommandName ) { if(pActor) UtilCommand( *pActor, sClassName, sCommandName ); }
|
||||
inline void UtilOnCommand( Actor* pActor, CString sClassName ) { if(pActor) UtilOnCommand( *pActor, sClassName ); }
|
||||
inline void UtilOffCommand( Actor* pActor, CString sClassName ) { if(pActor) UtilOffCommand( *pActor, sClassName ); }
|
||||
inline void UtilSetXYAndOnCommand( Actor* pActor, CString sClassName ) { if(pActor) UtilSetXYAndOnCommand( *pActor, sClassName ); }
|
||||
inline void UtilCommand( Actor* pActor, const CString &sClassName, const CString &sCommandName ) { if(pActor) UtilCommand( *pActor, sClassName, sCommandName ); }
|
||||
inline void UtilOnCommand( Actor* pActor, const CString &sClassName ) { if(pActor) UtilOnCommand( *pActor, sClassName ); }
|
||||
inline void UtilOffCommand( Actor* pActor, const CString &sClassName ) { if(pActor) UtilOffCommand( *pActor, sClassName ); }
|
||||
inline void UtilSetXYAndOnCommand( Actor* pActor, const CString &sClassName ) { if(pActor) UtilSetXYAndOnCommand( *pActor, sClassName ); }
|
||||
|
||||
// Return a Sprite, BitmapText, or Model depending on the file type
|
||||
Actor* LoadFromActorFile( CString sIniPath, CString sLayer = "Actor" );
|
||||
Actor* MakeActor( RageTextureID ID );
|
||||
Actor* LoadFromActorFile( const CString &sIniPath, const CString &sLayer = "Actor" );
|
||||
Actor* MakeActor( const RageTextureID &ID );
|
||||
|
||||
|
||||
// creates the appropriate Actor derivitive on load and
|
||||
@@ -50,8 +50,8 @@ public:
|
||||
Actor *operator->() { return m_pActor; }
|
||||
void Unload() { if(m_pActor) { delete m_pActor; m_pActor=NULL; } }
|
||||
bool IsLoaded() const { return m_pActor != NULL; }
|
||||
void Load( CString sPath );
|
||||
void LoadAndSetName( CString sScreenName, CString sActorName );
|
||||
void Load( const CString &sPath );
|
||||
void LoadAndSetName( const CString &sScreenName, const CString &sActorName );
|
||||
|
||||
protected:
|
||||
Actor* m_pActor;
|
||||
|
||||
@@ -30,8 +30,8 @@ void LyricDisplay::Init()
|
||||
m_iCurLyricNumber = 0;
|
||||
|
||||
/* Update global cache: */
|
||||
g_TweenInTime = Actor::GetCommandLength(IN_COMMAND);
|
||||
g_TweenOutTime = Actor::GetCommandLength(OUT_COMMAND);
|
||||
g_TweenInTime = Actor::GetCommandLengthSeconds(IN_COMMAND);
|
||||
g_TweenOutTime = Actor::GetCommandLengthSeconds(OUT_COMMAND);
|
||||
m_fLastSecond = -500;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user