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.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define SCREENPLAYEROPTIONS_H
|
||||
|
||||
#include "ScreenOptionsMaster.h"
|
||||
struct lua_State;
|
||||
|
||||
AutoScreenMessage( SM_BackFromPlayerOptions )
|
||||
|
||||
@@ -15,11 +16,14 @@ public:
|
||||
virtual void DrawPrimitives();
|
||||
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||
bool GetGoToOptions() const { return m_bGoToOptions; }
|
||||
|
||||
//
|
||||
// Lua
|
||||
//
|
||||
virtual void PushSelf( lua_State *L );
|
||||
|
||||
private:
|
||||
void GoToNextScreen();
|
||||
void GoToPrevScreen();
|
||||
|
||||
vector<bool> m_bRowCausesDisqualified[NUM_PLAYERS];
|
||||
void UpdateDisqualified( int row, PlayerNumber pn );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user