add 3D scrolling to ActorScroller
generalize BGAnimation, BGAnimationLayer to eliminate shared code with ActorFrame
This commit is contained in:
@@ -3342,6 +3342,8 @@ MemoryCardIcons=0
|
|||||||
TimerSeconds=0
|
TimerSeconds=0
|
||||||
|
|
||||||
[ScreenUnlock]
|
[ScreenUnlock]
|
||||||
|
Fallback=ScreenAttract
|
||||||
|
|
||||||
UseUnlocksDat=1
|
UseUnlocksDat=1
|
||||||
TypeOfPointsToDisplay=DP
|
TypeOfPointsToDisplay=DP
|
||||||
TimeToDisplay=10
|
TimeToDisplay=10
|
||||||
@@ -3477,6 +3479,8 @@ Unlock20X=250
|
|||||||
Unlock20Y=325
|
Unlock20Y=325
|
||||||
|
|
||||||
[ScreenRanking]
|
[ScreenRanking]
|
||||||
|
Fallback=ScreenAttract
|
||||||
|
|
||||||
StepsTypesToHide=dance-couple,dance-solo,pump-halfdouble
|
StepsTypesToHide=dance-couple,dance-solo,pump-halfdouble
|
||||||
ShowCategories=1
|
ShowCategories=1
|
||||||
CoursesToShow=Courses/DDRMAX/NaokiStandard.crs,Courses/DDRMAX/ParanoiaBrothers.crs,Courses/Samples/PlayersBest1-4.crs
|
CoursesToShow=Courses/DDRMAX/NaokiStandard.crs,Courses/DDRMAX/ParanoiaBrothers.crs,Courses/Samples/PlayersBest1-4.crs
|
||||||
@@ -3597,21 +3601,32 @@ Line3=conf,AttractSoundFrequency
|
|||||||
Line4=conf,SoundVolume
|
Line4=conf,SoundVolume
|
||||||
|
|
||||||
[ScreenIntroMovie]
|
[ScreenIntroMovie]
|
||||||
|
Class=ScreenAttract
|
||||||
|
Fallback=ScreenAttract
|
||||||
NextScreen=ScreenDemonstration
|
NextScreen=ScreenDemonstration
|
||||||
|
|
||||||
[ScreenMemoryCard]
|
[ScreenMemoryCard]
|
||||||
|
Class=ScreenAttract
|
||||||
|
Fallback=ScreenAttract
|
||||||
NextScreen=ScreenWarning
|
NextScreen=ScreenWarning
|
||||||
|
|
||||||
[ScreenWarning]
|
[ScreenWarning]
|
||||||
|
Class=ScreenAttract
|
||||||
|
Fallback=ScreenAttract
|
||||||
NextScreen=ScreenCompany
|
NextScreen=ScreenCompany
|
||||||
|
|
||||||
[ScreenCompany]
|
[ScreenCompany]
|
||||||
|
Class=ScreenAttract
|
||||||
|
Fallback=ScreenAttract
|
||||||
NextScreen=ScreenLogo
|
NextScreen=ScreenLogo
|
||||||
|
|
||||||
[ScreenAlbums]
|
[ScreenAlbums]
|
||||||
|
Class=ScreenAttract
|
||||||
|
Fallback=ScreenAttract
|
||||||
NextScreen=ScreenLogo
|
NextScreen=ScreenLogo
|
||||||
|
|
||||||
[ScreenLogo]
|
[ScreenLogo]
|
||||||
|
Fallback=ScreenAttract
|
||||||
LogoOnCommand=x,320;y,240;zoomy,0;sleep,0.5;bounceend,0.5;zoomy,1;glowshift;effectperiod,2.5;effectcolor1,1,1,1,0.1;effectcolor2,1,1,1,0.3
|
LogoOnCommand=x,320;y,240;zoomy,0;sleep,0.5;bounceend,0.5;zoomy,1;glowshift;effectperiod,2.5;effectcolor1,1,1,1,0.1;effectcolor2,1,1,1,0.3
|
||||||
NextScreen=ScreenHowToPlay
|
NextScreen=ScreenHowToPlay
|
||||||
|
|
||||||
|
|||||||
@@ -709,7 +709,7 @@ void Actor::AddRotationR( float rot )
|
|||||||
RageQuatMultiply( &DestTweenState().quat, DestTweenState().quat, RageQuatFromR(rot) );
|
RageQuatMultiply( &DestTweenState().quat, DestTweenState().quat, RageQuatFromR(rot) );
|
||||||
}
|
}
|
||||||
|
|
||||||
float Actor::Command( CString sCommands )
|
void Actor::Command( CString sCommands )
|
||||||
{
|
{
|
||||||
sCommands.MakeLower();
|
sCommands.MakeLower();
|
||||||
|
|
||||||
@@ -718,8 +718,6 @@ float Actor::Command( CString sCommands )
|
|||||||
|
|
||||||
for( unsigned i=0; i<vCommands.size(); i++ )
|
for( unsigned i=0; i<vCommands.size(); i++ )
|
||||||
this->HandleCommand( vCommands[i] );
|
this->HandleCommand( vCommands[i] );
|
||||||
|
|
||||||
return GetTweenTimeLeft();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::HandleCommand( const ParsedCommand &command )
|
void Actor::HandleCommand( const ParsedCommand &command )
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ 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); };
|
||||||
|
|
||||||
float Command( CString sCommands ); // return length in seconds to execute command
|
void Command( CString sCommands ); // return length in seconds to execute command
|
||||||
virtual void HandleCommand( const ParsedCommand &command ); // derivable
|
virtual void HandleCommand( const ParsedCommand &command ); // derivable
|
||||||
static float GetCommandLength( CString command );
|
static float GetCommandLength( CString command );
|
||||||
|
|
||||||
@@ -302,6 +302,14 @@ public:
|
|||||||
virtual void SetSecondsIntoAnimation( float fSeconds ) {};
|
virtual void SetSecondsIntoAnimation( float fSeconds ) {};
|
||||||
virtual int GetNumStates() { return 1; };
|
virtual int GetNumStates() { return 1; };
|
||||||
|
|
||||||
|
//
|
||||||
|
// BGAnimation stuff
|
||||||
|
//
|
||||||
|
virtual void GainingFocus( float fRate, bool bRewindMovie, bool bLoop ) {}
|
||||||
|
virtual void LosingFocus() {}
|
||||||
|
virtual void PlayOffCommand() { this->PlayCommand("Off"); }
|
||||||
|
virtual void PlayCommand( const CString &sCommandName ) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
struct TweenInfo
|
struct TweenInfo
|
||||||
|
|||||||
@@ -149,3 +149,23 @@ void ActorFrame::HandleCommand( const ParsedCommand &command )
|
|||||||
// base class handles the rest...
|
// base class handles the rest...
|
||||||
Actor::HandleCommand( command );
|
Actor::HandleCommand( command );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActorFrame::GainingFocus( float fRate, bool bRewindMovie, bool bLoop )
|
||||||
|
{
|
||||||
|
for( unsigned i=0; i<m_SubActors.size(); i++ )
|
||||||
|
m_SubActors[i]->GainingFocus( fRate, bRewindMovie, bLoop );
|
||||||
|
|
||||||
|
SetDiffuse( RageColor(1,1,1,1) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActorFrame::LosingFocus()
|
||||||
|
{
|
||||||
|
for( unsigned i=0; i<m_SubActors.size(); i++ )
|
||||||
|
m_SubActors[i]->LosingFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActorFrame::PlayCommand( const CString &sCommandName )
|
||||||
|
{
|
||||||
|
for( unsigned i=0; i<m_SubActors.size(); i++ )
|
||||||
|
m_SubActors[i]->PlayCommand( sCommandName );
|
||||||
|
}
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ public:
|
|||||||
/* Amount of time until all tweens (and all children's tweens) have stopped: */
|
/* Amount of time until all tweens (and all children's tweens) have stopped: */
|
||||||
virtual float GetTweenTimeLeft() const;
|
virtual float GetTweenTimeLeft() const;
|
||||||
|
|
||||||
|
virtual void GainingFocus( float fRate, bool bRewindMovie, bool bLoop );
|
||||||
|
virtual void LosingFocus();
|
||||||
|
virtual void PlayCommand( const CString &sCommandName );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
vector<Actor*> m_SubActors;
|
vector<Actor*> m_SubActors;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,37 +14,80 @@
|
|||||||
#include "ActorCollision.h"
|
#include "ActorCollision.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
|
#include "RageDisplay.h"
|
||||||
|
|
||||||
|
|
||||||
ActorScroller::ActorScroller()
|
ActorScroller::ActorScroller()
|
||||||
{
|
{
|
||||||
|
m_bLoaded = false;
|
||||||
m_fCurrentItem = 0;
|
m_fCurrentItem = 0;
|
||||||
m_fDestinationItem = 0;
|
m_fDestinationItem = 0;
|
||||||
|
m_fSecondsPerItem = 1;
|
||||||
|
m_iNumItemsToDraw = 7;
|
||||||
|
|
||||||
|
m_vRotationDegrees = RageVector3(0,0,0);
|
||||||
|
m_vTranslateTerm0 = RageVector3(0,0,0);
|
||||||
|
m_vTranslateTerm1 = RageVector3(0,0,0);
|
||||||
|
m_vTranslateTerm2 = RageVector3(0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActorScroller::Load( float fScrollSecondsPerItem, float fSpacingX, float fSpacingY )
|
void ActorScroller::Load(
|
||||||
|
float fSecondsPerItem,
|
||||||
|
int iNumItemsToDraw,
|
||||||
|
const RageVector3 &vRotationDegrees,
|
||||||
|
const RageVector3 &vTranslateTerm0,
|
||||||
|
const RageVector3 &vTranslateTerm1,
|
||||||
|
const RageVector3 &vTranslateTerm2
|
||||||
|
)
|
||||||
{
|
{
|
||||||
ASSERT( fScrollSecondsPerItem > 0 );
|
ASSERT( fSecondsPerItem > 0 );
|
||||||
m_fScrollSecondsPerItem = fScrollSecondsPerItem;
|
m_fSecondsPerItem = fSecondsPerItem;
|
||||||
m_vSpacing.x = fSpacingX;
|
m_iNumItemsToDraw = iNumItemsToDraw;
|
||||||
m_vSpacing.y = fSpacingY;
|
m_vRotationDegrees = vRotationDegrees;
|
||||||
|
m_vTranslateTerm0 = vTranslateTerm0;
|
||||||
|
m_vTranslateTerm1 = vTranslateTerm1;
|
||||||
|
m_vTranslateTerm2 = vTranslateTerm2;
|
||||||
|
|
||||||
|
m_bLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActorScroller::Update( float fDeltaTime )
|
void ActorScroller::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
ActorFrame::Update( fDeltaTime );
|
ActorFrame::Update( fDeltaTime );
|
||||||
|
|
||||||
fapproach( m_fCurrentItem, m_fDestinationItem, fDeltaTime/m_fScrollSecondsPerItem );
|
fapproach( m_fCurrentItem, m_fDestinationItem, fDeltaTime/m_fSecondsPerItem );
|
||||||
|
}
|
||||||
|
|
||||||
for( unsigned i=0; i<m_SubActors.size(); i++ )
|
void ActorScroller::DrawPrimitives()
|
||||||
|
{
|
||||||
|
if( m_bLoaded )
|
||||||
{
|
{
|
||||||
Actor* pActor = m_SubActors[i];
|
for( unsigned i=0; i<m_SubActors.size(); i++ )
|
||||||
|
{
|
||||||
|
float fItemOffset = i - m_fCurrentItem;
|
||||||
|
|
||||||
float fItemOffset = i - m_fCurrentItem;
|
if( m_vRotationDegrees[0] )
|
||||||
float fX = m_vSpacing.x * fItemOffset;
|
DISPLAY->RotateX( m_vRotationDegrees[0]*fItemOffset );
|
||||||
float fY = m_vSpacing.y * fItemOffset;
|
if( m_vRotationDegrees[1] )
|
||||||
fX = roundf( fX );
|
DISPLAY->RotateY( m_vRotationDegrees[1]*fItemOffset );
|
||||||
fY = roundf( fY );
|
if( m_vRotationDegrees[2] )
|
||||||
pActor->SetXY( fX, fY );
|
DISPLAY->RotateZ( m_vRotationDegrees[2]*fItemOffset );
|
||||||
|
|
||||||
|
RageVector3 vTranslation =
|
||||||
|
m_vTranslateTerm0 + // m_vTranslateTerm0*itemOffset^0
|
||||||
|
m_vTranslateTerm1 * fItemOffset + // m_vTranslateTerm1*itemOffset^1
|
||||||
|
m_vTranslateTerm2 * fItemOffset*fItemOffset; // m_vTranslateTerm2*itemOffset^2
|
||||||
|
DISPLAY->Translate(
|
||||||
|
vTranslation[0],
|
||||||
|
vTranslation[1],
|
||||||
|
vTranslation[2]
|
||||||
|
);
|
||||||
|
|
||||||
|
m_SubActors[i]->Draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ActorFrame::DrawPrimitives();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,19 +19,38 @@ class ActorScroller : public ActorFrame
|
|||||||
public:
|
public:
|
||||||
ActorScroller();
|
ActorScroller();
|
||||||
|
|
||||||
void Load( float fScrollSecondsPerItem, float fSpacingX, float fSpacingY );
|
void Load(
|
||||||
|
float fScrollSecondsPerItem,
|
||||||
|
int iNumItemsToDraw,
|
||||||
|
const RageVector3 &vRotationDegrees,
|
||||||
|
const RageVector3 &vTranslateTerm0,
|
||||||
|
const RageVector3 &vTranslateTerm1,
|
||||||
|
const RageVector3 &vTranslateTerm2 );
|
||||||
|
|
||||||
virtual void Update( float fDelta );
|
virtual void Update( float fDelta );
|
||||||
virtual void DrawPrimitives() {} // doesn't draw!
|
virtual void DrawPrimitives(); // DOES draw
|
||||||
|
|
||||||
void SetDestinationItem( int iItem ) { m_fDestinationItem = float(iItem); }
|
void SetDestinationItem( int iItem ) { m_fDestinationItem = float(iItem); }
|
||||||
void SetCurrentAndDestinationItem( int iItem ) { m_fCurrentItem = m_fDestinationItem = float(iItem); }
|
void SetCurrentAndDestinationItem( int iItem ) { m_fCurrentItem = m_fDestinationItem = float(iItem); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool m_bLoaded;
|
||||||
float m_fCurrentItem; // usually between 0 and m_SubActors.size()
|
float m_fCurrentItem; // usually between 0 and m_SubActors.size()
|
||||||
float m_fDestinationItem;
|
float m_fDestinationItem;
|
||||||
float m_fScrollSecondsPerItem;
|
float m_fSecondsPerItem;
|
||||||
RageVector2 m_vSpacing;
|
int m_iNumItemsToDraw;
|
||||||
|
|
||||||
|
// Note: Rotation is applied before translation.
|
||||||
|
|
||||||
|
// rot = m_vRotationDegrees*itemOffset^1
|
||||||
|
RageVector3 m_vRotationDegrees;
|
||||||
|
|
||||||
|
// trans = m_vTranslateTerm0*itemOffset^0 +
|
||||||
|
// m_vTranslateTerm1*itemOffset^1 +
|
||||||
|
// m_vTranslateTerm2*itemOffset^2
|
||||||
|
RageVector3 m_vTranslateTerm0;
|
||||||
|
RageVector3 m_vTranslateTerm1;
|
||||||
|
RageVector3 m_vTranslateTerm2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "song.h"
|
#include "song.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "RageTextureManager.h"
|
#include "RageTextureManager.h"
|
||||||
|
#include "SongManager.h"
|
||||||
|
|
||||||
|
|
||||||
Actor* LoadFromActorFile( CString sIniPath, CString sLayer )
|
Actor* LoadFromActorFile( CString sIniPath, CString sLayer )
|
||||||
@@ -95,7 +96,10 @@ Actor* LoadFromActorFile( CString sIniPath, CString sLayer )
|
|||||||
}
|
}
|
||||||
else if( sFile.CompareNoCase("songbanner")==0 )
|
else if( sFile.CompareNoCase("songbanner")==0 )
|
||||||
{
|
{
|
||||||
const Song *pSong = GAMESTATE->m_pCurSong;
|
Song *pSong = GAMESTATE->m_pCurSong;
|
||||||
|
if( pSong == NULL )
|
||||||
|
pSong = SONGMAN->GetRandomSong();
|
||||||
|
|
||||||
if( pSong && pSong->HasBanner() )
|
if( pSong && pSong->HasBanner() )
|
||||||
sFile = pSong->GetBannerPath();
|
sFile = pSong->GetBannerPath();
|
||||||
else
|
else
|
||||||
@@ -187,14 +191,14 @@ void UtilSetXY( Actor& actor, CString sClassName )
|
|||||||
actor.SetXY( THEME->GetMetricF(sClassName,actor.GetID()+"X"), THEME->GetMetricF(sClassName,actor.GetID()+"Y") );
|
actor.SetXY( THEME->GetMetricF(sClassName,actor.GetID()+"X"), THEME->GetMetricF(sClassName,actor.GetID()+"Y") );
|
||||||
}
|
}
|
||||||
|
|
||||||
float UtilCommand( Actor& actor, CString sClassName, CString sCommandName )
|
void UtilCommand( Actor& actor, CString sClassName, CString sCommandName )
|
||||||
{
|
{
|
||||||
// If Actor is hidden, it won't get updated or drawn, so don't bother tweening.
|
// If Actor is hidden, it won't get updated or drawn, so don't bother tweening.
|
||||||
/* ... but we might be unhiding it, or setting state for when we unhide it later */
|
/* ... but we might be unhiding it, or setting state for when we unhide it later */
|
||||||
// if( actor.GetHidden() )
|
// if( actor.GetHidden() )
|
||||||
// return 0;
|
// return 0;
|
||||||
|
|
||||||
float ret = actor.Command( "playcommand," + sCommandName );
|
actor.Command( "playcommand," + sCommandName );
|
||||||
|
|
||||||
// HACK: It's very often that we command things to TweenOffScreen
|
// HACK: It's very often that we command things to TweenOffScreen
|
||||||
// that we aren't drawing. We know that an Actor is not being
|
// that we aren't drawing. We know that an Actor is not being
|
||||||
@@ -203,11 +207,11 @@ float UtilCommand( Actor& actor, CString sClassName, CString sCommandName )
|
|||||||
if( sCommandName=="Off" )
|
if( sCommandName=="Off" )
|
||||||
{
|
{
|
||||||
if( actor.GetID().empty() )
|
if( actor.GetID().empty() )
|
||||||
return ret;
|
return;
|
||||||
} else {
|
} else {
|
||||||
RAGE_ASSERT_M( !actor.GetID().empty(), ssprintf("!actor.GetID().empty() ('%s', '%s')", sClassName.c_str(), sCommandName.c_str()) );
|
RAGE_ASSERT_M( !actor.GetID().empty(), ssprintf("!actor.GetID().empty() ('%s', '%s')", sClassName.c_str(), sCommandName.c_str()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return max( ret, actor.Command( THEME->GetMetric(sClassName,actor.GetID()+sCommandName+"Command") ) );
|
actor.Command( THEME->GetMetric(sClassName,actor.GetID()+sCommandName+"Command") );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,21 +26,21 @@ void UtilSetXY( Actor& actor, CString sClassName );
|
|||||||
inline void UtilSetXY( Actor* pActor, CString sClassName ) { UtilSetXY( *pActor, sClassName ); }
|
inline void UtilSetXY( Actor* pActor, CString sClassName ) { UtilSetXY( *pActor, sClassName ); }
|
||||||
|
|
||||||
|
|
||||||
float UtilCommand( Actor& actor, CString sClassName, CString sCommandName );
|
void UtilCommand( Actor& actor, CString sClassName, CString sCommandName );
|
||||||
|
|
||||||
inline float UtilOnCommand( Actor& actor, CString sClassName ) { return UtilCommand( actor, sClassName, "On" ); }
|
inline void UtilOnCommand( Actor& actor, CString sClassName ) { UtilCommand( actor, sClassName, "On" ); }
|
||||||
inline float UtilOffCommand( Actor& actor, CString sClassName ) { return UtilCommand( actor, sClassName, "Off" ); }
|
inline void UtilOffCommand( Actor& actor, CString sClassName ) { UtilCommand( actor, sClassName, "Off" ); }
|
||||||
inline float UtilSetXYAndOnCommand( Actor& actor, CString sClassName )
|
inline void UtilSetXYAndOnCommand( Actor& actor, CString sClassName )
|
||||||
{
|
{
|
||||||
UtilSetXY( actor, sClassName );
|
UtilSetXY( actor, sClassName );
|
||||||
return UtilOnCommand( actor, sClassName );
|
UtilOnCommand( actor, sClassName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* convenience */
|
/* convenience */
|
||||||
inline float UtilCommand( Actor* pActor, CString sClassName, CString sCommandName ) { return UtilCommand( *pActor, sClassName, sCommandName ); }
|
inline void UtilCommand( Actor* pActor, CString sClassName, CString sCommandName ) { UtilCommand( *pActor, sClassName, sCommandName ); }
|
||||||
inline float UtilOnCommand( Actor* pActor, CString sClassName ) { return UtilOnCommand( *pActor, sClassName ); }
|
inline void UtilOnCommand( Actor* pActor, CString sClassName ) { UtilOnCommand( *pActor, sClassName ); }
|
||||||
inline float UtilOffCommand( Actor* pActor, CString sClassName ) { return UtilOffCommand( *pActor, sClassName ); }
|
inline void UtilOffCommand( Actor* pActor, CString sClassName ) { UtilOffCommand( *pActor, sClassName ); }
|
||||||
inline float UtilSetXYAndOnCommand( Actor* pActor, CString sClassName ) { return UtilSetXYAndOnCommand( *pActor, sClassName ); }
|
inline void UtilSetXYAndOnCommand( Actor* pActor, CString sClassName ) { UtilSetXYAndOnCommand( *pActor, sClassName ); }
|
||||||
|
|
||||||
// Return a Sprite, BitmapText, or Model depending on the file type
|
// Return a Sprite, BitmapText, or Model depending on the file type
|
||||||
Actor* LoadFromActorFile( CString sIniPath, CString sLayer = "Actor" );
|
Actor* LoadFromActorFile( CString sIniPath, CString sLayer = "Actor" );
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
|
#include "arch/ArchHooks/ArchHooks.h"
|
||||||
|
|
||||||
const int MAX_LAYERS = 1000;
|
const int MAX_LAYERS = 1000;
|
||||||
|
|
||||||
@@ -38,9 +39,7 @@ BGAnimation::~BGAnimation()
|
|||||||
|
|
||||||
void BGAnimation::Unload()
|
void BGAnimation::Unload()
|
||||||
{
|
{
|
||||||
for( unsigned i=0; i<m_Layers.size(); i++ )
|
DeleteAllChildren();
|
||||||
delete m_Layers[i];
|
|
||||||
m_Layers.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BGAnimation::LoadFromStaticGraphic( CString sPath )
|
void BGAnimation::LoadFromStaticGraphic( CString sPath )
|
||||||
@@ -49,10 +48,10 @@ void BGAnimation::LoadFromStaticGraphic( CString sPath )
|
|||||||
|
|
||||||
BGAnimationLayer* pLayer = new BGAnimationLayer( m_bGeneric );
|
BGAnimationLayer* pLayer = new BGAnimationLayer( m_bGeneric );
|
||||||
pLayer->LoadFromStaticGraphic( sPath );
|
pLayer->LoadFromStaticGraphic( sPath );
|
||||||
m_Layers.push_back( pLayer );
|
AddChild( pLayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddLayersFromAniDir( CString sAniDir, vector<BGAnimationLayer*> &layersAddTo, bool Generic )
|
void AddLayersFromAniDir( CString sAniDir, vector<Actor*> &layersAddTo, bool Generic )
|
||||||
{
|
{
|
||||||
if( sAniDir.empty() )
|
if( sAniDir.empty() )
|
||||||
return;
|
return;
|
||||||
@@ -111,40 +110,62 @@ void BGAnimation::LoadFromAniDir( CString sAniDir )
|
|||||||
if( DoesFileExist(sPathToIni) )
|
if( DoesFileExist(sPathToIni) )
|
||||||
{
|
{
|
||||||
// This is a new style BGAnimation (using .ini)
|
// This is a new style BGAnimation (using .ini)
|
||||||
AddLayersFromAniDir( sAniDir, m_Layers, m_bGeneric ); // TODO: Check for circular load
|
AddLayersFromAniDir( sAniDir, m_SubActors, m_bGeneric ); // TODO: Check for circular load
|
||||||
|
|
||||||
IniFile ini(sPathToIni);
|
IniFile ini(sPathToIni);
|
||||||
ini.ReadFile();
|
ini.ReadFile();
|
||||||
if( !ini.GetValue( "BGAnimation", "LengthSeconds", m_fLengthSeconds ) )
|
if( !ini.GetValue( "BGAnimation", "LengthSeconds", m_fLengthSeconds ) )
|
||||||
{
|
{
|
||||||
m_fLengthSeconds = 0;
|
|
||||||
/* XXX: if m_bGeneric, simply constructing the BG layer won't run "On",
|
/* XXX: if m_bGeneric, simply constructing the BG layer won't run "On",
|
||||||
* so at this point GetMaxTweenTimeLeft is probably 0 */
|
* so at this point GetMaxTweenTimeLeft is probably 0 */
|
||||||
for( int i=0; (unsigned)i < m_Layers.size(); i++ )
|
m_fLengthSeconds = this->GetTweenTimeLeft();
|
||||||
m_fLengthSeconds = max(m_fLengthSeconds, m_Layers[i]->GetMaxTweenTimeLeft());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bUseScroller;
|
bool bUseScroller;
|
||||||
if( ini.GetValue( "BGAnimation", "UseScroller", bUseScroller ) && bUseScroller )
|
if( ini.GetValue( "BGAnimation", "UseScroller", bUseScroller ) && bUseScroller )
|
||||||
{
|
{
|
||||||
|
// TODO: Move this into ActorScroller
|
||||||
|
|
||||||
#define REQUIRED_GET_VALUE( szName, valueOut ) \
|
#define REQUIRED_GET_VALUE( szName, valueOut ) \
|
||||||
if( !ini.GetValue( "BGAnimation", szName, valueOut ) ) \
|
if( !ini.GetValue( "Scroller", szName, valueOut ) ) \
|
||||||
RageException::Throw( "File '%s' is missing the value BGAnimation::%s", sPathToIni.c_str(), szName );
|
HOOKS->MessageBoxOK( ssprintf("File '%s' is missing the value Scroller::%s", sPathToIni.c_str(), szName) );
|
||||||
|
|
||||||
float fScrollSecondsPerItem, fSpacingX, fSpacingY, fItemPaddingStart, fItemPaddingEnd;
|
float fSecondsPerItem = 1;
|
||||||
REQUIRED_GET_VALUE( "ScrollSecondsPerItem", fScrollSecondsPerItem );
|
int iNumItemsToDraw = 7;
|
||||||
REQUIRED_GET_VALUE( "ScrollSpacingX", fSpacingX );
|
RageVector3 vRotationDegrees = RageVector3(0,0,0);
|
||||||
REQUIRED_GET_VALUE( "ScrollSpacingY", fSpacingY );
|
RageVector3 vTranslateTerm0 = RageVector3(0,0,0);
|
||||||
|
RageVector3 vTranslateTerm1 = RageVector3(0,0,0);
|
||||||
|
RageVector3 vTranslateTerm2 = RageVector3(0,0,0);
|
||||||
|
float fItemPaddingStart = 0;
|
||||||
|
float fItemPaddingEnd = 0;
|
||||||
|
|
||||||
|
REQUIRED_GET_VALUE( "SecondsPerItem", fSecondsPerItem );
|
||||||
|
REQUIRED_GET_VALUE( "NumItemsToDraw", iNumItemsToDraw );
|
||||||
|
REQUIRED_GET_VALUE( "RotationDegreesX", vRotationDegrees[0] );
|
||||||
|
REQUIRED_GET_VALUE( "RotationDegreesY", vRotationDegrees[1] );
|
||||||
|
REQUIRED_GET_VALUE( "RotationDegreesZ", vRotationDegrees[2] );
|
||||||
|
REQUIRED_GET_VALUE( "TranslateTerm0X", vTranslateTerm0[0] );
|
||||||
|
REQUIRED_GET_VALUE( "TranslateTerm0Y", vTranslateTerm0[1] );
|
||||||
|
REQUIRED_GET_VALUE( "TranslateTerm0Z", vTranslateTerm0[2] );
|
||||||
|
REQUIRED_GET_VALUE( "TranslateTerm1X", vTranslateTerm1[0] );
|
||||||
|
REQUIRED_GET_VALUE( "TranslateTerm1Y", vTranslateTerm1[1] );
|
||||||
|
REQUIRED_GET_VALUE( "TranslateTerm1Z", vTranslateTerm1[2] );
|
||||||
|
REQUIRED_GET_VALUE( "TranslateTerm2X", vTranslateTerm2[0] );
|
||||||
|
REQUIRED_GET_VALUE( "TranslateTerm2Y", vTranslateTerm2[1] );
|
||||||
|
REQUIRED_GET_VALUE( "TranslateTerm2Z", vTranslateTerm2[2] );
|
||||||
REQUIRED_GET_VALUE( "ItemPaddingStart", fItemPaddingStart );
|
REQUIRED_GET_VALUE( "ItemPaddingStart", fItemPaddingStart );
|
||||||
REQUIRED_GET_VALUE( "ItemPaddingEnd", fItemPaddingEnd );
|
REQUIRED_GET_VALUE( "ItemPaddingEnd", fItemPaddingEnd );
|
||||||
#undef REQUIRED_GET_VALUE
|
#undef REQUIRED_GET_VALUE
|
||||||
|
|
||||||
m_Scroller.Load( fScrollSecondsPerItem, fSpacingX, fSpacingY );
|
ActorScroller::Load(
|
||||||
for( unsigned i=0; i<m_Layers.size(); i++ )
|
fSecondsPerItem,
|
||||||
m_Scroller.AddChild( m_Layers[i] );
|
iNumItemsToDraw,
|
||||||
m_Scroller.SetCurrentAndDestinationItem( int(-fItemPaddingStart) );
|
vRotationDegrees,
|
||||||
m_Scroller.SetDestinationItem( int(m_Layers.size()-1+fItemPaddingEnd) );
|
vTranslateTerm0,
|
||||||
this->AddChild( &m_Scroller );
|
vTranslateTerm1,
|
||||||
|
vTranslateTerm2 );
|
||||||
|
ActorScroller::SetCurrentAndDestinationItem( int(-fItemPaddingStart) );
|
||||||
|
ActorScroller::SetDestinationItem( int(m_SubActors.size()-1+fItemPaddingEnd) );
|
||||||
}
|
}
|
||||||
|
|
||||||
CString InitCommand;
|
CString InitCommand;
|
||||||
@@ -181,7 +202,7 @@ void BGAnimation::LoadFromAniDir( CString sAniDir )
|
|||||||
continue; // don't directly load files starting with an underscore
|
continue; // don't directly load files starting with an underscore
|
||||||
BGAnimationLayer* pLayer = new BGAnimationLayer( m_bGeneric );
|
BGAnimationLayer* pLayer = new BGAnimationLayer( m_bGeneric );
|
||||||
pLayer->LoadFromAniLayerFile( asImagePaths[i] );
|
pLayer->LoadFromAniLayerFile( asImagePaths[i] );
|
||||||
m_Layers.push_back( pLayer );
|
AddChild( pLayer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,7 +213,7 @@ void BGAnimation::LoadFromMovie( CString sMoviePath )
|
|||||||
|
|
||||||
BGAnimationLayer* pLayer = new BGAnimationLayer( m_bGeneric );
|
BGAnimationLayer* pLayer = new BGAnimationLayer( m_bGeneric );
|
||||||
pLayer->LoadFromMovie( sMoviePath );
|
pLayer->LoadFromMovie( sMoviePath );
|
||||||
m_Layers.push_back( pLayer );
|
AddChild( pLayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BGAnimation::LoadFromVisualization( CString sVisPath )
|
void BGAnimation::LoadFromVisualization( CString sVisPath )
|
||||||
@@ -205,82 +226,10 @@ void BGAnimation::LoadFromVisualization( CString sVisPath )
|
|||||||
|
|
||||||
pLayer = new BGAnimationLayer( m_bGeneric );
|
pLayer = new BGAnimationLayer( m_bGeneric );
|
||||||
pLayer->LoadFromStaticGraphic( sSongBGPath );
|
pLayer->LoadFromStaticGraphic( sSongBGPath );
|
||||||
m_Layers.push_back( pLayer );
|
AddChild( pLayer );
|
||||||
|
|
||||||
pLayer = new BGAnimationLayer( m_bGeneric );
|
pLayer = new BGAnimationLayer( m_bGeneric );
|
||||||
pLayer->LoadFromVisualization( sVisPath );
|
pLayer->LoadFromVisualization( sVisPath );
|
||||||
m_Layers.push_back( pLayer );
|
AddChild( pLayer );
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BGAnimation::Update( float fDeltaTime )
|
|
||||||
{
|
|
||||||
for( unsigned i=0; i<m_Layers.size(); i++ )
|
|
||||||
m_Layers[i]->Update( fDeltaTime );
|
|
||||||
ActorFrame::Update( fDeltaTime );
|
|
||||||
}
|
|
||||||
|
|
||||||
void BGAnimation::DrawPrimitives()
|
|
||||||
{
|
|
||||||
for( unsigned i=0; i<m_Layers.size(); i++ )
|
|
||||||
m_Layers[i]->Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BGAnimation::GainingFocus( float fRate, bool bRewindMovie, bool bLoop )
|
|
||||||
{
|
|
||||||
for( unsigned i=0; i<m_Layers.size(); i++ )
|
|
||||||
m_Layers[i]->GainingFocus( fRate, bRewindMovie, bLoop );
|
|
||||||
|
|
||||||
SetDiffuse( RageColor(1,1,1,1) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void BGAnimation::LosingFocus()
|
|
||||||
{
|
|
||||||
for( unsigned i=0; i<m_Layers.size(); i++ )
|
|
||||||
m_Layers[i]->LosingFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BGAnimation::SetDiffuse( const RageColor &c )
|
|
||||||
{
|
|
||||||
for( unsigned i=0; i<m_Layers.size(); i++ )
|
|
||||||
m_Layers[i]->SetDiffuse(c);
|
|
||||||
ActorFrame::SetDiffuse( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
float BGAnimation::GetTweenTimeLeft() const
|
|
||||||
{
|
|
||||||
float ret = 0;
|
|
||||||
|
|
||||||
for( unsigned i=0; i<m_Layers.size(); ++i )
|
|
||||||
ret = max( ret, m_Layers[i]->GetMaxTweenTimeLeft() );
|
|
||||||
|
|
||||||
return max( ret, Actor::GetTweenTimeLeft() );
|
|
||||||
}
|
|
||||||
|
|
||||||
void BGAnimation::FinishTweening()
|
|
||||||
{
|
|
||||||
for( unsigned i=0; i<m_Layers.size(); i++ )
|
|
||||||
m_Layers[i]->FinishTweening();
|
|
||||||
ActorFrame::FinishTweening();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BGAnimation::PlayCommand( const CString &cmd )
|
|
||||||
{
|
|
||||||
for( unsigned i=0; i<m_Layers.size(); i++ )
|
|
||||||
m_Layers[i]->PlayCommand( cmd );
|
|
||||||
}
|
|
||||||
|
|
||||||
void BGAnimation::HandleCommand( const ParsedCommand &command )
|
|
||||||
{
|
|
||||||
HandleParams;
|
|
||||||
|
|
||||||
if( sParam(0)=="playcommand" ) PlayCommand( sParam(1) );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Actor::HandleCommand( command );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckHandledParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
Class: BGAnimation
|
Class: BGAnimation
|
||||||
|
|
||||||
Desc: Particles that play in the background of ScreenGameplay
|
Desc: An ActorFrame that loads itself
|
||||||
|
|
||||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
Ben Nordstrom
|
Ben Nordstrom
|
||||||
@@ -12,14 +12,9 @@
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ActorFrame.h"
|
|
||||||
#include "ActorScroller.h"
|
#include "ActorScroller.h"
|
||||||
|
|
||||||
|
class BGAnimation : public ActorScroller
|
||||||
class BGAnimationLayer;
|
|
||||||
|
|
||||||
|
|
||||||
class BGAnimation : public ActorFrame
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BGAnimation( bool Generic=false );
|
BGAnimation( bool Generic=false );
|
||||||
@@ -32,29 +27,11 @@ public:
|
|||||||
void LoadFromMovie( CString sMoviePath );
|
void LoadFromMovie( CString sMoviePath );
|
||||||
void LoadFromVisualization( CString sMoviePath );
|
void LoadFromVisualization( CString sMoviePath );
|
||||||
|
|
||||||
virtual void Update( float fDeltaTime );
|
|
||||||
virtual void DrawPrimitives();
|
|
||||||
|
|
||||||
virtual void SetDiffuse( const RageColor &c );
|
|
||||||
|
|
||||||
void GainingFocus( float fRate, bool bRewindMovie, bool bLoop );
|
|
||||||
void LosingFocus();
|
|
||||||
|
|
||||||
float GetLengthSeconds() const { return m_fLengthSeconds; }
|
float GetLengthSeconds() const { return m_fLengthSeconds; }
|
||||||
|
|
||||||
virtual void HandleCommand( const ParsedCommand &command );
|
|
||||||
void PlayOffCommand() { PlayCommand("Off"); }
|
|
||||||
void PlayCommand( const CString &cmd );
|
|
||||||
|
|
||||||
float GetTweenTimeLeft() const;
|
|
||||||
void FinishTweening();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
vector<BGAnimationLayer*> m_Layers;
|
|
||||||
float m_fLengthSeconds;
|
float m_fLengthSeconds;
|
||||||
bool m_bGeneric;
|
bool m_bGeneric;
|
||||||
|
|
||||||
ActorScroller m_Scroller;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -651,15 +651,6 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer )
|
|||||||
PlayCommand( "On" );
|
PlayCommand( "On" );
|
||||||
}
|
}
|
||||||
|
|
||||||
float BGAnimationLayer::GetMaxTweenTimeLeft() const
|
|
||||||
{
|
|
||||||
float ret = 0;
|
|
||||||
|
|
||||||
for( unsigned i=0; i<m_SubActors.size(); i++ )
|
|
||||||
ret = max(ret, m_SubActors[i]->GetTweenTimeLeft());
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BGAnimationLayer::FinishTweening()
|
void BGAnimationLayer::FinishTweening()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -339,8 +339,15 @@ Screen* Screen::Create( CString sClassName )
|
|||||||
CString sName = sClassName;
|
CString sName = sClassName;
|
||||||
if( parts.size() == 2 )
|
if( parts.size() == 2 )
|
||||||
{
|
{
|
||||||
sClassName = parts[1];
|
|
||||||
sName = parts[0];
|
sName = parts[0];
|
||||||
|
sClassName = parts[1];
|
||||||
|
}
|
||||||
|
// This is the new, preferred method for specifying the screen class.
|
||||||
|
// Look up the class in the metrics group sName
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( THEME->HasMetric(sClassName,"Class") )
|
||||||
|
sClassName = THEME->GetMetric(sClassName,"Class");
|
||||||
}
|
}
|
||||||
|
|
||||||
#define IF_RETURN(X) if(sClassName.CompareNoCase(#X)==0) return new X(sName);
|
#define IF_RETURN(X) if(sClassName.CompareNoCase(#X)==0) return new X(sName);
|
||||||
|
|||||||
@@ -30,12 +30,12 @@
|
|||||||
#define INITIAL_SCREEN THEME->GetMetric("Common","InitialScreen")
|
#define INITIAL_SCREEN THEME->GetMetric("Common","InitialScreen")
|
||||||
|
|
||||||
|
|
||||||
ScreenAttract::ScreenAttract( CString sClassName, bool bResetGameState ) : Screen( sClassName )
|
ScreenAttract::ScreenAttract( CString sName, bool bResetGameState ) : Screen( sName )
|
||||||
{
|
{
|
||||||
LOG->Trace( "ScreenAttract::ScreenAttract(%s)", sClassName.c_str() );
|
LOG->Trace( "ScreenAttract::ScreenAttract(%s)", m_sName.c_str() );
|
||||||
|
|
||||||
// increment times through attract count
|
// increment times through attract count
|
||||||
if( sClassName == INITIAL_SCREEN )
|
if( m_sName == INITIAL_SCREEN )
|
||||||
GAMESTATE->m_iNumTimesThroughAttract++;
|
GAMESTATE->m_iNumTimesThroughAttract++;
|
||||||
|
|
||||||
if( bResetGameState )
|
if( bResetGameState )
|
||||||
@@ -46,11 +46,11 @@ ScreenAttract::ScreenAttract( CString sClassName, bool bResetGameState ) : Scree
|
|||||||
m_Background.LoadFromAniDir( THEME->GetPathToB(m_sName+" background") );
|
m_Background.LoadFromAniDir( THEME->GetPathToB(m_sName+" background") );
|
||||||
this->AddChild( &m_Background );
|
this->AddChild( &m_Background );
|
||||||
|
|
||||||
m_In.Load( THEME->GetPathToB("ScreenAttract in") );
|
m_In.Load( THEME->GetPathToB(m_sName+" in") );
|
||||||
m_In.StartTransitioning();
|
m_In.StartTransitioning();
|
||||||
this->AddChild( &m_In );
|
this->AddChild( &m_In );
|
||||||
|
|
||||||
m_Out.Load( THEME->GetPathToB("ScreenAttract out") );
|
m_Out.Load( THEME->GetPathToB(m_sName+" out") );
|
||||||
this->AddChild( &m_Out );
|
this->AddChild( &m_Out );
|
||||||
|
|
||||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(m_sName) );
|
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(m_sName) );
|
||||||
|
|||||||
@@ -172,10 +172,12 @@ ScreenCredits::ScreenCredits( CString sName ) : ScreenAttract( sName )
|
|||||||
SONGMAN->GetSongs( arraySongs );
|
SONGMAN->GetSongs( arraySongs );
|
||||||
SortSongPointerArrayByTitle( arraySongs );
|
SortSongPointerArrayByTitle( arraySongs );
|
||||||
|
|
||||||
m_ScrollerBackgrounds.Load( BACKGROUNDS_SCROLL_SECONDS_PER_ITEM, BACKGROUNDS_SPACING_X, BACKGROUNDS_SPACING_Y );
|
// FIXME: Redo this screen with a BGA
|
||||||
this->AddChild( &m_ScrollerBackgrounds );
|
// m_ScrollerBackgrounds.Load(
|
||||||
m_ScrollerFrames.Load( BACKGROUNDS_SCROLL_SECONDS_PER_ITEM, BACKGROUNDS_SPACING_X, BACKGROUNDS_SPACING_Y );
|
// BACKGROUNDS_SCROLL_SECONDS_PER_ITEM, BACKGROUNDS_SPACING_X, BACKGROUNDS_SPACING_Y );
|
||||||
this->AddChild( &m_ScrollerFrames );
|
// this->AddChild( &m_ScrollerBackgrounds );
|
||||||
|
// m_ScrollerFrames.Load( BACKGROUNDS_SCROLL_SECONDS_PER_ITEM, BACKGROUNDS_SPACING_X, BACKGROUNDS_SPACING_Y );
|
||||||
|
// this->AddChild( &m_ScrollerFrames );
|
||||||
|
|
||||||
{
|
{
|
||||||
for( int i=0; i<NUM_BACKGROUNDS; i++ )
|
for( int i=0; i<NUM_BACKGROUNDS; i++ )
|
||||||
@@ -199,7 +201,7 @@ ScreenCredits::ScreenCredits( CString sName ) : ScreenAttract( sName )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ScrollerTexts.Load( TEXTS_SCROLL_SECONDS_PER_ITEM, TEXTS_SPACING_X, TEXTS_SPACING_Y );
|
// m_ScrollerTexts.Load( TEXTS_SCROLL_SECONDS_PER_ITEM, TEXTS_SPACING_X, TEXTS_SPACING_Y );
|
||||||
this->AddChild( &m_ScrollerTexts );
|
this->AddChild( &m_ScrollerTexts );
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1566,9 +1566,23 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
|
|||||||
{
|
{
|
||||||
PREFSMAN->m_bAutoPlay = !PREFSMAN->m_bAutoPlay;
|
PREFSMAN->m_bAutoPlay = !PREFSMAN->m_bAutoPlay;
|
||||||
UpdateAutoPlayText();
|
UpdateAutoPlayText();
|
||||||
|
bool bIsHoldingShift =
|
||||||
|
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, SDLK_RSHIFT)) ||
|
||||||
|
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, SDLK_LSHIFT));
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
|
{
|
||||||
if( GAMESTATE->IsHumanPlayer(p) )
|
if( GAMESTATE->IsHumanPlayer(p) )
|
||||||
GAMESTATE->m_PlayerController[p] = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN;
|
{
|
||||||
|
if( bIsHoldingShift )
|
||||||
|
{
|
||||||
|
GAMESTATE->m_PlayerController[p] = PREFSMAN->m_bAutoPlay ? PC_CPU : PC_HUMAN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GAMESTATE->m_PlayerController[p] = PREFSMAN->m_bAutoPlay ? PC_AUTOPLAY : PC_HUMAN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDLK_F9:
|
case SDLK_F9:
|
||||||
|
|||||||
@@ -88,7 +88,13 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
|
|||||||
{
|
{
|
||||||
if( SHARED_PREVIEW_AND_CURSOR )
|
if( SHARED_PREVIEW_AND_CURSOR )
|
||||||
{
|
{
|
||||||
m_Scroller[0].Load( SCROLLER_SECONDS_PER_ITEM, SCROLLER_SPACING_X, SCROLLER_SPACING_Y );
|
m_Scroller[0].Load(
|
||||||
|
SCROLLER_SECONDS_PER_ITEM,
|
||||||
|
7,
|
||||||
|
RageVector3( 0, 0, 0 ),
|
||||||
|
RageVector3( 0, 0, 0 ),
|
||||||
|
RageVector3( SCROLLER_SPACING_X, SCROLLER_SPACING_Y, 0 ),
|
||||||
|
RageVector3( 0, 0, 0 ) );
|
||||||
m_Scroller[0].SetName( "Scroller" );
|
m_Scroller[0].SetName( "Scroller" );
|
||||||
this->AddChild( &m_Scroller[0] );
|
this->AddChild( &m_Scroller[0] );
|
||||||
|
|
||||||
@@ -109,7 +115,13 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
|
|||||||
if( !GAMESTATE->IsPlayerEnabled(p) )
|
if( !GAMESTATE->IsPlayerEnabled(p) )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
m_Scroller[p].Load( SCROLLER_SECONDS_PER_ITEM, SCROLLER_SPACING_X, SCROLLER_SPACING_Y );
|
m_Scroller[p].Load(
|
||||||
|
SCROLLER_SECONDS_PER_ITEM,
|
||||||
|
7,
|
||||||
|
RageVector3( 0, 0, 0 ),
|
||||||
|
RageVector3( 0, 0, 0 ),
|
||||||
|
RageVector3( SCROLLER_SPACING_X, SCROLLER_SPACING_Y, 0 ),
|
||||||
|
RageVector3( 0, 0, 0 ) );
|
||||||
m_Scroller[p].SetName( ssprintf("ScrollerP%d",p+1) );
|
m_Scroller[p].SetName( ssprintf("ScrollerP%d",p+1) );
|
||||||
this->AddChild( &m_Scroller[p] );
|
this->AddChild( &m_Scroller[p] );
|
||||||
|
|
||||||
@@ -228,7 +240,7 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
|
|||||||
|
|
||||||
this->UpdateSelectableChoices();
|
this->UpdateSelectableChoices();
|
||||||
|
|
||||||
m_fLockInputSecs = TweenOnScreen();
|
m_fLockInputSecs = this->GetTweenTimeLeft();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSelectMaster::Update( float fDelta )
|
void ScreenSelectMaster::Update( float fDelta )
|
||||||
@@ -245,14 +257,12 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
{
|
{
|
||||||
case SM_PlayPostSwitchPage:
|
case SM_PlayPostSwitchPage:
|
||||||
{
|
{
|
||||||
float fSecs = 0;
|
|
||||||
|
|
||||||
if( SHARED_PREVIEW_AND_CURSOR )
|
if( SHARED_PREVIEW_AND_CURSOR )
|
||||||
{
|
{
|
||||||
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
|
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
|
||||||
{
|
{
|
||||||
m_sprCursor[i][0].SetXY( GetCursorX((PlayerNumber)0,i), GetCursorY((PlayerNumber)0,i) );
|
m_sprCursor[i][0].SetXY( GetCursorX((PlayerNumber)0,i), GetCursorY((PlayerNumber)0,i) );
|
||||||
fSecs = max( fSecs, COMMAND( m_sprCursor[i][0], "PostSwitchPage" ) );
|
COMMAND( m_sprCursor[i][0], "PostSwitchPage" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -262,34 +272,37 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
if( GAMESTATE->IsPlayerEnabled(p) )
|
if( GAMESTATE->IsPlayerEnabled(p) )
|
||||||
{
|
{
|
||||||
m_sprCursor[i][p].SetXY( GetCursorX((PlayerNumber)p,i), GetCursorY((PlayerNumber)p,i) );
|
m_sprCursor[i][p].SetXY( GetCursorX((PlayerNumber)p,i), GetCursorY((PlayerNumber)p,i) );
|
||||||
fSecs = max( fSecs, COMMAND( m_sprCursor[i][p], "PostSwitchPage" ) );
|
COMMAND( m_sprCursor[i][p], "PostSwitchPage" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( SHARED_PREVIEW_AND_CURSOR )
|
if( SHARED_PREVIEW_AND_CURSOR )
|
||||||
{
|
{
|
||||||
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
||||||
fSecs = max( fSecs, COMMAND( m_sprPreview[i][m_iChoice[0]][0], "PostSwitchPage" ) );
|
COMMAND( m_sprPreview[i][m_iChoice[0]][0], "PostSwitchPage" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
if( GAMESTATE->IsPlayerEnabled(p) )
|
if( GAMESTATE->IsPlayerEnabled(p) )
|
||||||
fSecs = max( fSecs, COMMAND( m_sprPreview[i][m_iChoice[p]][p], "PostSwitchPage" ) );
|
COMMAND( m_sprPreview[i][m_iChoice[p]][p], "PostSwitchPage" );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fLockInputSecs = POST_SWITCH_PAGE_SECONDS;
|
m_fLockInputSecs = POST_SWITCH_PAGE_SECONDS;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SM_BeginFadingOut:
|
case SM_BeginFadingOut:
|
||||||
float fSecs = TweenOffScreen();
|
{
|
||||||
/* This can be used to allow overlap between the main tween-off and the MenuElements
|
TweenOffScreen();
|
||||||
* tweenoff. */
|
float fSecs = GetTweenTimeLeft();
|
||||||
fSecs += EXTRA_SLEEP_AFTER_TWEEN_OFF_SECONDS;
|
/* This can be used to allow overlap between the main tween-off and the MenuElements
|
||||||
fSecs = max( fSecs, 0 );
|
* tweenoff. */
|
||||||
SCREENMAN->PostMessageToTopScreen( SM_AllDoneChoosing, fSecs ); // nofify parent that we're finished
|
fSecs += EXTRA_SLEEP_AFTER_TWEEN_OFF_SECONDS;
|
||||||
m_Menu.StopTimer();
|
fSecs = max( fSecs, 0 );
|
||||||
|
SCREENMAN->PostMessageToTopScreen( SM_AllDoneChoosing, fSecs ); // nofify parent that we're finished
|
||||||
|
m_Menu.StopTimer();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -375,44 +388,42 @@ bool ScreenSelectMaster::ChangePage( int iNewChoice )
|
|||||||
if( GAMESTATE->IsHumanPlayer(p) && m_bChosen[p] )
|
if( GAMESTATE->IsHumanPlayer(p) && m_bChosen[p] )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
float fSecs = 0;
|
|
||||||
|
|
||||||
if( SHARED_PREVIEW_AND_CURSOR )
|
if( SHARED_PREVIEW_AND_CURSOR )
|
||||||
{
|
{
|
||||||
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
|
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
|
||||||
fSecs = max( fSecs, COMMAND( m_sprCursor[i][0], "PreSwitchPage" ) );
|
COMMAND( m_sprCursor[i][0], "PreSwitchPage" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
|
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
if( GAMESTATE->IsHumanPlayer(p) )
|
if( GAMESTATE->IsHumanPlayer(p) )
|
||||||
fSecs = max( fSecs, COMMAND( m_sprCursor[i][p], "PreSwitchPage" ) );
|
COMMAND( m_sprCursor[i][p], "PreSwitchPage" );
|
||||||
}
|
}
|
||||||
|
|
||||||
const CString sIconAndExplanationCommand = ssprintf( "SwitchToPage%d", newPage+1 );
|
const CString sIconAndExplanationCommand = ssprintf( "SwitchToPage%d", newPage+1 );
|
||||||
|
|
||||||
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
|
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
|
||||||
for( int i=0; i<NUM_ICON_PARTS; i++ )
|
for( int i=0; i<NUM_ICON_PARTS; i++ )
|
||||||
fSecs = max( fSecs, COMMAND( m_sprIcon[i][c], sIconAndExplanationCommand ) );
|
COMMAND( m_sprIcon[i][c], sIconAndExplanationCommand );
|
||||||
|
|
||||||
if( SHARED_PREVIEW_AND_CURSOR )
|
if( SHARED_PREVIEW_AND_CURSOR )
|
||||||
{
|
{
|
||||||
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
||||||
fSecs = max( fSecs, COMMAND( m_sprPreview[i][m_iChoice[p]][0], "PreSwitchPage" ) );
|
COMMAND( m_sprPreview[i][m_iChoice[p]][0], "PreSwitchPage" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
if( GAMESTATE->IsPlayerEnabled(p) )
|
if( GAMESTATE->IsPlayerEnabled(p) )
|
||||||
fSecs = max( fSecs, COMMAND( m_sprPreview[i][m_iChoice[p]][p], "PreSwitchPage" ) );
|
COMMAND( m_sprPreview[i][m_iChoice[p]][p], "PreSwitchPage" );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int page=0; page<NUM_PAGES; page++ )
|
for( int page=0; page<NUM_PAGES; page++ )
|
||||||
{
|
{
|
||||||
fSecs = max( fSecs, COMMAND( m_sprExplanation[page], sIconAndExplanationCommand ) );
|
COMMAND( m_sprExplanation[page], sIconAndExplanationCommand );
|
||||||
fSecs = max( fSecs, COMMAND( m_sprMore[page], sIconAndExplanationCommand ) );
|
COMMAND( m_sprMore[page], sIconAndExplanationCommand );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -532,19 +543,17 @@ ScreenSelectMaster::Page ScreenSelectMaster::GetCurrentPage() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float ScreenSelectMaster::DoMenuStart( PlayerNumber pn )
|
void ScreenSelectMaster::DoMenuStart( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
if( m_bChosen[pn] == true )
|
if( m_bChosen[pn] == true )
|
||||||
return 0;
|
return;
|
||||||
m_bChosen[pn] = true;
|
m_bChosen[pn] = true;
|
||||||
|
|
||||||
float fSecs = 0;
|
|
||||||
for( int page=0; page<NUM_PAGES; page++ )
|
for( int page=0; page<NUM_PAGES; page++ )
|
||||||
fSecs = max( fSecs, OFF_COMMAND( m_sprMore[page] ) );
|
OFF_COMMAND( m_sprMore[page] );
|
||||||
|
|
||||||
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
|
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
|
||||||
fSecs = max( fSecs, COMMAND( m_sprCursor[i][pn], "Choose") );
|
COMMAND( m_sprCursor[i][pn], "Choose");
|
||||||
return fSecs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSelectMaster::MenuStart( PlayerNumber pn )
|
void ScreenSelectMaster::MenuStart( PlayerNumber pn )
|
||||||
@@ -558,7 +567,6 @@ void ScreenSelectMaster::MenuStart( PlayerNumber pn )
|
|||||||
m_soundSelect.Play();
|
m_soundSelect.Play();
|
||||||
|
|
||||||
bool bAllDone = true;
|
bool bAllDone = true;
|
||||||
float fSecs = 0;
|
|
||||||
if( SHARED_PREVIEW_AND_CURSOR || GetCurrentPage() == PAGE_2 )
|
if( SHARED_PREVIEW_AND_CURSOR || GetCurrentPage() == PAGE_2 )
|
||||||
{
|
{
|
||||||
/* Only one player has to pick. Choose this for all the other players, too. */
|
/* Only one player has to pick. Choose this for all the other players, too. */
|
||||||
@@ -566,10 +574,12 @@ void ScreenSelectMaster::MenuStart( PlayerNumber pn )
|
|||||||
if( GAMESTATE->IsHumanPlayer(p) )
|
if( GAMESTATE->IsHumanPlayer(p) )
|
||||||
{
|
{
|
||||||
ASSERT( !m_bChosen[p] );
|
ASSERT( !m_bChosen[p] );
|
||||||
fSecs = max( fSecs, DoMenuStart( (PlayerNumber)p ) );
|
DoMenuStart( (PlayerNumber)p );
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
fSecs = max( fSecs, DoMenuStart(pn) );
|
else
|
||||||
|
{
|
||||||
|
DoMenuStart(pn);
|
||||||
// check to see if everyone has chosen
|
// check to see if everyone has chosen
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
if( GAMESTATE->IsHumanPlayer((PlayerNumber)p) )
|
if( GAMESTATE->IsHumanPlayer((PlayerNumber)p) )
|
||||||
@@ -577,7 +587,7 @@ void ScreenSelectMaster::MenuStart( PlayerNumber pn )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( bAllDone )
|
if( bAllDone )
|
||||||
this->PostScreenMessage( SM_BeginFadingOut, fSecs );// tell our owner it's time to move on
|
this->PostScreenMessage( SM_BeginFadingOut, GetTweenTimeLeft() );// tell our owner it's time to move on
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -592,17 +602,15 @@ void ScreenSelectMaster::MenuStart( PlayerNumber pn )
|
|||||||
* This means that the focus command should be position neutral; eg. only use "addx",
|
* This means that the focus command should be position neutral; eg. only use "addx",
|
||||||
* not "x".
|
* not "x".
|
||||||
*/
|
*/
|
||||||
float ScreenSelectMaster::TweenOnScreen()
|
void ScreenSelectMaster::TweenOnScreen()
|
||||||
{
|
{
|
||||||
float fSecs = 0;
|
|
||||||
|
|
||||||
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
|
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
|
||||||
{
|
{
|
||||||
for( int i=0; i<NUM_ICON_PARTS; i++ )
|
for( int i=0; i<NUM_ICON_PARTS; i++ )
|
||||||
{
|
{
|
||||||
COMMAND( m_sprIcon[i][c], (int(c) == m_iChoice[0])? "GainFocus":"LoseFocus" );
|
COMMAND( m_sprIcon[i][c], (int(c) == m_iChoice[0])? "GainFocus":"LoseFocus" );
|
||||||
m_sprIcon[i][c]->FinishTweening();
|
m_sprIcon[i][c]->FinishTweening();
|
||||||
fSecs = max( fSecs, SET_XY_AND_ON_COMMAND( m_sprIcon[i][c] ) );
|
SET_XY_AND_ON_COMMAND( m_sprIcon[i][c] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( SHARED_PREVIEW_AND_CURSOR )
|
if( SHARED_PREVIEW_AND_CURSOR )
|
||||||
@@ -612,7 +620,7 @@ float ScreenSelectMaster::TweenOnScreen()
|
|||||||
{
|
{
|
||||||
COMMAND( m_sprPreview[i][c][p], (int(c) == m_iChoice[p])? "GainFocus":"LoseFocus" );
|
COMMAND( m_sprPreview[i][c][p], (int(c) == m_iChoice[p])? "GainFocus":"LoseFocus" );
|
||||||
m_sprPreview[i][c][p]->FinishTweening();
|
m_sprPreview[i][c][p]->FinishTweening();
|
||||||
fSecs = max( fSecs, SET_XY_AND_ON_COMMAND( m_sprPreview[i][c][p] ) );
|
SET_XY_AND_ON_COMMAND( m_sprPreview[i][c][p] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -623,7 +631,7 @@ float ScreenSelectMaster::TweenOnScreen()
|
|||||||
{
|
{
|
||||||
COMMAND( m_sprPreview[i][c][p], int(c) == m_iChoice[p]? "GainFocus":"LoseFocus" );
|
COMMAND( m_sprPreview[i][c][p], int(c) == m_iChoice[p]? "GainFocus":"LoseFocus" );
|
||||||
m_sprPreview[i][c][p]->FinishTweening();
|
m_sprPreview[i][c][p]->FinishTweening();
|
||||||
fSecs = max( fSecs, SET_XY_AND_ON_COMMAND( m_sprPreview[i][c][p] ) );
|
SET_XY_AND_ON_COMMAND( m_sprPreview[i][c][p] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -634,7 +642,7 @@ float ScreenSelectMaster::TweenOnScreen()
|
|||||||
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
|
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
|
||||||
{
|
{
|
||||||
m_sprCursor[i][0].SetXY( GetCursorX((PlayerNumber)0,i), GetCursorY((PlayerNumber)0,i) );
|
m_sprCursor[i][0].SetXY( GetCursorX((PlayerNumber)0,i), GetCursorY((PlayerNumber)0,i) );
|
||||||
fSecs = max( fSecs, ON_COMMAND( m_sprCursor[i][0] ) );
|
ON_COMMAND( m_sprCursor[i][0] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -644,7 +652,7 @@ float ScreenSelectMaster::TweenOnScreen()
|
|||||||
if( GAMESTATE->IsPlayerEnabled(p) )
|
if( GAMESTATE->IsPlayerEnabled(p) )
|
||||||
{
|
{
|
||||||
m_sprCursor[i][p].SetXY( GetCursorX((PlayerNumber)p,i), GetCursorY((PlayerNumber)p,i) );
|
m_sprCursor[i][p].SetXY( GetCursorX((PlayerNumber)p,i), GetCursorY((PlayerNumber)p,i) );
|
||||||
fSecs = max( fSecs, ON_COMMAND( m_sprCursor[i][p] ) );
|
ON_COMMAND( m_sprCursor[i][p] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,44 +661,40 @@ float ScreenSelectMaster::TweenOnScreen()
|
|||||||
if( SHARED_PREVIEW_AND_CURSOR )
|
if( SHARED_PREVIEW_AND_CURSOR )
|
||||||
{
|
{
|
||||||
m_Scroller[0].SetCurrentAndDestinationItem( m_iChoice[0] );
|
m_Scroller[0].SetCurrentAndDestinationItem( m_iChoice[0] );
|
||||||
fSecs = max( fSecs, SET_XY_AND_ON_COMMAND( m_Scroller[0] ) );
|
SET_XY_AND_ON_COMMAND( m_Scroller[0] );
|
||||||
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
|
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
|
||||||
fSecs = max( fSecs, COMMAND( *m_sprScroll[c][0], int(c) == m_iChoice[0]? "GainFocus":"LoseFocus" ) );
|
COMMAND( *m_sprScroll[c][0], int(c) == m_iChoice[0]? "GainFocus":"LoseFocus" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
if( GAMESTATE->IsPlayerEnabled(p) )
|
if( GAMESTATE->IsPlayerEnabled(p) )
|
||||||
{
|
{
|
||||||
m_Scroller[p].SetCurrentAndDestinationItem( m_iChoice[p] );
|
m_Scroller[p].SetCurrentAndDestinationItem( m_iChoice[p] );
|
||||||
fSecs = max( fSecs, SET_XY_AND_ON_COMMAND( m_Scroller[p] ) );
|
SET_XY_AND_ON_COMMAND( m_Scroller[p] );
|
||||||
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
|
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
|
||||||
fSecs = max( fSecs, COMMAND( *m_sprScroll[c][p], int(c) == m_iChoice[p]? "GainFocus":"LoseFocus" ) );
|
COMMAND( *m_sprScroll[c][p], int(c) == m_iChoice[p]? "GainFocus":"LoseFocus" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fSecs = max( fSecs, SET_XY_AND_ON_COMMAND( m_sprExplanation[GetCurrentPage()] ) );
|
SET_XY_AND_ON_COMMAND( m_sprExplanation[GetCurrentPage()] );
|
||||||
fSecs = max( fSecs, SET_XY_AND_ON_COMMAND( m_sprMore[GetCurrentPage()] ) );
|
SET_XY_AND_ON_COMMAND( m_sprMore[GetCurrentPage()] );
|
||||||
|
|
||||||
this->SortByZ();
|
this->SortByZ();
|
||||||
|
|
||||||
return fSecs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float ScreenSelectMaster::TweenOffScreen()
|
void ScreenSelectMaster::TweenOffScreen()
|
||||||
{
|
{
|
||||||
float fSecs = 0;
|
|
||||||
|
|
||||||
if( SHARED_PREVIEW_AND_CURSOR )
|
if( SHARED_PREVIEW_AND_CURSOR )
|
||||||
{
|
{
|
||||||
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
|
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
|
||||||
fSecs = max( fSecs, OFF_COMMAND( m_sprCursor[i][0] ) );
|
OFF_COMMAND( m_sprCursor[i][0] );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
|
for( int i=0; i<NUM_CURSOR_PARTS; i++ )
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
if( GAMESTATE->IsPlayerEnabled(p) )
|
if( GAMESTATE->IsPlayerEnabled(p) )
|
||||||
fSecs = max( fSecs, OFF_COMMAND( m_sprCursor[i][p] ) );
|
OFF_COMMAND( m_sprCursor[i][p] );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
|
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
|
||||||
@@ -711,8 +715,8 @@ float ScreenSelectMaster::TweenOffScreen()
|
|||||||
|
|
||||||
for( int i=0; i<NUM_ICON_PARTS; i++ )
|
for( int i=0; i<NUM_ICON_PARTS; i++ )
|
||||||
{
|
{
|
||||||
fSecs = max( fSecs, OFF_COMMAND( m_sprIcon[i][c] ) );
|
OFF_COMMAND( m_sprIcon[i][c] );
|
||||||
fSecs = max( fSecs, COMMAND( m_sprIcon[i][c], SelectedByEitherPlayer? "OffFocused":"OffUnfocused" ) );
|
COMMAND( m_sprIcon[i][c], SelectedByEitherPlayer? "OffFocused":"OffUnfocused" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -720,8 +724,8 @@ float ScreenSelectMaster::TweenOffScreen()
|
|||||||
{
|
{
|
||||||
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
||||||
{
|
{
|
||||||
fSecs = max( fSecs, OFF_COMMAND( m_sprPreview[i][c][0] ) );
|
OFF_COMMAND( m_sprPreview[i][c][0] );
|
||||||
fSecs = max( fSecs, COMMAND( m_sprPreview[i][c][0], SelectedByEitherPlayer? "OffFocused":"OffUnfocused" ) );
|
COMMAND( m_sprPreview[i][c][0], SelectedByEitherPlayer? "OffFocused":"OffUnfocused" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -730,8 +734,8 @@ float ScreenSelectMaster::TweenOffScreen()
|
|||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
if( GAMESTATE->IsPlayerEnabled(p) )
|
if( GAMESTATE->IsPlayerEnabled(p) )
|
||||||
{
|
{
|
||||||
fSecs = max( fSecs, OFF_COMMAND( m_sprPreview[i][c][p] ) );
|
OFF_COMMAND( m_sprPreview[i][c][p] );
|
||||||
fSecs = max( fSecs, COMMAND( m_sprPreview[i][c][0], SelectedByEitherPlayer? "OffFocused":"OffUnfocused" ) );
|
COMMAND( m_sprPreview[i][c][0], SelectedByEitherPlayer? "OffFocused":"OffUnfocused" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -739,16 +743,14 @@ float ScreenSelectMaster::TweenOffScreen()
|
|||||||
if( SHOW_SCROLLER )
|
if( SHOW_SCROLLER )
|
||||||
{
|
{
|
||||||
if( SHARED_PREVIEW_AND_CURSOR )
|
if( SHARED_PREVIEW_AND_CURSOR )
|
||||||
fSecs = max( fSecs, OFF_COMMAND( m_Scroller[0] ) );
|
OFF_COMMAND( m_Scroller[0] );
|
||||||
else
|
else
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
fSecs = max( fSecs, OFF_COMMAND( m_Scroller[p] ) );
|
OFF_COMMAND( m_Scroller[p] );
|
||||||
}
|
}
|
||||||
|
|
||||||
fSecs = max( fSecs, OFF_COMMAND( m_sprExplanation[GetCurrentPage()] ) );
|
OFF_COMMAND( m_sprExplanation[GetCurrentPage()] );
|
||||||
fSecs = max( fSecs, OFF_COMMAND( m_sprMore[GetCurrentPage()] ) );
|
OFF_COMMAND( m_sprMore[GetCurrentPage()] );
|
||||||
|
|
||||||
return fSecs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ public:
|
|||||||
virtual void MenuUp( PlayerNumber pn );
|
virtual void MenuUp( PlayerNumber pn );
|
||||||
virtual void MenuDown( PlayerNumber pn );
|
virtual void MenuDown( PlayerNumber pn );
|
||||||
virtual void MenuStart( PlayerNumber pn );
|
virtual void MenuStart( PlayerNumber pn );
|
||||||
float TweenOffScreen(); // return time in seconds to execute the command
|
void TweenOffScreen(); // return time in seconds to execute the command
|
||||||
float TweenOnScreen(); // return time in seconds to execute the command
|
void TweenOnScreen(); // return time in seconds to execute the command
|
||||||
|
|
||||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ protected:
|
|||||||
bool Move( PlayerNumber pn, Dirs dir );
|
bool Move( PlayerNumber pn, Dirs dir );
|
||||||
bool ChangePage( int iNewChoice );
|
bool ChangePage( int iNewChoice );
|
||||||
bool ChangeSelection( PlayerNumber pn, int iNewChoice );
|
bool ChangeSelection( PlayerNumber pn, int iNewChoice );
|
||||||
float DoMenuStart( PlayerNumber pn );
|
void DoMenuStart( PlayerNumber pn );
|
||||||
|
|
||||||
float GetCursorX( PlayerNumber pn, int iPartIndex );
|
float GetCursorX( PlayerNumber pn, int iPartIndex );
|
||||||
float GetCursorY( PlayerNumber pn, int iPartIndex );
|
float GetCursorY( PlayerNumber pn, int iPartIndex );
|
||||||
|
|||||||
@@ -288,6 +288,8 @@ try_element_again:
|
|||||||
RageException::Throw( message );
|
RageException::Throw( message );
|
||||||
break;
|
break;
|
||||||
case ArchHooks::retry:
|
case ArchHooks::retry:
|
||||||
|
FlushDirCache();
|
||||||
|
ReloadMetrics();
|
||||||
goto try_element_again;
|
goto try_element_again;
|
||||||
case ArchHooks::ignore:
|
case ArchHooks::ignore:
|
||||||
break;
|
break;
|
||||||
@@ -333,7 +335,11 @@ try_element_again:
|
|||||||
sPath.c_str(), sNewFileName.c_str());
|
sPath.c_str(), sNewFileName.c_str());
|
||||||
|
|
||||||
if( ArchHooks::retry == HOOKS->MessageBoxAbortRetryIgnore(message) )
|
if( ArchHooks::retry == HOOKS->MessageBoxAbortRetryIgnore(message) )
|
||||||
|
{
|
||||||
|
FlushDirCache();
|
||||||
|
ReloadMetrics();
|
||||||
goto try_element_again;
|
goto try_element_again;
|
||||||
|
}
|
||||||
|
|
||||||
RageException::Throw( "%s", message.c_str() );
|
RageException::Throw( "%s", message.c_str() );
|
||||||
}
|
}
|
||||||
@@ -353,12 +359,11 @@ CString ThemeManager::GetPathTo( ElementCategory category, CString sClassName, C
|
|||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Use HOOKS->MessageBox()
|
|
||||||
try_element_again:
|
try_element_again:
|
||||||
|
|
||||||
CString sBaseClass;
|
CString sFallback;
|
||||||
sBaseClass = "";
|
sFallback = "";
|
||||||
m_pIniMetrics->GetValue(sClassName,"BaseClass",sBaseClass);
|
m_pIniMetrics->GetValue(sClassName,"Fallback",sFallback);
|
||||||
|
|
||||||
// search the requested current theme and requested class
|
// search the requested current theme and requested class
|
||||||
CString ret = GetPathToRaw( m_sCurThemeName, category, sClassName, sElement);
|
CString ret = GetPathToRaw( m_sCurThemeName, category, sClassName, sElement);
|
||||||
@@ -368,10 +373,10 @@ try_element_again:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// search the requested current theme and base class
|
// search the requested current theme and fallback class
|
||||||
if( !sBaseClass.empty() )
|
if( !sFallback.empty() )
|
||||||
{
|
{
|
||||||
CString ret = GetPathToRaw( m_sCurThemeName, category, sBaseClass, sElement);
|
CString ret = GetPathToRaw( m_sCurThemeName, category, sFallback, sElement);
|
||||||
if( !ret.empty() ) // we found something
|
if( !ret.empty() ) // we found something
|
||||||
{
|
{
|
||||||
Cache[sFileName] = ret;
|
Cache[sFileName] = ret;
|
||||||
@@ -387,10 +392,10 @@ try_element_again:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// search the base theme and base class
|
// search the base theme and fallback class
|
||||||
if( !sBaseClass.empty() )
|
if( !sFallback.empty() )
|
||||||
{
|
{
|
||||||
ret = GetPathToRaw( BASE_THEME_NAME, category, sBaseClass, sElement);
|
ret = GetPathToRaw( BASE_THEME_NAME, category, sFallback, sElement);
|
||||||
if( !ret.empty() ) // we found something
|
if( !ret.empty() ) // we found something
|
||||||
{
|
{
|
||||||
Cache[sFileName] = ret;
|
Cache[sFileName] = ret;
|
||||||
@@ -408,6 +413,8 @@ try_element_again:
|
|||||||
|
|
||||||
/* We can't fall back on _missing in Other: the file types are unknown. */
|
/* We can't fall back on _missing in Other: the file types are unknown. */
|
||||||
CString sMessage = "The theme element '" + sCategory + "/" + sFileName +"' is missing.";
|
CString sMessage = "The theme element '" + sCategory + "/" + sFileName +"' is missing.";
|
||||||
|
if( !sFallback.empty() )
|
||||||
|
sMessage += " And it's fallback, '" + ClassAndElementToFileName(sFallback,sElement) + "' isn't present either.";
|
||||||
ArchHooks::MessageBoxResult res;
|
ArchHooks::MessageBoxResult res;
|
||||||
if( category != Other )
|
if( category != Other )
|
||||||
res = HOOKS->MessageBoxAbortRetryIgnore(sMessage, "MissingThemeElement");
|
res = HOOKS->MessageBoxAbortRetryIgnore(sMessage, "MissingThemeElement");
|
||||||
@@ -417,7 +424,7 @@ try_element_again:
|
|||||||
{
|
{
|
||||||
case ArchHooks::retry:
|
case ArchHooks::retry:
|
||||||
FlushDirCache();
|
FlushDirCache();
|
||||||
g_ThemePathCache[category].clear();
|
ReloadMetrics();
|
||||||
goto try_element_again;
|
goto try_element_again;
|
||||||
case ArchHooks::ignore:
|
case ArchHooks::ignore:
|
||||||
LOG->Warn(
|
LOG->Warn(
|
||||||
|
|||||||
@@ -61,7 +61,9 @@ MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID) {
|
|||||||
const RageDisplay::PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(pixfmt);
|
const RageDisplay::PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(pixfmt);
|
||||||
SDL_Surface *img = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, size, size, pfd->bpp, pfd->masks[0],
|
SDL_Surface *img = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, size, size, pfd->bpp, pfd->masks[0],
|
||||||
pfd->masks[1], pfd->masks[2], pfd->masks[3]);
|
pfd->masks[1], pfd->masks[2], pfd->masks[3]);
|
||||||
|
|
||||||
texHandle = DISPLAY->CreateTexture(pixfmt, img, false);
|
texHandle = DISPLAY->CreateTexture(pixfmt, img, false);
|
||||||
|
|
||||||
//DISPLAY->UpdateTexture(texHandle, img, 0, 0, size, size);
|
//DISPLAY->UpdateTexture(texHandle, img, 0, 0, size, size);
|
||||||
SDL_FreeSurface(img);
|
SDL_FreeSurface(img);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user