From 78f3e80118705ea82f686e309c77c2b80421fe01 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 16 Apr 2002 17:31:00 +0000 Subject: [PATCH] 2.50 checkin --- stepmania/src/Actor.cpp | 6 +- stepmania/src/Actor.h | 2 +- stepmania/src/ActorFrame.cpp | 2 +- stepmania/src/ActorFrame.h | 2 +- stepmania/src/ArrowEffects.cpp | 11 +- stepmania/src/ArrowEffects.h | 6 +- stepmania/src/BPMDisplay.cpp | 2 +- stepmania/src/BPMDisplay.h | 2 +- stepmania/src/Background.cpp | 2 +- stepmania/src/Background.h | 2 +- stepmania/src/Banner.cpp | 89 +--- stepmania/src/Banner.h | 31 +- stepmania/src/BitmapText.cpp | 48 +- stepmania/src/BitmapText.h | 6 +- stepmania/src/Combo.cpp | 2 +- stepmania/src/Combo.h | 2 +- stepmania/src/CroppedSprite.cpp | 93 ++++ stepmania/src/CroppedSprite.h | 44 ++ stepmania/src/DifficultyIcon.cpp | 2 +- stepmania/src/DifficultyIcon.h | 24 +- stepmania/src/FocusingSprite.cpp | 2 +- stepmania/src/FocusingSprite.h | 2 +- stepmania/src/Font.cpp | 13 +- stepmania/src/Font.h | 2 +- stepmania/src/FontManager.cpp | 5 +- stepmania/src/FontManager.h | 2 +- stepmania/src/FootMeter.cpp | 2 +- stepmania/src/FootMeter.h | 8 +- stepmania/src/GameDef.cpp | 56 +++ stepmania/src/GameDef.h | 64 +++ stepmania/src/GameInput.h | 80 ++++ stepmania/src/GameManager.cpp | 320 +++++++------ stepmania/src/GameManager.h | 52 ++- stepmania/src/GhostArrow.h | 2 +- stepmania/src/GhostArrowBright.h | 2 +- stepmania/src/GhostArrowRow.cpp | 91 ++++ stepmania/src/GhostArrowRow.h | 43 ++ stepmania/src/Grade.cpp | 2 +- stepmania/src/Grade.h | 2 +- stepmania/src/GradeDisplay.cpp | 2 +- stepmania/src/GradeDisplay.h | 2 +- stepmania/src/GrayArrow.cpp | 7 +- stepmania/src/GrayArrow.h | 4 +- stepmania/src/GrayArrowRow.cpp | 73 +++ stepmania/src/GrayArrowRow.h | 43 ++ stepmania/src/GrooveRadar.cpp | 154 ++++++- stepmania/src/GrooveRadar.h | 24 +- stepmania/src/HoldGhostArrow.h | 2 +- stepmania/src/HoldJudgement.cpp | 2 +- stepmania/src/HoldJudgement.h | 2 +- stepmania/src/IniFile.cpp | 2 +- stepmania/src/IniFile.h | 2 +- stepmania/src/InputFilter.cpp | 87 ++++ stepmania/src/InputFilter.h | 56 +++ stepmania/src/InputMapper.cpp | 292 ++++++++++++ stepmania/src/InputMapper.h | 78 ++++ stepmania/src/Judgement.cpp | 2 +- stepmania/src/Judgement.h | 2 +- stepmania/src/MenuElements.cpp | 16 +- stepmania/src/MenuElements.h | 2 +- stepmania/src/MenuInput.h | 46 ++ stepmania/src/MotionBlurSprite.cpp | 2 +- stepmania/src/MotionBlurSprite.h | 2 +- stepmania/src/MusicSortDisplay.cpp | 2 +- stepmania/src/MusicSortDisplay.h | 2 +- stepmania/src/MusicStatusDisplay.cpp | 2 +- stepmania/src/MusicStatusDisplay.h | 2 +- stepmania/src/MusicWheel.cpp | 266 ++++++----- stepmania/src/MusicWheel.h | 15 +- stepmania/src/NoteData.cpp | 640 ++++++++++++++++++++++++++ stepmania/src/NoteData.h | 176 +++++++ stepmania/src/NoteField.cpp | 327 +++++++++++++ stepmania/src/NoteField.h | 78 ++++ stepmania/src/Player.cpp | 179 +++---- stepmania/src/Player.h | 37 +- stepmania/src/PrefsManager.cpp | 335 +------------- stepmania/src/PrefsManager.h | 48 +- stepmania/src/RageBitmapTexture.cpp | 9 +- stepmania/src/RageBitmapTexture.h | 2 +- stepmania/src/RageInput.cpp | 147 +++--- stepmania/src/RageInput.h | 30 +- stepmania/src/RageMovieTexture.cpp | 37 +- stepmania/src/RageMovieTexture.h | 2 +- stepmania/src/RageSound.cpp | 9 +- stepmania/src/RageSound.h | 2 +- stepmania/src/RageTexture.cpp | 2 +- stepmania/src/RageTexture.h | 2 +- stepmania/src/RageTextureManager.cpp | 5 +- stepmania/src/RageTextureManager.h | 2 +- stepmania/src/RageUtil.cpp | 2 +- stepmania/src/RageUtil.h | 9 +- stepmania/src/RandomSample.cpp | 10 +- stepmania/src/RandomSample.h | 2 +- stepmania/src/ScoreDisplayRolling.cpp | 8 +- stepmania/src/ScoreDisplayRolling.h | 2 +- stepmania/src/ScreenDimensions.h | 2 +- stepmania/src/Song.cpp | 479 +++++++++++++++---- stepmania/src/SongManager.cpp | 111 +++-- stepmania/src/SongManager.h | 19 +- stepmania/src/Sprite.cpp | 19 +- stepmania/src/Sprite.h | 3 +- stepmania/src/StdAfx.cpp | 2 +- stepmania/src/StdAfx.h | 14 +- stepmania/src/StepMania.RC | 2 +- stepmania/src/StepMania.cpp | 233 +++++++--- stepmania/src/StepMania.dsp | 200 ++++---- stepmania/src/StepMania.dsw | 15 + stepmania/src/StepMania.h | 2 +- stepmania/src/StepMania.sln | 19 +- stepmania/src/StepMania.vcproj | 273 ++++++----- stepmania/src/StyleDef.cpp | 42 +- stepmania/src/StyleDef.h | 96 ++-- stepmania/src/StyleInput.h | 27 ++ stepmania/src/TextBanner.cpp | 8 +- stepmania/src/TextBanner.h | 4 +- stepmania/src/ThemeManager.cpp | 157 ++++--- stepmania/src/ThemeManager.h | 31 +- stepmania/src/TipDisplay.cpp | 2 +- stepmania/src/TipDisplay.h | 2 +- stepmania/src/Transition.cpp | 2 +- stepmania/src/Transition.h | 2 +- stepmania/src/TransitionFade.cpp | 2 +- stepmania/src/TransitionFade.h | 2 +- stepmania/src/TransitionFadeWipe.cpp | 2 +- stepmania/src/TransitionFadeWipe.h | 2 +- stepmania/src/TransitionInvisible.cpp | 2 +- stepmania/src/TransitionInvisible.h | 2 +- stepmania/src/TransitionKeepAlive.cpp | 2 +- stepmania/src/TransitionKeepAlive.h | 2 +- stepmania/src/TransitionRectWipe.cpp | 2 +- stepmania/src/TransitionRectWipe.h | 2 +- stepmania/src/TransitionStarWipe.cpp | 2 +- stepmania/src/TransitionStarWipe.h | 2 +- stepmania/src/resource.h | 3 +- stepmania/src/song.h | 75 ++- 135 files changed, 4566 insertions(+), 1725 deletions(-) create mode 100644 stepmania/src/CroppedSprite.cpp create mode 100644 stepmania/src/CroppedSprite.h create mode 100644 stepmania/src/GameDef.cpp create mode 100644 stepmania/src/GameDef.h create mode 100644 stepmania/src/GameInput.h create mode 100644 stepmania/src/GhostArrowRow.cpp create mode 100644 stepmania/src/GhostArrowRow.h create mode 100644 stepmania/src/GrayArrowRow.cpp create mode 100644 stepmania/src/GrayArrowRow.h create mode 100644 stepmania/src/InputFilter.cpp create mode 100644 stepmania/src/InputFilter.h create mode 100644 stepmania/src/InputMapper.cpp create mode 100644 stepmania/src/InputMapper.h create mode 100644 stepmania/src/MenuInput.h create mode 100644 stepmania/src/NoteData.cpp create mode 100644 stepmania/src/NoteData.h create mode 100644 stepmania/src/NoteField.cpp create mode 100644 stepmania/src/NoteField.h create mode 100644 stepmania/src/StyleInput.h diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 6f8a74622e..f9f300ad4c 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -5,7 +5,7 @@ Desc: Base class for all objects that appear on the screen. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -40,7 +40,7 @@ Actor::Actor() if( PREFS ) m_bShadow = PREFS->m_GraphicOptions.m_bShadows; else m_bShadow = true; - m_fShadowLength = 5; + m_fShadowLength = 4; m_bBlendAdd = false; } @@ -278,7 +278,7 @@ void Actor::BeginTweening( float time, TweenType tt ) void Actor::BeginTweeningQueued( float time, TweenType tt ) { - ASSERT( time > 0 ); + ASSERT( time >= 0 ); // add a new TweenState to the tail, and initialize it m_QueuedTweens.Add( TweenState() ); diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 2a6834be01..5e2b03aadb 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -4,7 +4,7 @@ Desc: Base class for all objects that appear on the screen. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index 3585ae91e0..5e13d8cded 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -5,7 +5,7 @@ Desc: Base class for all objects that appear on the screen. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/ActorFrame.h b/stepmania/src/ActorFrame.h index af41b586d5..800cfb67d8 100644 --- a/stepmania/src/ActorFrame.h +++ b/stepmania/src/ActorFrame.h @@ -4,7 +4,7 @@ Desc: Base class for all objects that appear on the screen. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/ArrowEffects.cpp b/stepmania/src/ArrowEffects.cpp index 7db1379384..8cc3a9bebc 100644 --- a/stepmania/src/ArrowEffects.cpp +++ b/stepmania/src/ArrowEffects.cpp @@ -5,14 +5,15 @@ Desc: Functions that return properties of arrows based on StyleDef and PlayerOptions - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ #include "ArrowEffects.h" -#include "Pattern.h" +#include "NoteMetadata.h" #include "ColorArrow.h" #include "ScreenDimensions.h" +#include "GameManager.h" float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBeat ) @@ -31,9 +32,9 @@ float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBea return fYOffset; } -float ArrowGetXPos( const PlayerOptions& po, const StyleDef &StyleDef, int iColNum, float fYOffset, float fSongBeat ) +float ArrowGetXPos( const PlayerOptions& po, int iColNum, float fYOffset, float fSongBeat ) { - float fColOffsetFromCenter = iColNum - (StyleDef.m_iNumColumns-1)/2.0f; + float fColOffsetFromCenter = iColNum - (GAME->GetCurrentStyleDef()->GetColsPerPlayer()-1)/2.0f; float fPixelOffsetFromCenter = fColOffsetFromCenter * ARROW_SIZE; switch( po.m_EffectType ) @@ -45,7 +46,7 @@ float ArrowGetXPos( const PlayerOptions& po, const StyleDef &StyleDef, int iColN return fPixelOffsetFromCenter; } -float ArrowGetRotation( const PlayerOptions& po, const StyleDef &StyleDef, int iColNum, float fYOffset ) +float ArrowGetRotation( const PlayerOptions& po, int iColNum, float fYOffset ) { float fRotation = 0; //StyleDef.m_ColumnToRotation[iColNum]; diff --git a/stepmania/src/ArrowEffects.h b/stepmania/src/ArrowEffects.h index c501ada84a..c132c3d84d 100644 --- a/stepmania/src/ArrowEffects.h +++ b/stepmania/src/ArrowEffects.h @@ -4,7 +4,7 @@ Desc: Functions that return properties of arrows based on StyleDef and PlayerOptions - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -26,13 +26,13 @@ float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBea // fXPos is a horizontal position in pixels relative to the center of the field. // This depends on the column of the arrow and possibly the Arrow effect and // fYOffset (in the case of EFFECT_DRUNK). -float ArrowGetXPos( const PlayerOptions& po, const StyleDef &StyleDef, int iCol, float fYOffset, float fSongBeat ); +float ArrowGetXPos( const PlayerOptions& po, int iCol, float fYOffset, float fSongBeat ); // fRotation is Z rotation of an arrow. This will depend on the column of // the arrow and possibly the Arrow effect and the fYOffset (in the case of // EFFECT_DIZZY). -float ArrowGetRotation( const PlayerOptions& po, const StyleDef &StyleDef, int iCol, float fYOffset ); +float ArrowGetRotation( const PlayerOptions& po, int iCol, float fYOffset ); // fYPos is the position of the note in pixels relative to the center. diff --git a/stepmania/src/BPMDisplay.cpp b/stepmania/src/BPMDisplay.cpp index f507c5c02c..da87e39156 100644 --- a/stepmania/src/BPMDisplay.cpp +++ b/stepmania/src/BPMDisplay.cpp @@ -5,7 +5,7 @@ Desc: A graphic displayed in the BPMDisplay during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/BPMDisplay.h b/stepmania/src/BPMDisplay.h index 30443bf684..8fc0e9b258 100644 --- a/stepmania/src/BPMDisplay.h +++ b/stepmania/src/BPMDisplay.h @@ -4,7 +4,7 @@ Desc: A graphic displayed in the BPMDisplay during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 5c41ed6ddd..dd64dc7b2d 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -5,7 +5,7 @@ Desc: Background behind arrows while dancing - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/Background.h b/stepmania/src/Background.h index 569ff1b9b1..a5cb957634 100644 --- a/stepmania/src/Background.h +++ b/stepmania/src/Background.h @@ -4,7 +4,7 @@ Desc: Background behind arrows while dancing - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/Banner.cpp b/stepmania/src/Banner.cpp index e970099592..4f6ca1cc49 100644 --- a/stepmania/src/Banner.cpp +++ b/stepmania/src/Banner.cpp @@ -5,7 +5,7 @@ Desc: The song's banner displayed in SelectSong. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -16,7 +16,6 @@ #include "RageBitmapTexture.h" - bool Banner::LoadFromSong( Song* pSong ) // NULL means no song { Sprite::TurnShadowOff(); @@ -29,90 +28,4 @@ bool Banner::LoadFromSong( Song* pSong ) // NULL means no song return true; } -bool Banner::Load( const CString &sFilePath, DWORD dwHints, bool bForceReload ) -{ - Sprite::Load( sFilePath, dwHints, bForceReload ); - CropToRightSize(); - return true; -} - -void Banner::CropToRightSize() -{ - int iSourceWidth = m_pTexture->GetSourceWidth(); - int iSourceHeight = m_pTexture->GetSourceHeight(); - - // save the original X&Y. We're going to resore them later. - float fOriginalX = GetX(); - float fOriginalY = GetY(); - - if( iSourceWidth == iSourceHeight ) // this is a SSR/DWI banner - { - float fCustomImageCoords[8] = { - 0.22f, 0.98f, // bottom left - 0.02f, 0.78f, // top left - 0.98f, 0.22f, // bottom right - 0.78f, 0.02f, // top right - }; - Sprite::SetCustomImageCoords( fCustomImageCoords ); - - SetWidth( BANNER_WIDTH ); - SetHeight( BANNER_HEIGHT ); - SetZoom( 1 ); - } - else if( iSourceWidth * 2 > iSourceHeight ) - { - Sprite::StopUsingCustomCoords(); - Sprite::StretchTo( CRect(0, 0, - (int)BANNER_WIDTH, - (int)BANNER_HEIGHT ) - ); - } - else // this is probably a background graphic or something not intended to be a banner - { - Sprite::StopUsingCustomCoords(); - - // first find the correct zoom - Sprite::ScaleToCover( CRect(0, 0, - (int)BANNER_WIDTH, - (int)BANNER_HEIGHT ) - ); - float fFinalZoom = this->GetZoom(); - - // find which dimension is larger - bool bXDimNeedsToBeCropped = GetZoomedWidth() > BANNER_WIDTH; - - if( bXDimNeedsToBeCropped ) // crop X - { - float fPercentageToCutOff = (this->GetZoomedWidth() - BANNER_WIDTH) / this->GetZoomedWidth(); - float fPercentageToCutOffEachSide = fPercentageToCutOff / 2; - - // generate a rectangle with new texture coordinates - FRECT fCustomImageCoords( - fPercentageToCutOffEachSide, - 0, - 1 - fPercentageToCutOffEachSide, - 1 ); - SetCustomImageRect( fCustomImageCoords ); - } - else // crop Y - { - float fPercentageToCutOff = (this->GetZoomedHeight() - BANNER_HEIGHT) / this->GetZoomedHeight(); - float fPercentageToCutOffEachSide = fPercentageToCutOff / 2; - - // generate a rectangle with new texture coordinates - FRECT fCustomImageCoords( - 0, - fPercentageToCutOffEachSide, - 1, - 1 - fPercentageToCutOffEachSide ); - SetCustomImageRect( fCustomImageCoords ); - } - SetWidth( BANNER_WIDTH ); - SetHeight( BANNER_HEIGHT ); - SetZoom( 1 ); - } - - // restore original XY - SetXY( fOriginalX, fOriginalY ); -} diff --git a/stepmania/src/Banner.h b/stepmania/src/Banner.h index 6772720d49..ef81b3e44e 100644 --- a/stepmania/src/Banner.h +++ b/stepmania/src/Banner.h @@ -1,36 +1,31 @@ +#pragma once /* ----------------------------------------------------------------------------- File: Banner.h Desc: The song's banner displayed in SelectSong. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ -#ifndef _Banner_H_ -#define _Banner_H_ - - -#include "Sprite.h" +#include "CroppedSprite.h" #include "Song.h" -const float BANNER_WIDTH = 253; -const float BANNER_HEIGHT = 94; +const float BANNER_WIDTH = 286; +const float BANNER_HEIGHT = 92; -class Banner : public Sprite +class Banner : public CroppedSprite { public: - bool LoadFromSong( Song* pSong ); // NULL means no Song - virtual bool Load( const CString &sFilePath, DWORD dwHints = 0, bool bForceReload = false ); + Banner() + { + m_fCropWidth = BANNER_WIDTH; + m_fCropHeight = BANNER_HEIGHT; + }; + + bool LoadFromSong( Song* pSong ); // NULL means no song -protected: - void CropToRightSize(); }; - - - - -#endif \ No newline at end of file diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index bcf7fa553c..9221966585 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -14,6 +14,19 @@ #include "IniFile.h" #include "FontManager.h" #include "RageHelper.h" +#include "ErrorCatcher/ErrorCatcher.h" + + +D3DXCOLOR RAINBOW_COLORS[] = { + D3DXCOLOR( 1.0f, 0.2f, 0.4f, 1 ), // red + D3DXCOLOR( 0.8f, 0.2f, 0.6f, 1 ), // pink + D3DXCOLOR( 0.4f, 0.3f, 0.5f, 1 ), // purple + D3DXCOLOR( 0.2f, 0.6f, 1.0f, 1 ), // sky blue + D3DXCOLOR( 0.2f, 0.8f, 0.8f, 1 ), // sea green + D3DXCOLOR( 0.2f, 0.8f, 0.4f, 1 ), // green + D3DXCOLOR( 1.0f, 0.8f, 0.2f, 1 ), // orange +}; +const int NUM_RAINBOW_COLORS = sizeof(RAINBOW_COLORS) / sizeof(D3DXCOLOR); BitmapText::BitmapText() @@ -21,6 +34,9 @@ BitmapText::BitmapText() m_HorizAlign = align_center; m_VertAlign = align_middle; + m_fShadowLength = 2; + + m_pFont = NULL; m_iNumLines = 0; @@ -33,6 +49,8 @@ BitmapText::BitmapText() m_iLineLengths[i] = -1; m_iLineWidths[i] = 1; } + + m_bRainbow = false; } BitmapText::~BitmapText() @@ -161,7 +179,7 @@ void BitmapText::RebuildVertexBuffer() const char c = szLine[j]; const int iFrameNo = m_pFont->m_iCharToFrameNo[c]; if( iFrameNo == -1 ) // this font doesn't impelemnt this character - HELPER.FatalError( ssprintf("The font '%s' does not implement the character '%c'", m_sFontFilePath, c) ); + FatalError( ssprintf("The font '%s' does not implement the character '%c'", m_sFontFilePath, c) ); const int iCharWidth = m_pFont->m_iFrameNoToWidth[iFrameNo]; // HACK: @@ -288,14 +306,28 @@ void BitmapText::RenderPrimitives() ////////////////////// pVB->Lock( 0, 0, (BYTE**)&v, 0 ); - for( int i=0; iUnlock(); diff --git a/stepmania/src/BitmapText.h b/stepmania/src/BitmapText.h index f584615791..ce50a18571 100644 --- a/stepmania/src/BitmapText.h +++ b/stepmania/src/BitmapText.h @@ -4,7 +4,7 @@ Desc: An actor that holds a Font and draws text to the screen. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -37,6 +37,8 @@ public: void RebuildVertexBuffer(); // fill the RageScreen's vertex buffer with what we're going to draw virtual void RenderPrimitives(); + void TurnRainbowOn() { m_bRainbow = true; }; + void TurnRainbowOff() { m_bRainbow = false; }; protected: CString m_sFontFilePath; @@ -52,6 +54,8 @@ protected: // recalculate on RebuildVertexBuffer() int m_iNumV; // number of verticies we filled in the vertex buffer + + bool m_bRainbow; }; diff --git a/stepmania/src/Combo.cpp b/stepmania/src/Combo.cpp index 7690f88995..8754cbec91 100644 --- a/stepmania/src/Combo.cpp +++ b/stepmania/src/Combo.cpp @@ -5,7 +5,7 @@ Desc: A graphic displayed in the Combo during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/Combo.h b/stepmania/src/Combo.h index ebc01855ed..3f54c5d090 100644 --- a/stepmania/src/Combo.h +++ b/stepmania/src/Combo.h @@ -4,7 +4,7 @@ Desc: A graphic displayed in the Combo during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/CroppedSprite.cpp b/stepmania/src/CroppedSprite.cpp new file mode 100644 index 0000000000..24e7e052da --- /dev/null +++ b/stepmania/src/CroppedSprite.cpp @@ -0,0 +1,93 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + File: CroppedSprite.h + + Desc: The song's CroppedSprite displayed in SelectSong. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. +----------------------------------------------------------------------------- +*/ + +#include "RageUtil.h" + +#include "CroppedSprite.h" +#include "ThemeManager.h" +#include "RageBitmapTexture.h" + + +void CroppedSprite::CropToSize( float fWidth, float fHeight ) +{ + m_fCropWidth = fWidth; + m_fCropHeight = fHeight; + + + int iSourceWidth = m_pTexture->GetSourceWidth(); + int iSourceHeight = m_pTexture->GetSourceHeight(); + + // save the original X&Y. We're going to resore them later. + float fOriginalX = GetX(); + float fOriginalY = GetY(); + + if( iSourceWidth == iSourceHeight ) // this is a SSR/DWI CroppedSprite + { + float fCustomImageCoords[8] = { + 0.22f, 0.98f, // bottom left + 0.02f, 0.78f, // top left + 0.98f, 0.22f, // bottom right + 0.78f, 0.02f, // top right + }; + Sprite::SetCustomImageCoords( fCustomImageCoords ); + + SetWidth( m_fCropWidth ); + SetHeight( m_fCropHeight ); + SetZoom( 1 ); + } + else // this is probably a background graphic or something not intended to be a CroppedSprite + { + Sprite::StopUsingCustomCoords(); + + // first find the correct zoom + Sprite::ScaleToCover( CRect(0, 0, + (int)m_fCropWidth, + (int)m_fCropHeight ) + ); + float fFinalZoom = this->GetZoom(); + + // find which dimension is larger + bool bXDimNeedsToBeCropped = GetZoomedWidth() > m_fCropWidth; + + if( bXDimNeedsToBeCropped ) // crop X + { + float fPercentageToCutOff = (this->GetZoomedWidth() - m_fCropWidth) / this->GetZoomedWidth(); + float fPercentageToCutOffEachSide = fPercentageToCutOff / 2; + + // generate a rectangle with new texture coordinates + FRECT fCustomImageCoords( + fPercentageToCutOffEachSide, + 0, + 1 - fPercentageToCutOffEachSide, + 1 ); + SetCustomImageRect( fCustomImageCoords ); + } + else // crop Y + { + float fPercentageToCutOff = (this->GetZoomedHeight() - m_fCropHeight) / this->GetZoomedHeight(); + float fPercentageToCutOffEachSide = fPercentageToCutOff / 2; + + // generate a rectangle with new texture coordinates + FRECT fCustomImageCoords( + 0, + fPercentageToCutOffEachSide, + 1, + 1 - fPercentageToCutOffEachSide ); + SetCustomImageRect( fCustomImageCoords ); + } + SetWidth( m_fCropWidth ); + SetHeight( m_fCropHeight ); + SetZoom( 1 ); + } + + // restore original XY + SetXY( fOriginalX, fOriginalY ); +} diff --git a/stepmania/src/CroppedSprite.h b/stepmania/src/CroppedSprite.h new file mode 100644 index 0000000000..ba68a2cf42 --- /dev/null +++ b/stepmania/src/CroppedSprite.h @@ -0,0 +1,44 @@ +/* +----------------------------------------------------------------------------- + File: CroppedSprite.h + + Desc: The song's CroppedSprite displayed in SelectSong. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. +----------------------------------------------------------------------------- +*/ + +#ifndef _CroppedSprite_H_ +#define _CroppedSprite_H_ + + +#include "Sprite.h" +#include "Song.h" + + +class CroppedSprite : public Sprite +{ +public: + CroppedSprite() + { + m_fCropWidth = m_fCropHeight = 100; + }; + + bool Load( CString sFilePath, DWORD dwHints = 0, bool bForceReload = false ) + { + Sprite::Load( sFilePath, dwHints, bForceReload ); + CropToSize( m_fCropWidth, m_fCropHeight ); + + return true; + } + + void CropToSize( float fHeight, float fWidth ); + +protected: + float m_fCropWidth, m_fCropHeight; +}; + + + + +#endif \ No newline at end of file diff --git a/stepmania/src/DifficultyIcon.cpp b/stepmania/src/DifficultyIcon.cpp index 505a51631c..e8e57a94b9 100644 --- a/stepmania/src/DifficultyIcon.cpp +++ b/stepmania/src/DifficultyIcon.cpp @@ -5,7 +5,7 @@ Desc: A graphic displayed in the DifficultyIcon during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/DifficultyIcon.h b/stepmania/src/DifficultyIcon.h index 49443868e2..4a68a81398 100644 --- a/stepmania/src/DifficultyIcon.h +++ b/stepmania/src/DifficultyIcon.h @@ -4,7 +4,7 @@ Desc: A graphic displayed in the DifficultyIcon during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -24,18 +24,18 @@ class DifficultyIcon : public Sprite public: DifficultyIcon() { - Load( THEME->GetPathTo(GRAPHIC_STEPS_DESCRIPTION) ); + Load( THEME->GetPathTo(GRAPHIC_DIFFICULTY_ICONS) ); StopAnimating(); - SetFromDescription( "" ); + SetFromNoteMetadata( NULL ); }; - void SetFromSteps( Pattern* pSteps ) + void SetFromNoteMetadata( NoteMetadata* pNoteMetadata ) { - if( pSteps != NULL ) + if( pNoteMetadata != NULL ) { SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - SetFromDescription( pSteps->m_sDescription ); + SetFromDescription( pNoteMetadata->m_sDescription ); } else { @@ -52,12 +52,12 @@ private: sTemp.MakeLower(); if( sTemp.Find( "basic" ) != -1 ) SetState( 0 ); else if( sTemp.Find( "trick" ) != -1 ) SetState( 1 ); - else if( sTemp.Find( "another" ) != -1 ) SetState( 2 ); - else if( sTemp.Find( "maniac" ) != -1 ) SetState( 3 ); - else if( sTemp.Find( "ssr" ) != -1 ) SetState( 4 ); - else if( sTemp.Find( "battle" ) != -1 ) SetState( 5 ); - else if( sTemp.Find( "couple" ) != -1 ) SetState( 6 ); - else SetState( 7 ); + else if( sTemp.Find( "another" ) != -1 ) SetState( 1 ); + else if( sTemp.Find( "maniac" ) != -1 ) SetState( 2 ); + else if( sTemp.Find( "ssr" ) != -1 ) SetState( 2 ); + else if( sTemp.Find( "battle" ) != -1 ) SetState( 0 ); + else if( sTemp.Find( "couple" ) != -1 ) SetState( 0 ); + else SetState( 0 ); }; }; diff --git a/stepmania/src/FocusingSprite.cpp b/stepmania/src/FocusingSprite.cpp index 4a6b164da8..a8ece37288 100644 --- a/stepmania/src/FocusingSprite.cpp +++ b/stepmania/src/FocusingSprite.cpp @@ -5,7 +5,7 @@ Desc: A graphic that appears to blur and come into focus. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/FocusingSprite.h b/stepmania/src/FocusingSprite.h index 62f76dfab9..3dba52af2f 100644 --- a/stepmania/src/FocusingSprite.h +++ b/stepmania/src/FocusingSprite.h @@ -4,7 +4,7 @@ Desc: A graphic that appears to blur and come into focus. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/Font.cpp b/stepmania/src/Font.cpp index 27fa2ab318..20e437ad12 100644 --- a/stepmania/src/Font.cpp +++ b/stepmania/src/Font.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -16,6 +16,7 @@ #include "RageTextureManager.h" #include "RageUtil.h" #include "RageHelper.h" +#include "ErrorCatcher/ErrorCatcher.h" Font::Font( const CString &sFontFilePath ) @@ -44,7 +45,7 @@ Font::Font( const CString &sFontFilePath ) IniFile ini; ini.SetPath( m_sFontFilePath ); if( !ini.ReadFile() ) - HELPER.FatalError( ssprintf("Error opening Font file '%s'.", m_sFontFilePath) ); + FatalError( ssprintf("Error opening Font file '%s'.", m_sFontFilePath) ); // @@ -52,7 +53,7 @@ Font::Font( const CString &sFontFilePath ) // CString sTextureFile = ini.GetValue( "Font", "Texture" ); if( sTextureFile == "" ) - HELPER.FatalError( ssprintf("Error reading value 'Texture' from %s.", m_sFontFilePath) ); + FatalError( ssprintf("Error reading value 'Texture' from %s.", m_sFontFilePath) ); m_sTexturePath = sFontDir + sTextureFile; // save the path of the new texture m_sTexturePath.MakeLower(); @@ -73,7 +74,7 @@ Font::Font( const CString &sFontFilePath ) { // sanity check if( sCharacters.GetLength() != (int)m_pTexture->GetNumFrames() ) - HELPER.FatalError( ssprintf("The characters in '%s' does not match the number of frames in the texture.", m_sFontFilePath) ); + FatalError( ssprintf("The characters in '%s' does not match the number of frames in the texture.", m_sFontFilePath) ); // set the char to frame number map for( int i=0; iGetNumFrames() ) - HELPER.FatalError( ssprintf("The number of widths specified in '%s' (%d) do not match the number of frames in the texture (%u).", m_sFontFilePath, arrayCharWidths.GetSize(), m_pTexture->GetNumFrames()) ); + FatalError( ssprintf("The number of widths specified in '%s' (%d) do not match the number of frames in the texture (%u).", m_sFontFilePath, arrayCharWidths.GetSize(), m_pTexture->GetNumFrames()) ); for( int i=0; im_iNumFeet, pSteps->m_sDescription ); + SetNumFeet( pNoteMetadata->m_iMeter, pNoteMetadata->m_sDescription ); } else { diff --git a/stepmania/src/GameDef.cpp b/stepmania/src/GameDef.cpp new file mode 100644 index 0000000000..f766feca7f --- /dev/null +++ b/stepmania/src/GameDef.cpp @@ -0,0 +1,56 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: GameDef + + Desc: See header. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "GameDef.h" +#include "RageHelper.h" +#include "RageUtil.h" +#include "ErrorCatcher/ErrorCatcher.h" + +CString GameDef::ElementToGraphicSuffix( const GameButtonGraphic gbg ) +{ + CString sAssetPath; // fill this in below + + switch( gbg ) + { + case GRAPHIC_NOTE_COLOR_PART: sAssetPath = "note color part"; break; + case GRAPHIC_NOTE_GRAY_PART: sAssetPath = "note gray part"; break; + case GRAPHIC_RECEPTOR: sAssetPath = "receptor"; break; + case GRAPHIC_HOLD_EXPLOSION: sAssetPath = "hold explosion"; break; + case GRAPHIC_TAP_EXPLOSION_BRIGHT: sAssetPath = "tap explosion bright"; break; + case GRAPHIC_TAP_EXPLOSION_DIM: sAssetPath = "tap explosion dim"; break; + + default: + FatalError( ssprintf("Unhandled StyleElement %d", gbg) ); + } + + return sAssetPath; +} + +CString GameDef::GetPathToGraphic( const int iInstrumentButton, const GameButtonGraphic gbg ) +{ + const CString sDir = "Game\\" + CString(m_szName) + "\\"; + const CString sButtonName = m_szButtonNames[ iInstrumentButton ]; + const CString sGraphicSuffix = ElementToGraphicSuffix( gbg ); + + CStringArray arrayPossibleFileNames; // fill this with the possible files + + GetDirListing( ssprintf("%s%s %s*.sprite", sDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames ); + GetDirListing( ssprintf("%s%s %s*.png", sDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames ); + GetDirListing( ssprintf("%s%s %s*.jpg", sDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames ); + GetDirListing( ssprintf("%s%s %s*.bmp", sDir, sButtonName, sGraphicSuffix), arrayPossibleFileNames ); + + if( arrayPossibleFileNames.GetSize() > 0 ) + return sDir + arrayPossibleFileNames[0]; + + FatalError( "The game button graphic '%s%s %s' is missing.", sDir, sButtonName, sGraphicSuffix ); + return ""; +} diff --git a/stepmania/src/GameDef.h b/stepmania/src/GameDef.h new file mode 100644 index 0000000000..f71791d141 --- /dev/null +++ b/stepmania/src/GameDef.h @@ -0,0 +1,64 @@ +#pragma once +/* +----------------------------------------------------------------------------- + Class: GameDef + + Desc: Holds information about a particular style of a game (e.g. "single", "double"). + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "StyleDef.h" +#include "NoteMetadata.h" +#include "NoteData.h" +#include "GameInput.h" +#include "GameTypes.h" +#include "MenuInput.h" + + + +const int MAX_STYLES_PER_GAME = 10; + + + +struct GameDef +{ +public: + + LPCTSTR m_szName; + LPCTSTR m_szDescription; + LPCTSTR m_szGraphicPath; + + // instrument stuff + int m_iNumInstruments; + int m_iNumButtons; + LPCTSTR m_szButtonNames[NUM_INSTRUMENT_BUTTONS]; // e.g. "left", "right", "middle C", "snare" + int m_iMenuButtons[NUM_MENU_BUTTONS]; // map from MenuButton to InstrumentButton + + int m_iNumStyleDefs; + StyleDef m_StyleDefs[MAX_STYLES_PER_GAME]; + + + // graphic stuff + CString GetPathToGraphic( const int iInstrumentButton, const GameButtonGraphic gbg ); + CString ElementToGraphicSuffix( const GameButtonGraphic gbg ); + + + inline MenuInput GameInputToMenuInput( const GameInput GameI ) + { + PlayerNumber p = (PlayerNumber)GameI.number; + for( int b=0; bm_iNumStyleDefs; i++ ) + { + if( pGameDef->m_StyleDefs[i].m_szName == sStyle ) + return &pGameDef->m_StyleDefs[i]; + } + + return NULL; +} + + bool GameManager::IsPlayerEnabled( PlayerNumber PlayerNo ) { - switch( m_DanceStyle ) + StyleDef* pStyleDef = GetCurrentStyleDef(); + ASSERT( pStyleDef != NULL ); + + switch( pStyleDef->m_iNumPlayers ) { - case STYLE_VERSUS: - case STYLE_COUPLE: - if( PlayerNo == PLAYER_1 ) - return true; - if( PlayerNo == PLAYER_2 ) - return true; + case 1: + switch( PlayerNo ) + { + case PLAYER_1: return true; + case PLAYER_2: return false; + default: ASSERT( false ); + } break; - case STYLE_SINGLE: - case STYLE_SOLO: - case STYLE_DOUBLE: - if( PlayerNo == PLAYER_1 ) - return true; - if( PlayerNo == PLAYER_2 ) - return false; + case 2: + switch( PlayerNo ) + { + case PLAYER_1: return true; + case PLAYER_2: return true; + default: ASSERT( false ); + } break; default: - ASSERT( false ); // invalid StyleDef + ASSERT( false ); // invalid m_iNumPlayers } + return false; } - -StyleDef GameManager::GetStyleDef( DanceStyle mode ) -{ - StyleDef sd; - - - /* - CMap mapTapNoteToRotation; // arrow facing left is rotation 0 - mapTapNoteToRotation[NOTE_PAD1_LEFT] = 0; - mapTapNoteToRotation[NOTE_PAD1_UPLEFT] = D3DX_PI/4.0f; - mapTapNoteToRotation[NOTE_PAD1_DOWN] = -D3DX_PI/2.0f; - mapTapNoteToRotation[NOTE_PAD1_UP] = D3DX_PI/2.0f; - mapTapNoteToRotation[NOTE_PAD1_UPRIGHT] = D3DX_PI*3.0f/4.0f; - mapTapNoteToRotation[NOTE_PAD1_RIGHT] = D3DX_PI; - mapTapNoteToRotation[NOTE_PAD2_LEFT] = mapTapNoteToRotation[NOTE_PAD1_LEFT]; - mapTapNoteToRotation[NOTE_PAD2_UPLEFT] = mapTapNoteToRotation[NOTE_PAD1_UPLEFT]; - mapTapNoteToRotation[NOTE_PAD2_DOWN] = mapTapNoteToRotation[NOTE_PAD1_DOWN]; - mapTapNoteToRotation[NOTE_PAD2_UP] = mapTapNoteToRotation[NOTE_PAD1_UP]; - mapTapNoteToRotation[NOTE_PAD2_UPRIGHT] = mapTapNoteToRotation[NOTE_PAD1_UPRIGHT]; - mapTapNoteToRotation[NOTE_PAD2_RIGHT] = mapTapNoteToRotation[NOTE_PAD1_RIGHT]; - */ - - switch( mode ) - { - case STYLE_SINGLE: - case STYLE_DOUBLE: - case STYLE_SOLO: - sd.m_iNumPlayers = 1; - break; - case STYLE_VERSUS: - case STYLE_COUPLE: - sd.m_iNumPlayers = 2; - break; - default: - ASSERT( false ); // invalid GameMode - } - - - switch( mode ) - { - case STYLE_SINGLE: - case STYLE_VERSUS: - case STYLE_COUPLE: - sd.m_iNumColumns = 4; - sd.m_ColumnToTapNote[0] = NOTE_PAD1_LEFT; - sd.m_ColumnToTapNote[1] = NOTE_PAD1_DOWN; - sd.m_ColumnToTapNote[2] = NOTE_PAD1_UP; - sd.m_ColumnToTapNote[3] = NOTE_PAD1_RIGHT; - sd.m_sColumnToNoteName[0] = "left"; - sd.m_sColumnToNoteName[1] = "down"; - sd.m_sColumnToNoteName[2] = "up"; - sd.m_sColumnToNoteName[3] = "right"; -/* sd.m_ColumnToRotation[0] = mapTapNoteToRotation[NOTE_PAD1_LEFT]; - sd.m_ColumnToRotation[1] = mapTapNoteToRotation[NOTE_PAD1_DOWN]; - sd.m_ColumnToRotation[2] = mapTapNoteToRotation[NOTE_PAD1_UP]; - sd.m_ColumnToRotation[3] = mapTapNoteToRotation[NOTE_PAD1_RIGHT]; -*/ break; - case STYLE_SOLO: - sd.m_iNumColumns = 6; // LEFT, UP+LEFT, DOWN, UP, UP+RIGHT, RIGHT - sd.m_ColumnToTapNote[0] = NOTE_PAD1_LEFT; - sd.m_ColumnToTapNote[1] = NOTE_PAD1_UPLEFT; - sd.m_ColumnToTapNote[2] = NOTE_PAD1_DOWN; - sd.m_ColumnToTapNote[3] = NOTE_PAD1_UP; - sd.m_ColumnToTapNote[4] = NOTE_PAD1_UPRIGHT; - sd.m_ColumnToTapNote[5] = NOTE_PAD1_RIGHT; - sd.m_sColumnToNoteName[0] = "left"; - sd.m_sColumnToNoteName[1] = "upleft"; - sd.m_sColumnToNoteName[2] = "down"; - sd.m_sColumnToNoteName[3] = "up"; - sd.m_sColumnToNoteName[4] = "upright"; - sd.m_sColumnToNoteName[5] = "right"; -/* sd.m_ColumnToRotation[0] = mapTapNoteToRotation[NOTE_PAD1_LEFT]; - sd.m_ColumnToRotation[1] = mapTapNoteToRotation[NOTE_PAD1_UPLEFT]; - sd.m_ColumnToRotation[2] = mapTapNoteToRotation[NOTE_PAD1_DOWN]; - sd.m_ColumnToRotation[3] = mapTapNoteToRotation[NOTE_PAD1_UP]; - sd.m_ColumnToRotation[4] = mapTapNoteToRotation[NOTE_PAD1_UPRIGHT]; - sd.m_ColumnToRotation[5] = mapTapNoteToRotation[NOTE_PAD1_RIGHT]; -*/ break; - case STYLE_DOUBLE: - sd.m_iNumColumns = 8; // 1_LEFT, 1_DOWN, 1_UP, 1_RIGHT, 2_LEFT, 2_DOWN, 2_UP, 2_RIGHT - sd.m_ColumnToTapNote[0] = NOTE_PAD1_LEFT; - sd.m_ColumnToTapNote[1] = NOTE_PAD1_DOWN; - sd.m_ColumnToTapNote[2] = NOTE_PAD1_UP; - sd.m_ColumnToTapNote[3] = NOTE_PAD1_RIGHT; - sd.m_ColumnToTapNote[4] = NOTE_PAD2_LEFT; - sd.m_ColumnToTapNote[5] = NOTE_PAD2_DOWN; - sd.m_ColumnToTapNote[6] = NOTE_PAD2_UP; - sd.m_ColumnToTapNote[7] = NOTE_PAD2_RIGHT; - sd.m_ColumnToTapNote[8] = NOTE_PAD1_UPLEFT;// Even though this isn't used, Need them here so - sd.m_ColumnToTapNote[9] = NOTE_PAD1_UPRIGHT;// TapNoteToColumnNumber doesn't get confused by them - sd.m_ColumnToTapNote[10] = NOTE_PAD2_UPLEFT; - sd.m_ColumnToTapNote[11] = NOTE_PAD2_UPRIGHT; - sd.m_sColumnToNoteName[0] = "left"; - sd.m_sColumnToNoteName[1] = "upleft"; - sd.m_sColumnToNoteName[2] = "down"; - sd.m_sColumnToNoteName[3] = "up"; - sd.m_sColumnToNoteName[4] = "upright"; - sd.m_sColumnToNoteName[5] = "right"; - sd.m_sColumnToNoteName[6] = "left"; - sd.m_sColumnToNoteName[7] = "upleft"; - sd.m_sColumnToNoteName[8] = "down"; - sd.m_sColumnToNoteName[9] = "up"; - sd.m_sColumnToNoteName[10] = "upright"; - sd.m_sColumnToNoteName[11] = "right"; - /* - sd.m_ColumnToRotation[0] = mapTapNoteToRotation[NOTE_PAD1_LEFT]; - sd.m_ColumnToRotation[1] = mapTapNoteToRotation[NOTE_PAD1_DOWN]; - sd.m_ColumnToRotation[2] = mapTapNoteToRotation[NOTE_PAD1_UP]; - sd.m_ColumnToRotation[3] = mapTapNoteToRotation[NOTE_PAD1_RIGHT]; - sd.m_ColumnToRotation[4] = mapTapNoteToRotation[NOTE_PAD2_LEFT]; - sd.m_ColumnToRotation[5] = mapTapNoteToRotation[NOTE_PAD2_DOWN]; - sd.m_ColumnToRotation[6] = mapTapNoteToRotation[NOTE_PAD2_UP]; - sd.m_ColumnToRotation[7] = mapTapNoteToRotation[NOTE_PAD2_RIGHT]; - sd.m_ColumnToRotation[8] = mapTapNoteToRotation[NOTE_PAD1_UPLEFT]; - sd.m_ColumnToRotation[9] = mapTapNoteToRotation[NOTE_PAD1_UPRIGHT]; - sd.m_ColumnToRotation[10] = mapTapNoteToRotation[NOTE_PAD2_UPLEFT]; - sd.m_ColumnToRotation[11] = mapTapNoteToRotation[NOTE_PAD2_UPRIGHT]; - */ - break; - default: - ASSERT( false ); // invalid GameMode - } - - return sd; -} \ No newline at end of file diff --git a/stepmania/src/GameManager.h b/stepmania/src/GameManager.h index 5490e67e39..42968a67c3 100644 --- a/stepmania/src/GameManager.h +++ b/stepmania/src/GameManager.h @@ -1,40 +1,64 @@ +#pragma once /* ----------------------------------------------------------------------------- Class: GameManager - Desc: Manages "Game" and "StyleDef", and "Instrument" definitions, which define - different ways of playing - like "dance" and "pump". + Desc: Manages GameDefs (which define different games, like "dance" and "pump") + and StyleDefs (which define different games, like "single" and "couple") - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ - -#ifndef _GameManager_H_ -#define _GameManager_H_ - +#include "GameDef.h" #include "StyleDef.h" + +const int NUM_GAME_DEFS = 1; + + class GameManager { public: GameManager(); - ~GameManager(); - DanceStyle m_DanceStyle; // the current style + void SwitchGame( CString sGame ) + { + m_sCurrentGame = sGame; + m_pCurrentGameDef = GetGameDef( sGame ); + ASSERT( m_pCurrentGameDef != NULL ); + }; + void SwitchStyle( CString sStyle ) + { + m_sCurrentStyle = sStyle; + m_pCurrentStyleDef = GetStyleDef( m_sCurrentGame, sStyle ); + ASSERT( m_pCurrentStyleDef != NULL ); + }; + CString m_sCurrentGame; // currently only "dance" + CString m_sCurrentStyle; // currently only "single", "versus", "double", "couple", "solo" + inline GameDef* GetCurrentGameDef() { return m_pCurrentGameDef; }; + inline StyleDef* GetCurrentStyleDef() { return m_pCurrentStyleDef; }; bool IsPlayerEnabled( PlayerNumber PlayerNo ); - StyleDef GetStyleDef( DanceStyle mode ); - StyleDef GetCurrentStyleDef() { return GetStyleDef(m_DanceStyle); }; + // graphic stuff + CString GetPathToGraphic( const PlayerNumber p, const NoteColumn col, const GameButtonGraphic gbg ) + { + StyleInput si( p, col ); + GameInput gi = GetCurrentStyleDef()->StyleInputToGameInput( si ); + InstrumentButton b = gi.button; + return GetCurrentGameDef()->GetPathToGraphic( b, gbg ); + } + protected: + GameDef* m_pCurrentGameDef; + StyleDef* m_pCurrentStyleDef; + GameDef* GetGameDef( CString sGame ); + StyleDef* GetStyleDef( CString sGame, CString sStyle ); }; extern GameManager* GAME; // global and accessable from anywhere in our program - - -#endif \ No newline at end of file diff --git a/stepmania/src/GhostArrow.h b/stepmania/src/GhostArrow.h index a0e84a0cad..715c739fcb 100644 --- a/stepmania/src/GhostArrow.h +++ b/stepmania/src/GhostArrow.h @@ -16,7 +16,7 @@ class GhostArrow; #include "Sprite.h" -#include "Pattern.h" +#include "NoteMetadata.h" class GhostArrow : public Sprite diff --git a/stepmania/src/GhostArrowBright.h b/stepmania/src/GhostArrowBright.h index 94a56dfd24..e880077ad2 100644 --- a/stepmania/src/GhostArrowBright.h +++ b/stepmania/src/GhostArrowBright.h @@ -16,7 +16,7 @@ class GhostArrowBright; #include "Sprite.h" -#include "Pattern.h" +#include "NoteMetadata.h" class GhostArrowBright : public Sprite diff --git a/stepmania/src/GhostArrowRow.cpp b/stepmania/src/GhostArrowRow.cpp new file mode 100644 index 0000000000..0442bccbe0 --- /dev/null +++ b/stepmania/src/GhostArrowRow.cpp @@ -0,0 +1,91 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + File: GhostArrowRow.h + + Desc: A graphic displayed in the GhostArrowRow during Dancing. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. +----------------------------------------------------------------------------- +*/ + +#include "GhostArrowRow.h" +#include "RageUtil.h" +#include "ScreenDimensions.h" +#include "ThemeManager.h" +#include "ColorArrow.h" +#include "ArrowEffects.h" +#include "GameManager.h" + + + +GhostArrowRow::GhostArrowRow() +{ + m_iNumCols = 0; +} + +void GhostArrowRow::Load( PlayerOptions po ) +{ + m_PlayerOptions = po; + + StyleDef* pStyleDef = GAME->GetCurrentStyleDef(); + GameDef* pGameDef = GAME->GetCurrentGameDef(); + + m_iNumCols = pStyleDef->GetColsPerPlayer(); + + // init arrows + for( int c=0; cGetPathToGraphic(PLAYER_1, c, GRAPHIC_TAP_EXPLOSION_DIM) ); + m_GhostArrowRowBright[c].Load( GAME->GetPathToGraphic(PLAYER_1, c, GRAPHIC_TAP_EXPLOSION_BRIGHT) ); + m_HoldGhostArrowRow[c].Load( GAME->GetPathToGraphic(PLAYER_1, c, GRAPHIC_HOLD_EXPLOSION) ); + } +} + + +void GhostArrowRow::Update( float fDeltaTime, float fSongBeat ) +{ + m_fSongBeat = fSongBeat; + + for( int c=0; c= 0 && iCol < m_iNumCols ); + if( bBright ) + m_GhostArrowRowBright[iCol].Step( score ); + else + m_GhostArrowRow[iCol].Step( score ); +} + +void GhostArrowRow::HoldNote( int iCol ) +{ + ASSERT( iCol >= 0 && iCol < m_iNumCols ); + m_HoldGhostArrowRow[iCol].Step(); +} diff --git a/stepmania/src/GhostArrowRow.h b/stepmania/src/GhostArrowRow.h new file mode 100644 index 0000000000..468e78015c --- /dev/null +++ b/stepmania/src/GhostArrowRow.h @@ -0,0 +1,43 @@ +#pragma once +/* +----------------------------------------------------------------------------- + File: GhostArrowRow.h + + Desc: A row of GhostArrow Actors + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ActorFrame.h" +#include "GhostArrow.h" +#include "GhostArrowBright.h" +#include "HoldGhostArrow.h" +#include "GameTypes.h" +#include "StyleDef.h" + + + +class GhostArrowRow : public ActorFrame +{ +public: + GhostArrowRow(); + void Update( float fDeltaTime, float fSongBeat ); + virtual void RenderPrimitives(); + + void Load( PlayerOptions po ); + + void TapNote( int iCol, TapNoteScore score, bool bBright ); + void HoldNote( int iCol ); + +protected: + int m_iNumCols; + float m_fSongBeat; + PlayerOptions m_PlayerOptions; + + GhostArrow m_GhostArrowRow[MAX_NOTE_TRACKS]; + GhostArrowBright m_GhostArrowRowBright[MAX_NOTE_TRACKS]; + HoldGhostArrow m_HoldGhostArrowRow[MAX_NOTE_TRACKS]; +}; + diff --git a/stepmania/src/Grade.cpp b/stepmania/src/Grade.cpp index b51e1a5104..14cc385cac 100644 --- a/stepmania/src/Grade.cpp +++ b/stepmania/src/Grade.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/Grade.h b/stepmania/src/Grade.h index a52d18b226..255b8f79e4 100644 --- a/stepmania/src/Grade.h +++ b/stepmania/src/Grade.h @@ -4,7 +4,7 @@ Desc: This a mark the player receives after clearing a song. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/GradeDisplay.cpp b/stepmania/src/GradeDisplay.cpp index f6f547729b..f6a2911536 100644 --- a/stepmania/src/GradeDisplay.cpp +++ b/stepmania/src/GradeDisplay.cpp @@ -5,7 +5,7 @@ Desc: A graphic displayed in the Grade during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/GradeDisplay.h b/stepmania/src/GradeDisplay.h index fb3e4c69e5..2c085b7609 100644 --- a/stepmania/src/GradeDisplay.h +++ b/stepmania/src/GradeDisplay.h @@ -4,7 +4,7 @@ Desc: A graphic displayed in the GradeDisplay during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/GrayArrow.cpp b/stepmania/src/GrayArrow.cpp index 6770990ab5..df6dab2f45 100644 --- a/stepmania/src/GrayArrow.cpp +++ b/stepmania/src/GrayArrow.cpp @@ -5,7 +5,7 @@ Desc: A gray arrow that "receives" ColorArrows. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Ben Nordstrom Chris Danford ----------------------------------------------------------------------------- @@ -24,7 +24,10 @@ GrayArrow::GrayArrow() void GrayArrow::SetBeat( const float fSongBeat ) { - SetState( (int)( fmod(fSongBeat,1) * Sprite::GetNumStates() ) ); + int iNewState = (int)( fmod(fSongBeat,1) * Sprite::GetNumStates() ); + if( iNewState < 0 ) + iNewState += Sprite::GetNumStates(); + SetState( iNewState ); } void GrayArrow::Step() diff --git a/stepmania/src/GrayArrow.h b/stepmania/src/GrayArrow.h index b90df95207..c8031dbdd9 100644 --- a/stepmania/src/GrayArrow.h +++ b/stepmania/src/GrayArrow.h @@ -4,7 +4,7 @@ Desc: A gray arrow that "receives" ColorArrows. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Ben Nordstrom Chris Danford ----------------------------------------------------------------------------- @@ -16,7 +16,7 @@ #include "Sprite.h" -#include "Pattern.h" +#include "NoteMetadata.h" class GrayArrow : public Sprite { diff --git a/stepmania/src/GrayArrowRow.cpp b/stepmania/src/GrayArrowRow.cpp new file mode 100644 index 0000000000..df816e8c90 --- /dev/null +++ b/stepmania/src/GrayArrowRow.cpp @@ -0,0 +1,73 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: GrayArrowRow + + Desc: See header. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "GrayArrowRow.h" +#include "RageUtil.h" +#include "ScreenDimensions.h" +#include "ThemeManager.h" +#include "ColorArrow.h" +#include "ArrowEffects.h" +#include "GameManager.h" + + +GrayArrowRow::GrayArrowRow() +{ + m_iNumCols = 0; +} + +void GrayArrowRow::Load( PlayerOptions po ) +{ + m_PlayerOptions = po; + + StyleDef* pStyleDef = GAME->GetCurrentStyleDef(); + GameDef* pGameDef = GAME->GetCurrentGameDef(); + + m_iNumCols = pStyleDef->GetColsPerPlayer(); + + // init arrow rotations + for( int c=0; cGetPathToGraphic(PLAYER_1, c, GRAPHIC_RECEPTOR) ); + } + +} + +void GrayArrowRow::Update( float fDeltaTime, float fSongBeat ) +{ + m_fSongBeat = fSongBeat; + + for( int c=0; c= 0 && iCol < m_iNumCols ); + m_GrayArrow[iCol].Step(); +} diff --git a/stepmania/src/GrayArrowRow.h b/stepmania/src/GrayArrowRow.h new file mode 100644 index 0000000000..036b174311 --- /dev/null +++ b/stepmania/src/GrayArrowRow.h @@ -0,0 +1,43 @@ +/* +----------------------------------------------------------------------------- + Class: GrayArrowRow + + Desc: A row of GrayArrow objects + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + + +#ifndef _GrayArrowRow_H_ +#define _GrayArrowRow_H_ + + +#include "GrayArrow.h" +#include "ActorFrame.h" +#include "StyleDef.h" +#include "GameTypes.h" + + + +class GrayArrowRow : public ActorFrame +{ +public: + GrayArrowRow(); + virtual void Update( float fDeltaTime, float fSongBeat ); + virtual void RenderPrimitives(); + + void Load( PlayerOptions po ); + + void Step( int iCol ); + +protected: + int m_iNumCols; + float m_fSongBeat; + PlayerOptions m_PlayerOptions; + + GrayArrow m_GrayArrow[MAX_NOTE_TRACKS]; +}; + +#endif \ No newline at end of file diff --git a/stepmania/src/GrooveRadar.cpp b/stepmania/src/GrooveRadar.cpp index e21caac6c1..d0dd2d30f2 100644 --- a/stepmania/src/GrooveRadar.cpp +++ b/stepmania/src/GrooveRadar.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -14,15 +14,161 @@ #include "GrooveRadar.h" #include "ThemeManager.h" #include "RageBitmapTexture.h" +#include "GameConstants.h" GrooveRadar::GrooveRadar() { - m_sprRadar.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_RADAR) ); - this->AddActor( &m_sprRadar ); + m_sprRadarBase.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_RADAR_BASE) ); + this->AddActor( &m_sprRadarBase ); + + m_sprRadarWords.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_RADAR_WORDS) ); + m_sprRadarWords.SetY( -10 ); + this->AddActor( &m_sprRadarWords ); + + for( int p=0; pGetVertexBuffer(); + LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice(); + pd3dDevice->SetTexture( 0, NULL ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); + CUSTOMVERTEX* v; + + for( int p=0; pLock( 0, 0, (BYTE**)&v, 0 ); + + D3DXCOLOR color = PLAYER_COLOR[p]; + color.a = 0.5f; + v[0].p = D3DXVECTOR3( 0, 0, 0 ); + v[0].color = color; + + int i; + + for( i=0; iUnlock(); + + pd3dDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, 0, 5 ); + + + // + // use a strip to draw the thick line + // + pVB->Lock( 0, 0, (BYTE**)&v, 0 ); + + for( i=0; iUnlock(); + + pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 10 ); + } + } + +void GrooveRadar::TweenOnScreen() +{ + SetZoom( 0.5f ); + SetRotation( D3DX_PI*4 ); + BeginTweening( 0.6f ); + SetTweenZoom( 1 ); + SetTweenRotationZ( 0 ); +} + +void GrooveRadar::TweenOffScreen() +{ + BeginTweening( 0.6f ); + SetTweenRotationZ( D3DX_PI*4 ); + SetTweenZoom( 0 ); +} diff --git a/stepmania/src/GrooveRadar.h b/stepmania/src/GrooveRadar.h index 4d9d70cc09..f9aabbab53 100644 --- a/stepmania/src/GrooveRadar.h +++ b/stepmania/src/GrooveRadar.h @@ -4,7 +4,7 @@ Desc: The song's GrooveRadar displayed in SelectSong. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -17,18 +17,32 @@ #include "Song.h" +const int NUM_RADAR_CATEGORIES = 5; + class GrooveRadar : public ActorFrame { public: - GrooveRadar::GrooveRadar(); + GrooveRadar(); - void LoadFromSong( Song* pSong ); // NULL means no Song + virtual void Update( float fDeltaTime ); + virtual void RenderPrimitives(); + + void SetFromNoteMetadata( PlayerNumber p, NoteMetadata* pNoteMetadata ); // NULL means no Song + + void TweenOnScreen(); + void TweenOffScreen(); protected: - Sprite m_sprRadar; + + bool m_bValuesVisible[NUM_PLAYERS]; + float m_PercentTowardNew[NUM_PLAYERS]; + float m_fValuesNew[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; + float m_fValuesOld[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; + + Sprite m_sprRadarBase; + Sprite m_sprRadarWords; }; - #endif \ No newline at end of file diff --git a/stepmania/src/HoldGhostArrow.h b/stepmania/src/HoldGhostArrow.h index 0ffe090825..7278d1cf62 100644 --- a/stepmania/src/HoldGhostArrow.h +++ b/stepmania/src/HoldGhostArrow.h @@ -16,7 +16,7 @@ class HoldGhostArrow; #include "Sprite.h" -#include "Pattern.h" +#include "NoteMetadata.h" class HoldGhostArrow : public Sprite diff --git a/stepmania/src/HoldJudgement.cpp b/stepmania/src/HoldJudgement.cpp index a286d21963..c095bcf5f2 100644 --- a/stepmania/src/HoldJudgement.cpp +++ b/stepmania/src/HoldJudgement.cpp @@ -5,7 +5,7 @@ Desc: A graphic displayed in the HoldJudgement during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/HoldJudgement.h b/stepmania/src/HoldJudgement.h index 46bf5bab83..ea070c1f19 100644 --- a/stepmania/src/HoldJudgement.h +++ b/stepmania/src/HoldJudgement.h @@ -4,7 +4,7 @@ Desc: A graphic displayed in the HoldJudgement during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/IniFile.cpp b/stepmania/src/IniFile.cpp index 8f18f77ffb..e204b48060 100644 --- a/stepmania/src/IniFile.cpp +++ b/stepmania/src/IniFile.cpp @@ -4,7 +4,7 @@ Desc: Wrapper for reading and writing an .ini file. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/IniFile.h b/stepmania/src/IniFile.h index e96d5e234a..c6dbdbb2ce 100644 --- a/stepmania/src/IniFile.h +++ b/stepmania/src/IniFile.h @@ -4,7 +4,7 @@ Desc: Wrapper for reading and writing an .ini file. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/InputFilter.cpp b/stepmania/src/InputFilter.cpp new file mode 100644 index 0000000000..189a69d20d --- /dev/null +++ b/stepmania/src/InputFilter.cpp @@ -0,0 +1,87 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: InputFilter + + Desc: See header. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include // for fmod +#include "InputFilter.h" +#include "RageHelper.h" +#include "RageInput.h" +#include "ErrorCatcher/ErrorCatcher.h" + +InputFilter* FILTER = NULL; // global and accessable from anywhere in our program + + + +void InputFilter::GetInputEvents( InputEventArray &array, float fDeltaTime ) +{ + INPUTM->Update(); + + for( int d=0; dWasBeingPressed(di) ) + { + if( INPUTM->IsBeingPressed(di) ) + { + const float fOldHoldTime = m_fTimeHeld[d][b]; + m_fTimeHeld[d][b] += fDeltaTime; + const float fNewHoldTime = m_fTimeHeld[d][b]; + + float fTimeBetweenRepeats; + InputEventType iet; + if( fOldHoldTime > TIME_BEFORE_SLOW_REPEATS ) + { + if( fOldHoldTime > TIME_BEFORE_FAST_REPEATS ) + { + fTimeBetweenRepeats = TIME_BETWEEN_FAST_REPEATS; + iet = IET_FAST_REPEAT; + } + else + { + fTimeBetweenRepeats = TIME_BETWEEN_SLOW_REPEATS; + iet = IET_SLOW_REPEAT; + } + if( int(fOldHoldTime/fTimeBetweenRepeats) != int(fNewHoldTime/fTimeBetweenRepeats) ) + array.Add( InputEvent(di,iet) ); + } + } + else // !INPUTM->IsBeingPressed(di) + m_fTimeHeld[d][b] = 0; + } + else // !INPUTM->WasBeingPressed(di) + { + if( INPUTM->IsBeingPressed(di) ) + array.Add( InputEvent(di,IET_FIRST_PRESS) ); + else // !INPUTM->IsBeingPressed(di) + ; // don't care + } + } + } +} \ No newline at end of file diff --git a/stepmania/src/InputFilter.h b/stepmania/src/InputFilter.h new file mode 100644 index 0000000000..d45e480582 --- /dev/null +++ b/stepmania/src/InputFilter.h @@ -0,0 +1,56 @@ +#pragma once +/* +----------------------------------------------------------------------------- + Class: InputFilter + + Desc: Checks RageInput and generates a list of InputEvents, which can + represent when a button is first pressed, when a button is released, + or when an repeating input fires. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "RageInput.h" + +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_FAST_REPEATS = 0.125f; + +enum InputEventType { IET_FIRST_PRESS, IET_SLOW_REPEAT, IET_FAST_REPEAT, IET_RELEASE }; + +class InputEvent : public DeviceInput +{ +public: + InputEvent() { type=IET_FIRST_PRESS; }; + InputEvent( InputDevice d, int b, InputEventType t ) { device=d; button=b; type=t; }; + InputEvent( DeviceInput di, InputEventType t ) { device=di.device; button=di.button; type=t; }; + + InputEventType type; +}; + +typedef CArray InputEventArray; + +class InputFilter +{ +public: + InputFilter() + { + for( int i=0; im_sCurrentGame; + + ReadMappingsFromDisk(); +} + + +InputMapper::~InputMapper() +{ + // don't worry about releasing the Song array. Let the OS do it :-) + SaveMappingsToDisk(); +} + + +void InputMapper::ReadMappingsFromDisk() +{ + ASSERT( GAME != NULL ); + + IniFile ini; + ini.SetPath( m_sCurrentGame + ".ini" ); + if( !ini.ReadFile() ) { + return; // load nothing + //FatalError( "could not read config file" ); + } + + CMapStringToString* pKey = ini.GetKeyPointer("Input"); + CString name_string, value_string; + + if( pKey != NULL ) + { + for( POSITION pos = pKey->GetStartPosition(); pos != NULL; ) + { + pKey->GetNextAssoc( pos, name_string, value_string ); + + GameInput GameI; + GameI.fromString(name_string); + + CStringArray sDeviceInputStrings; + split( value_string, ",", sDeviceInputStrings, false ); + + for( int i=0; iGetCurrentStyleDef(); + StyleI = pStyleDef->GameInputToStyleInput( GameI ); +} + +void InputMapper::GameToMenu( GameInput GameI, MenuInput &MenuI ) +{ + GameDef* pGameDef = GAME->GetCurrentGameDef(); + MenuI = pGameDef->GameInputToMenuInput( GameI ); +} + +void InputMapper::StyleToGame( StyleInput StyleI, GameInput &GameI ) +{ + StyleDef* pStyleDef = GAME->GetCurrentStyleDef(); + GameI = pStyleDef->StyleInputToGameInput( StyleI ); +} + +void InputMapper::MenuToGame( MenuInput MenuI, GameInput &GameI ) +{ + GameDef* pGameDef = GAME->GetCurrentGameDef(); + GameI = pGameDef->MenuInputToGameInput( MenuI ); +} + +bool InputMapper::IsButtonDown( GameInput GameI ) +{ + for( int i=0; iIsBeingPressed( DeviceI ) ) + return true; + } + } + + return false; +} + +bool InputMapper::IsButtonDown( MenuInput MenuI ) +{ + GameInput GameI; + MenuToGame( MenuI, GameI ); + return IsButtonDown( GameI ); +} + + +bool InputMapper::IsButtonDown( StyleInput StyleI ) +{ + GameInput GameI; + StyleToGame( StyleI, GameI ); + return IsButtonDown( GameI ); +} + + + diff --git a/stepmania/src/InputMapper.h b/stepmania/src/InputMapper.h new file mode 100644 index 0000000000..1c3e3f4f0b --- /dev/null +++ b/stepmania/src/InputMapper.h @@ -0,0 +1,78 @@ +#pragma once +/* +----------------------------------------------------------------------------- + Class: InputMapper + + Desc: Holds user-chosen preferences and saves it between sessions. This class + also has temporary holders for information that passed between windows - e.g. + ScoreSummary. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "RageInput.h" +#include "GameInput.h" +#include "MenuInput.h" +#include "StyleInput.h" +#include "GameTypes.h" + + + +const int NUM_GAME_TO_DEVICE_SLOTS = 3; // three device inputs may map to one game input + + +class InputMapper +{ +public: + InputMapper(); + ~InputMapper(); + + void SwitchGame( CString sNewGame ) + { + SaveMappingsToDisk(); + m_sCurrentGame = sNewGame; + ReadMappingsFromDisk(); + }; + + void ReadMappingsFromDisk(); + void SaveMappingsToDisk(); + + + // input mapping stuff + void SetInputMap( DeviceInput DeviceI, GameInput GameI, int iSlotIndex, bool bOverrideHardCoded = false ); + void ClearFromInputMap( DeviceInput DeviceI ); + void ClearFromInputMap( GameInput GameI, int iSlotIndex ); + + bool DeviceToGame( DeviceInput DeviceI, GameInput& GameI ); // return true if there is a mapping from device to pad + bool GameToDevice( GameInput GameI, int iSoltNum, DeviceInput& DeviceI ); // return true if there is a mapping from pad to device + + MenuInput DeviceToMenu( DeviceInput DeviceI ); + DeviceInput MenuToDevice( MenuInput MenuI ); + + void GameToStyle( GameInput GameI, StyleInput &StyleI ); + void StyleToGame( StyleInput StyleI, GameInput &GameI ); + + void GameToMenu( GameInput GameI, MenuInput &MenuI ); + void MenuToGame( MenuInput MenuI, GameInput &GameI ); + + bool IsButtonDown( GameInput GameI ); + bool IsButtonDown( MenuInput MenuI ); + bool IsButtonDown( StyleInput StyleI ); + + +protected: + CString m_sCurrentGame; + + // all the DeviceInputs that map to a GameInput + DeviceInput m_GItoDI[NUM_INSTRUMENTS][NUM_INSTRUMENT_BUTTONS][NUM_GAME_TO_DEVICE_SLOTS]; + + // lookup for efficiency from a DeviceInput to a GameInput + // This is repopulated every time m_PItoDI changes by calling UpdateTempDItoPI(). + GameInput m_tempDItoGI[NUM_INPUT_DEVICES][NUM_DEVICE_BUTTONS]; + void UpdateTempDItoGI(); +}; + + +extern InputMapper* MAPPER; // global and accessable from anywhere in our program diff --git a/stepmania/src/Judgement.cpp b/stepmania/src/Judgement.cpp index fdc4a75f6c..c340c72fd0 100644 --- a/stepmania/src/Judgement.cpp +++ b/stepmania/src/Judgement.cpp @@ -5,7 +5,7 @@ Desc: A graphic displayed in the Judgement during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/Judgement.h b/stepmania/src/Judgement.h index 1f1e9ddfc3..a57a8fc57f 100644 --- a/stepmania/src/Judgement.h +++ b/stepmania/src/Judgement.h @@ -4,7 +4,7 @@ Desc: A graphic displayed in the Judgement during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/MenuElements.cpp b/stepmania/src/MenuElements.cpp index 52df1432fe..87de16465a 100644 --- a/stepmania/src/MenuElements.cpp +++ b/stepmania/src/MenuElements.cpp @@ -5,7 +5,7 @@ Desc: Base class for menu Windows. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -44,6 +44,7 @@ void MenuElements::Load( CString sBackgroundPath, CString sTopEdgePath, CString m_sprTopEdge.Load( sTopEdgePath ); m_sprTopEdge.TurnShadowOff(); m_sprTopEdge.SetZ( -1 ); + m_sprTopEdge.SetY( SCREEN_TOP + m_sprTopEdge.GetZoomedHeight()/2.0f ); m_sprBottomEdge.Load( THEME->GetPathTo(GRAPHIC_MENU_BOTTOM_EDGE) ); m_sprBottomEdge.TurnShadowOff(); @@ -71,8 +72,8 @@ void MenuElements::TweenTopEdgeOnScreen() { SetTopEdgeOffScreen(); - m_sprTopEdge.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); - m_sprTopEdge.SetTweenY( m_sprTopEdge.GetZoomedHeight()/2 ); + m_sprTopEdge.BeginTweening( MENU_ELEMENTS_TWEEN_TIME*2, TWEEN_SPRING ); + m_sprTopEdge.SetTweenX( CENTER_X ); float fOriginalZoomY = m_textHelp.GetZoomY(); m_textHelp.SetZoomY( 0 ); @@ -86,8 +87,9 @@ void MenuElements::TweenTopEdgeOffScreen() { SetTopEdgeOnScreen(); - m_sprTopEdge.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); - m_sprTopEdge.SetTweenY( -m_sprTopEdge.GetZoomedHeight() ); + m_sprTopEdge.BeginTweening( MENU_ELEMENTS_TWEEN_TIME*2, TWEEN_BIAS_END ); + m_sprTopEdge.SetTweenX( SCREEN_WIDTH*1.5f ); + m_textHelp.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); m_textHelp.SetTweenZoomY( 0 ); @@ -147,12 +149,12 @@ void MenuElements::SetBackgroundOffScreen() void MenuElements::SetTopEdgeOnScreen() { - m_sprTopEdge.SetXY( CENTER_X, m_sprTopEdge.GetZoomedHeight() ); + m_sprTopEdge.SetXY( CENTER_X, m_sprTopEdge.GetZoomedHeight()/2 ); } void MenuElements::SetTopEdgeOffScreen() { - m_sprTopEdge.SetXY( CENTER_X, -m_sprTopEdge.GetZoomedHeight() ); + m_sprTopEdge.SetXY( CENTER_X+SCREEN_WIDTH, m_sprTopEdge.GetZoomedHeight()/2 ); } diff --git a/stepmania/src/MenuElements.h b/stepmania/src/MenuElements.h index 800e0690e5..37f7b37626 100644 --- a/stepmania/src/MenuElements.h +++ b/stepmania/src/MenuElements.h @@ -4,7 +4,7 @@ Desc: Base class for menu Windows. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ #ifndef _MenuElements_H_ diff --git a/stepmania/src/MenuInput.h b/stepmania/src/MenuInput.h new file mode 100644 index 0000000000..763aa77b21 --- /dev/null +++ b/stepmania/src/MenuInput.h @@ -0,0 +1,46 @@ +#pragma once +/* +----------------------------------------------------------------------------- + Class: MenuInput + + Desc: An input event specific to a menu navigation. This is generated based + on a GameDef. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "GameTypes.h" + +enum MenuButton +{ + MENU_BUTTON_LEFT = 0, + MENU_BUTTON_RIGHT, + MENU_BUTTON_UP, + MENU_BUTTON_DOWN, + MENU_BUTTON_NEXT, + MENU_BUTTON_BACK, + NUM_MENU_BUTTONS, // leave this at the end + MENU_BUTTON_NONE +}; + + +struct MenuInput +{ + MenuInput() { MakeBlank(); }; + MenuInput( PlayerNumber p, MenuButton b ) { player = p; button = b; }; + + + PlayerNumber player; + MenuButton button; + + bool operator==( const MenuInput &other ) { return player == other.player && button == other.button; }; + + inline bool IsBlank() const { return player == PLAYER_NONE; }; + inline bool IsValid() const { return !IsBlank(); }; + inline void MakeBlank() { player = PLAYER_NONE; button = MENU_BUTTON_NONE; }; + +}; + + diff --git a/stepmania/src/MotionBlurSprite.cpp b/stepmania/src/MotionBlurSprite.cpp index 0532d22da2..bb876418b0 100644 --- a/stepmania/src/MotionBlurSprite.cpp +++ b/stepmania/src/MotionBlurSprite.cpp @@ -5,7 +5,7 @@ Desc: A graphic that appears to blur and come into focus. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/MotionBlurSprite.h b/stepmania/src/MotionBlurSprite.h index 7e88db4510..00f15519cb 100644 --- a/stepmania/src/MotionBlurSprite.h +++ b/stepmania/src/MotionBlurSprite.h @@ -4,7 +4,7 @@ Desc: A graphic that appears to blur and come into focus. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/MusicSortDisplay.cpp b/stepmania/src/MusicSortDisplay.cpp index cb62ffe442..fd3bbd8e95 100644 --- a/stepmania/src/MusicSortDisplay.cpp +++ b/stepmania/src/MusicSortDisplay.cpp @@ -5,7 +5,7 @@ Desc: A graphic displayed in the MusicSortDisplay during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/MusicSortDisplay.h b/stepmania/src/MusicSortDisplay.h index 5d4df4aa66..97f04f5745 100644 --- a/stepmania/src/MusicSortDisplay.h +++ b/stepmania/src/MusicSortDisplay.h @@ -4,7 +4,7 @@ Desc: A graphic displayed in the MusicSortDisplay during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/MusicStatusDisplay.cpp b/stepmania/src/MusicStatusDisplay.cpp index 1410f1685f..fa85277dc0 100644 --- a/stepmania/src/MusicStatusDisplay.cpp +++ b/stepmania/src/MusicStatusDisplay.cpp @@ -5,7 +5,7 @@ Desc: A graphic displayed in the MusicStatusDisplay during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/MusicStatusDisplay.h b/stepmania/src/MusicStatusDisplay.h index 06bc8bbfdb..1e335b33c8 100644 --- a/stepmania/src/MusicStatusDisplay.h +++ b/stepmania/src/MusicStatusDisplay.h @@ -4,7 +4,7 @@ Desc: A graphic displayed in the MusicStatusDisplay during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 68e4d2318a..cb77435f77 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -5,7 +5,7 @@ Desc: A graphic displayed in the MusicWheel during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -24,28 +24,30 @@ const float SWITCH_MUSIC_TIME = 0.3f; -const float SORT_ICON_ON_SCREEN_X = -395; -const float SORT_ICON_ON_SCREEN_Y = -176; +const float SORT_ICON_ON_SCREEN_X = 146; +const float SORT_ICON_ON_SCREEN_Y = 0; -const float SORT_ICON_OFF_SCREEN_X = SORT_ICON_ON_SCREEN_X - 200; +const float SORT_ICON_OFF_SCREEN_X = SORT_ICON_ON_SCREEN_X + 64; const float SORT_ICON_OFF_SCREEN_Y = SORT_ICON_ON_SCREEN_Y; D3DXCOLOR COLOR_BANNER_TINTS[] = { - D3DXCOLOR( 0.0f, 1.0f, 0.0f, 1 ), - D3DXCOLOR( 0.0f, 1.0f, 1.0f, 1 ), - D3DXCOLOR( 1.0f, 0.0f, 1.0f, 1 ), - D3DXCOLOR( 1.0f, 0.0f, 0.0f, 1 ), - D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1 ), + 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.2f, 0.1f, 0.3f, 1 ), // purple + 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 @@ -75,27 +77,36 @@ void WheelItemData::LoadFromSong( Song* pSong ) { ASSERT( pSong != NULL ); m_pSong = pSong; - m_WheelItemType = TYPE_MUSIC; + m_WheelItemType = TYPE_SONG; } WheelItemDisplay::WheelItemDisplay() { - m_MusicStatusDisplay.SetXY( -132, 0 ); + m_MusicStatusDisplay.SetXY( -136, 0 ); m_Banner.SetHorizAlign( align_left ); - m_Banner.SetXY( 15, 0 ); + m_Banner.SetXY( -30, 0 ); - m_sprSectionBackground.Load( THEME->GetPathTo(GRAPHIC_SECTION_BACKGROUND) ); - m_sprSectionBackground.SetXY( -30, 0 ); + m_sprSongBar.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SONG_BAR) ); + m_sprSongBar.SetXY( 0, 0 ); + + m_sprSectionBar.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SECTION_BAR) ); + m_sprSectionBar.SetXY( -30, 0 ); m_textSectionName.Load( THEME->GetPathTo(FONT_BOLD) ); m_textSectionName.TurnShadowOff(); m_textSectionName.SetHorizAlign( align_left ); m_textSectionName.SetVertAlign( align_middle ); - m_textSectionName.SetXY( m_sprSectionBackground.GetX() - m_sprSectionBackground.GetUnzoomedWidth()/2 + 10, 0 ); - m_textSectionName.SetZoom( 1.2f ); + m_textSectionName.SetXY( m_sprSectionBar.GetX() - m_sprSectionBar.GetUnzoomedWidth()/2 + 10, 0 ); + m_textSectionName.SetZoom( 1.0f ); m_textSectionName.SetDiffuseColor( COLOR_SECTION_LETTER ); + + for( int p=0; p 15 && - -1 != m_sSectionName.Find(' ', m_sSectionName.GetLength()/3) ) // this is space in the name { - int iIndexSplit = m_sSectionName.Find( ' ', m_sSectionName.GetLength()/3 ); - m_sSectionName.SetAt( iIndexSplit, '\n' ); + CString sDisplayName = SONG->ShortenGroupName(m_sSectionName); + + if( sDisplayName.GetLength() <= 4 ) + m_textSectionName.SetZoom( 2 ); + else + m_textSectionName.SetZoom( 1 ); + m_textSectionName.SetText( sDisplayName ); - m_textSectionName.SetZoom( 0.6f ); - m_textSectionName.SetText( m_sSectionName ); - } - else // this is a short name - { - m_textSectionName.SetZoom( 1.2f ); - m_textSectionName.SetText( m_sSectionName ); - } float fTextWidth, fSpriteWidth; fTextWidth = m_textSectionName.GetWidestLineWidthInSourcePixels() * m_textSectionName.GetZoom(); - fSpriteWidth = m_sprSectionBackground.GetUnzoomedWidth() * m_sprSectionBackground.GetZoom() - 20; + fSpriteWidth = m_sprSectionBar.GetUnzoomedWidth() * m_sprSectionBar.GetZoom() - 20; if( fTextWidth > fSpriteWidth ) m_textSectionName.SetZoomX( m_textSectionName.GetZoom() * fSpriteWidth / fTextWidth ); - m_sprSectionBackground.SetDiffuseColor( m_colorTint ); + m_sprSectionBar.SetDiffuseColor( m_colorTint ); + } break; - case TYPE_MUSIC: + case TYPE_SONG: + { + m_Banner.LoadFromSong( m_pSong ); m_Banner.SetDiffuseColor( m_colorTint ); m_MusicStatusDisplay.SetType( m_MusicStatusDisplayType ); + for( int p=0; pIsPlayerEnabled( (PlayerNumber)p ) ) + { + const DifficultyClass dc = PREFS->m_PreferredDifficultyClass[p]; + const Grade grade = m_pSong->GetGradeForDifficultyClass( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, dc ); + m_GradeDisplay[p].SetGrade( grade ); + m_GradeDisplay[p].SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); + } + else // !IsPlayerEnabled + { + m_GradeDisplay[p].SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); + } + } + + } break; default: ASSERT( false ); // invalid type @@ -164,7 +189,7 @@ void WheelItemDisplay::SetDiffuseColor( D3DXCOLOR c ) colorTempTint.b *= c.b; m_Banner.SetDiffuseColor( colorTempTint ); - m_sprSectionBackground.SetDiffuseColor( colorTempTint ); + m_sprSectionBar.SetDiffuseColor( colorTempTint ); D3DXCOLOR colorTempLetter = COLOR_SECTION_LETTER; colorTempLetter.a = c.a; @@ -184,12 +209,15 @@ void WheelItemDisplay::Update( float fDeltaTime ) switch( m_WheelItemType ) { case TYPE_SECTION: - m_sprSectionBackground.Update( fDeltaTime ); + m_sprSectionBar.Update( fDeltaTime ); m_textSectionName.Update( fDeltaTime ); break; - case TYPE_MUSIC: + case TYPE_SONG: + m_sprSongBar.Update( fDeltaTime ); m_MusicStatusDisplay.Update( fDeltaTime ); m_Banner.Update( fDeltaTime ); + for( int p=0; pGetPathTo(GRAPHIC_MUSIC_SELECTION_HIGHLIGHT) ); - m_sprSelectionBackground.SetXY( 0, 0 ); - m_sprSelectionBackground.SetDiffuseColor( D3DXCOLOR(0,0,0.7f,0.5f) ); // dark transparent blue - - m_sprSelectionOverlay.Load( THEME->GetPathTo(GRAPHIC_MUSIC_SELECTION_HIGHLIGHT) ); + m_sprSelectionOverlay.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SONG_HIGHLIGHT) ); m_sprSelectionOverlay.SetXY( 0, 0 ); m_sprSelectionOverlay.SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); // invisible m_sprSelectionOverlay.SetEffectGlowing( 1.5f, D3DXCOLOR(1,1,1,0.1f), D3DXCOLOR(1,1,1,1) ); @@ -277,27 +304,32 @@ MusicWheel::MusicWheel() for( int so=0; som_pCurSong == NULL && // if there is no currently selected song SONG->m_pSongs.GetSize() > 0 ) // and there is at least one song { - SONG->m_pCurSong = SONG->m_pSongs[0]; // select the first song + CArray arraySongs; + SONG->GetSongsInGroup( SONG->m_sPreferredGroup, arraySongs ); + + if( arraySongs.GetSize() > 0 ) + SONG->m_pCurSong = arraySongs[0]; // select the first song } - - // find the previously selected song (if any) - for( i=0; im_pCurSong != NULL ) { - if( GetCurWheelItemDatas()[i].m_pSong != NULL - && GetCurWheelItemDatas()[i].m_pSong == SONG->m_pCurSong ) + // find the previously selected song (if any) + for( i=0; im_pCurSong ) + { + m_iSelection = i; // select it + m_sExpandedSectionName = GetCurWheelItemDatas()[m_iSelection].m_sSectionName; // make its group the currently expanded group + break; + } } } - // rebuild the WheelItems that appear on screen RebuildWheelItemDisplays(); @@ -316,13 +348,13 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr /////////////////////////////////// CArray arraySongs; - // copy only song that have at least one Pattern for the current GameMode + // copy only song that have at least one NoteMetadata for the current GameMode for( int i=0; im_pSongs.GetSize(); i++ ) { Song* pSong = SONG->m_pSongs[i]; - CArray arraySteps; - pSong->GetPatternsThatMatchStyle( GAME->m_DanceStyle, arraySteps ); + CArray arraySteps; + pSong->GetNoteMetadatasThatMatchGameAndStyle( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, arraySteps ); if( arraySteps.GetSize() > 0 ) arraySongs.Add( pSong ); @@ -359,29 +391,21 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr arrayWheelItemDatas.RemoveAll(); // clear out the previous wheel items... // ...and load new ones + + bool bUseSections; switch( so ) { - case SORT_MOST_PLAYED: - case SORT_BPM: - // make WheelItems without sections - arrayWheelItemDatas.SetSize( arraySongs.GetSize() ); - { - for( int i=0; iGetGroupName()]; - WID.m_sSectionName = ""; - } - } - break; - case SORT_GROUP: - case SORT_TITLE: + case SORT_MOST_PLAYED: bUseSections = false; break; + case SORT_BPM: bUseSections = false; break; + case SORT_GROUP: bUseSections = SONG->m_sPreferredGroup != "ALL MUSIC"; break; + case SORT_TITLE: bUseSections = true; break; // case SORT_ARTIST: - { - // make WheelItemDatas with sections + default: ASSERT( false ); + } + if( bUseSections ) + { + // make WheelItemDatas with sections arrayWheelItemDatas.SetSize( arraySongs.GetSize()*2 ); // make sure we have enough room for all music and section items CString sLastSection = ""; @@ -406,11 +430,21 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr 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 + arrayWheelItemDatas.SetSize( iCurWheelItem ); // make sure we have enough room for all music and section items + } + else + { + arrayWheelItemDatas.SetSize( arraySongs.GetSize() ); + { + for( int i=0; iGetGroupName()]; + WID.m_sSectionName = ""; + } } - break; - default: - ASSERT( false ); // unhandled SORT_ORDER } // init crowns @@ -451,16 +485,18 @@ void MusicWheel::SwitchSortOrder() float MusicWheel::GetBannerY( float fPosOffsetsFromMiddle ) { - return fPosOffsetsFromMiddle*43.2f; + return fPosOffsetsFromMiddle*44; } float MusicWheel::GetBannerBrightness( float fPosOffsetsFromMiddle ) { - return 1 - fabsf(fPosOffsetsFromMiddle)*0.11f; + //return 1 - fabsf(fPosOffsetsFromMiddle)*0.11f; + return 1; } float MusicWheel::GetBannerAlpha( float fPosOffsetsFromMiddle ) { + /* if( m_WheelState == STATE_FLYING_OFF_BEFORE_NEXT_SORT || m_WheelState == STATE_TWEENING_OFF_SCREEN ) { @@ -479,33 +515,51 @@ float MusicWheel::GetBannerAlpha( float fPosOffsetsFromMiddle ) { return 1; } + */ + return 1; } float MusicWheel::GetBannerX( float fPosOffsetsFromMiddle ) { float fX = (1-cosf((fPosOffsetsFromMiddle)/3))*95.0f; - - if( m_WheelState == STATE_FLYING_OFF_BEFORE_NEXT_SORT - || m_WheelState == STATE_TWEENING_OFF_SCREEN ) + + float fPercentOffScreen = 0; + switch( m_WheelState ) { + case STATE_FLYING_OFF_BEFORE_NEXT_SORT: + case STATE_TWEENING_OFF_SCREEN: + fPercentOffScreen = 1 - (m_fTimeLeftInState / FADE_TIME); + break; + case STATE_FLYING_ON_AFTER_NEXT_SORT: + case STATE_TWEENING_ON_SCREEN: + fPercentOffScreen = m_fTimeLeftInState / FADE_TIME; + break; + default: + fPercentOffScreen = 1; + break; + } + + switch( m_WheelState ) + { + case STATE_FLYING_OFF_BEFORE_NEXT_SORT: + case STATE_TWEENING_OFF_SCREEN: + case STATE_FLYING_ON_AFTER_NEXT_SORT: + case STATE_TWEENING_ON_SCREEN: + { + /* float fDistFromCenter = fabsf( fPosOffsetsFromMiddle ); float fPercentOffScreen = 1- (m_fTimeLeftInState / FADE_TIME); float fXLogicalOffset = max( 0, fPercentOffScreen - 1 + (fDistFromCenter+3)/6 ); fXLogicalOffset = powf( fXLogicalOffset, 1.7f ); // accelerate float fXPixelOffset = fXLogicalOffset * 600; fX += fXPixelOffset; + */ + const float fShift = fPosOffsetsFromMiddle/NUM_WHEEL_ITEMS_TO_DRAW - 0.5f; // this is always < 0 + const float fXTween = fShift * 800 + fPercentOffScreen * 1200; + fX = max( fX, fXTween ); + } + break; } - else if( m_WheelState == STATE_FLYING_ON_AFTER_NEXT_SORT - || m_WheelState == STATE_TWEENING_ON_SCREEN ) - { - float fDistFromCenter = fabsf( fPosOffsetsFromMiddle ); - float fPercentOffScreen = m_fTimeLeftInState / FADE_TIME; - float fXLogicalOffset = max( 0, fPercentOffScreen - 1 + (fDistFromCenter+3)/6 ); - fXLogicalOffset = powf( fXLogicalOffset, 1.7f ); // accelerate - float fXPixelOffset = fXLogicalOffset * 600; - fX += fXPixelOffset; - } - return fX; } @@ -525,7 +579,7 @@ void MusicWheel::RebuildWheelItemDisplays() if( iIndex < 0 ) iIndex = GetCurWheelItemDatas().GetSize()-1; } - while( GetCurWheelItemDatas()[iIndex].m_WheelItemType == TYPE_MUSIC + while( GetCurWheelItemDatas()[iIndex].m_WheelItemType == TYPE_SONG && GetCurWheelItemDatas()[iIndex].m_sSectionName != "" && GetCurWheelItemDatas()[iIndex].m_sSectionName != m_sExpandedSectionName ); } @@ -545,7 +599,7 @@ void MusicWheel::RebuildWheelItemDisplays() if( iIndex > GetCurWheelItemDatas().GetSize()-1 ) iIndex = 0; } - while( GetCurWheelItemDatas()[iIndex].m_WheelItemType == TYPE_MUSIC + while( GetCurWheelItemDatas()[iIndex].m_WheelItemType == TYPE_SONG && GetCurWheelItemDatas()[iIndex].m_sSectionName != "" && GetCurWheelItemDatas()[iIndex].m_sSectionName != m_sExpandedSectionName ); } @@ -555,9 +609,6 @@ void MusicWheel::RebuildWheelItemDisplays() void MusicWheel::RenderPrimitives() { - m_sprSelectionBackground.Draw(); - - for( int i=0; i GetCurWheelItemDatas().GetSize()-1 ) m_iSelection = 0; } - while( GetCurWheelItemDatas()[m_iSelection].m_WheelItemType == TYPE_MUSIC + while( GetCurWheelItemDatas()[m_iSelection].m_WheelItemType == TYPE_SONG && GetCurWheelItemDatas()[m_iSelection].m_sSectionName != "" && GetCurWheelItemDatas()[m_iSelection].m_sSectionName != m_sExpandedSectionName ); @@ -815,7 +864,7 @@ bool MusicWheel::Select() } return false; - case TYPE_MUSIC: + case TYPE_SONG: default: return true; @@ -827,11 +876,8 @@ void MusicWheel::TweenOnScreen() m_WheelState = STATE_TWEENING_ON_SCREEN; m_fTimeLeftInState = FADE_TIME; - float fOriginalZoomY = m_sprSelectionBackground.GetZoomY(); - m_sprSelectionBackground.SetZoomY( 0 ); - m_sprSelectionBackground.BeginTweening( FADE_TIME ); - m_sprSelectionBackground.SetTweenZoomY( fOriginalZoomY ); - + float fOriginalZoomY; + fOriginalZoomY = m_sprSelectionOverlay.GetZoomY(); m_sprSelectionOverlay.SetZoomY( 0 ); m_sprSelectionOverlay.BeginTweening( FADE_TIME ); m_sprSelectionOverlay.SetTweenZoomY( fOriginalZoomY ); @@ -844,8 +890,6 @@ void MusicWheel::TweenOffScreen() m_WheelState = STATE_TWEENING_OFF_SCREEN; m_fTimeLeftInState = FADE_TIME; - m_sprSelectionBackground.BeginTweening( FADE_TIME ); - m_sprSelectionBackground.SetTweenZoomY( 0 ); m_sprSelectionOverlay.BeginTweening( FADE_TIME ); m_sprSelectionOverlay.SetTweenZoomY( 0 ); diff --git a/stepmania/src/MusicWheel.h b/stepmania/src/MusicWheel.h index 703c2c1792..d4abd49862 100644 --- a/stepmania/src/MusicWheel.h +++ b/stepmania/src/MusicWheel.h @@ -4,7 +4,7 @@ Desc: A graphic displayed in the MusicWheel during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -29,13 +29,13 @@ const int NUM_WHEEL_ITEMS_TO_DRAW = 11; -const float FADE_TIME = 0.5f; +const float FADE_TIME = 0.7f; const WindowMessage SM_SongChanged = WindowMessage(SM_User+47); // this should be unique! const WindowMessage SM_PlaySongSample = WindowMessage(SM_User+48); -enum WheelItemType { TYPE_SECTION, TYPE_MUSIC }; +enum WheelItemType { TYPE_SECTION, TYPE_SONG }; struct WheelItemData @@ -73,12 +73,14 @@ public: void LoadFromWheelItemData( WheelItemData* pWID ); // for a section - Sprite m_sprSectionBackground; - BitmapText m_textSectionName; + Sprite m_sprSectionBar; + BitmapText m_textSectionName; // for a music + Sprite m_sprSongBar; MusicStatusDisplay m_MusicStatusDisplay; TextBanner m_Banner; + GradeDisplay m_GradeDisplay[NUM_PLAYERS]; }; @@ -116,7 +118,6 @@ protected: void SwitchSortOrder(); - Sprite m_sprSelectionBackground; Sprite m_sprSelectionOverlay; MusicSortDisplay m_MusicSortDisplay; @@ -173,7 +174,7 @@ protected: // sTemp = "NUM"; // return sTemp; case SORT_TITLE: - sTemp = pSong->GetTitle(); + sTemp = pSong->GetFullTitle(); sTemp.MakeUpper(); sTemp = (sTemp.GetLength() > 0) ? sTemp.Left(1) : ""; if( IsAnInt(sTemp) ) diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp new file mode 100644 index 0000000000..e8c7783db0 --- /dev/null +++ b/stepmania/src/NoteData.cpp @@ -0,0 +1,640 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + File: NoteData.cpp + + Desc: A pattern of ColorArrows that past Y==0. + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "NoteData.h" +#include "RageUtil.h" +#include "ScreenDimensions.h" +#include "ThemeManager.h" +#include "ArrowEffects.h" +#include "PrefsManager.h" +#include "GameConstants.h" +#include "ErrorCatcher/ErrorCatcher.h" + + +NoteData::NoteData() +{ + for( int i=0; i= iNoteIndexBegin && hn.m_iStartIndex <= iNoteIndexEnd) || + (hn.m_iEndIndex >= iNoteIndexBegin && hn.m_iEndIndex <= iNoteIndexEnd) ) // overlap (kinda) + { + ; // do nothing + } + else // ! overlap + { + m_HoldNotes[iIndexWrite] = m_HoldNotes[iIndexRead]; + iIndexWrite++; + } + } + m_iNumHoldNotes = iIndexWrite; + +} + +void NoteData::CopyRange( NoteData* pFrom, NoteIndex iNoteIndexBegin, NoteIndex iNoteIndexEnd ) +{ + ASSERT( pFrom->m_iNumTracks == m_iNumTracks ); + + int i; + + // copy recorded TapNotes + for( i=iNoteIndexBegin; i<=iNoteIndexEnd; i++ ) + { + for( int c=0; cm_TapNotes[c][i]; + } + + // copy recorded HoldNotes + for( i=0; im_iNumHoldNotes; i++ ) + { + HoldNote hn = pFrom->m_HoldNotes[i]; + if( (hn.m_iStartIndex >= iNoteIndexBegin && hn.m_iStartIndex <= iNoteIndexEnd) || + (hn.m_iEndIndex >= iNoteIndexBegin && hn.m_iEndIndex <= iNoteIndexEnd) ) // overlap (kinda) + { + this->AddHoldNote( hn ); + } + } +} + +void NoteData::AddHoldNote( HoldNote add ) +{ + int i; + + // look for other hold notes that overlap and merge them + for( i=0; i= add.m_iStartIndex ) // these HoldNotes overlap (this isn't entirely correct!) + { + add.m_iStartIndex = min(add.m_iStartIndex, other.m_iStartIndex); + add.m_iEndIndex = max(add.m_iEndIndex, other.m_iEndIndex); + + // delete this HoldNote + for( int j=i; j 0 && index < m_iNumHoldNotes ); + + for( int j=index; j iOldestIndexFoundSoFar ) + iOldestIndexFoundSoFar = m_HoldNotes[i].m_iEndIndex; + } + + for( i=MAX_TAP_NOTE_ELEMENTS-1; i>=iOldestIndexFoundSoFar; i-- ) // iterate back to front + { + for( int t=0; t=0; i-- ) // foreach HoldNote + { + if( c >= iFirstRightSideColumn ) + { + // delete this HoldNote by shifting everything down + for( int j=i; j=0; i-- ) // foreach HoldNote + { + HoldNote &hn = m_HoldNotes[i]; + + if( hn.m_iTrack < iFirstRightSideColumn ) + { + // delete this HoldNote by shifting everything down + RemoveHoldNote( i ); + } + else + { + m_HoldNotes[i].m_iTrack -= 4; + } + } +} + +void NoteData::RemoveHoldNotes() +{ + // turn all the HoldNotes into TapNotes + for( int i=0; im_iNumTracks = m_iNumTracks; + + // transform m_TapNotes + for( int i=0; im_TapNotes[iNewCol][i] = m_TapNotes[iOldCol][i]; + } + } + + // transform m_HoldNotes + for( i=0; iAddHoldNote( newHN ); + } + } + } + + // + // copy note data from newData back into this + // + (*this) = *pNewData; +} + +void NoteData::MakeLittle() +{ + // filter out all non-quarter notes + for( int i=0; iGetLastBeat(); + int iLastMeasure = int( fLastBeat/BEATS_PER_MEASURE ); + + for( int m=0; m<=iLastMeasure; m++ ) // foreach measure + { + CString sMeasureString; + + int iMeasureStartIndex = m * ELEMENTS_PER_MEASURE; + int iMeasureLastIndex = (m+1) * ELEMENTS_PER_MEASURE - 1; + + // probe to find the smallest note type + NoteType nt; + int iNoteIndexSpacing; + for( nt=(NoteType)0; ntm_TapNotes[iOriginalTrack][i]; + + for( i=0; im_HoldNotes[i]; + if( hn.m_iTrack == iOriginalTrack ) + { + hn.m_iTrack = t; + this->AddHoldNote( hn ); + } + } + + } + +} diff --git a/stepmania/src/NoteData.h b/stepmania/src/NoteData.h new file mode 100644 index 0000000000..c0fb151919 --- /dev/null +++ b/stepmania/src/NoteData.h @@ -0,0 +1,176 @@ +#pragma once +/* +----------------------------------------------------------------------------- + File: NoteData.h + + Desc: Holds data about the notes that the player is supposed to hit. NoteData + is organized by: + track - corresponds to different columns of notes on the screen + index - corresponds to subdivisions of beats + + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "GameTypes.h" + +typedef unsigned char TapNote; +typedef unsigned char TrackNumber; +typedef unsigned short NoteIndex; +// '1' = tap note +// '2' = hold note begin +// '3' = hold note end ('1' can also end a HoldNote) +// ... for future expansion + + +enum TapNoteScore { + TNS_NONE, + TNS_PERFECT, + TNS_GREAT, + TNS_GOOD, + TNS_BOO, + TNS_MISS +}; + +//enum TapNoteTiming { +// TNT_NONE, +// TNT_EARLY, +// TNT_LATE +//}; + + +struct HoldNote +{ + TrackNumber m_iTrack; + NoteIndex m_iStartIndex; + NoteIndex m_iEndIndex; +}; + +enum HoldNoteResult +{ + HNR_NONE, // this HoldNote has not been scored yet + HNR_OK, // the HoldNote has passed and was successfully held all the way through + HNR_NG // the HoldNote has passed and they missed it +}; + +struct HoldNoteScore +{ + TapNoteScore m_TapNoteScore; // The scoring of the tap Note that begins the hold. + // This is judeged separately from the actual hold. + HoldNoteResult m_Result; + float m_fLife; // 1.0 means this HoldNote has full life. + // 0.0 means this HoldNote is dead + // When this value hits 0.0 for the first time, + // m_HoldScore becomes HSS_NG. + // If the life is > 0.0 when the HoldNote ends, then + // m_HoldScore becomes HSS_OK. + HoldNoteScore() + { + m_TapNoteScore = TNS_NONE; + m_Result = HNR_NONE; + m_fLife = 1.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; + +inline int BeatToNoteIndex( float fBeatNum ) { return int( fBeatNum * ELEMENTS_PER_BEAT + 0.5f); }; // round +inline int BeatToNoteIndexNotRounded( float fBeatNum ){ return (int)( fBeatNum * ELEMENTS_PER_BEAT ); }; +inline float NoteIndexToBeat( float fNoteIndex ) { return fNoteIndex / (float)ELEMENTS_PER_BEAT; }; +inline float NoteIndexToBeat( int iNoteIndex ) { return NoteIndexToBeat( (float)iNoteIndex ); }; + + +enum NoteType +{ + NOTE_4TH, // quarter notes + NOTE_8TH, // eighth notes + NOTE_12TH, // triplets + NOTE_16TH, // sixteenth notes + NUM_NOTE_TYPES +}; + +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; + } +}; + + + +class NoteData +{ +public: + NoteData(); + + int m_iNumTracks; + TapNote m_TapNotes[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ELEMENTS]; + HoldNote m_HoldNotes[MAX_HOLD_NOTE_ELEMENTS]; + int m_iNumHoldNotes; + + void ClearRange( NoteIndex iNoteIndexBegin, NoteIndex iNoteIndexEnd ); + void ClearAll() { ClearRange( 0, MAX_TAP_NOTE_ELEMENTS ); }; + void CopyRange( NoteData* pFrom, NoteIndex iNoteIndexBegin, NoteIndex iNoteIndexEnd ); + void CopyAll( NoteData* pFrom ) { m_iNumTracks = pFrom->m_iNumTracks; CopyRange( pFrom, 0, MAX_TAP_NOTE_ELEMENTS ); }; + + inline bool IsRowEmpty( NoteIndex index ) + { + for( int t=0; tGetPathTo(FONT_NORMAL) ); + m_textMeasureNumber.SetZoom( 1.0f ); + + m_rectMarkerBar.TurnShadowOff(); + m_rectMarkerBar.SetEffectGlowing(); + + m_Mode = MODE_DANCING; + + m_fBeginMarker = m_fEndMarker = -1; +} + + +void NoteField::Load( NoteData* pNoteData, PlayerOptions po, float fNumBeatsToDrawBehind, float fNumBeatsToDrawAhead, NoteFieldMode mode ) +{ + m_PlayerOptions = po; + m_fNumBeatsToDrawBehind = fNumBeatsToDrawBehind; + m_fNumBeatsToDrawAhead = fNumBeatsToDrawAhead; + m_Mode = mode; + + this->CopyAll( pNoteData ); + + // init arrow rotations and X positions + for( int c=0; cGetPathToGraphic( PLAYER_1, c, GRAPHIC_NOTE_COLOR_PART) ); + m_ColorArrow[c].m_sprGrayPart.Load( GAME->GetPathToGraphic( PLAYER_1, c, GRAPHIC_NOTE_GRAY_PART) ); + float fColOffsetFromCenter = c - (m_iNumTracks-1)/2.0f; + m_ColorArrow[c].SetX( fColOffsetFromCenter*ARROW_SIZE ); + } + + + ASSERT( m_iNumTracks == GAME->GetCurrentStyleDef()->GetColsPerPlayer() ); +} + +void NoteField::Update( float fDeltaTime, float fSongBeat ) +{ + m_fSongBeat = fSongBeat; + m_rectMarkerBar.Update( fDeltaTime ); +} + + + + +void NoteField::DrawTapNote( const int iCol, const float fIndex ) +{ + const float fYOffset = ArrowGetYOffset( m_PlayerOptions, fIndex, m_fSongBeat ); + const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset ); + const float fRotation = ArrowGetRotation( m_PlayerOptions, iCol, fYOffset ); + const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat ); + const float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos ); + + m_ColorArrow[iCol].SetXY( fXPos, fYPos ); + m_ColorArrow[iCol].SetRotation( fRotation ); + m_ColorArrow[iCol].SetColorPartFromIndexAndBeat( (int)fIndex, m_fSongBeat, m_PlayerOptions.m_ColorType ); + m_ColorArrow[iCol].SetGrayPartFromIndexAndBeat( (int)fIndex, m_fSongBeat ); + m_ColorArrow[iCol].SetAlpha( fAlpha ); + m_ColorArrow[iCol].Draw(); +} + +void NoteField::DrawTapNote( const int iCol, const float fIndex, const D3DXCOLOR color ) +{ + const float fYOffset = ArrowGetYOffset( m_PlayerOptions, fIndex, m_fSongBeat ); + const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset ); + const float fRotation = ArrowGetRotation( m_PlayerOptions, iCol, fYOffset ); + const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat ); + const float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos ); + + m_ColorArrow[iCol].SetXY( fXPos, fYPos ); + m_ColorArrow[iCol].SetRotation( fRotation ); + m_ColorArrow[iCol].SetDiffuseColor( color ); + m_ColorArrow[iCol].SetGrayPartFromIndexAndBeat( (int)fIndex, m_fSongBeat ); + m_ColorArrow[iCol].SetAlpha( fAlpha ); + m_ColorArrow[iCol].Draw(); +} + +void NoteField::DrawHoldNoteColorPart( const int iCol, const float fIndex, const HoldNote &hn, const float fHoldNoteLife ) +{ + const float fYOffset = ArrowGetYOffset( m_PlayerOptions, fIndex, m_fSongBeat ); + const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset ); + const float fRotation = ArrowGetRotation( m_PlayerOptions, iCol, fYOffset ); + const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat ); + const float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos ); + + D3DXCOLOR color( (fIndex-hn.m_iStartIndex)/(hn.m_iEndIndex-hn.m_iStartIndex), 1, 0, 1 ); // color shifts from green to yellow + color *= 1 - (1-fHoldNoteLife) / 1.2f; + color.a = 1; + + m_ColorArrow[iCol].SetXY( fXPos, fYPos ); + m_ColorArrow[iCol].SetRotation( fRotation ); + m_ColorArrow[iCol].SetDiffuseColor( color ); + m_ColorArrow[iCol].SetAlpha( fAlpha ); + m_ColorArrow[iCol].DrawColorPart(); +} + +void NoteField::DrawHoldNoteGrayPart( const int iCol, const float fIndex, const HoldNote &hn, const float fHoldNoteLife ) +{ + const float fYOffset = ArrowGetYOffset( m_PlayerOptions, fIndex, m_fSongBeat ); + const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset ); + const float fRotation = ArrowGetRotation( m_PlayerOptions, iCol, fYOffset ); + const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat ); + const float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos ); + + m_ColorArrow[iCol].SetXY( fXPos, fYPos ); + m_ColorArrow[iCol].SetRotation( fRotation ); + m_ColorArrow[iCol].SetAlpha( fAlpha ); + m_ColorArrow[iCol].DrawGrayPart(); +} + +void NoteField::DrawMeasureBar( const int iIndex, const int iMeasureNo ) +{ + const float fYOffset = ArrowGetYOffset( m_PlayerOptions, (float)iIndex, m_fSongBeat ); + const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset ); + + m_rectMeasureBar.SetXY( 0, fYPos ); + m_rectMeasureBar.SetWidth( (float)(m_iNumTracks+1) * ARROW_SIZE ); + m_rectMeasureBar.SetHeight( 20 ); + m_rectMeasureBar.SetDiffuseColor( D3DXCOLOR(0,0,0,0.5f) ); + m_rectMeasureBar.Draw(); + + m_textMeasureNumber.SetText( ssprintf("%d", iMeasureNo) ); + m_textMeasureNumber.SetXY( -m_rectMeasureBar.GetZoomedWidth()/2 + 10, fYPos ); + m_textMeasureNumber.Draw(); +} + +void NoteField::DrawMarkerBar( const int iIndex ) +{ + const float fYOffset = ArrowGetYOffset( m_PlayerOptions, (float)iIndex, m_fSongBeat ); + const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset ); + + m_rectMarkerBar.SetXY( 0, fYPos ); + m_rectMarkerBar.SetWidth( (float)(m_iNumTracks+1) * ARROW_SIZE ); + m_rectMarkerBar.SetHeight( 20 ); + m_rectMarkerBar.SetDiffuseColor( D3DXCOLOR(0,0,0,0.5f) ); + m_rectMarkerBar.Draw(); +} + +void NoteField::RenderPrimitives() +{ + //HELPER.Log( "NoteField::RenderPrimitives()" ); + + if( m_fSongBeat < 0 ) + m_fSongBeat = 0; + + int iBaseFrameNo = (int)(m_fSongBeat*2.5) % NUM_FRAMES_IN_COLOR_ARROW_SPRITE; // 2.5 is a "fudge number" :-) This should be based on BPM + + int iIndexFirstArrowToDraw = BeatToNoteIndex( m_fSongBeat - m_fNumBeatsToDrawBehind ); // 2 beats earlier + if( iIndexFirstArrowToDraw < 0 ) iIndexFirstArrowToDraw = 0; + int iIndexLastArrowToDraw = BeatToNoteIndex( m_fSongBeat + m_fNumBeatsToDrawAhead ); // 7 beats later + + //HELPER.Log( "Drawing elements %d through %d", iIndexFirstArrowToDraw, iIndexLastArrowToDraw ); + + + // + // Draw measure bars + // + if( m_Mode == MODE_EDITING ) + { + for( int i=iIndexFirstArrowToDraw; i<=iIndexLastArrowToDraw; i++ ) + { + if( i % ELEMENTS_PER_MEASURE == 0 ) + DrawMeasureBar( i, i / ELEMENTS_PER_MEASURE ); + } + } + + // + // Draw marker bars + // + if( m_Mode == MODE_EDITING ) + { + if( m_fBeginMarker != -1 ) + { + DrawMarkerBar( BeatToNoteIndex(m_fBeginMarker) ); + } + if( m_fEndMarker != -1 ) + { + DrawMarkerBar( BeatToNoteIndex(m_fEndMarker) ); + } + } + + // + // Draw all TapNotes + // + for( int i=iIndexFirstArrowToDraw; i<=iIndexLastArrowToDraw; i++ ) // for each row + { + if( !IsRowEmpty(i) ) + { + //HELPER.Log( "iYPos: %d, iFrameNo: %d, m_OriginalStep[i]: %d", iYPos, iFrameNo, m_OriginalStep[i] ); + + // See if there is a hold step that begins on this beat. Terribly inefficient! + bool bHoldNoteOnThisBeat = false; + for( int j=0; j iIndexLastArrowToDraw ) ) + { + continue; + } + + + int iCol = hn.m_iTrack; + float fHoldNoteLife = m_HoldNoteLife[i]; + + bool bActive = NoteIndexToBeat(hn.m_iStartIndex) > m_fSongBeat && m_fSongBeat < NoteIndexToBeat(hn.m_iEndIndex); + + if( bActive && m_Mode == MODE_DANCING ) + m_ColorArrow[iCol].SetGrayPartFull(); + else + m_ColorArrow[iCol].SetGrayPartClear(); + + + // draw the gray parts + for( float j=(float)hn.m_iStartIndex; + j<=hn.m_iEndIndex; + j+=INDICIES_BETWEEN_HOLD_BITS/m_PlayerOptions.m_fArrowScrollSpeed ) // for each arrow in the run + { + // check if this arrow is off the the screen + if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j) + continue; // skip this arrow + + if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteIndexToBeat(j) < m_fSongBeat ) + continue; // don't draw + + DrawHoldNoteGrayPart( iCol, j, hn, fHoldNoteLife ); + } + + // draw the color parts + for( j=(float)hn.m_iStartIndex; + j<=hn.m_iEndIndex; + j+=INDICIES_BETWEEN_HOLD_BITS/m_PlayerOptions.m_fArrowScrollSpeed ) // for each arrow in the run + { + // check if this arrow is off the the screen + if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j ) + continue; // skip this arrow + + if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteIndexToBeat(j) < m_fSongBeat ) + continue; // don't draw + + DrawHoldNoteColorPart( iCol, j, hn, fHoldNoteLife ); + } + + + // draw the first arrow on top of the others + j = (float)hn.m_iStartIndex; + + if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteIndexToBeat(j) < m_fSongBeat ) + { + ; // don't draw + } + else + { + DrawHoldNoteGrayPart( iCol, j, hn, fHoldNoteLife ); + DrawHoldNoteColorPart( iCol, j, hn, fHoldNoteLife ); + } + } +} + + + + +void NoteField::RemoveTapNoteRow( int iIndex ) +{ + for( int c=0; cAddActor( &m_GrayArrows ); - this->AddActor( &m_ColorArrowField ); - this->AddActor( &m_GhostArrows ); + this->AddActor( &m_GrayArrowRow ); + this->AddActor( &m_NoteField ); + this->AddActor( &m_GhostArrowRow ); this->AddActor( &m_Judgement ); - for( int c=0; cAddActor( &m_HoldJudgement[c] ); this->AddActor( &m_Combo ); this->AddActor( &m_LifeMeter ); @@ -56,51 +61,38 @@ Player::Player() } -void Player::Load( const StyleDef& StyleDef, PlayerNumber player_no, const Pattern& pattern, const PlayerOptions& po ) +void Player::Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOptions& po ) { //HELPER.Log( "Player::Load()", ); + this->CopyAll( pNoteData ); - m_Style = StyleDef; m_PlayerNumber = player_no; m_PlayerOptions = po; - Pattern pattern2 = pattern; - if( !po.m_bAllowFreezeArrows ) - pattern2.RemoveHoldNotes(); + this->RemoveHoldNotes(); - pattern2.Turn( po.m_TurnType ); + this->Turn( po.m_TurnType ); if( po.m_bLittle ) - pattern2.MakeLittle(); + this->MakeLittle(); - m_ColorArrowField.Load( StyleDef, pattern2, po, 1.5f, 5.5f, ColorArrowField::MODE_DANCING ); - m_GrayArrows.Load( po, StyleDef ); - m_GhostArrows.Load( po, StyleDef ); + m_NoteField.Load( (NoteData*)this, po, 1.5f, 5.5f, NoteField::MODE_DANCING ); - // load step elements - for( int i=0; i 0 ) { m_Judgement.SetJudgement( TNS_MISS ); @@ -138,32 +130,33 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference float fStartBeat = NoteIndexToBeat( (float)hn.m_iStartIndex ); float fEndBeat = NoteIndexToBeat( (float)hn.m_iEndIndex ); + const int iCol = hn.m_iTrack; + const StyleInput StyleI( m_PlayerNumber, hn.m_iTrack ); + const GameInput GameI = GAME->GetCurrentStyleDef()->StyleInputToGameInput( StyleI ); // update the life if( fStartBeat < m_fSongBeat && m_fSongBeat < fEndBeat ) // if the song beat is in the range of this hold { - PlayerInput PlayerI( m_PlayerNumber, hn.m_TapNote ); - bool bIsHoldingButton = PREFS->IsButtonDown( PlayerI ); + const bool bIsHoldingButton = MAPPER->IsButtonDown( GameI ); + if( bIsHoldingButton ) { hns.m_fLife += fDeltaTime/HOLD_ARROW_NG_TIME; hns.m_fLife = min( hns.m_fLife, 1 ); // clamp - int iCol = m_Style.TapNoteToColumnNumber( hn.m_TapNote ); - m_GhostArrows.HoldNote( iCol ); // update the "electric ghost" effect + m_GhostArrowRow.HoldNote( iCol ); // update the "electric ghost" effect } else // !bIsHoldingButton { hns.m_fLife -= fDeltaTime/HOLD_ARROW_NG_TIME; hns.m_fLife = max( hns.m_fLife, 0 ); // clamp } - m_ColorArrowField.SetHoldNoteLife( i, hns.m_fLife ); // update the ColorArrowField display + m_NoteField.SetHoldNoteLife( i, hns.m_fLife ); // update the NoteField display } // check for NG if( hns.m_fLife == 0 ) // the player has not pressed the button for a long time! { hns.m_Result = HNR_NG; - int iCol = m_Style.TapNoteToColumnNumber( hn.m_TapNote ); m_HoldJudgement[iCol].SetHoldJudgement( HNR_NG ); } @@ -173,9 +166,8 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference // this implies that hns.m_fLife > 0, or else we would have marked it NG above hns.m_fLife = 1; hns.m_Result = HNR_OK; - int iCol = m_Style.TapNoteToColumnNumber( hn.m_TapNote ); m_HoldJudgement[iCol].SetHoldJudgement( HNR_OK ); - m_ColorArrowField.SetHoldNoteLife( i, hns.m_fLife ); // update the ColorArrowField display + m_NoteField.SetHoldNoteLife( i, hns.m_fLife ); // update the NoteField display } } @@ -185,9 +177,9 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference m_LifeMeter.SetBeat( fSongBeat ); - m_GrayArrows.Update( fDeltaTime, fSongBeat ); - m_ColorArrowField.Update( fDeltaTime, fSongBeat ); - m_GhostArrows.Update( fDeltaTime, fSongBeat ); + m_GrayArrowRow.Update( fDeltaTime, fSongBeat ); + m_NoteField.Update( fDeltaTime, fSongBeat ); + m_GhostArrowRow.Update( fDeltaTime, fSongBeat ); m_fSongBeat = fSongBeat; // save song beat @@ -221,9 +213,9 @@ void Player::RenderPrimitives() SCREEN->GetDevice()->SetTransform( D3DTS_PROJECTION, &matNewProj ); } - m_GrayArrows.Draw(); - m_ColorArrowField.Draw(); - m_GhostArrows.Draw(); + m_GrayArrowRow.Draw(); + m_NoteField.Draw(); + m_GhostArrowRow.Draw(); if( m_PlayerOptions.m_EffectType == PlayerOptions::EFFECT_SPACE ) { @@ -238,7 +230,7 @@ void Player::RenderPrimitives() m_Judgement.Draw(); - for( int c=0; c= 0 && col <= m_iNumTracks ); - m_GrayArrows.Step( iColumnNum ); + m_GrayArrowRow.Step( col ); - CheckForCompleteStep( fSongBeat, player_step, fMaxBeatDiff ); + CheckForCompleteRow( fSongBeat, col, fMaxBeatDiff ); // // check if we stepped on the TapNote part of a HoldNote @@ -290,7 +283,7 @@ void Player::HandlePlayerStep( float fSongBeat, TapNote player_step, float fMaxB if( hns.m_TapNoteScore != TNS_NONE ) // the TapNote already has a score continue; // no need to continue; - if( player_step == m_HoldNotes[i].m_TapNote ) // the player's step is the same as this HoldNote + if( col == m_HoldNotes[i].m_iTrack ) // the player's step is the same as this HoldNote { float fBeatDifference = fabsf( NoteIndexToBeat(hn.m_iStartIndex) - fSongBeat ); @@ -315,8 +308,7 @@ void Player::HandlePlayerStep( float fSongBeat, TapNote player_step, float fMaxB m_LifeMeter.ChangeLife( score ); // show the gray arrow ghost - int iColNum = m_Style.TapNoteToColumnNumber( player_step ); - m_GhostArrows.TapNote( iColNum, score, m_Combo.GetCurrentCombo() > 100 ); + m_GhostArrowRow.TapNote( col, score, m_Combo.GetCurrentCombo() > 100 ); // update the combo display switch( score ) @@ -339,9 +331,9 @@ void Player::HandlePlayerStep( float fSongBeat, TapNote player_step, float fMaxB } -void Player::CheckForCompleteStep( float fSongBeat, TapNote player_step, float fMaxBeatDiff ) +void Player::CheckForCompleteRow( float fSongBeat, NoteColumn col, float fMaxBeatDiff ) { - //HELPER.Log( "Player::CheckForCompleteStep()" ); + //HELPER.Log( "Player::CheckForCompleteRow()" ); // look for the closest matching step int iIndexStartLookingAt = BeatToNoteIndex( fSongBeat ); @@ -362,32 +354,44 @@ void Player::CheckForCompleteStep( float fSongBeat, TapNote player_step, float f //////////////////////////// // check the step to the left of iIndexStartLookingAt //////////////////////////// - //HELPER.Log( "Checking Pattern[%d]", iCurrentIndexEarlier ); - if( m_TapNotesRemaining[iCurrentIndexEarlier] & player_step ) // these Pattern overlap + //HELPER.Log( "Checking NoteMetadata[%d]", iCurrentIndexEarlier ); + if( m_TapNotes[col][iCurrentIndexEarlier] != '0' ) // these NoteMetadata overlap { - m_TapNotesRemaining[iCurrentIndexEarlier] &= ~player_step; // subtract player_step - if( m_TapNotesRemaining[iCurrentIndexEarlier] == 0 ) { // did this complete the step? - OnCompleteStep( fSongBeat, player_step, fMaxBeatDiff, iCurrentIndexEarlier ); - return; + m_TapNotes[col][iCurrentIndexEarlier] = '0'; // mark hit + + bool bRowDestroyed = true; + for( int t=0; t100 ); // show the ghost arrow for this column + if( m_TapNotesOriginal[c][iIndexThatWasSteppedOn] != '0' ) // if there is an original note note in this column + m_GhostArrowRow.TapNote( c, score, m_Combo.GetCurrentCombo()>100 ); // show the ghost arrow for this column } // update the combo display @@ -481,22 +485,25 @@ ScoreSummary Player::GetScoreSummary() } -int Player::UpdateStepsMissedOlderThan( float fMissIfOlderThanThisBeat ) +int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ) { - //HELPER.Log( "Pattern::UpdateStepsMissedOlderThan(%f)", fMissIfOlderThanThisBeat ); + //HELPER.Log( "NoteMetadata::UpdateTapNotesMissedOlderThan(%f)", fMissIfOlderThanThisBeat ); int iMissIfOlderThanThisIndex = BeatToNoteIndex( fMissIfOlderThanThisBeat ); int iNumMissesFound = 0; - // Since this is being called frame, let's not check the whole array every time. + // Since this is being called every frame, let's not check the whole array every time. // Instead, only check 10 elements back. Even 10 is overkill. int iStartCheckingAt = max( 0, iMissIfOlderThanThisIndex-10 ); //HELPER.Log( "iStartCheckingAt: %d iMissIfOlderThanThisIndex: %d", iStartCheckingAt, iMissIfOlderThanThisIndex ); for( int i=iStartCheckingAt; iIsRowEmpty( i ) ) { m_TapNoteScores[i] = TNS_MISS; iNumMissesFound++; diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index faa288d876..065d033fe7 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -5,7 +5,7 @@ Desc: Object that accepts pad input, knocks down ColorArrows that were stepped on, and keeps score for the player. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -13,7 +13,7 @@ #define _PLAYER_H_ #include "PrefsManager.h" // for ScoreSummary -#include "Pattern.h" +#include "NoteMetadata.h" #include "Sprite.h" #include "BitmapText.h" @@ -29,14 +29,14 @@ #include "Judgement.h" #include "HoldJudgement.h" #include "Combo.h" -#include "ColorArrowField.h" -#include "GrayArrows.h" -#include "GhostArrows.h" +#include "NoteField.h" +#include "GrayArrowRow.h" +#include "GhostArrowRow.h" -class Player : public ActorFrame +class Player : public NoteData, public ActorFrame { public: Player(); @@ -44,10 +44,10 @@ public: void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference ); void RenderPrimitives(); - void Load( const StyleDef& StyleDef, PlayerNumber player_no, const Pattern& pattern, const PlayerOptions& po ); + void Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOptions& po ); void CrossedIndex( int iIndex ); - void HandlePlayerStep( float fSongBeat, TapNote step, float fMaxBeatDiff ); - int UpdateStepsMissedOlderThan( float fMissIfOlderThanThisBeat ); + void HandlePlayerStep( float fSongBeat, NoteColumn col, float fMaxBeatDiff ); + int UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ); ScoreSummary GetScoreSummary(); @@ -55,28 +55,25 @@ public: bool IsThereANoteAtIndex( int iIndex ); protected: - void CheckForCompleteStep( float fSongBeat, TapNote step, float fMaxBeatDiff ); - void OnCompleteStep( float fSongBeat, TapNote step, float fMaxBeatDiff, int iStepIndex ); + void CheckForCompleteRow( float fSongBeat, NoteColumn col, float fMaxBeatDiff ); + void OnRowDestroyed( float fSongBeat, NoteColumn col, float fMaxBeatDiff, int iStepIndex ); float m_fSongBeat; - StyleDef m_Style; PlayerNumber m_PlayerNumber; PlayerOptions m_PlayerOptions; - TapNote m_TapNotesOriginal[MAX_TAP_NOTE_ELEMENTS]; // the original Pattern that were loaded into player - TapNote m_TapNotesRemaining[MAX_TAP_NOTE_ELEMENTS]; // mask off the bits as the player Pattern + // maintain this extra data in addition to the NoteData + TapNote m_TapNotesOriginal[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ELEMENTS]; // the original NoteMetadata that were loaded into player TapNoteScore m_TapNoteScores[MAX_TAP_NOTE_ELEMENTS]; - HoldNote m_HoldNotes[MAX_HOLD_NOTE_ELEMENTS]; HoldNoteScore m_HoldNoteScores[MAX_HOLD_NOTE_ELEMENTS]; - int m_iNumHoldNotes; - GrayArrows m_GrayArrows; - ColorArrowField m_ColorArrowField; - GhostArrows m_GhostArrows; + GrayArrowRow m_GrayArrowRow; + NoteField m_NoteField; + GhostArrowRow m_GhostArrowRow; Judgement m_Judgement; - HoldJudgement m_HoldJudgement[MAX_NUM_COLUMNS]; + HoldJudgement m_HoldJudgement[MAX_NOTE_TRACKS]; Combo m_Combo; LifeMeterPills m_LifeMeter; ScoreDisplayRollingWithFrame m_Score; diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index bbc98587b8..adc2f8ae07 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -5,7 +5,7 @@ Desc: See Header. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -25,8 +25,10 @@ PrefsManager::PrefsManager() m_SongSortOrder = SORT_GROUP; m_iCurrentStage = 1; + for( int p=0; pGetStartPosition(); pos != NULL; ) - { - pKey->GetNextAssoc( pos, name_string, value_string ); - - PadInput pi; - pi.fromString(name_string); - - CStringArray sDeviceInputStrings; - split( value_string, ",", sDeviceInputStrings, false ); - - for( int i=0; iSetHardCodedButtons(); - + pKey = ini.GetKeyPointer( "GameOptions" ); if( pKey ) @@ -97,6 +75,15 @@ void PrefsManager::ReadPrefsFromDisk() pKey->GetNextAssoc( pos, name_string, value_string ); if( name_string == "Windowed" ) m_GraphicOptions.m_bWindowed = ( value_string == "1" ); + if( name_string == "Profile" ) + { + if( value_string == "super low" ) m_GraphicOptions.m_Profile = PROFILE_SUPER_LOW; + else if( value_string == "low" ) m_GraphicOptions.m_Profile = PROFILE_LOW; + else if( value_string == "medium" ) m_GraphicOptions.m_Profile = PROFILE_MEDIUM; + else if( value_string == "high" ) m_GraphicOptions.m_Profile = PROFILE_HIGH; + else if( value_string == "custom" ) m_GraphicOptions.m_Profile = PROFILE_CUSTOM; + else m_GraphicOptions.m_Profile = PROFILE_MEDIUM; + } if( name_string == "Resolution" ) m_GraphicOptions.m_iResolution = atoi( value_string ); if( name_string == "MaxTextureSize" ) m_GraphicOptions.m_iMaxTextureSize = atoi( value_string ); if( name_string == "DisplayColor" ) m_GraphicOptions.m_iDisplayColor = atoi( value_string ); @@ -117,24 +104,17 @@ void PrefsManager::SavePrefsToDisk() // ini.ReadFile(); // don't read the file so that we overwrite everything there - // iterate over our input map and write all mappings to the ini file - for( int i=0; im_DanceStyle ) - { - case STYLE_SINGLE: - case STYLE_SOLO: - if( PadI.pad_no == PAD_1 ) - PlayerI.player_no = PLAYER_1; - else - PlayerI.player_no = PLAYER_NONE; - - if ( PadI.button == BUTTON_LEFT ) PlayerI.note |= NOTE_PAD1_LEFT; - if ( PadI.button == BUTTON_UPLEFT ) PlayerI.note |= NOTE_PAD1_UPLEFT; - if ( PadI.button == BUTTON_DOWN ) PlayerI.note |= NOTE_PAD1_DOWN; - if ( PadI.button == BUTTON_UP ) PlayerI.note |= NOTE_PAD1_UP; - if ( PadI.button == BUTTON_UPRIGHT ) PlayerI.note |= NOTE_PAD1_UPRIGHT; - if ( PadI.button == BUTTON_RIGHT ) PlayerI.note |= NOTE_PAD1_RIGHT; - - break; - case STYLE_VERSUS: - case STYLE_COUPLE: - if( PadI.pad_no == PAD_1 ) - PlayerI.player_no = PLAYER_1; - else if( PadI.pad_no == PAD_2 ) - PlayerI.player_no = PLAYER_2; - else - PlayerI.player_no = PLAYER_NONE; - - if ( PadI.button == BUTTON_LEFT ) PlayerI.note |= NOTE_PAD1_LEFT; - if ( PadI.button == BUTTON_UPLEFT ) PlayerI.note |= NOTE_PAD1_UPLEFT; - if ( PadI.button == BUTTON_DOWN ) PlayerI.note |= NOTE_PAD1_DOWN; - if ( PadI.button == BUTTON_UP ) PlayerI.note |= NOTE_PAD1_UP; - if ( PadI.button == BUTTON_UPRIGHT ) PlayerI.note |= NOTE_PAD1_UPRIGHT; - if ( PadI.button == BUTTON_RIGHT ) PlayerI.note |= NOTE_PAD1_RIGHT; - - break; - case STYLE_DOUBLE: - - switch( PadI.pad_no ) - { - case PAD_1: - PlayerI.player_no = PLAYER_1; - if ( PadI.button == BUTTON_LEFT ) PlayerI.note |= NOTE_PAD1_LEFT; - if ( PadI.button == BUTTON_DOWN ) PlayerI.note |= NOTE_PAD1_DOWN; - if ( PadI.button == BUTTON_UP ) PlayerI.note |= NOTE_PAD1_UP; - if ( PadI.button == BUTTON_RIGHT ) PlayerI.note |= NOTE_PAD1_RIGHT; - break; - case PAD_2: - PlayerI.player_no = PLAYER_1; - if ( PadI.button == BUTTON_LEFT ) PlayerI.note |= NOTE_PAD2_LEFT; - if ( PadI.button == BUTTON_DOWN ) PlayerI.note |= NOTE_PAD2_DOWN; - if ( PadI.button == BUTTON_UP ) PlayerI.note |= NOTE_PAD2_UP; - if ( PadI.button == BUTTON_RIGHT ) PlayerI.note |= NOTE_PAD2_RIGHT; - break; - case PAD_NONE: - PlayerI.player_no = PLAYER_NONE; - break; - } - - break; - default: - ASSERT( false ); // invalid DanceStyle - } -} - -void PrefsManager::PlayerToPad( PlayerInput PlayerI, PadInput &PadI ) -{ - PadI.pad_no = PAD_NONE; - PadI.button = BUTTON_NONE; - - switch( GAME->m_DanceStyle ) - { - case STYLE_SINGLE: - case STYLE_SOLO: - case STYLE_VERSUS: - case STYLE_COUPLE: - PadI.pad_no = (PadNumber)PlayerI.player_no; - - if ( PlayerI.note == NOTE_PAD1_LEFT ) PadI.button = BUTTON_LEFT; - if ( PlayerI.note == NOTE_PAD1_UPLEFT ) PadI.button = BUTTON_UPLEFT; - if ( PlayerI.note == NOTE_PAD1_DOWN ) PadI.button = BUTTON_DOWN; - if ( PlayerI.note == NOTE_PAD1_UP ) PadI.button = BUTTON_UP; - if ( PlayerI.note == NOTE_PAD1_UPRIGHT ) PadI.button = BUTTON_UPRIGHT; - if ( PlayerI.note == NOTE_PAD1_RIGHT ) PadI.button = BUTTON_RIGHT; - - break; - case STYLE_DOUBLE: - switch( PlayerI.note ) - { - case NOTE_PAD1_LEFT: PadI.pad_no = PAD_1; PadI.button = BUTTON_LEFT; break; - case NOTE_PAD1_DOWN: PadI.pad_no = PAD_1; PadI.button = BUTTON_DOWN; break; - case NOTE_PAD1_UP: PadI.pad_no = PAD_1; PadI.button = BUTTON_UP; break; - case NOTE_PAD1_RIGHT: PadI.pad_no = PAD_1; PadI.button = BUTTON_RIGHT; break; - case NOTE_PAD2_LEFT: PadI.pad_no = PAD_2; PadI.button = BUTTON_LEFT; break; - case NOTE_PAD2_DOWN: PadI.pad_no = PAD_2; PadI.button = BUTTON_DOWN; break; - case NOTE_PAD2_UP: PadI.pad_no = PAD_2; PadI.button = BUTTON_UP; break; - case NOTE_PAD2_RIGHT: PadI.pad_no = PAD_2; PadI.button = BUTTON_RIGHT; break; - } - - break; - default: - ASSERT( false ); // invalid DanceStyle - } -} - -bool PrefsManager::IsButtonDown( PadInput pi ) -{ - for( int i=0; iIsBeingPressed( di ) ) - return true; - } - } - - return false; -} - -bool PrefsManager::IsButtonDown( PlayerInput PlayerI ) -{ - PadInput PadI; - PlayerToPad( PlayerI, PadI ); - return IsButtonDown( PadI ); -} - - CString PrefsManager::GetStageText() { if( m_iCurrentStage == 3 ) @@ -443,5 +160,3 @@ CString PrefsManager::GetStageText() return ssprintf( "%d%s", PREFS->m_iCurrentStage, sNumberSuffix ); } - - diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index afa61e57fb..17fa8d05ca 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -1,25 +1,19 @@ +#pragma once /* ----------------------------------------------------------------------------- Class: PrefsManager - Desc: Manages all other game data that isn't handled about SongManager, - GameManager, or ThemeManager. Some of this data is saved between sessions, - for example, input mapping settings and GameOptions. This class also has - temporary holders for information that passed between windows - e.g. + Desc: Holds user-chosen preferences and saves it between sessions. This class + also has temporary holders for information that passed between windows - e.g. ScoreSummary. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ -#ifndef _PrefsManager_H_ -#define _PrefsManager_H_ - #include "RageInput.h" -#include "PadInput.h" -#include "PlayerInput.h" #include "GameTypes.h" @@ -38,8 +32,9 @@ public: ScoreSummary m_ScoreSummary[NUM_PLAYERS]; // for passing from Dancing to Results SongSortOrder m_SongSortOrder; // used by MusicWheel and should be saved until the app exits int m_iCurrentStage; // number of stages played +1 - CString GetStageText(); + CString GetStageText(); + DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS]; GameOptions m_GameOptions; GraphicOptions m_GraphicOptions; PlayerOptions m_PlayerOptions[NUM_PLAYERS]; @@ -49,39 +44,8 @@ public: void ReadPrefsFromDisk(); void SavePrefsToDisk(); - void AfterPrefsChanged(); // this function puts all the changes into effect - - - // input mapping stuff - void SetInputMap( DeviceInput di, PadInput pi, int iSlotIndex, bool bOverrideHardCoded = false ); - void ClearFromInputMap( DeviceInput di ); - void ClearFromInputMap( PadInput pi, int iSlotIndex ); - - void SetHardCodedButtons(); - bool IsAHardCodedDeviceInput( DeviceInput di ); - - bool DeviceToPad( DeviceInput di, PadInput& pi ); // return true if there is a mapping from device to pad - bool PadToDevice( PadInput pi, int iSoltNum, DeviceInput& di ); // return true if there is a mapping from pad to device - - void PadToPlayer( PadInput PadI, PlayerInput &PlayerI ); - void PlayerToPad( PlayerInput PlayerI, PadInput &PadI ); - - bool IsButtonDown( PadInput pi ); - bool IsButtonDown( PlayerInput PlayerI ); - - protected: - - DeviceInput m_PItoDI[NUM_PADS][NUM_PAD_BUTTONS][NUM_PAD_TO_DEVICE_SLOTS]; // all the DeviceInputs that map to a PadInput - - // lookup for efficiency from a DeviceInput to a PadInput - // This is repopulated every time m_PItoDI changes by calling UpdateTempDItoPI(). - PadInput m_tempDItoPI[NUM_INPUT_DEVICES][NUM_DEVICE_BUTTONS]; - void UpdateTempDItoPI(); }; extern PrefsManager* PREFS; // global and accessable from anywhere in our program - - -#endif \ No newline at end of file diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index 2f0b908025..e5731d0f4a 100644 --- a/stepmania/src/RageBitmapTexture.cpp +++ b/stepmania/src/RageBitmapTexture.cpp @@ -5,7 +5,7 @@ Desc: Holder for a static texture with metadata. Can load just about any image format. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -24,6 +24,7 @@ #include "DXUtil.h" #include "RageUtil.h" #include "RageHelper.h" +#include "ErrorCatcher/ErrorCatcher.h" //----------------------------------------------------------------------------- @@ -109,7 +110,7 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR m_sFilePath, &ddii ) ) ) { - HELPER.FatalErrorHr( hr, "D3DXGetImageInfoFromFile() failed for file '%s'.", m_sFilePath ); + FatalErrorHr( hr, "D3DXGetImageInfoFromFile() failed for file '%s'.", m_sFilePath ); } D3DCAPS8 caps; @@ -144,7 +145,7 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR NULL, // no palette &m_pd3dTexture ) ) ) { - HELPER.FatalErrorHr( hr, "D3DXCreateTextureFromFileEx() failed for file '%s'.", m_sFilePath ); + FatalErrorHr( hr, "D3DXCreateTextureFromFileEx() failed for file '%s'.", m_sFilePath ); } ///////////////////// @@ -155,7 +156,7 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR D3DSURFACE_DESC ddsd; if ( FAILED( hr = m_pd3dTexture->GetLevelDesc( 0, &ddsd ) ) ) - HELPER.FatalErrorHr( hr, "Could not get level Description of D3DX texture!" ); + FatalErrorHr( hr, "Could not get level Description of D3DX texture!" ); // save information about the texture m_iTextureWidth = ddsd.Width; diff --git a/stepmania/src/RageBitmapTexture.h b/stepmania/src/RageBitmapTexture.h index 5280042709..891f7fe8b4 100644 --- a/stepmania/src/RageBitmapTexture.h +++ b/stepmania/src/RageBitmapTexture.h @@ -4,7 +4,7 @@ Desc: Holder for a static texture with metadata. Can load just about any image format. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/RageInput.cpp b/stepmania/src/RageInput.cpp index 61406b82f5..787e8b4172 100644 --- a/stepmania/src/RageInput.cpp +++ b/stepmania/src/RageInput.cpp @@ -5,7 +5,7 @@ Desc: Wrapper for DirectInput. Generates InputEvents. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -25,6 +25,7 @@ #include #include "RageUtil.h" #include "RageHelper.h" +#include "ErrorCatcher/ErrorCatcher.h" RageInput* INPUTM = NULL; // globally accessable input device @@ -41,11 +42,11 @@ CString DeviceInput::GetDescription() ASSERT( false ); // called GetDescription on a blank DeviceInput! break; - case DEVICE_JOYSTICK1: // joystick - case DEVICE_JOYSTICK2: - case DEVICE_JOYSTICK3: - case DEVICE_JOYSTICK4: - sReturn = ssprintf("Joystick %d: ", device - DEVICE_JOYSTICK1 + 1 ); + case DEVICE_JOY1: // joystick + case DEVICE_JOY2: + case DEVICE_JOY3: + case DEVICE_JOY4: + sReturn = ssprintf("Joystick %d: ", device - DEVICE_JOY1 + 1 ); switch( button ) { @@ -223,7 +224,7 @@ bool DeviceInput::fromString( const CString &s ) //----------------------------------------------------------------------------- -// Name: EnumJoysticksCallback() +// Name: EnumJoysticksCallMenuBack( PlayerNumber p ) // Desc: Called once for each enumerated joystick. If we find one, create a // device interface on it so we can play with it. //----------------------------------------------------------------------------- @@ -245,7 +246,7 @@ BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance, HRESULT hr = pDI->CreateDevice( pdidInstance->guidInstance, &pInput->m_pJoystick[i++], NULL ); - HELPER.FatalErrorHr( hr, "Error in CreateDevice() for joystick %d.", i ); + FatalErrorHr( hr, "Error in CreateDevice() for joystick %d.", i ); return DIENUM_CONTINUE; } @@ -254,7 +255,7 @@ BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance, //----------------------------------------------------------------------------- -// Name: EnumAxesCallback() +// Name: EnumAxesCallMenuBack( PlayerNumber p ) // Desc: Callback function for enumerating the axes on a joystick //----------------------------------------------------------------------------- BOOL CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, @@ -283,25 +284,26 @@ BOOL CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, RageInput::RageInput( HWND hWnd ) { + int i; + m_hWnd = hWnd; m_pDI = NULL; m_pKeyboard = NULL; m_pMouse = NULL; - for( int i=0; iCreateDevice( GUID_SysKeyboard, &m_pKeyboard, NULL ) ) ) - HELPER.FatalErrorHr( hr, "CreateDevice keyboard failed." ); + FatalErrorHr( hr, "CreateDevice keyboard failed." ); // Set our Cooperation Level with each Device if( FAILED( hr = m_pKeyboard->SetCooperativeLevel(m_hWnd, DISCL_FOREGROUND | DISCL_NOWINKEY | DISCL_NONEXCLUSIVE) ) ) - HELPER.FatalErrorHr( hr, "m_pKeyboard->SetCooperativeLevel failed." ); + FatalErrorHr( hr, "m_pKeyboard->SetCooperativeLevel failed." ); // Set the Data Format of each device if( FAILED( hr = m_pKeyboard->SetDataFormat(&c_dfDIKeyboard) ) ) - HELPER.FatalErrorHr( hr, "m_pKeyboard->SetDataFormat failed." ); + FatalErrorHr( hr, "m_pKeyboard->SetDataFormat failed." ); // Acquire the Keyboard Device //if( FAILED( hr = m_pKeyboard->Acquire() ) ) - // HELPER.FatalErrorHr( "m_pKeyboard->Acquire failed.", hr ); + // FatalErrorHr( "m_pKeyboard->Acquire failed.", hr ); @@ -351,13 +353,13 @@ HRESULT RageInput::Initialize() // Obtain an interface to the system mouse device. if( FAILED( hr = m_pDI->CreateDevice( GUID_SysMouse, &m_pMouse, NULL ) ) ) - HELPER.FatalErrorHr( hr, "CreateDevice mouse failed." ); + FatalErrorHr( hr, "CreateDevice mouse failed." ); if( FAILED( hr = m_pMouse->SetCooperativeLevel( m_hWnd, DISCL_NONEXCLUSIVE|DISCL_FOREGROUND ) ) ) - HELPER.FatalErrorHr( hr, "m_pMouse->SetCooperativeLevel failed." ); + FatalErrorHr( hr, "m_pMouse->SetCooperativeLevel failed." ); if( FAILED( hr = m_pMouse->SetDataFormat( &c_dfDIMouse2 ) ) ) - HELPER.FatalErrorHr( hr, "m_pMouse->SetDataFormat failed." ); + FatalErrorHr( hr, "m_pMouse->SetDataFormat failed." ); /* DIPROPDWORD dipdw; @@ -370,7 +372,7 @@ HRESULT RageInput::Initialize() if( FAILED( m_pMouse->SetProperty( DIPROP_AXISMODE, &dipdw.diph ) ) ) return E_FAIL;*/ //if( FAILED( hr = m_pMouse->Acquire())) - // HELPER.FatalErrorHr( "m_pMouse->Acquire failed.", hr ); + // FatalErrorHr( "m_pMouse->Acquire failed.", hr ); m_RelPosition_x = 0; m_RelPosition_y = 0; @@ -387,7 +389,7 @@ HRESULT RageInput::Initialize() EnumJoysticksCallback, (VOID*)this, DIEDFL_ATTACHEDONLY ) ) ) - HELPER.FatalErrorHr( hr, "m_pDI->EnumDevices failed." ); + FatalErrorHr( hr, "m_pDI->EnumDevices failed." ); for( int i=0; iSetDataFormat( &c_dfDIJoystick2 ) ) ) - HELPER.FatalErrorHr( hr, "m_pJoystick[i]->SetDataFormat failed." ); + FatalErrorHr( hr, "m_pJoystick[i]->SetDataFormat failed." ); // Set the cooperative level to let DInput know how this device should // interact with the system and with other DInput applications. if( m_pJoystick[i] ) if( FAILED( hr = m_pJoystick[i]->SetCooperativeLevel( m_hWnd, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND ) ) ) - HELPER.FatalErrorHr( hr, "m_pJoystick[i]->SetCooperativeLevel failed." ); + FatalErrorHr( hr, "m_pJoystick[i]->SetCooperativeLevel failed." ); /* @@ -423,12 +425,12 @@ HRESULT RageInput::Initialize() // of enumerating device objects (axes, buttons, etc.). if( m_pJoystick[i] ) if ( FAILED( hr = m_pJoystick[i]->EnumObjects( EnumAxesCallback, (VOID*)m_pJoystick[i], DIDFT_AXIS ) ) ) - HELPER.FatalErrorHr( hr, "m_pJoystick[i]->EnumObjects failed." ); + FatalErrorHr( hr, "m_pJoystick[i]->EnumObjects failed." ); // Acquire the newly created devices if( m_pJoystick[i] ) if( FAILED( hr = m_pJoystick[i]->Acquire() ) ) - HELPER.FatalErrorHr( hr, "m_pJoystick[i]->Acquire failed." ); + FatalErrorHr( hr, "m_pJoystick[i]->Acquire failed." ); } return S_OK; @@ -461,7 +463,7 @@ void RageInput::Release() -HRESULT RageInput::GetDeviceInputs( DeviceInputArray &listDeviceInputs ) +HRESULT RageInput::Update() { // macros for reading DI state structures #define IS_PRESSED(b) (b & 0x80) @@ -506,14 +508,6 @@ HRESULT RageInput::GetDeviceInputs( DeviceInputArray &listDeviceInputs ) return E_FAIL; } - // get keyboard state was successful. Compare this state to the last state - for( int k = 0; k < 256; k++ ) // foreach key - { - // check if key is depressed this update and was not depressed last update - if( IS_PRESSED( m_keys[k] ) && !IS_PRESSED( m_oldKeys[k] ) ) - listDeviceInputs.Add( DeviceInput(DEVICE_KEYBOARD, k) ); - } - //////////////////// // Read the mouse @@ -587,33 +581,6 @@ HRESULT RageInput::GetDeviceInputs( DeviceInputArray &listDeviceInputs ) // Get the input's device state if( FAILED( hr = m_pJoystick[i]->GetDeviceState( sizeof(DIJOYSTATE2), &m_joyState[i] ) ) ) return hr; // The device should have been acquired during the Poll() - else - { - - // check if key is depressed this update and was not depressed last update - if( IS_LEFT( m_joyState[i].lX ) && - !IS_LEFT( m_oldJoyState[i].lX ) ) - listDeviceInputs.Add( DeviceInput(InputDevice(DEVICE_JOYSTICK1+i), JOY_LEFT) ); - - if( IS_RIGHT( m_joyState[i].lX ) && - !IS_RIGHT( m_oldJoyState[i].lX ) ) - listDeviceInputs.Add( DeviceInput(InputDevice(DEVICE_JOYSTICK1+i), JOY_RIGHT) ); - - if( IS_UP( m_joyState[i].lY ) && - !IS_UP( m_oldJoyState[i].lY ) ) - listDeviceInputs.Add( DeviceInput(InputDevice(DEVICE_JOYSTICK1+i), JOY_UP) ); - - if( IS_DOWN( m_joyState[i].lY ) && - !IS_DOWN( m_oldJoyState[i].lY ) ) - listDeviceInputs.Add( DeviceInput(InputDevice(DEVICE_JOYSTICK1+i), JOY_DOWN) ); - - - for( BYTE b=0; b DeviceInputArray; - - class RageInput { // Our Windows Handle @@ -116,15 +115,15 @@ public: private: // Arrays for Keyboard Data - byte m_keys[256]; - byte m_oldKeys[256]; + byte m_keys[NUM_KEYBOARD_BUTTONS]; + byte m_oldKeys[NUM_KEYBOARD_BUTTONS]; // DirectInput mouse state structure DIMOUSESTATE2 m_mouseState; - // Joystick data for 4 controllers - DIJOYSTATE2 m_joyState[4]; - DIJOYSTATE2 m_oldJoyState[4]; + // Joystick data for NUM_JOYSTICKS controllers + DIJOYSTATE2 m_joyState[NUM_JOYSTICKS]; + DIJOYSTATE2 m_oldJoyState[NUM_JOYSTICKS]; INT m_AbsPosition_x; INT m_AbsPosition_y; @@ -141,8 +140,9 @@ public: // Release all DirectInput Resources VOID Release(); // Get our Devices State - HRESULT GetDeviceInputs( DeviceInputArray &listDeviceInputs ); - BOOL IsBeingPressed( DeviceInput di ); + HRESULT Update(); + bool IsBeingPressed( DeviceInput di ); + bool WasBeingPressed( DeviceInput di ); LPDIRECTINPUT8 GetDirectInput() { return m_pDI; } LPDIRECTINPUTDEVICE8 GetMouseDevice() { return m_pMouse; } diff --git a/stepmania/src/RageMovieTexture.cpp b/stepmania/src/RageMovieTexture.cpp index 33dd0886b4..6c9d94d665 100644 --- a/stepmania/src/RageMovieTexture.cpp +++ b/stepmania/src/RageMovieTexture.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -32,6 +32,7 @@ #include "DXUtil.h" #include "RageUtil.h" #include "RageHelper.h" +#include "ErrorCatcher/ErrorCatcher.h" #include @@ -297,26 +298,26 @@ VOID RageMovieTexture::Create() // Initialize the filter graph find and get information about the // video (dimensions, color depth, etc.) if( FAILED( hr = InitDShowTextureRenderer() ) ) - HELPER.FatalErrorHr( hr, "Could not initialize the DirectShow Texture Renderer!" ); + FatalErrorHr( hr, "Could not initialize the DirectShow Texture Renderer!" ); if( FAILED( hr = CreateD3DTexture() ) ) - HELPER.FatalErrorHr( hr, "Could not create the D3D Texture!" ); + FatalErrorHr( hr, "Could not create the D3D Texture!" ); // Pass the D3D texture to our TextureRenderer so it knows // where to render new movie frames to. if( FAILED( hr = m_pCTR->SetRenderTarget( this ) ) ) - HELPER.FatalErrorHr( hr, "RageMovieTexture: SetRenderTarget failed." ); + FatalErrorHr( hr, "RageMovieTexture: SetRenderTarget failed." ); // Start the graph running if( FAILED( hr = PlayMovie() ) ) - HELPER.FatalErrorHr( hr, "Could not run the DirectShow graph." ); + FatalErrorHr( hr, "Could not run the DirectShow graph." ); } void HandleDivXError() { - HELPER.FatalError( + FatalError( "Could not locate the DivX video codec.\n" "DivX is required to movie textures and must\n" "be installed before running the application.\n\n" @@ -338,17 +339,17 @@ HRESULT RageMovieTexture::InitDShowTextureRenderer() // Create the filter graph if( FAILED( m_pGB.CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC) ) ) - HELPER.FatalErrorHr( hr, "Could not create CLSID_FilterGraph!" ); + FatalErrorHr( hr, "Could not create CLSID_FilterGraph!" ); // Create the Texture Renderer object m_pCTR = new CTextureRenderer(NULL, &hr); if( FAILED(hr) ) - HELPER.FatalErrorHr( hr, "Could not create texture renderer object!" ); + FatalErrorHr( hr, "Could not create texture renderer object!" ); // Get a pointer to the IBaseFilter on the TextureRenderer, add it to graph pFTR = m_pCTR; if( FAILED( hr = m_pGB->AddFilter(pFTR, L"TEXTURERENDERER" ) ) ) - HELPER.FatalErrorHr( hr, "Could not add renderer filter to graph!" ); + FatalErrorHr( hr, "Could not add renderer filter to graph!" ); // convert movie file path to wide char string WCHAR wFileName[MAX_PATH]; @@ -364,21 +365,21 @@ HRESULT RageMovieTexture::InitDShowTextureRenderer() if( FAILED( hr = m_pGB->AddSourceFilter( wFileName, L"SOURCE", &pFSrc ) ) ) // if this fails, it's probably because the user doesn't have DivX installed { HandleDivXError(); - HELPER.FatalErrorHr( hr, "Could not create source filter to graph!" ); + FatalErrorHr( hr, "Could not create source filter to graph!" ); } // Find the source's output and the renderer's input if( FAILED( hr = pFTR->FindPin( L"In", &pFTRPinIn ) ) ) - HELPER.FatalErrorHr( hr, "Could not find input pin!" ); + FatalErrorHr( hr, "Could not find input pin!" ); if( FAILED( hr = pFSrc->FindPin( L"Output", &pFSrcPinOut ) ) ) - HELPER.FatalErrorHr( hr, "Could not find output pin!" ); + FatalErrorHr( hr, "Could not find output pin!" ); // Connect these two filters if( FAILED( hr = m_pGB->Connect( pFSrcPinOut, pFTRPinIn ) ) ) { HandleDivXError(); - HELPER.FatalErrorHr( hr, "Could not connect pins!" ); + FatalErrorHr( hr, "Could not connect pins!" ); } // Get the graph's media control, event & position interfaces @@ -408,25 +409,25 @@ HRESULT RageMovieTexture::CreateD3DTexture() m_iSourceHeight, m_iSourceHeight, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &m_pd3dTexture[0] ) ) ) - HELPER.FatalErrorHr( hr, "Could not create the D3DX texture!" ); + FatalErrorHr( hr, "Could not create the D3DX texture!" ); if( FAILED( hr = D3DXCreateTexture(m_pd3dDevice, m_iSourceHeight, m_iSourceHeight, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &m_pd3dTexture[1] ) ) ) - HELPER.FatalErrorHr( hr, "Could not create the D3DX texture!" ); + FatalErrorHr( hr, "Could not create the D3DX texture!" ); // D3DXCreateTexture can silently change the parameters on us D3DSURFACE_DESC ddsd; if ( FAILED( hr = m_pd3dTexture[0]->GetLevelDesc( 0, &ddsd ) ) ) - HELPER.FatalErrorHr( hr, "Could not get level Description of D3DX texture!" ); + FatalErrorHr( hr, "Could not get level Description of D3DX texture!" ); m_iTextureWidth = ddsd.Width; m_iTextureHeight = ddsd.Height; m_TextureFormat = ddsd.Format; if( m_TextureFormat != D3DFMT_A8R8G8B8 && m_TextureFormat != D3DFMT_A1R5G5B5 ) - HELPER.FatalError( "Texture is format we can't handle! Format = 0x%x!", m_TextureFormat ); + FatalError( "Texture is format we can't handle! Format = 0x%x!", m_TextureFormat ); return S_OK; @@ -438,7 +439,7 @@ HRESULT RageMovieTexture::PlayMovie() // Start the graph running; if( FAILED( hr = m_pMC->Run() ) ) - HELPER.FatalErrorHr( hr, "Could not run the DirectShow graph." ); + FatalErrorHr( hr, "Could not run the DirectShow graph." ); return S_OK; } diff --git a/stepmania/src/RageMovieTexture.h b/stepmania/src/RageMovieTexture.h index 72ad3752eb..090253281a 100644 --- a/stepmania/src/RageMovieTexture.h +++ b/stepmania/src/RageMovieTexture.h @@ -4,7 +4,7 @@ Desc: Based on the DShowTextures example in the DX8 SDK. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index 8b27b2b0c4..909adc7a0f 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -5,7 +5,7 @@ Desc: Sound effects library (currently a wrapper around Bass Sound Library). - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -13,6 +13,7 @@ #include "RageSound.h" #include "RageUtil.h" #include "RageHelper.h" +#include "ErrorCatcher/ErrorCatcher.h" #include "bass/bass.h" #pragma comment(lib, "bass/bass.lib") @@ -26,15 +27,15 @@ RageSound::RageSound( HWND hWnd ) HELPER.Log( "RageSound::RageSound()" ); // save the HWND if( !hWnd ) - HELPER.FatalError( "RageSound called with NULL hWnd." ); + FatalError( "RageSound called with NULL hWnd." ); m_hWndApp = hWnd; if( BASS_GetVersion() != MAKELONG(1,3) ) - HELPER.FatalError( "BASS version 1.3 DLL could not be loaded. Verify that Bass.dll exists in the program directory."); + FatalError( "BASS version 1.3 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 ) ) { - HELPER.FatalError( + FatalError( "There was an error while initializing your sound card.\n\n" "The most likely cause of this problem is that you do not have a sound card\n" "installed, or that you have not yet installed a driver for your sound card.\n" diff --git a/stepmania/src/RageSound.h b/stepmania/src/RageSound.h index bcf2c3ffc2..297ddc6676 100644 --- a/stepmania/src/RageSound.h +++ b/stepmania/src/RageSound.h @@ -4,7 +4,7 @@ Desc: Sound effects library (currently a wrapper around Bass Sound Library). - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/RageTexture.cpp b/stepmania/src/RageTexture.cpp index 0858d60159..e8a17d78f6 100644 --- a/stepmania/src/RageTexture.cpp +++ b/stepmania/src/RageTexture.cpp @@ -5,7 +5,7 @@ Desc: Abstract class for a texture with metadata. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/RageTexture.h b/stepmania/src/RageTexture.h index 313682a56b..be3fe863d8 100644 --- a/stepmania/src/RageTexture.h +++ b/stepmania/src/RageTexture.h @@ -4,7 +4,7 @@ Desc: Abstract class for a texture with metadata. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/RageTextureManager.cpp b/stepmania/src/RageTextureManager.cpp index 7d93d543ab..a270581d4f 100644 --- a/stepmania/src/RageTextureManager.cpp +++ b/stepmania/src/RageTextureManager.cpp @@ -5,7 +5,7 @@ Desc: Interface for loading and releasing textures. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -18,6 +18,7 @@ #include "RageMovieTexture.h" #include "RageUtil.h" #include "RageHelper.h" +#include "ErrorCatcher/ErrorCatcher.h" RageTextureManager* TEXTURE = NULL; @@ -139,7 +140,7 @@ void RageTextureManager::UnloadTexture( CString sTexturePath ) } else // texture not found { - HELPER.FatalError( ssprintf("Tried to Unload texture '%s' that wasn't loaded.", sTexturePath) ); + FatalError( ssprintf("Tried to Unload texture '%s' that wasn't loaded.", sTexturePath) ); } } diff --git a/stepmania/src/RageTextureManager.h b/stepmania/src/RageTextureManager.h index 5eb4dddec8..9c8391c86c 100644 --- a/stepmania/src/RageTextureManager.h +++ b/stepmania/src/RageTextureManager.h @@ -4,7 +4,7 @@ Desc: Interface for loading and releasing textures. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 752e05c5e8..874c058a0b 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index fe3fb10ee9..fdb736bf53 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -4,7 +4,7 @@ Desc: Miscellaneous helper functions. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -50,7 +50,10 @@ inline float randomf( const float low=-1.0f, const float high=1.0f ) } inline int roundf( const float f ) { return (int)((f)+0.5f); }; inline int roundf( const double f ) { return (int)((f)+0.5); }; - +inline float froundf( const float f, const float fRoundInterval ) +{ + return int( (f + fRoundInterval/2)/fRoundInterval ) * fRoundInterval; +} bool IsAnInt( LPCTSTR s ); @@ -79,7 +82,7 @@ void splitrelpath( CString& Ext ); -// Splits a CString into an CStringArray according the Deliminator. Supports UNC path names. +// Splits a CString into an CStringArray according the Deliminator. void split( const CString &Source, const CString &Deliminator, diff --git a/stepmania/src/RandomSample.cpp b/stepmania/src/RandomSample.cpp index 48cc468e4b..2b9995febc 100644 --- a/stepmania/src/RandomSample.cpp +++ b/stepmania/src/RandomSample.cpp @@ -5,7 +5,7 @@ Desc: Holds multiple sounds samples and can play a random sound easily. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -14,6 +14,7 @@ #include "RandomSample.h" #include "RageUtil.h" #include "RageHelper.h" +#include "ErrorCatcher/ErrorCatcher.h" RandomSample::RandomSample() @@ -48,7 +49,7 @@ bool RandomSample::LoadRandomSample( CString sSetFilePath ) { CStdioFile file; if( !file.Open(sSetFilePath, CFile::modeRead|CFile::shareDenyNone) ) - HELPER.FatalError( ssprintf("Error opening sound set file '%s'.", sSetFilePath) ); + FatalError( ssprintf("Error opening sound set file '%s'.", sSetFilePath) ); // Split for the directory of the sound set file. We'll need it below @@ -70,17 +71,12 @@ bool RandomSample::LoadSound( CString sSoundFilePath ) { HELPER.Log( "RandomSample::LoadSound( %s )", sSoundFilePath ); - HELPER.Log( "Made it here - A" ); - RageSoundSample* pSS = new RageSoundSample; - HELPER.Log( "Made it here - B" ); pSS->Load( sSoundFilePath ); m_pSamples.Add( pSS ); - HELPER.Log( "Made it here - C" ); - return true; } diff --git a/stepmania/src/RandomSample.h b/stepmania/src/RandomSample.h index 52d0b123cf..06cbc3a563 100644 --- a/stepmania/src/RandomSample.h +++ b/stepmania/src/RandomSample.h @@ -4,7 +4,7 @@ Desc: Holds multiple sounds samples and can play a random sound easily. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/ScoreDisplayRolling.cpp b/stepmania/src/ScoreDisplayRolling.cpp index 1512fc688d..8bda66fa43 100644 --- a/stepmania/src/ScoreDisplayRolling.cpp +++ b/stepmania/src/ScoreDisplayRolling.cpp @@ -5,7 +5,7 @@ Desc: A graphic displayed in the ScoreDisplayRolling during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -99,7 +99,7 @@ void ScoreDisplayRolling::AddToScore( TapNoteScore score, int iCurCombo ) // The scoring system for DDR versions 1 and 2 (including the Plus remixes) is as follows: // For every step: // - // Multiplier (M) = (# of Pattern in your current combo / 4) rounded down + // Multiplier (M) = (# of NoteMetadata in your current combo / 4) rounded down // "Good" step = M * 100 (and this ends your combo) // "Great" step = M * M * 100 // "Perfect" step = M * M * 300 @@ -139,11 +139,11 @@ void ScoreDisplayRolling::AddToScore( TapNoteScore score, int iCurCombo ) The base step value is the max score divided by 10, divided by one-half of the max combo squared plus the max combo. This value is multiplied by 10 for a perfect or 5 for a great, and further - multiplied by the number of Pattern currently in the combo. */ + multiplied by the number of NoteMetadata currently in the combo. */ /* int iScoreToAdd = 0; int iBonus = 0; - Pattern *pSteps = GAMEINFO->m_pStepsPlayer[m_PlayerNumber]; + NoteMetadata *pSteps = GAMEINFO->m_pStepsPlayer[m_PlayerNumber]; int iNumFeet = pSteps->m_iNumFeet; int iMaxCombo = pSteps->GetNumSteps(); diff --git a/stepmania/src/ScoreDisplayRolling.h b/stepmania/src/ScoreDisplayRolling.h index 1af2840a1e..97996b4c81 100644 --- a/stepmania/src/ScoreDisplayRolling.h +++ b/stepmania/src/ScoreDisplayRolling.h @@ -4,7 +4,7 @@ Desc: A graphic displayed in the ScoreDisplayRolling during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/ScreenDimensions.h b/stepmania/src/ScreenDimensions.h index 3cae135bce..ad11a4e2bc 100644 --- a/stepmania/src/ScreenDimensions.h +++ b/stepmania/src/ScreenDimensions.h @@ -4,7 +4,7 @@ Desc: - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index ae87c6e5a5..424dfa59fe 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -5,18 +5,18 @@ Desc: Holds metadata for a song and the song's step data. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ -#include "Pattern.h" +#include "NoteMetadata.h" #include "RageUtil.h" #include "Song.h" #include // for fmod #include "RageHelper.h" - +#include "ErrorCatcher/ErrorCatcher.h" @@ -72,12 +72,14 @@ Song::Song() { m_bChangedSinceSave = false; m_fOffsetInSeconds = 0; + m_fMusicSampleStartBeat = m_fMusicSampleEndBeat = -1; + m_dwMusicBytes = 0; } void Song::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut ) { - HELPER.Log( "GetBeatAndBPSFromElapsedTime( fElapsedTime = %f )", fElapsedTime ); +// HELPER.Log( "GetBeatAndBPSFromElapsedTime( fElapsedTime = %f )", fElapsedTime ); // This function is a nightmare. Don't even try to understand it. :-) fElapsedTime += m_fOffsetInSeconds; @@ -149,6 +151,30 @@ void Song::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, fl } +// This is a super hack, but it's only called from WindowEdit, so it's OK :-) +// Writing an inverse function of GetBeatAndBPSFromElapsedTime() is impossible, +// so do a binary search to get close to the correct elapsed time. +float Song::GetElapsedTimeFromBeat( float fBeat ) +{ + float fElapsedTimeBestGuess = 100; // seconds + float fSecondsToMove = fElapsedTimeBestGuess/2; // seconds + float fBeatOut, fBPSOut; + + while( fSecondsToMove > 0.1f ) + { + GetBeatAndBPSFromElapsedTime( fElapsedTimeBestGuess, fBeatOut, fBPSOut ); + if( fBeatOut > fBeat ) + fElapsedTimeBestGuess -= fSecondsToMove; + else + fElapsedTimeBestGuess += fSecondsToMove; + + fSecondsToMove /= 2; + } + + return fElapsedTimeBestGuess; +} + + bool Song::LoadFromSongDir( CString sDir ) { HELPER.Log( "Song::LoadFromSongDir(%s)", sDir ); @@ -171,32 +197,32 @@ bool Song::LoadFromSongDir( CString sDir ) GetDirListing( sDir + CString("*.dwi"), arrayDWIFileNames ); int iNumDWIFiles = arrayDWIFileNames.GetSize(); + CStringArray arraySongFileNames; + GetDirListing( sDir + CString("*.song"), arraySongFileNames ); + int iNumSongFiles = arraySongFileNames.GetSize(); - if( iNumDWIFiles > 1 ) - { - HELPER.FatalError( ssprintf("There is more than one DWI file in '%s'. Which one should I use?", sDir) ); - } + + if( iNumSongFiles > 1 ) + FatalError( "There is more than one DWI file in '%s'. Which one should I use?", sDir ); + else if( iNumDWIFiles > 1 ) + FatalError( "There is more than one DWI file in '%s'. Which one should I use?", sDir ); + else if( iNumSongFiles == 1 ) + LoadFromSMDir( sDir ); else if( iNumDWIFiles == 1 ) - { - LoadSongInfoFromDWIFile( sDir + arrayDWIFileNames[0] ); - } + LoadFromDWIFile( sDir + arrayDWIFileNames[0] ); else if( iNumBMSFiles > 0 ) - { - LoadSongInfoFromBMSDir( sDir ); - } + LoadFromBMSDir( sDir ); else - { - HELPER.FatalError( ssprintf("Couldn't find any BMS or MSD files in '%s'", sDir) ); - } + FatalError( "Couldn't find any Song, BMS, or MSD files in '%s'", sDir ); return TRUE; } -bool Song::LoadSongInfoFromBMSDir( CString sDir ) +bool Song::LoadFromBMSDir( CString sDir ) { - HELPER.Log( "Song::LoadSongInfoFromBMSDir(%s)", sDir ); + HELPER.Log( "Song::LoadFromBMSDir(%s)", sDir ); // make sure there is a trailing '\\' at the end of sDir if( sDir.Right(1) != "\\" ) @@ -215,7 +241,7 @@ bool Song::LoadSongInfoFromBMSDir( CString sDir ) GetDirListing( sDir + CString("*.bms"), arrayBMSFileNames ); if( arrayBMSFileNames.GetSize() == 0 ) - HELPER.FatalError( ssprintf("Couldn't find any BMS files in '%s'", sDir) ); + FatalError( ssprintf("Couldn't find any BMS files in '%s'", sDir) ); // Load the Song info from the first BMS file. Silly BMS duplicates the song info in every @@ -223,11 +249,11 @@ bool Song::LoadSongInfoFromBMSDir( CString sDir ) // is identical for every BMS file in the directory. m_sSongFilePath = m_sSongDir + arrayBMSFileNames[0]; - // load the Pattern from the rest of the BMS files + // load the NoteMetadata from the rest of the BMS files for( int i=0; i') + // strip NoteMetadata type out of description leaving only song title (looks like 'B4U ') m_sTitle.Replace( "(ANOTHER)", "" ); m_sTitle.Replace( "(BASIC)", "" ); m_sTitle.Replace( "(MANIAC)", "" ); @@ -367,7 +389,7 @@ bool Song::LoadSongInfoFromBMSDir( CString sDir ) } for( i=0; i 0 ) // we found a match m_sBackgroundMoviePath = arrayPossibleBackgroundMovies[0]; } + + if( !DoesFileExist(GetCDTitlePath()) ) + { + m_sCDTitlePath = ""; + } } -void Song::GetPatternsThatMatchStyle( DanceStyle s, CArray& arrayAddTo ) +void Song::GetNoteMetadatasThatMatchGameAndStyle( CString sGame, CString sStyle, CArray& arrayAddTo ) { - for( int i=0; im_DanceStyle // if the current GameModes matches the Pattern's GameMode - || (s == STYLE_VERSUS && pCurPattern->m_DanceStyle == STYLE_SINGLE) ) + if( sGame == pCurNoteMetadata->m_sGame && + ( sStyle == pCurNoteMetadata->m_sStyle || (sStyle == "versus" && pCurNoteMetadata->m_sStyle == "single") ) ) { - arrayAddTo.Add( pCurPattern ); + arrayAddTo.Add( pCurNoteMetadata ); } } } -void Song::GetNumFeet( DanceStyle s, int& iDiffEasyOut, int& iDiffMediumOut, int& iDiffHardOut ) -{ - iDiffEasyOut = iDiffMediumOut = iDiffHardOut = -1; // -1 means not found - CArray arrayMatchingSteps; - GetPatternsThatMatchStyle( s, arrayMatchingSteps ); - - for( int i=0; im_iNumFeet; - - switch( arrayMatchingSteps[i]->m_DifficultyClass ) - { - case Pattern::CLASS_EASY: - iDiffEasyOut = iNumFeet; - break; - case Pattern::CLASS_MEDIUM: - iDiffMediumOut = iNumFeet; - break; - case Pattern::CLASS_HARD: - iDiffHardOut = iNumFeet; - break; - case Pattern::CLASS_OTHER: - // should do something intelligent to fill in the missing spots... - if( iDiffEasyOut < 0 && iNumFeet <= 4 ) - iDiffEasyOut = iNumFeet; - else if( iDiffHardOut < 0 && iNumFeet >= 7 ) - iDiffHardOut = iNumFeet; - else if( iDiffMediumOut < 0 ) - iDiffMediumOut = iNumFeet; - break; - } - } -} - +/* void Song::SaveOffsetChangeToDisk() { CString sDir, sFName, sExt; @@ -702,14 +871,14 @@ void Song::SaveOffsetChangeToDisk() if( sExt == "bms" ) { - for( int i=0; i arrayNoteMetadatas; + this->GetNoteMetadatasThatMatchGameAndStyle( sGame, sStyle, arrayNoteMetadatas ); + SortNoteMetadataArrayByDifficultyClass( arrayNoteMetadatas ); + for( int i=0; im_DifficultyClass == dc ) + return pNoteMetadata->m_TopGrade; + } + return GRADE_NO_DATA; +} ///////////////////////////////////// // Sorting @@ -817,8 +1113,8 @@ int CompareSongPointersByTitle(const void *arg1, const void *arg2) Song* pSong1 = *(Song**)arg1; Song* pSong2 = *(Song**)arg2; - CString sTitle1 = pSong1->GetTitle(); - CString sTitle2 = pSong2->GetTitle(); + CString sTitle1 = pSong1->GetFullTitle(); + CString sTitle2 = pSong2->GetFullTitle(); CString sFilePath1 = pSong1->GetSongFilePath(); // this is unique among songs CString sFilePath2 = pSong2->GetSongFilePath(); @@ -922,3 +1218,4 @@ void SortSongPointerArrayByMostPlayed( CArray &arraySongPointers ) { qsort( arraySongPointers.GetData(), arraySongPointers.GetSize(), sizeof(Song*), CompareSongPointersByMostPlayed ); } + diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index a3744f08d2..4e0d7629d2 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -5,27 +5,39 @@ Desc: See header. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ +//#include #include "SongManager.h" #include "IniFile.h" #include "RageHelper.h" - +#include "ErrorCatcher/ErrorCatcher.h" SongManager* SONG = NULL; // global and accessable from anywhere in our program const CString g_sStatisticsFileName = "statistics.ini"; +D3DXCOLOR GROUP_COLORS[] = { + D3DXCOLOR( 0.9f, 0.0f, 0.2f, 1 ), // red + D3DXCOLOR( 0.6f, 0.0f, 0.4f, 1 ), // pink + D3DXCOLOR( 0.2f, 0.1f, 0.3f, 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_GROUP_COLORS = sizeof(GROUP_COLORS) / sizeof(D3DXCOLOR); + SongManager::SongManager() { m_pCurSong = NULL; for( int p=0; p arraySongs; + arraySongs.Copy( m_pSongs ); + SortSongPointerArrayByGroup( arraySongs ); + + for( int i=0; iGetGroupName(); + + if( m_arrayGroupNames.GetSize() == 0 || m_arrayGroupNames[m_arrayGroupNames.GetSize()-1] != sGroupName ) + m_arrayGroupNames.Add( sGroupName ); + } + HELPER.Log( "Found %d Songs.", m_pSongs.GetSize() ); } @@ -68,7 +96,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir ) GetDirListing( ssprintf("%s\\%s\\*.mp3", sDir, sGroupDirName), arrayFiles ); GetDirListing( ssprintf("%s\\%s\\*.wav", sDir, sGroupDirName), arrayFiles ); if( arrayFiles.GetSize() > 0 ) - HELPER.FatalError( + FatalError( ssprintf( "The song folder '%s' must be placed inside of a group folder.\n\n" "All song folders must be placed below a group folder. For example, 'Songs\\DDR 4th Mix\\B4U'. See the StepMania readme for more info.", ssprintf("%s\\%s", sDir, sGroupDirName ) ) @@ -135,7 +163,7 @@ void SongManager::LoadDWISongDir( CString sDir ) // load DWIs from the sub dirs Song* pNewSong = new Song; - pNewSong->LoadSongInfoFromDWIFile( ssprintf("DWI Support\\DWIs\\%s\\%s", sDirName, sDWIFileName) ); + pNewSong->LoadFromDWIFile( ssprintf("DWI Support\\DWIs\\%s\\%s", sDirName, sDWIFileName) ); m_pSongs.Add( pNewSong ); } } @@ -190,7 +218,7 @@ void SongManager::ReadStatisticsFromDisk() int iRetVal; int i; - // Parse for Song name and Pattern name + // Parse for Song name and NoteMetadata name iRetVal = sscanf( name_string, "%[^:]::%[^\n]", szSongName, szStepsName ); if( iRetVal != 2 ) continue; // this line doesn't match what is expected @@ -200,7 +228,7 @@ void SongManager::ReadStatisticsFromDisk() Song* pSong = NULL; for( i=0; iGetTitle() == szSongName ) // match! + if( m_pSongs[i]->GetFullTitle() == szSongName ) // match! { pSong = m_pSongs[i]; break; @@ -210,35 +238,35 @@ void SongManager::ReadStatisticsFromDisk() continue; // skip this entry - // Search for the corresponding Pattern pointer. - Pattern* pPattern = NULL; - for( i=0; im_arrayPatterns.GetSize(); i++ ) + // Search for the corresponding NoteMetadata pointer. + NoteMetadata* pNoteMetadata = NULL; + for( i=0; im_arrayNoteMetadatas.GetSize(); i++ ) { - if( pSong->m_arrayPatterns[i].m_sDescription == szStepsName ) // match! + if( pSong->m_arrayNoteMetadatas[i].m_sDescription == szStepsName ) // match! { - pPattern = &pSong->m_arrayPatterns[i]; + pNoteMetadata = &pSong->m_arrayNoteMetadatas[i]; break; } } - if( pPattern == NULL ) // didn't find a match + if( pNoteMetadata == NULL ) // didn't find a match continue; // skip this entry - // Parse the Pattern statistics. + // Parse the NoteMetadata statistics. char szGradeLetters[10]; // longest possible string is "AAA" iRetVal = sscanf( value_string, "%d::%[^:]::%d::%d", - &pPattern->m_iNumTimesPlayed, + &pNoteMetadata->m_iNumTimesPlayed, szGradeLetters, - &pPattern->m_iTopScore, - &pPattern->m_iMaxCombo + &pNoteMetadata->m_iTopScore, + &pNoteMetadata->m_iMaxCombo ); if( iRetVal != 4 ) continue; - pPattern->m_TopGrade = StringToGrade( szGradeLetters ); + pNoteMetadata->m_TopGrade = StringToGrade( szGradeLetters ); } } } @@ -253,22 +281,22 @@ void SongManager::SaveStatisticsToDisk() { Song* pSong = m_pSongs[i]; - for( int j=0; jm_arrayPatterns.GetSize(); j++ ) // for each Pattern + for( int j=0; jm_arrayNoteMetadatas.GetSize(); j++ ) // for each NoteMetadata { - Pattern* pPattern = &pSong->m_arrayPatterns[j]; + NoteMetadata* pNoteMetadata = &pSong->m_arrayNoteMetadatas[j]; - if( pPattern->m_TopGrade == GRADE_NO_DATA ) + if( pNoteMetadata->m_TopGrade == GRADE_NO_DATA ) continue; // skip - // Each value has the format "SongName::PatternName=TimesPlayed::TopGrade::TopScore::MaxCombo". + // Each value has the format "SongName::NoteMetadataName=TimesPlayed::TopGrade::TopScore::MaxCombo". - CString sName = ssprintf( "%s::%s", pSong->GetTitle(), pPattern->m_sDescription ); + CString sName = ssprintf( "%s::%s", pSong->GetFullTitle(), pNoteMetadata->m_sDescription ); CString sValue = ssprintf( "%d::%s::%d::%d", - pPattern->m_iNumTimesPlayed, - GradeToString( pPattern->m_TopGrade ), - pPattern->m_iTopScore, - pPattern->m_iMaxCombo + pNoteMetadata->m_iNumTimesPlayed, + GradeToString( pNoteMetadata->m_TopGrade ), + pNoteMetadata->m_iTopScore, + pNoteMetadata->m_iMaxCombo ); ini.SetValue( "Statistics", sName, sValue ); @@ -291,18 +319,20 @@ CString SongManager::GetGroupBannerPath( CString sGroupName ) void SongManager::GetGroupNames( CStringArray &AddTo ) { - CArray arraySongs; - arraySongs.Copy( m_pSongs ); - SortSongPointerArrayByGroup( arraySongs ); + AddTo.Copy( m_arrayGroupNames ); +} - for( int i=0; iGetGroupName(); - - if( AddTo.GetSize() == 0 || AddTo[AddTo.GetSize()-1] != sGroupName ) - AddTo.Add( sGroupName ); + if( m_arrayGroupNames[i] == sGroupName ) + break; } + ASSERT( i != m_arrayGroupNames.GetSize() ); // this is not a valid group + + return GROUP_COLORS[i%NUM_GROUP_COLORS]; } void SongManager::GetSongsInGroup( const CString sGroupName, CArray &AddTo ) @@ -315,3 +345,12 @@ void SongManager::GetSongsInGroup( const CString sGroupName, CArray // for D3DXCOLOR class SongManager @@ -24,8 +24,9 @@ public: SongManager(); ~SongManager(); - Song* m_pCurSong; - Pattern* m_pCurPattern[NUM_PLAYERS]; + Song* m_pCurSong; + NoteMetadata* m_pCurNoteMetadata[NUM_PLAYERS]; + CString m_sPreferredGroup; CArray m_pSongs; // all songs that can be played @@ -40,8 +41,10 @@ public: CString GetGroupBannerPath( CString sGroupName ); - void GetGroupNames( CStringArray &AddTo ); + D3DXCOLOR GetGroupColor( const CString &sGroupName ); + + CString ShortenGroupName( const CString &sOrigGroupName ); void GetSongsInGroup( const CString sGroupName, CArray &AddTo ); @@ -50,7 +53,7 @@ protected: void LoadStepManiaSongDir( CString sDir ); void LoadDWISongDir( CString sDir ); CMapStringToString m_mapGroupToBannerPath; // each song group has a banner associated with it - + CStringArray m_arrayGroupNames; }; diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 09cc1644a0..c238184ded 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -5,7 +5,7 @@ Desc: A bitmap actor that animates and moves around. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -16,6 +16,7 @@ #include "IniFile.h" #include #include "RageHelper.h" +#include "ErrorCatcher/ErrorCatcher.h" Sprite::Sprite() @@ -74,11 +75,11 @@ bool Sprite::LoadFromSpriteFile( CString sSpritePath, DWORD dwHints, bool bForce IniFile ini; ini.SetPath( m_sSpritePath ); if( !ini.ReadFile() ) - HELPER.FatalError( ssprintf("Error opening Sprite file '%s'.", m_sSpritePath) ); + FatalError( ssprintf("Error opening Sprite file '%s'.", m_sSpritePath) ); CString sTextureFile = ini.GetValue( "Sprite", "Texture" ); if( sTextureFile == "" ) - HELPER.FatalError( ssprintf("Error reading value 'Texture' from %s.", m_sSpritePath) ); + FatalError( ssprintf("Error reading value 'Texture' from %s.", m_sSpritePath) ); CString sTexturePath = sFontDir + sTextureFile; // save the path of the new texture @@ -99,7 +100,7 @@ bool Sprite::LoadFromSpriteFile( CString sSpritePath, DWORD dwHints, bool bForce m_iStateToFrame[i] = ini.GetValueI( "Sprite", sFrameKey ); if( m_iStateToFrame[i] >= m_pTexture->GetNumFrames() ) - HELPER.FatalError( ssprintf("In '%s', %s is %d, but the texture %s only has %d frames.", + FatalError( ssprintf("In '%s', %s is %d, but the texture %s only has %d frames.", m_sSpritePath, sFrameKey, m_iStateToFrame[i], sTexturePath, m_pTexture->GetNumFrames()) ); m_fDelay[i] = (float)ini.GetValueF( "Sprite", sDelayKey ); @@ -120,10 +121,18 @@ bool Sprite::LoadFromSpriteFile( CString sSpritePath, DWORD dwHints, bool bForce return true; } -bool Sprite::LoadTexture( CString sTexturePath, DWORD dwHints, bool bForceReload ) +void Sprite::UnloadTexture() { if( m_pTexture != NULL ) // If there was a previous bitmap... TEXTURE->UnloadTexture( m_sTexturePath ); // Unload it. + m_pTexture = NULL; + m_sTexturePath = ""; +} + +bool Sprite::LoadTexture( CString sTexturePath, DWORD dwHints, bool bForceReload ) +{ + if( m_pTexture != NULL ) // If there was a previous bitmap... + UnloadTexture(); m_sTexturePath = sTexturePath; diff --git a/stepmania/src/Sprite.h b/stepmania/src/Sprite.h index f55f2bdf6c..44a4269259 100644 --- a/stepmania/src/Sprite.h +++ b/stepmania/src/Sprite.h @@ -4,7 +4,7 @@ Desc: A bitmap Actor that animates and moves around. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -36,6 +36,7 @@ public: else return LoadFromTexture( sFilePath, dwHints, bForceReload ); }; + void UnloadTexture(); virtual void RenderPrimitives(); virtual void Update( float fDeltaTime ); diff --git a/stepmania/src/StdAfx.cpp b/stepmania/src/StdAfx.cpp index 4f5975fca6..c984fceb7d 100644 --- a/stepmania/src/StdAfx.cpp +++ b/stepmania/src/StdAfx.cpp @@ -5,7 +5,7 @@ Desc: Basic.pch will be the pre-compiled header stdafx.obj will contain the pre-compiled type information. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/StdAfx.h b/stepmania/src/StdAfx.h index 56769a06f6..0b28df6890 100644 --- a/stepmania/src/StdAfx.h +++ b/stepmania/src/StdAfx.h @@ -4,7 +4,7 @@ Desc: Include file for standard system include files. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -25,6 +25,18 @@ #endif // _AFX_NO_AFXCMN_SUPPORT +// +// Rage global classes +// +#include "RageHelper.h" +#include "RageScreen.h" +#include "RageTextureManager.h" +#include "RageSound.h" +#include "RageMusic.h" +#include "RageInput.h" + + + //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. diff --git a/stepmania/src/StepMania.RC b/stepmania/src/StepMania.RC index a5ef09fc08..d8fa16d2ec 100644 --- a/stepmania/src/StepMania.RC +++ b/stepmania/src/StepMania.RC @@ -54,7 +54,7 @@ END IDR_MAIN_ACCEL ACCELERATORS BEGIN - VK_F5, IDM_CHANGERESOLUTION, VIRTKEY, NOINVERT + VK_F5, IDM_CHANGEDETAIL, VIRTKEY, NOINVERT "X", IDM_EXIT, VIRTKEY, ALT, NOINVERT VK_F4, IDM_TOGGLEFULLSCREEN, VIRTKEY, NOINVERT VK_RETURN, IDM_TOGGLEFULLSCREEN, VIRTKEY, ALT, NOINVERT diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 505d5572a2..ebde451dd2 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -5,7 +5,7 @@ Desc: - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -14,19 +14,31 @@ //----------------------------------------------------------------------------- #include "resource.h" -#include "RageHelper.h" -#include "RageScreen.h" -#include "RageTextureManager.h" -#include "RageSound.h" -#include "RageMusic.h" -#include "RageInput.h" - +// +// StepMania global classes +// #include "PrefsManager.h" #include "SongManager.h" #include "ThemeManager.h" #include "WindowManager.h" #include "GameManager.h" #include "FontManager.h" +#include "InputFilter.h" +#include "InputMapper.h" + +// +// StepMania common classes +// +#include "Font.h" +#include "GameConstants.h" +#include "GameTypes.h" +#include "GameInput.h" +#include "StyleInput.h" +#include "Song.h" +#include "StyleDef.h" +#include "NoteData.h" +#include "NoteMetadata.h" + #include "WindowSandbox.h" #include "WindowResults.h" @@ -35,6 +47,17 @@ #include "ScreenDimensions.h" +// error catcher stuff +#include "ErrorCatcher/ErrorCatcher.h" +#pragma comment(lib, "ErrorCatcher/dbghelp.lib") +#if defined(DEBUG) | defined(_DEBUG) + #pragma comment(lib, "ErrorCatcher/ErrorCatcherD.lib") +#else + #pragma comment(lib, "ErrorCatcher/ErrorCatcher.lib") +#endif + + +#include "dxerr8.h" #include "DXUtil.h" #include @@ -98,7 +121,6 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow ) if( GetLastError() == ERROR_ALREADY_EXISTS ) { CloseHandle( g_hMutex ); - HELPER.FatalError( "StepMania is already running!" ); } @@ -163,9 +185,14 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow ) +#ifdef DEBUG +#define BCATCHERRORS false +#else +#define BCATCHERRORS true +#endif - bool bSuccess = HELPER.Run( MainLoop ); + bool bSuccess = RunAndCatchErrors( MainLoop, BCATCHERRORS ); @@ -227,7 +254,9 @@ void MainLoop() Update(); Render(); //if( !g_bFullscreen ) - //::Sleep(0 ); // give some time for the movie decoding thread +#ifdef DEBUG + ::Sleep(1 ); // give some time for the movie decoding thread +#endif } } // end while( WM_QUIT != msg.message ) @@ -244,7 +273,10 @@ BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { case WM_INITDIALOG: { - CString sMessage = HELPER.GetError() + "\n\nStack Trace:\n" + HELPER.GetErrorStackTrace(); + CString sMessage = ssprintf("%s", GetError() ); + if( GetErrorHr() != 0 ) + sMessage += ssprintf(" ('%d - %s)'", GetErrorHr(), DXGetErrorString8(GetErrorHr()) ); + sMessage += ssprintf("\n\n%s", GetStackTrace() ); sMessage.Replace( "\n", "\r\n" ); SendDlgItemMessage( hWnd, @@ -384,8 +416,8 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) go.m_bWindowed = !go.m_bWindowed; ApplyGraphicOptions(); return 0; - case IDM_CHANGERESOLUTION: - go.m_iResolution = (go.m_iResolution==640) ? 320 : 640; + case IDM_CHANGEDETAIL: + go.m_Profile = GraphicProfile( (go.m_Profile+1)%NUM_GRAPHIC_PROFILES ); ApplyGraphicOptions(); return 0; case IDM_EXIT: @@ -463,6 +495,8 @@ HRESULT CreateObjects( HWND hWnd ) SONG = new SongManager; // this takes a long time to load GAME = new GameManager; THEME = new ThemeManager; + FILTER = new InputFilter(); + MAPPER = new InputMapper(); BringWindowToTop( hWnd ); SetForegroundWindow( hWnd ); @@ -512,6 +546,8 @@ void DestroyObjects() SAFE_DELETE( SONG ); SAFE_DELETE( GAME ); SAFE_DELETE( FONT ); + SAFE_DELETE( FILTER ); + SAFE_DELETE( MAPPER ); SAFE_DELETE( INPUTM ); SAFE_DELETE( MUSIC ); @@ -589,27 +625,41 @@ void Update() if( fDeltaTime > 0.050f ) // we dropped a bunch of frames fDeltaTime = 0.050f; + if( INPUTM->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_TAB) ) ) + fDeltaTime *= 4; + if( INPUTM->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_LSHIFT) ) ) + fDeltaTime /= 4; + + MUSIC->Update( fDeltaTime ); WM->Update( fDeltaTime ); - static DeviceInputArray diArray; - diArray.SetSize( 0, 10 ); // zero the array - INPUTM->GetDeviceInputs( diArray ); + static InputEventArray ieArray; + ieArray.SetSize( 0, 20 ); // zero the array + FILTER->GetInputEvents( ieArray, fDeltaTime ); DeviceInput DeviceI; - PadInput PadI; - PlayerInput PlayerI; + InputEventType type; + GameInput GameI; + MenuInput MenuI; + StyleInput StyleI; - for( int i=0; iDeviceToPad( DeviceI, PadI ); - PREFS->PadToPlayer( PadI, PlayerI ); + MAPPER->DeviceToGame( DeviceI, GameI ); + + MenuI = MAPPER->DeviceToMenu( DeviceI ); + if( !MenuI.IsValid() ) // try again + MAPPER->GameToMenu( GameI, MenuI ); + + MAPPER->GameToStyle( GameI, StyleI ); - WM->Input( DeviceI, PadI, PlayerI ); + WM->Input( DeviceI, type, GameI, MenuI, StyleI ); } } @@ -640,7 +690,7 @@ void Render() } else { - HELPER.FatalErrorHr( hr, "Failed to SCREEN->Reset()" ); + FatalErrorHr( hr, "Failed to SCREEN->Reset()" ); } break; @@ -651,7 +701,7 @@ void Render() // calculate view and projection transforms D3DXMATRIX matProj; - D3DXMatrixOrthoOffCenterLH( &matProj, 0, 640, 480, 0, -100, 100 ); + D3DXMatrixOrthoOffCenterLH( &matProj, 0, 640, 480, 0, -1000, 1000 ); pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj ); D3DXMATRIX matView; @@ -695,78 +745,139 @@ void ApplyGraphicOptions() GraphicOptions &go = PREFS->m_GraphicOptions; - // - // Let the texture manager know about our preferences - // - if( TEXTURE != NULL ) - { - TEXTURE->SetMaxTextureSize( go.m_iMaxTextureSize ); - TEXTURE->SetTextureColorDepth( go.m_iTextureColor ); - } + bool bWindowed = go.m_bWindowed; // - // use GameOptions to get the display settings + // fill these in below depending on the profile // - bool bWindowed = go.m_bWindowed; - DWORD dwWidth = go.m_iResolution; - DWORD dwHeight; - // fill in dwHeight - switch( dwWidth ) + CString sProfileName; + DWORD dwWidth, dwHeight; + DWORD dwDisplayBPP; + DWORD dwTextureBPP; + DWORD dwMaxTextureSize; + bool bShadows; + bool bBackgrounds; + + switch( go.m_Profile ) { - case 320: dwHeight = 240; break; - case 400: dwHeight = 300; break; - case 512: dwHeight = 384; break; - case 640: dwHeight = 480; break; - case 800: dwHeight = 600; break; - case 1024: dwHeight = 768; break; - case 1280: dwHeight = 1024; break; - default: dwHeight = 480; break; + case PROFILE_SUPER_LOW: + sProfileName = "Super Low"; + dwWidth = 320; + dwHeight = 240; + dwDisplayBPP = 16; + dwTextureBPP = 16; + dwMaxTextureSize = 256; + bShadows = false; + bBackgrounds = false; + break; + case PROFILE_LOW: + sProfileName = "Low"; + dwWidth = 400; + dwHeight = 300; + dwDisplayBPP = 16; + dwTextureBPP = 16; + dwMaxTextureSize = 256; + bShadows = false; + bBackgrounds = true; + break; + case PROFILE_MEDIUM: + sProfileName = "Medium"; + dwWidth = 640; + dwHeight = 480; + dwDisplayBPP = 16; + dwTextureBPP = 16; + dwMaxTextureSize = 512; + bShadows = false; + bBackgrounds = true; + break; + case PROFILE_HIGH: + sProfileName = "High"; + dwWidth = 640; + dwHeight = 480; + dwDisplayBPP = 16; + dwTextureBPP = 16; + dwMaxTextureSize = 1024; + bShadows = true; + bBackgrounds = true; + break; + case PROFILE_CUSTOM: + sProfileName = "Custom"; + dwWidth = go.m_iResolution; + switch( dwWidth ) + { + case 320: dwHeight = 240; break; + case 400: dwHeight = 300; break; + case 512: dwHeight = 384; break; + case 640: dwHeight = 480; break; + case 800: dwHeight = 600; break; + case 1024: dwHeight = 768; break; + case 1280: dwHeight = 1024; break; + default: dwHeight = 480; break; + } + dwDisplayBPP = go.m_iDisplayColor; + dwTextureBPP = go.m_iTextureColor; + dwMaxTextureSize = go.m_iMaxTextureSize; + bShadows = go.m_bShadows; + bBackgrounds = go.m_bBackgrounds; + break; + default: + ASSERT( false ); } - DWORD dwBPP = go.m_iDisplayColor; - DWORD dwFlags = 0 | (go.m_b30fpsLock ? SCREEN_FLAG_CAP_AT_30HZ : 0); + DWORD dwFlags = 0; // not used // // If the requested resolution doesn't work, keep switching until we find one that does. // - if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwBPP, dwFlags ) ) + if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) { // We failed. Try full screen with same params. bWindowed = false; - if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwBPP, dwFlags ) ) + if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) { // Failed again. Try 16 BPP - dwBPP = 16; - if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwBPP, dwFlags ) ) + dwDisplayBPP = 16; + if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) { // Failed again. Try 640x480 dwWidth = 640; dwHeight = 480; - if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwBPP, dwFlags ) ) + if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) { // Failed again. Try 320x240 dwWidth = 320; dwHeight = 240; - if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwBPP, dwFlags ) ) + if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) { - HELPER.FatalError( "Tried every possible display mode, and couldn't change to any of them." ); + FatalError( "Tried every possible display mode, and couldn't change to any of them." ); } } } } } + // + // Let the texture manager know about our preferences + // + if( TEXTURE != NULL ) + { + TEXTURE->SetMaxTextureSize( dwMaxTextureSize ); + TEXTURE->SetTextureColorDepth( dwTextureBPP ); + } RestoreObjects(); - go.m_bWindowed = bWindowed; - go.m_iDisplayColor = dwBPP; - go.m_iResolution = dwWidth; PREFS->SavePrefsToDisk(); if( WM ) { - WM->SystemMessage( ssprintf("%s - %ux%u - %u bits", bWindowed ? "Windowed" : "FullScreen", dwWidth, dwHeight, dwBPP) ); + CString sMessage; + if( sProfileName == "Custom" ) + sMessage = ssprintf("%s - %ux%u - %u color, %u texture", bWindowed ? "Windowed" : "FullScreen", dwWidth, dwHeight, dwDisplayBPP, dwTextureBPP); + else + sMessage = ssprintf("%s - %s detail", bWindowed ? "Windowed" : "FullScreen", sProfileName ); + + WM->SystemMessage( sMessage ); } } diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index bbd8eb2930..82704e6a58 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -200,14 +200,6 @@ SOURCE=.\Window.h # End Source File # Begin Source File -SOURCE=.\WindowAdvancedOptions.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowAdvancedOptions.h -# End Source File -# Begin Source File - SOURCE=.\WindowCaution.cpp # End Source File # Begin Source File @@ -224,6 +216,14 @@ 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 @@ -248,14 +248,6 @@ SOURCE=.\WindowEditMenu.h # End Source File # Begin Source File -SOURCE=.\WindowEditOptions.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowEditOptions.h -# End Source File -# Begin Source File - SOURCE=.\WindowGameOptions.cpp # End Source File # Begin Source File @@ -280,14 +272,6 @@ SOURCE=.\WindowManager.h # End Source File # Begin Source File -SOURCE=.\WindowMenu.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowMenu.h -# End Source File -# Begin Source File - SOURCE=.\WindowMessage.h # End Source File # Begin Source File @@ -340,6 +324,14 @@ SOURCE=.\WindowSelectDifficulty.h # End Source File # Begin Source File +SOURCE=.\WindowSelectGroup.cpp +# End Source File +# Begin Source File + +SOURCE=.\WindowSelectGroup.h +# End Source File +# Begin Source File + SOURCE=.\WindowSelectMusic.cpp # End Source File # Begin Source File @@ -412,6 +404,18 @@ SOURCE=.\GameConstants.h # End Source File # Begin Source File +SOURCE=.\GameDef.cpp +# End Source File +# Begin Source File + +SOURCE=.\GameDef.h +# End Source File +# Begin Source File + +SOURCE=.\GameInput.h +# End Source File +# Begin Source File + SOURCE=.\GameManager.cpp # End Source File # Begin Source File @@ -432,18 +436,42 @@ SOURCE=.\Grade.h # End Source File # Begin Source File +SOURCE=.\InputFilter.cpp +# End Source File +# Begin Source File + +SOURCE=.\InputFilter.h +# End Source File +# Begin Source File + +SOURCE=.\InputMapper.cpp +# End Source File +# Begin Source File + +SOURCE=.\InputMapper.h +# End Source File +# Begin Source File + +SOURCE=.\NoteData.cpp +# End Source File +# Begin Source File + +SOURCE=.\NoteData.h +# End Source File +# Begin Source File + +SOURCE=.\NoteMetadata.cpp +# End Source File +# Begin Source File + +SOURCE=.\NoteMetadata.h +# End Source File +# Begin Source File + SOURCE=.\PadInput.h # End Source File # Begin Source File -SOURCE=.\Pattern.cpp -# End Source File -# Begin Source File - -SOURCE=.\Pattern.h -# End Source File -# Begin Source File - SOURCE=.\Player.cpp # End Source File # Begin Source File @@ -504,6 +532,10 @@ SOURCE=.\StyleDef.h # End Source File # Begin Source File +SOURCE=.\StyleInput.h +# End Source File +# Begin Source File + SOURCE=.\ThemeManager.cpp # End Source File # Begin Source File @@ -522,14 +554,6 @@ SOURCE=.\IniFile.cpp SOURCE=.\IniFile.h # End Source File -# Begin Source File - -SOURCE=.\XMLMarkup.cpp -# End Source File -# Begin Source File - -SOURCE=.\XMLMarkup.h -# End Source File # End Group # Begin Group "System" @@ -704,6 +728,14 @@ SOURCE=.\BPMDisplay.h # End Source File # Begin Source File +SOURCE=.\CroppedSprite.cpp +# End Source File +# Begin Source File + +SOURCE=.\CroppedSprite.h +# End Source File +# Begin Source File + SOURCE=.\DifficultyIcon.cpp # End Source File # Begin Source File @@ -736,11 +768,19 @@ SOURCE=.\GranularityIndicator.h # End Source File # Begin Source File -SOURCE=.\InfoFrame.cpp +SOURCE=.\GrooveRadar.cpp # End Source File # Begin Source File -SOURCE=.\InfoFrame.h +SOURCE=.\GrooveRadar.h +# End Source File +# Begin Source File + +SOURCE=.\GroupInfoFrame.cpp +# End Source File +# Begin Source File + +SOURCE=.\GroupInfoFrame.h # End Source File # Begin Source File @@ -776,11 +816,11 @@ SOURCE=.\MusicWheel.h # End Source File # Begin Source File -SOURCE=.\StepsSelector.cpp +SOURCE=.\SongInfoFrame.cpp # End Source File # Begin Source File -SOURCE=.\StepsSelector.h +SOURCE=.\SongInfoFrame.h # End Source File # Begin Source File @@ -828,14 +868,6 @@ SOURCE=.\ColorArrow.h # End Source File # Begin Source File -SOURCE=.\ColorArrowField.cpp -# End Source File -# Begin Source File - -SOURCE=.\ColorArrowField.h -# End Source File -# Begin Source File - SOURCE=.\Combo.cpp # End Source File # Begin Source File @@ -868,11 +900,11 @@ SOURCE=.\GhostArrowBright.h # End Source File # Begin Source File -SOURCE=.\GhostArrows.cpp +SOURCE=.\GhostArrowRow.cpp # End Source File # Begin Source File -SOURCE=.\GhostArrows.h +SOURCE=.\GhostArrowRow.h # End Source File # Begin Source File @@ -884,11 +916,11 @@ SOURCE=.\GrayArrow.h # End Source File # Begin Source File -SOURCE=.\GrayArrows.cpp +SOURCE=.\GrayArrowRow.cpp # End Source File # Begin Source File -SOURCE=.\GrayArrows.h +SOURCE=.\GrayArrowRow.h # End Source File # Begin Source File @@ -932,6 +964,14 @@ SOURCE=.\MotionBlurSprite.h # End Source File # Begin Source File +SOURCE=.\NoteField.cpp +# End Source File +# Begin Source File + +SOURCE=.\NoteField.h +# End Source File +# Begin Source File + SOURCE=.\ScoreDisplayRolling.cpp # End Source File # Begin Source File @@ -947,54 +987,6 @@ SOURCE=.\ScoreDisplayRollingWithFrame.cpp SOURCE=.\ScoreDisplayRollingWithFrame.h # End Source File # End Group -# Begin Group "exception" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\exception\AtlAux2.h -# End Source File -# Begin Source File - -SOURCE=.\exception\debug_stream.h -# End Source File -# Begin Source File - -SOURCE=.\exception\exception2.h -# End Source File -# Begin Source File - -SOURCE=.\exception\exception_trap.h -# End Source File -# Begin Source File - -SOURCE=.\exception\kbase.h -# End Source File -# Begin Source File - -SOURCE=.\exception\se_translator.cpp -# End Source File -# Begin Source File - -SOURCE=.\exception\se_translator.h -# End Source File -# Begin Source File - -SOURCE=.\exception\StdAfx.h -# End Source File -# Begin Source File - -SOURCE=.\exception\sym_engine.cpp -# End Source File -# Begin Source File - -SOURCE=.\exception\sym_engine.h -# End Source File -# Begin Source File - -SOURCE=.\exception\unhandled_report.h -# End Source File -# End Group # Begin Source File SOURCE=.\error.bmp diff --git a/stepmania/src/StepMania.dsw b/stepmania/src/StepMania.dsw index a387ec3711..daf93f4eab 100644 --- a/stepmania/src/StepMania.dsw +++ b/stepmania/src/StepMania.dsw @@ -3,6 +3,18 @@ Microsoft Developer Studio Workspace File, Format Version 6.00 ############################################################################### +Project: "ErrorCatcher"=.\ErrorCatcher\ErrorCatcher.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "StepMania"=.\StepMania.dsp - Package Owner=<4> Package=<5> @@ -11,6 +23,9 @@ Package=<5> Package=<4> {{{ + Begin Project Dependency + Project_Dep_Name ErrorCatcher + End Project Dependency }}} ############################################################################### diff --git a/stepmania/src/StepMania.h b/stepmania/src/StepMania.h index b14dccb06c..0185181372 100644 --- a/stepmania/src/StepMania.h +++ b/stepmania/src/StepMania.h @@ -4,7 +4,7 @@ Desc: - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/StepMania.sln b/stepmania/src/StepMania.sln index 505a0b2292..dc44dec192 100644 --- a/stepmania/src/StepMania.sln +++ b/stepmania/src/StepMania.sln @@ -1,12 +1,11 @@ Microsoft Visual Studio Solution File, Format Version 7.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StepMania", "StepMania.vcproj", "{670745A6-106B-420D-A2A9-D4F89A23986E}" EndProject -Project("{059D6162-CD51-11D0-AE1F-00A0C90FFFC3}") = "ZipArchive", "smpackage\ZipArchive\ZipArchive.dsp", "{2AF0D4D5-0984-4AD4-A2BD-402D4BE285CE}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZipArchive", "smpackage\ZipArchive\ZipArchive.vcproj", "{2AF0D4D5-0984-4AD4-A2BD-402D4BE285CE}" EndProject -Project("{059D6162-CD51-11D0-AE1F-00A0C90FFFC3}") = "smpackage", "smpackage\smpackage.dsp", "{775C9F19-F852-43AC-8563-D869C027722D}" - ProjectSection(DevStudioProjDeps) = postProject - 0 = ZipArchive - EndProjectSection +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smpackage", "smpackage\smpackage.vcproj", "{775C9F19-F852-43AC-8563-D869C027722D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ErrorCatcher", "ErrorCatcher\ErrorCatcher.vcproj", "{88A45E4A-2CEB-404C-88AB-EE07B1844DB0}" EndProject Global GlobalSection(SolutionConfiguration) = preSolution @@ -14,12 +13,22 @@ Global ConfigName.1 = Release EndGlobalSection GlobalSection(ProjectDependencies) = postSolution + {670745A6-106B-420D-A2A9-D4F89A23986E}.0 = {88A45E4A-2CEB-404C-88AB-EE07B1844DB0} + {775C9F19-F852-43AC-8563-D869C027722D}.0 = {2AF0D4D5-0984-4AD4-A2BD-402D4BE285CE} EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {670745A6-106B-420D-A2A9-D4F89A23986E}.Debug.ActiveCfg = Debug|Win32 {670745A6-106B-420D-A2A9-D4F89A23986E}.Debug.Build.0 = Debug|Win32 {670745A6-106B-420D-A2A9-D4F89A23986E}.Release.ActiveCfg = Release|Win32 {670745A6-106B-420D-A2A9-D4F89A23986E}.Release.Build.0 = Release|Win32 + {2AF0D4D5-0984-4AD4-A2BD-402D4BE285CE}.Debug.ActiveCfg = Debug|Win32 + {2AF0D4D5-0984-4AD4-A2BD-402D4BE285CE}.Release.ActiveCfg = Release|Win32 + {775C9F19-F852-43AC-8563-D869C027722D}.Debug.ActiveCfg = Debug|Win32 + {775C9F19-F852-43AC-8563-D869C027722D}.Release.ActiveCfg = Release|Win32 + {88A45E4A-2CEB-404C-88AB-EE07B1844DB0}.Debug.ActiveCfg = Debug|Win32 + {88A45E4A-2CEB-404C-88AB-EE07B1844DB0}.Debug.Build.0 = Debug|Win32 + {88A45E4A-2CEB-404C-88AB-EE07B1844DB0}.Release.ActiveCfg = Release|Win32 + {88A45E4A-2CEB-404C-88AB-EE07B1844DB0}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 0cef567492..ad55a532cd 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -11,71 +11,6 @@ Name="Win32"/> - - - - - - - - - - - - @@ -133,6 +69,72 @@ + + + + + + + + + + + + - - - - @@ -162,6 +158,12 @@ + + + + @@ -181,10 +183,10 @@ RelativePath=".\WindowEditMenu.h"> + RelativePath="WindowEnding.cpp"> + RelativePath="WindowEnding.h"> @@ -204,12 +206,6 @@ - - - - @@ -249,6 +245,12 @@ + + + + @@ -304,6 +306,15 @@ + + + + + + @@ -320,13 +331,31 @@ RelativePath=".\Grade.h"> + RelativePath="InputFilter.cpp"> + RelativePath="InputFilter.h"> + RelativePath="InputMapper.cpp"> + + + + + + + + + + + + @@ -334,9 +363,6 @@ - - @@ -370,6 +396,9 @@ + + @@ -389,12 +418,6 @@ - - - - + + + + @@ -559,10 +588,10 @@ RelativePath="GrooveRadar.h"> + RelativePath="GroupInfoFrame.cpp"> + RelativePath="GroupInfoFrame.h"> @@ -589,10 +618,10 @@ RelativePath=".\MusicWheel.h"> + RelativePath="SongInfoFrame.cpp"> + RelativePath="SongInfoFrame.h"> @@ -628,12 +657,6 @@ - - - - @@ -659,10 +682,10 @@ RelativePath=".\GhostArrowBright.h"> + RelativePath="GhostArrowRow.cpp"> + RelativePath="GhostArrowRow.h"> @@ -671,10 +694,10 @@ RelativePath=".\GrayArrow.h"> + RelativePath="GrayArrowRow.cpp"> + RelativePath="GrayArrowRow.h"> @@ -706,6 +729,12 @@ + + + + @@ -719,40 +748,6 @@ RelativePath="ScoreDisplayRollingWithFrame.h"> - - - - - - - - - - - - - - - - - - - - - - diff --git a/stepmania/src/StyleDef.cpp b/stepmania/src/StyleDef.cpp index 0312a3fa0d..1cf9e98af5 100644 --- a/stepmania/src/StyleDef.cpp +++ b/stepmania/src/StyleDef.cpp @@ -5,51 +5,13 @@ Desc: A data structure that holds the definition of a GameMode. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ #include "StyleDef.h" #include "RageHelper.h" #include "RageUtil.h" +#include "ErrorCatcher/ErrorCatcher.h" -CString StyleDef::ElementToGraphicSuffix( const StyleElement se ) -{ - CString sAssetPath; // fill this in below - - switch( se ) - { - case GRAPHIC_NOTE_COLOR_PART: sAssetPath = "note color part"; break; - case GRAPHIC_NOTE_GRAY_PART: sAssetPath = "note gray part"; break; - case GRAPHIC_RECEPTOR: sAssetPath = "receptor"; break; - case GRAPHIC_HOLD_EXPLOSION: sAssetPath = "hold explosion"; break; - case GRAPHIC_TAP_EXPLOSION_BRIGHT: sAssetPath = "tap explosion bright"; break; - case GRAPHIC_TAP_EXPLOSION_DIM: sAssetPath = "tap explosion dim"; break; - - default: - HELPER.FatalError( ssprintf("Unhandled StyleElement %d", se) ); - } - - return sAssetPath; -} - -CString StyleDef::GetPathToGraphic( const int iColumnNumber, const StyleElement se ) -{ - const CString sDir = "Game\\Dance\\"; - const CString sNoteName = m_sColumnToNoteName[ iColumnNumber ]; - const CString sGraphicSuffix = ElementToGraphicSuffix( se ); - - CStringArray arrayPossibleElementFileNames; // fill this with the possible files - - GetDirListing( ssprintf("%s%s %s*.sprite", sDir, sNoteName, sGraphicSuffix), arrayPossibleElementFileNames ); - GetDirListing( ssprintf("%s%s %s*.png", sDir, sNoteName, sGraphicSuffix), arrayPossibleElementFileNames ); - GetDirListing( ssprintf("%s%s %s*.jpg", sDir, sNoteName, sGraphicSuffix), arrayPossibleElementFileNames ); - GetDirListing( ssprintf("%s%s %s*.bmp", sDir, sNoteName, sGraphicSuffix), arrayPossibleElementFileNames ); - - if( arrayPossibleElementFileNames.GetSize() > 0 ) - return sDir + arrayPossibleElementFileNames[0]; - - HELPER.FatalError( "The style graphic '%s' if missing from '%s'.", sNoteName+" "+sGraphicSuffix, sDir ); - return ""; -} \ No newline at end of file diff --git a/stepmania/src/StyleDef.h b/stepmania/src/StyleDef.h index 60ee08a95b..0ca700e6ea 100644 --- a/stepmania/src/StyleDef.h +++ b/stepmania/src/StyleDef.h @@ -1,57 +1,83 @@ +#pragma once /* ----------------------------------------------------------------------------- - File: StyleDef.h + Class: StyleDef - Desc: A data structure that holds the definition of a GameMode. + Desc: A data structure that holds the definition for one of a Game's styles. + Styles define a set of columns for each player, and information about those + columns, like what Instruments are used play those columns and what track + to use to populate the column's notes. + A "track" is the term used to descibe a particular note in NoteData space. + A "column" is the term used to describe a particular note in Style space. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ -#ifndef _Style_H_ -#define _Style_H_ - -#include "Pattern.h" +#include "NoteMetadata.h" +#include "NoteData.h" +#include "StyleInput.h" +#include "GameInput.h" -const int MAX_NUM_COLUMNS = 12; +typedef TrackNumber NoteColumn; +const int MAX_NOTE_COLUMNS = MAX_NOTE_TRACKS; -enum StyleElement { - GRAPHIC_NOTE_COLOR_PART, - GRAPHIC_NOTE_GRAY_PART, - GRAPHIC_RECEPTOR, - GRAPHIC_TAP_EXPLOSION_BRIGHT, - GRAPHIC_TAP_EXPLOSION_DIM, - GRAPHIC_HOLD_EXPLOSION, - - NUM_STYLE_ELEMENTS // leave this at the end -}; struct StyleDef { public: - int m_iNumPlayers; - int m_iNumColumns; // will vary depending on the number panels (4,6,8,etc) - CString m_sColumnToNoteName[MAX_NUM_COLUMNS]; // e.g. "left", "right", "middle C", "snare" - TapNote m_ColumnToTapNote[MAX_NUM_COLUMNS]; // which TapNote does this column correspond to? - CString GetPathToGraphic( const int iColumnNumber, const StyleElement se ); + LPCTSTR m_szName; // name of the style. e.g. "single", "double" + LPCTSTR m_szReads; // name of the style that we can read. For example, the style named "versus" reads the NoteData with the tag "single" - inline int TapNoteToColumnNumber( TapNote tap_step ) + int m_iNumPlayers; // either 1 or 2 + int m_iNumTracks; // number of total tracks this style expects (e.g. 4 for versus, but 8 for double) + + inline int GetColsPerPlayer() { return m_iNumTracks/m_iNumPlayers; }; + + struct GameInputAndTrack { TrackNumber track; InstrumentNumber number; InstrumentButton button; }; + + GameInputAndTrack m_StyleInputToGameInputAndTrack[NUM_PLAYERS][MAX_NOTE_COLUMNS]; // maps each players' column to a track in the NoteData + + + inline GameInput StyleInputToGameInput( const StyleInput StyleI ) { - for (int i=0; iGetTitle(); + CString sTitle = pSong->GetFullTitle(); CString sSubTitle; m_textTitle.SetText( sTitle ); @@ -90,9 +90,9 @@ bool TextBanner::LoadFromSong( Song* pSong ) if( sSubTitle == "" ) { - m_textTitle.SetY( -7 ); + m_textTitle.SetY( -6 ); m_textSubTitle.SetY( 0 ); - m_textArtist.SetY( 10 ); + m_textArtist.SetY( 9 ); } else { diff --git a/stepmania/src/TextBanner.h b/stepmania/src/TextBanner.h index 3aef40748f..387ba764a6 100644 --- a/stepmania/src/TextBanner.h +++ b/stepmania/src/TextBanner.h @@ -4,7 +4,7 @@ Desc: The song's TextBanner displayed in SelectSong. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -18,7 +18,7 @@ #include "RectangleActor.h" -const float TEXT_BANNER_WIDTH = 250; +const float TEXT_BANNER_WIDTH = 180; const float TEXT_BANNER_HEIGHT = 40; diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 382d479f0a..77d2c0d6a7 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -5,14 +5,14 @@ Desc: See header. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ #include "ThemeManager.h" #include "RageHelper.h" - +#include "ErrorCatcher/ErrorCatcher.h" ThemeManager* THEME = NULL; // global object accessable from anywhere in the program @@ -51,7 +51,7 @@ bool ThemeManager::SetTheme( CString sThemeName ) // return false if theme does if( !DoesFileExist( sThemeDir ) ) { - HELPER.FatalError( ssprintf( "The theme in diretory '%' could not be loaded.", sThemeDir ) ); + FatalError( ssprintf( "The theme in diretory '%' could not be loaded.", sThemeDir ) ); return false; } @@ -63,7 +63,7 @@ void ThemeManager::AssertThemeIsComplete( CString sThemeName ) // return false for( int i=0; i 0 ) @@ -281,7 +300,7 @@ CString ThemeManager::GetPathTo( ThemeElement te, CString sThemeName ) } else { - HELPER.FatalError( ssprintf("Unknown theme asset dir '%s'.", sAssetDir) ); + FatalError( ssprintf("Unknown theme asset dir '%s'.", sAssetDir) ); } if( arrayPossibleElementFileNames.GetSize() > 0 ) @@ -289,6 +308,6 @@ CString ThemeManager::GetPathTo( ThemeElement te, CString sThemeName ) - HELPER.FatalError( ssprintf("The theme element '%s' does not exist in the current theme directory or the default theme directory.", sAssetDir + "\\" + sAssetFileName) ); + FatalError( ssprintf("The theme element '%s' does not exist in the current theme directory or the default theme directory.", sAssetDir + "\\" + sAssetFileName) ); return ""; } diff --git a/stepmania/src/ThemeManager.h b/stepmania/src/ThemeManager.h index 1e9dc3b315..9e5c5572b0 100644 --- a/stepmania/src/ThemeManager.h +++ b/stepmania/src/ThemeManager.h @@ -5,7 +5,7 @@ Desc: Manages which graphics and sounds are chosed to load. Every time a sound or graphic is loaded, it gets the path from the ThemeManager. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -37,6 +37,7 @@ enum ThemeElement { GRAPHIC_FAILED, GRAPHIC_FALLBACK_BACKGROUND, GRAPHIC_FALLBACK_BANNER, + GRAPHIC_FALLBACK_CD_TITLE, GRAPHIC_GAME_OPTIONS_BACKGROUND, GRAPHIC_GAME_OPTIONS_TOP_EDGE, GRAPHIC_GRADES, @@ -48,7 +49,8 @@ enum ThemeElement { GRAPHIC_LIFEMETER_FRAME, GRAPHIC_LIFEMETER_PILLS, GRAPHIC_MENU_BOTTOM_EDGE, - GRAPHIC_MUSIC_SELECTION_HIGHLIGHT, + GRAPHIC_SELECT_MUSIC_SONG_HIGHLIGHT, + GRAPHIC_SELECT_MUSIC_SONG_BAR, GRAPHIC_MUSIC_SORT_ICONS, GRAPHIC_MUSIC_STATUS_ICONS, GRAPHIC_OPENING_STAR, @@ -61,8 +63,9 @@ enum ThemeElement { GRAPHIC_RESULT_BACKGROUND, GRAPHIC_RESULT_TOP_EDGE, GRAPHIC_SCORE_FRAME, - GRAPHIC_SECTION_BACKGROUND, - GRAPHIC_SELECT_DIFFICULTY_ARROW, + GRAPHIC_SELECT_MUSIC_SECTION_BAR, + GRAPHIC_SELECT_DIFFICULTY_ARROW_P1, + GRAPHIC_SELECT_DIFFICULTY_ARROW_P2, GRAPHIC_SELECT_DIFFICULTY_BACKGROUND, GRAPHIC_SELECT_DIFFICULTY_EASY_HEADER, GRAPHIC_SELECT_DIFFICULTY_EASY_PICTURE, @@ -75,7 +78,8 @@ enum ThemeElement { GRAPHIC_SELECT_DIFFICULTY_TOP_EDGE, GRAPHIC_SELECT_MUSIC_BACKGROUND, GRAPHIC_SELECT_MUSIC_INFO_FRAME, - GRAPHIC_SELECT_MUSIC_RADAR, + GRAPHIC_SELECT_MUSIC_RADAR_BASE, + GRAPHIC_SELECT_MUSIC_RADAR_WORDS, GRAPHIC_SELECT_MUSIC_SCORE_FRAME, GRAPHIC_SELECT_MUSIC_TOP_EDGE, GRAPHIC_SELECT_STYLE_BACKGROUND, @@ -84,6 +88,19 @@ enum ThemeElement { GRAPHIC_SONG_OPTIONS_TOP_EDGE, GRAPHIC_STEPS_DESCRIPTION, GRAPHIC_STYLE_ICONS, + GRAPHIC_SELECT_GROUP_EXPLANATION, + GRAPHIC_SELECT_GROUP_INFO_FRAME, + GRAPHIC_SELECT_GROUP_BUTTON, + GRAPHIC_SELECT_GROUP_CONTENTS_HEADER, + GRAPHIC_ENDING_BACKGROUND, + GRAPHIC_SELECT_MUSIC_OPTION_ICONS, + GRAPHIC_SELECT_MUSIC_DIFFICULTY_FRAME, + GRAPHIC_SELECT_MUSIC_METER_FRAME, + GRAPHIC_DANCING_DIFFICULTY_FRAME, + GRAPHIC_DANCING_BOTTOM_FRAME, + GRAPHIC_DANCING_TOP_FRAME, + GRAPHIC_DIFFICULTY_ICONS, + GRAPHIC_ALL_MUSIC_BANNER, SOUND_FAILED, SOUND_ASSIST, @@ -96,11 +113,12 @@ enum ThemeElement { SOUND_TITLE_CHANGE, SOUND_MENU_SWOOSH, SOUND_MENU_BACK, - SOUND_TRAINING_MUSIC, SOUND_INVALID, SOUND_EDIT_CHANGE_LINE, SOUND_EDIT_CHANGE_SNAP, SOUND_SELECT_DIFFICULTY_CHANGE, + SOUND_ENDING_MUSIC, + SOUND_MENU_MUSIC, FONT_BOLD, FONT_COMBO_NUMBERS, @@ -108,6 +126,7 @@ enum ThemeElement { FONT_NORMAL, FONT_SCORE_NUMBERS, FONT_TEXT_BANNER, + FONT_BIG_MESSAGE, ANNOUNCER_ATTRACT, ANNOUNCER_BAD_COMMENT, diff --git a/stepmania/src/TipDisplay.cpp b/stepmania/src/TipDisplay.cpp index 68e25cad94..be23880308 100644 --- a/stepmania/src/TipDisplay.cpp +++ b/stepmania/src/TipDisplay.cpp @@ -5,7 +5,7 @@ Desc: A graphic displayed in the TipDisplay during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TipDisplay.h b/stepmania/src/TipDisplay.h index bb36dec04d..9fe67fdd06 100644 --- a/stepmania/src/TipDisplay.h +++ b/stepmania/src/TipDisplay.h @@ -4,7 +4,7 @@ Desc: A graphic displayed in the TipDisplay during Dancing. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/Transition.cpp b/stepmania/src/Transition.cpp index a59094bb39..abd7ff8bd6 100644 --- a/stepmania/src/Transition.cpp +++ b/stepmania/src/Transition.cpp @@ -5,7 +5,7 @@ Desc: Abstract base class for all transitions. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/Transition.h b/stepmania/src/Transition.h index 67c103b4b8..24214ad5d2 100644 --- a/stepmania/src/Transition.h +++ b/stepmania/src/Transition.h @@ -4,7 +4,7 @@ Desc: Abstract base class for all transitions. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TransitionFade.cpp b/stepmania/src/TransitionFade.cpp index 13bb8e1df1..17b58af4b0 100644 --- a/stepmania/src/TransitionFade.cpp +++ b/stepmania/src/TransitionFade.cpp @@ -5,7 +5,7 @@ Desc: Fades out or in. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TransitionFade.h b/stepmania/src/TransitionFade.h index ace6fb1e36..9e7a70b4a2 100644 --- a/stepmania/src/TransitionFade.h +++ b/stepmania/src/TransitionFade.h @@ -4,7 +4,7 @@ Desc: Fades out or in. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TransitionFadeWipe.cpp b/stepmania/src/TransitionFadeWipe.cpp index 3ed99981d0..b0d42813c7 100644 --- a/stepmania/src/TransitionFadeWipe.cpp +++ b/stepmania/src/TransitionFadeWipe.cpp @@ -5,7 +5,7 @@ Desc: Black bands (horizontal window blinds) gradually close. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TransitionFadeWipe.h b/stepmania/src/TransitionFadeWipe.h index bc37cb19ca..662e837b87 100644 --- a/stepmania/src/TransitionFadeWipe.h +++ b/stepmania/src/TransitionFadeWipe.h @@ -4,7 +4,7 @@ Desc: Fades out or in. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TransitionInvisible.cpp b/stepmania/src/TransitionInvisible.cpp index 21849bfa12..0d00e4a103 100644 --- a/stepmania/src/TransitionInvisible.cpp +++ b/stepmania/src/TransitionInvisible.cpp @@ -5,7 +5,7 @@ Desc: Fades out or in. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TransitionInvisible.h b/stepmania/src/TransitionInvisible.h index 18c9815c87..6f4eeb4b95 100644 --- a/stepmania/src/TransitionInvisible.h +++ b/stepmania/src/TransitionInvisible.h @@ -4,7 +4,7 @@ Desc: Fades out or in. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TransitionKeepAlive.cpp b/stepmania/src/TransitionKeepAlive.cpp index 8b87e7a92e..31aa6366a7 100644 --- a/stepmania/src/TransitionKeepAlive.cpp +++ b/stepmania/src/TransitionKeepAlive.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TransitionKeepAlive.h b/stepmania/src/TransitionKeepAlive.h index 327f3e3eed..10c96e129d 100644 --- a/stepmania/src/TransitionKeepAlive.h +++ b/stepmania/src/TransitionKeepAlive.h @@ -4,7 +4,7 @@ Desc: The transition between menu screens. "Let's Move On" - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TransitionRectWipe.cpp b/stepmania/src/TransitionRectWipe.cpp index a5d79140c5..11edee09a7 100644 --- a/stepmania/src/TransitionRectWipe.cpp +++ b/stepmania/src/TransitionRectWipe.cpp @@ -5,7 +5,7 @@ Desc: Black bands (horizontal window blinds) gradually close. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TransitionRectWipe.h b/stepmania/src/TransitionRectWipe.h index 40793aa7e2..18c01d06d8 100644 --- a/stepmania/src/TransitionRectWipe.h +++ b/stepmania/src/TransitionRectWipe.h @@ -4,7 +4,7 @@ Desc: Black bands (horizontal window blinds) gradually close. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TransitionStarWipe.cpp b/stepmania/src/TransitionStarWipe.cpp index 0d097787c9..e6024c5aed 100644 --- a/stepmania/src/TransitionStarWipe.cpp +++ b/stepmania/src/TransitionStarWipe.cpp @@ -5,7 +5,7 @@ Desc: Shooting start across the screen leave a black trail. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TransitionStarWipe.h b/stepmania/src/TransitionStarWipe.h index d685ff1aaf..d28db732af 100644 --- a/stepmania/src/TransitionStarWipe.h +++ b/stepmania/src/TransitionStarWipe.h @@ -4,7 +4,7 @@ Desc: Shooting start across the screen leave a black trail. - Copyright (c) 2001 Chris Danford. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/resource.h b/stepmania/src/resource.h index 4a0d301f28..44643f00c1 100644 --- a/stepmania/src/resource.h +++ b/stepmania/src/resource.h @@ -1,5 +1,5 @@ //{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. +// Microsoft Visual C++ generated include file. // Used by StepMania.RC // #define IDD_ERROR_DIALOG 111 @@ -11,6 +11,7 @@ #define IDC_BUTTON_REPORT 1002 #define IDM_CHANGERESOLUTION 1003 #define IDC_BUTTON_VIEW_LOG 1003 +#define IDM_CHANGEDETAIL 1003 #define IDM_CHANGEDISPLAYCOLOR 1004 #define IDM_CHANGETEXTURECOLOR 1005 #define IDC_EDIT_ERROR 1005 diff --git a/stepmania/src/song.h b/stepmania/src/song.h index e8f2838e02..bdf7ac4dcf 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -1,3 +1,4 @@ +#pragma once /* ----------------------------------------------------------------------------- Class: Song @@ -5,16 +6,13 @@ Desc: Holds data about a piece of music that can be played by one or more Games. - Copyright (c) 2001-2002 by the names listed below. All rights reserved. + Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ -#ifndef _SONG_H_ -#define _SONG_H_ - -#include "Pattern.h" +#include "NoteMetadata.h" #include "GameTypes.h" #include "RageUtil.h" @@ -43,34 +41,69 @@ public: Song(); bool LoadFromSongDir( CString sDir ); - bool LoadSongInfoFromDWIFile( CString sPath ); - bool LoadSongInfoFromBMSDir( CString sDir ); + bool LoadFromDWIFile( CString sPath ); + bool LoadFromBMSDir( CString sDir ); + bool LoadFromSMDir( CString sDir ); - void SaveOffsetChangeToDisk(); + void Save(); private: - void TidyUpData(); + void TidyUpData(); // call after loading to clean up invalid data public: CString GetSongFilePath() {return m_sSongFilePath; }; CString GetSongFileDir() {return m_sSongDir; }; CString GetGroupName() {return m_sGroupName; }; CString GetMusicPath() {return m_sMusicPath; }; + void GetMusicSampleRange( float &fStartBeatOut, float &fEndBeatOut ) { fStartBeatOut = m_fMusicSampleStartBeat; fEndBeatOut = m_fMusicSampleEndBeat; }; CString GetBannerPath() {return m_sBannerPath; }; CString GetBackgroundPath() {return m_sBackgroundPath; }; CString GetBackgroundMoviePath(){return m_sBackgroundMoviePath; }; + CString GetCDTitlePath() {return m_sCDTitlePath; }; bool HasMusic() {return m_sMusicPath != "" && DoesFileExist(GetMusicPath()); }; bool HasBanner() {return m_sBannerPath != "" && DoesFileExist(GetBannerPath()); }; bool HasBackground() {return m_sBackgroundPath != "" && DoesFileExist(GetBackgroundPath()); }; bool HasBackgroundMovie() {return m_sBackgroundMoviePath != ""&& DoesFileExist(GetBackgroundMoviePath()); }; + bool HasCDTitle() {return m_sCDTitlePath != "" && DoesFileExist(GetCDTitlePath()); }; - CString GetTitle() {return m_sTitle; }; + CString GetFullTitle() {return m_sTitle; }; + void GetMainTitleAndSubTitle( CString &sMainTitleOut, CString &sSubTitleOut ) + { + char szSeps[] = { '-', '~' }; + for( int i=0; i& arrayAddTo ); - void GetNumFeet( DanceStyle s, int& iDiffEasy, int& iDiffMedium, int& iDiffHard ); + float GetElapsedTimeFromBeat( float fBeat ); + void GetNoteMetadatasThatMatchGameAndStyle( CString sGame, CString sStyle, CArray& arrayAddTo ); int GetNumTimesPlayed() { int iTotalNumTimesPlayed = 0; - for( int i=0; i m_BPMSegments; // this must be sorted before dancing CArray m_FreezeSegments; // this must be sorted before dancing public: - CArray m_arrayPatterns; + CArray m_arrayNoteMetadatas; }; @@ -132,5 +171,3 @@ void SortSongPointerArrayByGroup( CArray &arraySongPointers ); void SortSongPointerArrayByMostPlayed( CArray &arraySongPointers ); - -#endif \ No newline at end of file