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 "RageDisplay.h"
#include "PrefsManager.h"
#include "RageUtil.h"
#include "GameConstantsAndTypes.h"
Actor::Actor()
@@ -256,6 +258,16 @@ void Actor::BeginTweening( float time, TweenType tt )
{
ASSERT( time >= 0 );
// HACK to keep from out of bounds access..
if( m_iNumTweenStates == MAX_TWEEN_STATES )
{
for( int i=0; i<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
m_iNumTweenStates++;
TweenState &TS = m_TweenStates[m_iNumTweenStates-1]; // latest
+1
View File
@@ -18,6 +18,7 @@
#include "RageException.h"
#include "RageTimer.h"
#include "NoteDisplay.h"
#include <math.h>
float ArrowGetYOffset( PlayerNumber pn, float fNoteBeat )
+9 -8
View File
@@ -16,6 +16,7 @@
#include "GameState.h"
#include "IniFile.h"
#include "RageMath.h"
#include <math.h>
inline float GetOffScreenLeft( Actor* pActor ) { return SCREEN_LEFT - pActor->GetZoomedWidth()/2; }
@@ -192,7 +193,7 @@ found_effect:
{
m_Sprites[i].Load( sPath );
m_Sprites[i].SetZoom( randomf(0.2f,2) );
m_Sprites[i].SetRotation( randomf(0,D3DX_PI*2) );
m_Sprites[i].SetRotation( randomf(0,PI*2) );
}
}
break;
@@ -232,8 +233,8 @@ found_effect:
case EFFECT_TILE_PULSE:
{
m_Sprites[0].Load( sPath );
int iNumTilesWide = int(ceil(SCREEN_WIDTH /m_Sprites[0].GetUnzoomedWidth()));
int iNumTilesHigh = int(ceil(SCREEN_HEIGHT/m_Sprites[0].GetUnzoomedHeight()));
int iNumTilesWide = 1+int(SCREEN_WIDTH /m_Sprites[0].GetUnzoomedWidth());
int iNumTilesHigh = 1+int(SCREEN_HEIGHT/m_Sprites[0].GetUnzoomedHeight());
if( m_Effect == EFFECT_TILE_SCROLL_LEFT ||
m_Effect == EFFECT_TILE_SCROLL_RIGHT ) {
iNumTilesWide++;
@@ -304,8 +305,8 @@ void BGAnimationLayer::Update( float fDeltaTime )
{
RageColor color = RageColor(
cosf( fSongBeat+i ) * 0.5f + 0.5f,
cosf( fSongBeat+i + D3DX_PI * 2.0f / 3.0f ) * 0.5f + 0.5f,
cosf( fSongBeat+i + D3DX_PI * 4.0f / 3.0f) * 0.5f + 0.5f,
cosf( fSongBeat+i + PI * 2.0f / 3.0f ) * 0.5f + 0.5f,
cosf( fSongBeat+i + PI * 4.0f / 3.0f) * 0.5f + 0.5f,
1.0f
);
m_Sprites[i].SetDiffuse( color );
@@ -467,19 +468,19 @@ void BGAnimationLayer::Update( float fDeltaTime )
case EFFECT_TILE_FLIP_X:
for( i=0; 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;
case EFFECT_TILE_FLIP_Y:
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;
case EFFECT_TILE_PULSE:
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;
default:
+1
View File
@@ -14,6 +14,7 @@
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "GameState.h"
#include "ThemeManager.h"
#define NORMAL_COLOR_TOP THEME->GetMetricC("BPMDisplay","NormalColorTop")
+2 -1
View File
@@ -15,6 +15,7 @@
#include "PrefsManager.h"
#include "SongManager.h"
#include "RageBitmapTexture.h"
#include "ThemeManager.h"
Banner::Banner()
{
@@ -39,7 +40,7 @@ void Banner::Update( float fDeltaTime )
m_fPercentScrolling += fDeltaTime/2;
m_fPercentScrolling -= (int)m_fPercentScrolling;
RectF *pTextureRect = m_pTexture->GetTextureCoordRect(0);
const RectF *pTextureRect = m_pTexture->GetTextureCoordRect(0);
float fTexCoords[8] =
{
+1
View File
@@ -15,6 +15,7 @@
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "RageLog.h"
#include "ThemeManager.h"
+20 -21
View File
@@ -16,7 +16,10 @@
#include "RageLog.h"
#include "RageException.h"
#include "RageTimer.h"
#include "RageDisplay.h"
#include "PrefsManager.h"
#include "ThemeManager.h"
#include "GameConstantsAndTypes.h"
#define RAINBOW_COLOR_1 THEME->GetMetricC("BitmapText","RainbowColor1")
@@ -188,11 +191,13 @@ void BitmapText::CropToWidth( int iMaxWidthInSourcePixels )
// draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale
void BitmapText::DrawPrimitives()
{
// offset so that pixels are aligned to texels
if( PREFSMAN->m_iDisplayResolution == 320 )
DISPLAY->TranslateLocal( -1, -1, 0 );
else
DISPLAY->TranslateLocal( -0.5f, -0.5f, 0 );
// Offset so that pixels are aligned to texels
// Offset by -0.5, -0.5 if 640x480
// Offset by -1.0, -1.0 if 320x240
DISPLAY->TranslateLocal(
-0.5f*SCREEN_WIDTH/(float)PREFSMAN->m_iDisplayWidth,
-0.5f*SCREEN_HEIGHT/(float)PREFSMAN->m_iDisplayHeight,
0 );
if( m_iNumLines == 0 )
return;
@@ -251,9 +256,9 @@ void BitmapText::DrawPrimitives()
// set vertex positions
//
v[iNumV++].p = RageVector3( (float)iX-iDrawExtraPixelsLeft, iY-iHeight/2.0f, 0 ); // top left
v[iNumV++].p = RageVector3( (float)iX-iDrawExtraPixelsLeft+iCharWidth+iDrawExtraPixelsRight, iY-iHeight/2.0f, 0 ); // top right
v[iNumV++].p = RageVector3( (float)iX-iDrawExtraPixelsLeft, iY+iHeight/2.0f, 0 ); // bottom left
v[iNumV++].p = RageVector3( (float)iX-iDrawExtraPixelsLeft+iCharWidth+iDrawExtraPixelsRight, iY+iHeight/2.0f, 0 ); // bottom right
v[iNumV++].p = RageVector3( (float)iX-iDrawExtraPixelsLeft+iCharWidth+iDrawExtraPixelsRight, iY-iHeight/2.0f, 0 ); // top right
iX += iCharWidth;
@@ -275,9 +280,9 @@ void BitmapText::DrawPrimitives()
const float fExtraTexCoordsRight = iDrawExtraPixelsRight / (float)pTexture->GetSourceWidth();
v[iNumV++].t = RageVector2( frectTexCoords.left - fExtraTexCoordsLeft, frectTexCoords.top ); // top left
v[iNumV++].t = RageVector2( frectTexCoords.right + fExtraTexCoordsRight, frectTexCoords.top ); // top right
v[iNumV++].t = RageVector2( frectTexCoords.left - fExtraTexCoordsLeft, frectTexCoords.bottom ); // bottom left
v[iNumV++].t = RageVector2( frectTexCoords.right + fExtraTexCoordsRight, frectTexCoords.bottom ); // bottom right
v[iNumV++].t = RageVector2( frectTexCoords.right + fExtraTexCoordsRight, frectTexCoords.top ); // top right
}
iY += iLineSpacing;
@@ -285,10 +290,7 @@ void BitmapText::DrawPrimitives()
DISPLAY->SetTexture( pTexture );
DISPLAY->SetColorTextureMultDiffuse();
DISPLAY->SetAlphaTextureMultDiffuse();
DISPLAY->SetTextureModeModulate();
if( m_bBlendAdd )
DISPLAY->SetBlendModeAdd();
else
@@ -310,8 +312,7 @@ void BitmapText::DrawPrimitives()
int i;
for( i=0; i<iNumV; i++ )
v[i].c = dwColor;
for( i=0; i<iNumV; i+=4 )
DISPLAY->AddQuad( &v[i] );
DISPLAY->DrawQuads( v, iNumV );
DISPLAY->PopMatrix();
}
@@ -336,14 +337,13 @@ void BitmapText::DrawPrimitives()
for( int i=0; i<iNumV; i+=4 )
{
v[i+0].c = m_temp.diffuse[0]; // top left
v[i+1].c = m_temp.diffuse[1]; // top right
v[i+2].c = m_temp.diffuse[2]; // bottom left
v[i+3].c = m_temp.diffuse[3]; // bottom right
v[i+1].c = m_temp.diffuse[2]; // bottom left
v[i+2].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->AddQuad( &v[i] );
DISPLAY->DrawQuads( v, iNumV );
}
//////////////////////
@@ -351,13 +351,12 @@ void BitmapText::DrawPrimitives()
//////////////////////
if( m_temp.glow.a != 0 )
{
DISPLAY->SetColorDiffuse();
DISPLAY->SetTextureModeGlow();
int i;
for( i=0; i<iNumV; i++ )
v[i].c = m_temp.glow;
for( i=0; i<iNumV; i+=4 )
DISPLAY->AddQuad( &v[i] );
DISPLAY->DrawQuads( v, iNumV );
}
}
+2 -2
View File
@@ -15,8 +15,8 @@
#include "Font.h"
const int MAX_TEXT_LINES = 40;
const int MAX_TEXT_CHARS = MAX_NUM_QUADS;
const int MAX_TEXT_LINES = 40;
const int MAX_TEXT_CHARS = 2000;
class BitmapText : public Actor
{
+1
View File
@@ -15,6 +15,7 @@
#include "ScreenManager.h"
#include "ScreenGameplay.h"
#include "GameState.h"
#include "ThemeManager.h"
void Combo::Reset()
+1
View File
@@ -21,6 +21,7 @@
#include "MsdFile.h"
#include "PlayerOptions.h"
#include "SongOptions.h"
#include "RageUtil.h"
void Course::LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs )
+4
View File
@@ -18,6 +18,10 @@
#include "PrefsManager.h"
#include "Course.h"
#include "SongManager.h"
#include <math.h>
#include "RageDisplay.h"
#include "ThemeManager.h"
#include "Notes.h"
const float TEXT_BANNER_X = 0;
+2
View File
@@ -14,6 +14,8 @@
#include "RageUtil.h"
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "ThemeManager.h"
#include "Notes.h"
const int NUM_FEET_IN_METER = 10;
+3
View File
@@ -27,6 +27,9 @@
#define CENTER_X (SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT)/2.0f)
#define CENTER_Y (SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP)/2.0f)
#define SCREEN_NEAR (-1000)
#define SCREEN_FAR (1000)
/////////////////////////
// Note definitions
/////////////////////////
+3 -6
View File
@@ -15,12 +15,9 @@
#include "GameConstantsAndTypes.h"
#include "GameState.h"
#include "GameInput.h" // for GameButton constants
#ifndef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION 0x0800
#endif
#include <dinput.h> // for DIK_* key codes
#include "IniFile.h"
#include "RageLog.h"
#include "RageUtil.h"
GameManager* GAMEMAN = NULL; // global and accessable from anywhere in our program
@@ -1193,11 +1190,11 @@ void GameManager::GetGameplayStylesForGame( Game game, CArray<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++ )
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 )
+2 -12
View File
@@ -14,20 +14,10 @@
#include "StyleDef.h"
#include "Style.h"
#include "Game.h"
#include "ModeChoice.h"
class IniFile;
struct ModeChoice // used in SelectMode
{
Game game;
PlayMode pm;
Style style;
Difficulty dc;
char name[64];
int numSidesJoinedToPlay;
};
class GameManager
{
public:
@@ -38,7 +28,7 @@ public:
const StyleDef* GetStyleDefForStyle( Style s );
void GetGameplayStylesForGame( Game game, CArray<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 GetGameNames( CStringArray &AddTo );
+1
View File
@@ -17,6 +17,7 @@
#include "InputMapper.h"
#include "Song.h"
#include "RageLog.h"
#include "ThemeManager.h"
GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program
+1
View File
@@ -13,6 +13,7 @@
#include "GhostArrow.h"
#include "PrefsManager.h"
#include "ThemeManager.h"
#define SHOW_SECONDS THEME->GetMetricF("GhostArrow","ShowSeconds")
+1
View File
@@ -13,6 +13,7 @@
#include "GhostArrowBright.h"
#include "PrefsManager.h"
#include "ThemeManager.h"
#define SHOW_SECONDS THEME->GetMetricF("GhostArrowBright","ShowSeconds")
+1
View File
@@ -14,6 +14,7 @@
#include "RageUtil.h"
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "ThemeManager.h"
const float SCROLL_TIME = 5.0f;
+1 -2
View File
@@ -10,11 +10,10 @@
-----------------------------------------------------------------------------
*/
#include "Sprite.h"
#include "PrefsManager.h"
#include "Grade.h"
#include "GameConstantsAndTypes.h"
class GradeDisplay : public Sprite
+2
View File
@@ -14,6 +14,8 @@
#include "GrayArrow.h"
#include "PrefsManager.h"
#include "GameState.h"
#include <math.h>
#include "ThemeManager.h"
#define STEP_SECONDS THEME->GetMetricF("GrayArrow","StepSeconds")
+5 -6
View File
@@ -16,8 +16,8 @@
#include "PrefsManager.h"
#include "RageBitmapTexture.h"
#include "GameConstantsAndTypes.h"
#include "ThemeManager.h"
#include "Notes.h"
#define LABEL_OFFSET_X( i ) THEME->GetMetricF("GrooveRadar",ssprintf("Label%dOffsetX",i+1))
@@ -140,8 +140,7 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives()
const float fRadius = m_sprRadarBase.GetZoomedHeight()/2.0f*1.1f;
DISPLAY->SetTexture( NULL );
DISPLAY->SetColorTextureMultDiffuse();
DISPLAY->SetAlphaTextureMultDiffuse();
DISPLAY->SetTextureModeModulate();
RageVertex v[12]; // needed to draw 5 fan primitives and 10 strip primitives
for( int p=0; p<NUM_PLAYERS; p++ )
@@ -172,7 +171,7 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives()
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;
}
DISPLAY->AddStrip( v, 10 );
DISPLAY->DrawStrip( v, 12 );
}
}
+1
View File
@@ -15,6 +15,7 @@
#include "PrefsManager.h"
#include "RageException.h"
#include "RageTimer.h"
#include <math.h>
const float HOLD_GHOST_ARROW_TWEEN_TIME = 0.5f;
+1
View File
@@ -14,6 +14,7 @@
#include "RageUtil.h"
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "ThemeManager.h"
//
+1
View File
@@ -15,6 +15,7 @@
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "GameState.h"
#include "ThemeManager.h"
const float JUDGEMENT_DISPLAY_TIME = 0.8f;
+4 -1
View File
@@ -15,6 +15,9 @@
#include "RageException.h"
#include "RageTimer.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_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) );
ActorFrame::DrawPrimitives();
+2
View File
@@ -13,6 +13,8 @@
#include "LifeMeterBattery.h"
#include "PrefsManager.h"
#include "GameState.h"
#include "ThemeManager.h"
#include "Notes.h"
const float BATTERY_X[NUM_PLAYERS] = { -92, +92 };
+1
View File
@@ -21,6 +21,7 @@
#include "RageLog.h"
#include "GameManager.h"
#include "GameState.h"
#include "ThemeManager.h"
#define TOP_EDGE_X THEME->GetMetricF("MenuElements","TopEdgeX")
+1
View File
@@ -16,6 +16,7 @@
#include "PrefsManager.h"
#include "ScreenManager.h"
#include "AnnouncerManager.h"
#include "ThemeManager.h"
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 "MusicWheel.h"
#include "MusicSortDisplay.h"
#include "ThemeManager.h"
MusicSortDisplay::MusicSortDisplay()
+2 -1
View File
@@ -16,7 +16,8 @@
#include "MusicWheel.h"
#include "MusicStatusDisplay.h"
#include "RageTimer.h"
#include <math.h>
#include "ThemeManager.h"
MusicStatusDisplay::MusicStatusDisplay()
+2
View File
@@ -20,6 +20,8 @@
#include "RageLog.h"
#include "GameConstantsAndTypes.h"
#include "GameState.h"
#include <math.h>
#include "ThemeManager.h"
// WheelItem stuff
+27 -25
View File
@@ -21,6 +21,8 @@
#include "RageException.h"
#include "ArrowEffects.h"
#include "RageLog.h"
#include <math.h>
#include "RageDisplay.h"
bool g_bDrawHoldHeadForTapsOnSameRow, g_bDrawTapOnTopOfHoldHead, g_bDrawTapOnTopOfHoldTail; // cache
@@ -221,14 +223,14 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
const int fYStep = 8; // draw a segment every 8 pixels // this requires that the texture dimensions be a multiple of 8
DISPLAY->SetBlendModeNormal();
if( bDrawGlowOnly )
DISPLAY->SetColorDiffuse();
else
DISPLAY->SetColorTextureMultDiffuse();
DISPLAY->SetAlphaTextureMultDiffuse();
DISPLAY->EnableTextureWrapping();
DISPLAY->SetTexture( m_sprHoldParts.GetTexture() );
// DISPLAY->SetBlendModeNormal();
// if( bDrawGlowOnly )
// DISPLAY->SetColorDiffuse();
// else
// DISPLAY->SetColorTextureMultDiffuse();
// DISPLAY->SetAlphaTextureMultDiffuse();
// DISPLAY->EnableTextureWrapping();
// DISPLAY->SetTexture( m_sprHoldParts.GetTexture() );
//
// Draw the tail
@@ -269,11 +271,13 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
if( !bDrawGlowOnly && colorDiffuseTop.a==0 && colorDiffuseBottom.a==0 )
continue;
DISPLAY->AddQuad(
RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordLeft, fTexCoordTop), // colorGlowTop, // top-left
RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordRight, fTexCoordTop), // colorGlowTop, // top-right
RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordLeft, fTexCoordBottom),// colorGlowBottom, // bottom-left
RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordRight, fTexCoordBottom) );//, colorGlowBottom ); // bottom-right
static RageVertex v[4];
v[0].p = RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0); v[0].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[0].t = RageVector2(fTexCoordLeft, fTexCoordTop),
v[1].p = RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0); v[1].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[1].t = RageVector2(fTexCoordRight, fTexCoordTop);
v[2].p = RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0); v[2].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordLeft, fTexCoordBottom);
v[3].p = RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0); v[3].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[3].t = RageVector2(fTexCoordRight, fTexCoordBottom);
DISPLAY->DrawQuad( v );
}
//
@@ -310,11 +314,11 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
if( !bDrawGlowOnly && colorDiffuseTop.a==0 && colorDiffuseBottom.a==0 )
continue;
DISPLAY->AddQuad(
RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordLeft, fTexCoordTop), //colorGlowTop, // top-left
RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordRight, fTexCoordTop), //colorGlowTop, // top-right
RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordLeft, fTexCoordBottom), //colorGlowBottom, // bottom-left
RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordRight, fTexCoordBottom) );//, colorGlowBottom ); // bottom-right
static RageVertex v[4];
v[0].p = RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0); v[0].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[2].t = RageVector2(fTexCoordLeft, fTexCoordTop);
v[1].p = RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0); v[1].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[2].t = RageVector2(fTexCoordRight, fTexCoordTop);
v[2].p = RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0); v[2].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordLeft, fTexCoordBottom);
v[3].p = RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0); v[3].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordRight, fTexCoordBottom);
}
if( g_bDrawTapOnTopOfHoldHead )
@@ -357,14 +361,12 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
if( !bDrawGlowOnly && colorDiffuseTop.a==0 && colorDiffuseBottom.a==0 )
continue;
DISPLAY->AddQuad(
RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordLeft, fTexCoordTop), // colorGlowTop, // top-left
RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0), bDrawGlowOnly ? colorGlowTop : colorDiffuseTop, RageVector2(fTexCoordRight, fTexCoordTop), // colorGlowTop, // top-right
RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordLeft, fTexCoordBottom),// colorGlowBottom, // bottom-left
RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0), bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom, RageVector2(fTexCoordRight, fTexCoordBottom) );//, colorGlowBottom ); // bottom-right
static RageVertex v[4];
v[0].p = RageVector3(fXTopLeft-0.5f, fYTop-0.5f, 0); v[0].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[2].t = RageVector2(fTexCoordLeft, fTexCoordTop);
v[0].p = RageVector3(fXTopRight-0.5f, fYTop-0.5f, 0); v[0].c = bDrawGlowOnly ? colorGlowTop : colorDiffuseTop; v[2].t = RageVector2(fTexCoordRight, fTexCoordTop);
v[0].p = RageVector3(fXBottomLeft-0.5f, fYBottom-0.5f,0); v[0].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordLeft, fTexCoordBottom);
v[0].p = RageVector3(fXBottomRight-0.5f,fYBottom-0.5f,0); v[0].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordRight, fTexCoordBottom);
}
DISPLAY->FlushQueue();
}
else
{
+2
View File
@@ -21,6 +21,8 @@
#include "RageException.h"
#include "RageTimer.h"
#include "RageLog.h"
#include <math.h>
#include "ThemeManager.h"
const float HOLD_NOTE_BITS_PER_BEAT = 6;
+27 -22
View File
@@ -24,6 +24,8 @@
#include "ScoreKeeperMAX2.h"
#include "RageLog.h"
#include "RageMath.h"
#include "RageDisplay.h"
#include "ThemeManager.h"
#include "Combo.h"
#define JUDGE_PERFECT_ZOOM_X THEME->GetMetricF("Player","JudgePerfectZoomX")
@@ -298,26 +300,28 @@ void Player::DrawPrimitives()
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_bEffects[PlayerOptions::EFFECT_SPACE] )
{
// save old view and projection
DISPLAY->GetViewTransform( &matOldView );
DISPLAY->GetProjectionTransform( &matOldProj );
// construct view and project matrix
RageMatrix matNewView;
RageVector3 Eye, At, Up( 0.0f, -1.0f, 0.0f );
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_bReverseScroll ) {
Eye = RageVector3( CENTER_X, GetY()-300.0f, 400.0f );
At = RageVector3( CENTER_X, GetY()+100.0f, 0.0f );
} else {
Eye = RageVector3( CENTER_X, GetY()+800.0f, 400.0f );
At = RageVector3( CENTER_X, GetY()+400.0f, 0.0f );
}
RageMatrixLookAtLH( &matNewView, &Eye, &At, &Up );
DISPLAY->SetViewTransform( &matNewView );
RageMatrix matNewProj;
RageMatrixPerspectiveFovLH( &matNewProj, D3DX_PI/4.0f, SCREEN_WIDTH/(float)SCREEN_HEIGHT, 0.0f, 1000.0f );
DISPLAY->SetProjectionTransform( &matNewProj );
// TODO: Re-add this code
// DISPLAY->GetViewTransform( &matOldView );
// DISPLAY->GetProjectionTransform( &matOldProj );
//
// // construct view and project matrix
// RageMatrix matNewView;
// RageVector3 Eye, At, Up( 0.0f, -1.0f, 0.0f );
// if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_bReverseScroll ) {
// Eye = RageVector3( CENTER_X, GetY()-300.0f, 400.0f );
// At = RageVector3( CENTER_X, GetY()+100.0f, 0.0f );
// } else {
// Eye = RageVector3( CENTER_X, GetY()+800.0f, 400.0f );
// At = RageVector3( CENTER_X, GetY()+400.0f, 0.0f );
// }
// RageMatrixLookAtLH( &matNewView, &Eye, &At, &Up );
//
// DISPLAY->SetViewTransform( &matNewView );
//
// RageMatrix matNewProj;
// RageMatrixPerspectiveFovLH( &matNewProj, PI/4.0f, SCREEN_WIDTH/(float)SCREEN_HEIGHT, 0.0f, 1000.0f );
// DISPLAY->SetProjectionTransform( &matNewProj );
}
m_GrayArrowRow.Draw();
@@ -326,9 +330,10 @@ void Player::DrawPrimitives()
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_bEffects[PlayerOptions::EFFECT_SPACE] )
{
// restire old view and projection
DISPLAY->SetViewTransform( &matOldView );
DISPLAY->SetProjectionTransform( &matOldProj );
// TODO: Re-add this code
// // restire old view and projection
// DISPLAY->SetViewTransform( &matOldView );
// DISPLAY->SetProjectionTransform( &matOldProj );
}
m_frameJudgement.Draw();
+18 -24
View File
@@ -16,6 +16,9 @@
#include "GameState.h"
#include "RageException.h"
#include "RageDisplay.h"
#include "RageUtil.h"
#include "AnnouncerManager.h"
#include "ThemeManager.h"
PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program
@@ -28,9 +31,11 @@ PrefsManager::PrefsManager()
#else
m_bWindowed = false;
#endif
m_iDisplayResolution = 640;
m_iTextureResolution = 1024;
m_iRefreshRate = RageDisplay::REFRESH_DEFAULT;
m_iDisplayWidth = 640;
m_iDisplayHeight = 480;
m_iDisplayColorDepth = 16;
m_iTextureColorDepth = 16;
m_iRefreshRateMode = REFRESH_DEFAULT;
m_bIgnoreJoyAxes = true;
m_bOnlyDedicatedMenuButtons = false;
#ifdef _DEBUG
@@ -80,9 +85,11 @@ PrefsManager::~PrefsManager()
return; // could not read config file, load nothing
ini.GetValueB( "Options", "Windowed", m_bWindowed );
ini.GetValueI( "Options", "DisplayResolution", m_iDisplayResolution );
ini.GetValueI( "Options", "TextureResolution", m_iTextureResolution );
ini.GetValueI( "Options", "RefreshRate", m_iRefreshRate );
ini.GetValueI( "Options", "DisplayWidth", m_iDisplayWidth );
ini.GetValueI( "Options", "DisplayHeight", m_iDisplayHeight );
ini.GetValueI( "Options", "DisplayColorDepth", m_iDisplayColorDepth );
ini.GetValueI( "Options", "TextureColorDepth", m_iTextureColorDepth );
ini.GetValueI( "Options", "RefreshRate", (int&)m_iRefreshRateMode );
ini.GetValueB( "Options", "IgnoreJoyAxes", m_bIgnoreJoyAxes );
ini.GetValueB( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons );
ini.GetValueB( "Options", "ShowStats", m_bShowStats );
@@ -129,9 +136,11 @@ void PrefsManager::SaveGlobalPrefsToDisk()
ini.SetPath( "StepMania.ini" );
ini.SetValueB( "Options", "Windowed", m_bWindowed );
ini.SetValueI( "Options", "DisplayResolution", m_iDisplayResolution );
ini.SetValueI( "Options", "TextureResolution", m_iTextureResolution );
ini.SetValueI( "Options", "RefreshRate", m_iRefreshRate );
ini.SetValueI( "Options", "DisplayWidth", m_iDisplayWidth );
ini.SetValueI( "Options", "DisplayHeight", m_iDisplayHeight );
ini.SetValueI( "Options", "DisplayColorDepth", m_iDisplayColorDepth );
ini.SetValueI( "Options", "TextureColorDepth", m_iTextureColorDepth );
ini.SetValueI( "Options", "RefreshRate", m_iRefreshRateMode );
ini.SetValueB( "Options", "IgnoreJoyAxes", m_bIgnoreJoyAxes );
ini.SetValueB( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons );
ini.SetValueB( "Options", "ShowStats", m_bShowStats );
@@ -204,18 +213,3 @@ void PrefsManager::SaveGamePrefsToDisk()
ini.WriteFile();
}
int PrefsManager::GetDisplayHeight()
{
switch( m_iDisplayResolution )
{
case 1280: return 1024; break;
case 1024: return 768; break;
case 800: return 600; break;
case 640: return 480; break;
case 512: return 384; break;
case 400: return 300; break;
case 320: return 240; break;
default: throw RageException( "Invalid DisplayWidth '%d'", m_iDisplayResolution );
}
}
+5 -12
View File
@@ -10,13 +10,6 @@
-----------------------------------------------------------------------------
*/
#include "GameConstantsAndTypes.h"
#include "AnnouncerManager.h"
#include "ThemeManager.h"
#include "GameManager.h"
class PrefsManager
{
@@ -28,9 +21,11 @@ public:
// GameOptions (ARE saved between sessions)
bool m_bWindowed;
int m_iDisplayResolution;
int m_iTextureResolution;
int m_iRefreshRate; // 0 means 'default'
int m_iDisplayWidth;
int m_iDisplayHeight;
int m_iDisplayColorDepth;
int m_iTextureColorDepth;
int m_iRefreshRateMode;
bool m_bShowStats;
BackgroundMode m_BackgroundMode;
float m_fBGBrightness;
@@ -60,8 +55,6 @@ public:
CStringArray m_asAdditionalSongFolders;
CString m_DWIPath;
int GetDisplayHeight();
void ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame );
void SaveGlobalPrefsToDisk();
+6 -6
View File
@@ -10,14 +10,14 @@
-----------------------------------------------------------------------------
*/
#include "Actor.h"
#include "Sprite.h"
class Quad : public Actor
class Quad : public Sprite
{
public:
Quad();
virtual void DrawPrimitives();
Quad()
{
m_bDrawIfTextureNull = true;
}
};
+35 -381
View File
@@ -15,6 +15,7 @@
#include "RageUtil.h"
#include "RageLog.h"
#include "RageException.h"
#include "RageTextureManager.h"
#include "SDL.h"
#include "SDL_image.h"
@@ -22,183 +23,43 @@
#include "SDL_rotozoom.h"
#include "SDL_utils.h"
#include "SDL_dither.h"
#include "SDL_opengl.h"
#include "RageTimer.h"
/* Definitions for various texture formats. We'll probably want RGBA
* in OpenGL, not ARGB ... All of these are in local (little) endian;
* this may or may not need adjustment for OpenGL. */
const static unsigned int PixFmtMasks[][5] =
{
/* Err. D3D's texture formats are little-endian, so the order of
* colors (bytewise) is BGRA; D3DFMT_A8R8G8B8 is really BGRA (bytewise).
* D3DFMT_A4R4G4B4 is 0xGBAR; flip the bytes and it's sane (0xARGB).
*/
{ 0x00FF0000, /* B8G8R8A8 */
0x0000FF00,
0x000000FF,
0xFF000000, 32 },
{ 0x0F00, /* B4G4R4A4 */
0x00F0,
0x000F,
0xF000, 16 },
{ 0x7C00, /* B5G5R5A1 */
0x03E0,
0x001F,
0x8000, 16 },
{ 0xF800, /* B5G6R5 */
0x07E0,
0x001F,
0x0000, 16 }
};
int PixFmtMaskNo(D3DFORMAT fmt)
{
switch(fmt) {
case D3DFMT_A8R8G8B8: return 0;
case D3DFMT_A4R4G4B4: return 1;
case D3DFMT_A1R5G5B5: return 2;
case D3DFMT_R5G6B5: return 3;
default: ASSERT(0); return 0;
}
}
//-----------------------------------------------------------------------------
// RageBitmapTexture constructor
//-----------------------------------------------------------------------------
RageBitmapTexture::RageBitmapTexture(
RageDisplay* pScreen,
const CString &sFilePath,
int dwMaxSize,
int dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch
) :
RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch )
RageBitmapTexture::RageBitmapTexture( const CString &sFilePath ) : RageTexture( sFilePath )
{
// LOG->Trace( "RageBitmapTexture::RageBitmapTexture()" );
m_pd3dTexture = NULL;
//if( !LoadFromCacheFile() )
Create( dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch );
//SaveToCache();
CreateFrameRects();
Load( sFilePath );
}
RageBitmapTexture::~RageBitmapTexture()
{
SAFE_RELEASE(m_pd3dTexture);
glDeleteTextures(1, &m_uGLTextureID);
}
void RageBitmapTexture::Reload(
int dwMaxSize,
int dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch
)
{
SAFE_RELEASE(m_pd3dTexture);
Create( dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch );
// leave m_iRefCount alone!
CreateFrameRects();
}
//-----------------------------------------------------------------------------
// GetTexture
//-----------------------------------------------------------------------------
LPDIRECT3DTEXTURE8 RageBitmapTexture::GetD3DTexture()
{
return m_pd3dTexture;
}
#if 1
static int power_of_two(int input)
int power_of_two(int input)
{
int value = 1;
while ( value < input ) value <<= 1;
return value;
}
/*
* Each dwMaxSize, dwTextureColorDepth and iAlphaBits are maximums; we may
* use less. iAlphaBits must be 0, 1 or 4.
*
* XXX: change iAlphaBits == 4 to iAlphaBits == 8 to indicate "as much alpha
* as needed", since that's what it really is; still only use 4 in 16-bit textures.
*
* Dither forces dithering when loading 16-bit textures.
* Stretch forces the loaded image to fill the texture completely.
*/
void RageBitmapTexture::Create(
int dwMaxSize,
int dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch
)
void RageBitmapTexture::Load( const CString &sFilePath )
{
HRESULT hr;
m_sFilePath = sFilePath; // save file path
// look in the file name for a format hints
m_sFilePath.MakeLower();
int iMaxSize = DISPLAY->GetMaxTextureSize();
if( m_sFilePath.Find("no alpha") != -1 ) iAlphaBits = 0;
else if( m_sFilePath.Find("1 alpha") != -1 ) iAlphaBits = 1;
else if( m_sFilePath.Find("1alpha") != -1 ) iAlphaBits = 1;
else if( m_sFilePath.Find("0alpha") != -1 ) iAlphaBits = 0;
if( m_sFilePath.Find("dither") != -1 ) bDither = true;
SDL_Surface *img;
/* Load the image into an SDL surface. */
SDL_Surface *img = IMG_Load(m_sFilePath);
/* Figure out which texture format to use. */
D3DFORMAT fmtTexture;
if( dwTextureColorDepth == 16 ) {
/* Bits of alpha in the source: */
int src_alpha_bits = 8 - img->format->Aloss;
/* No real alpha in paletted input. */
if( img->format->BytesPerPixel == 1 )
src_alpha_bits = 0;
/* Colorkeyed input effectively has at least one bit of alpha: */
if( img->flags & SDL_SRCCOLORKEY )
src_alpha_bits = max( 1, src_alpha_bits );
/* Don't use more than we were hinted to. */
src_alpha_bits = min( iAlphaBits, src_alpha_bits );
/* XXX Scan the image, and see if it actually uses its alpha channel/color key
* (if any). Reduce to 1 or 0 bits of alpha if possible. */
switch( src_alpha_bits ) {
case 0: fmtTexture = D3DFMT_R5G6B5; break;
case 1: fmtTexture = D3DFMT_A1R5G5B5; break;
default: fmtTexture = D3DFMT_A4R4G4B4; break;
}
} else if( dwTextureColorDepth == 32 )
fmtTexture = D3DFMT_A8R8G8B8;
else
throw RageException( "Invalid color depth: %d bits", dwTextureColorDepth );
/* Cap the max texture size to the hardware max. Is this needed--won't the
* texture creation do this for us? */
dwMaxSize = min( dwMaxSize, int(DISPLAY->GetDeviceCaps().MaxTextureWidth) );
img = IMG_Load(sFilePath);
if(!img)
throw RageException("Could not load graphic '%s'", sFilePath.GetString());
/* Save information about the source. Unless something else changes this
* later, the image inside the texture is the same size as the source. */
@@ -209,88 +70,6 @@ void RageBitmapTexture::Create(
m_iTextureWidth = power_of_two(img->w);
m_iTextureHeight = power_of_two(img->h);
/* Cap the size. */
m_iTextureWidth = min(m_iTextureWidth, int(dwMaxSize));
m_iTextureHeight = min(m_iTextureHeight, int(dwMaxSize));
if( FAILED( hr = m_pd3dDevice->CreateTexture(
m_iTextureWidth, // width
m_iTextureHeight, // height
1, // mip map levels XXX: sending 4 breaks 2x2 pngs
0, // usage (is a render target?)
fmtTexture, // our preferred texture format
D3DPOOL_MANAGED, // which memory pool
&m_pd3dTexture) ))
{
throw RageException( hr, "CreateTexture() failed for file '%s'.", m_sFilePath.GetString() );
}
{
D3DSURFACE_DESC ddsd;
if ( FAILED( hr = m_pd3dTexture->GetLevelDesc( 0, &ddsd ) ) )
throw RageException( hr, "Could not get level Description of D3D texture!" );
/* We might have received a texture of a different size or format than
* we asked for. */
m_iTextureWidth = ddsd.Width;
m_iTextureHeight = ddsd.Height;
fmtTexture = ddsd.Format;
}
/* If the source is larger than the texture, we have to scale it down; that's
* "stretching", I guess. */
if(m_iSourceWidth > m_iTextureWidth || m_iSourceHeight > m_iTextureHeight)
bStretch = true;
int target = PixFmtMaskNo(fmtTexture);
/* Dither only when the target is 16bpp, not when it's 32bpp. */
if( PixFmtMasks[target][4] /* XXX magic 4 */ == 4)
bDither = false;
if( bStretch ) {
/* zoomSurface takes a ratio. I'm not sure if it's always exact; we don't
* want to accidentally create a 513x513 texture, for example (it won't just
* cause lines; it'll be copied to the texture completely wrong). */
/* resize currently only does RGBA8888 */
{
int mask = 0;
ConvertSDLSurface(img, img->w, img->h, PixFmtMasks[mask][4],
PixFmtMasks[mask][0], PixFmtMasks[mask][1], PixFmtMasks[mask][2], PixFmtMasks[mask][3]);
}
while (m_iImageWidth != m_iTextureWidth || m_iImageHeight != m_iTextureHeight) {
float xscale = float(m_iTextureWidth)/m_iImageWidth;
float yscale = float(m_iTextureHeight)/m_iImageHeight;
/* Our filter is a simple linear filter, so it can't scale to
* less than .5 very well. If we need to go lower than .5, do
* it iteratively. */
xscale = max(xscale, .5f);
yscale = max(yscale, .5f);
SDL_Surface *dst = zoomSurface(img, xscale, yscale);
SDL_FreeSurface(img);
img = dst;
/* The new image size is the full texture size. */
m_iImageWidth = int(m_iImageWidth * xscale + .0001);
m_iImageHeight = int(m_iImageHeight * yscale + .0001);
}
}
if( bDither )
{
/* Dither down to the destination format. */
SDL_Surface *dst = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, img->w, img->h, PixFmtMasks[target][4],
PixFmtMasks[target][0], PixFmtMasks[target][1], PixFmtMasks[target][2], PixFmtMasks[target][3]);
SM_SDL_OrderedDither(img, dst);
SDL_FreeSurface(img);
img = dst;
}
/* Convert the data to the destination format. Hmm. We could just
* convert the format, leaving the resolution alone (simplifying
@@ -300,160 +79,35 @@ void RageBitmapTexture::Create(
* We don't want anything else to be linearly filtered in on the
* edge of the texture ...
*/
ConvertSDLSurface(img, m_iTextureWidth, m_iTextureHeight, PixFmtMasks[target][4],
PixFmtMasks[target][0], PixFmtMasks[target][1], PixFmtMasks[target][2], PixFmtMasks[target][3]);
ConvertSDLSurface(img, m_iTextureWidth, m_iTextureHeight, 32,
0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 );
/* Copy the data to the target texture. */
{
D3DLOCKED_RECT d3dlr;
if( FAILED( hr=m_pd3dTexture->LockRect(0, &d3dlr, 0, 0) ) )
throw RageException( hr, "LockRect failed for file '%s'.", m_sFilePath.GetString() );
memcpy( (byte *)(d3dlr.pBits), img->pixels, img->h*img->pitch );
ASSERT( !FAILED( m_pd3dTexture->UnlockRect(0) ) ) ;
}
glGenTextures(1, &m_uGLTextureID);
DISPLAY->FlushQueue();
glBindTexture(GL_TEXTURE_2D, m_uGLTextureID);
glPixelStorei(GL_UNPACK_ROW_LENGTH, img->pitch / img->format->BytesPerPixel);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, img->w, img->h, 0, GL_RGBA,
GL_UNSIGNED_BYTE, img->pixels);
glFlush();
SDL_FreeSurface(img);
LOG->Trace( "RageBitmapTexture: Loaded '%s' (%ux%u) from disk. bStretch = %d, source %d,%d; image %d,%d.",
m_sFilePath.GetString(), GetTextureWidth(), GetTextureHeight(),
bStretch, m_iSourceWidth, m_iSourceHeight,
m_iImageWidth, m_iImageHeight);
CreateFrameRects();
}
#else
#include "DXUtil.h"
#include "dxerr8.h"
void RageBitmapTexture::Create(
int dwMaxSize,
int dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch
)
void RageBitmapTexture::Reload()
{
HRESULT hr;
glDeleteTextures(1, &m_uGLTextureID);
// look in the file name for a format hints
m_sFilePath.MakeLower();
if( -1 != m_sFilePath.Find("no alpha") )
iAlphaBits = 0;
else if( -1 != m_sFilePath.Find("1 alpha") )
iAlphaBits = 1;
else if( -1 != m_sFilePath.Find("1alpha") )
iAlphaBits = 1;
else if( -1 != m_sFilePath.Find("0alpha") )
iAlphaBits = 0;
if( -1 != m_sFilePath.Find("dither") )
bDither = true;
/////////////////////
// Get info about the bitmap
/////////////////////
D3DXIMAGE_INFO ddii;
if( FAILED( hr = D3DXGetImageInfoFromFile(m_sFilePath,&ddii) ) )
{
throw RageException( hr, "D3DXGetImageInfoFromFile() failed for file '%s'.", m_sFilePath.GetString() );
}
///////////////////////
// Figure out which texture format to use
///////////////////////
D3DFORMAT fmtTexture;
if( dwTextureColorDepth == 32 )
fmtTexture = D3DFMT_A8R8G8B8;
else if( ddii.Format == D3DFMT_P8 )
fmtTexture = D3DFMT_A1R5G5B5;
else // dwTextureColorDepth == 16
{
switch( iAlphaBits )
{
case 0: fmtTexture = D3DFMT_R5G6B5; break;
case 1: fmtTexture = D3DFMT_A1R5G5B5; break;
case 4: fmtTexture = D3DFMT_A4R4G4B4; break;
default: ASSERT(0); fmtTexture = D3DFMT_A4R4G4B4; break;
}
}
// find out what the min texture size is
dwMaxSize = min( dwMaxSize, int(DISPLAY->GetDeviceCaps().MaxTextureWidth) );
bStretch |= int(ddii.Width) > dwMaxSize || int(ddii.Height) > dwMaxSize;
// HACK: On a Voodoo3 and Win98, D3DXCreateTextureFromFileEx fail randomly on rare occasions.
// So, we'll try the call 2x in a row in case the first one fails.
for( int i=0; i<2; i++ )
{
if( FAILED( hr = D3DXCreateTextureFromFileEx(
m_pd3dDevice, // device
m_sFilePath, // soure file
D3DX_DEFAULT, // width
D3DX_DEFAULT, // height
iMipMaps, // mip map levels
0, // usage (is a render target?)
fmtTexture, // our preferred texture format
D3DPOOL_MANAGED, // which memory pool
(bStretch ? D3DX_FILTER_LINEAR : D3DX_FILTER_NONE) | (bDither ? D3DX_FILTER_DITHER : 0), // filter
D3DX_FILTER_BOX | (bDither ? D3DX_FILTER_DITHER : 0), // mip filter
D3DCOLOR_ARGB(255,255,0,255), // pink color key
&ddii, // struct to fill with source image info
NULL, // no palette
&m_pd3dTexture ) ) )
{
if( i==0 )
{
LOG->Trace( "WARNING! D3DXCreateTextureFromFileEx failed. Sleep and try one more time..." );
::Sleep( 10 );
continue;
}
throw RageException( hr, "D3DXCreateTextureFromFileEx() failed for file '%s'.", m_sFilePath.GetString() );
}
else
break;
}
/////////////////////
// Save information about the texture
/////////////////////
m_iSourceWidth = ddii.Width;
m_iSourceHeight= ddii.Height;
D3DSURFACE_DESC ddsd;
if ( FAILED( hr = m_pd3dTexture->GetLevelDesc( 0, &ddsd ) ) )
throw RageException( hr, "Could not get level Description of D3DX texture!" );
// save information about the texture
m_iTextureWidth = ddsd.Width;
m_iTextureHeight = ddsd.Height;
if( bStretch )
{
m_iImageWidth = m_iTextureWidth;
m_iImageHeight = m_iTextureHeight;
}
else
{
m_iImageWidth = m_iSourceWidth;
m_iImageHeight = m_iSourceHeight;
}
LOG->Trace( "RageBitmapTexture: Loaded '%s' (%ux%u) from disk. bStretch = %d, source %d,%d; image %d,%d.",
m_sFilePath.GetString(),
GetTextureWidth(),
GetTextureHeight(),
bStretch,
m_iSourceWidth,
m_iSourceHeight,
m_iImageWidth,
m_iImageHeight
);
Load( m_sFilePath );
}
#endif
unsigned int RageBitmapTexture::GetGLTextureID()
{
return m_uGLTextureID;
}
+6 -30
View File
@@ -22,39 +22,15 @@
class RageBitmapTexture : public RageTexture
{
public:
RageBitmapTexture(
RageDisplay* pScreen,
const CString &sFilePath,
int dwMaxSize = 2048,
int dwTextureColorDepth = 16,
int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
);
RageBitmapTexture( const CString &sFilePath );
virtual ~RageBitmapTexture();
virtual void Reload(
int dwMaxSize,
int dwTextureColorDepth,
int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
);
virtual LPDIRECT3DTEXTURE8 GetD3DTexture();
protected:
virtual void Load( const CString &sFilePath );
virtual void Reload();
virtual void Create(
int dwMaxSize,
int dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch
);
virtual unsigned int GetGLTextureID();
LPDIRECT3DTEXTURE8 m_pd3dTexture;
unsigned int m_uGLTextureID;
CString m_sFilePath;
};
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;
struct RageMatrix;
struct RageVertex;
#include "RageTypes.h"
enum RefreshRateMode { REFRESH_DEFAULT, REFRESH_MAX, REFRESH_MIN };
class RageDisplay
{
friend class RageTexture;
public:
RageDisplay( HWND hWnd );
RageDisplay( bool windowed, int width, int height, int bpp, RefreshRateMode rate, bool vsync );
~RageDisplay();
enum { REFRESH_DEFAULT=0, REFRESH_MAX=1 };
bool SwitchDisplayMode(
bool bWindowed, int iWidth, int iHeight, int iBPP, int iFullScreenHz, bool bVsync );
// LPDIRECT3D8 GetD3D() { return m_pd3d; };
// inline LPDIRECT3DDEVICE8 GetDevice() { return m_pd3dDevice; };
const D3DCAPS8& GetDeviceCaps() const { return m_DeviceCaps; };
void SetVideoMode( bool windowed, int width, int height, int bpp, RefreshRateMode rate, bool vsync );
HRESULT Reset();
HRESULT BeginFrame();
HRESULT EndFrame();
HRESULT ShowFrame();
HRESULT Invalidate();
HRESULT Restore();
bool IsWindowed() const { return !!m_d3dpp.Windowed; };
unsigned GetWidth() const { return m_d3dpp.BackBufferWidth; };
unsigned GetHeight() const { return m_d3dpp.BackBufferHeight; };
unsigned GetBPP() const { return GetBPP( m_d3dpp.BackBufferFormat ); }
void Clear();
void Flip();
bool IsWindowed() const;
int GetWidth() const;
int GetHeight() const;
int GetBPP() const;
// LPDIRECT3DVERTEXBUFFER8 GetVertexBuffer() { return m_pVB; };
void SetViewTransform( const RageMatrix* pMatrix );
void SetProjectionTransform( const RageMatrix* pMatrix );
void GetViewTransform( RageMatrix* pMatrixOut );
@@ -68,85 +51,28 @@ public:
void RotateX( float r );
void RotateY( float r );
void RotateZ( float r );
// void RotateYawPitchRoll( const float x, const float y, const float z );
int GetFPS() const { return m_iFPS; };
int GetTPF() const { return m_iTPF; };
int GetDPF() const { return m_iDPF; };
void GetHzAtResolution(unsigned width, unsigned height, unsigned bpp, CArray<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 SetColorTextureMultDiffuse();
void SetColorDiffuse();
void SetAlphaTextureMultDiffuse();
void SetTextureModeModulate();
void SetTextureModeGlow();
void SetBlendModeNormal();
void SetBlendModeAdd();
void EnableZBuffer();
void DisableZBuffer();
void EnableTextureWrapping();
void DisableTextureWrapping();
void DrawQuad( const RageVertex v[4] ); // upper-left, upper-right, lower-left, lower-right
void DrawQuads( const RageVertex v[], int iNumVerts );
void DrawFan( const RageVertex v[], int iNumVerts );
void DrawStrip( const RageVertex v[], int iNumVerts );
void FlushQueue();
void GetHzAtResolution(int width, int height, int bpp, CArray<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;
};
#include "crash.h"
//#include "crash.h"
/* Assertion that sets an optional message and brings up the crash handler, so
* we get a backtrace. This should probably be used instead of throwing an
* exception in most cases we expect never to happen (but not in cases that
* we do expect, such as d3d init failure.) */
#define RAGE_ASSERT_M(COND, MESSAGE) { if(!(COND)) { VDCHECKPOINT_M(MESSAGE); *(char*)0=0; } }
#define RAGE_ASSERT(COND) RAGE_ASSERT_M((COND), "Assertion failure")
//#define RAGE_ASSERT_M(COND, MESSAGE) { if(!(COND)) { VDCHECKPOINT_M(MESSAGE); *(char*)0=0; } }
//#define RAGE_ASSERT(COND) RAGE_ASSERT_M((COND), "Assertion failure")
/* Make this the default assert handler. */
#ifdef ASSERT
#undef ASSERT
#endif
#define ASSERT RAGE_ASSERT
//#ifdef ASSERT
//#undef ASSERT
//#endif
//#define ASSERT RAGE_ASSERT
#endif
+1
View File
@@ -948,3 +948,4 @@ int RageInput::pump_t::GetPadEvent()
return buf;
}
+1
View File
@@ -159,3 +159,4 @@ namespace USB {
};
extern RageInput* INPUTMAN; // global and accessable from anywhere in our program
+2 -2
View File
@@ -14,7 +14,7 @@
#include "RageUtil.h"
#include <fstream>
#include "crash.h"
//#include "crash.h"
#include "dxerr8.h"
#pragma comment(lib, "DxErr8.lib")
@@ -73,7 +73,7 @@ void RageLog::Trace( const char *fmt, ...)
fprintf( m_fileLog, "%s\n", sBuff.GetString() );
printf( "%s\n", sBuff.GetString() );
CrashLog(sBuff);
// CrashLog(sBuff);
#ifdef DEBUG
this->Flush(); // implicit flush
+4 -10
View File
@@ -10,6 +10,7 @@
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// In-line Links
//-----------------------------------------------------------------------------
@@ -281,16 +282,7 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample )
//-----------------------------------------------------------------------------
// RageMovieTexture constructor
//-----------------------------------------------------------------------------
RageMovieTexture::RageMovieTexture(
RageDisplay* pScreen,
const CString &sFilePath,
int dwMaxSize,
int dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch ) :
RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch )
RageMovieTexture::RageMovieTexture( const CString &sFilePath ) : RageTexture( sFilePath )
{
LOG->Trace( "RageBitmapTexture::RageBitmapTexture()" );
@@ -578,3 +570,5 @@ bool RageMovieTexture::IsPlaying() const
return m_bPlaying;
}
+2 -7
View File
@@ -34,19 +34,14 @@ void RageSound::PlayOnceStreamedFromDir( CString sDir ) { }
RageSound::RageSound( HWND hWnd )
RageSound::RageSound()
{
LOG->Trace( "RageSound::RageSound()" );
// save the HWND
if( !hWnd )
throw RageException( "RageSound called with NULL hWnd." );
m_hWndApp = hWnd;
if( BASS_GetVersion() != MAKELONG(1,6) )
throw RageException( "BASS version 1.6 DLL could not be loaded. Verify that Bass.dll exists in the program directory.");
if( !BASS_Init( -1, 44100, BASS_DEVICE_LEAVEVOL|BASS_DEVICE_LATENCY, m_hWndApp ) )
if( !BASS_Init( -1, 44100, BASS_DEVICE_LEAVEVOL|BASS_DEVICE_LATENCY, NULL ) )
{
throw RageException(
"There was an error while initializing your sound card.\n\n"
+1 -2
View File
@@ -20,7 +20,7 @@
class RageSound
{
public:
RageSound( HWND hWnd );
RageSound();
~RageSound();
float GetPlayLatency() { return m_info.latency / 1000.0f; }; // latency between when Play() is called and sound starts coming out
@@ -29,7 +29,6 @@ public:
void PlayOnceStreamedFromDir( CString sDir );
private:
HWND m_hWndApp; // this is set on GRAPHICS_Create()
BASS_INFO m_info;
};
+9 -16
View File
@@ -18,34 +18,21 @@
#include <string.h>
#include <assert.h>
//-----------------------------------------------------------------------------
// RageTexture constructor
//-----------------------------------------------------------------------------
RageTexture::RageTexture(
RageDisplay* pScreen,
const CString &sFilePath,
int dwMaxSize,
int dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch )
RageTexture::RageTexture( const CString &sFilePath )
{
// LOG->Trace( "RageTexture::RageTexture()" );
// save a pointer to the D3D device
m_pd3dDevice = pScreen->m_pd3dDevice;
assert( m_pd3dDevice != NULL );
// save the file path
m_sFilePath = sFilePath;
// m_pd3dTexture = NULL;
m_iRefCount = 1;
m_iSourceWidth = m_iSourceHeight = 0;
m_iTextureWidth = m_iTextureHeight = 0;
m_iImageWidth = m_iImageHeight = 0;
m_iFramesWide = m_iFramesHigh = 1;
m_iFramesWide = m_iFramesHigh = 0;
}
RageTexture::~RageTexture()
@@ -110,3 +97,9 @@ void RageTexture::GetFrameDimensionsFromFileName( CString sPath, int* piFramesWi
}
}
const RectF *RageTexture::GetTextureCoordRect( int frameNo ) const
{
return &m_TextureCoordRects[frameNo];
}
+20 -53
View File
@@ -3,7 +3,7 @@
-----------------------------------------------------------------------------
Class: RageTexture
Desc: Abstract class for a texture and holds metadata.
Desc: Abstract class for a texture and metadata.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
@@ -11,24 +11,10 @@
*/
#include "RageTypes.h"
#include "RageDisplay.h"
#include <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;
};
const int MAX_TEXTURE_FRAMES = 256;
//-----------------------------------------------------------------------------
@@ -37,35 +23,19 @@ public:
class RageTexture
{
public:
RageTexture(
RageDisplay* pScreen,
const CString &sFilePath,
int dwMaxSize = 2048,
int dwTextureColorDepth = 16,
int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
);
RageTexture( const CString &sFilePath );
virtual ~RageTexture() = 0;
virtual void Reload(
int dwMaxSize = 2048,
int dwTextureColorDepth = 16,
int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
) = 0;
virtual void Reload() = 0;
virtual LPDIRECT3DTEXTURE8 GetD3DTexture() = 0;
// movie texture/animated texture stuff
virtual void Play() {}
virtual void Stop() {}
virtual void Pause() {}
virtual void SetPosition( float fSeconds ) {}
virtual bool IsAMovie() const { return false; }
virtual bool IsPlaying() const { return false; }
void SetLooping(bool looping=true) { }
void SetLooping(bool looping) { }
int GetSourceWidth() const {return m_iSourceWidth;}
int GetSourceHeight() const {return m_iSourceHeight;}
@@ -84,30 +54,27 @@ public:
int GetImageFrameWidth() const {return GetImageWidth() / GetFramesWide();}
int GetImageFrameHeight() const {return GetImageHeight() / GetFramesHigh();}
RectF *GetTextureCoordRect( int uFrameNo ) {return &m_TextureCoordRects[uFrameNo];}
int GetNumFrames() const {return m_TextureCoordRects.size();}
const RectF *GetTextureCoordRect( int frameNo ) const;
int GetNumFrames() const {return m_iFramesWide*m_iFramesHigh;}
CString GetFilePath() const {return m_sFilePath;}
int m_iRefCount;
int m_iTimeOfLastUnload;
int m_iRefCount;
int m_iTimeOfLastUnload;
virtual unsigned int GetGLTextureID() = 0; // accessed by RageDisplay
protected:
virtual void CreateFrameRects();
virtual void GetFrameDimensionsFromFileName( CString sPath, int* puFramesWide, int* puFramesHigh ) const;
CString m_sFilePath;
LPDIRECT3DDEVICE8 m_pd3dDevice;
CString m_sFilePath;
int m_iSourceWidth, m_iSourceHeight; // dimensions of the original image loaded from disk
int m_iTextureWidth, m_iTextureHeight; // dimensions of the texture in memory
int m_iImageWidth, m_iImageHeight; // dimensions of the image in the texture
int m_iFramesWide, m_iFramesHigh; // The number of frames of animation in each row and column of this texture
// RECTs that hold the bounds of each frame in the bitmap.
// e.g., if the texture has 4 frames of animation, the SrcRect for each frame would
// be in m_FrameRects[0..4].
CArray<RectF, RectF&> m_TextureCoordRects;
int m_iSourceWidth, m_iSourceHeight; // dimensions of the original image loaded from disk
int m_iTextureWidth, m_iTextureHeight; // dimensions of the texture in memory
int m_iImageWidth, m_iImageHeight; // dimensions of the image in the texture
int m_iFramesWide, m_iFramesHigh; // The number of frames of animation in each row and column of this texture
CArray<RectF,RectF> m_TextureCoordRects; // size = m_iFramesWide * m_iFramesHigh
};
+10 -21
View File
@@ -26,13 +26,9 @@ RageTextureManager* TEXTUREMAN = NULL;
//-----------------------------------------------------------------------------
// constructor/destructor
//-----------------------------------------------------------------------------
RageTextureManager::RageTextureManager( RageDisplay* pScreen )
RageTextureManager::RageTextureManager( int iTextureColorDepth, int iSecondsBeforeUnload )
{
assert( pScreen != NULL );
m_pScreen = pScreen;
m_iMaxTextureSize = 2048; // infinite size
m_iTextureColorDepth = 16;
m_iSecondsBeforeUnload = 60*30; // 30 mins
SetPrefs( iTextureColorDepth, iSecondsBeforeUnload );
}
RageTextureManager::~RageTextureManager()
@@ -51,7 +47,7 @@ RageTextureManager::~RageTextureManager()
//-----------------------------------------------------------------------------
// Load/Unload textures from disk
//-----------------------------------------------------------------------------
RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, bool bForceReload, int iMipMaps, int iAlphaBits, bool bDither, bool bStretch )
RageTexture* RageTextureManager::LoadTexture( CString sTexturePath )
{
sTexturePath.MakeLower();
@@ -70,8 +66,6 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, bool bForceR
pTexture = p->second;
pTexture->m_iRefCount++;
if( bForceReload )
pTexture->Reload( m_iMaxTextureSize, m_iTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch );
// LOG->Trace( "RageTextureManager: '%s' now has %d references.", sTexturePath.GetString(), pTexture->m_iRefCount );
}
@@ -80,10 +74,10 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, bool bForceR
CString sDrive, sDir, sFName, sExt;
splitpath( false, sTexturePath, sDrive, sDir, sFName, sExt );
if( sExt == "avi" || sExt == "mpg" || sExt == "mpeg" )
pTexture = new RageMovieTexture( m_pScreen, sTexturePath, m_iMaxTextureSize, m_iTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch );
else
pTexture = new RageBitmapTexture( m_pScreen, sTexturePath, m_iMaxTextureSize, m_iTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch );
// if( sExt == "avi" || sExt == "mpg" || sExt == "mpeg" )
// pTexture = new RageMovieTexture( sTexturePath );
// else
pTexture = new RageBitmapTexture( sTexturePath );
LOG->Trace( "RageTextureManager: Finished loading '%s'.", sTexturePath.GetString() );
@@ -185,19 +179,14 @@ void RageTextureManager::ReloadAll()
{
RageTexture* pTexture = i->second;
// this is not entirely correct. Hints are lost! XXX
pTexture->Reload( m_iMaxTextureSize, m_iTextureColorDepth, 0 );
pTexture->Reload(); // this is not entirely correct. Hints are lost! XXX
}
}
void RageTextureManager::SetPrefs( int iMaxSize, int iTextureColorDepth, int iSecondsBeforeUnload )
void RageTextureManager::SetPrefs( int iTextureColorDepth, int iSecondsBeforeUnload )
{
m_iSecondsBeforeUnload = iSecondsBeforeUnload;
if( iMaxSize == m_iMaxTextureSize && iTextureColorDepth == m_iTextureColorDepth )
return;
m_iMaxTextureSize = iMaxSize;
m_iTextureColorDepth = iTextureColorDepth;
ASSERT( m_iMaxTextureSize >= 64 );
ASSERT( m_iTextureColorDepth >= 16 );
ASSERT( m_iTextureColorDepth==16 || m_iTextureColorDepth==32 );
ReloadAll();
}
+4 -6
View File
@@ -19,23 +19,21 @@
class RageTextureManager
{
public:
RageTextureManager( RageDisplay* pScreen );
RageTextureManager( int iTextureColorDepth, int iSecsBeforeUnload );
~RageTextureManager();
RageTexture* LoadTexture( CString sTexturePath, bool bForceReload = false, int iMipMaps = 4, int iAlphaBits = 4, bool bDither = false, bool bStretch = false );
RageTexture* LoadTexture( CString sTexturePath );
bool IsTextureLoaded( CString sTexturePath );
void UnloadTexture( CString sTexturePath );
void ReloadAll();
void SetPrefs( int iMaxSize, int iTextureColorDepth, int iMaxTextureMB );
int GetMaxTextureSize() { return m_iMaxTextureSize; };
void SetPrefs( int iTextureColorDepth, int iSecsBeforeUnload );
int GetTextureColorDepth() { return m_iTextureColorDepth; };
int GetSecsBeforeUnload() { return m_iSecondsBeforeUnload; };
protected:
void GCTextures();
RageDisplay* m_pScreen;
int m_iMaxTextureSize;
int m_iTextureColorDepth;
int m_iSecondsBeforeUnload;
+55 -25
View File
@@ -79,16 +79,6 @@ public:
float x, y, z;
};
#define RAGECOLOR_ARGB(a,r,g,b) \
((DWORD)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
#define RAGECOLOR_RGBA(r,g,b,a) RAGECOLOR_ARGB(a,r,g,b)
#define RAGECOLOR_COLORVALUE(r,g,b,a) \
RAGECOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f))
struct RageVector4
{
public:
@@ -97,7 +87,6 @@ public:
RageVector4( float x1, float y1, float z1, float w1 ) { x=x1; y=y1; z=z1; w=w1; }
// casting
operator unsigned long () const { return RAGECOLOR_COLORVALUE(min(1.f,max(0.f,r)),min(1.f,max(0.f,g)),min(1.f,max(0.f,b)),min(1.f,max(0.f,a))); }
operator float* () { return &x; };
operator const float* () const { return &x; };
@@ -118,19 +107,58 @@ public:
bool operator == ( const RageVector4& other ) const { return x==other.x && y==other.y && z==other.z && w==other.w; }
bool operator != ( const RageVector4& other ) const { return x!=other.x || y!=other.y || z!=other.z || w!=other.w; }
union {
struct
{
float x, y, z, w;
};
struct
{
float r, g, b, a;
};
};
float x, y, z, w;
};
#define RAGECOLOR_ARGB(a,r,g,b) \
((DWORD)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
#define RAGECOLOR_RGBA(r,g,b,a) RAGECOLOR_ARGB(a,r,g,b)
#define RAGECOLOR_COLORVALUE(r,g,b,a) \
RAGECOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f))
struct RageColor
{
public:
RageColor() {}
RageColor( const float * f ) { r=f[0]; g=f[1]; b=f[2]; a=f[3]; }
RageColor( float r1, float g1, float b1, float a1 ) { r=r1; g=g1; b=b1; a=a1; }
RageColor( unsigned long c )
{
a = ((c>>24)&0xff) / 255.f;
r = ((c>>16)&0xff) / 255.f;
g = ((c>>8)&0xff) / 255.f;
b = (c&0xff) / 255.f;
}
// casting
operator unsigned long () const { return RAGECOLOR_COLORVALUE(min(1.f,max(0.f,r)),min(1.f,max(0.f,g)),min(1.f,max(0.f,b)),min(1.f,max(0.f,a))); }
operator float* () { return &r; };
operator const float* () const { return &r; };
// assignment operators
RageColor& operator += ( const RageColor& other ) { r+=other.r; g+=other.g; b+=other.b; a+=other.a; }
RageColor& operator -= ( const RageColor& other ) { r-=other.r; g-=other.g; b-=other.b; a-=other.a; }
RageColor& operator *= ( float f ) { r*=f; g*=f; b*=f; a*=f; }
RageColor& operator /= ( float f ) { r/=f; g/=f; b/=f; a/=f; }
// binarg operators
RageColor operator + ( const RageColor& other ) const { return RageColor( r+other.r, g+other.g, b+other.b, a+other.a ); }
RageColor operator - ( const RageColor& other ) const { return RageColor( r-other.r, g-other.g, b-other.b, a-other.a ); }
RageColor operator * ( float f ) const { return RageColor( r*f, g*f, b*f, a*f ); }
RageColor operator / ( float f ) const { return RageColor( r/f, g/f, b/f, a/f ); }
friend RageVector4 operator * ( float f, const RageVector4& other ) { return other*f; }
bool operator == ( const RageColor& other ) const { return r==other.r && g==other.g && b==other.b && a==other.a; }
bool operator != ( const RageColor& other ) const { return r!=other.r || g!=other.g || b!=other.b || a!=other.a; }
float r, g, b, a;
};
typedef RageVector4 RageColor;
template <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.
struct RageVertex
{
RageVector3 p; // position
DWORD c; // diffuse color
RageVector2 t; // texture coordinates
// This is the format expected by OpenGL. D3D expects the reverse!
RageVector2 t; // texture coordinates
unsigned long c; // diffuse color
RageVector3 p; // position
};
#define D3DFVF_RAGEVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1) // D3D FVF flags which describe our vertex structure
@@ -188,6 +217,7 @@ public:
operator float* () { return m[0]; }
operator const float* () const { return m[0]; }
RageMatrix GetTranspose() const { return RageMatrix(m00,m10,m20,m30,m01,m11,m21,m31,m02,m12,m22,m32,m03,m13,m23,m33); }
// ---These are not used. Maybe I'll implement them later...---
// // assignment operators
+1
View File
@@ -16,6 +16,7 @@
#include "PrefsManager.h"
#include "RageLog.h"
#include "GameState.h"
#include "ThemeManager.h"
const float SCORE_TWEEN_TIME = 0.2f;
+1
View File
@@ -16,6 +16,7 @@
#include "PrefsManager.h"
#include "RageLog.h"
#include "GameState.h"
#include "ThemeManager.h"
const float SCORE_TWEEN_TIME = 0.5f;
+1 -1
View File
@@ -23,7 +23,7 @@
#include "AnnouncerManager.h"
#include "GameManager.h"
#include "GameState.h"
#include "ThemeManager.h"
enum {
+1
View File
@@ -16,6 +16,7 @@
#include "AnnouncerManager.h"
#include "GameState.h"
#include "RageMusic.h"
#include "ThemeManager.h"
#define NEXT_SCREEN THEME->GetMetric("ScreenCaution","NextScreen")
+3
View File
@@ -21,6 +21,9 @@
#include "RageLog.h"
#include "GameState.h"
#include "InputMapper.h"
#include "RageLog.h"
#include <math.h>
#include "ThemeManager.h"
#include <utility>
+1
View File
@@ -20,6 +20,7 @@
#include "RageLog.h"
#include "GameState.h"
#include "RageMusic.h"
#include "ThemeManager.h"
//
+1
View File
@@ -22,6 +22,7 @@
#include "AnnouncerManager.h"
#include "GameState.h"
#include "GrooveRadar.h"
#include "ThemeManager.h"
#define BANNER_X THEME->GetMetricF("ScreenEvaluation","BannerX")
+1
View File
@@ -20,6 +20,7 @@ Andrew Livy
#include "GameState.h"
#include "RageException.h"
#include "RageTimer.h"
#include "ThemeManager.h"
/* Constants */
+1
View File
@@ -20,6 +20,7 @@
#include "AnnouncerManager.h"
#include "GameState.h"
#include "RageMusic.h"
#include "ThemeManager.h"
const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 1);
+1
View File
@@ -27,6 +27,7 @@
#include "ScreenPrompt.h"
#include "GrooveRadar.h"
#include "NotesLoaderSM.h"
#include "ThemeManager.h"
//
// Defines
+38 -51
View File
@@ -20,14 +20,16 @@
#include "StepMania.h"
#include "PrefsManager.h"
#include "RageLog.h"
#include "PrefsManager.h"
#include "ThemeManager.h"
enum {
GO_WINDOWED = 0,
GO_DISPLAY_RESOLUTION,
GO_TEXTURE_RESOLUTION,
GO_REFRESH_RATE,
GO_DISPLAY_COLOR_DEPTH,
GO_TEXTURE_COLOR_DEPTH,
GO_REFRESH_RATE_MODE,
GO_BGMODE,
GO_BGBRIGHTNESS,
GO_MOVIEDECODEMS,
@@ -38,10 +40,11 @@ enum {
OptionRowData g_GraphicOptionsLines[NUM_GRAPHIC_OPTIONS_LINES] = {
{ "Display\nMode", 2, {"FULLSCREEN", "WINDOWED"} },
{ "Display\nResolution", 7, {"320","400","512","640","800","1024","1280"} },
{ "Texture\nResolution", 3, {"256","512","1024"} },
{ "Refresh\nRate", 11, {"DEFAULT","MAX","60","70","72","75","80","85","90","100","120"} },
{ "Display\nColor", 2, {"16BIT","32BIT"} },
{ "Texture\nColor", 2, {"16BIT","32BIT"} },
{ "Refresh\nRate", 3, {"DEFAULT","MAX","MIN"} },
{ "Background\nMode", 4, {"OFF","ANIMATIONS","VISUALIZATIONS","RANDOM MOVIES"} },
{ "Background\nBrightness", 11, {"0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%"} },
{ "Background\nBrightness", 11, {"0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%"} },
{ "Movie\nDecode", 4, {"1ms","2ms","3ms","4ms"} },
{ "BG For\nBanner", 2, {"NO", "YES (slow)"} },
{ "Wait For\nVsync", 2, {"NO", "YES"} },
@@ -83,17 +86,6 @@ ScreenGraphicOptions::ScreenGraphicOptions() :
MUSIC->LoadAndPlayIfNotAlready( THEME->GetPathTo("Sounds","graphic options music") );
}
int ScreenGraphicOptions::CurrentRefresh() const
{
int RefreshOption = m_iSelectedOption[0][GO_REFRESH_RATE];
switch( RefreshOption )
{
case 0: return RageDisplay::REFRESH_DEFAULT;break;
case 1: return RageDisplay::REFRESH_MAX; break;
default:
return atoi( g_GraphicOptionsLines[GO_REFRESH_RATE].szOptionsText[RefreshOption] );
}
}
void ScreenGraphicOptions::UpdateRefreshRates()
{
@@ -110,7 +102,7 @@ void ScreenGraphicOptions::UpdateRefreshRates()
/* Set the refresh to default. If we can find the old selection in the
* new data, we'll set it to that later. */
OptionRowData &opt = g_GraphicOptionsLines[GO_REFRESH_RATE];
OptionRowData &opt = g_GraphicOptionsLines[GO_REFRESH_RATE_MODE];
opt.iNumOptions = 2;
int OldSettingNo = RageDisplay::REFRESH_DEFAULT;
@@ -127,8 +119,8 @@ void ScreenGraphicOptions::UpdateRefreshRates()
OldSettingNo = i;
}
m_iSelectedOption[0][GO_REFRESH_RATE] =
m_iSelectedOption[1][GO_REFRESH_RATE] = OldSettingNo;
m_iSelectedOption[0][GO_REFRESH_RATE_MODE] =
m_iSelectedOption[1][GO_REFRESH_RATE_MODE] = OldSettingNo;
InitOptionsText();
#endif
@@ -151,7 +143,7 @@ void ScreenGraphicOptions::ImportOptions()
{
m_iSelectedOption[0][GO_WINDOWED] = PREFSMAN->m_bWindowed ? 1:0;
switch( PREFSMAN->m_iDisplayResolution )
switch( PREFSMAN->m_iDisplayWidth )
{
case 320: m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 0; break;
case 400: m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 1; break;
@@ -162,31 +154,20 @@ void ScreenGraphicOptions::ImportOptions()
case 1280: m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 6; break;
default: m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 3; break;
}
switch( PREFSMAN->m_iTextureResolution )
switch( PREFSMAN->m_iDisplayColorDepth )
{
case 256: m_iSelectedOption[0][GO_TEXTURE_RESOLUTION] = 0; break;
case 512: m_iSelectedOption[0][GO_TEXTURE_RESOLUTION] = 1; break;
case 1024: m_iSelectedOption[0][GO_TEXTURE_RESOLUTION] = 2; break;
default: m_iSelectedOption[0][GO_TEXTURE_RESOLUTION] = 1; break;
}
switch( PREFSMAN->m_iRefreshRate )
{
case RageDisplay::REFRESH_DEFAULT: m_iSelectedOption[0][GO_REFRESH_RATE] = 0; break;
case RageDisplay::REFRESH_MAX: m_iSelectedOption[0][GO_REFRESH_RATE] = 1; break;
case 60: m_iSelectedOption[0][GO_REFRESH_RATE] = 2; break;
case 70: m_iSelectedOption[0][GO_REFRESH_RATE] = 3; break;
case 72: m_iSelectedOption[0][GO_REFRESH_RATE] = 4; break;
case 75: m_iSelectedOption[0][GO_REFRESH_RATE] = 5; break;
case 80: m_iSelectedOption[0][GO_REFRESH_RATE] = 6; break;
case 85: m_iSelectedOption[0][GO_REFRESH_RATE] = 7; break;
case 90: m_iSelectedOption[0][GO_REFRESH_RATE] = 8; break;
case 100: m_iSelectedOption[0][GO_REFRESH_RATE] = 9; break;
case 120: m_iSelectedOption[0][GO_REFRESH_RATE] = 10; break;
default: m_iSelectedOption[0][GO_REFRESH_RATE] = 1; break;
case 16: m_iSelectedOption[0][GO_DISPLAY_COLOR_DEPTH] = 0; break;
case 32: m_iSelectedOption[0][GO_DISPLAY_COLOR_DEPTH] = 1; break;
}
switch( PREFSMAN->m_iTextureColorDepth )
{
case 16: m_iSelectedOption[0][GO_TEXTURE_COLOR_DEPTH] = 0; break;
case 32: m_iSelectedOption[0][GO_TEXTURE_COLOR_DEPTH] = 1; break;
}
m_iSelectedOption[0][GO_REFRESH_RATE_MODE] = PREFSMAN->m_iRefreshRateMode;
m_iSelectedOption[0][GO_BGMODE] = PREFSMAN->m_BackgroundMode;
m_iSelectedOption[0][GO_BGBRIGHTNESS] = (int)( PREFSMAN->m_fBGBrightness*10+0.5f );
m_iSelectedOption[0][GO_MOVIEDECODEMS] = PREFSMAN->m_iMovieDecodeMS-1;
@@ -203,18 +184,24 @@ void ScreenGraphicOptions::ExportOptions()
ASSERT(0);
m_iSelectedOption[0][GO_DISPLAY_RESOLUTION] = 3;
}
PREFSMAN->m_iDisplayResolution =
HorizRes[m_iSelectedOption[0][GO_DISPLAY_RESOLUTION]];
PREFSMAN->m_iDisplayWidth = HorizRes[m_iSelectedOption[0][GO_DISPLAY_RESOLUTION]];
PREFSMAN->m_iDisplayHeight = VertRes[m_iSelectedOption[0][GO_DISPLAY_RESOLUTION]];
switch( m_iSelectedOption[0][GO_TEXTURE_RESOLUTION] )
switch( m_iSelectedOption[0][GO_DISPLAY_COLOR_DEPTH] )
{
case 0: PREFSMAN->m_iTextureResolution = 256; break;
case 1: PREFSMAN->m_iTextureResolution = 512; break;
case 2: PREFSMAN->m_iTextureResolution = 1024; break;
default: ASSERT(0); PREFSMAN->m_iTextureResolution = 512; break;
case 0: PREFSMAN->m_iDisplayColorDepth = 16; break;
case 1: PREFSMAN->m_iDisplayColorDepth = 32; break;
default: ASSERT(0); PREFSMAN->m_iDisplayColorDepth = 16; break;
}
PREFSMAN->m_iRefreshRate = CurrentRefresh();
switch( m_iSelectedOption[0][GO_TEXTURE_COLOR_DEPTH] )
{
case 0: PREFSMAN->m_iTextureColorDepth = 16; break;
case 1: PREFSMAN->m_iTextureColorDepth = 32; break;
default: ASSERT(0); PREFSMAN->m_iTextureColorDepth = 16; break;
}
PREFSMAN->m_iRefreshRateMode = m_iSelectedOption[0][GO_REFRESH_RATE_MODE];
PREFSMAN->m_BackgroundMode = PrefsManager::BackgroundMode( m_iSelectedOption[0][GO_BGMODE] );
PREFSMAN->m_fBGBrightness = m_iSelectedOption[0][GO_BGBRIGHTNESS] / 10.0f;
PREFSMAN->m_iMovieDecodeMS = m_iSelectedOption[0][GO_MOVIEDECODEMS]+1;
-1
View File
@@ -27,7 +27,6 @@ private:
void GoToNextState();
void GoToPrevState();
int CurrentRefresh() const;
};
#endif
+1
View File
@@ -18,6 +18,7 @@
#include "GameConstantsAndTypes.h"
#include "RageLog.h"
#include "GameState.h"
#include "ThemeManager.h"
#define HELP_TEXT THEME->GetMetric("ScreenHowToPlay","HelpText")
+1
View File
@@ -20,6 +20,7 @@
#include "StepMania.h"
#include "PrefsManager.h"
#include "RageLog.h"
#include "ThemeManager.h"
enum {
+1 -1
View File
@@ -20,7 +20,7 @@
#include "StepMania.h"
#include "PrefsManager.h"
#include "RageLog.h"
#include "ThemeManager.h"
enum {
+2 -3
View File
@@ -18,6 +18,7 @@
#include "GameState.h"
#include "RageException.h"
#include "RageTimer.h"
#include "ThemeManager.h"
ScreenManager* SCREENMAN = NULL; // global and accessable from anywhere in our program
@@ -133,7 +134,7 @@ void ScreenManager::Draw()
if( PREFSMAN && PREFSMAN->m_bShowStats )
{
m_textStats.SetText( ssprintf("%d FPS\n%d TPF\n%d DPF", DISPLAY->GetFPS(),DISPLAY->GetTPF(),DISPLAY->GetDPF()) );
m_textStats.SetText( "??? FPS" );
m_textStats.Draw();
}
for( int p=0; p<NUM_PLAYERS; p++ )
@@ -182,7 +183,6 @@ void ScreenManager::Input( const DeviceInput& DeviceI, const InputEventType type
#include "ScreenStage.h"
#include "ScreenTitleMenu.h"
#include "ScreenEz2SelectMusic.h"
#include "ScreenNetworkGame.h"
#include "ScreenPrompt.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, "ScreenTitleMenu") ) return new ScreenTitleMenu;
// else if( 0==stricmp(sClassName, "ScreenEz2SelectMusic") ) return new ScreenEz2SelectMusic;
else if( 0==stricmp(sClassName, "ScreenNetworkGame") ) return new ScreenNetworkGame;
else
throw RageException( "Invalid Screen class name '%s'", sClassName.GetString() );
}
+1
View File
@@ -20,6 +20,7 @@
#include "GameManager.h"
#include "GameState.h"
#include "RageMusic.h"
#include "ThemeManager.h"
#define HELP_TEXT THEME->GetMetric("ScreenMapControllers","HelpText")
+2
View File
@@ -19,6 +19,8 @@
#include "GameConstantsAndTypes.h"
#include "SongManager.h"
#include "GameState.h"
#include "ThemeManager.h"
#include "AnnouncerManager.h"
#define SCROLL_DELAY THEME->GetMetricF("ScreenMusicScroll","ScrollDelay")
+1
View File
@@ -19,6 +19,7 @@
#include "GameConstantsAndTypes.h"
#include "RageLog.h"
#include "GameState.h"
#include "ThemeManager.h"
#define ICONS_X( p ) THEME->GetMetricF("ScreenOptions",ssprintf("IconsP%dX",p+1))
+2
View File
@@ -15,6 +15,8 @@
#include "ScreenManager.h"
#include "RageLog.h"
#include "GameState.h"
#include "ThemeManager.h"
#include "AnnouncerManager.h"
enum {
+1
View File
@@ -17,6 +17,7 @@
#include "RageMusic.h"
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "ThemeManager.h"
const float QUESTION_X = CENTER_X;
const float QUESTION_Y = CENTER_Y - 60;
+7 -10
View File
@@ -16,15 +16,12 @@
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "Quad.h"
#include "ThemeManager.h"
#include "RageNetwork.h"
ScreenSandbox::ScreenSandbox()
{
m_text.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
m_text.SetXY( CENTER_X, CENTER_Y );
this->AddChild( &m_text );
// m_Menu.Load(
// THEME->GetPathTo(GRAPHIC_SELECT_STYLE_BACKGROUND),
// THEME->GetPathTo(GRAPHIC_SELECT_STYLE_TOP_EDGE),
@@ -34,7 +31,10 @@ ScreenSandbox::ScreenSandbox()
// this->AddChild( &m_Menu );
// m_Menu.TweenOnScreenFromBlack( SM_None );
//this->AddChild( &m_spr );
m_sprite.Load( THEME->GetPathTo("Graphics","title menu logo dance") );
m_sprite.SetXY( CENTER_X, CENTER_Y );
m_sprite.SetEffectGlowing();
this->AddChild( &m_sprite );
}
@@ -44,10 +44,6 @@ void ScreenSandbox::Update( float fDeltaTime )
CArray<Packet,Packet> aPackets;
NETWORK->Recv( aPackets );
for( unsigned int i=0; i<aPackets.size(); i++ )
{
m_text.SetText( "Message received." );
}
}
void ScreenSandbox::DrawPrimitives()
@@ -66,7 +62,8 @@ void ScreenSandbox::Input( const DeviceInput& DeviceI, const InputEventType type
switch( DeviceI.button )
{
case DIK_LEFT:
m_text.SetText( "Message sent." );
break;
case DIK_RIGHT:
break;
case DIK_T:
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 HandleScreenMessage( const ScreenMessage SM );
BitmapText m_text;
Sprite m_sprite;
};
+1
View File
@@ -26,6 +26,7 @@
#include "GameState.h"
#include "RageMusic.h"
#include "CodeDetector.h"
#include "ThemeManager.h"
#define EXPLANATION_X THEME->GetMetricF("ScreenSelectCourse","ExplanationX")
+1
View File
@@ -19,6 +19,7 @@
#include "AnnouncerManager.h"
#include "GameState.h"
#include "RageMusic.h"
#include "ThemeManager.h"
const float LOCK_INPUT_TIME = 0.30f; // lock input while waiting for tweening to complete
+1
View File
@@ -17,6 +17,7 @@
#include "GameManager.h"
#include "GameState.h"
#include "InputMapper.h"
#include "ThemeManager.h"
enum {
+13 -12
View File
@@ -21,6 +21,8 @@
#include "AnnouncerManager.h"
#include "GameState.h"
#include "RageMusic.h"
#include "ThemeManager.h"
#include <map>
#define FRAME_X THEME->GetMetricF("ScreenSelectGroup","FrameX")
@@ -78,20 +80,19 @@ ScreenSelectGroup::ScreenSelectGroup()
aAllSongs.erase( aAllSongs.begin()+j, aAllSongs.begin()+j+1 );
}
CStringArray asGroupNames;
for( i=0; i<aAllSongs.size(); i++ ) {
asGroupNames.push_back( aAllSongs[i]->m_sGroupName );
// Add all group names to a map.
std::map<CString, CString> mapGroupNames;
for( i=0; i<aAllSongs.size(); i++ )
{
const CString& sGroupName = aAllSongs[i]->m_sGroupName;
mapGroupNames[ sGroupName ] = ""; // group name maps to nothing
}
/* Remove duplicate groups. */
SortCStringArray(asGroupNames, true);
for( i=asGroupNames.size()-1; i > 0; --i ) {
if( asGroupNames[i] == asGroupNames[i-1] )
asGroupNames.erase( asGroupNames.begin()+i,
asGroupNames.begin()+i+1 );
}
asGroupNames.insert(asGroupNames.begin(), "ALL MUSIC" );
// copy group names into a vector
std::vector<CString> asGroupNames;
for( std::map<CString, CString>::const_iterator iter = mapGroupNames.begin(); iter != mapGroupNames.end(); ++i )
asGroupNames.push_back( iter->first );
asGroupNames.push_back( "ALL MUSIC" ); // "ALL MUSIC" is a special group
// Add songs to the MusicList.
for( unsigned g=0; g < asGroupNames.size(); g++ ) /* for each group */
+16 -15
View File
@@ -22,6 +22,7 @@ Chris Danford
#include "RageException.h"
#include "RageTimer.h"
#include "GameState.h"
#include "ThemeManager.h"
/* Constants */
@@ -200,11 +201,11 @@ void ScreenSelectMode::HandleScreenMessage( const ScreenMessage SM )
case SM_GoToNextScreen:
// Put the mode choice into effect
int iSelection = m_ScrollingList.GetSelection();
const ModeChoice& choice = m_aPossibleModeChoices[ iSelection ];
GAMESTATE->m_CurStyle = choice.style;
GAMESTATE->m_PlayMode = choice.pm;
const ModeChoice* pChoice = m_apPossibleModeChoices[ iSelection ];
GAMESTATE->m_CurStyle = pChoice->style;
GAMESTATE->m_PlayMode = pChoice->pm;
for( int p=0; p<NUM_PLAYERS; p++ )
GAMESTATE->m_PreferredDifficulty[p] = choice.dc;
GAMESTATE->m_PreferredDifficulty[p] = pChoice->dc;
switch( GAMESTATE->m_PlayMode )
{
@@ -224,24 +225,24 @@ void ScreenSelectMode::RefreshModeChoices()
{
int iNumSidesJoined = GAMESTATE->GetNumSidesJoined();
GAMEMAN->GetModesChoicesForGame( GAMESTATE->m_CurGame, m_aPossibleModeChoices );
ASSERT( !m_aPossibleModeChoices.empty() );
GAMEMAN->GetModesChoicesForGame( GAMESTATE->m_CurGame, m_apPossibleModeChoices );
ASSERT( !m_apPossibleModeChoices.empty() );
int i;
// remove ModeChoices that won't work with the current number of players
for( i=m_aPossibleModeChoices.size()-1; i>=0; i-- )
if( m_aPossibleModeChoices[i].numSidesJoinedToPlay != iNumSidesJoined )
m_aPossibleModeChoices.erase( m_aPossibleModeChoices.begin()+i,
m_aPossibleModeChoices.begin()+i+1 );
for( i=m_apPossibleModeChoices.size()-1; i>=0; i-- )
if( m_apPossibleModeChoices[i]->numSidesJoinedToPlay != iNumSidesJoined )
m_apPossibleModeChoices.erase( m_apPossibleModeChoices.begin()+i,
m_apPossibleModeChoices.begin()+i+1 );
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
CStringArray asGraphicPaths;
for( unsigned j=0; j<m_aPossibleModeChoices.size(); j++ )
for( unsigned j=0; j<m_apPossibleModeChoices.size(); j++ )
{
const ModeChoice& choice = m_aPossibleModeChoices[j];
asGraphicPaths.push_back( THEME->GetPathTo("Graphics", ssprintf("select mode choice %s %s", sGameName.GetString(), choice.name) ) );
const ModeChoice* pChoice = m_apPossibleModeChoices[j];
asGraphicPaths.push_back( THEME->GetPathTo("Graphics", ssprintf("select mode choice %s %s", sGameName.GetString(), pChoice->name) ) );
}
m_ScrollingList.Load( asGraphicPaths );
@@ -251,9 +252,9 @@ void ScreenSelectMode::RefreshModeChoices()
{
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
for( unsigned i=0; 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())) );
}
}
+3 -1
View File
@@ -17,6 +17,8 @@ Andrew Livy
#include "Quad.h"
#include "MenuElements.h"
#include "ScrollingList.h"
#include "GameConstantsAndTypes.h"
#include "ModeChoice.h"
/* Class Definition */
@@ -53,7 +55,7 @@ protected:
Sprite m_ChoiceListFrame;
Sprite m_ChoiceListHighlight;
CArray<ModeChoice,ModeChoice> m_aPossibleModeChoices;
CArray<ModeChoice*,ModeChoice*> m_apPossibleModeChoices;
ScrollingList m_ScrollingList;
void RefreshModeChoices();
+6 -3
View File
@@ -26,6 +26,9 @@
#include "InputMapper.h"
#include "GameState.h"
#include "CodeDetector.h"
#include <math.h>
#include "GameConstantsAndTypes.h"
#include "ThemeManager.h"
#define BANNER_FRAME_X THEME->GetMetricF("ScreenSelectMusic","BannerFrameX")
@@ -384,10 +387,10 @@ void ScreenSelectMusic::Update( float fDeltaTime )
this->PlayMusicSample();
}
float fNewRotation = m_sprCDTitle.GetRotationY()+D3DX_PI*fDeltaTime/2;
fNewRotation = fmodf( fNewRotation, D3DX_PI*2 );
float fNewRotation = m_sprCDTitle.GetRotationY()+PI*fDeltaTime/2;
fNewRotation = fmodf( fNewRotation, PI*2 );
m_sprCDTitle.SetRotationY( fNewRotation );
if( fNewRotation > D3DX_PI/2 && fNewRotation <= D3DX_PI*3.0f/2 )
if( fNewRotation > PI/2 && fNewRotation <= PI*3.0f/2 )
m_sprCDTitle.SetDiffuse( RageColor(0.2f,0.2f,0.2f,1) );
else
m_sprCDTitle.SetDiffuse( RageColor(1,1,1,1) );
+2
View File
@@ -21,6 +21,8 @@
#include "RageLog.h"
#include "AnnouncerManager.h"
#include "GameState.h"
#include "GameConstantsAndTypes.h"
#include "ThemeManager.h"
#define ICONS_START_X THEME->GetMetricF("ScreenSelectStyle","IconsStartX")
+3 -2
View File
@@ -1,3 +1,5 @@
#ifndef SCREEN_SELECT_STYLE_H
#define SCREEN_SELECT_STYLE_H
/*
-----------------------------------------------------------------------------
Class: ScreenSelectStyle
@@ -9,14 +11,13 @@
-----------------------------------------------------------------------------
*/
#ifndef SCREEN_SELECT_STYLE_H
#define SCREEN_SELECT_STYLE_H
#include "Screen.h"
#include "Sprite.h"
#include "TransitionFade.h"
#include "RandomSample.h"
#include "MenuElements.h"
#include "Style.h"
class ScreenSelectStyle : public Screen
+2
View File
@@ -21,6 +21,8 @@
#include "RageLog.h"
#include "GameState.h"
#include "PrefsManager.h"
#include "ThemeManager.h"
#include "AnnouncerManager.h"
#define HELP_TEXT THEME->GetMetric("ScreenSelectStyle5th","HelpText")
#define TIMER_SECONDS THEME->GetMetricI("ScreenSelectStyle5th","TimerSeconds")
+1
View File
@@ -17,6 +17,7 @@
#include "GameConstantsAndTypes.h"
#include "RageLog.h"
#include "GameState.h"
#include "ThemeManager.h"
enum {
+1
View File
@@ -23,6 +23,7 @@
#include "AnnouncerManager.h"
#include "GameState.h"
#include "RageMusic.h"
#include "ThemeManager.h"
#define NEXT_SCREEN THEME->GetMetric("ScreenStage","NextScreen")
+1
View File
@@ -17,6 +17,7 @@
#include "ScreenTitleMenu.h"
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "ThemeManager.h"
const float QUESTION_X = CENTER_X;
const float QUESTION_Y = CENTER_Y - 60;
+1 -5
View File
@@ -22,10 +22,10 @@
#include "GameState.h"
#include "GameManager.h"
#include "InputMapper.h"
#include "ThemeManager.h"
const CString CHOICE_TEXT[ScreenTitleMenu::NUM_TITLE_MENU_CHOICES] = {
"GAME START",
"NETWORK GAME",
"SWITCH GAME",
"CONFIG KEY/JOY",
"INPUT OPTIONS",
@@ -203,9 +203,6 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM )
case CHOICE_GAME_START:
SCREENMAN->SetNewScreen( NEXT_SCREEN );
break;
case CHOICE_NETWORK_GAME:
SCREENMAN->SetNewScreen( "ScreenNetworkGame" );
break;
case CHOICE_SELECT_GAME:
SCREENMAN->SetNewScreen( "ScreenSelectGame" );
break;
@@ -354,7 +351,6 @@ void ScreenTitleMenu::MenuStart( PlayerNumber pn )
switch( m_TitleMenuChoice )
{
case CHOICE_GAME_START:
case CHOICE_NETWORK_GAME:
case CHOICE_SELECT_GAME:
case CHOICE_MAP_INSTRUMENTS:
case CHOICE_INPUT_OPTIONS:
-1
View File
@@ -30,7 +30,6 @@ public:
enum TitleMenuChoice {
CHOICE_GAME_START = 0,
CHOICE_NETWORK_GAME,
CHOICE_SELECT_GAME,
CHOICE_MAP_INSTRUMENTS,
CHOICE_INPUT_OPTIONS,
+2
View File
@@ -13,6 +13,8 @@
#include "ScrollBar.h"
#include "PrefsManager.h"
#include "GameConstantsAndTypes.h"
#include <math.h>
#include "ThemeManager.h"
ScrollBar::ScrollBar()
+1
View File
@@ -14,6 +14,7 @@
#include "RageUtil.h"
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "ThemeManager.h"
const float SCROLL_TIME = 5.0f;
+1
View File
@@ -14,6 +14,7 @@
#include "Sprite.h"
#include "PrefsManager.h"
#include "Grade.h"
#include "GameConstantsAndTypes.h"
+1
View File
@@ -17,6 +17,7 @@
#include "ArrowEffects.h"
#include "GameManager.h"
#include "GameState.h"
#include "ThemeManager.h"
SnapDisplay::SnapDisplay()
+4
View File
@@ -20,6 +20,10 @@
#include "RageException.h"
#include "RageTimer.h"
#include "AnnouncerManager.h"
#include "ThemeManager.h"
#include "GameManager.h"
SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program
+2
View File
@@ -14,6 +14,8 @@
#include "RageLog.h"
#include "SongManager.h"
#include "GameState.h"
#include "ThemeManager.h"
#include "GameManager.h"
//
// Defines specific to SongSelector
+4 -3
View File
@@ -1,3 +1,5 @@
#ifndef SONG_SELECTOR_H
#define SONG_SELECTOR_H
/*
-----------------------------------------------------------------------------
Class: SongSelector
@@ -9,15 +11,14 @@
-----------------------------------------------------------------------------
*/
#ifndef SONG_SELECTOR_H
#define SONG_SELECTOR_H
#include "stdafx.h"
#include "ActorFrame.h"
#include "MenuElements.h"
#include "Banner.h"
#include "TextBanner.h"
#include "GameConstantsAndTypes.h"
#include "Style.h"
class SongSelector: public ActorFrame {
public:

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