put ActorUtil functions in a namespace
This commit is contained in:
@@ -29,7 +29,7 @@ void ActorFrame::LoadFromNode( const CString& sDir, const XNode* pNode )
|
||||
{
|
||||
FOREACH_CONST_Child( pChildren, pChild )
|
||||
{
|
||||
Actor* pChildActor = LoadFromActorFile( sDir, pChild );
|
||||
Actor* pChildActor = ActorUtil::LoadFromActorFile( sDir, pChild );
|
||||
if( pChildActor )
|
||||
AddChild( pChildActor );
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
|
||||
|
||||
Actor* LoadFromActorFile( const CString& sAniDir, const XNode* pNode )
|
||||
Actor* ActorUtil::LoadFromActorFile( const CString& sAniDir, const XNode* pNode )
|
||||
{
|
||||
ASSERT( pNode );
|
||||
|
||||
@@ -246,7 +246,7 @@ retry:
|
||||
|
||||
sNewPath = DerefRedir( sNewPath );
|
||||
|
||||
pActor = MakeActor( sNewPath );
|
||||
pActor = ActorUtil::MakeActor( sNewPath );
|
||||
if( pActor == NULL )
|
||||
return NULL;
|
||||
}
|
||||
@@ -259,7 +259,7 @@ retry:
|
||||
return pActor;
|
||||
}
|
||||
|
||||
Actor* MakeActor( const RageTextureID &ID )
|
||||
Actor* ActorUtil::MakeActor( const RageTextureID &ID )
|
||||
{
|
||||
CString sExt = GetExtension( ID.filename );
|
||||
sExt.MakeLower();
|
||||
@@ -335,13 +335,13 @@ Actor* MakeActor( const RageTextureID &ID )
|
||||
}
|
||||
}
|
||||
|
||||
void UtilSetXY( Actor& actor, const CString &sScreenName )
|
||||
void ActorUtil::SetXY( Actor& actor, const CString &sScreenName )
|
||||
{
|
||||
ASSERT( !actor.GetID().empty() );
|
||||
actor.SetXY( THEME->GetMetricF(sScreenName,actor.GetID()+"X"), THEME->GetMetricF(sScreenName,actor.GetID()+"Y") );
|
||||
}
|
||||
|
||||
void UtilCommand( Actor& actor, const CString &sScreenName, const CString &sCommandName )
|
||||
void ActorUtil::Command( Actor& actor, const CString &sScreenName, const CString &sCommandName )
|
||||
{
|
||||
actor.PlayCommand( sCommandName );
|
||||
|
||||
@@ -366,7 +366,7 @@ void UtilCommand( Actor& actor, const CString &sScreenName, const CString &sComm
|
||||
void AutoActor::Load( const CString &sPath )
|
||||
{
|
||||
Unload();
|
||||
m_pActor = MakeActor( sPath );
|
||||
m_pActor = ActorUtil::MakeActor( sPath );
|
||||
}
|
||||
|
||||
void AutoActor::LoadAndSetName( const CString &sScreenName, const CString &sActorName )
|
||||
|
||||
+26
-25
@@ -6,36 +6,37 @@
|
||||
|
||||
struct XNode;
|
||||
|
||||
#define SET_XY( actor ) UtilSetXY( actor, m_sName )
|
||||
#define ON_COMMAND( actor ) UtilOnCommand( actor, m_sName )
|
||||
#define OFF_COMMAND( actor ) UtilOffCommand( actor, m_sName )
|
||||
#define SET_XY_AND_ON_COMMAND( actor ) UtilSetXYAndOnCommand( actor, m_sName )
|
||||
#define COMMAND( actor, command_name ) UtilCommand( actor, m_sName, command_name )
|
||||
#define SET_XY( actor ) ActorUtil::SetXY( actor, m_sName )
|
||||
#define ON_COMMAND( actor ) ActorUtil::OnCommand( actor, m_sName )
|
||||
#define OFF_COMMAND( actor ) ActorUtil::OffCommand( actor, m_sName )
|
||||
#define SET_XY_AND_ON_COMMAND( actor ) ActorUtil::SetXYAndOnCommand( actor, m_sName )
|
||||
#define COMMAND( actor, command_name ) ActorUtil::Command( actor, m_sName, command_name )
|
||||
|
||||
void UtilSetXY( Actor& actor, const CString &sScreenName );
|
||||
inline void UtilSetXY( Actor* pActor, const CString &sScreenName ) { UtilSetXY( *pActor, sScreenName ); }
|
||||
|
||||
|
||||
void UtilCommand( Actor& actor, const CString &sScreenName, const CString &sCommandName );
|
||||
|
||||
inline void UtilOnCommand( Actor& actor, const CString &sScreenName ) { UtilCommand( actor, sScreenName, "On" ); }
|
||||
inline void UtilOffCommand( Actor& actor, const CString &sScreenName ) { UtilCommand( actor, sScreenName, "Off" ); }
|
||||
inline void UtilSetXYAndOnCommand( Actor& actor, const CString &sScreenName )
|
||||
namespace ActorUtil
|
||||
{
|
||||
UtilSetXY( actor, sScreenName );
|
||||
UtilOnCommand( actor, sScreenName );
|
||||
}
|
||||
void SetXY( Actor& actor, const CString &sScreenName );
|
||||
inline void SetXY( Actor* pActor, const CString &sScreenName ) { SetXY( *pActor, sScreenName ); }
|
||||
|
||||
/* convenience */
|
||||
inline void UtilCommand( Actor* pActor, const CString &sScreenName, const CString &sCommandName ) { if(pActor) UtilCommand( *pActor, sScreenName, sCommandName ); }
|
||||
inline void UtilOnCommand( Actor* pActor, const CString &sScreenName ) { if(pActor) UtilOnCommand( *pActor, sScreenName ); }
|
||||
inline void UtilOffCommand( Actor* pActor, const CString &sScreenName ) { if(pActor) UtilOffCommand( *pActor, sScreenName ); }
|
||||
inline void UtilSetXYAndOnCommand( Actor* pActor, const CString &sScreenName ) { if(pActor) UtilSetXYAndOnCommand( *pActor, sScreenName ); }
|
||||
void Command( Actor& actor, const CString &sScreenName, const CString &sCommandName );
|
||||
|
||||
// Return a Sprite, BitmapText, or Model depending on the file type
|
||||
Actor* LoadFromActorFile( const CString& sAniDir, const XNode* pNode );
|
||||
Actor* MakeActor( const RageTextureID &ID );
|
||||
inline void OnCommand( Actor& actor, const CString &sScreenName ) { Command( actor, sScreenName, "On" ); }
|
||||
inline void OffCommand( Actor& actor, const CString &sScreenName ) { Command( actor, sScreenName, "Off" ); }
|
||||
inline void SetXYAndOnCommand( Actor& actor, const CString &sScreenName )
|
||||
{
|
||||
SetXY( actor, sScreenName );
|
||||
OnCommand( actor, sScreenName );
|
||||
}
|
||||
|
||||
/* convenience */
|
||||
inline void Command( Actor* pActor, const CString &sScreenName, const CString &sCommandName ) { if(pActor) Command( *pActor, sScreenName, sCommandName ); }
|
||||
inline void OnCommand( Actor* pActor, const CString &sScreenName ) { if(pActor) OnCommand( *pActor, sScreenName ); }
|
||||
inline void OffCommand( Actor* pActor, const CString &sScreenName ) { if(pActor) OffCommand( *pActor, sScreenName ); }
|
||||
inline void SetXYAndOnCommand( Actor* pActor, const CString &sScreenName ) { if(pActor) SetXYAndOnCommand( *pActor, sScreenName ); }
|
||||
|
||||
// Return a Sprite, BitmapText, or Model depending on the file type
|
||||
Actor* LoadFromActorFile( const CString& sAniDir, const XNode* pNode );
|
||||
Actor* MakeActor( const RageTextureID &ID );
|
||||
};
|
||||
|
||||
// creates the appropriate Actor derivitive on load and
|
||||
// automatically deletes Actor on deconstruction.
|
||||
|
||||
@@ -469,7 +469,7 @@ void BGAnimationLayer::LoadFromNode( const CString& sDir, const XNode* pNode )
|
||||
{
|
||||
case TYPE_SPRITE:
|
||||
{
|
||||
Actor* pActor = LoadFromActorFile( sAniDir, pNode );
|
||||
Actor* pActor = ActorUtil::LoadFromActorFile( sAniDir, pNode );
|
||||
this->AddChild( pActor );
|
||||
if( bStretch )
|
||||
pActor->StretchTo( FullScreenRectF );
|
||||
@@ -494,7 +494,7 @@ void BGAnimationLayer::LoadFromNode( const CString& sDir, const XNode* pNode )
|
||||
|
||||
for( int i=0; i<iNumParticles; i++ )
|
||||
{
|
||||
Actor* pActor = MakeActor( sPath );
|
||||
Actor* pActor = ActorUtil::MakeActor( sPath );
|
||||
if( pActor == NULL )
|
||||
continue;
|
||||
this->AddChild( pActor );
|
||||
|
||||
@@ -99,7 +99,7 @@ void MusicWheel::Load()
|
||||
m_sprHighlight.Load( THEME->GetPathToG("MusicWheel highlight") );
|
||||
m_sprHighlight->SetName( "Highlight" );
|
||||
this->AddChild( m_sprHighlight );
|
||||
UtilOnCommand( m_sprHighlight, "MusicWheel" );
|
||||
ActorUtil::OnCommand( m_sprHighlight, "MusicWheel" );
|
||||
|
||||
m_ScrollBar.SetX( SCROLL_BAR_X );
|
||||
m_ScrollBar.SetBarHeight( SCROLL_BAR_HEIGHT );
|
||||
|
||||
@@ -129,7 +129,7 @@ static NoteResource *MakeNoteResource( const CString &sPath, bool bSpriteOnly )
|
||||
}
|
||||
else
|
||||
{
|
||||
pRes->m_pActor = MakeActor( sPath );
|
||||
pRes->m_pActor = ActorUtil::MakeActor( sPath );
|
||||
ASSERT( pRes->m_pActor );
|
||||
}
|
||||
|
||||
|
||||
@@ -260,7 +260,7 @@ void ScreenNetSelectBase::UpdateUsers()
|
||||
|
||||
void UtilSetQuadInit( Actor& actor, const CString &sClassName )
|
||||
{
|
||||
UtilSetXYAndOnCommand( actor, sClassName );
|
||||
ActorUtil::SetXYAndOnCommand( actor, sClassName );
|
||||
actor.SetDiffuse( THEME->GetMetricC( sClassName, actor.m_sName + "Color" ) );
|
||||
actor.SetWidth( THEME->GetMetricF( sClassName, actor.m_sName + "Width" ) );
|
||||
actor.SetHeight( THEME->GetMetricF( sClassName, actor.m_sName + "Height" ) );
|
||||
|
||||
@@ -127,7 +127,7 @@ void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventTyp
|
||||
GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.Init();
|
||||
GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.FromString( PREFSMAN->m_sDefaultModifiers );
|
||||
|
||||
UtilCommand( m_sprCancelAll[pn], m_sName, "Show" );
|
||||
ActorUtil::Command( m_sprCancelAll[pn], m_sName, "Show" );
|
||||
|
||||
this->ImportOptionsForPlayer( pn );
|
||||
this->PositionUnderlines();
|
||||
|
||||
@@ -126,15 +126,15 @@ void ScreenWithMenuElements::StartTransitioning( ScreenMessage smSendWhenDone )
|
||||
{
|
||||
m_MenuTimer->SetSeconds( 0 );
|
||||
m_MenuTimer->Stop();
|
||||
UtilOffCommand( m_MenuTimer, m_sName );
|
||||
ActorUtil::OffCommand( m_MenuTimer, m_sName );
|
||||
}
|
||||
|
||||
UtilOffCommand( m_autoHeader, m_sName );
|
||||
UtilOffCommand( m_sprStyleIcon, m_sName );
|
||||
ActorUtil::OffCommand( m_autoHeader, m_sName );
|
||||
ActorUtil::OffCommand( m_sprStyleIcon, m_sName );
|
||||
FOREACH_PlayerNumber( p )
|
||||
UtilOffCommand( m_MemoryCardDisplay[p], m_sName );
|
||||
UtilOffCommand( m_autoFooter, m_sName );
|
||||
UtilOffCommand( m_textHelp, m_sName );
|
||||
ActorUtil::OffCommand( m_MemoryCardDisplay[p], m_sName );
|
||||
ActorUtil::OffCommand( m_autoFooter, m_sName );
|
||||
ActorUtil::OffCommand( m_textHelp, m_sName );
|
||||
OFF_COMMAND( m_sprOverlay );
|
||||
|
||||
SCREENMAN->PlaySharedBackgroundOffCommand();
|
||||
|
||||
Reference in New Issue
Block a user