From 13c99c1814c4bfd75c567c98f9394f78ecced85c Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Wed, 12 Feb 2014 14:38:54 -0700 Subject: [PATCH 1/4] Added BodyHeight metric to ComboGraph and set width and height to make zoomtowidth/height work. --- Themes/_fallback/metrics.ini | 1 + src/ComboGraph.cpp | 8 ++++++++ src/ComboGraph.h | 1 + 3 files changed, 10 insertions(+) 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; From 392fabc45ff9b29635455576d921565815c3d603 Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Wed, 12 Feb 2014 14:59:48 -0700 Subject: [PATCH 2/4] Hold notes were added to possible score twice. --- src/ScoreKeeperNormal.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 From 5bde20e89724c708588d4f3ea02e6b4e06bc64c6 Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Wed, 12 Feb 2014 15:45:26 -0700 Subject: [PATCH 3/4] Exposing GameState::JoinInput to Lua. --- Docs/Luadoc/Lua.xml | 1 + Docs/Luadoc/LuaDocumentation.xml | 5 ++++- src/GameState.cpp | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index 994dd0d681..a18957acd9 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -783,6 +783,7 @@ + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index e2f3ea3597..34a824c103 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -2327,7 +2327,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. 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 ); From 779e3da2866917f87e3b84074e50f5755fd3a6ec Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Wed, 12 Feb 2014 17:18:13 -0700 Subject: [PATCH 4/4] Added SetAllowLateJoin to ScreenWithMenuElements. --- Docs/Luadoc/Lua.xml | 1 + Docs/Luadoc/LuaDocumentation.xml | 3 +++ src/ScreenWithMenuElements.cpp | 8 ++++++++ src/ScreenWithMenuElements.h | 3 +++ 4 files changed, 15 insertions(+) diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index 994dd0d681..0f26684e4b 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -1377,6 +1377,7 @@ + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index d40e06f3b2..62b16f91c5 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -3903,6 +3903,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/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 );