changes made from 0.95 through 0.97
This commit is contained in:
@@ -0,0 +1,106 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
File: BPMDisplay.h
|
||||||
|
|
||||||
|
Desc: A graphic displayed in the BPMDisplay during Dancing.
|
||||||
|
|
||||||
|
Copyright (c) 2001 Chris Danford. All rights reserved.
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "BPMDisplay.h"
|
||||||
|
#include "RageUtil.h"
|
||||||
|
#include "ScreenDimensions.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BPMDisplay::BPMDisplay()
|
||||||
|
{
|
||||||
|
m_fCurrentBPM = m_fLowBPM = m_fHighBPM = 0;
|
||||||
|
m_CountingState = holding_down;
|
||||||
|
m_fTimeLeftInState = 0;
|
||||||
|
|
||||||
|
m_rectFrame.SetDiffuseColor( D3DXCOLOR(0,0,0,0.3f) );
|
||||||
|
m_rectFrame.SetZoomX( 120 );
|
||||||
|
m_rectFrame.SetZoomY( 40 );
|
||||||
|
|
||||||
|
m_seqBPM.LoadFromSequenceFile( "SpriteSequences\\LED Numbers.seq" );
|
||||||
|
m_seqBPM.SetXY( CENTER_X, SCREEN_HEIGHT - 50 );
|
||||||
|
//m_seqBPM.SetSequence( ssprintf("999") );
|
||||||
|
m_seqBPM.SetXY( -30, 0 );
|
||||||
|
m_seqBPM.SetZoom( 0.7f );
|
||||||
|
m_seqBPM.SetDiffuseColorTopEdge( D3DXCOLOR(1,1,0,1) ); // yellow
|
||||||
|
m_seqBPM.SetDiffuseColorBottomEdge( D3DXCOLOR(1,0.5f,0,1) ); // orange
|
||||||
|
|
||||||
|
m_textLabel.LoadFromFontName( "Black Wolf" );
|
||||||
|
m_textLabel.SetXY( 54, 10 );
|
||||||
|
m_textLabel.SetText( "BPM" );
|
||||||
|
m_textLabel.SetDiffuseColorTopEdge( D3DXCOLOR(1,1,0,1) ); // yellow
|
||||||
|
m_textLabel.SetDiffuseColorBottomEdge( D3DXCOLOR(1,0.5f,0,1) ); // orange
|
||||||
|
|
||||||
|
//this->AddActor( &m_rectFrame );
|
||||||
|
this->AddActor( &m_seqBPM );
|
||||||
|
this->AddActor( &m_textLabel );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BPMDisplay::Update( float fDeltaTime )
|
||||||
|
{
|
||||||
|
ActorFrame::Update( fDeltaTime );
|
||||||
|
|
||||||
|
m_fTimeLeftInState -= fDeltaTime;
|
||||||
|
if( m_fTimeLeftInState < 0 )
|
||||||
|
{
|
||||||
|
// go to next state
|
||||||
|
switch( m_CountingState )
|
||||||
|
{
|
||||||
|
case counting_up: m_CountingState = holding_up; break;
|
||||||
|
case holding_up: m_CountingState = counting_down; break;
|
||||||
|
case counting_down: m_CountingState = holding_down; break;
|
||||||
|
case holding_down: m_CountingState = counting_up; break;
|
||||||
|
}
|
||||||
|
m_fTimeLeftInState = 1; // reset timer
|
||||||
|
}
|
||||||
|
|
||||||
|
switch( m_CountingState )
|
||||||
|
{
|
||||||
|
case counting_down: m_fCurrentBPM = m_fLowBPM + (m_fHighBPM-m_fLowBPM)*m_fTimeLeftInState; break;
|
||||||
|
case counting_up: m_fCurrentBPM = m_fHighBPM + (m_fLowBPM-m_fHighBPM)*m_fTimeLeftInState; break;
|
||||||
|
case holding_up: m_fCurrentBPM = m_fHighBPM; break;
|
||||||
|
case holding_down: m_fCurrentBPM = m_fLowBPM; break;
|
||||||
|
}
|
||||||
|
m_seqBPM.SetSequence( ssprintf("%03.0f", m_fCurrentBPM) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BPMDisplay::SetBPMRange( float fLowBPM, float fHighBPM )
|
||||||
|
{
|
||||||
|
m_fLowBPM = fLowBPM;
|
||||||
|
m_fHighBPM = fHighBPM;
|
||||||
|
if( m_fCurrentBPM > m_fHighBPM )
|
||||||
|
m_CountingState = counting_down;
|
||||||
|
else
|
||||||
|
m_CountingState = counting_up;
|
||||||
|
m_fTimeLeftInState = 1;
|
||||||
|
|
||||||
|
if( m_fLowBPM != m_fHighBPM )
|
||||||
|
{
|
||||||
|
m_seqBPM.BeginTweening(0.5f);
|
||||||
|
m_seqBPM.SetTweenDiffuseColorTopEdge( D3DXCOLOR(1,0,0,1) ); // red
|
||||||
|
m_seqBPM.SetTweenDiffuseColorBottomEdge( D3DXCOLOR(0.6f,0,0,1) ); // dark red
|
||||||
|
m_textLabel.BeginTweening(0.5f);
|
||||||
|
m_textLabel.SetTweenDiffuseColorTopEdge( D3DXCOLOR(1,0,0,1) ); // red
|
||||||
|
m_textLabel.SetTweenDiffuseColorBottomEdge( D3DXCOLOR(0.6f,0,0,1) ); // dark red
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_seqBPM.BeginTweening(0.5f);
|
||||||
|
m_seqBPM.SetTweenDiffuseColorTopEdge( D3DXCOLOR(1,1,0,1) ); // yellow
|
||||||
|
m_seqBPM.SetTweenDiffuseColorBottomEdge( D3DXCOLOR(1,0.5f,0,1) ); // orange
|
||||||
|
m_textLabel.BeginTweening(0.5f);
|
||||||
|
m_textLabel.SetTweenDiffuseColorTopEdge( D3DXCOLOR(1,1,0,1) ); // yellow
|
||||||
|
m_textLabel.SetTweenDiffuseColorBottomEdge( D3DXCOLOR(1,0.5f,0,1) ); // orange
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
File: BPMDisplay.h
|
||||||
|
|
||||||
|
Desc: A graphic displayed in the BPMDisplay during Dancing.
|
||||||
|
|
||||||
|
Copyright (c) 2001 Chris Danford. All rights reserved.
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _BPMDisplay_H_
|
||||||
|
#define _BPMDisplay_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include "Sprite.h"
|
||||||
|
#include "Song.h"
|
||||||
|
#include "ActorFrame.h"
|
||||||
|
#include "SpriteSequence.h"
|
||||||
|
#include "BitmapText.h"
|
||||||
|
#include "Rectangle.h"
|
||||||
|
|
||||||
|
|
||||||
|
class BPMDisplay : public ActorFrame
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BPMDisplay();
|
||||||
|
void Update( float fDeltaTime );
|
||||||
|
void SetBPMRange( float fLowBPM, float fHighBPM );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SpriteSequence m_seqBPM;
|
||||||
|
BitmapText m_textLabel;
|
||||||
|
RectangleActor m_rectFrame;
|
||||||
|
|
||||||
|
float m_fCurrentBPM;
|
||||||
|
float m_fLowBPM, m_fHighBPM;
|
||||||
|
enum CountingState{ counting_up, holding_up, counting_down, holding_down };
|
||||||
|
CountingState m_CountingState;
|
||||||
|
float m_fTimeLeftInState;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -18,10 +18,30 @@ const CString sVisDir = "Visualizations\\";
|
|||||||
|
|
||||||
void Background::LoadFromSong( Song& song )
|
void Background::LoadFromSong( Song& song )
|
||||||
{
|
{
|
||||||
Sprite::LoadFromTexture( song.GetBackgroundPath() );
|
CString sBGTexturePath = song.GetBackgroundPath();
|
||||||
Sprite::StretchTo( CRect(0,0,640,480) );
|
sBGTexturePath.MakeLower();
|
||||||
Sprite::SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
|
|
||||||
|
|
||||||
|
bool bIsAMovieBackground = ( sBGTexturePath.Right(3) == "avi" ||
|
||||||
|
sBGTexturePath.Right(3) == "mpg" ||
|
||||||
|
sBGTexturePath.Right(3) == "mpeg" );
|
||||||
|
|
||||||
|
if( bIsAMovieBackground )
|
||||||
|
{
|
||||||
|
Sprite::LoadFromTexture( sBGTexturePath );
|
||||||
|
Sprite::StretchTo( CRect(0,480,640,0) ); // flip
|
||||||
|
Sprite::SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,0.8f,1) );
|
||||||
|
|
||||||
|
// don't load m_sprVis
|
||||||
|
}
|
||||||
|
else // !bIsAMovieBackground
|
||||||
|
{
|
||||||
|
Sprite::LoadFromTexture( sBGTexturePath );
|
||||||
|
Sprite::StretchTo( CRect(0,0,640,480) );
|
||||||
|
Sprite::SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,0.8f,1) );
|
||||||
|
|
||||||
|
if( GAMEINFO->m_GameOptions.m_bRandomVis )
|
||||||
|
{
|
||||||
|
// load a random visualization
|
||||||
CStringArray sVisualizationPaths;
|
CStringArray sVisualizationPaths;
|
||||||
GetDirListing( sVisDir + "*.*", sVisualizationPaths );
|
GetDirListing( sVisDir + "*.*", sVisualizationPaths );
|
||||||
if( sVisualizationPaths.GetSize() > 0 ) // there is at least one visualization
|
if( sVisualizationPaths.GetSize() > 0 ) // there is at least one visualization
|
||||||
@@ -29,11 +49,14 @@ void Background::LoadFromSong( Song& song )
|
|||||||
int iIndexRandom = rand() % sVisualizationPaths.GetSize();
|
int iIndexRandom = rand() % sVisualizationPaths.GetSize();
|
||||||
|
|
||||||
m_sprVis.LoadFromTexture( sVisDir + sVisualizationPaths[iIndexRandom] );
|
m_sprVis.LoadFromTexture( sVisDir + sVisualizationPaths[iIndexRandom] );
|
||||||
m_sprVis.StretchTo( CRect(0,0,640,480) );
|
m_sprVis.StretchTo( CRect(0,480,640,0) ); // flip
|
||||||
// m_sprVis.SetBlendMode( TRUE );
|
m_sprVis.SetBlendModeAdd();
|
||||||
//m_sprVis.SetColor( D3DXCOLOR(1,1,1,0.5f) );
|
//m_sprVis.SetColor( D3DXCOLOR(1,1,1,0.5f) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Background::Update( float fDeltaTime)
|
void Background::Update( float fDeltaTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,19 +14,44 @@
|
|||||||
#include "Banner.h"
|
#include "Banner.h"
|
||||||
|
|
||||||
|
|
||||||
|
const CString TEXTURE_FALLBACK_BANNER = "Textures\\Fallback Banner.png";
|
||||||
|
|
||||||
|
|
||||||
bool Banner::LoadFromSong( Song &song )
|
bool Banner::LoadFromSong( Song &song )
|
||||||
{
|
{
|
||||||
|
if( song.HasBanner() )
|
||||||
Sprite::LoadFromTexture( song.GetBannerPath() );
|
Sprite::LoadFromTexture( song.GetBannerPath() );
|
||||||
|
else if( song.HasBackground() && !song.BackgroundIsAMovie() )
|
||||||
|
Sprite::LoadFromTexture( song.GetBackgroundPath() );
|
||||||
|
else
|
||||||
|
Sprite::LoadFromTexture( TEXTURE_FALLBACK_BANNER );
|
||||||
//Sprite::TurnShadowOff();
|
//Sprite::TurnShadowOff();
|
||||||
|
|
||||||
float fSourceWidth = (float)m_pTexture->GetSourceWidth();
|
int iSourceWidth = m_pTexture->GetSourceWidth();
|
||||||
float fSourceHeight = (float)m_pTexture->GetSourceHeight();
|
int iSourceHeight = m_pTexture->GetSourceHeight();
|
||||||
|
|
||||||
|
|
||||||
|
if( iSourceWidth == iSourceHeight ) // this is a SSR/DWI style banner
|
||||||
|
{
|
||||||
|
float fCustomTexCoords[8] = {
|
||||||
|
0.22f, 0.98f, // bottom left
|
||||||
|
0.02f, 0.78f, // top left
|
||||||
|
0.98f, 0.22f, // bottom right
|
||||||
|
0.78f, 0.02f, // top right
|
||||||
|
};
|
||||||
|
Sprite::SetCustomTexCoords( fCustomTexCoords );
|
||||||
|
|
||||||
|
SetWidth( BANNER_WIDTH );
|
||||||
|
SetHeight( BANNER_HEIGHT );
|
||||||
|
|
||||||
|
}
|
||||||
|
else // this is a normal sized banner
|
||||||
|
{
|
||||||
|
|
||||||
// first find the correct zoom
|
// first find the correct zoom
|
||||||
Sprite::ScaleToCover( CRect(0, 0,
|
Sprite::ScaleToCover( CRect(0, 0,
|
||||||
BANNER_WIDTH,
|
(int)BANNER_WIDTH,
|
||||||
BANNER_HEIGHT )
|
(int)BANNER_HEIGHT )
|
||||||
);
|
);
|
||||||
float fFinalZoom = this->GetZoom();
|
float fFinalZoom = this->GetZoom();
|
||||||
|
|
||||||
@@ -60,7 +85,7 @@ bool Banner::LoadFromSong( Song &song )
|
|||||||
SetWidth( BANNER_WIDTH );
|
SetWidth( BANNER_WIDTH );
|
||||||
SetHeight( BANNER_HEIGHT );
|
SetHeight( BANNER_HEIGHT );
|
||||||
SetZoom( 1 );
|
SetZoom( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,14 +57,32 @@ bool BitmapText::LoadCharWidths( CString sWidthFilePath )
|
|||||||
|
|
||||||
// get a rectangle for the text, considering a possible text scaling.
|
// get a rectangle for the text, considering a possible text scaling.
|
||||||
// useful to know if some text is visible or not
|
// useful to know if some text is visible or not
|
||||||
float BitmapText::GetWidthInSourcePixels()
|
float BitmapText::GetWidestLineWidthInSourcePixels()
|
||||||
{
|
{
|
||||||
float fTextWidth = 0;
|
float fWidestLineWidth = 0;
|
||||||
|
|
||||||
for( int i=0; i<m_sText.GetLength(); i++ )
|
for( int i=0; i<m_sTextLines.GetSize(); i++ )
|
||||||
fTextWidth += m_fCharWidthsInSourcePixels[ m_sText[i] ];
|
{
|
||||||
|
float fLineWidth = GetLineWidthInSourcePixels(i);
|
||||||
|
|
||||||
return fTextWidth;
|
if( fLineWidth > fWidestLineWidth )
|
||||||
|
fWidestLineWidth = fLineWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fWidestLineWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float BitmapText::GetLineWidthInSourcePixels( int iLineNo )
|
||||||
|
{
|
||||||
|
CString &sText = m_sTextLines[iLineNo];
|
||||||
|
|
||||||
|
float fLineWidth = 0;
|
||||||
|
|
||||||
|
for( int j=0; j<sText.GetLength(); j++ )
|
||||||
|
fLineWidth += m_fCharWidthsInSourcePixels[ sText[j] ];
|
||||||
|
|
||||||
|
return fLineWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -72,35 +90,32 @@ float BitmapText::GetWidthInSourcePixels()
|
|||||||
// draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale
|
// draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale
|
||||||
void BitmapText::Draw()
|
void BitmapText::Draw()
|
||||||
{
|
{
|
||||||
// some basic properties of the text
|
if( m_sTextLines.GetSize() == 0 )
|
||||||
float fTextWidthInSourcePixels = GetWidthInSourcePixels();
|
return;
|
||||||
float fTextWidth = fTextWidthInSourcePixels* GetZoom();
|
|
||||||
float fFrameWidth = GetZoomedWidth();
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
if( m_bHasShadow )
|
|
||||||
{
|
|
||||||
// do a pass for the shadow
|
|
||||||
|
|
||||||
|
// save the properties now so we can restore them at the end
|
||||||
float fOriginalX = GetX();
|
float fOriginalX = GetX();
|
||||||
float fOriginalY = GetY();
|
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;
|
|
||||||
|
|
||||||
|
float fHeight = Sprite::GetZoomedHeight();
|
||||||
|
|
||||||
|
for( int i=0; i<m_sTextLines.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
CString &sText = m_sTextLines[i];
|
||||||
|
float fY = fOriginalY + fHeight * i - (m_sTextLines.GetSize()-1) * fHeight / 2;
|
||||||
|
float fLineWidth = GetLineWidthInSourcePixels(i) * GetZoomX();
|
||||||
|
|
||||||
|
float fX = fOriginalX - (fLineWidth/2);
|
||||||
|
|
||||||
SetY( fY );
|
SetY( fY );
|
||||||
SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); // transparent
|
|
||||||
SetAddColor( D3DXCOLOR(0,0,0,0.5f) ); // semi-transparent black
|
|
||||||
|
|
||||||
|
for( int j=0; j<sText.GetLength(); j++ )
|
||||||
for( i=0; i<m_sText.GetLength(); i++ ) {
|
{
|
||||||
char c = m_sText[i];
|
char c = sText[j];
|
||||||
float fCharWidthZoomed = m_fCharWidthsInSourcePixels[c] * GetZoom();
|
float fCharWidthZoomed = m_fCharWidthsInSourcePixels[c] * GetZoomX();
|
||||||
SetState( c );
|
SetState( c );
|
||||||
fX += fCharWidthZoomed/2;
|
fX += fCharWidthZoomed/2;
|
||||||
SetX( fX );
|
SetX( fX );
|
||||||
@@ -108,32 +123,21 @@ void BitmapText::Draw()
|
|||||||
fX += fCharWidthZoomed/2;
|
fX += fCharWidthZoomed/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set properties back to original
|
}
|
||||||
|
|
||||||
|
// reset properties to what they were before this function
|
||||||
SetX( fOriginalX );
|
SetX( fOriginalX );
|
||||||
SetY( fOriginalY );
|
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);
|
|
||||||
|
|
||||||
|
|
||||||
for( int 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
|
void BitmapText::SetText( CString sText )
|
||||||
SetX( fCenterX );
|
{
|
||||||
|
m_sTextLines.RemoveAll();
|
||||||
|
split( sText, "\n", m_sTextLines, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
CString BitmapText::GetText()
|
||||||
|
{
|
||||||
|
return join( "\n", m_sTextLines );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,19 +27,15 @@ public:
|
|||||||
BitmapText();
|
BitmapText();
|
||||||
|
|
||||||
bool LoadFromFontName( CString sFontName );
|
bool LoadFromFontName( CString sFontName );
|
||||||
void SetText( CString sText ) { m_sText = sText; };
|
void SetText( CString sText );
|
||||||
CString GetText() { return m_sText; };
|
CString GetText();
|
||||||
|
|
||||||
bool LoadFontWidths( CString sFilePath );
|
bool LoadFontWidths( CString sFilePath );
|
||||||
//float GetWidthZoomed();
|
|
||||||
|
|
||||||
// void SetTopColor( D3DXCOLOR new_color ) { m_colorTop = new_color; };
|
|
||||||
// void SetBottomColor( D3DXCOLOR new_color ) { m_colorBottom = new_color; };
|
|
||||||
// void SetColor( D3DXCOLOR new_color ) { SetTopColor(new_color); SetBottomColor(new_color); };
|
|
||||||
|
|
||||||
void Draw();
|
void Draw();
|
||||||
|
|
||||||
float GetWidthInSourcePixels(); // in logical, pre-scaled units
|
float GetWidestLineWidthInSourcePixels(); // in logical, pre-zoomed units
|
||||||
|
float GetLineWidthInSourcePixels( int iLineNo );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool LoadCharWidths( CString sWidthFilePath );
|
bool LoadCharWidths( CString sWidthFilePath );
|
||||||
@@ -47,10 +43,8 @@ protected:
|
|||||||
CString m_sFontName;
|
CString m_sFontName;
|
||||||
float m_fCharWidthsInSourcePixels[NUM_CHARS]; // in soure coordinate space
|
float m_fCharWidthsInSourcePixels[NUM_CHARS]; // in soure coordinate space
|
||||||
|
|
||||||
CString m_sText; // the string that the font is displaying
|
CStringArray m_sTextLines;
|
||||||
// D3DXCOLOR m_colorTop;
|
//CArray<float,float> m_fLineWidths;
|
||||||
// D3DXCOLOR m_colorBottom;
|
|
||||||
// bool m_bHasShadow;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include "GhostArrow.h"
|
#include "GhostArrow.h"
|
||||||
|
|
||||||
|
|
||||||
const CString GHOST_ARROW_SPRITE = "Sprites\\Ghost Arrow.sprite";
|
const CString GHOST_ARROW_TEXTURE = "Textures\\Gray Arrow 1x2.png";
|
||||||
const float GRAY_ARROW_TWEEN_TIME = 0.5f;
|
const float GRAY_ARROW_TWEEN_TIME = 0.5f;
|
||||||
|
|
||||||
|
|
||||||
@@ -17,8 +17,10 @@ const float GRAY_ARROW_TWEEN_TIME = 0.5f;
|
|||||||
|
|
||||||
GhostArrow::GhostArrow()
|
GhostArrow::GhostArrow()
|
||||||
{
|
{
|
||||||
LoadFromSpriteFile( GHOST_ARROW_SPRITE );
|
LoadFromTexture( GHOST_ARROW_TEXTURE );
|
||||||
|
SetState( 1 );
|
||||||
SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||||
|
TurnShadowOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GhostArrow::SetBeat( const float fSongBeat )
|
void GhostArrow::SetBeat( const float fSongBeat )
|
||||||
@@ -30,16 +32,15 @@ void GhostArrow::Step( StepScore score )
|
|||||||
{
|
{
|
||||||
switch( score )
|
switch( score )
|
||||||
{
|
{
|
||||||
case perfect: SetDiffuseColor( D3DXCOLOR(1.0f,1.0f,0.3f,1.0f) ); break; // yellow
|
case perfect: SetDiffuseColor( D3DXCOLOR(1.0f,1.0f,0.3f,0.7f) ); break; // yellow
|
||||||
case great: SetDiffuseColor( D3DXCOLOR(0.0f,1.0f,0.4f,1.0f) ); break; // green
|
case great: SetDiffuseColor( D3DXCOLOR(0.0f,1.0f,0.4f,0.7f) ); break; // green
|
||||||
case good: SetDiffuseColor( D3DXCOLOR(0.3f,0.8f,1.0f,1.0f) ); break;
|
case good: SetDiffuseColor( D3DXCOLOR(0.3f,0.8f,1.0f,0.7f) ); break;
|
||||||
case boo: SetDiffuseColor( D3DXCOLOR(0.8f,0.0f,0.6f,1.0f) ); break;
|
case boo: SetDiffuseColor( D3DXCOLOR(0.8f,0.0f,0.6f,0.7f) ); break;
|
||||||
case miss: ASSERT(true); break;
|
case miss: ASSERT(true); break;
|
||||||
}
|
}
|
||||||
SetState( 0 );
|
SetZoom( 1.0f );
|
||||||
SetZoom( 1.2f );
|
|
||||||
BeginTweening( 0.3f );
|
BeginTweening( 0.3f );
|
||||||
SetTweenZoom( 2.5f );
|
SetTweenZoom( 1.5f );
|
||||||
D3DXCOLOR colorTween = GetDiffuseColor();
|
D3DXCOLOR colorTween = GetDiffuseColor();
|
||||||
colorTween.a = 0;
|
colorTween.a = 0;
|
||||||
SetTweenDiffuseColor( colorTween );
|
SetTweenDiffuseColor( colorTween );
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
//
|
||||||
|
// GhostArrowBright.cpp: implementation of the GhostArrowBright class.
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "GhostArrowBright.h"
|
||||||
|
|
||||||
|
|
||||||
|
const CString GHOST_ARROW_SPRITE = "Sprites\\Ghost Arrow.sprite";
|
||||||
|
const float GRAY_ARROW_TWEEN_TIME = 0.5f;
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Construction/Destruction
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GhostArrowBright::GhostArrowBright()
|
||||||
|
{
|
||||||
|
LoadFromSpriteFile( GHOST_ARROW_SPRITE );
|
||||||
|
SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||||
|
TurnShadowOff();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GhostArrowBright::SetBeat( const float fSongBeat )
|
||||||
|
{
|
||||||
|
//SetState( fmod(fSongBeat,1)<0.25 ? 1 : 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void GhostArrowBright::Step( StepScore score )
|
||||||
|
{
|
||||||
|
switch( score )
|
||||||
|
{
|
||||||
|
case perfect: SetDiffuseColor( D3DXCOLOR(1.0f,1.0f,0.3f,0.9f) ); break; // yellow
|
||||||
|
case great: SetDiffuseColor( D3DXCOLOR(0.0f,1.0f,0.4f,0.9f) ); break; // green
|
||||||
|
case good: SetDiffuseColor( D3DXCOLOR(0.3f,0.8f,1.0f,0.9f) ); break;
|
||||||
|
case boo: SetDiffuseColor( D3DXCOLOR(0.8f,0.0f,0.6f,0.9f) ); break;
|
||||||
|
case miss: ASSERT(true); break;
|
||||||
|
}
|
||||||
|
SetState( 0 );
|
||||||
|
SetZoom( 1.2f );
|
||||||
|
BeginTweening( 0.3f );
|
||||||
|
SetTweenZoom( 2.5f );
|
||||||
|
D3DXCOLOR colorTween = GetDiffuseColor();
|
||||||
|
colorTween.a = 0;
|
||||||
|
SetTweenDiffuseColor( colorTween );
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
File: GhostArrowBright.h
|
||||||
|
|
||||||
|
Desc: Class used to represent a color arrow on the screen.
|
||||||
|
|
||||||
|
Copyright (c) 2001 Ben Norstrom. All rights reserved.
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class GhostArrowBright;
|
||||||
|
|
||||||
|
#ifndef _GhostArrowBright_H_
|
||||||
|
#define _GhostArrowBright_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include "Sprite.h"
|
||||||
|
#include "Steps.h"
|
||||||
|
|
||||||
|
|
||||||
|
class GhostArrowBright : public Sprite
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GhostArrowBright();
|
||||||
|
|
||||||
|
void SetBeat( const float fSongBeat );
|
||||||
|
void Step( StepScore score );
|
||||||
|
|
||||||
|
float m_fVisibilityCountdown;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
+177
-44
@@ -178,6 +178,7 @@ Player::Player( PlayerOptions po, PlayerNumber pn )
|
|||||||
for( int c=0; c < MAX_NUM_COLUMNS; c++ ) {
|
for( int c=0; c < MAX_NUM_COLUMNS; c++ ) {
|
||||||
m_GrayArrow[c].SetRotation( m_ColumnToRotation[c] );
|
m_GrayArrow[c].SetRotation( m_ColumnToRotation[c] );
|
||||||
m_GhostArrow[c].SetRotation( m_ColumnToRotation[c] );
|
m_GhostArrow[c].SetRotation( m_ColumnToRotation[c] );
|
||||||
|
m_GhostArrowBright[c].SetRotation( m_ColumnToRotation[c] );
|
||||||
m_HoldGhostArrow[c].SetRotation( m_ColumnToRotation[c] );
|
m_HoldGhostArrow[c].SetRotation( m_ColumnToRotation[c] );
|
||||||
m_ColorArrow[c].SetRotation( m_ColumnToRotation[c] );
|
m_ColorArrow[c].SetRotation( m_ColumnToRotation[c] );
|
||||||
}
|
}
|
||||||
@@ -229,8 +230,12 @@ Player::Player( PlayerOptions po, PlayerNumber pn )
|
|||||||
m_ScoreNumber.SetSequence( " " );
|
m_ScoreNumber.SetSequence( " " );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SetX( CENTER_X );
|
SetX( CENTER_X );
|
||||||
|
|
||||||
|
|
||||||
|
// assist
|
||||||
|
m_soundAssistTick.AddSound( "Sounds\\Assist Tick.wav" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -417,6 +422,7 @@ void Player::SetSteps( const Steps& newSteps, bool bLoadOnlyLeftSide, bool bLoad
|
|||||||
{
|
{
|
||||||
HoldStep &oldHoldStep = tempHoldSteps[i];
|
HoldStep &oldHoldStep = tempHoldSteps[i];
|
||||||
HoldStep newHoldStep = oldHoldStep;
|
HoldStep newHoldStep = oldHoldStep;
|
||||||
|
newHoldStep.m_Step = STEP_NONE;
|
||||||
|
|
||||||
for( int j=0; j<12; j++ )
|
for( int j=0; j<12; j++ )
|
||||||
{
|
{
|
||||||
@@ -425,9 +431,24 @@ void Player::SetSteps( const Steps& newSteps, bool bLoadOnlyLeftSide, bool bLoad
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_HoldSteps.Add( newHoldStep );
|
m_HoldSteps.Add( newHoldStep );
|
||||||
m_HoldStepScores.Add( HOLD_SCORE_NONE );
|
m_HoldStepScores.Add( HoldStepScore() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// filter out all non-quarter notes if little is enabled
|
||||||
|
if( m_PlayerOptions.m_bLittle )
|
||||||
|
{
|
||||||
|
for( i=0; i<MAX_STEP_ELEMENTS; i++ )
|
||||||
|
{
|
||||||
|
if( i%ELEMENTS_PER_BEAT != 0 )
|
||||||
|
{
|
||||||
|
m_OriginalStep[i] = STEP_NONE;
|
||||||
|
m_LeftToStepOn[i] = STEP_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// leave HoldSteps unchanged
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference )
|
void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference )
|
||||||
@@ -441,8 +462,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
|
|||||||
if( iNumMisses > 0 )
|
if( iNumMisses > 0 )
|
||||||
{
|
{
|
||||||
SetJudgement( miss );
|
SetJudgement( miss );
|
||||||
m_iCurCombo = 0;
|
EndCombo();
|
||||||
SetCombo( 0 );
|
|
||||||
for( int i=0; i<iNumMisses; i++ )
|
for( int i=0; i<iNumMisses; i++ )
|
||||||
ChangeLife( miss );
|
ChangeLife( miss );
|
||||||
}
|
}
|
||||||
@@ -455,8 +475,8 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
|
|||||||
float fStartBeat = StepIndexToBeat( hs.m_iStartIndex );
|
float fStartBeat = StepIndexToBeat( hs.m_iStartIndex );
|
||||||
float fEndBeat = StepIndexToBeat( hs.m_iEndIndex );
|
float fEndBeat = StepIndexToBeat( hs.m_iEndIndex );
|
||||||
|
|
||||||
// update the "electric arrow"
|
// update the "electric ghost arrow"
|
||||||
if( m_HoldStepScores[i] == HOLD_STEPPED_ON && // this hold doesn't already have a score
|
if( m_HoldStepScores[i].m_HoldScore == HoldStepScore::HOLD_STEPPED_ON && // this hold doesn't already have a score
|
||||||
fStartBeat < m_fSongBeat && m_fSongBeat < fEndBeat ) // if the song beat is in the range of this hold
|
fStartBeat < m_fSongBeat && m_fSongBeat < fEndBeat ) // if the song beat is in the range of this hold
|
||||||
{
|
{
|
||||||
PlayerInput PlayerI = { m_PlayerNumber, hs.m_Step };
|
PlayerInput PlayerI = { m_PlayerNumber, hs.m_Step };
|
||||||
@@ -468,15 +488,15 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update the logic
|
// update the logic
|
||||||
if( (m_HoldStepScores[i] == HOLD_SCORE_NONE || m_HoldStepScores[i] == HOLD_STEPPED_ON) && // this hold doesn't already have a score
|
if( (m_HoldStepScores[i].m_HoldScore == HoldStepScore::HOLD_SCORE_NONE || m_HoldStepScores[i].m_HoldScore == HoldStepScore::HOLD_STEPPED_ON) && // this hold doesn't already have a score
|
||||||
fStartBeat+fMaxBeatDifference/2 < m_fSongBeat && m_fSongBeat < fEndBeat-fMaxBeatDifference/2 ) // if the song beat is in the range of this hold
|
fStartBeat+fMaxBeatDifference/2 < m_fSongBeat && m_fSongBeat < fEndBeat-fMaxBeatDifference/2 ) // if the song beat is in the range of this hold
|
||||||
{
|
{
|
||||||
PlayerInput PlayerI = { m_PlayerNumber, hs.m_Step };
|
PlayerInput PlayerI = { m_PlayerNumber, hs.m_Step };
|
||||||
if( !GAMEINFO->IsButtonDown( PlayerI ) ) // they're not holding the button down
|
if( !GAMEINFO->IsButtonDown( PlayerI ) ) // they're not holding the button down
|
||||||
{
|
{
|
||||||
m_HoldStepScores[i] = HOLD_SCORE_NG;
|
m_HoldStepScores[i].m_HoldScore = HoldStepScore::HOLD_SCORE_NG;
|
||||||
int iCol = m_StepToColumnNumber[ hs.m_Step ];
|
int iCol = m_StepToColumnNumber[ hs.m_Step ];
|
||||||
SetHoldJudgement( iCol, HOLD_SCORE_NG );
|
SetHoldJudgement( iCol, HoldStepScore::HOLD_SCORE_NG );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -488,11 +508,11 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
|
|||||||
float fEndBeat = StepIndexToBeat( hs.m_iEndIndex );
|
float fEndBeat = StepIndexToBeat( hs.m_iEndIndex );
|
||||||
|
|
||||||
if( m_fSongBeat > fEndBeat && // if this hold step is in the past
|
if( m_fSongBeat > fEndBeat && // if this hold step is in the past
|
||||||
m_HoldStepScores[i] == HOLD_STEPPED_ON ) // and it doesn't yet have a score
|
m_HoldStepScores[i].m_HoldScore == HoldStepScore::HOLD_STEPPED_ON ) // and it doesn't yet have a score
|
||||||
{
|
{
|
||||||
m_HoldStepScores[i] = HOLD_SCORE_OK;
|
m_HoldStepScores[i].m_HoldScore = HoldStepScore::HOLD_SCORE_OK;
|
||||||
int iCol = m_StepToColumnNumber[ hs.m_Step ];
|
int iCol = m_StepToColumnNumber[ hs.m_Step ];
|
||||||
SetHoldJudgement( iCol, HOLD_SCORE_OK );
|
SetHoldJudgement( iCol, HoldStepScore::HOLD_SCORE_OK );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,6 +529,29 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
|
|||||||
m_frameJudgementAndCombo.Update( fDeltaTime );
|
m_frameJudgementAndCombo.Update( fDeltaTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::CrossedIndex( int iIndex )
|
||||||
|
{
|
||||||
|
if( GAMEINFO->m_SongOptions.m_AssistType == SongOptions::ASSIST_TICK )
|
||||||
|
{
|
||||||
|
bool bThereIsANoteThisIndex = false;
|
||||||
|
|
||||||
|
bThereIsANoteThisIndex |= (m_OriginalStep[iIndex] != STEP_NONE);
|
||||||
|
|
||||||
|
for( int i=0; i<m_HoldSteps.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
if( m_HoldSteps[i].m_iStartIndex == iIndex )
|
||||||
|
{
|
||||||
|
bThereIsANoteThisIndex |= true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( bThereIsANoteThisIndex )
|
||||||
|
m_soundAssistTick.PlayRandom();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Player::Draw()
|
void Player::Draw()
|
||||||
{
|
{
|
||||||
DrawGrayArrows();
|
DrawGrayArrows();
|
||||||
@@ -537,15 +580,58 @@ void Player::HandlePlayerStep( float fSongBeat, Step player_step, float fMaxBeat
|
|||||||
int iCurrentIndex = BeatToStepIndex( fSongBeat );
|
int iCurrentIndex = BeatToStepIndex( fSongBeat );
|
||||||
for( int i=0; i<m_HoldSteps.GetSize(); i++ ) // for each HoldStep
|
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
|
if( m_HoldStepScores[i].m_HoldScore == HoldStepScore::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
|
player_step == m_HoldSteps[i].m_Step ) // player steps is the same note as the hold
|
||||||
{
|
{
|
||||||
HoldStep &hs = m_HoldSteps[i];
|
HoldStep &hs = m_HoldSteps[i];
|
||||||
int iIndexDifference = abs( hs.m_iStartIndex - iCurrentIndex );
|
int iIndexDifference = abs( hs.m_iStartIndex - iCurrentIndex );
|
||||||
int iMaxIndexDiff = BeatToStepIndex( fMaxBeatDiff );
|
int iMaxIndexDiff = BeatToStepIndex( fMaxBeatDiff );
|
||||||
|
|
||||||
if( iIndexDifference <= iMaxIndexDiff )
|
if( iIndexDifference <= iMaxIndexDiff )
|
||||||
m_HoldStepScores[i] = HOLD_STEPPED_ON;
|
{
|
||||||
|
m_HoldStepScores[i].m_HoldScore = HoldStepScore::HOLD_STEPPED_ON;
|
||||||
|
|
||||||
|
float fBeatsUntilStep = StepIndexToBeat(hs.m_iStartIndex) - fSongBeat;
|
||||||
|
float fPercentFromPerfect = (float)fabs( fBeatsUntilStep / fMaxBeatDiff );
|
||||||
|
|
||||||
|
//RageLog( "fBeatsUntilStep: %f, fPercentFromPerfect: %f",
|
||||||
|
// fBeatsUntilStep, fPercentFromPerfect );
|
||||||
|
|
||||||
|
// compute what the score should be for the note we stepped on
|
||||||
|
StepScore &stepscore = m_HoldStepScores[i].m_StepScore;
|
||||||
|
|
||||||
|
if( fPercentFromPerfect < 0.25f ) stepscore = perfect;
|
||||||
|
else if( fPercentFromPerfect < 0.50f ) stepscore = great;
|
||||||
|
else if( fPercentFromPerfect < 0.75f ) stepscore = good;
|
||||||
|
else stepscore = boo;
|
||||||
|
|
||||||
|
// update the judgement, score, and life
|
||||||
|
SetJudgement( stepscore );
|
||||||
|
ChangeScore( stepscore, m_iCurCombo );
|
||||||
|
ChangeLife( stepscore );
|
||||||
|
|
||||||
|
// show the gray arrow ghost
|
||||||
|
for( int c=0; c < m_iNumColumns; c++ ) // for each arrow column
|
||||||
|
{
|
||||||
|
if( m_HoldSteps[i].m_Step & m_ColumnNumberToStep[c] ) // this column matches the step
|
||||||
|
GhostArrowStep( c, stepscore );
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the combo display
|
||||||
|
switch( stepscore )
|
||||||
|
{
|
||||||
|
case perfect:
|
||||||
|
case great:
|
||||||
|
ContinueCombo();
|
||||||
|
break;
|
||||||
|
case good:
|
||||||
|
case boo:
|
||||||
|
EndCombo();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -636,11 +722,11 @@ void Player::OnCompleteStep( float fSongBeat, Step player_step, float fMaxBeatDi
|
|||||||
{
|
{
|
||||||
case perfect:
|
case perfect:
|
||||||
case great:
|
case great:
|
||||||
SetCombo( m_iCurCombo+1 ); // combo continuing
|
ContinueCombo();
|
||||||
break;
|
break;
|
||||||
case good:
|
case good:
|
||||||
case boo:
|
case boo:
|
||||||
SetCombo( 0 ); // combo stopped
|
EndCombo();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -689,6 +775,23 @@ ScoreSummary Player::GetScoreSummary()
|
|||||||
case none: break;
|
case none: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for( i=0; i<m_HoldStepScores.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
switch( m_HoldStepScores[i].m_StepScore )
|
||||||
|
{
|
||||||
|
case perfect: scoreSummary.perfect++; break;
|
||||||
|
case great: scoreSummary.great++; break;
|
||||||
|
case good: scoreSummary.good++; break;
|
||||||
|
case boo: scoreSummary.boo++; break;
|
||||||
|
case miss: scoreSummary.miss++; break;
|
||||||
|
case none: break;
|
||||||
|
}
|
||||||
|
switch( m_HoldStepScores[i].m_HoldScore )
|
||||||
|
{
|
||||||
|
case HoldStepScore::HOLD_SCORE_NG: scoreSummary.ng++; break;
|
||||||
|
case HoldStepScore::HOLD_SCORE_OK: scoreSummary.ok++; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
scoreSummary.max_combo = m_iMaxCombo;
|
scoreSummary.max_combo = m_iMaxCombo;
|
||||||
scoreSummary.score = m_fScore;
|
scoreSummary.score = m_fScore;
|
||||||
|
|
||||||
@@ -713,6 +816,7 @@ void Player::UpdateGhostArrows( float fDeltaTime )
|
|||||||
{
|
{
|
||||||
for( int i=0; i < m_iNumColumns; i++ ) {
|
for( int i=0; i < m_iNumColumns; i++ ) {
|
||||||
m_GhostArrow[i].Update( fDeltaTime );
|
m_GhostArrow[i].Update( fDeltaTime );
|
||||||
|
m_GhostArrowBright[i].Update( fDeltaTime );
|
||||||
m_HoldGhostArrow[i].Update( fDeltaTime );
|
m_HoldGhostArrow[i].Update( fDeltaTime );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -732,6 +836,8 @@ void Player::DrawGhostArrows()
|
|||||||
{
|
{
|
||||||
m_GhostArrow[i].SetBeat( m_fSongBeat );
|
m_GhostArrow[i].SetBeat( m_fSongBeat );
|
||||||
m_GhostArrow[i].Draw();
|
m_GhostArrow[i].Draw();
|
||||||
|
m_GhostArrowBright[i].SetBeat( m_fSongBeat );
|
||||||
|
m_GhostArrowBright[i].Draw();
|
||||||
m_HoldGhostArrow[i].SetBeat( m_fSongBeat );
|
m_HoldGhostArrow[i].SetBeat( m_fSongBeat );
|
||||||
m_HoldGhostArrow[i].Draw();
|
m_HoldGhostArrow[i].Draw();
|
||||||
}
|
}
|
||||||
@@ -754,6 +860,7 @@ void Player::SetGhostArrowsX( int iNewX )
|
|||||||
float fY = GetGrayArrowYPos();
|
float fY = GetGrayArrowYPos();
|
||||||
if( m_PlayerOptions.m_bReverseScroll ) fY = SCREEN_HEIGHT - fY;
|
if( m_PlayerOptions.m_bReverseScroll ) fY = SCREEN_HEIGHT - fY;
|
||||||
m_GhostArrow[i].SetXY( GetArrowColumnX(i), fY );
|
m_GhostArrow[i].SetXY( GetArrowColumnX(i), fY );
|
||||||
|
m_GhostArrowBright[i].SetXY( GetArrowColumnX(i), fY );
|
||||||
m_HoldGhostArrow[i].SetXY( GetArrowColumnX(i), fY );
|
m_HoldGhostArrow[i].SetXY( GetArrowColumnX(i), fY );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -771,6 +878,9 @@ void Player::GrayArrowStep( int index, StepScore score )
|
|||||||
|
|
||||||
void Player::GhostArrowStep( int index, StepScore score )
|
void Player::GhostArrowStep( int index, StepScore score )
|
||||||
{
|
{
|
||||||
|
if( m_iCurCombo >= 100 )
|
||||||
|
m_GhostArrowBright[index].Step( score );
|
||||||
|
else
|
||||||
m_GhostArrow[index].Step( score );
|
m_GhostArrow[index].Step( score );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -839,6 +949,7 @@ void Player::DrawColorArrows()
|
|||||||
{
|
{
|
||||||
HoldStep &hs = m_HoldSteps[i];
|
HoldStep &hs = m_HoldSteps[i];
|
||||||
|
|
||||||
|
// check if this entire hold step is on the screen
|
||||||
if( !( iIndexFirstArrowToDraw <= hs.m_iEndIndex && hs.m_iEndIndex <= iIndexLastArrowToDraw ||
|
if( !( iIndexFirstArrowToDraw <= hs.m_iEndIndex && hs.m_iEndIndex <= iIndexLastArrowToDraw ||
|
||||||
iIndexFirstArrowToDraw <= hs.m_iStartIndex && hs.m_iStartIndex <= iIndexLastArrowToDraw ||
|
iIndexFirstArrowToDraw <= hs.m_iStartIndex && hs.m_iStartIndex <= iIndexLastArrowToDraw ||
|
||||||
hs.m_iStartIndex < iIndexFirstArrowToDraw && hs.m_iEndIndex > iIndexLastArrowToDraw ) )
|
hs.m_iStartIndex < iIndexFirstArrowToDraw && hs.m_iEndIndex > iIndexLastArrowToDraw ) )
|
||||||
@@ -846,19 +957,19 @@ void Player::DrawColorArrows()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
HoldStepScore &score = m_HoldStepScores[i];
|
HoldStepScore::HoldScore &score = m_HoldStepScores[i].m_HoldScore;
|
||||||
|
|
||||||
int iColNum = m_StepToColumnNumber[ hs.m_Step ];
|
int iColNum = m_StepToColumnNumber[ hs.m_Step ];
|
||||||
|
|
||||||
switch( score )
|
switch( score )
|
||||||
{
|
{
|
||||||
case HOLD_SCORE_OK:
|
case HoldStepScore::HOLD_SCORE_OK:
|
||||||
continue; // don't draw
|
continue; // don't draw
|
||||||
case HOLD_SCORE_NONE:
|
case HoldStepScore::HOLD_SCORE_NONE:
|
||||||
case HOLD_SCORE_NG:
|
case HoldStepScore::HOLD_SCORE_NG:
|
||||||
m_ColorArrow[iColNum].SetGrayPartClear();
|
m_ColorArrow[iColNum].SetGrayPartClear();
|
||||||
break;
|
break;
|
||||||
case HOLD_STEPPED_ON:
|
case HoldStepScore::HOLD_STEPPED_ON:
|
||||||
m_ColorArrow[iColNum].SetGrayPartFull();
|
m_ColorArrow[iColNum].SetGrayPartFull();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -866,14 +977,22 @@ void Player::DrawColorArrows()
|
|||||||
// draw the gray parts
|
// draw the gray parts
|
||||||
for( int j=hs.m_iEndIndex; j>=hs.m_iStartIndex; j-- ) // for each arrow in this freeze
|
for( int j=hs.m_iEndIndex; j>=hs.m_iStartIndex; j-- ) // for each arrow in this freeze
|
||||||
{
|
{
|
||||||
|
// check if this hold step is off the the screen
|
||||||
|
if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j)
|
||||||
|
continue; // skip this arrow
|
||||||
|
|
||||||
|
|
||||||
float fYOffset = GetColorArrowYOffset( j, m_fSongBeat );
|
float fYOffset = GetColorArrowYOffset( j, m_fSongBeat );
|
||||||
float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset );
|
|
||||||
|
|
||||||
float fYPos = GetColorArrowYPos( j, m_fSongBeat );
|
float fYPos = GetColorArrowYPos( j, m_fSongBeat );
|
||||||
if( score == HOLD_STEPPED_ON || score == HOLD_SCORE_OK )
|
if( score == HoldStepScore::HOLD_STEPPED_ON || score == HoldStepScore::HOLD_SCORE_OK )
|
||||||
fYPos = max( fYPos, GetGrayArrowYPos() );
|
{
|
||||||
|
if( fYPos < GetGrayArrowYPos() )
|
||||||
|
continue; // don't draw
|
||||||
|
}
|
||||||
if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos;
|
if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos;
|
||||||
m_ColorArrow[iColNum].SetY( fYPos );
|
m_ColorArrow[iColNum].SetY( fYPos );
|
||||||
|
float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset );
|
||||||
m_ColorArrow[iColNum].SetAlpha( fAlpha );
|
m_ColorArrow[iColNum].SetAlpha( fAlpha );
|
||||||
m_ColorArrow[iColNum].DrawGrayPart();
|
m_ColorArrow[iColNum].DrawGrayPart();
|
||||||
}
|
}
|
||||||
@@ -881,17 +1000,24 @@ void Player::DrawColorArrows()
|
|||||||
// draw the color parts
|
// draw the color parts
|
||||||
for( j=hs.m_iEndIndex; j>=hs.m_iStartIndex; j-- ) // for each arrow in this freeze
|
for( j=hs.m_iEndIndex; j>=hs.m_iStartIndex; j-- ) // for each arrow in this freeze
|
||||||
{
|
{
|
||||||
|
// check if this hold step is off the the screen
|
||||||
|
if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j)
|
||||||
|
continue; // skip this arrow
|
||||||
|
|
||||||
float fYOffset = GetColorArrowYOffset( j, m_fSongBeat );
|
float fYOffset = GetColorArrowYOffset( j, m_fSongBeat );
|
||||||
float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset );
|
|
||||||
|
|
||||||
float fYPos = GetColorArrowYPos( j, m_fSongBeat );
|
float fYPos = GetColorArrowYPos( j, m_fSongBeat );
|
||||||
m_ColorArrow[iColNum].SetY( fYPos );
|
m_ColorArrow[iColNum].SetY( fYPos );
|
||||||
if( score == HOLD_STEPPED_ON || score == HOLD_SCORE_OK )
|
if( score == HoldStepScore::HOLD_STEPPED_ON || score == HoldStepScore::HOLD_SCORE_OK )
|
||||||
fYPos = max( fYPos, GetGrayArrowYPos() );
|
{
|
||||||
|
if( fYPos < GetGrayArrowYPos() )
|
||||||
|
continue; // don't draw
|
||||||
|
}
|
||||||
if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos;
|
if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos;
|
||||||
m_ColorArrow[iColNum].SetY( fYPos );
|
m_ColorArrow[iColNum].SetY( fYPos );
|
||||||
D3DXCOLOR color( (float)(j-hs.m_iStartIndex)/(float)(hs.m_iEndIndex-hs.m_iStartIndex), 1, 0, 1 ); // color shifts from green to yellow
|
D3DXCOLOR color( (float)(j-hs.m_iStartIndex)/(float)(hs.m_iEndIndex-hs.m_iStartIndex), 1, 0, 1 ); // color shifts from green to yellow
|
||||||
m_ColorArrow[iColNum].SetDiffuseColor( color );
|
m_ColorArrow[iColNum].SetDiffuseColor( color );
|
||||||
|
float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset );
|
||||||
m_ColorArrow[iColNum].SetAlpha( fAlpha );
|
m_ColorArrow[iColNum].SetAlpha( fAlpha );
|
||||||
m_ColorArrow[iColNum].DrawColorPart();
|
m_ColorArrow[iColNum].DrawColorPart();
|
||||||
}
|
}
|
||||||
@@ -900,15 +1026,15 @@ void Player::DrawColorArrows()
|
|||||||
j = hs.m_iStartIndex;
|
j = hs.m_iStartIndex;
|
||||||
|
|
||||||
float fYOffset = GetColorArrowYOffset( j, m_fSongBeat );
|
float fYOffset = GetColorArrowYOffset( j, m_fSongBeat );
|
||||||
float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset );
|
|
||||||
float fYPos = GetColorArrowYPos( j, m_fSongBeat );
|
float fYPos = GetColorArrowYPos( j, m_fSongBeat );
|
||||||
if( score == HOLD_STEPPED_ON || score == HOLD_SCORE_OK )
|
if( score == HoldStepScore::HOLD_STEPPED_ON || score == HoldStepScore::HOLD_SCORE_OK )
|
||||||
fYPos = max( fYPos, GetGrayArrowYPos() );
|
fYPos = max( fYPos, GetGrayArrowYPos() );
|
||||||
if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos;
|
if( m_PlayerOptions.m_bReverseScroll ) fYPos = SCREEN_HEIGHT - fYPos;
|
||||||
m_ColorArrow[iColNum].SetY( fYPos );
|
m_ColorArrow[iColNum].SetY( fYPos );
|
||||||
m_ColorArrow[iColNum].SetIndexAndBeat( i, m_fSongBeat );
|
m_ColorArrow[iColNum].SetIndexAndBeat( i, m_fSongBeat );
|
||||||
D3DXCOLOR color( 0, 1, 0, 1 ); // color shifts from green to yellow
|
D3DXCOLOR color( 0, 1, 0, 1 ); // color shifts from green to yellow
|
||||||
m_ColorArrow[iColNum].SetDiffuseColor( color );
|
m_ColorArrow[iColNum].SetDiffuseColor( color );
|
||||||
|
float fAlpha = GetColorArrowAlphaFromYOffset( fYOffset );
|
||||||
m_ColorArrow[iColNum].SetAlpha( fAlpha );
|
m_ColorArrow[iColNum].SetAlpha( fAlpha );
|
||||||
m_ColorArrow[iColNum].Draw();
|
m_ColorArrow[iColNum].Draw();
|
||||||
|
|
||||||
@@ -988,7 +1114,6 @@ float Player::GetGrayArrowYPos()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Player::SetJudgementX( int iNewX )
|
void Player::SetJudgementX( int iNewX )
|
||||||
{
|
{
|
||||||
// the frame will do this for us
|
// the frame will do this for us
|
||||||
@@ -1075,20 +1200,20 @@ void Player::SetJudgement( StepScore score )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::SetHoldJudgement( int iCol, HoldStepScore score )
|
void Player::SetHoldJudgement( int iCol, HoldStepScore::HoldScore score )
|
||||||
{
|
{
|
||||||
//RageLog( "Judgement::SetJudgement()" );
|
//RageLog( "Judgement::SetJudgement()" );
|
||||||
|
|
||||||
switch( score )
|
switch( score )
|
||||||
{
|
{
|
||||||
case HOLD_SCORE_NONE: m_sprHoldJudgement[iCol].SetState( 0 ); break; // freeze!
|
case HoldStepScore::HOLD_SCORE_NONE: m_sprHoldJudgement[iCol].SetState( 0 ); break; // freeze!
|
||||||
case HOLD_SCORE_OK: m_sprHoldJudgement[iCol].SetState( 7 ); break;
|
case HoldStepScore::HOLD_SCORE_OK: m_sprHoldJudgement[iCol].SetState( 7 ); break;
|
||||||
case HOLD_SCORE_NG: m_sprHoldJudgement[iCol].SetState( 8 ); break;
|
case HoldStepScore::HOLD_SCORE_NG: m_sprHoldJudgement[iCol].SetState( 8 ); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fHoldJudgementDisplayCountdown[iCol] = JUDGEMENT_DISPLAY_TIME;
|
m_fHoldJudgementDisplayCountdown[iCol] = JUDGEMENT_DISPLAY_TIME;
|
||||||
|
|
||||||
if( score == HOLD_SCORE_NG ) { // falling down
|
if( score == HoldStepScore::HOLD_SCORE_NG ) { // falling down
|
||||||
float fY = HOLD_JUDGEMENT_Y;
|
float fY = HOLD_JUDGEMENT_Y;
|
||||||
if( m_PlayerOptions.m_bReverseScroll ) fY = SCREEN_HEIGHT - fY;
|
if( m_PlayerOptions.m_bReverseScroll ) fY = SCREEN_HEIGHT - fY;
|
||||||
m_sprHoldJudgement[iCol].SetY( fY - 10 );
|
m_sprHoldJudgement[iCol].SetY( fY - 10 );
|
||||||
@@ -1133,15 +1258,15 @@ void Player::DrawCombo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Player::SetCombo( int iNewCombo )
|
void Player::ContinueCombo()
|
||||||
{
|
{
|
||||||
|
m_iCurCombo++;
|
||||||
|
|
||||||
// new max combo
|
// new max combo
|
||||||
if( iNewCombo > m_iMaxCombo )
|
if( m_iCurCombo > m_iMaxCombo )
|
||||||
m_iMaxCombo = iNewCombo;
|
m_iMaxCombo = m_iCurCombo;
|
||||||
|
|
||||||
m_iCurCombo = iNewCombo;
|
if( m_iCurCombo <= 4 )
|
||||||
|
|
||||||
if( iNewCombo <= 4 )
|
|
||||||
{
|
{
|
||||||
m_ComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
|
m_ComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
|
||||||
m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
|
m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
|
||||||
@@ -1151,8 +1276,8 @@ void Player::SetCombo( int iNewCombo )
|
|||||||
m_ComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // visible
|
m_ComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // visible
|
||||||
m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // visible
|
m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // visible
|
||||||
|
|
||||||
m_ComboNumber.SetSequence( ssprintf("%d", iNewCombo) );
|
m_ComboNumber.SetSequence( ssprintf("%d", m_iCurCombo) );
|
||||||
float fNewZoom = 0.5f + iNewCombo/800.0f;
|
float fNewZoom = 0.5f + m_iCurCombo/800.0f;
|
||||||
m_ComboNumber.SetZoom( fNewZoom );
|
m_ComboNumber.SetZoom( fNewZoom );
|
||||||
m_ComboNumber.SetX( -40 - (fNewZoom-1)*30 );
|
m_ComboNumber.SetX( -40 - (fNewZoom-1)*30 );
|
||||||
m_ComboNumber.SetY( m_PlayerOptions.m_bReverseScroll ? -JUDGEMENT_Y_OFFSET : JUDGEMENT_Y_OFFSET );
|
m_ComboNumber.SetY( m_PlayerOptions.m_bReverseScroll ? -JUDGEMENT_Y_OFFSET : JUDGEMENT_Y_OFFSET );
|
||||||
@@ -1160,6 +1285,14 @@ void Player::SetCombo( int iNewCombo )
|
|||||||
//m_ComboNumber.BeginTweening( COMBO_TWEEN_TIME );
|
//m_ComboNumber.BeginTweening( COMBO_TWEEN_TIME );
|
||||||
//m_ComboNumber.SetTweenZoom( 1 );
|
//m_ComboNumber.SetTweenZoom( 1 );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::EndCombo()
|
||||||
|
{
|
||||||
|
m_iCurCombo = 0;
|
||||||
|
|
||||||
|
m_ComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
|
||||||
|
m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-2
@@ -20,9 +20,11 @@
|
|||||||
#include "ColorArrow.h"
|
#include "ColorArrow.h"
|
||||||
#include "GrayArrow.h"
|
#include "GrayArrow.h"
|
||||||
#include "GhostArrow.h"
|
#include "GhostArrow.h"
|
||||||
|
#include "GhostArrowBright.h"
|
||||||
#include "HoldGhostArrow.h"
|
#include "HoldGhostArrow.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ActorFrame.h"
|
#include "ActorFrame.h"
|
||||||
|
#include "SoundSet.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -38,6 +40,7 @@ public:
|
|||||||
void SetSteps( const Steps& newSteps, bool bLoadOnlyLeftSide = false, bool bLoadOnlyRightSide = false );
|
void SetSteps( const Steps& newSteps, bool bLoadOnlyLeftSide = false, bool bLoadOnlyRightSide = false );
|
||||||
void SetX( float fX );
|
void SetX( float fX );
|
||||||
void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference );
|
void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference );
|
||||||
|
void CrossedIndex( int iIndex );
|
||||||
void Draw();
|
void Draw();
|
||||||
|
|
||||||
|
|
||||||
@@ -97,6 +100,7 @@ protected:
|
|||||||
void DrawGhostArrows();
|
void DrawGhostArrows();
|
||||||
void GhostArrowStep( int iCol, StepScore score );
|
void GhostArrowStep( int iCol, StepScore score );
|
||||||
GhostArrow m_GhostArrow[MAX_NUM_COLUMNS];
|
GhostArrow m_GhostArrow[MAX_NUM_COLUMNS];
|
||||||
|
GhostArrowBright m_GhostArrowBright[MAX_NUM_COLUMNS];
|
||||||
HoldGhostArrow m_HoldGhostArrow[MAX_NUM_COLUMNS];
|
HoldGhostArrow m_HoldGhostArrow[MAX_NUM_COLUMNS];
|
||||||
|
|
||||||
// holder for judgement and combo displays
|
// holder for judgement and combo displays
|
||||||
@@ -110,7 +114,7 @@ protected:
|
|||||||
float m_fJudgementDisplayCountdown;
|
float m_fJudgementDisplayCountdown;
|
||||||
Sprite m_sprJudgement;
|
Sprite m_sprJudgement;
|
||||||
|
|
||||||
void SetHoldJudgement( int iCol, HoldStepScore score );
|
void SetHoldJudgement( int iCol, HoldStepScore::HoldScore score );
|
||||||
float m_fHoldJudgementDisplayCountdown[MAX_NUM_COLUMNS];
|
float m_fHoldJudgementDisplayCountdown[MAX_NUM_COLUMNS];
|
||||||
Sprite m_sprHoldJudgement[MAX_NUM_COLUMNS];
|
Sprite m_sprHoldJudgement[MAX_NUM_COLUMNS];
|
||||||
|
|
||||||
@@ -118,7 +122,8 @@ protected:
|
|||||||
void SetComboX( int iX );
|
void SetComboX( int iX );
|
||||||
void UpdateCombo( float fDeltaTime );
|
void UpdateCombo( float fDeltaTime );
|
||||||
void DrawCombo();
|
void DrawCombo();
|
||||||
void SetCombo( int iNum );
|
void ContinueCombo();
|
||||||
|
void EndCombo();
|
||||||
bool m_bComboVisible;
|
bool m_bComboVisible;
|
||||||
Sprite m_sprCombo;
|
Sprite m_sprCombo;
|
||||||
SpriteSequence m_ComboNumber;
|
SpriteSequence m_ComboNumber;
|
||||||
@@ -144,6 +149,9 @@ private:
|
|||||||
Sprite m_sprScoreFrame;
|
Sprite m_sprScoreFrame;
|
||||||
SpriteSequence m_ScoreNumber;
|
SpriteSequence m_ScoreNumber;
|
||||||
|
|
||||||
|
// assist
|
||||||
|
SoundSet m_soundAssistTick;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,18 @@ CString DeviceInput::GetDescription()
|
|||||||
case JOY_10: sReturn += "10"; break;
|
case JOY_10: sReturn += "10"; break;
|
||||||
case JOY_11: sReturn += "11"; break;
|
case JOY_11: sReturn += "11"; break;
|
||||||
case JOY_12: sReturn += "12"; break;
|
case JOY_12: sReturn += "12"; break;
|
||||||
|
case JOY_13: sReturn += "13"; break;
|
||||||
|
case JOY_14: sReturn += "14"; break;
|
||||||
|
case JOY_15: sReturn += "15"; break;
|
||||||
|
case JOY_16: sReturn += "16"; break;
|
||||||
|
case JOY_17: sReturn += "17"; break;
|
||||||
|
case JOY_18: sReturn += "18"; break;
|
||||||
|
case JOY_19: sReturn += "19"; break;
|
||||||
|
case JOY_20: sReturn += "20"; break;
|
||||||
|
case JOY_21: sReturn += "21"; break;
|
||||||
|
case JOY_22: sReturn += "22"; break;
|
||||||
|
case JOY_23: sReturn += "23"; break;
|
||||||
|
case JOY_24: sReturn += "24"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -185,6 +197,9 @@ CString DeviceInput::GetDescription()
|
|||||||
|
|
||||||
CString DeviceInput::toString()
|
CString DeviceInput::toString()
|
||||||
{
|
{
|
||||||
|
if( device == DEVICE_NONE )
|
||||||
|
return "";
|
||||||
|
else
|
||||||
return ssprintf("%d-%d", device, button );
|
return ssprintf("%d-%d", device, button );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,7 +607,7 @@ HRESULT RageInput::GetDeviceInputs( DeviceInputArray &listDeviceInputs )
|
|||||||
listDeviceInputs.Add( DeviceInput(InputDevice(DEVICE_JOYSTICK1+i), JOY_DOWN) );
|
listDeviceInputs.Add( DeviceInput(InputDevice(DEVICE_JOYSTICK1+i), JOY_DOWN) );
|
||||||
|
|
||||||
|
|
||||||
for( BYTE b=0; b<10; b++ )
|
for( BYTE b=0; b<NUM_JOYSTICK_BUTTONS; b++ )
|
||||||
{
|
{
|
||||||
if( IS_PRESSED(m_joyState[i].rgbButtons[b]) && !IS_PRESSED(m_oldJoyState[i].rgbButtons[b]) )
|
if( IS_PRESSED(m_joyState[i].rgbButtons[b]) && !IS_PRESSED(m_oldJoyState[i].rgbButtons[b]) )
|
||||||
listDeviceInputs.Add( DeviceInput( InputDevice(DEVICE_JOYSTICK1+i), JOY_1+b ) );
|
listDeviceInputs.Add( DeviceInput( InputDevice(DEVICE_JOYSTICK1+i), JOY_1+b ) );
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
#include <dinput.h>
|
#include <dinput.h>
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
|
|
||||||
|
|
||||||
const int NUM_KEYBOARD_BUTTONS = 256;
|
const int NUM_KEYBOARD_BUTTONS = 256;
|
||||||
|
|
||||||
const int NUM_JOYSTICKS = 4;
|
const int NUM_JOYSTICKS = 4;
|
||||||
|
|
||||||
enum InputDevice {
|
enum InputDevice {
|
||||||
@@ -51,9 +51,23 @@ enum JoystickButton {
|
|||||||
JOY_10,
|
JOY_10,
|
||||||
JOY_11,
|
JOY_11,
|
||||||
JOY_12,
|
JOY_12,
|
||||||
|
JOY_13,
|
||||||
|
JOY_14,
|
||||||
|
JOY_15,
|
||||||
|
JOY_16,
|
||||||
|
JOY_17,
|
||||||
|
JOY_18,
|
||||||
|
JOY_19,
|
||||||
|
JOY_20,
|
||||||
|
JOY_21,
|
||||||
|
JOY_22,
|
||||||
|
JOY_23,
|
||||||
|
JOY_24,
|
||||||
NUM_JOYSTICK_BUTTONS // leave this at the end
|
NUM_JOYSTICK_BUTTONS // leave this at the end
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const int NUM_DEVICE_BUTTONS = max( NUM_KEYBOARD_BUTTONS, NUM_JOYSTICK_BUTTONS );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct DeviceInput
|
struct DeviceInput
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ CTextureRenderer::CTextureRenderer( LPUNKNOWN pUnk, HRESULT *phr )
|
|||||||
{
|
{
|
||||||
// Store and ARageef the texture for our use.
|
// Store and ARageef the texture for our use.
|
||||||
m_pTexture = NULL;
|
m_pTexture = NULL;
|
||||||
m_bLocked = FALSE;
|
m_bLocked[0] = m_bLocked[1] = FALSE;
|
||||||
*phr = S_OK;
|
*phr = S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample )
|
|||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bLocked = TRUE;
|
m_bLocked[m_pTexture->m_iIndexActiveTexture] = TRUE;
|
||||||
|
|
||||||
// Get the texture buffer & pitch
|
// Get the texture buffer & pitch
|
||||||
pTxtBuffer = static_cast<byte *>(d3dlr.pBits);
|
pTxtBuffer = static_cast<byte *>(d3dlr.pBits);
|
||||||
@@ -222,7 +222,7 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample )
|
|||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bLocked = FALSE;
|
m_bLocked[m_pTexture->m_iIndexActiveTexture] = FALSE;
|
||||||
|
|
||||||
|
|
||||||
// flip active texture
|
// flip active texture
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public:
|
|||||||
LONG GetVidWidth() {return m_lVidWidth;};
|
LONG GetVidWidth() {return m_lVidWidth;};
|
||||||
LONG GetVidHeight(){return m_lVidHeight;};
|
LONG GetVidHeight(){return m_lVidHeight;};
|
||||||
HRESULT SetRenderTarget( RageMovieTexture* pTexture );
|
HRESULT SetRenderTarget( RageMovieTexture* pTexture );
|
||||||
BOOL IsLocked() { return m_bLocked; };
|
BOOL IsLocked(int iIndex) { return m_bLocked[iIndex]; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LONG m_lVidWidth; // Video width
|
LONG m_lVidWidth; // Video width
|
||||||
@@ -62,7 +62,7 @@ protected:
|
|||||||
|
|
||||||
RageMovieTexture* 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
|
D3DFORMAT m_TextureFormat; // Texture format
|
||||||
BOOL m_bLocked; // Is the texture currently locked while we
|
BOOL m_bLocked[2]; // Is the texture currently locked while we
|
||||||
// copy the movie frame to it?
|
// copy the movie frame to it?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ RageSound::RageSound( HWND hWnd )
|
|||||||
The most likely cause of this problem is that you do not have a sound card\n\
|
The most likely cause of this problem is that you do not have a sound card\n\
|
||||||
installed, or that you have not yet installed a driver for your sound card.\n\
|
installed, or that you have not yet installed a driver for your sound card.\n\
|
||||||
Before running this program again, please verify that your sound card is\n\
|
Before running this program again, please verify that your sound card is\n\
|
||||||
is working in other Windows applications.", "Error - Need updated video driver", MB_ICONSTOP );
|
is working in other Windows applications.", "Sound error", MB_ICONSTOP );
|
||||||
RageError( "BASS can't initialize sound device." );
|
RageError( "BASS can't initialize sound device." );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,6 +59,7 @@ HSAMPLE RageSound::LoadSample( const CString sFileName )
|
|||||||
if( hSample == NULL )
|
if( hSample == NULL )
|
||||||
RageError( ssprintf("RageSound::LoadSound: error loading %s (error code %d)",
|
RageError( ssprintf("RageSound::LoadSound: error loading %s (error code %d)",
|
||||||
sFileName, BASS_ErrorGetCode()) );
|
sFileName, BASS_ErrorGetCode()) );
|
||||||
|
|
||||||
return hSample;
|
return hSample;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,8 +70,12 @@ void RageSound::UnloadSample( HSAMPLE hSample )
|
|||||||
|
|
||||||
void RageSound::PlaySample( HSAMPLE hSample )
|
void RageSound::PlaySample( HSAMPLE hSample )
|
||||||
{
|
{
|
||||||
if( FALSE == BASS_SamplePlay( hSample ) )
|
HCHANNEL hChannel = BASS_SamplePlay( hSample );
|
||||||
|
if( hChannel == NULL )
|
||||||
RageError( "There was an error playing a sound sample. Are you sure this is a valid HSAMPLE?" );
|
RageError( "There was an error playing a sound sample. Are you sure this is a valid HSAMPLE?" );
|
||||||
|
|
||||||
|
DWORD dwPosition = BASS_ChannelGetPosition( hChannel );
|
||||||
|
RageLog( "First BASS_ChannelGetPosition: %d", dwPosition );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSound::StopSample( HSAMPLE hSample )
|
void RageSound::StopSample( HSAMPLE hSample )
|
||||||
@@ -87,6 +92,7 @@ float RageSound::GetSampleLength( HSAMPLE hSample )
|
|||||||
float RageSound::GetSamplePosition( HSAMPLE hSample )
|
float RageSound::GetSamplePosition( HSAMPLE hSample )
|
||||||
{
|
{
|
||||||
DWORD dwPosition = BASS_ChannelGetPosition( hSample );
|
DWORD dwPosition = BASS_ChannelGetPosition( hSample );
|
||||||
|
RageLog( "BASS_ChannelGetPosition: %d", dwPosition );
|
||||||
float fSeconds = BASS_ChannelBytes2Seconds( hSample, dwPosition );
|
float fSeconds = BASS_ChannelBytes2Seconds( hSample, dwPosition );
|
||||||
// fSeconds += 0.05f; // fudge number. Should use a BASS_SYNC to sync the music.
|
// fSeconds += 0.05f; // fudge number. Should use a BASS_SYNC to sync the music.
|
||||||
return fSeconds;
|
return fSeconds;
|
||||||
|
|||||||
@@ -78,6 +78,42 @@ void RageTexture::CreateFrameRects()
|
|||||||
#include "string.h"
|
#include "string.h"
|
||||||
void RageTexture::GetFrameDimensionsFromFileName( CString sPath, UINT* puFramesWide, UINT* puFramesHigh ) const
|
void RageTexture::GetFrameDimensionsFromFileName( CString sPath, UINT* puFramesWide, UINT* puFramesHigh ) const
|
||||||
{
|
{
|
||||||
|
*puFramesWide = *puFramesHigh = 1; // initialize in case we don't find dimensions in the file name
|
||||||
|
|
||||||
|
sPath.MakeLower();
|
||||||
|
if( sPath.Find("max300.png") != -1 )
|
||||||
|
int kljds = 3;
|
||||||
|
|
||||||
|
CString sDir, sFName, sExt;
|
||||||
|
splitrelpath( sPath, sDir, sFName, sExt);
|
||||||
|
|
||||||
|
CStringArray sFileNameBits;
|
||||||
|
split( sFName, " ", sFileNameBits, false );
|
||||||
|
|
||||||
|
if( sFileNameBits.GetSize() < 2 )
|
||||||
|
return; // there can't be dimensions in the file name if there's no space
|
||||||
|
|
||||||
|
CString sDimensionsPart = sFileNameBits[ sFileNameBits.GetSize()-1 ]; // looks like "10x5"
|
||||||
|
|
||||||
|
CStringArray sDimensionsBits;
|
||||||
|
split( sDimensionsPart, "x", sDimensionsBits, false );
|
||||||
|
|
||||||
|
if( sDimensionsBits.GetSize() != 2 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( !IsAnInt(sDimensionsBits[0]) || !IsAnInt(sDimensionsBits[1]) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
*puFramesWide = atoi(sDimensionsBits[0]);
|
||||||
|
*puFramesHigh = atoi(sDimensionsBits[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
// Parse m_sFilePath for the frame dimensions
|
// Parse m_sFilePath for the frame dimensions
|
||||||
//
|
//
|
||||||
@@ -94,7 +130,7 @@ void RageTexture::GetFrameDimensionsFromFileName( CString sPath, UINT* puFramesW
|
|||||||
}
|
}
|
||||||
sDimensionsString = sDimensionsString.Left(index_of_last_period);
|
sDimensionsString = sDimensionsString.Left(index_of_last_period);
|
||||||
|
|
||||||
// chop off everything before the last space
|
// chop off everything before and including the last space
|
||||||
int index_of_last_space = sDimensionsString.ReverseFind( ' ' );
|
int index_of_last_space = sDimensionsString.ReverseFind( ' ' );
|
||||||
if( index_of_last_space == -1 ) // this file name has space, so the dimensions tag cannot be read
|
if( index_of_last_space == -1 ) // this file name has space, so the dimensions tag cannot be read
|
||||||
{
|
{
|
||||||
@@ -118,4 +154,5 @@ void RageTexture::GetFrameDimensionsFromFileName( CString sPath, UINT* puFramesW
|
|||||||
|
|
||||||
if( *puFramesWide == 0 ) *puFramesWide = 1;
|
if( *puFramesWide == 0 ) *puFramesWide = 1;
|
||||||
if( *puFramesHigh == 0 ) *puFramesHigh = 1;
|
if( *puFramesHigh == 0 ) *puFramesHigh = 1;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
+100
-6
@@ -41,12 +41,32 @@ int roundf( double f )
|
|||||||
return (int)((f)+0.5);
|
return (int)((f)+0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool IsAnInt( CString s )
|
||||||
|
{
|
||||||
|
if( s.GetLength() == 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for( int i=0; i<s.GetLength(); i++ )
|
||||||
|
{
|
||||||
|
if( s[i] < '0' || s[i] > '9' )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Name: RageLogStart()
|
// Name: RageLogStart()
|
||||||
// Desc:
|
// Desc:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void RageLogStart()
|
void RageLogStart()
|
||||||
{
|
{
|
||||||
|
#if defined(DEBUG) | defined(_DEBUG)
|
||||||
|
|
||||||
// delete the old log and create a new one
|
// delete the old log and create a new one
|
||||||
DeleteFile( g_sLogFileName );
|
DeleteFile( g_sLogFileName );
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
@@ -61,6 +81,8 @@ void RageLogStart()
|
|||||||
RageLog( "Log starting %.4d-%.2d-%.2d %.2d:%.2d:%.2d",
|
RageLog( "Log starting %.4d-%.2d-%.2d %.2d:%.2d:%.2d",
|
||||||
st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond );
|
st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond );
|
||||||
RageLog( "\n" );
|
RageLog( "\n" );
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -141,7 +163,7 @@ CString join(CString Deliminator, CStringArray& Source)
|
|||||||
// Name: split()
|
// Name: split()
|
||||||
// Desc:
|
// Desc:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void split( CString Source, CString Deliminator, CStringArray& AddIt )
|
void split( CString Source, CString Deliminator, CStringArray& AddIt, bool bIgnoreEmpty )
|
||||||
{
|
{
|
||||||
CString newCString;
|
CString newCString;
|
||||||
CString tmpCString;
|
CString tmpCString;
|
||||||
@@ -156,7 +178,9 @@ void split( CString Source, CString Deliminator, CStringArray& AddIt )
|
|||||||
pos = newCString.Find(Deliminator, pos1);
|
pos = newCString.Find(Deliminator, pos1);
|
||||||
if ( pos != -1 ) {
|
if ( pos != -1 ) {
|
||||||
CString AddCString = newCString.Left(pos);
|
CString AddCString = newCString.Left(pos);
|
||||||
if (!AddCString.IsEmpty())
|
if( newCString.IsEmpty() && bIgnoreEmpty )
|
||||||
|
; // do nothing
|
||||||
|
else
|
||||||
AddIt.Add(AddCString);
|
AddIt.Add(AddCString);
|
||||||
|
|
||||||
tmpCString = newCString.Mid(pos + Deliminator.GetLength());
|
tmpCString = newCString.Mid(pos + Deliminator.GetLength());
|
||||||
@@ -164,7 +188,9 @@ void split( CString Source, CString Deliminator, CStringArray& AddIt )
|
|||||||
}
|
}
|
||||||
} while ( pos != -1 );
|
} while ( pos != -1 );
|
||||||
|
|
||||||
if (!newCString.IsEmpty())
|
if( newCString.IsEmpty() && bIgnoreEmpty )
|
||||||
|
; // do nothing
|
||||||
|
else
|
||||||
AddIt.Add(newCString);
|
AddIt.Add(newCString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +205,8 @@ void splitpath (BOOL UsingDirsOnly, CString Path, CString& Drive, CString& Dir,
|
|||||||
int nSecond;
|
int nSecond;
|
||||||
|
|
||||||
// Look for a UNC Name!
|
// Look for a UNC Name!
|
||||||
if (Path.Left(2) == "\\\\") {
|
if (Path.Left(2) == "\\\\")
|
||||||
|
{
|
||||||
int nFirst = Path.Find("\\",3);
|
int nFirst = Path.Find("\\",3);
|
||||||
nSecond = Path.Find("\\",nFirst + 1);
|
nSecond = Path.Find("\\",nFirst + 1);
|
||||||
if (nSecond == -1) {
|
if (nSecond == -1) {
|
||||||
@@ -191,10 +218,16 @@ void splitpath (BOOL UsingDirsOnly, CString Path, CString& Drive, CString& Dir,
|
|||||||
else if (nSecond > nFirst)
|
else if (nSecond > nFirst)
|
||||||
Drive = Path.Left(nSecond);
|
Drive = Path.Left(nSecond);
|
||||||
}
|
}
|
||||||
else { // Look for normal Drive Structure
|
else if (Path.Mid(1,1) == ":" ) // normal Drive Structure
|
||||||
|
{
|
||||||
nSecond = 2;
|
nSecond = 2;
|
||||||
Drive = Path.Left(2);
|
Drive = Path.Left(2);
|
||||||
}
|
}
|
||||||
|
else // no UNC or drive letter
|
||||||
|
{
|
||||||
|
nSecond = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (UsingDirsOnly) {
|
if (UsingDirsOnly) {
|
||||||
Dir = Path.Right((Path.GetLength() - nSecond) - 1);
|
Dir = Path.Right((Path.GetLength() - nSecond) - 1);
|
||||||
@@ -232,6 +265,62 @@ void splitpath (BOOL UsingDirsOnly, CString Path, CString& Drive, CString& Dir,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Name: splitpath()
|
||||||
|
// Desc:
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void splitrelpath( CString Path, CString& Dir, CString& FName, CString& Ext )
|
||||||
|
{
|
||||||
|
// need to split on both forward slashes and back slashes
|
||||||
|
CStringArray sPathBits;
|
||||||
|
|
||||||
|
CStringArray sBackShashPathBits;
|
||||||
|
split( Path, "\\", sBackShashPathBits, true );
|
||||||
|
|
||||||
|
for( int i=0; i<sBackShashPathBits.GetSize(); i++ ) // foreach backslash bit
|
||||||
|
{
|
||||||
|
CStringArray sForwardShashPathBits;
|
||||||
|
split( sBackShashPathBits[i], "/", sForwardShashPathBits, true );
|
||||||
|
|
||||||
|
sPathBits.Append( sForwardShashPathBits );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( sPathBits.GetSize() == 0 )
|
||||||
|
{
|
||||||
|
Dir = FName = Ext = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CString sFNameAndExt = sPathBits[ sPathBits.GetSize()-1 ];
|
||||||
|
|
||||||
|
// subtract the FNameAndExt from Path
|
||||||
|
Dir = Path.Left( Path.GetLength()-sFNameAndExt.GetLength() ); // don't subtract out the trailing slash
|
||||||
|
|
||||||
|
|
||||||
|
CStringArray sFNameAndExtBits;
|
||||||
|
split( sFNameAndExt, ".", sFNameAndExtBits, false );
|
||||||
|
|
||||||
|
if( sFNameAndExtBits.GetSize() == 0 ) // no file at the end of this path
|
||||||
|
{
|
||||||
|
FName = "";
|
||||||
|
Ext = "";
|
||||||
|
}
|
||||||
|
else if( sFNameAndExtBits.GetSize() == 1 ) // file doesn't have extension
|
||||||
|
{
|
||||||
|
FName = sFNameAndExtBits[0];
|
||||||
|
Ext = "";
|
||||||
|
}
|
||||||
|
else if( sFNameAndExtBits.GetSize() > 1 ) // file has extension and possibly multiple periods
|
||||||
|
{
|
||||||
|
Ext = sFNameAndExtBits[ sFNameAndExtBits.GetSize()-1 ];
|
||||||
|
|
||||||
|
// subtract the Ext and last period from FNameAndExt
|
||||||
|
FName = sFNameAndExt.Left( sFNameAndExt.GetLength()-Ext.GetLength()-1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GetDirListing( CString sPath, CStringArray &AddTo, BOOL bOnlyDirs )
|
void GetDirListing( CString sPath, CStringArray &AddTo, BOOL bOnlyDirs )
|
||||||
{
|
{
|
||||||
WIN32_FIND_DATA fd;
|
WIN32_FIND_DATA fd;
|
||||||
@@ -241,8 +330,13 @@ void GetDirListing( CString sPath, CStringArray &AddTo, BOOL bOnlyDirs )
|
|||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if( !bOnlyDirs || fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
if( bOnlyDirs && !(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
|
||||||
{
|
{
|
||||||
|
; // do nothing
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// add it
|
||||||
CString sDirName( fd.cFileName );
|
CString sDirName( fd.cFileName );
|
||||||
if( sDirName != "." && sDirName != ".." )
|
if( sDirName != "." && sDirName != ".." )
|
||||||
AddTo.Add( sDirName );
|
AddTo.Add( sDirName );
|
||||||
|
|||||||
@@ -41,10 +41,12 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Simple function for generating random numbers
|
// Simple function for generating random numbers
|
||||||
FLOAT randomf( FLOAT low=-1.0f, FLOAT high=1.0f );
|
float randomf( float low=-1.0f, float high=1.0f );
|
||||||
int roundf( FLOAT f );
|
int roundf( FLOAT f );
|
||||||
int roundf( double f );
|
int roundf( double f );
|
||||||
|
|
||||||
|
bool IsAnInt( CString s );
|
||||||
|
|
||||||
CString ssprintf( LPCTSTR fmt, ...);
|
CString ssprintf( LPCTSTR fmt, ...);
|
||||||
CString vssprintf( LPCTSTR fmt, va_list argList );
|
CString vssprintf( LPCTSTR fmt, va_list argList );
|
||||||
|
|
||||||
@@ -63,6 +65,10 @@ CString vssprintf( LPCTSTR fmt, va_list argList );
|
|||||||
*/
|
*/
|
||||||
void splitpath(BOOL UsingDirsOnly, CString Path, CString& Drive, CString& Dir, CString& FName, CString& Ext);
|
void splitpath(BOOL UsingDirsOnly, CString Path, CString& Drive, CString& Dir, CString& FName, CString& Ext);
|
||||||
|
|
||||||
|
|
||||||
|
void splitrelpath( CString Path, CString& Dir, CString& FName, CString& Ext );
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@FUNCTION: Splits a CString into an CStringArray according the Deliminator.
|
@FUNCTION: Splits a CString into an CStringArray according the Deliminator.
|
||||||
NOTE: Supports UNC path names.
|
NOTE: Supports UNC path names.
|
||||||
@@ -70,7 +76,7 @@ void splitpath(BOOL UsingDirsOnly, CString Path, CString& Drive, CString& Dir, C
|
|||||||
@PARAM2: Deliminator.
|
@PARAM2: Deliminator.
|
||||||
@PARAM3: (Referenced) CStringArray to Add to.
|
@PARAM3: (Referenced) CStringArray to Add to.
|
||||||
*/
|
*/
|
||||||
void split(CString Source, CString Deliminator, CStringArray& AddIt );
|
void split(CString Source, CString Deliminator, CStringArray& AddIt, bool bIgnoreEmpty = true );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@FUNCTION: Joins a CStringArray to create a CString according the Deliminator.
|
@FUNCTION: Joins a CStringArray to create a CString according the Deliminator.
|
||||||
|
|||||||
+220
-89
@@ -20,6 +20,10 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
|
const CString TEXTURE_FALLBACK_BANNER = "Textures\\Fallback Banner.png";
|
||||||
|
const CString TEXTURE_FALLBACK_BACKGROUND = "Textures\\Fallback Background.png";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int CompareBPMSegments(const void *arg1, const void *arg2)
|
int CompareBPMSegments(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
@@ -43,6 +47,28 @@ void SortBPMSegmentsArray( CArray<BPMSegment,BPMSegment&> &arrayBPMSegments )
|
|||||||
qsort( arrayBPMSegments.GetData(), arrayBPMSegments.GetSize(), sizeof(BPMSegment), CompareBPMSegments );
|
qsort( arrayBPMSegments.GetData(), arrayBPMSegments.GetSize(), sizeof(BPMSegment), CompareBPMSegments );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CompareFreezeSegments(const void *arg1, const void *arg2)
|
||||||
|
{
|
||||||
|
// arg1 and arg2 are of type Step**
|
||||||
|
FreezeSegment* seg1 = (FreezeSegment*)arg1;
|
||||||
|
FreezeSegment* seg2 = (FreezeSegment*)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 SortFreezeSegmentsArray( CArray<FreezeSegment,FreezeSegment&> &arrayFreezeSegments )
|
||||||
|
{
|
||||||
|
qsort( arrayFreezeSegments.GetData(), arrayFreezeSegments.GetSize(), sizeof(FreezeSegment), CompareFreezeSegments );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
// Song
|
// Song
|
||||||
@@ -50,8 +76,9 @@ void SortBPMSegmentsArray( CArray<BPMSegment,BPMSegment&> &arrayBPMSegments )
|
|||||||
Song::Song()
|
Song::Song()
|
||||||
{
|
{
|
||||||
m_bChangedSinceSave = false;
|
m_bChangedSinceSave = false;
|
||||||
// m_fBPM = 0;
|
|
||||||
m_fOffsetInSeconds = 0;
|
m_fOffsetInSeconds = 0;
|
||||||
|
m_iMaxCombo = m_iTopScore = m_iNumTimesPlayed = 0;
|
||||||
|
m_bHasBeenLoadedBefore = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -59,25 +86,70 @@ void Song::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, fl
|
|||||||
{
|
{
|
||||||
fElapsedTime += m_fOffsetInSeconds;
|
fElapsedTime += m_fOffsetInSeconds;
|
||||||
|
|
||||||
for( int i=0; i<m_BPMSegments.GetSize(); i++ ) {
|
|
||||||
|
for( int i=0; i<m_BPMSegments.GetSize(); i++ ) // foreach BPMSegment
|
||||||
|
{
|
||||||
|
BPMSegment &this_seg = m_BPMSegments[i];
|
||||||
|
|
||||||
float fStartBeatThisSegment = m_BPMSegments[i].m_fStartBeat;
|
float fStartBeatThisSegment = m_BPMSegments[i].m_fStartBeat;
|
||||||
bool bIsLastBPMSegment = i==m_BPMSegments.GetSize()-1;
|
bool bIsLastBPMSegment = i==m_BPMSegments.GetSize()-1;
|
||||||
float fStartBeatNextSegment = bIsLastBPMSegment ? 40000/*inf*/ : m_BPMSegments[i+1].m_fStartBeat;
|
float fStartBeatNextSegment = bIsLastBPMSegment ? 40000/*inf*/ : m_BPMSegments[i+1].m_fStartBeat;
|
||||||
float fBeatsInThisSegment = fStartBeatNextSegment - fStartBeatThisSegment;
|
float fBeatsInThisSegment = fStartBeatNextSegment - fStartBeatThisSegment;
|
||||||
float fBPM = m_BPMSegments[i].m_fBPM;
|
float fBPM = m_BPMSegments[i].m_fBPM;
|
||||||
float fBPS = fBPM / 60.0f;
|
float fBPS = fBPM / 60.0f;
|
||||||
|
|
||||||
|
// calculate the number of seconds in this segment
|
||||||
float fSecondsInThisSegment = fBeatsInThisSegment / fBPS;
|
float fSecondsInThisSegment = fBeatsInThisSegment / fBPS;
|
||||||
fElapsedTime -= m_BPMSegments[i].m_fFreezeSeconds;
|
for( int j=0; j<m_FreezeSegments.GetSize(); j++ ) // foreach freeze
|
||||||
if( fElapsedTime < 0 ) fElapsedTime = 0;
|
{
|
||||||
|
if( fStartBeatThisSegment <= m_FreezeSegments[j].m_fStartBeat && m_FreezeSegments[j].m_fStartBeat < fStartBeatNextSegment )
|
||||||
|
{
|
||||||
|
// this freeze lies within this BPMSegment
|
||||||
|
fSecondsInThisSegment += m_FreezeSegments[j].m_fFreezeSeconds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if( fElapsedTime > fSecondsInThisSegment )
|
if( fElapsedTime > fSecondsInThisSegment )
|
||||||
|
{
|
||||||
|
// this BPMSegement is not the current segment
|
||||||
fElapsedTime -= fSecondsInThisSegment;
|
fElapsedTime -= fSecondsInThisSegment;
|
||||||
else {
|
}
|
||||||
fBeatOut = fStartBeatThisSegment + fElapsedTime*fBPS;
|
else
|
||||||
|
{
|
||||||
|
// this BPMSegment IS the current segment
|
||||||
|
|
||||||
|
float fBeatEstimate = fStartBeatThisSegment + fElapsedTime*fBPS;
|
||||||
|
|
||||||
|
for( int j=0; j<m_FreezeSegments.GetSize(); j++ ) // foreach freeze
|
||||||
|
{
|
||||||
|
if( fStartBeatThisSegment <= m_FreezeSegments[j].m_fStartBeat && m_FreezeSegments[j].m_fStartBeat <= fStartBeatNextSegment )
|
||||||
|
{
|
||||||
|
// this freeze lies within this BPMSegment
|
||||||
|
|
||||||
|
if( m_FreezeSegments[j].m_fStartBeat <= fBeatEstimate )
|
||||||
|
{
|
||||||
|
fElapsedTime -= m_FreezeSegments[j].m_fFreezeSeconds;
|
||||||
|
// re-estimate
|
||||||
|
fBeatEstimate = fStartBeatThisSegment + fElapsedTime*fBPS;
|
||||||
|
if( fBeatEstimate < m_FreezeSegments[j].m_fStartBeat )
|
||||||
|
{
|
||||||
|
fBeatOut = m_FreezeSegments[j].m_fStartBeat;
|
||||||
fBPSOut = fBPS;
|
fBPSOut = fBPS;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fBeatOut = fBeatEstimate;
|
||||||
|
fBPSOut = fBPS;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -103,53 +175,73 @@ bool Song::LoadFromSongDir( CString sDir )
|
|||||||
GetDirListing( sDir + CString("*.dwi"), arrayDWIFileNames );
|
GetDirListing( sDir + CString("*.dwi"), arrayDWIFileNames );
|
||||||
int iNumDWIFiles = arrayDWIFileNames.GetSize();
|
int iNumDWIFiles = arrayDWIFileNames.GetSize();
|
||||||
|
|
||||||
/*
|
|
||||||
int j;
|
|
||||||
RageLog( "Found the following .bms files:" );
|
|
||||||
for( j=0; j<iNumBMSFiles; j++ )
|
|
||||||
RageLog( arrayBMSFileNames.GetAt(j) );
|
|
||||||
|
|
||||||
RageLog( "Found the following .msd files:" );
|
if( iNumDWIFiles > 1 )
|
||||||
for( j=0; j<iNumMSDFiles; j++ )
|
|
||||||
RageLog( arrayMSDFileNames.GetAt(j) );
|
|
||||||
*/
|
|
||||||
|
|
||||||
if( iNumBMSFiles > 0 )
|
|
||||||
{
|
{
|
||||||
// Load the Song info from the first BMS file. Silly BMS duplicates the song info in every
|
RageError( ssprintf("There is more than one DWI file in '%s'. Which one should I use?", sDir) );
|
||||||
// file, so this method assumes that the song info is identical for every BMS file in
|
|
||||||
// the directory.
|
|
||||||
LoadSongInfoFromBMSFile( sDir + arrayBMSFileNames.GetAt(0) );
|
|
||||||
for( int i=0; i<iNumBMSFiles; i++ ) {
|
|
||||||
arraySteps.SetSize( arraySteps.GetSize()+1 );
|
|
||||||
Steps &new_steps = arraySteps[ arraySteps.GetSize()-1 ];
|
|
||||||
new_steps.LoadStepsFromBMSFile( sDir + arrayBMSFileNames.GetAt(i) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if( iNumDWIFiles == 1 )
|
else if( iNumDWIFiles == 1 )
|
||||||
{
|
{
|
||||||
m_sSongFile = arrayDWIFileNames[0];
|
LoadSongInfoFromDWIFile( sDir + arrayDWIFileNames[0] );
|
||||||
RageLog( "Found '%s'. Let's use it...", m_sSongFile );
|
}
|
||||||
LoadSongInfoFromDWIFile( sDir + m_sSongFile );
|
else if( iNumBMSFiles > 0 )
|
||||||
|
{
|
||||||
|
LoadSongInfoFromBMSDir( sDir );
|
||||||
}
|
}
|
||||||
else if( iNumDWIFiles > 0 )
|
|
||||||
RageError( ssprintf("Found more than one DWI file in '%s'. Which should I use?", sDir) );
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
RageError( ssprintf("Couldn't find any BMS or MSD files in '%s'", sDir) );
|
RageError( ssprintf("Couldn't find any BMS or MSD files in '%s'", sDir) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Song::LoadSongInfoFromBMSFile( CString sPath )
|
|
||||||
|
|
||||||
|
bool Song::LoadSongInfoFromBMSDir( CString sDir )
|
||||||
{
|
{
|
||||||
RageLog( "Song::LoadFromBMSFile(%s)", sPath );
|
RageLog( "Song::LoadSongInfoFromBMSDir(%s)", sDir );
|
||||||
|
|
||||||
if( sPath == "Songs\\saints\\saint_4basic.bms" )
|
// make sure there is a trailing '\\' at the end of sDir
|
||||||
int kdgjf = 0;
|
if( sDir.Right(1) != "\\" )
|
||||||
|
sDir += "\\";
|
||||||
|
|
||||||
BmsFile bms( sPath );
|
// save song dir
|
||||||
|
m_sSongDir = sDir;
|
||||||
|
|
||||||
|
// get group name
|
||||||
|
CStringArray sDirectoryParts;
|
||||||
|
split( m_sSongDir, "\\", sDirectoryParts, true );
|
||||||
|
for( int p=0; p<sDirectoryParts.GetSize(); p++ )
|
||||||
|
RageLog( "sDirectoryParts[p] = '%s'", sDirectoryParts[p] );
|
||||||
|
m_sGroupName = sDirectoryParts[1];
|
||||||
|
|
||||||
|
|
||||||
|
CStringArray arrayBMSFileNames;
|
||||||
|
GetDirListing( sDir + CString("*.bms"), arrayBMSFileNames );
|
||||||
|
|
||||||
|
if( arrayBMSFileNames.GetSize() == 0 )
|
||||||
|
RageError( ssprintf("Couldn't find any BMS files in '%s'", sDir) );
|
||||||
|
|
||||||
|
|
||||||
|
// Load the Song info from the first BMS file. Silly BMS duplicates the song info in every
|
||||||
|
// file, so this method assumes that the song info is identical for every BMS file in
|
||||||
|
// the directory.
|
||||||
|
CString sBMSFilePath = m_sSongDir + arrayBMSFileNames[0];
|
||||||
|
|
||||||
|
// load the Steps from the rest of the BMS files
|
||||||
|
for( int i=0; i<arrayBMSFileNames.GetSize(); i++ )
|
||||||
|
{
|
||||||
|
arraySteps.SetSize( arraySteps.GetSize()+1 );
|
||||||
|
Steps &new_steps = arraySteps[ arraySteps.GetSize()-1 ];
|
||||||
|
new_steps.LoadStepsFromBMSFile( m_sSongDir + arrayBMSFileNames[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BmsFile bms( sBMSFilePath );
|
||||||
bms.ReadFile();
|
bms.ReadFile();
|
||||||
|
|
||||||
CMapStringToString &mapValues = bms.mapValues;
|
CMapStringToString &mapValues = bms.mapValues;
|
||||||
@@ -179,14 +271,16 @@ bool Song::LoadSongInfoFromBMSFile( CString sPath )
|
|||||||
BPMSegment new_seg;
|
BPMSegment new_seg;
|
||||||
new_seg.m_fStartBeat = 0;
|
new_seg.m_fStartBeat = 0;
|
||||||
new_seg.m_fBPM = (float)atof( data_array[0] );
|
new_seg.m_fBPM = (float)atof( data_array[0] );
|
||||||
// find insertion point
|
|
||||||
|
// add, then sort
|
||||||
m_BPMSegments.Add( new_seg );
|
m_BPMSegments.Add( new_seg );
|
||||||
|
SortBPMSegmentsArray( m_BPMSegments );
|
||||||
RageLog( "Inserting new BPM change at beat %f, BPM %f", new_seg.m_fStartBeat, new_seg.m_fBPM );
|
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")
|
else if( value_name == "#BackBMP" || value_name == "#backBMP")
|
||||||
m_sBackground = data_array[0];
|
m_sBackgroundPath = m_sSongDir + data_array[0];
|
||||||
else if( value_name == "#WAV99" )
|
else if( value_name == "#WAV99" )
|
||||||
m_sMusic = data_array[0];
|
m_sMusicPath = m_sSongDir + data_array[0];
|
||||||
else if( value_name.GetLength() == 6 ) // this is probably step or offset data. Looks like "#00705"
|
else if( value_name.GetLength() == 6 ) // this is probably step or offset data. Looks like "#00705"
|
||||||
{
|
{
|
||||||
int iMeasureNo = atoi( value_name.Mid(1,3) );
|
int iMeasureNo = atoi( value_name.Mid(1,3) );
|
||||||
@@ -230,9 +324,8 @@ bool Song::LoadSongInfoFromBMSFile( CString sPath )
|
|||||||
BPMSegment new_seg;
|
BPMSegment new_seg;
|
||||||
new_seg.m_fStartBeat = StepIndexToBeat( iStepIndex );
|
new_seg.m_fStartBeat = StepIndexToBeat( iStepIndex );
|
||||||
new_seg.m_fBPM = (float)arrayNotes[j];
|
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
|
m_BPMSegments.Add( new_seg ); // add to back for now (we'll sort later)
|
||||||
SortBPMSegmentsArray( m_BPMSegments );
|
SortBPMSegmentsArray( m_BPMSegments );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -241,7 +334,7 @@ bool Song::LoadSongInfoFromBMSFile( CString sPath )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int i=0; i<m_BPMSegments.GetSize(); i++ )
|
for( i=0; i<m_BPMSegments.GetSize(); i++ )
|
||||||
RageLog( "There is a BPM change at beat fd, BPM %f, index %d",
|
RageLog( "There is a BPM change at beat fd, BPM %f, index %d",
|
||||||
m_BPMSegments[i].m_fStartBeat, m_BPMSegments[i].m_fBPM, i );
|
m_BPMSegments[i].m_fStartBeat, m_BPMSegments[i].m_fBPM, i );
|
||||||
|
|
||||||
@@ -257,10 +350,52 @@ bool Song::LoadSongInfoFromDWIFile( CString sPath )
|
|||||||
{
|
{
|
||||||
RageLog( "Song::LoadFromDWIFile(%s)", sPath );
|
RageLog( "Song::LoadFromDWIFile(%s)", sPath );
|
||||||
|
|
||||||
|
// save song file path
|
||||||
|
m_sSongFilePath = sPath;
|
||||||
|
|
||||||
|
// save song dir
|
||||||
|
CString sDir, sFName, sExt;
|
||||||
|
splitrelpath(sPath, sDir, sFName, sExt);
|
||||||
|
m_sSongDir = sDir;
|
||||||
|
|
||||||
|
// get group name
|
||||||
|
sDir.MakeLower();
|
||||||
|
if( sDir.Find( "dwi support" ) != -1 ) // loading from DWI support
|
||||||
|
{
|
||||||
|
int iIndexOfFirstBackslash = sDir.Find('\\');
|
||||||
|
int iIndexOfSecondBackslash = sDir.Find('\\', iIndexOfFirstBackslash+1);
|
||||||
|
int iIndexOfThirdBackslash = sDir.Find('\\', iIndexOfSecondBackslash+1);
|
||||||
|
m_sGroupName = sDir.Mid( iIndexOfSecondBackslash+1, iIndexOfThirdBackslash-iIndexOfSecondBackslash-1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// get group name
|
||||||
|
CStringArray sDirectoryParts;
|
||||||
|
split( m_sSongDir, "\\", sDirectoryParts, true );
|
||||||
|
for( int p=0; p<sDirectoryParts.GetSize(); p++ )
|
||||||
|
RageLog( "sDirectoryParts[p] = '%s'", sDirectoryParts[p] );
|
||||||
|
m_sGroupName = sDirectoryParts[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// save probable image paths
|
||||||
|
m_sBackgroundPath = ssprintf(".\\DWI Support\\Backgrounds\\%s\\%s.avi", m_sGroupName, sFName);
|
||||||
|
if( !DoesFileExist( GetBackgroundPath() ) )
|
||||||
|
m_sBackgroundPath = ssprintf(".\\DWI Support\\Backgrounds\\%s\\%s.mpg", m_sGroupName, sFName);
|
||||||
|
if( !DoesFileExist( GetBackgroundPath() ) )
|
||||||
|
m_sBackgroundPath = ssprintf(".\\DWI Support\\Backgrounds\\%s\\%s.mpeg", m_sGroupName, sFName);
|
||||||
|
if( !DoesFileExist( GetBackgroundPath() ) )
|
||||||
|
m_sBackgroundPath = ssprintf(".\\DWI Support\\Backgrounds\\%s\\%s.png", m_sGroupName, sFName);
|
||||||
|
|
||||||
|
m_sBannerPath = ssprintf(".\\DWI Support\\Banners\\%s\\%s.png", m_sGroupName, sFName);
|
||||||
|
|
||||||
|
|
||||||
CStdioFile file;
|
CStdioFile file;
|
||||||
if( !file.Open( GetSongFilePath(), CFile::modeRead ) )
|
if( !file.Open( GetSongFilePath(), CFile::modeRead ) )
|
||||||
RageError( ssprintf("Error opening Song file '%s'.", GetSongFilePath()) );
|
RageError( ssprintf("Error opening DWI file '%s'.", GetSongFilePath()) );
|
||||||
|
|
||||||
|
|
||||||
|
// MessageBox( NULL, sFName, sFName, MB_OK );
|
||||||
|
|
||||||
|
|
||||||
// read the whole file into a sFileText
|
// read the whole file into a sFileText
|
||||||
CString sFileText;
|
CString sFileText;
|
||||||
@@ -287,7 +422,7 @@ bool Song::LoadSongInfoFromDWIFile( CString sPath )
|
|||||||
|
|
||||||
// handle the data
|
// handle the data
|
||||||
if( sValueName == "#FILE" )
|
if( sValueName == "#FILE" )
|
||||||
m_sMusic = arrayValueTokens[1];
|
m_sMusicPath = CString("DWI Support\\") + arrayValueTokens[1];
|
||||||
|
|
||||||
else if( sValueName == "#TITLE" )
|
else if( sValueName == "#TITLE" )
|
||||||
m_sTitle = arrayValueTokens[1];
|
m_sTitle = arrayValueTokens[1];
|
||||||
@@ -299,8 +434,10 @@ bool Song::LoadSongInfoFromDWIFile( CString sPath )
|
|||||||
{
|
{
|
||||||
BPMSegment new_seg;
|
BPMSegment new_seg;
|
||||||
new_seg.m_fStartBeat = 0;
|
new_seg.m_fStartBeat = 0;
|
||||||
new_seg.m_fBPM = atof( arrayValueTokens[1] );
|
new_seg.m_fBPM = (float)atof( arrayValueTokens[1] );
|
||||||
m_BPMSegments.Add( new_seg ); // add to back for now (we'll sort later)
|
|
||||||
|
m_BPMSegments.Add( new_seg );
|
||||||
|
SortBPMSegmentsArray( m_BPMSegments );
|
||||||
}
|
}
|
||||||
else if( sValueName == "#GAP" )
|
else if( sValueName == "#GAP" )
|
||||||
// the units of GAP is 1/1000 second
|
// the units of GAP is 1/1000 second
|
||||||
@@ -319,17 +456,14 @@ bool Song::LoadSongInfoFromDWIFile( CString sPath )
|
|||||||
float fFreezeBeat = StepIndexToBeat( fIndex );
|
float fFreezeBeat = StepIndexToBeat( fIndex );
|
||||||
float fFreezeSeconds = atof( arrayFreezeValues[1] ) / 1000.0f;
|
float fFreezeSeconds = atof( arrayFreezeValues[1] ) / 1000.0f;
|
||||||
|
|
||||||
// find the BPM segment corresponding to this freeze
|
FreezeSegment new_seg;
|
||||||
for( int b=0; b<m_BPMSegments.GetSize(); b++ )
|
new_seg.m_fStartBeat = fFreezeBeat;
|
||||||
{
|
new_seg.m_fFreezeSeconds = fFreezeSeconds;
|
||||||
if( m_BPMSegments[b].m_fStartBeat == fFreezeBeat )
|
|
||||||
{
|
|
||||||
m_BPMSegments[b].m_fFreezeSeconds = fFreezeSeconds;
|
|
||||||
m_BPMSegments[b].m_fFreezeSeconds *= 0.8; // hack - Why is this needed?
|
|
||||||
|
|
||||||
break;
|
RageLog( "Adding a freeze segment: beat: %f, seconds = %f", new_seg.m_fStartBeat, new_seg.m_fFreezeSeconds );
|
||||||
}
|
|
||||||
}
|
m_FreezeSegments.Add( new_seg ); // add to back for now (we'll sort later)
|
||||||
|
SortFreezeSegmentsArray( m_FreezeSegments );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -350,17 +484,12 @@ bool Song::LoadSongInfoFromDWIFile( CString sPath )
|
|||||||
BPMSegment new_seg;
|
BPMSegment new_seg;
|
||||||
new_seg.m_fStartBeat = fBeat;
|
new_seg.m_fStartBeat = fBeat;
|
||||||
new_seg.m_fBPM = fNewBPM;
|
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
|
// add and sort
|
||||||
|
m_BPMSegments.Add( new_seg );
|
||||||
SortBPMSegmentsArray( m_BPMSegments );
|
SortBPMSegmentsArray( m_BPMSegments );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( sValueName == "#BANNER" )
|
|
||||||
m_sBanner = arrayValueTokens[1];
|
|
||||||
|
|
||||||
else if( sValueName == "#BACKGROUND" )
|
|
||||||
m_sBackground = arrayValueTokens[1];
|
|
||||||
|
|
||||||
else if( sValueName == "#SINGLE" || sValueName == "#DOUBLE" || sValueName == "#COUPLE" )
|
else if( sValueName == "#SINGLE" || sValueName == "#DOUBLE" || sValueName == "#COUPLE" )
|
||||||
{
|
{
|
||||||
@@ -384,14 +513,11 @@ void Song::TidyUpData()
|
|||||||
{
|
{
|
||||||
if( m_sTitle == "" ) m_sTitle = "Untitled song";
|
if( m_sTitle == "" ) m_sTitle = "Untitled song";
|
||||||
if( m_sArtist == "" ) m_sArtist = "Unknown artist";
|
if( m_sArtist == "" ) m_sArtist = "Unknown artist";
|
||||||
if( m_sCreator == "" ) m_sCreator = "";
|
if( m_sCreator == "" ) m_sCreator = "Unknown creator";
|
||||||
if( m_BPMSegments.GetSize() == 0 )
|
if( m_BPMSegments.GetSize() == 0 )
|
||||||
RageError( ssprintf("No #BPM specified in '%s.'", GetSongFilePath()) );
|
RageError( ssprintf("No #BPM specified in '%s.'", GetSongFilePath()) );
|
||||||
|
|
||||||
if( m_fOffsetInSeconds == 0.0 )
|
if( m_sMusicPath == "" || !DoesFileExist(GetMusicPath()) )
|
||||||
RageLog( "WARNING: #OFFSET or #GAP in '%s' is either 0.0, or was missing.", GetSongFilePath() );
|
|
||||||
|
|
||||||
if( m_sMusic == "" || !DoesFileExist(GetMusicPath()) )
|
|
||||||
{
|
{
|
||||||
CStringArray arrayPossibleMusic;
|
CStringArray arrayPossibleMusic;
|
||||||
GetDirListing( m_sSongDir + CString("*.mp3"), arrayPossibleMusic );
|
GetDirListing( m_sSongDir + CString("*.mp3"), arrayPossibleMusic );
|
||||||
@@ -399,12 +525,15 @@ void Song::TidyUpData()
|
|||||||
GetDirListing( m_sSongDir + CString("*.wav"), arrayPossibleMusic );
|
GetDirListing( m_sSongDir + CString("*.wav"), arrayPossibleMusic );
|
||||||
|
|
||||||
if( arrayPossibleMusic.GetSize() != 0 ) // we found a match
|
if( arrayPossibleMusic.GetSize() != 0 ) // we found a match
|
||||||
m_sMusic = arrayPossibleMusic.GetAt( 0 );
|
m_sMusicPath = m_sSongDir + arrayPossibleMusic[0];
|
||||||
else
|
else
|
||||||
m_sMusic = "";
|
m_sMusicPath = "";
|
||||||
// RageError( ssprintf("Music could not be found. Please check the Song file '%s' and verify the specified #MUSIC exists.", GetSongFilePath()) );
|
// RageError( ssprintf("Music could not be found. Please check the Song file '%s' and verify the specified #MUSIC exists.", GetSongFilePath()) );
|
||||||
}
|
}
|
||||||
if( m_sBanner == "" || !DoesFileExist(GetBannerPath()) )
|
|
||||||
|
if( !DoesFileExist(GetBannerPath()) )
|
||||||
|
m_sBannerPath = "";
|
||||||
|
if( m_sBannerPath == "" )
|
||||||
{
|
{
|
||||||
// find the smallest image in the directory
|
// find the smallest image in the directory
|
||||||
|
|
||||||
@@ -414,7 +543,7 @@ void Song::TidyUpData()
|
|||||||
GetDirListing( m_sSongDir + CString("*.bmp"), arrayPossibleBanners );
|
GetDirListing( m_sSongDir + CString("*.bmp"), arrayPossibleBanners );
|
||||||
|
|
||||||
DWORD dwSmallestFileSoFar = 0xFFFFFFFF;
|
DWORD dwSmallestFileSoFar = 0xFFFFFFFF;
|
||||||
CString sSmallestFileNameSoFar = "";
|
CString sSmallestFileSoFar = "";
|
||||||
|
|
||||||
for( int i=0; i<arrayPossibleBanners.GetSize(); i++ )
|
for( int i=0; i<arrayPossibleBanners.GetSize(); i++ )
|
||||||
{
|
{
|
||||||
@@ -422,26 +551,33 @@ void Song::TidyUpData()
|
|||||||
if( this_size < dwSmallestFileSoFar ) // we have a new leader!
|
if( this_size < dwSmallestFileSoFar ) // we have a new leader!
|
||||||
{
|
{
|
||||||
dwSmallestFileSoFar = this_size;
|
dwSmallestFileSoFar = this_size;
|
||||||
sSmallestFileNameSoFar = arrayPossibleBanners[i];
|
sSmallestFileSoFar = m_sSongDir + arrayPossibleBanners[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sSmallestFileNameSoFar != "" ) // we found a match
|
if( sSmallestFileSoFar != "" ) // we found a match
|
||||||
m_sBanner = sSmallestFileNameSoFar;
|
m_sBannerPath = sSmallestFileSoFar;
|
||||||
else
|
else
|
||||||
RageError( ssprintf("Banner could not be found. Please check the Song file '%s' and verify the specified #BANNER exists.", GetSongFilePath()) );
|
m_sBannerPath = "";
|
||||||
|
|
||||||
|
//RageError( ssprintf("Banner could not be found. Please check the Song file '%s' and verify the specified #BANNER exists.", GetSongFilePath()) );
|
||||||
}
|
}
|
||||||
if( m_sBackground == "" || !DoesFileExist(GetBackgroundPath()) )
|
if( !DoesFileExist(GetBackgroundPath()) )
|
||||||
|
m_sBackgroundPath = "";
|
||||||
|
if( m_sBackgroundPath == "" )
|
||||||
{
|
{
|
||||||
// find the largest image in the directory
|
// find the largest image in the directory
|
||||||
|
|
||||||
CStringArray arrayPossibleBackgrounds;
|
CStringArray arrayPossibleBackgrounds;
|
||||||
|
GetDirListing( m_sSongDir + CString("*.avi"), arrayPossibleBackgrounds );
|
||||||
|
GetDirListing( m_sSongDir + CString("*.mpg"), arrayPossibleBackgrounds );
|
||||||
|
GetDirListing( m_sSongDir + CString("*.mpeg"), arrayPossibleBackgrounds );
|
||||||
GetDirListing( m_sSongDir + CString("*.png"), arrayPossibleBackgrounds );
|
GetDirListing( m_sSongDir + CString("*.png"), arrayPossibleBackgrounds );
|
||||||
GetDirListing( m_sSongDir + CString("*.jpg"), arrayPossibleBackgrounds );
|
GetDirListing( m_sSongDir + CString("*.jpg"), arrayPossibleBackgrounds );
|
||||||
GetDirListing( m_sSongDir + CString("*.bmp"), arrayPossibleBackgrounds );
|
GetDirListing( m_sSongDir + CString("*.bmp"), arrayPossibleBackgrounds );
|
||||||
|
|
||||||
DWORD dwLargestFileSoFar = 0;
|
DWORD dwLargestFileSoFar = 0;
|
||||||
CString sLargestFileNameSoFar = "";
|
CString sLargestFileSoFar = "";
|
||||||
|
|
||||||
for( int i=0; i<arrayPossibleBackgrounds.GetSize(); i++ )
|
for( int i=0; i<arrayPossibleBackgrounds.GetSize(); i++ )
|
||||||
{
|
{
|
||||||
@@ -449,24 +585,18 @@ void Song::TidyUpData()
|
|||||||
if( this_size > dwLargestFileSoFar ) // we have a new leader!
|
if( this_size > dwLargestFileSoFar ) // we have a new leader!
|
||||||
{
|
{
|
||||||
dwLargestFileSoFar = this_size;
|
dwLargestFileSoFar = this_size;
|
||||||
sLargestFileNameSoFar = arrayPossibleBackgrounds[i];
|
sLargestFileSoFar = m_sSongDir + arrayPossibleBackgrounds[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sLargestFileNameSoFar != "" ) // we found a match
|
if( sLargestFileSoFar != "" ) // we found a match
|
||||||
m_sBackground = sLargestFileNameSoFar;
|
m_sBackgroundPath = sLargestFileSoFar;
|
||||||
else
|
else
|
||||||
RageError( ssprintf("Background could not be found. Please check the Song file '%s' and verify the specified #BANNER exists.", GetSongFilePath()) );
|
m_sBackgroundPath = "";
|
||||||
|
// RageError( ssprintf("Background could not be found. Please check the Song file '%s' and verify the specified #BANNER exists.", GetSongFilePath()) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
D3DXIMAGE_INFO ddii;
|
|
||||||
|
|
||||||
if( FAILED( hr = D3DXGetImageInfoFromFile(m_sFilePath,&ddii) ) ) {
|
|
||||||
RageErrorHr( ssprintf("D3DXGetImageInfoFromFile() failed for file '%s'.", m_sFilePath), hr );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
void Song::GetStepsThatMatchGameMode( GameMode gm, CArray<Steps*, Steps*&>& arrayAddTo )
|
void Song::GetStepsThatMatchGameMode( GameMode gm, CArray<Steps*, Steps*&>& arrayAddTo )
|
||||||
@@ -532,3 +662,4 @@ void Song::GetNumFeet( GameMode gm, int& iDiffEasyOut, int& iDiffMediumOut, int&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+38
-18
@@ -32,11 +32,11 @@ void Sprite::Init()
|
|||||||
m_uCurState = 0;
|
m_uCurState = 0;
|
||||||
m_bIsAnimating = TRUE;
|
m_bIsAnimating = TRUE;
|
||||||
m_fSecsIntoState = 0.0;
|
m_fSecsIntoState = 0.0;
|
||||||
m_bUsingCustomTexCoordRect = FALSE ;
|
m_bUsingCustomTexCoords = false;
|
||||||
m_Effect = no_effect ;
|
m_Effect = no_effect ;
|
||||||
m_fPercentBetweenColors = 0.0f;
|
m_fPercentBetweenColors = 0.0f;
|
||||||
m_bTweeningTowardEndColor = TRUE ;
|
m_bTweeningTowardEndColor = true;
|
||||||
m_fDeltaPercentPerSecond = 1.0 ;
|
m_fDeltaPercentPerSecond = 1.0f;
|
||||||
m_fWagRadians = 0.2f;
|
m_fWagRadians = 0.2f;
|
||||||
m_fWagPeriod = 2.0f;
|
m_fWagPeriod = 2.0f;
|
||||||
m_fWagTimer = 0.0f;
|
m_fWagTimer = 0.0f;
|
||||||
@@ -48,6 +48,9 @@ void Sprite::Init()
|
|||||||
m_bHasShadow = GAMEINFO->m_GameOptions.m_bShadows;
|
m_bHasShadow = GAMEINFO->m_GameOptions.m_bShadows;
|
||||||
else
|
else
|
||||||
m_bHasShadow = true;
|
m_bHasShadow = true;
|
||||||
|
|
||||||
|
|
||||||
|
m_bBlendAdd = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite::~Sprite()
|
Sprite::~Sprite()
|
||||||
@@ -239,15 +242,6 @@ void Sprite::Draw()
|
|||||||
if( m_pTexture != NULL )
|
if( m_pTexture != NULL )
|
||||||
{
|
{
|
||||||
|
|
||||||
FRECT* pTexCoordRect; // the texture coordinates of the frame we're going to use
|
|
||||||
if( m_bUsingCustomTexCoordRect ) {
|
|
||||||
pTexCoordRect = &m_CustomTexCoordRect;
|
|
||||||
} else {
|
|
||||||
UINT uFrameNo = m_uFrame[m_uCurState];
|
|
||||||
pTexCoordRect = m_pTexture->GetTextureCoordRect( uFrameNo );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
D3DXCOLOR colorDiffuse[4];
|
D3DXCOLOR colorDiffuse[4];
|
||||||
for(int i=0; i<4; i++)
|
for(int i=0; i<4; i++)
|
||||||
colorDiffuse[i] = m_colorDiffuse[i];
|
colorDiffuse[i] = m_colorDiffuse[i];
|
||||||
@@ -302,10 +296,26 @@ void Sprite::Draw()
|
|||||||
v[2].p = D3DXVECTOR3( fHalfSizeX, fHalfSizeY, 0 ); // bottom right
|
v[2].p = D3DXVECTOR3( fHalfSizeX, fHalfSizeY, 0 ); // bottom right
|
||||||
v[3].p = D3DXVECTOR3( fHalfSizeX, -fHalfSizeY, 0 ); // top right
|
v[3].p = D3DXVECTOR3( fHalfSizeX, -fHalfSizeY, 0 ); // top right
|
||||||
|
|
||||||
|
|
||||||
|
if( m_bUsingCustomTexCoords )
|
||||||
|
{
|
||||||
|
v[0].tu = m_CustomTexCoords[0]; v[0].tv = m_CustomTexCoords[1]; // bottom left
|
||||||
|
v[1].tu = m_CustomTexCoords[2]; v[1].tv = m_CustomTexCoords[3]; // top left
|
||||||
|
v[2].tu = m_CustomTexCoords[4]; v[2].tv = m_CustomTexCoords[5]; // bottom right
|
||||||
|
v[3].tu = m_CustomTexCoords[6]; v[3].tv = m_CustomTexCoords[7]; // top right
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UINT uFrameNo = m_uFrame[m_uCurState];
|
||||||
|
FRECT* pTexCoordRect = m_pTexture->GetTextureCoordRect( uFrameNo );
|
||||||
|
|
||||||
v[0].tu = pTexCoordRect->left; v[0].tv = pTexCoordRect->bottom; // bottom left
|
v[0].tu = pTexCoordRect->left; v[0].tv = pTexCoordRect->bottom; // bottom left
|
||||||
v[1].tu = pTexCoordRect->left; v[1].tv = pTexCoordRect->top; // top left
|
v[1].tu = pTexCoordRect->left; v[1].tv = pTexCoordRect->top; // top left
|
||||||
v[2].tu = pTexCoordRect->right; v[2].tv = pTexCoordRect->bottom; // bottom right
|
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[3].tu = pTexCoordRect->right; v[3].tv = pTexCoordRect->top; // top right
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pVB->Unlock();
|
pVB->Unlock();
|
||||||
|
|
||||||
@@ -317,14 +327,16 @@ void Sprite::Draw()
|
|||||||
pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR );
|
pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR );
|
||||||
//pd3dDevice->SetRenderState( D3DRS_SRCBLEND, bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA );
|
//pd3dDevice->SetRenderState( D3DRS_SRCBLEND, bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA );
|
||||||
//pd3dDevice->SetRenderState( D3DRS_DESTBLEND, bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA );
|
//pd3dDevice->SetRenderState( D3DRS_DESTBLEND, bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA );
|
||||||
pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
|
pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA );
|
||||||
pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
|
pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA );
|
||||||
|
|
||||||
pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX );
|
pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX );
|
||||||
pd3dDevice->SetStreamSource( 0, pVB, sizeof(CUSTOMVERTEX) );
|
pd3dDevice->SetStreamSource( 0, pVB, sizeof(CUSTOMVERTEX) );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if( colorDiffuse[0].a != 0 )
|
||||||
|
{
|
||||||
//////////////////////
|
//////////////////////
|
||||||
// render the shadow
|
// render the shadow
|
||||||
//////////////////////
|
//////////////////////
|
||||||
@@ -361,8 +373,6 @@ void Sprite::Draw()
|
|||||||
//////////////////////
|
//////////////////////
|
||||||
// render the diffuse pass
|
// render the diffuse pass
|
||||||
//////////////////////
|
//////////////////////
|
||||||
if( colorDiffuse[0].a != 0 )
|
|
||||||
{
|
|
||||||
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
|
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
|
||||||
|
|
||||||
v[0].color = colorDiffuse[2]; // bottom left
|
v[0].color = colorDiffuse[2]; // bottom left
|
||||||
@@ -424,8 +434,18 @@ void Sprite::SetState( UINT uNewState )
|
|||||||
|
|
||||||
void Sprite::SetCustomSrcRect( FRECT new_texcoord_frect )
|
void Sprite::SetCustomSrcRect( FRECT new_texcoord_frect )
|
||||||
{
|
{
|
||||||
m_bUsingCustomTexCoordRect = true;
|
m_bUsingCustomTexCoords = true;
|
||||||
m_CustomTexCoordRect = new_texcoord_frect;
|
m_CustomTexCoords[0] = new_texcoord_frect.left; m_CustomTexCoords[1] = new_texcoord_frect.bottom; // bottom left
|
||||||
|
m_CustomTexCoords[2] = new_texcoord_frect.left; m_CustomTexCoords[3] = new_texcoord_frect.top; // top left
|
||||||
|
m_CustomTexCoords[4] = new_texcoord_frect.right; m_CustomTexCoords[5] = new_texcoord_frect.bottom; // bottom right
|
||||||
|
m_CustomTexCoords[6] = new_texcoord_frect.right; m_CustomTexCoords[7] = new_texcoord_frect.top; // top right
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sprite::SetCustomTexCoords( float fTexCoords[8] ) // order: bottom left, top left, bottom right, top right
|
||||||
|
{
|
||||||
|
m_bUsingCustomTexCoords = true;
|
||||||
|
for( int i=0; i<8; i++ )
|
||||||
|
m_CustomTexCoords[i] = fTexCoords[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,10 +44,13 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
void SetCustomSrcRect( FRECT new_texcoord_frect ); // for cropping
|
void SetCustomSrcRect( FRECT new_texcoord_frect ); // for cropping
|
||||||
|
void SetCustomTexCoords( float fTexCoords[8] );
|
||||||
|
|
||||||
void TurnShadowOn() { m_bHasShadow = true; };
|
void TurnShadowOn() { m_bHasShadow = true; };
|
||||||
void TurnShadowOff() { m_bHasShadow = false; };
|
void TurnShadowOff() { m_bHasShadow = false; };
|
||||||
|
|
||||||
|
void SetBlendModeAdd() { m_bBlendAdd = true; };
|
||||||
|
void SetBlendModeNormal() { m_bBlendAdd = false; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Init();
|
void Init();
|
||||||
@@ -65,10 +68,13 @@ protected:
|
|||||||
bool m_bIsAnimating;
|
bool m_bIsAnimating;
|
||||||
float m_fSecsIntoState; // number of seconds that have elapsed since we switched to this frame
|
float m_fSecsIntoState; // number of seconds that have elapsed since we switched to this frame
|
||||||
|
|
||||||
bool m_bUsingCustomTexCoordRect;
|
bool m_bUsingCustomTexCoords;
|
||||||
FRECT m_CustomTexCoordRect;
|
//FRECT m_CustomTexCoordRect;
|
||||||
|
float m_CustomTexCoords[8]; // (x,y) * 4
|
||||||
|
|
||||||
bool m_bHasShadow;
|
bool m_bHasShadow;
|
||||||
|
|
||||||
|
bool m_bBlendAdd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "WindowSandbox.h"
|
#include "WindowSandbox.h"
|
||||||
#include "WindowLoading.h"
|
#include "WindowLoading.h"
|
||||||
|
#include "WindowResults.h"
|
||||||
#include "WindowTitleMenu.h"
|
#include "WindowTitleMenu.h"
|
||||||
|
|
||||||
#include <DXUtil.h>
|
#include <DXUtil.h>
|
||||||
@@ -89,7 +90,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
|
|||||||
RageError( "StepMania is already running!" );
|
RageError( "StepMania is already running!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !DoesFileExist("Songs") )
|
if( !DoesFileExist("Textures") )
|
||||||
{
|
{
|
||||||
// change dir to path of the execuctable
|
// change dir to path of the execuctable
|
||||||
TCHAR szFullAppPath[MAX_PATH];
|
TCHAR szFullAppPath[MAX_PATH];
|
||||||
@@ -174,7 +175,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
|
|||||||
Update();
|
Update();
|
||||||
Render();
|
Render();
|
||||||
//if( !g_bFullscreen )
|
//if( !g_bFullscreen )
|
||||||
::Sleep(16); // give some time for the movie
|
::Sleep(11); // give some time for the movie decoding thread
|
||||||
}
|
}
|
||||||
} // end while( WM_QUIT != msg.message )
|
} // end while( WM_QUIT != msg.message )
|
||||||
|
|
||||||
@@ -311,17 +312,18 @@ HRESULT CreateObjects( HWND hWnd )
|
|||||||
WM = new WindowManager;
|
WM = new WindowManager;
|
||||||
|
|
||||||
// throw something up on the screen while the game resources are loading
|
// throw something up on the screen while the game resources are loading
|
||||||
|
// super hack! Why do we crash unless we have rendered one frame before drawing anything?
|
||||||
|
Render();
|
||||||
|
ShowFrame();
|
||||||
WM->SetNewWindow( new WindowLoading );
|
WM->SetNewWindow( new WindowLoading );
|
||||||
Render();
|
Render();
|
||||||
ShowFrame();
|
ShowFrame();
|
||||||
|
|
||||||
|
|
||||||
// this stuff takes a long time...
|
// this stuff takes a long time...
|
||||||
SOUND = new RageSound( hWnd );
|
SOUND = new RageSound( hWnd );
|
||||||
MUSIC = new RageMusic;
|
MUSIC = new RageMusic;
|
||||||
INPUT = new RageInput( hWnd );
|
INPUT = new RageInput( hWnd );
|
||||||
GAMEINFO= new GameInfo;
|
GAMEINFO= new GameInfo;
|
||||||
GAMEINFO->InitSongArrayFromDisk();
|
|
||||||
|
|
||||||
BringWindowToTop( hWnd );
|
BringWindowToTop( hWnd );
|
||||||
SetForegroundWindow( hWnd );
|
SetForegroundWindow( hWnd );
|
||||||
@@ -422,7 +424,7 @@ HRESULT InvalidateObjects()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
FLOAT fDeltaTime = DXUtil_Timer( TIMER_GETELAPSEDTIME );
|
float fDeltaTime = DXUtil_Timer( TIMER_GETELAPSEDTIME );
|
||||||
|
|
||||||
// This was a hack to fix timing issues with the old WindowSelectSong
|
// This was a hack to fix timing issues with the old WindowSelectSong
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -176,6 +176,14 @@ SOURCE=.\Window.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\WindowCaution.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\WindowCaution.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\WindowConfigurePads.cpp
|
SOURCE=.\WindowConfigurePads.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -356,6 +364,14 @@ SOURCE=.\BlurredTitle.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\BPMDisplay.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\BPMDisplay.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\ColorArrow.cpp
|
SOURCE=.\ColorArrow.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -380,6 +396,14 @@ SOURCE=.\GhostArrow.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\GhostArrowBright.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\GhostArrowBright.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\GrayArrow.cpp
|
SOURCE=.\GrayArrow.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -568,6 +592,14 @@ SOURCE=.\TransitionFadeWipe.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\TransitionFadeWipeWithLogo.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\TransitionFadeWipeWithLogo.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\TransitionRectWipe.cpp
|
SOURCE=.\TransitionRectWipe.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#include "WindowManager.h"
|
#include "WindowManager.h"
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_TRANSITION_TIME 1.0f
|
#define DEFAULT_TRANSITION_TIME 0.75f
|
||||||
|
|
||||||
|
|
||||||
class Transition
|
class Transition
|
||||||
@@ -45,7 +45,7 @@ public:
|
|||||||
bool IsClosed() { return m_TransitionState == closed; };
|
bool IsClosed() { return m_TransitionState == closed; };
|
||||||
bool IsClosing() { return m_TransitionState == closing_right || m_TransitionState == closing_left; };
|
bool IsClosing() { return m_TransitionState == closing_right || m_TransitionState == closing_left; };
|
||||||
|
|
||||||
void SetTransitionTime( FLOAT fNewTransitionTime ) { m_fTransitionTime = fNewTransitionTime; };
|
void SetTransitionTime( float fNewTransitionTime ) { m_fTransitionTime = fNewTransitionTime; };
|
||||||
|
|
||||||
void SetColor( D3DXCOLOR new_color ) { m_Color = new_color; };
|
void SetColor( D3DXCOLOR new_color ) { m_Color = new_color; };
|
||||||
void SetCloseWipingRightSound( CString sSoundPath );
|
void SetCloseWipingRightSound( CString sSoundPath );
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ const float FADE_RECT_WIDTH = SCREEN_WIDTH/2;
|
|||||||
|
|
||||||
TransitionFadeWipe::TransitionFadeWipe()
|
TransitionFadeWipe::TransitionFadeWipe()
|
||||||
{
|
{
|
||||||
|
m_sprLogo.LoadFromTexture( "Textures\\Logo dots.png" );
|
||||||
|
m_sprLogo.SetXY( CENTER_X, CENTER_Y );
|
||||||
}
|
}
|
||||||
|
|
||||||
TransitionFadeWipe::~TransitionFadeWipe()
|
TransitionFadeWipe::~TransitionFadeWipe()
|
||||||
@@ -70,6 +71,12 @@ void TransitionFadeWipe::Draw()
|
|||||||
D3DXCOLOR(0,0,0,1), // down left
|
D3DXCOLOR(0,0,0,1), // down left
|
||||||
D3DXCOLOR(0,0,0,0) // down right
|
D3DXCOLOR(0,0,0,0) // down right
|
||||||
);
|
);
|
||||||
|
|
||||||
|
bool bIsOpening = m_TransitionState == opening_left || m_TransitionState == opening_right;
|
||||||
|
float fLogoAlpha = bIsOpening ? (1-fPercentComplete)*3-2 : fPercentComplete*3-2;
|
||||||
|
m_sprLogo.SetDiffuseColor( D3DXCOLOR(1,1,1,fLogoAlpha) );
|
||||||
|
m_sprLogo.Draw();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "Transition.h"
|
#include "Transition.h"
|
||||||
#include "RageScreen.h"
|
#include "RageScreen.h"
|
||||||
#include "RageSound.h"
|
#include "RageSound.h"
|
||||||
|
#include "Sprite.h"
|
||||||
|
|
||||||
|
|
||||||
class TransitionFadeWipe : public Transition
|
class TransitionFadeWipe : public Transition
|
||||||
@@ -24,6 +25,9 @@ public:
|
|||||||
~TransitionFadeWipe();
|
~TransitionFadeWipe();
|
||||||
|
|
||||||
void Draw();
|
void Draw();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Sprite m_sprLogo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 108
|
#define _APS_NEXT_RESOURCE_VALUE 110
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40009
|
#define _APS_NEXT_COMMAND_VALUE 40009
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1006
|
#define _APS_NEXT_CONTROL_VALUE 1006
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
|||||||
+81
-51
@@ -19,9 +19,55 @@ class Steps; // why is this needed?
|
|||||||
enum GameMode; // why is this needed?
|
enum GameMode; // why is this needed?
|
||||||
|
|
||||||
|
|
||||||
struct BPMSegment{
|
|
||||||
BPMSegment() { m_fStartBeat = m_fBPM = m_fFreezeSeconds = 0; };
|
struct Grade
|
||||||
float m_fStartBeat, m_fBPM, m_fFreezeSeconds;
|
{
|
||||||
|
Grade() { m_GradeType = GRADE_NONE; };
|
||||||
|
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_NONE: return "N";
|
||||||
|
default: return "N";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
void FromString( CString sGradeString )
|
||||||
|
{
|
||||||
|
sGradeString.MakeUpper();
|
||||||
|
if ( sGradeString == "AAA" ) m_GradeType = GRADE_AAA;
|
||||||
|
else if( sGradeString == "AA" ) m_GradeType = GRADE_AA;
|
||||||
|
else if( sGradeString == "A" ) m_GradeType = GRADE_A;
|
||||||
|
else if( sGradeString == "B" ) m_GradeType = GRADE_B;
|
||||||
|
else if( sGradeString == "C" ) m_GradeType = GRADE_C;
|
||||||
|
else if( sGradeString == "D" ) m_GradeType = GRADE_D;
|
||||||
|
else if( sGradeString == "E" ) m_GradeType = GRADE_E;
|
||||||
|
else if( sGradeString == "N" ) m_GradeType = GRADE_NONE;
|
||||||
|
else m_GradeType = GRADE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GradeType { GRADE_NONE=0, GRADE_E, GRADE_D, GRADE_C, GRADE_B, GRADE_A, GRADE_AA, GRADE_AAA };
|
||||||
|
GradeType m_GradeType;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BPMSegment
|
||||||
|
{
|
||||||
|
BPMSegment() { m_fStartBeat = m_fBPM = -1; };
|
||||||
|
float m_fStartBeat;
|
||||||
|
float m_fBPM;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FreezeSegment
|
||||||
|
{
|
||||||
|
FreezeSegment() { m_fStartBeat = m_fFreezeSeconds = -1; };
|
||||||
|
float m_fStartBeat;
|
||||||
|
float m_fFreezeSeconds;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -31,32 +77,27 @@ public:
|
|||||||
Song();
|
Song();
|
||||||
|
|
||||||
bool LoadFromSongDir( CString sDir );
|
bool LoadFromSongDir( CString sDir );
|
||||||
|
|
||||||
bool IsUsingMovieBG()
|
|
||||||
{
|
|
||||||
CString sBGFile = m_sBackground;
|
|
||||||
sBGFile.MakeLower();
|
|
||||||
return sBGFile.Right(3) == "avi" ||
|
|
||||||
sBGFile.Right(3) == "mpg";
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool LoadSongInfoFromBMSFile( CString sPath );
|
|
||||||
bool LoadSongInfoFromDWIFile( CString sPath );
|
bool LoadSongInfoFromDWIFile( CString sPath );
|
||||||
|
bool LoadSongInfoFromBMSDir( CString sDir );
|
||||||
|
private:
|
||||||
|
|
||||||
void TidyUpData();
|
void TidyUpData();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CString GetSongFilePath() {return m_sSongDir + m_sSongFile; };
|
CString GetSongFilePath() {return m_sSongFilePath; };
|
||||||
CString GetSongFileDir() {return m_sSongDir; };
|
CString GetSongFileDir() {return m_sSongDir; };
|
||||||
CString GetMusicPath() {return m_sSongDir + m_sMusic; };
|
CString GetGroupName() {return m_sGroupName; };
|
||||||
CString GetBannerPath() {return m_sSongDir + m_sBanner; };
|
CString GetMusicPath() {return m_sMusicPath; };
|
||||||
CString GetBackgroundPath() {return m_sSongDir + m_sBackground; };
|
CString GetBannerPath() {return m_sBannerPath; };
|
||||||
// Steps& GetStepsAt( int iIndex ) {return arraySteps[iIndex]; };
|
CString GetBackgroundPath() {return m_sBackgroundPath; };
|
||||||
|
bool BackgroundIsAMovie() {return m_sBackgroundPath.Right(3) == "avi" ||
|
||||||
|
m_sBackgroundPath.Right(3) == "mpg" ||
|
||||||
|
m_sBackgroundPath.Right(4) == "mpeg"; };
|
||||||
|
|
||||||
bool HasMusic() {return m_sMusic != "" && DoesFileExist(GetMusicPath()); };
|
|
||||||
bool HasBanner() {return m_sBanner != "" && DoesFileExist(GetBannerPath()); };
|
bool HasMusic() {return m_sMusicPath != "" && DoesFileExist(GetMusicPath()); };
|
||||||
bool HasBackground() {return m_sBackground != "" && DoesFileExist(GetBackgroundPath()); };
|
bool HasBanner() {return m_sBannerPath != "" && DoesFileExist(GetBannerPath()); };
|
||||||
|
bool HasBackground() {return m_sBackgroundPath != "" && DoesFileExist(GetBackgroundPath()); };
|
||||||
|
|
||||||
|
|
||||||
CString GetTitle() {return m_sTitle; };
|
CString GetTitle() {return m_sTitle; };
|
||||||
@@ -64,45 +105,33 @@ public:
|
|||||||
CString GetCreator() {return m_sCreator; };
|
CString GetCreator() {return m_sCreator; };
|
||||||
float GetBeatOffsetInSeconds() {return m_fOffsetInSeconds; };
|
float GetBeatOffsetInSeconds() {return m_fOffsetInSeconds; };
|
||||||
void SetBeatOffsetInSeconds(float fNewOffset) {m_fOffsetInSeconds = fNewOffset; };
|
void SetBeatOffsetInSeconds(float fNewOffset) {m_fOffsetInSeconds = fNewOffset; };
|
||||||
void GetMinMaxBPM( int &iMinBPM, int &iMaxBPM )
|
void GetMinMaxBPM( float &fMinBPM, float &fMaxBPM )
|
||||||
{
|
{
|
||||||
iMaxBPM = 0;
|
fMaxBPM = 0;
|
||||||
iMinBPM = 100000; // inf
|
fMinBPM = 100000; // inf
|
||||||
for( int i=0; i<m_BPMSegments.GetSize(); i++ ) {
|
for( int i=0; i<m_BPMSegments.GetSize(); i++ )
|
||||||
if( m_BPMSegments[i].m_fBPM > iMaxBPM )
|
{
|
||||||
iMaxBPM = (int)m_BPMSegments[i].m_fBPM;
|
BPMSegment &seg = m_BPMSegments[i];
|
||||||
if( m_BPMSegments[i].m_fBPM < iMinBPM )
|
fMaxBPM = max( seg.m_fBPM, fMaxBPM );
|
||||||
iMinBPM = (int)m_BPMSegments[i].m_fBPM;
|
fMinBPM = min( seg.m_fBPM, fMinBPM );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut );
|
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_fStartBeat > fSongBeat || i==m_BPMSegments.GetSize()-1 )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return m_BPMSegments[i].m_fBPM;
|
|
||||||
};
|
|
||||||
void SetBPM( float fNewBPM, float fSongBeat )
|
|
||||||
{
|
|
||||||
for( int i=0; i<m_BPMSegments.GetSize(); i++ ) {
|
|
||||||
if( m_BPMSegments[i].m_fStartBeat > fSongBeat || i==m_BPMSegments.GetSize()-1 )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
m_BPMSegments[i].m_fBPM = fNewBPM;
|
|
||||||
};
|
|
||||||
|
|
||||||
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 );
|
void GetNumFeet( GameMode gm, int& iDiffEasy, int& iDiffMedium, int& iDiffHard );
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// Song statistics:
|
||||||
|
int m_iMaxCombo, m_iTopScore, m_iNumTimesPlayed;
|
||||||
|
bool m_bHasBeenLoadedBefore;
|
||||||
|
Grade m_TopGrade;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CString m_sSongFile;
|
CString m_sSongFilePath;
|
||||||
CString m_sSongDir;
|
CString m_sSongDir;
|
||||||
|
CString m_sGroupName;
|
||||||
|
|
||||||
bool m_bChangedSinceSave;
|
bool m_bChangedSinceSave;
|
||||||
CString m_sTitle;
|
CString m_sTitle;
|
||||||
@@ -111,11 +140,12 @@ private:
|
|||||||
// float m_fBPM;
|
// float m_fBPM;
|
||||||
float m_fOffsetInSeconds;
|
float m_fOffsetInSeconds;
|
||||||
|
|
||||||
CString m_sMusic;
|
CString m_sMusicPath;
|
||||||
CString m_sBanner;
|
CString m_sBannerPath;
|
||||||
CString m_sBackground;
|
CString m_sBackgroundPath;
|
||||||
|
|
||||||
CArray<BPMSegment, BPMSegment&> m_BPMSegments; // this must be sorted before dancing
|
CArray<BPMSegment, BPMSegment&> m_BPMSegments; // this must be sorted before dancing
|
||||||
|
CArray<FreezeSegment, FreezeSegment&> m_FreezeSegments; // this must be sorted before dancing
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CArray<Steps, Steps&> arraySteps;
|
CArray<Steps, Steps&> arraySteps;
|
||||||
|
|||||||
Reference in New Issue
Block a user