moved some things around in preparation for new game types

This commit is contained in:
Chris Danford
2002-03-19 07:09:49 +00:00
parent 353fd47f85
commit 4acf0389d2
42 changed files with 833 additions and 622 deletions
+7 -7
View File
@@ -3,21 +3,21 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: ArrowEffects.cpp File: ArrowEffects.cpp
Desc: Functions that return properties of arrows based on Style and PlayerOptions Desc: Functions that return properties of arrows based on StyleDef and PlayerOptions
Copyright (c) 2001-2002 by the names listed below. All rights reserved. Copyright (c) 2001-2002 by the names listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "ArrowEffects.h" #include "ArrowEffects.h"
#include "Steps.h" #include "Pattern.h"
#include "ColorArrow.h" #include "ColorArrow.h"
#include "ScreenDimensions.h" #include "ScreenDimensions.h"
float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBeat ) float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBeat )
{ {
float fBeatsUntilStep = StepIndexToBeat( fStepIndex ) - fSongBeat; float fBeatsUntilStep = NoteIndexToBeat( fStepIndex ) - fSongBeat;
float fYOffset = fBeatsUntilStep * ARROW_GAP; float fYOffset = fBeatsUntilStep * ARROW_GAP;
switch( po.m_EffectType ) switch( po.m_EffectType )
{ {
@@ -31,9 +31,9 @@ float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBea
return fYOffset; return fYOffset;
} }
float ArrowGetXPos( const PlayerOptions& po, const Style &style, int iColNum, float fYOffset, float fSongBeat ) float ArrowGetXPos( const PlayerOptions& po, const StyleDef &StyleDef, int iColNum, float fYOffset, float fSongBeat )
{ {
float fColOffsetFromCenter = iColNum - (style.m_iNumColumns-1)/2.0f; float fColOffsetFromCenter = iColNum - (StyleDef.m_iNumColumns-1)/2.0f;
float fPixelOffsetFromCenter = fColOffsetFromCenter * ARROW_SIZE; float fPixelOffsetFromCenter = fColOffsetFromCenter * ARROW_SIZE;
switch( po.m_EffectType ) switch( po.m_EffectType )
@@ -45,9 +45,9 @@ float ArrowGetXPos( const PlayerOptions& po, const Style &style, int iColNum, fl
return fPixelOffsetFromCenter; return fPixelOffsetFromCenter;
} }
float ArrowGetRotation( const PlayerOptions& po, const Style &style, int iColNum, float fYOffset ) float ArrowGetRotation( const PlayerOptions& po, const StyleDef &StyleDef, int iColNum, float fYOffset )
{ {
float fRotation = style.m_ColumnToRotation[iColNum]; float fRotation = StyleDef.m_ColumnToRotation[iColNum];
switch( po.m_EffectType ) switch( po.m_EffectType )
{ {
+4 -4
View File
@@ -2,7 +2,7 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: ArrowEffects.h File: ArrowEffects.h
Desc: Functions that return properties of arrows based on Style and PlayerOptions Desc: Functions that return properties of arrows based on StyleDef and PlayerOptions
Copyright (c) 2001-2002 by the names listed below. All rights reserved. Copyright (c) 2001-2002 by the names listed below. All rights reserved.
Chris Danford Chris Danford
@@ -14,7 +14,7 @@
#include "GameTypes.h" #include "GameTypes.h"
#include "Style.h" #include "StyleDef.h"
// fYOffset is a vertical position in pixels relative to the center. // fYOffset is a vertical position in pixels relative to the center.
@@ -26,13 +26,13 @@ float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBea
// fXPos is a horizontal position in pixels relative to the center of the field. // fXPos is a horizontal position in pixels relative to the center of the field.
// This depends on the column of the arrow and possibly the Arrow effect and // This depends on the column of the arrow and possibly the Arrow effect and
// fYOffset (in the case of EFFECT_DRUNK). // fYOffset (in the case of EFFECT_DRUNK).
float ArrowGetXPos( const PlayerOptions& po, const Style &style, int iCol, float fYOffset, float fSongBeat ); float ArrowGetXPos( const PlayerOptions& po, const StyleDef &StyleDef, int iCol, float fYOffset, float fSongBeat );
// fRotation is Z rotation of an arrow. This will depend on the column of // fRotation is Z rotation of an arrow. This will depend on the column of
// the arrow and possibly the Arrow effect and the fYOffset (in the case of // the arrow and possibly the Arrow effect and the fYOffset (in the case of
// EFFECT_DIZZY). // EFFECT_DIZZY).
float ArrowGetRotation( const PlayerOptions& po, const Style &style, int iCol, float fYOffset ); float ArrowGetRotation( const PlayerOptions& po, const StyleDef &StyleDef, int iCol, float fYOffset );
// fYPos is the position of the note in pixels relative to the center. // fYPos is the position of the note in pixels relative to the center.
+1
View File
@@ -13,6 +13,7 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "ScreenDimensions.h" #include "ScreenDimensions.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "PrefsManager.h"
#include "RageBitmapTexture.h" #include "RageBitmapTexture.h"
+1 -1
View File
@@ -46,7 +46,7 @@ void Banner::CropToRightSize()
float fOriginalX = GetX(); float fOriginalX = GetX();
float fOriginalY = GetY(); float fOriginalY = GetY();
if( iImageWidth == iImageHeight ) // this is a SSR/DWI style banner if( iImageWidth == iImageHeight ) // this is a SSR/DWI StyleDef banner
{ {
float fCustomImageCoords[8] = { float fCustomImageCoords[8] = {
0.22f, 0.98f, // bottom left 0.22f, 0.98f, // bottom left
+1 -1
View File
@@ -30,7 +30,7 @@ public:
SetFromDescription( "" ); SetFromDescription( "" );
}; };
void SetFromSteps( Steps* pSteps ) void SetFromSteps( Pattern* pSteps )
{ {
if( pSteps != NULL ) if( pSteps != NULL )
{ {
+1 -1
View File
@@ -29,7 +29,7 @@ public:
SetNumFeet( 0, "" ); SetNumFeet( 0, "" );
}; };
void SetFromSteps( Steps* pSteps ) void SetFromSteps( Pattern* pSteps )
{ {
if( pSteps != NULL ) if( pSteps != NULL )
{ {
+159
View File
@@ -0,0 +1,159 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
Class: GameManager
Desc: See Header.
Copyright (c) 2001-2002 by the names listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "GameManager.h"
#include "D3DXmath.h"
GameManager* GAME = NULL; // global and accessable from anywhere in our program
GameManager::GameManager()
{
m_DanceStyle = STYLE_SINGLE;
}
GameManager::~GameManager()
{
}
bool GameManager::IsPlayerEnabled( PlayerNumber PlayerNo )
{
switch( m_DanceStyle )
{
case STYLE_VERSUS:
case STYLE_COUPLE:
if( PlayerNo == PLAYER_1 )
return true;
if( PlayerNo == PLAYER_2 )
return true;
break;
case STYLE_SINGLE:
case STYLE_SOLO:
case STYLE_DOUBLE:
if( PlayerNo == PLAYER_1 )
return true;
if( PlayerNo == PLAYER_2 )
return false;
break;
default:
ASSERT( false ); // invalid StyleDef
}
return false;
}
StyleDef GameManager::GetStyleDef( DanceStyle mode )
{
StyleDef StyleDef;
CMap<TapNote, TapNote, float, float> mapTapNoteToRotation; // arrow facing left is rotation 0
mapTapNoteToRotation[NOTE_PAD1_LEFT] = 0;
mapTapNoteToRotation[NOTE_PAD1_UPLEFT] = D3DX_PI/4.0f;
mapTapNoteToRotation[NOTE_PAD1_DOWN] = -D3DX_PI/2.0f;
mapTapNoteToRotation[NOTE_PAD1_UP] = D3DX_PI/2.0f;
mapTapNoteToRotation[NOTE_PAD1_UPRIGHT] = D3DX_PI*3.0f/4.0f;
mapTapNoteToRotation[NOTE_PAD1_RIGHT] = D3DX_PI;
mapTapNoteToRotation[NOTE_PAD2_LEFT] = mapTapNoteToRotation[NOTE_PAD1_LEFT];
mapTapNoteToRotation[NOTE_PAD2_UPLEFT] = mapTapNoteToRotation[NOTE_PAD1_UPLEFT];
mapTapNoteToRotation[NOTE_PAD2_DOWN] = mapTapNoteToRotation[NOTE_PAD1_DOWN];
mapTapNoteToRotation[NOTE_PAD2_UP] = mapTapNoteToRotation[NOTE_PAD1_UP];
mapTapNoteToRotation[NOTE_PAD2_UPRIGHT] = mapTapNoteToRotation[NOTE_PAD1_UPRIGHT];
mapTapNoteToRotation[NOTE_PAD2_RIGHT] = mapTapNoteToRotation[NOTE_PAD1_RIGHT];
switch( mode )
{
case STYLE_SINGLE:
case STYLE_DOUBLE:
case STYLE_SOLO:
StyleDef.m_iNumPlayers = 1;
break;
case STYLE_VERSUS:
case STYLE_COUPLE:
StyleDef.m_iNumPlayers = 2;
break;
default:
ASSERT( false ); // invalid GameMode
}
switch( mode )
{
case STYLE_SINGLE:
case STYLE_VERSUS:
case STYLE_COUPLE:
StyleDef.m_iNumColumns = 4; // LEFT, DOWN, UP, RIGHT
StyleDef.m_ColumnToTapNote[0] = NOTE_PAD1_LEFT;
StyleDef.m_ColumnToTapNote[1] = NOTE_PAD1_DOWN;
StyleDef.m_ColumnToTapNote[2] = NOTE_PAD1_UP;
StyleDef.m_ColumnToTapNote[3] = NOTE_PAD1_RIGHT;
StyleDef.m_ColumnToTapNote[4] = NOTE_PAD1_UPLEFT; // Even though this isn't used, Need them here so
StyleDef.m_ColumnToTapNote[5] = NOTE_PAD1_UPRIGHT; // TapNoteToColumnNumber doesn't get confused by them
StyleDef.m_ColumnToRotation[0] = mapTapNoteToRotation[NOTE_PAD1_LEFT];
StyleDef.m_ColumnToRotation[1] = mapTapNoteToRotation[NOTE_PAD1_DOWN];
StyleDef.m_ColumnToRotation[2] = mapTapNoteToRotation[NOTE_PAD1_UP];
StyleDef.m_ColumnToRotation[3] = mapTapNoteToRotation[NOTE_PAD1_RIGHT];
StyleDef.m_ColumnToRotation[4] = mapTapNoteToRotation[NOTE_PAD1_UPLEFT];
StyleDef.m_ColumnToRotation[5] = mapTapNoteToRotation[NOTE_PAD1_UPRIGHT];
break;
case STYLE_SOLO:
StyleDef.m_iNumColumns = 6; // LEFT, UP+LEFT, DOWN, UP, UP+RIGHT, RIGHT
StyleDef.m_ColumnToTapNote[0] = NOTE_PAD1_LEFT;
StyleDef.m_ColumnToTapNote[1] = NOTE_PAD1_UPLEFT;
StyleDef.m_ColumnToTapNote[2] = NOTE_PAD1_DOWN;
StyleDef.m_ColumnToTapNote[3] = NOTE_PAD1_UP;
StyleDef.m_ColumnToTapNote[4] = NOTE_PAD1_UPRIGHT;
StyleDef.m_ColumnToTapNote[5] = NOTE_PAD1_RIGHT;
StyleDef.m_ColumnToRotation[0] = mapTapNoteToRotation[NOTE_PAD1_LEFT];
StyleDef.m_ColumnToRotation[1] = mapTapNoteToRotation[NOTE_PAD1_UPLEFT];
StyleDef.m_ColumnToRotation[2] = mapTapNoteToRotation[NOTE_PAD1_DOWN];
StyleDef.m_ColumnToRotation[3] = mapTapNoteToRotation[NOTE_PAD1_UP];
StyleDef.m_ColumnToRotation[4] = mapTapNoteToRotation[NOTE_PAD1_UPRIGHT];
StyleDef.m_ColumnToRotation[5] = mapTapNoteToRotation[NOTE_PAD1_RIGHT];
break;
case STYLE_DOUBLE:
StyleDef.m_iNumColumns = 8; // 1_LEFT, 1_DOWN, 1_UP, 1_RIGHT, 2_LEFT, 2_DOWN, 2_UP, 2_RIGHT
StyleDef.m_ColumnToTapNote[0] = NOTE_PAD1_LEFT;
StyleDef.m_ColumnToTapNote[1] = NOTE_PAD1_DOWN;
StyleDef.m_ColumnToTapNote[2] = NOTE_PAD1_UP;
StyleDef.m_ColumnToTapNote[3] = NOTE_PAD1_RIGHT;
StyleDef.m_ColumnToTapNote[4] = NOTE_PAD2_LEFT;
StyleDef.m_ColumnToTapNote[5] = NOTE_PAD2_DOWN;
StyleDef.m_ColumnToTapNote[6] = NOTE_PAD2_UP;
StyleDef.m_ColumnToTapNote[7] = NOTE_PAD2_RIGHT;
StyleDef.m_ColumnToTapNote[8] = NOTE_PAD1_UPLEFT;// Even though this isn't used, Need them here so
StyleDef.m_ColumnToTapNote[9] = NOTE_PAD1_UPRIGHT;// TapNoteToColumnNumber doesn't get confused by them
StyleDef.m_ColumnToTapNote[10] = NOTE_PAD2_UPLEFT;
StyleDef.m_ColumnToTapNote[11] = NOTE_PAD2_UPRIGHT;
StyleDef.m_ColumnToRotation[0] = mapTapNoteToRotation[NOTE_PAD1_LEFT];
StyleDef.m_ColumnToRotation[1] = mapTapNoteToRotation[NOTE_PAD1_DOWN];
StyleDef.m_ColumnToRotation[2] = mapTapNoteToRotation[NOTE_PAD1_UP];
StyleDef.m_ColumnToRotation[3] = mapTapNoteToRotation[NOTE_PAD1_RIGHT];
StyleDef.m_ColumnToRotation[4] = mapTapNoteToRotation[NOTE_PAD2_LEFT];
StyleDef.m_ColumnToRotation[5] = mapTapNoteToRotation[NOTE_PAD2_DOWN];
StyleDef.m_ColumnToRotation[6] = mapTapNoteToRotation[NOTE_PAD2_UP];
StyleDef.m_ColumnToRotation[7] = mapTapNoteToRotation[NOTE_PAD2_RIGHT];
StyleDef.m_ColumnToRotation[8] = mapTapNoteToRotation[NOTE_PAD1_UPLEFT];
StyleDef.m_ColumnToRotation[9] = mapTapNoteToRotation[NOTE_PAD1_UPRIGHT];
StyleDef.m_ColumnToRotation[10] = mapTapNoteToRotation[NOTE_PAD2_UPLEFT];
StyleDef.m_ColumnToRotation[11] = mapTapNoteToRotation[NOTE_PAD2_UPRIGHT];
break;
default:
ASSERT( false ); // invalid GameMode
}
return StyleDef;
}
+40
View File
@@ -0,0 +1,40 @@
/*
-----------------------------------------------------------------------------
Class: GameManager
Desc: Manages "Game" and "StyleDef", and "Instrument" definitions, which define
different ways of playing - like "dance" and "pump".
Copyright (c) 2001-2002 by the names listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#ifndef _GameManager_H_
#define _GameManager_H_
#include "StyleDef.h"
class GameManager
{
public:
GameManager();
~GameManager();
DanceStyle m_DanceStyle; // the current style
bool IsPlayerEnabled( PlayerNumber PlayerNo );
StyleDef GetStyleDef( DanceStyle mode );
StyleDef GetCurrentStyleDef() { return GetStyleDef(m_DanceStyle); };
protected:
};
extern GameManager* GAME; // global and accessable from anywhere in our program
#endif
+6 -6
View File
@@ -31,15 +31,15 @@ void GhostArrow::SetBeat( const float fSongBeat )
//SetState( fmodf(fSongBeat,1)<0.25 ? 1 : 0 ); //SetState( fmodf(fSongBeat,1)<0.25 ? 1 : 0 );
} }
void GhostArrow::Step( TapStepScore score ) void GhostArrow::Step( TapNoteScore score )
{ {
switch( score ) switch( score )
{ {
case TSS_PERFECT: SetDiffuseColor( D3DXCOLOR(1.0f,1.0f,0.3f,0.6f) ); break; // yellow case TNS_PERFECT: SetDiffuseColor( D3DXCOLOR(1.0f,1.0f,0.3f,0.6f) ); break; // yellow
case TSS_GREAT: SetDiffuseColor( D3DXCOLOR(0.0f,1.0f,0.4f,0.6f) ); break; // green case TNS_GREAT: SetDiffuseColor( D3DXCOLOR(0.0f,1.0f,0.4f,0.6f) ); break; // green
case TSS_GOOD: SetDiffuseColor( D3DXCOLOR(0.3f,0.8f,1.0f,0.6f) ); break; case TNS_GOOD: SetDiffuseColor( D3DXCOLOR(0.3f,0.8f,1.0f,0.6f) ); break;
case TSS_BOO: SetDiffuseColor( D3DXCOLOR(0.8f,0.0f,0.6f,0.6f) ); break; case TNS_BOO: SetDiffuseColor( D3DXCOLOR(0.8f,0.0f,0.6f,0.6f) ); break;
case TSS_MISS: ASSERT( false ); break; case TNS_MISS: ASSERT( false ); break;
} }
SetZoom( 1.0f ); SetZoom( 1.0f );
BeginTweening( 0.3f ); BeginTweening( 0.3f );
+2 -2
View File
@@ -16,7 +16,7 @@ class GhostArrow;
#include "Sprite.h" #include "Sprite.h"
#include "Steps.h" #include "Pattern.h"
class GhostArrow : public Sprite class GhostArrow : public Sprite
@@ -27,7 +27,7 @@ public:
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
void SetBeat( const float fSongBeat ); void SetBeat( const float fSongBeat );
void Step( TapStepScore score ); void Step( TapNoteScore score );
float m_fVisibilityCountdown; float m_fVisibilityCountdown;
}; };
+6 -6
View File
@@ -27,15 +27,15 @@ void GhostArrowBright::SetBeat( const float fSongBeat )
//SetState( fmodf(fSongBeat,1)<0.25 ? 1 : 0 ); //SetState( fmodf(fSongBeat,1)<0.25 ? 1 : 0 );
} }
void GhostArrowBright::Step( TapStepScore score ) void GhostArrowBright::Step( TapNoteScore score )
{ {
switch( score ) switch( score )
{ {
case TSS_PERFECT: SetDiffuseColor( D3DXCOLOR(1.0f,1.0f,0.3f,1.0f) ); break; // yellow case TNS_PERFECT: SetDiffuseColor( D3DXCOLOR(1.0f,1.0f,0.3f,1.0f) ); break; // yellow
case TSS_GREAT: SetDiffuseColor( D3DXCOLOR(0.0f,1.0f,0.4f,1.0f) ); break; // green case TNS_GREAT: SetDiffuseColor( D3DXCOLOR(0.0f,1.0f,0.4f,1.0f) ); break; // green
case TSS_GOOD: SetDiffuseColor( D3DXCOLOR(0.3f,0.8f,1.0f,1.0f) ); break; case TNS_GOOD: SetDiffuseColor( D3DXCOLOR(0.3f,0.8f,1.0f,1.0f) ); break;
case TSS_BOO: SetDiffuseColor( D3DXCOLOR(0.8f,0.0f,0.6f,1.0f) ); break; case TNS_BOO: SetDiffuseColor( D3DXCOLOR(0.8f,0.0f,0.6f,1.0f) ); break;
case TSS_MISS: ASSERT( false ); break; case TNS_MISS: ASSERT( false ); break;
} }
SetState( 0 ); SetState( 0 );
SetZoom( 1.2f ); SetZoom( 1.2f );
+2 -2
View File
@@ -16,7 +16,7 @@ class GhostArrowBright;
#include "Sprite.h" #include "Sprite.h"
#include "Steps.h" #include "Pattern.h"
class GhostArrowBright : public Sprite class GhostArrowBright : public Sprite
@@ -25,7 +25,7 @@ public:
GhostArrowBright(); GhostArrowBright();
void SetBeat( const float fSongBeat ); void SetBeat( const float fSongBeat );
void Step( TapStepScore score ); void Step( TapNoteScore score );
float m_fVisibilityCountdown; float m_fVisibilityCountdown;
}; };
+4 -3
View File
@@ -1,11 +1,12 @@
#include "stdafx.h" #include "stdafx.h"
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: Grade.cpp Class: Grade
Desc: A graphic displayed in the Grade during Dancing. Desc: See header.
Copyright (c) 2001 Chris Danford. All rights reserved. Copyright (c) 2001-2002 by the names listed below. All rights reserved.
Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+4 -3
View File
@@ -1,10 +1,11 @@
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: Grade.h Class: Grade
Desc: A graphic displayed in the Grade during Dancing. Desc: This a mark the player receives after clearing a song.
Copyright (c) 2001 Chris Danford. All rights reserved. Copyright (c) 2001-2002 by the names listed below. All rights reserved.
Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+1 -1
View File
@@ -16,7 +16,7 @@
#include "Sprite.h" #include "Sprite.h"
#include "Steps.h" #include "Pattern.h"
class GrayArrow : public Sprite class GrayArrow : public Sprite
{ {
+1 -1
View File
@@ -16,7 +16,7 @@ class HoldGhostArrow;
#include "Sprite.h" #include "Sprite.h"
#include "Steps.h" #include "Pattern.h"
class HoldGhostArrow : public Sprite class HoldGhostArrow : public Sprite
+6 -6
View File
@@ -43,21 +43,21 @@ void HoldJudgement::RenderPrimitives()
} }
} }
void HoldJudgement::SetHoldJudgement( HoldStepResult result ) void HoldJudgement::SetHoldJudgement( HoldNoteResult result )
{ {
//RageLog( "Judgement::SetJudgement()" ); //RageLog( "Judgement::SetJudgement()" );
switch( result ) switch( result )
{ {
case HSR_NONE: m_sprJudgement.SetState( 0 ); break; case HNR_NONE: m_sprJudgement.SetState( 0 ); break;
case HSR_OK: m_sprJudgement.SetState( 7 ); break; case HNR_OK: m_sprJudgement.SetState( 7 ); break;
case HSR_NG: m_sprJudgement.SetState( 8 ); break; case HNR_NG: m_sprJudgement.SetState( 8 ); break;
default: ASSERT( false ); default: ASSERT( false );
} }
m_fDisplayCountdown = JUDGEMENT_DISPLAY_TIME; m_fDisplayCountdown = JUDGEMENT_DISPLAY_TIME;
if( result == HSR_NG ) if( result == HNR_NG )
{ {
// falling down // falling down
m_sprJudgement.SetY( -10 ); m_sprJudgement.SetY( -10 );
@@ -65,7 +65,7 @@ void HoldJudgement::SetHoldJudgement( HoldStepResult result )
m_sprJudgement.BeginTweening( JUDGEMENT_DISPLAY_TIME ); m_sprJudgement.BeginTweening( JUDGEMENT_DISPLAY_TIME );
m_sprJudgement.SetTweenY( 10 ); m_sprJudgement.SetTweenY( 10 );
} }
else if( result == HSR_OK ) else if( result == HNR_OK )
{ {
// zooming out // zooming out
m_sprJudgement.SetZoom( 1.5f ); m_sprJudgement.SetZoom( 1.5f );
+1 -1
View File
@@ -24,7 +24,7 @@ class HoldJudgement : public ActorFrame
{ {
public: public:
HoldJudgement(); HoldJudgement();
void SetHoldJudgement( HoldStepResult result ); void SetHoldJudgement( HoldNoteResult result );
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void RenderPrimitives(); virtual void RenderPrimitives();
+7 -7
View File
@@ -44,23 +44,23 @@ void Judgement::RenderPrimitives()
} }
void Judgement::SetJudgement( TapStepScore score ) void Judgement::SetJudgement( TapNoteScore score )
{ {
//RageLog( "Judgement::SetJudgement()" ); //RageLog( "Judgement::SetJudgement()" );
switch( score ) switch( score )
{ {
case TSS_PERFECT: m_sprJudgement.SetState( 0 ); break; case TNS_PERFECT: m_sprJudgement.SetState( 0 ); break;
case TSS_GREAT: m_sprJudgement.SetState( 1 ); break; case TNS_GREAT: m_sprJudgement.SetState( 1 ); break;
case TSS_GOOD: m_sprJudgement.SetState( 2 ); break; case TNS_GOOD: m_sprJudgement.SetState( 2 ); break;
case TSS_BOO: m_sprJudgement.SetState( 3 ); break; case TNS_BOO: m_sprJudgement.SetState( 3 ); break;
case TSS_MISS: m_sprJudgement.SetState( 4 ); break; case TNS_MISS: m_sprJudgement.SetState( 4 ); break;
default: ASSERT( false ); default: ASSERT( false );
} }
m_fDisplayCountdown = JUDGEMENT_DISPLAY_TIME; m_fDisplayCountdown = JUDGEMENT_DISPLAY_TIME;
if( score == TSS_MISS ) if( score == TNS_MISS )
{ {
// falling down // falling down
m_sprJudgement.SetY( -30 ); m_sprJudgement.SetY( -30 );
+1 -1
View File
@@ -24,7 +24,7 @@ class Judgement : public ActorFrame
{ {
public: public:
Judgement(); Judgement();
void SetJudgement( TapStepScore score ); void SetJudgement( TapNoteScore score );
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void RenderPrimitives(); virtual void RenderPrimitives();
+13 -12
View File
@@ -12,6 +12,7 @@
#include "MusicWheel.h" #include "MusicWheel.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "SongManager.h" #include "SongManager.h"
#include "GameManager.h"
#include "ScreenDimensions.h" #include "ScreenDimensions.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "RageMusic.h" #include "RageMusic.h"
@@ -231,7 +232,7 @@ MusicWheel::MusicWheel()
// init m_mapGroupNameToBannerColor // init m_mapGroupNameToBannerColor
CArray<Song*, Song*> arraySongs; CArray<Song*, Song*> arraySongs;
arraySongs.Copy( SONGS->m_pSongs ); arraySongs.Copy( SONG->m_pSongs );
SortSongPointerArrayByGroup( arraySongs ); SortSongPointerArrayByGroup( arraySongs );
int iNextGroupBannerColor = 0; int iNextGroupBannerColor = 0;
@@ -271,10 +272,10 @@ MusicWheel::MusicWheel()
BuildWheelItemDatas( m_WheelItemDatas[so], SongSortOrder(so) ); BuildWheelItemDatas( m_WheelItemDatas[so], SongSortOrder(so) );
if( SONGS->m_pCurSong == NULL && // if there is no currently selected song if( SONG->m_pCurSong == NULL && // if there is no currently selected song
SONGS->m_pSongs.GetSize() > 0 ) // and there is at least one song SONG->m_pSongs.GetSize() > 0 ) // and there is at least one song
{ {
SONGS->m_pCurSong = SONGS->m_pSongs[0]; // select the first song SONG->m_pCurSong = SONG->m_pSongs[0]; // select the first song
} }
@@ -283,7 +284,7 @@ MusicWheel::MusicWheel()
for( i=0; i<GetCurWheelItemDatas().GetSize(); i++ ) for( i=0; i<GetCurWheelItemDatas().GetSize(); i++ )
{ {
if( GetCurWheelItemDatas()[i].m_pSong != NULL if( GetCurWheelItemDatas()[i].m_pSong != NULL
&& GetCurWheelItemDatas()[i].m_pSong == SONGS->m_pCurSong ) && GetCurWheelItemDatas()[i].m_pSong == SONG->m_pCurSong )
{ {
m_iSelection = i; // select it m_iSelection = i; // select it
m_sExpandedSectionName = GetCurWheelItemDatas()[m_iSelection].m_sSectionName; // make its group the currently expanded group m_sExpandedSectionName = GetCurWheelItemDatas()[m_iSelection].m_sSectionName; // make its group the currently expanded group
@@ -309,20 +310,20 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
/////////////////////////////////// ///////////////////////////////////
CArray<Song*, Song*> arraySongs; CArray<Song*, Song*> arraySongs;
// copy only song that have at least one Steps for the current GameMode // copy only song that have at least one Pattern for the current GameMode
for( int i=0; i<SONGS->m_pSongs.GetSize(); i++ ) for( int i=0; i<SONG->m_pSongs.GetSize(); i++ )
{ {
Song* pSong = SONGS->m_pSongs[i]; Song* pSong = SONG->m_pSongs[i];
CArray<Steps*, Steps*> arraySteps; CArray<Pattern*, Pattern*> arraySteps;
pSong->GetStepsThatMatchGameMode( PREFS->m_GameMode, arraySteps ); pSong->GetPatternsThatMatchStyle( GAME->m_DanceStyle, arraySteps );
if( arraySteps.GetSize() > 0 ) if( arraySteps.GetSize() > 0 )
arraySongs.Add( pSong ); arraySongs.Add( pSong );
} }
// sort the songs // sort the SONG
switch( so ) switch( so )
{ {
case SORT_GROUP: case SORT_GROUP:
@@ -432,7 +433,7 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
if( arrayWheelItemDatas.GetSize() == 0 ) if( arrayWheelItemDatas.GetSize() == 0 )
{ {
arrayWheelItemDatas.SetSize( 1 ); arrayWheelItemDatas.SetSize( 1 );
arrayWheelItemDatas[0].LoadFromSectionName( "No Songs" ); arrayWheelItemDatas[0].LoadFromSectionName( "No SONG" );
arrayWheelItemDatas[0].m_colorTint = D3DXCOLOR(0.5f,0.5f,0.5f,1); arrayWheelItemDatas[0].m_colorTint = D3DXCOLOR(0.5f,0.5f,0.5f,1);
} }
} }
+129 -130
View File
@@ -1,10 +1,9 @@
#include "stdafx.h" #include "stdafx.h"
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: Player.cpp Class: Pattern
Desc: Object that accepts pad input, knocks down ColorArrows that were stepped on, Desc: See header.
and keeps score for the player.
Copyright (c) 2001 Chris Danford. All rights reserved. Copyright (c) 2001 Chris Danford. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
@@ -36,13 +35,13 @@ Player::Player()
m_PlayerNumber = PLAYER_NONE; m_PlayerNumber = PLAYER_NONE;
// init step elements // init step elements
for( int i=0; i<MAX_TAP_STEP_ELEMENTS; i++ ) for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ )
{ {
m_TapStepsOriginal[i] = STEP_NONE; m_TapNotesOriginal[i] = NOTE_NONE;
m_TapStepsRemaining[i] = STEP_NONE; m_TapNotesRemaining[i] = NOTE_NONE;
m_TapStepScores[i] = TSS_NONE; m_TapNoteScores[i] = TNS_NONE;
} }
m_iNumHoldSteps = 0; m_iNumHoldNotes = 0;
this->AddActor( &m_GrayArrows ); this->AddActor( &m_GrayArrows );
@@ -57,39 +56,39 @@ Player::Player()
} }
void Player::Load( const Style& style, PlayerNumber player_no, const Steps& steps, const PlayerOptions& po ) void Player::Load( const StyleDef& StyleDef, PlayerNumber player_no, const Pattern& pattern, const PlayerOptions& po )
{ {
//RageLog( "Player::Load()", ); //RageLog( "Player::Load()", );
m_Style = style; m_Style = StyleDef;
m_PlayerNumber = player_no; m_PlayerNumber = player_no;
m_PlayerOptions = po; m_PlayerOptions = po;
Steps steps2 = steps; Pattern pattern2 = pattern;
if( !po.m_bAllowFreezeArrows ) if( !po.m_bAllowFreezeArrows )
steps2.RemoveHoldSteps(); pattern2.RemoveHoldNotes();
steps2.Turn( po.m_TurnType ); pattern2.Turn( po.m_TurnType );
if( po.m_bLittle ) if( po.m_bLittle )
steps2.MakeLittle(); pattern2.MakeLittle();
m_ColorArrowField.Load( style, steps2, po, 2, 10 ); m_ColorArrowField.Load( StyleDef, pattern2, po, 2, 10 );
m_GrayArrows.Load( po, style ); m_GrayArrows.Load( po, StyleDef );
m_GhostArrows.Load( po, style ); m_GhostArrows.Load( po, StyleDef );
// load step elements // load step elements
for( int i=0; i<MAX_TAP_STEP_ELEMENTS; i++ ) for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ )
{ {
m_TapStepsOriginal[i] = steps2.m_TapSteps[i]; m_TapNotesOriginal[i] = pattern2.m_TapNotes[i];
m_TapStepsRemaining[i] = steps2.m_TapSteps[i]; m_TapNotesRemaining[i] = pattern2.m_TapNotes[i];
} }
for( i=0; i<steps2.m_iNumHoldSteps; i++ ) for( i=0; i<pattern2.m_iNumHoldNotes; i++ )
{ {
m_HoldSteps[i] = steps2.m_HoldSteps[i]; m_HoldNotes[i] = pattern2.m_HoldNotes[i];
} }
m_iNumHoldSteps = steps2.m_iNumHoldSteps; m_iNumHoldNotes = pattern2.m_iNumHoldNotes;
m_Combo.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - COMBO_Y : COMBO_Y ); m_Combo.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - COMBO_Y : COMBO_Y );
@@ -112,70 +111,70 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
// //
// Check for TapStep misses // Check for TapNote misses
// //
int iNumMisses = UpdateStepsMissedOlderThan( m_fSongBeat-fMaxBeatDifference ); int iNumMisses = UpdateStepsMissedOlderThan( m_fSongBeat-fMaxBeatDifference );
if( iNumMisses > 0 ) if( iNumMisses > 0 )
{ {
m_Judgement.SetJudgement( TSS_MISS ); m_Judgement.SetJudgement( TNS_MISS );
m_Combo.EndCombo(); m_Combo.EndCombo();
for( int i=0; i<iNumMisses; i++ ) for( int i=0; i<iNumMisses; i++ )
m_LifeMeter.ChangeLife( TSS_MISS ); m_LifeMeter.ChangeLife( TNS_MISS );
} }
// //
// update HoldSteps logic // update HoldNotes logic
// //
for( int i=0; i<m_iNumHoldSteps; i++ ) // for each HoldStep for( int i=0; i<m_iNumHoldNotes; i++ ) // for each HoldNote
{ {
HoldStep &hs = m_HoldSteps[i]; HoldNote &hn = m_HoldNotes[i];
HoldStepScore &hss = m_HoldStepScores[i]; HoldNoteScore &hns = m_HoldNoteScores[i];
if( hss.m_Result != HSR_NONE ) // if this HoldStep already has a result if( hns.m_Result != HNR_NONE ) // if this HoldNote already has a result
continue; // we don't need to update the logic for this one continue; // we don't need to update the logic for this one
float fStartBeat = StepIndexToBeat( (float)hs.m_iStartIndex ); float fStartBeat = NoteIndexToBeat( (float)hn.m_iStartIndex );
float fEndBeat = StepIndexToBeat( (float)hs.m_iEndIndex ); float fEndBeat = NoteIndexToBeat( (float)hn.m_iEndIndex );
// update the life // update the life
if( fStartBeat < m_fSongBeat && m_fSongBeat < fEndBeat ) // if the song beat is in the range of this hold if( fStartBeat < m_fSongBeat && m_fSongBeat < fEndBeat ) // if the song beat is in the range of this hold
{ {
PlayerInput PlayerI( m_PlayerNumber, hs.m_TapStep ); PlayerInput PlayerI( m_PlayerNumber, hn.m_TapNote );
bool bIsHoldingButton = PREFS->IsButtonDown( PlayerI ); bool bIsHoldingButton = PREFS->IsButtonDown( PlayerI );
if( bIsHoldingButton ) if( bIsHoldingButton )
{ {
hss.m_fLife += fDeltaTime/HOLD_ARROW_NG_TIME; hns.m_fLife += fDeltaTime/HOLD_ARROW_NG_TIME;
hss.m_fLife = min( hss.m_fLife, 1 ); // clamp hns.m_fLife = min( hns.m_fLife, 1 ); // clamp
int iCol = m_Style.TapStepToColumnNumber( hs.m_TapStep ); int iCol = m_Style.TapNoteToColumnNumber( hn.m_TapNote );
m_GhostArrows.HoldStep( iCol ); // update the "electric ghost" effect m_GhostArrows.HoldNote( iCol ); // update the "electric ghost" effect
} }
else // !bIsHoldingButton else // !bIsHoldingButton
{ {
hss.m_fLife -= fDeltaTime/HOLD_ARROW_NG_TIME; hns.m_fLife -= fDeltaTime/HOLD_ARROW_NG_TIME;
hss.m_fLife = max( hss.m_fLife, 0 ); // clamp hns.m_fLife = max( hns.m_fLife, 0 ); // clamp
} }
m_ColorArrowField.SetHoldStepLife( i, hss.m_fLife ); // update the ColorArrowField display m_ColorArrowField.SetHoldNoteLife( i, hns.m_fLife ); // update the ColorArrowField display
} }
// check for NG // check for NG
if( hss.m_fLife == 0 ) // the player has not pressed the button for a long time! if( hns.m_fLife == 0 ) // the player has not pressed the button for a long time!
{ {
hss.m_Result = HSR_NG; hns.m_Result = HNR_NG;
int iCol = m_Style.TapStepToColumnNumber( hs.m_TapStep ); int iCol = m_Style.TapNoteToColumnNumber( hn.m_TapNote );
m_HoldJudgement[iCol].SetHoldJudgement( HSR_NG ); m_HoldJudgement[iCol].SetHoldJudgement( HNR_NG );
} }
// check for OK // check for OK
if( m_fSongBeat > fEndBeat ) // if this HoldStep is in the past if( m_fSongBeat > fEndBeat ) // if this HoldNote is in the past
{ {
// this implies that hss.m_fLife > 0, or else we would have marked it NG above // this implies that hns.m_fLife > 0, or else we would have marked it NG above
hss.m_fLife = 1; hns.m_fLife = 1;
hss.m_Result = HSR_OK; hns.m_Result = HNR_OK;
int iCol = m_Style.TapStepToColumnNumber( hs.m_TapStep ); int iCol = m_Style.TapNoteToColumnNumber( hn.m_TapNote );
m_HoldJudgement[iCol].SetHoldJudgement( HSR_OK ); m_HoldJudgement[iCol].SetHoldJudgement( HNR_OK );
m_ColorArrowField.SetHoldStepLife( i, hss.m_fLife ); // update the ColorArrowField display m_ColorArrowField.SetHoldNoteLife( i, hns.m_fLife ); // update the ColorArrowField display
} }
} }
@@ -249,12 +248,12 @@ void Player::RenderPrimitives()
bool Player::IsThereANoteAtIndex( int iIndex ) bool Player::IsThereANoteAtIndex( int iIndex )
{ {
if( m_TapStepsOriginal[iIndex] != STEP_NONE ) if( m_TapNotesOriginal[iIndex] != NOTE_NONE )
return true; return true;
for( int i=0; i<m_iNumHoldSteps; i++ ) // for each HoldStep for( int i=0; i<m_iNumHoldNotes; i++ ) // for each HoldNote
{ {
if( m_HoldSteps[i].m_iStartIndex == iIndex ) if( m_HoldNotes[i].m_iStartIndex == iIndex )
return true; return true;
} }
@@ -264,12 +263,12 @@ bool Player::IsThereANoteAtIndex( int iIndex )
void Player::HandlePlayerStep( float fSongBeat, TapStep player_step, float fMaxBeatDiff ) void Player::HandlePlayerStep( float fSongBeat, TapNote player_step, float fMaxBeatDiff )
{ {
//RageLog( "Player::HandlePlayerStep()" ); //RageLog( "Player::HandlePlayerStep()" );
int iColumnNum = m_Style.TapStepToColumnNumber( player_step ); int iColumnNum = m_Style.TapNoteToColumnNumber( player_step );
if( iColumnNum == -1 ) // if this TapStep is not used in the current Style if( iColumnNum == -1 ) // if this TapNote is not used in the current StyleDef
return; // ignore the step return; // ignore the step
m_GrayArrows.Step( iColumnNum ); m_GrayArrows.Step( iColumnNum );
@@ -277,37 +276,37 @@ void Player::HandlePlayerStep( float fSongBeat, TapStep player_step, float fMaxB
CheckForCompleteStep( fSongBeat, player_step, fMaxBeatDiff ); CheckForCompleteStep( fSongBeat, player_step, fMaxBeatDiff );
// //
// check if we stepped on the TapStep part of a HoldStep // check if we stepped on the TapNote part of a HoldNote
// //
for( int i=0; i<m_iNumHoldSteps; i++ ) // for each HoldStep for( int i=0; i<m_iNumHoldNotes; i++ ) // for each HoldNote
{ {
HoldStep& hs = m_HoldSteps[i]; HoldNote& hn = m_HoldNotes[i];
HoldStepScore& hss = m_HoldStepScores[i]; HoldNoteScore& hns = m_HoldNoteScores[i];
if( hss.m_Result != HSR_NONE ) // if this note already has a score if( hns.m_Result != HNR_NONE ) // if this note already has a score
continue; // we don't need to update its logic continue; // we don't need to update its logic
if( hss.m_TapStepScore != TSS_NONE ) // the TapStep already has a score if( hns.m_TapNoteScore != TNS_NONE ) // the TapNote already has a score
continue; // no need to continue; continue; // no need to continue;
if( player_step == m_HoldSteps[i].m_TapStep ) // the player's step is the same as this HoldStep if( player_step == m_HoldNotes[i].m_TapNote ) // the player's step is the same as this HoldNote
{ {
float fBeatDifference = fabsf( StepIndexToBeat(hs.m_iStartIndex) - fSongBeat ); float fBeatDifference = fabsf( NoteIndexToBeat(hn.m_iStartIndex) - fSongBeat );
if( fBeatDifference <= fMaxBeatDiff ) if( fBeatDifference <= fMaxBeatDiff )
{ {
float fBeatsUntilStep = StepIndexToBeat( (float)hs.m_iStartIndex ) - fSongBeat; float fBeatsUntilStep = NoteIndexToBeat( (float)hn.m_iStartIndex ) - fSongBeat;
float fPercentFromPerfect = fabsf( fBeatsUntilStep / fMaxBeatDiff ); float fPercentFromPerfect = fabsf( fBeatsUntilStep / fMaxBeatDiff );
//RageLog( "fBeatsUntilStep: %f, fPercentFromPerfect: %f", //RageLog( "fBeatsUntilStep: %f, fPercentFromPerfect: %f",
// fBeatsUntilStep, fPercentFromPerfect ); // fBeatsUntilStep, fPercentFromPerfect );
// compute what the score should be for the note we stepped on // compute what the score should be for the note we stepped on
TapStepScore &score = hss.m_TapStepScore; TapNoteScore &score = hns.m_TapNoteScore;
if( fPercentFromPerfect < 0.25f ) score = TSS_PERFECT; if( fPercentFromPerfect < 0.25f ) score = TNS_PERFECT;
else if( fPercentFromPerfect < 0.50f ) score = TSS_GREAT; else if( fPercentFromPerfect < 0.50f ) score = TNS_GREAT;
else if( fPercentFromPerfect < 0.75f ) score = TSS_GOOD; else if( fPercentFromPerfect < 0.75f ) score = TNS_GOOD;
else score = TSS_BOO; else score = TNS_BOO;
// update the judgement, score, and life // update the judgement, score, and life
m_Judgement.SetJudgement( score ); m_Judgement.SetJudgement( score );
@@ -315,18 +314,18 @@ void Player::HandlePlayerStep( float fSongBeat, TapStep player_step, float fMaxB
m_LifeMeter.ChangeLife( score ); m_LifeMeter.ChangeLife( score );
// show the gray arrow ghost // show the gray arrow ghost
int iColNum = m_Style.TapStepToColumnNumber( player_step ); int iColNum = m_Style.TapNoteToColumnNumber( player_step );
m_GhostArrows.TapStep( iColNum, score, m_Combo.GetCurrentCombo() > 100 ); m_GhostArrows.TapNote( iColNum, score, m_Combo.GetCurrentCombo() > 100 );
// update the combo display // update the combo display
switch( score ) switch( score )
{ {
case TSS_PERFECT: case TNS_PERFECT:
case TSS_GREAT: case TNS_GREAT:
m_Combo.ContinueCombo(); m_Combo.ContinueCombo();
break; break;
case TSS_GOOD: case TNS_GOOD:
case TSS_BOO: case TNS_BOO:
m_Combo.EndCombo(); m_Combo.EndCombo();
break; break;
} }
@@ -339,13 +338,13 @@ void Player::HandlePlayerStep( float fSongBeat, TapStep player_step, float fMaxB
} }
void Player::CheckForCompleteStep( float fSongBeat, TapStep player_step, float fMaxBeatDiff ) void Player::CheckForCompleteStep( float fSongBeat, TapNote player_step, float fMaxBeatDiff )
{ {
//RageLog( "Player::CheckForCompleteStep()" ); //RageLog( "Player::CheckForCompleteStep()" );
// look for the closest matching step // look for the closest matching step
int iIndexStartLookingAt = BeatToStepIndex( fSongBeat ); int iIndexStartLookingAt = BeatToNoteIndex( fSongBeat );
int iNumElementsToExamine = BeatToStepIndex( fMaxBeatDiff ); // number of elements to examine on either end of iIndexStartLookingAt int iNumElementsToExamine = BeatToNoteIndex( fMaxBeatDiff ); // number of elements to examine on either end of iIndexStartLookingAt
//RageLog( "iIndexStartLookingAt = %d, iNumElementsToExamine = %d", iIndexStartLookingAt, iNumElementsToExamine ); //RageLog( "iIndexStartLookingAt = %d, iNumElementsToExamine = %d", iIndexStartLookingAt, iNumElementsToExamine );
@@ -356,17 +355,17 @@ void Player::CheckForCompleteStep( float fSongBeat, TapStep player_step, float f
int iCurrentIndexLater = iIndexStartLookingAt + delta; int iCurrentIndexLater = iIndexStartLookingAt + delta;
// silly check to make sure we don't go out of bounds // silly check to make sure we don't go out of bounds
iCurrentIndexEarlier = clamp( iCurrentIndexEarlier, 0, MAX_TAP_STEP_ELEMENTS-1 ); iCurrentIndexEarlier = clamp( iCurrentIndexEarlier, 0, MAX_TAP_NOTE_ELEMENTS-1 );
iCurrentIndexLater = clamp( iCurrentIndexLater, 0, MAX_TAP_STEP_ELEMENTS-1 ); iCurrentIndexLater = clamp( iCurrentIndexLater, 0, MAX_TAP_NOTE_ELEMENTS-1 );
//////////////////////////// ////////////////////////////
// check the step to the left of iIndexStartLookingAt // check the step to the left of iIndexStartLookingAt
//////////////////////////// ////////////////////////////
//RageLog( "Checking steps[%d]", iCurrentIndexEarlier ); //RageLog( "Checking Pattern[%d]", iCurrentIndexEarlier );
if( m_TapStepsRemaining[iCurrentIndexEarlier] & player_step ) // these steps overlap if( m_TapNotesRemaining[iCurrentIndexEarlier] & player_step ) // these Pattern overlap
{ {
m_TapStepsRemaining[iCurrentIndexEarlier] &= ~player_step; // subtract player_step m_TapNotesRemaining[iCurrentIndexEarlier] &= ~player_step; // subtract player_step
if( m_TapStepsRemaining[iCurrentIndexEarlier] == 0 ) { // did this complete the step? if( m_TapNotesRemaining[iCurrentIndexEarlier] == 0 ) { // did this complete the step?
OnCompleteStep( fSongBeat, player_step, fMaxBeatDiff, iCurrentIndexEarlier ); OnCompleteStep( fSongBeat, player_step, fMaxBeatDiff, iCurrentIndexEarlier );
return; return;
} }
@@ -375,11 +374,11 @@ void Player::CheckForCompleteStep( float fSongBeat, TapStep player_step, float f
//////////////////////////// ////////////////////////////
// check the step to the right of iIndexStartLookingAt // check the step to the right of iIndexStartLookingAt
//////////////////////////// ////////////////////////////
//RageLog( "Checking steps[%d]", iCurrentIndexLater ); //RageLog( "Checking Pattern[%d]", iCurrentIndexLater );
if( m_TapStepsRemaining[iCurrentIndexLater] & player_step ) // these steps overlap if( m_TapNotesRemaining[iCurrentIndexLater] & player_step ) // these Pattern overlap
{ {
m_TapStepsRemaining[iCurrentIndexLater] &= ~player_step; // subtract player_step m_TapNotesRemaining[iCurrentIndexLater] &= ~player_step; // subtract player_step
if( m_TapStepsRemaining[iCurrentIndexLater] == 0 ) { // did this complete the step? if( m_TapNotesRemaining[iCurrentIndexLater] == 0 ) { // did this complete the step?
OnCompleteStep( fSongBeat, player_step, fMaxBeatDiff, iCurrentIndexLater ); OnCompleteStep( fSongBeat, player_step, fMaxBeatDiff, iCurrentIndexLater );
return; return;
} }
@@ -387,9 +386,9 @@ void Player::CheckForCompleteStep( float fSongBeat, TapStep player_step, float f
} }
} }
void Player::OnCompleteStep( float fSongBeat, TapStep player_step, float fMaxBeatDiff, int iIndexThatWasSteppedOn ) void Player::OnCompleteStep( float fSongBeat, TapNote player_step, float fMaxBeatDiff, int iIndexThatWasSteppedOn )
{ {
float fStepBeat = StepIndexToBeat( (float)iIndexThatWasSteppedOn ); float fStepBeat = NoteIndexToBeat( (float)iIndexThatWasSteppedOn );
float fBeatsUntilStep = fStepBeat - fSongBeat; float fBeatsUntilStep = fStepBeat - fSongBeat;
@@ -399,12 +398,12 @@ void Player::OnCompleteStep( float fSongBeat, TapStep player_step, float fMaxBea
// fBeatsUntilStep, fPercentFromPerfect ); // fBeatsUntilStep, fPercentFromPerfect );
// compute what the score should be for the note we stepped on // compute what the score should be for the note we stepped on
TapStepScore &score = m_TapStepScores[iIndexThatWasSteppedOn]; TapNoteScore &score = m_TapNoteScores[iIndexThatWasSteppedOn];
if( fPercentFromPerfect < 0.25f ) score = TSS_PERFECT; if( fPercentFromPerfect < 0.25f ) score = TNS_PERFECT;
else if( fPercentFromPerfect < 0.50f ) score = TSS_GREAT; else if( fPercentFromPerfect < 0.50f ) score = TNS_GREAT;
else if( fPercentFromPerfect < 0.75f ) score = TSS_GOOD; else if( fPercentFromPerfect < 0.75f ) score = TNS_GOOD;
else score = TSS_BOO; else score = TNS_BOO;
// update the judgement, score, and life // update the judgement, score, and life
m_Judgement.SetJudgement( score ); m_Judgement.SetJudgement( score );
@@ -413,24 +412,24 @@ void Player::OnCompleteStep( float fSongBeat, TapStep player_step, float fMaxBea
// remove this row from the ColorArrowField // remove this row from the ColorArrowField
m_ColorArrowField.RemoveTapStepRow( iIndexThatWasSteppedOn ); m_ColorArrowField.RemoveTapNoteRow( iIndexThatWasSteppedOn );
// check to see if this completes a row of notes // check to see if this completes a row of notes
for( int c=0; c<m_Style.m_iNumColumns; c++ ) // for each column for( int c=0; c<m_Style.m_iNumColumns; c++ ) // for each column
{ {
if( m_TapStepsOriginal[iIndexThatWasSteppedOn] & m_Style.m_ColumnToTapStep[c] ) // if this colum was part of the original step if( m_TapNotesOriginal[iIndexThatWasSteppedOn] & m_Style.m_ColumnToTapNote[c] ) // if this colum was part of the original step
m_GhostArrows.TapStep( c, score, m_Combo.GetCurrentCombo()>100 ); // show the ghost arrow for this column m_GhostArrows.TapNote( c, score, m_Combo.GetCurrentCombo()>100 ); // show the ghost arrow for this column
} }
// update the combo display // update the combo display
switch( score ) switch( score )
{ {
case TSS_PERFECT: case TNS_PERFECT:
case TSS_GREAT: case TNS_GREAT:
m_Combo.ContinueCombo(); m_Combo.ContinueCombo();
break; break;
case TSS_GOOD: case TNS_GOOD:
case TSS_BOO: case TNS_BOO:
m_Combo.EndCombo(); m_Combo.EndCombo();
break; break;
} }
@@ -441,36 +440,36 @@ ScoreSummary Player::GetScoreSummary()
{ {
ScoreSummary scoreSummary; ScoreSummary scoreSummary;
for( int i=0; i<MAX_TAP_STEP_ELEMENTS; i++ ) for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ )
{ {
switch( m_TapStepScores[i] ) switch( m_TapNoteScores[i] )
{ {
case TSS_PERFECT: scoreSummary.perfect++; break; case TNS_PERFECT: scoreSummary.perfect++; break;
case TSS_GREAT: scoreSummary.great++; break; case TNS_GREAT: scoreSummary.great++; break;
case TSS_GOOD: scoreSummary.good++; break; case TNS_GOOD: scoreSummary.good++; break;
case TSS_BOO: scoreSummary.boo++; break; case TNS_BOO: scoreSummary.boo++; break;
case TSS_MISS: scoreSummary.miss++; break; case TNS_MISS: scoreSummary.miss++; break;
case TSS_NONE: break; case TNS_NONE: break;
default: ASSERT( false ); default: ASSERT( false );
} }
} }
for( i=0; i<m_iNumHoldSteps; i++ ) for( i=0; i<m_iNumHoldNotes; i++ )
{ {
switch( m_HoldStepScores[i].m_TapStepScore ) switch( m_HoldNoteScores[i].m_TapNoteScore )
{ {
case TSS_PERFECT: scoreSummary.perfect++; break; case TNS_PERFECT: scoreSummary.perfect++; break;
case TSS_GREAT: scoreSummary.great++; break; case TNS_GREAT: scoreSummary.great++; break;
case TSS_GOOD: scoreSummary.good++; break; case TNS_GOOD: scoreSummary.good++; break;
case TSS_BOO: scoreSummary.boo++; break; case TNS_BOO: scoreSummary.boo++; break;
case TSS_MISS: scoreSummary.miss++; break; case TNS_MISS: scoreSummary.miss++; break;
case TSS_NONE: break; case TNS_NONE: break;
default: ASSERT( false ); default: ASSERT( false );
} }
switch( m_HoldStepScores[i].m_Result ) switch( m_HoldNoteScores[i].m_Result )
{ {
case HSR_NG: scoreSummary.ng++; break; case HNR_NG: scoreSummary.ng++; break;
case HSR_OK: scoreSummary.ok++; break; case HNR_OK: scoreSummary.ok++; break;
case HSR_NONE: break; case HNR_NONE: break;
default: ASSERT( false ); default: ASSERT( false );
} }
} }
@@ -483,9 +482,9 @@ ScoreSummary Player::GetScoreSummary()
int Player::UpdateStepsMissedOlderThan( float fMissIfOlderThanThisBeat ) int Player::UpdateStepsMissedOlderThan( float fMissIfOlderThanThisBeat )
{ {
//RageLog( "Steps::UpdateStepsMissedOlderThan(%f)", fMissIfOlderThanThisBeat ); //RageLog( "Pattern::UpdateStepsMissedOlderThan(%f)", fMissIfOlderThanThisBeat );
int iMissIfOlderThanThisIndex = BeatToStepIndex( fMissIfOlderThanThisBeat ); int iMissIfOlderThanThisIndex = BeatToNoteIndex( fMissIfOlderThanThisBeat );
int iNumMissesFound = 0; int iNumMissesFound = 0;
// Since this is being called frame, let's not check the whole array every time. // Since this is being called frame, let's not check the whole array every time.
@@ -496,11 +495,11 @@ int Player::UpdateStepsMissedOlderThan( float fMissIfOlderThanThisBeat )
for( int i=iStartCheckingAt; i<iMissIfOlderThanThisIndex; i++ ) for( int i=iStartCheckingAt; i<iMissIfOlderThanThisIndex; i++ )
{ {
//RageLog( "Checking for miss: %d: lefttostepon == %d, score == %d", i, m_LeftToStepOn[i], m_StepScore[i] ); //RageLog( "Checking for miss: %d: lefttostepon == %d, score == %d", i, m_LeftToStepOn[i], m_StepScore[i] );
if( m_TapStepsRemaining[i] != 0 && m_TapStepScores[i] != TSS_MISS ) if( m_TapNotesRemaining[i] != 0 && m_TapNoteScores[i] != TNS_MISS )
{ {
m_TapStepScores[i] = TSS_MISS; m_TapNoteScores[i] = TNS_MISS;
iNumMissesFound++; iNumMissesFound++;
m_LifeMeter.ChangeLife( TSS_MISS ); m_LifeMeter.ChangeLife( TNS_MISS );
} }
} }
+12 -12
View File
@@ -13,7 +13,7 @@
#define _PLAYER_H_ #define _PLAYER_H_
#include "PrefsManager.h" // for ScoreSummary #include "PrefsManager.h" // for ScoreSummary
#include "Steps.h" #include "Pattern.h"
#include "Sprite.h" #include "Sprite.h"
#include "BitmapText.h" #include "BitmapText.h"
@@ -45,9 +45,9 @@ public:
void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference ); void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference );
void RenderPrimitives(); void RenderPrimitives();
void Load( const Style& style, PlayerNumber player_no, const Steps& steps, const PlayerOptions& po ); void Load( const StyleDef& StyleDef, PlayerNumber player_no, const Pattern& pattern, const PlayerOptions& po );
void CrossedIndex( int iIndex ); void CrossedIndex( int iIndex );
void HandlePlayerStep( float fSongBeat, TapStep step, float fMaxBeatDiff ); void HandlePlayerStep( float fSongBeat, TapNote step, float fMaxBeatDiff );
int UpdateStepsMissedOlderThan( float fMissIfOlderThanThisBeat ); int UpdateStepsMissedOlderThan( float fMissIfOlderThanThisBeat );
ScoreSummary GetScoreSummary(); ScoreSummary GetScoreSummary();
@@ -56,20 +56,20 @@ public:
bool IsThereANoteAtIndex( int iIndex ); bool IsThereANoteAtIndex( int iIndex );
protected: protected:
void CheckForCompleteStep( float fSongBeat, TapStep step, float fMaxBeatDiff ); void CheckForCompleteStep( float fSongBeat, TapNote step, float fMaxBeatDiff );
void OnCompleteStep( float fSongBeat, TapStep step, float fMaxBeatDiff, int iStepIndex ); void OnCompleteStep( float fSongBeat, TapNote step, float fMaxBeatDiff, int iStepIndex );
float m_fSongBeat; float m_fSongBeat;
Style m_Style; StyleDef m_Style;
PlayerNumber m_PlayerNumber; PlayerNumber m_PlayerNumber;
PlayerOptions m_PlayerOptions; PlayerOptions m_PlayerOptions;
TapStep m_TapStepsOriginal[MAX_TAP_STEP_ELEMENTS]; // the original steps that were loaded into player TapNote m_TapNotesOriginal[MAX_TAP_NOTE_ELEMENTS]; // the original Pattern that were loaded into player
TapStep m_TapStepsRemaining[MAX_TAP_STEP_ELEMENTS]; // mask off the bits as the player steps TapNote m_TapNotesRemaining[MAX_TAP_NOTE_ELEMENTS]; // mask off the bits as the player Pattern
TapStepScore m_TapStepScores[MAX_TAP_STEP_ELEMENTS]; TapNoteScore m_TapNoteScores[MAX_TAP_NOTE_ELEMENTS];
HoldStep m_HoldSteps[MAX_HOLD_STEP_ELEMENTS]; HoldNote m_HoldNotes[MAX_HOLD_NOTE_ELEMENTS];
HoldStepScore m_HoldStepScores[MAX_HOLD_STEP_ELEMENTS]; HoldNoteScore m_HoldNoteScores[MAX_HOLD_NOTE_ELEMENTS];
int m_iNumHoldSteps; int m_iNumHoldNotes;
GrayArrows m_GrayArrows; GrayArrows m_GrayArrows;
+51 -52
View File
@@ -12,6 +12,7 @@
#include "PrefsManager.h" #include "PrefsManager.h"
#include "IniFile.h" #include "IniFile.h"
#include "GameManager.h"
PrefsManager* PREFS = NULL; // global and accessable from anywhere in our program PrefsManager* PREFS = NULL; // global and accessable from anywhere in our program
@@ -21,10 +22,8 @@ PrefsManager* PREFS = NULL; // global and accessable from anywhere in our progra
PrefsManager::PrefsManager() PrefsManager::PrefsManager()
{ {
m_GameMode = MODE_SINGLE;
m_SongSortOrder = SORT_GROUP; m_SongSortOrder = SORT_GROUP;
m_iCurrentStage = 1; m_iCurrentStage = 1;
m_ThemeName = "default";
ReadPrefsFromDisk(); ReadPrefsFromDisk();
SetHardCodedButtons(); SetHardCodedButtons();
@@ -275,27 +274,27 @@ bool PrefsManager::PadToDevice( PadInput pi, int iSoltNum, DeviceInput& di ) //
void PrefsManager::PadToPlayer( PadInput PadI, PlayerInput &PlayerI ) void PrefsManager::PadToPlayer( PadInput PadI, PlayerInput &PlayerI )
{ {
PlayerI.player_no = PLAYER_NONE; PlayerI.player_no = PLAYER_NONE;
PlayerI.step = STEP_NONE; PlayerI.note = NOTE_NONE;
switch( m_GameMode ) switch( GAME->m_DanceStyle )
{ {
case MODE_SINGLE: case STYLE_SINGLE:
case MODE_SOLO: case STYLE_SOLO:
if( PadI.pad_no == PAD_1 ) if( PadI.pad_no == PAD_1 )
PlayerI.player_no = PLAYER_1; PlayerI.player_no = PLAYER_1;
else else
PlayerI.player_no = PLAYER_NONE; PlayerI.player_no = PLAYER_NONE;
if ( PadI.button == BUTTON_LEFT ) PlayerI.step |= STEP_PAD1_LEFT; if ( PadI.button == BUTTON_LEFT ) PlayerI.note |= NOTE_PAD1_LEFT;
if ( PadI.button == BUTTON_UPLEFT ) PlayerI.step |= STEP_PAD1_UPLEFT; if ( PadI.button == BUTTON_UPLEFT ) PlayerI.note |= NOTE_PAD1_UPLEFT;
if ( PadI.button == BUTTON_DOWN ) PlayerI.step |= STEP_PAD1_DOWN; if ( PadI.button == BUTTON_DOWN ) PlayerI.note |= NOTE_PAD1_DOWN;
if ( PadI.button == BUTTON_UP ) PlayerI.step |= STEP_PAD1_UP; if ( PadI.button == BUTTON_UP ) PlayerI.note |= NOTE_PAD1_UP;
if ( PadI.button == BUTTON_UPRIGHT ) PlayerI.step |= STEP_PAD1_UPRIGHT; if ( PadI.button == BUTTON_UPRIGHT ) PlayerI.note |= NOTE_PAD1_UPRIGHT;
if ( PadI.button == BUTTON_RIGHT ) PlayerI.step |= STEP_PAD1_RIGHT; if ( PadI.button == BUTTON_RIGHT ) PlayerI.note |= NOTE_PAD1_RIGHT;
break; break;
case MODE_VERSUS: case STYLE_VERSUS:
case MODE_COUPLE: case STYLE_COUPLE:
if( PadI.pad_no == PAD_1 ) if( PadI.pad_no == PAD_1 )
PlayerI.player_no = PLAYER_1; PlayerI.player_no = PLAYER_1;
else if( PadI.pad_no == PAD_2 ) else if( PadI.pad_no == PAD_2 )
@@ -303,31 +302,31 @@ void PrefsManager::PadToPlayer( PadInput PadI, PlayerInput &PlayerI )
else else
PlayerI.player_no = PLAYER_NONE; PlayerI.player_no = PLAYER_NONE;
if ( PadI.button == BUTTON_LEFT ) PlayerI.step |= STEP_PAD1_LEFT; if ( PadI.button == BUTTON_LEFT ) PlayerI.note |= NOTE_PAD1_LEFT;
if ( PadI.button == BUTTON_UPLEFT ) PlayerI.step |= STEP_PAD1_UPLEFT; if ( PadI.button == BUTTON_UPLEFT ) PlayerI.note |= NOTE_PAD1_UPLEFT;
if ( PadI.button == BUTTON_DOWN ) PlayerI.step |= STEP_PAD1_DOWN; if ( PadI.button == BUTTON_DOWN ) PlayerI.note |= NOTE_PAD1_DOWN;
if ( PadI.button == BUTTON_UP ) PlayerI.step |= STEP_PAD1_UP; if ( PadI.button == BUTTON_UP ) PlayerI.note |= NOTE_PAD1_UP;
if ( PadI.button == BUTTON_UPRIGHT ) PlayerI.step |= STEP_PAD1_UPRIGHT; if ( PadI.button == BUTTON_UPRIGHT ) PlayerI.note |= NOTE_PAD1_UPRIGHT;
if ( PadI.button == BUTTON_RIGHT ) PlayerI.step |= STEP_PAD1_RIGHT; if ( PadI.button == BUTTON_RIGHT ) PlayerI.note |= NOTE_PAD1_RIGHT;
break; break;
case MODE_DOUBLE: case STYLE_DOUBLE:
switch( PadI.pad_no ) switch( PadI.pad_no )
{ {
case PAD_1: case PAD_1:
PlayerI.player_no = PLAYER_1; PlayerI.player_no = PLAYER_1;
if ( PadI.button == BUTTON_LEFT ) PlayerI.step |= STEP_PAD1_LEFT; if ( PadI.button == BUTTON_LEFT ) PlayerI.note |= NOTE_PAD1_LEFT;
if ( PadI.button == BUTTON_DOWN ) PlayerI.step |= STEP_PAD1_DOWN; if ( PadI.button == BUTTON_DOWN ) PlayerI.note |= NOTE_PAD1_DOWN;
if ( PadI.button == BUTTON_UP ) PlayerI.step |= STEP_PAD1_UP; if ( PadI.button == BUTTON_UP ) PlayerI.note |= NOTE_PAD1_UP;
if ( PadI.button == BUTTON_RIGHT ) PlayerI.step |= STEP_PAD1_RIGHT; if ( PadI.button == BUTTON_RIGHT ) PlayerI.note |= NOTE_PAD1_RIGHT;
break; break;
case PAD_2: case PAD_2:
PlayerI.player_no = PLAYER_1; PlayerI.player_no = PLAYER_1;
if ( PadI.button == BUTTON_LEFT ) PlayerI.step |= STEP_PAD2_LEFT; if ( PadI.button == BUTTON_LEFT ) PlayerI.note |= NOTE_PAD2_LEFT;
if ( PadI.button == BUTTON_DOWN ) PlayerI.step |= STEP_PAD2_DOWN; if ( PadI.button == BUTTON_DOWN ) PlayerI.note |= NOTE_PAD2_DOWN;
if ( PadI.button == BUTTON_UP ) PlayerI.step |= STEP_PAD2_UP; if ( PadI.button == BUTTON_UP ) PlayerI.note |= NOTE_PAD2_UP;
if ( PadI.button == BUTTON_RIGHT ) PlayerI.step |= STEP_PAD2_RIGHT; if ( PadI.button == BUTTON_RIGHT ) PlayerI.note |= NOTE_PAD2_RIGHT;
break; break;
case PAD_NONE: case PAD_NONE:
PlayerI.player_no = PLAYER_NONE; PlayerI.player_no = PLAYER_NONE;
@@ -336,7 +335,7 @@ void PrefsManager::PadToPlayer( PadInput PadI, PlayerInput &PlayerI )
break; break;
default: default:
ASSERT( false ); // invalid GameMode ASSERT( false ); // invalid DanceStyle
} }
} }
@@ -345,38 +344,38 @@ void PrefsManager::PlayerToPad( PlayerInput PlayerI, PadInput &PadI )
PadI.pad_no = PAD_NONE; PadI.pad_no = PAD_NONE;
PadI.button = BUTTON_NONE; PadI.button = BUTTON_NONE;
switch( m_GameMode ) switch( GAME->m_DanceStyle )
{ {
case MODE_SINGLE: case STYLE_SINGLE:
case MODE_SOLO: case STYLE_SOLO:
case MODE_VERSUS: case STYLE_VERSUS:
case MODE_COUPLE: case STYLE_COUPLE:
PadI.pad_no = (PadNumber)PlayerI.player_no; PadI.pad_no = (PadNumber)PlayerI.player_no;
if ( PlayerI.step == STEP_PAD1_LEFT ) PadI.button = BUTTON_LEFT; if ( PlayerI.note == NOTE_PAD1_LEFT ) PadI.button = BUTTON_LEFT;
if ( PlayerI.step == STEP_PAD1_UPLEFT ) PadI.button = BUTTON_UPLEFT; if ( PlayerI.note == NOTE_PAD1_UPLEFT ) PadI.button = BUTTON_UPLEFT;
if ( PlayerI.step == STEP_PAD1_DOWN ) PadI.button = BUTTON_DOWN; if ( PlayerI.note == NOTE_PAD1_DOWN ) PadI.button = BUTTON_DOWN;
if ( PlayerI.step == STEP_PAD1_UP ) PadI.button = BUTTON_UP; if ( PlayerI.note == NOTE_PAD1_UP ) PadI.button = BUTTON_UP;
if ( PlayerI.step == STEP_PAD1_UPRIGHT ) PadI.button = BUTTON_UPRIGHT; if ( PlayerI.note == NOTE_PAD1_UPRIGHT ) PadI.button = BUTTON_UPRIGHT;
if ( PlayerI.step == STEP_PAD1_RIGHT ) PadI.button = BUTTON_RIGHT; if ( PlayerI.note == NOTE_PAD1_RIGHT ) PadI.button = BUTTON_RIGHT;
break; break;
case MODE_DOUBLE: case STYLE_DOUBLE:
switch( PlayerI.step ) switch( PlayerI.note )
{ {
case STEP_PAD1_LEFT: PadI.pad_no = PAD_1; PadI.button = BUTTON_LEFT; break; case NOTE_PAD1_LEFT: PadI.pad_no = PAD_1; PadI.button = BUTTON_LEFT; break;
case STEP_PAD1_DOWN: PadI.pad_no = PAD_1; PadI.button = BUTTON_DOWN; break; case NOTE_PAD1_DOWN: PadI.pad_no = PAD_1; PadI.button = BUTTON_DOWN; break;
case STEP_PAD1_UP: PadI.pad_no = PAD_1; PadI.button = BUTTON_UP; break; case NOTE_PAD1_UP: PadI.pad_no = PAD_1; PadI.button = BUTTON_UP; break;
case STEP_PAD1_RIGHT: PadI.pad_no = PAD_1; PadI.button = BUTTON_RIGHT; break; case NOTE_PAD1_RIGHT: PadI.pad_no = PAD_1; PadI.button = BUTTON_RIGHT; break;
case STEP_PAD2_LEFT: PadI.pad_no = PAD_2; PadI.button = BUTTON_LEFT; break; case NOTE_PAD2_LEFT: PadI.pad_no = PAD_2; PadI.button = BUTTON_LEFT; break;
case STEP_PAD2_DOWN: PadI.pad_no = PAD_2; PadI.button = BUTTON_DOWN; break; case NOTE_PAD2_DOWN: PadI.pad_no = PAD_2; PadI.button = BUTTON_DOWN; break;
case STEP_PAD2_UP: PadI.pad_no = PAD_2; PadI.button = BUTTON_UP; break; case NOTE_PAD2_UP: PadI.pad_no = PAD_2; PadI.button = BUTTON_UP; break;
case STEP_PAD2_RIGHT: PadI.pad_no = PAD_2; PadI.button = BUTTON_RIGHT; break; case NOTE_PAD2_RIGHT: PadI.pad_no = PAD_2; PadI.button = BUTTON_RIGHT; break;
} }
break; break;
default: default:
ASSERT( false ); // invalid GameMode ASSERT( false ); // invalid DanceStyle
} }
} }
+9 -39
View File
@@ -2,8 +2,11 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: PrefsManager Class: PrefsManager
Desc: Manages input mapping, saves preferences, and holds data that is passed Desc: Manages all other game data that isn't handled about SongManager,
between Windows. GameManager, or ThemeManager. Some of this data is saved between sessions,
for example, input mapping settings and GameOptions. This class also has
temporary holders for information that passed between windows - e.g.
ScoreSummary.
Copyright (c) 2001-2002 by the names listed below. All rights reserved. Copyright (c) 2001-2002 by the names listed below. All rights reserved.
Chris Danford Chris Danford
@@ -32,44 +35,16 @@ public:
PrefsManager(); PrefsManager();
~PrefsManager(); ~PrefsManager();
GameMode m_GameMode; 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
ScoreSummary scoreSummaryPlayer[NUM_PLAYERS]; int m_iCurrentStage; // number of stages played +1
SongSortOrder m_SongSortOrder;
int m_iCurrentStage;
GameOptions m_GameOptions; GameOptions m_GameOptions;
PlayerOptions m_PlayerOptions[NUM_PLAYERS]; PlayerOptions m_PlayerOptions[NUM_PLAYERS];
SongOptions m_SongOptions; SongOptions m_SongOptions;
bool IsPlayerEnabled( PlayerNumber PlayerNo )
{
switch( m_GameMode )
{
case MODE_VERSUS:
case MODE_COUPLE:
if( PlayerNo == PLAYER_1 )
return true;
if( PlayerNo == PLAYER_2 )
return true;
break;
case MODE_SINGLE:
case MODE_SOLO:
case MODE_DOUBLE:
if( PlayerNo == PLAYER_1 )
return true;
if( PlayerNo == PLAYER_2 )
return false;
break;
default:
ASSERT( false ); // invalid game mode
}
return false;
};
// prefs file stuff // read and write to disk
void ReadPrefsFromDisk(); void ReadPrefsFromDisk();
void SavePrefsToDisk(); void SavePrefsToDisk();
@@ -91,11 +66,6 @@ public:
bool IsButtonDown( PadInput pi ); bool IsButtonDown( PadInput pi );
bool IsButtonDown( PlayerInput PlayerI ); bool IsButtonDown( PlayerInput PlayerI );
// theme stuff
CString m_ThemeName;
protected: protected:
+50 -8
View File
@@ -93,12 +93,12 @@ void ScoreDisplayRolling::Draw()
void ScoreDisplayRolling::AddToScore( TapStepScore stepscore, int iCurCombo ) void ScoreDisplayRolling::AddToScore( TapNoteScore score, int iCurCombo )
{ {
// The scoring system for DDR versions 1 and 2 (including the Plus remixes) is as follows: // The scoring system for DDR versions 1 and 2 (including the Plus remixes) is as follows:
// For every step: // For every step:
// //
// Multiplier (M) = (# of steps in your current combo / 4) rounded down // Multiplier (M) = (# of Pattern in your current combo / 4) rounded down
// "Good" step = M * 100 (and this ends your combo) // "Good" step = M * 100 (and this ends your combo)
// "Great" step = M * M * 100 // "Great" step = M * M * 100
// "Perfect" step = M * M * 300 // "Perfect" step = M * M * 300
@@ -117,17 +117,59 @@ void ScoreDisplayRolling::AddToScore( TapStepScore stepscore, int iCurCombo )
float M = iCurCombo/4.0f; float M = iCurCombo/4.0f;
float fScoreToAdd = 0; float fScoreToAdd = 0;
switch( stepscore ) switch( score )
{ {
case TSS_MISS: break; case TNS_MISS: break;
case TSS_BOO: break; case TNS_BOO: break;
case TSS_GOOD: fScoreToAdd = M * 100 + 100; break; case TNS_GOOD: fScoreToAdd = M * 100 + 100; break;
case TSS_GREAT: fScoreToAdd = M * M * 100 + 300; break; case TNS_GREAT: fScoreToAdd = M * M * 100 + 300; break;
case TSS_PERFECT: fScoreToAdd = M * M * 300 + 500; break; case TNS_PERFECT: fScoreToAdd = M * M * 300 + 500; break;
} }
m_fScore += fScoreToAdd; m_fScore += fScoreToAdd;
ASSERT( m_fScore >= 0 ); ASSERT( m_fScore >= 0 );
/* Score implementation by Chris Gomez, February 6th, 2002 The
scoring system for 5th mix is much more complicated than the original
scoring system. We don't have bonuses yet, so they're not included in
this code. Max score is (feet + 1) * 5,000,000. Scores are clamped
to integers; this is fixed on the last step (if it's perfect)
The base step value is the max score divided by 10, divided by
one-half of the max combo squared plus the max combo. This value is
multiplied by 10 for a perfect or 5 for a great, and further
multiplied by the number of Pattern currently in the combo. */
/*
int iScoreToAdd = 0; int iBonus = 0;
Pattern *pSteps = GAMEINFO->m_pStepsPlayer[m_PlayerNumber];
int iNumFeet = pSteps->m_iNumFeet;
int iMaxCombo = pSteps->GetNumSteps();
int iScoreMax = (iNumFeet + 1) * 5000000; //magic numbers. int
iBaseScore = (iScoreMax / 10) / ((iMaxCombo * (iMaxCombo + 1)) / 2);
iCurCombo++; // looks like the current combo counter starts at 0 when
iCurCombo++it should start at 1
// this was messing with the scoring, so it had to be fixed.
switch (score)
{
case miss:
case boo:
case good:
break;
case great:
iScoreToAdd = 5 * iBaseScore * iCurCombo;
break;
case perfect:
iScoreToAdd = 10 * iBaseScore * iCurCombo;
if(BeatToStepIndex(pSteps->GetLastBeat()) == iMaxCombo)
for(int i = 1; i <= iMaxCombo; i++)
iBonus += 10 * iBaseScore * i;
iScoreToAdd += iBonus;
break;
}
*/
this->SetScore( m_fScore ); this->SetScore( m_fScore );
} }
+1 -1
View File
@@ -29,7 +29,7 @@ public:
void SetScore( float fNewScore ); void SetScore( float fNewScore );
float GetScore(); float GetScore();
void AddToScore( TapStepScore stepscore, int iCurCombo ); void AddToScore( TapNoteScore score, int iCurCombo );
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void Draw(); virtual void Draw();
+34 -33
View File
@@ -11,7 +11,7 @@
#include "Util.h" #include "Util.h"
#include "Steps.h" #include "Pattern.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "Song.h" #include "Song.h"
@@ -224,12 +224,12 @@ bool Song::LoadSongInfoFromBMSDir( CString sDir )
// is identical for every BMS file in the directory. // is identical for every BMS file in the directory.
m_sSongFilePath = m_sSongDir + arrayBMSFileNames[0]; m_sSongFilePath = m_sSongDir + arrayBMSFileNames[0];
// load the Steps from the rest of the BMS files // load the Pattern from the rest of the BMS files
for( int i=0; i<arrayBMSFileNames.GetSize(); i++ ) for( int i=0; i<arrayBMSFileNames.GetSize(); i++ )
{ {
arraySteps.SetSize( arraySteps.GetSize()+1 ); m_arrayPatterns.SetSize( m_arrayPatterns.GetSize()+1 );
Steps &new_steps = arraySteps[ arraySteps.GetSize()-1 ]; Pattern &new_steps = m_arrayPatterns[ m_arrayPatterns.GetSize()-1 ];
new_steps.LoadStepsFromBMSFile( m_sSongDir + arrayBMSFileNames[i] ); new_steps.LoadFromBMSFile( m_sSongDir + arrayBMSFileNames[i] );
} }
@@ -280,7 +280,7 @@ bool Song::LoadSongInfoFromBMSDir( CString sDir )
else if( -1 != value_name.Find("#title") ) else if( -1 != value_name.Find("#title") )
{ {
m_sTitle = value_data; m_sTitle = value_data;
// strip steps type out of description leaving only song title (looks like 'B4U <BASIC>') // strip Pattern type out of description leaving only song title (looks like 'B4U <BASIC>')
m_sTitle.Replace( "(ANOTHER)", "" ); m_sTitle.Replace( "(ANOTHER)", "" );
m_sTitle.Replace( "(BASIC)", "" ); m_sTitle.Replace( "(BASIC)", "" );
m_sTitle.Replace( "(MANIAC)", "" ); m_sTitle.Replace( "(MANIAC)", "" );
@@ -347,15 +347,15 @@ bool Song::LoadSongInfoFromBMSDir( CString sDir )
{ {
case 01: // background music track case 01: // background music track
float fBeatOffset; float fBeatOffset;
fBeatOffset = StepIndexToBeat( (float)iStepIndex ); fBeatOffset = NoteIndexToBeat( (float)iStepIndex );
float fBPS; float fBPS;
fBPS = m_BPMSegments[0].m_fBPM/60.0f; fBPS = m_BPMSegments[0].m_fBPM/60.0f;
m_fOffsetInSeconds = fBeatOffset / fBPS; m_fOffsetInSeconds = fBeatOffset / fBPS;
//RageLog( "Found offset to be index %d, beat %f", iStepIndex, StepIndexToBeat(iStepIndex) ); //RageLog( "Found offset to be index %d, beat %f", iStepIndex, NoteIndexToBeat(iStepIndex) );
break; break;
case 03: // bpm case 03: // bpm
BPMSegment new_seg; BPMSegment new_seg;
new_seg.m_fStartBeat = StepIndexToBeat( (float)iStepIndex ); new_seg.m_fStartBeat = NoteIndexToBeat( (float)iStepIndex );
new_seg.m_fBPM = (float)arrayNotes[j]; new_seg.m_fBPM = (float)arrayNotes[j];
m_BPMSegments.Add( new_seg ); // add to back for now (we'll sort later) m_BPMSegments.Add( new_seg ); // add to back for now (we'll sort later)
@@ -488,7 +488,7 @@ bool Song::LoadSongInfoFromDWIFile( CString sPath )
CStringArray arrayFreezeValues; CStringArray arrayFreezeValues;
split( arrayFreezeExpressions[f], "=", arrayFreezeValues ); split( arrayFreezeExpressions[f], "=", arrayFreezeValues );
float fIndex = atoi( arrayFreezeValues[0] ) * ELEMENTS_PER_BEAT / 4.0f; float fIndex = atoi( arrayFreezeValues[0] ) * ELEMENTS_PER_BEAT / 4.0f;
float fFreezeBeat = StepIndexToBeat( fIndex ); float fFreezeBeat = NoteIndexToBeat( fIndex );
float fFreezeSeconds = (float)atof( arrayFreezeValues[1] ) / 1000.0f; float fFreezeSeconds = (float)atof( arrayFreezeValues[1] ) / 1000.0f;
FreezeSegment new_seg; FreezeSegment new_seg;
@@ -513,7 +513,7 @@ bool Song::LoadSongInfoFromDWIFile( CString sPath )
CStringArray arrayBPMChangeValues; CStringArray arrayBPMChangeValues;
split( arrayBPMChangeExpressions[b], "=", arrayBPMChangeValues ); split( arrayBPMChangeExpressions[b], "=", arrayBPMChangeValues );
float fIndex = atoi( arrayBPMChangeValues[0] ) * ELEMENTS_PER_BEAT / 4.0f; float fIndex = atoi( arrayBPMChangeValues[0] ) * ELEMENTS_PER_BEAT / 4.0f;
float fBeat = StepIndexToBeat( fIndex ); float fBeat = NoteIndexToBeat( fIndex );
float fNewBPM = (float)atoi( arrayBPMChangeValues[1] ); float fNewBPM = (float)atoi( arrayBPMChangeValues[1] );
BPMSegment new_seg; BPMSegment new_seg;
@@ -528,9 +528,10 @@ bool Song::LoadSongInfoFromDWIFile( CString sPath )
else if( sValueName == "#SINGLE" || sValueName == "#DOUBLE" || sValueName == "#COUPLE" ) else if( sValueName == "#SINGLE" || sValueName == "#DOUBLE" || sValueName == "#COUPLE" )
{ {
arraySteps.SetSize( arraySteps.GetSize()+1 ); m_arrayPatterns.SetSize( m_arrayPatterns.GetSize()+1, 1 );
Steps &new_steps = arraySteps[ arraySteps.GetSize()-1 ]; Pattern &new_pattern = m_arrayPatterns[ m_arrayPatterns.GetSize()-1 ];
new_steps.LoadFromDWIValueTokens( arrayValueTokens ); new_pattern.LoadFromDWIValueTokens( arrayValueTokens );
int ksjfk = 0;
} }
else else
// do nothing. We don't care about this value name // do nothing. We don't care about this value name
@@ -639,26 +640,26 @@ void Song::TidyUpData()
} }
void Song::GetStepsThatMatchGameMode( GameMode gm, CArray<Steps*, Steps*>& arrayAddTo ) void Song::GetPatternsThatMatchStyle( DanceStyle s, CArray<Pattern*, Pattern*>& arrayAddTo )
{ {
for( int i=0; i<arraySteps.GetSize(); i++ ) // for each of the Song's Steps for( int i=0; i<m_arrayPatterns.GetSize(); i++ ) // for each of the Song's Pattern
{ {
Steps* pCurrentSteps = &arraySteps[i]; Pattern* pCurPattern = &m_arrayPatterns[i];
if( gm == pCurrentSteps->m_GameMode // if the current GameModes matches the Steps's GameMode if( s == pCurPattern->m_DanceStyle // if the current GameModes matches the Pattern's GameMode
|| (gm == MODE_VERSUS && pCurrentSteps->m_GameMode == MODE_SINGLE) ) || (s == STYLE_VERSUS && pCurPattern->m_DanceStyle == STYLE_SINGLE) )
{ {
arrayAddTo.Add( pCurrentSteps ); arrayAddTo.Add( pCurPattern );
} }
} }
} }
void Song::GetNumFeet( GameMode gm, int& iDiffEasyOut, int& iDiffMediumOut, int& iDiffHardOut ) void Song::GetNumFeet( DanceStyle s, int& iDiffEasyOut, int& iDiffMediumOut, int& iDiffHardOut )
{ {
iDiffEasyOut = iDiffMediumOut = iDiffHardOut = -1; // -1 means not found iDiffEasyOut = iDiffMediumOut = iDiffHardOut = -1; // -1 means not found
CArray<Steps*, Steps*> arrayMatchingSteps; CArray<Pattern*, Pattern*> arrayMatchingSteps;
GetStepsThatMatchGameMode( gm, arrayMatchingSteps ); GetPatternsThatMatchStyle( s, arrayMatchingSteps );
for( int i=0; i<arrayMatchingSteps.GetSize(); i++ ) for( int i=0; i<arrayMatchingSteps.GetSize(); i++ )
{ {
@@ -666,16 +667,16 @@ void Song::GetNumFeet( GameMode gm, int& iDiffEasyOut, int& iDiffMediumOut, int&
switch( arrayMatchingSteps[i]->m_DifficultyClass ) switch( arrayMatchingSteps[i]->m_DifficultyClass )
{ {
case Steps::CLASS_EASY: case Pattern::CLASS_EASY:
iDiffEasyOut = iNumFeet; iDiffEasyOut = iNumFeet;
break; break;
case Steps::CLASS_MEDIUM: case Pattern::CLASS_MEDIUM:
iDiffMediumOut = iNumFeet; iDiffMediumOut = iNumFeet;
break; break;
case Steps::CLASS_HARD: case Pattern::CLASS_HARD:
iDiffHardOut = iNumFeet; iDiffHardOut = iNumFeet;
break; break;
case Steps::CLASS_OTHER: case Pattern::CLASS_OTHER:
// should do something intelligent to fill in the missing spots... // should do something intelligent to fill in the missing spots...
if( iDiffEasyOut < 0 && iNumFeet <= 4 ) if( iDiffEasyOut < 0 && iNumFeet <= 4 )
iDiffEasyOut = iNumFeet; iDiffEasyOut = iNumFeet;
@@ -697,14 +698,14 @@ void Song::SaveOffsetChangeToDisk()
if( sExt == "bms" ) if( sExt == "bms" )
{ {
for( int i=0; i<arraySteps.GetSize(); i++ ) // for each Steps for( int i=0; i<m_arrayPatterns.GetSize(); i++ ) // for each Pattern
{ {
CString sStepsFileName = arraySteps[i].m_sStepsFilePath; CString sPatternFileName = m_arrayPatterns[i].m_sPatternFilePath;
CStringArray arrayLines; CStringArray arrayLines;
CStdioFile fileIn; CStdioFile fileIn;
if( !fileIn.Open( sStepsFileName, CFile::modeRead|CFile::shareDenyNone) ) if( !fileIn.Open( sPatternFileName, CFile::modeRead|CFile::shareDenyNone) )
RageError( ssprintf("Failed to open '%s' for reading", sStepsFileName) ); RageError( ssprintf("Failed to open '%s' for reading", sPatternFileName) );
// read the file into sFileContents // read the file into sFileContents
CString sLine; CString sLine;
@@ -716,8 +717,8 @@ void Song::SaveOffsetChangeToDisk()
// write the file back to disk with the changes // write the file back to disk with the changes
CStdioFile fileOut; CStdioFile fileOut;
if( !fileOut.Open( sStepsFileName, CFile::modeWrite|CFile::shareDenyWrite) ) if( !fileOut.Open( sPatternFileName, CFile::modeWrite|CFile::shareDenyWrite) )
RageError( ssprintf("Failed to open '%s' for writing", sStepsFileName) ); RageError( ssprintf("Failed to open '%s' for writing", sPatternFileName) );
for( int j=0; j<arrayLines.GetSize(); j++ ) for( int j=0; j<arrayLines.GetSize(); j++ )
{ {
CString sLine = arrayLines[j]; CString sLine = arrayLines[j];
+26 -30
View File
@@ -14,7 +14,7 @@
#include "IniFile.h" #include "IniFile.h"
SongManager* SONGS = NULL; // global and accessable from anywhere in our program SongManager* SONG = NULL; // global and accessable from anywhere in our program
const CString g_sStatisticsFileName = "statistics.ini"; const CString g_sStatisticsFileName = "statistics.ini";
@@ -24,7 +24,7 @@ SongManager::SongManager()
{ {
m_pCurSong = NULL; m_pCurSong = NULL;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
m_pStepsPlayer[p] = NULL; m_pCurPattern[p] = NULL;
InitSongArrayFromDisk(); InitSongArrayFromDisk();
ReadStatisticsFromDisk(); ReadStatisticsFromDisk();
@@ -33,8 +33,8 @@ SongManager::SongManager()
SongManager::~SongManager() SongManager::~SongManager()
{ {
CleanUpSongArray();
SaveStatisticsToDisk(); SaveStatisticsToDisk();
CleanUpSongArray();
} }
@@ -189,7 +189,7 @@ void SongManager::ReadStatisticsFromDisk()
int iRetVal; int iRetVal;
int i; int i;
// Parse for Song name and Steps name // Parse for Song name and Pattern name
iRetVal = sscanf( name_string, "%[^:]::%[^\n]", szSongName, szStepsName ); iRetVal = sscanf( name_string, "%[^:]::%[^\n]", szSongName, szStepsName );
if( iRetVal != 2 ) if( iRetVal != 2 )
continue; // this line doesn't match what is expected continue; // this line doesn't match what is expected
@@ -209,35 +209,35 @@ void SongManager::ReadStatisticsFromDisk()
continue; // skip this entry continue; // skip this entry
// Search for the corresponding Steps pointer. // Search for the corresponding Pattern pointer.
Steps* pSteps = NULL; Pattern* pPattern = NULL;
for( i=0; i<pSong->arraySteps.GetSize(); i++ ) for( i=0; i<pSong->m_arrayPatterns.GetSize(); i++ )
{ {
if( pSong->arraySteps[i].m_sDescription == szStepsName ) // match! if( pSong->m_arrayPatterns[i].m_sDescription == szStepsName ) // match!
{ {
pSteps = &pSong->arraySteps[i]; pPattern = &pSong->m_arrayPatterns[i];
break; break;
} }
} }
if( pSteps == NULL ) // didn't find a match if( pPattern == NULL ) // didn't find a match
continue; // skip this entry continue; // skip this entry
// Parse the Steps statistics. // Parse the Pattern statistics.
char szGradeLetters[10]; // longest possible string is "AAA" char szGradeLetters[10]; // longest possible string is "AAA"
iRetVal = sscanf( iRetVal = sscanf(
value_string, value_string,
"%d::%[^:]::%d::%d", "%d::%[^:]::%d::%d",
&pSteps->m_iNumTimesPlayed, &pPattern->m_iNumTimesPlayed,
szGradeLetters, szGradeLetters,
&pSteps->m_iTopScore, &pPattern->m_iTopScore,
&pSteps->m_iMaxCombo &pPattern->m_iMaxCombo
); );
if( iRetVal != 4 ) if( iRetVal != 4 )
continue; continue;
pSteps->m_TopGrade = StringToGrade( szGradeLetters ); pPattern->m_TopGrade = StringToGrade( szGradeLetters );
} }
} }
} }
@@ -246,32 +246,28 @@ void SongManager::SaveStatisticsToDisk()
{ {
IniFile ini; IniFile ini;
ini.SetPath( g_sStatisticsFileName ); ini.SetPath( g_sStatisticsFileName );
if( !ini.ReadFile() ) {
return; // load nothing
//RageError( "could not read config file" );
}
// save song statistics // save song statistics
for( int i=0; i<m_pSongs.GetSize(); i++ ) // for each Song for( int i=0; i<m_pSongs.GetSize(); i++ ) // for each Song
{ {
Song* pSong = m_pSongs[i]; Song* pSong = m_pSongs[i];
for( int j=0; j<pSong->arraySteps.GetSize(); j++ ) // for each Steps for( int j=0; j<pSong->m_arrayPatterns.GetSize(); j++ ) // for each Pattern
{ {
Steps* pSteps = &pSong->arraySteps[j]; Pattern* pPattern = &pSong->m_arrayPatterns[j];
if( pSteps->m_TopGrade == GRADE_NO_DATA ) if( pPattern->m_TopGrade == GRADE_NO_DATA )
continue; continue; // skip
// Each value has the format "SongName::StepsName=TimesPlayed::TopGrade::TopScore::MaxCombo". // Each value has the format "SongName::PatternName=TimesPlayed::TopGrade::TopScore::MaxCombo".
CString sName = ssprintf( "%s::%s", pSong->GetTitle(), pSteps->m_sDescription ); CString sName = ssprintf( "%s::%s", pSong->GetTitle(), pPattern->m_sDescription );
CString sValue = ssprintf( CString sValue = ssprintf(
"%d::%s::%d::%d", "%d::%s::%d::%d",
pSteps->m_iNumTimesPlayed, pPattern->m_iNumTimesPlayed,
GradeToString( pSteps->m_TopGrade ), GradeToString( pPattern->m_TopGrade ),
pSteps->m_iTopScore, pPattern->m_iTopScore,
pSteps->m_iMaxCombo pPattern->m_iMaxCombo
); );
ini.SetValue( "Statistics", sName, sValue ); ini.SetValue( "Statistics", sName, sValue );
@@ -282,7 +278,7 @@ void SongManager::SaveStatisticsToDisk()
} }
CString SongManager::GetBannerPathFromGroup( CString sGroupName ) CString SongManager::GetGroupBannerPath( CString sGroupName )
{ {
CString sPath; CString sPath;
+7 -6
View File
@@ -2,8 +2,8 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: SongManager Class: SongManager
Desc: Holder for all Songs and Steps. Also keeps track of the current Desc: Holder for all Songs and Pattern. Also keeps track of the current
Song and Steps, and loads/saves statistics. Song and Pattern, and loads/saves statistics.
Copyright (c) 2001-2002 by the names listed below. All rights reserved. Copyright (c) 2001-2002 by the names listed below. All rights reserved.
Chris Danford Chris Danford
@@ -24,9 +24,10 @@ public:
SongManager(); SongManager();
~SongManager(); ~SongManager();
CArray<Song*, Song*> m_pSongs;
Song* m_pCurSong; Song* m_pCurSong;
Steps* m_pStepsPlayer[NUM_PLAYERS]; Pattern* m_pCurPattern[NUM_PLAYERS];
CArray<Song*, Song*> m_pSongs; // all songs that can be played
void InitSongArrayFromDisk(); void InitSongArrayFromDisk();
@@ -38,7 +39,7 @@ public:
void SaveStatisticsToDisk(); void SaveStatisticsToDisk();
CString GetBannerPathFromGroup( CString sGroupName ); CString GetGroupBannerPath( CString sGroupName );
protected: protected:
void LoadStepManiaSongDir( CString sDir ); void LoadStepManiaSongDir( CString sDir );
@@ -48,7 +49,7 @@ protected:
}; };
extern SongManager* SONGS; // global and accessable from anywhere in our program extern SongManager* SONG; // global and accessable from anywhere in our program
#endif #endif
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

+13 -56
View File
@@ -124,71 +124,28 @@ END
// Bitmap // Bitmap
// //
SPLASH BITMAP DISCARDABLE "splash.bmp"
BITMAP_ERROR BITMAP DISCARDABLE "error.bmp" BITMAP_ERROR BITMAP DISCARDABLE "error.bmp"
BITMAP_SPLASH BITMAP DISCARDABLE "splash.bmp"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Dialog // Dialog
// //
IDD_ERROR_DIALOG DIALOGEX 0, 0, 320, 202 IDD_ERROR_DIALOG DIALOG DISCARDABLE 0, 0, 332, 234
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
EXSTYLE WS_EX_APPWINDOW CAPTION "StepMania Error"
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif"
BEGIN BEGIN
CONTROL "",IDC_SHOCKWAVEFLASH1, EDITTEXT IDC_EDIT_ERROR,5,80,320,80,ES_CENTER | ES_MULTILINE |
"{D27CDB6E-AE6D-11CF-96B8-444553540000}",WS_TABSTOP,0,0, ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP
319,201 DEFPUSHBUTTON "Close",IDOK,265,215,60,15
END CONTROL 129,IDC_STATIC,"Static",SS_BITMAP,0,0,258,37
LTEXT "We're sorry. An error has occurred while running StepMania.\r\n\r\nMore specific details about the error may be listeted in the box below:",
IDC_STATIC,7,47,298,28
///////////////////////////////////////////////////////////////////////////// PUSHBUTTON "Restart StepMania",IDC_BUTTON_RESTART,175,215,80,15
// PUSHBUTTON "Report the Error",IDC_BUTTON_REPORT,120,190,80,15
// DESIGNINFO PUSHBUTTON "View Log",IDC_BUTTON_VIEW_LOG,120,170,80,15
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ERROR_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 313
TOPMARGIN, 7
BOTTOMMARGIN, 195
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog Info
//
IDD_ERROR_DIALOG DLGINIT
BEGIN
IDC_SHOCKWAVEFLASH1, 0x376, 308, 0
0x0000, 0x0000, 0x5567, 0x5566, 0x0300, 0x0000, 0x3182, 0x0000, 0x21cc,
0x0000, 0x0008, 0x004a, 0x0000, 0x0066, 0x0069, 0x006c, 0x0065, 0x003a,
0x002f, 0x002f, 0x002f, 0x0064, 0x003a, 0x005c, 0x0064, 0x0065, 0x0076,
0x005c, 0x0066, 0x006c, 0x0061, 0x0073, 0x0068, 0x0020, 0x0074, 0x0065,
0x0073, 0x0074, 0x005c, 0x0066, 0x0069, 0x0067, 0x0068, 0x0074, 0x0033,
0x002e, 0x0073, 0x0077, 0x0066, 0x0000, 0x0008, 0x004a, 0x0000, 0x0066,
0x0069, 0x006c, 0x0065, 0x003a, 0x002f, 0x002f, 0x002f, 0x0064, 0x003a,
0x005c, 0x0064, 0x0065, 0x0076, 0x005c, 0x0066, 0x006c, 0x0061, 0x0073,
0x0068, 0x0020, 0x0074, 0x0065, 0x0073, 0x0074, 0x005c, 0x0066, 0x0069,
0x0067, 0x0068, 0x0074, 0x0033, 0x002e, 0x0073, 0x0077, 0x0066, 0x0000,
0x0008, 0x000e, 0x0000, 0x0057, 0x0069, 0x006e, 0x0064, 0x006f, 0x0077,
0x0000, 0x000b, 0xffff, 0x000b, 0xffff, 0x0008, 0x000a, 0x0000, 0x0048,
0x0069, 0x0067, 0x0068, 0x0000, 0x0008, 0x0002, 0x0000, 0x0000, 0x000b,
0xffff, 0x0008, 0x0002, 0x0000, 0x0000, 0x0008, 0x0010, 0x0000, 0x0053,
0x0068, 0x006f, 0x0077, 0x0041, 0x006c, 0x006c, 0x0000, 0x000b, 0x0000,
0x000b, 0x0000, 0x0008, 0x0002, 0x0000, 0x0000, 0x0008, 0x0002, 0x0000,
0x0000, 0x0008, 0x000c, 0x0000, 0x0062, 0x0065, 0x006c, 0x006f, 0x0077,
0x0000,
0
END END
#endif // English (U.S.) resources #endif // English (U.S.) resources
+23 -11
View File
@@ -24,6 +24,7 @@
#include "SongManager.h" #include "SongManager.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "WindowManager.h" #include "WindowManager.h"
#include "GameManager.h"
#include "WindowSandbox.h" #include "WindowSandbox.h"
#include "WindowLoading.h" #include "WindowLoading.h"
@@ -87,13 +88,16 @@ BOOL SwitchDisplayMode();// BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow ) int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
{ {
AfxEnableControlContainer(); // Initialize ActiveX for Flash
//AfxEnableControlContainer();
#ifndef DEBUG // don't use error handler in Release mode #ifndef DEBUG // don't use error handler in Release mode
try try
{ {
#endif #endif
//
// Check to see if the app is already running. // Check to see if the app is already running.
//
g_hMutex = CreateMutex( NULL, TRUE, g_sAppName ); g_hMutex = CreateMutex( NULL, TRUE, g_sAppName );
if( GetLastError() == ERROR_ALREADY_EXISTS ) if( GetLastError() == ERROR_ALREADY_EXISTS )
{ {
@@ -101,7 +105,9 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
RageError( "StepMania is already running!" ); RageError( "StepMania is already running!" );
} }
//
// Make sure the current directory is the root program directory // Make sure the current directory is the root program directory
//
if( !DoesFileExist("Songs") ) if( !DoesFileExist("Songs") )
{ {
// change dir to path of the execuctable // change dir to path of the execuctable
@@ -112,10 +118,14 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
LPSTR pLastBackslash = strrchr(szFullAppPath, '\\'); LPSTR pLastBackslash = strrchr(szFullAppPath, '\\');
*pLastBackslash = '\0'; // terminate the string *pLastBackslash = '\0'; // terminate the string
SetCurrentDirectory(szFullAppPath); RageLog( "Changing path to '%s'", szFullAppPath );
SetCurrentDirectory( szFullAppPath );
} }
CoInitialize (NULL); // Initialize COM CoInitialize (NULL); // Initialize COM
// Register the window class // Register the window class
@@ -144,7 +154,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
g_hWndMain = CreateWindow( g_hWndMain = CreateWindow(
g_sAppClassName,// pointer to registered class name g_sAppClassName,// pointer to registered class name
g_sAppName, // pointer to window name g_sAppName, // pointer to window name
g_dwWindowStyle, // window style g_dwWindowStyle, // window StyleDef
CW_USEDEFAULT, // horizontal position of window CW_USEDEFAULT, // horizontal position of window
CW_USEDEFAULT, // vertical position of window CW_USEDEFAULT, // vertical position of window
RECTWIDTH(rcWnd), // window width RECTWIDTH(rcWnd), // window width
@@ -439,12 +449,12 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
HRESULT CreateObjects( HWND hWnd ) HRESULT CreateObjects( HWND hWnd )
{ {
//////////////////////////////// //
// Draw a splash bitmap so the user isn't looking at a black screen // Draw a splash bitmap so the user isn't looking at a black screen
//////////////////////////////// //
HBITMAP hSplashBitmap = (HBITMAP)LoadImage( HBITMAP hSplashBitmap = (HBITMAP)LoadImage(
GetModuleHandle( NULL ), GetModuleHandle( NULL ),
TEXT("SPLASH"), TEXT("BITMAP_SPLASH"),
IMAGE_BITMAP, IMAGE_BITMAP,
0, 0, LR_CREATEDIBSECTION ); 0, 0, LR_CREATEDIBSECTION );
BITMAP bmp; BITMAP bmp;
@@ -467,9 +477,9 @@ HRESULT CreateObjects( HWND hWnd )
///////////////////////////////// //
// Create game objects // Create game objects
///////////////////////////////// //
srand( (unsigned)time(NULL) ); // seed number generator srand( (unsigned)time(NULL) ); // seed number generator
RageLogStart(); RageLogStart();
@@ -477,8 +487,8 @@ HRESULT CreateObjects( HWND hWnd )
MUSIC = new RageSoundStream; MUSIC = new RageSoundStream;
INPUT = new RageInput( hWnd ); INPUT = new RageInput( hWnd );
PREFS = new PrefsManager; PREFS = new PrefsManager;
SONGS = new SongManager;
SCREEN = new RageScreen( hWnd ); SCREEN = new RageScreen( hWnd );
SONG = new SongManager;
BringWindowToTop( hWnd ); BringWindowToTop( hWnd );
SetForegroundWindow( hWnd ); SetForegroundWindow( hWnd );
@@ -489,12 +499,13 @@ HRESULT CreateObjects( HWND hWnd )
TM = new RageTextureManager( SCREEN ); TM = new RageTextureManager( SCREEN );
THEME = new ThemeManager; THEME = new ThemeManager;
WM = new WindowManager; WM = new WindowManager;
GAME = new GameManager;
// Ugly... Switch the screen resolution again so that the system message will display // Ugly... Switch the screen resolution again so that the system message will display
SwitchDisplayMode(); SwitchDisplayMode();
WM->SystemMessage( ssprintf("Found %d songs.", SONGS->m_pSongs.GetSize()) ); WM->SystemMessage( ssprintf("Found %d songs.", SONG->m_pSongs.GetSize()) );
//WM->SetNewWindow( new WindowLoading ); //WM->SetNewWindow( new WindowLoading );
@@ -520,7 +531,8 @@ void DestroyObjects()
SAFE_DELETE( WM ); SAFE_DELETE( WM );
SAFE_DELETE( PREFS ); SAFE_DELETE( PREFS );
SAFE_DELETE( SONGS ); SAFE_DELETE( SONG );
SAFE_DELETE( GAME );
SAFE_DELETE( INPUT ); SAFE_DELETE( INPUT );
SAFE_DELETE( MUSIC ); SAFE_DELETE( MUSIC );
+18 -10
View File
@@ -388,6 +388,14 @@ SOURCE=.\GameConstants.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\GameManager.cpp
# End Source File
# Begin Source File
SOURCE=.\GameManager.h
# End Source File
# Begin Source File
SOURCE=.\GameTypes.h SOURCE=.\GameTypes.h
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -404,6 +412,14 @@ SOURCE=.\PadInput.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\Pattern.cpp
# End Source File
# Begin Source File
SOURCE=.\Pattern.h
# End Source File
# Begin Source File
SOURCE=.\Player.cpp SOURCE=.\Player.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -456,19 +472,11 @@ SOURCE=.\SongManager.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\Steps.cpp SOURCE=.\StyleDef.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\Steps.h SOURCE=.\StyleDef.h
# End Source File
# Begin Source File
SOURCE=.\Style.cpp
# End Source File
# Begin Source File
SOURCE=.\Style.h
# End Source File # End Source File
# Begin Source File # Begin Source File
+14
View File
@@ -0,0 +1,14 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
File: StyleDef.cpp
Desc: A data structure that holds the definition of a GameMode.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "StyleDef.h"
@@ -1,6 +1,6 @@
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: Style.h File: StyleDef.h
Desc: A data structure that holds the definition of a GameMode. Desc: A data structure that holds the definition of a GameMode.
@@ -11,33 +11,32 @@
#ifndef _Style_H_ #ifndef _Style_H_
#define _Style_H_ #define _Style_H_
#include "Steps.h" #include "Pattern.h"
const int MAX_NUM_COLUMNS = 12; const int MAX_NUM_COLUMNS = 12;
struct Style
struct StyleDef
{ {
int m_iNumPlayers; int m_iNumPlayers;
int m_iNumColumns; // will vary depending on the number panels (4,6,8,etc) int m_iNumColumns; // will vary depending on the number panels (4,6,8,etc)
TapStep m_ColumnToTapStep[MAX_NUM_COLUMNS]; TapNote m_ColumnToTapNote[MAX_NUM_COLUMNS];
float m_ColumnToRotation[MAX_NUM_COLUMNS]; float m_ColumnToRotation[MAX_NUM_COLUMNS];
int TapStepToColumnNumber( TapStep tap_step ) inline int TapNoteToColumnNumber( TapNote tap_step )
{ {
for (int i=0; i<m_iNumColumns; i++) for (int i=0; i<m_iNumColumns; i++)
{ {
if( m_ColumnToTapStep[i] == tap_step ) if( m_ColumnToTapNote[i] == tap_step )
return i; return i;
} }
return -1; // the TapStep is not used in this style return -1; // the TapNote is not used in this StyleDef
}; };
}; };
Style GetStyle( GameMode mode );
#endif #endif
+146 -84
View File
@@ -17,6 +17,68 @@
ThemeManager* THEME = NULL; // global object accessable from anywhere in the program ThemeManager* THEME = NULL; // global object accessable from anywhere in the program
ThemeManager::ThemeManager()
{
CStringArray arrayThemeNames;
GetThemeNames( arrayThemeNames );
for( int i=0; i<arrayThemeNames.GetSize(); i++ )
AssertThemeIsComplete( arrayThemeNames[i] );
SetTheme( DEFAULT_THEME_NAME );
}
void ThemeManager::GetThemeNames( CStringArray& AddTo )
{
GetDirListing( "Themes\\*", AddTo, true );
// strip out the folder called "CVS"
for( int i=0; i<AddTo.GetSize(); i++ )
{
if( 0 == stricmp( AddTo[i], "cvs" ) )
{
AddTo.RemoveAt(i);
i--;
}
}
}
bool ThemeManager::SetTheme( CString sThemeName ) // return false if theme doesn't exist
{
sThemeName.MakeLower();
m_sCurThemeName = sThemeName;
CString sThemeDir = ThemeNameToThemeDir( m_sCurThemeName );
if( !DoesFileExist( sThemeDir ) )
{
RageError( ssprintf( "The theme in diretory '%' could not be loaded.", sThemeDir ) );
return false;
}
return true;
}
void ThemeManager::AssertThemeIsComplete( CString sThemeName ) // return false if theme doesn't exist
{
for( int i=0; i<NUM_THEME_ELEMENTS; i++ )
{
if( GetPathTo( (ThemeElement)i, sThemeName ) == "" )
RageError( ssprintf( "The theme element for theme '%s' called '%s' could not be found.", sThemeName, ElementToAssetPath((ThemeElement)i) ) );
}
}
CString ThemeManager::GetPathTo( ThemeElement te )
{
return GetPathTo( te, m_sCurThemeName );
}
CString ThemeManager::ThemeNameToThemeDir( CString sThemeName )
{
return ssprintf( "Themes\\%s\\", sThemeName );
}
CString ThemeManager::ElementToAssetPath( ThemeElement te ) CString ThemeManager::ElementToAssetPath( ThemeElement te )
{ {
CString sAssetPath; // fill this in below CString sAssetPath; // fill this in below
@@ -24,106 +86,106 @@ CString ThemeManager::ElementToAssetPath( ThemeElement te )
switch( te ) switch( te )
{ {
case GRAPHIC_TITLE_MENU_BACKGROUND: sAssetPath = "Graphics\\title menu background"; break; case GRAPHIC_TITLE_MENU_BACKGROUND: sAssetPath = "Graphics\\title menu background"; break;
case GRAPHIC_SELECT_STYLE_BACKGROUND: sAssetPath = "Graphics\\select style background"; break; case GRAPHIC_SELECT_STYLE_BACKGROUND: sAssetPath = "Graphics\\select Style background"; break;
case GRAPHIC_SELECT_MUSIC_BACKGROUND: sAssetPath = "Graphics\\select music background"; break; case GRAPHIC_SELECT_MUSIC_BACKGROUND: sAssetPath = "Graphics\\select music background"; break;
case GRAPHIC_RESULT_BACKGROUND: sAssetPath = "Graphics\\result background"; break; case GRAPHIC_RESULT_BACKGROUND: sAssetPath = "Graphics\\result background"; break;
case GRAPHIC_SELECT_STYLE_TOP_EDGE: sAssetPath = "Graphics\\select style top edge"; break; case GRAPHIC_SELECT_STYLE_TOP_EDGE: sAssetPath = "Graphics\\select Style top edge"; break;
case GRAPHIC_SELECT_MUSIC_TOP_EDGE: sAssetPath = "Graphics\\select music top edge"; break; case GRAPHIC_SELECT_MUSIC_TOP_EDGE: sAssetPath = "Graphics\\select music top edge"; break;
case GRAPHIC_GAME_OPTIONS_TOP_EDGE: sAssetPath = "Graphics\\game options top edge"; break; case GRAPHIC_GAME_OPTIONS_TOP_EDGE: sAssetPath = "Graphics\\game options top edge"; break;
case GRAPHIC_PLAYER_OPTIONS_TOP_EDGE: sAssetPath = "Graphics\\player options top edge"; break; case GRAPHIC_PLAYER_OPTIONS_TOP_EDGE: sAssetPath = "Graphics\\player options top edge"; break;
case GRAPHIC_MUSIC_OPTIONS_TOP_EDGE: sAssetPath = "Graphics\\music options top edge"; break; case GRAPHIC_MUSIC_OPTIONS_TOP_EDGE: sAssetPath = "Graphics\\music options top edge"; break;
case GRAPHIC_RESULT_TOP_EDGE: sAssetPath = "Graphics\\result top edge"; break; case GRAPHIC_RESULT_TOP_EDGE: sAssetPath = "Graphics\\result top edge"; break;
case GRAPHIC_FALLBACK_BANNER: sAssetPath = "Graphics\\Fallback Banner"; break; case GRAPHIC_FALLBACK_BANNER: sAssetPath = "Graphics\\Fallback Banner"; break;
case GRAPHIC_FALLBACK_BACKGROUND: sAssetPath = "Graphics\\Fallback Background"; break; case GRAPHIC_FALLBACK_BACKGROUND: sAssetPath = "Graphics\\Fallback Background"; break;
case GRAPHIC_COLOR_ARROW_GRAY_PART: sAssetPath = "Graphics\\Color Arrow gray part 2x2"; break; case GRAPHIC_COLOR_ARROW_GRAY_PART: sAssetPath = "Graphics\\Color Arrow gray part 2x2"; break;
case GRAPHIC_COLOR_ARROW_COLOR_PART:sAssetPath = "Graphics\\Color Arrow color part"; break; case GRAPHIC_COLOR_ARROW_COLOR_PART: sAssetPath = "Graphics\\Color Arrow color part"; break;
case GRAPHIC_GHOST_ARROW: sAssetPath = "Graphics\\ghost arrow"; break; case GRAPHIC_GHOST_ARROW: sAssetPath = "Graphics\\ghost arrow"; break;
case GRAPHIC_BRIGHT_GHOST_ARROW: sAssetPath = "Graphics\\bright ghost arrow"; break; case GRAPHIC_BRIGHT_GHOST_ARROW: sAssetPath = "Graphics\\bright ghost arrow"; break;
case GRAPHIC_HOLD_GHOST_ARROW: sAssetPath = "Graphics\\hold ghost arrow"; break; case GRAPHIC_HOLD_GHOST_ARROW: sAssetPath = "Graphics\\hold ghost arrow"; break;
case GRAPHIC_GRAY_ARROW: sAssetPath = "Graphics\\gray arrow"; break; case GRAPHIC_GRAY_ARROW: sAssetPath = "Graphics\\gray arrow"; break;
case GRAPHIC_JUDGEMENT: sAssetPath = "Graphics\\judgement 1x9"; break; case GRAPHIC_JUDGEMENT: sAssetPath = "Graphics\\judgement 1x9"; break;
case GRAPHIC_MENU_BOTTOM_EDGE: sAssetPath = "Graphics\\menu bottom edge"; break; case GRAPHIC_MENU_BOTTOM_EDGE: sAssetPath = "Graphics\\menu bottom edge"; break;
case GRAPHIC_SCORE_FRAME: sAssetPath = "Graphics\\score frame"; break; case GRAPHIC_SCORE_FRAME: sAssetPath = "Graphics\\score frame"; break;
case GRAPHIC_LIFEMETER_FRAME: sAssetPath = "Graphics\\Life Meter Frame"; break; case GRAPHIC_LIFEMETER_FRAME: sAssetPath = "Graphics\\Life Meter Frame"; break;
case GRAPHIC_LIFEMETER_PILLS: sAssetPath = "Graphics\\life meter pills 17x1"; break; case GRAPHIC_LIFEMETER_PILLS: sAssetPath = "Graphics\\life meter pills 17x1"; break;
case GRAPHIC_COMBO: sAssetPath = "Graphics\\combo"; break; case GRAPHIC_COMBO: sAssetPath = "Graphics\\combo"; break;
case GRAPHIC_CLOSING_STAR: sAssetPath = "Graphics\\closing star"; break; case GRAPHIC_CLOSING_STAR: sAssetPath = "Graphics\\closing star"; break;
case GRAPHIC_OPENING_STAR: sAssetPath = "Graphics\\opening star"; break; case GRAPHIC_OPENING_STAR: sAssetPath = "Graphics\\opening star"; break;
case GRAPHIC_CAUTION: sAssetPath = "Graphics\\Caution"; break; case GRAPHIC_CAUTION: sAssetPath = "Graphics\\Caution"; break;
case GRAPHIC_READY: sAssetPath = "Graphics\\Ready"; break; case GRAPHIC_READY: sAssetPath = "Graphics\\Ready"; break;
case GRAPHIC_HERE_WE_GO: sAssetPath = "Graphics\\here we go"; break; case GRAPHIC_HERE_WE_GO: sAssetPath = "Graphics\\here we go"; break;
case GRAPHIC_CLEARED: sAssetPath = "Graphics\\cleared"; break; case GRAPHIC_CLEARED: sAssetPath = "Graphics\\cleared"; break;
case GRAPHIC_FAILED: sAssetPath = "Graphics\\failed"; break; case GRAPHIC_FAILED: sAssetPath = "Graphics\\failed"; break;
case GRAPHIC_GRADES: sAssetPath = "Graphics\\grades 1x8"; break; case GRAPHIC_GRADES: sAssetPath = "Graphics\\grades 1x8"; break;
case GRAPHIC_KEEP_ALIVE: sAssetPath = "Graphics\\keep alive"; break; case GRAPHIC_KEEP_ALIVE: sAssetPath = "Graphics\\keep alive"; break;
case GRAPHIC_DANCER_P1: sAssetPath = "Graphics\\dancer p1"; break; case GRAPHIC_DANCER_P1: sAssetPath = "Graphics\\dancer p1"; break;
case GRAPHIC_DANCER_P2: sAssetPath = "Graphics\\dancer p2"; break; case GRAPHIC_DANCER_P2: sAssetPath = "Graphics\\dancer p2"; break;
case GRAPHIC_PAD_SINGLE: sAssetPath = "Graphics\\Pad single"; break; case GRAPHIC_PAD_SINGLE: sAssetPath = "Graphics\\Pad single"; break;
case GRAPHIC_PAD_DOUBLE: sAssetPath = "Graphics\\Pad double"; break; case GRAPHIC_PAD_DOUBLE: sAssetPath = "Graphics\\Pad double"; break;
case GRAPHIC_PAD_SOLO: sAssetPath = "Graphics\\Pad solo"; break; case GRAPHIC_PAD_SOLO: sAssetPath = "Graphics\\Pad solo"; break;
case GRAPHIC_STYLE_ICONS: sAssetPath = "Graphics\\style icons 1x5"; break; case GRAPHIC_STYLE_ICONS: sAssetPath = "Graphics\\Style icons 1x5"; break;
case GRAPHIC_STYLE_EXPLANATIONS: sAssetPath = "Graphics\\style explanations 1x10"; break; case GRAPHIC_STYLE_EXPLANATIONS: sAssetPath = "Graphics\\Style explanations 1x10"; break;
case GRAPHIC_MUSIC_SELECTION_HIGHLIGHT: sAssetPath = "Graphics\\music selection highlight"; break; case GRAPHIC_MUSIC_SELECTION_HIGHLIGHT: sAssetPath = "Graphics\\music selection highlight"; break;
case GRAPHIC_STEPS_DESCRIPTION: sAssetPath = "Graphics\\steps description 1x8"; break; case GRAPHIC_STEPS_DESCRIPTION: sAssetPath = "Graphics\\Steps description 1x8"; break;
case GRAPHIC_SECTION_BACKGROUND: sAssetPath = "Graphics\\section background"; break; case GRAPHIC_SECTION_BACKGROUND: sAssetPath = "Graphics\\section background"; break;
case GRAPHIC_MUSIC_SORT_ICONS: sAssetPath = "Graphics\\music sort icons 1x4"; break; case GRAPHIC_MUSIC_SORT_ICONS: sAssetPath = "Graphics\\music sort icons 1x4"; break;
case GRAPHIC_MUSIC_STATUS_ICONS: sAssetPath = "Graphics\\music status icons 1x4"; break; case GRAPHIC_MUSIC_STATUS_ICONS: sAssetPath = "Graphics\\music status icons 1x4"; break;
case GRAPHIC_DANGER_TEXT: sAssetPath = "Graphics\\danger text"; break; case GRAPHIC_DANGER_TEXT: sAssetPath = "Graphics\\danger text"; break;
case GRAPHIC_DANGER_BACKGROUND: sAssetPath = "Graphics\\danger background"; break; case GRAPHIC_DANGER_BACKGROUND: sAssetPath = "Graphics\\danger background"; break;
case GRAPHIC_ARROWS_LEFT: sAssetPath = "Graphics\\arrows left 1x4"; break; case GRAPHIC_ARROWS_LEFT: sAssetPath = "Graphics\\arrows left 1x4"; break;
case GRAPHIC_ARROWS_RIGHT: sAssetPath = "Graphics\\arrows right 1x4"; break; case GRAPHIC_ARROWS_RIGHT: sAssetPath = "Graphics\\arrows right 1x4"; break;
case GRAPHIC_EDIT_BACKGROUND: sAssetPath = "Graphics\\edit background"; break; case GRAPHIC_EDIT_BACKGROUND: sAssetPath = "Graphics\\edit background"; break;
case GRAPHIC_EDIT_SNAP_INDICATOR: sAssetPath = "Graphics\\edit snap indicator"; break; case GRAPHIC_EDIT_SNAP_INDICATOR: sAssetPath = "Graphics\\edit snap indicator"; break;
case GRAPHIC_GAME_OPTIONS_BACKGROUND: sAssetPath = "Graphics\\game options background"; break; case GRAPHIC_GAME_OPTIONS_BACKGROUND: sAssetPath = "Graphics\\game options background"; break;
case GRAPHIC_PLAYER_OPTIONS_BACKGROUND: sAssetPath = "Graphics\\player options background"; break; case GRAPHIC_PLAYER_OPTIONS_BACKGROUND: sAssetPath = "Graphics\\player options background"; break;
case GRAPHIC_MUSIC_OPTIONS_BACKGROUND: sAssetPath = "Graphics\\music options background"; break; case GRAPHIC_MUSIC_OPTIONS_BACKGROUND: sAssetPath = "Graphics\\music options background"; break;
case GRAPHIC_SYNCHRONIZE_BACKGROUND: sAssetPath = "Graphics\\synchronize background"; break; case GRAPHIC_SYNCHRONIZE_BACKGROUND: sAssetPath = "Graphics\\synchronize background"; break;
case GRAPHIC_SYNCHRONIZE_TOP_EDGE: sAssetPath = "Graphics\\synchronize top edge"; break; case GRAPHIC_SYNCHRONIZE_TOP_EDGE: sAssetPath = "Graphics\\synchronize top edge"; break;
case SOUND_FAILED: sAssetPath = "Sounds\\failed"; break; case SOUND_FAILED: sAssetPath = "Sounds\\failed"; break;
case SOUND_ASSIST: sAssetPath = "Sounds\\Assist"; break; case SOUND_ASSIST: sAssetPath = "Sounds\\Assist"; break;
case SOUND_SELECT: sAssetPath = "Sounds\\select"; break; case SOUND_SELECT: sAssetPath = "Sounds\\select"; break;
case SOUND_SWITCH_STYLE: sAssetPath = "Sounds\\switch style"; break; case SOUND_SWITCH_STYLE: sAssetPath = "Sounds\\switch Style"; break;
case SOUND_SWITCH_MUSIC: sAssetPath = "Sounds\\switch music"; break; case SOUND_SWITCH_MUSIC: sAssetPath = "Sounds\\switch music"; break;
case SOUND_SWITCH_SORT: sAssetPath = "Sounds\\switch sort"; break; case SOUND_SWITCH_SORT: sAssetPath = "Sounds\\switch sort"; break;
case SOUND_EXPAND: sAssetPath = "Sounds\\expand"; break; case SOUND_EXPAND: sAssetPath = "Sounds\\expand"; break;
case SOUND_SWITCH_STEPS: sAssetPath = "Sounds\\switch steps"; break; case SOUND_SWITCH_STEPS: sAssetPath = "Sounds\\switch Steps"; break;
case SOUND_TITLE_CHANGE: sAssetPath = "Sounds\\title change"; break; case SOUND_TITLE_CHANGE: sAssetPath = "Sounds\\title change"; break;
case SOUND_MENU_SWOOSH: sAssetPath = "Sounds\\menu swoosh"; break; case SOUND_MENU_SWOOSH: sAssetPath = "Sounds\\menu swoosh"; break;
case SOUND_MENU_BACK: sAssetPath = "Sounds\\menu back"; break; case SOUND_MENU_BACK: sAssetPath = "Sounds\\menu back"; break;
case SOUND_TRAINING_MUSIC: sAssetPath = "Sounds\\training music"; break; case SOUND_TRAINING_MUSIC: sAssetPath = "Sounds\\training music"; break;
case SOUND_INVALID: sAssetPath = "Sounds\\invalid"; break; case SOUND_INVALID: sAssetPath = "Sounds\\invalid"; break;
case SOUND_EDIT_CHANGE_LINE: sAssetPath = "Sounds\\edit change line"; break; case SOUND_EDIT_CHANGE_LINE: sAssetPath = "Sounds\\edit change line"; break;
case SOUND_EDIT_CHANGE_SNAP: sAssetPath = "Sounds\\edit change snap"; break; case SOUND_EDIT_CHANGE_SNAP: sAssetPath = "Sounds\\edit change snap"; break;
case FONT_OUTLINE: sAssetPath = "Fonts\\Outline"; break; case FONT_OUTLINE: sAssetPath = "Fonts\\Outline"; break;
case FONT_NORMAL: sAssetPath = "Fonts\\Normal"; break; case FONT_NORMAL: sAssetPath = "Fonts\\Normal"; break;
case FONT_FUTURISTIC: sAssetPath = "Fonts\\Futuristic"; break; case FONT_FUTURISTIC: sAssetPath = "Fonts\\Futuristic"; break;
case FONT_BOLD_NUMBERS: sAssetPath = "Fonts\\Bold Numbers"; break; case FONT_BOLD_NUMBERS: sAssetPath = "Fonts\\Bold Numbers"; break;
case FONT_LCD_NUMBERS: sAssetPath = "Fonts\\LCD Numbers"; break; case FONT_LCD_NUMBERS: sAssetPath = "Fonts\\LCD Numbers"; break;
case FONT_FEET: sAssetPath = "Fonts\\Feet"; break; case FONT_FEET: sAssetPath = "Fonts\\Feet"; break;
case FONT_COMBO_NUMBERS: sAssetPath = "Fonts\\MAX Numbers"; break; case FONT_COMBO_NUMBERS: sAssetPath = "Fonts\\MAX Numbers"; break;
case FONT_SCORE_NUMBERS: sAssetPath = "Fonts\\Bold Numbers"; break; case FONT_SCORE_NUMBERS: sAssetPath = "Fonts\\Bold Numbers"; break;
case ANNOUNCER_ATTRACT: sAssetPath = "Announcer\\attract"; break; case ANNOUNCER_ATTRACT: sAssetPath = "Announcer\\attract"; break;
case ANNOUNCER_BAD_COMMENT: sAssetPath = "Announcer\\bad comment"; break; case ANNOUNCER_BAD_COMMENT: sAssetPath = "Announcer\\bad comment"; break;
case ANNOUNCER_CAUTION: sAssetPath = "Announcer\\caution"; break; case ANNOUNCER_CAUTION: sAssetPath = "Announcer\\caution"; break;
case ANNOUNCER_CLEARED: sAssetPath = "Announcer\\cleared"; break; case ANNOUNCER_CLEARED: sAssetPath = "Announcer\\cleared"; break;
case ANNOUNCER_FAIL_COMMENT: sAssetPath = "Announcer\\fail comment"; break; case ANNOUNCER_FAIL_COMMENT: sAssetPath = "Announcer\\fail comment"; break;
case ANNOUNCER_GAME_OVER: sAssetPath = "Announcer\\game over"; break; case ANNOUNCER_GAME_OVER: sAssetPath = "Announcer\\game over"; break;
case ANNOUNCER_GOOD_COMMENT: sAssetPath = "Announcer\\good comment"; break; case ANNOUNCER_GOOD_COMMENT: sAssetPath = "Announcer\\good comment"; break;
case ANNOUNCER_HERE_WE_GO: sAssetPath = "Announcer\\here we go"; break; case ANNOUNCER_HERE_WE_GO: sAssetPath = "Announcer\\here we go"; break;
case ANNOUNCER_MUSIC_COMMENT: sAssetPath = "Announcer\\music comment"; break; case ANNOUNCER_MUSIC_COMMENT: sAssetPath = "Announcer\\music comment"; break;
case ANNOUNCER_READY: sAssetPath = "Announcer\\ready"; break; case ANNOUNCER_READY: sAssetPath = "Announcer\\ready"; break;
case ANNOUNCER_READY_LAST: sAssetPath = "Announcer\\ready last"; break; case ANNOUNCER_READY_LAST: sAssetPath = "Announcer\\ready last"; break;
case ANNOUNCER_RESULT_AAA: sAssetPath = "Announcer\\result aaa"; break; case ANNOUNCER_RESULT_AAA: sAssetPath = "Announcer\\result aaa"; break;
case ANNOUNCER_RESULT_AA: sAssetPath = "Announcer\\result aa"; break; case ANNOUNCER_RESULT_AA: sAssetPath = "Announcer\\result aa"; break;
case ANNOUNCER_RESULT_A: sAssetPath = "Announcer\\result a"; break; case ANNOUNCER_RESULT_A: sAssetPath = "Announcer\\result a"; break;
case ANNOUNCER_RESULT_B: sAssetPath = "Announcer\\result b"; break; case ANNOUNCER_RESULT_B: sAssetPath = "Announcer\\result b"; break;
case ANNOUNCER_RESULT_C: sAssetPath = "Announcer\\result c"; break; case ANNOUNCER_RESULT_C: sAssetPath = "Announcer\\result c"; break;
case ANNOUNCER_RESULT_D: sAssetPath = "Announcer\\result d"; break; case ANNOUNCER_RESULT_D: sAssetPath = "Announcer\\result d"; break;
case ANNOUNCER_RESULT_E: sAssetPath = "Announcer\\result e"; break; case ANNOUNCER_RESULT_E: sAssetPath = "Announcer\\result e"; break;
case ANNOUNCER_TITLE: sAssetPath = "Announcer\\title"; break; case ANNOUNCER_TITLE: sAssetPath = "Announcer\\title"; break;
default: default:
+7 -61
View File
@@ -134,71 +134,17 @@ const CString DEFAULT_THEME_DIR = "Themes\\default\\";
class ThemeManager class ThemeManager
{ {
public: public:
ThemeManager() ThemeManager();
{
CStringArray arrayThemeNames;
GetThemeNames( arrayThemeNames );
for( int i=0; i<arrayThemeNames.GetSize(); i++ )
AssertThemeIsComplete( arrayThemeNames[i] );
SetTheme( DEFAULT_THEME_NAME );
};
void GetThemeNames( CStringArray& AddTo )
{
GetDirListing( "Themes\\*", AddTo, true );
// strip out the folder called "CVS"
for( int i=0; i<AddTo.GetSize(); i++ )
{
if( 0 == stricmp( AddTo[i], "cvs" ) )
{
AddTo.RemoveAt(i);
i--;
}
}
};
bool SetTheme( CString sThemeName ) // return false if theme doesn't exist
{
sThemeName.MakeLower();
m_sCurThemeName = sThemeName;
CString sThemeDir = ThemeNameToThemeDir( m_sCurThemeName );
if( !DoesFileExist( sThemeDir ) )
{
RageError( ssprintf( "The theme in diretory '%' could not be loaded.", sThemeDir ) );
return false;
}
return true;
};
void AssertThemeIsComplete( CString sThemeName ) // return false if theme doesn't exist
{
for( int i=0; i<NUM_THEME_ELEMENTS; i++ )
{
if( GetPathTo( (ThemeElement)i, sThemeName ) == "" )
RageError( ssprintf( "The theme element for theme '%s' called '%s' could not be found.", sThemeName, ElementToAssetPath((ThemeElement)i) ) );
}
};
void GetThemeNames( CStringArray& AddTo );
bool SetTheme( CString sThemeName ); // return false if theme doesn't exist
void AssertThemeIsComplete( CString sThemeName ); // return false if theme doesn't exist
CString ElementToAssetPath( ThemeElement te ); CString ElementToAssetPath( ThemeElement te );
CString GetPathTo( ThemeElement te );
CString GetPathTo( ThemeElement te )
{
return GetPathTo( te, m_sCurThemeName );
};
CString GetPathTo( ThemeElement te, CString sThemeName ); CString GetPathTo( ThemeElement te, CString sThemeName );
protected:
CString ThemeNameToThemeDir( CString sThemeName );
private:
CString ThemeNameToThemeDir( CString sThemeName )
{
return ssprintf( "Themes\\%s\\", sThemeName );
}
CString m_sCurThemeName; CString m_sCurThemeName;
}; };
+1 -1
View File
@@ -23,7 +23,7 @@
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 113 #define _APS_NEXT_RESOURCE_VALUE 115
#define _APS_NEXT_COMMAND_VALUE 40009 #define _APS_NEXT_COMMAND_VALUE 40009
#define _APS_NEXT_CONTROL_VALUE 1009 #define _APS_NEXT_CONTROL_VALUE 1009
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
+2 -2
View File
@@ -38,7 +38,7 @@ RSC=rc.exe
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 6 # PROP Use_MFC 6
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../" # PROP Output_Dir "../"
# PROP Intermediate_Dir "Release" # PROP Intermediate_Dir "Release"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c
@@ -63,7 +63,7 @@ LINK32=link.exe
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 6 # PROP Use_MFC 6
# PROP Use_Debug_Libraries 1 # PROP Use_Debug_Libraries 1
# PROP Output_Dir "../../" # PROP Output_Dir "../"
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
+14 -12
View File
@@ -1,10 +1,12 @@
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: Song.h Class: Song
Desc: Holds metadata for a song and the song's step data. Desc: Holds data about a piece of music that can be played by one or more
Games.
Copyright (c) 2001 Chris Danford. All rights reserved. Copyright (c) 2001-2002 by the names listed below. All rights reserved.
Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -12,10 +14,11 @@
#define _SONG_H_ #define _SONG_H_
#include "Steps.h" #include "Pattern.h"
#include "PrefsManager.h" // for definition of GameMode #include "GameTypes.h"
enum GameMode; // why is this needed? #include "RageUtil.h"
//enum DanceStyle; // why is this needed?
@@ -82,15 +85,15 @@ public:
} }
}; };
void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut ); void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut );
void GetStepsThatMatchGameMode( GameMode gm, CArray<Steps*, Steps*>& arrayAddTo ); void GetPatternsThatMatchStyle( DanceStyle s, CArray<Pattern*, Pattern*>& arrayAddTo );
void GetNumFeet( GameMode gm, int& iDiffEasy, int& iDiffMedium, int& iDiffHard ); void GetNumFeet( DanceStyle s, int& iDiffEasy, int& iDiffMedium, int& iDiffHard );
int GetNumTimesPlayed() int GetNumTimesPlayed()
{ {
int iTotalNumTimesPlayed = 0; int iTotalNumTimesPlayed = 0;
for( int i=0; i<arraySteps.GetSize(); i++ ) for( int i=0; i<m_arrayPatterns.GetSize(); i++ )
{ {
iTotalNumTimesPlayed += arraySteps[i].m_iNumTimesPlayed; iTotalNumTimesPlayed += m_arrayPatterns[i].m_iNumTimesPlayed;
} }
return iTotalNumTimesPlayed; return iTotalNumTimesPlayed;
} }
@@ -107,7 +110,6 @@ private:
CString m_sTitle; CString m_sTitle;
CString m_sArtist; CString m_sArtist;
CString m_sCreator; CString m_sCreator;
// float m_fBPM;
float m_fOffsetInSeconds; float m_fOffsetInSeconds;
CString m_sMusicPath; CString m_sMusicPath;
@@ -119,7 +121,7 @@ private:
CArray<FreezeSegment, FreezeSegment&> m_FreezeSegments; // this must be sorted before dancing CArray<FreezeSegment, FreezeSegment&> m_FreezeSegments; // this must be sorted before dancing
public: public:
CArray<Steps, Steps&> arraySteps; CArray<Pattern, Pattern&> m_arrayPatterns;
}; };
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB