Added lua bindings for playing sounds in SCREENMAN. Added input redirection functions to SCREENMAN for disabling non-lua screen input processing. Added OF_FALSE, OV_EOF, and OV_HOLE to error string list in RageSound for more understandable messages. Made sure RageSound doesn't delete null pointers. Updated changelog.
This commit is contained in:
+55
-1
@@ -72,6 +72,7 @@
|
||||
#include "ScreenDimensions.h"
|
||||
#include "Foreach.h"
|
||||
#include "ActorUtil.h"
|
||||
#include "InputEventPlus.h"
|
||||
|
||||
ScreenManager* SCREENMAN = NULL; // global and accessible from anywhere in our program
|
||||
|
||||
@@ -366,6 +367,24 @@ bool ScreenManager::IsStackedScreen( const Screen *pScreen ) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScreenManager::get_input_redirected(PlayerNumber pn)
|
||||
{
|
||||
if(pn >= m_input_redirected.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return m_input_redirected[pn];
|
||||
}
|
||||
|
||||
void ScreenManager::set_input_redirected(PlayerNumber pn, bool redir)
|
||||
{
|
||||
while(pn >= m_input_redirected.size())
|
||||
{
|
||||
m_input_redirected.push_back(false);
|
||||
}
|
||||
m_input_redirected[pn]= redir;
|
||||
}
|
||||
|
||||
/* Pop the top screen off the stack, sending SM_LoseFocus messages and
|
||||
* returning the message the popped screen wants sent to the new top
|
||||
* screen. Does not send SM_GainFocus. */
|
||||
@@ -534,7 +553,10 @@ void ScreenManager::Input( const InputEventPlus &input )
|
||||
if( g_ScreenStack.empty() )
|
||||
return;
|
||||
|
||||
g_ScreenStack.back().m_pScreen->Input( input );
|
||||
if(!get_input_redirected(input.pn))
|
||||
{
|
||||
g_ScreenStack.back().m_pScreen->Input( input );
|
||||
}
|
||||
g_ScreenStack.back().m_pScreen->PassInputToLua( input );
|
||||
}
|
||||
|
||||
@@ -945,6 +967,32 @@ public:
|
||||
//static int GetScreenStackSize( T* p, lua_State *L ) { lua_pushnumber( L, ScreenManagerUtil::g_ScreenStack.size() ); return 1; }
|
||||
static int ReloadOverlayScreens( T* p, lua_State *L ) { p->ReloadOverlayScreens(); COMMON_RETURN_SELF; }
|
||||
|
||||
static int get_input_redirected(T* p, lua_State* L)
|
||||
{
|
||||
PlayerNumber pn= Enum::Check<PlayerNumber>(L, 1);
|
||||
lua_pushboolean(L, p->get_input_redirected(pn));
|
||||
return 1;
|
||||
}
|
||||
static int set_input_redirected(T* p, lua_State* L)
|
||||
{
|
||||
PlayerNumber pn= Enum::Check<PlayerNumber>(L, 1);
|
||||
p->set_input_redirected(pn, BArg(2));
|
||||
COMMON_RETURN_SELF;
|
||||
}
|
||||
|
||||
#define SCRMAN_PLAY_SOUND(sound_name) \
|
||||
static int Play##sound_name(T* p, lua_State* L) \
|
||||
{ \
|
||||
p->Play##sound_name(); \
|
||||
COMMON_RETURN_SELF; \
|
||||
}
|
||||
SCRMAN_PLAY_SOUND(InvalidSound);
|
||||
SCRMAN_PLAY_SOUND(StartSound);
|
||||
SCRMAN_PLAY_SOUND(CoinSound);
|
||||
SCRMAN_PLAY_SOUND(CancelSound);
|
||||
SCRMAN_PLAY_SOUND(ScreenshotSound);
|
||||
#undef SCRMAN_PLAY_SOUND
|
||||
|
||||
LunaScreenManager()
|
||||
{
|
||||
ADD_METHOD( SetNewScreen );
|
||||
@@ -955,6 +1003,12 @@ public:
|
||||
ADD_METHOD( AddNewScreenToTop );
|
||||
//ADD_METHOD( GetScreenStackSize );
|
||||
ADD_METHOD( ReloadOverlayScreens );
|
||||
ADD_METHOD(PlayInvalidSound);
|
||||
ADD_METHOD(PlayStartSound);
|
||||
ADD_METHOD(PlayCoinSound);
|
||||
ADD_METHOD(PlayCancelSound);
|
||||
ADD_METHOD(PlayScreenshotSound);
|
||||
ADD_GET_SET_METHODS(input_redirected);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user