2004-01-07 04:37:00 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
#include "ScreenEnding.h"
|
|
|
|
|
#include "SongManager.h"
|
|
|
|
|
#include "RageSounds.h"
|
|
|
|
|
#include "ThemeManager.h"
|
|
|
|
|
#include "AnnouncerManager.h"
|
|
|
|
|
#include "song.h"
|
|
|
|
|
#include "ProfileManager.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-04-18 07:34:37 +00:00
|
|
|
#include "SongUtil.h"
|
2004-05-14 07:14:45 +00:00
|
|
|
#include "ScreenManager.h"
|
2004-06-22 08:41:25 +00:00
|
|
|
#include "PrefsManager.h"
|
|
|
|
|
#include "StageStats.h"
|
2004-01-07 04:37:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#define SCROLL_DELAY THEME->GetMetricF("ScreenEnding","ScrollDelay")
|
|
|
|
|
#define SCROLL_SPEED THEME->GetMetricF("ScreenEnding","ScrollSpeed")
|
|
|
|
|
#define TEXT_ZOOM THEME->GetMetricF("ScreenEnding","TextZoom")
|
|
|
|
|
|
|
|
|
|
|
2004-03-11 06:31:30 +00:00
|
|
|
|
2004-06-22 08:41:25 +00:00
|
|
|
CString GetStatsLineTitle( PlayerNumber pn, EndingStatsLine line )
|
2004-03-11 06:31:30 +00:00
|
|
|
{
|
2004-06-22 08:41:25 +00:00
|
|
|
switch( line )
|
|
|
|
|
{
|
|
|
|
|
case CALORIES_TODAY: return "Calories Today";
|
|
|
|
|
case CURRENT_COMBO: return "Current Combo";
|
|
|
|
|
case PERCENT_COMPLETE_EASY:
|
|
|
|
|
case PERCENT_COMPLETE_MEDIUM:
|
|
|
|
|
case PERCENT_COMPLETE_HARD:
|
|
|
|
|
case PERCENT_COMPLETE_CHALLENGE:
|
|
|
|
|
// Ugly...
|
|
|
|
|
{
|
2004-06-28 07:26:00 +00:00
|
|
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
2004-06-22 08:41:25 +00:00
|
|
|
CString sStepsType = GAMEMAN->NotesTypeToThemedString(st);
|
|
|
|
|
if( GAMESTATE->IsCourseMode() )
|
|
|
|
|
{
|
|
|
|
|
CourseDifficulty cd = (CourseDifficulty)line;
|
|
|
|
|
if( !GAMESTATE->IsCourseDifficultyShown(cd) )
|
|
|
|
|
return "";
|
|
|
|
|
CString sDifficulty = CourseDifficultyToThemedString(cd);
|
|
|
|
|
return ssprintf( "%s %% Complete", sStepsType.c_str() );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Difficulty dc = (Difficulty)line;
|
|
|
|
|
CString sDifficulty = DifficultyToThemedString(dc);
|
|
|
|
|
return ssprintf( "%s %% Complete", sStepsType.c_str() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
default: ASSERT(0); return "";
|
|
|
|
|
}
|
2004-03-11 06:31:30 +00:00
|
|
|
}
|
2004-01-07 04:37:00 +00:00
|
|
|
|
2004-06-22 08:41:25 +00:00
|
|
|
CString GetStatsLineValue( PlayerNumber pn, EndingStatsLine line )
|
2004-01-07 04:37:00 +00:00
|
|
|
{
|
|
|
|
|
Profile* pProfile = PROFILEMAN->GetProfile( pn );
|
|
|
|
|
ASSERT( pProfile );
|
|
|
|
|
|
2004-06-22 08:41:25 +00:00
|
|
|
switch( line )
|
2004-01-07 04:37:00 +00:00
|
|
|
{
|
2004-06-22 08:41:25 +00:00
|
|
|
case CALORIES_TODAY: return pProfile->GetDisplayTotalCaloriesBurned();
|
2004-05-02 18:49:41 +00:00
|
|
|
case CURRENT_COMBO: return Commify( pProfile->m_iCurrentCombo );
|
2004-06-22 08:41:25 +00:00
|
|
|
case PERCENT_COMPLETE_EASY:
|
|
|
|
|
case PERCENT_COMPLETE_MEDIUM:
|
|
|
|
|
case PERCENT_COMPLETE_HARD:
|
|
|
|
|
case PERCENT_COMPLETE_CHALLENGE:
|
|
|
|
|
// Ugly...
|
|
|
|
|
{
|
2004-06-28 07:26:00 +00:00
|
|
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
2004-06-22 08:41:25 +00:00
|
|
|
CString sStepsType = GAMEMAN->NotesTypeToThemedString(st);
|
|
|
|
|
if( GAMESTATE->IsCourseMode() )
|
|
|
|
|
{
|
|
|
|
|
CourseDifficulty cd = (CourseDifficulty)line;
|
|
|
|
|
if( !GAMESTATE->IsCourseDifficultyShown(cd) )
|
|
|
|
|
return "";
|
|
|
|
|
CString sDifficulty = CourseDifficultyToThemedString(cd);
|
|
|
|
|
return ssprintf( "%06.3f%%", pProfile->GetCoursesPercentComplete(st,cd)*100 );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Difficulty dc = (Difficulty)line;
|
|
|
|
|
CString sDifficulty = DifficultyToThemedString(dc);
|
|
|
|
|
return ssprintf( "%06.3f%%", pProfile->GetSongsPercentComplete(st,dc)*100 );
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-03-11 06:31:30 +00:00
|
|
|
default: ASSERT(0); return "";
|
2004-01-07 04:37:00 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ScreenEnding::ScreenEnding( CString sClassName ) : ScreenAttract( sClassName, false/*dont reset GAMESTATE*/ )
|
|
|
|
|
{
|
2004-06-22 08:41:25 +00:00
|
|
|
if( PREFSMAN->m_bScreenTestMode )
|
|
|
|
|
{
|
|
|
|
|
PROFILEMAN->LoadFirstAvailableProfile(PLAYER_1, false);
|
|
|
|
|
PROFILEMAN->LoadFirstAvailableProfile(PLAYER_2, false);
|
|
|
|
|
|
|
|
|
|
GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR;
|
2004-06-28 07:26:00 +00:00
|
|
|
GAMESTATE->m_pCurStyle = GAMEMAN->GameAndStringToStyle( GAME_DANCE, "versus" );
|
2004-06-22 08:41:25 +00:00
|
|
|
GAMESTATE->m_bSideIsJoined[PLAYER_1] = true;
|
|
|
|
|
GAMESTATE->m_bSideIsJoined[PLAYER_2] = true;
|
|
|
|
|
GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
|
|
|
|
|
GAMESTATE->m_pCurSong = SONGMAN->GetRandomSong();
|
|
|
|
|
GAMESTATE->m_pCurCourse = SONGMAN->GetRandomCourse();
|
|
|
|
|
GAMESTATE->m_pCurSteps[PLAYER_1] = GAMESTATE->m_pCurSong->GetAllSteps()[0];
|
|
|
|
|
GAMESTATE->m_pCurSteps[PLAYER_2] = GAMESTATE->m_pCurSong->GetAllSteps()[0];
|
|
|
|
|
g_CurStageStats.pSteps[PLAYER_1] = GAMESTATE->m_pCurSteps[PLAYER_1];
|
|
|
|
|
g_CurStageStats.pSteps[PLAYER_2] = GAMESTATE->m_pCurSteps[PLAYER_2];
|
|
|
|
|
GAMESTATE->m_PlayerOptions[PLAYER_1].m_fScrollSpeed = 2;
|
|
|
|
|
GAMESTATE->m_PlayerOptions[PLAYER_2].m_fScrollSpeed = 2;
|
|
|
|
|
GAMESTATE->m_iCurrentStageIndex = 0;
|
|
|
|
|
GAMESTATE->m_PlayerOptions[PLAYER_1].ChooseRandomMofifiers();
|
|
|
|
|
GAMESTATE->m_PlayerOptions[PLAYER_2].ChooseRandomMofifiers();
|
|
|
|
|
|
|
|
|
|
for( float f = 0; f < 100.0f; f += 1.0f )
|
|
|
|
|
{
|
|
|
|
|
float fP1 = fmodf(f/100*4+.3f,1);
|
|
|
|
|
g_CurStageStats.SetLifeRecord( PLAYER_1, fP1, f );
|
|
|
|
|
g_CurStageStats.SetLifeRecord( PLAYER_2, 1-fP1, f );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_CurStageStats.iActualDancePoints[PLAYER_1] = rand()%3;
|
|
|
|
|
g_CurStageStats.iPossibleDancePoints[PLAYER_1] = 2;
|
|
|
|
|
g_CurStageStats.iActualDancePoints[PLAYER_2] = rand()%2;
|
|
|
|
|
g_CurStageStats.iPossibleDancePoints[PLAYER_2] = 1;
|
|
|
|
|
g_CurStageStats.iCurCombo[PLAYER_1] = 0;
|
|
|
|
|
g_CurStageStats.UpdateComboList( PLAYER_1, 0, false );
|
|
|
|
|
g_CurStageStats.iCurCombo[PLAYER_1] = 1;
|
|
|
|
|
g_CurStageStats.UpdateComboList( PLAYER_1, 1, false );
|
|
|
|
|
g_CurStageStats.iCurCombo[PLAYER_1] = 50;
|
|
|
|
|
g_CurStageStats.UpdateComboList( PLAYER_1, 25, false );
|
|
|
|
|
g_CurStageStats.iCurCombo[PLAYER_1] = 250;
|
|
|
|
|
g_CurStageStats.UpdateComboList( PLAYER_1, 100, false );
|
|
|
|
|
|
|
|
|
|
g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_MARVELOUS] = rand()%2;
|
|
|
|
|
g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_PERFECT] = rand()%2;
|
|
|
|
|
g_CurStageStats.iTapNoteScores[PLAYER_1][TNS_GREAT] = rand()%2;
|
|
|
|
|
g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_MARVELOUS] = rand()%2;
|
|
|
|
|
g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_PERFECT] = rand()%2;
|
|
|
|
|
g_CurStageStats.iTapNoteScores[PLAYER_2][TNS_GREAT] = rand()%2;
|
|
|
|
|
|
|
|
|
|
g_vPlayedStageStats.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-01-07 04:37:00 +00:00
|
|
|
vector<Song*> arraySongs;
|
|
|
|
|
SONGMAN->GetSongs( arraySongs );
|
2004-04-18 07:34:37 +00:00
|
|
|
SongUtil::SortSongPointerArrayByTitle( arraySongs );
|
2004-01-07 04:37:00 +00:00
|
|
|
|
2004-05-02 18:49:41 +00:00
|
|
|
FOREACH_PlayerNumber( p )
|
2004-01-07 04:37:00 +00:00
|
|
|
{
|
|
|
|
|
m_bWaitingForRemoveCard[p] = false;
|
|
|
|
|
|
|
|
|
|
if( !GAMESTATE->IsHumanPlayer(p) )
|
|
|
|
|
continue; // skip
|
|
|
|
|
|
2004-05-02 18:49:41 +00:00
|
|
|
Profile* pProfile = PROFILEMAN->GetProfile( p );
|
2004-01-07 04:37:00 +00:00
|
|
|
|
|
|
|
|
m_textPlayerName[p].LoadFromFont( THEME->GetPathToF("ScreenEnding player name") );
|
|
|
|
|
m_textPlayerName[p].SetText( pProfile ? pProfile->GetDisplayName() : "NO CARD" );
|
|
|
|
|
m_textPlayerName[p].SetName( ssprintf("PlayerNameP%d",p+1) );
|
|
|
|
|
SET_XY_AND_ON_COMMAND( m_textPlayerName[p] );
|
|
|
|
|
this->AddChild( &m_textPlayerName[p] );
|
|
|
|
|
|
2004-06-22 08:41:25 +00:00
|
|
|
m_bWaitingForRemoveCard[p] = MEMCARDMAN->GetCardState(p)!=MEMORY_CARD_STATE_NO_CARD;
|
2004-01-07 04:37:00 +00:00
|
|
|
|
|
|
|
|
if( pProfile == NULL )
|
|
|
|
|
continue; // don't show the stats lines
|
|
|
|
|
|
2004-06-22 08:41:25 +00:00
|
|
|
FOREACH_EndingStatsLine( i )
|
2004-01-07 04:37:00 +00:00
|
|
|
{
|
2004-06-22 08:41:25 +00:00
|
|
|
m_Lines[i][p].title.LoadFromFont( THEME->GetPathToF("ScreenEnding stats title") );
|
|
|
|
|
m_Lines[i][p].title.SetText( GetStatsLineTitle(p, i) );
|
|
|
|
|
m_Lines[i][p].title.SetName( ssprintf("StatsTitleP%dLine%d",p+1,i+1) );
|
|
|
|
|
SET_XY_AND_ON_COMMAND( m_Lines[i][p].title );
|
|
|
|
|
this->AddChild( &m_Lines[i][p].title );
|
2004-01-07 04:37:00 +00:00
|
|
|
|
2004-06-22 08:41:25 +00:00
|
|
|
m_Lines[i][p].value.LoadFromFont( THEME->GetPathToF("ScreenEnding stats value") );
|
|
|
|
|
m_Lines[i][p].value.SetText( GetStatsLineValue(p, i) );
|
|
|
|
|
m_Lines[i][p].value.SetName( ssprintf("StatsValueP%dLine%d",p+1,i+1) );
|
|
|
|
|
SET_XY_AND_ON_COMMAND( m_Lines[i][p].value );
|
|
|
|
|
this->AddChild( &m_Lines[i][p].value );
|
2004-01-07 04:37:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_sprRemoveMemoryCard[p].SetName( ssprintf("RemoveCardP%d",p+1) );
|
2004-04-17 18:00:43 +00:00
|
|
|
m_sprRemoveMemoryCard[p].Load( THEME->GetPathToG(ssprintf("ScreenEnding remove card P%d",p+1)) );
|
2004-01-07 04:37:00 +00:00
|
|
|
SET_XY_AND_ON_COMMAND( m_sprRemoveMemoryCard[p] );
|
|
|
|
|
this->AddChild( &m_sprRemoveMemoryCard[p] );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this->MoveToTail( &m_In ); // put it in the back so it covers up the stuff we just added
|
|
|
|
|
this->MoveToTail( &m_Out ); // put it in the back so it covers up the stuff we just added
|
|
|
|
|
|
|
|
|
|
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("music scroll") );
|
|
|
|
|
|
|
|
|
|
// Now that we've read the data from the profile, it's ok to Reset()
|
|
|
|
|
GAMESTATE->Reset();
|
|
|
|
|
|
2004-03-24 04:05:43 +00:00
|
|
|
float fSecsUntilBeginFadingOut = m_Background.GetLengthSeconds() - m_Out.GetLengthSeconds();
|
|
|
|
|
if( fSecsUntilBeginFadingOut < 0 )
|
2004-01-07 04:37:00 +00:00
|
|
|
{
|
|
|
|
|
LOG->Warn( "Screen '%s' Out BGAnimation (%f seconds) is longer than Background BGAnimation (%f seconds); background BGA will be truncated",
|
|
|
|
|
m_sName.c_str(), m_Out.GetLengthSeconds(), m_Background.GetLengthSeconds() );
|
2004-03-24 04:05:43 +00:00
|
|
|
fSecsUntilBeginFadingOut = 0;
|
2004-01-07 04:37:00 +00:00
|
|
|
}
|
2004-03-24 04:05:43 +00:00
|
|
|
this->PostScreenMessage( SM_BeginFadingOut, fSecsUntilBeginFadingOut );
|
2004-01-07 04:37:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScreenEnding::~ScreenEnding()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenEnding::Update( float fDeltaTime )
|
|
|
|
|
{
|
|
|
|
|
ScreenAttract::Update( fDeltaTime );
|
|
|
|
|
|
2004-05-14 07:14:45 +00:00
|
|
|
if( m_In.IsTransitioning() && m_Out.IsTransitioning() )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
FOREACH_PlayerNumber( p )
|
2004-01-07 04:37:00 +00:00
|
|
|
{
|
2004-05-14 07:14:45 +00:00
|
|
|
if( m_bWaitingForRemoveCard[p] )
|
2004-01-07 04:37:00 +00:00
|
|
|
{
|
2004-06-22 08:41:25 +00:00
|
|
|
m_bWaitingForRemoveCard[p] = MEMCARDMAN->GetCardState(p)!=MEMORY_CARD_STATE_NO_CARD;
|
2004-05-14 07:14:45 +00:00
|
|
|
if( !m_bWaitingForRemoveCard[p] )
|
|
|
|
|
m_sprRemoveMemoryCard[p].SetHidden( true );
|
2004-01-07 04:37:00 +00:00
|
|
|
}
|
2004-01-11 09:26:01 +00:00
|
|
|
}
|
2004-01-07 04:37:00 +00:00
|
|
|
}
|
|
|
|
|
|
2004-05-14 07:14:45 +00:00
|
|
|
void ScreenEnding::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
|
|
|
|
{
|
2004-05-16 20:01:15 +00:00
|
|
|
bool bIsTransitioning = m_In.IsTransitioning() || m_Out.IsTransitioning();
|
|
|
|
|
if( MenuI.IsValid() && !bIsTransitioning )
|
2004-05-14 07:14:45 +00:00
|
|
|
{
|
|
|
|
|
switch( MenuI.button )
|
|
|
|
|
{
|
|
|
|
|
case MENU_BUTTON_START:
|
|
|
|
|
SCREENMAN->PostMessageToTopScreen( SM_BeginFadingOut, 0 );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScreenAttract::Input( DeviceI, type, GameI, MenuI, StyleI );
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-07 04:37:00 +00:00
|
|
|
void ScreenEnding::HandleScreenMessage( const ScreenMessage SM )
|
|
|
|
|
{
|
|
|
|
|
ScreenAttract::HandleScreenMessage( SM );
|
2004-01-11 22:42:11 +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.
|
|
|
|
|
*/
|