Added Elements to Ez2MusicSelect so that it looks similar to pump, added the "Guide" Graphic to Pump's Select Mode, Returning from Gameplay now goes to the correct SongSelect Screen based upon theme metrics.

This commit is contained in:
Andrew Livy
2002-12-20 19:05:54 +00:00
parent a4588f6c11
commit aa53eab253
12 changed files with 255 additions and 83 deletions
+176 -50
View File
@@ -1,14 +1,13 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
File: ScreenSandbox.h
File: ScreenEz2SelectMusic.cpp
Desc: Area for testing.
Desc: See Header
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
Glenn Maynard (OpenGL Code)
Lance Gilbert (OpenGL/Usability Modifications)
Andrew Livy
-----------------------------------------------------------------------------
*/
@@ -27,12 +26,27 @@
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "ThemeManager.h"
#include "GameState.h"
#include "StyleDef.h"
#include "InputMapper.h"
#include "CodeDetector.h"
#define SCROLLING_LIST_X THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListX")
#define SCROLLING_LIST_Y THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListY")
#define PUMP_DIFF_X THEME->GetMetricI("ScreenEz2SelectMusic","PumpDifficultyX")
#define PUMP_DIFF_Y THEME->GetMetricI("ScreenEz2SelectMusic","PumpDifficultyY")
#define HELP_TEXT THEME->GetMetric("ScreenSelectMusic","HelpText")
#define TIMER_SECONDS THEME->GetMetricI("ScreenSelectMusic","TimerSeconds")
#define METER_X( p ) THEME->GetMetricF("ScreenEz2SelectMusic",ssprintf("MeterP%dX",p+1))
#define METER_Y( p ) THEME->GetMetricF("ScreenEz2SelectMusic",ssprintf("MeterP%dY",p+1))
#define GUIDE_X THEME->GetMetricF("ScreenSelectMode","GuideX")
#define GUIDE_Y THEME->GetMetricF("ScreenSelectMode","GuideY")
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User+1);
ScreenEz2SelectMusic::ScreenEz2SelectMusic()
{
CodeDetector::RefreshCacheItems();
m_Menu.Load(
THEME->GetPathTo("BGAnimations","select music"),
THEME->GetPathTo("Graphics","select music top edge"),
@@ -40,52 +54,102 @@ ScreenEz2SelectMusic::ScreenEz2SelectMusic()
);
this->AddChild( &m_Menu );
m_MusicBannerWheel.SetX(CENTER_X);
m_MusicBannerWheel.SetY(CENTER_Y);
m_ChoiceListFrame.Load( THEME->GetPathTo("Graphics","select mode list frame"));
m_ChoiceListFrame.SetXY( SCROLLING_LIST_X, SCROLLING_LIST_Y);
this->AddChild( &m_ChoiceListFrame );
m_Guide.Load( THEME->GetPathTo("Graphics","select mode guide"));
m_Guide.SetXY( GUIDE_X, GUIDE_Y );
this->AddChild( &m_Guide );
m_MusicBannerWheel.SetX(SCROLLING_LIST_X);
m_MusicBannerWheel.SetY(SCROLLING_LIST_Y);
this->AddChild( &m_MusicBannerWheel );
m_ChoiceListHighlight.Load( THEME->GetPathTo("Graphics","select mode list highlight"));
m_ChoiceListHighlight.SetXY( SCROLLING_LIST_X, SCROLLING_LIST_Y);
this->AddChild( &m_ChoiceListHighlight );
for(int p=0; p<NUM_PLAYERS; p++ )
{
m_FootMeter[p].SetXY( METER_X(p), METER_Y(p) );
m_FootMeter[p].SetShadowLength( 2 );
this->AddChild( &m_FootMeter[p] );
m_iSelection[p] = 0;
}
m_PumpDifficultyRating.LoadFromFont( THEME->GetPathTo("Fonts","pump songselect difficulty") );
m_PumpDifficultyRating.SetXY( PUMP_DIFF_X, PUMP_DIFF_Y );
this->AddChild(&m_PumpDifficultyRating);
MusicChanged();
m_Menu.TweenOnScreenFromMenu( SM_None );
}
void ScreenEz2SelectMusic::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
if( type != IET_FIRST_PRESS )
return; // ignore
// if( type != IET_FIRST_PRESS )
// return; // ignore
switch( DeviceI.device)
PlayerNumber pn = GAMESTATE->GetCurrentStyleDef()->ControllerToPlayerNumber( GameI.controller );
if( CodeDetector::EnteredEasierDifficulty(GameI.controller) )
{
case DEVICE_KEYBOARD:
switch( DeviceI.button )
{
case SDLK_LEFT:
m_MusicBannerWheel.BannersLeft();
break;
case SDLK_RIGHT:
m_MusicBannerWheel.BannersRight();
break;
case SDLK_UP:
break;
case SDLK_DOWN:
break;
case SDLK_t:
{
SDL_Event *event;
event = (SDL_Event *) malloc(sizeof(event));
event->type = SDL_QUIT;
SDL_PushEvent(event);
}
case SDLK_ESCAPE:
{
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
}
}
EasierDifficulty( pn );
return;
}
if( CodeDetector::EnteredHarderDifficulty(GameI.controller) )
{
HarderDifficulty( pn );
return;
}
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
}
void ScreenEz2SelectMusic::HandleScreenMessage( const ScreenMessage SM )
{
Screen::HandleScreenMessage( SM );
switch( SM )
{
case SM_GoToPrevScreen:
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
break;
}
}
void ScreenEz2SelectMusic::MenuRight( PlayerNumber pn, const InputEventType type )
{
m_MusicBannerWheel.BannersRight();
MusicChanged();
}
void ScreenEz2SelectMusic::MenuBack( PlayerNumber pn )
{
MUSIC->Stop();
m_Menu.TweenOffScreenToBlack( SM_GoToPrevScreen, true );
}
void ScreenEz2SelectMusic::MenuLeft( PlayerNumber pn, const InputEventType type )
{
m_MusicBannerWheel.BannersLeft();
MusicChanged();
}
void ScreenEz2SelectMusic::MenuStart( PlayerNumber pn )
{
MUSIC->Stop();
SCREENMAN->SetNewScreen( "ScreenStage" );
}
void ScreenEz2SelectMusic::Update( float fDeltaTime )
{
Screen::Update( fDeltaTime );
@@ -98,19 +162,81 @@ void ScreenEz2SelectMusic::DrawPrimitives()
m_Menu.DrawTopLayer();
}
void ScreenEz2SelectMusic::HandleScreenMessage( const ScreenMessage SM )
void ScreenEz2SelectMusic::EasierDifficulty( PlayerNumber pn )
{
Screen::HandleScreenMessage( SM );
switch( SM )
if( !GAMESTATE->IsPlayerEnabled(pn) )
return;
if( m_arrayNotes[pn].empty() )
return;
if( m_iSelection[pn] == 0 )
return;
m_iSelection[pn]--;
// the user explicity switched difficulties. Update the preferred difficulty
GAMESTATE->m_PreferredDifficulty[pn] = m_arrayNotes[pn][ m_iSelection[pn] ]->m_Difficulty;
// m_soundChangeNotes.Play();
AfterNotesChange( pn );
}
void ScreenEz2SelectMusic::HarderDifficulty( PlayerNumber pn )
{
if( !GAMESTATE->IsPlayerEnabled(pn) )
return;
if( m_arrayNotes[pn].empty() )
return;
if( m_iSelection[pn] == int(m_arrayNotes[pn].size()-1) )
return;
m_iSelection[pn]++;
// the user explicity switched difficulties. Update the preferred difficulty
GAMESTATE->m_PreferredDifficulty[pn] = m_arrayNotes[pn][ m_iSelection[pn] ]->m_Difficulty;
// m_soundChangeNotes.Play();
AfterNotesChange( pn );
}
void ScreenEz2SelectMusic::MusicChanged()
{
Song* pSong = m_MusicBannerWheel.GetSelectedSong();
GAMESTATE->m_pCurSong = pSong;
int pn;
for( pn = 0; pn < NUM_PLAYERS; ++pn)
m_arrayNotes[pn].clear();
for( pn = 0; pn < NUM_PLAYERS; ++pn)
{
case SM_DoneClosingWipingLeft:
break;
case SM_DoneClosingWipingRight:
break;
case SM_DoneOpeningWipingLeft:
break;
case SM_DoneOpeningWipingRight:
break;
pSong->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef()->m_NotesType, m_arrayNotes[pn] );
SortNotesArrayByDifficulty( m_arrayNotes[pn] );
}
for( int p=0; p<NUM_PLAYERS; p++ )
{
AfterNotesChange( (PlayerNumber)p );
}
}
void ScreenEz2SelectMusic::AfterNotesChange( PlayerNumber pn )
{
if( !GAMESTATE->IsPlayerEnabled(pn) )
return;
Notes* pNotes = m_arrayNotes[pn].empty()? NULL: m_arrayNotes[pn][m_iSelection[pn]];
if( pNotes != NULL )
m_PumpDifficultyRating.SetText(ssprintf("Lv.%d",pNotes->m_iMeter));
GAMESTATE->m_pCurNotes[pn] = pNotes;
// Notes* m_pNotes = GAMESTATE->m_pCurNotes[pn];
m_FootMeter[pn].SetFromNotes( pNotes );
}