Files
itgmania212121/stepmania/src/ScreenTitleMenu.cpp
T

355 lines
9.8 KiB
C++
Raw Normal View History

2002-05-20 08:59:37 +00:00
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
2002-05-28 20:01:22 +00:00
Class: ScreenTitleMenu
2002-05-20 08:59:37 +00:00
2002-05-28 20:01:22 +00:00
Desc: See header.
2002-05-20 08:59:37 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
2002-05-28 20:01:22 +00:00
Chris Danford
2002-05-20 08:59:37 +00:00
-----------------------------------------------------------------------------
*/
#include "ScreenTitleMenu.h"
#include "ScreenManager.h"
#include "ScreenCaution.h"
#include "ScreenMapInstruments.h"
#include "ScreenGameOptions.h"
#include "ScreenEdit.h"
#include "GameConstantsAndTypes.h"
#include "RageUtil.h"
#include "StepMania.h"
#include "ThemeManager.h"
#include "ScreenEditMenu.h"
#include "ScreenSelectStyle.h"
#include "ScreenSelectGame.h"
2002-07-11 19:02:26 +00:00
#include "ScreenAppearanceOptions.h"
2002-05-20 08:59:37 +00:00
#include "RageLog.h"
#include "SongManager.h"
#include "AnnouncerManager.h"
2002-06-23 11:43:53 +00:00
#include "ScreenEz2SelectPlayer.h"
2002-06-14 22:25:22 +00:00
2002-05-28 20:01:22 +00:00
#include "GameManager.h"
2002-05-20 08:59:37 +00:00
//
// Defines specific to ScreenTitleMenu
//
const CString CHOICE_TEXT[ScreenTitleMenu::NUM_TITLE_MENU_CHOICES] = {
2002-05-28 20:01:22 +00:00
"GAME START",
2002-05-27 08:23:27 +00:00
"SWITCH GAME",
2002-07-03 21:27:26 +00:00
"CONFIG KEY/JOY",
2002-05-20 08:59:37 +00:00
"GAME OPTIONS",
2002-07-11 19:02:26 +00:00
"APPEARANCE OPTIONS",
2002-06-29 11:59:09 +00:00
"EDIT/RECORD/SYNCH",
2002-05-20 08:59:37 +00:00
"EXIT",
};
2002-07-11 19:02:26 +00:00
const float CHOICES_START_Y = 62;
const float CHOICES_GAP_Y = 52;
2002-05-20 08:59:37 +00:00
const float HELP_X = CENTER_X;
const float HELP_Y = SCREEN_HEIGHT-55;
const ScreenMessage SM_PlayAttract = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToCaution = ScreenMessage(SM_User+2);
const ScreenMessage SM_GoToSelectStyle = ScreenMessage(SM_User+3);
const ScreenMessage SM_GoToSelectGame = ScreenMessage(SM_User+4);
const ScreenMessage SM_GoToMapInstruments = ScreenMessage(SM_User+5);
const ScreenMessage SM_GoToGameOptions = ScreenMessage(SM_User+6);
2002-07-11 19:02:26 +00:00
const ScreenMessage SM_GoToAppearanceOptions= ScreenMessage(SM_User+7);
2002-05-20 08:59:37 +00:00
const ScreenMessage SM_GoToEdit = ScreenMessage(SM_User+10);
const ScreenMessage SM_DoneOpening = ScreenMessage(SM_User+11);
2002-06-23 11:43:53 +00:00
const ScreenMessage SM_GoToEz2 = ScreenMessage(SM_User+12);
2002-05-20 08:59:37 +00:00
ScreenTitleMenu::ScreenTitleMenu()
{
LOG->WriteLine( "ScreenTitleMenu::ScreenTitleMenu()" );
2002-07-04 21:05:18 +00:00
// reset game info
// GAMEMAN->m_sMasterPlayerNumber = PLAYER_INVALID;
// GAMEMAN->m_CurGame = GAME_INVALID;
// GAMEMAN->m_CurGame = GAME_INVALID;
2002-05-20 08:59:37 +00:00
int i;
m_sprBG.Load( THEME->GetPathTo(GRAPHIC_TITLE_MENU_BACKGROUND) );
m_sprBG.StretchTo( CRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT) );
m_sprBG.SetDiffuseColor( D3DXCOLOR(0.6f,0.6f,0.6f,1) );
m_sprBG.TurnShadowOff();
this->AddActor( &m_sprBG );
m_sprLogo.Load( THEME->GetPathTo(GRAPHIC_TITLE_MENU_LOGO) );
m_sprLogo.SetXY( CENTER_X, CENTER_Y );
m_sprLogo.SetAddColor( D3DXCOLOR(1,1,1,1) );
m_sprLogo.SetZoomY( 0 );
m_sprLogo.BeginTweeningQueued( 0.5f );
2002-05-27 18:36:01 +00:00
m_sprLogo.BeginTweeningQueued( 0.5f, Actor::TWEEN_BOUNCE_END );
2002-05-20 08:59:37 +00:00
m_sprLogo.SetEffectGlowing(1, D3DXCOLOR(1,1,1,0.1f), D3DXCOLOR(1,1,1,0.3f) );
m_sprLogo.SetTweenZoom( 1 );
this->AddActor( &m_sprLogo );
m_textHelp.Load( THEME->GetPathTo(FONT_NORMAL) );
2002-06-14 22:25:22 +00:00
m_textHelp.SetText( ssprintf("Use %c %c to select, then press START", char(3), char(4)) );
2002-05-20 08:59:37 +00:00
m_textHelp.SetXY( CENTER_X, SCREEN_BOTTOM - 30 );
m_textHelp.SetZoom( 0.5f );
m_textHelp.SetEffectBlinking();
m_textHelp.SetShadowLength( 2 );
this->AddActor( &m_textHelp );
m_textVersion.Load( THEME->GetPathTo(FONT_NORMAL) );
m_textVersion.SetHorizAlign( Actor::align_right );
2002-07-11 19:02:26 +00:00
m_textVersion.SetText( "v3.0 beta 4" );
2002-05-20 08:59:37 +00:00
m_textVersion.SetDiffuseColor( D3DXCOLOR(0.6f,0.6f,0.6f,1) ); // light gray
m_textVersion.SetXY( SCREEN_RIGHT-16, SCREEN_BOTTOM-20 );
m_textVersion.SetZoom( 0.5f );
this->AddActor( &m_textVersion );
m_textSongs.Load( THEME->GetPathTo(FONT_NORMAL) );
m_textSongs.SetHorizAlign( Actor::align_left );
m_textSongs.SetText( ssprintf("Found %d Songs", SONGMAN->m_pSongs.GetSize()) );
m_textSongs.SetDiffuseColor( D3DXCOLOR(0.6f,0.6f,0.6f,1) ); // light gray
m_textSongs.SetXY( SCREEN_LEFT+16, SCREEN_HEIGHT-20 );
m_textSongs.SetZoom( 0.5f );
this->AddActor( &m_textSongs );
for( i=0; i< NUM_TITLE_MENU_CHOICES; i++ )
{
m_textChoice[i].Load( THEME->GetPathTo(FONT_HEADER1) );
m_textChoice[i].SetText( CHOICE_TEXT[i] );
m_textChoice[i].SetXY( CENTER_X, CHOICES_START_Y + i*CHOICES_GAP_Y );
m_textChoice[i].SetShadowLength( 5 );
this->AddActor( &m_textChoice[i] );
}
m_Fade.SetClosed();
m_Fade.OpenWipingRight( SM_DoneOpening );
2002-05-20 08:59:37 +00:00
this->AddActor( &m_Fade );
// LEAVE THIS HERE! ITS ESSENTIAL
// I know you're a fan of removing my code, but if this isn't here
// the Ez2dancer announcer will be the default (as it loads in alphabetical order, and ez2dancer
// is the last announcer (E follows D))
// so just leave it yeah?
// I don't wanna fix this a 3rd TIME!!
// - Andy.
// if (GAMEMAN->m_CurGame != GAME_EZ2)
//{
// ANNOUNCER->SwitchAnnouncer( "default" );
//}
// Dear Andy:
// The above code breaks the program by making the announcer unswitchable.
2002-07-12 04:35:03 +00:00
// This is probably the wrong place for such a code change anyway.
// Cheers
// -- dro kulix
2002-07-12 17:46:15 +00:00
// Good call, actually, I made this change when announcer switching wasn't possible.
// or rather, announcer switching WASN'T possible from the title menu (it used to be
// in song options)
// but since it is now changed before we get here,
// care needs to be taken to ensure the player can still switch.
2002-05-20 08:59:37 +00:00
SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_TITLE_MENU_GAME_NAME) );
2002-07-11 19:02:26 +00:00
m_soundAttract.Load( ANNOUNCER->GetPathTo(ANNOUNCER_TITLE_MENU_ATTRACT) );
2002-05-27 18:36:01 +00:00
m_soundChange.Load( THEME->GetPathTo(SOUND_TITLE_MENU_CHANGE) );
m_soundSelect.Load( THEME->GetPathTo(SOUND_MENU_START) );
m_soundInvalid.Load( THEME->GetPathTo(SOUND_MENU_INVALID) );
2002-05-20 08:59:37 +00:00
2002-07-11 19:02:26 +00:00
2002-05-20 08:59:37 +00:00
for( i=0; i<3000; i++ )
2002-07-11 19:02:26 +00:00
this->SendScreenMessage( SM_PlayAttract, (float)20+i*20 );
2002-05-20 08:59:37 +00:00
2002-05-28 20:01:22 +00:00
m_TitleMenuChoice = CHOICE_GAME_START;
2002-05-20 08:59:37 +00:00
GainFocus( m_TitleMenuChoice );
2002-05-20 08:59:37 +00:00
MUSIC->Stop();
//this->SendScreenMessage( SM_TimeToFadeOut, 30.0 );
}
ScreenTitleMenu::~ScreenTitleMenu()
{
LOG->WriteLine( "ScreenTitleMenu::~ScreenTitleMenu()" );
}
void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
LOG->WriteLine( "ScreenTitleMenu::Input()" );
if( m_Fade.IsClosing() )
return;
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
}
void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM )
{
switch( SM )
{
case SM_DoneOpening:
break;
case SM_PlayAttract:
2002-07-11 19:02:26 +00:00
m_soundAttract.PlayRandom();
2002-05-20 08:59:37 +00:00
break;
case SM_GoToCaution:
SCREENMAN->SetNewScreen( new ScreenCaution );
break;
case SM_GoToSelectStyle:
SCREENMAN->SetNewScreen( new ScreenSelectStyle );
break;
case SM_GoToSelectGame:
SCREENMAN->SetNewScreen( new ScreenSelectGame );
break;
case SM_GoToMapInstruments:
SCREENMAN->SetNewScreen( new ScreenMapInstruments );
break;
case SM_GoToGameOptions:
SCREENMAN->SetNewScreen( new ScreenGameOptions );
break;
2002-07-11 19:02:26 +00:00
case SM_GoToAppearanceOptions:
SCREENMAN->SetNewScreen( new ScreenAppearanceOptions );
break;
2002-05-20 08:59:37 +00:00
case SM_GoToEdit:
SCREENMAN->SetNewScreen( new ScreenEditMenu );
break;
2002-06-23 11:43:53 +00:00
case SM_GoToEz2:
SCREENMAN->SetNewScreen( new ScreenEz2SelectPlayer );
break;
2002-05-20 08:59:37 +00:00
}
}
void ScreenTitleMenu::LoseFocus( int iChoiceIndex )
{
m_soundChange.PlayRandom();
m_textChoice[iChoiceIndex].SetEffectNone();
m_textChoice[iChoiceIndex].SetAddColor( D3DXCOLOR(0,0,0,0) );
m_textChoice[iChoiceIndex].SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
m_textChoice[iChoiceIndex].BeginTweening( 0.3f );
m_textChoice[iChoiceIndex].SetTweenZoom( 0.9f );
}
void ScreenTitleMenu::GainFocus( int iChoiceIndex )
{
m_textChoice[iChoiceIndex].SetDiffuseColor( D3DXCOLOR(0.5f,1,0.5f,1) );
m_textChoice[iChoiceIndex].BeginTweening( 0.3f );
m_textChoice[iChoiceIndex].SetTweenZoom( 1.2f );
m_textChoice[iChoiceIndex].SetEffectCamelion( 2.5f, D3DXCOLOR(0.5f,1,0.5f,1), D3DXCOLOR(0.3f,0.6f,0.3f,1) );
}
2002-05-27 18:36:01 +00:00
void ScreenTitleMenu::MenuUp( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
LoseFocus( m_TitleMenuChoice );
if( m_TitleMenuChoice == 0 ) // wrap around
m_TitleMenuChoice = (ScreenTitleMenu::TitleMenuChoice)((int)NUM_TITLE_MENU_CHOICES);
m_TitleMenuChoice = TitleMenuChoice( m_TitleMenuChoice-1 );
GainFocus( m_TitleMenuChoice );
}
2002-05-27 18:36:01 +00:00
void ScreenTitleMenu::MenuDown( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
LoseFocus( m_TitleMenuChoice );
if( m_TitleMenuChoice == (int)ScreenTitleMenu::NUM_TITLE_MENU_CHOICES-1 )
m_TitleMenuChoice = (TitleMenuChoice)-1; // wrap around
m_TitleMenuChoice = TitleMenuChoice( m_TitleMenuChoice+1 );
GainFocus( m_TitleMenuChoice );
}
2002-05-27 18:36:01 +00:00
void ScreenTitleMenu::MenuStart( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
2002-05-28 20:01:22 +00:00
GAMEMAN->m_sMasterPlayerNumber = p;
2002-05-20 08:59:37 +00:00
switch( m_TitleMenuChoice )
{
2002-05-28 20:01:22 +00:00
case CHOICE_GAME_START:
2002-06-23 11:43:53 +00:00
if ( GAMEMAN->m_CurGame == GAME_EZ2 )
{
m_soundSelect.PlayRandom();
m_Fade.CloseWipingRight( SM_GoToEz2 );
}
else
{
m_soundSelect.PlayRandom();
m_Fade.CloseWipingRight( SM_GoToCaution );
}
2002-05-20 08:59:37 +00:00
return;
case CHOICE_SELECT_GAME:
// m_soundInvalid.PlayRandom();
m_soundSelect.PlayRandom();
m_Fade.CloseWipingRight( SM_GoToSelectGame );
2002-05-20 08:59:37 +00:00
return;
case CHOICE_MAP_INSTRUMENTS:
m_soundSelect.PlayRandom();
m_Fade.CloseWipingRight( SM_GoToMapInstruments );
return;
case CHOICE_GAME_OPTIONS:
m_soundSelect.PlayRandom();
m_Fade.CloseWipingRight( SM_GoToGameOptions );
return;
2002-07-11 19:02:26 +00:00
case CHOICE_APPEARANCE_OPTIONS:
m_soundSelect.PlayRandom();
m_Fade.CloseWipingRight( SM_GoToAppearanceOptions );
return;
2002-05-20 08:59:37 +00:00
case CHOICE_EDIT:
2002-07-04 21:05:18 +00:00
if( SONGMAN->m_pSongs.GetSize() == 0 )
{
m_soundInvalid.PlayRandom();
}
else
{
m_soundSelect.PlayRandom();
m_Fade.CloseWipingRight( SM_GoToEdit );
}
2002-05-20 08:59:37 +00:00
return;
/* case CHOICE_HELP:
m_soundSelect.PlayRandom();
2002-05-27 08:23:27 +00:00
PREFSMAN->m_bWindowed = false;
2002-05-20 08:59:37 +00:00
ApplyGraphicOptions();
GotoURL( "Docs/index.htm" );
return;
case CHOICE_CHECK_FOR_UPDATE:
m_soundSelect.PlayRandom();
2002-05-27 08:23:27 +00:00
PREFSMAN->m_bWindowed = false;
2002-05-20 08:59:37 +00:00
ApplyGraphicOptions();
GotoURL( "http://www.stepmania.com" );
return;
*/
case CHOICE_EXIT:
m_soundSelect.PlayRandom();
PostQuitMessage(0);
return;
2002-07-11 19:02:26 +00:00
default:
ASSERT(0);
2002-05-20 08:59:37 +00:00
}
}
2002-05-27 18:36:01 +00:00
void ScreenTitleMenu::MenuBack( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
//m_Fade.CloseWipingLeft( SM_GoToIntroCovers );
}