Files
itgmania212121/stepmania/src/ScreenMusicScroll.cpp
T

164 lines
4.3 KiB
C++
Raw Normal View History

2003-02-16 04:01:45 +00:00
#include "global.h"
2002-05-20 08:59:37 +00:00
/*
-----------------------------------------------------------------------------
Class: ScreenMusicScroll
Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ScreenMusicScroll.h"
#include "ScreenManager.h"
#include "PrefsManager.h"
#include "GameManager.h"
#include "RageLog.h"
#include "GameConstantsAndTypes.h"
#include "SongManager.h"
2003-07-26 23:05:16 +00:00
#include "RageSounds.h"
2002-07-23 01:41:40 +00:00
#include "GameState.h"
#include "ThemeManager.h"
#include "AnnouncerManager.h"
2003-11-07 20:24:44 +00:00
#include "song.h"
2002-05-20 08:59:37 +00:00
#define SCROLL_DELAY THEME->GetMetricF("ScreenMusicScroll","ScrollDelay")
#define SCROLL_SPEED THEME->GetMetricF("ScreenMusicScroll","ScrollSpeed")
#define TEXT_ZOOM THEME->GetMetricF("ScreenMusicScroll","TextZoom")
#define NEXT_SCREEN THEME->GetMetric("ScreenMusicScroll","NextScreen")
2002-05-20 08:59:37 +00:00
const CString CREDIT_LINES[] =
{
2003-04-03 22:10:40 +00:00
""
2002-05-20 08:59:37 +00:00
};
const unsigned NUM_CREDIT_LINES = sizeof(CREDIT_LINES) / sizeof(CString);
2002-05-20 08:59:37 +00:00
2003-09-27 22:30:51 +00:00
ScreenMusicScroll::ScreenMusicScroll( CString sClassName ) : Screen( sClassName )
2002-05-20 08:59:37 +00:00
{
LOG->Trace( "ScreenMusicScroll::ScreenMusicScroll()" );
2002-05-20 08:59:37 +00:00
unsigned i;
2002-09-03 06:33:08 +00:00
GAMESTATE->Reset(); // so that credits message for both players will show
2002-05-20 08:59:37 +00:00
m_Background.LoadFromAniDir( THEME->GetPathToB("ScreenMusicScroll background") );
this->AddChild( &m_Background );
2002-05-20 08:59:37 +00:00
vector<Song*> arraySongs;
SONGMAN->GetSongs( arraySongs );
2002-05-20 08:59:37 +00:00
SortSongPointerArrayByTitle( arraySongs );
2003-05-30 20:39:40 +00:00
for( i=0; i < arraySongs.size(); i++ )
2002-05-20 08:59:37 +00:00
{
2003-05-30 20:39:40 +00:00
BitmapText *bt = new BitmapText;
m_textLines.push_back(bt);
2002-05-20 08:59:37 +00:00
Song* pSong = arraySongs[i];
2003-05-30 20:39:40 +00:00
bt->LoadFromFont( THEME->GetPathToF("ScreenMusicScroll titles") );
bt->SetText( pSong->GetFullDisplayTitle(), pSong->GetFullTranslitTitle() );
bt->SetDiffuse( SONGMAN->GetSongColor(pSong) );
bt->SetZoom( TEXT_ZOOM );
2002-05-20 08:59:37 +00:00
}
2003-04-03 22:10:40 +00:00
// for( i=0; i<min(NUM_CREDIT_LINES, MAX_CREDIT_LINES); i++ )
// {
// m_textLines[m_iNumLines].LoadFromFont( THEME->GetPathToF("ScreenMusicScroll titles") );
2003-04-03 22:10:40 +00:00
// m_textLines[m_iNumLines].SetText( CREDIT_LINES[i] );
// m_textLines[m_iNumLines].SetZoom( TEXT_ZOOM );
//
// m_iNumLines++;
// }
2002-05-20 08:59:37 +00:00
2003-05-30 20:39:40 +00:00
for( i=0; i<m_textLines.size(); i++ )
2002-05-20 08:59:37 +00:00
{
2003-05-30 20:39:40 +00:00
m_textLines[i]->SetXY( CENTER_X, SCREEN_BOTTOM + 40 );
m_textLines[i]->BeginTweening( SCROLL_DELAY * i );
m_textLines[i]->BeginTweening( 2.0f*SCROLL_SPEED );
m_textLines[i]->SetXY( CENTER_X, SCREEN_TOP - 40 );
2002-05-20 08:59:37 +00:00
}
2003-03-25 21:17:29 +00:00
this->PostScreenMessage( SM_BeginFadingOut, 0.2f * i + 3.0f );
2002-05-20 08:59:37 +00:00
m_In.Load( THEME->GetPathToB("ScreenMusicScroll in") );
2003-03-14 22:34:28 +00:00
// this->AddChild( &m_In ); // draw and update manually
m_In.StartTransitioning();
m_Out.Load( THEME->GetPathToB("ScreenMusicScroll out") );
2003-03-14 22:34:28 +00:00
// this->AddChild( &m_Out ); // draw and update manually
2002-05-20 08:59:37 +00:00
2003-07-26 23:05:16 +00:00
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("music scroll") );
2002-05-20 08:59:37 +00:00
2003-07-26 23:05:16 +00:00
SOUND->PlayMusic( THEME->GetPathToS("ScreenMusicScroll music") );
2002-05-20 08:59:37 +00:00
}
void ScreenMusicScroll::Update( float fDeltaTime )
{
2003-05-30 20:39:40 +00:00
for( unsigned i=0; i<m_textLines.size(); i++ )
m_textLines[i]->Update( fDeltaTime );
2003-03-14 22:34:28 +00:00
m_In.Update( fDeltaTime );
m_Out.Update( fDeltaTime );
Screen::Update( fDeltaTime );
2002-05-20 08:59:37 +00:00
}
void ScreenMusicScroll::DrawPrimitives()
{
Screen::DrawPrimitives();
2003-05-30 20:39:40 +00:00
for( unsigned i=0; i<m_textLines.size(); i++ )
2002-05-20 08:59:37 +00:00
{
2003-05-30 20:39:40 +00:00
if( m_textLines[i]->GetY() > SCREEN_TOP-20 &&
m_textLines[i]->GetY() < SCREEN_BOTTOM+20 )
m_textLines[i]->Draw();
2002-05-20 08:59:37 +00:00
}
2003-03-14 22:34:28 +00:00
m_In.Draw(); // render it again so it shows over the text
m_Out.Draw(); // render it again so it shows over the text
2002-05-20 08:59:37 +00:00
}
void ScreenMusicScroll::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
2003-03-14 22:34:28 +00:00
// LOG->Trace( "ScreenMusicScroll::Input()" );
2002-05-20 08:59:37 +00:00
2003-03-14 22:34:28 +00:00
if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
2002-05-20 08:59:37 +00:00
return;
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler
}
void ScreenMusicScroll::HandleScreenMessage( const ScreenMessage SM )
{
switch( SM )
{
case SM_BeginFadingOut:
2003-03-14 22:34:28 +00:00
if( !m_Out.IsTransitioning() )
m_Out.StartTransitioning( SM_GoToNextScreen );
2002-05-20 08:59:37 +00:00
break;
case SM_GoToNextScreen:
2003-01-22 05:29:27 +00:00
SONGMAN->SaveMachineScoresToDisk();
SCREENMAN->SetNewScreen( NEXT_SCREEN );
2002-05-20 08:59:37 +00:00
break;
}
}
void ScreenMusicScroll::MenuStart( PlayerNumber pn )
2002-05-20 08:59:37 +00:00
{
2003-03-25 21:17:29 +00:00
this->PostScreenMessage( SM_BeginFadingOut, 0 );
2002-05-20 08:59:37 +00:00
}
void ScreenMusicScroll::MenuBack( PlayerNumber pn )
2002-05-20 08:59:37 +00:00
{
2003-03-25 21:17:29 +00:00
this->PostScreenMessage( SM_BeginFadingOut, 0 );
2002-05-20 08:59:37 +00:00
}