specify effect and transition in each background change
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
<ActorFrame><children>
|
||||||
|
<AutoActor File="@File1" />
|
||||||
|
</children></ActorFrame>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<ActorFrame><children>
|
||||||
|
<AutoActor File="@File1" OnCommand="x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM);zoomtowidth,SCREEN_WIDTH/2;zoomtoheight,SCREEN_HEIGHT/2" />
|
||||||
|
<AutoActor File="@File2" OnCommand="x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(1,0,4,SCREEN_TOP,SCREEN_BOTTOM);zoomtowidth,SCREEN_WIDTH/2;zoomtoheight,SCREEN_HEIGHT/2" />
|
||||||
|
<AutoActor File="@File2" OnCommand="x,scale(1,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM);zoomtowidth,SCREEN_WIDTH/2;zoomtoheight,SCREEN_HEIGHT/2" />
|
||||||
|
<AutoActor File="@File1" OnCommand="x,scale(3,0,4,SCREEN_LEFT,SCREEN_RIGHT);y,scale(3,0,4,SCREEN_TOP,SCREEN_BOTTOM);zoomtowidth,SCREEN_WIDTH/2;zoomtoheight,SCREEN_HEIGHT/2" />
|
||||||
|
</children></ActorFrame>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<ActorFrame><children>
|
||||||
|
<AutoActor File="@File1" OnCommand="x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomtowidth,SCREEN_WIDTH;zoomtoheight,SCREEN_HEIGHT" />
|
||||||
|
</children></ActorFrame>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<BackgroundTransition
|
||||||
|
LeavesCommand="stoptweening;linear,1.0;diffusealpha,0"
|
||||||
|
RootCommand=""
|
||||||
|
/>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<BackgroundTransition
|
||||||
|
LeavesCommand=""
|
||||||
|
RootCommand="stoptweening;linear,1.0;addx,SCREEN_WIDTH"
|
||||||
|
/>
|
||||||
+234
-174
@@ -20,8 +20,10 @@
|
|||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
#include "XmlFile.h"
|
||||||
|
|
||||||
const float FADE_SECONDS = 1.0f;
|
const CString BACKGROUND_EFFECTS_DIR = "BackgroundEffects/";
|
||||||
|
const CString BACKGROUND_TRANSITIONS_DIR = "BackgroundTransitions/";
|
||||||
|
|
||||||
ThemeMetric<float> LEFT_EDGE ("Background","LeftEdge");
|
ThemeMetric<float> LEFT_EDGE ("Background","LeftEdge");
|
||||||
ThemeMetric<float> TOP_EDGE ("Background","TopEdge");
|
ThemeMetric<float> TOP_EDGE ("Background","TopEdge");
|
||||||
@@ -33,8 +35,7 @@ ThemeMetric<bool> DANGER_ALL_IS_OPAQUE ("Background","DangerAllIsOpaque");
|
|||||||
ThemeMetric<apActorCommands> BRIGHTNESS_FADE_COMMAND ("Background","BrightnessFadeCommand");
|
ThemeMetric<apActorCommands> BRIGHTNESS_FADE_COMMAND ("Background","BrightnessFadeCommand");
|
||||||
ThemeMetric<float> CLAMP_OUTPUT_PERCENT ("Background","ClampOutputPercent");
|
ThemeMetric<float> CLAMP_OUTPUT_PERCENT ("Background","ClampOutputPercent");
|
||||||
|
|
||||||
static float g_fBackgroundCenterWidth = 40;
|
static float g_fBackgroundCenterWidth = 40; // What is this for? -Chris
|
||||||
const CString STATIC_BACKGROUND = "static background";
|
|
||||||
|
|
||||||
static RageColor GetBrightnessColor( float fBrightnessPercent )
|
static RageColor GetBrightnessColor( float fBrightnessPercent )
|
||||||
{
|
{
|
||||||
@@ -54,8 +55,9 @@ static RageColor GetBrightnessColor( float fBrightnessPercent )
|
|||||||
|
|
||||||
Background::Background()
|
Background::Background()
|
||||||
{
|
{
|
||||||
m_pDancingCharacters = NULL;
|
|
||||||
m_bInitted = false;
|
m_bInitted = false;
|
||||||
|
m_pDancingCharacters = NULL;
|
||||||
|
m_pSong = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Background::Layer::Layer()
|
Background::Layer::Layer()
|
||||||
@@ -71,6 +73,33 @@ void Background::Init()
|
|||||||
if( m_bInitted )
|
if( m_bInitted )
|
||||||
return;
|
return;
|
||||||
m_bInitted = true;
|
m_bInitted = true;
|
||||||
|
STATIC_BACKGROUND_DEF = BackgroundDef();
|
||||||
|
|
||||||
|
// load transitions
|
||||||
|
{
|
||||||
|
ASSERT( m_mapNameToTransition.empty() );
|
||||||
|
vector<CString> v;
|
||||||
|
GetDirListing( BACKGROUND_TRANSITIONS_DIR+"*.xml", v, false, true );
|
||||||
|
FOREACH( CString, v, sPath )
|
||||||
|
{
|
||||||
|
CString sThrowAway, sFilename;
|
||||||
|
splitpath( *sPath, sThrowAway, sFilename, sThrowAway );
|
||||||
|
XNode xml;
|
||||||
|
xml.LoadFromFile( *sPath );
|
||||||
|
ASSERT( xml.m_sName == "BackgroundTransition" );
|
||||||
|
BackgroundTransition &bgt = m_mapNameToTransition[sFilename];
|
||||||
|
|
||||||
|
CString sCmdLeaves;
|
||||||
|
bool bSuccess = xml.GetAttrValue( "LeavesCommand", sCmdLeaves );
|
||||||
|
ASSERT( bSuccess );
|
||||||
|
bgt.cmdLeaves = apActorCommands(new ActorCommands(sCmdLeaves) );
|
||||||
|
|
||||||
|
CString sCmdRoot;
|
||||||
|
bSuccess = xml.GetAttrValue( "RootCommand", sCmdRoot );
|
||||||
|
ASSERT( bSuccess );
|
||||||
|
bgt.cmdRoot = apActorCommands(new ActorCommands(sCmdRoot) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_DangerAll.LoadFromAniDir( THEME->GetPathB("ScreenGameplay","danger all") );
|
m_DangerAll.LoadFromAniDir( THEME->GetPathB("ScreenGameplay","danger all") );
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
@@ -127,7 +156,7 @@ void Background::Unload()
|
|||||||
|
|
||||||
void Background::Layer::Unload()
|
void Background::Layer::Unload()
|
||||||
{
|
{
|
||||||
for( map<CString,Actor*>::iterator iter = m_BGAnimations.begin();
|
for( map<BackgroundDef,Actor*>::iterator iter = m_BGAnimations.begin();
|
||||||
iter != m_BGAnimations.end();
|
iter != m_BGAnimations.end();
|
||||||
iter++ )
|
iter++ )
|
||||||
delete iter->second;
|
delete iter->second;
|
||||||
@@ -173,85 +202,108 @@ Actor *MakeMovie( const CString &sMoviePath )
|
|||||||
return pSprite;
|
return pSprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
Actor *Background::Layer::CreateSongBGA( const Song *pSong, CString sBGName ) const
|
bool Background::Layer::CreateBackground( const Song *pSong, const BackgroundDef &bd )
|
||||||
{
|
{
|
||||||
BGAnimation *pTempBGA;
|
// Resolve the background names
|
||||||
|
vector<CString> vsResolvedFile;
|
||||||
|
vsResolvedFile.push_back( bd.m_sFile1 );
|
||||||
|
vsResolvedFile.push_back( bd.m_sFile2 );
|
||||||
|
|
||||||
// Using aniseg.m_sBGName, search for the corresponding animation.
|
for( unsigned i=0; i<vsResolvedFile.size(); i++ )
|
||||||
// Look in this order: movies in song dir, BGAnims in song dir
|
{
|
||||||
// movies in RandomMovies dir, BGAnims in BGAnimsDir.
|
LUA->SetGlobal( ssprintf("File%d",i+1), CString() );
|
||||||
CStringArray asFiles;
|
|
||||||
|
CString &sResolvedFile = vsResolvedFile[0];
|
||||||
|
if( sResolvedFile.empty() )
|
||||||
|
{
|
||||||
|
if( i == 0 )
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look for vsFileToResolve[i] in:
|
||||||
|
// - song's dir
|
||||||
|
// - RandomMovies dir
|
||||||
|
// - BGAnimations dir.
|
||||||
|
CStringArray asMatches;
|
||||||
|
|
||||||
// Look for BGAnims in the song dir
|
// Look for BGAnims in the song dir
|
||||||
GetDirListing( pSong->GetSongDir()+sBGName, asFiles, true, true );
|
GetDirListing( sResolvedFile+"*", asMatches, false, true );
|
||||||
if( !asFiles.empty() )
|
if( asMatches.empty() ) GetDirListing( pSong->GetSongDir()+sResolvedFile+"*", asMatches, false, true );
|
||||||
{
|
if( asMatches.empty() ) GetDirListing( RANDOMMOVIES_DIR+sResolvedFile+"*", asMatches, false, true );
|
||||||
/* If default.xml exists, use the regular generic actor load. However,
|
if( asMatches.empty() ) GetDirListing( BG_ANIMS_DIR+sResolvedFile+"*", asMatches, false, true );
|
||||||
* if it's an old BGAnimation.ini, load it ourself so we can set bGeneric
|
|
||||||
* to false. */
|
|
||||||
if( DoesFileExist(asFiles[0] + "/default.xml") )
|
|
||||||
return ActorUtil::MakeActor( asFiles[0] );
|
|
||||||
|
|
||||||
pTempBGA = new BGAnimation;
|
if( !asMatches.empty() )
|
||||||
pTempBGA->LoadFromAniDir( asFiles[0], false );
|
|
||||||
return pTempBGA;
|
|
||||||
}
|
|
||||||
// Look for BG movies or static graphics in the song dir
|
|
||||||
GetDirListing( pSong->GetSongDir()+sBGName, asFiles, false, true );
|
|
||||||
if( !asFiles.empty() )
|
|
||||||
{
|
{
|
||||||
const CString sExt = GetExtension( asFiles[0]) ;
|
sResolvedFile = asMatches[0];
|
||||||
if( sExt.CompareNoCase("avi")==0 ||
|
|
||||||
sExt.CompareNoCase("mpg")==0 ||
|
|
||||||
sExt.CompareNoCase("mpeg")==0 )
|
|
||||||
{
|
|
||||||
return MakeMovie( asFiles[0] );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sprite *pSprite = new Sprite;
|
// If the main background file is missing. We failed.
|
||||||
pSprite->LoadBG( asFiles[0] );
|
if( i == 0 )
|
||||||
pSprite->StretchTo( FullScreenRectF );
|
return false;
|
||||||
return pSprite;
|
else
|
||||||
|
sResolvedFile = ThemeManager::GetBlankGraphicPath();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// Look for movies in the RandomMovies dir
|
|
||||||
GetDirListing( RANDOMMOVIES_DIR+sBGName, asFiles, false, true );
|
|
||||||
if( !asFiles.empty() )
|
|
||||||
return MakeMovie( asFiles[0] );
|
|
||||||
|
|
||||||
// Look for BGAnims in the BGAnims dir
|
LUA->SetGlobal( ssprintf("File%d",i+1), sResolvedFile );
|
||||||
GetDirListing( BG_ANIMS_DIR+sBGName, asFiles, true, true );
|
}
|
||||||
if( !asFiles.empty() )
|
|
||||||
|
CString sEffect = bd.m_sEffect;
|
||||||
|
if( sEffect.empty() )
|
||||||
{
|
{
|
||||||
Actor *pActor = ActorUtil::MakeActor( asFiles[0] );
|
FileType ft = ActorUtil::GetFileType(vsResolvedFile[0]);
|
||||||
|
switch( ft )
|
||||||
|
{
|
||||||
|
case FT_Bitmap:
|
||||||
|
case FT_Sprite:
|
||||||
|
case FT_Movie:
|
||||||
|
sEffect = StandardBackgroundEffectToString( SBE_Stretch );
|
||||||
|
break;
|
||||||
|
case FT_Actor:
|
||||||
|
case FT_Directory:
|
||||||
|
case FT_Xml:
|
||||||
|
case FT_Model:
|
||||||
|
sEffect = StandardBackgroundEffectToString( SBE_Centered );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ASSERT( !sEffect.empty() );
|
||||||
|
|
||||||
|
vector<CString> v;
|
||||||
|
GetDirListing( BACKGROUND_EFFECTS_DIR + sEffect+"*", v, false, true );
|
||||||
|
ASSERT( v.size()==1 );
|
||||||
|
CString sEffectFile = v[0];
|
||||||
|
|
||||||
|
Actor *pActor = ActorUtil::MakeActor( sEffectFile );
|
||||||
ASSERT( pActor );
|
ASSERT( pActor );
|
||||||
return pActor;
|
m_BGAnimations[bd] = pActor;
|
||||||
|
|
||||||
|
for( unsigned i=0; i<vsResolvedFile.size(); i++ )
|
||||||
|
LUA->SetGlobal( ssprintf("File%d",i+1), CString() );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for BGAnims in the BGAnims dir
|
BackgroundDef Background::Layer::CreateRandomBGA( const Song *pSong, CString sPreferredSubDir )
|
||||||
GetDirListing( VISUALIZATIONS_DIR+sBGName, asFiles, false, true );
|
|
||||||
if( !asFiles.empty() )
|
|
||||||
return MakeVisualization( asFiles[0] );
|
|
||||||
|
|
||||||
// There is no background by this name.
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
CString Background::Layer::CreateRandomBGA( const Song *pSong, CString sPreferredSubDir )
|
|
||||||
{
|
{
|
||||||
if( sPreferredSubDir.Right(1) != "/" )
|
if( sPreferredSubDir.Right(1) != "/" )
|
||||||
sPreferredSubDir += '/';
|
sPreferredSubDir += '/';
|
||||||
|
|
||||||
if( PREFSMAN->m_BackgroundMode == PrefsManager::BGMODE_OFF )
|
if( PREFSMAN->m_BackgroundMode == PrefsManager::BGMODE_OFF )
|
||||||
return "";
|
{
|
||||||
|
return BackgroundDef();
|
||||||
|
}
|
||||||
|
|
||||||
/* If we already have enough random BGAs loaded, use them round-robin. */
|
/* If we already have enough random BGAs loaded, use them round-robin. */
|
||||||
if( (int)m_RandomBGAnimations.size() >= PREFSMAN->m_iNumBackgrounds )
|
if( (int)m_RandomBGAnimations.size() >= PREFSMAN->m_iNumBackgrounds )
|
||||||
{
|
{
|
||||||
/* XXX: every time we fully loop, shuffle, so we don't play the same sequence
|
/* XXX: every time we fully loop, shuffle, so we don't play the same sequence
|
||||||
* over and over; and nudge the shuffle so the next one won't be a repeat */
|
* over and over; and nudge the shuffle so the next one won't be a repeat */
|
||||||
const CString first = m_RandomBGAnimations.front();
|
BackgroundDef first = m_RandomBGAnimations.front();
|
||||||
m_RandomBGAnimations.push_back( m_RandomBGAnimations.front() );
|
m_RandomBGAnimations.push_back( m_RandomBGAnimations.front() );
|
||||||
m_RandomBGAnimations.pop_front();
|
m_RandomBGAnimations.pop_front();
|
||||||
return first;
|
return first;
|
||||||
@@ -270,12 +322,6 @@ CString Background::Layer::CreateRandomBGA( const Song *pSong, CString sPreferre
|
|||||||
GetDirListing( BG_ANIMS_DIR + sPreferredSubDir + "*", arrayPaths, true, true );
|
GetDirListing( BG_ANIMS_DIR + sPreferredSubDir + "*", arrayPaths, true, true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PrefsManager::BGMODE_MOVIEVIS:
|
|
||||||
GetDirListing( VISUALIZATIONS_DIR + sPreferredSubDir + "*.avi", arrayPaths, false, true );
|
|
||||||
GetDirListing( VISUALIZATIONS_DIR + sPreferredSubDir + "*.mpg", arrayPaths, false, true );
|
|
||||||
GetDirListing( VISUALIZATIONS_DIR + sPreferredSubDir + "*.mpeg", arrayPaths, false, true );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PrefsManager::BGMODE_RANDOMMOVIES:
|
case PrefsManager::BGMODE_RANDOMMOVIES:
|
||||||
GetDirListing( RANDOMMOVIES_DIR + sPreferredSubDir + "*.avi", arrayPaths, false, true );
|
GetDirListing( RANDOMMOVIES_DIR + sPreferredSubDir + "*.avi", arrayPaths, false, true );
|
||||||
GetDirListing( RANDOMMOVIES_DIR + sPreferredSubDir + "*.mpg", arrayPaths, false, true );
|
GetDirListing( RANDOMMOVIES_DIR + sPreferredSubDir + "*.mpg", arrayPaths, false, true );
|
||||||
@@ -296,61 +342,61 @@ CString Background::Layer::CreateRandomBGA( const Song *pSong, CString sPreferre
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( arrayPaths.empty() )
|
if( arrayPaths.empty() )
|
||||||
return "";
|
return BackgroundDef();
|
||||||
|
|
||||||
random_shuffle( arrayPaths.begin(), arrayPaths.end() );
|
random_shuffle( arrayPaths.begin(), arrayPaths.end() );
|
||||||
|
|
||||||
/* Find the first file in arrayPaths we havn't already loaded. */
|
/* Find the first BackgroundDef in arrayPaths we havn't already loaded. */
|
||||||
CString file;
|
BackgroundDef bd;
|
||||||
{
|
{
|
||||||
set<CString> loaded;
|
// copy into set for easy lookup
|
||||||
unsigned i;
|
set<BackgroundDef> loaded;
|
||||||
for( i = 0; i < m_RandomBGAnimations.size(); ++i )
|
for( unsigned i = 0; i < m_RandomBGAnimations.size(); ++i )
|
||||||
loaded.insert( m_RandomBGAnimations[i] );
|
loaded.insert( m_RandomBGAnimations[i] );
|
||||||
|
|
||||||
i = 0;
|
bool bFound = false;
|
||||||
while( i < arrayPaths.size() && loaded.find( arrayPaths[i] ) != loaded.end() )
|
FOREACH_CONST( CString, arrayPaths, p )
|
||||||
++i;
|
|
||||||
if( i == arrayPaths.size() )
|
|
||||||
return "";
|
|
||||||
|
|
||||||
file = arrayPaths[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
Actor *ret;
|
|
||||||
switch( PREFSMAN->m_BackgroundMode )
|
|
||||||
{
|
{
|
||||||
case PrefsManager::BGMODE_ANIMATIONS:
|
FOREACHD_CONST( BackgroundDef, m_RandomBGAnimations, b )
|
||||||
{
|
{
|
||||||
BGAnimation *p = new BGAnimation;
|
if( b->m_sFile1 == *p )
|
||||||
p->LoadFromAniDir( file );
|
{
|
||||||
ret = p;
|
bd.m_sFile1 = *p;
|
||||||
|
bFound = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PrefsManager::BGMODE_MOVIEVIS: ret = MakeVisualization( file ); break;
|
}
|
||||||
case PrefsManager::BGMODE_RANDOMMOVIES: ret = MakeMovie( file ); break;
|
if( bFound )
|
||||||
default: FAIL_M( ssprintf("%i", (int) PREFSMAN->m_BackgroundMode) );
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_BGAnimations[file] = ret;
|
if( !bFound )
|
||||||
m_RandomBGAnimations.push_back( file );
|
return BackgroundDef();
|
||||||
return file;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Background::LoadFromRandom( float fFirstBeat, float fLastBeat, const TimingData &timing, CString sPreferredSubDir )
|
bool bSuccess = CreateBackground( pSong, bd );
|
||||||
|
ASSERT( bSuccess ); // we fed it valid files, so this shouldn't fail
|
||||||
|
m_RandomBGAnimations.push_back( bd );
|
||||||
|
return bd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Background::LoadFromRandom( float fFirstBeat, float fLastBeat )
|
||||||
{
|
{
|
||||||
|
const TimingData &timing = m_pSong->m_Timing;
|
||||||
|
const CString &sPreferredSubDir = m_pSong->m_sGroupName;
|
||||||
|
|
||||||
// change BG every 4 bars
|
// change BG every 4 bars
|
||||||
for( float f=fFirstBeat; f<fLastBeat; f+=BEATS_PER_MEASURE*4 )
|
for( float f=fFirstBeat; f<fLastBeat; f+=BEATS_PER_MEASURE*4 )
|
||||||
{
|
{
|
||||||
// Don't fade. It causes frame rate dip, especially on
|
// Don't fade. It causes frame rate dip, especially on slower machines.
|
||||||
// slower machines.
|
BackgroundDef bd = m_Layer[0].CreateRandomBGA( m_pSong, sPreferredSubDir );
|
||||||
bool bFade = false;
|
if( !bd.IsEmpty() )
|
||||||
//bool bFade = PREFSMAN->m_BackgroundMode==PrefsManager::BGMODE_RANDOMMOVIES ||
|
{
|
||||||
// PREFSMAN->m_BackgroundMode==PrefsManager::BGMODE_MOVIEVIS;
|
BackgroundChange change;
|
||||||
|
(BackgroundDef&)change = bd;
|
||||||
CString sBGName = m_Layer[0].CreateRandomBGA( m_pSong, sPreferredSubDir );
|
change.m_fStartBeat = f;
|
||||||
if( sBGName != "" )
|
m_Layer[0].m_aBGChanges.push_back( change );
|
||||||
m_Layer[0].m_aBGChanges.push_back( BackgroundChange(f,sBGName,1.f,bFade) );
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// change BG every BPM change that is at the beginning of a measure
|
// change BG every BPM change that is at the beginning of a measure
|
||||||
@@ -366,9 +412,14 @@ void Background::LoadFromRandom( float fFirstBeat, float fLastBeat, const Timing
|
|||||||
if( bpmseg.m_iStartIndex < iStartIndex || bpmseg.m_iStartIndex > iEndIndex )
|
if( bpmseg.m_iStartIndex < iStartIndex || bpmseg.m_iStartIndex > iEndIndex )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
CString sBGName = m_Layer[0].CreateRandomBGA( m_pSong, sPreferredSubDir );
|
BackgroundDef bd = m_Layer[0].CreateRandomBGA( m_pSong, sPreferredSubDir );
|
||||||
if( sBGName != "" )
|
if( !bd.IsEmpty() )
|
||||||
m_Layer[0].m_aBGChanges.push_back( BackgroundChange(NoteRowToBeat(bpmseg.m_iStartIndex),sBGName) );
|
{
|
||||||
|
BackgroundChange change;
|
||||||
|
(BackgroundDef&)change = bd;
|
||||||
|
change.m_fStartBeat = NoteRowToBeat(bpmseg.m_iStartIndex);
|
||||||
|
m_Layer[0].m_aBGChanges.push_back( change );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,6 +431,8 @@ void Background::LoadFromSong( const Song* pSong )
|
|||||||
|
|
||||||
m_pSong = pSong;
|
m_pSong = pSong;
|
||||||
|
|
||||||
|
STATIC_BACKGROUND_DEF.m_sFile1 = m_pSong->HasBackground() ? m_pSong->GetBackgroundPath() : THEME->GetPathG("Common","fallback background");
|
||||||
|
|
||||||
if( PREFSMAN->m_fBGBrightness == 0.0f )
|
if( PREFSMAN->m_fBGBrightness == 0.0f )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -405,22 +458,22 @@ void Background::LoadFromSong( const Song* pSong )
|
|||||||
FOREACH_CONST( BackgroundChange, pSong->m_BackgroundChanges[i], bgc )
|
FOREACH_CONST( BackgroundChange, pSong->m_BackgroundChanges[i], bgc )
|
||||||
{
|
{
|
||||||
BackgroundChange change = *bgc;
|
BackgroundChange change = *bgc;
|
||||||
CString &sBGName = change.m_sBGName;
|
BackgroundDef &bd = change;
|
||||||
|
|
||||||
bool bIsAlreadyLoaded = layer.m_BGAnimations.find(sBGName) != layer.m_BGAnimations.end();
|
bool bIsAlreadyLoaded = layer.m_BGAnimations.find(bd) != layer.m_BGAnimations.end();
|
||||||
|
|
||||||
if( sBGName.CompareNoCase("-random-")!=0 && !bIsAlreadyLoaded )
|
if( bd.m_sFile1.CompareNoCase(RANDOM_BACKGROUND_FILE)!=0 && !bIsAlreadyLoaded )
|
||||||
{
|
{
|
||||||
Actor *pTempBGA = layer.CreateSongBGA( m_pSong, sBGName );
|
if( layer.CreateBackground( m_pSong, bd ) )
|
||||||
if( pTempBGA )
|
|
||||||
{
|
{
|
||||||
layer.m_BGAnimations[sBGName] = pTempBGA;
|
; // do nothing. Create was successful.
|
||||||
}
|
}
|
||||||
else // the background was not found. Use a random one instead
|
else
|
||||||
{
|
{
|
||||||
sBGName = layer.CreateRandomBGA( pSong, pSong->m_sGroupName );
|
// The background was not found. Try to use a random one instead.
|
||||||
if( sBGName == "" )
|
bd = layer.CreateRandomBGA( pSong, pSong->m_sGroupName );
|
||||||
sBGName = STATIC_BACKGROUND;
|
if( bd.IsEmpty() )
|
||||||
|
bd = STATIC_BACKGROUND_DEF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,10 +485,13 @@ void Background::LoadFromSong( const Song* pSong )
|
|||||||
{
|
{
|
||||||
Layer &layer = m_Layer[0];
|
Layer &layer = m_Layer[0];
|
||||||
|
|
||||||
LoadFromRandom( pSong->m_fFirstBeat, pSong->m_fLastBeat, pSong->m_Timing, pSong->m_sGroupName );
|
LoadFromRandom( pSong->m_fFirstBeat, pSong->m_fLastBeat );
|
||||||
|
|
||||||
// end showing the static song background
|
// end showing the static song background
|
||||||
layer.m_aBGChanges.push_back( BackgroundChange(pSong->m_fLastBeat,STATIC_BACKGROUND) );
|
BackgroundChange change;
|
||||||
|
(BackgroundDef&)change = STATIC_BACKGROUND_DEF;
|
||||||
|
change.m_fStartBeat = pSong->m_fLastBeat;
|
||||||
|
layer.m_aBGChanges.push_back( change );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -453,21 +509,25 @@ void Background::LoadFromSong( const Song* pSong )
|
|||||||
/* If the first BGAnimation isn't negative, add a lead-in image showing the song
|
/* If the first BGAnimation isn't negative, add a lead-in image showing the song
|
||||||
* background. */
|
* background. */
|
||||||
if( mainlayer.m_aBGChanges.empty() || mainlayer.m_aBGChanges.front().m_fStartBeat >= 0 )
|
if( mainlayer.m_aBGChanges.empty() || mainlayer.m_aBGChanges.front().m_fStartBeat >= 0 )
|
||||||
mainlayer.m_aBGChanges.insert( mainlayer.m_aBGChanges.begin(), BackgroundChange(-10000,STATIC_BACKGROUND) );
|
{
|
||||||
|
BackgroundChange change;
|
||||||
|
(BackgroundDef&)change = STATIC_BACKGROUND_DEF;
|
||||||
|
change.m_fStartBeat = -10000;
|
||||||
|
mainlayer.m_aBGChanges.insert( mainlayer.m_aBGChanges.begin(), change );
|
||||||
|
}
|
||||||
|
|
||||||
// If any BGChanges use the background image, load it.
|
// If any BGChanges use the background image, load it.
|
||||||
bool bStaticBackgroundUsed = false;
|
bool bStaticBackgroundUsed = false;
|
||||||
for( unsigned i=0; i<mainlayer.m_aBGChanges.size(); i++ )
|
FOREACH_CONST( BackgroundChange, mainlayer.m_aBGChanges, bgc )
|
||||||
if( mainlayer.m_aBGChanges[i].m_sBGName == STATIC_BACKGROUND )
|
{
|
||||||
|
const BackgroundDef &bd = *bgc;
|
||||||
|
if( bd == STATIC_BACKGROUND_DEF )
|
||||||
bStaticBackgroundUsed = true;
|
bStaticBackgroundUsed = true;
|
||||||
|
}
|
||||||
if( bStaticBackgroundUsed )
|
if( bStaticBackgroundUsed )
|
||||||
{
|
{
|
||||||
CString sSongBGPath =
|
bool bSuccess = mainlayer.CreateBackground( m_pSong, STATIC_BACKGROUND_DEF );
|
||||||
pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathG("Common","fallback background");
|
ASSERT( bSuccess );
|
||||||
Sprite* pSprite = new Sprite;
|
|
||||||
pSprite->LoadBG( sSongBGPath );
|
|
||||||
pSprite->StretchTo( FullScreenRectF );
|
|
||||||
mainlayer.m_BGAnimations[STATIC_BACKGROUND] = pSprite;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -475,7 +535,7 @@ void Background::LoadFromSong( const Song* pSong )
|
|||||||
for( unsigned i=0; i<mainlayer.m_aBGChanges.size(); i++ )
|
for( unsigned i=0; i<mainlayer.m_aBGChanges.size(); i++ )
|
||||||
{
|
{
|
||||||
BackgroundChange &change = mainlayer.m_aBGChanges[i];
|
BackgroundChange &change = mainlayer.m_aBGChanges[i];
|
||||||
if( change.m_sBGName.CompareNoCase("-random-") )
|
if( change.m_sFile1.CompareNoCase(RANDOM_BACKGROUND_FILE) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const float fStartBeat = change.m_fStartBeat;
|
const float fStartBeat = change.m_fStartBeat;
|
||||||
@@ -484,12 +544,12 @@ void Background::LoadFromSong( const Song* pSong )
|
|||||||
mainlayer.m_aBGChanges.erase( mainlayer.m_aBGChanges.begin()+i );
|
mainlayer.m_aBGChanges.erase( mainlayer.m_aBGChanges.begin()+i );
|
||||||
--i;
|
--i;
|
||||||
|
|
||||||
LoadFromRandom( fStartBeat, fLastBeat, pSong->m_Timing, pSong->m_sGroupName );
|
LoadFromRandom( fStartBeat, fLastBeat );
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point, we shouldn't have any BGChanges to "". "" is an invalid name.
|
// At this point, we shouldn't have any BGChanges to "". "" is an invalid name.
|
||||||
for( unsigned i=0; i<mainlayer.m_aBGChanges.size(); i++ )
|
for( unsigned i=0; i<mainlayer.m_aBGChanges.size(); i++ )
|
||||||
ASSERT( !mainlayer.m_aBGChanges[i].m_sBGName.empty() );
|
ASSERT( !mainlayer.m_aBGChanges[i].m_sFile1.empty() );
|
||||||
|
|
||||||
|
|
||||||
// Re-sort.
|
// Re-sort.
|
||||||
@@ -525,8 +585,7 @@ void Background::LoadFromSong( const Song* pSong )
|
|||||||
* which sync from the regular clock by default. If you don't want this, set
|
* which sync from the regular clock by default. If you don't want this, set
|
||||||
* the clock back with "effectclock,timer" in your OnCommand. Note that at this
|
* the clock back with "effectclock,timer" in your OnCommand. Note that at this
|
||||||
* point, we havn't run the OnCommand yet, so it'll override correctly. */
|
* point, we havn't run the OnCommand yet, so it'll override correctly. */
|
||||||
map<CString,Actor*>::iterator it;
|
FOREACHM( BackgroundDef, Actor*, mainlayer.m_BGAnimations, it )
|
||||||
for( it = mainlayer.m_BGAnimations.begin(); it != mainlayer.m_BGAnimations.end(); ++it )
|
|
||||||
{
|
{
|
||||||
Actor *pBGA = it->second;
|
Actor *pBGA = it->second;
|
||||||
|
|
||||||
@@ -558,7 +617,7 @@ int Background::Layer::FindBGSegmentForBeat( float fBeat ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If the BG segment has changed, move focus to it. Send Update() calls. */
|
/* If the BG segment has changed, move focus to it. Send Update() calls. */
|
||||||
void Background::Layer::UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime )
|
void Background::Layer::UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const map<CString,BackgroundTransition> &mapNameToTransition )
|
||||||
{
|
{
|
||||||
ASSERT( fCurrentTime != GameState::MUSIC_SECONDS_INVALID );
|
ASSERT( fCurrentTime != GameState::MUSIC_SECONDS_INVALID );
|
||||||
|
|
||||||
@@ -575,6 +634,7 @@ void Background::Layer::UpdateCurBGChange( const Song *pSong, float fLastMusicSe
|
|||||||
// Find the BGSegment we're in
|
// Find the BGSegment we're in
|
||||||
const int i = FindBGSegmentForBeat( fBeat );
|
const int i = FindBGSegmentForBeat( fBeat );
|
||||||
|
|
||||||
|
float fDeltaTime = fCurrentTime - fLastMusicSeconds;
|
||||||
if( i != -1 && i != m_iCurBGChangeIndex ) // we're changing backgrounds
|
if( i != -1 && i != m_iCurBGChangeIndex ) // we're changing backgrounds
|
||||||
{
|
{
|
||||||
LOG->Trace( "old bga %d -> new bga %d, %f, %f", m_iCurBGChangeIndex, i, m_aBGChanges[i].m_fStartBeat, fBeat );
|
LOG->Trace( "old bga %d -> new bga %d, %f, %f", m_iCurBGChangeIndex, i, m_aBGChanges[i].m_fStartBeat, fBeat );
|
||||||
@@ -583,51 +643,65 @@ void Background::Layer::UpdateCurBGChange( const Song *pSong, float fLastMusicSe
|
|||||||
|
|
||||||
const BackgroundChange& change = m_aBGChanges[i];
|
const BackgroundChange& change = m_aBGChanges[i];
|
||||||
|
|
||||||
Actor *pOld = m_pCurrentBGA;
|
|
||||||
|
|
||||||
if( change.m_bFadeLast )
|
|
||||||
m_pFadingBGA = m_pCurrentBGA;
|
m_pFadingBGA = m_pCurrentBGA;
|
||||||
else
|
|
||||||
|
m_pCurrentBGA = m_BGAnimations[ (BackgroundDef)change ];
|
||||||
|
|
||||||
|
if( m_pFadingBGA == m_pCurrentBGA )
|
||||||
|
{
|
||||||
m_pFadingBGA = NULL;
|
m_pFadingBGA = NULL;
|
||||||
|
LOG->Trace( "bg didn't actually change. Ignoring." );
|
||||||
m_pCurrentBGA = m_BGAnimations[ change.m_sBGName ];
|
m_fSecsLeftInFade = 0;
|
||||||
|
|
||||||
if( pOld )
|
|
||||||
{
|
|
||||||
pOld->LoseFocus();
|
|
||||||
pOld->PlayCommand( "LoseFocus" );
|
|
||||||
}
|
}
|
||||||
if( m_pCurrentBGA )
|
else
|
||||||
{
|
{
|
||||||
|
if( m_pFadingBGA )
|
||||||
|
{
|
||||||
|
m_pFadingBGA->LoseFocus();
|
||||||
|
m_pFadingBGA->PlayCommand( "LoseFocus" );
|
||||||
|
|
||||||
|
if( !change.m_sTransition.empty() )
|
||||||
|
{
|
||||||
|
map<CString,BackgroundTransition>::const_iterator iter = mapNameToTransition.find( change.m_sTransition );
|
||||||
|
ASSERT( iter != mapNameToTransition.end() );
|
||||||
|
const BackgroundTransition &bt = iter->second;
|
||||||
|
m_pFadingBGA->RunCommandsOnLeaves( *bt.cmdLeaves );
|
||||||
|
m_pFadingBGA->RunCommands( *bt.cmdRoot );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pCurrentBGA->Reset();
|
||||||
m_pCurrentBGA->GainFocus( change.m_fRate, change.m_bRewindMovie, change.m_bLoop );
|
m_pCurrentBGA->GainFocus( change.m_fRate, change.m_bRewindMovie, change.m_bLoop );
|
||||||
m_pCurrentBGA->PlayCommand( "On" );
|
m_pCurrentBGA->PlayCommand( "On" );
|
||||||
m_pCurrentBGA->PlayCommand( "GainFocus" );
|
m_pCurrentBGA->PlayCommand( "GainFocus" );
|
||||||
}
|
|
||||||
|
|
||||||
m_fSecsLeftInFade = m_pFadingBGA!=NULL ? FADE_SECONDS : 0;
|
m_fSecsLeftInFade = m_pFadingBGA ? m_pFadingBGA->GetTweenTimeLeft() : 0;
|
||||||
|
|
||||||
/* How much time of this BGA have we skipped? (This happens with SetSeconds.) */
|
/* How much time of this BGA have we skipped? (This happens with SetSeconds.) */
|
||||||
const float fStartSecond = pSong->m_Timing.GetElapsedTimeFromBeat( change.m_fStartBeat );
|
const float fStartSecond = pSong->m_Timing.GetElapsedTimeFromBeat( change.m_fStartBeat );
|
||||||
|
|
||||||
/* This is affected by the music rate. */
|
/* This is affected by the music rate. */
|
||||||
float fDeltaTime = fCurrentTime - fStartSecond;
|
fDeltaTime = fCurrentTime - fStartSecond;
|
||||||
fDeltaTime /= fRate;
|
|
||||||
if( m_pCurrentBGA )
|
|
||||||
m_pCurrentBGA->Update( max( fDeltaTime, 0 ) );
|
|
||||||
}
|
}
|
||||||
else // we're not changing backgrounds
|
|
||||||
{
|
|
||||||
/* This is affected by the music rate. */
|
|
||||||
float fDeltaTime = fCurrentTime - fLastMusicSeconds;
|
|
||||||
fDeltaTime /= fRate;
|
|
||||||
if( m_pCurrentBGA )
|
|
||||||
m_pCurrentBGA->Update( max( fDeltaTime, 0 ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float fDeltaTime = fCurrentTime - fLastMusicSeconds;
|
|
||||||
fDeltaTime /= fRate;
|
|
||||||
if( m_pFadingBGA )
|
if( m_pFadingBGA )
|
||||||
m_pFadingBGA->Update( max( fCurrentTime - fLastMusicSeconds, 0 ) );
|
{
|
||||||
|
m_fSecsLeftInFade -= fDeltaTime;
|
||||||
|
if( m_fSecsLeftInFade < 0 )
|
||||||
|
{
|
||||||
|
m_fSecsLeftInFade = 0;
|
||||||
|
m_pFadingBGA = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is affected by the music rate. */
|
||||||
|
float fDeltaTimeMusicRate = max( fDeltaTime / fRate, 0 );
|
||||||
|
|
||||||
|
if( m_pCurrentBGA )
|
||||||
|
m_pCurrentBGA->Update( fDeltaTimeMusicRate );
|
||||||
|
if( m_pFadingBGA )
|
||||||
|
m_pFadingBGA->Update( fDeltaTimeMusicRate );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Background::Update( float fDeltaTime )
|
void Background::Update( float fDeltaTime )
|
||||||
@@ -658,21 +732,7 @@ void Background::Update( float fDeltaTime )
|
|||||||
for( int i=0; i<NUM_BACKGROUND_LAYERS; i++ )
|
for( int i=0; i<NUM_BACKGROUND_LAYERS; i++ )
|
||||||
{
|
{
|
||||||
Layer &layer = m_Layer[i];
|
Layer &layer = m_Layer[i];
|
||||||
layer.UpdateCurBGChange( m_pSong, m_fLastMusicSeconds, GAMESTATE->m_fMusicSeconds );
|
layer.UpdateCurBGChange( m_pSong, m_fLastMusicSeconds, GAMESTATE->m_fMusicSeconds, m_mapNameToTransition );
|
||||||
|
|
||||||
if( layer.m_pFadingBGA )
|
|
||||||
{
|
|
||||||
layer.m_pFadingBGA->Update( fDeltaTime );
|
|
||||||
layer.m_fSecsLeftInFade -= fDeltaTime;
|
|
||||||
float fPercentOpaque = layer.m_fSecsLeftInFade / FADE_SECONDS;
|
|
||||||
layer.m_pFadingBGA->SetDiffuse( RageColor(1,1,1,fPercentOpaque) );
|
|
||||||
if( fPercentOpaque <= 0 )
|
|
||||||
{
|
|
||||||
/* Reset its diffuse color, in case we reuse it. */
|
|
||||||
layer.m_pFadingBGA->SetDiffuse( RageColor(1,1,1,1) );
|
|
||||||
layer.m_pFadingBGA = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
m_fLastMusicSeconds = GAMESTATE->m_fMusicSeconds;
|
m_fLastMusicSeconds = GAMESTATE->m_fMusicSeconds;
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-11
@@ -28,6 +28,12 @@ private:
|
|||||||
Quad m_quadBGBrightnessFade;
|
Quad m_quadBGBrightnessFade;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct BackgroundTransition
|
||||||
|
{
|
||||||
|
apActorCommands cmdLeaves;
|
||||||
|
apActorCommands cmdRoot;
|
||||||
|
};
|
||||||
|
|
||||||
class Background : public ActorFrame
|
class Background : public ActorFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -47,13 +53,13 @@ public:
|
|||||||
DancingCharacters* GetDancingCharacters() { return m_pDancingCharacters; };
|
DancingCharacters* GetDancingCharacters() { return m_pDancingCharacters; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const Song *m_pSong;
|
|
||||||
void LoadFromRandom( float fFirstBeat, float fLastBeat, const TimingData &timing, CString sPreferredSubDir );
|
|
||||||
|
|
||||||
bool IsDangerAllVisible();
|
|
||||||
|
|
||||||
bool m_bInitted;
|
bool m_bInitted;
|
||||||
DancingCharacters* m_pDancingCharacters;
|
DancingCharacters* m_pDancingCharacters;
|
||||||
|
const Song *m_pSong;
|
||||||
|
map<CString,BackgroundTransition> m_mapNameToTransition;
|
||||||
|
|
||||||
|
void LoadFromRandom( float fFirstBeat, float fLastBeat );
|
||||||
|
bool IsDangerAllVisible();
|
||||||
|
|
||||||
class Layer
|
class Layer
|
||||||
{
|
{
|
||||||
@@ -61,13 +67,16 @@ protected:
|
|||||||
Layer();
|
Layer();
|
||||||
void Unload();
|
void Unload();
|
||||||
|
|
||||||
Actor *CreateSongBGA( const Song *pSong, CString sBGName ) const;
|
// return true if created and added to m_BGAnimations
|
||||||
CString CreateRandomBGA( const Song *pSong, CString sPreferredSubDir );
|
bool CreateBackground( const Song *pSong, const BackgroundDef &bd );
|
||||||
int FindBGSegmentForBeat( float fBeat ) const;
|
// return def of the background that was created and added to m_BGAnimations. calls CreateBackground
|
||||||
void UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime );
|
BackgroundDef CreateRandomBGA( const Song *pSong, CString sPreferredSubDir );
|
||||||
|
|
||||||
map<CString,Actor*> m_BGAnimations;
|
int FindBGSegmentForBeat( float fBeat ) const;
|
||||||
deque<CString> m_RandomBGAnimations;
|
void UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const map<CString,BackgroundTransition> &mapNameToTransition );
|
||||||
|
|
||||||
|
map<BackgroundDef,Actor*> m_BGAnimations;
|
||||||
|
deque<BackgroundDef> m_RandomBGAnimations;
|
||||||
vector<BackgroundChange> m_aBGChanges;
|
vector<BackgroundChange> m_aBGChanges;
|
||||||
int m_iCurBGChangeIndex;
|
int m_iCurBGChangeIndex;
|
||||||
Actor *m_pCurrentBGA;
|
Actor *m_pCurrentBGA;
|
||||||
@@ -87,6 +96,8 @@ protected:
|
|||||||
Quad m_quadBorderLeft, m_quadBorderTop, m_quadBorderRight, m_quadBorderBottom;
|
Quad m_quadBorderLeft, m_quadBorderTop, m_quadBorderRight, m_quadBorderBottom;
|
||||||
|
|
||||||
BrightnessOverlay m_Brightness;
|
BrightnessOverlay m_Brightness;
|
||||||
|
|
||||||
|
BackgroundDef STATIC_BACKGROUND_DEF;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ void Foreground::LoadFromSong( const Song *pSong )
|
|||||||
for( unsigned i=0; i<pSong->m_ForegroundChanges.size(); i++ )
|
for( unsigned i=0; i<pSong->m_ForegroundChanges.size(); i++ )
|
||||||
{
|
{
|
||||||
const BackgroundChange &change = pSong->m_ForegroundChanges[i];
|
const BackgroundChange &change = pSong->m_ForegroundChanges[i];
|
||||||
CString sBGName = change.m_sBGName;
|
CString sBGName = change.m_sFile1;
|
||||||
|
|
||||||
LoadedBGA bga;
|
LoadedBGA bga;
|
||||||
bga.m_bga = ActorUtil::MakeActor( pSong->GetSongDir() + sBGName );
|
bga.m_bga = ActorUtil::MakeActor( pSong->GetSongDir() + sBGName );
|
||||||
|
|||||||
@@ -366,6 +366,19 @@ static const CString StageNames[] = {
|
|||||||
XToString( Stage, NUM_STAGES );
|
XToString( Stage, NUM_STAGES );
|
||||||
|
|
||||||
|
|
||||||
|
static const CString StandardBackgroundEffectNames[] = {
|
||||||
|
"Centered",
|
||||||
|
"Stretch",
|
||||||
|
};
|
||||||
|
XToString( StandardBackgroundEffect, NUM_StandardBackgroundEffect );
|
||||||
|
|
||||||
|
static const CString StandardBackgroundTransitionNames[] = {
|
||||||
|
"None",
|
||||||
|
"CrossFade",
|
||||||
|
};
|
||||||
|
XToString( StandardBackgroundTransition, NUM_StandardBackgroundTransition );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2001-2004 Chris Danford
|
* (c) 2001-2004 Chris Danford
|
||||||
|
|||||||
@@ -419,6 +419,89 @@ enum Stage
|
|||||||
const CString& StageToString( Stage s );
|
const CString& StageToString( Stage s );
|
||||||
|
|
||||||
|
|
||||||
|
enum StandardBackgroundEffect
|
||||||
|
{
|
||||||
|
SBE_Centered,
|
||||||
|
SBE_Stretch,
|
||||||
|
NUM_StandardBackgroundEffect
|
||||||
|
};
|
||||||
|
const CString& StandardBackgroundEffectToString( StandardBackgroundEffect sbe );
|
||||||
|
|
||||||
|
const CString RANDOM_BACKGROUND_FILE = "-random-";
|
||||||
|
struct BackgroundDef
|
||||||
|
{
|
||||||
|
BackgroundDef()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
bool operator<( const BackgroundDef &other ) const
|
||||||
|
{
|
||||||
|
#define COMPARE(x) if( x < other.x ) return true; else if( x > other.x ) return false;
|
||||||
|
COMPARE( m_sEffect );
|
||||||
|
COMPARE( m_sFile1 );
|
||||||
|
COMPARE( m_sFile2 );
|
||||||
|
#undef COMPARE
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool operator==( const BackgroundDef &other ) const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
m_sEffect == other.m_sEffect &&
|
||||||
|
m_sFile1 == other.m_sFile1 &&
|
||||||
|
m_sFile2 == other.m_sFile2;
|
||||||
|
}
|
||||||
|
bool IsEmpty() { return m_sFile1.empty() && m_sFile2.empty(); }
|
||||||
|
CString m_sEffect; // "" == automatically choose
|
||||||
|
CString m_sFile1; // must not be ""
|
||||||
|
CString m_sFile2; // may be ""
|
||||||
|
};
|
||||||
|
|
||||||
|
enum StandardBackgroundTransition
|
||||||
|
{
|
||||||
|
SBT_None,
|
||||||
|
SBT_CrossFade,
|
||||||
|
NUM_StandardBackgroundTransition
|
||||||
|
};
|
||||||
|
const CString& StandardBackgroundTransitionToString( StandardBackgroundTransition sbt );
|
||||||
|
|
||||||
|
struct BackgroundChange : public BackgroundDef
|
||||||
|
{
|
||||||
|
BackgroundChange()
|
||||||
|
{
|
||||||
|
m_fStartBeat=-1;
|
||||||
|
m_fRate=1;
|
||||||
|
m_bRewindMovie=false;
|
||||||
|
m_bLoop=true;
|
||||||
|
}
|
||||||
|
BackgroundChange(
|
||||||
|
float s,
|
||||||
|
CString f1,
|
||||||
|
CString f2=CString(),
|
||||||
|
float r=1.f,
|
||||||
|
bool m=false,
|
||||||
|
bool l=true,
|
||||||
|
CString e=StandardBackgroundEffectToString(SBE_Centered),
|
||||||
|
CString t=CString()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
m_fStartBeat=s;
|
||||||
|
m_sFile1=f1;
|
||||||
|
m_sFile2=f2;
|
||||||
|
m_fRate=r;
|
||||||
|
m_bRewindMovie=m;
|
||||||
|
m_bLoop=l;
|
||||||
|
m_sEffect=e;
|
||||||
|
m_sTransition=t;
|
||||||
|
}
|
||||||
|
float m_fStartBeat;
|
||||||
|
float m_fRate;
|
||||||
|
bool m_bRewindMovie;
|
||||||
|
bool m_bLoop;
|
||||||
|
CString m_sTransition;
|
||||||
|
};
|
||||||
|
|
||||||
|
void SortBackgroundChangesArray( vector<BackgroundChange> &arrayBackgroundChanges );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ NoteField::NoteField()
|
|||||||
m_textMeasureNumber.LoadFromFont( THEME->GetPathF("Common","normal") );
|
m_textMeasureNumber.LoadFromFont( THEME->GetPathF("Common","normal") );
|
||||||
m_textMeasureNumber.SetZoom( 1.0f );
|
m_textMeasureNumber.SetZoom( 1.0f );
|
||||||
m_textMeasureNumber.SetShadowLength( 2 );
|
m_textMeasureNumber.SetShadowLength( 2 );
|
||||||
|
m_textMeasureNumber.SetWrapWidthPixels( 300 );
|
||||||
|
|
||||||
m_rectMarkerBar.SetEffectDiffuseShift( 2, RageColor(1,1,1,0.5f), RageColor(0.5f,0.5f,0.5f,0.5f) );
|
m_rectMarkerBar.SetEffectDiffuseShift( 2, RageColor(1,1,1,0.5f), RageColor(0.5f,0.5f,0.5f,0.5f) );
|
||||||
|
|
||||||
@@ -540,14 +541,15 @@ void NoteField::DrawPrimitives()
|
|||||||
aBackgroundChanges[i].m_fStartBeat <= fLastBeatToDraw )
|
aBackgroundChanges[i].m_fStartBeat <= fLastBeatToDraw )
|
||||||
{
|
{
|
||||||
const BackgroundChange& change = aBackgroundChanges[i];
|
const BackgroundChange& change = aBackgroundChanges[i];
|
||||||
CString sChangeText = ssprintf("%s%s\n%.0f%%%s%s%s",
|
CString sChangeText = ssprintf("%s%s%s%s%s%s%s",
|
||||||
((b!=0) ? ssprintf("%d: ",b) : CString()).c_str(),
|
((b!=0) ? ssprintf("%d: ",b) : CString()).c_str(),
|
||||||
change.m_sBGName.c_str(),
|
(!change.m_sFile1.empty() ? " "+change.m_sFile1 : CString()).c_str(),
|
||||||
change.m_fRate*100,
|
(!change.m_sFile2.empty() ? " "+change.m_sFile2 : CString()).c_str(),
|
||||||
change.m_bFadeLast ? " Fade" : "",
|
((change.m_fRate!=1.0f) ? ssprintf("%.2f%%",change.m_fRate*100) : CString()).c_str(),
|
||||||
change.m_bRewindMovie ? " Rewind" : "",
|
change.m_bRewindMovie ? " Rewind" : "",
|
||||||
change.m_bLoop ? " Loop" : "" );
|
change.m_bLoop ? " Loop" : "" ,
|
||||||
|
(!change.m_sTransition.empty() ? " "+change.m_sTransition : CString()).c_str()
|
||||||
|
);
|
||||||
if( IS_ON_SCREEN(change.m_fStartBeat) )
|
if( IS_ON_SCREEN(change.m_fStartBeat) )
|
||||||
DrawBGChangeText( change.m_fStartBeat, sChangeText );
|
DrawBGChangeText( change.m_fStartBeat, sChangeText );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,19 +161,26 @@ bool LoadFromBGChangesString( BackgroundChange &change, const CString &sBGChange
|
|||||||
CStringArray aBGChangeValues;
|
CStringArray aBGChangeValues;
|
||||||
split( sBGChangeExpression, "=", aBGChangeValues );
|
split( sBGChangeExpression, "=", aBGChangeValues );
|
||||||
|
|
||||||
switch( aBGChangeValues.size() )
|
if( aBGChangeValues.size() >= 6 )
|
||||||
{
|
{
|
||||||
case 6:
|
|
||||||
change.m_fRate = strtof( aBGChangeValues[2], NULL );
|
change.m_fRate = strtof( aBGChangeValues[2], NULL );
|
||||||
change.m_bFadeLast = atoi( aBGChangeValues[3] ) != 0;
|
change.m_sTransition = (atoi( aBGChangeValues[3] ) != 0) ? "CrossFade" : "";
|
||||||
change.m_bRewindMovie = atoi( aBGChangeValues[4] ) != 0;
|
change.m_bRewindMovie = atoi( aBGChangeValues[4] ) != 0;
|
||||||
change.m_bLoop = atoi( aBGChangeValues[5] ) != 0;
|
change.m_bLoop = atoi( aBGChangeValues[5] ) != 0;
|
||||||
// fall through
|
}
|
||||||
case 2:
|
if( aBGChangeValues.size() >= 8 )
|
||||||
|
{
|
||||||
|
change.m_sFile1 = aBGChangeValues[6];
|
||||||
|
change.m_sTransition = aBGChangeValues[7];
|
||||||
|
}
|
||||||
|
if( aBGChangeValues.size() >= 2 )
|
||||||
|
{
|
||||||
change.m_fStartBeat = strtof( aBGChangeValues[0], NULL );
|
change.m_fStartBeat = strtof( aBGChangeValues[0], NULL );
|
||||||
change.m_sBGName = aBGChangeValues[1];
|
change.m_sFile1 = aBGChangeValues[1];
|
||||||
return true;
|
return true;
|
||||||
default:
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
LOG->Warn("Invalid #BGCHANGES value \"%s\" was ignored", sBGChangeExpression.c_str());
|
LOG->Warn("Invalid #BGCHANGES value \"%s\" was ignored", sBGChangeExpression.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -543,7 +550,7 @@ void SMLoader::TidyUpData( Song &song, bool cache )
|
|||||||
|
|
||||||
for( unsigned i = 0; !bHasNoSongBgTag && i < bg.size(); ++i )
|
for( unsigned i = 0; !bHasNoSongBgTag && i < bg.size(); ++i )
|
||||||
{
|
{
|
||||||
if( !bg[i].m_sBGName.CompareNoCase("-nosongbg-") )
|
if( !bg[i].m_sFile1.CompareNoCase("-nosongbg-") )
|
||||||
{
|
{
|
||||||
bg.erase( bg.begin()+i );
|
bg.erase( bg.begin()+i );
|
||||||
bHasNoSongBgTag = true;
|
bHasNoSongBgTag = true;
|
||||||
@@ -564,7 +571,7 @@ void SMLoader::TidyUpData( Song &song, bool cache )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* If the last BGA is already the song BGA, don't add a duplicate. */
|
/* If the last BGA is already the song BGA, don't add a duplicate. */
|
||||||
if( !bg.empty() && !bg.back().m_sBGName.CompareNoCase(song.m_sBackgroundFile) )
|
if( !bg.empty() && !bg.back().m_sFile1.CompareNoCase(song.m_sBackgroundFile) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( !IsAFile( song.GetBackgroundPath() ) )
|
if( !IsAFile( song.GetBackgroundPath() ) )
|
||||||
|
|||||||
@@ -12,6 +12,11 @@
|
|||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
|
|
||||||
|
static CString BackgroundChangeToString( const BackgroundChange &bgc )
|
||||||
|
{
|
||||||
|
return ssprintf( "%.3f=%s=%.3f=%d=%d=%d=%s,", bgc.m_fStartBeat, bgc.m_sFile1.c_str(), bgc.m_fRate, bgc.m_sTransition=="CrossFade", bgc.m_bRewindMovie, bgc.m_bLoop, bgc.m_sFile2.c_str(), bgc.m_sTransition );
|
||||||
|
}
|
||||||
|
|
||||||
void NotesWriterSM::WriteGlobalTags( RageFile &f, const Song &out )
|
void NotesWriterSM::WriteGlobalTags( RageFile &f, const Song &out )
|
||||||
{
|
{
|
||||||
f.PutLine( ssprintf( "#TITLE:%s;", out.m_sMainTitle.c_str() ) );
|
f.PutLine( ssprintf( "#TITLE:%s;", out.m_sMainTitle.c_str() ) );
|
||||||
@@ -92,7 +97,7 @@ void NotesWriterSM::WriteGlobalTags( RageFile &f, const Song &out )
|
|||||||
f.Write( ssprintf("#BGCHANGES%d:", b) );
|
f.Write( ssprintf("#BGCHANGES%d:", b) );
|
||||||
|
|
||||||
FOREACH_CONST( BackgroundChange, out.m_BackgroundChanges[b], bgc )
|
FOREACH_CONST( BackgroundChange, out.m_BackgroundChanges[b], bgc )
|
||||||
f.PutLine( ssprintf( "%.3f=%s=%.3f=%d=%d=%d,", bgc->m_fStartBeat, bgc->m_sBGName.c_str(), bgc->m_fRate, bgc->m_bFadeLast, bgc->m_bRewindMovie, bgc->m_bLoop ) );
|
f.PutLine( BackgroundChangeToString(*bgc) );
|
||||||
|
|
||||||
/* If there's an animation plan at all, add a dummy "-nosongbg-" tag to indicate that
|
/* If there's an animation plan at all, add a dummy "-nosongbg-" tag to indicate that
|
||||||
* this file doesn't want a song BG entry added at the end. See SMLoader::TidyUpData.
|
* this file doesn't want a song BG entry added at the end. See SMLoader::TidyUpData.
|
||||||
@@ -106,13 +111,9 @@ void NotesWriterSM::WriteGlobalTags( RageFile &f, const Song &out )
|
|||||||
if( out.m_ForegroundChanges.size() )
|
if( out.m_ForegroundChanges.size() )
|
||||||
{
|
{
|
||||||
f.Write( "#FGCHANGES:" );
|
f.Write( "#FGCHANGES:" );
|
||||||
for( unsigned i=0; i<out.m_ForegroundChanges.size(); i++ )
|
FOREACH_CONST( BackgroundChange, out.m_ForegroundChanges, bgc )
|
||||||
{
|
{
|
||||||
const BackgroundChange &seg = out.m_ForegroundChanges[i];
|
f.PutLine( BackgroundChangeToString(*bgc) );
|
||||||
|
|
||||||
f.PutLine( ssprintf( "%.3f=%s=%.3f=%d=%d=%d", seg.m_fStartBeat, seg.m_sBGName.c_str(), seg.m_fRate, seg.m_bFadeLast, seg.m_bRewindMovie, seg.m_bLoop ) );
|
|
||||||
if( i != out.m_ForegroundChanges.size()-1 )
|
|
||||||
f.Write( "," );
|
|
||||||
}
|
}
|
||||||
f.PutLine( ";" );
|
f.PutLine( ";" );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -441,19 +441,27 @@ static Menu g_SongInformation(
|
|||||||
|
|
||||||
static Menu g_BackgroundChange(
|
static Menu g_BackgroundChange(
|
||||||
"ScreenMiniMenuBackgroundChange",
|
"ScreenMiniMenuBackgroundChange",
|
||||||
MenuRow( ScreenEdit::layer, "Layer (applies to new adds)", true, EDIT_MODE_PRACTICE, 0, "0","1" ),
|
MenuRow( ScreenEdit::layer, "Layer", true, EDIT_MODE_FULL, 0, "0","1" ),
|
||||||
MenuRow( ScreenEdit::rate, "Rate (applies to new adds)", true, EDIT_MODE_PRACTICE, 10, "0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%","120%","140%","160%","180%","200%" ),
|
MenuRow( ScreenEdit::rate, "Rate", true, EDIT_MODE_FULL, 10, "0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%","120%","140%","160%","180%","200%" ),
|
||||||
MenuRow( ScreenEdit::fade_last, "Fade Last (applies to new adds)", true, EDIT_MODE_PRACTICE, 0, "NO","YES" ),
|
MenuRow( ScreenEdit::rewind_movie, "Rewind Movie", true, EDIT_MODE_FULL, 0, "NO","YES" ),
|
||||||
MenuRow( ScreenEdit::rewind_movie, "Rewind Movie (applies to new adds)", true, EDIT_MODE_PRACTICE, 0, "NO","YES" ),
|
MenuRow( ScreenEdit::loop, "Loop", true, EDIT_MODE_FULL, 1, "NO","YES" ),
|
||||||
MenuRow( ScreenEdit::loop, "Loop (applies to new adds)", true, EDIT_MODE_PRACTICE, 1, "NO","YES" ),
|
MenuRow( ScreenEdit::transition, "Transition", true, EDIT_MODE_FULL, 0, NULL ),
|
||||||
MenuRow( ScreenEdit::add_random, "Add Change to random", true, EDIT_MODE_PRACTICE, 0, NULL ),
|
MenuRow( ScreenEdit::effect, "Effect", true, EDIT_MODE_FULL, 0, NULL ),
|
||||||
MenuRow( ScreenEdit::add_song_bganimation, "Add Change to song BGAnimation", true, EDIT_MODE_PRACTICE, 0, NULL ),
|
MenuRow( ScreenEdit::file1_type, "file1_type", true, EDIT_MODE_FULL, 0, "None", "Random", "Song BGAnimation", "Song Movie", "Song Still", "Global BGAnimation", "Global Movie" ),
|
||||||
MenuRow( ScreenEdit::add_song_movie, "Add Change to song Movie", true, EDIT_MODE_PRACTICE, 0, NULL ),
|
MenuRow( ScreenEdit::file1_song_bganimation, "file1_type Song BGAnimation", true, EDIT_MODE_FULL, 0, NULL ),
|
||||||
MenuRow( ScreenEdit::add_song_still, "Add Change to song Still", true, EDIT_MODE_PRACTICE, 0, NULL ),
|
MenuRow( ScreenEdit::file1_song_movie, "file1_type Song Movie", true, EDIT_MODE_FULL, 0, NULL ),
|
||||||
MenuRow( ScreenEdit::add_global_random_movie, "Add Change to global Random Movie", true, EDIT_MODE_PRACTICE, 0, NULL ),
|
MenuRow( ScreenEdit::file1_song_still, "file1_type Song Still", true, EDIT_MODE_FULL, 0, NULL ),
|
||||||
MenuRow( ScreenEdit::add_global_bganimation, "Add Change to global BGAnimation", true, EDIT_MODE_PRACTICE, 0, NULL ),
|
MenuRow( ScreenEdit::file1_global_random_movie, "file1_type Global Random Movie", true, EDIT_MODE_FULL, 0, NULL ),
|
||||||
MenuRow( ScreenEdit::add_global_visualization, "Add Change to global Visualization", true, EDIT_MODE_PRACTICE, 0, NULL ),
|
MenuRow( ScreenEdit::file1_global_bganimation, "file1_type Global BGAnimation", true, EDIT_MODE_FULL, 0, NULL ),
|
||||||
MenuRow( ScreenEdit::delete_change, "Remove Change", true, EDIT_MODE_PRACTICE, 0, NULL )
|
MenuRow( ScreenEdit::file1_global_bganimation, "file1_type Global Visualization", true, EDIT_MODE_FULL, 0, NULL ),
|
||||||
|
MenuRow( ScreenEdit::file2_type, "file2_type", true, EDIT_MODE_FULL, 0, "None", "Random", "Song BGAnimation", "Song Movie", "Song Still", "Global BGAnimation", "Global Movie" ),
|
||||||
|
MenuRow( ScreenEdit::file2_song_bganimation, "file2_type Song BGAnimation", true, EDIT_MODE_FULL, 0, NULL ),
|
||||||
|
MenuRow( ScreenEdit::file2_song_movie, "file2_type Song Movie", true, EDIT_MODE_FULL, 0, NULL ),
|
||||||
|
MenuRow( ScreenEdit::file2_song_still, "file2_type Song Still", true, EDIT_MODE_FULL, 0, NULL ),
|
||||||
|
MenuRow( ScreenEdit::file2_global_random_movie, "file2_type Global Random Movie", true, EDIT_MODE_FULL, 0, NULL ),
|
||||||
|
MenuRow( ScreenEdit::file2_global_bganimation, "file2_type Global BGAnimation", true, EDIT_MODE_FULL, 0, NULL ),
|
||||||
|
MenuRow( ScreenEdit::file2_global_bganimation, "file2_type Global Visualization", true, EDIT_MODE_FULL, 0, NULL ),
|
||||||
|
MenuRow( ScreenEdit::delete_change, "Remove Change", true, EDIT_MODE_FULL, 0, NULL )
|
||||||
);
|
);
|
||||||
|
|
||||||
static Menu g_Prefs(
|
static Menu g_Prefs(
|
||||||
@@ -2030,24 +2038,24 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
|
|||||||
//
|
//
|
||||||
|
|
||||||
// m_pSong->GetSongDir() has trailing slash
|
// m_pSong->GetSongDir() has trailing slash
|
||||||
g_BackgroundChange.rows[add_song_bganimation].choices.clear();
|
g_BackgroundChange.rows[file1_song_bganimation].choices.clear();
|
||||||
GetDirListing( m_pSong->GetSongDir()+"*", g_BackgroundChange.rows[add_song_bganimation].choices, true );
|
GetDirListing( m_pSong->GetSongDir()+"*", g_BackgroundChange.rows[file1_song_bganimation].choices, true );
|
||||||
|
|
||||||
g_BackgroundChange.rows[add_song_movie].choices.clear();
|
g_BackgroundChange.rows[file1_song_movie].choices.clear();
|
||||||
GetDirListing( m_pSong->GetSongDir()+"*.avi", g_BackgroundChange.rows[add_song_movie].choices, false );
|
GetDirListing( m_pSong->GetSongDir()+"*.avi", g_BackgroundChange.rows[file1_song_movie].choices, false );
|
||||||
GetDirListing( m_pSong->GetSongDir()+"*.mpg", g_BackgroundChange.rows[add_song_movie].choices, false );
|
GetDirListing( m_pSong->GetSongDir()+"*.mpg", g_BackgroundChange.rows[file1_song_movie].choices, false );
|
||||||
GetDirListing( m_pSong->GetSongDir()+"*.mpeg", g_BackgroundChange.rows[add_song_movie].choices, false );
|
GetDirListing( m_pSong->GetSongDir()+"*.mpeg", g_BackgroundChange.rows[file1_song_movie].choices, false );
|
||||||
|
|
||||||
g_BackgroundChange.rows[add_song_still].choices.clear();
|
g_BackgroundChange.rows[file1_song_still].choices.clear();
|
||||||
GetDirListing( m_pSong->GetSongDir()+"*.png", g_BackgroundChange.rows[add_song_still].choices, false );
|
GetDirListing( m_pSong->GetSongDir()+"*.png", g_BackgroundChange.rows[file1_song_still].choices, false );
|
||||||
GetDirListing( m_pSong->GetSongDir()+"*.jpg", g_BackgroundChange.rows[add_song_still].choices, false );
|
GetDirListing( m_pSong->GetSongDir()+"*.jpg", g_BackgroundChange.rows[file1_song_still].choices, false );
|
||||||
GetDirListing( m_pSong->GetSongDir()+"*.gif", g_BackgroundChange.rows[add_song_still].choices, false );
|
GetDirListing( m_pSong->GetSongDir()+"*.gif", g_BackgroundChange.rows[file1_song_still].choices, false );
|
||||||
GetDirListing( m_pSong->GetSongDir()+"*.bmp", g_BackgroundChange.rows[add_song_still].choices, false );
|
GetDirListing( m_pSong->GetSongDir()+"*.bmp", g_BackgroundChange.rows[file1_song_still].choices, false );
|
||||||
|
|
||||||
g_BackgroundChange.rows[add_global_random_movie].choices.clear();
|
g_BackgroundChange.rows[file1_global_random_movie].choices.clear();
|
||||||
GetDirListing( RANDOMMOVIES_DIR+"*.avi", g_BackgroundChange.rows[add_global_random_movie].choices, false );
|
GetDirListing( RANDOMMOVIES_DIR+"*.avi", g_BackgroundChange.rows[file1_global_random_movie].choices, false );
|
||||||
GetDirListing( RANDOMMOVIES_DIR+"*.mpg", g_BackgroundChange.rows[add_global_random_movie].choices, false );
|
GetDirListing( RANDOMMOVIES_DIR+"*.mpg", g_BackgroundChange.rows[file1_global_random_movie].choices, false );
|
||||||
GetDirListing( RANDOMMOVIES_DIR+"*.mpeg", g_BackgroundChange.rows[add_global_random_movie].choices, false );
|
GetDirListing( RANDOMMOVIES_DIR+"*.mpeg", g_BackgroundChange.rows[file1_global_random_movie].choices, false );
|
||||||
|
|
||||||
vector<CString> vSubDirs;
|
vector<CString> vSubDirs;
|
||||||
GetDirListing( RANDOMMOVIES_DIR+"*", vSubDirs, true );
|
GetDirListing( RANDOMMOVIES_DIR+"*", vSubDirs, true );
|
||||||
@@ -2061,16 +2069,19 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
|
|||||||
GetDirListing( RANDOMMOVIES_DIR+sSubDir+"/*.mpeg", vsMovies, false );
|
GetDirListing( RANDOMMOVIES_DIR+sSubDir+"/*.mpeg", vsMovies, false );
|
||||||
|
|
||||||
FOREACH_CONST( CString, vsMovies, m )
|
FOREACH_CONST( CString, vsMovies, m )
|
||||||
g_BackgroundChange.rows[add_global_random_movie].choices.push_back( sSubDir +"/"+ *m );
|
g_BackgroundChange.rows[file1_global_random_movie].choices.push_back( sSubDir +"/"+ *m );
|
||||||
}
|
}
|
||||||
|
|
||||||
g_BackgroundChange.rows[add_global_bganimation].choices.clear();
|
g_BackgroundChange.rows[file1_global_bganimation].choices.clear();
|
||||||
GetDirListing( BG_ANIMS_DIR+"*", g_BackgroundChange.rows[add_global_bganimation].choices, true );
|
GetDirListing( BG_ANIMS_DIR+"*", g_BackgroundChange.rows[file1_global_bganimation].choices, true );
|
||||||
|
|
||||||
g_BackgroundChange.rows[add_global_visualization].choices.clear();
|
|
||||||
GetDirListing( VISUALIZATIONS_DIR+"*.avi", g_BackgroundChange.rows[add_global_visualization].choices, false );
|
g_BackgroundChange.rows[file2_type].choices = g_BackgroundChange.rows[file1_type].choices;
|
||||||
GetDirListing( VISUALIZATIONS_DIR+"*.mpg", g_BackgroundChange.rows[add_global_visualization].choices, false );
|
g_BackgroundChange.rows[file2_song_bganimation].choices = g_BackgroundChange.rows[file1_song_bganimation].choices;
|
||||||
GetDirListing( VISUALIZATIONS_DIR+"*.mpeg", g_BackgroundChange.rows[add_global_visualization].choices, false );
|
g_BackgroundChange.rows[file2_song_movie].choices = g_BackgroundChange.rows[file1_song_movie].choices;
|
||||||
|
g_BackgroundChange.rows[file2_song_still].choices = g_BackgroundChange.rows[file1_song_still].choices;
|
||||||
|
g_BackgroundChange.rows[file2_global_random_movie].choices = g_BackgroundChange.rows[file1_global_random_movie].choices;
|
||||||
|
g_BackgroundChange.rows[file2_global_bganimation].choices = g_BackgroundChange.rows[file1_global_bganimation].choices;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2092,28 +2103,39 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_BackgroundChange.rows[add_random].bEnabled = true;
|
g_BackgroundChange.rows[file1_type].bEnabled = true;
|
||||||
g_BackgroundChange.rows[add_song_bganimation].bEnabled = g_BackgroundChange.rows[add_song_bganimation].choices.size() > 0;
|
g_BackgroundChange.rows[file1_song_bganimation].bEnabled = g_BackgroundChange.rows[file1_song_bganimation].choices.size() > 0;
|
||||||
g_BackgroundChange.rows[add_song_movie].bEnabled = g_BackgroundChange.rows[add_song_movie].choices.size() > 0;
|
g_BackgroundChange.rows[file1_song_movie].bEnabled = g_BackgroundChange.rows[file1_song_movie].choices.size() > 0;
|
||||||
g_BackgroundChange.rows[add_song_still].bEnabled = g_BackgroundChange.rows[add_song_still].choices.size() > 0;
|
g_BackgroundChange.rows[file1_song_still].bEnabled = g_BackgroundChange.rows[file1_song_still].choices.size() > 0;
|
||||||
g_BackgroundChange.rows[add_global_random_movie].bEnabled = g_BackgroundChange.rows[add_global_random_movie].choices.size() > 0;
|
g_BackgroundChange.rows[file1_global_random_movie].bEnabled = g_BackgroundChange.rows[file1_global_random_movie].choices.size() > 0;
|
||||||
g_BackgroundChange.rows[add_global_bganimation].bEnabled = g_BackgroundChange.rows[add_global_bganimation].choices.size() > 0;
|
g_BackgroundChange.rows[file1_global_bganimation].bEnabled = g_BackgroundChange.rows[file1_global_bganimation].choices.size() > 0;
|
||||||
g_BackgroundChange.rows[add_global_visualization].bEnabled = g_BackgroundChange.rows[add_global_visualization].choices.size() > 0;
|
g_BackgroundChange.rows[file2_type].bEnabled = g_BackgroundChange.rows[file1_type].bEnabled;
|
||||||
|
g_BackgroundChange.rows[file2_song_bganimation].bEnabled = g_BackgroundChange.rows[file1_song_bganimation].bEnabled;
|
||||||
|
g_BackgroundChange.rows[file2_song_movie].bEnabled = g_BackgroundChange.rows[file1_song_movie].bEnabled;
|
||||||
|
g_BackgroundChange.rows[file2_song_still].bEnabled = g_BackgroundChange.rows[file1_song_still].bEnabled;
|
||||||
|
g_BackgroundChange.rows[file2_global_random_movie].bEnabled = g_BackgroundChange.rows[file1_global_random_movie].bEnabled;
|
||||||
|
g_BackgroundChange.rows[file2_global_bganimation].bEnabled = g_BackgroundChange.rows[file1_global_bganimation].bEnabled;
|
||||||
g_BackgroundChange.rows[delete_change].bEnabled = bAlreadyBGChangeHere;
|
g_BackgroundChange.rows[delete_change].bEnabled = bAlreadyBGChangeHere;
|
||||||
|
|
||||||
|
|
||||||
// set default choices
|
// set default choices
|
||||||
g_BackgroundChange.rows[layer]. SetDefaultChoiceIfPresent( ssprintf("%d",iLayer) );
|
g_BackgroundChange.rows[layer]. SetDefaultChoiceIfPresent( ssprintf("%d",iLayer) );
|
||||||
g_BackgroundChange.rows[rate]. SetDefaultChoiceIfPresent( ssprintf("%2.0f%%",bgChange.m_fRate*100) );
|
g_BackgroundChange.rows[rate]. SetDefaultChoiceIfPresent( ssprintf("%2.0f%%",bgChange.m_fRate*100) );
|
||||||
g_BackgroundChange.rows[fade_last].iDefaultChoice = bgChange.m_bFadeLast ? 1 : 0;
|
|
||||||
g_BackgroundChange.rows[rewind_movie].iDefaultChoice= bgChange.m_bRewindMovie ? 1 : 0;
|
g_BackgroundChange.rows[rewind_movie].iDefaultChoice= bgChange.m_bRewindMovie ? 1 : 0;
|
||||||
g_BackgroundChange.rows[loop].iDefaultChoice = bgChange.m_bLoop ? 1 : 0;
|
g_BackgroundChange.rows[loop].iDefaultChoice = bgChange.m_bLoop ? 1 : 0;
|
||||||
g_BackgroundChange.rows[add_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
|
g_BackgroundChange.rows[transition]. SetDefaultChoiceIfPresent( bgChange.m_sTransition );
|
||||||
g_BackgroundChange.rows[add_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
|
g_BackgroundChange.rows[file1_type].iDefaultChoice = 0; // FIXME
|
||||||
g_BackgroundChange.rows[add_song_still]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
|
g_BackgroundChange.rows[file1_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 );
|
||||||
g_BackgroundChange.rows[add_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
|
g_BackgroundChange.rows[file1_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 );
|
||||||
g_BackgroundChange.rows[add_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
|
g_BackgroundChange.rows[file1_song_still]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 );
|
||||||
g_BackgroundChange.rows[add_global_visualization]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
|
g_BackgroundChange.rows[file1_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 );
|
||||||
|
g_BackgroundChange.rows[file1_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 );
|
||||||
|
g_BackgroundChange.rows[file2_type].iDefaultChoice = 0; // FIXME
|
||||||
|
g_BackgroundChange.rows[file2_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 );
|
||||||
|
g_BackgroundChange.rows[file2_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 );
|
||||||
|
g_BackgroundChange.rows[file2_song_still]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 );
|
||||||
|
g_BackgroundChange.rows[file2_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 );
|
||||||
|
g_BackgroundChange.rows[file2_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 );
|
||||||
|
|
||||||
|
|
||||||
SCREENMAN->MiniMenu( &g_BackgroundChange, SM_BackFromBGChange );
|
SCREENMAN->MiniMenu( &g_BackgroundChange, SM_BackFromBGChange );
|
||||||
@@ -2639,34 +2661,19 @@ void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, const vector<int> &iAns
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( c == delete_change )
|
||||||
|
return; // don't add
|
||||||
|
|
||||||
newChange.m_fStartBeat = GAMESTATE->m_fSongBeat;
|
newChange.m_fStartBeat = GAMESTATE->m_fSongBeat;
|
||||||
|
|
||||||
switch( c )
|
|
||||||
{
|
|
||||||
case add_random:
|
|
||||||
newChange.m_sBGName = "-random-";
|
|
||||||
break;
|
|
||||||
case add_song_bganimation:
|
|
||||||
case add_song_movie:
|
|
||||||
case add_song_still:
|
|
||||||
case add_global_random_movie:
|
|
||||||
case add_global_bganimation:
|
|
||||||
case add_global_visualization:
|
|
||||||
newChange.m_sBGName = g_BackgroundChange.rows[c].choices[iAnswers[c]];
|
|
||||||
break;
|
|
||||||
case delete_change:
|
|
||||||
newChange.m_sBGName = "";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
|
|
||||||
newChange.m_fRate = strtof( g_BackgroundChange.rows[rate].choices[iAnswers[rate]], NULL )/100.f;
|
newChange.m_fRate = strtof( g_BackgroundChange.rows[rate].choices[iAnswers[rate]], NULL )/100.f;
|
||||||
newChange.m_bFadeLast = !!iAnswers[fade_last];
|
|
||||||
newChange.m_bRewindMovie = !!iAnswers[rewind_movie];
|
newChange.m_bRewindMovie = !!iAnswers[rewind_movie];
|
||||||
newChange.m_bLoop = !!iAnswers[loop];
|
newChange.m_bLoop = !!iAnswers[loop];
|
||||||
|
newChange.m_sTransition = g_BackgroundChange.rows[transition].choices[iAnswers[transition]];
|
||||||
|
int iRow1 = file1_song_bganimation + iAnswers[file1_type];
|
||||||
|
newChange.m_sFile1 = g_BackgroundChange.rows[iRow1].choices[iAnswers[iRow1]];
|
||||||
|
int iRow2 = file2_song_bganimation + iAnswers[file2_type];
|
||||||
|
newChange.m_sFile2 = g_BackgroundChange.rows[iRow2].choices[iAnswers[iRow2]];
|
||||||
|
|
||||||
if( newChange.m_sBGName != "" )
|
|
||||||
m_pSong->AddBackgroundChange( iLayer, newChange );
|
m_pSong->AddBackgroundChange( iLayer, newChange );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -366,16 +366,22 @@ public:
|
|||||||
enum BGChangeChoice {
|
enum BGChangeChoice {
|
||||||
layer,
|
layer,
|
||||||
rate,
|
rate,
|
||||||
fade_last,
|
|
||||||
rewind_movie,
|
rewind_movie,
|
||||||
loop,
|
loop,
|
||||||
add_random,
|
transition,
|
||||||
add_song_bganimation,
|
effect,
|
||||||
add_song_movie,
|
file1_type,
|
||||||
add_song_still,
|
file1_song_bganimation,
|
||||||
add_global_random_movie,
|
file1_song_movie,
|
||||||
add_global_bganimation,
|
file1_song_still,
|
||||||
add_global_visualization,
|
file1_global_random_movie,
|
||||||
|
file1_global_bganimation,
|
||||||
|
file2_type,
|
||||||
|
file2_song_bganimation,
|
||||||
|
file2_song_movie,
|
||||||
|
file2_song_still,
|
||||||
|
file2_global_random_movie,
|
||||||
|
file2_global_bganimation,
|
||||||
delete_change,
|
delete_change,
|
||||||
NUM_BGCHANGE_CHOICES
|
NUM_BGCHANGE_CHOICES
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -144,13 +144,13 @@ void Song::GetDisplayBpms( DisplayBpms &AddTo ) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CString Song::GetBackgroundAtBeat( int iLayer, float fBeat ) const
|
const BackgroundChange &Song::GetBackgroundAtBeat( int iLayer, float fBeat ) const
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for( i=0; i<m_BackgroundChanges[iLayer].size()-1; i++ )
|
for( i=0; i<m_BackgroundChanges[iLayer].size()-1; i++ )
|
||||||
if( m_BackgroundChanges[iLayer][i+1].m_fStartBeat > fBeat )
|
if( m_BackgroundChanges[iLayer][i+1].m_fStartBeat > fBeat )
|
||||||
break;
|
break;
|
||||||
return m_BackgroundChanges[iLayer][i].m_sBGName;
|
return m_BackgroundChanges[iLayer][i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -721,7 +721,7 @@ void Song::TidyUpData()
|
|||||||
/* Use this->GetBeatFromElapsedTime(0) instead of 0 to start when the
|
/* Use this->GetBeatFromElapsedTime(0) instead of 0 to start when the
|
||||||
* music starts. */
|
* music starts. */
|
||||||
if( arrayPossibleMovies.size() == 1 )
|
if( arrayPossibleMovies.size() == 1 )
|
||||||
this->AddBackgroundChange( 0, BackgroundChange(0,arrayPossibleMovies[0],1.f,true,true,false) );
|
this->AddBackgroundChange( 0, BackgroundChange(0,arrayPossibleMovies[0],"",1.f,true,true,false) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-16
@@ -24,20 +24,6 @@ extern const int FILE_CACHE_VERSION;
|
|||||||
|
|
||||||
const int NUM_BACKGROUND_LAYERS = 2;
|
const int NUM_BACKGROUND_LAYERS = 2;
|
||||||
|
|
||||||
struct BackgroundChange
|
|
||||||
{
|
|
||||||
BackgroundChange() { m_fStartBeat=-1; m_fRate=1; m_bFadeLast=false; m_bRewindMovie=false; m_bLoop=true; };
|
|
||||||
BackgroundChange( float s, CString n, float r=1.f, bool f=false, bool m=false, bool l=true ) { m_fStartBeat=s; m_sBGName=n; m_fRate=r; m_bFadeLast=f; m_bRewindMovie=m; m_bLoop=l; };
|
|
||||||
float m_fStartBeat;
|
|
||||||
CString m_sBGName;
|
|
||||||
float m_fRate;
|
|
||||||
bool m_bFadeLast;
|
|
||||||
bool m_bRewindMovie;
|
|
||||||
bool m_bLoop;
|
|
||||||
};
|
|
||||||
|
|
||||||
void SortBackgroundChangesArray( vector<BackgroundChange> &arrayBackgroundChanges );
|
|
||||||
|
|
||||||
struct LyricSegment
|
struct LyricSegment
|
||||||
{
|
{
|
||||||
float m_fStartTime;
|
float m_fStartTime;
|
||||||
@@ -45,7 +31,6 @@ struct LyricSegment
|
|||||||
RageColor m_Color;
|
RageColor m_Color;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Song
|
class Song
|
||||||
{
|
{
|
||||||
CString m_sSongDir;
|
CString m_sSongDir;
|
||||||
@@ -165,7 +150,7 @@ public:
|
|||||||
void AddLyricSegment( LyricSegment seg );
|
void AddLyricSegment( LyricSegment seg );
|
||||||
|
|
||||||
void GetDisplayBpms( DisplayBpms &AddTo ) const;
|
void GetDisplayBpms( DisplayBpms &AddTo ) const;
|
||||||
CString GetBackgroundAtBeat( int iLayer, float fBeat ) const;
|
const BackgroundChange &GetBackgroundAtBeat( int iLayer, float fBeat ) const;
|
||||||
|
|
||||||
float GetBPMAtBeat( float fBeat ) const { return m_Timing.GetBPMAtBeat( fBeat ); }
|
float GetBPMAtBeat( float fBeat ) const { return m_Timing.GetBPMAtBeat( fBeat ); }
|
||||||
void SetBPMAtBeat( float fBeat, float fBPM ) { m_Timing.SetBPMAtBeat( fBeat, fBPM ); }
|
void SetBPMAtBeat( float fBeat, float fBPM ) { m_Timing.SetBPMAtBeat( fBeat, fBPM ); }
|
||||||
|
|||||||
Reference in New Issue
Block a user