Files
itgmania212121/stepmania/src/ScreenEditMenu.cpp
T

151 lines
3.8 KiB
C++
Raw Normal View History

2002-05-20 08:59:37 +00:00
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
Class: ScreenEditMenu
2002-05-20 08:59:37 +00:00
Desc: The main title screen and menu.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
2002-05-20 08:59:37 +00:00
-----------------------------------------------------------------------------
*/
#include "ScreenEditMenu.h"
#include "SongManager.h"
#include "ScreenManager.h"
#include "ScreenTitleMenu.h"
#include "ScreenEdit.h"
#include "GameConstantsAndTypes.h"
#include "RageUtil.h"
2002-07-23 01:41:40 +00:00
#include "PrefsManager.h"
2002-05-20 08:59:37 +00:00
#include "GameManager.h"
#include "ScreenPrompt.h"
#include "RageLog.h"
2002-07-23 01:41:40 +00:00
#include "GameState.h"
2002-05-20 08:59:37 +00:00
//
// Defines specific to ScreenEditMenu
//
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->Trace( "ScreenEditMenu::ScreenEditMenu()" );
2002-05-20 08:59:37 +00:00
Selector.SetXY( 0, 0 );
2002-08-23 08:42:38 +00:00
// Selector.AllowNewNotes();
this->AddSubActor( &Selector );
2002-05-20 08:59:37 +00:00
m_textExplanation.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
2002-05-20 08:59:37 +00:00
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 );
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_textExplanation );
2002-05-20 08:59:37 +00:00
m_Fade.SetOpened();
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_Fade);
2002-05-20 08:59:37 +00:00
MUSIC->Load( THEME->GetPathTo("Sounds","edit menu music") );
2002-05-20 08:59:37 +00:00
MUSIC->Play( true );
m_soundSelect.Load( THEME->GetPathTo("Sounds","menu start") );
2002-05-20 08:59:37 +00:00
}
ScreenEditMenu::~ScreenEditMenu()
{
LOG->Trace( "ScreenEditMenu::~ScreenEditMenu()" );
2002-05-20 08:59:37 +00:00
}
void ScreenEditMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
LOG->Trace( "ScreenEditMenu::Input()" );
2002-05-20 08:59:37 +00:00
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
// Dro Kulix:
// A centralized solution for this switching mess...
// (See GameConstantsAndTypes.h)
2002-07-23 01:41:40 +00:00
//
// Chris:
// Find the first Style that will play the selected notes type.
// Set the current Style, then let ScreenEdit infer the desired
// NotesType from that Style.
NotesType nt = Selector.GetSelectedNotesType();
2002-08-17 06:44:04 +00:00
Style style = GAMEMAN->GetEditStyleThatPlaysNotesType( nt );
2002-07-27 19:29:51 +00:00
GAMESTATE->m_CurStyle = style;
GAMESTATE->m_CurGame = GAMEMAN->GetStyleDefForStyle(style)->m_Game;
2002-06-14 22:25:22 +00:00
2002-05-20 08:59:37 +00:00
SCREENMAN->SetNewScreen( new ScreenEdit );
break;
}
}
2002-05-27 18:36:01 +00:00
void ScreenEditMenu::MenuUp( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
Selector.Up();
2002-05-20 08:59:37 +00:00
}
2002-05-27 18:36:01 +00:00
void ScreenEditMenu::MenuDown( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
Selector.Down();
2002-05-20 08:59:37 +00:00
}
2002-05-27 18:36:01 +00:00
void ScreenEditMenu::MenuLeft( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
Selector.Left();
2002-05-20 08:59:37 +00:00
}
2002-05-27 18:36:01 +00:00
void ScreenEditMenu::MenuRight( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
Selector.Right();
2002-05-20 08:59:37 +00:00
}
2002-05-27 18:36:01 +00:00
void ScreenEditMenu::MenuStart( const PlayerNumber p )
2002-05-20 08:59:37 +00:00
{
Selector.TweenOffScreenToBlack( SM_None, false );
2002-05-20 08:59:37 +00:00
MUSIC->Stop();
GAMESTATE->m_pCurSong = Selector.GetSelectedSong();
2002-07-23 01:41:40 +00:00
// find the first style that matches this notes type
GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
GAMESTATE->m_CurStyle = GAMEMAN->GetEditStyleThatPlaysNotesType( Selector.GetSelectedNotesType() );
GAMESTATE->m_pCurNotes[PLAYER_1] = Selector.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
{
Selector.TweenOffScreenToBlack( SM_None, true );
2002-05-20 08:59:37 +00:00
MUSIC->Stop();
m_Fade.CloseWipingLeft( SM_GoToPrevState );
}