From 92d3778e293a544dfd78da4f67a7245f211cc500 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 29 May 2007 21:19:38 +0000 Subject: [PATCH] add LifeMeter binding in ScreenHowToPlay and ScreenGameplay remove GetPlayerInfo binding (currently unused) --- stepmania/src/ScreenAttract.cpp | 16 ++++++++++++++++ stepmania/src/ScreenAttract.h | 5 +++++ stepmania/src/ScreenGameplay.cpp | 10 +++++----- stepmania/src/ScreenGameplay.h | 1 + stepmania/src/ScreenHowToPlay.cpp | 24 ++++++++++++++++++++++++ stepmania/src/ScreenHowToPlay.h | 8 +++++++- 6 files changed, 58 insertions(+), 6 deletions(-) diff --git a/stepmania/src/ScreenAttract.cpp b/stepmania/src/ScreenAttract.cpp index 4739b39057..fbcc8bd61e 100644 --- a/stepmania/src/ScreenAttract.cpp +++ b/stepmania/src/ScreenAttract.cpp @@ -151,6 +151,22 @@ void ScreenAttract::GoToStartScreen( RString sScreenName ) SCREENMAN->SetNewScreen( START_SCREEN(sScreenName) ); } + +// lua start +#include "LuaBinding.h" + +class LunaScreenAttract: public Luna +{ +public: + + LunaScreenAttract() + { + } +}; + +LUA_REGISTER_DERIVED_CLASS( ScreenAttract, ScreenWithMenuElements ) +// lua end + /* * (c) 2003-2004 Chris Danford * All rights reserved. diff --git a/stepmania/src/ScreenAttract.h b/stepmania/src/ScreenAttract.h index 28d65d2071..a088210289 100644 --- a/stepmania/src/ScreenAttract.h +++ b/stepmania/src/ScreenAttract.h @@ -22,6 +22,11 @@ public: virtual ScreenType GetScreenType() const { return attract; } + // + // Lua + // + virtual void PushSelf( lua_State *L ); + protected: virtual void StartPlayingMusic(); }; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index f113c68dfd..688c18e5ea 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -2675,15 +2675,15 @@ class LunaScreenGameplay: public Luna public: static int GetNextCourseSong( T* p, lua_State *L ) { p->GetNextCourseSong()->PushSelf(L); return 1; } static int Center1Player( T* p, lua_State *L ) { lua_pushboolean( L, p->Center1Player() ); return 1; } - static int GetPlayerInfo( T* p, lua_State *L ) + static int GetLifeMeter( T* p, lua_State *L ) { PlayerNumber pn = Enum::Check( L, 1 ); - PlayerInfo *pInfo = p->GetPlayerInfo(pn); - if( pInfo == NULL ) + LifeMeter *pLM = p->GetPlayerInfo(pn)->m_pLifeMeter; + if( pLM == NULL ) return 0; - pInfo->PushSelf( L ); + pLM->PushSelf( L ); return 1; } @@ -2691,7 +2691,7 @@ public: { ADD_METHOD( GetNextCourseSong ); ADD_METHOD( Center1Player ); - ADD_METHOD( GetPlayerInfo ); + ADD_METHOD( GetLifeMeter ); } }; diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index 397c7e157b..09b48614d2 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -124,6 +124,7 @@ public: // virtual void PushSelf( lua_State *L ); Song *GetNextCourseSong() const; + LifeMeter *GetLifeMeter( PlayerNumber pn ); PlayerInfo *GetPlayerInfo( PlayerNumber pn ); protected: diff --git a/stepmania/src/ScreenHowToPlay.cpp b/stepmania/src/ScreenHowToPlay.cpp index 78d554ed27..c684b0d603 100644 --- a/stepmania/src/ScreenHowToPlay.cpp +++ b/stepmania/src/ScreenHowToPlay.cpp @@ -325,6 +325,30 @@ void ScreenHowToPlay::DrawPrimitives() } } + +// lua start +#include "LuaBinding.h" + +class LunaScreenHowToPlay: public Luna +{ +public: + static int GetLifeMeter( T* p, lua_State *L ) + { + //PlayerNumber pn = Enum::Check( L, 1 ); + + p->m_pLifeMeterBar->PushSelf( L ); + return 1; + } + + LunaScreenHowToPlay() + { + ADD_METHOD( GetLifeMeter ); + } +}; + +LUA_REGISTER_DERIVED_CLASS( ScreenHowToPlay, ScreenAttract ) +// lua end + /* * (c) 2001-2004 Chris Danford, Thad Ward * All rights reserved. diff --git a/stepmania/src/ScreenHowToPlay.h b/stepmania/src/ScreenHowToPlay.h index 11f3438065..ae5578e6be 100644 --- a/stepmania/src/ScreenHowToPlay.h +++ b/stepmania/src/ScreenHowToPlay.h @@ -19,9 +19,15 @@ public: virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void DrawPrimitives(); + // + // Lua + // + virtual void PushSelf( lua_State *L ); + + + LifeMeterBar *m_pLifeMeterBar; protected: virtual void Step(); - LifeMeterBar *m_pLifeMeterBar; PlayerPlus m_Player; Model *m_pmCharacter; Model *m_pmDancePad;