Files
itgmania212121/stepmania/src/ScreenEditMenu.cpp
T

171 lines
4.2 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 "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 "RageLog.h"
2002-07-23 01:41:40 +00:00
#include "GameState.h"
#include "RageMusic.h"
2002-05-20 08:59:37 +00:00
//
// Defines specific to ScreenEditMenu
//
#define EXPLANATION_X THEME->GetMetricF("ScreenEditMenu","ExplanationX")
#define EXPLANATION_Y THEME->GetMetricF("ScreenEditMenu","ExplanationY")
#define EXPLANATION_TEXT THEME->GetMetric("ScreenEditMenu","ExplanationText")
#define HELP_TEXT THEME->GetMetric("ScreenEditMenu","HelpText")
2002-05-20 08:59:37 +00:00
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+2);
2002-05-20 08:59:37 +00:00
ScreenEditMenu::ScreenEditMenu()
{
LOG->Trace( "ScreenEditMenu::ScreenEditMenu()" );
2002-05-20 08:59:37 +00:00
GAMESTATE->m_CurStyle = STYLE_NONE;
Selector.SetXY( 0, 0 );
2002-08-23 08:42:38 +00:00
// Selector.AllowNewNotes();
this->AddChild( &Selector );
2002-05-20 08:59:37 +00:00
2002-08-27 16:53:25 +00:00
m_Menu.Load(
THEME->GetPathTo("BGAnimations","edit menu"),
THEME->GetPathTo("Graphics","edit menu top edge"),
HELP_TEXT, false, false, 99
2002-08-27 16:53:25 +00:00
);
this->AddChild( &m_Menu );
2002-08-27 16:53:25 +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 );
this->AddChild( &m_textExplanation );
2002-05-20 08:59:37 +00:00
m_Fade.SetOpened();
this->AddChild( &m_Fade);
2002-05-20 08:59:37 +00:00
MUSIC->LoadAndPlayIfNotAlready( THEME->GetPathTo("Sounds","edit menu music") );
m_soundSelect.Load( THEME->GetPathTo("Sounds","menu start") );
2002-08-27 16:53:25 +00:00
m_Menu.TweenOnScreenFromBlack( SM_None );
2002-05-20 08:59:37 +00:00
}
ScreenEditMenu::~ScreenEditMenu()
{
LOG->Trace( "ScreenEditMenu::~ScreenEditMenu()" );
2002-05-20 08:59:37 +00:00
}
2002-08-27 16:53:25 +00:00
void ScreenEditMenu::DrawPrimitives()
{
m_Menu.DrawBottomLayer();
Screen::DrawPrimitives();
m_Menu.DrawTopLayer();
}
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_GoToPrevScreen:
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
2002-05-20 08:59:37 +00:00
break;
case SM_GoToNextScreen:
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.
Style style = Selector.GetSelectedStyle();
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
SCREENMAN->SetNewScreen( "ScreenEdit" );
2002-05-20 08:59:37 +00:00
break;
}
}
void ScreenEditMenu::MenuUp( PlayerNumber pn )
2002-05-20 08:59:37 +00:00
{
Selector.Up();
2002-05-20 08:59:37 +00:00
}
void ScreenEditMenu::MenuDown( PlayerNumber pn )
2002-05-20 08:59:37 +00:00
{
Selector.Down();
2002-05-20 08:59:37 +00:00
}
void ScreenEditMenu::MenuLeft( PlayerNumber pn, const InputEventType type )
2002-05-20 08:59:37 +00:00
{
Selector.Left();
2002-05-20 08:59:37 +00:00
}
void ScreenEditMenu::MenuRight( PlayerNumber pn, const InputEventType type )
2002-05-20 08:59:37 +00:00
{
Selector.Right();
2002-05-20 08:59:37 +00:00
}
void ScreenEditMenu::MenuStart( PlayerNumber pn )
2002-05-20 08:59:37 +00:00
{
GAMESTATE->m_pCurSong = Selector.GetSelectedSong();
if( !GAMESTATE->m_pCurSong->HasMusic() )
{
SCREENMAN->SystemMessage( "This song is missing a music file and cannot be edited" );
SOUND->PlayOnceStreamed( THEME->GetPathTo("Sounds","menu invalid") );
return;
}
2002-05-20 08:59:37 +00:00
MUSIC->Stop();
2002-07-23 01:41:40 +00:00
2002-09-07 10:00:58 +00:00
// get the style
GAMESTATE->m_CurStyle = Selector.GetSelectedStyle();
GAMESTATE->m_pCurNotes[PLAYER_1] = Selector.GetSelectedNotes();
2002-05-20 08:59:37 +00:00
m_soundSelect.PlayRandom();
m_Menu.TweenOffScreenToBlack( SM_GoToNextScreen, false );
2002-08-27 16:53:25 +00:00
m_Fade.CloseWipingRight( SM_None );
2002-05-20 08:59:37 +00:00
}
void ScreenEditMenu::MenuBack( PlayerNumber pn )
2002-05-20 08:59:37 +00:00
{
2002-08-27 16:53:25 +00:00
m_Menu.TweenOffScreenToBlack( SM_None, true );
2002-05-20 08:59:37 +00:00
MUSIC->Stop();
m_Fade.CloseWipingLeft( SM_GoToPrevScreen );
2002-05-20 08:59:37 +00:00
}