From 1500459bb15462c5d06767f621acb59c738f0a29 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 23 Jun 2002 02:50:33 +0000 Subject: [PATCH] no message --- stepmania/src/Background.cpp | 25 ++ stepmania/src/Background.h | 21 ++ stepmania/src/Combo.cpp | 2 +- stepmania/src/DifficultyIcon.h | 2 +- stepmania/src/FootMeter.cpp | 5 - stepmania/src/GameConstantsAndTypes.h | 80 ++++++- stepmania/src/GameDef.h | 2 +- stepmania/src/GhostArrow.h | 20 +- stepmania/src/InputMapper.cpp | 4 +- stepmania/src/LifeMeterBar.cpp | 24 +- stepmania/src/MenuElements.cpp | 4 +- stepmania/src/MenuInput.h | 6 +- stepmania/src/MusicWheel.cpp | 162 +++++++++---- stepmania/src/MusicWheel.h | 8 +- stepmania/src/NoteData.cpp | 57 +++-- stepmania/src/NoteData.h | 56 +---- stepmania/src/NoteDataWithScoring.cpp | 147 ++++++++++++ stepmania/src/NoteDataWithScoring.h | 50 ++++ stepmania/src/NoteField.cpp | 3 +- stepmania/src/Player.cpp | 276 ++++++++++++----------- stepmania/src/Player.h | 16 +- stepmania/src/PrefsManager.cpp | 45 +++- stepmania/src/PrefsManager.h | 7 +- stepmania/src/RageSound.cpp | 9 +- stepmania/src/ScreenEdit.cpp | 6 +- stepmania/src/ScreenGameplay.cpp | 215 +++++++++++++----- stepmania/src/ScreenGameplay.h | 12 +- stepmania/src/ScreenMusicScroll.cpp | 17 +- stepmania/src/ScreenSelectCourse.cpp | 50 ++-- stepmania/src/ScreenSelectDifficulty.cpp | 15 ++ stepmania/src/ScreenSelectMusic.cpp | 117 +++++----- stepmania/src/ScreenSelectStyle.cpp | 9 +- stepmania/src/ScreenStage.cpp | 51 +++-- stepmania/src/ScreenStage.h | 1 - stepmania/src/ScreenTitleMenu.cpp | 2 +- stepmania/src/Song.cpp | 2 +- stepmania/src/SongManager.cpp | 3 +- stepmania/src/SongManager.h | 6 +- stepmania/src/StepMania.RC | 39 ++-- stepmania/src/StepMania.cpp | 29 ++- stepmania/src/StepMania.dsp | 26 ++- stepmania/src/StepMania.vcproj | 6 + stepmania/src/StyleInput.h | 6 +- stepmania/src/resource.h | 4 +- stepmania/src/song.h | 5 +- 45 files changed, 1128 insertions(+), 524 deletions(-) create mode 100644 stepmania/src/NoteDataWithScoring.cpp create mode 100644 stepmania/src/NoteDataWithScoring.h diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 44cec63872..a3c8d85deb 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -18,6 +18,7 @@ const CString VIS_DIR = "Visualizations\\"; +const CString PARTICLE_DIR = "BGEffects\\particles\\"; Background::Background() @@ -31,6 +32,30 @@ 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) ); + + + LoadParticleSprites( PARTICLE_DIR ); +} + + +void Background::LoadParticleSprites( CString path ) +{ + CArray m_particleSprites; + + 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) ); + + m_particleSprites.Add( temp ); + } } bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations ) diff --git a/stepmania/src/Background.h b/stepmania/src/Background.h index 184d61c20f..fc8239d329 100644 --- a/stepmania/src/Background.h +++ b/stepmania/src/Background.h @@ -16,6 +16,9 @@ #include "ActorFrame.h" #include "Song.h" +#include "ParticleSystem.h" + + class Background : public ActorFrame { @@ -40,7 +43,25 @@ public: virtual bool IsDangerOn() { return m_bShowDanger; }; + virtual void nextEffect() {}; + protected: + + virtual void LoadParticleSprites( CString path ); + + + enum ParticleEffect + { + PE_DROPPING = 0, + PE_SPIRAL_OUT, + PE_NUM + }; + + //CArray m_backgroundTiles; + CArray m_particleSprites; + + ParticleSystem* m_pPS; + Sprite m_sprVisualizationOverlay; Sprite m_sprSongBackground; diff --git a/stepmania/src/Combo.cpp b/stepmania/src/Combo.cpp index 920b972362..d4957487fe 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 = 0.5f + m_iCurCombo/800.0f; + float fNewZoom = min( 2, 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 833b8416b4..8ebc52c95f 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_GAMEPLAY_DIFFICULTY_BANNER_ICONS) ); + Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_DIFFICULTY_ICONS) ); StopAnimating(); SetFromNotes( NULL ); diff --git a/stepmania/src/FootMeter.cpp b/stepmania/src/FootMeter.cpp index 68343665b1..d7fab355be 100644 --- a/stepmania/src/FootMeter.cpp +++ b/stepmania/src/FootMeter.cpp @@ -34,11 +34,6 @@ 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 2f9c7919fb..f5b32318a8 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_CHAOS, RADAR_FREEZE, + RADAR_CHAOS, NUM_RADAR_VALUES // leave this at the end }; @@ -216,14 +216,15 @@ enum PlayMode { PLAY_MODE_ARCADE, PLAY_MODE_ONI, - NUM_PLAY_MODES + NUM_PLAY_MODES, + PLAY_MODE_INVALID }; enum PlayerNumber { PLAYER_1 = 0, PLAYER_2, NUM_PLAYERS, // leave this at the end - PLAYER_NONE + PLAYER_INVALID }; inline D3DXCOLOR PlayerToColor( const PlayerNumber p ) @@ -256,7 +257,7 @@ enum Game GAME_PUMP, // Pump It Up GAME_EZ2, // Ez2dancer NUM_GAMES, // leave this at the end - GAME_NONE, + GAME_INVALID, }; enum Style @@ -392,3 +393,74 @@ 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 b032b7926a..d54e50e201 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_NONE, MENU_BUTTON_NONE ); + return MenuInput( PLAYER_INVALID, MENU_BUTTON_INVALID ); }; inline GameInput MenuInputToGameInput( const MenuInput MenuI ) { diff --git a/stepmania/src/GhostArrow.h b/stepmania/src/GhostArrow.h index 3719a512b5..ae1af7f8d6 100644 --- a/stepmania/src/GhostArrow.h +++ b/stepmania/src/GhostArrow.h @@ -1,23 +1,19 @@ +#pragma once /* ----------------------------------------------------------------------------- - File: GhostArrow.h + Class: GhostArrow - Desc: Class used to represent a color arrow on the screen. + Desc: The trail a note leaves when it is destroyed. - Copyright (c) 2001 Ben Norstrom. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Ben Nordstrom + Chris Danford ----------------------------------------------------------------------------- */ -class GhostArrow; - -#ifndef _GhostArrow_H_ -#define _GhostArrow_H_ - - #include "Sprite.h" -#include "Notes.h" - +#include "GameConstantsAndTypes.h" class GhostArrow : public Sprite { @@ -31,5 +27,3 @@ public: float m_fVisibilityCountdown; }; - -#endif diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index 4e0080b35c..95334b4ef1 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_NONE; + return GameI.number != PLAYER_INVALID; } 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_NONE, MENU_BUTTON_NONE ); + return MenuInput( PLAYER_INVALID, MENU_BUTTON_INVALID ); } DeviceInput InputMapper::MenuToDevice( MenuInput MenuI ) diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index f15b731048..7e11b2b7a2 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -18,11 +18,15 @@ 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(); } @@ -34,20 +38,20 @@ void LifeMeterBar::ChangeLife( TapNoteScore score ) float fDeltaLife; switch( score ) { - 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; + 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; } if( bWasDoingGreat && !IsDoingGreat() ) - fDeltaLife = -0.12f; // make it take a while to get back to "doing great" + fDeltaLife = -0.10f; // make it take a while to get back to "doing great" m_fLifePercentage += fDeltaLife; - m_fLifePercentage = clamp( m_fLifePercentage, 0, 1 ); + m_fLifePercentage = min( m_fLifePercentage, 1 ); - if( m_fLifePercentage == 0 ) + if( m_fLifePercentage < FAIL_THRESHOLD ) m_bHasFailed = true; ResetBarVelocity(); @@ -68,7 +72,7 @@ bool LifeMeterBar::IsDoingGreat() bool LifeMeterBar::IsAboutToFail() { - return m_fLifePercentage < 0.3f; + return m_fLifePercentage < ABOUT_TO_FAIL_THRESHOLD; } bool LifeMeterBar::HasFailed() @@ -86,7 +90,7 @@ void LifeMeterBar::Update( float fDeltaTime ) float fNewDelta = m_fLifePercentage - m_fTrailingLifePercentage; if( fDelta * fNewDelta < 0 ) // the deltas have different signs - m_fLifeVelocity /= 4; + m_fLifeVelocity /= 4; // make some drag m_fTrailingLifePercentage = clamp( m_fTrailingLifePercentage, 0, 1 ); } diff --git a/stepmania/src/MenuElements.cpp b/stepmania/src/MenuElements.cpp index d2d6d8e640..63da1bb5e4 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( "PRESENT" ); + m_textCreditInfo[p].SetText( "" ); else // not enabled - m_textCreditInfo[p].SetText( "CREDIT(S): 0 / 0" ); + m_textCreditInfo[p].SetText( "NOT PRESENT" ); m_textCreditInfo[p].SetZoom( 0.5f ); diff --git a/stepmania/src/MenuInput.h b/stepmania/src/MenuInput.h index 7ed78672ae..bcab3a861e 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_NONE + MENU_BUTTON_INVALID }; @@ -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_NONE; }; + inline bool IsBlank() const { return player == PLAYER_INVALID; }; inline bool IsValid() const { return !IsBlank(); }; - inline void MakeBlank() { player = PLAYER_NONE; button = MENU_BUTTON_NONE; }; + inline void MakeBlank() { player = PLAYER_INVALID; button = MENU_BUTTON_INVALID; }; }; diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 2ff353daa8..3b40ec7165 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -23,7 +23,11 @@ const float FADE_TIME = 1.0f; -const float SWITCH_MUSIC_TIME = 0.3f; +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 SORT_ICON_ON_SCREEN_X = -140; const float SORT_ICON_ON_SCREEN_Y = -180; @@ -51,6 +55,8 @@ D3DXCOLOR SECTION_COLORS[] = { }; const int NUM_SECTION_COLORS = sizeof(SECTION_COLORS)/sizeof(D3DXCOLOR); + + inline D3DXCOLOR GetNextSectionColor() { static int i=0; @@ -58,8 +64,6 @@ inline D3DXCOLOR GetNextSectionColor() return SECTION_COLORS[i++]; } - - WheelItemData::WheelItemData() { m_pSong = NULL; @@ -325,12 +329,15 @@ MusicWheel::MusicWheel() this->AddActor( &m_ScrollBar ); - m_soundChangeMusic.Load( THEME->GetPathTo(SOUND_SELECT_MUSIC_CHANGE_MUSIC), 10 ); + m_soundChangeMusic.Load( THEME->GetPathTo(SOUND_SELECT_MUSIC_CHANGE_MUSIC), 16 ); m_soundChangeSort.Load( THEME->GetPathTo(SOUND_SELECT_MUSIC_CHANGE_SORT) ); m_soundExpand.Load( THEME->GetPathTo(SOUND_SELECT_MUSIC_SECTION_EXPAND) ); - m_soundExpand.Load( THEME->GetPathTo(SOUND_MENU_START) ); + m_soundStart.Load( THEME->GetPathTo(SOUND_MENU_START) ); + m_soundLocked.Load( THEME->GetPathTo(SOUND_SELECT_MUSIC_WHEEL_LOCKED) ); + m_fTimeLeftBeforePlayMusicSample = 0; + // init m_mapGroupNameToBannerColor CArray arraySongs; @@ -349,10 +356,11 @@ MusicWheel::MusicWheel() m_iSelection = 0; - m_WheelState = STATE_IDLE; - m_fTimeLeftInState = FADE_TIME; + m_WheelState = STATE_SELECTING_MUSIC; + m_fTimeLeftInState = 0; m_fPositionOffsetFromSelection = 0; + m_iSwitchesLeftInSpinDown = 0; // build all of the wheel item datas for( int so=0; soGetTimeSinceStart()-fDeltaTime, SWITCH_MUSIC_TIME ); - float fNewMod = fmodf( TIMER->GetTimeSinceStart(), SWITCH_MUSIC_TIME ); - if( fNewMod < fOldMod ) // wrapped - NextMusic(); + NextMusic(); // spin as fast as possible + } + + if( m_fTimeLeftBeforePlayMusicSample > 0 ) + { + m_fTimeLeftBeforePlayMusicSample -= fDeltaTime; + if( m_fTimeLeftBeforePlayMusicSample < 0 ) + SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 ); } // update wheel state @@ -721,10 +735,6 @@ 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; @@ -779,46 +789,112 @@ void MusicWheel::Update( float fDeltaTime ) break; case STATE_FLYING_ON_AFTER_NEXT_SORT: SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 ); - m_WheelState = STATE_IDLE; // now, wait for input + m_WheelState = STATE_SELECTING_MUSIC; // now, wait for input break; case STATE_TWEENING_ON_SCREEN: SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 ); - m_WheelState = STATE_IDLE; + m_WheelState = STATE_SELECTING_MUSIC; m_fTimeLeftInState = 0; break; case STATE_TWEENING_OFF_SCREEN: m_WheelState = STATE_WAITING_OFF_SCREEN; m_fTimeLeftInState = 0; break; - case STATE_IDLE: + case STATE_SELECTING_MUSIC: m_fTimeLeftInState = 0; break; + case STATE_ROULETTE_SPINNING: + break; + case STATE_WAITING_OFF_SCREEN: + break; + case STATE_LOCKED: + break; case STATE_ROULETTE_SLOWING_DOWN: - m_WheelState = STATE_IDLE; - m_fTimeLeftInState = 0; + 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 break; } } - // "rotate" wheel toward selected song - if( fabsf(m_fPositionOffsetFromSelection) < 0.02f ) - m_fPositionOffsetFromSelection = 0; + 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; + } + } else { - m_fPositionOffsetFromSelection -= fDeltaTime * m_fPositionOffsetFromSelection*4; // linear - float fSign = m_fPositionOffsetFromSelection / fabsf(m_fPositionOffsetFromSelection); - m_fPositionOffsetFromSelection -= fDeltaTime * fSign; // constant + // "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 ); } } 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_IDLE: - case STATE_SWITCHING_MUSIC: + case STATE_SELECTING_MUSIC: case STATE_ROULETTE_SPINNING: case STATE_ROULETTE_SLOWING_DOWN: break; // fall through @@ -843,21 +919,29 @@ 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_IDLE: - case STATE_SWITCHING_MUSIC: + case STATE_SELECTING_MUSIC: case STATE_ROULETTE_SPINNING: case STATE_ROULETTE_SLOWING_DOWN: break; // fall through default: + LOG->WriteLine( "NextMusic() ignored" ); return; // don't continue } @@ -878,8 +962,6 @@ void MusicWheel::NextMusic() m_fPositionOffsetFromSelection += 1; - m_WheelState = STATE_SWITCHING_MUSIC; - m_fTimeLeftInState = SWITCH_MUSIC_TIME; m_soundChangeMusic.Play(); } @@ -892,8 +974,7 @@ void MusicWheel::NextSort() { switch( m_WheelState ) { - case STATE_IDLE: - case STATE_SWITCHING_MUSIC: + case STATE_SELECTING_MUSIC: case STATE_FLYING_ON_AFTER_NEXT_SORT: break; // fall through default: @@ -914,10 +995,13 @@ 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_fTimeLeftInState = 20; + m_iSwitchesLeftInSpinDown = ROULETTE_SWITCHES_IN_SLOWING_DOWN; + m_fTimeLeftInState = 0.1f; return false; } diff --git a/stepmania/src/MusicWheel.h b/stepmania/src/MusicWheel.h index 41074af1ce..760e088fd4 100644 --- a/stepmania/src/MusicWheel.h +++ b/stepmania/src/MusicWheel.h @@ -131,6 +131,7 @@ protected: MusicSortDisplay m_MusicSortDisplay; ActorFrame m_frameOverlay; + // Actors inside of m_frameOverlay Sprite m_sprSelectionOverlay; Sprite m_sprHighScoreFrame[NUM_PLAYERS]; @@ -145,10 +146,12 @@ 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_IDLE, - STATE_SWITCHING_MUSIC, + STATE_SELECTING_MUSIC, STATE_FLYING_OFF_BEFORE_NEXT_SORT, STATE_FLYING_ON_AFTER_NEXT_SORT, STATE_TWEENING_ON_SCREEN, @@ -168,6 +171,7 @@ 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 40141831f8..f448081d7c 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -21,6 +21,11 @@ NoteData::NoteData() +{ + Init(); +} + +void NoteData::Init() { memset( m_TapNotes, '0', MAX_NOTE_TRACKS*MAX_TAP_NOTE_ROWS ); m_iNumTracks = 0; @@ -176,6 +181,24 @@ void NoteData::RemoveHoldNote( int index ) m_iNumHoldNotes--; } +bool NoteData::IsThereANoteAtRow( int iRow ) +{ + for( int t=0; t= fHoldStartBeat && fStartBeat < fEndBeat ) - iNumSteps++; - + HoldNote &hn = m_HoldNotes[i]; + if( iStartIndex <= hn.m_iStartIndex && hn.m_iEndIndex <= iEndIndex ) + iNumHolds++; } - return iNumSteps; + return iNumHolds; } int NoteData::GetPossibleDancePoints() @@ -708,8 +730,9 @@ float NoteData::GetStreamRadarValue( float fSongSeconds ) { // density of steps int iNumNotes = GetNumTapNotes() + GetNumHoldNotes(); - float fBeatsPerSecond = iNumNotes/fSongSeconds; - return fBeatsPerSecond / 5; + float fNotesPerSecond = iNumNotes/fSongSeconds; + float fReturn = fNotesPerSecond / 5; + return min( fReturn, 1.2f ); } float NoteData::GetVoltageRadarValue( float fSongSeconds ) @@ -729,26 +752,30 @@ float NoteData::GetVoltageRadarValue( float fSongSeconds ) fMaxDensityPerSecSoFar = fDensityPerSecThisMeasure; } - return fMaxDensityPerSecSoFar; + float fReturn = fMaxDensityPerSecSoFar*10; + return min( fReturn, 1.2f ); } float NoteData::GetAirRadarValue( float fSongSeconds ) { // number of doubles int iNumDoubles = GetNumDoubles(); - return iNumDoubles / fSongSeconds * 2; + float fReturn = iNumDoubles / fSongSeconds * 2; + return min( fReturn, 1.2f ); } float NoteData::GetChaosRadarValue( float fSongSeconds ) { // irregularity of steps - return fabsf( GetStreamRadarValue(fSongSeconds) - GetVoltageRadarValue(fSongSeconds) ); + float fReturn = fabsf( GetStreamRadarValue(fSongSeconds) - GetVoltageRadarValue(fSongSeconds) ) * 2.5f; + return min( fReturn, 1.2f ); } float NoteData::GetFreezeRadarValue( float fSongSeconds ) { // number of hold steps - return GetNumHoldNotes() / fSongSeconds * 10; + float fReturn = GetNumHoldNotes() / fSongSeconds * 3; + return min( fReturn, 1.2f ); } diff --git a/stepmania/src/NoteData.h b/stepmania/src/NoteData.h index 498a428e78..9e050b8baf 100644 --- a/stepmania/src/NoteData.h +++ b/stepmania/src/NoteData.h @@ -21,33 +21,7 @@ // ... 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 @@ -57,28 +31,10 @@ 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 BeatToNoteIndexNotRounded( float fBeatNum ){ return (int)( fBeatNum * ELEMENTS_PER_BEAT ); }; -inline float NoteRowToBeat( float fNoteIndex ) { return fNoteIndex / (float)ELEMENTS_PER_BEAT; }; +inline int BeatToNoteRowNotRounded( 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 ); }; @@ -88,6 +44,7 @@ class NoteData { public: NoteData(); + void Init(); ~NoteData(); // used for loading @@ -109,7 +66,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; CopyRange( pFrom, 0, MAX_TAP_NOTE_ROWS ); }; + void CopyAll( NoteData* pFrom ) { m_iNumTracks = pFrom->m_iNumTracks; m_iNumHoldNotes = 0; CopyRange( pFrom, 0, MAX_TAP_NOTE_ROWS ); }; inline bool IsRowEmpty( int index ) { @@ -124,6 +81,7 @@ 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 ); @@ -140,16 +98,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_CHAOS: return GetChaosRadarValue( fSongSeconds ); break; case RADAR_FREEZE: return GetFreezeRadarValue( fSongSeconds ); break; + case RADAR_CHAOS: return GetChaosRadarValue( fSongSeconds ); break; default: ASSERT(0); return 0; } }; float GetStreamRadarValue( float fSongSeconds ); float GetVoltageRadarValue( float fSongSeconds ); float GetAirRadarValue( float fSongSeconds ); - float GetChaosRadarValue( float fSongSeconds ); float GetFreezeRadarValue( float fSongSeconds ); + float GetChaosRadarValue( float fSongSeconds ); // Transformations void LoadTransformed( NoteData* pOriginal, int iNewNumTracks, int iNewToOriginalTrack[] ); diff --git a/stepmania/src/NoteDataWithScoring.cpp b/stepmania/src/NoteDataWithScoring.cpp new file mode 100644 index 0000000000..125f7967e3 --- /dev/null +++ b/stepmania/src/NoteDataWithScoring.cpp @@ -0,0 +1,147 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: NoteDataWithScoring + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "NoteDataWithScoring.h" + + + +NoteDataWithScoring::NoteDataWithScoring() +{ + Init(); +} + +void NoteDataWithScoring::Init() +{ + // init step elements + for( int t=0; t= TNS_GREAT ) + iNumSuccessfulTapNotes++; + } + } + + return iNumSuccessfulTapNotes; +} + +int NoteDataWithScoring::GetNumSuccessfulDoubles( const float fStartBeat, const float fEndBeat ) +{ + int iNumSuccessfulDoubles = 0; + + int iStartIndex = BeatToNoteRow( fStartBeat ); + int iEndIndex = BeatToNoteRow( fEndBeat ); + + for( int i=iStartIndex; i= 2 && minTapNoteScore >= TNS_GREAT ) + iNumSuccessfulDoubles++; + } + + return iNumSuccessfulDoubles; +} + +int NoteDataWithScoring::GetNumSuccessfulHoldNotes( const float fStartBeat, const float fEndBeat ) +{ + int iNumSuccessfulHolds = 0; + + int iStartIndex = BeatToNoteRow( fStartBeat ); + int iEndIndex = BeatToNoteRow( fEndBeat ); + + for( int i=0; i fMaxDensityPerSecSoFar ) + fMaxDensityPerSecSoFar = fDensityPerSecThisMeasure; + } + + float fReturn = fMaxDensityPerSecSoFar*10; + return min( fReturn, 1.2f ); +} + +float NoteDataWithScoring::GetActualAirRadarValue( float fSongSeconds ) +{ + // number of doubles + int iNumDoubles = GetNumSuccessfulDoubles(); + float fReturn = iNumDoubles / fSongSeconds * 2; + return min( fReturn, 1.2f ); +} + +float NoteDataWithScoring::GetActualChaosRadarValue( float fSongSeconds ) +{ + // irregularity of steps + float fReturn = fabsf( GetActualStreamRadarValue(fSongSeconds) - GetActualVoltageRadarValue(fSongSeconds) ) * 2.5f; + return min( fReturn, 1.2f ); +} + +float NoteDataWithScoring::GetActualFreezeRadarValue( float fSongSeconds ) +{ + // number of hold steps + float fReturn = GetNumSuccessfulHoldNotes() / fSongSeconds * 3; + return min( fReturn, 1.2f ); +} diff --git a/stepmania/src/NoteDataWithScoring.h b/stepmania/src/NoteDataWithScoring.h new file mode 100644 index 0000000000..ca81bab457 --- /dev/null +++ b/stepmania/src/NoteDataWithScoring.h @@ -0,0 +1,50 @@ +#pragma once +/* +----------------------------------------------------------------------------- + Class: NoteDataWithScoring + + Desc: NoteData with scores for each TapNote and HoldNote + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "GameConstantsAndTypes.h" +#include "NoteData.h" + +struct NoteDataWithScoring : public NoteData +{ + NoteDataWithScoring(); + void Init(); + + // maintain this extra data in addition to the NoteData + TapNoteScore m_TapNoteScores[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ROWS]; + HoldNoteScore m_HoldNoteScores[MAX_HOLD_NOTE_ELEMENTS]; + + + // statistics + int GetNumSuccessfulTapNotes( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS ); + int GetNumSuccessfulDoubles( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS ); + int GetNumSuccessfulHoldNotes( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS ); + + + float GetActualRadarValue( RadarCatrgory rv, float fSongSeconds ) + { + switch( rv ) + { + case RADAR_STREAM: return GetActualStreamRadarValue( fSongSeconds ); break; + case RADAR_VOLTAGE: return GetActualVoltageRadarValue( fSongSeconds ); break; + case RADAR_AIR: return GetActualAirRadarValue( fSongSeconds ); break; + case RADAR_FREEZE: return GetActualFreezeRadarValue( fSongSeconds ); break; + case RADAR_CHAOS: return GetActualChaosRadarValue( fSongSeconds ); break; + default: ASSERT(0); return 0; + } + }; + float GetActualStreamRadarValue( float fSongSeconds ); + float GetActualVoltageRadarValue( float fSongSeconds ); + float GetActualAirRadarValue( float fSongSeconds ); + float GetActualFreezeRadarValue( float fSongSeconds ); + float GetActualChaosRadarValue( float fSongSeconds ); +}; + diff --git a/stepmania/src/NoteField.cpp b/stepmania/src/NoteField.cpp index 5d20f78d22..933d7e8138 100644 --- a/stepmania/src/NoteField.cpp +++ b/stepmania/src/NoteField.cpp @@ -237,8 +237,7 @@ void NoteField::DrawPrimitives() const int iCol = hn.m_iTrack; const float fHoldNoteLife = m_HoldNoteLife[i]; - const bool bActive = NoteRowToBeat(hn.m_iStartIndex) > m_fSongBeat && m_fSongBeat < NoteRowToBeat(hn.m_iEndIndex); - + 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 // 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 0568532f9c..81ab46b32a 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -1,11 +1,12 @@ #include "stdafx.h" /* ----------------------------------------------------------------------------- - Class: Notes + Class: Player Desc: See header. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ @@ -29,28 +30,27 @@ 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.27f; +const float HOLD_ARROW_NG_TIME = 0.18f; Player::Player() { m_fSongBeat = 0; - m_PlayerNumber = PLAYER_NONE; + m_PlayerNumber = PLAYER_INVALID; // init step elements - for( int i=0; iWriteLine( "Player::Load()", ); + + NoteData::Init(); + NoteDataWithScoring::Init(); + // init step elements + for( int i=0; iCopyAll( pNoteData ); m_PlayerNumber = player_no; @@ -83,7 +90,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(), SONGMAN->GetCurrentNotes(player_no)->m_iMeter ); + m_pScore->Init( player_no, m_PlayerOptions, pNoteData->GetNumTapNotes(), iMeter ); if( !po.m_bHoldNotes ) this->RemoveHoldNotes(); @@ -95,12 +102,6 @@ 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 ); @@ -108,8 +109,10 @@ 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++ ) m_HoldJudgement[c].SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - HOLD_JUDGEMENT_Y : HOLD_JUDGEMENT_Y ); + for( 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 ); @@ -120,7 +123,8 @@ 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 // @@ -142,7 +146,6 @@ 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 ); @@ -150,9 +153,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 ); + const bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI ) || PREFSMAN->m_bAutoPlay; // if they got a bad score or haven't stepped on the corresponding tap yet - const bool bSteppedOnTapNote = m_TapNoteScores[hn.m_iStartIndex] >= TNS_GREAT; + const bool bSteppedOnTapNote = m_TapNoteScores[hn.m_iTrack][hn.m_iStartIndex] >= TNS_GREAT; if( bIsHoldingButton && bSteppedOnTapNote ) @@ -161,9 +164,11 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference fLife += fDeltaTime/HOLD_ARROW_NG_TIME; fLife = min( fLife, 1 ); // clamp - m_NoteField.m_HoldNotes[i].m_iStartIndex = BeatToNoteRow( m_fSongBeat ); // move the start of this Hold + 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_GhostArrowRow.HoldNote( iCol ); // update the "electric ghost" effect + m_GhostArrowRow.HoldNote( hn.m_iTrack ); // update the "electric ghost" effect } else // !bIsHoldingButton { @@ -181,7 +186,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[iCol].SetHoldJudgement( HNS_NG ); + m_HoldJudgement[hn.m_iTrack].SetHoldJudgement( HNS_NG ); } // check for OK @@ -190,7 +195,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[iCol].SetHoldJudgement( HNS_OK ); + m_HoldJudgement[hn.m_iTrack].SetHoldJudgement( HNS_OK ); m_NoteField.SetHoldNoteLife( i, fLife ); // update the NoteField display } } @@ -206,9 +211,6 @@ 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() @@ -260,26 +262,6 @@ void Player::DrawPrimitives() m_HoldJudgement[c].Draw(); } -bool Player::IsThereANoteAtIndex( int iIndex ) -{ - for( int t=0; tWriteLine( "Player::HandlePlayerStep()" ); @@ -288,13 +270,6 @@ 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 ); @@ -304,7 +279,7 @@ void Player::CheckForCompleteRow( 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 that overlaps the player's step is the closest match. + // Start at iIndexStartLookingAt and search outward. The first one note overlaps the player's hit (this is the closest match). for( int delta=0; delta <= iNumElementsToExamine; delta++ ) { int iCurrentIndexEarlier = iIndexStartLookingAt - delta; @@ -318,7 +293,8 @@ void Player::CheckForCompleteRow( 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' ) // these Notes overlap + if( m_TapNotes[col][iCurrentIndexEarlier] != '0' && // there is a note here + m_TapNoteScores[col][iCurrentIndexEarlier] == TNS_NONE ) // this note doesn't have a score { iIndexOverlappingNote = iCurrentIndexEarlier; break; @@ -329,7 +305,8 @@ void Player::CheckForCompleteRow( 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' ) // these Notes overlap + if( m_TapNotes[col][iCurrentIndexLater] != '0' && // there is a note here + m_TapNoteScores[col][iCurrentIndexLater] == TNS_NONE ) // this note doesn't have a score { iIndexOverlappingNote = iCurrentIndexLater; break; @@ -338,13 +315,28 @@ void Player::CheckForCompleteRow( float fSongBeat, int col, float fMaxBeatDiff ) if( iIndexOverlappingNote != -1 ) { - m_TapNotes[col][iIndexOverlappingNote] = '0'; // mark hit - + // 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; + + bool bRowDestroyed = true; for( int t=0; tWriteLine( "fBeatsUntilStep: %f, fPercentFromPerfect: %f", // fBeatsUntilStep, fPercentFromPerfect ); - - // 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; + + // 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] ); // update the judgement, score, and life m_Judgement.SetJudgement( score ); @@ -383,14 +367,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 ); @@ -482,17 +418,19 @@ int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ) int iStartCheckingAt = max( 0, iMissIfOlderThanThisIndex-10 ); //LOG->WriteLine( "iStartCheckingAt: %d iMissIfOlderThanThisIndex: %d", iStartCheckingAt, iMissIfOlderThanThisIndex ); - for( int i=iStartCheckingAt; iIsRowEmpty( i ) ) + for( int r=iStartCheckingAt; rChangeLife( TNS_MISS ); + 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 ); } } @@ -506,8 +444,76 @@ 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 1ffb7f1260..3c10748fdf 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -31,11 +31,13 @@ #include "NoteField.h" #include "GrayArrowRow.h" #include "GhostArrowRow.h" +#include "NoteDataWithScoring.h" struct GameplayStatistics; -class Player : public NoteData, public ActorFrame + +class Player : public NoteDataWithScoring, public ActorFrame { public: Player(); @@ -43,33 +45,27 @@ public: void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference ); void DrawPrimitives(); - void Load( PlayerNumber player_no, StyleDef *pStyleDef, NoteData* pNoteData, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore ); - void CrossedIndex( int iIndex ); + 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 HandlePlayerStep( float fSongBeat, int col, float fMaxBeatDiff ); int UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ); - void GetGameplayStatistics( GameplayStatistics& GSout ); + GameplayStatistics GetGameplayStatistics( Song* pSong, Notes* pNotes ); - 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 3c43162a6c..0fd1588c2d 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -29,12 +29,13 @@ PrefsManager::PrefsManager() m_bAnnouncer = true; m_bEventMode = true; m_iNumArcadeStages = 3; - m_iDifficulty = 4; + m_bAutoPlay = false; + m_fJudgeWindow = 0.10f; for( int p=0; pGetStageNumber(), sNumberSuffix ); + return ssprintf( "%d%s", iStageNo, sNumberSuffix ); +} + +D3DXCOLOR PrefsManager::GetStageColor() +{ + if( IsFinalStage() ) + return D3DXCOLOR(1,0.1f,0.1f,1); // red + else if( IsExtraStage() || IsExtraStage2() ) + return D3DXCOLOR(1,1,0.3f,1); // yellow + else + return D3DXCOLOR(0.3f,1,0.3f,1); // green } diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 45773548e4..599c5c9973 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -33,7 +33,8 @@ public: bool m_bAnnouncer; bool m_bEventMode; int m_iNumArcadeStages; - int m_iDifficulty; + bool m_bAutoPlay; + float m_fJudgeWindow; void ReadPrefsFromDisk(); void SavePrefsToDisk(); @@ -46,9 +47,11 @@ 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 b1f2ffac0e..b3c78e8a95 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -25,13 +25,14 @@ 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,5) ) - throw RageException( "BASS version 1.5 DLL could not be loaded. Verify that Bass.dll exists in the program directory."); + 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_Init( -1, 44100, BASS_DEVICE_LEAVEVOL|BASS_DEVICE_LATENCY, m_hWndApp ) ) { @@ -72,6 +73,8 @@ RageSound::RageSound( HWND hWnd ) RageSound::~RageSound() { + LOG->WriteLine( "RageSound::~RageSound()" ); + BASS_Stop(); BASS_Free(); } @@ -85,7 +88,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 6e69a53eeb..d3ec054aa3 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, PlayerOptions(), NULL, NULL ); + m_Player.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), ¬eData, 1, 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 = BeatToNoteIndexNotRounded( m_fBeat ); + int iIndexNow = BeatToNoteRowNotRounded( 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, PlayerOptions(), NULL, NULL ); + m_Player.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), (NoteData*)&m_NoteFieldEdit, 1, PlayerOptions(), NULL, NULL ); m_rectRecordBack.BeginTweening( 0.5f ); m_rectRecordBack.SetTweenDiffuseColor( D3DXCOLOR(0,0,0,0.5f) ); diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index e4f5f11de2..9ccdeb5fe8 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -43,13 +43,15 @@ 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 MAX_SECONDS_CAN_BE_OFF_BY = 0.25f; +const float DEBUG_X = CENTER_X; +const float DEBUG_Y = CENTER_Y-70; const float TIME_BETWEEN_DANCING_COMMENTS = 15; // received while STATE_DANCING -const ScreenMessage SM_SongEnded = ScreenMessage(SM_User+102); +const ScreenMessage SM_PlayMusic = ScreenMessage(SM_User+101); +const ScreenMessage SM_MusicEnded = ScreenMessage(SM_User+102); const ScreenMessage SM_LifeIs0 = ScreenMessage(SM_User+103); @@ -62,7 +64,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); @@ -71,6 +73,8 @@ ScreenGameplay::ScreenGameplay() LOG->WriteLine( "ScreenGameplay::ScreenGameplay()" ); m_pCurSong = NULL; + for( int p=0; pm_PlayMode ) { @@ -106,7 +110,7 @@ ScreenGameplay::ScreenGameplay() - for( int p=0; pIsPlayerEnabled(PlayerNumber(p)) ) continue; @@ -150,12 +154,8 @@ ScreenGameplay::ScreenGameplay() m_textStageNumber.Load( THEME->GetPathTo(FONT_HEADER2) ); m_textStageNumber.TurnShadowOff(); m_textStageNumber.SetXY( STAGE_NUMBER_LOCAL_X, STAGE_NUMBER_LOCAL_Y ); - 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_textStageNumber.SetText( PREFSMAN->GetStageText() ); + m_textStageNumber.SetDiffuseColor( PREFSMAN->GetStageColor() ); m_frameTop.AddActor( &m_textStageNumber ); @@ -178,6 +178,7 @@ 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) ); @@ -207,9 +208,13 @@ 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(); @@ -262,18 +267,38 @@ 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); - Notes* pNotes[NUM_PLAYERS]; + SaveSummary(); + + m_pCurSong = m_apSongQueue[0]; + m_apSongQueue.RemoveAt(0); + for( p=0; pIsPlayerEnabled(PlayerNumber(p)) ) continue; - m_DifficultyBanner[p].SetFromNotes( PlayerNumber(p), pNotes[p] ); + m_DifficultyBanner[p].SetFromNotes( PlayerNumber(p), m_pCurNotes[p] ); - NoteData* pOriginalNoteData = pNotes[p]->GetNoteData(); + NoteData* pOriginalNoteData = m_pCurNotes[p]->GetNoteData(); NoteData newNoteData; pStyleDef->GetTransformedNoteDataForStyle( (PlayerNumber)p, pOriginalNoteData, newNoteData ); @@ -297,6 +322,7 @@ void ScreenGameplay::LoadNextSong() (PlayerNumber)p, GAMEMAN->GetCurrentStyleDef(), &newNoteData, + m_pCurNotes[p]->m_iMeter, PREFSMAN->m_PlayerOptions[p], &m_LifeMeter[p], &m_ScoreDisplay[p] @@ -304,6 +330,8 @@ 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) ); @@ -318,6 +346,10 @@ void ScreenGameplay::Update( float fDeltaTime ) Screen::Update( fDeltaTime ); + if( m_pCurSong == NULL ) + return; + + float fSongBeat, fBPS; float fPositionSeconds = m_soundMusic.GetPositionSeconds(); @@ -328,7 +360,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() ); - float fMaxBeatDifference = fBPS*MAX_SECONDS_CAN_BE_OFF_BY; + const float fMaxBeatDifference = fBPS * PREFSMAN->m_fJudgeWindow * PREFSMAN->m_SongOptions.m_fMusicRate; for( int p=0; pSendScreenMessage( SM_SongEnded, 1 ); - + m_soundMusic.GetLengthSeconds() - m_soundMusic.GetPositionSeconds() < 0.5f ) + { + this->SendScreenMessage( SM_MusicEnded, 0 ); + } + // Check to see if it's time to play a gameplay comment if( PREFSMAN->m_bAnnouncer ) { @@ -408,31 +438,52 @@ 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 iIndexNow = BeatToNoteIndexNotRounded( fSongBeat ); - static int iIndexLastCrossed = 0; + int iRowNow = BeatToNoteRowNotRounded( fSongBeat ); + static int iRowLastCrossed = 0; bool bAnyoneHasANote = false; // set this to true if any player has a note at one of the indicies we crossed - for( int i=iIndexLastCrossed+1; i<=iIndexNow; i++ ) // for each index we crossed since the last update + 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 - bAnyoneHasANote |= m_Player[p].IsThereANoteAtIndex( i ); + m_Player[p].CrossedRow( r, fSongBeat, fMaxBeatDifference ); + bAnyoneHasANote |= m_Player[p].IsThereANoteAtRow( r ); break; // this will only play the tick for the first player that is joined } } @@ -441,7 +492,7 @@ void ScreenGameplay::Update( float fDeltaTime ) m_soundAssistTick.PlayRandom(); - iIndexLastCrossed = iIndexNow; + iRowLastCrossed = iRowNow; } } @@ -460,6 +511,44 @@ 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() ) { @@ -478,14 +567,14 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ } } - float fMaxBeatsCanBeOffBy = MAX_SECONDS_CAN_BE_OFF_BY * fBPS; + const float fMaxBeatDifference = fBPS * PREFSMAN->m_fJudgeWindow * PREFSMAN->m_SongOptions.m_fMusicRate; if( type == IET_FIRST_PRESS ) { if( StyleI.IsValid() ) { if( GAMEMAN->IsPlayerEnabled( StyleI.player ) ) - m_Player[StyleI.player].HandlePlayerStep( fSongBeat, StyleI.col, fMaxBeatsCanBeOffBy ); + m_Player[StyleI.player].HandlePlayerStep( fSongBeat, StyleI.col, fMaxBeatDifference ); } } } @@ -515,8 +604,6 @@ 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; @@ -535,21 +622,33 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) this->SendScreenMessage( SM_BeginFailed, 0 ); m_DancingState = STATE_OUTRO; break; - case SM_SongEnded: + + case SM_PlayMusic: + m_soundMusic.Play(); + m_soundMusic.SetPlaybackRate( PREFSMAN->m_SongOptions.m_fMusicRate ); + break; + case SM_MusicEnded: if( m_DancingState == STATE_OUTRO ) // gameplay already ended return; // ignore - if( m_bBothHaveFailed ) // fail them + if( m_apSongQueue.GetSize() > 0 ) { - this->SendScreenMessage( SM_BeginFailed, 0 ); + LoadNextSong(); } - else // cleared + else { - m_StarWipe.CloseWipingRight( SM_ShowCleared ); - if( PREFSMAN->m_bAnnouncer ) - m_announcerCleared.PlayRandom(); // crowd cheer + 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_DancingState = STATE_OUTRO; break; // received while STATE_OUTRO @@ -562,16 +661,8 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) SCREENMAN->SendMessageToTopScreen( SM_GoToResults, 1 ); break; case SM_GoToResults: - { - // 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) ); - } + SaveSummary(); + SCREENMAN->SetNewScreen( new ScreenResults(false) ); break; diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index fd8769f8c7..cc4ced81be 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -47,14 +47,16 @@ public: private: void TweenOnScreen(); void TweenOffScreen(); + void SaveSummary(); void LoadNextSong(); DancingState m_DancingState; - 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 + 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 bool m_bBothHaveFailed; float m_fTimeLeftBeforeDancingComment; // this counter is only running while STATE_DANCING @@ -62,19 +64,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 d81512c855..bcc4fdb5ee 100644 --- a/stepmania/src/ScreenMusicScroll.cpp +++ b/stepmania/src/ScreenMusicScroll.cpp @@ -82,8 +82,9 @@ const CString CREDIT_LINES[] = "SPECIAL THANKS TO:", "SimWolf", "Dance With Intensity", - "DDR Llama", - "DDRManiaX", + "DDRLlama", + "AngelTK", + "www.ddrmaniax.net", "Lagged", "The Melting Pot", "DDRJamz Global BBS", @@ -108,10 +109,8 @@ const CString CREDIT_LINES[] = "", "", "If your name is missing from this list,", - "", - " I apologize!", - "", - " -Chris" + " send me an e-mail!", + " -Chris" }; const int NUM_CREDIT_LINES = sizeof(CREDIT_LINES) / sizeof(CString); @@ -156,12 +155,12 @@ ScreenMusicScroll::ScreenMusicScroll() { m_textLines[i].SetZoom( 0.7f ); m_textLines[i].SetXY( CENTER_X, SCREEN_BOTTOM + 40 ); - m_textLines[i].BeginTweeningQueued( 0.20f * i ); - m_textLines[i].BeginTweeningQueued( 2.0f ); + m_textLines[i].BeginTweeningQueued( 0.30f * i ); + m_textLines[i].BeginTweeningQueued( 3.0f ); m_textLines[i].SetTweenXY( CENTER_X, SCREEN_TOP - 40 ); } - this->SendScreenMessage( SM_StartFadingOut, 0.20f * i + 3.0f ); + this->SendScreenMessage( SM_StartFadingOut, 0.30f * i + 3.0f ); this->AddActor( &m_Fade ); diff --git a/stepmania/src/ScreenSelectCourse.cpp b/stepmania/src/ScreenSelectCourse.cpp index 04b840c8ab..bdd958bcdb 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_NONE ) + if( MenuI.player == PLAYER_INVALID ) 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(false) ); + SCREENMAN->SetNewScreen( new ScreenStage ); } break; } @@ -198,32 +198,38 @@ void ScreenSelectCourse::MenuRight( const PlayerNumber p, const InputEventType t void ScreenSelectCourse::MenuStart( const PlayerNumber p ) { // this needs to check whether valid Notes are selected! - m_MusicWheel.Select(); + bool bChoseACourse = m_MusicWheel.Select(); - switch( m_MusicWheel.GetSelectedType() ) + + if( bChoseACourse ) { - case TYPE_COURSE: - SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_MUSIC_COMMENT_GENERAL) ); - - TweenOffScreen(); + switch( m_MusicWheel.GetSelectedType() ) + { + case TYPE_COURSE: + SONGMAN->m_pCurCourse = m_MusicWheel.GetSelectedCourse(); - m_soundSelect.PlayRandom(); + SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_MUSIC_COMMENT_GENERAL) ); - // 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 ); + TweenOffScreen(); - m_Menu.TweenOffScreenToBlack( SM_None, false ); + m_soundSelect.PlayRandom(); - this->SendScreenMessage( SM_GoToNextState, 2.5f ); - - break; + // 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; + } } } diff --git a/stepmania/src/ScreenSelectDifficulty.cpp b/stepmania/src/ScreenSelectDifficulty.cpp index aa7adb2f99..d6f6daf2b6 100644 --- a/stepmania/src/ScreenSelectDifficulty.cpp +++ b/stepmania/src/ScreenSelectDifficulty.cpp @@ -72,6 +72,10 @@ ScreenSelectDifficulty::ScreenSelectDifficulty() { LOG->WriteLine( "ScreenSelectDifficulty::ScreenSelectDifficulty()" ); + // Reset the current PlayMode + PREFSMAN->m_PlayMode = PLAY_MODE_INVALID; + + int p; m_Menu.Load( @@ -207,11 +211,22 @@ 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/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index e30dafa168..edab999261 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_NONE ) + if( MenuI.player == PLAYER_INVALID ) return; if( m_Menu.IsClosing() ) @@ -323,7 +323,7 @@ void ScreenSelectMusic::HandleScreenMessage( const ScreenMessage SM ) { MUSIC->Stop(); - SCREENMAN->SetNewScreen( new ScreenStage(false) ); + SCREENMAN->SetNewScreen( new ScreenStage ); } break; case SM_PlaySongSample: @@ -350,64 +350,69 @@ void ScreenSelectMusic::MenuRight( const PlayerNumber p, const InputEventType ty void ScreenSelectMusic::MenuStart( const PlayerNumber p ) { // this needs to check whether valid Notes are selected! - m_MusicWheel.Select(); + bool bResult = m_MusicWheel.Select(); - switch( m_MusicWheel.GetSelectedType() ) + if( bResult ) { - case TYPE_SONG: + // a song was selected + switch( m_MusicWheel.GetSelectedType() ) { - if( !m_MusicWheel.GetSelectedSong()->HasMusic() ) + case TYPE_SONG: { - SCREENMAN->AddScreenToTop( new ScreenPrompt( "ERROR:\n \nThis song does not have a music file\n and cannot be played.", PROMPT_OK) ); - return; + 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 ); } + break; + case TYPE_SECTION: + + break; + case TYPE_ROULETTE: - 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; } - break; - case TYPE_SECTION: - - break; - case TYPE_ROULETTE: - - break; } + } @@ -434,6 +439,14 @@ 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 e872580d6f..2339383039 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -47,6 +47,11 @@ ScreenSelectStyle::ScreenSelectStyle() { LOG->WriteLine( "ScreenSelectStyle::ScreenSelectStyle()" ); + + // Reset the current style and game + GAMEMAN->m_CurStyle = STYLE_NONE; + + for( int s=0; sStop(); @@ -210,7 +215,7 @@ void ScreenSelectStyle::MenuRight( const PlayerNumber p ) void ScreenSelectStyle::MenuStart( const PlayerNumber p ) { - if( p != PLAYER_NONE ) + if( p != PLAYER_INVALID ) GAMEMAN->m_sMasterPlayerNumber = p; GAMEMAN->m_CurStyle = GetSelectedStyle(); diff --git a/stepmania/src/ScreenStage.cpp b/stepmania/src/ScreenStage.cpp index 25d1d8f99b..265807080b 100644 --- a/stepmania/src/ScreenStage.cpp +++ b/stepmania/src/ScreenStage.cpp @@ -29,41 +29,48 @@ const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 1); const ScreenMessage SM_GoToNextState = ScreenMessage(SM_User + 3); -ScreenStage::ScreenStage( bool bTryExtraStage ) +ScreenStage::ScreenStage() { - m_bTryExtraStage = false; - m_textStage.Load( THEME->GetPathTo(FONT_STAGE) ); m_textStage.TurnShadowOff(); - if( bTryExtraStage ) + + if( PREFSMAN->IsExtraStage() ) { - m_textStage.SetText( "Try Extra Stage!" ); + 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.SetDiffuseColor( D3DXCOLOR(1,0.1f,0.1f,1) ); SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_EXTRA) ); } - else // !bTryExtraStage + else if( PREFSMAN->IsFinalStage() ) { - int iStageNo = PREFSMAN->GetStageNumber(); - bool bFinal = PREFSMAN->IsFinalStage(); - - CString sStagePrefix = PREFSMAN->GetStageText(); - m_textStage.SetText( sStagePrefix + " Stage" ); + 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" ); m_textStage.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - if( bFinal ) - SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_STAGE_FINAL) ); - else + const int iStageNo = PREFSMAN->GetStageIndex()+1; + switch( iStageNo ) { - 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; - } + 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 } + } + + 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 9d5f3bb75c..3c209e370f 100644 --- a/stepmania/src/ScreenStage.h +++ b/stepmania/src/ScreenStage.h @@ -17,7 +17,6 @@ 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 f658261350..537f73ea9d 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -95,7 +95,7 @@ ScreenTitleMenu::ScreenTitleMenu() m_textVersion.Load( THEME->GetPathTo(FONT_NORMAL) ); m_textVersion.SetHorizAlign( Actor::align_right ); - m_textVersion.SetText( "v3.0 compatibility test" ); + m_textVersion.SetText( "v3.0 public 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 ); diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 413fb181a0..275d54346e 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_CHAOS] = pNM->GetNoteData()->GetChaosRadarValue( fMusicLength ); pNM->m_fRadarValues[RADAR_FREEZE] = pNM->GetNoteData()->GetFreezeRadarValue( fMusicLength ); + pNM->m_fRadarValues[RADAR_CHAOS] = pNM->GetNoteData()->GetChaosRadarValue( fMusicLength ); } } diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index af8b32204d..6351df6bb8 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -77,7 +77,8 @@ void SongManager::SetCurrentNotes( PlayerNumber p, Notes* pNotes ) GameplayStatistics SongManager::GetLatestGameplayStatistics( PlayerNumber p ) { - return m_GameplayStatistics[ PREFSMAN->GetStageIndex() ][p]; + ASSERT( m_aGameplayStatistics[p].GetSize() > 0 ); + return m_aGameplayStatistics[p][ m_aGameplayStatistics[p].GetSize()-1 ]; } diff --git a/stepmania/src/SongManager.h b/stepmania/src/SongManager.h index 6c59a19b01..bf112cd7ea 100644 --- a/stepmania/src/SongManager.h +++ b/stepmania/src/SongManager.h @@ -14,12 +14,10 @@ #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 { @@ -32,7 +30,7 @@ public: Course* m_pCurCourse; CString m_sPreferredGroup; - GameplayStatistics m_GameplayStatistics[MAX_NUM_STAGES][NUM_PLAYERS]; // for passing from Dancing to Results + CArray m_aGameplayStatistics[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 d8fa16d2ec..3a414b7737 100644 --- a/stepmania/src/StepMania.RC +++ b/stepmania/src/StepMania.RC @@ -1,4 +1,4 @@ -// Microsoft Visual C++ generated resource script. +//Microsoft Developer Studio generated resource script. // #include "resource.h" @@ -27,18 +27,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE MOVEABLE PURE BEGIN "resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE MOVEABLE PURE BEGIN "#include ""afxres.h""\r\n" "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE MOVEABLE PURE BEGIN "\r\n" "\0" @@ -52,7 +52,7 @@ END // Accelerator // -IDR_MAIN_ACCEL ACCELERATORS +IDR_MAIN_ACCEL ACCELERATORS MOVEABLE PURE BEGIN VK_F5, IDM_CHANGEDETAIL, VIRTKEY, NOINVERT "X", IDM_EXIT, VIRTKEY, ALT, NOINVERT @@ -68,8 +68,9 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_ICON ICON "StepMania.ICO" +IDI_ICON ICON DISCARDABLE "StepMania.ICO" +#ifndef _MAC ///////////////////////////////////////////////////////////////////////////// // // Version @@ -92,14 +93,14 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN - 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" + 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" END END BLOCK "VarFileInfo" @@ -108,14 +109,16 @@ BEGIN END END +#endif // !_MAC + ///////////////////////////////////////////////////////////////////////////// // // Bitmap // -BITMAP_ERROR BITMAP "error.bmp" -BITMAP_SPLASH BITMAP "splash.bmp" +BITMAP_ERROR BITMAP MOVEABLE PURE "error.bmp" +BITMAP_SPLASH BITMAP MOVEABLE PURE "splash.bmp" ///////////////////////////////////////////////////////////////////////////// // @@ -123,9 +126,9 @@ BITMAP_SPLASH BITMAP "splash.bmp" // IDD_ERROR_DIALOG DIALOGEX 0, 0, 332, 234 -STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION CAPTION "StepMania Error" -FONT 8, "MS Sans Serif", 0, 0, 0x0 +FONT 8, "MS Sans Serif" 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 896cf9ab04..0650a28610 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -223,6 +223,7 @@ 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 @@ -236,7 +237,29 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow ) } catch( ... ) { - g_sErrorString = "access violation or other run-time error."; + 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; + } + } if( g_sErrorString != "" ) @@ -510,12 +533,12 @@ HRESULT CreateObjects( HWND hWnd ) + SCREENMAN->SetNewScreen( new ScreenTitleMenu ); //SCREENMAN->SetNewScreen( new ScreenLoading ); //SCREENMAN->SetNewScreen( new ScreenSandbox ); - //SCREENMAN->SetNewScreen( new ScreenResults(false) ); + //SCREENMAN->SetNewScreen( new ScreenResults(true) ); //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 00e2022d09..402c3d701d 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 /debug /machine:I386 /out:"../StepMania-debug.exe" /pdbtype:sept +# ADD LINK32 /nologo /subsystem:windows /profile /debug /machine:I386 /out:"../StepMania-debug.exe" !ENDIF @@ -260,6 +260,14 @@ 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 @@ -658,6 +666,22 @@ 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 diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 2b8e8cf044..1751812228 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -359,6 +359,12 @@ + + + + diff --git a/stepmania/src/StyleInput.h b/stepmania/src/StyleInput.h index da197b4c6c..17066634a2 100644 --- a/stepmania/src/StyleInput.h +++ b/stepmania/src/StyleInput.h @@ -13,15 +13,15 @@ struct StyleInput { - StyleInput() { player = PLAYER_NONE; col = -1; }; + StyleInput() { player = PLAYER_INVALID; 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_NONE; }; + inline bool IsBlank() const { return player == PLAYER_INVALID; }; inline bool IsValid() const { return !IsBlank(); }; - inline void MakeBlank() { player = PLAYER_NONE; col = -1; }; + inline void MakeBlank() { player = PLAYER_INVALID; col = -1; }; }; \ No newline at end of file diff --git a/stepmania/src/resource.h b/stepmania/src/resource.h index 44643f00c1..495cbc30de 100644 --- a/stepmania/src/resource.h +++ b/stepmania/src/resource.h @@ -1,5 +1,5 @@ //{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. +// Microsoft Developer Studio 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 115 +#define _APS_NEXT_RESOURCE_VALUE 116 #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 53bcaaa51b..b5d263dfcc 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; }; + void SetBeatOffsetInSeconds(float fNewOffset) {m_fOffsetInSeconds = fNewOffset; SetChangedSinceLastSave(); }; void GetMinMaxBPM( float &fMinBPM, float &fMaxBPM ) { fMaxBPM = 0; @@ -114,12 +114,13 @@ 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;