results fixed, rolling score changed
This commit is contained in:
@@ -24,7 +24,7 @@ Background::Background()
|
||||
|
||||
m_sprDanger.SetZoom( 2 );
|
||||
m_sprDanger.SetEffectWagging();
|
||||
m_sprDanger.Load( THEME->GetPathTo(GRAPHIC_DANGER) );
|
||||
m_sprDanger.Load( THEME->GetPathTo(GRAPHIC_DANGER_TEXT) );
|
||||
m_sprDanger.SetXY( CENTER_X, CENTER_Y );
|
||||
|
||||
m_sprDangerBackground.Load( THEME->GetPathTo(GRAPHIC_DANGER_BACKGROUND) );
|
||||
|
||||
@@ -21,7 +21,7 @@ bool Banner::LoadFromSong( Song* pSong ) // NULL means no song
|
||||
{
|
||||
if( pSong == NULL )
|
||||
Sprite::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) );
|
||||
if( pSong->HasBanner() )
|
||||
else if( pSong->HasBanner() )
|
||||
Sprite::Load( pSong->GetBannerPath() );
|
||||
else if( pSong->HasBackground() )
|
||||
Sprite::Load( pSong->GetBackgroundPath() );
|
||||
|
||||
@@ -29,7 +29,19 @@ BitmapText::BitmapText()
|
||||
m_HorizAlign = align_center;
|
||||
m_VertAlign = align_middle;
|
||||
|
||||
// m_bHasShadow = false;
|
||||
// allocate a vertex buffer
|
||||
HRESULT hr;
|
||||
if( FAILED( hr = SCREEN->GetDevice()->CreateVertexBuffer(
|
||||
MAX_NUM_VERTICIES * sizeof(CUSTOMVERTEX),
|
||||
D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX,
|
||||
D3DPOOL_MANAGED, &m_pVB ) ) )
|
||||
RageErrorHr( "Vertex Buffer Could Not Be Created", hr );
|
||||
|
||||
}
|
||||
|
||||
BitmapText::~BitmapText()
|
||||
{
|
||||
SAFE_RELEASE( m_pVB );
|
||||
}
|
||||
|
||||
bool BitmapText::Load( CString sFontFilePath )
|
||||
@@ -230,16 +242,20 @@ void BitmapText::RenderPrimitives()
|
||||
break;
|
||||
}
|
||||
|
||||
pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA );
|
||||
pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA );
|
||||
|
||||
|
||||
// make the object in logical units centered at the origin
|
||||
LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer();
|
||||
CUSTOMVERTEX* v;
|
||||
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
|
||||
m_pVB->Lock( 0, 0, (BYTE**)&v, 0 );
|
||||
|
||||
|
||||
|
||||
|
||||
int iVNum = 0; // the current vertex number
|
||||
int &iVNum = m_iNumVerticies; // the current vertex number
|
||||
iVNum = 0;
|
||||
|
||||
|
||||
float fHeight = GetUnzoomedHeight();
|
||||
float fY;
|
||||
@@ -450,3 +466,96 @@ CString BitmapText::GetText()
|
||||
{
|
||||
return join( "\n", m_sTextLines );
|
||||
}
|
||||
|
||||
void BitmapText::RebuildVertexBuffer()
|
||||
{
|
||||
// make the object in logical units centered at the origin
|
||||
CUSTOMVERTEX* v;
|
||||
m_pVB->Lock( 0, 0, (BYTE**)&v, 0 );
|
||||
|
||||
|
||||
int &iVNum = m_iNumVerticies; // the current vertex number
|
||||
iVNum = 0;
|
||||
|
||||
|
||||
float fHeight = GetUnzoomedHeight();
|
||||
float fY;
|
||||
switch( m_VertAlign )
|
||||
{
|
||||
case align_top: fY = -(m_sTextLines.GetSize()) * fHeight / 2; break; break;
|
||||
case align_middle: fY = 0; break;
|
||||
case align_bottom: fY = (m_sTextLines.GetSize()) * fHeight / 2; break;
|
||||
default: ASSERT( true );
|
||||
}
|
||||
|
||||
|
||||
for( i=0; i<m_sTextLines.GetSize(); i++ ) // foreach line
|
||||
{
|
||||
CString &sLine = m_sTextLines[i];
|
||||
|
||||
float fLineWidth = GetLineWidthInSourcePixels(i);
|
||||
float fX;
|
||||
switch( m_HorizAlign )
|
||||
{
|
||||
case align_left: fX = 0; break;
|
||||
case align_center: fX = -(fLineWidth/2); break;
|
||||
case align_right: fX = -fLineWidth; break;
|
||||
default: ASSERT( true );
|
||||
}
|
||||
|
||||
for( int j=0; j<sLine.GetLength(); j++ ) // for each character in the line
|
||||
{
|
||||
char c = sLine[j];
|
||||
int iFrameNo = m_iCharToFrameNo[c];
|
||||
ASSERT( iFrameNo != -1 ); // this font doesn't implement this character
|
||||
float fCharWidth = m_fFrameNoToWidth[iFrameNo];
|
||||
|
||||
|
||||
|
||||
// HACK:
|
||||
// The right side of italic letters is being cropped. So, we're going to draw a little bit
|
||||
// to the right of the normal character.
|
||||
float fPercentExtra = 0.20f;
|
||||
|
||||
// don't go over the frame boundary and draw part of the adjacent character
|
||||
float fPercentageOfFrame = fCharWidth / GetUnzoomedWidth();
|
||||
if( fPercentExtra > 1-fPercentageOfFrame )
|
||||
fPercentExtra = 1-fPercentageOfFrame;
|
||||
|
||||
|
||||
// set vertex positions
|
||||
|
||||
v[iVNum++].p = D3DXVECTOR3( fX, fY+fHeight/2, 0 ); // bottom left
|
||||
v[iVNum++].p = D3DXVECTOR3( fX, fY-fHeight/2, 0 ); // top left
|
||||
|
||||
fX += fCharWidth;
|
||||
|
||||
float fExtraPixels = fPercentExtra * GetUnzoomedWidth();
|
||||
|
||||
v[iVNum++].p = D3DXVECTOR3( fX+fExtraPixels, fY+fHeight/2, 0 ); // bottom right
|
||||
v[iVNum++].p = D3DXVECTOR3( fX+fExtraPixels, fY-fHeight/2, 0 ); // top right
|
||||
|
||||
|
||||
// set texture coordinates
|
||||
iVNum -= 4;
|
||||
|
||||
FRECT* pTexCoordRect = m_pTexture->GetTextureCoordRect( iFrameNo );
|
||||
|
||||
float fExtraTexCoords = fPercentExtra * m_pTexture->GetTextureFrameWidth() / m_pTexture->GetTextureWidth();
|
||||
|
||||
v[iVNum].tu = pTexCoordRect->left; v[iVNum++].tv = pTexCoordRect->bottom; // bottom left
|
||||
v[iVNum].tu = pTexCoordRect->left; v[iVNum++].tv = pTexCoordRect->top; // top left
|
||||
v[iVNum].tu = pTexCoordRect->right + fExtraTexCoords; v[iVNum++].tv = pTexCoordRect->bottom; // bottom right
|
||||
v[iVNum].tu = pTexCoordRect->right + fExtraTexCoords; v[iVNum++].tv = pTexCoordRect->top; // top right
|
||||
|
||||
|
||||
}
|
||||
|
||||
fY += fHeight;
|
||||
}
|
||||
|
||||
|
||||
|
||||
m_pVB->Unlock();
|
||||
|
||||
}
|
||||
@@ -39,11 +39,17 @@ public:
|
||||
|
||||
protected:
|
||||
bool LoadCharWidths( CString sWidthFilePath );
|
||||
// a vertex buffer for all to share
|
||||
|
||||
CString m_sFontFilePath;
|
||||
int m_iCharToFrameNo[NUM_CHARS];
|
||||
float m_fFrameNoToWidth[NUM_CHARS]; // in soure coordinate space
|
||||
|
||||
|
||||
LPDIRECT3DVERTEXBUFFER8 m_pVB; // our vertex buffer only needs to be rebuilt when the text changes
|
||||
int m_iNumVerticies;
|
||||
RebuildVertexBuffer(); // this should be called when the
|
||||
|
||||
CStringArray m_sTextLines;
|
||||
};
|
||||
|
||||
|
||||
@@ -30,9 +30,18 @@ public:
|
||||
SetFromDescription( "" );
|
||||
};
|
||||
|
||||
void SetFromSteps( Steps &steps )
|
||||
void SetFromSteps( Steps* pSteps )
|
||||
{
|
||||
SetFromDescription( steps.m_sDescription );
|
||||
if( pSteps != NULL )
|
||||
{
|
||||
SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
|
||||
SetFromDescription( pSteps->m_sDescription );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
SetFromDescription( "" );
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
@@ -29,9 +29,18 @@ public:
|
||||
SetNumFeet( 0, "" );
|
||||
};
|
||||
|
||||
void SetFromSteps( Steps &steps )
|
||||
void SetFromSteps( Steps* pSteps )
|
||||
{
|
||||
SetNumFeet( steps.m_iNumFeet, steps.m_sDescription );
|
||||
if( pSteps != NULL )
|
||||
{
|
||||
SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
|
||||
SetNumFeet( pSteps->m_iNumFeet, pSteps->m_sDescription );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
SetNumFeet( 0, "" );
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
+28
-7
@@ -9,13 +9,34 @@
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "Grade.h"
|
||||
#include "RageUtil.h"
|
||||
#include "ScreenDimensions.h"
|
||||
#include "ThemeManager.h"
|
||||
|
||||
|
||||
|
||||
CString GradeToString( Grade g )
|
||||
{
|
||||
switch( g )
|
||||
{
|
||||
case GRADE_AAA: return "AAA";
|
||||
case GRADE_AA: return "AA";
|
||||
case GRADE_A: return "A";
|
||||
case GRADE_B: return "B";
|
||||
case GRADE_C: return "C";
|
||||
case GRADE_D: return "D";
|
||||
case GRADE_E: return "E";
|
||||
case GRADE_NO_DATA: return "N";
|
||||
default: ASSERT(true); return "N";
|
||||
}
|
||||
};
|
||||
|
||||
Grade StringToGrade( CString s )
|
||||
{
|
||||
s.MakeUpper();
|
||||
if ( s == "AAA" ) return GRADE_AAA;
|
||||
else if( s == "AA" ) return GRADE_AA;
|
||||
else if( s == "A" ) return GRADE_A;
|
||||
else if( s == "B" ) return GRADE_B;
|
||||
else if( s == "C" ) return GRADE_C;
|
||||
else if( s == "D" ) return GRADE_D;
|
||||
else if( s == "E" ) return GRADE_E;
|
||||
else if( s == "N" ) return GRADE_NO_DATA;
|
||||
else ASSERT(true); return GRADE_NO_DATA; // invalid grade string
|
||||
};
|
||||
|
||||
+4
-40
@@ -13,49 +13,13 @@
|
||||
#define _Grade_H_
|
||||
|
||||
|
||||
#include "Sprite.h"
|
||||
#include "ThemeManager.h"
|
||||
|
||||
|
||||
struct Grade
|
||||
{
|
||||
Grade()
|
||||
{
|
||||
m_GradeType = GRADE_NO_DATA;
|
||||
};
|
||||
enum Grade { GRADE_NO_DATA=0, GRADE_E, GRADE_D, GRADE_C, GRADE_B, GRADE_A, GRADE_AA, GRADE_AAA };
|
||||
|
||||
CString GradeToString( Grade g );
|
||||
Grade StringToGrade( CString s );
|
||||
|
||||
|
||||
CString ToString()
|
||||
{
|
||||
switch( m_GradeType )
|
||||
{
|
||||
case GRADE_AAA: return "AAA";
|
||||
case GRADE_AA: return "AA";
|
||||
case GRADE_A: return "A";
|
||||
case GRADE_B: return "B";
|
||||
case GRADE_C: return "C";
|
||||
case GRADE_D: return "D";
|
||||
case GRADE_E: return "E";
|
||||
case GRADE_NO_DATA: return "N";
|
||||
default: ASSERT(true); return "N";
|
||||
}
|
||||
};
|
||||
void FromString( CString sGrade )
|
||||
{
|
||||
sGrade.MakeUpper();
|
||||
if ( sGrade == "AAA" ) m_GradeType = GRADE_AAA;
|
||||
else if( sGrade == "AA" ) m_GradeType = GRADE_AA;
|
||||
else if( sGrade == "A" ) m_GradeType = GRADE_A;
|
||||
else if( sGrade == "B" ) m_GradeType = GRADE_B;
|
||||
else if( sGrade == "C" ) m_GradeType = GRADE_C;
|
||||
else if( sGrade == "D" ) m_GradeType = GRADE_D;
|
||||
else if( sGrade == "E" ) m_GradeType = GRADE_E;
|
||||
else if( sGrade == "N" ) m_GradeType = GRADE_NO_DATA;
|
||||
else ASSERT(true); // invalid grade string
|
||||
};
|
||||
|
||||
enum GradeType { GRADE_NO_DATA=0, GRADE_E, GRADE_D, GRADE_C, GRADE_B, GRADE_A, GRADE_AA, GRADE_AAA };
|
||||
GradeType m_GradeType;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,22 +26,21 @@ public:
|
||||
{
|
||||
Load( THEME->GetPathTo(GRAPHIC_GRADES) );
|
||||
StopAnimating();
|
||||
Grade grade;
|
||||
grade.m_GradeType = Grade::GRADE_NO_DATA;
|
||||
SetGrade( grade );
|
||||
SetGrade( GRADE_NO_DATA );
|
||||
};
|
||||
|
||||
void SetGrade( Grade grade )
|
||||
void SetGrade( Grade g )
|
||||
{
|
||||
switch( grade.m_GradeType )
|
||||
switch( g )
|
||||
{
|
||||
case Grade::GRADE_NO_DATA: SetState(7); break;
|
||||
case Grade::GRADE_E: SetState(6); break;
|
||||
case Grade::GRADE_D: SetState(5); break;
|
||||
case Grade::GRADE_C: SetState(4); break;
|
||||
case Grade::GRADE_A: SetState(3); break;
|
||||
case Grade::GRADE_AA: SetState(2); break;
|
||||
case Grade::GRADE_AAA: SetState(1); break;
|
||||
case GRADE_AAA: SetState(0); break;
|
||||
case GRADE_AA: SetState(1); break;
|
||||
case GRADE_A: SetState(2); break;
|
||||
case GRADE_B: SetState(3); break;
|
||||
case GRADE_C: SetState(4); break;
|
||||
case GRADE_D: SetState(5); break;
|
||||
case GRADE_E: SetState(6); break;
|
||||
case GRADE_NO_DATA: SetState(7); break;
|
||||
default: ASSERT( true );
|
||||
}
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "ActorFrame.h"
|
||||
|
||||
|
||||
const int NUM_BLUR_GHOSTS = 4;
|
||||
const int NUM_BLUR_GHOSTS = 1;
|
||||
|
||||
class MotionBlurSprite : public Actor
|
||||
{
|
||||
|
||||
@@ -59,27 +59,17 @@ void WheelItem::LoadFromSong( Song &song )
|
||||
{
|
||||
m_WheelItemType = TYPE_MUSIC;
|
||||
|
||||
m_MusicStatusDisplay.SetXY( -140, 0 );
|
||||
m_MusicStatusDisplay.SetXY( -132, 0 );
|
||||
this->AddActor( &m_MusicStatusDisplay );
|
||||
|
||||
m_Banner.SetHorizAlign( align_left );
|
||||
m_Banner.SetXY( -30, 0 );
|
||||
m_Banner.SetXY( 15, 0 );
|
||||
this->AddActor( &m_Banner );
|
||||
|
||||
m_GradeP1.SetZoom( 0.4f );
|
||||
m_GradeP1.SetXY( 105, 0 );
|
||||
this->AddActor( &m_GradeP1 );
|
||||
|
||||
m_GradeP2.SetZoom( 0.4f );
|
||||
m_GradeP2.SetXY( 145, 0 );
|
||||
this->AddActor( &m_GradeP2 );
|
||||
|
||||
|
||||
m_pSong = &song;
|
||||
m_Banner.LoadFromSong( song );
|
||||
m_MusicStatusDisplay.SetNew( m_pSong->m_iNumTimesPlayed == 0 );
|
||||
//m_GradeP1.SetGrade( song.m_TopGrade[PLAYER_1] );
|
||||
//m_GradeP2.SetGrade( song.m_TopGrade[PLAYER_2] );
|
||||
m_MusicStatusDisplay.SetNew( m_pSong->GetNumTimesPlayed() == 0 );
|
||||
};
|
||||
|
||||
|
||||
@@ -440,7 +430,7 @@ void MusicWheel::Update( float fDeltaTime )
|
||||
{
|
||||
case STATE_SWITCHING_MUSIC:
|
||||
m_WheelState = STATE_IDLE; // now, wait for input
|
||||
WM->SendMessageToTopWindow( SM_PlayMusicSample, 0 );
|
||||
WM->SendMessageToTopWindow( SM_PlaySongSample, 0 );
|
||||
break;
|
||||
case STATE_FLYING_OFF_BEFORE_NEXT_SORT:
|
||||
{
|
||||
@@ -470,11 +460,11 @@ void MusicWheel::Update( float fDeltaTime )
|
||||
}
|
||||
break;
|
||||
case STATE_FLYING_ON_AFTER_NEXT_SORT:
|
||||
WM->SendMessageToTopWindow( SM_PlayMusicSample, 0 );
|
||||
WM->SendMessageToTopWindow( SM_PlaySongSample, 0 );
|
||||
m_WheelState = STATE_IDLE; // now, wait for input
|
||||
break;
|
||||
case STATE_TWEENING_ON_SCREEN:
|
||||
WM->SendMessageToTopWindow( SM_PlayMusicSample, 0 );
|
||||
WM->SendMessageToTopWindow( SM_PlaySongSample, 0 );
|
||||
m_WheelState = STATE_IDLE;
|
||||
m_fTimeLeftInState = 0;
|
||||
break;
|
||||
|
||||
@@ -30,8 +30,8 @@ const int NUM_WHEEL_ITEMS_TO_DRAW = 13;
|
||||
|
||||
const float FADE_TIME = 0.5f;
|
||||
|
||||
|
||||
const WindowMessage SM_PlayMusicSample = WindowMessage(SM_User+47); // this should be unique!
|
||||
const WindowMessage SM_SongChanged = WindowMessage(SM_User+47); // this should be unique!
|
||||
const WindowMessage SM_PlaySongSample = WindowMessage(SM_User+48);
|
||||
|
||||
|
||||
|
||||
@@ -69,8 +69,6 @@ public:
|
||||
Song* m_pSong;
|
||||
MusicStatusDisplay m_MusicStatusDisplay;
|
||||
TextBanner m_Banner;
|
||||
GradeDisplay m_GradeP1;
|
||||
GradeDisplay m_GradeP2;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -61,11 +61,8 @@ const float PILL_OFFSET_Y[LIEFMETER_NUM_PILLS] = {
|
||||
const float SCORE_Y = SCREEN_HEIGHT - 40;
|
||||
|
||||
|
||||
Player::Player( PlayerOptions po, PlayerNumber pn )
|
||||
Player::Player()
|
||||
{
|
||||
m_PlayerOptions = po;
|
||||
m_PlayerNumber = pn;
|
||||
|
||||
m_iCurCombo = 0;
|
||||
m_iMaxCombo = 0;
|
||||
m_fLifePercentage = 0.50f;
|
||||
@@ -232,6 +229,13 @@ Player::Player( PlayerOptions po, PlayerNumber pn )
|
||||
}
|
||||
|
||||
|
||||
void Player::SetPlayerOptions( PlayerOptions po, PlayerNumber pn )
|
||||
{
|
||||
m_PlayerOptions = po;
|
||||
m_PlayerNumber = pn;
|
||||
}
|
||||
|
||||
|
||||
void Player::SetX( float fX )
|
||||
{
|
||||
m_fArrowsCenterX = fX;
|
||||
|
||||
@@ -36,7 +36,8 @@ const int MAX_NUM_COLUMNS = 8;
|
||||
class Player : public ActorFrame
|
||||
{
|
||||
public:
|
||||
Player( PlayerOptions po, PlayerNumber pn );
|
||||
Player();
|
||||
void SetPlayerOptions( PlayerOptions po, PlayerNumber pn );
|
||||
|
||||
virtual void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference );
|
||||
virtual void RenderPrimitives();
|
||||
|
||||
@@ -68,11 +68,12 @@ void RageLogStart()
|
||||
{
|
||||
#if defined(DEBUG) | defined(_DEBUG)
|
||||
|
||||
// create a new log file, overwriting the old one
|
||||
DeleteFile( g_sLogFileName );
|
||||
DeleteFile( g_sErrorFileName );
|
||||
|
||||
// Open log file and leave it open. Let the OS close it when the app exits
|
||||
g_fileLog = fopen( g_sLogFileName, "w" );
|
||||
|
||||
// let the OS close the file when the app exits
|
||||
|
||||
SYSTEMTIME st;
|
||||
GetLocalTime( &st );
|
||||
|
||||
@@ -14,35 +14,21 @@
|
||||
#include "ThemeManager.h"
|
||||
|
||||
|
||||
const float TIME_BETWEEN_TICKS = 0.05f;
|
||||
|
||||
ScoreDisplayRolling::ScoreDisplayRolling()
|
||||
{
|
||||
RageLog( "ScoreDisplayRolling::ScoreDisplayRolling()" );
|
||||
|
||||
for( int i=0; i<MAX_SCORE_DIGITS; i++ )
|
||||
// init the text
|
||||
Load( THEME->GetPathTo(FONT_SCORE_NUMBERS) );
|
||||
TurnShadowOff();
|
||||
|
||||
// init the digits
|
||||
for( int i=0; i<NUM_SCORE_DIGITS; i++ )
|
||||
{
|
||||
m_textDigits[i].Load( THEME->GetPathTo(FONT_SCORE_NUMBERS) );
|
||||
m_textDigits[i].TurnShadowOff();
|
||||
|
||||
// get the width of the numbers
|
||||
m_textDigits[i].SetText( "0" );
|
||||
float fCharWidth = m_textDigits[i].GetWidestLineWidthInSourcePixels();
|
||||
|
||||
m_textDigits[i].SetText( " " );
|
||||
|
||||
float fCharOffsetsFromCenter = i - float(MAX_SCORE_DIGITS-1)/2;
|
||||
|
||||
m_textDigits[i].SetXY( fCharOffsetsFromCenter * fCharWidth, 0 );
|
||||
|
||||
iCurrentScoreDigits[i] = 0;
|
||||
iDestinationScoreDigits[i] = 0;
|
||||
|
||||
this->AddActor( &m_textDigits[i] );
|
||||
m_iCurrentScoreDigits[i] = 0;
|
||||
m_iDestinationScoreDigits[i] = 0;
|
||||
}
|
||||
|
||||
m_fTimeUntilNextTick = 0;
|
||||
|
||||
SetScore( 0 );
|
||||
}
|
||||
|
||||
@@ -50,12 +36,12 @@ ScoreDisplayRolling::ScoreDisplayRolling()
|
||||
void ScoreDisplayRolling::SetScore( float fNewScore )
|
||||
{
|
||||
// super inefficient (but isn't called very often)
|
||||
CString sFormatString = ssprintf( "%%%d.0f", MAX_SCORE_DIGITS );
|
||||
CString sFormatString = ssprintf( "%%%d.0f", NUM_SCORE_DIGITS );
|
||||
CString sScore = ssprintf( sFormatString, fNewScore );
|
||||
|
||||
for( int i=0; i<MAX_SCORE_DIGITS; i++ )
|
||||
for( int i=0; i<NUM_SCORE_DIGITS; i++ )
|
||||
{
|
||||
iDestinationScoreDigits[i] = atoi( sScore.Mid(i,1) );
|
||||
m_iDestinationScoreDigits[i] = atoi( sScore.Mid(i,1) );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,26 +49,36 @@ void ScoreDisplayRolling::SetScore( float fNewScore )
|
||||
|
||||
void ScoreDisplayRolling::Update( float fDeltaTime )
|
||||
{
|
||||
ActorFrame::Update( fDeltaTime );
|
||||
|
||||
m_fTimeUntilNextTick -= fDeltaTime;
|
||||
|
||||
while( m_fTimeUntilNextTick <= 0 )
|
||||
{
|
||||
m_fTimeUntilNextTick += TIME_BETWEEN_TICKS;
|
||||
|
||||
// do a tick
|
||||
for( int i=0; i<MAX_SCORE_DIGITS; i++ )
|
||||
{
|
||||
if( iCurrentScoreDigits[i] != iDestinationScoreDigits[i] )
|
||||
{
|
||||
iCurrentScoreDigits[i]++;
|
||||
if( iCurrentScoreDigits[i] > 9 )
|
||||
iCurrentScoreDigits[i] = 0;
|
||||
|
||||
m_textDigits[i].SetText( ssprintf("%d", iCurrentScoreDigits[i]) );
|
||||
}
|
||||
}
|
||||
}
|
||||
BitmapText::Update( fDeltaTime );
|
||||
}
|
||||
|
||||
void ScoreDisplayRolling::Draw()
|
||||
{
|
||||
// find the leftmost current digit that doesn't match the destination digit
|
||||
for( int i=0; i<NUM_SCORE_DIGITS; i++ )
|
||||
{
|
||||
if( m_iCurrentScoreDigits[i] != m_iDestinationScoreDigits[i] )
|
||||
break;
|
||||
}
|
||||
|
||||
// and increment that digit and everything after
|
||||
for( ; i<NUM_SCORE_DIGITS; i++ )
|
||||
{
|
||||
m_iCurrentScoreDigits[i]++;
|
||||
if( m_iCurrentScoreDigits[i] > 9 )
|
||||
m_iCurrentScoreDigits[i] = 0;
|
||||
}
|
||||
|
||||
int iCurScore = 0;
|
||||
int iMultiplier = 1;
|
||||
for( int d=NUM_SCORE_DIGITS-1; d>=0; d-- ) // foreach digit
|
||||
{
|
||||
iCurScore += m_iCurrentScoreDigits[d] * iMultiplier;
|
||||
iMultiplier *= 10;
|
||||
}
|
||||
|
||||
CString sFormat = ssprintf( "%%%d.0d", NUM_SCORE_DIGITS );
|
||||
SetText( ssprintf(sFormat, iCurScore) );
|
||||
|
||||
BitmapText::Draw();
|
||||
}
|
||||
@@ -19,23 +19,21 @@
|
||||
#include "BitmapText.h"
|
||||
|
||||
|
||||
const int MAX_SCORE_DIGITS = 9;
|
||||
const int NUM_SCORE_DIGITS = 9;
|
||||
|
||||
|
||||
class ScoreDisplayRolling : public ActorFrame
|
||||
class ScoreDisplayRolling : public BitmapText
|
||||
{
|
||||
public:
|
||||
ScoreDisplayRolling();
|
||||
void SetScore( float fNewScore );
|
||||
|
||||
virtual void Update( float fDeltaTime );
|
||||
virtual void Draw();
|
||||
|
||||
protected:
|
||||
BitmapText m_textDigits[MAX_SCORE_DIGITS];
|
||||
int iCurrentScoreDigits[MAX_SCORE_DIGITS];
|
||||
int iDestinationScoreDigits[MAX_SCORE_DIGITS];
|
||||
|
||||
float m_fTimeUntilNextTick;
|
||||
int m_iCurrentScoreDigits[NUM_SCORE_DIGITS];
|
||||
int m_iDestinationScoreDigits[NUM_SCORE_DIGITS];
|
||||
};
|
||||
|
||||
#endif
|
||||
+9
-17
@@ -72,14 +72,6 @@ Song::Song()
|
||||
{
|
||||
m_bChangedSinceSave = false;
|
||||
m_fOffsetInSeconds = 0;
|
||||
|
||||
m_iNumTimesPlayed = 0;
|
||||
for( int i=0; i<6; i++ )
|
||||
{
|
||||
m_iMaxCombo[i] = 0;
|
||||
m_iTopScore[i] = 0;
|
||||
m_TopGrade[i].FromString( "N" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -641,7 +633,7 @@ void Song::TidyUpData()
|
||||
}
|
||||
|
||||
|
||||
void Song::GetStepsThatMatchGameMode( GameMode gm, CArray<Steps*, Steps*&>& arrayAddTo )
|
||||
void Song::GetStepsThatMatchGameMode( GameMode gm, CArray<Steps*, Steps*>& arrayAddTo )
|
||||
{
|
||||
for( int i=0; i<arraySteps.GetSize(); i++ ) // for each of the Song's Steps
|
||||
{
|
||||
@@ -659,25 +651,25 @@ void Song::GetStepsThatMatchGameMode( GameMode gm, CArray<Steps*, Steps*&>& arra
|
||||
void Song::GetNumFeet( GameMode gm, int& iDiffEasyOut, int& iDiffMediumOut, int& iDiffHardOut )
|
||||
{
|
||||
iDiffEasyOut = iDiffMediumOut = iDiffHardOut = -1; // -1 means not found
|
||||
CArray<Steps*, Steps*&> arrayMatchingSteps;
|
||||
CArray<Steps*, Steps*> arrayMatchingSteps;
|
||||
GetStepsThatMatchGameMode( gm, arrayMatchingSteps );
|
||||
|
||||
for( int i=0; i<arrayMatchingSteps.GetSize(); i++ )
|
||||
{
|
||||
int iNumFeet = arrayMatchingSteps[i]->m_iNumFeet;
|
||||
|
||||
switch( arrayMatchingSteps[i]->m_difficulty )
|
||||
switch( arrayMatchingSteps[i]->m_DifficultyClass )
|
||||
{
|
||||
case Steps::easy:
|
||||
case Steps::CLASS_EASY:
|
||||
iDiffEasyOut = iNumFeet;
|
||||
break;
|
||||
case Steps::medium:
|
||||
case Steps::CLASS_MEDIUM:
|
||||
iDiffMediumOut = iNumFeet;
|
||||
break;
|
||||
case Steps::hard:
|
||||
case Steps::CLASS_HARD:
|
||||
iDiffHardOut = iNumFeet;
|
||||
break;
|
||||
case Steps::other:
|
||||
case Steps::CLASS_OTHER:
|
||||
// should do something intelligent to fill in the missing spots...
|
||||
if( iDiffEasyOut < 0 && iNumFeet <= 4 )
|
||||
iDiffEasyOut = iNumFeet;
|
||||
@@ -790,8 +782,8 @@ int CompareSongPointersByMostPlayed(const void *arg1, const void *arg2)
|
||||
Song* pSong1 = *(Song**)arg1;
|
||||
Song* pSong2 = *(Song**)arg2;
|
||||
|
||||
int iNumTimesPlayed1 = pSong1->m_iNumTimesPlayed;
|
||||
int iNumTimesPlayed2 = pSong2->m_iNumTimesPlayed;
|
||||
int iNumTimesPlayed1 = pSong1->GetNumTimesPlayed();
|
||||
int iNumTimesPlayed2 = pSong2->GetNumTimesPlayed();
|
||||
|
||||
CString sFilePath1 = pSong1->GetSongFilePath(); // this is unique among songs
|
||||
CString sFilePath2 = pSong2->GetSongFilePath();
|
||||
|
||||
@@ -306,10 +306,6 @@ void Sprite::RenderPrimitives()
|
||||
LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice();
|
||||
pd3dDevice->SetTexture( 0, m_pTexture->GetD3DTexture() );
|
||||
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR );
|
||||
//pd3dDevice->SetRenderState( D3DRS_SRCBLEND, bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA );
|
||||
//pd3dDevice->SetRenderState( D3DRS_DESTBLEND, bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA );
|
||||
pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA );
|
||||
pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA );
|
||||
|
||||
|
||||
@@ -527,7 +527,6 @@ void Render()
|
||||
LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice();
|
||||
|
||||
// calculate view and projection transforms
|
||||
|
||||
D3DXMATRIX matProj;
|
||||
D3DXMatrixOrthoOffCenterLH( &matProj, 0, 640, 480, 0, -100, 100 );
|
||||
pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
|
||||
@@ -536,10 +535,7 @@ void Render()
|
||||
D3DXMatrixIdentity( &matView );
|
||||
pd3dDevice->SetTransform( D3DTS_VIEW, &matView );
|
||||
|
||||
D3DXMATRIX matWorld;
|
||||
D3DXMatrixIdentity( &matWorld );
|
||||
SCREEN->ResetMatrixStack( matWorld );
|
||||
|
||||
SCREEN->ResetMatrixStack();
|
||||
|
||||
// draw the game
|
||||
WM->Draw();
|
||||
|
||||
@@ -64,7 +64,7 @@ LINK32=link.exe
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 1
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "../Debug"
|
||||
# PROP Output_Dir "../"
|
||||
# PROP Intermediate_Dir "../Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
@@ -288,6 +288,10 @@ SOURCE=.\WindowMenuSelectStyle.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WindowMessage.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WindowOptions.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -604,6 +608,14 @@ SOURCE=.\FocusingSprite.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FootMeter.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FootMeter.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\GhostArrow.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -684,14 +696,6 @@ SOURCE=.\Rectangle.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScoreDisplayFlipping.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScoreDisplayFlipping.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScoreDisplayRolling.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "Rectangle.h"
|
||||
|
||||
|
||||
const float TEXT_BANNER_WIDTH = 192; // from the source art of DDR
|
||||
const float TEXT_BANNER_WIDTH = 250;
|
||||
const float TEXT_BANNER_HEIGHT = 40;
|
||||
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ CString ThemeManager::GetPathTo( ThemeElement te, CString sThemeName )
|
||||
case GRAPHIC_SECTION_BACKGROUND: sAssetPath = "Graphics\\section background"; break;
|
||||
case GRAPHIC_MUSIC_SORT_ICONS: sAssetPath = "Graphics\\music sort icons 1x5"; break;
|
||||
case GRAPHIC_MUSIC_STATUS_ICONS: sAssetPath = "Graphics\\music status icons 1x4"; break;
|
||||
case GRAPHIC_DANGER: sAssetPath = "Graphics\\danger"; break;
|
||||
case GRAPHIC_DANGER_TEXT: sAssetPath = "Graphics\\danger text"; break;
|
||||
case GRAPHIC_DANGER_BACKGROUND: sAssetPath = "Graphics\\danger background"; break;
|
||||
|
||||
case SOUND_FAILED: sAssetPath = "Sounds\\failed"; break;
|
||||
|
||||
@@ -61,7 +61,7 @@ enum ThemeElement {
|
||||
GRAPHIC_SECTION_BACKGROUND,
|
||||
GRAPHIC_MUSIC_SORT_ICONS,
|
||||
GRAPHIC_MUSIC_STATUS_ICONS,
|
||||
GRAPHIC_DANGER,
|
||||
GRAPHIC_DANGER_TEXT,
|
||||
GRAPHIC_DANGER_BACKGROUND,
|
||||
|
||||
SOUND_FAILED,
|
||||
|
||||
+10
-13
@@ -18,9 +18,6 @@ class Steps; // why is this needed?
|
||||
#include "GameInfo.h" // for definition of GameMode
|
||||
enum GameMode; // why is this needed?
|
||||
|
||||
#include "Grade.h"
|
||||
|
||||
|
||||
|
||||
|
||||
struct BPMSegment
|
||||
@@ -83,18 +80,18 @@ public:
|
||||
}
|
||||
};
|
||||
void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut );
|
||||
void GetStepsThatMatchGameMode( GameMode gm, CArray<Steps*, Steps*&>& arrayAddTo );
|
||||
void GetStepsThatMatchGameMode( GameMode gm, CArray<Steps*, Steps*>& arrayAddTo );
|
||||
void GetNumFeet( GameMode gm, int& iDiffEasy, int& iDiffMedium, int& iDiffHard );
|
||||
|
||||
|
||||
public:
|
||||
int m_iNumTimesPlayed;
|
||||
|
||||
// statistics for single-basic, single-another... double-basic... double-maniac:
|
||||
Grade m_TopGrade[6];
|
||||
int m_iTopScore[6];
|
||||
int m_iMaxCombo[6];
|
||||
|
||||
int GetNumTimesPlayed()
|
||||
{
|
||||
int iTotalNumTimesPlayed = 0;
|
||||
for( int i=0; i<arraySteps.GetSize(); i++ )
|
||||
{
|
||||
iTotalNumTimesPlayed += arraySteps[i].m_iNumTimesPlayed;
|
||||
}
|
||||
return iTotalNumTimesPlayed;
|
||||
}
|
||||
|
||||
private:
|
||||
CString m_sSongFilePath;
|
||||
|
||||
Reference in New Issue
Block a user