From 23df7ec56443d4c8960f51c2b84274bfcc51696a Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 24 Sep 2002 02:55:32 +0000 Subject: [PATCH] Yet more theme cleanup. This should be the job of the artists! --- stepmania/NEWS | 1 + stepmania/TODO.chris | 6 + stepmania/src/Background.cpp | 10 + stepmania/src/Background.h | 3 +- stepmania/src/NotesLoaderDWI.cpp | 4 +- stepmania/src/RageUtil.cpp | 4 +- stepmania/src/ScreenAppearanceOptions.cpp | 1 + stepmania/src/ScreenEdit.cpp | 7 +- stepmania/src/ScreenEdit.h | 2 +- stepmania/src/ScreenEditMenu.cpp | 2 +- stepmania/src/ScreenEz2SelectStyle.cpp | 2 +- stepmania/src/ScreenGameOver.cpp | 28 +-- stepmania/src/ScreenGameOver.h | 7 +- stepmania/src/ScreenGraphicOptions.cpp | 2 +- stepmania/src/ScreenManager.cpp | 4 +- stepmania/src/ScreenMapControllers.cpp | 277 ++++++++++++++++++++++ stepmania/src/ScreenMapControllers.h | 56 +++++ stepmania/src/ScreenSelectGame.cpp | 2 + stepmania/src/ScreenStage.cpp | 6 +- stepmania/src/ScreenTitleMenu.cpp | 3 +- stepmania/src/Song.cpp | 2 +- stepmania/src/StepMania.dsp | 12 +- stepmania/src/StepMania.vcproj | 4 +- 23 files changed, 392 insertions(+), 53 deletions(-) create mode 100644 stepmania/src/ScreenMapControllers.cpp create mode 100644 stepmania/src/ScreenMapControllers.h diff --git a/stepmania/NEWS b/stepmania/NEWS index 611ada5ab9..eabc448e00 100644 --- a/stepmania/NEWS +++ b/stepmania/NEWS @@ -1,4 +1,5 @@ ------------------------CVS after 3.00 beta 6---------------- +BUG FIX: DWI music sample info now read correctly - again. NEW FEATURE: Precise adjustment of timing window for each grade via the stepmania.ini file (see JudgeWindowPerfectPercent, JudgeWindowGreatPercent, etc). diff --git a/stepmania/TODO.chris b/stepmania/TODO.chris index 9ff1e5ef45..99356e7694 100644 --- a/stepmania/TODO.chris +++ b/stepmania/TODO.chris @@ -2,8 +2,14 @@ Fix ///////////////////////// +anon CVS instructions + +MS phone bill + In the arcade, it doesn't sort music by alphabetical order in its group, but rather, it sorts all the songs in a group according to light difficutly, from the easiest song on top, to the hardest light mode song on the bottom. When there are songs with the same light rating, THEN it sorts THOSE by alphabetical order. +difficulty hiding for ez2 + get rid of lines between tiles red life glow in sync with beat diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 4769211ab7..e420356136 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -93,6 +93,16 @@ void Background::Unload() m_iCurBGSegment = 0; } +void Background::LoadFromAniDir( CString sAniDir ) +{ + Unload(); + + BackgroundAnimation* pTempBGA; + pTempBGA = new BackgroundAnimation; + pTempBGA->LoadFromAniDir( sAniDir ); + m_BackgroundAnimations.Add( pTempBGA ); +} + void Background::LoadFromSong( Song* pSong ) { Unload(); diff --git a/stepmania/src/Background.h b/stepmania/src/Background.h index 25985726a5..189fe7949e 100644 --- a/stepmania/src/Background.h +++ b/stepmania/src/Background.h @@ -35,8 +35,9 @@ public: Background(); ~Background(); + virtual void LoadFromAniDir( CString sAniDir ); virtual void LoadFromSong( Song *pSong ); - virtual void Unload(); // call this on before calling load + virtual void Unload(); virtual void Update( float fDeltaTime ); virtual void DrawPrimitives(); diff --git a/stepmania/src/NotesLoaderDWI.cpp b/stepmania/src/NotesLoaderDWI.cpp index c7e272619a..2eb942ec4b 100644 --- a/stepmania/src/NotesLoaderDWI.cpp +++ b/stepmania/src/NotesLoaderDWI.cpp @@ -279,10 +279,10 @@ bool DWILoader::LoadFromDWIFile( CString sPath, Song &out ) out.m_fBeat0OffsetInSeconds = -atoi( sParams[1] ) / 1000.0f; else if( 0==stricmp(sValueName,"SAMPLESTART") ) - out.m_fMusicSampleStartSeconds = TimeToSeconds( sParams[1] ); + out.m_fMusicSampleStartSeconds = TimeToSeconds( sParams[1]+":"+sParams[2] ); // this value has a ':' in it. Colon is supposed to be a parameter separator. Stupid DWI! else if( 0==stricmp(sValueName,"SAMPLELENGTH") ) - out.m_fMusicSampleLengthSeconds = TimeToSeconds( sParams[1] ); + out.m_fMusicSampleLengthSeconds = TimeToSeconds( sParams[1]+":"+sParams[2] ); else if( 0==stricmp(sValueName,"FREEZE") ) { diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 794d08b33d..b923517e1a 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -49,8 +49,8 @@ CString SecondsToTime( float fSecs ) { int iMinsDisplay = (int)fSecs/60; int iSecsDisplay = (int)fSecs - iMinsDisplay*60; - int iLeftoverDisplay = int( (fSecs - iMinsDisplay*60 - iSecsDisplay) * 100 ); - return ssprintf( "%02d:%02d:%02d", iMinsDisplay, iSecsDisplay, iLeftoverDisplay ); + float fLeftoverDisplay = (fSecs - iMinsDisplay*60 - iSecsDisplay) * 100; + return ssprintf( "%02d:%02d:%02f", iMinsDisplay, iSecsDisplay, fLeftoverDisplay ); } //----------------------------------------------------------------------------- diff --git a/stepmania/src/ScreenAppearanceOptions.cpp b/stepmania/src/ScreenAppearanceOptions.cpp index f3dbddb1a9..3d3aed0a47 100644 --- a/stepmania/src/ScreenAppearanceOptions.cpp +++ b/stepmania/src/ScreenAppearanceOptions.cpp @@ -64,6 +64,7 @@ ScreenAppearanceOptions::ScreenAppearanceOptions() : g_AppearanceOptionsLines, NUM_APPEARANCE_OPTIONS_LINES, false ); + m_Menu.SetTimer( 99 ); m_Menu.StopTimer(); MUSIC->LoadAndPlayIfNotAlready( THEME->GetPathTo("Sounds","appearance options music") ); diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index a1758ff2e7..f2058e552d 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -198,8 +198,7 @@ ScreenEdit::ScreenEdit() GAMESTATE->m_PlayerOptions[PLAYER_1].m_fArrowScrollSpeed = 1; GAMESTATE->m_PlayerOptions[PLAYER_1].m_ColorType = PlayerOptions::COLOR_NOTE; - m_sprBackground.Load( THEME->GetPathTo("Graphics","edit background") ); - m_sprBackground.StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) ); + m_Background.LoadFromSong( m_pSong ); shiftAnchor = -1; m_SnapDisplay.SetXY( EDIT_X, EDIT_GRAY_Y ); @@ -332,7 +331,7 @@ void ScreenEdit::Update( float fDeltaTime ) } } - m_sprBackground.Update( fDeltaTime ); + m_Background.Update( fDeltaTime ); m_SnapDisplay.Update( fDeltaTime ); m_GrayArrowRowEdit.Update( fDeltaTime ); m_NoteFieldEdit.Update( fDeltaTime ); @@ -470,7 +469,7 @@ void ScreenEdit::Update( float fDeltaTime ) void ScreenEdit::DrawPrimitives() { - m_sprBackground.Draw(); + m_Background.Draw(); m_SnapDisplay.Draw(); m_GrayArrowRowEdit.Draw(); diff --git a/stepmania/src/ScreenEdit.h b/stepmania/src/ScreenEdit.h index 9507f60066..789c4d343c 100644 --- a/stepmania/src/ScreenEdit.h +++ b/stepmania/src/ScreenEdit.h @@ -53,7 +53,7 @@ protected: Song* m_pSong; Notes* m_pNotes; - Sprite m_sprBackground; + Background m_Background; NoteField m_NoteFieldEdit; SnapDisplay m_SnapDisplay; diff --git a/stepmania/src/ScreenEditMenu.cpp b/stepmania/src/ScreenEditMenu.cpp index bfde537cd6..2863ac8712 100644 --- a/stepmania/src/ScreenEditMenu.cpp +++ b/stepmania/src/ScreenEditMenu.cpp @@ -45,7 +45,7 @@ ScreenEditMenu::ScreenEditMenu() this->AddChild( &Selector ); m_Menu.Load( - THEME->GetPathTo("Graphics","edit menu background"), + THEME->GetPathTo("BGAnimations","edit menu"), THEME->GetPathTo("Graphics","edit menu top edge"), HELP_TEXT, false, false, 99 ); diff --git a/stepmania/src/ScreenEz2SelectStyle.cpp b/stepmania/src/ScreenEz2SelectStyle.cpp index f06c0cffac..3a6add648a 100644 --- a/stepmania/src/ScreenEz2SelectStyle.cpp +++ b/stepmania/src/ScreenEz2SelectStyle.cpp @@ -87,7 +87,7 @@ ScreenEz2SelectStyle::ScreenEz2SelectStyle() m_Menu.Load( - THEME->GetPathTo("Graphics","select style background"), + THEME->GetPathTo("BGAnimations","select style"), THEME->GetPathTo("Graphics","select style top edge"), HELP_TEXT, true, true, TIMER_SECONDS ); diff --git a/stepmania/src/ScreenGameOver.cpp b/stepmania/src/ScreenGameOver.cpp index df3aa1432a..7d5b3d6d5a 100644 --- a/stepmania/src/ScreenGameOver.cpp +++ b/stepmania/src/ScreenGameOver.cpp @@ -29,24 +29,11 @@ const ScreenMessage SM_PlayAnnouncer = ScreenMessage(SM_User + 3); ScreenGameOver::ScreenGameOver() { - m_bClosing = false; + m_Background.LoadFromAniDir( THEME->GetPathTo("BGAnimations","game over") ); + this->AddChild( &m_Background ); - m_sprGameOver.Load( THEME->GetPathTo("Graphics","game over") ); - m_sprGameOver.SetXY( CENTER_X, CENTER_Y ); - this->AddChild( &m_sprGameOver ); - - // tween game over - m_sprGameOver.SetGlow( D3DXCOLOR(1,1,1,0) ); - m_sprGameOver.SetDiffuse( D3DXCOLOR(1,1,1,0) ); - - m_sprGameOver.BeginTweening( 0.5f ); // fade to white - m_sprGameOver.SetTweenGlow( D3DXCOLOR(1,1,1,1) ); - - m_sprGameOver.BeginTweening( 0.01f ); // turn color on - m_sprGameOver.SetTweenDiffuse( D3DXCOLOR(1,1,1,1) ); - - m_sprGameOver.BeginTweening( 0.5f ); // fade to color - m_sprGameOver.SetTweenGlow( D3DXCOLOR(1,1,1,0) ); + m_Fade.OpenWipingRight( SM_None ); + this->AddChild( &m_Fade ); MUSIC->LoadAndPlayIfNotAlready( THEME->GetPathTo("Sounds","game over music") ); @@ -63,10 +50,7 @@ void ScreenGameOver::HandleScreenMessage( const ScreenMessage SM ) SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("game over") ); break; case SM_StartFadingOut: - m_bClosing = true; - m_sprGameOver.BeginTweening( 0.8f ); - m_sprGameOver.SetTweenDiffuse( D3DXCOLOR(1,1,1,0) ); - this->SendScreenMessage( SM_GoToNextScreen, 0.8f ); + m_Fade.CloseWipingRight( SM_GoToNextScreen ); break; case SM_GoToNextScreen: SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); @@ -76,7 +60,7 @@ void ScreenGameOver::HandleScreenMessage( const ScreenMessage SM ) void ScreenGameOver::MenuStart( PlayerNumber pn ) { - if( m_bClosing ) + if( m_Fade.IsClosing() ) return; this->ClearMessageQueue(); diff --git a/stepmania/src/ScreenGameOver.h b/stepmania/src/ScreenGameOver.h index d25b2aaee2..b5ef0d85f8 100644 --- a/stepmania/src/ScreenGameOver.h +++ b/stepmania/src/ScreenGameOver.h @@ -10,7 +10,8 @@ */ #include "Screen.h" -#include "Sprite.h" +#include "BackgroundAnimation.h" +#include "TransitionFade.h" class ScreenGameOver : public Screen @@ -24,8 +25,8 @@ public: private: - bool m_bClosing; - Sprite m_sprGameOver; + TransitionFade m_Fade; + BackgroundAnimation m_Background; }; diff --git a/stepmania/src/ScreenGraphicOptions.cpp b/stepmania/src/ScreenGraphicOptions.cpp index a03c14f159..28d6634d43 100644 --- a/stepmania/src/ScreenGraphicOptions.cpp +++ b/stepmania/src/ScreenGraphicOptions.cpp @@ -56,7 +56,7 @@ static const int VertRes[] = { ScreenGraphicOptions::ScreenGraphicOptions() : ScreenOptions( - THEME->GetPathTo("Graphics","graphic options background"), + THEME->GetPathTo("BGAnimations","graphic options"), THEME->GetPathTo("Graphics","graphic options page"), THEME->GetPathTo("Graphics","graphic options top edge") ) diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index da91e21629..7d995b4370 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -167,7 +167,7 @@ void ScreenManager::Input( const DeviceInput& DeviceI, const InputEventType type #include "ScreenHowToPlay.h" #include "ScreenInputOptions.h" #include "ScreenMachineOptions.h" -#include "ScreenMapInstruments.h" +#include "ScreenMapControllers.h" #include "ScreenMusicScroll.h" #include "ScreenPlayerOptions.h" #include "ScreenSandbox.h" @@ -204,7 +204,7 @@ Screen* ScreenManager::MakeNewScreen( CString sClassName ) else if( 0==stricmp(sClassName, "ScreenHowToPlay") ) return new ScreenHowToPlay; else if( 0==stricmp(sClassName, "ScreenInputOptions") ) return new ScreenInputOptions; else if( 0==stricmp(sClassName, "ScreenMachineOptions") ) return new ScreenMachineOptions; - else if( 0==stricmp(sClassName, "ScreenMapInstruments") ) return new ScreenMapInstruments; + else if( 0==stricmp(sClassName, "ScreenMapControllers") ) return new ScreenMapControllers; else if( 0==stricmp(sClassName, "ScreenInputOptions") ) return new ScreenInputOptions; else if( 0==stricmp(sClassName, "ScreenMusicScroll") ) return new ScreenMusicScroll; else if( 0==stricmp(sClassName, "ScreenPlayerOptions") ) return new ScreenPlayerOptions; diff --git a/stepmania/src/ScreenMapControllers.cpp b/stepmania/src/ScreenMapControllers.cpp new file mode 100644 index 0000000000..08b6887c56 --- /dev/null +++ b/stepmania/src/ScreenMapControllers.cpp @@ -0,0 +1,277 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: ScreenMapControllers + + Desc: Where the player maps device input to pad input. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ScreenMapControllers.h" +#include "PrefsManager.h" +#include "ScreenManager.h" +#include "GameConstantsAndTypes.h" +#include "PrefsManager.h" +#include "RageLog.h" +#include "InputMapper.h" +#include "GameManager.h" +#include "GameState.h" +#include "RageMusic.h" + + +#define HELP_TEXT THEME->GetMetric("ScreenMapControllers","HelpText") + + +// reserve the 3rd slot for hard-coded keys +const int NUM_CHANGABLE_SLOTS = NUM_GAME_TO_DEVICE_SLOTS-1; + + +const float TITLE_Y = 30; +const float HELP_X = CENTER_X; +const float HELP_Y = SCREEN_HEIGHT-10; +const float LINE_START_Y = 64; +const float LINE_GAP_Y = 28; +const float BUTTON_COLUMN_X[NUM_GAME_TO_DEVICE_SLOTS*MAX_GAME_CONTROLLERS] = +{ + 50, 125, 200, 440, 515, 590 +}; + + +const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+2); + + +ScreenMapControllers::ScreenMapControllers() +{ + LOG->Trace( "ScreenMapControllers::ScreenMapControllers()" ); + + for( int b=0; bGetCurrentGameDef()->m_iButtonsPerController; b++ ) + { + CString sName = GAMESTATE->GetCurrentGameDef()->m_szButtonNames[b]; + CString sSecondary = GAMESTATE->GetCurrentGameDef()->m_szSecondaryFunction[b]; + + m_textName[b].LoadFromFont( THEME->GetPathTo("Fonts","Header2") ); + m_textName[b].SetXY( CENTER_X, LINE_START_Y + b*LINE_GAP_Y-6 ); + m_textName[b].SetText( sName ); + m_textName[b].SetZoom( 0.7f ); + m_textName[b].SetShadowLength( 2 ); + this->AddChild( &m_textName[b] ); + + m_textName2[b].LoadFromFont( THEME->GetPathTo("Fonts","Header2") ); + m_textName2[b].SetXY( CENTER_X, LINE_START_Y + b*LINE_GAP_Y+6 ); + m_textName2[b].SetText( sSecondary ); + m_textName2[b].SetZoom( 0.5f ); + m_textName2[b].SetShadowLength( 2 ); + this->AddChild( &m_textName2[b] ); + + for( int p=0; pGetPathTo("Fonts","normal") ); + m_textMappedTo[p][b][s].SetXY( BUTTON_COLUMN_X[p*NUM_GAME_TO_DEVICE_SLOTS+s], LINE_START_Y + b*LINE_GAP_Y ); + m_textMappedTo[p][b][s].SetZoom( 0.5f ); + m_textMappedTo[p][b][s].SetShadowLength( 2 ); + this->AddChild( &m_textMappedTo[p][b][s] ); + } + } + } + + m_textError.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); + m_textError.SetText( "" ); + m_textError.SetXY( CENTER_X, CENTER_Y ); + m_textError.SetDiffuse( D3DXCOLOR(0,1,0,0) ); + m_textError.SetZoom( 0.8f ); + this->AddChild( &m_textError ); + + + m_iCurController = 0; + m_iCurButton = 0; + m_iCurSlot = 0; + + m_bWaitingForPress = false; + + m_Menu.Load( + THEME->GetPathTo("BGAnimations","map controllers"), + THEME->GetPathTo("Graphics","map controllers top edge"), + HELP_TEXT, false, false, 99 + ); + m_Menu.TweenOnScreenFromBlack( SM_None ); + this->AddChild( &m_Menu ); + + MUSIC->LoadAndPlayIfNotAlready( THEME->GetPathTo("Sounds","map controllers music") ); + + Refresh(); +} + + + +ScreenMapControllers::~ScreenMapControllers() +{ + LOG->Trace( "ScreenMapControllers::~ScreenMapControllers()" ); +} + + +void ScreenMapControllers::Update( float fDeltaTime ) +{ + Screen::Update( fDeltaTime ); + + for( int b=0; bGetCurrentGameDef()->m_iButtonsPerController; b++ ) + { + CString sButtonName = GAMESTATE->GetCurrentGameDef()->m_szButtonNames[b]; + + if( sButtonName == "Start" || sButtonName == "Back" ) + continue; + } +} + + +void ScreenMapControllers::DrawPrimitives() +{ + m_Menu.DrawBottomLayer(); + Screen::DrawPrimitives(); + m_Menu.DrawTopLayer(); +} + +void ScreenMapControllers::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) +{ + if( type != IET_FIRST_PRESS && type != IET_SLOW_REPEAT ) + return; // ignore + + LOG->Trace( "ScreenMapControllers::Input(): device: %d, button: %d", + DeviceI.device, DeviceI.button ); + + if( m_bWaitingForPress ) // we're going to map an input + { + // ignore joystick D-Pad presses if the user has set their pref. + if( PREFSMAN->m_bIgnoreJoyAxes && + DEVICE_JOY1 <= DeviceI.device && DeviceI.device <= DEVICE_JOY4 && + ( DeviceI.button == JOY_LEFT || DeviceI.button == JOY_RIGHT || DeviceI.button == JOY_UP || DeviceI.button == JOY_DOWN ) ) + { + //m_textError.SetText( "Game option is set to ignore the Joystick D-Pad." ); + //m_fErrorDisplayCountdown = 5; // show the error message + m_textError.SetDiffuse( D3DXCOLOR(0,1,0,1) ); + m_textError.BeginTweening( 3 ); + m_textError.BeginTweening( 1 ); + m_textError.SetTweenDiffuse( D3DXCOLOR(0,1,0,0) ); + + return; // ignore this press + } + + GameInput curGameI( (GameController)m_iCurController, + (GameButton)m_iCurButton ); + + INPUTMAPPER->SetInputMap( DeviceI, curGameI, m_iCurSlot ); + INPUTMAPPER->AddDefaultMappingsForCurrentGameIfUnmapped(); + // commit to disk so we don't lose the changes! + INPUTMAPPER->SaveMappingsToDisk(); + + m_bWaitingForPress = false; + } + else if( DeviceI.device == DEVICE_KEYBOARD ) + { + switch( DeviceI.button ) + { + /* We only advertise space as doing this, but most games + * use either backspace or delete, and I find them more + * intuitive, so allow them, too. -gm */ + case DIK_SPACE: + case DIK_DELETE: + case DIK_BACK: /* Clear the selected input mapping. */ + { + GameInput curGameI( (GameController)m_iCurController, (GameButton)m_iCurButton ); + INPUTMAPPER->ClearFromInputMap( curGameI, m_iCurSlot ); + INPUTMAPPER->AddDefaultMappingsForCurrentGameIfUnmapped(); + // commit to disk so we don't lose the changes! + INPUTMAPPER->SaveMappingsToDisk(); + } + break; + case DIK_LEFT: /* Move the selection left, wrapping up. */ + if( m_iCurSlot == 0 && m_iCurController == 0 ) + break; // can't go left any more + m_iCurSlot--; + if( m_iCurSlot < 0 ) + { + m_iCurSlot = NUM_CHANGABLE_SLOTS-1; + m_iCurController--; + } + break; + case DIK_RIGHT: /* Move the selection right, wrapping down. */ + if( m_iCurSlot == NUM_CHANGABLE_SLOTS-1 && m_iCurController == MAX_GAME_CONTROLLERS-1 ) + break; // can't go right any more + m_iCurSlot++; + if( m_iCurSlot > NUM_CHANGABLE_SLOTS-1 ) + { + m_iCurSlot = 0; + m_iCurController++; + } + break; + case DIK_UP: /* Move the selection up. */ + if( m_iCurButton == 0 ) + break; // can't go up any more + m_iCurButton--; + break; + case DIK_DOWN: /* Move the selection down. */ + if( m_iCurButton == GAMESTATE->GetCurrentGameDef()->m_iButtonsPerController-1 ) + break; // can't go down any more + m_iCurButton++; + break; + case DIK_ESCAPE: /* Quit the screen. */ + m_Menu.TweenOffScreenToBlack( SM_GoToNextScreen, true ); + break; + case DIK_RETURN: /* Change the selection. */ + m_bWaitingForPress = true; + break; + } + } + +// Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default handler + + LOG->Trace( "m_iCurSlot: %d m_iCurController: %d m_iCurButton: %d", m_iCurSlot, m_iCurController, m_iCurButton ); + + Refresh(); +} + +void ScreenMapControllers::HandleScreenMessage( const ScreenMessage SM ) +{ + switch( SM ) + { + case SM_GoToNextScreen: + SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); + break; + } +} + +void ScreenMapControllers::Refresh() +{ + for( int p=0; pGetCurrentGameDef()->m_iButtonsPerController; b++ ) + { + for( int s=0; sGameToDevice( cur_gi, s, di ) ) + m_textMappedTo[p][b][s].SetText( di.GetDescription() ); + else + m_textMappedTo[p][b][s].SetText( "-----------" ); + + // highlight the currently selected pad button + D3DXCOLOR color; + if( p == m_iCurController && b == m_iCurButton && s == m_iCurSlot ) + { + if( m_bWaitingForPress ) + color = D3DXCOLOR(1,0.5,0.5,1); // red + else + color = D3DXCOLOR(1,1,1,1); // white + } + else + color = D3DXCOLOR(0.5,0.5,0.5,1); // gray + m_textMappedTo[p][b][s].SetDiffuse( color ); + } + } + } +} diff --git a/stepmania/src/ScreenMapControllers.h b/stepmania/src/ScreenMapControllers.h new file mode 100644 index 0000000000..0575b1c6cd --- /dev/null +++ b/stepmania/src/ScreenMapControllers.h @@ -0,0 +1,56 @@ +/* +----------------------------------------------------------------------------- + Class: ScreenMapControllers + + Desc: Where the player maps device input to instrument buttons. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Screen.h" +#include "Sprite.h" +#include "BitmapText.h" +#include "PrefsManager.h" +#include "GrayArrow.h" +#include "InputMapper.h" +#include "MenuElements.h" + + +class ScreenMapControllers : public Screen +{ +public: + ScreenMapControllers(); + virtual ~ScreenMapControllers(); + + virtual void Update( float fDeltaTime ); + virtual void DrawPrimitives(); + virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); + virtual void HandleScreenMessage( const ScreenMessage SM ); + +private: + void KeyLeft(); + void KeyRight(); + void KeyUp(); + void KeyDown(); + void KeyBack(); + void KeyStart(); + + void Refresh(); + + + int m_iCurController; + int m_iCurButton; + int m_iCurSlot; + bool m_bWaitingForPress; + + BitmapText m_textError; + BitmapText m_textName[MAX_GAME_BUTTONS]; + BitmapText m_textName2[MAX_GAME_BUTTONS]; + BitmapText m_textMappedTo[MAX_GAME_CONTROLLERS][MAX_GAME_BUTTONS][NUM_GAME_TO_DEVICE_SLOTS]; + + MenuElements m_Menu; + +}; + diff --git a/stepmania/src/ScreenSelectGame.cpp b/stepmania/src/ScreenSelectGame.cpp index 8519832a9e..69e3ce6286 100644 --- a/stepmania/src/ScreenSelectGame.cpp +++ b/stepmania/src/ScreenSelectGame.cpp @@ -71,6 +71,8 @@ ScreenSelectGame::ScreenSelectGame() : g_SelectGameLines, NUM_SELECT_GAME_LINES, false ); + m_Menu.SetTimer( 99 ); + m_Menu.StopTimer(); MUSIC->LoadAndPlayIfNotAlready( THEME->GetPathTo("Sounds","select game music") ); } diff --git a/stepmania/src/ScreenStage.cpp b/stepmania/src/ScreenStage.cpp index f140663ead..464b21a98d 100644 --- a/stepmania/src/ScreenStage.cpp +++ b/stepmania/src/ScreenStage.cpp @@ -365,9 +365,9 @@ ScreenStage::ScreenStage() for (i=0; i<2; i++) // specify the font file. { - m_ez2ukm[i].LoadFromFont( THEME->GetPathTo("Fonts","Stage") ); + m_ez2ukm[i].LoadFromFont( THEME->GetPathTo("Fonts","Stage ez2") ); m_ez2ukm[i].TurnShadowOff(); - m_stagedesc[i].LoadFromFont( THEME->GetPathTo("Fonts","Stage") ); + m_stagedesc[i].LoadFromFont( THEME->GetPathTo("Fonts","Stage ez2") ); m_stagedesc[i].TurnShadowOff(); } @@ -481,7 +481,7 @@ ScreenStage::ScreenStage() // write the stage name - m_stagename.LoadFromFont( THEME->GetPathTo("Fonts","Stage") ); + m_stagename.LoadFromFont( THEME->GetPathTo("Fonts","Stage ez2") ); m_stagename.TurnShadowOff(); m_stagename.SetXY( CENTER_X+400, CENTER_Y-30+element_y_offsets ); // set initial position diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index 6afb130386..e484862f53 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -210,7 +210,7 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM ) SCREENMAN->SetNewScreen( "ScreenSelectGame" ); break; case CHOICE_MAP_INSTRUMENTS: - SCREENMAN->SetNewScreen( "ScreenMapInstruments" ); + SCREENMAN->SetNewScreen( "ScreenMapControllers" ); break; case CHOICE_INPUT_OPTIONS: SCREENMAN->SetNewScreen( "ScreenInputOptions" ); @@ -241,6 +241,7 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM ) case GAME_DANCE: GAMESTATE->m_CurStyle = STYLE_DANCE_VERSUS; break; case GAME_PUMP: GAMESTATE->m_CurStyle = STYLE_PUMP_VERSUS; break; case GAME_EZ2: GAMESTATE->m_CurStyle = STYLE_EZ2_SINGLE_VERSUS; break; + case GAME_PARA: GAMESTATE->m_CurStyle = STYLE_PARA_SINGLE; break; default: ASSERT(0); } diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 4454dc32a0..2f87dfda6a 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -32,7 +32,7 @@ #include "NotesLoaderKSF.h" #include "NotesWriterDWI.h" -const int FILE_CACHE_VERSION = 70; // increment this when Song or Notes changes to invalidate cache +const int FILE_CACHE_VERSION = 73; // increment this when Song or Notes changes to invalidate cache int CompareBPMSegments(const void *arg1, const void *arg2) diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index d3d62e5d5d..17352ca873 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -56,10 +56,10 @@ LINK32=link.exe # ADD LINK32 $(intdir)\verstub.obj /nologo /subsystem:windows /map /debug /machine:I386 # Begin Special Build Tool IntDir=.\../Release6 -TargetDir=\Stepmania\stepmania +TargetDir=\stepmania\stepmania TargetName=StepMania SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -91,10 +91,10 @@ LINK32=link.exe # SUBTRACT LINK32 /profile /incremental:no /nodefaultlib # Begin Special Build Tool IntDir=.\../Debug6 -TargetDir=\Stepmania\stepmania +TargetDir=\stepmania\stepmania TargetName=StepMania-debug SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -1192,11 +1192,11 @@ SOURCE=.\ScreenManager.h # End Source File # Begin Source File -SOURCE=.\ScreenMapInstruments.cpp +SOURCE=.\ScreenMapControllers.cpp # End Source File # Begin Source File -SOURCE=.\ScreenMapInstruments.h +SOURCE=.\ScreenMapControllers.h # End Source File # Begin Source File diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 6fa24fd379..d667173603 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -262,10 +262,10 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ RelativePath="ScreenManager.h"> + RelativePath="ScreenMapControllers.cpp"> + RelativePath="ScreenMapControllers.h">