ugh. Cleanup of ez2's menubganimations.

This commit is contained in:
Chris Danford
2002-09-29 05:06:18 +00:00
parent e621580615
commit ad6c239858
53 changed files with 1233 additions and 601 deletions
+5
View File
@@ -2,6 +2,11 @@
Fix
/////////////////////////
more traditional particle system in BGAnimationLayer?
- fog
- particle lifetime
- set camera position
anon CVS instructions
MS phone bill
+3 -127
View File
@@ -88,7 +88,9 @@ ControllerP2Y=350
HelpText=Press $ on the pad to join. Press ! " to change styles, then press START
TimerSeconds=40
NextScreen=ScreenSelectGroup
ScrollingListX=320
ScrollingListY=250
UseSelectionBGAnimations=0
[ScreenSelectDifficulty]
MorePage1X=580
@@ -458,7 +460,7 @@ SectionColor7=0.8, 0.6, 0.0, 1
[LifeMeterBar]
MeterWidth=260
MeterHeight=20
MeterHeight=24
DangerThreshold=0.2
NumChambers=32
NumStrips=2
@@ -693,129 +695,3 @@ Theme=Choose from this list of installed theme packs.::For more information abou
NoteSkin=Choose from this list of installed note skins.::For more information about creating a note skin, see the README.
HowToPlay=Toggle whether the How To Play screen is shown.
// BACKGROUND ANIMATION THEME METRICS
// For EVERY gametype you must have AT LEAST [bganims-GAMETYPE-0] WITH
// the NumElements = x
// if you specify NumElements = 0 then you need not add any more elements
// however, if it is 1 or greater you MUST specify the PATH,X,Y,ZOOM and EFFECT
// for EACH sprite you have.
// if EFFECT is NULL then you need not specify the SPEED of that sprite.
//
// NumElements is how many sprites you want to work with. You may use up to 10 sprites
// from then on use SpriteX-path ... where X is the Element you're working with
// e.g. Sprite1-path=somesprite
//
// SpriteX-effect :
// NULL = no effect
// RC = Rotate Clockwise
// RA = Rotate AntiClockwise
// FH = Flip Horizontally
// FV = Flip Vertically
// SL = Scroll Left, works ideally with Unzoomed (1.0) images that are the size of the screen (e.g. 640x480)
// basically, it scrolls a large background image left, and wraps it so that it appears to go on forever.
// the limitation is... that it only works for images of width 640.
// use an image smaller or larger than the screen size and you'll likely get unpredictable results.
//
// SpriteX-speed :
// Depending on the EFFECT you choose, the speed (specified as a float, 0.1 for example)
// will determine how fast something rotates/tweens e.t.c.
//
// SpriteX-zoom :
// Specifies how zoomed the graphic is. in floating point 1.0 is normal size
// anything less is shrunk, anything more is zoomed. 0 is totally invisible.
//
// CENTER_X and CENTER_Y are keywords reserved for the use of BGAnims, they may not necessarily work
// on any other theme metrics. The BGAnims will display a graphic in the Center Of the Screen using
// these defines. Alternatively you may use a number instead of this constant value.
[bganims-ez2-0]
NumElements=2
Sprite0-path=Ez2 select style Anim Easy 01
Sprite0-effect=RA
Sprite0-speed=0.01
Sprite0-zoom=2.0
Sprite0-X=CENTER_X
Sprite0-Y=CENTER_Y
Sprite1-path=Ez2 select style Anim Easy 02
Sprite1-effect=RC
Sprite1-speed=0.01
Sprite1-zoom=2.0
Sprite1-X=CENTER_X
Sprite1-Y=CENTER_Y
[bganims-ez2-1]
NumElements=0
Sprite0-path=select style preview ez2 singlehard
Sprite0-effect=RA
Sprite0-speed=0.01
Sprite0-zoom=2.0
Sprite0-X=CENTER_X
Sprite0-Y=CENTER_Y
[bganims-ez2-2]
NumElements=4
Sprite0-path=Ez2 select style Anim Real 04
Sprite0-effect=SL
Sprite0-speed=5
Sprite0-zoom=1.0
Sprite0-X=CENTER_X
Sprite0-Y=CENTER_Y
Sprite1-path=Ez2 select style Anim Real 01
Sprite1-effect=SL
Sprite1-speed=5
Sprite1-zoom=1.0
Sprite1-X=CENTER_X
Sprite1-Y=CENTER_Y
Sprite2-path=Ez2 select style Anim Real 02
Sprite2-effect=SL
Sprite2-speed=3
Sprite2-zoom=1.0
Sprite2-X=CENTER_X
Sprite2-Y=CENTER_Y
Sprite3-path=Ez2 select style Anim Real 03
Sprite3-effect=SL
Sprite3-speed=1
Sprite3-zoom=1.0
Sprite3-X=CENTER_X
Sprite3-Y=CENTER_Y
[bganims-ez2-3]
NumElements=0
Sprite0-path=select style preview ez2 double
Sprite0-effect=RC
Sprite0-speed=0.005
Sprite0-zoom=5.0
Sprite0-X=CENTER_X
Sprite0-Y=-350
[bganims-para-0]
NumElements=0
[bganims-para-1]
NumElements=0
[bganims-para-2]
NumElements=0
[bganims-para-3]
NumElements=0
[bganims-pump-0]
NumElements=0
[bganims-pump-1]
NumElements=0
[bganims-pump-2]
NumElements=0
[bganims-pump-3]
NumElements=0
[bganims-pump-4]
NumElements=0
+124
View File
@@ -0,0 +1,124 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
Class: BGAnimation
Desc: Particles used initially for background effects
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Ben Nordstrom
Chris Danford
-----------------------------------------------------------------------------
*/
#include "BGAnimation.h"
#include "PrefsManager.h"
#include "GameState.h"
#include "IniFile.h"
#include "BGAnimationLayer.h"
BGAnimation::BGAnimation()
{
}
BGAnimation::~BGAnimation()
{
Unload();
}
void BGAnimation::Unload()
{
for( int i=0; i<m_Layers.GetSize(); i++ )
delete m_Layers[i];
m_Layers.RemoveAll();
}
void BGAnimation::LoadFromStaticGraphic( CString sPath )
{
Unload();
BGAnimationLayer* pLayer = new BGAnimationLayer;
pLayer->LoadFromStaticGraphic( sPath );
m_Layers.Add( pLayer );
}
void BGAnimation::LoadFromAniDir( CString sAniDir, CString sSongBGPath )
{
Unload();
if( sAniDir.Right(1) != "\\" )
sAniDir += "\\";
// loading a directory of layers
CStringArray asImagePaths;
ASSERT( sAniDir != "" );
GetDirListing( sAniDir+"*.png", asImagePaths, false, true );
GetDirListing( sAniDir+"*.jpg", asImagePaths, false, true );
GetDirListing( sAniDir+"*.gif", asImagePaths, false, true );
GetDirListing( sAniDir+"*.sprite", asImagePaths, false, true );
SortCStringArray( asImagePaths );
for( int i=0; i<asImagePaths.GetSize(); i++ )
{
const CString sPath = asImagePaths[i];
CString sDir, sFName, sExt;
splitrelpath( sPath, sDir, sFName, sExt );
if( sFName.Left(1) == "_" )
continue; // don't directly load files starting with an underscore
BGAnimationLayer* pLayer = new BGAnimationLayer;
pLayer->LoadFromAniLayerFile( asImagePaths[i], sSongBGPath );
m_Layers.Add( pLayer );
}
}
void BGAnimation::LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind, bool bFadeSongBG, CString sSongBGPath )
{
Unload();
BGAnimationLayer* pLayer = new BGAnimationLayer;
pLayer->LoadFromMovie( sMoviePath, bLoop, bRewind, bFadeSongBG, sSongBGPath );
m_Layers.Add( pLayer );
}
void BGAnimation::LoadFromVisualization( CString sVisPath, CString sSongBGPath )
{
Unload();
BGAnimationLayer* pLayer;
pLayer = new BGAnimationLayer;
pLayer->LoadFromStaticGraphic( sSongBGPath );
m_Layers.Add( pLayer );
pLayer = new BGAnimationLayer;
pLayer->LoadFromVisualization( sVisPath );
m_Layers.Add( pLayer );
}
void BGAnimation::Update( float fDeltaTime )
{
for( int i=0; i<m_Layers.GetSize(); i++ )
m_Layers[i]->Update( fDeltaTime );
}
void BGAnimation::DrawPrimitives()
{
for( int i=0; i<m_Layers.GetSize(); i++ )
m_Layers[i]->Draw();
}
void BGAnimation::GainingFocus()
{
for( int i=0; i<m_Layers.GetSize(); i++ )
m_Layers[i]->GainingFocus();
}
void BGAnimation::LosingFocus()
{
for( int i=0; i<m_Layers.GetSize(); i++ )
m_Layers[i]->LosingFocus();
}
+43
View File
@@ -0,0 +1,43 @@
#pragma once
/*
-----------------------------------------------------------------------------
Class: BGAnimation
Desc: Particles that play in the background of ScreenGameplay
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Ben Nordstrom
Chris Danford
-----------------------------------------------------------------------------
*/
#include "GameConstantsAndTypes.h"
#include "ActorFrame.h"
class BGAnimationLayer;
class BGAnimation : public ActorFrame
{
public:
BGAnimation();
virtual ~BGAnimation();
void Unload();
void LoadFromStaticGraphic( CString sPath );
void LoadFromAniDir( CString sAniDir, CString sSongBGPath="" );
void LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind, bool bFadeSongBG = false, CString sSongBGPath = "" );
void LoadFromVisualization( CString sMoviePath, CString sSongBGPath );
virtual void Update( float fDeltaTime );
virtual void DrawPrimitives();
void GainingFocus();
void LosingFocus();
protected:
CArray<BGAnimationLayer*,BGAnimationLayer*> m_Layers;
};
+508
View File
@@ -0,0 +1,508 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
Class: BGAnimation
Desc: Particles used initially for background effects
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Ben Nordstrom
Chris Danford
-----------------------------------------------------------------------------
*/
#include "BGAnimationLayer.h"
#include "PrefsManager.h"
#include "GameState.h"
#include "IniFile.h"
inline float GetOffScreenLeft( Actor* pActor ) { return SCREEN_LEFT - pActor->GetZoomedWidth()/2; }
inline float GetOffScreenRight( Actor* pActor ) { return SCREEN_RIGHT + pActor->GetZoomedWidth()/2; }
inline float GetOffScreenTop( Actor* pActor ) { return SCREEN_TOP - pActor->GetZoomedHeight()/2; }
inline float GetOffScreenBottom(Actor* pActor ) { return SCREEN_BOTTOM+ pActor->GetZoomedHeight()/2; }
inline bool IsOffScreenLeft( Actor* pActor ) { return pActor->GetX() < GetOffScreenLeft(pActor); }
inline bool IsOffScreenRight( Actor* pActor ) { return pActor->GetX() > GetOffScreenRight(pActor); }
inline bool IsOffScreenTop( Actor* pActor ) { return pActor->GetY() < GetOffScreenTop(pActor); }
inline bool IsOffScreenBottom(Actor* pActor ) { return pActor->GetY() > GetOffScreenBottom(pActor); }
// guard rail is the area that keeps particles from going off screen
inline float GetGuardRailLeft( Actor* pActor ) { return SCREEN_LEFT + pActor->GetZoomedWidth()/2; }
inline float GetGuardRailRight( Actor* pActor ) { return SCREEN_RIGHT - pActor->GetZoomedWidth()/2; }
inline float GetGuardRailTop( Actor* pActor ) { return SCREEN_TOP + pActor->GetZoomedHeight()/2; }
inline float GetGuardRailBottom(Actor* pActor ) { return SCREEN_BOTTOM- pActor->GetZoomedHeight()/2; }
inline bool HitGuardRailLeft( Actor* pActor ) { return pActor->GetX() < GetGuardRailLeft(pActor); }
inline bool HitGuardRailRight( Actor* pActor ) { return pActor->GetX() > GetGuardRailRight(pActor); }
inline bool HitGuardRailTop( Actor* pActor ) { return pActor->GetY() < GetGuardRailTop(pActor); }
inline bool HitGuardRailBottom(Actor* pActor ) { return pActor->GetY() > GetGuardRailBottom(pActor); }
const float PARTICLE_VELOCITY = 300;
const float SPIRAL_MAX_ZOOM = 2;
const float SPIRAL_MIN_ZOOM = 0.3f;
BGAnimationLayer::BGAnimationLayer()
{
m_iNumSprites = 0;
m_bCycleColor = false;
m_bCycleAlpha = false;
m_Effect = EFFECT_STRETCH_STILL;
}
void BGAnimationLayer::LoadFromStaticGraphic( CString sPath )
{
m_iNumSprites = 1;
m_Sprites[0].Load( sPath );
m_Sprites[0].StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
}
void BGAnimationLayer::LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind, bool bFadeSongBG, CString sSongBGPath )
{
m_iNumSprites = bFadeSongBG ? 2 : 1;
m_Sprites[0].Load( sMoviePath );
m_Sprites[0].StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
m_Sprites[0].GetTexture()->Play();
::Sleep( 50 ); // decode a frame so we don't see a black flash at the beginning
m_Sprites[0].GetTexture()->Pause();
m_bRewindMovie = bRewind;
if( !bLoop )
m_Sprites[0].GetTexture()->SetLooping(false);
if( bFadeSongBG )
{
m_Sprites[1].Load( sSongBGPath );
m_Sprites[1].StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
m_Sprites[1].BeginTweening( 0.7f ); // this tween won't actually happen until GainFocus is called and this Layer starts getting Update()s.
m_Sprites[1].SetTweenDiffuse( D3DXCOLOR(1,1,1,0) );
}
}
void BGAnimationLayer::LoadFromVisualization( CString sMoviePath )
{
m_iNumSprites = 1;
m_Sprites[0].Load( sMoviePath );
m_Sprites[0].StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
m_Sprites[0].SetBlendModeAdd();
}
void BGAnimationLayer::LoadFromAniLayerFile( CString sPath, CString sSongBGPath )
{
sPath.MakeLower();
if( sPath.Find("usesongbg") != -1 )
{
LoadFromStaticGraphic( sSongBGPath );
return; // this will ignore other effects in the file name
}
const CString EFFECT_STRING[NUM_EFFECTS] = {
"center",
"stretchstill",
"scretchscrollleft",
"stretchscrollright",
"stretchscrollup",
"stretchscrolldown",
"stretchwater",
"stretchbubble",
"stretchtwist",
"stretchspin",
"particlesspiralout",
"particlesspiralin",
"particlesfloatup",
"particlesfloatdown",
"particlesfloatleft",
"particlesfloatright",
"particlesbounce",
"tilestill",
"tilescrollleft",
"tilescrollright",
"tilescrollup",
"tilescrolldown",
"tileflipx",
"tileflipy",
"tilepulse",
};
for( int i=0; i<NUM_EFFECTS; i++ )
{
if( sPath.Find(EFFECT_STRING[i]) != -1 )
{
m_Effect = (Effect)i;
goto found_effect;
}
}
// If we get here, we didn't find an effect string in the file name. Use the defualt effect (StretchStill)
found_effect:
//////////////////////
// init
//////////////////////
switch( m_Effect )
{
case EFFECT_CENTER:
m_iNumSprites = 1;
m_Sprites[0].Load( sPath );
m_Sprites[0].SetXY( CENTER_X, CENTER_Y );
break;
case EFFECT_STRETCH_STILL:
m_iNumSprites = 1;
m_Sprites[0].Load( sPath );
m_Sprites[0].StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
break;
case EFFECT_STRETCH_SCROLL_LEFT:
case EFFECT_STRETCH_SCROLL_RIGHT:
case EFFECT_STRETCH_SCROLL_UP:
case EFFECT_STRETCH_SCROLL_DOWN:
case EFFECT_STRETCH_WATER:
case EFFECT_STRETCH_BUBBLE:
case EFFECT_STRETCH_TWIST:
m_iNumSprites = 1;
m_Sprites[0].Load( sPath, false, 4, 4, false, true );
m_Sprites[0].StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
m_Sprites[0].SetCustomTextureRect( FRECT(0,0,1,1) );
switch( m_Effect )
{
case EFFECT_STRETCH_SCROLL_LEFT: m_vTexCoordVelocity = D3DXVECTOR2(+0.5f,0); break;
case EFFECT_STRETCH_SCROLL_RIGHT: m_vTexCoordVelocity = D3DXVECTOR2(-0.5f,0); break;
case EFFECT_STRETCH_SCROLL_UP: m_vTexCoordVelocity = D3DXVECTOR2(0,+0.5f); break;
case EFFECT_STRETCH_SCROLL_DOWN: m_vTexCoordVelocity = D3DXVECTOR2(0,-0.5f); break;
case EFFECT_STRETCH_WATER:
case EFFECT_STRETCH_BUBBLE:
case EFFECT_STRETCH_TWIST:
m_vTexCoordVelocity = D3DXVECTOR2(-0.0f,0);
break;
default:
ASSERT(0);
}
break;
case EFFECT_STRETCH_SPIN:
m_iNumSprites = 1;
m_Sprites[0].Load( sPath );
m_Sprites[0].ScaleToCover( CRect(SCREEN_LEFT-200,SCREEN_TOP-200,SCREEN_RIGHT+200,SCREEN_BOTTOM+200) );
m_fRotationalVelocity = 1;
break;
case EFFECT_PARTICLES_SPIRAL_OUT:
case EFFECT_PARTICLES_SPIRAL_IN:
{
m_Sprites[0].Load( sPath );
int iSpriteArea = int( m_Sprites[0].GetUnzoomedWidth()*m_Sprites[0].GetUnzoomedHeight() );
int iMaxArea = SCREEN_WIDTH*SCREEN_HEIGHT;
m_iNumSprites = min( iMaxArea / iSpriteArea, MAX_SPRITES );
for( int i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].Load( sPath );
m_Sprites[i].SetZoom( randomf(0.2f,2) );
m_Sprites[i].SetRotation( randomf(0,D3DX_PI*2) );
}
}
break;
case EFFECT_PARTICLES_FLOAT_UP:
case EFFECT_PARTICLES_FLOAT_DOWN:
case EFFECT_PARTICLES_FLOAT_LEFT:
case EFFECT_PARTICLES_FLOAT_RIGHT:
case EFFECT_PARTICLES_BOUNCE:
{
m_Sprites[0].Load( sPath );
int iSpriteArea = int( m_Sprites[0].GetUnzoomedWidth()*m_Sprites[0].GetUnzoomedHeight() );
int iMaxArea = SCREEN_WIDTH*SCREEN_HEIGHT;
m_iNumSprites = min( iMaxArea / iSpriteArea, MAX_SPRITES );
for( int i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].Load( sPath );
m_Sprites[i].SetZoom( 0.7f + 0.6f*i/(float)m_iNumSprites );
m_Sprites[i].SetX( randomf( GetGuardRailLeft(&m_Sprites[i]), GetGuardRailRight(&m_Sprites[i]) ) );
m_Sprites[i].SetY( randomf( GetGuardRailTop(&m_Sprites[i]), GetGuardRailBottom(&m_Sprites[i]) ) );
if( m_Effect == EFFECT_PARTICLES_BOUNCE )
{
m_Sprites[i].SetZoom( 1 );
m_vHeadings[i] = D3DXVECTOR2( randomf(), randomf() );
D3DXVec2Normalize( &m_vHeadings[i], &m_vHeadings[i] );
}
}
}
break;
case EFFECT_TILE_STILL:
case EFFECT_TILE_SCROLL_LEFT:
case EFFECT_TILE_SCROLL_RIGHT:
case EFFECT_TILE_SCROLL_UP:
case EFFECT_TILE_SCROLL_DOWN:
case EFFECT_TILE_FLIP_X:
case EFFECT_TILE_FLIP_Y:
case EFFECT_TILE_PULSE:
{
m_Sprites[0].Load( sPath );
int iNumTilesWide = SCREEN_WIDTH /(int)m_Sprites[0].GetUnzoomedWidth() + 2;
int iNumTilesHigh = SCREEN_HEIGHT/(int)m_Sprites[0].GetUnzoomedHeight() + 2;
iNumTilesWide = min( iNumTilesWide, MAX_TILES_WIDE );
iNumTilesHigh = min( iNumTilesHigh, MAX_TILES_HIGH );
m_iNumSprites = min( iNumTilesWide * iNumTilesHigh, MAX_SPRITES );
for( int x=0; x<iNumTilesWide; x++ )
{
for( int y=0; y<iNumTilesHigh; y++ )
{
int i = x+y*iNumTilesWide;
m_Sprites[i].Load( sPath );
m_Sprites[i].SetX( (x+0.5f)*m_Sprites[i].GetUnzoomedWidth() );
m_Sprites[i].SetY( (y+0.5f)*m_Sprites[i].GetUnzoomedHeight() );
}
}
}
break;
default:
ASSERT(0);
}
m_bCycleColor = sPath.Find("cyclecolor") != -1;
m_bCycleAlpha = sPath.Find("cyclealpha") != -1;
if( sPath.Find("startonrandomframe") != -1 )
for( int i=0; i<m_iNumSprites; i++ )
m_Sprites[i].SetState( rand()%m_Sprites[i].GetNumStates() );
if( sPath.Find("dontanimate") != -1 )
for( int i=0; i<m_iNumSprites; i++ )
m_Sprites[i].StopAnimating();
if( sPath.Find("add") != -1 )
for( int i=0; i<m_iNumSprites; i++ )
m_Sprites[i].SetBlendModeAdd();
CString sDir, sFName, sExt;
splitrelpath( sPath, sDir, sFName, sExt );
CString sIniPath = sDir+"\\"+sFName+".ini";
IniFile ini;
ini.SetPath( sIniPath );
if( ini.ReadFile() )
{
ini.GetValueF( "BGAnimationLayer", "TexCoordVelocityX", m_vTexCoordVelocity.x );
ini.GetValueF( "BGAnimationLayer", "TexCoordVelocityY", m_vTexCoordVelocity.y );
ini.GetValueF( "BGAnimationLayer", "RotationalVelocity", m_fRotationalVelocity );
}
}
void BGAnimationLayer::Update( float fDeltaTime )
{
int i;
const float fSongBeat = GAMESTATE->m_fSongBeat;
if( m_bCycleColor )
{
for( int i=0; i<m_iNumSprites; i++ )
{
D3DXCOLOR color = D3DXCOLOR(
cosf( fSongBeat+i ) * 0.5f + 0.5f,
cosf( fSongBeat+i + D3DX_PI * 2.0f / 3.0f ) * 0.5f + 0.5f,
cosf( fSongBeat+i + D3DX_PI * 4.0f / 3.0f) * 0.5f + 0.5f,
1.0f
);
m_Sprites[i].SetDiffuse( color );
}
}
if( m_bCycleAlpha )
{
for( int i=0; i<m_iNumSprites; i++ )
{
D3DXCOLOR color = m_Sprites[i].GetDiffuse();
color.a = cosf( fSongBeat/2 ) * 0.5f + 0.5f;
m_Sprites[i].SetDiffuse( color );
}
}
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].Update( fDeltaTime );
}
switch( m_Effect )
{
case EFFECT_CENTER:
case EFFECT_STRETCH_STILL:
break;
case EFFECT_STRETCH_SCROLL_LEFT:
case EFFECT_STRETCH_SCROLL_RIGHT:
case EFFECT_STRETCH_SCROLL_UP:
case EFFECT_STRETCH_SCROLL_DOWN:
float fTexCoords[8];
m_Sprites[0].GetCustomTextureCoords( fTexCoords );
for( i=0; i<8; i+=2 )
{
fTexCoords[i ] += fDeltaTime*m_vTexCoordVelocity.x;
fTexCoords[i+1] += fDeltaTime*m_vTexCoordVelocity.y;
}
m_Sprites[0].SetCustomTextureCoords( fTexCoords );
break;
case EFFECT_STRETCH_SPIN:
m_Sprites[0].SetRotation( m_Sprites[0].GetRotation() + fDeltaTime*m_fRotationalVelocity );
case EFFECT_STRETCH_WATER:
case EFFECT_STRETCH_BUBBLE:
case EFFECT_STRETCH_TWIST:
break;
case EFFECT_PARTICLES_SPIRAL_OUT:
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].SetZoom( m_Sprites[i].GetZoom() + fDeltaTime );
if( m_Sprites[i].GetZoom() > SPIRAL_MAX_ZOOM )
m_Sprites[i].SetZoom( SPIRAL_MIN_ZOOM );
m_Sprites[i].SetRotation( m_Sprites[i].GetRotation() + fDeltaTime );
float fRadius = (m_Sprites[i].GetZoom()-SPIRAL_MIN_ZOOM);
fRadius *= fRadius;
fRadius *= 200;
m_Sprites[i].SetX( CENTER_X + cosf(m_Sprites[i].GetRotation())*fRadius );
m_Sprites[i].SetY( CENTER_Y + sinf(m_Sprites[i].GetRotation())*fRadius );
}
break;
case EFFECT_PARTICLES_SPIRAL_IN:
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].SetZoom( m_Sprites[i].GetZoom() - fDeltaTime );
if( m_Sprites[i].GetZoom() < SPIRAL_MIN_ZOOM )
m_Sprites[i].SetZoom( SPIRAL_MAX_ZOOM );
m_Sprites[i].SetRotation( m_Sprites[i].GetRotation() - fDeltaTime );
float fRadius = (m_Sprites[i].GetZoom()-SPIRAL_MIN_ZOOM);
fRadius *= fRadius;
fRadius *= 200;
m_Sprites[i].SetX( CENTER_X + cosf(m_Sprites[i].GetRotation())*fRadius );
m_Sprites[i].SetY( CENTER_Y + sinf(m_Sprites[i].GetRotation())*fRadius );
}
break;
case EFFECT_PARTICLES_FLOAT_UP:
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].SetY( m_Sprites[i].GetY() - fDeltaTime * PARTICLE_VELOCITY * m_Sprites[i].GetZoom() );
if( IsOffScreenTop(&m_Sprites[i]) )
m_Sprites[i].SetY( GetOffScreenBottom(&m_Sprites[i]) );
}
break;
case EFFECT_PARTICLES_FLOAT_DOWN:
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].SetY( m_Sprites[i].GetY() + fDeltaTime * PARTICLE_VELOCITY * m_Sprites[i].GetZoom() );
if( IsOffScreenBottom(&m_Sprites[i]) )
m_Sprites[i].SetY( GetOffScreenTop(&m_Sprites[i]) );
}
break;
case EFFECT_PARTICLES_FLOAT_LEFT:
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].SetX( m_Sprites[i].GetX() - fDeltaTime * PARTICLE_VELOCITY * m_Sprites[i].GetZoom() );
if( IsOffScreenLeft(&m_Sprites[i]) )
m_Sprites[i].SetX( GetOffScreenRight(&m_Sprites[i]) );
}
break;
case EFFECT_PARTICLES_FLOAT_RIGHT:
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].SetX( m_Sprites[i].GetX() + fDeltaTime * PARTICLE_VELOCITY * m_Sprites[i].GetZoom() );
if( IsOffScreenRight(&m_Sprites[i]) )
m_Sprites[i].SetX( GetOffScreenLeft(&m_Sprites[i]) );
}
break;
case EFFECT_PARTICLES_BOUNCE:
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].SetX( m_Sprites[i].GetX() + fDeltaTime * PARTICLE_VELOCITY * m_vHeadings[i].x );
m_Sprites[i].SetY( m_Sprites[i].GetY() + fDeltaTime * PARTICLE_VELOCITY * m_vHeadings[i].y );
if( HitGuardRailLeft(&m_Sprites[i]) ) m_vHeadings[i].x *= -1;
if( HitGuardRailRight(&m_Sprites[i]) ) m_vHeadings[i].x *= -1;
if( HitGuardRailTop(&m_Sprites[i]) ) m_vHeadings[i].y *= -1;
if( HitGuardRailBottom(&m_Sprites[i]) ) m_vHeadings[i].y *= -1;
}
break;
case EFFECT_TILE_STILL:
break;
case EFFECT_TILE_SCROLL_LEFT:
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].SetX( m_Sprites[i].GetX() - fDeltaTime * PARTICLE_VELOCITY );
if( IsOffScreenLeft(&m_Sprites[i]) )
m_Sprites[i].SetX( m_Sprites[i].GetX()-GetOffScreenLeft(&m_Sprites[i]) + GetOffScreenRight(&m_Sprites[i]) );
}
break;
case EFFECT_TILE_SCROLL_RIGHT:
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].SetX( m_Sprites[i].GetX() + fDeltaTime * PARTICLE_VELOCITY );
if( IsOffScreenRight(&m_Sprites[i]) )
m_Sprites[i].SetX( m_Sprites[i].GetX()-GetOffScreenRight(&m_Sprites[i]) + GetOffScreenLeft(&m_Sprites[i]) );
}
break;
case EFFECT_TILE_SCROLL_UP:
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].SetY( m_Sprites[i].GetY() - fDeltaTime * PARTICLE_VELOCITY );
if( IsOffScreenTop(&m_Sprites[i]) )
m_Sprites[i].SetY( m_Sprites[i].GetY()-GetOffScreenTop(&m_Sprites[i]) + GetOffScreenBottom(&m_Sprites[i]) );
}
break;
case EFFECT_TILE_SCROLL_DOWN:
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].SetY( m_Sprites[i].GetY() + fDeltaTime * PARTICLE_VELOCITY );
if( IsOffScreenBottom(&m_Sprites[i]) )
m_Sprites[i].SetY( m_Sprites[i].GetY()-GetOffScreenBottom(&m_Sprites[i]) + GetOffScreenTop(&m_Sprites[i]) );
}
break;
case EFFECT_TILE_FLIP_X:
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].SetRotationX( m_Sprites[i].GetRotationX() + fDeltaTime * D3DX_PI );
}
break;
case EFFECT_TILE_FLIP_Y:
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].SetRotationY( m_Sprites[i].GetRotationY() + fDeltaTime * D3DX_PI );
}
break;
case EFFECT_TILE_PULSE:
for( i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].SetZoom( sinf( fSongBeat*D3DX_PI/2 ) );
}
break;
default:
ASSERT(0);
}
}
void BGAnimationLayer::Draw()
{
for( int i=0; i<m_iNumSprites; i++ )
{
m_Sprites[i].Draw();
}
}
void BGAnimationLayer::GainingFocus()
{
if( m_bRewindMovie )
m_Sprites[0].GetTexture()->SetPosition( 0 );
// if movie texture, pause and play movie so we don't waste CPU cycles decoding frames that won't be shown
m_Sprites[0].GetTexture()->Play();
}
void BGAnimationLayer::LosingFocus()
{
m_Sprites[0].GetTexture()->Pause();
}
+80
View File
@@ -0,0 +1,80 @@
#pragma once
/*
-----------------------------------------------------------------------------
Class: BGAnimation
Desc: Particles that play in the background of ScreenGameplay
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Ben Nordstrom
Chris Danford
-----------------------------------------------------------------------------
*/
#include "Sprite.h"
const int MAX_TILES_WIDE = 11;
const int MAX_TILES_HIGH = 8;
const int MAX_SPRITES = MAX_TILES_WIDE*MAX_TILES_HIGH;
class BGAnimationLayer
{
public:
BGAnimationLayer();
virtual ~BGAnimationLayer() { }
void LoadFromStaticGraphic( CString sPath );
void LoadFromAniLayerFile( CString sPath, CString sSongBGPath );
void LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind, bool bFadeSongBG, CString sSongBGPath );
void LoadFromVisualization( CString sMoviePath );
virtual void Update( float fDeltaTime );
virtual void Draw();
void GainingFocus();
void LosingFocus();
protected:
Sprite m_Sprites[MAX_SPRITES];
int m_iNumSprites;
bool m_bCycleColor;
bool m_bCycleAlpha;
bool m_bRewindMovie;
enum Effect {
EFFECT_CENTER,
EFFECT_STRETCH_STILL,
EFFECT_STRETCH_SCROLL_LEFT,
EFFECT_STRETCH_SCROLL_RIGHT,
EFFECT_STRETCH_SCROLL_UP,
EFFECT_STRETCH_SCROLL_DOWN,
EFFECT_STRETCH_WATER,
EFFECT_STRETCH_BUBBLE,
EFFECT_STRETCH_TWIST,
EFFECT_STRETCH_SPIN,
EFFECT_PARTICLES_SPIRAL_OUT,
EFFECT_PARTICLES_SPIRAL_IN,
EFFECT_PARTICLES_FLOAT_UP,
EFFECT_PARTICLES_FLOAT_DOWN,
EFFECT_PARTICLES_FLOAT_LEFT,
EFFECT_PARTICLES_FLOAT_RIGHT,
EFFECT_PARTICLES_BOUNCE,
EFFECT_TILE_STILL,
EFFECT_TILE_SCROLL_LEFT,
EFFECT_TILE_SCROLL_RIGHT,
EFFECT_TILE_SCROLL_UP,
EFFECT_TILE_SCROLL_DOWN,
EFFECT_TILE_FLIP_X,
EFFECT_TILE_FLIP_Y,
EFFECT_TILE_PULSE,
NUM_EFFECTS // leave this at the end
};
Effect m_Effect;
D3DXVECTOR2 m_vHeadings[MAX_SPRITES]; // only used in EFFECT_PARTICLES_BOUNCE
D3DXVECTOR2 m_vTexCoordVelocity;
float m_fRotationalVelocity;
};
+41 -41
View File
@@ -85,9 +85,9 @@ Background::~Background()
void Background::Unload()
{
for( int i=0; i<m_BackgroundAnimations.GetSize(); i++ )
delete m_BackgroundAnimations[i];
m_BackgroundAnimations.RemoveAll();
for( int i=0; i<m_BGAnimations.GetSize(); i++ )
delete m_BGAnimations[i];
m_BGAnimations.RemoveAll();
m_aBGSegments.RemoveAll();
m_iCurBGSegment = 0;
@@ -97,10 +97,10 @@ void Background::LoadFromAniDir( CString sAniDir )
{
Unload();
BackgroundAnimation* pTempBGA;
pTempBGA = new BackgroundAnimation;
BGAnimation* pTempBGA;
pTempBGA = new BGAnimation;
pTempBGA->LoadFromAniDir( sAniDir );
m_BackgroundAnimations.Add( pTempBGA );
m_BGAnimations.Add( pTempBGA );
}
void Background::LoadFromSong( Song* pSong )
@@ -131,20 +131,20 @@ void Background::LoadFromSong( Song* pSong )
//
// Load the static background that will before notes start and after notes end
//
BackgroundAnimation* pTempBGA;
BGAnimation* pTempBGA;
// Tricky! The song background looks terrible unless its loaded with no alpha
// and dithered. Create a dummy sprite that loads the texture with the proper
// hints so we don't have to hack up BackgroundAnimation to handle this special
// hints so we don't have to hack up BGAnimation to handle this special
// case.
Sprite sprDummy;
sprDummy.Load( sSongBackgroundPath, true, 4, 0, true, false );
pTempBGA = new BackgroundAnimation;
pTempBGA = new BGAnimation;
pTempBGA->LoadFromStaticGraphic( sSongBackgroundPath );
m_BackgroundAnimations.Add( pTempBGA );
m_BGAnimations.Add( pTempBGA );
if( pSong->HasBGChanges() )
@@ -170,11 +170,11 @@ void Background::LoadFromSong( Song* pSong )
GetDirListing( pSong->m_sSongDir+"movies\\"+aniseg.m_sBGName+".mpeg", asFiles, false, true );
if( asFiles.GetSize() > 0 )
{
pTempBGA = new BackgroundAnimation;
pTempBGA = new BGAnimation;
pTempBGA->LoadFromMovie( asFiles[0], true, true, i==0/*first BGChange*/, sSongBackgroundPath );
m_BackgroundAnimations.Add( pTempBGA );
m_BGAnimations.Add( pTempBGA );
m_aBGSegments.Add( BGSegment(aniseg.m_fStartBeat, m_BackgroundAnimations.GetSize()-1) ); // add to the plan
m_aBGSegments.Add( BGSegment(aniseg.m_fStartBeat, m_BGAnimations.GetSize()-1) ); // add to the plan
continue; // stop looking for this background
}
@@ -182,11 +182,11 @@ void Background::LoadFromSong( Song* pSong )
GetDirListing( pSong->m_sSongDir+aniseg.m_sBGName, asFiles, true, true );
if( asFiles.GetSize() > 0 )
{
pTempBGA = new BackgroundAnimation;
pTempBGA = new BGAnimation;
pTempBGA->LoadFromAniDir( asFiles[0], sSongBackgroundPath );
m_BackgroundAnimations.Add( pTempBGA );
m_BGAnimations.Add( pTempBGA );
m_aBGSegments.Add( BGSegment(aniseg.m_fStartBeat, m_BackgroundAnimations.GetSize()-1) ); // add to the plan
m_aBGSegments.Add( BGSegment(aniseg.m_fStartBeat, m_BGAnimations.GetSize()-1) ); // add to the plan
continue; // stop looking for this background
}
@@ -196,11 +196,11 @@ void Background::LoadFromSong( Song* pSong )
GetDirListing( RANDOMMOVIES_DIR+aniseg.m_sBGName+".mpeg", asFiles, false, true );
if( asFiles.GetSize() > 0 )
{
pTempBGA = new BackgroundAnimation;
pTempBGA = new BGAnimation;
pTempBGA->LoadFromMovie( asFiles[0], true, false, i==0/*first BGChange*/, sSongBackgroundPath );
m_BackgroundAnimations.Add( pTempBGA );
m_BGAnimations.Add( pTempBGA );
m_aBGSegments.Add( BGSegment(aniseg.m_fStartBeat, m_BackgroundAnimations.GetSize()-1) ); // add to the plan
m_aBGSegments.Add( BGSegment(aniseg.m_fStartBeat, m_BGAnimations.GetSize()-1) ); // add to the plan
continue; // stop looking for this background
}
@@ -208,11 +208,11 @@ void Background::LoadFromSong( Song* pSong )
GetDirListing( BG_ANIMS_DIR+aniseg.m_sBGName, asFiles, true, true );
if( asFiles.GetSize() > 0 )
{
pTempBGA = new BackgroundAnimation;
pTempBGA = new BGAnimation;
pTempBGA->LoadFromAniDir( asFiles[0], sSongBackgroundPath );
m_BackgroundAnimations.Add( pTempBGA );
m_BGAnimations.Add( pTempBGA );
m_aBGSegments.Add( BGSegment(aniseg.m_fStartBeat, m_BackgroundAnimations.GetSize()-1) ); // add to the plan
m_aBGSegments.Add( BGSegment(aniseg.m_fStartBeat, m_BGAnimations.GetSize()-1) ); // add to the plan
continue; // stop looking for this background
}
@@ -235,9 +235,9 @@ void Background::LoadFromSong( Song* pSong )
break;
case MODE_MOVIE_BG:
{
pTempBGA = new BackgroundAnimation;
pTempBGA = new BGAnimation;
pTempBGA->LoadFromMovie( pSong->GetMovieBackgroundPath(), false, true, true, sSongBackgroundPath );
m_BackgroundAnimations.Add( pTempBGA );
m_BGAnimations.Add( pTempBGA );
}
break;
case MODE_MOVIE_VIS:
@@ -248,9 +248,9 @@ void Background::LoadFromSong( Song* pSong )
GetDirListing( VISUALIZATIONS_DIR + "*.mpeg", arrayPossibleMovies, false, true );
int index = rand() % arrayPossibleMovies.GetSize();
pTempBGA = new BackgroundAnimation;
pTempBGA = new BGAnimation;
pTempBGA->LoadFromVisualization( arrayPossibleMovies[index], sSongBackgroundPath );
m_BackgroundAnimations.Add( pTempBGA );
m_BGAnimations.Add( pTempBGA );
arrayPossibleMovies.RemoveAt( index );
}
break;
@@ -265,9 +265,9 @@ void Background::LoadFromSong( Song* pSong )
for( i=0; i<4 && arrayPossibleAnims.GetSize()>0; i++ )
{
int index = rand() % arrayPossibleAnims.GetSize();
pTempBGA = new BackgroundAnimation;
pTempBGA = new BGAnimation;
pTempBGA->LoadFromAniDir( arrayPossibleAnims[index], sSongBackgroundPath );
m_BackgroundAnimations.Add( pTempBGA );
m_BGAnimations.Add( pTempBGA );
arrayPossibleAnims.RemoveAt( index );
}
}
@@ -281,9 +281,9 @@ void Background::LoadFromSong( Song* pSong )
for( int i=0; i<4 && arrayPossibleMovies.GetSize()>0; i++ )
{
int index = rand() % arrayPossibleMovies.GetSize();
pTempBGA = new BackgroundAnimation;
pTempBGA = new BGAnimation;
pTempBGA->LoadFromMovie( arrayPossibleMovies[index], true, false, i==0, sSongBackgroundPath );
m_BackgroundAnimations.Add( pTempBGA );
m_BGAnimations.Add( pTempBGA );
arrayPossibleMovies.RemoveAt( index );
}
}
@@ -293,8 +293,8 @@ void Background::LoadFromSong( Song* pSong )
}
// At this point, m_BackgroundAnimations[0] is the song background, and everything else
// in m_BackgroundAnimations should be cycled through randomly while notes are playing.
// At this point, m_BGAnimations[0] is the song background, and everything else
// in m_BGAnimations should be cycled through randomly while notes are playing.
//
// Generate an animation plan
//
@@ -316,19 +316,19 @@ void Background::LoadFromSong( Song* pSong )
const float fFirstBeat = (m_BackgroundMode==MODE_MOVIE_BG) ? fMusicStartBeat : pSong->m_fFirstBeat;
const float fLastBeat = pSong->m_fLastBeat;
if( m_BackgroundAnimations.GetSize() == 2) {
if( m_BGAnimations.GetSize() == 2) {
m_aBGSegments.Add( BGSegment(fFirstBeat,1) );
} else {
// change BG every 4 bars
for( float f=fFirstBeat; f<fLastBeat; f+=16 )
{
int index;
if( m_BackgroundAnimations.GetSize()==1 )
if( m_BGAnimations.GetSize()==1 )
index = 0;
else if( f == fFirstBeat )
index = 1; // force the first random background to play first
else
index = 1 + rand()%(m_BackgroundAnimations.GetSize()-1);
index = 1 + rand()%(m_BGAnimations.GetSize()-1);
m_aBGSegments.Add( BGSegment(f,index) );
}
@@ -341,10 +341,10 @@ void Background::LoadFromSong( Song* pSong )
continue; // skip]
int index;
if( m_BackgroundAnimations.GetSize()==1 )
if( m_BGAnimations.GetSize()==1 )
index = 0;
else
index = 1 + int(bpmseg.m_fBPM)%(m_BackgroundAnimations.GetSize()-1);
index = 1 + int(bpmseg.m_fBPM)%(m_BGAnimations.GetSize()-1);
m_aBGSegments.Add( BGSegment(bpmseg.m_fStartBeat,index) );
}
}
@@ -356,11 +356,11 @@ void Background::LoadFromSong( Song* pSong )
SortBGSegmentArray( m_aBGSegments );
}
for( int i=0; i<m_BackgroundAnimations.GetSize(); i++ )
for( int i=0; i<m_BGAnimations.GetSize(); i++ )
{
m_BackgroundAnimations[i]->SetXY( (float)LEFT_EDGE, (float)TOP_EDGE );
m_BackgroundAnimations[i]->SetZoomX( fXZoom );
m_BackgroundAnimations[i]->SetZoomY( fYZoom );
m_BGAnimations[i]->SetXY( (float)LEFT_EDGE, (float)TOP_EDGE );
m_BGAnimations[i]->SetZoomX( fXZoom );
m_BGAnimations[i]->SetZoomY( fYZoom );
}
m_BGADanger.SetXY( (float)LEFT_EDGE, (float)TOP_EDGE );
+4 -4
View File
@@ -16,7 +16,7 @@
#include "Quad.h"
#include "ActorFrame.h"
#include "Song.h"
#include "BackgroundAnimation.h"
#include "BGAnimation.h"
struct BGSegment // like a BGChange, but holds index of a background instead of name
@@ -56,13 +56,13 @@ protected:
enum BackgroundMode { MODE_STATIC_BG, MODE_MOVIE_BG, MODE_ANIMATIONS, MODE_MOVIE_VIS, MODE_RANDOMMOVIES };
BackgroundMode m_BackgroundMode;
BackgroundAnimation m_BGADanger;
BGAnimation m_BGADanger;
// used in all BackgroundModes except OFF
CArray<BackgroundAnimation*,BackgroundAnimation*> m_BackgroundAnimations;
CArray<BGAnimation*,BGAnimation*> m_BGAnimations;
CArray<BGSegment,BGSegment&> m_aBGSegments;
int m_iCurBGSegment; // this increases as we move into new segments
BackgroundAnimation* GetCurBGA() { int index = m_aBGSegments[m_iCurBGSegment].m_iBGIndex; return m_BackgroundAnimations[index]; };
BGAnimation* GetCurBGA() { int index = m_aBGSegments[m_iCurBGSegment].m_iBGIndex; return m_BGAnimations[index]; };
Quad m_quadBGBrightness;
+3 -1
View File
@@ -40,9 +40,11 @@ public:
void TurnRainbowOn() { m_bRainbow = true; };
void TurnRainbowOff() { m_bRainbow = false; };
protected:
public:
CString m_sFontFilePath;
Font* m_pFont;
protected:
// recalculate the items below on SetText()
char m_szText[MAX_TEXT_CHARS];
+8 -8
View File
@@ -93,7 +93,7 @@ void Course::LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs )
}
void Course::CreateEndlessCourseFromGroupAndDifficultyClass( CString sGroupName, DifficultyClass dc, CArray<Song*,Song*> &apSongsInGroup )
void Course::CreateEndlessCourseFromGroupAndDifficulty( CString sGroupName, Difficulty dc, CArray<Song*,Song*> &apSongsInGroup )
{
m_bRepeat = true;
m_bRandomize = true;
@@ -112,15 +112,15 @@ void Course::CreateEndlessCourseFromGroupAndDifficultyClass( CString sGroupName,
m_sName = sShortGroupName + " ";
switch( dc )
{
case CLASS_EASY: m_sName += "Easy"; break;
case CLASS_MEDIUM: m_sName += "Medium"; break;
case CLASS_HARD: m_sName += "Hard"; break;
case DIFFICULTY_EASY: m_sName += "Easy"; break;
case DIFFICULTY_MEDIUM: m_sName += "Medium"; break;
case DIFFICULTY_HARD: m_sName += "Hard"; break;
}
for( int s=0; s<apSongsInGroup.GetSize(); s++ )
{
Song* pSong = apSongsInGroup[s];
AddStage( pSong, DifficultyClassToString(dc), "" );
AddStage( pSong, DifficultyToString(dc), "" );
}
Shuffle();
}
@@ -148,13 +148,13 @@ Notes* Course::GetNotesForStage( int iStage )
}
// Didn't find a matching description. Try to match the DifficultyClass instead.
DifficultyClass dc = Notes::DifficultyClassFromDescriptionAndMeter( sDescription, 5 );
// Didn't find a matching description. Try to match the Difficulty instead.
Difficulty dc = Notes::DifficultyFromDescriptionAndMeter( sDescription, 5 );
for( i=0; i<pSong->m_apNotes.GetSize(); i++ )
{
Notes* pNotes = pSong->m_apNotes[i];
if( pNotes->m_DifficultyClass == dc &&
if( pNotes->m_Difficulty == dc &&
GAMESTATE->GetCurrentStyleDef()->MatchesNotesType(pNotes->m_NotesType, 0) )
return pNotes;
}
+1 -1
View File
@@ -51,7 +51,7 @@ public:
void GetSongOptions( SongOptions* pSO_out);
void LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs );
void CreateEndlessCourseFromGroupAndDifficultyClass( CString sGroupName, DifficultyClass dc, CArray<Song*,Song*> &apSongsInGroup );
void CreateEndlessCourseFromGroupAndDifficulty( CString sGroupName, Difficulty dc, CArray<Song*,Song*> &apSongsInGroup );
void AddStage( Song* pSong, CString sDescription, CString sModifiers )
{
+1 -1
View File
@@ -66,7 +66,7 @@ void CourseContentDisplay::Load( int iNum, Song* pSong, Notes* pNotes )
m_textNumber.SetText( ssprintf("%d", iNum) );
D3DXCOLOR colorGroup = SONGMAN->GetSongColor( pSong );
D3DXCOLOR colorDifficulty = DifficultyClassToColor( pNotes->m_DifficultyClass );
D3DXCOLOR colorDifficulty = DifficultyToColor( pNotes->m_Difficulty );
m_TextBanner.LoadFromSong( pSong );
m_TextBanner.SetDiffuse( colorGroup );
+4 -4
View File
@@ -32,11 +32,11 @@ public:
if( pNotes != NULL )
{
SetDiffuse( D3DXCOLOR(1,1,1,1) );
switch( pNotes->m_DifficultyClass )
switch( pNotes->m_Difficulty )
{
case CLASS_EASY: SetState( 0 ); break;
case CLASS_MEDIUM: SetState( 1 ); break;
case CLASS_HARD: SetState( 2 ); break;
case DIFFICULTY_EASY: SetState( 0 ); break;
case DIFFICULTY_MEDIUM: SetState( 1 ); break;
case DIFFICULTY_HARD: SetState( 2 ); break;
}
}
else
+14 -14
View File
@@ -20,34 +20,34 @@
#define COLOR_HARD THEME->GetMetricC("Common","ColorHard")
D3DXCOLOR DifficultyClassToColor( DifficultyClass dc )
D3DXCOLOR DifficultyToColor( Difficulty dc )
{
switch( dc )
{
case CLASS_EASY: return COLOR_EASY;
case CLASS_MEDIUM: return COLOR_MEDIUM;
case CLASS_HARD: return COLOR_HARD;
default: ASSERT(0); return D3DXCOLOR(); // invalid DifficultyClass
case DIFFICULTY_EASY: return COLOR_EASY;
case DIFFICULTY_MEDIUM: return COLOR_MEDIUM;
case DIFFICULTY_HARD: return COLOR_HARD;
default: ASSERT(0); return D3DXCOLOR(); // invalid Difficulty
}
}
CString DifficultyClassToString( DifficultyClass dc )
CString DifficultyToString( Difficulty dc )
{
switch( dc )
{
case CLASS_EASY: return "easy";
case CLASS_MEDIUM: return "medium";
case CLASS_HARD: return "hard";
default: ASSERT(0); return ""; // invalid DifficultyClass
case DIFFICULTY_EASY: return "easy";
case DIFFICULTY_MEDIUM: return "medium";
case DIFFICULTY_HARD: return "hard";
default: ASSERT(0); return ""; // invalid Difficulty
}
}
DifficultyClass StringToDifficultyClass( CString sDC )
Difficulty StringToDifficulty( CString sDC )
{
for( int i=0; i<NUM_DIFFICULTY_CLASSES; i++ )
for( int i=0; i<NUM_DIFFICULTIES; i++ )
{
DifficultyClass dc = (DifficultyClass)i;
if( sDC == DifficultyClassToString(dc) )
Difficulty dc = (Difficulty)i;
if( sDC == DifficultyToString(dc) )
return dc;
}
return CLASS_INVALID;
+9 -13
View File
@@ -43,20 +43,20 @@ enum RadarCategory // starting from 12-o'clock rotating clockwise
NUM_RADAR_VALUES // leave this at the end
};
enum DifficultyClass
{
CLASS_EASY, // corresponds to Basic
CLASS_MEDIUM, // corresponds to Trick, Another, Standard
CLASS_HARD, // corresponds to Maniac, SSR, Heavy
NUM_DIFFICULTY_CLASSES,
enum Difficulty
{
DIFFICULTY_EASY, // corresponds to Basic, Easy
DIFFICULTY_MEDIUM, // corresponds to Trick, Another, Standard, Normal
DIFFICULTY_HARD, // corresponds to Maniac, SSR, Heavy, Crazy
NUM_DIFFICULTIES,
CLASS_INVALID
};
D3DXCOLOR DifficultyClassToColor( DifficultyClass dc );
D3DXCOLOR DifficultyToColor( Difficulty dc );
CString DifficultyClassToString( DifficultyClass dc );
CString DifficultyToString( Difficulty dc );
DifficultyClass StringToDifficultyClass( CString sDC );
Difficulty StringToDifficulty( CString sDC );
enum NotesType
@@ -69,13 +69,9 @@ enum NotesType
NOTES_TYPE_PUMP_DOUBLE,
NOTES_TYPE_PUMP_COUPLE,
NOTES_TYPE_EZ2_SINGLE,
NOTES_TYPE_EZ2_SINGLE_HARD,
NOTES_TYPE_EZ2_DOUBLE,
NOTES_TYPE_EZ2_REAL,
NOTES_TYPE_PARA,
// NOTES_TYPE_EZ2_SINGLE_VERSUS, // Chris: these should only be styles, not NotesTypes
// NOTES_TYPE_EZ2_SINGLE_HARD_VERSUS,
// NOTES_TYPE_EZ2_REAL_VERSUS,
NUM_NOTES_TYPES, // leave this at the end
NOTES_TYPE_INVALID,
};
+191 -61
View File
@@ -48,7 +48,6 @@ struct {
{ "pump-double", 10 },
{ "pump-couple", 10 },
{ "ez2-single", 5 }, // Single: TL,LHH,D,RHH,TR
{ "ez2-single-hard", 5 }, // Single: TL,LHH,D,RHH,TR
{ "ez2-double", 10 }, // Double: Single x2
{ "ez2-real", 7 }, // Real: TL,LHH,LHL,D,RHL,RHH,TR
{ "para-single", 5 }
@@ -774,35 +773,6 @@ StyleDef g_StyleDefs[NUM_STYLES] =
2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand
},
},
{ // EZ2_STYLE_SINGLE_HARD
GAME_EZ2, // m_Game
true, // m_bUsedForGameplay
true, // m_bUsedForEdit
"singleHard", // m_szName
{ NOTES_TYPE_EZ2_SINGLE_HARD,NOTES_TYPE_EZ2_SINGLE_HARD}, // m_NotesTypes
StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType
{ 160, 480 }, // m_iCenterX
5, // m_iColsPerPlayer
{ // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER];
{ // PLAYER_1
{ TRACK_1, GAME_CONTROLLER_1, EZ2_BUTTON_FOOTUPLEFT, -EZ2_COL_SPACING*2 },
{ TRACK_2, GAME_CONTROLLER_1, EZ2_BUTTON_HANDUPLEFT, -EZ2_COL_SPACING*1 },
{ TRACK_3, GAME_CONTROLLER_1, EZ2_BUTTON_FOOTDOWN, +EZ2_COL_SPACING*0 },
{ TRACK_4, GAME_CONTROLLER_1, EZ2_BUTTON_HANDUPRIGHT, +EZ2_COL_SPACING*1 },
{ TRACK_5, GAME_CONTROLLER_1, EZ2_BUTTON_FOOTUPRIGHT, +EZ2_COL_SPACING*2 },
},
{ // PLAYER_2
{ TRACK_1, GAME_CONTROLLER_2, EZ2_BUTTON_FOOTUPLEFT, -EZ2_COL_SPACING*2 },
{ TRACK_2, GAME_CONTROLLER_2, EZ2_BUTTON_HANDUPLEFT, -EZ2_COL_SPACING*1 },
{ TRACK_3, GAME_CONTROLLER_2, EZ2_BUTTON_FOOTDOWN, +EZ2_COL_SPACING*0 },
{ TRACK_4, GAME_CONTROLLER_2, EZ2_BUTTON_HANDUPRIGHT, +EZ2_COL_SPACING*1 },
{ TRACK_5, GAME_CONTROLLER_2, EZ2_BUTTON_FOOTUPRIGHT, +EZ2_COL_SPACING*2 },
},
},
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand
},
},
{ // EZ2_STYLE_REAL
GAME_EZ2, // m_Game
true, // m_bUsedForGameplay
@@ -904,35 +874,6 @@ StyleDef g_StyleDefs[NUM_STYLES] =
2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand
},
},
{ // EZ2_STYLE_SINGLE_VERSUS
GAME_EZ2, // m_Game
true, // m_bUsedForGameplay
true, // m_bUsedForEdit
"versusHard", // m_szName
{ NOTES_TYPE_EZ2_SINGLE_HARD,NOTES_TYPE_EZ2_SINGLE_HARD }, // m_NotesTypes
StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType
{ 160, 480 }, // m_iCenterX
5, // m_iColsPerPlayer
{ // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER];
{ // PLAYER_1
{ TRACK_1, GAME_CONTROLLER_1, EZ2_BUTTON_FOOTUPLEFT, -EZ2_COL_SPACING*2 },
{ TRACK_2, GAME_CONTROLLER_1, EZ2_BUTTON_HANDUPLEFT, -EZ2_COL_SPACING*1 },
{ TRACK_3, GAME_CONTROLLER_1, EZ2_BUTTON_FOOTDOWN, +EZ2_COL_SPACING*0 },
{ TRACK_4, GAME_CONTROLLER_1, EZ2_BUTTON_HANDUPRIGHT, +EZ2_COL_SPACING*1 },
{ TRACK_5, GAME_CONTROLLER_1, EZ2_BUTTON_FOOTUPRIGHT, +EZ2_COL_SPACING*2 },
},
{ // PLAYER_2
{ TRACK_1, GAME_CONTROLLER_2, EZ2_BUTTON_FOOTUPLEFT, -EZ2_COL_SPACING*2 },
{ TRACK_2, GAME_CONTROLLER_2, EZ2_BUTTON_HANDUPLEFT, -EZ2_COL_SPACING*1 },
{ TRACK_3, GAME_CONTROLLER_2, EZ2_BUTTON_FOOTDOWN, +EZ2_COL_SPACING*0 },
{ TRACK_4, GAME_CONTROLLER_2, EZ2_BUTTON_HANDUPRIGHT, +EZ2_COL_SPACING*1 },
{ TRACK_5, GAME_CONTROLLER_2, EZ2_BUTTON_FOOTUPRIGHT, +EZ2_COL_SPACING*2 },
},
},
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand
},
},
{ // EZ2_STYLE_REAL_VERSUS
GAME_EZ2, // m_Game
true, // m_bUsedForGameplay
@@ -998,6 +939,188 @@ StyleDef g_StyleDefs[NUM_STYLES] =
};
ModeChoice g_ModeChoices[] =
{
{
GAME_DANCE,
PLAY_MODE_ARCADE,
STYLE_DANCE_SINGLE,
DIFFICULTY_MEDIUM,
"single",
1
},
{
GAME_DANCE,
PLAY_MODE_ARCADE,
STYLE_DANCE_VERSUS,
DIFFICULTY_MEDIUM,
"versus",
2
},
{
GAME_DANCE,
PLAY_MODE_ARCADE,
STYLE_DANCE_DOUBLE,
DIFFICULTY_MEDIUM,
"double",
2
},
{
GAME_DANCE,
PLAY_MODE_ARCADE,
STYLE_DANCE_COUPLE,
DIFFICULTY_MEDIUM,
"couple",
2
},
{
GAME_DANCE,
PLAY_MODE_ARCADE,
STYLE_DANCE_SOLO,
DIFFICULTY_MEDIUM,
"solo",
1
},
{
GAME_PUMP,
PLAY_MODE_ARCADE,
STYLE_PUMP_SINGLE,
DIFFICULTY_EASY,
"normal",
1
},
{
GAME_PUMP,
PLAY_MODE_ARCADE,
STYLE_PUMP_SINGLE,
DIFFICULTY_MEDIUM,
"hard",
1
},
{
GAME_PUMP,
PLAY_MODE_ARCADE,
STYLE_PUMP_SINGLE,
DIFFICULTY_HARD,
"crazy",
1
},
{
GAME_PUMP,
PLAY_MODE_ARCADE,
STYLE_PUMP_VERSUS,
DIFFICULTY_EASY,
"normal",
2
},
{
GAME_PUMP,
PLAY_MODE_ARCADE,
STYLE_PUMP_VERSUS,
DIFFICULTY_MEDIUM,
"hard",
2
},
{
GAME_PUMP,
PLAY_MODE_ARCADE,
STYLE_PUMP_VERSUS,
DIFFICULTY_HARD,
"crazy",
2
},
{
GAME_PUMP,
PLAY_MODE_ARCADE,
STYLE_PUMP_COUPLE,
DIFFICULTY_MEDIUM,
"battle",
2
},
{
GAME_PUMP,
PLAY_MODE_ARCADE,
STYLE_PUMP_DOUBLE,
DIFFICULTY_MEDIUM,
"double",
1
},
{
GAME_PUMP,
PLAY_MODE_ONI,
STYLE_PUMP_SINGLE,
DIFFICULTY_MEDIUM,
"nonstop",
1
},
{
GAME_PUMP,
PLAY_MODE_ONI,
STYLE_PUMP_VERSUS,
DIFFICULTY_MEDIUM,
"nonstop",
2
},
{
GAME_EZ2,
PLAY_MODE_ARCADE,
STYLE_EZ2_SINGLE,
DIFFICULTY_EASY,
"easy",
1
},
{
GAME_EZ2,
PLAY_MODE_ARCADE,
STYLE_EZ2_SINGLE,
DIFFICULTY_HARD,
"hard",
1
},
{
GAME_EZ2,
PLAY_MODE_ARCADE,
STYLE_EZ2_REAL,
DIFFICULTY_MEDIUM,
"real",
1
},
{
GAME_EZ2,
PLAY_MODE_ARCADE,
STYLE_EZ2_DOUBLE,
DIFFICULTY_MEDIUM,
"club",
1
},
{
GAME_EZ2,
PLAY_MODE_ARCADE,
STYLE_EZ2_SINGLE_VERSUS,
DIFFICULTY_EASY,
"easy",
2
},
{
GAME_EZ2,
PLAY_MODE_ARCADE,
STYLE_EZ2_SINGLE_VERSUS,
DIFFICULTY_HARD,
"hard",
2
},
{
GAME_EZ2,
PLAY_MODE_ARCADE,
STYLE_EZ2_REAL_VERSUS,
DIFFICULTY_MEDIUM,
"real",
2
},
};
const int NUM_MODE_CHOICES = sizeof(g_ModeChoices) / sizeof(g_ModeChoices[0]);
GameManager::GameManager()
{
m_pIniFile = new IniFile;
@@ -1010,13 +1133,13 @@ GameManager::~GameManager()
GameDef* GameManager::GetGameDefForGame( Game g )
{
ASSERT( g != GAME_INVALID );
ASSERT( g != GAME_INVALID ); // the game must be set before calling this
return &g_GameDefs[ g ];
}
const StyleDef* GameManager::GetStyleDefForStyle( Style s )
{
ASSERT( s != STYLE_NONE );
ASSERT( s != STYLE_NONE ); // the style must be set before calling this
return &g_StyleDefs[ s ];
}
@@ -1034,6 +1157,13 @@ void GameManager::GetGameplayStylesForGame( Game game, CArray<Style,Style>& aSty
}
}
void GameManager::GetModesChoicesForGame( Game game, CArray<ModeChoice,ModeChoice>& aChoicesAddTo )
{
for( int s=0; s<NUM_MODE_CHOICES; s++ )
if( g_ModeChoices[s].game == game)
aChoicesAddTo.Add( g_ModeChoices[s] );
}
void GameManager::GetNotesTypesForGame( Game game, CArray<NotesType,NotesType>& aNotesTypeAddTo )
{
for( int nt=0; nt<NUM_NOTES_TYPES; nt++ )
+12
View File
@@ -17,6 +17,17 @@
class IniFile;
struct ModeChoice // used in SelectMode
{
Game game;
PlayMode pm;
Style style;
Difficulty dc;
char name[64];
int numSidesJoinedToPlay;
};
class GameManager
{
public:
@@ -27,6 +38,7 @@ public:
const StyleDef* GetStyleDefForStyle( Style s );
void GetGameplayStylesForGame( Game game, CArray<Style,Style>& aStylesAddTo, bool editor=false );
void GetModesChoicesForGame( Game game, CArray<ModeChoice,ModeChoice>& aChoicesAddTo );
void GetNotesTypesForGame( Game game, CArray<NotesType,NotesType>& aNotesTypeAddTo ); // only look at edit-specific styles
// void GetGameNames( CStringArray &AddTo );
+3 -1
View File
@@ -55,7 +55,7 @@ void GameState::Reset()
m_MasterPlayerNumber = PLAYER_INVALID;
m_sPreferredGroup = "";
for( p=0; p<NUM_PLAYERS; p++ )
m_PreferredDifficultyClass[p] = CLASS_INVALID;
m_PreferredDifficulty[p] = CLASS_INVALID;
m_SongSortOrder = SORT_GROUP;
m_PlayMode = PLAY_MODE_INVALID;
m_bEditing = false;
@@ -262,11 +262,13 @@ D3DXCOLOR GameState::GetStageColor()
GameDef* GameState::GetCurrentGameDef()
{
ASSERT( m_CurGame != GAME_INVALID ); // the game must be set before calling this
return GAMEMAN->GetGameDefForGame( m_CurGame );
}
const StyleDef* GameState::GetCurrentStyleDef()
{
ASSERT( m_CurStyle != STYLE_NONE ); // the style must be set before calling this
return GAMEMAN->GetStyleDefForStyle( m_CurStyle );
}
+10 -1
View File
@@ -40,6 +40,15 @@ public:
bool m_bPlayersCanJoin; // true if it's not too late for a player to join - this only has an effect on the credits message
bool m_bSideIsJoined[2]; // left side, right side
PlayerNumber m_MasterPlayerNumber;
int GetNumSidesJoined()
{
int iNumSidesJoined = 0;
for( int c=0; c<2; c++ )
if( m_bSideIsJoined[c] )
iNumSidesJoined++; // left side, and right side
return iNumSidesJoined;
};
GameDef* GetCurrentGameDef();
const StyleDef* GetCurrentStyleDef();
@@ -49,7 +58,7 @@ public:
CString m_sLoadingMessage;
CString m_sPreferredGroup;
DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS];
Difficulty m_PreferredDifficulty[NUM_PLAYERS];
SongSortOrder m_SongSortOrder; // used by MusicWheel
PlayMode m_PlayMode;
bool m_bEditing; // NoteField does special stuff when this is true
+3 -3
View File
@@ -22,7 +22,7 @@
#include "TransitionKeepAlive.h"
#include "TransitionInvisible.h"
#include "TipDisplay.h"
#include "BackgroundAnimation.h"
#include "BGAnimation.h"
const float MENU_ELEMENTS_TWEEN_TIME = 0.5f;
@@ -61,12 +61,12 @@ protected:
void TweenBottomLayerOnScreen();
void TweenBottomLayerOffScreen();
public:
Sprite m_sprTopEdge;
Sprite m_sprStyleIcon;
MenuTimer m_MenuTimer;
Sprite m_sprBottomEdge;
BackgroundAnimation m_Background;
BGAnimation m_Background;
Quad m_quadBrightness; // for darkening the background
TipDisplay m_textHelp;
+9 -5
View File
@@ -26,13 +26,17 @@ MenuTimer::MenuTimer()
m_bTimerStopped = false;
m_textDigit1.LoadFromNumbers( THEME->GetPathTo("Numbers","menu timer numbers") );
m_textDigit1.TurnShadowOff();
m_textDigit1.SetXY( -18, 0 );
this->AddChild( &m_textDigit1 );
m_textDigit2.LoadFromNumbers( THEME->GetPathTo("Numbers","menu timer numbers") );
m_textDigit1.TurnShadowOff();
m_textDigit2.TurnShadowOff();
m_textDigit2.SetXY( +18, 0 );
float fCharWidth = (float)m_textDigit1.m_pFont->m_pTexture->GetSourceFrameWidth();
m_textDigit1.SetXY( -fCharWidth/2, 0 );
m_textDigit2.SetXY( +fCharWidth/2, 0 );
this->AddChild( &m_textDigit1 );
this->AddChild( &m_textDigit2 );
m_soundBeep.Load( THEME->GetPathTo("Sounds","menu timer") );
+2 -2
View File
@@ -186,8 +186,8 @@ void WheelItemDisplay::RefreshGrades()
if( m_pSong ) // this is a song display
{
const DifficultyClass dc = GAMESTATE->m_PreferredDifficultyClass[p];
const Grade grade = m_pSong->GetGradeForDifficultyClass( GAMESTATE->GetCurrentStyleDef(), p, dc );
const Difficulty dc = GAMESTATE->m_PreferredDifficulty[p];
const Grade grade = m_pSong->GetGradeForDifficulty( GAMESTATE->GetCurrentStyleDef(), p, dc );
m_GradeDisplay[p].SetGrade( (PlayerNumber)p, grade );
//m_GradeDisplay[p].SetDiffuse( PlayerToColor((PlayerNumber)p) );
}
-1
View File
@@ -515,7 +515,6 @@ void NoteData::Turn( PlayerOptions::TurnType tt )
iTakeFromTrack[9] = 5;
break;
case NOTES_TYPE_EZ2_SINGLE:
case NOTES_TYPE_EZ2_SINGLE_HARD:
case NOTES_TYPE_EZ2_DOUBLE:
case NOTES_TYPE_EZ2_REAL:
// identity transform. What should we do here?
+19 -19
View File
@@ -33,7 +33,7 @@ Notes::Notes()
* it'd trip obscure asserts all over the place, so I'll wait
* until after b6 to do this. -glenn */
m_NotesType = NOTES_TYPE_DANCE_SINGLE;
m_DifficultyClass = CLASS_INVALID;
m_Difficulty = CLASS_INVALID;
m_iMeter = 0;
ZeroMemory(m_fRadarValues, sizeof(m_fRadarValues));
@@ -54,7 +54,7 @@ void Notes::WriteSMNotesTag( FILE* fp )
fprintf( fp, "#NOTES:\n" );
fprintf( fp, " %s:\n", GameManager::NotesTypeToString(m_NotesType) );
fprintf( fp, " %s:\n", m_sDescription );
fprintf( fp, " %s:\n", DifficultyClassToString(m_DifficultyClass) );
fprintf( fp, " %s:\n", DifficultyToString(m_Difficulty) );
fprintf( fp, " %d:\n", m_iMeter );
CStringArray asRadarValues;
@@ -77,7 +77,7 @@ void Notes::GetNoteData( NoteData* pNoteDataOut ) const
pNoteDataOut->LoadFromSMNoteDataString( m_sSMNoteData );
}
// Color is a function of DifficultyClass and Intended Style
// Color is a function of Difficulty and Intended Style
D3DXCOLOR Notes::GetColor() const
{
CString sDescription = m_sDescription;
@@ -88,32 +88,32 @@ D3DXCOLOR Notes::GetColor() const
else if( -1 != m_sDescription.Find("couple") )
return D3DXCOLOR(0,0,1,1); // blue
else
return DifficultyClassToColor( m_DifficultyClass );
return DifficultyToColor( m_Difficulty );
}
void Notes::TidyUpData()
{
if( m_DifficultyClass == CLASS_INVALID )
m_DifficultyClass = DifficultyClassFromDescriptionAndMeter( m_sDescription, m_iMeter );
if( m_Difficulty == CLASS_INVALID )
m_Difficulty = DifficultyFromDescriptionAndMeter( m_sDescription, m_iMeter );
if( m_iMeter < 1 || m_iMeter > 10 )
{
switch( m_DifficultyClass )
switch( m_Difficulty )
{
case CLASS_EASY: m_iMeter = 3; break;
case CLASS_MEDIUM: m_iMeter = 5; break;
case CLASS_HARD: m_iMeter = 8; break;
case DIFFICULTY_EASY: m_iMeter = 3; break;
case DIFFICULTY_MEDIUM: m_iMeter = 5; break;
case DIFFICULTY_HARD: m_iMeter = 8; break;
default: ASSERT(0);
}
}
}
DifficultyClass Notes::DifficultyClassFromDescriptionAndMeter( CString sDescription, int iMeter )
Difficulty Notes::DifficultyFromDescriptionAndMeter( CString sDescription, int iMeter )
{
sDescription.MakeLower();
const int DESCRIPTIONS_PER_CLASS = 4;
const CString sDescriptionParts[NUM_DIFFICULTY_CLASSES][DESCRIPTIONS_PER_CLASS] = {
const CString sDescriptionParts[NUM_DIFFICULTIES][DESCRIPTIONS_PER_CLASS] = {
{
"easy",
"basic",
@@ -134,15 +134,15 @@ DifficultyClass Notes::DifficultyClassFromDescriptionAndMeter( CString sDescript
},
};
for( int i=0; i<NUM_DIFFICULTY_CLASSES; i++ )
for( int i=0; i<NUM_DIFFICULTIES; i++ )
for( int j=0; j<DESCRIPTIONS_PER_CLASS; j++ )
if( sDescription.Find(sDescriptionParts[i][j]) != -1 )
return DifficultyClass(i);
return Difficulty(i);
// guess difficulty class from meter
if( iMeter <= 3 ) return CLASS_EASY;
else if( iMeter <= 6 ) return CLASS_MEDIUM;
else return CLASS_HARD;
if( iMeter <= 3 ) return DIFFICULTY_EASY;
else if( iMeter <= 6 ) return DIFFICULTY_MEDIUM;
else return DIFFICULTY_HARD;
}
@@ -190,8 +190,8 @@ int CompareNotesPointersByMeter(const void *arg1, const void *arg2)
int CompareNotesPointersByDifficulty(Notes* pNotes1, Notes* pNotes2)
{
DifficultyClass class1 = pNotes1->m_DifficultyClass;
DifficultyClass class2 = pNotes2->m_DifficultyClass;
Difficulty class1 = pNotes1->m_Difficulty;
Difficulty class2 = pNotes2->m_Difficulty;
if( class1 < class2 )
return -1;
+2 -2
View File
@@ -30,7 +30,7 @@ public:
public:
NotesType m_NotesType;
CString m_sDescription; // This text is displayed next to thte number of feet when a song is selected
DifficultyClass m_DifficultyClass; // this is inferred from m_sDescription
Difficulty m_Difficulty; // this is inferred from m_sDescription
int m_iMeter; // difficulty from 1-10
float m_fRadarValues[NUM_RADAR_VALUES]; // between 0.0-1.2 starting from 12-o'clock rotating clockwise
@@ -45,7 +45,7 @@ public:
int m_iMaxCombo;
int m_iNumTimesPlayed;
static DifficultyClass DifficultyClassFromDescriptionAndMeter( CString sDescription, int iMeter );
static Difficulty DifficultyFromDescriptionAndMeter( CString sDescription, int iMeter );
void TidyUpData();
+1 -1
View File
@@ -124,7 +124,7 @@ bool DWILoader::LoadFromDWITokens(
out.m_iMeter = atoi( sNumFeet );
//m_DifficultyClass = DifficultyClassFromDescriptionAndMeter( m_sDescription, m_iMeter );
//m_Difficulty = DifficultyFromDescriptionAndMeter( m_sDescription, m_iMeter );
NoteData* pNoteData = new NoteData;
ASSERT( pNoteData );
+4 -4
View File
@@ -101,22 +101,22 @@ bool KSFLoader::LoadFromKSFFile( const CString &sPath, Notes &out )
out.m_sDescription = sFName;
if( sFName.Find("crazy")!=-1 )
{
out.m_DifficultyClass = CLASS_HARD;
out.m_Difficulty = DIFFICULTY_HARD;
if(!out.m_iMeter) out.m_iMeter = 8;
}
else if( sFName.Find("hard")!=-1 )
{
out.m_DifficultyClass = CLASS_MEDIUM;
out.m_Difficulty = DIFFICULTY_MEDIUM;
if(!out.m_iMeter) out.m_iMeter = 5;
}
else if( sFName.Find("easy")!=-1 )
{
out.m_DifficultyClass = CLASS_EASY;
out.m_Difficulty = DIFFICULTY_EASY;
if(!out.m_iMeter) out.m_iMeter = 2;
}
else
{
out.m_DifficultyClass = CLASS_MEDIUM;
out.m_Difficulty = DIFFICULTY_MEDIUM;
if(!out.m_iMeter) out.m_iMeter = 5;
}
+4 -4
View File
@@ -10,7 +10,7 @@
void SMLoader::LoadFromSMTokens(
CString sNotesType,
CString sDescription,
CString sDifficultyClass,
CString sDifficulty,
CString sMeter,
CString sRadarValues,
CString sNoteData,
@@ -21,15 +21,15 @@ void SMLoader::LoadFromSMTokens(
sNotesType.TrimRight();
sDescription.TrimLeft();
sDescription.TrimRight();
sDifficultyClass.TrimLeft();
sDifficultyClass.TrimRight();
sDifficulty.TrimLeft();
sDifficulty.TrimRight();
// LOG->Trace( "Notes::LoadFromSMTokens()" );
out.m_NotesType = GameManager::StringToNotesType(sNotesType);
out.m_sDescription = sDescription;
out.m_DifficultyClass = StringToDifficultyClass( sDifficultyClass );
out.m_Difficulty = StringToDifficulty( sDifficulty );
out.m_iMeter = atoi(sMeter);
CStringArray saValues;
split( sRadarValues, ",", saValues, true );
+1 -1
View File
@@ -9,7 +9,7 @@ class SMLoader: public NotesLoader {
void LoadFromSMTokens(
CString sNotesType,
CString sDescription,
CString sDifficultyClass,
CString sDifficulty,
CString sMeter,
CString sRadarValues,
CString sNoteData,
+4 -4
View File
@@ -187,11 +187,11 @@ bool NotesWriterDWI::WriteDWINotesTag( FILE* fp, const Notes &out )
default: return false; // not a type supported by DWI
}
switch( out.m_DifficultyClass )
switch( out.m_Difficulty )
{
case CLASS_EASY: fprintf( fp, "BASIC:" ); break;
case CLASS_MEDIUM: fprintf( fp, "ANOTHER:" ); break;
case CLASS_HARD: fprintf( fp, "MANIAC:" ); break;
case DIFFICULTY_EASY: fprintf( fp, "BASIC:" ); break;
case DIFFICULTY_MEDIUM: fprintf( fp, "ANOTHER:" ); break;
case DIFFICULTY_HARD: fprintf( fp, "MANIAC:" ); break;
default: ASSERT(0); return false;
}
+1 -1
View File
@@ -50,7 +50,7 @@ CString SecondsToTime( float fSecs )
int iMinsDisplay = (int)fSecs/60;
int iSecsDisplay = (int)fSecs - iMinsDisplay*60;
float fLeftoverDisplay = (fSecs - iMinsDisplay*60 - iSecsDisplay) * 100;
return ssprintf( "%02d:%02d:%02f", iMinsDisplay, iSecsDisplay, fLeftoverDisplay );
return ssprintf( "%02d:%02d:%02.0f", iMinsDisplay, iSecsDisplay, fLeftoverDisplay );
}
//-----------------------------------------------------------------------------
+2 -2
View File
@@ -17,7 +17,7 @@
#include "TransitionFade.h"
#include "TransitionFadeWipe.h"
#include "RandomSample.h"
#include "BackgroundAnimation.h"
#include "BGAnimation.h"
class ScreenCaution : public Screen
@@ -31,7 +31,7 @@ public:
protected:
void MenuStart( PlayerNumber pn );
void MenuBack( PlayerNumber pn );
BackgroundAnimation m_Background;
BGAnimation m_Background;
TransitionFade m_Wipe;
TransitionFadeWipe m_FadeWipe;
};
+4 -4
View File
@@ -187,7 +187,7 @@ ScreenEdit::ScreenEdit()
if( m_pNotes == NULL )
{
m_pNotes = new Notes;
m_pNotes->m_DifficultyClass = CLASS_MEDIUM;
m_pNotes->m_Difficulty = DIFFICULTY_MEDIUM;
m_pNotes->m_NotesType = GAMESTATE->GetCurrentStyleDef()->m_NotesTypes[0];
m_pNotes->m_sDescription = "Untitled";
@@ -487,7 +487,7 @@ void ScreenEdit::Update( float fDeltaTime )
GAMESTATE->m_fSongBeat,
m_NoteFieldEdit.m_fBeginMarker, m_NoteFieldEdit.m_fEndMarker,
GAMESTATE->m_SongOptions.m_fMusicRate,
DifficultyClassToString( m_pNotes->m_DifficultyClass ),
DifficultyToString( m_pNotes->m_Difficulty ),
GAMESTATE->m_pCurNotes[PLAYER_1] ? GAMESTATE->m_pCurNotes[PLAYER_1]->m_sDescription : "no description",
m_pSong->m_sMainTitle,
m_pSong->m_sSubTitle,
@@ -1020,8 +1020,8 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
case DIK_D:
{
DifficultyClass &dc = m_pNotes->m_DifficultyClass;
dc = DifficultyClass( (dc+1)%NUM_DIFFICULTY_CLASSES );
Difficulty &dc = m_pNotes->m_Difficulty;
dc = Difficulty( (dc+1)%NUM_DIFFICULTIES );
}
break;
+1 -1
View File
@@ -342,7 +342,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
if( GAMESTATE->m_pCurNotes[p]->m_DifficultyClass == CLASS_HARD && grade[p] >= GRADE_AA )
if( GAMESTATE->m_pCurNotes[p]->m_Difficulty == DIFFICULTY_HARD && grade[p] >= GRADE_AA )
m_bTryExtraStage = true;
}
}
+6 -13
View File
@@ -147,21 +147,14 @@ void ScreenEz2SelectPlayer::HandleScreenMessage( const ScreenMessage SM )
switch( SM )
{
case SM_MenuTimer:
if( GAMESTATE->GetNumSidesJoined() == 0 )
{
bool bAtLeastOneJoined = false;
for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->m_bSideIsJoined[p] )
bAtLeastOneJoined = true;
if( !bAtLeastOneJoined )
{
MenuStart(PLAYER_1);
m_Menu.StopTimer();
}
TweenOffScreen();
m_Menu.TweenOffScreenToMenu( SM_GoToNextScreen );
MenuStart(PLAYER_1);
m_Menu.StopTimer();
}
TweenOffScreen();
m_Menu.TweenOffScreenToMenu( SM_GoToNextScreen );
break;
case SM_GoToPrevScreen:
MUSIC->Stop();
+1 -1
View File
@@ -40,5 +40,5 @@ private:
MenuElements m_Menu;
RageSoundSample m_soundSelect;
BackgroundAnimation m_Background;
BGAnimation m_Background;
};
+44 -184
View File
@@ -28,18 +28,17 @@ const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User + 1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User + 2);
#define CURSOR_X( p ) THEME->GetMetricF("ScreenEz2SelectStyle",ssprintf("CursorP%dX",p+1))
#define CURSOR_Y( i ) THEME->GetMetricF("ScreenEz2SelectStyle",ssprintf("CursorP%dY",i+1))
#define CONTROLLER_X( p ) THEME->GetMetricF("ScreenEz2SelectStyle",ssprintf("ControllerP%dX",p+1))
#define CONTROLLER_Y( i ) THEME->GetMetricF("ScreenEz2SelectStyle",ssprintf("ControllerP%dY",i+1))
#define HELP_TEXT THEME->GetMetric("ScreenEz2SelectStyle","HelpText")
#define TIMER_SECONDS THEME->GetMetricI("ScreenEz2SelectStyle","TimerSeconds")
#define NEXT_SCREEN THEME->GetMetric("ScreenEz2SelectStyle","NextScreen")
#define USE_METRIC_FOR_MENU THEME->GetMetricI("ScreenEz2SelectStyle","UseMetricForMenu")
#define SCROLLING_ELEMENT_SPACING THEME->GetMetricI("ScreenEz2SelectStyle","ScrollingElementSpacing")
#define DISABLE_2P THEME->GetMetricI("ScreenEz2SelectStyle","Disable2p")
#define SCROLLING_LIST_Y THEME->GetMetricF("ScreenEz2SelectStyle","ScrollingListY")
#define NUM_BG_ANIMS THEME->GetMetricF("ScreenEz2SelectStyle","NumStyles")
#define CURSOR_X( p ) THEME->GetMetricF("ScreenEz2SelectStyle",ssprintf("CursorP%dX",p+1))
#define CURSOR_Y( i ) THEME->GetMetricF("ScreenEz2SelectStyle",ssprintf("CursorP%dY",i+1))
#define CONTROLLER_X( p ) THEME->GetMetricF("ScreenEz2SelectStyle",ssprintf("ControllerP%dX",p+1))
#define CONTROLLER_Y( i ) THEME->GetMetricF("ScreenEz2SelectStyle",ssprintf("ControllerP%dY",i+1))
#define HELP_TEXT THEME->GetMetric("ScreenEz2SelectStyle","HelpText")
#define TIMER_SECONDS THEME->GetMetricI("ScreenEz2SelectStyle","TimerSeconds")
#define NEXT_SCREEN THEME->GetMetric("ScreenEz2SelectStyle","NextScreen")
#define SCROLLING_ELEMENT_SPACING THEME->GetMetricI("ScreenEz2SelectStyle","ScrollingElementSpacing")
#define SCROLLING_LIST_X THEME->GetMetricF("ScreenEz2SelectStyle","ScrollingListX")
#define SCROLLING_LIST_Y THEME->GetMetricF("ScreenEz2SelectStyle","ScrollingListY")
#define CHANGE_BG_ANIMATIONS THEME->GetMetricB("ScreenEz2SelectStyle","ChangeBGAnimations")
const float TWEEN_TIME = 0.35f;
@@ -58,21 +57,8 @@ ScreenEz2SelectStyle::ScreenEz2SelectStyle()
/*********** TODO: MAKE THIS WORK FOR ALL GAME STYLES! *************/
for (int i=0; i<NUM_BG_ANIMS; i++)
{
this->AddChild( &m_BGAnim[i] );
m_BGAnim[i].UpdateMetrics(i);
m_BGAnim[i].SetZoom(0.0f); // hide the background
m_Background[i].LoadFromAniDir( THEME->GetPathTo("BGAnimations",ssprintf("ez2 select style %d", i)) );
this->AddChild( &m_Background[i] ); // animated background =)
m_Background[i].SetZoom( 0.0f );
}
m_Background[0].SetZoom(1.0f);
m_BGAnim[0].SetZoom(1.0f);
m_StyleListFrame.Load( THEME->GetPathTo("Graphics","StyleListFrame"));
m_StyleListFrame.SetXY( CENTER_X, SCROLLING_LIST_Y);
m_StyleListFrame.SetXY( SCROLLING_LIST_X, SCROLLING_LIST_Y);
this->AddChild( &m_StyleListFrame );
m_ScrollingList.SetXY( CENTER_X, SCROLLING_LIST_Y );
@@ -111,20 +97,13 @@ ScreenEz2SelectStyle::ScreenEz2SelectStyle()
this->AddChild( &m_Menu );
m_soundSelect.Load( THEME->GetPathTo("Sounds","menu start") );
m_soundChange.Load( THEME->GetPathTo("Sounds","select style change") );
m_soundChange.Load( THEME->GetPathTo("Sounds","select style change"), 10 );
SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("select style intro") );
MUSIC->LoadAndPlayIfNotAlready( THEME->GetPathTo("Sounds","select style music") );
if (USE_METRIC_FOR_MENU == 1) // get it from the metrics
{
RefreshStylesAndListFromMetrics();
}
else // get it from the styles......
{
RefreshStylesAndList();
}
RefreshModeChoices();
TweenOnScreen();
m_Menu.TweenOnScreenFromBlack( SM_None );
@@ -188,21 +167,11 @@ void ScreenEz2SelectStyle::HandleScreenMessage( const ScreenMessage SM )
switch( SM )
{
case SM_MenuTimer:
{
bool bAtLeastOneJoined = false;
for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->m_bSideIsJoined[p] )
bAtLeastOneJoined = true;
MenuStart(PLAYER_1);
m_Menu.StopTimer();
if( !bAtLeastOneJoined )
{
MenuStart(PLAYER_1);
m_Menu.StopTimer();
}
TweenOffScreen();
m_Menu.TweenOffScreenToMenu( SM_GoToNextScreen );
}
TweenOffScreen();
m_Menu.TweenOffScreenToMenu( SM_GoToNextScreen );
break;
case SM_GoToPrevScreen:
MUSIC->Stop();
@@ -214,78 +183,27 @@ void ScreenEz2SelectStyle::HandleScreenMessage( const ScreenMessage SM )
}
}
void ScreenEz2SelectStyle::RefreshStylesAndListFromMetrics()
void ScreenEz2SelectStyle::RefreshModeChoices()
{
int numstyles = THEME->GetMetricI("ScreenEz2SelectStyle","NumStyles"); // get the number of styles we need
int numstyles2p = THEME->GetMetricI("ScreenEz2SelectStyle","NumStyles2p"); // get the number of styles we need
int iNumSidesJoined = GAMESTATE->GetNumSidesJoined();
int iNumSidesJoined = 0;
for( int c=0; c<2; c++ )
if( GAMESTATE->m_bSideIsJoined[c] )
iNumSidesJoined++; // left side, and right side
GAMEMAN->GetModesChoicesForGame( GAMESTATE->m_CurGame, m_aPossibleModeChoices );
CStringArray asGraphicPaths;
if( iNumSidesJoined == 2 ) // we got two players
{
for (int i=0; i<numstyles2p; i++) // load in the graphics we want to use
{
asGraphicPaths.Add( THEME->GetPathTo("Graphics",ssprintf("%s",THEME->GetMetric("ScreenEz2SelectStyle",ssprintf("StyleGraphic2p%d",i) ) ) ) );
}
}
else // else we got one player
{
for (int i=0; i<numstyles; i++) // load in the graphics we want to use
{
asGraphicPaths.Add( THEME->GetPathTo("Graphics",ssprintf("%s",THEME->GetMetric("ScreenEz2SelectStyle",ssprintf("StyleGraphic%d",i) ) ) ) );
}
}
m_ScrollingList.Load( asGraphicPaths );
}
void ScreenEz2SelectStyle::RefreshStylesAndList()
{
GAMEMAN->GetGameplayStylesForGame( GAMESTATE->m_CurGame, m_aPossibleStyles );
ASSERT( m_aPossibleStyles.GetSize() > 0 ); // every game should have at least one Style, or else why have the Game? :-)
// strip out Styles that don't work for the current number of players
int iNumSidesJoined = 0;
for( int c=0; c<2; c++ )
if( GAMESTATE->m_bSideIsJoined[c] )
iNumSidesJoined++; // left side, and right side
for( int i=m_aPossibleStyles.GetSize()-1; i>=0; i-- )
{
Style style = m_aPossibleStyles[i];
switch( GAMEMAN->GetStyleDefForStyle(style)->m_StyleType )
{
case StyleDef::ONE_PLAYER_ONE_CREDIT: // if the current style is for 1player
if( iNumSidesJoined!=1 ) // and we have two (or more) players
m_aPossibleStyles.RemoveAt( i ); // remove the element
break;
case StyleDef::ONE_PLAYER_TWO_CREDITS: // if the current style is for 1player on both sides
case StyleDef::TWO_PLAYERS_TWO_CREDITS: // if the current style for 2players
if( iNumSidesJoined!=2 ) // and we don't have two players
m_aPossibleStyles.RemoveAt( i ); // remove the element
break;
default: ASSERT(0);
}
}
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
CStringArray asGraphicPaths;
for( i=0; i<m_aPossibleStyles.GetSize(); i++ )
for( int i=0; i<m_aPossibleModeChoices.GetSize(); i++ )
{
Style style = m_aPossibleStyles[i];
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
CString sStyleName = GAMEMAN->GetStyleDefForStyle(style)->m_szName;
const ModeChoice& choice = m_aPossibleModeChoices[i];
asGraphicPaths.Add( THEME->GetPathTo("Graphics",ssprintf("select style info %s %s",sGameName,sStyleName)) );
if( choice.numSidesJoinedToPlay == iNumSidesJoined )
asGraphicPaths.Add( THEME->GetPathTo("Graphics", ssprintf("select mode %s %s", sGameName, choice.name) ) );
}
m_ScrollingList.Load( asGraphicPaths );
}
/************************************
MenuBack
Desc: Actions performed when a player
@@ -298,30 +216,26 @@ void ScreenEz2SelectStyle::MenuBack( PlayerNumber pn )
m_Menu.TweenOffScreenToBlack( SM_GoToPrevScreen, true );
}
void ScreenEz2SelectStyle::AfterChange()
{
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
const ModeChoice& choice = m_aPossibleModeChoices[ m_ScrollingList.GetSelection() ];
if( CHANGE_BG_ANIMATIONS )
m_Menu.m_Background.LoadFromAniDir( THEME->GetPathTo("BGAnimations",ssprintf("select mode %s %s", sGameName, choice.name)) );
}
void ScreenEz2SelectStyle::MenuLeft( PlayerNumber pn )
{
m_BGAnim[m_ScrollingList.GetSelection()].SetZoom(0.0f); // hide old background
m_Background[m_ScrollingList.GetSelection()].SetZoom(0.0f); // hide old background
m_ScrollingList.Left();
m_soundChange.Play();
m_Background[m_ScrollingList.GetSelection()].SetZoom(1.0f); // show new background
m_BGAnim[m_ScrollingList.GetSelection()].SetZoom(1.0f); // show new background
// m_BGAnim.UpdateMetrics(m_ScrollingList.GetSelection());
AfterChange();
}
void ScreenEz2SelectStyle::MenuRight( PlayerNumber pn )
{
m_BGAnim[m_ScrollingList.GetSelection()].SetZoom(0.0f); // hide old background
m_Background[m_ScrollingList.GetSelection()].SetZoom(0.0f); // hide old background
m_ScrollingList.Right();
m_soundChange.Play();
m_Background[m_ScrollingList.GetSelection()].SetZoom(1.0f); // show new background
m_BGAnim[m_ScrollingList.GetSelection()].SetZoom(1.0f); // show new background
// m_BGAnim.UpdateMetrics(m_ScrollingList.GetSelection());
AfterChange();
}
/************************************
@@ -344,7 +258,7 @@ presses the button bound to start
************************************/
void ScreenEz2SelectStyle::MenuStart( PlayerNumber pn )
{
if( !GAMESTATE->m_bSideIsJoined[pn] && !DISABLE_2P )
if( !GAMESTATE->m_bSideIsJoined[pn] )
{
// join them
GAMESTATE->m_bSideIsJoined[pn] = true;
@@ -357,75 +271,21 @@ void ScreenEz2SelectStyle::MenuStart( PlayerNumber pn )
// NOW replace with the new controller!
m_sprControllers[pn].Load( THEME->GetPathTo("Graphics",ssprintf("select player controller selected p%d", pn+1)) );
if (USE_METRIC_FOR_MENU == 1) // get it from the metrics
{
RefreshStylesAndListFromMetrics();
}
else
{
RefreshStylesAndList();
}
RefreshModeChoices();
m_ScrollingList.SetSelection( 0 );
/********** TODO: MAKE IT WORK FOR ALL GAME TYPES! ************/
for (int i=0; i<NUM_BG_ANIMS; i++)
{
m_BGAnim[i].SetZoom(0.0f); // hide the background
m_Background[i].SetZoom(0.0f);
}
m_BGAnim[0].SetZoom(1.0f);
m_Background[0].SetZoom(1.0f);
}
else
{
// made a selection
m_soundSelect.Play();
if (USE_METRIC_FOR_MENU == 1) // get it from the metrics
{
int chosen=m_ScrollingList.GetSelection();
int iNumSidesJoined = 0;
for( int c=0; c<2; c++ )
if( GAMESTATE->m_bSideIsJoined[c] )
iNumSidesJoined++; // left side, and right side
const ModeChoice& choice = m_aPossibleModeChoices[ m_ScrollingList.GetSelection() ];
GAMESTATE->m_CurStyle = choice.style;
GAMESTATE->m_PlayMode = choice.pm;
for( int p=0; p<NUM_PLAYERS; p++ )
GAMESTATE->m_PreferredDifficulty[p] = choice.dc;
GAMEMAN->GetGameplayStylesForGame( GAMESTATE->m_CurGame, m_aPossibleStyles );
if( iNumSidesJoined == 2 ) // load in the Style to use based upon the list for 2players
GAMESTATE->m_CurStyle = m_aPossibleStyles[ THEME->GetMetricI("ScreenEz2SelectStyle",ssprintf("UseStyle2p%d",chosen) ) ];
else // load in the Style to use based upon the list for 1player
GAMESTATE->m_CurStyle = m_aPossibleStyles[ THEME->GetMetricI("ScreenEz2SelectStyle",ssprintf("UseStyle%d",chosen) ) ];
int m_diSelection;
if( iNumSidesJoined == 2 )
m_diSelection = THEME->GetMetricI("ScreenEz2SelectStyle",ssprintf("UseDifficulty2p%d",chosen) );
else
m_diSelection = THEME->GetMetricI("ScreenEz2SelectStyle",ssprintf("UseDifficulty%d",chosen) );
switch( m_diSelection )
{
case 0:
GAMESTATE->m_PreferredDifficultyClass[PLAYER_1] = CLASS_EASY;
GAMESTATE->m_PreferredDifficultyClass[PLAYER_2] = CLASS_EASY;
break;
case 1:
GAMESTATE->m_PreferredDifficultyClass[PLAYER_1] = CLASS_MEDIUM;
GAMESTATE->m_PreferredDifficultyClass[PLAYER_2] = CLASS_MEDIUM;
break;
case 2:
GAMESTATE->m_PreferredDifficultyClass[PLAYER_1] = CLASS_HARD;
GAMESTATE->m_PreferredDifficultyClass[PLAYER_2] = CLASS_HARD;
break;
}
}
else // get it from the scrolling list
{
GAMESTATE->m_CurStyle = m_aPossibleStyles[m_ScrollingList.GetSelection()];
}
TweenOffScreen();
m_Menu.TweenOffScreenToMenu( SM_GoToNextScreen );
}
+4 -11
View File
@@ -17,7 +17,6 @@ Andrew Livy
#include "Quad.h"
#include "MenuElements.h"
#include "ScrollingList.h"
#include "MenuBGAnims.h"
/* Class Definition */
@@ -42,6 +41,8 @@ public:
void MenuDown( PlayerNumber pn );
protected:
void AfterChange();
void TweenOffScreen();
void TweenOnScreen();
@@ -50,21 +51,13 @@ protected:
Sprite m_StyleListFrame;
Sprite m_SelectedStyleFrame;
CArray<Style,Style> m_aPossibleStyles;
MenuBGAnims m_BGAnim[10];
CArray<ModeChoice,ModeChoice> m_aPossibleModeChoices;
ScrollingList m_ScrollingList;
void RefreshStylesAndList();
void RefreshStylesAndListFromMetrics();
Sprite m_sprBackgrounds[10];
void RefreshModeChoices();
MenuElements m_Menu;
RageSoundSample m_soundSelect;
RageSoundSample m_soundChange;
BackgroundAnimation m_Background[10];
};
+2 -2
View File
@@ -10,7 +10,7 @@
*/
#include "Screen.h"
#include "BackgroundAnimation.h"
#include "BGAnimation.h"
#include "TransitionFade.h"
@@ -26,7 +26,7 @@ public:
private:
TransitionFade m_Fade;
BackgroundAnimation m_Background;
BGAnimation m_Background;
};
+1 -1
View File
@@ -1106,7 +1106,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
if( GAMESTATE->m_pCurNotes[p]->m_DifficultyClass == CLASS_HARD && GAMESTATE->GetCurrentGrade((PlayerNumber)p) >= GRADE_AA )
if( GAMESTATE->m_pCurNotes[p]->m_Difficulty == DIFFICULTY_HARD && GAMESTATE->GetCurrentGrade((PlayerNumber)p) >= GRADE_AA )
bTryExtraStage = true;
}
}
+15 -17
View File
@@ -88,15 +88,14 @@ void ScreenMachineOptions::ImportOptions()
* impossible, and perhaps it *is* justice that even the CPU fails
* it. :)
*/
if( PREFSMAN->m_fJudgeWindowSeconds == 0.24f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 0;
else if( PREFSMAN->m_fJudgeWindowSeconds == 0.22f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 1;
else if( PREFSMAN->m_fJudgeWindowSeconds == 0.20f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 2;
else if( PREFSMAN->m_fJudgeWindowSeconds == 0.18f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 3;
else if( PREFSMAN->m_fJudgeWindowSeconds == 0.16f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 4;
else if( PREFSMAN->m_fJudgeWindowSeconds == 0.14f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 5;
else if( PREFSMAN->m_fJudgeWindowSeconds == 0.12f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 6;
if( PREFSMAN->m_fJudgeWindowSeconds == 0.20f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 0;
else if( PREFSMAN->m_fJudgeWindowSeconds == 0.18f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 1;
else if( PREFSMAN->m_fJudgeWindowSeconds == 0.16f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 2;
else if( PREFSMAN->m_fJudgeWindowSeconds == 0.14f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 3;
else if( PREFSMAN->m_fJudgeWindowSeconds == 0.12f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 4;
else if( PREFSMAN->m_fJudgeWindowSeconds == 0.10f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 5;
else if( PREFSMAN->m_fJudgeWindowSeconds == 0.08f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 6;
else if( PREFSMAN->m_fJudgeWindowSeconds == 0.06f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 7;
// else if( PREFSMAN->m_fJudgeWindowSeconds == 0.02f ) m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 8;
else m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] = 3;
if( PREFSMAN->m_fLifeDifficultyScale == 1.60f ) m_iSelectedOption[0][MO_LIFE_DIFFICULTY] = 0;
@@ -121,15 +120,14 @@ void ScreenMachineOptions::ExportOptions()
switch( m_iSelectedOption[0][MO_JUDGE_DIFFICULTY] )
{
case 0: PREFSMAN->m_fJudgeWindowSeconds = 0.24f; break;
case 1: PREFSMAN->m_fJudgeWindowSeconds = 0.22f; break;
case 2: PREFSMAN->m_fJudgeWindowSeconds = 0.20f; break;
case 3: PREFSMAN->m_fJudgeWindowSeconds = 0.18f; break;
case 4: PREFSMAN->m_fJudgeWindowSeconds = 0.16f; break;
case 5: PREFSMAN->m_fJudgeWindowSeconds = 0.14f; break;
case 6: PREFSMAN->m_fJudgeWindowSeconds = 0.12f; break;
case 0: PREFSMAN->m_fJudgeWindowSeconds = 0.20f; break;
case 1: PREFSMAN->m_fJudgeWindowSeconds = 0.18f; break;
case 2: PREFSMAN->m_fJudgeWindowSeconds = 0.16f; break;
case 3: PREFSMAN->m_fJudgeWindowSeconds = 0.14f; break;
case 4: PREFSMAN->m_fJudgeWindowSeconds = 0.12f; break;
case 5: PREFSMAN->m_fJudgeWindowSeconds = 0.10f; break;
case 6: PREFSMAN->m_fJudgeWindowSeconds = 0.08f; break;
case 7: PREFSMAN->m_fJudgeWindowSeconds = 0.06f; break;
// case 8: PREFSMAN->m_fJudgeWindowSeconds = 0.02f; break;
default: ASSERT(0);
}
@@ -145,7 +143,7 @@ void ScreenMachineOptions::ExportOptions()
default: ASSERT(0);
}
PREFSMAN->m_bShowStats = m_iSelectedOption[0][MO_SHOWSTATS] == 1;
PREFSMAN->m_bShowStats = m_iSelectedOption[0][MO_SHOWSTATS] == 1;
}
void ScreenMachineOptions::GoToPrevState()
+1 -1
View File
@@ -58,7 +58,7 @@ const CString CREDIT_LINES[] =
"",
"SOUND:",
"Kyle 'KeeL' Ward",
"Animechanic"
"Jim 'Animechanic' Cabeen"
"",
"",
"",
+1 -1
View File
@@ -38,7 +38,7 @@ public:
private:
BackgroundAnimation m_Background;
BGAnimation m_Background;
BitmapText m_textLines[MAX_TOTAL_LINES];
int m_iNumLines;
float m_fTimeLeftInScreen;
+4 -4
View File
@@ -234,9 +234,9 @@ void ScreenSelectDifficulty::HandleScreenMessage( const ScreenMessage SM )
for( int p=0; p<NUM_PLAYERS; p++ )
switch( m_iSelection[p] )
{
case 0: GAMESTATE->m_PreferredDifficultyClass[p] = CLASS_EASY; break;
case 1: GAMESTATE->m_PreferredDifficultyClass[p] = CLASS_MEDIUM; break;
case 2: GAMESTATE->m_PreferredDifficultyClass[p] = CLASS_HARD; break;
case 0: GAMESTATE->m_PreferredDifficulty[p] = DIFFICULTY_EASY; break;
case 1: GAMESTATE->m_PreferredDifficulty[p] = DIFFICULTY_MEDIUM; break;
case 2: GAMESTATE->m_PreferredDifficulty[p] = DIFFICULTY_HARD; break;
}
}
@@ -305,7 +305,7 @@ bool ScreenSelectDifficulty::IsItemOnPage2( int iItemIndex )
{
ASSERT( iItemIndex >= 0 && iItemIndex < NUM_DIFFICULTY_ITEMS );
return iItemIndex >= NUM_DIFFICULTY_CLASSES;
return iItemIndex >= NUM_DIFFICULTIES;
}
bool ScreenSelectDifficulty::SelectedSomethingOnPage2()
+1 -1
View File
@@ -17,7 +17,7 @@
#include "MenuElements.h"
const int NUM_DIFFICULTY_ITEMS = NUM_DIFFICULTY_CLASSES + 2; // easy, medium, hard, Oni, Endless
const int NUM_DIFFICULTY_ITEMS = NUM_DIFFICULTIES + 2; // easy, medium, hard, Oni, Endless
const int NUM_PAGES = 2; // easy-medium-hard, Oni
class ScreenSelectDifficulty : public Screen
+3 -3
View File
@@ -463,7 +463,7 @@ void ScreenSelectMusic::EasierDifficulty( PlayerNumber pn )
m_iSelection[pn]--;
// the user explicity switched difficulties. Update the preferred difficulty
GAMESTATE->m_PreferredDifficultyClass[pn] = m_arrayNotes[pn][ m_iSelection[pn] ]->m_DifficultyClass;
GAMESTATE->m_PreferredDifficulty[pn] = m_arrayNotes[pn][ m_iSelection[pn] ]->m_Difficulty;
m_soundChangeNotes.Play();
@@ -483,7 +483,7 @@ void ScreenSelectMusic::HarderDifficulty( PlayerNumber pn )
m_iSelection[pn]++;
// the user explicity switched difficulties. Update the preferred difficulty
GAMESTATE->m_PreferredDifficultyClass[pn] = m_arrayNotes[pn][ m_iSelection[pn] ]->m_DifficultyClass;
GAMESTATE->m_PreferredDifficulty[pn] = m_arrayNotes[pn][ m_iSelection[pn] ]->m_Difficulty;
m_soundChangeNotes.Play();
@@ -743,7 +743,7 @@ void ScreenSelectMusic::AfterMusicChange()
if( !GAMESTATE->IsPlayerEnabled( PlayerNumber(p) ) )
continue;
for( int i=0; i<m_arrayNotes[p].GetSize(); i++ )
if( m_arrayNotes[p][i]->m_DifficultyClass == GAMESTATE->m_PreferredDifficultyClass[p] )
if( m_arrayNotes[p][i]->m_Difficulty == GAMESTATE->m_PreferredDifficulty[p] )
m_iSelection[p] = i;
m_iSelection[p] = clamp( m_iSelection[p], 0, m_arrayNotes[p].GetSize() ) ;
+1 -1
View File
@@ -255,7 +255,7 @@ ScreenStage::ScreenStage()
// float fOffsetX = SCALE(i, 0, iNumChars-1, -(iNumChars-1)/2.0f*fFrameWidth, (iNumChars-1)/2.0f*fFrameWidth);
if( stage_mode == MODE_FINAL )
{
m_sprNumbers[i].Load( THEME->GetPathTo("Graphics","stage numbers final") );
m_sprNumbers[i].Load( THEME->GetPathTo("Graphics","stage final parts") );
m_sprNumbers[i].StopAnimating();
}
+2 -2
View File
@@ -15,7 +15,7 @@
#include "TransitionFade.h"
#include "RandomSample.h"
#include "RandomStream.h"
#include "BackgroundAnimation.h"
#include "BGAnimation.h"
@@ -51,7 +51,7 @@ private:
TitleMenuChoice m_TitleMenuChoice;
BackgroundAnimation m_Background;
BGAnimation m_Background;
Sprite m_sprLogo;
BitmapText m_textHelp;
BitmapText m_textVersion;
+5 -5
View File
@@ -575,10 +575,10 @@ bool Song::SongHasNotesType( NotesType nt ) const
return false;
}
bool Song::SongHasNotesTypeAndDifficulty( NotesType nt, DifficultyClass dc ) const
bool Song::SongHasNotesTypeAndDifficulty( NotesType nt, Difficulty dc ) const
{
for( int i=0; i < m_apNotes.GetSize(); i++ ) // foreach Notes
if( m_apNotes[i]->m_NotesType == nt && m_apNotes[i]->m_DifficultyClass == dc )
if( m_apNotes[i]->m_NotesType == nt && m_apNotes[i]->m_Difficulty == dc )
return true;
return false;
}
@@ -742,7 +742,7 @@ void Song::AddAutoGenNotes()
continue;
Notes* pNewNotes = new Notes;
pNewNotes->m_DifficultyClass = pOriginalNotes->m_DifficultyClass;
pNewNotes->m_Difficulty = pOriginalNotes->m_Difficulty;
pNewNotes->m_iMeter = pOriginalNotes->m_iMeter;
pNewNotes->m_sDescription = pOriginalNotes->m_sDescription + " (autogen)";
pNewNotes->m_NotesType = mapping.ntMissing;
@@ -757,7 +757,7 @@ void Song::AddAutoGenNotes()
}
}
Grade Song::GetGradeForDifficultyClass( const StyleDef *st, int p, DifficultyClass dc ) const
Grade Song::GetGradeForDifficulty( const StyleDef *st, int p, Difficulty dc ) const
{
CArray<Notes*, Notes*> aNotes;
this->GetNotesThatMatch( st, p, aNotes );
@@ -766,7 +766,7 @@ Grade Song::GetGradeForDifficultyClass( const StyleDef *st, int p, DifficultyCla
for( int i=0; i<aNotes.GetSize(); i++ )
{
const Notes* pNotes = aNotes[i];
if( pNotes->m_DifficultyClass == dc )
if( pNotes->m_Difficulty == dc )
return pNotes->m_TopGrade;
}
return GRADE_NO_DATA;
+2 -2
View File
@@ -455,10 +455,10 @@ void SongManager::InitCoursesFromDisk()
CArray<Song*, Song*> apGroupSongs;
GetSongsInGroup( sGroupName, apGroupSongs );
for( DifficultyClass dc=CLASS_EASY; dc<=CLASS_HARD; dc=DifficultyClass(dc+1) ) // foreach DifficultyClass
for( Difficulty dc=DIFFICULTY_EASY; dc<=DIFFICULTY_HARD; dc=Difficulty(dc+1) ) // foreach Difficulty
{
Course course;
course.CreateEndlessCourseFromGroupAndDifficultyClass( sGroupName, dc, apGroupSongs );
course.CreateEndlessCourseFromGroupAndDifficulty( sGroupName, dc, apGroupSongs );
if( course.m_iStages > 0 )
m_aEndlessCourses.Add( course );
+12 -12
View File
@@ -713,12 +713,6 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
<File
RelativePath="GroupList.h">
</File>
<File
RelativePath="MenuBGAnims.h">
</File>
<File
RelativePath="MenuBgAnims.cpp">
</File>
<File
RelativePath="MenuElements.cpp">
</File>
@@ -825,18 +819,24 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
<File
RelativePath=".\ArrowEffects.h">
</File>
<File
RelativePath="BGAnimation.cpp">
</File>
<File
RelativePath="BGAnimation.h">
</File>
<File
RelativePath="BGAnimationLayer.cpp">
</File>
<File
RelativePath="BGAnimationLayer.h">
</File>
<File
RelativePath=".\Background.cpp">
</File>
<File
RelativePath=".\Background.h">
</File>
<File
RelativePath="BackgroundAnimation.cpp">
</File>
<File
RelativePath="BackgroundAnimation.h">
</File>
<File
RelativePath=".\Combo.cpp">
</File>
+5 -7
View File
@@ -24,11 +24,9 @@ enum Style
STYLE_PUMP_COUPLE,
STYLE_PUMP_EDIT_COUPLE,
STYLE_EZ2_SINGLE,
STYLE_EZ2_SINGLE_HARD,
STYLE_EZ2_DOUBLE,
STYLE_EZ2_REAL,
STYLE_EZ2_SINGLE_VERSUS,
STYLE_EZ2_SINGLE_HARD_VERSUS,
STYLE_EZ2_REAL_VERSUS,
STYLE_PARA_SINGLE,
NUM_STYLES, // leave this at the end
@@ -37,7 +35,7 @@ enum Style
const int NUM_DANCE_STYLES = 6;
const int NUM_PUMP_STYLES = 5;
const int NUM_EZ2_STYLES = 7;
const int NUM_EZ2_STYLES = 5;
const int NUM_PARA_STYLES = 1;
// Ugh. This is needed for the style icon.
@@ -47,10 +45,10 @@ inline int GetStyleIndexRelativeToGame( int iGameIndex, Style style )
int iStyleIndex = style;
switch( iGameIndex )
{
case 0: break; // dance
case 1: iStyleIndex -= NUM_DANCE_STYLES; break; // pump
case 2: iStyleIndex -= NUM_DANCE_STYLES+NUM_PUMP_STYLES; break; // ez2
case 3: iStyleIndex -= NUM_DANCE_STYLES+NUM_PUMP_STYLES+NUM_EZ2_STYLES; break; // ez2
case 0: break; // dance
case 1: iStyleIndex -= NUM_DANCE_STYLES; break; // pump
case 2: iStyleIndex -= NUM_DANCE_STYLES+NUM_PUMP_STYLES; break; // ez2
case 3: iStyleIndex -= NUM_DANCE_STYLES+NUM_PUMP_STYLES+NUM_EZ2_STYLES; break; // para
default: ASSERT(0); // invalid game index
}
return iStyleIndex;
+2 -2
View File
@@ -187,12 +187,12 @@ public:
bool SongCompleteForStyle( const StyleDef *st ) const;
bool SongHasNotesType( NotesType nt ) const;
bool SongHasNotesTypeAndDifficulty( NotesType nt, DifficultyClass dc ) const;
bool SongHasNotesTypeAndDifficulty( NotesType nt, Difficulty dc ) const;
void GetNotesThatMatch( const StyleDef *s, int p, CArray<Notes*, Notes*>& arrayAddTo ) const;
int GetNumTimesPlayed() const;
bool IsNew() const;
bool IsEasy( NotesType nt ) const;
Grade GetGradeForDifficultyClass( const StyleDef *s, int p, DifficultyClass dc ) const;
Grade GetGradeForDifficulty( const StyleDef *s, int p, Difficulty dc ) const;
bool NormallyDisplayed() const;
bool RouletteDisplayed() const;
};