From ad6c239858e7f6d46c65e06fe8489a8afa310d0d Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 29 Sep 2002 05:06:18 +0000 Subject: [PATCH] ugh. Cleanup of ez2's menubganimations. --- stepmania/TODO.chris | 5 + stepmania/Themes/default/metrics.ini | 130 +----- stepmania/src/BGAnimation.cpp | 124 ++++++ stepmania/src/BGAnimation.h | 43 ++ stepmania/src/BGAnimationLayer.cpp | 508 +++++++++++++++++++++++ stepmania/src/BGAnimationLayer.h | 80 ++++ stepmania/src/Background.cpp | 82 ++-- stepmania/src/Background.h | 8 +- stepmania/src/BitmapText.h | 4 +- stepmania/src/Course.cpp | 16 +- stepmania/src/Course.h | 2 +- stepmania/src/CourseContentsFrame.cpp | 2 +- stepmania/src/DifficultyIcon.h | 8 +- stepmania/src/GameConstantsAndTypes.cpp | 28 +- stepmania/src/GameConstantsAndTypes.h | 22 +- stepmania/src/GameManager.cpp | 252 ++++++++--- stepmania/src/GameManager.h | 12 + stepmania/src/GameState.cpp | 4 +- stepmania/src/GameState.h | 11 +- stepmania/src/MenuElements.h | 6 +- stepmania/src/MenuTimer.cpp | 14 +- stepmania/src/MusicWheel.cpp | 4 +- stepmania/src/NoteData.cpp | 1 - stepmania/src/Notes.cpp | 38 +- stepmania/src/Notes.h | 4 +- stepmania/src/NotesLoaderDWI.cpp | 2 +- stepmania/src/NotesLoaderKSF.cpp | 8 +- stepmania/src/NotesLoaderSM.cpp | 8 +- stepmania/src/NotesLoaderSM.h | 2 +- stepmania/src/NotesWriterDWI.cpp | 8 +- stepmania/src/RageUtil.cpp | 2 +- stepmania/src/ScreenCaution.h | 4 +- stepmania/src/ScreenEdit.cpp | 8 +- stepmania/src/ScreenEvaluation.cpp | 2 +- stepmania/src/ScreenEz2SelectPlayer.cpp | 19 +- stepmania/src/ScreenEz2SelectPlayer.h | 2 +- stepmania/src/ScreenEz2SelectStyle.cpp | 228 ++-------- stepmania/src/ScreenEz2SelectStyle.h | 15 +- stepmania/src/ScreenGameOver.h | 4 +- stepmania/src/ScreenGameplay.cpp | 2 +- stepmania/src/ScreenMachineOptions.cpp | 32 +- stepmania/src/ScreenMusicScroll.cpp | 2 +- stepmania/src/ScreenMusicScroll.h | 2 +- stepmania/src/ScreenSelectDifficulty.cpp | 8 +- stepmania/src/ScreenSelectDifficulty.h | 2 +- stepmania/src/ScreenSelectMusic.cpp | 6 +- stepmania/src/ScreenStage.cpp | 2 +- stepmania/src/ScreenTitleMenu.h | 4 +- stepmania/src/Song.cpp | 10 +- stepmania/src/SongManager.cpp | 4 +- stepmania/src/StepMania.vcproj | 24 +- stepmania/src/Style.h | 12 +- stepmania/src/song.h | 4 +- 53 files changed, 1233 insertions(+), 601 deletions(-) create mode 100644 stepmania/src/BGAnimation.cpp create mode 100644 stepmania/src/BGAnimation.h create mode 100644 stepmania/src/BGAnimationLayer.cpp create mode 100644 stepmania/src/BGAnimationLayer.h diff --git a/stepmania/TODO.chris b/stepmania/TODO.chris index 99356e7694..b23bcc5ff8 100644 --- a/stepmania/TODO.chris +++ b/stepmania/TODO.chris @@ -2,6 +2,11 @@ Fix ///////////////////////// +more traditional particle system in BGAnimationLayer? +- fog +- particle lifetime +- set camera position + anon CVS instructions MS phone bill diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index d4e938d399..5867b833d6 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -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 \ No newline at end of file diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp new file mode 100644 index 0000000000..2fe536a726 --- /dev/null +++ b/stepmania/src/BGAnimation.cpp @@ -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; iLoadFromStaticGraphic( 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; iLoadFromAniLayerFile( 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; iUpdate( fDeltaTime ); +} + +void BGAnimation::DrawPrimitives() +{ + for( int i=0; iDraw(); +} + +void BGAnimation::GainingFocus() +{ + for( int i=0; iGainingFocus(); +} + +void BGAnimation::LosingFocus() +{ + for( int i=0; iLosingFocus(); +} + diff --git a/stepmania/src/BGAnimation.h b/stepmania/src/BGAnimation.h new file mode 100644 index 0000000000..2d3ce874ad --- /dev/null +++ b/stepmania/src/BGAnimation.h @@ -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 m_Layers; +}; + diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp new file mode 100644 index 0000000000..d5ba9d2196 --- /dev/null +++ b/stepmania/src/BGAnimationLayer.cpp @@ -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; im_fSongBeat; + if( m_bCycleColor ) + { + for( int i=0; i 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; iSetPosition( 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(); +} diff --git a/stepmania/src/BGAnimationLayer.h b/stepmania/src/BGAnimationLayer.h new file mode 100644 index 0000000000..85fffdba83 --- /dev/null +++ b/stepmania/src/BGAnimationLayer.h @@ -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; +}; diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 813c142b77..933fd6d8f5 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -85,9 +85,9 @@ Background::~Background() void Background::Unload() { - for( int i=0; iLoadFromAniDir( 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; fSetXY( (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 ); diff --git a/stepmania/src/Background.h b/stepmania/src/Background.h index 189fe7949e..5732b0c177 100644 --- a/stepmania/src/Background.h +++ b/stepmania/src/Background.h @@ -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 m_BackgroundAnimations; + CArray m_BGAnimations; CArray 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; diff --git a/stepmania/src/BitmapText.h b/stepmania/src/BitmapText.h index 4837339c83..5e69b49993 100644 --- a/stepmania/src/BitmapText.h +++ b/stepmania/src/BitmapText.h @@ -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]; diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 9192aca65f..5fea8f98e5 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -93,7 +93,7 @@ void Course::LoadFromCRSFile( CString sPath, CArray &apSongs ) } -void Course::CreateEndlessCourseFromGroupAndDifficultyClass( CString sGroupName, DifficultyClass dc, CArray &apSongsInGroup ) +void Course::CreateEndlessCourseFromGroupAndDifficulty( CString sGroupName, Difficulty dc, CArray &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; sm_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; } diff --git a/stepmania/src/Course.h b/stepmania/src/Course.h index f7e31fb51c..ee65de0de9 100644 --- a/stepmania/src/Course.h +++ b/stepmania/src/Course.h @@ -51,7 +51,7 @@ public: void GetSongOptions( SongOptions* pSO_out); void LoadFromCRSFile( CString sPath, CArray &apSongs ); - void CreateEndlessCourseFromGroupAndDifficultyClass( CString sGroupName, DifficultyClass dc, CArray &apSongsInGroup ); + void CreateEndlessCourseFromGroupAndDifficulty( CString sGroupName, Difficulty dc, CArray &apSongsInGroup ); void AddStage( Song* pSong, CString sDescription, CString sModifiers ) { diff --git a/stepmania/src/CourseContentsFrame.cpp b/stepmania/src/CourseContentsFrame.cpp index 9c1103f104..28f63eb489 100644 --- a/stepmania/src/CourseContentsFrame.cpp +++ b/stepmania/src/CourseContentsFrame.cpp @@ -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 ); diff --git a/stepmania/src/DifficultyIcon.h b/stepmania/src/DifficultyIcon.h index 5380fba87c..1b21be93cc 100644 --- a/stepmania/src/DifficultyIcon.h +++ b/stepmania/src/DifficultyIcon.h @@ -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 diff --git a/stepmania/src/GameConstantsAndTypes.cpp b/stepmania/src/GameConstantsAndTypes.cpp index 57532d1279..d882615dc0 100644 --- a/stepmania/src/GameConstantsAndTypes.cpp +++ b/stepmania/src/GameConstantsAndTypes.cpp @@ -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& aSty } } +void GameManager::GetModesChoicesForGame( Game game, CArray& aChoicesAddTo ) +{ + for( int s=0; s& aNotesTypeAddTo ) { for( int nt=0; nt& aStylesAddTo, bool editor=false ); + void GetModesChoicesForGame( Game game, CArray& aChoicesAddTo ); void GetNotesTypesForGame( Game game, CArray& aNotesTypeAddTo ); // only look at edit-specific styles // void GetGameNames( CStringArray &AddTo ); diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index ddc697c018..dc667b558e 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -55,7 +55,7 @@ void GameState::Reset() m_MasterPlayerNumber = PLAYER_INVALID; m_sPreferredGroup = ""; for( p=0; pGetGameDefForGame( m_CurGame ); } const StyleDef* GameState::GetCurrentStyleDef() { + ASSERT( m_CurStyle != STYLE_NONE ); // the style must be set before calling this return GAMEMAN->GetStyleDefForStyle( m_CurStyle ); } diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 08ce297e65..462caf66e3 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -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 diff --git a/stepmania/src/MenuElements.h b/stepmania/src/MenuElements.h index c045e4c6d9..953235d8ae 100644 --- a/stepmania/src/MenuElements.h +++ b/stepmania/src/MenuElements.h @@ -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; diff --git a/stepmania/src/MenuTimer.cpp b/stepmania/src/MenuTimer.cpp index ed719320b6..f49a6617fa 100644 --- a/stepmania/src/MenuTimer.cpp +++ b/stepmania/src/MenuTimer.cpp @@ -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") ); diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index c567af0fca..163ca17631 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -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) ); } diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index 7ef6d1d9a1..c74c950e03 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -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? diff --git a/stepmania/src/Notes.cpp b/stepmania/src/Notes.cpp index b6d0c444c5..a33547cf94 100644 --- a/stepmania/src/Notes.cpp +++ b/stepmania/src/Notes.cpp @@ -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; im_DifficultyClass; - DifficultyClass class2 = pNotes2->m_DifficultyClass; + Difficulty class1 = pNotes1->m_Difficulty; + Difficulty class2 = pNotes2->m_Difficulty; if( class1 < class2 ) return -1; diff --git a/stepmania/src/Notes.h b/stepmania/src/Notes.h index 719e86b534..983872e5ed 100644 --- a/stepmania/src/Notes.h +++ b/stepmania/src/Notes.h @@ -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(); diff --git a/stepmania/src/NotesLoaderDWI.cpp b/stepmania/src/NotesLoaderDWI.cpp index 2eb942ec4b..9587adc69f 100644 --- a/stepmania/src/NotesLoaderDWI.cpp +++ b/stepmania/src/NotesLoaderDWI.cpp @@ -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 ); diff --git a/stepmania/src/NotesLoaderKSF.cpp b/stepmania/src/NotesLoaderKSF.cpp index 39f1c0ce63..787a75f081 100644 --- a/stepmania/src/NotesLoaderKSF.cpp +++ b/stepmania/src/NotesLoaderKSF.cpp @@ -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; } diff --git a/stepmania/src/NotesLoaderSM.cpp b/stepmania/src/NotesLoaderSM.cpp index db33ab7cf0..92ed7c9c3b 100644 --- a/stepmania/src/NotesLoaderSM.cpp +++ b/stepmania/src/NotesLoaderSM.cpp @@ -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 ); diff --git a/stepmania/src/NotesLoaderSM.h b/stepmania/src/NotesLoaderSM.h index 571aa88be6..1723e1ac98 100644 --- a/stepmania/src/NotesLoaderSM.h +++ b/stepmania/src/NotesLoaderSM.h @@ -9,7 +9,7 @@ class SMLoader: public NotesLoader { void LoadFromSMTokens( CString sNotesType, CString sDescription, - CString sDifficultyClass, + CString sDifficulty, CString sMeter, CString sRadarValues, CString sNoteData, diff --git a/stepmania/src/NotesWriterDWI.cpp b/stepmania/src/NotesWriterDWI.cpp index d64c94a97d..2b3af98c49 100644 --- a/stepmania/src/NotesWriterDWI.cpp +++ b/stepmania/src/NotesWriterDWI.cpp @@ -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; } diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index b923517e1a..1cc3494a50 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -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 ); } //----------------------------------------------------------------------------- diff --git a/stepmania/src/ScreenCaution.h b/stepmania/src/ScreenCaution.h index 2a67e9ae42..01ebeb0caa 100644 --- a/stepmania/src/ScreenCaution.h +++ b/stepmania/src/ScreenCaution.h @@ -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; }; diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index ea545238f8..52a6d7b65d 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -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; diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 1003685e71..9b4c904bab 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -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; } } diff --git a/stepmania/src/ScreenEz2SelectPlayer.cpp b/stepmania/src/ScreenEz2SelectPlayer.cpp index 0136850798..1c43be4511 100644 --- a/stepmania/src/ScreenEz2SelectPlayer.cpp +++ b/stepmania/src/ScreenEz2SelectPlayer.cpp @@ -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; pm_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(); diff --git a/stepmania/src/ScreenEz2SelectPlayer.h b/stepmania/src/ScreenEz2SelectPlayer.h index 745ebcec30..199c41743d 100644 --- a/stepmania/src/ScreenEz2SelectPlayer.h +++ b/stepmania/src/ScreenEz2SelectPlayer.h @@ -40,5 +40,5 @@ private: MenuElements m_Menu; RageSoundSample m_soundSelect; - BackgroundAnimation m_Background; + BGAnimation m_Background; }; diff --git a/stepmania/src/ScreenEz2SelectStyle.cpp b/stepmania/src/ScreenEz2SelectStyle.cpp index e7b6390fce..9eec79518b 100644 --- a/stepmania/src/ScreenEz2SelectStyle.cpp +++ b/stepmania/src/ScreenEz2SelectStyle.cpp @@ -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; iAddChild( &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; pm_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; iGetPathTo("Graphics",ssprintf("%s",THEME->GetMetric("ScreenEz2SelectStyle",ssprintf("StyleGraphic2p%d",i) ) ) ) ); - } - } - else // else we got one player - { - for (int i=0; iGetPathTo("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; iGetCurrentGameDef()->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; im_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; pm_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 ); } diff --git a/stepmania/src/ScreenEz2SelectStyle.h b/stepmania/src/ScreenEz2SelectStyle.h index 916ae65742..47d2599910 100644 --- a/stepmania/src/ScreenEz2SelectStyle.h +++ b/stepmania/src/ScreenEz2SelectStyle.h @@ -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 m_aPossibleStyles; - - MenuBGAnims m_BGAnim[10]; + CArray 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]; }; diff --git a/stepmania/src/ScreenGameOver.h b/stepmania/src/ScreenGameOver.h index b5ef0d85f8..56b2c70a87 100644 --- a/stepmania/src/ScreenGameOver.h +++ b/stepmania/src/ScreenGameOver.h @@ -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; }; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index fa56d0ff61..b895db025d 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -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; } } diff --git a/stepmania/src/ScreenMachineOptions.cpp b/stepmania/src/ScreenMachineOptions.cpp index 782880064a..fe5489150a 100644 --- a/stepmania/src/ScreenMachineOptions.cpp +++ b/stepmania/src/ScreenMachineOptions.cpp @@ -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() diff --git a/stepmania/src/ScreenMusicScroll.cpp b/stepmania/src/ScreenMusicScroll.cpp index 9553d5b246..0e802041b8 100644 --- a/stepmania/src/ScreenMusicScroll.cpp +++ b/stepmania/src/ScreenMusicScroll.cpp @@ -58,7 +58,7 @@ const CString CREDIT_LINES[] = "", "SOUND:", "Kyle 'KeeL' Ward", - "Animechanic" + "Jim 'Animechanic' Cabeen" "", "", "", diff --git a/stepmania/src/ScreenMusicScroll.h b/stepmania/src/ScreenMusicScroll.h index a978d3bc4d..39a02792f5 100644 --- a/stepmania/src/ScreenMusicScroll.h +++ b/stepmania/src/ScreenMusicScroll.h @@ -38,7 +38,7 @@ public: private: - BackgroundAnimation m_Background; + BGAnimation m_Background; BitmapText m_textLines[MAX_TOTAL_LINES]; int m_iNumLines; float m_fTimeLeftInScreen; diff --git a/stepmania/src/ScreenSelectDifficulty.cpp b/stepmania/src/ScreenSelectDifficulty.cpp index 3cdade564b..c7f6f99335 100644 --- a/stepmania/src/ScreenSelectDifficulty.cpp +++ b/stepmania/src/ScreenSelectDifficulty.cpp @@ -234,9 +234,9 @@ void ScreenSelectDifficulty::HandleScreenMessage( const ScreenMessage SM ) for( int p=0; pm_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() diff --git a/stepmania/src/ScreenSelectDifficulty.h b/stepmania/src/ScreenSelectDifficulty.h index 980f8c881c..ec7fba874b 100644 --- a/stepmania/src/ScreenSelectDifficulty.h +++ b/stepmania/src/ScreenSelectDifficulty.h @@ -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 diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 4adf0ae2d3..177b1cc84a 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -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; im_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() ) ; diff --git a/stepmania/src/ScreenStage.cpp b/stepmania/src/ScreenStage.cpp index 464b21a98d..932fe29c18 100644 --- a/stepmania/src/ScreenStage.cpp +++ b/stepmania/src/ScreenStage.cpp @@ -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(); } diff --git a/stepmania/src/ScreenTitleMenu.h b/stepmania/src/ScreenTitleMenu.h index af1ea11a56..0279a70c68 100644 --- a/stepmania/src/ScreenTitleMenu.h +++ b/stepmania/src/ScreenTitleMenu.h @@ -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; diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index be422ae7eb..c98817a11f 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -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 aNotes; this->GetNotesThatMatch( st, p, aNotes ); @@ -766,7 +766,7 @@ Grade Song::GetGradeForDifficultyClass( const StyleDef *st, int p, DifficultyCla for( int i=0; im_DifficultyClass == dc ) + if( pNotes->m_Difficulty == dc ) return pNotes->m_TopGrade; } return GRADE_NO_DATA; diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index bbdfe5ebad..67559793a0 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -455,10 +455,10 @@ void SongManager::InitCoursesFromDisk() CArray 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 ); diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index d667173603..2ca14cdc6a 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -713,12 +713,6 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ - - - - @@ -825,18 +819,24 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ + + + + + + + + - - - - diff --git a/stepmania/src/Style.h b/stepmania/src/Style.h index e636593079..663ea5a107 100644 --- a/stepmania/src/Style.h +++ b/stepmania/src/Style.h @@ -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; diff --git a/stepmania/src/song.h b/stepmania/src/song.h index 7b35a8151f..55fbf3574e 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -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& 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; };