From 2f80235590ce399f59f40c436da28a435d89c2a8 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 19 May 2002 01:59:48 +0000 Subject: [PATCH] no message --- stepmania/src/Actor.cpp | 25 +- stepmania/src/Actor.h | 25 +- stepmania/src/ActorFrame.cpp | 4 +- stepmania/src/ActorFrame.h | 4 +- stepmania/src/ArrowEffects.cpp | 6 +- stepmania/src/ArrowEffects.h | 2 +- stepmania/src/BPMDisplay.cpp | 6 +- stepmania/src/BPMDisplay.h | 6 +- stepmania/src/Background.cpp | 16 +- stepmania/src/Background.h | 4 +- stepmania/src/Banner.cpp | 73 +++- stepmania/src/Banner.h | 21 +- stepmania/src/BannerWithFrame.cpp | 2 +- stepmania/src/BannerWithFrame.h | 2 +- stepmania/src/BitmapText.cpp | 214 ++++------ stepmania/src/BitmapText.h | 15 +- stepmania/src/Combo.cpp | 16 +- stepmania/src/Combo.h | 2 +- stepmania/src/CroppedSprite.cpp | 2 +- stepmania/src/CroppedSprite.h | 6 +- stepmania/src/DifficultyIcon.cpp | 2 +- stepmania/src/DifficultyIcon.h | 10 +- stepmania/src/FocusingSprite.cpp | 6 +- stepmania/src/FocusingSprite.h | 4 +- stepmania/src/Font.cpp | 6 +- stepmania/src/Font.h | 2 +- stepmania/src/FontManager.cpp | 2 +- stepmania/src/FontManager.h | 2 +- stepmania/src/FootMeter.cpp | 54 ++- stepmania/src/FootMeter.h | 58 +-- stepmania/src/GameConstantsAndTypes.h | 22 +- stepmania/src/GameDef.cpp | 28 +- stepmania/src/GameDef.h | 5 +- stepmania/src/GameInput.h | 2 +- stepmania/src/GameManager.cpp | 11 +- stepmania/src/GameManager.h | 3 +- stepmania/src/GhostArrow.cpp | 6 +- stepmania/src/GhostArrow.h | 2 +- stepmania/src/GhostArrowBright.cpp | 2 +- stepmania/src/GhostArrowBright.h | 2 +- stepmania/src/GhostArrowRow.cpp | 4 +- stepmania/src/GhostArrowRow.h | 4 +- stepmania/src/Grade.cpp | 2 +- stepmania/src/Grade.h | 2 +- stepmania/src/GradeDisplay.cpp | 20 +- stepmania/src/GradeDisplay.h | 5 +- stepmania/src/GrayArrow.cpp | 2 +- stepmania/src/GrayArrow.h | 4 +- stepmania/src/GrayArrowRow.cpp | 4 +- stepmania/src/GrayArrowRow.h | 4 +- stepmania/src/GrooveRadar.cpp | 75 +++- stepmania/src/GrooveRadar.h | 37 +- stepmania/src/HoldGhostArrow.h | 2 +- stepmania/src/HoldJudgement.cpp | 8 +- stepmania/src/HoldJudgement.h | 4 +- stepmania/src/IniFile.cpp | 2 +- stepmania/src/IniFile.h | 2 +- stepmania/src/InputFilter.cpp | 18 +- stepmania/src/InputFilter.h | 4 +- stepmania/src/InputMapper.cpp | 8 +- stepmania/src/InputMapper.h | 4 +- stepmania/src/Judgement.cpp | 44 +- stepmania/src/Judgement.h | 4 +- stepmania/src/LifeMeterBar.cpp | 24 +- stepmania/src/LifeMeterBar.h | 21 +- stepmania/src/MenuElements.cpp | 19 +- stepmania/src/MenuElements.h | 12 +- stepmania/src/MenuInput.h | 4 +- stepmania/src/MotionBlurSprite.cpp | 2 +- stepmania/src/MotionBlurSprite.h | 4 +- stepmania/src/MusicSortDisplay.cpp | 2 +- stepmania/src/MusicSortDisplay.h | 2 +- stepmania/src/MusicStatusDisplay.cpp | 2 +- stepmania/src/MusicStatusDisplay.h | 6 +- stepmania/src/MusicWheel.cpp | 218 ++++++---- stepmania/src/MusicWheel.h | 44 +- stepmania/src/NoteData.cpp | 188 ++++++-- stepmania/src/NoteData.h | 58 +-- stepmania/src/NoteField.cpp | 29 +- stepmania/src/NoteField.h | 12 +- stepmania/src/Player.cpp | 120 ++++-- stepmania/src/Player.h | 13 +- stepmania/src/PrefsManager.cpp | 29 +- stepmania/src/PrefsManager.h | 17 +- stepmania/src/RageBitmapTexture.cpp | 96 +++-- stepmania/src/RageBitmapTexture.h | 56 ++- stepmania/src/RageInput.cpp | 6 +- stepmania/src/RageInput.h | 14 +- stepmania/src/RageLog.cpp | 2 +- stepmania/src/RageLog.h | 2 +- stepmania/src/RageMovieTexture.cpp | 24 +- stepmania/src/RageMovieTexture.h | 26 +- stepmania/src/RageSound.cpp | 18 +- stepmania/src/RageSound.h | 5 +- stepmania/src/RageTexture.cpp | 13 +- stepmania/src/RageTexture.h | 29 +- stepmania/src/RageTextureManager.cpp | 23 +- stepmania/src/RageTextureManager.h | 27 +- stepmania/src/RageUtil.cpp | 62 ++- stepmania/src/RageUtil.h | 15 +- stepmania/src/RandomSample.cpp | 3 +- stepmania/src/RandomSample.h | 2 +- stepmania/src/ScoreDisplayRolling.cpp | 8 +- stepmania/src/ScoreDisplayRolling.h | 13 +- stepmania/src/ScrollBar.cpp | 2 +- stepmania/src/ScrollBar.h | 2 +- stepmania/src/Song.cpp | 400 ++++++++++-------- stepmania/src/SongManager.cpp | 58 +-- stepmania/src/SongManager.h | 17 +- stepmania/src/Sprite.cpp | 38 +- stepmania/src/Sprite.h | 23 +- stepmania/src/StdAfx.cpp | 2 +- stepmania/src/StdAfx.h | 8 +- stepmania/src/StepMania.cpp | 165 ++++---- stepmania/src/StepMania.dsp | 588 ++++++++++++++------------ stepmania/src/StepMania.h | 10 +- stepmania/src/StepMania.vcproj | 314 ++++++++------ stepmania/src/StyleDef.cpp | 2 +- stepmania/src/StyleDef.h | 4 +- stepmania/src/StyleInput.h | 2 +- stepmania/src/TextBanner.cpp | 2 +- stepmania/src/TextBanner.h | 4 +- stepmania/src/ThemeManager.cpp | 423 +++++++----------- stepmania/src/ThemeManager.h | 133 +++--- stepmania/src/TipDisplay.cpp | 2 +- stepmania/src/TipDisplay.h | 2 +- stepmania/src/Transition.cpp | 12 +- stepmania/src/Transition.h | 18 +- stepmania/src/TransitionFade.cpp | 4 +- stepmania/src/TransitionFade.h | 10 +- stepmania/src/TransitionFadeWipe.cpp | 4 +- stepmania/src/TransitionFadeWipe.h | 10 +- stepmania/src/TransitionInvisible.cpp | 4 +- stepmania/src/TransitionInvisible.h | 8 +- stepmania/src/TransitionKeepAlive.cpp | 12 +- stepmania/src/TransitionKeepAlive.h | 14 +- stepmania/src/TransitionRectWipe.cpp | 6 +- stepmania/src/TransitionRectWipe.h | 6 +- stepmania/src/TransitionStarWipe.cpp | 20 +- stepmania/src/TransitionStarWipe.h | 18 +- stepmania/src/song.h | 38 +- 141 files changed, 2540 insertions(+), 2058 deletions(-) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index ef177bf6e3..9fe74eb455 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -1,17 +1,18 @@ #include "stdafx.h" // testing updates /* ----------------------------------------------------------------------------- - File: Actor.h + Class: Actor - Desc: Base class for all objects that appear on the screen. + Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ #include "Actor.h" #include -#include "RageScreen.h" +#include "RageDisplay.h" #include "PrefsManager.h" @@ -45,9 +46,9 @@ Actor::Actor() } -void Actor::Draw() // set the world matrix and calculate actor properties, the call RenderPrimitives +void Actor::Draw() // set the world matrix and calculate actor properties, the call DrawPrimitives { - SCREEN->PushMatrix(); // we're actually going to do some drawing in this function + DISPLAY->PushMatrix(); // we're actually going to do some drawing in this function int i; @@ -112,8 +113,8 @@ void Actor::Draw() // set the world matrix and calculate actor properties, the - SCREEN->Translate( m_temp_pos.x, m_temp_pos.y, m_temp_pos.z ); // offset so that pixels are aligned to texels - SCREEN->Scale( m_temp_scale.x, m_temp_scale.y, 1 ); + DISPLAY->Translate( m_temp_pos.x, m_temp_pos.y, m_temp_pos.z ); // offset so that pixels are aligned to texels + DISPLAY->Scale( m_temp_scale.x, m_temp_scale.y, 1 ); // super slow! // D3DXMatrixRotationYawPitchRoll( &matTemp, rotation.y, rotation.x, rotation.z ); // add in the rotation @@ -122,19 +123,19 @@ void Actor::Draw() // set the world matrix and calculate actor properties, the // replace with... if( m_temp_rotation.z != 0 ) { - SCREEN->RotateZ( m_temp_rotation.z ); + DISPLAY->RotateZ( m_temp_rotation.z ); } if( m_temp_rotation.y != 0 ) { - SCREEN->RotateY( m_temp_rotation.y ); + DISPLAY->RotateY( m_temp_rotation.y ); } - this->RenderPrimitives(); // call the most-derived version of RenderPrimitives(); + this->DrawPrimitives(); // call the most-derived version of DrawPrimitives(); - SCREEN->PopMatrix(); + DISPLAY->PopMatrix(); } diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 5e2b03aadb..85183da5bf 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -1,29 +1,20 @@ +#pragma once /* ----------------------------------------------------------------------------- - File: Actor.h + Class: Actor Desc: Base class for all objects that appear on the screen. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ - -#ifndef _Actor_H_ -#define _Actor_H_ - -#include "RageUtil.h" - #include - - class Actor { -protected: - - public: Actor(); @@ -48,8 +39,8 @@ public: virtual void Restore() {}; virtual void Invalidate() {}; - virtual void Draw(); - virtual void RenderPrimitives() = 0; + virtual void Draw(); // set up the world matrix, then calls DrawPrimitives() + virtual void DrawPrimitives() = 0; virtual void Update( float fDeltaTime ); virtual float GetX() { return m_pos.x; }; @@ -280,7 +271,3 @@ protected: bool m_bBlendAdd; }; - - - -#endif \ No newline at end of file diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index a4bfcee65e..e5f7fde60b 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -5,14 +5,14 @@ Desc: Base class for all objects that appear on the screen. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ #include "ActorFrame.h" -void ActorFrame::RenderPrimitives() +void ActorFrame::DrawPrimitives() { // draw all sub-ActorFrames while we're in the ActorFrame's local coordinate space for( int i=0; iGetPathTo(FONT_BOLD) ); + m_textBPM.Load( THEME->GetPathTo(FONT_HEADER1) ); m_textBPM.TurnShadowOff(); m_textBPM.SetXY( CENTER_X, SCREEN_HEIGHT - 50 ); //m_textBPM.SetSequence( ssprintf("999") ); @@ -35,7 +35,7 @@ BPMDisplay::BPMDisplay() m_textBPM.SetDiffuseColorTopEdge( D3DXCOLOR(1,1,0,1) ); // yellow m_textBPM.SetDiffuseColorBottomEdge( D3DXCOLOR(1,0.5f,0,1) ); // orange - m_textLabel.Load( THEME->GetPathTo(FONT_BOLD) ); + m_textLabel.Load( THEME->GetPathTo(FONT_HEADER1) ); m_textLabel.TurnShadowOff(); m_textLabel.SetXY( 34, 2 ); m_textLabel.SetText( "BPM" ); diff --git a/stepmania/src/BPMDisplay.h b/stepmania/src/BPMDisplay.h index 8fc0e9b258..29c8391c88 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "Song.h" #include "ActorFrame.h" #include "BitmapText.h" -#include "RectangleActor.h" +#include "Quad.h" class BPMDisplay : public ActorFrame @@ -30,7 +30,7 @@ public: protected: BitmapText m_textBPM; BitmapText m_textLabel; - RectangleActor m_rectFrame; + Quad m_rectFrame; float m_fCurrentBPM; float m_fLowBPM, m_fHighBPM; diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 9755fd4789..cc3b270ad0 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -5,7 +5,7 @@ Desc: Background behind arrows while dancing - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -26,10 +26,10 @@ Background::Background() m_sprDanger.SetZoom( 2 ); m_sprDanger.SetEffectWagging(); - m_sprDanger.Load( THEME->GetPathTo(GRAPHIC_DANGER_TEXT) ); + m_sprDanger.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_DANGER_TEXT) ); m_sprDanger.SetXY( CENTER_X, CENTER_Y ); - m_sprDangerBackground.Load( THEME->GetPathTo(GRAPHIC_DANGER_BACKGROUND) ); + m_sprDangerBackground.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_DANGER_BACKGROUND) ); m_sprDangerBackground.StretchTo( CRect((int)SCREEN_LEFT, (int)SCREEN_TOP, (int)SCREEN_RIGHT, (int)SCREEN_BOTTOM) ); } @@ -38,7 +38,7 @@ bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations ) if( pSong->HasBackgroundMovie() ) { // load the movie backgound, and don't load a visualization - m_sprSongBackground.Load( pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND) ); + m_sprSongBackground.Load( pSong->GetBackgroundMoviePath() ); m_sprSongBackground.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) ); m_sprSongBackground.SetZoomY( -1 ); m_sprSongBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) ); @@ -47,8 +47,8 @@ bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations ) else { // load the static background (if available), and a visualization - if( pSong->HasBackground() ) m_sprSongBackground.Load( pSong->GetBackgroundPath(), TEXTURE_HINT_DITHER ); - else m_sprSongBackground.Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND), TEXTURE_HINT_DITHER ); + if( pSong->HasBackground() ) m_sprSongBackground.Load( pSong->GetBackgroundPath(), false, 2, 0, true ); + else m_sprSongBackground.Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND), false, 2, 0, true ); m_sprSongBackground.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) ); m_sprSongBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) ); @@ -91,9 +91,9 @@ void Background::Update( float fDeltaTime ) m_sprDangerBackground.Update( fDeltaTime ); } -void Background::RenderPrimitives() +void Background::DrawPrimitives() { - ActorFrame::RenderPrimitives(); + ActorFrame::DrawPrimitives(); if( m_bShowDanger && (GetTickCount() % 1000) > 500 ) { diff --git a/stepmania/src/Background.h b/stepmania/src/Background.h index a5cb957634..184d61c20f 100644 --- a/stepmania/src/Background.h +++ b/stepmania/src/Background.h @@ -4,7 +4,7 @@ Desc: Background behind arrows while dancing - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -25,7 +25,7 @@ public: virtual bool LoadFromSong( Song *pSong, bool bDisableVisualizations = false ); virtual void Update( float fDeltaTime ); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); virtual void SetDiffuseColor( D3DXCOLOR c ) { diff --git a/stepmania/src/Banner.cpp b/stepmania/src/Banner.cpp index 4f6ca1cc49..c5fe1c4e5e 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -13,19 +13,82 @@ #include "Banner.h" #include "ThemeManager.h" +#include "SongManager.h" #include "RageBitmapTexture.h" +bool Banner::Load( CString sFilePath, bool bForceReload, int iMipMaps, int iAlphaBits, bool bDither, bool bStretch ) +{ + // note that the defaults are changes for faster loading + return CroppedSprite::Load( sFilePath, bForceReload, iMipMaps, iAlphaBits, bDither, bStretch ); +}; + +void Banner::Update( float fDeltaTime ) +{ + CroppedSprite::Update( fDeltaTime ); + + if( m_bScrolling ) + { + m_fPercentScrolling += fDeltaTime/2; + m_fPercentScrolling -= (int)m_fPercentScrolling; + float fTexCoords[8] = + { + 0+m_fPercentScrolling, 1, // bottom left + 0+m_fPercentScrolling, 0, // top left + 1+m_fPercentScrolling, 1, // bottom right + 1+m_fPercentScrolling, 0, // top right + }; + Sprite::SetCustomTextureCoords( fTexCoords ); + } +} bool Banner::LoadFromSong( Song* pSong ) // NULL means no song { + TurnOffRoulette(); + Sprite::TurnShadowOff(); - if( pSong == NULL ) Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER), TEXTURE_HINT_NOMIPMAPS ); - else if( pSong->HasBanner() ) Banner::Load( pSong->GetBannerPath(), TEXTURE_HINT_NOMIPMAPS ); - else if( pSong->HasBackground() ) Banner::Load( pSong->GetBackgroundPath(), TEXTURE_HINT_NOMIPMAPS ); - else Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER), TEXTURE_HINT_NOMIPMAPS ); + if( pSong == NULL ) Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) ); + else if( pSong->HasBanner() ) Banner::Load( pSong->GetBannerPath() ); + else if( pSong->HasBackground() ) Banner::Load( pSong->GetBackgroundPath() ); + else Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) ); return true; } +bool Banner::LoadFromGroup( CString sGroupName ) +{ + TurnOffRoulette(); + + CString sGroupBannerPath = SONGMAN->GetGroupBannerPath( sGroupName ); + + if( sGroupBannerPath == "" ) + Banner::Load( sGroupBannerPath ); + else + Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) ); + + return true; +} + +bool Banner::LoadRoulette() +{ + Banner::Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_ROULETTE_BANNER), false, 0, 0, false, true ); + TurnOnRoulette(); + + return true; +} + +void Banner::TurnOnRoulette() +{ + m_bScrolling = true; + m_fPercentScrolling = 0; + + SetEffectGlowing( 1, D3DXCOLOR(1,0,0,0), D3DXCOLOR(1,0,0,0.5f) ); +} + +void Banner::TurnOffRoulette() +{ + m_bScrolling = false; + + SetEffectNone(); +} diff --git a/stepmania/src/Banner.h b/stepmania/src/Banner.h index 9ca4be791c..2e95fab551 100644 --- a/stepmania/src/Banner.h +++ b/stepmania/src/Banner.h @@ -5,7 +5,7 @@ Desc: The song's banner displayed in SelectSong. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -23,10 +23,27 @@ class Banner : public CroppedSprite public: Banner() { + m_bScrolling = false; + m_fPercentScrolling = 0; + m_fCropWidth = BANNER_WIDTH; m_fCropHeight = BANNER_HEIGHT; }; - bool LoadFromSong( Song* pSong ); // NULL means no song + virtual bool Load( CString sFilePath, bool bForceReload = false, int iMipMaps = 0, int iAlphaBits = 0, bool bDither = false, bool bStretch = false ); + virtual void Update( float fDeltaTime ); + + bool LoadFromSong( Song* pSong ); // NULL means no song + bool LoadFromGroup( CString sGroupName ); + bool LoadRoulette(); + + bool IsRouletteOn() { return m_bScrolling; }; + void TurnOnRoulette(); + void TurnOffRoulette(); + +protected: + + bool m_bScrolling; + float m_fPercentScrolling; }; diff --git a/stepmania/src/BannerWithFrame.cpp b/stepmania/src/BannerWithFrame.cpp index 9f79c8f23f..490fb71574 100644 --- a/stepmania/src/BannerWithFrame.cpp +++ b/stepmania/src/BannerWithFrame.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/BannerWithFrame.h b/stepmania/src/BannerWithFrame.h index 1b3dcf94f0..836aca6f35 100644 --- a/stepmania/src/BannerWithFrame.h +++ b/stepmania/src/BannerWithFrame.h @@ -5,7 +5,7 @@ Desc: bonus meters and max combo number. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index 552da7ec7e..e78ebb7c75 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -38,7 +38,6 @@ BitmapText::BitmapText() m_iNumLines = 0; m_iWidestLineWidth = 0; - m_iNumV = 0; for( int i=0; iWriteLine( "BitmapText::RebuildVertexBuffer()" ); - - + if( m_iNumLines == 0 ) + return; RageTexture* pTexture = m_pFont->m_pTexture; - - - - - - - // make the object in logical units centered at the origin - LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer(); - //LPDIRECT3DVERTEXBUFFER8 pVB = m_pVB; - - CUSTOMVERTEX* v; + LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer(); + RAGEVERTEX* v; pVB->Lock( 0, 0, (BYTE**)&v, 0 ); + int iNumV = 0; // the current vertex number - - m_iNumV = 0; // the current vertex number - const int iHeight = pTexture->GetSourceFrameHeight(); // height of a character const int iFrameWidth = pTexture->GetSourceFrameWidth(); // width of a character frame in logical units @@ -205,21 +191,21 @@ void BitmapText::RebuildVertexBuffer() const float fExtraPixels = fPercentExtra * pTexture->GetSourceFrameWidth(); // first triangle - v[m_iNumV++].p = D3DXVECTOR3( (float)iX, iY-iHeight/2.0f, 0 ); // top left - v[m_iNumV++].p = D3DXVECTOR3( (float)iX, iY+iHeight/2.0f, 0 ); // bottom left + v[iNumV++].p = D3DXVECTOR3( (float)iX, iY-iHeight/2.0f, 0 ); // top left + v[iNumV++].p = D3DXVECTOR3( (float)iX, iY+iHeight/2.0f, 0 ); // bottom left iX += iCharWidth; - v[m_iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY-iHeight/2.0f, 0 ); // top right + v[iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY-iHeight/2.0f, 0 ); // top right // 2nd triangle - v[m_iNumV++].p = v[m_iNumV-1].p; // top right - v[m_iNumV++].p = v[m_iNumV-3].p; // bottom left - v[m_iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY+iHeight/2.0f, 0 ); // bottom right + v[iNumV++].p = v[iNumV-1].p; // top right + v[iNumV++].p = v[iNumV-3].p; // bottom left + v[iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY+iHeight/2.0f, 0 ); // bottom right // // set texture coordinates // - m_iNumV -= 6; + iNumV -= 6; FRECT frectTexCoords = *pTexture->GetTextureCoordRect( iFrameNo ); @@ -232,146 +218,112 @@ void BitmapText::RebuildVertexBuffer() const float fExtraTexCoords = fPercentExtra * pTexture->GetTextureFrameWidth() / pTexture->GetTextureWidth(); - v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.top ); // top left - v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.bottom ); // bottom left - v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.top ); // top right - v[m_iNumV++].t = v[m_iNumV-1].t; // top right - v[m_iNumV++].t = v[m_iNumV-3].t; // bottom left - v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.bottom ); // bottom right + v[iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.top ); // top left + v[iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.bottom ); // bottom left + v[iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.top ); // top right + v[iNumV++].t = v[iNumV-1].t; // top right + v[iNumV++].t = v[iNumV-3].t; // bottom left + v[iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.bottom ); // bottom right } iY += iHeight; } + // + // set vertex colors for the diffuse pass + // + if( m_bRainbow ) + { + int color_index = (GetTickCount() / 200) % NUM_RAINBOW_COLORS; + for( int i=0; iUnlock(); -} - - -// draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale -void BitmapText::RenderPrimitives() -{ - if( m_iNumLines == 0 ) - return; - - RageTexture* pTexture = m_pFont->m_pTexture; - - - // fill the RageScreen's vertex buffer with what we're going to draw - RebuildVertexBuffer(); - - - LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer(); - //LPDIRECT3DVERTEXBUFFER8 pVB = m_pVB; - CUSTOMVERTEX* v; // Set the stage... - LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice(); + LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice(); pd3dDevice->SetTexture( 0, pTexture->GetD3DTexture() ); pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA ); pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA ); - pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX ); - pd3dDevice->SetStreamSource( 0, pVB, sizeof(CUSTOMVERTEX) ); + pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX ); + pd3dDevice->SetStreamSource( 0, pVB, sizeof(RAGEVERTEX) ); - if( m_temp_colorDiffuse[0].a != 0 ) + ////////////////////// + // render the shadow + ////////////////////// + if( m_bShadow && m_temp_colorDiffuse[0].a != 0 ) { - ////////////////////// - // render the shadow - ////////////////////// - if( m_bShadow ) - { - SCREEN->PushMatrix(); - SCREEN->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units + DISPLAY->PushMatrix(); + DISPLAY->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units - pVB->Lock( 0, 0, (BYTE**)&v, 0 ); + DWORD dwColor = D3DXCOLOR(0,0,0,0.5f*m_temp_colorDiffuse[0].a); // semi-transparent black + pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, dwColor ); - for( int i=0; iUnlock(); - - 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 ); - - pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 ); - - SCREEN->PopMatrix(); - } - - - ////////////////////// - // render the diffuse pass - ////////////////////// - pVB->Lock( 0, 0, (BYTE**)&v, 0 ); - - if( m_bRainbow ) - { - int color_index = (GetTickCount() / 200) % NUM_RAINBOW_COLORS; - for( int i=0; iUnlock(); - - - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TFACTOR ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 ); + pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, iNumV/3 ); + + DISPLAY->PopMatrix(); } + ////////////////////// + // render the diffuse pass + ////////////////////// + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); + + pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, iNumV/3 ); + + ////////////////////// // render the add pass ////////////////////// if( m_temp_colorAdd.a != 0 ) { - pVB->Lock( 0, 0, (BYTE**)&v, 0 ); + DWORD dwColor = m_temp_colorAdd; + pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, dwColor ); - for( int i=0; iUnlock(); - - 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_COLORARG1, D3DTA_TFACTOR ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); + pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 ); + pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, iNumV/3 ); } } \ No newline at end of file diff --git a/stepmania/src/BitmapText.h b/stepmania/src/BitmapText.h index 2c6291e1ac..83fb052c4f 100644 --- a/stepmania/src/BitmapText.h +++ b/stepmania/src/BitmapText.h @@ -1,17 +1,15 @@ +#pragma once /* ----------------------------------------------------------------------------- File: BitmapText Desc: An actor that holds a Font and draws text to the screen. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ -#ifndef _BITMAPTEXT_H_ -#define _BITMAPTEXT_H_ - #include "Sprite.h" #include "Font.h" @@ -34,8 +32,7 @@ public: int GetWidestLineWidthInSourcePixels() { return m_iWidestLineWidth; }; - void RebuildVertexBuffer(); // fill the RageScreen's vertex buffer with what we're going to draw - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); void TurnRainbowOn() { m_bRainbow = true; }; void TurnRainbowOff() { m_bRainbow = false; }; @@ -52,12 +49,6 @@ protected: int m_iLineWidths[MAX_TEXT_LINES]; // in source pixels int m_iWidestLineWidth; // in source pixels - // recalculate on RebuildVertexBuffer() -// LPDIRECT3DVERTEXBUFFER8 m_pVB; - int m_iNumV; // number of verticies we filled in the vertex buffer - bool m_bRainbow; }; - -#endif \ No newline at end of file diff --git a/stepmania/src/Combo.cpp b/stepmania/src/Combo.cpp index 8754cbec91..26a04bf958 100644 --- a/stepmania/src/Combo.cpp +++ b/stepmania/src/Combo.cpp @@ -5,28 +5,29 @@ Desc: A graphic displayed in the Combo during Dancing. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ #include "Combo.h" #include "ThemeManager.h" -const float COMBO_TWEEN_TIME = 0.5f; - Combo::Combo() { m_iCurCombo = 0; m_iMaxCombo = 0; - m_sprCombo.Load( THEME->GetPathTo(GRAPHIC_COMBO) ); + m_sprCombo.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_COMBO) ); + m_sprCombo.TurnShadowOn(); m_sprCombo.StopAnimating(); m_sprCombo.SetX( 40 ); m_sprCombo.SetZoom( 1.0f ); m_textComboNumber.Load( THEME->GetPathTo(FONT_COMBO_NUMBERS) ); - m_textComboNumber.SetX( -40 ); + m_textComboNumber.TurnShadowOn(); + m_textComboNumber.SetHorizAlign( Actor::align_right ); + m_textComboNumber.SetX( -20 ); m_textComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible @@ -60,8 +61,9 @@ void Combo::ContinueCombo() m_textComboNumber.SetZoom( fNewZoom ); m_textComboNumber.SetX( -40 - (fNewZoom-1)*30 ); - //m_textComboNumber.BeginTweening( COMBO_TWEEN_TIME ); - //m_textComboNumber.SetTweenZoom( 1 ); + //this->SetZoom( 1.2f ); + //this->BeginTweening( 0.3f ); + //this->SetTweenZoom( 1 ); } } diff --git a/stepmania/src/Combo.h b/stepmania/src/Combo.h index 3f54c5d090..db16dc9fcc 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/CroppedSprite.cpp b/stepmania/src/CroppedSprite.cpp index 24e7e052da..16141e201e 100644 --- a/stepmania/src/CroppedSprite.cpp +++ b/stepmania/src/CroppedSprite.cpp @@ -5,7 +5,7 @@ Desc: The song's CroppedSprite displayed in SelectSong. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/CroppedSprite.h b/stepmania/src/CroppedSprite.h index 0a3efe813d..696fe8c6b0 100644 --- a/stepmania/src/CroppedSprite.h +++ b/stepmania/src/CroppedSprite.h @@ -4,7 +4,7 @@ Desc: The song's CroppedSprite displayed in SelectSong. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -24,9 +24,9 @@ public: m_fCropWidth = m_fCropHeight = 100; }; - bool Load( CString sFilePath, DWORD dwHints = 0, bool bForceReload = false ) + bool Load( CString sFilePath, bool bForceReload = false, int iMipMaps = 4, int iAlphaBits = 4, bool bDither = false, bool bStretch = false ) { - Sprite::Load( sFilePath, dwHints, bForceReload ); + Sprite::Load( sFilePath, bForceReload, iMipMaps, iAlphaBits, bDither, bStretch ); CropToSize( m_fCropWidth, m_fCropHeight ); return true; diff --git a/stepmania/src/DifficultyIcon.cpp b/stepmania/src/DifficultyIcon.cpp index 2d580ef404..bbe96c65fa 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/DifficultyIcon.h b/stepmania/src/DifficultyIcon.h index 4a68a81398..f12bf16641 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -27,15 +27,15 @@ public: Load( THEME->GetPathTo(GRAPHIC_DIFFICULTY_ICONS) ); StopAnimating(); - SetFromNoteMetadata( NULL ); + SetFromNotes( NULL ); }; - void SetFromNoteMetadata( NoteMetadata* pNoteMetadata ) + void SetFromNotes( Notes* pNotes ) { - if( pNoteMetadata != NULL ) + if( pNotes != NULL ) { SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - SetFromDescription( pNoteMetadata->m_sDescription ); + SetFromDescription( pNotes->m_sDescription ); } else { diff --git a/stepmania/src/FocusingSprite.cpp b/stepmania/src/FocusingSprite.cpp index a8ece37288..8f3b292b55 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -60,7 +60,7 @@ void FocusingSprite::Update( float fDeltaTime ) } -void FocusingSprite::RenderPrimitives() +void FocusingSprite::DrawPrimitives() { if( m_BlurState != invisible ) { @@ -70,7 +70,7 @@ void FocusingSprite::RenderPrimitives() m_sprites[1].SetXY( -m_fPercentBlurred*BLUR_DISTANCE*2, -m_fPercentBlurred*BLUR_DISTANCE ); m_sprites[2].SetXY( 0, 0 ); - ActorFrame::RenderPrimitives(); + ActorFrame::DrawPrimitives(); } } diff --git a/stepmania/src/FocusingSprite.h b/stepmania/src/FocusingSprite.h index 3dba52af2f..46b94c32f9 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -30,7 +30,7 @@ public: }; virtual void Update( float fDeltaTime ); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); void StartFocusing(); void StartBlurring(); diff --git a/stepmania/src/Font.cpp b/stepmania/src/Font.cpp index de473ce0a7..b19e6a4ef3 100644 --- a/stepmania/src/Font.cpp +++ b/stepmania/src/Font.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -59,7 +59,7 @@ Font::Font( const CString &sFontFilePath ) m_sTexturePath.MakeLower(); - m_pTexture = TEXTURE->LoadTexture( m_sTexturePath, 0, false ); + m_pTexture = TEXTUREMAN->LoadTexture( m_sTexturePath ); assert( m_pTexture != NULL ); @@ -139,7 +139,7 @@ Font::Font( const CString &sFontFilePath ) Font::~Font() { if( m_pTexture != NULL ) - TEXTURE->UnloadTexture( m_sTexturePath ); + TEXTUREMAN->UnloadTexture( m_sTexturePath ); } diff --git a/stepmania/src/Font.h b/stepmania/src/Font.h index 6958b9fde1..8abf313fcc 100644 --- a/stepmania/src/Font.h +++ b/stepmania/src/Font.h @@ -4,7 +4,7 @@ Desc: A holder for information that is used by BitmapText objects. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/FontManager.cpp b/stepmania/src/FontManager.cpp index b1d7044a8e..0bf727cc73 100644 --- a/stepmania/src/FontManager.cpp +++ b/stepmania/src/FontManager.cpp @@ -5,7 +5,7 @@ Desc: Interface for loading and releasing textures. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/FontManager.h b/stepmania/src/FontManager.h index 8241290e56..afddea7596 100644 --- a/stepmania/src/FontManager.h +++ b/stepmania/src/FontManager.h @@ -4,7 +4,7 @@ Desc: Manages Loading and Unloading of fonts. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/FootMeter.cpp b/stepmania/src/FootMeter.cpp index e737e20502..b74362f701 100644 --- a/stepmania/src/FootMeter.cpp +++ b/stepmania/src/FootMeter.cpp @@ -5,7 +5,7 @@ Desc: A graphic displayed in the FootMeter during Dancing. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -16,3 +16,55 @@ +FootMeter::FootMeter() +{ + Load( THEME->GetPathTo(FONT_METER) ); + + SetNumFeet( 0, "" ); +} + +void FootMeter::SetFromNotes( Notes* pNotes ) +{ + if( pNotes != NULL ) + { + SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); + SetNumFeet( pNotes->m_iMeter, pNotes->m_sDescription ); + if( pNotes->m_iMeter >= 10 ) + this->SetEffectGlowing(); + else + this->SetEffectNone(); + + this->StopTweening(); + this->SetZoom( 1.1f ); + this->BeginTweening( 0.3f, TWEEN_BOUNCE_BEGIN ); + this->SetTweenZoom( 1 ); + } + else + { + SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); + SetNumFeet( 0, "" ); + } +} + +void FootMeter::SetNumFeet( int iNumFeet, const CString &sDescription ) +{ + CString sNewText; + for( int f=0; f<=8; f++ ) + sNewText += (fGetPathTo(FONT_FEET) ); + FootMeter(); - SetNumFeet( 0, "" ); - }; - - void SetFromNoteMetadata( NoteMetadata* pNoteMetadata ) - { - if( pNoteMetadata != NULL ) - { - SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - SetNumFeet( pNoteMetadata->m_iMeter, pNoteMetadata->m_sDescription ); - } - else - { - SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); - SetNumFeet( 0, "" ); - } - }; + void SetFromNotes( Notes* pNotes ); private: - - void SetNumFeet( int iNumFeet, const CString &sDescription ) - { - CString sNewText; - for( int f=0; f<=9; f++ ) - sNewText += (f &arrayTweenColors ) +{ + const CString sSkinDir = ssprintf("%s\\%s\\", m_sGameDir, sSkinName); + const CString sButtonName = m_sButtonNames[ iInstrumentButton ]; + + const CString sColorsFilePath = sSkinDir + sButtonName + ".colors"; + + FILE* file = fopen( sColorsFilePath, "r" ); + ASSERT( file != NULL ); + if( file == NULL ) + return; + + bool bSuccess; + do + { + D3DXCOLOR color; + int retval = fscanf( file, "%f,%f,%f,%f\n", &color.r, &color.g, &color.b, &color.a ); + bSuccess = retval == 4; + if( bSuccess ) + arrayTweenColors.Add( color ); + } while( bSuccess ); + + return; +} + diff --git a/stepmania/src/GameDef.h b/stepmania/src/GameDef.h index 432e243d5b..a68f60310b 100644 --- a/stepmania/src/GameDef.h +++ b/stepmania/src/GameDef.h @@ -5,12 +5,12 @@ 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. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ -#include "NoteMetadata.h" +#include "Notes.h" #include "NoteData.h" #include "GameInput.h" #include "GameConstantsAndTypes.h" @@ -64,6 +64,7 @@ public: return false; } CString GetPathToGraphic( const CString sSkinName, const int iInstrumentButton, const GameButtonGraphic gbg ); + void GetTweenColors( const CString sSkinName, const int iInstrumentButton, CArray &arrayTweenColors ); CString ElementToGraphicSuffix( const GameButtonGraphic gbg ); diff --git a/stepmania/src/GameInput.h b/stepmania/src/GameInput.h index 90c78baf55..dd5d401740 100644 --- a/stepmania/src/GameInput.h +++ b/stepmania/src/GameInput.h @@ -5,7 +5,7 @@ Desc: An input event specific to a Game definied by an instrument and a button space. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index 4723efa019..cebdd6f130 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -5,7 +5,7 @@ Desc: See Header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -166,3 +166,12 @@ bool GameManager::IsPlayerEnabled( PlayerNumber PlayerNo ) return false; } +void GameManager::GetTweenColors( const PlayerNumber p, const ColumnNumber col, CArray &aTweenColorsAddTo ) +{ + GameDef* pGameDef = GetCurrentGameDef(); + StyleDef* pStyleDef = GetCurrentStyleDef(); + StyleInput StyleI( p, col ); + GameInput GameI = pStyleDef->StyleInputToGameInput( StyleI ); + + pGameDef->GetTweenColors( m_sCurrentSkin[p], GameI.button, aTweenColorsAddTo ); +} diff --git a/stepmania/src/GameManager.h b/stepmania/src/GameManager.h index 1c7386af6f..43f5f99f14 100644 --- a/stepmania/src/GameManager.h +++ b/stepmania/src/GameManager.h @@ -6,7 +6,7 @@ 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 persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -49,6 +49,7 @@ public: InstrumentButton b = gi.button; return GetCurrentGameDef()->GetPathToGraphic( m_sCurrentSkin[p], b, gbg ); } + void GetTweenColors( const PlayerNumber p, const ColumnNumber col, CArray &aTweenColorsAddTo ); protected: diff --git a/stepmania/src/GhostArrow.cpp b/stepmania/src/GhostArrow.cpp index c3c16f5035..c1aaa2b57b 100644 --- a/stepmania/src/GhostArrow.cpp +++ b/stepmania/src/GhostArrow.cpp @@ -41,9 +41,9 @@ void GhostArrow::Step( TapNoteScore score ) case TNS_BOO: SetDiffuseColor( D3DXCOLOR(0.8f,0.0f,0.6f,0.6f) ); break; case TNS_MISS: ASSERT( false ); break; } - SetZoom( 1.0f ); - BeginTweening( 0.3f ); - SetTweenZoom( 1.5f ); + SetZoom( 1.1f ); + BeginTweening( 0.30f ); + SetTweenZoom( 1.7f ); D3DXCOLOR colorTween = GetDiffuseColor(); colorTween.a = 0; SetTweenDiffuseColor( colorTween ); diff --git a/stepmania/src/GhostArrow.h b/stepmania/src/GhostArrow.h index 715c739fcb..3719a512b5 100644 --- a/stepmania/src/GhostArrow.h +++ b/stepmania/src/GhostArrow.h @@ -16,7 +16,7 @@ class GhostArrow; #include "Sprite.h" -#include "NoteMetadata.h" +#include "Notes.h" class GhostArrow : public Sprite diff --git a/stepmania/src/GhostArrowBright.cpp b/stepmania/src/GhostArrowBright.cpp index 89e75c3f53..79c44b220c 100644 --- a/stepmania/src/GhostArrowBright.cpp +++ b/stepmania/src/GhostArrowBright.cpp @@ -38,7 +38,7 @@ void GhostArrowBright::Step( TapNoteScore score ) case TNS_MISS: ASSERT( false ); break; } SetState( 0 ); - SetZoom( 1.2f ); + SetZoom( 1.3f ); BeginTweening( 0.35f ); SetTweenZoom( 2.5f ); D3DXCOLOR colorTween = GetDiffuseColor(); diff --git a/stepmania/src/GhostArrowBright.h b/stepmania/src/GhostArrowBright.h index e880077ad2..3988f53a79 100644 --- a/stepmania/src/GhostArrowBright.h +++ b/stepmania/src/GhostArrowBright.h @@ -16,7 +16,7 @@ class GhostArrowBright; #include "Sprite.h" -#include "NoteMetadata.h" +#include "Notes.h" class GhostArrowBright : public Sprite diff --git a/stepmania/src/GhostArrowRow.cpp b/stepmania/src/GhostArrowRow.cpp index 0f6d27d0ea..297e25b649 100644 --- a/stepmania/src/GhostArrowRow.cpp +++ b/stepmania/src/GhostArrowRow.cpp @@ -5,7 +5,7 @@ Desc: A graphic displayed in the GhostArrowRow during Dancing. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -59,7 +59,7 @@ void GhostArrowRow::Update( float fDeltaTime, float fSongBeat ) } } -void GhostArrowRow::RenderPrimitives() +void GhostArrowRow::DrawPrimitives() { for( int c=0; cSetCustomTextureRect( frectCurrentTextureCoords ); } +void GradeDisplay::DrawPrimitives() +{ + if( m_Grade == GRADE_NO_DATA ) + return; + + Sprite::DrawPrimitives(); +} + void GradeDisplay::SetGrade( Grade g ) { -// StopUsingCustomCoords(); + m_Grade = g; -// SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); + StopUsingCustomCoords(); + + SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); switch( g ) { @@ -62,7 +72,7 @@ void GradeDisplay::SetGrade( Grade g ) case GRADE_C: SetState(4); break; case GRADE_D: SetState(5); break; case GRADE_E: SetState(6); break; -// case GRADE_NO_DATA: SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); break; + case GRADE_NO_DATA: break; // don't draw at all if grade = GRADE_NO_DATA default: ASSERT( false ); } }; diff --git a/stepmania/src/GradeDisplay.h b/stepmania/src/GradeDisplay.h index 4aa2853c40..0f6fd9afee 100644 --- a/stepmania/src/GradeDisplay.h +++ b/stepmania/src/GradeDisplay.h @@ -5,7 +5,7 @@ Desc: A graphic displayed in the GradeDisplay during Dancing. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -22,12 +22,15 @@ public: GradeDisplay(); virtual void Update( float fDeltaTime ); + virtual void DrawPrimitives(); void SetGrade( Grade g ); void SpinAndSettleOn( Grade g ); protected: + Grade m_Grade; + // for scrolling void ScrollToVirtualFrame( int iFrameNo ); // a virtual frame is a tiled state number FRECT m_frectStartTexCoords; diff --git a/stepmania/src/GrayArrow.cpp b/stepmania/src/GrayArrow.cpp index e196f5b081..c7a79d7c73 100644 --- a/stepmania/src/GrayArrow.cpp +++ b/stepmania/src/GrayArrow.cpp @@ -5,7 +5,7 @@ Desc: A gray arrow that "receives" ColorNotes. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Ben Nordstrom Chris Danford ----------------------------------------------------------------------------- diff --git a/stepmania/src/GrayArrow.h b/stepmania/src/GrayArrow.h index c281221f57..8a3e907b5a 100644 --- a/stepmania/src/GrayArrow.h +++ b/stepmania/src/GrayArrow.h @@ -4,7 +4,7 @@ Desc: A gray arrow that "receives" ColorNotes. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Ben Nordstrom Chris Danford ----------------------------------------------------------------------------- @@ -16,7 +16,7 @@ #include "Sprite.h" -#include "NoteMetadata.h" +#include "Notes.h" class GrayArrow : public Sprite { diff --git a/stepmania/src/GrayArrowRow.cpp b/stepmania/src/GrayArrowRow.cpp index 9f0b89d293..ba36edb572 100644 --- a/stepmania/src/GrayArrowRow.cpp +++ b/stepmania/src/GrayArrowRow.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -52,7 +52,7 @@ void GrayArrowRow::Update( float fDeltaTime, float fSongBeat ) } } -void GrayArrowRow::RenderPrimitives() +void GrayArrowRow::DrawPrimitives() { for( int c=0; cGetPathTo(GRAPHIC_SELECT_MUSIC_RADAR_BASE) ); - this->AddActor( &m_sprRadarBase ); + this->AddActor( &m_GrooveRadarValueMap ); for( int c=0; cAddActor( &m_sprRadarLabels[c] ); } +} + +void GrooveRadar::TweenOnScreen() +{ + for( int c=0; cGetPathTo(GRAPHIC_SELECT_MUSIC_RADAR_BASE) ); + this->AddActor( &m_sprRadarBase ); for( int p=0; pm_fRadarValues[c]; } if( m_bValuesVisible[p] == false ) // the values WERE invisible @@ -84,13 +121,13 @@ void GrooveRadar::SetFromNoteMetadata( PlayerNumber p, NoteMetadata* pNoteMetada m_bValuesVisible[p] = true; } - else // pNoteMetadata == NULL + else // pNotes == NULL { m_bValuesVisible[p] = false; } } -void GrooveRadar::Update( float fDeltaTime ) +void GrooveRadar::GrooveRadarValueMap::Update( float fDeltaTime ) { ActorFrame::Update( fDeltaTime ); @@ -100,14 +137,14 @@ void GrooveRadar::Update( float fDeltaTime ) } } -void GrooveRadar::RenderPrimitives() +void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() { - ActorFrame::RenderPrimitives(); + ActorFrame::DrawPrimitives(); // draw radar filling const float fRadius = m_sprRadarBase.GetZoomedHeight()/2.0f; - LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer(); - LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice(); + LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer(); + LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice(); pd3dDevice->SetTexture( 0, NULL ); pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); @@ -115,7 +152,7 @@ void GrooveRadar::RenderPrimitives() pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - CUSTOMVERTEX* v; + RAGEVERTEX* v; for( int p=0; pGetPathTo(GRAPHIC_JUDGEMENT) ); + m_sprJudgement.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_JUDGEMENT) ); m_sprJudgement.StopAnimating(); this->AddActor( &m_sprJudgement ); } @@ -35,11 +35,11 @@ void HoldJudgement::Update( float fDeltaTime ) m_fDisplayCountdown = 0; } -void HoldJudgement::RenderPrimitives() +void HoldJudgement::DrawPrimitives() { if( m_fDisplayCountdown > 0 ) { - ActorFrame::RenderPrimitives(); + ActorFrame::DrawPrimitives(); } } diff --git a/stepmania/src/HoldJudgement.h b/stepmania/src/HoldJudgement.h index ea070c1f19..6bcbaa35b0 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -26,7 +26,7 @@ public: HoldJudgement(); void SetHoldJudgement( HoldNoteResult result ); virtual void Update( float fDeltaTime ); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); protected: Sprite m_sprJudgement; diff --git a/stepmania/src/IniFile.cpp b/stepmania/src/IniFile.cpp index e204b48060..b08a496e90 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/IniFile.h b/stepmania/src/IniFile.h index c6dbdbb2ce..cdef99657d 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/InputFilter.cpp b/stepmania/src/InputFilter.cpp index 9966ada6a8..dc0b9b846a 100644 --- a/stepmania/src/InputFilter.cpp +++ b/stepmania/src/InputFilter.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -16,13 +16,13 @@ #include "RageInput.h" #include "ErrorCatcher/ErrorCatcher.h" -InputFilter* FILTER = NULL; // global and accessable from anywhere in our program +InputFilter* INPUTFILTER = NULL; // global and accessable from anywhere in our program void InputFilter::GetInputEvents( InputEventArray &array, float fDeltaTime ) { - INPUTM->Update(); + INPUTMAN->Update(); for( int d=0; dWasBeingPressed(di) ) + if( INPUTMAN->WasBeingPressed(di) ) { - if( INPUTM->IsBeingPressed(di) ) + if( INPUTMAN->IsBeingPressed(di) ) { const float fOldHoldTime = m_fTimeHeld[d][b]; m_fTimeHeld[d][b] += fDeltaTime; @@ -72,14 +72,14 @@ void InputFilter::GetInputEvents( InputEventArray &array, float fDeltaTime ) array.Add( InputEvent(di,iet) ); } } - else // !INPUTM->IsBeingPressed(di) + else // !INPUTMAN->IsBeingPressed(di) m_fTimeHeld[d][b] = 0; } - else // !INPUTM->WasBeingPressed(di) + else // !INPUTMAN->WasBeingPressed(di) { - if( INPUTM->IsBeingPressed(di) ) + if( INPUTMAN->IsBeingPressed(di) ) array.Add( InputEvent(di,IET_FIRST_PRESS) ); - else // !INPUTM->IsBeingPressed(di) + else // !INPUTMAN->IsBeingPressed(di) ; // don't care } } diff --git a/stepmania/src/InputFilter.h b/stepmania/src/InputFilter.h index fc7df03655..0f7c0771ca 100644 --- a/stepmania/src/InputFilter.h +++ b/stepmania/src/InputFilter.h @@ -7,7 +7,7 @@ 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. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -53,5 +53,5 @@ public: }; -extern InputFilter* FILTER; // global and accessable from anywhere in our program +extern InputFilter* INPUTFILTER; // global and accessable from anywhere in our program diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index 605878a3b6..a1a91fb078 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -5,7 +5,7 @@ Desc: See Header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -15,7 +15,7 @@ #include "GameManager.h" -InputMapper* MAPPER = NULL; // global and accessable from anywhere in our program +InputMapper* INPUTMAPPER = NULL; // global and accessable from anywhere in our program InputMapper::InputMapper() @@ -200,7 +200,7 @@ const HardCodedMenuKey g_HardCodedMenuKeys[] = { DEVICE_KEYBOARD, DIK_DOWN, PLAYER_1, MENU_BUTTON_DOWN }, { DEVICE_KEYBOARD, DIK_LEFT, PLAYER_1, MENU_BUTTON_LEFT }, { DEVICE_KEYBOARD, DIK_RIGHT, PLAYER_1, MENU_BUTTON_RIGHT }, - { DEVICE_KEYBOARD, DIK_RETURN, PLAYER_1, MENU_BUTTON_NEXT }, + { DEVICE_KEYBOARD, DIK_RETURN, PLAYER_1, MENU_BUTTON_START }, { DEVICE_KEYBOARD, DIK_ESCAPE, PLAYER_1, MENU_BUTTON_BACK }, }; const int NUM_HARD_CODED_MENU_KEYS = sizeof(g_HardCodedMenuKeys) / sizeof(HardCodedMenuKey); @@ -265,7 +265,7 @@ bool InputMapper::IsButtonDown( GameInput GameI ) if( GameToDevice( GameI, i, DeviceI ) ) { - if( INPUTM->IsBeingPressed( DeviceI ) ) + if( INPUTMAN->IsBeingPressed( DeviceI ) ) return true; } } diff --git a/stepmania/src/InputMapper.h b/stepmania/src/InputMapper.h index b0d3eddaaa..69e070fd3d 100644 --- a/stepmania/src/InputMapper.h +++ b/stepmania/src/InputMapper.h @@ -7,7 +7,7 @@ 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. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -75,4 +75,4 @@ protected: }; -extern InputMapper* MAPPER; // global and accessable from anywhere in our program +extern InputMapper* INPUTMAPPER; // global and accessable from anywhere in our program diff --git a/stepmania/src/Judgement.cpp b/stepmania/src/Judgement.cpp index 19f42d7ec3..934015df89 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -15,14 +15,15 @@ #include "ThemeManager.h" -const float JUDGEMENT_DISPLAY_TIME = 0.6f; +const float JUDGEMENT_DISPLAY_TIME = 0.8f; Judgement::Judgement() { m_fDisplayCountdown = 0; - m_sprJudgement.Load( THEME->GetPathTo(GRAPHIC_JUDGEMENT) ); + m_sprJudgement.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_JUDGEMENT) ); m_sprJudgement.StopAnimating(); + m_sprJudgement.TurnShadowOn(); this->AddActor( &m_sprJudgement ); } @@ -35,11 +36,11 @@ void Judgement::Update( float fDeltaTime ) m_fDisplayCountdown = 0; } -void Judgement::RenderPrimitives() +void Judgement::DrawPrimitives() { if( m_fDisplayCountdown > 0 ) { - ActorFrame::RenderPrimitives(); + ActorFrame::DrawPrimitives(); } } @@ -60,19 +61,40 @@ void Judgement::SetJudgement( TapNoteScore score ) m_fDisplayCountdown = JUDGEMENT_DISPLAY_TIME; + m_sprJudgement.SetEffectNone(); + if( score == TNS_MISS ) { // falling down - m_sprJudgement.SetY( -30 ); - m_sprJudgement.SetZoom( 1.0f ); + m_sprJudgement.SetY( -20 ); + //m_sprJudgement.SetZoom( 1.0f ); m_sprJudgement.BeginTweening( JUDGEMENT_DISPLAY_TIME ); - m_sprJudgement.SetTweenY( 30 ); + m_sprJudgement.SetTweenY( 20 ); } + else if( score == TNS_BOO ) + { + // vibrate + m_sprJudgement.StopTweening(); + m_sprJudgement.SetY( 0 ); + m_sprJudgement.SetZoom( 1.0f ); + m_sprJudgement.SetEffectVibrating(); + } else { // zooming out - m_sprJudgement.SetZoom( 1.35f ); - m_sprJudgement.BeginTweening( JUDGEMENT_DISPLAY_TIME/5.0f ); - m_sprJudgement.SetTweenZoom( 1.0f ); + float fMagnitudeX, fMagnitudeY; + switch( score ) + { + case TNS_PERFECT: fMagnitudeX = 1.50f; fMagnitudeY = 2.00f; break; + case TNS_GREAT: fMagnitudeX = 1.30f; fMagnitudeY = 1.50f; break; + case TNS_GOOD: fMagnitudeX = 1.10f; fMagnitudeY = 1.25f; break; + default: ASSERT(false); // invalid score value + } + m_sprJudgement.StopTweening(); + m_sprJudgement.SetY( 0 ); + // m_sprJudgement.SetZoomY( fMagnitudeY ); + // m_sprJudgement.SetZoomX( fMagnitudeX ); + // m_sprJudgement.BeginTweening( JUDGEMENT_DISPLAY_TIME/5.0f ); + // m_sprJudgement.SetTweenZoom( 1 ); } } \ No newline at end of file diff --git a/stepmania/src/Judgement.h b/stepmania/src/Judgement.h index a57a8fc57f..52fe3a73d0 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -26,7 +26,7 @@ public: Judgement(); void SetJudgement( TapNoteScore score ); virtual void Update( float fDeltaTime ); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); protected: Sprite m_sprJudgement; diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index 272f582dac..8b09aeea97 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -20,11 +20,6 @@ const float SECTION_WIDTH = 1.0f/NUM_SECTIONS; LifeMeterBar::LifeMeterBar() { -} - -void LifeMeterBar::SetPlayerOptions(const PlayerOptions& po) { - m_po = po; - //m_fLifePercentage = m_po.m_fInitialLifePercentage; m_fLifePercentage = 0.5f; m_fTrailingLifePercentage = 0; m_fLifeVelocity = 0; @@ -55,7 +50,7 @@ void LifeMeterBar::Update( float fDeltaTime ) m_fLifeVelocity += fDelta * fDeltaTime; - m_fLifeVelocity = clamp( m_fLifeVelocity, -0.15f, 0.15f ); + m_fLifeVelocity = clamp( m_fLifeVelocity, -0.30f, 0.30f ); m_fLifeVelocity *= 1-fDeltaTime*2; @@ -84,19 +79,20 @@ const D3DXCOLOR COLOR_FULL_2 = D3DXCOLOR(1,1,0,1); D3DXCOLOR LifeMeterBar::GetColor( float fPercentIntoSection ) { - const float fPercentColor1 = fabsf( fPercentIntoSection*2 - 1 ); + float fPercentColor1 = fabsf( fPercentIntoSection*2 - 1 ); + fPercentColor1 *= fPercentColor1 * fPercentColor1; if( m_fLifePercentage == 1 ) return COLOR_FULL_1 * fPercentColor1 + COLOR_FULL_2 * (1-fPercentColor1); else return COLOR_NORMAL_1 * fPercentColor1 + COLOR_NORMAL_2 * (1-fPercentColor1); } -void LifeMeterBar::RenderPrimitives() +void LifeMeterBar::DrawPrimitives() { // make the object in logical units centered at the origin - LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer(); - CUSTOMVERTEX* v; + LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer(); + RAGEVERTEX* v; pVB->Lock( 0, 0, (BYTE**)&v, 0 ); int iNumV = 0; @@ -175,7 +171,7 @@ void LifeMeterBar::RenderPrimitives() pVB->Unlock(); - LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice(); + LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice(); pd3dDevice->SetTexture( 0, NULL ); @@ -191,8 +187,8 @@ void LifeMeterBar::RenderPrimitives() // finally! Pump those triangles! - pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX ); - pd3dDevice->SetStreamSource( 0, pVB, sizeof(CUSTOMVERTEX) ); + pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX ); + pd3dDevice->SetStreamSource( 0, pVB, sizeof(RAGEVERTEX) ); pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, iNumV-2 ); } \ No newline at end of file diff --git a/stepmania/src/LifeMeterBar.h b/stepmania/src/LifeMeterBar.h index 4229eaf70b..2db2703d32 100644 --- a/stepmania/src/LifeMeterBar.h +++ b/stepmania/src/LifeMeterBar.h @@ -5,38 +5,31 @@ Desc: A graphic displayed in the LifeMeterBar during Dancing. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ -#include "ActorFrame.h" +#include "LifeMeter.h" #include "Sprite.h" -#include "ScoreDisplayRolling.h" +#include "Quad.h" -class LifeMeterBar : public ActorFrame +class LifeMeterBar : public LifeMeter { public: LifeMeterBar(); - void SetPlayerOptions(const PlayerOptions& po); virtual void Update( float fDeltaTime ); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); - void SetBeat( float fSongBeat ) { m_fSongBeat = fSongBeat; }; - - void ChangeLife( TapNoteScore score ); - float GetLifePercentage(); + virtual void ChangeLife( TapNoteScore score ); + virtual float GetLifePercentage(); private: D3DXCOLOR GetColor( float fPercentIntoSection ); - float m_fSongBeat; - float m_fLifePercentage; float m_fTrailingLifePercentage; // this approaches m_fLifePercentage float m_fLifeVelocity; // how m_fTrailingLifePercentage approaches m_fLifePercentage - - PlayerOptions m_po; }; diff --git a/stepmania/src/MenuElements.cpp b/stepmania/src/MenuElements.cpp index 822b1cf863..d04fc38284 100644 --- a/stepmania/src/MenuElements.cpp +++ b/stepmania/src/MenuElements.cpp @@ -3,9 +3,10 @@ ----------------------------------------------------------------------------- File: MenuElements.h - Desc: Base class for menu Windows. + Desc: Base class for menu Screens. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ @@ -13,8 +14,8 @@ #include "RageTextureManager.h" #include "RageUtil.h" #include "RageMusic.h" -#include "WindowManager.h" -#include "WindowDancing.h" +#include "ScreenManager.h" +#include "ScreenGameplay.h" #include "GameConstantsAndTypes.h" #include "ThemeManager.h" #include "RageLog.h" @@ -80,7 +81,7 @@ void MenuElements::TweenTopEdgeOnScreen() m_textHelp.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); m_textHelp.SetTweenZoomY( fOriginalZoomY ); - m_soundSwoosh.PlayRandom(); + m_soundSwoosh.Play(); } void MenuElements::TweenTopEdgeOffScreen() @@ -92,7 +93,7 @@ void MenuElements::TweenTopEdgeOffScreen() m_textHelp.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); m_textHelp.SetTweenZoomY( 0 ); - m_soundSwoosh.PlayRandom(); + m_soundSwoosh.Play(); } void MenuElements::TweenBackgroundOnScreen() @@ -106,7 +107,7 @@ void MenuElements::TweenBackgroundOnScreen() m_sprBG.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); m_sprBG.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) ); - m_soundSwoosh.PlayRandom(); + m_soundSwoosh.Play(); } void MenuElements::TweenBackgroundOffScreen() @@ -118,7 +119,7 @@ void MenuElements::TweenBackgroundOffScreen() m_sprBG.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); m_sprBG.SetTweenDiffuseColor( D3DXCOLOR(0,0,0,1) ); - m_soundBack.PlayRandom(); + m_soundBack.Play(); } void MenuElements::TweenAllOnScreen() @@ -154,7 +155,7 @@ void MenuElements::SetTopEdgeOffScreen() } -void MenuElements::RenderPrimitives() +void MenuElements::DrawPrimitives() { // do nothing. Call DrawBottomLayer() and DrawTopLayer() instead. } diff --git a/stepmania/src/MenuElements.h b/stepmania/src/MenuElements.h index 37f7b37626..617f0be7f3 100644 --- a/stepmania/src/MenuElements.h +++ b/stepmania/src/MenuElements.h @@ -2,9 +2,9 @@ ----------------------------------------------------------------------------- File: MenuElements.h - Desc: Base class for menu Windows. + Desc: Base class for menu Screens. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ #ifndef _MenuElements_H_ @@ -12,7 +12,7 @@ -#include "Window.h" +#include "Screen.h" #include "Sprite.h" #include "BitmapText.h" #include "RandomSample.h" @@ -27,7 +27,7 @@ class MenuElements : public ActorFrame public: MenuElements(); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); void Load( CString sBackgroundPath, CString sTopEdgePath, CString sHelpText ); @@ -56,8 +56,8 @@ protected: Sprite m_sprBottomEdge; BitmapText m_textHelp; - RandomSample m_soundSwoosh; - RandomSample m_soundBack; + RageSoundSample m_soundSwoosh; + RageSoundSample m_soundBack; }; diff --git a/stepmania/src/MenuInput.h b/stepmania/src/MenuInput.h index 2a7ec51d3d..7ed78672ae 100644 --- a/stepmania/src/MenuInput.h +++ b/stepmania/src/MenuInput.h @@ -6,7 +6,7 @@ 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. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -19,7 +19,7 @@ enum MenuButton MENU_BUTTON_RIGHT, MENU_BUTTON_UP, MENU_BUTTON_DOWN, - MENU_BUTTON_NEXT, + MENU_BUTTON_START, MENU_BUTTON_BACK, NUM_MENU_BUTTONS, // leave this at the end MENU_BUTTON_NONE diff --git a/stepmania/src/MotionBlurSprite.cpp b/stepmania/src/MotionBlurSprite.cpp index bb876418b0..538e960055 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/MotionBlurSprite.h b/stepmania/src/MotionBlurSprite.h index 00f15519cb..da1c4be5f3 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -26,7 +26,7 @@ public: virtual void Update( float fDeltaTime ) { for( int i=0; iGetPathTo(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_sprSectionBar.SetXY( 0, 0 ); - m_textSectionName.Load( THEME->GetPathTo(FONT_BOLD) ); + m_textSectionName.Load( THEME->GetPathTo(FONT_HEADER1) ); m_textSectionName.TurnShadowOff(); m_textSectionName.SetHorizAlign( align_left ); m_textSectionName.SetVertAlign( align_middle ); - m_textSectionName.SetXY( m_sprSectionBar.GetX() - m_sprSectionBar.GetUnzoomedWidth()/2 + 10, 0 ); + m_textSectionName.SetXY( m_sprSectionBar.GetX() - m_sprSectionBar.GetUnzoomedWidth()/2 + 30, 0 ); m_textSectionName.SetZoom( 1.0f ); - m_textSectionName.SetDiffuseColor( COLOR_SECTION_LETTERS ); + + + + m_textRoulette.Load( THEME->GetPathTo(FONT_TEXT_BANNER) ); + m_textRoulette.TurnShadowOff(); + m_textRoulette.SetText( "ROULETTE" ); + m_textRoulette.TurnRainbowOn(); + m_textRoulette.SetZoom( 1.3f ); + m_textRoulette.SetHorizAlign( align_left ); + m_textRoulette.SetXY( -120, 0 ); for( int p=0; pm_WheelItemType; m_sSectionName = pWID->m_sSectionName; m_pSong = pWID->m_pSong; + m_color = pWID->m_color; m_MusicStatusDisplayType = pWID->m_MusicStatusDisplayType; @@ -109,35 +131,34 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID ) case TYPE_SECTION: { - CString sDisplayName = SONG->ShortenGroupName(m_sSectionName); - - if( sDisplayName.GetLength() <= 4 ) - m_textSectionName.SetZoom( 2 ); - else - m_textSectionName.SetZoom( 1 ); + CString sDisplayName = SONGMAN->ShortenGroupName(m_sSectionName); + m_textSectionName.SetZoom( 1 ); m_textSectionName.SetText( sDisplayName ); - m_textSectionName.SetDiffuseColor( COLOR_SECTION_LETTERS ); + m_textSectionName.SetDiffuseColor( m_color ); + m_textSectionName.TurnRainbowOff(); - float fTextWidth, fSpriteWidth; - fTextWidth = m_textSectionName.GetWidestLineWidthInSourcePixels() * m_textSectionName.GetZoom(); - fSpriteWidth = m_sprSectionBar.GetUnzoomedWidth() * m_sprSectionBar.GetZoom() - 20; - if( fTextWidth > fSpriteWidth ) - m_textSectionName.SetZoomX( m_textSectionName.GetZoom() * fSpriteWidth / fTextWidth ); - m_sprSectionBar.SetDiffuseColor( SONG->GetGroupColor( m_pSong->GetGroupName() ) ); + float fSourcePixelWidth = (float)m_textSectionName.GetWidestLineWidthInSourcePixels(); + float fMaxTextWidth = 200; + if( fSourcePixelWidth > fMaxTextWidth ) + m_textSectionName.SetZoomX( fMaxTextWidth / fSourcePixelWidth ); } break; case TYPE_SONG: { - m_Banner.LoadFromSong( m_pSong ); - D3DXCOLOR color = SONG->GetGroupColor( m_pSong->GetGroupName() ); + m_TextBanner.LoadFromSong( m_pSong ); + D3DXCOLOR color = m_color; color.r += 0.15f; color.g += 0.15f; color.b += 0.15f; - m_Banner.SetDiffuseColor( color ); + m_TextBanner.SetDiffuseColor( color ); m_MusicStatusDisplay.SetType( m_MusicStatusDisplayType ); RefreshGrades(); } break; + case TYPE_ROULETTE: + { + } + break; default: ASSERT( false ); // invalid type } @@ -147,17 +168,22 @@ void WheelItemDisplay::RefreshGrades() { for( int p=0; pIsPlayerEnabled( (PlayerNumber)p ) ) + if( !GAME->IsPlayerEnabled( (PlayerNumber)p ) ) + { + m_GradeDisplay[p].SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); + continue; + } + + const DifficultyClass dc = PREFS->m_PreferredDifficultyClass[p]; + if( m_pSong ) // this is a song display { - const DifficultyClass dc = PREFS->m_PreferredDifficultyClass[p]; - ASSERT( m_pSong != NULL ); const Grade grade = m_pSong->GetGradeForDifficultyClass( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, dc ); m_GradeDisplay[p].SetGrade( grade ); m_GradeDisplay[p].SetDiffuseColor( PlayerToColor((PlayerNumber)p) ); } - else // !IsPlayerEnabled + else // this is a section display { - m_GradeDisplay[p].SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); + m_GradeDisplay[p].SetGrade( GRADE_NO_DATA ); } } } @@ -170,17 +196,21 @@ void WheelItemDisplay::Update( float fDeltaTime ) m_sprSectionBar.Update( fDeltaTime ); m_textSectionName.Update( fDeltaTime ); break; + case TYPE_ROULETTE: + m_sprSectionBar.Update( fDeltaTime ); + m_textRoulette.Update( fDeltaTime ); + break; case TYPE_SONG: m_sprSongBar.Update( fDeltaTime ); m_MusicStatusDisplay.Update( fDeltaTime ); - m_Banner.Update( fDeltaTime ); + m_TextBanner.Update( fDeltaTime ); for( int p=0; pAddActor( &m_sprHighScoreFrame[p] ); - m_HighScore[p].SetXY( SCORE_X-12, SCORE_Y[p]*0.97f ); - m_HighScore[p].SetZoom( 0.5f ); + m_HighScore[p].SetXY( SCORE_X, SCORE_Y[p]*0.97f ); + m_HighScore[p].SetZoom( 0.6f ); this->AddActor( &m_HighScore[p] ); } @@ -220,8 +254,8 @@ MusicWheel::MusicWheel() m_sprSelectionOverlay.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SONG_HIGHLIGHT) ); m_sprSelectionOverlay.SetXY( 0, 0 ); - m_sprSelectionOverlay.SetDiffuseColor( D3DXCOLOR(1,1,1,0.3f) ); - m_sprSelectionOverlay.SetEffectGlowing( 1.0f, D3DXCOLOR(1,1,1,0.2f), D3DXCOLOR(1,1,1,0.8f) ); + m_sprSelectionOverlay.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); + m_sprSelectionOverlay.SetEffectGlowing( 1.0f, D3DXCOLOR(1,1,1,0.4f), D3DXCOLOR(1,1,1,1) ); this->AddActor( &m_sprSelectionOverlay ); m_MusicSortDisplay.SetXY( SORT_ICON_ON_SCREEN_X, SORT_ICON_ON_SCREEN_Y ); @@ -240,7 +274,7 @@ MusicWheel::MusicWheel() // init m_mapGroupNameToBannerColor CArray arraySongs; - arraySongs.Copy( SONG->m_pSongs ); + arraySongs.Copy( SONGMAN->m_pSongs ); SortSongPointerArrayByGroup( arraySongs ); @@ -265,23 +299,23 @@ MusicWheel::MusicWheel() BuildWheelItemDatas( m_WheelItemDatas[so], SongSortOrder(so) ); // select a song if none are selected - if( SONG->m_pCurSong == NULL && // if there is no currently selected song - SONG->m_pSongs.GetSize() > 0 ) // and there is at least one song + if( SONGMAN->m_pCurSong == NULL && // if there is no currently selected song + SONGMAN->m_pSongs.GetSize() > 0 ) // and there is at least one song { CArray arraySongs; - SONG->GetSongsInGroup( SONG->m_sPreferredGroup, arraySongs ); + SONGMAN->GetSongsInGroup( SONGMAN->m_sPreferredGroup, arraySongs ); if( arraySongs.GetSize() > 0 ) - SONG->m_pCurSong = arraySongs[0]; // select the first song + SONGMAN->m_pCurSong = arraySongs[0]; // select the first song } - if( SONG->m_pCurSong != NULL ) + if( SONGMAN->m_pCurSong != NULL ) { // find the previously selected song (if any) for( int i=0; im_pCurSong ) + if( GetCurWheelItemDatas()[i].m_pSong == SONGMAN->m_pCurSong ) { m_iSelection = i; // select it m_sExpandedSectionName = GetCurWheelItemDatas()[m_iSelection].m_sSectionName; // make its group the currently expanded group @@ -309,20 +343,20 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr /////////////////////////////////// CArray arraySongs; - // copy only song that have at least one NoteMetadata for the current GameMode - for( i=0; im_pSongs.GetSize(); i++ ) + // copy only song that have at least one Notes for the current GameMode + for( i=0; im_pSongs.GetSize(); i++ ) { - Song* pSong = SONG->m_pSongs[i]; + Song* pSong = SONGMAN->m_pSongs[i]; - CArray arraySteps; - pSong->GetNoteMetadatasThatMatchGameAndStyle( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, arraySteps ); + CArray arraySteps; + pSong->GetNotessThatMatchGameAndStyle( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, arraySteps ); if( arraySteps.GetSize() > 0 ) arraySongs.Add( pSong ); } - // sort the SONG + // sort the SONGMAN switch( so ) { case SORT_GROUP: @@ -358,9 +392,8 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr { 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_GROUP: bUseSections = SONGMAN->m_sPreferredGroup != "ALL MUSIC"; break; case SORT_TITLE: bUseSections = true; break; -// case SORT_ARTIST: default: ASSERT( false ); } @@ -370,21 +403,24 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr arrayWheelItemDatas.SetSize( arraySongs.GetSize()*2 ); // make sure we have enough room for all music and section items CString sLastSection = ""; + D3DXCOLOR colorSection; int iCurWheelItem = 0; for( int i=0; i< arraySongs.GetSize(); i++ ) { Song* pSong = arraySongs[i]; CString sThisSection = GetSectionNameFromSongAndSort( pSong, so ); + int iSectionColorIndex = 0; if( sThisSection != sLastSection ) // new section, make a section item { WheelItemData &WID = arrayWheelItemDatas[iCurWheelItem++]; - WID.LoadFromSectionName( sThisSection ); + colorSection = (so==SORT_TITLE) ? SONGMAN->GetGroupColor(pSong->GetGroupName()) : SECTION_COLORS[iSectionColorIndex]; + iSectionColorIndex = (iSectionColorIndex+1) % NUM_SECTION_COLORS; + WID.Load( TYPE_SECTION, NULL, sThisSection, colorSection ); sLastSection = sThisSection; } WheelItemData &WID = arrayWheelItemDatas[iCurWheelItem++]; - WID.LoadFromSong( pSong ); - WID.m_sSectionName = sThisSection; + WID.Load( TYPE_SONG, pSong, sThisSection, SONGMAN->GetGroupColor(pSong->GetGroupName()) ); } arrayWheelItemDatas.SetSize( iCurWheelItem ); // make sure we have enough room for all music and section items } @@ -396,8 +432,7 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr { Song* pSong = arraySongs[i]; WheelItemData &WID = arrayWheelItemDatas[i]; - WID.LoadFromSong( pSong ); - WID.m_sSectionName = ""; + WID.Load( TYPE_SONG, pSong, "", SONGMAN->GetGroupColor(pSong->GetGroupName()) ); } } } @@ -408,8 +443,7 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr Song* pSong = arrayWheelItemDatas[i].m_pSong; if( pSong != NULL ) { - MusicStatusDisplayType crown = (pSong->GetNumTimesPlayed()==0) ? TYPE_NEW : TYPE_NONE; - arrayWheelItemDatas[i].m_MusicStatusDisplayType = crown; + arrayWheelItemDatas[i].m_MusicStatusDisplayType = (pSong->GetNumTimesPlayed()==0) ? TYPE_NEW : TYPE_NONE; } } @@ -418,8 +452,7 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr // init crown icons for( int i=0; i &arr if( arrayWheelItemDatas.GetSize() == 0 ) { arrayWheelItemDatas.SetSize( 1 ); - arrayWheelItemDatas[0].LoadFromSectionName( "NO SONGS" ); + arrayWheelItemDatas[0].Load( TYPE_SECTION, NULL, "NO SONGS", D3DXCOLOR(1,0,0,1) ); + } + else + { + arrayWheelItemDatas.SetSize( arrayWheelItemDatas.GetSize()+1 ); + arrayWheelItemDatas[arrayWheelItemDatas.GetSize()-1].Load( TYPE_ROULETTE, NULL, "", D3DXCOLOR(1,0,0,1) ); } } @@ -439,7 +477,7 @@ void MusicWheel::SwitchSortOrder() float MusicWheel::GetBannerY( float fPosOffsetsFromMiddle ) { - return fPosOffsetsFromMiddle*44; + return (float)roundf( fPosOffsetsFromMiddle*44 ); } float MusicWheel::GetBannerBrightness( float fPosOffsetsFromMiddle ) @@ -515,7 +553,7 @@ float MusicWheel::GetBannerX( float fPosOffsetsFromMiddle ) break; } - return fX; + return (float)roundf( fX ); } void MusicWheel::RebuildWheelItemDisplays() @@ -563,10 +601,11 @@ void MusicWheel::RebuildWheelItemDisplays() void MusicWheel::NotesChanged( PlayerNumber pn ) // update grade graphics and top score { DifficultyClass dc = PREFS->m_PreferredDifficultyClass[pn]; - Song* pSong = SONG->m_pCurSong; - NoteMetadata* m_pNoteMetadata = SONG->m_pCurNoteMetadata[pn]; + Song* pSong = SONGMAN->m_pCurSong; + Notes* m_pNotes = SONGMAN->m_pCurNotes[pn]; - m_HighScore[pn].SetScore( (float)m_pNoteMetadata->m_iTopScore ); + if( m_pNotes ) + m_HighScore[pn].SetScore( (float)m_pNotes->m_iTopScore ); for( int i=0; iSendMessageToTopWindow( SM_PlaySongSample, 0 ); + SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 ); break; case STATE_FLYING_OFF_BEFORE_NEXT_SORT: { @@ -681,11 +720,11 @@ void MusicWheel::Update( float fDeltaTime ) } break; case STATE_FLYING_ON_AFTER_NEXT_SORT: - WM->SendMessageToTopWindow( SM_PlaySongSample, 0 ); + SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 ); m_WheelState = STATE_IDLE; // now, wait for input break; case STATE_TWEENING_ON_SCREEN: - WM->SendMessageToTopWindow( SM_PlaySongSample, 0 ); + SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 ); m_WheelState = STATE_IDLE; m_fTimeLeftInState = 0; break; @@ -778,6 +817,11 @@ void MusicWheel::NextMusic() m_soundChangeMusic.Play(); } +void MusicWheel::PrevSort() +{ + NextSort(); +} + void MusicWheel::NextSort() { switch( m_WheelState ) @@ -833,6 +877,8 @@ bool MusicWheel::Select() } return false; + case TYPE_ROULETTE: + return false; case TYPE_SONG: default: diff --git a/stepmania/src/MusicWheel.h b/stepmania/src/MusicWheel.h index 56cf0b4ada..1b72ba52d9 100644 --- a/stepmania/src/MusicWheel.h +++ b/stepmania/src/MusicWheel.h @@ -5,7 +5,7 @@ Desc: A wheel with song names used in the Select Music screen. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -14,7 +14,7 @@ #include "Song.h" #include "ActorFrame.h" #include "BitmapText.h" -#include "RectangleActor.h" +#include "Quad.h" #include "TextBanner.h" #include "RandomSample.h" #include "GradeDisplay.h" @@ -22,7 +22,7 @@ #include "GameConstantsAndTypes.h" #include "MusicSortDisplay.h" #include "MusicStatusDisplay.h" -#include "Window.h" // for WindowMessage +#include "Screen.h" // for ScreenMessage #include "ScoreDisplayRolling.h" #include "ScrollBar.h" @@ -31,11 +31,11 @@ const int NUM_WHEEL_ITEMS_TO_DRAW = 13; 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); +const ScreenMessage SM_SongChanged = ScreenMessage(SM_User+47); // this should be unique! +const ScreenMessage SM_PlaySongSample = ScreenMessage(SM_User+48); -enum WheelItemType { TYPE_SECTION, TYPE_SONG }; +enum WheelItemType { TYPE_SECTION, TYPE_SONG, TYPE_ROULETTE }; struct WheelItemData @@ -43,12 +43,12 @@ struct WheelItemData public: WheelItemData(); - void LoadFromSectionName( const CString &sSectionName ); - void LoadFromSong( Song* pSong ); + void Load( WheelItemType wit, Song* pSong, const CString &sSectionName, const D3DXCOLOR color ); WheelItemType m_WheelItemType; CString m_sSectionName; Song* m_pSong; + D3DXCOLOR m_color; // either text color or section background color MusicStatusDisplayType m_MusicStatusDisplayType; }; @@ -60,24 +60,24 @@ public: WheelItemDisplay(); virtual void Update( float fDeltaTime ); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); - CString GetSectionName() - { - return m_sSectionName; - }; + CString GetSectionName() { return m_sSectionName; } void LoadFromWheelItemData( WheelItemData* pWID ); void RefreshGrades(); - // for a section - Sprite m_sprSectionBar; - BitmapText m_textSectionName; + // for TYPE_SECTION and TYPE_ROULETTE + Sprite m_sprSectionBar; + // for TYPE_SECTION + BitmapText m_textSectionName; + // for TYPE_ROULETTE + BitmapText m_textRoulette; - // for a music + // for a TYPE_MUSIC Sprite m_sprSongBar; MusicStatusDisplay m_MusicStatusDisplay; - TextBanner m_Banner; + TextBanner m_TextBanner; GradeDisplay m_GradeDisplay[NUM_PLAYERS]; }; @@ -91,13 +91,14 @@ public: ~MusicWheel(); virtual void Update( float fDeltaTime ); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); virtual void TweenOnScreen(); virtual void TweenOffScreen(); void PrevMusic(); void NextMusic(); + void PrevSort(); void NextSort(); void NotesChanged( PlayerNumber pn ); // update grade graphics and top score @@ -107,8 +108,9 @@ public: float GetBannerX( float fPosOffsetsFromMiddle ); bool Select(); // return true if the selected item is a music, otherwise false - Song* GetSelectedSong() { return GetCurWheelItemDatas()[m_iSelection].m_pSong; }; - CString GetSelectedSection() { return GetCurWheelItemDatas()[m_iSelection].m_sSectionName; }; + WheelItemType GetSelectedType() { return GetCurWheelItemDatas()[m_iSelection].m_WheelItemType; }; + Song* GetSelectedSong() { return GetCurWheelItemDatas()[m_iSelection].m_pSong; }; + CString GetSelectedSection() { return GetCurWheelItemDatas()[m_iSelection].m_sSectionName; }; protected: diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index 4e3da502e7..494cc518e5 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -5,7 +5,7 @@ Desc: A pattern of ColorNotes that past Y==0. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -22,16 +22,53 @@ NoteData::NoteData() { - for( int i=0; iWriteLine( "NoteData::WriteToCacheFile()" ); + + ConvertHoldNotesTo2sAnd3s(); + + int iNumRows = GetLastRow(); + fprintf( file, "%d\n", iNumRows ); + fwrite( m_TapNotes, sizeof(TapNote), MAX_NOTE_TRACKS*iNumRows, file ); + fprintf( file, "\n" ); + + Convert2sAnd3sToHoldNotes(); +} + +void NoteData::ReadFromCacheFile( FILE* file ) +{ + LOG->WriteLine( "NoteData::ReadFromCacheFile()" ); + + int iNumRows; + fscanf( file, "%d\n", &iNumRows ); + fread( m_TapNotes, sizeof(TapNote), MAX_NOTE_TRACKS*iNumRows, file ); + fscanf( file, "\n", &iNumRows ); + + Convert2sAnd3sToHoldNotes(); +} + +void NoteData::SkipOverDataInCacheFile( FILE* file ) +{ + LOG->WriteLine( "NoteData::SkipOverDataInCacheFile()" ); + + int iNumRows; + fscanf( file, "%d\n", &iNumRows ); + int retval = fseek( file, sizeof(TapNote)*MAX_NOTE_TRACKS*iNumRows, SEEK_CUR ); + ASSERT( retval == 0 ); + fscanf( file, "\n", &iNumRows ); +} + + void NoteData::ClearRange( NoteIndex iNoteIndexBegin, NoteIndex iNoteIndexEnd ) { // delete old TapNotes in the range @@ -131,7 +168,7 @@ void NoteData::RemoveHoldNote( int index ) m_iNumHoldNotes--; } -float NoteData::GetLastBeat() +int NoteData::GetLastRow() { int iOldestIndexFoundSoFar = 0; @@ -143,7 +180,7 @@ float NoteData::GetLastBeat() iOldestIndexFoundSoFar = m_HoldNotes[i].m_iEndIndex; } - for( i=MAX_TAP_NOTE_ELEMENTS-1; i>=iOldestIndexFoundSoFar; i-- ) // iterate back to front + for( i=MAX_TAP_NOTE_ROWS-1; i>=iOldestIndexFoundSoFar; i-- ) // iterate back to front { for( int t=0; t= 2 ) + iNumDoubles++; + } + + return iNumDoubles; +} + +int NoteData::GetNumHoldNotes( const float fStartBeat, const float fEndBeat ) +{ + int iNumSteps = 0; + + int iStartIndex = BeatToNoteRow( fStartBeat ); + int iEndIndex = BeatToNoteRow( fEndBeat ); + + for( int i=0; i= fHoldStartBeat && fStartBeat < fEndBeat ) + iNumSteps++; + + } + return iNumSteps; } @@ -192,7 +269,7 @@ void NoteData::CropToLeftSide() // clear out the right half for( int c=iFirstRightSideColumn; c<=iLastRightSideColumn; c++ ) { - for( int i=0; im_iNumTracks = m_iNumTracks; // transform m_TapNotes - for( int i=0; i fMaxDensityPerSecSoFar ) + fMaxDensityPerSecSoFar = fDensityPerSecThisMeasure; + } + + return fMaxDensityPerSecSoFar; +} + +float NoteData::GetAirRadarValue( float fSongSeconds ) +{ + // number of doubles + int iNumDoubles = GetNumDoubles(); + return iNumDoubles / fSongSeconds * 2; +} + +float NoteData::GetChaosRadarValue( float fSongSeconds ) +{ + // irregularity of steps + return fabsf( GetStreamRadarValue(fSongSeconds) - GetVoltageRadarValue(fSongSeconds) ); +} + +float NoteData::GetFreezeRadarValue( float fSongSeconds ) +{ + // number of hold steps + return GetNumHoldNotes() / fSongSeconds * 10; +} + + void NoteData::LoadTransformed( NoteData* pOriginal, int iNewNumTracks, TrackNumber iNewToOriginalTrack[] ) { // init for( int i=0; im_TapNotes[iOriginalTrack][i]; for( i=0; im_iNumTracks; CopyRange( pFrom, 0, MAX_TAP_NOTE_ELEMENTS ); }; + void CopyAll( NoteData* pFrom ) { m_iNumTracks = pFrom->m_iNumTracks; CopyRange( pFrom, 0, MAX_TAP_NOTE_ROWS ); }; inline bool IsRowEmpty( NoteIndex index ) { for( int t=0; tGetPathToGraphic( PLAYER_1, c, GRAPHIC_NOTE_COLOR_PART) ); - m_ColorNote[c].m_sprGrayPart.Load( GAME->GetPathToGraphic( PLAYER_1, c, GRAPHIC_NOTE_GRAY_PART) ); + CArray arrayTweenColors; + GAME->GetTweenColors( p, c, arrayTweenColors ); + + m_ColorNote[c].m_sprColorPart.Load( GAME->GetPathToGraphic( p, c, GRAPHIC_NOTE_COLOR_PART) ); + m_ColorNote[c].m_sprGrayPart.Load( GAME->GetPathToGraphic( p, c, GRAPHIC_NOTE_GRAY_PART) ); } @@ -149,18 +152,18 @@ void NoteField::DrawMarkerBar( const int iIndex ) m_rectMarkerBar.Draw(); } -void NoteField::RenderPrimitives() +void NoteField::DrawPrimitives() { - //LOG->WriteLine( "NoteField::RenderPrimitives()" ); + //LOG->WriteLine( "NoteField::DrawPrimitives()" ); 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 + int iIndexFirstArrowToDraw = BeatToNoteRow( m_fSongBeat - m_fNumBeatsToDrawBehind ); // 2 beats earlier if( iIndexFirstArrowToDraw < 0 ) iIndexFirstArrowToDraw = 0; - int iIndexLastArrowToDraw = BeatToNoteIndex( m_fSongBeat + m_fNumBeatsToDrawAhead ); // 7 beats later + int iIndexLastArrowToDraw = BeatToNoteRow( m_fSongBeat + m_fNumBeatsToDrawAhead ); // 7 beats later //LOG->WriteLine( "Drawing elements %d through %d", iIndexFirstArrowToDraw, iIndexLastArrowToDraw ); @@ -183,11 +186,11 @@ void NoteField::RenderPrimitives() { if( m_fBeginMarker != -1 ) { - DrawMarkerBar( BeatToNoteIndex(m_fBeginMarker) ); + DrawMarkerBar( BeatToNoteRow(m_fBeginMarker) ); } if( m_fEndMarker != -1 ) { - DrawMarkerBar( BeatToNoteIndex(m_fEndMarker) ); + DrawMarkerBar( BeatToNoteRow(m_fEndMarker) ); } } @@ -252,7 +255,7 @@ void NoteField::RenderPrimitives() const int iCol = hn.m_iTrack; const float fHoldNoteLife = m_HoldNoteLife[i]; - const bool bActive = NoteIndexToBeat(hn.m_iStartIndex) > m_fSongBeat && m_fSongBeat < NoteIndexToBeat(hn.m_iEndIndex); + const bool bActive = NoteRowToBeat(hn.m_iStartIndex) > m_fSongBeat && m_fSongBeat < NoteRowToBeat(hn.m_iEndIndex); // draw the gray parts @@ -264,7 +267,7 @@ void NoteField::RenderPrimitives() if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j) continue; // skip this arrow - if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteIndexToBeat(j) < m_fSongBeat ) + if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteRowToBeat(j) < m_fSongBeat ) continue; // don't draw CreateHoldNoteInstance( instances[iCount++], bActive, j, hn, fHoldNoteLife ); @@ -273,7 +276,7 @@ void NoteField::RenderPrimitives() // 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 ) + if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteRowToBeat(j) < m_fSongBeat ) ; // don't draw else CreateHoldNoteInstance( instances[iCount++], bActive, j, hn, fHoldNoteLife ); diff --git a/stepmania/src/NoteField.h b/stepmania/src/NoteField.h index 3f051d9647..d7859e8ae2 100644 --- a/stepmania/src/NoteField.h +++ b/stepmania/src/NoteField.h @@ -5,7 +5,7 @@ Desc: A stream of ColorNotes that scrolls past Y==0. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -19,7 +19,7 @@ #include "StyleDef.h" #include "ColorNote.h" #include "BitmapText.h" -#include "RectangleActor.h" +#include "Quad.h" #include "ArrowEffects.h" @@ -30,14 +30,14 @@ class NoteField : public NoteData, public ActorFrame public: NoteField(); virtual void Update( float fDeltaTime, float fSongBeat ); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); enum NoteFieldMode { MODE_DANCING, MODE_EDITING, }; - void Load( NoteData* pNoteData, PlayerOptions po, float fNumArrowsToDrawBehind, float fNumArrowsToDrawAhead, NoteFieldMode mode ); + void Load( NoteData* pNoteData, PlayerNumber p, PlayerOptions po, float fNumArrowsToDrawBehind, float fNumArrowsToDrawAhead, NoteFieldMode mode ); void RemoveTapNoteRow( int iIndex ); void SetHoldNoteLife( int iIndex, float fLife ); @@ -65,7 +65,7 @@ protected: ColorNote m_ColorNote[MAX_NOTE_TRACKS]; // used in MODE_EDIT - RectangleActor m_rectMeasureBar; + Quad m_rectMeasureBar; BitmapText m_textMeasureNumber; - RectangleActor m_rectMarkerBar; + Quad m_rectMarkerBar; }; diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index c54faec2ef..76b36eb737 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -1,11 +1,11 @@ #include "stdafx.h" /* ----------------------------------------------------------------------------- - Class: NoteMetadata + Class: Notes Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -20,10 +20,13 @@ #include "InputMapper.h" -const float JUDGEMENT_Y = CENTER_Y; +// these two items are in the +const float FRAME_JUDGE_AND_COMBO_Y = CENTER_Y; +const float JUDGEMENT_Y_OFFSET = -26; +const float COMBO_Y_OFFSET = +26; + const float ARROWS_Y = SCREEN_TOP + ARROW_SIZE * 1.5f; const float HOLD_JUDGEMENT_Y = ARROWS_Y + 80; -const float COMBO_Y = CENTER_Y + 60; const float HOLD_ARROW_NG_TIME = 0.27f; @@ -35,7 +38,7 @@ Player::Player() m_PlayerNumber = PLAYER_NONE; // init step elements - for( int i=0; iAddActor( &m_GrayArrowRow ); this->AddActor( &m_NoteField ); this->AddActor( &m_GhostArrowRow ); - this->AddActor( &m_Judgement ); + + m_frameJudgeAndCombo.AddActor( &m_Judgement ); + m_frameJudgeAndCombo.AddActor( &m_Combo ); + this->AddActor( &m_frameJudgeAndCombo ); + for( int c=0; cAddActor( &m_HoldJudgement[c] ); - this->AddActor( &m_Combo ); } @@ -78,14 +84,21 @@ void Player::Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOpti if( po.m_bLittle ) this->MakeLittle(); - m_NoteField.Load( (NoteData*)this, po, 1.5f, 5.5f, NoteField::MODE_DANCING ); + m_NoteField.Load( (NoteData*)this, player_no, po, 1.5f, 5.5f, NoteField::MODE_DANCING ); + + for( int t=0; tm_iNumTracks; t++ ) + { + for( int r=0; rm_TapNotes[t][r]; + } m_GrayArrowRow.Load( po ); m_GhostArrowRow.Load( po ); + m_frameJudgeAndCombo.SetY( FRAME_JUDGE_AND_COMBO_Y ); + m_Combo.SetY( po.m_bReverseScroll ? -COMBO_Y_OFFSET : COMBO_Y_OFFSET ); + m_Judgement.SetY( po.m_bReverseScroll ? -JUDGEMENT_Y_OFFSET : JUDGEMENT_Y_OFFSET ); - m_Combo.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - COMBO_Y : COMBO_Y ); - m_Judgement.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - JUDGEMENT_Y : JUDGEMENT_Y ); for( int c=0; cIsButtonDown( GameI ); + const bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI ); if( bIsHoldingButton ) { @@ -171,6 +184,8 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference ActorFrame::Update( fDeltaTime ); + m_frameJudgeAndCombo.Update( fDeltaTime ); + m_pLifeMeter->SetBeat( fSongBeat ); m_GrayArrowRow.Update( fDeltaTime, fSongBeat ); @@ -181,19 +196,19 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference } -void Player::RenderPrimitives() +void Player::DrawPrimitives() { D3DXMATRIX matOldView, matOldProj; if( m_PlayerOptions.m_EffectType == PlayerOptions::EFFECT_SPACE ) { // turn off Z Buffering - SCREEN->GetDevice()->SetRenderState( D3DRS_ZENABLE, FALSE ); - SCREEN->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, FALSE ); + DISPLAY->GetDevice()->SetRenderState( D3DRS_ZENABLE, FALSE ); + DISPLAY->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, FALSE ); // save old view and projection - SCREEN->GetDevice()->GetTransform( D3DTS_VIEW, &matOldView ); - SCREEN->GetDevice()->GetTransform( D3DTS_PROJECTION, &matOldProj ); + DISPLAY->GetDevice()->GetTransform( D3DTS_VIEW, &matOldView ); + DISPLAY->GetDevice()->GetTransform( D3DTS_PROJECTION, &matOldProj ); // construct view and project matrix @@ -202,11 +217,11 @@ void Player::RenderPrimitives() &D3DXVECTOR3( CENTER_X , GetY()+400.0f, 0.0f ), &D3DXVECTOR3( 0.0f, -1.0f, 0.0f ) ); - SCREEN->GetDevice()->SetTransform( D3DTS_VIEW, &matNewView ); + DISPLAY->GetDevice()->SetTransform( D3DTS_VIEW, &matNewView ); D3DXMATRIX matNewProj; D3DXMatrixPerspectiveFovLH( &matNewProj, D3DX_PI/4.0f, SCREEN_WIDTH/(float)SCREEN_HEIGHT, 0.0f, 1000.0f ); - SCREEN->GetDevice()->SetTransform( D3DTS_PROJECTION, &matNewProj ); + DISPLAY->GetDevice()->SetTransform( D3DTS_PROJECTION, &matNewProj ); } m_GrayArrowRow.Draw(); @@ -216,19 +231,18 @@ void Player::RenderPrimitives() if( m_PlayerOptions.m_EffectType == PlayerOptions::EFFECT_SPACE ) { // restire old view and projection - SCREEN->GetDevice()->SetTransform( D3DTS_VIEW, &matOldView ); - SCREEN->GetDevice()->SetTransform( D3DTS_PROJECTION, &matOldProj ); + DISPLAY->GetDevice()->SetTransform( D3DTS_VIEW, &matOldView ); + DISPLAY->GetDevice()->SetTransform( D3DTS_PROJECTION, &matOldProj ); // turn Z Buffering back on - SCREEN->GetDevice()->SetRenderState( D3DRS_ZENABLE, TRUE ); - SCREEN->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, TRUE ); + DISPLAY->GetDevice()->SetRenderState( D3DRS_ZENABLE, TRUE ); + DISPLAY->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, TRUE ); } + m_frameJudgeAndCombo.Draw(); - m_Judgement.Draw(); for( int c=0; cWriteLine( "fBeatsUntilStep: %f, fPercentFromPerfect: %f", @@ -315,7 +329,18 @@ void Player::HandlePlayerStep( float fSongBeat, ColumnNumber col, float fMaxBeat break; } - + // zoom the judgement and combo like a heart beat + float fStartZoom; + switch( score ) + { + case TNS_PERFECT: fStartZoom = 1.5f; break; + case TNS_GREAT: fStartZoom = 1.3f; break; + case TNS_GOOD: fStartZoom = 1.2f; break; + case TNS_BOO: fStartZoom = 1.0f; break; + } + m_frameJudgeAndCombo.SetZoom( fStartZoom ); + m_frameJudgeAndCombo.BeginTweening( 0.2f ); + m_frameJudgeAndCombo.SetTweenZoom( 1 ); } } } @@ -328,8 +353,8 @@ void Player::CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxB //LOG->WriteLine( "Player::CheckForCompleteRow()" ); // look for the closest matching step - int iIndexStartLookingAt = BeatToNoteIndex( fSongBeat ); - int iNumElementsToExamine = BeatToNoteIndex( fMaxBeatDiff ); // number of elements to examine on either end of iIndexStartLookingAt + int iIndexStartLookingAt = BeatToNoteRow( fSongBeat ); + int iNumElementsToExamine = BeatToNoteRow( fMaxBeatDiff ); // number of elements to examine on either end of iIndexStartLookingAt //LOG->WriteLine( "iIndexStartLookingAt = %d, iNumElementsToExamine = %d", iIndexStartLookingAt, iNumElementsToExamine ); @@ -340,14 +365,14 @@ void Player::CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxB int iCurrentIndexLater = iIndexStartLookingAt + delta; // silly check to make sure we don't go out of bounds - iCurrentIndexEarlier = clamp( iCurrentIndexEarlier, 0, MAX_TAP_NOTE_ELEMENTS-1 ); - iCurrentIndexLater = clamp( iCurrentIndexLater, 0, MAX_TAP_NOTE_ELEMENTS-1 ); + iCurrentIndexEarlier = clamp( iCurrentIndexEarlier, 0, MAX_TAP_NOTE_ROWS-1 ); + iCurrentIndexLater = clamp( iCurrentIndexLater, 0, MAX_TAP_NOTE_ROWS-1 ); //////////////////////////// // check the step to the left of iIndexStartLookingAt //////////////////////////// - //LOG->WriteLine( "Checking NoteMetadata[%d]", iCurrentIndexEarlier ); - if( m_TapNotes[col][iCurrentIndexEarlier] != '0' ) // these NoteMetadata overlap + //LOG->WriteLine( "Checking Notes[%d]", iCurrentIndexEarlier ); + if( m_TapNotes[col][iCurrentIndexEarlier] != '0' ) // these Notes overlap { m_TapNotes[col][iCurrentIndexEarlier] = '0'; // mark hit @@ -365,8 +390,8 @@ void Player::CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxB //////////////////////////// // check the step to the right of iIndexStartLookingAt //////////////////////////// - //LOG->WriteLine( "Checking NoteMetadata[%d]", iCurrentIndexLater ); - if( m_TapNotes[col][iCurrentIndexLater] != '0' ) // these NoteMetadata overlap + //LOG->WriteLine( "Checking Notes[%d]", iCurrentIndexLater ); + if( m_TapNotes[col][iCurrentIndexLater] != '0' ) // these Notes overlap { m_TapNotes[col][iCurrentIndexLater] = '0'; // mark hit @@ -385,7 +410,7 @@ void Player::CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxB void Player::OnRowDestroyed( float fSongBeat, ColumnNumber col, float fMaxBeatDiff, int iIndexThatWasSteppedOn ) { - float fStepBeat = NoteIndexToBeat( (float)iIndexThatWasSteppedOn ); + float fStepBeat = NoteRowToBeat( (float)iIndexThatWasSteppedOn ); float fBeatsUntilStep = fStepBeat - fSongBeat; @@ -431,6 +456,19 @@ void Player::OnRowDestroyed( float fSongBeat, ColumnNumber col, float fMaxBeatDi m_Combo.EndCombo(); break; } + + // zoom the judgement and combo like a heart beat + float fStartZoom; + switch( score ) + { + case TNS_PERFECT: fStartZoom = 1.5f; break; + case TNS_GREAT: fStartZoom = 1.3f; break; + case TNS_GOOD: fStartZoom = 1.2f; break; + case TNS_BOO: fStartZoom = 1.0f; break; + } + m_frameJudgeAndCombo.SetZoom( fStartZoom ); + m_frameJudgeAndCombo.BeginTweening( 0.2f ); + m_frameJudgeAndCombo.SetTweenZoom( 1 ); } @@ -438,7 +476,7 @@ ScoreSummary Player::GetScoreSummary() { ScoreSummary scoreSummary; - for( int i=0; iWriteLine( "NoteMetadata::UpdateTapNotesMissedOlderThan(%f)", fMissIfOlderThanThisBeat ); + //LOG->WriteLine( "Notes::UpdateTapNotesMissedOlderThan(%f)", fMissIfOlderThanThisBeat ); - int iMissIfOlderThanThisIndex = BeatToNoteIndex( fMissIfOlderThanThisBeat ); + int iMissIfOlderThanThisIndex = BeatToNoteRow( fMissIfOlderThanThisBeat ); int iNumMissesFound = 0; // Since this is being called every frame, let's not check the whole array every time. diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index 8538d88860..86cc72cfd6 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -6,13 +6,13 @@ Desc: Object that accepts pad input, knocks down ColorNotes that were stepped on, and keeps score for the player. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ #include "PrefsManager.h" // for ScoreSummary -#include "NoteMetadata.h" +#include "Notes.h" #include "Sprite.h" #include "BitmapText.h" @@ -41,7 +41,7 @@ public: Player(); void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference ); - void RenderPrimitives(); + void DrawPrimitives(); void Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore ); void CrossedIndex( int iIndex ); @@ -61,8 +61,8 @@ protected: PlayerOptions m_PlayerOptions; // 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]; + TapNote m_TapNotesOriginal[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ROWS]; // the original Notes that were loaded into player + TapNoteScore m_TapNoteScores[MAX_TAP_NOTE_ROWS]; HoldNoteScore m_HoldNoteScores[MAX_HOLD_NOTE_ELEMENTS]; @@ -70,8 +70,9 @@ protected: NoteField m_NoteField; GhostArrowRow m_GhostArrowRow; - Judgement m_Judgement; HoldJudgement m_HoldJudgement[MAX_NOTE_TRACKS]; + ActorFrame m_frameJudgeAndCombo; + Judgement m_Judgement; Combo m_Combo; LifeMeterBar* m_pLifeMeter; ScoreDisplayRolling* m_pScore; diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index d82ee445f0..90de2db147 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -5,7 +5,7 @@ Desc: See Header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -121,12 +121,14 @@ void PrefsManager::ReadPrefsFromDisk() { pKey->GetNextAssoc( pos, name_string, value_string ); - if( name_string == "IgnoreJoyAxes" ) m_GameOptions.m_bIgnoreJoyAxes = ( value_string == "1" ); - if( name_string == "ShowFPS" ) m_GameOptions.m_bShowFPS = ( value_string == "1" ); - if( name_string == "UseRandomVis" ) m_GameOptions.m_bUseRandomVis = ( value_string == "1" ); - if( name_string == "SkipCaution" ) m_GameOptions.m_bSkipCaution = ( value_string == "1" ); - if( name_string == "Announcer" ) m_GameOptions.m_bAnnouncer = ( value_string == "1" ); - if( name_string == "NumArcadeStages" ) m_GameOptions.m_iNumArcadeStages= atoi( value_string ); + if( name_string == "IgnoreJoyAxes" ) m_GameOptions.m_bIgnoreJoyAxes = ( value_string == "1" ); + if( name_string == "ShowFPS" ) m_GameOptions.m_bShowFPS = ( value_string == "1" ); + if( name_string == "UseRandomVis" ) m_GameOptions.m_bUseRandomVis = ( value_string == "1" ); + if( name_string == "Announcer" ) m_GameOptions.m_bAnnouncer = ( value_string == "1" ); + if( name_string == "ShowCaution" ) m_GameOptions.m_bShowCaution = ( value_string == "1" ); + if( name_string == "ShowSelectDifficulty" ) m_GameOptions.m_bShowSelectDifficulty = ( value_string == "1" ); + if( name_string == "ShowSelectGroup" ) m_GameOptions.m_bShowSelectGroup = ( value_string == "1" ); + if( name_string == "NumArcadeStages" ) m_GameOptions.m_iNumArcadeStages = atoi( value_string ); if( name_string == "JudgementDifficulty" ) m_GameOptions.m_JudgementDifficulty= (GameOptions::JudgementDifficulty) atoi( value_string ); } } @@ -193,14 +195,25 @@ void PrefsManager::SavePrefsToDisk() ini.SetValue( "GameOptions", "IgnoreJoyAxes", m_GameOptions.m_bIgnoreJoyAxes ? "1":"0" ); ini.SetValue( "GameOptions", "ShowFPS", m_GameOptions.m_bShowFPS ? "1":"0" ); ini.SetValue( "GameOptions", "UseRandomVis", m_GameOptions.m_bUseRandomVis ? "1":"0" ); - ini.SetValue( "GameOptions", "SkipCaution", m_GameOptions.m_bSkipCaution ? "1":"0" ); ini.SetValue( "GameOptions", "Announcer", m_GameOptions.m_bAnnouncer ? "1":"0" ); + ini.SetValue( "GameOptions", "ShowCaution", m_GameOptions.m_bShowCaution ? "1":"0" ); + ini.SetValue( "GameOptions", "ShowSelectDifficulty",m_GameOptions.m_bShowSelectDifficulty ? "1":"0" ); + ini.SetValue( "GameOptions", "ShowSelectGroup", m_GameOptions.m_bShowSelectGroup ? "1":"0" ); ini.WriteFile(); } +int PrefsManager::GetStageNumber() +{ + return m_iCurrentStage; +} + +bool PrefsManager::IsFinalStage() +{ + return m_GameOptions.m_iNumArcadeStages == m_iCurrentStage; +} CString PrefsManager::GetStageText() { diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index a10f179203..67fb265997 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -7,7 +7,7 @@ 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. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -28,16 +28,19 @@ public: SongSortOrder m_SongSortOrder; // used by MusicWheel and should be saved until the app exits GameMode m_GameMode; int m_iCurrentStage; // number of stages played +1 + + int GetStageNumber(); + bool IsFinalStage(); CString GetStageText(); - DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS]; - GameOptions m_GameOptions; - bool m_bWindowed; - GraphicProfile m_GraphicProfile; + DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS]; + GameOptions m_GameOptions; + bool m_bWindowed; + GraphicProfile m_GraphicProfile; GraphicProfileOptions* GetCustomGraphicProfileOptions(); GraphicProfileOptions* GetCurrentGraphicProfileOptions(); - PlayerOptions m_PlayerOptions[NUM_PLAYERS]; - SongOptions m_SongOptions; + PlayerOptions m_PlayerOptions[NUM_PLAYERS]; + SongOptions m_SongOptions; void ReadPrefsFromDisk(); diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index 98c5e26c55..ac0977ebe0 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -31,18 +31,22 @@ // RageBitmapTexture constructor //----------------------------------------------------------------------------- RageBitmapTexture::RageBitmapTexture( - RageScreen* pScreen, + RageDisplay* pScreen, const CString &sFilePath, - const DWORD dwMaxSize, - const DWORD dwTextureColorDepth, - const DWORD dwHints ) : - RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, dwHints ) + DWORD dwMaxSize, + DWORD dwTextureColorDepth, + int iMipMaps, + int iAlphaBits, + bool bDither, + bool bStretch + ) : + RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ) { // LOG->WriteLine( "RageBitmapTexture::RageBitmapTexture()" ); m_pd3dTexture = NULL; - Create( dwMaxSize, dwTextureColorDepth, dwHints ); + Create( dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ); CreateFrameRects(); } @@ -53,12 +57,16 @@ RageBitmapTexture::~RageBitmapTexture() } void RageBitmapTexture::Reload( - const DWORD dwMaxSize, - const DWORD dwTextureColorDepth, - const DWORD dwHints ) + DWORD dwMaxSize, + DWORD dwTextureColorDepth, + int iMipMaps, + int iAlphaBits, + bool bDither, + bool bStretch + ) { SAFE_RELEASE(m_pd3dTexture); - Create( dwMaxSize, dwTextureColorDepth, dwHints ); + Create( dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ); // leave m_iRefCount alone! CreateFrameRects(); } @@ -72,49 +80,51 @@ LPDIRECT3DTEXTURE8 RageBitmapTexture::GetD3DTexture() } -void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWORD dwHints ) +void RageBitmapTexture::Create( + DWORD dwMaxSize, + DWORD dwTextureColorDepth, + int iMipMaps, + int iAlphaBits, + bool bDither, + bool bStretch + ) { HRESULT hr; + // look in the file name for a format hints + m_sFilePath.MakeLower(); + + if( -1 != m_sFilePath.Find("no alpha") ) + iAlphaBits = 0; + else if( -1 != m_sFilePath.Find("1 alpha") ) + iAlphaBits = 1; + if( -1 != m_sFilePath.Find("dither") ) + bDither = true; + /////////////////////// // Figure out which texture format to use /////////////////////// D3DFORMAT fmtTexture; - - // look in the file name for a format hint - m_sFilePath.MakeLower(); - switch( dwTextureColorDepth ) { case 16: - if( -1 != m_sFilePath.Find("no alpha") ) - fmtTexture = D3DFMT_R5G6B5; - else if( -1 != m_sFilePath.Find("1 alpha") ) - fmtTexture = D3DFMT_A1R5G5B5; - else - fmtTexture = D3DFMT_A4R4G4B4; - break; + switch( iAlphaBits ) + { + case 0: fmtTexture = D3DFMT_R5G6B5; break; + case 1: fmtTexture = D3DFMT_A1R5G5B5; break; + default: fmtTexture = D3DFMT_A4R4G4B4; break; + } case 32: fmtTexture = D3DFMT_A8R8G8B8; break; default: - ASSERT( false ); // invalid color depth value + FatalError( "Invalid color depth: %d bits", dwTextureColorDepth ); } - - // look in the file name for a dither hint - bool bDither = (dwHints & TEXTURE_HINT_DITHER) - || -1 != m_sFilePath.Find("dither"); - - - bool bCreateMipMaps = !(dwHints & TEXTURE_HINT_NOMIPMAPS); - ///////////////////// // Figure out whether the texture can fit into texture memory unscaled ///////////////////// - bool bScaleImageToTextureSize; - D3DXIMAGE_INFO ddii; if( FAILED( hr = D3DXGetImageInfoFromFile( m_sFilePath, @@ -124,9 +134,9 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR } // find out what the min texture size is - dwMaxSize = min( dwMaxSize, SCREEN->GetDeviceCaps().MaxTextureWidth ); + dwMaxSize = min( dwMaxSize, DISPLAY->GetDeviceCaps().MaxTextureWidth ); - bScaleImageToTextureSize = ddii.Width > dwMaxSize || ddii.Height > dwMaxSize; + bStretch |= ddii.Width > dwMaxSize || ddii.Height > dwMaxSize; /* // HACK: The stupid Savage driver will report that it can hold the entire texture, @@ -139,13 +149,13 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR if( FAILED( hr = D3DXCreateTextureFromFileEx( m_pd3dDevice, // device m_sFilePath, // soure file - bScaleImageToTextureSize ? dwMaxSize : D3DX_DEFAULT, // width - bScaleImageToTextureSize ? dwMaxSize : D3DX_DEFAULT, // height - bCreateMipMaps ? 4 : 0, // mip map levels + bStretch ? dwMaxSize : D3DX_DEFAULT, // width + bStretch ? dwMaxSize : D3DX_DEFAULT, // height + iMipMaps, // mip map levels 0, // usage (is a render target?) fmtTexture, // our preferred texture format D3DPOOL_MANAGED, // which memory pool - (bScaleImageToTextureSize ? D3DX_FILTER_BOX : D3DX_FILTER_NONE) | (bDither ? D3DX_FILTER_DITHER : 0), // filter + (bStretch ? D3DX_FILTER_BOX : D3DX_FILTER_NONE) | (bDither ? D3DX_FILTER_DITHER : 0), // filter D3DX_FILTER_BOX | (bDither ? D3DX_FILTER_DITHER : 0), // mip filter 0, // no color key &ddii, // struct to fill with source image info @@ -171,7 +181,7 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR m_TextureFormat = ddsd.Format; - if( bScaleImageToTextureSize ) + if( bStretch ) { m_iImageWidth = m_iTextureWidth; m_iImageHeight = m_iTextureHeight; @@ -182,11 +192,11 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR m_iImageHeight = m_iSourceHeight; } - LOG->WriteLine( "RageBitmapTexture: Loaded '%s' (%ux%u) from disk. bScaleImageToTextureSize = %d, source %d,%d; image %d,%d.", + LOG->WriteLine( "RageBitmapTexture: Loaded '%s' (%ux%u) from disk. bStretch = %d, source %d,%d; image %d,%d.", m_sFilePath, GetTextureWidth(), GetTextureHeight(), - bScaleImageToTextureSize, + bStretch, m_iSourceWidth, m_iSourceHeight, m_iImageWidth, diff --git a/stepmania/src/RageBitmapTexture.h b/stepmania/src/RageBitmapTexture.h index be262bbcd6..d3efdf7026 100644 --- a/stepmania/src/RageBitmapTexture.h +++ b/stepmania/src/RageBitmapTexture.h @@ -1,30 +1,18 @@ +#pragma once /* ----------------------------------------------------------------------------- - File: RageBitmapTexture.h + Class: RageBitmapTexture Desc: Holder for a static texture with metadata. Can load just about any image format. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ - -class RageBitmapTexture; - - - -#ifndef _RageBitmapTexture_H_ -#define _RageBitmapTexture_H_ - - -#include "RageScreen.h" +#include "RageDisplay.h" #include #include -//#include - - -const DWORD TEXTURE_HINT_NOMIPMAPS = 1 << 0; -const DWORD TEXTURE_HINT_DITHER = 1 << 1; //----------------------------------------------------------------------------- @@ -34,26 +22,36 @@ class RageBitmapTexture : public RageTexture { public: RageBitmapTexture( - RageScreen* pScreen, + RageDisplay* pScreen, const CString &sFilePath, - const DWORD dwMaxSize = 2048, - const DWORD dwTextureColorDepth = 16, - const DWORD dwHints = 0 + DWORD dwMaxSize = 2048, + DWORD dwTextureColorDepth = 16, + int iMipMaps = 4, + int iAlphaBits = 4, + bool bDither = false, + bool bStretch = false ); ~RageBitmapTexture(); virtual void Reload( - const DWORD dwMaxSize, - const DWORD dwTextureColorDepth, - const DWORD dwHints ); - + DWORD dwMaxSize, + DWORD dwTextureColorDepth, + int iMipMaps = 4, + int iAlphaBits = 4, + bool bDither = false, + bool bStretch = false + ); virtual LPDIRECT3DTEXTURE8 GetD3DTexture(); protected: - virtual void Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWORD dwHints ); + virtual void Create( + DWORD dwMaxSize, + DWORD dwTextureColorDepth, + int iMipMaps, + int iAlphaBits, + bool bDither, + bool bStretch + ); LPDIRECT3DTEXTURE8 m_pd3dTexture; }; - - -#endif diff --git a/stepmania/src/RageInput.cpp b/stepmania/src/RageInput.cpp index b4f68310fa..878783820b 100644 --- a/stepmania/src/RageInput.cpp +++ b/stepmania/src/RageInput.cpp @@ -5,7 +5,7 @@ Desc: Wrapper for DirectInput. Generates InputEvents. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -28,7 +28,7 @@ #include "ErrorCatcher/ErrorCatcher.h" -RageInput* INPUTM = NULL; // globally accessable input device +RageInput* INPUTMAN = NULL; // globally accessable input device @@ -283,6 +283,8 @@ BOOL CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, RageInput::RageInput( HWND hWnd ) { + LOG->WriteLine( "RageInput::RageInput()" ); + int i; m_hWnd = hWnd; diff --git a/stepmania/src/RageInput.h b/stepmania/src/RageInput.h index 9661a473f8..13ace5dc01 100644 --- a/stepmania/src/RageInput.h +++ b/stepmania/src/RageInput.h @@ -1,17 +1,14 @@ +#pragma once /* ----------------------------------------------------------------------------- File: RageInput.h Desc: Wrapper for DirectInput. Generates InputEvents. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ -#ifndef _RAGEINPUT_H_ -#define _RAGEINPUT_H_ - - #ifndef DIRECTINPUT_VERSION #define DIRECTINPUT_VERSION 0x0800 #endif @@ -99,7 +96,7 @@ public: class RageInput { - // Our Windows Handle + // Our Screens Handle HWND m_hWnd; // Main DirectInput Object @@ -155,7 +152,4 @@ public: }; -extern RageInput* INPUTM; // global and accessable from anywhere in our program - - -#endif \ No newline at end of file +extern RageInput* INPUTMAN; // global and accessable from anywhere in our program diff --git a/stepmania/src/RageLog.cpp b/stepmania/src/RageLog.cpp index b881aad074..17dff0b98d 100644 --- a/stepmania/src/RageLog.cpp +++ b/stepmania/src/RageLog.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/RageLog.h b/stepmania/src/RageLog.h index cefcd27604..95c2859333 100644 --- a/stepmania/src/RageLog.h +++ b/stepmania/src/RageLog.h @@ -5,7 +5,7 @@ Desc: Manages logging - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/RageMovieTexture.cpp b/stepmania/src/RageMovieTexture.cpp index 8c48b49e12..ae82f1ebae 100644 --- a/stepmania/src/RageMovieTexture.cpp +++ b/stepmania/src/RageMovieTexture.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -243,12 +243,15 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample ) // RageMovieTexture constructor //----------------------------------------------------------------------------- RageMovieTexture::RageMovieTexture( - RageScreen* pScreen, + RageDisplay* pScreen, const CString &sFilePath, - const DWORD dwMaxSize, - const DWORD dwTextureColorDepth, - const DWORD dwHints ) : - RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, dwHints ) + DWORD dwMaxSize, + DWORD dwTextureColorDepth, + int iMipMaps, + int iAlphaBits, + bool bDither, + bool bStretch ) : + RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ) { LOG->WriteLine( "RageBitmapTexture::RageBitmapTexture()" ); @@ -269,9 +272,12 @@ RageMovieTexture::~RageMovieTexture() } void RageMovieTexture::Reload( - const DWORD dwMaxSize, - const DWORD dwTextureColorDepth, - const DWORD dwHints ) + DWORD dwMaxSize, + DWORD dwTextureColorDepth, + int iMipMaps, + int iAlphaBits, + bool bDither, + bool bStretch ) { // do nothing } diff --git a/stepmania/src/RageMovieTexture.h b/stepmania/src/RageMovieTexture.h index f792c7fb9e..f8391f9b76 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 persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -14,7 +14,7 @@ #define _RAGEMOVIETEXTURE_H_ -#include "RageScreen.h" +#include "RageDisplay.h" #include //#include #include @@ -75,17 +75,25 @@ class RageMovieTexture : public RageTexture { public: RageMovieTexture( - RageScreen* pScreen, + RageDisplay* pScreen, const CString &sFilePath, - const DWORD dwMaxSize, - const DWORD dwTextureColorDepth, - const DWORD dwHints ); + DWORD dwMaxSize = 2048, + DWORD dwTextureColorDepth = 16, + int iMipMaps = 4, + int iAlphaBits = 4, + bool bDither = false, + bool bStretch = false + ); virtual ~RageMovieTexture(); virtual void Reload( - const DWORD dwMaxSize, - const DWORD dwTextureColorDepth, - const DWORD dwHints ); + DWORD dwMaxSize, + DWORD dwTextureColorDepth, + int iMipMaps = 4, + int iAlphaBits = 4, + bool bDither = false, + bool bStretch = false + ); LPDIRECT3DTEXTURE8 GetD3DTexture(); diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index c95bdaa918..64a3dce970 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -40,7 +40,7 @@ RageSound::RageSound( HWND hWnd ) "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" "Before running this program again, please verify that your sound card is\n" - "is working in other Windows applications." + "is working in other Screens applications." ); } @@ -87,3 +87,17 @@ void RageSound::PlayOnceStreamed( CString sPath ) // this stream will free itself when stopped } +void RageSound::PlayOnceStreamedFromDir( CString sDir ) +{ + // make sure there's a backslash at the end of this path + if( sDir[sDir.GetLength()-1] != '\\' ) + sDir += "\\"; + + CStringArray arraySoundFiles; + GetDirListing( sDir + "*.mp3", arraySoundFiles ); + GetDirListing( sDir + "*.wav", arraySoundFiles ); + GetDirListing( sDir + "*.ogg", arraySoundFiles ); + + int index = rand() % arraySoundFiles.GetSize(); + PlayOnceStreamed( sDir + arraySoundFiles[index] ); +} diff --git a/stepmania/src/RageSound.h b/stepmania/src/RageSound.h index 21a78714dc..e5f15ab75b 100644 --- a/stepmania/src/RageSound.h +++ b/stepmania/src/RageSound.h @@ -5,7 +5,7 @@ Desc: Sound effects library (currently a wrapper around Bass Sound Library). - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -23,9 +23,10 @@ public: RageSound( HWND hWnd ); ~RageSound(); - float GetPlayLatency() { return m_info.latency / 1000.0f; }; + float GetPlayLatency() { return m_info.latency / 1000.0f; }; // latency between when Play() is called and sound starts coming out void PlayOnceStreamed( CString sPath ); + void PlayOnceStreamedFromDir( CString sDir ); private: HWND m_hWndApp; // this is set on GRAPHICS_Create() diff --git a/stepmania/src/RageTexture.cpp b/stepmania/src/RageTexture.cpp index a0861d2c99..0ca3a6da23 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -21,11 +21,14 @@ // RageTexture constructor //----------------------------------------------------------------------------- RageTexture::RageTexture( - RageScreen* pScreen, + RageDisplay* pScreen, const CString &sFilePath, - const DWORD dwMaxSize, - const DWORD dwTextureColorDepth, - const DWORD dwHints ) + DWORD dwMaxSize, + DWORD dwTextureColorDepth, + int iMipMaps, + int iAlphaBits, + bool bDither, + bool bStretch ) { // LOG->WriteLine( "RageTexture::RageTexture()" ); diff --git a/stepmania/src/RageTexture.h b/stepmania/src/RageTexture.h index 95f99ecefd..becfb5259d 100644 --- a/stepmania/src/RageTexture.h +++ b/stepmania/src/RageTexture.h @@ -5,7 +5,7 @@ Desc: Abstract class for a texture and holds metadata. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -13,7 +13,7 @@ -#include "RageScreen.h" +#include "RageDisplay.h" #include #include //#include @@ -32,7 +32,6 @@ public: }; - //----------------------------------------------------------------------------- // RageTexture Class Declarations //----------------------------------------------------------------------------- @@ -40,17 +39,25 @@ class RageTexture { public: RageTexture( - RageScreen* pScreen, + RageDisplay* pScreen, const CString &sFilePath, - const DWORD dwMaxSize, - const DWORD dwTextureColorDepth, - const DWORD dwHints ); + DWORD dwMaxSize = 2048, + DWORD dwTextureColorDepth = 16, + int iMipMaps = 4, + int iAlphaBits = 4, + bool bDither = false, + bool bStretch = false + ); virtual ~RageTexture() = 0; virtual void Reload( - const DWORD dwMaxSize, - const DWORD dwTextureColorDepth, - const DWORD dwHints ) = 0; + DWORD dwMaxSize = 2048, + DWORD dwTextureColorDepth = 16, + int iMipMaps = 4, + int iAlphaBits = 4, + bool bDither = false, + bool bStretch = false + ) = 0; virtual LPDIRECT3DTEXTURE8 GetD3DTexture() = 0; @@ -88,7 +95,7 @@ protected: int m_iSourceWidth, m_iSourceHeight; // dimensions of the original image loaded from disk int m_iTextureWidth, m_iTextureHeight; // dimensions of the texture in memory int m_iImageWidth, m_iImageHeight; // dimensions of the image in the texture - D3DFORMAT m_TextureFormat; + D3DFORMAT m_TextureFormat; // The number of frames of animation in each row and column of this texture. int m_iFramesWide, m_iFramesHigh; diff --git a/stepmania/src/RageTextureManager.cpp b/stepmania/src/RageTextureManager.cpp index 86ffaa4182..7858bd7d0a 100644 --- a/stepmania/src/RageTextureManager.cpp +++ b/stepmania/src/RageTextureManager.cpp @@ -1,11 +1,12 @@ #include "stdafx.h" /* ----------------------------------------------------------------------------- - File: RageTextureManager.cpp + Class: RageTextureManager - Desc: Interface for loading and releasing textures. + Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ @@ -20,12 +21,12 @@ #include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" -RageTextureManager* TEXTURE = NULL; +RageTextureManager* TEXTUREMAN = NULL; //----------------------------------------------------------------------------- // constructor/destructor //----------------------------------------------------------------------------- -RageTextureManager::RageTextureManager( RageScreen* pScreen ) +RageTextureManager::RageTextureManager( RageDisplay* pScreen ) { assert( pScreen != NULL ); m_pScreen = pScreen; @@ -43,7 +44,7 @@ RageTextureManager::~RageTextureManager() while( pos != NULL ) // iterate over all k/v pairs in map { m_mapPathToTexture.GetNextAssoc( pos, sPath, pTexture ); - LOG->WriteLine( "TEXTURE LEAK: '%s', RefCount = %d.", sPath, pTexture->m_iRefCount ); + LOG->WriteLine( "TEXTUREMAN LEAK: '%s', RefCount = %d.", sPath, pTexture->m_iRefCount ); SAFE_DELETE( pTexture ); } @@ -54,7 +55,7 @@ RageTextureManager::~RageTextureManager() //----------------------------------------------------------------------------- // Load/Unload textures from disk //----------------------------------------------------------------------------- -RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, const DWORD dwHints, const bool bForceReload ) +RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, bool bForceReload, int iMipMaps, int iAlphaBits, bool bDither, bool bStretch ) { sTexturePath.MakeLower(); @@ -72,7 +73,7 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, const DWORD { pTexture->m_iRefCount++; if( bForceReload ) - pTexture->Reload( m_dwMaxTextureSize, m_dwTextureColorDepth, dwHints ); + pTexture->Reload( m_dwMaxTextureSize, m_dwTextureColorDepth, iMipMaps, iAlphaBits, bDither ); LOG->WriteLine( "RageTextureManager: '%s' now has %d references.", sTexturePath, pTexture->m_iRefCount ); } @@ -82,12 +83,12 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, const DWORD splitpath( false, sTexturePath, sDrive, sDir, sFName, sExt ); if( sExt == "avi" || sExt == "mpg" || sExt == "mpeg" ) - pTexture = (RageTexture*) new RageMovieTexture( m_pScreen, sTexturePath, m_dwMaxTextureSize, m_dwTextureColorDepth, dwHints ); + pTexture = (RageTexture*) new RageMovieTexture( m_pScreen, sTexturePath, m_dwMaxTextureSize, m_dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ); else - pTexture = (RageTexture*) new RageBitmapTexture( m_pScreen, sTexturePath, m_dwMaxTextureSize, m_dwTextureColorDepth, dwHints ); + pTexture = (RageTexture*) new RageBitmapTexture( m_pScreen, sTexturePath, m_dwMaxTextureSize, m_dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ); - LOG->WriteLine( "RageTextureManager: Finished loading '%s' - %d references.", sTexturePath ); + LOG->WriteLine( "RageTextureManager: Finished loading '%s' - %d references.", sTexturePath, pTexture->m_iRefCount ); m_mapPathToTexture.SetAt( sTexturePath, pTexture ); diff --git a/stepmania/src/RageTextureManager.h b/stepmania/src/RageTextureManager.h index acf1b40997..599ab02d66 100644 --- a/stepmania/src/RageTextureManager.h +++ b/stepmania/src/RageTextureManager.h @@ -1,24 +1,15 @@ +#pragma once /* ----------------------------------------------------------------------------- - File: RageTextureManager.h + Class: RageTextureManager Desc: Interface for loading and releasing textures. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ - -class RageTextureManager; - - - -#ifndef _RAGETEXTUREMANAGER_H_ -#define _RAGETEXTUREMANAGER_H_ - - #include "RageTexture.h" -//#include -//#include //----------------------------------------------------------------------------- @@ -27,10 +18,10 @@ class RageTextureManager; class RageTextureManager { public: - RageTextureManager( RageScreen* pScreen ); + RageTextureManager( RageDisplay* pScreen ); ~RageTextureManager(); - RageTexture* LoadTexture( CString sTexturePath, const DWORD dwHints = 0, const bool bForceReload = false ); + RageTexture* LoadTexture( CString sTexturePath, bool bForceReload = false, int iMipMaps = 4, int iAlphaBits = 4, bool bDither = false, bool bStretch = false ); bool IsTextureLoaded( CString sTexturePath ); void UnloadTexture( CString sTexturePath ); void ReloadAll(); @@ -46,7 +37,7 @@ public: DWORD GetTextureColorDepth() { return m_dwTextureColorDepth; }; protected: - RageScreen* m_pScreen; + RageDisplay* m_pScreen; DWORD m_dwMaxTextureSize; DWORD m_dwTextureColorDepth; @@ -55,6 +46,4 @@ protected: CTypedPtrMap m_mapPathToTexture; }; -extern RageTextureManager* TEXTURE; // global and accessable from anywhere in our program - -#endif +extern RageTextureManager* TEXTUREMAN; // global and accessable from anywhere in our program diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 3819ed99d0..1470e96187 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -275,6 +275,49 @@ void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs ) ::FindClose( hFind ); } +ULONG GetHashForString( CString s ) +{ + ULONG hash = 0; + for( int i=0; iWriteLine( "DoesFileExist(%s)", sPath ); @@ -376,4 +418,20 @@ HINSTANCE GotoURL(LPCTSTR url) return result; } +void WriteStringToFile( FILE* file, CString s ) +{ + if( s == "" ) + s = "_"; + fprintf( file, "%s\n", s ); +} + +void ReadStringFromFile( FILE* file, CString& s ) +{ + char szTemp[MAX_PATH]; + fscanf( file, "%[^\n]\n", szTemp ); + s = szTemp; + if( s == "_" ) + s = ""; +} + diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index a17c9bea29..dbae1dcd49 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -1,18 +1,15 @@ +#pragma once /* ----------------------------------------------------------------------------- File: RageUtil Desc: Miscellaneous helper functions. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ -#ifndef _RAGEUTIL_H_ -#define _RAGEUTIL_H_ - - //----------------------------------------------------------------------------- // SAFE_ Macros @@ -27,6 +24,8 @@ //----------------------------------------------------------------------------- #define RECTWIDTH(rect) ((rect).right - (rect).left) #define RECTHEIGHT(rect) ((rect).bottom - (rect).top) +inline int RECTCENTERX(RECT rect) { return rect.left + (rect.right-rect.left)/2; } +inline int RECTCENTERY(RECT rect) { return rect.top + (rect.bottom-rect.top)/2; } #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) @@ -98,6 +97,9 @@ CString join( ); void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs=false ); +ULONG GetHashForString( CString s ); +ULONG GetHashForFile( CString sPath ); +ULONG GetHashForDirectory( CString sDir ); // a hash value that remains the same as long as nothing in the directory has changed bool DoesFileExist( const CString &sPath ); DWORD GetFileSizeInBytes( const CString &sFilePath ); @@ -110,5 +112,6 @@ void SortCStringArray( CStringArray &AddTo, const bool bSortAcsending = true ); LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata); HINSTANCE GotoURL(LPCTSTR url); +void WriteStringToFile( FILE* file, CString s ); +void ReadStringFromFile( FILE* file, CString& s ); -#endif diff --git a/stepmania/src/RandomSample.cpp b/stepmania/src/RandomSample.cpp index bb196f5e25..9ee5ef5919 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -37,6 +37,7 @@ bool RandomSample::LoadSoundDir( CString sDir ) CStringArray arraySoundFiles; GetDirListing( sDir + "*.mp3", arraySoundFiles ); + GetDirListing( sDir + "*.ogg", arraySoundFiles ); GetDirListing( sDir + "*.wav", arraySoundFiles ); for( int i=0; im_pStepsPlayer[m_PlayerNumber]; + Notes *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 19468f3703..d1f5015b1c 100644 --- a/stepmania/src/ScoreDisplayRolling.h +++ b/stepmania/src/ScoreDisplayRolling.h @@ -1,18 +1,15 @@ +#pragma once /* ----------------------------------------------------------------------------- - File: ScoreDisplayRolling.h + Class: ScoreDisplayRolling Desc: A graphic displayed in the ScoreDisplayRolling during Dancing. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ - -#ifndef _ScoreDisplayRolling_H_ -#define _ScoreDisplayRolling_H_ - - #include "Sprite.h" #include "Song.h" #include "ActorFrame.h" @@ -41,5 +38,3 @@ protected: int m_iCurrentScoreDigits[NUM_SCORE_DIGITS]; int m_iDestinationScoreDigits[NUM_SCORE_DIGITS]; }; - -#endif \ No newline at end of file diff --git a/stepmania/src/ScrollBar.cpp b/stepmania/src/ScrollBar.cpp index 09c33c684a..583169c8aa 100644 --- a/stepmania/src/ScrollBar.cpp +++ b/stepmania/src/ScrollBar.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/ScrollBar.h b/stepmania/src/ScrollBar.h index 3a48a3a71e..2ef1f4b32a 100644 --- a/stepmania/src/ScrollBar.h +++ b/stepmania/src/ScrollBar.h @@ -5,7 +5,7 @@ Desc: A graphic displayed in the ScrollBar during Dancing. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 907f105631..c2f549fe0a 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -5,12 +5,11 @@ Desc: Holds metadata for a song and the song's step data. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ - -#include "NoteMetadata.h" +#include "Notes.h" #include "RageUtil.h" #include "Song.h" @@ -73,7 +72,8 @@ Song::Song() m_bChangedSinceSave = false; m_fOffsetInSeconds = 0; m_fMusicSampleStartSeconds = m_fMusicSampleLengthSeconds = -1; - m_dwMusicBytes = 0; + m_iMusicBytes = 0; + m_fMusicLength = 0; } @@ -151,7 +151,7 @@ void Song::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, fl } -// This is a super hack, but it's only called from WindowEdit, so it's OK :-) +// This is a super hack, but it's only called from ScreenEdit, 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 ) @@ -194,6 +194,12 @@ void Song::GetMainAndSubTitlesFromFullTitle( CString sFullTitle, CString &sMainT sSubTitleOut = ""; }; +CString Song::GetCacheFilePath() +{ + ULONG hash = GetHashForString( m_sSongDir ); + return ssprintf( "Cache\\%u", hash ); +} + bool Song::LoadFromSongDir( CString sDir ) { LOG->WriteLine( "Song::LoadFromSongDir(%s)", sDir ); @@ -205,9 +211,18 @@ bool Song::LoadFromSongDir( CString sDir ) // save song dir m_sSongDir = sDir; - // We are going to load from either a .song or .msd file. - // If no .song files exist, then look for an .msd. + // + // First look in the cache for this song (without loading NoteData) + // + if( LoadFromCacheFile(false) ) + return true; + + + // + // There was no entry in the cache for this song. + // Let's load it from a file, then write a cache entry. + // CStringArray arrayBMSFileNames; GetDirListing( sDir + CString("*.bms"), arrayBMSFileNames ); int iNumBMSFiles = arrayBMSFileNames.GetSize(); @@ -222,9 +237,9 @@ bool Song::LoadFromSongDir( CString sDir ) if( iNumSongFiles > 1 ) - FatalError( "There is more than one DWI file in '%s'. Which one should I use?", sDir ); + FatalError( "There is more than one .song file in '%s'. There should be only one!", sDir ); else if( iNumDWIFiles > 1 ) - FatalError( "There is more than one DWI file in '%s'. Which one should I use?", sDir ); + FatalError( "There is more than one DWI file in '%s'. There should be only one!", sDir ); else if( iNumSongFiles == 1 ) LoadFromSMDir( sDir ); else if( iNumDWIFiles == 1 ) @@ -232,9 +247,18 @@ bool Song::LoadFromSongDir( CString sDir ) else if( iNumBMSFiles > 0 ) LoadFromBMSDir( sDir ); else - FatalError( "Couldn't find any Song, BMS, or MSD files in '%s'", sDir ); + FatalError( "Couldn't find any .song, BMS, or DWI files in '%s'. This is not a valid song directory.", sDir ); - return TRUE; + TidyUpData(); + + // + // In order to save memory, we're going to save the file back to the cache, + // then unload all the large NoteData. + // + SaveToCacheFile(); + LoadFromCacheFile( false ); + + return true; } @@ -268,11 +292,11 @@ bool Song::LoadFromBMSDir( CString sDir ) // is identical for every BMS file in the directory. m_sSongFilePath = m_sSongDir + arrayBMSFileNames[0]; - // load the NoteMetadata from the rest of the BMS files + // load the Notes from the rest of the BMS files for( int i=0; i') + // strip Notes type out of description leaving only song title (looks like 'B4U ') value_data.Replace( "(ANOTHER)", "" ); value_data.Replace( "(BASIC)", "" ); value_data.Replace( "(MANIAC)", "" ); @@ -387,15 +411,15 @@ bool Song::LoadFromBMSDir( CString sDir ) { case 01: // background music track float fBeatOffset; - fBeatOffset = NoteIndexToBeat( (float)iStepIndex ); + fBeatOffset = NoteRowToBeat( (float)iStepIndex ); float fBPS; fBPS = m_BPMSegments[0].m_fBPM/60.0f; m_fOffsetInSeconds = fBeatOffset / fBPS; - //LOG->WriteLine( "Found offset to be index %d, beat %f", iStepIndex, NoteIndexToBeat(iStepIndex) ); + //LOG->WriteLine( "Found offset to be index %d, beat %f", iStepIndex, NoteRowToBeat(iStepIndex) ); break; case 03: // bpm BPMSegment new_seg; - new_seg.m_fStartBeat = NoteIndexToBeat( (float)iStepIndex ); + new_seg.m_fStartBeat = NoteRowToBeat( (float)iStepIndex ); new_seg.m_fBPM = (float)arrayNotes[j]; m_BPMSegments.Add( new_seg ); // add to back for now (we'll sort later) @@ -412,9 +436,6 @@ bool Song::LoadFromBMSDir( CString sDir ) m_BPMSegments[i].m_fStartBeat, m_BPMSegments[i].m_fBPM, i ); - - TidyUpData(); - return TRUE; } @@ -535,7 +556,7 @@ bool Song::LoadFromDWIFile( CString sPath ) CStringArray arrayFreezeValues; split( arrayFreezeExpressions[f], "=", arrayFreezeValues ); float fIndex = atoi( arrayFreezeValues[0] ) * ELEMENTS_PER_BEAT / 4.0f; - float fFreezeBeat = NoteIndexToBeat( fIndex ); + float fFreezeBeat = NoteRowToBeat( fIndex ); float fFreezeSeconds = (float)atof( arrayFreezeValues[1] ) / 1000.0f; FreezeSegment new_seg; @@ -560,7 +581,7 @@ bool Song::LoadFromDWIFile( CString sPath ) CStringArray arrayBPMChangeValues; split( arrayBPMChangeExpressions[b], "=", arrayBPMChangeValues ); float fIndex = atoi( arrayBPMChangeValues[0] ) * ELEMENTS_PER_BEAT / 4.0f; - float fBeat = NoteIndexToBeat( fIndex ); + float fBeat = NoteRowToBeat( fIndex ); float fNewBPM = (float)atoi( arrayBPMChangeValues[1] ); BPMSegment new_seg; @@ -575,9 +596,9 @@ bool Song::LoadFromDWIFile( CString sPath ) else if( sValueName == "#SINGLE" || sValueName == "#DOUBLE" || sValueName == "#COUPLE" ) { - m_arrayNoteMetadatas.SetSize( m_arrayNoteMetadatas.GetSize()+1, 1 ); - NoteMetadata &new_NoteMetadata = m_arrayNoteMetadatas[ m_arrayNoteMetadatas.GetSize()-1 ]; - new_NoteMetadata.LoadFromDWITokens( + m_arrayNotes.SetSize( m_arrayNotes.GetSize()+1, 1 ); + Notes &new_Notes = m_arrayNotes[ m_arrayNotes.GetSize()-1 ]; + new_Notes.LoadFromDWITokens( arrayValueTokens[0], arrayValueTokens[1], arrayValueTokens[2], @@ -590,9 +611,6 @@ bool Song::LoadFromDWIFile( CString sPath ) ; } - TidyUpData(); - - return TRUE; } @@ -628,15 +646,15 @@ bool Song::LoadFromSMDir( CString sDir ) m_sSongFilePath = m_sSongDir + arraySongFileNames[0]; - CStringArray arrayNoteMetadataFileNames; - GetDirListing( sDir + CString("*.notes"), arrayNoteMetadataFileNames ); + CStringArray arrayNotesFileNames; + GetDirListing( sDir + CString("*.notes"), arrayNotesFileNames ); - // load the NoteMetadata from the rest of the BMS files - for( i=0; iWriteLine( "Unexpected value named '%s'", sValueName ); } - TidyUpData(); - return TRUE; } @@ -797,6 +813,14 @@ void Song::TidyUpData() // FatalError( ssprintf("Music could not be found. Please check the Song file '%s' and verify the specified #MUSIC exists.", GetSongFilePath()) ); } + // Save length of music + if( GetMusicPath() != "" ) + { + RageSoundStream sound; + sound.Load( GetMusicPath() ); + m_fMusicLength = sound.GetLengthSeconds(); + } + if( !DoesFileExist(GetBannerPath()) ) { m_sBannerPath = ""; @@ -872,149 +896,176 @@ void Song::TidyUpData() { m_sCDTitlePath = ""; } + + for( int i=0; im_fRadarValues[RADAR_STREAM] = pNM->GetNoteData()->GetStreamRadarValue( fMusicLength ); + pNM->m_fRadarValues[RADAR_VOLTAGE] = pNM->GetNoteData()->GetVoltageRadarValue( fMusicLength ); + pNM->m_fRadarValues[RADAR_AIR] = pNM->GetNoteData()->GetAirRadarValue( fMusicLength ); + pNM->m_fRadarValues[RADAR_CHAOS] = pNM->GetNoteData()->GetChaosRadarValue( fMusicLength ); + pNM->m_fRadarValues[RADAR_FREEZE] = pNM->GetNoteData()->GetFreezeRadarValue( fMusicLength ); + } } -void Song::GetNoteMetadatasThatMatchGameAndStyle( CString sGame, CString sStyle, CArray& arrayAddTo ) +void Song::GetNotessThatMatchGameAndStyle( CString sGame, CString sStyle, CArray& arrayAddTo ) { - for( int i=0; im_sGame && - ( sStyle == pCurNoteMetadata->m_sStyle || (sStyle == "versus" && pCurNoteMetadata->m_sStyle == "single") ) ) + if( sGame == pCurNotes->m_sIntendedGame && + ( sStyle == pCurNotes->m_sIntendedStyle || (sStyle == "versus" && pCurNotes->m_sIntendedStyle == "single") ) ) { - arrayAddTo.Add( pCurNoteMetadata ); + arrayAddTo.Add( pCurNotes ); } } } -/* -void Song::SaveOffsetChangeToDisk() +const int FILE_CACHE_VERSION = 9; // increment this when the cache file format changes + +void Song::SaveToCacheFile() { - CString sDir, sFName, sExt; - splitrelpath( GetSongFilePath(), sDir, sFName, sExt ); - sExt.MakeLower(); - - if( sExt == "bms" ) - { - for( int i=0; iWriteLine( "Song::Save()" ); + LOG->WriteLine( "Song::SaveToCacheFile()" ); int i; + CString sCacheFilePath = GetCacheFilePath(); - if( -1 != m_sSongDir.Find("DWI Support") ) - { - LOG->WriteLine("WARNING: Can't save to DWI support folder!"); + FILE* file = fopen( sCacheFilePath, "w" ); + ASSERT( file != NULL ); + if( file == NULL ) return; + + fprintf( file, "%d\n", FILE_CACHE_VERSION ); + fprintf( file, "%u\n", GetHashForDirectory(m_sSongDir) ); + WriteStringToFile( file, m_sSongDir ); + WriteStringToFile( file, m_sSongFilePath ); + WriteStringToFile( file, m_sGroupName ); + + WriteStringToFile( file, m_sMainTitle ); + WriteStringToFile( file, m_sSubTitle ); + WriteStringToFile( file, m_sArtist ); + WriteStringToFile( file, m_sCredit ); + fprintf( file, "%f\n", m_fOffsetInSeconds ); + + WriteStringToFile( file, m_sMusicPath ); + fprintf( file, "%d\n", m_iMusicBytes ); + fprintf( file, "%f\n", m_fMusicLength ); + fprintf( file, "%f\n", m_fMusicSampleStartSeconds ); + fprintf( file, "%f\n", m_fMusicSampleLengthSeconds ); + WriteStringToFile( file, m_sBannerPath ); + WriteStringToFile( file, m_sBackgroundPath ); + WriteStringToFile( file, m_sBackgroundMoviePath ); + WriteStringToFile( file, m_sCDTitlePath ); + + fprintf( file, "%d\n", m_BPMSegments.GetSize() ); + for( i=0; iWriteLine( "Song::LoadFromCacheFile( %i )", bLoadNoteData ); + + int i; + CString sCacheFilePath = GetCacheFilePath(); + + LOG->WriteLine( "cache file is '%s'.", sCacheFilePath ); + + FILE* file = fopen( sCacheFilePath, "r" ); + if( file == NULL ) + return false; + + int iCacheVersion; + fscanf( file, "%d\n", &iCacheVersion ); + if( iCacheVersion != FILE_CACHE_VERSION ) + { + LOG->WriteLine( "Cache file versions don't match '%s'.", sCacheFilePath ); + fclose( file ); + DeleteCacheFile(); + return false; } + ULONG hash; + fscanf( file, "%u\n", &hash ); + if( hash != GetHashForDirectory(m_sSongDir) ) + { + LOG->WriteLine( "Cache file is out of date.", sCacheFilePath ); + fclose( file ); + return false; + } + + ReadStringFromFile( file, m_sSongDir ); + ReadStringFromFile( file, m_sSongFilePath ); + ReadStringFromFile( file, m_sGroupName ); + + ReadStringFromFile( file, m_sMainTitle ); + ReadStringFromFile( file, m_sSubTitle ); + ReadStringFromFile( file, m_sArtist ); + ReadStringFromFile( file, m_sCredit ); + fscanf( file, "%f\n", &m_fOffsetInSeconds ); + + ReadStringFromFile( file, m_sMusicPath ); + fscanf( file, "%d\n", &m_iMusicBytes ); + fscanf( file, "%f\n", &m_fMusicLength ); + fscanf( file, "%f\n", &m_fMusicSampleStartSeconds ); + fscanf( file, "%f\n", &m_fMusicSampleLengthSeconds ); + ReadStringFromFile( file, m_sBannerPath ); + ReadStringFromFile( file, m_sBackgroundPath ); + ReadStringFromFile( file, m_sBackgroundMoviePath ); + ReadStringFromFile( file, m_sCDTitlePath ); + + int iNumBPMSegments; + fscanf( file, "%d\n", &iNumBPMSegments ); + m_BPMSegments.SetSize( iNumBPMSegments ); + for( i=0; iWriteLine( "Song::SaveToSMDir()" ); + + int i; // // rename all old files to avoid confusion // @@ -1082,7 +1133,7 @@ void Song::Save() else file.WriteString( "#MUSIC:;\n" ); - file.WriteString( ssprintf("#MUSICBYTES:%u;\n", m_dwMusicBytes) ); + file.WriteString( ssprintf("#MUSICBYTES:%u;\n", m_iMusicBytes) ); file.WriteString( ssprintf("#OFFSET:%f;\n", m_fOffsetInSeconds) ); file.WriteString( ssprintf("#SAMPLESTART:%f;\n", m_fMusicSampleStartSeconds) ); @@ -1113,30 +1164,33 @@ void Song::Save() file.Close(); // - // Save all NoteMetadatas for this file + // Save all Notess for this file // - for( i=0; i arrayNoteMetadatas; - this->GetNoteMetadatasThatMatchGameAndStyle( sGame, sStyle, arrayNoteMetadatas ); - SortNoteMetadataArrayByDifficultyClass( arrayNoteMetadatas ); + CArray arrayNotess; + this->GetNotessThatMatchGameAndStyle( sGame, sStyle, arrayNotess ); + SortNotesArrayByDifficultyClass( arrayNotess ); - for( int i=0; im_DifficultyClass == dc ) - return pNoteMetadata->m_TopGrade; + Notes* pNotes = arrayNotess[i]; + if( pNotes->m_DifficultyClass == dc ) + return pNotes->m_TopGrade; } return GRADE_NO_DATA; } + + + ///////////////////////////////////// // Sorting ///////////////////////////////////// diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 704cea3bf3..e5e479781e 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -16,15 +16,15 @@ #include "RageLog.h" #include "ErrorCatcher/ErrorCatcher.h" -SongManager* SONG = NULL; // global and accessable from anywhere in our program +SongManager* SONGMAN = 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.7f, 0.0f, 0.5f, 1 ), // pink + D3DXCOLOR( 0.4f, 0.2f, 0.6f, 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 @@ -37,7 +37,7 @@ SongManager::SongManager() { m_pCurSong = NULL; for( int p=0; p arraySongs; @@ -94,6 +94,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir ) // Check to see if they put a song directly inside of the group folder CStringArray arrayFiles; GetDirListing( ssprintf("%s\\%s\\*.mp3", sDir, sGroupDirName), arrayFiles ); + GetDirListing( ssprintf("%s\\%s\\*.ogg", sDir, sGroupDirName), arrayFiles ); GetDirListing( ssprintf("%s\\%s\\*.wav", sDir, sGroupDirName), arrayFiles ); if( arrayFiles.GetSize() > 0 ) FatalError( @@ -135,6 +136,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir ) } +/* void SongManager::LoadDWISongDir( CString DWIHome ) { // trim off the trailing slash if any @@ -185,7 +187,7 @@ void SongManager::LoadDWISongDir( CString DWIHome ) } } } - +*/ void SongManager::CleanUpSongArray() @@ -235,7 +237,7 @@ void SongManager::ReadStatisticsFromDisk() int iRetVal; int i; - // Parse for Song name and NoteMetadata name + // Parse for Song name and Notes name iRetVal = sscanf( name_string, "%[^:]::%[^\n]", szSongName, szStepsName ); if( iRetVal != 2 ) continue; // this line doesn't match what is expected @@ -255,35 +257,35 @@ void SongManager::ReadStatisticsFromDisk() continue; // skip this entry - // Search for the corresponding NoteMetadata pointer. - NoteMetadata* pNoteMetadata = NULL; - for( i=0; im_arrayNoteMetadatas.GetSize(); i++ ) + // Search for the corresponding Notes pointer. + Notes* pNotes = NULL; + for( i=0; im_arrayNotes.GetSize(); i++ ) { - if( pSong->m_arrayNoteMetadatas[i].m_sDescription == szStepsName ) // match! + if( pSong->m_arrayNotes[i].m_sDescription == szStepsName ) // match! { - pNoteMetadata = &pSong->m_arrayNoteMetadatas[i]; + pNotes = &pSong->m_arrayNotes[i]; break; } } - if( pNoteMetadata == NULL ) // didn't find a match + if( pNotes == NULL ) // didn't find a match continue; // skip this entry - // Parse the NoteMetadata statistics. + // Parse the Notes statistics. char szGradeLetters[10]; // longest possible string is "AAA" iRetVal = sscanf( value_string, "%d::%[^:]::%d::%d", - &pNoteMetadata->m_iNumTimesPlayed, + &pNotes->m_iNumTimesPlayed, szGradeLetters, - &pNoteMetadata->m_iTopScore, - &pNoteMetadata->m_iMaxCombo + &pNotes->m_iTopScore, + &pNotes->m_iMaxCombo ); if( iRetVal != 4 ) continue; - pNoteMetadata->m_TopGrade = StringToGrade( szGradeLetters ); + pNotes->m_TopGrade = StringToGrade( szGradeLetters ); } } } @@ -298,22 +300,22 @@ void SongManager::SaveStatisticsToDisk() { Song* pSong = m_pSongs[i]; - for( int j=0; jm_arrayNoteMetadatas.GetSize(); j++ ) // for each NoteMetadata + for( int j=0; jm_arrayNotes.GetSize(); j++ ) // for each Notes { - NoteMetadata* pNoteMetadata = &pSong->m_arrayNoteMetadatas[j]; + Notes* pNotes = &pSong->m_arrayNotes[j]; - if( pNoteMetadata->m_TopGrade == GRADE_NO_DATA ) + if( pNotes->m_TopGrade == GRADE_NO_DATA ) continue; // skip - // Each value has the format "SongName::NoteMetadataName=TimesPlayed::TopGrade::TopScore::MaxCombo". + // Each value has the format "SongName::NotesName=TimesPlayed::TopGrade::TopScore::MaxCombo". - CString sName = ssprintf( "%s::%s", pSong->GetMainTitle(), pNoteMetadata->m_sDescription ); + CString sName = ssprintf( "%s::%s", pSong->GetMainTitle(), pNotes->m_sDescription ); CString sValue = ssprintf( "%d::%s::%d::%d", - pNoteMetadata->m_iNumTimesPlayed, - GradeToString( pNoteMetadata->m_TopGrade ), - pNoteMetadata->m_iTopScore, - pNoteMetadata->m_iMaxCombo + pNotes->m_iNumTimesPlayed, + GradeToString( pNotes->m_TopGrade ), + pNotes->m_iTopScore, + pNotes->m_iMaxCombo ); ini.SetValue( "Statistics", sName, sValue ); diff --git a/stepmania/src/SongManager.h b/stepmania/src/SongManager.h index 0a7c46592d..0a04d1cb87 100644 --- a/stepmania/src/SongManager.h +++ b/stepmania/src/SongManager.h @@ -1,18 +1,16 @@ +#pragma once /* ----------------------------------------------------------------------------- Class: SongManager - Desc: Holder for all Songs and NoteMetadata. Also keeps track of the current - Song and NoteMetadata, and loads/saves statistics. + Desc: Holder for all Songs and Notes. Also keeps track of the current + Song and Notes, and loads/saves statistics. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ -#ifndef _SongManager_H_ -#define _SongManager_H_ - #include "Song.h" //#include // for D3DXCOLOR @@ -25,7 +23,7 @@ public: ~SongManager(); Song* m_pCurSong; - NoteMetadata* m_pCurNoteMetadata[NUM_PLAYERS]; + Notes* m_pCurNotes[NUM_PLAYERS]; CString m_sPreferredGroup; CArray m_pSongs; // all songs that can be played @@ -57,7 +55,4 @@ protected: }; -extern SongManager* SONG; // global and accessable from anywhere in our program - - -#endif \ No newline at end of file +extern SongManager* SONGMAN; // global and accessable from anywhere in our program diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index e5ee5b532e..18a8aac518 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -33,16 +33,16 @@ Sprite::~Sprite() { // LOG->WriteLine( "Sprite Destructor" ); - TEXTURE->UnloadTexture( m_sTexturePath ); + TEXTUREMAN->UnloadTexture( m_sTexturePath ); } -bool Sprite::LoadFromTexture( CString sTexturePath, DWORD dwHints, bool bForceReload ) +bool Sprite::LoadFromTexture( CString sTexturePath, bool bForceReload, int iMipMaps, int iAlphaBits, bool bDither, bool bStretch ) { LOG->WriteLine( ssprintf("Sprite::LoadFromTexture(%s)", sTexturePath) ); //Init(); - return LoadTexture( sTexturePath, dwHints, bForceReload ); + return LoadTexture( sTexturePath, bForceReload, iMipMaps, iAlphaBits, bDither, bStretch ); } // Sprite file has the format: @@ -53,7 +53,7 @@ bool Sprite::LoadFromTexture( CString sTexturePath, DWORD dwHints, bool bForceRe // Delay0000=1.0 // Frame0001=3 // Delay0000=2.0 -bool Sprite::LoadFromSpriteFile( CString sSpritePath, DWORD dwHints, bool bForceReload ) +bool Sprite::LoadFromSpriteFile( CString sSpritePath, bool bForceReload, int iMipMaps, int iAlphaBits, bool bDither, bool bStretch ) { LOG->WriteLine( ssprintf("Sprite::LoadFromSpriteFile(%s)", sSpritePath) ); @@ -123,12 +123,12 @@ bool Sprite::LoadFromSpriteFile( CString sSpritePath, DWORD dwHints, bool bForce void Sprite::UnloadTexture() { if( m_pTexture != NULL ) // If there was a previous bitmap... - TEXTURE->UnloadTexture( m_sTexturePath ); // Unload it. + TEXTUREMAN->UnloadTexture( m_sTexturePath ); // Unload it. m_pTexture = NULL; m_sTexturePath = ""; } -bool Sprite::LoadTexture( CString sTexturePath, DWORD dwHints, bool bForceReload ) +bool Sprite::LoadTexture( CString sTexturePath, bool bForceReload, int iMipMaps, int iAlphaBits, bool bDither, bool bStretch ) { if( m_pTexture != NULL ) // If there was a previous bitmap... UnloadTexture(); @@ -136,7 +136,7 @@ bool Sprite::LoadTexture( CString sTexturePath, DWORD dwHints, bool bForceReload m_sTexturePath = sTexturePath; - m_pTexture = TEXTURE->LoadTexture( m_sTexturePath, dwHints, bForceReload ); + m_pTexture = TEXTUREMAN->LoadTexture( m_sTexturePath, bForceReload, iMipMaps, iAlphaBits, bDither, bStretch ); assert( m_pTexture != NULL ); // the size of the sprite is the size of the image before it was scaled @@ -184,9 +184,9 @@ void Sprite::Update( float fDeltaTime ) } -void Sprite::RenderPrimitives() +void Sprite::DrawPrimitives() { - SCREEN->TranslateLocal( -0.5f, -0.5f, 0 ); // offset so that pixels are aligned to texels + DISPLAY->TranslateLocal( -0.5f, -0.5f, 0 ); // offset so that pixels are aligned to texels if( m_pTexture == NULL ) return; @@ -217,8 +217,8 @@ void Sprite::RenderPrimitives() } - LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer(); - CUSTOMVERTEX* v; + LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer(); + RAGEVERTEX* v; pVB->Lock( 0, 0, (BYTE**)&v, 0 ); v[0].p = D3DXVECTOR3( quadVerticies.left, quadVerticies.bottom, 0 ); // bottom left @@ -252,14 +252,14 @@ void Sprite::RenderPrimitives() // Set the stage... - LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice(); + LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice(); pd3dDevice->SetTexture( 0, m_pTexture->GetD3DTexture() ); pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA ); pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA ); - pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX ); - pd3dDevice->SetStreamSource( 0, pVB, sizeof(CUSTOMVERTEX) ); + pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX ); + pd3dDevice->SetStreamSource( 0, pVB, sizeof(RAGEVERTEX) ); @@ -270,8 +270,8 @@ void Sprite::RenderPrimitives() ////////////////////// if( m_bShadow ) { - SCREEN->PushMatrix(); - SCREEN->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units + DISPLAY->PushMatrix(); + DISPLAY->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units pVB->Lock( 0, 0, (BYTE**)&v, 0 ); @@ -288,7 +288,7 @@ void Sprite::RenderPrimitives() pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 ); - SCREEN->PopMatrix(); + DISPLAY->PopMatrix(); } @@ -345,6 +345,8 @@ void Sprite::RenderPrimitives() void Sprite::SetState( int iNewState ) { ASSERT( iNewState >= 0 && iNewState < m_iNumStates ); + if( iNewState < 0 ) + iNewState = 0; m_iCurState = iNewState; m_fSecsIntoState = 0.0; } diff --git a/stepmania/src/Sprite.h b/stepmania/src/Sprite.h index a2061a8e60..a7dac59954 100644 --- a/stepmania/src/Sprite.h +++ b/stepmania/src/Sprite.h @@ -1,16 +1,14 @@ +#pragma once /* ----------------------------------------------------------------------------- File: Sprite.h Desc: A bitmap Actor that animates and moves around. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ -#ifndef _SPRITE_H_ -#define _SPRITE_H_ - #include "Actor.h" #include "RageUtil.h" @@ -28,18 +26,18 @@ public: Sprite(); virtual ~Sprite(); - virtual bool Load( CString sFilePath, DWORD dwHints = 0, bool bForceReload = false ) + virtual bool Load( CString sFilePath, bool bForceReload = false, int iMipMaps = 4, int iAlphaBits = 4, bool bDither = false, bool bStretch = false ) { ASSERT( sFilePath != "" ); if( sFilePath.Right(7) == ".sprite" ) - return LoadFromSpriteFile( sFilePath, dwHints, bForceReload ); + return LoadFromSpriteFile( sFilePath, bForceReload, iMipMaps, iAlphaBits, bDither, bStretch ); else - return LoadFromTexture( sFilePath, dwHints, bForceReload ); + return LoadFromTexture( sFilePath, bForceReload, iMipMaps, iAlphaBits, bDither, bStretch ); }; void UnloadTexture(); RageTexture* GetTexture() { return m_pTexture; }; - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); virtual void Update( float fDeltaTime ); virtual void StartAnimating() { m_bIsAnimating = TRUE; }; @@ -59,10 +57,10 @@ public: protected: - virtual bool LoadFromTexture( CString sTexturePath, DWORD dwHints = 0, bool bForceReload = false ); - virtual bool LoadFromSpriteFile( CString sSpritePath, DWORD dwHints = 0, bool bForceReload = false ); + virtual bool LoadFromTexture( CString sTexturePath, bool bForceReload = false, int iMipMaps = 4, int iAlphaBits = 4, bool bDither = false, bool bStretch = false ); + virtual bool LoadFromSpriteFile( CString sSpritePath, bool bForceReload = false, int iMipMaps = 4, int iAlphaBits = 4, bool bDither = false, bool bStretch = false ); - virtual bool LoadTexture( CString sTexture, DWORD dwHints = 0, bool bForceReload = false ); + virtual bool LoadTexture( CString sTexture, bool bForceReload = false, int iMipMaps = 4, int iAlphaBits = 4, bool bDither = false, bool bStretch = false ); @@ -81,6 +79,3 @@ protected: //FRECT m_CustomTexCoordRect; float m_CustomTexCoords[8]; // (x,y) * 4 }; - - -#endif \ No newline at end of file diff --git a/stepmania/src/StdAfx.cpp b/stepmania/src/StdAfx.cpp index c984fceb7d..e45b9deb6b 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/StdAfx.h b/stepmania/src/StdAfx.h index c813681dd0..c7f2c3c532 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -15,13 +15,13 @@ #pragma once #endif // _MSC_VER >= 1000 -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define VC_EXTRALEAN // Exclude rarely-used stuff from Screens headers #include // MFC core and standard components #include // MFC extensions #include // MFC templated collections #ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls +#include // MFC support for Screens Common Controls #endif // _AFX_NO_AFXCMN_SUPPORT @@ -29,7 +29,7 @@ // Rage global classes // #include "RageLog.h" -#include "RageScreen.h" +#include "RageDisplay.h" #include "RageTextureManager.h" #include "RageSound.h" #include "RageMusic.h" diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 3b29585385..54c516d498 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -5,7 +5,7 @@ Desc: - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -20,33 +20,33 @@ #include "PrefsManager.h" #include "SongManager.h" #include "ThemeManager.h" -#include "WindowManager.h" +#include "AnnouncerManager.h" +#include "ScreenManager.h" #include "GameManager.h" #include "FontManager.h" #include "InputFilter.h" #include "InputMapper.h" +#include "InputQueue.h" // // StepMania common classes // #include "Font.h" #include "GameConstantsAndTypes.h" -#include "GameConstantsAndTypes.h" #include "GameInput.h" #include "StyleInput.h" #include "Song.h" #include "StyleDef.h" #include "NoteData.h" -#include "NoteMetadata.h" +#include "Notes.h" -#include "WindowSandbox.h" -#include "WindowResults.h" -#include "WindowTitleMenu.h" -#include "WindowPlayerOptions.h" -#include "WindowMusicScroll.h" - -#include "GameConstantsAndTypes.h" +#include "ScreenSandbox.h" +#include "ScreenResults.h" +#include "ScreenTitleMenu.h" +#include "ScreenPlayerOptions.h" +#include "ScreenMusicScroll.h" +#include "ScreenSelectMusic.h" // error catcher stuff #include "ErrorCatcher/ErrorCatcher.h" @@ -96,7 +96,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow ); // wi void MainLoop(); // put everything in here so we can wrap it in a try...catch block void Update(); // Update the game logic void Render(); // Render a frame -void ShowFrame(); // Display the contents of the back buffer to the screen +void ShowFrame(); // Display the contents of the back buffer to the Window // Functions that work with game objects HRESULT CreateObjects( HWND hWnd ); // allocate and initialize game objects @@ -183,6 +183,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow ) if( NULL == g_hWndMain ) exit(1); + ShowWindow( g_hWndMain, SW_HIDE ); @@ -231,6 +232,9 @@ void MainLoop() // run the game CreateObjects( g_hWndMain ); // Create the game objects + ShowWindow( g_hWndMain, SW_SHOW ); + + // Now we're ready to recieve and process Windows messages. MSG msg; ZeroMemory( &msg, sizeof(msg) ); @@ -254,8 +258,8 @@ void MainLoop() { Update(); Render(); - if( SCREEN && SCREEN->IsWindowed() ) - ::Sleep( 0 ); // give some time to other processes + if( DISPLAY && DISPLAY->IsWindowed() ) + ::Sleep( 1 ); // give some time to other processes } } // end while( WM_QUIT != msg.message ) @@ -368,7 +372,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) case WM_GETMINMAXINFO: { // Don't allow the window to be resized smaller than the screen resolution. - // This should snap to multiples of the screen size two! + // This should snap to multiples of the Window size two! RECT rcWnd; SetRect( &rcWnd, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); @@ -382,7 +386,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) case WM_SETCURSOR: // Turn off Windows cursor in fullscreen mode - if( SCREEN && !SCREEN->IsWindowed() ) + if( DISPLAY && !DISPLAY->IsWindowed() ) { SetCursor( NULL ); return TRUE; // prevent Windows from setting the cursor @@ -430,7 +434,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) } case WM_NCHITTEST: // Prevent the user from selecting the menu in fullscreen mode - if( SCREEN && !SCREEN->IsWindowed() ) + if( DISPLAY && !DISPLAY->IsWindowed() ) return HTCLIENT; break; @@ -456,7 +460,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) HRESULT CreateObjects( HWND hWnd ) { // - // Draw a splash bitmap so the user isn't looking at a black screen + // Draw a splash bitmap so the user isn't looking at a black Window // HBITMAP hSplashBitmap = (HBITMAP)LoadImage( GetModuleHandle( NULL ), @@ -491,14 +495,16 @@ HRESULT CreateObjects( HWND hWnd ) LOG = new RageLog(); SOUND = new RageSound( hWnd ); MUSIC = new RageSoundStream; - INPUTM = new RageInput( hWnd ); + INPUTMAN= new RageInput( hWnd ); PREFS = new PrefsManager; - SCREEN = new RageScreen( hWnd ); - SONG = new SongManager; // this takes a long time to load + DISPLAY = new RageDisplay( hWnd ); + SONGMAN = new SongManager; // this takes a long time to load GAME = new GameManager; THEME = new ThemeManager; - FILTER = new InputFilter(); - MAPPER = new InputMapper(); + ANNOUNCER = new AnnouncerManager; + INPUTFILTER = new InputFilter(); + INPUTMAPPER = new InputMapper(); + INPUTQUEUE = new InputQueue(); BringWindowToTop( hWnd ); SetForegroundWindow( hWnd ); @@ -507,27 +513,23 @@ HRESULT CreateObjects( HWND hWnd ) // Set the display mode to make sure the D3D device is created. ApplyGraphicOptions(); - TEXTURE = new RageTextureManager( SCREEN ); - - // Ugly... Set graphic options again so the TextureManager knows our preferences - ApplyGraphicOptions(); + TEXTUREMAN = new RageTextureManager( DISPLAY ); // These things depend on the TextureManager, so do them last! FONT = new FontManager; - WM = new WindowManager; + SCREENMAN = new ScreenManager; - // Ugly... Switch the screen resolution again so that the system message will display - ApplyGraphicOptions(); - - WM->SystemMessage( ssprintf("Found %d songs.", SONG->m_pSongs.GetSize()) ); +// SCREENMAN->SystemMessage( ssprintf("Found %d songs.", SONGMAN->m_pSongs.GetSize()) ); - //WM->SetNewWindow( new WindowLoading ); - //WM->SetNewWindow( new WindowSandbox ); - //WM->SetNewWindow( new WindowResults ); - //WM->SetNewWindow( new WindowPlayerOptions ); - WM->SetNewWindow( new WindowTitleMenu ); - //WM->SetNewWindow( new WindowMusicScroll ); + //SCREENMAN->SetNewScreen( new ScreenLoading ); + //SCREENMAN->SetNewScreen( new ScreenSandbox ); + //SCREENMAN->SetNewScreen( new ScreenResults ); + //SCREENMAN->SetNewScreen( new ScreenPlayerOptions ); + SCREENMAN->SetNewScreen( new ScreenTitleMenu ); + //SCREENMAN->SetNewScreen( new ScreenMusicScroll ); + //SCREENMAN->SetNewScreen( new ScreenSelectMusic ); + //SCREENMAN->SetNewScreen( new ScreenSelectGroup ); DXUtil_Timer( TIMER_START ); // Start the accurate timer @@ -544,19 +546,21 @@ void DestroyObjects() { DXUtil_Timer( TIMER_STOP ); - SAFE_DELETE( WM ); - SAFE_DELETE( PREFS ); - SAFE_DELETE( SONG ); - SAFE_DELETE( GAME ); + SAFE_DELETE( SCREENMAN ); SAFE_DELETE( FONT ); - SAFE_DELETE( FILTER ); - SAFE_DELETE( MAPPER ); - - SAFE_DELETE( INPUTM ); + SAFE_DELETE( TEXTUREMAN ); + SAFE_DELETE( INPUTQUEUE ); + SAFE_DELETE( INPUTMAPPER ); + SAFE_DELETE( INPUTFILTER ); + SAFE_DELETE( ANNOUNCER ); + SAFE_DELETE( THEME ); + SAFE_DELETE( GAME ); + SAFE_DELETE( SONGMAN ); + SAFE_DELETE( DISPLAY ); + SAFE_DELETE( PREFS ); + SAFE_DELETE( INPUTMAN ); SAFE_DELETE( MUSIC ); SAFE_DELETE( SOUND ); - SAFE_DELETE( TEXTURE ); - SAFE_DELETE( SCREEN ); SAFE_DELETE( LOG ); } @@ -573,7 +577,7 @@ HRESULT RestoreObjects() // Set window size RECT rcWnd; - if( SCREEN->IsWindowed() ) + if( DISPLAY->IsWindowed() ) { SetRect( &rcWnd, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); AdjustWindowRect( &rcWnd, g_dwWindowStyle, FALSE ); @@ -597,7 +601,7 @@ HRESULT RestoreObjects() // Restore all game objects /////////////////////////// - SCREEN->Restore(); + DISPLAY->Restore(); return S_OK; } @@ -609,7 +613,7 @@ HRESULT RestoreObjects() //----------------------------------------------------------------------------- HRESULT InvalidateObjects() { - SCREEN->Invalidate(); + DISPLAY->Invalidate(); return S_OK; } @@ -624,25 +628,25 @@ void Update() { float fDeltaTime = DXUtil_Timer( TIMER_GETELAPSEDTIME ); - // This was a hack to fix timing issues with the old WindowSelectSong + // This was a hack to fix timing issues with the old ScreenSelectSong // if( fDeltaTime > 0.050f ) // we dropped a bunch of frames fDeltaTime = 0.050f; - if( INPUTM->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_TAB) ) ) + if( INPUTMAN->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_TAB) ) ) fDeltaTime *= 4; - if( INPUTM->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_LSHIFT) ) ) + if( INPUTMAN->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_LSHIFT) ) ) fDeltaTime /= 4; MUSIC->Update( fDeltaTime ); - WM->Update( fDeltaTime ); + SCREENMAN->Update( fDeltaTime ); static InputEventArray ieArray; ieArray.SetSize( 0, 20 ); // zero the array - FILTER->GetInputEvents( ieArray, fDeltaTime ); + INPUTFILTER->GetInputEvents( ieArray, fDeltaTime ); DeviceInput DeviceI; InputEventType type; @@ -655,15 +659,18 @@ void Update() DeviceI = (DeviceInput)ieArray[i]; type = ieArray[i].type; - MAPPER->DeviceToGame( DeviceI, GameI ); + INPUTMAPPER->DeviceToGame( DeviceI, GameI ); - MenuI = MAPPER->DeviceToMenu( DeviceI ); + MenuI = INPUTMAPPER->DeviceToMenu( DeviceI ); if( !MenuI.IsValid() ) // try again - MAPPER->GameToMenu( GameI, MenuI ); + INPUTMAPPER->GameToMenu( GameI, MenuI ); - MAPPER->GameToStyle( GameI, StyleI ); + if( MenuI.IsValid() && type == IET_FIRST_PRESS ) + INPUTQUEUE->HandleInput( MenuI.player, MenuI.button ); - WM->Input( DeviceI, type, GameI, MenuI, StyleI ); + INPUTMAPPER->GameToStyle( GameI, StyleI ); + + SCREENMAN->Input( DeviceI, type, GameI, MenuI, StyleI ); } } @@ -675,7 +682,7 @@ void Update() //----------------------------------------------------------------------------- void Render() { - HRESULT hr = SCREEN->BeginFrame(); + HRESULT hr = DISPLAY->BeginFrame(); switch( hr ) { case D3DERR_DEVICELOST: @@ -686,7 +693,7 @@ void Render() InvalidateObjects(); // Resize the device - if( SUCCEEDED( hr = SCREEN->Reset() ) ) + if( SUCCEEDED( hr = DISPLAY->Reset() ) ) { // Initialize the app's device-dependent objects RestoreObjects(); @@ -694,14 +701,14 @@ void Render() } else { - FatalErrorHr( hr, "Failed to SCREEN->Reset()" ); + FatalErrorHr( hr, "Failed to DISPLAY->Reset()" ); } break; case S_OK: { // set texture and alpha properties - LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice(); + LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice(); // calculate view and projection transforms D3DXMATRIX matProj; @@ -712,14 +719,14 @@ void Render() D3DXMatrixIdentity( &matView ); pd3dDevice->SetTransform( D3DTS_VIEW, &matView ); - SCREEN->ResetMatrixStack(); + DISPLAY->ResetMatrixStack(); // draw the game - WM->Draw(); + SCREENMAN->Draw(); - SCREEN->EndFrame(); + DISPLAY->EndFrame(); } break; } @@ -735,8 +742,8 @@ void Render() void ShowFrame() { // display the contents of the back buffer to the front - if( SCREEN ) - SCREEN->ShowFrame(); + if( DISPLAY ) + DISPLAY->ShowFrame(); } @@ -762,25 +769,25 @@ void ApplyGraphicOptions() // // If the requested resolution doesn't work, keep switching until we find one that does. // - if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) + if( !DISPLAY->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) { // We failed. Try full screen with same params. bWindowed = false; - if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) + if( !DISPLAY->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) { // Failed again. Try 16 BPP dwDisplayBPP = 16; - if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) + if( !DISPLAY->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) { // Failed again. Try 640x480 dwWidth = 640; dwHeight = 480; - if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) + if( !DISPLAY->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) { // Failed again. Try 320x240 dwWidth = 320; dwHeight = 240; - if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) + if( !DISPLAY->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwDisplayBPP, dwFlags ) ) { FatalError( "Tried every possible display mode, and couldn't change to any of them." ); } @@ -792,20 +799,20 @@ void ApplyGraphicOptions() // // Let the texture manager know about our preferences // - if( TEXTURE != NULL ) - TEXTURE->SetPrefs( dwMaxTextureSize, dwTextureBPP ); + if( TEXTUREMAN != NULL ) + TEXTUREMAN->SetPrefs( dwMaxTextureSize, dwTextureBPP ); RestoreObjects(); PREFS->SavePrefsToDisk(); - if( WM ) + if( SCREENMAN ) { CString sMessage = ssprintf("%s - %s detail", bWindowed ? "Windowed" : "FullScreen", sProfileName ); if( PREFS->m_GraphicProfile == PROFILE_CUSTOM ) sMessage += ssprintf(" - %ux%u - %u color, %u texture", dwWidth, dwHeight, dwDisplayBPP, dwTextureBPP); - WM->SystemMessage( sMessage ); + SCREENMAN->SystemMessage( sMessage ); } } diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index e3282129c2..134dcb3676 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -100,6 +100,14 @@ SOURCE=.\RageBitmapTexture.h # End Source File # Begin Source File +SOURCE=.\RageDisplay.cpp +# End Source File +# Begin Source File + +SOURCE=.\RageDisplay.h +# End Source File +# Begin Source File + SOURCE=.\RageInput.cpp # End Source File # Begin Source File @@ -132,14 +140,6 @@ SOURCE=.\RageMusic.h # End Source File # Begin Source File -SOURCE=.\RageScreen.cpp -# End Source File -# Begin Source File - -SOURCE=.\RageScreen.h -# End Source File -# Begin Source File - SOURCE=.\RageSound.cpp # End Source File # Begin Source File @@ -187,214 +187,6 @@ SOURCE=.\RageUtil.cpp SOURCE=.\RageUtil.h # End Source File # End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\Window.cpp -# End Source File -# Begin Source File - -SOURCE=.\Window.h -# End Source File -# Begin Source File - -SOURCE=.\WindowCaution.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowCaution.h -# End Source File -# Begin Source File - -SOURCE=.\WindowConfigurePads.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowConfigurePads.h -# End Source File -# Begin Source File - -SOURCE=.\WindowDancing.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowDancing.h -# End Source File -# Begin Source File - -SOURCE=.\WindowEdit.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowEdit.h -# End Source File -# Begin Source File - -SOURCE=.\WindowEditMenu.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowEditMenu.h -# End Source File -# Begin Source File - -SOURCE=.\WindowGameOptions.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowGameOptions.h -# End Source File -# Begin Source File - -SOURCE=.\WindowGraphicOptions.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowGraphicOptions.h -# End Source File -# Begin Source File - -SOURCE=.\WindowManager.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowManager.h -# End Source File -# Begin Source File - -SOURCE=.\WindowMessage.h -# End Source File -# Begin Source File - -SOURCE=.\WindowOptions.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowOptions.h -# End Source File -# Begin Source File - -SOURCE=.\WindowOptionsType2.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowOptionsType2.h -# End Source File -# Begin Source File - -SOURCE=.\WindowPlayerOptions.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowPlayerOptions.h -# End Source File -# Begin Source File - -SOURCE=.\WindowPrompt.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowPrompt.h -# End Source File -# Begin Source File - -SOURCE=.\WindowResults.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowResults.h -# End Source File -# Begin Source File - -SOURCE=.\WindowSandbox.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowSandbox.h -# End Source File -# Begin Source File - -SOURCE=.\WindowSelectDifficulty.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowSelectDifficulty.h -# End Source File -# Begin Source File - -SOURCE=.\WindowSelectGame.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowSelectGame.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=.\WindowSelectMode.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowSelectMode.h -# End Source File -# Begin Source File - -SOURCE=.\WindowSelectMusic.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowSelectMusic.h -# End Source File -# Begin Source File - -SOURCE=.\WindowSelectStyle.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowSelectStyle.h -# End Source File -# Begin Source File - -SOURCE=.\WindowSongOptions.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowSongOptions.h -# End Source File -# Begin Source File - -SOURCE=.\WindowSynchronize.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowSynchronize.h -# End Source File -# Begin Source File - -SOURCE=.\WindowSynchronizeMenu.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowSynchronizeMenu.h -# End Source File -# Begin Source File - -SOURCE=.\WindowTitleMenu.cpp -# End Source File -# Begin Source File - -SOURCE=.\WindowTitleMenu.h -# End Source File -# End Group # Begin Group "Data Structures" # PROP Default_Filter "" @@ -408,14 +200,6 @@ SOURCE=.\Font.h # End Source File # Begin Source File -SOURCE=.\FontManager.cpp -# End Source File -# Begin Source File - -SOURCE=.\FontManager.h -# End Source File -# Begin Source File - SOURCE=.\GameConstants.h # End Source File # Begin Source File @@ -432,14 +216,6 @@ SOURCE=.\GameInput.h # End Source File # Begin Source File -SOURCE=.\GameManager.cpp -# End Source File -# Begin Source File - -SOURCE=.\GameManager.h -# End Source File -# Begin Source File - SOURCE=.\GameTypes.h # End Source File # Begin Source File @@ -452,22 +228,6 @@ 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 @@ -476,11 +236,11 @@ SOURCE=.\NoteData.h # End Source File # Begin Source File -SOURCE=.\NoteMetadata.cpp +SOURCE=.\Notes.cpp # End Source File # Begin Source File -SOURCE=.\NoteMetadata.h +SOURCE=.\Notes.h # End Source File # Begin Source File @@ -500,14 +260,6 @@ SOURCE=.\PlayerInput.h # End Source File # Begin Source File -SOURCE=.\PrefsManager.cpp -# End Source File -# Begin Source File - -SOURCE=.\PrefsManager.h -# End Source File -# Begin Source File - SOURCE=.\RandomSample.cpp # End Source File # Begin Source File @@ -532,14 +284,6 @@ SOURCE=.\song.h # End Source File # Begin Source File -SOURCE=.\SongManager.cpp -# End Source File -# Begin Source File - -SOURCE=.\SongManager.h -# End Source File -# Begin Source File - SOURCE=.\StyleDef.cpp # End Source File # Begin Source File @@ -550,14 +294,6 @@ SOURCE=.\StyleDef.h SOURCE=.\StyleInput.h # End Source File -# Begin Source File - -SOURCE=.\ThemeManager.cpp -# End Source File -# Begin Source File - -SOURCE=.\ThemeManager.h -# End Source File # End Group # Begin Group "File Types" @@ -708,11 +444,11 @@ SOURCE=.\BitmapText.h # End Source File # Begin Source File -SOURCE=.\RectangleActor.cpp +SOURCE=.\Quad.cpp # End Source File # Begin Source File -SOURCE=.\RectangleActor.h +SOURCE=.\Quad.h # End Source File # Begin Source File @@ -1035,6 +771,306 @@ SOURCE=.\ScoreDisplayRollingWithFrame.cpp SOURCE=.\ScoreDisplayRollingWithFrame.h # End Source File # End Group +# Begin Group "Screens" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\Screen.cpp +# End Source File +# Begin Source File + +SOURCE=.\Screen.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenCaution.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenCaution.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenEdit.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenEdit.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenEditMenu.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenEditMenu.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenGameOptions.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenGameOptions.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenGameplay.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenGameplay.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenGraphicOptions.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenGraphicOptions.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenManager.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenManager.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenMapInstruments.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenMapInstruments.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenMessage.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenMusicScroll.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenMusicScroll.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenOptions.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenOptions.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenOptionsType2.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenOptionsType2.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenPlayerOptions.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenPlayerOptions.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenPrompt.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenPrompt.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenResults.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenResults.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenSandbox.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenSandbox.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenSelectDifficulty.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenSelectDifficulty.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenSelectGame.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenSelectGame.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenSelectGroup.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenSelectGroup.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenSelectMode.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenSelectMode.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenSelectMusic.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenSelectMusic.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenSelectStyle.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenSelectStyle.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenSongOptions.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenSongOptions.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenStage.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenStage.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenSynchronize.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenSynchronize.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenSynchronizeMenu.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenSynchronizeMenu.h +# End Source File +# Begin Source File + +SOURCE=.\ScreenTitleMenu.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScreenTitleMenu.h +# End Source File +# End Group +# Begin Group "Global Singletons" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\AnnoncerManager.cpp +# End Source File +# Begin Source File + +SOURCE=.\AnnoncerManager.h +# End Source File +# Begin Source File + +SOURCE=.\FontManager.cpp +# End Source File +# Begin Source File + +SOURCE=.\FontManager.h +# End Source File +# Begin Source File + +SOURCE=.\GameManager.cpp +# End Source File +# Begin Source File + +SOURCE=.\GameManager.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=.\InputQueue.cpp +# End Source File +# Begin Source File + +SOURCE=.\InputQueue.h +# End Source File +# Begin Source File + +SOURCE=.\PrefsManager.cpp +# End Source File +# Begin Source File + +SOURCE=.\PrefsManager.h +# End Source File +# Begin Source File + +SOURCE=.\SongManager.cpp +# End Source File +# Begin Source File + +SOURCE=.\SongManager.h +# End Source File +# Begin Source File + +SOURCE=.\ThemeManager.cpp +# End Source File +# Begin Source File + +SOURCE=.\ThemeManager.h +# End Source File +# End Group # Begin Source File SOURCE=.\error.bmp diff --git a/stepmania/src/StepMania.h b/stepmania/src/StepMania.h index 0185181372..47f92cc103 100644 --- a/stepmania/src/StepMania.h +++ b/stepmania/src/StepMania.h @@ -1,19 +1,17 @@ +#pragma once /* ----------------------------------------------------------------------------- File: StepMania.h - Desc: + Desc: Objects accessable from anywhere in the program. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford ----------------------------------------------------------------------------- */ -#ifndef _STEPMANIA_H_ -#define _STEPMANIA_H_ - void ApplyGraphicOptions(); -#endif \ No newline at end of file diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 31dd08c25e..7cf99ccda0 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -85,7 +85,7 @@ GlobalOptimizations="TRUE" InlineFunctionExpansion="2" EnableIntrinsicFunctions="TRUE" - FavorSizeOrSpeed="1" + FavorSizeOrSpeed="2" OptimizeForProcessor="2" OptimizeForWindowsApplication="TRUE" PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS" @@ -138,166 +138,175 @@ + RelativePath="Screen.cpp"> + RelativePath="Screen.h"> + RelativePath="ScreenCaution.cpp"> + RelativePath="ScreenCaution.h"> + RelativePath="ScreenDimensions.h"> + RelativePath="ScreenEdit.cpp"> + RelativePath="ScreenEdit.h"> + RelativePath="ScreenEditMenu.cpp"> + RelativePath="ScreenEditMenu.h"> + RelativePath="ScreenGameOptions.cpp"> + RelativePath="ScreenGameOptions.h"> + RelativePath="ScreenGameplay.cpp"> + RelativePath="ScreenGameplay.h"> + RelativePath="ScreenGraphicOptions.cpp"> + RelativePath="ScreenGraphicOptions.h"> + RelativePath="ScreenManager.cpp"> + RelativePath="ScreenManager.h"> + RelativePath="ScreenMapInstruments.cpp"> + RelativePath="ScreenMapInstruments.h"> + RelativePath="ScreenMessage.h"> + RelativePath="ScreenMusicScroll.cpp"> + RelativePath="ScreenMusicScroll.h"> + RelativePath="ScreenOptions.cpp"> + RelativePath="ScreenOptions.h"> + RelativePath="ScreenOptionsType2.cpp"> + RelativePath="ScreenOptionsType2.h"> + RelativePath="ScreenPlayerOptions.cpp"> + RelativePath="ScreenPlayerOptions.h"> + RelativePath="ScreenPrompt.cpp"> + RelativePath="ScreenPrompt.h"> + RelativePath="ScreenResults.cpp"> + RelativePath="ScreenResults.h"> + RelativePath="ScreenSandbox.cpp"> + RelativePath="ScreenSandbox.h"> + RelativePath="ScreenSelectDifficulty.cpp"> + RelativePath="ScreenSelectDifficulty.h"> + RelativePath="ScreenSelectGame.cpp"> + RelativePath="ScreenSelectGame.h"> + RelativePath="ScreenSelectGroup.cpp"> + RelativePath="ScreenSelectGroup.h"> + RelativePath="ScreenSelectMode.cpp"> + RelativePath="ScreenSelectMode.h"> + RelativePath="ScreenSelectMusic.cpp"> + RelativePath="ScreenSelectMusic.h"> + RelativePath="ScreenSelectStyle.cpp"> + RelativePath="ScreenSelectStyle.h"> + RelativePath="ScreenSongOptions.cpp"> + RelativePath="ScreenSongOptions.h"> + RelativePath="ScreenStage.cpp"> + RelativePath="ScreenStage.h"> + RelativePath="ScreenSynchronize.cpp"> + RelativePath="ScreenSynchronize.h"> + RelativePath="ScreenSynchronizeMenu.cpp"> + + + + + + - - - - @@ -327,12 +330,6 @@ - - - - @@ -342,18 +339,6 @@ - - - - - - - - @@ -364,10 +349,10 @@ RelativePath="NoteData.h"> + RelativePath="Notes.cpp"> + RelativePath="Notes.h"> @@ -375,12 +360,6 @@ - - - - @@ -397,10 +376,7 @@ RelativePath=".\Song.cpp"> - - + RelativePath="Song.h"> @@ -411,15 +387,6 @@ - - - - - - + + + + @@ -511,40 +484,6 @@ RelativePath=".\TransitionStarburst.h"> - - - - - - - - - - - - - - - - - - - - - - @@ -744,6 +683,9 @@ + + @@ -790,6 +732,12 @@ + + + + @@ -814,12 +762,6 @@ - - - - @@ -857,6 +799,98 @@ RelativePath=".\RageUtil.h"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stepmania/src/StyleDef.cpp b/stepmania/src/StyleDef.cpp index 89699d8131..e944d14dfb 100644 --- a/stepmania/src/StyleDef.cpp +++ b/stepmania/src/StyleDef.cpp @@ -5,7 +5,7 @@ Desc: A data structure that holds the definition of a GameMode. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/StyleDef.h b/stepmania/src/StyleDef.h index 78bc22af07..317aa75b1c 100644 --- a/stepmania/src/StyleDef.h +++ b/stepmania/src/StyleDef.h @@ -15,12 +15,12 @@ correspondance. For example, dance-versus has 8 columns but only 4 tracks because two players place from the same set of 4 tracks. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ -#include "NoteMetadata.h" +#include "Notes.h" #include "NoteData.h" #include "StyleInput.h" #include "GameInput.h" diff --git a/stepmania/src/StyleInput.h b/stepmania/src/StyleInput.h index 8dec40be77..0c7e0273f1 100644 --- a/stepmania/src/StyleInput.h +++ b/stepmania/src/StyleInput.h @@ -5,7 +5,7 @@ Desc: An input event specific to a style that is defined by a player number and the player's note column. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TextBanner.cpp b/stepmania/src/TextBanner.cpp index 5c8f6a5b19..9eaa37f23c 100644 --- a/stepmania/src/TextBanner.cpp +++ b/stepmania/src/TextBanner.cpp @@ -5,7 +5,7 @@ Desc: The song's TextBanner displayed in SelectSong. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TextBanner.h b/stepmania/src/TextBanner.h index 387ba764a6..64385dd5bd 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -15,7 +15,7 @@ #include "ActorFrame.h" #include "Song.h" #include "BitmapText.h" -#include "RectangleActor.h" +#include "Quad.h" const float TEXT_BANNER_WIDTH = 180; diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index d8e69748c1..58dc4743ac 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -1,11 +1,11 @@ #include "stdafx.h" /* ----------------------------------------------------------------------------- - Class: FontManager + Class: ThemeManager Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -18,6 +18,9 @@ ThemeManager* THEME = NULL; // global object accessable from anywhere in the program +const CString DEFAULT_THEME_NAME = "default"; +const CString THEME_BASE_DIR = "Themes\\default\\"; + ThemeManager::ThemeManager() { CStringArray arrayThemeNames; @@ -30,306 +33,192 @@ ThemeManager::ThemeManager() void ThemeManager::GetThemeNames( CStringArray& AddTo ) { - GetDirListing( "Themes\\*", AddTo, true ); + GetDirListing( DEFAULT_THEME_NAME+"\\*", AddTo, true ); // strip out the folder called "CVS" - for( int i=0; i=0; i-- ) { if( 0 == stricmp( AddTo[i], "cvs" ) ) - { AddTo.RemoveAt(i); - i--; - } } } -bool ThemeManager::SwitchTheme( CString sThemeName ) // return false if theme doesn't exist +void ThemeManager::SwitchTheme( CString sThemeName ) { - sThemeName.MakeLower(); - m_sCurThemeName = sThemeName; - CString sThemeDir = ThemeNameToThemeDir( m_sCurThemeName ); + CString sThemeDir = GetThemeDirFromName( m_sCurThemeName ); if( !DoesFileExist( sThemeDir ) ) - { - FatalError( ssprintf( "The theme in diretory '%' could not be loaded.", sThemeDir ) ); - return false; - } - - return true; + FatalError( "Error loading the announcer in diretory '%s'.", m_sCurThemeName ); } -void ThemeManager::AssertThemeIsComplete( CString sThemeName ) // return false if theme doesn't exist + +void ThemeManager::AssertThemeIsComplete( CString sAnnouncerName ) { for( int i=0; i 0 ) - return sThemeDir + sAssetDir + arrayPossibleElementFileNames[0]; + case SOUND_FAILED: sAssetDir = "Sounds\\failed"; break; + case SOUND_ASSIST: sAssetDir = "Sounds\\Assist"; break; + case SOUND_SELECT: sAssetDir = "Sounds\\select"; break; + case SOUND_SWITCH_STYLE: sAssetDir = "Sounds\\switch Style"; break; + case SOUND_SWITCH_MUSIC: sAssetDir = "Sounds\\switch music"; break; + case SOUND_SWITCH_SORT: sAssetDir = "Sounds\\switch sort"; break; + case SOUND_EXPAND: sAssetDir = "Sounds\\expand"; break; + case SOUND_SWITCH_STEPS: sAssetDir = "Sounds\\switch Steps"; break; + case SOUND_TITLE_CHANGE: sAssetDir = "Sounds\\title change"; break; + case SOUND_MENU_SWOOSH: sAssetDir = "Sounds\\menu swoosh"; break; + case SOUND_MENU_BACK: sAssetDir = "Sounds\\menu back"; break; + case SOUND_INVALID: sAssetDir = "Sounds\\invalid"; break; + case SOUND_EDIT_CHANGE_LINE: sAssetDir = "Sounds\\edit change line"; break; + case SOUND_EDIT_CHANGE_SNAP: sAssetDir = "Sounds\\edit change snap"; break; + case SOUND_SELECT_DIFFICULTY_CHANGE: sAssetDir = "Sounds\\select difficulty change"; break; + case SOUND_SELECT_MODE_CHANGE: sAssetDir = "Sounds\\select mode change"; break; + case SOUND_MENU_MUSIC: sAssetDir = "Sounds\\menu music"; break; + case SOUND_ENDING_MUSIC: sAssetDir = "Sounds\\ending music"; break; + case FONT_HEADER1: sAssetDir = "Fonts\\Header1"; break; + case FONT_HEADER2: sAssetDir = "Fonts\\Header2"; break; + case FONT_NORMAL: sAssetDir = "Fonts\\Normal"; break; + case FONT_COMBO_NUMBERS: sAssetDir = "Fonts\\Combo Numbers"; break; + case FONT_METER: sAssetDir = "Fonts\\Meter"; break; + case FONT_SCORE_NUMBERS: sAssetDir = "Fonts\\Score Numbers"; break; + case FONT_TEXT_BANNER: sAssetDir = "Fonts\\Text Banner"; break; + case FONT_STAGE: sAssetDir = "Fonts\\stage"; break; - /////////////////////////////////////// - // the current theme does not implement this element. Fall back to the default path. - /////////////////////////////////////// - if( sAssetDir == "Graphics\\" ) - { - GetDirListing( DEFAULT_THEME_DIR + sAssetDir + sAssetFileName + "*.sprite", arrayPossibleElementFileNames ); - GetDirListing( DEFAULT_THEME_DIR + sAssetDir + sAssetFileName + "*.png", arrayPossibleElementFileNames ); - GetDirListing( DEFAULT_THEME_DIR + sAssetDir + sAssetFileName + "*.jpg", arrayPossibleElementFileNames ); - GetDirListing( DEFAULT_THEME_DIR + sAssetDir + sAssetFileName + "*.bmp", arrayPossibleElementFileNames ); + default: ASSERT(0); // Unhandled theme element } - else if( sAssetDir == "Sounds\\" ) - { - GetDirListing( DEFAULT_THEME_DIR + sAssetDir + sAssetFileName + ".set", arrayPossibleElementFileNames ); - GetDirListing( DEFAULT_THEME_DIR + sAssetDir + sAssetFileName + ".mp3", arrayPossibleElementFileNames ); - GetDirListing( DEFAULT_THEME_DIR + sAssetDir + sAssetFileName + ".wav", arrayPossibleElementFileNames ); - } - else if( sAssetDir == "Fonts\\" ) - { - GetDirListing( DEFAULT_THEME_DIR + sAssetDir + sAssetFileName + ".font", arrayPossibleElementFileNames ); - } - else if( sAssetDir == "Announcer\\" ) - { - // return the directory, and let the SoundSet discover all the samples in that directory - if( DoesFileExist( DEFAULT_THEME_DIR + sAssetDir + sAssetFileName ) ) - return DEFAULT_THEME_DIR + sAssetDir + sAssetFileName; - } - else - { - FatalError( ssprintf("Unknown theme asset dir '%s'.", sAssetDir) ); - } - - if( arrayPossibleElementFileNames.GetSize() > 0 ) - return DEFAULT_THEME_DIR + sAssetDir + arrayPossibleElementFileNames[0]; - - - - FatalError( ssprintf("The theme element '%s' does not exist in the current theme directory or the default theme directory.", sAssetDir + "\\" + sAssetFileName) ); - return ""; + + return GetThemeDirFromName( sThemeName ) + sAssetDir; } + diff --git a/stepmania/src/ThemeManager.h b/stepmania/src/ThemeManager.h index 4c3d9044f5..7a7b35f50c 100644 --- a/stepmania/src/ThemeManager.h +++ b/stepmania/src/ThemeManager.h @@ -6,7 +6,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 persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ @@ -15,62 +15,57 @@ enum ThemeElement { - GRAPHIC_TITLE_MENU_BACKGROUND, - GRAPHIC_TITLE_MENU_LOGO, - GRAPHIC_SYNCHRONIZE_BACKGROUND, - GRAPHIC_SYNCHRONIZE_TOP_EDGE, + GRAPHIC_ALL_MUSIC_BANNER, GRAPHIC_ARROWS_LEFT, GRAPHIC_ARROWS_RIGHT, GRAPHIC_CAUTION, - GRAPHIC_CLEARED, - GRAPHIC_CLOSING_STAR, - GRAPHIC_COMBO, - GRAPHIC_SCROLLBAR_PARTS, + GRAPHIC_GAMEPLAY_CLOSING_STAR, GRAPHIC_DANCER_P1, GRAPHIC_DANCER_P2, - GRAPHIC_DANGER_BACKGROUND, - GRAPHIC_DANGER_TEXT, + GRAPHIC_GAMEPLAY_BOTTOM_FRAME, + GRAPHIC_GAMEPLAY_DIFFICULTY_FRAME, + GRAPHIC_GAMEPLAY_TOP_FRAME, + GRAPHIC_DIFFICULTY_ICONS, GRAPHIC_EDIT_BACKGROUND, GRAPHIC_EDIT_SNAP_INDICATOR, - GRAPHIC_FAILED, + GRAPHIC_MUSIC_SCROLL_BACKGROUND, GRAPHIC_FALLBACK_BACKGROUND, GRAPHIC_FALLBACK_BANNER, GRAPHIC_FALLBACK_CD_TITLE, - GRAPHIC_SELECT_GAME_BACKGROUND, - GRAPHIC_SELECT_GAME_TOP_EDGE, - GRAPHIC_RESULTS_GRADES, - GRAPHIC_SELECT_MUSIC_SMALL_GRADES, - GRAPHIC_GRAPHIC_OPTIONS_BACKGROUND, - GRAPHIC_GRAPHIC_OPTIONS_TOP_EDGE, GRAPHIC_GAME_OPTIONS_BACKGROUND, GRAPHIC_GAME_OPTIONS_TOP_EDGE, - GRAPHIC_HERE_WE_GO, - GRAPHIC_JUDGEMENT, + GRAPHIC_GAMEPLAY_CLEARED, + GRAPHIC_GAMEPLAY_COMBO, + GRAPHIC_GAMEPLAY_DANGER_BACKGROUND, + GRAPHIC_GAMEPLAY_DANGER_TEXT, + GRAPHIC_GAMEPLAY_FAILED, + GRAPHIC_GAMEPLAY_JUDGEMENT, + GRAPHIC_GAMEPLAY_READY, + GRAPHIC_GRAPHIC_OPTIONS_BACKGROUND, + GRAPHIC_GRAPHIC_OPTIONS_TOP_EDGE, + GRAPHIC_GAMEPLAY_HERE_WE_GO, GRAPHIC_KEEP_ALIVE, GRAPHIC_LIFEMETER_FRAME, GRAPHIC_LIFEMETER_PILLS, GRAPHIC_MENU_BOTTOM_EDGE, - GRAPHIC_SELECT_MUSIC_SONG_HIGHLIGHT, - GRAPHIC_SELECT_MUSIC_SONG_BAR, GRAPHIC_MUSIC_SORT_ICONS, GRAPHIC_MUSIC_STATUS_ICONS, - GRAPHIC_OPENING_STAR, + GRAPHIC_GAMEPLAY_OPENING_STAR, GRAPHIC_PAD_DOUBLE, GRAPHIC_PAD_SINGLE, GRAPHIC_PAD_SOLO, GRAPHIC_PLAYER_OPTIONS_BACKGROUND, GRAPHIC_PLAYER_OPTIONS_TOP_EDGE, - GRAPHIC_READY, GRAPHIC_RESULTS_BACKGROUND, - GRAPHIC_RESULTS_TOP_EDGE, GRAPHIC_RESULTS_BANNER_FRAME, GRAPHIC_RESULTS_BONUS_FRAME_P1, GRAPHIC_RESULTS_BONUS_FRAME_P2, GRAPHIC_RESULTS_GRADE_FRAME, + GRAPHIC_RESULTS_GRADES, GRAPHIC_RESULTS_JUDGE_LABELS, GRAPHIC_RESULTS_SCORE_LABELS, - GRAPHIC_SCORE_FRAME, - GRAPHIC_SELECT_MUSIC_SECTION_BAR, + GRAPHIC_RESULTS_TOP_EDGE, + GRAPHIC_SCROLLBAR_PARTS, GRAPHIC_SELECT_DIFFICULTY_ARROW_P1, GRAPHIC_SELECT_DIFFICULTY_ARROW_P2, GRAPHIC_SELECT_DIFFICULTY_BACKGROUND, @@ -83,42 +78,50 @@ enum ThemeElement { GRAPHIC_SELECT_DIFFICULTY_MEDIUM_PICTURE, GRAPHIC_SELECT_DIFFICULTY_OK, GRAPHIC_SELECT_DIFFICULTY_TOP_EDGE, - GRAPHIC_SELECT_MODE_BACKGROUND, - GRAPHIC_SELECT_MODE_TOP_EDGE, - GRAPHIC_SELECT_MODE_EXPLANATION, - GRAPHIC_SELECT_MODE_ARROW, - GRAPHIC_SELECT_MODE_OK, + GRAPHIC_SELECT_GAME_BACKGROUND, + GRAPHIC_SELECT_GAME_TOP_EDGE, + GRAPHIC_SELECT_GROUP_BACKGROUND, + GRAPHIC_SELECT_GROUP_BUTTON, + GRAPHIC_SELECT_GROUP_CONTENTS_HEADER, + GRAPHIC_SELECT_GROUP_EXPLANATION, + GRAPHIC_SELECT_GROUP_INFO_FRAME, + GRAPHIC_SELECT_GROUP_TOP_EDGE, GRAPHIC_SELECT_MODE_ARCADE_HEADER, GRAPHIC_SELECT_MODE_ARCADE_PICTURE, + GRAPHIC_SELECT_MODE_ARROW, + GRAPHIC_SELECT_MODE_BACKGROUND, + GRAPHIC_SELECT_MODE_EXPLANATION, GRAPHIC_SELECT_MODE_FREE_PLAY_HEADER, GRAPHIC_SELECT_MODE_FREE_PLAY_PICTURE, GRAPHIC_SELECT_MODE_NONSTOP_HEADER, GRAPHIC_SELECT_MODE_NONSTOP_PICTURE, + GRAPHIC_SELECT_MODE_OK, + GRAPHIC_SELECT_MODE_TOP_EDGE, GRAPHIC_SELECT_MUSIC_BACKGROUND, + GRAPHIC_SELECT_MUSIC_DIFFICULTY_FRAME, GRAPHIC_SELECT_MUSIC_INFO_FRAME, + GRAPHIC_SELECT_MUSIC_METER_FRAME, + GRAPHIC_SELECT_MUSIC_OPTION_ICONS, GRAPHIC_SELECT_MUSIC_RADAR_BASE, GRAPHIC_SELECT_MUSIC_RADAR_WORDS, + GRAPHIC_SELECT_MUSIC_ROULETTE_BANNER, GRAPHIC_SELECT_MUSIC_SCORE_FRAME, + GRAPHIC_SELECT_MUSIC_SECTION_BAR, + GRAPHIC_SELECT_MUSIC_SMALL_GRADES, + GRAPHIC_SELECT_MUSIC_SONG_BAR, + GRAPHIC_SELECT_MUSIC_SONG_HIGHLIGHT, GRAPHIC_SELECT_MUSIC_TOP_EDGE, GRAPHIC_SELECT_STYLE_BACKGROUND, GRAPHIC_SELECT_STYLE_TOP_EDGE, GRAPHIC_SONG_OPTIONS_BACKGROUND, GRAPHIC_SONG_OPTIONS_TOP_EDGE, + GRAPHIC_STAGE_UNDERSCORE, 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, + GRAPHIC_SYNCHRONIZE_BACKGROUND, + GRAPHIC_SYNCHRONIZE_TOP_EDGE, + GRAPHIC_TITLE_MENU_BACKGROUND, + GRAPHIC_TITLE_MENU_LOGO, SOUND_FAILED, SOUND_ASSIST, @@ -139,43 +142,20 @@ enum ThemeElement { SOUND_ENDING_MUSIC, SOUND_MENU_MUSIC, - FONT_BOLD, - FONT_COMBO_NUMBERS, - FONT_FEET, + FONT_HEADER1, + FONT_HEADER2, FONT_NORMAL, + FONT_COMBO_NUMBERS, + FONT_METER, FONT_SCORE_NUMBERS, FONT_TEXT_BANNER, - FONT_BIG_MESSAGE, - - ANNOUNCER_ATTRACT, - ANNOUNCER_BAD_COMMENT, - ANNOUNCER_CAUTION, - ANNOUNCER_CLEARED, - ANNOUNCER_FAIL_COMMENT, - ANNOUNCER_GAME_OVER, - ANNOUNCER_GOOD_COMMENT, - ANNOUNCER_HERE_WE_GO, - ANNOUNCER_MUSIC_COMMENT, - ANNOUNCER_READY, - ANNOUNCER_READY_LAST, - ANNOUNCER_RESULT_AAA, - ANNOUNCER_RESULT_AA, - ANNOUNCER_RESULT_A, - ANNOUNCER_RESULT_B, - ANNOUNCER_RESULT_C, - ANNOUNCER_RESULT_D, - ANNOUNCER_RESULT_E, - ANNOUNCER_TITLE, - ANNOUNCER_DIFFICULTY_COMMENT, - + FONT_STAGE, NUM_THEME_ELEMENTS // leave this at the end }; -const CString DEFAULT_THEME_NAME = "default"; -const CString DEFAULT_THEME_DIR = "Themes\\default\\"; @@ -185,14 +165,15 @@ public: ThemeManager(); void GetThemeNames( CStringArray& AddTo ); - bool SwitchTheme( CString sThemeName ); // return false if theme doesn't exist + CString GetCurrentThemeName() { return m_sCurThemeName; } + void SwitchTheme( CString sThemeName ); // return false if theme doesn't exist void AssertThemeIsComplete( CString sThemeName ); // return false if theme doesn't exist - CString ElementToAssetPath( ThemeElement te ); CString GetPathTo( ThemeElement te ); CString GetPathTo( ThemeElement te, CString sThemeName ); protected: - CString ThemeNameToThemeDir( CString sThemeName ); + CString GetThemeDirFromName( CString sAnnouncerName ); + CString GetElementDir( CString sThemeName ); CString m_sCurThemeName; }; diff --git a/stepmania/src/TipDisplay.cpp b/stepmania/src/TipDisplay.cpp index 2187c39d2a..5ff2229000 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/TipDisplay.h b/stepmania/src/TipDisplay.h index 9fe67fdd06..ec7903b0d5 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ diff --git a/stepmania/src/Transition.cpp b/stepmania/src/Transition.cpp index abd7ff8bd6..a3c13d8443 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -53,7 +53,7 @@ void Transition::Update( float fDeltaTime ) break; } - WM->SendMessageToTopWindow( m_MessageToSendWhenDone, 0 ); + SCREENMAN->SendMessageToTopScreen( m_MessageToSendWhenDone, 0 ); } m_fPercentThroughTransition += fDeltaTime/m_fTransitionTime; @@ -71,28 +71,28 @@ void Transition::SetOpened() m_TransitionState = opened; } -void Transition::OpenWipingRight( WindowMessage send_when_done ) +void Transition::OpenWipingRight( ScreenMessage send_when_done ) { m_MessageToSendWhenDone = send_when_done; m_TransitionState = opening_right; m_fPercentThroughTransition = 0.0; } -void Transition::OpenWipingLeft( WindowMessage send_when_done ) +void Transition::OpenWipingLeft( ScreenMessage send_when_done ) { m_MessageToSendWhenDone = send_when_done; m_TransitionState = opening_left; m_fPercentThroughTransition = 0.0; } -void Transition::CloseWipingRight( WindowMessage send_when_done ) +void Transition::CloseWipingRight( ScreenMessage send_when_done ) { m_MessageToSendWhenDone = send_when_done; m_TransitionState = closing_right; m_fPercentThroughTransition = 0.0; } -void Transition::CloseWipingLeft( WindowMessage send_when_done ) +void Transition::CloseWipingLeft( ScreenMessage send_when_done ) { m_MessageToSendWhenDone = send_when_done; m_TransitionState = closing_left; diff --git a/stepmania/src/Transition.h b/stepmania/src/Transition.h index 24214ad5d2..c155cdffb6 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -13,9 +13,9 @@ #define _Transition_H_ -#include "RageScreen.h" -#include "Window.h" -#include "WindowManager.h" +#include "RageDisplay.h" +#include "Screen.h" +#include "ScreenManager.h" #include "Actor.h" #include "RandomSample.h" @@ -41,10 +41,10 @@ public: virtual void SetOpened(); virtual void SetClosed(); - virtual void OpenWipingRight( WindowMessage send_when_done = SM_None ); - virtual void OpenWipingLeft( WindowMessage send_when_done = SM_None ); - virtual void CloseWipingRight(WindowMessage send_when_done = SM_None ); - virtual void CloseWipingLeft( WindowMessage send_when_done = SM_None ); + virtual void OpenWipingRight( ScreenMessage send_when_done = SM_None ); + virtual void OpenWipingLeft( ScreenMessage send_when_done = SM_None ); + virtual void CloseWipingRight(ScreenMessage send_when_done = SM_None ); + virtual void CloseWipingLeft( ScreenMessage send_when_done = SM_None ); bool IsOpened() { return m_TransitionState == opened; }; bool IsOpening() { return m_TransitionState == opening_right || m_TransitionState == opening_left; }; @@ -85,7 +85,7 @@ protected: }; - WindowMessage m_MessageToSendWhenDone; + ScreenMessage m_MessageToSendWhenDone; D3DXCOLOR m_Color; }; diff --git a/stepmania/src/TransitionFade.cpp b/stepmania/src/TransitionFade.cpp index 2dd2634e08..07ffe6a120 100644 --- a/stepmania/src/TransitionFade.cpp +++ b/stepmania/src/TransitionFade.cpp @@ -5,7 +5,7 @@ Desc: Fades out or in. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -27,7 +27,7 @@ TransitionFade::~TransitionFade() } -void TransitionFade::RenderPrimitives() +void TransitionFade::DrawPrimitives() { const float fPercentageOpaque = 1 - GetPercentageOpen(); if( fPercentageOpaque == 0 ) diff --git a/stepmania/src/TransitionFade.h b/stepmania/src/TransitionFade.h index 9e7a70b4a2..8c010f367c 100644 --- a/stepmania/src/TransitionFade.h +++ b/stepmania/src/TransitionFade.h @@ -4,7 +4,7 @@ Desc: Fades out or in. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -14,9 +14,9 @@ #include "Transition.h" -#include "RageScreen.h" +#include "RageDisplay.h" #include "RageSound.h" -#include "RectangleActor.h" +#include "Quad.h" class TransitionFade : public Transition @@ -25,10 +25,10 @@ public: TransitionFade(); virtual ~TransitionFade(); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); protected: - RectangleActor m_rect; + Quad m_rect; }; diff --git a/stepmania/src/TransitionFadeWipe.cpp b/stepmania/src/TransitionFadeWipe.cpp index ce310db260..7cceb35fef 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -30,7 +30,7 @@ TransitionFadeWipe::~TransitionFadeWipe() } -void TransitionFadeWipe::RenderPrimitives() +void TransitionFadeWipe::DrawPrimitives() { if( m_TransitionState == opened ) return; diff --git a/stepmania/src/TransitionFadeWipe.h b/stepmania/src/TransitionFadeWipe.h index 662e837b87..b4ef297d81 100644 --- a/stepmania/src/TransitionFadeWipe.h +++ b/stepmania/src/TransitionFadeWipe.h @@ -4,7 +4,7 @@ Desc: Fades out or in. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -13,10 +13,10 @@ #include "Transition.h" -#include "RageScreen.h" +#include "RageDisplay.h" #include "RageSound.h" #include "Sprite.h" -#include "RectangleActor.h" +#include "Quad.h" class TransitionFadeWipe : public Transition @@ -25,10 +25,10 @@ public: TransitionFadeWipe(); ~TransitionFadeWipe(); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); protected: - RectangleActor m_rectBlack, m_rectGradient; + Quad m_rectBlack, m_rectGradient; }; diff --git a/stepmania/src/TransitionInvisible.cpp b/stepmania/src/TransitionInvisible.cpp index dfbcffdc2a..9499b9dc05 100644 --- a/stepmania/src/TransitionInvisible.cpp +++ b/stepmania/src/TransitionInvisible.cpp @@ -5,7 +5,7 @@ Desc: Fades out or in. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -26,7 +26,7 @@ TransitionInvisible::~TransitionInvisible() } -void TransitionInvisible::RenderPrimitives() +void TransitionInvisible::DrawPrimitives() { } diff --git a/stepmania/src/TransitionInvisible.h b/stepmania/src/TransitionInvisible.h index 6f4eeb4b95..d422da826b 100644 --- a/stepmania/src/TransitionInvisible.h +++ b/stepmania/src/TransitionInvisible.h @@ -4,7 +4,7 @@ Desc: Fades out or in. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -14,9 +14,9 @@ #include "Transition.h" -#include "RageScreen.h" +#include "RageDisplay.h" #include "RageSound.h" -#include "RectangleActor.h" +#include "Quad.h" class TransitionInvisible : public Transition @@ -25,7 +25,7 @@ public: TransitionInvisible(); virtual ~TransitionInvisible(); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); protected: }; diff --git a/stepmania/src/TransitionKeepAlive.cpp b/stepmania/src/TransitionKeepAlive.cpp index 8e01f0acb2..f9df52782a 100644 --- a/stepmania/src/TransitionKeepAlive.cpp +++ b/stepmania/src/TransitionKeepAlive.cpp @@ -5,7 +5,7 @@ Desc: See header. - Copyright (c) 2001-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -36,7 +36,7 @@ void TransitionKeepAlive::Update( float fDeltaTime ) } -void TransitionKeepAlive::RenderPrimitives() +void TransitionKeepAlive::DrawPrimitives() { if( m_TransitionState == closing_left ) // we're going back { @@ -67,28 +67,28 @@ void TransitionKeepAlive::RenderPrimitives() } -void TransitionKeepAlive::OpenWipingRight( WindowMessage send_when_done ) +void TransitionKeepAlive::OpenWipingRight( ScreenMessage send_when_done ) { this->SetTransitionTime( KEEP_ALIVE_FORWARD_TRANSITION_TIME ); Transition::OpenWipingRight( send_when_done ); } -void TransitionKeepAlive::OpenWipingLeft( WindowMessage send_when_done ) +void TransitionKeepAlive::OpenWipingLeft( ScreenMessage send_when_done ) { this->SetTransitionTime( KEEP_ALIVE_BACKWARD_TRANSITION_TIME ); Transition::OpenWipingLeft( send_when_done ); } -void TransitionKeepAlive::CloseWipingRight(WindowMessage send_when_done ) +void TransitionKeepAlive::CloseWipingRight(ScreenMessage send_when_done ) { this->SetTransitionTime( KEEP_ALIVE_FORWARD_TRANSITION_TIME ); Transition::CloseWipingRight( send_when_done ); } -void TransitionKeepAlive::CloseWipingLeft( WindowMessage send_when_done ) +void TransitionKeepAlive::CloseWipingLeft( ScreenMessage send_when_done ) { this->SetTransitionTime( KEEP_ALIVE_BACKWARD_TRANSITION_TIME ); diff --git a/stepmania/src/TransitionKeepAlive.h b/stepmania/src/TransitionKeepAlive.h index 855fdb0cc5..1a06568afb 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -22,16 +22,16 @@ public: TransitionKeepAlive(); virtual void Update( float fDeltaTime ); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); - virtual void OpenWipingRight( WindowMessage send_when_done = SM_None ); - virtual void OpenWipingLeft( WindowMessage send_when_done = SM_None ); - virtual void CloseWipingRight(WindowMessage send_when_done = SM_None ); - virtual void CloseWipingLeft( WindowMessage send_when_done = SM_None ); + virtual void OpenWipingRight( ScreenMessage send_when_done = SM_None ); + virtual void OpenWipingLeft( ScreenMessage send_when_done = SM_None ); + virtual void CloseWipingRight(ScreenMessage send_when_done = SM_None ); + virtual void CloseWipingLeft( ScreenMessage send_when_done = SM_None ); protected: Sprite m_sprLogo; - RectangleActor m_rect; + Quad m_rect; }; diff --git a/stepmania/src/TransitionRectWipe.cpp b/stepmania/src/TransitionRectWipe.cpp index a63a68be2d..81622f0c81 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -30,7 +30,7 @@ TransitionRectWipe::~TransitionRectWipe() } -void TransitionRectWipe::RenderPrimitives() +void TransitionRectWipe::DrawPrimitives() { if( m_TransitionState == opened ) return; @@ -77,7 +77,7 @@ void TransitionRectWipe::RenderPrimitives() /* RECT rect; SetRect( &rect, iRectX-iRectWidth/2, 0, iRectX+iRectWidth/2, SCREEN_HEIGHT ); - SCREEN->DrawRect( &rect, D3DCOLOR_ARGB(255,0,0,0) ); + DISPLAY->DrawRect( &rect, D3DCOLOR_ARGB(255,0,0,0) ); */ } } // end foreach rect } diff --git a/stepmania/src/TransitionRectWipe.h b/stepmania/src/TransitionRectWipe.h index 18c01d06d8..b677d0fb88 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -13,7 +13,7 @@ #include "Transition.h" -#include "RageScreen.h" +#include "RageDisplay.h" #include "RageSound.h" @@ -23,7 +23,7 @@ public: TransitionRectWipe(); ~TransitionRectWipe(); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); }; diff --git a/stepmania/src/TransitionStarWipe.cpp b/stepmania/src/TransitionStarWipe.cpp index ca670ede76..8f120e644c 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -26,7 +26,7 @@ TransitionStarWipe::~TransitionStarWipe() } -void TransitionStarWipe::RenderPrimitives() +void TransitionStarWipe::DrawPrimitives() { if( m_TransitionState == opened ) return; @@ -98,28 +98,28 @@ void TransitionStarWipe::RenderPrimitives() } } -void TransitionStarWipe::OpenWipingRight( WindowMessage send_when_done ) +void TransitionStarWipe::OpenWipingRight( ScreenMessage send_when_done ) { Transition::OpenWipingRight( send_when_done ); - LoadNewStarSprite( THEME->GetPathTo(GRAPHIC_CLOSING_STAR) ); + LoadNewStarSprite( THEME->GetPathTo(GRAPHIC_GAMEPLAY_CLOSING_STAR) ); } -void TransitionStarWipe::OpenWipingLeft( WindowMessage send_when_done ) +void TransitionStarWipe::OpenWipingLeft( ScreenMessage send_when_done ) { Transition::OpenWipingLeft( send_when_done ); - LoadNewStarSprite( THEME->GetPathTo(GRAPHIC_CLOSING_STAR) ); + LoadNewStarSprite( THEME->GetPathTo(GRAPHIC_GAMEPLAY_CLOSING_STAR) ); } -void TransitionStarWipe::CloseWipingRight(WindowMessage send_when_done ) +void TransitionStarWipe::CloseWipingRight(ScreenMessage send_when_done ) { Transition::CloseWipingRight( send_when_done ); - LoadNewStarSprite( THEME->GetPathTo(GRAPHIC_OPENING_STAR) ); + LoadNewStarSprite( THEME->GetPathTo(GRAPHIC_GAMEPLAY_OPENING_STAR) ); } -void TransitionStarWipe::CloseWipingLeft( WindowMessage send_when_done ) +void TransitionStarWipe::CloseWipingLeft( ScreenMessage send_when_done ) { Transition::CloseWipingLeft( send_when_done ); - LoadNewStarSprite( THEME->GetPathTo(GRAPHIC_OPENING_STAR) ); + LoadNewStarSprite( THEME->GetPathTo(GRAPHIC_GAMEPLAY_OPENING_STAR) ); } void TransitionStarWipe::LoadNewStarSprite( CString sFileName ) diff --git a/stepmania/src/TransitionStarWipe.h b/stepmania/src/TransitionStarWipe.h index d28db732af..f726fc5d65 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-2002 by the persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. ----------------------------------------------------------------------------- */ @@ -13,9 +13,9 @@ #include "Transition.h" -#include "RageScreen.h" +#include "RageDisplay.h" #include "RageSound.h" -#include "RectangleActor.h" +#include "Quad.h" class TransitionStarWipe : public Transition @@ -24,12 +24,12 @@ public: TransitionStarWipe(); ~TransitionStarWipe(); - virtual void RenderPrimitives(); + virtual void DrawPrimitives(); - void OpenWipingRight( WindowMessage send_when_done ); - void OpenWipingLeft( WindowMessage send_when_done ); - void CloseWipingRight(WindowMessage send_when_done ); - void CloseWipingLeft( WindowMessage send_when_done ); + void OpenWipingRight( ScreenMessage send_when_done ); + void OpenWipingLeft( ScreenMessage send_when_done ); + void CloseWipingRight(ScreenMessage send_when_done ); + void CloseWipingLeft( ScreenMessage send_when_done ); protected: void LoadNewStarSprite( CString sFileName ); @@ -38,7 +38,7 @@ protected: int m_iStarWidth; int m_iStarHeight; - RectangleActor m_rect; + Quad m_rect; }; diff --git a/stepmania/src/song.h b/stepmania/src/song.h index 7bb8c19a41..a5fc5c7599 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -6,13 +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 persons listed below. All rights reserved. + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ -#include "NoteMetadata.h" +#include "Notes.h" #include "GameConstantsAndTypes.h" #include "RageUtil.h" @@ -40,19 +40,25 @@ class Song public: Song(); - bool LoadFromSongDir( CString sDir ); + bool LoadFromSongDir( CString sDir ); // calls one of the loads below + void Save() { SaveToSMDir(); SaveToCacheFile(); }; + + bool LoadFromCacheFile( bool bLoadNoteData ); + +protected: bool LoadFromDWIFile( CString sPath ); bool LoadFromBMSDir( CString sDir ); bool LoadFromSMDir( CString sDir ); - - void Save(); - -private: - void TidyUpData(); // call after loading to clean up invalid data + void SaveToSMDir(); // saves to StepMania song and notes files + void SaveToCacheFile(); // saves to cache file + + void DeleteCacheFile(); + public: CString GetSongFilePath() {return m_sSongFilePath; }; + CString GetCacheFilePath(); CString GetSongFileDir() {return m_sSongDir; }; CString GetGroupName() {return m_sGroupName; }; CString GetMusicPath() {return m_sMusicPath; }; @@ -92,17 +98,18 @@ public: }; void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut ); float GetElapsedTimeFromBeat( float fBeat ); - void GetNoteMetadatasThatMatchGameAndStyle( CString sGame, CString sStyle, CArray& arrayAddTo ); + void GetNotessThatMatchGameAndStyle( 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 + CArray m_BPMSegments; // this must be sorted before gameplay + CArray m_FreezeSegments; // this must be sorted before gameplay public: - CArray m_arrayNoteMetadatas; + CArray m_arrayNotes; };