De-Python-ize REGISTER_ACTOR_CLASS(*).

This commit is contained in:
Jason Felds
2011-02-18 23:55:41 -05:00
parent 020e3a70fe
commit 1bed6d3630
37 changed files with 51 additions and 44 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ public:
HiddenActor() { SetVisible(false); } HiddenActor() { SetVisible(false); }
virtual HiddenActor *Copy() const; virtual HiddenActor *Copy() const;
}; };
REGISTER_ACTOR_CLASS_WITH_NAME( HiddenActor, Actor ) REGISTER_ACTOR_CLASS_WITH_NAME( HiddenActor, Actor );
float Actor::g_fCurrentBGMTime = 0, Actor::g_fCurrentBGMBeat; float Actor::g_fCurrentBGMTime = 0, Actor::g_fCurrentBGMBeat;
float Actor::g_fCurrentBGMTimeNoOffset = 0, Actor::g_fCurrentBGMBeatNoOffset = 0; float Actor::g_fCurrentBGMTimeNoOffset = 0, Actor::g_fCurrentBGMBeatNoOffset = 0;
+2 -2
View File
@@ -16,8 +16,8 @@
* children. The name "ActorFrame" is widely used in Lua, so we'll have * children. The name "ActorFrame" is widely used in Lua, so we'll have
* that string instead create an ActorFrameAutoDeleteChildren object. * that string instead create an ActorFrameAutoDeleteChildren object.
*/ */
//REGISTER_ACTOR_CLASS( ActorFrame ) //REGISTER_ACTOR_CLASS( ActorFrame );
REGISTER_ACTOR_CLASS_WITH_NAME( ActorFrameAutoDeleteChildren, ActorFrame ) REGISTER_ACTOR_CLASS_WITH_NAME( ActorFrameAutoDeleteChildren, ActorFrame );
ActorFrame *ActorFrame::Copy() const { return new ActorFrame(*this); } ActorFrame *ActorFrame::Copy() const { return new ActorFrame(*this); }
+1 -1
View File
@@ -4,7 +4,7 @@
#include "RageTextureManager.h" #include "RageTextureManager.h"
#include "ActorUtil.h" #include "ActorUtil.h"
REGISTER_ACTOR_CLASS_WITH_NAME( ActorFrameTextureAutoDeleteChildren, ActorFrameTexture ) REGISTER_ACTOR_CLASS_WITH_NAME( ActorFrameTextureAutoDeleteChildren, ActorFrameTexture );
ActorFrameTexture *ActorFrameTexture::Copy() const { return new ActorFrameTexture(*this); } ActorFrameTexture *ActorFrameTexture::Copy() const { return new ActorFrameTexture(*this); }
ActorFrameTexture::ActorFrameTexture() ActorFrameTexture::ActorFrameTexture()
+1 -1
View File
@@ -13,7 +13,7 @@
#include "LuaBinding.h" #include "LuaBinding.h"
#include "LuaManager.h" #include "LuaManager.h"
REGISTER_ACTOR_CLASS( ActorMultiTexture ) REGISTER_ACTOR_CLASS( ActorMultiTexture );
ActorMultiTexture::ActorMultiTexture() ActorMultiTexture::ActorMultiTexture()
+1 -1
View File
@@ -2,7 +2,7 @@
#include "ActorProxy.h" #include "ActorProxy.h"
#include "ActorUtil.h" #include "ActorUtil.h"
REGISTER_ACTOR_CLASS( ActorProxy ) REGISTER_ACTOR_CLASS( ActorProxy );
ActorProxy::ActorProxy() ActorProxy::ActorProxy()
{ {
+2 -2
View File
@@ -12,8 +12,8 @@
* We don't want classes that derive from ActorFrame to auto delete their * We don't want classes that derive from ActorFrame to auto delete their
* children. The name "ActorFrame" is widely used in Lua, so we'll have * children. The name "ActorFrame" is widely used in Lua, so we'll have
* that string instead create an ActorFrameAutoDeleteChildren object. */ * that string instead create an ActorFrameAutoDeleteChildren object. */
//REGISTER_ACTOR_CLASS( ActorScroller ) //REGISTER_ACTOR_CLASS( ActorScroller );
REGISTER_ACTOR_CLASS_WITH_NAME( ActorScrollerAutoDeleteChildren, ActorScroller ) REGISTER_ACTOR_CLASS_WITH_NAME( ActorScrollerAutoDeleteChildren, ActorScroller );
ActorScroller *ActorScroller::Copy() const { return new ActorScroller(*this); } ActorScroller *ActorScroller::Copy() const { return new ActorScroller(*this); }
+1 -1
View File
@@ -5,7 +5,7 @@
#include "XmlFile.h" #include "XmlFile.h"
#include "RageUtil.h" #include "RageUtil.h"
REGISTER_ACTOR_CLASS_WITH_NAME( ActorSound, Sound ) REGISTER_ACTOR_CLASS_WITH_NAME( ActorSound, Sound );
void ActorSound::Load( const RString &sPath ) void ActorSound::Load( const RString &sPath )
{ {
+10 -3
View File
@@ -13,14 +13,21 @@ typedef Actor* (*CreateActorFn)();
template<typename T> template<typename T>
Actor *CreateActor() { return new T; } Actor *CreateActor() { return new T; }
// Each Actor class should have a REGISTER_ACTOR_CLASS in its CPP file. /**
* @brief Register the requested Actor with the specified external name.
*
* This should be called manually only if needed. */
#define REGISTER_ACTOR_CLASS_WITH_NAME( className, externalClassName ) \ #define REGISTER_ACTOR_CLASS_WITH_NAME( className, externalClassName ) \
struct Register##className { \ struct Register##className { \
Register##className() { ActorUtil::Register(#externalClassName, CreateActor<className>); } \ Register##className() { ActorUtil::Register(#externalClassName, CreateActor<className>); } \
}; \ }; \
static Register##className register##className; \ className *className::Copy() const { return new className(*this); } \
className *className::Copy() const { return new className(*this); } static Register##className register##className
/**
* @brief Register the requested Actor so that it's more accessible.
*
* Each Actor class should have a REGISTER_ACTOR_CLASS in its CPP file. */
#define REGISTER_ACTOR_CLASS( className ) REGISTER_ACTOR_CLASS_WITH_NAME( className, className ) #define REGISTER_ACTOR_CLASS( className ) REGISTER_ACTOR_CLASS_WITH_NAME( className, className )
enum FileType enum FileType
+1 -1
View File
@@ -7,7 +7,7 @@
#include "Foreach.h" #include "Foreach.h"
#include "LuaManager.h" #include "LuaManager.h"
REGISTER_ACTOR_CLASS(BGAnimation) REGISTER_ACTOR_CLASS(BGAnimation);
BGAnimation::BGAnimation() BGAnimation::BGAnimation()
{ {
+2 -2
View File
@@ -12,7 +12,7 @@
#include <limits.h> #include <limits.h>
REGISTER_ACTOR_CLASS( BPMDisplay ) REGISTER_ACTOR_CLASS( BPMDisplay );
BPMDisplay::BPMDisplay() BPMDisplay::BPMDisplay()
{ {
@@ -286,7 +286,7 @@ void SongBPMDisplay::Update( float fDeltaTime )
BPMDisplay::Update( fDeltaTime ); BPMDisplay::Update( fDeltaTime );
} }
REGISTER_ACTOR_CLASS( SongBPMDisplay ) REGISTER_ACTOR_CLASS( SongBPMDisplay );
#include "LuaBinding.h" #include "LuaBinding.h"
/** @brief Allow Lua to have access to the BPMDisplay. */ /** @brief Allow Lua to have access to the BPMDisplay. */
+1 -1
View File
@@ -13,7 +13,7 @@
#include "UnlockManager.h" #include "UnlockManager.h"
#include "PrefsManager.h" #include "PrefsManager.h"
REGISTER_ACTOR_CLASS( Banner ) REGISTER_ACTOR_CLASS( Banner );
ThemeMetric<bool> SCROLL_RANDOM ("Banner","ScrollRandom"); ThemeMetric<bool> SCROLL_RANDOM ("Banner","ScrollRandom");
ThemeMetric<bool> SCROLL_ROULETTE ("Banner","ScrollRoulette"); ThemeMetric<bool> SCROLL_ROULETTE ("Banner","ScrollRoulette");
+1 -1
View File
@@ -11,7 +11,7 @@
#include "LuaBinding.h" #include "LuaBinding.h"
#include "Foreach.h" #include "Foreach.h"
REGISTER_ACTOR_CLASS( BitmapText ) REGISTER_ACTOR_CLASS( BitmapText );
/* XXX: Changing a whole array of diffuse colors every frame (several times) is /* XXX: Changing a whole array of diffuse colors every frame (several times) is
* a waste, when we're usually setting them all to the same value. Rainbow and * a waste, when we're usually setting them all to the same value. Rainbow and
+1 -1
View File
@@ -8,7 +8,7 @@
const int MinComboSizeToShow = 5; const int MinComboSizeToShow = 5;
REGISTER_ACTOR_CLASS( ComboGraph ) REGISTER_ACTOR_CLASS( ComboGraph );
ComboGraph::ComboGraph() ComboGraph::ComboGraph()
{ {
+1 -1
View File
@@ -27,7 +27,7 @@ static const GameButton ControllerStateButtonToGameButton[] = {
PUMP_BUTTON_DOWNRIGHT, PUMP_BUTTON_DOWNRIGHT,
}; };
REGISTER_ACTOR_CLASS( ControllerStateDisplay ) REGISTER_ACTOR_CLASS( ControllerStateDisplay );
ControllerStateDisplay::ControllerStateDisplay() ControllerStateDisplay::ControllerStateDisplay()
{ {
+1 -1
View File
@@ -10,7 +10,7 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "Steps.h" #include "Steps.h"
REGISTER_ACTOR_CLASS( CourseContentsList ) REGISTER_ACTOR_CLASS( CourseContentsList );
CourseContentsList::~CourseContentsList() CourseContentsList::~CourseContentsList()
{ {
+1 -1
View File
@@ -12,7 +12,7 @@
#include "XmlFile.h" #include "XmlFile.h"
#include "LuaManager.h" #include "LuaManager.h"
REGISTER_ACTOR_CLASS(DifficultyIcon) REGISTER_ACTOR_CLASS(DifficultyIcon);
DifficultyIcon::DifficultyIcon() DifficultyIcon::DifficultyIcon()
{ {
+1 -1
View File
@@ -24,7 +24,7 @@
// "magic" 6. -aj // "magic" 6. -aj
#define MAX_METERS (NUM_Difficulty * 6) + MAX_EDITS_PER_SONG #define MAX_METERS (NUM_Difficulty * 6) + MAX_EDITS_PER_SONG
REGISTER_ACTOR_CLASS( StepsDisplayList ) REGISTER_ACTOR_CLASS( StepsDisplayList );
StepsDisplayList::StepsDisplayList() StepsDisplayList::StepsDisplayList()
{ {
+1 -1
View File
@@ -126,7 +126,7 @@ void DynamicActorScroller::ConfigureActor( Actor *pActor, int iItem )
LUA->Release(L); LUA->Release(L);
} }
REGISTER_ACTOR_CLASS_WITH_NAME( DynamicActorScrollerAutoDeleteChildren, DynamicActorScroller ) REGISTER_ACTOR_CLASS_WITH_NAME( DynamicActorScrollerAutoDeleteChildren, DynamicActorScroller );
/* /*
* (c) 2005 Glenn Maynard * (c) 2005 Glenn Maynard
+1 -1
View File
@@ -11,7 +11,7 @@
#include "ThemeMetric.h" #include "ThemeMetric.h"
#include "ActorUtil.h" #include "ActorUtil.h"
REGISTER_ACTOR_CLASS( FadingBanner ) REGISTER_ACTOR_CLASS( FadingBanner );
/* Allow fading from one banner to another. We can handle two fades at once; /* Allow fading from one banner to another. We can handle two fades at once;
* this is used to fade from an old banner to a low-quality banner to a high- * this is used to fade from an old banner to a low-quality banner to a high-
+1 -1
View File
@@ -6,7 +6,7 @@
#include "ActorUtil.h" #include "ActorUtil.h"
#include "ThemeManager.h" #include "ThemeManager.h"
REGISTER_ACTOR_CLASS( GradeDisplay ) REGISTER_ACTOR_CLASS( GradeDisplay );
void GradeDisplay::Load( RString sMetricsGroup ) void GradeDisplay::Load( RString sMetricsGroup )
{ {
+2 -2
View File
@@ -13,7 +13,7 @@
#include "XmlFile.h" #include "XmlFile.h"
//#define DIVIDE_LINE_WIDTH THEME->GetMetricI(m_sName,"TexturedBottomHalf") //#define DIVIDE_LINE_WIDTH THEME->GetMetricI(m_sName,"TexturedBottomHalf")
REGISTER_ACTOR_CLASS( GraphDisplay ) REGISTER_ACTOR_CLASS( GraphDisplay );
enum { VALUE_RESOLUTION=100 }; enum { VALUE_RESOLUTION=100 };
@@ -108,7 +108,7 @@ private:
vector<RageSpriteVertex> m_Quads; vector<RageSpriteVertex> m_Quads;
vector<RageSpriteVertex> m_pCircles; vector<RageSpriteVertex> m_pCircles;
}; };
REGISTER_ACTOR_CLASS( GraphLine ) REGISTER_ACTOR_CLASS( GraphLine );
class GraphBody: public Actor class GraphBody: public Actor
{ {
+1 -1
View File
@@ -11,7 +11,7 @@
#include "CommonMetrics.h" #include "CommonMetrics.h"
#include "ActorUtil.h" #include "ActorUtil.h"
REGISTER_ACTOR_CLASS(GrooveRadar) REGISTER_ACTOR_CLASS(GrooveRadar);
#define LABEL_OFFSET_X( i ) THEME->GetMetricF("GrooveRadar",ssprintf("Label%dOffsetX",i+1)) #define LABEL_OFFSET_X( i ) THEME->GetMetricF("GrooveRadar",ssprintf("Label%dOffsetX",i+1))
#define LABEL_OFFSET_Y( i ) THEME->GetMetricF("GrooveRadar",ssprintf("Label%dOffsetY",i+1)) #define LABEL_OFFSET_Y( i ) THEME->GetMetricF("GrooveRadar",ssprintf("Label%dOffsetY",i+1))
+1 -1
View File
@@ -5,7 +5,7 @@
#include "ThemeManager.h" #include "ThemeManager.h"
#include "ActorUtil.h" #include "ActorUtil.h"
REGISTER_ACTOR_CLASS( HelpDisplay ) REGISTER_ACTOR_CLASS( HelpDisplay );
HelpDisplay::HelpDisplay() HelpDisplay::HelpDisplay()
{ {
+1 -1
View File
@@ -7,7 +7,7 @@
#include "ActorUtil.h" #include "ActorUtil.h"
#include "XmlFile.h" #include "XmlFile.h"
REGISTER_ACTOR_CLASS( HoldJudgment ) REGISTER_ACTOR_CLASS( HoldJudgment );
HoldJudgment::HoldJudgment() HoldJudgment::HoldJudgment()
{ {
+1 -1
View File
@@ -6,7 +6,7 @@
#include "XmlFile.h" #include "XmlFile.h"
#include "ActorUtil.h" #include "ActorUtil.h"
REGISTER_ACTOR_CLASS( MemoryCardDisplay ) REGISTER_ACTOR_CLASS( MemoryCardDisplay );
MemoryCardDisplay::MemoryCardDisplay() MemoryCardDisplay::MemoryCardDisplay()
{ {
+2 -2
View File
@@ -8,8 +8,8 @@
#include "RageLog.h" #include "RageLog.h"
#include "LuaManager.h" #include "LuaManager.h"
REGISTER_ACTOR_CLASS(MeterDisplay) REGISTER_ACTOR_CLASS(MeterDisplay);
REGISTER_ACTOR_CLASS(SongMeterDisplay) REGISTER_ACTOR_CLASS(SongMeterDisplay);
MeterDisplay::MeterDisplay() MeterDisplay::MeterDisplay()
{ {
+1 -1
View File
@@ -10,7 +10,7 @@
#include "LuaManager.h" #include "LuaManager.h"
#include "Foreach.h" #include "Foreach.h"
REGISTER_ACTOR_CLASS( ModIconRow ) REGISTER_ACTOR_CLASS( ModIconRow );
ModIconRow::ModIconRow() ModIconRow::ModIconRow()
{ {
+1 -1
View File
@@ -14,7 +14,7 @@
#include "LuaBinding.h" #include "LuaBinding.h"
#include "PrefsManager.h" #include "PrefsManager.h"
REGISTER_ACTOR_CLASS( Model ) REGISTER_ACTOR_CLASS( Model );
static const float FRAMES_PER_SECOND = 30; static const float FRAMES_PER_SECOND = 30;
static const RString DEFAULT_ANIMATION_NAME = "default"; static const RString DEFAULT_ANIMATION_NAME = "default";
+1 -1
View File
@@ -55,7 +55,7 @@ static const Content_t g_Contents[NUM_PaneCategory] =
{ NEED_NOTES|NEED_PROFILE, "score" }, // ProfileHighScore { NEED_NOTES|NEED_PROFILE, "score" }, // ProfileHighScore
}; };
REGISTER_ACTOR_CLASS( PaneDisplay ) REGISTER_ACTOR_CLASS( PaneDisplay );
void PaneDisplay::Load( const RString &sMetricsGroup, PlayerNumber pn ) void PaneDisplay::Load( const RString &sMetricsGroup, PlayerNumber pn )
{ {
+1 -1
View File
@@ -12,7 +12,7 @@
#include "Course.h" #include "Course.h"
REGISTER_ACTOR_CLASS( PercentageDisplay ) REGISTER_ACTOR_CLASS( PercentageDisplay );
PercentageDisplay::PercentageDisplay() PercentageDisplay::PercentageDisplay()
{ {
+1 -1
View File
@@ -3,7 +3,7 @@
#include "ActorUtil.h" #include "ActorUtil.h"
#include "RageTextureManager.h" #include "RageTextureManager.h"
REGISTER_ACTOR_CLASS( Quad ) REGISTER_ACTOR_CLASS( Quad );
Quad::Quad() Quad::Quad()
{ {
+1 -1
View File
@@ -5,7 +5,7 @@
#include "ActorUtil.h" #include "ActorUtil.h"
#include "LuaManager.h" #include "LuaManager.h"
#include "ThemeManager.h" #include "ThemeManager.h"
REGISTER_ACTOR_CLASS( RollingNumbers ) REGISTER_ACTOR_CLASS( RollingNumbers );
RollingNumbers::RollingNumbers() RollingNumbers::RollingNumbers()
{ {
+1 -1
View File
@@ -9,7 +9,7 @@
#include "LuaManager.h" #include "LuaManager.h"
#include "RageLog.h" #include "RageLog.h"
REGISTER_ACTOR_CLASS( ScoreDisplayAliveTime ) REGISTER_ACTOR_CLASS( ScoreDisplayAliveTime );
ScoreDisplayAliveTime::ScoreDisplayAliveTime() ScoreDisplayAliveTime::ScoreDisplayAliveTime()
+1 -1
View File
@@ -10,7 +10,7 @@
#include "StatsManager.h" #include "StatsManager.h"
#include "LuaManager.h" #include "LuaManager.h"
REGISTER_ACTOR_CLASS( ScoreDisplayCalories ) REGISTER_ACTOR_CLASS( ScoreDisplayCalories );
ScoreDisplayCalories::ScoreDisplayCalories() ScoreDisplayCalories::ScoreDisplayCalories()
{ {
+1 -1
View File
@@ -14,7 +14,7 @@
#include "LuaBinding.h" #include "LuaBinding.h"
#include "LuaManager.h" #include "LuaManager.h"
REGISTER_ACTOR_CLASS( Sprite ) REGISTER_ACTOR_CLASS( Sprite );
Sprite::Sprite() Sprite::Sprite()
+1 -1
View File
@@ -5,7 +5,7 @@
#include "ThemeManager.h" #include "ThemeManager.h"
#include "XmlFile.h" #include "XmlFile.h"
REGISTER_ACTOR_CLASS( TextBanner ) REGISTER_ACTOR_CLASS( TextBanner );
void TextBanner::LoadFromNode( const XNode* pNode ) void TextBanner::LoadFromNode( const XNode* pNode )
{ {
+1 -1
View File
@@ -14,7 +14,7 @@
const int MAX_METERS_TO_SHOW = 50; const int MAX_METERS_TO_SHOW = 50;
REGISTER_ACTOR_CLASS( WorkoutGraph ) REGISTER_ACTOR_CLASS( WorkoutGraph );
WorkoutGraph::WorkoutGraph() WorkoutGraph::WorkoutGraph()
{ {