diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index e88ea1bc90..44cec63872 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -18,24 +18,10 @@ const CString VIS_DIR = "Visualizations\\"; -const CString PARTICLE_DIR = "BGEffects\\particles\\"; -const CString BACKGROUND_DIR = "BGEffects\\backgrounds\\"; - - -// macro for handling CArrays of pointers -#define DELETE_CARRAY_CONTENTS( p ) {\ -for( int d_ca_cI=0; d_ca_cI < (p).GetSize(); d_ca_cI++ ){ \ - if((p).GetAt( d_ca_cI )) \ - delete (p).GetAt( d_ca_cI ); \ -}} - -#define GET_RAND_ELEMENT( p ) ( (p).GetAt( rand() % (p).GetSize() ) ) Background::Background() { - m_totalTime = 0.0f; - m_bShowDanger = false; m_sprDanger.SetZoom( 2 ); @@ -45,116 +31,28 @@ Background::Background() m_sprDangerBackground.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_DANGER_BACKGROUND) ); m_sprDangerBackground.StretchTo( CRect((int)SCREEN_LEFT, (int)SCREEN_TOP, (int)SCREEN_RIGHT, (int)SCREEN_BOTTOM) ); - - // load particle sprites - m_curParticleSprite = NULL; - LoadParticleSprites( PARTICLE_DIR ); - - // load particle systems - m_curPS = NULL; - LoadParticleSystems(); - - // load background sprites - m_curBackground = NULL; - LoadBackgroundSprites( BACKGROUND_DIR ); - - m_songBackground = NULL; - } - -void Background::LoadParticleSprites( CString path ) -{ - CStringArray filenames; - - // get full path filenames for particleSprites - GetDirListing( path+"*.sprite", filenames, false, true ); - - // load sprites - for( int i=0; i < filenames.GetSize(); i++ ) - { - Sprite * temp = new Sprite(); - - temp->Load( filenames.GetAt(i) ); - temp->SetBlendModeAdd(); - - m_particleSprites.Add( temp ); - } -} - - -void Background::LoadParticleSystems() -{ - m_particleSystems.Add( new DroppingParticleSystem ); - m_particleSystems.Add( new SpiralParticleSystem ); - m_particleSystems.Add( new ScrollingParticleSystem ); -} - - -void Background::LoadBackgroundSprites( CString path ) -{ - CStringArray filenames; - - // get full path filenames for particleSprites - GetDirListing( path+"*.png", filenames, false, true ); - - // load sprites - for( int i=0; i < filenames.GetSize(); i++ ) - { - Sprite * temp = new Sprite(); - - temp->Load( filenames.GetAt(i) ); - - float colTiles = SCREEN_WIDTH / temp->GetUnzoomedWidth(); - float rowTiles = SCREEN_HEIGHT / temp->GetUnzoomedHeight(); - - temp->StretchTo( CRect( SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM ) ); - - float textCoords[] = { - 0,rowTiles, // bottom-left - 0,0, // top-left - colTiles, rowTiles, // bottom-right - colTiles, 0, // top-right - }; - temp->SetCustomTextureCoords( textCoords ); - - m_backgroundSprites.Add( temp ); - } -} - - -Background::~Background() -{ - DELETE_CARRAY_CONTENTS( m_particleSprites ); - DELETE_CARRAY_CONTENTS( m_particleSystems ); - DELETE_CARRAY_CONTENTS( m_backgroundSprites ); -} - - - bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations ) { - Sprite * sprSongBackground = new Sprite(); - if( pSong->HasBackgroundMovie() ) { // load the movie backgound, and don't load a visualization - sprSongBackground->Load( pSong->GetBackgroundMoviePath() ); - sprSongBackground->StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) ); - sprSongBackground->SetZoomY( -1 ); - sprSongBackground->SetDiffuseColor( D3DXCOLOR(0,0,0,1) ); - //this->AddActor( &m_sprSongBackground ); - + m_sprSongBackground.Load( pSong->GetBackgroundMoviePath() ); + m_sprSongBackground.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) ); + m_sprSongBackground.SetZoomY( -1 ); + m_sprSongBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) ); + this->AddActor( &m_sprSongBackground ); } else { // load the static background (if available), and a visualization - if( pSong->HasBackground() ) sprSongBackground->Load( pSong->GetBackgroundPath(), false, 2, 0, true ); - else sprSongBackground->Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND), false, 2, 0, true ); + if( pSong->HasBackground() ) m_sprSongBackground.Load( pSong->GetBackgroundPath(), false, 2, 0, true ); + else m_sprSongBackground.Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND), false, 2, 0, true ); - sprSongBackground->StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) ); - sprSongBackground->SetDiffuseColor( D3DXCOLOR(0,0,0,1) ); - //this->AddActor( &m_sprSongBackground ); + m_sprSongBackground.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) ); + m_sprSongBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) ); + this->AddActor( &m_sprSongBackground ); if( PREFSMAN->m_bUseRandomVis && !bDisableVisualizations ) @@ -180,13 +78,6 @@ bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations ) } } - m_backgroundSprites.Add( sprSongBackground ); - m_songBackground = sprSongBackground; - - - // get a effect to start with - NextEffect(); - return true; } @@ -194,36 +85,10 @@ void Background::Update( float fDeltaTime ) { ActorFrame::Update( fDeltaTime ); - m_totalTime += fDeltaTime; - m_sprVisualizationOverlay.Update( fDeltaTime ); - //m_sprSongBackground.Update( fDeltaTime ); + m_sprSongBackground.Update( fDeltaTime ); m_sprDanger.Update( fDeltaTime ); m_sprDangerBackground.Update( fDeltaTime ); - - if( m_curPS && m_curParticleSprite ) - { - m_curParticleSprite->Update( fDeltaTime ); - m_curPS->update( fDeltaTime ); - } - if( m_curBackground ) - { - if( m_curBackground != m_songBackground ) - { - float tweenPeriod = 2.0f; - float rads = ( fmodf( m_totalTime, tweenPeriod ) / tweenPeriod ) * 2.0f * D3DX_PI; - - D3DXCOLOR color = D3DXCOLOR( - cosf( rads ) * 0.5f + 0.5f, - cosf( rads + D3DX_PI * 2.0f / 3.0f ) * 0.5f + 0.5f, - cosf( rads + D3DX_PI * 4.0f / 3.0f) * 0.5f + 0.5f, - 1.0f - ); - m_curBackground->SetDiffuseColor( color ); - - } - m_curBackground->Update( fDeltaTime ); - } } void Background::DrawPrimitives() @@ -237,34 +102,10 @@ void Background::DrawPrimitives() } else { - //m_sprSongBackground.Draw(); + m_sprSongBackground.Draw(); m_sprVisualizationOverlay.Draw(); - - if( m_curBackground ) - m_curBackground->Draw(); - - if( m_curPS && m_curParticleSprite ) - m_curPS->draw( m_curParticleSprite ); } } - -void Background::NextEffect() -{ - // randomly choose a particle system - if( m_particleSystems.GetSize() > 0 ) - m_curPS = GET_RAND_ELEMENT( m_particleSystems ); - - // randomly choose a particle sprite - if( m_particleSprites.GetSize() > 0 ) - m_curParticleSprite = GET_RAND_ELEMENT( m_particleSprites ); - - // randomly choose a background sprite - if( m_backgroundSprites.GetSize() > 0 ) - { - m_curBackground = GET_RAND_ELEMENT( m_backgroundSprites ); - } -} - diff --git a/stepmania/src/Background.h b/stepmania/src/Background.h index 1743c2f516..184d61c20f 100644 --- a/stepmania/src/Background.h +++ b/stepmania/src/Background.h @@ -12,22 +12,16 @@ #define _Background_H_ -#include "RageUtil.h" #include "Sprite.h" #include "ActorFrame.h" #include "Song.h" -#include "ParticleSystem.h" - - class Background : public ActorFrame { public: Background(); - virtual ~Background(); - virtual bool LoadFromSong( Song *pSong, bool bDisableVisualizations = false ); virtual void Update( float fDeltaTime ); @@ -36,12 +30,7 @@ public: virtual void SetDiffuseColor( D3DXCOLOR c ) { m_sprVisualizationOverlay.SetDiffuseColor( c ); - - for( int i=0; i < m_backgroundSprites.GetSize(); i++ ) - m_backgroundSprites[i]->SetDiffuseColor(c); - - //m_sprSongBackground.SetDiffuseColor( c ); - + m_sprSongBackground.SetDiffuseColor( c ); m_sprDanger.SetDiffuseColor( c ); m_sprDangerBackground.SetDiffuseColor( c ); }; @@ -51,34 +40,14 @@ public: virtual bool IsDangerOn() { return m_bShowDanger; }; - virtual void NextEffect(); - protected: - - virtual void LoadParticleSprites( CString path ); - virtual void LoadBackgroundSprites( CString path ); - virtual void LoadParticleSystems(); - - - //CArray m_backgroundTiles; - CArray m_particleSprites; - Sprite * m_curParticleSprite; - - CArray m_particleSystems; - ParticleSystem* m_curPS; - - CArray m_backgroundSprites; - Sprite * m_curBackground; - Sprite m_sprVisualizationOverlay; - Sprite * m_songBackground; + Sprite m_sprSongBackground; Sprite m_sprDanger; Sprite m_sprDangerBackground; bool m_bShowDanger; - - float m_totalTime; }; diff --git a/stepmania/src/Combo.cpp b/stepmania/src/Combo.cpp index d4957487fe..920b972362 100644 --- a/stepmania/src/Combo.cpp +++ b/stepmania/src/Combo.cpp @@ -57,7 +57,7 @@ void Combo::ContinueCombo( const int iNumNotesHit ) m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // visible m_textComboNumber.SetText( ssprintf("%d", m_iCurCombo) ); - float fNewZoom = min( 2, 0.5f + m_iCurCombo/800.0f ); + float fNewZoom = 0.5f + m_iCurCombo/800.0f; m_textComboNumber.SetZoom( fNewZoom ); //this->SetZoom( 1.2f ); diff --git a/stepmania/src/DifficultyIcon.h b/stepmania/src/DifficultyIcon.h index 8ebc52c95f..833b8416b4 100644 --- a/stepmania/src/DifficultyIcon.h +++ b/stepmania/src/DifficultyIcon.h @@ -22,7 +22,7 @@ class DifficultyIcon : public Sprite public: DifficultyIcon() { - Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_DIFFICULTY_ICONS) ); + Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_DIFFICULTY_BANNER_ICONS) ); StopAnimating(); SetFromNotes( NULL ); diff --git a/stepmania/src/FootMeter.cpp b/stepmania/src/FootMeter.cpp index d7fab355be..68343665b1 100644 --- a/stepmania/src/FootMeter.cpp +++ b/stepmania/src/FootMeter.cpp @@ -34,6 +34,11 @@ void FootMeter::SetFromNotes( Notes* pNotes ) this->SetEffectGlowing(); else this->SetEffectNone(); + + this->StopTweening(); + this->SetZoom( 1.1f ); + this->BeginTweening( 0.3f, TWEEN_BOUNCE_BEGIN ); + this->SetTweenZoom( 1 ); } else { diff --git a/stepmania/src/GameConstantsAndTypes.h b/stepmania/src/GameConstantsAndTypes.h index f5b32318a8..2f9c7919fb 100644 --- a/stepmania/src/GameConstantsAndTypes.h +++ b/stepmania/src/GameConstantsAndTypes.h @@ -121,8 +121,8 @@ enum RadarCatrgory // starting from 12-o'clock rotating clockwise RADAR_STREAM = 0, RADAR_VOLTAGE, RADAR_AIR, - RADAR_FREEZE, RADAR_CHAOS, + RADAR_FREEZE, NUM_RADAR_VALUES // leave this at the end }; @@ -216,15 +216,14 @@ enum PlayMode { PLAY_MODE_ARCADE, PLAY_MODE_ONI, - NUM_PLAY_MODES, - PLAY_MODE_INVALID + NUM_PLAY_MODES }; enum PlayerNumber { PLAYER_1 = 0, PLAYER_2, NUM_PLAYERS, // leave this at the end - PLAYER_INVALID + PLAYER_NONE }; inline D3DXCOLOR PlayerToColor( const PlayerNumber p ) @@ -257,7 +256,7 @@ enum Game GAME_PUMP, // Pump It Up GAME_EZ2, // Ez2dancer NUM_GAMES, // leave this at the end - GAME_INVALID, + GAME_NONE, }; enum Style @@ -393,74 +392,3 @@ struct SongOptions }; - - - -/////////////////////////// -// Scoring stuff -/////////////////////////// - -enum TapNoteScore { - TNS_NONE, - TNS_MISS, - TNS_BOO, - TNS_GOOD, - TNS_GREAT, - TNS_PERFECT, -}; - -inline int TapNoteScoreToDancePoints( TapNoteScore tns ) -{ - // What "Aaron in Japan" says: - /* - switch( tns ) - { - case TNS_PERFECT: return +2; - case TNS_GREAT: return +1; - case TNS_GOOD: return +0; - case TNS_BOO: return -4; - case TNS_MISS: return -8; - case TNS_NONE: return -8; - default: ASSERT(0); - } - */ - // What seems more realistic to me: - switch( tns ) - { - case TNS_PERFECT: return +2; - case TNS_GREAT: return +1; - case TNS_GOOD: return +0; - case TNS_BOO: return 0; - case TNS_MISS: return -2; - case TNS_NONE: return -4; - default: ASSERT(0); return 0; - } -} - -//enum TapNoteTiming { -// TNT_NONE, -// TNT_EARLY, -// TNT_LATE -//}; - - -enum HoldNoteScore -{ - HNS_NONE, // this HoldNote has not been scored yet - HNS_OK, // the HoldNote has passed and was successfully held all the way through - HNS_NG // the HoldNote has passed and they missed it -}; - - -inline int HoldNoteScoreToDancePoints( HoldNoteScore hns ) -{ - switch( hns ) - { - case HNS_OK: return +6; - case HNS_NG: return +0; - default: ASSERT(0); return 0; - } -} - - - diff --git a/stepmania/src/GameDef.h b/stepmania/src/GameDef.h index d54e50e201..b032b7926a 100644 --- a/stepmania/src/GameDef.h +++ b/stepmania/src/GameDef.h @@ -71,7 +71,7 @@ public: if( m_iMenuButtons[b] == GameI.button ) return MenuInput( p, (MenuButton)b ); } - return MenuInput( PLAYER_INVALID, MENU_BUTTON_INVALID ); + return MenuInput( PLAYER_NONE, MENU_BUTTON_NONE ); }; inline GameInput MenuInputToGameInput( const MenuInput MenuI ) { diff --git a/stepmania/src/GhostArrow.h b/stepmania/src/GhostArrow.h index ae1af7f8d6..3719a512b5 100644 --- a/stepmania/src/GhostArrow.h +++ b/stepmania/src/GhostArrow.h @@ -1,19 +1,23 @@ -#pragma once /* ----------------------------------------------------------------------------- - Class: GhostArrow + File: GhostArrow.h - Desc: The trail a note leaves when it is destroyed. + Desc: Class used to represent a color arrow on the screen. - Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. - Ben Nordstrom - Chris Danford + Copyright (c) 2001 Ben Norstrom. All rights reserved. ----------------------------------------------------------------------------- */ +class GhostArrow; + +#ifndef _GhostArrow_H_ +#define _GhostArrow_H_ + + #include "Sprite.h" -#include "GameConstantsAndTypes.h" +#include "Notes.h" + class GhostArrow : public Sprite { @@ -27,3 +31,5 @@ public: float m_fVisibilityCountdown; }; + +#endif diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index 95334b4ef1..4e0080b35c 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -177,7 +177,7 @@ void InputMapper::UpdateTempDItoGI() bool InputMapper::DeviceToGame( DeviceInput DeviceI, GameInput& GameI ) // return true if there is a mapping from device to pad { GameI = m_tempDItoGI[DeviceI.device][DeviceI.button]; - return GameI.number != PLAYER_INVALID; + return GameI.number != PLAYER_NONE; } bool InputMapper::GameToDevice( GameInput GameI, int iSoltNum, DeviceInput& DeviceI ) // return true if there is a mapping from pad to device @@ -216,7 +216,7 @@ MenuInput InputMapper::DeviceToMenu( DeviceInput DeviceI ) } } - return MenuInput( PLAYER_INVALID, MENU_BUTTON_INVALID ); + return MenuInput( PLAYER_NONE, MENU_BUTTON_NONE ); } DeviceInput InputMapper::MenuToDevice( MenuInput MenuI ) diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index 7e11b2b7a2..f15b731048 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -18,15 +18,11 @@ const int NUM_SECTIONS = 3; const float SECTION_WIDTH = 1.0f/NUM_SECTIONS; -const float ABOUT_TO_FAIL_THRESHOLD = -0.3f; -const float FAIL_THRESHOLD = 0; - LifeMeterBar::LifeMeterBar() { m_fLifePercentage = 0.5f; m_fTrailingLifePercentage = 0; m_fLifeVelocity = 0; - m_bHasFailed = false; ResetBarVelocity(); } @@ -38,20 +34,20 @@ void LifeMeterBar::ChangeLife( TapNoteScore score ) float fDeltaLife; switch( score ) { - case TNS_PERFECT: fDeltaLife = +0.015f; break; - case TNS_GREAT: fDeltaLife = +0.008f; break; - case TNS_GOOD: fDeltaLife = +0.000f; break; - case TNS_BOO: fDeltaLife = -0.050f; break; - case TNS_MISS: fDeltaLife = -0.100f; break; + case TNS_PERFECT: fDeltaLife = +0.02f; break; + case TNS_GREAT: fDeltaLife = +0.01f; break; + case TNS_GOOD: fDeltaLife = +0.00f; break; + case TNS_BOO: fDeltaLife = -0.06f; break; + case TNS_MISS: fDeltaLife = -0.12f; break; } if( bWasDoingGreat && !IsDoingGreat() ) - fDeltaLife = -0.10f; // make it take a while to get back to "doing great" + fDeltaLife = -0.12f; // make it take a while to get back to "doing great" m_fLifePercentage += fDeltaLife; - m_fLifePercentage = min( m_fLifePercentage, 1 ); + m_fLifePercentage = clamp( m_fLifePercentage, 0, 1 ); - if( m_fLifePercentage < FAIL_THRESHOLD ) + if( m_fLifePercentage == 0 ) m_bHasFailed = true; ResetBarVelocity(); @@ -72,7 +68,7 @@ bool LifeMeterBar::IsDoingGreat() bool LifeMeterBar::IsAboutToFail() { - return m_fLifePercentage < ABOUT_TO_FAIL_THRESHOLD; + return m_fLifePercentage < 0.3f; } bool LifeMeterBar::HasFailed() @@ -90,7 +86,7 @@ void LifeMeterBar::Update( float fDeltaTime ) float fNewDelta = m_fLifePercentage - m_fTrailingLifePercentage; if( fDelta * fNewDelta < 0 ) // the deltas have different signs - m_fLifeVelocity /= 4; // make some drag + m_fLifeVelocity /= 4; m_fTrailingLifePercentage = clamp( m_fTrailingLifePercentage, 0, 1 ); } diff --git a/stepmania/src/MenuElements.cpp b/stepmania/src/MenuElements.cpp index 63da1bb5e4..d2d6d8e640 100644 --- a/stepmania/src/MenuElements.cpp +++ b/stepmania/src/MenuElements.cpp @@ -108,9 +108,9 @@ void MenuElements::Load( CString sBackgroundPath, CString sTopEdgePath, CString if( GAMEMAN->m_CurStyle == STYLE_NONE ) m_textCreditInfo[p].SetText( "PRESS START" ); else if( GAMEMAN->IsPlayerEnabled( (PlayerNumber)p ) ) - m_textCreditInfo[p].SetText( "" ); + m_textCreditInfo[p].SetText( "PRESENT" ); else // not enabled - m_textCreditInfo[p].SetText( "NOT PRESENT" ); + m_textCreditInfo[p].SetText( "CREDIT(S): 0 / 0" ); m_textCreditInfo[p].SetZoom( 0.5f ); diff --git a/stepmania/src/MenuInput.h b/stepmania/src/MenuInput.h index bcab3a861e..7ed78672ae 100644 --- a/stepmania/src/MenuInput.h +++ b/stepmania/src/MenuInput.h @@ -22,7 +22,7 @@ enum MenuButton MENU_BUTTON_START, MENU_BUTTON_BACK, NUM_MENU_BUTTONS, // leave this at the end - MENU_BUTTON_INVALID + MENU_BUTTON_NONE }; @@ -37,9 +37,9 @@ struct MenuInput bool operator==( const MenuInput &other ) { return player == other.player && button == other.button; }; - inline bool IsBlank() const { return player == PLAYER_INVALID; }; + inline bool IsBlank() const { return player == PLAYER_NONE; }; inline bool IsValid() const { return !IsBlank(); }; - inline void MakeBlank() { player = PLAYER_INVALID; button = MENU_BUTTON_INVALID; }; + inline void MakeBlank() { player = PLAYER_NONE; button = MENU_BUTTON_NONE; }; }; diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 3b40ec7165..2ff353daa8 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -23,11 +23,7 @@ const float FADE_TIME = 1.0f; -const float SWITCH_MUSIC_TIME = 0.15f; -const float ROULETTE_SWITCH_MUSIC_TIME = SWITCH_MUSIC_TIME/2; -const int ROULETTE_SWITCHES_IN_SLOWING_DOWN = 5; - -const float LOCKED_WHEEL_INITIAL_VELOCITY = 10; +const float SWITCH_MUSIC_TIME = 0.3f; const float SORT_ICON_ON_SCREEN_X = -140; const float SORT_ICON_ON_SCREEN_Y = -180; @@ -55,8 +51,6 @@ D3DXCOLOR SECTION_COLORS[] = { }; const int NUM_SECTION_COLORS = sizeof(SECTION_COLORS)/sizeof(D3DXCOLOR); - - inline D3DXCOLOR GetNextSectionColor() { static int i=0; @@ -64,6 +58,8 @@ inline D3DXCOLOR GetNextSectionColor() return SECTION_COLORS[i++]; } + + WheelItemData::WheelItemData() { m_pSong = NULL; @@ -329,15 +325,12 @@ MusicWheel::MusicWheel() this->AddActor( &m_ScrollBar ); - m_soundChangeMusic.Load( THEME->GetPathTo(SOUND_SELECT_MUSIC_CHANGE_MUSIC), 16 ); + m_soundChangeMusic.Load( THEME->GetPathTo(SOUND_SELECT_MUSIC_CHANGE_MUSIC), 10 ); m_soundChangeSort.Load( THEME->GetPathTo(SOUND_SELECT_MUSIC_CHANGE_SORT) ); m_soundExpand.Load( THEME->GetPathTo(SOUND_SELECT_MUSIC_SECTION_EXPAND) ); - m_soundStart.Load( THEME->GetPathTo(SOUND_MENU_START) ); - m_soundLocked.Load( THEME->GetPathTo(SOUND_SELECT_MUSIC_WHEEL_LOCKED) ); + m_soundExpand.Load( THEME->GetPathTo(SOUND_MENU_START) ); - m_fTimeLeftBeforePlayMusicSample = 0; - // init m_mapGroupNameToBannerColor CArray arraySongs; @@ -356,11 +349,10 @@ MusicWheel::MusicWheel() m_iSelection = 0; - m_WheelState = STATE_SELECTING_MUSIC; - m_fTimeLeftInState = 0; + m_WheelState = STATE_IDLE; + m_fTimeLeftInState = FADE_TIME; m_fPositionOffsetFromSelection = 0; - m_iSwitchesLeftInSpinDown = 0; // build all of the wheel item datas for( int so=0; so 0 ) - { - m_fTimeLeftBeforePlayMusicSample -= fDeltaTime; - if( m_fTimeLeftBeforePlayMusicSample < 0 ) - SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 ); + float fOldMod = fmodf( TIMER->GetTimeSinceStart()-fDeltaTime, SWITCH_MUSIC_TIME ); + float fNewMod = fmodf( TIMER->GetTimeSinceStart(), SWITCH_MUSIC_TIME ); + if( fNewMod < fOldMod ) // wrapped + NextMusic(); } // update wheel state @@ -735,6 +721,10 @@ void MusicWheel::Update( float fDeltaTime ) { switch( m_WheelState ) { + case STATE_SWITCHING_MUSIC: + m_WheelState = STATE_IDLE; // now, wait for input + SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 ); + break; case STATE_FLYING_OFF_BEFORE_NEXT_SORT: { m_WheelState = STATE_FLYING_ON_AFTER_NEXT_SORT; @@ -789,112 +779,46 @@ void MusicWheel::Update( float fDeltaTime ) break; case STATE_FLYING_ON_AFTER_NEXT_SORT: SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 ); - m_WheelState = STATE_SELECTING_MUSIC; // now, wait for input + m_WheelState = STATE_IDLE; // now, wait for input break; case STATE_TWEENING_ON_SCREEN: SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 ); - m_WheelState = STATE_SELECTING_MUSIC; + m_WheelState = STATE_IDLE; m_fTimeLeftInState = 0; break; case STATE_TWEENING_OFF_SCREEN: m_WheelState = STATE_WAITING_OFF_SCREEN; m_fTimeLeftInState = 0; break; - case STATE_SELECTING_MUSIC: + case STATE_IDLE: m_fTimeLeftInState = 0; break; - case STATE_ROULETTE_SPINNING: - break; - case STATE_WAITING_OFF_SCREEN: - break; - case STATE_LOCKED: - break; case STATE_ROULETTE_SLOWING_DOWN: - if( m_iSwitchesLeftInSpinDown == 0 ) - { - m_WheelState = STATE_LOCKED; - m_fTimeLeftInState = 0; - m_soundStart.Play(); - m_fLockedWheelVelocity = 0; - } - else - { - m_iSwitchesLeftInSpinDown--; - switch( m_iSwitchesLeftInSpinDown ) - { - case 4: m_fTimeLeftInState = 0.2f; break; - case 3: m_fTimeLeftInState = 0.4f; break; - case 2: m_fTimeLeftInState = 0.8f; break; - case 1: m_fTimeLeftInState = 1.3f; break; - case 0: m_fTimeLeftInState = 0.5f; break; - default: ASSERT(0); - } - - LOG->WriteLine( "m_iSwitchesLeftInSpinDown id %d, m_fTimeLeftInState is %f", m_iSwitchesLeftInSpinDown, m_fTimeLeftInState ); - - if( m_iSwitchesLeftInSpinDown < 2 ) - randomf(0,1) >= 0.5f ? NextMusic() : PrevMusic(); - else - NextMusic(); - } - break; - default: - ASSERT(0); // all state changes should be handled explitily + m_WheelState = STATE_IDLE; + m_fTimeLeftInState = 0; break; } } + // "rotate" wheel toward selected song - if( m_WheelState == STATE_LOCKED ) - { - m_fPositionOffsetFromSelection = clamp( m_fPositionOffsetFromSelection, -0.3f, +0.3f ); - - float fSpringForce = - m_fPositionOffsetFromSelection*LOCKED_WHEEL_INITIAL_VELOCITY; - m_fLockedWheelVelocity += fSpringForce; - - float fDrag = -m_fLockedWheelVelocity * fDeltaTime*4; - m_fLockedWheelVelocity += fDrag; - - m_fPositionOffsetFromSelection += m_fLockedWheelVelocity*fDeltaTime; - - if( fabsf(m_fPositionOffsetFromSelection) < 0.01f && fabsf(m_fLockedWheelVelocity) < 0.01f ) - { - m_fPositionOffsetFromSelection = 0; - m_fLockedWheelVelocity = 0; - } - } + if( fabsf(m_fPositionOffsetFromSelection) < 0.02f ) + m_fPositionOffsetFromSelection = 0; else { - // "rotate" wheel toward selected song - float fSpinSpeed; - if( m_WheelState == STATE_ROULETTE_SPINNING ) - fSpinSpeed = 1.0f/ROULETTE_SWITCH_MUSIC_TIME; - else - fSpinSpeed = 0.6f + fabsf(m_fPositionOffsetFromSelection)/SWITCH_MUSIC_TIME; - - if( m_fPositionOffsetFromSelection > 0 ) - m_fPositionOffsetFromSelection = max( 0, m_fPositionOffsetFromSelection - fSpinSpeed*fDeltaTime ); - else if( m_fPositionOffsetFromSelection < 0 ) - m_fPositionOffsetFromSelection = min( 0, m_fPositionOffsetFromSelection + fSpinSpeed*fDeltaTime ); + m_fPositionOffsetFromSelection -= fDeltaTime * m_fPositionOffsetFromSelection*4; // linear + float fSign = m_fPositionOffsetFromSelection / fabsf(m_fPositionOffsetFromSelection); + m_fPositionOffsetFromSelection -= fDeltaTime * fSign; // constant } } void MusicWheel::PrevMusic() { - if( m_WheelState == STATE_LOCKED ) - { - m_fLockedWheelVelocity = LOCKED_WHEEL_INITIAL_VELOCITY; - m_soundLocked.Play(); - return; - } - - if( fabsf(m_fPositionOffsetFromSelection) > 0.5f ) // wheel is busy spinning - return; - switch( m_WheelState ) { - case STATE_SELECTING_MUSIC: + case STATE_IDLE: + case STATE_SWITCHING_MUSIC: case STATE_ROULETTE_SPINNING: case STATE_ROULETTE_SLOWING_DOWN: break; // fall through @@ -919,29 +843,21 @@ void MusicWheel::PrevMusic() m_fPositionOffsetFromSelection -= 1; + m_WheelState = STATE_SWITCHING_MUSIC; + m_fTimeLeftInState = SWITCH_MUSIC_TIME; m_soundChangeMusic.Play(); } void MusicWheel::NextMusic() { - if( m_WheelState == STATE_LOCKED ) - { - m_fLockedWheelVelocity = -LOCKED_WHEEL_INITIAL_VELOCITY; - m_soundLocked.Play(); - return; - } - - if( fabsf(m_fPositionOffsetFromSelection) > 0.5 ) // wheel is very busy spinning - return; - switch( m_WheelState ) { - case STATE_SELECTING_MUSIC: + case STATE_IDLE: + case STATE_SWITCHING_MUSIC: case STATE_ROULETTE_SPINNING: case STATE_ROULETTE_SLOWING_DOWN: break; // fall through default: - LOG->WriteLine( "NextMusic() ignored" ); return; // don't continue } @@ -962,6 +878,8 @@ void MusicWheel::NextMusic() m_fPositionOffsetFromSelection += 1; + m_WheelState = STATE_SWITCHING_MUSIC; + m_fTimeLeftInState = SWITCH_MUSIC_TIME; m_soundChangeMusic.Play(); } @@ -974,7 +892,8 @@ void MusicWheel::NextSort() { switch( m_WheelState ) { - case STATE_SELECTING_MUSIC: + case STATE_IDLE: + case STATE_SWITCHING_MUSIC: case STATE_FLYING_ON_AFTER_NEXT_SORT: break; // fall through default: @@ -995,13 +914,10 @@ void MusicWheel::NextSort() bool MusicWheel::Select() // return true of a playable item was chosen { - LOG->WriteLine( "MusicWheel::Select()" ); - if( m_WheelState == STATE_ROULETTE_SPINNING ) { m_WheelState = STATE_ROULETTE_SLOWING_DOWN; - m_iSwitchesLeftInSpinDown = ROULETTE_SWITCHES_IN_SLOWING_DOWN; - m_fTimeLeftInState = 0.1f; + m_fTimeLeftInState = 20; return false; } diff --git a/stepmania/src/MusicWheel.h b/stepmania/src/MusicWheel.h index 760e088fd4..41074af1ce 100644 --- a/stepmania/src/MusicWheel.h +++ b/stepmania/src/MusicWheel.h @@ -131,7 +131,6 @@ protected: MusicSortDisplay m_MusicSortDisplay; ActorFrame m_frameOverlay; - // Actors inside of m_frameOverlay Sprite m_sprSelectionOverlay; Sprite m_sprHighScoreFrame[NUM_PLAYERS]; @@ -146,12 +145,10 @@ protected: int m_iSelection; // index into GetCurWheelItemDatas() CString m_sExpandedSectionName; - int m_iSwitchesLeftInSpinDown; - float m_fLockedWheelVelocity; - float m_fTimeLeftBeforePlayMusicSample; // Triggers a message send when crosses 0 enum WheelState { - STATE_SELECTING_MUSIC, + STATE_IDLE, + STATE_SWITCHING_MUSIC, STATE_FLYING_OFF_BEFORE_NEXT_SORT, STATE_FLYING_ON_AFTER_NEXT_SORT, STATE_TWEENING_ON_SCREEN, @@ -171,7 +168,6 @@ protected: RageSoundSample m_soundChangeSort; RageSoundSample m_soundExpand; RageSoundSample m_soundStart; - RageSoundSample m_soundLocked; diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index f448081d7c..40141831f8 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -21,11 +21,6 @@ NoteData::NoteData() -{ - Init(); -} - -void NoteData::Init() { memset( m_TapNotes, '0', MAX_NOTE_TRACKS*MAX_TAP_NOTE_ROWS ); m_iNumTracks = 0; @@ -181,24 +176,6 @@ void NoteData::RemoveHoldNote( int index ) m_iNumHoldNotes--; } -bool NoteData::IsThereANoteAtRow( int iRow ) -{ - for( int t=0; t= fHoldStartBeat && fStartBeat < fEndBeat ) + iNumSteps++; + } - return iNumHolds; + return iNumSteps; } int NoteData::GetPossibleDancePoints() @@ -730,9 +708,8 @@ float NoteData::GetStreamRadarValue( float fSongSeconds ) { // density of steps int iNumNotes = GetNumTapNotes() + GetNumHoldNotes(); - float fNotesPerSecond = iNumNotes/fSongSeconds; - float fReturn = fNotesPerSecond / 5; - return min( fReturn, 1.2f ); + float fBeatsPerSecond = iNumNotes/fSongSeconds; + return fBeatsPerSecond / 5; } float NoteData::GetVoltageRadarValue( float fSongSeconds ) @@ -752,30 +729,26 @@ float NoteData::GetVoltageRadarValue( float fSongSeconds ) fMaxDensityPerSecSoFar = fDensityPerSecThisMeasure; } - float fReturn = fMaxDensityPerSecSoFar*10; - return min( fReturn, 1.2f ); + return fMaxDensityPerSecSoFar; } float NoteData::GetAirRadarValue( float fSongSeconds ) { // number of doubles int iNumDoubles = GetNumDoubles(); - float fReturn = iNumDoubles / fSongSeconds * 2; - return min( fReturn, 1.2f ); + return iNumDoubles / fSongSeconds * 2; } float NoteData::GetChaosRadarValue( float fSongSeconds ) { // irregularity of steps - float fReturn = fabsf( GetStreamRadarValue(fSongSeconds) - GetVoltageRadarValue(fSongSeconds) ) * 2.5f; - return min( fReturn, 1.2f ); + return fabsf( GetStreamRadarValue(fSongSeconds) - GetVoltageRadarValue(fSongSeconds) ); } float NoteData::GetFreezeRadarValue( float fSongSeconds ) { // number of hold steps - float fReturn = GetNumHoldNotes() / fSongSeconds * 3; - return min( fReturn, 1.2f ); + return GetNumHoldNotes() / fSongSeconds * 10; } diff --git a/stepmania/src/NoteData.h b/stepmania/src/NoteData.h index 9e050b8baf..498a428e78 100644 --- a/stepmania/src/NoteData.h +++ b/stepmania/src/NoteData.h @@ -21,7 +21,33 @@ // ... for future expansion +enum TapNoteScore { + TNS_NONE, + TNS_MISS, + TNS_BOO, + TNS_GOOD, + TNS_GREAT, + TNS_PERFECT, +}; +inline int TapNoteScoreToDancePoints( TapNoteScore tns ) +{ + switch( tns ) + { + case TNS_PERFECT: return +2; + case TNS_GREAT: return +1; + case TNS_GOOD: return +0; + case TNS_BOO: return -4; + case TNS_MISS: return +8; + default: return 0; + } +} + +//enum TapNoteTiming { +// TNT_NONE, +// TNT_EARLY, +// TNT_LATE +//}; struct HoldNote @@ -31,10 +57,28 @@ struct HoldNote int m_iEndIndex; }; +enum HoldNoteScore +{ + HNS_NONE, // this HoldNote has not been scored yet + HNS_OK, // the HoldNote has passed and was successfully held all the way through + HNS_NG // the HoldNote has passed and they missed it +}; + + +inline int HoldNoteScoreToDancePoints( HoldNoteScore hns ) +{ + switch( hns ) + { + case HNS_OK: return +6; + case HNS_NG: return +0; + default: ASSERT(0); return 0; + } +} + inline int BeatToNoteRow( float fBeatNum ) { return int( fBeatNum * ELEMENTS_PER_BEAT + 0.5f); }; // round -inline int BeatToNoteRowNotRounded( float fBeatNum ) { return (int)( fBeatNum * ELEMENTS_PER_BEAT ); }; -inline float NoteRowToBeat( float fNoteIndex ) { return fNoteIndex / (float)ELEMENTS_PER_BEAT; }; +inline int BeatToNoteIndexNotRounded( float fBeatNum ){ return (int)( fBeatNum * ELEMENTS_PER_BEAT ); }; +inline float NoteRowToBeat( float fNoteIndex ) { return fNoteIndex / (float)ELEMENTS_PER_BEAT; }; inline float NoteRowToBeat( int iNoteIndex ) { return NoteRowToBeat( (float)iNoteIndex ); }; @@ -44,7 +88,6 @@ class NoteData { public: NoteData(); - void Init(); ~NoteData(); // used for loading @@ -66,7 +109,7 @@ public: void ClearRange( int iNoteIndexBegin, int iNoteIndexEnd ); void ClearAll() { ClearRange( 0, MAX_TAP_NOTE_ROWS ); }; void CopyRange( NoteData* pFrom, int iNoteIndexBegin, int iNoteIndexEnd ); - void CopyAll( NoteData* pFrom ) { m_iNumTracks = pFrom->m_iNumTracks; m_iNumHoldNotes = 0; CopyRange( pFrom, 0, MAX_TAP_NOTE_ROWS ); }; + void CopyAll( NoteData* pFrom ) { m_iNumTracks = pFrom->m_iNumTracks; CopyRange( pFrom, 0, MAX_TAP_NOTE_ROWS ); }; inline bool IsRowEmpty( int index ) { @@ -81,7 +124,6 @@ public: void RemoveHoldNote( int index ); // statistics - bool IsThereANoteAtRow( int iRow ); float GetLastBeat(); // return the beat number of the last note int GetLastRow(); int GetNumTapNotes( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS ); @@ -98,16 +140,16 @@ public: case RADAR_STREAM: return GetStreamRadarValue( fSongSeconds ); break; case RADAR_VOLTAGE: return GetVoltageRadarValue( fSongSeconds ); break; case RADAR_AIR: return GetAirRadarValue( fSongSeconds ); break; - case RADAR_FREEZE: return GetFreezeRadarValue( fSongSeconds ); break; case RADAR_CHAOS: return GetChaosRadarValue( fSongSeconds ); break; + case RADAR_FREEZE: return GetFreezeRadarValue( fSongSeconds ); break; default: ASSERT(0); return 0; } }; float GetStreamRadarValue( float fSongSeconds ); float GetVoltageRadarValue( float fSongSeconds ); float GetAirRadarValue( float fSongSeconds ); - float GetFreezeRadarValue( float fSongSeconds ); float GetChaosRadarValue( float fSongSeconds ); + float GetFreezeRadarValue( float fSongSeconds ); // Transformations void LoadTransformed( NoteData* pOriginal, int iNewNumTracks, int iNewToOriginalTrack[] ); diff --git a/stepmania/src/NoteField.cpp b/stepmania/src/NoteField.cpp index 933d7e8138..5d20f78d22 100644 --- a/stepmania/src/NoteField.cpp +++ b/stepmania/src/NoteField.cpp @@ -237,7 +237,8 @@ void NoteField::DrawPrimitives() const int iCol = hn.m_iTrack; const float fHoldNoteLife = m_HoldNoteLife[i]; - const bool bActive = NoteRowToBeat(hn.m_iStartIndex-1) <= m_fSongBeat && m_fSongBeat <= NoteRowToBeat(hn.m_iEndIndex); // hack: added -1 because hn.m_iStartIndex changes as note is held + const bool bActive = NoteRowToBeat(hn.m_iStartIndex) > m_fSongBeat && m_fSongBeat < NoteRowToBeat(hn.m_iEndIndex); + // parts of the hold const float fStartDrawingAtBeat = froundf( (float)hn.m_iStartIndex, ROWS_BETWEEN_HOLD_BITS ); diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 81ab46b32a..0568532f9c 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -1,12 +1,11 @@ #include "stdafx.h" /* ----------------------------------------------------------------------------- - Class: Player + Class: Notes Desc: See header. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. - Chris Danford ----------------------------------------------------------------------------- */ @@ -30,27 +29,28 @@ const float COMBO_Y_OFFSET = +26; const float ARROWS_Y = SCREEN_TOP + ARROW_SIZE * 1.5f; const float HOLD_JUDGEMENT_Y = ARROWS_Y + 80; -const float HOLD_ARROW_NG_TIME = 0.18f; +const float HOLD_ARROW_NG_TIME = 0.27f; Player::Player() { m_fSongBeat = 0; - m_PlayerNumber = PLAYER_INVALID; + m_PlayerNumber = PLAYER_NONE; // init step elements - for( int t=0; tWriteLine( "Player::Load()", ); - - NoteData::Init(); - NoteDataWithScoring::Init(); - // init step elements - for( int i=0; iCopyAll( pNoteData ); m_PlayerNumber = player_no; @@ -90,7 +83,7 @@ void Player::Load( PlayerNumber player_no, StyleDef* pStyleDef, NoteData* pNoteD m_pLifeMeter = pLM; m_pScore = pScore; if( m_pScore ) - m_pScore->Init( player_no, m_PlayerOptions, pNoteData->GetNumTapNotes(), iMeter ); + m_pScore->Init( player_no, m_PlayerOptions, pNoteData->GetNumTapNotes(), SONGMAN->GetCurrentNotes(player_no)->m_iMeter ); if( !po.m_bHoldNotes ) this->RemoveHoldNotes(); @@ -102,6 +95,12 @@ void Player::Load( PlayerNumber player_no, StyleDef* pStyleDef, NoteData* pNoteD m_NoteField.Load( (NoteData*)this, player_no, pStyleDef, po, 1.5f, 5.5f, NoteField::MODE_DANCING ); + for( int t=0; tm_iNumTracks; t++ ) + { + for( int r=0; rm_TapNotes[t][r]; + } + m_GrayArrowRow.Load( player_no, pStyleDef, po ); m_GhostArrowRow.Load( player_no, pStyleDef, po ); @@ -109,10 +108,8 @@ void Player::Load( PlayerNumber player_no, StyleDef* pStyleDef, NoteData* pNoteD m_Combo.SetY( po.m_bReverseScroll ? -COMBO_Y_OFFSET : COMBO_Y_OFFSET ); m_Judgement.SetY( po.m_bReverseScroll ? -JUDGEMENT_Y_OFFSET : JUDGEMENT_Y_OFFSET ); - for( int c=0; cm_iColsPerPlayer; c++ ) + for( int c=0; cm_iColsPerPlayer; c++ ) - m_HoldJudgement[c].SetX( (float)pStyleDef->m_ColumnInfo[player_no][c].fXOffset ); m_NoteField.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - ARROWS_Y : ARROWS_Y ); m_GrayArrowRow.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - ARROWS_Y : ARROWS_Y ); @@ -123,8 +120,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference { //LOG->WriteLine( "Player::Update(%f, %f, %f)", fDeltaTime, fSongBeat, fMaxBeatDifference ); - m_fSongBeat = fSongBeat; // save song beat - + // // Check for TapNote misses // @@ -146,6 +142,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference float fStartBeat = NoteRowToBeat( (float)hn.m_iStartIndex ); float fEndBeat = NoteRowToBeat( (float)hn.m_iEndIndex ); + const int iCol = hn.m_iTrack; const StyleInput StyleI( m_PlayerNumber, hn.m_iTrack ); const GameInput GameI = GAMEMAN->GetCurrentStyleDef()->StyleInputToGameInput( StyleI ); @@ -153,9 +150,9 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference // update the life if( fStartBeat < m_fSongBeat && m_fSongBeat < fEndBeat ) // if the song beat is in the range of this hold { - const bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI ) || PREFSMAN->m_bAutoPlay; + const bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI ); // if they got a bad score or haven't stepped on the corresponding tap yet - const bool bSteppedOnTapNote = m_TapNoteScores[hn.m_iTrack][hn.m_iStartIndex] >= TNS_GREAT; + const bool bSteppedOnTapNote = m_TapNoteScores[hn.m_iStartIndex] >= TNS_GREAT; if( bIsHoldingButton && bSteppedOnTapNote ) @@ -164,11 +161,9 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference fLife += fDeltaTime/HOLD_ARROW_NG_TIME; fLife = min( fLife, 1 ); // clamp - int iNewStartRow = BeatToNoteRow( m_fSongBeat ); - ASSERT( iNewStartRow >= m_NoteField.m_HoldNotes[i].m_iStartIndex ); - m_NoteField.m_HoldNotes[i].m_iStartIndex = iNewStartRow; // move the start of this Hold + m_NoteField.m_HoldNotes[i].m_iStartIndex = BeatToNoteRow( m_fSongBeat ); // move the start of this Hold - m_GhostArrowRow.HoldNote( hn.m_iTrack ); // update the "electric ghost" effect + m_GhostArrowRow.HoldNote( iCol ); // update the "electric ghost" effect } else // !bIsHoldingButton { @@ -186,7 +181,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference if( fLife == 0 ) // the player has not pressed the button for a long time! { hns = HNS_NG; - m_HoldJudgement[hn.m_iTrack].SetHoldJudgement( HNS_NG ); + m_HoldJudgement[iCol].SetHoldJudgement( HNS_NG ); } // check for OK @@ -195,7 +190,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference // At this point fLife > 0, or else we would have marked it NG above fLife = 1; hns = HNS_OK; - m_HoldJudgement[hn.m_iTrack].SetHoldJudgement( HNS_OK ); + m_HoldJudgement[iCol].SetHoldJudgement( HNS_OK ); m_NoteField.SetHoldNoteLife( i, fLife ); // update the NoteField display } } @@ -211,6 +206,9 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference m_GrayArrowRow.Update( fDeltaTime, fSongBeat ); m_NoteField.Update( fDeltaTime, fSongBeat ); m_GhostArrowRow.Update( fDeltaTime, fSongBeat ); + + m_fSongBeat = fSongBeat; // save song beat + } void Player::DrawPrimitives() @@ -262,6 +260,26 @@ void Player::DrawPrimitives() m_HoldJudgement[c].Draw(); } +bool Player::IsThereANoteAtIndex( int iIndex ) +{ + for( int t=0; tWriteLine( "Player::HandlePlayerStep()" ); @@ -270,6 +288,13 @@ void Player::HandlePlayerStep( float fSongBeat, int col, float fMaxBeatDiff ) m_GrayArrowRow.Step( col ); + CheckForCompleteRow( fSongBeat, col, fMaxBeatDiff ); +} + + +void Player::CheckForCompleteRow( float fSongBeat, int col, float fMaxBeatDiff ) +{ + //LOG->WriteLine( "Player::CheckForCompleteRow()" ); // look for the closest matching step int iIndexStartLookingAt = BeatToNoteRow( fSongBeat ); @@ -279,7 +304,7 @@ void Player::HandlePlayerStep( float fSongBeat, int col, float fMaxBeatDiff ) int iIndexOverlappingNote = -1; // leave as -1 if we don't find any - // Start at iIndexStartLookingAt and search outward. The first one note overlaps the player's hit (this is the closest match). + // Start at iIndexStartLookingAt and search outward. The first one that overlaps the player's step is the closest match. for( int delta=0; delta <= iNumElementsToExamine; delta++ ) { int iCurrentIndexEarlier = iIndexStartLookingAt - delta; @@ -293,8 +318,7 @@ void Player::HandlePlayerStep( float fSongBeat, int col, float fMaxBeatDiff ) // check the step to the left of iIndexStartLookingAt //////////////////////////// //LOG->WriteLine( "Checking Notes[%d]", iCurrentIndexEarlier ); - if( m_TapNotes[col][iCurrentIndexEarlier] != '0' && // there is a note here - m_TapNoteScores[col][iCurrentIndexEarlier] == TNS_NONE ) // this note doesn't have a score + if( m_TapNotes[col][iCurrentIndexEarlier] != '0' ) // these Notes overlap { iIndexOverlappingNote = iCurrentIndexEarlier; break; @@ -305,8 +329,7 @@ void Player::HandlePlayerStep( float fSongBeat, int col, float fMaxBeatDiff ) // check the step to the right of iIndexStartLookingAt //////////////////////////// //LOG->WriteLine( "Checking Notes[%d]", iCurrentIndexLater ); - if( m_TapNotes[col][iCurrentIndexLater] != '0' && // there is a note here - m_TapNoteScores[col][iCurrentIndexLater] == TNS_NONE ) // this note doesn't have a score + if( m_TapNotes[col][iCurrentIndexLater] != '0' ) // these Notes overlap { iIndexOverlappingNote = iCurrentIndexLater; break; @@ -315,28 +338,13 @@ void Player::HandlePlayerStep( float fSongBeat, int col, float fMaxBeatDiff ) if( iIndexOverlappingNote != -1 ) { - // compute the score for this hit - const float fStepBeat = NoteRowToBeat( (float)iIndexOverlappingNote ); - const float fBeatsUntilStep = fStepBeat - fSongBeat; - const float fPercentFromPerfect = fabsf( fBeatsUntilStep / fMaxBeatDiff ); - - TapNoteScore &score = m_TapNoteScores[col][iIndexOverlappingNote]; - - if( fPercentFromPerfect < 0.35f ) score = TNS_PERFECT; - else if( fPercentFromPerfect < 0.6f ) score = TNS_GREAT; - else if( fPercentFromPerfect < 0.8f ) score = TNS_GOOD; - else score = TNS_BOO; - - + m_TapNotes[col][iIndexOverlappingNote] = '0'; // mark hit + bool bRowDestroyed = true; for( int t=0; tWriteLine( "fBeatsUntilStep: %f, fPercentFromPerfect: %f", // fBeatsUntilStep, fPercentFromPerfect ); - - // find the minimum score of the row - TapNoteScore score = TNS_PERFECT; - for( int t=0; t= TNS_BOO ) - score = min( score, m_TapNoteScores[t][iIndexThatWasSteppedOn] ); + + // compute what the score should be for the note we stepped on + TapNoteScore &score = m_TapNoteScores[iIndexThatWasSteppedOn]; + + if( fPercentFromPerfect < 0.25f ) score = TNS_PERFECT; + else if( fPercentFromPerfect < 0.50f ) score = TNS_GREAT; + else if( fPercentFromPerfect < 0.75f ) score = TNS_GOOD; + else score = TNS_BOO; // update the judgement, score, and life m_Judgement.SetJudgement( score ); @@ -367,14 +383,14 @@ void Player::OnRowDestroyed( float fSongBeat, int col, float fMaxBeatDiff, int i // show ghost arrows for( int c=0; c100 ); // show the ghost arrow for this column } int iNumNotesDestroyed = 0; for( c=0; cGetCurrentSong(); + Notes* pNotes = SONGMAN->GetCurrentNotes(m_PlayerNumber); + GSout.dc = pNotes->m_DifficultyClass; + GSout.meter = pNotes->m_iMeter; + GSout.iPossibleDancePoints = ((NoteData*)this)->GetPossibleDancePoints(); + GSout.iActualDancePoints = 0; + + for( int i=0; iGetScore() : 0; + + GSout.failed = this->m_pLifeMeter->HasFailed(); + + + for( int r=0; rGetRadarValue( (RadarCatrgory)r, SONGMAN->GetCurrentSong()->GetMusicLengthSeconds() ); + GSout.fRadarActual[r] = randomf(0, GSout.fRadarPossible[r]); + } +} + + int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ) { //LOG->WriteLine( "Notes::UpdateTapNotesMissedOlderThan(%f)", fMissIfOlderThanThisBeat ); @@ -418,19 +482,17 @@ int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ) int iStartCheckingAt = max( 0, iMissIfOlderThanThisIndex-10 ); //LOG->WriteLine( "iStartCheckingAt: %d iMissIfOlderThanThisIndex: %d", iStartCheckingAt, iMissIfOlderThanThisIndex ); - for( int t=0; tIsRowEmpty( i ) ) { - bool bFoundAMissInThisRow = false; - if( m_TapNotes[t][r] != '0' && m_TapNoteScores[t][r] == TNS_NONE ) - { - m_TapNoteScores[t][r] = TNS_MISS; - iNumMissesFound++; - bFoundAMissInThisRow = true; - } - if( bFoundAMissInThisRow ) - m_pLifeMeter->ChangeLife( TNS_MISS ); + m_TapNoteScores[i] = TNS_MISS; + iNumMissesFound++; + m_pLifeMeter->ChangeLife( TNS_MISS ); } } @@ -444,76 +506,8 @@ int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ) } -void Player::CrossedRow( int iNoteRow, float fSongBeat, float fMaxBeatDiff ) -{ - if( PREFSMAN->m_bAutoPlay ) - { - // check to see if there's at the crossed row - for( int t=0; tHandlePlayerStep( fSongBeat, t, fMaxBeatDiff ); - } - } -} -GameplayStatistics Player::GetGameplayStatistics( Song* pSong, Notes* pNotes ) -{ - GameplayStatistics GSreturn; - - GSreturn.pSong = pSong; - GSreturn.dc = pNotes->m_DifficultyClass; - GSreturn.meter = pNotes->m_iMeter; - GSreturn.iPossibleDancePoints = ((NoteData*)this)->GetPossibleDancePoints(); - GSreturn.iActualDancePoints = 0; - - for( int t=0; tGetScore() : 0; - - GSreturn.failed = this->m_pLifeMeter->HasFailed(); - for( int r=0; rGetRadarValue( (RadarCatrgory)r, pSong->GetMusicLengthSeconds() ); - GSreturn.fRadarActual[r] = this->GetActualRadarValue( (RadarCatrgory)r, pSong->GetMusicLengthSeconds() ); - - GSreturn.fRadarPossible[r] = clamp( GSreturn.fRadarPossible[r], 0, 1 ); - GSreturn.fRadarActual[r] = clamp( GSreturn.fRadarActual[r], 0, 1 ); - } - - return GSreturn; -} diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index 3c10748fdf..1ffb7f1260 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -31,13 +31,11 @@ #include "NoteField.h" #include "GrayArrowRow.h" #include "GhostArrowRow.h" -#include "NoteDataWithScoring.h" struct GameplayStatistics; - -class Player : public NoteDataWithScoring, public ActorFrame +class Player : public NoteData, public ActorFrame { public: Player(); @@ -45,27 +43,33 @@ public: void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference ); void DrawPrimitives(); - void Load( PlayerNumber player_no, StyleDef *pStyleDef, NoteData* pNoteData, int iMeter, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore ); - void CrossedRow( int iNoteRow, float fSongBeat, float fMaxBeatDiff ); + void Load( PlayerNumber player_no, StyleDef *pStyleDef, NoteData* pNoteData, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore ); + void CrossedIndex( int iIndex ); void HandlePlayerStep( float fSongBeat, int col, float fMaxBeatDiff ); int UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ); - GameplayStatistics GetGameplayStatistics( Song* pSong, Notes* pNotes ); + void GetGameplayStatistics( GameplayStatistics& GSout ); + bool IsThereANoteAtIndex( int iIndex ); protected: + void CheckForCompleteRow( float fSongBeat, int col, float fMaxBeatDiff ); void OnRowDestroyed( float fSongBeat, int col, float fMaxBeatDiff, int iStepIndex ); float m_fSongBeat; PlayerNumber m_PlayerNumber; PlayerOptions m_PlayerOptions; + // maintain this extra data in addition to the NoteData + TapNote m_TapNotesOriginal[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ROWS]; // the original Notes that were loaded into player + TapNoteScore m_TapNoteScores[MAX_TAP_NOTE_ROWS]; float m_fHoldNoteLife[MAX_TAP_NOTE_ROWS]; // 1.0 means this HoldNote has full life. // 0.0 means this HoldNote is dead // When this value hits 0.0 for the first time, // m_HoldScore becomes HSS_NG. // If the life is > 0.0 when the HoldNote ends, then // m_HoldScore becomes HSS_OK. + HoldNoteScore m_HoldNoteScores[MAX_HOLD_NOTE_ELEMENTS]; GrayArrowRow m_GrayArrowRow; diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 0fd1588c2d..3c43162a6c 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -29,13 +29,12 @@ PrefsManager::PrefsManager() m_bAnnouncer = true; m_bEventMode = true; m_iNumArcadeStages = 3; - m_bAutoPlay = false; - m_fJudgeWindow = 0.10f; + m_iDifficulty = 4; for( int p=0; pGetStageNumber(), sNumberSuffix ); } diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 599c5c9973..45773548e4 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -33,8 +33,7 @@ public: bool m_bAnnouncer; bool m_bEventMode; int m_iNumArcadeStages; - bool m_bAutoPlay; - float m_fJudgeWindow; + int m_iDifficulty; void ReadPrefsFromDisk(); void SavePrefsToDisk(); @@ -47,11 +46,9 @@ public: int m_iCurrentStageIndex; // starts at 0, and is incremented with each Stage Clear int GetStageIndex(); + int GetStageNumber(); bool IsFinalStage(); - bool IsExtraStage(); - bool IsExtraStage2(); CString GetStageText(); - D3DXCOLOR GetStageColor(); PlayerOptions m_PlayerOptions[NUM_PLAYERS]; diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index b3c78e8a95..b1f2ffac0e 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -25,14 +25,13 @@ RageSound* SOUND = NULL; RageSound::RageSound( HWND hWnd ) { LOG->WriteLine( "RageSound::RageSound()" ); - // save the HWND if( !hWnd ) throw RageException( "RageSound called with NULL hWnd." ); m_hWndApp = hWnd; - if( BASS_GetVersion() != MAKELONG(1,6) ) - throw RageException( "BASS version 1.6 DLL could not be loaded. Verify that Bass.dll exists in the program directory."); + if( BASS_GetVersion() != MAKELONG(1,5) ) + throw RageException( "BASS version 1.5 DLL could not be loaded. Verify that Bass.dll exists in the program directory."); if( !BASS_Init( -1, 44100, BASS_DEVICE_LEAVEVOL|BASS_DEVICE_LATENCY, m_hWndApp ) ) { @@ -73,8 +72,6 @@ RageSound::RageSound( HWND hWnd ) RageSound::~RageSound() { - LOG->WriteLine( "RageSound::~RageSound()" ); - BASS_Stop(); BASS_Free(); } @@ -88,7 +85,7 @@ void RageSound::PlayOnceStreamed( CString sPath ) if( FALSE == BASS_StreamPlay( hStream, FALSE, 0 ) ) throw RageException( "RageSound: Error playing a sound stream." ); - // this stream will free itself when stopped + // this stream will free itself when stopped } void RageSound::PlayOnceStreamedFromDir( CString sDir ) diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index d3ec054aa3..6e69a53eeb 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -97,7 +97,7 @@ ScreenEdit::ScreenEdit() m_NoteFieldRecord.SetZoom( 1.0f ); m_NoteFieldRecord.Load( ¬eData, PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions, 2, 5, NoteField::MODE_EDITING ); - m_Player.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), ¬eData, 1, PlayerOptions(), NULL, NULL ); + m_Player.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), ¬eData, PlayerOptions(), NULL, NULL ); m_Player.SetXY( EDIT_CENTER_X, EDIT_GRAY_Y ); m_Fade.SetClosed(); @@ -234,7 +234,7 @@ void ScreenEdit::Update( float fDeltaTime ) m_NoteFieldEdit.Update( fDeltaTime, m_fTrailingBeat ); - int iIndexNow = BeatToNoteRowNotRounded( m_fBeat ); + int iIndexNow = BeatToNoteIndexNotRounded( m_fBeat ); CString sNoteType; @@ -499,7 +499,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ m_Mode = MODE_PLAY; - m_Player.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), (NoteData*)&m_NoteFieldEdit, 1, PlayerOptions(), NULL, NULL ); + m_Player.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), (NoteData*)&m_NoteFieldEdit, PlayerOptions(), NULL, NULL ); m_rectRecordBack.BeginTweening( 0.5f ); m_rectRecordBack.SetTweenDiffuseColor( D3DXCOLOR(0,0,0,0.5f) ); diff --git a/stepmania/src/ScreenEz2SelectPlayer.cpp b/stepmania/src/ScreenEz2SelectPlayer.cpp index 9f874f14f1..1ce13edce6 100644 --- a/stepmania/src/ScreenEz2SelectPlayer.cpp +++ b/stepmania/src/ScreenEz2SelectPlayer.cpp @@ -21,6 +21,7 @@ Andrew Livy #include "GameManager.h" #include "RageLog.h" #include "AnnouncerManager.h" +#include "ScreenEz2SelectStyle.h" /* Constants */ @@ -64,37 +65,6 @@ ScreenEz2SelectPlayer::ScreenEz2SelectPlayer() { LOG->WriteLine( "ScreenEz2SelectPlayer::ScreenEz2SelectPlayer()" ); - /* - for( int s=0; sm_CurGame ) // games match - m_aPossibleStyles.Add( style ); - } -*/ -// m_iSelection = 0; -/* - for( int i=0; iGetPathTo(GRAPHIC_SELECT_STYLE_ICONS) ); - m_sprIcon[i].StopAnimating(); - m_sprIcon[i].SetState( style ); - m_sprIcon[i].SetXY( ICONS_START_X + ICONS_SPACING_X*i, ICON_Y ); - this->AddActor( &m_sprIcon[i] ); - } - - m_sprExplanation.Load( THEME->GetPathTo(GRAPHIC_SELECT_STYLE_EXPLANATION) ); - m_sprExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y ); - this->AddActor( &m_sprExplanation ); - - m_sprPreview.SetXY( PREVIEW_X, PREVIEW_Y ); - this->AddActor( &m_sprPreview ); - - m_sprInfo.SetXY( INFO_X, INFO_Y ); - this->AddActor( &m_sprInfo ); -*/ - m_iSelectedStyle=0; // Load in the sprites we will be working with. @@ -266,7 +236,7 @@ void ScreenEz2SelectPlayer::HandleScreenMessage( const ScreenMessage SM ) SCREENMAN->SetNewScreen( new ScreenTitleMenu ); break; case SM_GoToNextState: - SCREENMAN->SetNewScreen( new ScreenTitleMenu ); + SCREENMAN->SetNewScreen( new ScreenEz2SelectStyle ); break; } } @@ -362,6 +332,8 @@ presses the button bound to start void ScreenEz2SelectPlayer::MenuStart( PlayerNumber p ) { // GAME->m_sCurrentStyle = DANCE_STYLES[m_iSelectedStyle]; + + MUSIC->Stop(); m_soundSelect.PlayRandom(); diff --git a/stepmania/src/ScreenEz2SelectStyle.cpp b/stepmania/src/ScreenEz2SelectStyle.cpp new file mode 100644 index 0000000000..29299c60fc --- /dev/null +++ b/stepmania/src/ScreenEz2SelectStyle.cpp @@ -0,0 +1,381 @@ +/**************************************** +ScreenEzSelectPlayer,cpp +Desc: See Header +Copyright (C): +Andrew Livy +*****************************************/ + +/* Includes */ + +#include "stdafx.h" +#include "ScreenEz2SelectStyle.h" +#include "ScreenManager.h" +#include "PrefsManager.h" +#include "RageMusic.h" +#include "ScreenTitleMenu.h" +#include "ScreenCaution.h" +#include "GameConstantsAndTypes.h" +#include "ThemeManager.h" +#include "ScreenSelectDifficulty.h" +#include "ScreenSandbox.h" +#include "GameManager.h" +#include "RageLog.h" +#include "AnnouncerManager.h" + +/* Constants */ + +const ScreenMessage SM_GoToPrevState = ScreenMessage(SM_User + 1); +const ScreenMessage SM_GoToNextState = ScreenMessage(SM_User + 2); + +const CString DANCE_STYLES[] = { + "easy", + "hard", + "real", + "double", +}; + +const float TWEEN_TIME = 0.35f; +const D3DXCOLOR OPT_NOT_SELECTED = D3DXCOLOR(0.3f,0.3f,0.3f,1); +const D3DXCOLOR OPT_SELECTED = D3DXCOLOR(1.0f,1.0f,1.0f,1); + + +const float OPT_X[NUM_EZ2STYLE_GRAPHICS] = { + CENTER_X-350, + CENTER_X, + CENTER_X+350, + CENTER_X+700, +}; // tells us the default X position +const float OPT_Y[NUM_EZ2STYLE_GRAPHICS] = { + CENTER_Y, + CENTER_Y, + CENTER_Y, + CENTER_Y, +}; // tells us the default Y position + +const float CLUB_X[NUM_EZ2STYLE_GRAPHICS] = { + OPT_X[0]+0, + OPT_X[0]-350, + OPT_X[2]+0, + OPT_X[1]+0, +}; + +const float EASY_X[NUM_EZ2STYLE_GRAPHICS] = { + OPT_X[1]+0, + OPT_X[0]+0, + OPT_X[0]-350, + OPT_X[2]+0, +}; + +const float HARD_X[NUM_EZ2STYLE_GRAPHICS] = { + OPT_X[2]+0, + OPT_X[1]+0, + OPT_X[0]+0, + OPT_X[0]-350, +}; + +const float REAL_X[NUM_EZ2STYLE_GRAPHICS] = { + OPT_X[3]+0, + OPT_X[2]+0, + OPT_X[1]+0, + OPT_X[0]+0, +}; + + +/************************************ +ScreenEz2SelectStyle (Constructor) +Desc: Sets up the screen display +************************************/ + +ScreenEz2SelectStyle::ScreenEz2SelectStyle() +{ + LOG->WriteLine( "ScreenEz2SelectStyle::ScreenEz2SelectStyle()" ); + + m_iSelectedStyle=0; + +// Load in the sprites we will be working with. + for( int i=0; iGetPathTo(GRAPHIC_SELECT_STYLE_INFO_GAME_0_STYLE_3); //HACK! Would LIKE to have own filename :) + break; + case 1: + sPadGraphicPath = THEME->GetPathTo(GRAPHIC_SELECT_STYLE_INFO_GAME_0_STYLE_0); + break; + case 2: + sPadGraphicPath = THEME->GetPathTo(GRAPHIC_SELECT_STYLE_INFO_GAME_0_STYLE_1); + break; + case 3: + sPadGraphicPath = THEME->GetPathTo(GRAPHIC_SELECT_STYLE_INFO_GAME_0_STYLE_2); + break; + } + m_sprOpt[i].Load( sPadGraphicPath ); + m_sprOpt[i].SetXY( OPT_X[i], OPT_Y[i] ); + m_sprOpt[i].SetZoom( 1 ); + this->AddActor( &m_sprOpt[i] ); + } + + + m_Menu.Load( + THEME->GetPathTo(GRAPHIC_SELECT_STYLE_BACKGROUND), + THEME->GetPathTo(GRAPHIC_SELECT_STYLE_TOP_EDGE), + ssprintf("Use %c %c to select, then press START", char(1), char(2) ) + ); + this->AddActor( &m_Menu ); + + m_soundChange.Load( THEME->GetPathTo(SOUND_SELECT_STYLE_CHANGE) ); + m_soundSelect.Load( THEME->GetPathTo(SOUND_MENU_START) ); + + +// SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_STYLE_INTRO) ); + + + if( !MUSIC->IsPlaying() ) + { + MUSIC->Load( THEME->GetPathTo(SOUND_MUSIC_SCROLL_MUSIC) ); + MUSIC->Play( true ); + } + +// AfterChange(); +// TweenOnScreen(); + m_Menu.TweenOnScreenFromBlack( SM_None ); +} + +/************************************ +~ScreenEz2SelectStyle (Destructor) +Desc: Writes line to log when screen +is terminated. +************************************/ +ScreenEz2SelectStyle::~ScreenEz2SelectStyle() +{ + LOG->WriteLine( "ScreenEz2SelectStyle::~ScreenEz2SelectStyle()" ); +} + + +/************************************ +DrawPrimitives +Desc: Draws the screen =P +************************************/ + +void ScreenEz2SelectStyle::DrawPrimitives() +{ + m_Menu.DrawBottomLayer(); + Screen::DrawPrimitives(); + m_Menu.DrawTopLayer(); +} + +/************************************ +Input +Desc: Handles player input. +************************************/ +void ScreenEz2SelectStyle::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) +{ + LOG->WriteLine( "ScreenEz2SelectStyle::Input()" ); + + if( m_Menu.IsClosing() ) + return; + + Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler +} + +/************************************ +HandleScreenMessage +Desc: Handles Screen Messages and changes + game states. +************************************/ +void ScreenEz2SelectStyle::HandleScreenMessage( const ScreenMessage SM ) +{ + Screen::HandleScreenMessage( SM ); + + switch( SM ) + { + case SM_MenuTimer: + MenuStart(PLAYER_NONE); + break; + case SM_GoToPrevState: + MUSIC->Stop(); + SCREENMAN->SetNewScreen( new ScreenTitleMenu ); + break; + case SM_GoToNextState: + SCREENMAN->SetNewScreen( new ScreenTitleMenu ); + break; + } +} + + +/************************************ +MenuBack +Desc: Actions performed when a player +presses the button bound to back +************************************/ + +void ScreenEz2SelectStyle::MenuBack( const PlayerNumber p ) +{ + MUSIC->Stop(); + + m_Menu.TweenOffScreenToBlack( SM_GoToPrevState, true ); + +// m_Fade.CloseWipingLeft( SM_GoToPrevState ); + +// TweenOffScreen(); +} + +/************************************ +SetFadedStyles +Desc: Fades out non-highlighted items +depending on the users choice. +************************************/ +void ScreenEz2SelectStyle::SetFadedStyles() +{ + m_sprOpt[0].SetTweenDiffuseColor( OPT_NOT_SELECTED ); + m_sprOpt[1].SetTweenDiffuseColor( OPT_NOT_SELECTED ); + m_sprOpt[2].SetTweenDiffuseColor( OPT_NOT_SELECTED ); + m_sprOpt[3].SetTweenDiffuseColor( OPT_NOT_SELECTED ); + if (m_iSelectedStyle != 3) + { + m_sprOpt[m_iSelectedStyle + 1].SetTweenDiffuseColor( OPT_SELECTED ); + } + else + { + m_sprOpt[0].SetTweenDiffuseColor( OPT_SELECTED ); + } +} + +/************************************ +MenuRight +Desc: Actions performed when a player +presses the button bound to right +************************************/ +void ScreenEz2SelectStyle::MenuRight( PlayerNumber p ) +{ + + if( m_iSelectedStyle == 3 ) // wrap to the first dance style + m_iSelectedStyle = 0; // which is (club) easy (hard) + else + m_iSelectedStyle = m_iSelectedStyle + 1; // otherwise shuffle up a style... + + if(m_iSelectedStyle == 2) // If it's HARD and CLUB needs to appear from the other side... + { + m_sprOpt[0].SetXY( REAL_X[m_iSelectedStyle]+700, OPT_Y[0] ); // First move it over the other side off-screen... + } + else if(m_iSelectedStyle == 3) // If it's REAL and EASY needs to appear from the other side... + { + m_sprOpt[1].SetXY( CLUB_X[m_iSelectedStyle]+700, OPT_Y[0] ); // First move it over the other side off-screen... + } + else if(m_iSelectedStyle == 0) // If it's CLUB and HARD needs to appear from the other side... + { + m_sprOpt[2].SetXY( EASY_X[m_iSelectedStyle]+700, OPT_Y[0] ); // First move it over the other side off-screen... + m_sprOpt[3].SetXY( EASY_X[m_iSelectedStyle]+1050, OPT_Y[0] ); // REAL must also move, due to the fact that it is the end item at the start, it moves differently to the rest. + } + + m_sprOpt[0].BeginTweening( 0.2f, TWEEN_BIAS_BEGIN ); + m_sprOpt[0].SetTweenX( CLUB_X[m_iSelectedStyle] ); + m_sprOpt[0].SetTweenY( OPT_Y[m_iSelectedStyle] ); + + + m_sprOpt[1].BeginTweening( 0.2f, TWEEN_BIAS_BEGIN ); + m_sprOpt[1].SetTweenX( EASY_X[m_iSelectedStyle] ); + m_sprOpt[1].SetTweenY( OPT_Y[m_iSelectedStyle] ); + + m_sprOpt[2].BeginTweening( 0.2f, TWEEN_BIAS_BEGIN ); + m_sprOpt[2].SetTweenX( HARD_X[m_iSelectedStyle] ); + m_sprOpt[2].SetTweenY( OPT_Y[m_iSelectedStyle] ); + + m_sprOpt[3].BeginTweening( 0.2f, TWEEN_BIAS_BEGIN ); + m_sprOpt[3].SetTweenX( REAL_X[m_iSelectedStyle] ); + m_sprOpt[3].SetTweenY( OPT_Y[m_iSelectedStyle] ); + + SetFadedStyles(); + +} + +/************************************ +MenuLeft +Desc: Actions performed when a player +presses the button bound to left +************************************/ +void ScreenEz2SelectStyle::MenuLeft( PlayerNumber p ) +{ + +if( m_iSelectedStyle == 0 ) // wrap to the last dance style + m_iSelectedStyle = 3; + else + m_iSelectedStyle = m_iSelectedStyle - 1; + + if( m_iSelectedStyle == 3 ) + { + m_sprOpt[3].SetXY( CLUB_X[m_iSelectedStyle]-700, OPT_Y[0] ); // First move it over the other side off-screen... + m_sprOpt[2].SetXY( CLUB_X[m_iSelectedStyle]-1050, OPT_Y[0] ); + } + else if( m_iSelectedStyle == 2 ) + { + m_sprOpt[1].SetXY( HARD_X[m_iSelectedStyle]-700, OPT_Y[0] ); // First move it over the other side off-screen... + } + else if( m_iSelectedStyle == 1 ) + { + m_sprOpt[0].SetXY( EASY_X[m_iSelectedStyle]-1050, OPT_Y[0] ); // First move it over the other side off-screen... + } + + m_sprOpt[0].BeginTweening( 0.2f, TWEEN_BIAS_BEGIN ); + m_sprOpt[0].SetTweenX( CLUB_X[m_iSelectedStyle] ); + m_sprOpt[0].SetTweenY( OPT_Y[m_iSelectedStyle] ); + + m_sprOpt[1].BeginTweening( 0.2f, TWEEN_BIAS_BEGIN ); + m_sprOpt[1].SetTweenX( EASY_X[m_iSelectedStyle] ); + m_sprOpt[1].SetTweenY( OPT_Y[m_iSelectedStyle] ); + + m_sprOpt[2].BeginTweening( 0.2f, TWEEN_BIAS_BEGIN ); + m_sprOpt[2].SetTweenX( HARD_X[m_iSelectedStyle] ); + m_sprOpt[2].SetTweenY( OPT_Y[m_iSelectedStyle] ); + + m_sprOpt[3].BeginTweening( 0.2f, TWEEN_BIAS_BEGIN ); + m_sprOpt[3].SetTweenX( REAL_X[m_iSelectedStyle] ); + m_sprOpt[3].SetTweenY( OPT_Y[m_iSelectedStyle] ); + + SetFadedStyles(); + +} + +/************************************ +MenuStart +Desc: Actions performed when a player +presses the button bound to start +************************************/ +void ScreenEz2SelectStyle::MenuStart( PlayerNumber p ) +{ +// GAMEMAN->m_CurStyle = DANCE_STYLES[m_iSelectedStyle]; + + m_soundSelect.PlayRandom(); + + this->ClearMessageQueue(); + + m_Menu.TweenOffScreenToMenu( SM_GoToNextState ); + + TweenOffScreen(); + +} + +/************************************ +TweenOffScreen +Desc: Squashes graphics before the screen +changes state. +************************************/ +void ScreenEz2SelectStyle::TweenOffScreen() +{ + /* if (m_iSelectedStyle == 0 || m_iSelectedStyle == 2) + { + m_sprOpt[1].BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); + m_sprOpt[1].SetTweenZoomY( 0 ); + m_sprOpt[2].BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); + m_sprOpt[2].SetTweenZoomY( 0 ); + } + if (m_iSelectedStyle == 1 || m_iSelectedStyle == 2) + { + m_sprOpt[0].BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); + m_sprOpt[0].SetTweenZoomY( 0 ); + m_sprOpt[3].BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); + m_sprOpt[3].SetTweenZoomY( 0 ); + }*/ +} diff --git a/stepmania/src/ScreenEz2SelectStyle.h b/stepmania/src/ScreenEz2SelectStyle.h new file mode 100644 index 0000000000..9d56ba2ac4 --- /dev/null +++ b/stepmania/src/ScreenEz2SelectStyle.h @@ -0,0 +1,56 @@ +/******************************** +ScreenEz2SelectStyle.h +Desc: The "Player Select Screen" for Ez2dancer +Copyright (c): +Andrew Livy +*********************************/ + +/* Includes */ + +#include "Screen.h" +#include "Sprite.h" +#include "BitmapText.h" +#include "TransitionFade.h" +#include "Quad.h" +#include "RandomSample.h" +#include "Quad.h" +#include "MenuElements.h" + +/* Class Definition */ + +const int NUM_EZ2STYLE_GRAPHICS = 4; + +class ScreenEz2SelectStyle : public Screen +{ +public: + ScreenEz2SelectStyle(); // Constructor + virtual ~ScreenEz2SelectStyle(); // Destructor + + /* Public Function Prototypes */ + 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 ); + + void MenuLeft( const PlayerNumber p ); + void MenuRight( const PlayerNumber p ); + void MenuStart( const PlayerNumber p ); + void MenuBack( const PlayerNumber p ); + void TweenOffScreen(); +// void TweenOnScreen(); + +private: + /* Private Function Prototypes */ + + // void BeforeChange(); + void AfterChange(); + void SetFadedStyles(); +// void AnimateGraphics(); + /* Variable Declarations */ + + MenuElements m_Menu; + Sprite m_sprOpt[NUM_EZ2STYLE_GRAPHICS]; + int m_iSelectedStyle; + + RandomSample m_soundChange; + RandomSample m_soundSelect; +}; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 9ccdeb5fe8..e4f5f11de2 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -43,15 +43,13 @@ const float PLAYER_OPTIONS_LOCAL_Y[NUM_PLAYERS] = { -10, +10 }; const float DIFFICULTY_X[NUM_PLAYERS] = { SCREEN_LEFT+60, SCREEN_RIGHT-60 }; const float DIFFICULTY_Y[NUM_PLAYERS] = { SCREEN_BOTTOM-70, SCREEN_BOTTOM-70 }; -const float DEBUG_X = CENTER_X; -const float DEBUG_Y = CENTER_Y-70; +const float MAX_SECONDS_CAN_BE_OFF_BY = 0.25f; const float TIME_BETWEEN_DANCING_COMMENTS = 15; // received while STATE_DANCING -const ScreenMessage SM_PlayMusic = ScreenMessage(SM_User+101); -const ScreenMessage SM_MusicEnded = ScreenMessage(SM_User+102); +const ScreenMessage SM_SongEnded = ScreenMessage(SM_User+102); const ScreenMessage SM_LifeIs0 = ScreenMessage(SM_User+103); @@ -64,7 +62,7 @@ const ScreenMessage SM_BeginFailed = ScreenMessage(SM_User+121); const ScreenMessage SM_ShowFailed = ScreenMessage(SM_User+122); const ScreenMessage SM_PlayFailComment = ScreenMessage(SM_User+123); const ScreenMessage SM_HideFailed = ScreenMessage(SM_User+124); -const ScreenMessage SM_GoToScreenAfterFail = ScreenMessage(SM_User+125); +const ScreenMessage SM_GoToScreenAfterFail = ScreenMessage(SM_User+125); @@ -73,8 +71,6 @@ ScreenGameplay::ScreenGameplay() LOG->WriteLine( "ScreenGameplay::ScreenGameplay()" ); m_pCurSong = NULL; - for( int p=0; pm_PlayMode ) { @@ -110,7 +106,7 @@ ScreenGameplay::ScreenGameplay() - for( p=0; pIsPlayerEnabled(PlayerNumber(p)) ) continue; @@ -154,8 +150,12 @@ ScreenGameplay::ScreenGameplay() m_textStageNumber.Load( THEME->GetPathTo(FONT_HEADER2) ); m_textStageNumber.TurnShadowOff(); m_textStageNumber.SetXY( STAGE_NUMBER_LOCAL_X, STAGE_NUMBER_LOCAL_Y ); - m_textStageNumber.SetText( PREFSMAN->GetStageText() ); - m_textStageNumber.SetDiffuseColor( PREFSMAN->GetStageColor() ); + CString sStageText = PREFSMAN->GetStageText(); + m_textStageNumber.SetText( sStageText ); + if( stricmp(sStageText, "Final") == 0 ) + m_textStageNumber.SetDiffuseColor( D3DXCOLOR(1,0.1f,0.1f,1) ); // red + else + m_textStageNumber.SetDiffuseColor( D3DXCOLOR(0.3f,1,0.3f,1) ); // green m_frameTop.AddActor( &m_textStageNumber ); @@ -178,7 +178,6 @@ ScreenGameplay::ScreenGameplay() m_ScoreDisplay[p].SetXY( SCORE_LOCAL_X[p], SCORE_LOCAL_Y[p] ); m_ScoreDisplay[p].SetZoom( 0.8f ); - m_ScoreDisplay[p].SetDiffuseColor( PlayerToColor(p) ); m_frameBottom.AddActor( &m_ScoreDisplay[p] ); m_textPlayerOptions[p].Load( THEME->GetPathTo(FONT_NORMAL) ); @@ -208,13 +207,9 @@ ScreenGameplay::ScreenGameplay() } - m_textDebug.Load( THEME->GetPathTo(FONT_NORMAL) ); - m_textDebug.SetXY( DEBUG_X, DEBUG_Y ); - m_textDebug.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - this->AddActor( &m_textDebug ); - + m_StarWipe.SetClosed(); @@ -267,38 +262,18 @@ ScreenGameplay::~ScreenGameplay() } -void ScreenGameplay::SaveSummary() -{ - // save score summaries - if( m_pCurSong != NULL ) - { - for( int p=0; pIsPlayerEnabled((PlayerNumber)p) ) - continue; // skip - - SONGMAN->m_aGameplayStatistics[p].Add( m_Player[p].GetGameplayStatistics(m_pCurSong, m_pCurNotes[p]) ); - } - - m_pCurSong = NULL; - } -} - - void ScreenGameplay::LoadNextSong() { int p; + m_pCurSong = m_apSongQueue[m_apSongQueue.GetSize()-1]; + m_apSongQueue.RemoveAt(m_apSongQueue.GetSize()-1); - SaveSummary(); - - m_pCurSong = m_apSongQueue[0]; - m_apSongQueue.RemoveAt(0); - + Notes* pNotes[NUM_PLAYERS]; for( p=0; pIsPlayerEnabled(PlayerNumber(p)) ) continue; - m_DifficultyBanner[p].SetFromNotes( PlayerNumber(p), m_pCurNotes[p] ); + m_DifficultyBanner[p].SetFromNotes( PlayerNumber(p), pNotes[p] ); - NoteData* pOriginalNoteData = m_pCurNotes[p]->GetNoteData(); + NoteData* pOriginalNoteData = pNotes[p]->GetNoteData(); NoteData newNoteData; pStyleDef->GetTransformedNoteDataForStyle( (PlayerNumber)p, pOriginalNoteData, newNoteData ); @@ -322,7 +297,6 @@ void ScreenGameplay::LoadNextSong() (PlayerNumber)p, GAMEMAN->GetCurrentStyleDef(), &newNoteData, - m_pCurNotes[p]->m_iMeter, PREFSMAN->m_PlayerOptions[p], &m_LifeMeter[p], &m_ScoreDisplay[p] @@ -330,8 +304,6 @@ void ScreenGameplay::LoadNextSong() } m_soundMusic.Load( m_pCurSong->GetMusicPath() ); - this->SendScreenMessage( SM_PlayMusic, 3 ); - m_soundMusic.SetPlaybackRate( PREFSMAN->m_SongOptions.m_fMusicRate ); m_Background.LoadFromSong( m_pCurSong ); m_Background.SetDiffuseColor( D3DXCOLOR(0.5f,0.5f,0.5f,1) ); @@ -346,10 +318,6 @@ void ScreenGameplay::Update( float fDeltaTime ) Screen::Update( fDeltaTime ); - if( m_pCurSong == NULL ) - return; - - float fSongBeat, fBPS; float fPositionSeconds = m_soundMusic.GetPositionSeconds(); @@ -360,7 +328,7 @@ void ScreenGameplay::Update( float fDeltaTime ) //LOG->WriteLine( "m_fOffsetInBeats = %f, m_fBeatsPerSecond = %f, m_Music.GetPositionSeconds = %f", m_fOffsetInBeats, m_fBeatsPerSecond, m_Music.GetPositionSeconds() ); - const float fMaxBeatDifference = fBPS * PREFSMAN->m_fJudgeWindow * PREFSMAN->m_SongOptions.m_fMusicRate; + float fMaxBeatDifference = fBPS*MAX_SECONDS_CAN_BE_OFF_BY; for( int p=0; pSendScreenMessage( SM_MusicEnded, 0 ); - } - + m_soundMusic.GetLengthSeconds() - m_soundMusic.GetPositionSeconds() < 2 ) + this->SendScreenMessage( SM_SongEnded, 1 ); + // Check to see if it's time to play a gameplay comment if( PREFSMAN->m_bAnnouncer ) { @@ -438,52 +408,31 @@ void ScreenGameplay::Update( float fDeltaTime ) - // - // Send crossed row messages to Player - // - int iRowNow = BeatToNoteRowNotRounded( fSongBeat ); - static int iRowLastCrossed = 0; - for( int r=iRowLastCrossed+1; r<=iRowNow; r++ ) // for each index we crossed since the last update - { - for( int p=0; pIsPlayerEnabled( (PlayerNumber)p ) ) - continue; // skip - - m_Player[p].CrossedRow( r, fSongBeat, fMaxBeatDifference ); - } - } - - iRowLastCrossed = iRowNow; - - - - // - // play assist ticks - // - // Sound cards have a latency between when a sample is Play()ed and when the sound - // will start coming out the speaker. Compensate for this by boosting - // fPositionSeconds ahead if( PREFSMAN->m_SongOptions.m_AssistType == SongOptions::ASSIST_TICK ) { + // + // play assist ticks + // + // Sound cards have a latency between when a sample is Play()ed and when the sound + // will start coming out the speaker. Compensate for this by boosting + // fPositionSeconds ahead fPositionSeconds += (SOUND->GetPlayLatency()+0.06f) * m_soundMusic.GetPlaybackRate(); // HACK: Add 0.06 seconds to make them play a tiny bit earlier m_pCurSong->GetBeatAndBPSFromElapsedTime( fPositionSeconds, fSongBeat, fBPS ); - int iRowNow = BeatToNoteRowNotRounded( fSongBeat ); - static int iRowLastCrossed = 0; + int iIndexNow = BeatToNoteIndexNotRounded( fSongBeat ); + static int iIndexLastCrossed = 0; bool bAnyoneHasANote = false; // set this to true if any player has a note at one of the indicies we crossed - for( int r=iRowLastCrossed+1; r<=iRowNow; r++ ) // for each index we crossed since the last update + for( int i=iIndexLastCrossed+1; i<=iIndexNow; i++ ) // for each index we crossed since the last update { for( int p=0; pIsPlayerEnabled( (PlayerNumber)p ) ) continue; // skip - m_Player[p].CrossedRow( r, fSongBeat, fMaxBeatDifference ); - bAnyoneHasANote |= m_Player[p].IsThereANoteAtRow( r ); + bAnyoneHasANote |= m_Player[p].IsThereANoteAtIndex( i ); break; // this will only play the tick for the first player that is joined } } @@ -492,7 +441,7 @@ void ScreenGameplay::Update( float fDeltaTime ) m_soundAssistTick.PlayRandom(); - iRowLastCrossed = iRowNow; + iIndexLastCrossed = iIndexNow; } } @@ -511,44 +460,6 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ float fSongBeat, fBPS; m_pCurSong->GetBeatAndBPSFromElapsedTime( m_soundMusic.GetPositionSeconds(), fSongBeat, fBPS ); - - // Handle special keys to adjust the offset - if( type == IET_FIRST_PRESS && DeviceI.device == DEVICE_KEYBOARD ) - { - switch( DeviceI.button ) - { - case DIK_F9: - m_pCurSong->SetBeatOffsetInSeconds( m_pCurSong->GetBeatOffsetInSeconds()-0.01f ); - break; - case DIK_F10: - m_pCurSong->SetBeatOffsetInSeconds( m_pCurSong->GetBeatOffsetInSeconds()+0.01f ); - break; - case DIK_F11: - m_pCurSong->SetBeatOffsetInSeconds( m_pCurSong->GetBeatOffsetInSeconds()-(1/fBPS) ); - break; - case DIK_F12: - m_pCurSong->SetBeatOffsetInSeconds( m_pCurSong->GetBeatOffsetInSeconds()+(1/fBPS) ); - break; - } - - switch( DeviceI.button ) - { - case DIK_F9: - case DIK_F10: - case DIK_F11: - case DIK_F12: - m_textDebug.SetText( ssprintf("Offset = %f.", m_pCurSong->GetBeatOffsetInSeconds()) ); - m_textDebug.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - m_textDebug.StopTweening(); - m_textDebug.BeginTweeningQueued( 3 ); // sleep - m_textDebug.BeginTweeningQueued( 0.5f ); // fade out - m_textDebug.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) ); - break; - } - - } - - if( MenuI.IsValid() ) { @@ -567,14 +478,14 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ } } - const float fMaxBeatDifference = fBPS * PREFSMAN->m_fJudgeWindow * PREFSMAN->m_SongOptions.m_fMusicRate; + float fMaxBeatsCanBeOffBy = MAX_SECONDS_CAN_BE_OFF_BY * fBPS; if( type == IET_FIRST_PRESS ) { if( StyleI.IsValid() ) { if( GAMEMAN->IsPlayerEnabled( StyleI.player ) ) - m_Player[StyleI.player].HandlePlayerStep( fSongBeat, StyleI.col, fMaxBeatDifference ); + m_Player[StyleI.player].HandlePlayerStep( fSongBeat, StyleI.col, fMaxBeatsCanBeOffBy ); } } } @@ -604,6 +515,8 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) if( PREFSMAN->m_bAnnouncer ) m_announcerHereWeGo.PlayRandom(); m_Background.SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,0.8f,1) ); + m_soundMusic.Play(); + m_soundMusic.SetPlaybackRate( PREFSMAN->m_SongOptions.m_fMusicRate ); break; case SM_User+6: break; @@ -622,33 +535,21 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) this->SendScreenMessage( SM_BeginFailed, 0 ); m_DancingState = STATE_OUTRO; break; - - case SM_PlayMusic: - m_soundMusic.Play(); - m_soundMusic.SetPlaybackRate( PREFSMAN->m_SongOptions.m_fMusicRate ); - break; - case SM_MusicEnded: + case SM_SongEnded: if( m_DancingState == STATE_OUTRO ) // gameplay already ended return; // ignore - if( m_apSongQueue.GetSize() > 0 ) + if( m_bBothHaveFailed ) // fail them { - LoadNextSong(); + this->SendScreenMessage( SM_BeginFailed, 0 ); } - else + else // cleared { - if( m_bBothHaveFailed ) // fail them - { - this->SendScreenMessage( SM_BeginFailed, 0 ); - } - else // cleared - { - m_StarWipe.CloseWipingRight( SM_ShowCleared ); - if( PREFSMAN->m_bAnnouncer ) - m_announcerCleared.PlayRandom(); // crowd cheer - } - m_DancingState = STATE_OUTRO; + m_StarWipe.CloseWipingRight( SM_ShowCleared ); + if( PREFSMAN->m_bAnnouncer ) + m_announcerCleared.PlayRandom(); // crowd cheer } + m_DancingState = STATE_OUTRO; break; // received while STATE_OUTRO @@ -661,8 +562,16 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) SCREENMAN->SendMessageToTopScreen( SM_GoToResults, 1 ); break; case SM_GoToResults: - SaveSummary(); - SCREENMAN->SetNewScreen( new ScreenResults(false) ); + { + // send score summaries to the PREFSMAN object so ScreenResults can grab it. + for( int p=0; pIsPlayerEnabled((PlayerNumber)p) ) + continue; // skip + m_Player[p].GetGameplayStatistics( SONGMAN->m_GameplayStatistics[PREFSMAN->m_iNumArcadeStages-1][p] ); + } + SCREENMAN->SetNewScreen( new ScreenResults(false) ); + } break; diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index cc4ced81be..fd8769f8c7 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -47,16 +47,14 @@ public: private: void TweenOnScreen(); void TweenOffScreen(); - void SaveSummary(); void LoadNextSong(); DancingState m_DancingState; - Song* m_pCurSong; - Notes* m_pCurNotes[NUM_PLAYERS]; - CArray m_apSongQueue; // nearest songs are on front of queue - CArray m_apNotesQueue[NUM_PLAYERS]; // nearest notes are on front of queue + Song* m_pCurSong; // nearest songs are on back of queue + CArray m_apSongQueue; // nearest songs are on back of queue + CArray m_apNotesQueue[NUM_PLAYERS]; // nearest notes are on back of queue bool m_bBothHaveFailed; float m_fTimeLeftBeforeDancingComment; // this counter is only running while STATE_DANCING @@ -64,19 +62,19 @@ private: Background m_Background; + ActorFrame m_frameTop; Sprite m_sprTopFrame; Quad m_quadLifeMeterBG[NUM_PLAYERS]; // just a black quad to fill in hole for the life meter LifeMeterBar m_LifeMeter[NUM_PLAYERS]; BitmapText m_textStageNumber; + ActorFrame m_frameBottom; Sprite m_sprBottomFrame; ScoreDisplayRolling m_ScoreDisplay[NUM_PLAYERS]; BitmapText m_textPlayerOptions[NUM_PLAYERS]; - BitmapText m_textDebug; - TransitionStarWipe m_StarWipe; diff --git a/stepmania/src/ScreenMusicScroll.cpp b/stepmania/src/ScreenMusicScroll.cpp index bcc4fdb5ee..d81512c855 100644 --- a/stepmania/src/ScreenMusicScroll.cpp +++ b/stepmania/src/ScreenMusicScroll.cpp @@ -82,9 +82,8 @@ const CString CREDIT_LINES[] = "SPECIAL THANKS TO:", "SimWolf", "Dance With Intensity", - "DDRLlama", - "AngelTK", - "www.ddrmaniax.net", + "DDR Llama", + "DDRManiaX", "Lagged", "The Melting Pot", "DDRJamz Global BBS", @@ -109,8 +108,10 @@ const CString CREDIT_LINES[] = "", "", "If your name is missing from this list,", - " send me an e-mail!", - " -Chris" + "", + " I apologize!", + "", + " -Chris" }; const int NUM_CREDIT_LINES = sizeof(CREDIT_LINES) / sizeof(CString); @@ -155,12 +156,12 @@ ScreenMusicScroll::ScreenMusicScroll() { m_textLines[i].SetZoom( 0.7f ); m_textLines[i].SetXY( CENTER_X, SCREEN_BOTTOM + 40 ); - m_textLines[i].BeginTweeningQueued( 0.30f * i ); - m_textLines[i].BeginTweeningQueued( 3.0f ); + m_textLines[i].BeginTweeningQueued( 0.20f * i ); + m_textLines[i].BeginTweeningQueued( 2.0f ); m_textLines[i].SetTweenXY( CENTER_X, SCREEN_TOP - 40 ); } - this->SendScreenMessage( SM_StartFadingOut, 0.30f * i + 3.0f ); + this->SendScreenMessage( SM_StartFadingOut, 0.20f * i + 3.0f ); this->AddActor( &m_Fade ); diff --git a/stepmania/src/ScreenSelectCourse.cpp b/stepmania/src/ScreenSelectCourse.cpp index bdd958bcdb..04b840c8ab 100644 --- a/stepmania/src/ScreenSelectCourse.cpp +++ b/stepmania/src/ScreenSelectCourse.cpp @@ -134,7 +134,7 @@ void ScreenSelectCourse::Input( const DeviceInput& DeviceI, const InputEventType if( m_Menu.IsClosing() ) return; // ignore - if( MenuI.player == PLAYER_INVALID ) + if( MenuI.player == PLAYER_NONE ) return; Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler @@ -174,7 +174,7 @@ void ScreenSelectCourse::HandleScreenMessage( const ScreenMessage SM ) { MUSIC->Stop(); - SCREENMAN->SetNewScreen( new ScreenStage ); + SCREENMAN->SetNewScreen( new ScreenStage(false) ); } break; } @@ -198,38 +198,32 @@ void ScreenSelectCourse::MenuRight( const PlayerNumber p, const InputEventType t void ScreenSelectCourse::MenuStart( const PlayerNumber p ) { // this needs to check whether valid Notes are selected! - bool bChoseACourse = m_MusicWheel.Select(); + m_MusicWheel.Select(); - - if( bChoseACourse ) + switch( m_MusicWheel.GetSelectedType() ) { - switch( m_MusicWheel.GetSelectedType() ) - { - case TYPE_COURSE: - SONGMAN->m_pCurCourse = m_MusicWheel.GetSelectedCourse(); + case TYPE_COURSE: + SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_MUSIC_COMMENT_GENERAL) ); + + TweenOffScreen(); - SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_MUSIC_COMMENT_GENERAL) ); + m_soundSelect.PlayRandom(); - TweenOffScreen(); + // show "hold START for options" + m_textHoldForOptions.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); + m_textHoldForOptions.BeginTweeningQueued( 0.25f ); // fade in + m_textHoldForOptions.SetTweenZoomY( 1 ); + m_textHoldForOptions.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) ); + m_textHoldForOptions.BeginTweeningQueued( 2.0f ); // sleep + m_textHoldForOptions.BeginTweeningQueued( 0.25f ); // fade out + m_textHoldForOptions.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) ); + m_textHoldForOptions.SetTweenZoomY( 0 ); - m_soundSelect.PlayRandom(); + m_Menu.TweenOffScreenToBlack( SM_None, false ); - // show "hold START for options" - m_textHoldForOptions.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); - m_textHoldForOptions.BeginTweeningQueued( 0.25f ); // fade in - m_textHoldForOptions.SetTweenZoomY( 1 ); - m_textHoldForOptions.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) ); - m_textHoldForOptions.BeginTweeningQueued( 2.0f ); // sleep - m_textHoldForOptions.BeginTweeningQueued( 0.25f ); // fade out - m_textHoldForOptions.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) ); - m_textHoldForOptions.SetTweenZoomY( 0 ); - - m_Menu.TweenOffScreenToBlack( SM_None, false ); - - this->SendScreenMessage( SM_GoToNextState, 2.5f ); - - break; - } + this->SendScreenMessage( SM_GoToNextState, 2.5f ); + + break; } } diff --git a/stepmania/src/ScreenSelectDifficulty.cpp b/stepmania/src/ScreenSelectDifficulty.cpp index d6f6daf2b6..aa7adb2f99 100644 --- a/stepmania/src/ScreenSelectDifficulty.cpp +++ b/stepmania/src/ScreenSelectDifficulty.cpp @@ -72,10 +72,6 @@ ScreenSelectDifficulty::ScreenSelectDifficulty() { LOG->WriteLine( "ScreenSelectDifficulty::ScreenSelectDifficulty()" ); - // Reset the current PlayMode - PREFSMAN->m_PlayMode = PLAY_MODE_INVALID; - - int p; m_Menu.Load( @@ -211,22 +207,11 @@ void ScreenSelectDifficulty::HandleScreenMessage( const ScreenMessage SM ) SCREENMAN->SetNewScreen( new ScreenTitleMenu ); break; case SM_GoToNextState: - { - for( int p=0; pm_PreferredDifficultyClass[p] = CLASS_EASY; break; - case 1: PREFSMAN->m_PreferredDifficultyClass[p] = CLASS_MEDIUM; break; - case 2: PREFSMAN->m_PreferredDifficultyClass[p] = CLASS_HARD; break; - } - } - switch( m_iSelection[PLAYER_1] ) { case 0: case 1: case 2: // something on page 1 was chosen - PREFSMAN->m_PlayMode = PLAY_MODE_ARCADE; SCREENMAN->SetNewScreen( new ScreenSelectGroup ); break; case 3: diff --git a/stepmania/src/ScreenSelectGame.cpp b/stepmania/src/ScreenSelectGame.cpp index 1d3397e815..fc3d78e2f7 100644 --- a/stepmania/src/ScreenSelectGame.cpp +++ b/stepmania/src/ScreenSelectGame.cpp @@ -77,14 +77,17 @@ void ScreenSelectGame::ExportOptions() { case GAME_DANCE: GAMEMAN->m_CurStyle = STYLE_DANCE_SINGLE; + GAMEMAN->m_CurGame = GAME_DANCE; ANNOUNCER->SwitchAnnouncer( "default" ); break; case GAME_PUMP: GAMEMAN->m_CurStyle = STYLE_PUMP_SINGLE; + GAMEMAN->m_CurGame = GAME_PUMP; ANNOUNCER->SwitchAnnouncer( "default" ); break; case GAME_EZ2: - GAMEMAN->m_CurStyle = STYLE_EZ2_SINGLE; + GAMEMAN->m_CurStyle = STYLE_EZ2_SINGLE; + GAMEMAN->m_CurGame = GAME_EZ2; ANNOUNCER->SwitchAnnouncer( "ez2" ); break; default: ASSERT(0); // invalid Game diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index edab999261..e30dafa168 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -217,7 +217,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, const InputEventType { LOG->WriteLine( "ScreenSelectMusic::Input()" ); - if( MenuI.player == PLAYER_INVALID ) + if( MenuI.player == PLAYER_NONE ) return; if( m_Menu.IsClosing() ) @@ -323,7 +323,7 @@ void ScreenSelectMusic::HandleScreenMessage( const ScreenMessage SM ) { MUSIC->Stop(); - SCREENMAN->SetNewScreen( new ScreenStage ); + SCREENMAN->SetNewScreen( new ScreenStage(false) ); } break; case SM_PlaySongSample: @@ -350,69 +350,64 @@ void ScreenSelectMusic::MenuRight( const PlayerNumber p, const InputEventType ty void ScreenSelectMusic::MenuStart( const PlayerNumber p ) { // this needs to check whether valid Notes are selected! - bool bResult = m_MusicWheel.Select(); + m_MusicWheel.Select(); - if( bResult ) + switch( m_MusicWheel.GetSelectedType() ) { - // a song was selected - switch( m_MusicWheel.GetSelectedType() ) + case TYPE_SONG: { - case TYPE_SONG: + if( !m_MusicWheel.GetSelectedSong()->HasMusic() ) { - if( !m_MusicWheel.GetSelectedSong()->HasMusic() ) - { - SCREENMAN->AddScreenToTop( new ScreenPrompt( "ERROR:\n \nThis song does not have a music file\n and cannot be played.", PROMPT_OK) ); - return; - } - - bool bIsNew = m_MusicWheel.GetSelectedSong()->IsNew(); - bool bIsHard = false; - for( int p=0; pIsPlayerEnabled( (PlayerNumber)p ) ) - continue; // skip - if( SONGMAN->GetCurrentNotes((PlayerNumber)p) && SONGMAN->GetCurrentNotes((PlayerNumber)p)->m_iMeter >= 9 ) - bIsHard = true; - } - - if( bIsNew ) - SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_MUSIC_COMMENT_NEW) ); - else if( bIsHard ) - SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_MUSIC_COMMENT_HARD) ); - else - SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_MUSIC_COMMENT_GENERAL) ); - - - TweenOffScreen(); - - m_bMadeChoice = true; - - m_soundSelect.PlayRandom(); - - // show "hold START for options" - m_textHoldForOptions.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); - m_textHoldForOptions.BeginTweeningQueued( 0.25f ); // fade in - m_textHoldForOptions.SetTweenZoomY( 1 ); - m_textHoldForOptions.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) ); - m_textHoldForOptions.BeginTweeningQueued( 2.0f ); // sleep - m_textHoldForOptions.BeginTweeningQueued( 0.25f ); // fade out - m_textHoldForOptions.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) ); - m_textHoldForOptions.SetTweenZoomY( 0 ); - - m_Menu.TweenOffScreenToBlack( SM_None, false ); - - this->SendScreenMessage( SM_GoToNextState, 2.5f ); + SCREENMAN->AddScreenToTop( new ScreenPrompt( "ERROR:\n \nThis song does not have a music file\n and cannot be played.", PROMPT_OK) ); + return; } - break; - case TYPE_SECTION: - - break; - case TYPE_ROULETTE: - break; + bool bIsNew = m_MusicWheel.GetSelectedSong()->IsNew(); + bool bIsHard = false; + for( int p=0; pIsPlayerEnabled( (PlayerNumber)p ) ) + continue; // skip + if( SONGMAN->GetCurrentNotes((PlayerNumber)p) && SONGMAN->GetCurrentNotes((PlayerNumber)p)->m_iMeter >= 9 ) + bIsHard = true; + } + + if( bIsNew ) + SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_MUSIC_COMMENT_NEW) ); + else if( bIsHard ) + SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_MUSIC_COMMENT_HARD) ); + else + SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_MUSIC_COMMENT_GENERAL) ); + + + TweenOffScreen(); + + m_bMadeChoice = true; + + m_soundSelect.PlayRandom(); + + // show "hold START for options" + m_textHoldForOptions.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); + m_textHoldForOptions.BeginTweeningQueued( 0.25f ); // fade in + m_textHoldForOptions.SetTweenZoomY( 1 ); + m_textHoldForOptions.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) ); + m_textHoldForOptions.BeginTweeningQueued( 2.0f ); // sleep + m_textHoldForOptions.BeginTweeningQueued( 0.25f ); // fade out + m_textHoldForOptions.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) ); + m_textHoldForOptions.SetTweenZoomY( 0 ); + + m_Menu.TweenOffScreenToBlack( SM_None, false ); + + this->SendScreenMessage( SM_GoToNextState, 2.5f ); } - } + break; + case TYPE_SECTION: + + break; + case TYPE_ROULETTE: + break; + } } @@ -439,14 +434,6 @@ void ScreenSelectMusic::AfterNotesChange( const PlayerNumber p ) m_DifficultyIcon[p].SetFromNotes( pNotes ); m_FootMeter[p].SetFromNotes( pNotes ); - if( pNotes ) - { - // do a little bounce - m_FootMeter[p].StopTweening(); - m_FootMeter[p].SetZoom( 1.1f ); - m_FootMeter[p].BeginTweening( 0.3f, TWEEN_BOUNCE_BEGIN ); - m_FootMeter[p].SetTweenZoom( 1 ); - } m_GrooveRadar.SetFromNotes( p, pNotes ); m_MusicWheel.NotesChanged( p ); } diff --git a/stepmania/src/ScreenSelectStyle.cpp b/stepmania/src/ScreenSelectStyle.cpp index 2339383039..e872580d6f 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -47,11 +47,6 @@ ScreenSelectStyle::ScreenSelectStyle() { LOG->WriteLine( "ScreenSelectStyle::ScreenSelectStyle()" ); - - // Reset the current style and game - GAMEMAN->m_CurStyle = STYLE_NONE; - - for( int s=0; sStop(); @@ -215,7 +210,7 @@ void ScreenSelectStyle::MenuRight( const PlayerNumber p ) void ScreenSelectStyle::MenuStart( const PlayerNumber p ) { - if( p != PLAYER_INVALID ) + if( p != PLAYER_NONE ) GAMEMAN->m_sMasterPlayerNumber = p; GAMEMAN->m_CurStyle = GetSelectedStyle(); diff --git a/stepmania/src/ScreenStage.cpp b/stepmania/src/ScreenStage.cpp index 265807080b..25d1d8f99b 100644 --- a/stepmania/src/ScreenStage.cpp +++ b/stepmania/src/ScreenStage.cpp @@ -29,48 +29,41 @@ const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 1); const ScreenMessage SM_GoToNextState = ScreenMessage(SM_User + 3); -ScreenStage::ScreenStage() +ScreenStage::ScreenStage( bool bTryExtraStage ) { + m_bTryExtraStage = false; + m_textStage.Load( THEME->GetPathTo(FONT_STAGE) ); m_textStage.TurnShadowOff(); - - if( PREFSMAN->IsExtraStage() ) + if( bTryExtraStage ) { - m_textStage.SetText( "Extra Stage" ); - m_textStage.SetDiffuseColor( D3DXCOLOR(1,0.1f,0.1f,1) ); // red - SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_EXTRA) ); - } - else if( PREFSMAN->IsExtraStage2() ) - { - m_textStage.SetText( "Extra Stage 2" ); // red + m_textStage.SetText( "Try Extra Stage!" ); m_textStage.SetDiffuseColor( D3DXCOLOR(1,0.1f,0.1f,1) ); SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_EXTRA) ); } - else if( PREFSMAN->IsFinalStage() ) + else // !bTryExtraStage { - m_textStage.SetText( "Final Stage" ); - m_textStage.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_FINAL) ); - } - else - { - m_textStage.SetText( PREFSMAN->GetStageText() + " Stage" ); + int iStageNo = PREFSMAN->GetStageNumber(); + bool bFinal = PREFSMAN->IsFinalStage(); + + CString sStagePrefix = PREFSMAN->GetStageText(); + m_textStage.SetText( sStagePrefix + " Stage" ); m_textStage.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - const int iStageNo = PREFSMAN->GetStageIndex()+1; - switch( iStageNo ) + if( bFinal ) + SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_FINAL) ); + else { - case 1: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_1) ); break; - case 2: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_2) ); break; - case 3: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_3) ); break; - case 4: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_4) ); break; - case 5: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_5) ); break; - default: ; break; // play nothing + switch( iStageNo ) + { + case 1: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_1) ); break; + case 2: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_2) ); break; + case 3: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_3) ); break; + case 4: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_4) ); break; + case 5: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_5) ); break; + } } - } - - m_textStage.SetXY( CENTER_X, CENTER_Y ); m_textStage.SetZoomX( 2 ); m_textStage.SetZoomY( 0 ); diff --git a/stepmania/src/ScreenStage.h b/stepmania/src/ScreenStage.h index 3c209e370f..9d5f3bb75c 100644 --- a/stepmania/src/ScreenStage.h +++ b/stepmania/src/ScreenStage.h @@ -17,6 +17,7 @@ class ScreenStage : public Screen { public: ScreenStage(); + ScreenStage( bool bTryExtraStage ); virtual void HandleScreenMessage( const ScreenMessage SM ); diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index 537f73ea9d..9dc2d703b2 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -27,6 +27,7 @@ #include "RageLog.h" #include "SongManager.h" #include "AnnouncerManager.h" +#include "ScreenEz2SelectPlayer.h" #include "GameManager.h" @@ -61,6 +62,7 @@ const ScreenMessage SM_GoToGameOptions = ScreenMessage(SM_User+6); const ScreenMessage SM_GoToSynchronize = ScreenMessage(SM_User+9); const ScreenMessage SM_GoToEdit = ScreenMessage(SM_User+10); const ScreenMessage SM_DoneOpening = ScreenMessage(SM_User+11); +const ScreenMessage SM_GoToEz2 = ScreenMessage(SM_User+12); ScreenTitleMenu::ScreenTitleMenu() { @@ -95,7 +97,7 @@ ScreenTitleMenu::ScreenTitleMenu() m_textVersion.Load( THEME->GetPathTo(FONT_NORMAL) ); m_textVersion.SetHorizAlign( Actor::align_right ); - m_textVersion.SetText( "v3.0 public test" ); + m_textVersion.SetText( "v3.0 compatibility test" ); m_textVersion.SetDiffuseColor( D3DXCOLOR(0.6f,0.6f,0.6f,1) ); // light gray m_textVersion.SetXY( SCREEN_RIGHT-16, SCREEN_BOTTOM-20 ); m_textVersion.SetZoom( 0.5f ); @@ -193,6 +195,9 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM ) case SM_GoToEdit: SCREENMAN->SetNewScreen( new ScreenEditMenu ); break; + case SM_GoToEz2: + SCREENMAN->SetNewScreen( new ScreenEz2SelectPlayer ); + break; } } @@ -250,8 +255,16 @@ void ScreenTitleMenu::MenuStart( const PlayerNumber p ) switch( m_TitleMenuChoice ) { case CHOICE_GAME_START: - m_soundSelect.PlayRandom(); - m_Fade.CloseWipingRight( SM_GoToCaution ); + if ( GAMEMAN->m_CurGame == GAME_EZ2 ) + { + m_soundSelect.PlayRandom(); + m_Fade.CloseWipingRight( SM_GoToEz2 ); + } + else + { + m_soundSelect.PlayRandom(); + m_Fade.CloseWipingRight( SM_GoToCaution ); + } return; case CHOICE_SELECT_GAME: m_soundSelect.PlayRandom(); diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 275d54346e..413fb181a0 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -890,8 +890,8 @@ void Song::TidyUpData() pNM->m_fRadarValues[RADAR_STREAM] = pNM->GetNoteData()->GetStreamRadarValue( fMusicLength ); pNM->m_fRadarValues[RADAR_VOLTAGE] = pNM->GetNoteData()->GetVoltageRadarValue( fMusicLength ); pNM->m_fRadarValues[RADAR_AIR] = pNM->GetNoteData()->GetAirRadarValue( fMusicLength ); - pNM->m_fRadarValues[RADAR_FREEZE] = pNM->GetNoteData()->GetFreezeRadarValue( fMusicLength ); pNM->m_fRadarValues[RADAR_CHAOS] = pNM->GetNoteData()->GetChaosRadarValue( fMusicLength ); + pNM->m_fRadarValues[RADAR_FREEZE] = pNM->GetNoteData()->GetFreezeRadarValue( fMusicLength ); } } diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 6351df6bb8..af8b32204d 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -77,8 +77,7 @@ void SongManager::SetCurrentNotes( PlayerNumber p, Notes* pNotes ) GameplayStatistics SongManager::GetLatestGameplayStatistics( PlayerNumber p ) { - ASSERT( m_aGameplayStatistics[p].GetSize() > 0 ); - return m_aGameplayStatistics[p][ m_aGameplayStatistics[p].GetSize()-1 ]; + return m_GameplayStatistics[ PREFSMAN->GetStageIndex() ][p]; } diff --git a/stepmania/src/SongManager.h b/stepmania/src/SongManager.h index bf112cd7ea..6c59a19b01 100644 --- a/stepmania/src/SongManager.h +++ b/stepmania/src/SongManager.h @@ -14,10 +14,12 @@ #include "Song.h" #include "Course.h" -#include "GameplayStatistics.h" +#include "GamePlayStatistics.h" //#include // for D3DXCOLOR const int MAX_SONG_QUEUE_SIZE = 400; // this has to be gigantic to fit an "endless" number of songs +const int MAX_NUM_STAGES = 10; // the max number of stages that can be played in arcade mode + class SongManager { @@ -30,7 +32,7 @@ public: Course* m_pCurCourse; CString m_sPreferredGroup; - CArray m_aGameplayStatistics[NUM_PLAYERS]; // for passing from Dancing to Results + GameplayStatistics m_GameplayStatistics[MAX_NUM_STAGES][NUM_PLAYERS]; // for passing from Dancing to Results CArray m_pSongs; // all songs that can be played diff --git a/stepmania/src/StepMania.RC b/stepmania/src/StepMania.RC index 3a414b7737..d8fa16d2ec 100644 --- a/stepmania/src/StepMania.RC +++ b/stepmania/src/StepMania.RC @@ -1,4 +1,4 @@ -//Microsoft Developer Studio generated resource script. +// Microsoft Visual C++ generated resource script. // #include "resource.h" @@ -27,18 +27,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // TEXTINCLUDE // -1 TEXTINCLUDE MOVEABLE PURE +1 TEXTINCLUDE BEGIN "resource.h\0" END -2 TEXTINCLUDE MOVEABLE PURE +2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" "\0" END -3 TEXTINCLUDE MOVEABLE PURE +3 TEXTINCLUDE BEGIN "\r\n" "\0" @@ -52,7 +52,7 @@ END // Accelerator // -IDR_MAIN_ACCEL ACCELERATORS MOVEABLE PURE +IDR_MAIN_ACCEL ACCELERATORS BEGIN VK_F5, IDM_CHANGEDETAIL, VIRTKEY, NOINVERT "X", IDM_EXIT, VIRTKEY, ALT, NOINVERT @@ -68,9 +68,8 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_ICON ICON DISCARDABLE "StepMania.ICO" +IDI_ICON ICON "StepMania.ICO" -#ifndef _MAC ///////////////////////////////////////////////////////////////////////////// // // Version @@ -93,14 +92,14 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN - VALUE "CompanyName", "http://www.stepmania.com\0" - VALUE "FileDescription", "StepMania\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "StepMania\0" - VALUE "LegalCopyright", "Copyright © 2001-2002\0" - VALUE "OriginalFilename", "StepMania.exe\0" - VALUE "ProductName", " StepMania\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "CompanyName", "http://www.stepmania.com" + VALUE "FileDescription", "StepMania" + VALUE "FileVersion", "1, 0, 0, 1" + VALUE "InternalName", "StepMania" + VALUE "LegalCopyright", "Copyright © 2001-2002" + VALUE "OriginalFilename", "StepMania.exe" + VALUE "ProductName", " StepMania" + VALUE "ProductVersion", "1, 0, 0, 1" END END BLOCK "VarFileInfo" @@ -109,16 +108,14 @@ BEGIN END END -#endif // !_MAC - ///////////////////////////////////////////////////////////////////////////// // // Bitmap // -BITMAP_ERROR BITMAP MOVEABLE PURE "error.bmp" -BITMAP_SPLASH BITMAP MOVEABLE PURE "splash.bmp" +BITMAP_ERROR BITMAP "error.bmp" +BITMAP_SPLASH BITMAP "splash.bmp" ///////////////////////////////////////////////////////////////////////////// // @@ -126,9 +123,9 @@ BITMAP_SPLASH BITMAP MOVEABLE PURE "splash.bmp" // IDD_ERROR_DIALOG DIALOGEX 0, 0, 332, 234 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION CAPTION "StepMania Error" -FONT 8, "MS Sans Serif" +FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN EDITTEXT IDC_EDIT_ERROR,5,80,320,130,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | NOT diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 0650a28610..896cf9ab04 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -223,7 +223,6 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow ) } } // end while( WM_QUIT != msg.message ) - LOG->WriteLine( "Recieved WM_QUIT message. Shutting down..." ); // clean up after a normal exit DestroyObjects(); // deallocate our game objects and leave fullscreen @@ -237,29 +236,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow ) } catch( ... ) { - switch( GetExceptionCode() ) - { - case EXCEPTION_ACCESS_VIOLATION: g_sErrorString = "EXCEPTION_ACCESS_VIOLATION"; break; - case EXCEPTION_BREAKPOINT: g_sErrorString = "EXCEPTION_BREAKPOINT"; break; - case EXCEPTION_DATATYPE_MISALIGNMENT: g_sErrorString = "EXCEPTION_DATATYPE_MISALIGNMENT"; break; - case EXCEPTION_SINGLE_STEP: g_sErrorString = "EXCEPTION_SINGLE_STEP"; break; - case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: g_sErrorString = "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"; break; - case EXCEPTION_FLT_DENORMAL_OPERAND: g_sErrorString = "EXCEPTION_FLT_DENORMAL_OPERAND"; break; - case EXCEPTION_FLT_DIVIDE_BY_ZERO: g_sErrorString = "EXCEPTION_FLT_DIVIDE_BY_ZERO"; break; - case EXCEPTION_FLT_INEXACT_RESULT: g_sErrorString = "EXCEPTION_FLT_INEXACT_RESULT"; break; - case EXCEPTION_FLT_INVALID_OPERATION: g_sErrorString = "EXCEPTION_FLT_INVALID_OPERATION"; break; - case EXCEPTION_FLT_OVERFLOW: g_sErrorString = "EXCEPTION_FLT_OVERFLOW"; break; - case EXCEPTION_FLT_STACK_CHECK: g_sErrorString = "EXCEPTION_FLT_STACK_CHECK"; break; - case EXCEPTION_FLT_UNDERFLOW: g_sErrorString = "EXCEPTION_FLT_UNDERFLOW"; break; - case EXCEPTION_INT_DIVIDE_BY_ZERO: g_sErrorString = "EXCEPTION_INT_DIVIDE_BY_ZERO"; break; - case EXCEPTION_INT_OVERFLOW: g_sErrorString = "EXCEPTION_INT_OVERFLOW"; break; - case EXCEPTION_PRIV_INSTRUCTION: g_sErrorString = "EXCEPTION_PRIV_INSTRUCTION"; break; - case EXCEPTION_NONCONTINUABLE_EXCEPTION:g_sErrorString = "EXCEPTION_NONCONTINUABLE_EXCEPTION"; break; - case EXCEPTION_ACCESS_VIOLATION: g_sErrorString = "EXCEPTION_ACCESS_VIOLATION"; break; - case EXCEPTION_ACCESS_VIOLATION: g_sErrorString = "EXCEPTION_ACCESS_VIOLATION"; break; - default: g_sErrorString = "Unknown exception."; break; - } - + g_sErrorString = "access violation or other run-time error."; } if( g_sErrorString != "" ) @@ -533,12 +510,12 @@ HRESULT CreateObjects( HWND hWnd ) - SCREENMAN->SetNewScreen( new ScreenTitleMenu ); //SCREENMAN->SetNewScreen( new ScreenLoading ); //SCREENMAN->SetNewScreen( new ScreenSandbox ); - //SCREENMAN->SetNewScreen( new ScreenResults(true) ); + //SCREENMAN->SetNewScreen( new ScreenResults(false) ); //SCREENMAN->SetNewScreen( new ScreenSelectDifficulty ); //SCREENMAN->SetNewScreen( new ScreenPlayerOptions ); + SCREENMAN->SetNewScreen( new ScreenTitleMenu ); //SCREENMAN->SetNewScreen( new ScreenGameplay ); //SCREENMAN->SetNewScreen( new ScreenMusicScroll ); //SCREENMAN->SetNewScreen( new ScreenSelectMusic ); diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 402c3d701d..b929cee7d0 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -79,7 +79,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:windows /profile /debug /machine:I386 /out:"../StepMania-debug.exe" +# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /out:"../StepMania-debug.exe" /pdbtype:sept !ENDIF @@ -260,14 +260,6 @@ SOURCE=.\NoteData.h # End Source File # Begin Source File -SOURCE=.\NoteDataWithScoring.cpp -# End Source File -# Begin Source File - -SOURCE=.\NoteDataWithScoring.h -# End Source File -# Begin Source File - SOURCE=.\Notes.cpp # End Source File # Begin Source File @@ -666,22 +658,6 @@ SOURCE=.\TipDisplay.h # Begin Group "Actors used in Gameplay" # PROP Default_Filter "" -# Begin Group "ParticleSystems" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\DroppingParticleSystem.cpp -# End Source File -# Begin Source File - -SOURCE=.\ParticleSystem.cpp -# End Source File -# Begin Source File - -SOURCE=.\ParticleSystem.h -# End Source File -# End Group # Begin Source File SOURCE=.\ArrowEffects.cpp @@ -872,6 +848,22 @@ SOURCE=.\ScreenEditMenu.h # End Source File # Begin Source File +SOURCE=.\ScreenEz2SelectPlayer.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenEz2SelectPlayer.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenEz2SelectStyle.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenEz2SelectStyle.h +# End Source File +# Begin Source File + SOURCE=.\ScreenGameOptions.cpp # End Source File # Begin Source File @@ -1056,6 +1048,10 @@ SOURCE=.\ScreenTitleMenu.h # PROP Default_Filter "" # Begin Source File +SOURCE=.\AnnouncerManager.cpp +# End Source File +# Begin Source File + SOURCE=.\AnnouncerManager.h # End Source File # Begin Source File diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 1751812228..2b8e8cf044 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -359,12 +359,6 @@ - - - - diff --git a/stepmania/src/StyleInput.h b/stepmania/src/StyleInput.h index 17066634a2..da197b4c6c 100644 --- a/stepmania/src/StyleInput.h +++ b/stepmania/src/StyleInput.h @@ -13,15 +13,15 @@ struct StyleInput { - StyleInput() { player = PLAYER_INVALID; col = -1; }; + StyleInput() { player = PLAYER_NONE; col = -1; }; StyleInput( PlayerNumber p, int c ) { player = p; col = c; }; bool operator==( const StyleInput &other ) { return player == other.player && col == other.col; }; PlayerNumber player; int col; - inline bool IsBlank() const { return player == PLAYER_INVALID; }; + inline bool IsBlank() const { return player == PLAYER_NONE; }; inline bool IsValid() const { return !IsBlank(); }; - inline void MakeBlank() { player = PLAYER_INVALID; col = -1; }; + inline void MakeBlank() { player = PLAYER_NONE; col = -1; }; }; \ No newline at end of file diff --git a/stepmania/src/resource.h b/stepmania/src/resource.h index 495cbc30de..44643f00c1 100644 --- a/stepmania/src/resource.h +++ b/stepmania/src/resource.h @@ -1,5 +1,5 @@ //{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. +// Microsoft Visual C++ generated include file. // Used by StepMania.RC // #define IDD_ERROR_DIALOG 111 @@ -24,7 +24,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 116 +#define _APS_NEXT_RESOURCE_VALUE 115 #define _APS_NEXT_COMMAND_VALUE 40009 #define _APS_NEXT_CONTROL_VALUE 1009 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/stepmania/src/song.h b/stepmania/src/song.h index b5d263dfcc..53bcaaa51b 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -86,7 +86,7 @@ public: CString GetArtist() {return m_sArtist; }; CString GetCredit() {return m_sCredit; }; float GetBeatOffsetInSeconds() {return m_fOffsetInSeconds; }; - void SetBeatOffsetInSeconds(float fNewOffset) {m_fOffsetInSeconds = fNewOffset; SetChangedSinceLastSave(); }; + void SetBeatOffsetInSeconds(float fNewOffset) {m_fOffsetInSeconds = fNewOffset; }; void GetMinMaxBPM( float &fMinBPM, float &fMaxBPM ) { fMaxBPM = 0; @@ -114,13 +114,12 @@ public: bool IsNew() { return GetNumTimesPlayed()==0; }; bool HasChangedSinceLastSave() { return m_bChangedSinceSave; } + void SetChangedSinceLastSave() { m_bChangedSinceSave = true; } Grade GetGradeForDifficultyClass( NotesType nt, DifficultyClass dc ); private: - void SetChangedSinceLastSave() { m_bChangedSinceSave = true; } - CString m_sSongFilePath; CString m_sSongDir; CString m_sGroupName;