OPTIMIZATION: Major optimization of BitmapText. Now about 2x faster.
NEW FEATURE: F4-F8: Toggle Fullscreen, Change Resolution, Change Display Color, Change Texture Color, Toggle Statistics NEW FEATURE: Remebers last selected Steps NEW FEATURE: Stage number saved to .ini file. BUG FIX: Default key buttons don't work if .ini file not present on startup CHANGE: Hold Arrows are now drawn last to first, like in DDR MAX. NEW FEATURE: Hold Arrows allow you to not hold the button for a second without NG'ing them. CHANGE: Regular Arrows on the same line as a Hold Arrow now appear green. NEW FEATURE: Hold Arrows now turn gray player doesn't hold the button. NEW FEATURE: More texture loading hints (DITHER, NO_MIP_MAPS) for increased quality and faster loading time.
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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; i<m_iNumV; i+=4 )
|
||||
pd3dDevice->DrawPrimitive( 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; i<m_iNumV; i+=4 )
|
||||
pd3dDevice->DrawPrimitive( 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; i<m_iNumV; i+=4 )
|
||||
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, i, 2 );
|
||||
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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) );
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "ActorFrame.h"
|
||||
|
||||
|
||||
const int NUM_BLUR_GHOSTS = 1;
|
||||
const int NUM_BLUR_GHOSTS = 2;
|
||||
|
||||
class MotionBlurSprite : public Actor
|
||||
{
|
||||
|
||||
+80
-22
@@ -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; i<m_HoldSteps.GetSize(); i++ )
|
||||
{
|
||||
HoldStep &hs = m_HoldSteps[i];
|
||||
HoldStepScore &hss = m_HoldStepScores[i];
|
||||
|
||||
float fStartBeat = StepIndexToBeat( hs.m_iStartIndex );
|
||||
float fEndBeat = StepIndexToBeat( hs.m_iEndIndex );
|
||||
|
||||
@@ -480,6 +483,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
|
||||
PlayerInput PlayerI = { m_PlayerNumber, hs.m_Step };
|
||||
if( GAMEINFO->IsButtonDown( 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<m_HoldSteps.GetSize(); i++ )
|
||||
{
|
||||
HoldStep &hs = m_HoldSteps[i];
|
||||
HoldStepScore &hss = m_HoldStepScores[i];
|
||||
float fEndBeat = StepIndexToBeat( hs.m_iEndIndex );
|
||||
|
||||
if( m_fSongBeat > 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<m_HoldSteps.GetSize(); j++ )
|
||||
{
|
||||
if( m_HoldSteps[j].m_iStartIndex == i )
|
||||
{
|
||||
bHoldStepOnThisBeat = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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?
|
||||
{
|
||||
m_ColorArrow[c].SetY( fYPos );
|
||||
m_ColorArrow[c].SetIndexAndBeat( i, m_fSongBeat );
|
||||
|
||||
if( bHoldStepOnThisBeat )
|
||||
m_ColorArrow[c].SetDiffuseColor( D3DXCOLOR(0,1,0,1) );
|
||||
else
|
||||
m_ColorArrow[c].SetColorPartFromIndexAndBeat( i, m_fSongBeat );
|
||||
|
||||
m_ColorArrow[c].SetGrayPartFromIndexAndBeat( i, m_fSongBeat );
|
||||
m_ColorArrow[c].SetAlpha( fAlpha );
|
||||
m_ColorArrow[c].Draw();
|
||||
}
|
||||
@@ -955,11 +987,11 @@ void Player::DrawColorArrows()
|
||||
continue;
|
||||
}
|
||||
|
||||
HoldStepScore::HoldScore &score = m_HoldStepScores[i].m_HoldScore;
|
||||
HoldStepScore &hss = m_HoldStepScores[i];
|
||||
|
||||
int iColNum = m_StepToColumnNumber[ hs.m_Step ];
|
||||
|
||||
switch( score )
|
||||
switch( hss.m_HoldScore )
|
||||
{
|
||||
case HoldStepScore::HOLD_SCORE_OK:
|
||||
continue; // don't draw
|
||||
@@ -973,9 +1005,9 @@ void Player::DrawColorArrows()
|
||||
}
|
||||
|
||||
// draw the gray parts
|
||||
for( int j=hs.m_iEndIndex; 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 )
|
||||
{
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -25,19 +25,23 @@ typedef RageBitmapTexture* LPRageBitmapTexture;
|
||||
//#include <d3d8types.h>
|
||||
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -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() );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
+46
-18
@@ -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 ) )
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user