Files
itgmania212121/stepmania/src/ScreenEnding.cpp
T

158 lines
6.2 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 );
2006-01-15 19:18:57 +00:00
ScreenEnding::ScreenEnding() : ScreenAttract( false/*dont reset GAMESTATE*/ )
{
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 );
2005-05-07 08:34:20 +00:00
GAMESTATE->m_pCurStyle.Set( GAMEMAN->GameAndStringToStyle( GAMEMAN->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].vpPlayedSteps.push_back( GAMESTATE->m_pCurSteps[PLAYER_1] );
STATSMAN->m_CurStageStats.m_player[PLAYER_2].vpPlayedSteps.push_back( GAMESTATE->m_pCurSteps[PLAYER_2] );
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;
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].iActualDancePoints = RandomInt( 3 );
2005-02-16 03:25:45 +00:00
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iPossibleDancePoints = 2;
STATSMAN->m_CurStageStats.m_player[PLAYER_2].iActualDancePoints = RandomInt( 2 );
2005-02-16 03:25:45 +00:00
STATSMAN->m_CurStageStats.m_player[PLAYER_2].iPossibleDancePoints = 1;
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 0;
STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 0, false );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 1;
STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 1, false );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 50;
STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 25, false );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 250;
STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 100, false );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_W1] = RandomInt( 2 );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_W2] = RandomInt( 2 );
STATSMAN->m_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_W3] = RandomInt( 2 );
STATSMAN->m_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_W1] = RandomInt( 2 );
STATSMAN->m_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_W2] = RandomInt( 2 );
STATSMAN->m_CurStageStats.m_player[PLAYER_2].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
}
// Update final profile stats before we load them for display.
GAMESTATE->FinishStage();
}
void ScreenEnding::Init()
{
ScreenAttract::Init();
vector<Song*> arraySongs;
SONGMAN->GetSongs( arraySongs );
SongUtil::SortSongPointerArrayByTitle( arraySongs );
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:
m_sprRemoveMemoryCard[p].SetHidden( true );
break;
}
SET_XY_AND_ON_COMMAND( m_sprRemoveMemoryCard[p] );
m_sprRemoveMemoryCard[p].AddCommand( ssprintf("CardRemovedP%dMessage",p+1), ActorUtil::ParseActorCommands("hidden,1") );
this->AddChild( &m_sprRemoveMemoryCard[p] );
}
2005-05-06 06:34:18 +00:00
this->SortByDrawOrder();
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
{
case MENU_BUTTON_START:
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.
*/