diff --git a/stepmania/src/Banner.cpp b/stepmania/src/Banner.cpp index 49f1b9e2b4..4ad8b76592 100644 --- a/stepmania/src/Banner.cpp +++ b/stepmania/src/Banner.cpp @@ -13,20 +13,16 @@ #include "Banner.h" #include "ThemeManager.h" - +#include "RageBitmapTexture.h" bool Banner::LoadFromSong( Song* pSong ) // NULL means no song { - if( pSong == NULL ) - Sprite::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) ); - else if( pSong->HasBanner() ) - Sprite::Load( pSong->GetBannerPath() ); - else if( pSong->HasBackground() ) - Sprite::Load( pSong->GetBackgroundPath() ); - else - Sprite::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) ); + if( pSong == NULL ) Sprite::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER), HINT_NOMIPMAPS ); + else if( pSong->HasBanner() ) Sprite::Load( pSong->GetBannerPath(), HINT_NOMIPMAPS ); + else if( pSong->HasBackground() ) Sprite::Load( pSong->GetBackgroundPath(), HINT_NOMIPMAPS ); + else Sprite::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER), HINT_NOMIPMAPS ); Sprite::TurnShadowOff(); diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index f228109758..8ba898a602 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -258,31 +258,33 @@ void BitmapText::RebuildVertexBuffer() if( fPercentExtra > 1-fPercentageOfFrame ) fPercentExtra = 1-fPercentageOfFrame; - - // set vertex positions - - v[m_iNumV++].p = D3DXVECTOR3( fX, fY+fHeight/2, 0 ); // bottom left - v[m_iNumV++].p = D3DXVECTOR3( fX, fY-fHeight/2, 0 ); // top left - - fX += fCharWidth; - float fExtraPixels = fPercentExtra * GetUnzoomedWidth(); - v[m_iNumV++].p = D3DXVECTOR3( fX+fExtraPixels, fY+fHeight/2, 0 ); // bottom right + // first triangle + v[m_iNumV++].p = D3DXVECTOR3( fX, fY-fHeight/2, 0 ); // top left + v[m_iNumV++].p = D3DXVECTOR3( fX, fY+fHeight/2, 0 ); // bottom left + fX += fCharWidth; v[m_iNumV++].p = D3DXVECTOR3( fX+fExtraPixels, fY-fHeight/2, 0 ); // top right + + // 2nd triangle + v[m_iNumV++].p = v[m_iNumV-1].p; // top right + v[m_iNumV++].p = v[m_iNumV-3].p; // bottom left + v[m_iNumV++].p = D3DXVECTOR3( fX+fExtraPixels, fY+fHeight/2, 0 ); // bottom right // set texture coordinates - m_iNumV -= 4; + m_iNumV -= 6; FRECT* pTexCoordRect = m_pTexture->GetTextureCoordRect( iFrameNo ); float fExtraTexCoords = fPercentExtra * m_pTexture->GetTextureFrameWidth() / m_pTexture->GetTextureWidth(); - v[m_iNumV].tu = pTexCoordRect->left; v[m_iNumV++].tv = pTexCoordRect->bottom; // bottom left v[m_iNumV].tu = pTexCoordRect->left; v[m_iNumV++].tv = pTexCoordRect->top; // top left - v[m_iNumV].tu = pTexCoordRect->right + fExtraTexCoords; v[m_iNumV++].tv = pTexCoordRect->bottom; // bottom right + v[m_iNumV].tu = pTexCoordRect->left; v[m_iNumV++].tv = pTexCoordRect->bottom; // bottom left v[m_iNumV].tu = pTexCoordRect->right + fExtraTexCoords; v[m_iNumV++].tv = pTexCoordRect->top; // top right + v[m_iNumV].tu = v[m_iNumV-1].tu; v[m_iNumV++].tv = v[m_iNumV-1].tv; // top right + v[m_iNumV].tu = v[m_iNumV-3].tu; v[m_iNumV++].tv = v[m_iNumV-3].tv; // bottom left + v[m_iNumV].tu = pTexCoordRect->right + fExtraTexCoords; v[m_iNumV++].tv = pTexCoordRect->bottom; // bottom right } @@ -352,7 +354,7 @@ void BitmapText::RenderPrimitives() -// RebuildVertexBuffer(); + RebuildVertexBuffer(); LPDIRECT3DVERTEXBUFFER8 pVB = m_pVB; @@ -399,8 +401,7 @@ void BitmapText::RenderPrimitives() pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - for( i=0; iDrawPrimitive( D3DPT_TRIANGLESTRIP, i, 2 ); + pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 ); SCREEN->PopMatrix(); } @@ -430,9 +431,7 @@ void BitmapText::RenderPrimitives() pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );//bBlendAdd ? D3DTOP_ADD : D3DTOP_MODULATE ); - - for( i=0; iDrawPrimitive( D3DPT_TRIANGLESTRIP, i, 2 ); + pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 ); } @@ -455,8 +454,7 @@ void BitmapText::RenderPrimitives() pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - for( i=0; iDrawPrimitive( D3DPT_TRIANGLESTRIP, i, 2 ); + pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 ); } } diff --git a/stepmania/src/HoldGhostArrow.cpp b/stepmania/src/HoldGhostArrow.cpp index ff258ccab1..0fdfeaf7cc 100644 --- a/stepmania/src/HoldGhostArrow.cpp +++ b/stepmania/src/HoldGhostArrow.cpp @@ -44,6 +44,14 @@ void HoldGhostArrow::Update( float fDeltaTime ) int iStateNum = min( m_fHeatLevel * GetNumStates(), GetNumStates()-1 ); SetState( iStateNum ); + + if( m_fHeatLevel == 1 ) + { + bool bZooomALittle = (GetTickCount() % 50) > 25; + SetZoom( bZooomALittle ? 1.04f : 1.0f ); + } + else + SetZoom( 1 ); SetDiffuseColor( D3DXCOLOR(1,1,1,m_fHeatLevel*3) ); diff --git a/stepmania/src/MotionBlurSprite.h b/stepmania/src/MotionBlurSprite.h index 22c2b3f438..3537495dc6 100644 --- a/stepmania/src/MotionBlurSprite.h +++ b/stepmania/src/MotionBlurSprite.h @@ -16,7 +16,7 @@ #include "ActorFrame.h" -const int NUM_BLUR_GHOSTS = 1; +const int NUM_BLUR_GHOSTS = 2; class MotionBlurSprite : public Actor { diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 926708b458..6c1c656098 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -60,6 +60,7 @@ const float PILL_OFFSET_Y[LIEFMETER_NUM_PILLS] = { const float SCORE_Y = SCREEN_HEIGHT - 40; +const float HOLD_ARROW_NG_TIME = 0.27f; Player::Player() { @@ -470,6 +471,8 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference for( int i=0; iIsButtonDown( PlayerI ) ) // they're holding the button down { + hss.m_fTimeNotHeld = clamp( hss.m_fTimeNotHeld-fDeltaTime, 0, HOLD_ARROW_NG_TIME ); int iCol = m_StepToColumnNumber[ hs.m_Step ]; m_HoldGhostArrow[iCol].Step(); } @@ -492,9 +496,14 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference PlayerInput PlayerI = { m_PlayerNumber, hs.m_Step }; if( !GAMEINFO->IsButtonDown( PlayerI ) ) // they're not holding the button down { - m_HoldStepScores[i].m_HoldScore = HoldStepScore::HOLD_SCORE_NG; - int iCol = m_StepToColumnNumber[ hs.m_Step ]; - SetHoldJudgement( iCol, HoldStepScore::HOLD_SCORE_NG ); + hss.m_fTimeNotHeld = clamp( hss.m_fTimeNotHeld+fDeltaTime, 0, HOLD_ARROW_NG_TIME ); + if( hss.m_fTimeNotHeld >= HOLD_ARROW_NG_TIME ) // the player has not pressed the button for a long time! + { + hss.m_fTimeNotHeld = HOLD_ARROW_NG_TIME; + hss.m_HoldScore = HoldStepScore::HOLD_SCORE_NG; + int iCol = m_StepToColumnNumber[ hs.m_Step ]; + SetHoldJudgement( iCol, HoldStepScore::HOLD_SCORE_NG ); + } } } } @@ -503,11 +512,13 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference for( i=0; i fEndBeat && // if this hold step is in the past m_HoldStepScores[i].m_HoldScore == HoldStepScore::HOLD_STEPPED_ON ) // and it doesn't yet have a score { + hss.m_fTimeNotHeld = 0; m_HoldStepScores[i].m_HoldScore = HoldStepScore::HOLD_SCORE_OK; int iCol = m_StepToColumnNumber[ hs.m_Step ]; SetHoldJudgement( iCol, HoldStepScore::HOLD_SCORE_OK ); @@ -913,6 +924,7 @@ void Player::DrawColorArrows() //RageLog( "Drawing elements %d through %d", iIndexFirstArrowToDraw, iIndexLastArrowToDraw ); + // draw all normal arrows for( int i=iIndexFirstArrowToDraw; i<=iIndexLastArrowToDraw; i++ ) // for each row { if( m_LeftToStepOn[i] != 0 || // this step is not yet complete @@ -929,10 +941,30 @@ void Player::DrawColorArrows() //RageLog( "iYPos: %d, iFrameNo: %d, m_OriginalStep[i]: %d", iYPos, iFrameNo, m_OriginalStep[i] ); - for( int c=0; c < m_iNumColumns; c++ ) { // for each arrow column - if( m_OriginalStep[i] & m_ColumnNumberToStep[c] ) { // this column is still unstepped on? + // See if there is a hold step that begins on this beat. Terribly inefficient! + bool bHoldStepOnThisBeat = false; + for (int j=0; j=hs.m_iStartIndex; j-- ) // for each arrow in this freeze + for( float j=hs.m_iStartIndex; j<=hs.m_iEndIndex; j+=1.5f ) // for each arrow in this freeze { - // check if this hold step is off the the screen + // check if this arrow is off the the screen if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j) continue; // skip this arrow @@ -983,7 +1015,7 @@ void Player::DrawColorArrows() float fYOffset = GetColorArrowYOffset( j, m_fSongBeat ); float fYPos = GetColorArrowYPos( j, m_fSongBeat ); - if( score == HoldStepScore::HOLD_STEPPED_ON || score == HoldStepScore::HOLD_SCORE_OK ) + if( hss.m_HoldScore == HoldStepScore::HOLD_STEPPED_ON || hss.m_HoldScore == HoldStepScore::HOLD_SCORE_OK ) { if( fYPos < GetGrayArrowYPos() ) continue; // don't draw @@ -996,17 +1028,17 @@ void Player::DrawColorArrows() } // draw the color parts - for( j=hs.m_iEndIndex; j>=hs.m_iStartIndex; j-- ) // for each arrow in this freeze + for( j=hs.m_iStartIndex; j<=hs.m_iEndIndex; j+=1.5f ) // for each arrow in this freeze { - // check if this hold step is off the the screen - if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j) + // check if this arrow is off the the screen + if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j ) continue; // skip this arrow float fYOffset = GetColorArrowYOffset( j, m_fSongBeat ); float fYPos = GetColorArrowYPos( j, m_fSongBeat ); m_ColorArrow[iColNum].SetY( fYPos ); - if( score == HoldStepScore::HOLD_STEPPED_ON || score == HoldStepScore::HOLD_SCORE_OK ) + if( hss.m_HoldScore == HoldStepScore::HOLD_STEPPED_ON || hss.m_HoldScore == HoldStepScore::HOLD_SCORE_OK ) { if( fYPos < GetGrayArrowYPos() ) continue; // don't draw @@ -1014,27 +1046,53 @@ void Player::DrawColorArrows() if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos; m_ColorArrow[iColNum].SetY( fYPos ); D3DXCOLOR color( (float)(j-hs.m_iStartIndex)/(float)(hs.m_iEndIndex-hs.m_iStartIndex), 1, 0, 1 ); // color shifts from green to yellow + float fPercentageDead = hss.m_fTimeNotHeld / HOLD_ARROW_NG_TIME; + color *= 1 - fPercentageDead / 1.2f; + color.a = 1; m_ColorArrow[iColNum].SetDiffuseColor( color ); float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset ); m_ColorArrow[iColNum].SetAlpha( fAlpha ); m_ColorArrow[iColNum].DrawColorPart(); } + // draw the first arrow on top of the others j = hs.m_iStartIndex; + // check if this arrow is off the the screen + if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j) + continue; // skip this arrow + + float fYOffset = GetColorArrowYOffset( j, m_fSongBeat ); + float fYPos = GetColorArrowYPos( j, m_fSongBeat ); - if( score == HoldStepScore::HOLD_STEPPED_ON || score == HoldStepScore::HOLD_SCORE_OK ) + if( hss.m_HoldScore == HoldStepScore::HOLD_STEPPED_ON || hss.m_HoldScore == HoldStepScore::HOLD_SCORE_OK ) + { + if( fYPos < GetGrayArrowYPos() ) + continue; // don't draw + } + if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos; + m_ColorArrow[iColNum].SetY( fYPos ); + float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset ); + m_ColorArrow[iColNum].SetAlpha( fAlpha ); + m_ColorArrow[iColNum].DrawGrayPart(); + + + if( hss.m_HoldScore == HoldStepScore::HOLD_STEPPED_ON || hss.m_HoldScore == HoldStepScore::HOLD_SCORE_OK ) fYPos = max( fYPos, GetGrayArrowYPos() ); if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos; m_ColorArrow[iColNum].SetY( fYPos ); - m_ColorArrow[iColNum].SetIndexAndBeat( i, m_fSongBeat ); + m_ColorArrow[iColNum].SetColorPartFromIndexAndBeat( i, m_fSongBeat ); + m_ColorArrow[iColNum].SetGrayPartFromIndexAndBeat( i, m_fSongBeat ); D3DXCOLOR color( 0, 1, 0, 1 ); // color shifts from green to yellow + float fPercentageDead = hss.m_fTimeNotHeld / 0.5f; // Hack! Hard coded hold period + color *= 1 - fPercentageDead / 1.2f; + color.a = 1; m_ColorArrow[iColNum].SetDiffuseColor( color ); - float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset ); m_ColorArrow[iColNum].SetAlpha( fAlpha ); m_ColorArrow[iColNum].Draw(); + } @@ -1042,9 +1100,9 @@ void Player::DrawColorArrows() -float Player::GetColorArrowYPos( int iStepIndex, float fSongBeat ) +float Player::GetColorArrowYPos( float fStepIndex, float fSongBeat ) { - float fBeatsUntilStep = StepIndexToBeat( iStepIndex ) - fSongBeat; + float fBeatsUntilStep = StepIndexToBeat( fStepIndex ) - fSongBeat; float fYOffset = fBeatsUntilStep * ARROW_GAP * m_PlayerOptions.m_fArrowScrollSpeed; switch( m_PlayerOptions.m_EffectType ) { @@ -1061,9 +1119,9 @@ float Player::GetColorArrowYPos( int iStepIndex, float fSongBeat ) } -float Player::GetColorArrowYOffset( int iStepIndex, float fSongBeat ) +float Player::GetColorArrowYOffset( float fStepIndex, float fSongBeat ) { - float fBeatsUntilStep = StepIndexToBeat( iStepIndex ) - fSongBeat; + float fBeatsUntilStep = StepIndexToBeat( fStepIndex ) - fSongBeat; float fYOffset = fBeatsUntilStep * ARROW_GAP * m_PlayerOptions.m_fArrowScrollSpeed; switch( m_PlayerOptions.m_EffectType ) { diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index a70bc60352..c482ea4e83 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -81,8 +81,8 @@ protected: // color arrows void SetColorArrowsX( int iX ); void UpdateColorArrows( float fDeltaTime ); - float GetColorArrowYPos( int iStepIndex, float fSongBeat ); - float GetColorArrowYOffset( int iStepIndex, float fSongBeat ); + float GetColorArrowYPos( float fStepIndex, float fSongBeat ); + float GetColorArrowYOffset( float fStepIndex, float fSongBeat ); float GetColorArrowAlphaFromYOffset( float fYOffset ); void DrawColorArrows(); int m_iColorArrowFrameOffset[MAX_STEP_ELEMENTS]; diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index 354b50c9ab..11e1caaae2 100644 --- a/stepmania/src/RageBitmapTexture.cpp +++ b/stepmania/src/RageBitmapTexture.cpp @@ -31,14 +31,14 @@ //----------------------------------------------------------------------------- // RageBitmapTexture constructor //----------------------------------------------------------------------------- -RageBitmapTexture::RageBitmapTexture( LPRageScreen pScreen, CString sFilePath ) : +RageBitmapTexture::RageBitmapTexture( LPRageScreen pScreen, CString sFilePath, DWORD dwHints ) : RageTexture( pScreen, sFilePath ) { // RageLog( "RageBitmapTexture::RageBitmapTexture()" ); m_pd3dTexture = NULL; - Create(); + Create( dwHints ); CreateFrameRects(); } @@ -58,7 +58,7 @@ LPDIRECT3DTEXTURE8 RageBitmapTexture::GetD3DTexture() } -void RageBitmapTexture::Create() +void RageBitmapTexture::Create( DWORD dwHints ) { HRESULT hr; @@ -84,7 +84,11 @@ void RageBitmapTexture::Create() // look in the file name for a dither hint - bool bDither = false;//-1 == m_sFilePath.Find("no dither"); + bool bDither = (dwHints & HINT_DITHER) + || -1 != m_sFilePath.Find("dither"); + + + bool bCreateMipMaps = !(dwHints & HINT_NOMIPMAPS); // if the user has requested high color textures, use the higher color @@ -120,7 +124,7 @@ void RageBitmapTexture::Create() m_pd3dDevice, // device m_sFilePath, // soure file D3DX_DEFAULT, D3DX_DEFAULT, // width, height - 4, // mip map levels + bCreateMipMaps ? 4 : 0, // mip map levels 0, // usage (is a render target?) fmtTexture, // our preferred texture format D3DPOOL_MANAGED, // which memory pool diff --git a/stepmania/src/RageBitmapTexture.h b/stepmania/src/RageBitmapTexture.h index d783927555..9ca701e0d9 100644 --- a/stepmania/src/RageBitmapTexture.h +++ b/stepmania/src/RageBitmapTexture.h @@ -25,19 +25,23 @@ typedef RageBitmapTexture* LPRageBitmapTexture; //#include +const DWORD HINT_NOMIPMAPS = 1 << 0; +const DWORD HINT_DITHER = 1 << 1; + + //----------------------------------------------------------------------------- // RageBitmapTexture Class Declarations //----------------------------------------------------------------------------- class RageBitmapTexture : public RageTexture { public: - RageBitmapTexture( LPRageScreen pScreen, CString sFilePath ); + RageBitmapTexture( LPRageScreen pScreen, CString sFilePath, DWORD dwHints = 0 ); ~RageBitmapTexture(); virtual LPDIRECT3DTEXTURE8 GetD3DTexture(); protected: - virtual VOID Create(); + virtual VOID Create( DWORD dwHints ); LPDIRECT3DTEXTURE8 m_pd3dTexture; }; diff --git a/stepmania/src/RageTextureManager.cpp b/stepmania/src/RageTextureManager.cpp index 25938d4943..2e344cdb28 100644 --- a/stepmania/src/RageTextureManager.cpp +++ b/stepmania/src/RageTextureManager.cpp @@ -51,7 +51,7 @@ RageTextureManager::~RageTextureManager() //----------------------------------------------------------------------------- // Load/Unload textures from disk //----------------------------------------------------------------------------- -LPRageTexture RageTextureManager::LoadTexture( CString sTexturePath ) +LPRageTexture RageTextureManager::LoadTexture( CString sTexturePath, DWORD dwHints, bool bForceReload ) { // RageLog( "RageTextureManager::LoadTexture(%s).", sTexturePath ); @@ -77,7 +77,7 @@ LPRageTexture RageTextureManager::LoadTexture( CString sTexturePath ) if( sExt == "avi" || sExt == "mpg" || sExt == "mpeg" ) pTexture = (LPRageTexture) new RageMovieTexture( m_pScreen, sTexturePath ); else - pTexture = (LPRageTexture) new RageBitmapTexture( m_pScreen, sTexturePath ); + pTexture = (LPRageTexture) new RageBitmapTexture( m_pScreen, sTexturePath, dwHints ); RageLog( "RageTextureManager: allocating space for '%s' (%ux%u).", sTexturePath, pTexture->GetTextureWidth(), pTexture->GetTextureHeight() ); diff --git a/stepmania/src/RageTextureManager.h b/stepmania/src/RageTextureManager.h index 57ba8a738f..330ddde71e 100644 --- a/stepmania/src/RageTextureManager.h +++ b/stepmania/src/RageTextureManager.h @@ -32,7 +32,7 @@ public: RageTextureManager( LPRageScreen pScreen ); ~RageTextureManager(); - LPRageTexture LoadTexture( CString sTexturePath ); + LPRageTexture LoadTexture( CString sTexturePath, DWORD dwHints = 0, bool bForceReload = false ); bool IsTextureLoaded( CString sTexturePath ); void UnloadTexture( CString sTexturePath ); diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index e58605554f..43337cfa60 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -58,12 +58,12 @@ Sprite::~Sprite() } -bool Sprite::LoadFromTexture( CString sTexturePath ) +bool Sprite::LoadFromTexture( CString sTexturePath, DWORD dwHints, bool bForceReload ) { RageLog( ssprintf("Sprite::LoadFromTexture(%s)", sTexturePath) ); //Init(); - return LoadTexture( sTexturePath ); + return LoadTexture( sTexturePath, dwHints, bForceReload ); } // Sprite file has the format: @@ -74,7 +74,7 @@ bool Sprite::LoadFromTexture( CString sTexturePath ) // Delay0000=1.0 // Frame0001=3 // Delay0000=2.0 -bool Sprite::LoadFromSpriteFile( CString sSpritePath ) +bool Sprite::LoadFromSpriteFile( CString sSpritePath, DWORD dwHints, bool bForceReload ) { RageLog( ssprintf("Sprite::LoadFromSpriteFile(%s)", sSpritePath) ); @@ -141,7 +141,7 @@ bool Sprite::LoadFromSpriteFile( CString sSpritePath ) return true; } -bool Sprite::LoadTexture( CString sTexturePath ) +bool Sprite::LoadTexture( CString sTexturePath, DWORD dwHints, bool bForceReload ) { if( m_sTexturePath != "" ) // If there was a previous bitmap... TM->UnloadTexture( m_sTexturePath ); // Unload it. @@ -149,7 +149,7 @@ bool Sprite::LoadTexture( CString sTexturePath ) m_sTexturePath = sTexturePath; - m_pTexture = TM->LoadTexture( m_sTexturePath ); + m_pTexture = TM->LoadTexture( m_sTexturePath, dwHints, bForceReload ); assert( m_pTexture != NULL ); // the size of the sprite is the size of the image before it was scaled diff --git a/stepmania/src/Sprite.h b/stepmania/src/Sprite.h index 68b69cc729..57eee7e147 100644 --- a/stepmania/src/Sprite.h +++ b/stepmania/src/Sprite.h @@ -28,12 +28,12 @@ public: Sprite(); virtual ~Sprite(); - virtual bool Load( CString sFilePath ) + virtual bool Load( CString sFilePath, DWORD dwHints = 0, bool bForceReload = false ) { if( sFilePath.Right(7) == ".sprite" ) - return LoadFromSpriteFile( sFilePath ); + return LoadFromSpriteFile( sFilePath, dwHints, bForceReload ); else - return LoadFromTexture( sFilePath ); + return LoadFromTexture( sFilePath, dwHints, bForceReload ); }; virtual void RenderPrimitives(); @@ -61,12 +61,12 @@ public: protected: - virtual bool LoadFromTexture( CString sTexturePath ); - virtual bool LoadFromSpriteFile( CString sSpritePath ); + virtual bool LoadFromTexture( CString sTexturePath, DWORD dwHints = 0, bool bForceReload = false ); + virtual bool LoadFromSpriteFile( CString sSpritePath, DWORD dwHints = 0, bool bForceReload = false ); + virtual bool LoadTexture( CString sTexture, DWORD dwHints = 0, bool bForceReload = false ); - bool LoadTexture( CString sTexture ); CString m_sSpritePath; RageTexture* m_pTexture; diff --git a/stepmania/src/StepMania.RC b/stepmania/src/StepMania.RC index d859c63b19..a731b35667 100644 --- a/stepmania/src/StepMania.RC +++ b/stepmania/src/StepMania.RC @@ -55,6 +55,10 @@ END IDR_MAIN_ACCEL ACCELERATORS DISCARDABLE BEGIN VK_F4, IDM_TOGGLEFULLSCREEN, VIRTKEY, NOINVERT + VK_F5, IDM_CHANGERESOLUTION, VIRTKEY, NOINVERT + VK_F6, IDM_CHANGEDISPLAYCOLOR, VIRTKEY, NOINVERT + VK_F7, IDM_CHANGETEXTURECOLOR, VIRTKEY, NOINVERT + VK_F8, IDM_TOGGLESTATISTICS, VIRTKEY, NOINVERT VK_RETURN, IDM_TOGGLEFULLSCREEN, VIRTKEY, ALT, NOINVERT "X", IDM_EXIT, VIRTKEY, ALT, NOINVERT END diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index dca0c3b517..c975ee50ed 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -76,7 +76,7 @@ HRESULT InvalidateObjects(); // invalidate game objects before a display mode HRESULT RestoreObjects(); // restore game objects after a display mode change VOID DestroyObjects(); // deallocate game objects when we're done with them -BOOL SwitchDisplayMode( BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP ); +BOOL SwitchDisplayMode();// BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP ); BOOL WeAreAlone( LPSTR szName ); @@ -181,7 +181,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow ) Update(); Render(); //if( !g_bFullscreen ) - ::Sleep(4 ); // give some time for the movie decoding thread + ::Sleep(0 ); // give some time for the movie decoding thread } } // end while( WM_QUIT != msg.message ) @@ -259,10 +259,30 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) case WM_COMMAND: + { + GameOptions &go = GAMEINFO->m_GameOptions; switch( LOWORD(wParam) ) { + case IDM_TOGGLEFULLSCREEN: - SwitchDisplayMode( !SCREEN->IsWindowed(), SCREEN_WIDTH, SCREEN_HEIGHT, 16 ); + go.m_bWindowed = !go.m_bWindowed; + SwitchDisplayMode();// !SCREEN->IsWindowed(), SCREEN_WIDTH, SCREEN_HEIGHT, 16 ); + return 0; + case IDM_CHANGERESOLUTION: + go.m_iResolution = (go.m_iResolution==640) ? 320 : 640; + SwitchDisplayMode(); + return 0; + case IDM_CHANGEDISPLAYCOLOR: + go.m_iDisplayColor = (go.m_iDisplayColor==16) ? 32 : 16; + SwitchDisplayMode(); + return 0; + case IDM_CHANGETEXTURECOLOR: + go.m_iTextureColor = (go.m_iTextureColor==16) ? 32 : 16; + SwitchDisplayMode(); + return 0; + case IDM_TOGGLESTATISTICS: + go.m_bShowFPS = !go.m_bShowFPS; + SwitchDisplayMode(); return 0; case IDM_EXIT: // Recieved key/menu command to exit app @@ -270,7 +290,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) return 0; } break; - + } case WM_NCHITTEST: // Prevent the user from selecting the menu in fullscreen mode if( !SCREEN->IsWindowed() ) @@ -342,13 +362,12 @@ HRESULT CreateObjects( HWND hWnd ) SetForegroundWindow( hWnd ); // switch the screen resolution according to user's prefs - GameOptions &go = GAMEINFO->m_GameOptions; - SwitchDisplayMode( - go.m_bWindowed, - go.m_iResolution, - go.m_iResolution==640 ? 480 : 240, - go.m_iDisplayColor - ); + SwitchDisplayMode(); +// go.m_bWindowed, +// go.m_iResolution, +// go.m_iResolution==640 ? 480 : 240, +// go.m_iDisplayColor +// ); TM = new RageTextureManager( SCREEN ); THEME = new ThemeManager; @@ -356,12 +375,12 @@ HRESULT CreateObjects( HWND hWnd ) // Ugly... Switch the screen resolution again so that the system message will display - SwitchDisplayMode( - go.m_bWindowed, - go.m_iResolution, - go.m_iResolution==640 ? 480 : 240, - go.m_iDisplayColor - ); + SwitchDisplayMode(); +// go.m_bWindowed, +// go.m_iResolution, +// go.m_iResolution==640 ? 480 : 240, +// go.m_iDisplayColor +// ); WM->SystemMessage( ssprintf("Found %d songs.", GAMEINFO->m_pSongs.GetSize()) ); @@ -566,10 +585,19 @@ void ShowFrame() // Name: SwitchDisplayMode() // Desc: //----------------------------------------------------------------------------- -BOOL SwitchDisplayMode( BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP ) +BOOL SwitchDisplayMode()//( BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP ) { InvalidateObjects(); + + // use GameOptions to get the display settings + GameOptions &go = GAMEINFO->m_GameOptions; + bool bWindowed = go.m_bWindowed; + DWORD dwWidth = go.m_iResolution; + DWORD dwHeight = go.m_iResolution==640 ? 480 : 240; + DWORD dwBPP = go.m_iDisplayColor; + + // If the requested resolution doesn't work, keep switching until we find one that does. if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwBPP ) ) diff --git a/stepmania/src/StepMania.h b/stepmania/src/StepMania.h index 8167b6b2bd..81f413b024 100644 --- a/stepmania/src/StepMania.h +++ b/stepmania/src/StepMania.h @@ -12,7 +12,7 @@ #define _STEPMANIA_H_ -BOOL SwitchDisplayMode( BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP ); +BOOL SwitchDisplayMode();//( BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP ); diff --git a/stepmania/src/resource.h b/stepmania/src/resource.h index 0e64508eda..1501aac90e 100644 --- a/stepmania/src/resource.h +++ b/stepmania/src/resource.h @@ -4,8 +4,12 @@ // #define IDR_MAIN_ACCEL 1001 #define IDM_TOGGLEFULLSCREEN 1002 -#define IDI_ICON 1003 -#define IDC_CURSOR 1004 +#define IDM_CHANGERESOLUTION 1003 +#define IDM_CHANGEDISPLAYCOLOR 1004 +#define IDM_CHANGETEXTURECOLOR 1005 +#define IDM_TOGGLESTATISTICS 1006 +#define IDI_ICON 1007 +#define IDC_CURSOR 1008 #define IDM_EXIT 40003 // Next default values for new objects @@ -14,7 +18,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 111 #define _APS_NEXT_COMMAND_VALUE 40009 -#define _APS_NEXT_CONTROL_VALUE 1006 +#define _APS_NEXT_CONTROL_VALUE 1009 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif