remove unfinished, crufty multiplayer stuff
This commit is contained in:
@@ -27,18 +27,15 @@ ScreenDemonstration.cpp ScreenDemonstration.h ScreenDimensions.h \
|
||||
ScreenEdit.cpp ScreenEdit.h \
|
||||
ScreenEditMenu.cpp ScreenEditMenu.h ScreenEnding.cpp ScreenEnding.h \
|
||||
ScreenEvaluation.cpp ScreenEvaluation.h \
|
||||
ScreenEvaluationMultiplayer.cpp ScreenEvaluationMultiplayer.h \
|
||||
ScreenExit.cpp ScreenExit.h ScreenNetEvaluation.cpp ScreenNetEvaluation.h \
|
||||
ScreenNetSelectMusic.cpp ScreenNetSelectMusic.h ScreenNetSelectBase.cpp ScreenNetSelectBase.h ScreenNetRoom.cpp ScreenNetRoom.h \
|
||||
ScreenEz2SelectMusic.cpp ScreenEz2SelectMusic.h ScreenEz2SelectPlayer.cpp ScreenEz2SelectPlayer.h \
|
||||
ScreenGameplay.cpp ScreenGameplay.h \
|
||||
ScreenGameplayLesson.cpp ScreenGameplayLesson.h \
|
||||
ScreenGameplayMultiplayer.cpp ScreenGameplayMultiplayer.h \
|
||||
ScreenGameplayNormal.cpp ScreenGameplayNormal.h \
|
||||
ScreenGameplaySyncMachine.cpp ScreenGameplaySyncMachine.h \
|
||||
ScreenHowToPlay.cpp ScreenHowToPlay.h \
|
||||
ScreenInstructions.cpp ScreenInstructions.h \
|
||||
ScreenJoinMultiplayer.cpp ScreenJoinMultiplayer.h \
|
||||
ScreenJukebox.cpp ScreenJukebox.h \
|
||||
ScreenMapControllers.cpp ScreenMapControllers.h \
|
||||
ScreenMessage.cpp ScreenMessage.h ScreenMiniMenu.cpp ScreenMiniMenu.h ScreenMusicScroll.cpp ScreenMusicScroll.h \
|
||||
@@ -293,7 +290,6 @@ LifeMeterBar.cpp LifeMeterBar.h \
|
||||
LifeMeterBattery.cpp LifeMeterBattery.h LifeMeterTime.cpp LifeMeterTime.h \
|
||||
LyricDisplay.cpp LyricDisplay.h NoteDisplay.cpp NoteDisplay.h NoteField.cpp NoteField.h \
|
||||
PercentageDisplay.cpp PercentageDisplay.h Player.cpp Player.h \
|
||||
PlayerScoreList.cpp PlayerScoreList.h \
|
||||
ReceptorArrow.cpp ReceptorArrow.h ReceptorArrowRow.cpp ReceptorArrowRow.h \
|
||||
ScoreDisplay.cpp ScoreDisplay.h \
|
||||
ScoreDisplayBattle.cpp ScoreDisplayBattle.h \
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "PlayerScoreList.h"
|
||||
#include "GameCommand.h"
|
||||
#include "PlayerState.h"
|
||||
|
||||
|
||||
//
|
||||
// PlayerScoreItem
|
||||
//
|
||||
void PlayerScoreItem::Init( const PlayerState *pPlayerState, const PlayerStageStats *pPlayerStageStats )
|
||||
{
|
||||
m_sprFrame.Load( THEME->GetPathG("PlayerScoreItem","Frame") );
|
||||
this->AddChild( m_sprFrame );
|
||||
|
||||
m_score.Load( pPlayerState, pPlayerStageStats, "PlayerScoreItem Percent", true );
|
||||
this->AddChild( &m_score );
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// PlayerScoreList
|
||||
//
|
||||
PlayerScoreList::PlayerScoreList()
|
||||
{
|
||||
m_timerRefreshCountdown.Touch();
|
||||
}
|
||||
|
||||
static void PositionItem( LuaExpression &expr, Actor *pSelf, int iItemIndex, int iNumItems )
|
||||
{
|
||||
Lua *L = LUA->Get();
|
||||
expr.PushSelf( L );
|
||||
ASSERT( !lua_isnil(L, -1) );
|
||||
pSelf->PushSelf( L );
|
||||
LuaHelpers::Push( iItemIndex, L );
|
||||
LuaHelpers::Push( iNumItems, L );
|
||||
lua_call( L, 3, 0 ); // 3 args, 0 results
|
||||
LUA->Release(L);
|
||||
}
|
||||
|
||||
void PlayerScoreList::Init( vector<const PlayerState*> vpPlayerState, vector<const PlayerStageStats*> vpPlayerStageStats )
|
||||
{
|
||||
ASSERT( !vpPlayerState.empty() );
|
||||
ASSERT( !vpPlayerStageStats.empty() );
|
||||
|
||||
m_vpPlayerState = vpPlayerState;
|
||||
m_vpPlayerStageStats = vpPlayerStageStats;
|
||||
|
||||
m_vsprBullet.resize( vpPlayerState.size() );
|
||||
m_vScoreItem.resize( vpPlayerState.size() );
|
||||
|
||||
//
|
||||
{
|
||||
LuaExpression expr;
|
||||
expr.SetFromExpression( THEME->GetMetric("PlayerScoreList","ItemPositionCommandFunction") );
|
||||
Actor a;
|
||||
FOREACH( const PlayerState*, m_vpPlayerState, iter )
|
||||
{
|
||||
int i = iter - m_vpPlayerState.begin();
|
||||
|
||||
PositionItem( expr, &a, i, vpPlayerState.size() );
|
||||
m_vtsPositions.push_back( a.DestTweenState() );
|
||||
}
|
||||
}
|
||||
|
||||
GameCommand gc;
|
||||
FOREACH( const PlayerState*, m_vpPlayerState, iter )
|
||||
{
|
||||
int i = iter - m_vpPlayerState.begin();
|
||||
|
||||
gc.m_iIndex = i;
|
||||
gc.m_MultiPlayer = (*iter)->m_mp;
|
||||
|
||||
Lua *L = LUA->Get();
|
||||
gc.PushSelf( L );
|
||||
lua_setglobal( L, "ThisGameCommand" );
|
||||
LUA->Release( L );
|
||||
|
||||
m_vsprBullet[i].Load( THEME->GetPathG("PlayerScoreList","Bullet") );
|
||||
m_vsprBullet[i]->DestTweenState() = m_vtsPositions[i];
|
||||
this->AddChild( m_vsprBullet[i] );
|
||||
|
||||
m_vScoreItem[i].Init( vpPlayerState[i], vpPlayerStageStats[i] );
|
||||
this->AddChild( &m_vScoreItem[i] );
|
||||
|
||||
LUA->UnsetGlobal( "ThisGameCommand" );
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerScoreList::Update( float fDelta )
|
||||
{
|
||||
ActorFrame::Update( fDelta );
|
||||
|
||||
bool bTimeToRefresh = m_timerRefreshCountdown.PeekDeltaTime() > 0.5f;
|
||||
if( bTimeToRefresh )
|
||||
m_timerRefreshCountdown.Touch();
|
||||
|
||||
if( bTimeToRefresh )
|
||||
Refresh();
|
||||
}
|
||||
|
||||
struct EnabledPlayerIndexAndScore
|
||||
{
|
||||
int iEnabledPlayerIndex;
|
||||
float fScore;
|
||||
|
||||
bool operator<( const EnabledPlayerIndexAndScore &other ) const { return fScore > other.fScore; }
|
||||
};
|
||||
|
||||
void PlayerScoreList::Refresh()
|
||||
{
|
||||
vector<EnabledPlayerIndexAndScore> v;
|
||||
|
||||
FOREACH( const PlayerStageStats*, m_vpPlayerStageStats, iter )
|
||||
{
|
||||
int i = iter - m_vpPlayerStageStats.begin();
|
||||
EnabledPlayerIndexAndScore t = { i, (*iter)->GetPercentDancePoints() };
|
||||
v.push_back( t );
|
||||
}
|
||||
|
||||
stable_sort( v.begin(), v.end() );
|
||||
|
||||
FOREACH( EnabledPlayerIndexAndScore, v, iter )
|
||||
{
|
||||
int i = iter - v.begin();
|
||||
PlayerScoreItem &psi = m_vScoreItem[iter->iEnabledPlayerIndex];
|
||||
psi.SetDrawOrder( -i );
|
||||
psi.BeginTweening( 0.5f, TWEEN_DECELERATE );
|
||||
psi.DestTweenState() = m_vtsPositions[i];
|
||||
}
|
||||
|
||||
this->SortByDrawOrder();
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,68 +0,0 @@
|
||||
#ifndef PlayerScoreList_H
|
||||
#define PlayerScoreList_H
|
||||
|
||||
#include "ActorFrame.h"
|
||||
#include "AutoActor.h"
|
||||
#include "PercentageDisplay.h"
|
||||
#include "RageTimer.h"
|
||||
class PlayerState;
|
||||
class PlayerStageStats;
|
||||
|
||||
class PlayerScoreItem : public ActorFrame
|
||||
{
|
||||
public:
|
||||
void Init( const PlayerState *pPlayerState, const PlayerStageStats *pPlayerStageStats );
|
||||
|
||||
protected:
|
||||
AutoActor m_sprFrame;
|
||||
PercentageDisplay m_score;
|
||||
};
|
||||
|
||||
class PlayerScoreList : public ActorFrame
|
||||
{
|
||||
public:
|
||||
PlayerScoreList();
|
||||
|
||||
void Init( vector<const PlayerState*> vpPlayerState, vector<const PlayerStageStats*> vpPlayerStageStats );
|
||||
|
||||
virtual void Update( float fDelta );
|
||||
|
||||
void Refresh();
|
||||
|
||||
protected:
|
||||
vector<const PlayerState*> m_vpPlayerState;
|
||||
vector<const PlayerStageStats*> m_vpPlayerStageStats;
|
||||
|
||||
RageTimer m_timerRefreshCountdown;
|
||||
|
||||
vector<Actor::TweenState> m_vtsPositions; // size = num joined players
|
||||
vector<AutoActor> m_vsprBullet; // size = num joined players
|
||||
vector<PlayerScoreItem> m_vScoreItem; // size = num joined players
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,356 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "ScreenEvaluationMultiplayer.h"
|
||||
#include "BitmapText.h"
|
||||
#include "PlayerState.h"
|
||||
#include "PlayerStageStats.h"
|
||||
#include "GameState.h"
|
||||
#include "StatsManager.h"
|
||||
#include "GameCommand.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "GameManager.h"
|
||||
#include "SongManager.h"
|
||||
#include "song.h"
|
||||
#include "ScoreKeeperNormal.h"
|
||||
#include "PercentageDisplay.h"
|
||||
#include "LocalizedString.h"
|
||||
#include "InputEventPlus.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "ControllerStateDisplay.h"
|
||||
#include "InputMapper.h"
|
||||
#include "StepMania.h"
|
||||
#include "CommonMetrics.h"
|
||||
|
||||
static const char *MultiplayerJudgeLineNames[] = {
|
||||
"W1",
|
||||
"W2",
|
||||
"W3",
|
||||
"W4",
|
||||
"W5",
|
||||
"Miss",
|
||||
"Held",
|
||||
};
|
||||
XToString( MultiplayerJudgeLine, NUM_MultiplayerJudgeLine );
|
||||
#define FOREACH_MultiplayerJudgeLine( i ) FOREACH_ENUM( MultiplayerJudgeLine, NUM_MultiplayerJudgeLine, i )
|
||||
|
||||
static void PositionItem( LuaExpression &expr, Actor *pSelf, int iItemIndex, int iNumItems )
|
||||
{
|
||||
Lua *L = LUA->Get();
|
||||
expr.PushSelf( L );
|
||||
ASSERT( !lua_isnil(L, -1) );
|
||||
pSelf->PushSelf( L );
|
||||
LuaHelpers::Push( iItemIndex, L );
|
||||
LuaHelpers::Push( iNumItems, L );
|
||||
lua_call( L, 3, 0 ); // 3 args, 0 results
|
||||
LUA->Release(L);
|
||||
}
|
||||
|
||||
class MultiplayerEvalScoreRow : public ActorFrame
|
||||
{
|
||||
protected:
|
||||
AutoActor m_sprFrame;
|
||||
PercentageDisplay m_score;
|
||||
BitmapText m_textJudgmentNumber[NUM_MultiplayerJudgeLine];
|
||||
ControllerStateDisplay m_ControllerStateDisplay;
|
||||
|
||||
public:
|
||||
MultiplayerEvalScoreRow( MultiPlayer mp, int iRankIndex )
|
||||
{
|
||||
PlayerState *pPlayerState = GAMESTATE->m_pMultiPlayerState[mp];
|
||||
PlayerStageStats *pPlayerStageStats = &STATSMAN->m_CurStageStats.m_multiPlayer[mp];
|
||||
|
||||
ASSERT( GAMESTATE->IsPlayerEnabled(pPlayerState) );
|
||||
|
||||
|
||||
m_sprFrame.Load( THEME->GetPathG("MultiplayerEvalScoreRow","frame") );
|
||||
this->AddChild( m_sprFrame );
|
||||
|
||||
|
||||
m_score.Load( pPlayerState, pPlayerStageStats, "MultiplayerEvalScoreRow Percent", true );
|
||||
m_score.SetName( "Score" );
|
||||
ActorUtil::OnCommand( &m_score, "MultiplayerEvalScoreRow" );
|
||||
this->AddChild( &m_score );
|
||||
|
||||
|
||||
LuaExpression expr;
|
||||
expr.SetFromExpression( THEME->GetMetric("MultiplayerEvalScoreRow","NumberOnCommandFunction") );
|
||||
|
||||
FOREACH_MultiplayerJudgeLine( i )
|
||||
{
|
||||
BitmapText &text = m_textJudgmentNumber[i];
|
||||
text.LoadFromFont( THEME->GetPathF("MultiplayerEvalScoreRow","JudgmentNumber") );
|
||||
this->AddChild( &text );
|
||||
|
||||
int iVal = -1;
|
||||
switch( i )
|
||||
{
|
||||
default: ASSERT(0);
|
||||
case MultiplayerJudgeLine_W1: iVal = pPlayerStageStats->iTapNoteScores[TNS_W1]; break;
|
||||
case MultiplayerJudgeLine_W2: iVal = pPlayerStageStats->iTapNoteScores[TNS_W2]; break;
|
||||
case MultiplayerJudgeLine_W3: iVal = pPlayerStageStats->iTapNoteScores[TNS_W3]; break;
|
||||
case MultiplayerJudgeLine_W4: iVal = pPlayerStageStats->iTapNoteScores[TNS_W4]; break;
|
||||
case MultiplayerJudgeLine_W5: iVal = pPlayerStageStats->iTapNoteScores[TNS_W5]; break;
|
||||
case MultiplayerJudgeLine_Miss: iVal = pPlayerStageStats->iTapNoteScores[TNS_Miss]; break;
|
||||
case MultiplayerJudgeLine_Held: iVal = pPlayerStageStats->iHoldNoteScores[HNS_Held];break;
|
||||
}
|
||||
|
||||
RString s = ssprintf( "%3d", iVal );
|
||||
text.SetText( s );
|
||||
|
||||
PositionItem( expr, &text, i, NUM_MultiplayerJudgeLine );
|
||||
}
|
||||
|
||||
m_ControllerStateDisplay.LoadMultiPlayer( mp );
|
||||
this->AddChild( &m_ControllerStateDisplay );
|
||||
PositionItem( expr, &m_ControllerStateDisplay, NUM_MultiplayerJudgeLine, NUM_MultiplayerJudgeLine );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenEvaluationMultiplayer );
|
||||
ScreenEvaluationMultiplayer::ScreenEvaluationMultiplayer()
|
||||
{
|
||||
//
|
||||
// debugging
|
||||
//
|
||||
if( PREFSMAN->m_bScreenTestMode )
|
||||
{
|
||||
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
|
||||
GAMESTATE->m_pCurStyle.Set( GAMEMAN->GameAndStringToStyle(GAMEMAN->GetDefaultGame(),"single") );
|
||||
|
||||
GAMESTATE->m_bMultiplayer = true;
|
||||
|
||||
STATSMAN->m_CurStageStats.playMode = GAMESTATE->m_PlayMode;
|
||||
STATSMAN->m_CurStageStats.pStyle = GAMESTATE->m_pCurStyle;
|
||||
STATSMAN->m_CurStageStats.StageType = StageStats::STAGE_NORMAL;
|
||||
GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
|
||||
GAMESTATE->m_pCurSong.Set( SONGMAN->GetRandomSong() );
|
||||
STATSMAN->m_CurStageStats.vpPlayedSongs.push_back( GAMESTATE->m_pCurSong );
|
||||
STATSMAN->m_CurStageStats.vpPossibleSongs.push_back( GAMESTATE->m_pCurSong );
|
||||
GAMESTATE->m_pCurCourse.Set( SONGMAN->GetRandomCourse() );
|
||||
GAMESTATE->m_iCurrentStageIndex = 0;
|
||||
|
||||
GAMESTATE->m_pCurSteps[PLAYER_1].Set( GAMESTATE->m_pCurSong->GetAllSteps()[0] );
|
||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].vpPlayedSteps.push_back( GAMESTATE->m_pCurSteps[PLAYER_1] );
|
||||
STATSMAN->m_CurStageStats.m_player[PLAYER_1].vpPossibleSteps.push_back( GAMESTATE->m_pCurSteps[PLAYER_1] );
|
||||
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_fScrollSpeed = 2;
|
||||
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.ChooseRandomModifiers();
|
||||
|
||||
FOREACH_MultiPlayer( p )
|
||||
{
|
||||
GAMESTATE->m_bIsMultiPlayerJoined[p] = (rand() % 4) != 0;
|
||||
}
|
||||
|
||||
FOREACH_MultiPlayer( p )
|
||||
{
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].iActualDancePoints = rand()%3;
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].iPossibleDancePoints = 2;
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].iCurCombo = 0;
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].UpdateComboList( 0, false );
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].iCurCombo = 1;
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].UpdateComboList( 1, false );
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].iCurCombo = 50;
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].UpdateComboList( 25, false );
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].iCurCombo = 250;
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].UpdateComboList( 100, false );
|
||||
if( rand()%2 )
|
||||
{
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].iCurCombo = rand()%11000;
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].UpdateComboList( 110, false );
|
||||
}
|
||||
if( rand()%5 == 0 )
|
||||
{
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].bFailedEarlier = true;
|
||||
}
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].iTapNoteScores[TNS_W1] = rand()%3;
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].iTapNoteScores[TNS_W2] = rand()%3;
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].iTapNoteScores[TNS_W3] = rand()%3;
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].iPossibleGradePoints = 4*ScoreKeeperNormal::TapNoteScoreToGradePoints(TNS_W1, false);
|
||||
STATSMAN->m_CurStageStats.m_multiPlayer[p].fLifeRemainingSeconds = randomf( 90, 580 );
|
||||
}
|
||||
|
||||
STATSMAN->m_vPlayedStageStats.clear();
|
||||
}
|
||||
|
||||
|
||||
ASSERT( GAMESTATE->m_bMultiplayer );
|
||||
}
|
||||
|
||||
ScreenEvaluationMultiplayer::~ScreenEvaluationMultiplayer()
|
||||
{
|
||||
FOREACH( MultiplayerEvalScoreRow*, m_vpMultiplayerEvalScoreRow, iter )
|
||||
SAFE_DELETE( *iter );
|
||||
m_vpMultiplayerEvalScoreRow.clear();
|
||||
}
|
||||
|
||||
struct EnabledPlayerIndexAndScore
|
||||
{
|
||||
MultiPlayer m_MultiPlayer;
|
||||
float fScore;
|
||||
|
||||
bool operator<( const EnabledPlayerIndexAndScore &other ) const { return fScore > other.fScore; }
|
||||
};
|
||||
|
||||
void ScreenEvaluationMultiplayer::Init()
|
||||
{
|
||||
ScreenWithMenuElements::Init();
|
||||
|
||||
int iNumEnabledPlayers = 0;
|
||||
FOREACH_EnabledMultiPlayer( p )
|
||||
iNumEnabledPlayers++;
|
||||
|
||||
int iNumLines = iNumEnabledPlayers+1;
|
||||
|
||||
LuaExpression exprBullet;
|
||||
exprBullet.SetFromExpression( THEME->GetMetric("ScreenEvaluationMultiplayer","BulletOnCommandFunction") );
|
||||
LuaExpression exprLine;
|
||||
exprLine.SetFromExpression( THEME->GetMetric("ScreenEvaluationMultiplayer","LineOnCommandFunction") );
|
||||
|
||||
this->AddChild( &m_frameLabels );
|
||||
PositionItem( exprLine, &m_frameLabels, 0, iNumLines );
|
||||
{
|
||||
LuaExpression expr;
|
||||
expr.SetFromExpression( THEME->GetMetric("ScreenEvaluationMultiplayer","LabelOnCommandFunction") );
|
||||
|
||||
FOREACH_MultiplayerJudgeLine( i )
|
||||
{
|
||||
AutoActor &a = m_sprJudgmentLabel[i];
|
||||
a.Load( THEME->GetPathG("ScreenEvaluationMultiplayer","JudgmentLabel"+MultiplayerJudgeLineToString(i)) );
|
||||
m_frameLabels.AddChild( m_sprJudgmentLabel[i] );
|
||||
|
||||
PositionItem( expr, a, i, NUM_MultiplayerJudgeLine );
|
||||
}
|
||||
}
|
||||
|
||||
vector<EnabledPlayerIndexAndScore> v;
|
||||
FOREACH_EnabledMultiPlayer( p )
|
||||
{
|
||||
PlayerStageStats *pPlayerStageStats = &STATSMAN->m_CurStageStats.m_multiPlayer[p];
|
||||
EnabledPlayerIndexAndScore t = { p, pPlayerStageStats->GetPercentDancePoints() };
|
||||
v.push_back( t );
|
||||
}
|
||||
stable_sort( v.begin(), v.end() );
|
||||
|
||||
GameCommand gc;
|
||||
int iRankIndex = 0;
|
||||
m_vsprBullet.resize( v.size() );
|
||||
FOREACH( EnabledPlayerIndexAndScore, v, iter )
|
||||
{
|
||||
int i = iter - v.begin();
|
||||
gc.m_iIndex = i;
|
||||
gc.m_MultiPlayer = iter->m_MultiPlayer;
|
||||
|
||||
Lua *L = LUA->Get();
|
||||
gc.PushSelf( L );
|
||||
lua_setglobal( L, "ThisGameCommand" );
|
||||
LUA->Release( L );
|
||||
|
||||
{
|
||||
MultiplayerEvalScoreRow *pRow = new MultiplayerEvalScoreRow( iter->m_MultiPlayer, iRankIndex );
|
||||
m_vpMultiplayerEvalScoreRow.push_back( pRow );
|
||||
PositionItem( exprLine, pRow, iRankIndex+1, iNumLines );
|
||||
this->AddChild( pRow );
|
||||
}
|
||||
|
||||
{
|
||||
AutoActor &a = m_vsprBullet[i];
|
||||
a.Load( THEME->GetPathG("ScreenEvaluationMultiplayer","Bullet") );
|
||||
PositionItem( exprBullet, a, iRankIndex+1, iNumLines );
|
||||
this->AddChild( a );
|
||||
}
|
||||
|
||||
LUA->UnsetGlobal( "ThisGameCommand" );
|
||||
|
||||
iRankIndex++;
|
||||
}
|
||||
|
||||
this->SortByDrawOrder();
|
||||
}
|
||||
|
||||
void ScreenEvaluationMultiplayer::HandleScreenMessage( const ScreenMessage SM )
|
||||
{
|
||||
ScreenWithMenuElements::HandleScreenMessage( SM );
|
||||
}
|
||||
|
||||
static LocalizedString ONLY_PLAYER_1_CAN_CONTINUE ("ScreenJoinMultiplayer", "Only Player 1 can continue.");
|
||||
void ScreenEvaluationMultiplayer::Input( const InputEventPlus &input )
|
||||
{
|
||||
if( this->IsTransitioning() )
|
||||
return;
|
||||
|
||||
if( input.type == IET_FIRST_PRESS &&
|
||||
input.DeviceI.device >= DEVICE_JOY1 &&
|
||||
input.DeviceI.device < DEVICE_JOY1 + NUM_MultiPlayer &&
|
||||
input.MenuI.IsValid() )
|
||||
{
|
||||
switch( input.MenuI.button )
|
||||
{
|
||||
case MENU_BUTTON_START:
|
||||
if( input.mp != MultiPlayer_1 )
|
||||
{
|
||||
SCREENMAN->SystemMessage( ONLY_PLAYER_1_CAN_CONTINUE );
|
||||
SCREENMAN->PlayInvalidSound();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( INPUTMAPPER->IsButtonDown( MenuInput(PLAYER_1,MENU_BUTTON_LEFT) ) &&
|
||||
INPUTMAPPER->IsButtonDown( MenuInput(PLAYER_1,MENU_BUTTON_DOWN) ) )
|
||||
{
|
||||
StepMania::ResetGame();
|
||||
SCREENMAN->SetNewScreen( CommonMetrics::INITIAL_SCREEN );
|
||||
}
|
||||
|
||||
MenuStart( GAMESTATE->m_MasterPlayerNumber );
|
||||
}
|
||||
return; // input handled
|
||||
}
|
||||
}
|
||||
|
||||
ScreenWithMenuElements::Input( input );
|
||||
}
|
||||
|
||||
void ScreenEvaluationMultiplayer::Update( float fDeltaTime )
|
||||
{
|
||||
ScreenWithMenuElements::Update(fDeltaTime);
|
||||
}
|
||||
|
||||
void ScreenEvaluationMultiplayer::DrawPrimitives()
|
||||
{
|
||||
ScreenWithMenuElements::DrawPrimitives();
|
||||
}
|
||||
|
||||
void ScreenEvaluationMultiplayer::MenuBack( PlayerNumber pn )
|
||||
{
|
||||
MenuStart( pn );
|
||||
}
|
||||
|
||||
void ScreenEvaluationMultiplayer::MenuStart( PlayerNumber pn )
|
||||
{
|
||||
|
||||
this->StartTransitioningScreen( SM_GoToNextScreen );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2005 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,70 +0,0 @@
|
||||
#ifndef ScreenEvaluationMultiplayer_H
|
||||
#define ScreenEvaluationMultiplayer_H
|
||||
|
||||
#include "ScreenWithMenuElements.h"
|
||||
|
||||
class MultiplayerEvalScoreRow;
|
||||
|
||||
enum MultiplayerJudgeLine
|
||||
{
|
||||
MultiplayerJudgeLine_W1,
|
||||
MultiplayerJudgeLine_W2,
|
||||
MultiplayerJudgeLine_W3,
|
||||
MultiplayerJudgeLine_W4,
|
||||
MultiplayerJudgeLine_W5,
|
||||
MultiplayerJudgeLine_Miss,
|
||||
MultiplayerJudgeLine_Held,
|
||||
NUM_MultiplayerJudgeLine,
|
||||
MultiplayerJudgeLine_INVALID
|
||||
};
|
||||
|
||||
class ScreenEvaluationMultiplayer : public ScreenWithMenuElements
|
||||
{
|
||||
public:
|
||||
ScreenEvaluationMultiplayer();
|
||||
~ScreenEvaluationMultiplayer();
|
||||
virtual void Init();
|
||||
|
||||
virtual void Input( const InputEventPlus &input );
|
||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||
virtual void Update(float f);
|
||||
virtual void DrawPrimitives();
|
||||
|
||||
protected:
|
||||
void MenuBack( PlayerNumber pn );
|
||||
void MenuStart( PlayerNumber pn );
|
||||
|
||||
ActorFrame m_frameLabels;
|
||||
AutoActor m_sprJudgmentLabel[NUM_MultiplayerJudgeLine];
|
||||
|
||||
vector<AutoActor> m_vsprBullet;
|
||||
vector<MultiplayerEvalScoreRow*> m_vpMultiplayerEvalScoreRow;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2005 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "ScreenGameplayMultiplayer.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenGameplayMultiplayer );
|
||||
|
||||
void ScreenGameplayMultiplayer::Init()
|
||||
{
|
||||
ScreenGameplay::Init();
|
||||
}
|
||||
|
||||
void ScreenGameplayMultiplayer::FillPlayerInfo( vector<PlayerInfo> &vPlayerInfoOut )
|
||||
{
|
||||
vPlayerInfoOut.resize( NUM_MultiPlayer+1 );
|
||||
FOREACH_MultiPlayer( p )
|
||||
vPlayerInfoOut[p].Load( PLAYER_INVALID, p, false );
|
||||
PlayerInfo &pi = vPlayerInfoOut.back();
|
||||
pi.LoadDummyP1(); // dummy autoplay NoteField
|
||||
};
|
||||
|
||||
void ScreenGameplayMultiplayer::LoadNextSong()
|
||||
{
|
||||
ScreenGameplay::LoadNextSong();
|
||||
|
||||
ASSERT( !m_vPlayerInfo.empty() );
|
||||
int iIndex = m_vPlayerInfo.size()-1;
|
||||
PlayerInfo &pi = m_vPlayerInfo[iIndex];
|
||||
//pi.LoadDummyP1(); // dummy autoplay NoteField
|
||||
pi.m_PlayerStateDummy = *GAMESTATE->m_pPlayerState[PLAYER_1];
|
||||
pi.m_PlayerStateDummy.m_PlayerController = PC_AUTOPLAY;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2005 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,43 +0,0 @@
|
||||
/* ScreenGameplayMultiplayer - The music plays, the notes scroll, and the Player is pressing buttons. */
|
||||
|
||||
#ifndef ScreenGameplayMultiplayer_H
|
||||
#define ScreenGameplayMultiplayer_H
|
||||
|
||||
#include "ScreenGameplay.h"
|
||||
|
||||
class LyricsLoader;
|
||||
class ScreenGameplayMultiplayer : public ScreenGameplay
|
||||
{
|
||||
public:
|
||||
void Init();
|
||||
virtual void FillPlayerInfo( vector<PlayerInfo> &vPlayerInfoOut );
|
||||
virtual void ScreenGameplayMultiplayer::LoadNextSong();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2005 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,276 +0,0 @@
|
||||
/*
|
||||
* Join players in perparation for ScreenGameplayMultiplayer.
|
||||
*/
|
||||
#include "global.h"
|
||||
#include "ScreenJoinMultiplayer.h"
|
||||
#include "RageInput.h"
|
||||
class Style;
|
||||
#include "GameManager.h"
|
||||
#include "GameState.h"
|
||||
#include "InputMapper.h"
|
||||
#include "GameSoundManager.h"
|
||||
#include "GameCommand.h"
|
||||
#include "ScreenPrompt.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "InputEventPlus.h"
|
||||
#include "LocalizedString.h"
|
||||
|
||||
static const char *MultiPlayerStatusNames[] = {
|
||||
"Joined",
|
||||
"NotJoined",
|
||||
"Unplugged",
|
||||
"MissingMultitap",
|
||||
};
|
||||
XToString( MultiPlayerStatus, NUM_MultiPlayerStatus );
|
||||
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenJoinMultiplayer );
|
||||
ScreenJoinMultiplayer::ScreenJoinMultiplayer()
|
||||
{
|
||||
FOREACH_MultiPlayer( p )
|
||||
{
|
||||
m_InputDeviceState[p] = InputDeviceState_INVALID;
|
||||
m_MultiPlayerStatus[p] = MultiPlayerStatus_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenJoinMultiplayer::Init()
|
||||
{
|
||||
ScreenWithMenuElements::Init();
|
||||
|
||||
GAMESTATE->m_bMultiplayer = true;
|
||||
|
||||
// Set Style to the first style (should be a one player style)
|
||||
vector<const Style*> v;
|
||||
GAMEMAN->GetStylesForGame( GAMESTATE->m_pCurGame, v, false );
|
||||
GAMESTATE->m_pCurStyle.Set( v[0] );
|
||||
|
||||
GAMESTATE->m_bTemporaryEventMode = true;
|
||||
GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
|
||||
|
||||
FOREACH_MultiPlayer( p )
|
||||
{
|
||||
GameCommand gc;
|
||||
gc.m_iIndex = p;
|
||||
|
||||
Lua *L = LUA->Get();
|
||||
gc.PushSelf( L );
|
||||
lua_setglobal( L, "ThisGameCommand" );
|
||||
LUA->Release( L );
|
||||
|
||||
m_sprPlayer[p].Load( THEME->GetPathG(m_sName, "player") );
|
||||
this->AddChild( m_sprPlayer[p] );
|
||||
|
||||
LUA->UnsetGlobal( "ThisGameCommand" );
|
||||
|
||||
m_ControllerState[p].LoadMultiPlayer( p );
|
||||
}
|
||||
|
||||
m_exprOnCommandFunction.SetFromExpression( THEME->GetMetric(m_sName,"TranformFunction") );
|
||||
|
||||
FOREACH_MultiPlayer( p )
|
||||
{
|
||||
PositionItem( m_sprPlayer[p], p, NUM_MultiPlayer );
|
||||
PositionItem( &m_ControllerState[p], p, NUM_MultiPlayer );
|
||||
m_ControllerState[p].AddX( -30 );
|
||||
m_ControllerState[p].AddY( 30 );
|
||||
|
||||
this->AddChild( &m_ControllerState[p] );
|
||||
}
|
||||
|
||||
m_soundPlugIn.Load( THEME->GetPathS(m_sName,"PlugIn") );
|
||||
m_soundUnplug.Load( THEME->GetPathS(m_sName,"Unplug") );
|
||||
m_soundJoin.Load( THEME->GetPathS(m_sName,"Join") );
|
||||
m_soundUnjoin.Load( THEME->GetPathS(m_sName,"Unjoin") );
|
||||
|
||||
UpdatePlayerStatus( true );
|
||||
}
|
||||
|
||||
void ScreenJoinMultiplayer::PositionItem( Actor *pActor, int iItemIndex, int iNumItems )
|
||||
{
|
||||
Lua *L = LUA->Get();
|
||||
m_exprOnCommandFunction.PushSelf( L );
|
||||
ASSERT( !lua_isnil(L, -1) );
|
||||
pActor->PushSelf( L );
|
||||
LuaHelpers::Push( iItemIndex, L );
|
||||
LuaHelpers::Push( iNumItems, L );
|
||||
lua_call( L, 3, 0 ); // 3 args, 0 results
|
||||
LUA->Release(L);
|
||||
}
|
||||
|
||||
void ScreenJoinMultiplayer::HandleScreenMessage( const ScreenMessage SM )
|
||||
{
|
||||
ScreenWithMenuElements::HandleScreenMessage( SM );
|
||||
}
|
||||
|
||||
static LocalizedString ONLY_PLAYER_1_CAN_START ("ScreenJoinMultiplayer", "Only Player 1 can start the game.");
|
||||
void ScreenJoinMultiplayer::Input( const InputEventPlus &input )
|
||||
{
|
||||
if( this->IsTransitioning() )
|
||||
return;
|
||||
|
||||
if( input.type == IET_FIRST_PRESS &&
|
||||
input.DeviceI.device >= DEVICE_JOY1 &&
|
||||
input.DeviceI.device < DEVICE_JOY1 + NUM_MultiPlayer &&
|
||||
input.MenuI.IsValid() )
|
||||
{
|
||||
MultiPlayerStatus old = m_MultiPlayerStatus[input.mp];
|
||||
|
||||
switch( input.MenuI.button )
|
||||
{
|
||||
case MENU_BUTTON_UP:
|
||||
if( old == MultiPlayerStatus_NotJoined )
|
||||
{
|
||||
m_soundJoin.Play();
|
||||
m_MultiPlayerStatus[input.mp] = MultiPlayerStatus_Joined;
|
||||
m_sprPlayer[input.mp]->PlayCommand( MultiPlayerStatusToString(m_MultiPlayerStatus[input.mp]) );
|
||||
}
|
||||
return; // input handled
|
||||
case MENU_BUTTON_DOWN:
|
||||
if( old == MultiPlayerStatus_Joined )
|
||||
{
|
||||
m_soundUnjoin.Play();
|
||||
m_MultiPlayerStatus[input.mp] = MultiPlayerStatus_NotJoined;
|
||||
m_sprPlayer[input.mp]->PlayCommand( MultiPlayerStatusToString(m_MultiPlayerStatus[input.mp]) );
|
||||
}
|
||||
return; // input handled
|
||||
case MENU_BUTTON_BACK:
|
||||
//MenuBack( GAMESTATE->m_MasterPlayerNumber );
|
||||
return; // input handled
|
||||
case MENU_BUTTON_START:
|
||||
if( input.mp != MultiPlayer_1 )
|
||||
{
|
||||
SCREENMAN->SystemMessage( ONLY_PLAYER_1_CAN_START );
|
||||
SCREENMAN->PlayInvalidSound();
|
||||
}
|
||||
else
|
||||
{
|
||||
MenuStart( GAMESTATE->m_MasterPlayerNumber );
|
||||
}
|
||||
return; // input handled
|
||||
}
|
||||
}
|
||||
|
||||
ScreenWithMenuElements::Input( input );
|
||||
}
|
||||
|
||||
void ScreenJoinMultiplayer::Update( float fDeltaTime )
|
||||
{
|
||||
ScreenWithMenuElements::Update(fDeltaTime);
|
||||
|
||||
UpdatePlayerStatus( false );
|
||||
}
|
||||
|
||||
void ScreenJoinMultiplayer::DrawPrimitives()
|
||||
{
|
||||
ScreenWithMenuElements::DrawPrimitives();
|
||||
}
|
||||
|
||||
void ScreenJoinMultiplayer::UpdatePlayerStatus( bool bFirstUpdate )
|
||||
{
|
||||
FOREACH_MultiPlayer( p )
|
||||
{
|
||||
InputDeviceState idsOld = m_InputDeviceState[p];
|
||||
bool bWasConnected = idsOld == InputDeviceState_Connected;
|
||||
|
||||
// DEBUG
|
||||
//InputDevice id = InputMapper::MultiPlayerToInputDevice( p );
|
||||
//InputDeviceState idsNew = INPUTMAN->GetInputDeviceState(id);
|
||||
InputDeviceState idsNew = InputDeviceState_Connected;
|
||||
if( INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD,KEY_RSHIFT)) )
|
||||
idsNew = InputDeviceState_Disconnected;
|
||||
bool bIsConnected = idsNew == InputDeviceState_Connected;
|
||||
|
||||
MultiPlayerStatus &mps = m_MultiPlayerStatus[p];
|
||||
|
||||
if( bFirstUpdate || idsOld != idsNew )
|
||||
{
|
||||
switch( idsNew )
|
||||
{
|
||||
default:
|
||||
ASSERT(0);
|
||||
case InputDeviceState_Connected:
|
||||
mps = MultiPlayerStatus_NotJoined;
|
||||
break;
|
||||
case InputDeviceState_INVALID:
|
||||
case InputDeviceState_Disconnected:
|
||||
mps = MultiPlayerStatus_Unplugged;
|
||||
break;
|
||||
case InputDeviceState_MissingMultitap:
|
||||
mps = MultiPlayerStatus_MissingMultitap;
|
||||
break;
|
||||
}
|
||||
|
||||
m_sprPlayer[p]->PlayCommand( MultiPlayerStatusToString(mps) );
|
||||
|
||||
if( idsOld == InputDeviceState_INVALID )
|
||||
{
|
||||
m_sprPlayer[p]->FinishTweening();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !bWasConnected && bIsConnected )
|
||||
m_soundPlugIn.Play();
|
||||
else if( bWasConnected && !bIsConnected )
|
||||
m_soundUnplug.Play();
|
||||
}
|
||||
}
|
||||
|
||||
m_InputDeviceState[p] = idsNew;
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenJoinMultiplayer::MenuBack( PlayerNumber pn )
|
||||
{
|
||||
SOUND->StopMusic();
|
||||
Cancel( SM_GoToPrevScreen );
|
||||
}
|
||||
|
||||
static LocalizedString JOIN_2_OR_MORE_PLAYERS ("ScreenJoinMultiplayer", "You must join 2 or more players before continuing.");
|
||||
void ScreenJoinMultiplayer::MenuStart( PlayerNumber pn )
|
||||
{
|
||||
int iNumJoinedPlayers = 0;
|
||||
FOREACH_MultiPlayer( p )
|
||||
{
|
||||
bool bJoined = m_MultiPlayerStatus[p] == MultiPlayerStatus_Joined;
|
||||
GAMESTATE->m_bIsMultiPlayerJoined[p] = bJoined;
|
||||
if( bJoined )
|
||||
iNumJoinedPlayers++;
|
||||
}
|
||||
|
||||
SCREENMAN->PlayStartSound();
|
||||
|
||||
if( iNumJoinedPlayers < 2 )
|
||||
{
|
||||
ScreenPrompt::Prompt( SM_None, JOIN_2_OR_MORE_PLAYERS );
|
||||
return;
|
||||
}
|
||||
|
||||
this->StartTransitioningScreen( SM_GoToNextScreen );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2005 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,78 +0,0 @@
|
||||
#ifndef ScreenJoinMultiplayer_H
|
||||
#define ScreenJoinMultiplayer_H
|
||||
|
||||
#include "ScreenWithMenuElements.h"
|
||||
#include "RageSound.h"
|
||||
#include "ControllerStateDisplay.h"
|
||||
|
||||
enum MultiPlayerStatus
|
||||
{
|
||||
MultiPlayerStatus_Joined,
|
||||
MultiPlayerStatus_NotJoined,
|
||||
MultiPlayerStatus_Unplugged,
|
||||
MultiPlayerStatus_MissingMultitap,
|
||||
NUM_MultiPlayerStatus,
|
||||
MultiPlayerStatus_INVALID
|
||||
};
|
||||
const RString& MultiPlayerStatusToString( MultiPlayerStatus i );
|
||||
|
||||
|
||||
class ScreenJoinMultiplayer : public ScreenWithMenuElements
|
||||
{
|
||||
public:
|
||||
ScreenJoinMultiplayer();
|
||||
virtual void Init();
|
||||
|
||||
virtual void Input( const InputEventPlus &input );
|
||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||
virtual void Update(float f);
|
||||
virtual void DrawPrimitives();
|
||||
|
||||
protected:
|
||||
void UpdatePlayerStatus( bool bFirstUpdate );
|
||||
void PositionItem( Actor *pActor, int iItemIndex, int iNumItems );
|
||||
|
||||
virtual void MenuBack( PlayerNumber pn );
|
||||
virtual void MenuStart( PlayerNumber pn );
|
||||
|
||||
InputDeviceState m_InputDeviceState[NUM_MultiPlayer];
|
||||
MultiPlayerStatus m_MultiPlayerStatus[NUM_MultiPlayer];
|
||||
|
||||
AutoActor m_sprPlayer[NUM_MultiPlayer];
|
||||
ControllerStateDisplay m_ControllerState[NUM_MultiPlayer];
|
||||
|
||||
LuaExpression m_exprOnCommandFunction; // params: self,itemIndex,numItems
|
||||
|
||||
RageSound m_soundPlugIn;
|
||||
RageSound m_soundUnplug;
|
||||
RageSound m_soundJoin;
|
||||
RageSound m_soundUnjoin;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2005 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
@@ -319,12 +319,6 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath="ScreenEvaluation.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScreenEvaluationMultiplayer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScreenEvaluationMultiplayer.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenExit.cpp">
|
||||
</File>
|
||||
@@ -355,12 +349,6 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath=".\ScreenGameplayLesson.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenGameplayMultiplayer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenGameplayMultiplayer.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScreenGameplayNormal.cpp">
|
||||
</File>
|
||||
@@ -385,12 +373,6 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath="ScreenInstructions.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScreenJoinMultiplayer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScreenJoinMultiplayer.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenJukebox.cpp">
|
||||
</File>
|
||||
@@ -2065,12 +2047,6 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath=".\Player.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PlayerScoreList.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PlayerScoreList.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ReceptorArrow.cpp">
|
||||
</File>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 60000
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
@@ -55,14 +55,14 @@ BSC32=bscmake.exe
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 $(intdir)\verstub.obj kernel32.lib shell32.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
|
||||
# SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
|
||||
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"../Program/StepMania-debug.exe"
|
||||
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"../../stepmania/Program/StepMania-debug.exe"
|
||||
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
|
||||
# Begin Special Build Tool
|
||||
IntDir=.\../Debug6
|
||||
TargetDir=\cvs\stepmania\Program
|
||||
TargetName=StepMania-debug
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -99,7 +99,7 @@ IntDir=.\../Release6
|
||||
TargetDir=\cvs\stepmania\Program
|
||||
TargetName=StepMania
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -2266,14 +2266,6 @@ SOURCE=.\Player.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PlayerScoreList.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PlayerScoreList.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ReceptorArrow.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -2756,14 +2748,6 @@ SOURCE=.\ScreenEvaluation.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenEvaluationMultiplayer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenEvaluationMultiplayer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenExit.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -2804,14 +2788,6 @@ SOURCE=.\ScreenGameplayLesson.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenGameplayMultiplayer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenGameplayMultiplayer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenGameplayNormal.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -2844,14 +2820,6 @@ SOURCE=.\ScreenInstructions.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenJoinMultiplayer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenJoinMultiplayer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenJukebox.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
Reference in New Issue
Block a user