diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index 994dd0d681..4bf2da5bdd 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -783,6 +783,7 @@ + @@ -1377,6 +1378,7 @@ + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index ba9d6baa90..d74d48ecc9 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -2329,7 +2329,10 @@ save yourself some time, copy this for undocumented things: Returns true if player pn is the winner. - Joins player pn. + Joins player pn. Does not deduct coins. + + + Similar to JoinPlayer, but checks whether the player is allowed to join and returns false if the player is not allowed to join. Also deducts coins for joining. A player can't join if PlayersCanJoin() returns false, or that side is already joined (is true for both sides when in a style that is OnePlayerTwoSides), or there are not enough coins. Returns true if player pn is using modifier sModifier. @@ -3905,6 +3908,9 @@ save yourself some time, copy this for undocumented things: Tells the screen to go to the previous screen. + + Sets whether the screen allows late joining. This only works for screens that are just ScreenWithMenuElements, as most derived screens have their own hard coded function for whether late joining is allowed. + diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index d0a6e46d72..3a752eb261 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -4423,6 +4423,7 @@ BodyHeight=38 [ComboGraph] BodyWidth=140 +BodyHeight=11 # Arcade ################################# [ScreenLogo] diff --git a/src/ComboGraph.cpp b/src/ComboGraph.cpp index f7c745bdf5..e582f2a9fb 100644 --- a/src/ComboGraph.cpp +++ b/src/ComboGraph.cpp @@ -22,6 +22,11 @@ ComboGraph::ComboGraph() void ComboGraph::Load( RString sMetricsGroup ) { BODY_WIDTH.Load( sMetricsGroup, "BodyWidth" ); + BODY_HEIGHT.Load( sMetricsGroup, "BodyHeight" ); + + // These need to be set so that a theme can use zoomtowidth/zoomtoheight and get correct behavior. + this->SetWidth(BODY_WIDTH); + this->SetHeight(BODY_HEIGHT); Actor *pActor = NULL; @@ -29,6 +34,7 @@ void ComboGraph::Load( RString sMetricsGroup ) if( m_pBacking != NULL ) { m_pBacking->ZoomToWidth( BODY_WIDTH ); + m_pBacking->ZoomToHeight( BODY_HEIGHT ); this->AddChild( m_pBacking ); } @@ -36,6 +42,7 @@ void ComboGraph::Load( RString sMetricsGroup ) if( m_pNormalCombo != NULL ) { m_pNormalCombo->ZoomToWidth( BODY_WIDTH ); + m_pNormalCombo->ZoomToHeight( BODY_HEIGHT ); this->AddChild( m_pNormalCombo ); } @@ -43,6 +50,7 @@ void ComboGraph::Load( RString sMetricsGroup ) if( m_pMaxCombo != NULL ) { m_pMaxCombo->ZoomToWidth( BODY_WIDTH ); + m_pMaxCombo->ZoomToHeight( BODY_HEIGHT ); this->AddChild( m_pMaxCombo ); } diff --git a/src/ComboGraph.h b/src/ComboGraph.h index b679c7043b..492d13bfd9 100644 --- a/src/ComboGraph.h +++ b/src/ComboGraph.h @@ -24,6 +24,7 @@ public: private: ThemeMetric BODY_WIDTH; + ThemeMetric BODY_HEIGHT; Actor *m_pBacking; Actor *m_pNormalCombo; Actor *m_pMaxCombo; diff --git a/src/GameState.cpp b/src/GameState.cpp index 5902ee152e..dd46fdf02a 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -2474,6 +2474,11 @@ public: static int Reset( T* p, lua_State *L ) { p->Reset(); return 0; } static int JoinPlayer( T* p, lua_State *L ) { p->JoinPlayer(Enum::Check(L, 1)); return 0; } static int UnjoinPlayer( T* p, lua_State *L ) { p->UnjoinPlayer(Enum::Check(L, 1)); return 0; } + static int JoinInput( T* p, lua_State *L ) + { + lua_pushboolean(L, p->JoinInput(Enum::Check(L, 1))); + return 1; + } static int GetSongPercent( T* p, lua_State *L ) { lua_pushnumber(L, p->GetSongPercent(FArg(1))); return 1; } DEFINE_METHOD( GetCurMusicSeconds, m_Position.m_fMusicSeconds ) @@ -2606,6 +2611,7 @@ public: ADD_METHOD( Reset ); ADD_METHOD( JoinPlayer ); ADD_METHOD( UnjoinPlayer ); + ADD_METHOD( JoinInput ); ADD_METHOD( GetSongPercent ); ADD_METHOD( GetCurMusicSeconds ); ADD_METHOD( GetCharacter ); diff --git a/src/ScoreKeeperNormal.cpp b/src/ScoreKeeperNormal.cpp index e36e602837..787a89796b 100644 --- a/src/ScoreKeeperNormal.cpp +++ b/src/ScoreKeeperNormal.cpp @@ -586,13 +586,10 @@ void ScoreKeeperNormal::HandleHoldScore( const TapNote &tn ) // update dance points totals if( !m_pPlayerStageStats->m_bFailed ) m_pPlayerStageStats->m_iActualDancePoints += HoldNoteScoreToDancePoints( holdScore ); + // increment the current total possible dance score m_pPlayerStageStats->m_iCurPossibleDancePoints += HoldNoteScoreToDancePoints( HNS_Held ); m_pPlayerStageStats->m_iHoldNoteScores[holdScore] ++; - // increment the current total possible dance score - - m_pPlayerStageStats->m_iCurPossibleDancePoints += HoldNoteScoreToDancePoints( HNS_Held ); - AddHoldScore( holdScore ); // TODO: Remove indexing with PlayerNumber diff --git a/src/ScreenWithMenuElements.cpp b/src/ScreenWithMenuElements.cpp index f02d2e1cb4..21bfbd140e 100644 --- a/src/ScreenWithMenuElements.cpp +++ b/src/ScreenWithMenuElements.cpp @@ -25,6 +25,7 @@ ScreenWithMenuElements::ScreenWithMenuElements() FOREACH_PlayerNumber( p ) m_MemoryCardDisplay[p] = NULL; m_MenuTimer = NULL; + m_bShouldAllowLateJoin= false; } void ScreenWithMenuElements::Init() @@ -377,11 +378,18 @@ class LunaScreenWithMenuElements: public Luna public: static int Cancel( T* p, lua_State *L ) { p->Cancel( SM_GoToPrevScreen ); return 0; } static int IsTransitioning( T* p, lua_State *L ) { lua_pushboolean( L, p->IsTransitioning() ); return 1; } + static int SetAllowLateJoin( T* p, lua_State *L ) + { + p->m_bShouldAllowLateJoin= BArg(1); + return 0; + } + LunaScreenWithMenuElements() { ADD_METHOD( Cancel ); ADD_METHOD( IsTransitioning ); + ADD_METHOD( SetAllowLateJoin ); } }; diff --git a/src/ScreenWithMenuElements.h b/src/ScreenWithMenuElements.h index 01d55b7b27..2879e96d64 100644 --- a/src/ScreenWithMenuElements.h +++ b/src/ScreenWithMenuElements.h @@ -33,6 +33,9 @@ public: // Lua virtual void PushSelf( lua_State *L ); + virtual bool AllowLateJoin() const { return m_bShouldAllowLateJoin; } + bool m_bShouldAllowLateJoin; // So that it can be exposed to Lua. + protected: virtual void StartPlayingMusic(); void SetHelpText( RString s );