Files
itgmania212121/stepmania/src/ScreenEditMenu.cpp
T

363 lines
9.3 KiB
C++
Raw Normal View History

2002-05-20 08:59:37 +00:00
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
File: ScreenEditMenu.h
Desc: The main title screen and menu.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "ScreenEditMenu.h"
#include "SongManager.h"
#include "ScreenManager.h"
#include "ScreenTitleMenu.h"
#include "ScreenEdit.h"
#include "GameConstantsAndTypes.h"
#include "RageUtil.h"
#include "ThemeManager.h"
#include "GameManager.h"
#include "ScreenPrompt.h"
#include "RageLog.h"
//
// Defines specific to ScreenEditMenu
//
2002-06-29 11:59:09 +00:00
const float GROUP_X = CENTER_X;
const float GROUP_Y = CENTER_Y - 160;
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
const float SONG_BANNER_X = CENTER_X;
const float SONG_BANNER_Y = CENTER_Y - 80;
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
const float ARROWS_X[2] = { SONG_BANNER_X - 200, SONG_BANNER_X + 200 };
const float ARROWS_Y[2] = { SONG_BANNER_Y, SONG_BANNER_Y };
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
const float SONG_TEXT_BANNER_X = CENTER_X;
const float SONG_TEXT_BANNER_Y = CENTER_Y - 10;
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
const float GAME_STYLE_X = CENTER_X;
const float GAME_STYLE_Y = CENTER_Y + 40;
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
const float STEPS_X = CENTER_X;
const float STEPS_Y = CENTER_Y + 90;
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
const float EXPLANATION_X = CENTER_X;
const float EXPLANATION_Y = SCREEN_BOTTOM - 70;
const CString EXPLANATION_TEXT =
"In this mode, you can edit existing notes patterns,\n"
"create note patterns, or synchronize notes with the music.";
2002-05-20 08:59:37 +00:00
const ScreenMessage SM_GoToPrevState = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToNextState = ScreenMessage(SM_User+2);
ScreenEditMenu::ScreenEditMenu()
{
LOG->WriteLine( "ScreenEditMenu::ScreenEditMenu()" );
// data structures
m_SelectedRow = ROW_GROUP;
SONGMAN->GetGroupNames( m_sGroups );
m_iSelectedGroup = 0;
m_iSelectedSong = 0;
2002-05-27 08:23:27 +00:00
m_CurNotesType = NOTES_TYPE_DANCE_SINGLE;
2002-05-20 08:59:37 +00:00
m_iSelectedNotes = 0;
m_textGroup.Load( THEME->GetPathTo(FONT_HEADER1) );
m_textGroup.SetXY( GROUP_X, GROUP_Y );
m_textGroup.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
this->AddActor( &m_textGroup );
2002-06-29 11:59:09 +00:00
m_Banner.SetXY( SONG_BANNER_X, SONG_BANNER_Y );
this->AddActor( &m_Banner );
m_TextBanner.SetXY( SONG_TEXT_BANNER_X, SONG_TEXT_BANNER_Y );
this->AddActor( &m_TextBanner );
m_sprArrowLeft.Load( THEME->GetPathTo(GRAPHIC_ARROWS_LEFT) );
m_sprArrowLeft.SetXY( ARROWS_X[0], ARROWS_Y[0] );
m_sprArrowLeft.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
this->AddActor( &m_sprArrowLeft );
m_sprArrowRight.Load( THEME->GetPathTo(GRAPHIC_ARROWS_RIGHT) );
m_sprArrowRight.SetXY( ARROWS_X[1], ARROWS_Y[1] );
m_sprArrowRight.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
this->AddActor( &m_sprArrowRight );
2002-05-20 08:59:37 +00:00
2002-05-27 08:23:27 +00:00
m_textNotesType.Load( THEME->GetPathTo(FONT_HEADER1) );
m_textNotesType.SetXY( GAME_STYLE_X, GAME_STYLE_Y );
m_textNotesType.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
this->AddActor( &m_textNotesType );
2002-05-20 08:59:37 +00:00
m_textNotes.Load( THEME->GetPathTo(FONT_HEADER1) );
m_textNotes.SetXY( STEPS_X, STEPS_Y );
m_textNotes.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
this->AddActor( &m_textNotes );
AfterRowChange();
OnGroupChange();
m_textExplanation.Load( THEME->GetPathTo(FONT_NORMAL) );
m_textExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y );
2002-06-29 11:59:09 +00:00
m_textExplanation.SetText( EXPLANATION_TEXT );
2002-05-20 08:59:37 +00:00
m_textExplanation.SetZoom( 0.7f );
this->AddActor( &m_textExplanation );
m_Menu.Load(
THEME->GetPathTo(GRAPHIC_EDIT_BACKGROUND),
2002-05-28 20:01:22 +00:00
THEME->GetPathTo(GRAPHIC_EDIT_TOP_EDGE),
2002-06-14 22:25:22 +00:00
ssprintf("%s %s change music START to continue", CString(char(1)), CString(char(2)) )
2002-05-20 08:59:37 +00:00
);
this->AddActor( &m_Menu );
m_Fade.SetOpened();
this->AddActor( &m_Fade);
2002-05-27 18:36:01 +00:00
m_soundChangeMusic.Load( THEME->GetPathTo(SOUND_SELECT_MUSIC_CHANGE_MUSIC) );
m_soundSelect.Load( THEME->GetPathTo(SOUND_MENU_START) );
2002-05-20 08:59:37 +00:00
MUSIC->Load( THEME->GetPathTo(SOUND_MENU_MUSIC) );
MUSIC->Play( true );
2002-05-28 20:01:22 +00:00
m_Menu.TweenOnScreenFromBlack( SM_None );
2002-05-20 08:59:37 +00:00
}
ScreenEditMenu::~ScreenEditMenu()
{
LOG->WriteLine( "ScreenEditMenu::~ScreenEditMenu()" );
}
void ScreenEditMenu::DrawPrimitives()
{
m_Menu.DrawBottomLayer();
Screen::DrawPrimitives();
m_Menu.DrawTopLayer();
}
void ScreenEditMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
LOG->WriteLine( "ScreenEditMenu::Input()" );
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
}
void ScreenEditMenu::HandleScreenMessage( const ScreenMessage SM )
{
switch( SM )
{
case SM_GoToPrevState:
SCREENMAN->SetNewScreen( new ScreenTitleMenu );
break;
case SM_GoToNextState:
2002-06-14 22:25:22 +00:00
// set the current style based on the notes type
switch( GetSelectedNotesType() )
{
case NOTES_TYPE_DANCE_SINGLE: GAMEMAN->m_CurStyle = STYLE_DANCE_SINGLE; break;
case NOTES_TYPE_DANCE_DOUBLE: GAMEMAN->m_CurStyle = STYLE_DANCE_DOUBLE; break;
case NOTES_TYPE_DANCE_COUPLE: GAMEMAN->m_CurStyle = STYLE_DANCE_COUPLE; break;
case NOTES_TYPE_DANCE_SOLO: GAMEMAN->m_CurStyle = STYLE_DANCE_SOLO; break;
case NOTES_TYPE_PUMP_SINGLE: GAMEMAN->m_CurStyle = STYLE_PUMP_SINGLE; break;
case NOTES_TYPE_PUMP_DOUBLE: GAMEMAN->m_CurStyle = STYLE_PUMP_DOUBLE; break;
}
2002-05-20 08:59:37 +00:00
SCREENMAN->SetNewScreen( new ScreenEdit );
break;
}
}
void ScreenEditMenu::BeforeRowChange()
{
m_textGroup.SetEffectNone();
2002-06-29 11:59:09 +00:00
m_sprArrowLeft.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
m_sprArrowRight.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
2002-05-27 08:23:27 +00:00
m_textNotesType.SetEffectNone();
2002-05-20 08:59:37 +00:00
m_textNotes.SetEffectNone();
}
void ScreenEditMenu::AfterRowChange()
{
switch( m_SelectedRow )
{
2002-05-27 08:23:27 +00:00
case ROW_GROUP: m_textGroup.SetEffectGlowing(); break;
2002-06-29 11:59:09 +00:00
case ROW_SONG:
m_sprArrowLeft.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
m_sprArrowRight.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
break;
2002-05-27 08:23:27 +00:00
case ROW_NOTES_TYPE: m_textNotesType.SetEffectGlowing(); break;
case ROW_STEPS: m_textNotes.SetEffectGlowing(); break;
2002-05-20 08:59:37 +00:00
default: ASSERT(false);
}
}
void ScreenEditMenu::OnGroupChange()
{
m_iSelectedGroup = clamp( m_iSelectedGroup, 0, m_sGroups.GetSize()-1 );
2002-05-27 18:36:01 +00:00
m_textGroup.SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) );
2002-05-20 08:59:37 +00:00
// reload songs
m_pSongs.RemoveAll();
SONGMAN->GetSongsInGroup( GetSelectedGroup(), m_pSongs );
OnSongChange();
}
void ScreenEditMenu::OnSongChange()
{
m_iSelectedSong = clamp( m_iSelectedSong, 0, m_pSongs.GetSize()-1 );
2002-06-29 11:59:09 +00:00
m_Banner.LoadFromSong( GetSelectedSong() );
m_TextBanner.LoadFromSong( GetSelectedSong() );
2002-05-20 08:59:37 +00:00
2002-05-27 08:23:27 +00:00
OnNotesTypeChange();
2002-05-20 08:59:37 +00:00
}
2002-05-27 08:23:27 +00:00
void ScreenEditMenu::OnNotesTypeChange()
2002-05-20 08:59:37 +00:00
{
2002-05-27 08:23:27 +00:00
m_CurNotesType = (NotesType)clamp( m_CurNotesType, 0, NUM_NOTES_TYPES );
2002-05-20 08:59:37 +00:00
2002-05-27 08:23:27 +00:00
m_textNotesType.SetText( NotesTypeToString( GetSelectedNotesType() ) );
2002-05-20 08:59:37 +00:00
m_pNotess.RemoveAll();
2002-05-27 08:23:27 +00:00
GetSelectedSong()->GetNotesThatMatch( GetSelectedNotesType(), m_pNotess );
2002-05-20 08:59:37 +00:00
SortNotesArrayByDifficultyClass( m_pNotess );
m_pNotess.Add( NULL ); // marker for "(NEW)"
m_iSelectedNotes = 0;
OnStepsChange();
}
void ScreenEditMenu::OnStepsChange()
{
m_iSelectedNotes = clamp( m_iSelectedNotes, 0, m_pNotess.GetSize()-1 );
if( GetSelectedNotes() == NULL )
m_textNotes.SetText( "(NEW)" );
else
m_textNotes.SetText( GetSelectedNotes()->m_sDescription );
}
2002-05-27 18:36:01 +00:00
void ScreenEditMenu::MenuUp( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
if( m_SelectedRow == 0 ) // can't go up any further
return;
BeforeRowChange();
m_SelectedRow = SelectedRow(m_SelectedRow-1);
AfterRowChange();
}
2002-05-27 18:36:01 +00:00
void ScreenEditMenu::MenuDown( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
if( m_SelectedRow == NUM_ROWS-1 ) // can't go down any further
return;
BeforeRowChange();
m_SelectedRow = SelectedRow(m_SelectedRow+1);
AfterRowChange();
}
2002-05-27 18:36:01 +00:00
void ScreenEditMenu::MenuLeft( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
switch( m_SelectedRow )
{
case ROW_GROUP:
if( m_iSelectedGroup == 0 ) // can't go left any further
return;
m_iSelectedGroup--;
OnGroupChange();
break;
case ROW_SONG:
if( m_iSelectedSong == 0 ) // can't go left any further
return;
m_iSelectedSong--;
OnSongChange();
break;
2002-05-27 08:23:27 +00:00
case ROW_NOTES_TYPE:
if( m_CurNotesType == 0 ) // can't go left any further
2002-05-20 08:59:37 +00:00
return;
2002-05-27 08:23:27 +00:00
m_CurNotesType = NotesType( m_CurNotesType-1 );
OnNotesTypeChange();
2002-05-20 08:59:37 +00:00
break;
case ROW_STEPS:
if( m_iSelectedNotes == 0 ) // can't go left any further
return;
m_iSelectedNotes--;
OnStepsChange();
break;
default:
ASSERT(false);
}
}
2002-05-27 18:36:01 +00:00
void ScreenEditMenu::MenuRight( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
switch( m_SelectedRow )
{
case ROW_GROUP:
if( m_iSelectedGroup == m_sGroups.GetSize()-1 ) // can't go right any further
return;
m_iSelectedGroup++;
OnGroupChange();
break;
case ROW_SONG:
if( m_iSelectedSong == m_pSongs.GetSize()-1 ) // can't go right any further
return;
m_iSelectedSong++;
OnSongChange();
break;
2002-05-27 08:23:27 +00:00
case ROW_NOTES_TYPE:
if( m_CurNotesType == NUM_NOTES_TYPES-1 ) // can't go right any further
2002-05-20 08:59:37 +00:00
return;
2002-05-27 08:23:27 +00:00
m_CurNotesType = NotesType( m_CurNotesType+1 );
OnNotesTypeChange();
2002-05-20 08:59:37 +00:00
break;
case ROW_STEPS:
if( m_iSelectedNotes == m_pNotess.GetSize()-1 ) // can't go right any further
return;
m_iSelectedNotes++;
OnStepsChange();
break;
default:
ASSERT(false);
}
}
2002-05-27 18:36:01 +00:00
void ScreenEditMenu::MenuStart( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
2002-05-28 20:01:22 +00:00
m_Menu.TweenOffScreenToBlack( SM_None, false );
2002-05-20 08:59:37 +00:00
MUSIC->Stop();
2002-05-29 09:47:24 +00:00
SONGMAN->SetCurrentSong( GetSelectedSong() );
2002-05-27 08:23:27 +00:00
GAMEMAN->m_CurNotesType = GetSelectedNotesType();
2002-05-29 09:47:24 +00:00
SONGMAN->SetCurrentNotes( PLAYER_1, GetSelectedNotes() );
2002-05-20 08:59:37 +00:00
m_soundSelect.PlayRandom();
m_Fade.CloseWipingRight( SM_GoToNextState );
}
2002-05-27 18:36:01 +00:00
void ScreenEditMenu::MenuBack( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
2002-05-28 20:01:22 +00:00
m_Menu.TweenOffScreenToBlack( SM_None, true );
2002-05-20 08:59:37 +00:00
MUSIC->Stop();
m_Fade.CloseWipingLeft( SM_GoToPrevState );
}