no message

This commit is contained in:
Chris Danford
2002-04-28 20:42:32 +00:00
parent 78f3e80118
commit dad622f11c
63 changed files with 1642 additions and 16473 deletions
+1 -2
View File
@@ -38,8 +38,7 @@ Actor::Actor()
m_fVibrationDistance = 5.0f; m_fVibrationDistance = 5.0f;
m_bVisibleThisFrame = FALSE; m_bVisibleThisFrame = FALSE;
if( PREFS ) m_bShadow = PREFS->m_GraphicOptions.m_bShadows; m_bShadow = true;
else m_bShadow = true;
m_fShadowLength = 4; m_fShadowLength = 4;
m_bBlendAdd = false; m_bBlendAdd = false;
+2 -2
View File
@@ -11,7 +11,7 @@
*/ */
#include "ArrowEffects.h" #include "ArrowEffects.h"
#include "NoteMetadata.h" #include "NoteMetadata.h"
#include "ColorArrow.h" #include "ColorNote.h"
#include "ScreenDimensions.h" #include "ScreenDimensions.h"
#include "GameManager.h" #include "GameManager.h"
@@ -34,7 +34,7 @@ float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBea
float ArrowGetXPos( const PlayerOptions& po, int iColNum, float fYOffset, float fSongBeat ) float ArrowGetXPos( const PlayerOptions& po, int iColNum, float fYOffset, float fSongBeat )
{ {
float fColOffsetFromCenter = iColNum - (GAME->GetCurrentStyleDef()->GetColsPerPlayer()-1)/2.0f; float fColOffsetFromCenter = iColNum - (GAME->GetCurrentStyleDef()->m_iColsPerPlayer-1)/2.0f;
float fPixelOffsetFromCenter = fColOffsetFromCenter * ARROW_SIZE; float fPixelOffsetFromCenter = fColOffsetFromCenter * ARROW_SIZE;
switch( po.m_EffectType ) switch( po.m_EffectType )
+38 -27
View File
@@ -15,6 +15,7 @@
#include "FontManager.h" #include "FontManager.h"
#include "RageHelper.h" #include "RageHelper.h"
#include "ErrorCatcher/ErrorCatcher.h" #include "ErrorCatcher/ErrorCatcher.h"
#include "PrefsManager.h"
D3DXCOLOR RAINBOW_COLORS[] = { D3DXCOLOR RAINBOW_COLORS[] = {
@@ -74,6 +75,8 @@ bool BitmapText::Load( const CString &sFontFilePath )
void BitmapText::SetText( CString sText ) void BitmapText::SetText( CString sText )
{ {
//HELPER.Log( "BitmapText::SetText()" );
if( m_pFont->m_bCapitalsOnly ) if( m_pFont->m_bCapitalsOnly )
sText.MakeUpper(); sText.MakeUpper();
@@ -120,6 +123,10 @@ void BitmapText::SetText( CString sText )
if( m_iLineWidths[l] > m_iWidestLineWidth ) if( m_iLineWidths[l] > m_iWidestLineWidth )
m_iWidestLineWidth = m_iLineWidths[l]; m_iWidestLineWidth = m_iLineWidths[l];
} }
// fill the RageScreen's vertex buffer with what we're going to draw
//RebuildVertexBuffer();
} }
@@ -127,6 +134,10 @@ void BitmapText::SetText( CString sText )
void BitmapText::RebuildVertexBuffer() void BitmapText::RebuildVertexBuffer()
{ {
//HELPER.Log( "BitmapText::RebuildVertexBuffer()" );
RageTexture* pTexture = m_pFont->m_pTexture; RageTexture* pTexture = m_pFont->m_pTexture;
@@ -139,6 +150,8 @@ void BitmapText::RebuildVertexBuffer()
// make the object in logical units centered at the origin // make the object in logical units centered at the origin
LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer(); LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer();
//LPDIRECT3DVERTEXBUFFER8 pVB = m_pVB;
CUSTOMVERTEX* v; CUSTOMVERTEX* v;
pVB->Lock( 0, 0, (BYTE**)&v, 0 ); pVB->Lock( 0, 0, (BYTE**)&v, 0 );
@@ -185,11 +198,12 @@ void BitmapText::RebuildVertexBuffer()
// HACK: // HACK:
// The right side of any italic letter is being cropped. So, we're going to draw a little bit // The right side of any italic letter is being cropped. So, we're going to draw a little bit
// to the right of the normal character. // to the right of the normal character.
const float fPercentExtra = min( const float fPercentExtra = min( m_pFont->m_fDrawExtraPercent, (iFrameWidth-iCharWidth)/(float)iFrameWidth ); // don't draw from the adjacent frame
0.20f,
(iFrameWidth-iCharWidth)/(float)iFrameWidth
);
//
// set vertex positions
//
const float fExtraPixels = fPercentExtra * pTexture->GetSourceFrameWidth(); const float fExtraPixels = fPercentExtra * pTexture->GetSourceFrameWidth();
// first triangle // first triangle
@@ -204,28 +218,28 @@ void BitmapText::RebuildVertexBuffer()
v[m_iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY+iHeight/2.0f, 0 ); // bottom right v[m_iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY+iHeight/2.0f, 0 ); // bottom right
//
// set texture coordinates // set texture coordinates
//
m_iNumV -= 6; m_iNumV -= 6;
FRECT* pTexCoordRect = pTexture->GetTextureCoordRect( iFrameNo ); FRECT frectTexCoords = *pTexture->GetTextureCoordRect( iFrameNo );
// Tweak the textures frame rectangles so we don't draw extra
// to the left and right of the character, saving us fill rate.
float fPixelsToChopOff = pTexture->GetSourceFrameWidth() - (float)iCharWidth;
float fTexCoordsToChopOff = fPixelsToChopOff / pTexture->GetSourceWidth();
frectTexCoords.left += fTexCoordsToChopOff/2;
frectTexCoords.right -= fTexCoordsToChopOff/2;
const float fExtraTexCoords = fPercentExtra * pTexture->GetTextureFrameWidth() / pTexture->GetTextureWidth(); const float fExtraTexCoords = fPercentExtra * pTexture->GetTextureFrameWidth() / pTexture->GetTextureWidth();
v[m_iNumV].tu = pTexCoordRect->left; v[m_iNumV++].tv = pTexCoordRect->top; // top left v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.top ); // top left
v[m_iNumV].tu = pTexCoordRect->left; v[m_iNumV++].tv = pTexCoordRect->bottom; // bottom left v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.bottom ); // bottom left
v[m_iNumV].tu = pTexCoordRect->right + fExtraTexCoords; v[m_iNumV++].tv = pTexCoordRect->top; // top right v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.top ); // top right
v[m_iNumV].tu = v[m_iNumV-1].tu; v[m_iNumV++].tv = v[m_iNumV-1].tv; // top right v[m_iNumV++].t = v[m_iNumV-1].t; // top right
v[m_iNumV].tu = v[m_iNumV-3].tu; v[m_iNumV++].tv = v[m_iNumV-3].tv; // bottom left v[m_iNumV++].t = v[m_iNumV-3].t; // bottom left
v[m_iNumV].tu = pTexCoordRect->right + fExtraTexCoords; v[m_iNumV++].tv = pTexCoordRect->bottom; // bottom right v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.bottom ); // bottom right
/*
v[m_iNumV].tu = 0.0f; v[m_iNumV++].tv = 1.0f-1.0f/16; // top left
v[m_iNumV].tu = 0.0f; v[m_iNumV++].tv = 1.0f; // bottom left
v[m_iNumV].tu = 1.0f/16; v[m_iNumV++].tv = 1.0f-1.0f/16; // top right
v[m_iNumV].tu = 1.0f/16; v[m_iNumV++].tv = 1.0f-1.0f/16; // top right
v[m_iNumV].tu = 0.0f; v[m_iNumV++].tv = 1.0f; // bottom left
v[m_iNumV].tu = 1.0f/16; v[m_iNumV++].tv = 1.0f; // bottom right
*/
} }
iY += iHeight; iY += iHeight;
@@ -252,6 +266,7 @@ void BitmapText::RenderPrimitives()
LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer(); LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer();
//LPDIRECT3DVERTEXBUFFER8 pVB = m_pVB;
CUSTOMVERTEX* v; CUSTOMVERTEX* v;
@@ -259,10 +274,6 @@ void BitmapText::RenderPrimitives()
LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice(); LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice();
pd3dDevice->SetTexture( 0, pTexture->GetD3DTexture() ); pd3dDevice->SetTexture( 0, pTexture->GetD3DTexture() );
pd3dDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR );
//pd3dDevice->SetRenderState( D3DRS_SRCBLEND, bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA );
//pd3dDevice->SetRenderState( D3DRS_DESTBLEND, bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA );
pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA ); pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA );
pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA ); pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA );
@@ -276,7 +287,7 @@ void BitmapText::RenderPrimitives()
////////////////////// //////////////////////
// render the shadow // render the shadow
////////////////////// //////////////////////
if( m_bShadow ) if( m_bShadow && PREFS && PREFS->GetCurrentGraphicProfileOptions()->m_bShadows )
{ {
SCREEN->PushMatrix(); SCREEN->PushMatrix();
SCREEN->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units SCREEN->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units
@@ -334,10 +345,10 @@ void BitmapText::RenderPrimitives()
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );//bBlendAdd ? D3DTOP_ADD : D3DTOP_MODULATE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );//bBlendAdd ? D3DTOP_ADD : D3DTOP_MODULATE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 ); pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 );
} }
+1
View File
@@ -53,6 +53,7 @@ protected:
int m_iWidestLineWidth; // in source pixels int m_iWidestLineWidth; // in source pixels
// recalculate on RebuildVertexBuffer() // recalculate on RebuildVertexBuffer()
// LPDIRECT3DVERTEXBUFFER8 m_pVB;
int m_iNumV; // number of verticies we filled in the vertex buffer int m_iNumV; // number of verticies we filled in the vertex buffer
bool m_bRainbow; bool m_bRainbow;
+19 -25
View File
@@ -58,9 +58,6 @@ Font::Font( const CString &sFontFilePath )
m_sTexturePath = sFontDir + sTextureFile; // save the path of the new texture m_sTexturePath = sFontDir + sTextureFile; // save the path of the new texture
m_sTexturePath.MakeLower(); m_sTexturePath.MakeLower();
// is this the first time the texture is being loaded?
bool bFirstTimeBeingLoaded = !TEXTURE->IsTextureLoaded( m_sTexturePath );
m_pTexture = TEXTURE->LoadTexture( m_sTexturePath, 0, false ); m_pTexture = TEXTURE->LoadTexture( m_sTexturePath, 0, false );
assert( m_pTexture != NULL ); assert( m_pTexture != NULL );
@@ -74,7 +71,7 @@ Font::Font( const CString &sFontFilePath )
{ {
// sanity check // sanity check
if( sCharacters.GetLength() != (int)m_pTexture->GetNumFrames() ) if( sCharacters.GetLength() != (int)m_pTexture->GetNumFrames() )
FatalError( ssprintf("The characters in '%s' does not match the number of frames in the texture.", m_sFontFilePath) ); FatalError( "The characters in '%s' does not match the number of frames in the texture.", m_sFontFilePath );
// set the char to frame number map // set the char to frame number map
for( int i=0; i<sCharacters.GetLength(); i++ ) for( int i=0; i<sCharacters.GetLength(); i++ )
@@ -87,11 +84,28 @@ Font::Font( const CString &sFontFilePath )
} }
else // the font file creator did not supply characters. Assume this is a full low ASCII set. else // the font file creator did not supply characters. Assume this is a full low ASCII set.
{ {
for( int i=0; i<MAX_FONT_CHARS; i++ ) switch( m_pTexture->GetNumFrames() )
{
case 256: // ASCII 0-255
{
for( int i=0; i<256; i++ )
m_iCharToFrameNo[i] = i; m_iCharToFrameNo[i] = i;
} }
break;
case 128: // ASCII 32-159
{
for( int i=32; i<160; i++ )
m_iCharToFrameNo[i] = i-32;
}
break;
default:
FatalError( "No characters were specified in '%s' and the font is not a standard ASCII set.", m_sFontFilePath );
}
}
m_bCapitalsOnly = ("1" == ini.GetValue("Font", "CapitalsOnly")); m_bCapitalsOnly = ("1" == ini.GetValue("Font", "CapitalsOnly"));
m_fDrawExtraPercent = (float)ini.GetValueF("Font", "DrawExtraPercent");
// //
@@ -119,26 +133,6 @@ Font::Font( const CString &sFontFilePath )
m_iFrameNoToWidth[i] = m_pTexture->GetSourceFrameWidth(); m_iFrameNoToWidth[i] = m_pTexture->GetSourceFrameWidth();
} }
} }
//
// Tweak the textures frame rectangles so we don't draw extra
// to the left and right of the character, saving us fill rate.
//
if( bFirstTimeBeingLoaded )
{
for( int i=0; i<(int)m_pTexture->GetNumFrames(); i++ )
{
FRECT* pFrect = m_pTexture->GetTextureCoordRect( i );
float fPixelsToChopOff = (float)m_iFrameNoToWidth[i] - m_pTexture->GetSourceFrameWidth();
float fTexCoordsToChopOff = fPixelsToChopOff / m_pTexture->GetSourceWidth();
pFrect->left -= fTexCoordsToChopOff/2;
pFrect->right += fTexCoordsToChopOff/2;
}
}
} }
+1
View File
@@ -35,6 +35,7 @@ public:
RageTexture* m_pTexture; RageTexture* m_pTexture;
bool m_bCapitalsOnly; bool m_bCapitalsOnly;
float m_fDrawExtraPercent; // for italic fonts
int m_iCharToFrameNo[MAX_FONT_CHARS]; int m_iCharToFrameNo[MAX_FONT_CHARS];
int m_iFrameNoToWidth[MAX_FONT_CHARS]; // in soure coordinate space int m_iFrameNoToWidth[MAX_FONT_CHARS]; // in soure coordinate space
+126 -9
View File
@@ -14,6 +14,123 @@
#include "RageHelper.h" #include "RageHelper.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "ErrorCatcher/ErrorCatcher.h" #include "ErrorCatcher/ErrorCatcher.h"
#include "IniFile.h"
#include "StyleDef.h"
GameDef::GameDef( CString sGameDir )
{
HELPER.Log( "GameDef::GameDef( '%s )", sGameDir );
sGameDir.TrimRight( "/\\" ); // trim off the trailing slash if any
m_sGameDir = sGameDir + "\\";
// extract the game name
CString sThrowAway;
splitrelpath( sGameDir, sThrowAway, m_sName, sThrowAway );
//
// Parse the .game definition file
//
CString sGameFilePath = ssprintf("%s\\%s.game", sGameDir, m_sName);
IniFile ini;
ini.SetPath( sGameFilePath );
if( !ini.ReadFile() )
FatalError( "Error reading game definition file '%s'.", sGameFilePath );
if( ini.GetValue( "Game", "Name" ) != m_sName )
FatalError( "Game name in '%s' doesn't match the directory name.", sGameFilePath );
m_sDescription = ini.GetValue( "Game", "Description" );
m_iNumInstruments = ini.GetValueI( "Game", "NumInstruments" );
if( m_iNumInstruments != 2 )
FatalError( "Invalid value for NumInstruments in '%s'.", sGameFilePath );
m_iButtonsPerInstrument = ini.GetValueI( "Game", "ButtonsPerInstrument" );
if( m_iButtonsPerInstrument < 1 || m_iButtonsPerInstrument > MAX_INSTRUMENT_BUTTONS )
FatalError( "Invalid value for ButtonsPerInstrument in '%s'.", sGameFilePath );
CString sButtonsString = ini.GetValue( "Game", "ButtonNames" );
CStringArray arrayButtonNames;
split( sButtonsString, ",", arrayButtonNames );
if( arrayButtonNames.GetSize() != m_iButtonsPerInstrument )
FatalError( "Button names do not match number of buttons in '%s'.", sGameFilePath );
for( int i=0; i<m_iButtonsPerInstrument; i++ )
m_sButtonNames[i] = arrayButtonNames[i];
CString sMenuButtonsString = ini.GetValue( "Game", "MenuButtons" );
CStringArray arrayMenuButtonNames;
split( sMenuButtonsString, ",", arrayMenuButtonNames );
if( arrayMenuButtonNames.GetSize() != NUM_MENU_BUTTONS )
FatalError( "Invalid number of menu buttons in '%s'.", sGameFilePath );
for( i=0; i<NUM_MENU_BUTTONS; i++ )
m_iMenuButtons[i] = ButtonNameToIndex( arrayMenuButtonNames[i] );
//
// Look for a StyleDefs in this game folder
//
m_iNumStyleDefs = 0;
CStringArray arrayStyleFiles;
GetDirListing( ssprintf("%s\\*.style", sGameDir), arrayStyleFiles );
SortCStringArray( arrayStyleFiles );
for( i=0; i<arrayStyleFiles.GetSize(); i++ ) // for each style
{
CString sStyleFileName = arrayStyleFiles[i];
if( 0 == stricmp( sStyleFileName, "cvs" ) ) // the directory called "CVS"
continue; // ignore it
CString sStyleFilePath = ssprintf("%s\\%s", sGameDir, sStyleFileName);
// add the new style
m_pStyleDefs[m_iNumStyleDefs++] = new StyleDef( this, sStyleFilePath );
}
//
// Look for a note skins in this game folder
//
m_iNumSkinFolders = 0;
CStringArray arraySkinFolders;
GetDirListing( ssprintf("%s\\*.", sGameDir), arraySkinFolders, true );
SortCStringArray( arraySkinFolders );
if( arraySkinFolders.GetSize() == 0 )
FatalError( "The Game directory '%s' must contain at least one skin.", sGameFilePath );
for( i=0; i<arraySkinFolders.GetSize(); i++ ) // for each skin folder
{
CString sSkinFolder = arraySkinFolders[i];
if( 0 == stricmp( sSkinFolder, "cvs" ) ) // the directory called "CVS"
continue; // ignore it
m_sSkinFolders[m_iNumSkinFolders++] = sSkinFolder;
}
}
GameDef::~GameDef()
{
for( int i=0; i<m_iNumStyleDefs; i++ )
delete m_pStyleDefs[i];
}
StyleDef* GameDef::GetStyleDef( CString sStyle )
{
for( int i=0; i<m_iNumStyleDefs; i++ )
{
if( m_pStyleDefs[i]->m_sName == sStyle )
return m_pStyleDefs[i];
}
return NULL;
}
CString GameDef::ElementToGraphicSuffix( const GameButtonGraphic gbg ) CString GameDef::ElementToGraphicSuffix( const GameButtonGraphic gbg )
{ {
@@ -35,22 +152,22 @@ CString GameDef::ElementToGraphicSuffix( const GameButtonGraphic gbg )
return sAssetPath; return sAssetPath;
} }
CString GameDef::GetPathToGraphic( const int iInstrumentButton, const GameButtonGraphic gbg ) CString GameDef::GetPathToGraphic( const CString sSkinName, const int iInstrumentButton, const GameButtonGraphic gbg )
{ {
const CString sDir = "Game\\" + CString(m_szName) + "\\"; const CString sSkinDir = ssprintf("%s\\%s\\", m_sGameDir, sSkinName);
const CString sButtonName = m_szButtonNames[ iInstrumentButton ]; const CString sButtonName = m_sButtonNames[ iInstrumentButton ];
const CString sGraphicSuffix = ElementToGraphicSuffix( gbg ); const CString sGraphicSuffix = ElementToGraphicSuffix( gbg );
CStringArray arrayPossibleFileNames; // fill this with the possible files CStringArray arrayPossibleFileNames; // fill this with the possible files
GetDirListing( ssprintf("%s%s %s*.sprite", sDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames ); GetDirListing( ssprintf("%s%s %s*.sprite", sSkinDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames );
GetDirListing( ssprintf("%s%s %s*.png", sDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames ); GetDirListing( ssprintf("%s%s %s*.png", sSkinDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames );
GetDirListing( ssprintf("%s%s %s*.jpg", sDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames ); GetDirListing( ssprintf("%s%s %s*.jpg", sSkinDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames );
GetDirListing( ssprintf("%s%s %s*.bmp", sDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames ); GetDirListing( ssprintf("%s%s %s*.bmp", sSkinDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames );
if( arrayPossibleFileNames.GetSize() > 0 ) if( arrayPossibleFileNames.GetSize() > 0 )
return sDir + arrayPossibleFileNames[0]; return sSkinDir + arrayPossibleFileNames[0];
FatalError( "The game button graphic '%s%s %s' is missing.", sDir, sButtonName, sGraphicSuffix ); FatalError( "The game button graphic '%s%s %s' is missing.", sSkinDir, sButtonName, sGraphicSuffix );
return ""; return "";
} }
+31 -10
View File
@@ -10,7 +10,6 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "StyleDef.h"
#include "NoteMetadata.h" #include "NoteMetadata.h"
#include "NoteData.h" #include "NoteData.h"
#include "GameInput.h" #include "GameInput.h"
@@ -20,29 +19,51 @@
const int MAX_STYLES_PER_GAME = 10; const int MAX_STYLES_PER_GAME = 10;
const int MAX_SKIN_PATHS = 16;
class StyleDef;
struct GameDef class GameDef
{ {
public: public:
GameDef( CString sGameDir );
~GameDef();
LPCTSTR m_szName; CString m_sGameDir;
LPCTSTR m_szDescription; CString m_sName;
LPCTSTR m_szGraphicPath; CString m_sDescription;
// instrument stuff // instrument stuff
int m_iNumInstruments; int m_iNumInstruments;
int m_iNumButtons; int m_iButtonsPerInstrument;
LPCTSTR m_szButtonNames[NUM_INSTRUMENT_BUTTONS]; // e.g. "left", "right", "middle C", "snare" CString m_sButtonNames[MAX_INSTRUMENT_BUTTONS]; // e.g. "left", "right", "middle C", "snare"
int m_iMenuButtons[NUM_MENU_BUTTONS]; // map from MenuButton to InstrumentButton int ButtonNameToIndex( const CString &sButtonName )
{
for( int i=0; i<m_iButtonsPerInstrument; i++ )
if( m_sButtonNames[i] == sButtonName )
return i;
return -1;
}
int m_iMenuButtons[NUM_MENU_BUTTONS]; // map from MenuButton to m_sButtonNames
int m_iNumStyleDefs; int m_iNumStyleDefs;
StyleDef m_StyleDefs[MAX_STYLES_PER_GAME]; StyleDef* m_pStyleDefs[MAX_STYLES_PER_GAME];
StyleDef* GetStyleDef( CString sStyle );
// graphic stuff // graphic stuff
CString GetPathToGraphic( const int iInstrumentButton, const GameButtonGraphic gbg ); int m_iNumSkinFolders;
CString m_sSkinFolders[MAX_SKIN_PATHS]; // path to skin folders relative to m_sGameDir
bool HasASkinNamed( CString sSkin )
{
for( int i=0; i<m_iNumSkinFolders; i++ )
if( m_sSkinFolders[i] == sSkin )
return true;
return false;
}
CString GetPathToGraphic( const CString sSkinName, const int iInstrumentButton, const GameButtonGraphic gbg );
CString ElementToGraphicSuffix( const GameButtonGraphic gbg ); CString ElementToGraphicSuffix( const GameButtonGraphic gbg );
+2 -2
View File
@@ -13,7 +13,7 @@ enum InstrumentNumber
{ {
INSTRUMENT_1 = 0, INSTRUMENT_1 = 0,
INSTRUMENT_2, INSTRUMENT_2,
NUM_INSTRUMENTS, // leave this at the end MAX_INSTRUMENTS, // leave this at the end
INSTRUMENT_NONE, INSTRUMENT_NONE,
}; };
@@ -35,7 +35,7 @@ enum InstrumentButton
INSTRUMENT_BUTTON_14, INSTRUMENT_BUTTON_14,
INSTRUMENT_BUTTON_15, INSTRUMENT_BUTTON_15,
INSTRUMENT_BUTTON_16, INSTRUMENT_BUTTON_16,
NUM_INSTRUMENT_BUTTONS, // leave this at the end MAX_INSTRUMENT_BUTTONS, // leave this at the end
INSTRUMENT_BUTTON_NONE INSTRUMENT_BUTTON_NONE
}; };
+69 -129
View File
@@ -11,6 +11,7 @@
*/ */
#include "GameManager.h" #include "GameManager.h"
#include "ErrorCatcher/ErrorCatcher.h"
GameManager* GAME = NULL; // global and accessable from anywhere in our program GameManager* GAME = NULL; // global and accessable from anywhere in our program
@@ -26,141 +27,49 @@ GameManager* GAME = NULL; // global and accessable from anywhere in our program
#define NUM_DANCE_PAD_BUTTONS 8 #define NUM_DANCE_PAD_BUTTONS 8
//
// ----------------------------------
// This is where all Games and Styles are definied.
// If you want to add support for new games or styles, do it here.
// ----------------------------------
//
GameDef g_GameDefs[] =
{
{
"dance", // m_szName
"Dance Dance Revolution", // m_szDescription
"", // m_szGraphicPath
2, // m_iNumInstruments
NUM_DANCE_PAD_BUTTONS, // m_iNumButtons
{ "Left", "Right", "Up", "Down", "UpLeft", "UpRight", "Next", "Back" }, // m_sButtonNames[NUM_INSTRUMENT_BUTTONS]
{ // m_iMenuButtons
DANCE_PAD_BUTTON_LEFT,
DANCE_PAD_BUTTON_RIGHT,
DANCE_PAD_BUTTON_UP,
DANCE_PAD_BUTTON_DOWN,
DANCE_PAD_BUTTON_NEXT,
DANCE_PAD_BUTTON_BACK,
},
5, // m_iNumStyleDefs
{ // StyleDef list
{ // StyleDef
"single", // m_szName
"single", // m_szReads
1, // m_iNumPlayers
4, // m_iNumTracks
{ // m_StyleInputToGameInput[NUM_PLAYERS][NUM_NOTE_COLS];
{ // player 1
{ 0, INSTRUMENT_1, DANCE_PAD_BUTTON_LEFT }, // column 1
{ 1, INSTRUMENT_1, DANCE_PAD_BUTTON_DOWN }, // column 2
{ 2, INSTRUMENT_1, DANCE_PAD_BUTTON_UP }, // column 3
{ 3, INSTRUMENT_1, DANCE_PAD_BUTTON_RIGHT }, // column 4
}
},
},
{ // StyleDef
"versus", // m_szName
"single", // m_szReads
1, // m_iNumPlayers
4, // m_iNumTracks
{ // m_StyleInputToGameInput[NUM_PLAYERS][NUM_NOTE_COLS];
{ // player 1
{ 0, INSTRUMENT_1, DANCE_PAD_BUTTON_LEFT }, // column 1
{ 1, INSTRUMENT_1, DANCE_PAD_BUTTON_DOWN }, // column 2
{ 2, INSTRUMENT_1, DANCE_PAD_BUTTON_UP }, // column 3
{ 3, INSTRUMENT_1, DANCE_PAD_BUTTON_RIGHT }, // column 4
},
{ // player 2
{ 0, INSTRUMENT_2, DANCE_PAD_BUTTON_LEFT }, // column 1
{ 1, INSTRUMENT_2, DANCE_PAD_BUTTON_DOWN }, // column 2
{ 2, INSTRUMENT_2, DANCE_PAD_BUTTON_UP }, // column 3
{ 3, INSTRUMENT_2, DANCE_PAD_BUTTON_RIGHT }, // column 4
}
},
},
{ // StyleDef
"double", // m_szName
"double", // m_szReads
1, // m_iNumPlayers
8, // m_iNumTracks
{ // m_StyleInputToGameInput[NUM_PLAYERS][NUM_NOTE_COLS];
{ // player 1
{ 0, INSTRUMENT_1, DANCE_PAD_BUTTON_LEFT }, // column 1
{ 1, INSTRUMENT_1, DANCE_PAD_BUTTON_DOWN }, // column 2
{ 2, INSTRUMENT_1, DANCE_PAD_BUTTON_UP }, // column 3
{ 3, INSTRUMENT_1, DANCE_PAD_BUTTON_RIGHT }, // column 4
{ 4, INSTRUMENT_2, DANCE_PAD_BUTTON_LEFT }, // column 5
{ 5, INSTRUMENT_2, DANCE_PAD_BUTTON_DOWN }, // column 6
{ 6, INSTRUMENT_2, DANCE_PAD_BUTTON_UP }, // column 7
{ 7, INSTRUMENT_2, DANCE_PAD_BUTTON_RIGHT }, // column 8
},
},
},
{ // StyleDef
"couple", // m_szName
"couple", // m_szReads
1, // m_iNumPlayers
8, // m_iNumTracks
{ // m_StyleInputToGameInput[NUM_PLAYERS][NUM_NOTE_COLS];
{ // player 1
{ 0, INSTRUMENT_1, DANCE_PAD_BUTTON_LEFT }, // column 1
{ 1, INSTRUMENT_1, DANCE_PAD_BUTTON_DOWN }, // column 2
{ 2, INSTRUMENT_1, DANCE_PAD_BUTTON_UP }, // column 3
{ 3, INSTRUMENT_1, DANCE_PAD_BUTTON_RIGHT }, // column 4
},
{ // player 2
{ 4, INSTRUMENT_2, DANCE_PAD_BUTTON_LEFT }, // column 1
{ 5, INSTRUMENT_2, DANCE_PAD_BUTTON_DOWN }, // column 2
{ 6, INSTRUMENT_2, DANCE_PAD_BUTTON_UP }, // column 3
{ 7, INSTRUMENT_2, DANCE_PAD_BUTTON_RIGHT }, // column 4
}
},
},
{ // StyleDef
"solo", // m_szName
"solo", // m_szReads
1, // m_iNumPlayers
6, // m_iNumTracks
{ // m_StyleInputToGameInput[NUM_PLAYERS][NUM_NOTE_COLS];
{ // player 1
{ 0, INSTRUMENT_1, DANCE_PAD_BUTTON_LEFT }, // column 1
{ 1, INSTRUMENT_1, DANCE_PAD_BUTTON_UPLEFT }, // column 2
{ 2, INSTRUMENT_1, DANCE_PAD_BUTTON_DOWN }, // column 3
{ 3, INSTRUMENT_1, DANCE_PAD_BUTTON_UP }, // column 4
{ 4, INSTRUMENT_1, DANCE_PAD_BUTTON_UPRIGHT }, // column 5
{ 5, INSTRUMENT_1, DANCE_PAD_BUTTON_RIGHT }, // column 6
}
},
},
}
}
};
GameManager::GameManager() GameManager::GameManager()
{ {
m_iNumGameDefs = 0;
ReadGamesAndStylesFromDir( "Games" );
SwitchGame( "dance" ); SwitchGame( "dance" );
SwitchStyle( "single" ); SwitchStyle( "single" );
} }
GameManager::~GameManager()
{
for( int i=0; i<m_iNumGameDefs; i++ )
delete m_pGameDefs[i];
}
void GameManager::ReadGamesAndStylesFromDir( CString sDir )
{
// trim off the trailing slash if any
sDir.TrimRight( "/\\" );
// Find all group directories in "Games" folder
CStringArray arrayGameNames;
GetDirListing( sDir+"\\*.*", arrayGameNames, true );
SortCStringArray( arrayGameNames );
for( int i=0; i< arrayGameNames.GetSize(); i++ ) // for each dir in /Songs/
{
CString sGameName = arrayGameNames[i];
if( 0 == stricmp( sGameName, "cvs" ) ) // the directory called "CVS"
continue; // ignore it
CString sGameDir = ssprintf( "%s\\%s", sDir, sGameName ); // game file must have same name as dir
m_pGameDefs[m_iNumGameDefs++] = new GameDef(sGameDir);
}
}
GameDef* GameManager::GetGameDef( CString sGame ) GameDef* GameManager::GetGameDef( CString sGame )
{ {
for( int i=0; i<NUM_GAME_DEFS; i++ ) for( int i=0; i<m_iNumGameDefs; i++ )
{ {
if( g_GameDefs[i].m_szName == sGame ) if( m_pGameDefs[i]->m_sName == sGame )
return &g_GameDefs[i]; return m_pGameDefs[i];
} }
return NULL; return NULL;
@@ -170,16 +79,47 @@ StyleDef* GameManager::GetStyleDef( CString sGame, CString sStyle )
{ {
GameDef* pGameDef = GetGameDef( sGame ); GameDef* pGameDef = GetGameDef( sGame );
for( int i=0; i<pGameDef->m_iNumStyleDefs; i++ ) return pGameDef->GetStyleDef( sStyle );
{
if( pGameDef->m_StyleDefs[i].m_szName == sStyle )
return &pGameDef->m_StyleDefs[i];
}
return NULL; return NULL;
} }
void GameManager::GetGameNames( CStringArray &arrayGameNames )
{
for( int i=0; i<MAX_GAME_DEFS; i++ )
arrayGameNames.Add( m_pGameDefs[i]->m_sName );
}
void GameManager::GetStyleNames( CString sGameName, CStringArray &arrayStyleNames )
{
GameDef* pGameDef = GetGameDef( sGameName );
for( int i=0; i<pGameDef->m_iNumStyleDefs; i++ )
{
arrayStyleNames.Add( pGameDef->m_pStyleDefs[i]->m_sName );
}
}
void GameManager::GetSkinNames( CString sGameName, CStringArray &arraySkinNames )
{
GameDef* pGameDef = GetGameDef( sGameName );
for( int i=0; i<pGameDef->m_iNumSkinFolders; i++ )
arraySkinNames.Add( pGameDef->m_sSkinFolders[i] );
}
void GameManager::SwitchSkin( PlayerNumber p, CString sSkin )
{
if( !m_pCurrentGameDef->HasASkinNamed( sSkin ) )
FatalError( "The current game doesn't have a skin named '%s'.", sSkin );
m_sCurrentSkin[p] = sSkin;
}
bool GameManager::IsPlayerEnabled( PlayerNumber PlayerNo ) bool GameManager::IsPlayerEnabled( PlayerNumber PlayerNo )
{ {
StyleDef* pStyleDef = GetCurrentStyleDef(); StyleDef* pStyleDef = GetCurrentStyleDef();
+17 -3
View File
@@ -14,19 +14,24 @@
#include "StyleDef.h" #include "StyleDef.h"
const int NUM_GAME_DEFS = 1; const int MAX_GAME_DEFS = 10;
class GameManager class GameManager
{ {
public: public:
GameManager(); GameManager();
~GameManager();
void ReadGamesAndStylesFromDir( CString sDir );
void SwitchGame( CString sGame ) void SwitchGame( CString sGame )
{ {
m_sCurrentGame = sGame; m_sCurrentGame = sGame;
m_pCurrentGameDef = GetGameDef( sGame ); m_pCurrentGameDef = GetGameDef( sGame );
ASSERT( m_pCurrentGameDef != NULL ); ASSERT( m_pCurrentGameDef != NULL );
for( int p=0; p<NUM_PLAYERS; p++ )
m_sCurrentSkin[p] = m_pCurrentGameDef->m_sSkinFolders[0];
}; };
void SwitchStyle( CString sStyle ) void SwitchStyle( CString sStyle )
{ {
@@ -34,25 +39,34 @@ public:
m_pCurrentStyleDef = GetStyleDef( m_sCurrentGame, sStyle ); m_pCurrentStyleDef = GetStyleDef( m_sCurrentGame, sStyle );
ASSERT( m_pCurrentStyleDef != NULL ); ASSERT( m_pCurrentStyleDef != NULL );
}; };
void SwitchSkin( PlayerNumber p, CString sSkin );
CString m_sCurrentGame; // currently only "dance" CString m_sCurrentGame; // currently only "dance"
CString m_sCurrentStyle; // currently only "single", "versus", "double", "couple", "solo" CString m_sCurrentStyle; // currently only "single", "versus", "double", "couple", "solo"
inline GameDef* GetCurrentGameDef() { return m_pCurrentGameDef; }; inline GameDef* GetCurrentGameDef() { return m_pCurrentGameDef; };
inline StyleDef* GetCurrentStyleDef() { return m_pCurrentStyleDef; }; inline StyleDef* GetCurrentStyleDef() { return m_pCurrentStyleDef; };
CString m_sCurrentSkin[NUM_PLAYERS]; //
void GetGameNames( CStringArray &arrayGameNames );
void GetStyleNames( CString sGameName, CStringArray &arrayStyleNames );
void GetSkinNames( CString sGameName, CStringArray &arraySkinNames );
bool IsPlayerEnabled( PlayerNumber PlayerNo ); bool IsPlayerEnabled( PlayerNumber PlayerNo );
// graphic stuff // graphic stuff
CString GetPathToGraphic( const PlayerNumber p, const NoteColumn col, const GameButtonGraphic gbg ) CString GetPathToGraphic( const PlayerNumber p, const ColumnNumber col, const GameButtonGraphic gbg )
{ {
StyleInput si( p, col ); StyleInput si( p, col );
GameInput gi = GetCurrentStyleDef()->StyleInputToGameInput( si ); GameInput gi = GetCurrentStyleDef()->StyleInputToGameInput( si );
InstrumentButton b = gi.button; InstrumentButton b = gi.button;
return GetCurrentGameDef()->GetPathToGraphic( b, gbg ); return GetCurrentGameDef()->GetPathToGraphic( m_sCurrentSkin[p], b, gbg );
} }
protected: protected:
int m_iNumGameDefs;
GameDef* m_pGameDefs[MAX_GAME_DEFS];
GameDef* m_pCurrentGameDef; GameDef* m_pCurrentGameDef;
StyleDef* m_pCurrentStyleDef; StyleDef* m_pCurrentStyleDef;
+2 -2
View File
@@ -13,7 +13,7 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "ScreenDimensions.h" #include "ScreenDimensions.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "ColorArrow.h" #include "ColorNote.h"
#include "ArrowEffects.h" #include "ArrowEffects.h"
#include "GameManager.h" #include "GameManager.h"
@@ -31,7 +31,7 @@ void GhostArrowRow::Load( PlayerOptions po )
StyleDef* pStyleDef = GAME->GetCurrentStyleDef(); StyleDef* pStyleDef = GAME->GetCurrentStyleDef();
GameDef* pGameDef = GAME->GetCurrentGameDef(); GameDef* pGameDef = GAME->GetCurrentGameDef();
m_iNumCols = pStyleDef->GetColsPerPlayer(); m_iNumCols = pStyleDef->m_iColsPerPlayer;
// init arrows // init arrows
for( int c=0; c<m_iNumCols; c++ ) for( int c=0; c<m_iNumCols; c++ )
+1 -1
View File
@@ -3,7 +3,7 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: GrayArrow Class: GrayArrow
Desc: A gray arrow that "receives" ColorArrows. Desc: A gray arrow that "receives" ColorNotes.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
Ben Nordstrom Ben Nordstrom
+1 -1
View File
@@ -2,7 +2,7 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: GrayArrow Class: GrayArrow
Desc: A gray arrow that "receives" ColorArrows. Desc: A gray arrow that "receives" ColorNotes.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
Ben Nordstrom Ben Nordstrom
+2 -2
View File
@@ -14,7 +14,7 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "ScreenDimensions.h" #include "ScreenDimensions.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "ColorArrow.h" #include "ColorNote.h"
#include "ArrowEffects.h" #include "ArrowEffects.h"
#include "GameManager.h" #include "GameManager.h"
@@ -31,7 +31,7 @@ void GrayArrowRow::Load( PlayerOptions po )
StyleDef* pStyleDef = GAME->GetCurrentStyleDef(); StyleDef* pStyleDef = GAME->GetCurrentStyleDef();
GameDef* pGameDef = GAME->GetCurrentGameDef(); GameDef* pGameDef = GAME->GetCurrentGameDef();
m_iNumCols = pStyleDef->GetColsPerPlayer(); m_iNumCols = pStyleDef->m_iColsPerPlayer;
// init arrow rotations // init arrow rotations
for( int c=0; c<m_iNumCols; c++ ) for( int c=0; c<m_iNumCols; c++ )
+32 -5
View File
@@ -6,6 +6,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -17,14 +18,40 @@
#include "GameConstants.h" #include "GameConstants.h"
float RADAR_VALUE_ROTATION( int iValueIndex ) { return D3DX_PI/2 + D3DX_PI*2 / 5.0f * iValueIndex; }
GrooveRadar::GrooveRadar() GrooveRadar::GrooveRadar()
{ {
m_sprRadarBase.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_RADAR_BASE) ); m_sprRadarBase.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_RADAR_BASE) );
this->AddActor( &m_sprRadarBase ); this->AddActor( &m_sprRadarBase );
m_sprRadarWords.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_RADAR_WORDS) ); for( int c=0; c<NUM_RADAR_CATEGORIES; c++ )
m_sprRadarWords.SetY( -10 ); {
this->AddActor( &m_sprRadarWords ); const float fRadius = m_sprRadarBase.GetZoomedHeight()/2.0f;
const float fRotation = RADAR_VALUE_ROTATION(c);
float fX = cosf(fRotation) * fRadius;
// push the labels out a little
switch( c )
{
case 0: break;
case 1:
case 4: if( fabsf(fX) > 1 ) fX += fX/fabsf(fX) * 40; break;
case 2:
case 3: if( fabsf(fX) > 1 ) fX += fX/fabsf(fX) * 50; break;
default: ASSERT( false );
}
const float fY = -sinf(fRotation) * fRadius * 1.15f;
m_sprRadarLabels[c].Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_RADAR_WORDS) );
m_sprRadarLabels[c].StopAnimating();
m_sprRadarLabels[c].SetState( c );
m_sprRadarLabels[c].SetXY( fX, fY );
this->AddActor( &m_sprRadarLabels[c] );
}
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
@@ -112,7 +139,7 @@ void GrooveRadar::RenderPrimitives()
const int c = i%NUM_RADAR_CATEGORIES; const int c = i%NUM_RADAR_CATEGORIES;
const float fDistFromCenter = const float fDistFromCenter =
( m_fValuesOld[p][c] * (1-m_PercentTowardNew[p]) + m_fValuesNew[p][c] * m_PercentTowardNew[p] ) * fRadius; ( m_fValuesOld[p][c] * (1-m_PercentTowardNew[p]) + m_fValuesNew[p][c] * m_PercentTowardNew[p] ) * fRadius;
const float fRotation = D3DX_PI/2 + D3DX_PI*2 / 5.0f * i; const float fRotation = RADAR_VALUE_ROTATION(i);
const float fX = cosf(fRotation) * fDistFromCenter; const float fX = cosf(fRotation) * fDistFromCenter;
const float fY = -sinf(fRotation) * fDistFromCenter; const float fY = -sinf(fRotation) * fDistFromCenter;
@@ -137,7 +164,7 @@ void GrooveRadar::RenderPrimitives()
( m_fValuesOld[p][c] * (1-m_PercentTowardNew[p]) + m_fValuesNew[p][c] * m_PercentTowardNew[p] ) * fRadius; ( m_fValuesOld[p][c] * (1-m_PercentTowardNew[p]) + m_fValuesNew[p][c] * m_PercentTowardNew[p] ) * fRadius;
const float fDistFromCenterInner = fDistFromCenter-2; const float fDistFromCenterInner = fDistFromCenter-2;
const float fDistFromCenterOutter = fDistFromCenter+2; const float fDistFromCenterOutter = fDistFromCenter+2;
const float fRotation = D3DX_PI/2 + D3DX_PI*2 / 5.0f * i; const float fRotation = RADAR_VALUE_ROTATION(i);
const float fXInner = cosf(fRotation) * fDistFromCenterInner; const float fXInner = cosf(fRotation) * fDistFromCenterInner;
const float fXOutter = cosf(fRotation) * fDistFromCenterOutter; const float fXOutter = cosf(fRotation) * fDistFromCenterOutter;
const float fYInner = -sinf(fRotation) * fDistFromCenterInner; const float fYInner = -sinf(fRotation) * fDistFromCenterInner;
+3 -9
View File
@@ -1,3 +1,4 @@
#pragma once
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: GrooveRadar Class: GrooveRadar
@@ -5,13 +6,10 @@
Desc: The song's GrooveRadar displayed in SelectSong. Desc: The song's GrooveRadar displayed in SelectSong.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#ifndef _GrooveRadar_H_
#define _GrooveRadar_H_
#include "ActorFrame.h" #include "ActorFrame.h"
#include "Sprite.h" #include "Sprite.h"
#include "Song.h" #include "Song.h"
@@ -40,9 +38,5 @@ protected:
float m_fValuesOld[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; float m_fValuesOld[NUM_PLAYERS][NUM_RADAR_CATEGORIES];
Sprite m_sprRadarBase; Sprite m_sprRadarBase;
Sprite m_sprRadarWords; Sprite m_sprRadarLabels[NUM_RADAR_CATEGORIES];
}; };
#endif
+6 -6
View File
@@ -79,9 +79,9 @@ void InputMapper::SaveMappingsToDisk()
// iterate over our input map and write all mappings to the ini file // iterate over our input map and write all mappings to the ini file
for( int i=0; i<NUM_INSTRUMENTS; i++ ) for( int i=0; i<MAX_INSTRUMENTS; i++ )
{ {
for( int j=0; j<NUM_INSTRUMENT_BUTTONS; j++ ) for( int j=0; j<MAX_INSTRUMENT_BUTTONS; j++ )
{ {
CString sNameString, sValueString; CString sNameString, sValueString;
@@ -118,9 +118,9 @@ void InputMapper::ClearFromInputMap( DeviceInput DeviceI )
{ {
// search for where this DeviceI maps to // search for where this DeviceI maps to
for( int p=0; p<NUM_INSTRUMENTS; p++ ) for( int p=0; p<MAX_INSTRUMENTS; p++ )
{ {
for( int b=0; b<NUM_INSTRUMENT_BUTTONS; b++ ) for( int b=0; b<MAX_INSTRUMENT_BUTTONS; b++ )
{ {
for( int s=0; s<NUM_GAME_TO_DEVICE_SLOTS; s++ ) for( int s=0; s<NUM_GAME_TO_DEVICE_SLOTS; s++ )
{ {
@@ -156,9 +156,9 @@ void InputMapper::UpdateTempDItoGI()
// repopulate m_tempDItoGI // repopulate m_tempDItoGI
for( int n=0; n<NUM_INSTRUMENTS; n++ ) for( int n=0; n<MAX_INSTRUMENTS; n++ )
{ {
for( int b=0; b<NUM_INSTRUMENT_BUTTONS; b++ ) for( int b=0; b<MAX_INSTRUMENT_BUTTONS; b++ )
{ {
for( int s=0; s<NUM_GAME_TO_DEVICE_SLOTS; s++ ) for( int s=0; s<NUM_GAME_TO_DEVICE_SLOTS; s++ )
{ {
+1 -1
View File
@@ -66,7 +66,7 @@ protected:
CString m_sCurrentGame; CString m_sCurrentGame;
// all the DeviceInputs that map to a GameInput // all the DeviceInputs that map to a GameInput
DeviceInput m_GItoDI[NUM_INSTRUMENTS][NUM_INSTRUMENT_BUTTONS][NUM_GAME_TO_DEVICE_SLOTS]; DeviceInput m_GItoDI[MAX_INSTRUMENTS][MAX_INSTRUMENT_BUTTONS][NUM_GAME_TO_DEVICE_SLOTS];
// lookup for efficiency from a DeviceInput to a GameInput // lookup for efficiency from a DeviceInput to a GameInput
// This is repopulated every time m_PItoDI changes by calling UpdateTempDItoPI(). // This is repopulated every time m_PItoDI changes by calling UpdateTempDItoPI().
+198
View File
@@ -0,0 +1,198 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
Class: LifeMeterBar
Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "LifeMeterBar.h"
#include "ThemeManager.h"
const int NUM_SECTIONS = 3;
const float SECTION_WIDTH = 1.0f/NUM_SECTIONS;
LifeMeterBar::LifeMeterBar()
{
}
void LifeMeterBar::SetPlayerOptions(const PlayerOptions& po) {
m_po = po;
//m_fLifePercentage = m_po.m_fInitialLifePercentage;
m_fLifePercentage = 0.5f;
m_fTrailingLifePercentage = 0;
m_fLifeVelocity = 0;
}
void LifeMeterBar::ChangeLife( TapNoteScore score )
{
switch( score )
{
case TNS_PERFECT: m_fLifePercentage += m_po.m_fLifeAdjustments[m_po.LIFE_PERFECT]; break;
case TNS_GREAT: m_fLifePercentage += m_po.m_fLifeAdjustments[m_po.LIFE_GREAT]; break;
case TNS_GOOD: m_fLifePercentage += m_po.m_fLifeAdjustments[m_po.LIFE_GOOD]; break;
case TNS_BOO: m_fLifePercentage += m_po.m_fLifeAdjustments[m_po.LIFE_BOO]; break;
case TNS_MISS: m_fLifePercentage += m_po.m_fLifeAdjustments[m_po.LIFE_MISS]; break;
}
m_fLifePercentage = clamp( m_fLifePercentage, 0, 1 );
}
float LifeMeterBar::GetLifePercentage()
{
return m_fLifePercentage;
}
void LifeMeterBar::Update( float fDeltaTime )
{
const float fDelta = m_fLifePercentage - m_fTrailingLifePercentage;
m_fLifeVelocity += fDelta * fDeltaTime;
m_fLifeVelocity = clamp( m_fLifeVelocity, -0.15f, 0.15f );
m_fLifeVelocity *= 1-fDeltaTime*2;
if( fDelta != 0 )
{
int j=9;
}
if( fabsf(m_fLifeVelocity) < 0.01f && fabsf(fDelta) < 0.01f )
{
m_fTrailingLifePercentage += fDelta/2;
m_fLifeVelocity = 0;
}
else
{
m_fTrailingLifePercentage += m_fLifeVelocity * fDeltaTime*4;
m_fTrailingLifePercentage = clamp( m_fTrailingLifePercentage, 0, 1 );
}
}
const D3DXCOLOR COLOR_NORMAL_1 = D3DXCOLOR(1,1,1,1);
const D3DXCOLOR COLOR_NORMAL_2 = D3DXCOLOR(0,1,0,1);
const D3DXCOLOR COLOR_FULL_1 = D3DXCOLOR(1,0,0,1);
const D3DXCOLOR COLOR_FULL_2 = D3DXCOLOR(1,1,0,1);
D3DXCOLOR LifeMeterBar::GetColor( float fPercentIntoSection )
{
const float fPercentColor1 = fabsf( fPercentIntoSection*2 - 1 );
if( m_fLifePercentage == 1 )
return COLOR_FULL_1 * fPercentColor1 + COLOR_FULL_2 * (1-fPercentColor1);
else
return COLOR_NORMAL_1 * fPercentColor1 + COLOR_NORMAL_2 * (1-fPercentColor1);
}
void LifeMeterBar::RenderPrimitives()
{
// make the object in logical units centered at the origin
LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer();
CUSTOMVERTEX* v;
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
int iNumV = 0;
float fPercentIntoSection = (GetTickCount()/300.0f)*SECTION_WIDTH;
fPercentIntoSection -= (int)fPercentIntoSection;
fPercentIntoSection = 1-fPercentIntoSection;
fPercentIntoSection -= (int)fPercentIntoSection;
ASSERT( fPercentIntoSection >= 0 && fPercentIntoSection < 1 );
float fX = - 0.5f;
while( fX < m_fTrailingLifePercentage-0.5f )
{
//
// draw middle
//
v[iNumV++].p = D3DXVECTOR3( fX, -0.5f, 0 );
v[iNumV++].p = D3DXVECTOR3( fX, 0.5f, 0 );
iNumV -= 2;
const D3DXCOLOR color = GetColor( fPercentIntoSection );
v[iNumV++].color = color;
v[iNumV++].color = color;
if( fPercentIntoSection < 0.5f )
{
const float fPercentToAdd = 0.5f-fPercentIntoSection;
fPercentIntoSection += fPercentToAdd;
fX += fPercentToAdd*SECTION_WIDTH;
}
else if( fPercentIntoSection < 1.0f )
{
const float fPercentToAdd = 1.0f-fPercentIntoSection;
fPercentIntoSection = 0;
fX += fPercentToAdd*SECTION_WIDTH;
}
else
ASSERT( false );
}
const float fXToSubtract = fX - (m_fTrailingLifePercentage-0.5f);
fX -= fXToSubtract;
fPercentIntoSection -= fXToSubtract/SECTION_WIDTH;
if( fPercentIntoSection < 0 )
fPercentIntoSection += 1;
//
// draw right edge
//
v[iNumV++].p = D3DXVECTOR3( fX, -0.5f, 0 );
v[iNumV++].p = D3DXVECTOR3( fX, 0.5f, 0 );
iNumV -= 2;
const D3DXCOLOR color = GetColor( fPercentIntoSection );
v[iNumV++].color = color;
v[iNumV++].color = color;
//
// draw black filler
//
v[iNumV++].p = D3DXVECTOR3( fX, -0.5f, 0 );
v[iNumV++].p = D3DXVECTOR3( fX, 0.5f, 0 );
v[iNumV++].p = D3DXVECTOR3( 0.5f, -0.5f, 0 );
v[iNumV++].p = D3DXVECTOR3( 0.5f, 0.5f, 0 );
iNumV -= 4;
const D3DXCOLOR colorBlack = D3DXCOLOR(0,0,0,1);
v[iNumV++].color = colorBlack;
v[iNumV++].color = colorBlack;
v[iNumV++].color = colorBlack;
v[iNumV++].color = colorBlack;
pVB->Unlock();
LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice();
pd3dDevice->SetTexture( 0, NULL );
// set texture and alpha properties
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2 );
pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
// finally! Pump those triangles!
pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX );
pd3dDevice->SetStreamSource( 0, pVB, sizeof(CUSTOMVERTEX) );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, iNumV-2 );
}
+42
View File
@@ -0,0 +1,42 @@
#pragma once
/*
-----------------------------------------------------------------------------
Class: LifeMeterBar
Desc: A graphic displayed in the LifeMeterBar during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ActorFrame.h"
#include "Sprite.h"
#include "ScoreDisplayRolling.h"
class LifeMeterBar : public ActorFrame
{
public:
LifeMeterBar();
void SetPlayerOptions(const PlayerOptions& po);
virtual void Update( float fDeltaTime );
virtual void RenderPrimitives();
void SetBeat( float fSongBeat ) { m_fSongBeat = fSongBeat; };
void ChangeLife( TapNoteScore score );
float GetLifePercentage();
private:
D3DXCOLOR GetColor( float fPercentIntoSection );
float m_fSongBeat;
float m_fLifePercentage;
float m_fTrailingLifePercentage; // this approaches m_fLifePercentage
float m_fLifeVelocity; // how m_fTrailingLifePercentage approaches m_fLifePercentage
PlayerOptions m_po;
};
+71 -37
View File
@@ -18,19 +18,22 @@
#include "RageMusic.h" #include "RageMusic.h"
#include "WindowManager.h" // for sending SM_PlayMusicSample #include "WindowManager.h" // for sending SM_PlayMusicSample
#include "RageHelper.h" #include "RageHelper.h"
#include "GameConstants.h"
const float SWITCH_MUSIC_TIME = 0.3f; const float SWITCH_MUSIC_TIME = 0.3f;
const float SORT_ICON_ON_SCREEN_X = 146; const float SORT_ICON_ON_SCREEN_X = -140;
const float SORT_ICON_ON_SCREEN_Y = 0; const float SORT_ICON_ON_SCREEN_Y = -180;
const float SORT_ICON_OFF_SCREEN_X = SORT_ICON_ON_SCREEN_X + 64; const float SORT_ICON_OFF_SCREEN_X = SORT_ICON_ON_SCREEN_X;
const float SORT_ICON_OFF_SCREEN_Y = SORT_ICON_ON_SCREEN_Y; const float SORT_ICON_OFF_SCREEN_Y = SORT_ICON_ON_SCREEN_Y - 64;
const float SCORE_X = 86;
const float SCORE_Y[NUM_PLAYERS] = { -34, 34 };
D3DXCOLOR COLOR_BANNER_TINTS[] = { D3DXCOLOR COLOR_BANNER_TINTS[] = {
@@ -147,25 +150,14 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID )
break; break;
case TYPE_SONG: case TYPE_SONG:
{ {
m_Banner.LoadFromSong( m_pSong ); m_Banner.LoadFromSong( m_pSong );
m_Banner.SetDiffuseColor( m_colorTint ); D3DXCOLOR color = m_colorTint;
color.r += 0.4f;
color.g += 0.4f;
color.b += 0.4f;
m_Banner.SetDiffuseColor( color );
m_MusicStatusDisplay.SetType( m_MusicStatusDisplayType ); m_MusicStatusDisplay.SetType( m_MusicStatusDisplayType );
for( int p=0; p<NUM_PLAYERS; p++ ) RefreshGrades();
{
if( GAME->IsPlayerEnabled( (PlayerNumber)p ) )
{
const DifficultyClass dc = PREFS->m_PreferredDifficultyClass[p];
const Grade grade = m_pSong->GetGradeForDifficultyClass( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, dc );
m_GradeDisplay[p].SetGrade( grade );
m_GradeDisplay[p].SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
}
else // !IsPlayerEnabled
{
m_GradeDisplay[p].SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
}
}
} }
break; break;
default: default:
@@ -173,8 +165,24 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID )
} }
} }
void WheelItemDisplay::RefreshGrades()
{
for( int p=0; p<NUM_PLAYERS; p++ )
{
if( GAME->IsPlayerEnabled( (PlayerNumber)p ) )
{
const DifficultyClass dc = PREFS->m_PreferredDifficultyClass[p];
ASSERT( m_pSong != NULL );
const Grade grade = m_pSong->GetGradeForDifficultyClass( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, dc );
m_GradeDisplay[p].SetGrade( grade );
m_GradeDisplay[p].SetDiffuseColor( PLAYER_COLOR[p] );
}
else // !IsPlayerEnabled
{
m_GradeDisplay[p].SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
}
}
}
void WheelItemDisplay::SetDiffuseColor( D3DXCOLOR c ) void WheelItemDisplay::SetDiffuseColor( D3DXCOLOR c )
@@ -246,18 +254,33 @@ MusicWheel::MusicWheel()
{ {
HELPER.Log( "MusicWheel::MusicWheel()" ); HELPER.Log( "MusicWheel::MusicWheel()" );
for( int p=0; p<NUM_PLAYERS; p++ )
{
m_sprHighScoreFrame[p].Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SCORE_FRAME) );
m_sprHighScoreFrame[p].SetXY( SCORE_X, SCORE_Y[p] );
this->AddActor( &m_sprHighScoreFrame[p] );
m_HighScore[p].SetXY( SCORE_X, SCORE_Y[p]*0.97f );
m_HighScore[p].SetZoom( 0.6f );
this->AddActor( &m_HighScore[p] );
}
m_sprHighScoreFrame[1].SetZoomY( -1 ); // flip vertically
m_sprSelectionOverlay.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SONG_HIGHLIGHT) ); m_sprSelectionOverlay.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SONG_HIGHLIGHT) );
m_sprSelectionOverlay.SetXY( 0, 0 ); m_sprSelectionOverlay.SetXY( 0, 0 );
m_sprSelectionOverlay.SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); // invisible m_sprSelectionOverlay.SetDiffuseColor( D3DXCOLOR(1,1,1,0.3f) );
m_sprSelectionOverlay.SetEffectGlowing( 1.5f, D3DXCOLOR(1,1,1,0.1f), D3DXCOLOR(1,1,1,1) ); m_sprSelectionOverlay.SetEffectGlowing( 1.0f, D3DXCOLOR(1,1,1,0.2f), D3DXCOLOR(1,1,1,0.8f) );
this->AddActor( &m_sprSelectionOverlay );
m_MusicSortDisplay.SetZ( -2 );
m_MusicSortDisplay.SetXY( SORT_ICON_ON_SCREEN_X, SORT_ICON_ON_SCREEN_Y ); m_MusicSortDisplay.SetXY( SORT_ICON_ON_SCREEN_X, SORT_ICON_ON_SCREEN_Y );
m_MusicSortDisplay.SetEffectGlowing( 1.0f );
this->AddActor( &m_MusicSortDisplay ); this->AddActor( &m_MusicSortDisplay );
m_soundChangeMusic.Load( THEME->GetPathTo(SOUND_SWITCH_MUSIC) );
m_soundChangeMusic.Load( THEME->GetPathTo(SOUND_SWITCH_MUSIC), 10 );
m_soundChangeSort.Load( THEME->GetPathTo(SOUND_SWITCH_SORT) ); m_soundChangeSort.Load( THEME->GetPathTo(SOUND_SWITCH_SORT) );
m_soundExpand.Load( THEME->GetPathTo(SOUND_EXPAND) ); m_soundExpand.Load( THEME->GetPathTo(SOUND_EXPAND) );
@@ -606,6 +629,22 @@ void MusicWheel::RebuildWheelItemDisplays()
} }
void MusicWheel::NotesChanged( PlayerNumber pn ) // update grade graphics and top score
{
DifficultyClass dc = PREFS->m_PreferredDifficultyClass[pn];
Song* pSong = SONG->m_pCurSong;
NoteMetadata* m_pNoteMetadata = SONG->m_pCurNoteMetadata[pn];
m_HighScore[pn].SetScore( (float)m_pNoteMetadata->m_iTopScore );
for( int i=0; i<NUM_WHEEL_ITEMS_TO_DRAW; i++ )
{
WheelItemDisplay& display = m_WheelItemDisplays[i];
display.RefreshGrades();
}
}
void MusicWheel::RenderPrimitives() void MusicWheel::RenderPrimitives()
{ {
@@ -627,9 +666,6 @@ void MusicWheel::RenderPrimitives()
} }
m_sprSelectionOverlay.Draw();
ActorFrame::RenderPrimitives(); ActorFrame::RenderPrimitives();
} }
@@ -637,8 +673,6 @@ void MusicWheel::Update( float fDeltaTime )
{ {
ActorFrame::Update( fDeltaTime ); ActorFrame::Update( fDeltaTime );
m_sprSelectionOverlay.Update( fDeltaTime );
for( int i=0; i<NUM_WHEEL_ITEMS_TO_DRAW; i++ ) for( int i=0; i<NUM_WHEEL_ITEMS_TO_DRAW; i++ )
{ {
@@ -772,7 +806,7 @@ void MusicWheel::PrevMusic()
m_WheelState = STATE_SWITCHING_MUSIC; m_WheelState = STATE_SWITCHING_MUSIC;
m_fTimeLeftInState = SWITCH_MUSIC_TIME; m_fTimeLeftInState = SWITCH_MUSIC_TIME;
m_soundChangeMusic.PlayRandom(); m_soundChangeMusic.Play();
} }
void MusicWheel::NextMusic() void MusicWheel::NextMusic()
@@ -805,7 +839,7 @@ void MusicWheel::NextMusic()
m_WheelState = STATE_SWITCHING_MUSIC; m_WheelState = STATE_SWITCHING_MUSIC;
m_fTimeLeftInState = SWITCH_MUSIC_TIME; m_fTimeLeftInState = SWITCH_MUSIC_TIME;
m_soundChangeMusic.PlayRandom(); m_soundChangeMusic.Play();
} }
void MusicWheel::NextSort() void MusicWheel::NextSort()
@@ -822,7 +856,7 @@ void MusicWheel::NextSort()
MUSIC->Stop(); MUSIC->Stop();
m_soundChangeSort.PlayRandom(); m_soundChangeSort.Play();
m_MusicSortDisplay.BeginTweening( FADE_TIME, TWEEN_BIAS_END ); m_MusicSortDisplay.BeginTweening( FADE_TIME, TWEEN_BIAS_END );
m_MusicSortDisplay.SetTweenXY( SORT_ICON_OFF_SCREEN_X, SORT_ICON_OFF_SCREEN_Y ); m_MusicSortDisplay.SetTweenXY( SORT_ICON_OFF_SCREEN_X, SORT_ICON_OFF_SCREEN_Y );
@@ -846,7 +880,7 @@ bool MusicWheel::Select()
RebuildWheelItemDisplays(); RebuildWheelItemDisplays();
m_soundExpand.PlayRandom(); m_soundExpand.Play();
m_iSelection = 0; // reset in case we can't find the last selected song m_iSelection = 0; // reset in case we can't find the last selected song
+11 -5
View File
@@ -26,6 +26,8 @@
#include "MusicSortDisplay.h" #include "MusicSortDisplay.h"
#include "MusicStatusDisplay.h" #include "MusicStatusDisplay.h"
#include "Window.h" // for WindowMessage #include "Window.h" // for WindowMessage
#include "ScoreDisplayRolling.h" // for WindowMessage
const int NUM_WHEEL_ITEMS_TO_DRAW = 11; const int NUM_WHEEL_ITEMS_TO_DRAW = 11;
@@ -63,7 +65,6 @@ public:
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void RenderPrimitives(); virtual void RenderPrimitives();
void SetDiffuseColor( D3DXCOLOR c );
CString GetSectionName() CString GetSectionName()
{ {
@@ -71,6 +72,8 @@ public:
}; };
void LoadFromWheelItemData( WheelItemData* pWID ); void LoadFromWheelItemData( WheelItemData* pWID );
void RefreshGrades();
void SetDiffuseColor( D3DXCOLOR c );
// for a section // for a section
Sprite m_sprSectionBar; Sprite m_sprSectionBar;
@@ -101,6 +104,7 @@ public:
void PrevMusic(); void PrevMusic();
void NextMusic(); void NextMusic();
void NextSort(); void NextSort();
void NotesChanged( PlayerNumber pn ); // update grade graphics and top score
float GetBannerY( float fPosOffsetsFromMiddle ); float GetBannerY( float fPosOffsetsFromMiddle );
float GetBannerBrightness( float fPosOffsetsFromMiddle ); float GetBannerBrightness( float fPosOffsetsFromMiddle );
@@ -121,6 +125,8 @@ protected:
Sprite m_sprSelectionOverlay; Sprite m_sprSelectionOverlay;
MusicSortDisplay m_MusicSortDisplay; MusicSortDisplay m_MusicSortDisplay;
Sprite m_sprHighScoreFrame[NUM_PLAYERS];
ScoreDisplayRolling m_HighScore[NUM_PLAYERS];
SongSortOrder m_SortOrder; SongSortOrder m_SortOrder;
@@ -148,9 +154,9 @@ protected:
// having sounds here causes a crash in Bass. What the heck!?!?! // having sounds here causes a crash in Bass. What the heck!?!?!
RandomSample m_soundChangeMusic; RageSoundSample m_soundChangeMusic;
RandomSample m_soundChangeSort; RageSoundSample m_soundChangeSort;
RandomSample m_soundExpand; RageSoundSample m_soundExpand;
@@ -174,7 +180,7 @@ protected:
// sTemp = "NUM"; // sTemp = "NUM";
// return sTemp; // return sTemp;
case SORT_TITLE: case SORT_TITLE:
sTemp = pSong->GetFullTitle(); sTemp = pSong->GetMainTitle();
sTemp.MakeUpper(); sTemp.MakeUpper();
sTemp = (sTemp.GetLength() > 0) ? sTemp.Left(1) : ""; sTemp = (sTemp.GetLength() > 0) ? sTemp.Left(1) : "";
if( IsAnInt(sTemp) ) if( IsAnInt(sTemp) )
+2 -2
View File
@@ -3,7 +3,7 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: NoteData.cpp File: NoteData.cpp
Desc: A pattern of ColorArrows that past Y==0. Desc: A pattern of ColorNotes that past Y==0.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
Chris Danford Chris Danford
@@ -166,7 +166,7 @@ int NoteData::GetNumTapNotes()
for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ ) for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ )
{ {
for( int t=0; i<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
{ {
if( m_TapNotes[t][i] != '0' ) if( m_TapNotes[t][i] != '0' )
iNumSteps++; iNumSteps++;
-3
View File
@@ -15,9 +15,6 @@
#include "GameTypes.h" #include "GameTypes.h"
typedef unsigned char TapNote;
typedef unsigned char TrackNumber;
typedef unsigned short NoteIndex;
// '1' = tap note // '1' = tap note
// '2' = hold note begin // '2' = hold note begin
// '3' = hold note end ('1' can also end a HoldNote) // '3' = hold note end ('1' can also end a HoldNote)
+70 -96
View File
@@ -49,14 +49,16 @@ void NoteField::Load( NoteData* pNoteData, PlayerOptions po, float fNumBeatsToDr
// init arrow rotations and X positions // init arrow rotations and X positions
for( int c=0; c<m_iNumTracks; c++ ) for( int c=0; c<m_iNumTracks; c++ )
{ {
m_ColorArrow[c].m_sprColorPart.Load( GAME->GetPathToGraphic( PLAYER_1, c, GRAPHIC_NOTE_COLOR_PART) ); m_ColorNote[c].m_sprColorPart.Load( GAME->GetPathToGraphic( PLAYER_1, c, GRAPHIC_NOTE_COLOR_PART) );
m_ColorArrow[c].m_sprGrayPart.Load( GAME->GetPathToGraphic( PLAYER_1, c, GRAPHIC_NOTE_GRAY_PART) ); m_ColorNote[c].m_sprGrayPart.Load( GAME->GetPathToGraphic( PLAYER_1, c, GRAPHIC_NOTE_GRAY_PART) );
float fColOffsetFromCenter = c - (m_iNumTracks-1)/2.0f;
m_ColorArrow[c].SetX( fColOffsetFromCenter*ARROW_SIZE );
} }
ASSERT( m_iNumTracks == GAME->GetCurrentStyleDef()->GetColsPerPlayer() ); for( int i=0; i<MAX_HOLD_NOTE_ELEMENTS; i++ )
m_HoldNoteLife[i] = 1; // start with full life
ASSERT( m_iNumTracks == GAME->GetCurrentStyleDef()->m_iColsPerPlayer );
} }
void NoteField::Update( float fDeltaTime, float fSongBeat ) void NoteField::Update( float fDeltaTime, float fSongBeat )
@@ -68,7 +70,7 @@ void NoteField::Update( float fDeltaTime, float fSongBeat )
void NoteField::DrawTapNote( const int iCol, const float fIndex ) void NoteField::CreateTapNoteInstance( ColorNoteInstance &cni, const int iCol, const float fIndex, const D3DXCOLOR color )
{ {
const float fYOffset = ArrowGetYOffset( m_PlayerOptions, fIndex, m_fSongBeat ); const float fYOffset = ArrowGetYOffset( m_PlayerOptions, fIndex, m_fSongBeat );
const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset ); const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset );
@@ -76,61 +78,47 @@ void NoteField::DrawTapNote( const int iCol, const float fIndex )
const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat ); const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat );
const float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos ); const float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos );
m_ColorArrow[iCol].SetXY( fXPos, fYPos ); D3DXCOLOR colorLeading, colorTrailing; // of the color part. Alpha here be overwritten with fAlpha!
m_ColorArrow[iCol].SetRotation( fRotation ); if( color.a == -1 ) // indicated "NULL"
m_ColorArrow[iCol].SetColorPartFromIndexAndBeat( (int)fIndex, m_fSongBeat, m_PlayerOptions.m_ColorType ); m_ColorNote[iCol].GetEdgeColorsFromIndexAndBeat( roundf(fIndex), m_fSongBeat, m_PlayerOptions.m_ColorType, colorLeading, colorTrailing );
m_ColorArrow[iCol].SetGrayPartFromIndexAndBeat( (int)fIndex, m_fSongBeat ); else
m_ColorArrow[iCol].SetAlpha( fAlpha ); colorLeading = colorTrailing = color;
m_ColorArrow[iCol].Draw();
const float fAddAlpha = m_ColorNote[iCol].GetAddAlphaFromDiffuseAlpha( fAlpha );
int iGrayPartFrameNo = m_ColorNote[iCol].GetGrayPartFrameNoFromIndexAndBeat( roundf(fIndex), m_fSongBeat );
ColorNoteInstance instance = { fXPos, fYPos, fRotation, fAlpha, colorLeading, colorTrailing, fAddAlpha, iGrayPartFrameNo };
cni = instance;
} }
void NoteField::DrawTapNote( const int iCol, const float fIndex, const D3DXCOLOR color ) void NoteField::CreateHoldNoteInstance( ColorNoteInstance &cni, const bool bActive, const float fIndex, const HoldNote &hn, const float fHoldNoteLife )
{ {
const int iCol = hn.m_iTrack;
const float fYOffset = ArrowGetYOffset( m_PlayerOptions, fIndex, m_fSongBeat ); const float fYOffset = ArrowGetYOffset( m_PlayerOptions, fIndex, m_fSongBeat );
const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset ); const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset );
const float fRotation = ArrowGetRotation( m_PlayerOptions, iCol, fYOffset ); const float fRotation = ArrowGetRotation( m_PlayerOptions, iCol, fYOffset );
const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat ); const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat );
const float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos ); const float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos );
m_ColorArrow[iCol].SetXY( fXPos, fYPos );
m_ColorArrow[iCol].SetRotation( fRotation );
m_ColorArrow[iCol].SetDiffuseColor( color );
m_ColorArrow[iCol].SetGrayPartFromIndexAndBeat( (int)fIndex, m_fSongBeat );
m_ColorArrow[iCol].SetAlpha( fAlpha );
m_ColorArrow[iCol].Draw();
}
void NoteField::DrawHoldNoteColorPart( const int iCol, const float fIndex, const HoldNote &hn, const float fHoldNoteLife ) int iGrayPartFrameNo;
{ if( bActive && m_Mode == MODE_DANCING )
const float fYOffset = ArrowGetYOffset( m_PlayerOptions, fIndex, m_fSongBeat ); iGrayPartFrameNo = m_ColorNote[iCol].GetGrayPartFrameNoFull();
const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset ); else
const float fRotation = ArrowGetRotation( m_PlayerOptions, iCol, fYOffset ); iGrayPartFrameNo = m_ColorNote[iCol].GetGrayPartFrameNoClear();
const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat );
const float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos );
D3DXCOLOR color( (fIndex-hn.m_iStartIndex)/(hn.m_iEndIndex-hn.m_iStartIndex), 1, 0, 1 ); // color shifts from green to yellow const float fPercentIntoHold = (fIndex-hn.m_iStartIndex)/(hn.m_iEndIndex-hn.m_iStartIndex);
color *= 1 - (1-fHoldNoteLife) / 1.2f; D3DXCOLOR colorLeading( fPercentIntoHold, 1, 0, 1 ); // color shifts from green to yellow
color.a = 1; colorLeading *= fHoldNoteLife;
colorLeading.a = 1;
D3DXCOLOR colorTrailing = colorLeading;
m_ColorArrow[iCol].SetXY( fXPos, fYPos ); const float fAddAlpha = m_ColorNote[iCol].GetAddAlphaFromDiffuseAlpha( fAlpha );
m_ColorArrow[iCol].SetRotation( fRotation );
m_ColorArrow[iCol].SetDiffuseColor( color );
m_ColorArrow[iCol].SetAlpha( fAlpha );
m_ColorArrow[iCol].DrawColorPart();
}
void NoteField::DrawHoldNoteGrayPart( const int iCol, const float fIndex, const HoldNote &hn, const float fHoldNoteLife ) ColorNoteInstance instance = { fXPos, fYPos, fRotation, fAlpha, colorLeading, colorTrailing, fAddAlpha, iGrayPartFrameNo };
{ cni = instance;
const float fYOffset = ArrowGetYOffset( m_PlayerOptions, fIndex, m_fSongBeat );
const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset );
const float fRotation = ArrowGetRotation( m_PlayerOptions, iCol, fYOffset );
const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat );
const float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos );
m_ColorArrow[iCol].SetXY( fXPos, fYPos );
m_ColorArrow[iCol].SetRotation( fRotation );
m_ColorArrow[iCol].SetAlpha( fAlpha );
m_ColorArrow[iCol].DrawGrayPart();
} }
void NoteField::DrawMeasureBar( const int iIndex, const int iMeasureNo ) void NoteField::DrawMeasureBar( const int iIndex, const int iMeasureNo )
@@ -176,7 +164,6 @@ void NoteField::RenderPrimitives()
//HELPER.Log( "Drawing elements %d through %d", iIndexFirstArrowToDraw, iIndexLastArrowToDraw ); //HELPER.Log( "Drawing elements %d through %d", iIndexFirstArrowToDraw, iIndexLastArrowToDraw );
// //
// Draw measure bars // Draw measure bars
// //
@@ -205,15 +192,28 @@ void NoteField::RenderPrimitives()
} }
// //
// Draw all TapNotes // Optimization is very important here because there are so many arrows to draw. We're going
// to draw the arrows in order of column. This will let us fill up a vertex buffer of arrows
// so we can draw them in one swoop without texture or state changes.
//
for( int c=0; c<m_iNumTracks; c++ ) // for each arrow column
{
const int MAX_COLOR_NOTE_INSTANCES = 300;
ColorNoteInstance instances[MAX_COLOR_NOTE_INSTANCES];
int iCount = 0; // number of valid elements in instances
//
// Draw all TapNotes in this column
// //
for( int i=iIndexFirstArrowToDraw; i<=iIndexLastArrowToDraw; i++ ) // for each row for( int i=iIndexFirstArrowToDraw; i<=iIndexLastArrowToDraw; i++ ) // for each row
{ {
if( !IsRowEmpty(i) ) if( m_TapNotes[c][i] == '0' )
{ continue; // no note here
//HELPER.Log( "iYPos: %d, iFrameNo: %d, m_OriginalStep[i]: %d", iYPos, iFrameNo, m_OriginalStep[i] );
// See if there is a hold step that begins on this beat. Terribly inefficient! // See if there is a hold step that begins on this beat. Not pretty...
bool bHoldNoteOnThisBeat = false; bool bHoldNoteOnThisBeat = false;
for( int j=0; j<m_iNumHoldNotes; j++ ) for( int j=0; j<m_iNumHoldNotes; j++ )
{ {
@@ -224,28 +224,23 @@ void NoteField::RenderPrimitives()
} }
} }
for( int c=0; c<m_iNumTracks; c++ ) // for each arrow column
{
if( m_TapNotes[c][i] != '0' ) // this column is still unstepped on?
{
if( bHoldNoteOnThisBeat ) if( bHoldNoteOnThisBeat )
DrawTapNote( c, (float)i, D3DXCOLOR(0,1,0,1) ); CreateTapNoteInstance( instances[iCount++], c, (float)i, D3DXCOLOR(0,1,0,1) );
else else
DrawTapNote( c, (float)i ); CreateTapNoteInstance( instances[iCount++], c, (float)i );
}
} }
} // end if there is a step
} // end foreach arrow to draw
// //
// Draw all HoldNotes // Draw all HoldNotes in this column
// //
for( i=0; i<m_iNumHoldNotes; i++ ) for( i=0; i<m_iNumHoldNotes; i++ )
{ {
HoldNote &hn = m_HoldNotes[i]; HoldNote &hn = m_HoldNotes[i];
if( hn.m_iTrack != c ) // this HoldNote doesn't belong to this column
continue;
// If no part of this HoldNote is on the screen, skip it // If no part of this HoldNote is on the screen, skip it
if( !( iIndexFirstArrowToDraw <= hn.m_iEndIndex && hn.m_iEndIndex <= iIndexLastArrowToDraw || if( !( iIndexFirstArrowToDraw <= hn.m_iEndIndex && hn.m_iEndIndex <= iIndexLastArrowToDraw ||
iIndexFirstArrowToDraw <= hn.m_iStartIndex && hn.m_iStartIndex <= iIndexLastArrowToDraw || iIndexFirstArrowToDraw <= hn.m_iStartIndex && hn.m_iStartIndex <= iIndexLastArrowToDraw ||
@@ -255,15 +250,9 @@ void NoteField::RenderPrimitives()
} }
int iCol = hn.m_iTrack; const int iCol = hn.m_iTrack;
float fHoldNoteLife = m_HoldNoteLife[i]; const float fHoldNoteLife = m_HoldNoteLife[i];
const bool bActive = NoteIndexToBeat(hn.m_iStartIndex) > m_fSongBeat && m_fSongBeat < NoteIndexToBeat(hn.m_iEndIndex);
bool bActive = NoteIndexToBeat(hn.m_iStartIndex) > m_fSongBeat && m_fSongBeat < NoteIndexToBeat(hn.m_iEndIndex);
if( bActive && m_Mode == MODE_DANCING )
m_ColorArrow[iCol].SetGrayPartFull();
else
m_ColorArrow[iCol].SetGrayPartClear();
// draw the gray parts // draw the gray parts
@@ -278,38 +267,23 @@ void NoteField::RenderPrimitives()
if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteIndexToBeat(j) < m_fSongBeat ) if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteIndexToBeat(j) < m_fSongBeat )
continue; // don't draw continue; // don't draw
DrawHoldNoteGrayPart( iCol, j, hn, fHoldNoteLife ); CreateHoldNoteInstance( instances[iCount++], bActive, j, hn, fHoldNoteLife );
} }
// draw the color parts
for( j=(float)hn.m_iStartIndex;
j<=hn.m_iEndIndex;
j+=INDICIES_BETWEEN_HOLD_BITS/m_PlayerOptions.m_fArrowScrollSpeed ) // for each arrow in the run
{
// check if this arrow is off the the screen
if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j )
continue; // skip this arrow
if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteIndexToBeat(j) < m_fSongBeat )
continue; // don't draw
DrawHoldNoteColorPart( iCol, j, hn, fHoldNoteLife );
}
// draw the first arrow on top of the others // draw the first arrow on top of the others
j = (float)hn.m_iStartIndex; j = (float)hn.m_iStartIndex;
if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteIndexToBeat(j) < m_fSongBeat ) if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteIndexToBeat(j) < m_fSongBeat )
{
; // don't draw ; // don't draw
}
else else
{ CreateHoldNoteInstance( instances[iCount++], bActive, j, hn, fHoldNoteLife );
DrawHoldNoteGrayPart( iCol, j, hn, fHoldNoteLife );
DrawHoldNoteColorPart( iCol, j, hn, fHoldNoteLife );
} }
const bool bDrawAddPass = m_PlayerOptions.m_AppearanceType != PlayerOptions::APPEARANCE_VISIBLE;
if( iCount > 0 )
m_ColorNote[c].DrawList( iCount, instances, bDrawAddPass );
} }
} }
+6 -13
View File
@@ -1,8 +1,9 @@
#pragma once
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: NoteField Class: NoteField
Desc: A stream of ColorArrows that scrolls past Y==0. Desc: A stream of ColorNotes that scrolls past Y==0.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
Chris Danford Chris Danford
@@ -10,17 +11,13 @@
*/ */
#ifndef _NoteField_H_
#define _NoteField_H_
#include "Sprite.h" #include "Sprite.h"
#include "ActorFrame.h" #include "ActorFrame.h"
#include "Song.h" #include "Song.h"
#include "BitmapText.h" #include "BitmapText.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "StyleDef.h" #include "StyleDef.h"
#include "ColorArrow.h" #include "ColorNote.h"
#include "BitmapText.h" #include "BitmapText.h"
#include "RectangleActor.h" #include "RectangleActor.h"
#include "ArrowEffects.h" #include "ArrowEffects.h"
@@ -49,10 +46,8 @@ public:
float m_fBeginMarker, m_fEndMarker; // only used with MODE_EDIT float m_fBeginMarker, m_fEndMarker; // only used with MODE_EDIT
protected: protected:
inline void DrawTapNote( const int iCol, const float fIndex ); inline void CreateTapNoteInstance( ColorNoteInstance &cni, const int iCol, const float fIndex, const D3DXCOLOR color = D3DXCOLOR(-1,-1,-1,-1) );
inline void DrawTapNote( const int iCol, const float fIndex, const D3DXCOLOR color ); inline void CreateHoldNoteInstance( ColorNoteInstance &cni, const bool bActive, const float fIndex, const HoldNote &hn, const float fHoldNoteLife );
inline void DrawHoldNoteColorPart( const int iCol, const float fIndex, const HoldNote &hs, const float fHoldNoteLife );
inline void DrawHoldNoteGrayPart( const int iCol, const float fIndex, const HoldNote &hs, const float fHoldNoteLife );
inline void DrawMeasureBar( const int iIndex, const int iMeasureNo ); inline void DrawMeasureBar( const int iIndex, const int iMeasureNo );
inline void DrawMarkerBar( const int iIndex ); inline void DrawMarkerBar( const int iIndex );
@@ -67,12 +62,10 @@ protected:
NoteFieldMode m_Mode; NoteFieldMode m_Mode;
// color arrows // color arrows
ColorArrow m_ColorArrow[MAX_NOTE_TRACKS]; ColorNote m_ColorNote[MAX_NOTE_TRACKS];
// used in MODE_EDIT // used in MODE_EDIT
RectangleActor m_rectMeasureBar; RectangleActor m_rectMeasureBar;
BitmapText m_textMeasureNumber; BitmapText m_textMeasureNumber;
RectangleActor m_rectMarkerBar; RectangleActor m_rectMarkerBar;
}; };
#endif
+18 -25
View File
@@ -23,9 +23,7 @@
const float JUDGEMENT_Y = CENTER_Y; const float JUDGEMENT_Y = CENTER_Y;
const float ARROWS_Y = SCREEN_TOP + ARROW_SIZE * 1.5f; const float ARROWS_Y = SCREEN_TOP + ARROW_SIZE * 1.5f;
const float HOLD_JUDGEMENT_Y = ARROWS_Y + 80; const float HOLD_JUDGEMENT_Y = ARROWS_Y + 80;
const float LIFEMETER_Y = SCREEN_TOP + 30;
const float COMBO_Y = CENTER_Y + 60; const float COMBO_Y = CENTER_Y + 60;
const float SCORE_Y = SCREEN_HEIGHT - 40;
const float HOLD_ARROW_NG_TIME = 0.27f; const float HOLD_ARROW_NG_TIME = 0.27f;
@@ -48,6 +46,8 @@ Player::Player()
} }
m_iNumHoldNotes = 0; m_iNumHoldNotes = 0;
m_pLifeMeter = NULL;
m_pScore = NULL;
this->AddActor( &m_GrayArrowRow ); this->AddActor( &m_GrayArrowRow );
this->AddActor( &m_NoteField ); this->AddActor( &m_NoteField );
@@ -56,12 +56,10 @@ Player::Player()
for( int c=0; c<MAX_NOTE_TRACKS; c++ ) for( int c=0; c<MAX_NOTE_TRACKS; c++ )
this->AddActor( &m_HoldJudgement[c] ); this->AddActor( &m_HoldJudgement[c] );
this->AddActor( &m_Combo ); this->AddActor( &m_Combo );
this->AddActor( &m_LifeMeter );
this->AddActor( &m_Score );
} }
void Player::Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOptions& po ) void Player::Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore )
{ {
//HELPER.Log( "Player::Load()", ); //HELPER.Log( "Player::Load()", );
this->CopyAll( pNoteData ); this->CopyAll( pNoteData );
@@ -69,6 +67,9 @@ void Player::Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOpti
m_PlayerNumber = player_no; m_PlayerNumber = player_no;
m_PlayerOptions = po; m_PlayerOptions = po;
m_pLifeMeter = pLM;
m_pScore = pScore;
if( !po.m_bAllowFreezeArrows ) if( !po.m_bAllowFreezeArrows )
this->RemoveHoldNotes(); this->RemoveHoldNotes();
@@ -84,18 +85,13 @@ void Player::Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOpti
m_Combo.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - COMBO_Y : COMBO_Y ); m_Combo.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - COMBO_Y : COMBO_Y );
m_LifeMeter.SetY( LIFEMETER_Y );
m_Judgement.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - JUDGEMENT_Y : JUDGEMENT_Y ); m_Judgement.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - JUDGEMENT_Y : JUDGEMENT_Y );
for( int c=0; c<MAX_NOTE_TRACKS; c++ ) for( int c=0; c<MAX_NOTE_TRACKS; c++ )
m_HoldJudgement[c].SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - HOLD_JUDGEMENT_Y : HOLD_JUDGEMENT_Y ); m_HoldJudgement[c].SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - HOLD_JUDGEMENT_Y : HOLD_JUDGEMENT_Y );
m_Score.SetY( SCORE_Y );
m_NoteField.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - ARROWS_Y : ARROWS_Y ); m_NoteField.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - ARROWS_Y : ARROWS_Y );
m_GrayArrowRow.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - ARROWS_Y : ARROWS_Y ); m_GrayArrowRow.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - ARROWS_Y : ARROWS_Y );
m_GhostArrowRow.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - ARROWS_Y : ARROWS_Y ); m_GhostArrowRow.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - ARROWS_Y : ARROWS_Y );
// Load options into Life Meter
m_LifeMeter.SetPlayerOptions(po);
} }
void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference ) void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference )
@@ -112,7 +108,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
m_Judgement.SetJudgement( TNS_MISS ); m_Judgement.SetJudgement( TNS_MISS );
m_Combo.EndCombo(); m_Combo.EndCombo();
for( int i=0; i<iNumMisses; i++ ) for( int i=0; i<iNumMisses; i++ )
m_LifeMeter.ChangeLife( TNS_MISS ); m_pLifeMeter->ChangeLife( TNS_MISS );
} }
@@ -175,7 +171,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
ActorFrame::Update( fDeltaTime ); ActorFrame::Update( fDeltaTime );
m_LifeMeter.SetBeat( fSongBeat ); m_pLifeMeter->SetBeat( fSongBeat );
m_GrayArrowRow.Update( fDeltaTime, fSongBeat ); m_GrayArrowRow.Update( fDeltaTime, fSongBeat );
m_NoteField.Update( fDeltaTime, fSongBeat ); m_NoteField.Update( fDeltaTime, fSongBeat );
@@ -233,10 +229,6 @@ void Player::RenderPrimitives()
for( int c=0; c<m_iNumTracks; c++ ) for( int c=0; c<m_iNumTracks; c++ )
m_HoldJudgement[c].Draw(); m_HoldJudgement[c].Draw();
m_Combo.Draw(); m_Combo.Draw();
m_LifeMeter.Draw();
m_Score.Draw();
} }
bool Player::IsThereANoteAtIndex( int iIndex ) bool Player::IsThereANoteAtIndex( int iIndex )
@@ -259,7 +251,7 @@ bool Player::IsThereANoteAtIndex( int iIndex )
void Player::HandlePlayerStep( float fSongBeat, NoteColumn col, float fMaxBeatDiff ) void Player::HandlePlayerStep( float fSongBeat, ColumnNumber col, float fMaxBeatDiff )
{ {
//HELPER.Log( "Player::HandlePlayerStep()" ); //HELPER.Log( "Player::HandlePlayerStep()" );
@@ -304,8 +296,8 @@ void Player::HandlePlayerStep( float fSongBeat, NoteColumn col, float fMaxBeatDi
// update the judgement, score, and life // update the judgement, score, and life
m_Judgement.SetJudgement( score ); m_Judgement.SetJudgement( score );
m_Score.AddToScore( score, m_Combo.GetCurrentCombo() ); m_pScore->AddToScore( score, m_Combo.GetCurrentCombo() );
m_LifeMeter.ChangeLife( score ); m_pLifeMeter->ChangeLife( score );
// show the gray arrow ghost // show the gray arrow ghost
m_GhostArrowRow.TapNote( col, score, m_Combo.GetCurrentCombo() > 100 ); m_GhostArrowRow.TapNote( col, score, m_Combo.GetCurrentCombo() > 100 );
@@ -331,7 +323,7 @@ void Player::HandlePlayerStep( float fSongBeat, NoteColumn col, float fMaxBeatDi
} }
void Player::CheckForCompleteRow( float fSongBeat, NoteColumn col, float fMaxBeatDiff ) void Player::CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxBeatDiff )
{ {
//HELPER.Log( "Player::CheckForCompleteRow()" ); //HELPER.Log( "Player::CheckForCompleteRow()" );
@@ -391,7 +383,7 @@ void Player::CheckForCompleteRow( float fSongBeat, NoteColumn col, float fMaxBea
} }
} }
void Player::OnRowDestroyed( float fSongBeat, NoteColumn col, float fMaxBeatDiff, int iIndexThatWasSteppedOn ) void Player::OnRowDestroyed( float fSongBeat, ColumnNumber col, float fMaxBeatDiff, int iIndexThatWasSteppedOn )
{ {
float fStepBeat = NoteIndexToBeat( (float)iIndexThatWasSteppedOn ); float fStepBeat = NoteIndexToBeat( (float)iIndexThatWasSteppedOn );
@@ -412,11 +404,12 @@ void Player::OnRowDestroyed( float fSongBeat, NoteColumn col, float fMaxBeatDiff
// update the judgement, score, and life // update the judgement, score, and life
m_Judgement.SetJudgement( score ); m_Judgement.SetJudgement( score );
m_Score.AddToScore( score, m_Combo.GetCurrentCombo() ); m_pScore->AddToScore( score, m_Combo.GetCurrentCombo() );
m_LifeMeter.ChangeLife( score ); m_pLifeMeter->ChangeLife( score );
// remove this row from the NoteField // remove this row from the NoteField
if ( ( score == TNS_PERFECT ) || ( score == TNS_GREAT ) )
m_NoteField.RemoveTapNoteRow( iIndexThatWasSteppedOn ); m_NoteField.RemoveTapNoteRow( iIndexThatWasSteppedOn );
// show ghost arrows // show ghost arrows
@@ -479,7 +472,7 @@ ScoreSummary Player::GetScoreSummary()
} }
} }
scoreSummary.max_combo = m_Combo.GetMaxCombo(); scoreSummary.max_combo = m_Combo.GetMaxCombo();
scoreSummary.score = m_Score.GetScore(); scoreSummary.score = m_pScore ? m_pScore->GetScore() : 0;
return scoreSummary; return scoreSummary;
} }
@@ -507,7 +500,7 @@ int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat )
{ {
m_TapNoteScores[i] = TNS_MISS; m_TapNoteScores[i] = TNS_MISS;
iNumMissesFound++; iNumMissesFound++;
m_LifeMeter.ChangeLife( TNS_MISS ); m_pLifeMeter->ChangeLife( TNS_MISS );
} }
} }
+12 -19
View File
@@ -1,31 +1,30 @@
#pragma once
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: Player.h File: Player.h
Desc: Object that accepts pad input, knocks down ColorArrows that were stepped on, Desc: Object that accepts pad input, knocks down ColorNotes that were stepped on,
and keeps score for the player. and keeps score for the player.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#ifndef _PLAYER_H_
#define _PLAYER_H_
#include "PrefsManager.h" // for ScoreSummary #include "PrefsManager.h" // for ScoreSummary
#include "NoteMetadata.h" #include "NoteMetadata.h"
#include "Sprite.h" #include "Sprite.h"
#include "BitmapText.h" #include "BitmapText.h"
#include "ColorArrow.h" #include "ColorNote.h"
#include "GrayArrow.h" #include "GrayArrow.h"
#include "GhostArrow.h" #include "GhostArrow.h"
#include "GhostArrowBright.h" #include "GhostArrowBright.h"
#include "HoldGhostArrow.h" #include "HoldGhostArrow.h"
#include "ActorFrame.h" #include "ActorFrame.h"
#include "RandomSample.h" #include "RandomSample.h"
#include "ScoreDisplayRollingWithFrame.h" #include "ScoreDisplayRolling.h"
#include "LifeMeterPills.h" #include "LifeMeterBar.h"
#include "Judgement.h" #include "Judgement.h"
#include "HoldJudgement.h" #include "HoldJudgement.h"
#include "Combo.h" #include "Combo.h"
@@ -44,19 +43,18 @@ public:
void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference ); void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference );
void RenderPrimitives(); void RenderPrimitives();
void Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOptions& po ); void Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore );
void CrossedIndex( int iIndex ); void CrossedIndex( int iIndex );
void HandlePlayerStep( float fSongBeat, NoteColumn col, float fMaxBeatDiff ); void HandlePlayerStep( float fSongBeat, ColumnNumber col, float fMaxBeatDiff );
int UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ); int UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
ScoreSummary GetScoreSummary(); ScoreSummary GetScoreSummary();
float GetLifePercentage() { return m_LifeMeter.GetLifePercentage(); };
bool IsThereANoteAtIndex( int iIndex ); bool IsThereANoteAtIndex( int iIndex );
protected: protected:
void CheckForCompleteRow( float fSongBeat, NoteColumn col, float fMaxBeatDiff ); void CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxBeatDiff );
void OnRowDestroyed( float fSongBeat, NoteColumn col, float fMaxBeatDiff, int iStepIndex ); void OnRowDestroyed( float fSongBeat, ColumnNumber col, float fMaxBeatDiff, int iStepIndex );
float m_fSongBeat; float m_fSongBeat;
PlayerNumber m_PlayerNumber; PlayerNumber m_PlayerNumber;
@@ -75,12 +73,7 @@ protected:
Judgement m_Judgement; Judgement m_Judgement;
HoldJudgement m_HoldJudgement[MAX_NOTE_TRACKS]; HoldJudgement m_HoldJudgement[MAX_NOTE_TRACKS];
Combo m_Combo; Combo m_Combo;
LifeMeterPills m_LifeMeter; LifeMeterBar* m_pLifeMeter;
ScoreDisplayRollingWithFrame m_Score; ScoreDisplayRolling* m_pScore;
}; };
#endif
+98 -25
View File
@@ -17,13 +17,68 @@
PrefsManager* PREFS = NULL; // global and accessable from anywhere in our program PrefsManager* PREFS = NULL; // global and accessable from anywhere in our program
GraphicProfileOptions GRAPHIC_OPTIONS[NUM_GRAPHIC_PROFILES] =
{
{ // PROFILE_SUPER_LOW
"Super Low",
320,
240,
256,
16,
16,
false,
false,
},
{ // PROFILE_LOW
"Low",
400,
300,
256,
16,
16,
false,
true,
},
{ // PROFILE_MEDIUM
"Medium",
640,
480,
512,
16,
16,
false,
true,
},
{ // PROFILE_HIGH
"High",
640,
480,
1024,
16,
32,
true,
true,
},
{ // PROFILE_CUSTOM
"Custom",
640,
480,
512,
16,
16,
false,
true,
},
};
PrefsManager::PrefsManager() PrefsManager::PrefsManager()
{ {
m_SongSortOrder = SORT_GROUP; m_SongSortOrder = SORT_GROUP;
m_iCurrentStage = 1; m_iCurrentStage = 1;
m_GameMode = GAME_MODE_ARCADE;
m_bWindowed = false;
m_GraphicProfile = PROFILE_MEDIUM;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
m_PreferredDifficultyClass[p] = CLASS_EASY; m_PreferredDifficultyClass[p] = CLASS_EASY;
@@ -39,6 +94,18 @@ PrefsManager::~PrefsManager()
} }
GraphicProfileOptions* PrefsManager::GetCustomGraphicProfileOptions()
{
return &GRAPHIC_OPTIONS[PROFILE_CUSTOM];
}
GraphicProfileOptions* PrefsManager::GetCurrentGraphicProfileOptions()
{
return &GRAPHIC_OPTIONS[m_GraphicProfile];
}
void PrefsManager::ReadPrefsFromDisk() void PrefsManager::ReadPrefsFromDisk()
{ {
IniFile ini; IniFile ini;
@@ -74,23 +141,25 @@ void PrefsManager::ReadPrefsFromDisk()
{ {
pKey->GetNextAssoc( pos, name_string, value_string ); pKey->GetNextAssoc( pos, name_string, value_string );
if( name_string == "Windowed" ) m_GraphicOptions.m_bWindowed = ( value_string == "1" ); if( name_string == "Windowed" ) m_bWindowed = ( value_string == "1" );
if( name_string == "Profile" ) if( name_string == "Profile" )
{ {
if( value_string == "super low" ) m_GraphicOptions.m_Profile = PROFILE_SUPER_LOW; if( value_string == "super low" ) m_GraphicProfile = PROFILE_SUPER_LOW;
else if( value_string == "low" ) m_GraphicOptions.m_Profile = PROFILE_LOW; else if( value_string == "low" ) m_GraphicProfile = PROFILE_LOW;
else if( value_string == "medium" ) m_GraphicOptions.m_Profile = PROFILE_MEDIUM; else if( value_string == "medium" ) m_GraphicProfile = PROFILE_MEDIUM;
else if( value_string == "high" ) m_GraphicOptions.m_Profile = PROFILE_HIGH; else if( value_string == "high" ) m_GraphicProfile = PROFILE_HIGH;
else if( value_string == "custom" ) m_GraphicOptions.m_Profile = PROFILE_CUSTOM; else if( value_string == "custom" ) m_GraphicProfile = PROFILE_CUSTOM;
else m_GraphicOptions.m_Profile = PROFILE_MEDIUM; else m_GraphicProfile = PROFILE_MEDIUM;
} }
if( name_string == "Resolution" ) m_GraphicOptions.m_iResolution = atoi( value_string );
if( name_string == "MaxTextureSize" ) m_GraphicOptions.m_iMaxTextureSize = atoi( value_string ); GraphicProfileOptions* pGPO = GetCustomGraphicProfileOptions();
if( name_string == "DisplayColor" ) m_GraphicOptions.m_iDisplayColor = atoi( value_string ); if( name_string == "Width" ) pGPO->m_dwWidth = atoi( value_string );
if( name_string == "TextureColor" ) m_GraphicOptions.m_iTextureColor = atoi( value_string ); if( name_string == "Height" ) pGPO->m_dwHeight = atoi( value_string );
if( name_string == "Shadows" ) m_GraphicOptions.m_bShadows = ( value_string == "1" ); if( name_string == "MaxTextureSize" ) pGPO->m_dwMaxTextureSize = atoi( value_string );
if( name_string == "30fpsLock" ) m_GraphicOptions.m_b30fpsLock = ( value_string == "1" ); if( name_string == "DisplayColor" ) pGPO->m_dwDisplayColor = atoi( value_string );
if( name_string == "Backgrounds" ) m_GraphicOptions.m_bBackgrounds = ( value_string == "1" ); if( name_string == "TextureColor" ) pGPO->m_dwTextureColor = atoi( value_string );
if( name_string == "Shadows" ) pGPO->m_bShadows = ( value_string == "1" );
if( name_string == "Backgrounds" ) pGPO->m_bBackgrounds = ( value_string == "1" );
} }
} }
@@ -105,8 +174,8 @@ void PrefsManager::SavePrefsToDisk()
// save the GameOptions // save the GameOptions
ini.SetValue( "GraphicOptions", "Windowed", m_GraphicOptions.m_bWindowed ? "1":"0" ); ini.SetValue( "GraphicOptions", "Windowed", m_bWindowed ? "1":"0" );
switch( m_GraphicOptions.m_Profile ) switch( m_GraphicProfile )
{ {
case PROFILE_SUPER_LOW: ini.SetValue( "GraphicOptions", "Profile", "super low" ); break; case PROFILE_SUPER_LOW: ini.SetValue( "GraphicOptions", "Profile", "super low" ); break;
case PROFILE_LOW: ini.SetValue( "GraphicOptions", "Profile", "low" ); break; case PROFILE_LOW: ini.SetValue( "GraphicOptions", "Profile", "low" ); break;
@@ -115,13 +184,17 @@ void PrefsManager::SavePrefsToDisk()
case PROFILE_CUSTOM: ini.SetValue( "GraphicOptions", "Profile", "custom" ); break; case PROFILE_CUSTOM: ini.SetValue( "GraphicOptions", "Profile", "custom" ); break;
default: ASSERT( false ); default: ASSERT( false );
} }
ini.SetValue( "GraphicOptions", "Resolution", ssprintf("%d", m_GraphicOptions.m_iResolution) );
ini.SetValue( "GraphicOptions", "MaxTextureSize", ssprintf("%d", m_GraphicOptions.m_iMaxTextureSize) );
ini.SetValue( "GraphicOptions", "DisplayColor", ssprintf("%d", m_GraphicOptions.m_iDisplayColor) ); GraphicProfileOptions* pGPO = GetCustomGraphicProfileOptions();
ini.SetValue( "GraphicOptions", "TextureColor", ssprintf("%d", m_GraphicOptions.m_iTextureColor) );
ini.SetValue( "GraphicOptions", "Shadows", m_GraphicOptions.m_bShadows ? "1":"0" ); ini.SetValue( "GraphicOptions", "Width", ssprintf("%d", pGPO->m_dwWidth) );
ini.SetValue( "GraphicOptions", "30fpsLock", m_GraphicOptions.m_b30fpsLock ? "1":"0" ); ini.SetValue( "GraphicOptions", "Height", ssprintf("%d", pGPO->m_dwWidth) );
ini.SetValue( "GraphicOptions", "Backgrounds", m_GraphicOptions.m_bBackgrounds ? "1":"0" ); ini.SetValue( "GraphicOptions", "MaxTextureSize", ssprintf("%d", pGPO->m_dwMaxTextureSize) );
ini.SetValue( "GraphicOptions", "DisplayColor", ssprintf("%d", pGPO->m_dwDisplayColor) );
ini.SetValue( "GraphicOptions", "TextureColor", ssprintf("%d", pGPO->m_dwTextureColor) );
ini.SetValue( "GraphicOptions", "Shadows", pGPO->m_bShadows ? "1":"0" );
ini.SetValue( "GraphicOptions", "Backgrounds", pGPO->m_bBackgrounds ? "1":"0" );
ini.SetValue( "GameOptions", "IgnoreJoyAxes", m_GameOptions.m_bIgnoreJoyAxes ? "1":"0" ); ini.SetValue( "GameOptions", "IgnoreJoyAxes", m_GameOptions.m_bIgnoreJoyAxes ? "1":"0" );
+5 -6
View File
@@ -12,17 +12,12 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "RageInput.h"
#include "GameTypes.h" #include "GameTypes.h"
const int NUM_PAD_TO_DEVICE_SLOTS = 3; // three device inputs may map to one pad input const int NUM_PAD_TO_DEVICE_SLOTS = 3; // three device inputs may map to one pad input
class Song;
class PrefsManager class PrefsManager
{ {
public: public:
@@ -31,12 +26,16 @@ public:
ScoreSummary m_ScoreSummary[NUM_PLAYERS]; // for passing from Dancing to Results ScoreSummary m_ScoreSummary[NUM_PLAYERS]; // for passing from Dancing to Results
SongSortOrder m_SongSortOrder; // used by MusicWheel and should be saved until the app exits SongSortOrder m_SongSortOrder; // used by MusicWheel and should be saved until the app exits
GameMode m_GameMode;
int m_iCurrentStage; // number of stages played +1 int m_iCurrentStage; // number of stages played +1
CString GetStageText(); CString GetStageText();
DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS]; DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS];
GameOptions m_GameOptions; GameOptions m_GameOptions;
GraphicOptions m_GraphicOptions; bool m_bWindowed;
GraphicProfile m_GraphicProfile;
GraphicProfileOptions* GetCustomGraphicProfileOptions();
GraphicProfileOptions* GetCurrentGraphicProfileOptions();
PlayerOptions m_PlayerOptions[NUM_PLAYERS]; PlayerOptions m_PlayerOptions[NUM_PLAYERS];
SongOptions m_SongOptions; SongOptions m_SongOptions;
+25 -7
View File
@@ -36,7 +36,7 @@ RageBitmapTexture::RageBitmapTexture(
const DWORD dwMaxSize, const DWORD dwMaxSize,
const DWORD dwTextureColorDepth, const DWORD dwTextureColorDepth,
const DWORD dwHints ) : const DWORD dwHints ) :
RageTexture( pScreen, sFilePath ) RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, dwHints )
{ {
// HELPER.Log( "RageBitmapTexture::RageBitmapTexture()" ); // HELPER.Log( "RageBitmapTexture::RageBitmapTexture()" );
@@ -52,6 +52,16 @@ RageBitmapTexture::~RageBitmapTexture()
SAFE_RELEASE(m_pd3dTexture); SAFE_RELEASE(m_pd3dTexture);
} }
void RageBitmapTexture::Reload(
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints )
{
SAFE_RELEASE(m_pd3dTexture);
Create( dwMaxSize, dwTextureColorDepth, dwHints );
// leave m_iRefCount alone!
CreateFrameRects();
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// GetTexture // GetTexture
@@ -113,11 +123,8 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR
FatalErrorHr( hr, "D3DXGetImageInfoFromFile() failed for file '%s'.", m_sFilePath ); FatalErrorHr( hr, "D3DXGetImageInfoFromFile() failed for file '%s'.", m_sFilePath );
} }
D3DCAPS8 caps;
m_pd3dDevice->GetDeviceCaps( &caps );
// find out what the min texture size is // find out what the min texture size is
dwMaxSize = min( dwMaxSize, caps.MaxTextureWidth ); dwMaxSize = min( dwMaxSize, SCREEN->GetDeviceCaps().MaxTextureWidth );
bScaleImageToTextureSize = ddii.Width > dwMaxSize || ddii.Height > dwMaxSize; bScaleImageToTextureSize = ddii.Width > dwMaxSize || ddii.Height > dwMaxSize;
@@ -132,8 +139,8 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR
if( FAILED( hr = D3DXCreateTextureFromFileEx( if( FAILED( hr = D3DXCreateTextureFromFileEx(
m_pd3dDevice, // device m_pd3dDevice, // device
m_sFilePath, // soure file m_sFilePath, // soure file
D3DX_DEFAULT, // width bScaleImageToTextureSize ? dwMaxSize : D3DX_DEFAULT, // width
D3DX_DEFAULT, // height bScaleImageToTextureSize ? dwMaxSize : D3DX_DEFAULT, // height
bCreateMipMaps ? 4 : 0, // mip map levels bCreateMipMaps ? 4 : 0, // mip map levels
0, // usage (is a render target?) 0, // usage (is a render target?)
fmtTexture, // our preferred texture format fmtTexture, // our preferred texture format
@@ -174,5 +181,16 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR
m_iImageWidth = m_iSourceWidth; m_iImageWidth = m_iSourceWidth;
m_iImageHeight = m_iSourceHeight; m_iImageHeight = m_iSourceHeight;
} }
HELPER.Log( "RageBitmapTexture: Loaded '%s' (%ux%u) from disk. bScaleImageToTextureSize = %d, source %d,%d; image %d,%d.",
m_sFilePath,
GetTextureWidth(),
GetTextureHeight(),
bScaleImageToTextureSize,
m_iSourceWidth,
m_iSourceHeight,
m_iImageWidth,
m_iImageHeight
);
} }
+5
View File
@@ -42,6 +42,11 @@ public:
); );
~RageBitmapTexture(); ~RageBitmapTexture();
virtual void Reload(
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints );
virtual LPDIRECT3DTEXTURE8 GetD3DTexture(); virtual LPDIRECT3DTEXTURE8 GetD3DTexture();
protected: protected:
-2
View File
@@ -240,8 +240,6 @@ BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance,
// Obtain an interface to the enumerated joystick. // Obtain an interface to the enumerated joystick.
if( i >= NUM_JOYSTICKS ) if( i >= NUM_JOYSTICKS )
return DIENUM_STOP; // we only care about the first 4 return DIENUM_STOP; // we only care about the first 4
else
ASSERT( false ); // we should never get here since the app is only initialized once
HRESULT hr = pDI->CreateDevice( pdidInstance->guidInstance, HRESULT hr = pDI->CreateDevice( pdidInstance->guidInstance,
&pInput->m_pJoystick[i++], &pInput->m_pJoystick[i++],
+16 -2
View File
@@ -242,8 +242,13 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// RageMovieTexture constructor // RageMovieTexture constructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
RageMovieTexture::RageMovieTexture( RageScreen* pScreen, const CString &sFilePath ) : RageMovieTexture::RageMovieTexture(
RageTexture( pScreen, sFilePath ) RageScreen* pScreen,
const CString &sFilePath,
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints ) :
RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, dwHints )
{ {
HELPER.Log( "RageBitmapTexture::RageBitmapTexture()" ); HELPER.Log( "RageBitmapTexture::RageBitmapTexture()" );
@@ -263,6 +268,15 @@ RageMovieTexture::~RageMovieTexture()
SAFE_RELEASE(m_pd3dTexture[1]); SAFE_RELEASE(m_pd3dTexture[1]);
} }
void RageMovieTexture::Reload(
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints )
{
// do nothing
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// GetTexture // GetTexture
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+11 -1
View File
@@ -74,9 +74,19 @@ protected:
class RageMovieTexture : public RageTexture class RageMovieTexture : public RageTexture
{ {
public: public:
RageMovieTexture( RageScreen* pScreen, const CString &sFilePath ); RageMovieTexture(
RageScreen* pScreen,
const CString &sFilePath,
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints );
virtual ~RageMovieTexture(); virtual ~RageMovieTexture();
virtual void Reload(
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints );
LPDIRECT3DTEXTURE8 GetD3DTexture(); LPDIRECT3DTEXTURE8 GetD3DTexture();
LPDIRECT3DTEXTURE8 m_pd3dTexture[2]; // double buffered LPDIRECT3DTEXTURE8 m_pd3dTexture[2]; // double buffered
+11
View File
@@ -75,4 +75,15 @@ RageSound::~RageSound()
BASS_Free(); BASS_Free();
} }
void RageSound::PlayOnceStreamed( CString sPath )
{
HSTREAM hStream = BASS_StreamCreateFile( FALSE, (void*)((LPCTSTR)sPath), 0, 0, BASS_STREAM_AUTOFREE );
if( hStream == NULL )
FatalError( "RageSound: Error creating stream." );
if( FALSE == BASS_StreamPlay( hStream, FALSE, 0 ) )
FatalError( "RageSound: Error playing a sound stream." );
// this stream will free itself when stopped
}
+2
View File
@@ -27,6 +27,8 @@ public:
float GetPlayLatency() { return m_info.latency / 1000.0f; }; float GetPlayLatency() { return m_info.latency / 1000.0f; };
void PlayOnceStreamed( CString sPath );
private: private:
HWND m_hWndApp; // this is set on GRAPHICS_Create() HWND m_hWndApp; // this is set on GRAPHICS_Create()
BASS_INFO m_info; BASS_INFO m_info;
+7 -1
View File
@@ -20,7 +20,12 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// RageTexture constructor // RageTexture constructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
RageTexture::RageTexture( RageScreen* pScreen, const CString &sFilePath ) RageTexture::RageTexture(
RageScreen* pScreen,
const CString &sFilePath,
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints )
{ {
// HELPER.Log( "RageTexture::RageTexture()" ); // HELPER.Log( "RageTexture::RageTexture()" );
@@ -52,6 +57,7 @@ void RageTexture::CreateFrameRects()
/////////////////////////////////// ///////////////////////////////////
// Fill in the m_FrameRects with the bounds of each frame in the animation. // Fill in the m_FrameRects with the bounds of each frame in the animation.
/////////////////////////////////// ///////////////////////////////////
m_TextureCoordRects.RemoveAll();
for( int j=0; j<m_iFramesHigh; j++ ) // traverse along Y for( int j=0; j<m_iFramesHigh; j++ ) // traverse along Y
{ {
for( int i=0; i<m_iFramesWide; i++ ) // traverse along X (important that this is the inner loop) for( int i=0; i<m_iFramesWide; i++ ) // traverse along X (important that this is the inner loop)
+17 -12
View File
@@ -1,19 +1,17 @@
#pragma once
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: RageTexture.h Class: RageTexture
Desc: Abstract class for a texture with metadata. Desc: Abstract class for a texture and holds metadata.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
class RageTexture;
#ifndef _RAGETEXTURE_H_
#define _RAGETEXTURE_H_
#include "RageScreen.h" #include "RageScreen.h"
#include <d3dx8.h> #include <d3dx8.h>
@@ -41,10 +39,20 @@ public:
class RageTexture class RageTexture
{ {
public: public:
RageTexture( RageScreen* pScreen, const CString &sFilePath ); RageTexture(
virtual ~RageTexture() PURE; RageScreen* pScreen,
const CString &sFilePath,
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints );
virtual ~RageTexture() = 0;
virtual LPDIRECT3DTEXTURE8 GetD3DTexture() PURE; virtual void Reload(
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints ) = 0;
virtual LPDIRECT3DTEXTURE8 GetD3DTexture() = 0;
int GetSourceWidth() {return m_iSourceWidth;}; int GetSourceWidth() {return m_iSourceWidth;};
int GetSourceHeight() {return m_iSourceHeight;}; int GetSourceHeight() {return m_iSourceHeight;};
@@ -92,6 +100,3 @@ protected:
CArray<FRECT, FRECT&> m_TextureCoordRects; CArray<FRECT, FRECT&> m_TextureCoordRects;
}; };
#endif
+22 -10
View File
@@ -71,7 +71,10 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, const DWORD
if( m_mapPathToTexture.Lookup( sTexturePath, pTexture ) ) // if the texture already exists in the map if( m_mapPathToTexture.Lookup( sTexturePath, pTexture ) ) // if the texture already exists in the map
{ {
pTexture->m_iRefCount++; pTexture->m_iRefCount++;
HELPER.Log( ssprintf("RageTextureManager: '%s' now has %d references.", sTexturePath, pTexture->m_iRefCount) ); if( bForceReload )
pTexture->Reload( m_dwMaxTextureSize, m_dwTextureColorDepth, dwHints );
HELPER.Log( "RageTextureManager: '%s' now has %d references.", sTexturePath, pTexture->m_iRefCount );
} }
else // the texture is not already loaded else // the texture is not already loaded
{ {
@@ -79,17 +82,13 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, const DWORD
splitpath( false, sTexturePath, sDrive, sDir, sFName, sExt ); splitpath( false, sTexturePath, sDrive, sDir, sFName, sExt );
if( sExt == "avi" || sExt == "mpg" || sExt == "mpeg" ) if( sExt == "avi" || sExt == "mpg" || sExt == "mpeg" )
pTexture = (RageTexture*) new RageMovieTexture( m_pScreen, sTexturePath ); pTexture = (RageTexture*) new RageMovieTexture( m_pScreen, sTexturePath, m_dwMaxTextureSize, m_dwTextureColorDepth, dwHints );
else else
pTexture = (RageTexture*) new RageBitmapTexture( m_pScreen, sTexturePath, m_dwMaxTextureSize, m_dwTextureColorDepth, dwHints ); pTexture = (RageTexture*) new RageBitmapTexture( m_pScreen, sTexturePath, m_dwMaxTextureSize, m_dwTextureColorDepth, dwHints );
HELPER.Log( "RageTextureManager: Loading '%s' (%ux%u) from disk. It has %d references", HELPER.Log( "RageTextureManager: Finished loading '%s' - %d references.", sTexturePath );
sTexturePath,
pTexture->GetTextureWidth(),
pTexture->GetTextureHeight(),
pTexture->m_iRefCount
);
m_mapPathToTexture.SetAt( sTexturePath, pTexture ); m_mapPathToTexture.SetAt( sTexturePath, pTexture );
} }
@@ -135,12 +134,25 @@ void RageTextureManager::UnloadTexture( CString sTexturePath )
} }
else else
{ {
HELPER.Log( ssprintf("RageTextureManager: '%s' will not be deleted. It still has %d references.", sTexturePath, pTexture->m_iRefCount) ); HELPER.Log( "RageTextureManager: '%s' will not be deleted. It still has %d references.", sTexturePath, pTexture->m_iRefCount );
} }
} }
else // texture not found else // texture not found
{ {
FatalError( ssprintf("Tried to Unload texture '%s' that wasn't loaded.", sTexturePath) ); FatalError( "Tried to Unload texture '%s' that wasn't loaded.", sTexturePath );
} }
} }
void RageTextureManager::ReloadAll()
{
for( POSITION pos = m_mapPathToTexture.GetStartPosition(); pos != NULL; )
{
CString sPath;
RageTexture* pTexture;
m_mapPathToTexture.GetNextAssoc( pos, sPath, pTexture );
pTexture->Reload( m_dwMaxTextureSize, m_dwTextureColorDepth, 0 ); // this not entirely correct. Hints are lost!
}
}
+8 -3
View File
@@ -33,11 +33,16 @@ public:
RageTexture* LoadTexture( CString sTexturePath, const DWORD dwHints = 0, const bool bForceReload = false ); RageTexture* LoadTexture( CString sTexturePath, const DWORD dwHints = 0, const bool bForceReload = false );
bool IsTextureLoaded( CString sTexturePath ); bool IsTextureLoaded( CString sTexturePath );
void UnloadTexture( CString sTexturePath ); void UnloadTexture( CString sTexturePath );
void ReloadAll();
void SetMaxTextureSize( const DWORD dwMaxSize ) { m_dwMaxTextureSize = dwMaxSize; }; void SetPrefs( const DWORD dwMaxSize, const DWORD dwTextureColorDepth )
{
ASSERT( m_dwMaxTextureSize >= 64 );
m_dwMaxTextureSize = dwMaxSize;
m_dwTextureColorDepth = dwTextureColorDepth;
ReloadAll();
};
DWORD GetMaxTextureSize() { return m_dwMaxTextureSize; }; DWORD GetMaxTextureSize() { return m_dwMaxTextureSize; };
void SetTextureColorDepth( const DWORD dwTextureColorDepth ) { m_dwTextureColorDepth = dwTextureColorDepth; };
DWORD GetTextureColorDepth() { return m_dwTextureColorDepth; }; DWORD GetTextureColorDepth() { return m_dwTextureColorDepth; };
protected: protected:
+15
View File
@@ -28,6 +28,21 @@ bool IsAnInt( LPCTSTR s )
return true; return true;
} }
float TimeToSeconds( CString sHMS )
{
CStringArray arrayBits;
split( sHMS, ":", arrayBits, false );
while( arrayBits.GetSize() < 3 )
arrayBits.InsertAt( 0, "0" ); // pad missing bits
float fSeconds = 0;
fSeconds += atoi( arrayBits[0] ) * 60 * 60;
fSeconds += atoi( arrayBits[1] ) * 60;
fSeconds += (float)atof( arrayBits[2] );
return fSeconds;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+1
View File
@@ -56,6 +56,7 @@ inline float froundf( const float f, const float fRoundInterval )
} }
bool IsAnInt( LPCTSTR s ); bool IsAnInt( LPCTSTR s );
float TimeToSeconds( CString sHMS );
CString ssprintf( LPCTSTR fmt, ...); CString ssprintf( LPCTSTR fmt, ...);
+8 -23
View File
@@ -45,28 +45,6 @@ bool RandomSample::LoadSoundDir( CString sDir )
return true; return true;
} }
bool RandomSample::LoadRandomSample( CString sSetFilePath )
{
CStdioFile file;
if( !file.Open(sSetFilePath, CFile::modeRead|CFile::shareDenyNone) )
FatalError( ssprintf("Error opening sound set file '%s'.", sSetFilePath) );
// Split for the directory of the sound set file. We'll need it below
CString sDir, sFileName, sExtension;
splitrelpath( sSetFilePath, sDir, sFileName, sExtension );
CString line;
while( file.ReadString(line) )
{
if( line != "" )
LoadSound( sDir + line );
}
return true;
}
bool RandomSample::LoadSound( CString sSoundFilePath ) bool RandomSample::LoadSound( CString sSoundFilePath )
{ {
HELPER.Log( "RandomSample::LoadSound( %s )", sSoundFilePath ); HELPER.Log( "RandomSample::LoadSound( %s )", sSoundFilePath );
@@ -89,7 +67,14 @@ void RandomSample::PlayRandom()
} }
else else
{ {
int iIndexToPlay = rand() % m_pSamples.GetSize(); int iIndexToPlay;
for( int i=0; i<5; i++ )
{
iIndexToPlay = rand() % m_pSamples.GetSize();
if( iIndexToPlay != m_iIndexLastPlayed )
break;
}
m_pSamples[iIndexToPlay]->Play(); m_pSamples[iIndexToPlay]->Play();
m_iIndexLastPlayed = iIndexToPlay; m_iIndexLastPlayed = iIndexToPlay;
} }
+2 -7
View File
@@ -29,12 +29,8 @@ public:
sExt.MakeLower(); sExt.MakeLower();
if( sExt == "" ) if( sExt == "" ) return LoadSoundDir( sFilePath );
return LoadSoundDir( sFilePath ); else return LoadSound( sFilePath );
else if( sExt == "set" )
return LoadRandomSample( sFilePath );
else
return LoadSound( sFilePath );
}; };
void PlayRandom(); void PlayRandom();
@@ -43,7 +39,6 @@ public:
private: private:
bool LoadSoundDir( CString sDir ); bool LoadSoundDir( CString sDir );
bool LoadRandomSample( CString sSetFilePath );
bool LoadSound( CString sSoundFilePath ); bool LoadSound( CString sSoundFilePath );
+5
View File
@@ -34,6 +34,11 @@ ScoreDisplayRolling::ScoreDisplayRolling()
} }
void ScoreDisplayRolling::SetScore( int iNewScore )
{
SetScore( (float)iNewScore );
}
void ScoreDisplayRolling::SetScore( float fNewScore ) void ScoreDisplayRolling::SetScore( float fNewScore )
{ {
m_fScore = fNewScore; m_fScore = fNewScore;
+1
View File
@@ -28,6 +28,7 @@ public:
ScoreDisplayRolling(); ScoreDisplayRolling();
void SetScore( float fNewScore ); void SetScore( float fNewScore );
void SetScore( int iNewScore );
float GetScore(); float GetScore();
void AddToScore( TapNoteScore score, int iCurCombo ); void AddToScore( TapNoteScore score, int iCurCombo );
+40 -26
View File
@@ -72,7 +72,7 @@ Song::Song()
{ {
m_bChangedSinceSave = false; m_bChangedSinceSave = false;
m_fOffsetInSeconds = 0; m_fOffsetInSeconds = 0;
m_fMusicSampleStartBeat = m_fMusicSampleEndBeat = -1; m_fMusicSampleStartSeconds = m_fMusicSampleLengthSeconds = -1;
m_dwMusicBytes = 0; m_dwMusicBytes = 0;
} }
@@ -300,15 +300,15 @@ bool Song::LoadFromBMSDir( CString sDir )
// handle the data // handle the data
if( -1 != value_name.Find("#title") ) if( -1 != value_name.Find("#title") )
{ {
m_sTitle = value_data;
// strip NoteMetadata type out of description leaving only song title (looks like 'B4U <BASIC>') // strip NoteMetadata type out of description leaving only song title (looks like 'B4U <BASIC>')
m_sTitle.Replace( "(ANOTHER)", "" ); value_data.Replace( "(ANOTHER)", "" );
m_sTitle.Replace( "(BASIC)", "" ); value_data.Replace( "(BASIC)", "" );
m_sTitle.Replace( "(MANIAC)", "" ); value_data.Replace( "(MANIAC)", "" );
m_sTitle.Replace( "<ANOTHER>", "" ); value_data.Replace( "<ANOTHER>", "" );
m_sTitle.Replace( "<BASIC>", "" ); value_data.Replace( "<BASIC>", "" );
m_sTitle.Replace( "<MANIAC>", "" ); value_data.Replace( "<MANIAC>", "" );
GetMainAndSubTitlesFromFullTitle( value_data, m_sMainTitle, m_sSubTitle );
} }
else if( -1 != value_name.Find("#artist") ) else if( -1 != value_name.Find("#artist") )
{ {
@@ -481,8 +481,9 @@ bool Song::LoadFromDWIFile( CString sPath )
m_sMusicPath = CString("DWI Support\\") + arrayValueTokens[1]; m_sMusicPath = CString("DWI Support\\") + arrayValueTokens[1];
else if( sValueName == "#TITLE" ) else if( sValueName == "#TITLE" )
m_sTitle = arrayValueTokens[1]; {
GetMainAndSubTitlesFromFullTitle( arrayValueTokens[1], m_sMainTitle, m_sSubTitle );
}
else if( sValueName == "#ARTIST" ) else if( sValueName == "#ARTIST" )
m_sArtist = arrayValueTokens[1]; m_sArtist = arrayValueTokens[1];
@@ -499,6 +500,12 @@ bool Song::LoadFromDWIFile( CString sPath )
// the units of GAP is 1/1000 second // the units of GAP is 1/1000 second
m_fOffsetInSeconds = -atoi( arrayValueTokens[1] ) / 1000.0f; m_fOffsetInSeconds = -atoi( arrayValueTokens[1] ) / 1000.0f;
else if( sValueName == "#SAMPLESTART" )
m_fMusicSampleStartSeconds = TimeToSeconds( arrayValueTokens[1] );
else if( sValueName == "#SAMPLELENGTH" )
m_fMusicSampleLengthSeconds = TimeToSeconds( arrayValueTokens[1] );
else if( sValueName == "#FREEZE" ) else if( sValueName == "#FREEZE" )
{ {
CStringArray arrayFreezeExpressions; CStringArray arrayFreezeExpressions;
@@ -648,7 +655,13 @@ bool Song::LoadFromSMDir( CString sDir )
// handle the data // handle the data
if( sValueName == "#TITLE" ) if( sValueName == "#TITLE" )
m_sTitle = arrayValueTokens[1]; GetMainAndSubTitlesFromFullTitle( arrayValueTokens[1], m_sMainTitle, m_sSubTitle );
if( sValueName == "#MAINTITLE" )
m_sMainTitle = arrayValueTokens[1];
if( sValueName == "#SUBTITLE" )
m_sSubTitle = arrayValueTokens[1];
else if( sValueName == "#ARTIST" ) else if( sValueName == "#ARTIST" )
m_sArtist = arrayValueTokens[1]; m_sArtist = arrayValueTokens[1];
@@ -678,19 +691,15 @@ bool Song::LoadFromSMDir( CString sDir )
else if( sValueName == "#MUSICBYTES" ) else if( sValueName == "#MUSICBYTES" )
m_dwMusicBytes = atoi( arrayValueTokens[1] ); m_dwMusicBytes = atoi( arrayValueTokens[1] );
else if( sValueName == "#SAMPLESTART" )
m_fMusicSampleStartSeconds = TimeToSeconds( arrayValueTokens[1] );
else if( sValueName == "#SAMPLELENGTH" )
m_fMusicSampleLengthSeconds = TimeToSeconds( arrayValueTokens[1] );
else if( sValueName == "#OFFSET" ) else if( sValueName == "#OFFSET" )
m_fOffsetInSeconds = (float)atof( arrayValueTokens[1] ); m_fOffsetInSeconds = (float)atof( arrayValueTokens[1] );
else if( sValueName == "#MUSICSAMPLERANGE" )
{
CStringArray arrayBeatValues;
split( arrayValueTokens[1], ",", arrayBeatValues );
m_fMusicSampleStartBeat = (float)atof( arrayBeatValues[0] );
m_fMusicSampleEndBeat = (float)atof( arrayBeatValues[1] );
}
else if( sValueName == "#FREEZES" ) else if( sValueName == "#FREEZES" )
{ {
CStringArray arrayFreezeExpressions; CStringArray arrayFreezeExpressions;
@@ -748,8 +757,9 @@ bool Song::LoadFromSMDir( CString sDir )
void Song::TidyUpData() void Song::TidyUpData()
{ {
if( m_sTitle == "" ) m_sTitle = "Untitled song"; m_sMainTitle.TrimRight();
m_sTitle.TrimRight(); if( m_sMainTitle == "" ) m_sMainTitle = "Untitled song";
m_sSubTitle.TrimRight();
if( m_sArtist == "" ) m_sArtist = "Unknown artist"; if( m_sArtist == "" ) m_sArtist = "Unknown artist";
if( m_BPMSegments.GetSize() == 0 ) if( m_BPMSegments.GetSize() == 0 )
FatalError( "No #BPM specified in '%s.'", GetSongFilePath() ); FatalError( "No #BPM specified in '%s.'", GetSongFilePath() );
@@ -1008,7 +1018,8 @@ void Song::Save()
if( !file.Open( m_sSongFilePath, CFile::modeWrite | CFile::modeCreate ) ) if( !file.Open( m_sSongFilePath, CFile::modeWrite | CFile::modeCreate ) )
FatalError( "Error opening song file '%s' for writing.", m_sSongFilePath ); FatalError( "Error opening song file '%s' for writing.", m_sSongFilePath );
file.WriteString( ssprintf("#TITLE:%s;\n", m_sTitle) ); file.WriteString( ssprintf("#MAINTITLE:%s;\n", m_sMainTitle) );
file.WriteString( ssprintf("#SUBTITLE:%s;\n", m_sSubTitle) );
file.WriteString( ssprintf("#ARTIST:%s;\n", m_sArtist) ); file.WriteString( ssprintf("#ARTIST:%s;\n", m_sArtist) );
file.WriteString( ssprintf("#CREDIT:%s;\n", m_sCredit) ); file.WriteString( ssprintf("#CREDIT:%s;\n", m_sCredit) );
@@ -1055,6 +1066,9 @@ void Song::Save()
file.WriteString( ssprintf("#MUSICBYTES:%u;\n", m_dwMusicBytes) ); file.WriteString( ssprintf("#MUSICBYTES:%u;\n", m_dwMusicBytes) );
file.WriteString( ssprintf("#OFFSET:%f;\n", m_fOffsetInSeconds) ); file.WriteString( ssprintf("#OFFSET:%f;\n", m_fOffsetInSeconds) );
file.WriteString( ssprintf("#SAMPLESTART:%f;\n", m_fMusicSampleStartSeconds) );
file.WriteString( ssprintf("#SAMPLELENGTH:%f;\n", m_fMusicSampleLengthSeconds) );
file.WriteString( "#FREEZES:" ); file.WriteString( "#FREEZES:" );
for( i=0; i<m_FreezeSegments.GetSize(); i++ ) for( i=0; i<m_FreezeSegments.GetSize(); i++ )
{ {
@@ -1113,8 +1127,8 @@ int CompareSongPointersByTitle(const void *arg1, const void *arg2)
Song* pSong1 = *(Song**)arg1; Song* pSong1 = *(Song**)arg1;
Song* pSong2 = *(Song**)arg2; Song* pSong2 = *(Song**)arg2;
CString sTitle1 = pSong1->GetFullTitle(); CString sTitle1 = pSong1->GetMainTitle();
CString sTitle2 = pSong2->GetFullTitle(); CString sTitle2 = pSong2->GetMainTitle();
CString sFilePath1 = pSong1->GetSongFilePath(); // this is unique among songs CString sFilePath1 = pSong1->GetSongFilePath(); // this is unique among songs
CString sFilePath2 = pSong2->GetSongFilePath(); CString sFilePath2 = pSong2->GetSongFilePath();
+27 -10
View File
@@ -134,26 +134,42 @@ void SongManager::LoadStepManiaSongDir( CString sDir )
} }
} }
void SongManager::LoadDWISongDir( CString sDir )
void SongManager::LoadDWISongDir( CString DWIHome )
{ {
// trim off the trailing slash if any // trim off the trailing slash if any
sDir.TrimRight( "/\\" ); DWIHome.TrimRight( "/\\" );
// this has to be fixed, DWI doesn't put files
// in it's DWI folder. It puts them in Songs/<MIX>/<SONGNAME>
// so what we have to do, is go to the DWI directory (which will
// be changeable by the user so they don't have to copy everything
// over and have two copies of everything
// Find all directories in "DWIs" folder // Find all directories in "DWIs" folder
CStringArray arrayDirs; CStringArray arrayDirs;
GetDirListing( "DWI Support\\DWIs\\*.*", arrayDirs, true ); CStringArray MixDirs;
SortCStringArray( arrayDirs ); // now we've got the listing of the mix directories
// and we need to use THOSE directories to find our
// dwis
GetDirListing( ssprintf("%s\\Songs\\*.*", DWIHome ), MixDirs, true );
SortCStringArray( MixDirs );
for( int i=0; i< arrayDirs.GetSize(); i++ ) // for each dir in /DWIs/ for( int i=0; i< MixDirs.GetSize(); i++ ) // for each dir in /Songs/
{ {
CString sDirName = arrayDirs[i]; // the dir name will most likely be something like
// Dance Dance Revolution 4th Mix, etc.
CString sDirName = MixDirs[i];
sDirName.MakeLower(); sDirName.MakeLower();
if( sDirName == "cvs" ) // ignore the directory called "CVS" if( sDirName == "cvs" ) // ignore the directory called "CVS"
continue; continue;
GetDirListing( ssprintf("%s\\Songs\\%s\\*.*", DWIHome, MixDirs[i]), arrayDirs, true);
SortCStringArray(arrayDirs, true);
for( int b = 0; b < arrayDirs.GetSize(); b++)
{
// Find all DWIs in this directory // Find all DWIs in this directory
CStringArray arrayDWIFiles; CStringArray arrayDWIFiles;
GetDirListing( ssprintf("DWI Support\\DWIs\\%s\\*.dwi", sDirName), arrayDWIFiles ); GetDirListing( ssprintf("%s\\Songs\\%s\\%s\\*.dwi", DWIHome, MixDirs[i], arrayDirs[b]), arrayDWIFiles, false);
SortCStringArray( arrayDWIFiles ); SortCStringArray( arrayDWIFiles );
for( int j=0; j< arrayDWIFiles.GetSize(); j++ ) // for each DWI file for( int j=0; j< arrayDWIFiles.GetSize(); j++ ) // for each DWI file
@@ -163,11 +179,12 @@ void SongManager::LoadDWISongDir( CString sDir )
// load DWIs from the sub dirs // load DWIs from the sub dirs
Song* pNewSong = new Song; Song* pNewSong = new Song;
pNewSong->LoadFromDWIFile( ssprintf("DWI Support\\DWIs\\%s\\%s", sDirName, sDWIFileName) ); pNewSong->LoadFromDWIFile( ssprintf("%s\\Songs\\%s\\%s\\%s", DWIHome, MixDirs[i], arrayDirs[b], sDWIFileName) );
m_pSongs.Add( pNewSong ); m_pSongs.Add( pNewSong );
} }
} }
} }
}
@@ -228,7 +245,7 @@ void SongManager::ReadStatisticsFromDisk()
Song* pSong = NULL; Song* pSong = NULL;
for( i=0; i<m_pSongs.GetSize(); i++ ) for( i=0; i<m_pSongs.GetSize(); i++ )
{ {
if( m_pSongs[i]->GetFullTitle() == szSongName ) // match! if( m_pSongs[i]->GetMainTitle() == szSongName ) // match!
{ {
pSong = m_pSongs[i]; pSong = m_pSongs[i];
break; break;
@@ -290,7 +307,7 @@ void SongManager::SaveStatisticsToDisk()
// Each value has the format "SongName::NoteMetadataName=TimesPlayed::TopGrade::TopScore::MaxCombo". // Each value has the format "SongName::NoteMetadataName=TimesPlayed::TopGrade::TopScore::MaxCombo".
CString sName = ssprintf( "%s::%s", pSong->GetFullTitle(), pNoteMetadata->m_sDescription ); CString sName = ssprintf( "%s::%s", pSong->GetMainTitle(), pNoteMetadata->m_sDescription );
CString sValue = ssprintf( CString sValue = ssprintf(
"%d::%s::%d::%d", "%d::%s::%d::%d",
pNoteMetadata->m_iNumTimesPlayed, pNoteMetadata->m_iNumTimesPlayed,
+13 -14
View File
@@ -222,29 +222,28 @@ void Sprite::RenderPrimitives()
CUSTOMVERTEX* v; CUSTOMVERTEX* v;
pVB->Lock( 0, 0, (BYTE**)&v, 0 ); pVB->Lock( 0, 0, (BYTE**)&v, 0 );
// shift by one pixel because sprites are not aligned (why?!?) v[0].p = D3DXVECTOR3( quadVerticies.left, quadVerticies.bottom, 0 ); // bottom left
v[0].p = D3DXVECTOR3( quadVerticies.left+1, quadVerticies.bottom, 0 ); // bottom left v[1].p = D3DXVECTOR3( quadVerticies.left, quadVerticies.top, 0 ); // top left
v[1].p = D3DXVECTOR3( quadVerticies.left+1, quadVerticies.top, 0 ); // top left v[2].p = D3DXVECTOR3( quadVerticies.right, quadVerticies.bottom, 0 ); // bottom right
v[2].p = D3DXVECTOR3( quadVerticies.right+1, quadVerticies.bottom, 0 ); // bottom right v[3].p = D3DXVECTOR3( quadVerticies.right, quadVerticies.top, 0 ); // top right
v[3].p = D3DXVECTOR3( quadVerticies.right+1, quadVerticies.top, 0 ); // top right
if( m_bUsingCustomTexCoords ) if( m_bUsingCustomTexCoords )
{ {
v[0].tu = m_CustomTexCoords[0]; v[0].tv = m_CustomTexCoords[1]; // bottom left v[0].t = D3DXVECTOR2( m_CustomTexCoords[0], m_CustomTexCoords[1] ); // bottom left
v[1].tu = m_CustomTexCoords[2]; v[1].tv = m_CustomTexCoords[3]; // top left v[1].t = D3DXVECTOR2( m_CustomTexCoords[2], m_CustomTexCoords[3] ); // top left
v[2].tu = m_CustomTexCoords[4]; v[2].tv = m_CustomTexCoords[5]; // bottom right v[2].t = D3DXVECTOR2( m_CustomTexCoords[4], m_CustomTexCoords[5] ); // bottom right
v[3].tu = m_CustomTexCoords[6]; v[3].tv = m_CustomTexCoords[7]; // top right v[3].t = D3DXVECTOR2( m_CustomTexCoords[6], m_CustomTexCoords[7] ); // top right
} }
else else
{ {
UINT uFrameNo = m_iStateToFrame[m_iCurState]; UINT uFrameNo = m_iStateToFrame[m_iCurState];
FRECT* pTexCoordRect = m_pTexture->GetTextureCoordRect( uFrameNo ); FRECT* pTexCoordRect = m_pTexture->GetTextureCoordRect( uFrameNo );
v[0].tu = pTexCoordRect->left; v[0].tv = pTexCoordRect->bottom; // bottom left v[0].t = D3DXVECTOR2( pTexCoordRect->left, pTexCoordRect->bottom ); // bottom left
v[1].tu = pTexCoordRect->left; v[1].tv = pTexCoordRect->top; // top left v[1].t = D3DXVECTOR2( pTexCoordRect->left, pTexCoordRect->top ); // top left
v[2].tu = pTexCoordRect->right; v[2].tv = pTexCoordRect->bottom; // bottom right v[2].t = D3DXVECTOR2( pTexCoordRect->right, pTexCoordRect->bottom ); // bottom right
v[3].tu = pTexCoordRect->right; v[3].tv = pTexCoordRect->top; // top right v[3].t = D3DXVECTOR2( pTexCoordRect->right, pTexCoordRect->top ); // top right
} }
@@ -270,7 +269,7 @@ void Sprite::RenderPrimitives()
////////////////////// //////////////////////
// render the shadow // render the shadow
////////////////////// //////////////////////
if( m_bShadow ) if( m_bShadow && PREFS && PREFS->GetCurrentGraphicProfileOptions()->m_bShadows )
{ {
SCREEN->PushMatrix(); SCREEN->PushMatrix();
SCREEN->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units SCREEN->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units
+1
View File
@@ -37,6 +37,7 @@ public:
return LoadFromTexture( sFilePath, dwHints, bForceReload ); return LoadFromTexture( sFilePath, dwHints, bForceReload );
}; };
void UnloadTexture(); void UnloadTexture();
RageTexture* GetTexture() { return m_pTexture; };
virtual void RenderPrimitives(); virtual void RenderPrimitives();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
+18 -93
View File
@@ -44,6 +44,7 @@
#include "WindowResults.h" #include "WindowResults.h"
#include "WindowTitleMenu.h" #include "WindowTitleMenu.h"
#include "WindowPlayerOptions.h" #include "WindowPlayerOptions.h"
#include "WindowMusicScroll.h"
#include "ScreenDimensions.h" #include "ScreenDimensions.h"
@@ -409,15 +410,14 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
case WM_COMMAND: case WM_COMMAND:
{ {
GraphicOptions &go = PREFS->m_GraphicOptions;
switch( LOWORD(wParam) ) switch( LOWORD(wParam) )
{ {
case IDM_TOGGLEFULLSCREEN: case IDM_TOGGLEFULLSCREEN:
go.m_bWindowed = !go.m_bWindowed; PREFS->m_bWindowed = !PREFS->m_bWindowed;
ApplyGraphicOptions(); ApplyGraphicOptions();
return 0; return 0;
case IDM_CHANGEDETAIL: case IDM_CHANGEDETAIL:
go.m_Profile = GraphicProfile( (go.m_Profile+1)%NUM_GRAPHIC_PROFILES ); PREFS->m_GraphicProfile = GraphicProfile( (PREFS->m_GraphicProfile+1)%NUM_GRAPHIC_PROFILES );
ApplyGraphicOptions(); ApplyGraphicOptions();
return 0; return 0;
case IDM_EXIT: case IDM_EXIT:
@@ -525,6 +525,7 @@ HRESULT CreateObjects( HWND hWnd )
//WM->SetNewWindow( new WindowResults ); //WM->SetNewWindow( new WindowResults );
//WM->SetNewWindow( new WindowPlayerOptions ); //WM->SetNewWindow( new WindowPlayerOptions );
WM->SetNewWindow( new WindowTitleMenu ); WM->SetNewWindow( new WindowTitleMenu );
//WM->SetNewWindow( new WindowMusicScroll );
DXUtil_Timer( TIMER_START ); // Start the accurate timer DXUtil_Timer( TIMER_START ); // Start the accurate timer
@@ -710,6 +711,7 @@ void Render()
SCREEN->ResetMatrixStack(); SCREEN->ResetMatrixStack();
// draw the game // draw the game
WM->Draw(); WM->Draw();
@@ -743,88 +745,16 @@ void ApplyGraphicOptions()
{ {
InvalidateObjects(); InvalidateObjects();
GraphicOptions &go = PREFS->m_GraphicOptions; GraphicProfileOptions *pGPO = PREFS->GetCurrentGraphicProfileOptions();
bool bWindowed = go.m_bWindowed; bool bWindowed = PREFS->m_bWindowed;
CString sProfileName = pGPO->m_szProfileName;
// DWORD dwWidth = pGPO->m_dwWidth;
// fill these in below depending on the profile DWORD dwHeight = pGPO->m_dwHeight;
// DWORD dwDisplayBPP = pGPO->m_dwDisplayColor;
CString sProfileName; DWORD dwTextureBPP = pGPO->m_dwTextureColor;
DWORD dwWidth, dwHeight; DWORD dwMaxTextureSize = pGPO->m_dwMaxTextureSize;
DWORD dwDisplayBPP; DWORD dwFlags = 0; // not used anymore
DWORD dwTextureBPP;
DWORD dwMaxTextureSize;
bool bShadows;
bool bBackgrounds;
switch( go.m_Profile )
{
case PROFILE_SUPER_LOW:
sProfileName = "Super Low";
dwWidth = 320;
dwHeight = 240;
dwDisplayBPP = 16;
dwTextureBPP = 16;
dwMaxTextureSize = 256;
bShadows = false;
bBackgrounds = false;
break;
case PROFILE_LOW:
sProfileName = "Low";
dwWidth = 400;
dwHeight = 300;
dwDisplayBPP = 16;
dwTextureBPP = 16;
dwMaxTextureSize = 256;
bShadows = false;
bBackgrounds = true;
break;
case PROFILE_MEDIUM:
sProfileName = "Medium";
dwWidth = 640;
dwHeight = 480;
dwDisplayBPP = 16;
dwTextureBPP = 16;
dwMaxTextureSize = 512;
bShadows = false;
bBackgrounds = true;
break;
case PROFILE_HIGH:
sProfileName = "High";
dwWidth = 640;
dwHeight = 480;
dwDisplayBPP = 16;
dwTextureBPP = 16;
dwMaxTextureSize = 1024;
bShadows = true;
bBackgrounds = true;
break;
case PROFILE_CUSTOM:
sProfileName = "Custom";
dwWidth = go.m_iResolution;
switch( dwWidth )
{
case 320: dwHeight = 240; break;
case 400: dwHeight = 300; break;
case 512: dwHeight = 384; break;
case 640: dwHeight = 480; break;
case 800: dwHeight = 600; break;
case 1024: dwHeight = 768; break;
case 1280: dwHeight = 1024; break;
default: dwHeight = 480; break;
}
dwDisplayBPP = go.m_iDisplayColor;
dwTextureBPP = go.m_iTextureColor;
dwMaxTextureSize = go.m_iMaxTextureSize;
bShadows = go.m_bShadows;
bBackgrounds = go.m_bBackgrounds;
break;
default:
ASSERT( false );
}
DWORD dwFlags = 0; // not used
// //
// If the requested resolution doesn't work, keep switching until we find one that does. // If the requested resolution doesn't work, keep switching until we find one that does.
@@ -860,10 +790,7 @@ void ApplyGraphicOptions()
// Let the texture manager know about our preferences // Let the texture manager know about our preferences
// //
if( TEXTURE != NULL ) if( TEXTURE != NULL )
{ TEXTURE->SetPrefs( dwMaxTextureSize, dwTextureBPP );
TEXTURE->SetMaxTextureSize( dwMaxTextureSize );
TEXTURE->SetTextureColorDepth( dwTextureBPP );
}
RestoreObjects(); RestoreObjects();
@@ -871,11 +798,9 @@ void ApplyGraphicOptions()
if( WM ) if( WM )
{ {
CString sMessage; CString sMessage = ssprintf("%s - %s detail", bWindowed ? "Windowed" : "FullScreen", sProfileName );
if( sProfileName == "Custom" ) if( PREFS->m_GraphicProfile == PROFILE_CUSTOM )
sMessage = ssprintf("%s - %ux%u - %u color, %u texture", bWindowed ? "Windowed" : "FullScreen", dwWidth, dwHeight, dwDisplayBPP, dwTextureBPP); sMessage += ssprintf(" - %ux%u - %u color, %u texture", dwWidth, dwHeight, dwDisplayBPP, dwTextureBPP);
else
sMessage = ssprintf("%s - %s detail", bWindowed ? "Windowed" : "FullScreen", sProfileName );
WM->SystemMessage( sMessage ); WM->SystemMessage( sMessage );
} }
+34 -2
View File
@@ -284,6 +284,14 @@ SOURCE=.\WindowOptions.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\WindowOptionsType2.cpp
# End Source File
# Begin Source File
SOURCE=.\WindowOptionsType2.h
# End Source File
# Begin Source File
SOURCE=.\WindowPlayerOptions.cpp SOURCE=.\WindowPlayerOptions.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -324,6 +332,14 @@ SOURCE=.\WindowSelectDifficulty.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\WindowSelectGame.cpp
# End Source File
# Begin Source File
SOURCE=.\WindowSelectGame.h
# End Source File
# Begin Source File
SOURCE=.\WindowSelectGroup.cpp SOURCE=.\WindowSelectGroup.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -332,6 +348,14 @@ SOURCE=.\WindowSelectGroup.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\WindowSelectMode.cpp
# End Source File
# Begin Source File
SOURCE=.\WindowSelectMode.h
# End Source File
# Begin Source File
SOURCE=.\WindowSelectMusic.cpp SOURCE=.\WindowSelectMusic.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -860,11 +884,11 @@ SOURCE=.\Background.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\ColorArrow.cpp SOURCE=.\ColorNote.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\ColorArrow.h SOURCE=.\ColorNote.h
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -948,6 +972,14 @@ SOURCE=.\Judgement.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\LifeMeterBar.cpp
# End Source File
# Begin Source File
SOURCE=.\LifeMeterBar.h
# End Source File
# Begin Source File
SOURCE=.\LifeMeterPills.cpp SOURCE=.\LifeMeterPills.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
+38 -14
View File
@@ -71,26 +71,26 @@
</Configuration> </Configuration>
<Configuration <Configuration
Name="Release|Win32" Name="Release|Win32"
OutputDirectory="Release and Debug" OutputDirectory="./.."
IntermediateDirectory="Release and Debug" IntermediateDirectory="./../Release"
ConfigurationType="1" ConfigurationType="1"
UseOfMFC="1" UseOfMFC="1"
ATLMinimizesCRunTimeLibraryUsage="FALSE" ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2" CharacterSet="2"
WholeProgramOptimization="FALSE"> WholeProgramOptimization="TRUE">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/EHa" AdditionalOptions="/EHa"
Optimization="3" Optimization="3"
GlobalOptimizations="FALSE" GlobalOptimizations="TRUE"
InlineFunctionExpansion="0" InlineFunctionExpansion="2"
EnableIntrinsicFunctions="TRUE" EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"
OptimizeForWindowsApplication="TRUE" OptimizeForWindowsApplication="TRUE"
PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS" PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS"
StringPooling="TRUE" StringPooling="TRUE"
MinimalRebuild="TRUE" MinimalRebuild="FALSE"
RuntimeLibrary="0" RuntimeLibrary="0"
BufferSecurityCheck="FALSE" BufferSecurityCheck="FALSE"
EnableFunctionLevelLinking="FALSE" EnableFunctionLevelLinking="FALSE"
@@ -182,12 +182,6 @@
<File <File
RelativePath=".\WindowEditMenu.h"> RelativePath=".\WindowEditMenu.h">
</File> </File>
<File
RelativePath="WindowEnding.cpp">
</File>
<File
RelativePath="WindowEnding.h">
</File>
<File <File
RelativePath=".\WindowGameOptions.cpp"> RelativePath=".\WindowGameOptions.cpp">
</File> </File>
@@ -209,12 +203,24 @@
<File <File
RelativePath=".\WindowMessage.h"> RelativePath=".\WindowMessage.h">
</File> </File>
<File
RelativePath="WindowMusicScroll.cpp">
</File>
<File
RelativePath="WindowMusicScroll.h">
</File>
<File <File
RelativePath=".\WindowOptions.cpp"> RelativePath=".\WindowOptions.cpp">
</File> </File>
<File <File
RelativePath=".\WindowOptions.h"> RelativePath=".\WindowOptions.h">
</File> </File>
<File
RelativePath="WindowOptionsType2.cpp">
</File>
<File
RelativePath="WindowOptionsType2.h">
</File>
<File <File
RelativePath=".\WindowPlayerOptions.cpp"> RelativePath=".\WindowPlayerOptions.cpp">
</File> </File>
@@ -245,12 +251,24 @@
<File <File
RelativePath="WindowSelectDifficulty.h"> RelativePath="WindowSelectDifficulty.h">
</File> </File>
<File
RelativePath="WindowSelectGame.cpp">
</File>
<File
RelativePath="WindowSelectGame.h">
</File>
<File <File
RelativePath="WindowSelectGroup.cpp"> RelativePath="WindowSelectGroup.cpp">
</File> </File>
<File <File
RelativePath="WindowSelectGroup.h"> RelativePath="WindowSelectGroup.h">
</File> </File>
<File
RelativePath="WindowSelectMode.cpp">
</File>
<File
RelativePath="WindowSelectMode.h">
</File>
<File <File
RelativePath="WindowSelectMusic.cpp"> RelativePath="WindowSelectMusic.cpp">
</File> </File>
@@ -652,10 +670,10 @@
RelativePath=".\Background.h"> RelativePath=".\Background.h">
</File> </File>
<File <File
RelativePath=".\ColorArrow.cpp"> RelativePath="ColorNote.cpp">
</File> </File>
<File <File
RelativePath=".\ColorArrow.h"> RelativePath="ColorNote.h">
</File> </File>
<File <File
RelativePath=".\Combo.cpp"> RelativePath=".\Combo.cpp">
@@ -717,6 +735,12 @@
<File <File
RelativePath=".\Judgement.h"> RelativePath=".\Judgement.h">
</File> </File>
<File
RelativePath="LifeMeterBar.cpp">
</File>
<File
RelativePath="LifeMeterBar.h">
</File>
<File <File
RelativePath=".\LifeMeterPills.cpp"> RelativePath=".\LifeMeterPills.cpp">
</File> </File>
+126
View File
@@ -13,5 +13,131 @@
#include "RageHelper.h" #include "RageHelper.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "ErrorCatcher/ErrorCatcher.h" #include "ErrorCatcher/ErrorCatcher.h"
#include "GameDef.h"
#include "IniFile.h"
StyleDef::StyleDef( GameDef* pGameDef, CString sStyleFilePath )
{
HELPER.Log( "StyleDef::StyleDef( '%s )", sStyleFilePath );
// extract the game name
CString sThrowAway;
splitrelpath( sStyleFilePath, sThrowAway, m_sName, sThrowAway );
//
// Parse the .style definition file
//
IniFile ini;
ini.SetPath( sStyleFilePath );
if( !ini.ReadFile() )
FatalError( "Error reading style definition file '%s'.", sStyleFilePath );
if( ini.GetValue( "Style", "Name" ) != m_sName )
FatalError( "Style name in '%s' doesn't match the file name.", sStyleFilePath );
m_sDescription = ini.GetValue( "Style", "Description" );
if( m_sDescription == "" )
FatalError( "Invalid value for Description in '%s'.", sStyleFilePath );
m_sReadsTag = ini.GetValue( "Style", "ReadsTag" );
if( m_sReadsTag == "" )
FatalError( "Invalid value for ReadsTag in '%s'.", sStyleFilePath );
m_iNumPlayers = ini.GetValueI( "Style", "NumPlayers" );
if( m_iNumPlayers < 1 || m_iNumPlayers > 2 )
FatalError( "Invalid value for NumPlayers in '%s'.", sStyleFilePath );
m_iColsPerPlayer = ini.GetValueI( "Style", "ColsPerPlayer" );
if( m_iColsPerPlayer < 1 || m_iColsPerPlayer > MAX_COLS_PER_PLAYER )
FatalError( "Invalid value for ColsPerPlayer in '%s'.", sStyleFilePath );
for( int p=0; p<m_iNumPlayers; p++ )
{
for( int c=0; c<m_iColsPerPlayer; c++ )
{
ColumnInfo &colInfo = m_ColumnInfo[p][c]; // fill this in below
CString sValueName = ssprintf( "P%01dCol%02d", p+1, c+1 );
CString sColumnInfo = ini.GetValue( "Style", sValueName ); // should look like "TRACK08,INSTRUMENT02,right,576"
if( sColumnInfo == "" )
FatalError( "Value '%s' missing in file '%s'.", sValueName, sStyleFilePath );
// replace the constants with their corresponding integer literals
sColumnInfo.Replace( "TRACK01", "0" );
sColumnInfo.Replace( "TRACK02", "1" );
sColumnInfo.Replace( "TRACK03", "2" );
sColumnInfo.Replace( "TRACK04", "3" );
sColumnInfo.Replace( "TRACK05", "4" );
sColumnInfo.Replace( "TRACK06", "5" );
sColumnInfo.Replace( "TRACK07", "6" );
sColumnInfo.Replace( "TRACK08", "7" );
sColumnInfo.Replace( "TRACK09", "8" );
sColumnInfo.Replace( "TRACK00", "9" );
sColumnInfo.Replace( "TRACK11", "10" );
sColumnInfo.Replace( "TRACK12", "11" );
sColumnInfo.Replace( "TRACK13", "12" );
sColumnInfo.Replace( "TRACK14", "13" );
sColumnInfo.Replace( "TRACK15", "14" );
sColumnInfo.Replace( "TRACK16", "15" );
sColumnInfo.Replace( "INSTRUMENT01", "0" );
sColumnInfo.Replace( "INSTRUMENT02", "1" );
// replace button names with their corresponding index
for( int b=0; b<pGameDef->m_iButtonsPerInstrument; b++ )
if( 0 != sColumnInfo.Replace( pGameDef->m_sButtonNames[b], ssprintf("%d",b) ) ) // replace was successful
break;
if( b == pGameDef->m_iButtonsPerInstrument ) // we didn't replace anything
FatalError( "Invalid button name in ColumnInfo in '%s': '%s'.", sStyleFilePath, sColumnInfo );
CStringArray arrayColumnInfo;
split( sColumnInfo, ",", arrayColumnInfo );
if( arrayColumnInfo.GetSize() != 4 )
FatalError( "Invalid ColumnInfo string in '%s'.", sStyleFilePath );
colInfo.track = atoi( arrayColumnInfo[0] );
colInfo.number = (InstrumentNumber)atoi( arrayColumnInfo[1] );
colInfo.button = (InstrumentButton)atoi( arrayColumnInfo[2] );
colInfo.iX = atoi( arrayColumnInfo[3] );
}
}
m_iColsPerPlayer = ini.GetValueI( "Style", "ColsPerPlayer" );
if( m_iColsPerPlayer < 1 || m_iColsPerPlayer > MAX_COLS_PER_PLAYER )
FatalError( "Invalid value for ColsPerPlayer in '%s'.", sStyleFilePath );
CString sColDrawOrder = ini.GetValue( "Style", "ColDrawOrder" ); // should look like "COL01,COL02,COL03,COL04"
// replace the constants with their corresponding integer literals
sColDrawOrder.Replace( "COL01", "0" );
sColDrawOrder.Replace( "COL02", "1" );
sColDrawOrder.Replace( "COL03", "2" );
sColDrawOrder.Replace( "COL04", "3" );
sColDrawOrder.Replace( "COL05", "4" );
sColDrawOrder.Replace( "COL06", "5" );
sColDrawOrder.Replace( "COL07", "6" );
sColDrawOrder.Replace( "COL08", "7" );
sColDrawOrder.Replace( "COL09", "8" );
sColDrawOrder.Replace( "COL00", "9" );
sColDrawOrder.Replace( "COL11", "10" );
sColDrawOrder.Replace( "COL12", "11" );
sColDrawOrder.Replace( "COL13", "12" );
sColDrawOrder.Replace( "COL14", "13" );
sColDrawOrder.Replace( "COL15", "14" );
sColDrawOrder.Replace( "COL16", "15" );
CStringArray arrayColDrawOrder;
split( sColDrawOrder, ",", arrayColDrawOrder );
if( arrayColDrawOrder.GetSize() != m_iColsPerPlayer )
FatalError( "Invalid number of columns in ColDrawOrder in '%s'.", sStyleFilePath );
for( int c=0; c<m_iColsPerPlayer; c++ )
m_iColumnDrawOrder[c] = atoi( arrayColDrawOrder[c] );
}
+34 -24
View File
@@ -7,8 +7,13 @@
Styles define a set of columns for each player, and information about those Styles define a set of columns for each player, and information about those
columns, like what Instruments are used play those columns and what track columns, like what Instruments are used play those columns and what track
to use to populate the column's notes. to use to populate the column's notes.
A "track" is the term used to descibe a particular note in NoteData space. A "track" is the term used to descibe a particular vertical sting of note
A "column" is the term used to describe a particular note in Style space. in NoteData.
A "column" is the term used to describe the vertical string of notes that
a player sees on the screen while they're playing. Column notes are
picked from a track, but columns and tracks don't have a 1-to-1
correspondance. For example, dance-versus has 8 columns but only 4 tracks
because two players place from the same set of 4 tracks.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
Chris Danford Chris Danford
@@ -21,31 +26,36 @@
#include "GameInput.h" #include "GameInput.h"
typedef TrackNumber NoteColumn; const int MAX_COLS_PER_PLAYER = MAX_NOTE_TRACKS;
const int MAX_NOTE_COLUMNS = MAX_NOTE_TRACKS;
struct StyleDef class GameDef;
class StyleDef
{ {
public: public:
StyleDef( GameDef* pGameDef, CString sStyleFilePath );
LPCTSTR m_szName; // name of the style. e.g. "single", "double" struct ColumnInfo
LPCTSTR m_szReads; // name of the style that we can read. For example, the style named "versus" reads the NoteData with the tag "single" {
TrackNumber track; // take note data from this track
InstrumentNumber number; // use this instrument to hit a note on this track
InstrumentButton button; // use this button to hit a note on this track
int iX; // x position of the column
};
CString m_sName; // name of the style. e.g. "single", "double"
CString m_sDescription;
CString m_sReadsTag; // name of the style that we can read. For example, the style named "versus" reads the NoteData with the tag "dance-single"
int m_iNumPlayers; // either 1 or 2 int m_iNumPlayers; // either 1 or 2
int m_iNumTracks; // number of total tracks this style expects (e.g. 4 for versus, but 8 for double) int m_iColsPerPlayer; // number of total tracks this style expects (e.g. 4 for versus, but 8 for double)
ColumnInfo m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; // maps each players' column to a track in the NoteData
inline int GetColsPerPlayer() { return m_iNumTracks/m_iNumPlayers; }; int m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
struct GameInputAndTrack { TrackNumber track; InstrumentNumber number; InstrumentButton button; };
GameInputAndTrack m_StyleInputToGameInputAndTrack[NUM_PLAYERS][MAX_NOTE_COLUMNS]; // maps each players' column to a track in the NoteData
inline GameInput StyleInputToGameInput( const StyleInput StyleI ) inline GameInput StyleInputToGameInput( const StyleInput StyleI )
{ {
InstrumentNumber n = m_StyleInputToGameInputAndTrack[StyleI.player][StyleI.col].number; InstrumentNumber n = m_ColumnInfo[StyleI.player][StyleI.col].number;
InstrumentButton b = m_StyleInputToGameInputAndTrack[StyleI.player][StyleI.col].button; InstrumentButton b = m_ColumnInfo[StyleI.player][StyleI.col].button;
return GameInput( n, b ); return GameInput( n, b );
}; };
@@ -55,8 +65,8 @@ public:
{ {
for( int t=0; t<MAX_NOTE_TRACKS; t++ ) for( int t=0; t<MAX_NOTE_TRACKS; t++ )
{ {
if( m_StyleInputToGameInputAndTrack[p][t].number == GameI.number && if( m_ColumnInfo[p][t].number == GameI.number &&
m_StyleInputToGameInputAndTrack[p][t].button == GameI.button ) m_ColumnInfo[p][t].button == GameI.button )
{ {
return StyleInput( (PlayerNumber)p, t ); return StyleInput( (PlayerNumber)p, t );
} }
@@ -67,16 +77,16 @@ public:
void GetTransformedNoteDataForStyle( PlayerNumber p, NoteData* pOriginal, NoteData &newNoteData ) void GetTransformedNoteDataForStyle( PlayerNumber p, NoteData* pOriginal, NoteData &newNoteData )
{ {
TrackNumber iNewToOriginalTrack[MAX_NOTE_COLUMNS]; TrackNumber iNewToOriginalTrack[MAX_COLS_PER_PLAYER];
for( int col=0; col<GetColsPerPlayer(); col++ ) for( int col=0; col<m_iColsPerPlayer; col++ )
{ {
GameInputAndTrack GIAT = m_StyleInputToGameInputAndTrack[p][col]; ColumnInfo colInfo = m_ColumnInfo[p][col];
TrackNumber originalTrack = GIAT.track; TrackNumber originalTrack = colInfo.track;
iNewToOriginalTrack[col] = originalTrack; iNewToOriginalTrack[col] = originalTrack;
} }
newNoteData.LoadTransformed( pOriginal, GetColsPerPlayer(), iNewToOriginalTrack ); newNoteData.LoadTransformed( pOriginal, m_iColsPerPlayer, iNewToOriginalTrack );
} }
}; };
+1 -1
View File
@@ -18,7 +18,7 @@ struct StyleInput
bool operator==( const StyleInput &other ) { return player == other.player && col == other.col; }; bool operator==( const StyleInput &other ) { return player == other.player && col == other.col; };
PlayerNumber player; PlayerNumber player;
TrackNumber col; ColumnNumber col;
inline bool IsBlank() const { return player == PLAYER_NONE; }; inline bool IsBlank() const { return player == PLAYER_NONE; };
inline bool IsValid() const { return !IsBlank(); }; inline bool IsValid() const { return !IsBlank(); };
+10 -10
View File
@@ -46,10 +46,10 @@ bool TextBanner::LoadFromSong( Song* pSong )
return true; return true;
} }
CString sTitle = pSong->GetFullTitle(); CString sMainTitle = pSong->GetMainTitle();
CString sSubTitle; CString sSubTitle = pSong->GetSubTitle();
m_textTitle.SetText( sTitle ); m_textTitle.SetText( sMainTitle );
m_textSubTitle.SetText( sSubTitle ); m_textSubTitle.SetText( sSubTitle );
m_textArtist.SetText( "/" + pSong->GetArtist() ); m_textArtist.SetText( "/" + pSong->GetArtist() );
@@ -58,15 +58,15 @@ bool TextBanner::LoadFromSong( Song* pSong )
if( sSubTitle == "" ) if( sSubTitle == "" )
{ {
fTitleZoom = 0.9f; fTitleZoom = 1.0f;
fSubTitleZoom = 0.0f; fSubTitleZoom = 0.0f;
fArtistZoom = 0.5f; fArtistZoom = 0.6f;
} }
else else
{ {
fTitleZoom = 0.6f; fTitleZoom = 0.8f;
fSubTitleZoom = 0.3f; fSubTitleZoom = 0.6f;
fArtistZoom = 0.5f; fArtistZoom = 0.6f;
} }
m_textTitle.SetZoom( fTitleZoom ); m_textTitle.SetZoom( fTitleZoom );
@@ -90,14 +90,14 @@ bool TextBanner::LoadFromSong( Song* pSong )
if( sSubTitle == "" ) if( sSubTitle == "" )
{ {
m_textTitle.SetY( -6 ); m_textTitle.SetY( -7 );
m_textSubTitle.SetY( 0 ); m_textSubTitle.SetY( 0 );
m_textArtist.SetY( 9 ); m_textArtist.SetY( 9 );
} }
else else
{ {
m_textTitle.SetY( -10 ); m_textTitle.SetY( -10 );
m_textSubTitle.SetY( -4 ); m_textSubTitle.SetY( 0 );
m_textArtist.SetY( 10 ); m_textArtist.SetY( 10 );
} }
+22 -4
View File
@@ -89,14 +89,20 @@ CString ThemeManager::ElementToAssetPath( ThemeElement te )
case GRAPHIC_TITLE_MENU_BACKGROUND: sAssetPath = "Graphics\\title menu background"; break; case GRAPHIC_TITLE_MENU_BACKGROUND: sAssetPath = "Graphics\\title menu background"; break;
case GRAPHIC_SELECT_STYLE_BACKGROUND: sAssetPath = "Graphics\\select Style background"; break; case GRAPHIC_SELECT_STYLE_BACKGROUND: sAssetPath = "Graphics\\select Style background"; break;
case GRAPHIC_SELECT_MUSIC_BACKGROUND: sAssetPath = "Graphics\\select music background"; break; case GRAPHIC_SELECT_MUSIC_BACKGROUND: sAssetPath = "Graphics\\select music background"; break;
case GRAPHIC_RESULT_BACKGROUND: sAssetPath = "Graphics\\result background"; break;
case GRAPHIC_SELECT_STYLE_TOP_EDGE: sAssetPath = "Graphics\\select Style top edge"; break; case GRAPHIC_SELECT_STYLE_TOP_EDGE: sAssetPath = "Graphics\\select Style top edge"; break;
case GRAPHIC_SELECT_MUSIC_TOP_EDGE: sAssetPath = "Graphics\\select music top edge"; break; case GRAPHIC_SELECT_MUSIC_TOP_EDGE: sAssetPath = "Graphics\\select music top edge"; break;
case GRAPHIC_GAME_OPTIONS_TOP_EDGE: sAssetPath = "Graphics\\game options top edge"; break; case GRAPHIC_GAME_OPTIONS_TOP_EDGE: sAssetPath = "Graphics\\game options top edge"; break;
case GRAPHIC_GRAPHIC_OPTIONS_TOP_EDGE: sAssetPath = "Graphics\\graphic options top edge"; break; case GRAPHIC_GRAPHIC_OPTIONS_TOP_EDGE: sAssetPath = "Graphics\\graphic options top edge"; break;
case GRAPHIC_PLAYER_OPTIONS_TOP_EDGE: sAssetPath = "Graphics\\player options top edge"; break; case GRAPHIC_PLAYER_OPTIONS_TOP_EDGE: sAssetPath = "Graphics\\player options top edge"; break;
case GRAPHIC_SONG_OPTIONS_TOP_EDGE: sAssetPath = "Graphics\\song options top edge"; break; case GRAPHIC_SONG_OPTIONS_TOP_EDGE: sAssetPath = "Graphics\\song options top edge"; break;
case GRAPHIC_RESULT_TOP_EDGE: sAssetPath = "Graphics\\result top edge"; break; case GRAPHIC_RESULTS_TOP_EDGE: sAssetPath = "Graphics\\results top edge"; break;
case GRAPHIC_RESULTS_BACKGROUND: sAssetPath = "Graphics\\results background"; break;
case GRAPHIC_RESULTS_BANNER_FRAME: sAssetPath = "Graphics\\results banner frame"; break;
case GRAPHIC_RESULTS_BONUS_FRAME_P1: sAssetPath = "Graphics\\results bonus frame p1"; break;
case GRAPHIC_RESULTS_BONUS_FRAME_P2: sAssetPath = "Graphics\\results bonus frame p2"; break;
case GRAPHIC_RESULTS_GRADE_FRAME: sAssetPath = "Graphics\\results grade frame 1x2"; break;
case GRAPHIC_RESULTS_JUDGE_LABELS: sAssetPath = "Graphics\\results judge labels 1x6"; break;
case GRAPHIC_RESULTS_SCORE_LABELS: sAssetPath = "Graphics\\results score labels 1x2"; break;
case GRAPHIC_FALLBACK_BANNER: sAssetPath = "Graphics\\Fallback Banner"; break; case GRAPHIC_FALLBACK_BANNER: sAssetPath = "Graphics\\Fallback Banner"; break;
case GRAPHIC_FALLBACK_BACKGROUND: sAssetPath = "Graphics\\Fallback Background"; break; case GRAPHIC_FALLBACK_BACKGROUND: sAssetPath = "Graphics\\Fallback Background"; break;
case GRAPHIC_FALLBACK_CD_TITLE: sAssetPath = "Graphics\\Fallback CD Title"; break; case GRAPHIC_FALLBACK_CD_TITLE: sAssetPath = "Graphics\\Fallback CD Title"; break;
@@ -125,7 +131,7 @@ CString ThemeManager::ElementToAssetPath( ThemeElement te )
case GRAPHIC_SELECT_MUSIC_SONG_HIGHLIGHT: sAssetPath = "Graphics\\select music song highlight"; break; case GRAPHIC_SELECT_MUSIC_SONG_HIGHLIGHT: sAssetPath = "Graphics\\select music song highlight"; break;
case GRAPHIC_STEPS_DESCRIPTION: sAssetPath = "Graphics\\Steps description 1x8"; break; case GRAPHIC_STEPS_DESCRIPTION: sAssetPath = "Graphics\\Steps description 1x8"; break;
case GRAPHIC_SELECT_MUSIC_SECTION_BAR: sAssetPath = "Graphics\\select music section bar"; break; case GRAPHIC_SELECT_MUSIC_SECTION_BAR: sAssetPath = "Graphics\\select music section bar"; break;
case GRAPHIC_MUSIC_SORT_ICONS: sAssetPath = "Graphics\\music sort icons 4x1"; break; case GRAPHIC_MUSIC_SORT_ICONS: sAssetPath = "Graphics\\music sort icons 1x4"; break;
case GRAPHIC_MUSIC_STATUS_ICONS: sAssetPath = "Graphics\\music status icons 1x4"; break; case GRAPHIC_MUSIC_STATUS_ICONS: sAssetPath = "Graphics\\music status icons 1x4"; break;
case GRAPHIC_DANGER_TEXT: sAssetPath = "Graphics\\danger text"; break; case GRAPHIC_DANGER_TEXT: sAssetPath = "Graphics\\danger text"; break;
case GRAPHIC_DANGER_BACKGROUND: sAssetPath = "Graphics\\danger background"; break; case GRAPHIC_DANGER_BACKGROUND: sAssetPath = "Graphics\\danger background"; break;
@@ -152,9 +158,20 @@ CString ThemeManager::ElementToAssetPath( ThemeElement te )
case GRAPHIC_SELECT_DIFFICULTY_ARROW_P1: sAssetPath = "Graphics\\select difficulty arrow p1"; break; case GRAPHIC_SELECT_DIFFICULTY_ARROW_P1: sAssetPath = "Graphics\\select difficulty arrow p1"; break;
case GRAPHIC_SELECT_DIFFICULTY_ARROW_P2: sAssetPath = "Graphics\\select difficulty arrow p2"; break; case GRAPHIC_SELECT_DIFFICULTY_ARROW_P2: sAssetPath = "Graphics\\select difficulty arrow p2"; break;
case GRAPHIC_SELECT_DIFFICULTY_OK: sAssetPath = "Graphics\\select difficulty ok"; break; case GRAPHIC_SELECT_DIFFICULTY_OK: sAssetPath = "Graphics\\select difficulty ok"; break;
case GRAPHIC_SELECT_MODE_BACKGROUND: sAssetPath = "Graphics\\select mode background"; break;
case GRAPHIC_SELECT_MODE_TOP_EDGE: sAssetPath = "Graphics\\select mode top edge"; break;
case GRAPHIC_SELECT_MODE_EXPLANATION: sAssetPath = "Graphics\\select mode explanation"; break;
case GRAPHIC_SELECT_MODE_ARROW: sAssetPath = "Graphics\\select mode arrow"; break;
case GRAPHIC_SELECT_MODE_OK: sAssetPath = "Graphics\\select mode ok"; break;
case GRAPHIC_SELECT_MODE_ARCADE_HEADER: sAssetPath = "Graphics\\select mode arcade header"; break;
case GRAPHIC_SELECT_MODE_ARCADE_PICTURE: sAssetPath = "Graphics\\select mode arcade picture"; break;
case GRAPHIC_SELECT_MODE_FREE_PLAY_HEADER: sAssetPath = "Graphics\\select mode free play header"; break;
case GRAPHIC_SELECT_MODE_FREE_PLAY_PICTURE: sAssetPath = "Graphics\\select mode free play picture"; break;
case GRAPHIC_SELECT_MODE_NONSTOP_HEADER: sAssetPath = "Graphics\\select mode nonstop header"; break;
case GRAPHIC_SELECT_MODE_NONSTOP_PICTURE: sAssetPath = "Graphics\\select mode nonstop picture"; break;
case GRAPHIC_SELECT_MUSIC_INFO_FRAME: sAssetPath = "Graphics\\select music info frame"; break; case GRAPHIC_SELECT_MUSIC_INFO_FRAME: sAssetPath = "Graphics\\select music info frame"; break;
case GRAPHIC_SELECT_MUSIC_RADAR_BASE: sAssetPath = "Graphics\\select music radar base"; break; case GRAPHIC_SELECT_MUSIC_RADAR_BASE: sAssetPath = "Graphics\\select music radar base"; break;
case GRAPHIC_SELECT_MUSIC_RADAR_WORDS: sAssetPath = "Graphics\\select music radar words"; break; case GRAPHIC_SELECT_MUSIC_RADAR_WORDS: sAssetPath = "Graphics\\select music radar words 1x5"; break;
case GRAPHIC_SELECT_MUSIC_SCORE_FRAME: sAssetPath = "Graphics\\select music score frame"; break; case GRAPHIC_SELECT_MUSIC_SCORE_FRAME: sAssetPath = "Graphics\\select music score frame"; break;
case GRAPHIC_SELECT_GROUP_EXPLANATION: sAssetPath = "Graphics\\select group explanation"; break; case GRAPHIC_SELECT_GROUP_EXPLANATION: sAssetPath = "Graphics\\select group explanation"; break;
case GRAPHIC_SELECT_GROUP_INFO_FRAME: sAssetPath = "Graphics\\select group info frame"; break; case GRAPHIC_SELECT_GROUP_INFO_FRAME: sAssetPath = "Graphics\\select group info frame"; break;
@@ -185,6 +202,7 @@ CString ThemeManager::ElementToAssetPath( ThemeElement te )
case SOUND_EDIT_CHANGE_LINE: sAssetPath = "Sounds\\edit change line"; break; case SOUND_EDIT_CHANGE_LINE: sAssetPath = "Sounds\\edit change line"; break;
case SOUND_EDIT_CHANGE_SNAP: sAssetPath = "Sounds\\edit change snap"; break; case SOUND_EDIT_CHANGE_SNAP: sAssetPath = "Sounds\\edit change snap"; break;
case SOUND_SELECT_DIFFICULTY_CHANGE: sAssetPath = "Sounds\\select difficulty change"; break; case SOUND_SELECT_DIFFICULTY_CHANGE: sAssetPath = "Sounds\\select difficulty change"; break;
case SOUND_SELECT_MODE_CHANGE: sAssetPath = "Sounds\\select mode change"; break;
case SOUND_MENU_MUSIC: sAssetPath = "Sounds\\menu music"; break; case SOUND_MENU_MUSIC: sAssetPath = "Sounds\\menu music"; break;
case SOUND_ENDING_MUSIC: sAssetPath = "Sounds\\ending music"; break; case SOUND_ENDING_MUSIC: sAssetPath = "Sounds\\ending music"; break;
+20 -2
View File
@@ -60,8 +60,14 @@ enum ThemeElement {
GRAPHIC_PLAYER_OPTIONS_BACKGROUND, GRAPHIC_PLAYER_OPTIONS_BACKGROUND,
GRAPHIC_PLAYER_OPTIONS_TOP_EDGE, GRAPHIC_PLAYER_OPTIONS_TOP_EDGE,
GRAPHIC_READY, GRAPHIC_READY,
GRAPHIC_RESULT_BACKGROUND, GRAPHIC_RESULTS_BACKGROUND,
GRAPHIC_RESULT_TOP_EDGE, GRAPHIC_RESULTS_TOP_EDGE,
GRAPHIC_RESULTS_BANNER_FRAME,
GRAPHIC_RESULTS_BONUS_FRAME_P1,
GRAPHIC_RESULTS_BONUS_FRAME_P2,
GRAPHIC_RESULTS_GRADE_FRAME,
GRAPHIC_RESULTS_JUDGE_LABELS,
GRAPHIC_RESULTS_SCORE_LABELS,
GRAPHIC_SCORE_FRAME, GRAPHIC_SCORE_FRAME,
GRAPHIC_SELECT_MUSIC_SECTION_BAR, GRAPHIC_SELECT_MUSIC_SECTION_BAR,
GRAPHIC_SELECT_DIFFICULTY_ARROW_P1, GRAPHIC_SELECT_DIFFICULTY_ARROW_P1,
@@ -76,6 +82,17 @@ enum ThemeElement {
GRAPHIC_SELECT_DIFFICULTY_MEDIUM_PICTURE, GRAPHIC_SELECT_DIFFICULTY_MEDIUM_PICTURE,
GRAPHIC_SELECT_DIFFICULTY_OK, GRAPHIC_SELECT_DIFFICULTY_OK,
GRAPHIC_SELECT_DIFFICULTY_TOP_EDGE, GRAPHIC_SELECT_DIFFICULTY_TOP_EDGE,
GRAPHIC_SELECT_MODE_BACKGROUND,
GRAPHIC_SELECT_MODE_TOP_EDGE,
GRAPHIC_SELECT_MODE_EXPLANATION,
GRAPHIC_SELECT_MODE_ARROW,
GRAPHIC_SELECT_MODE_OK,
GRAPHIC_SELECT_MODE_ARCADE_HEADER,
GRAPHIC_SELECT_MODE_ARCADE_PICTURE,
GRAPHIC_SELECT_MODE_FREE_PLAY_HEADER,
GRAPHIC_SELECT_MODE_FREE_PLAY_PICTURE,
GRAPHIC_SELECT_MODE_NONSTOP_HEADER,
GRAPHIC_SELECT_MODE_NONSTOP_PICTURE,
GRAPHIC_SELECT_MUSIC_BACKGROUND, GRAPHIC_SELECT_MUSIC_BACKGROUND,
GRAPHIC_SELECT_MUSIC_INFO_FRAME, GRAPHIC_SELECT_MUSIC_INFO_FRAME,
GRAPHIC_SELECT_MUSIC_RADAR_BASE, GRAPHIC_SELECT_MUSIC_RADAR_BASE,
@@ -117,6 +134,7 @@ enum ThemeElement {
SOUND_EDIT_CHANGE_LINE, SOUND_EDIT_CHANGE_LINE,
SOUND_EDIT_CHANGE_SNAP, SOUND_EDIT_CHANGE_SNAP,
SOUND_SELECT_DIFFICULTY_CHANGE, SOUND_SELECT_DIFFICULTY_CHANGE,
SOUND_SELECT_MODE_CHANGE,
SOUND_ENDING_MUSIC, SOUND_ENDING_MUSIC,
SOUND_MENU_MUSIC, SOUND_MENU_MUSIC,
+144 -15659
View File
File diff suppressed because it is too large Load Diff
+13 -22
View File
@@ -56,7 +56,7 @@ public:
CString GetSongFileDir() {return m_sSongDir; }; CString GetSongFileDir() {return m_sSongDir; };
CString GetGroupName() {return m_sGroupName; }; CString GetGroupName() {return m_sGroupName; };
CString GetMusicPath() {return m_sMusicPath; }; CString GetMusicPath() {return m_sMusicPath; };
void GetMusicSampleRange( float &fStartBeatOut, float &fEndBeatOut ) { fStartBeatOut = m_fMusicSampleStartBeat; fEndBeatOut = m_fMusicSampleEndBeat; }; void GetMusicSampleRange( float &fStartSec, float &fEndSec ) { fStartSec = m_fMusicSampleStartSeconds; fEndSec = m_fMusicSampleStartSeconds + m_fMusicSampleLengthSeconds; };
CString GetBannerPath() {return m_sBannerPath; }; CString GetBannerPath() {return m_sBannerPath; };
CString GetBackgroundPath() {return m_sBackgroundPath; }; CString GetBackgroundPath() {return m_sBackgroundPath; };
CString GetBackgroundMoviePath(){return m_sBackgroundMoviePath; }; CString GetBackgroundMoviePath(){return m_sBackgroundMoviePath; };
@@ -70,38 +70,28 @@ public:
bool HasCDTitle() {return m_sCDTitlePath != "" && DoesFileExist(GetCDTitlePath()); }; bool HasCDTitle() {return m_sCDTitlePath != "" && DoesFileExist(GetCDTitlePath()); };
CString GetFullTitle() {return m_sTitle; }; CString GetMainTitle() {return m_sMainTitle; };
void GetMainTitleAndSubTitle( CString &sMainTitleOut, CString &sSubTitleOut ) CString GetSubTitle() {return m_sSubTitle; };
void GetMainAndSubTitlesFromFullTitle( CString sFullTitle, CString &sMainTitleOut, CString &sSubTitleOut )
{ {
char szSeps[] = { '-', '~' }; char szSeps[] = { '-', '~' };
for( int i=0; i<sizeof(szSeps); i++ ) for( int i=0; i<sizeof(szSeps); i++ )
{ {
const char c = szSeps[i]; const char c = szSeps[i];
int iBeginIndex = m_sTitle.Find( c ); int iBeginIndex = sFullTitle.Find( c );
if( iBeginIndex == -1 ) if( iBeginIndex == -1 )
continue; continue;
int iEndIndex = m_sTitle.Find( c, iBeginIndex+1 ); int iEndIndex = sFullTitle.Find( c, iBeginIndex+1 );
if( iEndIndex == -1 ) if( iEndIndex == -1 )
continue; continue;
sMainTitleOut = m_sTitle.Left( iBeginIndex-1 ); sMainTitleOut = sFullTitle.Left( iBeginIndex-1 );
sSubTitleOut = m_sTitle.Mid( iBeginIndex, iEndIndex-iBeginIndex+1 ); sSubTitleOut = sFullTitle.Mid( iBeginIndex, iEndIndex-iBeginIndex+1 );
return; return;
} }
sMainTitleOut = m_sTitle; sMainTitleOut = sFullTitle;
sSubTitleOut = ""; sSubTitleOut = "";
}; };
CString GetMainTitle()
{
CString sMainTitle, sSubTitle;
GetMainTitleAndSubTitle( sMainTitle, sSubTitle );
return sMainTitle;
};
CString GetSubTitle()
{
CString sMainTitle, sSubTitle;
GetMainTitleAndSubTitle( sMainTitle, sSubTitle );
return sSubTitle;
};
CString GetArtist() {return m_sArtist; }; CString GetArtist() {return m_sArtist; };
CString GetCredit() {return m_sCredit; }; CString GetCredit() {return m_sCredit; };
float GetBeatOffsetInSeconds() {return m_fOffsetInSeconds; }; float GetBeatOffsetInSeconds() {return m_fOffsetInSeconds; };
@@ -143,14 +133,15 @@ private:
CString m_sGroupName; CString m_sGroupName;
bool m_bChangedSinceSave; bool m_bChangedSinceSave;
CString m_sTitle; CString m_sMainTitle;
CString m_sSubTitle;
CString m_sArtist; CString m_sArtist;
CString m_sCredit; CString m_sCredit;
float m_fOffsetInSeconds; float m_fOffsetInSeconds;
CString m_sMusicPath; CString m_sMusicPath;
DWORD m_dwMusicBytes; DWORD m_dwMusicBytes;
float m_fMusicSampleStartBeat, m_fMusicSampleEndBeat; float m_fMusicSampleStartSeconds, m_fMusicSampleLengthSeconds;
CString m_sBannerPath; CString m_sBannerPath;
CString m_sBackgroundPath; CString m_sBackgroundPath;
CString m_sBackgroundMoviePath; CString m_sBackgroundMoviePath;