turns out these bindings don't work so well.

This commit is contained in:
AJ Kelly
2010-12-21 23:04:59 -06:00
parent d282db4b7c
commit 069bd6cca2
3 changed files with 25 additions and 37 deletions
-2
View File
@@ -17,8 +17,6 @@ sm-ssc v1.2 | 201012xx
-------- --------
* SM5SVN r28586: Only unload fonts if not used by the next screen. [shakesoda] * SM5SVN r28586: Only unload fonts if not used by the next screen. [shakesoda]
* [ScreenSelectMaster] Fix DoSwitchAnyways to actually work again. * [ScreenSelectMaster] Fix DoSwitchAnyways to actually work again.
* [Screen] Added SetNextScreenName(string) and SetPrevScreenName(string)
Lua bindings. [freem]
* [ScreenInstallOverlay] Installs won't jump to SelMusic on Gameplay or System * [ScreenInstallOverlay] Installs won't jump to SelMusic on Gameplay or System
Menus (e.g. Edit Mode) anymore on download completion. [freem] Menus (e.g. Edit Mode) anymore on download completion. [freem]
+13 -21
View File
@@ -84,7 +84,6 @@ void Screen::BeginScreen()
/* Screens set these when they determine their next screen dynamically. Reset them /* Screens set these when they determine their next screen dynamically. Reset them
* here, so a reused screen doesn't inherit these from the last time it was used. */ * here, so a reused screen doesn't inherit these from the last time it was used. */
m_sNextScreen = RString(); m_sNextScreen = RString();
m_sPrevScreen = RString();
m_fLockInputSecs = 0; m_fLockInputSecs = 0;
@@ -108,33 +107,28 @@ void Screen::Update( float fDeltaTime )
m_fLockInputSecs = max( 0, m_fLockInputSecs-fDeltaTime ); m_fLockInputSecs = max( 0, m_fLockInputSecs-fDeltaTime );
/* /* We need to ensure two things:
* We need to ensure two things:
* 1. Messages must be sent in the order of delay. If two messages are sent * 1. Messages must be sent in the order of delay. If two messages are sent
* simultaneously, one with a .001 delay and another with a .002 delay, the * simultaneously, one with a .001 delay and another with a .002 delay,
* .001 delay message must be sent first. * the .001 delay message must be sent first.
* 2. Messages to be delivered simultaneously must be sent in the order queued. * 2. Messages to be delivered simultaneously must be sent in the order queued.
* *
* Sort by time to ensure #1; use a stable sort to ensure #2. * Sort by time to ensure #1; use a stable sort to ensure #2. */
*/
stable_sort(m_QueuedMessages.begin(), m_QueuedMessages.end(), SortMessagesByDelayRemaining); stable_sort(m_QueuedMessages.begin(), m_QueuedMessages.end(), SortMessagesByDelayRemaining);
/* Update the times of queued ScreenMessages. */ // Update the times of queued ScreenMessages.
for( unsigned i=0; i<m_QueuedMessages.size(); i++ ) for( unsigned i=0; i<m_QueuedMessages.size(); i++ )
{ {
/* Hack: /* Hack:
*
* If we simply subtract time and then send messages, we have a problem. * If we simply subtract time and then send messages, we have a problem.
* Messages are queued to arrive at specific times, and those times line * Messages are queued to arrive at specific times, and those times line
* up with things like tweens finishing. If we send the message at the * up with things like tweens finishing. If we send the message at the
* exact time given, then it'll be on the same cycle that would be rendering * exact time given, then it'll be on the same cycle that would be rendering
* the last frame of a tween (such as an object going off the screen). However, * the last frame of a tween (such as an object going off the screen).
* when we send the message, we're likely to set up a new screen, which * However, when we send the message, we're likely to set up a new screen,
* causes everything to stop in place; this results in actors occasionally * which causes everything to stop in place; this results in actors
* not quite finishing their tweens. * occasionally not quite finishing their tweens.
* * Let's delay all messages that have a non-zero time an extra frame. */
* Let's delay all messages that have a non-zero time an extra frame.
*/
if( m_QueuedMessages[i].fDelayRemaining > 0.0001f ) if( m_QueuedMessages[i].fDelayRemaining > 0.0001f )
{ {
m_QueuedMessages[i].fDelayRemaining -= fDeltaTime; m_QueuedMessages[i].fDelayRemaining -= fDeltaTime;
@@ -155,7 +149,7 @@ void Screen::Update( float fDeltaTime )
if( m_QueuedMessages[i].fDelayRemaining > 0.0f ) if( m_QueuedMessages[i].fDelayRemaining > 0.0f )
continue; /* not yet */ continue; /* not yet */
/* Remove the message from the list. */ // Remove the message from the list.
const ScreenMessage SM = m_QueuedMessages[i].SM; const ScreenMessage SM = m_QueuedMessages[i].SM;
m_QueuedMessages.erase( m_QueuedMessages.begin()+i ); m_QueuedMessages.erase( m_QueuedMessages.begin()+i );
i--; i--;
@@ -244,6 +238,7 @@ void Screen::HandleScreenMessage( const ScreenMessage SM )
RString Screen::GetNextScreenName() const RString Screen::GetNextScreenName() const
{ {
LOG->Trace("[Screen::GetNextScreenName]: m_sNextScreen = %s",m_sNextScreen.c_str());
if( !m_sNextScreen.empty() ) if( !m_sNextScreen.empty() )
return m_sNextScreen; return m_sNextScreen;
return NEXT_SCREEN; return NEXT_SCREEN;
@@ -251,6 +246,7 @@ RString Screen::GetNextScreenName() const
RString Screen::GetPrevScreen() const RString Screen::GetPrevScreen() const
{ {
LOG->Trace("[Screen::GetPrevScreen]: m_sPrevScreen = %s",m_sPrevScreen.c_str());
if( !m_sPrevScreen.empty() ) if( !m_sPrevScreen.empty() )
return m_sPrevScreen; return m_sPrevScreen;
return PREV_SCREEN; return PREV_SCREEN;
@@ -286,8 +282,6 @@ class LunaScreen: public Luna<Screen>
public: public:
static int GetNextScreenName( T* p, lua_State *L ) { lua_pushstring(L, p->GetNextScreenName() ); return 1; } static int GetNextScreenName( T* p, lua_State *L ) { lua_pushstring(L, p->GetNextScreenName() ); return 1; }
static int GetPrevScreenName( T* p, lua_State *L ) { lua_pushstring(L, p->GetPrevScreen() ); return 1; } static int GetPrevScreenName( T* p, lua_State *L ) { lua_pushstring(L, p->GetPrevScreen() ); return 1; }
static int SetNextScreenName( T* p, lua_State *L ) { p->SetNextScreen(SArg(1)); return 0; }
static int SetPrevScreenName( T* p, lua_State *L ) { p->SetPrevScreen(SArg(1)); return 0; }
static int lockinput( T* p, lua_State *L ) { p->SetLockInputSecs(FArg(1)); return 0; } static int lockinput( T* p, lua_State *L ) { p->SetLockInputSecs(FArg(1)); return 0; }
DEFINE_METHOD( GetScreenType, GetScreenType() ) DEFINE_METHOD( GetScreenType, GetScreenType() )
@@ -303,8 +297,6 @@ public:
{ {
ADD_METHOD( GetNextScreenName ); ADD_METHOD( GetNextScreenName );
ADD_METHOD( GetPrevScreenName ); ADD_METHOD( GetPrevScreenName );
ADD_METHOD( SetNextScreenName );
ADD_METHOD( SetPrevScreenName );
ADD_METHOD( PostScreenMessage ); ADD_METHOD( PostScreenMessage );
ADD_METHOD( lockinput ); ADD_METHOD( lockinput );
ADD_METHOD( GetScreenType ); ADD_METHOD( GetScreenType );
-2
View File
@@ -97,8 +97,6 @@ protected:
public: public:
RString GetNextScreenName() const; RString GetNextScreenName() const;
RString GetPrevScreen() const; RString GetPrevScreen() const;
void SetNextScreen(RString sNextScreen){ m_sNextScreen = sNextScreen; };
void SetPrevScreen(RString sPrevScreen){ m_sPrevScreen = sPrevScreen; };
// let subclass override if they want // let subclass override if they want
virtual void MenuUp( const InputEventPlus &input ) { } virtual void MenuUp( const InputEventPlus &input ) { }