OpenGL checkin. Movie textures, texture stretch, texture dither, and 16 bit textures are broken.

This commit is contained in:
Chris Danford
2002-11-11 04:53:31 +00:00
parent 8f4e1a1675
commit 628dea9da7
116 changed files with 1087 additions and 2612 deletions
+12
View File
@@ -14,6 +14,8 @@
#include <math.h> #include <math.h>
#include "RageDisplay.h" #include "RageDisplay.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "RageUtil.h"
#include "GameConstantsAndTypes.h"
Actor::Actor() Actor::Actor()
@@ -256,6 +258,16 @@ void Actor::BeginTweening( float time, TweenType tt )
{ {
ASSERT( time >= 0 ); ASSERT( time >= 0 );
// HACK to keep from out of bounds access..
if( m_iNumTweenStates == MAX_TWEEN_STATES )
{
for( int i=0; i<m_iNumTweenStates-1; i++ )
{
m_TweenStates[i] = m_TweenStates[i+1];
m_TweenInfo[i] = m_TweenInfo[i+1];
}
}
// add a new TweenState to the tail, and initialize it // add a new TweenState to the tail, and initialize it
m_iNumTweenStates++; m_iNumTweenStates++;
TweenState &TS = m_TweenStates[m_iNumTweenStates-1]; // latest TweenState &TS = m_TweenStates[m_iNumTweenStates-1]; // latest
+1
View File
@@ -18,6 +18,7 @@
#include "RageException.h" #include "RageException.h"
#include "RageTimer.h" #include "RageTimer.h"
#include "NoteDisplay.h" #include "NoteDisplay.h"
#include <math.h>
float ArrowGetYOffset( PlayerNumber pn, float fNoteBeat ) float ArrowGetYOffset( PlayerNumber pn, float fNoteBeat )
+9 -8
View File
@@ -16,6 +16,7 @@
#include "GameState.h" #include "GameState.h"
#include "IniFile.h" #include "IniFile.h"
#include "RageMath.h" #include "RageMath.h"
#include <math.h>
inline float GetOffScreenLeft( Actor* pActor ) { return SCREEN_LEFT - pActor->GetZoomedWidth()/2; } 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].Load( sPath );
m_Sprites[i].SetZoom( randomf(0.2f,2) ); 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; break;
@@ -232,8 +233,8 @@ found_effect:
case EFFECT_TILE_PULSE: case EFFECT_TILE_PULSE:
{ {
m_Sprites[0].Load( sPath ); m_Sprites[0].Load( sPath );
int iNumTilesWide = int(ceil(SCREEN_WIDTH /m_Sprites[0].GetUnzoomedWidth())); int iNumTilesWide = 1+int(SCREEN_WIDTH /m_Sprites[0].GetUnzoomedWidth());
int iNumTilesHigh = int(ceil(SCREEN_HEIGHT/m_Sprites[0].GetUnzoomedHeight())); int iNumTilesHigh = 1+int(SCREEN_HEIGHT/m_Sprites[0].GetUnzoomedHeight());
if( m_Effect == EFFECT_TILE_SCROLL_LEFT || if( m_Effect == EFFECT_TILE_SCROLL_LEFT ||
m_Effect == EFFECT_TILE_SCROLL_RIGHT ) { m_Effect == EFFECT_TILE_SCROLL_RIGHT ) {
iNumTilesWide++; iNumTilesWide++;
@@ -304,8 +305,8 @@ void BGAnimationLayer::Update( float fDeltaTime )
{ {
RageColor color = RageColor( RageColor color = RageColor(
cosf( fSongBeat+i ) * 0.5f + 0.5f, cosf( fSongBeat+i ) * 0.5f + 0.5f,
cosf( fSongBeat+i + D3DX_PI * 2.0f / 3.0f ) * 0.5f + 0.5f, cosf( fSongBeat+i + 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 * 4.0f / 3.0f) * 0.5f + 0.5f,
1.0f 1.0f
); );
m_Sprites[i].SetDiffuse( color ); m_Sprites[i].SetDiffuse( color );
@@ -467,19 +468,19 @@ void BGAnimationLayer::Update( float fDeltaTime )
case EFFECT_TILE_FLIP_X: case EFFECT_TILE_FLIP_X:
for( i=0; i<m_iNumSprites; i++ ) for( i=0; i<m_iNumSprites; i++ )
{ {
m_Sprites[i].SetRotationX( m_Sprites[i].GetRotationX() + fDeltaTime * D3DX_PI ); m_Sprites[i].SetRotationX( m_Sprites[i].GetRotationX() + fDeltaTime * PI );
} }
break; break;
case EFFECT_TILE_FLIP_Y: case EFFECT_TILE_FLIP_Y:
for( i=0; i<m_iNumSprites; i++ ) for( i=0; i<m_iNumSprites; i++ )
{ {
m_Sprites[i].SetRotationY( m_Sprites[i].GetRotationY() + fDeltaTime * D3DX_PI ); m_Sprites[i].SetRotationY( m_Sprites[i].GetRotationY() + fDeltaTime * PI );
} }
break; break;
case EFFECT_TILE_PULSE: case EFFECT_TILE_PULSE:
for( i=0; i<m_iNumSprites; i++ ) for( i=0; i<m_iNumSprites; i++ )
{ {
m_Sprites[i].SetZoom( sinf( fSongBeat*D3DX_PI/2 ) ); m_Sprites[i].SetZoom( sinf( fSongBeat*PI/2 ) );
} }
break; break;
default: default:
+1
View File
@@ -14,6 +14,7 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
#define NORMAL_COLOR_TOP THEME->GetMetricC("BPMDisplay","NormalColorTop") #define NORMAL_COLOR_TOP THEME->GetMetricC("BPMDisplay","NormalColorTop")
+2 -1
View File
@@ -15,6 +15,7 @@
#include "PrefsManager.h" #include "PrefsManager.h"
#include "SongManager.h" #include "SongManager.h"
#include "RageBitmapTexture.h" #include "RageBitmapTexture.h"
#include "ThemeManager.h"
Banner::Banner() Banner::Banner()
{ {
@@ -39,7 +40,7 @@ void Banner::Update( float fDeltaTime )
m_fPercentScrolling += fDeltaTime/2; m_fPercentScrolling += fDeltaTime/2;
m_fPercentScrolling -= (int)m_fPercentScrolling; m_fPercentScrolling -= (int)m_fPercentScrolling;
RectF *pTextureRect = m_pTexture->GetTextureCoordRect(0); const RectF *pTextureRect = m_pTexture->GetTextureCoordRect(0);
float fTexCoords[8] = float fTexCoords[8] =
{ {
+1
View File
@@ -15,6 +15,7 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "RageLog.h" #include "RageLog.h"
#include "ThemeManager.h"
+20 -21
View File
@@ -16,7 +16,10 @@
#include "RageLog.h" #include "RageLog.h"
#include "RageException.h" #include "RageException.h"
#include "RageTimer.h" #include "RageTimer.h"
#include "RageDisplay.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ThemeManager.h"
#include "GameConstantsAndTypes.h"
#define RAINBOW_COLOR_1 THEME->GetMetricC("BitmapText","RainbowColor1") #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 // draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale
void BitmapText::DrawPrimitives() void BitmapText::DrawPrimitives()
{ {
// offset so that pixels are aligned to texels // Offset so that pixels are aligned to texels
if( PREFSMAN->m_iDisplayResolution == 320 ) // Offset by -0.5, -0.5 if 640x480
DISPLAY->TranslateLocal( -1, -1, 0 ); // Offset by -1.0, -1.0 if 320x240
else DISPLAY->TranslateLocal(
DISPLAY->TranslateLocal( -0.5f, -0.5f, 0 ); -0.5f*SCREEN_WIDTH/(float)PREFSMAN->m_iDisplayWidth,
-0.5f*SCREEN_HEIGHT/(float)PREFSMAN->m_iDisplayHeight,
0 );
if( m_iNumLines == 0 ) if( m_iNumLines == 0 )
return; return;
@@ -251,9 +256,9 @@ void BitmapText::DrawPrimitives()
// set vertex positions // set vertex positions
// //
v[iNumV++].p = RageVector3( (float)iX-iDrawExtraPixelsLeft, iY-iHeight/2.0f, 0 ); // top left 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, 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 ); // bottom right
v[iNumV++].p = RageVector3( (float)iX-iDrawExtraPixelsLeft+iCharWidth+iDrawExtraPixelsRight, iY-iHeight/2.0f, 0 ); // top right
iX += iCharWidth; iX += iCharWidth;
@@ -275,9 +280,9 @@ void BitmapText::DrawPrimitives()
const float fExtraTexCoordsRight = iDrawExtraPixelsRight / (float)pTexture->GetSourceWidth(); const float fExtraTexCoordsRight = iDrawExtraPixelsRight / (float)pTexture->GetSourceWidth();
v[iNumV++].t = RageVector2( frectTexCoords.left - fExtraTexCoordsLeft, frectTexCoords.top ); // top left 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.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.bottom ); // bottom right
v[iNumV++].t = RageVector2( frectTexCoords.right + fExtraTexCoordsRight, frectTexCoords.top ); // top right
} }
iY += iLineSpacing; iY += iLineSpacing;
@@ -285,10 +290,7 @@ void BitmapText::DrawPrimitives()
DISPLAY->SetTexture( pTexture ); DISPLAY->SetTexture( pTexture );
DISPLAY->SetTextureModeModulate();
DISPLAY->SetColorTextureMultDiffuse();
DISPLAY->SetAlphaTextureMultDiffuse();
if( m_bBlendAdd ) if( m_bBlendAdd )
DISPLAY->SetBlendModeAdd(); DISPLAY->SetBlendModeAdd();
else else
@@ -310,8 +312,7 @@ void BitmapText::DrawPrimitives()
int i; int i;
for( i=0; i<iNumV; i++ ) for( i=0; i<iNumV; i++ )
v[i].c = dwColor; v[i].c = dwColor;
for( i=0; i<iNumV; i+=4 ) DISPLAY->DrawQuads( v, iNumV );
DISPLAY->AddQuad( &v[i] );
DISPLAY->PopMatrix(); DISPLAY->PopMatrix();
} }
@@ -336,14 +337,13 @@ void BitmapText::DrawPrimitives()
for( int i=0; i<iNumV; i+=4 ) for( int i=0; i<iNumV; i+=4 )
{ {
v[i+0].c = m_temp.diffuse[0]; // top left v[i+0].c = m_temp.diffuse[0]; // top left
v[i+1].c = m_temp.diffuse[1]; // top right v[i+1].c = m_temp.diffuse[2]; // bottom left
v[i+2].c = m_temp.diffuse[2]; // bottom left v[i+2].c = m_temp.diffuse[3]; // bottom right
v[i+3].c = m_temp.diffuse[3]; // bottom right v[i+3].c = m_temp.diffuse[1]; // top right
} }
} }
for( int i=0; i<iNumV; i+=4 ) DISPLAY->DrawQuads( v, iNumV );
DISPLAY->AddQuad( &v[i] );
} }
////////////////////// //////////////////////
@@ -351,13 +351,12 @@ void BitmapText::DrawPrimitives()
////////////////////// //////////////////////
if( m_temp.glow.a != 0 ) if( m_temp.glow.a != 0 )
{ {
DISPLAY->SetColorDiffuse(); DISPLAY->SetTextureModeGlow();
int i; int i;
for( i=0; i<iNumV; i++ ) for( i=0; i<iNumV; i++ )
v[i].c = m_temp.glow; v[i].c = m_temp.glow;
for( i=0; i<iNumV; i+=4 ) DISPLAY->DrawQuads( v, iNumV );
DISPLAY->AddQuad( &v[i] );
} }
} }
+1 -1
View File
@@ -16,7 +16,7 @@
const int MAX_TEXT_LINES = 40; const int MAX_TEXT_LINES = 40;
const int MAX_TEXT_CHARS = MAX_NUM_QUADS; const int MAX_TEXT_CHARS = 2000;
class BitmapText : public Actor class BitmapText : public Actor
{ {
+1
View File
@@ -15,6 +15,7 @@
#include "ScreenManager.h" #include "ScreenManager.h"
#include "ScreenGameplay.h" #include "ScreenGameplay.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
void Combo::Reset() void Combo::Reset()
+1
View File
@@ -21,6 +21,7 @@
#include "MsdFile.h" #include "MsdFile.h"
#include "PlayerOptions.h" #include "PlayerOptions.h"
#include "SongOptions.h" #include "SongOptions.h"
#include "RageUtil.h"
void Course::LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs ) void Course::LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs )
+4
View File
@@ -18,6 +18,10 @@
#include "PrefsManager.h" #include "PrefsManager.h"
#include "Course.h" #include "Course.h"
#include "SongManager.h" #include "SongManager.h"
#include <math.h>
#include "RageDisplay.h"
#include "ThemeManager.h"
#include "Notes.h"
const float TEXT_BANNER_X = 0; const float TEXT_BANNER_X = 0;
+2
View File
@@ -14,6 +14,8 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ThemeManager.h"
#include "Notes.h"
const int NUM_FEET_IN_METER = 10; const int NUM_FEET_IN_METER = 10;
+3
View File
@@ -27,6 +27,9 @@
#define CENTER_X (SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT)/2.0f) #define CENTER_X (SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT)/2.0f)
#define CENTER_Y (SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP)/2.0f) #define CENTER_Y (SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP)/2.0f)
#define SCREEN_NEAR (-1000)
#define SCREEN_FAR (1000)
///////////////////////// /////////////////////////
// Note definitions // Note definitions
///////////////////////// /////////////////////////
+3 -6
View File
@@ -15,12 +15,9 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "GameState.h" #include "GameState.h"
#include "GameInput.h" // for GameButton constants #include "GameInput.h" // for GameButton constants
#ifndef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION 0x0800
#endif
#include <dinput.h> // for DIK_* key codes
#include "IniFile.h" #include "IniFile.h"
#include "RageLog.h" #include "RageLog.h"
#include "RageUtil.h"
GameManager* GAMEMAN = NULL; // global and accessable from anywhere in our program GameManager* GAMEMAN = NULL; // global and accessable from anywhere in our program
@@ -1193,11 +1190,11 @@ void GameManager::GetGameplayStylesForGame( Game game, CArray<Style,Style>& aSty
} }
} }
void GameManager::GetModesChoicesForGame( Game game, CArray<ModeChoice,ModeChoice>& aChoicesAddTo ) void GameManager::GetModesChoicesForGame( Game game, CArray<ModeChoice*,ModeChoice*>& apChoicesAddTo )
{ {
for( int s=0; s<NUM_MODE_CHOICES; s++ ) for( int s=0; s<NUM_MODE_CHOICES; s++ )
if( g_ModeChoices[s].game == game) if( g_ModeChoices[s].game == game)
aChoicesAddTo.push_back( g_ModeChoices[s] ); apChoicesAddTo.push_back( &g_ModeChoices[s] );
} }
void GameManager::GetNotesTypesForGame( Game game, CArray<NotesType,NotesType>& aNotesTypeAddTo ) void GameManager::GetNotesTypesForGame( Game game, CArray<NotesType,NotesType>& aNotesTypeAddTo )
+2 -12
View File
@@ -14,20 +14,10 @@
#include "StyleDef.h" #include "StyleDef.h"
#include "Style.h" #include "Style.h"
#include "Game.h" #include "Game.h"
#include "ModeChoice.h"
class IniFile; class IniFile;
struct ModeChoice // used in SelectMode
{
Game game;
PlayMode pm;
Style style;
Difficulty dc;
char name[64];
int numSidesJoinedToPlay;
};
class GameManager class GameManager
{ {
public: public:
@@ -38,7 +28,7 @@ public:
const StyleDef* GetStyleDefForStyle( Style s ); const StyleDef* GetStyleDefForStyle( Style s );
void GetGameplayStylesForGame( Game game, CArray<Style,Style>& aStylesAddTo, bool editor=false ); void GetGameplayStylesForGame( Game game, CArray<Style,Style>& aStylesAddTo, bool editor=false );
void GetModesChoicesForGame( Game game, CArray<ModeChoice,ModeChoice>& aChoicesAddTo ); void GetModesChoicesForGame( Game game, CArray<ModeChoice*,ModeChoice*>& apChoicesAddTo );
void GetNotesTypesForGame( Game game, CArray<NotesType,NotesType>& aNotesTypeAddTo ); // only look at edit-specific styles void GetNotesTypesForGame( Game game, CArray<NotesType,NotesType>& aNotesTypeAddTo ); // only look at edit-specific styles
// void GetGameNames( CStringArray &AddTo ); // void GetGameNames( CStringArray &AddTo );
+1
View File
@@ -17,6 +17,7 @@
#include "InputMapper.h" #include "InputMapper.h"
#include "Song.h" #include "Song.h"
#include "RageLog.h" #include "RageLog.h"
#include "ThemeManager.h"
GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program
+1
View File
@@ -13,6 +13,7 @@
#include "GhostArrow.h" #include "GhostArrow.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ThemeManager.h"
#define SHOW_SECONDS THEME->GetMetricF("GhostArrow","ShowSeconds") #define SHOW_SECONDS THEME->GetMetricF("GhostArrow","ShowSeconds")
+1
View File
@@ -13,6 +13,7 @@
#include "GhostArrowBright.h" #include "GhostArrowBright.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ThemeManager.h"
#define SHOW_SECONDS THEME->GetMetricF("GhostArrowBright","ShowSeconds") #define SHOW_SECONDS THEME->GetMetricF("GhostArrowBright","ShowSeconds")
+1
View File
@@ -14,6 +14,7 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ThemeManager.h"
const float SCROLL_TIME = 5.0f; const float SCROLL_TIME = 5.0f;
+1 -2
View File
@@ -10,11 +10,10 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "Sprite.h" #include "Sprite.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "Grade.h" #include "Grade.h"
#include "GameConstantsAndTypes.h"
class GradeDisplay : public Sprite class GradeDisplay : public Sprite
+2
View File
@@ -14,6 +14,8 @@
#include "GrayArrow.h" #include "GrayArrow.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "GameState.h" #include "GameState.h"
#include <math.h>
#include "ThemeManager.h"
#define STEP_SECONDS THEME->GetMetricF("GrayArrow","StepSeconds") #define STEP_SECONDS THEME->GetMetricF("GrayArrow","StepSeconds")
+5 -6
View File
@@ -16,8 +16,8 @@
#include "PrefsManager.h" #include "PrefsManager.h"
#include "RageBitmapTexture.h" #include "RageBitmapTexture.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "ThemeManager.h"
#include "Notes.h"
#define LABEL_OFFSET_X( i ) THEME->GetMetricF("GrooveRadar",ssprintf("Label%dOffsetX",i+1)) #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; const float fRadius = m_sprRadarBase.GetZoomedHeight()/2.0f*1.1f;
DISPLAY->SetTexture( NULL ); DISPLAY->SetTexture( NULL );
DISPLAY->SetColorTextureMultDiffuse(); DISPLAY->SetTextureModeModulate();
DISPLAY->SetAlphaTextureMultDiffuse();
RageVertex v[12]; // needed to draw 5 fan primitives and 10 strip primitives RageVertex v[12]; // needed to draw 5 fan primitives and 10 strip primitives
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
@@ -172,7 +171,7 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives()
v[1+i].c = v[0].c; v[1+i].c = v[0].c;
} }
DISPLAY->AddFan( v, 5 ); DISPLAY->DrawFan( v, 7 );
// //
@@ -197,7 +196,7 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives()
v[i*2+1].c = v[i*2+0].c; v[i*2+1].c = v[i*2+0].c;
} }
DISPLAY->AddStrip( v, 10 ); DISPLAY->DrawStrip( v, 12 );
} }
} }
+1
View File
@@ -15,6 +15,7 @@
#include "PrefsManager.h" #include "PrefsManager.h"
#include "RageException.h" #include "RageException.h"
#include "RageTimer.h" #include "RageTimer.h"
#include <math.h>
const float HOLD_GHOST_ARROW_TWEEN_TIME = 0.5f; const float HOLD_GHOST_ARROW_TWEEN_TIME = 0.5f;
+1
View File
@@ -14,6 +14,7 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ThemeManager.h"
// //
+1
View File
@@ -15,6 +15,7 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
const float JUDGEMENT_DISPLAY_TIME = 0.8f; const float JUDGEMENT_DISPLAY_TIME = 0.8f;
+4 -1
View File
@@ -15,6 +15,9 @@
#include "RageException.h" #include "RageException.h"
#include "RageTimer.h" #include "RageTimer.h"
#include "GameState.h" #include "GameState.h"
#include "RageDisplay.h"
#include <math.h>
#include "ThemeManager.h"
// //
@@ -412,7 +415,7 @@ void LifeMeterBar::DrawPrimitives()
m_pStream->m_fPercent = m_fTrailingLifePercentage; m_pStream->m_fPercent = m_fTrailingLifePercentage;
m_pStream->m_fHotAlpha = m_fHotAlpha; m_pStream->m_fHotAlpha = m_fHotAlpha;
float fPercentRed = (m_fTrailingLifePercentage<g_fDangerThreshold) ? sinf( TIMER->GetTimeSinceStart()*D3DX_PI*4 )/2+0.5f : 0; float fPercentRed = (m_fTrailingLifePercentage<g_fDangerThreshold) ? sinf( TIMER->GetTimeSinceStart()*PI*4 )/2+0.5f : 0;
m_quadBlackBackground.SetDiffuse( RageColor(fPercentRed*0.8f,0,0,1) ); m_quadBlackBackground.SetDiffuse( RageColor(fPercentRed*0.8f,0,0,1) );
ActorFrame::DrawPrimitives(); ActorFrame::DrawPrimitives();
+2
View File
@@ -13,6 +13,8 @@
#include "LifeMeterBattery.h" #include "LifeMeterBattery.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
#include "Notes.h"
const float BATTERY_X[NUM_PLAYERS] = { -92, +92 }; const float BATTERY_X[NUM_PLAYERS] = { -92, +92 };
+1
View File
@@ -21,6 +21,7 @@
#include "RageLog.h" #include "RageLog.h"
#include "GameManager.h" #include "GameManager.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
#define TOP_EDGE_X THEME->GetMetricF("MenuElements","TopEdgeX") #define TOP_EDGE_X THEME->GetMetricF("MenuElements","TopEdgeX")
+1
View File
@@ -16,6 +16,7 @@
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "AnnouncerManager.h" #include "AnnouncerManager.h"
#include "ThemeManager.h"
const float TIMER_SECONDS = 99; const float TIMER_SECONDS = 99;
+24
View File
@@ -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;
};
+1
View File
@@ -15,6 +15,7 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "MusicWheel.h" #include "MusicWheel.h"
#include "MusicSortDisplay.h" #include "MusicSortDisplay.h"
#include "ThemeManager.h"
MusicSortDisplay::MusicSortDisplay() MusicSortDisplay::MusicSortDisplay()
+2 -1
View File
@@ -16,7 +16,8 @@
#include "MusicWheel.h" #include "MusicWheel.h"
#include "MusicStatusDisplay.h" #include "MusicStatusDisplay.h"
#include "RageTimer.h" #include "RageTimer.h"
#include <math.h>
#include "ThemeManager.h"
MusicStatusDisplay::MusicStatusDisplay() MusicStatusDisplay::MusicStatusDisplay()
+2
View File
@@ -20,6 +20,8 @@
#include "RageLog.h" #include "RageLog.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "GameState.h" #include "GameState.h"
#include <math.h>
#include "ThemeManager.h"
// WheelItem stuff // WheelItem stuff
+27 -25
View File
@@ -21,6 +21,8 @@
#include "RageException.h" #include "RageException.h"
#include "ArrowEffects.h" #include "ArrowEffects.h"
#include "RageLog.h" #include "RageLog.h"
#include <math.h>
#include "RageDisplay.h"
bool g_bDrawHoldHeadForTapsOnSameRow, g_bDrawTapOnTopOfHoldHead, g_bDrawTapOnTopOfHoldTail; // cache 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 const int fYStep = 8; // draw a segment every 8 pixels // this requires that the texture dimensions be a multiple of 8
DISPLAY->SetBlendModeNormal(); // DISPLAY->SetBlendModeNormal();
if( bDrawGlowOnly ) // if( bDrawGlowOnly )
DISPLAY->SetColorDiffuse(); // DISPLAY->SetColorDiffuse();
else // else
DISPLAY->SetColorTextureMultDiffuse(); // DISPLAY->SetColorTextureMultDiffuse();
DISPLAY->SetAlphaTextureMultDiffuse(); // DISPLAY->SetAlphaTextureMultDiffuse();
DISPLAY->EnableTextureWrapping(); // DISPLAY->EnableTextureWrapping();
DISPLAY->SetTexture( m_sprHoldParts.GetTexture() ); // DISPLAY->SetTexture( m_sprHoldParts.GetTexture() );
// //
// Draw the tail // 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 ) if( !bDrawGlowOnly && colorDiffuseTop.a==0 && colorDiffuseBottom.a==0 )
continue; continue;
DISPLAY->AddQuad( static RageVertex v[4];
RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordLeft, fTexCoordTop), // colorGlowTop, // top-left v[0].p = RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0); v[0].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[0].t = RageVector2(fTexCoordLeft, fTexCoordTop),
RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordRight, fTexCoordTop), // colorGlowTop, // top-right v[1].p = RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0); v[1].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[1].t = RageVector2(fTexCoordRight, fTexCoordTop);
RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordLeft, fTexCoordBottom),// colorGlowBottom, // bottom-left v[2].p = RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0); v[2].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordLeft, fTexCoordBottom);
RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordRight, fTexCoordBottom) );//, colorGlowBottom ); // bottom-right 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 ) if( !bDrawGlowOnly && colorDiffuseTop.a==0 && colorDiffuseBottom.a==0 )
continue; continue;
DISPLAY->AddQuad( static RageVertex v[4];
RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordLeft, fTexCoordTop), //colorGlowTop, // top-left v[0].p = RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0); v[0].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[2].t = RageVector2(fTexCoordLeft, fTexCoordTop);
RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordRight, fTexCoordTop), //colorGlowTop, // top-right v[1].p = RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0); v[1].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[2].t = RageVector2(fTexCoordRight, fTexCoordTop);
RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordLeft, fTexCoordBottom), //colorGlowBottom, // bottom-left v[2].p = RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0); v[2].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordLeft, fTexCoordBottom);
RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordRight, fTexCoordBottom) );//, colorGlowBottom ); // bottom-right 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 ) 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 ) if( !bDrawGlowOnly && colorDiffuseTop.a==0 && colorDiffuseBottom.a==0 )
continue; continue;
DISPLAY->AddQuad( static RageVertex v[4];
RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordLeft, fTexCoordTop), // colorGlowTop, // top-left v[0].p = RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0); v[0].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[2].t = RageVector2(fTexCoordLeft, fTexCoordTop);
RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordRight, fTexCoordTop), // colorGlowTop, // top-right v[0].p = RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0); v[0].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[2].t = RageVector2(fTexCoordRight, fTexCoordTop);
RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordLeft, fTexCoordBottom),// colorGlowBottom, // bottom-left v[0].p = RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0); v[0].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordLeft, fTexCoordBottom);
RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordRight, fTexCoordBottom) );//, colorGlowBottom ); // bottom-right 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 else
{ {
+2
View File
@@ -21,6 +21,8 @@
#include "RageException.h" #include "RageException.h"
#include "RageTimer.h" #include "RageTimer.h"
#include "RageLog.h" #include "RageLog.h"
#include <math.h>
#include "ThemeManager.h"
const float HOLD_NOTE_BITS_PER_BEAT = 6; const float HOLD_NOTE_BITS_PER_BEAT = 6;
+27 -22
View File
@@ -24,6 +24,8 @@
#include "ScoreKeeperMAX2.h" #include "ScoreKeeperMAX2.h"
#include "RageLog.h" #include "RageLog.h"
#include "RageMath.h" #include "RageMath.h"
#include "RageDisplay.h"
#include "ThemeManager.h"
#include "Combo.h" #include "Combo.h"
#define JUDGE_PERFECT_ZOOM_X THEME->GetMetricF("Player","JudgePerfectZoomX") #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] ) if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_bEffects[PlayerOptions::EFFECT_SPACE] )
{ {
// save old view and projection // save old view and projection
DISPLAY->GetViewTransform( &matOldView );
DISPLAY->GetProjectionTransform( &matOldProj );
// construct view and project matrix // TODO: Re-add this code
RageMatrix matNewView; // DISPLAY->GetViewTransform( &matOldView );
RageVector3 Eye, At, Up( 0.0f, -1.0f, 0.0f ); // DISPLAY->GetProjectionTransform( &matOldProj );
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_bReverseScroll ) { //
Eye = RageVector3( CENTER_X, GetY()-300.0f, 400.0f ); // // construct view and project matrix
At = RageVector3( CENTER_X, GetY()+100.0f, 0.0f ); // RageMatrix matNewView;
} else { // RageVector3 Eye, At, Up( 0.0f, -1.0f, 0.0f );
Eye = RageVector3( CENTER_X, GetY()+800.0f, 400.0f ); // if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_bReverseScroll ) {
At = RageVector3( CENTER_X, GetY()+400.0f, 0.0f ); // Eye = RageVector3( CENTER_X, GetY()-300.0f, 400.0f );
} // At = RageVector3( CENTER_X, GetY()+100.0f, 0.0f );
RageMatrixLookAtLH( &matNewView, &Eye, &At, &Up ); // } else {
// Eye = RageVector3( CENTER_X, GetY()+800.0f, 400.0f );
DISPLAY->SetViewTransform( &matNewView ); // At = RageVector3( CENTER_X, GetY()+400.0f, 0.0f );
// }
RageMatrix matNewProj; // RageMatrixLookAtLH( &matNewView, &Eye, &At, &Up );
RageMatrixPerspectiveFovLH( &matNewProj, D3DX_PI/4.0f, SCREEN_WIDTH/(float)SCREEN_HEIGHT, 0.0f, 1000.0f ); //
DISPLAY->SetProjectionTransform( &matNewProj ); // 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(); m_GrayArrowRow.Draw();
@@ -326,9 +330,10 @@ void Player::DrawPrimitives()
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_bEffects[PlayerOptions::EFFECT_SPACE] ) if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_bEffects[PlayerOptions::EFFECT_SPACE] )
{ {
// restire old view and projection // TODO: Re-add this code
DISPLAY->SetViewTransform( &matOldView ); // // restire old view and projection
DISPLAY->SetProjectionTransform( &matOldProj ); // DISPLAY->SetViewTransform( &matOldView );
// DISPLAY->SetProjectionTransform( &matOldProj );
} }
m_frameJudgement.Draw(); m_frameJudgement.Draw();
+18 -24
View File
@@ -16,6 +16,9 @@
#include "GameState.h" #include "GameState.h"
#include "RageException.h" #include "RageException.h"
#include "RageDisplay.h" #include "RageDisplay.h"
#include "RageUtil.h"
#include "AnnouncerManager.h"
#include "ThemeManager.h"
PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program
@@ -28,9 +31,11 @@ PrefsManager::PrefsManager()
#else #else
m_bWindowed = false; m_bWindowed = false;
#endif #endif
m_iDisplayResolution = 640; m_iDisplayWidth = 640;
m_iTextureResolution = 1024; m_iDisplayHeight = 480;
m_iRefreshRate = RageDisplay::REFRESH_DEFAULT; m_iDisplayColorDepth = 16;
m_iTextureColorDepth = 16;
m_iRefreshRateMode = REFRESH_DEFAULT;
m_bIgnoreJoyAxes = true; m_bIgnoreJoyAxes = true;
m_bOnlyDedicatedMenuButtons = false; m_bOnlyDedicatedMenuButtons = false;
#ifdef _DEBUG #ifdef _DEBUG
@@ -80,9 +85,11 @@ PrefsManager::~PrefsManager()
return; // could not read config file, load nothing return; // could not read config file, load nothing
ini.GetValueB( "Options", "Windowed", m_bWindowed ); ini.GetValueB( "Options", "Windowed", m_bWindowed );
ini.GetValueI( "Options", "DisplayResolution", m_iDisplayResolution ); ini.GetValueI( "Options", "DisplayWidth", m_iDisplayWidth );
ini.GetValueI( "Options", "TextureResolution", m_iTextureResolution ); ini.GetValueI( "Options", "DisplayHeight", m_iDisplayHeight );
ini.GetValueI( "Options", "RefreshRate", m_iRefreshRate ); 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", "IgnoreJoyAxes", m_bIgnoreJoyAxes );
ini.GetValueB( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons ); ini.GetValueB( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons );
ini.GetValueB( "Options", "ShowStats", m_bShowStats ); ini.GetValueB( "Options", "ShowStats", m_bShowStats );
@@ -129,9 +136,11 @@ void PrefsManager::SaveGlobalPrefsToDisk()
ini.SetPath( "StepMania.ini" ); ini.SetPath( "StepMania.ini" );
ini.SetValueB( "Options", "Windowed", m_bWindowed ); ini.SetValueB( "Options", "Windowed", m_bWindowed );
ini.SetValueI( "Options", "DisplayResolution", m_iDisplayResolution ); ini.SetValueI( "Options", "DisplayWidth", m_iDisplayWidth );
ini.SetValueI( "Options", "TextureResolution", m_iTextureResolution ); ini.SetValueI( "Options", "DisplayHeight", m_iDisplayHeight );
ini.SetValueI( "Options", "RefreshRate", m_iRefreshRate ); 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", "IgnoreJoyAxes", m_bIgnoreJoyAxes );
ini.SetValueB( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons ); ini.SetValueB( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons );
ini.SetValueB( "Options", "ShowStats", m_bShowStats ); ini.SetValueB( "Options", "ShowStats", m_bShowStats );
@@ -204,18 +213,3 @@ void PrefsManager::SaveGamePrefsToDisk()
ini.WriteFile(); 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 );
}
}
+5 -12
View File
@@ -10,13 +10,6 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "GameConstantsAndTypes.h"
#include "AnnouncerManager.h"
#include "ThemeManager.h"
#include "GameManager.h"
class PrefsManager class PrefsManager
{ {
@@ -28,9 +21,11 @@ public:
// GameOptions (ARE saved between sessions) // GameOptions (ARE saved between sessions)
bool m_bWindowed; bool m_bWindowed;
int m_iDisplayResolution; int m_iDisplayWidth;
int m_iTextureResolution; int m_iDisplayHeight;
int m_iRefreshRate; // 0 means 'default' int m_iDisplayColorDepth;
int m_iTextureColorDepth;
int m_iRefreshRateMode;
bool m_bShowStats; bool m_bShowStats;
BackgroundMode m_BackgroundMode; BackgroundMode m_BackgroundMode;
float m_fBGBrightness; float m_fBGBrightness;
@@ -60,8 +55,6 @@ public:
CStringArray m_asAdditionalSongFolders; CStringArray m_asAdditionalSongFolders;
CString m_DWIPath; CString m_DWIPath;
int GetDisplayHeight();
void ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame ); void ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame );
void SaveGlobalPrefsToDisk(); void SaveGlobalPrefsToDisk();
+6 -6
View File
@@ -10,14 +10,14 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "Actor.h" #include "Sprite.h"
class Quad : public Actor class Quad : public Sprite
{ {
public: public:
Quad(); Quad()
{
virtual void DrawPrimitives(); m_bDrawIfTextureNull = true;
}
}; };
+35 -381
View File
@@ -15,6 +15,7 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "RageLog.h" #include "RageLog.h"
#include "RageException.h" #include "RageException.h"
#include "RageTextureManager.h"
#include "SDL.h" #include "SDL.h"
#include "SDL_image.h" #include "SDL_image.h"
@@ -22,183 +23,43 @@
#include "SDL_rotozoom.h" #include "SDL_rotozoom.h"
#include "SDL_utils.h" #include "SDL_utils.h"
#include "SDL_dither.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 constructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
RageBitmapTexture::RageBitmapTexture( RageBitmapTexture::RageBitmapTexture( const CString &sFilePath ) : RageTexture( sFilePath )
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 )
{ {
// LOG->Trace( "RageBitmapTexture::RageBitmapTexture()" ); // LOG->Trace( "RageBitmapTexture::RageBitmapTexture()" );
m_pd3dTexture = NULL; Load( sFilePath );
//if( !LoadFromCacheFile() )
Create( dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch );
//SaveToCache();
CreateFrameRects();
} }
RageBitmapTexture::~RageBitmapTexture() RageBitmapTexture::~RageBitmapTexture()
{ {
SAFE_RELEASE(m_pd3dTexture); glDeleteTextures(1, &m_uGLTextureID);
} }
void RageBitmapTexture::Reload( int power_of_two(int input)
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 value = 1; int value = 1;
while ( value < input ) value <<= 1; while ( value < input ) value <<= 1;
return value; return value;
} }
/* void RageBitmapTexture::Load( const CString &sFilePath )
* 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
)
{ {
HRESULT hr; m_sFilePath = sFilePath; // save file path
// look in the file name for a format hints int iMaxSize = DISPLAY->GetMaxTextureSize();
m_sFilePath.MakeLower();
if( m_sFilePath.Find("no alpha") != -1 ) iAlphaBits = 0; SDL_Surface *img;
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;
/* Load the image into an SDL surface. */ /* Load the image into an SDL surface. */
SDL_Surface *img = IMG_Load(m_sFilePath); img = IMG_Load(sFilePath);
if(!img)
/* Figure out which texture format to use. */ throw RageException("Could not load graphic '%s'", sFilePath.GetString());
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) );
/* Save information about the source. Unless something else changes this /* Save information about the source. Unless something else changes this
* later, the image inside the texture is the same size as the source. */ * 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_iTextureWidth = power_of_two(img->w);
m_iTextureHeight = power_of_two(img->h); 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 data to the destination format. Hmm. We could just
* convert the format, leaving the resolution alone (simplifying * 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 * We don't want anything else to be linearly filtered in on the
* edge of the texture ... * edge of the texture ...
*/ */
ConvertSDLSurface(img, m_iTextureWidth, m_iTextureHeight, PixFmtMasks[target][4], ConvertSDLSurface(img, m_iTextureWidth, m_iTextureHeight, 32,
PixFmtMasks[target][0], PixFmtMasks[target][1], PixFmtMasks[target][2], PixFmtMasks[target][3]); 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 ); glGenTextures(1, &m_uGLTextureID);
ASSERT( !FAILED( m_pd3dTexture->UnlockRect(0) ) ) ; 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); 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, CreateFrameRects();
m_iImageWidth, m_iImageHeight);
} }
#else void RageBitmapTexture::Reload()
#include "DXUtil.h"
#include "dxerr8.h"
void RageBitmapTexture::Create(
int dwMaxSize,
int dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch
)
{ {
HRESULT hr; glDeleteTextures(1, &m_uGLTextureID);
// look in the file name for a format hints Load( m_sFilePath );
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
);
} }
#endif unsigned int RageBitmapTexture::GetGLTextureID()
{
return m_uGLTextureID;
}
+6 -30
View File
@@ -22,39 +22,15 @@
class RageBitmapTexture : public RageTexture class RageBitmapTexture : public RageTexture
{ {
public: public:
RageBitmapTexture( RageBitmapTexture( const CString &sFilePath );
RageDisplay* pScreen,
const CString &sFilePath,
int dwMaxSize = 2048,
int dwTextureColorDepth = 16,
int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
);
virtual ~RageBitmapTexture(); 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: protected:
virtual void Load( const CString &sFilePath );
virtual void Reload();
virtual void Create( virtual unsigned int GetGLTextureID();
int dwMaxSize,
int dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch
);
unsigned int m_uGLTextureID;
LPDIRECT3DTEXTURE8 m_pd3dTexture; CString m_sFilePath;
}; };
File diff suppressed because it is too large Load Diff
+27 -101
View File
@@ -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; class RageTexture;
struct RageMatrix;
struct RageVertex;
#include "RageTypes.h" #include "RageTypes.h"
enum RefreshRateMode { REFRESH_DEFAULT, REFRESH_MAX, REFRESH_MIN };
class RageDisplay class RageDisplay
{ {
friend class RageTexture; friend class RageTexture;
public: public:
RageDisplay( HWND hWnd ); RageDisplay( bool windowed, int width, int height, int bpp, RefreshRateMode rate, bool vsync );
~RageDisplay(); ~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; }; void SetVideoMode( bool windowed, int width, int height, int bpp, RefreshRateMode rate, bool vsync );
// inline LPDIRECT3DDEVICE8 GetDevice() { return m_pd3dDevice; };
const D3DCAPS8& GetDeviceCaps() const { return m_DeviceCaps; };
HRESULT Reset(); void Clear();
HRESULT BeginFrame(); void Flip();
HRESULT EndFrame(); bool IsWindowed() const;
HRESULT ShowFrame(); int GetWidth() const;
int GetHeight() const;
int GetBPP() const;
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 ); }
// LPDIRECT3DVERTEXBUFFER8 GetVertexBuffer() { return m_pVB; };
void SetViewTransform( const RageMatrix* pMatrix ); void SetViewTransform( const RageMatrix* pMatrix );
void SetProjectionTransform( const RageMatrix* pMatrix ); void SetProjectionTransform( const RageMatrix* pMatrix );
void GetViewTransform( RageMatrix* pMatrixOut ); void GetViewTransform( RageMatrix* pMatrixOut );
@@ -68,85 +51,28 @@ public:
void RotateX( float r ); void RotateX( float r );
void RotateY( float r ); void RotateY( float r );
void RotateZ( 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<int,int> &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<RageMatrix, RageMatrix&> 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 SetTexture( RageTexture* pTexture );
void SetColorTextureMultDiffuse(); void SetTextureModeModulate();
void SetColorDiffuse(); void SetTextureModeGlow();
void SetAlphaTextureMultDiffuse();
void SetBlendModeNormal(); void SetBlendModeNormal();
void SetBlendModeAdd(); void SetBlendModeAdd();
void EnableZBuffer(); void EnableZBuffer();
void DisableZBuffer(); void DisableZBuffer();
void EnableTextureWrapping(); void EnableTextureWrapping();
void DisableTextureWrapping(); 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<int,int> &add) const;
int GetMaxTextureSize() const;
protected:
void AddVerts( const RageVertex v[], int iNumVerts );
}; };
+8 -7
View File
@@ -25,19 +25,20 @@ protected:
CString m_sError; CString m_sError;
}; };
#include "crash.h" //#include "crash.h"
/* Assertion that sets an optional message and brings up the crash handler, so /* 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 * 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 * exception in most cases we expect never to happen (but not in cases that
* we do expect, such as d3d init failure.) */ * 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_M(COND, MESSAGE) { if(!(COND)) { VDCHECKPOINT_M(MESSAGE); *(char*)0=0; } }
#define RAGE_ASSERT(COND) RAGE_ASSERT_M((COND), "Assertion failure") //#define RAGE_ASSERT(COND) RAGE_ASSERT_M((COND), "Assertion failure")
/* Make this the default assert handler. */ /* Make this the default assert handler. */
#ifdef ASSERT //#ifdef ASSERT
#undef ASSERT //#undef ASSERT
#endif //#endif
#define ASSERT RAGE_ASSERT //#define ASSERT RAGE_ASSERT
#endif #endif
+1
View File
@@ -948,3 +948,4 @@ int RageInput::pump_t::GetPadEvent()
return buf; return buf;
} }
+1
View File
@@ -159,3 +159,4 @@ namespace USB {
}; };
extern RageInput* INPUTMAN; // global and accessable from anywhere in our program extern RageInput* INPUTMAN; // global and accessable from anywhere in our program
+2 -2
View File
@@ -14,7 +14,7 @@
#include "RageUtil.h" #include "RageUtil.h"
#include <fstream> #include <fstream>
#include "crash.h" //#include "crash.h"
#include "dxerr8.h" #include "dxerr8.h"
#pragma comment(lib, "DxErr8.lib") #pragma comment(lib, "DxErr8.lib")
@@ -73,7 +73,7 @@ void RageLog::Trace( const char *fmt, ...)
fprintf( m_fileLog, "%s\n", sBuff.GetString() ); fprintf( m_fileLog, "%s\n", sBuff.GetString() );
printf( "%s\n", sBuff.GetString() ); printf( "%s\n", sBuff.GetString() );
CrashLog(sBuff); // CrashLog(sBuff);
#ifdef DEBUG #ifdef DEBUG
this->Flush(); // implicit flush this->Flush(); // implicit flush
+4 -10
View File
@@ -10,6 +10,7 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// In-line Links // In-line Links
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -281,16 +282,7 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// RageMovieTexture constructor // RageMovieTexture constructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
RageMovieTexture::RageMovieTexture( RageMovieTexture::RageMovieTexture( const CString &sFilePath ) : RageTexture( sFilePath )
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 )
{ {
LOG->Trace( "RageBitmapTexture::RageBitmapTexture()" ); LOG->Trace( "RageBitmapTexture::RageBitmapTexture()" );
@@ -578,3 +570,5 @@ bool RageMovieTexture::IsPlaying() const
return m_bPlaying; return m_bPlaying;
} }
+2 -7
View File
@@ -34,19 +34,14 @@ void RageSound::PlayOnceStreamedFromDir( CString sDir ) { }
RageSound::RageSound( HWND hWnd ) RageSound::RageSound()
{ {
LOG->Trace( "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) ) 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."); 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( throw RageException(
"There was an error while initializing your sound card.\n\n" "There was an error while initializing your sound card.\n\n"
+1 -2
View File
@@ -20,7 +20,7 @@
class RageSound class RageSound
{ {
public: public:
RageSound( HWND hWnd ); RageSound();
~RageSound(); ~RageSound();
float GetPlayLatency() { return m_info.latency / 1000.0f; }; // latency between when Play() is called and sound starts coming out 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 ); void PlayOnceStreamedFromDir( CString sDir );
private: private:
HWND m_hWndApp; // this is set on GRAPHICS_Create()
BASS_INFO m_info; BASS_INFO m_info;
}; };
+9 -16
View File
@@ -18,34 +18,21 @@
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// RageTexture constructor // RageTexture constructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
RageTexture::RageTexture( RageTexture::RageTexture( const CString &sFilePath )
RageDisplay* pScreen,
const CString &sFilePath,
int dwMaxSize,
int dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch )
{ {
// LOG->Trace( "RageTexture::RageTexture()" ); // 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_sFilePath = sFilePath;
// m_pd3dTexture = NULL;
m_iRefCount = 1; m_iRefCount = 1;
m_iSourceWidth = m_iSourceHeight = 0; m_iSourceWidth = m_iSourceHeight = 0;
m_iTextureWidth = m_iTextureHeight = 0; m_iTextureWidth = m_iTextureHeight = 0;
m_iImageWidth = m_iImageHeight = 0; m_iImageWidth = m_iImageHeight = 0;
m_iFramesWide = m_iFramesHigh = 1; m_iFramesWide = m_iFramesHigh = 0;
} }
RageTexture::~RageTexture() RageTexture::~RageTexture()
@@ -110,3 +97,9 @@ void RageTexture::GetFrameDimensionsFromFileName( CString sPath, int* piFramesWi
} }
} }
const RectF *RageTexture::GetTextureCoordRect( int frameNo ) const
{
return &m_TextureCoordRects[frameNo];
}
+13 -46
View File
@@ -3,7 +3,7 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: RageTexture 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. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
@@ -11,24 +11,10 @@
*/ */
#include "RageTypes.h"
#include "RageDisplay.h" const int MAX_TEXTURE_FRAMES = 256;
#include <d3dx8.h>
//#include <d3d8types.h>
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;
};
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -37,35 +23,19 @@ public:
class RageTexture class RageTexture
{ {
public: public:
RageTexture( RageTexture( const CString &sFilePath );
RageDisplay* pScreen,
const CString &sFilePath,
int dwMaxSize = 2048,
int dwTextureColorDepth = 16,
int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
);
virtual ~RageTexture() = 0; virtual ~RageTexture() = 0;
virtual void Reload( virtual void Reload() = 0;
int dwMaxSize = 2048,
int dwTextureColorDepth = 16,
int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
) = 0;
virtual LPDIRECT3DTEXTURE8 GetD3DTexture() = 0; // movie texture/animated texture stuff
virtual void Play() {} virtual void Play() {}
virtual void Stop() {} virtual void Stop() {}
virtual void Pause() {} virtual void Pause() {}
virtual void SetPosition( float fSeconds ) {} virtual void SetPosition( float fSeconds ) {}
virtual bool IsAMovie() const { return false; } virtual bool IsAMovie() const { return false; }
virtual bool IsPlaying() 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 GetSourceWidth() const {return m_iSourceWidth;}
int GetSourceHeight() const {return m_iSourceHeight;} int GetSourceHeight() const {return m_iSourceHeight;}
@@ -84,30 +54,27 @@ public:
int GetImageFrameWidth() const {return GetImageWidth() / GetFramesWide();} int GetImageFrameWidth() const {return GetImageWidth() / GetFramesWide();}
int GetImageFrameHeight() const {return GetImageHeight() / GetFramesHigh();} int GetImageFrameHeight() const {return GetImageHeight() / GetFramesHigh();}
RectF *GetTextureCoordRect( int uFrameNo ) {return &m_TextureCoordRects[uFrameNo];} const RectF *GetTextureCoordRect( int frameNo ) const;
int GetNumFrames() const {return m_TextureCoordRects.size();} int GetNumFrames() const {return m_iFramesWide*m_iFramesHigh;}
CString GetFilePath() const {return m_sFilePath;} CString GetFilePath() const {return m_sFilePath;}
int m_iRefCount; int m_iRefCount;
int m_iTimeOfLastUnload; int m_iTimeOfLastUnload;
virtual unsigned int GetGLTextureID() = 0; // accessed by RageDisplay
protected: protected:
virtual void CreateFrameRects(); virtual void CreateFrameRects();
virtual void GetFrameDimensionsFromFileName( CString sPath, int* puFramesWide, int* puFramesHigh ) const; virtual void GetFrameDimensionsFromFileName( CString sPath, int* puFramesWide, int* puFramesHigh ) const;
CString m_sFilePath; CString m_sFilePath;
LPDIRECT3DDEVICE8 m_pd3dDevice;
int m_iSourceWidth, m_iSourceHeight; // dimensions of the original image loaded from disk 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_iTextureWidth, m_iTextureHeight; // dimensions of the texture in memory
int m_iImageWidth, m_iImageHeight; // dimensions of the image in the texture 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 int m_iFramesWide, m_iFramesHigh; // The number of frames of animation in each row and column of this texture
CArray<RectF,RectF> m_TextureCoordRects; // size = m_iFramesWide * m_iFramesHigh
// RECTs that hold the bounds of each frame in the bitmap.
// e.g., if the texture has 4 frames of animation, the SrcRect for each frame would
// be in m_FrameRects[0..4].
CArray<RectF, RectF&> m_TextureCoordRects;
}; };
+10 -21
View File
@@ -26,13 +26,9 @@ RageTextureManager* TEXTUREMAN = NULL;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// constructor/destructor // constructor/destructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
RageTextureManager::RageTextureManager( RageDisplay* pScreen ) RageTextureManager::RageTextureManager( int iTextureColorDepth, int iSecondsBeforeUnload )
{ {
assert( pScreen != NULL ); SetPrefs( iTextureColorDepth, iSecondsBeforeUnload );
m_pScreen = pScreen;
m_iMaxTextureSize = 2048; // infinite size
m_iTextureColorDepth = 16;
m_iSecondsBeforeUnload = 60*30; // 30 mins
} }
RageTextureManager::~RageTextureManager() RageTextureManager::~RageTextureManager()
@@ -51,7 +47,7 @@ RageTextureManager::~RageTextureManager()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Load/Unload textures from disk // 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(); sTexturePath.MakeLower();
@@ -70,8 +66,6 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, bool bForceR
pTexture = p->second; pTexture = p->second;
pTexture->m_iRefCount++; 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 ); // 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; CString sDrive, sDir, sFName, sExt;
splitpath( false, sTexturePath, sDrive, sDir, sFName, sExt ); splitpath( false, sTexturePath, sDrive, sDir, sFName, sExt );
if( sExt == "avi" || sExt == "mpg" || sExt == "mpeg" ) // if( sExt == "avi" || sExt == "mpg" || sExt == "mpeg" )
pTexture = new RageMovieTexture( m_pScreen, sTexturePath, m_iMaxTextureSize, m_iTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ); // pTexture = new RageMovieTexture( sTexturePath );
else // else
pTexture = new RageBitmapTexture( m_pScreen, sTexturePath, m_iMaxTextureSize, m_iTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch ); pTexture = new RageBitmapTexture( sTexturePath );
LOG->Trace( "RageTextureManager: Finished loading '%s'.", sTexturePath.GetString() ); LOG->Trace( "RageTextureManager: Finished loading '%s'.", sTexturePath.GetString() );
@@ -185,19 +179,14 @@ void RageTextureManager::ReloadAll()
{ {
RageTexture* pTexture = i->second; RageTexture* pTexture = i->second;
// this is not entirely correct. Hints are lost! XXX pTexture->Reload(); // this is not entirely correct. Hints are lost! XXX
pTexture->Reload( m_iMaxTextureSize, m_iTextureColorDepth, 0 );
} }
} }
void RageTextureManager::SetPrefs( int iMaxSize, int iTextureColorDepth, int iSecondsBeforeUnload ) void RageTextureManager::SetPrefs( int iTextureColorDepth, int iSecondsBeforeUnload )
{ {
m_iSecondsBeforeUnload = iSecondsBeforeUnload; m_iSecondsBeforeUnload = iSecondsBeforeUnload;
if( iMaxSize == m_iMaxTextureSize && iTextureColorDepth == m_iTextureColorDepth )
return;
m_iMaxTextureSize = iMaxSize;
m_iTextureColorDepth = iTextureColorDepth; m_iTextureColorDepth = iTextureColorDepth;
ASSERT( m_iMaxTextureSize >= 64 ); ASSERT( m_iTextureColorDepth==16 || m_iTextureColorDepth==32 );
ASSERT( m_iTextureColorDepth >= 16 );
ReloadAll(); ReloadAll();
} }
+4 -6
View File
@@ -19,23 +19,21 @@
class RageTextureManager class RageTextureManager
{ {
public: public:
RageTextureManager( RageDisplay* pScreen ); RageTextureManager( int iTextureColorDepth, int iSecsBeforeUnload );
~RageTextureManager(); ~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 ); bool IsTextureLoaded( CString sTexturePath );
void UnloadTexture( CString sTexturePath ); void UnloadTexture( CString sTexturePath );
void ReloadAll(); void ReloadAll();
void SetPrefs( int iMaxSize, int iTextureColorDepth, int iMaxTextureMB ); void SetPrefs( int iTextureColorDepth, int iSecsBeforeUnload );
int GetMaxTextureSize() { return m_iMaxTextureSize; };
int GetTextureColorDepth() { return m_iTextureColorDepth; }; int GetTextureColorDepth() { return m_iTextureColorDepth; };
int GetSecsBeforeUnload() { return m_iSecondsBeforeUnload; };
protected: protected:
void GCTextures(); void GCTextures();
RageDisplay* m_pScreen;
int m_iMaxTextureSize;
int m_iTextureColorDepth; int m_iTextureColorDepth;
int m_iSecondsBeforeUnload; int m_iSecondsBeforeUnload;
+53 -23
View File
@@ -79,16 +79,6 @@ public:
float x, y, z; 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 struct RageVector4
{ {
public: public:
@@ -97,7 +87,6 @@ public:
RageVector4( float x1, float y1, float z1, float w1 ) { x=x1; y=y1; z=z1; w=w1; } RageVector4( float x1, float y1, float z1, float w1 ) { x=x1; y=y1; z=z1; w=w1; }
// casting // 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 float* () { return &x; };
operator const float* () const { 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; }
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; float x, y, z, w;
};
struct
{
float r, g, b, a;
};
};
}; };
typedef RageVector4 RageColor;
#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;
};
template <class T> template <class T>
@@ -155,9 +183,10 @@ typedef Rect<float> RectF;
// A structure for our custom vertex type. Note that these data structes have the same layout that D3D expects. // A structure for our custom vertex type. Note that these data structes have the same layout that D3D expects.
struct RageVertex struct RageVertex
{ {
RageVector3 p; // position // This is the format expected by OpenGL. D3D expects the reverse!
DWORD c; // diffuse color
RageVector2 t; // texture coordinates 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 #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 float* () { return m[0]; }
operator const float* () const { 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...--- // ---These are not used. Maybe I'll implement them later...---
// // assignment operators // // assignment operators
+1
View File
@@ -16,6 +16,7 @@
#include "PrefsManager.h" #include "PrefsManager.h"
#include "RageLog.h" #include "RageLog.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
const float SCORE_TWEEN_TIME = 0.2f; const float SCORE_TWEEN_TIME = 0.2f;
+1
View File
@@ -16,6 +16,7 @@
#include "PrefsManager.h" #include "PrefsManager.h"
#include "RageLog.h" #include "RageLog.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
const float SCORE_TWEEN_TIME = 0.5f; const float SCORE_TWEEN_TIME = 0.5f;
+1 -1
View File
@@ -23,7 +23,7 @@
#include "AnnouncerManager.h" #include "AnnouncerManager.h"
#include "GameManager.h" #include "GameManager.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
enum { enum {
+1
View File
@@ -16,6 +16,7 @@
#include "AnnouncerManager.h" #include "AnnouncerManager.h"
#include "GameState.h" #include "GameState.h"
#include "RageMusic.h" #include "RageMusic.h"
#include "ThemeManager.h"
#define NEXT_SCREEN THEME->GetMetric("ScreenCaution","NextScreen") #define NEXT_SCREEN THEME->GetMetric("ScreenCaution","NextScreen")
+3
View File
@@ -21,6 +21,9 @@
#include "RageLog.h" #include "RageLog.h"
#include "GameState.h" #include "GameState.h"
#include "InputMapper.h" #include "InputMapper.h"
#include "RageLog.h"
#include <math.h>
#include "ThemeManager.h"
#include <utility> #include <utility>
+1
View File
@@ -20,6 +20,7 @@
#include "RageLog.h" #include "RageLog.h"
#include "GameState.h" #include "GameState.h"
#include "RageMusic.h" #include "RageMusic.h"
#include "ThemeManager.h"
// //
+1
View File
@@ -22,6 +22,7 @@
#include "AnnouncerManager.h" #include "AnnouncerManager.h"
#include "GameState.h" #include "GameState.h"
#include "GrooveRadar.h" #include "GrooveRadar.h"
#include "ThemeManager.h"
#define BANNER_X THEME->GetMetricF("ScreenEvaluation","BannerX") #define BANNER_X THEME->GetMetricF("ScreenEvaluation","BannerX")
+1
View File
@@ -20,6 +20,7 @@ Andrew Livy
#include "GameState.h" #include "GameState.h"
#include "RageException.h" #include "RageException.h"
#include "RageTimer.h" #include "RageTimer.h"
#include "ThemeManager.h"
/* Constants */ /* Constants */
+1
View File
@@ -20,6 +20,7 @@
#include "AnnouncerManager.h" #include "AnnouncerManager.h"
#include "GameState.h" #include "GameState.h"
#include "RageMusic.h" #include "RageMusic.h"
#include "ThemeManager.h"
const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 1); const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 1);
+1
View File
@@ -27,6 +27,7 @@
#include "ScreenPrompt.h" #include "ScreenPrompt.h"
#include "GrooveRadar.h" #include "GrooveRadar.h"
#include "NotesLoaderSM.h" #include "NotesLoaderSM.h"
#include "ThemeManager.h"
// //
// Defines // Defines
+33 -46
View File
@@ -20,14 +20,16 @@
#include "StepMania.h" #include "StepMania.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "RageLog.h" #include "RageLog.h"
#include "PrefsManager.h"
#include "ThemeManager.h"
enum { enum {
GO_WINDOWED = 0, GO_WINDOWED = 0,
GO_DISPLAY_RESOLUTION, GO_DISPLAY_RESOLUTION,
GO_TEXTURE_RESOLUTION, GO_DISPLAY_COLOR_DEPTH,
GO_REFRESH_RATE, GO_TEXTURE_COLOR_DEPTH,
GO_REFRESH_RATE_MODE,
GO_BGMODE, GO_BGMODE,
GO_BGBRIGHTNESS, GO_BGBRIGHTNESS,
GO_MOVIEDECODEMS, GO_MOVIEDECODEMS,
@@ -38,8 +40,9 @@ enum {
OptionRowData g_GraphicOptionsLines[NUM_GRAPHIC_OPTIONS_LINES] = { OptionRowData g_GraphicOptionsLines[NUM_GRAPHIC_OPTIONS_LINES] = {
{ "Display\nMode", 2, {"FULLSCREEN", "WINDOWED"} }, { "Display\nMode", 2, {"FULLSCREEN", "WINDOWED"} },
{ "Display\nResolution", 7, {"320","400","512","640","800","1024","1280"} }, { "Display\nResolution", 7, {"320","400","512","640","800","1024","1280"} },
{ "Texture\nResolution", 3, {"256","512","1024"} }, { "Display\nColor", 2, {"16BIT","32BIT"} },
{ "Refresh\nRate", 11, {"DEFAULT","MAX","60","70","72","75","80","85","90","100","120"} }, { "Texture\nColor", 2, {"16BIT","32BIT"} },
{ "Refresh\nRate", 3, {"DEFAULT","MAX","MIN"} },
{ "Background\nMode", 4, {"OFF","ANIMATIONS","VISUALIZATIONS","RANDOM MOVIES"} }, { "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"} }, { "Movie\nDecode", 4, {"1ms","2ms","3ms","4ms"} },
@@ -83,17 +86,6 @@ ScreenGraphicOptions::ScreenGraphicOptions() :
MUSIC->LoadAndPlayIfNotAlready( THEME->GetPathTo("Sounds","graphic options music") ); 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() void ScreenGraphicOptions::UpdateRefreshRates()
{ {
@@ -110,7 +102,7 @@ void ScreenGraphicOptions::UpdateRefreshRates()
/* Set the refresh to default. If we can find the old selection in the /* Set the refresh to default. If we can find the old selection in the
* new data, we'll set it to that later. */ * 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; opt.iNumOptions = 2;
int OldSettingNo = RageDisplay::REFRESH_DEFAULT; int OldSettingNo = RageDisplay::REFRESH_DEFAULT;
@@ -127,8 +119,8 @@ void ScreenGraphicOptions::UpdateRefreshRates()
OldSettingNo = i; OldSettingNo = i;
} }
m_iSelectedOption[0][GO_REFRESH_RATE] = m_iSelectedOption[0][GO_REFRESH_RATE_MODE] =
m_iSelectedOption[1][GO_REFRESH_RATE] = OldSettingNo; m_iSelectedOption[1][GO_REFRESH_RATE_MODE] = OldSettingNo;
InitOptionsText(); InitOptionsText();
#endif #endif
@@ -151,7 +143,7 @@ void ScreenGraphicOptions::ImportOptions()
{ {
m_iSelectedOption[0][GO_WINDOWED] = PREFSMAN->m_bWindowed ? 1:0; 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 320: m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 0; break;
case 400: m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 1; break; case 400: m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 1; break;
@@ -163,30 +155,19 @@ void ScreenGraphicOptions::ImportOptions()
default: m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 3; 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 16: m_iSelectedOption[0][GO_DISPLAY_COLOR_DEPTH] = 0; break;
case 512: m_iSelectedOption[0][GO_TEXTURE_RESOLUTION] = 1; break; case 32: m_iSelectedOption[0][GO_DISPLAY_COLOR_DEPTH] = 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 ) switch( PREFSMAN->m_iTextureColorDepth )
{ {
case RageDisplay::REFRESH_DEFAULT: m_iSelectedOption[0][GO_REFRESH_RATE] = 0; break; case 16: m_iSelectedOption[0][GO_TEXTURE_COLOR_DEPTH] = 0; break;
case RageDisplay::REFRESH_MAX: m_iSelectedOption[0][GO_REFRESH_RATE] = 1; break; case 32: m_iSelectedOption[0][GO_TEXTURE_COLOR_DEPTH] = 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;
} }
m_iSelectedOption[0][GO_REFRESH_RATE_MODE] = PREFSMAN->m_iRefreshRateMode;
m_iSelectedOption[0][GO_BGMODE] = PREFSMAN->m_BackgroundMode; m_iSelectedOption[0][GO_BGMODE] = PREFSMAN->m_BackgroundMode;
m_iSelectedOption[0][GO_BGBRIGHTNESS] = (int)( PREFSMAN->m_fBGBrightness*10+0.5f ); m_iSelectedOption[0][GO_BGBRIGHTNESS] = (int)( PREFSMAN->m_fBGBrightness*10+0.5f );
m_iSelectedOption[0][GO_MOVIEDECODEMS] = PREFSMAN->m_iMovieDecodeMS-1; m_iSelectedOption[0][GO_MOVIEDECODEMS] = PREFSMAN->m_iMovieDecodeMS-1;
@@ -203,18 +184,24 @@ void ScreenGraphicOptions::ExportOptions()
ASSERT(0); ASSERT(0);
m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 3; m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 3;
} }
PREFSMAN->m_iDisplayResolution = PREFSMAN->m_iDisplayWidth = HorizRes[m_iSelectedOption[0][GO_DISPLAY_RESOLUTION]];
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 0: PREFSMAN->m_iDisplayColorDepth = 16; break;
case 1: PREFSMAN->m_iTextureResolution = 512; break; case 1: PREFSMAN->m_iDisplayColorDepth = 32; break;
case 2: PREFSMAN->m_iTextureResolution = 1024; break; default: ASSERT(0); PREFSMAN->m_iDisplayColorDepth = 16; break;
default: ASSERT(0); PREFSMAN->m_iTextureResolution = 512; 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_BackgroundMode = PrefsManager::BackgroundMode( m_iSelectedOption[0][GO_BGMODE] );
PREFSMAN->m_fBGBrightness = m_iSelectedOption[0][GO_BGBRIGHTNESS] / 10.0f; PREFSMAN->m_fBGBrightness = m_iSelectedOption[0][GO_BGBRIGHTNESS] / 10.0f;
PREFSMAN->m_iMovieDecodeMS = m_iSelectedOption[0][GO_MOVIEDECODEMS]+1; PREFSMAN->m_iMovieDecodeMS = m_iSelectedOption[0][GO_MOVIEDECODEMS]+1;
-1
View File
@@ -27,7 +27,6 @@ private:
void GoToNextState(); void GoToNextState();
void GoToPrevState(); void GoToPrevState();
int CurrentRefresh() const;
}; };
#endif #endif
+1
View File
@@ -18,6 +18,7 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "RageLog.h" #include "RageLog.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
#define HELP_TEXT THEME->GetMetric("ScreenHowToPlay","HelpText") #define HELP_TEXT THEME->GetMetric("ScreenHowToPlay","HelpText")
+1
View File
@@ -20,6 +20,7 @@
#include "StepMania.h" #include "StepMania.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "RageLog.h" #include "RageLog.h"
#include "ThemeManager.h"
enum { enum {
+1 -1
View File
@@ -20,7 +20,7 @@
#include "StepMania.h" #include "StepMania.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "RageLog.h" #include "RageLog.h"
#include "ThemeManager.h"
enum { enum {
+2 -3
View File
@@ -18,6 +18,7 @@
#include "GameState.h" #include "GameState.h"
#include "RageException.h" #include "RageException.h"
#include "RageTimer.h" #include "RageTimer.h"
#include "ThemeManager.h"
ScreenManager* SCREENMAN = NULL; // global and accessable from anywhere in our program ScreenManager* SCREENMAN = NULL; // global and accessable from anywhere in our program
@@ -133,7 +134,7 @@ void ScreenManager::Draw()
if( PREFSMAN && PREFSMAN->m_bShowStats ) 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(); m_textStats.Draw();
} }
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
@@ -182,7 +183,6 @@ void ScreenManager::Input( const DeviceInput& DeviceI, const InputEventType type
#include "ScreenStage.h" #include "ScreenStage.h"
#include "ScreenTitleMenu.h" #include "ScreenTitleMenu.h"
#include "ScreenEz2SelectMusic.h" #include "ScreenEz2SelectMusic.h"
#include "ScreenNetworkGame.h"
#include "ScreenPrompt.h" #include "ScreenPrompt.h"
#include "ScreenTextEntry.h" #include "ScreenTextEntry.h"
@@ -221,7 +221,6 @@ Screen* ScreenManager::MakeNewScreen( CString sClassName )
else if( 0==stricmp(sClassName, "ScreenStage") ) return new ScreenStage; else if( 0==stricmp(sClassName, "ScreenStage") ) return new ScreenStage;
else if( 0==stricmp(sClassName, "ScreenTitleMenu") ) return new ScreenTitleMenu; else if( 0==stricmp(sClassName, "ScreenTitleMenu") ) return new ScreenTitleMenu;
// else if( 0==stricmp(sClassName, "ScreenEz2SelectMusic") ) return new ScreenEz2SelectMusic; // else if( 0==stricmp(sClassName, "ScreenEz2SelectMusic") ) return new ScreenEz2SelectMusic;
else if( 0==stricmp(sClassName, "ScreenNetworkGame") ) return new ScreenNetworkGame;
else else
throw RageException( "Invalid Screen class name '%s'", sClassName.GetString() ); throw RageException( "Invalid Screen class name '%s'", sClassName.GetString() );
} }
+1
View File
@@ -20,6 +20,7 @@
#include "GameManager.h" #include "GameManager.h"
#include "GameState.h" #include "GameState.h"
#include "RageMusic.h" #include "RageMusic.h"
#include "ThemeManager.h"
#define HELP_TEXT THEME->GetMetric("ScreenMapControllers","HelpText") #define HELP_TEXT THEME->GetMetric("ScreenMapControllers","HelpText")
+2
View File
@@ -19,6 +19,8 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "SongManager.h" #include "SongManager.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
#include "AnnouncerManager.h"
#define SCROLL_DELAY THEME->GetMetricF("ScreenMusicScroll","ScrollDelay") #define SCROLL_DELAY THEME->GetMetricF("ScreenMusicScroll","ScrollDelay")
+1
View File
@@ -19,6 +19,7 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "RageLog.h" #include "RageLog.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
#define ICONS_X( p ) THEME->GetMetricF("ScreenOptions",ssprintf("IconsP%dX",p+1)) #define ICONS_X( p ) THEME->GetMetricF("ScreenOptions",ssprintf("IconsP%dX",p+1))
+2
View File
@@ -15,6 +15,8 @@
#include "ScreenManager.h" #include "ScreenManager.h"
#include "RageLog.h" #include "RageLog.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
#include "AnnouncerManager.h"
enum { enum {
+1
View File
@@ -17,6 +17,7 @@
#include "RageMusic.h" #include "RageMusic.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ThemeManager.h"
const float QUESTION_X = CENTER_X; const float QUESTION_X = CENTER_X;
const float QUESTION_Y = CENTER_Y - 60; const float QUESTION_Y = CENTER_Y - 60;
+7 -10
View File
@@ -16,15 +16,12 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "Quad.h" #include "Quad.h"
#include "ThemeManager.h"
#include "RageNetwork.h" #include "RageNetwork.h"
ScreenSandbox::ScreenSandbox() ScreenSandbox::ScreenSandbox()
{ {
m_text.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
m_text.SetXY( CENTER_X, CENTER_Y );
this->AddChild( &m_text );
// m_Menu.Load( // m_Menu.Load(
// THEME->GetPathTo(GRAPHIC_SELECT_STYLE_BACKGROUND), // THEME->GetPathTo(GRAPHIC_SELECT_STYLE_BACKGROUND),
// THEME->GetPathTo(GRAPHIC_SELECT_STYLE_TOP_EDGE), // THEME->GetPathTo(GRAPHIC_SELECT_STYLE_TOP_EDGE),
@@ -34,7 +31,10 @@ ScreenSandbox::ScreenSandbox()
// this->AddChild( &m_Menu ); // this->AddChild( &m_Menu );
// m_Menu.TweenOnScreenFromBlack( SM_None ); // 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<Packet,Packet> aPackets; CArray<Packet,Packet> aPackets;
NETWORK->Recv( aPackets ); NETWORK->Recv( aPackets );
for( unsigned int i=0; i<aPackets.size(); i++ )
{
m_text.SetText( "Message received." );
}
} }
void ScreenSandbox::DrawPrimitives() void ScreenSandbox::DrawPrimitives()
@@ -66,7 +62,8 @@ void ScreenSandbox::Input( const DeviceInput& DeviceI, const InputEventType type
switch( DeviceI.button ) switch( DeviceI.button )
{ {
case DIK_LEFT: case DIK_LEFT:
m_text.SetText( "Message sent." ); break;
case DIK_RIGHT:
break; break;
case DIK_T: case DIK_T:
break; break;
+1 -1
View File
@@ -30,6 +30,6 @@ public:
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
BitmapText m_text; Sprite m_sprite;
}; };
+1
View File
@@ -26,6 +26,7 @@
#include "GameState.h" #include "GameState.h"
#include "RageMusic.h" #include "RageMusic.h"
#include "CodeDetector.h" #include "CodeDetector.h"
#include "ThemeManager.h"
#define EXPLANATION_X THEME->GetMetricF("ScreenSelectCourse","ExplanationX") #define EXPLANATION_X THEME->GetMetricF("ScreenSelectCourse","ExplanationX")
+1
View File
@@ -19,6 +19,7 @@
#include "AnnouncerManager.h" #include "AnnouncerManager.h"
#include "GameState.h" #include "GameState.h"
#include "RageMusic.h" #include "RageMusic.h"
#include "ThemeManager.h"
const float LOCK_INPUT_TIME = 0.30f; // lock input while waiting for tweening to complete const float LOCK_INPUT_TIME = 0.30f; // lock input while waiting for tweening to complete
+1
View File
@@ -17,6 +17,7 @@
#include "GameManager.h" #include "GameManager.h"
#include "GameState.h" #include "GameState.h"
#include "InputMapper.h" #include "InputMapper.h"
#include "ThemeManager.h"
enum { enum {
+13 -12
View File
@@ -21,6 +21,8 @@
#include "AnnouncerManager.h" #include "AnnouncerManager.h"
#include "GameState.h" #include "GameState.h"
#include "RageMusic.h" #include "RageMusic.h"
#include "ThemeManager.h"
#include <map>
#define FRAME_X THEME->GetMetricF("ScreenSelectGroup","FrameX") #define FRAME_X THEME->GetMetricF("ScreenSelectGroup","FrameX")
@@ -78,20 +80,19 @@ ScreenSelectGroup::ScreenSelectGroup()
aAllSongs.erase( aAllSongs.begin()+j, aAllSongs.begin()+j+1 ); aAllSongs.erase( aAllSongs.begin()+j, aAllSongs.begin()+j+1 );
} }
CStringArray asGroupNames; // Add all group names to a map.
for( i=0; i<aAllSongs.size(); i++ ) { std::map<CString, CString> mapGroupNames;
asGroupNames.push_back( aAllSongs[i]->m_sGroupName ); for( i=0; i<aAllSongs.size(); i++ )
{
const CString& sGroupName = aAllSongs[i]->m_sGroupName;
mapGroupNames[ sGroupName ] = ""; // group name maps to nothing
} }
/* Remove duplicate groups. */ // copy group names into a vector
SortCStringArray(asGroupNames, true); std::vector<CString> asGroupNames;
for( i=asGroupNames.size()-1; i > 0; --i ) { for( std::map<CString, CString>::const_iterator iter = mapGroupNames.begin(); iter != mapGroupNames.end(); ++i )
if( asGroupNames[i] == asGroupNames[i-1] ) asGroupNames.push_back( iter->first );
asGroupNames.erase( asGroupNames.begin()+i, asGroupNames.push_back( "ALL MUSIC" ); // "ALL MUSIC" is a special group
asGroupNames.begin()+i+1 );
}
asGroupNames.insert(asGroupNames.begin(), "ALL MUSIC" );
// Add songs to the MusicList. // Add songs to the MusicList.
for( unsigned g=0; g < asGroupNames.size(); g++ ) /* for each group */ for( unsigned g=0; g < asGroupNames.size(); g++ ) /* for each group */
+16 -15
View File
@@ -22,6 +22,7 @@ Chris Danford
#include "RageException.h" #include "RageException.h"
#include "RageTimer.h" #include "RageTimer.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
/* Constants */ /* Constants */
@@ -200,11 +201,11 @@ void ScreenSelectMode::HandleScreenMessage( const ScreenMessage SM )
case SM_GoToNextScreen: case SM_GoToNextScreen:
// Put the mode choice into effect // Put the mode choice into effect
int iSelection = m_ScrollingList.GetSelection(); int iSelection = m_ScrollingList.GetSelection();
const ModeChoice& choice = m_aPossibleModeChoices[ iSelection ]; const ModeChoice* pChoice = m_apPossibleModeChoices[ iSelection ];
GAMESTATE->m_CurStyle = choice.style; GAMESTATE->m_CurStyle = pChoice->style;
GAMESTATE->m_PlayMode = choice.pm; GAMESTATE->m_PlayMode = pChoice->pm;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
GAMESTATE->m_PreferredDifficulty[p] = choice.dc; GAMESTATE->m_PreferredDifficulty[p] = pChoice->dc;
switch( GAMESTATE->m_PlayMode ) switch( GAMESTATE->m_PlayMode )
{ {
@@ -224,24 +225,24 @@ void ScreenSelectMode::RefreshModeChoices()
{ {
int iNumSidesJoined = GAMESTATE->GetNumSidesJoined(); int iNumSidesJoined = GAMESTATE->GetNumSidesJoined();
GAMEMAN->GetModesChoicesForGame( GAMESTATE->m_CurGame, m_aPossibleModeChoices ); GAMEMAN->GetModesChoicesForGame( GAMESTATE->m_CurGame, m_apPossibleModeChoices );
ASSERT( !m_aPossibleModeChoices.empty() ); ASSERT( !m_apPossibleModeChoices.empty() );
int i; int i;
// remove ModeChoices that won't work with the current number of players // remove ModeChoices that won't work with the current number of players
for( i=m_aPossibleModeChoices.size()-1; i>=0; i-- ) for( i=m_apPossibleModeChoices.size()-1; i>=0; i-- )
if( m_aPossibleModeChoices[i].numSidesJoinedToPlay != iNumSidesJoined ) if( m_apPossibleModeChoices[i]->numSidesJoinedToPlay != iNumSidesJoined )
m_aPossibleModeChoices.erase( m_aPossibleModeChoices.begin()+i, m_apPossibleModeChoices.erase( m_apPossibleModeChoices.begin()+i,
m_aPossibleModeChoices.begin()+i+1 ); m_apPossibleModeChoices.begin()+i+1 );
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
CStringArray asGraphicPaths; CStringArray asGraphicPaths;
for( unsigned j=0; j<m_aPossibleModeChoices.size(); j++ ) for( unsigned j=0; j<m_apPossibleModeChoices.size(); j++ )
{ {
const ModeChoice& choice = m_aPossibleModeChoices[j]; const ModeChoice* pChoice = m_apPossibleModeChoices[j];
asGraphicPaths.push_back( THEME->GetPathTo("Graphics", ssprintf("select mode choice %s %s", sGameName.GetString(), choice.name) ) ); asGraphicPaths.push_back( THEME->GetPathTo("Graphics", ssprintf("select mode choice %s %s", sGameName.GetString(), pChoice->name) ) );
} }
m_ScrollingList.Load( asGraphicPaths ); m_ScrollingList.Load( asGraphicPaths );
@@ -251,9 +252,9 @@ void ScreenSelectMode::RefreshModeChoices()
{ {
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
for( unsigned i=0; i<m_aPossibleModeChoices.size(); i++ ) for( unsigned i=0; i<m_apPossibleModeChoices.size(); i++ )
{ {
CString sChoiceName = m_aPossibleModeChoices[i].name; CString sChoiceName = m_apPossibleModeChoices[i]->name;
m_BGAnimations[i].LoadFromAniDir( THEME->GetPathTo("BGAnimations",ssprintf("select mode %s %s", sGameName.GetString(), sChoiceName.GetString())) ); m_BGAnimations[i].LoadFromAniDir( THEME->GetPathTo("BGAnimations",ssprintf("select mode %s %s", sGameName.GetString(), sChoiceName.GetString())) );
} }
} }
+3 -1
View File
@@ -17,6 +17,8 @@ Andrew Livy
#include "Quad.h" #include "Quad.h"
#include "MenuElements.h" #include "MenuElements.h"
#include "ScrollingList.h" #include "ScrollingList.h"
#include "GameConstantsAndTypes.h"
#include "ModeChoice.h"
/* Class Definition */ /* Class Definition */
@@ -53,7 +55,7 @@ protected:
Sprite m_ChoiceListFrame; Sprite m_ChoiceListFrame;
Sprite m_ChoiceListHighlight; Sprite m_ChoiceListHighlight;
CArray<ModeChoice,ModeChoice> m_aPossibleModeChoices; CArray<ModeChoice*,ModeChoice*> m_apPossibleModeChoices;
ScrollingList m_ScrollingList; ScrollingList m_ScrollingList;
void RefreshModeChoices(); void RefreshModeChoices();
+6 -3
View File
@@ -26,6 +26,9 @@
#include "InputMapper.h" #include "InputMapper.h"
#include "GameState.h" #include "GameState.h"
#include "CodeDetector.h" #include "CodeDetector.h"
#include <math.h>
#include "GameConstantsAndTypes.h"
#include "ThemeManager.h"
#define BANNER_FRAME_X THEME->GetMetricF("ScreenSelectMusic","BannerFrameX") #define BANNER_FRAME_X THEME->GetMetricF("ScreenSelectMusic","BannerFrameX")
@@ -384,10 +387,10 @@ void ScreenSelectMusic::Update( float fDeltaTime )
this->PlayMusicSample(); this->PlayMusicSample();
} }
float fNewRotation = m_sprCDTitle.GetRotationY()+D3DX_PI*fDeltaTime/2; float fNewRotation = m_sprCDTitle.GetRotationY()+PI*fDeltaTime/2;
fNewRotation = fmodf( fNewRotation, D3DX_PI*2 ); fNewRotation = fmodf( fNewRotation, PI*2 );
m_sprCDTitle.SetRotationY( fNewRotation ); 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) ); m_sprCDTitle.SetDiffuse( RageColor(0.2f,0.2f,0.2f,1) );
else else
m_sprCDTitle.SetDiffuse( RageColor(1,1,1,1) ); m_sprCDTitle.SetDiffuse( RageColor(1,1,1,1) );
+2
View File
@@ -21,6 +21,8 @@
#include "RageLog.h" #include "RageLog.h"
#include "AnnouncerManager.h" #include "AnnouncerManager.h"
#include "GameState.h" #include "GameState.h"
#include "GameConstantsAndTypes.h"
#include "ThemeManager.h"
#define ICONS_START_X THEME->GetMetricF("ScreenSelectStyle","IconsStartX") #define ICONS_START_X THEME->GetMetricF("ScreenSelectStyle","IconsStartX")
+3 -2
View File
@@ -1,3 +1,5 @@
#ifndef SCREEN_SELECT_STYLE_H
#define SCREEN_SELECT_STYLE_H
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: ScreenSelectStyle Class: ScreenSelectStyle
@@ -9,14 +11,13 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#ifndef SCREEN_SELECT_STYLE_H
#define SCREEN_SELECT_STYLE_H
#include "Screen.h" #include "Screen.h"
#include "Sprite.h" #include "Sprite.h"
#include "TransitionFade.h" #include "TransitionFade.h"
#include "RandomSample.h" #include "RandomSample.h"
#include "MenuElements.h" #include "MenuElements.h"
#include "Style.h"
class ScreenSelectStyle : public Screen class ScreenSelectStyle : public Screen
+2
View File
@@ -21,6 +21,8 @@
#include "RageLog.h" #include "RageLog.h"
#include "GameState.h" #include "GameState.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ThemeManager.h"
#include "AnnouncerManager.h"
#define HELP_TEXT THEME->GetMetric("ScreenSelectStyle5th","HelpText") #define HELP_TEXT THEME->GetMetric("ScreenSelectStyle5th","HelpText")
#define TIMER_SECONDS THEME->GetMetricI("ScreenSelectStyle5th","TimerSeconds") #define TIMER_SECONDS THEME->GetMetricI("ScreenSelectStyle5th","TimerSeconds")
+1
View File
@@ -17,6 +17,7 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "RageLog.h" #include "RageLog.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
enum { enum {
+1
View File
@@ -23,6 +23,7 @@
#include "AnnouncerManager.h" #include "AnnouncerManager.h"
#include "GameState.h" #include "GameState.h"
#include "RageMusic.h" #include "RageMusic.h"
#include "ThemeManager.h"
#define NEXT_SCREEN THEME->GetMetric("ScreenStage","NextScreen") #define NEXT_SCREEN THEME->GetMetric("ScreenStage","NextScreen")
+1
View File
@@ -17,6 +17,7 @@
#include "ScreenTitleMenu.h" #include "ScreenTitleMenu.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ThemeManager.h"
const float QUESTION_X = CENTER_X; const float QUESTION_X = CENTER_X;
const float QUESTION_Y = CENTER_Y - 60; const float QUESTION_Y = CENTER_Y - 60;
+1 -5
View File
@@ -22,10 +22,10 @@
#include "GameState.h" #include "GameState.h"
#include "GameManager.h" #include "GameManager.h"
#include "InputMapper.h" #include "InputMapper.h"
#include "ThemeManager.h"
const CString CHOICE_TEXT[ScreenTitleMenu::NUM_TITLE_MENU_CHOICES] = { const CString CHOICE_TEXT[ScreenTitleMenu::NUM_TITLE_MENU_CHOICES] = {
"GAME START", "GAME START",
"NETWORK GAME",
"SWITCH GAME", "SWITCH GAME",
"CONFIG KEY/JOY", "CONFIG KEY/JOY",
"INPUT OPTIONS", "INPUT OPTIONS",
@@ -203,9 +203,6 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM )
case CHOICE_GAME_START: case CHOICE_GAME_START:
SCREENMAN->SetNewScreen( NEXT_SCREEN ); SCREENMAN->SetNewScreen( NEXT_SCREEN );
break; break;
case CHOICE_NETWORK_GAME:
SCREENMAN->SetNewScreen( "ScreenNetworkGame" );
break;
case CHOICE_SELECT_GAME: case CHOICE_SELECT_GAME:
SCREENMAN->SetNewScreen( "ScreenSelectGame" ); SCREENMAN->SetNewScreen( "ScreenSelectGame" );
break; break;
@@ -354,7 +351,6 @@ void ScreenTitleMenu::MenuStart( PlayerNumber pn )
switch( m_TitleMenuChoice ) switch( m_TitleMenuChoice )
{ {
case CHOICE_GAME_START: case CHOICE_GAME_START:
case CHOICE_NETWORK_GAME:
case CHOICE_SELECT_GAME: case CHOICE_SELECT_GAME:
case CHOICE_MAP_INSTRUMENTS: case CHOICE_MAP_INSTRUMENTS:
case CHOICE_INPUT_OPTIONS: case CHOICE_INPUT_OPTIONS:
-1
View File
@@ -30,7 +30,6 @@ public:
enum TitleMenuChoice { enum TitleMenuChoice {
CHOICE_GAME_START = 0, CHOICE_GAME_START = 0,
CHOICE_NETWORK_GAME,
CHOICE_SELECT_GAME, CHOICE_SELECT_GAME,
CHOICE_MAP_INSTRUMENTS, CHOICE_MAP_INSTRUMENTS,
CHOICE_INPUT_OPTIONS, CHOICE_INPUT_OPTIONS,
+2
View File
@@ -13,6 +13,8 @@
#include "ScrollBar.h" #include "ScrollBar.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include <math.h>
#include "ThemeManager.h"
ScrollBar::ScrollBar() ScrollBar::ScrollBar()
+1
View File
@@ -14,6 +14,7 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ThemeManager.h"
const float SCROLL_TIME = 5.0f; const float SCROLL_TIME = 5.0f;
+1
View File
@@ -14,6 +14,7 @@
#include "Sprite.h" #include "Sprite.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "Grade.h" #include "Grade.h"
#include "GameConstantsAndTypes.h"
+1
View File
@@ -17,6 +17,7 @@
#include "ArrowEffects.h" #include "ArrowEffects.h"
#include "GameManager.h" #include "GameManager.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
SnapDisplay::SnapDisplay() SnapDisplay::SnapDisplay()
+4
View File
@@ -20,6 +20,10 @@
#include "RageException.h" #include "RageException.h"
#include "RageTimer.h" #include "RageTimer.h"
#include "AnnouncerManager.h"
#include "ThemeManager.h"
#include "GameManager.h"
SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program
+2
View File
@@ -14,6 +14,8 @@
#include "RageLog.h" #include "RageLog.h"
#include "SongManager.h" #include "SongManager.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h"
#include "GameManager.h"
// //
// Defines specific to SongSelector // Defines specific to SongSelector
+4 -3
View File
@@ -1,3 +1,5 @@
#ifndef SONG_SELECTOR_H
#define SONG_SELECTOR_H
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: SongSelector Class: SongSelector
@@ -9,15 +11,14 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#ifndef SONG_SELECTOR_H
#define SONG_SELECTOR_H
#include "stdafx.h" #include "stdafx.h"
#include "ActorFrame.h" #include "ActorFrame.h"
#include "MenuElements.h" #include "MenuElements.h"
#include "Banner.h" #include "Banner.h"
#include "TextBanner.h" #include "TextBanner.h"
#include "GameConstantsAndTypes.h"
#include "Style.h"
class SongSelector: public ActorFrame { class SongSelector: public ActorFrame {
public: public:

Some files were not shown because too many files have changed in this diff Show More