kljhfdkjhfjkhdfkjf
This commit is contained in:
@@ -214,11 +214,11 @@ void Actor::SetTweenX( float x ) { m_end_pos.x = x; }
|
||||
void Actor::SetTweenY( float y ) { m_end_pos.y = y; }
|
||||
void Actor::SetTweenXY( float x, float y ) { SetTweenX(x); SetTweenY(y); }
|
||||
void Actor::SetTweenZoom( float zoom ) { m_end_scale.x = zoom; m_end_scale.y = zoom; }
|
||||
void Actor::SetTweenZoomX( float zoom ) { m_end_scale.x = zoom; }
|
||||
void Actor::SetTweenZoomY( float zoom ) { m_end_scale.y = zoom; }
|
||||
void Actor::SetTweenRotationX( float r ) { m_end_rotation.x = r; }
|
||||
void Actor::SetTweenRotationY( float r ) { m_end_rotation.y = r; }
|
||||
void Actor::SetTweenRotationZ( float r ) { m_end_rotation.z = r; }
|
||||
void Actor::SetTweenDiffuseColor( D3DXCOLOR c ) { for(int i=0; i<4; i++) m_end_colorDiffuse[i] = c; }
|
||||
void Actor::SetTweenAddColor( D3DXCOLOR c ) { m_end_colorAdd = c; }
|
||||
|
||||
|
||||
void Actor::ScaleTo( LPRECT pRect, StretchType st )
|
||||
|
||||
+22
-5
@@ -40,9 +40,9 @@ public:
|
||||
|
||||
virtual float GetX() { return m_pos.x; };
|
||||
virtual float GetY() { return m_pos.y; };
|
||||
virtual void SetX( float x ) { m_pos.x = x; m_TweenType = no_tween; };
|
||||
virtual void SetY( float y ) { m_pos.y = y; m_TweenType = no_tween; };
|
||||
virtual void SetXY( float x, float y ) { m_pos.x = x; m_pos.y = y; m_TweenType = no_tween; };
|
||||
virtual void SetX( float x ) { m_pos.x = x; };
|
||||
virtual void SetY( float y ) { m_pos.y = y; };
|
||||
virtual void SetXY( float x, float y ) { m_pos.x = x; m_pos.y = y; };
|
||||
|
||||
// height and width vary depending on zoom
|
||||
virtual float GetZoomedWidth() { return m_size.x * m_scale.x; }
|
||||
@@ -51,7 +51,11 @@ public:
|
||||
virtual void SetHeight( float height ){ m_size.y = height; }
|
||||
|
||||
virtual float GetZoom() { return m_scale.x; }
|
||||
virtual float GetZoomX() { return m_scale.x; }
|
||||
virtual float GetZoomY() { return m_scale.y; }
|
||||
virtual void SetZoom( float zoom ) { m_scale.x = zoom; m_scale.y = zoom; }
|
||||
virtual void SetZoomX( float zoom ){ m_scale.x = zoom; }
|
||||
virtual void SetZoomY( float zoom ){ m_scale.y = zoom; }
|
||||
|
||||
virtual float GetRotation() { return m_rotation.z; }
|
||||
virtual void SetRotation( float rot ) { m_rotation.z = rot; }
|
||||
@@ -61,6 +65,7 @@ public:
|
||||
virtual void SetRotationY( float rot ) { m_rotation.y = rot; }
|
||||
|
||||
virtual void SetDiffuseColor( D3DXCOLOR colorDiffuse ) { for(int i=0; i<4; i++) m_colorDiffuse[i] = colorDiffuse; };
|
||||
virtual void SetDiffuseColors( int i, D3DXCOLOR colorDiffuse ) { m_colorDiffuse[i] = colorDiffuse; };
|
||||
virtual void SetDiffuseColorUpperLeft( D3DXCOLOR colorDiffuse ) { m_colorDiffuse[0] = colorDiffuse; };
|
||||
virtual void SetDiffuseColorUpperRight( D3DXCOLOR colorDiffuse ) { m_colorDiffuse[1] = colorDiffuse; };
|
||||
virtual void SetDiffuseColorLowerLeft( D3DXCOLOR colorDiffuse ) { m_colorDiffuse[2] = colorDiffuse; };
|
||||
@@ -70,6 +75,7 @@ public:
|
||||
virtual void SetDiffuseColorBottomEdge( D3DXCOLOR colorDiffuse ) { m_colorDiffuse[2] = m_colorDiffuse[3] = colorDiffuse; };
|
||||
virtual void SetDiffuseColorLeftEdge( D3DXCOLOR colorDiffuse ) { m_colorDiffuse[0] = m_colorDiffuse[2] = colorDiffuse; };
|
||||
virtual D3DXCOLOR GetDiffuseColor() { return m_colorDiffuse[0]; };
|
||||
virtual D3DXCOLOR GetDiffuseColors( int i ) { return m_colorDiffuse[i]; };
|
||||
virtual void SetAddColor( D3DXCOLOR colorAdd ) { m_colorAdd = colorAdd; };
|
||||
virtual D3DXCOLOR GetAddColor() { return m_colorAdd; };
|
||||
|
||||
@@ -81,15 +87,26 @@ public:
|
||||
TweenType tt = tween_linear );
|
||||
|
||||
virtual void BeginTweening( float time, TweenType tt = tween_linear );
|
||||
virtual void StopTweening( float time, TweenType tt = tween_linear ) { m_TweenType = no_tween; };
|
||||
virtual void SetTweenX( float x );
|
||||
virtual void SetTweenY( float y );
|
||||
virtual void SetTweenXY( float x, float y );
|
||||
virtual void SetTweenZoom( float zoom );
|
||||
virtual void SetTweenZoomX( float zoom );
|
||||
virtual void SetTweenZoomY( float zoom );
|
||||
virtual void SetTweenRotationX( float r );
|
||||
virtual void SetTweenRotationY( float r );
|
||||
virtual void SetTweenRotationZ( float r );
|
||||
virtual void SetTweenDiffuseColor( D3DXCOLOR c );
|
||||
virtual void SetTweenAddColor( D3DXCOLOR c );
|
||||
virtual void SetTweenDiffuseColor( D3DXCOLOR colorDiffuse ) { for(int i=0; i<4; i++) m_end_colorDiffuse[i] = colorDiffuse; };
|
||||
virtual void SetTweenDiffuseColorUpperLeft( D3DXCOLOR colorDiffuse ) { m_end_colorDiffuse[0] = colorDiffuse; };
|
||||
virtual void SetTweenDiffuseColorUpperRight( D3DXCOLOR colorDiffuse ) { m_end_colorDiffuse[1] = colorDiffuse; };
|
||||
virtual void SetTweenDiffuseColorLowerLeft( D3DXCOLOR colorDiffuse ) { m_end_colorDiffuse[2] = colorDiffuse; };
|
||||
virtual void SetTweenDiffuseColorLowerRight( D3DXCOLOR colorDiffuse ) { m_end_colorDiffuse[3] = colorDiffuse; };
|
||||
virtual void SetTweenDiffuseColorTopEdge( D3DXCOLOR colorDiffuse ) { m_end_colorDiffuse[0] = m_end_colorDiffuse[1] = colorDiffuse; };
|
||||
virtual void SetTweenDiffuseColorRightEdge( D3DXCOLOR colorDiffuse ) { m_end_colorDiffuse[1] = m_end_colorDiffuse[3] = colorDiffuse; };
|
||||
virtual void SetTweenDiffuseColorBottomEdge( D3DXCOLOR colorDiffuse ) { m_end_colorDiffuse[2] = m_end_colorDiffuse[3] = colorDiffuse; };
|
||||
virtual void SetTweenDiffuseColorLeftEdge( D3DXCOLOR colorDiffuse ) { m_end_colorDiffuse[0] = m_end_colorDiffuse[2] = colorDiffuse; };
|
||||
virtual void SetTweenAddColor( D3DXCOLOR c ) { m_end_colorAdd = c; }
|
||||
|
||||
|
||||
// NOTE: GetEdge functions don't consider rotation
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
bool Banner::LoadFromSong( Song &song )
|
||||
{
|
||||
Sprite::LoadFromTexture( song.GetBannerPath() );
|
||||
//Sprite::TurnShadowOff();
|
||||
|
||||
float fSourceWidth = (float)m_pTexture->GetSourceWidth();
|
||||
float fSourceHeight = (float)m_pTexture->GetSourceHeight();
|
||||
|
||||
@@ -22,6 +22,8 @@ BitmapText::BitmapText()
|
||||
|
||||
for( int i=0; i<NUM_CHARS; i++ )
|
||||
m_fCharWidthsInSourcePixels[i] = 16;
|
||||
|
||||
// m_bHasShadow = false;
|
||||
}
|
||||
|
||||
bool BitmapText::LoadFromFontName( CString sFontName )
|
||||
@@ -55,7 +57,7 @@ bool BitmapText::LoadCharWidths( CString sWidthFilePath )
|
||||
|
||||
// get a rectangle for the text, considering a possible text scaling.
|
||||
// useful to know if some text is visible or not
|
||||
float BitmapText::GetTextWidthInSourcePixels()
|
||||
float BitmapText::GetWidthInSourcePixels()
|
||||
{
|
||||
float fTextWidth = 0;
|
||||
|
||||
@@ -70,10 +72,55 @@ float BitmapText::GetTextWidthInSourcePixels()
|
||||
// draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale
|
||||
void BitmapText::Draw()
|
||||
{
|
||||
float fCenterX = GetX();
|
||||
float fTextWidthInSourcePixels = GetTextWidthInSourcePixels();
|
||||
// some basic properties of the text
|
||||
float fTextWidthInSourcePixels = GetWidthInSourcePixels();
|
||||
float fTextWidth = fTextWidthInSourcePixels* GetZoom();
|
||||
float fFrameWidth = GetZoomedWidth();
|
||||
|
||||
|
||||
/*
|
||||
if( m_bHasShadow )
|
||||
{
|
||||
// do a pass for the shadow
|
||||
|
||||
float fOriginalX = GetX();
|
||||
float fOriginalY = GetY();
|
||||
D3DXCOLOR colorOriginalDiffuse[4];
|
||||
for( int i=0; i<4; i++ )
|
||||
colorOriginalDiffuse[i] = GetDiffuseColors(i);
|
||||
D3DXCOLOR colorOriginalAdd = GetAddColor();
|
||||
|
||||
float fX = fOriginalX - (fTextWidth/2) + 10;
|
||||
float fY = fOriginalY + 10;
|
||||
|
||||
SetY( fY );
|
||||
SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); // transparent
|
||||
SetAddColor( D3DXCOLOR(0,0,0,0.5f) ); // semi-transparent black
|
||||
|
||||
|
||||
for( i=0; i<m_sText.GetLength(); i++ ) {
|
||||
char c = m_sText[i];
|
||||
float fCharWidthZoomed = m_fCharWidthsInSourcePixels[c] * GetZoom();
|
||||
SetState( c );
|
||||
fX += fCharWidthZoomed/2;
|
||||
SetX( fX );
|
||||
Sprite::Draw();
|
||||
fX += fCharWidthZoomed/2;
|
||||
}
|
||||
|
||||
// set properties back to original
|
||||
SetX( fOriginalX );
|
||||
SetY( fOriginalY );
|
||||
for( i=0; i<4; i++ )
|
||||
SetDiffuseColors( i, colorOriginalDiffuse[i] );
|
||||
SetAddColor( colorOriginalAdd );
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// draw the text
|
||||
|
||||
float fCenterX = GetX();
|
||||
float fX = fCenterX - (fTextWidth/2);
|
||||
|
||||
|
||||
@@ -82,7 +129,7 @@ void BitmapText::Draw()
|
||||
float fCharWidthZoomed = m_fCharWidthsInSourcePixels[c] * GetZoom();
|
||||
SetState( c );
|
||||
fX += fCharWidthZoomed/2;
|
||||
SetX( roundf(fX) ); // set X acording to offset and round to help blurring
|
||||
SetX( fX );
|
||||
Sprite::Draw();
|
||||
fX += fCharWidthZoomed/2;
|
||||
}
|
||||
|
||||
@@ -39,9 +39,10 @@ public:
|
||||
|
||||
void Draw();
|
||||
|
||||
float GetWidthInSourcePixels(); // in logical, pre-scaled units
|
||||
|
||||
protected:
|
||||
bool LoadCharWidths( CString sWidthFilePath );
|
||||
float GetTextWidthInSourcePixels(); // in logical, pre-scaled units
|
||||
|
||||
CString m_sFontName;
|
||||
float m_fCharWidthsInSourcePixels[NUM_CHARS]; // in soure coordinate space
|
||||
@@ -49,6 +50,7 @@ protected:
|
||||
CString m_sText; // the string that the font is displaying
|
||||
// D3DXCOLOR m_colorTop;
|
||||
// D3DXCOLOR m_colorBottom;
|
||||
// bool m_bHasShadow;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+271
-21
@@ -40,33 +40,38 @@ const int NUM_FRAMES_IN_COLOR_ARROW_SPRITE = 12;
|
||||
|
||||
|
||||
const float JUDGEMENT_DISPLAY_TIME = 0.6f;
|
||||
const CString JUDGEMENT_SPRITE = "Sprites\\Judgement.sprite";
|
||||
const CString JUDGEMENT_TEXTURE = "Textures\\judgement 1x6.png";
|
||||
const float JUDGEMENT_Y = CENTER_Y;
|
||||
|
||||
const CString HOLD_JUDGEMENT_TEXTURE = "Textures\\Hold Arrow Judgement 1x3.png";
|
||||
const float HOLD_JUDGEMENT_Y = GRAY_ARROW_Y + 50;
|
||||
|
||||
|
||||
const CString SEQUENCE_NUMBERS = "SpriteSequences\\Bold Numbers.seq";
|
||||
|
||||
const float COMBO_TWEEN_TIME = 0.5f;
|
||||
const CString COMBO_SPRITE = "Sprites\\Combo.sprite";
|
||||
const CString COMBO_TEXTURE = "Textures\\Combo.png";
|
||||
const float COMBO_Y = (CENTER_Y+60);
|
||||
|
||||
|
||||
const int LIEFMETER_NUM_PILLS = 17;
|
||||
const CString LIFEMETER_FRAME_SPRITE= "Sprites\\Life Meter Frame.sprite";
|
||||
const CString LIFEMETER_PILLS_SPRITE= "Sprites\\Life Meter Pills.sprite";
|
||||
const CString LIFEMETER_FRAME_TEXTURE= "Textures\\Life Meter Frame.png";
|
||||
const CString LIFEMETER_PILLS_TEXTURE= "Textures\\Life Meter Pills 17x1.png";
|
||||
const float LIFEMETER_Y = 30;
|
||||
const float LIFEMETER_PILLS_Y = LIFEMETER_Y+2;
|
||||
const float LIFEMETER_PILLS_Y = LIFEMETER_Y;
|
||||
const float PILL_OFFSET_Y[LIEFMETER_NUM_PILLS] = {
|
||||
0.3f, 0.7f, 1.0f, 0.7f, 0.3f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f // kind of a sin wave
|
||||
};
|
||||
|
||||
const CString FONT_SCORE = "Fonts\\Font - Arial Bold numbers 30px.font";
|
||||
const CString SCORE_FRAME_TEXTURE = "Textures\\Score Frame 1x1.png";
|
||||
const CString SCORE_FRAME_TEXTURE = "Textures\\Score Frame.png";
|
||||
const float SCORE_Y = SCREEN_HEIGHT - 40;
|
||||
|
||||
|
||||
Player::Player()
|
||||
Player::Player( PlayerOptions po )
|
||||
{
|
||||
m_PlayerOptions = po;
|
||||
|
||||
m_iCurCombo = 0;
|
||||
m_iMaxCombo = 0;
|
||||
m_fLifePercentage = 0.50f;
|
||||
@@ -171,21 +176,33 @@ Player::Player()
|
||||
for( int c=0; c < MAX_NUM_COLUMNS; c++ ) {
|
||||
m_GrayArrow[c].SetRotation( m_ColumnToRotation[c] );
|
||||
m_GhostArrow[c].SetRotation( m_ColumnToRotation[c] );
|
||||
m_HoldGhostArrow[c].SetRotation( m_ColumnToRotation[c] );
|
||||
m_ColorArrow[c].SetRotation( m_ColumnToRotation[c] );
|
||||
}
|
||||
|
||||
// judgement
|
||||
m_fJudgementDisplayCountdown = 0;
|
||||
m_sprJudgement.LoadFromSpriteFile( JUDGEMENT_SPRITE );
|
||||
m_sprJudgement.LoadFromTexture( JUDGEMENT_TEXTURE );
|
||||
m_sprJudgement.StopAnimating();
|
||||
|
||||
for( c=0; c<MAX_NUM_COLUMNS; c++ )
|
||||
{
|
||||
m_fHoldJudgementDisplayCountdown[c] = 0;
|
||||
m_sprHoldJudgement[c].LoadFromTexture( HOLD_JUDGEMENT_TEXTURE );
|
||||
m_sprHoldJudgement[c].StopAnimating();
|
||||
}
|
||||
|
||||
|
||||
// combo
|
||||
m_bComboVisible = FALSE;
|
||||
m_sprCombo.LoadFromSpriteFile( COMBO_SPRITE );
|
||||
m_sprCombo.LoadFromTexture( COMBO_TEXTURE );
|
||||
m_ComboNumber.LoadFromSequenceFile( SEQUENCE_NUMBERS );
|
||||
|
||||
// life meter
|
||||
m_sprLifeMeterFrame.LoadFromSpriteFile( LIFEMETER_FRAME_SPRITE );
|
||||
m_sprLifeMeterPills.LoadFromSpriteFile( LIFEMETER_PILLS_SPRITE );
|
||||
m_sprLifeMeterFrame.LoadFromTexture( LIFEMETER_FRAME_TEXTURE );
|
||||
m_sprLifeMeterPills.LoadFromTexture( LIFEMETER_PILLS_TEXTURE );
|
||||
m_sprLifeMeterFrame.StopAnimating();
|
||||
m_sprLifeMeterPills.StopAnimating();
|
||||
|
||||
// score
|
||||
m_sprScoreFrame.LoadFromTexture( SCORE_FRAME_TEXTURE );
|
||||
@@ -217,7 +234,7 @@ void Player::SetSteps( const Steps& newSteps, bool bLoadOnlyLeftSide, bool bLoad
|
||||
// copy the steps
|
||||
for( int i=0; i<MAX_STEP_ELEMENTS; i++ )
|
||||
{
|
||||
m_OriginalStep[i] = newSteps.m_steps[i];
|
||||
m_OriginalStep[i] = newSteps.m_Steps[i];
|
||||
|
||||
if( bLoadOnlyLeftSide ) {
|
||||
// mask off the pad2 steps
|
||||
@@ -237,6 +254,15 @@ void Player::SetSteps( const Steps& newSteps, bool bLoadOnlyLeftSide, bool bLoad
|
||||
m_iColorArrowFrameOffset[i] = (int)( i/(FLOAT)ELEMENTS_PER_BEAT*NUM_FRAMES_IN_COLOR_ARROW_SPRITE );
|
||||
}
|
||||
|
||||
// copy the HoldSteps
|
||||
m_HoldSteps.Copy( newSteps.m_HoldSteps );
|
||||
|
||||
// init HoldStepScores
|
||||
m_HoldStepScores.RemoveAll();
|
||||
for( i=0; i<m_HoldSteps.GetSize(); i++ )
|
||||
{
|
||||
m_HoldStepScores.Add( HOLD_SCORE_NONE );
|
||||
}
|
||||
}
|
||||
|
||||
void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference )
|
||||
@@ -245,7 +271,8 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
|
||||
|
||||
m_fSongBeat = fSongBeat; // save song beat
|
||||
|
||||
int iNumMisses = UpdateStepsMissedOlderThan( fSongBeat-fMaxBeatDifference );
|
||||
// check for misses
|
||||
int iNumMisses = UpdateStepsMissedOlderThan( m_fSongBeat-fMaxBeatDifference );
|
||||
if( iNumMisses > 0 )
|
||||
{
|
||||
SetJudgement( miss );
|
||||
@@ -256,6 +283,49 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
|
||||
}
|
||||
|
||||
|
||||
// check for HoldStep misses
|
||||
for( int i=0; i<m_HoldSteps.GetSize(); i++ )
|
||||
{
|
||||
HoldStep &hs = m_HoldSteps[i];
|
||||
float fStartBeat = StepIndexToBeat( hs.m_iStartIndex );
|
||||
float fEndBeat = StepIndexToBeat( hs.m_iEndIndex );
|
||||
|
||||
if( fStartBeat+fMaxBeatDifference < m_fSongBeat && m_fSongBeat < fEndBeat-fMaxBeatDifference && // if the song beat is in the range of this hold
|
||||
m_HoldStepScores[i] == HOLD_SCORE_NONE ||
|
||||
m_HoldStepScores[i] == HOLD_STEPPED_ON ) // this hold doesn't already have a score
|
||||
{
|
||||
PlayerInput PlayerI = { PLAYER_1, hs.m_Step };
|
||||
if( GAMEINFO->IsButtonDown( PlayerI ) ) // they're holding the button down
|
||||
{
|
||||
int iCol = m_StepToColumnNumber[ hs.m_Step ];
|
||||
m_HoldGhostArrow[iCol].Step();
|
||||
}
|
||||
else // they're not holding the button down
|
||||
{
|
||||
m_HoldStepScores[i] = HOLD_SCORE_NG;
|
||||
int iCol = m_StepToColumnNumber[ hs.m_Step ];
|
||||
SetHoldJudgement( iCol, HOLD_SCORE_NG );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check for HoldStep completes
|
||||
for( i=0; i<m_HoldSteps.GetSize(); i++ )
|
||||
{
|
||||
HoldStep &hs = m_HoldSteps[i];
|
||||
float fEndBeat = StepIndexToBeat( hs.m_iEndIndex );
|
||||
|
||||
if( fEndBeat < m_fSongBeat && // if this hold step is in the past
|
||||
m_HoldStepScores[i] == HOLD_STEPPED_ON ) // and it doesn't yet have a score
|
||||
{
|
||||
m_HoldStepScores[i] = HOLD_SCORE_OK;
|
||||
int iCol = m_StepToColumnNumber[ hs.m_Step ];
|
||||
SetHoldJudgement( iCol, HOLD_SCORE_OK );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
UpdateGrayArrows( fDeltaTime );
|
||||
UpdateColorArrows( fDeltaTime );
|
||||
UpdateGhostArrows( fDeltaTime );
|
||||
@@ -286,6 +356,23 @@ void Player::HandlePlayerStep( float fSongBeat, Step player_step, float fMaxBeat
|
||||
GrayArrowStep( iColumnNum, perfect );
|
||||
|
||||
CheckForCompleteStep( fSongBeat, player_step, fMaxBeatDiff );
|
||||
|
||||
// check if we stepped on the beginning of a HoldStep
|
||||
int iCurrentIndex = BeatToStepIndex( fSongBeat );
|
||||
for( int i=0; i<m_HoldSteps.GetSize(); i++ ) // for each HoldStep
|
||||
{
|
||||
if( m_HoldStepScores[i] == HOLD_SCORE_NONE && // this has not already been stepped on
|
||||
player_step == m_HoldSteps[i].m_Step ) // player steps in the same note as the hold
|
||||
{
|
||||
HoldStep &hs = m_HoldSteps[i];
|
||||
int iIndexDifference = abs( hs.m_iStartIndex - iCurrentIndex );
|
||||
int iMaxIndexDiff = BeatToStepIndex( fMaxBeatDiff );
|
||||
|
||||
if( iIndexDifference <= iMaxIndexDiff )
|
||||
m_HoldStepScores[i] = HOLD_STEPPED_ON;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -450,6 +537,7 @@ void Player::UpdateGhostArrows( float fDeltaTime )
|
||||
{
|
||||
for( int i=0; i < m_iNumColumns; i++ ) {
|
||||
m_GhostArrow[i].Update( fDeltaTime );
|
||||
m_HoldGhostArrow[i].Update( fDeltaTime );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,19 +556,30 @@ void Player::DrawGhostArrows()
|
||||
{
|
||||
m_GhostArrow[i].SetBeat( m_fSongBeat );
|
||||
m_GhostArrow[i].Draw();
|
||||
m_HoldGhostArrow[i].SetBeat( m_fSongBeat );
|
||||
m_HoldGhostArrow[i].Draw();
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SetGrayArrowsX( int iNewX )
|
||||
{
|
||||
for( int i=0; i<m_iNumColumns; i++ )
|
||||
m_GrayArrow[i].SetXY( GetArrowColumnX(i), GRAY_ARROW_Y );
|
||||
{
|
||||
float fY = GetGrayArrowYPos();
|
||||
if( m_PlayerOptions.m_bReverseScroll ) fY = SCREEN_HEIGHT - fY;
|
||||
m_GrayArrow[i].SetXY( GetArrowColumnX(i), fY );
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SetGhostArrowsX( int iNewX )
|
||||
{
|
||||
for( int i=0; i<m_iNumColumns; i++ )
|
||||
m_GhostArrow[i].SetXY( GetArrowColumnX(i), GRAY_ARROW_Y );
|
||||
{
|
||||
float fY = GetGrayArrowYPos();
|
||||
if( m_PlayerOptions.m_bReverseScroll ) fY = SCREEN_HEIGHT - fY;
|
||||
m_GhostArrow[i].SetXY( GetArrowColumnX(i), fY );
|
||||
m_HoldGhostArrow[i].SetXY( GetArrowColumnX(i), fY );
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SetColorArrowsX( int iNewX )
|
||||
@@ -519,7 +618,11 @@ void Player::DrawColorArrows()
|
||||
//RageLog( "ColorArrows::Draw(%f)", fSongBeat );
|
||||
|
||||
int iBaseFrameNo = (int)(m_fSongBeat*2.5) % 12; // 2.5 is a "fudge number" :-) This should be based on BPM
|
||||
|
||||
if( iBaseFrameNo < 0 )
|
||||
iBaseFrameNo = 0;
|
||||
|
||||
if( m_fSongBeat < 0 )
|
||||
m_fSongBeat = 0;
|
||||
int iIndexFirstArrowToDraw = BeatToStepIndex( m_fSongBeat - 2.0f ); // 2 beats earlier
|
||||
if( iIndexFirstArrowToDraw < 0 ) iIndexFirstArrowToDraw = 0;
|
||||
int iIndexLastArrowToDraw = BeatToStepIndex( m_fSongBeat + 7.0f ); // 7 beats later
|
||||
@@ -531,6 +634,8 @@ void Player::DrawColorArrows()
|
||||
if( m_LeftToStepOn[i] != 0 ) // this step is not yet complete
|
||||
{
|
||||
float fYPos = GetColorArrowYPos( i, m_fSongBeat );
|
||||
if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos;
|
||||
|
||||
|
||||
// beats until the note is stepped on.
|
||||
float fBeatsTilStep = StepIndexToBeat( i ) - m_fSongBeat;
|
||||
@@ -548,6 +653,75 @@ void Player::DrawColorArrows()
|
||||
|
||||
} // end if there is a step
|
||||
} // end foreach arrow to draw
|
||||
|
||||
// draw all freeze arrows
|
||||
for( i=0; i<m_HoldSteps.GetSize(); i++ )
|
||||
{
|
||||
HoldStep &hs = m_HoldSteps[i];
|
||||
|
||||
if( !( iIndexFirstArrowToDraw <= hs.m_iEndIndex && hs.m_iEndIndex <= iIndexLastArrowToDraw ||
|
||||
iIndexFirstArrowToDraw <= hs.m_iStartIndex && hs.m_iStartIndex <= iIndexLastArrowToDraw ||
|
||||
hs.m_iStartIndex < iIndexFirstArrowToDraw && hs.m_iEndIndex > iIndexLastArrowToDraw ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
HoldStepScore &score = m_HoldStepScores[i];
|
||||
|
||||
int iColNum = m_StepToColumnNumber[ hs.m_Step ];
|
||||
|
||||
switch( score )
|
||||
{
|
||||
case HOLD_SCORE_OK:
|
||||
continue; // don't draw
|
||||
case HOLD_SCORE_NONE:
|
||||
case HOLD_SCORE_NG:
|
||||
m_ColorArrow[iColNum].SetGrayPartClear();
|
||||
break;
|
||||
case HOLD_STEPPED_ON:
|
||||
m_ColorArrow[iColNum].SetGrayPartFull();
|
||||
break;
|
||||
}
|
||||
|
||||
// draw the gray parts
|
||||
for( int j=hs.m_iEndIndex; j>=hs.m_iStartIndex; j-- ) // for each arrow in this freeze
|
||||
{
|
||||
float fYPos = GetColorArrowYPos( j, m_fSongBeat );
|
||||
if( score == HOLD_STEPPED_ON || score == HOLD_SCORE_OK )
|
||||
fYPos = max( fYPos, GetGrayArrowYPos() );
|
||||
if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos;
|
||||
m_ColorArrow[iColNum].SetY( fYPos );
|
||||
m_ColorArrow[iColNum].DrawGrayPart();
|
||||
}
|
||||
|
||||
// draw the color parts
|
||||
for( j=hs.m_iEndIndex; j>=hs.m_iStartIndex; j-- ) // for each arrow in this freeze
|
||||
{
|
||||
float fYPos = GetColorArrowYPos( j, m_fSongBeat );
|
||||
m_ColorArrow[iColNum].SetY( fYPos );
|
||||
if( score == HOLD_STEPPED_ON || score == HOLD_SCORE_OK )
|
||||
fYPos = max( fYPos, GetGrayArrowYPos() );
|
||||
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
|
||||
m_ColorArrow[iColNum].SetDiffuseColor( color );
|
||||
m_ColorArrow[iColNum].DrawColorPart();
|
||||
}
|
||||
|
||||
// draw the first arrow on top of the others
|
||||
j = hs.m_iStartIndex;
|
||||
float fYPos = GetColorArrowYPos( j, m_fSongBeat );
|
||||
if( score == HOLD_STEPPED_ON || score == 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 );
|
||||
D3DXCOLOR color( 0, 1, 0, 1 ); // color shifts from green to yellow
|
||||
m_ColorArrow[iColNum].SetDiffuseColor( color );
|
||||
m_ColorArrow[iColNum].Draw();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -555,7 +729,25 @@ void Player::DrawColorArrows()
|
||||
float Player::GetColorArrowYPos( int iStepIndex, float fSongBeat )
|
||||
{
|
||||
float fBeatsUntilStep = StepIndexToBeat( iStepIndex ) - fSongBeat;
|
||||
return (int)(fBeatsUntilStep * ARROW_GAP) + GRAY_ARROW_Y;
|
||||
float fYOffset = fBeatsUntilStep * ARROW_GAP * m_PlayerOptions.m_fArrowScrollSpeed;
|
||||
switch( m_PlayerOptions.m_EffectType )
|
||||
{
|
||||
case PlayerOptions::EFFECT_BOOST:
|
||||
fYOffset *= 1.4f / ((fYOffset+SCREEN_HEIGHT/1.6f)/SCREEN_HEIGHT);
|
||||
break;
|
||||
case PlayerOptions::EFFECT_WAVE:
|
||||
fYOffset += 15*sin( fYOffset/38 );
|
||||
break;
|
||||
}
|
||||
float fYPos = fYOffset + GRAY_ARROW_Y;
|
||||
|
||||
return fYPos;
|
||||
|
||||
}
|
||||
|
||||
float Player::GetGrayArrowYPos()
|
||||
{
|
||||
return GRAY_ARROW_Y;
|
||||
}
|
||||
|
||||
|
||||
@@ -565,20 +757,43 @@ float Player::GetColorArrowYPos( int iStepIndex, float fSongBeat )
|
||||
|
||||
void Player::SetJudgementX( int iNewX )
|
||||
{
|
||||
m_sprJudgement.SetXY( iNewX, JUDGEMENT_Y );
|
||||
float fY = JUDGEMENT_Y;
|
||||
if( m_PlayerOptions.m_bReverseScroll ) fY = SCREEN_HEIGHT - fY;
|
||||
m_sprJudgement.SetXY( iNewX, fY );
|
||||
|
||||
fY = HOLD_JUDGEMENT_Y;
|
||||
if( m_PlayerOptions.m_bReverseScroll ) fY = SCREEN_HEIGHT - fY;
|
||||
for( int c=0; c<MAX_NUM_COLUMNS; c++ )
|
||||
{
|
||||
m_sprHoldJudgement[c].SetXY( GetArrowColumnX(c), fY );
|
||||
}
|
||||
}
|
||||
|
||||
void Player::UpdateJudgement( float fDeltaTime )
|
||||
{
|
||||
if( m_fJudgementDisplayCountdown > 0.0 )
|
||||
if( m_fJudgementDisplayCountdown > 0 )
|
||||
m_fJudgementDisplayCountdown -= fDeltaTime;
|
||||
m_sprJudgement.Update( fDeltaTime );
|
||||
|
||||
for( int c=0; c<MAX_NUM_COLUMNS; c++ )
|
||||
{
|
||||
if( m_fHoldJudgementDisplayCountdown[c] > 0 )
|
||||
m_fHoldJudgementDisplayCountdown[c] -= fDeltaTime;
|
||||
m_sprHoldJudgement[c].Update( fDeltaTime );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Player::DrawJudgement()
|
||||
{
|
||||
if( m_fJudgementDisplayCountdown > 0.0 )
|
||||
m_sprJudgement.Draw();
|
||||
|
||||
for( int c=0; c<MAX_NUM_COLUMNS; c++ )
|
||||
{
|
||||
if( m_fHoldJudgementDisplayCountdown[c] > 0.0 )
|
||||
m_sprHoldJudgement[c].Draw();
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SetJudgement( StepScore score )
|
||||
@@ -609,10 +824,45 @@ void Player::SetJudgement( StepScore score )
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SetHoldJudgement( int iCol, HoldStepScore score )
|
||||
{
|
||||
//RageLog( "Judgement::SetJudgement()" );
|
||||
|
||||
switch( score )
|
||||
{
|
||||
case HOLD_SCORE_NONE: m_sprHoldJudgement[iCol].SetState( 0 ); break; // freeze!
|
||||
case HOLD_SCORE_NG: m_sprHoldJudgement[iCol].SetState( 1 ); break;
|
||||
case HOLD_SCORE_OK: m_sprHoldJudgement[iCol].SetState( 2 ); break;
|
||||
}
|
||||
|
||||
m_fHoldJudgementDisplayCountdown[iCol] = JUDGEMENT_DISPLAY_TIME;
|
||||
|
||||
if( score == HOLD_SCORE_NG ) { // falling down
|
||||
float fY = HOLD_JUDGEMENT_Y;
|
||||
if( m_PlayerOptions.m_bReverseScroll ) fY = SCREEN_HEIGHT - fY;
|
||||
m_sprHoldJudgement[iCol].SetY( fY - 10 );
|
||||
m_sprHoldJudgement[iCol].SetZoom( 1.0f );
|
||||
m_sprHoldJudgement[iCol].BeginTweening( JUDGEMENT_DISPLAY_TIME );
|
||||
m_sprHoldJudgement[iCol].SetTweenY( HOLD_JUDGEMENT_Y + 10 );
|
||||
} else { // zooming out
|
||||
float fY = HOLD_JUDGEMENT_Y;
|
||||
if( m_PlayerOptions.m_bReverseScroll ) fY = SCREEN_HEIGHT - fY;
|
||||
m_sprHoldJudgement[iCol].SetY( fY );
|
||||
m_sprHoldJudgement[iCol].SetZoom( 1.5f );
|
||||
m_sprHoldJudgement[iCol].BeginTweening( JUDGEMENT_DISPLAY_TIME/3.0 );
|
||||
m_sprHoldJudgement[iCol].SetTweenZoom( 1.0f );
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SetComboX( int iNewX )
|
||||
{
|
||||
m_sprCombo.SetXY( iNewX+40, COMBO_Y );
|
||||
m_ComboNumber.SetXY( iNewX-50, COMBO_Y );
|
||||
float fY;
|
||||
|
||||
fY = COMBO_Y;
|
||||
if( m_PlayerOptions.m_bReverseScroll ) fY = SCREEN_HEIGHT - fY;
|
||||
|
||||
m_sprCombo.SetXY( iNewX+40, fY );
|
||||
m_ComboNumber.SetXY( iNewX-50, fY );
|
||||
}
|
||||
|
||||
void Player::UpdateCombo( float fDeltaTime )
|
||||
|
||||
+15
-4
@@ -20,6 +20,8 @@
|
||||
#include "ColorArrow.h"
|
||||
#include "GrayArrow.h"
|
||||
#include "GhostArrow.h"
|
||||
#include "HoldGhostArrow.h"
|
||||
#include "Player.h"
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +32,7 @@ const int MAX_NUM_COLUMNS = 8;
|
||||
class Player
|
||||
{
|
||||
public:
|
||||
Player();
|
||||
Player( PlayerOptions po );
|
||||
|
||||
void SetSteps( const Steps& newSteps, bool bLoadOnlyLeftSide = false, bool bLoadOnlyRightSide = false );
|
||||
void SetX( float fX );
|
||||
@@ -46,6 +48,8 @@ protected:
|
||||
void CheckForCompleteStep( float fSongBeat, Step player_step, float fMaxBeatDiff );
|
||||
void OnCompleteStep( float fSongBeat, Step player_step, float fMaxBeatDiff, int iStepIndex );
|
||||
|
||||
PlayerOptions m_PlayerOptions;
|
||||
|
||||
int m_iCurCombo;
|
||||
int m_iMaxCombo;
|
||||
float m_fSongBeat;
|
||||
@@ -54,8 +58,9 @@ protected:
|
||||
Step m_OriginalStep[MAX_STEP_ELEMENTS];
|
||||
Step m_LeftToStepOn[MAX_STEP_ELEMENTS];
|
||||
StepScore m_StepScore[MAX_STEP_ELEMENTS];
|
||||
CArray<HoldStep, HoldStep&> m_HoldSteps;
|
||||
//StepTiming m_StepTiming[MAX_STEP_ELEMENTS];
|
||||
|
||||
CArray<HoldStepScore, HoldStepScore> m_HoldStepScores;
|
||||
|
||||
// common to color and gray arrows
|
||||
float m_fArrowsCenterX;
|
||||
@@ -77,16 +82,18 @@ protected:
|
||||
// gray arrows
|
||||
void SetGrayArrowsX( int iX );
|
||||
void UpdateGrayArrows( float fDeltaTime );
|
||||
float GetGrayArrowYPos();
|
||||
void DrawGrayArrows();
|
||||
void GrayArrowStep( int index, StepScore score );
|
||||
void GrayArrowStep( int iCol, StepScore score );
|
||||
GrayArrow m_GrayArrow[MAX_NUM_COLUMNS];
|
||||
|
||||
// ghost arrows
|
||||
void SetGhostArrowsX( int iX );
|
||||
void UpdateGhostArrows( float fDeltaTime );
|
||||
void DrawGhostArrows();
|
||||
void GhostArrowStep( int index, StepScore score );
|
||||
void GhostArrowStep( int iCol, StepScore score );
|
||||
GhostArrow m_GhostArrow[MAX_NUM_COLUMNS];
|
||||
HoldGhostArrow m_HoldGhostArrow[MAX_NUM_COLUMNS];
|
||||
|
||||
|
||||
// judgement
|
||||
@@ -97,6 +104,10 @@ protected:
|
||||
float m_fJudgementDisplayCountdown;
|
||||
Sprite m_sprJudgement;
|
||||
|
||||
void SetHoldJudgement( int iCol, HoldStepScore score );
|
||||
float m_fHoldJudgementDisplayCountdown[MAX_NUM_COLUMNS];
|
||||
Sprite m_sprHoldJudgement[MAX_NUM_COLUMNS];
|
||||
|
||||
// combo
|
||||
void SetComboX( int iX );
|
||||
void UpdateCombo( float fDeltaTime );
|
||||
|
||||
@@ -35,6 +35,8 @@ RageBitmapTexture::RageBitmapTexture( LPRageScreen pScreen, CString sFilePath )
|
||||
{
|
||||
// RageLog( "RageBitmapTexture::RageBitmapTexture()" );
|
||||
|
||||
m_pd3dTexture = NULL;
|
||||
|
||||
Create();
|
||||
|
||||
CreateFrameRects();
|
||||
|
||||
@@ -38,6 +38,8 @@ public:
|
||||
|
||||
protected:
|
||||
virtual VOID Create();
|
||||
|
||||
LPDIRECT3DTEXTURE8 m_pd3dTexture;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -444,6 +444,7 @@ VOID RageInput::Release()
|
||||
}
|
||||
|
||||
|
||||
|
||||
HRESULT RageInput::GetDeviceInputs( DeviceInputArray &listDeviceInputs )
|
||||
{
|
||||
// macros for reading DI state structures
|
||||
@@ -606,3 +607,36 @@ HRESULT RageInput::GetDeviceInputs( DeviceInputArray &listDeviceInputs )
|
||||
}
|
||||
|
||||
|
||||
BOOL RageInput::IsBeingPressed( DeviceInput di )
|
||||
{
|
||||
switch( di.device )
|
||||
{
|
||||
case DEVICE_KEYBOARD:
|
||||
return m_keys[ di.button ];
|
||||
case DEVICE_JOYSTICK1:
|
||||
case DEVICE_JOYSTICK2:
|
||||
case DEVICE_JOYSTICK3:
|
||||
case DEVICE_JOYSTICK4:
|
||||
int joy_index;
|
||||
joy_index = di.device - DEVICE_JOYSTICK1;
|
||||
|
||||
switch( di.button )
|
||||
{
|
||||
case JOY_LEFT:
|
||||
return IS_LEFT( m_joyState[joy_index].lX );
|
||||
case JOY_RIGHT:
|
||||
return IS_RIGHT( m_joyState[joy_index].lX );
|
||||
case JOY_UP:
|
||||
return IS_UP( m_joyState[joy_index].lX );
|
||||
case JOY_DOWN:
|
||||
return IS_DOWN( m_joyState[joy_index].lX );
|
||||
default: // a joystick button
|
||||
int button_index = di.button - JOY_1;
|
||||
return IS_PRESSED( m_joyState[joy_index].rgbButtons[button_index] );
|
||||
}
|
||||
default:
|
||||
RageError( "Invalid device" );
|
||||
}
|
||||
|
||||
return false; // how did we get here?!?
|
||||
}
|
||||
@@ -65,6 +65,11 @@ public:
|
||||
DeviceInput() { device=DEVICE_NONE; };
|
||||
DeviceInput( InputDevice d, int b ) { device=d; button=b; };
|
||||
|
||||
bool operator==( const DeviceInput &other )
|
||||
{
|
||||
return device == other.device && button == other.button;
|
||||
};
|
||||
|
||||
CString GetDescription();
|
||||
|
||||
CString toString();
|
||||
@@ -123,6 +128,7 @@ public:
|
||||
VOID Release();
|
||||
// Get our Devices State
|
||||
HRESULT GetDeviceInputs( DeviceInputArray &listDeviceInputs );
|
||||
BOOL IsBeingPressed( DeviceInput di );
|
||||
|
||||
LPDIRECTINPUT8 GetDirectInput() { return m_pDI; }
|
||||
LPDIRECTINPUTDEVICE8 GetMouseDevice() { return m_pMouse; }
|
||||
|
||||
@@ -111,11 +111,13 @@ HRESULT CTextureRenderer::SetMediaType(const CMediaType *pmt)
|
||||
//-----------------------------------------------------------------------------
|
||||
// SetRenderTarget: Save all the information we'll need to render to a D3D texture.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CTextureRenderer::SetRenderTarget(LPDIRECT3DTEXTURE8 pTexture)
|
||||
HRESULT CTextureRenderer::SetRenderTarget( RageMovieTexture* pTexture )
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if (pTexture == NULL) {
|
||||
LPDIRECT3DTEXTURE8 pD3DTexture = pTexture->GetD3DTexture();
|
||||
|
||||
if (pD3DTexture == NULL) {
|
||||
DXTRACE_ERR(TEXT("SetRenderTarget called with a NULL texture!"), 0);
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -124,7 +126,7 @@ HRESULT CTextureRenderer::SetRenderTarget(LPDIRECT3DTEXTURE8 pTexture)
|
||||
|
||||
// get the format of the texture
|
||||
D3DSURFACE_DESC ddsd;
|
||||
if ( FAILED( hr = m_pTexture->GetLevelDesc( 0, &ddsd ) ) ) {
|
||||
if ( FAILED( hr = pD3DTexture->GetLevelDesc( 0, &ddsd ) ) ) {
|
||||
DXTRACE_ERR(TEXT("Could not get level Description of D3DX texture! hr = 0x%x"), hr);
|
||||
return hr;
|
||||
}
|
||||
@@ -151,9 +153,19 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample )
|
||||
// Get the video bitmap buffer
|
||||
pSample->GetPointer( &pBmpBuffer );
|
||||
|
||||
|
||||
// Find which texture we should render to.
|
||||
LPDIRECT3DTEXTURE8 pD3DTexture;
|
||||
|
||||
switch( m_pTexture->m_iIndexActiveTexture )
|
||||
{
|
||||
case 0: pD3DTexture = m_pTexture->m_pd3dTexture[1]; break; // 0 is active, so render to 1
|
||||
case 1: pD3DTexture = m_pTexture->m_pd3dTexture[0]; break; // 1 is active, so render to 0
|
||||
}
|
||||
|
||||
// Lock the Texture
|
||||
D3DLOCKED_RECT d3dlr;
|
||||
if (FAILED(m_pTexture->LockRect(0, &d3dlr, 0, 0))) {
|
||||
if (FAILED(pD3DTexture->LockRect(0, &d3dlr, 0, 0))) {
|
||||
DXTRACE_ERR_NOMSGBOX(TEXT("Failed to lock the texture!"), E_FAIL);
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -205,13 +217,22 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample )
|
||||
|
||||
|
||||
// Unlock the Texture
|
||||
if (FAILED(m_pTexture->UnlockRect(0))) {
|
||||
if (FAILED(pD3DTexture->UnlockRect(0))) {
|
||||
DXTRACE_ERR_NOMSGBOX(TEXT("Failed to unlock the texture!"), E_FAIL);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_bLocked = FALSE;
|
||||
|
||||
|
||||
// flip active texture
|
||||
switch( m_pTexture->m_iIndexActiveTexture )
|
||||
{
|
||||
case 0: m_pTexture->m_iIndexActiveTexture = 1; break;
|
||||
case 1: m_pTexture->m_iIndexActiveTexture = 0; break;
|
||||
}
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -224,6 +245,9 @@ RageMovieTexture::RageMovieTexture( LPRageScreen pScreen, CString sFilePath ) :
|
||||
{
|
||||
RageLog( "RageBitmapTexture::RageBitmapTexture()" );
|
||||
|
||||
m_pd3dTexture[0] = m_pd3dTexture[1] = NULL;
|
||||
m_iIndexActiveTexture = 0;
|
||||
|
||||
Create();
|
||||
|
||||
CreateFrameRects();
|
||||
@@ -233,7 +257,8 @@ RageMovieTexture::~RageMovieTexture()
|
||||
{
|
||||
CleanupDShow();
|
||||
|
||||
SAFE_RELEASE(m_pd3dTexture);
|
||||
SAFE_RELEASE(m_pd3dTexture[0]);
|
||||
SAFE_RELEASE(m_pd3dTexture[1]);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -249,15 +274,15 @@ LPDIRECT3DTEXTURE8 RageMovieTexture::GetD3DTexture()
|
||||
// the video fell behind and is trying to copy several frames in a row
|
||||
// to catch up. So, if the TextureRenderer is busy, give it a 1ms slice of
|
||||
// time for it to catch up and copy all the frames it fell behind on.
|
||||
while( m_pCTR->IsLocked() ) {
|
||||
::Sleep(1);
|
||||
RageLog( "Sleeping waiting for unlock..." );
|
||||
}
|
||||
// while( m_pCTR->IsLocked() ) {
|
||||
// ::Sleep(1);
|
||||
// RageLog( "Sleeping waiting for unlock..." );
|
||||
// }
|
||||
|
||||
// restart the movie if we reach the end
|
||||
CheckMovieStatus();
|
||||
|
||||
return m_pd3dTexture;
|
||||
return m_pd3dTexture[m_iIndexActiveTexture];
|
||||
}
|
||||
|
||||
|
||||
@@ -278,7 +303,7 @@ VOID RageMovieTexture::Create()
|
||||
|
||||
// Pass the D3D texture to our TextureRenderer so it knows
|
||||
// where to render new movie frames to.
|
||||
if( FAILED( hr = m_pCTR->SetRenderTarget(GetD3DTexture()) ) )
|
||||
if( FAILED( hr = m_pCTR->SetRenderTarget( this ) ) )
|
||||
RageErrorHr( "RageMovieTexture: SetRenderTarget failed.", hr );
|
||||
|
||||
// Start the graph running
|
||||
@@ -409,12 +434,18 @@ HRESULT RageMovieTexture::CreateD3DTexture()
|
||||
if( FAILED( hr = D3DXCreateTexture(m_pd3dDevice,
|
||||
m_uSourceHeight, m_uSourceHeight,
|
||||
1, 0,
|
||||
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &m_pd3dTexture ) ) )
|
||||
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &m_pd3dTexture[0] ) ) )
|
||||
RageErrorHr( "Could not create the D3DX texture!", hr );
|
||||
|
||||
if( FAILED( hr = D3DXCreateTexture(m_pd3dDevice,
|
||||
m_uSourceHeight, m_uSourceHeight,
|
||||
1, 0,
|
||||
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &m_pd3dTexture[1] ) ) )
|
||||
RageErrorHr( "Could not create the D3DX texture!", hr );
|
||||
|
||||
// D3DXCreateTexture can silently change the parameters on us
|
||||
D3DSURFACE_DESC ddsd;
|
||||
if ( FAILED( hr = m_pd3dTexture->GetLevelDesc( 0, &ddsd ) ) )
|
||||
if ( FAILED( hr = m_pd3dTexture[0]->GetLevelDesc( 0, &ddsd ) ) )
|
||||
RageErrorHr( "Could not get level Description of D3DX texture!", hr );
|
||||
|
||||
m_uTextureWidth = ddsd.Width;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
struct __declspec(uuid("{71771540-2017-11cf-ae26-0020afd79767}")) CLSID_TextureRenderer;
|
||||
|
||||
class RageMovieTexture;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CTextureRenderer Class Declarations
|
||||
@@ -51,7 +52,7 @@ public:
|
||||
// new methods
|
||||
LONG GetVidWidth() {return m_lVidWidth;};
|
||||
LONG GetVidHeight(){return m_lVidHeight;};
|
||||
HRESULT SetRenderTarget(LPDIRECT3DTEXTURE8 pTexture);
|
||||
HRESULT SetRenderTarget( RageMovieTexture* pTexture );
|
||||
BOOL IsLocked() { return m_bLocked; };
|
||||
|
||||
protected:
|
||||
@@ -59,7 +60,7 @@ protected:
|
||||
LONG m_lVidHeight; // Video Height
|
||||
LONG m_lVidPitch; // Video Pitch
|
||||
|
||||
LPDIRECT3DTEXTURE8 m_pTexture; // the video surface we will copy new frames to
|
||||
RageMovieTexture* m_pTexture; // the video surface we will copy new frames to
|
||||
D3DFORMAT m_TextureFormat; // Texture format
|
||||
BOOL m_bLocked; // Is the texture currently locked while we
|
||||
// copy the movie frame to it?
|
||||
@@ -77,6 +78,9 @@ public:
|
||||
|
||||
LPDIRECT3DTEXTURE8 GetD3DTexture();
|
||||
|
||||
LPDIRECT3DTEXTURE8 m_pd3dTexture[2]; // double buffered
|
||||
int m_iIndexActiveTexture; // either 0 or 1
|
||||
|
||||
protected:
|
||||
virtual VOID Create();
|
||||
|
||||
@@ -94,6 +98,7 @@ protected:
|
||||
CComPtr<IMediaPosition> m_pMP; // Media Postion
|
||||
CComPtr<IMediaEvent> m_pME; // Media Event
|
||||
CTextureRenderer *m_pCTR; // DShow Texture renderer
|
||||
|
||||
};
|
||||
|
||||
typedef RageMovieTexture* LPRageMovieTexture;
|
||||
|
||||
@@ -79,6 +79,19 @@ void RageSound::StopSample( HSAMPLE hSample )
|
||||
RageError( "There was an error stopping a sound sample. Are you sure this is a valid HSAMPLE?" );
|
||||
}
|
||||
|
||||
float RageSound::GetSampleLength( HSAMPLE hSample )
|
||||
{
|
||||
return 90;
|
||||
}
|
||||
|
||||
float RageSound::GetSamplePosition( HSAMPLE hSample )
|
||||
{
|
||||
DWORD dwPosition = BASS_ChannelGetPosition( hSample );
|
||||
float fSeconds = BASS_ChannelBytes2Seconds( hSample, dwPosition );
|
||||
// fSeconds += 0.05f; // fudge number. Should use a BASS_SYNC to sync the music.
|
||||
return fSeconds;
|
||||
}
|
||||
|
||||
|
||||
// Stream stuff
|
||||
|
||||
@@ -127,6 +140,7 @@ float RageSound::GetStreamPosition( HSTREAM hStream )
|
||||
{
|
||||
DWORD dwPosition = BASS_ChannelGetPosition( hStream );
|
||||
float fSeconds = BASS_ChannelBytes2Seconds( hStream, dwPosition );
|
||||
//fSeconds += 0.05f; // fudge number. Should use a BASS_SYNC to sync the music.
|
||||
return fSeconds;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ public:
|
||||
void UnloadSample( HSAMPLE hSample );
|
||||
void PlaySample( HSAMPLE hSample );
|
||||
void StopSample( HSAMPLE hSample );
|
||||
float GetSampleLength( HSAMPLE hSample );
|
||||
float GetSamplePosition( HSAMPLE hSample );
|
||||
|
||||
HSTREAM LoadStream( const CString sFileName );
|
||||
void UnloadStream( HSTREAM hStream);
|
||||
@@ -39,6 +41,8 @@ public:
|
||||
float GetStreamPosition( HSTREAM hStream);
|
||||
BOOL IsPlaying(DWORD handle);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
HWND m_hWndApp; // this is set on GRAPHICS_Create()
|
||||
// HSAMPLE m_hSample[NUM_STREAMS];
|
||||
|
||||
@@ -38,7 +38,7 @@ RageTexture::RageTexture( LPRageScreen pScreen, CString sFilePath ) :
|
||||
|
||||
// save the file path
|
||||
m_sFilePath = sFilePath;
|
||||
m_pd3dTexture = NULL;
|
||||
// m_pd3dTexture = NULL;
|
||||
m_iRefCount = 1;
|
||||
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ protected:
|
||||
|
||||
CString m_sFilePath;
|
||||
LPDIRECT3DDEVICE8 m_pd3dDevice;
|
||||
LPDIRECT3DTEXTURE8 m_pd3dTexture;
|
||||
// LPDIRECT3DTEXTURE8 m_pd3dTexture;
|
||||
|
||||
UINT m_uSourceWidth, m_uSourceHeight; // dimensions of the original image
|
||||
UINT m_uTextureWidth, m_uTextureHeight; // dimensions of the texture holding the image
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef _SCREENDIMENSIONS_H_
|
||||
#define _SCREENDIMENSIONS_H_
|
||||
|
||||
|
||||
const int SCREEN_WIDTH = 640;
|
||||
const int SCREEN_HEIGHT = 480;
|
||||
@@ -20,3 +23,5 @@ const float BOTTOM_EDGE = SCREEN_HEIGHT;
|
||||
const float CENTER_X = LEFT_EDGE + (RIGHT_EDGE - LEFT_EDGE)/2.0f;
|
||||
const float CENTER_Y = TOP_EDGE + (BOTTOM_EDGE - TOP_EDGE)/2.0f;
|
||||
|
||||
|
||||
#endif
|
||||
+156
-106
@@ -20,6 +20,30 @@
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
|
||||
int CompareBPMSegments(const void *arg1, const void *arg2)
|
||||
{
|
||||
// arg1 and arg2 are of type Step**
|
||||
BPMSegment* seg1 = (BPMSegment*)arg1;
|
||||
BPMSegment* seg2 = (BPMSegment*)arg2;
|
||||
|
||||
float score1 = seg1->m_fStartBeat;
|
||||
float score2 = seg2->m_fStartBeat;
|
||||
|
||||
if( score1 == score2 )
|
||||
return 0;
|
||||
else if( score1 < score2 )
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
void SortBPMSegmentsArray( CArray<BPMSegment,BPMSegment&> &arrayBPMSegments )
|
||||
{
|
||||
qsort( arrayBPMSegments.GetData(), arrayBPMSegments.GetSize(), sizeof(BPMSegment), CompareBPMSegments );
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
// Song
|
||||
//////////////////////////////
|
||||
@@ -30,6 +54,33 @@ Song::Song()
|
||||
m_fOffsetInSeconds = 0;
|
||||
}
|
||||
|
||||
|
||||
void Song::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut )
|
||||
{
|
||||
fElapsedTime += m_fOffsetInSeconds;
|
||||
|
||||
for( int i=0; i<m_BPMSegments.GetSize(); i++ ) {
|
||||
float fStartBeatThisSegment = m_BPMSegments[i].m_fStartBeat;
|
||||
bool bIsLastBPMSegment = i==m_BPMSegments.GetSize()-1;
|
||||
float fStartBeatNextSegment = bIsLastBPMSegment ? 40000/*inf*/ : m_BPMSegments[i+1].m_fStartBeat;
|
||||
float fBeatsInThisSegment = fStartBeatNextSegment - fStartBeatThisSegment;
|
||||
float fBPM = m_BPMSegments[i].m_fBPM;
|
||||
float fBPS = fBPM / 60.0f;
|
||||
float fSecondsInThisSegment = fBeatsInThisSegment / fBPS;
|
||||
fElapsedTime -= m_BPMSegments[i].m_fFreezeSeconds;
|
||||
if( fElapsedTime < 0 ) fElapsedTime = 0;
|
||||
|
||||
if( fElapsedTime > fSecondsInThisSegment )
|
||||
fElapsedTime -= fSecondsInThisSegment;
|
||||
else {
|
||||
fBeatOut = fStartBeatThisSegment + fElapsedTime*fBPS;
|
||||
fBPSOut = fBPS;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Song::LoadFromSongDir( CString sDir )
|
||||
{
|
||||
RageLog( "Song::LoadFromSongDir(%s)", sDir );
|
||||
@@ -48,9 +99,9 @@ bool Song::LoadFromSongDir( CString sDir )
|
||||
GetDirListing( sDir + CString("*.bms"), arrayBMSFileNames );
|
||||
int iNumBMSFiles = arrayBMSFileNames.GetSize();
|
||||
|
||||
CStringArray arrayMSDFileNames;
|
||||
GetDirListing( sDir + CString("*.msd"), arrayMSDFileNames );
|
||||
int iNumMSDFiles = arrayMSDFileNames.GetSize();
|
||||
CStringArray arrayDWIFileNames;
|
||||
GetDirListing( sDir + CString("*.dwi"), arrayDWIFileNames );
|
||||
int iNumDWIFiles = arrayDWIFileNames.GetSize();
|
||||
|
||||
/*
|
||||
int j;
|
||||
@@ -75,14 +126,14 @@ bool Song::LoadFromSongDir( CString sDir )
|
||||
new_steps.LoadStepsFromBMSFile( sDir + arrayBMSFileNames.GetAt(i) );
|
||||
}
|
||||
}
|
||||
else if( iNumMSDFiles == 1 )
|
||||
else if( iNumDWIFiles == 1 )
|
||||
{
|
||||
//m_sSongFile = arrayMSDFileNames.GetAt( 0 );
|
||||
//RageLog( "Found '%s'. Let's use it...", m_sSongFile );
|
||||
//LoadFromMSDFile( sDir + m_sSongFile );
|
||||
m_sSongFile = arrayDWIFileNames[0];
|
||||
RageLog( "Found '%s'. Let's use it...", m_sSongFile );
|
||||
LoadSongInfoFromDWIFile( sDir + m_sSongFile );
|
||||
}
|
||||
else if( iNumMSDFiles > 0 )
|
||||
RageError( ssprintf("Found more than one MSD file in '%s'. Which should I use?", sDir) );
|
||||
else if( iNumDWIFiles > 0 )
|
||||
RageError( ssprintf("Found more than one DWI file in '%s'. Which should I use?", sDir) );
|
||||
else
|
||||
RageError( ssprintf("Couldn't find any BMS or MSD files in '%s'", sDir) );
|
||||
|
||||
@@ -95,6 +146,9 @@ bool Song::LoadSongInfoFromBMSFile( CString sPath )
|
||||
{
|
||||
RageLog( "Song::LoadFromBMSFile(%s)", sPath );
|
||||
|
||||
if( sPath == "Songs\\saints\\saint_4basic.bms" )
|
||||
int kdgjf = 0;
|
||||
|
||||
BmsFile bms( sPath );
|
||||
bms.ReadFile();
|
||||
|
||||
@@ -123,14 +177,11 @@ bool Song::LoadSongInfoFromBMSFile( CString sPath )
|
||||
m_sArtist = data_array[0];
|
||||
else if( value_name == "#BPM" ) {
|
||||
BPMSegment new_seg;
|
||||
new_seg.m_iStartBeat = 0;
|
||||
new_seg.m_fStartBeat = 0;
|
||||
new_seg.m_fBPM = (float)atof( data_array[0] );
|
||||
// find insertion point
|
||||
for( int i=0; i<m_BPMSegments.GetSize(); i++ )
|
||||
if( m_BPMSegments[i].m_iStartBeat > new_seg.m_iStartBeat )
|
||||
break;
|
||||
m_BPMSegments.InsertAt( i, new_seg );
|
||||
RageLog( "Inserting new BPM change at beat %d, BPM %f, index %d", new_seg.m_iStartBeat, new_seg.m_fBPM, i );
|
||||
m_BPMSegments.Add( new_seg );
|
||||
RageLog( "Inserting new BPM change at beat %f, BPM %f", new_seg.m_fStartBeat, new_seg.m_fBPM );
|
||||
}
|
||||
else if( value_name == "#BackBMP" || value_name == "#backBMP")
|
||||
m_sBackground = data_array[0];
|
||||
@@ -141,35 +192,15 @@ bool Song::LoadSongInfoFromBMSFile( CString sPath )
|
||||
int iMeasureNo = atoi( value_name.Mid(1,3) );
|
||||
int iTrackNum = atoi( value_name.Mid(4,2) );
|
||||
|
||||
if( m_sTitle.Find("era") > 0 )
|
||||
m_sTitle = m_sTitle;
|
||||
switch( iTrackNum )
|
||||
{
|
||||
case 03: // bpm
|
||||
{
|
||||
int iNewBPM;
|
||||
sscanf( data_array[0], "%x", &iNewBPM ); // data is in hexadecimal
|
||||
BPMSegment new_seg;
|
||||
new_seg.m_iStartBeat = iMeasureNo * 4;
|
||||
new_seg.m_fBPM = (float)iNewBPM;
|
||||
// find insertion point
|
||||
for( int i=0; i<m_BPMSegments.GetSize(); i++ )
|
||||
if( m_BPMSegments[i].m_iStartBeat > new_seg.m_iStartBeat )
|
||||
break;
|
||||
m_BPMSegments.InsertAt( i, new_seg );
|
||||
RageLog( "Inserting new BPM change at beat %d, BPM %f, index %d", new_seg.m_iStartBeat, new_seg.m_fBPM, i );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
CString sNoteData = data_array[0];
|
||||
CArray<BOOL, BOOL&> arrayNotes;
|
||||
CArray<int, int> arrayNotes;
|
||||
|
||||
for( int i=0; i<sNoteData.GetLength(); i+=2 )
|
||||
{
|
||||
BOOL bThisIsANote = sNoteData.Mid(i,2) == "01" // step
|
||||
|| sNoteData.Mid(i,2) == "99"; // offset
|
||||
arrayNotes.Add( bThisIsANote );
|
||||
CString sNote = sNoteData.Mid(i,2);
|
||||
int iNote;
|
||||
sscanf( sNote, "%x", &iNote ); // data is in hexadecimal
|
||||
arrayNotes.Add( iNote );
|
||||
}
|
||||
|
||||
const int iNumNotesInThisMeasure = arrayNotes.GetSize();
|
||||
@@ -177,7 +208,7 @@ bool Song::LoadSongInfoFromBMSFile( CString sPath )
|
||||
// valuename, sNoteData, iMeasureNo, iTrackNum, iNumNotesInThisMeasure );
|
||||
for( int j=0; j<iNumNotesInThisMeasure; j++ )
|
||||
{
|
||||
if( arrayNotes.GetAt(j) == TRUE )
|
||||
if( arrayNotes[j] != 0 )
|
||||
{
|
||||
float fPercentThroughMeasure = (float)j/(float)iNumNotesInThisMeasure;
|
||||
|
||||
@@ -187,24 +218,22 @@ bool Song::LoadSongInfoFromBMSFile( CString sPath )
|
||||
|
||||
switch( iTrackNum )
|
||||
{
|
||||
case 01: // offset
|
||||
{
|
||||
float fBeatOffset = StepIndexToBeat(iStepIndex);
|
||||
float fBPS = m_BPMSegments[0].m_fBPM/60.0f;
|
||||
case 01: // background music track
|
||||
float fBeatOffset;
|
||||
fBeatOffset = StepIndexToBeat(iStepIndex);
|
||||
float fBPS;
|
||||
fBPS = m_BPMSegments[0].m_fBPM/60.0f;
|
||||
m_fOffsetInSeconds = fBeatOffset / fBPS;
|
||||
//RageLog( "Found offset to be index %d, beat %f", iStepIndex, StepIndexToBeat(iStepIndex) );
|
||||
}
|
||||
break;
|
||||
case 03: // bpm
|
||||
{
|
||||
int iNewBPM;
|
||||
sscanf( data_array[0], "%x", &iNewBPM ); // data is in hexadecimal
|
||||
BPMSegment seg;
|
||||
seg.m_iStartBeat = iMeasureNo * 4;
|
||||
seg.m_fBPM = (float)iNewBPM;
|
||||
m_BPMSegments.Add(seg);
|
||||
RageLog( "Found new BPM change at beat %d, BPM %f", seg.m_iStartBeat, seg.m_fBPM );
|
||||
}
|
||||
BPMSegment new_seg;
|
||||
new_seg.m_fStartBeat = StepIndexToBeat( iStepIndex );
|
||||
new_seg.m_fBPM = (float)arrayNotes[j];
|
||||
m_BPMSegments.Add( new_seg ); // add to back for now (we'll sort later)
|
||||
|
||||
// sort the BPM segments so that they are always in order
|
||||
SortBPMSegmentsArray( m_BPMSegments );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -212,19 +241,23 @@ bool Song::LoadSongInfoFromBMSFile( CString sPath )
|
||||
}
|
||||
}
|
||||
|
||||
for( int i=0; i<m_BPMSegments.GetSize(); i++ )
|
||||
RageLog( "There is a BPM change at beat fd, BPM %f, index %d",
|
||||
m_BPMSegments[i].m_fStartBeat, m_BPMSegments[i].m_fBPM, i );
|
||||
|
||||
|
||||
|
||||
TidyUpData();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool Song::LoadSongInfoFromMSDFile( CString sPath )
|
||||
bool Song::LoadSongInfoFromDWIFile( CString sPath )
|
||||
{
|
||||
RageLog( "Song::LoadFromMSDFile(%s)", sPath );
|
||||
RageLog( "Song::LoadFromDWIFile(%s)", sPath );
|
||||
|
||||
|
||||
// BROKEN
|
||||
/*
|
||||
CStdioFile file;
|
||||
if( !file.Open( GetSongFilePath(), CFile::modeRead ) )
|
||||
RageError( ssprintf("Error opening Song file '%s'.", GetSongFilePath()) );
|
||||
@@ -251,78 +284,95 @@ bool Song::LoadSongInfoFromMSDFile( CString sPath )
|
||||
split( sValueString, ":", arrayValueTokens );
|
||||
|
||||
CString sValueName = arrayValueTokens.GetAt( 0 );
|
||||
|
||||
|
||||
// handle the data
|
||||
if( sValueName == "#TITLE" )
|
||||
if( sValueName == "#FILE" )
|
||||
m_sMusic = arrayValueTokens[1];
|
||||
|
||||
else if( sValueName == "#TITLE" )
|
||||
m_sTitle = arrayValueTokens[1];
|
||||
|
||||
else if( sValueName == "#ARTIST" )
|
||||
m_sArtist = arrayValueTokens[1];
|
||||
|
||||
else if( sValueName == "#REMIXER" || sValueName == "#MSD")
|
||||
m_sCreator = arrayValueTokens[1];
|
||||
|
||||
else if( sValueName == "#BPM" )
|
||||
m_fBPM = (FLOAT)atof( arrayValueTokens[1] );
|
||||
|
||||
else if( sValueName == "#OFFSET" )
|
||||
m_fBeatOffset = (FLOAT)atoi( arrayValueTokens[1] );
|
||||
|
||||
{
|
||||
BPMSegment new_seg;
|
||||
new_seg.m_fStartBeat = 0;
|
||||
new_seg.m_fBPM = atof( arrayValueTokens[1] );
|
||||
m_BPMSegments.Add( new_seg ); // add to back for now (we'll sort later)
|
||||
}
|
||||
else if( sValueName == "#GAP" )
|
||||
// the units of GAP is 1/10 second
|
||||
m_fBeatOffset = (FLOAT)atof( arrayValueTokens[1] ) / 10.0f;
|
||||
// the units of GAP is 1/1000 second
|
||||
m_fOffsetInSeconds = -atoi( arrayValueTokens[1] ) / 1000.0f;
|
||||
|
||||
else if( sValueName == "#MUSIC" )
|
||||
m_sMusic = arrayValueTokens[1];
|
||||
else if( sValueName == "#FREEZE" )
|
||||
{
|
||||
CStringArray arrayFreezeExpressions;
|
||||
split( arrayValueTokens[1], ",", arrayFreezeExpressions );
|
||||
|
||||
else if( sValueName == "#SAMPLE" )
|
||||
m_sSample = arrayValueTokens[1];
|
||||
for( int f=0; f<arrayFreezeExpressions.GetSize(); f++ )
|
||||
{
|
||||
CStringArray arrayFreezeValues;
|
||||
split( arrayFreezeExpressions[f], "=", arrayFreezeValues );
|
||||
int fIndex = atoi( arrayFreezeValues[0] ) * 2;
|
||||
float fFreezeBeat = StepIndexToBeat( fIndex );
|
||||
float fFreezeSeconds = atof( arrayFreezeValues[1] ) / 1000.0f;
|
||||
|
||||
// find the BPM segment corresponding to this freeze
|
||||
for( int b=0; b<m_BPMSegments.GetSize(); b++ )
|
||||
{
|
||||
if( m_BPMSegments[b].m_fStartBeat == fFreezeBeat )
|
||||
{
|
||||
m_BPMSegments[b].m_fFreezeSeconds = fFreezeSeconds*0.8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
else if( sValueName == "#CHANGEBPM" || sValueName == "#BPMCHANGE" )
|
||||
{
|
||||
CStringArray arrayBPMChangeExpressions;
|
||||
split( arrayValueTokens[1], ",", arrayBPMChangeExpressions );
|
||||
|
||||
for( int b=0; b<arrayBPMChangeExpressions.GetSize(); b++ )
|
||||
{
|
||||
CStringArray arrayBPMChangeValues;
|
||||
split( arrayBPMChangeExpressions[b], "=", arrayBPMChangeValues );
|
||||
int fIndex = atoi( arrayBPMChangeValues[0] ) * 2;
|
||||
float fBeat = StepIndexToBeat( fIndex );
|
||||
float fNewBPM = atoi( arrayBPMChangeValues[1] );
|
||||
|
||||
BPMSegment new_seg;
|
||||
new_seg.m_fStartBeat = fBeat;
|
||||
new_seg.m_fBPM = fNewBPM;
|
||||
m_BPMSegments.Add( new_seg ); // add to back for now (we'll sort later)
|
||||
|
||||
// sort the BPM segments so that they are always in order
|
||||
SortBPMSegmentsArray( m_BPMSegments );
|
||||
}
|
||||
}
|
||||
else if( sValueName == "#BANNER" )
|
||||
m_sBanner = arrayValueTokens[1];
|
||||
|
||||
else if( sValueName == "#BACKGROUND" )
|
||||
m_sBackground = arrayValueTokens[1];
|
||||
|
||||
// handle STEPS defined in the file for backwards compatibility with MSD files
|
||||
else if( sValueName == "#SINGLE" || sValueName == "#DOUBLE" || sValueName == "#COUPLE" )
|
||||
{
|
||||
Steps s;
|
||||
if( sValueName == "#SINGLE" )
|
||||
s.type = st_single;
|
||||
else if( sValueName == "#DOUBLE" )
|
||||
s.type = st_double;
|
||||
else if( sValueName == "#COUPLE" )
|
||||
s.type = st_couple;
|
||||
else
|
||||
RageError( ssprintf("Unknown game type '%s' in '%s'", sValueName, GetSongFilePath()) );
|
||||
|
||||
s.sDescription = arrayValueTokens[1];
|
||||
s.iDifficulty = atoi( arrayValueTokens[2] );
|
||||
s.sPadDataLeft = arrayValueTokens[3];
|
||||
if( sValueName == "#DOUBLE" || sValueName == "#COUPLE" )
|
||||
s.sPadDataRight = arrayValueTokens[4];
|
||||
|
||||
switch( s.type)
|
||||
{
|
||||
case st_single:
|
||||
arraySingleSteps.Add( s );
|
||||
break;
|
||||
case st_double:
|
||||
arrayDoubleSteps.Add( s );
|
||||
break;
|
||||
case st_couple:
|
||||
arrayCoupleSteps.Add( s );
|
||||
break;
|
||||
}
|
||||
arraySteps.SetSize( arraySteps.GetSize()+1 );
|
||||
Steps &new_steps = arraySteps[ arraySteps.GetSize()-1 ];
|
||||
new_steps.LoadFromDWIValueTokens( arrayValueTokens );
|
||||
}
|
||||
else
|
||||
// do nothing. We don't care about this value name
|
||||
;
|
||||
}
|
||||
|
||||
FillEmptyValuesWithDefaults();
|
||||
*/
|
||||
TidyUpData();
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+68
-22
@@ -42,6 +42,8 @@ void Sprite::Init()
|
||||
m_fSpinSpeed = 2.0f ;
|
||||
m_fVibrationDistance = 5.0f ;
|
||||
m_bVisibleThisFrame = FALSE;
|
||||
|
||||
m_bHasShadow = true;
|
||||
}
|
||||
|
||||
Sprite::~Sprite()
|
||||
@@ -63,7 +65,7 @@ bool Sprite::LoadFromTexture( CString sTexturePath )
|
||||
// Sprite file has the format:
|
||||
//
|
||||
// [Sprite]
|
||||
// Texture=Textures\Logo 1x1.bmp
|
||||
// Texture=Textures\Logo.bmp
|
||||
// Frame0000=0
|
||||
// Delay0000=1.0
|
||||
// Frame0001=3
|
||||
@@ -301,28 +303,12 @@ void Sprite::Draw()
|
||||
v[2].tu = pTexCoordRect->right; v[2].tv = pTexCoordRect->bottom; // bottom right
|
||||
v[3].tu = pTexCoordRect->right; v[3].tv = pTexCoordRect->top; // top right
|
||||
|
||||
v[0].color = colorDiffuse[2]; // bottom left
|
||||
v[1].color = colorDiffuse[0]; // top left
|
||||
v[2].color = colorDiffuse[3]; // bottom right
|
||||
v[3].color = colorDiffuse[1]; // top right
|
||||
|
||||
pVB->Unlock();
|
||||
|
||||
|
||||
//////////////////////
|
||||
// render the diffuse pass
|
||||
//////////////////////
|
||||
|
||||
// set texture and alpha properties
|
||||
// LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice();
|
||||
// Set the stage...
|
||||
pd3dDevice->SetTexture( 0, m_pTexture->GetD3DTexture() );
|
||||
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );//bBlendAdd ? D3DTOP_ADD : D3DTOP_MODULATE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );//bBlendAdd ? D3DTOP_ADD : D3DTOP_MODULATE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR );
|
||||
//pd3dDevice->SetRenderState( D3DRS_SRCBLEND, bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA );
|
||||
@@ -330,17 +316,76 @@ void Sprite::Draw()
|
||||
pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
|
||||
pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
|
||||
|
||||
|
||||
// finally! Pump those triangles!
|
||||
pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX );
|
||||
pd3dDevice->SetStreamSource( 0, pVB, sizeof(CUSTOMVERTEX) );
|
||||
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
|
||||
|
||||
|
||||
|
||||
//////////////////////
|
||||
// render the shadow
|
||||
//////////////////////
|
||||
if( m_bHasShadow )
|
||||
{
|
||||
D3DXMATRIX matOriginalWorld, matNewWorld, matTemp;
|
||||
pd3dDevice->GetTransform( D3DTS_WORLD, &matOriginalWorld ); // save the original world matrix
|
||||
matNewWorld = matOriginalWorld;
|
||||
|
||||
D3DXMatrixTranslation( &matTemp, 5, 5, 0 ); // shift by 5 units
|
||||
matNewWorld = matTemp * matNewWorld;
|
||||
pd3dDevice->SetTransform( D3DTS_WORLD, &matNewWorld ); // transform to local coordinates
|
||||
|
||||
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
|
||||
|
||||
v[0].color = v[1].color = v[2].color = v[3].color = D3DXCOLOR(0,0,0,0.5f*colorDiffuse[0].a); // semi-transparent black
|
||||
|
||||
pVB->Unlock();
|
||||
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
|
||||
|
||||
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
|
||||
|
||||
pd3dDevice->SetTransform( D3DTS_WORLD, &matOriginalWorld ); // restore the original world matrix
|
||||
|
||||
}
|
||||
|
||||
|
||||
//////////////////////
|
||||
// render the diffuse pass
|
||||
//////////////////////
|
||||
if( colorDiffuse[0].a != 0 )
|
||||
{
|
||||
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
|
||||
|
||||
v[0].color = colorDiffuse[2]; // bottom left
|
||||
v[1].color = colorDiffuse[0]; // top left
|
||||
v[2].color = colorDiffuse[3]; // bottom right
|
||||
v[3].color = colorDiffuse[1]; // top right
|
||||
|
||||
pVB->Unlock();
|
||||
|
||||
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );//bBlendAdd ? D3DTOP_ADD : D3DTOP_MODULATE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
|
||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );//bBlendAdd ? D3DTOP_ADD : D3DTOP_MODULATE );
|
||||
|
||||
|
||||
// finally! Pump those triangles!
|
||||
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
|
||||
}
|
||||
|
||||
|
||||
//////////////////////
|
||||
// render the add pass
|
||||
//////////////////////
|
||||
if( colorAdd.a != 0 ) // no need to render an add pass
|
||||
if( colorAdd.a != 0 )
|
||||
{
|
||||
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
|
||||
|
||||
@@ -357,6 +402,7 @@ void Sprite::Draw()
|
||||
|
||||
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ public:
|
||||
|
||||
void SetCustomSrcRect( FRECT new_texcoord_frect ); // for cropping
|
||||
|
||||
void TurnShadowOn() { m_bHasShadow = true; };
|
||||
void TurnShadowOff() { m_bHasShadow = false; };
|
||||
|
||||
|
||||
protected:
|
||||
@@ -65,6 +67,8 @@ protected:
|
||||
|
||||
bool m_bUsingCustomTexCoordRect;
|
||||
FRECT m_CustomTexCoordRect;
|
||||
|
||||
bool m_bHasShadow;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -54,8 +54,6 @@ END
|
||||
|
||||
IDR_MAIN_ACCEL ACCELERATORS DISCARDABLE
|
||||
BEGIN
|
||||
"P", IDM_PADS, VIRTKEY, CONTROL, NOINVERT
|
||||
VK_ESCAPE, IDM_WINDOWED, VIRTKEY, NOINVERT
|
||||
VK_F4, IDM_TOGGLEFULLSCREEN, VIRTKEY, NOINVERT
|
||||
VK_RETURN, IDM_TOGGLEFULLSCREEN, VIRTKEY, ALT, NOINVERT
|
||||
"X", IDM_EXIT, VIRTKEY, ALT, NOINVERT
|
||||
|
||||
@@ -75,6 +75,8 @@ 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 WeAreAlone( LPSTR szName );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: WinMain()
|
||||
@@ -82,6 +84,11 @@ VOID DestroyObjects(); // deallocate game objects when we're done with them
|
||||
//-----------------------------------------------------------------------------
|
||||
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
|
||||
{
|
||||
if( !WeAreAlone("StepMania") )
|
||||
{
|
||||
RageError( "StepMania is already running!" );
|
||||
}
|
||||
|
||||
if( !DoesFileExist("Songs") )
|
||||
{
|
||||
// change dir to path of the execuctable
|
||||
@@ -420,15 +427,18 @@ void Update()
|
||||
diArray.RemoveAll();
|
||||
INPUT->GetDeviceInputs( diArray );
|
||||
|
||||
DeviceInput di;
|
||||
PadInput pi;
|
||||
DeviceInput DeviceI;
|
||||
PadInput PadI;
|
||||
PlayerInput PlayerI;
|
||||
|
||||
for( int i=0; i<diArray.GetSize(); i++ )
|
||||
{
|
||||
di = diArray[i];
|
||||
if( GAMEINFO->DeviceToPad( di, pi ) )
|
||||
WM->Input( di, &pi ); // this di maps to a pi
|
||||
else
|
||||
WM->Input( di, NULL ); // this di doesn't map to a pi, so pass NULL
|
||||
DeviceI = diArray[i];
|
||||
|
||||
GAMEINFO->DeviceToPad( DeviceI, PadI );
|
||||
GAMEINFO->PadToPlayer( PadI, PlayerI );
|
||||
|
||||
WM->Input( DeviceI, PadI, PlayerI );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -520,10 +530,20 @@ void SetFullscreen( BOOL bFullscreen )
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: TestForDirectX()
|
||||
// Name: WeAreAlone()
|
||||
// Desc: check for DirectX 8
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "getdxver.h"
|
||||
BOOL WeAreAlone (LPSTR szName)
|
||||
{
|
||||
HANDLE hMutex = CreateMutex (NULL, TRUE, szName);
|
||||
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
CloseHandle(hMutex);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -216,6 +216,22 @@ SOURCE=.\WindowManager.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WindowPlayerOptions.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WindowPlayerOptions.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WindowPrompt.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WindowPrompt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WindowResults.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -348,6 +364,14 @@ SOURCE=.\GrayArrow.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\HoldGhostArrow.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\HoldGhostArrow.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PadInput.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -360,6 +384,10 @@ SOURCE=.\Player.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PlayerInput.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PreviewGraphic.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -368,6 +396,14 @@ SOURCE=.\previewgraphic.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Rectangle.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Rectangle.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Song.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -40,8 +40,10 @@ public:
|
||||
virtual void CloseWipingRight(WindowMessage send_when_done = SM_None );
|
||||
virtual void CloseWipingLeft( WindowMessage send_when_done = SM_None );
|
||||
|
||||
bool IsClosed() { return m_TransitionState == closed; };
|
||||
bool IsClosing() { return m_TransitionState == closing_right || m_TransitionState == closing_left; };
|
||||
bool IsOpened() { return m_TransitionState == opened; };
|
||||
bool IsOpening() { return m_TransitionState == opening_right || m_TransitionState == opening_left; };
|
||||
bool IsClosed() { return m_TransitionState == closed; };
|
||||
bool IsClosing() { return m_TransitionState == closing_right || m_TransitionState == closing_left; };
|
||||
|
||||
void SetTransitionTime( FLOAT fNewTransitionTime ) { m_fTransitionTime = fNewTransitionTime; };
|
||||
|
||||
|
||||
@@ -54,9 +54,8 @@ void TransitionFade::Draw()
|
||||
break;
|
||||
}
|
||||
|
||||
m_Color.a = fPercentageOpaque;
|
||||
int alpha = (int)( fPercentageOpaque * 255 );
|
||||
SCREEN->DrawRect( CRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT), m_Color );
|
||||
D3DXCOLOR colorTemp = m_Color * fPercentageOpaque;
|
||||
SCREEN->DrawRect( CRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT), colorTemp );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+10
-26
@@ -19,6 +19,11 @@ class Steps; // why is this needed?
|
||||
enum GameMode; // why is this needed?
|
||||
|
||||
|
||||
struct BPMSegment{
|
||||
BPMSegment() { m_fStartBeat = m_fBPM = m_fFreezeSeconds = 0; };
|
||||
float m_fStartBeat, m_fBPM, m_fFreezeSeconds;
|
||||
};
|
||||
|
||||
|
||||
class Song
|
||||
{
|
||||
@@ -37,7 +42,7 @@ public:
|
||||
|
||||
private:
|
||||
bool LoadSongInfoFromBMSFile( CString sPath );
|
||||
bool LoadSongInfoFromMSDFile( CString sPath );
|
||||
bool LoadSongInfoFromDWIFile( CString sPath );
|
||||
|
||||
void TidyUpData();
|
||||
|
||||
@@ -65,31 +70,11 @@ public:
|
||||
iMinBPM = (int)m_BPMSegments[i].m_fBPM;
|
||||
}
|
||||
};
|
||||
void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut )
|
||||
{
|
||||
fElapsedTime += m_fOffsetInSeconds;
|
||||
|
||||
for( int i=0; i<m_BPMSegments.GetSize(); i++ ) {
|
||||
int iStartBeatThisSegment = m_BPMSegments[i].m_iStartBeat;
|
||||
bool bIsLastBPMSegment = i==m_BPMSegments.GetSize()-1;
|
||||
int iStartBeatNextSegment = bIsLastBPMSegment ? 40000/*inf*/ : m_BPMSegments[i+1].m_iStartBeat;
|
||||
int iBeatsInThisSegment = iStartBeatNextSegment - iStartBeatThisSegment;
|
||||
float fBPM = m_BPMSegments[i].m_fBPM;
|
||||
float fBPS = fBPM / 60.0f;
|
||||
float fSecondsInThisSegment = iBeatsInThisSegment / fBPS;
|
||||
if( fElapsedTime > fSecondsInThisSegment )
|
||||
fElapsedTime -= fSecondsInThisSegment;
|
||||
else {
|
||||
fBeatOut = iStartBeatThisSegment + fElapsedTime*fBPS;
|
||||
fBPSOut = fBPS;
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut );
|
||||
float GetBPMAtBeat( float fSongBeat )
|
||||
{
|
||||
for( int i=0; i<m_BPMSegments.GetSize(); i++ ) {
|
||||
if( m_BPMSegments[i].m_iStartBeat > fSongBeat || i==m_BPMSegments.GetSize()-1 )
|
||||
if( m_BPMSegments[i].m_fStartBeat > fSongBeat || i==m_BPMSegments.GetSize()-1 )
|
||||
break;
|
||||
}
|
||||
return m_BPMSegments[i].m_fBPM;
|
||||
@@ -97,7 +82,7 @@ public:
|
||||
void SetBPM( float fNewBPM, float fSongBeat )
|
||||
{
|
||||
for( int i=0; i<m_BPMSegments.GetSize(); i++ ) {
|
||||
if( m_BPMSegments[i].m_iStartBeat > fSongBeat || i==m_BPMSegments.GetSize()-1 )
|
||||
if( m_BPMSegments[i].m_fStartBeat > fSongBeat || i==m_BPMSegments.GetSize()-1 )
|
||||
break;
|
||||
}
|
||||
m_BPMSegments[i].m_fBPM = fNewBPM;
|
||||
@@ -125,8 +110,7 @@ private:
|
||||
CString m_sBanner;
|
||||
CString m_sBackground;
|
||||
|
||||
struct BPMSegment{ int m_iStartBeat; float m_fBPM; };
|
||||
CArray<BPMSegment, BPMSegment&> m_BPMSegments;
|
||||
CArray<BPMSegment, BPMSegment&> m_BPMSegments; // this must be sorted before dancing
|
||||
|
||||
public:
|
||||
CArray<Steps, Steps&> arraySteps;
|
||||
|
||||
Reference in New Issue
Block a user