diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 4d2da7dc21..ef177bf6e3 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -38,7 +38,7 @@ Actor::Actor() m_fVibrationDistance = 5.0f; m_bVisibleThisFrame = FALSE; - m_bShadow = true; + m_bShadow = false; m_fShadowLength = 4; m_bBlendAdd = false; @@ -140,7 +140,7 @@ void Actor::Draw() // set the world matrix and calculate actor properties, the void Actor::Update( float fDeltaTime ) { -// HELPER.Log( "Actor::Update( %f )", fDeltaTime ); +// LOG->WriteLine( "Actor::Update( %f )", fDeltaTime ); // update effect switch( m_Effect ) @@ -165,7 +165,7 @@ void Actor::Update( float fDeltaTime ) m_bTweeningTowardEndColor = TRUE; } } - //HELPER.Log( "Actor::m_fPercentBetweenColors %f", m_fPercentBetweenColors ); + //LOG->WriteLine( "Actor::m_fPercentBetweenColors %f", m_fPercentBetweenColors ); break; case wagging: m_fWagTimer += fDeltaTime; diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index 5e13d8cded..a4bfcee65e 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -23,7 +23,7 @@ void ActorFrame::RenderPrimitives() void ActorFrame::Update( float fDeltaTime ) { -// HELPER.Log( "ActorFrame::Update( %f )", fDeltaTime ); +// LOG->WriteLine( "ActorFrame::Update( %f )", fDeltaTime ); Actor::Update( fDeltaTime ); diff --git a/stepmania/src/ArrowEffects.cpp b/stepmania/src/ArrowEffects.cpp index d16562d318..97e6ec110b 100644 --- a/stepmania/src/ArrowEffects.cpp +++ b/stepmania/src/ArrowEffects.cpp @@ -12,7 +12,7 @@ #include "ArrowEffects.h" #include "NoteMetadata.h" #include "ColorNote.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "GameManager.h" diff --git a/stepmania/src/ArrowEffects.h b/stepmania/src/ArrowEffects.h index c132c3d84d..e6a8c4c1d5 100644 --- a/stepmania/src/ArrowEffects.h +++ b/stepmania/src/ArrowEffects.h @@ -13,7 +13,7 @@ #define _ArrowEffects_H_ -#include "GameTypes.h" +#include "GameConstantsAndTypes.h" #include "StyleDef.h" diff --git a/stepmania/src/BPMDisplay.cpp b/stepmania/src/BPMDisplay.cpp index da87e39156..c1ad6cb2bc 100644 --- a/stepmania/src/BPMDisplay.cpp +++ b/stepmania/src/BPMDisplay.cpp @@ -11,7 +11,7 @@ #include "BPMDisplay.h" #include "RageUtil.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "ThemeManager.h" diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index dd64dc7b2d..9755fd4789 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -11,7 +11,7 @@ #include "Background.h" #include "RageUtil.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "ThemeManager.h" #include "PrefsManager.h" #include "RageBitmapTexture.h" diff --git a/stepmania/src/Banner.h b/stepmania/src/Banner.h index ef81b3e44e..9ca4be791c 100644 --- a/stepmania/src/Banner.h +++ b/stepmania/src/Banner.h @@ -6,6 +6,7 @@ Desc: The song's banner displayed in SelectSong. Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/BannerWithFrame.cpp b/stepmania/src/BannerWithFrame.cpp new file mode 100644 index 0000000000..9f79c8f23f --- /dev/null +++ b/stepmania/src/BannerWithFrame.cpp @@ -0,0 +1,33 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: BannerWithFrame + + Desc: See header. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "BannerWithFrame.h" +#include "RageUtil.h" +#include "GameConstantsAndTypes.h" +#include "ThemeManager.h" +#include "RageLog.h" + + + +BannerWithFrame::BannerWithFrame() +{ + m_sprBannerFrame.Load( THEME->GetPathTo(GRAPHIC_RESULTS_BANNER_FRAME) ); + m_Banner.SetCroppedSize( m_sprBannerFrame.GetUnzoomedWidth()-6, m_sprBannerFrame.GetUnzoomedHeight()-6 ); + + this->AddActor( &m_Banner ); + this->AddActor( &m_sprBannerFrame ); +} + +void BannerWithFrame::LoadFromSong( Song* pSong ) +{ + m_Banner.LoadFromSong( pSong ); +} diff --git a/stepmania/src/BannerWithFrame.h b/stepmania/src/BannerWithFrame.h new file mode 100644 index 0000000000..1b3dcf94f0 --- /dev/null +++ b/stepmania/src/BannerWithFrame.h @@ -0,0 +1,29 @@ +#pragma once +/* +----------------------------------------------------------------------------- + Class: BannerWithFrame + + Desc: bonus meters and max combo number. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ActorFrame.h" +#include "Sprite.h" +#include "Banner.h" + + +class BannerWithFrame : public ActorFrame +{ +public: + BannerWithFrame(); + + void LoadFromSong( Song* pSong ); + +protected: + + Sprite m_sprBannerFrame; + Banner m_Banner; +}; diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index 6f6b2841b1..552da7ec7e 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -13,9 +13,8 @@ #include "BitmapText.h" #include "IniFile.h" #include "FontManager.h" -#include "RageHelper.h" +#include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" -#include "PrefsManager.h" D3DXCOLOR RAINBOW_COLORS[] = { @@ -35,9 +34,6 @@ BitmapText::BitmapText() m_HorizAlign = align_center; m_VertAlign = align_middle; - m_fShadowLength = 2; - - m_pFont = NULL; m_iNumLines = 0; @@ -51,6 +47,8 @@ BitmapText::BitmapText() m_iLineWidths[i] = 1; } + m_bShadow = true; + m_bRainbow = false; } @@ -62,7 +60,7 @@ BitmapText::~BitmapText() bool BitmapText::Load( const CString &sFontFilePath ) { - HELPER.Log( "BitmapText::LoadFromFontName(%s)", sFontFilePath ); + LOG->WriteLine( "BitmapText::LoadFromFontName(%s)", sFontFilePath ); // load font m_pFont = FONT->LoadFont( sFontFilePath ); @@ -75,7 +73,7 @@ bool BitmapText::Load( const CString &sFontFilePath ) void BitmapText::SetText( CString sText ) { - //HELPER.Log( "BitmapText::SetText()" ); + //LOG->WriteLine( "BitmapText::SetText()" ); if( m_pFont->m_bCapitalsOnly ) sText.MakeUpper(); @@ -134,7 +132,7 @@ void BitmapText::SetText( CString sText ) void BitmapText::RebuildVertexBuffer() { - //HELPER.Log( "BitmapText::RebuildVertexBuffer()" ); + //LOG->WriteLine( "BitmapText::RebuildVertexBuffer()" ); @@ -287,7 +285,7 @@ void BitmapText::RenderPrimitives() ////////////////////// // render the shadow ////////////////////// - if( m_bShadow && PREFS && PREFS->GetCurrentGraphicProfileOptions()->m_bShadows ) + if( m_bShadow ) { SCREEN->PushMatrix(); SCREEN->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units diff --git a/stepmania/src/CroppedSprite.h b/stepmania/src/CroppedSprite.h index ba68a2cf42..0a3efe813d 100644 --- a/stepmania/src/CroppedSprite.h +++ b/stepmania/src/CroppedSprite.h @@ -32,9 +32,15 @@ public: return true; } - void CropToSize( float fHeight, float fWidth ); + void SetCroppedSize( float fWidth, float fHeight ) + { + m_fCropWidth = fWidth; + m_fCropHeight = fHeight; + } protected: + void CropToSize( float fWidth, float fHeight ); + float m_fCropWidth, m_fCropHeight; }; diff --git a/stepmania/src/DifficultyIcon.cpp b/stepmania/src/DifficultyIcon.cpp index e8e57a94b9..2d580ef404 100644 --- a/stepmania/src/DifficultyIcon.cpp +++ b/stepmania/src/DifficultyIcon.cpp @@ -11,7 +11,7 @@ #include "DifficultyIcon.h" #include "RageUtil.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "ThemeManager.h" diff --git a/stepmania/src/Font.cpp b/stepmania/src/Font.cpp index 9f8b142614..de473ce0a7 100644 --- a/stepmania/src/Font.cpp +++ b/stepmania/src/Font.cpp @@ -15,13 +15,13 @@ #include #include "RageTextureManager.h" #include "RageUtil.h" -#include "RageHelper.h" +#include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" Font::Font( const CString &sFontFilePath ) { - //HELPER.Log( "Font::LoadFromFontName(%s)", sFontFilePath ); + //LOG->WriteLine( "Font::LoadFromFontName(%s)", sFontFilePath ); for( int i=0; im_iRefCount ); + LOG->WriteLine( "FONT LEAK: '%s', RefCount = %d.", sFontFilePath, pFont->m_iRefCount ); SAFE_DELETE( pFont ); } @@ -53,7 +53,7 @@ Font* FontManager::LoadFont( CString sFontFilePath ) { sFontFilePath.MakeLower(); -// HELPER.Log( "FontManager::LoadFont(%s).", sFontFilePath ); +// LOG->WriteLine( "FontManager::LoadFont(%s).", sFontFilePath ); // Convert the path to lowercase so that we don't load duplicates. @@ -65,7 +65,7 @@ Font* FontManager::LoadFont( CString sFontFilePath ) if( m_mapPathToFont.Lookup( sFontFilePath, pFont ) ) // if the texture already exists in the map { - HELPER.Log( ssprintf("FontManager: The Font '%s' now has %d references.", sFontFilePath, pFont->m_iRefCount) ); + LOG->WriteLine( ssprintf("FontManager: The Font '%s' now has %d references.", sFontFilePath, pFont->m_iRefCount) ); pFont->m_iRefCount++; } else // the texture is not already loaded @@ -75,7 +75,7 @@ Font* FontManager::LoadFont( CString sFontFilePath ) pFont = (Font*) new Font( sFontFilePath ); - HELPER.Log( "FontManager: Loading '%s' from disk.", sFontFilePath); + LOG->WriteLine( "FontManager: Loading '%s' from disk.", sFontFilePath); m_mapPathToFont.SetAt( sFontFilePath, pFont ); } @@ -100,11 +100,11 @@ void FontManager::UnloadFont( CString sFontFilePath ) { sFontFilePath.MakeLower(); -// HELPER.Log( "FontManager::UnloadTexture(%s).", sFontFilePath ); +// LOG->WriteLine( "FontManager::UnloadTexture(%s).", sFontFilePath ); if( sFontFilePath == "" ) { - HELPER.Log( "FontManager::UnloadTexture(): tried to Unload a blank" ); + LOG->WriteLine( "FontManager::UnloadTexture(): tried to Unload a blank" ); return; } @@ -115,13 +115,13 @@ void FontManager::UnloadFont( CString sFontFilePath ) pFont->m_iRefCount--; if( pFont->m_iRefCount == 0 ) // there are no more references to this texture { - HELPER.Log( ssprintf("FontManager: '%s' will be deleted. It has %d references.", sFontFilePath, pFont->m_iRefCount) ); + LOG->WriteLine( ssprintf("FontManager: '%s' will be deleted. It has %d references.", sFontFilePath, pFont->m_iRefCount) ); SAFE_DELETE( pFont ); // free the texture m_mapPathToFont.RemoveKey( sFontFilePath ); // and remove the key in the map } else { - HELPER.Log( ssprintf("FontManager: '%s' will not be deleted. It still has %d references.", sFontFilePath, pFont->m_iRefCount) ); + LOG->WriteLine( ssprintf("FontManager: '%s' will not be deleted. It still has %d references.", sFontFilePath, pFont->m_iRefCount) ); } } diff --git a/stepmania/src/FootMeter.cpp b/stepmania/src/FootMeter.cpp index 0897b828d2..e737e20502 100644 --- a/stepmania/src/FootMeter.cpp +++ b/stepmania/src/FootMeter.cpp @@ -11,7 +11,7 @@ #include "FootMeter.h" #include "RageUtil.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "ThemeManager.h" diff --git a/stepmania/src/GameConstantsAndTypes.h b/stepmania/src/GameConstantsAndTypes.h new file mode 100644 index 0000000000..66e3fcfbad --- /dev/null +++ b/stepmania/src/GameConstantsAndTypes.h @@ -0,0 +1,280 @@ +#pragma once +/* +----------------------------------------------------------------------------- + File: GameConstantsAndTypes.h + + Desc: These things don't change very often. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + + +#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 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; + + +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_MEASURE = ELEMENTS_PER_BEAT * BEATS_PER_MEASURE; +const int MAX_TAP_NOTE_ELEMENTS = MAX_BEATS*ELEMENTS_PER_BEAT; + +const int MAX_HOLD_NOTE_ELEMENTS = 200; + +const int NUM_RADAR_VALUES = 5; + +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 + NOTE_8TH, // eighth notes + NOTE_12TH, // triplets + NOTE_16TH, // sixteenth notes + NUM_NOTE_TYPES +}; + +inline D3DXCOLOR NoteTypeToColor( NoteType nt ) +{ + switch( nt ) + { + case NOTE_4TH: return D3DXCOLOR(1,0,0,1); // red + case NOTE_8TH: return D3DXCOLOR(0,0,1,1); // blue + case NOTE_12TH: return D3DXCOLOR(1,0,1,1); // purple + case NOTE_16TH: return D3DXCOLOR(1,1,0,1); // yellow + default: ASSERT( false ); return D3DXCOLOR(1,1,1,1); + } +}; + +inline float NoteTypeToBeat( NoteType nt ) +{ + switch( nt ) + { + case NOTE_4TH: return 1.0f; // quarter notes + case NOTE_8TH: return 1.0f/2; // eighth notes + case NOTE_12TH: return 1.0f/3; // triplets + case NOTE_16TH: return 1.0f/4; // sixteenth notes + default: ASSERT( false ); return 0; + } +}; + +inline bool IsNoteOfType( int iNoteIndex, NoteType t ) +{ + switch( t ) + { + case NOTE_4TH: return iNoteIndex % (ELEMENTS_PER_MEASURE/4) == 0; + case NOTE_8TH: return iNoteIndex % (ELEMENTS_PER_MEASURE/8) == 0; + case NOTE_12TH: return iNoteIndex % (ELEMENTS_PER_MEASURE/12) == 0; + case NOTE_16TH: return iNoteIndex % (ELEMENTS_PER_MEASURE/16) == 0; + default: ASSERT( false ); return false; + } +}; + +inline D3DXCOLOR GetNoteColorFromIndex( int iStepIndex ) +{ + for( int t=0; tWriteLine( "GameDef::GameDef( '%s )", sGameDir ); sGameDir.TrimRight( "/\\" ); // trim off the trailing slash if any m_sGameDir = sGameDir + "\\"; diff --git a/stepmania/src/GameDef.h b/stepmania/src/GameDef.h index b1abd6ccff..432e243d5b 100644 --- a/stepmania/src/GameDef.h +++ b/stepmania/src/GameDef.h @@ -13,7 +13,7 @@ #include "NoteMetadata.h" #include "NoteData.h" #include "GameInput.h" -#include "GameTypes.h" +#include "GameConstantsAndTypes.h" #include "MenuInput.h" diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index 08a7cca91e..4723efa019 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -84,10 +84,35 @@ StyleDef* GameManager::GetStyleDef( CString sGame, CString sStyle ) return NULL; } +void GameManager::SwitchGame( CString sGame ) +{ + m_sCurrentGame = sGame; + m_pCurrentGameDef = GetGameDef( sGame ); + if( m_pCurrentGameDef == NULL ) + FatalError( "SwitchGame failed. The game '%s' is not present.", sGame ); + + for( int p=0; pm_sSkinFolders[0]; +}; + +void GameManager::SwitchStyle( CString sStyle ) +{ + 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; +} void GameManager::GetGameNames( CStringArray &arrayGameNames ) { - for( int i=0; im_sName ); } @@ -111,15 +136,6 @@ void GameManager::GetSkinNames( CString sGameName, CStringArray &arraySkinNames arraySkinNames.Add( pGameDef->m_sSkinFolders[i] ); } -void GameManager::SwitchSkin( PlayerNumber p, CString sSkin ) -{ - if( !m_pCurrentGameDef->HasASkinNamed( sSkin ) ) - FatalError( "The current game doesn't have a skin named '%s'.", sSkin ); - - m_sCurrentSkin[p] = sSkin; -} - - bool GameManager::IsPlayerEnabled( PlayerNumber PlayerNo ) { StyleDef* pStyleDef = GetCurrentStyleDef(); diff --git a/stepmania/src/GameManager.h b/stepmania/src/GameManager.h index 2599373ce0..1c7386af6f 100644 --- a/stepmania/src/GameManager.h +++ b/stepmania/src/GameManager.h @@ -24,21 +24,8 @@ public: ~GameManager(); void ReadGamesAndStylesFromDir( CString sDir ); - void SwitchGame( CString sGame ) - { - m_sCurrentGame = sGame; - m_pCurrentGameDef = GetGameDef( sGame ); - ASSERT( m_pCurrentGameDef != NULL ); - - for( int p=0; pm_sSkinFolders[0]; - }; - void SwitchStyle( CString sStyle ) - { - m_sCurrentStyle = sStyle; - m_pCurrentStyleDef = GetStyleDef( m_sCurrentGame, sStyle ); - ASSERT( m_pCurrentStyleDef != NULL ); - }; + void SwitchGame( CString sGame ); + void SwitchStyle( CString sStyle ); void SwitchSkin( PlayerNumber p, CString sSkin ); CString m_sCurrentGame; // currently only "dance" @@ -50,6 +37,7 @@ public: void GetGameNames( CStringArray &arrayGameNames ); void GetStyleNames( CString sGameName, CStringArray &arrayStyleNames ); void GetSkinNames( CString sGameName, CStringArray &arraySkinNames ); + void GetSkinNames( CStringArray &arraySkinNames ) { GetSkinNames( m_sCurrentGame, arraySkinNames ); }; bool IsPlayerEnabled( PlayerNumber PlayerNo ); diff --git a/stepmania/src/GhostArrowRow.cpp b/stepmania/src/GhostArrowRow.cpp index 61899ce6e3..0f6d27d0ea 100644 --- a/stepmania/src/GhostArrowRow.cpp +++ b/stepmania/src/GhostArrowRow.cpp @@ -11,7 +11,7 @@ #include "GhostArrowRow.h" #include "RageUtil.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "ThemeManager.h" #include "ColorNote.h" #include "ArrowEffects.h" diff --git a/stepmania/src/GhostArrowRow.h b/stepmania/src/GhostArrowRow.h index 468e78015c..78bbafa28f 100644 --- a/stepmania/src/GhostArrowRow.h +++ b/stepmania/src/GhostArrowRow.h @@ -14,7 +14,7 @@ #include "GhostArrow.h" #include "GhostArrowBright.h" #include "HoldGhostArrow.h" -#include "GameTypes.h" +#include "GameConstantsAndTypes.h" #include "StyleDef.h" diff --git a/stepmania/src/GradeDisplay.cpp b/stepmania/src/GradeDisplay.cpp index f6a2911536..e11c93d00c 100644 --- a/stepmania/src/GradeDisplay.cpp +++ b/stepmania/src/GradeDisplay.cpp @@ -11,11 +11,67 @@ -#include "Grade.h" +#include "GradeDisplay.h" #include "RageUtil.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "ThemeManager.h" +const float SCROLL_TIME = 5.0f; +GradeDisplay::GradeDisplay() +{ + Load( THEME->GetPathTo(GRAPHIC_RESULTS_GRADES) ); + StopAnimating(); + + m_fTimeLeftInScroll = 0; + +// SetGrade( GRADE_NO_DATA ); +} + +void GradeDisplay::Update( float fDeltaTime ) +{ + Sprite::Update( fDeltaTime ); + + m_fTimeLeftInScroll -= fDeltaTime; + m_fTimeLeftInScroll = max( 0, m_fTimeLeftInScroll ); + + const float fPercentIntoScrolling = 1 - (m_fTimeLeftInScroll/SCROLL_TIME); + FRECT frectCurrentTextureCoords; + frectCurrentTextureCoords.left = m_frectStartTexCoords.left*(1-fPercentIntoScrolling) + m_frectDestTexCoords.left*fPercentIntoScrolling; + frectCurrentTextureCoords.top = m_frectStartTexCoords.top*(1-fPercentIntoScrolling) + m_frectDestTexCoords.top*fPercentIntoScrolling; + frectCurrentTextureCoords.right = m_frectStartTexCoords.right*(1-fPercentIntoScrolling) + m_frectDestTexCoords.right*fPercentIntoScrolling; + frectCurrentTextureCoords.bottom = m_frectStartTexCoords.bottom*(1-fPercentIntoScrolling) + m_frectDestTexCoords.bottom*fPercentIntoScrolling; + + this->SetCustomTextureRect( frectCurrentTextureCoords ); +} + +void GradeDisplay::SetGrade( Grade g ) +{ +// StopUsingCustomCoords(); + +// SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); + + switch( g ) + { + case GRADE_AAA: SetState(0); break; + case GRADE_AA: SetState(1); break; + case GRADE_A: SetState(2); break; + case GRADE_B: SetState(3); break; + case GRADE_C: SetState(4); break; + case GRADE_D: SetState(5); break; + case GRADE_E: SetState(6); break; +// case GRADE_NO_DATA: SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); break; + default: ASSERT( false ); + } +}; + +void GradeDisplay::SpinAndSettleOn( Grade g ) +{ + SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); + + m_frectStartTexCoords = *m_pTexture->GetTextureCoordRect( 0 ); + m_frectDestTexCoords = *m_pTexture->GetTextureCoordRect( 6 ); + m_fTimeLeftInScroll = SCROLL_TIME; +} diff --git a/stepmania/src/GradeDisplay.h b/stepmania/src/GradeDisplay.h index 2c085b7609..4aa2853c40 100644 --- a/stepmania/src/GradeDisplay.h +++ b/stepmania/src/GradeDisplay.h @@ -1,3 +1,4 @@ +#pragma once /* ----------------------------------------------------------------------------- File: GradeDisplay.h @@ -9,10 +10,6 @@ */ -#ifndef _GradeDisplay_H_ -#define _GradeDisplay_H_ - - #include "Sprite.h" #include "ThemeManager.h" #include "Grade.h" @@ -22,32 +19,18 @@ class GradeDisplay : public Sprite { public: - GradeDisplay() - { - Load( THEME->GetPathTo(GRAPHIC_GRADES) ); - StopAnimating(); - SetGrade( GRADE_NO_DATA ); - }; - - void SetGrade( Grade g ) - { - switch( g ) - { - case GRADE_AAA: SetState(0); break; - case GRADE_AA: SetState(1); break; - case GRADE_A: SetState(2); break; - case GRADE_B: SetState(3); break; - case GRADE_C: SetState(4); break; - case GRADE_D: SetState(5); break; - case GRADE_E: SetState(6); break; - case GRADE_NO_DATA: SetState(7); break; - default: ASSERT( false ); - } - }; + GradeDisplay(); + + virtual void Update( float fDeltaTime ); + void SetGrade( Grade g ); + void SpinAndSettleOn( Grade g ); +protected: + + // for scrolling + void ScrollToVirtualFrame( int iFrameNo ); // a virtual frame is a tiled state number + FRECT m_frectStartTexCoords; + FRECT m_frectDestTexCoords; + float m_fTimeLeftInScroll; }; - - - -#endif diff --git a/stepmania/src/GrayArrowRow.cpp b/stepmania/src/GrayArrowRow.cpp index d14bd0b213..9f0b89d293 100644 --- a/stepmania/src/GrayArrowRow.cpp +++ b/stepmania/src/GrayArrowRow.cpp @@ -12,7 +12,7 @@ #include "GrayArrowRow.h" #include "RageUtil.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "ThemeManager.h" #include "ColorNote.h" #include "ArrowEffects.h" diff --git a/stepmania/src/GrayArrowRow.h b/stepmania/src/GrayArrowRow.h index 036b174311..582723fc87 100644 --- a/stepmania/src/GrayArrowRow.h +++ b/stepmania/src/GrayArrowRow.h @@ -17,7 +17,7 @@ #include "GrayArrow.h" #include "ActorFrame.h" #include "StyleDef.h" -#include "GameTypes.h" +#include "GameConstantsAndTypes.h" diff --git a/stepmania/src/GrooveRadar.cpp b/stepmania/src/GrooveRadar.cpp index 1a1748cb42..70ea650eb3 100644 --- a/stepmania/src/GrooveRadar.cpp +++ b/stepmania/src/GrooveRadar.cpp @@ -15,7 +15,7 @@ #include "GrooveRadar.h" #include "ThemeManager.h" #include "RageBitmapTexture.h" -#include "GameConstants.h" +#include "GameConstantsAndTypes.h" float RADAR_VALUE_ROTATION( int iValueIndex ) { return D3DX_PI/2 + D3DX_PI*2 / 5.0f * iValueIndex; } @@ -127,7 +127,7 @@ void GrooveRadar::RenderPrimitives() // pVB->Lock( 0, 0, (BYTE**)&v, 0 ); - D3DXCOLOR color = PLAYER_COLOR[p]; + D3DXCOLOR color = PlayerToColor( (PlayerNumber)p ); color.a = 0.5f; v[0].p = D3DXVECTOR3( 0, 0, 0 ); v[0].color = color; @@ -172,8 +172,8 @@ void GrooveRadar::RenderPrimitives() v[i*2+0].p = D3DXVECTOR3( fXInner, fYInner, 0 ); v[i*2+1].p = D3DXVECTOR3( fXOutter, fYOutter, 0 ); - v[i*2+0].color = PLAYER_COLOR[p]; - v[i*2+1].color = PLAYER_COLOR[p]; + v[i*2+0].color = PlayerToColor( (PlayerNumber)p ); + v[i*2+1].color = PlayerToColor( (PlayerNumber)p ); } pVB->Unlock(); diff --git a/stepmania/src/HoldJudgement.cpp b/stepmania/src/HoldJudgement.cpp index c095bcf5f2..68d8647f5e 100644 --- a/stepmania/src/HoldJudgement.cpp +++ b/stepmania/src/HoldJudgement.cpp @@ -11,7 +11,7 @@ #include "HoldJudgement.h" #include "RageUtil.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "ThemeManager.h" @@ -45,7 +45,7 @@ void HoldJudgement::RenderPrimitives() void HoldJudgement::SetHoldJudgement( HoldNoteResult result ) { - //HELPER.Log( "Judgement::SetJudgement()" ); + //LOG->WriteLine( "Judgement::SetJudgement()" ); switch( result ) { diff --git a/stepmania/src/InputFilter.cpp b/stepmania/src/InputFilter.cpp index 189a69d20d..9966ada6a8 100644 --- a/stepmania/src/InputFilter.cpp +++ b/stepmania/src/InputFilter.cpp @@ -12,7 +12,7 @@ #include // for fmod #include "InputFilter.h" -#include "RageHelper.h" +#include "RageLog.h" #include "RageInput.h" #include "ErrorCatcher/ErrorCatcher.h" diff --git a/stepmania/src/InputFilter.h b/stepmania/src/InputFilter.h index d45e480582..fc7df03655 100644 --- a/stepmania/src/InputFilter.h +++ b/stepmania/src/InputFilter.h @@ -17,7 +17,8 @@ const float TIME_BEFORE_SLOW_REPEATS = 0.7f; const float TIME_BEFORE_FAST_REPEATS = 2.0f; -const float TIME_BETWEEN_SLOW_REPEATS = 0.25f; +//const float TIME_BETWEEN_SLOW_REPEATS = 0.25f; +const float TIME_BETWEEN_SLOW_REPEATS = 0.125f; const float TIME_BETWEEN_FAST_REPEATS = 0.125f; enum InputEventType { IET_FIRST_PRESS, IET_SLOW_REPEAT, IET_FAST_REPEAT, IET_RELEASE }; diff --git a/stepmania/src/InputMapper.h b/stepmania/src/InputMapper.h index 4ab3c4d1ec..b0d3eddaaa 100644 --- a/stepmania/src/InputMapper.h +++ b/stepmania/src/InputMapper.h @@ -16,7 +16,7 @@ #include "GameInput.h" #include "MenuInput.h" #include "StyleInput.h" -#include "GameTypes.h" +#include "GameConstantsAndTypes.h" diff --git a/stepmania/src/Judgement.cpp b/stepmania/src/Judgement.cpp index c340c72fd0..19f42d7ec3 100644 --- a/stepmania/src/Judgement.cpp +++ b/stepmania/src/Judgement.cpp @@ -11,7 +11,7 @@ #include "Judgement.h" #include "RageUtil.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "ThemeManager.h" @@ -46,7 +46,7 @@ void Judgement::RenderPrimitives() void Judgement::SetJudgement( TapNoteScore score ) { - //HELPER.Log( "Judgement::SetJudgement()" ); + //LOG->WriteLine( "Judgement::SetJudgement()" ); switch( score ) { diff --git a/stepmania/src/MenuElements.cpp b/stepmania/src/MenuElements.cpp index 87de16465a..822b1cf863 100644 --- a/stepmania/src/MenuElements.cpp +++ b/stepmania/src/MenuElements.cpp @@ -15,9 +15,9 @@ #include "RageMusic.h" #include "WindowManager.h" #include "WindowDancing.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "ThemeManager.h" -#include "RageHelper.h" +#include "RageLog.h" const float HELP_X = CENTER_X; @@ -34,7 +34,7 @@ MenuElements::MenuElements() void MenuElements::Load( CString sBackgroundPath, CString sTopEdgePath, CString sHelpText ) { - HELPER.Log( "MenuElements::MenuElements()" ); + LOG->WriteLine( "MenuElements::MenuElements()" ); m_sprBG.Load( sBackgroundPath ); @@ -85,8 +85,6 @@ void MenuElements::TweenTopEdgeOnScreen() void MenuElements::TweenTopEdgeOffScreen() { - SetTopEdgeOnScreen(); - m_sprTopEdge.BeginTweening( MENU_ELEMENTS_TWEEN_TIME*2, TWEEN_BIAS_END ); m_sprTopEdge.SetTweenX( SCREEN_WIDTH*1.5f ); @@ -113,8 +111,6 @@ void MenuElements::TweenBackgroundOnScreen() void MenuElements::TweenBackgroundOffScreen() { - SetBackgroundOnScreen(); - m_sprBottomEdge.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); m_sprBottomEdge.SetTweenY( SCREEN_HEIGHT + m_sprTopEdge.GetZoomedHeight() ); diff --git a/stepmania/src/MenuInput.h b/stepmania/src/MenuInput.h index 763aa77b21..2a7ec51d3d 100644 --- a/stepmania/src/MenuInput.h +++ b/stepmania/src/MenuInput.h @@ -11,7 +11,7 @@ ----------------------------------------------------------------------------- */ -#include "GameTypes.h" +#include "GameConstantsAndTypes.h" enum MenuButton { diff --git a/stepmania/src/MusicSortDisplay.cpp b/stepmania/src/MusicSortDisplay.cpp index fd3bbd8e95..4782f09eb2 100644 --- a/stepmania/src/MusicSortDisplay.cpp +++ b/stepmania/src/MusicSortDisplay.cpp @@ -11,7 +11,7 @@ #include "MusicSortDisplay.h" #include "RageUtil.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "MusicWheel.h" #include "MusicSortDisplay.h" diff --git a/stepmania/src/MusicSortDisplay.h b/stepmania/src/MusicSortDisplay.h index 97f04f5745..39f43f8ecf 100644 --- a/stepmania/src/MusicSortDisplay.h +++ b/stepmania/src/MusicSortDisplay.h @@ -16,7 +16,7 @@ class MusicSortDisplay; #include "Sprite.h" -#include "GameTypes.h" +#include "GameConstantsAndTypes.h" diff --git a/stepmania/src/MusicStatusDisplay.cpp b/stepmania/src/MusicStatusDisplay.cpp index fa85277dc0..e32df3e5dd 100644 --- a/stepmania/src/MusicStatusDisplay.cpp +++ b/stepmania/src/MusicStatusDisplay.cpp @@ -11,7 +11,7 @@ #include "MusicStatusDisplay.h" #include "RageUtil.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "MusicWheel.h" #include "MusicStatusDisplay.h" diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index c0083e25ea..e21756aa0c 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -1,11 +1,12 @@ #include "stdafx.h" /* ----------------------------------------------------------------------------- - File: MusicWheel.h + Class: MusicWheel - Desc: A graphic displayed in the MusicWheel during Dancing. + Desc: See header. Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ @@ -13,12 +14,11 @@ #include "RageUtil.h" #include "SongManager.h" #include "GameManager.h" -#include "ScreenDimensions.h" #include "ThemeManager.h" #include "RageMusic.h" #include "WindowManager.h" // for sending SM_PlayMusicSample -#include "RageHelper.h" -#include "GameConstants.h" +#include "RageLog.h" +#include "GameConstantsAndTypes.h" @@ -35,31 +35,9 @@ const float SORT_ICON_OFF_SCREEN_Y = SORT_ICON_ON_SCREEN_Y - 64; const float SCORE_X = 86; const float SCORE_Y[NUM_PLAYERS] = { -34, 34 }; +const float SCROLLBAR_X = 150; -D3DXCOLOR COLOR_BANNER_TINTS[] = { - D3DXCOLOR( 0.9f, 0.0f, 0.2f, 1 ), // red - D3DXCOLOR( 0.6f, 0.0f, 0.4f, 1 ), // pink - D3DXCOLOR( 0.3f, 0.2f, 0.4f, 1 ), // purple - D3DXCOLOR( 0.0f, 0.4f, 0.8f, 1 ), // sky blue - D3DXCOLOR( 0.0f, 0.6f, 0.6f, 1 ), // sea green - D3DXCOLOR( 0.0f, 0.6f, 0.2f, 1 ), // green - D3DXCOLOR( 0.8f, 0.6f, 0.0f, 1 ), // orange -}; -const int NUM_BANNER_TINTS = sizeof(COLOR_BANNER_TINTS) / sizeof(D3DXCOLOR); - -D3DXCOLOR COLOR_SECTION_TINTS[] = { - D3DXCOLOR( 0.9f, 0.0f, 0.2f, 1 ), // red - D3DXCOLOR( 0.6f, 0.0f, 0.4f, 1 ), // pink - D3DXCOLOR( 0.3f, 0.2f, 0.4f, 1 ), // purple - D3DXCOLOR( 0.0f, 0.4f, 0.8f, 1 ), // sky blue - D3DXCOLOR( 0.0f, 0.6f, 0.6f, 1 ), // sea green - D3DXCOLOR( 0.0f, 0.6f, 0.2f, 1 ), // green - D3DXCOLOR( 0.8f, 0.6f, 0.0f, 1 ), // orange -}; -const int NUM_SECTION_TINTS = sizeof(COLOR_SECTION_TINTS) / sizeof(D3DXCOLOR); - - -D3DXCOLOR COLOR_SECTION_LETTER = D3DXCOLOR(1,1,0.3f,1); +D3DXCOLOR COLOR_SECTION_LETTERS = D3DXCOLOR(1,1,0.3f,1); WheelItemData::WheelItemData() @@ -72,7 +50,6 @@ void WheelItemData::LoadFromSectionName( const CString &sSectionName ) { m_WheelItemType = TYPE_SECTION; m_sSectionName = sSectionName; - m_colorTint = D3DXCOLOR(0.5f,0.5f,0.5f,1); } @@ -103,11 +80,12 @@ WheelItemDisplay::WheelItemDisplay() m_textSectionName.SetVertAlign( align_middle ); m_textSectionName.SetXY( m_sprSectionBar.GetX() - m_sprSectionBar.GetUnzoomedWidth()/2 + 10, 0 ); m_textSectionName.SetZoom( 1.0f ); - m_textSectionName.SetDiffuseColor( COLOR_SECTION_LETTER ); + m_textSectionName.SetDiffuseColor( COLOR_SECTION_LETTERS ); for( int p=0; pGetPathTo(GRAPHIC_SELECT_MUSIC_SMALL_GRADES) ); + m_GradeDisplay[p].SetZoom( 1.0f ); m_GradeDisplay[p].SetXY( 90.0f + p*30.0f, 0 ); } } @@ -120,7 +98,6 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID ) // copy all data items m_WheelItemType = pWID->m_WheelItemType; - m_colorTint = pWID->m_colorTint; m_sSectionName = pWID->m_sSectionName; m_pSong = pWID->m_pSong; m_MusicStatusDisplayType = pWID->m_MusicStatusDisplayType; @@ -139,22 +116,23 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID ) else m_textSectionName.SetZoom( 1 ); m_textSectionName.SetText( sDisplayName ); + m_textSectionName.SetDiffuseColor( COLOR_SECTION_LETTERS ); float fTextWidth, fSpriteWidth; fTextWidth = m_textSectionName.GetWidestLineWidthInSourcePixels() * m_textSectionName.GetZoom(); fSpriteWidth = m_sprSectionBar.GetUnzoomedWidth() * m_sprSectionBar.GetZoom() - 20; if( fTextWidth > fSpriteWidth ) m_textSectionName.SetZoomX( m_textSectionName.GetZoom() * fSpriteWidth / fTextWidth ); - m_sprSectionBar.SetDiffuseColor( m_colorTint ); + m_sprSectionBar.SetDiffuseColor( SONG->GetGroupColor( m_pSong->GetGroupName() ) ); } break; case TYPE_SONG: { m_Banner.LoadFromSong( m_pSong ); - D3DXCOLOR color = m_colorTint; - color.r += 0.4f; - color.g += 0.4f; - color.b += 0.4f; + D3DXCOLOR color = SONG->GetGroupColor( m_pSong->GetGroupName() ); + color.r += 0.15f; + color.g += 0.15f; + color.b += 0.15f; m_Banner.SetDiffuseColor( color ); m_MusicStatusDisplay.SetType( m_MusicStatusDisplayType ); RefreshGrades(); @@ -175,7 +153,7 @@ void WheelItemDisplay::RefreshGrades() ASSERT( m_pSong != NULL ); const Grade grade = m_pSong->GetGradeForDifficultyClass( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, dc ); m_GradeDisplay[p].SetGrade( grade ); - m_GradeDisplay[p].SetDiffuseColor( PLAYER_COLOR[p] ); + m_GradeDisplay[p].SetDiffuseColor( PlayerToColor((PlayerNumber)p) ); } else // !IsPlayerEnabled { @@ -184,34 +162,6 @@ void WheelItemDisplay::RefreshGrades() } } - -void WheelItemDisplay::SetDiffuseColor( D3DXCOLOR c ) -{ - Actor::SetDiffuseColor( c ); - - - D3DXCOLOR colorTempTint = m_colorTint; - colorTempTint.a = c.a; - colorTempTint.r *= c.r; - colorTempTint.g *= c.g; - colorTempTint.b *= c.b; - - m_Banner.SetDiffuseColor( colorTempTint ); - m_sprSectionBar.SetDiffuseColor( colorTempTint ); - - D3DXCOLOR colorTempLetter = COLOR_SECTION_LETTER; - colorTempLetter.a = c.a; - colorTempLetter.r *= c.r; - colorTempLetter.g *= c.g; - colorTempLetter.b *= c.b; - - m_textSectionName.SetDiffuseColor( colorTempLetter ); - - D3DXCOLOR colorTempDisplay = D3DXCOLOR( 1, 1, 1, c.a); - - m_MusicStatusDisplay.SetDiffuseColor( colorTempDisplay ); -} - void WheelItemDisplay::Update( float fDeltaTime ) { switch( m_WheelItemType ) @@ -252,7 +202,7 @@ void WheelItemDisplay::RenderPrimitives() MusicWheel::MusicWheel() { - HELPER.Log( "MusicWheel::MusicWheel()" ); + LOG->WriteLine( "MusicWheel::MusicWheel()" ); for( int p=0; pAddActor( &m_sprHighScoreFrame[p] ); - m_HighScore[p].SetXY( SCORE_X, SCORE_Y[p]*0.97f ); - m_HighScore[p].SetZoom( 0.6f ); + m_HighScore[p].SetXY( SCORE_X-12, SCORE_Y[p]*0.97f ); + m_HighScore[p].SetZoom( 0.5f ); this->AddActor( &m_HighScore[p] ); } @@ -278,7 +228,9 @@ MusicWheel::MusicWheel() m_MusicSortDisplay.SetEffectGlowing( 1.0f ); this->AddActor( &m_MusicSortDisplay ); - + m_ScrollBar.SetX( SCROLLBAR_X ); + this->AddActor( &m_ScrollBar ); + m_soundChangeMusic.Load( THEME->GetPathTo(SOUND_SWITCH_MUSIC), 10 ); m_soundChangeSort.Load( THEME->GetPathTo(SOUND_SWITCH_SORT) ); @@ -291,21 +243,6 @@ MusicWheel::MusicWheel() arraySongs.Copy( SONG->m_pSongs ); SortSongPointerArrayByGroup( arraySongs ); - int iNextGroupBannerColor = 0; - - CString sLastGroupNameSeen = ""; - - for( int i=0; iGetGroupName(); - if( sThisGroupName != sLastGroupNameSeen ) - { - m_mapGroupNameToColorPtr.SetAt( sThisGroupName, &COLOR_BANNER_TINTS[iNextGroupBannerColor++] ); - if( iNextGroupBannerColor >= NUM_BANNER_TINTS-1 ) - iNextGroupBannerColor = 0; - } - sLastGroupNameSeen = sThisGroupName; - } m_SortOrder = PREFS->m_SongSortOrder; @@ -342,7 +279,7 @@ MusicWheel::MusicWheel() if( SONG->m_pCurSong != NULL ) { // find the previously selected song (if any) - for( i=0; im_pCurSong ) { @@ -365,6 +302,7 @@ MusicWheel::~MusicWheel() void MusicWheel::BuildWheelItemDatas( CArray &arrayWheelItemDatas, SongSortOrder so ) { + int i; /////////////////////////////////// // Make an array of Song*, then sort them @@ -372,7 +310,7 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr CArray arraySongs; // copy only song that have at least one NoteMetadata for the current GameMode - for( int i=0; im_pSongs.GetSize(); i++ ) + for( i=0; im_pSongs.GetSize(); i++ ) { Song* pSong = SONG->m_pSongs[i]; @@ -433,7 +371,6 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr CString sLastSection = ""; int iCurWheelItem = 0; - int iNextSectionTint = 0; for( int i=0; i< arraySongs.GetSize(); i++ ) { Song* pSong = arraySongs[i]; @@ -442,16 +379,12 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr { WheelItemData &WID = arrayWheelItemDatas[iCurWheelItem++]; WID.LoadFromSectionName( sThisSection ); - WID.m_colorTint = COLOR_SECTION_TINTS[iNextSectionTint++]; - if( iNextSectionTint >= NUM_SECTION_TINTS ) - iNextSectionTint = 0; sLastSection = sThisSection; } WheelItemData &WID = arrayWheelItemDatas[iCurWheelItem++]; WID.LoadFromSong( pSong ); WID.m_sSectionName = sThisSection; - WID.m_colorTint = *m_mapGroupNameToColorPtr[pSong->GetGroupName()]; } arrayWheelItemDatas.SetSize( iCurWheelItem ); // make sure we have enough room for all music and section items } @@ -464,7 +397,6 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr Song* pSong = arraySongs[i]; WheelItemData &WID = arrayWheelItemDatas[i]; WID.LoadFromSong( pSong ); - WID.m_colorTint = *m_mapGroupNameToColorPtr[pSong->GetGroupName()]; WID.m_sSectionName = ""; } } @@ -496,8 +428,7 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr if( arrayWheelItemDatas.GetSize() == 0 ) { arrayWheelItemDatas.SetSize( 1 ); - arrayWheelItemDatas[0].LoadFromSectionName( "No SONG" ); - arrayWheelItemDatas[0].m_colorTint = D3DXCOLOR(0.5f,0.5f,0.5f,1); + arrayWheelItemDatas[0].LoadFromSectionName( "NO SONGS" ); } } @@ -655,6 +586,9 @@ void MusicWheel::RenderPrimitives() float fThisBannerPositionOffsetFromSelection = i - NUM_WHEEL_ITEMS_TO_DRAW/2 + m_fPositionOffsetFromSelection; float fY = GetBannerY( fThisBannerPositionOffsetFromSelection ); + if( fY < -SCREEN_HEIGHT/2 || fY > SCREEN_HEIGHT/2 ) + continue; // skip + float fX = GetBannerX( fThisBannerPositionOffsetFromSelection ); display.SetXY( fX, fY ); @@ -681,6 +615,8 @@ void MusicWheel::Update( float fDeltaTime ) display.Update( fDeltaTime ); } + float fScrollPercentage = (m_iSelection-m_fPositionOffsetFromSelection) / (float)GetCurWheelItemDatas().GetSize(); + m_ScrollBar.SetPercentage( fScrollPercentage ); // update wheel state diff --git a/stepmania/src/MusicWheel.h b/stepmania/src/MusicWheel.h index 0b76daeb87..56cf0b4ada 100644 --- a/stepmania/src/MusicWheel.h +++ b/stepmania/src/MusicWheel.h @@ -1,18 +1,15 @@ +#pragma once /* ----------------------------------------------------------------------------- - File: MusicWheel.h + Class: MusicWheel - Desc: A graphic displayed in the MusicWheel during Dancing. + Desc: A wheel with song names used in the Select Music screen. Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ - -#ifndef _MusicWheel_H_ -#define _MusicWheel_H_ - - #include "Sprite.h" #include "Song.h" #include "ActorFrame.h" @@ -22,14 +19,15 @@ #include "RandomSample.h" #include "GradeDisplay.h" #include "RageSoundStream.h" -#include "GameTypes.h" +#include "GameConstantsAndTypes.h" #include "MusicSortDisplay.h" #include "MusicStatusDisplay.h" #include "Window.h" // for WindowMessage -#include "ScoreDisplayRolling.h" // for WindowMessage +#include "ScoreDisplayRolling.h" +#include "ScrollBar.h" -const int NUM_WHEEL_ITEMS_TO_DRAW = 11; +const int NUM_WHEEL_ITEMS_TO_DRAW = 13; const float FADE_TIME = 0.7f; @@ -49,7 +47,6 @@ public: void LoadFromSong( Song* pSong ); WheelItemType m_WheelItemType; - D3DXCOLOR m_colorTint; CString m_sSectionName; Song* m_pSong; MusicStatusDisplayType m_MusicStatusDisplayType; @@ -65,7 +62,6 @@ public: virtual void Update( float fDeltaTime ); virtual void RenderPrimitives(); - CString GetSectionName() { return m_sSectionName; @@ -73,7 +69,6 @@ public: void LoadFromWheelItemData( WheelItemData* pWID ); void RefreshGrades(); - void SetDiffuseColor( D3DXCOLOR c ); // for a section Sprite m_sprSectionBar; @@ -122,6 +117,8 @@ protected: void SwitchSortOrder(); + ScrollBar m_ScrollBar; + Sprite m_sprSelectionOverlay; MusicSortDisplay m_MusicSortDisplay; @@ -193,11 +190,5 @@ protected: } }; - - CTypedPtrMap m_mapGroupNameToColorPtr; - - }; - -#endif diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index e74cf876aa..4e3da502e7 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -12,11 +12,11 @@ #include "NoteData.h" #include "RageUtil.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "ThemeManager.h" #include "ArrowEffects.h" #include "PrefsManager.h" -#include "GameConstants.h" +#include "GameConstantsAndTypes.h" #include "ErrorCatcher/ErrorCatcher.h" @@ -527,7 +527,7 @@ void NoteData::GetMeasureStrings( CStringArray &arrayMeasureStrings ) int iNoteIndexSpacing; for( nt=(NoteType)0; ntWriteLine( "NoteField::RenderPrimitives()" ); if( m_fSongBeat < 0 ) m_fSongBeat = 0; @@ -162,7 +162,7 @@ void NoteField::RenderPrimitives() if( iIndexFirstArrowToDraw < 0 ) iIndexFirstArrowToDraw = 0; int iIndexLastArrowToDraw = BeatToNoteIndex( m_fSongBeat + m_fNumBeatsToDrawAhead ); // 7 beats later - //HELPER.Log( "Drawing elements %d through %d", iIndexFirstArrowToDraw, iIndexLastArrowToDraw ); + //LOG->WriteLine( "Drawing elements %d through %d", iIndexFirstArrowToDraw, iIndexLastArrowToDraw ); // // Draw measure bars diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 38c344edc0..c54faec2ef 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -9,12 +9,12 @@ ----------------------------------------------------------------------------- */ -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "Math.h" // for fabs() #include "Player.h" #include "RageUtil.h" #include "ThemeManager.h" -#include "GameTypes.h" +#include "GameConstantsAndTypes.h" #include "ArrowEffects.h" #include "GameManager.h" #include "InputMapper.h" @@ -61,7 +61,7 @@ Player::Player() void Player::Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore ) { - //HELPER.Log( "Player::Load()", ); + //LOG->WriteLine( "Player::Load()", ); this->CopyAll( pNoteData ); m_PlayerNumber = player_no; @@ -96,7 +96,7 @@ void Player::Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOpti void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference ) { - //HELPER.Log( "Player::Update(%f, %f, %f)", fDeltaTime, fSongBeat, fMaxBeatDifference ); + //LOG->WriteLine( "Player::Update(%f, %f, %f)", fDeltaTime, fSongBeat, fMaxBeatDifference ); // @@ -253,7 +253,7 @@ bool Player::IsThereANoteAtIndex( int iIndex ) void Player::HandlePlayerStep( float fSongBeat, ColumnNumber col, float fMaxBeatDiff ) { - //HELPER.Log( "Player::HandlePlayerStep()" ); + //LOG->WriteLine( "Player::HandlePlayerStep()" ); ASSERT( col >= 0 && col <= m_iNumTracks ); @@ -284,7 +284,7 @@ void Player::HandlePlayerStep( float fSongBeat, ColumnNumber col, float fMaxBeat float fBeatsUntilStep = NoteIndexToBeat( (float)hn.m_iStartIndex ) - fSongBeat; float fPercentFromPerfect = fabsf( fBeatsUntilStep / fMaxBeatDiff ); - //HELPER.Log( "fBeatsUntilStep: %f, fPercentFromPerfect: %f", + //LOG->WriteLine( "fBeatsUntilStep: %f, fPercentFromPerfect: %f", // fBeatsUntilStep, fPercentFromPerfect ); // compute what the score should be for the note we stepped on @@ -325,13 +325,13 @@ void Player::HandlePlayerStep( float fSongBeat, ColumnNumber col, float fMaxBeat void Player::CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxBeatDiff ) { - //HELPER.Log( "Player::CheckForCompleteRow()" ); + //LOG->WriteLine( "Player::CheckForCompleteRow()" ); // look for the closest matching step int iIndexStartLookingAt = BeatToNoteIndex( fSongBeat ); int iNumElementsToExamine = BeatToNoteIndex( fMaxBeatDiff ); // number of elements to examine on either end of iIndexStartLookingAt - //HELPER.Log( "iIndexStartLookingAt = %d, iNumElementsToExamine = %d", iIndexStartLookingAt, iNumElementsToExamine ); + //LOG->WriteLine( "iIndexStartLookingAt = %d, iNumElementsToExamine = %d", iIndexStartLookingAt, iNumElementsToExamine ); // Start at iIndexStartLookingAt and search outward. The first one that overlaps the player's step is the closest match. for( int delta=0; delta <= iNumElementsToExamine; delta++ ) @@ -346,7 +346,7 @@ void Player::CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxB //////////////////////////// // check the step to the left of iIndexStartLookingAt //////////////////////////// - //HELPER.Log( "Checking NoteMetadata[%d]", iCurrentIndexEarlier ); + //LOG->WriteLine( "Checking NoteMetadata[%d]", iCurrentIndexEarlier ); if( m_TapNotes[col][iCurrentIndexEarlier] != '0' ) // these NoteMetadata overlap { m_TapNotes[col][iCurrentIndexEarlier] = '0'; // mark hit @@ -365,7 +365,7 @@ void Player::CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxB //////////////////////////// // check the step to the right of iIndexStartLookingAt //////////////////////////// - //HELPER.Log( "Checking NoteMetadata[%d]", iCurrentIndexLater ); + //LOG->WriteLine( "Checking NoteMetadata[%d]", iCurrentIndexLater ); if( m_TapNotes[col][iCurrentIndexLater] != '0' ) // these NoteMetadata overlap { m_TapNotes[col][iCurrentIndexLater] = '0'; // mark hit @@ -391,7 +391,7 @@ void Player::OnRowDestroyed( float fSongBeat, ColumnNumber col, float fMaxBeatDi float fBeatsUntilStep = fStepBeat - fSongBeat; float fPercentFromPerfect = fabsf( fBeatsUntilStep / fMaxBeatDiff ); - //HELPER.Log( "fBeatsUntilStep: %f, fPercentFromPerfect: %f", + //LOG->WriteLine( "fBeatsUntilStep: %f, fPercentFromPerfect: %f", // fBeatsUntilStep, fPercentFromPerfect ); // compute what the score should be for the note we stepped on @@ -480,7 +480,7 @@ ScoreSummary Player::GetScoreSummary() int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ) { - //HELPER.Log( "NoteMetadata::UpdateTapNotesMissedOlderThan(%f)", fMissIfOlderThanThisBeat ); + //LOG->WriteLine( "NoteMetadata::UpdateTapNotesMissedOlderThan(%f)", fMissIfOlderThanThisBeat ); int iMissIfOlderThanThisIndex = BeatToNoteIndex( fMissIfOlderThanThisBeat ); @@ -489,7 +489,7 @@ int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ) // Instead, only check 10 elements back. Even 10 is overkill. int iStartCheckingAt = max( 0, iMissIfOlderThanThisIndex-10 ); - //HELPER.Log( "iStartCheckingAt: %d iMissIfOlderThanThisIndex: %d", iStartCheckingAt, iMissIfOlderThanThisIndex ); + //LOG->WriteLine( "iStartCheckingAt: %d iMissIfOlderThanThisIndex: %d", iStartCheckingAt, iMissIfOlderThanThisIndex ); for( int i=iStartCheckingAt; im_dwMaxTextureSize = atoi( value_string ); if( name_string == "DisplayColor" ) pGPO->m_dwDisplayColor = atoi( value_string ); if( name_string == "TextureColor" ) pGPO->m_dwTextureColor = atoi( value_string ); - if( name_string == "Shadows" ) pGPO->m_bShadows = ( value_string == "1" ); - if( name_string == "Backgrounds" ) pGPO->m_bBackgrounds = ( value_string == "1" ); } } @@ -193,8 +188,6 @@ void PrefsManager::SavePrefsToDisk() ini.SetValue( "GraphicOptions", "MaxTextureSize", ssprintf("%d", pGPO->m_dwMaxTextureSize) ); ini.SetValue( "GraphicOptions", "DisplayColor", ssprintf("%d", pGPO->m_dwDisplayColor) ); ini.SetValue( "GraphicOptions", "TextureColor", ssprintf("%d", pGPO->m_dwTextureColor) ); - ini.SetValue( "GraphicOptions", "Shadows", pGPO->m_bShadows ? "1":"0" ); - ini.SetValue( "GraphicOptions", "Backgrounds", pGPO->m_bBackgrounds ? "1":"0" ); ini.SetValue( "GameOptions", "IgnoreJoyAxes", m_GameOptions.m_bIgnoreJoyAxes ? "1":"0" ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index f7a775a79b..a10f179203 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -12,7 +12,7 @@ ----------------------------------------------------------------------------- */ -#include "GameTypes.h" +#include "GameConstantsAndTypes.h" const int NUM_PAD_TO_DEVICE_SLOTS = 3; // three device inputs may map to one pad input diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index 3b9c31066e..98c5e26c55 100644 --- a/stepmania/src/RageBitmapTexture.cpp +++ b/stepmania/src/RageBitmapTexture.cpp @@ -23,7 +23,7 @@ #include "dxerr8.h" #include "DXUtil.h" #include "RageUtil.h" -#include "RageHelper.h" +#include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" @@ -38,7 +38,7 @@ RageBitmapTexture::RageBitmapTexture( const DWORD dwHints ) : RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, dwHints ) { -// HELPER.Log( "RageBitmapTexture::RageBitmapTexture()" ); +// LOG->WriteLine( "RageBitmapTexture::RageBitmapTexture()" ); m_pd3dTexture = NULL; @@ -146,7 +146,7 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR fmtTexture, // our preferred texture format D3DPOOL_MANAGED, // which memory pool (bScaleImageToTextureSize ? D3DX_FILTER_BOX : D3DX_FILTER_NONE) | (bDither ? D3DX_FILTER_DITHER : 0), // filter - D3DX_DEFAULT | (bDither ? D3DX_FILTER_DITHER : 0), // mip filter + D3DX_FILTER_BOX | (bDither ? D3DX_FILTER_DITHER : 0), // mip filter 0, // no color key &ddii, // struct to fill with source image info NULL, // no palette @@ -182,7 +182,7 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR m_iImageHeight = m_iSourceHeight; } - HELPER.Log( "RageBitmapTexture: Loaded '%s' (%ux%u) from disk. bScaleImageToTextureSize = %d, source %d,%d; image %d,%d.", + LOG->WriteLine( "RageBitmapTexture: Loaded '%s' (%ux%u) from disk. bScaleImageToTextureSize = %d, source %d,%d; image %d,%d.", m_sFilePath, GetTextureWidth(), GetTextureHeight(), diff --git a/stepmania/src/RageInput.cpp b/stepmania/src/RageInput.cpp index ef064e59cc..b4f68310fa 100644 --- a/stepmania/src/RageInput.cpp +++ b/stepmania/src/RageInput.cpp @@ -24,7 +24,7 @@ #include "RageInput.h" #include #include "RageUtil.h" -#include "RageHelper.h" +#include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" @@ -244,6 +244,7 @@ BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance, HRESULT hr = pDI->CreateDevice( pdidInstance->guidInstance, &pInput->m_pJoystick[i++], NULL ); + if( FAILED( hr ) ) FatalErrorHr( hr, "Error in CreateDevice() for joystick %d.", i ); return DIENUM_CONTINUE; diff --git a/stepmania/src/RageLog.cpp b/stepmania/src/RageLog.cpp new file mode 100644 index 0000000000..b881aad074 --- /dev/null +++ b/stepmania/src/RageLog.cpp @@ -0,0 +1,87 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: RageLog + + Desc: See header. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "RageLog.h" +#include "RageUtil.h" +#include +#include "ErrorCatcher/ErrorCatcher.h" + +#include "dxerr8.h" +#pragma comment(lib, "DxErr8.lib") + + +RageLog* LOG; // global and accessable from anywhere in the program + + +// constants +#define LOG_FILE_NAME "log.txt" + + +RageLog::RageLog() +{ + // delete old log files + DeleteFile( LOG_FILE_NAME ); + + // create a new console window and attach standard handles + AllocConsole(); + freopen("CONOUT$","wb",stdout); + freopen("CONOUT$","wb",stderr); + + // Open log file and leave it open. Let the OS close it when the app exits + m_fileLog = fopen( LOG_FILE_NAME, "w" ); + + + SYSTEMTIME st; + GetLocalTime( &st ); + + this->WriteLine( "Last compiled on %s.", __TIMESTAMP__ ); + this->WriteLine( "Log starting %.4d-%.2d-%.2d %.2d:%.2d:%.2d", + st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond ); + this->WriteLine( "\n" ); +} + +RageLog::~RageLog() +{ + FreeConsole(); + Flush(); + fclose( m_fileLog ); +} + +void RageLog::WriteLine( LPCTSTR fmt, ...) +{ + va_list va; + va_start(va, fmt); + + CString sBuff = vssprintf( fmt, va ); + sBuff += "\n"; + + fprintf( m_fileLog, sBuff ); + printf( sBuff ); + +#ifdef DEBUG + this->Flush(); // implicit flush +#endif +} + +void RageLog::WriteLineHr( HRESULT hr, LPCTSTR fmt, ...) +{ + va_list va; + va_start(va, fmt); + CString s = vssprintf( fmt, va ); + s += ssprintf( "(%s)", DXGetErrorString8(hr) ); + this->WriteLine( s ); +} + +void RageLog::Flush() +{ + fflush( m_fileLog ); +} diff --git a/stepmania/src/RageLog.h b/stepmania/src/RageLog.h new file mode 100644 index 0000000000..cefcd27604 --- /dev/null +++ b/stepmania/src/RageLog.h @@ -0,0 +1,28 @@ +#pragma once +/* +----------------------------------------------------------------------------- + Class: RageLog + + Desc: Manages logging + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + + +class RageLog +{ +public: + RageLog(); + ~RageLog(); + + void WriteLine( LPCTSTR fmt, ...); + void WriteLineHr( HRESULT hr, LPCTSTR fmt, ...); + void Flush(); + +protected: + FILE* m_fileLog; +}; + +extern RageLog* LOG; // global and accessable from anywhere in our program diff --git a/stepmania/src/RageMovieTexture.cpp b/stepmania/src/RageMovieTexture.cpp index 9a9b52fdb8..8c48b49e12 100644 --- a/stepmania/src/RageMovieTexture.cpp +++ b/stepmania/src/RageMovieTexture.cpp @@ -31,7 +31,7 @@ #include "dxerr8.h" #include "DXUtil.h" #include "RageUtil.h" -#include "RageHelper.h" +#include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" #include @@ -250,7 +250,7 @@ RageMovieTexture::RageMovieTexture( const DWORD dwHints ) : RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, dwHints ) { - HELPER.Log( "RageBitmapTexture::RageBitmapTexture()" ); + LOG->WriteLine( "RageBitmapTexture::RageBitmapTexture()" ); m_pd3dTexture[0] = m_pd3dTexture[1] = NULL; m_iIndexActiveTexture = 0; @@ -292,7 +292,7 @@ LPDIRECT3DTEXTURE8 RageMovieTexture::GetD3DTexture() // time for it to catch up and copy all the frames it fell behind on. // while( m_pCTR->IsLocked() ) { // ::Sleep(1); -// HELPER.Log( "Sleeping waiting for unlock..." ); +// LOG->WriteLine( "Sleeping waiting for unlock..." ); // } // restart the movie if we reach the end diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index bf09085ab8..c95bdaa918 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -12,26 +12,26 @@ #include "RageSound.h" #include "RageUtil.h" -#include "RageHelper.h" +#include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" #include "bass/bass.h" #pragma comment(lib, "bass/bass.lib") - + RageSound* SOUND = NULL; RageSound::RageSound( HWND hWnd ) { - HELPER.Log( "RageSound::RageSound()" ); + LOG->WriteLine( "RageSound::RageSound()" ); // save the HWND if( !hWnd ) FatalError( "RageSound called with NULL hWnd." ); m_hWndApp = hWnd; - if( BASS_GetVersion() != MAKELONG(1,3) ) - FatalError( "BASS version 1.3 DLL could not be loaded. Verify that Bass.dll exists in the program directory."); + if( BASS_GetVersion() != MAKELONG(1,5) ) + FatalError( "BASS version 1.5 DLL could not be loaded. Verify that Bass.dll exists in the program directory."); if( !BASS_Init( -1, 44100, BASS_DEVICE_LEAVEVOL|BASS_DEVICE_LATENCY, m_hWndApp ) ) { @@ -51,7 +51,7 @@ RageSound::RageSound( HWND hWnd ) BASS_GetInfo( &m_info ); - HELPER.Log( + LOG->WriteLine( "Sound card info:\n" " - play latency is %u ms\n" " - total device hardware memory is %u bytes\n" diff --git a/stepmania/src/RageSound.h b/stepmania/src/RageSound.h index e23834836f..21a78714dc 100644 --- a/stepmania/src/RageSound.h +++ b/stepmania/src/RageSound.h @@ -1,3 +1,4 @@ +#pragma once /* ----------------------------------------------------------------------------- File: RageSound.h @@ -5,14 +6,11 @@ Desc: Sound effects library (currently a wrapper around Bass Sound Library). Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ -#ifndef _RAGESOUND_H_ -#define _RAGESOUND_H_ - - #include "bass/bass.h" @@ -37,6 +35,3 @@ private: extern RageSound* SOUND; // global and accessable from anywhere in our program - - -#endif \ No newline at end of file diff --git a/stepmania/src/RageTexture.cpp b/stepmania/src/RageTexture.cpp index f255a6249d..a0861d2c99 100644 --- a/stepmania/src/RageTexture.cpp +++ b/stepmania/src/RageTexture.cpp @@ -27,7 +27,7 @@ RageTexture::RageTexture( const DWORD dwTextureColorDepth, const DWORD dwHints ) { -// HELPER.Log( "RageTexture::RageTexture()" ); +// LOG->WriteLine( "RageTexture::RageTexture()" ); // save a pointer to the D3D device m_pd3dDevice = pScreen->GetDevice(); @@ -68,7 +68,7 @@ void RageTexture::CreateFrameRects() (j+1)/(float)m_iFramesHigh*m_iImageHeight/(float)m_iTextureHeight ); m_TextureCoordRects.Add( frect ); // the index of this array element will be (i + j*m_iFramesWide) - //HELPER.Log( "Adding frect%d %f %f %f %f", (i + j*m_iFramesWide), frect.left, frect.top, frect.right, frect.bottom ); + //LOG->WriteLine( "Adding frect%d %f %f %f %f", (i + j*m_iFramesWide), frect.left, frect.top, frect.right, frect.bottom ); } } } diff --git a/stepmania/src/RageTextureManager.cpp b/stepmania/src/RageTextureManager.cpp index de7f25f5ed..86ffaa4182 100644 --- a/stepmania/src/RageTextureManager.cpp +++ b/stepmania/src/RageTextureManager.cpp @@ -17,7 +17,7 @@ #include "RageBitmapTexture.h" #include "RageMovieTexture.h" #include "RageUtil.h" -#include "RageHelper.h" +#include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" RageTextureManager* TEXTURE = NULL; @@ -43,7 +43,7 @@ RageTextureManager::~RageTextureManager() while( pos != NULL ) // iterate over all k/v pairs in map { m_mapPathToTexture.GetNextAssoc( pos, sPath, pTexture ); - HELPER.Log( "TEXTURE LEAK: '%s', RefCount = %d.", sPath, pTexture->m_iRefCount ); + LOG->WriteLine( "TEXTURE LEAK: '%s', RefCount = %d.", sPath, pTexture->m_iRefCount ); SAFE_DELETE( pTexture ); } @@ -58,7 +58,7 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, const DWORD { sTexturePath.MakeLower(); -// HELPER.Log( "RageTextureManager::LoadTexture(%s).", sTexturePath ); +// LOG->WriteLine( "RageTextureManager::LoadTexture(%s).", sTexturePath ); // holder for the new texture RageTexture* pTexture; @@ -74,7 +74,7 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, const DWORD if( bForceReload ) pTexture->Reload( m_dwMaxTextureSize, m_dwTextureColorDepth, dwHints ); - HELPER.Log( "RageTextureManager: '%s' now has %d references.", sTexturePath, pTexture->m_iRefCount ); + LOG->WriteLine( "RageTextureManager: '%s' now has %d references.", sTexturePath, pTexture->m_iRefCount ); } else // the texture is not already loaded { @@ -87,7 +87,7 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, const DWORD pTexture = (RageTexture*) new RageBitmapTexture( m_pScreen, sTexturePath, m_dwMaxTextureSize, m_dwTextureColorDepth, dwHints ); - HELPER.Log( "RageTextureManager: Finished loading '%s' - %d references.", sTexturePath ); + LOG->WriteLine( "RageTextureManager: Finished loading '%s' - %d references.", sTexturePath ); m_mapPathToTexture.SetAt( sTexturePath, pTexture ); @@ -113,11 +113,11 @@ void RageTextureManager::UnloadTexture( CString sTexturePath ) { sTexturePath.MakeLower(); -// HELPER.Log( "RageTextureManager::UnloadTexture(%s).", sTexturePath ); +// LOG->WriteLine( "RageTextureManager::UnloadTexture(%s).", sTexturePath ); if( sTexturePath == "" ) { - HELPER.Log( "RageTextureManager::UnloadTexture(): tried to Unload a blank texture." ); + LOG->WriteLine( "RageTextureManager::UnloadTexture(): tried to Unload a blank texture." ); return; } @@ -128,13 +128,13 @@ void RageTextureManager::UnloadTexture( CString sTexturePath ) pTexture->m_iRefCount--; if( pTexture->m_iRefCount == 0 ) // there are no more references to this texture { - HELPER.Log( ssprintf("RageTextureManager: '%s' will be deleted. It has %d references.", sTexturePath, pTexture->m_iRefCount) ); + LOG->WriteLine( ssprintf("RageTextureManager: '%s' will be deleted. It has %d references.", sTexturePath, pTexture->m_iRefCount) ); SAFE_DELETE( pTexture ); // free the texture m_mapPathToTexture.RemoveKey( sTexturePath ); // and remove the key in the map } else { - HELPER.Log( "RageTextureManager: '%s' will not be deleted. It still has %d references.", sTexturePath, pTexture->m_iRefCount ); + LOG->WriteLine( "RageTextureManager: '%s' will not be deleted. It still has %d references.", sTexturePath, pTexture->m_iRefCount ); } } else // texture not found diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 91894f54b5..3819ed99d0 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -293,7 +293,7 @@ DWORD GetFileSizeInBytes( const CString &sFilePath ) bool DoesFileExist( const CString &sPath ) { - //HELPER.Log( "DoesFileExist(%s)", sPath ); + //LOG->WriteLine( "DoesFileExist(%s)", sPath ); DWORD dwAttr = GetFileAttributes( sPath ); if( dwAttr == (DWORD)-1 ) diff --git a/stepmania/src/RandomSample.cpp b/stepmania/src/RandomSample.cpp index d8f30ccb65..bb196f5e25 100644 --- a/stepmania/src/RandomSample.cpp +++ b/stepmania/src/RandomSample.cpp @@ -13,7 +13,7 @@ #include "RandomSample.h" #include "RageUtil.h" -#include "RageHelper.h" +#include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" @@ -47,7 +47,7 @@ bool RandomSample::LoadSoundDir( CString sDir ) bool RandomSample::LoadSound( CString sSoundFilePath ) { - HELPER.Log( "RandomSample::LoadSound( %s )", sSoundFilePath ); + LOG->WriteLine( "RandomSample::LoadSound( %s )", sSoundFilePath ); RageSoundSample* pSS = new RageSoundSample; pSS->Load( sSoundFilePath ); @@ -63,7 +63,7 @@ void RandomSample::PlayRandom() // play one of the samples if( m_pSamples.GetSize() == 0 ) { - HELPER.Log( "WARNING: Tried to play a RandomSample that has 0 sounds loaded." ); + LOG->WriteLine( "WARNING: Tried to play a RandomSample that has 0 sounds loaded." ); } else { diff --git a/stepmania/src/ScoreDisplayRolling.cpp b/stepmania/src/ScoreDisplayRolling.cpp index 7402652396..b54e327a7d 100644 --- a/stepmania/src/ScoreDisplayRolling.cpp +++ b/stepmania/src/ScoreDisplayRolling.cpp @@ -11,13 +11,13 @@ #include "ScoreDisplayRolling.h" #include "RageUtil.h" -#include "RageHelper.h" +#include "RageLog.h" #include "ThemeManager.h" ScoreDisplayRolling::ScoreDisplayRolling() { - HELPER.Log( "ScoreDisplayRolling::ScoreDisplayRolling()" ); + LOG->WriteLine( "ScoreDisplayRolling::ScoreDisplayRolling()" ); // init the text Load( THEME->GetPathTo(FONT_SCORE_NUMBERS) ); diff --git a/stepmania/src/ScrollBar.cpp b/stepmania/src/ScrollBar.cpp new file mode 100644 index 0000000000..09c33c684a --- /dev/null +++ b/stepmania/src/ScrollBar.cpp @@ -0,0 +1,52 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: ScrollBar + + Desc: See header. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ScrollBar.h" +#include "ThemeManager.h" +#include "GameConstantsAndTypes.h" + + +const float BAR_HEIGHT = 376; + +ScrollBar::ScrollBar() +{ + m_sprBackground.Load( THEME->GetPathTo(GRAPHIC_SCROLLBAR_PARTS) ); + m_sprBackground.StopAnimating(); + m_sprBackground.SetState( 2 ); + m_sprBackground.SetZoomY( BAR_HEIGHT/m_sprBackground.GetUnzoomedHeight() ); + this->AddActor( &m_sprBackground ); + + m_sprTopButton.Load( THEME->GetPathTo(GRAPHIC_SCROLLBAR_PARTS) ); + m_sprTopButton.StopAnimating(); + m_sprTopButton.SetState( 0 ); + m_sprTopButton.SetY( -BAR_HEIGHT/2 ); + this->AddActor( &m_sprTopButton ); + + m_sprBottomButton.Load( THEME->GetPathTo(GRAPHIC_SCROLLBAR_PARTS) ); + m_sprBottomButton.StopAnimating(); + m_sprBottomButton.SetState( 3 ); + m_sprBottomButton.SetY( BAR_HEIGHT/2 ); + this->AddActor( &m_sprBottomButton ); + + m_sprScrollThumb.Load( THEME->GetPathTo(GRAPHIC_SCROLLBAR_PARTS) ); + m_sprScrollThumb.StopAnimating(); + m_sprScrollThumb.SetState( 1 ); + m_sprScrollThumb.SetY( CENTER_Y ); + this->AddActor( &m_sprScrollThumb ); +} + +void ScrollBar::SetPercentage( float fPercentageFromTop ) +{ + if( fPercentageFromTop < 0 ) fPercentageFromTop += 1; + fPercentageFromTop = fmodf( fPercentageFromTop, 1 ); + m_sprScrollThumb.SetY( -BAR_HEIGHT/2+16 + fPercentageFromTop*(BAR_HEIGHT-32) ); +} diff --git a/stepmania/src/ScrollBar.h b/stepmania/src/ScrollBar.h new file mode 100644 index 0000000000..3a48a3a71e --- /dev/null +++ b/stepmania/src/ScrollBar.h @@ -0,0 +1,27 @@ +#pragma once +/* +----------------------------------------------------------------------------- + Class: ScrollBar + + Desc: A graphic displayed in the ScrollBar during Dancing. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ActorFrame.h" +#include "Sprite.h" + + +class ScrollBar : public ActorFrame +{ +public: + ScrollBar(); + + void SetPercentage( float fPercentageFromTop ); + +private: + Sprite m_sprTopButton, m_sprBottomButton; + Sprite m_sprBackground, m_sprScrollThumb; +}; diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index a49e1e3b63..907f105631 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -15,7 +15,7 @@ #include "Song.h" #include // for fmod -#include "RageHelper.h" +#include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" @@ -79,7 +79,7 @@ Song::Song() void Song::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut ) { -// HELPER.Log( "GetBeatAndBPSFromElapsedTime( fElapsedTime = %f )", fElapsedTime ); +// LOG->WriteLine( "GetBeatAndBPSFromElapsedTime( fElapsedTime = %f )", fElapsedTime ); // This function is a nightmare. Don't even try to understand it. :-) fElapsedTime += m_fOffsetInSeconds; @@ -174,10 +174,29 @@ float Song::GetElapsedTimeFromBeat( float fBeat ) return fElapsedTimeBestGuess; } +void Song::GetMainAndSubTitlesFromFullTitle( CString sFullTitle, CString &sMainTitleOut, CString &sSubTitleOut ) +{ + char szSeps[] = { '-', '~' }; + for( int i=0; iWriteLine( "Song::LoadFromSongDir(%s)", sDir ); // make sure there is a trailing '\\' at the end of sDir if( sDir.Right(1) != "\\" ) @@ -222,7 +241,7 @@ bool Song::LoadFromSongDir( CString sDir ) bool Song::LoadFromBMSDir( CString sDir ) { - HELPER.Log( "Song::LoadFromBMSDir(%s)", sDir ); + LOG->WriteLine( "Song::LoadFromBMSDir(%s)", sDir ); // make sure there is a trailing '\\' at the end of sDir if( sDir.Right(1) != "\\" ) @@ -323,7 +342,7 @@ bool Song::LoadFromBMSDir( CString sDir ) // add, then sort m_BPMSegments.Add( new_seg ); SortBPMSegmentsArray( m_BPMSegments ); - HELPER.Log( "Inserting new BPM change at beat %f, BPM %f", new_seg.m_fStartBeat, new_seg.m_fBPM ); + LOG->WriteLine( "Inserting new BPM change at beat %f, BPM %f", new_seg.m_fStartBeat, new_seg.m_fBPM ); } else if( -1 != value_name.Find("#backbmp") ) { @@ -352,7 +371,7 @@ bool Song::LoadFromBMSDir( CString sDir ) } const int iNumNotesInThisMeasure = arrayNotes.GetSize(); - //HELPER.Log( "%s:%s: iMeasureNo = %d, iTrackNum = %d, iNumNotesInThisMeasure = %d", + //LOG->WriteLine( "%s:%s: iMeasureNo = %d, iTrackNum = %d, iNumNotesInThisMeasure = %d", // valuename, sNoteData, iMeasureNo, iTrackNum, iNumNotesInThisMeasure ); for( int j=0; jWriteLine( "Found offset to be index %d, beat %f", iStepIndex, NoteIndexToBeat(iStepIndex) ); break; case 03: // bpm BPMSegment new_seg; @@ -389,7 +408,7 @@ bool Song::LoadFromBMSDir( CString sDir ) } for( i=0; iWriteLine( "There is a BPM change at beat %f, BPM %f, index %d", m_BPMSegments[i].m_fStartBeat, m_BPMSegments[i].m_fBPM, i ); @@ -402,7 +421,7 @@ bool Song::LoadFromBMSDir( CString sDir ) bool Song::LoadFromDWIFile( CString sPath ) { - HELPER.Log( "Song::LoadFromDWIFile(%s)", sPath ); + LOG->WriteLine( "Song::LoadFromDWIFile(%s)", sPath ); // save song file path m_sSongFilePath = sPath; @@ -523,7 +542,7 @@ bool Song::LoadFromDWIFile( CString sPath ) new_seg.m_fStartBeat = fFreezeBeat; new_seg.m_fFreezeSeconds = fFreezeSeconds; - HELPER.Log( "Adding a freeze segment: beat: %f, seconds = %f", new_seg.m_fStartBeat, new_seg.m_fFreezeSeconds ); + LOG->WriteLine( "Adding a freeze segment: beat: %f, seconds = %f", new_seg.m_fStartBeat, new_seg.m_fFreezeSeconds ); m_FreezeSegments.Add( new_seg ); // add to back for now (we'll sort later) SortFreezeSegmentsArray( m_FreezeSegments ); @@ -580,7 +599,7 @@ bool Song::LoadFromDWIFile( CString sPath ) bool Song::LoadFromSMDir( CString sDir ) { - HELPER.Log( "Song::LoadFromSMDir(%s)", sDir ); + LOG->WriteLine( "Song::LoadFromSMDir(%s)", sDir ); int i; @@ -716,7 +735,7 @@ bool Song::LoadFromSMDir( CString sDir ) new_seg.m_fStartBeat = fFreezeBeat; new_seg.m_fFreezeSeconds = fFreezeSeconds; - HELPER.Log( "Adding a freeze segment: beat: %f, seconds = %f", new_seg.m_fStartBeat, new_seg.m_fFreezeSeconds ); + LOG->WriteLine( "Adding a freeze segment: beat: %f, seconds = %f", new_seg.m_fStartBeat, new_seg.m_fFreezeSeconds ); m_FreezeSegments.Add( new_seg ); // add to back for now (we'll sort later) SortFreezeSegmentsArray( m_FreezeSegments ); @@ -746,7 +765,7 @@ bool Song::LoadFromSMDir( CString sDir ) } else - HELPER.Log( "Unexpected value named '%s'", sValueName ); + LOG->WriteLine( "Unexpected value named '%s'", sValueName ); } TidyUpData(); @@ -986,13 +1005,13 @@ void Song::SaveOffsetChangeToDisk() */ void Song::Save() { - HELPER.Log( "Song::Save()" ); + LOG->WriteLine( "Song::Save()" ); int i; if( -1 != m_sSongDir.Find("DWI Support") ) { - HELPER.Log("WARNING: Can't save to DWI support folder!"); + LOG->WriteLine("WARNING: Can't save to DWI support folder!"); return; } diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 1bd7fdaa0b..704cea3bf3 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -13,7 +13,7 @@ //#include #include "SongManager.h" #include "IniFile.h" -#include "RageHelper.h" +#include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" SongManager* SONG = NULL; // global and accessable from anywhere in our program @@ -71,7 +71,7 @@ void SongManager::InitSongArrayFromDisk() m_arrayGroupNames.Add( sGroupName ); } - HELPER.Log( "Found %d Songs.", m_pSongs.GetSize() ); + LOG->WriteLine( "Found %d Songs.", m_pSongs.GetSize() ); } void SongManager::LoadStepManiaSongDir( CString sDir ) @@ -111,7 +111,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir ) if( arrayGroupBanners.GetSize() > 0 ) { m_mapGroupToBannerPath[sGroupDirName] = ssprintf("%s\\%s\\%s", sDir, sGroupDirName, arrayGroupBanners[0] ); - HELPER.Log( ssprintf("Group banner for '%s' is '%s'.", sGroupDirName, m_mapGroupToBannerPath[sGroupDirName]) ); + LOG->WriteLine( ssprintf("Group banner for '%s' is '%s'.", sGroupDirName, m_mapGroupToBannerPath[sGroupDirName]) ); } // Find all Song folders in this group directory @@ -213,7 +213,7 @@ void SongManager::ReadStatisticsFromDisk() IniFile ini; ini.SetPath( g_sStatisticsFileName ); if( !ini.ReadFile() ) { - HELPER.Log( "WARNING: Could not read config file '%s'.", g_sStatisticsFileName ); + LOG->WriteLine( "WARNING: Could not read config file '%s'.", g_sStatisticsFileName ); return; // load nothing } diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 7d4e025f3b..e5ee5b532e 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -12,10 +12,9 @@ #include "Sprite.h" #include "RageTextureManager.h" -#include "PrefsManager.h" #include "IniFile.h" #include -#include "RageHelper.h" +#include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" @@ -32,7 +31,7 @@ Sprite::Sprite() Sprite::~Sprite() { -// HELPER.Log( "Sprite Destructor" ); +// LOG->WriteLine( "Sprite Destructor" ); TEXTURE->UnloadTexture( m_sTexturePath ); } @@ -40,7 +39,7 @@ Sprite::~Sprite() bool Sprite::LoadFromTexture( CString sTexturePath, DWORD dwHints, bool bForceReload ) { - HELPER.Log( ssprintf("Sprite::LoadFromTexture(%s)", sTexturePath) ); + LOG->WriteLine( ssprintf("Sprite::LoadFromTexture(%s)", sTexturePath) ); //Init(); return LoadTexture( sTexturePath, dwHints, bForceReload ); @@ -56,7 +55,7 @@ bool Sprite::LoadFromTexture( CString sTexturePath, DWORD dwHints, bool bForceRe // Delay0000=2.0 bool Sprite::LoadFromSpriteFile( CString sSpritePath, DWORD dwHints, bool bForceReload ) { - HELPER.Log( ssprintf("Sprite::LoadFromSpriteFile(%s)", sSpritePath) ); + LOG->WriteLine( ssprintf("Sprite::LoadFromSpriteFile(%s)", sSpritePath) ); //Init(); @@ -269,7 +268,7 @@ void Sprite::RenderPrimitives() ////////////////////// // render the shadow ////////////////////// - if( m_bShadow && PREFS && PREFS->GetCurrentGraphicProfileOptions()->m_bShadows ) + if( m_bShadow ) { SCREEN->PushMatrix(); SCREEN->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units diff --git a/stepmania/src/StdAfx.h b/stepmania/src/StdAfx.h index 0b28df6890..c813681dd0 100644 --- a/stepmania/src/StdAfx.h +++ b/stepmania/src/StdAfx.h @@ -28,7 +28,7 @@ // // Rage global classes // -#include "RageHelper.h" +#include "RageLog.h" #include "RageScreen.h" #include "RageTextureManager.h" #include "RageSound.h" diff --git a/stepmania/src/StepMania.ICO b/stepmania/src/StepMania.ICO index ba69fbb699..09ecd2db8c 100644 Binary files a/stepmania/src/StepMania.ICO and b/stepmania/src/StepMania.ICO differ diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index b2aef97d8c..3b29585385 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -30,8 +30,8 @@ // StepMania common classes // #include "Font.h" -#include "GameConstants.h" -#include "GameTypes.h" +#include "GameConstantsAndTypes.h" +#include "GameConstantsAndTypes.h" #include "GameInput.h" #include "StyleInput.h" #include "Song.h" @@ -46,7 +46,7 @@ #include "WindowPlayerOptions.h" #include "WindowMusicScroll.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" // error catcher stuff #include "ErrorCatcher/ErrorCatcher.h" @@ -254,10 +254,8 @@ void MainLoop() { Update(); Render(); - //if( !g_bFullscreen ) -#ifdef DEBUG - ::Sleep(1 ); // give some time for the movie decoding thread -#endif + if( SCREEN && SCREEN->IsWindowed() ) + ::Sleep( 0 ); // give some time to other processes } } // end while( WM_QUIT != msg.message ) @@ -312,7 +310,7 @@ BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) } break; case IDC_BUTTON_REPORT: - GotoURL( "Docs/report.htm" ); + GotoURL( "http://sourceforge.net/tracker/?func=add&group_id=37892&atid=421366" ); break; case IDC_BUTTON_RESTART: { @@ -417,7 +415,10 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) ApplyGraphicOptions(); return 0; case IDM_CHANGEDETAIL: - PREFS->m_GraphicProfile = GraphicProfile( (PREFS->m_GraphicProfile+1)%NUM_GRAPHIC_PROFILES ); + if( PREFS->m_GraphicProfile == PROFILE_LOW ) + PREFS->m_GraphicProfile = PROFILE_MEDIUM; + else + PREFS->m_GraphicProfile = PROFILE_LOW; ApplyGraphicOptions(); return 0; case IDM_EXIT: @@ -487,6 +488,7 @@ HRESULT CreateObjects( HWND hWnd ) // srand( (unsigned)time(NULL) ); // seed number generator + LOG = new RageLog(); SOUND = new RageSound( hWnd ); MUSIC = new RageSoundStream; INPUTM = new RageInput( hWnd ); @@ -555,6 +557,7 @@ void DestroyObjects() SAFE_DELETE( SOUND ); SAFE_DELETE( TEXTURE ); SAFE_DELETE( SCREEN ); + SAFE_DELETE( LOG ); } diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 6d126e6375..e3282129c2 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -100,14 +100,6 @@ SOURCE=.\RageBitmapTexture.h # End Source File # Begin Source File -SOURCE=.\RageHelper.cpp -# End Source File -# Begin Source File - -SOURCE=.\RageHelper.h -# End Source File -# Begin Source File - SOURCE=.\RageInput.cpp # End Source File # Begin Source File @@ -116,6 +108,14 @@ SOURCE=.\RageInput.h # End Source File # Begin Source File +SOURCE=.\RageLog.cpp +# End Source File +# Begin Source File + +SOURCE=.\RageLog.h +# End Source File +# Begin Source File + SOURCE=.\RageMovieTexture.cpp # End Source File # Begin Source File @@ -216,14 +216,6 @@ SOURCE=.\WindowConfigurePads.h # End Source File # Begin Source File -SOURCE=.\WindowCustomGraphicOptions.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowCustomGraphicOptions.h -# End Source File -# Begin Source File - SOURCE=.\WindowDancing.cpp # End Source File # Begin Source File @@ -744,6 +736,22 @@ SOURCE=.\Banner.h # End Source File # Begin Source File +SOURCE=.\BannerWithFrame.cpp +# End Source File +# Begin Source File + +SOURCE=.\BannerWithFrame.h +# End Source File +# Begin Source File + +SOURCE=.\BonusInfoFrame.cpp +# End Source File +# Begin Source File + +SOURCE=.\BonusInfoFrame.h +# End Source File +# Begin Source File + SOURCE=.\BPMDisplay.cpp # End Source File # Begin Source File @@ -840,6 +848,14 @@ SOURCE=.\MusicWheel.h # End Source File # Begin Source File +SOURCE=.\ScrollBar.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScrollBar.h +# End Source File +# Begin Source File + SOURCE=.\SongInfoFrame.cpp # End Source File # Begin Source File diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 49e15d8265..31dd08c25e 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -158,12 +158,6 @@ - - - - @@ -322,7 +316,7 @@ RelativePath=".\FontManager.h"> + RelativePath="GameConstantsAndTypes.h"> @@ -440,9 +434,6 @@ - - @@ -569,6 +560,18 @@ + + + + + + + + @@ -635,6 +638,12 @@ + + + + @@ -781,18 +790,18 @@ - - - - + + + + diff --git a/stepmania/src/StyleDef.cpp b/stepmania/src/StyleDef.cpp index d6a6025cf5..89699d8131 100644 --- a/stepmania/src/StyleDef.cpp +++ b/stepmania/src/StyleDef.cpp @@ -10,7 +10,7 @@ */ #include "StyleDef.h" -#include "RageHelper.h" +#include "RageLog.h" #include "RageUtil.h" #include "ErrorCatcher/ErrorCatcher.h" #include "GameDef.h" @@ -19,7 +19,7 @@ StyleDef::StyleDef( GameDef* pGameDef, CString sStyleFilePath ) { - HELPER.Log( "StyleDef::StyleDef( '%s )", sStyleFilePath ); + LOG->WriteLine( "StyleDef::StyleDef( '%s )", sStyleFilePath ); // extract the game name CString sThrowAway; @@ -140,4 +140,18 @@ StyleDef::StyleDef( GameDef* pGameDef, CString sStyleFilePath ) for( int c=0; cAddActor( &m_textTitle ); this->AddActor( &m_textSubTitle ); this->AddActor( &m_textArtist ); diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index e1451bae02..d8e69748c1 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -11,7 +11,7 @@ */ #include "ThemeManager.h" -#include "RageHelper.h" +#include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" @@ -25,7 +25,7 @@ ThemeManager::ThemeManager() for( int i=0; iWriteLine( "TipDisplay::TipDisplay()" ); m_textTip.Load( THEME->GetPathTo(FONT_NORMAL) ); this->AddActor( &m_textTip ); diff --git a/stepmania/src/TransitionFade.cpp b/stepmania/src/TransitionFade.cpp index 17b58af4b0..2dd2634e08 100644 --- a/stepmania/src/TransitionFade.cpp +++ b/stepmania/src/TransitionFade.cpp @@ -13,7 +13,7 @@ #include "RageUtil.h" #include "TransitionFade.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" diff --git a/stepmania/src/TransitionFadeWipe.cpp b/stepmania/src/TransitionFadeWipe.cpp index b0d42813c7..ce310db260 100644 --- a/stepmania/src/TransitionFadeWipe.cpp +++ b/stepmania/src/TransitionFadeWipe.cpp @@ -12,7 +12,7 @@ #include "RageUtil.h" #include "TransitionFadeWipe.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "ThemeManager.h" //#define RECTANGLE_WIDTH 20 diff --git a/stepmania/src/TransitionInvisible.cpp b/stepmania/src/TransitionInvisible.cpp index 0d00e4a103..dfbcffdc2a 100644 --- a/stepmania/src/TransitionInvisible.cpp +++ b/stepmania/src/TransitionInvisible.cpp @@ -13,7 +13,7 @@ #include "RageUtil.h" #include "TransitionInvisible.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" diff --git a/stepmania/src/TransitionKeepAlive.cpp b/stepmania/src/TransitionKeepAlive.cpp index 31aa6366a7..8e01f0acb2 100644 --- a/stepmania/src/TransitionKeepAlive.cpp +++ b/stepmania/src/TransitionKeepAlive.cpp @@ -12,18 +12,19 @@ #include "RageUtil.h" #include "TransitionKeepAlive.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "ThemeManager.h" -const float KEEP_ALIVE_TRANSITION_TIME = 1.0f; +const float KEEP_ALIVE_FORWARD_TRANSITION_TIME = 0.8f; +const float KEEP_ALIVE_BACKWARD_TRANSITION_TIME = 0.4f; TransitionKeepAlive::TransitionKeepAlive() { - this->SetTransitionTime( KEEP_ALIVE_TRANSITION_TIME ); - m_sprLogo.Load( THEME->GetPathTo(GRAPHIC_KEEP_ALIVE) ); m_sprLogo.SetXY( CENTER_X, CENTER_Y ); + + m_rect.StretchTo( CRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT) ); } void TransitionKeepAlive::Update( float fDeltaTime ) @@ -37,15 +38,60 @@ void TransitionKeepAlive::Update( float fDeltaTime ) void TransitionKeepAlive::RenderPrimitives() { - float fPercentClosed = 1 - this->GetPercentageOpen(); - fPercentClosed = min( 1, fPercentClosed*2 ); - const float fPercentColor = fPercentClosed; - const float fPercentAlpha = min( fPercentClosed * 2, 1 ); + if( m_TransitionState == closing_left ) // we're going back + { + // Draw a fade - m_sprLogo.SetDiffuseColor( D3DXCOLOR(fPercentColor,fPercentColor,fPercentColor,fPercentAlpha) ); - m_sprLogo.SetZoomY( fPercentClosed ); - if( fPercentClosed > 0 ) - m_sprLogo.Draw(); + const float fPercentageOpaque = 1 - GetPercentageOpen(); + if( fPercentageOpaque == 0 ) + return; // draw nothing + + D3DXCOLOR colorTemp = m_Color * fPercentageOpaque; + m_rect.SetDiffuseColor( colorTemp ); + m_rect.Draw(); + } + else // we're going forward + { + // draw keep alive graphic + + float fPercentClosed = 1 - this->GetPercentageOpen(); + fPercentClosed = min( 1, fPercentClosed*2 ); + const float fPercentColor = fPercentClosed; + const float fPercentAlpha = min( fPercentClosed * 2, 1 ); + + m_sprLogo.SetDiffuseColor( D3DXCOLOR(fPercentColor,fPercentColor,fPercentColor,fPercentAlpha) ); + m_sprLogo.SetZoomY( fPercentClosed ); + if( fPercentClosed > 0 ) + m_sprLogo.Draw(); + } } +void TransitionKeepAlive::OpenWipingRight( WindowMessage send_when_done ) +{ + this->SetTransitionTime( KEEP_ALIVE_FORWARD_TRANSITION_TIME ); + + Transition::OpenWipingRight( send_when_done ); +} + +void TransitionKeepAlive::OpenWipingLeft( WindowMessage send_when_done ) +{ + this->SetTransitionTime( KEEP_ALIVE_BACKWARD_TRANSITION_TIME ); + + Transition::OpenWipingLeft( send_when_done ); +} + +void TransitionKeepAlive::CloseWipingRight(WindowMessage send_when_done ) +{ + this->SetTransitionTime( KEEP_ALIVE_FORWARD_TRANSITION_TIME ); + + Transition::CloseWipingRight( send_when_done ); +} + +void TransitionKeepAlive::CloseWipingLeft( WindowMessage send_when_done ) +{ + this->SetTransitionTime( KEEP_ALIVE_BACKWARD_TRANSITION_TIME ); + + Transition::CloseWipingLeft( send_when_done ); +} + diff --git a/stepmania/src/TransitionKeepAlive.h b/stepmania/src/TransitionKeepAlive.h index 10c96e129d..855fdb0cc5 100644 --- a/stepmania/src/TransitionKeepAlive.h +++ b/stepmania/src/TransitionKeepAlive.h @@ -24,8 +24,14 @@ public: virtual void Update( float fDeltaTime ); virtual void RenderPrimitives(); + virtual void OpenWipingRight( WindowMessage send_when_done = SM_None ); + virtual void OpenWipingLeft( WindowMessage send_when_done = SM_None ); + virtual void CloseWipingRight(WindowMessage send_when_done = SM_None ); + virtual void CloseWipingLeft( WindowMessage send_when_done = SM_None ); + protected: Sprite m_sprLogo; + RectangleActor m_rect; }; diff --git a/stepmania/src/TransitionRectWipe.cpp b/stepmania/src/TransitionRectWipe.cpp index 11edee09a7..a63a68be2d 100644 --- a/stepmania/src/TransitionRectWipe.cpp +++ b/stepmania/src/TransitionRectWipe.cpp @@ -14,9 +14,6 @@ #include "TransitionRectWipe.h" -#define SCREEN_WIDTH 640 -#define SCREEN_HEIGHT 480 - #define RECTANGLE_WIDTH 20 #define NUM_RECTANGLES (SCREEN_WIDTH/RECTANGLE_WIDTH) #define FADE_RECTS_WIDE (NUM_RECTANGLES/4) // number of rects from fade start to fade end diff --git a/stepmania/src/TransitionStarWipe.cpp b/stepmania/src/TransitionStarWipe.cpp index e6024c5aed..ca670ede76 100644 --- a/stepmania/src/TransitionStarWipe.cpp +++ b/stepmania/src/TransitionStarWipe.cpp @@ -12,7 +12,7 @@ #include "RageUtil.h" #include "TransitionStarWipe.h" -#include "ScreenDimensions.h" +#include "GameConstantsAndTypes.h" #include "ThemeManager.h" diff --git a/stepmania/src/log.txt b/stepmania/src/log.txt index 6a11a9825a..5785175280 100644 --- a/stepmania/src/log.txt +++ b/stepmania/src/log.txt @@ -1,10 +1,10 @@ log.txt: last compiled on Sun Apr 7 14:19:25 2002. -Log starting 2002-04-28 12:00:05 +Log starting 2002-04-30 13:16:42 RageSound::RageSound() Sound card info: - - play latency is 2 ms + - play latency is 3 ms - total device hardware memory is 0 bytes - free device hardware memory is 0 bytes - number of free sample slots in the hardware is 94 @@ -149,18 +149,10 @@ Present Parameters: 640, 480, 22, 1, 0, 1, 0, 1, 1, 80, 0, 0, 0 Mode change was successful. BitmapText::LoadFromFontName(Themes\default\Fonts\Normal.font) RageBitmapTexture: Loaded 'themes\default\fonts\normal 16x16.png' (512x512) from disk. bScaleImageToTextureSize = 0, source 512,512; image 512,512. -RageTextureManager: Finished loading 'themes\default\fonts\normal 16x16.png' - 1237280 references. +RageTextureManager: Finished loading 'themes\default\fonts\normal 16x16.png' - 1237292 references. FontManager: Loading 'themes\default\fonts\normal.font' from disk. BitmapText::LoadFromFontName(Themes\default\Fonts\Normal.font) FontManager: The Font 'themes\default\fonts\normal.font' now has 1 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Normal.font) -FontManager: The Font 'themes\default\fonts\normal.font' now has 2 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Normal.font) -FontManager: The Font 'themes\default\fonts\normal.font' now has 3 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Normal.font) -FontManager: The Font 'themes\default\fonts\normal.font' now has 4 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Normal.font) -FontManager: The Font 'themes\default\fonts\normal.font' now has 5 references. RageScreen::SwitchDisplayModes( 1, 640, 480, 16 ) Testing format: display 22, back buffer 23, windowed 1... This won't work. Keep searching. @@ -174,96 +166,9 @@ Testing format: display 22, back buffer 22, windowed 1... This will work. Present Parameters: 640, 480, 22, 1, 0, 1, 0, 1, 1, 80, 0, 0, 0 Mode change was successful. -FPS: 2 RageBitmapTexture: Loaded 'themes\default\fonts\normal 16x16.png' (512x512) from disk. bScaleImageToTextureSize = 0, source 512,512; image 512,512. -WindowTitleMenu::WindowTitleMenu() -Sprite::LoadFromTexture(Themes\default\Graphics\title menu background (no alpha).png) -RageBitmapTexture: Loaded 'themes\default\graphics\title menu background (no alpha).png' (512x512) from disk. bScaleImageToTextureSize = 1, source 640,480; image 512,512. -RageTextureManager: Finished loading 'themes\default\graphics\title menu background (no alpha).png' - 1236964 references. -Sprite::LoadFromTexture(Themes\default\Graphics\title menu logo (1 alpha).png) -RageBitmapTexture: Loaded 'themes\default\graphics\title menu logo (1 alpha).png' (512x512) from disk. bScaleImageToTextureSize = 0, source 512,315; image 512,315. -RageTextureManager: Finished loading 'themes\default\graphics\title menu logo (1 alpha).png' - 1236964 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Normal.font) -FontManager: The Font 'themes\default\fonts\normal.font' now has 6 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Normal.font) -FontManager: The Font 'themes\default\fonts\normal.font' now has 7 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Bold.font) -RageBitmapTexture: Loaded 'themes\default\fonts\bold 8x8.png' (256x256) from disk. bScaleImageToTextureSize = 0, source 256,256; image 256,256. -RageTextureManager: Finished loading 'themes\default\fonts\bold 8x8.png' - 1236968 references. -FontManager: Loading 'themes\default\fonts\bold.font' from disk. -BitmapText::LoadFromFontName(Themes\default\Fonts\Bold.font) -FontManager: The Font 'themes\default\fonts\bold.font' now has 1 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Bold.font) -FontManager: The Font 'themes\default\fonts\bold.font' now has 2 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Bold.font) -FontManager: The Font 'themes\default\fonts\bold.font' now has 3 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Bold.font) -FontManager: The Font 'themes\default\fonts\bold.font' now has 4 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Bold.font) -FontManager: The Font 'themes\default\fonts\bold.font' now has 5 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Bold.font) -FontManager: The Font 'themes\default\fonts\bold.font' now has 6 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Bold.font) -FontManager: The Font 'themes\default\fonts\bold.font' now has 7 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Bold.font) -FontManager: The Font 'themes\default\fonts\bold.font' now has 8 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Bold.font) -FontManager: The Font 'themes\default\fonts\bold.font' now has 9 references. -BitmapText::LoadFromFontName(Themes\default\Fonts\Bold.font) -FontManager: The Font 'themes\default\fonts\bold.font' now has 10 references. -RandomStream::LoadSound( Themes\default\Announcer\title\Dance Dance Revolution.mp3 ) -RandomSample::LoadSound( Themes\default\Sounds\title change.mp3 ) -RageSoundSample::Load( Themes\default\Sounds\title change.mp3 ) -RandomSample::LoadSound( Themes\default\Sounds\select.mp3 ) -RageSoundSample::Load( Themes\default\Sounds\select.mp3 ) -RandomSample::LoadSound( Themes\default\Sounds\invalid.mp3 ) -RageSoundSample::Load( Themes\default\Sounds\invalid.mp3 ) -FPS: 1 -FPS: 63 -FPS: 188 -FPS: 248 -FPS: 159 -FPS: 32 -FPS: 219 -FPS: 278 -FPS: 235 -FPS: 30 -FPS: 150 -FPS: 290 -FPS: 148 -FPS: 48 -FPS: 78 -FPS: 70 -FPS: 51 -FPS: 83 -FPS: 137 -FPS: 32 -FPS: 92 -FPS: 44 -FPS: 82 -FPS: 58 -WindowManager::~WindowManager() -WindowTitleMenu::~WindowTitleMenu() -FontManager: 'themes\default\fonts\bold.font' will not be deleted. It still has 10 references. -FontManager: 'themes\default\fonts\bold.font' will not be deleted. It still has 9 references. -FontManager: 'themes\default\fonts\bold.font' will not be deleted. It still has 8 references. -FontManager: 'themes\default\fonts\bold.font' will not be deleted. It still has 7 references. -FontManager: 'themes\default\fonts\bold.font' will not be deleted. It still has 6 references. -FontManager: 'themes\default\fonts\bold.font' will not be deleted. It still has 5 references. -FontManager: 'themes\default\fonts\bold.font' will not be deleted. It still has 4 references. -FontManager: 'themes\default\fonts\bold.font' will not be deleted. It still has 3 references. -FontManager: 'themes\default\fonts\bold.font' will not be deleted. It still has 2 references. -FontManager: 'themes\default\fonts\bold.font' will not be deleted. It still has 1 references. -FontManager: 'themes\default\fonts\bold.font' will be deleted. It has 0 references. -RageTextureManager: 'themes\default\fonts\bold 8x8.png' will be deleted. It has 0 references. -FontManager: 'themes\default\fonts\normal.font' will not be deleted. It still has 7 references. -FontManager: 'themes\default\fonts\normal.font' will not be deleted. It still has 6 references. -RageTextureManager: 'themes\default\graphics\title menu logo (1 alpha).png' will be deleted. It has 0 references. -RageTextureManager: 'themes\default\graphics\title menu background (no alpha).png' will be deleted. It has 0 references. -FontManager: 'themes\default\fonts\normal.font' will not be deleted. It still has 5 references. -FontManager: 'themes\default\fonts\normal.font' will not be deleted. It still has 4 references. -FontManager: 'themes\default\fonts\normal.font' will not be deleted. It still has 3 references. -FontManager: 'themes\default\fonts\normal.font' will not be deleted. It still has 2 references. -FontManager: 'themes\default\fonts\normal.font' will not be deleted. It still has 1 references. -FontManager: 'themes\default\fonts\normal.font' will be deleted. It has 0 references. -RageTextureManager: 'themes\default\fonts\normal 16x16.png' will be deleted. It has 0 references. +WARNING: Didn't find an empty system messages slot. +WARNING: Didn't find an empty system messages slot. +Sprite::LoadFromTexture(Themes\default\Graphics\results banner frame.png) +RageBitmapTexture: Loaded 'themes\default\graphics\results banner frame.png' (256x128) from disk. bScaleImageToTextureSize = 0, source 256,100; image 256,100. +RageTextureManager: Finished loading 'themes\default\graphics\results banner frame.png' - 1236440 references. diff --git a/stepmania/src/smpackage/ZipArchive/ZipArchive.vcproj b/stepmania/src/smpackage/ZipArchive/ZipArchive.vcproj new file mode 100644 index 0000000000..46b385e4e4 --- /dev/null +++ b/stepmania/src/smpackage/ZipArchive/ZipArchive.vcproj @@ -0,0 +1,587 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stepmania/src/song.h b/stepmania/src/song.h index d4d18b2443..7bb8c19a41 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -14,7 +14,7 @@ #include "NoteMetadata.h" -#include "GameTypes.h" +#include "GameConstantsAndTypes.h" #include "RageUtil.h" //enum DanceStyle; // why is this needed? @@ -72,25 +72,8 @@ public: CString GetMainTitle() {return m_sMainTitle; }; CString GetSubTitle() {return m_sSubTitle; }; - void GetMainAndSubTitlesFromFullTitle( CString sFullTitle, CString &sMainTitleOut, CString &sSubTitleOut ) - { - char szSeps[] = { '-', '~' }; - for( int i=0; i