instead of a hard-coded special case, bind the screen to Lua and move the
special case there. this reduces cross-dependencies between screens, which should be kept to a minimum
This commit is contained in:
@@ -14,9 +14,6 @@
|
||||
#include "PlayerState.h"
|
||||
#include "Foreach.h"
|
||||
|
||||
#define PREV_SCREEN THEME->GetMetric ("ScreenPlayerOptions","PrevScreen")
|
||||
#define NEXT_SCREEN THEME->GetMetric ("ScreenPlayerOptions","NextScreen")
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenPlayerOptions );
|
||||
ScreenPlayerOptions::ScreenPlayerOptions( CString sClassName ) :
|
||||
ScreenOptionsMaster( sClassName )
|
||||
@@ -73,36 +70,6 @@ void ScreenPlayerOptions::Init()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ScreenPlayerOptions::GoToPrevScreen()
|
||||
{
|
||||
if( SCREENMAN->IsStackedScreen(this) )
|
||||
{
|
||||
SCREENMAN->PopTopScreen( SM_BackFromPlayerOptions );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCREENMAN->DeletePreparedScreens();
|
||||
SCREENMAN->SetNewScreen( PREV_SCREEN );
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenPlayerOptions::GoToNextScreen()
|
||||
{
|
||||
if( SCREENMAN->IsStackedScreen(this) )
|
||||
{
|
||||
SCREENMAN->PopTopScreen( SM_BackFromPlayerOptions );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_bGoToOptions )
|
||||
SCREENMAN->SetNewScreen( NEXT_SCREEN );
|
||||
else
|
||||
SCREENMAN->SetNewScreen( ScreenSongOptions::GetNextScreen() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ScreenPlayerOptions::Update( float fDelta )
|
||||
{
|
||||
ScreenOptionsMaster::Update( fDelta );
|
||||
@@ -227,6 +194,25 @@ void ScreenPlayerOptions::UpdateDisqualified( int row, PlayerNumber pn )
|
||||
GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions = poOrig;
|
||||
}
|
||||
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
class LunaScreenPlayerOptions: public Luna<ScreenPlayerOptions>
|
||||
{
|
||||
public:
|
||||
LunaScreenPlayerOptions() { LUA->Register( Register ); }
|
||||
|
||||
static int GetGoToOptions( T* p, lua_State *L ) { lua_pushboolean( L, p->GetGoToOptions() ); return 1; }
|
||||
static void Register( Lua *L )
|
||||
{
|
||||
ADD_METHOD( GetGoToOptions )
|
||||
Luna<T>::Register( L );
|
||||
}
|
||||
};
|
||||
|
||||
LUA_REGISTER_DERIVED_CLASS( ScreenPlayerOptions, ActorFrame )
|
||||
// lua end
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
|
||||
Reference in New Issue
Block a user