From 41fda46bfd35af8fbe68020110fe71a972430518 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 27 Oct 2007 01:49:18 +0000 Subject: [PATCH] support MultiPlayer --- stepmania/src/ScoreDisplayAliveTime.cpp | 14 +++++++++++--- stepmania/src/ScoreDisplayAliveTime.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/stepmania/src/ScoreDisplayAliveTime.cpp b/stepmania/src/ScoreDisplayAliveTime.cpp index df556212ab..11f49b9a48 100644 --- a/stepmania/src/ScoreDisplayAliveTime.cpp +++ b/stepmania/src/ScoreDisplayAliveTime.cpp @@ -7,6 +7,7 @@ #include "StatsManager.h" #include "ActorUtil.h" #include "LuaManager.h" +#include "RageLog.h" REGISTER_ACTOR_CLASS( ScoreDisplayAliveTime ) @@ -14,6 +15,7 @@ REGISTER_ACTOR_CLASS( ScoreDisplayAliveTime ) ScoreDisplayAliveTime::ScoreDisplayAliveTime() { m_PlayerNumber = PLAYER_INVALID; + m_MultiPlayer = MultiPlayer_Invalid; } ScoreDisplayAliveTime::~ScoreDisplayAliveTime() @@ -27,8 +29,10 @@ void ScoreDisplayAliveTime::LoadFromNode( const XNode* pNode ) { Lua *L = LUA->Get(); bool b = pNode->PushAttrValue( L, "PlayerNumber" ); - ASSERT( b ); LuaHelpers::Pop( L, m_PlayerNumber ); + bool b2 = pNode->PushAttrValue( L, "MultiPlayer" ); + LuaHelpers::Pop( L, m_MultiPlayer ); + ASSERT( b || b2 ); LUA->Release( L ); } } @@ -50,11 +54,15 @@ void ScoreDisplayAliveTime::HandleMessage( const Message &msg ) void ScoreDisplayAliveTime::UpdateNumber() { float fSecsIntoPlay = 0; - ASSERT( m_PlayerNumber != PLAYER_INVALID ); - if( GAMESTATE->IsPlayerEnabled(m_PlayerNumber) ) + ASSERT( m_PlayerNumber != PLAYER_INVALID || m_MultiPlayer != MultiPlayer_Invalid ); + if( m_PlayerNumber != PLAYER_INVALID && GAMESTATE->IsPlayerEnabled(m_PlayerNumber) ) fSecsIntoPlay = STATSMAN->GetAccumPlayedStageStats().m_player[m_PlayerNumber].m_fAliveSeconds + STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].m_fAliveSeconds; + if( m_MultiPlayer != MultiPlayer_Invalid && GAMESTATE->IsMultiPlayerEnabled(m_MultiPlayer) ) + fSecsIntoPlay = + STATSMAN->GetAccumPlayedStageStats().m_fGameplaySeconds + + STATSMAN->m_CurStageStats.m_fGameplaySeconds; SetText( SecondsToMMSSMsMs(fSecsIntoPlay) ); } diff --git a/stepmania/src/ScoreDisplayAliveTime.h b/stepmania/src/ScoreDisplayAliveTime.h index 1e3b8904a6..56a029d684 100644 --- a/stepmania/src/ScoreDisplayAliveTime.h +++ b/stepmania/src/ScoreDisplayAliveTime.h @@ -30,6 +30,7 @@ public: private: PlayerNumber m_PlayerNumber; + MultiPlayer m_MultiPlayer; }; #endif