From a770ba9d9dfc4141fb36a345057aa887745b8627 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 26 Oct 2007 10:09:43 +0000 Subject: [PATCH] add GetDummyPlayerInfo --- stepmania/src/ScreenGameplay.cpp | 29 +++++++++++++++++++++++++++++ stepmania/src/ScreenGameplay.h | 1 + 2 files changed, 30 insertions(+) diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 01dd3ca544..0238882b78 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -1221,6 +1221,8 @@ void ScreenGameplay::LoadNextSong() pPlayerSound = m_AutoKeysounds.GetSharedSound(); pi->m_SoundEffectControl.SetSoundReader( pPlayerSound ); } + + MESSAGEMAN->Broadcast("DoneLoadingNextSong"); } void ScreenGameplay::LoadLights() @@ -2663,6 +2665,16 @@ PlayerInfo *ScreenGameplay::GetPlayerInfo( PlayerNumber pn ) return NULL; } +PlayerInfo *ScreenGameplay::GetDummyPlayerInfo( int iDummyIndex ) +{ + FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi ) + { + if( pi->m_bIsDummy && pi->m_iDummyIndex == iDummyIndex ) + return &*pi; + } + return NULL; +} + void ScreenGameplay::SaveReplay() { FOREACH_HumanPlayer( pn ) @@ -2727,12 +2739,22 @@ public: pLM->PushSelf( L ); return 1; } + static int GetDummyPlayerInfo( T* p, lua_State *L ) + { + int iDummyIndex = IArg(1); + PlayerInfo *pi = p->GetDummyPlayerInfo(iDummyIndex); + if( pi == NULL ) + return 0; + pi->PushSelf( L ); + return 1; + } LunaScreenGameplay() { ADD_METHOD( GetNextCourseSong ); ADD_METHOD( Center1Player ); ADD_METHOD( GetLifeMeter ); + ADD_METHOD( GetDummyPlayerInfo ); } }; @@ -2743,10 +2765,17 @@ class LunaPlayerInfo: public Luna { public: static int GetLifeMeter( T* p, lua_State *L ) { p->m_pLifeMeter->PushSelf(L); return 1; } + static int GetStepsQueue( T* p, lua_State *L ) + { + Steps *pSteps = p->m_vpStepsQueue[ IArg(1) ]; + pSteps->PushSelf(L); + return 1; + } LunaPlayerInfo() { ADD_METHOD( GetLifeMeter ); + ADD_METHOD( GetStepsQueue ); } }; diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index d09e14af80..1273533714 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -128,6 +128,7 @@ public: Song *GetNextCourseSong() const; LifeMeter *GetLifeMeter( PlayerNumber pn ); PlayerInfo *GetPlayerInfo( PlayerNumber pn ); + PlayerInfo *GetDummyPlayerInfo( int iDummyIndex ); protected: virtual void UpdateStageStats( MultiPlayer mp ) {}; // overridden for multiplayer