diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 9fe74eb455..dfc8877f7a 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -121,14 +121,12 @@ void Actor::Draw() // set the world matrix and calculate actor properties, the // matNewWorld = matTemp * matNewWorld; // replace with... - if( m_temp_rotation.z != 0 ) - { - DISPLAY->RotateZ( m_temp_rotation.z ); - } + if( m_temp_rotation.x != 0 ) + DISPLAY->RotateX( m_temp_rotation.x ); if( m_temp_rotation.y != 0 ) - { DISPLAY->RotateY( m_temp_rotation.y ); - } + if( m_temp_rotation.z != 0 ) + DISPLAY->RotateZ( m_temp_rotation.z ); diff --git a/stepmania/src/ArrowEffects.cpp b/stepmania/src/ArrowEffects.cpp index cb570055e2..89fa139bcf 100644 --- a/stepmania/src/ArrowEffects.cpp +++ b/stepmania/src/ArrowEffects.cpp @@ -34,7 +34,7 @@ float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBea float ArrowGetXPos( const PlayerOptions& po, int iColNum, float fYOffset, float fSongBeat ) { - float fColOffsetFromCenter = iColNum - (GAME->GetCurrentStyleDef()->m_iColsPerPlayer-1)/2.0f; + float fColOffsetFromCenter = iColNum - (GAMEMAN->GetCurrentStyleDef()->m_iColsPerPlayer-1)/2.0f; float fPixelOffsetFromCenter = fColOffsetFromCenter * ARROW_SIZE; switch( po.m_EffectType ) diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index cc3b270ad0..a88b709d3f 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -55,7 +55,7 @@ bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations ) this->AddActor( &m_sprSongBackground ); - if( PREFS->m_GameOptions.m_bUseRandomVis && !bDisableVisualizations ) + if( PREFSMAN->m_bUseRandomVis && !bDisableVisualizations ) { // load a random visualization CStringArray sVisualizationPaths; diff --git a/stepmania/src/Banner.cpp b/stepmania/src/Banner.cpp index c5fe1c4e5e..a1b224f0b5 100644 --- a/stepmania/src/Banner.cpp +++ b/stepmania/src/Banner.cpp @@ -30,12 +30,15 @@ void Banner::Update( float fDeltaTime ) { m_fPercentScrolling += fDeltaTime/2; m_fPercentScrolling -= (int)m_fPercentScrolling; + + FRECT* pTextureRect = m_pTexture->GetTextureCoordRect(0); + float fTexCoords[8] = { - 0+m_fPercentScrolling, 1, // bottom left - 0+m_fPercentScrolling, 0, // top left - 1+m_fPercentScrolling, 1, // bottom right - 1+m_fPercentScrolling, 0, // top right + 0+m_fPercentScrolling, pTextureRect->bottom, // bottom left + 0+m_fPercentScrolling, pTextureRect->top, // top left + 1+m_fPercentScrolling, pTextureRect->bottom, // bottom right + 1+m_fPercentScrolling, pTextureRect->top, // top right }; Sprite::SetCustomTextureCoords( fTexCoords ); } @@ -43,7 +46,7 @@ void Banner::Update( float fDeltaTime ) bool Banner::LoadFromSong( Song* pSong ) // NULL means no song { - TurnOffRoulette(); + m_bScrolling = false; Sprite::TurnShadowOff(); @@ -57,38 +60,22 @@ bool Banner::LoadFromSong( Song* pSong ) // NULL means no song bool Banner::LoadFromGroup( CString sGroupName ) { - TurnOffRoulette(); + m_bScrolling = true; CString sGroupBannerPath = SONGMAN->GetGroupBannerPath( sGroupName ); - if( sGroupBannerPath == "" ) + if( sGroupBannerPath != "" ) Banner::Load( sGroupBannerPath ); else - Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) ); + Banner::Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SECTION_BANNER) ); return true; } bool Banner::LoadRoulette() { - Banner::Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_ROULETTE_BANNER), false, 0, 0, false, true ); - TurnOnRoulette(); + Banner::Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_ROULETTE_BANNER), false, 0, 0, false, false ); + m_bScrolling = true; return true; } - -void Banner::TurnOnRoulette() -{ - m_bScrolling = true; - m_fPercentScrolling = 0; - - SetEffectGlowing( 1, D3DXCOLOR(1,0,0,0), D3DXCOLOR(1,0,0,0.5f) ); -} - -void Banner::TurnOffRoulette() -{ - m_bScrolling = false; - - SetEffectNone(); -} - diff --git a/stepmania/src/Banner.h b/stepmania/src/Banner.h index 2e95fab551..e07bf19fba 100644 --- a/stepmania/src/Banner.h +++ b/stepmania/src/Banner.h @@ -38,12 +38,7 @@ public: bool LoadFromGroup( CString sGroupName ); bool LoadRoulette(); - bool IsRouletteOn() { return m_bScrolling; }; - void TurnOnRoulette(); - void TurnOffRoulette(); - protected: - bool m_bScrolling; float m_fPercentScrolling; }; diff --git a/stepmania/src/Combo.cpp b/stepmania/src/Combo.cpp index 26a04bf958..d591e727f0 100644 --- a/stepmania/src/Combo.cpp +++ b/stepmania/src/Combo.cpp @@ -27,7 +27,7 @@ Combo::Combo() m_textComboNumber.Load( THEME->GetPathTo(FONT_COMBO_NUMBERS) ); m_textComboNumber.TurnShadowOn(); m_textComboNumber.SetHorizAlign( Actor::align_right ); - m_textComboNumber.SetX( -20 ); + m_textComboNumber.SetX( -10 ); m_textComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible diff --git a/stepmania/src/FootMeter.cpp b/stepmania/src/FootMeter.cpp index b74362f701..de2d752b2f 100644 --- a/stepmania/src/FootMeter.cpp +++ b/stepmania/src/FootMeter.cpp @@ -1,11 +1,12 @@ #include "stdafx.h" /* ----------------------------------------------------------------------------- - File: FootMeter.h + Class: FootMeter - Desc: A graphic displayed in the FootMeter during Dancing. + Desc: See header. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/FootMeter.h b/stepmania/src/FootMeter.h index bdb11d737f..3d9a8c878f 100644 --- a/stepmania/src/FootMeter.h +++ b/stepmania/src/FootMeter.h @@ -3,7 +3,7 @@ ----------------------------------------------------------------------------- Class: FootMeter - Desc: A graphic displayed in the FootMeter during Dancing. + Desc: A meter represention of how hard Notes is. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford diff --git a/stepmania/src/GameConstantsAndTypes.h b/stepmania/src/GameConstantsAndTypes.h index 6cb6d1236e..8691e69e66 100644 --- a/stepmania/src/GameConstantsAndTypes.h +++ b/stepmania/src/GameConstantsAndTypes.h @@ -10,87 +10,57 @@ ----------------------------------------------------------------------------- */ +///////////////////////////// +// Screen Dimensions +///////////////////////////// +#define SCREEN_WIDTH (640) +#define SCREEN_HEIGHT (480) -#define SCREEN_WIDTH (640) -#define SCREEN_HEIGHT (480) +#define SCREEN_LEFT (0) +#define SCREEN_RIGHT (SCREEN_WIDTH) +#define SCREEN_TOP (0) +#define SCREEN_BOTTOM (SCREEN_HEIGHT) -#define SCREEN_LEFT (0) -#define SCREEN_RIGHT (SCREEN_WIDTH) -#define SCREEN_TOP (0) -#define SCREEN_BOTTOM (SCREEN_HEIGHT) - -#define CENTER_X (SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT)/2.0f) -#define CENTER_Y (SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP)/2.0f) +#define CENTER_X (SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT)/2.0f) +#define CENTER_Y (SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP)/2.0f) -const int MAX_NOTE_TRACKS = 16; +///////////////////////// +// Note definitions +///////////////////////// +typedef unsigned char TapNote; +enum +{ + TRACK_1 = 0, + TRACK_2, + TRACK_3, + TRACK_4, + TRACK_5, + TRACK_6, + TRACK_7, + TRACK_8, + TRACK_9, + TRACK_10, + TRACK_11, + TRACK_12, + TRACK_13, + TRACK_14, + TRACK_15, + TRACK_16, + MAX_NOTE_TRACKS // leave this at the end +}; const int MAX_MEASURES = 200; // this should be long enough to hold 10:00 minute songs ( const int BEATS_PER_MEASURE = 4; const int MAX_BEATS = MAX_MEASURES * BEATS_PER_MEASURE; -const int ELEMENTS_PER_BEAT = 12; // It is important that this number is evenly divisible by 2, 3, 4, and 8 +const int ELEMENTS_PER_BEAT = 12; // It is important that this number is evenly divisible by 2, 3, and 4. const int ELEMENTS_PER_MEASURE = ELEMENTS_PER_BEAT * BEATS_PER_MEASURE; const int MAX_TAP_NOTE_ROWS = MAX_BEATS*ELEMENTS_PER_BEAT; const int MAX_HOLD_NOTE_ELEMENTS = 200; -enum RadarCatrgory // starting from 12-o'clock rotating clockwise -{ - RADAR_STREAM = 0, - RADAR_VOLTAGE, - RADAR_AIR, - RADAR_CHAOS, - RADAR_FREEZE, - 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 GameMode -{ - GAME_MODE_ARCADE, - GAME_MODE_FREE_PLAY, - GAME_MODE_NONSTOP, - NUM_GAME_MODES -}; - -enum GameButtonGraphic { - GRAPHIC_NOTE_COLOR_PART, - GRAPHIC_NOTE_GRAY_PART, - GRAPHIC_RECEPTOR, - GRAPHIC_TAP_EXPLOSION_BRIGHT, - GRAPHIC_TAP_EXPLOSION_DIM, - GRAPHIC_HOLD_EXPLOSION, - NUM_GAME_BUTTON_GRAPHICS // leave this at the end -}; - - -enum PlayerNumber { - PLAYER_1 = 0, - PLAYER_2, - NUM_PLAYERS, // leave this at the end - PLAYER_NONE -}; - -inline D3DXCOLOR PlayerToColor( PlayerNumber p ) -{ - switch( p ) - { - case PLAYER_1: return D3DXCOLOR(0.4f,1.0f,0.8f,1); // sea green - case PLAYER_2: return D3DXCOLOR(1.0f,0.5f,0.2f,1); // orange - default: ASSERT( false ); return D3DXCOLOR(1,1,1,1); - } -}; -inline D3DXCOLOR PlayerToColor( int p ) { return PlayerToColor( (PlayerNumber)p ); } - enum NoteType { NOTE_4TH, // quarter notes @@ -146,10 +116,112 @@ inline D3DXCOLOR GetNoteColorFromIndex( int iStepIndex ) return D3DXCOLOR(0.5f,0.5f,0.5f,1); }; -typedef unsigned char TapNote; -typedef unsigned char TrackNumber; -typedef unsigned short NoteIndex; -typedef TrackNumber ColumnNumber; +enum RadarCatrgory // starting from 12-o'clock rotating clockwise +{ + RADAR_STREAM = 0, + RADAR_VOLTAGE, + RADAR_AIR, + RADAR_CHAOS, + RADAR_FREEZE, + 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 +}; + +inline D3DXCOLOR DifficultyClassToColor( DifficultyClass dc ) +{ + switch( dc ) + { + case CLASS_EASY: return D3DXCOLOR(1,1,0,1); // yellow + case CLASS_MEDIUM: return D3DXCOLOR(1,0,0,1); // red + case CLASS_HARD: return D3DXCOLOR(0,1,0,1); // green + default: ASSERT(0); return D3DXCOLOR(); // invalid DifficultyClass + } +} + +enum NotesType +{ + NOTES_TYPE_DANCE_SINGLE = 0, + NOTES_TYPE_DANCE_DOUBLE, + NOTES_TYPE_DANCE_COUPLE, + NOTES_TYPE_DANCE_SOLO, + NOTES_TYPE_PUMP_SINGLE, + NOTES_TYPE_PUMP_VERSUS, + NUM_NOTES_TYPES // leave this at the end +}; + +inline int NotesTypeToNumColumns( NotesType nt ) +{ + switch( nt ) + { + case NOTES_TYPE_DANCE_SINGLE: return 4; + case NOTES_TYPE_DANCE_DOUBLE: return 8; + case NOTES_TYPE_DANCE_COUPLE: return 8; + case NOTES_TYPE_DANCE_SOLO: return 6; + case NOTES_TYPE_PUMP_SINGLE: return 5; + default: ASSERT(0); return -1; // invalid NotesType + } +} + +inline NotesType StringToNotesType( CString sNotesType ) +{ + if ( sNotesType == "dance-single" ) return NOTES_TYPE_DANCE_SINGLE; + else if( sNotesType == "dance-double" ) return NOTES_TYPE_DANCE_DOUBLE; + else if( sNotesType == "dance-couple" ) return NOTES_TYPE_DANCE_COUPLE; + else if( sNotesType == "dance-solo" ) return NOTES_TYPE_DANCE_SOLO; + else if( sNotesType == "pump-single" ) return NOTES_TYPE_PUMP_SINGLE; + else ASSERT(0); return NOTES_TYPE_DANCE_SINGLE; // invalid NotesType +} + +inline CString NotesTypeToString( NotesType nt ) +{ + switch( nt ) + { + case NOTES_TYPE_DANCE_SINGLE: return "dance-single"; + case NOTES_TYPE_DANCE_DOUBLE: return "dance-double"; + case NOTES_TYPE_DANCE_COUPLE: return "dance-couple"; + case NOTES_TYPE_DANCE_SOLO: return "dance-solo"; + case NOTES_TYPE_PUMP_SINGLE: return "pump-single"; + default: ASSERT(0); return ""; // invalid NotesType + } +} + + +////////////////////////// +// Play mode stuff +////////////////////////// +enum PlayMode +{ + PLAY_MODE_ARCADE, + PLAY_MODE_NONSTOP, + PLAY_MODE_ENDLESS, + NUM_PLAY_MODES +}; + +enum PlayerNumber { + PLAYER_1 = 0, + PLAYER_2, + NUM_PLAYERS, // leave this at the end + PLAYER_NONE +}; + +inline D3DXCOLOR PlayerToColor( PlayerNumber p ) +{ + switch( p ) + { + case PLAYER_1: return D3DXCOLOR(0.4f,1.0f,0.8f,1); // sea green + case PLAYER_2: return D3DXCOLOR(1.0f,0.5f,0.2f,1); // orange + default: ASSERT( false ); return D3DXCOLOR(1,1,1,1); + } +}; +inline D3DXCOLOR PlayerToColor( int p ) { return PlayerToColor( (PlayerNumber)p ); } + enum SongSortOrder { SORT_GROUP, @@ -160,70 +232,52 @@ enum SongSortOrder { }; - -struct GameOptions +/////////////////////////////// +// Game/Style definition stuff +/////////////////////////////// +enum Game { - GameOptions() + GAME_DANCE, + GAME_PUMP, + NUM_GAMES // leave this at the end +}; + +enum Style +{ + STYLE_DANCE_SINGLE, + STYLE_DANCE_VERSUS, + STYLE_DANCE_DOUBLE, + STYLE_DANCE_COUPLE, + STYLE_DANCE_SOLO, + STYLE_DANCE_SOLO_VERSUS, + STYLE_PUMP_SINGLE, + STYLE_PUMP_VERSUS, + NUM_STYLES // leave this at the end +}; + +inline Game StyleToGame( Style s ) +{ + switch( s ) { - m_bIgnoreJoyAxes = false; - m_bShowFPS = true; - m_bUseRandomVis = false; - m_bAnnouncer = true; - m_bEventMode = false; - m_bShowCaution = true; - m_bShowSelectDifficulty = true; - m_bShowSelectGroup = true; - m_iNumArcadeStages = 3; - m_iDifficulty = 4; - }; - bool m_bIgnoreJoyAxes; - bool m_bShowFPS; - bool m_bUseRandomVis; - bool m_bAnnouncer; - bool m_bEventMode; - bool m_bShowCaution; - bool m_bShowSelectDifficulty; - bool m_bShowSelectGroup; - int m_iNumArcadeStages; - int m_iDifficulty; -}; - -enum GraphicProfile -{ - PROFILE_SUPER_LOW = 0, - PROFILE_LOW, - PROFILE_MEDIUM, - PROFILE_HIGH, - PROFILE_CUSTOM, - NUM_GRAPHIC_PROFILES -}; - -struct GraphicProfileOptions -{ - char m_szProfileName[30]; - int m_iWidth; - int m_iHeight; - int m_iMaxTextureSize; - int m_iDisplayColor; - int m_iTextureColor; - bool m_bBackgrounds; -}; - -inline DWORD GetHeightFromWidth( DWORD dwWidth ) -{ - switch( dwWidth ) - { - case 320: return 240; - case 400: return 300; - case 512: return 384; - case 640: return 480; - case 800: return 600; - case 1024: return 768; - case 1280: return 1024; - default: return 480; + case STYLE_DANCE_SINGLE: + case STYLE_DANCE_VERSUS: + case STYLE_DANCE_DOUBLE: + case STYLE_DANCE_COUPLE: + case STYLE_DANCE_SOLO: + case STYLE_DANCE_SOLO_VERSUS: + return GAME_DANCE; + case STYLE_PUMP_SINGLE: + case STYLE_PUMP_VERSUS: + return GAME_PUMP; + default: + ASSERT(0); // invalid Style + return GAME_DANCE; } } +/////////////////////////// +// Options stuff +/////////////////////////// struct PlayerOptions { @@ -235,15 +289,8 @@ struct PlayerOptions m_bLittle = false; m_bReverseScroll = false; m_ColorType = COLOR_ARCADE; - m_bAllowFreezeArrows = true; + m_bHoldNotes = true; m_DrainType = DRAIN_NORMAL; - - m_fInitialLifePercentage = 0.5f; - m_fLifeAdjustments[LIFE_PERFECT] = 0.010f; - m_fLifeAdjustments[LIFE_GREAT] = 0.005f; - m_fLifeAdjustments[LIFE_GOOD] = 0.000f; - m_fLifeAdjustments[LIFE_BOO] = -0.015f; - m_fLifeAdjustments[LIFE_MISS] = -0.030f; }; float m_fArrowScrollSpeed; @@ -257,13 +304,9 @@ struct PlayerOptions bool m_bReverseScroll; enum ColorType { COLOR_ARCADE=0, COLOR_NOTE, COLOR_FLAT, COLOR_PLAIN }; ColorType m_ColorType; - bool m_bAllowFreezeArrows; + bool m_bHoldNotes; enum DrainType { DRAIN_NORMAL=0, DRAIN_NO_RECOVER, DRAIN_SUDDEN_DEATH }; DrainType m_DrainType; - - float m_fInitialLifePercentage; - enum LifeAdjustmentType { LIFE_PERFECT=0, LIFE_GREAT, LIFE_GOOD, LIFE_BOO, LIFE_MISS, NUM_LIFE_ADJUSTMENTS }; - float m_fLifeAdjustments[NUM_LIFE_ADJUSTMENTS]; }; struct SongOptions @@ -272,8 +315,6 @@ struct SongOptions m_FailType = FAIL_ARCADE; m_AssistType = ASSIST_NONE; m_fMusicRate = 1.0f; - m_fMusicPitch = 0.0f; - m_bShowMeasureBars = false; }; enum FailType { FAIL_ARCADE=0, FAIL_END_OF_SONG, FAIL_OFF }; @@ -281,8 +322,6 @@ struct SongOptions enum AssistType { ASSIST_NONE=0, ASSIST_TICK }; AssistType m_AssistType; float m_fMusicRate; - float m_fMusicPitch; - bool m_bShowMeasureBars; }; diff --git a/stepmania/src/GameDef.cpp b/stepmania/src/GameDef.cpp index fce4834e13..eead252c94 100644 --- a/stepmania/src/GameDef.cpp +++ b/stepmania/src/GameDef.cpp @@ -18,124 +18,6 @@ #include "StyleDef.h" -GameDef::GameDef( CString sGameDir ) -{ - LOG->WriteLine( "GameDef::GameDef( '%s )", sGameDir ); - - sGameDir.TrimRight( "/\\" ); // trim off the trailing slash if any - m_sGameDir = sGameDir + "\\"; - - // extract the game name - CString sThrowAway; - splitrelpath( sGameDir, sThrowAway, m_sName, sThrowAway ); - - // - // Parse the .game definition file - // - CString sGameFilePath = ssprintf("%s\\%s.game", sGameDir, m_sName); - IniFile ini; - ini.SetPath( sGameFilePath ); - if( !ini.ReadFile() ) - FatalError( "Error reading game definition file '%s'.", sGameFilePath ); - - - CString sGameName; - ini.GetValue( "Game", "Name", sGameName ); - if( sGameName != m_sName ) - FatalError( "Game name in '%s' doesn't match the directory name.", sGameFilePath ); - - ini.GetValue( "Game", "Description", m_sDescription ); - - ini.GetValueI( "Game", "NumInstruments", m_iNumInstruments ); - if( m_iNumInstruments != 2 ) - FatalError( "Invalid value for NumInstruments in '%s'.", sGameFilePath ); - - ini.GetValueI( "Game", "ButtonsPerInstrument", m_iButtonsPerInstrument ); - if( m_iButtonsPerInstrument < 1 || m_iButtonsPerInstrument > MAX_INSTRUMENT_BUTTONS ) - FatalError( "Invalid value for ButtonsPerInstrument in '%s'.", sGameFilePath ); - - CString sButtonsString; - ini.GetValue( "Game", "ButtonNames", sButtonsString ); - CStringArray arrayButtonNames; - split( sButtonsString, ",", arrayButtonNames ); - if( arrayButtonNames.GetSize() != m_iButtonsPerInstrument ) - FatalError( "Button names do not match number of buttons in '%s'.", sGameFilePath ); - for( int i=0; im_sName == sStyle ) - return m_pStyleDefs[i]; - } - return NULL; -} - CString GameDef::ElementToGraphicSuffix( const GameButtonGraphic gbg ) { CString sAssetPath; // fill this in below @@ -158,8 +40,8 @@ CString GameDef::ElementToGraphicSuffix( const GameButtonGraphic gbg ) CString GameDef::GetPathToGraphic( const CString sSkinName, const int iInstrumentButton, const GameButtonGraphic gbg ) { - const CString sSkinDir = ssprintf("%s\\%s\\", m_sGameDir, sSkinName); - const CString sButtonName = m_sButtonNames[ iInstrumentButton ]; + const CString sSkinDir = ssprintf("Skins\\%s\\%s\\", m_szName, sSkinName); + const CString sButtonName = m_szButtonNames[ iInstrumentButton ]; const CString sGraphicSuffix = ElementToGraphicSuffix( gbg ); CStringArray arrayPossibleFileNames; // fill this with the possible files @@ -178,8 +60,8 @@ CString GameDef::GetPathToGraphic( const CString sSkinName, const int iInstrumen void GameDef::GetTweenColors( const CString sSkinName, const int iInstrumentButton, CArray &arrayTweenColors ) { - const CString sSkinDir = ssprintf("%s\\%s\\", m_sGameDir, sSkinName); - const CString sButtonName = m_sButtonNames[ iInstrumentButton ]; + const CString sSkinDir = ssprintf("Skins\\%s\\%s\\", m_szName, sSkinName); + const CString sButtonName = m_szButtonNames[ iInstrumentButton ]; const CString sColorsFilePath = sSkinDir + sButtonName + ".colors"; @@ -201,3 +83,42 @@ void GameDef::GetTweenColors( const CString sSkinName, const int iInstrumentButt return; } +void GameDef::GetSkinNames( CStringArray &AddTo ) +{ + CString sBaseSkinFolder = "Skins\\" + CString(m_szName) + "\\"; + GetDirListing( sBaseSkinFolder + "*.*", AddTo, true ); + if( AddTo.GetSize() == 0 ) + FatalError( "The folder '%s' must contain at least one skin.", sBaseSkinFolder ); +} + +bool GameDef::HasASkinNamed( CString sSkin ) +{ + CStringArray asSkinNames; + GetSkinNames( asSkinNames ); + + for( int i=0; i &arrayTweenColors ); CString ElementToGraphicSuffix( const GameButtonGraphic gbg ); diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index cebdd6f130..290d81dfbd 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -14,164 +14,385 @@ #include "ErrorCatcher/ErrorCatcher.h" -GameManager* GAME = NULL; // global and accessable from anywhere in our program +GameManager* GAMEMAN = NULL; // global and accessable from anywhere in our program -#define DANCE_PAD_BUTTON_LEFT INSTRUMENT_BUTTON_1 -#define DANCE_PAD_BUTTON_RIGHT INSTRUMENT_BUTTON_2 -#define DANCE_PAD_BUTTON_UP INSTRUMENT_BUTTON_3 -#define DANCE_PAD_BUTTON_DOWN INSTRUMENT_BUTTON_4 -#define DANCE_PAD_BUTTON_UPLEFT INSTRUMENT_BUTTON_5 -#define DANCE_PAD_BUTTON_UPRIGHT INSTRUMENT_BUTTON_6 -#define DANCE_PAD_BUTTON_NEXT INSTRUMENT_BUTTON_7 -#define DANCE_PAD_BUTTON_BACK INSTRUMENT_BUTTON_8 -#define NUM_DANCE_PAD_BUTTONS 8 +InstrumentButton DANCE_BUTTON_LEFT = (InstrumentButton)0; +InstrumentButton DANCE_BUTTON_RIGHT = (InstrumentButton)1; +InstrumentButton DANCE_BUTTON_UP = (InstrumentButton)2; +InstrumentButton DANCE_BUTTON_DOWN = (InstrumentButton)3; +InstrumentButton DANCE_BUTTON_UPLEFT = (InstrumentButton)4; +InstrumentButton DANCE_BUTTON_UPRIGHT = (InstrumentButton)5; +InstrumentButton DANCE_BUTTON_SELECT = (InstrumentButton)6; +InstrumentButton DANCE_BUTTON_START = (InstrumentButton)7; +int NUM_DANCE_BUTTONS = 8; +InstrumentButton PUMP_BUTTON_UPLEFT = (InstrumentButton)0; +InstrumentButton PUMP_BUTTON_UPRIGHT = (InstrumentButton)1; +InstrumentButton PUMP_BUTTON_CENTER = (InstrumentButton)2; +InstrumentButton PUMP_BUTTON_DOWNLEFT = (InstrumentButton)3; +InstrumentButton PUMP_BUTTON_DOWNRIGHT = (InstrumentButton)4; +InstrumentButton PUMP_BUTTON_SELECT = (InstrumentButton)5; +int NUM_PUMP_BUTTONS = 6; + + +const int DANCE_COL_SPACING = 64; +const int DANCE_6PANEL_VERSUS_COL_SPACING = 54; +const int PUMP_COL_SPACING = 60; + + +GameDef g_GameDefs[NUM_GAMES] = +{ + { // GAME_DANCE + "dance", // m_szName + "Dance Dance Revolution", // m_szDescription + 2, // m_iNumInstruments + NUM_DANCE_BUTTONS, // m_iButtonsPerInstrument + { // m_szButtonNames + "Left", + "Right", + "Up", + "Down", + "UpLeft", + "UpRight", + "Back", + "Start" + }, + { // m_iMenuButtons[NUM_MENU_BUTTONS]; // map from MenuButton to m_szButtonNames + DANCE_BUTTON_LEFT, // MENU_BUTTON_LEFT + DANCE_BUTTON_RIGHT, // MENU_BUTTON_RIGHT + DANCE_BUTTON_UP, // MENU_BUTTON_UP + DANCE_BUTTON_DOWN, // MENU_BUTTON_DOWN + DANCE_BUTTON_START, // MENU_BUTTON_START + DANCE_BUTTON_SELECT, // MENU_BUTTON_BACK + }, + }, + { // GAME_DANCE + "pump", // m_szName + "Pump It Up", // m_szDescription + 2, // m_iNumInstruments + NUM_DANCE_BUTTONS, // m_iButtonsPerInstrument + { // m_szButtonNames + "UpLeft", + "UpRight", + "Center", + "DownLeft", + "DownRight", + "Back" + }, + { // m_iMenuButtons[NUM_MENU_BUTTONS]; // map from MenuButton to m_szButtonNames + PUMP_BUTTON_UPLEFT, // MENU_BUTTON_LEFT + PUMP_BUTTON_UPRIGHT, // MENU_BUTTON_RIGHT + PUMP_BUTTON_DOWNRIGHT, // MENU_BUTTON_UP + PUMP_BUTTON_DOWNLEFT, // MENU_BUTTON_DOWN + PUMP_BUTTON_CENTER, // MENU_BUTTON_START + PUMP_BUTTON_SELECT, // MENU_BUTTON_BACK + }, + }, +}; + + +StyleDef g_StyleDefSingle = + { // STYLE_DANCE_SINGLE + "dance-single", // m_szName + NOTES_TYPE_DANCE_SINGLE, // m_NotesType + StyleDef::ONE_PLAYER_USES_ONE_SIDE, // m_StyleType + { 160, 480 }, // m_iCenterX + 4, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, INSTRUMENT_1, DANCE_BUTTON_LEFT, -DANCE_COL_SPACING*1.5f }, + { TRACK_2, INSTRUMENT_1, DANCE_BUTTON_DOWN, -DANCE_COL_SPACING*0.5f }, + { TRACK_3, INSTRUMENT_1, DANCE_BUTTON_UP, +DANCE_COL_SPACING*0.5f }, + { TRACK_4, INSTRUMENT_1, DANCE_BUTTON_RIGHT, +DANCE_COL_SPACING*1.5f }, + }, + { // PLAYER_2 + { TRACK_1, INSTRUMENT_2, DANCE_BUTTON_LEFT, -DANCE_COL_SPACING*1.5f }, + { TRACK_2, INSTRUMENT_2, DANCE_BUTTON_DOWN, -DANCE_COL_SPACING*0.5f }, + { TRACK_3, INSTRUMENT_2, DANCE_BUTTON_UP, +DANCE_COL_SPACING*0.5f }, + { TRACK_4, INSTRUMENT_2, DANCE_BUTTON_RIGHT, +DANCE_COL_SPACING*1.5f }, + }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0, 1, 2, 3 + }, + }; + + + + +StyleDef g_StyleDefs[NUM_STYLES] = +{ + { // STYLE_DANCE_SINGLE + "dance-single", // m_szName + NOTES_TYPE_DANCE_SINGLE, // m_NotesType + StyleDef::ONE_PLAYER_USES_ONE_SIDE, // m_StyleType + { 160, 480 }, // m_iCenterX + 4, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, INSTRUMENT_1, DANCE_BUTTON_LEFT, -DANCE_COL_SPACING*1.5f }, + { TRACK_2, INSTRUMENT_1, DANCE_BUTTON_DOWN, -DANCE_COL_SPACING*0.5f }, + { TRACK_3, INSTRUMENT_1, DANCE_BUTTON_UP, +DANCE_COL_SPACING*0.5f }, + { TRACK_4, INSTRUMENT_1, DANCE_BUTTON_RIGHT, +DANCE_COL_SPACING*1.5f }, + }, + { // PLAYER_2 + { TRACK_1, INSTRUMENT_2, DANCE_BUTTON_LEFT, -DANCE_COL_SPACING*1.5f }, + { TRACK_2, INSTRUMENT_2, DANCE_BUTTON_DOWN, -DANCE_COL_SPACING*0.5f }, + { TRACK_3, INSTRUMENT_2, DANCE_BUTTON_UP, +DANCE_COL_SPACING*0.5f }, + { TRACK_4, INSTRUMENT_2, DANCE_BUTTON_RIGHT, +DANCE_COL_SPACING*1.5f }, + }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0, 1, 2, 3 + }, + }, + { // STYLE_DANCE_VERSUS + "dance-versus", // m_szName + NOTES_TYPE_DANCE_SINGLE, // m_NotesType + StyleDef::TWO_PLAYERS_USE_TWO_SIDES, // m_StyleType + { 160, 480 }, // m_iCenterX + 4, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, INSTRUMENT_1, DANCE_BUTTON_LEFT, -DANCE_COL_SPACING*1.5f }, + { TRACK_2, INSTRUMENT_1, DANCE_BUTTON_DOWN, -DANCE_COL_SPACING*0.5f }, + { TRACK_3, INSTRUMENT_1, DANCE_BUTTON_UP, +DANCE_COL_SPACING*0.5f }, + { TRACK_4, INSTRUMENT_1, DANCE_BUTTON_RIGHT, +DANCE_COL_SPACING*1.5f }, + }, + { // PLAYER_2 + { TRACK_1, INSTRUMENT_2, DANCE_BUTTON_LEFT, -DANCE_COL_SPACING*1.5f }, + { TRACK_2, INSTRUMENT_2, DANCE_BUTTON_DOWN, -DANCE_COL_SPACING*0.5f }, + { TRACK_3, INSTRUMENT_2, DANCE_BUTTON_UP, +DANCE_COL_SPACING*0.5f }, + { TRACK_4, INSTRUMENT_2, DANCE_BUTTON_RIGHT, +DANCE_COL_SPACING*1.5f }, + }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0, 1, 2, 3 + }, + }, + { // STYLE_DANCE_DOUBLE + "dance-double", // m_szName + NOTES_TYPE_DANCE_DOUBLE, // m_NotesType + StyleDef::ONE_PLAYER_USES_TWO_SIDES, // m_StyleType + { 320, 320 }, // m_iCenterX + 8, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, INSTRUMENT_1, DANCE_BUTTON_LEFT, -DANCE_COL_SPACING*3.5f }, + { TRACK_2, INSTRUMENT_1, DANCE_BUTTON_DOWN, -DANCE_COL_SPACING*2.5f }, + { TRACK_3, INSTRUMENT_1, DANCE_BUTTON_UP, -DANCE_COL_SPACING*1.5f }, + { TRACK_4, INSTRUMENT_1, DANCE_BUTTON_RIGHT, -DANCE_COL_SPACING*0.5f }, + { TRACK_5, INSTRUMENT_2, DANCE_BUTTON_LEFT, +DANCE_COL_SPACING*0.5f }, + { TRACK_6, INSTRUMENT_2, DANCE_BUTTON_DOWN, +DANCE_COL_SPACING*1.5f }, + { TRACK_7, INSTRUMENT_2, DANCE_BUTTON_UP, +DANCE_COL_SPACING*2.5f }, + { TRACK_8, INSTRUMENT_2, DANCE_BUTTON_RIGHT, +DANCE_COL_SPACING*3.5f }, + }, + { // PLAYER_2 + { TRACK_1, INSTRUMENT_1, DANCE_BUTTON_LEFT, -DANCE_COL_SPACING*3.5f }, + { TRACK_2, INSTRUMENT_1, DANCE_BUTTON_DOWN, -DANCE_COL_SPACING*2.5f }, + { TRACK_3, INSTRUMENT_1, DANCE_BUTTON_UP, -DANCE_COL_SPACING*1.5f }, + { TRACK_4, INSTRUMENT_1, DANCE_BUTTON_RIGHT, -DANCE_COL_SPACING*0.5f }, + { TRACK_5, INSTRUMENT_2, DANCE_BUTTON_LEFT, +DANCE_COL_SPACING*0.5f }, + { TRACK_6, INSTRUMENT_2, DANCE_BUTTON_DOWN, +DANCE_COL_SPACING*1.5f }, + { TRACK_7, INSTRUMENT_2, DANCE_BUTTON_UP, +DANCE_COL_SPACING*2.5f }, + { TRACK_8, INSTRUMENT_2, DANCE_BUTTON_RIGHT, +DANCE_COL_SPACING*3.5f }, + }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5,6,7 + }, + }, + { // StyleDef + "dance-couple", // m_szName + NOTES_TYPE_DANCE_SINGLE, // m_NotesType + StyleDef::TWO_PLAYERS_USE_TWO_SIDES, // m_StyleType + { 160, 480 }, // m_iCenterX + 4, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, INSTRUMENT_1, DANCE_BUTTON_LEFT, -DANCE_COL_SPACING*1.5f }, + { TRACK_2, INSTRUMENT_1, DANCE_BUTTON_DOWN, -DANCE_COL_SPACING*0.5f }, + { TRACK_3, INSTRUMENT_1, DANCE_BUTTON_UP, +DANCE_COL_SPACING*0.5f }, + { TRACK_4, INSTRUMENT_1, DANCE_BUTTON_RIGHT, +DANCE_COL_SPACING*1.5f }, + }, + { // PLAYER_2 + { TRACK_1, INSTRUMENT_2, DANCE_BUTTON_LEFT, -DANCE_COL_SPACING*1.5f }, + { TRACK_2, INSTRUMENT_2, DANCE_BUTTON_DOWN, -DANCE_COL_SPACING*0.5f }, + { TRACK_3, INSTRUMENT_2, DANCE_BUTTON_UP, +DANCE_COL_SPACING*0.5f }, + { TRACK_4, INSTRUMENT_2, DANCE_BUTTON_RIGHT, +DANCE_COL_SPACING*1.5f }, + }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3 + }, + }, + { // STYLE_DANCE_SOLO + "dance-solo", // m_szName + NOTES_TYPE_DANCE_SOLO, // m_NotesType + StyleDef::ONE_PLAYER_USES_ONE_SIDE, // m_StyleType + { 240, 400 }, // m_iCenterX + 6, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, INSTRUMENT_1, DANCE_BUTTON_LEFT, -DANCE_COL_SPACING*2.5f }, + { TRACK_2, INSTRUMENT_1, DANCE_BUTTON_UPLEFT, -DANCE_COL_SPACING*1.5f }, + { TRACK_3, INSTRUMENT_1, DANCE_BUTTON_DOWN, -DANCE_COL_SPACING*0.5f }, + { TRACK_4, INSTRUMENT_1, DANCE_BUTTON_UP, +DANCE_COL_SPACING*0.5f }, + { TRACK_5, INSTRUMENT_1, DANCE_BUTTON_UPRIGHT, +DANCE_COL_SPACING*1.5f }, + { TRACK_6, INSTRUMENT_1, DANCE_BUTTON_RIGHT, +DANCE_COL_SPACING*2.5f }, + }, + { // PLAYER_2 + { TRACK_1, INSTRUMENT_2, DANCE_BUTTON_LEFT, -DANCE_COL_SPACING*2.5f }, + { TRACK_2, INSTRUMENT_2, DANCE_BUTTON_UPLEFT, -DANCE_COL_SPACING*1.5f }, + { TRACK_3, INSTRUMENT_2, DANCE_BUTTON_DOWN, -DANCE_COL_SPACING*0.5f }, + { TRACK_4, INSTRUMENT_2, DANCE_BUTTON_UP, +DANCE_COL_SPACING*0.5f }, + { TRACK_5, INSTRUMENT_2, DANCE_BUTTON_UPRIGHT, +DANCE_COL_SPACING*1.5f }, + { TRACK_6, INSTRUMENT_2, DANCE_BUTTON_RIGHT, +DANCE_COL_SPACING*2.5f }, + }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,1,2,3,4,5 + }, + }, + { // STYLE_DANCE_SOLO_VERSUS + "dance-solo-versus", // m_szName + NOTES_TYPE_DANCE_SOLO, // m_NotesType + StyleDef::ONE_PLAYER_USES_ONE_SIDE, // m_StyleType + { 160, 480 }, // m_iCenterX + 6, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, INSTRUMENT_1, DANCE_BUTTON_LEFT, -DANCE_6PANEL_VERSUS_COL_SPACING*2.5f }, + { TRACK_2, INSTRUMENT_1, DANCE_BUTTON_UPLEFT, -DANCE_6PANEL_VERSUS_COL_SPACING*1.5f }, + { TRACK_3, INSTRUMENT_1, DANCE_BUTTON_DOWN, -DANCE_6PANEL_VERSUS_COL_SPACING*0.5f }, + { TRACK_4, INSTRUMENT_1, DANCE_BUTTON_UP, +DANCE_6PANEL_VERSUS_COL_SPACING*0.5f }, + { TRACK_5, INSTRUMENT_1, DANCE_BUTTON_UPRIGHT, +DANCE_6PANEL_VERSUS_COL_SPACING*1.5f }, + { TRACK_6, INSTRUMENT_1, DANCE_BUTTON_RIGHT, +DANCE_6PANEL_VERSUS_COL_SPACING*2.5f }, + }, + { // PLAYER_2 + { TRACK_1, INSTRUMENT_2, DANCE_BUTTON_LEFT, -DANCE_6PANEL_VERSUS_COL_SPACING*2.5f }, + { TRACK_2, INSTRUMENT_2, DANCE_BUTTON_UPLEFT, -DANCE_6PANEL_VERSUS_COL_SPACING*1.5f }, + { TRACK_3, INSTRUMENT_2, DANCE_BUTTON_DOWN, -DANCE_6PANEL_VERSUS_COL_SPACING*0.5f }, + { TRACK_4, INSTRUMENT_2, DANCE_BUTTON_UP, +DANCE_6PANEL_VERSUS_COL_SPACING*0.5f }, + { TRACK_5, INSTRUMENT_2, DANCE_BUTTON_UPRIGHT, +DANCE_6PANEL_VERSUS_COL_SPACING*1.5f }, + { TRACK_6, INSTRUMENT_2, DANCE_BUTTON_RIGHT, +DANCE_6PANEL_VERSUS_COL_SPACING*2.5f }, + }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,5,1,4,2,3 // outside in + }, + }, + { // PUMP_STYLE_SINGLE + "single", // m_szName + NOTES_TYPE_PUMP_SINGLE, // m_NotesType + StyleDef::ONE_PLAYER_USES_ONE_SIDE, // m_StyleType + { 160, 480 }, // m_iCenterX + 5, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, INSTRUMENT_1, PUMP_BUTTON_DOWNLEFT, -PUMP_COL_SPACING*2 }, + { TRACK_2, INSTRUMENT_1, PUMP_BUTTON_UPLEFT, -PUMP_COL_SPACING*1 }, + { TRACK_3, INSTRUMENT_1, PUMP_BUTTON_CENTER, +PUMP_COL_SPACING*0 }, + { TRACK_4, INSTRUMENT_1, PUMP_BUTTON_UPRIGHT, +PUMP_COL_SPACING*1 }, + { TRACK_5, INSTRUMENT_1, PUMP_BUTTON_DOWNRIGHT, +PUMP_COL_SPACING*2 }, + }, + { // PLAYER_2 + { TRACK_1, INSTRUMENT_2, PUMP_BUTTON_DOWNLEFT, -PUMP_COL_SPACING*2 }, + { TRACK_2, INSTRUMENT_2, PUMP_BUTTON_UPLEFT, -PUMP_COL_SPACING*1 }, + { TRACK_3, INSTRUMENT_2, PUMP_BUTTON_CENTER, +PUMP_COL_SPACING*0 }, + { TRACK_4, INSTRUMENT_2, PUMP_BUTTON_UPRIGHT, +PUMP_COL_SPACING*1 }, + { TRACK_5, INSTRUMENT_2, PUMP_BUTTON_DOWNRIGHT, +PUMP_COL_SPACING*2 }, + }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,2,4,1,3 + }, + }, + { // PUMP_STYLE_VERSUS + "pump-versus", // m_szName + NOTES_TYPE_PUMP_SINGLE, // m_NotesType + StyleDef::TWO_PLAYERS_USE_TWO_SIDES, // m_StyleType + { 160, 480 }, // m_iCenterX + 5, // m_iColsPerPlayer + { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; + { // PLAYER_1 + { TRACK_1, INSTRUMENT_1, PUMP_BUTTON_DOWNLEFT, -PUMP_COL_SPACING*2 }, + { TRACK_2, INSTRUMENT_1, PUMP_BUTTON_UPLEFT, -PUMP_COL_SPACING*1 }, + { TRACK_3, INSTRUMENT_1, PUMP_BUTTON_CENTER, +PUMP_COL_SPACING*0 }, + { TRACK_4, INSTRUMENT_1, PUMP_BUTTON_UPRIGHT, +PUMP_COL_SPACING*1 }, + { TRACK_5, INSTRUMENT_1, PUMP_BUTTON_DOWNRIGHT, +PUMP_COL_SPACING*2 }, + }, + { // PLAYER_2 + { TRACK_1, INSTRUMENT_2, PUMP_BUTTON_DOWNLEFT, -PUMP_COL_SPACING*2 }, + { TRACK_2, INSTRUMENT_2, PUMP_BUTTON_UPLEFT, -PUMP_COL_SPACING*1 }, + { TRACK_3, INSTRUMENT_2, PUMP_BUTTON_CENTER, +PUMP_COL_SPACING*0 }, + { TRACK_4, INSTRUMENT_2, PUMP_BUTTON_UPRIGHT, +PUMP_COL_SPACING*1 }, + { TRACK_5, INSTRUMENT_2, PUMP_BUTTON_DOWNRIGHT, +PUMP_COL_SPACING*2 }, + }, + }, + { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; + 0,2,4,1,3 + }, + }, +}; GameManager::GameManager() { - m_iNumGameDefs = 0; - ReadGamesAndStylesFromDir( "Games" ); - SwitchGame( "dance" ); - SwitchStyle( "single" ); -} + m_CurStyle = STYLE_DANCE_SINGLE; -GameManager::~GameManager() -{ - for( int i=0; im_sName == sGame ) - return m_pGameDefs[i]; - } - return NULL; +Game GameManager::GetCurrentGame() +{ + return StyleToGame( m_CurStyle ); } -StyleDef* GameManager::GetStyleDef( CString sGame, CString sStyle ) +GameDef* GameManager::GetCurrentGameDef() { - GameDef* pGameDef = GetGameDef( sGame ); - - return pGameDef->GetStyleDef( sStyle ); - - return NULL; + return &g_GameDefs[ GetCurrentGame() ]; } -void GameManager::SwitchGame( CString sGame ) +StyleDef* GameManager::GetCurrentStyleDef() { - m_sCurrentGame = sGame; - m_pCurrentGameDef = GetGameDef( sGame ); - if( m_pCurrentGameDef == NULL ) - FatalError( "SwitchGame failed. The game '%s' is not present.", sGame ); + return &g_StyleDefs[ m_CurStyle ]; +} - for( int p=0; pm_sSkinFolders[0]; +void GameManager::GetGameNames( CStringArray &AddTo ) +{ + for( int i=0; iGetSkinNames( AddTo ); +} + +bool GameManager::IsPlayerEnabled( PlayerNumber pn ) +{ + return ( pn == m_sMasterPlayerNumber ) || + ( GetCurrentStyleDef()->m_StyleType == StyleDef::TWO_PLAYERS_USE_TWO_SIDES ); }; -void GameManager::SwitchStyle( CString sStyle ) +CString GameManager::GetPathToGraphic( const PlayerNumber p, const int col, const GameButtonGraphic gbg ) { - m_sCurrentStyle = sStyle; - m_pCurrentStyleDef = GetStyleDef( m_sCurrentGame, sStyle ); - ASSERT( m_pCurrentStyleDef != NULL ); -}; - -void GameManager::SwitchSkin( PlayerNumber p, CString sSkin ) -{ - if( !m_pCurrentGameDef->HasASkinNamed( sSkin ) ) - FatalError( "The current game doesn't have a skin named '%s'.", sSkin ); - - m_sCurrentSkin[p] = sSkin; + StyleInput si( p, col ); + GameInput gi = GetCurrentStyleDef()->StyleInputToGameInput( si ); + InstrumentButton b = gi.button; + return GetCurrentGameDef()->GetPathToGraphic( m_sCurrentSkin[p], b, gbg ); } -void GameManager::GetGameNames( CStringArray &arrayGameNames ) +void GameManager::GetTweenColors( const PlayerNumber p, const int col, CArray &aTweenColorsAddTo ) { - for( int i=0; im_sName ); -} - - -void GameManager::GetStyleNames( CString sGameName, CStringArray &arrayStyleNames ) -{ - GameDef* pGameDef = GetGameDef( sGameName ); - - for( int i=0; im_iNumStyleDefs; i++ ) - { - arrayStyleNames.Add( pGameDef->m_pStyleDefs[i]->m_sName ); - } -} - - -void GameManager::GetSkinNames( CString sGameName, CStringArray &arraySkinNames ) -{ - GameDef* pGameDef = GetGameDef( sGameName ); - - for( int i=0; im_iNumSkinFolders; i++ ) - arraySkinNames.Add( pGameDef->m_sSkinFolders[i] ); -} - -bool GameManager::IsPlayerEnabled( PlayerNumber PlayerNo ) -{ - StyleDef* pStyleDef = GetCurrentStyleDef(); - ASSERT( pStyleDef != NULL ); - - switch( pStyleDef->m_iNumPlayers ) - { - case 1: - switch( PlayerNo ) - { - case PLAYER_1: return true; - case PLAYER_2: return false; - default: ASSERT( false ); - } - break; - case 2: - switch( PlayerNo ) - { - case PLAYER_1: return true; - case PLAYER_2: return true; - default: ASSERT( false ); - } - break; - default: - ASSERT( false ); // invalid m_iNumPlayers - } - - return false; -} - -void GameManager::GetTweenColors( const PlayerNumber p, const ColumnNumber col, CArray &aTweenColorsAddTo ) -{ - GameDef* pGameDef = GetCurrentGameDef(); - StyleDef* pStyleDef = GetCurrentStyleDef(); StyleInput StyleI( p, col ); - GameInput GameI = pStyleDef->StyleInputToGameInput( StyleI ); - - pGameDef->GetTweenColors( m_sCurrentSkin[p], GameI.button, aTweenColorsAddTo ); + GameInput GameI = GetCurrentStyleDef()->StyleInputToGameInput( StyleI ); + GetCurrentGameDef()->GetTweenColors( m_sCurrentSkin[p], GameI.button, aTweenColorsAddTo ); } diff --git a/stepmania/src/GameManager.h b/stepmania/src/GameManager.h index 43f5f99f14..6aa8263471 100644 --- a/stepmania/src/GameManager.h +++ b/stepmania/src/GameManager.h @@ -21,47 +21,21 @@ class GameManager { public: GameManager(); - ~GameManager(); - void ReadGamesAndStylesFromDir( CString sDir ); - void SwitchGame( CString sGame ); - void SwitchStyle( CString sStyle ); - void SwitchSkin( PlayerNumber p, CString sSkin ); + Style m_CurStyle; + NotesType m_CurNotesType; // only used in Edit + CString m_sCurrentSkin[NUM_PLAYERS]; + PlayerNumber m_sMasterPlayerNumber; - CString m_sCurrentGame; // currently only "dance" - CString m_sCurrentStyle; // currently only "single", "versus", "double", "couple", "solo" - inline GameDef* GetCurrentGameDef() { return m_pCurrentGameDef; }; - inline StyleDef* GetCurrentStyleDef() { return m_pCurrentStyleDef; }; - CString m_sCurrentSkin[NUM_PLAYERS]; // - - void GetGameNames( CStringArray &arrayGameNames ); - void GetStyleNames( CString sGameName, CStringArray &arrayStyleNames ); - void GetSkinNames( CString sGameName, CStringArray &arraySkinNames ); - void GetSkinNames( CStringArray &arraySkinNames ) { GetSkinNames( m_sCurrentGame, arraySkinNames ); }; + Game GetCurrentGame(); // inferred from m_CurStyle + GameDef* GetCurrentGameDef(); + StyleDef* GetCurrentStyleDef(); + void GetGameNames( CStringArray &AddTo ); + void GetSkinNames( CStringArray &AddTo ); bool IsPlayerEnabled( PlayerNumber PlayerNo ); - - // graphic stuff - CString GetPathToGraphic( const PlayerNumber p, const ColumnNumber col, const GameButtonGraphic gbg ) - { - StyleInput si( p, col ); - GameInput gi = GetCurrentStyleDef()->StyleInputToGameInput( si ); - InstrumentButton b = gi.button; - return GetCurrentGameDef()->GetPathToGraphic( m_sCurrentSkin[p], b, gbg ); - } - void GetTweenColors( const PlayerNumber p, const ColumnNumber col, CArray &aTweenColorsAddTo ); - - -protected: - int m_iNumGameDefs; - GameDef* m_pGameDefs[MAX_GAME_DEFS]; - - GameDef* m_pCurrentGameDef; - StyleDef* m_pCurrentStyleDef; - - GameDef* GetGameDef( CString sGame ); - StyleDef* GetStyleDef( CString sGame, CString sStyle ); + CString GetPathToGraphic( const PlayerNumber p, const int col, const GameButtonGraphic gbg ); + void GetTweenColors( const PlayerNumber p, const int col, CArray &aTweenColorsAddTo ); }; - -extern GameManager* GAME; // global and accessable from anywhere in our program +extern GameManager* GAMEMAN; // global and accessable from anywhere in our program diff --git a/stepmania/src/GhostArrowRow.cpp b/stepmania/src/GhostArrowRow.cpp index 297e25b649..8411006a48 100644 --- a/stepmania/src/GhostArrowRow.cpp +++ b/stepmania/src/GhostArrowRow.cpp @@ -24,21 +24,24 @@ GhostArrowRow::GhostArrowRow() m_iNumCols = 0; } -void GhostArrowRow::Load( PlayerOptions po ) +void GhostArrowRow::Load( PlayerNumber pn, StyleDef* pStyleDef, PlayerOptions po ) { m_PlayerOptions = po; - StyleDef* pStyleDef = GAME->GetCurrentStyleDef(); - GameDef* pGameDef = GAME->GetCurrentGameDef(); + GameDef* pGameDef = GAMEMAN->GetCurrentGameDef(); m_iNumCols = pStyleDef->m_iColsPerPlayer; // init arrows for( int c=0; cGetPathToGraphic(PLAYER_1, c, GRAPHIC_TAP_EXPLOSION_DIM) ); - m_GhostArrowRowBright[c].Load( GAME->GetPathToGraphic(PLAYER_1, c, GRAPHIC_TAP_EXPLOSION_BRIGHT) ); - m_HoldGhostArrowRow[c].Load( GAME->GetPathToGraphic(PLAYER_1, c, GRAPHIC_HOLD_EXPLOSION) ); + m_GhostArrowRow[c].Load( GAMEMAN->GetPathToGraphic(pn, c, GRAPHIC_TAP_EXPLOSION_DIM) ); + m_GhostArrowRowBright[c].Load( GAMEMAN->GetPathToGraphic(pn, c, GRAPHIC_TAP_EXPLOSION_BRIGHT) ); + m_HoldGhostArrowRow[c].Load( GAMEMAN->GetPathToGraphic(pn, c, GRAPHIC_HOLD_EXPLOSION) ); + + m_GhostArrowRow[c].SetX( pStyleDef->m_ColumnInfo[pn][c].fXOffset ); + m_GhostArrowRowBright[c].SetX( pStyleDef->m_ColumnInfo[pn][c].fXOffset ); + m_HoldGhostArrowRow[c].SetX( pStyleDef->m_ColumnInfo[pn][c].fXOffset ); } } diff --git a/stepmania/src/GhostArrowRow.h b/stepmania/src/GhostArrowRow.h index e6cbda22d3..146c29118d 100644 --- a/stepmania/src/GhostArrowRow.h +++ b/stepmania/src/GhostArrowRow.h @@ -26,7 +26,7 @@ public: void Update( float fDeltaTime, float fSongBeat ); virtual void DrawPrimitives(); - void Load( PlayerOptions po ); + void Load( PlayerNumber pn, StyleDef* pStyleDef, PlayerOptions po ); void TapNote( int iCol, TapNoteScore score, bool bBright ); void HoldNote( int iCol ); diff --git a/stepmania/src/GrayArrowRow.cpp b/stepmania/src/GrayArrowRow.cpp index ba36edb572..2cbdc9716a 100644 --- a/stepmania/src/GrayArrowRow.cpp +++ b/stepmania/src/GrayArrowRow.cpp @@ -24,19 +24,19 @@ GrayArrowRow::GrayArrowRow() m_iNumCols = 0; } -void GrayArrowRow::Load( PlayerOptions po ) +void GrayArrowRow::Load( PlayerNumber pn, StyleDef* pStyleDef, PlayerOptions po ) { m_PlayerOptions = po; - StyleDef* pStyleDef = GAME->GetCurrentStyleDef(); - GameDef* pGameDef = GAME->GetCurrentGameDef(); + GameDef* pGameDef = GAMEMAN->GetCurrentGameDef(); m_iNumCols = pStyleDef->m_iColsPerPlayer; // init arrow rotations for( int c=0; cGetPathToGraphic(PLAYER_1, c, GRAPHIC_RECEPTOR) ); + m_GrayArrow[c].Load( GAMEMAN->GetPathToGraphic(pn, c, GRAPHIC_RECEPTOR) ); + m_GrayArrow[c].SetX( pStyleDef->m_ColumnInfo[pn][c].fXOffset ); } } diff --git a/stepmania/src/GrayArrowRow.h b/stepmania/src/GrayArrowRow.h index 27a056c0e8..f02fe31c9a 100644 --- a/stepmania/src/GrayArrowRow.h +++ b/stepmania/src/GrayArrowRow.h @@ -1,3 +1,4 @@ +#pragma once /* ----------------------------------------------------------------------------- Class: GrayArrowRow @@ -9,18 +10,12 @@ ----------------------------------------------------------------------------- */ - -#ifndef _GrayArrowRow_H_ -#define _GrayArrowRow_H_ - - #include "GrayArrow.h" #include "ActorFrame.h" #include "StyleDef.h" #include "GameConstantsAndTypes.h" - class GrayArrowRow : public ActorFrame { public: @@ -28,7 +23,7 @@ public: virtual void Update( float fDeltaTime, float fSongBeat ); virtual void DrawPrimitives(); - void Load( PlayerOptions po ); + void Load( PlayerNumber pn, StyleDef* pStyleDef, PlayerOptions po ); void Step( int iCol ); @@ -39,5 +34,3 @@ protected: GrayArrow m_GrayArrow[MAX_NOTE_TRACKS]; }; - -#endif \ No newline at end of file diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index a1a91fb078..6828c2e0a3 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -20,7 +20,7 @@ InputMapper* INPUTMAPPER = NULL; // global and accessable from anywhere in our p InputMapper::InputMapper() { - m_sCurrentGame = GAME->m_sCurrentGame; + m_sCurrentGame = GAMEMAN->GetCurrentGameDef()->m_szName; ReadMappingsFromDisk(); } @@ -35,7 +35,7 @@ InputMapper::~InputMapper() void InputMapper::ReadMappingsFromDisk() { - ASSERT( GAME != NULL ); + ASSERT( GAMEMAN != NULL ); IniFile ini; ini.SetPath( m_sCurrentGame + ".ini" ); @@ -196,12 +196,12 @@ struct HardCodedMenuKey const HardCodedMenuKey g_HardCodedMenuKeys[] = { - { DEVICE_KEYBOARD, DIK_UP, PLAYER_1, MENU_BUTTON_UP }, - { DEVICE_KEYBOARD, DIK_DOWN, PLAYER_1, MENU_BUTTON_DOWN }, - { DEVICE_KEYBOARD, DIK_LEFT, PLAYER_1, MENU_BUTTON_LEFT }, - { DEVICE_KEYBOARD, DIK_RIGHT, PLAYER_1, MENU_BUTTON_RIGHT }, - { DEVICE_KEYBOARD, DIK_RETURN, PLAYER_1, MENU_BUTTON_START }, - { DEVICE_KEYBOARD, DIK_ESCAPE, PLAYER_1, MENU_BUTTON_BACK }, + { DEVICE_KEYBOARD, DIK_UP, PLAYER_2, MENU_BUTTON_UP }, + { DEVICE_KEYBOARD, DIK_DOWN, PLAYER_2, MENU_BUTTON_DOWN }, + { DEVICE_KEYBOARD, DIK_LEFT, PLAYER_2, MENU_BUTTON_LEFT }, + { DEVICE_KEYBOARD, DIK_RIGHT, PLAYER_2, MENU_BUTTON_RIGHT }, + { DEVICE_KEYBOARD, DIK_RETURN, PLAYER_2, MENU_BUTTON_START }, + { DEVICE_KEYBOARD, DIK_ESCAPE, PLAYER_2, MENU_BUTTON_BACK }, }; const int NUM_HARD_CODED_MENU_KEYS = sizeof(g_HardCodedMenuKeys) / sizeof(HardCodedMenuKey); @@ -235,25 +235,25 @@ DeviceInput InputMapper::MenuToDevice( MenuInput MenuI ) void InputMapper::GameToStyle( GameInput GameI, StyleInput &StyleI ) { - StyleDef* pStyleDef = GAME->GetCurrentStyleDef(); + StyleDef* pStyleDef = GAMEMAN->GetCurrentStyleDef(); StyleI = pStyleDef->GameInputToStyleInput( GameI ); } void InputMapper::GameToMenu( GameInput GameI, MenuInput &MenuI ) { - GameDef* pGameDef = GAME->GetCurrentGameDef(); + GameDef* pGameDef = GAMEMAN->GetCurrentGameDef(); MenuI = pGameDef->GameInputToMenuInput( GameI ); } void InputMapper::StyleToGame( StyleInput StyleI, GameInput &GameI ) { - StyleDef* pStyleDef = GAME->GetCurrentStyleDef(); + StyleDef* pStyleDef = GAMEMAN->GetCurrentStyleDef(); GameI = pStyleDef->StyleInputToGameInput( StyleI ); } void InputMapper::MenuToGame( MenuInput MenuI, GameInput &GameI ) { - GameDef* pGameDef = GAME->GetCurrentGameDef(); + GameDef* pGameDef = GAMEMAN->GetCurrentGameDef(); GameI = pGameDef->MenuInputToGameInput( MenuI ); } diff --git a/stepmania/src/LifeMeter.cpp b/stepmania/src/LifeMeter.cpp new file mode 100644 index 0000000000..951820b00b --- /dev/null +++ b/stepmania/src/LifeMeter.cpp @@ -0,0 +1,15 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: LifeMeter + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "LifeMeter.h" + + diff --git a/stepmania/src/LifeMeter.h b/stepmania/src/LifeMeter.h index 815ac26150..bfefeaec52 100644 --- a/stepmania/src/LifeMeter.h +++ b/stepmania/src/LifeMeter.h @@ -25,7 +25,8 @@ public: void SetBeat( float fSongBeat ) { m_fSongBeat = fSongBeat; }; virtual void ChangeLife( TapNoteScore score ) = 0; - virtual float GetLifePercentage() = 0; + virtual bool IsAboutToFail() = 0; + virtual bool HasFailed() = 0; protected: float m_fSongBeat; diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index 8b09aeea97..71bb33a9ad 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -23,52 +23,75 @@ LifeMeterBar::LifeMeterBar() m_fLifePercentage = 0.5f; m_fTrailingLifePercentage = 0; m_fLifeVelocity = 0; + + ResetBarVelocity(); } void LifeMeterBar::ChangeLife( TapNoteScore score ) { + bool bWasDoingGreat = IsDoingGreat(); + switch( score ) { - case TNS_PERFECT: m_fLifePercentage += m_po.m_fLifeAdjustments[m_po.LIFE_PERFECT]; break; - case TNS_GREAT: m_fLifePercentage += m_po.m_fLifeAdjustments[m_po.LIFE_GREAT]; break; - case TNS_GOOD: m_fLifePercentage += m_po.m_fLifeAdjustments[m_po.LIFE_GOOD]; break; - case TNS_BOO: m_fLifePercentage += m_po.m_fLifeAdjustments[m_po.LIFE_BOO]; break; - case TNS_MISS: m_fLifePercentage += m_po.m_fLifeAdjustments[m_po.LIFE_MISS]; break; + case TNS_PERFECT: m_fLifePercentage += 0.03f; break; + case TNS_GREAT: m_fLifePercentage += 0.01f; break; + case TNS_GOOD: m_fLifePercentage += 0.00f; break; + case TNS_BOO: m_fLifePercentage -= 0.05f; break; + case TNS_MISS: m_fLifePercentage -= 0.10f; break; } + bool bIsDoingGreat = IsDoingGreat(); + + if( bWasDoingGreat && !bIsDoingGreat ) + m_fLifePercentage -= 0.10f; // make it take a while to get back to "doing great" + m_fLifePercentage = clamp( m_fLifePercentage, 0, 1 ); + + ResetBarVelocity(); } -float LifeMeterBar::GetLifePercentage() +void LifeMeterBar::ResetBarVelocity() +{ + // update bar animation + const float fDelta = m_fLifePercentage - m_fTrailingLifePercentage; + + m_fLifeVelocity = fDelta * 5; // change in life percent per second +} + +bool LifeMeterBar::IsDoingGreat() { - return m_fLifePercentage; + return m_fLifePercentage == 1; +} + +bool LifeMeterBar::IsAboutToFail() +{ + return m_fLifePercentage < 0.3f; +} + +bool LifeMeterBar::HasFailed() +{ + return m_bHasFailed; } void LifeMeterBar::Update( float fDeltaTime ) { - const float fDelta = m_fLifePercentage - m_fTrailingLifePercentage; + m_fLifeVelocity *= 1-fDeltaTime*2; // dampen - m_fLifeVelocity += fDelta * fDeltaTime; - - m_fLifeVelocity = clamp( m_fLifeVelocity, -0.30f, 0.30f ); - - m_fLifeVelocity *= 1-fDeltaTime*2; - - if( fDelta != 0 ) + if( fabsf(m_fLifeVelocity) < 0.01f ) { - int j=9; - } - - if( fabsf(m_fLifeVelocity) < 0.01f && fabsf(fDelta) < 0.01f ) - { - m_fTrailingLifePercentage += fDelta/2; + // snap + m_fTrailingLifePercentage = m_fLifePercentage; m_fLifeVelocity = 0; } else { - m_fTrailingLifePercentage += m_fLifeVelocity * fDeltaTime*4; + + m_fTrailingLifePercentage += m_fLifeVelocity * fDeltaTime; m_fTrailingLifePercentage = clamp( m_fTrailingLifePercentage, 0, 1 ); } + + if( m_fLifePercentage == 0 ) + m_bHasFailed = true; } @@ -80,7 +103,7 @@ const D3DXCOLOR COLOR_FULL_2 = D3DXCOLOR(1,1,0,1); D3DXCOLOR LifeMeterBar::GetColor( float fPercentIntoSection ) { float fPercentColor1 = fabsf( fPercentIntoSection*2 - 1 ); - fPercentColor1 *= fPercentColor1 * fPercentColor1; + fPercentColor1 *= fPercentColor1 * fPercentColor1 * fPercentColor1; // make the color bunch around one side if( m_fLifePercentage == 1 ) return COLOR_FULL_1 * fPercentColor1 + COLOR_FULL_2 * (1-fPercentColor1); else diff --git a/stepmania/src/LifeMeterBar.h b/stepmania/src/LifeMeterBar.h index 2db2703d32..96d71611fb 100644 --- a/stepmania/src/LifeMeterBar.h +++ b/stepmania/src/LifeMeterBar.h @@ -24,12 +24,16 @@ public: virtual void DrawPrimitives(); virtual void ChangeLife( TapNoteScore score ); - virtual float GetLifePercentage(); + virtual bool IsDoingGreat(); + virtual bool IsAboutToFail(); + virtual bool HasFailed(); private: D3DXCOLOR GetColor( float fPercentIntoSection ); + void ResetBarVelocity(); float m_fLifePercentage; float m_fTrailingLifePercentage; // this approaches m_fLifePercentage float m_fLifeVelocity; // how m_fTrailingLifePercentage approaches m_fLifePercentage + bool m_bHasFailed; }; diff --git a/stepmania/src/MenuElements.cpp b/stepmania/src/MenuElements.cpp index d04fc38284..ec52b9edf5 100644 --- a/stepmania/src/MenuElements.cpp +++ b/stepmania/src/MenuElements.cpp @@ -22,15 +22,22 @@ const float HELP_X = CENTER_X; -const float HELP_Y = SCREEN_HEIGHT-25; +const float HELP_Y = SCREEN_HEIGHT-28; + +const float TIMER_LOCAL_X = 270; +const float TIMER_LOCAL_Y = 0; MenuElements::MenuElements() { - this->AddActor( &m_sprBG ); - this->AddActor( &m_sprTopEdge ); - this->AddActor( &m_sprBottomEdge ); - this->AddActor( &m_textHelp ); + m_frameTopBar.AddActor( &m_sprTopEdge ); + m_frameTopBar.AddActor( &m_MenuTimer ); + m_frameBottomBar.AddActor( &m_sprBottomEdge ); + + this->AddActor( &m_sprBG ); + this->AddActor( &m_frameTopBar ); + this->AddActor( &m_frameBottomBar ); + this->AddActor( &m_textHelp ); } void MenuElements::Load( CString sBackgroundPath, CString sTopEdgePath, CString sHelpText ) @@ -42,14 +49,18 @@ void MenuElements::Load( CString sBackgroundPath, CString sTopEdgePath, CString m_sprBG.StretchTo( CRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT) ); m_sprBG.TurnShadowOff(); + m_frameTopBar.SetZ( -1 ); + m_sprTopEdge.Load( sTopEdgePath ); m_sprTopEdge.TurnShadowOff(); - m_sprTopEdge.SetZ( -1 ); - m_sprTopEdge.SetY( SCREEN_TOP + m_sprTopEdge.GetZoomedHeight()/2.0f ); + + m_MenuTimer.SetXY( TIMER_LOCAL_X, TIMER_LOCAL_Y ); + m_MenuTimer.SetZ( -1 ); + + m_frameBottomBar.SetZ( -1 ); m_sprBottomEdge.Load( THEME->GetPathTo(GRAPHIC_MENU_BOTTOM_EDGE) ); m_sprBottomEdge.TurnShadowOff(); - m_sprBottomEdge.SetZ( -1 ); m_textHelp.Load( THEME->GetPathTo(FONT_NORMAL) ); m_textHelp.SetXY( HELP_X, HELP_Y ); @@ -73,8 +84,8 @@ void MenuElements::TweenTopEdgeOnScreen() { SetTopEdgeOffScreen(); - m_sprTopEdge.BeginTweening( MENU_ELEMENTS_TWEEN_TIME*2, TWEEN_SPRING ); - m_sprTopEdge.SetTweenX( CENTER_X ); + m_frameTopBar.BeginTweening( MENU_ELEMENTS_TWEEN_TIME*2, TWEEN_SPRING ); + m_frameTopBar.SetTweenX( CENTER_X ); float fOriginalZoomY = m_textHelp.GetZoomY(); m_textHelp.SetZoomY( 0 ); @@ -86,8 +97,8 @@ void MenuElements::TweenTopEdgeOnScreen() void MenuElements::TweenTopEdgeOffScreen() { - m_sprTopEdge.BeginTweening( MENU_ELEMENTS_TWEEN_TIME*2, TWEEN_BIAS_END ); - m_sprTopEdge.SetTweenX( SCREEN_WIDTH*1.5f ); + m_frameTopBar.BeginTweening( MENU_ELEMENTS_TWEEN_TIME*2, TWEEN_BIAS_END ); + m_frameTopBar.SetTweenX( SCREEN_WIDTH*1.5f ); m_textHelp.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); @@ -100,8 +111,8 @@ void MenuElements::TweenBackgroundOnScreen() { SetBackgroundOffScreen(); - m_sprBottomEdge.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); - m_sprBottomEdge.SetTweenY( SCREEN_HEIGHT - m_sprBottomEdge.GetZoomedHeight()/2 ); + m_frameBottomBar.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); + m_frameBottomBar.SetTweenY( SCREEN_HEIGHT - m_sprBottomEdge.GetZoomedHeight()/2 ); m_sprBG.SetDiffuseColor( D3DXCOLOR(0,0,0,1) ); m_sprBG.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); @@ -112,8 +123,8 @@ void MenuElements::TweenBackgroundOnScreen() void MenuElements::TweenBackgroundOffScreen() { - m_sprBottomEdge.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); - m_sprBottomEdge.SetTweenY( SCREEN_HEIGHT + m_sprTopEdge.GetZoomedHeight() ); + m_frameBottomBar.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); + m_frameBottomBar.SetTweenY( SCREEN_HEIGHT + m_sprTopEdge.GetZoomedHeight() ); m_sprBG.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); m_sprBG.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); @@ -136,22 +147,22 @@ void MenuElements::TweenAllOffScreen() void MenuElements::SetBackgroundOnScreen() { - m_sprBottomEdge.SetXY( CENTER_X, SCREEN_HEIGHT - m_sprBottomEdge.GetZoomedHeight()/2 ); + m_frameBottomBar.SetXY( CENTER_X, SCREEN_HEIGHT - m_sprBottomEdge.GetZoomedHeight()/2 ); } void MenuElements::SetBackgroundOffScreen() { - m_sprBottomEdge.SetXY( CENTER_X, SCREEN_HEIGHT + m_sprBottomEdge.GetZoomedHeight()/2 ); + m_frameBottomBar.SetXY( CENTER_X, SCREEN_HEIGHT + m_sprBottomEdge.GetZoomedHeight()/2 ); } void MenuElements::SetTopEdgeOnScreen() { - m_sprTopEdge.SetXY( CENTER_X, m_sprTopEdge.GetZoomedHeight()/2 ); + m_frameTopBar.SetXY( CENTER_X, m_sprTopEdge.GetZoomedHeight()/2 ); } void MenuElements::SetTopEdgeOffScreen() { - m_sprTopEdge.SetXY( CENTER_X+SCREEN_WIDTH, m_sprTopEdge.GetZoomedHeight()/2 ); + m_frameTopBar.SetXY( CENTER_X+SCREEN_WIDTH, m_sprTopEdge.GetZoomedHeight()/2 ); } @@ -162,8 +173,8 @@ void MenuElements::DrawPrimitives() void MenuElements::DrawTopLayer() { - m_sprTopEdge.Draw(); - m_sprBottomEdge.Draw(); + m_frameTopBar.Draw(); + m_frameBottomBar.Draw(); m_textHelp.Draw(); } diff --git a/stepmania/src/MenuElements.h b/stepmania/src/MenuElements.h index 617f0be7f3..3770cf8223 100644 --- a/stepmania/src/MenuElements.h +++ b/stepmania/src/MenuElements.h @@ -1,15 +1,15 @@ +#pragma once /* ----------------------------------------------------------------------------- File: MenuElements.h - Desc: Base class for menu Screens. + Desc: Displays common components of menu screens: + Background, Top Bar, Bottom Bar, help message, credits or PlayerOptions, style icon, + Menu Timer Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ -#ifndef _MenuElements_H_ -#define _MenuElements_H_ - #include "Screen.h" @@ -17,6 +17,7 @@ #include "BitmapText.h" #include "RandomSample.h" #include "TransitionFade.h" +#include "MenuTimer.h" const float MENU_ELEMENTS_TWEEN_TIME = 0.30f; @@ -51,16 +52,21 @@ protected: void SetTopEdgeOffScreen(); - Sprite m_sprBG; - Sprite m_sprTopEdge; - Sprite m_sprBottomEdge; + Sprite m_sprBG; + + // stuff in the top bar + ActorFrame m_frameTopBar; + Sprite m_sprTopEdge; + MenuTimer m_MenuTimer; + + // stuff in the bottom bar + ActorFrame m_frameBottomBar; + Sprite m_sprBottomEdge; + + // stuff in the main frame BitmapText m_textHelp; + RageSoundSample m_soundSwoosh; RageSoundSample m_soundBack; }; - - - - -#endif \ No newline at end of file diff --git a/stepmania/src/MenuTimer.cpp b/stepmania/src/MenuTimer.cpp new file mode 100644 index 0000000000..eb4f551887 --- /dev/null +++ b/stepmania/src/MenuTimer.cpp @@ -0,0 +1,80 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: MenuTimer + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "MenuTimer.h" +#include "RageUtil.h" +#include "GameConstantsAndTypes.h" +#include "ThemeManager.h" +#include "ScreenManager.h" + +const float TIMER_SECONDS = 40; + +MenuTimer::MenuTimer() +{ + m_fSecondsLeft = TIMER_SECONDS; + + m_textDigit1.Load( THEME->GetPathTo(FONT_TIMER_NUMBERS) ); + m_textDigit1.TurnShadowOff(); + m_textDigit1.SetXY( -20, 0 ); + this->AddActor( &m_textDigit1 ); + + m_textDigit2.Load( THEME->GetPathTo(FONT_TIMER_NUMBERS) ); + m_textDigit2.TurnShadowOff(); + m_textDigit2.SetXY( +20, 0 ); + this->AddActor( &m_textDigit2 ); +} + + +void MenuTimer::Update( float fDeltaTime ) +{ + ActorFrame::Update( fDeltaTime ); + + float fOldSecondsLeft = m_fSecondsLeft; + float fNewSecondsLeft = fOldSecondsLeft - fDeltaTime; + + if( fOldSecondsLeft > 5 && fNewSecondsLeft < 5 ) // transition to below 5 + { + m_textDigit1.SetEffectGlowing( 10, D3DXCOLOR(1,0,0,0), D3DXCOLOR(1,0,0,1) ); + m_textDigit2.SetEffectGlowing( 10, D3DXCOLOR(1,0,0,0), D3DXCOLOR(1,0,0,1) ); + } + else if( fOldSecondsLeft > 0 && fNewSecondsLeft < 0 ) // transition to below 0 + { + SCREENMAN->SendMessageToTopScreen( SM_MenuTimer, 0 ); + } + + m_fSecondsLeft = fNewSecondsLeft; + m_fSecondsLeft = max( 0, m_fSecondsLeft ); + + m_textDigit1.SetText( ssprintf("%d", ((int)m_fSecondsLeft)/10) ); + m_textDigit2.SetText( ssprintf("%d", ((int)m_fSecondsLeft)%10) ); + + // "flip" the numbers + float fRemainder = m_fSecondsLeft - (int)m_fSecondsLeft; + float fDistFromNearestNumber = min( fRemainder, 1-fRemainder ); // this is between 0 and 0.5; + + if( m_fSecondsLeft < 4.5f ) + { + m_textDigit1.SetZoomX( min(1, fDistFromNearestNumber*8) ); + m_textDigit2.SetZoomX( min(1, fDistFromNearestNumber*8) ); + } +} + + +void MenuTimer::StopTimer() +{ + +} + +void MenuTimer::StallTimer() +{ + +} diff --git a/stepmania/src/MenuTimer.h b/stepmania/src/MenuTimer.h new file mode 100644 index 0000000000..be75cd72da --- /dev/null +++ b/stepmania/src/MenuTimer.h @@ -0,0 +1,34 @@ +#pragma once +/* +----------------------------------------------------------------------------- + Class: MenuTimer + + Desc: A timer in the upper right corner of the menu that ticks down. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Sprite.h" +#include "Song.h" +#include "ActorFrame.h" +#include "BitmapText.h" +#include "Quad.h" + + +class MenuTimer : public ActorFrame +{ +public: + MenuTimer(); + + virtual void Update( float fDeltaTime ); + void StopTimer(); + void StallTimer(); + +protected: + float m_fSecondsLeft; + + BitmapText m_textDigit1; + BitmapText m_textDigit2; +}; diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 9df1c46726..5c79cdebe3 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -168,16 +168,16 @@ void WheelItemDisplay::RefreshGrades() { for( int p=0; pIsPlayerEnabled( (PlayerNumber)p ) ) + if( !GAMEMAN->IsPlayerEnabled( (PlayerNumber)p ) ) { m_GradeDisplay[p].SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); continue; } - const DifficultyClass dc = PREFS->m_PreferredDifficultyClass[p]; + const DifficultyClass dc = PREFSMAN->m_PreferredDifficultyClass[p]; if( m_pSong ) // this is a song display { - const Grade grade = m_pSong->GetGradeForDifficultyClass( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, dc ); + const Grade grade = m_pSong->GetGradeForDifficultyClass( GAMEMAN->GetCurrentStyleDef()->m_NotesType, dc ); m_GradeDisplay[p].SetGrade( grade ); m_GradeDisplay[p].SetDiffuseColor( PlayerToColor((PlayerNumber)p) ); } @@ -279,7 +279,7 @@ MusicWheel::MusicWheel() - m_SortOrder = PREFS->m_SongSortOrder; + m_SortOrder = PREFSMAN->m_SongSortOrder; m_MusicSortDisplay.Set( m_SortOrder ); m_MusicSortDisplay.SetXY( SORT_ICON_ON_SCREEN_X, SORT_ICON_ON_SCREEN_Y ); @@ -331,7 +331,7 @@ MusicWheel::MusicWheel() MusicWheel::~MusicWheel() { - PREFS->m_SongSortOrder = m_SortOrder; + PREFSMAN->m_SongSortOrder = m_SortOrder; } void MusicWheel::BuildWheelItemDatas( CArray &arrayWheelItemDatas, SongSortOrder so ) @@ -349,7 +349,7 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr Song* pSong = SONGMAN->m_pSongs[i]; CArray arraySteps; - pSong->GetNotessThatMatchGameAndStyle( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, arraySteps ); + pSong->GetNotesThatMatch( GAMEMAN->GetCurrentStyleDef()->m_NotesType, arraySteps ); if( arraySteps.GetSize() > 0 ) arraySongs.Add( pSong ); @@ -600,7 +600,7 @@ void MusicWheel::RebuildWheelItemDisplays() void MusicWheel::NotesChanged( PlayerNumber pn ) // update grade graphics and top score { - DifficultyClass dc = PREFS->m_PreferredDifficultyClass[pn]; + DifficultyClass dc = PREFSMAN->m_PreferredDifficultyClass[pn]; Song* pSong = SONGMAN->m_pCurSong; Notes* m_pNotes = SONGMAN->m_pCurNotes[pn]; diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index 494cc518e5..a9e4dabab2 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -69,7 +69,7 @@ void NoteData::SkipOverDataInCacheFile( FILE* file ) } -void NoteData::ClearRange( NoteIndex iNoteIndexBegin, NoteIndex iNoteIndexEnd ) +void NoteData::ClearRange( int iNoteIndexBegin, int iNoteIndexEnd ) { // delete old TapNotes in the range for( int i=iNoteIndexBegin; i<=iNoteIndexEnd; i++ ) @@ -99,7 +99,7 @@ void NoteData::ClearRange( NoteIndex iNoteIndexBegin, NoteIndex iNoteIndexEnd ) } -void NoteData::CopyRange( NoteData* pFrom, NoteIndex iNoteIndexBegin, NoteIndex iNoteIndexEnd ) +void NoteData::CopyRange( NoteData* pFrom, int iNoteIndexBegin, int iNoteIndexEnd ) { ASSERT( pFrom->m_iNumTracks == m_iNumTracks ); @@ -727,7 +727,7 @@ float NoteData::GetFreezeRadarValue( float fSongSeconds ) } -void NoteData::LoadTransformed( NoteData* pOriginal, int iNewNumTracks, TrackNumber iNewToOriginalTrack[] ) +void NoteData::LoadTransformed( NoteData* pOriginal, int iNewNumTracks, int iNewToOriginalTrack[] ) { // init for( int i=0; im_iNumTracks; CopyRange( pFrom, 0, MAX_TAP_NOTE_ROWS ); }; - inline bool IsRowEmpty( NoteIndex index ) + inline bool IsRowEmpty( int index ) { for( int t=0; t arrayTweenColors; - GAME->GetTweenColors( p, c, arrayTweenColors ); + GAMEMAN->GetTweenColors( p, c, arrayTweenColors ); - m_ColorNote[c].m_sprColorPart.Load( GAME->GetPathToGraphic( p, c, GRAPHIC_NOTE_COLOR_PART) ); - m_ColorNote[c].m_sprGrayPart.Load( GAME->GetPathToGraphic( p, c, GRAPHIC_NOTE_GRAY_PART) ); + m_ColorNote[c].m_sprColorPart.Load( GAMEMAN->GetPathToGraphic( p, c, GRAPHIC_NOTE_COLOR_PART) ); + m_ColorNote[c].m_sprGrayPart.Load( GAMEMAN->GetPathToGraphic( p, c, GRAPHIC_NOTE_GRAY_PART) ); } @@ -61,7 +61,7 @@ void NoteField::Load( NoteData* pNoteData, PlayerNumber p, PlayerOptions po, flo m_HoldNoteLife[i] = 1; // start with full life - ASSERT( m_iNumTracks == GAME->GetCurrentStyleDef()->m_iColsPerPlayer ); + ASSERT( m_iNumTracks == GAMEMAN->GetCurrentStyleDef()->m_iColsPerPlayer ); } void NoteField::Update( float fDeltaTime, float fSongBeat ) diff --git a/stepmania/src/NoteField.h b/stepmania/src/NoteField.h index d7859e8ae2..c8c5e26438 100644 --- a/stepmania/src/NoteField.h +++ b/stepmania/src/NoteField.h @@ -37,7 +37,7 @@ public: MODE_EDITING, }; - void Load( NoteData* pNoteData, PlayerNumber p, PlayerOptions po, float fNumArrowsToDrawBehind, float fNumArrowsToDrawAhead, NoteFieldMode mode ); + void Load( NoteData* pNoteData, PlayerNumber p, StyleDef* pStyleDef, PlayerOptions po, float fNumArrowsToDrawBehind, float fNumArrowsToDrawAhead, NoteFieldMode mode ); void RemoveTapNoteRow( int iIndex ); void SetHoldNoteLife( int iIndex, float fLife ); diff --git a/stepmania/src/Notes.cpp b/stepmania/src/Notes.cpp index 574ad258a1..be62d57f85 100644 --- a/stepmania/src/Notes.cpp +++ b/stepmania/src/Notes.cpp @@ -60,8 +60,7 @@ void Notes::WriteToCacheFile( FILE* file ) { LOG->WriteLine( "Notes::WriteToCacheFile()" ); - WriteStringToFile( file, m_sIntendedGame ); - WriteStringToFile( file, m_sIntendedStyle ); + fprintf( file, "%d\n", m_NotesType ); WriteStringToFile( file, m_sDescription ); WriteStringToFile( file, m_sCredit ); fprintf( file, "%d\n", m_DifficultyClass ); @@ -82,8 +81,7 @@ void Notes::ReadFromCacheFile( FILE* file, bool bLoadNoteData ) { LOG->WriteLine( "Notes::ReadFromCacheFile( %d )", bLoadNoteData ); - ReadStringFromFile( file, m_sIntendedGame ); - ReadStringFromFile( file, m_sIntendedStyle ); + fscanf( file, "%d\n", &m_NotesType ); ReadStringFromFile( file, m_sDescription ); ReadStringFromFile( file, m_sCredit ); fscanf( file, "%d\n", &m_DifficultyClass ); @@ -113,8 +111,6 @@ bool Notes::LoadFromBMSFile( const CString &sPath ) this->GetNoteData(); // make sure NoteData is loaded - m_sIntendedGame = "dance"; - // BMS encoding: // 4&8panel: Player1 Player2 // Left 11 21 @@ -199,14 +195,14 @@ bool Notes::LoadFromBMSFile( const CString &sPath ) switch( atoi(value_data) ) { case 1: // 4 or 6 single - m_sIntendedStyle = "single"; + m_NotesType = NOTES_TYPE_DANCE_SINGLE; // if the mode should be solo, then we'll update m_DanceStyle below when we read in step data break; case 2: // couple/battle - m_sIntendedStyle = "couple"; + m_NotesType = NOTES_TYPE_DANCE_COUPLE; break; case 3: // double - m_sIntendedStyle = "double"; + m_NotesType = NOTES_TYPE_DANCE_DOUBLE; break; } } @@ -229,7 +225,7 @@ bool Notes::LoadFromBMSFile( const CString &sPath ) // if there's a 6 in the description, it's probably part of "6panel" or "6-panel" if( m_sDescription.Find("6") != -1 ) - m_sIntendedStyle = "solo"; + m_NotesType = NOTES_TYPE_DANCE_SOLO; } if( -1 != value_name.Find("#playlevel") ) @@ -273,7 +269,9 @@ bool Notes::LoadFromBMSFile( const CString &sPath ) } } - if( m_sIntendedStyle == "single" || m_sIntendedStyle == "double" || m_sIntendedStyle == "couple" ) // if there are 4 panels, then we have to flip the Up and Up+Right bits + if( m_NotesType == NOTES_TYPE_DANCE_SINGLE || + m_NotesType == NOTES_TYPE_DANCE_DOUBLE || + m_NotesType == NOTES_TYPE_DANCE_COUPLE ) // if there are 4 panels, then we have to flip the Up and Up+Right bits { for( int i=0; i mapDanceNoteToNoteDataColumn; - if( m_sIntendedStyle == "single" ) + if( m_NotesType == NOTES_TYPE_DANCE_SINGLE ) { mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_LEFT] = 0; mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_DOWN] = 1; mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_UP] = 2; mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_RIGHT] = 3; } - else if( m_sIntendedStyle == "double" ) + else if( m_NotesType == NOTES_TYPE_DANCE_DOUBLE ) { mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_LEFT] = 0; mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_DOWN] = 1; @@ -311,7 +309,7 @@ bool Notes::LoadFromBMSFile( const CString &sPath ) mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD2_UP] = 6; mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD2_RIGHT] = 7; } - else if( m_sIntendedStyle == "couple" ) + else if( m_NotesType == NOTES_TYPE_DANCE_COUPLE ) { mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_LEFT] = 0; mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_DOWN] = 1; @@ -322,7 +320,7 @@ bool Notes::LoadFromBMSFile( const CString &sPath ) mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD2_UP] = 6; mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD2_RIGHT] = 7; } - else if( m_sIntendedStyle == "solo" ) + else if( m_NotesType == NOTES_TYPE_DANCE_SOLO ) { mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_LEFT] = 0; mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_UPLEFT] = 1; @@ -462,24 +460,22 @@ bool Notes::LoadFromDWITokens( { LOG->WriteLine( "Notes::LoadFromDWITokens()" ); - m_sIntendedGame = "dance"; - - if( sMode == "#SINGLE" ) m_sIntendedStyle = "single"; - else if( sMode == "#DOUBLE" ) m_sIntendedStyle = "double"; - else if( sMode == "#COUPLE" ) m_sIntendedStyle = "couple"; - else if( sMode == "#SOLO" ) m_sIntendedStyle = "solo"; - else FatalError( "Unrecognized DWI mode '%s'", sMode ); + if( sMode == "#SINGLE" ) m_NotesType = NOTES_TYPE_DANCE_SINGLE; + else if( sMode == "#DOUBLE" ) m_NotesType = NOTES_TYPE_DANCE_DOUBLE; + else if( sMode == "#COUPLE" ) m_NotesType = NOTES_TYPE_DANCE_COUPLE; + else if( sMode == "#SOLO" ) m_NotesType = NOTES_TYPE_DANCE_SOLO; + else LOG->WriteLine( "Unrecognized DWI mode '%s'", sMode ); CMap mapDanceNoteToNoteDataColumn; - if( m_sIntendedStyle == "single" ) + if( m_NotesType == NOTES_TYPE_DANCE_SINGLE ) { mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_LEFT] = 0; mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_DOWN] = 1; mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_UP] = 2; mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_RIGHT] = 3; } - else if( m_sIntendedStyle == "double" || m_sIntendedStyle == "couple" ) + else if( m_NotesType == NOTES_TYPE_DANCE_DOUBLE || m_NotesType == NOTES_TYPE_DANCE_COUPLE ) { mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_LEFT] = 0; mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_DOWN] = 1; @@ -490,7 +486,7 @@ bool Notes::LoadFromDWITokens( mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD2_UP] = 6; mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD2_RIGHT] = 7; } - else if( m_sIntendedStyle == "solo" ) + else if( m_NotesType == NOTES_TYPE_DANCE_SOLO ) { mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_LEFT] = 0; mapDanceNoteToNoteDataColumn[DANCE_NOTE_PAD1_UPLEFT] = 1; @@ -667,16 +663,9 @@ bool Notes::LoadFromNotesFile( const CString &sPath ) sValueName.TrimRight(); // handle the data - if( sValueName == "#GAME" ) - { - m_sIntendedGame = arrayValueTokens[1]; - m_sIntendedGame.MakeLower(); - } - else if( sValueName == "#STYLE" ) - { - m_sIntendedStyle = arrayValueTokens[1]; - m_sIntendedStyle.MakeLower(); - } + if( sValueName == "#TYPE" ) + m_NotesType = StringToNotesType( arrayValueTokens[1] ); + else if( sValueName == "#DESCRIPTION" ) m_sDescription = arrayValueTokens[1]; @@ -714,14 +703,13 @@ void Notes::SaveToSMDir( CString sSongDir ) int i; - CString sNewNotesFilePath = sSongDir + ssprintf("%s-%s-%s.notes", m_sIntendedGame, m_sIntendedStyle, m_sDescription); + CString sNewNotesFilePath = sSongDir + ssprintf("%s-%s.notes", NotesTypeToString(m_NotesType), m_sDescription); CStdioFile file; if( !file.Open( sNewNotesFilePath, CFile::modeWrite | CFile::modeCreate ) ) - FatalError( ssprintf("Error opening Notes file '%s' for writing.", sNewNotesFilePath) ); + FatalError( "Error opening Notes file '%s' for writing.", sNewNotesFilePath ); - file.WriteString( ssprintf("#GAME:%s;\n", m_sIntendedGame) ); - file.WriteString( ssprintf("#STYLE:%s;\n", m_sIntendedStyle) ); + file.WriteString( ssprintf("#TYPE:%s;\n", NotesTypeToString(m_NotesType)) ); file.WriteString( ssprintf("#DESCRIPTION:%s;\n", m_sDescription) ); file.WriteString( ssprintf("#CREDIT:%s;\n", m_sCredit) ); file.WriteString( ssprintf("#METER:%d;\n", m_iMeter) ); diff --git a/stepmania/src/Notes.h b/stepmania/src/Notes.h index bf0b126df0..6f91bb56c1 100644 --- a/stepmania/src/Notes.h +++ b/stepmania/src/Notes.h @@ -35,12 +35,28 @@ public: void SaveToSMDir( CString sSongDir ); void WriteToCacheFile( FILE* file ); + // + public: - CString m_sIntendedGame; - CString m_sIntendedStyle; + NotesType m_NotesType; CString m_sDescription; // This text is displayed next to thte number of feet when a song is selected CString m_sCredit; // name of the person who created these Notes DifficultyClass m_DifficultyClass; // this is inferred from m_sDescription + + // Color is a function of DifficultyClass and Intended Style + D3DXCOLOR GetColor() + { + CString sDescription = m_sDescription; + sDescription.MakeLower(); + + if( -1 != sDescription.Find("battle") ) + return D3DXCOLOR(1,0.5f,0,1); // orange + else if( -1 != m_sDescription.Find("couple") ) + return D3DXCOLOR(0,0,1,1); // blue + else + return DifficultyClassToColor( m_DifficultyClass ); + } + 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 diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 76b36eb737..ff55d9a056 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -65,7 +65,7 @@ Player::Player() } -void Player::Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore ) +void Player::Load( PlayerNumber player_no, StyleDef* pStyleDef, NoteData* pNoteData, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore ) { //LOG->WriteLine( "Player::Load()", ); this->CopyAll( pNoteData ); @@ -76,7 +76,7 @@ void Player::Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOpti m_pLifeMeter = pLM; m_pScore = pScore; - if( !po.m_bAllowFreezeArrows ) + if( !po.m_bHoldNotes ) this->RemoveHoldNotes(); this->Turn( po.m_TurnType ); @@ -84,7 +84,7 @@ void Player::Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOpti if( po.m_bLittle ) this->MakeLittle(); - m_NoteField.Load( (NoteData*)this, player_no, po, 1.5f, 5.5f, NoteField::MODE_DANCING ); + m_NoteField.Load( (NoteData*)this, player_no, pStyleDef, po, 1.5f, 5.5f, NoteField::MODE_DANCING ); for( int t=0; tm_iNumTracks; t++ ) { @@ -92,8 +92,8 @@ void Player::Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOpti m_TapNotesOriginal[t][r] = pNoteData->m_TapNotes[t][r]; } - m_GrayArrowRow.Load( po ); - m_GhostArrowRow.Load( po ); + m_GrayArrowRow.Load( player_no, pStyleDef, po ); + m_GhostArrowRow.Load( player_no, pStyleDef, po ); m_frameJudgeAndCombo.SetY( FRAME_JUDGE_AND_COMBO_Y ); m_Combo.SetY( po.m_bReverseScroll ? -COMBO_Y_OFFSET : COMBO_Y_OFFSET ); @@ -141,7 +141,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference const int iCol = hn.m_iTrack; const StyleInput StyleI( m_PlayerNumber, hn.m_iTrack ); - const GameInput GameI = GAME->GetCurrentStyleDef()->StyleInputToGameInput( StyleI ); + const GameInput GameI = GAMEMAN->GetCurrentStyleDef()->StyleInputToGameInput( StyleI ); // update the life if( fStartBeat < m_fSongBeat && m_fSongBeat < fEndBeat ) // if the song beat is in the range of this hold @@ -265,7 +265,7 @@ bool Player::IsThereANoteAtIndex( int iIndex ) -void Player::HandlePlayerStep( float fSongBeat, ColumnNumber col, float fMaxBeatDiff ) +void Player::HandlePlayerStep( float fSongBeat, int col, float fMaxBeatDiff ) { //LOG->WriteLine( "Player::HandlePlayerStep()" ); @@ -348,7 +348,7 @@ void Player::HandlePlayerStep( float fSongBeat, ColumnNumber col, float fMaxBeat } -void Player::CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxBeatDiff ) +void Player::CheckForCompleteRow( float fSongBeat, int col, float fMaxBeatDiff ) { //LOG->WriteLine( "Player::CheckForCompleteRow()" ); @@ -408,7 +408,7 @@ void Player::CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxB } } -void Player::OnRowDestroyed( float fSongBeat, ColumnNumber col, float fMaxBeatDiff, int iIndexThatWasSteppedOn ) +void Player::OnRowDestroyed( float fSongBeat, int col, float fMaxBeatDiff, int iIndexThatWasSteppedOn ) { float fStepBeat = NoteRowToBeat( (float)iIndexThatWasSteppedOn ); diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index 86cc72cfd6..acfaac4d2a 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -43,9 +43,9 @@ public: void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference ); void DrawPrimitives(); - void Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore ); + void Load( PlayerNumber player_no, StyleDef *pStyleDef, NoteData* pNoteData, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore ); void CrossedIndex( int iIndex ); - void HandlePlayerStep( float fSongBeat, ColumnNumber col, float fMaxBeatDiff ); + void HandlePlayerStep( float fSongBeat, int col, float fMaxBeatDiff ); int UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ); ScoreSummary GetScoreSummary(); @@ -53,8 +53,8 @@ public: bool IsThereANoteAtIndex( int iIndex ); protected: - void CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxBeatDiff ); - void OnRowDestroyed( float fSongBeat, ColumnNumber col, float fMaxBeatDiff, int iStepIndex ); + void CheckForCompleteRow( float fSongBeat, int col, float fMaxBeatDiff ); + void OnRowDestroyed( float fSongBeat, int col, float fMaxBeatDiff, int iStepIndex ); float m_fSongBeat; PlayerNumber m_PlayerNumber; diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 179f3c3746..ab997348f8 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -15,119 +15,53 @@ #include "GameManager.h" -PrefsManager* PREFS = NULL; // global and accessable from anywhere in our program +PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program -GraphicProfileOptions GRAPHIC_OPTIONS[NUM_GRAPHIC_PROFILES] = -{ - { // PROFILE_SUPER_LOW - "Super Low", - 320, - 240, - 256, - 16, - 16, - false, - }, - { // PROFILE_LOW - "Low", - 400, - 300, - 256, - 16, - 16, - true, - }, - { // PROFILE_MEDIUM - "Medium", - 640, - 480, - 512, - 16, - 16, - true, - }, - { // PROFILE_HIGH - "High", - 640, - 480, - 1024, - 16, - 32, - true, - }, - { // PROFILE_CUSTOM - "Custom", - 640, - 480, - 512, - 16, - 16, - true, - }, -}; PrefsManager::PrefsManager() { - m_SongSortOrder = SORT_GROUP; - m_iCurrentStage = 1; - m_GameMode = GAME_MODE_ARCADE; - - m_bWindowed = false; - m_GraphicProfile = PROFILE_MEDIUM; + m_WindowMode = WINDOW_MODE_FULLSCREEN; + m_bHighDetail = true; + m_bHighTextureDetail = true; + m_bIgnoreJoyAxes = false; + m_bShowFPS = false; + m_bUseRandomVis = false; + m_bAnnouncer = true; + m_bEventMode = true; + m_iNumArcadeStages = 3; + m_iDifficulty = 4; for( int p=0; pm_iWidth ); - ini.GetValueI( "GraphicOptions", "Height", pGPO->m_iHeight ); - ini.GetValueI( "GraphicOptions", "MaxTextureSize", pGPO->m_iMaxTextureSize ); - ini.GetValueI( "GraphicOptions", "DisplayColor", pGPO->m_iDisplayColor ); - ini.GetValueI( "GraphicOptions", "TextureColor", pGPO->m_iTextureColor ); - - ini.GetValueB( "GameOptions", "IgnoreJoyAxes", m_GameOptions.m_bIgnoreJoyAxes ); - ini.GetValueB( "GameOptions", "ShowFPS", m_GameOptions.m_bShowFPS ); - ini.GetValueB( "GameOptions", "UseRandomVis", m_GameOptions.m_bUseRandomVis ); - ini.GetValueB( "GameOptions", "Announcer", m_GameOptions.m_bAnnouncer ); - ini.GetValueB( "GameOptions", "EventMode", m_GameOptions.m_bEventMode ); - ini.GetValueB( "GameOptions", "ShowSelectDifficulty", m_GameOptions.m_bShowSelectDifficulty ); - ini.GetValueB( "GameOptions", "ShowSelectGroup", m_GameOptions.m_bShowSelectGroup ); - ini.GetValueI( "GameOptions", "NumArcadeStages", m_GameOptions.m_iNumArcadeStages ); - ini.GetValueI( "GameOptions", "Difficulty", m_GameOptions.m_iDifficulty ); + ini.GetValueI( "Options", "WindowMode", (int&)m_WindowMode ); + ini.GetValueB( "Options", "HighDetail", m_bHighDetail ); + ini.GetValueB( "Options", "HighTextureDetail", m_bHighTextureDetail ); + ini.GetValueB( "Options", "IgnoreJoyAxes", m_bIgnoreJoyAxes ); + ini.GetValueB( "Options", "ShowFPS", m_bShowFPS ); + ini.GetValueB( "Options", "UseRandomVis", m_bUseRandomVis ); + ini.GetValueB( "Options", "Announcer", m_bAnnouncer ); + ini.GetValueB( "Options", "EventMode", m_bEventMode ); + ini.GetValueI( "Options", "NumArcadeStages", m_iNumArcadeStages ); + ini.GetValueI( "Options", "Difficulty", m_iDifficulty ); } @@ -136,26 +70,16 @@ void PrefsManager::SavePrefsToDisk() IniFile ini; ini.SetPath( "StepMania.ini" ); - - GraphicProfileOptions* pGPO = GetCustomGraphicProfileOptions(); - - ini.SetValueB( "GraphicOptions", "Windowed", m_bWindowed ); - ini.SetValueI( "GraphicOptions", "Profile", m_GraphicProfile ); - ini.SetValueI( "GraphicOptions", "Width", pGPO->m_iWidth ); - ini.SetValueI( "GraphicOptions", "Height", pGPO->m_iHeight ); - ini.SetValueI( "GraphicOptions", "MaxTextureSize", pGPO->m_iMaxTextureSize ); - ini.SetValueI( "GraphicOptions", "DisplayColor", pGPO->m_iDisplayColor ); - ini.SetValueI( "GraphicOptions", "TextureColor", pGPO->m_iTextureColor ); - - ini.SetValueB( "GameOptions", "IgnoreJoyAxes", m_GameOptions.m_bIgnoreJoyAxes ); - ini.SetValueB( "GameOptions", "ShowFPS", m_GameOptions.m_bShowFPS ); - ini.SetValueB( "GameOptions", "UseRandomVis", m_GameOptions.m_bUseRandomVis ); - ini.SetValueB( "GameOptions", "Announcer", m_GameOptions.m_bAnnouncer ); - ini.SetValueB( "GameOptions", "EventMode", m_GameOptions.m_bEventMode ); - ini.SetValueB( "GameOptions", "ShowSelectDifficulty", m_GameOptions.m_bShowSelectDifficulty ); - ini.SetValueB( "GameOptions", "ShowSelectGroup", m_GameOptions.m_bShowSelectGroup ); - ini.SetValueI( "GameOptions", "NumArcadeStages", m_GameOptions.m_iNumArcadeStages ); - ini.SetValueI( "GameOptions", "Difficulty", m_GameOptions.m_iDifficulty ); + ini.SetValueI( "Options", "WindowMode", (int)m_WindowMode ); + ini.SetValueB( "Options", "HighDetail", m_bHighDetail ); + ini.GetValueB( "Options", "HighTextureDetail", m_bHighTextureDetail ); + ini.SetValueB( "Options", "IgnoreJoyAxes", m_bIgnoreJoyAxes ); + ini.SetValueB( "Options", "ShowFPS", m_bShowFPS ); + ini.SetValueB( "Options", "UseRandomVis", m_bUseRandomVis ); + ini.SetValueB( "Options", "Announcer", m_bAnnouncer ); + ini.SetValueB( "Options", "EventMode", m_bEventMode ); + ini.SetValueI( "Options", "NumArcadeStages", m_iNumArcadeStages ); + ini.SetValueI( "Options", "Difficulty", m_iDifficulty ); ini.WriteFile(); } @@ -167,7 +91,7 @@ int PrefsManager::GetStageNumber() bool PrefsManager::IsFinalStage() { - return m_GameOptions.m_iNumArcadeStages == m_iCurrentStage; + return m_iNumArcadeStages == m_iCurrentStage; } CString PrefsManager::GetStageText() @@ -191,6 +115,6 @@ CString PrefsManager::GetStageText() default:sNumberSuffix = "th"; break; } } - return ssprintf( "%d%s", PREFS->m_iCurrentStage, sNumberSuffix ); + return ssprintf( "%d%s", PREFSMAN->m_iCurrentStage, sNumberSuffix ); } diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 67fb265997..84703c3f51 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -24,30 +24,41 @@ public: PrefsManager(); ~PrefsManager(); - ScoreSummary m_ScoreSummary[NUM_PLAYERS]; // for passing from Dancing to Results + // Options that ARE saved between sessions + enum WindowMode{ WINDOW_MODE_FULLSCREEN, WINDOW_MODE_WINDOWED, WINDOW_MODE_MAXIMIZED, NUM_WINDOW_MODES }; + WindowMode m_WindowMode; + bool m_bHighDetail; + bool m_bHighTextureDetail; + bool m_bIgnoreJoyAxes; + bool m_bShowFPS; + bool m_bUseRandomVis; + bool m_bAnnouncer; + bool m_bEventMode; + int m_iNumArcadeStages; + int m_iDifficulty; + + void ReadPrefsFromDisk(); + void SavePrefsToDisk(); + + + // Options that are NOT saved between sessions + DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS]; SongSortOrder m_SongSortOrder; // used by MusicWheel and should be saved until the app exits - GameMode m_GameMode; - int m_iCurrentStage; // number of stages played +1 + PlayMode m_PlayMode; + int m_iCurrentStage; // starts at 1, and is incremented with each Stage Clear int GetStageNumber(); bool IsFinalStage(); CString GetStageText(); - DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS]; - GameOptions m_GameOptions; - bool m_bWindowed; - GraphicProfile m_GraphicProfile; - GraphicProfileOptions* GetCustomGraphicProfileOptions(); - GraphicProfileOptions* GetCurrentGraphicProfileOptions(); - PlayerOptions m_PlayerOptions[NUM_PLAYERS]; - SongOptions m_SongOptions; + + PlayerOptions m_PlayerOptions[NUM_PLAYERS]; + SongOptions m_SongOptions; + + ScoreSummary m_ScoreSummary[NUM_PLAYERS]; // for passing from Dancing to Results - void ReadPrefsFromDisk(); - void SavePrefsToDisk(); - -protected: }; -extern PrefsManager* PREFS; // global and accessable from anywhere in our program +extern PrefsManager* PREFSMAN; // global and accessable from anywhere in our program diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index ac0977ebe0..8a32678e78 100644 --- a/stepmania/src/RageBitmapTexture.cpp +++ b/stepmania/src/RageBitmapTexture.cpp @@ -46,8 +46,11 @@ RageBitmapTexture::RageBitmapTexture( m_pd3dTexture = NULL; - Create( dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ); + //if( !LoadFromCacheFile() ) + Create( dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ); + //SaveToCache(); + CreateFrameRects(); } @@ -114,6 +117,7 @@ void RageBitmapTexture::Create( case 1: fmtTexture = D3DFMT_A1R5G5B5; break; default: fmtTexture = D3DFMT_A4R4G4B4; break; } + break; case 32: fmtTexture = D3DFMT_A8R8G8B8; break; diff --git a/stepmania/src/RageBitmapTexture.h b/stepmania/src/RageBitmapTexture.h index d3efdf7026..ac79597ed1 100644 --- a/stepmania/src/RageBitmapTexture.h +++ b/stepmania/src/RageBitmapTexture.h @@ -44,6 +44,7 @@ public: virtual LPDIRECT3DTEXTURE8 GetD3DTexture(); protected: + virtual void Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, @@ -53,5 +54,6 @@ protected: bool bStretch ); + LPDIRECT3DTEXTURE8 m_pd3dTexture; }; diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index 5032dfb274..a892b8066e 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -105,8 +105,7 @@ RageDisplay::~RageDisplay() // Desc: //----------------------------------------------------------------------------- bool RageDisplay::SwitchDisplayMode( - const bool bWindowed, const DWORD dwWidth, const DWORD dwHeight, - const DWORD dwBPP, const DWORD dwFlags ) + const bool bWindowed, const DWORD dwWidth, const DWORD dwHeight, const DWORD dwBPP ) { LOG->WriteLine( "RageDisplay::SwitchDisplayModes( %d, %u, %u, %u )", bWindowed, dwWidth, dwHeight, dwBPP ); diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index 96669be57f..8286afe70a 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -41,8 +41,7 @@ public: RageDisplay( HWND hWnd ); ~RageDisplay(); bool SwitchDisplayMode( - const bool bWindowed, const DWORD dwWidth, const DWORD dwHeight, - const DWORD dwBPP, const DWORD dwFlags ); + const bool bWindowed, const DWORD dwWidth, const DWORD dwHeight, const DWORD dwBPP ); LPDIRECT3D8 GetD3D() { return m_pd3d; }; inline LPDIRECT3DDEVICE8 GetDevice() { return m_pd3dDevice; }; diff --git a/stepmania/src/RageTexture.cpp b/stepmania/src/RageTexture.cpp index 0ca3a6da23..a729f58ab0 100644 --- a/stepmania/src/RageTexture.cpp +++ b/stepmania/src/RageTexture.cpp @@ -108,4 +108,84 @@ void RageTexture::GetFrameDimensionsFromFileName( CString sPath, int* piFramesWi return; } -} \ No newline at end of file +} + +CString RageTexture::GetCacheFilePath() +{ + ULONG hash = GetHashForString( m_sFilePath ); + return ssprintf( "Cache\\%u.texinfo", hash ); +} + +const int FILE_CACHE_VERSION = 10; // increment this when the cache file format changes + +void RageTexture::SaveToCacheFile() +{ + LOG->WriteLine( "RageBitmapTexture::SaveToCacheFile()" ); + + CString sCacheFilePath = GetCacheFilePath(); + + FILE* file = fopen( sCacheFilePath, "w" ); + ASSERT( file != NULL ); + if( file == NULL ) + return; + + WriteIntToFile( file, FILE_CACHE_VERSION ); + WriteUlongToFile( file, GetHashForFile(m_sFilePath) ); + WriteStringToFile( file, m_sFilePath ); + WriteIntToFile( file, m_iSourceWidth ); + WriteIntToFile( file, m_iSourceHeight ); + WriteIntToFile( file, m_iTextureWidth ); + WriteIntToFile( file, m_iTextureHeight ); + WriteIntToFile( file, m_iImageWidth ); + WriteIntToFile( file, m_iImageHeight ); + WriteIntToFile( file, m_iFramesWide ); + WriteIntToFile( file, m_iFramesHigh ); + WriteIntToFile( file, m_TextureFormat ); + + fclose( file ); +} + +bool RageTexture::LoadFromCacheFile() +{ + LOG->WriteLine( "Song::LoadFromCacheFile()" ); + + CString sCacheFilePath = GetCacheFilePath(); + + LOG->WriteLine( "cache file is '%s'.", sCacheFilePath ); + + FILE* file = fopen( sCacheFilePath, "r" ); + if( file == NULL ) + return false; + + int iCacheVersion; + ReadIntFromFile( file, iCacheVersion ); + if( iCacheVersion != FILE_CACHE_VERSION ) + { + LOG->WriteLine( "Cache file versions don't match '%s'.", sCacheFilePath ); + fclose( file ); + return false; + } + + ULONG hash; + ReadUlongFromFile( file, hash ); + if( hash != GetHashForFile(m_sFilePath) ) + { + LOG->WriteLine( "Cache file is out of date.", sCacheFilePath ); + fclose( file ); + return false; + } + + ReadStringFromFile( file, m_sFilePath ); + ReadIntFromFile( file, m_iSourceWidth ); + ReadIntFromFile( file, m_iSourceHeight ); + ReadIntFromFile( file, m_iTextureWidth ); + ReadIntFromFile( file, m_iTextureHeight ); + ReadIntFromFile( file, m_iImageWidth ); + ReadIntFromFile( file, m_iImageHeight ); + ReadIntFromFile( file, m_iFramesWide ); + ReadIntFromFile( file, m_iFramesHigh ); + ReadIntFromFile( file, (int&)m_TextureFormat ); + + fclose( file ); + return true; +} diff --git a/stepmania/src/RageTexture.h b/stepmania/src/RageTexture.h index becfb5259d..45d4eef1a7 100644 --- a/stepmania/src/RageTexture.h +++ b/stepmania/src/RageTexture.h @@ -88,22 +88,24 @@ protected: virtual void CreateFrameRects(); virtual void GetFrameDimensionsFromFileName( CString sPath, int* puFramesWide, int* puFramesHigh ) const; + virtual CString GetCacheFilePath(); + virtual bool LoadFromCacheFile(); + virtual void SaveToCacheFile(); + CString m_sFilePath; LPDIRECT3DDEVICE8 m_pd3dDevice; -// LPDIRECT3DTEXTURE8 m_pd3dTexture; int m_iSourceWidth, m_iSourceHeight; // dimensions of the original image loaded from disk int m_iTextureWidth, m_iTextureHeight; // dimensions of the texture in memory int m_iImageWidth, m_iImageHeight; // dimensions of the image in the texture - D3DFORMAT m_TextureFormat; + int m_iFramesWide, m_iFramesHigh; // The number of frames of animation in each row and column of this texture + D3DFORMAT m_TextureFormat; - // The number of frames of animation in each row and column of this texture. - int m_iFramesWide, m_iFramesHigh; - // RECTs that hold the bounds of each frame in the bitmap. // e.g., if the texture has 4 frames of animation, the SrcRect for each frame would // be in m_FrameRects[0..4]. CArray m_TextureCoordRects; - }; + + diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index e28b83bb11..917b0bfc99 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -442,3 +442,38 @@ void ReadStringFromFile( FILE* file, CString& s ) } +void WriteIntToFile( FILE* file, int i ) +{ + fprintf( file, "%d\n", i ); +} + +void ReadIntFromFile( FILE* file, int& i ) +{ + fscanf( file, "%d\n", &i ); +} + + +void WriteFloatToFile( FILE* file, float f ) +{ + fprintf( file, "%f\n", f ); +} + +void ReadFloatFromFile( FILE* file, float& f ) +{ + fscanf( file, "%f\n", &f ); +} + + + +void WriteUlongToFile( FILE* file, ULONG u ) +{ + fprintf( file, "%u\n", u ); +} + +void ReadUlongFromFile( FILE* file, ULONG& u ) +{ + fscanf( file, "%u\n", &u ); +} + + + diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index 4d821557f9..9f5ae28efe 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -114,4 +114,10 @@ HINSTANCE GotoURL(LPCTSTR url); void WriteStringToFile( FILE* file, CString s ); void ReadStringFromFile( FILE* file, CString& s ); +void WriteIntToFile( FILE* file, int i ); +void ReadIntFromFile( FILE* file, int& i ); +void WriteFloatToFile( FILE* file, float f ); +void ReadFloatFromFile( FILE* file, float& f ); +void WriteUlongToFile( FILE* file, ULONG u ); +void ReadUlongFromFile( FILE* file, ULONG& u ); diff --git a/stepmania/src/ScreenCaution.cpp b/stepmania/src/ScreenCaution.cpp index f194f6bb8d..1b6024e5b3 100644 --- a/stepmania/src/ScreenCaution.cpp +++ b/stepmania/src/ScreenCaution.cpp @@ -53,7 +53,7 @@ void ScreenCaution::HandleScreenMessage( const ScreenMessage SM ) m_Wipe.CloseWipingRight( SM_GoToSelectMusic ); break; case SM_DoneOpening: - if( PREFS->m_GameOptions.m_bAnnouncer ) + if( PREFSMAN->m_bAnnouncer ) SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_CAUTION) ); break; case SM_GoToSelectMusic: diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index bf499582ec..6b2c6bcecd 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -74,30 +74,30 @@ ScreenEdit::ScreenEdit() m_GranularityIndicator.SetZoom( 0.5f ); m_GrayArrowRowEdit.SetXY( EDIT_CENTER_X, EDIT_GRAY_Y ); - m_GrayArrowRowEdit.Load( m_PlayerOptions ); + m_GrayArrowRowEdit.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions ); m_GrayArrowRowEdit.SetZoom( 0.5f ); NoteData noteData; - noteData.m_iNumTracks = GAME->GetCurrentStyleDef()->m_iColsPerPlayer; + noteData.m_iNumTracks = GAMEMAN->GetCurrentStyleDef()->m_iColsPerPlayer; if( SONGMAN->m_pCurNotes[PLAYER_1] != NULL ) noteData = *SONGMAN->m_pCurNotes[PLAYER_1]->GetNoteData(); m_NoteFieldEdit.SetXY( EDIT_CENTER_X, EDIT_GRAY_Y ); m_NoteFieldEdit.SetZoom( 0.5f ); - m_NoteFieldEdit.Load( ¬eData, PLAYER_1, m_PlayerOptions, 10, 12, NoteField::MODE_EDITING ); + m_NoteFieldEdit.Load( ¬eData, PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions, 10, 12, NoteField::MODE_EDITING ); m_rectRecordBack.StretchTo( CRect(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) ); m_rectRecordBack.SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); m_GrayArrowRowRecord.SetXY( EDIT_CENTER_X, EDIT_GRAY_Y ); - m_GrayArrowRowRecord.Load( m_PlayerOptions ); + m_GrayArrowRowRecord.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions ); m_GrayArrowRowRecord.SetZoom( 1.0f ); m_NoteFieldRecord.SetXY( EDIT_CENTER_X, EDIT_GRAY_Y ); m_NoteFieldRecord.SetZoom( 1.0f ); - m_NoteFieldRecord.Load( ¬eData, PLAYER_1, m_PlayerOptions, 2, 5, NoteField::MODE_EDITING ); + m_NoteFieldRecord.Load( ¬eData, PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions, 2, 5, NoteField::MODE_EDITING ); - m_Player.Load( PLAYER_1, ¬eData, PlayerOptions(), NULL, NULL ); + m_Player.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), ¬eData, PlayerOptions(), NULL, NULL ); m_Player.SetXY( EDIT_CENTER_X, EDIT_GRAY_Y ); m_Fade.SetClosed(); @@ -371,9 +371,8 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ // allocate a new Notes SONGMAN->m_pCurSong->m_arrayNotes.SetSize( SONGMAN->m_pCurSong->m_arrayNotes.GetSize() + 1 ); pNotes = &SONGMAN->m_pCurSong->m_arrayNotes[ SONGMAN->m_pCurSong->m_arrayNotes.GetSize()-1 ]; - pNotes->m_sIntendedGame = GAME->m_sCurrentGame; - pNotes->m_sIntendedStyle = GAME->m_sCurrentStyle; - pNotes->m_sDescription = "Untitled Edit"; + pNotes->m_NotesType = GAMEMAN->m_CurNotesType; + pNotes->m_sDescription = "Untitled"; pNotes->m_iMeter = 1; } @@ -500,7 +499,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ m_Mode = MODE_PLAY; - m_Player.Load( PLAYER_1, (NoteData*)&m_NoteFieldEdit, PlayerOptions(), NULL, NULL ); + m_Player.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), (NoteData*)&m_NoteFieldEdit, PlayerOptions(), NULL, NULL ); m_rectRecordBack.BeginTweening( 0.5f ); m_rectRecordBack.SetTweenDiffuseColor( D3DXCOLOR(0,0,0,0.5f) ); diff --git a/stepmania/src/ScreenEditMenu.cpp b/stepmania/src/ScreenEditMenu.cpp index da4a140e5f..d1ebfd09c4 100644 --- a/stepmania/src/ScreenEditMenu.cpp +++ b/stepmania/src/ScreenEditMenu.cpp @@ -59,7 +59,7 @@ ScreenEditMenu::ScreenEditMenu() SONGMAN->GetGroupNames( m_sGroups ); m_iSelectedGroup = 0; m_iSelectedSong = 0; - m_iSelectedStyle = 0; + m_CurNotesType = NOTES_TYPE_DANCE_SINGLE; m_iSelectedNotes = 0; m_textGroup.Load( THEME->GetPathTo(FONT_HEADER1) ); @@ -72,10 +72,10 @@ ScreenEditMenu::ScreenEditMenu() m_textSong.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) ); this->AddActor( &m_textSong ); - m_textStyle.Load( THEME->GetPathTo(FONT_HEADER1) ); - m_textStyle.SetXY( GAME_STYLE_X, GAME_STYLE_Y ); - m_textStyle.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) ); - this->AddActor( &m_textStyle ); + m_textNotesType.Load( THEME->GetPathTo(FONT_HEADER1) ); + m_textNotesType.SetXY( GAME_STYLE_X, GAME_STYLE_Y ); + m_textNotesType.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) ); + this->AddActor( &m_textNotesType ); m_textNotes.Load( THEME->GetPathTo(FONT_HEADER1) ); m_textNotes.SetXY( STEPS_X, STEPS_Y ); @@ -153,7 +153,7 @@ void ScreenEditMenu::BeforeRowChange() { m_textGroup.SetEffectNone(); m_textSong.SetEffectNone(); - m_textStyle.SetEffectNone(); + m_textNotesType.SetEffectNone(); m_textNotes.SetEffectNone(); } @@ -161,10 +161,10 @@ void ScreenEditMenu::AfterRowChange() { switch( m_SelectedRow ) { - case ROW_GROUP: m_textGroup.SetEffectGlowing(); break; - case ROW_SONG: m_textSong.SetEffectGlowing(); break; - case ROW_GAME_MODE: m_textStyle.SetEffectGlowing(); break; - case ROW_STEPS: m_textNotes.SetEffectGlowing(); break; + case ROW_GROUP: m_textGroup.SetEffectGlowing(); break; + case ROW_SONG: m_textSong.SetEffectGlowing(); break; + case ROW_NOTES_TYPE: m_textNotesType.SetEffectGlowing(); break; + case ROW_STEPS: m_textNotes.SetEffectGlowing(); break; default: ASSERT(false); } } @@ -188,24 +188,17 @@ void ScreenEditMenu::OnSongChange() m_textSong.SetText( GetSelectedSong()->GetMainTitle() ); - m_sStyles.RemoveAll(); - m_sStyles.Add( "single" ); - m_sStyles.Add( "versus" ); - m_sStyles.Add( "double" ); - m_sStyles.Add( "couple" ); - m_sStyles.Add( "solo" ); - - OnDanceStyleChange(); + OnNotesTypeChange(); } -void ScreenEditMenu::OnDanceStyleChange() +void ScreenEditMenu::OnNotesTypeChange() { - m_iSelectedStyle = clamp( m_iSelectedStyle, 0, m_sStyles.GetSize()-1 ); + m_CurNotesType = (NotesType)clamp( m_CurNotesType, 0, NUM_NOTES_TYPES ); - m_textStyle.SetText( GetSelectedStyle() ); + m_textNotesType.SetText( NotesTypeToString( GetSelectedNotesType() ) ); m_pNotess.RemoveAll(); - GetSelectedSong()->GetNotessThatMatchGameAndStyle( "dance", GetSelectedStyle(), m_pNotess ); + GetSelectedSong()->GetNotesThatMatch( GetSelectedNotesType(), m_pNotess ); SortNotesArrayByDifficultyClass( m_pNotess ); m_pNotess.Add( NULL ); // marker for "(NEW)" m_iSelectedNotes = 0; @@ -261,11 +254,11 @@ void ScreenEditMenu::MenuLeft( PlayerNumber p ) m_iSelectedSong--; OnSongChange(); break; - case ROW_GAME_MODE: - if( m_iSelectedStyle == 0 ) // can't go left any further + case ROW_NOTES_TYPE: + if( m_CurNotesType == 0 ) // can't go left any further return; - m_iSelectedStyle--; - OnDanceStyleChange(); + m_CurNotesType = NotesType( m_CurNotesType-1 ); + OnNotesTypeChange(); break; case ROW_STEPS: if( m_iSelectedNotes == 0 ) // can't go left any further @@ -294,11 +287,11 @@ void ScreenEditMenu::MenuRight( PlayerNumber p ) m_iSelectedSong++; OnSongChange(); break; - case ROW_GAME_MODE: - if( m_iSelectedStyle == m_sStyles.GetSize()-1 ) // can't go right any further + case ROW_NOTES_TYPE: + if( m_CurNotesType == NUM_NOTES_TYPES-1 ) // can't go right any further return; - m_iSelectedStyle++; - OnDanceStyleChange(); + m_CurNotesType = NotesType( m_CurNotesType+1 ); + OnNotesTypeChange(); break; case ROW_STEPS: if( m_iSelectedNotes == m_pNotess.GetSize()-1 ) // can't go right any further @@ -318,7 +311,7 @@ void ScreenEditMenu::MenuStart( PlayerNumber p ) MUSIC->Stop(); SONGMAN->m_pCurSong = GetSelectedSong(); - GAME->m_sCurrentStyle = GetSelectedStyle(); + GAMEMAN->m_CurNotesType = GetSelectedNotesType(); SONGMAN->m_pCurNotes[PLAYER_1] = GetSelectedNotes(); m_soundSelect.PlayRandom(); diff --git a/stepmania/src/ScreenEditMenu.h b/stepmania/src/ScreenEditMenu.h index 7417fcab5f..8b54cc4360 100644 --- a/stepmania/src/ScreenEditMenu.h +++ b/stepmania/src/ScreenEditMenu.h @@ -38,13 +38,13 @@ private: void OnGroupChange(); void OnSongChange(); - void OnDanceStyleChange(); + void OnNotesTypeChange(); void OnStepsChange(); - CString GetSelectedGroup() { return m_sGroups[m_iSelectedGroup]; }; - Song* GetSelectedSong() { return m_pSongs[m_iSelectedSong]; }; - CString GetSelectedStyle() { return m_sStyles[m_iSelectedStyle]; }; - Notes* GetSelectedNotes() { return m_pNotess[m_iSelectedNotes]; }; + CString GetSelectedGroup() { return m_sGroups[m_iSelectedGroup]; }; + Song* GetSelectedSong() { return m_pSongs[m_iSelectedSong]; }; + NotesType GetSelectedNotesType() { return m_CurNotesType; }; + Notes* GetSelectedNotes() { return m_pNotess[m_iSelectedNotes]; }; void MenuUp( PlayerNumber p ); void MenuDown( PlayerNumber p ); @@ -54,7 +54,7 @@ private: void MenuStart( PlayerNumber p ); - enum SelectedRow { ROW_GROUP, ROW_SONG, ROW_GAME_MODE, ROW_STEPS, NUM_ROWS }; + enum SelectedRow { ROW_GROUP, ROW_SONG, ROW_NOTES_TYPE, ROW_STEPS, NUM_ROWS }; SelectedRow m_SelectedRow; MenuElements m_Menu; @@ -67,9 +67,8 @@ private: int m_iSelectedSong; // index into m_pSongs BitmapText m_textSong; - CStringArray m_sStyles; - int m_iSelectedStyle; // index into enum GameMode - BitmapText m_textStyle; + NotesType m_CurNotesType; // index into enum GameMode + BitmapText m_textNotesType; CArray m_pNotess; int m_iSelectedNotes; // index into m_pNotess diff --git a/stepmania/src/ScreenGameOver.cpp b/stepmania/src/ScreenGameOver.cpp new file mode 100644 index 0000000000..3fd46417b1 --- /dev/null +++ b/stepmania/src/ScreenGameOver.cpp @@ -0,0 +1,60 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: ScreenGameOver + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ScreenGameOver.h" +#include "ThemeManager.h" +#include "RageLog.h" +#include "TransitionFadeWipe.h" +#include "Sprite.h" +#include "AnnouncerManager.h" +#include "ScreenManager.h" +#include "ScreenTitleMenu.h" + +const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 1); +const ScreenMessage SM_GoToNextState = ScreenMessage(SM_User + 2); + + +ScreenGameOver::ScreenGameOver() +{ + m_psprGameOver = new Sprite; + m_psprGameOver->Load( THEME->GetPathTo(GRAPHIC_GAME_OVER) ); + m_psprGameOver->SetXY( CENTER_X, CENTER_Y ); + this->AddActor( m_psprGameOver ); + + m_pWipe = new TransitionFadeWipe; + m_pWipe->OpenWipingRight(); + + this->SendScreenMessage( SM_StartFadingOut, 5 ); +} + + +ScreenGameOver::~ScreenGameOver() +{ + delete m_psprGameOver; + delete m_pWipe; +} + +void ScreenGameOver::HandleScreenMessage( const ScreenMessage SM ) +{ + switch( SM ) + { + case SM_StartFadingOut: + m_psprGameOver->BeginTweening( 0.8f ); + m_psprGameOver->SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) ); + this->SendScreenMessage( SM_GoToNextState, 0.8f ); + break; + case SM_GoToNextState: + SCREENMAN->SetNewScreen( new ScreenTitleMenu ); + break; + } +} + diff --git a/stepmania/src/ScreenGameOver.h b/stepmania/src/ScreenGameOver.h new file mode 100644 index 0000000000..944cf71763 --- /dev/null +++ b/stepmania/src/ScreenGameOver.h @@ -0,0 +1,34 @@ +/* +----------------------------------------------------------------------------- + Class: ScreenGameOver + + Desc: Shows the stage number. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Screen.h" + +class Sprite; +class TransitionFadeWipe; + + +class ScreenGameOver : public Screen +{ +public: + ScreenGameOver(); + + ~ScreenGameOver(); + + virtual void HandleScreenMessage( const ScreenMessage SM ); + +private: + + Sprite* m_psprGameOver; + + TransitionFadeWipe* m_pWipe; +}; + + diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 27db72a99e..83031c865e 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -22,22 +22,21 @@ #include "SongManager.h" #include "RageLog.h" #include "AnnouncerManager.h" +#include "ScreenGameOver.h" // // Defines specific to GameScreenTitleMenu // -const float COLUMN_LEFT_SINGLE = (SCREEN_WIDTH*1/4); -const float COLUMN_RIGHT_SINGLE = (SCREEN_WIDTH*3/4); -const float COLUMN_LEFT_DOUBLE = (COLUMN_LEFT_SINGLE+30); -const float COLUMN_RIGHT_DOUBLE = (COLUMN_RIGHT_SINGLE-30); - const float LIFE_X[NUM_PLAYERS] = { CENTER_X-180, CENTER_X+180 }; const float LIFE_Y = SCREEN_TOP+28; const float SCORE_X[NUM_PLAYERS] = { CENTER_X-214, CENTER_X+214 }; const float SCORE_Y = SCREEN_BOTTOM-38; +const float DIFFICULTY_X[NUM_PLAYERS] = { SCREEN_LEFT+50, SCREEN_RIGHT-50 }; +const float DIFFICULTY_Y = SCREEN_BOTTOM-80; + const float MAX_SECONDS_CAN_BE_OFF_BY = 0.20f; const float TIME_BETWEEN_DANCING_COMMENTS = 15; @@ -57,7 +56,7 @@ const ScreenMessage SM_BeginFailed = ScreenMessage(SM_User+121); const ScreenMessage SM_ShowFailed = ScreenMessage(SM_User+122); const ScreenMessage SM_PlayFailComment = ScreenMessage(SM_User+123); const ScreenMessage SM_HideFailed = ScreenMessage(SM_User+124); -const ScreenMessage SM_GoToSelectSong = ScreenMessage(SM_User+125); +const ScreenMessage SM_GoToScreenAfterFail = ScreenMessage(SM_User+125); @@ -72,67 +71,52 @@ ScreenGameplay::ScreenGameplay() m_pSong = SONGMAN->m_pCurSong; - - // Get the current StyleDef definition (used below) - StyleDef* pStyleDef = GAME->GetCurrentStyleDef(); - - for( int p=0; pIsPlayerEnabled(PlayerNumber(p)) ) - continue; - - NoteData* pOriginalNoteData = SONGMAN->m_pCurNotes[p]->GetNoteData(); - - NoteData newNoteData; - GAME->GetCurrentStyleDef()->GetTransformedNoteDataForStyle( (PlayerNumber)p, pOriginalNoteData, newNoteData ); - - m_Player[p].Load( - (PlayerNumber)p, - &newNoteData, - PREFS->m_PlayerOptions[p], - &m_LifeMeter[p], - &m_ScoreDisplay[p] - ); - - } - - m_Background.LoadFromSong( SONGMAN->m_pCurSong ); m_Background.SetDiffuseColor( D3DXCOLOR(0.4f,0.4f,0.4f,1) ); this->AddActor( &m_Background ); + // Get the current StyleDef definition (used below) + StyleDef* pStyleDef = GAMEMAN->GetCurrentStyleDef(); + + for( int p=0; pIsPlayerEnabled(PlayerNumber(p)) ) + continue; + + float fDifficultyY = DIFFICULTY_Y; + if( PREFSMAN->m_PlayerOptions[p].m_bReverseScroll ) + fDifficultyY = SCREEN_HEIGHT - DIFFICULTY_Y; + m_DifficultyBanner[p].SetXY( DIFFICULTY_X[p], fDifficultyY ); + m_DifficultyBanner[p].SetFromNotes( SONGMAN->m_pCurNotes[p] ); + this->AddActor( &m_DifficultyBanner[p] ); - // init players - if( GAME->m_sCurrentStyle == "single" ) - { - m_Player[PLAYER_1].SetX( COLUMN_LEFT_SINGLE ); - this->AddActor( &m_Player[PLAYER_1] ); - } - else if( GAME->m_sCurrentStyle == "versus" || GAME->m_sCurrentStyle == "couple" ) - { - m_Player[PLAYER_1].SetX( COLUMN_LEFT_SINGLE ); - this->AddActor( &m_Player[PLAYER_1] ); - m_Player[PLAYER_2].SetX( COLUMN_RIGHT_SINGLE ); - this->AddActor( &m_Player[PLAYER_2] ); - } - else if( GAME->m_sCurrentStyle == "double" || GAME->m_sCurrentStyle == "solo" ) - { - m_Player[PLAYER_1].SetX( CENTER_X ); - this->AddActor( &m_Player[PLAYER_1] ); - } - else - ASSERT( false ); // invalid style + NoteData* pOriginalNoteData = SONGMAN->m_pCurNotes[p]->GetNoteData(); + + NoteData newNoteData; + GAMEMAN->GetCurrentStyleDef()->GetTransformedNoteDataForStyle( (PlayerNumber)p, pOriginalNoteData, newNoteData ); + m_Player[p].SetX( (float) GAMEMAN->GetCurrentStyleDef()->m_iCenterX[p] ); + m_Player[p].Load( + (PlayerNumber)p, + GAMEMAN->GetCurrentStyleDef(), + &newNoteData, + PREFSMAN->m_PlayerOptions[p], + &m_LifeMeter[p], + &m_ScoreDisplay[p] + ); + + this->AddActor( &m_Player[p] ); + } for( p=0; pIsPlayerEnabled(PlayerNumber(p)) ) + if( !GAMEMAN->IsPlayerEnabled(PlayerNumber(p)) ) continue; - m_LifeMeter[p].SetPlayerOptions( PREFS->m_PlayerOptions[p] ); + m_LifeMeter[p].SetPlayerOptions( PREFSMAN->m_PlayerOptions[p] ); m_LifeMeter[p].SetXY( LIFE_X[p], LIFE_Y ); m_LifeMeter[p].SetZoomX( 256 ); m_LifeMeter[p].SetZoomY( 20 ); @@ -151,13 +135,13 @@ ScreenGameplay::ScreenGameplay() m_textSmallStage.TurnShadowOff(); m_textSmallStage.SetXY( CENTER_X, 60 ); m_textSmallStage.SetDiffuseColor( D3DXCOLOR(0.3f,1,1,1) ); - m_textSmallStage.SetText( PREFS->GetStageText() ); + m_textSmallStage.SetText( PREFSMAN->GetStageText() ); this->AddActor( &m_textSmallStage ); for( p=0; pIsPlayerEnabled(PlayerNumber(p)) ) + if( !GAMEMAN->IsPlayerEnabled(PlayerNumber(p)) ) continue; m_ScoreDisplay[p].SetXY( SCORE_X[p], SCORE_Y ); @@ -243,13 +227,13 @@ void ScreenGameplay::Update( float fDeltaTime ) for( int p=0; pIsPlayerEnabled(PlayerNumber(p)) ) + if( !GAMEMAN->IsPlayerEnabled(PlayerNumber(p)) ) continue; m_Player[p].Update( fDeltaTime, fSongBeat, fMaxBeatDifference ); } // check for fail - switch( PREFS->m_SongOptions.m_FailType ) + switch( PREFSMAN->m_SongOptions.m_FailType ) { case SongOptions::FAIL_ARCADE: case SongOptions::FAIL_END_OF_SONG: @@ -263,17 +247,15 @@ void ScreenGameplay::Update( float fDeltaTime ) bool bAllFailed = true; for( int p=0; pIsPlayerEnabled(PlayerNumber(p)) ) + if( !GAMEMAN->IsPlayerEnabled(PlayerNumber(p)) ) continue; - const float fLifePercentage = m_LifeMeter[p].GetLifePercentage(); - - if( fLifePercentage > 0.3f ) + if( !m_LifeMeter[p].IsAboutToFail() ) { bAllAboutToFail = false; bAllFailed = false; } - else if( fLifePercentage > 0.0f ) // dead. Let the message handler choose to fail or not + else if( !m_LifeMeter[p].HasFailed() ) { bAllFailed = false; } @@ -304,7 +286,7 @@ void ScreenGameplay::Update( float fDeltaTime ) this->SendScreenMessage( SM_SongEnded, 1 ); // Check to see if it's time to play a gameplay comment - if( PREFS->m_GameOptions.m_bAnnouncer ) + if( PREFSMAN->m_bAnnouncer ) { m_fTimeLeftBeforeDancingComment -= fDeltaTime; if( m_fTimeLeftBeforeDancingComment <= 0 ) @@ -322,7 +304,7 @@ void ScreenGameplay::Update( float fDeltaTime ) - if( PREFS->m_SongOptions.m_AssistType == SongOptions::ASSIST_TICK ) + if( PREFSMAN->m_SongOptions.m_AssistType == SongOptions::ASSIST_TICK ) { // // play assist ticks @@ -342,10 +324,11 @@ void ScreenGameplay::Update( float fDeltaTime ) { for( int p=0; pIsPlayerEnabled( (PlayerNumber)p ) ) + if( !GAMEMAN->IsPlayerEnabled( (PlayerNumber)p ) ) continue; // skip bAnyoneHasANote |= m_Player[p].IsThereANoteAtIndex( i ); + break; // this will only play the tick for the first player that is joined } } @@ -413,7 +396,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) break; case SM_User+2: m_sprReady.StartFocusing(); - if( PREFS->m_GameOptions.m_bAnnouncer ) + if( PREFSMAN->m_bAnnouncer ) m_announcerReady.PlayRandom(); break; case SM_User+3: @@ -423,11 +406,11 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) break; case SM_User+5: m_sprHereWeGo.StartFocusing(); - if( PREFS->m_GameOptions.m_bAnnouncer ) + if( PREFSMAN->m_bAnnouncer ) m_announcerHereWeGo.PlayRandom(); m_Background.SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,0.8f,1) ); m_soundMusic.Play(); - m_soundMusic.SetPlaybackRate( PREFS->m_SongOptions.m_fMusicRate ); + m_soundMusic.SetPlaybackRate( PREFSMAN->m_SongOptions.m_fMusicRate ); break; case SM_User+6: break; @@ -442,7 +425,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) // received while STATE_DANCING case SM_LifeIs0: - if( PREFS->m_SongOptions.m_FailType == SongOptions::FAIL_ARCADE ) // fail them now! + if( PREFSMAN->m_SongOptions.m_FailType == SongOptions::FAIL_ARCADE ) // fail them now! this->SendScreenMessage( SM_BeginFailed, 0 ); m_DancingState = STATE_OUTRO; break; @@ -457,7 +440,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) else // cleared { m_StarWipe.CloseWipingRight( SM_ShowCleared ); - if( PREFS->m_GameOptions.m_bAnnouncer ) + if( PREFSMAN->m_bAnnouncer ) m_announcerCleared.PlayRandom(); // crowd cheer } m_DancingState = STATE_OUTRO; @@ -473,9 +456,9 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) SCREENMAN->SendMessageToTopScreen( SM_GoToResults, 1 ); break; case SM_GoToResults: - // send score summaries to the PREFS object so ScreenResults can grab it. - PREFS->m_ScoreSummary[PLAYER_1] = m_Player[PLAYER_1].GetScoreSummary(); - PREFS->m_ScoreSummary[PLAYER_2] = m_Player[PLAYER_2].GetScoreSummary(); + // send score summaries to the PREFSMAN object so ScreenResults can grab it. + PREFSMAN->m_ScoreSummary[PLAYER_1] = m_Player[PLAYER_1].GetScoreSummary(); + PREFSMAN->m_ScoreSummary[PLAYER_2] = m_Player[PLAYER_2].GetScoreSummary(); SCREENMAN->SetNewScreen( new ScreenResults ); break; @@ -487,7 +470,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) this->SendScreenMessage( SM_ShowFailed, 0.2f ); break; case SM_ShowFailed: - if( PREFS->m_GameOptions.m_bAnnouncer ) + if( PREFSMAN->m_bAnnouncer ) m_soundFail.PlayRandom(); // make the background invisible so we don't waste mem bandwidth drawing it @@ -509,7 +492,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) SCREENMAN->SendMessageToTopScreen( SM_HideFailed, 3.0f ); break; case SM_PlayFailComment: - if( PREFS->m_GameOptions.m_bAnnouncer ) + if( PREFSMAN->m_bAnnouncer ) m_announcerFailComment.PlayRandom(); break; case SM_HideFailed: @@ -517,10 +500,13 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) m_sprFailed.BeginTweening(1.0f); m_sprFailed.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) ); - SCREENMAN->SendMessageToTopScreen( SM_GoToSelectSong, 1.5f ); + SCREENMAN->SendMessageToTopScreen( SM_GoToScreenAfterFail, 1.5f ); break; - case SM_GoToSelectSong: - SCREENMAN->SetNewScreen( new ScreenSelectMusic ); + case SM_GoToScreenAfterFail: + if( PREFSMAN->m_bEventMode ) + SCREENMAN->SetNewScreen( new ScreenSelectMusic ); + else + SCREENMAN->SetNewScreen( new ScreenGameOver ); break; } diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index db5b75e11b..77f602f143 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -23,6 +23,7 @@ #include "Background.h" #include "LifeMeterBar.h" #include "ScoreDisplayRolling.h" +#include "DifficultyBanner.h" class ScreenGameplay : public Screen @@ -49,8 +50,8 @@ private: float m_fTimeLeftBeforeDancingComment; // this counter is only running while STATE_DANCING - Song* m_pSong; - bool m_bHasFailed; + Song* m_pSong; + bool m_bHasFailed; Background m_Background; @@ -73,6 +74,8 @@ private: Player m_Player[NUM_PLAYERS]; + DifficultyBanner m_DifficultyBanner[NUM_PLAYERS]; + RandomSample m_soundFail; RandomSample m_announcerReady; RandomSample m_announcerHereWeGo; diff --git a/stepmania/src/ScreenGraphicOptions.cpp b/stepmania/src/ScreenGraphicOptions.cpp deleted file mode 100644 index 9cf1376af9..0000000000 --- a/stepmania/src/ScreenGraphicOptions.cpp +++ /dev/null @@ -1,161 +0,0 @@ -#include "stdafx.h" -/* ------------------------------------------------------------------------------ - File: ScreenGraphicOptions.cpp - - Desc: Select a song. - - Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ------------------------------------------------------------------------------ -*/ - -#include "ScreenGraphicOptions.h" -#include -#include "RageTextureManager.h" -#include "RageUtil.h" -#include "RageMusic.h" -#include "ScreenManager.h" -#include "PrefsManager.h" -#include "ScreenOptions.h" -#include "ScreenTitleMenu.h" -#include "GameConstantsAndTypes.h" -#include "StepMania.h" -#include "ThemeManager.h" -#include "RageLog.h" - - -enum { - GO_WINDOWED = 0, - GO_PROFILE, - GO_RESOLUTION, - GO_TEXTURE_SIZE, - GO_DISPLAY_COLOR, - GO_TEXTURE_COLOR, - GO_BACKGROUNDS, - NUM_GRAPHIC_OPTIONS_LINES -}; -OptionLineData g_GraphicOptionsLines[NUM_GRAPHIC_OPTIONS_LINES] = { - { "Mode", 2, {"Fullscreen", "Windowed"} }, - { "Profile", 5, {"Super Low", "Low", "Medium", "High", "Custom (use settings below)"} }, - { "Resolution", 7, {"320", "400", "512", "640", "800", "1024", "1280" } }, - { "Tex. Size", 4, {"256", "512", "1024", "2048"} }, - { "Display", 2, {"16bit", "32bit"} }, - { "Tex. Color", 2, {"16bit", "32bit"} }, -}; - -//const int NUm_SelectedOption_LINES = sizeof(g_GraphicOptionsLines)/sizeof(OptionLine); - -ScreenGraphicOptions::ScreenGraphicOptions() : - ScreenOptions( - THEME->GetPathTo(GRAPHIC_GRAPHIC_OPTIONS_BACKGROUND), - THEME->GetPathTo(GRAPHIC_GRAPHIC_OPTIONS_TOP_EDGE) - ) -{ - LOG->WriteLine( "ScreenGraphicOptions::ScreenGraphicOptions()" ); - - Init( - INPUTMODE_BOTH, - g_GraphicOptionsLines, - NUM_GRAPHIC_OPTIONS_LINES - ); -} - -void ScreenGraphicOptions::ImportOptions() -{ - GraphicProfileOptions* pGPO = PREFS->GetCustomGraphicProfileOptions(); - - m_iSelectedOption[0][GO_WINDOWED] = (PREFS->m_bWindowed ? 1:0 ); - m_iSelectedOption[0][GO_PROFILE] = PREFS->m_GraphicProfile; - - switch( pGPO->m_iWidth ) - { - case 320: m_iSelectedOption[0][GO_RESOLUTION] = 0; break; - case 400: m_iSelectedOption[0][GO_RESOLUTION] = 1; break; - case 512: m_iSelectedOption[0][GO_RESOLUTION] = 2; break; - case 640: m_iSelectedOption[0][GO_RESOLUTION] = 3; break; - case 800: m_iSelectedOption[0][GO_RESOLUTION] = 4; break; - case 1024: m_iSelectedOption[0][GO_RESOLUTION] = 5; break; - case 1280: m_iSelectedOption[0][GO_RESOLUTION] = 6; break; - default: m_iSelectedOption[0][GO_RESOLUTION] = 3; break; - } - switch( pGPO->m_iMaxTextureSize ) - { - case 256: m_iSelectedOption[0][GO_TEXTURE_SIZE] = 0; break; - case 512: m_iSelectedOption[0][GO_TEXTURE_SIZE] = 1; break; - case 1024: m_iSelectedOption[0][GO_TEXTURE_SIZE] = 2; break; - case 2048: m_iSelectedOption[0][GO_TEXTURE_SIZE] = 3; break; - default: m_iSelectedOption[0][GO_TEXTURE_SIZE] = 1; break; - } - switch( pGPO->m_iDisplayColor ) - { - case 16: m_iSelectedOption[0][GO_DISPLAY_COLOR] = 0; break; - case 32: m_iSelectedOption[0][GO_DISPLAY_COLOR] = 1; break; - } - switch( pGPO->m_iTextureColor ) - { - case 16: m_iSelectedOption[0][GO_TEXTURE_COLOR] = 0; break; - case 32: m_iSelectedOption[0][GO_TEXTURE_COLOR] = 1; break; - } -} - -void ScreenGraphicOptions::ExportOptions() -{ - GraphicProfileOptions* pGPO = PREFS->GetCustomGraphicProfileOptions(); - - PREFS->m_bWindowed = (m_iSelectedOption[0][GO_WINDOWED] == 1); - PREFS->m_GraphicProfile = (GraphicProfile)m_iSelectedOption[0][GO_PROFILE]; - - switch( m_iSelectedOption[0][GO_RESOLUTION] ) - { - case 0: pGPO->m_iWidth = 320; break; - case 1: pGPO->m_iWidth = 400; break; - case 2: pGPO->m_iWidth = 512; break; - case 3: pGPO->m_iWidth = 640; break; - case 4: pGPO->m_iWidth = 800; break; - case 5: pGPO->m_iWidth = 1024; break; - case 6: pGPO->m_iWidth = 1280; break; - default: ASSERT( false ); - } - pGPO->m_iHeight = GetHeightFromWidth( pGPO->m_iWidth ); - - switch( m_iSelectedOption[0][GO_TEXTURE_SIZE] ) - { - case 0: pGPO->m_iMaxTextureSize = 256; break; - case 1: pGPO->m_iMaxTextureSize = 512; break; - case 2: pGPO->m_iMaxTextureSize = 1024; break; - case 3: pGPO->m_iMaxTextureSize = 2048; break; - default: ASSERT( false ); - } - switch( m_iSelectedOption[0][GO_DISPLAY_COLOR] ) - { - case 0: pGPO->m_iDisplayColor = 16; break; - case 1: pGPO->m_iDisplayColor = 32; break; - default: ASSERT( false ); - } - switch( m_iSelectedOption[0][GO_TEXTURE_COLOR] ) - { - case 0: pGPO->m_iTextureColor = 16; break; - case 1: pGPO->m_iTextureColor = 32; break; - default: ASSERT( false ); - } - - // - // put the options into effect - // - ApplyGraphicOptions(); -} - -void ScreenGraphicOptions::GoToPrevState() -{ - SCREENMAN->SetNewScreen( new ScreenTitleMenu ); -} - -void ScreenGraphicOptions::GoToNextState() -{ - SCREENMAN->SetNewScreen( new ScreenTitleMenu ); -} - - - - - diff --git a/stepmania/src/ScreenGraphicOptions.h b/stepmania/src/ScreenGraphicOptions.h deleted file mode 100644 index 3017bbcb68..0000000000 --- a/stepmania/src/ScreenGraphicOptions.h +++ /dev/null @@ -1,31 +0,0 @@ -/* ------------------------------------------------------------------------------ - File: ScreenGraphicOptions.h - - Desc: Select a song. - - Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ------------------------------------------------------------------------------ -*/ - -#include "Screen.h" -#include "ScreenOptions.h" -#include "Sprite.h" -#include "BitmapText.h" -#include "RandomSample.h" -#include "TransitionFade.h" -#include "Quad.h" - - -class ScreenGraphicOptions : public ScreenOptions -{ -public: - ScreenGraphicOptions(); - -private: - void ImportOptions(); - void ExportOptions(); - - void GoToNextState(); - void GoToPrevState(); -}; diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index c61f66fec1..18ec0b1db4 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -94,7 +94,7 @@ void ScreenManager::Draw() if( m_textSystemMessage.GetDiffuseColor().a != 0 ) m_textSystemMessage.Draw(); - if( PREFS && PREFS->m_GameOptions.m_bShowFPS ) + if( PREFSMAN && PREFSMAN->m_bShowFPS ) { m_textFPS.SetText( ssprintf("%3.0f FPS", DISPLAY->GetFPS()) ); m_textFPS.Draw(); diff --git a/stepmania/src/ScreenMessage.h b/stepmania/src/ScreenMessage.h index 267e10a63b..beba5b5714 100644 --- a/stepmania/src/ScreenMessage.h +++ b/stepmania/src/ScreenMessage.h @@ -1,16 +1,15 @@ +#pragma once /* ----------------------------------------------------------------------------- - File: ScreenMessage.h + File: ScreenMessage - Desc: + Desc: Definition of common ScreenMessages Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ -#ifndef _ScreenMessage_H_ -#define _ScreenMessage_H_ - // common ScreenMessages enum ScreenMessage { @@ -21,7 +20,6 @@ enum ScreenMessage { SM_DoneOpeningWipingRight, SM_LosingInputFocus, SM_RegainingInputFocus, + SM_MenuTimer, SM_User = 100 }; - -#endif \ No newline at end of file diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 24874ae949..6767d2d7de 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -32,22 +32,22 @@ enum { PO_LITTLE, PO_SCROLL, PO_COLOR, - PO_FREEZES, + PO_HOLD_NOTES, PO_DRAIN, PO_SKIN, NUM_PLAYER_OPTIONS_LINES }; OptionLineData g_PlayerOptionsLines[NUM_PLAYER_OPTIONS_LINES] = { - { "Speed", 6, {"x1","x1.5","x2","x3","x5","x8"} }, + { "Speed", 6, {"x1","x1.5","x2","x3","x5","x8"} }, { "Effect", 6, {"OFF","BOOST","WAVE", "DRUNK", "DIZZY", "SPACE"} }, { "Appear", 4, {"VISIBLE","HIDDEN","SUDDEN","STEALTH"} }, - { "Turn", 5, {"OFF","MIRROR","LEFT","RIGHT","SHUFFLE"} }, + { "Turn", 5, {"OFF","MIRROR","LEFT","RIGHT","SHUFFLE"} }, { "Little", 2, {"OFF","ON"} }, { "Scroll", 2, {"STANDARD","REVERSE"} }, - { "Color", 4, {"ARCADE","NOTE","FLAT","PLAIN"} }, - { "Freezes", 2, {"OFF","ON"} }, - { "Drain", 3, {"NORMAL", "NO-RECOVER", "SUDDEN-DEATH"} }, - { "Skin", 0, {""} }, // fill this in on ImportOptions(); + { "Color", 4, {"ARCADE","NOTE","FLAT","PLAIN"} }, + { "Holds", 2, {"OFF","ON"} }, + { "Drain", 3, {"NORMAL", "NO-RECOVER", "SUDDEN-DEATH"} }, + { "Skin", 0, {""} }, // fill this in on ImportOptions(); }; @@ -72,7 +72,7 @@ void ScreenPlayerOptions::ImportOptions() { // fill in skin names CStringArray arraySkinNames; - GAME->GetSkinNames( arraySkinNames ); + GAMEMAN->GetSkinNames( arraySkinNames ); m_OptionLineData[PO_SKIN].iNumOptions = arraySkinNames.GetSize(); @@ -82,7 +82,7 @@ void ScreenPlayerOptions::ImportOptions() for( int p=0; pm_PlayerOptions[p]; + PlayerOptions &po = PREFSMAN->m_PlayerOptions[p]; if( po.m_fArrowScrollSpeed == 1.0f ) m_iSelectedOption[p][PO_SPEED] = 0; else if( po.m_fArrowScrollSpeed == 1.5f ) m_iSelectedOption[p][PO_SPEED] = 1; @@ -98,12 +98,12 @@ void ScreenPlayerOptions::ImportOptions() m_iSelectedOption[p][PO_LITTLE] = po.m_bLittle ? 1 : 0; m_iSelectedOption[p][PO_SCROLL] = po.m_bReverseScroll ? 1 : 0 ; m_iSelectedOption[p][PO_COLOR] = po.m_ColorType; - m_iSelectedOption[p][PO_FREEZES] = po.m_bAllowFreezeArrows ? 1 : 0; + m_iSelectedOption[p][PO_HOLD_NOTES] = po.m_bHoldNotes ? 1 : 0; m_iSelectedOption[p][PO_DRAIN] = po.m_DrainType; // highlight currently selected skin for( int s=0; im_sCurrentSkin[p] ) + if( m_OptionLineData[PO_SKIN].szOptionsText[s] == GAMEMAN->m_sCurrentSkin[p] ) { m_iSelectedOption[p][PO_DRAIN] = s; break; @@ -115,7 +115,7 @@ void ScreenPlayerOptions::ExportOptions() { for( int p=0; pm_PlayerOptions[p]; + PlayerOptions &po = PREFSMAN->m_PlayerOptions[p]; switch( m_iSelectedOption[p][PO_SPEED] ) { @@ -128,50 +128,17 @@ void ScreenPlayerOptions::ExportOptions() } - po.m_EffectType = (PlayerOptions::EffectType)m_iSelectedOption[p][PO_EFFECT]; - po.m_AppearanceType = (PlayerOptions::AppearanceType)m_iSelectedOption[p][PO_APPEAR]; - po.m_TurnType = (PlayerOptions::TurnType)m_iSelectedOption[p][PO_TURN]; - po.m_bLittle = m_iSelectedOption[p][PO_LITTLE] == 1; - po.m_bReverseScroll = (m_iSelectedOption[p][PO_SCROLL] == 1); - po.m_ColorType = (PlayerOptions::ColorType)m_iSelectedOption[p][PO_COLOR]; - po.m_bAllowFreezeArrows = (m_iSelectedOption[p][PO_FREEZES] == 1); - po.m_DrainType = (PlayerOptions::DrainType)m_iSelectedOption[p][PO_DRAIN]; - - switch(po.m_DrainType) { - case po.DRAIN_NORMAL: - po.m_fInitialLifePercentage = 0.5f; - po.m_fLifeAdjustments[po.LIFE_PERFECT] = 0.010f; - po.m_fLifeAdjustments[po.LIFE_GREAT] = 0.005f; - po.m_fLifeAdjustments[po.LIFE_GOOD] = 0.000f; - po.m_fLifeAdjustments[po.LIFE_BOO] = -0.015f; - po.m_fLifeAdjustments[po.LIFE_MISS] = -0.030f; - break; - - case po.DRAIN_NO_RECOVER: - po.m_fInitialLifePercentage = 1.0f; - po.m_fLifeAdjustments[po.LIFE_PERFECT] = 0.000f; - po.m_fLifeAdjustments[po.LIFE_GREAT] = 0.000f; - po.m_fLifeAdjustments[po.LIFE_GOOD] = 0.000f; - po.m_fLifeAdjustments[po.LIFE_BOO] = -0.015f; - po.m_fLifeAdjustments[po.LIFE_MISS] = -0.030f; - break; - - case po.DRAIN_SUDDEN_DEATH: - po.m_fInitialLifePercentage = 1.0f; - po.m_fLifeAdjustments[po.LIFE_PERFECT] = 0.000f; - po.m_fLifeAdjustments[po.LIFE_GREAT] = 0.000f; - po.m_fLifeAdjustments[po.LIFE_GOOD] = -1.000f; - po.m_fLifeAdjustments[po.LIFE_BOO] = -1.000f; - po.m_fLifeAdjustments[po.LIFE_MISS] = -1.000f; - break; - - default: - LOG->WriteLine("Unknown Life Meter Drain Setting: %d", m_iSelectedOption[p][PO_DRAIN]); - } - + po.m_EffectType = (PlayerOptions::EffectType)m_iSelectedOption[p][PO_EFFECT]; + po.m_AppearanceType = (PlayerOptions::AppearanceType)m_iSelectedOption[p][PO_APPEAR]; + po.m_TurnType = (PlayerOptions::TurnType)m_iSelectedOption[p][PO_TURN]; + po.m_bLittle = m_iSelectedOption[p][PO_LITTLE] == 1; + po.m_bReverseScroll = (m_iSelectedOption[p][PO_SCROLL] == 1); + po.m_ColorType = (PlayerOptions::ColorType)m_iSelectedOption[p][PO_COLOR]; + po.m_bHoldNotes = (m_iSelectedOption[p][PO_HOLD_NOTES] == 1); + po.m_DrainType = (PlayerOptions::DrainType)m_iSelectedOption[p][PO_DRAIN]; for( int s=0; sm_sCurrentSkin[p] ) + if( m_OptionLineData[PO_SKIN].szOptionsText[s] == GAMEMAN->m_sCurrentSkin[p] ) { m_iSelectedOption[p][PO_DRAIN] = s; break; diff --git a/stepmania/src/ScreenSelectDifficulty.cpp b/stepmania/src/ScreenSelectDifficulty.cpp index c331653c12..26d6dcee6a 100644 --- a/stepmania/src/ScreenSelectDifficulty.cpp +++ b/stepmania/src/ScreenSelectDifficulty.cpp @@ -100,7 +100,7 @@ ScreenSelectDifficulty::ScreenSelectDifficulty() for( int p=0; pIsPlayerEnabled((PlayerNumber)p) ) + if( !GAMEMAN->IsPlayerEnabled((PlayerNumber)p) ) continue; ThemeElement te; @@ -178,6 +178,12 @@ void ScreenSelectDifficulty::HandleScreenMessage( const ScreenMessage SM ) { switch( SM ) { + case SM_MenuTimer: + { + for( int p=0; pSetNewScreen( new ScreenTitleMenu ); break; @@ -296,7 +302,7 @@ void ScreenSelectDifficulty::TweenOffScreen() for( int p=0; pIsPlayerEnabled((PlayerNumber)p) ) + if( !GAMEMAN->IsPlayerEnabled((PlayerNumber)p) ) continue; m_sprArrow[p].BeginTweening( 0.3f ); @@ -343,7 +349,7 @@ void ScreenSelectDifficulty::TweenOnScreen() for( int p=0; pIsPlayerEnabled((PlayerNumber)p) ) + if( !GAMEMAN->IsPlayerEnabled((PlayerNumber)p) ) continue; int iSelection = m_iSelection[p]; diff --git a/stepmania/src/ScreenSelectGame.cpp b/stepmania/src/ScreenSelectGame.cpp index 94b114181e..282bca53db 100644 --- a/stepmania/src/ScreenSelectGame.cpp +++ b/stepmania/src/ScreenSelectGame.cpp @@ -50,7 +50,7 @@ ScreenSelectGame::ScreenSelectGame() : // populate g_SelectGameLines CStringArray arrayGameNames; - GAME->GetGameNames( arrayGameNames ); + GAMEMAN->GetGameNames( arrayGameNames ); for( int i=0; im_sCurrentGame, m_OptionLineData[0].szOptionsText[i]) ) - { - CString sGameName = m_OptionLineData[0].szOptionsText[i]; - if( sGameName == GAME->m_sCurrentGame ) - m_iSelectedOption[0][SG_GAME] = i; - } - } + m_iSelectedOption[0][SG_GAME] = GAMEMAN->GetCurrentGame(); } void ScreenSelectGame::ExportOptions() { - int iOption = m_iSelectedOption[0][SG_GAME]; - CString sGameName = m_OptionLineData[0].szOptionsText[iOption]; - GAME->SwitchGame( sGameName ); - THEME->SwitchTheme( sGameName ); + // Switch the current style to the frist style of the selected game + Game game = (Game)m_iSelectedOption[0][SG_GAME]; + switch( game ) + { + case GAME_DANCE: GAMEMAN->m_CurStyle = STYLE_DANCE_SINGLE; break; + case GAME_PUMP: GAMEMAN->m_CurStyle = STYLE_PUMP_SINGLE; break; + default: ASSERT(0); // invalid Game + } + + // Try to switch themes to a theme with the same name as the current game + CStringArray asGameNames; + GAMEMAN->GetGameNames( asGameNames ); + CString sGameName = asGameNames[game]; + THEME->SwitchTheme( sGameName ); } void ScreenSelectGame::GoToPrevState() diff --git a/stepmania/src/ScreenSelectGroup.cpp b/stepmania/src/ScreenSelectGroup.cpp index 5c16ac5467..a629663889 100644 --- a/stepmania/src/ScreenSelectGroup.cpp +++ b/stepmania/src/ScreenSelectGroup.cpp @@ -161,6 +161,9 @@ void ScreenSelectGroup::HandleScreenMessage( const ScreenMessage SM ) { switch( SM ) { + case SM_MenuTimer: + MenuStart(PLAYER_1); + break; case SM_GoToPrevState: SCREENMAN->SetNewScreen( new ScreenTitleMenu ); break; @@ -229,6 +232,7 @@ void ScreenSelectGroup::AfterChange() else sGroupBannerPath = THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER); + // There is too much Z-fighting when we rotate this, so fake a rotation with a squash m_GroupInfoFrame.Set( sGroupBannerPath, arraySongs.GetSize() ); } diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 0e459c0ecd..915bba5b28 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -250,7 +250,7 @@ void ScreenSelectMusic::EasierDifficulty( PlayerNumber p ) { LOG->WriteLine( "ScreenSelectMusic::EasierDifficulty( %d )", p ); - if( !GAME->IsPlayerEnabled(p) ) + if( !GAMEMAN->IsPlayerEnabled(p) ) return; if( m_arrayNotes.GetSize() == 0 ) return; @@ -267,7 +267,7 @@ void ScreenSelectMusic::HarderDifficulty( PlayerNumber p ) { LOG->WriteLine( "ScreenSelectMusic::HarderDifficulty( %d )", p ); - if( !GAME->IsPlayerEnabled(p) ) + if( !GAMEMAN->IsPlayerEnabled(p) ) return; if( m_arrayNotes.GetSize() == 0 ) return; @@ -287,6 +287,9 @@ void ScreenSelectMusic::HandleScreenMessage( const ScreenMessage SM ) switch( SM ) { + case SM_MenuTimer: + MenuStart(PLAYER_1); + break; case SM_GoToPrevState: SCREENMAN->SetNewScreen( new ScreenTitleMenu ); break; @@ -357,7 +360,7 @@ void ScreenSelectMusic::MenuStart( PlayerNumber p ) bool bIsHard = false; for( int p=0; pIsPlayerEnabled( (PlayerNumber)p ) ) + if( !GAMEMAN->IsPlayerEnabled( (PlayerNumber)p ) ) continue; // skip if( SONGMAN->m_pCurNotes[p]->m_iMeter >= 9 ) bIsHard = true; @@ -408,7 +411,7 @@ void ScreenSelectMusic::MenuBack( PlayerNumber p ) void ScreenSelectMusic::AfterNotesChange( PlayerNumber p ) { - if( !GAME->IsPlayerEnabled(p) ) + if( !GAMEMAN->IsPlayerEnabled(p) ) return; m_iSelection[p] = clamp( m_iSelection[p], 0, m_arrayNotes.GetSize()-1 ); // bounds clamping @@ -444,12 +447,12 @@ void ScreenSelectMusic::AfterMusicChange() break; case TYPE_SONG: { - pSong->GetNotessThatMatchGameAndStyle( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, m_arrayNotes ); + pSong->GetNotesThatMatch( GAMEMAN->GetCurrentStyleDef()->m_NotesType, m_arrayNotes ); SortNotesArrayByDifficultyClass( m_arrayNotes ); m_SongInfoFrame.SetFromSong( pSong ); for( int p=0; pIsPlayerEnabled( PlayerNumber(p) ) ) + if( !GAMEMAN->IsPlayerEnabled( PlayerNumber(p) ) ) continue; m_iSelection[p] = clamp( m_iSelection[p], 0, m_arrayNotes.GetSize() ) ; } diff --git a/stepmania/src/ScreenSelectStyle.cpp b/stepmania/src/ScreenSelectStyle.cpp index 05b53fcd07..e54cfef980 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -116,7 +116,7 @@ ScreenSelectStyle::ScreenSelectStyle() { LOG->WriteLine( "ScreenSelectStyle::ScreenSelectStyle()" ); - m_iSelectedStyle = 0; // single + m_iSelection = 0; // single for( int i=0; iStop(); SCREENMAN->SetNewScreen( new ScreenTitleMenu ); @@ -266,7 +269,7 @@ void ScreenSelectStyle::HandleScreenMessage( const ScreenMessage SM ) case SM_UpdateAnimations: for( int i=0; im_sCurrentStyle = DANCE_STYLES[m_iSelectedStyle]; - - if( GAME->m_sCurrentStyle == "single" ) - SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_STYLE_COMMENT_SINGLE) ); - else if( GAME->m_sCurrentStyle == "versus" ) - SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_STYLE_COMMENT_VERSUS) ); - else if( GAME->m_sCurrentStyle == "double" ) - SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_STYLE_COMMENT_DOUBLE) ); - else if( GAME->m_sCurrentStyle == "couple" ) - SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_STYLE_COMMENT_COUPLE) ); - else if( GAME->m_sCurrentStyle == "solo" ) - SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_STYLE_COMMENT_SOLO) ); + GAMEMAN->m_CurStyle = Style( m_iSelection ); + GAMEMAN->m_sMasterPlayerNumber = p; + AnnouncerElement ae; + switch( GAMEMAN->m_CurStyle ) + { + case STYLE_DANCE_SINGLE: ae = ANNOUNCER_SELECT_STYLE_COMMENT_SINGLE; break; + case STYLE_DANCE_VERSUS: ae = ANNOUNCER_SELECT_STYLE_COMMENT_VERSUS; break; + case STYLE_DANCE_DOUBLE: ae = ANNOUNCER_SELECT_STYLE_COMMENT_DOUBLE; break; + case STYLE_DANCE_COUPLE: ae = ANNOUNCER_SELECT_STYLE_COMMENT_COUPLE; break; + case STYLE_DANCE_SOLO: ae = ANNOUNCER_SELECT_STYLE_COMMENT_SOLO; break; + case STYLE_DANCE_SOLO_VERSUS: ae = ANNOUNCER_SELECT_STYLE_COMMENT_VERSUS; break; + case STYLE_PUMP_SINGLE: ae = ANNOUNCER_SELECT_STYLE_COMMENT_SINGLE; break; + case STYLE_PUMP_VERSUS: ae = ANNOUNCER_SELECT_STYLE_COMMENT_VERSUS; break; + default: ASSERT(0); break; // invalid Style + } + SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ae) ); this->ClearMessageQueue(); @@ -343,7 +350,7 @@ void ScreenSelectStyle::MenuBack( PlayerNumber p ) void ScreenSelectStyle::BeforeChange() { - switch( m_iSelectedStyle ) + switch( m_iSelection ) { case 0: m_sprDancer[0].BeginTweening( TWEEN_TIME ); @@ -378,16 +385,16 @@ void ScreenSelectStyle::AfterChange() { this->ClearMessageQueue(); - m_textExplanation1.SetText( TEXT_EXPLANATION1[m_iSelectedStyle] ); + m_textExplanation1.SetText( TEXT_EXPLANATION1[m_iSelection] ); m_textExplanation1.SetZoomX( 0 ); m_textExplanation1.BeginTweening( 0.6f ); m_textExplanation1.SetTweenZoomX( EXPLANATION1_ZOOM_X ); - m_textExplanation2.SetText( TEXT_EXPLANATION2[m_iSelectedStyle] ); + m_textExplanation2.SetText( TEXT_EXPLANATION2[m_iSelection] ); m_textExplanation2.StopTweening(); m_textExplanation2.SetZoomX( 0 ); - switch( m_iSelectedStyle ) + switch( m_iSelection ) { case 0: m_sprPad[0].BeginTweening( TWEEN_TIME ); @@ -498,8 +505,8 @@ void ScreenSelectStyle::TweenOnScreen() m_textExplanation2.SetZoomX( 0 ); m_sprStyleIcon.SetState( 0 ); - m_textExplanation1.SetText( TEXT_EXPLANATION1[m_iSelectedStyle] ); - m_textExplanation2.SetText( TEXT_EXPLANATION2[m_iSelectedStyle] ); + m_textExplanation1.SetText( TEXT_EXPLANATION1[m_iSelection] ); + m_textExplanation2.SetText( TEXT_EXPLANATION2[m_iSelection] ); this->SendScreenMessage( SM_TweenExplanation2, 1 ); this->SendScreenMessage( SM_UpdateAnimations, TWEEN_TIME ); diff --git a/stepmania/src/ScreenSelectStyle.h b/stepmania/src/ScreenSelectStyle.h index ed31f269b2..9058d9d4e5 100644 --- a/stepmania/src/ScreenSelectStyle.h +++ b/stepmania/src/ScreenSelectStyle.h @@ -58,7 +58,7 @@ private: RandomSample m_soundChange; RandomSample m_soundSelect; - int m_iSelectedStyle; + int m_iSelection; TransitionKeepAlive m_Fade; diff --git a/stepmania/src/ScreenSongOptions.cpp b/stepmania/src/ScreenSongOptions.cpp index 70879a1b24..86a1b4eb84 100644 --- a/stepmania/src/ScreenSongOptions.cpp +++ b/stepmania/src/ScreenSongOptions.cpp @@ -58,7 +58,7 @@ ScreenSongOptions::ScreenSongOptions() : void ScreenSongOptions::ImportOptions() { - SongOptions &so = PREFS->m_SongOptions; + SongOptions &so = PREFSMAN->m_SongOptions; m_iSelectedOption[0][SO_FAIL] = so.m_FailType; m_iSelectedOption[0][SO_ASSIST] = so.m_AssistType; @@ -80,13 +80,11 @@ void ScreenSongOptions::ImportOptions() else if( so.m_fMusicRate == 1.0f ) m_iSelectedOption[0][SO_PITCH] = 5; else if( so.m_fMusicRate == 1.5f ) m_iSelectedOption[0][SO_PITCH] = 6; else m_iSelectedOption[0][SO_PITCH] = 3; - - m_iSelectedOption[0][SO_BARS] = so.m_bShowMeasureBars ? 1 : 0; } void ScreenSongOptions::ExportOptions() { - SongOptions &so = PREFS->m_SongOptions; + SongOptions &so = PREFSMAN->m_SongOptions; so.m_FailType = (SongOptions::FailType)m_iSelectedOption[0][SO_FAIL]; so.m_AssistType = (SongOptions::AssistType)m_iSelectedOption[0][SO_ASSIST]; @@ -102,21 +100,6 @@ void ScreenSongOptions::ExportOptions() case 6: so.m_fMusicRate = 1.30f; break; default: ASSERT( false ); } - - switch( m_iSelectedOption[0][SO_PITCH] ) - { - case 0: so.m_fMusicPitch = -1.5f; break; - case 1: so.m_fMusicPitch = -1.0f; break; - case 2: so.m_fMusicPitch = -0.5f; break; - case 3: so.m_fMusicPitch = 0.0f; break; - case 4: so.m_fMusicPitch = 0.5f; break; - case 5: so.m_fMusicPitch = 1.0f; break; - case 6: so.m_fMusicPitch = 1.5f; break; - default: ASSERT( false ); - } - - so.m_bShowMeasureBars = m_iSelectedOption[0][SO_BARS] ? true : false; - } void ScreenSongOptions::GoToPrevState() diff --git a/stepmania/src/ScreenStage.cpp b/stepmania/src/ScreenStage.cpp index e9327febfd..f1440d61a6 100644 --- a/stepmania/src/ScreenStage.cpp +++ b/stepmania/src/ScreenStage.cpp @@ -48,10 +48,10 @@ ScreenStage::ScreenStage( bool bTryExtraStage ) } else // !bTryExtraStage { - int iStageNo = PREFS->GetStageNumber(); - bool bFinal = PREFS->IsFinalStage(); + int iStageNo = PREFSMAN->GetStageNumber(); + bool bFinal = PREFSMAN->IsFinalStage(); - CString sStagePrefix = PREFS->GetStageText(); + CString sStagePrefix = PREFSMAN->GetStageText(); m_ptextStage->SetText( sStagePrefix + " Stage" ); m_ptextStage->SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); @@ -74,7 +74,7 @@ ScreenStage::ScreenStage( bool bTryExtraStage ) m_ptextStage->SetZoomX( 2 ); m_ptextStage->SetZoomY( 0 ); m_ptextStage->BeginTweeningQueued( 0.6f ); // sleep - m_ptextStage->BeginTweeningQueued( 0.5f ); // sleep + m_ptextStage->BeginTweeningQueued( 0.3f ); // sleep m_ptextStage->SetTweenZoom( 2 ); m_ptextStage->SetTweenXY( CENTER_X, CENTER_Y ); this->AddActor( m_ptextStage ); @@ -88,7 +88,7 @@ ScreenStage::ScreenStage( bool bTryExtraStage ) m_psprUnderscore->BeginTweeningQueued( 0.4f ); // open float fDestZoom = m_ptextStage->GetWidestLineWidthInSourcePixels() * m_ptextStage->GetZoomX() / m_psprUnderscore->GetUnzoomedWidth(); m_psprUnderscore->SetTweenZoomX( fDestZoom ); - m_psprUnderscore->BeginTweeningQueued( 0.1f ); // sleep + m_psprUnderscore->BeginTweeningQueued( 0.3f ); // sleep m_psprUnderscore->BeginTweeningQueued( 0.4f ); // close m_psprUnderscore->SetTweenZoomX( 0 ); this->AddActor( m_psprUnderscore ); diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index 0b53058a1f..c481d2bca9 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -14,7 +14,6 @@ #include "ScreenCaution.h" #include "ScreenMapInstruments.h" #include "ScreenGameOptions.h" -#include "ScreenGraphicOptions.h" #include "ScreenSynchronizeMenu.h" #include "ScreenEdit.h" #include "GameConstantsAndTypes.h" @@ -27,6 +26,7 @@ #include "RageLog.h" #include "SongManager.h" #include "AnnouncerManager.h" +#include "ErrorCatcher/ErrorCatcher.h" // @@ -38,17 +38,16 @@ const CString CHOICE_TEXT[ScreenTitleMenu::NUM_TITLE_MENU_CHOICES] = { "NONSTOP MODE", "ENDLESS MODE", "ONI MODE", - "SELECT GAME", - "MAP INSTRUMENTS", + "SWITCH GAME", + "CONFIG INSTRUMENTS", "GAME OPTIONS", - "GRAPHIC OPTIONS", "SYNCHRONIZE", "EDIT/RECORD", "EXIT", }; const float CHOICES_START_Y = 52; -const float CHOICES_GAP_Y = 34; +const float CHOICES_GAP_Y = 38; const float HELP_X = CENTER_X; const float HELP_Y = SCREEN_HEIGHT-55; @@ -60,7 +59,6 @@ const ScreenMessage SM_GoToSelectStyle = ScreenMessage(SM_User+3); const ScreenMessage SM_GoToSelectGame = ScreenMessage(SM_User+4); const ScreenMessage SM_GoToMapInstruments = ScreenMessage(SM_User+5); const ScreenMessage SM_GoToGameOptions = ScreenMessage(SM_User+6); -const ScreenMessage SM_GoToGraphicOptions = ScreenMessage(SM_User+7); const ScreenMessage SM_GoToSynchronize = ScreenMessage(SM_User+9); const ScreenMessage SM_GoToEdit = ScreenMessage(SM_User+10); const ScreenMessage SM_DoneOpening = ScreenMessage(SM_User+11); @@ -188,7 +186,7 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM ) switch( SM ) { case SM_DoneOpening: - if( PREFS->m_GameOptions.m_bAnnouncer ) + if( PREFSMAN->m_bAnnouncer ) m_soundTitle.PlayRandom(); break; case SM_PlayAttract: @@ -209,9 +207,6 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM ) case SM_GoToGameOptions: SCREENMAN->SetNewScreen( new ScreenGameOptions ); break; - case SM_GoToGraphicOptions: - SCREENMAN->SetNewScreen( new ScreenGraphicOptions ); - break; case SM_GoToSynchronize: SCREENMAN->SetNewScreen( new ScreenSynchronizeMenu ); break; @@ -275,10 +270,7 @@ void ScreenTitleMenu::MenuStart( PlayerNumber p ) { case CHOICE_GAME_MODE: m_soundSelect.PlayRandom(); - if( PREFS->m_GameOptions.m_bShowCaution ) - m_Fade.CloseWipingRight( SM_GoToCaution ); - else - m_Fade.CloseWipingRight( SM_GoToSelectStyle ); + m_Fade.CloseWipingRight( SM_GoToCaution ); return; case CHOICE_SELECT_GAME: m_soundSelect.PlayRandom(); @@ -292,10 +284,6 @@ void ScreenTitleMenu::MenuStart( PlayerNumber p ) m_soundSelect.PlayRandom(); m_Fade.CloseWipingRight( SM_GoToGameOptions ); return; - case CHOICE_GRAPHIC_OPTIONS: - m_soundSelect.PlayRandom(); - m_Fade.CloseWipingRight( SM_GoToGraphicOptions ); - return; case CHOICE_SYNCHRONIZE: m_soundSelect.PlayRandom(); m_Fade.CloseWipingRight( SM_GoToSynchronize ); @@ -311,13 +299,13 @@ void ScreenTitleMenu::MenuStart( PlayerNumber p ) return; /* case CHOICE_HELP: m_soundSelect.PlayRandom(); - PREFS->m_bWindowed = false; + PREFSMAN->m_bWindowed = false; ApplyGraphicOptions(); GotoURL( "Docs/index.htm" ); return; case CHOICE_CHECK_FOR_UPDATE: m_soundSelect.PlayRandom(); - PREFS->m_bWindowed = false; + PREFSMAN->m_bWindowed = false; ApplyGraphicOptions(); GotoURL( "http://www.stepmania.com" ); return; diff --git a/stepmania/src/ScreenTitleMenu.h b/stepmania/src/ScreenTitleMenu.h index 671d288b69..959a53e71b 100644 --- a/stepmania/src/ScreenTitleMenu.h +++ b/stepmania/src/ScreenTitleMenu.h @@ -35,7 +35,6 @@ public: CHOICE_SELECT_GAME, CHOICE_MAP_INSTRUMENTS, CHOICE_GAME_OPTIONS, - CHOICE_GRAPHIC_OPTIONS, CHOICE_SYNCHRONIZE, CHOICE_EDIT, CHOICE_EXIT, diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index c2f549fe0a..5f6ab65d71 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -197,7 +197,7 @@ void Song::GetMainAndSubTitlesFromFullTitle( CString sFullTitle, CString &sMainT CString Song::GetCacheFilePath() { ULONG hash = GetHashForString( m_sSongDir ); - return ssprintf( "Cache\\%u", hash ); + return ssprintf( "Cache\\%u.song", hash ); } bool Song::LoadFromSongDir( CString sDir ) @@ -914,23 +914,15 @@ void Song::TidyUpData() } -void Song::GetNotessThatMatchGameAndStyle( CString sGame, CString sStyle, CArray& arrayAddTo ) +void Song::GetNotesThatMatch( NotesType nt, CArray& arrayAddTo ) { for( int i=0; im_sIntendedGame && - ( sStyle == pCurNotes->m_sIntendedStyle || (sStyle == "versus" && pCurNotes->m_sIntendedStyle == "single") ) ) - { - arrayAddTo.Add( pCurNotes ); - } - } - + if( m_arrayNotes[i].m_NotesType == nt ) + arrayAddTo.Add( &m_arrayNotes[i] ); } -const int FILE_CACHE_VERSION = 9; // increment this when the cache file format changes +const int FILE_CACHE_VERSION = 10; // increment this when the cache file format changes void Song::SaveToCacheFile() { @@ -1173,10 +1165,10 @@ void Song::SaveToSMDir() } -Grade Song::GetGradeForDifficultyClass( CString sGame, CString sStyle, DifficultyClass dc ) +Grade Song::GetGradeForDifficultyClass( NotesType nt, DifficultyClass dc ) { CArray arrayNotess; - this->GetNotessThatMatchGameAndStyle( sGame, sStyle, arrayNotess ); + this->GetNotesThatMatch( nt, arrayNotess ); SortNotesArrayByDifficultyClass( arrayNotess ); for( int i=0; i #include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" +#include "PrefsManager.h" Sprite::Sprite() @@ -191,7 +192,12 @@ void Sprite::Update( float fDeltaTime ) void Sprite::DrawPrimitives() { - DISPLAY->TranslateLocal( -0.5f, -0.5f, 0 ); // offset so that pixels are aligned to texels + // offset so that pixels are aligned to texels + if( PREFSMAN->m_bHighDetail ) // 640x480 + DISPLAY->TranslateLocal( -0.5f, -0.5f, 0 ); + else // 320x240 + DISPLAY->TranslateLocal( -0.5f, -0.5f, 0 ); +// DISPLAY->TranslateLocal( -1, -1, 0 ); // offset so that pixels are aligned to texels if( m_pTexture == NULL ) return; diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index cda2ec517d..798fd7270d 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -47,6 +47,7 @@ #include "ScreenPlayerOptions.h" #include "ScreenMusicScroll.h" #include "ScreenSelectMusic.h" +#include "ScreenGameplay.h" // error catcher stuff #include "ErrorCatcher/ErrorCatcher.h" @@ -106,6 +107,7 @@ VOID DestroyObjects(); // deallocate game objects when we're done with them void ApplyGraphicOptions(); // Set the display mode according to the user's preferences + //----------------------------------------------------------------------------- // Name: WinMain() // Desc: Application entry point @@ -186,17 +188,15 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow ) ShowWindow( g_hWndMain, SW_HIDE ); - -#ifdef DEBUG -#define BCATCHERRORS false + // Don't catch errors if we're running in the debugger. This way, the debugger + // will give us a nice stack trace. +#ifdef _DEBUG + #define bCatchErrors false #else -#define BCATCHERRORS true + #define bCatchErrors true #endif - - bool bSuccess = RunAndCatchErrors( MainLoop, BCATCHERRORS ); - - + bool bSuccess = RunAndCatchErrors( MainLoop, bCatchErrors ); @@ -279,6 +279,7 @@ BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) CString sMessage = ssprintf("%s", GetError() ); if( GetErrorHr() != 0 ) sMessage += ssprintf(" ('%d - %s)'", GetErrorHr(), DXGetErrorString8(GetErrorHr()) ); + sMessage += ssprintf("\n\nStack Trace: (PDB file required for function names)", GetStackTrace() ); sMessage += ssprintf("\n\n%s", GetStackTrace() ); sMessage.Replace( "\n", "\r\n" ); SendDlgItemMessage( @@ -415,14 +416,13 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) switch( LOWORD(wParam) ) { case IDM_TOGGLEFULLSCREEN: - PREFS->m_bWindowed = !PREFS->m_bWindowed; + PREFSMAN->m_WindowMode = PrefsManager::WindowMode( PREFSMAN->m_WindowMode+1 ); + if( PREFSMAN->m_WindowMode >= PrefsManager::NUM_WINDOW_MODES ) + PREFSMAN->m_WindowMode = PrefsManager::WindowMode( 0 ); ApplyGraphicOptions(); return 0; case IDM_CHANGEDETAIL: - if( PREFS->m_GraphicProfile == PROFILE_LOW ) - PREFS->m_GraphicProfile = PROFILE_MEDIUM; - else - PREFS->m_GraphicProfile = PROFILE_LOW; + PREFSMAN->m_bHighDetail = !PREFSMAN->m_bHighDetail; ApplyGraphicOptions(); return 0; case IDM_EXIT: @@ -496,10 +496,10 @@ HRESULT CreateObjects( HWND hWnd ) SOUND = new RageSound( hWnd ); MUSIC = new RageSoundStream; INPUTMAN= new RageInput( hWnd ); - PREFS = new PrefsManager; + PREFSMAN = new PrefsManager; DISPLAY = new RageDisplay( hWnd ); SONGMAN = new SongManager; // this takes a long time to load - GAME = new GameManager; + GAMEMAN = new GameManager; THEME = new ThemeManager; ANNOUNCER = new AnnouncerManager; INPUTFILTER = new InputFilter(); @@ -526,9 +526,10 @@ HRESULT CreateObjects( HWND hWnd ) //SCREENMAN->SetNewScreen( new ScreenSandbox ); //SCREENMAN->SetNewScreen( new ScreenResults ); //SCREENMAN->SetNewScreen( new ScreenPlayerOptions ); - SCREENMAN->SetNewScreen( new ScreenTitleMenu ); + //SCREENMAN->SetNewScreen( new ScreenTitleMenu ); + //SCREENMAN->SetNewScreen( new ScreenGameplay ); //SCREENMAN->SetNewScreen( new ScreenMusicScroll ); - //SCREENMAN->SetNewScreen( new ScreenSelectMusic ); + SCREENMAN->SetNewScreen( new ScreenSelectMusic ); //SCREENMAN->SetNewScreen( new ScreenSelectGroup ); @@ -554,10 +555,10 @@ void DestroyObjects() SAFE_DELETE( INPUTFILTER ); SAFE_DELETE( ANNOUNCER ); SAFE_DELETE( THEME ); - SAFE_DELETE( GAME ); + SAFE_DELETE( GAMEMAN ); SAFE_DELETE( SONGMAN ); SAFE_DELETE( DISPLAY ); - SAFE_DELETE( PREFS ); + SAFE_DELETE( PREFSMAN ); SAFE_DELETE( INPUTMAN ); SAFE_DELETE( MUSIC ); SAFE_DELETE( SOUND ); @@ -755,39 +756,39 @@ void ApplyGraphicOptions() { InvalidateObjects(); - GraphicProfileOptions *pGPO = PREFS->GetCurrentGraphicProfileOptions(); - - bool bWindowed = PREFS->m_bWindowed; - CString sProfileName = pGPO->m_szProfileName; - DWORD dwWidth = pGPO->m_iWidth; - DWORD dwHeight = pGPO->m_iHeight; - DWORD dwDisplayBPP = pGPO->m_iDisplayColor; - DWORD dwTextureBPP = pGPO->m_iTextureColor; - DWORD dwMaxTextureSize = pGPO->m_iMaxTextureSize; - DWORD dwFlags = 0; // not used anymore + bool bWindowed = PREFSMAN->m_WindowMode != PrefsManager::WINDOW_MODE_FULLSCREEN; + bool bMaximized = PREFSMAN->m_WindowMode == PrefsManager::WINDOW_MODE_MAXIMIZED; + CString sProfileName = PREFSMAN->m_bHighDetail ? "High Detail" : "Low Detail"; + DWORD dwWidth = PREFSMAN->m_bHighDetail ? 640 : 320; + DWORD dwHeight = PREFSMAN->m_bHighDetail ? 480 : 240; + DWORD dwDisplayBPP = PREFSMAN->m_bHighDetail ? 16 : 16; + DWORD dwTextureBPP = PREFSMAN->m_bHighDetail ? 16 : 16; + DWORD dwMaxTextureSize = PREFSMAN->m_bHighDetail ? + (PREFSMAN->m_bHighTextureDetail ? 1024 : 512) : + (PREFSMAN->m_bHighTextureDetail ? 512 : 256); // // If the requested resolution doesn't work, keep switching until we find one that does. // - if( !DISPLAY->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) + if( !DISPLAY->SwitchDisplayMode(bWindowed, dwWidth, dwHeight, dwDisplayBPP) ) { // We failed. Try full screen with same params. bWindowed = false; - if( !DISPLAY->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) + if( !DISPLAY->SwitchDisplayMode(bWindowed, dwWidth, dwHeight, dwDisplayBPP) ) { // Failed again. Try 16 BPP dwDisplayBPP = 16; - if( !DISPLAY->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) + if( !DISPLAY->SwitchDisplayMode(bWindowed, dwWidth, dwHeight, dwDisplayBPP) ) { // Failed again. Try 640x480 dwWidth = 640; dwHeight = 480; - if( !DISPLAY->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) + if( !DISPLAY->SwitchDisplayMode(bWindowed, dwWidth, dwHeight, dwDisplayBPP) ) { // Failed again. Try 320x240 dwWidth = 320; dwHeight = 240; - if( !DISPLAY->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) + if( !DISPLAY->SwitchDisplayMode(bWindowed, dwWidth, dwHeight, dwDisplayBPP) ) { FatalError( "Tried every possible display mode, and couldn't find one that works." ); } @@ -804,14 +805,11 @@ void ApplyGraphicOptions() RestoreObjects(); - PREFS->SavePrefsToDisk(); + PREFSMAN->SavePrefsToDisk(); if( SCREENMAN ) { CString sMessage = ssprintf("%s - %s detail", bWindowed ? "Windowed" : "FullScreen", sProfileName ); - if( PREFS->m_GraphicProfile == PROFILE_CUSTOM ) - sMessage += ssprintf(" - %ux%u - %u color, %u texture", dwWidth, dwHeight, dwDisplayBPP, dwTextureBPP); - SCREENMAN->SystemMessage( sMessage ); } } diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 134dcb3676..1b24481c35 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -39,21 +39,21 @@ RSC=rc.exe # PROP Use_MFC 1 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "../" -# PROP Intermediate_Dir "../Release" +# PROP Intermediate_Dir "../Release-StackTrace" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo -# ADD BSC32 /nologo +# ADD BSC32 /nologo /o"../StepMania-StackTrace.bsc" LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /out:"../StepMania-StackTrace.exe" !ELSEIF "$(CFG)" == "StepMania - Win32 Debug" @@ -200,7 +200,7 @@ SOURCE=.\Font.h # End Source File # Begin Source File -SOURCE=.\GameConstants.h +SOURCE=.\GameConstantsAndTypes.h # End Source File # Begin Source File @@ -504,6 +504,14 @@ SOURCE=.\CroppedSprite.h # End Source File # Begin Source File +SOURCE=.\DifficultyBanner.cpp +# End Source File +# Begin Source File + +SOURCE=.\DifficultyBanner.h +# End Source File +# Begin Source File + SOURCE=.\DifficultyIcon.cpp # End Source File # Begin Source File @@ -560,6 +568,14 @@ SOURCE=.\MenuElements.h # End Source File # Begin Source File +SOURCE=.\MenuTimer.cpp +# End Source File +# Begin Source File + +SOURCE=.\MenuTimer.h +# End Source File +# Begin Source File + SOURCE=.\MusicSortDisplay.cpp # End Source File # Begin Source File @@ -932,14 +948,6 @@ SOURCE=.\ScreenSelectGroup.h # End Source File # Begin Source File -SOURCE=.\ScreenSelectMode.cpp -# End Source File -# Begin Source File - -SOURCE=.\ScreenSelectMode.h -# End Source File -# Begin Source File - SOURCE=.\ScreenSelectMusic.cpp # End Source File # Begin Source File @@ -1000,11 +1008,11 @@ SOURCE=.\ScreenTitleMenu.h # PROP Default_Filter "" # Begin Source File -SOURCE=.\AnnoncerManager.cpp +SOURCE=.\AnnouncerManager.cpp # End Source File # Begin Source File -SOURCE=.\AnnoncerManager.h +SOURCE=.\AnnouncerManager.h # End Source File # Begin Source File diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 3b74b80d4d..7db2792f41 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -102,7 +102,7 @@ BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="TRUE" - DebugInformationFormat="0"/> + DebugInformationFormat="3"/> + + + + - - - - @@ -511,6 +511,12 @@ + + + + @@ -553,6 +559,12 @@ + + + + @@ -597,7 +609,7 @@ @@ -677,6 +689,9 @@ + + diff --git a/stepmania/src/StyleDef.cpp b/stepmania/src/StyleDef.cpp index f85de15728..f702029a9f 100644 --- a/stepmania/src/StyleDef.cpp +++ b/stepmania/src/StyleDef.cpp @@ -17,141 +17,13 @@ #include "IniFile.h" -StyleDef::StyleDef( GameDef* pGameDef, CString sStyleFilePath ) -{ - LOG->WriteLine( "StyleDef::StyleDef( '%s )", sStyleFilePath ); - - // extract the game name - CString sThrowAway; - splitrelpath( sStyleFilePath, sThrowAway, m_sName, sThrowAway ); - - - // - // Parse the .style definition file - // - IniFile ini; - ini.SetPath( sStyleFilePath ); - if( !ini.ReadFile() ) - FatalError( "Error reading style definition file '%s'.", sStyleFilePath ); - - CString sStyleName; - ini.GetValue( "Style", "Name", sStyleName ); - if( sStyleName != m_sName ) - FatalError( "Style name in '%s' doesn't match the file name.", sStyleFilePath ); - - ini.GetValue( "Style", "Name", m_sDescription ); - if( m_sDescription == "" ) - FatalError( "Invalid value for Description in '%s'.", sStyleFilePath ); - - ini.GetValue( "Style", "ReadsTag", m_sReadsTag ); - if( m_sReadsTag == "" ) - FatalError( "Invalid value for ReadsTag in '%s'.", sStyleFilePath ); - - ini.GetValueI( "Style", "NumPlayers", m_iNumPlayers ); - if( m_iNumPlayers < 1 || m_iNumPlayers > 2 ) - FatalError( "Invalid value for NumPlayers in '%s'.", sStyleFilePath ); - - ini.GetValueI( "Style", "ColsPerPlayer", m_iColsPerPlayer ); - if( m_iColsPerPlayer < 1 || m_iColsPerPlayer > MAX_COLS_PER_PLAYER ) - FatalError( "Invalid value for ColsPerPlayer in '%s'.", sStyleFilePath ); - - - for( int p=0; pm_iButtonsPerInstrument; b++ ) - if( 0 != sColumnInfo.Replace( pGameDef->m_sButtonNames[b], ssprintf("%d",b) ) ) // replace was successful - break; - if( b == pGameDef->m_iButtonsPerInstrument ) // we didn't replace anything - FatalError( "Invalid button name in ColumnInfo in '%s': '%s'.", sStyleFilePath, sColumnInfo ); - - - CStringArray arrayColumnInfo; - split( sColumnInfo, ",", arrayColumnInfo ); - if( arrayColumnInfo.GetSize() != 4 ) - FatalError( "Invalid ColumnInfo string in '%s'.", sStyleFilePath ); - - - colInfo.track = atoi( arrayColumnInfo[0] ); - colInfo.number = (InstrumentNumber)atoi( arrayColumnInfo[1] ); - colInfo.button = (InstrumentButton)atoi( arrayColumnInfo[2] ); - colInfo.iX = atoi( arrayColumnInfo[3] ); - } - } - ini.GetValueI( "Style", "ColsPerPlayer", m_iColsPerPlayer ); - if( m_iColsPerPlayer < 1 || m_iColsPerPlayer > MAX_COLS_PER_PLAYER ) - FatalError( "Invalid value for ColsPerPlayer in '%s'.", sStyleFilePath ); - - - - CString sColDrawOrder; - ini.GetValue( "Style", "ColDrawOrder", sColDrawOrder ); // should look like "COL01,COL02,COL03,COL04" - - // replace the constants with their corresponding integer literals - sColDrawOrder.Replace( "COL01", "0" ); - sColDrawOrder.Replace( "COL02", "1" ); - sColDrawOrder.Replace( "COL03", "2" ); - sColDrawOrder.Replace( "COL04", "3" ); - sColDrawOrder.Replace( "COL05", "4" ); - sColDrawOrder.Replace( "COL06", "5" ); - sColDrawOrder.Replace( "COL07", "6" ); - sColDrawOrder.Replace( "COL08", "7" ); - sColDrawOrder.Replace( "COL09", "8" ); - sColDrawOrder.Replace( "COL00", "9" ); - sColDrawOrder.Replace( "COL11", "10" ); - sColDrawOrder.Replace( "COL12", "11" ); - sColDrawOrder.Replace( "COL13", "12" ); - sColDrawOrder.Replace( "COL14", "13" ); - sColDrawOrder.Replace( "COL15", "14" ); - sColDrawOrder.Replace( "COL16", "15" ); - - CStringArray arrayColDrawOrder; - split( sColDrawOrder, ",", arrayColDrawOrder ); - if( arrayColDrawOrder.GetSize() != m_iColsPerPlayer ) - FatalError( "Invalid number of columns in ColDrawOrder in '%s'.", sStyleFilePath ); - - for( int c=0; c& arrayAddTo ); + void GetNotesThatMatch( NotesType nt, CArray& arrayAddTo ); int GetNumTimesPlayed() { @@ -114,7 +114,7 @@ public: bool HasChangedSinceLastSave() { return m_bChangedSinceSave; } void SetChangedSinceLastSave() { m_bChangedSinceSave = true; } - Grade GetGradeForDifficultyClass( CString sGame, CString sStyle, DifficultyClass dc ); + Grade GetGradeForDifficultyClass( NotesType nt, DifficultyClass dc ); private: