bind DifficultyList. Remove it from SSM; do it in XML instead.
This commit is contained in:
@@ -14,9 +14,12 @@
|
||||
#include "Command.h"
|
||||
#include "Foreach.h"
|
||||
#include "SongUtil.h"
|
||||
#include "XmlFile.h"
|
||||
|
||||
#define MAX_METERS NUM_Difficulty + MAX_EDITS_PER_SONG
|
||||
|
||||
REGISTER_ACTOR_CLASS( DifficultyList )
|
||||
|
||||
DifficultyList::DifficultyList()
|
||||
{
|
||||
m_bShown = true;
|
||||
@@ -26,25 +29,24 @@ DifficultyList::~DifficultyList()
|
||||
{
|
||||
}
|
||||
|
||||
void DifficultyList::SetName( const RString &sName )
|
||||
void DifficultyList::LoadFromNode( const RString& sDir, const XNode* pNode )
|
||||
{
|
||||
ActorFrame::SetName( sName );
|
||||
ActorFrame::LoadFromNode( sDir, pNode );
|
||||
|
||||
ITEMS_SPACING_Y.Load( m_sName, "ItemsSpacingY" );
|
||||
NUM_SHOWN_ITEMS.Load( m_sName, "NumShownItems" );
|
||||
CAPITALIZE_DIFFICULTY_NAMES.Load( m_sName, "CapitalizeDifficultyNames" );
|
||||
MOVE_COMMAND.Load( m_sName, "MoveCommand" );
|
||||
}
|
||||
|
||||
void DifficultyList::Load()
|
||||
{
|
||||
m_Lines.resize( MAX_METERS );
|
||||
m_CurSong = NULL;
|
||||
|
||||
FOREACH_HumanPlayer( pn )
|
||||
{
|
||||
m_Cursors[pn].Load( THEME->GetPathG(m_sName,ssprintf("cursor p%i",pn+1)) );
|
||||
m_Cursors[pn]->SetName( ssprintf("CursorP%i",pn+1) );
|
||||
const XNode *pChild = pNode->GetChild( ssprintf("CursorP%i",pn+1) );
|
||||
if( pChild == NULL )
|
||||
RageException::Throw( ssprintf("ComboGraph in \"%s\" is missing the node \"%s\"", sDir.c_str(), ssprintf("CursorP%i",pn+1).c_str()) );
|
||||
m_Cursors[pn].LoadFromNode( sDir, pChild );
|
||||
|
||||
/* Hack: we need to tween cursors both up to down (cursor motion) and visible to
|
||||
* invisible (fading). Cursor motion needs to stoptweening, so multiple motions
|
||||
@@ -52,8 +54,10 @@ void DifficultyList::Load()
|
||||
* resulting in the cursor remaining invisible or partially invisible. So, do them
|
||||
* in separate tweening stacks. This means the Cursor command can't change diffuse
|
||||
* colors; I think we do need a diffuse color stack ... */
|
||||
m_CursorFrames[pn].SetName( ssprintf("CursorP%i",pn+1) );
|
||||
ActorUtil::LoadCommand( m_CursorFrames[pn], m_sName, "Change" );
|
||||
pChild = pNode->GetChild( ssprintf("CursorP%iFrame",pn+1) );
|
||||
if( pChild == NULL )
|
||||
RageException::Throw( ssprintf("ComboGraph in \"%s\" is missing the node \"%s\"", sDir.c_str(), ssprintf("CursorP%iFrame",pn+1).c_str()) );
|
||||
m_CursorFrames[pn].LoadFromNode( sDir, pChild );
|
||||
m_CursorFrames[pn].AddChild( m_Cursors[pn] );
|
||||
this->AddChild( &m_CursorFrames[pn] );
|
||||
}
|
||||
@@ -239,7 +243,7 @@ void DifficultyList::PositionItems()
|
||||
|
||||
void DifficultyList::SetFromGameState()
|
||||
{
|
||||
Song *pSong = GAMESTATE->m_pCurSong;
|
||||
const Song *pSong = GAMESTATE->m_pCurSong;
|
||||
|
||||
const bool bSongChanged = (pSong != m_CurSong);
|
||||
|
||||
@@ -369,6 +373,27 @@ void DifficultyList::Hide()
|
||||
COMMAND( m_Cursors[pn], "Hide" );
|
||||
}
|
||||
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
class LunaDifficultyList: public Luna<DifficultyList>
|
||||
{
|
||||
public:
|
||||
LunaDifficultyList() { LUA->Register( Register ); }
|
||||
|
||||
static int setfromgamestate( T* p, lua_State *L ) { p->SetFromGameState(); return 0; }
|
||||
|
||||
static void Register(lua_State *L)
|
||||
{
|
||||
ADD_METHOD( setfromgamestate );
|
||||
|
||||
Luna<T>::Register( L );
|
||||
}
|
||||
};
|
||||
|
||||
LUA_REGISTER_DERIVED_CLASS( DifficultyList, ActorFrame )
|
||||
// lua end
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Glenn Maynard
|
||||
* All rights reserved.
|
||||
|
||||
@@ -16,15 +16,18 @@ class DifficultyList: public ActorFrame
|
||||
public:
|
||||
DifficultyList();
|
||||
virtual ~DifficultyList();
|
||||
virtual void SetName( const RString &sName );
|
||||
virtual Actor *Copy() const;
|
||||
virtual void LoadFromNode( const RString& sDir, const XNode* pNode );
|
||||
|
||||
void Load();
|
||||
void SetFromGameState();
|
||||
void TweenOnScreen();
|
||||
void TweenOffScreen();
|
||||
void Hide();
|
||||
void Show();
|
||||
|
||||
// Lua
|
||||
void PushSelf( lua_State *L );
|
||||
|
||||
private:
|
||||
void UpdatePositions();
|
||||
void PositionItems();
|
||||
@@ -45,7 +48,7 @@ private:
|
||||
};
|
||||
vector<Line> m_Lines;
|
||||
|
||||
Song *m_CurSong;
|
||||
const Song *m_CurSong;
|
||||
bool m_bShown;
|
||||
|
||||
struct Row
|
||||
|
||||
@@ -70,7 +70,6 @@ void ScreenSelectMusic::Init()
|
||||
SAMPLE_MUSIC_DELAY.Load( m_sName, "SampleMusicDelay" );
|
||||
SHOW_RADAR.Load( m_sName, "ShowRadar" );
|
||||
SHOW_PANES.Load( m_sName, "ShowPanes" );
|
||||
SHOW_DIFFICULTY_LIST.Load( m_sName, "ShowDifficultyList" );
|
||||
SHOW_COURSE_CONTENTS.Load( m_sName, "ShowCourseContents" );
|
||||
DO_ROULETTE_ON_MENU_TIMER.Load( m_sName, "DoRouletteOnMenuTimer" );
|
||||
ALIGN_MUSIC_BEATS.Load( m_sName, "AlignMusicBeat" );
|
||||
@@ -120,14 +119,13 @@ void ScreenSelectMusic::Init()
|
||||
/* Load low-res banners, if needed. */
|
||||
BANNERCACHE->Demand();
|
||||
|
||||
m_MusicWheel.Load( MUSIC_WHEEL_TYPE );
|
||||
|
||||
m_MusicWheelUnder.Load( THEME->GetPathG(m_sName,"wheel under") );
|
||||
m_MusicWheelUnder->SetName( "WheelUnder" );
|
||||
SET_XY( m_MusicWheelUnder );
|
||||
this->AddChild( m_MusicWheelUnder );
|
||||
|
||||
m_MusicWheel.SetName( "MusicWheel" );
|
||||
m_MusicWheel.Load( MUSIC_WHEEL_TYPE );
|
||||
SET_XY( m_MusicWheel );
|
||||
this->AddChild( &m_MusicWheel );
|
||||
|
||||
@@ -197,14 +195,6 @@ void ScreenSelectMusic::Init()
|
||||
SET_XY( m_MachineRank );
|
||||
this->AddChild( &m_MachineRank );
|
||||
|
||||
if( SHOW_DIFFICULTY_LIST )
|
||||
{
|
||||
m_DifficultyList.SetName( "DifficultyList" );
|
||||
m_DifficultyList.Load();
|
||||
SET_XY( m_DifficultyList );
|
||||
this->AddChild( &m_DifficultyList );
|
||||
}
|
||||
|
||||
if( SHOW_COURSE_CONTENTS )
|
||||
{
|
||||
m_CourseContents.SetName( "CourseContents" );
|
||||
@@ -332,9 +322,6 @@ void ScreenSelectMusic::BeginScreen()
|
||||
ON_COMMAND( m_DifficultyMeter[p] );
|
||||
}
|
||||
|
||||
if( SHOW_DIFFICULTY_LIST )
|
||||
ON_COMMAND( m_DifficultyList );
|
||||
|
||||
TweenSongPartsOnScreen( true );
|
||||
TweenCoursePartsOnScreen( true );
|
||||
|
||||
@@ -394,13 +381,6 @@ void ScreenSelectMusic::TweenSongPartsOnScreen( bool Initial )
|
||||
{
|
||||
m_GrooveRadar.StopTweening();
|
||||
m_GrooveRadar.TweenOnScreen();
|
||||
if( SHOW_DIFFICULTY_LIST )
|
||||
{
|
||||
if( Initial )
|
||||
m_DifficultyList.TweenOnScreen();
|
||||
// else // do this after SM_SortOrderChanged
|
||||
// m_DifficultyList.Show();
|
||||
}
|
||||
|
||||
{
|
||||
FOREACH_HumanPlayer( p )
|
||||
@@ -416,16 +396,6 @@ void ScreenSelectMusic::TweenSongPartsOnScreen( bool Initial )
|
||||
void ScreenSelectMusic::TweenSongPartsOffScreen( bool Final )
|
||||
{
|
||||
m_GrooveRadar.TweenOffScreen();
|
||||
if( SHOW_DIFFICULTY_LIST )
|
||||
{
|
||||
if( Final )
|
||||
{
|
||||
OFF_COMMAND( m_DifficultyList );
|
||||
m_DifficultyList.TweenOffScreen();
|
||||
}
|
||||
else
|
||||
m_DifficultyList.Hide();
|
||||
}
|
||||
|
||||
{
|
||||
FOREACH_HumanPlayer( p )
|
||||
@@ -469,8 +439,6 @@ void ScreenSelectMusic::TweenCoursePartsOffScreen( bool Final )
|
||||
void ScreenSelectMusic::SkipSongPartTweens()
|
||||
{
|
||||
m_GrooveRadar.FinishTweening();
|
||||
if( SHOW_DIFFICULTY_LIST )
|
||||
m_DifficultyList.FinishTweening();
|
||||
|
||||
FOREACH_HumanPlayer( p )
|
||||
{
|
||||
@@ -1301,9 +1269,6 @@ void ScreenSelectMusic::AfterStepsChange( const vector<PlayerNumber> &vpns )
|
||||
if( SHOW_PANES )
|
||||
m_PaneDisplay[pn].SetFromGameState( GAMESTATE->m_SortOrder );
|
||||
}
|
||||
|
||||
if( SHOW_DIFFICULTY_LIST )
|
||||
m_DifficultyList.SetFromGameState();
|
||||
}
|
||||
|
||||
void ScreenSelectMusic::AfterTrailChange( const vector<PlayerNumber> &vpns )
|
||||
@@ -1355,9 +1320,6 @@ void ScreenSelectMusic::AfterTrailChange( const vector<PlayerNumber> &vpns )
|
||||
if( SHOW_PANES )
|
||||
m_PaneDisplay[pn].SetFromGameState( GAMESTATE->m_SortOrder );
|
||||
}
|
||||
|
||||
if( SHOW_DIFFICULTY_LIST )
|
||||
m_DifficultyList.SetFromGameState();
|
||||
}
|
||||
|
||||
void ScreenSelectMusic::SwitchToPreferredDifficulty()
|
||||
@@ -1818,8 +1780,6 @@ void ScreenSelectMusic::SortOrderChanged()
|
||||
// do nothing
|
||||
break;
|
||||
default:
|
||||
if( SHOW_DIFFICULTY_LIST )
|
||||
m_DifficultyList.Show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "DifficultyIcon.h"
|
||||
#include "DifficultyMeter.h"
|
||||
#include "DifficultyDisplay.h"
|
||||
#include "DifficultyList.h"
|
||||
#include "CourseContentsList.h"
|
||||
#include "HelpDisplay.h"
|
||||
#include "PaneDisplay.h"
|
||||
@@ -82,7 +81,6 @@ protected:
|
||||
ThemeMetric<float> SAMPLE_MUSIC_DELAY;
|
||||
ThemeMetric<bool> SHOW_RADAR;
|
||||
ThemeMetric<bool> SHOW_PANES;
|
||||
ThemeMetric<bool> SHOW_DIFFICULTY_LIST;
|
||||
ThemeMetric<bool> SHOW_COURSE_CONTENTS;
|
||||
ThemeMetric<bool> DO_ROULETTE_ON_MENU_TIMER;
|
||||
ThemeMetric<bool> ALIGN_MUSIC_BEATS;
|
||||
@@ -120,7 +118,6 @@ protected:
|
||||
AutoActor m_sprMarathonBalloon;
|
||||
AutoActor m_sprCourseHasMods;
|
||||
DifficultyDisplay m_DifficultyDisplay;
|
||||
DifficultyList m_DifficultyList;
|
||||
CourseContentsList m_CourseContents;
|
||||
HelpDisplay m_Artist;
|
||||
BitmapText m_MachineRank;
|
||||
|
||||
Reference in New Issue
Block a user