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:
Chris Danford
2002-02-03 20:45:08 +00:00
parent 13afccfe10
commit 49f4997d47
16 changed files with 201 additions and 97 deletions
+5 -9
View File
@@ -13,20 +13,16 @@
#include "Banner.h" #include "Banner.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "RageBitmapTexture.h"
bool Banner::LoadFromSong( Song* pSong ) // NULL means no song bool Banner::LoadFromSong( Song* pSong ) // NULL means no song
{ {
if( pSong == NULL ) if( pSong == NULL ) Sprite::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER), HINT_NOMIPMAPS );
Sprite::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) ); else if( pSong->HasBanner() ) Sprite::Load( pSong->GetBannerPath(), HINT_NOMIPMAPS );
else if( pSong->HasBanner() ) else if( pSong->HasBackground() ) Sprite::Load( pSong->GetBackgroundPath(), HINT_NOMIPMAPS );
Sprite::Load( pSong->GetBannerPath() ); else Sprite::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER), HINT_NOMIPMAPS );
else if( pSong->HasBackground() )
Sprite::Load( pSong->GetBackgroundPath() );
else
Sprite::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) );
Sprite::TurnShadowOff(); Sprite::TurnShadowOff();
+18 -20
View File
@@ -258,31 +258,33 @@ void BitmapText::RebuildVertexBuffer()
if( fPercentExtra > 1-fPercentageOfFrame ) if( fPercentExtra > 1-fPercentageOfFrame )
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(); 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 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 // set texture coordinates
m_iNumV -= 4; m_iNumV -= 6;
FRECT* pTexCoordRect = m_pTexture->GetTextureCoordRect( iFrameNo ); FRECT* pTexCoordRect = m_pTexture->GetTextureCoordRect( iFrameNo );
float fExtraTexCoords = fPercentExtra * m_pTexture->GetTextureFrameWidth() / m_pTexture->GetTextureWidth(); 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->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 = 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; LPDIRECT3DVERTEXBUFFER8 pVB = m_pVB;
@@ -399,8 +401,7 @@ void BitmapText::RenderPrimitives()
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
for( i=0; i<m_iNumV; i+=4 ) pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, i, 2 );
SCREEN->PopMatrix(); SCREEN->PopMatrix();
} }
@@ -430,9 +431,7 @@ void BitmapText::RenderPrimitives()
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );//bBlendAdd ? D3DTOP_ADD : D3DTOP_MODULATE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );//bBlendAdd ? D3DTOP_ADD : D3DTOP_MODULATE );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 );
for( i=0; i<m_iNumV; i+=4 )
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, i, 2 );
} }
@@ -455,8 +454,7 @@ void BitmapText::RenderPrimitives()
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
for( i=0; i<m_iNumV; i+=4 ) pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, i, 2 );
} }
} }
+8
View File
@@ -45,6 +45,14 @@ void HoldGhostArrow::Update( float fDeltaTime )
int iStateNum = min( m_fHeatLevel * GetNumStates(), GetNumStates()-1 ); int iStateNum = min( m_fHeatLevel * GetNumStates(), GetNumStates()-1 );
SetState( iStateNum ); 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) ); SetDiffuseColor( D3DXCOLOR(1,1,1,m_fHeatLevel*3) );
m_bWasSteppedOnLastFrame = false; // reset for next frame m_bWasSteppedOnLastFrame = false; // reset for next frame
+1 -1
View File
@@ -16,7 +16,7 @@
#include "ActorFrame.h" #include "ActorFrame.h"
const int NUM_BLUR_GHOSTS = 1; const int NUM_BLUR_GHOSTS = 2;
class MotionBlurSprite : public Actor class MotionBlurSprite : public Actor
{ {
+78 -20
View File
@@ -60,6 +60,7 @@ const float PILL_OFFSET_Y[LIEFMETER_NUM_PILLS] = {
const float SCORE_Y = SCREEN_HEIGHT - 40; const float SCORE_Y = SCREEN_HEIGHT - 40;
const float HOLD_ARROW_NG_TIME = 0.27f;
Player::Player() Player::Player()
{ {
@@ -470,6 +471,8 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
for( int i=0; i<m_HoldSteps.GetSize(); i++ ) for( int i=0; i<m_HoldSteps.GetSize(); i++ )
{ {
HoldStep &hs = m_HoldSteps[i]; HoldStep &hs = m_HoldSteps[i];
HoldStepScore &hss = m_HoldStepScores[i];
float fStartBeat = StepIndexToBeat( hs.m_iStartIndex ); float fStartBeat = StepIndexToBeat( hs.m_iStartIndex );
float fEndBeat = StepIndexToBeat( hs.m_iEndIndex ); 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 }; PlayerInput PlayerI = { m_PlayerNumber, hs.m_Step };
if( GAMEINFO->IsButtonDown( PlayerI ) ) // they're holding the button down 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 ]; int iCol = m_StepToColumnNumber[ hs.m_Step ];
m_HoldGhostArrow[iCol].Step(); m_HoldGhostArrow[iCol].Step();
} }
@@ -492,22 +496,29 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
PlayerInput PlayerI = { m_PlayerNumber, hs.m_Step }; PlayerInput PlayerI = { m_PlayerNumber, hs.m_Step };
if( !GAMEINFO->IsButtonDown( PlayerI ) ) // they're not holding the button down if( !GAMEINFO->IsButtonDown( PlayerI ) ) // they're not holding the button down
{ {
m_HoldStepScores[i].m_HoldScore = 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 ]; int iCol = m_StepToColumnNumber[ hs.m_Step ];
SetHoldJudgement( iCol, HoldStepScore::HOLD_SCORE_NG ); SetHoldJudgement( iCol, HoldStepScore::HOLD_SCORE_NG );
} }
} }
} }
}
// check for HoldStep completes // check for HoldStep completes
for( i=0; i<m_HoldSteps.GetSize(); i++ ) for( i=0; i<m_HoldSteps.GetSize(); i++ )
{ {
HoldStep &hs = m_HoldSteps[i]; HoldStep &hs = m_HoldSteps[i];
HoldStepScore &hss = m_HoldStepScores[i];
float fEndBeat = StepIndexToBeat( hs.m_iEndIndex ); float fEndBeat = StepIndexToBeat( hs.m_iEndIndex );
if( m_fSongBeat > fEndBeat && // if this hold step is in the past 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 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; m_HoldStepScores[i].m_HoldScore = HoldStepScore::HOLD_SCORE_OK;
int iCol = m_StepToColumnNumber[ hs.m_Step ]; int iCol = m_StepToColumnNumber[ hs.m_Step ];
SetHoldJudgement( iCol, HoldStepScore::HOLD_SCORE_OK ); SetHoldJudgement( iCol, HoldStepScore::HOLD_SCORE_OK );
@@ -913,6 +924,7 @@ void Player::DrawColorArrows()
//RageLog( "Drawing elements %d through %d", iIndexFirstArrowToDraw, iIndexLastArrowToDraw ); //RageLog( "Drawing elements %d through %d", iIndexFirstArrowToDraw, iIndexLastArrowToDraw );
// draw all normal arrows
for( int i=iIndexFirstArrowToDraw; i<=iIndexLastArrowToDraw; i++ ) // for each row for( int i=iIndexFirstArrowToDraw; i<=iIndexLastArrowToDraw; i++ ) // for each row
{ {
if( m_LeftToStepOn[i] != 0 || // this step is not yet complete 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] ); //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 // See if there is a hold step that begins on this beat. Terribly inefficient!
if( m_OriginalStep[i] & m_ColumnNumberToStep[c] ) { // this column is still unstepped on? 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].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].SetAlpha( fAlpha );
m_ColorArrow[c].Draw(); m_ColorArrow[c].Draw();
} }
@@ -955,11 +987,11 @@ void Player::DrawColorArrows()
continue; continue;
} }
HoldStepScore::HoldScore &score = m_HoldStepScores[i].m_HoldScore; HoldStepScore &hss = m_HoldStepScores[i];
int iColNum = m_StepToColumnNumber[ hs.m_Step ]; int iColNum = m_StepToColumnNumber[ hs.m_Step ];
switch( score ) switch( hss.m_HoldScore )
{ {
case HoldStepScore::HOLD_SCORE_OK: case HoldStepScore::HOLD_SCORE_OK:
continue; // don't draw continue; // don't draw
@@ -973,9 +1005,9 @@ void Player::DrawColorArrows()
} }
// draw the gray parts // 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) if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j)
continue; // skip this arrow continue; // skip this arrow
@@ -983,7 +1015,7 @@ void Player::DrawColorArrows()
float fYOffset = GetColorArrowYOffset( j, m_fSongBeat ); float fYOffset = GetColorArrowYOffset( j, m_fSongBeat );
float fYPos = GetColorArrowYPos( 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() ) if( fYPos < GetGrayArrowYPos() )
continue; // don't draw continue; // don't draw
@@ -996,17 +1028,17 @@ void Player::DrawColorArrows()
} }
// draw the color parts // 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 // check if this arrow is off the the screen
if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j) if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j )
continue; // skip this arrow continue; // skip this arrow
float fYOffset = GetColorArrowYOffset( j, m_fSongBeat ); float fYOffset = GetColorArrowYOffset( j, m_fSongBeat );
float fYPos = GetColorArrowYPos( j, m_fSongBeat ); float fYPos = GetColorArrowYPos( j, m_fSongBeat );
m_ColorArrow[iColNum].SetY( fYPos ); 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() ) if( fYPos < GetGrayArrowYPos() )
continue; // don't draw continue; // don't draw
@@ -1014,37 +1046,63 @@ void Player::DrawColorArrows()
if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos; if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos;
m_ColorArrow[iColNum].SetY( 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 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 ); m_ColorArrow[iColNum].SetDiffuseColor( color );
float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset ); float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset );
m_ColorArrow[iColNum].SetAlpha( fAlpha ); m_ColorArrow[iColNum].SetAlpha( fAlpha );
m_ColorArrow[iColNum].DrawColorPart(); m_ColorArrow[iColNum].DrawColorPart();
} }
// draw the first arrow on top of the others // draw the first arrow on top of the others
j = hs.m_iStartIndex; 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 fYOffset = GetColorArrowYOffset( j, m_fSongBeat );
float fYPos = GetColorArrowYPos( 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() ); fYPos = max( fYPos, GetGrayArrowYPos() );
if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos; if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos;
m_ColorArrow[iColNum].SetY( 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 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 ); m_ColorArrow[iColNum].SetDiffuseColor( color );
float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset );
m_ColorArrow[iColNum].SetAlpha( fAlpha ); m_ColorArrow[iColNum].SetAlpha( fAlpha );
m_ColorArrow[iColNum].Draw(); m_ColorArrow[iColNum].Draw();
} }
} }
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; float fYOffset = fBeatsUntilStep * ARROW_GAP * m_PlayerOptions.m_fArrowScrollSpeed;
switch( m_PlayerOptions.m_EffectType ) 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; float fYOffset = fBeatsUntilStep * ARROW_GAP * m_PlayerOptions.m_fArrowScrollSpeed;
switch( m_PlayerOptions.m_EffectType ) switch( m_PlayerOptions.m_EffectType )
{ {
+2 -2
View File
@@ -81,8 +81,8 @@ protected:
// color arrows // color arrows
void SetColorArrowsX( int iX ); void SetColorArrowsX( int iX );
void UpdateColorArrows( float fDeltaTime ); void UpdateColorArrows( float fDeltaTime );
float GetColorArrowYPos( int iStepIndex, float fSongBeat ); float GetColorArrowYPos( float fStepIndex, float fSongBeat );
float GetColorArrowYOffset( int iStepIndex, float fSongBeat ); float GetColorArrowYOffset( float fStepIndex, float fSongBeat );
float GetColorArrowAlphaFromYOffset( float fYOffset ); float GetColorArrowAlphaFromYOffset( float fYOffset );
void DrawColorArrows(); void DrawColorArrows();
int m_iColorArrowFrameOffset[MAX_STEP_ELEMENTS]; int m_iColorArrowFrameOffset[MAX_STEP_ELEMENTS];
+9 -5
View File
@@ -31,14 +31,14 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// RageBitmapTexture constructor // RageBitmapTexture constructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
RageBitmapTexture::RageBitmapTexture( LPRageScreen pScreen, CString sFilePath ) : RageBitmapTexture::RageBitmapTexture( LPRageScreen pScreen, CString sFilePath, DWORD dwHints ) :
RageTexture( pScreen, sFilePath ) RageTexture( pScreen, sFilePath )
{ {
// RageLog( "RageBitmapTexture::RageBitmapTexture()" ); // RageLog( "RageBitmapTexture::RageBitmapTexture()" );
m_pd3dTexture = NULL; m_pd3dTexture = NULL;
Create(); Create( dwHints );
CreateFrameRects(); CreateFrameRects();
} }
@@ -58,7 +58,7 @@ LPDIRECT3DTEXTURE8 RageBitmapTexture::GetD3DTexture()
} }
void RageBitmapTexture::Create() void RageBitmapTexture::Create( DWORD dwHints )
{ {
HRESULT hr; HRESULT hr;
@@ -84,7 +84,11 @@ void RageBitmapTexture::Create()
// look in the file name for a dither hint // 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 // if the user has requested high color textures, use the higher color
@@ -120,7 +124,7 @@ void RageBitmapTexture::Create()
m_pd3dDevice, // device m_pd3dDevice, // device
m_sFilePath, // soure file m_sFilePath, // soure file
D3DX_DEFAULT, D3DX_DEFAULT, // width, height D3DX_DEFAULT, D3DX_DEFAULT, // width, height
4, // mip map levels bCreateMipMaps ? 4 : 0, // mip map levels
0, // usage (is a render target?) 0, // usage (is a render target?)
fmtTexture, // our preferred texture format fmtTexture, // our preferred texture format
D3DPOOL_MANAGED, // which memory pool D3DPOOL_MANAGED, // which memory pool
+6 -2
View File
@@ -25,19 +25,23 @@ typedef RageBitmapTexture* LPRageBitmapTexture;
//#include <d3d8types.h> //#include <d3d8types.h>
const DWORD HINT_NOMIPMAPS = 1 << 0;
const DWORD HINT_DITHER = 1 << 1;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// RageBitmapTexture Class Declarations // RageBitmapTexture Class Declarations
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class RageBitmapTexture : public RageTexture class RageBitmapTexture : public RageTexture
{ {
public: public:
RageBitmapTexture( LPRageScreen pScreen, CString sFilePath ); RageBitmapTexture( LPRageScreen pScreen, CString sFilePath, DWORD dwHints = 0 );
~RageBitmapTexture(); ~RageBitmapTexture();
virtual LPDIRECT3DTEXTURE8 GetD3DTexture(); virtual LPDIRECT3DTEXTURE8 GetD3DTexture();
protected: protected:
virtual VOID Create(); virtual VOID Create( DWORD dwHints );
LPDIRECT3DTEXTURE8 m_pd3dTexture; LPDIRECT3DTEXTURE8 m_pd3dTexture;
}; };
+2 -2
View File
@@ -51,7 +51,7 @@ RageTextureManager::~RageTextureManager()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Load/Unload textures from disk // Load/Unload textures from disk
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LPRageTexture RageTextureManager::LoadTexture( CString sTexturePath ) LPRageTexture RageTextureManager::LoadTexture( CString sTexturePath, DWORD dwHints, bool bForceReload )
{ {
// RageLog( "RageTextureManager::LoadTexture(%s).", sTexturePath ); // RageLog( "RageTextureManager::LoadTexture(%s).", sTexturePath );
@@ -77,7 +77,7 @@ LPRageTexture RageTextureManager::LoadTexture( CString sTexturePath )
if( sExt == "avi" || sExt == "mpg" || sExt == "mpeg" ) if( sExt == "avi" || sExt == "mpg" || sExt == "mpeg" )
pTexture = (LPRageTexture) new RageMovieTexture( m_pScreen, sTexturePath ); pTexture = (LPRageTexture) new RageMovieTexture( m_pScreen, sTexturePath );
else 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() ); RageLog( "RageTextureManager: allocating space for '%s' (%ux%u).", sTexturePath, pTexture->GetTextureWidth(), pTexture->GetTextureHeight() );
+1 -1
View File
@@ -32,7 +32,7 @@ public:
RageTextureManager( LPRageScreen pScreen ); RageTextureManager( LPRageScreen pScreen );
~RageTextureManager(); ~RageTextureManager();
LPRageTexture LoadTexture( CString sTexturePath ); LPRageTexture LoadTexture( CString sTexturePath, DWORD dwHints = 0, bool bForceReload = false );
bool IsTextureLoaded( CString sTexturePath ); bool IsTextureLoaded( CString sTexturePath );
void UnloadTexture( CString sTexturePath ); void UnloadTexture( CString sTexturePath );
+5 -5
View File
@@ -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) ); RageLog( ssprintf("Sprite::LoadFromTexture(%s)", sTexturePath) );
//Init(); //Init();
return LoadTexture( sTexturePath ); return LoadTexture( sTexturePath, dwHints, bForceReload );
} }
// Sprite file has the format: // Sprite file has the format:
@@ -74,7 +74,7 @@ bool Sprite::LoadFromTexture( CString sTexturePath )
// Delay0000=1.0 // Delay0000=1.0
// Frame0001=3 // Frame0001=3
// Delay0000=2.0 // Delay0000=2.0
bool Sprite::LoadFromSpriteFile( CString sSpritePath ) bool Sprite::LoadFromSpriteFile( CString sSpritePath, DWORD dwHints, bool bForceReload )
{ {
RageLog( ssprintf("Sprite::LoadFromSpriteFile(%s)", sSpritePath) ); RageLog( ssprintf("Sprite::LoadFromSpriteFile(%s)", sSpritePath) );
@@ -141,7 +141,7 @@ bool Sprite::LoadFromSpriteFile( CString sSpritePath )
return true; 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... if( m_sTexturePath != "" ) // If there was a previous bitmap...
TM->UnloadTexture( m_sTexturePath ); // Unload it. TM->UnloadTexture( m_sTexturePath ); // Unload it.
@@ -149,7 +149,7 @@ bool Sprite::LoadTexture( CString sTexturePath )
m_sTexturePath = sTexturePath; m_sTexturePath = sTexturePath;
m_pTexture = TM->LoadTexture( m_sTexturePath ); m_pTexture = TM->LoadTexture( m_sTexturePath, dwHints, bForceReload );
assert( m_pTexture != NULL ); assert( m_pTexture != NULL );
// the size of the sprite is the size of the image before it was scaled // the size of the sprite is the size of the image before it was scaled
+7 -7
View File
@@ -28,12 +28,12 @@ public:
Sprite(); Sprite();
virtual ~Sprite(); virtual ~Sprite();
virtual bool Load( CString sFilePath ) virtual bool Load( CString sFilePath, DWORD dwHints = 0, bool bForceReload = false )
{ {
if( sFilePath.Right(7) == ".sprite" ) if( sFilePath.Right(7) == ".sprite" )
return LoadFromSpriteFile( sFilePath ); return LoadFromSpriteFile( sFilePath, dwHints, bForceReload );
else else
return LoadFromTexture( sFilePath ); return LoadFromTexture( sFilePath, dwHints, bForceReload );
}; };
virtual void RenderPrimitives(); virtual void RenderPrimitives();
@@ -61,13 +61,13 @@ public:
protected: protected:
virtual bool LoadFromTexture( CString sTexturePath ); virtual bool LoadFromTexture( CString sTexturePath, DWORD dwHints = 0, bool bForceReload = false );
virtual bool LoadFromSpriteFile( CString sSpritePath ); 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; CString m_sSpritePath;
RageTexture* m_pTexture; RageTexture* m_pTexture;
CString m_sTexturePath; CString m_sTexturePath;
+4
View File
@@ -55,6 +55,10 @@ END
IDR_MAIN_ACCEL ACCELERATORS DISCARDABLE IDR_MAIN_ACCEL ACCELERATORS DISCARDABLE
BEGIN BEGIN
VK_F4, IDM_TOGGLEFULLSCREEN, VIRTKEY, NOINVERT 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 VK_RETURN, IDM_TOGGLEFULLSCREEN, VIRTKEY, ALT, NOINVERT
"X", IDM_EXIT, VIRTKEY, ALT, NOINVERT "X", IDM_EXIT, VIRTKEY, ALT, NOINVERT
END END
+46 -18
View File
@@ -76,7 +76,7 @@ HRESULT InvalidateObjects(); // invalidate game objects before a display mode
HRESULT RestoreObjects(); // restore game objects after a display mode change HRESULT RestoreObjects(); // restore game objects after a display mode change
VOID DestroyObjects(); // deallocate game objects when we're done with them 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 ); BOOL WeAreAlone( LPSTR szName );
@@ -181,7 +181,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
Update(); Update();
Render(); Render();
//if( !g_bFullscreen ) //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 ) } // end while( WM_QUIT != msg.message )
@@ -259,10 +259,30 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
case WM_COMMAND: case WM_COMMAND:
{
GameOptions &go = GAMEINFO->m_GameOptions;
switch( LOWORD(wParam) ) switch( LOWORD(wParam) )
{ {
case IDM_TOGGLEFULLSCREEN: 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; return 0;
case IDM_EXIT: case IDM_EXIT:
// Recieved key/menu command to exit app // Recieved key/menu command to exit app
@@ -270,7 +290,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
return 0; return 0;
} }
break; break;
}
case WM_NCHITTEST: case WM_NCHITTEST:
// Prevent the user from selecting the menu in fullscreen mode // Prevent the user from selecting the menu in fullscreen mode
if( !SCREEN->IsWindowed() ) if( !SCREEN->IsWindowed() )
@@ -342,13 +362,12 @@ HRESULT CreateObjects( HWND hWnd )
SetForegroundWindow( hWnd ); SetForegroundWindow( hWnd );
// switch the screen resolution according to user's prefs // switch the screen resolution according to user's prefs
GameOptions &go = GAMEINFO->m_GameOptions; SwitchDisplayMode();
SwitchDisplayMode( // go.m_bWindowed,
go.m_bWindowed, // go.m_iResolution,
go.m_iResolution, // go.m_iResolution==640 ? 480 : 240,
go.m_iResolution==640 ? 480 : 240, // go.m_iDisplayColor
go.m_iDisplayColor // );
);
TM = new RageTextureManager( SCREEN ); TM = new RageTextureManager( SCREEN );
THEME = new ThemeManager; THEME = new ThemeManager;
@@ -356,12 +375,12 @@ HRESULT CreateObjects( HWND hWnd )
// Ugly... Switch the screen resolution again so that the system message will display // Ugly... Switch the screen resolution again so that the system message will display
SwitchDisplayMode( SwitchDisplayMode();
go.m_bWindowed, // go.m_bWindowed,
go.m_iResolution, // go.m_iResolution,
go.m_iResolution==640 ? 480 : 240, // go.m_iResolution==640 ? 480 : 240,
go.m_iDisplayColor // go.m_iDisplayColor
); // );
WM->SystemMessage( ssprintf("Found %d songs.", GAMEINFO->m_pSongs.GetSize()) ); WM->SystemMessage( ssprintf("Found %d songs.", GAMEINFO->m_pSongs.GetSize()) );
@@ -566,10 +585,19 @@ void ShowFrame()
// Name: SwitchDisplayMode() // Name: SwitchDisplayMode()
// Desc: // Desc:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
BOOL SwitchDisplayMode( BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP ) BOOL SwitchDisplayMode()//( BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP )
{ {
InvalidateObjects(); 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 the requested resolution doesn't work, keep switching until we find one that does.
if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwBPP ) ) if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwBPP ) )
+1 -1
View File
@@ -12,7 +12,7 @@
#define _STEPMANIA_H_ #define _STEPMANIA_H_
BOOL SwitchDisplayMode( BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP ); BOOL SwitchDisplayMode();//( BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP );
+7 -3
View File
@@ -4,8 +4,12 @@
// //
#define IDR_MAIN_ACCEL 1001 #define IDR_MAIN_ACCEL 1001
#define IDM_TOGGLEFULLSCREEN 1002 #define IDM_TOGGLEFULLSCREEN 1002
#define IDI_ICON 1003 #define IDM_CHANGERESOLUTION 1003
#define IDC_CURSOR 1004 #define IDM_CHANGEDISPLAYCOLOR 1004
#define IDM_CHANGETEXTURECOLOR 1005
#define IDM_TOGGLESTATISTICS 1006
#define IDI_ICON 1007
#define IDC_CURSOR 1008
#define IDM_EXIT 40003 #define IDM_EXIT 40003
// Next default values for new objects // Next default values for new objects
@@ -14,7 +18,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 111 #define _APS_NEXT_RESOURCE_VALUE 111
#define _APS_NEXT_COMMAND_VALUE 40009 #define _APS_NEXT_COMMAND_VALUE 40009
#define _APS_NEXT_CONTROL_VALUE 1006 #define _APS_NEXT_CONTROL_VALUE 1009
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif