let Actor subclasses have first crack at parsing commands
allow Models and BitmapTexts in BGAnimationLayer (detected through file extension) add RageModelVertex, which doesn't have a color property add "stretch" file name hint for textures
This commit is contained in:
+29
-26
@@ -18,6 +18,7 @@
|
|||||||
#include "RageMath.h"
|
#include "RageMath.h"
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
|
#include "StepMania.h"
|
||||||
|
|
||||||
/* This is Reset instead of Init since many derived classes have Init() functions
|
/* This is Reset instead of Init since many derived classes have Init() functions
|
||||||
* that shouldn't change the position of the actor. */
|
* that shouldn't change the position of the actor. */
|
||||||
@@ -637,15 +638,6 @@ void Actor::Fade( float fSleepSeconds, CString sFadeString, float fFadeSeconds,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static CString GetParam( const CStringArray& sParams, int iIndex, int& iMaxIndexAccessed )
|
|
||||||
{
|
|
||||||
iMaxIndexAccessed = max( iIndex, iMaxIndexAccessed );
|
|
||||||
if( iIndex < int(sParams.size()) )
|
|
||||||
return sParams[iIndex];
|
|
||||||
else
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
void Actor::AddRotationH( float rot )
|
void Actor::AddRotationH( float rot )
|
||||||
{
|
{
|
||||||
RageQuatMultiply( &DestTweenState().quat, DestTweenState().quat, RageQuatFromH(rot) );
|
RageQuatMultiply( &DestTweenState().quat, DestTweenState().quat, RageQuatFromH(rot) );
|
||||||
@@ -677,8 +669,30 @@ float Actor::Command( CString sCommandString )
|
|||||||
|
|
||||||
for(unsigned d=0; d < asTokens.size(); d++)
|
for(unsigned d=0; d < asTokens.size(); d++)
|
||||||
{
|
{
|
||||||
TrimLeft(asTokens[d]); TrimRight(asTokens[d]);
|
TrimLeft(asTokens[d]);
|
||||||
|
TrimRight(asTokens[d]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( asTokens[0].size() == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
this->HandleCommand( asTokens );
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetTweenTimeLeft();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline CString GetParam( const CStringArray& sParams, int iIndex, int& iMaxIndexAccessed )
|
||||||
|
{
|
||||||
|
iMaxIndexAccessed = max( iIndex, iMaxIndexAccessed );
|
||||||
|
if( iIndex < int(sParams.size()) )
|
||||||
|
return sParams[iIndex];
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
void Actor::HandleCommand( const CStringArray &asTokens )
|
||||||
|
{
|
||||||
int iMaxIndexAccessed = 0;
|
int iMaxIndexAccessed = 0;
|
||||||
|
|
||||||
#define sParam(i) (GetParam(asTokens,i,iMaxIndexAccessed))
|
#define sParam(i) (GetParam(asTokens,i,iMaxIndexAccessed))
|
||||||
@@ -686,10 +700,7 @@ float Actor::Command( CString sCommandString )
|
|||||||
#define iParam(i) (atoi(sParam(i)))
|
#define iParam(i) (atoi(sParam(i)))
|
||||||
#define bParam(i) (iParam(i)!=0)
|
#define bParam(i) (iParam(i)!=0)
|
||||||
|
|
||||||
CString& sName = asTokens[0];
|
const CString& sName = asTokens[0];
|
||||||
|
|
||||||
if( sName.size() == 0 )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Commands that go in the tweening queue:
|
// Commands that go in the tweening queue:
|
||||||
if ( sName=="sleep" ) { BeginTweening( fParam(1), TWEEN_LINEAR ); BeginTweening( 0, TWEEN_LINEAR ); }
|
if ( sName=="sleep" ) { BeginTweening( fParam(1), TWEEN_LINEAR ); BeginTweening( 0, TWEEN_LINEAR ); }
|
||||||
@@ -765,29 +776,21 @@ float Actor::Command( CString sCommandString )
|
|||||||
else if( sName=="zbuffer" ) SetUseZBuffer( bParam(1) );
|
else if( sName=="zbuffer" ) SetUseZBuffer( bParam(1) );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CString sError = ssprintf( "Unrecognized command name '%s' in command string '%s'.", sName.c_str(), sCommandString.c_str() );
|
CString sError = ssprintf( "Actor::HandleCommand: Unrecognized command name '%s'.", sName.c_str() );
|
||||||
LOG->Warn( sError );
|
LOG->Warn( sError );
|
||||||
#if defined(WIN32) // XXX arch?
|
|
||||||
if( DISPLAY->IsWindowed() )
|
if( DISPLAY->IsWindowed() )
|
||||||
MessageBox(NULL, sError, "Actor::Command", MB_OK);
|
HOOKS->MessageBoxOK( sError );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( iMaxIndexAccessed != (int)asTokens.size()-1 )
|
if( iMaxIndexAccessed != (int)asTokens.size()-1 )
|
||||||
{
|
{
|
||||||
CString sError = ssprintf( "Wrong number of parameters in command '%s'. Expected %d but there are %d.", join(",",asTokens).c_str(), iMaxIndexAccessed+1, (int)asTokens.size() );
|
CString sError = ssprintf( "Actor::HandleCommand: Wrong number of parameters in command '%s'. Expected %d but there are %d.", join(",",asTokens).c_str(), iMaxIndexAccessed+1, (int)asTokens.size() );
|
||||||
LOG->Warn( sError );
|
LOG->Warn( sError );
|
||||||
#if defined(WIN32) // XXX arch?
|
|
||||||
if( DISPLAY->IsWindowed() )
|
if( DISPLAY->IsWindowed() )
|
||||||
MessageBox(NULL, sError, "Actor::Command", MB_OK);
|
HOOKS->MessageBoxOK( sError );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetTweenTimeLeft();
|
|
||||||
}
|
|
||||||
|
|
||||||
float Actor::GetCommandLength( CString command )
|
float Actor::GetCommandLength( CString command )
|
||||||
{
|
{
|
||||||
Actor temp;
|
Actor temp;
|
||||||
|
|||||||
@@ -257,7 +257,8 @@ public:
|
|||||||
void FadeOn( float fSleepSeconds, CString sFadeString, float fFadeSeconds ) { Fade(fSleepSeconds,sFadeString,fFadeSeconds,false); };
|
void FadeOn( float fSleepSeconds, CString sFadeString, float fFadeSeconds ) { Fade(fSleepSeconds,sFadeString,fFadeSeconds,false); };
|
||||||
void FadeOff( float fSleepSeconds, CString sFadeString, float fFadeSeconds ) { Fade(fSleepSeconds,sFadeString,fFadeSeconds,true); };
|
void FadeOff( float fSleepSeconds, CString sFadeString, float fFadeSeconds ) { Fade(fSleepSeconds,sFadeString,fFadeSeconds,true); };
|
||||||
|
|
||||||
virtual float Command( CString sCommandString ); // return length in seconds to execute command
|
float Command( CString sCommandString ); // return length in seconds to execute command
|
||||||
|
virtual void HandleCommand( const CStringArray &asTokens ); // derivable
|
||||||
static float GetCommandLength( CString command );
|
static float GetCommandLength( CString command );
|
||||||
|
|
||||||
virtual void SetState( int iNewState ) {};
|
virtual void SetState( int iNewState ) {};
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
#include "global.h" // testing updates
|
||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ActorUtil
|
||||||
|
|
||||||
|
Desc: See header.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ActorUtil.h"
|
||||||
|
#include "Sprite.h"
|
||||||
|
#include "BitmapText.h"
|
||||||
|
#include "Model.h"
|
||||||
|
|
||||||
|
|
||||||
|
Actor* MakeActor( CString sPath )
|
||||||
|
{
|
||||||
|
CString sDir, sFName, sExt;
|
||||||
|
splitrelpath( sPath, sDir, sFName, sExt );
|
||||||
|
sExt.MakeLower();
|
||||||
|
|
||||||
|
|
||||||
|
if( sExt=="png" ||
|
||||||
|
sExt=="jpg" ||
|
||||||
|
sExt=="gif" ||
|
||||||
|
sExt=="bmp" ||
|
||||||
|
sExt=="avi" ||
|
||||||
|
sExt=="mpeg" ||
|
||||||
|
sExt=="mpg" )
|
||||||
|
{
|
||||||
|
Sprite* pSprite = new Sprite;
|
||||||
|
pSprite->Load( sPath );
|
||||||
|
return pSprite;
|
||||||
|
}
|
||||||
|
if( sExt=="ini" )
|
||||||
|
{
|
||||||
|
BitmapText* pBitmapText = new BitmapText;
|
||||||
|
pBitmapText->LoadFromFont( sPath );
|
||||||
|
return pBitmapText;
|
||||||
|
}
|
||||||
|
if( sExt=="txt" )
|
||||||
|
{
|
||||||
|
Model* pModel = new Model;
|
||||||
|
pModel->LoadMilkshapeAscii( sPath );
|
||||||
|
return pModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT(0);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Actor.h"
|
#include "Actor.h"
|
||||||
|
#include "ThemeManager.h"
|
||||||
|
|
||||||
|
|
||||||
#define SET_XY( actor ) UtilSetXY( actor, m_sName )
|
#define SET_XY( actor ) UtilSetXY( actor, m_sName )
|
||||||
@@ -55,4 +56,7 @@ inline float UtilSetXYAndOnCommand( Actor& actor, CString sClassName )
|
|||||||
return UtilOnCommand( actor, sClassName );
|
return UtilOnCommand( actor, sClassName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return a Sprite, BitmapText, or Model depending on the file type
|
||||||
|
Actor* MakeActor( CString sPath );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ void BGAnimation::LoadFromAniDir( CString sAniDir )
|
|||||||
IniFile ini(sPathToIni);
|
IniFile ini(sPathToIni);
|
||||||
ini.ReadFile();
|
ini.ReadFile();
|
||||||
|
|
||||||
|
m_fLengthSeconds = -1;
|
||||||
|
ini.GetValueF( "BGAnimation", "LengthSeconds", m_fLengthSeconds );
|
||||||
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for( i=0; i<MAX_LAYERS; i++ )
|
for( i=0; i<MAX_LAYERS; i++ )
|
||||||
{
|
{
|
||||||
|
|||||||
+195
-167
@@ -24,7 +24,8 @@
|
|||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "ActorCollision.h"
|
#include "ActorCollision.h"
|
||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
|
#include "RageDisplay.h"
|
||||||
|
#include "ActorUtil.h"
|
||||||
|
|
||||||
|
|
||||||
const float PARTICLE_SPEED = 300;
|
const float PARTICLE_SPEED = 300;
|
||||||
@@ -46,9 +47,9 @@ BGAnimationLayer::~BGAnimationLayer()
|
|||||||
|
|
||||||
void BGAnimationLayer::Unload()
|
void BGAnimationLayer::Unload()
|
||||||
{
|
{
|
||||||
for( unsigned i=0; i<m_Sprites.size(); i++ )
|
for( unsigned i=0; i<m_pActors.size(); i++ )
|
||||||
delete m_Sprites[i];
|
delete m_pActors[i];
|
||||||
m_Sprites.clear();
|
m_pActors.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BGAnimationLayer::Init()
|
void BGAnimationLayer::Init()
|
||||||
@@ -56,6 +57,7 @@ void BGAnimationLayer::Init()
|
|||||||
Unload();
|
Unload();
|
||||||
|
|
||||||
m_fUpdateRate = 1;
|
m_fUpdateRate = 1;
|
||||||
|
m_fFOV = 0; // ortho
|
||||||
|
|
||||||
// m_bCycleColor = false;
|
// m_bCycleColor = false;
|
||||||
// m_bCycleAlpha = false;
|
// m_bCycleAlpha = false;
|
||||||
@@ -110,29 +112,32 @@ void BGAnimationLayer::LoadFromStaticGraphic( CString sPath )
|
|||||||
Init();
|
Init();
|
||||||
RageTextureID ID(sPath);
|
RageTextureID ID(sPath);
|
||||||
ID.iAlphaBits = 0;
|
ID.iAlphaBits = 0;
|
||||||
m_Sprites.push_back(new Sprite);
|
Sprite* pSprite = new Sprite;
|
||||||
m_Sprites.back()->LoadBG( ID );
|
pSprite->LoadBG( ID );
|
||||||
m_Sprites.back()->StretchTo( RectI(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
|
pSprite->StretchTo( RectI(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
|
||||||
|
m_pActors.push_back( pSprite );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BGAnimationLayer::LoadFromMovie( CString sMoviePath )
|
void BGAnimationLayer::LoadFromMovie( CString sMoviePath )
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
m_Sprites.push_back(new Sprite);
|
Sprite* pSprite = new Sprite;
|
||||||
m_Sprites.back()->LoadBG( sMoviePath );
|
pSprite->LoadBG( sMoviePath );
|
||||||
m_Sprites.back()->StretchTo( RectI(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
|
pSprite->StretchTo( RectI(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
|
||||||
m_Sprites.back()->GetTexture()->Play();
|
pSprite->GetTexture()->Play();
|
||||||
SDL_Delay( 50 ); // decode a frame so we don't see a black flash at the beginning
|
SDL_Delay( 50 ); // decode a frame so we don't see a black flash at the beginning
|
||||||
m_Sprites.back()->GetTexture()->Pause();
|
pSprite->GetTexture()->Pause();
|
||||||
|
m_pActors.push_back( pSprite );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BGAnimationLayer::LoadFromVisualization( CString sMoviePath )
|
void BGAnimationLayer::LoadFromVisualization( CString sMoviePath )
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
m_Sprites.push_back(new Sprite);
|
Sprite* pSprite = new Sprite;
|
||||||
m_Sprites.back()->LoadBG( sMoviePath );
|
m_pActors.push_back( pSprite );
|
||||||
m_Sprites.back()->StretchTo( RectI(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
|
pSprite->LoadBG( sMoviePath );
|
||||||
m_Sprites.back()->SetBlendMode( BLEND_ADD );
|
pSprite->StretchTo( RectI(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
|
||||||
|
pSprite->SetBlendMode( BLEND_ADD );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -192,10 +197,13 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath )
|
|||||||
switch( effect )
|
switch( effect )
|
||||||
{
|
{
|
||||||
case EFFECT_CENTER:
|
case EFFECT_CENTER:
|
||||||
|
{
|
||||||
m_Type = TYPE_SPRITE;
|
m_Type = TYPE_SPRITE;
|
||||||
m_Sprites.push_back(new Sprite);
|
Sprite* pSprite = new Sprite;
|
||||||
m_Sprites.back()->Load( sPath );
|
m_pActors.push_back( pSprite );
|
||||||
m_Sprites.back()->SetXY( CENTER_X, CENTER_Y );
|
pSprite->Load( sPath );
|
||||||
|
pSprite->SetXY( CENTER_X, CENTER_Y );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case EFFECT_STRETCH_STILL:
|
case EFFECT_STRETCH_STILL:
|
||||||
case EFFECT_STRETCH_SCROLL_LEFT:
|
case EFFECT_STRETCH_SCROLL_LEFT:
|
||||||
@@ -207,12 +215,13 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath )
|
|||||||
case EFFECT_STRETCH_TWIST:
|
case EFFECT_STRETCH_TWIST:
|
||||||
{
|
{
|
||||||
m_Type = TYPE_STRETCH;
|
m_Type = TYPE_STRETCH;
|
||||||
m_Sprites.push_back(new Sprite);
|
Sprite* pSprite = new Sprite;
|
||||||
|
m_pActors.push_back( pSprite );
|
||||||
RageTextureID ID(sPath);
|
RageTextureID ID(sPath);
|
||||||
ID.bStretch = true;
|
ID.bStretch = true;
|
||||||
m_Sprites.back()->LoadBG( ID );
|
pSprite->LoadBG( ID );
|
||||||
m_Sprites.back()->StretchTo( RectI(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
|
pSprite->StretchTo( RectI(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
|
||||||
m_Sprites.back()->SetCustomTextureRect( RectF(0,0,1,1) );
|
pSprite->SetCustomTextureRect( RectF(0,0,1,1) );
|
||||||
|
|
||||||
switch( effect )
|
switch( effect )
|
||||||
{
|
{
|
||||||
@@ -227,26 +236,27 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath )
|
|||||||
case EFFECT_STRETCH_SPIN:
|
case EFFECT_STRETCH_SPIN:
|
||||||
{
|
{
|
||||||
m_Type = TYPE_STRETCH;
|
m_Type = TYPE_STRETCH;
|
||||||
m_Sprites.push_back(new Sprite);
|
Sprite* pSprite = new Sprite;
|
||||||
m_Sprites.back()->LoadBG( sPath );
|
m_pActors.push_back( pSprite );
|
||||||
m_Sprites.back()->ScaleToCover( RectI(SCREEN_LEFT-200,SCREEN_TOP-200,SCREEN_RIGHT+200,SCREEN_BOTTOM+200) );
|
pSprite->LoadBG( sPath );
|
||||||
m_Sprites.back()->SetEffectSpin( RageVector3(0,0,60) );
|
pSprite->ScaleToCover( RectI(SCREEN_LEFT-200,SCREEN_TOP-200,SCREEN_RIGHT+200,SCREEN_BOTTOM+200) );
|
||||||
|
pSprite->SetEffectSpin( RageVector3(0,0,60) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EFFECT_PARTICLES_SPIRAL_OUT:
|
case EFFECT_PARTICLES_SPIRAL_OUT:
|
||||||
case EFFECT_PARTICLES_SPIRAL_IN:
|
case EFFECT_PARTICLES_SPIRAL_IN:
|
||||||
/* {
|
/* {
|
||||||
m_Type = TYPE_PARTICLES;
|
m_Type = TYPE_PARTICLES;
|
||||||
m_Sprites.back()->Load( sPath );
|
pSprite->Load( sPath );
|
||||||
int iSpriteArea = int( m_Sprites.back()->GetUnzoomedWidth()*m_Sprites.back()->GetUnzoomedHeight() );
|
int iSpriteArea = int( pSprite->GetUnzoomedWidth()*pSprite->GetUnzoomedHeight() );
|
||||||
int iMaxArea = SCREEN_WIDTH*SCREEN_HEIGHT;
|
int iMaxArea = SCREEN_WIDTH*SCREEN_HEIGHT;
|
||||||
m_iNumSprites = m_iNumParticles = iMaxArea / iSpriteArea;
|
m_iNumSprites = m_iNumParticles = iMaxArea / iSpriteArea;
|
||||||
m_iNumSprites = m_iNumParticles = min( m_iNumSprites, MAX_SPRITES );
|
m_iNumSprites = m_iNumParticles = min( m_iNumSprites, MAX_SPRITES );
|
||||||
for( unsigned i=0; i<m_iNumSprites; i++ )
|
for( unsigned i=0; i<m_iNumSprites; i++ )
|
||||||
{
|
{
|
||||||
m_Sprites[i].Load( sPath );
|
m_pActors[i].Load( sPath );
|
||||||
m_Sprites[i].SetZoom( randomf(0.2f,2) );
|
m_pActors[i].SetZoom( randomf(0.2f,2) );
|
||||||
m_Sprites[i].SetRotationZ( randomf(0,360) );
|
m_pActors[i].SetRotationZ( randomf(0,360) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -266,31 +276,32 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath )
|
|||||||
|
|
||||||
for( int i=0; i<m_iNumParticles; i++ )
|
for( int i=0; i<m_iNumParticles; i++ )
|
||||||
{
|
{
|
||||||
m_Sprites.push_back(new Sprite);
|
Sprite* pSprite = new Sprite;
|
||||||
m_Sprites.back()->Load( sPath );
|
m_pActors.push_back( pSprite );
|
||||||
m_Sprites.back()->SetZoom( 0.7f + 0.6f*i/(float)m_iNumParticles );
|
pSprite->Load( sPath );
|
||||||
m_Sprites.back()->SetX( randomf( GetGuardRailLeft(m_Sprites.back()), GetGuardRailRight(m_Sprites.back()) ) );
|
pSprite->SetZoom( 0.7f + 0.6f*i/(float)m_iNumParticles );
|
||||||
m_Sprites.back()->SetY( randomf( GetGuardRailTop(m_Sprites.back()), GetGuardRailBottom(m_Sprites.back()) ) );
|
pSprite->SetX( randomf( GetGuardRailLeft(pSprite), GetGuardRailRight(pSprite) ) );
|
||||||
|
pSprite->SetY( randomf( GetGuardRailTop(pSprite), GetGuardRailBottom(pSprite) ) );
|
||||||
|
|
||||||
switch( effect )
|
switch( effect )
|
||||||
{
|
{
|
||||||
case EFFECT_PARTICLES_FLOAT_UP:
|
case EFFECT_PARTICLES_FLOAT_UP:
|
||||||
case EFFECT_PARTICLES_SPIRAL_OUT:
|
case EFFECT_PARTICLES_SPIRAL_OUT:
|
||||||
m_vParticleVelocity[i] = RageVector3( 0, -PARTICLE_SPEED*m_Sprites.back()->GetZoom(), 0 );
|
m_vParticleVelocity[i] = RageVector3( 0, -PARTICLE_SPEED*pSprite->GetZoom(), 0 );
|
||||||
break;
|
break;
|
||||||
case EFFECT_PARTICLES_FLOAT_DOWN:
|
case EFFECT_PARTICLES_FLOAT_DOWN:
|
||||||
case EFFECT_PARTICLES_SPIRAL_IN:
|
case EFFECT_PARTICLES_SPIRAL_IN:
|
||||||
m_vParticleVelocity[i] = RageVector3( 0, PARTICLE_SPEED*m_Sprites.back()->GetZoom(), 0 );
|
m_vParticleVelocity[i] = RageVector3( 0, PARTICLE_SPEED*pSprite->GetZoom(), 0 );
|
||||||
break;
|
break;
|
||||||
case EFFECT_PARTICLES_FLOAT_LEFT:
|
case EFFECT_PARTICLES_FLOAT_LEFT:
|
||||||
m_vParticleVelocity[i] = RageVector3( -PARTICLE_SPEED*m_Sprites.back()->GetZoom(), 0, 0 );
|
m_vParticleVelocity[i] = RageVector3( -PARTICLE_SPEED*pSprite->GetZoom(), 0, 0 );
|
||||||
break;
|
break;
|
||||||
case EFFECT_PARTICLES_FLOAT_RIGHT:
|
case EFFECT_PARTICLES_FLOAT_RIGHT:
|
||||||
m_vParticleVelocity[i] = RageVector3( +PARTICLE_SPEED*m_Sprites.back()->GetZoom(), 0, 0 );
|
m_vParticleVelocity[i] = RageVector3( +PARTICLE_SPEED*pSprite->GetZoom(), 0, 0 );
|
||||||
break;
|
break;
|
||||||
case EFFECT_PARTICLES_BOUNCE:
|
case EFFECT_PARTICLES_BOUNCE:
|
||||||
m_bParticlesBounce = true;
|
m_bParticlesBounce = true;
|
||||||
m_Sprites.back()->SetZoom( 1 );
|
pSprite->SetZoom( 1 );
|
||||||
m_vParticleVelocity[i] = RageVector3( randomf(), randomf(), 0 );
|
m_vParticleVelocity[i] = RageVector3( randomf(), randomf(), 0 );
|
||||||
RageVec3Normalize( &m_vParticleVelocity[i], &m_vParticleVelocity[i] );
|
RageVec3Normalize( &m_vParticleVelocity[i], &m_vParticleVelocity[i] );
|
||||||
break;
|
break;
|
||||||
@@ -328,9 +339,10 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath )
|
|||||||
{
|
{
|
||||||
for( int y=0; y<m_iNumTilesHigh; y++ )
|
for( int y=0; y<m_iNumTilesHigh; y++ )
|
||||||
{
|
{
|
||||||
m_Sprites.push_back(new Sprite);
|
Sprite* pSprite = new Sprite;
|
||||||
m_Sprites.back()->Load( ID );
|
m_pActors.push_back( pSprite );
|
||||||
m_Sprites.back()->SetTextureWrapping( true ); // gets rid of some "cracks"
|
pSprite->Load( ID );
|
||||||
|
pSprite->SetTextureWrapping( true ); // gets rid of some "cracks"
|
||||||
|
|
||||||
switch( effect )
|
switch( effect )
|
||||||
{
|
{
|
||||||
@@ -349,13 +361,13 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath )
|
|||||||
m_fTileVelocityY = +PARTICLE_SPEED;
|
m_fTileVelocityY = +PARTICLE_SPEED;
|
||||||
break;
|
break;
|
||||||
case EFFECT_TILE_FLIP_X:
|
case EFFECT_TILE_FLIP_X:
|
||||||
m_Sprites.back()->SetEffectSpin( RageVector3(2,0,0) );
|
pSprite->SetEffectSpin( RageVector3(2,0,0) );
|
||||||
break;
|
break;
|
||||||
case EFFECT_TILE_FLIP_Y:
|
case EFFECT_TILE_FLIP_Y:
|
||||||
m_Sprites.back()->SetEffectSpin( RageVector3(0,2,0) );
|
pSprite->SetEffectSpin( RageVector3(0,2,0) );
|
||||||
break;
|
break;
|
||||||
case EFFECT_TILE_PULSE:
|
case EFFECT_TILE_PULSE:
|
||||||
m_Sprites.back()->SetEffectPulse( 1, 0.3f, 1.f );
|
pSprite->SetEffectPulse( 1, 0.3f, 1.f );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
@@ -372,24 +384,24 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath )
|
|||||||
sPath.MakeLower();
|
sPath.MakeLower();
|
||||||
|
|
||||||
if( sPath.Find("cyclecolor") != -1 )
|
if( sPath.Find("cyclecolor") != -1 )
|
||||||
for( unsigned i=0; i<m_Sprites.size(); i++ )
|
for( unsigned i=0; i<m_pActors.size(); i++ )
|
||||||
m_Sprites[i]->SetEffectRainbow( 5 );
|
m_pActors[i]->SetEffectRainbow( 5 );
|
||||||
|
|
||||||
if( sPath.Find("cyclealpha") != -1 )
|
if( sPath.Find("cyclealpha") != -1 )
|
||||||
for( unsigned i=0; i<m_Sprites.size(); i++ )
|
for( unsigned i=0; i<m_pActors.size(); i++ )
|
||||||
m_Sprites[i]->SetEffectDiffuseShift( 2, RageColor(1,1,1,1), RageColor(1,1,1,0) );
|
m_pActors[i]->SetEffectDiffuseShift( 2, RageColor(1,1,1,1), RageColor(1,1,1,0) );
|
||||||
|
|
||||||
if( sPath.Find("startonrandomframe") != -1 )
|
if( sPath.Find("startonrandomframe") != -1 )
|
||||||
for( unsigned i=0; i<m_Sprites.size(); i++ )
|
for( unsigned i=0; i<m_pActors.size(); i++ )
|
||||||
m_Sprites[i]->SetState( rand()%m_Sprites[i]->GetNumStates() );
|
m_pActors[i]->SetState( rand()%m_pActors[i]->GetNumStates() );
|
||||||
|
|
||||||
if( sPath.Find("dontanimate") != -1 )
|
if( sPath.Find("dontanimate") != -1 )
|
||||||
for( unsigned i=0; i<m_Sprites.size(); i++ )
|
for( unsigned i=0; i<m_pActors.size(); i++ )
|
||||||
m_Sprites[i]->StopAnimating();
|
m_pActors[i]->StopAnimating();
|
||||||
|
|
||||||
if( sPath.Find("add") != -1 )
|
if( sPath.Find("add") != -1 )
|
||||||
for( unsigned i=0; i<m_Sprites.size(); i++ )
|
for( unsigned i=0; i<m_pActors.size(); i++ )
|
||||||
m_Sprites[i]->SetBlendMode( BLEND_ADD );
|
m_pActors[i]->SetBlendMode( BLEND_ADD );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CString sDir, sFName, sExt;
|
CString sDir, sFName, sExt;
|
||||||
@@ -417,23 +429,23 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath )
|
|||||||
|
|
||||||
if(m_ShowTime != 0) // they don't want to show until a certain point... hide it all
|
if(m_ShowTime != 0) // they don't want to show until a certain point... hide it all
|
||||||
{
|
{
|
||||||
m_Sprites[0].SetDiffuse(RageColor(0,0,0,0));
|
m_pActors[0].SetDiffuse(RageColor(0,0,0,0));
|
||||||
}
|
}
|
||||||
if(m_PosX != 0)
|
if(m_PosX != 0)
|
||||||
{
|
{
|
||||||
m_Sprites[0].SetX(m_PosX);
|
m_pActors[0].SetX(m_PosX);
|
||||||
}
|
}
|
||||||
if(m_PosY != 0)
|
if(m_PosY != 0)
|
||||||
{
|
{
|
||||||
m_Sprites[0].SetY(m_PosY);
|
m_pActors[0].SetY(m_PosY);
|
||||||
}
|
}
|
||||||
if(m_Zoom != 0)
|
if(m_Zoom != 0)
|
||||||
{
|
{
|
||||||
m_Sprites[0].SetZoom(m_Zoom);
|
m_pActors[0].SetZoom(m_Zoom);
|
||||||
}
|
}
|
||||||
if(m_Rot != 0)
|
if(m_Rot != 0)
|
||||||
{
|
{
|
||||||
m_Sprites[0].SetRotationZ(m_Rot);
|
m_pActors[0].SetRotationZ(m_Rot);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@@ -503,6 +515,7 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer )
|
|||||||
|
|
||||||
ini.GetValueI( sLayer, "Type", (int&)m_Type );
|
ini.GetValueI( sLayer, "Type", (int&)m_Type );
|
||||||
ini.GetValue ( sLayer, "Command", m_sCommand );
|
ini.GetValue ( sLayer, "Command", m_sCommand );
|
||||||
|
ini.GetValueF( sLayer, "FOV", m_fFOV );
|
||||||
ini.GetValueF( sLayer, "StretchTexCoordVelocityX", m_fStretchTexCoordVelocityX );
|
ini.GetValueF( sLayer, "StretchTexCoordVelocityX", m_fStretchTexCoordVelocityX );
|
||||||
ini.GetValueF( sLayer, "StretchTexCoordVelocityY", m_fStretchTexCoordVelocityY );
|
ini.GetValueF( sLayer, "StretchTexCoordVelocityY", m_fStretchTexCoordVelocityY );
|
||||||
ini.GetValueF( sLayer, "ZoomMin", m_fZoomMin );
|
ini.GetValueF( sLayer, "ZoomMin", m_fZoomMin );
|
||||||
@@ -529,28 +542,31 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer )
|
|||||||
switch( m_Type )
|
switch( m_Type )
|
||||||
{
|
{
|
||||||
case TYPE_SPRITE:
|
case TYPE_SPRITE:
|
||||||
m_Sprites.push_back( new Sprite );
|
{
|
||||||
m_Sprites.back()->Load( sPath );
|
Actor* pActor = MakeActor( sPath );
|
||||||
m_Sprites.back()->SetXY( CENTER_X, CENTER_Y );
|
m_pActors.push_back( pActor );
|
||||||
|
pActor->SetXY( CENTER_X, CENTER_Y );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TYPE_STRETCH:
|
case TYPE_STRETCH:
|
||||||
{
|
{
|
||||||
m_Sprites.push_back( new Sprite );
|
Sprite* pSprite = new Sprite;
|
||||||
|
m_pActors.push_back( pSprite );
|
||||||
RageTextureID ID(sPath);
|
RageTextureID ID(sPath);
|
||||||
ID.bStretch = true;
|
ID.bStretch = true;
|
||||||
m_Sprites.back()->LoadBG( ID );
|
pSprite->LoadBG( ID );
|
||||||
m_Sprites.back()->StretchTo( RectI(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
|
pSprite->StretchTo( RectI(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
|
||||||
m_Sprites.back()->SetCustomTextureRect( RectF(0,0,1,1) );
|
pSprite->SetCustomTextureRect( RectF(0,0,1,1) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TYPE_PARTICLES:
|
case TYPE_PARTICLES:
|
||||||
{
|
{
|
||||||
for( int i=0; i<m_iNumParticles; i++ )
|
for( int i=0; i<m_iNumParticles; i++ )
|
||||||
{
|
{
|
||||||
m_Sprites.push_back( new Sprite );
|
Actor* pActor = MakeActor( sPath );
|
||||||
m_Sprites.back()->Load( sPath );
|
m_pActors.push_back( pActor );
|
||||||
m_Sprites.back()->SetXY( randomf(SCREEN_LEFT,SCREEN_RIGHT), randomf(SCREEN_TOP,SCREEN_BOTTOM) );
|
pActor->SetXY( randomf(SCREEN_LEFT,SCREEN_RIGHT), randomf(SCREEN_TOP,SCREEN_BOTTOM) );
|
||||||
m_Sprites.back()->SetZoom( randomf(m_fZoomMin,m_fZoomMax) );
|
pActor->SetZoom( randomf(m_fZoomMin,m_fZoomMax) );
|
||||||
m_vParticleVelocity[i] = RageVector3(
|
m_vParticleVelocity[i] = RageVector3(
|
||||||
randomf(m_fVelocityXMin,m_fVelocityXMax),
|
randomf(m_fVelocityXMin,m_fVelocityXMax),
|
||||||
randomf(m_fVelocityYMin,m_fVelocityYMax),
|
randomf(m_fVelocityYMin,m_fVelocityYMax),
|
||||||
@@ -578,10 +594,11 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer )
|
|||||||
unsigned NumSprites = m_iNumTilesWide * m_iNumTilesHigh;
|
unsigned NumSprites = m_iNumTilesWide * m_iNumTilesHigh;
|
||||||
for( unsigned i=0; i<NumSprites; i++ )
|
for( unsigned i=0; i<NumSprites; i++ )
|
||||||
{
|
{
|
||||||
m_Sprites.push_back( new Sprite );
|
Sprite* pSprite = new Sprite;
|
||||||
m_Sprites.back()->Load( ID );
|
m_pActors.push_back( pSprite );
|
||||||
m_Sprites.back()->SetTextureWrapping( true ); // gets rid of some "cracks"
|
pSprite->Load( ID );
|
||||||
m_Sprites.back()->SetZoom( randomf(m_fZoomMin,m_fZoomMax) );
|
pSprite->SetTextureWrapping( true ); // gets rid of some "cracks"
|
||||||
|
pSprite->SetZoom( randomf(m_fZoomMin,m_fZoomMax) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -593,14 +610,14 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer )
|
|||||||
ini.GetValueB( sLayer, "StartOnRandomFrame", bStartOnRandomFrame );
|
ini.GetValueB( sLayer, "StartOnRandomFrame", bStartOnRandomFrame );
|
||||||
if( bStartOnRandomFrame )
|
if( bStartOnRandomFrame )
|
||||||
{
|
{
|
||||||
for( unsigned i=0; i<m_Sprites.size(); i++ )
|
for( unsigned i=0; i<m_pActors.size(); i++ )
|
||||||
m_Sprites[i]->SetState( rand()%m_Sprites[i]->GetNumStates() );
|
m_pActors[i]->SetState( rand()%m_pActors[i]->GetNumStates() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_sCommand != "" )
|
if( m_sCommand != "" )
|
||||||
{
|
{
|
||||||
for( unsigned i=0; i<m_Sprites.size(); i++ )
|
for( unsigned i=0; i<m_pActors.size(); i++ )
|
||||||
m_Sprites[i]->Command( m_sCommand );
|
m_pActors[i]->Command( m_sCommand );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,8 +625,8 @@ float BGAnimationLayer::GetMaxTweenTimeLeft() const
|
|||||||
{
|
{
|
||||||
float ret = 0;
|
float ret = 0;
|
||||||
|
|
||||||
for( unsigned i=0; i<m_Sprites.size(); i++ )
|
for( unsigned i=0; i<m_pActors.size(); i++ )
|
||||||
ret = max(ret, m_Sprites[i]->GetTweenTimeLeft());
|
ret = max(ret, m_pActors[i]->GetTweenTimeLeft());
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -621,8 +638,8 @@ void BGAnimationLayer::Update( float fDeltaTime )
|
|||||||
const float fSongBeat = GAMESTATE->m_fSongBeat;
|
const float fSongBeat = GAMESTATE->m_fSongBeat;
|
||||||
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for( i=0; i<m_Sprites.size(); i++ )
|
for( i=0; i<m_pActors.size(); i++ )
|
||||||
m_Sprites[i]->Update( fDeltaTime );
|
m_pActors[i]->Update( fDeltaTime );
|
||||||
|
|
||||||
|
|
||||||
switch( m_Type )
|
switch( m_Type )
|
||||||
@@ -630,10 +647,12 @@ void BGAnimationLayer::Update( float fDeltaTime )
|
|||||||
case TYPE_SPRITE:
|
case TYPE_SPRITE:
|
||||||
break;
|
break;
|
||||||
case TYPE_STRETCH:
|
case TYPE_STRETCH:
|
||||||
for( i=0; i<m_Sprites.size(); i++ )
|
for( i=0; i<m_pActors.size(); i++ )
|
||||||
{
|
{
|
||||||
float fTexCoords[8];
|
float fTexCoords[8];
|
||||||
m_Sprites[i]->GetActiveTextureCoords( fTexCoords );
|
// FIXME: Very dangerous. How could we handle this better?
|
||||||
|
Sprite* pSprite = (Sprite*)m_pActors[i];
|
||||||
|
pSprite->GetActiveTextureCoords( fTexCoords );
|
||||||
|
|
||||||
for( int j=0; j<8; j+=2 )
|
for( int j=0; j<8; j+=2 )
|
||||||
{
|
{
|
||||||
@@ -641,81 +660,81 @@ void BGAnimationLayer::Update( float fDeltaTime )
|
|||||||
fTexCoords[j+1] += fDeltaTime*m_fStretchTexCoordVelocityY;
|
fTexCoords[j+1] += fDeltaTime*m_fStretchTexCoordVelocityY;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Sprites[i]->SetCustomTextureCoords( fTexCoords );
|
pSprite->SetCustomTextureCoords( fTexCoords );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/* case EFFECT_PARTICLES_SPIRAL_OUT:
|
/* case EFFECT_PARTICLES_SPIRAL_OUT:
|
||||||
for( i=0; i<m_iNumSprites; i++ )
|
for( i=0; i<m_iNumSprites; i++ )
|
||||||
{
|
{
|
||||||
m_Sprites[i].SetZoom( m_Sprites[i].GetZoom() + fDeltaTime );
|
m_pActors[i].SetZoom( m_pActors[i].GetZoom() + fDeltaTime );
|
||||||
if( m_Sprites[i].GetZoom() > SPIRAL_MAX_ZOOM )
|
if( m_pActors[i].GetZoom() > SPIRAL_MAX_ZOOM )
|
||||||
m_Sprites[i].SetZoom( SPIRAL_MIN_ZOOM );
|
m_pActors[i].SetZoom( SPIRAL_MIN_ZOOM );
|
||||||
|
|
||||||
m_Sprites[i].SetRotationZ( m_Sprites[i].GetRotationZ() + fDeltaTime );
|
m_pActors[i].SetRotationZ( m_pActors[i].GetRotationZ() + fDeltaTime );
|
||||||
|
|
||||||
float fRadius = (m_Sprites[i].GetZoom()-SPIRAL_MIN_ZOOM);
|
float fRadius = (m_pActors[i].GetZoom()-SPIRAL_MIN_ZOOM);
|
||||||
fRadius *= fRadius;
|
fRadius *= fRadius;
|
||||||
fRadius *= 200;
|
fRadius *= 200;
|
||||||
m_Sprites[i].SetX( CENTER_X + cosf(m_Sprites[i].GetRotationZ())*fRadius );
|
m_pActors[i].SetX( CENTER_X + cosf(m_pActors[i].GetRotationZ())*fRadius );
|
||||||
m_Sprites[i].SetY( CENTER_Y + sinf(m_Sprites[i].GetRotationZ())*fRadius );
|
m_pActors[i].SetY( CENTER_Y + sinf(m_pActors[i].GetRotationZ())*fRadius );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EFFECT_PARTICLES_SPIRAL_IN:
|
case EFFECT_PARTICLES_SPIRAL_IN:
|
||||||
for( i=0; i<m_iNumSprites; i++ )
|
for( i=0; i<m_iNumSprites; i++ )
|
||||||
{
|
{
|
||||||
m_Sprites[i].SetZoom( m_Sprites[i].GetZoom() - fDeltaTime );
|
m_pActors[i].SetZoom( m_pActors[i].GetZoom() - fDeltaTime );
|
||||||
if( m_Sprites[i].GetZoom() < SPIRAL_MIN_ZOOM )
|
if( m_pActors[i].GetZoom() < SPIRAL_MIN_ZOOM )
|
||||||
m_Sprites[i].SetZoom( SPIRAL_MAX_ZOOM );
|
m_pActors[i].SetZoom( SPIRAL_MAX_ZOOM );
|
||||||
|
|
||||||
m_Sprites[i].SetRotationZ( m_Sprites[i].GetRotationZ() - fDeltaTime );
|
m_pActors[i].SetRotationZ( m_pActors[i].GetRotationZ() - fDeltaTime );
|
||||||
|
|
||||||
float fRadius = (m_Sprites[i].GetZoom()-SPIRAL_MIN_ZOOM);
|
float fRadius = (m_pActors[i].GetZoom()-SPIRAL_MIN_ZOOM);
|
||||||
fRadius *= fRadius;
|
fRadius *= fRadius;
|
||||||
fRadius *= 200;
|
fRadius *= 200;
|
||||||
m_Sprites[i].SetX( CENTER_X + cosf(m_Sprites[i].GetRotationZ())*fRadius );
|
m_pActors[i].SetX( CENTER_X + cosf(m_pActors[i].GetRotationZ())*fRadius );
|
||||||
m_Sprites[i].SetY( CENTER_Y + sinf(m_Sprites[i].GetRotationZ())*fRadius );
|
m_pActors[i].SetY( CENTER_Y + sinf(m_pActors[i].GetRotationZ())*fRadius );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
case TYPE_PARTICLES:
|
case TYPE_PARTICLES:
|
||||||
for( i=0; i<m_Sprites.size(); i++ )
|
for( i=0; i<m_pActors.size(); i++ )
|
||||||
{
|
{
|
||||||
m_Sprites[i]->SetX( m_Sprites[i]->GetX() + fDeltaTime*m_vParticleVelocity[i].x );
|
m_pActors[i]->SetX( m_pActors[i]->GetX() + fDeltaTime*m_vParticleVelocity[i].x );
|
||||||
m_Sprites[i]->SetY( m_Sprites[i]->GetY() + fDeltaTime*m_vParticleVelocity[i].y );
|
m_pActors[i]->SetY( m_pActors[i]->GetY() + fDeltaTime*m_vParticleVelocity[i].y );
|
||||||
m_Sprites[i]->SetZ( m_Sprites[i]->GetZ() + fDeltaTime*m_vParticleVelocity[i].z );
|
m_pActors[i]->SetZ( m_pActors[i]->GetZ() + fDeltaTime*m_vParticleVelocity[i].z );
|
||||||
if( m_bParticlesBounce )
|
if( m_bParticlesBounce )
|
||||||
{
|
{
|
||||||
if( HitGuardRailLeft(m_Sprites[i]) )
|
if( HitGuardRailLeft(m_pActors[i]) )
|
||||||
{
|
{
|
||||||
m_vParticleVelocity[i].x *= -1;
|
m_vParticleVelocity[i].x *= -1;
|
||||||
m_Sprites[i]->SetX( GetGuardRailLeft(m_Sprites[i]) );
|
m_pActors[i]->SetX( GetGuardRailLeft(m_pActors[i]) );
|
||||||
}
|
}
|
||||||
if( HitGuardRailRight(m_Sprites[i]) )
|
if( HitGuardRailRight(m_pActors[i]) )
|
||||||
{
|
{
|
||||||
m_vParticleVelocity[i].x *= -1;
|
m_vParticleVelocity[i].x *= -1;
|
||||||
m_Sprites[i]->SetX( GetGuardRailRight(m_Sprites[i]) );
|
m_pActors[i]->SetX( GetGuardRailRight(m_pActors[i]) );
|
||||||
}
|
}
|
||||||
if( HitGuardRailTop(m_Sprites[i]) )
|
if( HitGuardRailTop(m_pActors[i]) )
|
||||||
{
|
{
|
||||||
m_vParticleVelocity[i].y *= -1;
|
m_vParticleVelocity[i].y *= -1;
|
||||||
m_Sprites[i]->SetY( GetGuardRailTop(m_Sprites[i]) );
|
m_pActors[i]->SetY( GetGuardRailTop(m_pActors[i]) );
|
||||||
}
|
}
|
||||||
if( HitGuardRailBottom(m_Sprites[i]) )
|
if( HitGuardRailBottom(m_pActors[i]) )
|
||||||
{
|
{
|
||||||
m_vParticleVelocity[i].y *= -1;
|
m_vParticleVelocity[i].y *= -1;
|
||||||
m_Sprites[i]->SetY( GetGuardRailBottom(m_Sprites[i]) );
|
m_pActors[i]->SetY( GetGuardRailBottom(m_pActors[i]) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // !m_bParticlesBounce
|
else // !m_bParticlesBounce
|
||||||
{
|
{
|
||||||
if( m_vParticleVelocity[i].x<0 && IsOffScreenLeft(m_Sprites[i]) )
|
if( m_vParticleVelocity[i].x<0 && IsOffScreenLeft(m_pActors[i]) )
|
||||||
m_Sprites[i]->SetX( GetOffScreenRight(m_Sprites[i]) );
|
m_pActors[i]->SetX( GetOffScreenRight(m_pActors[i]) );
|
||||||
if( m_vParticleVelocity[i].x>0 && IsOffScreenRight(m_Sprites[i]) )
|
if( m_vParticleVelocity[i].x>0 && IsOffScreenRight(m_pActors[i]) )
|
||||||
m_Sprites[i]->SetX( GetOffScreenLeft(m_Sprites[i]) );
|
m_pActors[i]->SetX( GetOffScreenLeft(m_pActors[i]) );
|
||||||
if( m_vParticleVelocity[i].y<0 && IsOffScreenTop(m_Sprites[i]) )
|
if( m_vParticleVelocity[i].y<0 && IsOffScreenTop(m_pActors[i]) )
|
||||||
m_Sprites[i]->SetY( GetOffScreenBottom(m_Sprites[i]) );
|
m_pActors[i]->SetY( GetOffScreenBottom(m_pActors[i]) );
|
||||||
if( m_vParticleVelocity[i].y>0 && IsOffScreenBottom(m_Sprites[i]) )
|
if( m_vParticleVelocity[i].y>0 && IsOffScreenBottom(m_pActors[i]) )
|
||||||
m_Sprites[i]->SetY( GetOffScreenTop(m_Sprites[i]) );
|
m_pActors[i]->SetY( GetOffScreenTop(m_pActors[i]) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -725,7 +744,7 @@ void BGAnimationLayer::Update( float fDeltaTime )
|
|||||||
float fTotalWidth = m_iNumTilesWide * m_fTilesSpacingX;
|
float fTotalWidth = m_iNumTilesWide * m_fTilesSpacingX;
|
||||||
float fTotalHeight = m_iNumTilesHigh * m_fTilesSpacingY;
|
float fTotalHeight = m_iNumTilesHigh * m_fTilesSpacingY;
|
||||||
|
|
||||||
ASSERT( int(m_Sprites.size()) == m_iNumTilesWide * m_iNumTilesHigh );
|
ASSERT( int(m_pActors.size()) == m_iNumTilesWide * m_iNumTilesHigh );
|
||||||
|
|
||||||
for( int x=0; x<m_iNumTilesWide; x++ )
|
for( int x=0; x<m_iNumTilesWide; x++ )
|
||||||
{
|
{
|
||||||
@@ -748,30 +767,30 @@ void BGAnimationLayer::Update( float fDeltaTime )
|
|||||||
fX -= m_fTilesSpacingX/2;
|
fX -= m_fTilesSpacingX/2;
|
||||||
fY -= m_fTilesSpacingY/2;
|
fY -= m_fTilesSpacingY/2;
|
||||||
|
|
||||||
m_Sprites[i]->SetX( fX );
|
m_pActors[i]->SetX( fX );
|
||||||
m_Sprites[i]->SetY( fY );
|
m_pActors[i]->SetY( fY );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
for( i=0; i<m_iNumSprites; i++ )
|
for( i=0; i<m_iNumSprites; i++ )
|
||||||
{
|
{
|
||||||
m_Sprites[i].SetX( m_Sprites[i].GetX() + fDeltaTime* );
|
m_pActors[i].SetX( m_pActors[i].GetX() + fDeltaTime* );
|
||||||
m_Sprites[i].SetY( m_Sprites[i].GetY() + fDeltaTime*m_vParticleVelocity[i].y );
|
m_pActors[i].SetY( m_pActors[i].GetY() + fDeltaTime*m_vParticleVelocity[i].y );
|
||||||
m_Sprites[i].SetZ( m_Sprites[i].GetZ() + fDeltaTime*m_vParticleVelocity[i].z );
|
m_pActors[i].SetZ( m_pActors[i].GetZ() + fDeltaTime*m_vParticleVelocity[i].z );
|
||||||
if( IsOffScreenLeft(&m_Sprites[i]) )
|
if( IsOffScreenLeft(&m_pActors[i]) )
|
||||||
m_Sprites[i].SetX( m_Sprites[i].GetX()-GetOffScreenLeft(&m_Sprites[i]) + GetOffScreenRight(&m_Sprites[i]) );
|
m_pActors[i].SetX( m_pActors[i].GetX()-GetOffScreenLeft(&m_pActors[i]) + GetOffScreenRight(&m_pActors[i]) );
|
||||||
if( IsOffScreenRight(&m_Sprites[i]) )
|
if( IsOffScreenRight(&m_pActors[i]) )
|
||||||
m_Sprites[i].SetX( m_Sprites[i].GetX()-GetOffScreenRight(&m_Sprites[i]) + GetOffScreenLeft(&m_Sprites[i]) );
|
m_pActors[i].SetX( m_pActors[i].GetX()-GetOffScreenRight(&m_pActors[i]) + GetOffScreenLeft(&m_pActors[i]) );
|
||||||
if( IsOffScreenTop(&m_Sprites[i]) )
|
if( IsOffScreenTop(&m_pActors[i]) )
|
||||||
m_Sprites[i].SetY( m_Sprites[i].GetY()-GetOffScreenTop(&m_Sprites[i]) + GetOffScreenBottom(&m_Sprites[i]) );
|
m_pActors[i].SetY( m_pActors[i].GetY()-GetOffScreenTop(&m_pActors[i]) + GetOffScreenBottom(&m_pActors[i]) );
|
||||||
if( IsOffScreenBottom(&m_Sprites[i]) )
|
if( IsOffScreenBottom(&m_pActors[i]) )
|
||||||
m_Sprites[i].SetY( m_Sprites[i].GetY()-GetOffScreenBottom(&m_Sprites[i]) + GetOffScreenTop(&m_Sprites[i]) );
|
m_pActors[i].SetY( m_pActors[i].GetY()-GetOffScreenBottom(&m_pActors[i]) + GetOffScreenTop(&m_pActors[i]) );
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EFFECT_TILE_PULSE:
|
case EFFECT_TILE_PULSE:
|
||||||
for( i=0; i<m_Sprites.size(); i++ )
|
for( i=0; i<m_pActors.size(); i++ )
|
||||||
m_Sprites[i]->SetZoom( sinf( fSongBeat*PI/2 ) );
|
m_pActors[i]->SetZoom( sinf( fSongBeat*PI/2 ) );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -784,7 +803,7 @@ void BGAnimationLayer::Update( float fDeltaTime )
|
|||||||
m_TweenStartTime -= fDeltaTime;
|
m_TweenStartTime -= fDeltaTime;
|
||||||
if(m_TweenStartTime <= 0) // if we've gone past the magic point... show the beast....
|
if(m_TweenStartTime <= 0) // if we've gone past the magic point... show the beast....
|
||||||
{
|
{
|
||||||
// m_Sprites[0].SetXY( m_TweenX, m_TweenY);
|
// m_pActors[0].SetXY( m_TweenX, m_TweenY);
|
||||||
|
|
||||||
// WHAT WOULD BE NICE HERE:
|
// WHAT WOULD BE NICE HERE:
|
||||||
// Set the Sprite Tweening To m_TweenX and m_TweenY
|
// Set the Sprite Tweening To m_TweenX and m_TweenY
|
||||||
@@ -808,25 +827,25 @@ void BGAnimationLayer::Update( float fDeltaTime )
|
|||||||
{
|
{
|
||||||
if(m_TweenPassedY != 1) // Check to see if we still need to Tween Along the Y Axis
|
if(m_TweenPassedY != 1) // Check to see if we still need to Tween Along the Y Axis
|
||||||
{
|
{
|
||||||
if(m_Sprites[0].GetY() < m_TweenY) // it needs to travel down
|
if(m_pActors[0].GetY() < m_TweenY) // it needs to travel down
|
||||||
{
|
{
|
||||||
// Speed = Distance / Time....
|
// Speed = Distance / Time....
|
||||||
// Take away from the current position... the distance it has to travel divided by the time they want it done in...
|
// Take away from the current position... the distance it has to travel divided by the time they want it done in...
|
||||||
m_Sprites[0].SetY(m_Sprites[0].GetY() + ((m_TweenY - m_PosY)/(m_TweenSpeed*60)));
|
m_pActors[0].SetY(m_pActors[0].GetY() + ((m_TweenY - m_PosY)/(m_TweenSpeed*60)));
|
||||||
|
|
||||||
if(m_Sprites[0].GetY() > m_TweenY) // passed the location we wanna go to?
|
if(m_pActors[0].GetY() > m_TweenY) // passed the location we wanna go to?
|
||||||
{
|
{
|
||||||
m_Sprites[0].SetY(m_TweenY); // set it to the exact location we want
|
m_pActors[0].SetY(m_TweenY); // set it to the exact location we want
|
||||||
m_TweenPassedY = 1; // say we passed it.
|
m_TweenPassedY = 1; // say we passed it.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // travelling up
|
else // travelling up
|
||||||
{
|
{
|
||||||
m_Sprites[0].SetY(m_Sprites[0].GetY() - ((m_TweenY + m_PosY)/(m_TweenSpeed*60)));
|
m_pActors[0].SetY(m_pActors[0].GetY() - ((m_TweenY + m_PosY)/(m_TweenSpeed*60)));
|
||||||
|
|
||||||
if(m_Sprites[0].GetY() < m_TweenY)
|
if(m_pActors[0].GetY() < m_TweenY)
|
||||||
{
|
{
|
||||||
m_Sprites[0].SetY(m_TweenY);
|
m_pActors[0].SetY(m_TweenY);
|
||||||
m_TweenPassedY = 1;
|
m_TweenPassedY = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -834,21 +853,21 @@ void BGAnimationLayer::Update( float fDeltaTime )
|
|||||||
|
|
||||||
if(m_TweenPassedX != 1) // Check to see if we still need to Tween Along the X Axis
|
if(m_TweenPassedX != 1) // Check to see if we still need to Tween Along the X Axis
|
||||||
{
|
{
|
||||||
if(m_Sprites[0].GetX() < m_TweenX) // it needs to travel right
|
if(m_pActors[0].GetX() < m_TweenX) // it needs to travel right
|
||||||
{
|
{
|
||||||
m_Sprites[0].SetX(m_Sprites[0].GetX() + ((m_TweenX - m_PosX)/(m_TweenSpeed*60)));
|
m_pActors[0].SetX(m_pActors[0].GetX() + ((m_TweenX - m_PosX)/(m_TweenSpeed*60)));
|
||||||
if(m_Sprites[0].GetX() > m_TweenX)
|
if(m_pActors[0].GetX() > m_TweenX)
|
||||||
{
|
{
|
||||||
m_Sprites[0].SetX(m_TweenX);
|
m_pActors[0].SetX(m_TweenX);
|
||||||
m_TweenPassedX = 1;
|
m_TweenPassedX = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // travelling left
|
else // travelling left
|
||||||
{
|
{
|
||||||
m_Sprites[0].SetX(m_Sprites[0].GetX() - ((m_TweenX + m_PosX)/(m_TweenSpeed*60)));
|
m_pActors[0].SetX(m_pActors[0].GetX() - ((m_TweenX + m_PosX)/(m_TweenSpeed*60)));
|
||||||
if(m_Sprites[0].GetX() < m_TweenX)
|
if(m_pActors[0].GetX() < m_TweenX)
|
||||||
{
|
{
|
||||||
m_Sprites[0].SetX(m_TweenX);
|
m_pActors[0].SetX(m_TweenX);
|
||||||
m_TweenPassedX = 1;
|
m_TweenPassedX = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -865,7 +884,7 @@ void BGAnimationLayer::Update( float fDeltaTime )
|
|||||||
m_ShowTime -= fDeltaTime;
|
m_ShowTime -= fDeltaTime;
|
||||||
if(m_ShowTime <= 0) // if we've gone past the magic point... show the beast....
|
if(m_ShowTime <= 0) // if we've gone past the magic point... show the beast....
|
||||||
{
|
{
|
||||||
m_Sprites[0].SetDiffuse( RageColor(1,1,1,1) );
|
m_pActors[0].SetDiffuse( RageColor(1,1,1,1) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(m_HideTime != 0 && !(m_HideTime < 0)) // make sure it's not 0 or less than 0...
|
if(m_HideTime != 0 && !(m_HideTime < 0)) // make sure it's not 0 or less than 0...
|
||||||
@@ -873,7 +892,7 @@ void BGAnimationLayer::Update( float fDeltaTime )
|
|||||||
m_HideTime -= fDeltaTime;
|
m_HideTime -= fDeltaTime;
|
||||||
if(m_HideTime <= 0) // if we've gone past the magic point... hide the beast....
|
if(m_HideTime <= 0) // if we've gone past the magic point... hide the beast....
|
||||||
{
|
{
|
||||||
m_Sprites[0].SetDiffuse( RageColor(0,0,0,0) );
|
m_pActors[0].SetDiffuse( RageColor(0,0,0,0) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -882,32 +901,41 @@ void BGAnimationLayer::Update( float fDeltaTime )
|
|||||||
|
|
||||||
void BGAnimationLayer::Draw()
|
void BGAnimationLayer::Draw()
|
||||||
{
|
{
|
||||||
for( unsigned i=0; i<m_Sprites.size(); i++ )
|
DISPLAY->LoadMenuPerspective( m_fFOV );
|
||||||
m_Sprites[i]->Draw();
|
for( unsigned i=0; i<m_pActors.size(); i++ )
|
||||||
|
m_pActors[i]->Draw();
|
||||||
|
DISPLAY->LoadMenuPerspective( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BGAnimationLayer::SetDiffuse( RageColor c )
|
void BGAnimationLayer::SetDiffuse( RageColor c )
|
||||||
{
|
{
|
||||||
for(unsigned i=0; i<m_Sprites.size(); i++)
|
for(unsigned i=0; i<m_pActors.size(); i++)
|
||||||
m_Sprites[i]->SetDiffuse(c);
|
m_pActors[i]->SetDiffuse(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BGAnimationLayer::GainingFocus( float fRate, bool bRewindMovie, bool bLoop )
|
void BGAnimationLayer::GainingFocus( float fRate, bool bRewindMovie, bool bLoop )
|
||||||
{
|
{
|
||||||
m_fUpdateRate = fRate;
|
m_fUpdateRate = fRate;
|
||||||
m_Sprites.back()->GetTexture()->SetPlaybackRate(fRate);
|
|
||||||
|
// FIXME: Very dangerous. How could we handle this better?
|
||||||
|
Sprite* pSprite = (Sprite*)m_pActors[0];
|
||||||
|
|
||||||
|
pSprite->GetTexture()->SetPlaybackRate(fRate);
|
||||||
if( bRewindMovie )
|
if( bRewindMovie )
|
||||||
m_Sprites[0]->GetTexture()->SetPosition( 0 );
|
pSprite->GetTexture()->SetPosition( 0 );
|
||||||
m_Sprites.back()->GetTexture()->SetLooping(bLoop);
|
pSprite->GetTexture()->SetLooping(bLoop);
|
||||||
|
|
||||||
// if movie texture, pause and play movie so we don't waste CPU cycles decoding frames that won't be shown
|
// if movie texture, pause and play movie so we don't waste CPU cycles decoding frames that won't be shown
|
||||||
m_Sprites[0]->GetTexture()->Play();
|
pSprite->GetTexture()->Play();
|
||||||
|
|
||||||
for( unsigned i=0; i<m_Sprites.size(); i++ )
|
for( unsigned i=0; i<m_pActors.size(); i++ )
|
||||||
m_Sprites[i]->Command( m_sCommand );
|
m_pActors[i]->Command( m_sCommand );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BGAnimationLayer::LosingFocus()
|
void BGAnimationLayer::LosingFocus()
|
||||||
{
|
{
|
||||||
m_Sprites[0]->GetTexture()->Pause();
|
// FIXME: Very dangerous. How could we handle this better?
|
||||||
|
Sprite* pSprite = (Sprite*)m_pActors[0];
|
||||||
|
|
||||||
|
pSprite->GetTexture()->Pause();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public:
|
|||||||
void LosingFocus();
|
void LosingFocus();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
vector<Sprite *> m_Sprites;
|
vector<Actor*> m_pActors;
|
||||||
RageVector3 m_vParticleVelocity[MAX_SPRITES];
|
RageVector3 m_vParticleVelocity[MAX_SPRITES];
|
||||||
|
|
||||||
enum Effect {
|
enum Effect {
|
||||||
@@ -97,6 +97,7 @@ protected:
|
|||||||
// common stuff
|
// common stuff
|
||||||
CString m_sCommand;
|
CString m_sCommand;
|
||||||
float m_fUpdateRate; // get by GainingFocus
|
float m_fUpdateRate; // get by GainingFocus
|
||||||
|
float m_fFOV;
|
||||||
|
|
||||||
// stretch stuff
|
// stretch stuff
|
||||||
float m_fStretchTexCoordVelocityX;
|
float m_fStretchTexCoordVelocityX;
|
||||||
@@ -123,7 +124,6 @@ protected:
|
|||||||
float m_fTileVelocityX;
|
float m_fTileVelocityX;
|
||||||
float m_fTileVelocityY;
|
float m_fTileVelocityY;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ void BitmapText::BuildChars()
|
|||||||
|
|
||||||
for( unsigned j=0; j<szLine.size(); j++ ) // for each character in the line
|
for( unsigned j=0; j<szLine.size(); j++ ) // for each character in the line
|
||||||
{
|
{
|
||||||
RageVertex v[4];
|
RageSpriteVertex v[4];
|
||||||
const glyph &g = m_pFont->GetGlyph(szLine[j]);
|
const glyph &g = m_pFont->GetGlyph(szLine[j]);
|
||||||
|
|
||||||
/* set vertex positions */
|
/* set vertex positions */
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ protected:
|
|||||||
|
|
||||||
bool m_bRainbow;
|
bool m_bRainbow;
|
||||||
|
|
||||||
vector<RageVertex> verts;
|
vector<RageSpriteVertex> verts;
|
||||||
vector<RageTexture *> tex;
|
vector<RageTexture *> tex;
|
||||||
|
|
||||||
void BuildChars();
|
void BuildChars();
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ void GrooveGraph::Mountain::DrawPrimitives()
|
|||||||
{
|
{
|
||||||
DISPLAY->SetTexture( NULL );
|
DISPLAY->SetTexture( NULL );
|
||||||
DISPLAY->SetTextureModeModulate();
|
DISPLAY->SetTextureModeModulate();
|
||||||
RageVertex v[4];
|
RageSpriteVertex v[4];
|
||||||
|
|
||||||
for( int i=NUM_DIFFICULTIES-1; i>=0; i-- )
|
for( int i=NUM_DIFFICULTIES-1; i>=0; i-- )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives()
|
|||||||
|
|
||||||
DISPLAY->SetTexture( NULL );
|
DISPLAY->SetTexture( NULL );
|
||||||
DISPLAY->SetTextureModeModulate();
|
DISPLAY->SetTextureModeModulate();
|
||||||
RageVertex v[12]; // needed to draw 5 fan primitives and 10 strip primitives
|
RageSpriteVertex 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++ )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -489,7 +489,7 @@ void LifeStream::DrawPrimitives()
|
|||||||
{
|
{
|
||||||
// make the object in logical units centered at the origin
|
// make the object in logical units centered at the origin
|
||||||
LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer();
|
LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer();
|
||||||
RAGEVERTEX* v;
|
RageSpriteVertex* v;
|
||||||
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
|
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
|
||||||
|
|
||||||
int iNumV = 0;
|
int iNumV = 0;
|
||||||
@@ -570,8 +570,8 @@ void LifeStream::DrawPrimitives()
|
|||||||
|
|
||||||
|
|
||||||
// finally! Pump those triangles!
|
// finally! Pump those triangles!
|
||||||
pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX );
|
pd3dDevice->SetVertexShader( D3DFVF_RageSpriteVertex );
|
||||||
pd3dDevice->SetStreamSource( 0, pVB, sizeof(RAGEVERTEX) );
|
pd3dDevice->SetStreamSource( 0, pVB, sizeof(RageSpriteVertex) );
|
||||||
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, iNumV-2 );
|
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, iNumV-2 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -614,7 +614,7 @@ void Model::DrawPrimitives()
|
|||||||
for (int i = 0; i < (int)m_Meshes.size(); i++)
|
for (int i = 0; i < (int)m_Meshes.size(); i++)
|
||||||
{
|
{
|
||||||
msMesh *pMesh = &m_Meshes[i];
|
msMesh *pMesh = &m_Meshes[i];
|
||||||
RageVertexVector& TempVertices = m_vTempVerticesByBone[i];
|
RageModelVertexVector& TempVertices = m_vTempVerticesByBone[i];
|
||||||
|
|
||||||
// apply material
|
// apply material
|
||||||
if( pMesh->nMaterialIndex != -1 )
|
if( pMesh->nMaterialIndex != -1 )
|
||||||
@@ -647,11 +647,9 @@ void Model::DrawPrimitives()
|
|||||||
// process vertices
|
// process vertices
|
||||||
for (int j = 0; j < (int)pMesh->Vertices.size(); j++)
|
for (int j = 0; j < (int)pMesh->Vertices.size(); j++)
|
||||||
{
|
{
|
||||||
RageVertex& tempVert = TempVertices[j];
|
RageModelVertex& tempVert = TempVertices[j];
|
||||||
msVertex& originalVert = pMesh->Vertices[j];
|
msVertex& originalVert = pMesh->Vertices[j];
|
||||||
|
|
||||||
tempVert.c = RageColor(1,1,1,1);
|
|
||||||
|
|
||||||
memcpy( &tempVert.t, originalVert.uv, sizeof(originalVert.uv) );
|
memcpy( &tempVert.t, originalVert.uv, sizeof(originalVert.uv) );
|
||||||
|
|
||||||
if( originalVert.nBoneIndex == -1 )
|
if( originalVert.nBoneIndex == -1 )
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ private:
|
|||||||
|
|
||||||
RageVector3 m_vMins, m_vMaxs;
|
RageVector3 m_vMins, m_vMaxs;
|
||||||
myBone_t *m_pBones;
|
myBone_t *m_pBones;
|
||||||
typedef vector<RageVertex> RageVertexVector;
|
typedef vector<RageModelVertex> RageModelVertexVector;
|
||||||
vector<RageVertexVector> m_vTempVerticesByBone;
|
vector<RageModelVertexVector> m_vTempVerticesByBone;
|
||||||
float m_fCurrFrame;
|
float m_fCurrFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
|
|||||||
/* The body and caps should have no overlap, so their order doesn't matter.
|
/* The body and caps should have no overlap, so their order doesn't matter.
|
||||||
* Draw the head last, so it appears on top. */
|
* Draw the head last, so it appears on top. */
|
||||||
const int size = 4096;
|
const int size = 4096;
|
||||||
static RageVertex queue[size];
|
static RageSpriteVertex queue[size];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Draw the bottom cap (always wavy)
|
// Draw the bottom cap (always wavy)
|
||||||
@@ -421,7 +421,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
|
|||||||
Sprite* pBottomCap = GetHoldBottomCapSprite( hn.fStartBeat, bActive );
|
Sprite* pBottomCap = GetHoldBottomCapSprite( hn.fStartBeat, bActive );
|
||||||
|
|
||||||
// draw manually in small segments
|
// draw manually in small segments
|
||||||
RageVertex *v = &queue[0];
|
RageSpriteVertex *v = &queue[0];
|
||||||
RageTexture* pTexture = pBottomCap->GetTexture();
|
RageTexture* pTexture = pBottomCap->GetTexture();
|
||||||
const RectF *pRect = pBottomCap->GetCurrentTextureCoordRect();
|
const RectF *pRect = pBottomCap->GetCurrentTextureCoordRect();
|
||||||
DISPLAY->SetTexture( pTexture );
|
DISPLAY->SetTexture( pTexture );
|
||||||
@@ -490,7 +490,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
|
|||||||
Sprite* pSprBody = GetHoldBodySprite( hn.fStartBeat, bActive );
|
Sprite* pSprBody = GetHoldBodySprite( hn.fStartBeat, bActive );
|
||||||
|
|
||||||
// draw manually in small segments
|
// draw manually in small segments
|
||||||
RageVertex *v = &queue[0];
|
RageSpriteVertex *v = &queue[0];
|
||||||
RageTexture* pTexture = pSprBody->GetTexture();
|
RageTexture* pTexture = pSprBody->GetTexture();
|
||||||
const RectF *pRect = pSprBody->GetCurrentTextureCoordRect();
|
const RectF *pRect = pSprBody->GetCurrentTextureCoordRect();
|
||||||
DISPLAY->SetTexture( pTexture );
|
DISPLAY->SetTexture( pTexture );
|
||||||
@@ -572,7 +572,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
|
|||||||
Sprite* pSprTopCap = GetHoldTopCapSprite( hn.fStartBeat, bActive );
|
Sprite* pSprTopCap = GetHoldTopCapSprite( hn.fStartBeat, bActive );
|
||||||
|
|
||||||
// draw manually in small segments
|
// draw manually in small segments
|
||||||
RageVertex *v = &queue[0];
|
RageSpriteVertex *v = &queue[0];
|
||||||
RageTexture* pTexture = pSprTopCap->GetTexture();
|
RageTexture* pTexture = pSprTopCap->GetTexture();
|
||||||
const RectF *pRect = pSprTopCap->GetCurrentTextureCoordRect();
|
const RectF *pRect = pSprTopCap->GetCurrentTextureCoordRect();
|
||||||
DISPLAY->SetTexture( pTexture );
|
DISPLAY->SetTexture( pTexture );
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ apply_color_key:
|
|||||||
if( HintString.Find("4alphaonly") != -1 ) actualID.iTransparencyOnly = 4;
|
if( HintString.Find("4alphaonly") != -1 ) actualID.iTransparencyOnly = 4;
|
||||||
else if( HintString.Find("8alphaonly") != -1 ) actualID.iTransparencyOnly = 8;
|
else if( HintString.Find("8alphaonly") != -1 ) actualID.iTransparencyOnly = 8;
|
||||||
if( HintString.Find("dither") != -1 ) actualID.bDither = true;
|
if( HintString.Find("dither") != -1 ) actualID.bDither = true;
|
||||||
|
if( HintString.Find("stretch") != -1 ) actualID.bStretch = true;
|
||||||
|
|
||||||
if( actualID.iTransparencyOnly )
|
if( actualID.iTransparencyOnly )
|
||||||
actualID.iColorDepth = 32; /* Treat the image as 32-bit, so we don't lose any alpha precision. */
|
actualID.iColorDepth = 32; /* Treat the image as 32-bit, so we don't lose any alpha precision. */
|
||||||
@@ -312,6 +313,8 @@ apply_color_key:
|
|||||||
// HACK: Don't check song graphics. Many of them are weird dimensions.
|
// HACK: Don't check song graphics. Many of them are weird dimensions.
|
||||||
if( (actualID.filename.length()>=6 && actualID.filename.Left(6)=="Songs/") )
|
if( (actualID.filename.length()>=6 && actualID.filename.Left(6)=="Songs/") )
|
||||||
bRunCheck = false;
|
bRunCheck = false;
|
||||||
|
if( (actualID.filename.length()>=6 && actualID.filename.Left(9)=="CDTitles/") )
|
||||||
|
bRunCheck = false;
|
||||||
|
|
||||||
if( bRunCheck )
|
if( bRunCheck )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ void RageDisplay::StatsAddVerts( int iNumVertsRendered ) { g_iVertsRenderedSince
|
|||||||
/* Draw a line as a quad. GL_LINES with antialiasing off can draw line
|
/* Draw a line as a quad. GL_LINES with antialiasing off can draw line
|
||||||
* ends at odd angles--they're forced to axis-alignment regardless of the
|
* ends at odd angles--they're forced to axis-alignment regardless of the
|
||||||
* angle of the line. */
|
* angle of the line. */
|
||||||
void RageDisplay::DrawPolyLine(const RageVertex &p1, const RageVertex &p2, float LineWidth )
|
void RageDisplay::DrawPolyLine(const RageSpriteVertex &p1, const RageSpriteVertex &p2, float LineWidth )
|
||||||
{
|
{
|
||||||
/* soh cah toa strikes strikes again! */
|
/* soh cah toa strikes strikes again! */
|
||||||
float opp = p2.p.x - p1.p.x;
|
float opp = p2.p.x - p1.p.x;
|
||||||
@@ -137,7 +137,7 @@ void RageDisplay::DrawPolyLine(const RageVertex &p1, const RageVertex &p2, float
|
|||||||
float lsin = opp/hyp;
|
float lsin = opp/hyp;
|
||||||
float lcos = adj/hyp;
|
float lcos = adj/hyp;
|
||||||
|
|
||||||
RageVertex v[4];
|
RageSpriteVertex v[4];
|
||||||
|
|
||||||
v[0] = v[1] = p1;
|
v[0] = v[1] = p1;
|
||||||
v[2] = v[3] = p2;
|
v[2] = v[3] = p2;
|
||||||
@@ -158,7 +158,7 @@ void RageDisplay::DrawPolyLine(const RageVertex &p1, const RageVertex &p2, float
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RageDisplay::DrawLineStrip( const RageVertex v[], int iNumVerts, float LineWidth )
|
void RageDisplay::DrawLineStrip( const RageSpriteVertex v[], int iNumVerts, float LineWidth )
|
||||||
{
|
{
|
||||||
ASSERT( iNumVerts >= 2 );
|
ASSERT( iNumVerts >= 2 );
|
||||||
|
|
||||||
@@ -174,10 +174,10 @@ void RageDisplay::DrawLineStrip( const RageVertex v[], int iNumVerts, float Line
|
|||||||
DrawCircle( v[i], LineWidth/2 );
|
DrawCircle( v[i], LineWidth/2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay::DrawCircle( const RageVertex &p, float radius )
|
void RageDisplay::DrawCircle( const RageSpriteVertex &p, float radius )
|
||||||
{
|
{
|
||||||
const int subdivisions = 32;
|
const int subdivisions = 32;
|
||||||
RageVertex v[subdivisions+2];
|
RageSpriteVertex v[subdivisions+2];
|
||||||
v[0] = p;
|
v[0] = p;
|
||||||
|
|
||||||
for(int i = 0; i < subdivisions+1; ++i)
|
for(int i = 0; i < subdivisions+1; ++i)
|
||||||
|
|||||||
+10
-10
@@ -30,7 +30,7 @@ struct SDL_Surface;
|
|||||||
RageVector3& Normal( int index );
|
RageVector3& Normal( int index );
|
||||||
RageVector3& Position( int index );
|
RageVector3& Position( int index );
|
||||||
// convenience. Remove this later!
|
// convenience. Remove this later!
|
||||||
void Set( int index, const RageVertex& v );
|
void Set( int index, const RageSpriteVertex& v );
|
||||||
|
|
||||||
struct Impl;
|
struct Impl;
|
||||||
Impl* pImpl;
|
Impl* pImpl;
|
||||||
@@ -170,15 +170,15 @@ public:
|
|||||||
RageVector3 dir ) = 0;
|
RageVector3 dir ) = 0;
|
||||||
|
|
||||||
|
|
||||||
void DrawQuad( const RageVertex v[] ) { DrawQuads(v,4); } /* alias. upper-left, upper-right, lower-left, lower-right */
|
void DrawQuad( const RageSpriteVertex v[] ) { DrawQuads(v,4); } /* alias. upper-left, upper-right, lower-left, lower-right */
|
||||||
virtual void DrawQuads( const RageVertex v[], int iNumVerts ) = 0;
|
virtual void DrawQuads( const RageSpriteVertex v[], int iNumVerts ) = 0;
|
||||||
virtual void DrawFan( const RageVertex v[], int iNumVerts ) = 0;
|
virtual void DrawFan( const RageSpriteVertex v[], int iNumVerts ) = 0;
|
||||||
virtual void DrawStrip( const RageVertex v[], int iNumVerts ) = 0;
|
virtual void DrawStrip( const RageSpriteVertex v[], int iNumVerts ) = 0;
|
||||||
virtual void DrawTriangles( const RageVertex v[], int iNumVerts ) = 0;
|
virtual void DrawTriangles( const RageSpriteVertex v[], int iNumVerts ) = 0;
|
||||||
virtual void DrawIndexedTriangles( const RageVertex v[], int iNumVerts, const Uint16* pIndices, int iNumIndices ) = 0;
|
virtual void DrawIndexedTriangles( const RageModelVertex v[], int iNumVerts, const Uint16* pIndices, int iNumIndices ) = 0;
|
||||||
virtual void DrawLineStrip( const RageVertex v[], int iNumVerts, float LineWidth );
|
virtual void DrawLineStrip( const RageSpriteVertex v[], int iNumVerts, float LineWidth );
|
||||||
|
|
||||||
void DrawCircle( const RageVertex &v, float radius );
|
void DrawCircle( const RageSpriteVertex &v, float radius );
|
||||||
|
|
||||||
virtual void SaveScreenshot( CString sPath ) = 0;
|
virtual void SaveScreenshot( CString sPath ) = 0;
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ protected:
|
|||||||
|
|
||||||
virtual void SetViewport(int shift_left, int shift_down) = 0;
|
virtual void SetViewport(int shift_left, int shift_down) = 0;
|
||||||
|
|
||||||
void DrawPolyLine(const RageVertex &p1, const RageVertex &p2, float LineWidth );
|
void DrawPolyLine(const RageSpriteVertex &p1, const RageSpriteVertex &p2, float LineWidth );
|
||||||
|
|
||||||
// Stuff in RageDisplay.cpp
|
// Stuff in RageDisplay.cpp
|
||||||
void SetDefaultRenderStates();
|
void SetDefaultRenderStates();
|
||||||
|
|||||||
@@ -127,7 +127,8 @@ static void SetPalette( unsigned TexResource )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define D3DFVF_RAGEVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX1) // D3D FVF flags which describe our vertex structure
|
#define D3DFVF_RageSpriteVertex (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX1)
|
||||||
|
#define D3DFVF_RageModelVertex (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)
|
||||||
|
|
||||||
|
|
||||||
static const PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PIX_FORMATS] = {
|
static const PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PIX_FORMATS] = {
|
||||||
@@ -601,7 +602,7 @@ RageDisplay::VideoModeParams RageDisplay_D3D::GetVideoModeParams() const { retur
|
|||||||
g_pd3dDevice->SetTransform( D3DTS_WORLD, (D3DMATRIX*)&m );
|
g_pd3dDevice->SetTransform( D3DTS_WORLD, (D3DMATRIX*)&m );
|
||||||
|
|
||||||
|
|
||||||
void RageDisplay_D3D::DrawQuads( const RageVertex v[], int iNumVerts )
|
void RageDisplay_D3D::DrawQuads( const RageSpriteVertex v[], int iNumVerts )
|
||||||
{
|
{
|
||||||
ASSERT( (iNumVerts%4) == 0 );
|
ASSERT( (iNumVerts%4) == 0 );
|
||||||
|
|
||||||
@@ -628,7 +629,7 @@ void RageDisplay_D3D::DrawQuads( const RageVertex v[], int iNumVerts )
|
|||||||
vIndices[i*6+5] = i*4+0;
|
vIndices[i*6+5] = i*4+0;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX );
|
g_pd3dDevice->SetVertexShader( D3DFVF_RageSpriteVertex );
|
||||||
SEND_CURRENT_MATRICES;
|
SEND_CURRENT_MATRICES;
|
||||||
g_pd3dDevice->DrawIndexedPrimitiveUP(
|
g_pd3dDevice->DrawIndexedPrimitiveUP(
|
||||||
D3DPT_TRIANGLELIST, // PrimitiveType
|
D3DPT_TRIANGLELIST, // PrimitiveType
|
||||||
@@ -638,60 +639,60 @@ void RageDisplay_D3D::DrawQuads( const RageVertex v[], int iNumVerts )
|
|||||||
&vIndices[0], // pIndexData,
|
&vIndices[0], // pIndexData,
|
||||||
D3DFMT_INDEX16, // IndexDataFormat,
|
D3DFMT_INDEX16, // IndexDataFormat,
|
||||||
v, // pVertexStreamZeroData,
|
v, // pVertexStreamZeroData,
|
||||||
sizeof(RageVertex) // VertexStreamZeroStride
|
sizeof(RageSpriteVertex) // VertexStreamZeroStride
|
||||||
);
|
);
|
||||||
|
|
||||||
StatsAddVerts( iNumVerts );
|
StatsAddVerts( iNumVerts );
|
||||||
}
|
}
|
||||||
void RageDisplay_D3D::DrawFan( const RageVertex v[], int iNumVerts )
|
void RageDisplay_D3D::DrawFan( const RageSpriteVertex v[], int iNumVerts )
|
||||||
{
|
{
|
||||||
ASSERT( iNumVerts >= 3 );
|
ASSERT( iNumVerts >= 3 );
|
||||||
g_pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX );
|
g_pd3dDevice->SetVertexShader( D3DFVF_RageSpriteVertex );
|
||||||
SEND_CURRENT_MATRICES;
|
SEND_CURRENT_MATRICES;
|
||||||
g_pd3dDevice->DrawPrimitiveUP(
|
g_pd3dDevice->DrawPrimitiveUP(
|
||||||
D3DPT_TRIANGLEFAN, // PrimitiveType
|
D3DPT_TRIANGLEFAN, // PrimitiveType
|
||||||
iNumVerts-2, // PrimitiveCount,
|
iNumVerts-2, // PrimitiveCount,
|
||||||
v, // pVertexStreamZeroData,
|
v, // pVertexStreamZeroData,
|
||||||
sizeof(RageVertex)
|
sizeof(RageSpriteVertex)
|
||||||
);
|
);
|
||||||
StatsAddVerts( iNumVerts );
|
StatsAddVerts( iNumVerts );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_D3D::DrawStrip( const RageVertex v[], int iNumVerts )
|
void RageDisplay_D3D::DrawStrip( const RageSpriteVertex v[], int iNumVerts )
|
||||||
{
|
{
|
||||||
ASSERT( iNumVerts >= 3 );
|
ASSERT( iNumVerts >= 3 );
|
||||||
g_pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX );
|
g_pd3dDevice->SetVertexShader( D3DFVF_RageSpriteVertex );
|
||||||
SEND_CURRENT_MATRICES;
|
SEND_CURRENT_MATRICES;
|
||||||
g_pd3dDevice->DrawPrimitiveUP(
|
g_pd3dDevice->DrawPrimitiveUP(
|
||||||
D3DPT_TRIANGLESTRIP, // PrimitiveType
|
D3DPT_TRIANGLESTRIP, // PrimitiveType
|
||||||
iNumVerts-2, // PrimitiveCount,
|
iNumVerts-2, // PrimitiveCount,
|
||||||
v, // pVertexStreamZeroData,
|
v, // pVertexStreamZeroData,
|
||||||
sizeof(RageVertex)
|
sizeof(RageSpriteVertex)
|
||||||
);
|
);
|
||||||
StatsAddVerts( iNumVerts );
|
StatsAddVerts( iNumVerts );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_D3D::DrawTriangles( const RageVertex v[], int iNumVerts )
|
void RageDisplay_D3D::DrawTriangles( const RageSpriteVertex v[], int iNumVerts )
|
||||||
{
|
{
|
||||||
if( iNumVerts == 0 )
|
if( iNumVerts == 0 )
|
||||||
return;
|
return;
|
||||||
ASSERT( iNumVerts >= 3 );
|
ASSERT( iNumVerts >= 3 );
|
||||||
g_pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX );
|
g_pd3dDevice->SetVertexShader( D3DFVF_RageSpriteVertex );
|
||||||
SEND_CURRENT_MATRICES;
|
SEND_CURRENT_MATRICES;
|
||||||
g_pd3dDevice->DrawPrimitiveUP(
|
g_pd3dDevice->DrawPrimitiveUP(
|
||||||
D3DPT_TRIANGLELIST, // PrimitiveType
|
D3DPT_TRIANGLELIST, // PrimitiveType
|
||||||
iNumVerts/3, // PrimitiveCount,
|
iNumVerts/3, // PrimitiveCount,
|
||||||
v, // pVertexStreamZeroData,
|
v, // pVertexStreamZeroData,
|
||||||
sizeof(RageVertex)
|
sizeof(RageSpriteVertex)
|
||||||
);
|
);
|
||||||
StatsAddVerts( iNumVerts );
|
StatsAddVerts( iNumVerts );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_D3D::DrawIndexedTriangles( const RageVertex v[], int iNumVerts, const Uint16 pIndices[], int iNumIndices )
|
void RageDisplay_D3D::DrawIndexedTriangles( const RageModelVertex v[], int iNumVerts, const Uint16 pIndices[], int iNumIndices )
|
||||||
{
|
{
|
||||||
if( iNumIndices == 0 )
|
if( iNumIndices == 0 )
|
||||||
return;
|
return;
|
||||||
g_pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX );
|
g_pd3dDevice->SetVertexShader( D3DFVF_RageModelVertex );
|
||||||
SEND_CURRENT_MATRICES;
|
SEND_CURRENT_MATRICES;
|
||||||
g_pd3dDevice->DrawIndexedPrimitiveUP(
|
g_pd3dDevice->DrawIndexedPrimitiveUP(
|
||||||
D3DPT_TRIANGLELIST, // PrimitiveType
|
D3DPT_TRIANGLELIST, // PrimitiveType
|
||||||
@@ -701,7 +702,7 @@ void RageDisplay_D3D::DrawIndexedTriangles( const RageVertex v[], int iNumVerts,
|
|||||||
pIndices, // pIndexData,
|
pIndices, // pIndexData,
|
||||||
D3DFMT_INDEX16, // IndexDataFormat,
|
D3DFMT_INDEX16, // IndexDataFormat,
|
||||||
v, // pVertexStreamZeroData,
|
v, // pVertexStreamZeroData,
|
||||||
sizeof(RageVertex) // VertexStreamZeroStride
|
sizeof(RageModelVertex) // VertexStreamZeroStride
|
||||||
);
|
);
|
||||||
StatsAddVerts( iNumIndices );
|
StatsAddVerts( iNumIndices );
|
||||||
}
|
}
|
||||||
@@ -709,17 +710,17 @@ void RageDisplay_D3D::DrawIndexedTriangles( const RageVertex v[], int iNumVerts,
|
|||||||
/* Use the default poly-based implementation. D3D lines apparently don't support
|
/* Use the default poly-based implementation. D3D lines apparently don't support
|
||||||
* AA with greater-than-one widths. */
|
* AA with greater-than-one widths. */
|
||||||
/*
|
/*
|
||||||
void RageDisplay_D3D::DrawLineStrip( const RageVertex v[], int iNumVerts, float LineWidth )
|
void RageDisplay_D3D::DrawLineStrip( const RageSpriteVertex v[], int iNumVerts, float LineWidth )
|
||||||
{
|
{
|
||||||
ASSERT( iNumVerts >= 2 );
|
ASSERT( iNumVerts >= 2 );
|
||||||
g_pd3dDevice->SetRenderState( D3DRS_POINTSIZE, *((DWORD*)&LineWidth) ); // funky cast. See D3DRENDERSTATETYPE doc
|
g_pd3dDevice->SetRenderState( D3DRS_POINTSIZE, *((DWORD*)&LineWidth) ); // funky cast. See D3DRENDERSTATETYPE doc
|
||||||
g_pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX );
|
g_pd3dDevice->SetVertexShader( D3DFVF_RageSpriteVertex );
|
||||||
SEND_CURRENT_MATRICES;
|
SEND_CURRENT_MATRICES;
|
||||||
g_pd3dDevice->DrawPrimitiveUP(
|
g_pd3dDevice->DrawPrimitiveUP(
|
||||||
D3DPT_LINESTRIP, // PrimitiveType
|
D3DPT_LINESTRIP, // PrimitiveType
|
||||||
iNumVerts-1, // PrimitiveCount,
|
iNumVerts-1, // PrimitiveCount,
|
||||||
v, // pVertexStreamZeroData,
|
v, // pVertexStreamZeroData,
|
||||||
sizeof(RageVertex)
|
sizeof(RageSpriteVertex)
|
||||||
);
|
);
|
||||||
StatsAddVerts( iNumVerts );
|
StatsAddVerts( iNumVerts );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,12 +55,12 @@ public:
|
|||||||
RageColor specular,
|
RageColor specular,
|
||||||
RageVector3 dir );
|
RageVector3 dir );
|
||||||
|
|
||||||
void DrawQuads( const RageVertex v[], int iNumVerts );
|
void DrawQuads( const RageSpriteVertex v[], int iNumVerts );
|
||||||
void DrawFan( const RageVertex v[], int iNumVerts );
|
void DrawFan( const RageSpriteVertex v[], int iNumVerts );
|
||||||
void DrawStrip( const RageVertex v[], int iNumVerts );
|
void DrawStrip( const RageSpriteVertex v[], int iNumVerts );
|
||||||
void DrawTriangles( const RageVertex v[], int iNumVerts );
|
void DrawTriangles( const RageSpriteVertex v[], int iNumVerts );
|
||||||
void DrawIndexedTriangles( const RageVertex v[], int iNumVerts, const Uint16* pIndices, int iNumIndices );
|
void DrawIndexedTriangles( const RageModelVertex v[], int iNumVerts, const Uint16* pIndices, int iNumIndices );
|
||||||
// void DrawLineStrip( const RageVertex v[], int iNumVerts, float LineWidth );
|
// void DrawLineStrip( const RageSpriteVertex v[], int iNumVerts, float LineWidth );
|
||||||
|
|
||||||
void SaveScreenshot( CString sPath );
|
void SaveScreenshot( CString sPath );
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ set<string> g_glExts;
|
|||||||
|
|
||||||
/* We don't actually use normals (we don't tunr on lighting), there's just
|
/* We don't actually use normals (we don't tunr on lighting), there's just
|
||||||
* no GL_T2F_C4F_V3F. */
|
* no GL_T2F_C4F_V3F. */
|
||||||
const GLenum RageVertexFormat = GL_T2F_C4F_N3F_V3F;
|
const GLenum RageSpriteVertexFormat = GL_T2F_C4F_N3F_V3F;
|
||||||
|
|
||||||
|
|
||||||
LowLevelWindow *wind;
|
LowLevelWindow *wind;
|
||||||
@@ -605,7 +605,7 @@ void RageDisplay_OGL::SaveScreenshot( CString sPath )
|
|||||||
|
|
||||||
RageDisplay::VideoModeParams RageDisplay_OGL::GetVideoModeParams() const { return wind->GetVideoModeParams(); }
|
RageDisplay::VideoModeParams RageDisplay_OGL::GetVideoModeParams() const { return wind->GetVideoModeParams(); }
|
||||||
|
|
||||||
static void SetupVertices( const RageVertex v[], int iNumVerts )
|
static void SetupVertices( const RageSpriteVertex v[], int iNumVerts )
|
||||||
{
|
{
|
||||||
static float *Vertex, *Texture, *Normal;
|
static float *Vertex, *Texture, *Normal;
|
||||||
static GLubyte *Color;
|
static GLubyte *Color;
|
||||||
@@ -651,7 +651,45 @@ static void SetupVertices( const RageVertex v[], int iNumVerts )
|
|||||||
glNormalPointer(GL_FLOAT, 0, Normal);
|
glNormalPointer(GL_FLOAT, 0, Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_OGL::DrawQuads( const RageVertex v[], int iNumVerts )
|
static void SetupVertices( const RageModelVertex v[], int iNumVerts )
|
||||||
|
{
|
||||||
|
static float *Vertex, *Texture, *Normal;
|
||||||
|
static int Size = 0;
|
||||||
|
if(iNumVerts > Size)
|
||||||
|
{
|
||||||
|
Size = iNumVerts;
|
||||||
|
delete [] Vertex;
|
||||||
|
delete [] Texture;
|
||||||
|
delete [] Normal;
|
||||||
|
Vertex = new float[Size*3];
|
||||||
|
Texture = new float[Size*2];
|
||||||
|
Normal = new float[Size*3];
|
||||||
|
}
|
||||||
|
|
||||||
|
for(unsigned i = 0; i < unsigned(iNumVerts); ++i)
|
||||||
|
{
|
||||||
|
Vertex[i*3+0] = v[i].p[0];
|
||||||
|
Vertex[i*3+1] = v[i].p[1];
|
||||||
|
Vertex[i*3+2] = v[i].p[2];
|
||||||
|
Texture[i*2+0] = v[i].t[0];
|
||||||
|
Texture[i*2+1] = v[i].t[1];
|
||||||
|
Normal[i*3+0] = v[i].n[0];
|
||||||
|
Normal[i*3+1] = v[i].n[1];
|
||||||
|
Normal[i*3+2] = v[i].n[2];
|
||||||
|
}
|
||||||
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glVertexPointer(3, GL_FLOAT, 0, Vertex);
|
||||||
|
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
|
||||||
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glTexCoordPointer(2, GL_FLOAT, 0, Texture);
|
||||||
|
|
||||||
|
glEnableClientState(GL_NORMAL_ARRAY);
|
||||||
|
glNormalPointer(GL_FLOAT, 0, Normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RageDisplay_OGL::DrawQuads( const RageSpriteVertex v[], int iNumVerts )
|
||||||
{
|
{
|
||||||
ASSERT( (iNumVerts%4) == 0 );
|
ASSERT( (iNumVerts%4) == 0 );
|
||||||
|
|
||||||
@@ -669,7 +707,7 @@ void RageDisplay_OGL::DrawQuads( const RageVertex v[], int iNumVerts )
|
|||||||
StatsAddVerts( iNumVerts );
|
StatsAddVerts( iNumVerts );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_OGL::DrawFan( const RageVertex v[], int iNumVerts )
|
void RageDisplay_OGL::DrawFan( const RageSpriteVertex v[], int iNumVerts )
|
||||||
{
|
{
|
||||||
ASSERT( iNumVerts >= 3 );
|
ASSERT( iNumVerts >= 3 );
|
||||||
glMatrixMode( GL_PROJECTION );
|
glMatrixMode( GL_PROJECTION );
|
||||||
@@ -681,7 +719,7 @@ void RageDisplay_OGL::DrawFan( const RageVertex v[], int iNumVerts )
|
|||||||
StatsAddVerts( iNumVerts );
|
StatsAddVerts( iNumVerts );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_OGL::DrawStrip( const RageVertex v[], int iNumVerts )
|
void RageDisplay_OGL::DrawStrip( const RageSpriteVertex v[], int iNumVerts )
|
||||||
{
|
{
|
||||||
ASSERT( iNumVerts >= 3 );
|
ASSERT( iNumVerts >= 3 );
|
||||||
glMatrixMode( GL_PROJECTION );
|
glMatrixMode( GL_PROJECTION );
|
||||||
@@ -693,7 +731,7 @@ void RageDisplay_OGL::DrawStrip( const RageVertex v[], int iNumVerts )
|
|||||||
StatsAddVerts( iNumVerts );
|
StatsAddVerts( iNumVerts );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_OGL::DrawTriangles( const RageVertex v[], int iNumVerts )
|
void RageDisplay_OGL::DrawTriangles( const RageSpriteVertex v[], int iNumVerts )
|
||||||
{
|
{
|
||||||
if( iNumVerts == 0 )
|
if( iNumVerts == 0 )
|
||||||
return;
|
return;
|
||||||
@@ -707,7 +745,7 @@ void RageDisplay_OGL::DrawTriangles( const RageVertex v[], int iNumVerts )
|
|||||||
StatsAddVerts( iNumVerts );
|
StatsAddVerts( iNumVerts );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_OGL::DrawIndexedTriangles( const RageVertex v[], int iNumVerts, const Uint16 pIndices[], int iNumIndices )
|
void RageDisplay_OGL::DrawIndexedTriangles( const RageModelVertex v[], int iNumVerts, const Uint16 pIndices[], int iNumIndices )
|
||||||
{
|
{
|
||||||
if( iNumIndices == 0 )
|
if( iNumIndices == 0 )
|
||||||
return;
|
return;
|
||||||
@@ -718,12 +756,12 @@ void RageDisplay_OGL::DrawIndexedTriangles( const RageVertex v[], int iNumVerts,
|
|||||||
glLoadMatrixf( (const float*)GetModelViewTop() );
|
glLoadMatrixf( (const float*)GetModelViewTop() );
|
||||||
|
|
||||||
SetupVertices( v, iNumVerts );
|
SetupVertices( v, iNumVerts );
|
||||||
// glInterleavedArrays( RageVertexFormat, sizeof(RageVertex), v );
|
// glInterleavedArrays( RageSpriteVertexFormat, sizeof(RageSpriteVertex), v );
|
||||||
glDrawElements( GL_TRIANGLES, iNumIndices, GL_UNSIGNED_SHORT, pIndices );
|
glDrawElements( GL_TRIANGLES, iNumIndices, GL_UNSIGNED_SHORT, pIndices );
|
||||||
StatsAddVerts( iNumIndices );
|
StatsAddVerts( iNumIndices );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_OGL::DrawLineStrip( const RageVertex v[], int iNumVerts, float LineWidth )
|
void RageDisplay_OGL::DrawLineStrip( const RageSpriteVertex v[], int iNumVerts, float LineWidth )
|
||||||
{
|
{
|
||||||
ASSERT( iNumVerts >= 2 );
|
ASSERT( iNumVerts >= 2 );
|
||||||
|
|
||||||
@@ -794,10 +832,16 @@ void RageDisplay_OGL::DrawLineStrip( const RageVertex v[], int iNumVerts, float
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_OGL::SetTexture( RageTexture* pTexture )
|
void RageDisplay_OGL::SetTexture( RageTexture* pTexture )
|
||||||
|
{
|
||||||
|
if( pTexture )
|
||||||
{
|
{
|
||||||
glEnable( GL_TEXTURE_2D );
|
glEnable( GL_TEXTURE_2D );
|
||||||
unsigned id = pTexture ? pTexture->GetTexHandle() : 0;
|
glBindTexture( GL_TEXTURE_2D, pTexture->GetTexHandle() );
|
||||||
glBindTexture( GL_TEXTURE_2D, id );
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glDisable( GL_TEXTURE_2D );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void RageDisplay_OGL::SetTextureModeModulate()
|
void RageDisplay_OGL::SetTextureModeModulate()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,12 +51,12 @@ public:
|
|||||||
RageColor specular,
|
RageColor specular,
|
||||||
RageVector3 dir );
|
RageVector3 dir );
|
||||||
|
|
||||||
void DrawQuads( const RageVertex v[], int iNumVerts );
|
void DrawQuads( const RageSpriteVertex v[], int iNumVerts );
|
||||||
void DrawFan( const RageVertex v[], int iNumVerts );
|
void DrawFan( const RageSpriteVertex v[], int iNumVerts );
|
||||||
void DrawStrip( const RageVertex v[], int iNumVerts );
|
void DrawStrip( const RageSpriteVertex v[], int iNumVerts );
|
||||||
void DrawTriangles( const RageVertex v[], int iNumVerts );
|
void DrawTriangles( const RageSpriteVertex v[], int iNumVerts );
|
||||||
void DrawIndexedTriangles( const RageVertex v[], int iNumVerts, const Uint16* pIndices, int iNumIndices );
|
void DrawIndexedTriangles( const RageModelVertex v[], int iNumVerts, const Uint16* pIndices, int iNumIndices );
|
||||||
void DrawLineStrip( const RageVertex v[], int iNumVerts, float LineWidth );
|
void DrawLineStrip( const RageSpriteVertex v[], int iNumVerts, float LineWidth );
|
||||||
|
|
||||||
CString GetTextureDiagnostics( unsigned id ) const;
|
CString GetTextureDiagnostics( unsigned id ) const;
|
||||||
|
|
||||||
|
|||||||
@@ -182,6 +182,8 @@ bool RageSound::Load(CString sSoundFilePath, int precache)
|
|||||||
// Check for "loop" hint
|
// Check for "loop" hint
|
||||||
if( m_sFilePath.Find("loop") != -1 )
|
if( m_sFilePath.Find("loop") != -1 )
|
||||||
SetStopMode( M_LOOP );
|
SetStopMode( M_LOOP );
|
||||||
|
else
|
||||||
|
SetStopMode( M_STOP );
|
||||||
|
|
||||||
|
|
||||||
SoundReader_FileReader *NewSample = new RageSoundReader_LowLevel;
|
SoundReader_FileReader *NewSample = new RageSoundReader_LowLevel;
|
||||||
|
|||||||
@@ -185,11 +185,12 @@ public:
|
|||||||
typedef Rect<int> RectI;
|
typedef Rect<int> RectI;
|
||||||
typedef Rect<float> RectF;
|
typedef Rect<float> RectF;
|
||||||
|
|
||||||
// A structure for our custom vertex type. Note that these data structes have the same layout that D3D expects.
|
/* Structure for our custom vertex type. Note that these data structes
|
||||||
struct RageVertex
|
* have the same layout that D3D expects. */
|
||||||
|
struct RageSpriteVertex // has color
|
||||||
{
|
{
|
||||||
/* Zero out by default. */
|
/* Zero out by default. */
|
||||||
RageVertex():
|
RageSpriteVertex():
|
||||||
p(0,0,0),
|
p(0,0,0),
|
||||||
n(0,0,0),
|
n(0,0,0),
|
||||||
t(0,0)
|
t(0,0)
|
||||||
@@ -200,6 +201,19 @@ struct RageVertex
|
|||||||
RageVector2 t; // texture coordinates
|
RageVector2 t; // texture coordinates
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct RageModelVertex // doesn't have color. Relies on material color
|
||||||
|
{
|
||||||
|
/* Zero out by default. */
|
||||||
|
RageModelVertex():
|
||||||
|
p(0,0,0),
|
||||||
|
n(0,0,0),
|
||||||
|
t(0,0)
|
||||||
|
{ }
|
||||||
|
RageVector3 p; // position
|
||||||
|
RageVector3 n; // normal
|
||||||
|
RageVector2 t; // texture coordinates
|
||||||
|
};
|
||||||
|
|
||||||
/* nonstandard extension used : nameless struct/union
|
/* nonstandard extension used : nameless struct/union
|
||||||
* It is, in fact, nonstandard. G++ 3.x can handle it. 2.95.x can not. XXX */
|
* It is, in fact, nonstandard. G++ 3.x can handle it. 2.95.x can not. XXX */
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
|||||||
@@ -24,33 +24,32 @@
|
|||||||
|
|
||||||
ScreenSandbox::ScreenSandbox() : Screen("ScreenSandbox")
|
ScreenSandbox::ScreenSandbox() : Screen("ScreenSandbox")
|
||||||
{
|
{
|
||||||
m_quad1.StretchTo( RectI(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) );
|
// m_quad1.StretchTo( RectI(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) );
|
||||||
m_quad1.SetDiffuse( RageColor(0,0,1,1) );
|
// m_quad1.SetDiffuse( RageColor(0,0,1,1) );
|
||||||
m_quad1.SetZ( 0 );
|
// m_quad1.SetZ( 0 );
|
||||||
m_quad1.SetUseZBuffer( true );
|
// m_quad1.SetUseZBuffer( true );
|
||||||
this->AddChild( &m_quad1 );
|
// this->AddChild( &m_quad1 );
|
||||||
|
|
||||||
m_quad2.StretchTo( RectI(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) );
|
// m_quad2.StretchTo( RectI(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) );
|
||||||
m_quad2.SetDiffuse( RageColor(0,1,0,1) );
|
// m_quad2.SetDiffuse( RageColor(0,1,0,1) );
|
||||||
m_quad2.SetZ( -1 );
|
// m_quad2.SetZ( -1 );
|
||||||
m_quad2.SetUseZBuffer( true );
|
// m_quad2.SetUseZBuffer( true );
|
||||||
this->AddChild( &m_quad2 );
|
// this->AddChild( &m_quad2 );
|
||||||
|
|
||||||
// m_sprite.Load( "C:\\stepmania\\stepmania\\RandomMovies\\cm301[1].avi" );
|
// m_sprite.Load( "C:\\stepmania\\stepmania\\RandomMovies\\cm301[1].avi" );
|
||||||
// m_sprite.SetXY( CENTER_X, CENTER_Y );
|
// m_sprite.SetXY( CENTER_X, CENTER_Y );
|
||||||
// this->AddChild( &m_sprite );
|
// this->AddChild( &m_sprite );
|
||||||
|
|
||||||
// m_model.SetXY(CENTER_X, CENTER_Y);
|
m_model.LoadMilkshapeAscii( "C:\\stepmania\\stepmania\\Themes\\groove\\BGAnimations\\ScreenCaution background\\2 platforms and backbar.txt" );
|
||||||
// m_model.SetZoom(3);
|
m_model.SetXY(CENTER_X, CENTER_Y);
|
||||||
// //m_model.SetZoomY(-1);
|
m_model.SetZoom(15);
|
||||||
// m_model.LoadMilkshapeAscii( "Down Tap Note 4th.txt" );
|
this->AddChild(&m_model);
|
||||||
// m_model.LoadMilkshapeAsciiBones( "D:\\Dev\\ddrpc char hacking\\DDRPCRip\\models\\howtoplay.bones.txt" );
|
m_model.AddRotationH( 90 );
|
||||||
// this->AddChild(&m_model);
|
|
||||||
// m_model.SetEffectSpin( RageVector3(0,90,90) );
|
// m_model.SetEffectSpin( RageVector3(0,90,90) );
|
||||||
|
|
||||||
this->AddChild( &m_In );
|
// this->AddChild( &m_In );
|
||||||
|
|
||||||
this->AddChild( &m_Out );
|
// this->AddChild( &m_Out );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSandbox::HandleScreenMessage( const ScreenMessage SM )
|
void ScreenSandbox::HandleScreenMessage( const ScreenMessage SM )
|
||||||
@@ -69,28 +68,28 @@ void ScreenSandbox::Update( float fDeltaTime )
|
|||||||
|
|
||||||
void ScreenSandbox::DrawPrimitives()
|
void ScreenSandbox::DrawPrimitives()
|
||||||
{
|
{
|
||||||
// DISPLAY->SetLighting( true );
|
DISPLAY->SetLighting( true );
|
||||||
// DISPLAY->SetLightDirectional(
|
DISPLAY->SetLightDirectional(
|
||||||
// 0,
|
0,
|
||||||
// RageColor(0,0,0,0),
|
RageColor(0.5,0.5,0.5,1),
|
||||||
// RageColor(1,1,1,1),
|
RageColor(1,1,1,1),
|
||||||
// RageColor(0,0,0,1),
|
RageColor(0,0,0,1),
|
||||||
// RageVector3(0, -1, 0) );
|
RageVector3(0, 0, 1) );
|
||||||
|
|
||||||
Screen::DrawPrimitives();
|
Screen::DrawPrimitives();
|
||||||
|
|
||||||
// DISPLAY->SetLightOff( 0 );
|
DISPLAY->SetLightOff( 0 );
|
||||||
// DISPLAY->SetLighting( false );
|
DISPLAY->SetLighting( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSandbox::MenuLeft( PlayerNumber pn )
|
void ScreenSandbox::MenuLeft( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
m_In.Load( THEME->GetPathToB("_menu in") );
|
// m_In.Load( THEME->GetPathToB("_menu in") );
|
||||||
m_In.StartTransitioning();
|
// m_In.StartTransitioning();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSandbox::MenuRight( PlayerNumber pn )
|
void ScreenSandbox::MenuRight( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
m_Out.Load( THEME->GetPathToB("_menu out") );
|
// m_Out.Load( THEME->GetPathToB("_menu out") );
|
||||||
m_Out.StartTransitioning();
|
// m_Out.StartTransitioning();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ public:
|
|||||||
void MenuLeft( PlayerNumber pn );
|
void MenuLeft( PlayerNumber pn );
|
||||||
void MenuRight( PlayerNumber pn );
|
void MenuRight( PlayerNumber pn );
|
||||||
|
|
||||||
/// Model m_model;
|
Model m_model;
|
||||||
Quad m_quad1;
|
// Quad m_quad1;
|
||||||
Quad m_quad2;
|
// Quad m_quad2;
|
||||||
Transition m_In;
|
// Transition m_In;
|
||||||
Transition m_Out;
|
// Transition m_Out;
|
||||||
Sprite m_text;
|
// Sprite m_text;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -131,6 +131,9 @@ ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu")
|
|||||||
m_Out.Load( THEME->GetPathToB("ScreenTitleMenu out") );
|
m_Out.Load( THEME->GetPathToB("ScreenTitleMenu out") );
|
||||||
this->AddChild( &m_Out );
|
this->AddChild( &m_Out );
|
||||||
|
|
||||||
|
m_BeginOut.Load( THEME->GetPathToB("ScreenTitleMenu begin out") );
|
||||||
|
this->AddChild( &m_BeginOut );
|
||||||
|
|
||||||
|
|
||||||
SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("title menu game name") );
|
SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("title menu game name") );
|
||||||
|
|
||||||
@@ -152,6 +155,7 @@ ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu")
|
|||||||
|
|
||||||
this->MoveToTail( &m_In ); // put it in the back so it covers up the stuff we just added
|
this->MoveToTail( &m_In ); // put it in the back so it covers up the stuff we just added
|
||||||
this->MoveToTail( &m_Out ); // put it in the back so it covers up the stuff we just added
|
this->MoveToTail( &m_Out ); // put it in the back so it covers up the stuff we just added
|
||||||
|
this->MoveToTail( &m_BeginOut ); // put it in the back so it covers up the stuff we just added
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenTitleMenu::~ScreenTitleMenu()
|
ScreenTitleMenu::~ScreenTitleMenu()
|
||||||
@@ -182,7 +186,7 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
case MENU_BUTTON_UP:
|
case MENU_BUTTON_UP:
|
||||||
if( PREFSMAN->m_iCoinMode != COIN_HOME )
|
if( PREFSMAN->m_iCoinMode != COIN_HOME )
|
||||||
break;
|
break;
|
||||||
if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
|
if( m_In.IsTransitioning() || m_Out.IsTransitioning() || m_BeginOut.IsTransitioning() )
|
||||||
break;
|
break;
|
||||||
TimeToDemonstration.GetDeltaTime(); /* Reset the demonstration timer when a key is pressed. */
|
TimeToDemonstration.GetDeltaTime(); /* Reset the demonstration timer when a key is pressed. */
|
||||||
LoseFocus( m_Choice );
|
LoseFocus( m_Choice );
|
||||||
@@ -195,7 +199,7 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
case MENU_BUTTON_DOWN:
|
case MENU_BUTTON_DOWN:
|
||||||
if( PREFSMAN->m_iCoinMode != COIN_HOME )
|
if( PREFSMAN->m_iCoinMode != COIN_HOME )
|
||||||
break;
|
break;
|
||||||
if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
|
if( m_In.IsTransitioning() || m_Out.IsTransitioning() || m_BeginOut.IsTransitioning() )
|
||||||
break;
|
break;
|
||||||
TimeToDemonstration.GetDeltaTime(); /* Reset the demonstration timer when a key is pressed. */
|
TimeToDemonstration.GetDeltaTime(); /* Reset the demonstration timer when a key is pressed. */
|
||||||
LoseFocus( m_Choice );
|
LoseFocus( m_Choice );
|
||||||
@@ -206,7 +210,7 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
GainFocus( m_Choice );
|
GainFocus( m_Choice );
|
||||||
break;
|
break;
|
||||||
case MENU_BUTTON_BACK:
|
case MENU_BUTTON_BACK:
|
||||||
if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
|
if( m_In.IsTransitioning() || m_Out.IsTransitioning() || m_BeginOut.IsTransitioning() )
|
||||||
break;
|
break;
|
||||||
m_Out.StartTransitioning( SM_GoToAttractLoop );
|
m_Out.StartTransitioning( SM_GoToAttractLoop );
|
||||||
break;
|
break;
|
||||||
@@ -232,8 +236,8 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( Screen::JoinInput( DeviceI, type, GameI, MenuI, StyleI ) )
|
if( Screen::JoinInput( DeviceI, type, GameI, MenuI, StyleI ) )
|
||||||
if( !m_Out.IsTransitioning() )
|
if( !m_Out.IsTransitioning() && !m_BeginOut.IsTransitioning() )
|
||||||
m_Out.StartTransitioning( SM_GoToNextScreen );
|
m_BeginOut.StartTransitioning( SM_GoToNextScreen );
|
||||||
}
|
}
|
||||||
|
|
||||||
// detect codes
|
// detect codes
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ private:
|
|||||||
|
|
||||||
Transition m_In;
|
Transition m_In;
|
||||||
Transition m_Out;
|
Transition m_Out;
|
||||||
|
Transition m_BeginOut;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "RageDisplay.h"
|
#include "RageDisplay.h"
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
#include "SDL_utils.h"
|
#include "SDL_utils.h"
|
||||||
|
#include "StepMania.h"
|
||||||
|
|
||||||
Sprite::Sprite()
|
Sprite::Sprite()
|
||||||
{
|
{
|
||||||
@@ -252,7 +253,7 @@ void Sprite::Update( float fDelta )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TexCoordsFromArray(RageVertex *v, const float *f)
|
static void TexCoordsFromArray(RageSpriteVertex *v, const float *f)
|
||||||
{
|
{
|
||||||
v[0].t = RageVector2( f[0], f[1] ); // top left
|
v[0].t = RageVector2( f[0], f[1] ); // top left
|
||||||
v[1].t = RageVector2( f[2], f[3] ); // bottom left
|
v[1].t = RageVector2( f[2], f[3] ); // bottom left
|
||||||
@@ -316,7 +317,7 @@ void Sprite::DrawPrimitives()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static RageVertex v[4];
|
static RageSpriteVertex v[4];
|
||||||
v[0].p = RageVector3( croppedQuadVerticies.left, croppedQuadVerticies.top, 0 ); // top left
|
v[0].p = RageVector3( croppedQuadVerticies.left, croppedQuadVerticies.top, 0 ); // top left
|
||||||
v[1].p = RageVector3( croppedQuadVerticies.left, croppedQuadVerticies.bottom, 0 ); // bottom left
|
v[1].p = RageVector3( croppedQuadVerticies.left, croppedQuadVerticies.bottom, 0 ); // bottom left
|
||||||
v[2].p = RageVector3( croppedQuadVerticies.right, croppedQuadVerticies.bottom, 0 ); // bottom right
|
v[2].p = RageVector3( croppedQuadVerticies.right, croppedQuadVerticies.bottom, 0 ); // bottom right
|
||||||
@@ -592,3 +593,44 @@ bool Sprite::IsDiagonalBanner( int iWidth, int iHeight )
|
|||||||
/* A diagonal banner is a square. Give a couple pixels of leeway. */
|
/* A diagonal banner is a square. Give a couple pixels of leeway. */
|
||||||
return iWidth >= 100 && abs(iWidth - iHeight) < 2;
|
return iWidth >= 100 && abs(iWidth - iHeight) < 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline CString GetParam( const CStringArray& sParams, int iIndex, int& iMaxIndexAccessed )
|
||||||
|
{
|
||||||
|
iMaxIndexAccessed = max( iIndex, iMaxIndexAccessed );
|
||||||
|
if( iIndex < int(sParams.size()) )
|
||||||
|
return sParams[iIndex];
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sprite::HandleCommand( const CStringArray &asTokens )
|
||||||
|
{
|
||||||
|
int iMaxIndexAccessed = 0;
|
||||||
|
|
||||||
|
#define sParam(i) (GetParam(asTokens,i,iMaxIndexAccessed))
|
||||||
|
#define fParam(i) ((float)atof(sParam(i)))
|
||||||
|
#define iParam(i) (atoi(sParam(i)))
|
||||||
|
#define bParam(i) (iParam(i)!=0)
|
||||||
|
|
||||||
|
const CString& sName = asTokens[0];
|
||||||
|
|
||||||
|
// Commands that go in the tweening queue:
|
||||||
|
/* Add left/right/top/bottom for alpha if needed. */
|
||||||
|
// Commands that take effect immediately (ignoring the tweening queue):
|
||||||
|
if( sName=="customtexturerect" ) SetCustomTextureRect( RectF(fParam(1),fParam(2),fParam(3),fParam(4)) );
|
||||||
|
else if( sName=="texcoordvelocity" ) SetTexCoordVelocity( fParam(1),fParam(2) );
|
||||||
|
else if( sName=="scaletoclipped" ) ScaleToClipped( fParam(1),fParam(2) );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Actor::HandleCommand( asTokens );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( iMaxIndexAccessed != (int)asTokens.size()-1 )
|
||||||
|
{
|
||||||
|
CString sError = ssprintf( "Actor::HandleCommand: Wrong number of parameters in command '%s'. Expected %d but there are %d.", join(",",asTokens).c_str(), iMaxIndexAccessed+1, (int)asTokens.size() );
|
||||||
|
LOG->Warn( sError );
|
||||||
|
if( DISPLAY->IsWindowed() )
|
||||||
|
HOOKS->MessageBoxOK( sError );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ public:
|
|||||||
void ScaleToClipped( float fWidth, float fHeight );
|
void ScaleToClipped( float fWidth, float fHeight );
|
||||||
static bool IsDiagonalBanner( int iWidth, int iHeight );
|
static bool IsDiagonalBanner( int iWidth, int iHeight );
|
||||||
|
|
||||||
|
virtual void HandleCommand( const CStringArray &asTokens );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool LoadFromTexture( RageTextureID ID );
|
virtual bool LoadFromTexture( RageTextureID ID );
|
||||||
|
|||||||
+28
-15
@@ -1,5 +1,5 @@
|
|||||||
# Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4>
|
# Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4>
|
||||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
# Microsoft Developer Studio Generated Build File, Format Version 60000
|
||||||
# ** DO NOT EDIT **
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||||
@@ -61,7 +61,7 @@ LINK32=link.exe
|
|||||||
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
|
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
IntDir=.\../Debug6
|
IntDir=.\../Debug6
|
||||||
TargetDir=\temp\stepmania
|
TargetDir=\stepmania\stepmania
|
||||||
TargetName=StepMania-debug
|
TargetName=StepMania-debug
|
||||||
SOURCE="$(InputPath)"
|
SOURCE="$(InputPath)"
|
||||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||||
@@ -82,23 +82,23 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania
|
|||||||
# PROP Intermediate_Dir "StepMania___Xbox_Debug___VC6"
|
# PROP Intermediate_Dir "StepMania___Xbox_Debug___VC6"
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
XBCP=xbecopy.exe
|
CPP=cl.exe
|
||||||
# ADD BASE XBCP /NOLOGO
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
|
||||||
# ADD XBCP /NOLOGO
|
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
|
||||||
XBE=imagebld.exe
|
BSC32=bscmake.exe
|
||||||
# ADD BASE XBE /nologo /stack:0x10000 /debug
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD XBE /nologo /stack:0x10000 /debug
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 $(intdir)\verstub.obj kernel32.lib shell32.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
|
# ADD BASE LINK32 $(intdir)\verstub.obj kernel32.lib shell32.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
|
||||||
# SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
|
# SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
|
||||||
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib shell32.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
|
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib shell32.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
|
||||||
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
|
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
|
||||||
BSC32=bscmake.exe
|
XBE=imagebld.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE XBE /nologo /stack:0x10000 /debug
|
||||||
# ADD BSC32 /nologo
|
# ADD XBE /nologo /stack:0x10000 /debug
|
||||||
CPP=cl.exe
|
XBCP=xbecopy.exe
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
|
# ADD BASE XBCP /NOLOGO
|
||||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
|
# ADD XBCP /NOLOGO
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
IntDir=.\StepMania___Xbox_Debug___VC6
|
IntDir=.\StepMania___Xbox_Debug___VC6
|
||||||
TargetDir=.\StepMania___Xbox_Debug___VC6
|
TargetDir=.\StepMania___Xbox_Debug___VC6
|
||||||
@@ -141,7 +141,7 @@ LINK32=link.exe
|
|||||||
# SUBTRACT LINK32 /verbose /pdb:none
|
# SUBTRACT LINK32 /verbose /pdb:none
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
IntDir=.\../Release6
|
IntDir=.\../Release6
|
||||||
TargetDir=\temp\stepmania
|
TargetDir=\stepmania\stepmania
|
||||||
TargetName=StepMania
|
TargetName=StepMania
|
||||||
SOURCE="$(InputPath)"
|
SOURCE="$(InputPath)"
|
||||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||||
@@ -2009,6 +2009,19 @@ SOURCE=.\ActorScroller.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ActorUtil.cpp
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "StepMania - Win32 Debug"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\ActorUtil.h
|
SOURCE=.\ActorUtil.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|||||||
@@ -1677,6 +1677,9 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
|||||||
<File
|
<File
|
||||||
RelativePath="ActorScroller.h">
|
RelativePath="ActorScroller.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="ActorUtil.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="ActorUtil.h">
|
RelativePath="ActorUtil.h">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
Reference in New Issue
Block a user