From 628dea9da748f679d9a5fc5909e9fa5eb96ec049 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 11 Nov 2002 04:53:31 +0000 Subject: [PATCH] OpenGL checkin. Movie textures, texture stretch, texture dither, and 16 bit textures are broken. --- stepmania/src/Actor.cpp | 12 + stepmania/src/ArrowEffects.cpp | 1 + stepmania/src/BGAnimationLayer.cpp | 17 +- stepmania/src/BPMDisplay.cpp | 1 + stepmania/src/Banner.cpp | 3 +- stepmania/src/BannerWithFrame.cpp | 1 + stepmania/src/BitmapText.cpp | 41 +- stepmania/src/BitmapText.h | 4 +- stepmania/src/Combo.cpp | 1 + stepmania/src/Course.cpp | 1 + stepmania/src/CourseContentsFrame.cpp | 4 + stepmania/src/FootMeter.cpp | 2 + stepmania/src/GameConstantsAndTypes.h | 3 + stepmania/src/GameManager.cpp | 9 +- stepmania/src/GameManager.h | 14 +- stepmania/src/GameState.cpp | 1 + stepmania/src/GhostArrow.cpp | 1 + stepmania/src/GhostArrowBright.cpp | 1 + stepmania/src/GradeDisplay.cpp | 1 + stepmania/src/GradeDisplay.h | 3 +- stepmania/src/GrayArrow.cpp | 2 + stepmania/src/GrooveRadar.cpp | 11 +- stepmania/src/HoldGhostArrow.cpp | 1 + stepmania/src/HoldJudgement.cpp | 1 + stepmania/src/Judgement.cpp | 1 + stepmania/src/LifeMeterBar.cpp | 5 +- stepmania/src/LifeMeterBattery.cpp | 2 + stepmania/src/MenuElements.cpp | 1 + stepmania/src/MenuTimer.cpp | 1 + stepmania/src/ModeChoice.h | 24 + stepmania/src/MusicSortDisplay.cpp | 1 + stepmania/src/MusicStatusDisplay.cpp | 3 +- stepmania/src/MusicWheel.cpp | 2 + stepmania/src/NoteDisplay.cpp | 52 +- stepmania/src/NoteField.cpp | 2 + stepmania/src/Player.cpp | 49 +- stepmania/src/PrefsManager.cpp | 42 +- stepmania/src/PrefsManager.h | 17 +- stepmania/src/Quad.h | 12 +- stepmania/src/RageBitmapTexture.cpp | 416 +------ stepmania/src/RageBitmapTexture.h | 36 +- stepmania/src/RageDisplay.cpp | 815 ++++---------- stepmania/src/RageDisplay.h | 128 +-- stepmania/src/RageException.h | 15 +- stepmania/src/RageInput.cpp | 1 + stepmania/src/RageInput.h | 1 + stepmania/src/RageLog.cpp | 4 +- stepmania/src/RageMovieTexture.cpp | 14 +- stepmania/src/RageSound.cpp | 9 +- stepmania/src/RageSound.h | 3 +- stepmania/src/RageTexture.cpp | 25 +- stepmania/src/RageTexture.h | 73 +- stepmania/src/RageTextureManager.cpp | 31 +- stepmania/src/RageTextureManager.h | 10 +- stepmania/src/RageTypes.h | 80 +- stepmania/src/ScoreDisplayNormal.cpp | 1 + stepmania/src/ScoreDisplayOni.cpp | 1 + stepmania/src/ScreenAppearanceOptions.cpp | 2 +- stepmania/src/ScreenCaution.cpp | 1 + stepmania/src/ScreenEdit.cpp | 3 + stepmania/src/ScreenEditMenu.cpp | 1 + stepmania/src/ScreenEvaluation.cpp | 1 + stepmania/src/ScreenEz2SelectPlayer.cpp | 1 + stepmania/src/ScreenGameOver.cpp | 1 + stepmania/src/ScreenGameplay.cpp | 1 + stepmania/src/ScreenGraphicOptions.cpp | 89 +- stepmania/src/ScreenGraphicOptions.h | 1 - stepmania/src/ScreenHowToPlay.cpp | 1 + stepmania/src/ScreenInputOptions.cpp | 1 + stepmania/src/ScreenMachineOptions.cpp | 2 +- stepmania/src/ScreenManager.cpp | 5 +- stepmania/src/ScreenMapControllers.cpp | 1 + stepmania/src/ScreenMusicScroll.cpp | 2 + stepmania/src/ScreenOptions.cpp | 1 + stepmania/src/ScreenPlayerOptions.cpp | 2 + stepmania/src/ScreenPrompt.cpp | 1 + stepmania/src/ScreenSandbox.cpp | 17 +- stepmania/src/ScreenSandbox.h | 2 +- stepmania/src/ScreenSelectCourse.cpp | 1 + stepmania/src/ScreenSelectDifficulty.cpp | 1 + stepmania/src/ScreenSelectGame.cpp | 1 + stepmania/src/ScreenSelectGroup.cpp | 25 +- stepmania/src/ScreenSelectMode.cpp | 31 +- stepmania/src/ScreenSelectMode.h | 4 +- stepmania/src/ScreenSelectMusic.cpp | 9 +- stepmania/src/ScreenSelectStyle.cpp | 2 + stepmania/src/ScreenSelectStyle.h | 5 +- stepmania/src/ScreenSelectStyle5th.cpp | 2 + stepmania/src/ScreenSongOptions.cpp | 1 + stepmania/src/ScreenStage.cpp | 1 + stepmania/src/ScreenTextEntry.cpp | 1 + stepmania/src/ScreenTitleMenu.cpp | 6 +- stepmania/src/ScreenTitleMenu.h | 1 - stepmania/src/ScrollBar.cpp | 2 + stepmania/src/SmallGradeDisplay.cpp | 1 + stepmania/src/SmallGradeDisplay.h | 1 + stepmania/src/SnapDisplay.cpp | 1 + stepmania/src/SongManager.cpp | 4 + stepmania/src/SongSelector.cpp | 2 + stepmania/src/SongSelector.h | 7 +- stepmania/src/Sprite.cpp | 73 +- stepmania/src/Sprite.h | 1 + stepmania/src/StdAfx.h | 2 +- stepmania/src/StepMania.RC | 49 +- stepmania/src/StepMania.cpp | 1230 +++++---------------- stepmania/src/StepMania.dsp | 42 +- stepmania/src/StepMania.vcproj | 25 +- stepmania/src/TextBanner.cpp | 1 + stepmania/src/ThemeManager.cpp | 6 +- stepmania/src/TipDisplay.cpp | 1 + stepmania/src/TransitionBackWipe.cpp | 2 +- stepmania/src/TransitionKeepAlive.cpp | 1 + stepmania/src/TransitionOniFade.cpp | 1 + stepmania/src/TransitionStarWipe.cpp | 3 +- stepmania/src/loading.bmp | Bin 12660 -> 29588 bytes stepmania/src/resource.h | 4 +- 116 files changed, 1087 insertions(+), 2612 deletions(-) create mode 100644 stepmania/src/ModeChoice.h diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 6acac3f921..d66aee4fd5 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -14,6 +14,8 @@ #include #include "RageDisplay.h" #include "PrefsManager.h" +#include "RageUtil.h" +#include "GameConstantsAndTypes.h" Actor::Actor() @@ -256,6 +258,16 @@ void Actor::BeginTweening( float time, TweenType tt ) { ASSERT( time >= 0 ); + // HACK to keep from out of bounds access.. + if( m_iNumTweenStates == MAX_TWEEN_STATES ) + { + for( int i=0; i float ArrowGetYOffset( PlayerNumber pn, float fNoteBeat ) diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index 8e66324768..df6c926fc4 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -16,6 +16,7 @@ #include "GameState.h" #include "IniFile.h" #include "RageMath.h" +#include inline float GetOffScreenLeft( Actor* pActor ) { return SCREEN_LEFT - pActor->GetZoomedWidth()/2; } @@ -192,7 +193,7 @@ found_effect: { m_Sprites[i].Load( sPath ); m_Sprites[i].SetZoom( randomf(0.2f,2) ); - m_Sprites[i].SetRotation( randomf(0,D3DX_PI*2) ); + m_Sprites[i].SetRotation( randomf(0,PI*2) ); } } break; @@ -232,8 +233,8 @@ found_effect: case EFFECT_TILE_PULSE: { m_Sprites[0].Load( sPath ); - int iNumTilesWide = int(ceil(SCREEN_WIDTH /m_Sprites[0].GetUnzoomedWidth())); - int iNumTilesHigh = int(ceil(SCREEN_HEIGHT/m_Sprites[0].GetUnzoomedHeight())); + int iNumTilesWide = 1+int(SCREEN_WIDTH /m_Sprites[0].GetUnzoomedWidth()); + int iNumTilesHigh = 1+int(SCREEN_HEIGHT/m_Sprites[0].GetUnzoomedHeight()); if( m_Effect == EFFECT_TILE_SCROLL_LEFT || m_Effect == EFFECT_TILE_SCROLL_RIGHT ) { iNumTilesWide++; @@ -304,8 +305,8 @@ void BGAnimationLayer::Update( float fDeltaTime ) { RageColor color = RageColor( cosf( fSongBeat+i ) * 0.5f + 0.5f, - cosf( fSongBeat+i + D3DX_PI * 2.0f / 3.0f ) * 0.5f + 0.5f, - cosf( fSongBeat+i + D3DX_PI * 4.0f / 3.0f) * 0.5f + 0.5f, + cosf( fSongBeat+i + PI * 2.0f / 3.0f ) * 0.5f + 0.5f, + cosf( fSongBeat+i + PI * 4.0f / 3.0f) * 0.5f + 0.5f, 1.0f ); m_Sprites[i].SetDiffuse( color ); @@ -467,19 +468,19 @@ void BGAnimationLayer::Update( float fDeltaTime ) case EFFECT_TILE_FLIP_X: for( i=0; iGetMetricC("BPMDisplay","NormalColorTop") diff --git a/stepmania/src/Banner.cpp b/stepmania/src/Banner.cpp index 09a109c1ff..ab7816f118 100644 --- a/stepmania/src/Banner.cpp +++ b/stepmania/src/Banner.cpp @@ -15,6 +15,7 @@ #include "PrefsManager.h" #include "SongManager.h" #include "RageBitmapTexture.h" +#include "ThemeManager.h" Banner::Banner() { @@ -39,7 +40,7 @@ void Banner::Update( float fDeltaTime ) m_fPercentScrolling += fDeltaTime/2; m_fPercentScrolling -= (int)m_fPercentScrolling; - RectF *pTextureRect = m_pTexture->GetTextureCoordRect(0); + const RectF *pTextureRect = m_pTexture->GetTextureCoordRect(0); float fTexCoords[8] = { diff --git a/stepmania/src/BannerWithFrame.cpp b/stepmania/src/BannerWithFrame.cpp index c44f82f36a..8924442a22 100644 --- a/stepmania/src/BannerWithFrame.cpp +++ b/stepmania/src/BannerWithFrame.cpp @@ -15,6 +15,7 @@ #include "GameConstantsAndTypes.h" #include "PrefsManager.h" #include "RageLog.h" +#include "ThemeManager.h" diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index 22cbf1c26d..b1f313ebd3 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -16,7 +16,10 @@ #include "RageLog.h" #include "RageException.h" #include "RageTimer.h" +#include "RageDisplay.h" #include "PrefsManager.h" +#include "ThemeManager.h" +#include "GameConstantsAndTypes.h" #define RAINBOW_COLOR_1 THEME->GetMetricC("BitmapText","RainbowColor1") @@ -188,11 +191,13 @@ void BitmapText::CropToWidth( int iMaxWidthInSourcePixels ) // draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale void BitmapText::DrawPrimitives() { - // offset so that pixels are aligned to texels - if( PREFSMAN->m_iDisplayResolution == 320 ) - DISPLAY->TranslateLocal( -1, -1, 0 ); - else - DISPLAY->TranslateLocal( -0.5f, -0.5f, 0 ); + // Offset so that pixels are aligned to texels + // Offset by -0.5, -0.5 if 640x480 + // Offset by -1.0, -1.0 if 320x240 + DISPLAY->TranslateLocal( + -0.5f*SCREEN_WIDTH/(float)PREFSMAN->m_iDisplayWidth, + -0.5f*SCREEN_HEIGHT/(float)PREFSMAN->m_iDisplayHeight, + 0 ); if( m_iNumLines == 0 ) return; @@ -251,9 +256,9 @@ void BitmapText::DrawPrimitives() // set vertex positions // v[iNumV++].p = RageVector3( (float)iX-iDrawExtraPixelsLeft, iY-iHeight/2.0f, 0 ); // top left - v[iNumV++].p = RageVector3( (float)iX-iDrawExtraPixelsLeft+iCharWidth+iDrawExtraPixelsRight, iY-iHeight/2.0f, 0 ); // top right v[iNumV++].p = RageVector3( (float)iX-iDrawExtraPixelsLeft, iY+iHeight/2.0f, 0 ); // bottom left v[iNumV++].p = RageVector3( (float)iX-iDrawExtraPixelsLeft+iCharWidth+iDrawExtraPixelsRight, iY+iHeight/2.0f, 0 ); // bottom right + v[iNumV++].p = RageVector3( (float)iX-iDrawExtraPixelsLeft+iCharWidth+iDrawExtraPixelsRight, iY-iHeight/2.0f, 0 ); // top right iX += iCharWidth; @@ -275,9 +280,9 @@ void BitmapText::DrawPrimitives() const float fExtraTexCoordsRight = iDrawExtraPixelsRight / (float)pTexture->GetSourceWidth(); v[iNumV++].t = RageVector2( frectTexCoords.left - fExtraTexCoordsLeft, frectTexCoords.top ); // top left - v[iNumV++].t = RageVector2( frectTexCoords.right + fExtraTexCoordsRight, frectTexCoords.top ); // top right v[iNumV++].t = RageVector2( frectTexCoords.left - fExtraTexCoordsLeft, frectTexCoords.bottom ); // bottom left v[iNumV++].t = RageVector2( frectTexCoords.right + fExtraTexCoordsRight, frectTexCoords.bottom ); // bottom right + v[iNumV++].t = RageVector2( frectTexCoords.right + fExtraTexCoordsRight, frectTexCoords.top ); // top right } iY += iLineSpacing; @@ -285,10 +290,7 @@ void BitmapText::DrawPrimitives() DISPLAY->SetTexture( pTexture ); - - DISPLAY->SetColorTextureMultDiffuse(); - DISPLAY->SetAlphaTextureMultDiffuse(); - + DISPLAY->SetTextureModeModulate(); if( m_bBlendAdd ) DISPLAY->SetBlendModeAdd(); else @@ -310,8 +312,7 @@ void BitmapText::DrawPrimitives() int i; for( i=0; iAddQuad( &v[i] ); + DISPLAY->DrawQuads( v, iNumV ); DISPLAY->PopMatrix(); } @@ -336,14 +337,13 @@ void BitmapText::DrawPrimitives() for( int i=0; iAddQuad( &v[i] ); + DISPLAY->DrawQuads( v, iNumV ); } ////////////////////// @@ -351,13 +351,12 @@ void BitmapText::DrawPrimitives() ////////////////////// if( m_temp.glow.a != 0 ) { - DISPLAY->SetColorDiffuse(); + DISPLAY->SetTextureModeGlow(); int i; for( i=0; iAddQuad( &v[i] ); + DISPLAY->DrawQuads( v, iNumV ); } } \ No newline at end of file diff --git a/stepmania/src/BitmapText.h b/stepmania/src/BitmapText.h index 5e69b49993..3f25431725 100644 --- a/stepmania/src/BitmapText.h +++ b/stepmania/src/BitmapText.h @@ -15,8 +15,8 @@ #include "Font.h" -const int MAX_TEXT_LINES = 40; -const int MAX_TEXT_CHARS = MAX_NUM_QUADS; +const int MAX_TEXT_LINES = 40; +const int MAX_TEXT_CHARS = 2000; class BitmapText : public Actor { diff --git a/stepmania/src/Combo.cpp b/stepmania/src/Combo.cpp index e727d2cdb4..b24d0865fe 100644 --- a/stepmania/src/Combo.cpp +++ b/stepmania/src/Combo.cpp @@ -15,6 +15,7 @@ #include "ScreenManager.h" #include "ScreenGameplay.h" #include "GameState.h" +#include "ThemeManager.h" void Combo::Reset() diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 4d90592f76..95e9e16588 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -21,6 +21,7 @@ #include "MsdFile.h" #include "PlayerOptions.h" #include "SongOptions.h" +#include "RageUtil.h" void Course::LoadFromCRSFile( CString sPath, CArray &apSongs ) diff --git a/stepmania/src/CourseContentsFrame.cpp b/stepmania/src/CourseContentsFrame.cpp index f4f65f6475..f8ecc085af 100644 --- a/stepmania/src/CourseContentsFrame.cpp +++ b/stepmania/src/CourseContentsFrame.cpp @@ -18,6 +18,10 @@ #include "PrefsManager.h" #include "Course.h" #include "SongManager.h" +#include +#include "RageDisplay.h" +#include "ThemeManager.h" +#include "Notes.h" const float TEXT_BANNER_X = 0; diff --git a/stepmania/src/FootMeter.cpp b/stepmania/src/FootMeter.cpp index 632fd0b672..9ebe0477c7 100644 --- a/stepmania/src/FootMeter.cpp +++ b/stepmania/src/FootMeter.cpp @@ -14,6 +14,8 @@ #include "RageUtil.h" #include "GameConstantsAndTypes.h" #include "PrefsManager.h" +#include "ThemeManager.h" +#include "Notes.h" const int NUM_FEET_IN_METER = 10; diff --git a/stepmania/src/GameConstantsAndTypes.h b/stepmania/src/GameConstantsAndTypes.h index e68855176c..cc68ed5f83 100644 --- a/stepmania/src/GameConstantsAndTypes.h +++ b/stepmania/src/GameConstantsAndTypes.h @@ -27,6 +27,9 @@ #define CENTER_X (SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT)/2.0f) #define CENTER_Y (SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP)/2.0f) +#define SCREEN_NEAR (-1000) +#define SCREEN_FAR (1000) + ///////////////////////// // Note definitions ///////////////////////// diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index 1d577b1369..3b5e044ef7 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -15,12 +15,9 @@ #include "GameConstantsAndTypes.h" #include "GameState.h" #include "GameInput.h" // for GameButton constants -#ifndef DIRECTINPUT_VERSION -#define DIRECTINPUT_VERSION 0x0800 -#endif -#include // for DIK_* key codes #include "IniFile.h" #include "RageLog.h" +#include "RageUtil.h" GameManager* GAMEMAN = NULL; // global and accessable from anywhere in our program @@ -1193,11 +1190,11 @@ void GameManager::GetGameplayStylesForGame( Game game, CArray& aSty } } -void GameManager::GetModesChoicesForGame( Game game, CArray& aChoicesAddTo ) +void GameManager::GetModesChoicesForGame( Game game, CArray& apChoicesAddTo ) { for( int s=0; s& aNotesTypeAddTo ) diff --git a/stepmania/src/GameManager.h b/stepmania/src/GameManager.h index 047a90769c..643fa7da64 100644 --- a/stepmania/src/GameManager.h +++ b/stepmania/src/GameManager.h @@ -14,20 +14,10 @@ #include "StyleDef.h" #include "Style.h" #include "Game.h" +#include "ModeChoice.h" class IniFile; -struct ModeChoice // used in SelectMode -{ - Game game; - PlayMode pm; - Style style; - Difficulty dc; - char name[64]; - int numSidesJoinedToPlay; -}; - - class GameManager { public: @@ -38,7 +28,7 @@ public: const StyleDef* GetStyleDefForStyle( Style s ); void GetGameplayStylesForGame( Game game, CArray& aStylesAddTo, bool editor=false ); - void GetModesChoicesForGame( Game game, CArray& aChoicesAddTo ); + void GetModesChoicesForGame( Game game, CArray& apChoicesAddTo ); void GetNotesTypesForGame( Game game, CArray& aNotesTypeAddTo ); // only look at edit-specific styles // void GetGameNames( CStringArray &AddTo ); diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 6509de51be..b3274752a5 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -17,6 +17,7 @@ #include "InputMapper.h" #include "Song.h" #include "RageLog.h" +#include "ThemeManager.h" GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program diff --git a/stepmania/src/GhostArrow.cpp b/stepmania/src/GhostArrow.cpp index 7ad3c4c194..6d45b07c6b 100644 --- a/stepmania/src/GhostArrow.cpp +++ b/stepmania/src/GhostArrow.cpp @@ -13,6 +13,7 @@ #include "GhostArrow.h" #include "PrefsManager.h" +#include "ThemeManager.h" #define SHOW_SECONDS THEME->GetMetricF("GhostArrow","ShowSeconds") diff --git a/stepmania/src/GhostArrowBright.cpp b/stepmania/src/GhostArrowBright.cpp index cc12d68721..9a5f2c1612 100644 --- a/stepmania/src/GhostArrowBright.cpp +++ b/stepmania/src/GhostArrowBright.cpp @@ -13,6 +13,7 @@ #include "GhostArrowBright.h" #include "PrefsManager.h" +#include "ThemeManager.h" #define SHOW_SECONDS THEME->GetMetricF("GhostArrowBright","ShowSeconds") diff --git a/stepmania/src/GradeDisplay.cpp b/stepmania/src/GradeDisplay.cpp index c06f6d0233..117167b7bf 100644 --- a/stepmania/src/GradeDisplay.cpp +++ b/stepmania/src/GradeDisplay.cpp @@ -14,6 +14,7 @@ #include "RageUtil.h" #include "GameConstantsAndTypes.h" #include "PrefsManager.h" +#include "ThemeManager.h" const float SCROLL_TIME = 5.0f; diff --git a/stepmania/src/GradeDisplay.h b/stepmania/src/GradeDisplay.h index e1c897ca7d..e8353661ae 100644 --- a/stepmania/src/GradeDisplay.h +++ b/stepmania/src/GradeDisplay.h @@ -10,11 +10,10 @@ ----------------------------------------------------------------------------- */ - #include "Sprite.h" #include "PrefsManager.h" #include "Grade.h" - +#include "GameConstantsAndTypes.h" class GradeDisplay : public Sprite diff --git a/stepmania/src/GrayArrow.cpp b/stepmania/src/GrayArrow.cpp index e0e74c2f3d..40263eb52b 100644 --- a/stepmania/src/GrayArrow.cpp +++ b/stepmania/src/GrayArrow.cpp @@ -14,6 +14,8 @@ #include "GrayArrow.h" #include "PrefsManager.h" #include "GameState.h" +#include +#include "ThemeManager.h" #define STEP_SECONDS THEME->GetMetricF("GrayArrow","StepSeconds") diff --git a/stepmania/src/GrooveRadar.cpp b/stepmania/src/GrooveRadar.cpp index 105c5d8be0..816f76bde3 100644 --- a/stepmania/src/GrooveRadar.cpp +++ b/stepmania/src/GrooveRadar.cpp @@ -16,8 +16,8 @@ #include "PrefsManager.h" #include "RageBitmapTexture.h" #include "GameConstantsAndTypes.h" - - +#include "ThemeManager.h" +#include "Notes.h" #define LABEL_OFFSET_X( i ) THEME->GetMetricF("GrooveRadar",ssprintf("Label%dOffsetX",i+1)) @@ -140,8 +140,7 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() const float fRadius = m_sprRadarBase.GetZoomedHeight()/2.0f*1.1f; DISPLAY->SetTexture( NULL ); - DISPLAY->SetColorTextureMultDiffuse(); - DISPLAY->SetAlphaTextureMultDiffuse(); + DISPLAY->SetTextureModeModulate(); RageVertex v[12]; // needed to draw 5 fan primitives and 10 strip primitives for( int p=0; pAddFan( v, 5 ); + DISPLAY->DrawFan( v, 7 ); // @@ -197,7 +196,7 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() v[i*2+1].c = v[i*2+0].c; } - DISPLAY->AddStrip( v, 10 ); + DISPLAY->DrawStrip( v, 12 ); } } diff --git a/stepmania/src/HoldGhostArrow.cpp b/stepmania/src/HoldGhostArrow.cpp index 48f818ba00..9533aabedc 100644 --- a/stepmania/src/HoldGhostArrow.cpp +++ b/stepmania/src/HoldGhostArrow.cpp @@ -15,6 +15,7 @@ #include "PrefsManager.h" #include "RageException.h" #include "RageTimer.h" +#include const float HOLD_GHOST_ARROW_TWEEN_TIME = 0.5f; diff --git a/stepmania/src/HoldJudgement.cpp b/stepmania/src/HoldJudgement.cpp index b21f097b0c..e120f69101 100644 --- a/stepmania/src/HoldJudgement.cpp +++ b/stepmania/src/HoldJudgement.cpp @@ -14,6 +14,7 @@ #include "RageUtil.h" #include "GameConstantsAndTypes.h" #include "PrefsManager.h" +#include "ThemeManager.h" // diff --git a/stepmania/src/Judgement.cpp b/stepmania/src/Judgement.cpp index 9fa041b2d2..1b7fc242c7 100644 --- a/stepmania/src/Judgement.cpp +++ b/stepmania/src/Judgement.cpp @@ -15,6 +15,7 @@ #include "GameConstantsAndTypes.h" #include "PrefsManager.h" #include "GameState.h" +#include "ThemeManager.h" const float JUDGEMENT_DISPLAY_TIME = 0.8f; diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index d49aba29a6..d31f3ce883 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -15,6 +15,9 @@ #include "RageException.h" #include "RageTimer.h" #include "GameState.h" +#include "RageDisplay.h" +#include +#include "ThemeManager.h" // @@ -412,7 +415,7 @@ void LifeMeterBar::DrawPrimitives() m_pStream->m_fPercent = m_fTrailingLifePercentage; m_pStream->m_fHotAlpha = m_fHotAlpha; - float fPercentRed = (m_fTrailingLifePercentageGetTimeSinceStart()*D3DX_PI*4 )/2+0.5f : 0; + float fPercentRed = (m_fTrailingLifePercentageGetTimeSinceStart()*PI*4 )/2+0.5f : 0; m_quadBlackBackground.SetDiffuse( RageColor(fPercentRed*0.8f,0,0,1) ); ActorFrame::DrawPrimitives(); diff --git a/stepmania/src/LifeMeterBattery.cpp b/stepmania/src/LifeMeterBattery.cpp index f0d674f6a7..f1f8ed950b 100644 --- a/stepmania/src/LifeMeterBattery.cpp +++ b/stepmania/src/LifeMeterBattery.cpp @@ -13,6 +13,8 @@ #include "LifeMeterBattery.h" #include "PrefsManager.h" #include "GameState.h" +#include "ThemeManager.h" +#include "Notes.h" const float BATTERY_X[NUM_PLAYERS] = { -92, +92 }; diff --git a/stepmania/src/MenuElements.cpp b/stepmania/src/MenuElements.cpp index 1761ad9c76..207825c938 100644 --- a/stepmania/src/MenuElements.cpp +++ b/stepmania/src/MenuElements.cpp @@ -21,6 +21,7 @@ #include "RageLog.h" #include "GameManager.h" #include "GameState.h" +#include "ThemeManager.h" #define TOP_EDGE_X THEME->GetMetricF("MenuElements","TopEdgeX") diff --git a/stepmania/src/MenuTimer.cpp b/stepmania/src/MenuTimer.cpp index a0620f9b6c..f4d367b98d 100644 --- a/stepmania/src/MenuTimer.cpp +++ b/stepmania/src/MenuTimer.cpp @@ -16,6 +16,7 @@ #include "PrefsManager.h" #include "ScreenManager.h" #include "AnnouncerManager.h" +#include "ThemeManager.h" const float TIMER_SECONDS = 99; diff --git a/stepmania/src/ModeChoice.h b/stepmania/src/ModeChoice.h new file mode 100644 index 0000000000..e2574b1483 --- /dev/null +++ b/stepmania/src/ModeChoice.h @@ -0,0 +1,24 @@ +#pragma once +/* +----------------------------------------------------------------------------- + Class: ModeChoice + + Desc: . + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Game.h" +#include "Style.h" + +struct ModeChoice // used in SelectMode +{ + Game game; + PlayMode pm; + Style style; + Difficulty dc; + char name[64]; + int numSidesJoinedToPlay; +}; diff --git a/stepmania/src/MusicSortDisplay.cpp b/stepmania/src/MusicSortDisplay.cpp index 6fb14d01c7..cc6ac1dd08 100644 --- a/stepmania/src/MusicSortDisplay.cpp +++ b/stepmania/src/MusicSortDisplay.cpp @@ -15,6 +15,7 @@ #include "GameConstantsAndTypes.h" #include "MusicWheel.h" #include "MusicSortDisplay.h" +#include "ThemeManager.h" MusicSortDisplay::MusicSortDisplay() diff --git a/stepmania/src/MusicStatusDisplay.cpp b/stepmania/src/MusicStatusDisplay.cpp index e036d3f724..b74bdaa85b 100644 --- a/stepmania/src/MusicStatusDisplay.cpp +++ b/stepmania/src/MusicStatusDisplay.cpp @@ -16,7 +16,8 @@ #include "MusicWheel.h" #include "MusicStatusDisplay.h" #include "RageTimer.h" - +#include +#include "ThemeManager.h" MusicStatusDisplay::MusicStatusDisplay() diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index f53fc4ecb0..bd6d55623c 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -20,6 +20,8 @@ #include "RageLog.h" #include "GameConstantsAndTypes.h" #include "GameState.h" +#include +#include "ThemeManager.h" // WheelItem stuff diff --git a/stepmania/src/NoteDisplay.cpp b/stepmania/src/NoteDisplay.cpp index c9f7c0b0d4..e22b79275a 100644 --- a/stepmania/src/NoteDisplay.cpp +++ b/stepmania/src/NoteDisplay.cpp @@ -21,6 +21,8 @@ #include "RageException.h" #include "ArrowEffects.h" #include "RageLog.h" +#include +#include "RageDisplay.h" bool g_bDrawHoldHeadForTapsOnSameRow, g_bDrawTapOnTopOfHoldHead, g_bDrawTapOnTopOfHoldTail; // cache @@ -221,14 +223,14 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float const int fYStep = 8; // draw a segment every 8 pixels // this requires that the texture dimensions be a multiple of 8 - DISPLAY->SetBlendModeNormal(); - if( bDrawGlowOnly ) - DISPLAY->SetColorDiffuse(); - else - DISPLAY->SetColorTextureMultDiffuse(); - DISPLAY->SetAlphaTextureMultDiffuse(); - DISPLAY->EnableTextureWrapping(); - DISPLAY->SetTexture( m_sprHoldParts.GetTexture() ); +// DISPLAY->SetBlendModeNormal(); +// if( bDrawGlowOnly ) +// DISPLAY->SetColorDiffuse(); +// else +// DISPLAY->SetColorTextureMultDiffuse(); +// DISPLAY->SetAlphaTextureMultDiffuse(); +// DISPLAY->EnableTextureWrapping(); +// DISPLAY->SetTexture( m_sprHoldParts.GetTexture() ); // // Draw the tail @@ -269,11 +271,13 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float if( !bDrawGlowOnly && colorDiffuseTop.a==0 && colorDiffuseBottom.a==0 ) continue; - DISPLAY->AddQuad( - RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordLeft, fTexCoordTop), // colorGlowTop, // top-left - RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordRight, fTexCoordTop), // colorGlowTop, // top-right - RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordLeft, fTexCoordBottom),// colorGlowBottom, // bottom-left - RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordRight, fTexCoordBottom) );//, colorGlowBottom ); // bottom-right + static RageVertex v[4]; + v[0].p = RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0); v[0].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[0].t = RageVector2(fTexCoordLeft, fTexCoordTop), + v[1].p = RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0); v[1].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[1].t = RageVector2(fTexCoordRight, fTexCoordTop); + v[2].p = RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0); v[2].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordLeft, fTexCoordBottom); + v[3].p = RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0); v[3].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[3].t = RageVector2(fTexCoordRight, fTexCoordBottom); + + DISPLAY->DrawQuad( v ); } // @@ -310,11 +314,11 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float if( !bDrawGlowOnly && colorDiffuseTop.a==0 && colorDiffuseBottom.a==0 ) continue; - DISPLAY->AddQuad( - RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordLeft, fTexCoordTop), //colorGlowTop, // top-left - RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordRight, fTexCoordTop), //colorGlowTop, // top-right - RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordLeft, fTexCoordBottom), //colorGlowBottom, // bottom-left - RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordRight, fTexCoordBottom) );//, colorGlowBottom ); // bottom-right + static RageVertex v[4]; + v[0].p = RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0); v[0].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[2].t = RageVector2(fTexCoordLeft, fTexCoordTop); + v[1].p = RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0); v[1].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[2].t = RageVector2(fTexCoordRight, fTexCoordTop); + v[2].p = RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0); v[2].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordLeft, fTexCoordBottom); + v[3].p = RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0); v[3].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordRight, fTexCoordBottom); } if( g_bDrawTapOnTopOfHoldHead ) @@ -357,14 +361,12 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float if( !bDrawGlowOnly && colorDiffuseTop.a==0 && colorDiffuseBottom.a==0 ) continue; - DISPLAY->AddQuad( - RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordLeft, fTexCoordTop), // colorGlowTop, // top-left - RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordRight, fTexCoordTop), // colorGlowTop, // top-right - RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordLeft, fTexCoordBottom),// colorGlowBottom, // bottom-left - RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordRight, fTexCoordBottom) );//, colorGlowBottom ); // bottom-right + static RageVertex v[4]; + v[0].p = RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0); v[0].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[2].t = RageVector2(fTexCoordLeft, fTexCoordTop); + v[0].p = RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0); v[0].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[2].t = RageVector2(fTexCoordRight, fTexCoordTop); + v[0].p = RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0); v[0].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordLeft, fTexCoordBottom); + v[0].p = RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0); v[0].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordRight, fTexCoordBottom); } - - DISPLAY->FlushQueue(); } else { diff --git a/stepmania/src/NoteField.cpp b/stepmania/src/NoteField.cpp index edf70437bc..948af0a23d 100644 --- a/stepmania/src/NoteField.cpp +++ b/stepmania/src/NoteField.cpp @@ -21,6 +21,8 @@ #include "RageException.h" #include "RageTimer.h" #include "RageLog.h" +#include +#include "ThemeManager.h" const float HOLD_NOTE_BITS_PER_BEAT = 6; diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 7201163c2b..e15c38aa25 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -24,6 +24,8 @@ #include "ScoreKeeperMAX2.h" #include "RageLog.h" #include "RageMath.h" +#include "RageDisplay.h" +#include "ThemeManager.h" #include "Combo.h" #define JUDGE_PERFECT_ZOOM_X THEME->GetMetricF("Player","JudgePerfectZoomX") @@ -298,26 +300,28 @@ void Player::DrawPrimitives() if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_bEffects[PlayerOptions::EFFECT_SPACE] ) { // save old view and projection - DISPLAY->GetViewTransform( &matOldView ); - DISPLAY->GetProjectionTransform( &matOldProj ); - // construct view and project matrix - RageMatrix matNewView; - RageVector3 Eye, At, Up( 0.0f, -1.0f, 0.0f ); - if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_bReverseScroll ) { - Eye = RageVector3( CENTER_X, GetY()-300.0f, 400.0f ); - At = RageVector3( CENTER_X, GetY()+100.0f, 0.0f ); - } else { - Eye = RageVector3( CENTER_X, GetY()+800.0f, 400.0f ); - At = RageVector3( CENTER_X, GetY()+400.0f, 0.0f ); - } - RageMatrixLookAtLH( &matNewView, &Eye, &At, &Up ); - - DISPLAY->SetViewTransform( &matNewView ); - - RageMatrix matNewProj; - RageMatrixPerspectiveFovLH( &matNewProj, D3DX_PI/4.0f, SCREEN_WIDTH/(float)SCREEN_HEIGHT, 0.0f, 1000.0f ); - DISPLAY->SetProjectionTransform( &matNewProj ); +// TODO: Re-add this code +// DISPLAY->GetViewTransform( &matOldView ); +// DISPLAY->GetProjectionTransform( &matOldProj ); +// +// // construct view and project matrix +// RageMatrix matNewView; +// RageVector3 Eye, At, Up( 0.0f, -1.0f, 0.0f ); +// if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_bReverseScroll ) { +// Eye = RageVector3( CENTER_X, GetY()-300.0f, 400.0f ); +// At = RageVector3( CENTER_X, GetY()+100.0f, 0.0f ); +// } else { +// Eye = RageVector3( CENTER_X, GetY()+800.0f, 400.0f ); +// At = RageVector3( CENTER_X, GetY()+400.0f, 0.0f ); +// } +// RageMatrixLookAtLH( &matNewView, &Eye, &At, &Up ); +// +// DISPLAY->SetViewTransform( &matNewView ); +// +// RageMatrix matNewProj; +// RageMatrixPerspectiveFovLH( &matNewProj, PI/4.0f, SCREEN_WIDTH/(float)SCREEN_HEIGHT, 0.0f, 1000.0f ); +// DISPLAY->SetProjectionTransform( &matNewProj ); } m_GrayArrowRow.Draw(); @@ -326,9 +330,10 @@ void Player::DrawPrimitives() if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_bEffects[PlayerOptions::EFFECT_SPACE] ) { - // restire old view and projection - DISPLAY->SetViewTransform( &matOldView ); - DISPLAY->SetProjectionTransform( &matOldProj ); +// TODO: Re-add this code +// // restire old view and projection +// DISPLAY->SetViewTransform( &matOldView ); +// DISPLAY->SetProjectionTransform( &matOldProj ); } m_frameJudgement.Draw(); diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 21868a00ec..e2159e8a15 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -16,6 +16,9 @@ #include "GameState.h" #include "RageException.h" #include "RageDisplay.h" +#include "RageUtil.h" +#include "AnnouncerManager.h" +#include "ThemeManager.h" PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program @@ -28,9 +31,11 @@ PrefsManager::PrefsManager() #else m_bWindowed = false; #endif - m_iDisplayResolution = 640; - m_iTextureResolution = 1024; - m_iRefreshRate = RageDisplay::REFRESH_DEFAULT; + m_iDisplayWidth = 640; + m_iDisplayHeight = 480; + m_iDisplayColorDepth = 16; + m_iTextureColorDepth = 16; + m_iRefreshRateMode = REFRESH_DEFAULT; m_bIgnoreJoyAxes = true; m_bOnlyDedicatedMenuButtons = false; #ifdef _DEBUG @@ -80,9 +85,11 @@ PrefsManager::~PrefsManager() return; // could not read config file, load nothing ini.GetValueB( "Options", "Windowed", m_bWindowed ); - ini.GetValueI( "Options", "DisplayResolution", m_iDisplayResolution ); - ini.GetValueI( "Options", "TextureResolution", m_iTextureResolution ); - ini.GetValueI( "Options", "RefreshRate", m_iRefreshRate ); + ini.GetValueI( "Options", "DisplayWidth", m_iDisplayWidth ); + ini.GetValueI( "Options", "DisplayHeight", m_iDisplayHeight ); + ini.GetValueI( "Options", "DisplayColorDepth", m_iDisplayColorDepth ); + ini.GetValueI( "Options", "TextureColorDepth", m_iTextureColorDepth ); + ini.GetValueI( "Options", "RefreshRate", (int&)m_iRefreshRateMode ); ini.GetValueB( "Options", "IgnoreJoyAxes", m_bIgnoreJoyAxes ); ini.GetValueB( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons ); ini.GetValueB( "Options", "ShowStats", m_bShowStats ); @@ -129,9 +136,11 @@ void PrefsManager::SaveGlobalPrefsToDisk() ini.SetPath( "StepMania.ini" ); ini.SetValueB( "Options", "Windowed", m_bWindowed ); - ini.SetValueI( "Options", "DisplayResolution", m_iDisplayResolution ); - ini.SetValueI( "Options", "TextureResolution", m_iTextureResolution ); - ini.SetValueI( "Options", "RefreshRate", m_iRefreshRate ); + ini.SetValueI( "Options", "DisplayWidth", m_iDisplayWidth ); + ini.SetValueI( "Options", "DisplayHeight", m_iDisplayHeight ); + ini.SetValueI( "Options", "DisplayColorDepth", m_iDisplayColorDepth ); + ini.SetValueI( "Options", "TextureColorDepth", m_iTextureColorDepth ); + ini.SetValueI( "Options", "RefreshRate", m_iRefreshRateMode ); ini.SetValueB( "Options", "IgnoreJoyAxes", m_bIgnoreJoyAxes ); ini.SetValueB( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons ); ini.SetValueB( "Options", "ShowStats", m_bShowStats ); @@ -204,18 +213,3 @@ void PrefsManager::SaveGamePrefsToDisk() ini.WriteFile(); } - -int PrefsManager::GetDisplayHeight() -{ - switch( m_iDisplayResolution ) - { - case 1280: return 1024; break; - case 1024: return 768; break; - case 800: return 600; break; - case 640: return 480; break; - case 512: return 384; break; - case 400: return 300; break; - case 320: return 240; break; - default: throw RageException( "Invalid DisplayWidth '%d'", m_iDisplayResolution ); - } -} diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 8b033fcabc..4c6946f8d8 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -10,13 +10,6 @@ ----------------------------------------------------------------------------- */ -#include "GameConstantsAndTypes.h" - - -#include "AnnouncerManager.h" -#include "ThemeManager.h" -#include "GameManager.h" - class PrefsManager { @@ -28,9 +21,11 @@ public: // GameOptions (ARE saved between sessions) bool m_bWindowed; - int m_iDisplayResolution; - int m_iTextureResolution; - int m_iRefreshRate; // 0 means 'default' + int m_iDisplayWidth; + int m_iDisplayHeight; + int m_iDisplayColorDepth; + int m_iTextureColorDepth; + int m_iRefreshRateMode; bool m_bShowStats; BackgroundMode m_BackgroundMode; float m_fBGBrightness; @@ -60,8 +55,6 @@ public: CStringArray m_asAdditionalSongFolders; CString m_DWIPath; - int GetDisplayHeight(); - void ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame ); void SaveGlobalPrefsToDisk(); diff --git a/stepmania/src/Quad.h b/stepmania/src/Quad.h index 90c5ae9dc3..baf53f9720 100644 --- a/stepmania/src/Quad.h +++ b/stepmania/src/Quad.h @@ -10,14 +10,14 @@ ----------------------------------------------------------------------------- */ -#include "Actor.h" +#include "Sprite.h" -class Quad : public Actor +class Quad : public Sprite { public: - Quad(); - - virtual void DrawPrimitives(); - + Quad() + { + m_bDrawIfTextureNull = true; + } }; diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index c777c24c01..55aa5f4286 100644 --- a/stepmania/src/RageBitmapTexture.cpp +++ b/stepmania/src/RageBitmapTexture.cpp @@ -15,6 +15,7 @@ #include "RageUtil.h" #include "RageLog.h" #include "RageException.h" +#include "RageTextureManager.h" #include "SDL.h" #include "SDL_image.h" @@ -22,183 +23,43 @@ #include "SDL_rotozoom.h" #include "SDL_utils.h" #include "SDL_dither.h" +#include "SDL_opengl.h" -#include "RageTimer.h" - - - -/* Definitions for various texture formats. We'll probably want RGBA - * in OpenGL, not ARGB ... All of these are in local (little) endian; - * this may or may not need adjustment for OpenGL. */ -const static unsigned int PixFmtMasks[][5] = -{ - /* Err. D3D's texture formats are little-endian, so the order of - * colors (bytewise) is BGRA; D3DFMT_A8R8G8B8 is really BGRA (bytewise). - * D3DFMT_A4R4G4B4 is 0xGBAR; flip the bytes and it's sane (0xARGB). - */ - { 0x00FF0000, /* B8G8R8A8 */ - 0x0000FF00, - 0x000000FF, - 0xFF000000, 32 }, - { 0x0F00, /* B4G4R4A4 */ - 0x00F0, - 0x000F, - 0xF000, 16 }, - { 0x7C00, /* B5G5R5A1 */ - 0x03E0, - 0x001F, - 0x8000, 16 }, - { 0xF800, /* B5G6R5 */ - 0x07E0, - 0x001F, - 0x0000, 16 } -}; - -int PixFmtMaskNo(D3DFORMAT fmt) -{ - switch(fmt) { - case D3DFMT_A8R8G8B8: return 0; - case D3DFMT_A4R4G4B4: return 1; - case D3DFMT_A1R5G5B5: return 2; - case D3DFMT_R5G6B5: return 3; - default: ASSERT(0); return 0; - } -} //----------------------------------------------------------------------------- // RageBitmapTexture constructor //----------------------------------------------------------------------------- -RageBitmapTexture::RageBitmapTexture( - RageDisplay* pScreen, - const CString &sFilePath, - int dwMaxSize, - int dwTextureColorDepth, - int iMipMaps, - int iAlphaBits, - bool bDither, - bool bStretch - ) : - RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ) +RageBitmapTexture::RageBitmapTexture( const CString &sFilePath ) : RageTexture( sFilePath ) { // LOG->Trace( "RageBitmapTexture::RageBitmapTexture()" ); - m_pd3dTexture = NULL; - - //if( !LoadFromCacheFile() ) - Create( dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ); - - //SaveToCache(); - - CreateFrameRects(); + Load( sFilePath ); } RageBitmapTexture::~RageBitmapTexture() { - SAFE_RELEASE(m_pd3dTexture); + glDeleteTextures(1, &m_uGLTextureID); } -void RageBitmapTexture::Reload( - int dwMaxSize, - int dwTextureColorDepth, - int iMipMaps, - int iAlphaBits, - bool bDither, - bool bStretch - ) -{ - SAFE_RELEASE(m_pd3dTexture); - Create( dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ); - // leave m_iRefCount alone! - CreateFrameRects(); -} - -//----------------------------------------------------------------------------- -// GetTexture -//----------------------------------------------------------------------------- -LPDIRECT3DTEXTURE8 RageBitmapTexture::GetD3DTexture() -{ - return m_pd3dTexture; -} - -#if 1 - -static int power_of_two(int input) +int power_of_two(int input) { int value = 1; - while ( value < input ) value <<= 1; - return value; } -/* - * Each dwMaxSize, dwTextureColorDepth and iAlphaBits are maximums; we may - * use less. iAlphaBits must be 0, 1 or 4. - * - * XXX: change iAlphaBits == 4 to iAlphaBits == 8 to indicate "as much alpha - * as needed", since that's what it really is; still only use 4 in 16-bit textures. - * - * Dither forces dithering when loading 16-bit textures. - * Stretch forces the loaded image to fill the texture completely. - */ - -void RageBitmapTexture::Create( - int dwMaxSize, - int dwTextureColorDepth, - int iMipMaps, - int iAlphaBits, - bool bDither, - bool bStretch - ) +void RageBitmapTexture::Load( const CString &sFilePath ) { - HRESULT hr; + m_sFilePath = sFilePath; // save file path - // look in the file name for a format hints - m_sFilePath.MakeLower(); + int iMaxSize = DISPLAY->GetMaxTextureSize(); - if( m_sFilePath.Find("no alpha") != -1 ) iAlphaBits = 0; - else if( m_sFilePath.Find("1 alpha") != -1 ) iAlphaBits = 1; - else if( m_sFilePath.Find("1alpha") != -1 ) iAlphaBits = 1; - else if( m_sFilePath.Find("0alpha") != -1 ) iAlphaBits = 0; - if( m_sFilePath.Find("dither") != -1 ) bDither = true; + SDL_Surface *img; /* Load the image into an SDL surface. */ - SDL_Surface *img = IMG_Load(m_sFilePath); - - /* Figure out which texture format to use. */ - D3DFORMAT fmtTexture; - - if( dwTextureColorDepth == 16 ) { - /* Bits of alpha in the source: */ - int src_alpha_bits = 8 - img->format->Aloss; - - /* No real alpha in paletted input. */ - if( img->format->BytesPerPixel == 1 ) - src_alpha_bits = 0; - - /* Colorkeyed input effectively has at least one bit of alpha: */ - if( img->flags & SDL_SRCCOLORKEY ) - src_alpha_bits = max( 1, src_alpha_bits ); - - /* Don't use more than we were hinted to. */ - src_alpha_bits = min( iAlphaBits, src_alpha_bits ); - - /* XXX Scan the image, and see if it actually uses its alpha channel/color key - * (if any). Reduce to 1 or 0 bits of alpha if possible. */ - - switch( src_alpha_bits ) { - case 0: fmtTexture = D3DFMT_R5G6B5; break; - case 1: fmtTexture = D3DFMT_A1R5G5B5; break; - default: fmtTexture = D3DFMT_A4R4G4B4; break; - } - } else if( dwTextureColorDepth == 32 ) - fmtTexture = D3DFMT_A8R8G8B8; - else - throw RageException( "Invalid color depth: %d bits", dwTextureColorDepth ); - - /* Cap the max texture size to the hardware max. Is this needed--won't the - * texture creation do this for us? */ - dwMaxSize = min( dwMaxSize, int(DISPLAY->GetDeviceCaps().MaxTextureWidth) ); + img = IMG_Load(sFilePath); + if(!img) + throw RageException("Could not load graphic '%s'", sFilePath.GetString()); /* Save information about the source. Unless something else changes this * later, the image inside the texture is the same size as the source. */ @@ -209,88 +70,6 @@ void RageBitmapTexture::Create( m_iTextureWidth = power_of_two(img->w); m_iTextureHeight = power_of_two(img->h); - /* Cap the size. */ - m_iTextureWidth = min(m_iTextureWidth, int(dwMaxSize)); - m_iTextureHeight = min(m_iTextureHeight, int(dwMaxSize)); - - if( FAILED( hr = m_pd3dDevice->CreateTexture( - m_iTextureWidth, // width - m_iTextureHeight, // height - 1, // mip map levels XXX: sending 4 breaks 2x2 pngs - 0, // usage (is a render target?) - fmtTexture, // our preferred texture format - D3DPOOL_MANAGED, // which memory pool - &m_pd3dTexture) )) - { - throw RageException( hr, "CreateTexture() failed for file '%s'.", m_sFilePath.GetString() ); - } - - { - D3DSURFACE_DESC ddsd; - if ( FAILED( hr = m_pd3dTexture->GetLevelDesc( 0, &ddsd ) ) ) - throw RageException( hr, "Could not get level Description of D3D texture!" ); - - /* We might have received a texture of a different size or format than - * we asked for. */ - m_iTextureWidth = ddsd.Width; - m_iTextureHeight = ddsd.Height; - fmtTexture = ddsd.Format; - } - - /* If the source is larger than the texture, we have to scale it down; that's - * "stretching", I guess. */ - if(m_iSourceWidth > m_iTextureWidth || m_iSourceHeight > m_iTextureHeight) - bStretch = true; - - int target = PixFmtMaskNo(fmtTexture); - - /* Dither only when the target is 16bpp, not when it's 32bpp. */ - if( PixFmtMasks[target][4] /* XXX magic 4 */ == 4) - bDither = false; - - if( bStretch ) { - /* zoomSurface takes a ratio. I'm not sure if it's always exact; we don't - * want to accidentally create a 513x513 texture, for example (it won't just - * cause lines; it'll be copied to the texture completely wrong). */ - - /* resize currently only does RGBA8888 */ - { - int mask = 0; - ConvertSDLSurface(img, img->w, img->h, PixFmtMasks[mask][4], - PixFmtMasks[mask][0], PixFmtMasks[mask][1], PixFmtMasks[mask][2], PixFmtMasks[mask][3]); - } - - while (m_iImageWidth != m_iTextureWidth || m_iImageHeight != m_iTextureHeight) { - float xscale = float(m_iTextureWidth)/m_iImageWidth; - float yscale = float(m_iTextureHeight)/m_iImageHeight; - - /* Our filter is a simple linear filter, so it can't scale to - * less than .5 very well. If we need to go lower than .5, do - * it iteratively. */ - xscale = max(xscale, .5f); - yscale = max(yscale, .5f); - - SDL_Surface *dst = zoomSurface(img, xscale, yscale); - - SDL_FreeSurface(img); - img = dst; - - /* The new image size is the full texture size. */ - m_iImageWidth = int(m_iImageWidth * xscale + .0001); - m_iImageHeight = int(m_iImageHeight * yscale + .0001); - } - } - - if( bDither ) - { - /* Dither down to the destination format. */ - SDL_Surface *dst = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, img->w, img->h, PixFmtMasks[target][4], - PixFmtMasks[target][0], PixFmtMasks[target][1], PixFmtMasks[target][2], PixFmtMasks[target][3]); - - SM_SDL_OrderedDither(img, dst); - SDL_FreeSurface(img); - img = dst; - } /* Convert the data to the destination format. Hmm. We could just * convert the format, leaving the resolution alone (simplifying @@ -300,160 +79,35 @@ void RageBitmapTexture::Create( * We don't want anything else to be linearly filtered in on the * edge of the texture ... */ - ConvertSDLSurface(img, m_iTextureWidth, m_iTextureHeight, PixFmtMasks[target][4], - PixFmtMasks[target][0], PixFmtMasks[target][1], PixFmtMasks[target][2], PixFmtMasks[target][3]); + ConvertSDLSurface(img, m_iTextureWidth, m_iTextureHeight, 32, + 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 ); - /* Copy the data to the target texture. */ - { - D3DLOCKED_RECT d3dlr; - if( FAILED( hr=m_pd3dTexture->LockRect(0, &d3dlr, 0, 0) ) ) - throw RageException( hr, "LockRect failed for file '%s'.", m_sFilePath.GetString() ); - memcpy( (byte *)(d3dlr.pBits), img->pixels, img->h*img->pitch ); - ASSERT( !FAILED( m_pd3dTexture->UnlockRect(0) ) ) ; - } + glGenTextures(1, &m_uGLTextureID); + DISPLAY->FlushQueue(); + glBindTexture(GL_TEXTURE_2D, m_uGLTextureID); + glPixelStorei(GL_UNPACK_ROW_LENGTH, img->pitch / img->format->BytesPerPixel); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, img->w, img->h, 0, GL_RGBA, + GL_UNSIGNED_BYTE, img->pixels); + glFlush(); + SDL_FreeSurface(img); - LOG->Trace( "RageBitmapTexture: Loaded '%s' (%ux%u) from disk. bStretch = %d, source %d,%d; image %d,%d.", - m_sFilePath.GetString(), GetTextureWidth(), GetTextureHeight(), - bStretch, m_iSourceWidth, m_iSourceHeight, - m_iImageWidth, m_iImageHeight); + + + CreateFrameRects(); } -#else - -#include "DXUtil.h" -#include "dxerr8.h" - -void RageBitmapTexture::Create( - int dwMaxSize, - int dwTextureColorDepth, - int iMipMaps, - int iAlphaBits, - bool bDither, - bool bStretch - ) +void RageBitmapTexture::Reload() { - HRESULT hr; + glDeleteTextures(1, &m_uGLTextureID); - // 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; - else if( -1 != m_sFilePath.Find("1alpha") ) - iAlphaBits = 1; - else if( -1 != m_sFilePath.Find("0alpha") ) - iAlphaBits = 0; - if( -1 != m_sFilePath.Find("dither") ) - bDither = true; - - - ///////////////////// - // Get info about the bitmap - ///////////////////// - D3DXIMAGE_INFO ddii; - if( FAILED( hr = D3DXGetImageInfoFromFile(m_sFilePath,&ddii) ) ) - { - throw RageException( hr, "D3DXGetImageInfoFromFile() failed for file '%s'.", m_sFilePath.GetString() ); - } - - - /////////////////////// - // Figure out which texture format to use - /////////////////////// - D3DFORMAT fmtTexture; - if( dwTextureColorDepth == 32 ) - fmtTexture = D3DFMT_A8R8G8B8; - else if( ddii.Format == D3DFMT_P8 ) - fmtTexture = D3DFMT_A1R5G5B5; - else // dwTextureColorDepth == 16 - { - switch( iAlphaBits ) - { - case 0: fmtTexture = D3DFMT_R5G6B5; break; - case 1: fmtTexture = D3DFMT_A1R5G5B5; break; - case 4: fmtTexture = D3DFMT_A4R4G4B4; break; - default: ASSERT(0); fmtTexture = D3DFMT_A4R4G4B4; break; - } - } - - - // find out what the min texture size is - dwMaxSize = min( dwMaxSize, int(DISPLAY->GetDeviceCaps().MaxTextureWidth) ); - - bStretch |= int(ddii.Width) > dwMaxSize || int(ddii.Height) > dwMaxSize; - - // HACK: On a Voodoo3 and Win98, D3DXCreateTextureFromFileEx fail randomly on rare occasions. - // So, we'll try the call 2x in a row in case the first one fails. - for( int i=0; i<2; i++ ) - { - if( FAILED( hr = D3DXCreateTextureFromFileEx( - m_pd3dDevice, // device - m_sFilePath, // soure file - D3DX_DEFAULT, // width - D3DX_DEFAULT, // height - iMipMaps, // mip map levels - 0, // usage (is a render target?) - fmtTexture, // our preferred texture format - D3DPOOL_MANAGED, // which memory pool - (bStretch ? D3DX_FILTER_LINEAR : D3DX_FILTER_NONE) | (bDither ? D3DX_FILTER_DITHER : 0), // filter - D3DX_FILTER_BOX | (bDither ? D3DX_FILTER_DITHER : 0), // mip filter - D3DCOLOR_ARGB(255,255,0,255), // pink color key - &ddii, // struct to fill with source image info - NULL, // no palette - &m_pd3dTexture ) ) ) - { - if( i==0 ) - { - LOG->Trace( "WARNING! D3DXCreateTextureFromFileEx failed. Sleep and try one more time..." ); - ::Sleep( 10 ); - continue; - } - throw RageException( hr, "D3DXCreateTextureFromFileEx() failed for file '%s'.", m_sFilePath.GetString() ); - } - else - break; - } - - ///////////////////// - // Save information about the texture - ///////////////////// - m_iSourceWidth = ddii.Width; - m_iSourceHeight= ddii.Height; - - D3DSURFACE_DESC ddsd; - if ( FAILED( hr = m_pd3dTexture->GetLevelDesc( 0, &ddsd ) ) ) - throw RageException( hr, "Could not get level Description of D3DX texture!" ); - - // save information about the texture - m_iTextureWidth = ddsd.Width; - m_iTextureHeight = ddsd.Height; - - - if( bStretch ) - { - m_iImageWidth = m_iTextureWidth; - m_iImageHeight = m_iTextureHeight; - } - else - { - m_iImageWidth = m_iSourceWidth; - m_iImageHeight = m_iSourceHeight; - } - - LOG->Trace( "RageBitmapTexture: Loaded '%s' (%ux%u) from disk. bStretch = %d, source %d,%d; image %d,%d.", - m_sFilePath.GetString(), - GetTextureWidth(), - GetTextureHeight(), - bStretch, - m_iSourceWidth, - m_iSourceHeight, - m_iImageWidth, - m_iImageHeight - ); + Load( m_sFilePath ); } -#endif \ No newline at end of file +unsigned int RageBitmapTexture::GetGLTextureID() +{ + return m_uGLTextureID; +} \ No newline at end of file diff --git a/stepmania/src/RageBitmapTexture.h b/stepmania/src/RageBitmapTexture.h index aecf531de9..e1dcff3274 100644 --- a/stepmania/src/RageBitmapTexture.h +++ b/stepmania/src/RageBitmapTexture.h @@ -22,39 +22,15 @@ class RageBitmapTexture : public RageTexture { public: - RageBitmapTexture( - RageDisplay* pScreen, - const CString &sFilePath, - int dwMaxSize = 2048, - int dwTextureColorDepth = 16, - int iMipMaps = 4, - int iAlphaBits = 4, - bool bDither = false, - bool bStretch = false - ); + RageBitmapTexture( const CString &sFilePath ); virtual ~RageBitmapTexture(); - virtual void Reload( - int dwMaxSize, - int dwTextureColorDepth, - int iMipMaps = 4, - int iAlphaBits = 4, - bool bDither = false, - bool bStretch = false - ); - virtual LPDIRECT3DTEXTURE8 GetD3DTexture(); - protected: + virtual void Load( const CString &sFilePath ); + virtual void Reload(); - virtual void Create( - int dwMaxSize, - int dwTextureColorDepth, - int iMipMaps, - int iAlphaBits, - bool bDither, - bool bStretch - ); + virtual unsigned int GetGLTextureID(); - - LPDIRECT3DTEXTURE8 m_pd3dTexture; + unsigned int m_uGLTextureID; + CString m_sFilePath; }; diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index 5dd54a2b05..50e4d158c7 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -18,222 +18,46 @@ #include "RageException.h" #include "RageTexture.h" #include "RageMath.h" +#include "SDL.h" +#include "SDL_opengl.h" +#include "RageTypes.h" +#include "GameConstantsAndTypes.h" RageDisplay* DISPLAY = NULL; -RageDisplay::RageDisplay( HWND hWnd ) +//////////// +// Globals +//////////// +const int MAX_NUM_VERTICIES = 1000; +SDL_Surface *g_screen = NULL; // this class is a singleton, so there can be only one +vector g_matModelStack; // model matrix stack +RageMatrix g_matView; // view matrix +RageMatrix& GetTopModelMatrix() { return g_matModelStack.back(); } +int g_flags = 0; /* SDL video flags */ +GLenum g_vertMode = GL_TRIANGLES; +RageVertex g_vertQueue[MAX_NUM_VERTICIES]; +int g_iNumVerts; +float g_fLastCheckTime; +int g_iFramesRenderedSinceLastCheck; +int g_iVertsRenderedSinceLastCheck; +int g_iDrawsSinceLastCheck; +int g_iFPS, g_iTPF, g_iDPF; + + +RageDisplay::RageDisplay( bool windowed, int width, int height, int bpp, RefreshRateMode rate, bool vsync ) { - LOG->Trace( "RageDisplay::RageDisplay()" ); +// LOG->Trace( "RageDisplay::RageDisplay()" ); - // Save the window handle - m_hWnd = hWnd; - m_pd3d = NULL; - m_pd3dDevice = NULL; - m_pVB = NULL; - - m_fLastCheckTime = TIMER->GetTimeSinceStart(); - m_iFramesRenderedSinceLastCheck = 0; - m_iTrianglesRenderedSinceLastCheck = 0; - m_iDrawsSinceLastCheck = 0; - m_iFPS = 0; - m_iTPF = 0; - m_iDPF = 0; - - m_iNumVerts = 0; - - try - { - // Construct a Direct3D object - m_pd3d = Direct3DCreate8( D3D_SDK_VERSION ); - } - catch (...) - { - // Edwin Evans: Catch any exception. It won't be caught by main exception handler. - throw RageException( "Unknown exception in Direct3DCreate8." ); - } - - if( NULL == m_pd3d ) - throw RageException( "Direct3DCreate8 failed." ); - - HRESULT hr; - if( FAILED( hr = m_pd3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &m_DeviceCaps) ) ) - { - throw RageException( - "There was an error while initializing your video card.\n\n" - "Your system is reporting that Direct3D8 hardware acceleration\n" - "is not available. In most cases, you can download an updated\n" - "driver from your card's manufacturer." - ); - } - - LOG->Trace( - "Video card info:\n" - " - max texture width is %d\n" - " - max texture height is %d\n" - " - max texture blend stages is %d\n" - " - max simultaneous textures is %d\n", - m_DeviceCaps.MaxTextureWidth, - m_DeviceCaps.MaxTextureHeight, - m_DeviceCaps.MaxTextureBlendStages, - m_DeviceCaps.MaxSimultaneousTextures - ); - - - - // Enumerate possible display modes - LOG->Trace( "This display adaptor supports the following modes:" ); - for( UINT u=0; uGetAdapterModeCount(D3DADAPTER_DEFAULT); u++ ) - { - D3DDISPLAYMODE mode; - if( SUCCEEDED( m_pd3d->EnumAdapterModes( D3DADAPTER_DEFAULT, u, &mode ) ) ) - { - LOG->Trace( " %ux%u %uHz, format %d", mode.Width, mode.Height, mode.RefreshRate, mode.Format ); - } - } - - // Save the original desktop format. - m_pd3d->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &m_DesktopMode ); - - D3DADAPTER_IDENTIFIER8 identifier; - if( FAILED( hr = m_pd3d->GetAdapterIdentifier( D3DADAPTER_DEFAULT, 0, &identifier ) ) ) - LOG->Trace( hr, "GetAdapterIdentifier failed" ); - else - LOG->Trace( "Driver: %s. Description: %s.", - identifier.Driver, identifier.Description ); -} - -unsigned RageDisplay::MaxRefresh(unsigned uWidth, unsigned uHeight, D3DFORMAT fmt) const -{ - UINT mx = D3DPRESENT_RATE_DEFAULT; - for( UINT u=0; uGetAdapterModeCount(D3DADAPTER_DEFAULT); u++ ) - { - D3DDISPLAYMODE mode; - if( !SUCCEEDED( m_pd3d->EnumAdapterModes( D3DADAPTER_DEFAULT, u, &mode ) ) ) - continue; - - if(mode.Width != uWidth) continue; - if(mode.Height != uHeight) continue; - if(mode.Format != fmt) continue; - - if(mx == D3DPRESENT_RATE_DEFAULT || mode.RefreshRate > mx) - mx = mode.RefreshRate; - } - return mx; -} - -/* Get the maximum refresh rate available in the given size, for any format - * that fits bpp. */ -void RageDisplay::GetHzAtResolution(unsigned width, unsigned height, unsigned bpp, CArray &add) const -{ - for( UINT u=0; uGetAdapterModeCount(D3DADAPTER_DEFAULT); u++ ) - { - D3DDISPLAYMODE mode; - if( !SUCCEEDED( m_pd3d->EnumAdapterModes( D3DADAPTER_DEFAULT, u, &mode ) ) ) - continue; - - if(mode.Width != width) continue; - if(mode.Height != height) continue; - if(GetBPP(mode.Format) != bpp) continue; - - add.push_back(mode.RefreshRate); - } + SDL_InitSubSystem(SDL_INIT_VIDEO); + + SetVideoMode( windowed, width, height, bpp, rate, vsync ); } RageDisplay::~RageDisplay() { - ReleaseVertexBuffer(); - // Release our D3D Device - SAFE_RELEASE( m_pd3dDevice ); - m_pd3d->Release(); -} - - -HRESULT RageDisplay::SetMode() -{ - HRESULT hr; - if( m_pd3dDevice == NULL ) - { - // device is not yet created. We need to create it - if( FAILED( hr = m_pd3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - m_hWnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED, - &m_d3dpp, &m_pd3dDevice) ) ) - { - return hr; - } - LOG->Trace( - "Video card info:\n" - " - available texture mem is %u\n", - m_pd3dDevice->GetAvailableTextureMem() - ); - if( m_pVB == NULL ) - CreateVertexBuffer(); - } - else - { - // device is already created. Just reset it. - if( FAILED( hr = m_pd3dDevice->Reset( &m_d3dpp ) ) ) - return hr; - } - - LOG->Trace( "Mode change was successful." ); - return S_OK; -} - -D3DFORMAT RageDisplay::FindBackBufferType(bool bWindowed, int iBPP) -{ - HRESULT hr; - - // If windowed, then dwBPP is ignored. Use whatever works. - CArray arrayBackBufferFormats; // throw all possibilities in here - - /* When windowed, add all formats; otherwise add only formats that match dwBPP. */ - if( iBPP == 16 || bWindowed ) - { - arrayBackBufferFormats.push_back( D3DFMT_R5G6B5 ); - arrayBackBufferFormats.push_back( D3DFMT_X1R5G5B5 ); - arrayBackBufferFormats.push_back( D3DFMT_A1R5G5B5 ); - } - if( iBPP == 32 || bWindowed ) - { - arrayBackBufferFormats.push_back( D3DFMT_R8G8B8 ); - arrayBackBufferFormats.push_back( D3DFMT_X8R8G8B8 ); - arrayBackBufferFormats.push_back( D3DFMT_A8R8G8B8 ); - } - if( !bWindowed && iBPP != 16 && iBPP != 32 ) - throw RageException( ssprintf("Invalid BPP '%u' specified", iBPP) ); - - // Test each back buffer format until we find something that works. - for( unsigned i=0; i < arrayBackBufferFormats.size(); i++ ) - { - D3DFORMAT fmtBackBuffer = arrayBackBufferFormats[i]; - - D3DFORMAT fmtDisplay; - if( bWindowed ) - fmtDisplay = m_DesktopMode.Format; - else // Fullscreen - fmtDisplay = arrayBackBufferFormats[i]; - - LOG->Trace( "Testing format: display %d, back buffer %d, windowed %d...", - fmtDisplay, fmtBackBuffer, bWindowed ); - - hr = m_pd3d->CheckDeviceType( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - fmtDisplay, fmtBackBuffer, bWindowed ); - - if( FAILED(hr) ) { - LOG->Trace( hr, "That won't work. "); - continue; - } - - // done searching - LOG->Trace( "This will work." ); - return fmtBackBuffer; - } - - // we didn't find an appropriate format - return D3DFMT_UNKNOWN; + SDL_QuitSubSystem(SDL_INIT_VIDEO); } @@ -241,397 +65,213 @@ D3DFORMAT RageDisplay::FindBackBufferType(bool bWindowed, int iBPP) // Name: SwitchDisplayMode() // Desc: //----------------------------------------------------------------------------- -bool RageDisplay::SwitchDisplayMode( - bool bWindowed, int iWidth, int iHeight, int iBPP, int iFullScreenHz, bool bVsync ) +void RageDisplay::SetVideoMode( bool windowed, int width, int height, int bpp, RefreshRateMode rate, bool vsync ) { - LOG->Trace( "RageDisplay::SwitchDisplayModes( %d, %d, %d, %d, %d, %d )", bWindowed, iWidth, iHeight, iBPP, iFullScreenHz, bVsync ); - - if( !bWindowed ) - SetCursor( NULL ); +// LOG->Trace( "RageDisplay::SetVideoMode( %d, %d, %d, %d, %d, %d )", windowed, width, height, bpp, rate, vsync ); - HRESULT hr; +// if( windowed ) +// flags |= SDL_FULLSCREEN; + g_flags |= SDL_DOUBLEBUF; + g_flags |= SDL_RESIZABLE; + g_flags |= SDL_OPENGL; - // Find a pixel format for the back buffer. - D3DFORMAT fmtBackBuffer=FindBackBufferType( bWindowed, iBPP ); - if( fmtBackBuffer == D3DFMT_UNKNOWN ) + SDL_ShowCursor( ~g_flags & SDL_FULLSCREEN ); + + SDL_InitSubSystem(SDL_INIT_VIDEO); + + switch( bpp ) { - // we didn't find an appropriate format - LOG->Trace( "failed to find an appropriate format for %d, %u, %u, %u.", bWindowed, iWidth, iHeight, iBPP ); - return false; + case 15: + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); + break; + case 16: + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); + break; + case 24: + case 32: + default: + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); } - // Set up presentation parameters for the display - ZeroMemory( &m_d3dpp, sizeof(m_d3dpp) ); - - m_d3dpp.BackBufferWidth = iWidth; - m_d3dpp.BackBufferHeight = iHeight; - m_d3dpp.BackBufferFormat = fmtBackBuffer; - m_d3dpp.BackBufferCount = 1; - m_d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE; - m_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - m_d3dpp.hDeviceWindow = m_hWnd; - m_d3dpp.Windowed = bWindowed; - m_d3dpp.EnableAutoDepthStencil = TRUE; - m_d3dpp.AutoDepthStencilFormat = D3DFMT_D16; - m_d3dpp.Flags = 0; - m_d3dpp.FullScreen_RefreshRateInHz = bWindowed? D3DPRESENT_RATE_DEFAULT : - iFullScreenHz == REFRESH_MAX? MaxRefresh(iWidth, iHeight, fmtBackBuffer): - iFullScreenHz == REFRESH_DEFAULT? D3DPRESENT_RATE_DEFAULT: - iFullScreenHz; + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, bpp); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, TRUE); - /* Windowed must always use D3DPRESENT_INTERVAL_DEFAULT. */ - m_d3dpp.FullScreen_PresentationInterval = - bWindowed || bVsync? D3DPRESENT_INTERVAL_DEFAULT: - D3DPRESENT_INTERVAL_IMMEDIATE; + g_screen = SDL_SetVideoMode(width, height, bpp, g_flags); + if(!g_screen) + throw RageException("Failed to open screen!"); - LOG->Trace( "Present Parameters: %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d", - m_d3dpp.BackBufferWidth, m_d3dpp.BackBufferHeight, m_d3dpp.BackBufferFormat, - m_d3dpp.BackBufferCount, - m_d3dpp.MultiSampleType, m_d3dpp.SwapEffect, m_d3dpp.hDeviceWindow, - m_d3dpp.Windowed, m_d3dpp.EnableAutoDepthStencil, m_d3dpp.AutoDepthStencilFormat, - m_d3dpp.Flags, m_d3dpp.FullScreen_RefreshRateInHz, - m_d3dpp.FullScreen_PresentationInterval - ); + /* + * Set up OpenGL for 2D rendering. + */ + glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + glViewport(0, 0, g_screen->w, g_screen->h); - if( FAILED( hr=SetMode() ) ) - { - LOG->Trace( hr, "failed to set device: %d, %u, %u, %u.", bWindowed, iWidth, iHeight, iBPP ); - return false; - } + /* + * Set state variables + */ + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - // Clear the back buffer and present it so we don't show the gibberish that was - // in video memory from the last app. - BeginFrame(); - EndFrame(); - ShowFrame(); +// glBegin( GL_TRIANGLES ); +// glColor4f( 1,1,1,1 ); +// glVertex3f( 0, 0, 0 ); +// glVertex3f( 320, 0, 0 ); +// glVertex3f( 320, 240, 0 ); +// glEnd(); - return true; +// SDL_GL_SwapBuffers(); } - -//----------------------------------------------------------------------------- -// Name: Reset() -// Desc: -//----------------------------------------------------------------------------- -HRESULT RageDisplay::Reset() +int RageDisplay::GetMaxTextureSize() const { - return m_pd3dDevice->Reset( &m_d3dpp ); + GLint size; + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size); + return size; } - -//----------------------------------------------------------------------------- -// Name: BeginFrame() -// Desc: -//----------------------------------------------------------------------------- -HRESULT RageDisplay::BeginFrame() +void RageDisplay::Clear() { - ////////////////////////////////////////////////////////////// - // Do some fancy testing to make sure the D3D deivce is ready. - // This is mainly used when the the app is reactivated - // after the user has Alt-tabed out of full screen mode. - ////////////////////////////////////////////////////////////// - - // Test cooperative level - HRESULT hr; - - // Test the cooperative level to see if it's okay to render - if( FAILED( hr = m_pd3dDevice->TestCooperativeLevel() ) ) - { - // If the device was lost, do not render until we get it back - if( D3DERR_DEVICELOST == hr ) - return hr; // not ready to render - - // Check if the device needs to be resized. - if( D3DERR_DEVICENOTRESET == hr ) - return hr; - - return hr; - } - - - m_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, - D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 ); - - - if ( FAILED( hr = m_pd3dDevice->BeginScene() ) ) - return E_FAIL; - - // disable culling so backward polys can be drawn - m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE ); - m_pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE ); - - // Enable Alpha Blending and Testing - m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE ); - //m_pd3dDevice->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE ); - //m_pd3dDevice->SetRenderState( D3DRS_ALPHAREF, 0x08 ); - //m_pd3dDevice->SetRenderState( D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL ); - - m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA ); - m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA ); - - m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE ); -// m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE ); -// m_pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE ); - - - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR ); - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR ); - - - // Don't tile texture coords. This creates ugly wrapping artifacts on textures that have to be rescaled. - DisableTextureWrapping(); - - // m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSU, D3DTADDRESS_BORDER ); - // m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV, D3DTADDRESS_BORDER ); - // m_pd3dDevice->SetTextureStageState( 0, D3DTSS_BORDERCOLOR, D3DCOLOR_ARGB(0,0,0,0) ); - - - m_pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX ); - m_pd3dDevice->SetStreamSource( 0, m_pVB, sizeof(RageVertex) ); - - - - return S_OK; + glClearColor( 0,0,0,1 ); + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); } - -HRESULT RageDisplay::EndFrame() +void RageDisplay::Flip() { FlushQueue(); - - - m_pd3dDevice->EndScene(); - - - // update stats - m_iFramesRenderedSinceLastCheck++; - - float fTimeNow = TIMER->GetTimeSinceStart(); - if( fTimeNow - m_fLastCheckTime > 1.0f ) // update stats every 1 sec. - { - m_iFPS = m_iFramesRenderedSinceLastCheck; - m_iFramesRenderedSinceLastCheck = 0; - m_iTPF = m_iTrianglesRenderedSinceLastCheck / m_iFPS; - m_iTrianglesRenderedSinceLastCheck = 0; - m_iDPF = m_iDrawsSinceLastCheck / m_iFPS; - m_iDrawsSinceLastCheck = 0; - m_fLastCheckTime = fTimeNow; - - //LOG->Trace( "FPS: %d, TPF: %d, DPF: %d", m_iFPS, m_iTPF, m_iDPF ); - } - - - return S_OK; + SDL_GL_SwapBuffers(); } -HRESULT RageDisplay::ShowFrame() + +void RageDisplay::GetHzAtResolution(int width, int height, int bpp, CArray &add) const { - if( m_pd3dDevice ) - m_pd3dDevice->Present( 0, 0, 0, 0 ); - return S_OK; } - -HRESULT RageDisplay::Invalidate() +bool RageDisplay::IsWindowed() const { - return S_OK; + return true; // FIXME } - - -HRESULT RageDisplay::Restore() +void RageDisplay::DrawQuad( const RageVertex v[4] ) // upper-left, upper-right, lower-left, lower-right { - return S_OK; + DrawQuads( v, 4 ); } - -unsigned RageDisplay::GetBPP(D3DFORMAT fmt) const -{ - switch( fmt ) - { - case D3DFMT_R5G6B5: - case D3DFMT_X1R5G5B5: - case D3DFMT_A1R5G5B5: - return 16; - case D3DFMT_R8G8B8: - case D3DFMT_X8R8G8B8: - case D3DFMT_A8R8G8B8: - return 32; - default: - ASSERT( false ); // unexpected format - return 0; - } -} - - -void RageDisplay::CreateVertexBuffer() +void RageDisplay::DrawQuads( const RageVertex v[], int iNumVerts ) { - HRESULT hr; - if( FAILED( hr = m_pd3dDevice->CreateVertexBuffer( - MAX_NUM_VERTICIES * sizeof(RageVertex), - D3DUSAGE_WRITEONLY, D3DFVF_RAGEVERTEX, - D3DPOOL_MANAGED, &m_pVB ) ) ) - throw RageException( hr, "Vertex Buffer Could Not Be Created" ); -} - - -void RageDisplay::ReleaseVertexBuffer() -{ - SAFE_RELEASE( m_pVB ); -} - -/* -void RageDisplay::AddTriangle( const RageVertex& v[3] ) -{ - COPY( &m_vertQueue[m_iNumVerts], v ); // do a big mem copy - for( int i=0; i<3; i++ ) - RageVec3TransformCoord( &m_vertQueue[m_iNumVerts+i].p, v[i].p, &GetTopMatrix() ); - m_iNumVerts+=3; -} -*/ - -void RageDisplay::AddQuad( const RageVertex v[4] ) // upper-left, upper-right, lower-left, lower-right -{ - AddQuad( - v[0].p, v[0].c, v[0].t, - v[1].p, v[1].c, v[1].t, - v[2].p, v[2].c, v[2].t, - v[3].p, v[3].c, v[3].t ); -} -void RageDisplay::AddFan( const RageVertex v[], int iNumPrimitives ) -{ - // HACK: This function does not take winding order into account. It will goof if you turn on culling. - for( int i=0; i MAX_NUM_VERTICIES-4 ) + if( g_vertMode != GL_QUADS ) FlushQueue(); - m_iTrianglesRenderedSinceLastCheck++; + ASSERT( (iNumVerts%4) == 0 ); + g_vertMode = GL_QUADS; + AddVerts( v, iNumVerts ); } - -void RageDisplay::AddQuad( - const RageVector3 &p0, const D3DCOLOR& c0, const RageVector2& t0, // upper-left - const RageVector3 &p1, const D3DCOLOR& c1, const RageVector2& t1, // upper-right - const RageVector3 &p2, const D3DCOLOR& c2, const RageVector2& t2, // lower-left - const RageVector3 &p3, const D3DCOLOR& c3, const RageVector2& t3 ) // lower-right +void RageDisplay::DrawFan( const RageVertex v[], int iNumVerts ) { - // trangles must be in clockwise order in case we ever turn on clipping - AddTriangle( - p0, c0, t0, // upper-left - p2, c2, t2, // lower-left - p3, c3, t3 ); // lower-right - AddTriangle( - p0, c0, t0, // upper-left - p3, c3, t3, // lower-right - p1, c1, t1 ); // upper-right + if( g_vertMode != GL_TRIANGLE_FAN ) + FlushQueue(); + + ASSERT( iNumVerts >= 3 ); + g_vertMode = GL_TRIANGLE_FAN; + AddVerts( v, iNumVerts ); + FlushQueue(); +} +void RageDisplay::DrawStrip( const RageVertex v[], int iNumVerts ) +{ + if( g_vertMode != GL_TRIANGLE_STRIP ) + FlushQueue(); + + ASSERT( iNumVerts >= 3 ); + g_vertMode = GL_TRIANGLE_STRIP; + AddVerts( v, iNumVerts ); + FlushQueue(); +} +void RageDisplay::AddVerts( const RageVertex v[], int iNumVerts ) +{ + // Try not to overflow the queue + if( g_iNumVerts > MAX_NUM_VERTICIES-30 ) + FlushQueue(); + + for( int i=0; iDrawPrimitiveUP( D3DPT_TRIANGLELIST, m_iNumVerts/3, m_vertQueue, sizeof(RageVertex) ); - m_iNumVerts = 0; + glInterleavedArrays( GL_T2F_C4UB_V3F, sizeof(RageVertex), g_vertQueue ); + glDrawArrays( g_vertMode, 0, g_iNumVerts ); -/* - RageVertex* v; - m_pVB->Lock( 0, 0, (BYTE**)&v, 0 ); - memcpy( v, m_vertQueue, sizeof(RageVertex)*m_iNumVerts ); - m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumVerts/3 ); - m_pVB->Unlock(); - m_iNumVerts = 0; -*/ + g_iVertsRenderedSinceLastCheck += g_iNumVerts; + g_iNumVerts = 0; - m_iDrawsSinceLastCheck++; + g_iDrawsSinceLastCheck++; } void RageDisplay::SetViewTransform( const RageMatrix* pMatrix ) { FlushQueue(); - m_pd3dDevice->SetTransform( D3DTS_VIEW, (D3DMATRIX*)pMatrix ); + // OpenGL doesn't have a separate view matrix. We need to save it and muliply in later + g_matView = *pMatrix; } void RageDisplay::SetProjectionTransform( const RageMatrix* pMatrix ) { FlushQueue(); - m_pd3dDevice->SetTransform( D3DTS_PROJECTION, (D3DMATRIX*)pMatrix ); + glMatrixMode( GL_MODELVIEW ); + glLoadMatrixf( (float*)pMatrix ); } void RageDisplay::GetViewTransform( RageMatrix* pMatrixOut ) { - m_pd3dDevice->GetTransform( D3DTS_VIEW, (D3DMATRIX*)pMatrixOut ); + *pMatrixOut = g_matView; } void RageDisplay::GetProjectionTransform( RageMatrix* pMatrixOut ) { - m_pd3dDevice->GetTransform( D3DTS_PROJECTION, (D3DMATRIX*)pMatrixOut ); + glGetFloatv( GL_PROJECTION_MATRIX, (float*)pMatrixOut ); } - void RageDisplay::ResetMatrixStack() { RageMatrix ident; RageMatrixIdentity( &ident ); - m_MatrixStack.clear(); - m_MatrixStack.push_back(ident); + g_matModelStack.clear(); + g_matModelStack.push_back(ident); } void RageDisplay::PushMatrix() { - m_MatrixStack.push_back( GetTopMatrix() ); - ASSERT(m_MatrixStack.size()<20); // check for infinite loop + g_matModelStack.push_back( GetTopModelMatrix() ); + ASSERT(g_matModelStack.size()<20); // check for infinite loop } void RageDisplay::PopMatrix() { - m_MatrixStack.erase( m_MatrixStack.end()-1, m_MatrixStack.end() ); + g_matModelStack.erase( g_matModelStack.end()-1, g_matModelStack.end() ); + ASSERT(g_matModelStack.size()>=1); // popped a matrix we didn't push } void RageDisplay::Translate( float x, float y, float z ) { RageMatrix matTemp; RageMatrixTranslation( &matTemp, x, y, z ); - RageMatrix& matTop = GetTopMatrix(); + RageMatrix& matTop = GetTopModelMatrix(); RageMatrixMultiply( &matTop, &matTemp, &matTop ); } @@ -639,7 +279,7 @@ void RageDisplay::TranslateLocal( float x, float y, float z ) { RageMatrix matTemp; RageMatrixTranslation( &matTemp, x, y, z ); - RageMatrix& matTop = GetTopMatrix(); + RageMatrix& matTop = GetTopModelMatrix(); RageMatrixMultiply( &matTop, &matTop, &matTemp ); } @@ -647,7 +287,7 @@ void RageDisplay::Scale( float x, float y, float z ) { RageMatrix matTemp; RageMatrixScaling( &matTemp, x, y, z ); - RageMatrix& matTop = GetTopMatrix(); + RageMatrix& matTop = GetTopModelMatrix(); RageMatrixMultiply( &matTop, &matTemp, &matTop ); } @@ -655,7 +295,7 @@ void RageDisplay::RotateX( float r ) { RageMatrix matTemp; RageMatrixRotationX( &matTemp, r ); - RageMatrix& matTop = GetTopMatrix(); + RageMatrix& matTop = GetTopModelMatrix(); RageMatrixMultiply( &matTop, &matTemp, &matTop ); } @@ -663,7 +303,7 @@ void RageDisplay::RotateY( float r ) { RageMatrix matTemp; RageMatrixRotationY( &matTemp, r ); - RageMatrix& matTop = GetTopMatrix(); + RageMatrix& matTop = GetTopModelMatrix(); RageMatrixMultiply( &matTop, &matTemp, &matTop ); } @@ -671,146 +311,105 @@ void RageDisplay::RotateZ( float r ) { RageMatrix matTemp; RageMatrixRotationZ( &matTemp, r ); - RageMatrix& matTop = GetTopMatrix(); + RageMatrix& matTop = GetTopModelMatrix(); RageMatrixMultiply( &matTop, &matTemp, &matTop ); } -/* -void RageDisplay::RotateYawPitchRoll( const float x, const float y, const float z ) -{ - RageMatrix matTemp; - RageMatrixRotationYawPitchRoll( &matTemp, x, y, z ); - RageMatrix& matTop = GetTopMatrix(); - RageMatrixMultiply( &matTop, &matTemp, &matTop ); -} -*/ - void RageDisplay::SetTexture( RageTexture* pTexture ) { - LPDIRECT3DBASETEXTURE8 pNewD3DTexture = pTexture ? pTexture->GetD3DTexture() : NULL; + static int iLastTexID = 0; + int iNewTexID = pTexture ? pTexture->GetGLTextureID() : 0; - LPDIRECT3DBASETEXTURE8 pOldD3DTexture; - m_pd3dDevice->GetTexture( 0, &pOldD3DTexture ); - - if( pOldD3DTexture != pNewD3DTexture ) + if( iLastTexID != iNewTexID ) FlushQueue(); - if(pOldD3DTexture) - pOldD3DTexture->Release(); - - m_pd3dDevice->SetTexture( 0, pNewD3DTexture ); + glBindTexture( GL_TEXTURE_2D, iNewTexID ); } -void RageDisplay::SetColorTextureMultDiffuse() +void RageDisplay::SetTextureModeModulate() { - DWORD dw0, dw1, dw2; - m_pd3dDevice->GetTextureStageState( 0, D3DTSS_COLORARG1, &dw0 ); - m_pd3dDevice->GetTextureStageState( 0, D3DTSS_COLORARG2, &dw1 ); - m_pd3dDevice->GetTextureStageState( 0, D3DTSS_COLOROP, &dw2 ); + int a; + glGetTexEnviv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &a ); - if( dw0!=D3DTA_TEXTURE || dw1!=D3DTA_DIFFUSE || dw2!=D3DTOP_MODULATE ) + if( a == GL_MODULATE ) FlushQueue(); - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); } -void RageDisplay::SetColorDiffuse() -{ - DWORD dw0, dw1, dw2; - m_pd3dDevice->GetTextureStageState( 0, D3DTSS_COLORARG1, &dw0 ); - m_pd3dDevice->GetTextureStageState( 0, D3DTSS_COLORARG2, &dw1 ); - m_pd3dDevice->GetTextureStageState( 0, D3DTSS_COLOROP, &dw2 ); - if( dw0!=D3DTA_TEXTURE || dw1!=D3DTA_DIFFUSE || dw2!=D3DTOP_SELECTARG2 ) +void RageDisplay::SetTextureModeGlow() +{ + int a, b; + glGetIntegerv( GL_BLEND_SRC, &a ); + glGetIntegerv( GL_BLEND_DST, &b ); + + if( a!=GL_SRC_ALPHA || b!=GL_ONE ) FlushQueue(); - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 ); -} -void RageDisplay::SetAlphaTextureMultDiffuse() -{ - DWORD dw0, dw1, dw2; - m_pd3dDevice->GetTextureStageState( 0, D3DTSS_ALPHAARG1, &dw0 ); - m_pd3dDevice->GetTextureStageState( 0, D3DTSS_ALPHAARG2, &dw1 ); - m_pd3dDevice->GetTextureStageState( 0, D3DTSS_ALPHAOP, &dw2 ); - - if( dw0!=D3DTA_TEXTURE || dw1!=D3DTA_DIFFUSE || dw2!=D3DTOP_MODULATE ) - FlushQueue(); - - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); + glBlendFunc( GL_SRC_ALPHA, GL_ONE ); } void RageDisplay::SetBlendModeNormal() { - DWORD dw0, dw1; - m_pd3dDevice->GetRenderState( D3DRS_SRCBLEND, &dw0 ); - m_pd3dDevice->GetRenderState( D3DRS_DESTBLEND, &dw1 ); + int a, b; + glGetIntegerv( GL_BLEND_SRC, &a ); + glGetIntegerv( GL_BLEND_DST, &b ); - if( dw0!=D3DBLEND_SRCALPHA || dw1!=D3DBLEND_INVSRCALPHA ) + if( a!=GL_SRC_ALPHA || b!=GL_ONE_MINUS_SRC_ALPHA ) FlushQueue(); - m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA ); - m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA ); + glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); } void RageDisplay::SetBlendModeAdd() { - DWORD dw0, dw1; - m_pd3dDevice->GetRenderState( D3DRS_SRCBLEND, &dw0 ); - m_pd3dDevice->GetRenderState( D3DRS_DESTBLEND, &dw1 ); + int a, b; + glGetIntegerv( GL_BLEND_SRC, &a ); + glGetIntegerv( GL_BLEND_DST, &b ); - if( dw0!=D3DBLEND_ONE || dw1!=D3DBLEND_ONE ) + if( a!=GL_ONE || b!=GL_ONE ) FlushQueue(); - m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ONE ); - m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE ); + glBlendFunc( GL_ONE, GL_ONE ); } void RageDisplay::EnableZBuffer() { - DWORD dw0, dw1; - m_pd3dDevice->GetRenderState( D3DRS_ZENABLE, &dw0 ); - m_pd3dDevice->GetRenderState( D3DRS_ZWRITEENABLE, &dw1 ); + bool a; + glGetBooleanv( GL_DEPTH_TEST, (unsigned char*)&a ); - if( dw0!=TRUE || dw1!=TRUE ) + if( !a ) FlushQueue(); - m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE ); - m_pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE ); + glEnable( GL_DEPTH_TEST ); } void RageDisplay::DisableZBuffer() { - DWORD dw0, dw1; - m_pd3dDevice->GetRenderState( D3DRS_ZENABLE, &dw0 ); - m_pd3dDevice->GetRenderState( D3DRS_ZWRITEENABLE, &dw1 ); + bool a; + glGetBooleanv( GL_DEPTH_TEST, (unsigned char*)&a ); - if( dw0!=FALSE || dw1!=FALSE ) + if( a ) FlushQueue(); - m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE ); - m_pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE ); + glDisable( GL_DEPTH_TEST ); } void RageDisplay::EnableTextureWrapping() { - DWORD dw0, dw1; - m_pd3dDevice->GetTextureStageState( 0, D3DTSS_ADDRESSU, &dw0 ); - m_pd3dDevice->GetTextureStageState( 0, D3DTSS_ADDRESSV, &dw1 ); + int a, b; + glGetTexParameteriv( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, &a ); + glGetTexParameteriv( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, &b ); - if( dw0!=D3DTADDRESS_WRAP || dw1!=D3DTADDRESS_WRAP ) + if( a!=GL_REPEAT || b!=GL_REPEAT ) FlushQueue(); - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP ); - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); } void RageDisplay::DisableTextureWrapping() { - DWORD dw0, dw1; - m_pd3dDevice->GetTextureStageState( 0, D3DTSS_ADDRESSU, &dw0 ); - m_pd3dDevice->GetTextureStageState( 0, D3DTSS_ADDRESSV, &dw1 ); + int a, b; + glGetTexParameteriv( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, &a ); + glGetTexParameteriv( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, &b ); - if( dw0!=D3DTADDRESS_CLAMP || dw1!=D3DTADDRESS_CLAMP ) + if( a!=GL_CLAMP || b!=GL_CLAMP ) FlushQueue(); - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP ); - m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); } diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index fe62eb0252..79fe4c095d 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -12,48 +12,31 @@ ----------------------------------------------------------------------------- */ -// -// Chris: -// Drawing indexed primitives is 30% SLOWER than duplicating verticies on a TNT, -// Win98 w/ latest drivers. In fact, drawing indexed primitives is about 30% slower. -// Does this have something to do with poor usage of the vertex cache since we're using -// DrawPrimitiveUP instead of DrawPrimitive? -// - -#include "D3D8.h" class RageTexture; +struct RageMatrix; +struct RageVertex; + #include "RageTypes.h" +enum RefreshRateMode { REFRESH_DEFAULT, REFRESH_MAX, REFRESH_MIN }; + class RageDisplay { friend class RageTexture; public: - RageDisplay( HWND hWnd ); + RageDisplay( bool windowed, int width, int height, int bpp, RefreshRateMode rate, bool vsync ); ~RageDisplay(); - enum { REFRESH_DEFAULT=0, REFRESH_MAX=1 }; - bool SwitchDisplayMode( - bool bWindowed, int iWidth, int iHeight, int iBPP, int iFullScreenHz, bool bVsync ); -// LPDIRECT3D8 GetD3D() { return m_pd3d; }; -// inline LPDIRECT3DDEVICE8 GetDevice() { return m_pd3dDevice; }; - const D3DCAPS8& GetDeviceCaps() const { return m_DeviceCaps; }; + void SetVideoMode( bool windowed, int width, int height, int bpp, RefreshRateMode rate, bool vsync ); - HRESULT Reset(); - HRESULT BeginFrame(); - HRESULT EndFrame(); - HRESULT ShowFrame(); - - HRESULT Invalidate(); - HRESULT Restore(); - - - bool IsWindowed() const { return !!m_d3dpp.Windowed; }; - unsigned GetWidth() const { return m_d3dpp.BackBufferWidth; }; - unsigned GetHeight() const { return m_d3dpp.BackBufferHeight; }; - unsigned GetBPP() const { return GetBPP( m_d3dpp.BackBufferFormat ); } + void Clear(); + void Flip(); + bool IsWindowed() const; + int GetWidth() const; + int GetHeight() const; + int GetBPP() const; -// LPDIRECT3DVERTEXBUFFER8 GetVertexBuffer() { return m_pVB; }; void SetViewTransform( const RageMatrix* pMatrix ); void SetProjectionTransform( const RageMatrix* pMatrix ); void GetViewTransform( RageMatrix* pMatrixOut ); @@ -68,85 +51,28 @@ public: void RotateX( float r ); void RotateY( float r ); void RotateZ( float r ); -// void RotateYawPitchRoll( const float x, const float y, const float z ); - int GetFPS() const { return m_iFPS; }; - int GetTPF() const { return m_iTPF; }; - int GetDPF() const { return m_iDPF; }; - - void GetHzAtResolution(unsigned width, unsigned height, unsigned bpp, CArray &add) const; - -private: - unsigned MaxRefresh(unsigned iWidth, unsigned iHeight, D3DFORMAT fmt) const; - unsigned GetBPP(D3DFORMAT fmt) const; - HRESULT SetMode(); - D3DFORMAT FindBackBufferType(bool bWindowed, int iBPP); - RageMatrix& GetTopMatrix() { return m_MatrixStack.back(); } - - HWND m_hWnd; - - // DirectDraw/Direct3D objects - LPDIRECT3D8 m_pd3d; - LPDIRECT3DDEVICE8 m_pd3dDevice; - D3DCAPS8 m_DeviceCaps; - - - D3DDISPLAYMODE m_DesktopMode; - D3DPRESENT_PARAMETERS m_d3dpp; - - // a vertex buffer for all to share - LPDIRECT3DVERTEXBUFFER8 m_pVB; - void CreateVertexBuffer(); - void ReleaseVertexBuffer(); - - // OpenGL-like matrix stack - CArray m_MatrixStack; - - // for performance stats - float m_fLastCheckTime; - int m_iFramesRenderedSinceLastCheck; - int m_iTrianglesRenderedSinceLastCheck; - int m_iDrawsSinceLastCheck; - int m_iFPS, m_iTPF, m_iDPF; - - - // - // Render Queue stuff - // -protected: - -#define MAX_NUM_QUADS 2048 -#define MAX_NUM_VERTICIES (MAX_NUM_QUADS*4) // 4 verticies per quad - - RageVertex m_vertQueue[MAX_NUM_VERTICIES]; - int m_iNumVerts; - -public: - // TODO: Elminiate vertex duplication using an index buffer. Would this work with OpenGL though? -// void AddTriangle( const RageVertex v[3] ); - void AddQuad( const RageVertex v[4] ); // upper-left, upper-right, lower-left, lower-right - void AddFan( const RageVertex v[], int iNumPrimitives ); - void AddStrip( const RageVertex v[], int iNumPrimitives ); - void AddTriangle( - const RageVector3& p0, const D3DCOLOR& c0, const RageVector2& t0, - const RageVector3& p1, const D3DCOLOR& c1, const RageVector2& t1, - const RageVector3& p2, const D3DCOLOR& c2, const RageVector2& t2 ); - void AddQuad( - const RageVector3 &p0, const D3DCOLOR& c0, const RageVector2& t0, // upper-left - const RageVector3 &p1, const D3DCOLOR& c1, const RageVector2& t1, // upper-right - const RageVector3 &p2, const D3DCOLOR& c2, const RageVector2& t2, // lower-left - const RageVector3 &p3, const D3DCOLOR& c3, const RageVector2& t3 ); // lower-right - void FlushQueue(); void SetTexture( RageTexture* pTexture ); - void SetColorTextureMultDiffuse(); - void SetColorDiffuse(); - void SetAlphaTextureMultDiffuse(); + void SetTextureModeModulate(); + void SetTextureModeGlow(); void SetBlendModeNormal(); void SetBlendModeAdd(); void EnableZBuffer(); void DisableZBuffer(); void EnableTextureWrapping(); void DisableTextureWrapping(); + + void DrawQuad( const RageVertex v[4] ); // upper-left, upper-right, lower-left, lower-right + void DrawQuads( const RageVertex v[], int iNumVerts ); + void DrawFan( const RageVertex v[], int iNumVerts ); + void DrawStrip( const RageVertex v[], int iNumVerts ); + void FlushQueue(); + + void GetHzAtResolution(int width, int height, int bpp, CArray &add) const; + int GetMaxTextureSize() const; + +protected: + void AddVerts( const RageVertex v[], int iNumVerts ); }; diff --git a/stepmania/src/RageException.h b/stepmania/src/RageException.h index de39d26c97..9540f164fc 100644 --- a/stepmania/src/RageException.h +++ b/stepmania/src/RageException.h @@ -25,19 +25,20 @@ protected: CString m_sError; }; -#include "crash.h" +//#include "crash.h" /* Assertion that sets an optional message and brings up the crash handler, so * we get a backtrace. This should probably be used instead of throwing an * exception in most cases we expect never to happen (but not in cases that * we do expect, such as d3d init failure.) */ -#define RAGE_ASSERT_M(COND, MESSAGE) { if(!(COND)) { VDCHECKPOINT_M(MESSAGE); *(char*)0=0; } } -#define RAGE_ASSERT(COND) RAGE_ASSERT_M((COND), "Assertion failure") +//#define RAGE_ASSERT_M(COND, MESSAGE) { if(!(COND)) { VDCHECKPOINT_M(MESSAGE); *(char*)0=0; } } +//#define RAGE_ASSERT(COND) RAGE_ASSERT_M((COND), "Assertion failure") /* Make this the default assert handler. */ -#ifdef ASSERT -#undef ASSERT -#endif -#define ASSERT RAGE_ASSERT +//#ifdef ASSERT +//#undef ASSERT +//#endif +//#define ASSERT RAGE_ASSERT + #endif diff --git a/stepmania/src/RageInput.cpp b/stepmania/src/RageInput.cpp index 6968092166..c68e063180 100644 --- a/stepmania/src/RageInput.cpp +++ b/stepmania/src/RageInput.cpp @@ -948,3 +948,4 @@ int RageInput::pump_t::GetPadEvent() return buf; } + diff --git a/stepmania/src/RageInput.h b/stepmania/src/RageInput.h index 27be9e1f2c..19644a4e4b 100644 --- a/stepmania/src/RageInput.h +++ b/stepmania/src/RageInput.h @@ -159,3 +159,4 @@ namespace USB { }; extern RageInput* INPUTMAN; // global and accessable from anywhere in our program + diff --git a/stepmania/src/RageLog.cpp b/stepmania/src/RageLog.cpp index b082dbaa28..5a1b085b62 100644 --- a/stepmania/src/RageLog.cpp +++ b/stepmania/src/RageLog.cpp @@ -14,7 +14,7 @@ #include "RageUtil.h" #include -#include "crash.h" +//#include "crash.h" #include "dxerr8.h" #pragma comment(lib, "DxErr8.lib") @@ -73,7 +73,7 @@ void RageLog::Trace( const char *fmt, ...) fprintf( m_fileLog, "%s\n", sBuff.GetString() ); printf( "%s\n", sBuff.GetString() ); - CrashLog(sBuff); +// CrashLog(sBuff); #ifdef DEBUG this->Flush(); // implicit flush diff --git a/stepmania/src/RageMovieTexture.cpp b/stepmania/src/RageMovieTexture.cpp index 8269173ffc..10bc720435 100644 --- a/stepmania/src/RageMovieTexture.cpp +++ b/stepmania/src/RageMovieTexture.cpp @@ -10,6 +10,7 @@ ----------------------------------------------------------------------------- */ + //----------------------------------------------------------------------------- // In-line Links //----------------------------------------------------------------------------- @@ -281,16 +282,7 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample ) //----------------------------------------------------------------------------- // RageMovieTexture constructor //----------------------------------------------------------------------------- -RageMovieTexture::RageMovieTexture( - RageDisplay* pScreen, - const CString &sFilePath, - int dwMaxSize, - int dwTextureColorDepth, - int iMipMaps, - int iAlphaBits, - bool bDither, - bool bStretch ) : - RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ) +RageMovieTexture::RageMovieTexture( const CString &sFilePath ) : RageTexture( sFilePath ) { LOG->Trace( "RageBitmapTexture::RageBitmapTexture()" ); @@ -578,3 +570,5 @@ bool RageMovieTexture::IsPlaying() const return m_bPlaying; } + + diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index c654aeed19..0ad04c0a6a 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -34,19 +34,14 @@ void RageSound::PlayOnceStreamedFromDir( CString sDir ) { } -RageSound::RageSound( HWND hWnd ) +RageSound::RageSound() { LOG->Trace( "RageSound::RageSound()" ); - // save the HWND - if( !hWnd ) - throw RageException( "RageSound called with NULL hWnd." ); - m_hWndApp = hWnd; - if( BASS_GetVersion() != MAKELONG(1,6) ) throw RageException( "BASS version 1.6 DLL could not be loaded. Verify that Bass.dll exists in the program directory."); - if( !BASS_Init( -1, 44100, BASS_DEVICE_LEAVEVOL|BASS_DEVICE_LATENCY, m_hWndApp ) ) + if( !BASS_Init( -1, 44100, BASS_DEVICE_LEAVEVOL|BASS_DEVICE_LATENCY, NULL ) ) { throw RageException( "There was an error while initializing your sound card.\n\n" diff --git a/stepmania/src/RageSound.h b/stepmania/src/RageSound.h index e5f15ab75b..224a19ca2f 100644 --- a/stepmania/src/RageSound.h +++ b/stepmania/src/RageSound.h @@ -20,7 +20,7 @@ class RageSound { public: - RageSound( HWND hWnd ); + RageSound(); ~RageSound(); float GetPlayLatency() { return m_info.latency / 1000.0f; }; // latency between when Play() is called and sound starts coming out @@ -29,7 +29,6 @@ public: void PlayOnceStreamedFromDir( CString sDir ); private: - HWND m_hWndApp; // this is set on GRAPHICS_Create() BASS_INFO m_info; }; diff --git a/stepmania/src/RageTexture.cpp b/stepmania/src/RageTexture.cpp index 8c4c981784..c9d85ca12f 100644 --- a/stepmania/src/RageTexture.cpp +++ b/stepmania/src/RageTexture.cpp @@ -18,34 +18,21 @@ #include #include + //----------------------------------------------------------------------------- // RageTexture constructor //----------------------------------------------------------------------------- -RageTexture::RageTexture( - RageDisplay* pScreen, - const CString &sFilePath, - int dwMaxSize, - int dwTextureColorDepth, - int iMipMaps, - int iAlphaBits, - bool bDither, - bool bStretch ) +RageTexture::RageTexture( const CString &sFilePath ) { // LOG->Trace( "RageTexture::RageTexture()" ); - // save a pointer to the D3D device - m_pd3dDevice = pScreen->m_pd3dDevice; - assert( m_pd3dDevice != NULL ); - - // save the file path m_sFilePath = sFilePath; -// m_pd3dTexture = NULL; m_iRefCount = 1; m_iSourceWidth = m_iSourceHeight = 0; m_iTextureWidth = m_iTextureHeight = 0; m_iImageWidth = m_iImageHeight = 0; - m_iFramesWide = m_iFramesHigh = 1; + m_iFramesWide = m_iFramesHigh = 0; } RageTexture::~RageTexture() @@ -110,3 +97,9 @@ void RageTexture::GetFrameDimensionsFromFileName( CString sPath, int* piFramesWi } } + +const RectF *RageTexture::GetTextureCoordRect( int frameNo ) const +{ + return &m_TextureCoordRects[frameNo]; +} + diff --git a/stepmania/src/RageTexture.h b/stepmania/src/RageTexture.h index f7fcdea4f4..369d21b168 100644 --- a/stepmania/src/RageTexture.h +++ b/stepmania/src/RageTexture.h @@ -3,7 +3,7 @@ ----------------------------------------------------------------------------- Class: RageTexture - Desc: Abstract class for a texture and holds metadata. + Desc: Abstract class for a texture and metadata. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford @@ -11,24 +11,10 @@ */ +#include "RageTypes.h" -#include "RageDisplay.h" -#include -//#include - - - -struct FRECT -{ -public: - FRECT() {}; - FRECT(float l, float t, float r, float b) { - left = l; top = t; right = r; bottom = b; - }; - - float left, top, right, bottom; -}; +const int MAX_TEXTURE_FRAMES = 256; //----------------------------------------------------------------------------- @@ -37,35 +23,19 @@ public: class RageTexture { public: - RageTexture( - RageDisplay* pScreen, - const CString &sFilePath, - int dwMaxSize = 2048, - int dwTextureColorDepth = 16, - int iMipMaps = 4, - int iAlphaBits = 4, - bool bDither = false, - bool bStretch = false - ); + RageTexture( const CString &sFilePath ); virtual ~RageTexture() = 0; - virtual void Reload( - int dwMaxSize = 2048, - int dwTextureColorDepth = 16, - int iMipMaps = 4, - int iAlphaBits = 4, - bool bDither = false, - bool bStretch = false - ) = 0; + virtual void Reload() = 0; - virtual LPDIRECT3DTEXTURE8 GetD3DTexture() = 0; + // movie texture/animated texture stuff virtual void Play() {} virtual void Stop() {} virtual void Pause() {} virtual void SetPosition( float fSeconds ) {} virtual bool IsAMovie() const { return false; } virtual bool IsPlaying() const { return false; } - void SetLooping(bool looping=true) { } + void SetLooping(bool looping) { } int GetSourceWidth() const {return m_iSourceWidth;} int GetSourceHeight() const {return m_iSourceHeight;} @@ -84,30 +54,27 @@ public: int GetImageFrameWidth() const {return GetImageWidth() / GetFramesWide();} int GetImageFrameHeight() const {return GetImageHeight() / GetFramesHigh();} - RectF *GetTextureCoordRect( int uFrameNo ) {return &m_TextureCoordRects[uFrameNo];} - int GetNumFrames() const {return m_TextureCoordRects.size();} + const RectF *GetTextureCoordRect( int frameNo ) const; + int GetNumFrames() const {return m_iFramesWide*m_iFramesHigh;} CString GetFilePath() const {return m_sFilePath;} - int m_iRefCount; - int m_iTimeOfLastUnload; + int m_iRefCount; + int m_iTimeOfLastUnload; + + virtual unsigned int GetGLTextureID() = 0; // accessed by RageDisplay protected: + virtual void CreateFrameRects(); virtual void GetFrameDimensionsFromFileName( CString sPath, int* puFramesWide, int* puFramesHigh ) const; - CString m_sFilePath; - LPDIRECT3DDEVICE8 m_pd3dDevice; + CString m_sFilePath; - 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 - int m_iFramesWide, m_iFramesHigh; // The number of frames of animation in each row and column of this texture - - - // RECTs that hold the bounds of each frame in the bitmap. - // e.g., if the texture has 4 frames of animation, the SrcRect for each frame would - // be in m_FrameRects[0..4]. - CArray m_TextureCoordRects; + 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 + int m_iFramesWide, m_iFramesHigh; // The number of frames of animation in each row and column of this texture + CArray m_TextureCoordRects; // size = m_iFramesWide * m_iFramesHigh }; diff --git a/stepmania/src/RageTextureManager.cpp b/stepmania/src/RageTextureManager.cpp index d6c293773b..5c415fae7f 100644 --- a/stepmania/src/RageTextureManager.cpp +++ b/stepmania/src/RageTextureManager.cpp @@ -26,13 +26,9 @@ RageTextureManager* TEXTUREMAN = NULL; //----------------------------------------------------------------------------- // constructor/destructor //----------------------------------------------------------------------------- -RageTextureManager::RageTextureManager( RageDisplay* pScreen ) +RageTextureManager::RageTextureManager( int iTextureColorDepth, int iSecondsBeforeUnload ) { - assert( pScreen != NULL ); - m_pScreen = pScreen; - m_iMaxTextureSize = 2048; // infinite size - m_iTextureColorDepth = 16; - m_iSecondsBeforeUnload = 60*30; // 30 mins + SetPrefs( iTextureColorDepth, iSecondsBeforeUnload ); } RageTextureManager::~RageTextureManager() @@ -51,7 +47,7 @@ RageTextureManager::~RageTextureManager() //----------------------------------------------------------------------------- // Load/Unload textures from disk //----------------------------------------------------------------------------- -RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, bool bForceReload, int iMipMaps, int iAlphaBits, bool bDither, bool bStretch ) +RageTexture* RageTextureManager::LoadTexture( CString sTexturePath ) { sTexturePath.MakeLower(); @@ -70,8 +66,6 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, bool bForceR pTexture = p->second; pTexture->m_iRefCount++; - if( bForceReload ) - pTexture->Reload( m_iMaxTextureSize, m_iTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ); // LOG->Trace( "RageTextureManager: '%s' now has %d references.", sTexturePath.GetString(), pTexture->m_iRefCount ); } @@ -80,10 +74,10 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, bool bForceR CString sDrive, sDir, sFName, sExt; splitpath( false, sTexturePath, sDrive, sDir, sFName, sExt ); - if( sExt == "avi" || sExt == "mpg" || sExt == "mpeg" ) - pTexture = new RageMovieTexture( m_pScreen, sTexturePath, m_iMaxTextureSize, m_iTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ); - else - pTexture = new RageBitmapTexture( m_pScreen, sTexturePath, m_iMaxTextureSize, m_iTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ); +// if( sExt == "avi" || sExt == "mpg" || sExt == "mpeg" ) +// pTexture = new RageMovieTexture( sTexturePath ); +// else + pTexture = new RageBitmapTexture( sTexturePath ); LOG->Trace( "RageTextureManager: Finished loading '%s'.", sTexturePath.GetString() ); @@ -185,19 +179,14 @@ void RageTextureManager::ReloadAll() { RageTexture* pTexture = i->second; - // this is not entirely correct. Hints are lost! XXX - pTexture->Reload( m_iMaxTextureSize, m_iTextureColorDepth, 0 ); + pTexture->Reload(); // this is not entirely correct. Hints are lost! XXX } } -void RageTextureManager::SetPrefs( int iMaxSize, int iTextureColorDepth, int iSecondsBeforeUnload ) +void RageTextureManager::SetPrefs( int iTextureColorDepth, int iSecondsBeforeUnload ) { m_iSecondsBeforeUnload = iSecondsBeforeUnload; - if( iMaxSize == m_iMaxTextureSize && iTextureColorDepth == m_iTextureColorDepth ) - return; - m_iMaxTextureSize = iMaxSize; m_iTextureColorDepth = iTextureColorDepth; - ASSERT( m_iMaxTextureSize >= 64 ); - ASSERT( m_iTextureColorDepth >= 16 ); + ASSERT( m_iTextureColorDepth==16 || m_iTextureColorDepth==32 ); ReloadAll(); } diff --git a/stepmania/src/RageTextureManager.h b/stepmania/src/RageTextureManager.h index dd9ddedcea..246002d389 100644 --- a/stepmania/src/RageTextureManager.h +++ b/stepmania/src/RageTextureManager.h @@ -19,23 +19,21 @@ class RageTextureManager { public: - RageTextureManager( RageDisplay* pScreen ); + RageTextureManager( int iTextureColorDepth, int iSecsBeforeUnload ); ~RageTextureManager(); - RageTexture* LoadTexture( CString sTexturePath, bool bForceReload = false, int iMipMaps = 4, int iAlphaBits = 4, bool bDither = false, bool bStretch = false ); + RageTexture* LoadTexture( CString sTexturePath ); bool IsTextureLoaded( CString sTexturePath ); void UnloadTexture( CString sTexturePath ); void ReloadAll(); - void SetPrefs( int iMaxSize, int iTextureColorDepth, int iMaxTextureMB ); - int GetMaxTextureSize() { return m_iMaxTextureSize; }; + void SetPrefs( int iTextureColorDepth, int iSecsBeforeUnload ); int GetTextureColorDepth() { return m_iTextureColorDepth; }; + int GetSecsBeforeUnload() { return m_iSecondsBeforeUnload; }; protected: void GCTextures(); - RageDisplay* m_pScreen; - int m_iMaxTextureSize; int m_iTextureColorDepth; int m_iSecondsBeforeUnload; diff --git a/stepmania/src/RageTypes.h b/stepmania/src/RageTypes.h index 0829d883b4..1ef4bfc29f 100644 --- a/stepmania/src/RageTypes.h +++ b/stepmania/src/RageTypes.h @@ -79,16 +79,6 @@ public: float x, y, z; }; - -#define RAGECOLOR_ARGB(a,r,g,b) \ - ((DWORD)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) - -#define RAGECOLOR_RGBA(r,g,b,a) RAGECOLOR_ARGB(a,r,g,b) - -#define RAGECOLOR_COLORVALUE(r,g,b,a) \ - RAGECOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f)) - - struct RageVector4 { public: @@ -97,7 +87,6 @@ public: RageVector4( float x1, float y1, float z1, float w1 ) { x=x1; y=y1; z=z1; w=w1; } // casting - operator unsigned long () const { return RAGECOLOR_COLORVALUE(min(1.f,max(0.f,r)),min(1.f,max(0.f,g)),min(1.f,max(0.f,b)),min(1.f,max(0.f,a))); } operator float* () { return &x; }; operator const float* () const { return &x; }; @@ -118,19 +107,58 @@ public: bool operator == ( const RageVector4& other ) const { return x==other.x && y==other.y && z==other.z && w==other.w; } bool operator != ( const RageVector4& other ) const { return x!=other.x || y!=other.y || z!=other.z || w!=other.w; } - union { - struct - { - float x, y, z, w; - }; - struct - { - float r, g, b, a; - }; - }; + float x, y, z, w; +}; + + +#define RAGECOLOR_ARGB(a,r,g,b) \ + ((DWORD)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) + +#define RAGECOLOR_RGBA(r,g,b,a) RAGECOLOR_ARGB(a,r,g,b) + +#define RAGECOLOR_COLORVALUE(r,g,b,a) \ + RAGECOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f)) + + +struct RageColor +{ +public: + RageColor() {} + RageColor( const float * f ) { r=f[0]; g=f[1]; b=f[2]; a=f[3]; } + RageColor( float r1, float g1, float b1, float a1 ) { r=r1; g=g1; b=b1; a=a1; } + RageColor( unsigned long c ) + { + a = ((c>>24)&0xff) / 255.f; + r = ((c>>16)&0xff) / 255.f; + g = ((c>>8)&0xff) / 255.f; + b = (c&0xff) / 255.f; + } + + // casting + operator unsigned long () const { return RAGECOLOR_COLORVALUE(min(1.f,max(0.f,r)),min(1.f,max(0.f,g)),min(1.f,max(0.f,b)),min(1.f,max(0.f,a))); } + operator float* () { return &r; }; + operator const float* () const { return &r; }; + + // assignment operators + RageColor& operator += ( const RageColor& other ) { r+=other.r; g+=other.g; b+=other.b; a+=other.a; } + RageColor& operator -= ( const RageColor& other ) { r-=other.r; g-=other.g; b-=other.b; a-=other.a; } + RageColor& operator *= ( float f ) { r*=f; g*=f; b*=f; a*=f; } + RageColor& operator /= ( float f ) { r/=f; g/=f; b/=f; a/=f; } + + // binarg operators + RageColor operator + ( const RageColor& other ) const { return RageColor( r+other.r, g+other.g, b+other.b, a+other.a ); } + RageColor operator - ( const RageColor& other ) const { return RageColor( r-other.r, g-other.g, b-other.b, a-other.a ); } + RageColor operator * ( float f ) const { return RageColor( r*f, g*f, b*f, a*f ); } + RageColor operator / ( float f ) const { return RageColor( r/f, g/f, b/f, a/f ); } + + friend RageVector4 operator * ( float f, const RageVector4& other ) { return other*f; } + + bool operator == ( const RageColor& other ) const { return r==other.r && g==other.g && b==other.b && a==other.a; } + bool operator != ( const RageColor& other ) const { return r!=other.r || g!=other.g || b!=other.b || a!=other.a; } + + float r, g, b, a; }; -typedef RageVector4 RageColor; template @@ -155,9 +183,10 @@ typedef Rect RectF; // A structure for our custom vertex type. Note that these data structes have the same layout that D3D expects. struct RageVertex { - RageVector3 p; // position - DWORD c; // diffuse color - RageVector2 t; // texture coordinates + // This is the format expected by OpenGL. D3D expects the reverse! + RageVector2 t; // texture coordinates + unsigned long c; // diffuse color + RageVector3 p; // position }; #define D3DFVF_RAGEVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1) // D3D FVF flags which describe our vertex structure @@ -188,6 +217,7 @@ public: operator float* () { return m[0]; } operator const float* () const { return m[0]; } + RageMatrix GetTranspose() const { return RageMatrix(m00,m10,m20,m30,m01,m11,m21,m31,m02,m12,m22,m32,m03,m13,m23,m33); } // ---These are not used. Maybe I'll implement them later...--- // // assignment operators diff --git a/stepmania/src/ScoreDisplayNormal.cpp b/stepmania/src/ScoreDisplayNormal.cpp index 5f366e8bde..af990a1d01 100644 --- a/stepmania/src/ScoreDisplayNormal.cpp +++ b/stepmania/src/ScoreDisplayNormal.cpp @@ -16,6 +16,7 @@ #include "PrefsManager.h" #include "RageLog.h" #include "GameState.h" +#include "ThemeManager.h" const float SCORE_TWEEN_TIME = 0.2f; diff --git a/stepmania/src/ScoreDisplayOni.cpp b/stepmania/src/ScoreDisplayOni.cpp index 46deb4b05b..78f0527e91 100644 --- a/stepmania/src/ScoreDisplayOni.cpp +++ b/stepmania/src/ScoreDisplayOni.cpp @@ -16,6 +16,7 @@ #include "PrefsManager.h" #include "RageLog.h" #include "GameState.h" +#include "ThemeManager.h" const float SCORE_TWEEN_TIME = 0.5f; diff --git a/stepmania/src/ScreenAppearanceOptions.cpp b/stepmania/src/ScreenAppearanceOptions.cpp index f9030f9bcd..01c402149f 100644 --- a/stepmania/src/ScreenAppearanceOptions.cpp +++ b/stepmania/src/ScreenAppearanceOptions.cpp @@ -23,7 +23,7 @@ #include "AnnouncerManager.h" #include "GameManager.h" #include "GameState.h" - +#include "ThemeManager.h" enum { diff --git a/stepmania/src/ScreenCaution.cpp b/stepmania/src/ScreenCaution.cpp index 8e4a84dbd6..06a0b98f08 100644 --- a/stepmania/src/ScreenCaution.cpp +++ b/stepmania/src/ScreenCaution.cpp @@ -16,6 +16,7 @@ #include "AnnouncerManager.h" #include "GameState.h" #include "RageMusic.h" +#include "ThemeManager.h" #define NEXT_SCREEN THEME->GetMetric("ScreenCaution","NextScreen") diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 15728bf17e..238eff0f5c 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -21,6 +21,9 @@ #include "RageLog.h" #include "GameState.h" #include "InputMapper.h" +#include "RageLog.h" +#include +#include "ThemeManager.h" #include diff --git a/stepmania/src/ScreenEditMenu.cpp b/stepmania/src/ScreenEditMenu.cpp index 8990cb9737..0ba8e7f83b 100644 --- a/stepmania/src/ScreenEditMenu.cpp +++ b/stepmania/src/ScreenEditMenu.cpp @@ -20,6 +20,7 @@ #include "RageLog.h" #include "GameState.h" #include "RageMusic.h" +#include "ThemeManager.h" // diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 8549fe5d75..8d3cc8c544 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -22,6 +22,7 @@ #include "AnnouncerManager.h" #include "GameState.h" #include "GrooveRadar.h" +#include "ThemeManager.h" #define BANNER_X THEME->GetMetricF("ScreenEvaluation","BannerX") diff --git a/stepmania/src/ScreenEz2SelectPlayer.cpp b/stepmania/src/ScreenEz2SelectPlayer.cpp index 43549c6bfe..d6345e3a0c 100644 --- a/stepmania/src/ScreenEz2SelectPlayer.cpp +++ b/stepmania/src/ScreenEz2SelectPlayer.cpp @@ -20,6 +20,7 @@ Andrew Livy #include "GameState.h" #include "RageException.h" #include "RageTimer.h" +#include "ThemeManager.h" /* Constants */ diff --git a/stepmania/src/ScreenGameOver.cpp b/stepmania/src/ScreenGameOver.cpp index 7d5b3d6d5a..a3333f213b 100644 --- a/stepmania/src/ScreenGameOver.cpp +++ b/stepmania/src/ScreenGameOver.cpp @@ -20,6 +20,7 @@ #include "AnnouncerManager.h" #include "GameState.h" #include "RageMusic.h" +#include "ThemeManager.h" const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 1); diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 37211bdc50..cb21665064 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -27,6 +27,7 @@ #include "ScreenPrompt.h" #include "GrooveRadar.h" #include "NotesLoaderSM.h" +#include "ThemeManager.h" // // Defines diff --git a/stepmania/src/ScreenGraphicOptions.cpp b/stepmania/src/ScreenGraphicOptions.cpp index cf248ff5f4..60a6d85734 100644 --- a/stepmania/src/ScreenGraphicOptions.cpp +++ b/stepmania/src/ScreenGraphicOptions.cpp @@ -20,14 +20,16 @@ #include "StepMania.h" #include "PrefsManager.h" #include "RageLog.h" - +#include "PrefsManager.h" +#include "ThemeManager.h" enum { GO_WINDOWED = 0, GO_DISPLAY_RESOLUTION, - GO_TEXTURE_RESOLUTION, - GO_REFRESH_RATE, + GO_DISPLAY_COLOR_DEPTH, + GO_TEXTURE_COLOR_DEPTH, + GO_REFRESH_RATE_MODE, GO_BGMODE, GO_BGBRIGHTNESS, GO_MOVIEDECODEMS, @@ -38,10 +40,11 @@ enum { OptionRowData g_GraphicOptionsLines[NUM_GRAPHIC_OPTIONS_LINES] = { { "Display\nMode", 2, {"FULLSCREEN", "WINDOWED"} }, { "Display\nResolution", 7, {"320","400","512","640","800","1024","1280"} }, - { "Texture\nResolution", 3, {"256","512","1024"} }, - { "Refresh\nRate", 11, {"DEFAULT","MAX","60","70","72","75","80","85","90","100","120"} }, + { "Display\nColor", 2, {"16BIT","32BIT"} }, + { "Texture\nColor", 2, {"16BIT","32BIT"} }, + { "Refresh\nRate", 3, {"DEFAULT","MAX","MIN"} }, { "Background\nMode", 4, {"OFF","ANIMATIONS","VISUALIZATIONS","RANDOM MOVIES"} }, - { "Background\nBrightness", 11, {"0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%"} }, + { "Background\nBrightness", 11, {"0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%"} }, { "Movie\nDecode", 4, {"1ms","2ms","3ms","4ms"} }, { "BG For\nBanner", 2, {"NO", "YES (slow)"} }, { "Wait For\nVsync", 2, {"NO", "YES"} }, @@ -83,17 +86,6 @@ ScreenGraphicOptions::ScreenGraphicOptions() : MUSIC->LoadAndPlayIfNotAlready( THEME->GetPathTo("Sounds","graphic options music") ); } -int ScreenGraphicOptions::CurrentRefresh() const -{ - int RefreshOption = m_iSelectedOption[0][GO_REFRESH_RATE]; - switch( RefreshOption ) - { - case 0: return RageDisplay::REFRESH_DEFAULT;break; - case 1: return RageDisplay::REFRESH_MAX; break; - default: - return atoi( g_GraphicOptionsLines[GO_REFRESH_RATE].szOptionsText[RefreshOption] ); - } -} void ScreenGraphicOptions::UpdateRefreshRates() { @@ -110,7 +102,7 @@ void ScreenGraphicOptions::UpdateRefreshRates() /* Set the refresh to default. If we can find the old selection in the * new data, we'll set it to that later. */ - OptionRowData &opt = g_GraphicOptionsLines[GO_REFRESH_RATE]; + OptionRowData &opt = g_GraphicOptionsLines[GO_REFRESH_RATE_MODE]; opt.iNumOptions = 2; int OldSettingNo = RageDisplay::REFRESH_DEFAULT; @@ -127,8 +119,8 @@ void ScreenGraphicOptions::UpdateRefreshRates() OldSettingNo = i; } - m_iSelectedOption[0][GO_REFRESH_RATE] = - m_iSelectedOption[1][GO_REFRESH_RATE] = OldSettingNo; + m_iSelectedOption[0][GO_REFRESH_RATE_MODE] = + m_iSelectedOption[1][GO_REFRESH_RATE_MODE] = OldSettingNo; InitOptionsText(); #endif @@ -151,7 +143,7 @@ void ScreenGraphicOptions::ImportOptions() { m_iSelectedOption[0][GO_WINDOWED] = PREFSMAN->m_bWindowed ? 1:0; - switch( PREFSMAN->m_iDisplayResolution ) + switch( PREFSMAN->m_iDisplayWidth ) { case 320: m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 0; break; case 400: m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 1; break; @@ -162,31 +154,20 @@ void ScreenGraphicOptions::ImportOptions() case 1280: m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 6; break; default: m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 3; break; } - - switch( PREFSMAN->m_iTextureResolution ) + + switch( PREFSMAN->m_iDisplayColorDepth ) { - case 256: m_iSelectedOption[0][GO_TEXTURE_RESOLUTION] = 0; break; - case 512: m_iSelectedOption[0][GO_TEXTURE_RESOLUTION] = 1; break; - case 1024: m_iSelectedOption[0][GO_TEXTURE_RESOLUTION] = 2; break; - default: m_iSelectedOption[0][GO_TEXTURE_RESOLUTION] = 1; break; - } - - switch( PREFSMAN->m_iRefreshRate ) - { - case RageDisplay::REFRESH_DEFAULT: m_iSelectedOption[0][GO_REFRESH_RATE] = 0; break; - case RageDisplay::REFRESH_MAX: m_iSelectedOption[0][GO_REFRESH_RATE] = 1; break; - case 60: m_iSelectedOption[0][GO_REFRESH_RATE] = 2; break; - case 70: m_iSelectedOption[0][GO_REFRESH_RATE] = 3; break; - case 72: m_iSelectedOption[0][GO_REFRESH_RATE] = 4; break; - case 75: m_iSelectedOption[0][GO_REFRESH_RATE] = 5; break; - case 80: m_iSelectedOption[0][GO_REFRESH_RATE] = 6; break; - case 85: m_iSelectedOption[0][GO_REFRESH_RATE] = 7; break; - case 90: m_iSelectedOption[0][GO_REFRESH_RATE] = 8; break; - case 100: m_iSelectedOption[0][GO_REFRESH_RATE] = 9; break; - case 120: m_iSelectedOption[0][GO_REFRESH_RATE] = 10; break; - default: m_iSelectedOption[0][GO_REFRESH_RATE] = 1; break; + case 16: m_iSelectedOption[0][GO_DISPLAY_COLOR_DEPTH] = 0; break; + case 32: m_iSelectedOption[0][GO_DISPLAY_COLOR_DEPTH] = 1; break; } + switch( PREFSMAN->m_iTextureColorDepth ) + { + case 16: m_iSelectedOption[0][GO_TEXTURE_COLOR_DEPTH] = 0; break; + case 32: m_iSelectedOption[0][GO_TEXTURE_COLOR_DEPTH] = 1; break; + } + + m_iSelectedOption[0][GO_REFRESH_RATE_MODE] = PREFSMAN->m_iRefreshRateMode; m_iSelectedOption[0][GO_BGMODE] = PREFSMAN->m_BackgroundMode; m_iSelectedOption[0][GO_BGBRIGHTNESS] = (int)( PREFSMAN->m_fBGBrightness*10+0.5f ); m_iSelectedOption[0][GO_MOVIEDECODEMS] = PREFSMAN->m_iMovieDecodeMS-1; @@ -203,18 +184,24 @@ void ScreenGraphicOptions::ExportOptions() ASSERT(0); m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 3; } - PREFSMAN->m_iDisplayResolution = - HorizRes[m_iSelectedOption[0][GO_DISPLAY_RESOLUTION]]; + PREFSMAN->m_iDisplayWidth = HorizRes[m_iSelectedOption[0][GO_DISPLAY_RESOLUTION]]; + PREFSMAN->m_iDisplayHeight = VertRes[m_iSelectedOption[0][GO_DISPLAY_RESOLUTION]]; - switch( m_iSelectedOption[0][GO_TEXTURE_RESOLUTION] ) + switch( m_iSelectedOption[0][GO_DISPLAY_COLOR_DEPTH] ) { - case 0: PREFSMAN->m_iTextureResolution = 256; break; - case 1: PREFSMAN->m_iTextureResolution = 512; break; - case 2: PREFSMAN->m_iTextureResolution = 1024; break; - default: ASSERT(0); PREFSMAN->m_iTextureResolution = 512; break; + case 0: PREFSMAN->m_iDisplayColorDepth = 16; break; + case 1: PREFSMAN->m_iDisplayColorDepth = 32; break; + default: ASSERT(0); PREFSMAN->m_iDisplayColorDepth = 16; break; } - PREFSMAN->m_iRefreshRate = CurrentRefresh(); + switch( m_iSelectedOption[0][GO_TEXTURE_COLOR_DEPTH] ) + { + case 0: PREFSMAN->m_iTextureColorDepth = 16; break; + case 1: PREFSMAN->m_iTextureColorDepth = 32; break; + default: ASSERT(0); PREFSMAN->m_iTextureColorDepth = 16; break; + } + + PREFSMAN->m_iRefreshRateMode = m_iSelectedOption[0][GO_REFRESH_RATE_MODE]; PREFSMAN->m_BackgroundMode = PrefsManager::BackgroundMode( m_iSelectedOption[0][GO_BGMODE] ); PREFSMAN->m_fBGBrightness = m_iSelectedOption[0][GO_BGBRIGHTNESS] / 10.0f; PREFSMAN->m_iMovieDecodeMS = m_iSelectedOption[0][GO_MOVIEDECODEMS]+1; diff --git a/stepmania/src/ScreenGraphicOptions.h b/stepmania/src/ScreenGraphicOptions.h index 9bad6d5dd3..cd54a523fb 100644 --- a/stepmania/src/ScreenGraphicOptions.h +++ b/stepmania/src/ScreenGraphicOptions.h @@ -27,7 +27,6 @@ private: void GoToNextState(); void GoToPrevState(); - int CurrentRefresh() const; }; #endif \ No newline at end of file diff --git a/stepmania/src/ScreenHowToPlay.cpp b/stepmania/src/ScreenHowToPlay.cpp index c8408f10c1..d36b52bfa2 100644 --- a/stepmania/src/ScreenHowToPlay.cpp +++ b/stepmania/src/ScreenHowToPlay.cpp @@ -18,6 +18,7 @@ #include "GameConstantsAndTypes.h" #include "RageLog.h" #include "GameState.h" +#include "ThemeManager.h" #define HELP_TEXT THEME->GetMetric("ScreenHowToPlay","HelpText") diff --git a/stepmania/src/ScreenInputOptions.cpp b/stepmania/src/ScreenInputOptions.cpp index 20a9ca735d..5ef81d5669 100644 --- a/stepmania/src/ScreenInputOptions.cpp +++ b/stepmania/src/ScreenInputOptions.cpp @@ -20,6 +20,7 @@ #include "StepMania.h" #include "PrefsManager.h" #include "RageLog.h" +#include "ThemeManager.h" enum { diff --git a/stepmania/src/ScreenMachineOptions.cpp b/stepmania/src/ScreenMachineOptions.cpp index d1ecff9c95..3005b75c55 100644 --- a/stepmania/src/ScreenMachineOptions.cpp +++ b/stepmania/src/ScreenMachineOptions.cpp @@ -20,7 +20,7 @@ #include "StepMania.h" #include "PrefsManager.h" #include "RageLog.h" - +#include "ThemeManager.h" enum { diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index e154ec4c77..f72f8a948f 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -18,6 +18,7 @@ #include "GameState.h" #include "RageException.h" #include "RageTimer.h" +#include "ThemeManager.h" ScreenManager* SCREENMAN = NULL; // global and accessable from anywhere in our program @@ -133,7 +134,7 @@ void ScreenManager::Draw() if( PREFSMAN && PREFSMAN->m_bShowStats ) { - m_textStats.SetText( ssprintf("%d FPS\n%d TPF\n%d DPF", DISPLAY->GetFPS(),DISPLAY->GetTPF(),DISPLAY->GetDPF()) ); + m_textStats.SetText( "??? FPS" ); m_textStats.Draw(); } for( int p=0; pGetMetric("ScreenMapControllers","HelpText") diff --git a/stepmania/src/ScreenMusicScroll.cpp b/stepmania/src/ScreenMusicScroll.cpp index 96ff1fa7fd..32d4783164 100644 --- a/stepmania/src/ScreenMusicScroll.cpp +++ b/stepmania/src/ScreenMusicScroll.cpp @@ -19,6 +19,8 @@ #include "GameConstantsAndTypes.h" #include "SongManager.h" #include "GameState.h" +#include "ThemeManager.h" +#include "AnnouncerManager.h" #define SCROLL_DELAY THEME->GetMetricF("ScreenMusicScroll","ScrollDelay") diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index c673bebaa0..eb21f9c5a9 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -19,6 +19,7 @@ #include "GameConstantsAndTypes.h" #include "RageLog.h" #include "GameState.h" +#include "ThemeManager.h" #define ICONS_X( p ) THEME->GetMetricF("ScreenOptions",ssprintf("IconsP%dX",p+1)) diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 5eb23c0266..be4c5e3909 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -15,6 +15,8 @@ #include "ScreenManager.h" #include "RageLog.h" #include "GameState.h" +#include "ThemeManager.h" +#include "AnnouncerManager.h" enum { diff --git a/stepmania/src/ScreenPrompt.cpp b/stepmania/src/ScreenPrompt.cpp index bc21247c59..8aa5de10ed 100644 --- a/stepmania/src/ScreenPrompt.cpp +++ b/stepmania/src/ScreenPrompt.cpp @@ -17,6 +17,7 @@ #include "RageMusic.h" #include "GameConstantsAndTypes.h" #include "PrefsManager.h" +#include "ThemeManager.h" const float QUESTION_X = CENTER_X; const float QUESTION_Y = CENTER_Y - 60; diff --git a/stepmania/src/ScreenSandbox.cpp b/stepmania/src/ScreenSandbox.cpp index e6601b82b0..ac30867046 100644 --- a/stepmania/src/ScreenSandbox.cpp +++ b/stepmania/src/ScreenSandbox.cpp @@ -16,15 +16,12 @@ #include "GameConstantsAndTypes.h" #include "PrefsManager.h" #include "Quad.h" +#include "ThemeManager.h" #include "RageNetwork.h" ScreenSandbox::ScreenSandbox() { - m_text.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); - m_text.SetXY( CENTER_X, CENTER_Y ); - this->AddChild( &m_text ); - // m_Menu.Load( // THEME->GetPathTo(GRAPHIC_SELECT_STYLE_BACKGROUND), // THEME->GetPathTo(GRAPHIC_SELECT_STYLE_TOP_EDGE), @@ -34,7 +31,10 @@ ScreenSandbox::ScreenSandbox() // this->AddChild( &m_Menu ); // m_Menu.TweenOnScreenFromBlack( SM_None ); - //this->AddChild( &m_spr ); + m_sprite.Load( THEME->GetPathTo("Graphics","title menu logo dance") ); + m_sprite.SetXY( CENTER_X, CENTER_Y ); + m_sprite.SetEffectGlowing(); + this->AddChild( &m_sprite ); } @@ -44,10 +44,6 @@ void ScreenSandbox::Update( float fDeltaTime ) CArray aPackets; NETWORK->Recv( aPackets ); - for( unsigned int i=0; iGetMetricF("ScreenSelectCourse","ExplanationX") diff --git a/stepmania/src/ScreenSelectDifficulty.cpp b/stepmania/src/ScreenSelectDifficulty.cpp index 039de22256..919372dec3 100644 --- a/stepmania/src/ScreenSelectDifficulty.cpp +++ b/stepmania/src/ScreenSelectDifficulty.cpp @@ -19,6 +19,7 @@ #include "AnnouncerManager.h" #include "GameState.h" #include "RageMusic.h" +#include "ThemeManager.h" const float LOCK_INPUT_TIME = 0.30f; // lock input while waiting for tweening to complete diff --git a/stepmania/src/ScreenSelectGame.cpp b/stepmania/src/ScreenSelectGame.cpp index 2398d93a2a..ed67fe4a64 100644 --- a/stepmania/src/ScreenSelectGame.cpp +++ b/stepmania/src/ScreenSelectGame.cpp @@ -17,6 +17,7 @@ #include "GameManager.h" #include "GameState.h" #include "InputMapper.h" +#include "ThemeManager.h" enum { diff --git a/stepmania/src/ScreenSelectGroup.cpp b/stepmania/src/ScreenSelectGroup.cpp index 061e574ae2..168b2a3ad9 100644 --- a/stepmania/src/ScreenSelectGroup.cpp +++ b/stepmania/src/ScreenSelectGroup.cpp @@ -21,6 +21,8 @@ #include "AnnouncerManager.h" #include "GameState.h" #include "RageMusic.h" +#include "ThemeManager.h" +#include #define FRAME_X THEME->GetMetricF("ScreenSelectGroup","FrameX") @@ -78,20 +80,19 @@ ScreenSelectGroup::ScreenSelectGroup() aAllSongs.erase( aAllSongs.begin()+j, aAllSongs.begin()+j+1 ); } - CStringArray asGroupNames; - for( i=0; im_sGroupName ); + // Add all group names to a map. + std::map mapGroupNames; + for( i=0; im_sGroupName; + mapGroupNames[ sGroupName ] = ""; // group name maps to nothing } - /* Remove duplicate groups. */ - SortCStringArray(asGroupNames, true); - for( i=asGroupNames.size()-1; i > 0; --i ) { - if( asGroupNames[i] == asGroupNames[i-1] ) - asGroupNames.erase( asGroupNames.begin()+i, - asGroupNames.begin()+i+1 ); - } - - asGroupNames.insert(asGroupNames.begin(), "ALL MUSIC" ); + // copy group names into a vector + std::vector asGroupNames; + for( std::map::const_iterator iter = mapGroupNames.begin(); iter != mapGroupNames.end(); ++i ) + asGroupNames.push_back( iter->first ); + asGroupNames.push_back( "ALL MUSIC" ); // "ALL MUSIC" is a special group // Add songs to the MusicList. for( unsigned g=0; g < asGroupNames.size(); g++ ) /* for each group */ diff --git a/stepmania/src/ScreenSelectMode.cpp b/stepmania/src/ScreenSelectMode.cpp index 2da0eeaa0b..e99964d2b6 100644 --- a/stepmania/src/ScreenSelectMode.cpp +++ b/stepmania/src/ScreenSelectMode.cpp @@ -22,6 +22,7 @@ Chris Danford #include "RageException.h" #include "RageTimer.h" #include "GameState.h" +#include "ThemeManager.h" /* Constants */ @@ -200,11 +201,11 @@ void ScreenSelectMode::HandleScreenMessage( const ScreenMessage SM ) case SM_GoToNextScreen: // Put the mode choice into effect int iSelection = m_ScrollingList.GetSelection(); - const ModeChoice& choice = m_aPossibleModeChoices[ iSelection ]; - GAMESTATE->m_CurStyle = choice.style; - GAMESTATE->m_PlayMode = choice.pm; + const ModeChoice* pChoice = m_apPossibleModeChoices[ iSelection ]; + GAMESTATE->m_CurStyle = pChoice->style; + GAMESTATE->m_PlayMode = pChoice->pm; for( int p=0; pm_PreferredDifficulty[p] = choice.dc; + GAMESTATE->m_PreferredDifficulty[p] = pChoice->dc; switch( GAMESTATE->m_PlayMode ) { @@ -224,24 +225,24 @@ void ScreenSelectMode::RefreshModeChoices() { int iNumSidesJoined = GAMESTATE->GetNumSidesJoined(); - GAMEMAN->GetModesChoicesForGame( GAMESTATE->m_CurGame, m_aPossibleModeChoices ); - ASSERT( !m_aPossibleModeChoices.empty() ); + GAMEMAN->GetModesChoicesForGame( GAMESTATE->m_CurGame, m_apPossibleModeChoices ); + ASSERT( !m_apPossibleModeChoices.empty() ); int i; // remove ModeChoices that won't work with the current number of players - for( i=m_aPossibleModeChoices.size()-1; i>=0; i-- ) - if( m_aPossibleModeChoices[i].numSidesJoinedToPlay != iNumSidesJoined ) - m_aPossibleModeChoices.erase( m_aPossibleModeChoices.begin()+i, - m_aPossibleModeChoices.begin()+i+1 ); + for( i=m_apPossibleModeChoices.size()-1; i>=0; i-- ) + if( m_apPossibleModeChoices[i]->numSidesJoinedToPlay != iNumSidesJoined ) + m_apPossibleModeChoices.erase( m_apPossibleModeChoices.begin()+i, + m_apPossibleModeChoices.begin()+i+1 ); CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; CStringArray asGraphicPaths; - for( unsigned j=0; jGetPathTo("Graphics", ssprintf("select mode choice %s %s", sGameName.GetString(), choice.name) ) ); + const ModeChoice* pChoice = m_apPossibleModeChoices[j]; + asGraphicPaths.push_back( THEME->GetPathTo("Graphics", ssprintf("select mode choice %s %s", sGameName.GetString(), pChoice->name) ) ); } m_ScrollingList.Load( asGraphicPaths ); @@ -251,9 +252,9 @@ void ScreenSelectMode::RefreshModeChoices() { CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; - for( unsigned i=0; iname; m_BGAnimations[i].LoadFromAniDir( THEME->GetPathTo("BGAnimations",ssprintf("select mode %s %s", sGameName.GetString(), sChoiceName.GetString())) ); } } diff --git a/stepmania/src/ScreenSelectMode.h b/stepmania/src/ScreenSelectMode.h index 0f4e5b037a..6420306895 100644 --- a/stepmania/src/ScreenSelectMode.h +++ b/stepmania/src/ScreenSelectMode.h @@ -17,6 +17,8 @@ Andrew Livy #include "Quad.h" #include "MenuElements.h" #include "ScrollingList.h" +#include "GameConstantsAndTypes.h" +#include "ModeChoice.h" /* Class Definition */ @@ -53,7 +55,7 @@ protected: Sprite m_ChoiceListFrame; Sprite m_ChoiceListHighlight; - CArray m_aPossibleModeChoices; + CArray m_apPossibleModeChoices; ScrollingList m_ScrollingList; void RefreshModeChoices(); diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index c491d9e497..eee8c6021e 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -26,6 +26,9 @@ #include "InputMapper.h" #include "GameState.h" #include "CodeDetector.h" +#include +#include "GameConstantsAndTypes.h" +#include "ThemeManager.h" #define BANNER_FRAME_X THEME->GetMetricF("ScreenSelectMusic","BannerFrameX") @@ -384,10 +387,10 @@ void ScreenSelectMusic::Update( float fDeltaTime ) this->PlayMusicSample(); } - float fNewRotation = m_sprCDTitle.GetRotationY()+D3DX_PI*fDeltaTime/2; - fNewRotation = fmodf( fNewRotation, D3DX_PI*2 ); + float fNewRotation = m_sprCDTitle.GetRotationY()+PI*fDeltaTime/2; + fNewRotation = fmodf( fNewRotation, PI*2 ); m_sprCDTitle.SetRotationY( fNewRotation ); - if( fNewRotation > D3DX_PI/2 && fNewRotation <= D3DX_PI*3.0f/2 ) + if( fNewRotation > PI/2 && fNewRotation <= PI*3.0f/2 ) m_sprCDTitle.SetDiffuse( RageColor(0.2f,0.2f,0.2f,1) ); else m_sprCDTitle.SetDiffuse( RageColor(1,1,1,1) ); diff --git a/stepmania/src/ScreenSelectStyle.cpp b/stepmania/src/ScreenSelectStyle.cpp index 6988b7342a..2499936fc2 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -21,6 +21,8 @@ #include "RageLog.h" #include "AnnouncerManager.h" #include "GameState.h" +#include "GameConstantsAndTypes.h" +#include "ThemeManager.h" #define ICONS_START_X THEME->GetMetricF("ScreenSelectStyle","IconsStartX") diff --git a/stepmania/src/ScreenSelectStyle.h b/stepmania/src/ScreenSelectStyle.h index 363ad8b22b..862ff26310 100644 --- a/stepmania/src/ScreenSelectStyle.h +++ b/stepmania/src/ScreenSelectStyle.h @@ -1,3 +1,5 @@ +#ifndef SCREEN_SELECT_STYLE_H +#define SCREEN_SELECT_STYLE_H /* ----------------------------------------------------------------------------- Class: ScreenSelectStyle @@ -9,14 +11,13 @@ ----------------------------------------------------------------------------- */ -#ifndef SCREEN_SELECT_STYLE_H -#define SCREEN_SELECT_STYLE_H #include "Screen.h" #include "Sprite.h" #include "TransitionFade.h" #include "RandomSample.h" #include "MenuElements.h" +#include "Style.h" class ScreenSelectStyle : public Screen diff --git a/stepmania/src/ScreenSelectStyle5th.cpp b/stepmania/src/ScreenSelectStyle5th.cpp index a907a4d7f7..c3c594ffba 100644 --- a/stepmania/src/ScreenSelectStyle5th.cpp +++ b/stepmania/src/ScreenSelectStyle5th.cpp @@ -21,6 +21,8 @@ #include "RageLog.h" #include "GameState.h" #include "PrefsManager.h" +#include "ThemeManager.h" +#include "AnnouncerManager.h" #define HELP_TEXT THEME->GetMetric("ScreenSelectStyle5th","HelpText") #define TIMER_SECONDS THEME->GetMetricI("ScreenSelectStyle5th","TimerSeconds") diff --git a/stepmania/src/ScreenSongOptions.cpp b/stepmania/src/ScreenSongOptions.cpp index b7adcdb285..838a04005e 100644 --- a/stepmania/src/ScreenSongOptions.cpp +++ b/stepmania/src/ScreenSongOptions.cpp @@ -17,6 +17,7 @@ #include "GameConstantsAndTypes.h" #include "RageLog.h" #include "GameState.h" +#include "ThemeManager.h" enum { diff --git a/stepmania/src/ScreenStage.cpp b/stepmania/src/ScreenStage.cpp index 76b27a7800..c464219bfc 100644 --- a/stepmania/src/ScreenStage.cpp +++ b/stepmania/src/ScreenStage.cpp @@ -23,6 +23,7 @@ #include "AnnouncerManager.h" #include "GameState.h" #include "RageMusic.h" +#include "ThemeManager.h" #define NEXT_SCREEN THEME->GetMetric("ScreenStage","NextScreen") diff --git a/stepmania/src/ScreenTextEntry.cpp b/stepmania/src/ScreenTextEntry.cpp index 60a2825cb5..47ed89ee39 100644 --- a/stepmania/src/ScreenTextEntry.cpp +++ b/stepmania/src/ScreenTextEntry.cpp @@ -17,6 +17,7 @@ #include "ScreenTitleMenu.h" #include "GameConstantsAndTypes.h" #include "PrefsManager.h" +#include "ThemeManager.h" const float QUESTION_X = CENTER_X; const float QUESTION_Y = CENTER_Y - 60; diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index 2ebd071c83..7689552b3d 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -22,10 +22,10 @@ #include "GameState.h" #include "GameManager.h" #include "InputMapper.h" +#include "ThemeManager.h" const CString CHOICE_TEXT[ScreenTitleMenu::NUM_TITLE_MENU_CHOICES] = { "GAME START", - "NETWORK GAME", "SWITCH GAME", "CONFIG KEY/JOY", "INPUT OPTIONS", @@ -203,9 +203,6 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM ) case CHOICE_GAME_START: SCREENMAN->SetNewScreen( NEXT_SCREEN ); break; - case CHOICE_NETWORK_GAME: - SCREENMAN->SetNewScreen( "ScreenNetworkGame" ); - break; case CHOICE_SELECT_GAME: SCREENMAN->SetNewScreen( "ScreenSelectGame" ); break; @@ -354,7 +351,6 @@ void ScreenTitleMenu::MenuStart( PlayerNumber pn ) switch( m_TitleMenuChoice ) { case CHOICE_GAME_START: - case CHOICE_NETWORK_GAME: case CHOICE_SELECT_GAME: case CHOICE_MAP_INSTRUMENTS: case CHOICE_INPUT_OPTIONS: diff --git a/stepmania/src/ScreenTitleMenu.h b/stepmania/src/ScreenTitleMenu.h index e44d6d25bc..0279a70c68 100644 --- a/stepmania/src/ScreenTitleMenu.h +++ b/stepmania/src/ScreenTitleMenu.h @@ -30,7 +30,6 @@ public: enum TitleMenuChoice { CHOICE_GAME_START = 0, - CHOICE_NETWORK_GAME, CHOICE_SELECT_GAME, CHOICE_MAP_INSTRUMENTS, CHOICE_INPUT_OPTIONS, diff --git a/stepmania/src/ScrollBar.cpp b/stepmania/src/ScrollBar.cpp index 7b34895c14..f26310586b 100644 --- a/stepmania/src/ScrollBar.cpp +++ b/stepmania/src/ScrollBar.cpp @@ -13,6 +13,8 @@ #include "ScrollBar.h" #include "PrefsManager.h" #include "GameConstantsAndTypes.h" +#include +#include "ThemeManager.h" ScrollBar::ScrollBar() diff --git a/stepmania/src/SmallGradeDisplay.cpp b/stepmania/src/SmallGradeDisplay.cpp index 65b83d224c..cf07f5d821 100644 --- a/stepmania/src/SmallGradeDisplay.cpp +++ b/stepmania/src/SmallGradeDisplay.cpp @@ -14,6 +14,7 @@ #include "RageUtil.h" #include "GameConstantsAndTypes.h" #include "PrefsManager.h" +#include "ThemeManager.h" const float SCROLL_TIME = 5.0f; diff --git a/stepmania/src/SmallGradeDisplay.h b/stepmania/src/SmallGradeDisplay.h index a5a3a3b7e0..4912ec8151 100644 --- a/stepmania/src/SmallGradeDisplay.h +++ b/stepmania/src/SmallGradeDisplay.h @@ -14,6 +14,7 @@ #include "Sprite.h" #include "PrefsManager.h" #include "Grade.h" +#include "GameConstantsAndTypes.h" diff --git a/stepmania/src/SnapDisplay.cpp b/stepmania/src/SnapDisplay.cpp index 7ff56bd61c..4e186ab692 100644 --- a/stepmania/src/SnapDisplay.cpp +++ b/stepmania/src/SnapDisplay.cpp @@ -17,6 +17,7 @@ #include "ArrowEffects.h" #include "GameManager.h" #include "GameState.h" +#include "ThemeManager.h" SnapDisplay::SnapDisplay() diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 06894e09e8..596b10aeef 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -20,6 +20,10 @@ #include "RageException.h" #include "RageTimer.h" +#include "AnnouncerManager.h" +#include "ThemeManager.h" +#include "GameManager.h" + SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program diff --git a/stepmania/src/SongSelector.cpp b/stepmania/src/SongSelector.cpp index f66d971836..3fdde37b34 100644 --- a/stepmania/src/SongSelector.cpp +++ b/stepmania/src/SongSelector.cpp @@ -14,6 +14,8 @@ #include "RageLog.h" #include "SongManager.h" #include "GameState.h" +#include "ThemeManager.h" +#include "GameManager.h" // // Defines specific to SongSelector diff --git a/stepmania/src/SongSelector.h b/stepmania/src/SongSelector.h index 410c5bae9b..74007b7d43 100644 --- a/stepmania/src/SongSelector.h +++ b/stepmania/src/SongSelector.h @@ -1,3 +1,5 @@ +#ifndef SONG_SELECTOR_H +#define SONG_SELECTOR_H /* ----------------------------------------------------------------------------- Class: SongSelector @@ -9,15 +11,14 @@ ----------------------------------------------------------------------------- */ -#ifndef SONG_SELECTOR_H -#define SONG_SELECTOR_H - #include "stdafx.h" #include "ActorFrame.h" #include "MenuElements.h" #include "Banner.h" #include "TextBanner.h" +#include "GameConstantsAndTypes.h" +#include "Style.h" class SongSelector: public ActorFrame { public: diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index b57cbc8556..878d33c8e7 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -19,11 +19,14 @@ #include "RageLog.h" #include "RageException.h" #include "PrefsManager.h" +#include "RageDisplay.h" +#include "GameConstantsAndTypes.h" Sprite::Sprite() { m_pTexture = NULL; + m_bDrawIfTextureNull = false; m_iNumStates = 0; m_iCurState = 0; m_bIsAnimating = TRUE; @@ -144,7 +147,7 @@ bool Sprite::LoadTexture( CString sTexturePath, bool bForceReload, int iMipMaps, m_sTexturePath = sTexturePath; - m_pTexture = TEXTUREMAN->LoadTexture( m_sTexturePath, bForceReload, iMipMaps, iAlphaBits, bDither, bStretch ); + m_pTexture = TEXTUREMAN->LoadTexture( m_sTexturePath ); assert( m_pTexture != NULL ); // the size of the sprite is the size of the image before it was scaled @@ -187,10 +190,10 @@ void Sprite::Update( float fDeltaTime ) void Sprite::DrawPrimitives() { - if( m_pTexture == NULL ) + if( m_pTexture == NULL && !m_bDrawIfTextureNull ) return; - if( m_pTexture->IsAMovie() && m_pTexture->IsPlaying() ) + if( m_pTexture && m_pTexture->IsAMovie() && m_pTexture->IsPlaying() ) ::Sleep( PREFSMAN->m_iMovieDecodeMS ); // let the movie decode a frame @@ -198,8 +201,8 @@ void Sprite::DrawPrimitives() // Offset by -0.5, -0.5 if 640x480 // Offset by -1.0, -1.0 if 320x240 DISPLAY->TranslateLocal( - -0.5f*SCREEN_WIDTH/(float)PREFSMAN->m_iDisplayResolution, - -0.5f*SCREEN_WIDTH/(float)PREFSMAN->GetDisplayHeight(), + -0.5f*SCREEN_WIDTH/(float)PREFSMAN->m_iDisplayWidth, + -0.5f*SCREEN_HEIGHT/(float)PREFSMAN->m_iDisplayHeight, 0 ); // use m_temp_* variables to draw the object @@ -223,44 +226,42 @@ void Sprite::DrawPrimitives() static RageVertex v[4]; - - v[0].p = RageVector3( quadVerticies.left, quadVerticies.bottom, 0 ); // bottom left - v[1].p = RageVector3( quadVerticies.left, quadVerticies.top, 0 ); // top left + v[0].p = RageVector3( quadVerticies.left, quadVerticies.top, 0 ); // top left + v[1].p = RageVector3( quadVerticies.left, quadVerticies.bottom, 0 ); // bottom left v[2].p = RageVector3( quadVerticies.right, quadVerticies.bottom, 0 ); // bottom right v[3].p = RageVector3( quadVerticies.right, quadVerticies.top, 0 ); // top right - if( m_bUsingCustomTexCoords ) + if( m_pTexture ) { - v[0].t = RageVector2( m_CustomTexCoords[0], m_CustomTexCoords[1] ); // bottom left - v[1].t = RageVector2( m_CustomTexCoords[2], m_CustomTexCoords[3] ); // top left - v[2].t = RageVector2( m_CustomTexCoords[4], m_CustomTexCoords[5] ); // bottom right - v[3].t = RageVector2( m_CustomTexCoords[6], m_CustomTexCoords[7] ); // top right + if( m_bUsingCustomTexCoords ) + { + v[0].t = RageVector2( m_CustomTexCoords[2], m_CustomTexCoords[3] ); // top left + v[1].t = RageVector2( m_CustomTexCoords[0], m_CustomTexCoords[1] ); // bottom left + v[2].t = RageVector2( m_CustomTexCoords[4], m_CustomTexCoords[5] ); // bottom right + v[3].t = RageVector2( m_CustomTexCoords[6], m_CustomTexCoords[7] ); // top right - DISPLAY->EnableTextureWrapping(); - } - else - { - UINT uFrameNo = m_iStateToFrame[m_iCurState]; - RectF *pTexCoordRect = m_pTexture->GetTextureCoordRect( uFrameNo ); + DISPLAY->EnableTextureWrapping(); + } + else + { + UINT uFrameNo = m_iStateToFrame[m_iCurState]; + const RectF *pTexCoordRect = m_pTexture->GetTextureCoordRect( uFrameNo ); - v[0].t = RageVector2( pTexCoordRect->left, pTexCoordRect->bottom ); // bottom left - v[1].t = RageVector2( pTexCoordRect->left, pTexCoordRect->top ); // top left - v[2].t = RageVector2( pTexCoordRect->right, pTexCoordRect->bottom ); // bottom right - v[3].t = RageVector2( pTexCoordRect->right, pTexCoordRect->top ); // top right + v[0].t = RageVector2( pTexCoordRect->left, pTexCoordRect->top ); // top left + v[1].t = RageVector2( pTexCoordRect->left, pTexCoordRect->bottom ); // bottom left + v[2].t = RageVector2( pTexCoordRect->right, pTexCoordRect->bottom ); // bottom right + v[3].t = RageVector2( pTexCoordRect->right, pTexCoordRect->top ); // top right - // if the texture has more than one frame, we're going to get border mess from the - // neighboring frame, so don't bother turning wrapping off. - if( m_pTexture->GetNumFrames() == 1 ) - DISPLAY->DisableTextureWrapping(); + // if the texture has more than one frame, we're going to get border mess from the + // neighboring frame, so don't bother turning wrapping off. + if( m_pTexture->GetNumFrames() == 1 ) + DISPLAY->DisableTextureWrapping(); + } } - DISPLAY->SetTexture( m_pTexture ); - - DISPLAY->SetColorTextureMultDiffuse(); - DISPLAY->SetAlphaTextureMultDiffuse(); - + DISPLAY->SetTextureModeModulate(); if( m_bBlendAdd ) DISPLAY->SetBlendModeAdd(); else @@ -279,7 +280,7 @@ void Sprite::DrawPrimitives() DISPLAY->PushMatrix(); DISPLAY->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units v[0].c = v[1].c = v[2].c = v[3].c = RageColor(0,0,0,0.5f*m_temp.diffuse[0].a); // semi-transparent black - DISPLAY->AddQuad( v ); + DISPLAY->DrawQuad( v ); DISPLAY->PopMatrix(); } @@ -290,7 +291,7 @@ void Sprite::DrawPrimitives() v[1].c = m_temp.diffuse[0]; // top left v[2].c = m_temp.diffuse[3]; // bottom right v[3].c = m_temp.diffuse[1]; // top right - DISPLAY->AddQuad( v ); + DISPLAY->DrawQuad( v ); } ////////////////////// @@ -298,9 +299,9 @@ void Sprite::DrawPrimitives() ////////////////////// if( m_temp.glow.a != 0 ) { - DISPLAY->SetColorDiffuse(); + DISPLAY->SetTextureModeGlow(); v[0].c = v[1].c = v[2].c = v[3].c = m_temp.glow; - DISPLAY->AddQuad( v ); + DISPLAY->DrawQuad( v ); } } diff --git a/stepmania/src/Sprite.h b/stepmania/src/Sprite.h index 1d8d6e1eee..0c45d0f5b1 100644 --- a/stepmania/src/Sprite.h +++ b/stepmania/src/Sprite.h @@ -68,6 +68,7 @@ protected: CString m_sSpritePath; RageTexture* m_pTexture; + bool m_bDrawIfTextureNull; CString m_sTexturePath; int m_iStateToFrame[MAX_SPRITE_STATES]; // array of indicies into m_rectBitmapFrames diff --git a/stepmania/src/StdAfx.h b/stepmania/src/StdAfx.h index aae0fd501f..04caeea4b0 100644 --- a/stepmania/src/StdAfx.h +++ b/stepmania/src/StdAfx.h @@ -33,7 +33,7 @@ #undef max #define NOMINMAX /* make sure Windows doesn't try to define this */ -#include // MFC core and standard components + /* Make sure everyone has min and max: */ #include diff --git a/stepmania/src/StepMania.RC b/stepmania/src/StepMania.RC index 0ca08d8f8d..94eb8b8277 100644 --- a/stepmania/src/StepMania.RC +++ b/stepmania/src/StepMania.RC @@ -1,4 +1,4 @@ -// Microsoft Visual C++ generated resource script. +//Microsoft Developer Studio generated resource script. // #include "resource.h" @@ -27,18 +27,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE MOVEABLE PURE BEGIN "resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE MOVEABLE PURE BEGIN "#include ""afxres.h""\r\n" "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE MOVEABLE PURE BEGIN "\r\n" "\0" @@ -52,7 +52,7 @@ END // Accelerator // -IDR_MAIN_ACCEL ACCELERATORS +IDR_MAIN_ACCEL ACCELERATORS MOVEABLE PURE BEGIN VK_F5, IDM_CHANGEDETAIL, VIRTKEY, NOINVERT "X", IDM_EXIT, VIRTKEY, ALT, NOINVERT @@ -68,8 +68,9 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_ICON ICON "StepMania.ICO" +IDI_ICON ICON DISCARDABLE "StepMania.ICO" +#ifndef _MAC ///////////////////////////////////////////////////////////////////////////// // // Version @@ -92,14 +93,14 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN - VALUE "CompanyName", "http://www.stepmania.com" - VALUE "FileDescription", "StepMania" - VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "StepMania" - VALUE "LegalCopyright", "Copyright © 2001-2002" - VALUE "OriginalFilename", "StepMania.exe" - VALUE "ProductName", " StepMania" - VALUE "ProductVersion", "1, 0, 0, 1" + VALUE "CompanyName", "http://www.stepmania.com\0" + VALUE "FileDescription", "StepMania\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "StepMania\0" + VALUE "LegalCopyright", "Copyright © 2001-2002\0" + VALUE "OriginalFilename", "StepMania.exe\0" + VALUE "ProductName", " StepMania\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" END END BLOCK "VarFileInfo" @@ -108,23 +109,25 @@ BEGIN END END +#endif // !_MAC + ///////////////////////////////////////////////////////////////////////////// // // Bitmap // -BITMAP_ERROR BITMAP "error.bmp" -BITMAP_LOADING BITMAP "loading.bmp" -BITMAP_CRASH BITMAP "error2.bmp" +BITMAP_ERROR BITMAP MOVEABLE PURE "error.bmp" +BITMAP_LOADING BITMAP MOVEABLE PURE "loading.bmp" +BITMAP_CRASH BITMAP MOVEABLE PURE "error2.bmp" ///////////////////////////////////////////////////////////////////////////// // // Dialog // -IDD_ERROR_DIALOG DIALOG 0, 0, 332, 234 -STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION +IDD_ERROR_DIALOG DIALOG DISCARDABLE 0, 0, 332, 234 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION CAPTION "StepMania Error" FONT 8, "MS Sans Serif" BEGIN @@ -139,8 +142,8 @@ BEGIN PUSHBUTTON "View Log",IDC_BUTTON_VIEW_LOG,8,215,74,15 END -IDD_LOADING_DIALOG DIALOG 0, 0, 312, 78 -STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE +IDD_LOADING_DIALOG DIALOG DISCARDABLE 0, 0, 312, 78 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE FONT 8, "MS Sans Serif" BEGIN CONTROL 117,IDC_STATIC,"Static",SS_BITMAP,0,0,312,38 @@ -150,7 +153,7 @@ BEGIN END IDD_DISASM_CRASH DIALOGEX 0, 0, 399, 286 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION CAPTION "StepMania Error" FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN @@ -185,7 +188,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO MOVEABLE PURE BEGIN IDD_LOADING_DIALOG, DIALOG BEGIN diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index b08bb034ce..36fd8f58a6 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -30,10 +30,12 @@ #include "RageMath.h" #include "SDL.h" +#include "SDL_syswm.h" // for SDL_SysWMinfo // // StepMania global classes // +#include "ThemeManager.h" #include "PrefsManager.h" #include "SongManager.h" #include "PrefsManager.h" @@ -50,40 +52,24 @@ // // StepMania common classes // -#include "Font.h" #include "GameConstantsAndTypes.h" -#include "GameInput.h" -#include "StyleInput.h" -#include "Song.h" -#include "StyleDef.h" -#include "NoteData.h" -#include "Notes.h" -#include "tls.h" -#include "crash.h" +//#include "tls.h" +//#include "crash.h" -#include "dxerr8.h" -//#include -//----------------------------------------------------------------------------- -// Links -//----------------------------------------------------------------------------- +#include "SDL.h" +#include "SDL_opengl.h" + +#ifdef _DEBUG +#pragma comment(lib, "SDL-1.2.5/lib/SDLmaind.lib") +#else +#pragma comment(lib, "SDL-1.2.5/lib/SDLmain.lib") +#endif +#pragma comment(lib, "opengl32.lib") #pragma comment(lib, "d3dx8.lib") -#pragma comment(lib, "d3d8.lib") -//----------------------------------------------------------------------------- -// Application globals -//----------------------------------------------------------------------------- -const CString g_sAppName = "StepMania"; -const CString g_sAppClassName = "StepMania Class"; - -HINSTANCE g_hInstance; // The Handle to Window Instance -HWND g_hWndMain; // Main Window Handle -HWND g_hWndLoading; // Loading Window Handle -HANDLE g_hMutex; // Used to check if an instance of our app is already -const DWORD g_dwWindowStyle = WS_POPUP|WS_CAPTION|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU; -BOOL g_bIsActive = FALSE; // Whether the focus is on our app // command line arguments CString g_sSongPath = ""; @@ -94,414 +80,80 @@ int g_iNumClients = 0; const int SM_PORT = 26573; // Quake port + "Ko" + "na" + "mitsu" -//----------------------------------------------------------------------------- -// Function prototypes -//----------------------------------------------------------------------------- -// Main game functions -LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); -BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); -BOOL CALLBACK LoadingWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); +/*------------------------------------------------ + Common stuff +------------------------------------------------*/ +int flags = 0; /* SDL video flags */ +int bpp = 0; /* Preferred screen bpp */ +int window_w = SCREEN_WIDTH, window_h = SCREEN_HEIGHT; /* window width and height */ +SDL_Surface *loading_screen = NULL; +CString g_sErrorString = ""; -int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow ); // windows entry point -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 Window - -// Functions that work with game objects -HRESULT CreateObjects( HWND hWnd ); // allocate and initialize game objects -HRESULT InvalidateObjects(); // invalidate game objects before a display mode change -HRESULT RestoreObjects(); // restore game objects after a display mode change -VOID DestroyObjects(); // deallocate game objects when we're done with them - -void CreateLoadingWindow(); -void PaintLoadingWindow(); -void DestroyLoadingWindow(); - -void ApplyGraphicOptions(); // Set the display mode according to the user's preferences - -CString g_sErrorString; - -//----------------------------------------------------------------------------- -// Name: StructuredExceptionHandler() -// Desc: Callback for SEH exceptions -//----------------------------------------------------------------------------- -void StructuredExceptionHandler(unsigned int uCode, - struct _EXCEPTION_POINTERS* /* pXPointers */) +void ChangeToDirOfExecutable() { - const char* msg; - switch( uCode ) + // + // Make sure the current directory is the root program directory + // + if( !DoesFileExist("Songs") ) { - case EXCEPTION_ACCESS_VIOLATION: msg = "Access Violation"; break; - case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: msg = "Array Bounds Exceeded"; break; - case EXCEPTION_STACK_OVERFLOW: msg = "Stack Overflow"; break; - case EXCEPTION_FLT_DENORMAL_OPERAND: msg = "Floating Point Denormal Operation"; break; - case EXCEPTION_FLT_DIVIDE_BY_ZERO: msg = "Floating Point Divide by Zero"; break; - case EXCEPTION_FLT_INVALID_OPERATION: msg = "Floating Point Invalid Operation"; break; - case EXCEPTION_FLT_UNDERFLOW: msg = "Floating Point Underflow"; break; - case EXCEPTION_FLT_OVERFLOW: msg = "Floating Point Overflow"; break; - case EXCEPTION_FLT_STACK_CHECK: msg = "Floating Point Stack Over/Underflow"; break; - case EXCEPTION_INT_DIVIDE_BY_ZERO: msg = "Integer Divide by Zero"; break; - case EXCEPTION_INT_OVERFLOW: msg = "Integer Overflow"; break; - default: msg = "Unknown Exception"; break; - } - throw std::exception(msg); -} -void SplitCommandLine(const char *lpCmdLine, CStringArray &aCmds) -{ - const char *s = lpCmdLine; - - /* Split a string on whitespace, but never between quotes. */ - while(*s) - { - CString cmd; - - while( isspace(*s) ) s++; - - bool quoted = false; - while( *s && (quoted || !isspace(*s)) ) - { - cmd += *s; - if (*s == '"') - quoted = !quoted; - s++; - } - - if(cmd.GetLength()) - aCmds.push_back(cmd); - } -} - -//----------------------------------------------------------------------------- -// Name: WinMain() -// Desc: Application entry point -//----------------------------------------------------------------------------- -int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR CmdLine, int nCmdShow ) -{ - _set_se_translator( StructuredExceptionHandler ); - - g_hInstance = hInstance; -#ifdef _DEBUG - _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF); -#endif - - SetUnhandledExceptionFilter(CrashHandler); - InitThreadData("Main thread"); - VDCHECKPOINT; - - CStringArray Cmds; - SplitCommandLine(CmdLine, Cmds); - for(unsigned i = 0; i < Cmds.size(); ) - { - if(Cmds[i] == "--fsck") - { - crash(); - exit( 0 ); - } - else if(Cmds[i] == "--song") - { - ++i; - g_sSongPath = Cmds[i]; - ++i; - } - else if(Cmds[i] == "--client") - { - ++i; - g_bBeClient = true; - } - else if(Cmds[i] == "--server") - { - ++i; - g_bBeServer = true; - } - else if(Cmds[i] == "--ip") - { - ++i; - g_sServerIP = Cmds[i]; - ++i; - } - else if(Cmds[i] == "--numclients") - { - ++i; - g_iNumClients = atoi(Cmds[i]); - ++i; - } - } - -#ifndef _DEBUG - try - { -#endif - - CreateLoadingWindow(); + // change dir to path of the execuctable + TCHAR szFullAppPath[MAX_PATH]; + GetModuleFileName(NULL, szFullAppPath, MAX_PATH); - // - // Check to see if the app is already running. - // - g_hMutex = CreateMutex( NULL, TRUE, g_sAppName ); - if( GetLastError() == ERROR_ALREADY_EXISTS ) - { - MessageBox( NULL, "StepMania is already running.", "FatalError", MB_OK ); - exit( 1 ); - } + // strip off executable name + LPSTR pLastBackslash = strrchr(szFullAppPath, '\\'); + *pLastBackslash = '\0'; // terminate the string - - // - // Make sure the current directory is the root program directory - // - if( !DoesFileExist("Songs") ) - { - // change dir to path of the execuctable - TCHAR szFullAppPath[MAX_PATH]; - GetModuleFileName(NULL, szFullAppPath, MAX_PATH); - - // strip off executable name - LPSTR pLastBackslash = strrchr(szFullAppPath, '\\'); - *pLastBackslash = '\0'; // terminate the string - - SetCurrentDirectory( szFullAppPath ); - } - - /* - This was a stupid idea... -Chris - - // - // Check for packages in the AutoInstall folder - // - CStringArray asPackagePaths; - GetDirListing( "AutoInstall\\*.smzip", asPackagePaths, false, true ); - for( i=0; iIsWindowed() ) - ::Sleep( 0 ); // give some time to other processes because this process has such a high priority -#ifdef _DEBUG - ::Sleep( 1 ); -#endif - } - } // end while( WM_QUIT != msg.message ) - - LOG->Trace( "Recieved WM_QUIT message. Shutting down..." ); - - // clean up after a normal exit - DestroyObjects(); // deallocate our game objects and leave fullscreen - ShowWindow( g_hWndMain, SW_HIDE ); - - -#ifndef _DEBUG + SetCurrentDirectory( szFullAppPath ); } - catch( RageException e ) - { - g_sErrorString = e.what(); - - DestroyObjects(); // destroy game objects so we can see the error dialog - ShowWindow( g_hWndMain, SW_HIDE ); - } - - if( g_sErrorString != "" ) - { - - if( LOG ) - { - LOG->Flush(); - - LOG->Trace( - "\n" - "//////////////////////////////////////////////////////\n" - "Exception: %s\n" - "//////////////////////////////////////////////////////\n" - "\n", - g_sErrorString.GetString() - ); - } - - // throw up a pretty error dialog - DialogBox( - g_hInstance, - MAKEINTRESOURCE(IDD_ERROR_DIALOG), - NULL, - ErrorWndProc - ); - } -#endif - - DestroyWindow( g_hWndMain ); - UnregisterClass( g_sAppClassName, hInstance ); - CoUninitialize(); // Uninitialize COM - CloseHandle( g_hMutex ); - - return 0L; } -void CleanupForRestart() + +void PaintLoadingWindow() { - CloseHandle( g_hMutex ); - g_hMutex = NULL; + SDL_UpdateRect(loading_screen, 0,0,0,0); } void CreateLoadingWindow() { - // throw up a pretty error dialog - g_hWndLoading = CreateDialog( - g_hInstance, - MAKEINTRESOURCE(IDD_LOADING_DIALOG), - NULL, - LoadingWndProc - ); -} + ASSERT( loading_screen == NULL ); -void PaintLoadingWindow() -{ - SendMessage( g_hWndLoading, WM_PAINT, 0, 0 ); + /* Initialize the SDL library */ + if( SDL_InitSubSystem(SDL_INIT_VIDEO) < 0 ) + throw RageException( "Couldn't initialize SDL: %s\n", SDL_GetError() ); + + SDL_Surface *image; + + /* Load the BMP file into a surface */ + image = SDL_LoadBMP("loading.bmp"); + if( image == NULL ) + throw RageException("Couldn't load loading.bmp: %s\n",SDL_GetError()); + + /* Initialize the display in a 640x480 16-bit mode */ + loading_screen = SDL_SetVideoMode(image->w, image->h, 16, SDL_SWSURFACE|SDL_ANYFORMAT|SDL_NOFRAME); + if( loading_screen == NULL ) + throw RageException( "Couldn't initialize loading window: %s\n", SDL_GetError() ); + + /* Blit onto the screen surface */ + SDL_Rect dest; + dest.x = 0; + dest.y = 0; + dest.w = (Uint16)image->w; + dest.h = (Uint16)image->h; + SDL_BlitSurface(image, NULL, loading_screen, NULL); + + SDL_WM_SetCaption( "StepMania", NULL); + + PaintLoadingWindow(); + + /* Free the allocated BMP surface */ + SDL_FreeSurface(image); } void DestroyLoadingWindow() { - EndDialog( g_hWndLoading, 0 ); -} - -//----------------------------------------------------------------------------- -// Name: LoadingWndProc() -// Desc: Callback for all Windows messages -//----------------------------------------------------------------------------- -BOOL CALLBACK LoadingWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) -{ - switch( msg ) - { - case WM_INITDIALOG: - { - } - break; - case WM_COMMAND: - break; - case WM_PAINT: - { - CStringArray asMessageLines; - if( GAMESTATE && GAMESTATE->m_sLoadingMessage != "" ) - split( GAMESTATE->m_sLoadingMessage, "\n", asMessageLines, false ); - else - asMessageLines.push_back( "Initializing hardware..." ); - - SendDlgItemMessage( - hWnd, - IDC_STATIC_MESSAGE1, - WM_SETTEXT, - 0, - (LPARAM)(LPCTSTR)asMessageLines[0] - ); - SendDlgItemMessage( - hWnd, - IDC_STATIC_MESSAGE2, - WM_SETTEXT, - 0, - (LPARAM)(LPCTSTR)(asMessageLines.size()>=2 ? asMessageLines[1] : "") - ); - SendDlgItemMessage( - hWnd, - IDC_STATIC_MESSAGE3, - WM_SETTEXT, - 0, - (LPARAM)(LPCTSTR)(asMessageLines.size()>=3 ? asMessageLines[2] : "") - ); - } - break; - - } - return FALSE; + SDL_QuitSubSystem( SDL_INIT_VIDEO ); + loading_screen = NULL; } @@ -557,9 +209,7 @@ BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) case IDC_BUTTON_RESTART: { /* Clear the startup mutex, since we're starting a new - * instance before ending ourself. */ - CleanupForRestart(); - + * instance before ending ourself. */ TCHAR szFullAppPath[MAX_PATH]; GetModuleFileName(NULL, szFullAppPath, MAX_PATH); @@ -594,147 +244,71 @@ BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) //----------------------------------------------------------------------------- -// Name: WndProc() -// Desc: Callback for all Windows messages +// Name: ApplyGraphicOptions() +// Desc: //----------------------------------------------------------------------------- -LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) -{ - switch( msg ) - { - case WM_ACTIVATEAPP: - // Check to see if we are losing our window... - g_bIsActive = (BOOL)wParam; - break; - - case WM_SIZE: - // Check to see if we are losing our window... - if( SIZE_MAXHIDE==wParam || SIZE_MINIMIZED==wParam ) - g_bIsActive = FALSE; - else - g_bIsActive = TRUE; - break; - - case WM_GETMINMAXINFO: - { - // Don't allow the window to be resized smaller than the screen resolution. - // This should snap to multiples of the Window size two! - RECT rcWnd; - SetRect( &rcWnd, 0, 0, PREFSMAN->m_iDisplayResolution, PREFSMAN->GetDisplayHeight() ); - DWORD dwWindowStyle = GetWindowLong( g_hWndMain, GWL_STYLE ); - AdjustWindowRect( &rcWnd, dwWindowStyle, FALSE ); - - ((MINMAXINFO*)lParam)->ptMinTrackSize.x = RECTWIDTH(rcWnd); - ((MINMAXINFO*)lParam)->ptMinTrackSize.y = RECTHEIGHT(rcWnd); - } - break; - - case WM_SETCURSOR: - // Turn off Windows cursor in fullscreen mode - if( DISPLAY && !DISPLAY->IsWindowed() ) - { - SetCursor( NULL ); - return TRUE; // prevent Windows from setting the cursor - } - break; - - case WM_SYSCOMMAND: - // Prevent moving/sizing and power loss - switch( wParam ) - { - case SC_MOVE: - case SC_SIZE: - case SC_KEYMENU: - case SC_MONITORPOWER: - return 1; - case SC_MAXIMIZE: - //SendMessage( g_hWndMain, WM_COMMAND, IDM_TOGGLEFULLSCREEN, 0 ); - //return 1; - break; - } - break; - - - case WM_COMMAND: - { - switch( LOWORD(wParam) ) - { - case IDM_TOGGLEFULLSCREEN: - PREFSMAN->m_bWindowed = !PREFSMAN->m_bWindowed; - ApplyGraphicOptions(); - return 0; - case IDM_CHANGEDETAIL: - if( PREFSMAN->m_iDisplayResolution != 640 ) - PREFSMAN->m_iDisplayResolution = 640; - else - PREFSMAN->m_iDisplayResolution = 320; - - ApplyGraphicOptions(); - return 0; - case IDM_EXIT: - // Recieved key/menu command to exit app - SendMessage( hWnd, WM_CLOSE, 0, 0 ); - return 0; - } - break; - } - case WM_NCHITTEST: - // Prevent the user from selecting the menu in fullscreen mode - if( DISPLAY && !DISPLAY->IsWindowed() ) - return HTCLIENT; - break; - - case WM_PAINT: - // redisplay the contents of the back buffer if the window needs to be redrawn - ShowFrame(); - break; - - case WM_DESTROY: - PostQuitMessage( 0 ); - break; - } - - return DefWindowProc( hWnd, msg, wParam, lParam ); +void ApplyGraphicOptions() +{ + DISPLAY->SetVideoMode( + PREFSMAN->m_bWindowed, + PREFSMAN->m_iDisplayWidth, + PREFSMAN->m_iDisplayHeight, + PREFSMAN->m_iDisplayColorDepth, + (RefreshRateMode)PREFSMAN->m_iRefreshRateMode, + PREFSMAN->m_bVsync ); + TEXTUREMAN->SetPrefs( PREFSMAN->m_iTextureColorDepth, PREFSMAN->m_iUnloadTextureDelaySeconds ); } //----------------------------------------------------------------------------- -// Name: CreateObjects() -// Desc: +// Name: WinMain() +// Desc: Application entry point //----------------------------------------------------------------------------- -HRESULT CreateObjects( HWND hWnd ) +int main(int argc, char* argv[]) { - /* Fire up the SDL, but don't actually start any subsystems. */ - SDL_Init(0); + ChangeToDirOfExecutable(); + + atexit(SDL_Quit); /* Clean up on exit */ /* - // - // Draw a splash bitmap so the user isn't looking at a black Window - // - HBITMAP hSplashBitmap = (HBITMAP)LoadImage( - GetModuleHandle( NULL ), - TEXT("BITMAP_SPLASH"), - IMAGE_BITMAP, - 0, 0, LR_CREATEDIBSECTION ); - BITMAP bmp; - RECT rc; - GetClientRect( hWnd, &rc ); + * Handle command line args + */ + for(int i=0; iReadGlobalPrefsFromDisk( true ); + DISPLAY = new RageDisplay( + PREFSMAN->m_bWindowed, + PREFSMAN->m_iDisplayWidth, + PREFSMAN->m_iDisplayHeight, + PREFSMAN->m_iDisplayColorDepth, + (RefreshRateMode)PREFSMAN->m_iRefreshRateMode, + PREFSMAN->m_bVsync ); + TEXTUREMAN = new RageTextureManager( PREFSMAN->m_iTextureColorDepth, PREFSMAN->m_iUnloadTextureDelaySeconds ); + + /* Grab the window manager specific information */ + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + if ( SDL_GetWMInfo(&info) < 0 ) + throw RageException( "SDL_GetWMInfo failed" ); + HWND hwnd = info.window; + + INPUTMAN = new RageInput( hwnd ); + // These things depend on the TextureManager, so do them after! FONT = new FontManager; SCREENMAN = new ScreenManager; - BringWindowToTop( hWnd ); - SetForegroundWindow( hWnd ); - + /* + * Load initial screen depending on network mode + */ if( g_bBeClient ) { // immediately try to connect to server @@ -814,15 +394,117 @@ HRESULT CreateObjects( HWND hWnd ) } - return S_OK; -} + // Do game loop + bool do_exit = false; + SDL_Event event; + while(!do_exit) + { + // process all queued events + while(SDL_PollEvent(&event)) + { + switch(event.type) + { + case SDL_QUIT: + do_exit = 1; + break; + case SDL_VIDEORESIZE: + PREFSMAN->m_iDisplayWidth = event.resize.w; + PREFSMAN->m_iDisplayHeight = event.resize.h; + ApplyGraphicOptions(); + break; + } + } + + DISPLAY->Clear(); + DISPLAY->ResetMatrixStack(); + + + /* + * Update + */ + float fDeltaTime = TIMER->GetDeltaTime(); + + // This was a hack to fix timing issues with the old ScreenSelectSong + // See ScreenManager::Update comments for why we shouldn't do this. -glenn + //if( fDeltaTime > 0.050f ) // we dropped a bunch of frames + // fDeltaTime = 0.050f; + if( INPUTMAN->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_TAB) ) ) + fDeltaTime *= 4; + if( INPUTMAN->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_GRAVE) ) ) + fDeltaTime /= 4; + + + MUSIC->Update( fDeltaTime ); + SCREENMAN->Update( fDeltaTime ); + NETWORK->Update( fDeltaTime ); + + + static InputEventArray ieArray; + ieArray.clear(); // empty the array + INPUTFILTER->GetInputEvents( ieArray, fDeltaTime ); + for( unsigned i=0; iDeviceToGame( DeviceI, GameI ); + + if( GameI.IsValid() && type == IET_FIRST_PRESS ) + INPUTQUEUE->RememberInput( GameI ); + if( GameI.IsValid() ) + { + INPUTMAPPER->GameToMenu( GameI, MenuI ); + INPUTMAPPER->GameToStyle( GameI, StyleI ); + } + + SCREENMAN->Input( DeviceI, type, GameI, MenuI, StyleI ); + } + + + /* + * Render + */ + DISPLAY->ResetMatrixStack(); + + RageMatrix mat; + + RageMatrixOrthoOffCenterLH( &mat, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, SCREEN_NEAR, SCREEN_FAR ); + DISPLAY->SetProjectionTransform( &mat ); + + RageMatrixIdentity( &mat ); + DISPLAY->SetViewTransform( &mat ); + + SCREENMAN->Draw(); // draw the game + + DISPLAY->FlushQueue(); + DISPLAY->Flip(); + + if( DISPLAY && DISPLAY->IsWindowed() ) + ::Sleep( 0 ); // give some time to other processes + } + +#ifndef _DEBUG + } + catch( RageException e ) + { + g_sErrorString = e.what(); + + LOG->Trace( + "\n" + "//////////////////////////////////////////////////////\n" + "Exception: %s\n" + "//////////////////////////////////////////////////////\n" + "\n", + g_sErrorString.GetString() + ); + + LOG->Flush(); + } +#endif -//----------------------------------------------------------------------------- -// Name: DestroyObjects() -// Desc: -//----------------------------------------------------------------------------- -void DestroyObjects() -{ SAFE_DELETE( SCREENMAN ); SAFE_DELETE( NETWORK ); SAFE_DELETE( INPUTQUEUE ); @@ -843,390 +525,18 @@ void DestroyObjects() SAFE_DELETE( TEXTUREMAN ); SAFE_DELETE( DISPLAY ); SAFE_DELETE( LOG ); -} -//----------------------------------------------------------------------------- -// Name: RestoreObjects() -// Desc: -//----------------------------------------------------------------------------- -HRESULT RestoreObjects() -{ - ///////////////////// - // Restore the window - ///////////////////// - - // Set window size - RECT rcWnd; - DWORD dwWindowStyle = g_dwWindowStyle; - - if( DISPLAY->IsWindowed() ) + if( g_sErrorString != "" ) { -// dwWindowStyle &= WS_THICKFRAME; -// SetWindowLong( g_hWndMain, GWL_STYLE, dwWindowStyle ); - SetRect( &rcWnd, 0, 0, PREFSMAN->m_iDisplayResolution, PREFSMAN->GetDisplayHeight() ); - AdjustWindowRect( &rcWnd, dwWindowStyle, FALSE ); - } - else // if fullscreen - { -// SetWindowLong( g_hWndMain, GWL_STYLE, dwWindowStyle ); - SetRect( &rcWnd, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN) ); + // throw up a pretty error dialog + DialogBox( + NULL, + MAKEINTRESOURCE(IDD_ERROR_DIALOG), + NULL, + ErrorWndProc + ); } - // Bring the window to the foreground - SetWindowPos( g_hWndMain, - HWND_NOTOPMOST, - 0, - 0, - RECTWIDTH(rcWnd), - RECTHEIGHT(rcWnd), - 0 ); - - - - /////////////////////////// - // Restore all game objects - /////////////////////////// - - DISPLAY->Restore(); - - return S_OK; + return 0; } - - -//----------------------------------------------------------------------------- -// Name: InvalidateObjects() -// Desc: -//----------------------------------------------------------------------------- -HRESULT InvalidateObjects() -{ - DISPLAY->Invalidate(); - - return S_OK; -} - - - -//----------------------------------------------------------------------------- -// Name: Update() -// Desc: -//----------------------------------------------------------------------------- -void Update() -{ - float fDeltaTime = TIMER->GetDeltaTime(); - - // This was a hack to fix timing issues with the old ScreenSelectSong - // - // See ScreenManager::Update comments for why we shouldn't do this. -glenn - //if( fDeltaTime > 0.050f ) // we dropped a bunch of frames - // fDeltaTime = 0.050f; - - if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_TAB) ) ) - fDeltaTime *= 4; - if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_GRAVE) ) ) { - if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_TAB) ) ) - fDeltaTime = 0; - else - fDeltaTime /= 4; - } - - MUSIC->Update( fDeltaTime ); - - SCREENMAN->Update( fDeltaTime ); - - NETWORK->Update( fDeltaTime ); - - /* - // handle network input - Packet packet; - while( NETWORK->Recv(&packet) ) - { - SCREENMAN->SystemMessage( "Packet Recv'd" ); - - // process pPacket - switch( packet.type ) - { - case Packet::chat: - SCREENMAN->SystemMessage( (char*)packet.GetData() ); - break; - case Packet::input: - { - GameInput* pGI; - pGI = (GameInput*)packet.GetData(); - ASSERT( packet.GetSize() == sizeof(GameInput) ); - - DeviceInput DeviceI; - InputEventType type; - GameInput GameI; - MenuInput MenuI; - StyleInput StyleI; - - DeviceI.MakeInvalid(); - type = IET_FIRST_PRESS; - - GameI = *pGI; - - if( GameI.IsValid() && type == IET_FIRST_PRESS ) - INPUTQUEUE->RememberInput( GameI ); - if( GameI.IsValid() ) - { - INPUTMAPPER->GameToMenu( GameI, MenuI ); - INPUTMAPPER->GameToStyle( GameI, StyleI ); - } - - SCREENMAN->Input( DeviceI, type, GameI, MenuI, StyleI ); - } - break; - default: - ASSERT(0); // corrupt packet? Not a type we recognize - } - } - */ - - static InputEventArray ieArray; - ieArray.clear(); // empty the array - INPUTFILTER->GetInputEvents( ieArray, fDeltaTime ); - - for( unsigned i=0; iDeviceToGame( DeviceI, GameI ); - - if( GameI.IsValid() && type == IET_FIRST_PRESS ) - INPUTQUEUE->RememberInput( GameI ); - if( GameI.IsValid() ) - { - INPUTMAPPER->GameToMenu( GameI, MenuI ); - INPUTMAPPER->GameToStyle( GameI, StyleI ); - } - - SCREENMAN->Input( DeviceI, type, GameI, MenuI, StyleI ); - - /* - // Replicate input over network - if( GameI.IsValid() && type == IET_FIRST_PRESS ) - { - Packet packet; - packet.type = Packet::input; - packet.SetData( &GameI, sizeof(GameInput) ); - - NETWORK->Send( &packet ); - - SCREENMAN->SystemMessage( "Packet Sent" ); - } - */ - } -} - - -//----------------------------------------------------------------------------- -// Name: Render() -// Desc: -//----------------------------------------------------------------------------- -void Render() -{ - HRESULT hr = DISPLAY->BeginFrame(); - switch( hr ) - { - case D3DERR_DEVICELOST: - // The user probably alt-tabbed out of fullscreen. - // Do not render a frame until we re-acquire the device - break; - case D3DERR_DEVICENOTRESET: - InvalidateObjects(); - - // Resize the device - if( FAILED( hr = DISPLAY->Reset() ) ) - throw RageException( hr, "Failed to DISPLAY->Reset()" ); - - // Initialize the app's device-dependent objects - RestoreObjects(); - - break; - case S_OK: - { - // calculate view and projection transforms - RageMatrix mat; - - RageMatrixOrthoOffCenterLH( &mat, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, -1000, 1000 ); - DISPLAY->SetProjectionTransform( &mat ); - - RageMatrixIdentity( &mat ); - DISPLAY->SetViewTransform( &mat ); - - DISPLAY->ResetMatrixStack(); - - // draw the game - SCREENMAN->Draw(); - - DISPLAY->EndFrame(); - } - break; - } - - ShowFrame(); -} - - -//----------------------------------------------------------------------------- -// Name: ShowFrame() -// Desc: -//----------------------------------------------------------------------------- -void ShowFrame() -{ - // display the contents of the back buffer to the front - if( DISPLAY ) - DISPLAY->ShowFrame(); -} - - -//----------------------------------------------------------------------------- -// Name: ApplyGraphicOptions() -// Desc: -//----------------------------------------------------------------------------- -void ApplyGraphicOptions() -{ - InvalidateObjects(); - - bool &bWindowed = PREFSMAN->m_bWindowed; - - int &iDisplayWidth = PREFSMAN->m_iDisplayResolution; - int iDisplayHeight = PREFSMAN->GetDisplayHeight(); - - int iDisplayBPP = 16; - - int &iTextureSize = PREFSMAN->m_iTextureResolution; - - /* XXX: ScreenGraphicOptions assumes this is always 16bpp. If this is - * ever changed, keep track of it, since the available refresh rates - * is dependent on the bit depth. */ - int iTextureBPP = 16; - - int iUnloadTextureDelaySeconds = PREFSMAN->m_iUnloadTextureDelaySeconds; - - int &iRefreshRate = PREFSMAN->m_iRefreshRate; - - CString sMessage = ssprintf( "%s - %dx%d, %dx%d textures%s", - bWindowed ? "Windowed" : "FullScreen", - iDisplayWidth, - iDisplayHeight, - iTextureSize, - iTextureSize, - bWindowed ? "" : ssprintf(", %dHz", iRefreshRate).GetString() - ); - - // - // If the requested modes doesn't work, keep switching until we find one that does. - // - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "We failed. Using default refresh rate." ); - iRefreshRate = RageDisplay::REFRESH_DEFAULT; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "Failed again. Try 16 BPP." ); - iDisplayBPP = 16; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "Failed again. Try 32 BPP." ); - iDisplayBPP = 32; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "We failed. Try full screen with same params." ); - bWindowed = false; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "Failed again. Try 16 BPP." ); - iDisplayBPP = 16; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "Failed again. Try 32 BPP." ); - iDisplayBPP = 32; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "We failed. Try windowed with same params." ); - bWindowed = false; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "Failed again. Try 32 BPP." ); - iDisplayBPP = 32; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "Failed again. Try 16 BPP." ); - iDisplayBPP = 16; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "Failed again. Try 640x480." ); - iDisplayWidth = 640; - iDisplayHeight = 480; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "We failed. Try full screen with same params." ); - bWindowed = false; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "Failed again. Try 16 BPP." ); - iDisplayBPP = 16; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "Failed again. Try 32 BPP." ); - iDisplayBPP = 32; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "We failed. Try windowed with same params." ); - bWindowed = false; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "Failed again. Try 32 BPP." ); - iDisplayBPP = 32; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - LOG->Trace( "Failed again. Try 16 BPP." ); - iDisplayBPP = 16; - if( DISPLAY->SwitchDisplayMode(bWindowed, iDisplayWidth, iDisplayHeight, iDisplayBPP, iRefreshRate, PREFSMAN->m_bVsync ) ) - goto success; - - throw RageException( "Tried every possible display mode, and couldn't find one that works." ); - -success: - - // - // Let the texture manager know about our preferences - // - if( TEXTUREMAN != NULL ) - TEXTUREMAN->SetPrefs( iTextureSize, iTextureBPP, iUnloadTextureDelaySeconds ); - - RestoreObjects(); - - PREFSMAN->SaveGlobalPrefsToDisk(); - - if( SCREENMAN ) - SCREENMAN->SystemMessage( sMessage ); - -} - - - - - diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index c5a92d4b62..3a88f463de 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -36,14 +36,14 @@ RSC=rc.exe # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" -# PROP Use_MFC 1 +# PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "../" # PROP Intermediate_Dir "../Release6" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /Ob2 /I "SDL-1.2.5\include" /I "SDL_image-1.2" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /Ob2 /I "SDL-1.2.5\include" /I "SDL_image-1.2" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo /o"../StepMania-StackTrace.bsc" LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 $(intdir)\verstub.obj /nologo /subsystem:windows /pdb:"../release6/StepMania.pdb" /map /debug /machine:I386 +# ADD LINK32 $(intdir)\verstub.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /pdb:"../release6/StepMania.pdb" /map /debug /machine:I386 # SUBTRACT LINK32 /pdb:none # Begin Special Build Tool IntDir=.\../Release6 @@ -71,7 +71,7 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" -# PROP Use_MFC 1 +# PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "../" # PROP Intermediate_Dir "../Debug6" @@ -88,7 +88,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 $(intdir)\verstub.obj /nologo /subsystem:windows /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:I386 /out:"../StepMania-debug.exe" +# ADD LINK32 $(intdir)\verstub.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:I386 /out:"../StepMania-debug.exe" # SUBTRACT LINK32 /profile /pdb:none /incremental:no /nodefaultlib # Begin Special Build Tool IntDir=.\../Debug6 @@ -195,10 +195,6 @@ SOURCE=.\RageMath.h # End Source File # Begin Source File -SOURCE=.\RageMovieTexture.cpp -# End Source File -# Begin Source File - SOURCE=.\RageMovieTexture.h # End Source File # Begin Source File @@ -515,10 +511,6 @@ SOURCE=.\MsdFile.h # PROP Default_Filter "" # Begin Source File -SOURCE=.\dxutil.cpp -# End Source File -# Begin Source File - SOURCE=.\resource.h # End Source File # Begin Source File @@ -1253,14 +1245,6 @@ SOURCE=.\ScreenMusicScroll.h # End Source File # Begin Source File -SOURCE=.\ScreenNetworkGame.cpp -# End Source File -# Begin Source File - -SOURCE=.\ScreenNetworkGame.h -# End Source File -# Begin Source File - SOURCE=.\ScreenOptions.cpp # End Source File # Begin Source File @@ -1477,10 +1461,6 @@ SOURCE=.\ThemeManager.h # PROP Default_Filter "" # Begin Source File -SOURCE=.\Crash.cpp -# End Source File -# Begin Source File - SOURCE=.\Crash.h # End Source File # Begin Source File @@ -1489,18 +1469,10 @@ SOURCE=.\CrashList.h # End Source File # Begin Source File -SOURCE=.\Disasm.cpp -# End Source File -# Begin Source File - SOURCE=.\Disasm.h # End Source File # Begin Source File -SOURCE=.\Tls.cpp -# End Source File -# Begin Source File - SOURCE=.\Tls.h # End Source File # End Group @@ -1516,9 +1488,5 @@ SOURCE=.\error.bmp SOURCE=.\error2.bmp # End Source File -# Begin Source File - -SOURCE=.\loading.bmp -# End Source File # End Target # End Project diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index b2a15b7954..e3a51e9d4d 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -16,7 +16,7 @@ OutputDirectory=".\.." IntermediateDirectory=".\../Debug" ConfigurationType="1" - UseOfMFC="1" + UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2" WholeProgramOptimization="FALSE"> @@ -86,7 +86,7 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ OutputDirectory="./.." IntermediateDirectory="./../Release" ConfigurationType="1" - UseOfMFC="1" + UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2" WholeProgramOptimization="TRUE"> @@ -271,12 +271,6 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ - - - - @@ -428,6 +422,9 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ + + @@ -1004,9 +1001,6 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ - - @@ -1191,24 +1185,15 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ - - - - - - diff --git a/stepmania/src/TextBanner.cpp b/stepmania/src/TextBanner.cpp index f061afbdd7..fe1919020a 100644 --- a/stepmania/src/TextBanner.cpp +++ b/stepmania/src/TextBanner.cpp @@ -14,6 +14,7 @@ #include "RageUtil.h" #include "Song.h" #include "PrefsManager.h" +#include "ThemeManager.h" const float TEXT_BANNER_WIDTH = 180; diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 36e7d247fb..e6a368e33e 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -168,7 +168,7 @@ try_element_again: if( asPossibleElementFilePaths.empty() ) { #ifdef _DEBUG - switch( AfxMessageBox( ssprintf("The theme element %s/%s is missing.",sAssetCategory.GetString(),sFileName.GetString()), MB_ABORTRETRYIGNORE ) ) + switch( MessageBox(NULL,"ThemeManager",ssprintf("The theme element %s/%s is missing.",sAssetCategory.GetString(),sFileName.GetString()), MB_ABORTRETRYIGNORE ) ) { case IDRETRY: goto try_element_again; @@ -213,7 +213,7 @@ try_element_again: if( sNewFileName == "" || !DoesFileExist(sNewFilePath) ) { #ifdef _DEBUG - if( IDRETRY == AfxMessageBox( ssprintf("The redirect '%s' points to the file '%s', which does not exist. Verify that this redirect is correct.", sRedirFilePath.GetString(), sNewFilePath.GetString()), MB_RETRYCANCEL ) ) + if( IDRETRY == MessageBox(NULL,"ThemeManager",ssprintf("The redirect '%s' points to the file '%s', which does not exist. Verify that this redirect is correct.", sRedirFilePath.GetString(), sNewFilePath.GetString()), MB_RETRYCANCEL ) ) goto try_element_again; #endif throw RageException( "The redirect '%s' points to the file '%s', which does not exist. Verify that this redirect is correct.", sRedirFilePath.GetString(), sNewFilePath.GetString() ); @@ -259,7 +259,7 @@ try_metric_again: } #ifdef _DEBUG - if( IDRETRY == AfxMessageBox( ssprintf("The theme metric %s-%s is missing. Correct this and click Retry, or Cancel to break.",sClassName.GetString(),sValueName.GetString()), MB_RETRYCANCEL ) ) + if( IDRETRY == MessageBox(NULL,"ThemeManager",ssprintf("The theme metric %s-%s is missing. Correct this and click Retry, or Cancel to break.",sClassName.GetString(),sValueName.GetString()), MB_RETRYCANCEL ) ) goto try_metric_again; #endif diff --git a/stepmania/src/TipDisplay.cpp b/stepmania/src/TipDisplay.cpp index 18830d12ac..3ae06651c7 100644 --- a/stepmania/src/TipDisplay.cpp +++ b/stepmania/src/TipDisplay.cpp @@ -14,6 +14,7 @@ #include "RageUtil.h" #include "PrefsManager.h" #include "RageLog.h" +#include "ThemeManager.h" const float TIP_SHOW_TIME = 3.5f; diff --git a/stepmania/src/TransitionBackWipe.cpp b/stepmania/src/TransitionBackWipe.cpp index be763df8b6..ff02bdc173 100644 --- a/stepmania/src/TransitionBackWipe.cpp +++ b/stepmania/src/TransitionBackWipe.cpp @@ -13,6 +13,7 @@ #include "TransitionBackWipe.h" #include "RageUtil.h" #include "PrefsManager.h" +#include "ThemeManager.h" #define RECTANGLE_WIDTH 20 @@ -20,7 +21,6 @@ #define FADE_RECTS_WIDE (NUM_RECTANGLES/4) // number of rects from fade start to fade end - TransitionBackWipe::TransitionBackWipe() { m_soundBack.Load( THEME->GetPathTo("Sounds","menu back") ); diff --git a/stepmania/src/TransitionKeepAlive.cpp b/stepmania/src/TransitionKeepAlive.cpp index cfd2e34012..c456969962 100644 --- a/stepmania/src/TransitionKeepAlive.cpp +++ b/stepmania/src/TransitionKeepAlive.cpp @@ -16,6 +16,7 @@ #include "GameConstantsAndTypes.h" #include "PrefsManager.h" #include "RageMusic.h" +#include "ThemeManager.h" #define STOP_MUSIC_ON_NEXT THEME->GetMetricB("TransitionKeepAlive","StopMusicOnNext") diff --git a/stepmania/src/TransitionOniFade.cpp b/stepmania/src/TransitionOniFade.cpp index cd466c5cd5..164230ba84 100644 --- a/stepmania/src/TransitionOniFade.cpp +++ b/stepmania/src/TransitionOniFade.cpp @@ -16,6 +16,7 @@ #include "GameConstantsAndTypes.h" #include "PrefsManager.h" #include "GameState.h" +#include "ThemeManager.h" #define BANNER_WIDTH THEME->GetMetricF("TransitionOniFade","BannerWidth") diff --git a/stepmania/src/TransitionStarWipe.cpp b/stepmania/src/TransitionStarWipe.cpp index bd7a7abf19..6ae3b7af36 100644 --- a/stepmania/src/TransitionStarWipe.cpp +++ b/stepmania/src/TransitionStarWipe.cpp @@ -14,6 +14,7 @@ #include "TransitionStarWipe.h" #include "GameConstantsAndTypes.h" #include "PrefsManager.h" +#include "ThemeManager.h" TransitionStarWipe::TransitionStarWipe() @@ -70,7 +71,7 @@ void TransitionStarWipe::DrawPrimitives() SCREEN_WIDTH+SCREEN_HEIGHT/2 - x_offset + x_tilt; - m_sprStar.SetRotation( bIsAnEvenRow ? D3DX_PI : 0.0f ); // flip the sprite + m_sprStar.SetRotation( bIsAnEvenRow ? PI : 0.0f ); // flip the sprite m_sprStar.SetXY( bIsAnEvenRow?x-1.0f:x+0.0f, bIsAnEvenRow?y-1.0f:y+0.0f ); // fudge. The rotation makes it off center m_sprStar.Draw(); diff --git a/stepmania/src/loading.bmp b/stepmania/src/loading.bmp index 20d8a7e4e56963647666a1500c958e532f1a8850..34bfbeec419990618248450599404e1a28c5dcac 100644 GIT binary patch literal 29588 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 TJvE{Iu(7Q#=$8!sUn>3^Mo0AT diff --git a/stepmania/src/resource.h b/stepmania/src/resource.h index 001c0138c2..7bb0b337f7 100644 --- a/stepmania/src/resource.h +++ b/stepmania/src/resource.h @@ -1,5 +1,5 @@ //{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. +// Microsoft Developer Studio generated include file. // Used by StepMania.RC // #define IDC_CRASH_SAVE 16 @@ -38,7 +38,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 123 +#define _APS_NEXT_RESOURCE_VALUE 124 #define _APS_NEXT_COMMAND_VALUE 40009 #define _APS_NEXT_CONTROL_VALUE 1013 #define _APS_NEXT_SYMED_VALUE 101