From 7b644e834a3700f7bcf611060d26742424f81162 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 11 Feb 2003 02:20:38 +0000 Subject: [PATCH] Added ScreenJukeboxMenu, and UI cleanup. --- stepmania/Themes/default/metrics.ini | 21 +- .../src/{SongSelector.cpp => EditMenu.cpp} | 83 ++++---- stepmania/src/{SongSelector.h => EditMenu.h} | 23 +-- stepmania/src/GameState.cpp | 1 + stepmania/src/GameState.h | 1 + stepmania/src/JukeboxMenu.cpp | 190 ++++++++++++++++++ stepmania/src/JukeboxMenu.h | 86 ++++++++ stepmania/src/PlayerOptions.cpp | 21 ++ stepmania/src/PlayerOptions.h | 1 + stepmania/src/ScreenDemonstration.cpp | 13 +- stepmania/src/ScreenEditMenu.cpp | 12 +- stepmania/src/ScreenEditMenu.h | 6 +- stepmania/src/ScreenGameplay.cpp | 3 +- stepmania/src/ScreenJukebox.cpp | 66 +++--- stepmania/src/ScreenJukeboxMenu.cpp | 152 ++++++++++++++ stepmania/src/ScreenJukeboxMenu.h | 52 +++++ stepmania/src/ScreenManager.cpp | 2 + stepmania/src/ScreenNameEntry.h | 3 +- stepmania/src/ScreenTitleMenu.cpp | 2 +- stepmania/src/Song.cpp | 20 +- stepmania/src/StepMania.vcproj | 24 ++- 21 files changed, 650 insertions(+), 132 deletions(-) rename stepmania/src/{SongSelector.cpp => EditMenu.cpp} (76%) rename stepmania/src/{SongSelector.h => EditMenu.h} (85%) create mode 100644 stepmania/src/JukeboxMenu.cpp create mode 100644 stepmania/src/JukeboxMenu.h create mode 100644 stepmania/src/ScreenJukeboxMenu.cpp create mode 100644 stepmania/src/ScreenJukeboxMenu.h diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index b9dc132e47..b6bf171ecb 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -462,6 +462,12 @@ ExplanationY=410 ExplanationText=In this mode, you can edit existing notes patterns,::create note patterns, or synchronize notes with the music. HelpText=&UP; &DOWN; change line &LEFT; &RIGHT; change value START to continue +[ScreenJukeboxMenu] +ExplanationX=320 +ExplanationY=410 +ExplanationText=In this mode, you can edit existing notes patterns,::create note patterns, or synchronize notes with the music. +HelpText=&UP; &DOWN; change line &LEFT; &RIGHT; change value START to continue + [ScreenManager] StatsX=632 StatsY=10 @@ -845,7 +851,7 @@ NumCharsToDrawTotal=10 FakeBeatsPerSec=2.5 TimerSeconds=24 -[SongSelector] +[EditMenu] Arrows1X=190 Arrows2X=590 SongBannerX=490 @@ -878,6 +884,19 @@ Row5Y=260 Row6Y=300 Row7Y=340 +[JukeboxMenu] +Arrows1X=190 +Arrows2X=590 +RowLabelsX=20 +RowValue1X=380 +RowValue2X=380 +RowValue3X=380 +RowValue4X=380 +Row1Y=80 +Row2Y=130 +Row3Y=180 +Row4Y=230 + [ScreenOptionsMenu] InputOptions= MachineOptions= diff --git a/stepmania/src/SongSelector.cpp b/stepmania/src/EditMenu.cpp similarity index 76% rename from stepmania/src/SongSelector.cpp rename to stepmania/src/EditMenu.cpp index c029ac973b..56e6f46270 100644 --- a/stepmania/src/SongSelector.cpp +++ b/stepmania/src/EditMenu.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" /* ----------------------------------------------------------------------------- - Class: SongSelector + Class: EditMenu Desc: See header. @@ -10,7 +10,7 @@ ----------------------------------------------------------------------------- */ -#include "SongSelector.h" +#include "EditMenu.h" #include "RageLog.h" #include "SongManager.h" #include "GameState.h" @@ -18,34 +18,32 @@ #include "GameManager.h" // -// Defines specific to SongSelector +// Defines specific to EditMenu // -#define ARROWS_X( i ) THEME->GetMetricF("SongSelector",ssprintf("Arrows%dX",i+1)) -#define SONG_BANNER_X THEME->GetMetricF("SongSelector","SongBannerX") -#define SONG_BANNER_Y THEME->GetMetricF("SongSelector","SongBannerY") -#define SONG_BANNER_WIDTH THEME->GetMetricF("SongSelector","SongBannerWidth") -#define SONG_BANNER_HEIGHT THEME->GetMetricF("SongSelector","SongBannerHeight") -#define SONG_TEXT_BANNER_X THEME->GetMetricF("SongSelector","SongTextBannerX") -#define SONG_TEXT_BANNER_Y THEME->GetMetricF("SongSelector","SongTextBannerY") -#define GROUP_BANNER_X THEME->GetMetricF("SongSelector","GroupBannerX") -#define GROUP_BANNER_Y THEME->GetMetricF("SongSelector","GroupBannerY") -#define GROUP_BANNER_WIDTH THEME->GetMetricF("SongSelector","GroupBannerWidth") -#define GROUP_BANNER_HEIGHT THEME->GetMetricF("SongSelector","GroupBannerHeight") -#define METER_X THEME->GetMetricF("SongSelector","MeterX") -#define METER_Y THEME->GetMetricF("SongSelector","MeterY") -#define SOURCE_METER_X THEME->GetMetricF("SongSelector","SourceMeterX") -#define SOURCE_METER_Y THEME->GetMetricF("SongSelector","SourceMeterY") -#define ROW_LABELS_X THEME->GetMetricF("SongSelector","RowLabelsX") -#define ROW_VALUE_X( i ) THEME->GetMetricF("SongSelector",ssprintf("RowValue%dX",i+1)) -#define ROW_Y( i ) THEME->GetMetricF("SongSelector",ssprintf("Row%dY",i+1)) +#define ARROWS_X( i ) THEME->GetMetricF("EditMenu",ssprintf("Arrows%dX",i+1)) +#define SONG_BANNER_X THEME->GetMetricF("EditMenu","SongBannerX") +#define SONG_BANNER_Y THEME->GetMetricF("EditMenu","SongBannerY") +#define SONG_BANNER_WIDTH THEME->GetMetricF("EditMenu","SongBannerWidth") +#define SONG_BANNER_HEIGHT THEME->GetMetricF("EditMenu","SongBannerHeight") +#define SONG_TEXT_BANNER_X THEME->GetMetricF("EditMenu","SongTextBannerX") +#define SONG_TEXT_BANNER_Y THEME->GetMetricF("EditMenu","SongTextBannerY") +#define GROUP_BANNER_X THEME->GetMetricF("EditMenu","GroupBannerX") +#define GROUP_BANNER_Y THEME->GetMetricF("EditMenu","GroupBannerY") +#define GROUP_BANNER_WIDTH THEME->GetMetricF("EditMenu","GroupBannerWidth") +#define GROUP_BANNER_HEIGHT THEME->GetMetricF("EditMenu","GroupBannerHeight") +#define METER_X THEME->GetMetricF("EditMenu","MeterX") +#define METER_Y THEME->GetMetricF("EditMenu","MeterY") +#define SOURCE_METER_X THEME->GetMetricF("EditMenu","SourceMeterX") +#define SOURCE_METER_Y THEME->GetMetricF("EditMenu","SourceMeterY") +#define ROW_LABELS_X THEME->GetMetricF("EditMenu","RowLabelsX") +#define ROW_VALUE_X( i ) THEME->GetMetricF("EditMenu",ssprintf("RowValue%dX",i+1)) +#define ROW_Y( i ) THEME->GetMetricF("EditMenu",ssprintf("Row%dY",i+1)) -SongSelector::SongSelector() +EditMenu::EditMenu() { LOG->Trace( "ScreenEditMenu::ScreenEditMenu()" ); - m_bAllowNewNotes = true; - int i; for( i=0; i<2; i++ ) @@ -59,6 +57,13 @@ SongSelector::SongSelector() ZERO( m_iSelection ); + + // start out on easy, not beginner + m_iSelection[ROW_DIFFICULTY] = DIFFICULTY_EASY; + m_iSelection[ROW_SOURCE_DIFFICULTY] = DIFFICULTY_EASY; + + + for( i=0; iGetPathTo("Fonts","header2") ); @@ -121,38 +126,38 @@ SongSelector::SongSelector() OnRowValueChanged( (Row)0 ); } -SongSelector::~SongSelector() +EditMenu::~EditMenu() { } -void SongSelector::Refresh() +void EditMenu::Refresh() { ChangeToRow( (Row)0 ); OnRowValueChanged( (Row)0 ); } -void SongSelector::DrawPrimitives() +void EditMenu::DrawPrimitives() { ActorFrame::DrawPrimitives(); } -bool SongSelector::CanGoUp() +bool EditMenu::CanGoUp() { return m_SelectedRow != 0; } -bool SongSelector::CanGoDown() +bool EditMenu::CanGoDown() { return m_SelectedRow != NUM_ROWS-1; } -bool SongSelector::CanGoLeft() +bool EditMenu::CanGoLeft() { return m_iSelection[m_SelectedRow] != 0; } -bool SongSelector::CanGoRight() +bool EditMenu::CanGoRight() { int num_values[NUM_ROWS] = { @@ -168,7 +173,7 @@ bool SongSelector::CanGoRight() return m_iSelection[m_SelectedRow] != (num_values[m_SelectedRow]-1); } -void SongSelector::Up() +void EditMenu::Up() { if( CanGoUp() ) { @@ -180,7 +185,7 @@ void SongSelector::Up() } } -void SongSelector::Down() +void EditMenu::Down() { if( CanGoDown() ) { @@ -192,7 +197,7 @@ void SongSelector::Down() } } -void SongSelector::Left() +void EditMenu::Left() { if( CanGoLeft() ) { @@ -202,7 +207,7 @@ void SongSelector::Left() } } -void SongSelector::Right() +void EditMenu::Right() { if( CanGoRight() ) { @@ -213,7 +218,7 @@ void SongSelector::Right() } -void SongSelector::ChangeToRow( Row newRow ) +void EditMenu::ChangeToRow( Row newRow ) { m_SelectedRow = newRow; @@ -223,7 +228,7 @@ void SongSelector::ChangeToRow( Row newRow ) m_sprArrows[1].SetDiffuse( CanGoRight()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); } -void SongSelector::OnRowValueChanged( Row row ) +void EditMenu::OnRowValueChanged( Row row ) { m_sprArrows[0].SetDiffuse( CanGoLeft()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); m_sprArrows[1].SetDiffuse( CanGoRight()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); @@ -287,12 +292,12 @@ void SongSelector::OnRowValueChanged( Row row ) } } -Notes* SongSelector::GetSelectedNotes() +Notes* EditMenu::GetSelectedNotes() { return GetSelectedSong()->GetNotes(GetSelectedNotesType(),GetSelectedDifficulty(), false); } -Notes* SongSelector::GetSelectedSourceNotes() +Notes* EditMenu::GetSelectedSourceNotes() { return GetSelectedSong()->GetNotes(GetSelectedSourceNotesType(),GetSelectedSourceDifficulty(), false); } diff --git a/stepmania/src/SongSelector.h b/stepmania/src/EditMenu.h similarity index 85% rename from stepmania/src/SongSelector.h rename to stepmania/src/EditMenu.h index a0454bc9a2..d58fb651da 100644 --- a/stepmania/src/SongSelector.h +++ b/stepmania/src/EditMenu.h @@ -1,29 +1,30 @@ -#ifndef SONG_SELECTOR_H -#define SONG_SELECTOR_H +#ifndef EDITMENU_H +#define EDITMENU_H /* ----------------------------------------------------------------------------- - Class: SongSelector + Class: EditMenu - Desc: Choose a game, style, song and notes on one screen. + Desc: UI on Edit Menu screen. Create Notes, delete Notes, or launch Notes + in editor. - Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ #include "ActorFrame.h" -#include "MenuElements.h" #include "Banner.h" #include "TextBanner.h" #include "GameConstantsAndTypes.h" #include "FootMeter.h" +#include "RandomSample.h" -class SongSelector: public ActorFrame +class EditMenu: public ActorFrame { public: - SongSelector(); - ~SongSelector(); + EditMenu(); + ~EditMenu(); virtual void DrawPrimitives(); bool CanGoUp(); @@ -98,10 +99,6 @@ public: Notes* GetSelectedNotes(); Notes* GetSelectedSourceNotes(); - /* not used yet */ - bool m_bAllowNewNotes; - void AllowNewNotes(bool b) { m_bAllowNewNotes = b; } - private: Sprite m_sprArrows[2]; diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 37984224a7..ef3c81a146 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -70,6 +70,7 @@ void GameState::Reset() m_PlayMode = PLAY_MODE_INVALID; m_bEditing = false; m_bDemonstration = false; + m_bJukeboxUsesModifiers = false; m_iCurrentStageIndex = 0; m_bAllow2ndExtraStage = true; diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 27c0bd0d36..0846bacbac 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -67,6 +67,7 @@ public: PlayMode m_PlayMode; // many screen display different info depending on this value bool m_bEditing; // NoteField does special stuff when this is true bool m_bDemonstration; // ScreenGameplay does special stuff when this is true + bool m_bJukeboxUsesModifiers; int m_iCurrentStageIndex; // incremented on Eval screen int GetStageIndex(); diff --git a/stepmania/src/JukeboxMenu.cpp b/stepmania/src/JukeboxMenu.cpp new file mode 100644 index 0000000000..52d800b5f6 --- /dev/null +++ b/stepmania/src/JukeboxMenu.cpp @@ -0,0 +1,190 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: JukeboxMenu + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "JukeboxMenu.h" +#include "RageLog.h" +#include "SongManager.h" +#include "GameState.h" +#include "ThemeManager.h" +#include "GameManager.h" + +// +// Defines specific to JukeboxMenu +// +#define ARROWS_X( i ) THEME->GetMetricF("JukeboxMenu",ssprintf("Arrows%dX",i+1)) +#define ROW_LABELS_X THEME->GetMetricF("JukeboxMenu","RowLabelsX") +#define ROW_VALUE_X( i ) THEME->GetMetricF("JukeboxMenu",ssprintf("RowValue%dX",i+1)) +#define ROW_Y( i ) THEME->GetMetricF("JukeboxMenu",ssprintf("Row%dY",i+1)) + + +JukeboxMenu::JukeboxMenu() +{ + LOG->Trace( "ScreenJukeboxMenu::ScreenJukeboxMenu()" ); + + int i; + + for( i=0; i<2; i++ ) + { + m_sprArrows[i].Load( THEME->GetPathTo("Graphics",ssprintf("jukebox menu %s",(i==0?"left":"right"))) ); + m_sprArrows[i].SetX( ARROWS_X(i) ); + this->AddChild( &m_sprArrows[i] ); + } + + m_SelectedRow = (Row)0; + + ZERO( m_iSelection ); + + for( i=0; iGetPathTo("Fonts","header2") ); + m_textLabel[i].SetXY( ROW_LABELS_X, ROW_Y(i) ); + m_textLabel[i].SetText( RowToString((Row)i) ); + m_textLabel[i].SetZoom( 0.8f ); + m_textLabel[i].SetHorizAlign( Actor::align_left ); + this->AddChild( &m_textLabel[i] ); + + m_textValue[i].LoadFromFont( THEME->GetPathTo("Fonts","normal") ); + m_textValue[i].SetXY( ROW_VALUE_X(i), ROW_Y(i) ); + m_textValue[i].SetText( "blah" ); + m_textValue[i].SetZoom( 0.8f ); + this->AddChild( &m_textValue[i] ); + } + + m_soundChangeRow.Load( THEME->GetPathTo("sounds","jukebox menu row") ); + m_soundChangeValue.Load( THEME->GetPathTo("sounds","jukebox menu value") ); + + + // fill in data structures + GAMEMAN->GetStylesForGame( GAMESTATE->m_CurGame, m_Styles ); + SONGMAN->GetGroupNames( m_sGroups ); + m_sGroups.insert( m_sGroups.begin(), "All Music" ); + m_sDifficulties.push_back( "all difficulties" ); + for( int d=0; dGetStyleDefForStyle(GetSelectedStyle())->m_szName ); + // fall through + case ROW_GROUP: + m_textValue[ROW_GROUP].SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) ); + // fall through + case ROW_DIFFICULTY: + m_textValue[ROW_DIFFICULTY].SetText( GetSelectedDifficultyString() ); + // fall through + case ROW_MODIFIERS: + m_textValue[ROW_MODIFIERS].SetText( m_sModifiers[GetSelectedModifiers()] ); + break; + default: + ASSERT(0); // invalid row + } +} + diff --git a/stepmania/src/JukeboxMenu.h b/stepmania/src/JukeboxMenu.h new file mode 100644 index 0000000000..a77f1dd4aa --- /dev/null +++ b/stepmania/src/JukeboxMenu.h @@ -0,0 +1,86 @@ +#ifndef JukeboxMenu_H +#define JukeboxMenu_H +/* +----------------------------------------------------------------------------- + Class: JukeboxMenu + + Desc: UI on ScreenJukeboxMenu. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ActorFrame.h" +#include "Banner.h" +#include "TextBanner.h" +#include "GameConstantsAndTypes.h" +#include "FootMeter.h" +#include "RandomSample.h" +#include "Style.h" + + +class JukeboxMenu: public ActorFrame +{ +public: + JukeboxMenu(); + ~JukeboxMenu(); + virtual void DrawPrimitives(); + + bool CanGoUp(); + bool CanGoDown(); + bool CanGoLeft(); + bool CanGoRight(); + + void Up(); + void Down(); + void Left(); + void Right(); + + enum Row + { + ROW_STYLE, + ROW_GROUP, + ROW_DIFFICULTY, + ROW_MODIFIERS, + NUM_ROWS + } m_SelectedRow; + CString RowToString( Row r ) + { + const CString s[NUM_ROWS] = + { + "Style", + "Group", + "Difficulty", + "Modifiers", + }; + return s[r]; + } + + + Style GetSelectedStyle() { return m_Styles[m_iSelection[ROW_STYLE]]; } + CString GetSelectedGroup() { return m_sGroups[m_iSelection[ROW_GROUP]]; } + CString GetSelectedDifficultyString() { return m_sDifficulties[m_iSelection[ROW_DIFFICULTY]]; } + Difficulty GetSelectedDifficulty() { return StringToDifficulty( GetSelectedDifficultyString() ); } + bool GetSelectedModifiers() { return m_iSelection[ROW_MODIFIERS] != 0; } + +private: + Sprite m_sprArrows[2]; + + int m_iSelection[NUM_ROWS]; + BitmapText m_textLabel[NUM_ROWS]; + BitmapText m_textValue[NUM_ROWS]; + + vector