Files
itgmania212121/stepmania/src/ScreenEnding.cpp
T

150 lines
6.1 KiB
C++
Raw Normal View History

#include "global.h"
#include "ScreenEnding.h"
2005-07-20 09:48:19 +00:00
#include "ScreenManager.h"
#include "SongManager.h"
2004-07-08 00:10:34 +00:00
#include "GameSoundManager.h"
#include "ThemeManager.h"
#include "AnnouncerManager.h"
#include "Song.h"
#include "ProfileManager.h"
2005-07-01 05:07:22 +00:00
#include "Profile.h"
#include "ActorUtil.h"
#include "GameState.h"
#include "MemoryCardManager.h"
#include "RageLog.h"
2004-06-28 07:26:00 +00:00
#include "Style.h"
2004-03-11 06:31:30 +00:00
#include "GameManager.h"
2004-06-22 08:41:25 +00:00
#include "PrefsManager.h"
2005-02-16 03:25:45 +00:00
#include "StatsManager.h"
#include "PlayerState.h"
2005-03-10 19:57:43 +00:00
#include "CommonMetrics.h"
#include "InputEventPlus.h"
2006-01-15 20:46:15 +00:00
REGISTER_SCREEN_CLASS( ScreenEnding );
2007-06-03 22:27:27 +00:00
ScreenEnding::ScreenEnding()
{
2004-06-22 08:41:25 +00:00
if( PREFSMAN->m_bScreenTestMode )
{
PROFILEMAN->LoadFirstAvailableProfile(PLAYER_1);
PROFILEMAN->LoadFirstAvailableProfile(PLAYER_2);
2004-06-22 08:41:25 +00:00
2005-07-25 03:59:24 +00:00
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
2008-03-24 12:50:16 +00:00
GAMESTATE->SetCurrentStyle( GameManager::GameAndStringToStyle( GameManager::GetDefaultGame(),"versus") );
GAMESTATE->JoinPlayer( PLAYER_1 );
GAMESTATE->JoinPlayer( PLAYER_2 );
GAMESTATE->m_pCurSong.Set( SONGMAN->GetRandomSong() );
2005-05-18 07:14:19 +00:00
GAMESTATE->m_pCurCourse.Set( SONGMAN->GetRandomCourse() );
GAMESTATE->m_pCurSteps[PLAYER_1].Set( GAMESTATE->m_pCurSong->GetAllSteps()[0] );
GAMESTATE->m_pCurSteps[PLAYER_2].Set( GAMESTATE->m_pCurSong->GetAllSteps()[0] );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].m_vpPossibleSteps.push_back( GAMESTATE->m_pCurSteps[PLAYER_1] );
STATSMAN->m_CurStageStats.m_player[PLAYER_2].m_vpPossibleSteps.push_back( GAMESTATE->m_pCurSteps[PLAYER_2] );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].m_iStepsPlayed = 1;
STATSMAN->m_CurStageStats.m_player[PLAYER_2].m_iStepsPlayed = 1;
PO_GROUP_ASSIGN( GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions, ModsLevel_Stage, m_fScrollSpeed, 2.0f );
PO_GROUP_ASSIGN( GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions, ModsLevel_Stage, m_fScrollSpeed, 2.0f );
2004-06-22 08:41:25 +00:00
GAMESTATE->m_iCurrentStageIndex = 0;
FOREACH_ENUM( PlayerNumber, p )
2007-04-25 03:50:17 +00:00
GAMESTATE->m_iPlayerStageTokens[p] = 1;
PO_GROUP_CALL( GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions, ModsLevel_Stage, ChooseRandomModifiers );
PO_GROUP_CALL( GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions, ModsLevel_Stage, ChooseRandomModifiers );
2004-06-22 08:41:25 +00:00
for( float f = 0; f < 100.0f; f += 1.0f )
{
float fP1 = fmodf(f/100*4+.3f,1);
2005-02-16 03:25:45 +00:00
STATSMAN->m_CurStageStats.m_player[PLAYER_1].SetLifeRecordAt( fP1, f );
STATSMAN->m_CurStageStats.m_player[PLAYER_2].SetLifeRecordAt( 1-fP1, f );
2004-06-22 08:41:25 +00:00
}
STATSMAN->m_CurStageStats.m_player[PLAYER_1].m_iActualDancePoints = RandomInt( 3 );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].m_iPossibleDancePoints = 2;
STATSMAN->m_CurStageStats.m_player[PLAYER_2].m_iActualDancePoints = RandomInt( 2 );
STATSMAN->m_CurStageStats.m_player[PLAYER_2].m_iPossibleDancePoints = 1;
STATSMAN->m_CurStageStats.m_player[PLAYER_1].m_iCurCombo = 0;
2005-02-16 03:25:45 +00:00
STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 0, false );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].m_iCurCombo = 1;
2005-02-16 03:25:45 +00:00
STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 1, false );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].m_iCurCombo = 50;
2005-02-16 03:25:45 +00:00
STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 25, false );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].m_iCurCombo = 250;
2005-02-16 03:25:45 +00:00
STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 100, false );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].m_iTapNoteScores[TNS_W1] = RandomInt( 2 );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].m_iTapNoteScores[TNS_W2] = RandomInt( 2 );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].m_iTapNoteScores[TNS_W3] = RandomInt( 2 );
STATSMAN->m_CurStageStats.m_player[PLAYER_2].m_iTapNoteScores[TNS_W1] = RandomInt( 2 );
STATSMAN->m_CurStageStats.m_player[PLAYER_2].m_iTapNoteScores[TNS_W2] = RandomInt( 2 );
STATSMAN->m_CurStageStats.m_player[PLAYER_2].m_iTapNoteScores[TNS_W3] = RandomInt( 2 );
2005-02-16 03:25:45 +00:00
STATSMAN->m_vPlayedStageStats.clear();
2004-06-22 08:41:25 +00:00
}
}
void ScreenEnding::Init()
{
ScreenAttract::Init();
FOREACH_HumanPlayer( p )
{
2006-03-15 01:31:55 +00:00
if( !PROFILEMAN->IsPersistentProfile(p) )
continue;
m_sprRemoveMemoryCard[p].SetName( ssprintf("RemoveCardP%d",p+1) );
2005-02-06 03:32:53 +00:00
m_sprRemoveMemoryCard[p].Load( THEME->GetPathG("ScreenEnding",ssprintf("remove card P%d",p+1)) );
switch( MEMCARDMAN->GetCardState(p) )
{
2005-12-01 03:20:25 +00:00
case MemoryCardState_Removed:
case MemoryCardState_NoCard:
2007-02-13 06:32:26 +00:00
m_sprRemoveMemoryCard[p].SetVisible( false );
break;
}
2007-02-19 09:30:07 +00:00
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_sprRemoveMemoryCard[p] );
this->AddChild( &m_sprRemoveMemoryCard[p] );
}
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("music scroll") );
// Now that we've read the data from the profile, it's ok to Reset()
GAMESTATE->Reset();
}
void ScreenEnding::Input( const InputEventPlus &input )
2004-05-14 07:14:45 +00:00
{
if( !IsTransitioning() )
2004-05-14 07:14:45 +00:00
{
2006-09-14 20:52:34 +00:00
switch( input.MenuI )
2004-05-14 07:14:45 +00:00
{
2008-05-21 05:36:09 +00:00
case GAME_BUTTON_START:
2004-05-14 07:14:45 +00:00
SCREENMAN->PostMessageToTopScreen( SM_BeginFadingOut, 0 );
break;
}
}
ScreenAttract::Input( input );
2004-05-14 07:14:45 +00:00
}
2004-06-08 05:22:33 +00:00
/*
* (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.
*/