diff --git a/stepmania/README-FIRST.TXT b/stepmania/README-FIRST.TXT index 85a0305442..f13ef66f36 100644 --- a/stepmania/README-FIRST.TXT +++ b/stepmania/README-FIRST.TXT @@ -1029,7 +1029,9 @@ CVS is the repository that manages the StepMania source code. Our CVS server is graciously provided by SourceForge. You can get the absolute-latest bleeding edge updates to StepMania by taking the source from CVS. Below are instructions on how to configure your computer to download source code from CVS and complile -the source into a working executable. +the source into a working executable. If you do not have a basic understanding +of how to build a program using Visual C++, then you probably should not attempt +to build StepMania. * Step 1: Install and configure Visual C++ @@ -1044,7 +1046,13 @@ Install it using all the default settings. The SDK installer will configure Visual C++ with the correct paths needed to find the DirectX 8.1 libraries and headers. -* Step 3: Install WinCVS +* Step 3: Create a SourceForge account + +In order to commit changes to CVS, you'll have to have a SourceForge account. +Create an account at www.sourceforge.net, then e-mail Chris +(chris@videogamers.com) with your username so he can add you to the project. + +* Step 4: Install WinCVS A CVS client is required to "checkout" the course from the CVS server. Download version 1.2 of WinCVS here - http://www.cvsgui.org @@ -1053,7 +1061,7 @@ version 1.2 of WinCVS here - http://www.cvsgui.org IMPORTANT: Now, open and close WinCVS once. This will cause WinCVS to create registry entries, which is required for the next step... -* Step 4: Use SourceForge Setup to install SSH and configure WinCVS +* Step 5: Use SourceForge Setup to install SSH and configure WinCVS A small utility called SourceForge Setup will greatly simplify the steps needed to configure SSH and WinCVS. Download SourceForge Setup from @@ -1079,19 +1087,33 @@ SET HOME=c:\ssh IMPORTANT: You must restart after running SF Setup so that the new environment variables take effect. -* Step 5: Enable SSH access to the cvs machine +* Step 6: Enable SSH access to the cvs machine -Before you can use your account, you must type the following (substituting your +Before you can use your account, you must run the following (substituting your username and projectname as appropriate) before attempting to use CVS from a new -user account: +user account. Open a command prompt, and type: -ssh -l username cvs.projectname.sf.net +ssh -l username cvs.stepmania.sourceforge.net Enter your password, and you'll get a message about how you're not supposed to be there and the connection will drop. What they don't tell you is that this creates your home directory and is required for things to start working. -* DONE! Enjoy staying on the bleeding edge of StepMania releases!  +* Step 7: "Checkout" the source code + +- Open up WinCVS again. +- In the right pane, you should see the folder "stepmania". +- Right click on that folder and choose "Checkout module...". For the module name + enter "stepmania". +- Click OK. +- If a "chose your home directory" window appears, select "c:\stepmania". +- A minimized console window should appear. Unminimize it, type in your + SourceForge password, and press Enter. +- The source code should begin downloading. This can take a long time depending + on your connection speed. + +* Done! Enjoy staying on the bleeding edge of StepMania releases!  + ************************************************************ 22. Version History @@ -1114,11 +1136,26 @@ NEW FEATURE: Most graphical elements can be positioned per theme using more info. BUG FIX: Autoplay no longer misses the first step if it lies on beat 0. NEW FEATURE: Support for holds notes in KSF. -CHANGE: KSF title discovery will use song foler name if KSF file contains foreign - characters. +CHANGE: KSF title discovery will use song foler name if KSF file contains + foreign characters. BUG FIX: Stepping before start of a note at beat 0 no longer results in a BAD. BUG FIX: Editor now works with dance-couple note patterns BUG FIX: Lead-in/lead-out time added to Play and Record in editor. +CHANGE: Song specific Background Animations removed in favor of a more powerful + system. +NEW FEATURE: "Show Danger" toggle in game options to enable/disable + flashing danger message. +CHANGE: "Event Mode" option renamed to "Unlimited Arcade Stages". +NEW FEATURE: Graphic Option "MovieDecodeMS". Controls how many milliseconds + the program will sleep each frame to allow the movie background movie + decoding thread to catch up. Increase this number if movies are dropping + frames. Decrease this number to decrease the priority of movie decoding. +CHANGE: "SongFolders" renamed to "AdditionalSongFolders". +BUG FIX: AdditionalSongFolers no longer creates duplicate entries on program + load. +CHANGE: RandomMovies do not start playing until the first beat +OPTIMIZATION: New deferred rendering architecture uses more CPU in order to + create more efficient operations for the graphics card. ------------------------CVS after 3.00 beta 5---------------- OPTIMIZATION: Much faster song loading. diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 9b050f4155..22314d457d 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -209,7 +209,7 @@ TryExtraStageY=420 TimerSeconds=40 [Other] -FPSX=626 +FPSX=616 FPSY=10 CreditsP1X=100 CreditsP1Y=470 diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 7fb2b8cec2..63a1471492 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -25,7 +25,7 @@ Actor::Actor() m_rotation = m_start_rotation = D3DXVECTOR3( 0, 0, 0 ); m_scale = m_start_scale = D3DXVECTOR2( 1, 1 ); for(int i=0; i<4; i++) m_colorDiffuse[i] = m_start_colorDiffuse[i] = D3DXCOLOR( 1, 1, 1, 1 ); - m_colorAdd = m_start_colorAdd = D3DXCOLOR( 0, 0, 0, 0 ); + m_colorGlow = m_start_colorGlow = D3DXCOLOR( 0, 0, 0, 0 ); m_HorizAlign = align_center; m_VertAlign = align_middle; @@ -61,7 +61,7 @@ void Actor::Draw() // set the world matrix and calculate actor properties, the m_temp_colorDiffuse[4]; for(i=0; i<4; i++) m_temp_colorDiffuse[i] = m_colorDiffuse[i]; - m_temp_colorAdd = m_colorAdd; + m_temp_colorGlow = m_colorGlow; // @@ -82,7 +82,7 @@ void Actor::Draw() // set the world matrix and calculate actor properties, the case glowing: float fCurvedPercent; fCurvedPercent = sinf( m_fPercentBetweenColors * D3DX_PI ); - m_temp_colorAdd = m_effect_colorAdd1*fCurvedPercent + m_effect_colorAdd2*(1.0f-fCurvedPercent); + m_temp_colorGlow = m_effect_colorGlow1*fCurvedPercent + m_effect_colorGlow2*(1.0f-fCurvedPercent); break; case wagging: m_temp_rotation.z = m_fWagRadians * sinf( @@ -220,7 +220,7 @@ void Actor::Update( float fDeltaTime ) m_start_rotation = m_rotation; m_start_scale = m_scale; for( int i=0; i<4; i++) m_start_colorDiffuse[i] = m_colorDiffuse[i]; - m_start_colorAdd = m_colorAdd; + m_start_colorGlow = m_colorGlow; } TS.m_fTimeLeftInTween -= fDeltaTime; @@ -233,7 +233,7 @@ void Actor::Update( float fDeltaTime ) m_scale = TS.m_end_scale; m_rotation = TS.m_end_rotation; for(i=0; i<4; i++) m_colorDiffuse[i] = TS.m_end_colorDiffuse[i]; - m_colorAdd = TS.m_end_colorAdd; + m_colorGlow = TS.m_end_colorGlow; // delete the head tween for( i=0; i &arrayAnimSegs ) Background::Background() { - m_fSongBeat = 0; - m_bFreeze = false; - + m_iCurAnimSegment = 0; m_bInDanger = false; m_BackgroundMode = MODE_STATIC_BG; @@ -60,31 +66,39 @@ Background::Background() m_sprDanger.SetZoom( 2 ); m_sprDanger.SetEffectWagging(); m_sprDanger.Load( THEME->GetPathTo("Graphics","gameplay danger text") ); - m_sprDanger.SetXY( CENTER_X, CENTER_Y ); + m_sprDanger.SetX( (float)RECTCENTERX(RECT_BACKGROUND) ); + m_sprDanger.SetY( (float)RECTCENTERY(RECT_BACKGROUND) ); m_sprDangerBackground.Load( THEME->GetPathTo("Graphics","gameplay danger background") ); - m_sprDangerBackground.StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) ); + m_sprDangerBackground.StretchTo( RECT_BACKGROUND ); - m_quadBGBrightness.StretchTo( CRect(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) ); + m_quadBGBrightness.StretchTo( RECT_BACKGROUND ); m_quadBGBrightness.SetDiffuseColor( D3DXCOLOR(0,0,0,1-0.5f) ); - m_pCurBGA = NULL; - m_iCurAnimSegment = -1; + m_quadBorder[0].StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,BACKGROUND_LEFT,SCREEN_BOTTOM) ); + m_quadBorder[0].SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); + m_quadBorder[1].StretchTo( CRect(BACKGROUND_LEFT,SCREEN_TOP,BACKGROUND_RIGHT,BACKGROUND_TOP) ); + m_quadBorder[1].SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); + m_quadBorder[2].StretchTo( CRect(BACKGROUND_RIGHT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) ); + m_quadBorder[2].SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); + m_quadBorder[3].StretchTo( CRect(BACKGROUND_LEFT,SCREEN_TOP,BACKGROUND_RIGHT,BACKGROUND_TOP) ); + m_quadBorder[3].SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); } Background::~Background() +{ + Unload(); +} + +void Background::Unload() { for( int i=0; iHasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","fallback background"), true, 4, 0, true ); - - m_sprSongBackground.StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) ); + // + // Load the static background that will before notes start and after notes end + // + BackgroundAnimation* pTempBGA; + pTempBGA = new BackgroundAnimation; + pTempBGA->LoadFromStaticGraphic( pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","fallback background") ); + m_BackgroundAnimations.Add( pTempBGA ); + + + // + // Load animations that will play while notes are active + // switch( m_BackgroundMode ) { case MODE_STATIC_BG: - // do nothing break; case MODE_MOVIE_BG: - m_sprMovieBackground.Load( pSong->GetMovieBackgroundPath() ); - m_sprMovieBackground.StretchTo( CRect(SCREEN_LEFT+10,SCREEN_TOP+16,SCREEN_RIGHT-10,SCREEN_BOTTOM-16) ); - m_sprMovieBackground.SetZoomY( m_sprMovieBackground.GetZoomY() ); - m_sprMovieBackground.StopAnimating( ); + { + pTempBGA = new BackgroundAnimation; + pTempBGA->LoadFromMovie( pSong->GetMovieBackgroundPath() ); + m_BackgroundAnimations.Add( pTempBGA ); + } break; case MODE_MOVIE_VIS: { CStringArray arrayPossibleMovies; - GetDirListing( VISUALIZATIONS_DIR + CString("*.avi"), arrayPossibleMovies ); - GetDirListing( VISUALIZATIONS_DIR + CString("*.mpg"), arrayPossibleMovies ); - GetDirListing( VISUALIZATIONS_DIR + CString("*.mpeg"), arrayPossibleMovies ); - if( arrayPossibleMovies.GetSize() > 0 ) + GetDirListing( VISUALIZATIONS_DIR + "*.avi", arrayPossibleMovies, false, true ); + GetDirListing( VISUALIZATIONS_DIR + "*.mpg", arrayPossibleMovies, false, true ); + GetDirListing( VISUALIZATIONS_DIR + "*.mpeg", arrayPossibleMovies, false, true ); + while( arrayPossibleMovies.GetSize() > 0 && m_BackgroundAnimations.GetSize() < 2 ) { int index = rand() % arrayPossibleMovies.GetSize(); - m_sprMovieVis.Load( VISUALIZATIONS_DIR + arrayPossibleMovies[index] ); - m_sprMovieVis.StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) ); - m_sprMovieVis.SetZoomY( m_sprMovieVis.GetZoomY()*-1 ); - m_sprMovieVis.SetBlendModeAdd(); - } + pTempBGA = new BackgroundAnimation; + pTempBGA->LoadFromVisualization( arrayPossibleMovies[index], pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","fallback background") ); + m_BackgroundAnimations.Add( pTempBGA ); + arrayPossibleMovies.RemoveAt( index ); + } } break; case MODE_ANIMATIONS: { - // - // Load background animations - // - CStringArray asBGAnimNames; - - // First look in the song folder for animations - GetDirListing( pSong->m_sSongDir+"BGAnimations\\*.*", asBGAnimNames, true ); - - if( asBGAnimNames.GetSize() > 0 ) + CStringArray arrayPossibleAnims; + GetDirListing( BG_ANIMS_DIR+"*.*", arrayPossibleAnims, true, true ); + while( arrayPossibleAnims.GetSize() > 0 && m_BackgroundAnimations.GetSize() < 5 ) { - for( int i=0; im_sSongDir+"BGAnimations\\"+asBGAnimNames[i], pSong) ); - + int index = rand() % arrayPossibleAnims.GetSize(); + pTempBGA = new BackgroundAnimation; + pTempBGA->LoadFromAniDir( arrayPossibleAnims[index], pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","fallback background") ); + m_BackgroundAnimations.Add( pTempBGA ); + arrayPossibleAnims.RemoveAt( index ); } - else + } + break; + case MODE_RANDOMMOVIES: + { + CStringArray arrayPossibleMovies; + GetDirListing( RANDOMMOVIES_DIR + "*.avi", arrayPossibleMovies, false, true ); + GetDirListing( RANDOMMOVIES_DIR + "*.mpg", arrayPossibleMovies, false, true ); + GetDirListing( RANDOMMOVIES_DIR + "*.mpeg", arrayPossibleMovies, false, true ); + while( arrayPossibleMovies.GetSize() > 0 && m_BackgroundAnimations.GetSize() < 5 ) { - // We're going to try to classify songs as trance, pop, or techno based on some data about the song - if( pSong->m_BPMSegments.GetSize() + pSong->m_StopSegments.GetSize() >= 3 ) - GetDirListing( BG_ANIMS_DIR+"techno*.*", asBGAnimNames, true ); - else if( pSong->m_BPMSegments[0].m_fBPM > 160 ) - GetDirListing( BG_ANIMS_DIR+"trance*.*", asBGAnimNames, true ); - else - GetDirListing( BG_ANIMS_DIR+"pop*.*", asBGAnimNames, true ); - - // load different animations - for( int i=0; iLoadFromMovie( arrayPossibleMovies[index] ); + m_BackgroundAnimations.Add( pTempBGA ); + arrayPossibleMovies.RemoveAt( index ); + } + } + break; + default: + ASSERT(0); + } - if( m_BackgroundAnimations.GetSize() == 0 ) - break; + // At this point, m_BackgroundAnimations[0] is the song background, and everything else + // in m_BackgroundAnimations should be cycled through randomly while notes are playing. + // + // Generate an animation plan + // + if( m_BackgroundMode == MODE_MOVIE_VIS ) + { + m_aAnimSegs.Add( AnimSeg(-10000,1) ); + return; + } + + // start off showing the static song background + m_aAnimSegs.Add( AnimSeg(-10000,0) ); + + // change BG every 4 bars + const float fFirstBeat = m_BackgroundMode==MODE_MOVIE_BG ? 0 : pSong->m_fFirstBeat; + const float fLastBeat = pSong->m_fLastBeat; + for( float f=fFirstBeat; fm_BPMSegments.GetSize(); i++ ) + { + const BPMSegment& bpmseg = pSong->m_BPMSegments[i]; + + if( bpmseg.m_fStartBeat < fFirstBeat || bpmseg.m_fStartBeat > fLastBeat ) + continue; // skip + + int index; + if( m_BackgroundAnimations.GetSize()==1 ) + index = 0; + else + int index = 1 + int(bpmseg.m_fBPM)%(m_BackgroundAnimations.GetSize()-1); + m_aAnimSegs.Add( AnimSeg(bpmseg.m_fStartBeat,index) ); + } + + // end showing the static song background + m_aAnimSegs.Add( AnimSeg(pSong->m_fLastBeat,0) ); + + // sort segments + SortAnimSegArray( m_aAnimSegs ); +// for( int i=0; im_AnimationSegments.GetSize() > 0 ) @@ -188,55 +267,7 @@ bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations ) m_aAnimSegs.Add( AnimSeg(aniseg.m_fStartBeat, iIndex) ); } SortAnimSegArray( m_aAnimSegs ); // this should already be sorted - } - else - { - // Generate a plan. - for( int i=0; im_fLastBeat; i+=16 ) - m_aAnimSegs.Add( AnimSeg((float)i,rand()%m_BackgroundAnimations.GetSize()) ); // change BG every 4 bars - - for( i=0; im_BPMSegments.GetSize(); i++ ) - { - const BPMSegment& bpmseg = pSong->m_BPMSegments[i]; - m_aAnimSegs.Add( AnimSeg(bpmseg.m_fStartBeat,int(bpmseg.m_fBPM)%m_BackgroundAnimations.GetSize()) ); // change BG every BPM change - } - SortAnimSegArray( m_aAnimSegs ); - } - } - break; - case MODE_RANDOMMOVIES: - { - CStringArray asMovieNames; - GetDirListing( RANDOMMOVIES_DIR + "*.avi", asMovieNames ); - GetDirListing( RANDOMMOVIES_DIR + "*.mpg", asMovieNames ); - GetDirListing( RANDOMMOVIES_DIR + "*.mpeg", asMovieNames ); - for( int i=0; im_fLastBeat; i+=16 ) - m_aAnimSegs.Add( AnimSeg((float)i,rand()%m_BackgroundAnimations.GetSize()) ); // change BG every 4 bars - - for( i=0; im_BPMSegments.GetSize(); i++ ) - { - const BPMSegment& bpmseg = pSong->m_BPMSegments[i]; - m_aAnimSegs.Add( AnimSeg(bpmseg.m_fStartBeat,int(bpmseg.m_fBPM)%m_BackgroundAnimations.GetSize()) ); // change BG every BPM change - } - SortAnimSegArray( m_aAnimSegs ); - } - break; - default: - ASSERT(0); - } - - - return true; +*/ } @@ -251,77 +282,35 @@ void Background::Update( float fDeltaTime ) } else { - if( m_bFreeze ) + if( GAMESTATE->m_bFreeze ) return; - m_sprSongBackground.Update( fDeltaTime ); + // Find the AnimSeg we're in + for( int i=0; im_fSongBeat < m_aAnimSegs[i+1].m_fStartBeat ) + break; + ASSERT( i >= 0 && i m_iCurAnimSegment ) { - case MODE_STATIC_BG: - // do nothing - break; - case MODE_MOVIE_BG: - m_sprMovieBackground.Update( fDeltaTime ); - break; - case MODE_MOVIE_VIS: - m_sprMovieVis.Update( fDeltaTime ); - break; - case MODE_ANIMATIONS: - case MODE_RANDOMMOVIES: - { - // Find the AnimSeg we're in - for( int i=0; i m_fSongBeat ) - break; - if( i == m_aAnimSegs.GetSize() ) - { - m_pCurBGA = NULL; - break; // no animations - } - int iNewAnimationSegment = i; - if( iNewAnimationSegment > m_iCurAnimSegment ) - { - m_iCurAnimSegment = iNewAnimationSegment; - if( m_pCurBGA ) - m_pCurBGA->LosingFocus(); - if( i > m_aAnimSegs.GetSize() ) - { - m_pCurBGA = NULL; - } - else - { - int iNewAnimIndex = m_aAnimSegs[i].m_iAnimationIndex; - m_pCurBGA = m_BackgroundAnimations[iNewAnimIndex]; - m_pCurBGA->GainingFocus(); - } - } +// printf( "%d, %d, %f, %f\n", m_iCurAnimSegment, i, m_aAnimSegs[i].m_fStartBeat, GAMESTATE->m_fSongBeat ); + GetCurBGA()->LosingFocus(); + m_iCurAnimSegment = i; + GetCurBGA()->GainingFocus(); - if( m_pCurBGA ) - m_pCurBGA->Update( fDeltaTime, m_fSongBeat ); - } - break; - default: - ASSERT(0); } - m_quadBGBrightness.Update( fDeltaTime ); - } -} + GetCurBGA()->Update( fDeltaTime ); -void Background::SetSongBeat( const float fSongBeat, const bool bFreeze, const float fMusicSeconds ) -{ - m_fSongBeat = fSongBeat; - m_bFreeze = bFreeze; - m_fMusicSeconds = fMusicSeconds; - if( m_BackgroundMode == MODE_MOVIE_BG && !m_bStartedBGMovie && m_fMusicSeconds > 0 ) - m_sprMovieBackground.StartAnimating(); + } + + m_quadBGBrightness.Update( fDeltaTime ); } void Background::DrawPrimitives() { ActorFrame::DrawPrimitives(); - + if( DangerVisible() ) { m_sprDangerBackground.Draw(); @@ -329,45 +318,17 @@ void Background::DrawPrimitives() } else { - - switch( m_BackgroundMode ) - { - case MODE_STATIC_BG: - m_sprSongBackground.Draw(); - break; - case MODE_MOVIE_BG: - ::Sleep(2); // let the movie decode a frame - m_sprMovieBackground.Draw(); - break; - case MODE_MOVIE_VIS: - m_sprSongBackground.Draw(); - ::Sleep(2); // let the movie decode a frame - m_sprMovieVis.Draw(); - break; - case MODE_ANIMATIONS: - case MODE_RANDOMMOVIES: - if( m_pCurBGA ) - { - if( m_pCurBGA->IsAMovie() ) - ::Sleep(2); // let the movie decode a frame - m_pCurBGA->Draw(); - } - else - { - m_sprSongBackground.Draw(); - } - break; - default: - ASSERT(0); - } - - m_quadBGBrightness.Draw(); + GetCurBGA()->Draw(); } + + m_quadBGBrightness.Draw(); + for( int i=0; i<4; i++ ) + m_quadBorder[i].Draw(); } bool Background::DangerVisible() { - return m_bInDanger && (TIMER->GetTimeSinceStart() - (int)TIMER->GetTimeSinceStart()) < 0.5f; + return m_bInDanger && PREFSMAN->m_bShowDanger && (TIMER->GetTimeSinceStart() - (int)TIMER->GetTimeSinceStart()) < 0.5f; } diff --git a/stepmania/src/Background.h b/stepmania/src/Background.h index 3b648477af..19fa457230 100644 --- a/stepmania/src/Background.h +++ b/stepmania/src/Background.h @@ -35,13 +35,12 @@ public: Background(); ~Background(); - virtual bool LoadFromSong( Song *pSong, bool bDisableVisualizations = false ); + virtual void LoadFromSong( Song *pSong, bool bDisableVisualizations = false ); + virtual void Unload(); // call this on before calling load virtual void Update( float fDeltaTime ); virtual void DrawPrimitives(); - void SetSongBeat( const float fSongBeat, const bool bFreeze, const float fMusicSeconds ); - void FadeIn(); void FadeOut(); @@ -53,36 +52,23 @@ public: protected: bool DangerVisible(); - Song* m_pSong; - enum BackgroundMode { MODE_STATIC_BG, MODE_MOVIE_BG, MODE_ANIMATIONS, MODE_MOVIE_VIS, MODE_RANDOMMOVIES }; BackgroundMode m_BackgroundMode; - - Sprite m_sprSongBackground; - + Sprite m_sprDanger; Sprite m_sprDangerBackground; - // for movie BG - Sprite m_sprMovieBackground; - // for animations + // used in all BackgroundModes except OFF CArray m_BackgroundAnimations; CArray m_aAnimSegs; - BackgroundAnimation* m_pCurBGA; int m_iCurAnimSegment; // this increases as we move into new segments + BackgroundAnimation* GetCurBGA() { int index = m_aAnimSegs[m_iCurAnimSegment].m_iAnimationIndex; return m_BackgroundAnimations[index]; }; - // for movie vis - Sprite m_sprMovieVis; - Quad m_quadBGBrightness; + Quad m_quadBorder[4]; // l, t, r, b - cover up the edge of animations that might hang outside of the background rectangle bool m_bInDanger; - - float m_fSongBeat; - bool m_bFreeze; - float m_fMusicSeconds; - bool m_bStartedBGMovie; }; diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index d6a76aa32f..7f0aa7cfeb 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -148,9 +148,7 @@ void BitmapText::DrawPrimitives() // make the object in logical units centered at the origin - LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer(); - RAGEVERTEX* v; - pVB->Lock( 0, 0, (BYTE**)&v, 0 ); + static RAGEVERTEX v[4000]; int iNumV = 0; // the current vertex number @@ -201,22 +199,17 @@ void BitmapText::DrawPrimitives() // const float fExtraPixels = fPercentExtra * pTexture->GetSourceFrameWidth(); - // first triangle - v[iNumV++].p = D3DXVECTOR3( (float)iX, iY-iHeight/2.0f, 0 ); // top left - v[iNumV++].p = D3DXVECTOR3( (float)iX, iY+iHeight/2.0f, 0 ); // bottom left - iX += iCharWidth; - v[iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY-iHeight/2.0f, 0 ); // top right - - // 2nd triangle - v[iNumV++].p = v[iNumV-1].p; // top right - v[iNumV++].p = v[iNumV-3].p; // bottom left - v[iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY+iHeight/2.0f, 0 ); // bottom right + v[iNumV++].p = D3DXVECTOR3( (float)iX, iY-iHeight/2.0f, 0 ); // top left + v[iNumV++].p = D3DXVECTOR3( iX+iCharWidth+fExtraPixels, iY-iHeight/2.0f, 0 ); // top right + v[iNumV++].p = D3DXVECTOR3( (float)iX, iY+iHeight/2.0f, 0 ); // bottom left + v[iNumV++].p = D3DXVECTOR3( iX+iCharWidth+fExtraPixels, iY+iHeight/2.0f, 0 ); // bottom right + iX += iCharWidth; // // set texture coordinates // - iNumV -= 6; + iNumV -= 4; FRECT frectTexCoords = *pTexture->GetTextureCoordRect( iFrameNo ); @@ -230,153 +223,89 @@ void BitmapText::DrawPrimitives() const float fExtraTexCoords = fPercentExtra * pTexture->GetTextureFrameWidth() / pTexture->GetTextureWidth(); v[iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.top ); // top left - v[iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.bottom ); // bottom left v[iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.top ); // top right - v[iNumV++].t = v[iNumV-1].t; // top right - v[iNumV++].t = v[iNumV-3].t; // bottom left + v[iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.bottom ); // bottom left v[iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.bottom ); // bottom right } iY += iHeight; } - pVB->Unlock(); + DISPLAY->SetTexture( pTexture ); + DISPLAY->SetColorTextureMultDiffuse(); + DISPLAY->SetAlphaTextureMultDiffuse(); - // Set the stage... - LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice(); - pd3dDevice->SetTexture( 0, pTexture->GetD3DTexture() ); - - pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA ); - pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA ); - - pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX ); - pd3dDevice->SetStreamSource( 0, pVB, sizeof(RAGEVERTEX) ); - - - - ////////////////////// - // render the shadow - ////////////////////// - if( m_bShadow && m_temp_colorDiffuse[0].a != 0 ) - { - DISPLAY->PushMatrix(); - DISPLAY->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units - - DWORD dwColor = D3DXCOLOR(0,0,0,0.5f*m_temp_colorDiffuse[0].a); // semi-transparent black - - /* - // YUCK. It is very common in crapier drivers that the texture factor doesn't work. - // Too bad because using the texture factor instead of recoloring the verticies is very fast. - pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, dwColor ); - - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TFACTOR ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - */ - - // recolor the verticies for a shadow - pVB->Lock( 0, 0, (BYTE**)&v, 0 ); - for( int i=0; iUnlock(); - - - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - - - pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, iNumV/3 ); - - DISPLAY->PopMatrix(); - } - - - ////////////////////// - // render the diffuse pass - ////////////////////// - - // - // set vertex colors for the diffuse pass - // - pVB->Lock( 0, 0, (BYTE**)&v, 0 ); - - if( m_bRainbow ) - { - int color_index = int(TIMER->GetTimeSinceStart() / 0.200) % NUM_RAINBOW_COLORS; - for( int i=0; iSetBlendModeAdd(); else + DISPLAY->SetBlendModeNormal(); + + + if( m_temp_colorDiffuse[0].a != 0 ) { - for( int i=0; iPushMatrix(); + DISPLAY->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units + + DWORD dwColor = D3DXCOLOR(0,0,0,0.5f*m_temp_colorDiffuse[0].a); // semi-transparent black + + for( int i=0; iAddQuad( &v[i] ); + + DISPLAY->PopMatrix(); } + + ////////////////////// + // render the diffuse pass + ////////////////////// + if( m_bRainbow ) + { + int color_index = int(TIMER->GetTimeSinceStart() / 0.200) % NUM_RAINBOW_COLORS; + for( int i=0; iAddQuad( &v[i] ); } - pVB->Unlock(); - - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - - pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, iNumV/3 ); - - ////////////////////// - // render the add pass + // render the glow pass ////////////////////// - if( m_temp_colorAdd.a != 0 ) + if( m_temp_colorGlow.a != 0 ) { - DWORD dwColor = m_temp_colorAdd; + DISPLAY->SetColorDiffuse(); - /* - // See above comment about some cards not correctly handling the - // texture factor render state. - - pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, dwColor ); - - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TFACTOR ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - */ - - // recolor the verticies for - pVB->Lock( 0, 0, (BYTE**)&v, 0 ); for( int i=0; iUnlock(); + v[i].color = m_temp_colorGlow; - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - - pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, iNumV/3 ); + for( int i=0; iAddQuad( &v[i] ); } } \ No newline at end of file diff --git a/stepmania/src/CourseContentsFrame.cpp b/stepmania/src/CourseContentsFrame.cpp index 1881b93556..6f36576e52 100644 --- a/stepmania/src/CourseContentsFrame.cpp +++ b/stepmania/src/CourseContentsFrame.cpp @@ -135,10 +135,7 @@ void CourseContentsFrame::Update( float fDeltaTime ) void CourseContentsFrame::DrawPrimitives() { // turn on Z buffer to clip items - LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice(); - pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE ); - pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE ); - + DISPLAY->EnableZBuffer(); // write to z buffer so that top and bottom are clipped m_quad.SetZ( -1 ); @@ -166,8 +163,6 @@ void CourseContentsFrame::DrawPrimitives() fY += CONTENTS_BAR_HEIGHT; } - // turn off Z buffer - pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE ); - pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE ); + DISPLAY->DisableZBuffer(); } diff --git a/stepmania/src/GrooveRadar.cpp b/stepmania/src/GrooveRadar.cpp index c71103c8d4..27102d7c76 100644 --- a/stepmania/src/GrooveRadar.cpp +++ b/stepmania/src/GrooveRadar.cpp @@ -146,14 +146,11 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() // draw radar filling const float fRadius = m_sprRadarBase.GetZoomedHeight()/2.0f*1.1f; - LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer(); - LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice(); - pd3dDevice->SetTexture( 0, NULL ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2 ); - RAGEVERTEX* v; + + DISPLAY->SetTexture( NULL ); + DISPLAY->SetColorTextureMultDiffuse(); + DISPLAY->SetAlphaTextureMultDiffuse(); + RAGEVERTEX v[12]; // needed to draw 5 fan primitives and 10 strip primitives for( int p=0; pLock( 0, 0, (BYTE**)&v, 0 ); - D3DXCOLOR color = PlayerToColor( (PlayerNumber)p ); color.a = 0.5f; v[0].p = D3DXVECTOR3( 0, 0, 0 ); @@ -182,19 +177,15 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() const float fY = -sinf(fRotation) * fDistFromCenter; v[1+i].p = D3DXVECTOR3( fX, fY, 0 ); - v[1+i].color = color; + v[1+i].color = v[0].color; } - pVB->Unlock(); - - pd3dDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, 0, 5 ); + DISPLAY->AddFan( v, 5 ); // // use a strip to draw the thick line // - pVB->Lock( 0, 0, (BYTE**)&v, 0 ); - for( i=0; iUnlock(); - - pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 10 ); + DISPLAY->AddStrip( v, 10 ); } - - } void GrooveRadar::GrooveRadarValueMap::TweenOnScreen() diff --git a/stepmania/src/LifeMeterBattery.cpp b/stepmania/src/LifeMeterBattery.cpp index eb42fd2a22..35bf3ce1d4 100644 --- a/stepmania/src/LifeMeterBattery.cpp +++ b/stepmania/src/LifeMeterBattery.cpp @@ -132,7 +132,7 @@ void LifeMeterBattery::OnDancePointsChange() iPossibleDancePoints = max( 1, iPossibleDancePoints ); float fPercentDancePoints = iActualDancePoints / (float)iPossibleDancePoints + 0.00001f; // correct for rounding errors - printf( "Actual %d, Possible %d, Percent %f\n", iActualDancePoints, iPossibleDancePoints, fPercentDancePoints ); +// printf( "Actual %d, Possible %d, Percent %f\n", iActualDancePoints, iPossibleDancePoints, fPercentDancePoints ); float fNumToDisplay = MAX( 0, fPercentDancePoints*100 ); CString sNumToDisplay = ssprintf("%03.1f", fNumToDisplay); diff --git a/stepmania/src/MotionBlurSprite.h b/stepmania/src/MotionBlurSprite.h index 2aecbab3a7..7a8fe2ad8b 100644 --- a/stepmania/src/MotionBlurSprite.h +++ b/stepmania/src/MotionBlurSprite.h @@ -58,8 +58,8 @@ public: virtual void SetDiffuseColor( D3DXCOLOR c ) { for(int i=0; i 0 ) { m_sprSongBar.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); - m_sprSongBar.SetAddColor( D3DXCOLOR(0,0,0,m_fPercentGray) ); + m_sprSongBar.SetGlowColor( D3DXCOLOR(0,0,0,m_fPercentGray) ); m_sprSongBar.Draw(); m_sprSongBar.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - m_sprSongBar.SetAddColor( D3DXCOLOR(0,0,0,0) ); + m_sprSongBar.SetGlowColor( D3DXCOLOR(0,0,0,0) ); } } break; diff --git a/stepmania/src/NoteDisplay.cpp b/stepmania/src/NoteDisplay.cpp index 6c9556c0e6..532b8856ea 100644 --- a/stepmania/src/NoteDisplay.cpp +++ b/stepmania/src/NoteDisplay.cpp @@ -331,17 +331,17 @@ void NoteDisplay::DrawList( int iCount, NoteDisplayInstance cni[], bool bDrawAdd { NoteDisplayInstance* pCNI = &cni[i]; - const D3DXCOLOR colorAdd = D3DXCOLOR(1,1,1,pCNI->fAddAlpha); + const D3DXCOLOR colorGlow = D3DXCOLOR(1,1,1,pCNI->fAddAlpha); // // set vertex colors // - v[iNumV++].color = colorAdd; // top left - v[iNumV++].color = colorAdd; // bottom left - v[iNumV++].color = colorAdd; // top right - v[iNumV++].color = colorAdd; // top right - v[iNumV++].color = colorAdd; // bottom left - v[iNumV++].color = colorAdd; // bottom right + v[iNumV++].color = colorGlow; // top left + v[iNumV++].color = colorGlow; // bottom left + v[iNumV++].color = colorGlow; // top right + v[iNumV++].color = colorGlow; // top right + v[iNumV++].color = colorGlow; // bottom left + v[iNumV++].color = colorGlow; // bottom right } ASSERT( iNumV == iCount*6 ); // two triangles for each note @@ -472,17 +472,17 @@ void NoteDisplay::DrawList( int iCount, NoteDisplayInstance cni[], bool bDrawAdd { NoteDisplayInstance* pCNI = &cni[i]; - const D3DXCOLOR colorAdd = D3DXCOLOR(1,1,1,pCNI->fAddAlpha); + const D3DXCOLOR colorGlow = D3DXCOLOR(1,1,1,pCNI->fAddAlpha); // // set vertex colors // - v[iNumV++].color = colorAdd; // top left - v[iNumV++].color = colorAdd; // bottom left - v[iNumV++].color = colorAdd; // top right - v[iNumV++].color = colorAdd; // top right - v[iNumV++].color = colorAdd; // bottom left - v[iNumV++].color = colorAdd; // bottom right + v[iNumV++].color = colorGlow; // top left + v[iNumV++].color = colorGlow; // bottom left + v[iNumV++].color = colorGlow; // top right + v[iNumV++].color = colorGlow; // top right + v[iNumV++].color = colorGlow; // bottom left + v[iNumV++].color = colorGlow; // bottom right } ASSERT( iNumV == iCount*6 ); // two triangles for each note @@ -551,16 +551,16 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float const float fColorScale = SCALE(fLife,0,1,0.5f,1); const D3DXCOLOR colorDiffuseTop = D3DXCOLOR(fColorScale,fColorScale,fColorScale,fAlphaTop); const D3DXCOLOR colorDiffuseBottom = D3DXCOLOR(fColorScale,fColorScale,fColorScale,fAlphaBottom); - const D3DXCOLOR colorAddTop = D3DXCOLOR(1,1,1,fAddAlphaTop); - const D3DXCOLOR colorAddBottom = D3DXCOLOR(1,1,1,fAddAlphaBottom); + const D3DXCOLOR colorGlowTop = D3DXCOLOR(1,1,1,fAddAlphaTop); + const D3DXCOLOR colorGlowBottom = D3DXCOLOR(1,1,1,fAddAlphaBottom); // the shift by -0.5 is to align texels to pixels DISPLAY->AddQuad( - D3DXVECTOR3(fXTopLeft-0.5f, fYTop-0.5f, 0), colorDiffuseTop, D3DXVECTOR2(fTexCoordLeft, fTexCoordTop), colorAddTop, // top-left - D3DXVECTOR3(fXTopRight-0.5f, fYTop-0.5f, 0), colorDiffuseTop, D3DXVECTOR2(fTexCoordRight, fTexCoordTop), colorAddTop, // top-right - D3DXVECTOR3(fXBottomLeft-0.5f, fYBottom-0.5f,0), colorDiffuseBottom, D3DXVECTOR2(fTexCoordLeft, fTexCoordBottom), colorAddBottom, // bottom-left - D3DXVECTOR3(fXBottomRight-0.5f,fYBottom-0.5f,0), colorDiffuseBottom, D3DXVECTOR2(fTexCoordRight, fTexCoordBottom), colorAddBottom ); // bottom-right + D3DXVECTOR3(fXTopLeft-0.5f, fYTop-0.5f, 0), colorDiffuseTop, D3DXVECTOR2(fTexCoordLeft, fTexCoordTop), // colorGlowTop, // top-left + D3DXVECTOR3(fXTopRight-0.5f, fYTop-0.5f, 0), colorDiffuseTop, D3DXVECTOR2(fTexCoordRight, fTexCoordTop), // colorGlowTop, // top-right + D3DXVECTOR3(fXBottomLeft-0.5f, fYBottom-0.5f,0), colorDiffuseBottom, D3DXVECTOR2(fTexCoordLeft, fTexCoordBottom),// colorGlowBottom, // bottom-left + D3DXVECTOR3(fXBottomRight-0.5f,fYBottom-0.5f,0), colorDiffuseBottom, D3DXVECTOR2(fTexCoordRight, fTexCoordBottom) );//, colorGlowBottom ); // bottom-right } // @@ -589,14 +589,14 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float const float fColorScale = SCALE(fLife,0,1,0.5f,1); const D3DXCOLOR colorDiffuseTop = D3DXCOLOR(fColorScale,fColorScale,fColorScale,fAlphaTop); const D3DXCOLOR colorDiffuseBottom = D3DXCOLOR(fColorScale,fColorScale,fColorScale,fAlphaBottom); - const D3DXCOLOR colorAddTop = D3DXCOLOR(1,1,1,fAddAlphaTop); - const D3DXCOLOR colorAddBottom = D3DXCOLOR(1,1,1,fAddAlphaBottom); + const D3DXCOLOR colorGlowTop = D3DXCOLOR(1,1,1,fAddAlphaTop); + const D3DXCOLOR colorGlowBottom = D3DXCOLOR(1,1,1,fAddAlphaBottom); DISPLAY->AddQuad( - D3DXVECTOR3(fXTopLeft-0.5f, fYTop-0.5f, 0), colorDiffuseTop, D3DXVECTOR2(fTexCoordLeft, fTexCoordTop), colorAddTop, // top-left - D3DXVECTOR3(fXTopRight-0.5f, fYTop-0.5f, 0), colorDiffuseTop, D3DXVECTOR2(fTexCoordRight, fTexCoordTop), colorAddTop, // top-right - D3DXVECTOR3(fXBottomLeft-0.5f, fYBottom-0.5f,0), colorDiffuseBottom, D3DXVECTOR2(fTexCoordLeft, fTexCoordBottom), colorAddBottom, // bottom-left - D3DXVECTOR3(fXBottomRight-0.5f,fYBottom-0.5f,0), colorDiffuseBottom, D3DXVECTOR2(fTexCoordRight, fTexCoordBottom), colorAddBottom ); // bottom-right + D3DXVECTOR3(fXTopLeft-0.5f, fYTop-0.5f, 0), colorDiffuseTop, D3DXVECTOR2(fTexCoordLeft, fTexCoordTop), //colorGlowTop, // top-left + D3DXVECTOR3(fXTopRight-0.5f, fYTop-0.5f, 0), colorDiffuseTop, D3DXVECTOR2(fTexCoordRight, fTexCoordTop), //colorGlowTop, // top-right + D3DXVECTOR3(fXBottomLeft-0.5f, fYBottom-0.5f,0), colorDiffuseBottom, D3DXVECTOR2(fTexCoordLeft, fTexCoordBottom), //colorGlowBottom, // bottom-left + D3DXVECTOR3(fXBottomRight-0.5f,fYBottom-0.5f,0), colorDiffuseBottom, D3DXVECTOR2(fTexCoordRight, fTexCoordBottom) );//, colorGlowBottom ); // bottom-right } DISPLAY->FlushQueue(); @@ -612,12 +612,12 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float const float fAddAlpha = GetAddAlpha( fAlpha, fPercentFadeToFail ); const float fColorScale = SCALE(fLife,0,1,0.5f,1); const D3DXCOLOR colorDiffuse= D3DXCOLOR(fColorScale,fColorScale,fColorScale,fAlpha); - const D3DXCOLOR colorAdd = D3DXCOLOR(1,1,1,fAddAlpha); + const D3DXCOLOR colorGlow = D3DXCOLOR(1,1,1,fAddAlpha); m_sprHoldParts.SetState( bActive?1:0 ); m_sprHoldParts.SetXY( fX, fY ); m_sprHoldParts.SetDiffuseColor( colorDiffuse ); - m_sprHoldParts.SetAddColor( colorAdd ); + m_sprHoldParts.SetGlowColor( colorGlow ); m_sprHoldParts.Draw(); } } @@ -646,7 +646,7 @@ void NoteDisplay::DrawTap( const int iCol, const float fBeat, const bool bUseHol m_sprTapParts.SetXY( fXPos, fYPos ); m_sprTapParts.SetRotation( fRotation ); - m_sprTapParts.SetAddColor( D3DXCOLOR(1,1,1,fAddAlpha) ); + m_sprTapParts.SetGlowColor( D3DXCOLOR(1,1,1,fAddAlpha) ); // // draw gray part diff --git a/stepmania/src/NoteField.cpp b/stepmania/src/NoteField.cpp index 2f7f985b4a..e553242416 100644 --- a/stepmania/src/NoteField.cpp +++ b/stepmania/src/NoteField.cpp @@ -130,7 +130,7 @@ void NoteField::DrawMeasureBar( int iMeasureIndex ) m_rectMeasureBar.Draw(); m_textMeasureNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - m_textMeasureNumber.SetAddColor( D3DXCOLOR(1,1,1,0) ); + m_textMeasureNumber.SetGlowColor( D3DXCOLOR(1,1,1,0) ); m_textMeasureNumber.SetText( ssprintf("%d", iMeasureNoDisplay) ); m_textMeasureNumber.SetXY( -m_rectMeasureBar.GetZoomedWidth()/2 + 10, fYPos ); m_textMeasureNumber.Draw(); @@ -154,7 +154,7 @@ void NoteField::DrawBPMText( const float fBeat, const float fBPM ) const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset ); m_textMeasureNumber.SetDiffuseColor( D3DXCOLOR(1,0,0,1) ); - m_textMeasureNumber.SetAddColor( D3DXCOLOR(1,1,1,cosf(TIMER->GetTimeSinceStart()*2)/2+0.5f) ); + m_textMeasureNumber.SetGlowColor( D3DXCOLOR(1,1,1,cosf(TIMER->GetTimeSinceStart()*2)/2+0.5f) ); m_textMeasureNumber.SetText( ssprintf("%.2f", fBPM) ); m_textMeasureNumber.SetXY( -m_rectMeasureBar.GetZoomedWidth()/2 - 60, fYPos ); m_textMeasureNumber.Draw(); @@ -166,7 +166,7 @@ void NoteField::DrawFreezeText( const float fBeat, const float fSecs ) const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset ); m_textMeasureNumber.SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,0,1) ); - m_textMeasureNumber.SetAddColor( D3DXCOLOR(1,1,1,cosf(TIMER->GetTimeSinceStart()*2)/2+0.5f) ); + m_textMeasureNumber.SetGlowColor( D3DXCOLOR(1,1,1,cosf(TIMER->GetTimeSinceStart()*2)/2+0.5f) ); m_textMeasureNumber.SetText( ssprintf("%.2f", fSecs) ); m_textMeasureNumber.SetXY( -m_rectMeasureBar.GetZoomedWidth()/2 - 10, fYPos ); m_textMeasureNumber.Draw(); diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 118f8fff19..25681d7331 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -232,9 +232,8 @@ void Player::DrawPrimitives() if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_EffectType == PlayerOptions::EFFECT_SPACE ) { // save old view and projection - DISPLAY->GetDevice()->GetTransform( D3DTS_VIEW, &matOldView ); - DISPLAY->GetDevice()->GetTransform( D3DTS_PROJECTION, &matOldProj ); - + DISPLAY->GetViewTransform( &matOldView ); + DISPLAY->GetProjectionTransform( &matOldProj ); // construct view and project matrix D3DXMATRIX matNewView; @@ -253,11 +252,11 @@ void Player::DrawPrimitives() &D3DXVECTOR3( 0.0f, -1.0f, 0.0f ) ); - DISPLAY->GetDevice()->SetTransform( D3DTS_VIEW, &matNewView ); + DISPLAY->SetViewTransform( &matNewView ); D3DXMATRIX matNewProj; D3DXMatrixPerspectiveFovLH( &matNewProj, D3DX_PI/4.0f, SCREEN_WIDTH/(float)SCREEN_HEIGHT, 0.0f, 1000.0f ); - DISPLAY->GetDevice()->SetTransform( D3DTS_PROJECTION, &matNewProj ); + DISPLAY->SetProjectionTransform( &matNewProj ); } m_GrayArrowRow.Draw(); @@ -267,8 +266,8 @@ void Player::DrawPrimitives() if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_EffectType == PlayerOptions::EFFECT_SPACE ) { // restire old view and projection - DISPLAY->GetDevice()->SetTransform( D3DTS_VIEW, &matOldView ); - DISPLAY->GetDevice()->SetTransform( D3DTS_PROJECTION, &matOldProj ); + DISPLAY->SetViewTransform( &matOldView ); + DISPLAY->SetProjectionTransform( &matOldProj ); } m_frameJudgement.Draw(); diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 54b8684926..64d189cb4b 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -34,6 +34,7 @@ PrefsManager::PrefsManager() m_bOnlyDedicatedMenuButtons = false; m_bShowFPS = false; m_BackgroundMode = BGMODE_ANIMATIONS; + m_bShowDanger = true; m_fBGBrightness = 0.8f; m_bMenuTimer = true; m_bEventMode = false; @@ -41,6 +42,7 @@ PrefsManager::PrefsManager() m_bAutoPlay = false; m_fJudgeWindow = 0.18f; m_fLifeDifficultyScale = 1.0f; + m_iMovieDecodeMS = 2; ReadGlobalPrefsFromDisk( true ); } @@ -66,6 +68,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame ) ini.GetValueB( "Options", "UseDedicatedMenuButtons",m_bOnlyDedicatedMenuButtons ); ini.GetValueB( "Options", "ShowFPS", m_bShowFPS ); ini.GetValueI( "Options", "BackgroundMode", (int&)m_BackgroundMode ); + ini.GetValueB( "Options", "ShowDanger", m_bShowDanger ); ini.GetValueF( "Options", "BGBrightness", m_fBGBrightness ); ini.GetValueB( "Options", "MenuTimer", m_bMenuTimer ); ini.GetValueB( "Options", "EventMode", m_bEventMode ); @@ -73,10 +76,12 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame ) ini.GetValueB( "Options", "AutoPlay", m_bAutoPlay ); ini.GetValueF( "Options", "JudgeWindow", m_fJudgeWindow ); ini.GetValueF( "Options", "LifeDifficultyScale", m_fLifeDifficultyScale ); + ini.GetValueI( "Options", "MovieDecodeMS", m_iMovieDecodeMS ); + m_asAdditionalSongFolders.RemoveAll(); CString sAdditionalSongFolders; - ini.GetValue( "Options", "SongFolders", sAdditionalSongFolders ); - split( sAdditionalSongFolders, ",", m_asSongFolders, true ); + ini.GetValue( "Options", "AdditionalSongFolders", sAdditionalSongFolders ); + split( sAdditionalSongFolders, ",", m_asAdditionalSongFolders, true ); if( bSwitchToLastPlayedGame ) { @@ -100,15 +105,17 @@ void PrefsManager::SaveGlobalPrefsToDisk() ini.GetValueB( "Options", "UseDedicatedMenuButtons",m_bOnlyDedicatedMenuButtons ); ini.SetValueB( "Options", "ShowFPS", m_bShowFPS ); ini.SetValueI( "Options", "BackgroundMode", m_BackgroundMode); + ini.SetValueB( "Options", "ShowDanger", m_bShowDanger ); ini.SetValueF( "Options", "BGBrightness", m_fBGBrightness ); ini.SetValueB( "Options", "EventMode", m_bEventMode ); ini.SetValueB( "Options", "MenuTimer", m_bMenuTimer ); ini.SetValueI( "Options", "NumArcadeStages", m_iNumArcadeStages ); ini.SetValueB( "Options", "AutoPlay", m_bAutoPlay ); ini.SetValueF( "Options", "JudgeWindow", m_fJudgeWindow ); - ini.GetValueF( "Options", "LifeDifficultyScale", m_fLifeDifficultyScale ); + ini.SetValueF( "Options", "LifeDifficultyScale", m_fLifeDifficultyScale ); + ini.SetValueI( "Options", "MovieDecodeMS", m_iMovieDecodeMS ); - ini.SetValue( "Options", "SongFolders", join(",", m_asSongFolders) ); + ini.SetValue( "Options", "AdditionalSongFolders", join(",", m_asAdditionalSongFolders) ); ini.SetValueI( "Options", "Game", GAMESTATE->m_CurGame ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 5e3daae6f8..8fbf71020a 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -35,6 +35,7 @@ public: bool m_bOnlyDedicatedMenuButtons; bool m_bShowFPS; BackgroundMode m_BackgroundMode; + bool m_bShowDanger; float m_fBGBrightness; bool m_bMenuTimer; bool m_bEventMode; @@ -42,8 +43,9 @@ public: bool m_bAutoPlay; float m_fJudgeWindow; float m_fLifeDifficultyScale; + int m_iMovieDecodeMS; - CStringArray m_asSongFolders; + CStringArray m_asAdditionalSongFolders; int GetDisplayHeight(); diff --git a/stepmania/src/RageBitmapTexture.h b/stepmania/src/RageBitmapTexture.h index 210bcd5194..4ea8f948fd 100644 --- a/stepmania/src/RageBitmapTexture.h +++ b/stepmania/src/RageBitmapTexture.h @@ -44,8 +44,6 @@ public: ); virtual LPDIRECT3DTEXTURE8 GetD3DTexture(); - virtual bool IsAMovie() { return true; }; - protected: virtual void Create( diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index 9041073b0b..05c5f9ff6a 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -360,6 +360,10 @@ HRESULT RageDisplay::BeginFrame() //m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV, D3DTADDRESS_BORDER ); + m_pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX ); + m_pd3dDevice->SetStreamSource( 0, m_pVB, sizeof(RAGEVERTEX) ); + + return S_OK; } @@ -367,6 +371,9 @@ HRESULT RageDisplay::BeginFrame() HRESULT RageDisplay::EndFrame() { + FlushQueue(); + + m_pd3dDevice->EndScene(); @@ -396,8 +403,6 @@ HRESULT RageDisplay::ShowFrame() } - - HRESULT RageDisplay::Invalidate() { return S_OK; @@ -406,17 +411,15 @@ HRESULT RageDisplay::Invalidate() HRESULT RageDisplay::Restore() { - return S_OK; } - void RageDisplay::CreateVertexBuffer() { HRESULT hr; - if( FAILED( hr = GetDevice()->CreateVertexBuffer( + if( FAILED( hr = m_pd3dDevice->CreateVertexBuffer( MAX_NUM_VERTICIES * sizeof(RAGEVERTEX), D3DUSAGE_WRITEONLY, D3DFVF_RAGEVERTEX, D3DPOOL_MANAGED, &m_pVB ) ) ) @@ -429,26 +432,67 @@ void RageDisplay::ReleaseVertexBuffer() SAFE_RELEASE( m_pVB ); } +/* +void RageDisplay::AddTriangle( const RAGEVERTEX& v[3] ) +{ + COPY( &m_vertQueue[m_iNumVerts], v ); // do a big mem copy + for( int i=0; i<3; i++ ) + D3DXVec3TransformCoord( &m_vertQueue[m_iNumVerts+i].p, v[i].p, &GetTopMatrix() ); + m_iNumVerts+=3; +} +*/ + +void RageDisplay::AddQuad( const RAGEVERTEX v[4] ) // upper-left, upper-right, lower-left, lower-right +{ + AddQuad( + v[0].p, v[0].color, v[0].t, + v[1].p, v[1].color, v[1].t, + v[2].p, v[2].color, v[2].t, + v[3].p, v[3].color, v[3].t ); +} +void RageDisplay::AddFan( const RAGEVERTEX v[], int iNumPrimitives ) +{ + // HACK: This function does not take winding order into account. It will goof if you turn on culling. + for( int i=0; i MAX_NUM_VERTICIES-4 ) @@ -456,21 +500,20 @@ void RageDisplay::AddTriangle( } void RageDisplay::AddQuad( - const D3DXVECTOR3 &p0, const D3DCOLOR& c0, const D3DXVECTOR2& t0, const D3DCOLOR& a0, // upper-left - const D3DXVECTOR3 &p1, const D3DCOLOR& c1, const D3DXVECTOR2& t1, const D3DCOLOR& a1, // upper-right - const D3DXVECTOR3 &p2, const D3DCOLOR& c2, const D3DXVECTOR2& t2, const D3DCOLOR& a2, // lower-left - const D3DXVECTOR3 &p3, const D3DCOLOR& c3, const D3DXVECTOR2& t3, const D3DCOLOR& a3 ) // lower-right + const D3DXVECTOR3 &p0, const D3DCOLOR& c0, const D3DXVECTOR2& t0, // upper-left + const D3DXVECTOR3 &p1, const D3DCOLOR& c1, const D3DXVECTOR2& t1, // upper-right + const D3DXVECTOR3 &p2, const D3DCOLOR& c2, const D3DXVECTOR2& t2, // lower-left + const D3DXVECTOR3 &p3, const D3DCOLOR& c3, const D3DXVECTOR2& t3 ) // lower-right { - // trangles must be in clockwise order + // trangles must be in clockwise order in case we ever turn on clipping AddTriangle( - p0, c0, t0, a0, // upper-left - p2, c2, t2, a1, // lower-left - p3, c3, t3, a2 ); // lower-right - + p0, c0, t0, // upper-left + p2, c2, t2, // lower-left + p3, c3, t3 ); // lower-right AddTriangle( - p0, c0, t0, a0, // upper-left - p3, c3, t3, a1, // lower-right - p1, c1, t1, a2 ); // upper-right + p0, c0, t0, // upper-left + p3, c3, t3, // lower-right + p1, c1, t1 ); // upper-right } void RageDisplay::FlushQueue() @@ -478,77 +521,210 @@ void RageDisplay::FlushQueue() if( m_iNumVerts == 0 ) return; ASSERT( (m_iNumVerts % 3) == 0 ); - RAGEVERTEX* v; - // - // draw diffuse pass - // + RAGEVERTEX* v; m_pVB->Lock( 0, 0, (BYTE**)&v, 0 ); memcpy( v, m_vertQueue, sizeof(RAGEVERTEX)*m_iNumVerts ); m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumVerts/3 ); m_pVB->Unlock(); - // - // draw add pass - // - bool bAnyVertsHaveAdd = false; - for( int i=0; i>24 != 0 ) // if there is any alpha - bAnyVertsHaveAdd = true; - - if( bAnyVertsHaveAdd ) - { - SetColorTextureMultDiffuse(); - SetColorDiffuse(); - m_pVB->Lock( 0, 0, (BYTE**)&v, 0 ); - for( int i=0; iDrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumVerts/3 ); - m_pVB->Unlock(); - } - m_iNumVerts = 0; } +void RageDisplay::SetViewTransform( D3DXMATRIX* pMatrix ) +{ + FlushQueue(); + m_pd3dDevice->SetTransform( D3DTS_VIEW, pMatrix ); +} +void RageDisplay::SetProjectionTransform( D3DXMATRIX* pMatrix ) +{ + FlushQueue(); + m_pd3dDevice->SetTransform( D3DTS_PROJECTION, pMatrix ); +} +void RageDisplay::GetViewTransform( D3DXMATRIX* pMatrixOut ) +{ + m_pd3dDevice->GetTransform( D3DTS_VIEW, pMatrixOut ); +} +void RageDisplay::GetProjectionTransform( D3DXMATRIX* pMatrixOut ) +{ + m_pd3dDevice->GetTransform( D3DTS_PROJECTION, pMatrixOut ); +} + + +void RageDisplay::ResetMatrixStack() +{ + m_MatrixStack.SetSize( 1, 20 ); + D3DXMatrixIdentity( &GetTopMatrix() ); +} + +void RageDisplay::PushMatrix() +{ + m_MatrixStack.Add( GetTopMatrix() ); + ASSERT(m_MatrixStack.GetSize()<20); // check for infinite loop +} + +void RageDisplay::PopMatrix() +{ + m_MatrixStack.RemoveAt( m_MatrixStack.GetSize()-1 ); +} + +void RageDisplay::Translate( const float x, const float y, const float z ) +{ + D3DXMATRIX matTemp; + D3DXMatrixTranslation( &matTemp, x, y, z ); + D3DXMATRIX& matTop = GetTopMatrix(); + matTop = matTemp * matTop; +} + +void RageDisplay::TranslateLocal( const float x, const float y, const float z ) +{ + D3DXMATRIX matTemp; + D3DXMatrixTranslation( &matTemp, x, y, z ); + D3DXMATRIX& matTop = GetTopMatrix(); + matTop = matTop * matTemp; +} + +void RageDisplay::Scale( const float x, const float y, const float z ) +{ + D3DXMATRIX matTemp; + D3DXMatrixScaling( &matTemp, x, y, z ); + D3DXMATRIX& matTop = GetTopMatrix(); + matTop = matTemp * matTop; +} + +void RageDisplay::RotateX( const float r ) +{ + D3DXMATRIX matTemp; + D3DXMatrixRotationX( &matTemp, r ); + D3DXMATRIX& matTop = GetTopMatrix(); + matTop = matTemp * matTop; +} + +void RageDisplay::RotateY( const float r ) +{ + D3DXMATRIX matTemp; + D3DXMatrixRotationY( &matTemp, r ); + D3DXMATRIX& matTop = GetTopMatrix(); + matTop = matTemp * matTop; +} + +void RageDisplay::RotateZ( const float r ) +{ + D3DXMATRIX matTemp; + D3DXMatrixRotationZ( &matTemp, r ); + D3DXMATRIX& matTop = GetTopMatrix(); + matTop = matTemp * matTop; +} + +/* +void RageDisplay::RotateYawPitchRoll( const float x, const float y, const float z ) +{ + D3DXMATRIX matTemp; + D3DXMatrixRotationYawPitchRoll( &matTemp, x, y, z ); + D3DXMATRIX& matTop = GetTopMatrix(); + matTop = matTemp * matTop; +} +*/ + void RageDisplay::SetTexture( RageTexture* pTexture ) { - m_pd3dDevice->SetTexture( 0, pTexture->GetD3DTexture() ); + LPDIRECT3DBASETEXTURE8 pNewD3DTexture = pTexture ? pTexture->GetD3DTexture() : NULL; + + LPDIRECT3DBASETEXTURE8 pOldD3DTexture; + m_pd3dDevice->GetTexture( 0, &pOldD3DTexture ); + + if( pOldD3DTexture != pNewD3DTexture ) + FlushQueue(); + + m_pd3dDevice->SetTexture( 0, pNewD3DTexture ); } void RageDisplay::SetColorTextureMultDiffuse() { + DWORD dw0, dw1, dw2; + m_pd3dDevice->GetTextureStageState( 0, D3DTSS_COLORARG1, &dw0 ); + m_pd3dDevice->GetTextureStageState( 0, D3DTSS_COLORARG2, &dw1 ); + m_pd3dDevice->GetTextureStageState( 0, D3DTSS_COLOROP, &dw2 ); + + if( dw0!=D3DTA_TEXTURE || dw1!=D3DTA_DIFFUSE || dw2!=D3DTOP_MODULATE ) + FlushQueue(); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); } void RageDisplay::SetColorDiffuse() { + DWORD dw0, dw1, dw2; + m_pd3dDevice->GetTextureStageState( 0, D3DTSS_COLORARG1, &dw0 ); + m_pd3dDevice->GetTextureStageState( 0, D3DTSS_COLORARG2, &dw1 ); + m_pd3dDevice->GetTextureStageState( 0, D3DTSS_COLOROP, &dw2 ); + + if( dw0!=D3DTA_TEXTURE || dw1!=D3DTA_DIFFUSE || dw2!=D3DTOP_SELECTARG2 ) + FlushQueue(); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 ); } void RageDisplay::SetAlphaTextureMultDiffuse() { + DWORD dw0, dw1, dw2; + m_pd3dDevice->GetTextureStageState( 0, D3DTSS_ALPHAARG1, &dw0 ); + m_pd3dDevice->GetTextureStageState( 0, D3DTSS_ALPHAARG2, &dw1 ); + m_pd3dDevice->GetTextureStageState( 0, D3DTSS_ALPHAOP, &dw2 ); + + if( dw0!=D3DTA_TEXTURE || dw1!=D3DTA_DIFFUSE || dw2!=D3DTOP_MODULATE ) + FlushQueue(); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); } void RageDisplay::SetBlendModeNormal() { + DWORD dw0, dw1; + m_pd3dDevice->GetRenderState( D3DRS_SRCBLEND, &dw0 ); + m_pd3dDevice->GetRenderState( D3DRS_DESTBLEND, &dw1 ); + + if( dw0!=D3DBLEND_SRCALPHA || dw1!=D3DBLEND_INVSRCALPHA ) + FlushQueue(); + m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA ); m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA ); } void RageDisplay::SetBlendModeAdd() { + DWORD dw0, dw1; + m_pd3dDevice->GetRenderState( D3DRS_SRCBLEND, &dw0 ); + m_pd3dDevice->GetRenderState( D3DRS_DESTBLEND, &dw1 ); + + if( dw0!=D3DBLEND_ONE || dw1!=D3DBLEND_ONE ) + FlushQueue(); + m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ONE ); m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE ); } void RageDisplay::EnableZBuffer() { + DWORD dw0, dw1; + m_pd3dDevice->GetRenderState( D3DRS_ZENABLE, &dw0 ); + m_pd3dDevice->GetRenderState( D3DRS_ZWRITEENABLE, &dw1 ); + + if( dw0!=TRUE || dw1!=TRUE ) + FlushQueue(); + m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE ); m_pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE ); } void RageDisplay::DisableZBuffer() { + DWORD dw0, dw1; + m_pd3dDevice->GetRenderState( D3DRS_ZENABLE, &dw0 ); + m_pd3dDevice->GetRenderState( D3DRS_ZWRITEENABLE, &dw1 ); + + if( dw0!=FALSE || dw1!=FALSE ) + FlushQueue(); + m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE ); m_pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE ); } \ No newline at end of file diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index 101f0eb655..1266fc421f 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -37,14 +37,16 @@ const int MAX_NUM_VERTICIES = MAX_NUM_QUADS*4; // 4 verticies per quad class RageDisplay { + friend class RageTexture; + public: RageDisplay( HWND hWnd ); ~RageDisplay(); bool SwitchDisplayMode( const bool bWindowed, const int iWidth, const int iHeight, const int iBPP, const int iFullScreenHz ); - LPDIRECT3D8 GetD3D() { return m_pd3d; }; - inline LPDIRECT3DDEVICE8 GetDevice() { return m_pd3dDevice; }; +// LPDIRECT3D8 GetD3D() { return m_pd3d; }; +// inline LPDIRECT3DDEVICE8 GetDevice() { return m_pd3dDevice; }; const D3DCAPS8& GetDeviceCaps() { return m_DeviceCaps; }; HRESULT Reset(); @@ -78,82 +80,22 @@ public: } - LPDIRECT3DVERTEXBUFFER8 GetVertexBuffer() { return m_pVB; }; +// LPDIRECT3DVERTEXBUFFER8 GetVertexBuffer() { return m_pVB; }; + void SetViewTransform( D3DXMATRIX* pMatrix ); + void SetProjectionTransform( D3DXMATRIX* pMatrix ); + void GetViewTransform( D3DXMATRIX* pMatrixOut ); + void GetProjectionTransform( D3DXMATRIX* pMatrixOut ); - inline void ResetMatrixStack() - { - m_MatrixStack.SetSize( 1, 20 ); - D3DXMatrixIdentity( &GetTopMatrix() ); - - m_pd3dDevice->SetTransform( D3DTS_WORLD, &m_MatrixStack[m_MatrixStack.GetSize()-1] ); - }; - inline void PushMatrix() - { - m_MatrixStack.Add( GetTopMatrix() ); - ASSERT(m_MatrixStack.GetSize()<30); // check for infinite loop - m_pd3dDevice->SetTransform( D3DTS_WORLD, &m_MatrixStack[m_MatrixStack.GetSize()-1] ); - }; - inline void PopMatrix() - { - m_MatrixStack.RemoveAt( m_MatrixStack.GetSize()-1 ); - m_pd3dDevice->SetTransform( D3DTS_WORLD, &m_MatrixStack[m_MatrixStack.GetSize()-1] ); - }; - inline void Translate( const float x, const float y, const float z ) - { - D3DXMATRIX matTemp; - D3DXMatrixTranslation( &matTemp, x, y, z ); - D3DXMATRIX& matTop = GetTopMatrix(); - matTop = matTemp * matTop; - m_pd3dDevice->SetTransform( D3DTS_WORLD, &matTop ); - }; - inline void TranslateLocal( const float x, const float y, const float z ) - { - D3DXMATRIX matTemp; - D3DXMatrixTranslation( &matTemp, x, y, z ); - D3DXMATRIX& matTop = GetTopMatrix(); - matTop = matTop * matTemp; - m_pd3dDevice->SetTransform( D3DTS_WORLD, &matTop ); - }; - inline void Scale( const float x, const float y, const float z ) - { - D3DXMATRIX matTemp; - D3DXMatrixScaling( &matTemp, x, y, z ); - D3DXMATRIX& matTop = GetTopMatrix(); - matTop = matTemp * matTop; - m_pd3dDevice->SetTransform( D3DTS_WORLD, &matTop ); - }; - inline void RotateX( const float r ) - { - D3DXMATRIX matTemp; - D3DXMatrixRotationX( &matTemp, r ); - D3DXMATRIX& matTop = GetTopMatrix(); - matTop = matTemp * matTop; - m_pd3dDevice->SetTransform( D3DTS_WORLD, &matTop ); - }; - inline void RotateY( const float r ) - { - D3DXMATRIX matTemp; - D3DXMatrixRotationY( &matTemp, r ); - D3DXMATRIX& matTop = GetTopMatrix(); - matTop = matTemp * matTop; - m_pd3dDevice->SetTransform( D3DTS_WORLD, &matTop ); - }; - inline void RotateZ( const float r ) - { - D3DXMATRIX matTemp; - D3DXMatrixRotationZ( &matTemp, r ); - D3DXMATRIX& matTop = GetTopMatrix(); - matTop = matTemp * matTop; - m_pd3dDevice->SetTransform( D3DTS_WORLD, &matTop ); - }; - inline void RotateYawPitchRoll( const float x, const float y, const float z ) - { - D3DXMATRIX matTemp; - D3DXMatrixRotationYawPitchRoll( &matTemp, x, y, z ); - D3DXMATRIX& matTop = GetTopMatrix(); - matTop = matTemp * matTop; - m_pd3dDevice->SetTransform( D3DTS_WORLD, &matTop ); - }; + void ResetMatrixStack(); + void PushMatrix(); + void PopMatrix(); + void Translate( const float x, const float y, const float z ); + void TranslateLocal( const float x, const float y, const float z ); + void Scale( const float x, const float y, const float z ); + void RotateX( const float r ); + void RotateY( const float r ); + void RotateZ( const float r ); +// void RotateYawPitchRoll( const float x, const float y, const float z ); float GetFPS() { return m_fFPS; }; @@ -194,15 +136,20 @@ protected: int m_iNumVerts; public: + // TODO: Elminiate vertex duplication using an index buffer. Would this work with OpenGL though? +// void AddTriangle( const RAGEVERTEX v[3] ); + void AddQuad( const RAGEVERTEX v[4] ); // upper-left, upper-right, lower-left, lower-right + void AddFan( const RAGEVERTEX v[], int iNumPrimitives ); + void AddStrip( const RAGEVERTEX v[], int iNumPrimitives ); void AddTriangle( - const D3DXVECTOR3& p0, const D3DCOLOR& c0, const D3DXVECTOR2& t0, const D3DCOLOR& a0, - const D3DXVECTOR3& p1, const D3DCOLOR& c1, const D3DXVECTOR2& t1, const D3DCOLOR& a1, - const D3DXVECTOR3& p2, const D3DCOLOR& c2, const D3DXVECTOR2& t2, const D3DCOLOR& a2 ); + const D3DXVECTOR3& p0, const D3DCOLOR& c0, const D3DXVECTOR2& t0, + const D3DXVECTOR3& p1, const D3DCOLOR& c1, const D3DXVECTOR2& t1, + const D3DXVECTOR3& p2, const D3DCOLOR& c2, const D3DXVECTOR2& t2 ); void AddQuad( - const D3DXVECTOR3 &p0, const D3DCOLOR& c0, const D3DXVECTOR2& t0, const D3DCOLOR& a0, // upper-left - const D3DXVECTOR3 &p1, const D3DCOLOR& c1, const D3DXVECTOR2& t1, const D3DCOLOR& a1, // upper-right - const D3DXVECTOR3 &p2, const D3DCOLOR& c2, const D3DXVECTOR2& t2, const D3DCOLOR& a2, // lower-left - const D3DXVECTOR3 &p3, const D3DCOLOR& c3, const D3DXVECTOR2& t3, const D3DCOLOR& a3 );// lower-right + const D3DXVECTOR3 &p0, const D3DCOLOR& c0, const D3DXVECTOR2& t0, // upper-left + const D3DXVECTOR3 &p1, const D3DCOLOR& c1, const D3DXVECTOR2& t1, // upper-right + const D3DXVECTOR3 &p2, const D3DCOLOR& c2, const D3DXVECTOR2& t2, // lower-left + const D3DXVECTOR3 &p3, const D3DCOLOR& c3, const D3DXVECTOR2& t3 ); // lower-right void FlushQueue(); void SetTexture( RageTexture* pTexture ); void SetColorTextureMultDiffuse(); diff --git a/stepmania/src/RageTexture.cpp b/stepmania/src/RageTexture.cpp index dbc6a9c869..d32a491b0e 100644 --- a/stepmania/src/RageTexture.cpp +++ b/stepmania/src/RageTexture.cpp @@ -34,7 +34,7 @@ RageTexture::RageTexture( // LOG->Trace( "RageTexture::RageTexture()" ); // save a pointer to the D3D device - m_pd3dDevice = pScreen->GetDevice(); + m_pd3dDevice = pScreen->m_pd3dDevice; assert( m_pd3dDevice != NULL ); // save the file path diff --git a/stepmania/src/RageTexture.h b/stepmania/src/RageTexture.h index b7bfaa6576..89fb1d1355 100644 --- a/stepmania/src/RageTexture.h +++ b/stepmania/src/RageTexture.h @@ -63,7 +63,7 @@ public: virtual void Play() {}; virtual void SetPosition( float fSeconds ) {}; virtual void Pause() {}; - virtual bool IsAMovie() = 0; + virtual bool IsAMovie() { return false; }; int GetSourceWidth() {return m_iSourceWidth;}; int GetSourceHeight() {return m_iSourceHeight;}; diff --git a/stepmania/src/ScreenGameOver.cpp b/stepmania/src/ScreenGameOver.cpp index f64b0335e7..147d47b35e 100644 --- a/stepmania/src/ScreenGameOver.cpp +++ b/stepmania/src/ScreenGameOver.cpp @@ -36,7 +36,7 @@ ScreenGameOver::ScreenGameOver() this->AddSubActor( &m_sprGameOver ); // tween game over - m_sprGameOver.SetAddColor( D3DXCOLOR(1,1,1,0) ); + m_sprGameOver.SetGlowColor( D3DXCOLOR(1,1,1,0) ); m_sprGameOver.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); m_sprGameOver.BeginTweeningQueued( 0.5f ); // fade to white diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 73e1676df8..70b515ee2c 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -768,8 +768,6 @@ void ScreenGameplay::Update( float fDeltaTime ) // LOG->Trace( "GAMESTATE->m_fMusicSeconds = %f", GAMESTATE->m_fMusicSeconds ); - m_Background.SetSongBeat( fSongBeat, bFreeze, fPositionSeconds ); - //LOG->Trace( "m_fOffsetInBeats = %f, m_fBeatsPerSecond = %f, m_Music.GetPositionSeconds = %f", m_fOffsetInBeats, m_fBeatsPerSecond, m_Music.GetPositionSeconds() ); diff --git a/stepmania/src/ScreenGraphicOptions.cpp b/stepmania/src/ScreenGraphicOptions.cpp index 4a26c43c03..fee97d55e1 100644 --- a/stepmania/src/ScreenGraphicOptions.cpp +++ b/stepmania/src/ScreenGraphicOptions.cpp @@ -34,6 +34,7 @@ enum { GO_SHOWFPS, GO_BGMODE, GO_BGBRIGHTNESS, + GO_MOVIEDECODEMS, NUM_GRAPHIC_OPTIONS_LINES }; OptionLineData g_GraphicOptionsLines[NUM_GRAPHIC_OPTIONS_LINES] = { @@ -44,6 +45,7 @@ OptionLineData g_GraphicOptionsLines[NUM_GRAPHIC_OPTIONS_LINES] = { { "Show FPS", 2, {"OFF","ON"} }, { "BG Mode", 4, {"OFF","ANIMATIONS","VISUALIZATIONS","RANDOM MOVIES"} }, { "BG Brightness", 5, {"20%","40%","60%","80%","100%"} }, + { "Movie Decode MS", 5, {"1ms","2ms","3ms","4ms","5ms"} }, }; ScreenGraphicOptions::ScreenGraphicOptions() : @@ -111,6 +113,8 @@ void ScreenGraphicOptions::ImportOptions() else if( PREFSMAN->m_fBGBrightness == 0.8f ) m_iSelectedOption[0][GO_BGBRIGHTNESS] = 3; else if( PREFSMAN->m_fBGBrightness == 1.0f ) m_iSelectedOption[0][GO_BGBRIGHTNESS] = 4; else m_iSelectedOption[0][GO_BGBRIGHTNESS] = 2; + + m_iSelectedOption[0][GO_MOVIEDECODEMS] = PREFSMAN->m_iMovieDecodeMS-1; } void ScreenGraphicOptions::ExportOptions() @@ -164,6 +168,8 @@ void ScreenGraphicOptions::ExportOptions() case 4: PREFSMAN->m_fBGBrightness = 1.0f; break; default: ASSERT(0); } + + PREFSMAN->m_iMovieDecodeMS = m_iSelectedOption[0][GO_MOVIEDECODEMS]+1; } void ScreenGraphicOptions::GoToPrevState() diff --git a/stepmania/src/ScreenSelectStyle.cpp b/stepmania/src/ScreenSelectStyle.cpp index a6983fb550..6d6cf32a2d 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -171,7 +171,7 @@ void ScreenSelectStyle::AfterChange() m_sprPreview.Load( THEME->GetPathTo("Graphics",ssprintf("select style preview game %d style %d",GAMESTATE->m_CurGame,m_iSelection)) ); m_sprPreview.StopTweening(); - m_sprPreview.SetAddColor( D3DXCOLOR(1,1,1,0) ); + m_sprPreview.SetGlowColor( D3DXCOLOR(1,1,1,0) ); m_sprPreview.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); m_sprPreview.BeginTweeningQueued( 0.25f ); // sleep diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index 26af5bcc44..8d1f2d0350 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -111,7 +111,7 @@ ScreenTitleMenu::ScreenTitleMenu() m_sprLogo.Load( THEME->GetPathTo("Graphics",ssprintf("title menu logo game %d",GAMESTATE->m_CurGame)) ); m_sprLogo.SetXY( LOGO_X, LOGO_Y ); - m_sprLogo.SetAddColor( D3DXCOLOR(1,1,1,1) ); + m_sprLogo.SetGlowColor( D3DXCOLOR(1,1,1,1) ); m_sprLogo.SetZoomY( 0 ); m_sprLogo.BeginTweeningQueued( 0.5f ); // sleep m_sprLogo.BeginTweeningQueued( 0.5f, Actor::TWEEN_BOUNCE_END ); diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 4950833608..7c879c03b6 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -58,8 +58,8 @@ void SongManager::InitSongArrayFromDisk( void(*callback)() ) { LoadStepManiaSongDir( "Songs", callback ); - for( int i=0; im_asSongFolders.GetSize(); i++ ) - LoadStepManiaSongDir( PREFSMAN->m_asSongFolders[i], callback ); + for( int i=0; im_asAdditionalSongFolders.GetSize(); i++ ) + LoadStepManiaSongDir( PREFSMAN->m_asAdditionalSongFolders[i], callback ); // compute group names CArray arraySongs; diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index abd3a9a319..0c3247723a 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -1,9 +1,9 @@ #include "stdafx.h" /* ----------------------------------------------------------------------------- - File: Sprite.cpp + Class: Sprite - Desc: A bitmap actor that animates and moves around. + Desc: See header. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford @@ -190,22 +190,21 @@ void Sprite::Update( float fDeltaTime ) void Sprite::DrawPrimitives() { + if( m_pTexture == NULL ) + return; + + if( m_pTexture->IsAMovie() ) + ::Sleep( PREFSMAN->m_iMovieDecodeMS ); // let the movie decode a frame + + // offset so that pixels are aligned to texels if( PREFSMAN->m_iDisplayResolution == 320 ) DISPLAY->TranslateLocal( -1, -1, 0 ); else DISPLAY->TranslateLocal( -0.5f, -0.5f, 0 ); - if( m_pTexture == NULL ) - return; // use m_temp_* variables to draw the object - - - // make the object in logical units centered at the origin - - - FRECT quadVerticies; switch( m_HorizAlign ) @@ -225,9 +224,7 @@ void Sprite::DrawPrimitives() } - LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer(); - RAGEVERTEX* v; - pVB->Lock( 0, 0, (BYTE**)&v, 0 ); + static RAGEVERTEX v[4]; v[0].p = D3DXVECTOR3( quadVerticies.left, quadVerticies.bottom, 0 ); // bottom left v[1].p = D3DXVECTOR3( quadVerticies.left, quadVerticies.top, 0 ); // top left @@ -254,18 +251,16 @@ void Sprite::DrawPrimitives() } - pVB->Unlock(); + DISPLAY->SetTexture( m_pTexture ); + DISPLAY->SetColorTextureMultDiffuse(); + DISPLAY->SetAlphaTextureMultDiffuse(); - // Set the stage... - LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice(); - pd3dDevice->SetTexture( 0, m_pTexture->GetD3DTexture() ); + if( m_bBlendAdd ) + DISPLAY->SetBlendModeAdd(); + else + DISPLAY->SetBlendModeNormal(); - pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA ); - pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA ); - - pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX ); - pd3dDevice->SetStreamSource( 0, pVB, sizeof(RAGEVERTEX) ); @@ -278,71 +273,29 @@ void Sprite::DrawPrimitives() { DISPLAY->PushMatrix(); DISPLAY->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units - - pVB->Lock( 0, 0, (BYTE**)&v, 0 ); - v[0].color = v[1].color = v[2].color = v[3].color = D3DXCOLOR(0,0,0,0.5f*m_temp_colorDiffuse[0].a); // semi-transparent black - - pVB->Unlock(); - - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - - pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 ); - + DISPLAY->AddQuad( v ); DISPLAY->PopMatrix(); } - ////////////////////// // render the diffuse pass ////////////////////// - pVB->Lock( 0, 0, (BYTE**)&v, 0 ); - v[0].color = m_temp_colorDiffuse[2]; // bottom left v[1].color = m_temp_colorDiffuse[0]; // top left v[2].color = m_temp_colorDiffuse[3]; // bottom right v[3].color = m_temp_colorDiffuse[1]; // top right - - pVB->Unlock(); - - - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );//bBlendAdd ? D3DTOP_ADD : D3DTOP_MODULATE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );//bBlendAdd ? D3DTOP_ADD : D3DTOP_MODULATE ); - - - // finally! Pump those triangles! - pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 ); + DISPLAY->AddQuad( v ); } - ////////////////////// - // render the add pass + // render the glow pass ////////////////////// - if( m_temp_colorAdd.a != 0 ) + if( m_temp_colorGlow.a != 0 ) { - pVB->Lock( 0, 0, (BYTE**)&v, 0 ); - - v[0].color = v[1].color = v[2].color = v[3].color = m_temp_colorAdd; - - pVB->Unlock(); - - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - - pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 ); + DISPLAY->SetColorDiffuse(); + v[0].color = v[1].color = v[2].color = v[3].color = m_temp_colorGlow; + DISPLAY->AddQuad( v ); } } diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index cb240b393b..6dec96e6d4 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -874,25 +874,20 @@ void Render() break; case S_OK: { - // set texture and alpha properties - LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice(); - // calculate view and projection transforms - D3DXMATRIX matProj; - D3DXMatrixOrthoOffCenterLH( &matProj, 0, 640, 480, 0, -1000, 1000 ); - pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj ); + D3DXMATRIX mat; + + D3DXMatrixOrthoOffCenterLH( &mat, 0, 640, 480, 0, -1000, 1000 ); + DISPLAY->SetProjectionTransform( &mat ); - D3DXMATRIX matView; - D3DXMatrixIdentity( &matView ); - pd3dDevice->SetTransform( D3DTS_VIEW, &matView ); + D3DXMatrixIdentity( &mat ); + DISPLAY->SetViewTransform( &mat ); DISPLAY->ResetMatrixStack(); - // draw the game SCREENMAN->Draw(); - DISPLAY->EndFrame(); } break;