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_bVisibleThisFrame = FALSE;
if( PREFS ) m_bShadow = PREFS->m_GraphicOptions.m_bShadows;
else m_bShadow = true;
m_bShadow = true;
m_fShadowLength = 4;
m_bBlendAdd = false;
+2 -2
View File
@@ -11,7 +11,7 @@
*/
#include "ArrowEffects.h"
#include "NoteMetadata.h"
#include "ColorArrow.h"
#include "ColorNote.h"
#include "ScreenDimensions.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 fColOffsetFromCenter = iColNum - (GAME->GetCurrentStyleDef()->GetColsPerPlayer()-1)/2.0f;
float fColOffsetFromCenter = iColNum - (GAME->GetCurrentStyleDef()->m_iColsPerPlayer-1)/2.0f;
float fPixelOffsetFromCenter = fColOffsetFromCenter * ARROW_SIZE;
switch( po.m_EffectType )
+39 -28
View File
@@ -15,6 +15,7 @@
#include "FontManager.h"
#include "RageHelper.h"
#include "ErrorCatcher/ErrorCatcher.h"
#include "PrefsManager.h"
D3DXCOLOR RAINBOW_COLORS[] = {
@@ -74,6 +75,8 @@ bool BitmapText::Load( const CString &sFontFilePath )
void BitmapText::SetText( CString sText )
{
//HELPER.Log( "BitmapText::SetText()" );
if( m_pFont->m_bCapitalsOnly )
sText.MakeUpper();
@@ -120,6 +123,10 @@ void BitmapText::SetText( CString sText )
if( m_iLineWidths[l] > m_iWidestLineWidth )
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()
{
//HELPER.Log( "BitmapText::RebuildVertexBuffer()" );
RageTexture* pTexture = m_pFont->m_pTexture;
@@ -139,6 +150,8 @@ void BitmapText::RebuildVertexBuffer()
// make the object in logical units centered at the origin
LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer();
//LPDIRECT3DVERTEXBUFFER8 pVB = m_pVB;
CUSTOMVERTEX* v;
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
@@ -185,11 +198,12 @@ void BitmapText::RebuildVertexBuffer()
// HACK:
// 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.
const float fPercentExtra = min(
0.20f,
(iFrameWidth-iCharWidth)/(float)iFrameWidth
);
const float fPercentExtra = min( m_pFont->m_fDrawExtraPercent, (iFrameWidth-iCharWidth)/(float)iFrameWidth ); // don't draw from the adjacent frame
//
// set vertex positions
//
const float fExtraPixels = fPercentExtra * pTexture->GetSourceFrameWidth();
// first triangle
@@ -204,28 +218,28 @@ void BitmapText::RebuildVertexBuffer()
v[m_iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY+iHeight/2.0f, 0 ); // bottom right
//
// set texture coordinates
//
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();
v[m_iNumV].tu = pTexCoordRect->left; v[m_iNumV++].tv = pTexCoordRect->top; // top left
v[m_iNumV].tu = pTexCoordRect->left; v[m_iNumV++].tv = pTexCoordRect->bottom; // bottom left
v[m_iNumV].tu = pTexCoordRect->right + fExtraTexCoords; v[m_iNumV++].tv = pTexCoordRect->top; // top right
v[m_iNumV].tu = v[m_iNumV-1].tu; v[m_iNumV++].tv = v[m_iNumV-1].tv; // top right
v[m_iNumV].tu = v[m_iNumV-3].tu; v[m_iNumV++].tv = v[m_iNumV-3].tv; // bottom left
v[m_iNumV].tu = pTexCoordRect->right + fExtraTexCoords; v[m_iNumV++].tv = pTexCoordRect->bottom; // bottom right
/*
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
*/
v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.top ); // top left
v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.bottom ); // bottom left
v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.top ); // top right
v[m_iNumV++].t = v[m_iNumV-1].t; // top right
v[m_iNumV++].t = v[m_iNumV-3].t; // bottom left
v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.bottom ); // bottom right
}
iY += iHeight;
@@ -252,6 +266,7 @@ void BitmapText::RenderPrimitives()
LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer();
//LPDIRECT3DVERTEXBUFFER8 pVB = m_pVB;
CUSTOMVERTEX* v;
@@ -259,10 +274,6 @@ void BitmapText::RenderPrimitives()
LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice();
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_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA );
@@ -276,7 +287,7 @@ void BitmapText::RenderPrimitives()
//////////////////////
// render the shadow
//////////////////////
if( m_bShadow )
if( m_bShadow && PREFS && PREFS->GetCurrentGraphicProfileOptions()->m_bShadows )
{
SCREEN->PushMatrix();
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_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_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 );
}
+1
View File
@@ -53,6 +53,7 @@ protected:
int m_iWidestLineWidth; // in source pixels
// recalculate on RebuildVertexBuffer()
// LPDIRECT3DVERTEXBUFFER8 m_pVB;
int m_iNumV; // number of verticies we filled in the vertex buffer
bool m_bRainbow;
+20 -26
View File
@@ -58,9 +58,6 @@ Font::Font( const CString &sFontFilePath )
m_sTexturePath = sFontDir + sTextureFile; // save the path of the new texture
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 );
assert( m_pTexture != NULL );
@@ -74,7 +71,7 @@ Font::Font( const CString &sFontFilePath )
{
// sanity check
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
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.
{
for( int i=0; i<MAX_FONT_CHARS; i++ )
m_iCharToFrameNo[i] = i;
switch( m_pTexture->GetNumFrames() )
{
case 256: // ASCII 0-255
{
for( int i=0; i<256; 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_fDrawExtraPercent = (float)ini.GetValueF("Font", "DrawExtraPercent");
//
@@ -119,26 +133,6 @@ Font::Font( const CString &sFontFilePath )
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;
bool m_bCapitalsOnly;
float m_fDrawExtraPercent; // for italic fonts
int m_iCharToFrameNo[MAX_FONT_CHARS];
int m_iFrameNoToWidth[MAX_FONT_CHARS]; // in soure coordinate space
+126 -9
View File
@@ -14,6 +14,123 @@
#include "RageHelper.h"
#include "RageUtil.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 )
{
@@ -35,22 +152,22 @@ CString GameDef::ElementToGraphicSuffix( const GameButtonGraphic gbg )
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 sButtonName = m_szButtonNames[ iInstrumentButton ];
const CString sSkinDir = ssprintf("%s\\%s\\", m_sGameDir, sSkinName);
const CString sButtonName = m_sButtonNames[ iInstrumentButton ];
const CString sGraphicSuffix = ElementToGraphicSuffix( gbg );
CStringArray arrayPossibleFileNames; // fill this with the possible files
GetDirListing( ssprintf("%s%s %s*.sprite", sDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames );
GetDirListing( ssprintf("%s%s %s*.png", sDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames );
GetDirListing( ssprintf("%s%s %s*.jpg", sDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames );
GetDirListing( ssprintf("%s%s %s*.bmp", sDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames );
GetDirListing( ssprintf("%s%s %s*.sprite", sSkinDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames );
GetDirListing( ssprintf("%s%s %s*.png", sSkinDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames );
GetDirListing( ssprintf("%s%s %s*.jpg", sSkinDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames );
GetDirListing( ssprintf("%s%s %s*.bmp", sSkinDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames );
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 "";
}
+31 -10
View File
@@ -10,7 +10,6 @@
-----------------------------------------------------------------------------
*/
#include "StyleDef.h"
#include "NoteMetadata.h"
#include "NoteData.h"
#include "GameInput.h"
@@ -20,29 +19,51 @@
const int MAX_STYLES_PER_GAME = 10;
const int MAX_SKIN_PATHS = 16;
class StyleDef;
struct GameDef
class GameDef
{
public:
GameDef( CString sGameDir );
~GameDef();
LPCTSTR m_szName;
LPCTSTR m_szDescription;
LPCTSTR m_szGraphicPath;
CString m_sGameDir;
CString m_sName;
CString m_sDescription;
// instrument stuff
int m_iNumInstruments;
int m_iNumButtons;
LPCTSTR m_szButtonNames[NUM_INSTRUMENT_BUTTONS]; // e.g. "left", "right", "middle C", "snare"
int m_iMenuButtons[NUM_MENU_BUTTONS]; // map from MenuButton to InstrumentButton
int m_iButtonsPerInstrument;
CString m_sButtonNames[MAX_INSTRUMENT_BUTTONS]; // e.g. "left", "right", "middle C", "snare"
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;
StyleDef m_StyleDefs[MAX_STYLES_PER_GAME];
StyleDef* m_pStyleDefs[MAX_STYLES_PER_GAME];
StyleDef* GetStyleDef( CString sStyle );
// 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 );
+2 -2
View File
@@ -13,7 +13,7 @@ enum InstrumentNumber
{
INSTRUMENT_1 = 0,
INSTRUMENT_2,
NUM_INSTRUMENTS, // leave this at the end
MAX_INSTRUMENTS, // leave this at the end
INSTRUMENT_NONE,
};
@@ -35,7 +35,7 @@ enum InstrumentButton
INSTRUMENT_BUTTON_14,
INSTRUMENT_BUTTON_15,
INSTRUMENT_BUTTON_16,
NUM_INSTRUMENT_BUTTONS, // leave this at the end
MAX_INSTRUMENT_BUTTONS, // leave this at the end
INSTRUMENT_BUTTON_NONE
};
+69 -129
View File
@@ -11,6 +11,7 @@
*/
#include "GameManager.h"
#include "ErrorCatcher/ErrorCatcher.h"
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
//
// ----------------------------------
// 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()
{
m_iNumGameDefs = 0;
ReadGamesAndStylesFromDir( "Games" );
SwitchGame( "dance" );
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 )
{
for( int i=0; i<NUM_GAME_DEFS; i++ )
for( int i=0; i<m_iNumGameDefs; i++ )
{
if( g_GameDefs[i].m_szName == sGame )
return &g_GameDefs[i];
if( m_pGameDefs[i]->m_sName == sGame )
return m_pGameDefs[i];
}
return NULL;
@@ -170,16 +79,47 @@ StyleDef* GameManager::GetStyleDef( CString sGame, CString sStyle )
{
GameDef* pGameDef = GetGameDef( sGame );
for( int i=0; i<pGameDef->m_iNumStyleDefs; i++ )
{
if( pGameDef->m_StyleDefs[i].m_szName == sStyle )
return &pGameDef->m_StyleDefs[i];
}
return pGameDef->GetStyleDef( sStyle );
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 )
{
StyleDef* pStyleDef = GetCurrentStyleDef();
+19 -5
View File
@@ -14,19 +14,24 @@
#include "StyleDef.h"
const int NUM_GAME_DEFS = 1;
const int MAX_GAME_DEFS = 10;
class GameManager
{
public:
GameManager();
~GameManager();
void ReadGamesAndStylesFromDir( CString sDir );
void SwitchGame( CString sGame )
{
m_sCurrentGame = sGame;
m_pCurrentGameDef = GetGameDef( sGame );
ASSERT( m_pCurrentGameDef != NULL );
for( int p=0; p<NUM_PLAYERS; p++ )
m_sCurrentSkin[p] = m_pCurrentGameDef->m_sSkinFolders[0];
};
void SwitchStyle( CString sStyle )
{
@@ -34,25 +39,34 @@ public:
m_pCurrentStyleDef = GetStyleDef( m_sCurrentGame, sStyle );
ASSERT( m_pCurrentStyleDef != NULL );
};
void SwitchSkin( PlayerNumber p, CString sSkin );
CString m_sCurrentGame; // currently only "dance"
CString m_sCurrentStyle; // currently only "single", "versus", "double", "couple", "solo"
CString m_sCurrentGame; // currently only "dance"
CString m_sCurrentStyle; // currently only "single", "versus", "double", "couple", "solo"
inline GameDef* GetCurrentGameDef() { return m_pCurrentGameDef; };
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 );
// 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 );
GameInput gi = GetCurrentStyleDef()->StyleInputToGameInput( si );
InstrumentButton b = gi.button;
return GetCurrentGameDef()->GetPathToGraphic( b, gbg );
return GetCurrentGameDef()->GetPathToGraphic( m_sCurrentSkin[p], b, gbg );
}
protected:
int m_iNumGameDefs;
GameDef* m_pGameDefs[MAX_GAME_DEFS];
GameDef* m_pCurrentGameDef;
StyleDef* m_pCurrentStyleDef;
+2 -2
View File
@@ -13,7 +13,7 @@
#include "RageUtil.h"
#include "ScreenDimensions.h"
#include "ThemeManager.h"
#include "ColorArrow.h"
#include "ColorNote.h"
#include "ArrowEffects.h"
#include "GameManager.h"
@@ -31,7 +31,7 @@ void GhostArrowRow::Load( PlayerOptions po )
StyleDef* pStyleDef = GAME->GetCurrentStyleDef();
GameDef* pGameDef = GAME->GetCurrentGameDef();
m_iNumCols = pStyleDef->GetColsPerPlayer();
m_iNumCols = pStyleDef->m_iColsPerPlayer;
// init arrows
for( int c=0; c<m_iNumCols; c++ )
+1 -1
View File
@@ -3,7 +3,7 @@
-----------------------------------------------------------------------------
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.
Ben Nordstrom
+1 -1
View File
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------
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.
Ben Nordstrom
+2 -2
View File
@@ -14,7 +14,7 @@
#include "RageUtil.h"
#include "ScreenDimensions.h"
#include "ThemeManager.h"
#include "ColorArrow.h"
#include "ColorNote.h"
#include "ArrowEffects.h"
#include "GameManager.h"
@@ -31,7 +31,7 @@ void GrayArrowRow::Load( PlayerOptions po )
StyleDef* pStyleDef = GAME->GetCurrentStyleDef();
GameDef* pGameDef = GAME->GetCurrentGameDef();
m_iNumCols = pStyleDef->GetColsPerPlayer();
m_iNumCols = pStyleDef->m_iColsPerPlayer;
// init arrow rotations
for( int c=0; c<m_iNumCols; c++ )
+32 -5
View File
@@ -6,6 +6,7 @@
Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
@@ -17,14 +18,40 @@
#include "GameConstants.h"
float RADAR_VALUE_ROTATION( int iValueIndex ) { return D3DX_PI/2 + D3DX_PI*2 / 5.0f * iValueIndex; }
GrooveRadar::GrooveRadar()
{
m_sprRadarBase.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_RADAR_BASE) );
this->AddActor( &m_sprRadarBase );
m_sprRadarWords.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_RADAR_WORDS) );
m_sprRadarWords.SetY( -10 );
this->AddActor( &m_sprRadarWords );
for( int c=0; c<NUM_RADAR_CATEGORIES; c++ )
{
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++ )
{
@@ -112,7 +139,7 @@ void GrooveRadar::RenderPrimitives()
const int c = i%NUM_RADAR_CATEGORIES;
const float fDistFromCenter =
( 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 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;
const float fDistFromCenterInner = 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 fXOutter = cosf(fRotation) * fDistFromCenterOutter;
const float fYInner = -sinf(fRotation) * fDistFromCenterInner;
+3 -9
View File
@@ -1,3 +1,4 @@
#pragma once
/*
-----------------------------------------------------------------------------
Class: GrooveRadar
@@ -5,13 +6,10 @@
Desc: The song's GrooveRadar displayed in SelectSong.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#ifndef _GrooveRadar_H_
#define _GrooveRadar_H_
#include "ActorFrame.h"
#include "Sprite.h"
#include "Song.h"
@@ -40,9 +38,5 @@ protected:
float m_fValuesOld[NUM_PLAYERS][NUM_RADAR_CATEGORIES];
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
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;
@@ -118,9 +118,9 @@ void InputMapper::ClearFromInputMap( DeviceInput DeviceI )
{
// 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++ )
{
@@ -156,9 +156,9 @@ void InputMapper::UpdateTempDItoGI()
// 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++ )
{
+1 -1
View File
@@ -66,7 +66,7 @@ protected:
CString m_sCurrentGame;
// 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
// 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;
};
+72 -38
View File
@@ -18,19 +18,22 @@
#include "RageMusic.h"
#include "WindowManager.h" // for sending SM_PlayMusicSample
#include "RageHelper.h"
#include "GameConstants.h"
const float SWITCH_MUSIC_TIME = 0.3f;
const float SORT_ICON_ON_SCREEN_X = 146;
const float SORT_ICON_ON_SCREEN_Y = 0;
const float SORT_ICON_ON_SCREEN_X = -140;
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_Y = SORT_ICON_ON_SCREEN_Y;
const float SORT_ICON_OFF_SCREEN_X = SORT_ICON_ON_SCREEN_X;
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[] = {
@@ -147,25 +150,14 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID )
break;
case TYPE_SONG:
{
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 );
for( int p=0; p<NUM_PLAYERS; p++ )
{
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) );
}
}
RefreshGrades();
}
break;
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 )
@@ -199,7 +207,7 @@ void WheelItemDisplay::SetDiffuseColor( D3DXCOLOR c )
m_textSectionName.SetDiffuseColor( colorTempLetter );
D3DXCOLOR colorTempDisplay = D3DXCOLOR( 1, 1 ,1, c.a);
D3DXCOLOR colorTempDisplay = D3DXCOLOR( 1, 1, 1, c.a);
m_MusicStatusDisplay.SetDiffuseColor( colorTempDisplay );
}
@@ -246,18 +254,33 @@ 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.SetXY( 0, 0 );
m_sprSelectionOverlay.SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); // invisible
m_sprSelectionOverlay.SetEffectGlowing( 1.5f, D3DXCOLOR(1,1,1,0.1f), D3DXCOLOR(1,1,1,1) );
m_sprSelectionOverlay.SetDiffuseColor( D3DXCOLOR(1,1,1,0.3f) );
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.SetEffectGlowing( 1.0f );
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_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()
{
@@ -627,9 +666,6 @@ void MusicWheel::RenderPrimitives()
}
m_sprSelectionOverlay.Draw();
ActorFrame::RenderPrimitives();
}
@@ -637,8 +673,6 @@ void MusicWheel::Update( float fDeltaTime )
{
ActorFrame::Update( fDeltaTime );
m_sprSelectionOverlay.Update( fDeltaTime );
for( int i=0; i<NUM_WHEEL_ITEMS_TO_DRAW; i++ )
{
@@ -772,7 +806,7 @@ void MusicWheel::PrevMusic()
m_WheelState = STATE_SWITCHING_MUSIC;
m_fTimeLeftInState = SWITCH_MUSIC_TIME;
m_soundChangeMusic.PlayRandom();
m_soundChangeMusic.Play();
}
void MusicWheel::NextMusic()
@@ -805,7 +839,7 @@ void MusicWheel::NextMusic()
m_WheelState = STATE_SWITCHING_MUSIC;
m_fTimeLeftInState = SWITCH_MUSIC_TIME;
m_soundChangeMusic.PlayRandom();
m_soundChangeMusic.Play();
}
void MusicWheel::NextSort()
@@ -822,7 +856,7 @@ void MusicWheel::NextSort()
MUSIC->Stop();
m_soundChangeSort.PlayRandom();
m_soundChangeSort.Play();
m_MusicSortDisplay.BeginTweening( FADE_TIME, TWEEN_BIAS_END );
m_MusicSortDisplay.SetTweenXY( SORT_ICON_OFF_SCREEN_X, SORT_ICON_OFF_SCREEN_Y );
@@ -846,7 +880,7 @@ bool MusicWheel::Select()
RebuildWheelItemDisplays();
m_soundExpand.PlayRandom();
m_soundExpand.Play();
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 "MusicStatusDisplay.h"
#include "Window.h" // for WindowMessage
#include "ScoreDisplayRolling.h" // for WindowMessage
const int NUM_WHEEL_ITEMS_TO_DRAW = 11;
@@ -63,7 +65,6 @@ public:
virtual void Update( float fDeltaTime );
virtual void RenderPrimitives();
void SetDiffuseColor( D3DXCOLOR c );
CString GetSectionName()
{
@@ -71,6 +72,8 @@ public:
};
void LoadFromWheelItemData( WheelItemData* pWID );
void RefreshGrades();
void SetDiffuseColor( D3DXCOLOR c );
// for a section
Sprite m_sprSectionBar;
@@ -101,6 +104,7 @@ public:
void PrevMusic();
void NextMusic();
void NextSort();
void NotesChanged( PlayerNumber pn ); // update grade graphics and top score
float GetBannerY( float fPosOffsetsFromMiddle );
float GetBannerBrightness( float fPosOffsetsFromMiddle );
@@ -121,6 +125,8 @@ protected:
Sprite m_sprSelectionOverlay;
MusicSortDisplay m_MusicSortDisplay;
Sprite m_sprHighScoreFrame[NUM_PLAYERS];
ScoreDisplayRolling m_HighScore[NUM_PLAYERS];
SongSortOrder m_SortOrder;
@@ -148,9 +154,9 @@ protected:
// having sounds here causes a crash in Bass. What the heck!?!?!
RandomSample m_soundChangeMusic;
RandomSample m_soundChangeSort;
RandomSample m_soundExpand;
RageSoundSample m_soundChangeMusic;
RageSoundSample m_soundChangeSort;
RageSoundSample m_soundExpand;
@@ -174,7 +180,7 @@ protected:
// sTemp = "NUM";
// return sTemp;
case SORT_TITLE:
sTemp = pSong->GetFullTitle();
sTemp = pSong->GetMainTitle();
sTemp.MakeUpper();
sTemp = (sTemp.GetLength() > 0) ? sTemp.Left(1) : "";
if( IsAnInt(sTemp) )
+2 -2
View File
@@ -3,7 +3,7 @@
-----------------------------------------------------------------------------
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.
Chris Danford
@@ -166,7 +166,7 @@ int NoteData::GetNumTapNotes()
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' )
iNumSteps++;
-3
View File
@@ -15,9 +15,6 @@
#include "GameTypes.h"
typedef unsigned char TapNote;
typedef unsigned char TrackNumber;
typedef unsigned short NoteIndex;
// '1' = tap note
// '2' = hold note begin
// '3' = hold note end ('1' can also end a HoldNote)
+102 -128
View File
@@ -49,14 +49,16 @@ void NoteField::Load( NoteData* pNoteData, PlayerOptions po, float fNumBeatsToDr
// init arrow rotations and X positions
for( int c=0; c<m_iNumTracks; c++ )
{
m_ColorArrow[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) );
float fColOffsetFromCenter = c - (m_iNumTracks-1)/2.0f;
m_ColorArrow[c].SetX( fColOffsetFromCenter*ARROW_SIZE );
m_ColorNote[c].m_sprColorPart.Load( GAME->GetPathToGraphic( PLAYER_1, c, GRAPHIC_NOTE_COLOR_PART) );
m_ColorNote[c].m_sprGrayPart.Load( GAME->GetPathToGraphic( PLAYER_1, c, GRAPHIC_NOTE_GRAY_PART) );
}
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 )
@@ -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 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 fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos );
m_ColorArrow[iCol].SetXY( fXPos, fYPos );
m_ColorArrow[iCol].SetRotation( fRotation );
m_ColorArrow[iCol].SetColorPartFromIndexAndBeat( (int)fIndex, m_fSongBeat, m_PlayerOptions.m_ColorType );
m_ColorArrow[iCol].SetGrayPartFromIndexAndBeat( (int)fIndex, m_fSongBeat );
m_ColorArrow[iCol].SetAlpha( fAlpha );
m_ColorArrow[iCol].Draw();
D3DXCOLOR colorLeading, colorTrailing; // of the color part. Alpha here be overwritten with fAlpha!
if( color.a == -1 ) // indicated "NULL"
m_ColorNote[iCol].GetEdgeColorsFromIndexAndBeat( roundf(fIndex), m_fSongBeat, m_PlayerOptions.m_ColorType, colorLeading, colorTrailing );
else
colorLeading = colorTrailing = color;
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 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].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 )
{
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 );
int iGrayPartFrameNo;
if( bActive && m_Mode == MODE_DANCING )
iGrayPartFrameNo = m_ColorNote[iCol].GetGrayPartFrameNoFull();
else
iGrayPartFrameNo = m_ColorNote[iCol].GetGrayPartFrameNoClear();
D3DXCOLOR color( (fIndex-hn.m_iStartIndex)/(hn.m_iEndIndex-hn.m_iStartIndex), 1, 0, 1 ); // color shifts from green to yellow
color *= 1 - (1-fHoldNoteLife) / 1.2f;
color.a = 1;
const float fPercentIntoHold = (fIndex-hn.m_iStartIndex)/(hn.m_iEndIndex-hn.m_iStartIndex);
D3DXCOLOR colorLeading( fPercentIntoHold, 1, 0, 1 ); // color shifts from green to yellow
colorLeading *= fHoldNoteLife;
colorLeading.a = 1;
D3DXCOLOR colorTrailing = colorLeading;
m_ColorArrow[iCol].SetXY( fXPos, fYPos );
m_ColorArrow[iCol].SetRotation( fRotation );
m_ColorArrow[iCol].SetDiffuseColor( color );
m_ColorArrow[iCol].SetAlpha( fAlpha );
m_ColorArrow[iCol].DrawColorPart();
}
const float fAddAlpha = m_ColorNote[iCol].GetAddAlphaFromDiffuseAlpha( fAlpha );
void NoteField::DrawHoldNoteGrayPart( const int iCol, const float fIndex, const HoldNote &hn, const float fHoldNoteLife )
{
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();
ColorNoteInstance instance = { fXPos, fYPos, fRotation, fAlpha, colorLeading, colorTrailing, fAddAlpha, iGrayPartFrameNo };
cni = instance;
}
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 );
//
// 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 i=iIndexFirstArrowToDraw; i<=iIndexLastArrowToDraw; i++ ) // for each row
{
if( !IsRowEmpty(i) )
{
//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!
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
{
if( m_TapNotes[c][i] == '0' )
continue; // no note here
// See if there is a hold step that begins on this beat. Not pretty...
bool bHoldNoteOnThisBeat = false;
for( int j=0; j<m_iNumHoldNotes; j++ )
{
@@ -224,92 +224,66 @@ void NoteField::RenderPrimitives()
}
}
for( int c=0; c<m_iNumTracks; c++ ) // for each arrow column
if( bHoldNoteOnThisBeat )
CreateTapNoteInstance( instances[iCount++], c, (float)i, D3DXCOLOR(0,1,0,1) );
else
CreateTapNoteInstance( instances[iCount++], c, (float)i );
}
//
// Draw all HoldNotes in this column
//
for( i=0; i<m_iNumHoldNotes; 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( !( iIndexFirstArrowToDraw <= hn.m_iEndIndex && hn.m_iEndIndex <= iIndexLastArrowToDraw ||
iIndexFirstArrowToDraw <= hn.m_iStartIndex && hn.m_iStartIndex <= iIndexLastArrowToDraw ||
hn.m_iStartIndex < iIndexFirstArrowToDraw && hn.m_iEndIndex > iIndexLastArrowToDraw ) )
{
if( m_TapNotes[c][i] != '0' ) // this column is still unstepped on?
{
if( bHoldNoteOnThisBeat )
DrawTapNote( c, (float)i, D3DXCOLOR(0,1,0,1) );
else
DrawTapNote( c, (float)i );
}
continue;
}
} // end if there is a step
} // end foreach arrow to draw
//
// Draw all HoldNotes
//
for( i=0; i<m_iNumHoldNotes; i++ )
{
HoldNote &hn = m_HoldNotes[i];
// If no part of this HoldNote is on the screen, skip it
if( !( iIndexFirstArrowToDraw <= hn.m_iEndIndex && hn.m_iEndIndex <= iIndexLastArrowToDraw ||
iIndexFirstArrowToDraw <= hn.m_iStartIndex && hn.m_iStartIndex <= iIndexLastArrowToDraw ||
hn.m_iStartIndex < iIndexFirstArrowToDraw && hn.m_iEndIndex > iIndexLastArrowToDraw ) )
{
continue;
}
const int iCol = hn.m_iTrack;
const float fHoldNoteLife = m_HoldNoteLife[i];
const bool bActive = NoteIndexToBeat(hn.m_iStartIndex) > m_fSongBeat && m_fSongBeat < NoteIndexToBeat(hn.m_iEndIndex);
int iCol = hn.m_iTrack;
float fHoldNoteLife = m_HoldNoteLife[i];
bool bActive = NoteIndexToBeat(hn.m_iStartIndex) > m_fSongBeat && m_fSongBeat < NoteIndexToBeat(hn.m_iEndIndex);
// draw the gray parts
for( float 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( bActive && m_Mode == MODE_DANCING )
m_ColorArrow[iCol].SetGrayPartFull();
else
m_ColorArrow[iCol].SetGrayPartClear();
if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteIndexToBeat(j) < m_fSongBeat )
continue; // don't draw
CreateHoldNoteInstance( instances[iCount++], bActive, j, hn, fHoldNoteLife );
}
// draw the gray parts
for( float 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
// draw the first arrow on top of the others
j = (float)hn.m_iStartIndex;
if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteIndexToBeat(j) < m_fSongBeat )
continue; // don't draw
DrawHoldNoteGrayPart( iCol, j, hn, fHoldNoteLife );
; // don't draw
else
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
j = (float)hn.m_iStartIndex;
if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteIndexToBeat(j) < m_fSongBeat )
{
; // don't draw
}
else
{
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
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.
Chris Danford
@@ -10,17 +11,13 @@
*/
#ifndef _NoteField_H_
#define _NoteField_H_
#include "Sprite.h"
#include "ActorFrame.h"
#include "Song.h"
#include "BitmapText.h"
#include "ThemeManager.h"
#include "StyleDef.h"
#include "ColorArrow.h"
#include "ColorNote.h"
#include "BitmapText.h"
#include "RectangleActor.h"
#include "ArrowEffects.h"
@@ -49,10 +46,8 @@ public:
float m_fBeginMarker, m_fEndMarker; // only used with MODE_EDIT
protected:
inline void DrawTapNote( const int iCol, const float fIndex );
inline void DrawTapNote( const int iCol, const float fIndex, const D3DXCOLOR color );
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 CreateTapNoteInstance( ColorNoteInstance &cni, const int iCol, const float fIndex, const D3DXCOLOR color = D3DXCOLOR(-1,-1,-1,-1) );
inline void CreateHoldNoteInstance( ColorNoteInstance &cni, const bool bActive, const float fIndex, const HoldNote &hn, const float fHoldNoteLife );
inline void DrawMeasureBar( const int iIndex, const int iMeasureNo );
inline void DrawMarkerBar( const int iIndex );
@@ -67,12 +62,10 @@ protected:
NoteFieldMode m_Mode;
// color arrows
ColorArrow m_ColorArrow[MAX_NOTE_TRACKS];
ColorNote m_ColorNote[MAX_NOTE_TRACKS];
// used in MODE_EDIT
RectangleActor m_rectMeasureBar;
BitmapText m_textMeasureNumber;
RectangleActor m_rectMarkerBar;
};
#endif
+19 -26
View File
@@ -23,9 +23,7 @@
const float JUDGEMENT_Y = CENTER_Y;
const float ARROWS_Y = SCREEN_TOP + ARROW_SIZE * 1.5f;
const float HOLD_JUDGEMENT_Y = ARROWS_Y + 80;
const float LIFEMETER_Y = SCREEN_TOP + 30;
const float COMBO_Y = CENTER_Y + 60;
const float SCORE_Y = SCREEN_HEIGHT - 40;
const float HOLD_ARROW_NG_TIME = 0.27f;
@@ -48,6 +46,8 @@ Player::Player()
}
m_iNumHoldNotes = 0;
m_pLifeMeter = NULL;
m_pScore = NULL;
this->AddActor( &m_GrayArrowRow );
this->AddActor( &m_NoteField );
@@ -56,12 +56,10 @@ Player::Player()
for( int c=0; c<MAX_NOTE_TRACKS; c++ )
this->AddActor( &m_HoldJudgement[c] );
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()", );
this->CopyAll( pNoteData );
@@ -69,6 +67,9 @@ void Player::Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOpti
m_PlayerNumber = player_no;
m_PlayerOptions = po;
m_pLifeMeter = pLM;
m_pScore = pScore;
if( !po.m_bAllowFreezeArrows )
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_LifeMeter.SetY( LIFEMETER_Y );
m_Judgement.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - JUDGEMENT_Y : JUDGEMENT_Y );
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_Score.SetY( SCORE_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_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 )
@@ -112,7 +108,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
m_Judgement.SetJudgement( TNS_MISS );
m_Combo.EndCombo();
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 );
m_LifeMeter.SetBeat( fSongBeat );
m_pLifeMeter->SetBeat( fSongBeat );
m_GrayArrowRow.Update( fDeltaTime, fSongBeat );
m_NoteField.Update( fDeltaTime, fSongBeat );
@@ -233,10 +229,6 @@ void Player::RenderPrimitives()
for( int c=0; c<m_iNumTracks; c++ )
m_HoldJudgement[c].Draw();
m_Combo.Draw();
m_LifeMeter.Draw();
m_Score.Draw();
}
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()" );
@@ -304,8 +296,8 @@ void Player::HandlePlayerStep( float fSongBeat, NoteColumn col, float fMaxBeatDi
// update the judgement, score, and life
m_Judgement.SetJudgement( score );
m_Score.AddToScore( score, m_Combo.GetCurrentCombo() );
m_LifeMeter.ChangeLife( score );
m_pScore->AddToScore( score, m_Combo.GetCurrentCombo() );
m_pLifeMeter->ChangeLife( score );
// show the gray arrow ghost
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()" );
@@ -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 );
@@ -412,12 +404,13 @@ void Player::OnRowDestroyed( float fSongBeat, NoteColumn col, float fMaxBeatDiff
// update the judgement, score, and life
m_Judgement.SetJudgement( score );
m_Score.AddToScore( score, m_Combo.GetCurrentCombo() );
m_LifeMeter.ChangeLife( score );
m_pScore->AddToScore( score, m_Combo.GetCurrentCombo() );
m_pLifeMeter->ChangeLife( score );
// remove this row from the NoteField
m_NoteField.RemoveTapNoteRow( iIndexThatWasSteppedOn );
if ( ( score == TNS_PERFECT ) || ( score == TNS_GREAT ) )
m_NoteField.RemoveTapNoteRow( iIndexThatWasSteppedOn );
// show ghost arrows
for( int c=0; c<m_iNumTracks; c++ ) // for each column
@@ -479,7 +472,7 @@ ScoreSummary Player::GetScoreSummary()
}
}
scoreSummary.max_combo = m_Combo.GetMaxCombo();
scoreSummary.score = m_Score.GetScore();
scoreSummary.score = m_pScore ? m_pScore->GetScore() : 0;
return scoreSummary;
}
@@ -507,7 +500,7 @@ int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat )
{
m_TapNoteScores[i] = TNS_MISS;
iNumMissesFound++;
m_LifeMeter.ChangeLife( TNS_MISS );
m_pLifeMeter->ChangeLife( TNS_MISS );
}
}
+16 -23
View File
@@ -1,31 +1,30 @@
#pragma once
/*
-----------------------------------------------------------------------------
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.
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 "NoteMetadata.h"
#include "Sprite.h"
#include "BitmapText.h"
#include "ColorArrow.h"
#include "ColorNote.h"
#include "GrayArrow.h"
#include "GhostArrow.h"
#include "GhostArrowBright.h"
#include "HoldGhostArrow.h"
#include "ActorFrame.h"
#include "RandomSample.h"
#include "ScoreDisplayRollingWithFrame.h"
#include "LifeMeterPills.h"
#include "ScoreDisplayRolling.h"
#include "LifeMeterBar.h"
#include "Judgement.h"
#include "HoldJudgement.h"
#include "Combo.h"
@@ -44,19 +43,18 @@ public:
void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference );
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 HandlePlayerStep( float fSongBeat, NoteColumn col, float fMaxBeatDiff );
void HandlePlayerStep( float fSongBeat, ColumnNumber col, float fMaxBeatDiff );
int UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
ScoreSummary GetScoreSummary();
float GetLifePercentage() { return m_LifeMeter.GetLifePercentage(); };
bool IsThereANoteAtIndex( int iIndex );
protected:
void CheckForCompleteRow( float fSongBeat, NoteColumn col, float fMaxBeatDiff );
void OnRowDestroyed( float fSongBeat, NoteColumn col, float fMaxBeatDiff, int iStepIndex );
void CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxBeatDiff );
void OnRowDestroyed( float fSongBeat, ColumnNumber col, float fMaxBeatDiff, int iStepIndex );
float m_fSongBeat;
PlayerNumber m_PlayerNumber;
@@ -69,18 +67,13 @@ protected:
GrayArrowRow m_GrayArrowRow;
NoteField m_NoteField;
NoteField m_NoteField;
GhostArrowRow m_GhostArrowRow;
Judgement m_Judgement;
HoldJudgement m_HoldJudgement[MAX_NOTE_TRACKS];
Combo m_Combo;
LifeMeterPills m_LifeMeter;
ScoreDisplayRollingWithFrame m_Score;
Judgement m_Judgement;
HoldJudgement m_HoldJudgement[MAX_NOTE_TRACKS];
Combo m_Combo;
LifeMeterBar* m_pLifeMeter;
ScoreDisplayRolling* m_pScore;
};
#endif
+98 -25
View File
@@ -17,13 +17,68 @@
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()
{
m_SongSortOrder = SORT_GROUP;
m_iCurrentStage = 1;
m_GameMode = GAME_MODE_ARCADE;
m_bWindowed = false;
m_GraphicProfile = PROFILE_MEDIUM;
for( int p=0; p<NUM_PLAYERS; p++ )
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()
{
IniFile ini;
@@ -74,23 +141,25 @@ void PrefsManager::ReadPrefsFromDisk()
{
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( value_string == "super low" ) m_GraphicOptions.m_Profile = PROFILE_SUPER_LOW;
else if( value_string == "low" ) m_GraphicOptions.m_Profile = PROFILE_LOW;
else if( value_string == "medium" ) m_GraphicOptions.m_Profile = PROFILE_MEDIUM;
else if( value_string == "high" ) m_GraphicOptions.m_Profile = PROFILE_HIGH;
else if( value_string == "custom" ) m_GraphicOptions.m_Profile = PROFILE_CUSTOM;
else m_GraphicOptions.m_Profile = PROFILE_MEDIUM;
if( value_string == "super low" ) m_GraphicProfile = PROFILE_SUPER_LOW;
else if( value_string == "low" ) m_GraphicProfile = PROFILE_LOW;
else if( value_string == "medium" ) m_GraphicProfile = PROFILE_MEDIUM;
else if( value_string == "high" ) m_GraphicProfile = PROFILE_HIGH;
else if( value_string == "custom" ) m_GraphicProfile = PROFILE_CUSTOM;
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 );
if( name_string == "DisplayColor" ) m_GraphicOptions.m_iDisplayColor = atoi( value_string );
if( name_string == "TextureColor" ) m_GraphicOptions.m_iTextureColor = atoi( value_string );
if( name_string == "Shadows" ) m_GraphicOptions.m_bShadows = ( value_string == "1" );
if( name_string == "30fpsLock" ) m_GraphicOptions.m_b30fpsLock = ( value_string == "1" );
if( name_string == "Backgrounds" ) m_GraphicOptions.m_bBackgrounds = ( value_string == "1" );
GraphicProfileOptions* pGPO = GetCustomGraphicProfileOptions();
if( name_string == "Width" ) pGPO->m_dwWidth = atoi( value_string );
if( name_string == "Height" ) pGPO->m_dwHeight = atoi( value_string );
if( name_string == "MaxTextureSize" ) pGPO->m_dwMaxTextureSize = atoi( value_string );
if( name_string == "DisplayColor" ) pGPO->m_dwDisplayColor = atoi( value_string );
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
ini.SetValue( "GraphicOptions", "Windowed", m_GraphicOptions.m_bWindowed ? "1":"0" );
switch( m_GraphicOptions.m_Profile )
ini.SetValue( "GraphicOptions", "Windowed", m_bWindowed ? "1":"0" );
switch( m_GraphicProfile )
{
case PROFILE_SUPER_LOW: ini.SetValue( "GraphicOptions", "Profile", "super 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;
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) );
ini.SetValue( "GraphicOptions", "TextureColor", ssprintf("%d", m_GraphicOptions.m_iTextureColor) );
ini.SetValue( "GraphicOptions", "Shadows", m_GraphicOptions.m_bShadows ? "1":"0" );
ini.SetValue( "GraphicOptions", "30fpsLock", m_GraphicOptions.m_b30fpsLock ? "1":"0" );
ini.SetValue( "GraphicOptions", "Backgrounds", m_GraphicOptions.m_bBackgrounds ? "1":"0" );
GraphicProfileOptions* pGPO = GetCustomGraphicProfileOptions();
ini.SetValue( "GraphicOptions", "Width", ssprintf("%d", pGPO->m_dwWidth) );
ini.SetValue( "GraphicOptions", "Height", ssprintf("%d", pGPO->m_dwWidth) );
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" );
+5 -6
View File
@@ -12,17 +12,12 @@
-----------------------------------------------------------------------------
*/
#include "RageInput.h"
#include "GameTypes.h"
const int NUM_PAD_TO_DEVICE_SLOTS = 3; // three device inputs may map to one pad input
class Song;
class PrefsManager
{
public:
@@ -31,12 +26,16 @@ public:
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
GameMode m_GameMode;
int m_iCurrentStage; // number of stages played +1
CString GetStageText();
DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS];
GameOptions m_GameOptions;
GraphicOptions m_GraphicOptions;
bool m_bWindowed;
GraphicProfile m_GraphicProfile;
GraphicProfileOptions* GetCustomGraphicProfileOptions();
GraphicProfileOptions* GetCurrentGraphicProfileOptions();
PlayerOptions m_PlayerOptions[NUM_PLAYERS];
SongOptions m_SongOptions;
+25 -7
View File
@@ -36,7 +36,7 @@ RageBitmapTexture::RageBitmapTexture(
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints ) :
RageTexture( pScreen, sFilePath )
RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, dwHints )
{
// HELPER.Log( "RageBitmapTexture::RageBitmapTexture()" );
@@ -52,6 +52,16 @@ RageBitmapTexture::~RageBitmapTexture()
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
@@ -113,11 +123,8 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR
FatalErrorHr( hr, "D3DXGetImageInfoFromFile() failed for file '%s'.", m_sFilePath );
}
D3DCAPS8 caps;
m_pd3dDevice->GetDeviceCaps( &caps );
// 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;
@@ -132,8 +139,8 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR
if( FAILED( hr = D3DXCreateTextureFromFileEx(
m_pd3dDevice, // device
m_sFilePath, // soure file
D3DX_DEFAULT, // width
D3DX_DEFAULT, // height
bScaleImageToTextureSize ? dwMaxSize : D3DX_DEFAULT, // width
bScaleImageToTextureSize ? dwMaxSize : D3DX_DEFAULT, // height
bCreateMipMaps ? 4 : 0, // mip map levels
0, // usage (is a render target?)
fmtTexture, // our preferred texture format
@@ -174,5 +181,16 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR
m_iImageWidth = m_iSourceWidth;
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();
virtual void Reload(
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints );
virtual LPDIRECT3DTEXTURE8 GetD3DTexture();
protected:
-2
View File
@@ -240,8 +240,6 @@ BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance,
// Obtain an interface to the enumerated joystick.
if( i >= NUM_JOYSTICKS )
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,
&pInput->m_pJoystick[i++],
+16 -2
View File
@@ -242,8 +242,13 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample )
//-----------------------------------------------------------------------------
// RageMovieTexture constructor
//-----------------------------------------------------------------------------
RageMovieTexture::RageMovieTexture( RageScreen* pScreen, const CString &sFilePath ) :
RageTexture( pScreen, sFilePath )
RageMovieTexture::RageMovieTexture(
RageScreen* pScreen,
const CString &sFilePath,
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints ) :
RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, dwHints )
{
HELPER.Log( "RageBitmapTexture::RageBitmapTexture()" );
@@ -263,6 +268,15 @@ RageMovieTexture::~RageMovieTexture()
SAFE_RELEASE(m_pd3dTexture[1]);
}
void RageMovieTexture::Reload(
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints )
{
// do nothing
}
//-----------------------------------------------------------------------------
// GetTexture
//-----------------------------------------------------------------------------
+11 -1
View File
@@ -74,9 +74,19 @@ protected:
class RageMovieTexture : public RageTexture
{
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 void Reload(
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints );
LPDIRECT3DTEXTURE8 GetD3DTexture();
LPDIRECT3DTEXTURE8 m_pd3dTexture[2]; // double buffered
+11
View File
@@ -75,4 +75,15 @@ RageSound::~RageSound()
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; };
void PlayOnceStreamed( CString sPath );
private:
HWND m_hWndApp; // this is set on GRAPHICS_Create()
BASS_INFO m_info;
+7 -1
View File
@@ -20,7 +20,12 @@
//-----------------------------------------------------------------------------
// 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()" );
@@ -52,6 +57,7 @@ void RageTexture::CreateFrameRects()
///////////////////////////////////
// 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 i=0; i<m_iFramesWide; i++ ) // traverse along X (important that this is the inner loop)
+18 -13
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.
Chris Danford
-----------------------------------------------------------------------------
*/
class RageTexture;
#ifndef _RAGETEXTURE_H_
#define _RAGETEXTURE_H_
#include "RageScreen.h"
#include <d3dx8.h>
@@ -41,16 +39,26 @@ public:
class RageTexture
{
public:
RageTexture( RageScreen* pScreen, const CString &sFilePath );
virtual ~RageTexture() PURE;
RageTexture(
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 GetSourceHeight() {return m_iSourceHeight;};
int GetTextureWidth() {return m_iTextureWidth;};
int GetTextureHeight() {return m_iTextureHeight;};
int GetImageWidth() {return m_iImageWidth;};
int GetImageWidth() {return m_iImageWidth;};
int GetImageHeight() {return m_iImageHeight;};
int GetFramesWide() {return m_iFramesWide;};
@@ -92,6 +100,3 @@ protected:
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
{
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
{
@@ -79,17 +82,13 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, const DWORD
splitpath( false, sTexturePath, sDrive, sDir, sFName, sExt );
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
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",
sTexturePath,
pTexture->GetTextureWidth(),
pTexture->GetTextureHeight(),
pTexture->m_iRefCount
);
HELPER.Log( "RageTextureManager: Finished loading '%s' - %d references.", sTexturePath );
m_mapPathToTexture.SetAt( sTexturePath, pTexture );
}
@@ -135,12 +134,25 @@ void RageTextureManager::UnloadTexture( CString sTexturePath )
}
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
{
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 );
bool IsTextureLoaded( 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; };
void SetTextureColorDepth( const DWORD dwTextureColorDepth ) { m_dwTextureColorDepth = dwTextureColorDepth; };
DWORD GetTextureColorDepth() { return m_dwTextureColorDepth; };
protected:
+15
View File
@@ -28,6 +28,21 @@ bool IsAnInt( LPCTSTR s )
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 );
float TimeToSeconds( CString sHMS );
CString ssprintf( LPCTSTR fmt, ...);
+8 -23
View File
@@ -45,28 +45,6 @@ bool RandomSample::LoadSoundDir( CString sDir )
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 )
{
HELPER.Log( "RandomSample::LoadSound( %s )", sSoundFilePath );
@@ -89,7 +67,14 @@ void RandomSample::PlayRandom()
}
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_iIndexLastPlayed = iIndexToPlay;
}
+2 -7
View File
@@ -29,12 +29,8 @@ public:
sExt.MakeLower();
if( sExt == "" )
return LoadSoundDir( sFilePath );
else if( sExt == "set" )
return LoadRandomSample( sFilePath );
else
return LoadSound( sFilePath );
if( sExt == "" ) return LoadSoundDir( sFilePath );
else return LoadSound( sFilePath );
};
void PlayRandom();
@@ -43,7 +39,6 @@ public:
private:
bool LoadSoundDir( CString sDir );
bool LoadRandomSample( CString sSetFilePath );
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 )
{
m_fScore = fNewScore;
+1
View File
@@ -28,6 +28,7 @@ public:
ScoreDisplayRolling();
void SetScore( float fNewScore );
void SetScore( int iNewScore );
float GetScore();
void AddToScore( TapNoteScore score, int iCurCombo );
+42 -28
View File
@@ -72,7 +72,7 @@ Song::Song()
{
m_bChangedSinceSave = false;
m_fOffsetInSeconds = 0;
m_fMusicSampleStartBeat = m_fMusicSampleEndBeat = -1;
m_fMusicSampleStartSeconds = m_fMusicSampleLengthSeconds = -1;
m_dwMusicBytes = 0;
}
@@ -298,17 +298,17 @@ bool Song::LoadFromBMSDir( CString sDir )
// 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>')
m_sTitle.Replace( "(ANOTHER)", "" );
m_sTitle.Replace( "(BASIC)", "" );
m_sTitle.Replace( "(MANIAC)", "" );
m_sTitle.Replace( "<ANOTHER>", "" );
m_sTitle.Replace( "<BASIC>", "" );
m_sTitle.Replace( "<MANIAC>", "" );
value_data.Replace( "(ANOTHER)", "" );
value_data.Replace( "(BASIC)", "" );
value_data.Replace( "(MANIAC)", "" );
value_data.Replace( "<ANOTHER>", "" );
value_data.Replace( "<BASIC>", "" );
value_data.Replace( "<MANIAC>", "" );
GetMainAndSubTitlesFromFullTitle( value_data, m_sMainTitle, m_sSubTitle );
}
else if( -1 != value_name.Find("#artist") )
{
@@ -481,8 +481,9 @@ bool Song::LoadFromDWIFile( CString sPath )
m_sMusicPath = CString("DWI Support\\") + arrayValueTokens[1];
else if( sValueName == "#TITLE" )
m_sTitle = arrayValueTokens[1];
{
GetMainAndSubTitlesFromFullTitle( arrayValueTokens[1], m_sMainTitle, m_sSubTitle );
}
else if( sValueName == "#ARTIST" )
m_sArtist = arrayValueTokens[1];
@@ -499,6 +500,12 @@ bool Song::LoadFromDWIFile( CString sPath )
// the units of GAP is 1/1000 second
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" )
{
CStringArray arrayFreezeExpressions;
@@ -648,7 +655,13 @@ bool Song::LoadFromSMDir( CString sDir )
// handle the data
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" )
m_sArtist = arrayValueTokens[1];
@@ -678,19 +691,15 @@ bool Song::LoadFromSMDir( CString sDir )
else if( sValueName == "#MUSICBYTES" )
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" )
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" )
{
CStringArray arrayFreezeExpressions;
@@ -748,9 +757,10 @@ bool Song::LoadFromSMDir( CString sDir )
void Song::TidyUpData()
{
if( m_sTitle == "" ) m_sTitle = "Untitled song";
m_sTitle.TrimRight();
if( m_sArtist == "" ) m_sArtist = "Unknown artist";
m_sMainTitle.TrimRight();
if( m_sMainTitle == "" ) m_sMainTitle = "Untitled song";
m_sSubTitle.TrimRight();
if( m_sArtist == "" ) m_sArtist = "Unknown artist";
if( m_BPMSegments.GetSize() == 0 )
FatalError( "No #BPM specified in '%s.'", GetSongFilePath() );
@@ -1008,7 +1018,8 @@ void Song::Save()
if( !file.Open( m_sSongFilePath, CFile::modeWrite | CFile::modeCreate ) )
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("#CREDIT:%s;\n", m_sCredit) );
@@ -1055,6 +1066,9 @@ void Song::Save()
file.WriteString( ssprintf("#MUSICBYTES:%u;\n", m_dwMusicBytes) );
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:" );
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* pSong2 = *(Song**)arg2;
CString sTitle1 = pSong1->GetFullTitle();
CString sTitle2 = pSong2->GetFullTitle();
CString sTitle1 = pSong1->GetMainTitle();
CString sTitle2 = pSong2->GetMainTitle();
CString sFilePath1 = pSong1->GetSongFilePath(); // this is unique among songs
CString sFilePath2 = pSong2->GetSongFilePath();
+37 -20
View File
@@ -134,37 +134,54 @@ void SongManager::LoadStepManiaSongDir( CString sDir )
}
}
void SongManager::LoadDWISongDir( CString sDir )
void SongManager::LoadDWISongDir( CString DWIHome )
{
// 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
CStringArray arrayDirs;
GetDirListing( "DWI Support\\DWIs\\*.*", arrayDirs, true );
SortCStringArray( arrayDirs );
CStringArray MixDirs;
// 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();
if( sDirName == "cvs" ) // ignore the directory called "CVS"
continue;
// Find all DWIs in this directory
CStringArray arrayDWIFiles;
GetDirListing( ssprintf("DWI Support\\DWIs\\%s\\*.dwi", sDirName), arrayDWIFiles );
SortCStringArray( arrayDWIFiles );
GetDirListing( ssprintf("%s\\Songs\\%s\\*.*", DWIHome, MixDirs[i]), arrayDirs, true);
SortCStringArray(arrayDirs, true);
for( int j=0; j< arrayDWIFiles.GetSize(); j++ ) // for each DWI file
for( int b = 0; b < arrayDirs.GetSize(); b++)
{
CString sDWIFileName = arrayDWIFiles[j];
sDWIFileName.MakeLower();
// Find all DWIs in this directory
CStringArray arrayDWIFiles;
GetDirListing( ssprintf("%s\\Songs\\%s\\%s\\*.dwi", DWIHome, MixDirs[i], arrayDirs[b]), arrayDWIFiles, false);
SortCStringArray( arrayDWIFiles );
// load DWIs from the sub dirs
Song* pNewSong = new Song;
pNewSong->LoadFromDWIFile( ssprintf("DWI Support\\DWIs\\%s\\%s", sDirName, sDWIFileName) );
m_pSongs.Add( pNewSong );
for( int j=0; j< arrayDWIFiles.GetSize(); j++ ) // for each DWI file
{
CString sDWIFileName = arrayDWIFiles[j];
sDWIFileName.MakeLower();
// load DWIs from the sub dirs
Song* pNewSong = new Song;
pNewSong->LoadFromDWIFile( ssprintf("%s\\Songs\\%s\\%s\\%s", DWIHome, MixDirs[i], arrayDirs[b], sDWIFileName) );
m_pSongs.Add( pNewSong );
}
}
}
}
@@ -228,7 +245,7 @@ void SongManager::ReadStatisticsFromDisk()
Song* pSong = NULL;
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];
break;
@@ -290,7 +307,7 @@ void SongManager::SaveStatisticsToDisk()
// 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(
"%d::%s::%d::%d",
pNoteMetadata->m_iNumTimesPlayed,
+13 -14
View File
@@ -222,29 +222,28 @@ void Sprite::RenderPrimitives()
CUSTOMVERTEX* v;
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
// shift by one pixel because sprites are not aligned (why?!?)
v[0].p = D3DXVECTOR3( quadVerticies.left+1, quadVerticies.bottom, 0 ); // bottom left
v[1].p = D3DXVECTOR3( quadVerticies.left+1, quadVerticies.top, 0 ); // top left
v[2].p = D3DXVECTOR3( quadVerticies.right+1, quadVerticies.bottom, 0 ); // bottom right
v[3].p = D3DXVECTOR3( quadVerticies.right+1, quadVerticies.top, 0 ); // top right
v[0].p = D3DXVECTOR3( quadVerticies.left, quadVerticies.bottom, 0 ); // bottom left
v[1].p = D3DXVECTOR3( quadVerticies.left, quadVerticies.top, 0 ); // top left
v[2].p = D3DXVECTOR3( quadVerticies.right, quadVerticies.bottom, 0 ); // bottom right
v[3].p = D3DXVECTOR3( quadVerticies.right, quadVerticies.top, 0 ); // top right
if( m_bUsingCustomTexCoords )
{
v[0].tu = m_CustomTexCoords[0]; v[0].tv = m_CustomTexCoords[1]; // bottom left
v[1].tu = m_CustomTexCoords[2]; v[1].tv = m_CustomTexCoords[3]; // top left
v[2].tu = m_CustomTexCoords[4]; v[2].tv = m_CustomTexCoords[5]; // bottom right
v[3].tu = m_CustomTexCoords[6]; v[3].tv = m_CustomTexCoords[7]; // top right
v[0].t = D3DXVECTOR2( m_CustomTexCoords[0], m_CustomTexCoords[1] ); // bottom left
v[1].t = D3DXVECTOR2( m_CustomTexCoords[2], m_CustomTexCoords[3] ); // top left
v[2].t = D3DXVECTOR2( m_CustomTexCoords[4], m_CustomTexCoords[5] ); // bottom right
v[3].t = D3DXVECTOR2( m_CustomTexCoords[6], m_CustomTexCoords[7] ); // top right
}
else
{
UINT uFrameNo = m_iStateToFrame[m_iCurState];
FRECT* pTexCoordRect = m_pTexture->GetTextureCoordRect( uFrameNo );
v[0].tu = pTexCoordRect->left; v[0].tv = pTexCoordRect->bottom; // bottom left
v[1].tu = pTexCoordRect->left; v[1].tv = pTexCoordRect->top; // top left
v[2].tu = pTexCoordRect->right; v[2].tv = pTexCoordRect->bottom; // bottom right
v[3].tu = pTexCoordRect->right; v[3].tv = pTexCoordRect->top; // top right
v[0].t = D3DXVECTOR2( pTexCoordRect->left, pTexCoordRect->bottom ); // bottom left
v[1].t = D3DXVECTOR2( pTexCoordRect->left, pTexCoordRect->top ); // top left
v[2].t = D3DXVECTOR2( pTexCoordRect->right, pTexCoordRect->bottom ); // bottom right
v[3].t = D3DXVECTOR2( pTexCoordRect->right, pTexCoordRect->top ); // top right
}
@@ -270,7 +269,7 @@ void Sprite::RenderPrimitives()
//////////////////////
// render the shadow
//////////////////////
if( m_bShadow )
if( m_bShadow && PREFS && PREFS->GetCurrentGraphicProfileOptions()->m_bShadows )
{
SCREEN->PushMatrix();
SCREEN->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units
+1
View File
@@ -37,6 +37,7 @@ public:
return LoadFromTexture( sFilePath, dwHints, bForceReload );
};
void UnloadTexture();
RageTexture* GetTexture() { return m_pTexture; };
virtual void RenderPrimitives();
virtual void Update( float fDeltaTime );
+18 -93
View File
@@ -44,6 +44,7 @@
#include "WindowResults.h"
#include "WindowTitleMenu.h"
#include "WindowPlayerOptions.h"
#include "WindowMusicScroll.h"
#include "ScreenDimensions.h"
@@ -409,15 +410,14 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
case WM_COMMAND:
{
GraphicOptions &go = PREFS->m_GraphicOptions;
switch( LOWORD(wParam) )
{
case IDM_TOGGLEFULLSCREEN:
go.m_bWindowed = !go.m_bWindowed;
PREFS->m_bWindowed = !PREFS->m_bWindowed;
ApplyGraphicOptions();
return 0;
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();
return 0;
case IDM_EXIT:
@@ -525,6 +525,7 @@ HRESULT CreateObjects( HWND hWnd )
//WM->SetNewWindow( new WindowResults );
//WM->SetNewWindow( new WindowPlayerOptions );
WM->SetNewWindow( new WindowTitleMenu );
//WM->SetNewWindow( new WindowMusicScroll );
DXUtil_Timer( TIMER_START ); // Start the accurate timer
@@ -710,6 +711,7 @@ void Render()
SCREEN->ResetMatrixStack();
// draw the game
WM->Draw();
@@ -743,88 +745,16 @@ void ApplyGraphicOptions()
{
InvalidateObjects();
GraphicOptions &go = PREFS->m_GraphicOptions;
GraphicProfileOptions *pGPO = PREFS->GetCurrentGraphicProfileOptions();
bool bWindowed = go.m_bWindowed;
//
// fill these in below depending on the profile
//
CString sProfileName;
DWORD dwWidth, dwHeight;
DWORD dwDisplayBPP;
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
bool bWindowed = PREFS->m_bWindowed;
CString sProfileName = pGPO->m_szProfileName;
DWORD dwWidth = pGPO->m_dwWidth;
DWORD dwHeight = pGPO->m_dwHeight;
DWORD dwDisplayBPP = pGPO->m_dwDisplayColor;
DWORD dwTextureBPP = pGPO->m_dwTextureColor;
DWORD dwMaxTextureSize = pGPO->m_dwMaxTextureSize;
DWORD dwFlags = 0; // not used anymore
//
// 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
//
if( TEXTURE != NULL )
{
TEXTURE->SetMaxTextureSize( dwMaxTextureSize );
TEXTURE->SetTextureColorDepth( dwTextureBPP );
}
TEXTURE->SetPrefs( dwMaxTextureSize, dwTextureBPP );
RestoreObjects();
@@ -871,11 +798,9 @@ void ApplyGraphicOptions()
if( WM )
{
CString sMessage;
if( sProfileName == "Custom" )
sMessage = ssprintf("%s - %ux%u - %u color, %u texture", bWindowed ? "Windowed" : "FullScreen", dwWidth, dwHeight, dwDisplayBPP, dwTextureBPP);
else
sMessage = ssprintf("%s - %s detail", bWindowed ? "Windowed" : "FullScreen", sProfileName );
CString sMessage = ssprintf("%s - %s detail", bWindowed ? "Windowed" : "FullScreen", sProfileName );
if( PREFS->m_GraphicProfile == PROFILE_CUSTOM )
sMessage += ssprintf(" - %ux%u - %u color, %u texture", dwWidth, dwHeight, dwDisplayBPP, dwTextureBPP);
WM->SystemMessage( sMessage );
}
+34 -2
View File
@@ -284,6 +284,14 @@ SOURCE=.\WindowOptions.h
# End 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
# End Source File
# Begin Source File
@@ -324,6 +332,14 @@ SOURCE=.\WindowSelectDifficulty.h
# End 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
# End Source File
# Begin Source File
@@ -332,6 +348,14 @@ SOURCE=.\WindowSelectGroup.h
# End 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
# End Source File
# Begin Source File
@@ -860,11 +884,11 @@ SOURCE=.\Background.h
# End Source File
# Begin Source File
SOURCE=.\ColorArrow.cpp
SOURCE=.\ColorNote.cpp
# End Source File
# Begin Source File
SOURCE=.\ColorArrow.h
SOURCE=.\ColorNote.h
# End Source File
# Begin Source File
@@ -948,6 +972,14 @@ SOURCE=.\Judgement.h
# End 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
# End Source File
# Begin Source File
+38 -14
View File
@@ -71,26 +71,26 @@
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release and Debug"
IntermediateDirectory="Release and Debug"
OutputDirectory="./.."
IntermediateDirectory="./../Release"
ConfigurationType="1"
UseOfMFC="1"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2"
WholeProgramOptimization="FALSE">
WholeProgramOptimization="TRUE">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/EHa"
Optimization="3"
GlobalOptimizations="FALSE"
InlineFunctionExpansion="0"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OptimizeForProcessor="2"
OptimizeForWindowsApplication="TRUE"
PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS"
StringPooling="TRUE"
MinimalRebuild="TRUE"
MinimalRebuild="FALSE"
RuntimeLibrary="0"
BufferSecurityCheck="FALSE"
EnableFunctionLevelLinking="FALSE"
@@ -182,12 +182,6 @@
<File
RelativePath=".\WindowEditMenu.h">
</File>
<File
RelativePath="WindowEnding.cpp">
</File>
<File
RelativePath="WindowEnding.h">
</File>
<File
RelativePath=".\WindowGameOptions.cpp">
</File>
@@ -209,12 +203,24 @@
<File
RelativePath=".\WindowMessage.h">
</File>
<File
RelativePath="WindowMusicScroll.cpp">
</File>
<File
RelativePath="WindowMusicScroll.h">
</File>
<File
RelativePath=".\WindowOptions.cpp">
</File>
<File
RelativePath=".\WindowOptions.h">
</File>
<File
RelativePath="WindowOptionsType2.cpp">
</File>
<File
RelativePath="WindowOptionsType2.h">
</File>
<File
RelativePath=".\WindowPlayerOptions.cpp">
</File>
@@ -245,12 +251,24 @@
<File
RelativePath="WindowSelectDifficulty.h">
</File>
<File
RelativePath="WindowSelectGame.cpp">
</File>
<File
RelativePath="WindowSelectGame.h">
</File>
<File
RelativePath="WindowSelectGroup.cpp">
</File>
<File
RelativePath="WindowSelectGroup.h">
</File>
<File
RelativePath="WindowSelectMode.cpp">
</File>
<File
RelativePath="WindowSelectMode.h">
</File>
<File
RelativePath="WindowSelectMusic.cpp">
</File>
@@ -652,10 +670,10 @@
RelativePath=".\Background.h">
</File>
<File
RelativePath=".\ColorArrow.cpp">
RelativePath="ColorNote.cpp">
</File>
<File
RelativePath=".\ColorArrow.h">
RelativePath="ColorNote.h">
</File>
<File
RelativePath=".\Combo.cpp">
@@ -717,6 +735,12 @@
<File
RelativePath=".\Judgement.h">
</File>
<File
RelativePath="LifeMeterBar.cpp">
</File>
<File
RelativePath="LifeMeterBar.h">
</File>
<File
RelativePath=".\LifeMeterPills.cpp">
</File>
+126
View File
@@ -13,5 +13,131 @@
#include "RageHelper.h"
#include "RageUtil.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] );
}
+35 -25
View File
@@ -7,8 +7,13 @@
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
to use to populate the column's notes.
A "track" is the term used to descibe a particular note in NoteData space.
A "column" is the term used to describe a particular note in Style space.
A "track" is the term used to descibe a particular vertical sting of note
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.
Chris Danford
@@ -21,31 +26,36 @@
#include "GameInput.h"
typedef TrackNumber NoteColumn;
const int MAX_NOTE_COLUMNS = MAX_NOTE_TRACKS;
const int MAX_COLS_PER_PLAYER = MAX_NOTE_TRACKS;
struct StyleDef
class GameDef;
class StyleDef
{
public:
StyleDef( GameDef* pGameDef, CString sStyleFilePath );
LPCTSTR m_szName; // name of the style. e.g. "single", "double"
LPCTSTR m_szReads; // name of the style that we can read. For example, the style named "versus" reads the NoteData with the tag "single"
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)
inline int GetColsPerPlayer() { return m_iNumTracks/m_iNumPlayers; };
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
struct ColumnInfo
{
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_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
int m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
inline GameInput StyleInputToGameInput( const StyleInput StyleI )
{
InstrumentNumber n = m_StyleInputToGameInputAndTrack[StyleI.player][StyleI.col].number;
InstrumentButton b = m_StyleInputToGameInputAndTrack[StyleI.player][StyleI.col].button;
InstrumentNumber n = m_ColumnInfo[StyleI.player][StyleI.col].number;
InstrumentButton b = m_ColumnInfo[StyleI.player][StyleI.col].button;
return GameInput( n, b );
};
@@ -55,8 +65,8 @@ public:
{
for( int t=0; t<MAX_NOTE_TRACKS; t++ )
{
if( m_StyleInputToGameInputAndTrack[p][t].number == GameI.number &&
m_StyleInputToGameInputAndTrack[p][t].button == GameI.button )
if( m_ColumnInfo[p][t].number == GameI.number &&
m_ColumnInfo[p][t].button == GameI.button )
{
return StyleInput( (PlayerNumber)p, t );
}
@@ -67,16 +77,16 @@ public:
void GetTransformedNoteDataForStyle( PlayerNumber p, NoteData* pOriginal, NoteData &newNoteData )
{
TrackNumber iNewToOriginalTrack[MAX_NOTE_COLUMNS];
for( int col=0; col<GetColsPerPlayer(); col++ )
TrackNumber iNewToOriginalTrack[MAX_COLS_PER_PLAYER];
for( int col=0; col<m_iColsPerPlayer; col++ )
{
GameInputAndTrack GIAT = m_StyleInputToGameInputAndTrack[p][col];
TrackNumber originalTrack = GIAT.track;
ColumnInfo colInfo = m_ColumnInfo[p][col];
TrackNumber originalTrack = colInfo.track;
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; };
PlayerNumber player;
TrackNumber col;
ColumnNumber col;
inline bool IsBlank() const { return player == PLAYER_NONE; };
inline bool IsValid() const { return !IsBlank(); };
+11 -11
View File
@@ -46,27 +46,27 @@ bool TextBanner::LoadFromSong( Song* pSong )
return true;
}
CString sTitle = pSong->GetFullTitle();
CString sSubTitle;
CString sMainTitle = pSong->GetMainTitle();
CString sSubTitle = pSong->GetSubTitle();
m_textTitle.SetText( sTitle );
m_textTitle.SetText( sMainTitle );
m_textSubTitle.SetText( sSubTitle );
m_textArtist.SetText( "/ " + pSong->GetArtist() );
m_textArtist.SetText( "/" + pSong->GetArtist() );
float fTitleZoom, fSubTitleZoom, fArtistZoom;
if( sSubTitle == "" )
{
fTitleZoom = 0.9f;
fTitleZoom = 1.0f;
fSubTitleZoom = 0.0f;
fArtistZoom = 0.5f;
fArtistZoom = 0.6f;
}
else
{
fTitleZoom = 0.6f;
fSubTitleZoom = 0.3f;
fArtistZoom = 0.5f;
fTitleZoom = 0.8f;
fSubTitleZoom = 0.6f;
fArtistZoom = 0.6f;
}
m_textTitle.SetZoom( fTitleZoom );
@@ -90,14 +90,14 @@ bool TextBanner::LoadFromSong( Song* pSong )
if( sSubTitle == "" )
{
m_textTitle.SetY( -6 );
m_textTitle.SetY( -7 );
m_textSubTitle.SetY( 0 );
m_textArtist.SetY( 9 );
}
else
{
m_textTitle.SetY( -10 );
m_textSubTitle.SetY( -4 );
m_textSubTitle.SetY( 0 );
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_SELECT_STYLE_BACKGROUND: sAssetPath = "Graphics\\select Style 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_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_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_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_BACKGROUND: sAssetPath = "Graphics\\Fallback Background"; 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_STEPS_DESCRIPTION: sAssetPath = "Graphics\\Steps description 1x8"; 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_DANGER_TEXT: sAssetPath = "Graphics\\danger text"; 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_P2: sAssetPath = "Graphics\\select difficulty arrow p2"; 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_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_GROUP_EXPLANATION: sAssetPath = "Graphics\\select group explanation"; 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_SNAP: sAssetPath = "Sounds\\edit change snap"; 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_ENDING_MUSIC: sAssetPath = "Sounds\\ending music"; break;
+20 -2
View File
@@ -60,8 +60,14 @@ enum ThemeElement {
GRAPHIC_PLAYER_OPTIONS_BACKGROUND,
GRAPHIC_PLAYER_OPTIONS_TOP_EDGE,
GRAPHIC_READY,
GRAPHIC_RESULT_BACKGROUND,
GRAPHIC_RESULT_TOP_EDGE,
GRAPHIC_RESULTS_BACKGROUND,
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_SELECT_MUSIC_SECTION_BAR,
GRAPHIC_SELECT_DIFFICULTY_ARROW_P1,
@@ -76,6 +82,17 @@ enum ThemeElement {
GRAPHIC_SELECT_DIFFICULTY_MEDIUM_PICTURE,
GRAPHIC_SELECT_DIFFICULTY_OK,
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_INFO_FRAME,
GRAPHIC_SELECT_MUSIC_RADAR_BASE,
@@ -117,6 +134,7 @@ enum ThemeElement {
SOUND_EDIT_CHANGE_LINE,
SOUND_EDIT_CHANGE_SNAP,
SOUND_SELECT_DIFFICULTY_CHANGE,
SOUND_SELECT_MODE_CHANGE,
SOUND_ENDING_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 GetGroupName() {return m_sGroupName; };
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 GetBackgroundPath() {return m_sBackgroundPath; };
CString GetBackgroundMoviePath(){return m_sBackgroundMoviePath; };
@@ -70,38 +70,28 @@ public:
bool HasCDTitle() {return m_sCDTitlePath != "" && DoesFileExist(GetCDTitlePath()); };
CString GetFullTitle() {return m_sTitle; };
void GetMainTitleAndSubTitle( CString &sMainTitleOut, CString &sSubTitleOut )
CString GetMainTitle() {return m_sMainTitle; };
CString GetSubTitle() {return m_sSubTitle; };
void GetMainAndSubTitlesFromFullTitle( CString sFullTitle, CString &sMainTitleOut, CString &sSubTitleOut )
{
char szSeps[] = { '-', '~' };
for( int i=0; i<sizeof(szSeps); i++ )
{
const char c = szSeps[i];
int iBeginIndex = m_sTitle.Find( c );
int iBeginIndex = sFullTitle.Find( c );
if( iBeginIndex == -1 )
continue;
int iEndIndex = m_sTitle.Find( c, iBeginIndex+1 );
int iEndIndex = sFullTitle.Find( c, iBeginIndex+1 );
if( iEndIndex == -1 )
continue;
sMainTitleOut = m_sTitle.Left( iBeginIndex-1 );
sSubTitleOut = m_sTitle.Mid( iBeginIndex, iEndIndex-iBeginIndex+1 );
sMainTitleOut = sFullTitle.Left( iBeginIndex-1 );
sSubTitleOut = sFullTitle.Mid( iBeginIndex, iEndIndex-iBeginIndex+1 );
return;
}
sMainTitleOut = m_sTitle;
sMainTitleOut = sFullTitle;
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 GetCredit() {return m_sCredit; };
float GetBeatOffsetInSeconds() {return m_fOffsetInSeconds; };
@@ -143,14 +133,15 @@ private:
CString m_sGroupName;
bool m_bChangedSinceSave;
CString m_sTitle;
CString m_sMainTitle;
CString m_sSubTitle;
CString m_sArtist;
CString m_sCredit;
float m_fOffsetInSeconds;
CString m_sMusicPath;
DWORD m_dwMusicBytes;
float m_fMusicSampleStartBeat, m_fMusicSampleEndBeat;
float m_fMusicSampleStartSeconds, m_fMusicSampleLengthSeconds;
CString m_sBannerPath;
CString m_sBackgroundPath;
CString m_sBackgroundMoviePath;