From 936fabbe85b9f669000dc92a59a7fc0a1f72c87a Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 27 Jul 2002 19:29:51 +0000 Subject: [PATCH] more fixes to Oni and courses --- stepmania/src/Actor.cpp | 20 +- stepmania/src/Actor.h | 5 +- stepmania/src/ArrowEffects.cpp | 2 + stepmania/src/Background.cpp | 9 +- stepmania/src/BannerWithFrame.cpp | 5 + stepmania/src/BannerWithFrame.h | 4 +- stepmania/src/BitmapText.cpp | 2 + stepmania/src/Course.cpp | 124 ++++--- stepmania/src/Course.h | 14 +- stepmania/src/CourseContentsFrame.cpp | 9 +- stepmania/src/Font.cpp | 1 + stepmania/src/FontManager.cpp | 2 + stepmania/src/GameConstantsAndTypes.cpp | 210 +++++++++++ stepmania/src/GameConstantsAndTypes.h | 283 ++------------ stepmania/src/GameDef.cpp | 1 + stepmania/src/GameDef.h | 6 +- stepmania/src/GameInput.cpp | 38 ++ stepmania/src/GameInput.h | 82 ++--- stepmania/src/GameManager.cpp | 428 +++++++++++----------- stepmania/src/GameManager.h | 1 - stepmania/src/GameState.cpp | 7 - stepmania/src/GameState.h | 10 +- stepmania/src/GrooveRadar.cpp | 6 +- stepmania/src/HoldGhostArrow.cpp | 2 + stepmania/src/InputFilter.h | 4 +- stepmania/src/InputMapper.cpp | 24 +- stepmania/src/InputMapper.h | 2 +- stepmania/src/InputQueue.cpp | 40 ++ stepmania/src/InputQueue.h | 38 +- stepmania/src/Judgement.cpp | 2 +- stepmania/src/LifeMeter.h | 1 + stepmania/src/LifeMeterBar.cpp | 16 +- stepmania/src/LifeMeterBattery.cpp | 10 +- stepmania/src/MenuElements.cpp | 1 + stepmania/src/MenuTimer.cpp | 10 + stepmania/src/MotionBlurSprite.h | 2 +- stepmania/src/MusicStatusDisplay.cpp | 65 ++++ stepmania/src/MusicStatusDisplay.h | 84 +---- stepmania/src/MusicWheel.cpp | 63 ++-- stepmania/src/MusicWheel.h | 5 +- stepmania/src/NoteData.cpp | 3 +- stepmania/src/NoteData.h | 1 + stepmania/src/NoteField.cpp | 21 +- stepmania/src/NoteField.h | 6 +- stepmania/src/Notes.cpp | 20 +- stepmania/src/Player.cpp | 45 ++- stepmania/src/PlayerOptions.cpp | 62 ++++ stepmania/src/PlayerOptions.h | 43 +++ stepmania/src/PrefsManager.cpp | 23 +- stepmania/src/PrefsManager.h | 17 +- stepmania/src/RageBitmapTexture.cpp | 1 + stepmania/src/RageDisplay.cpp | 2 + stepmania/src/RageInput.cpp | 1 + stepmania/src/RageMovieTexture.cpp | 1 + stepmania/src/RageSound.cpp | 1 + stepmania/src/RageTextureManager.cpp | 1 + stepmania/src/ScoreDisplay.h | 1 + stepmania/src/Screen.h | 2 +- stepmania/src/ScreenAppearanceOptions.cpp | 6 +- stepmania/src/ScreenEdit.cpp | 1 + stepmania/src/ScreenEditMenu.cpp | 8 +- stepmania/src/ScreenEvaluation.cpp | 38 +- stepmania/src/ScreenEvaluation.h | 1 - stepmania/src/ScreenEz2SelectPlayer.cpp | 2 + stepmania/src/ScreenEz2SelectStyle.cpp | 2 + stepmania/src/ScreenGameplay.cpp | 326 ++++++++++------ stepmania/src/ScreenGameplay.h | 22 +- stepmania/src/ScreenManager.cpp | 8 +- stepmania/src/ScreenManager.h | 2 +- stepmania/src/ScreenMessage.h | 2 - stepmania/src/ScreenMusicScroll.cpp | 4 +- stepmania/src/ScreenPlayerOptions.cpp | 7 +- stepmania/src/ScreenPrompt.cpp | 95 ++--- stepmania/src/ScreenPrompt.h | 26 +- stepmania/src/ScreenSandbox.h | 4 +- stepmania/src/ScreenSelectCourse.cpp | 34 +- stepmania/src/ScreenSelectCourse.h | 2 + stepmania/src/ScreenSelectDifficulty.cpp | 34 +- stepmania/src/ScreenSelectDifficulty.h | 5 +- stepmania/src/ScreenSelectGame.cpp | 4 +- stepmania/src/ScreenSelectMusic.cpp | 2 +- stepmania/src/ScreenSelectStyle.cpp | 2 +- stepmania/src/ScreenSongOptions.cpp | 55 +-- stepmania/src/ScreenTitleMenu.cpp | 9 +- stepmania/src/Song.cpp | 16 +- stepmania/src/SongManager.cpp | 8 +- stepmania/src/SongOptions.cpp | 12 + stepmania/src/SongOptions.h | 37 ++ stepmania/src/Sprite.cpp | 2 +- stepmania/src/StdAfx.h | 7 +- stepmania/src/StepMania.cpp | 20 +- stepmania/src/StepMania.dsp | 24 ++ stepmania/src/StepMania.vcproj | 21 ++ stepmania/src/StyleDef.h | 10 +- stepmania/src/ThemeManager.cpp | 20 +- stepmania/src/ThemeManager.h | 15 +- stepmania/src/TipDisplay.cpp | 1 + stepmania/src/song.h | 7 + 98 files changed, 1634 insertions(+), 1156 deletions(-) create mode 100644 stepmania/src/GameConstantsAndTypes.cpp create mode 100644 stepmania/src/GameInput.cpp create mode 100644 stepmania/src/PlayerOptions.cpp create mode 100644 stepmania/src/PlayerOptions.h create mode 100644 stepmania/src/SongOptions.cpp create mode 100644 stepmania/src/SongOptions.h diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 8296ad7c21..f58509caab 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -109,8 +109,15 @@ void Actor::Draw() // set the world matrix and calculate actor properties, the m_temp_pos += m_vectBounce * fPercentOffset; } break; + case bobbing: + { + float fPercentThroughBounce = m_fTimeIntoBounce / m_fBouncePeriod; + float fPercentOffset = sinf( fPercentThroughBounce*D3DX_PI ); + m_temp_pos += m_vectBounce * fPercentOffset; + } + break; default: - ASSERT( false ); // invalid Effect + ASSERT(0); // invalid Effect } @@ -189,6 +196,7 @@ void Actor::Update( float fDeltaTime ) case flickering: break; case bouncing: + case bobbing: m_fTimeIntoBounce += fDeltaTime; if( m_fTimeIntoBounce >= m_fBouncePeriod ) m_fTimeIntoBounce -= m_fBouncePeriod; @@ -460,4 +468,14 @@ void Actor::SetEffectBouncing( D3DXVECTOR3 vectBounce, float fPeriod ) m_fBouncePeriod = fPeriod; m_fTimeIntoBounce = 0; +} + +void Actor::SetEffectBobbing( D3DXVECTOR3 vectBob, float fPeriod ) +{ + m_Effect = bobbing; + + m_vectBounce = vectBob; + m_fBouncePeriod = fPeriod; + m_fTimeIntoBounce = 0; + } \ No newline at end of file diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index ba4cf61922..f66fce12f7 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -34,7 +34,7 @@ public: blinking, camelion, glowing, wagging, spinning, vibrating, flickering, - bouncing + bouncing, bobbing }; // let subclasses override @@ -154,6 +154,7 @@ public: void SetEffectVibrating( float fVibrationDistance = 5.0 ); void SetEffectFlickering(); void SetEffectBouncing( D3DXVECTOR3 vectBounceDir, float fPeriod ); + void SetEffectBobbing( D3DXVECTOR3 vectBobDir, float fPeriod ); Effect GetEffect() { return m_Effect; }; @@ -210,7 +211,7 @@ protected: TweenState m_QueuedTweens[MAX_TWEEN_STATES]; int m_iNumTweenStates; - TweenState& GetLatestTween() { return m_QueuedTweens[m_iNumTweenStates-1]; }; + TweenState& GetLatestTween() { ASSERT(m_iNumTweenStates>0 && m_iNumTweenStatesHasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND), true, 2, 0, true, m_BackgroundMode==MODE_ANIMATIONS ); + m_sprSongBackground.Load( pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND), true, 4, 0, true ); m_sprSongBackground.StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) ); diff --git a/stepmania/src/BannerWithFrame.cpp b/stepmania/src/BannerWithFrame.cpp index 2ac8ac5dbd..37a0e8b6c7 100644 --- a/stepmania/src/BannerWithFrame.cpp +++ b/stepmania/src/BannerWithFrame.cpp @@ -36,3 +36,8 @@ void BannerWithFrame::LoadFromGroup( CString sGroupName ) { m_Banner.LoadFromGroup( sGroupName ); } + +void BannerWithFrame::LoadFromCourse( Course* pCourse ) +{ + m_Banner.LoadFromCourse( pCourse ); +} diff --git a/stepmania/src/BannerWithFrame.h b/stepmania/src/BannerWithFrame.h index 3735cd563a..85aae25eee 100644 --- a/stepmania/src/BannerWithFrame.h +++ b/stepmania/src/BannerWithFrame.h @@ -13,7 +13,8 @@ #include "ActorFrame.h" #include "Sprite.h" #include "Banner.h" - +class Song; +class Course; class BannerWithFrame : public ActorFrame { @@ -22,6 +23,7 @@ public: void LoadFromSong( Song* pSong ); void LoadFromGroup( CString sGroupName ); + void LoadFromCourse( Course* pCourse ); protected: diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index 565d95fba4..6c6d9387ba 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -14,6 +14,8 @@ #include "IniFile.h" #include "FontManager.h" #include "RageLog.h" +#include "RageException.h" +#include "RageTimer.h" diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index ea8cbf98e8..a6b8da1a55 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -16,79 +16,63 @@ #include "GameManager.h" #include "SongManager.h" #include "GameState.h" +#include "RageException.h" +#include "RageLog.h" +#include "MsdFile.h" void Course::LoadFromCRSFile( CString sPath, CArray &apSongs ) { - CStdioFile file; - if( !file.Open( sPath, CFile::modeRead|CFile::shareDenyNone ) ) + MsdFile msd; + if( !msd.ReadFile(sPath) ) throw RageException( "Error opening CRS file '%s'.", sPath ); + CString sDir, sFName, sExt; + splitrelpath( sPath, sDir, sFName, sExt ); - // read the whole file into a sFileText - CString sFileText; - CString buffer; - while( file.ReadString(buffer) ) - sFileText += buffer + "\n"; - file.Close(); + CStringArray arrayPossibleBanners; + GetDirListing( "Courses\\" + sFName + ".png", arrayPossibleBanners, false, true ); + GetDirListing( "Courses\\" + sFName + ".jpg", arrayPossibleBanners, false, true ); + GetDirListing( "Courses\\" + sFName + ".bmp", arrayPossibleBanners, false, true ); + GetDirListing( "Courses\\" + sFName + ".gif", arrayPossibleBanners, false, true ); + if( arrayPossibleBanners.GetSize() > 0 ) + m_sBannerPath = arrayPossibleBanners[0]; - // strip comments out of sFileText - while( sFileText.Find("//") != -1 ) + for( int i=0; im_sSongDir, sSongDir) ) + for( i=0; im_sSongDir; + if( 0 == stricmp(sThisSongDir, sSongDir) ) pSong = apSongs[i]; - + } if( pSong == NULL ) // we didn't find the Song continue; // skip this song @@ -164,4 +148,40 @@ void Course::GetSongAndNotesForCurrentStyle( CArray& apSongsOut, CA for( int p=0; p= 7 ) + return D3DXCOLOR(1,0,0,1); // red + else if( m_iStages >= 4 ) + return D3DXCOLOR(1,0.5f,0,1); // orange + else + return D3DXCOLOR(0,1,0,1); // green +} + +// +// Sorting stuff +// + +int CompareCoursePointersByDifficulty(const void *arg1, const void *arg2) +{ + Course* pCourse1 = *(Course**)arg1; + Course* pCourse2 = *(Course**)arg2; + + float fScore1 = (float)pCourse1->m_iStages; + float fScore2 = (float)pCourse2->m_iStages; + + if( fScore1 < fScore2 ) + return -1; + else if( fScore1 == fScore2 ) + return 0; + else + return 1; +} + +void SortCoursePointerArrayByDifficulty( CArray &apCourses ) +{ + qsort( apCourses.GetData(), apCourses.GetSize(), sizeof(Course*), CompareCoursePointersByDifficulty ); +} diff --git a/stepmania/src/Course.h b/stepmania/src/Course.h index 33bd618ca7..5635a93ec5 100644 --- a/stepmania/src/Course.h +++ b/stepmania/src/Course.h @@ -1,7 +1,7 @@ #pragma once /* ----------------------------------------------------------------------------- - Course: Course + Class: Course Desc: A queue of songs and notes. @@ -11,9 +11,11 @@ */ #include "GameConstantsAndTypes.h" +#include "PlayerOptions.h" class Song; struct Notes; + const int MAX_COURSE_STAGES = 100; class Course @@ -23,6 +25,7 @@ public: { m_iStages = 0; m_bRepeat = false; + m_iLives = 4; for( int i=0; i &apSongs ); @@ -50,4 +55,9 @@ public: } void GetSongAndNotesForCurrentStyle( CArray& apSongsOut, CArray apNotesOut[NUM_PLAYERS] ); + D3DXCOLOR GetColor(); }; + + +void SortCoursePointerArrayByDifficulty( CArray &apCourses ); + diff --git a/stepmania/src/CourseContentsFrame.cpp b/stepmania/src/CourseContentsFrame.cpp index 1a8741d279..0d981329e6 100644 --- a/stepmania/src/CourseContentsFrame.cpp +++ b/stepmania/src/CourseContentsFrame.cpp @@ -108,6 +108,9 @@ void CourseContentsFrame::SetFromCourse( Course* pCourse ) printf( "Adding song '%s'\n", pSong->m_sMainTitle ); m_CourseContentDisplays[m_iNumContents].Load( m_iNumContents+1, pSong, pNotes ); + m_CourseContentDisplays[m_iNumContents].SetXY( 0, -((MAX_VISIBLE_CONTENTS-1)/2) * CONTENTS_BAR_HEIGHT ); + m_CourseContentDisplays[m_iNumContents].BeginTweening( i*0.1f ); + m_CourseContentDisplays[m_iNumContents].SetTweenY( (-(MAX_VISIBLE_CONTENTS-1)/2 + i) * CONTENTS_BAR_HEIGHT ); m_iNumContents ++; } @@ -116,6 +119,8 @@ void CourseContentsFrame::SetFromCourse( Course* pCourse ) void CourseContentsFrame::Update( float fDeltaTime ) { + ActorFrame::Update( fDeltaTime ); + if( m_fTimeUntilScroll > 0 && m_iNumContents > MAX_VISIBLE_CONTENTS) m_fTimeUntilScroll -= fDeltaTime; if( m_fTimeUntilScroll <= 0 ) @@ -149,11 +154,13 @@ void CourseContentsFrame::DrawPrimitives() int iItemToDraw = (int)m_fItemAtTopOfList; + float fY = (iItemToDraw-m_fItemAtTopOfList-(MAX_VISIBLE_CONTENTS-1)/2) * CONTENTS_BAR_HEIGHT; for( int i=0; i= m_iNumContents ) diff --git a/stepmania/src/Font.cpp b/stepmania/src/Font.cpp index 9f6adde55f..673c8f350f 100644 --- a/stepmania/src/Font.cpp +++ b/stepmania/src/Font.cpp @@ -16,6 +16,7 @@ #include "RageTextureManager.h" #include "RageUtil.h" #include "RageLog.h" +#include "RageException.h" diff --git a/stepmania/src/FontManager.cpp b/stepmania/src/FontManager.cpp index 45f57739fc..680c41a14e 100644 --- a/stepmania/src/FontManager.cpp +++ b/stepmania/src/FontManager.cpp @@ -17,6 +17,8 @@ #include "Font.h" #include "RageUtil.h" #include "RageLog.h" +#include "RageException.h" +#include "RageTimer.h" FontManager* FONT = NULL; diff --git a/stepmania/src/GameConstantsAndTypes.cpp b/stepmania/src/GameConstantsAndTypes.cpp new file mode 100644 index 0000000000..d9d6c5682d --- /dev/null +++ b/stepmania/src/GameConstantsAndTypes.cpp @@ -0,0 +1,210 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + File: GameConstantsAndTypes.cpp + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "GameConstantsAndTypes.h" + + +D3DXCOLOR NoteTypeToColor( NoteType nt ) +{ + switch( nt ) + { + case NOTE_4TH: return D3DXCOLOR(1,0,0,1); // red + case NOTE_8TH: return D3DXCOLOR(0,0,1,1); // blue + case NOTE_12TH: return D3DXCOLOR(1,0,1,1); // purple + case NOTE_16TH: return D3DXCOLOR(1,1,0,1); // yellow + default: ASSERT( false ); return D3DXCOLOR(1,1,1,1); + } +}; + +float NoteTypeToBeat( NoteType nt ) +{ + switch( nt ) + { + case NOTE_4TH: return 1.0f; // quarter notes + case NOTE_8TH: return 1.0f/2; // eighth notes + case NOTE_12TH: return 1.0f/3; // triplets + case NOTE_16TH: return 1.0f/4; // sixteenth notes + default: ASSERT( false ); return 0; + } +}; + +NoteType GetNoteType( int iNoteIndex ) +{ + if( iNoteIndex % (ELEMENTS_PER_MEASURE/4) == 0) + return NOTE_4TH; + else if( iNoteIndex % (ELEMENTS_PER_MEASURE/8) == 0) + return NOTE_8TH; + else if( iNoteIndex % (ELEMENTS_PER_MEASURE/12) == 0) + return NOTE_12TH; + else if( iNoteIndex % (ELEMENTS_PER_MEASURE/16) == 0) + return NOTE_16TH; +// ASSERT(0); + return NOTE_INVALID; +}; + +bool IsNoteOfType( int iNoteIndex, NoteType t ) +{ + return GetNoteType(iNoteIndex) == t; +}; + +D3DXCOLOR GetNoteColorFromIndex( int iStepIndex ) +{ + for( int t=0; t 2 ) - sReturn.Delete( sReturn.GetLength()-2, 2 ); // delete the trailing ", " - return sReturn; - } -}; - -struct SongOptions -{ - SongOptions() { - m_FailType = FAIL_ARCADE; - m_AssistType = ASSIST_NONE; - m_fMusicRate = 1.0f; - }; - - enum FailType { FAIL_ARCADE=0, FAIL_END_OF_SONG, FAIL_OFF }; - FailType m_FailType; - enum AssistType { ASSIST_NONE=0, ASSIST_TICK }; - AssistType m_AssistType; - float m_fMusicRate; -}; diff --git a/stepmania/src/GameDef.cpp b/stepmania/src/GameDef.cpp index 3a01d216fa..190922f7ef 100644 --- a/stepmania/src/GameDef.cpp +++ b/stepmania/src/GameDef.cpp @@ -16,6 +16,7 @@ #include "IniFile.h" #include "StyleDef.h" +#include "RageException.h" CString GameDef::ElementToGraphicSuffix( const SkinElement gbg ) diff --git a/stepmania/src/GameDef.h b/stepmania/src/GameDef.h index 3290c9fd64..5c98e8b83e 100644 --- a/stepmania/src/GameDef.h +++ b/stepmania/src/GameDef.h @@ -40,7 +40,7 @@ public: char m_szDescription[60]; int m_iNumInstruments; int m_iButtonsPerInstrument; - char m_szButtonNames[60][MAX_INSTRUMENT_BUTTONS]; // e.g. "left", "right", "middle C", "snare" + char m_szButtonNames[60][MAX_GAME_BUTTONS]; // e.g. "left", "right", "middle C", "snare" // int ButtonNameToIndex( const CString &sButtonName ) // { @@ -66,7 +66,7 @@ public: inline MenuInput GameInputToMenuInput( const GameInput GameI ) { - PlayerNumber p = (PlayerNumber)GameI.number; + PlayerNumber p = (PlayerNumber)GameI.controller; for( int b=0; b= 0 && newGame < NUM_GAMES ); - - m_CurGame = newGame; -} - int GameState::GetStageIndex() { return m_iCurrentStageIndex; diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 9c18b285c5..c3688517d5 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -12,6 +12,8 @@ #include "GameConstantsAndTypes.h" #include "GameplayStatistics.h" +#include "PlayerOptions.h" +#include "SongOptions.h" class Song; @@ -43,11 +45,9 @@ public: CArray m_aGameplayStatistics; // for passing from Dancing to Results GameplayStatistics& GetLatestGameplayStatistics(); -protected: + + Game m_CurGame; -public: - Game GetCurGame() { return m_CurGame; }; - void SwitchGame( Game newGame ); Style m_CurStyle; PlayerNumber m_MasterPlayerNumber; @@ -55,7 +55,7 @@ public: StyleDef* GetCurrentStyleDef(); bool IsPlayerEnabled( PlayerNumber pn ); - //bool IsPlayerEnabled( int p ) { return IsPlayerEnabled( (PlayerNumber)p ); }; // for those too lasy to cast all those p's to a PlayerNumber + bool IsPlayerEnabled( int p ) { return IsPlayerEnabled( (PlayerNumber)p ); }; // for those too lasy to cast all those p's to a PlayerNumber CString m_sLoadingMessage; diff --git a/stepmania/src/GrooveRadar.cpp b/stepmania/src/GrooveRadar.cpp index c11cafad6f..ed1975d831 100644 --- a/stepmania/src/GrooveRadar.cpp +++ b/stepmania/src/GrooveRadar.cpp @@ -20,6 +20,8 @@ float RADAR_VALUE_ROTATION( int iValueIndex ) { return D3DX_PI/2 + D3DX_PI*2 / 5.0f * iValueIndex; } +const float RADAR_EDGE_WIDTH = 2; + GrooveRadar::GrooveRadar() { this->AddSubActor( &m_GrooveRadarValueMap ); @@ -197,8 +199,8 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() const int c = i%NUM_RADAR_CATEGORIES; const float fDistFromCenter = ( m_fValuesOld[p][c] * (1-m_PercentTowardNew[p]) + m_fValuesNew[p][c] * m_PercentTowardNew[p] + 0.07f ) * fRadius; - const float fDistFromCenterInner = fDistFromCenter-2; - const float fDistFromCenterOutter = fDistFromCenter+2; + const float fDistFromCenterInner = fDistFromCenter-RADAR_EDGE_WIDTH/2; + const float fDistFromCenterOutter = fDistFromCenter+RADAR_EDGE_WIDTH/2; const float fRotation = RADAR_VALUE_ROTATION(i); const float fXInner = cosf(fRotation) * fDistFromCenterInner; const float fXOutter = cosf(fRotation) * fDistFromCenterOutter; diff --git a/stepmania/src/HoldGhostArrow.cpp b/stepmania/src/HoldGhostArrow.cpp index 0f5113d01b..b439fd4eca 100644 --- a/stepmania/src/HoldGhostArrow.cpp +++ b/stepmania/src/HoldGhostArrow.cpp @@ -6,6 +6,8 @@ #include "HoldGhostArrow.h" #include "PrefsManager.h" +#include "RageException.h" +#include "RageTimer.h" const float HOLD_GHOST_ARROW_TWEEN_TIME = 0.5f; diff --git a/stepmania/src/InputFilter.h b/stepmania/src/InputFilter.h index 0f7c0771ca..a197d78d98 100644 --- a/stepmania/src/InputFilter.h +++ b/stepmania/src/InputFilter.h @@ -14,8 +14,8 @@ #include "RageInput.h" -const float TIME_BEFORE_SLOW_REPEATS = 0.7f; -const float TIME_BEFORE_FAST_REPEATS = 2.0f; +const float TIME_BEFORE_SLOW_REPEATS = 0.6f; +const float TIME_BEFORE_FAST_REPEATS = 1.5f; //const float TIME_BETWEEN_SLOW_REPEATS = 0.25f; const float TIME_BETWEEN_SLOW_REPEATS = 0.125f; diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index 46915d08b7..cf3e111f69 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -76,13 +76,13 @@ void InputMapper::SaveMappingsToDisk() // iterate over our input map and write all mappings to the ini file - for( int i=0; i= MAX_INPUT_QUEUE_LENGTH ) // full + m_aQueue[p].RemoveAt( 0, m_aQueue[p].GetSize()-MAX_INPUT_QUEUE_LENGTH+1 ); + m_aQueue[p].Add( MenuButtonAndTime(b,TIMER->GetTimeSinceStart()) ); +}; + +bool InputQueue::MatchesPattern( const PlayerNumber p, const MenuButton* button_sequence, const int iNumButtons, float fMaxSecondsBack ) +{ + if( fMaxSecondsBack == -1 ) + fMaxSecondsBack = 0.4f + iNumButtons*0.15f; + + float fOldestTimeAllowed = TIMER->GetTimeSinceStart() - fMaxSecondsBack; + + int sequence_index = iNumButtons-1; // count down + for( int queue_index=m_aQueue[p].GetSize()-1; queue_index>=0; queue_index-- ) // iterate newest to oldest + { + MenuButtonAndTime BandT = m_aQueue[p][queue_index]; + if( BandT.button != button_sequence[sequence_index] || + BandT.fTime < fOldestTimeAllowed ) + { + return false; + } + if( sequence_index == 0 ) // we matched the whole pattern + { + m_aQueue[p].RemoveAll(); // empty the queue so we don't match on it again + return true; + } + sequence_index--; + } + return false; +} \ No newline at end of file diff --git a/stepmania/src/InputQueue.h b/stepmania/src/InputQueue.h index 47e8e413b7..498936f563 100644 --- a/stepmania/src/InputQueue.h +++ b/stepmania/src/InputQueue.h @@ -18,43 +18,11 @@ const int MAX_INPUT_QUEUE_LENGTH = 8; class InputQueue { public: - InputQueue() - { - for( int p=0; p= MAX_INPUT_QUEUE_LENGTH ) // full - m_aQueue[p].RemoveAt( 0, m_aQueue[p].GetSize()-MAX_INPUT_QUEUE_LENGTH+1 ); - m_aQueue[p].Add( MenuButtonAndTime(b,TIMER->GetTimeSinceStart()) ); - }; - bool MatchesPattern( const PlayerNumber p, const MenuButton* button_sequence, const int iNumButtons, float fMaxSecondsBack = -1 ) - { - if( fMaxSecondsBack == -1 ) - fMaxSecondsBack = 0.4f + iNumButtons*0.15f; + void HandleInput( const PlayerNumber p, const MenuButton b ); + bool MatchesPattern( const PlayerNumber p, const MenuButton* button_sequence, const int iNumButtons, float fMaxSecondsBack = -1 ); - float fOldestTimeAllowed = TIMER->GetTimeSinceStart() - fMaxSecondsBack; - - int sequence_index = iNumButtons-1; // count down - for( int queue_index=m_aQueue[p].GetSize()-1; queue_index>=0; queue_index-- ) // iterate newest to oldest - { - MenuButtonAndTime BandT = m_aQueue[p][queue_index]; - if( BandT.button != button_sequence[sequence_index] || - BandT.fTime < fOldestTimeAllowed ) - { - return false; - } - if( sequence_index == 0 ) // we matched the whole pattern - { - m_aQueue[p].RemoveAll(); // empty the queue so we don't match on it again - return true; - } - sequence_index--; - } - return false; - } protected: struct MenuButtonAndTime diff --git a/stepmania/src/Judgement.cpp b/stepmania/src/Judgement.cpp index f9a1346a66..aaa79f852e 100644 --- a/stepmania/src/Judgement.cpp +++ b/stepmania/src/Judgement.cpp @@ -60,7 +60,7 @@ void Judgement::SetJudgement( TapNoteScore score ) default: ASSERT( false ); } - if ( GAMESTATE->GetCurGame() == GAME_EZ2 ) // Resize Judgement graphics for Ez2. + if ( GAMESTATE->m_CurGame == GAME_EZ2 ) // Resize Judgement graphics for Ez2. { m_sprJudgement.SetHeight( 22.0f * 2.1f ); m_sprJudgement.SetWidth( 143.0f * 2.1f ); diff --git a/stepmania/src/LifeMeter.h b/stepmania/src/LifeMeter.h index a154b6ee20..febc6bdf8a 100644 --- a/stepmania/src/LifeMeter.h +++ b/stepmania/src/LifeMeter.h @@ -12,6 +12,7 @@ #include "GameConstantsAndTypes.h" #include "ActorFrame.h" +#include "PlayerOptions.h" class Song; diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index 3a1a87acc2..cefaddbd08 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -12,6 +12,9 @@ #include "LifeMeterBar.h" #include "PrefsManager.h" +#include "RageException.h" +#include "RageTimer.h" +#include "GameState.h" const int NUM_LIFE_STREAM_SECTIONS = 3; const float LIFE_STREAM_SECTION_WIDTH = 1.0f/NUM_LIFE_STREAM_SECTIONS; @@ -67,9 +70,9 @@ void LifeMeterBar::ChangeLife( TapNoteScore score ) bool bWasHot = IsHot(); float fDeltaLife; - switch( m_PlayerOptions.m_DrainType ) + switch( GAMESTATE->m_SongOptions.m_DrainType ) { - case PlayerOptions::DRAIN_NORMAL: + case SongOptions::DRAIN_NORMAL: switch( score ) { case TNS_PERFECT: fDeltaLife = +0.008f; break; @@ -81,7 +84,7 @@ void LifeMeterBar::ChangeLife( TapNoteScore score ) if( IsHot() && score < TNS_GOOD ) fDeltaLife = -0.10f; // make it take a while to get back to "doing great" break; - case PlayerOptions::DRAIN_NO_RECOVER: + case SongOptions::DRAIN_NO_RECOVER: switch( score ) { case TNS_PERFECT: fDeltaLife = +0.000f; break; @@ -91,7 +94,7 @@ void LifeMeterBar::ChangeLife( TapNoteScore score ) case TNS_MISS: fDeltaLife = -0.080f; break; } break; - case PlayerOptions::DRAIN_SUDDEN_DEATH: + case SongOptions::DRAIN_SUDDEN_DEATH: fDeltaLife = -1; break; } @@ -181,6 +184,11 @@ void LifeMeterBar::DrawPrimitives() float fPercentRed = IsInDanger() ? sinf( TIMER->GetTimeSinceStart()*D3DX_PI*4 )/2+0.5f : 0; m_quadBlackBackground.SetDiffuseColor( D3DXCOLOR(fPercentRed*0.8f,0,0,1) ); + if( !GAMESTATE->IsPlayerEnabled(m_PlayerNumber) ) + { + m_sprStreamNormal.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); + m_sprStreamHot.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); + } ActorFrame::DrawPrimitives(); } diff --git a/stepmania/src/LifeMeterBattery.cpp b/stepmania/src/LifeMeterBattery.cpp index 26d9a60e9e..2d352a80f8 100644 --- a/stepmania/src/LifeMeterBattery.cpp +++ b/stepmania/src/LifeMeterBattery.cpp @@ -50,7 +50,7 @@ LifeMeterBattery::LifeMeterBattery() m_textPercent.Load( THEME->GetPathTo(FONT_SCORE_NUMBERS) ); m_textPercent.TurnShadowOff(); m_textPercent.SetZoom( 0.7f ); - m_textPercent.SetText( "0.00" ); + m_textPercent.SetText( "00.0" ); this->AddSubActor( &m_textPercent ); m_soundGainLife.Load( THEME->GetPathTo(SOUND_GAMEPLAY_ONI_GAIN_LIFE) ); @@ -97,8 +97,12 @@ void LifeMeterBattery::ChangeLife( TapNoteScore score ) for( int i=0; im_aGameplayStatistics.GetSize(); i++ ) iActualDancePoints += GAMESTATE->m_aGameplayStatistics[i].iActualDancePoints[m_PlayerNumber]; int iPossibleDancePoints = GAMESTATE->m_iCoursePossibleDancePoints; - float fPercentDancePoints = iActualDancePoints / (float)iPossibleDancePoints + 0.0001f; // correct for rounding errors - m_textPercent.SetText( ssprintf("%1.2f", fPercentDancePoints) ); + float fPercentDancePoints = iActualDancePoints / (float)iPossibleDancePoints + 0.001f; // correct for rounding errors + float fNumToDisplay = fPercentDancePoints*100; + CString sNumToDisplay = ssprintf("%03.1f", fNumToDisplay); + if( sNumToDisplay.GetLength() == 3 ) + sNumToDisplay = "0" + sNumToDisplay; + m_textPercent.SetText( sNumToDisplay ); } switch( score ) diff --git a/stepmania/src/MenuElements.cpp b/stepmania/src/MenuElements.cpp index 0b25812e3a..e375cc8bc8 100644 --- a/stepmania/src/MenuElements.cpp +++ b/stepmania/src/MenuElements.cpp @@ -91,6 +91,7 @@ void MenuElements::Load( CString sBackgroundPath, CString sTopEdgePath, CString if( !bTimerEnabled || !PREFSMAN->m_bMenuTimer ) { m_MenuTimer.SetTimer( 99 ); + m_MenuTimer.Update( 0 ); m_MenuTimer.StopTimer(); } else diff --git a/stepmania/src/MenuTimer.cpp b/stepmania/src/MenuTimer.cpp index 2df0592c8e..0196b1a588 100644 --- a/stepmania/src/MenuTimer.cpp +++ b/stepmania/src/MenuTimer.cpp @@ -44,7 +44,16 @@ void MenuTimer::Update( float fDeltaTime ) ActorFrame::Update( fDeltaTime ); if( m_bTimerStopped ) + { + m_textDigit1.SetText( ssprintf("%d", ((int)m_fSecondsLeft)/10) ); + m_textDigit2.SetText( ssprintf("%d", ((int)m_fSecondsLeft)%10) ); + + m_textDigit1.SetZoomX( 1 ); + m_textDigit2.SetZoomX( 1 ); + return; + } + if( m_fStallSeconds > 0 ) { @@ -105,4 +114,5 @@ void MenuTimer::StallTimer() void MenuTimer::SetTimer( int iSeconds ) { m_fSecondsLeft = (float)iSeconds; + CLAMP( m_fSecondsLeft, 0, 99 ); } diff --git a/stepmania/src/MotionBlurSprite.h b/stepmania/src/MotionBlurSprite.h index 072a255ceb..2aecbab3a7 100644 --- a/stepmania/src/MotionBlurSprite.h +++ b/stepmania/src/MotionBlurSprite.h @@ -67,7 +67,7 @@ public: { for(int i=0; iGetPathTo(GRAPHIC_MUSIC_STATUS_ICONS) ); + StopAnimating(); + SetType( TYPE_NONE ); +}; +void MusicStatusDisplay::SetType( MusicStatusDisplayType msdt ) +{ + m_MusicStatusDisplayType = msdt; + + switch( m_MusicStatusDisplayType ) + { + case TYPE_NEW: + m_MusicStatusDisplayType = TYPE_NEW; + SetState( 0 ); + SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); + break; + case TYPE_CROWN1: + m_MusicStatusDisplayType = TYPE_CROWN1; + SetState( 1 ); + SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); + break; + case TYPE_CROWN2: + m_MusicStatusDisplayType = TYPE_CROWN2; + SetState( 2 ); + SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); + break; + case TYPE_CROWN3: + m_MusicStatusDisplayType = TYPE_CROWN3; + SetState( 3 ); + SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); + break; + case TYPE_NONE: + default: + m_MusicStatusDisplayType = TYPE_NONE; + SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); + break; + } +}; + +void MusicStatusDisplay::Update( float fDeltaTime ) +{ + Sprite::Update( fDeltaTime ); + +}; + +void MusicStatusDisplay::DrawPrimitives() +{ + switch( m_MusicStatusDisplayType ) + { + case TYPE_CROWN1: + case TYPE_CROWN2: + case TYPE_CROWN3: + // blink + if( (TIMER->GetTimeSinceStart() - (int)TIMER->GetTimeSinceStart()) > 0.5f ) // show the new icon + return; + break; + case TYPE_NONE: + return; + break; + } + + Sprite::DrawPrimitives(); +} \ No newline at end of file diff --git a/stepmania/src/MusicStatusDisplay.h b/stepmania/src/MusicStatusDisplay.h index 7f002fcd32..fed906bfcf 100644 --- a/stepmania/src/MusicStatusDisplay.h +++ b/stepmania/src/MusicStatusDisplay.h @@ -1,22 +1,17 @@ +#pragma once /* ----------------------------------------------------------------------------- - File: MusicStatusDisplay.h + Class: MusicStatusDisplay - Desc: A graphic displayed in the MusicStatusDisplay during Dancing. + Desc: A little graphic to the left of the song's text banner in the MusicWheel. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ -class MusicStatusDisplay; - - -#ifndef _MusicStatusDisplay_H_ -#define _MusicStatusDisplay_H_ - #include "Sprite.h" -#include "PrefsManager.h" enum MusicStatusDisplayType { TYPE_NEW, TYPE_NONE, TYPE_CROWN1, TYPE_CROWN2, TYPE_CROWN3 }; @@ -24,77 +19,14 @@ enum MusicStatusDisplayType { TYPE_NEW, TYPE_NONE, TYPE_CROWN1, TYPE_CROWN2, TYP class MusicStatusDisplay : public Sprite { public: - MusicStatusDisplay() - { - Load( THEME->GetPathTo(GRAPHIC_MUSIC_STATUS_ICONS) ); - StopAnimating(); + MusicStatusDisplay(); - SetType( TYPE_NONE ); - }; + void SetType( MusicStatusDisplayType msdt ); - void SetType( MusicStatusDisplayType msdt ) - { - m_MusicStatusDisplayType = msdt; - - switch( m_MusicStatusDisplayType ) - { - case TYPE_NEW: - m_MusicStatusDisplayType = TYPE_NEW; - SetState( 0 ); - SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - break; - case TYPE_CROWN1: - m_MusicStatusDisplayType = TYPE_CROWN1; - SetState( 1 ); - SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - break; - case TYPE_CROWN2: - m_MusicStatusDisplayType = TYPE_CROWN2; - SetState( 2 ); - SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - break; - case TYPE_CROWN3: - m_MusicStatusDisplayType = TYPE_CROWN3; - SetState( 3 ); - SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - break; - case TYPE_NONE: - default: - m_MusicStatusDisplayType = TYPE_NONE; - SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); - break; - } - }; - - virtual void Update( float fDeltaTime ) - { - Sprite::Update( fDeltaTime ); - - }; - - virtual void DrawPrimitives() - { - switch( m_MusicStatusDisplayType ) - { - case TYPE_CROWN1: - case TYPE_CROWN2: - case TYPE_CROWN3: - // blink - if( (TIMER->GetTimeSinceStart() - (int)TIMER->GetTimeSinceStart()) > 0.5f ) // show the new icon - return; - break; - case TYPE_NONE: - return; - break; - } - - Sprite::DrawPrimitives(); - } + virtual void Update( float fDeltaTime ); + virtual void DrawPrimitives(); protected: enum MusicStatusDisplayType m_MusicStatusDisplayType; }; - - -#endif \ No newline at end of file diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index f964a13f72..eb0e25ab0c 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -66,13 +66,8 @@ inline D3DXCOLOR GetNextSectionColor() return SECTION_COLORS[i++]; } -WheelItemData::WheelItemData() -{ - m_pSong = NULL; - m_MusicStatusDisplayType = TYPE_NONE; -} -void WheelItemData::Load( WheelItemType wit, Song* pSong, const CString &sSectionName, Course* pCourse, const D3DXCOLOR color ) +WheelItemData::WheelItemData( WheelItemType wit, Song* pSong, const CString &sSectionName, Course* pCourse, const D3DXCOLOR color ) { m_WheelItemType = wit; m_pSong = pSong; @@ -81,6 +76,7 @@ void WheelItemData::Load( WheelItemType wit, Song* pSong, const CString &sSectio m_color = color; } + WheelItemDisplay::WheelItemDisplay() { m_fPercentGray = 0; @@ -442,7 +438,7 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr } - // sort the SONGMAN + // sort the songs switch( so ) { case SORT_GROUP: @@ -467,11 +463,9 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr /////////////////////////////////// - // Build an array of WheelItemDatas from the sorted list of Song* + // Build an array of WheelItemDatas from the sorted list of Song*s /////////////////////////////////// - arrayWheelItemDatas.RemoveAll(); // clear out the previous wheel items... - - // ...and load new ones + arrayWheelItemDatas.SetSize( 0, 300 ); // clear out the previous wheel items and set large capacity jumps bool bUseSections; switch( so ) @@ -489,8 +483,6 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr if( bUseSections ) { // make WheelItemDatas with sections - arrayWheelItemDatas.SetSize( arraySongs.GetSize()*2 ); // make sure we have enough room for all music and section items - CString sLastSection = ""; D3DXCOLOR colorSection; int iCurWheelItem = 0; @@ -501,41 +493,39 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr int iSectionColorIndex = 0; if( sThisSection != sLastSection ) // new section, make a section item { - WheelItemData &WID = arrayWheelItemDatas[iCurWheelItem++]; colorSection = (so==SORT_GROUP) ? SONGMAN->GetGroupColor(pSong->m_sGroupName) : SECTION_COLORS[iSectionColorIndex]; iSectionColorIndex = (iSectionColorIndex+1) % NUM_SECTION_COLORS; - WID.Load( TYPE_SECTION, NULL, sThisSection, NULL, colorSection ); + arrayWheelItemDatas.Add( WheelItemData(TYPE_SECTION, NULL, sThisSection, NULL, colorSection) ); sLastSection = sThisSection; } - WheelItemData &WID = arrayWheelItemDatas[iCurWheelItem++]; - WID.Load( TYPE_SONG, pSong, sThisSection, NULL, SONGMAN->GetGroupColor(pSong->m_sGroupName) ); + arrayWheelItemDatas.Add( WheelItemData( TYPE_SONG, pSong, sThisSection, NULL, SONGMAN->GetGroupColor(pSong->m_sGroupName)) ); } - arrayWheelItemDatas.SetSize( iCurWheelItem ); // make sure we have enough room for all music and section items } else { - arrayWheelItemDatas.SetSize( arraySongs.GetSize() ); + for( int i=0; iGetGroupColor(pSong->m_sGroupName) ); - } + Song* pSong = arraySongs[i]; + if( bRoulette && GAMESTATE->m_sPreferredGroup != "ALL MUSIC" && pSong->m_sGroupName != GAMESTATE->m_sPreferredGroup ) + continue; // skip + arrayWheelItemDatas.Add( WheelItemData(TYPE_SONG, pSong, "", NULL, SONGMAN->GetGroupColor(pSong->m_sGroupName)) ); } } } break; case PLAY_MODE_ONI: { - arrayWheelItemDatas.SetSize( 0, 20 ); // clear out the previous wheel items... - for( int c=0; cm_aCourses.GetSize(); c++ ) // foreach course + CArray apCourses; + for( int i=0; im_aCourses.GetSize(); i++ ) + apCourses.Add( &SONGMAN->m_aCourses[i] ); + + SortCoursePointerArrayByDifficulty( apCourses ); + + for( int c=0; cm_aCourses[c]; - arrayWheelItemDatas.Add( WheelItemData() ); - WheelItemData &WID = arrayWheelItemDatas[arrayWheelItemDatas.GetSize()-1]; - WID.Load( TYPE_COURSE, NULL, "", pCourse, D3DXCOLOR(1,1,1,1) ); + Course* pCourse = apCourses[c]; + arrayWheelItemDatas.Add( WheelItemData(TYPE_COURSE, NULL, "", pCourse, pCourse->GetColor()) ); } } break; @@ -566,13 +556,11 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr if( arrayWheelItemDatas.GetSize() == 0 ) { - arrayWheelItemDatas.SetSize( 1 ); - arrayWheelItemDatas[0].Load( TYPE_SECTION, NULL, "NO SONGS", NULL, D3DXCOLOR(1,0,0,1) ); + arrayWheelItemDatas.Add( WheelItemData(TYPE_SECTION, NULL, "EMPTY", NULL, D3DXCOLOR(1,0,0,1)) ); } else if( GAMESTATE->m_PlayMode == PLAY_MODE_ARCADE && !bRoulette ) { - arrayWheelItemDatas.SetSize( arrayWheelItemDatas.GetSize()+1 ); - arrayWheelItemDatas[arrayWheelItemDatas.GetSize()-1].Load( TYPE_ROULETTE, NULL, "", NULL, D3DXCOLOR(1,0,0,1) ); + arrayWheelItemDatas.Add( WheelItemData(TYPE_ROULETTE, NULL, "", NULL, D3DXCOLOR(1,0,0,1)) ); } } @@ -937,8 +925,6 @@ void MusicWheel::PrevMusic( bool bSendSongChangedMessage ) return; // don't fall through } - MUSIC->Stop(); - // decrement m_iSelection do { @@ -985,7 +971,6 @@ void MusicWheel::NextMusic( bool bSendSongChangedMessage ) return; // don't continue } - MUSIC->Stop(); // increment m_iSelection do @@ -1024,8 +1009,6 @@ void MusicWheel::NextSort() return; // don't continue } - MUSIC->Stop(); - m_soundChangeSort.Play(); m_MusicSortDisplay.BeginTweening( FADE_TIME, TWEEN_BIAS_END ); m_MusicSortDisplay.SetTweenXY( SORT_ICON_OFF_SCREEN_X, SORT_ICON_OFF_SCREEN_Y ); diff --git a/stepmania/src/MusicWheel.h b/stepmania/src/MusicWheel.h index d0c73a2b69..ed17abdc3a 100644 --- a/stepmania/src/MusicWheel.h +++ b/stepmania/src/MusicWheel.h @@ -41,9 +41,8 @@ enum WheelItemType { TYPE_SECTION, TYPE_SONG, TYPE_ROULETTE, TYPE_COURSE }; struct WheelItemData { public: - WheelItemData(); - - void Load( WheelItemType wit, Song* pSong, const CString &sSectionName, Course* pCourse, const D3DXCOLOR color ); + WheelItemData() {}; // this is needed to use a CArray of these + WheelItemData( WheelItemType wit, Song* pSong, const CString &sSectionName, Course* pCourse, const D3DXCOLOR color ); WheelItemType m_WheelItemType; CString m_sSectionName; diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index 0f842c3c16..73ca83f286 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" /* ----------------------------------------------------------------------------- - File: NoteData.cpp + Class: NoteData Desc: See header. @@ -17,6 +17,7 @@ #include "ArrowEffects.h" #include "PrefsManager.h" #include "GameConstantsAndTypes.h" +#include "RageException.h" diff --git a/stepmania/src/NoteData.h b/stepmania/src/NoteData.h index 7a39f31684..e3585d1e02 100644 --- a/stepmania/src/NoteData.h +++ b/stepmania/src/NoteData.h @@ -14,6 +14,7 @@ */ #include "GameConstantsAndTypes.h" +#include "PlayerOptions.h" // '1' = tap note // '2' = hold note begin diff --git a/stepmania/src/NoteField.cpp b/stepmania/src/NoteField.cpp index 0dc9006981..35424df127 100644 --- a/stepmania/src/NoteField.cpp +++ b/stepmania/src/NoteField.cpp @@ -18,6 +18,9 @@ #include "PrefsManager.h" #include "GameManager.h" #include "GameState.h" +#include "RageException.h" +#include "RageTimer.h" + const float HOLD_NOTE_BITS_PER_BEAT = 6; const float HOLD_NOTE_BITS_PER_ROW = HOLD_NOTE_BITS_PER_BEAT / ELEMENTS_PER_BEAT; @@ -41,11 +44,11 @@ NoteField::NoteField() } -void NoteField::Load( NoteData* pNoteData, PlayerNumber p, StyleDef* pStyleDef, PlayerOptions po, float fNumBeatsToDrawBehind, float fNumBeatsToDrawAhead, NoteFieldMode mode ) +void NoteField::Load( NoteData* pNoteData, PlayerNumber p, StyleDef* pStyleDef, PlayerOptions po, int iPixelsToDrawBehind, int iPixelsToDrawAhead, NoteFieldMode mode ) { m_PlayerOptions = po; - m_fNumBeatsToDrawBehind = fNumBeatsToDrawBehind; - m_fNumBeatsToDrawAhead = fNumBeatsToDrawAhead; + m_iPixelsToDrawBehind = iPixelsToDrawBehind; + m_iPixelsToDrawAhead = iPixelsToDrawAhead; m_Mode = mode; this->CopyAll( pNoteData ); @@ -56,8 +59,7 @@ void NoteField::Load( NoteData* pNoteData, PlayerNumber p, StyleDef* pStyleDef, CArray arrayTweenColors; GAMEMAN->GetTweenColors( c, arrayTweenColors ); - m_ColorNote[c].m_sprColorPart.Load( GAMEMAN->GetPathTo(c, GRAPHIC_NOTE_COLOR_PART) ); - m_ColorNote[c].m_sprGrayPart.Load( GAMEMAN->GetPathTo(c, GRAPHIC_NOTE_GRAY_PART) ); + m_ColorNote[c].Load( c, p ); } @@ -194,9 +196,10 @@ void NoteField::DrawPrimitives() int iBaseFrameNo = (int)(m_fSongBeat*2.5) % NUM_FRAMES_IN_COLOR_ARROW_SPRITE; // 2.5 is a "fudge number" :-) This should be based on BPM - int iIndexFirstArrowToDraw = BeatToNoteRow( m_fSongBeat - m_fNumBeatsToDrawBehind ); // 2 beats earlier - if( iIndexFirstArrowToDraw < 0 ) iIndexFirstArrowToDraw = 0; - int iIndexLastArrowToDraw = BeatToNoteRow( m_fSongBeat + m_fNumBeatsToDrawAhead ); // 7 beats later + const float fBeatsToDrawBehind = m_iPixelsToDrawBehind * (1/(float)ARROW_SIZE) * (1/m_PlayerOptions.m_fArrowScrollSpeed); + const float fBeatsToDrawAhead = m_iPixelsToDrawAhead * (1/(float)ARROW_SIZE) * (1/m_PlayerOptions.m_fArrowScrollSpeed); + const int iIndexFirstArrowToDraw = max( 0, BeatToNoteRow( m_fSongBeat - fBeatsToDrawBehind ) ); + const int iIndexLastArrowToDraw = BeatToNoteRow( m_fSongBeat + fBeatsToDrawAhead ); //LOG->WriteLine( "Drawing elements %d through %d", iIndexFirstArrowToDraw, iIndexLastArrowToDraw ); @@ -290,7 +293,7 @@ void NoteField::DrawPrimitives() 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 ); + const float fStartDrawingAtBeat = froundf( (float)hn.m_iStartIndex, ROWS_BETWEEN_HOLD_BITS/m_PlayerOptions.m_fArrowScrollSpeed ); for( float j=fStartDrawingAtBeat; j<=hn.m_iEndIndex; j+=ROWS_BETWEEN_HOLD_BITS/m_PlayerOptions.m_fArrowScrollSpeed ) // for each bit of the hold diff --git a/stepmania/src/NoteField.h b/stepmania/src/NoteField.h index f6a0fd0d48..e7e201ce5a 100644 --- a/stepmania/src/NoteField.h +++ b/stepmania/src/NoteField.h @@ -37,7 +37,7 @@ public: MODE_EDITING, }; - void Load( NoteData* pNoteData, PlayerNumber p, StyleDef* pStyleDef, PlayerOptions po, float fNumArrowsToDrawBehind, float fNumArrowsToDrawAhead, NoteFieldMode mode ); + void Load( NoteData* pNoteData, PlayerNumber p, StyleDef* pStyleDef, PlayerOptions po, int iPixelsToDrawBehind, int iPixelsToDrawAhead, NoteFieldMode mode ); void RemoveTapNoteRow( int iIndex ); void SetHoldNoteLife( int iIndex, float fLife ); @@ -57,8 +57,8 @@ protected: PlayerOptions m_PlayerOptions; - float m_fNumBeatsToDrawBehind; - float m_fNumBeatsToDrawAhead; + int m_iPixelsToDrawBehind; + int m_iPixelsToDrawAhead; float m_fSongBeat; diff --git a/stepmania/src/Notes.cpp b/stepmania/src/Notes.cpp index ee9befbedb..cc3d8b9904 100644 --- a/stepmania/src/Notes.cpp +++ b/stepmania/src/Notes.cpp @@ -3,10 +3,10 @@ ----------------------------------------------------------------------------- Class: Notes - Desc: Hold Notes data and metadata. Does not hold gameplay-time information, - like keeping track of which Notes have been stepped on (PlayerSteps does that). + Desc: See header. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ @@ -20,6 +20,7 @@ #include "NoteData.h" #include "GameInput.h" +#include "RageException.h" typedef int DanceNote; @@ -305,7 +306,7 @@ bool Notes::LoadFromBMSFile( const CString &sPath ) -void DWIcharToNote( char c, InstrumentNumber i, DanceNote ¬e1Out, DanceNote ¬e2Out ) +void DWIcharToNote( char c, GameController i, DanceNote ¬e1Out, DanceNote ¬e2Out ) { switch( c ) { @@ -337,9 +338,9 @@ void DWIcharToNote( char c, InstrumentNumber i, DanceNote ¬e1Out, DanceNote & switch( i ) { - case INSTRUMENT_1: + case GAME_CONTROLLER_1: break; - case INSTRUMENT_2: + case GAME_CONTROLLER_2: if( note1Out != DANCE_NOTE_NONE ) note1Out += 6; if( note2Out != DANCE_NOTE_NONE ) @@ -474,7 +475,7 @@ bool Notes::LoadFromDWITokens( char holdChar = sStepData[i++]; DanceNote note1, note2; - DWIcharToNote( holdChar, (InstrumentNumber)pad, note1, note2 ); + DWIcharToNote( holdChar, (GameController)pad, note1, note2 ); if( note1 != DANCE_NOTE_NONE ) { @@ -493,7 +494,7 @@ bool Notes::LoadFromDWITokens( int iIndex = BeatToNoteRow( (float)fCurrentBeat ); DanceNote note1, note2; - DWIcharToNote( c, (InstrumentNumber)pad, note1, note2 ); + DWIcharToNote( c, (GameController)pad, note1, note2 ); if( note1 != DANCE_NOTE_NONE ) { @@ -610,7 +611,8 @@ DifficultyClass Notes::DifficultyClassFromDescriptionAndMeter( CString sDescript { sDescription.MakeLower(); - const CString sDescriptionParts[NUM_DIFFICULTY_CLASSES][4] = { + const int DESCRIPTIONS_PER_CLASS = 4; + const CString sDescriptionParts[NUM_DIFFICULTY_CLASSES][DESCRIPTIONS_PER_CLASS] = { { "easy", "basic", @@ -632,7 +634,7 @@ DifficultyClass Notes::DifficultyClassFromDescriptionAndMeter( CString sDescript }; for( int i=0; iMakeLittle(); - m_NoteField.Load( (NoteData*)this, player_no, pStyleDef, po, 1.5f, 5.5f, NoteField::MODE_DANCING ); + int iPixelsToDrawBefore = 64; + int iPixelsToDrawAfter = 320; + switch( po.m_EffectType ) + { + case PlayerOptions::EFFECT_MINI: iPixelsToDrawBefore *= 2; iPixelsToDrawAfter *= 2; break; + case PlayerOptions::EFFECT_SPACE: iPixelsToDrawBefore *= 2; iPixelsToDrawAfter *= 2; break; + } + + m_NoteField.Load( (NoteData*)this, player_no, pStyleDef, po, iPixelsToDrawBefore, iPixelsToDrawAfter, NoteField::MODE_DANCING ); m_GrayArrowRow.Load( player_no, pStyleDef, po ); m_GhostArrowRow.Load( player_no, pStyleDef, po ); @@ -100,6 +108,13 @@ void Player::Load( PlayerNumber player_no, StyleDef* pStyleDef, NoteData* pNoteD m_NoteField.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - ARROWS_Y : ARROWS_Y ); m_GrayArrowRow.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - ARROWS_Y : ARROWS_Y ); m_GhostArrowRow.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - ARROWS_Y : ARROWS_Y ); + + if( po.m_EffectType == PlayerOptions::EFFECT_MINI ) + { + m_NoteField.SetZoom( 0.5f ); + m_GrayArrowRow.SetZoom( 0.5f ); + m_GhostArrowRow.SetZoom( 0.5f ); + } } void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference ) @@ -205,10 +220,6 @@ void Player::DrawPrimitives() if( m_PlayerOptions.m_EffectType == PlayerOptions::EFFECT_SPACE ) { - // turn off Z Buffering - DISPLAY->GetDevice()->SetRenderState( D3DRS_ZENABLE, FALSE ); - DISPLAY->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, FALSE ); - // save old view and projection DISPLAY->GetDevice()->GetTransform( D3DTS_VIEW, &matOldView ); DISPLAY->GetDevice()->GetTransform( D3DTS_PROJECTION, &matOldProj ); @@ -216,10 +227,21 @@ void Player::DrawPrimitives() // construct view and project matrix D3DXMATRIX matNewView; - D3DXMatrixLookAtLH( &matNewView, &D3DXVECTOR3( CENTER_X, GetY()+800.0f, 300.0f ), - &D3DXVECTOR3( CENTER_X - , GetY()+400.0f, 0.0f ), - &D3DXVECTOR3( 0.0f, -1.0f, 0.0f ) ); + if( m_PlayerOptions.m_bReverseScroll ) + D3DXMatrixLookAtLH( + &matNewView, + &D3DXVECTOR3( CENTER_X, GetY()-300.0f, 400.0f ), + &D3DXVECTOR3( CENTER_X, GetY()+100.0f, 0.0f ), + &D3DXVECTOR3( 0.0f, -1.0f, 0.0f ) + ); + else + D3DXMatrixLookAtLH( + &matNewView, + &D3DXVECTOR3( CENTER_X, GetY()+800.0f, 400.0f ), + &D3DXVECTOR3( CENTER_X, GetY()+400.0f, 0.0f ), + &D3DXVECTOR3( 0.0f, -1.0f, 0.0f ) + ); + DISPLAY->GetDevice()->SetTransform( D3DTS_VIEW, &matNewView ); D3DXMATRIX matNewProj; @@ -238,10 +260,6 @@ void Player::DrawPrimitives() // restire old view and projection DISPLAY->GetDevice()->SetTransform( D3DTS_VIEW, &matOldView ); DISPLAY->GetDevice()->SetTransform( D3DTS_PROJECTION, &matOldProj ); - - // turn Z Buffering back on - DISPLAY->GetDevice()->SetRenderState( D3DRS_ZENABLE, TRUE ); - DISPLAY->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, TRUE ); } m_frameJudgement.Draw(); @@ -367,6 +385,7 @@ void Player::OnRowDestroyed( float fSongBeat, int col, float fMaxBeatDiff, int i m_pScore->AddToScore( score, m_Combo.GetCurrentCombo() ); // update score - called once per note in this row // update dance points for Oni lifemeter + if( GAMESTATE->m_aGameplayStatistics.GetSize() > 0 ) GAMESTATE->GetLatestGameplayStatistics().iActualDancePoints[m_PlayerNumber] += TapNoteScoreToDancePoints( score ); // update combo - called once per note in this row diff --git a/stepmania/src/PlayerOptions.cpp b/stepmania/src/PlayerOptions.cpp new file mode 100644 index 0000000000..46d2059b4c --- /dev/null +++ b/stepmania/src/PlayerOptions.cpp @@ -0,0 +1,62 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: PlayerOptions + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "PlayerOptions.h" +#include "RageUtil.h" + + +CString PlayerOptions::GetString() +{ + CString sReturn; + if( m_fArrowScrollSpeed != 1 ) + sReturn += ssprintf( "%2.1fX, ", m_fArrowScrollSpeed ); + switch( m_EffectType ) + { + case EFFECT_NONE: break; + case EFFECT_BOOST: sReturn += "Boost, "; break; + case EFFECT_WAVE: sReturn += "Wave, "; break; + case EFFECT_DRUNK: sReturn += "Drunk, "; break; + case EFFECT_DIZZY: sReturn += "Dizzy, "; break; + case EFFECT_SPACE: sReturn += "Space, "; break; + case EFFECT_MINI: sReturn += "Mini, "; break; + default: ASSERT(0); // invalid EFFECT + } + switch( m_AppearanceType ) + { + case APPEARANCE_VISIBLE: break; + case APPEARANCE_HIDDEN: sReturn += "Hidden, "; break; + case APPEARANCE_SUDDEN: sReturn += "Sudden, "; break; + case APPEARANCE_STEALTH: sReturn += "Stealth, "; break; + default: ASSERT(0); // invalid EFFECT + } + switch( m_TurnType ) + { + case TURN_NONE: break; + case TURN_MIRROR: sReturn += "Mirror, "; break; + case TURN_LEFT: sReturn += "Left, "; break; + case TURN_RIGHT: sReturn += "Right, "; break; + case TURN_SHUFFLE: sReturn += "Shuffle, "; break; + default: ASSERT(0); // invalid EFFECT + } + if( m_bLittle ) + sReturn += "Little, "; + if( m_bReverseScroll ) + sReturn += "Reverse, "; + + if( sReturn.GetLength() > 2 ) + sReturn.Delete( sReturn.GetLength()-2, 2 ); // delete the trailing ", " + return sReturn; +} + +void PlayerOptions::FromString( CString sOptions ) +{ +} \ No newline at end of file diff --git a/stepmania/src/PlayerOptions.h b/stepmania/src/PlayerOptions.h new file mode 100644 index 0000000000..93c09c051f --- /dev/null +++ b/stepmania/src/PlayerOptions.h @@ -0,0 +1,43 @@ +#pragma once +/* +----------------------------------------------------------------------------- + Class: PlayerOptions + + Desc: Per-player options that are not saved between sessions. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +struct PlayerOptions +{ + float m_fArrowScrollSpeed; + enum EffectType { EFFECT_NONE=0, EFFECT_BOOST, EFFECT_WAVE, EFFECT_DRUNK, EFFECT_DIZZY, EFFECT_SPACE, EFFECT_MINI }; + EffectType m_EffectType; + enum AppearanceType { APPEARANCE_VISIBLE=0, APPEARANCE_HIDDEN, APPEARANCE_SUDDEN, APPEARANCE_STEALTH }; + AppearanceType m_AppearanceType; + enum TurnType { TURN_NONE=0, TURN_MIRROR, TURN_LEFT, TURN_RIGHT, TURN_SHUFFLE }; + TurnType m_TurnType; + bool m_bLittle; + bool m_bReverseScroll; + enum ColorType { COLOR_ARCADE=0, COLOR_NOTE, COLOR_FLAT, COLOR_PLAIN }; + ColorType m_ColorType; + bool m_bHoldNotes; + bool m_bDark; + + PlayerOptions() + { + m_fArrowScrollSpeed = 1.0f; + m_EffectType = EFFECT_NONE; + m_AppearanceType = APPEARANCE_VISIBLE; + m_TurnType = TURN_NONE; + m_bLittle = false; + m_bReverseScroll = false; + m_ColorType = COLOR_ARCADE; + m_bHoldNotes = true; + m_bDark = false; + }; + CString GetString(); + void FromString( CString sOptions ); +}; diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 0d087853be..bfc8aea548 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -14,6 +14,7 @@ #include "IniFile.h" #include "GameManager.h" #include "GameState.h" +#include "RageException.h" PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program @@ -24,7 +25,7 @@ PrefsManager::PrefsManager() m_bWindowed = false; m_iDisplayResolution = 640; m_iTextureResolution = 512; - m_iRefreshRate = 60; + m_iRefreshRate = 0; m_bIgnoreJoyAxes = false; m_bShowFPS = false; m_BackgroundMode = BGMODE_ANIMATIONS; @@ -73,7 +74,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame ) { Game game; if( ini.GetValueI("Options", "Game", (int&)game) ) - GAMESTATE->SwitchGame( game ); + GAMESTATE->m_CurGame = game; } } @@ -99,7 +100,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() ini.SetValue( "Options", "SongFolders", join(",", m_asSongFolders) ); - ini.SetValueI( "Options", "Game", GAMESTATE->GetCurGame() ); + ini.SetValueI( "Options", "Game", GAMESTATE->m_CurGame ); ini.WriteFile(); } @@ -142,3 +143,19 @@ void PrefsManager::SaveGamePrefsToDisk() ini.WriteFile(); } + + +int PrefsManager::GetDisplayHeight() +{ + switch( m_iDisplayResolution ) + { + case 1280: return 1024; break; + case 1024: return 768; break; + case 800: return 600; break; + case 640: return 480; break; + case 512: return 384; break; + case 400: return 300; break; + case 320: return 240; break; + default: throw RageException( "Invalid DisplayWidth '%d'", m_iDisplayResolution ); return 480; + } +} diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index cbb657c90d..313e89fce0 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -30,7 +30,7 @@ public: bool m_bWindowed; int m_iDisplayResolution; int m_iTextureResolution; - int m_iRefreshRate; + int m_iRefreshRate; // 0 means 'default' bool m_bIgnoreJoyAxes; bool m_bShowFPS; BackgroundMode m_BackgroundMode; @@ -43,20 +43,7 @@ public: CStringArray m_asSongFolders; - int GetDisplayHeight() - { - switch( m_iDisplayResolution ) - { - case 1280: return 1024; break; - case 1024: return 768; break; - case 800: return 600; break; - case 640: return 480; break; - case 512: return 384; break; - case 400: return 300; break; - case 320: return 240; break; - default: throw RageException( "Invalid DisplayWidth '%d'", m_iDisplayResolution ); return 480; - } - } + int GetDisplayHeight(); void ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame ); void SaveGlobalPrefsToDisk(); diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index 8de883ba40..5a70266938 100644 --- a/stepmania/src/RageBitmapTexture.cpp +++ b/stepmania/src/RageBitmapTexture.cpp @@ -24,6 +24,7 @@ #include "DXUtil.h" #include "RageUtil.h" #include "RageLog.h" +#include "RageException.h" diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index 32e327ed01..729cabef32 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -14,6 +14,8 @@ #include "RageUtil.h" #include "RageLog.h" +#include "RageTimer.h" +#include "RageException.h" RageDisplay* DISPLAY = NULL; diff --git a/stepmania/src/RageInput.cpp b/stepmania/src/RageInput.cpp index b7cb596237..135c82a7d2 100644 --- a/stepmania/src/RageInput.cpp +++ b/stepmania/src/RageInput.cpp @@ -25,6 +25,7 @@ #include #include "RageUtil.h" #include "RageLog.h" +#include "RageException.h" diff --git a/stepmania/src/RageMovieTexture.cpp b/stepmania/src/RageMovieTexture.cpp index 3ede8f5bf9..e88e9f58bd 100644 --- a/stepmania/src/RageMovieTexture.cpp +++ b/stepmania/src/RageMovieTexture.cpp @@ -32,6 +32,7 @@ #include "DXUtil.h" #include "RageUtil.h" #include "RageLog.h" +#include "RageException.h" #include diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index 1822939868..5eaf67dd2f 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -13,6 +13,7 @@ #include "RageSound.h" #include "RageUtil.h" #include "RageLog.h" +#include "RageException.h" #include "bass/bass.h" diff --git a/stepmania/src/RageTextureManager.cpp b/stepmania/src/RageTextureManager.cpp index 740ff38cbd..960796cef5 100644 --- a/stepmania/src/RageTextureManager.cpp +++ b/stepmania/src/RageTextureManager.cpp @@ -19,6 +19,7 @@ #include "RageMovieTexture.h" #include "RageUtil.h" #include "RageLog.h" +#include "RageException.h" RageTextureManager* TEXTUREMAN = NULL; diff --git a/stepmania/src/ScoreDisplay.h b/stepmania/src/ScoreDisplay.h index c82bf54ddc..453031135d 100644 --- a/stepmania/src/ScoreDisplay.h +++ b/stepmania/src/ScoreDisplay.h @@ -14,6 +14,7 @@ #include "Song.h" #include "ActorFrame.h" #include "BitmapText.h" +#include "PlayerOptions.h" diff --git a/stepmania/src/Screen.h b/stepmania/src/Screen.h index 6170e793e7..882865ccbf 100644 --- a/stepmania/src/Screen.h +++ b/stepmania/src/Screen.h @@ -55,7 +55,7 @@ public: virtual void MenuLeft( const PlayerNumber p, const InputEventType type ) { if( type==IET_FIRST_PRESS) MenuLeft(p); }; virtual void MenuRight( const PlayerNumber p, const InputEventType type ) { if( type==IET_FIRST_PRESS) MenuRight(p); }; virtual void MenuStart( const PlayerNumber p, const InputEventType type ) { if( type==IET_FIRST_PRESS) MenuStart(p); }; - virtual void MenuBack( const PlayerNumber p, const InputEventType type ) { if( type==IET_FIRST_PRESS) MenuBack(p); }; + virtual void MenuBack( const PlayerNumber p, const InputEventType type ) { if( type==IET_SLOW_REPEAT) MenuBack(p); }; virtual void MenuUp( const PlayerNumber p ) {}; virtual void MenuDown( const PlayerNumber p ) {}; diff --git a/stepmania/src/ScreenAppearanceOptions.cpp b/stepmania/src/ScreenAppearanceOptions.cpp index 232dbd06a7..dbfa2f53fd 100644 --- a/stepmania/src/ScreenAppearanceOptions.cpp +++ b/stepmania/src/ScreenAppearanceOptions.cpp @@ -95,12 +95,12 @@ void ScreenAppearanceOptions::ImportOptions() m_OptionLineData[AO_THEME].iNumOptions = arrayThemeNames.GetSize() + 1; for( i=0; iGetCurThemeName()) ) { @@ -161,8 +161,8 @@ void ScreenAppearanceOptions::GoToPrevState() void ScreenAppearanceOptions::GoToNextState() { + PREFSMAN->SaveGamePrefsToDisk(); SCREENMAN->SetNewScreen( new ScreenTitleMenu ); - PREFSMAN->SaveGlobalPrefsToDisk(); } diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index dcdb039f18..328d5fe56c 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -440,6 +440,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ pNotes->SetNoteData( (NoteData*)&m_NoteFieldEdit ); GAMESTATE->m_pCurSong->SaveToSMFile(); + SOUND->PlayOnceStreamed( THEME->GetPathTo(SOUND_EDIT_SAVE) ); } break; case DIK_UP: diff --git a/stepmania/src/ScreenEditMenu.cpp b/stepmania/src/ScreenEditMenu.cpp index bafecf68dc..b64f48db01 100644 --- a/stepmania/src/ScreenEditMenu.cpp +++ b/stepmania/src/ScreenEditMenu.cpp @@ -113,8 +113,8 @@ ScreenEditMenu::ScreenEditMenu() m_Menu.Load( THEME->GetPathTo(GRAPHIC_EDIT_BACKGROUND), THEME->GetPathTo(GRAPHIC_EDIT_TOP_EDGE), - ssprintf("%s %s change music START to continue", CString(char(1)), CString(char(2)) ), - false, true, 40 + ssprintf("%c %c change line %c %c change value START to continue", char(3), char(4), char(1), char(2) ), + false, false, 40 ); this->AddSubActor( &m_Menu ); @@ -173,7 +173,9 @@ void ScreenEditMenu::HandleScreenMessage( const ScreenMessage SM ) // Set the current Style, then let ScreenEdit infer the desired // NotesType from that Style. NotesType nt = GetSelectedNotesType(); - GAMESTATE->m_CurStyle = GAMEMAN->GetStyleThatPlaysNotesType( nt ); + Style style = GAMEMAN->GetStyleThatPlaysNotesType( nt ); + GAMESTATE->m_CurStyle = style; + GAMESTATE->m_CurGame = StyleToGame(style); SCREENMAN->SetNewScreen( new ScreenEdit ); break; diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 9b236e922a..55acb59a32 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -131,7 +131,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) // Andy: // Fake COOL! / GOOD / OOPS for Ez2dancer using the DDR Rankings. - if( GAMESTATE->GetCurGame() == GAME_EZ2 ) + if( GAMESTATE->m_CurGame == GAME_EZ2 ) { for( int p=0; pGetCurGame() != GAME_EZ2 ) + if( GAMESTATE->m_CurGame != GAME_EZ2 ) { switch( m_ResultMode ) { @@ -178,7 +178,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) } break; case RM_ONI: - m_BannerWithFrame[0].LoadFromGroup( GAMESTATE->m_sPreferredGroup ); + m_BannerWithFrame[0].LoadFromCourse( GAMESTATE->m_pCurCourse ); m_BannerWithFrame[0].SetXY( BANNER_X, BANNER_Y ); this->AddSubActor( &m_BannerWithFrame[0] ); break; @@ -201,7 +201,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) for( l=0; lGetCurGame() != GAME_EZ2) + if (GAMESTATE->m_CurGame != GAME_EZ2) { m_sprJudgeLabels[l].Load( THEME->GetPathTo(GRAPHIC_EVALUATION_JUDGE_LABELS) ); m_sprJudgeLabels[l].StopAnimating(); @@ -222,23 +222,23 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) // RE-ARRANGE the scoreboard for EZ2Dancer Scoring - if (l == 0 && GAMESTATE->GetCurGame() == GAME_EZ2) // Change Position For Ez2dancer + if (l == 0 && GAMESTATE->m_CurGame == GAME_EZ2) // Change Position For Ez2dancer { m_textJudgeNumbers[l][p].SetXY( JUDGE_NUMBERS_X_EZ2[p], JUDGE_EZ2_COOL_Y); } - else if (l == 2 && GAMESTATE->GetCurGame() == GAME_EZ2) + else if (l == 2 && GAMESTATE->m_CurGame == GAME_EZ2) { m_textJudgeNumbers[l][p].SetXY( JUDGE_NUMBERS_X_EZ2[p], JUDGE_EZ2_COOL_Y + 55); } - else if (l == 4 && GAMESTATE->GetCurGame() == GAME_EZ2) + else if (l == 4 && GAMESTATE->m_CurGame == GAME_EZ2) { m_textJudgeNumbers[l][p].SetXY( JUDGE_NUMBERS_X_EZ2[p], JUDGE_EZ2_COOL_Y + 120); } - else if ((l == 1 || l == 3 ) && GAMESTATE->GetCurGame() == GAME_EZ2) + else if ((l == 1 || l == 3 ) && GAMESTATE->m_CurGame == GAME_EZ2) { m_textJudgeNumbers[l][p].SetZoomX(0); // Hide These Ones } - else if (l == 5 && GAMESTATE->GetCurGame() == GAME_EZ2 ) // sneakily use this one for the max combo. + else if (l == 5 && GAMESTATE->m_CurGame == GAME_EZ2 ) // sneakily use this one for the max combo. { if (p == PLAYER_1 ) { @@ -254,7 +254,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) } } - if (GAMESTATE->GetCurGame() != GAME_EZ2) + if (GAMESTATE->m_CurGame != GAME_EZ2) { m_sprScoreLabel.Load( THEME->GetPathTo(GRAPHIC_EVALUATION_SCORE_LABELS) ); m_sprScoreLabel.StopAnimating(); @@ -265,7 +265,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) for( p=0; pIsPlayerEnabled( (PlayerNumber)p ) || GAMESTATE->GetCurGame() == GAME_EZ2 ) + if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) || GAMESTATE->m_CurGame == GAME_EZ2 ) continue; // skip m_ScoreDisplay[p].SetXY( SCORE_DISPLAY_X[p], SCORE_Y ); @@ -309,7 +309,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) // SNEAKY! We take the max combo, and put it into element 5, because Ez2dancer // doesn't care for OK's and plus this text element is already nicely aligned =) - if (GAMESTATE->GetCurGame() == GAME_EZ2) + if (GAMESTATE->m_CurGame == GAME_EZ2) { m_textJudgeNumbers[5][p].SetText( ssprintf("%4d", totalGS.max_combo[p]) ); } @@ -370,7 +370,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) ) continue; // skip - if ( GAMESTATE->GetCurGame() != GAME_EZ2) + if ( GAMESTATE->m_CurGame != GAME_EZ2) { m_sprGradeFrame[p].Load( THEME->GetPathTo(GRAPHIC_EVALUATION_GRADE_FRAME) ); m_sprGradeFrame[p].StopAnimating(); @@ -401,7 +401,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) break; case RM_ARCADE_STAGE: case RM_ARCADE_SUMMARY: - if (GAMESTATE->GetCurGame() != GAME_EZ2 ) + if (GAMESTATE->m_CurGame != GAME_EZ2 ) { m_Grades[p].SetXY( GRADE_X[p], GRADE_Y ); m_Grades[p].SetZ( -2 ); @@ -430,7 +430,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) break; } - if ( GAMESTATE->GetCurGame() == GAME_EZ2) + if ( GAMESTATE->m_CurGame == GAME_EZ2) continue; m_BonusInfoFrame[p].SetXY( BONUS_FRAME_X[p], BONUS_FRAME_Y ); @@ -529,7 +529,7 @@ void ScreenEvaluation::TweenOnScreen() for( i=0; iGetCurGame() != GAME_EZ2) + if (GAMESTATE->m_CurGame != GAME_EZ2) { fOriginalY = m_sprJudgeLabels[i].GetY(); m_sprJudgeLabels[i].SetY( fOriginalY + SCREEN_HEIGHT ); @@ -548,7 +548,7 @@ void ScreenEvaluation::TweenOnScreen() } } - if (GAMESTATE->GetCurGame() != GAME_EZ2) + if (GAMESTATE->m_CurGame != GAME_EZ2) { fOriginalY = m_sprScoreLabel.GetY(); @@ -604,7 +604,7 @@ void ScreenEvaluation::TweenOffScreen() for( i=0; iGetCurGame() != GAME_EZ2) + if (GAMESTATE->m_CurGame != GAME_EZ2) { m_sprJudgeLabels[i].BeginTweeningQueued( MENU_ELEMENTS_TWEEN_TIME, Actor::TWEEN_BIAS_END ); m_sprJudgeLabels[i].SetTweenZoomY( 0 ); @@ -617,7 +617,7 @@ void ScreenEvaluation::TweenOffScreen() } } - if (GAMESTATE->GetCurGame() != GAME_EZ2) + if (GAMESTATE->m_CurGame != GAME_EZ2) { m_sprScoreLabel.BeginTweeningQueued( MENU_ELEMENTS_TWEEN_TIME, Actor::TWEEN_BIAS_END ); m_sprScoreLabel.SetTweenZoomY( 0 ); diff --git a/stepmania/src/ScreenEvaluation.h b/stepmania/src/ScreenEvaluation.h index c1d80fb2f9..a65efdab38 100644 --- a/stepmania/src/ScreenEvaluation.h +++ b/stepmania/src/ScreenEvaluation.h @@ -12,7 +12,6 @@ #include "Screen.h" #include "Sprite.h" -#include "Score.h" #include "RandomStream.h" #include "BitmapText.h" #include "GradeDisplay.h" diff --git a/stepmania/src/ScreenEz2SelectPlayer.cpp b/stepmania/src/ScreenEz2SelectPlayer.cpp index 2d18844a79..6a5a7357cd 100644 --- a/stepmania/src/ScreenEz2SelectPlayer.cpp +++ b/stepmania/src/ScreenEz2SelectPlayer.cpp @@ -23,6 +23,8 @@ Andrew Livy #include "AnnouncerManager.h" #include "ScreenEz2SelectStyle.h" #include "GameState.h" +#include "RageException.h" +#include "RageTimer.h" /* Constants */ diff --git a/stepmania/src/ScreenEz2SelectStyle.cpp b/stepmania/src/ScreenEz2SelectStyle.cpp index add48edefb..2701ebbe45 100644 --- a/stepmania/src/ScreenEz2SelectStyle.cpp +++ b/stepmania/src/ScreenEz2SelectStyle.cpp @@ -28,6 +28,8 @@ and sloppy and err needs cleaning up ;) #include "Background.h" #include "ScreenSelectGroup.h" #include "GameState.h" +#include "RageException.h" +#include "RageTimer.h" /* Constants */ diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 3ea6f9652b..e13f491cdd 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -15,6 +15,7 @@ #include "ScreenManager.h" #include "ScreenSelectMusic.h" +#include "ScreenSelectCourse.h" #include "ScreenEvaluation.h" #include "GameConstantsAndTypes.h" #include "PrefsManager.h" @@ -28,6 +29,7 @@ #include "GameState.h" #include "ScoreDisplayNormal.h" #include "ScoreDisplayOni.h" +#include "ScreenPrompt.h" // // Defines @@ -61,19 +63,19 @@ const float TIME_BETWEEN_DANCING_COMMENTS = 13; // received while STATE_DANCING const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+102); const ScreenMessage SM_LastNotesEnded = ScreenMessage(SM_User+103); -const ScreenMessage SM_LifeIs0 = ScreenMessage(SM_User+104); // received while STATE_OUTRO const ScreenMessage SM_ShowCleared = ScreenMessage(SM_User+111); const ScreenMessage SM_HideCleared = ScreenMessage(SM_User+112); -const ScreenMessage SM_GoToResults = ScreenMessage(SM_User+113); +const ScreenMessage SM_GoToScreenAfterBack = ScreenMessage(SM_User+113); +const ScreenMessage SM_GoToStateAfterCleared= ScreenMessage(SM_User+114); 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); @@ -81,6 +83,9 @@ ScreenGameplay::ScreenGameplay() { LOG->WriteLine( "ScreenGameplay::ScreenGameplay()" ); + m_bAutoPlayerWasOn = PREFSMAN->m_bAutoPlay; + m_bChangedOffsetOrBPM = false; + switch( GAMESTATE->m_PlayMode ) { case PLAY_MODE_ARCADE: @@ -116,7 +121,6 @@ ScreenGameplay::ScreenGameplay() m_DancingState = STATE_INTRO; m_fTimeLeftBeforeDancingComment = TIME_BETWEEN_DANCING_COMMENTS; - m_bBothHaveFailed = false; m_Background.SetDiffuseColor( D3DXCOLOR(0.4f,0.4f,0.4f,1) ); @@ -157,7 +161,7 @@ ScreenGameplay::ScreenGameplay() m_pLifeMeter[p]->SetXY( LIFE_LOCAL_X[p], LIFE_LOCAL_Y[p] ); m_frameTop.AddSubActor( m_pLifeMeter[p] ); - if( GAMESTATE->GetCurGame() == GAME_EZ2 ) + if( GAMESTATE->m_CurGame == GAME_EZ2 ) { m_pScoreDisplay[p]->SetXY( SCORE_LOCALEZ2_X[p], SCORE_LOCALEZ2_Y[p] ); m_pScoreDisplay[p]->SetZoom( 0.5f ); @@ -178,7 +182,7 @@ ScreenGameplay::ScreenGameplay() m_textStageNumber.SetText( GAMESTATE->GetStageText() ); m_textStageNumber.SetDiffuseColor( GAMESTATE->GetStageColor() ); - if( GAMESTATE->GetCurGame() == GAME_EZ2 ) + if( GAMESTATE->m_CurGame == GAME_EZ2 ) { m_textStageNumber.SetXY( STAGE_NUMBER_LOCAL_X, STAGE_NUMBER_LOCALEZ2_Y ); } @@ -202,7 +206,7 @@ ScreenGameplay::ScreenGameplay() m_frameBottom.SetXY( CENTER_X, SCREEN_BOTTOM - m_sprBottomFrame.GetZoomedHeight()/2 ); - if( GAMESTATE->GetCurGame() != GAME_EZ2 ) + if( GAMESTATE->m_CurGame != GAME_EZ2 ) { m_sprBottomFrame.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_BOTTOM_FRAME) ); m_frameBottom.AddSubActor( &m_sprBottomFrame ); @@ -235,7 +239,7 @@ ScreenGameplay::ScreenGameplay() if( !GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) ) continue; - if( GAMESTATE->GetCurGame() != GAME_EZ2 ) + if( GAMESTATE->m_CurGame != GAME_EZ2 ) { m_pScoreDisplay[p]->SetXY( SCORE_LOCAL_X[p], SCORE_LOCAL_Y[p] ); m_pScoreDisplay[p]->SetZoom( 0.8f ); @@ -269,7 +273,7 @@ ScreenGameplay::ScreenGameplay() m_DifficultyBanner[p].SetXY( DIFFICULTY_X[p], fDifficultyY ); this->AddSubActor( &m_DifficultyBanner[p] ); - if( GAMESTATE->GetCurGame() != GAME_EZ2 ) + if( GAMESTATE->m_CurGame != GAME_EZ2 ) { float fDifficultyY = DIFFICULTY_Y[p]; if( GAMESTATE->m_PlayerOptions[p].m_bReverseScroll ) @@ -287,8 +291,6 @@ ScreenGameplay::ScreenGameplay() - - m_StarWipe.SetClosed(); this->AddSubActor( &m_StarWipe ); @@ -312,6 +314,10 @@ ScreenGameplay::ScreenGameplay() m_sprFailed.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); this->AddSubActor( &m_sprFailed ); + m_Fade.SetClosed(); + m_Fade.SetOpened(); + this->AddSubActor( &m_Fade ); + m_soundFail.Load( THEME->GetPathTo(SOUND_GAMEPLAY_FAILED) ); @@ -445,6 +451,42 @@ void ScreenGameplay::LoadNextSong( bool bPlayMusic ) m_pLifeMeter[p]->NextSong( NULL ); } +bool ScreenGameplay::OneIsHot() +{ + for( int p=0; pIsPlayerEnabled(PlayerNumber(p)) ) + if( !m_pLifeMeter[p]->IsHot() ) + return true; + return false; +} + +bool ScreenGameplay::AllAreInDanger() +{ + for( int p=0; pIsPlayerEnabled(PlayerNumber(p)) ) + if( !m_pLifeMeter[p]->IsInDanger() ) + return false; + return true; +} + +bool ScreenGameplay::AllAreFailing() +{ + for( int p=0; pIsPlayerEnabled(PlayerNumber(p)) ) + if( !m_pLifeMeter[p]->IsFailing() ) + return false; + return true; +} + +bool ScreenGameplay::AllFailedEarlier() +{ + for( int p=0; pIsPlayerEnabled(p) ) + if( !m_pLifeMeter[p]->FailedEarlier() ) + return false; + return true; +} + void ScreenGameplay::Update( float fDeltaTime ) { @@ -484,45 +526,6 @@ void ScreenGameplay::Update( float fDeltaTime ) m_Player[p].Update( fDeltaTime, fSongBeat, fMaxBeatDifference ); } - // check for fail - switch( GAMESTATE->m_SongOptions.m_FailType ) - { - case SongOptions::FAIL_ARCADE: - case SongOptions::FAIL_END_OF_SONG: - { - - if( m_bBothHaveFailed ) - break; // if they have already failed, don't bother checking again - - // check for both players fail - bool bAllInDanger = true; - bool bAllAreFailing = true; - for( int p=0; pIsPlayerEnabled(PlayerNumber(p)) ) - continue; - - if( !m_pLifeMeter[p]->IsInDanger() ) - bAllInDanger = false; - - if( !m_pLifeMeter[p]->IsFailing() ) - bAllAreFailing = false; - } - - if( bAllInDanger ) m_Background.TurnDangerOn(); - else m_Background.TurnDangerOff(); - - if( bAllAreFailing ) - { - m_bBothHaveFailed = true; - SCREENMAN->SendMessageToTopScreen( SM_LifeIs0, 0 ); - } - } - break; - case SongOptions::FAIL_OFF: - break; - } - // update seconds into play for( p=0; pIsPlayerEnabled((PlayerNumber)p) && !m_pLifeMeter[p]->FailedEarlier() ) @@ -533,29 +536,44 @@ void ScreenGameplay::Update( float fDeltaTime ) { case STATE_DANCING: + // // Check for end of song + // if( fSongBeat > GAMESTATE->m_pCurSong->m_fLastBeat+4 ) this->SendScreenMessage( SM_NotesEnded, 0 ); + // + // check for fail + // + switch( GAMESTATE->m_SongOptions.m_FailType ) + { + case SongOptions::FAIL_ARCADE: + if( AllAreFailing() ) + SCREENMAN->SendMessageToTopScreen( SM_BeginFailed, 0 ); + + if( AllAreInDanger() ) + m_Background.TurnDangerOn(); + else + m_Background.TurnDangerOff(); + break; + case SongOptions::FAIL_END_OF_SONG: + case SongOptions::FAIL_OFF: + break; // don't check for fail + default: + ASSERT(0); + } + + // // Check to see if it's time to play a gameplay comment + // m_fTimeLeftBeforeDancingComment -= fDeltaTime; if( m_fTimeLeftBeforeDancingComment <= 0 ) { m_fTimeLeftBeforeDancingComment = TIME_BETWEEN_DANCING_COMMENTS; // reset for the next comment - bool bAllInDanger = true; - for( int p=0; pIsInDanger() ) - bAllInDanger = false; - - bool bOneIsHot = false; - for( p=0; pIsHot() ) - bOneIsHot = true; - - if( bOneIsHot ) + if( OneIsHot() ) m_announcerHot.PlayRandom(); - else if( bAllInDanger ) + else if( AllAreInDanger() ) m_announcerDanger.PlayRandom(); else m_announcerGood.PlayRandom(); @@ -620,28 +638,6 @@ void ScreenGameplay::Update( float fDeltaTime ) iRowLastCrossed = iRowNow; } - - // - if( m_bBothHaveFailed ) - { - for( int p=0; pIsPlayerEnabled((PlayerNumber)p) ) - continue; - - float fOverrideAdd = m_Player[p].GetOverrideAdd(); - if( fOverrideAdd == -1 ) - { - m_Player[p].SetOverrideAdd( 0 ); - } - else - { - float fNewAdd = min( 1, fOverrideAdd + fDeltaTime ); - m_Player[p].SetOverrideAdd( fNewAdd ); - } - - } - } } @@ -665,14 +661,52 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ { switch( DeviceI.button ) { - case DIK_F11: - case DIK_F12: + case DIK_F8: + PREFSMAN->m_bAutoPlay = !PREFSMAN->m_bAutoPlay; + m_bAutoPlayerWasOn &= PREFSMAN->m_bAutoPlay; + m_textDebug.SetText( ssprintf("Autoplayer %s.", (PREFSMAN->m_bAutoPlay ? "ON" : "OFF")) ); + 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; + case DIK_F9: + case DIK_F10: { + m_bChangedOffsetOrBPM = true; + float fOffsetDelta; switch( DeviceI.button ) { - case DIK_F11: fOffsetDelta = -0.025f; break; - case DIK_F12: fOffsetDelta = +0.025f; break; + case DIK_F9: fOffsetDelta = -0.025f; break; + case DIK_F10: fOffsetDelta = +0.025f; break; + default: ASSERT(0); + } + if( type == IET_FAST_REPEAT ) + fOffsetDelta *= 40; + BPMSegment& seg = GAMESTATE->m_pCurSong->GetBPMSegmentAtBeat( fSongBeat ); + + seg.m_fBPM += fOffsetDelta; + + m_textDebug.SetText( ssprintf("Cur BPM = %f.", GAMESTATE->m_pCurSong->m_fBeat0OffsetInSeconds) ); + 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; + case DIK_F11: + case DIK_F12: + { + m_bChangedOffsetOrBPM = true; + + float fOffsetDelta; + switch( DeviceI.button ) + { + case DIK_F11: fOffsetDelta = -0.02f; break; + case DIK_F12: fOffsetDelta = +0.02f; break; default: ASSERT(0); } if( type == IET_FAST_REPEAT ) @@ -691,26 +725,60 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ } } - - - if( MenuI.IsValid() && MenuI.button == MENU_BUTTON_BACK && type == IET_SLOW_REPEAT && m_DancingState == STATE_DANCING && !m_bBothHaveFailed ) + if( MenuI.IsValid() && MenuI.button == MENU_BUTTON_BACK && type == IET_SLOW_REPEAT ) { - m_bBothHaveFailed = true; - SCREENMAN->SendMessageToTopScreen( SM_BeginFailed, 0 ); + m_soundMusic.Stop(); + this->ClearMessageQueue(); + m_Fade.CloseWipingLeft( SM_GoToScreenAfterBack ); } - const float fMaxBeatDifference = fBPS * PREFSMAN->m_fJudgeWindow * GAMESTATE->m_SongOptions.m_fMusicRate; - - if( type == IET_FIRST_PRESS ) + // + // handle a step + // + if( m_DancingState == STATE_DANCING ) { - if( StyleI.IsValid() ) + const float fMaxBeatDifference = fBPS * PREFSMAN->m_fJudgeWindow * GAMESTATE->m_SongOptions.m_fMusicRate; + + if( type == IET_FIRST_PRESS ) { - if( GAMESTATE->IsPlayerEnabled( StyleI.player ) ) - m_Player[StyleI.player].HandlePlayerStep( fSongBeat, StyleI.col, fMaxBeatDifference ); + if( StyleI.IsValid() ) + { + if( GAMESTATE->IsPlayerEnabled( StyleI.player ) ) + m_Player[StyleI.player].HandlePlayerStep( fSongBeat, StyleI.col, fMaxBeatDifference ); + } } } } +void SaveChanges( void* pContext ) +{ + GAMESTATE->m_pCurSong->SaveToSMFile(); +} + +void DontSaveChanges( void* pContext ) +{ + GAMESTATE->m_pCurSong->LoadFromSMFile( GAMESTATE->m_pCurSong->GetCacheFilePath() ); +} + +void ShowSavePrompt( ScreenMessage SM_SendWhenDone ) +{ + SCREENMAN->AddScreenToTop( new ScreenPrompt( + SM_SendWhenDone, + ssprintf( + "You have changed the offset or BPM of\n" + "%s.\n" + "Would you like to save these changes back\n" + "to the song file?\n" + "Choosing NO will disgard your changes.", + GAMESTATE->m_pCurSong->GetFullTitle() ), + PROMPT_YES_NO, + true, + SaveChanges, + DontSaveChanges + ) + ); +} + void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) { switch( SM ) @@ -750,33 +818,32 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) break; // received while STATE_DANCING - case SM_LifeIs0: - if( GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_ARCADE ) // fail them now! - this->SendScreenMessage( SM_BeginFailed, 0 ); - m_DancingState = STATE_OUTRO; - break; case SM_NotesEnded: { for( int p=0; pIsPlayerEnabled( (PlayerNumber)p ) ) m_Player[p].SaveGameplayStatistics(); + GAMESTATE->GetLatestGameplayStatistics().bAutoPlayerWasOn = m_bAutoPlayerWasOn; LoadNextSong( true ); } break; case SM_LastNotesEnded: - if( m_DancingState == STATE_OUTRO ) // gameplay already ended - return; // ignore + { + if( m_DancingState == STATE_OUTRO ) // gameplay already ended + return; // ignore - if( m_bBothHaveFailed ) // fail them - { - this->SendScreenMessage( SM_BeginFailed, 0 ); + m_DancingState = STATE_OUTRO; + + if( GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_END_OF_SONG && AllFailedEarlier() ) + { + this->SendScreenMessage( SM_BeginFailed, 0 ); + } + else + { + m_StarWipe.CloseWipingRight( SM_ShowCleared ); + m_announcerCleared.PlayRandom(); // crowd cheer + } } - else // cleared - { - m_StarWipe.CloseWipingRight( SM_ShowCleared ); - m_announcerCleared.PlayRandom(); // crowd cheer - } - m_DancingState = STATE_OUTRO; break; case SM_100Combo: @@ -865,9 +932,23 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) break; case SM_HideCleared: m_sprCleared.StartBlurring(); - SCREENMAN->SendMessageToTopScreen( SM_GoToResults, 1 ); + SCREENMAN->SendMessageToTopScreen( SM_GoToStateAfterCleared, 1 ); break; - case SM_GoToResults: + case SM_GoToScreenAfterBack: + switch( GAMESTATE->m_PlayMode ) + { + case PLAY_MODE_ARCADE: SCREENMAN->SetNewScreen( new ScreenSelectMusic ); break; + case PLAY_MODE_ONI: SCREENMAN->SetNewScreen( new ScreenSelectCourse ); break; + default: ASSERT(0); + } + break; + case SM_GoToStateAfterCleared: + if( m_bChangedOffsetOrBPM ) + { + m_bChangedOffsetOrBPM = false; + ShowSavePrompt( SM_GoToStateAfterCleared ); + break; + } SCREENMAN->SetNewScreen( new ScreenEvaluation(false) ); break; @@ -896,9 +977,6 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) m_sprFailed.SetTweenZoom( 1.0f ); // come to rest m_sprFailed.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0.7f) ); // and fade in - // BUGFIX by ANDY: Stage will now reset back to 0 when game ends. - GAMESTATE->m_iCurrentStageIndex = 0; - SCREENMAN->SendMessageToTopScreen( SM_PlayFailComment, 1.5f ); SCREENMAN->SendMessageToTopScreen( SM_HideFailed, 3.0f ); break; @@ -913,8 +991,14 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) SCREENMAN->SendMessageToTopScreen( SM_GoToScreenAfterFail, 1.5f ); break; case SM_GoToScreenAfterFail: + if( m_bChangedOffsetOrBPM ) + { + m_bChangedOffsetOrBPM = false; + ShowSavePrompt( SM_GoToScreenAfterFail ); + break; + } if( PREFSMAN->m_bEventMode ) - SCREENMAN->SetNewScreen( new ScreenSelectMusic ); + this->SendScreenMessage( SM_GoToScreenAfterBack, 0 ); else SCREENMAN->SetNewScreen( new ScreenGameOver ); break; diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index c1538fd485..1cd9270be2 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -24,6 +24,7 @@ #include "LifeMeter.h" #include "ScoreDisplay.h" #include "DifficultyBanner.h" +#include "TransitionFadeWipe.h" // messages sent by Combo @@ -50,13 +51,6 @@ public: virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); virtual void HandleScreenMessage( const ScreenMessage SM ); - enum DancingState { - STATE_INTRO = 0, // not allowed to press Back - STATE_DANCING, - STATE_OUTRO, // not allowed to press Back - NUM_DANCING_STATES - }; - private: void TweenOnScreen(); @@ -64,12 +58,23 @@ private: void LoadNextSong( bool bPlayMusic ); + bool OneIsHot(); + bool AllAreInDanger(); + bool AllAreFailing(); + bool AllFailedEarlier(); + enum DancingState { + STATE_INTRO = 0, // not allowed to press Back + STATE_DANCING, + STATE_OUTRO, // not allowed to press Back + NUM_DANCING_STATES + }; DancingState m_DancingState; + bool m_bAutoPlayerWasOn; + bool m_bChangedOffsetOrBPM; 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 @@ -89,6 +94,7 @@ private: BitmapText m_textDebug; + TransitionFadeWipe m_Fade; TransitionStarWipe m_StarWipe; FocusingSprite m_sprReady; diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index fad5cbabfa..66204a8691 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -105,7 +105,7 @@ void ScreenManager::Draw() void ScreenManager::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { LOG->WriteLine( "ScreenManager::Input( %d-%d, %d-%d, %d-%d, %d-%d )", - DeviceI.device, DeviceI.button, GameI.number, GameI.button, MenuI.player, MenuI.button, StyleI.player, StyleI.col ); + DeviceI.device, DeviceI.button, GameI.controller, GameI.button, MenuI.player, MenuI.button, StyleI.player, StyleI.col ); // pass input only to topmost state if( m_ScreenStack.GetSize() > 0 ) @@ -124,13 +124,13 @@ void ScreenManager::SetNewScreen( Screen *pNewScreen ) void ScreenManager::AddScreenToTop( Screen *pNewScreen ) { // our responsibility to tell the old state that it's losing focus - m_ScreenStack[m_ScreenStack.GetSize()-1]->HandleScreenMessage( SM_LosingInputFocus ); +// m_ScreenStack[m_ScreenStack.GetSize()-1]->HandleScreenMessage( SM_LosingInputFocus ); // add the new state onto the back of the array m_ScreenStack.Add( pNewScreen ); } -void ScreenManager::PopTopScreen() +void ScreenManager::PopTopScreen( ScreenMessage SM ) { Screen* pScreenToPop = m_ScreenStack[m_ScreenStack.GetSize()-1]; // top menu //pScreenToPop->HandleScreenMessage( SM_LosingInputFocus ); @@ -138,7 +138,7 @@ void ScreenManager::PopTopScreen() m_ScreensToDelete.Add( pScreenToPop ); Screen* pNewTopScreen = m_ScreenStack[m_ScreenStack.GetSize()-1]; - pNewTopScreen->HandleScreenMessage( SM_RegainingInputFocus ); + pNewTopScreen->HandleScreenMessage( SM ); } void ScreenManager::SendMessageToTopScreen( ScreenMessage SM, float fDelay ) diff --git a/stepmania/src/ScreenManager.h b/stepmania/src/ScreenManager.h index 825ff7a4c7..35018c3b7b 100644 --- a/stepmania/src/ScreenManager.h +++ b/stepmania/src/ScreenManager.h @@ -34,7 +34,7 @@ public: void SetNewScreen( Screen *pNewScreen ); void AddScreenToTop( Screen *pNewScreen ); - void PopTopScreen(); + void PopTopScreen( ScreenMessage SM_SendToNewTopScreen ); void SystemMessage( CString sMessage ); diff --git a/stepmania/src/ScreenMessage.h b/stepmania/src/ScreenMessage.h index beba5b5714..5a550038ea 100644 --- a/stepmania/src/ScreenMessage.h +++ b/stepmania/src/ScreenMessage.h @@ -18,8 +18,6 @@ enum ScreenMessage { SM_DoneClosingWipingRight, SM_DoneOpeningWipingLeft, SM_DoneOpeningWipingRight, - SM_LosingInputFocus, - SM_RegainingInputFocus, SM_MenuTimer, SM_User = 100 }; diff --git a/stepmania/src/ScreenMusicScroll.cpp b/stepmania/src/ScreenMusicScroll.cpp index c2cc315dae..860b70c8ac 100644 --- a/stepmania/src/ScreenMusicScroll.cpp +++ b/stepmania/src/ScreenMusicScroll.cpp @@ -169,7 +169,7 @@ ScreenMusicScroll::ScreenMusicScroll() this->AddSubActor( &m_Fade ); - if ( GAMESTATE->GetCurGame() != GAME_EZ2 ) + if ( GAMESTATE->m_CurGame != GAME_EZ2 ) { m_soundMusic.Load( THEME->GetPathTo(SOUND_MUSIC_SCROLL_MUSIC) ); } @@ -179,7 +179,7 @@ ScreenMusicScroll::ScreenMusicScroll() } m_Fade.OpenWipingRight(); - if ( GAMESTATE->GetCurGame() != GAME_EZ2 ) + if ( GAMESTATE->m_CurGame != GAME_EZ2 ) { m_soundMusic.Play( true ); } diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 40fa6c89d8..e2c5423c67 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -35,12 +35,11 @@ enum { PO_COLOR, PO_HOLD_NOTES, PO_DARK, - PO_DRAIN, NUM_PLAYER_OPTIONS_LINES }; OptionLineData g_PlayerOptionsLines[NUM_PLAYER_OPTIONS_LINES] = { { "Speed", 8, {"x0.5","x0.75","x1","x1.5","x2","x3","x5","x8"} }, - { "Effect", 6, {"OFF","BOOST","WAVE", "DRUNK", "DIZZY", "SPACE"} }, + { "Effect", 7, {"OFF","BOOST","WAVE", "DRUNK", "DIZZY","SPACE","MINI"} }, { "Appear", 4, {"VISIBLE","HIDDEN","SUDDEN","STEALTH"} }, { "Turn", 5, {"OFF","MIRROR","LEFT","RIGHT","SHUFFLE"} }, { "Little", 2, {"OFF","ON"} }, @@ -48,11 +47,9 @@ OptionLineData g_PlayerOptionsLines[NUM_PLAYER_OPTIONS_LINES] = { { "Color", 4, {"ARCADE","NOTE","FLAT","PLAIN"} }, { "Holds", 2, {"OFF","ON"} }, { "Dark", 2, {"OFF","ON"} }, - { "Drain", 3, {"NORMAL", "NO-RECOVER", "SUDDEN-DEATH"} }, }; - ScreenPlayerOptions::ScreenPlayerOptions() : ScreenOptions( THEME->GetPathTo(GRAPHIC_PLAYER_OPTIONS_BACKGROUND), @@ -93,7 +90,6 @@ void ScreenPlayerOptions::ImportOptions() m_iSelectedOption[p][PO_COLOR] = po.m_ColorType; m_iSelectedOption[p][PO_HOLD_NOTES] = po.m_bHoldNotes ? 1 : 0; m_iSelectedOption[p][PO_DARK] = po.m_bDark ? 1 : 0; - m_iSelectedOption[p][PO_DRAIN] = po.m_DrainType; } } @@ -124,7 +120,6 @@ void ScreenPlayerOptions::ExportOptions() po.m_ColorType = (PlayerOptions::ColorType)m_iSelectedOption[p][PO_COLOR]; po.m_bHoldNotes = (m_iSelectedOption[p][PO_HOLD_NOTES] == 1); po.m_bDark = (m_iSelectedOption[p][PO_DARK] == 1); - po.m_DrainType = (PlayerOptions::DrainType)m_iSelectedOption[p][PO_DRAIN]; } } diff --git a/stepmania/src/ScreenPrompt.cpp b/stepmania/src/ScreenPrompt.cpp index ab719fa7e3..22aab9d6cc 100644 --- a/stepmania/src/ScreenPrompt.cpp +++ b/stepmania/src/ScreenPrompt.cpp @@ -1,11 +1,12 @@ #include "stdafx.h" /* ----------------------------------------------------------------------------- - File: ScreenPrompt.h + Class: ScreenPrompt - Desc: Area for testing. + Desc: See header. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ @@ -18,51 +19,40 @@ #include "GameConstantsAndTypes.h" #include "PrefsManager.h" -ScreenPrompt::ScreenPrompt( CString sText, PromptType pt, bool* pbAnswer ) +const float QUESTION_X = CENTER_X; +const float QUESTION_Y = CENTER_Y - 60; + +const float PROMPT_X = CENTER_X; +const float PROMPT_Y = CENTER_Y + 120; + + +ScreenPrompt::ScreenPrompt( ScreenMessage SM_SendWhenDone, CString sText, PromptType pt, bool bDefaultAnswer, void(*OnYes)(void* pContext), void(*OnNo)(void* pContext) ) { - - static bool bThrowAway; - - if( pbAnswer == NULL ) - pbAnswer = &bThrowAway; - + m_SMSendWhenDone = SM_SendWhenDone; + m_pOnYes = OnYes; + m_pOnNo = OnNo; m_PromptType = pt; - m_pbAnswer = pbAnswer; - - ASSERT( !(pt == PROMPT_YES_NO && pt == NULL) ); + m_bAnswer = bDefaultAnswer; m_Fade.SetTransitionTime( 0.5f ); m_Fade.SetColor( D3DXCOLOR(0,0,0,0.7f) ); m_Fade.SetOpened(); m_Fade.CloseWipingRight(); - m_Fade.SetZ(-2); this->AddSubActor( &m_Fade ); - CStringArray arrayTextLines; - split( sText, "\n", arrayTextLines ); - for( int i=0; iGetPathTo(FONT_HEADER1) ); - m_textQuestion[i].SetText( arrayTextLines[i] ); - m_textQuestion[i].SetXY( CENTER_X, CENTER_Y-50 + i*27 - arrayTextLines.GetSize()*27/2 ); - m_textQuestion[i].SetZ(-2); - this->AddSubActor( &m_textQuestion[i] ); - } + m_textQuestion.Load( THEME->GetPathTo(FONT_NORMAL) ); + m_textQuestion.SetText( sText ); + m_textQuestion.SetXY( QUESTION_X, QUESTION_Y ); + this->AddSubActor( &m_textQuestion ); m_rectAnswerBox.SetDiffuseColor( D3DXCOLOR(0.5f,0.5f,1.0f,0.7f) ); - m_rectAnswerBox.SetXY( m_textAnswer[*m_pbAnswer].GetX(), m_textAnswer[*m_pbAnswer].GetY() ); - m_rectAnswerBox.SetZoomX( m_textAnswer[*m_pbAnswer].GetWidestLineWidthInSourcePixels()+10.0f ); - m_rectAnswerBox.SetZoomY( 30 ); - m_rectAnswerBox.SetZ(-2); this->AddSubActor( &m_rectAnswerBox ); m_textAnswer[0].Load( THEME->GetPathTo(FONT_HEADER1) ); m_textAnswer[1].Load( THEME->GetPathTo(FONT_HEADER1) ); - m_textAnswer[0].SetY( CENTER_Y+120 ); - m_textAnswer[1].SetY( CENTER_Y+120 ); - m_textAnswer[0].SetZ(-2); - m_textAnswer[1].SetZ(-2); + m_textAnswer[0].SetY( PROMPT_Y ); + m_textAnswer[1].SetY( PROMPT_Y ); this->AddSubActor( &m_textAnswer[0] ); this->AddSubActor( &m_textAnswer[1] ); @@ -72,23 +62,21 @@ ScreenPrompt::ScreenPrompt( CString sText, PromptType pt, bool* pbAnswer ) { case PROMPT_OK: m_textAnswer[0].SetText( "OK" ); - m_textAnswer[0].SetX( CENTER_X ); + m_textAnswer[0].SetX( PROMPT_X ); break; case PROMPT_YES_NO: m_textAnswer[0].SetText( "NO" ); m_textAnswer[1].SetText( "YES" ); - m_textAnswer[0].SetX( CENTER_X+50 ); - m_textAnswer[1].SetX( CENTER_X-50 ); + m_textAnswer[0].SetX( PROMPT_X+50 ); + m_textAnswer[1].SetX( PROMPT_X-50 ); break; } - m_rectAnswerBox.SetXY( m_textAnswer[*m_pbAnswer].GetX(), m_textAnswer[*m_pbAnswer].GetY() ); - m_rectAnswerBox.SetZoomX( m_textAnswer[*m_pbAnswer].GetWidestLineWidthInSourcePixels()+10.0f ); + m_rectAnswerBox.SetXY( m_textAnswer[m_bAnswer].GetX(), m_textAnswer[m_bAnswer].GetY() ); + m_rectAnswerBox.SetZoomX( m_textAnswer[m_bAnswer].GetWidestLineWidthInSourcePixels()+10.0f ); + m_rectAnswerBox.SetZoomY( 30 ); - m_textAnswer[*m_pbAnswer].SetEffectGlowing(); - - - m_soundSelect.Load( THEME->GetPathTo(SOUND_MENU_START) ); + m_textAnswer[m_bAnswer].SetEffectGlowing(); } void ScreenPrompt::Update( float fDeltaTime ) @@ -120,7 +108,7 @@ void ScreenPrompt::HandleScreenMessage( const ScreenMessage SM ) case SM_DoneOpeningWipingLeft: break; case SM_DoneOpeningWipingRight: - SCREENMAN->PopTopScreen(); + SCREENMAN->PopTopScreen( m_SMSendWhenDone ); break; } } @@ -138,33 +126,28 @@ void ScreenPrompt::MenuRight( const PlayerNumber p ) if( m_PromptType == PROMPT_OK ) return; - m_textAnswer[*m_pbAnswer].SetEffectNone(); - *m_pbAnswer = !*m_pbAnswer; - m_textAnswer[*m_pbAnswer].SetEffectGlowing(); + m_textAnswer[m_bAnswer].SetEffectNone(); + m_bAnswer = !m_bAnswer; + m_textAnswer[m_bAnswer].SetEffectGlowing(); m_rectAnswerBox.BeginTweening( 0.2f ); - m_rectAnswerBox.SetTweenXY( m_textAnswer[*m_pbAnswer].GetX(), m_textAnswer[*m_pbAnswer].GetY() ); - m_rectAnswerBox.SetTweenZoomX( m_textAnswer[*m_pbAnswer].GetWidestLineWidthInSourcePixels()+10.0f ); + m_rectAnswerBox.SetTweenXY( m_textAnswer[m_bAnswer].GetX(), m_textAnswer[m_bAnswer].GetY() ); + m_rectAnswerBox.SetTweenZoomX( m_textAnswer[m_bAnswer].GetWidestLineWidthInSourcePixels()+10.0f ); + SOUND->PlayOnceStreamed( THEME->GetPathTo(SOUND_EDIT_CHANGE_LINE) ); } void ScreenPrompt::MenuStart( const PlayerNumber p ) { m_Fade.OpenWipingRight( SM_DoneOpeningWipingRight ); - m_textTitle.BeginTweening( 0.2f ); - m_textTitle.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) ); - - for( int i=0; iPlayOnceStreamed( THEME->GetPathTo(SOUND_MENU_START) ); } void ScreenPrompt::MenuBack( const PlayerNumber p ) diff --git a/stepmania/src/ScreenPrompt.h b/stepmania/src/ScreenPrompt.h index 5081b507b7..fd8d95f0d0 100644 --- a/stepmania/src/ScreenPrompt.h +++ b/stepmania/src/ScreenPrompt.h @@ -1,10 +1,12 @@ /* ----------------------------------------------------------------------------- - File: ScreenPrompt.h + Class: ScreenPrompt - Desc: Area for testing. + Desc: Displays a prompt over the top of another screen. Must use by calling + SCREENMAN->AddScreenToTop( new ScreenPrompt(...) ); Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ @@ -18,13 +20,13 @@ enum PromptType{ PROMPT_OK, PROMPT_YES_NO }; -const int NUM_QUESTION_LINES = 10; - class ScreenPrompt : public Screen { public: - ScreenPrompt( CString sText, PromptType pt, bool* pbAnswer = NULL ); + ScreenPrompt(); + ScreenPrompt( ScreenMessage SM_SendWhenDone, CString sText, PromptType pt, bool bDefaultAnswer = false, void(*OnYes)(void*) = NULL, void(*OnNo)(void*) = NULL ); + virtual void Update( float fDeltaTime ); virtual void DrawPrimitives(); virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); @@ -37,14 +39,14 @@ protected: void MenuStart( const PlayerNumber p ); - TransitionFade m_Fade; - BitmapText m_textTitle; - BitmapText m_textQuestion[NUM_QUESTION_LINES]; - Quad m_rectAnswerBox; + TransitionFade m_Fade; + BitmapText m_textQuestion; + Quad m_rectAnswerBox; BitmapText m_textAnswer[2]; // "YES" or "NO" PromptType m_PromptType; - bool* m_pbAnswer; // true = "YES", false = "NO"; - - RandomSample m_soundSelect; + bool m_bAnswer; // true = "YES", false = "NO"; + ScreenMessage m_SMSendWhenDone; + void(*m_pOnYes)(void* pContext); + void(*m_pOnNo)(void* pContext); }; diff --git a/stepmania/src/ScreenSandbox.h b/stepmania/src/ScreenSandbox.h index a63f3f92f6..9b6b22110a 100644 --- a/stepmania/src/ScreenSandbox.h +++ b/stepmania/src/ScreenSandbox.h @@ -1,11 +1,12 @@ #pragma once /* ----------------------------------------------------------------------------- - File: ScreenSandbox.h + Class: ScreenSandbox Desc: Area for testing. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ @@ -16,6 +17,7 @@ #include "TransitionStarWipe.h" #include "MenuElements.h" #include "TipDisplay.h" +#include "RageSoundStream.h" class ScreenSandbox : public Screen diff --git a/stepmania/src/ScreenSelectCourse.cpp b/stepmania/src/ScreenSelectCourse.cpp index fce32e63bd..576178e4c5 100644 --- a/stepmania/src/ScreenSelectCourse.cpp +++ b/stepmania/src/ScreenSelectCourse.cpp @@ -54,15 +54,13 @@ ScreenSelectCourse::ScreenSelectCourse() { LOG->WriteLine( "ScreenSelectCourse::ScreenSelectCourse()" ); - // for debugging - if( GAMESTATE->m_CurStyle == STYLE_NONE ) - GAMESTATE->m_CurStyle = STYLE_DANCE_SINGLE; + m_bMadeChoice = false; + m_bGoToOptions = false; m_Menu.Load( THEME->GetPathTo(GRAPHIC_SELECT_COURSE_BACKGROUND), THEME->GetPathTo(GRAPHIC_SELECT_COURSE_TOP_EDGE), - ssprintf("%c or %c change course then press START", - char(1), char(2), char(3), char(3), char(4), char(4), char(3), char(4), char(3), char(4) ), + ssprintf("%c or %c change course then press START", char(1), char(2)), false, true, 60 ); this->AddSubActor( &m_Menu ); @@ -78,11 +76,10 @@ ScreenSelectCourse::ScreenSelectCourse() m_textHoldForOptions.Load( THEME->GetPathTo(FONT_STAGE) ); m_textHoldForOptions.SetXY( CENTER_X, CENTER_Y ); - m_textHoldForOptions.SetText( "hold START for options" ); + m_textHoldForOptions.SetText( "press START again for options" ); m_textHoldForOptions.SetZoom( 1 ); m_textHoldForOptions.SetZoomY( 0 ); m_textHoldForOptions.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); - m_textHoldForOptions.SetZ( -2 ); this->AddSubActor( &m_textHoldForOptions ); @@ -117,6 +114,10 @@ void ScreenSelectCourse::TweenOnScreen() m_CourseInfoFrame.BeginTweening( TWEEN_TIME, Actor::TWEEN_BIAS_END ); m_CourseInfoFrame.SetTweenXY( COURSE_INFO_FRAME_X, COURSE_INFO_FRAME_Y ); + m_CourseContentsFrame.SetXY( COURSE_CONTENTS_FRAME_X - 400, COURSE_CONTENTS_FRAME_Y ); + m_CourseContentsFrame.BeginTweeningQueued( TWEEN_TIME, Actor::TWEEN_BIAS_END ); + m_CourseContentsFrame.SetTweenXY( COURSE_CONTENTS_FRAME_X, COURSE_CONTENTS_FRAME_Y ); + m_MusicWheel.TweenOnScreen(); } @@ -125,6 +126,9 @@ void ScreenSelectCourse::TweenOffScreen() m_CourseInfoFrame.BeginTweening( TWEEN_TIME, Actor::TWEEN_BOUNCE_END ); m_CourseInfoFrame.SetTweenXY( COURSE_INFO_FRAME_X - 400, COURSE_INFO_FRAME_Y ); + m_CourseContentsFrame.BeginTweeningQueued( TWEEN_TIME, Actor::TWEEN_BOUNCE_END ); + m_CourseContentsFrame.SetTweenXY( COURSE_CONTENTS_FRAME_X - 400, COURSE_CONTENTS_FRAME_Y ); + m_MusicWheel.TweenOffScreen(); } @@ -139,6 +143,14 @@ void ScreenSelectCourse::Input( const DeviceInput& DeviceI, const InputEventType if( MenuI.player == PLAYER_INVALID ) return; + if( m_bMadeChoice && !m_bGoToOptions && MenuI.button == MENU_BUTTON_START ) + { + m_bGoToOptions = true; + m_textHoldForOptions.SetText( "Entering Options..." ); + SOUND->PlayOnceStreamed( THEME->GetPathTo(SOUND_MENU_START) ); + return; + } + Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler } @@ -168,14 +180,12 @@ void ScreenSelectCourse::HandleScreenMessage( const ScreenMessage SM ) bIsHoldingNext = true; } - if( bIsHoldingNext ) + if( bIsHoldingNext || m_bGoToOptions ) { SCREENMAN->SetNewScreen( new ScreenPlayerOptions ); } else { - MUSIC->Stop(); - SCREENMAN->SetNewScreen( new ScreenStage ); } break; @@ -211,6 +221,8 @@ void ScreenSelectCourse::MenuStart( const PlayerNumber p ) m_soundSelect.PlayRandom(); + m_bMadeChoice = true; + // show "hold START for options" m_textHoldForOptions.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); m_textHoldForOptions.BeginTweeningQueued( 0.25f ); // fade in @@ -251,6 +263,8 @@ void ScreenSelectCourse::AfterCourseChange() m_CourseContentsFrame.SetFromCourse( pCourse ); } break; + case TYPE_SECTION: // this probably means "no courses" + break; default: ASSERT(0); } diff --git a/stepmania/src/ScreenSelectCourse.h b/stepmania/src/ScreenSelectCourse.h index 6c8e5ee485..ec5d353a22 100644 --- a/stepmania/src/ScreenSelectCourse.h +++ b/stepmania/src/ScreenSelectCourse.h @@ -48,6 +48,8 @@ protected: CourseContentsFrame m_CourseContentsFrame; MusicWheel m_MusicWheel; + bool m_bMadeChoice; + bool m_bGoToOptions; BitmapText m_textHoldForOptions; RandomSample m_soundSelect; diff --git a/stepmania/src/ScreenSelectDifficulty.cpp b/stepmania/src/ScreenSelectDifficulty.cpp index 59179f1267..d7797e7d90 100644 --- a/stepmania/src/ScreenSelectDifficulty.cpp +++ b/stepmania/src/ScreenSelectDifficulty.cpp @@ -35,7 +35,8 @@ const float DIFFICULTY_ITEM_X[NUM_DIFFICULTY_ITEMS] = { CENTER_X-200, // easy CENTER_X, // medium CENTER_X+200, // hard - SCREEN_WIDTH+CENTER_X, // Oni, page 2 + SCREEN_WIDTH+CENTER_X-100, // Oni, page 2 + SCREEN_WIDTH+CENTER_X+100, // Endless, page 2 }; // these sprites are bottom aligned! const float DIFFICULTY_ITEM_Y[NUM_DIFFICULTY_ITEMS] = { @@ -43,6 +44,7 @@ const float DIFFICULTY_ITEM_Y[NUM_DIFFICULTY_ITEMS] = { CENTER_Y-60, CENTER_Y-40, CENTER_Y-60, + CENTER_Y-60, }; const float DIFFICULTY_ARROW_Y[NUM_DIFFICULTY_ITEMS] = { @@ -50,12 +52,14 @@ const float DIFFICULTY_ARROW_Y[NUM_DIFFICULTY_ITEMS] = { DIFFICULTY_ITEM_Y[1]+205, DIFFICULTY_ITEM_Y[2]+205, DIFFICULTY_ITEM_Y[3]+205, + DIFFICULTY_ITEM_Y[4]+205, }; const float DIFFICULTY_ARROW_X[NUM_DIFFICULTY_ITEMS][NUM_PLAYERS] = { { DIFFICULTY_ITEM_X[0]-40, DIFFICULTY_ITEM_X[0]+40 }, { DIFFICULTY_ITEM_X[1]-40, DIFFICULTY_ITEM_X[1]+40 }, { DIFFICULTY_ITEM_X[2]-40, DIFFICULTY_ITEM_X[2]+40 }, { DIFFICULTY_ITEM_X[3]-40, DIFFICULTY_ITEM_X[3]+40 }, + { DIFFICULTY_ITEM_X[4]-40, DIFFICULTY_ITEM_X[4]+40 }, }; @@ -232,10 +236,13 @@ void ScreenSelectDifficulty::HandleScreenMessage( const ScreenMessage SM ) SCREENMAN->SetNewScreen( new ScreenSelectGroup ); break; case 3: - case 4: GAMESTATE->m_PlayMode = PLAY_MODE_ONI; SCREENMAN->SetNewScreen( new ScreenSelectCourse ); break; + case 4: + GAMESTATE->m_PlayMode = PLAY_MODE_ENDLESS; + SCREENMAN->SetNewScreen( new ScreenSelectGroup ); + break; default: ASSERT(0); // bad selection } @@ -271,6 +278,23 @@ void ScreenSelectDifficulty::MenuRight( const PlayerNumber p ) ChangeTo( p, m_iSelection[p], m_iSelection[p]+1 ); } +bool ScreenSelectDifficulty::IsItemOnPage2( int iItemIndex ) +{ + ASSERT( iItemIndex >= 0 && iItemIndex < NUM_DIFFICULTY_ITEMS ); + + return iItemIndex >= NUM_DIFFICULTY_CLASSES; +} + +bool ScreenSelectDifficulty::SelectedSomethingOnPage2() +{ + for( int p=0; pIsPlayerEnabled(p) && IsItemOnPage2(m_iSelection[p]) ) + return true; + } + return false; +} + void ScreenSelectDifficulty::ChangeTo( const PlayerNumber pn, int iSelectionWas, int iSelectionIs ) { bool bChangedPagesFrom1To2 = iSelectionWas < 3 && iSelectionIs >= 3; @@ -421,7 +445,7 @@ void ScreenSelectDifficulty::TweenOffScreen() for( int d=0; d= 3 ) // this item is on page 2 + if( SelectedSomethingOnPage2() != IsItemOnPage2(d) ) // item isn't on selected page continue; // don't tween const float fPauseTime = d*0.2f; @@ -490,9 +514,7 @@ void ScreenSelectDifficulty::TweenOnScreen() { const float fPauseTime = d*0.2f; - bool bIsOnPage1 = m_iSelection[PLAYER_1] >= 3; - - if( bIsOnPage1 && d >= 3 ) // they are on page 1, but this item is on page 2 + if( SelectedSomethingOnPage2() != IsItemOnPage2(d) ) // item isn't on the current page continue; // don't tween // set off screen diff --git a/stepmania/src/ScreenSelectDifficulty.h b/stepmania/src/ScreenSelectDifficulty.h index 072b2fb569..825efd4af7 100644 --- a/stepmania/src/ScreenSelectDifficulty.h +++ b/stepmania/src/ScreenSelectDifficulty.h @@ -17,7 +17,7 @@ #include "MenuElements.h" -const int NUM_DIFFICULTY_ITEMS = NUM_DIFFICULTY_CLASSES + 1; // easy, medium, hard, Oni +const int NUM_DIFFICULTY_ITEMS = NUM_DIFFICULTY_CLASSES + 2; // easy, medium, hard, Oni, Endless const int NUM_PAGES = 2; // easy-medium-hard, Oni class ScreenSelectDifficulty : public Screen @@ -41,6 +41,9 @@ public: private: void ChangeTo( const PlayerNumber pn, int iSelectionWas, int iSelectionIs ); + bool IsItemOnPage2( int iItemIndex ); + bool SelectedSomethingOnPage2(); // checks selection of players + MenuElements m_Menu; ActorFrame m_framePages; // 2 pages diff --git a/stepmania/src/ScreenSelectGame.cpp b/stepmania/src/ScreenSelectGame.cpp index dad04fcf19..a8139e5c5e 100644 --- a/stepmania/src/ScreenSelectGame.cpp +++ b/stepmania/src/ScreenSelectGame.cpp @@ -67,7 +67,7 @@ ScreenSelectGame::ScreenSelectGame() : void ScreenSelectGame::ImportOptions() { - m_iSelectedOption[0][SG_GAME] = GAMESTATE->GetCurGame(); + m_iSelectedOption[0][SG_GAME] = GAMESTATE->m_CurGame; } void ScreenSelectGame::ExportOptions() @@ -79,7 +79,7 @@ void ScreenSelectGame::ExportOptions() // Switch the current style to the frist style of the selected game Game game = (Game)m_iSelectedOption[0][SG_GAME]; - GAMESTATE->SwitchGame( game ); + GAMESTATE->m_CurGame = game; PREFSMAN->ReadGamePrefsFromDisk(); INPUTMAPPER->ReadMappingsFromDisk(); } diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 28c8894568..e1b737c6e9 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -372,7 +372,7 @@ void ScreenSelectMusic::MenuStart( const PlayerNumber p ) { 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) ); + SCREENMAN->AddScreenToTop( new ScreenPrompt( SM_None, "ERROR:\n \nThis song does not have a music file\n and cannot be played.", PROMPT_OK) ); return; } diff --git a/stepmania/src/ScreenSelectStyle.cpp b/stepmania/src/ScreenSelectStyle.cpp index e7e4a325fb..1b16e95660 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -57,7 +57,7 @@ ScreenSelectStyle::ScreenSelectStyle() for( int s=0; sGetCurGame() ) // games match + if( StyleToGame(style) == GAMESTATE->m_CurGame ) // games match m_aPossibleStyles.Add( style ); } diff --git a/stepmania/src/ScreenSongOptions.cpp b/stepmania/src/ScreenSongOptions.cpp index fb34ad947e..16503b4836 100644 --- a/stepmania/src/ScreenSongOptions.cpp +++ b/stepmania/src/ScreenSongOptions.cpp @@ -25,15 +25,21 @@ OptionLineData g_SongOptionsLines[] = { - { "Fail", 3, {"ARCADE","END OF SONG","OFF"} }, - { "Assist", 2, {"OFF","TICK"} }, - { "Rate", 9, {"x0.5","x0.7","x0.8","x0.9","x1.0","x1.1","x1.2","x1.3","x1.5"} }, - { "Bars", 2, {"OFF","ON"} }, + { "Life", 2, {"BAR","BATTERY"} }, + { "Bar Drain", 3, {"NORMAL","NO RECOVER","SUDDEN DEATH"} }, + { "Bat.Lives", 10, {"1","2","3","4","5","6","7","8","9","10"} }, + { "Fail", 3, {"ARCADE","END OF SONG","OFF"} }, + { "Assist", 2, {"OFF","TICK"} }, + { "Rate", 9, {"x0.7","x0.8","x0.9","x1.0","x1.1","x1.2","x1.3","x1.4","x1.5"} }, + { "Bars", 2, {"OFF","ON"} }, }; const int NUM_SONG_OPTIONS_LINES = sizeof(g_SongOptionsLines)/sizeof(OptionLineData); enum { - SO_FAIL = 0, + SO_LIFE = 0, + SO_DRAIN, + SO_BAT_LIVES, + SO_FAIL, SO_ASSIST, SO_RATE, SO_BARS @@ -59,38 +65,43 @@ void ScreenSongOptions::ImportOptions() { SongOptions &so = GAMESTATE->m_SongOptions; + m_iSelectedOption[0][SO_LIFE] = so.m_LifeType; + m_iSelectedOption[0][SO_BAT_LIVES] = so.m_iBatteryLives-1; m_iSelectedOption[0][SO_FAIL] = so.m_FailType; m_iSelectedOption[0][SO_ASSIST] = so.m_AssistType; - if( so.m_fMusicRate == 0.5f ) m_iSelectedOption[0][SO_RATE] = 0; - else if( so.m_fMusicRate == 0.7f ) m_iSelectedOption[0][SO_RATE] = 1; - else if( so.m_fMusicRate == 0.8f ) m_iSelectedOption[0][SO_RATE] = 2; - else if( so.m_fMusicRate == 0.9f ) m_iSelectedOption[0][SO_RATE] = 3; - else if( so.m_fMusicRate == 1.0f ) m_iSelectedOption[0][SO_RATE] = 4; - else if( so.m_fMusicRate == 1.1f ) m_iSelectedOption[0][SO_RATE] = 5; - else if( so.m_fMusicRate == 1.2f ) m_iSelectedOption[0][SO_RATE] = 6; - else if( so.m_fMusicRate == 1.3f ) m_iSelectedOption[0][SO_RATE] = 7; + if( so.m_fMusicRate == 0.7f ) m_iSelectedOption[0][SO_RATE] = 0; + else if( so.m_fMusicRate == 0.8f ) m_iSelectedOption[0][SO_RATE] = 1; + else if( so.m_fMusicRate == 0.9f ) m_iSelectedOption[0][SO_RATE] = 2; + else if( so.m_fMusicRate == 1.0f ) m_iSelectedOption[0][SO_RATE] = 3; + else if( so.m_fMusicRate == 1.1f ) m_iSelectedOption[0][SO_RATE] = 4; + else if( so.m_fMusicRate == 1.2f ) m_iSelectedOption[0][SO_RATE] = 5; + else if( so.m_fMusicRate == 1.3f ) m_iSelectedOption[0][SO_RATE] = 6; + else if( so.m_fMusicRate == 1.4f ) m_iSelectedOption[0][SO_RATE] = 7; else if( so.m_fMusicRate == 1.5f ) m_iSelectedOption[0][SO_RATE] = 8; - else m_iSelectedOption[0][SO_RATE] = 4; + else m_iSelectedOption[0][SO_RATE] = 3; } void ScreenSongOptions::ExportOptions() { SongOptions &so = GAMESTATE->m_SongOptions; + so.m_LifeType = (SongOptions::LifeType)m_iSelectedOption[0][SO_LIFE]; + so.m_DrainType = (SongOptions::DrainType)m_iSelectedOption[0][SO_DRAIN]; + so.m_iBatteryLives = m_iSelectedOption[0][SO_BAT_LIVES]+1; so.m_FailType = (SongOptions::FailType)m_iSelectedOption[0][SO_FAIL]; so.m_AssistType = (SongOptions::AssistType)m_iSelectedOption[0][SO_ASSIST]; switch( m_iSelectedOption[0][SO_RATE] ) { - case 0: so.m_fMusicRate = 0.5f; break; - case 1: so.m_fMusicRate = 0.7f; break; - case 2: so.m_fMusicRate = 0.8f; break; - case 3: so.m_fMusicRate = 0.9f; break; - case 4: so.m_fMusicRate = 1.0f; break; - case 5: so.m_fMusicRate = 1.1f; break; - case 6: so.m_fMusicRate = 1.2f; break; - case 7: so.m_fMusicRate = 1.3f; break; + case 0: so.m_fMusicRate = 0.7f; break; + case 1: so.m_fMusicRate = 0.8f; break; + case 2: so.m_fMusicRate = 0.9f; break; + case 3: so.m_fMusicRate = 1.0f; break; + case 4: so.m_fMusicRate = 1.1f; break; + case 5: so.m_fMusicRate = 1.2f; break; + case 6: so.m_fMusicRate = 1.3f; break; + case 7: so.m_fMusicRate = 1.4f; break; case 8: so.m_fMusicRate = 1.5f; break; default: ASSERT( false ); } diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index a60df8beea..908e8d3c57 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -71,7 +71,6 @@ ScreenTitleMenu::ScreenTitleMenu() // reset game info - GAMESTATE->SwitchGame( GAMESTATE->GetCurGame() ); GAMESTATE->Reset(); PREFSMAN->ReadGamePrefsFromDisk(); INPUTMAPPER->ReadMappingsFromDisk(); @@ -105,7 +104,7 @@ ScreenTitleMenu::ScreenTitleMenu() m_textVersion.Load( THEME->GetPathTo(FONT_NORMAL) ); m_textVersion.SetHorizAlign( Actor::align_right ); - m_textVersion.SetText( "v3.0 beta 4" ); + m_textVersion.SetText( "v3.0 beta 5" ); 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 ); @@ -148,7 +147,7 @@ ScreenTitleMenu::ScreenTitleMenu() // I don't wanna fix this a 3rd TIME!! // - Andy. - if( GAMESTATE->GetCurGame() != GAME_EZ2 ) + if( GAMESTATE->m_CurGame != GAME_EZ2 ) PREFSMAN->m_sAnnouncer = ""; @@ -185,7 +184,7 @@ ScreenTitleMenu::ScreenTitleMenu() static int announcercheck=0; - if( GAMESTATE->GetCurGame() != GAME_EZ2 && PREFSMAN->m_sAnnouncer == "ez2" && announcercheck == 0) + if( GAMESTATE->m_CurGame != GAME_EZ2 && PREFSMAN->m_sAnnouncer == "ez2" && announcercheck == 0) { ANNOUNCER->SwitchAnnouncer( "default" ); announcercheck = 1; @@ -321,7 +320,7 @@ void ScreenTitleMenu::MenuStart( const PlayerNumber p ) switch( m_TitleMenuChoice ) { case CHOICE_GAME_START: - if( GAMESTATE->GetCurGame() == GAME_EZ2 ) + if( GAMESTATE->m_CurGame == GAME_EZ2 ) { m_soundSelect.PlayRandom(); m_Fade.CloseWipingRight( SM_GoToEz2 ); diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 90615c11b0..734b9042a1 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -18,6 +18,8 @@ #include "Song.h" #include "NoteData.h" #include "MsdFile.h" +#include "RageSoundStream.h" +#include "RageException.h" const int FILE_CACHE_VERSION = 45; // increment this to force a cache reload (useful when the SM file format changes) @@ -574,7 +576,7 @@ bool Song::LoadFromBMSDir( CString sDir ) file.Close(); } break; - case 9: // freeze + case 9: // stop { // This is a very inefficient way to parse, but it doesn't // matter much because this is only parsed on the first run after the song is installed. @@ -616,7 +618,7 @@ bool Song::LoadFromBMSDir( CString sDir ) value_name = line; } - if( 0==stricmp(value_name, sTagToLookFor) == 0 ) + if( 0==stricmp(value_name, sTagToLookFor) ) { // find the BPM at the time of this freeze float fBPM = -1; @@ -787,7 +789,10 @@ bool Song::LoadFromDWIFile( CString sPath ) } } - else if( 0==stricmp(sValueName,"#SINGLE") || 0==stricmp(sValueName,"#DOUBLE") || 0==stricmp(sValueName,"#COUPLE") ) + else if( 0==stricmp(sValueName,"#SINGLE") || + 0==stricmp(sValueName,"#DOUBLE") || + 0==stricmp(sValueName,"#COUPLE") || + 0==stricmp(sValueName,"#SOLO")) { Notes* pNewNotes = new Notes; pNewNotes->LoadFromDWITokens( @@ -1012,6 +1017,7 @@ void Song::TidyUpData() GetDirListing( m_sSongDir + CString("*banner*.png"), arrayPossibleBanners ); GetDirListing( m_sSongDir + CString("*banner*.jpg"), arrayPossibleBanners ); GetDirListing( m_sSongDir + CString("*banner*.bmp"), arrayPossibleBanners ); + GetDirListing( m_sSongDir + CString("*banner*.gif"), arrayPossibleBanners ); if( arrayPossibleBanners.GetSize() > 0 ) m_sBannerFile = arrayPossibleBanners[0]; } @@ -1025,9 +1031,11 @@ void Song::TidyUpData() GetDirListing( m_sSongDir + CString("*bg*.png"), arrayPossibleBGs ); GetDirListing( m_sSongDir + CString("*bg*.jpg"), arrayPossibleBGs ); GetDirListing( m_sSongDir + CString("*bg*.bmp"), arrayPossibleBGs ); + GetDirListing( m_sSongDir + CString("*bg*.gif"), arrayPossibleBGs ); GetDirListing( m_sSongDir + CString("*background*.png"), arrayPossibleBGs ); GetDirListing( m_sSongDir + CString("*background*.jpg"), arrayPossibleBGs ); GetDirListing( m_sSongDir + CString("*background*.bmp"), arrayPossibleBGs ); + GetDirListing( m_sSongDir + CString("*background*.gif"), arrayPossibleBGs ); if( arrayPossibleBGs.GetSize() > 0 ) m_sBackgroundFile = arrayPossibleBGs[0]; } @@ -1041,6 +1049,7 @@ void Song::TidyUpData() GetDirListing( m_sSongDir + CString("*cdtitle*.png"), arrayPossibleCDTitles ); GetDirListing( m_sSongDir + CString("*cdtitle*.jpg"), arrayPossibleCDTitles ); GetDirListing( m_sSongDir + CString("*cdtitle*.bmp"), arrayPossibleCDTitles ); + GetDirListing( m_sSongDir + CString("*cdtitle*.gif"), arrayPossibleCDTitles ); if( arrayPossibleCDTitles.GetSize() > 0 ) m_sCDTitleFile = arrayPossibleCDTitles[0]; } @@ -1053,6 +1062,7 @@ void Song::TidyUpData() GetDirListing( m_sSongDir + CString("*.png"), arrayImages ); GetDirListing( m_sSongDir + CString("*.jpg"), arrayImages ); GetDirListing( m_sSongDir + CString("*.bmp"), arrayImages ); + GetDirListing( m_sSongDir + CString("*.gif"), arrayImages ); for( int i=0; i 0 ) + m_aCourses.Add( course ); } +/* + Chris: Default courses were a bad idea. Get rid of them. // // Create default courses @@ -417,6 +422,7 @@ void SongManager::InitCoursesFromDisk() m_aCourses.Add( course ); } } + */ } void SongManager::ReloadCourses() diff --git a/stepmania/src/SongOptions.cpp b/stepmania/src/SongOptions.cpp new file mode 100644 index 0000000000..967da2237e --- /dev/null +++ b/stepmania/src/SongOptions.cpp @@ -0,0 +1,12 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: SongOptions + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + diff --git a/stepmania/src/SongOptions.h b/stepmania/src/SongOptions.h new file mode 100644 index 0000000000..f8e9bdce05 --- /dev/null +++ b/stepmania/src/SongOptions.h @@ -0,0 +1,37 @@ +#pragma once +/* +----------------------------------------------------------------------------- + Course: SongOptions + + Desc: Per-song options that are not saved between sessions. These are options + that should probably be disabled in a coin-operated machine. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + + +struct SongOptions +{ + enum LifeType { LIFE_BAR_NORMAL=0, LIFE_BATTERY }; + LifeType m_LifeType; + enum DrainType { DRAIN_NORMAL, DRAIN_NO_RECOVER, DRAIN_SUDDEN_DEATH }; + DrainType m_DrainType; // only used with LifeBar + int m_iBatteryLives; + enum FailType { FAIL_ARCADE=0, FAIL_END_OF_SONG, FAIL_OFF }; + FailType m_FailType; + enum AssistType { ASSIST_NONE=0, ASSIST_TICK }; + AssistType m_AssistType; + float m_fMusicRate; + + SongOptions() { + m_LifeType = LIFE_BAR_NORMAL; + m_iBatteryLives = 4; + m_FailType = FAIL_ARCADE; + m_AssistType = ASSIST_NONE; + m_fMusicRate = 1.0f; + }; + CString GetString() { return ""; }; + void FromString( CString sOptions ) {}; +}; diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 0c66bca664..393b71b9e7 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -16,7 +16,7 @@ #include "IniFile.h" #include #include "RageLog.h" - +#include "RageException.h" #include "PrefsManager.h" diff --git a/stepmania/src/StdAfx.h b/stepmania/src/StdAfx.h index c8d7287903..5332c9f2d2 100644 --- a/stepmania/src/StdAfx.h +++ b/stepmania/src/StdAfx.h @@ -16,19 +16,20 @@ #pragma once #endif // _MSC_VER >= 1000 -#define VC_EXTRALEAN // Exclude rarely-used stuff from Screens headers +#define VC_EXTRALEAN // Exclude rarely-used stuff #include // MFC core and standard components #include // MFC extensions #include // MFC templated collections #ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Screens Common Controls +#include // MFC support for Common Controls #endif // _AFX_NO_AFXCMN_SUPPORT // // Rage global classes // +/* #include "RageLog.h" #include "RageDisplay.h" #include "RageTextureManager.h" @@ -37,7 +38,7 @@ #include "RageInput.h" #include "RageTimer.h" #include "RageException.h" - +*/ //{{AFX_INSERT_LOCATION}} diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 7e0c387b7d..8849800971 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -15,6 +15,18 @@ //----------------------------------------------------------------------------- #include "resource.h" +// +// Rage global classes +// +#include "RageLog.h" +#include "RageDisplay.h" +#include "RageTextureManager.h" +#include "RageSound.h" +#include "RageMusic.h" +#include "RageInput.h" +#include "RageTimer.h" +#include "RageException.h" + // // StepMania global classes // @@ -578,6 +590,8 @@ HRESULT CreateObjects( HWND hWnd ) TEXTUREMAN = new RageTextureManager( DISPLAY ); + PREFSMAN->ReadGlobalPrefsFromDisk( true ); + // These things depend on the TextureManager, so do them after! FONT = new FontManager; SCREENMAN = new ScreenManager; @@ -614,6 +628,7 @@ HRESULT CreateObjects( HWND hWnd ) //----------------------------------------------------------------------------- void DestroyObjects() { + SAFE_DELETE( SCREENMAN ); SAFE_DELETE( INPUTQUEUE ); SAFE_DELETE( INPUTMAPPER ); SAFE_DELETE( INPUTFILTER ); @@ -627,7 +642,6 @@ void DestroyObjects() SAFE_DELETE( MUSIC ); SAFE_DELETE( SOUND ); SAFE_DELETE( TIMER ); - SAFE_DELETE( SCREENMAN ); SAFE_DELETE( FONT ); SAFE_DELETE( TEXTUREMAN ); SAFE_DELETE( DISPLAY ); @@ -875,8 +889,8 @@ void ApplyGraphicOptions() if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate) ) goto success; - // We failed. Try full screen with same params. - iRefreshRate = 60; + // We failed. Using default refresh rate. + iRefreshRate = 0; if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate) ) goto success; diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 2cda04c697..38ab5c8dd1 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -224,6 +224,10 @@ SOURCE=.\Font.h # End Source File # Begin Source File +SOURCE=.\GameConstantsAndTypes.cpp +# End Source File +# Begin Source File + SOURCE=.\GameConstantsAndTypes.h # End Source File # Begin Source File @@ -236,6 +240,10 @@ SOURCE=.\GameDef.h # End Source File # Begin Source File +SOURCE=.\GameInput.cpp +# End Source File +# Begin Source File + SOURCE=.\GameInput.h # End Source File # Begin Source File @@ -300,6 +308,14 @@ SOURCE=.\PlayerInput.h # End Source File # Begin Source File +SOURCE=.\PlayerOptions.cpp +# End Source File +# Begin Source File + +SOURCE=.\PlayerOptions.h +# End Source File +# Begin Source File + SOURCE=.\RandomSample.cpp # End Source File # Begin Source File @@ -324,6 +340,14 @@ SOURCE=.\song.h # End Source File # Begin Source File +SOURCE=.\SongOptions.cpp +# End Source File +# Begin Source File + +SOURCE=.\SongOptions.h +# End Source File +# Begin Source File + SOURCE=.\StyleDef.cpp # End Source File # Begin Source File diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 1f0b0985f8..31c8828e97 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -336,6 +336,9 @@ + + @@ -345,6 +348,9 @@ + + @@ -390,6 +396,12 @@ + + + + @@ -408,6 +420,12 @@ + + + + @@ -458,6 +476,9 @@ + + diff --git a/stepmania/src/StyleDef.h b/stepmania/src/StyleDef.h index 32874946d3..95c60e9140 100644 --- a/stepmania/src/StyleDef.h +++ b/stepmania/src/StyleDef.h @@ -49,8 +49,8 @@ public: struct ColumnInfo { int track; // take note data from this track - InstrumentNumber number; // use this instrument to hit a note on this track - InstrumentButton button; // use this button to hit a note on this track + GameController number; // use this instrument to hit a note on this track + GameButton button; // use this button to hit a note on this track float fXOffset; // x position of the column relative to player center }; ColumnInfo m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; // maps each players' column to a track in the NoteData @@ -58,8 +58,8 @@ public: inline GameInput StyleInputToGameInput( const StyleInput StyleI ) { - InstrumentNumber n = m_ColumnInfo[StyleI.player][StyleI.col].number; - InstrumentButton b = m_ColumnInfo[StyleI.player][StyleI.col].button; + GameController n = m_ColumnInfo[StyleI.player][StyleI.col].number; + GameButton b = m_ColumnInfo[StyleI.player][StyleI.col].button; return GameInput( n, b ); }; @@ -69,7 +69,7 @@ public: { for( int t=0; t fBeat ) + break; + return m_BPMSegments[i]; + }; CString GetAnimationAtBeat( float fBeat ) { for( int i=0; i