diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 12d432d9a2..2090d19cd2 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -741,9 +741,9 @@ void Actor::HandleCommand( const ParsedCommand &command ) else if( sName=="x" ) SetX( fParam(1) ); else if( sName=="y" ) SetY( fParam(1) ); else if( sName=="z" ) SetZ( fParam(1) ); - else if( sName=="addx" ) SetX( GetX()+fParam(1) ); - else if( sName=="addy" ) SetY( GetY()+fParam(1) ); - else if( sName=="addz" ) SetZ( GetZ()+fParam(1) ); + else if( sName=="addx" ) SetX( GetDestX()+fParam(1) ); + else if( sName=="addy" ) SetY( GetDestY()+fParam(1) ); + else if( sName=="addz" ) SetZ( GetDestZ()+fParam(1) ); else if( sName=="zoom" ) SetZoom( fParam(1) ); else if( sName=="zoomx" ) SetZoomX( fParam(1) ); else if( sName=="zoomy" ) SetZoomY( fParam(1) ); diff --git a/stepmania/src/ActorScroller.h b/stepmania/src/ActorScroller.h index 8fea7e7ca0..4da9ce53e9 100644 --- a/stepmania/src/ActorScroller.h +++ b/stepmania/src/ActorScroller.h @@ -22,6 +22,7 @@ public: void Load( float fScrollSecondsPerItem, float fSpacingX, float fSpacingY ); virtual void Update( float fDelta ); + virtual void DrawPrimitives() {} // doesn't draw! void SetDestinationItem( int iItem ) { m_fDestinationItem = float(iItem); } void SetCurrentAndDestinationItem( int iItem ) { m_fCurrentItem = m_fDestinationItem = float(iItem); } diff --git a/stepmania/src/ActorUtil.cpp b/stepmania/src/ActorUtil.cpp index 386eb3af06..728f5a10fb 100644 --- a/stepmania/src/ActorUtil.cpp +++ b/stepmania/src/ActorUtil.cpp @@ -23,74 +23,113 @@ #include "arch/ArchHooks/ArchHooks.h" #include "RageFileManager.h" #include "SongCreditDisplay.h" +#include "song.h" +#include "GameState.h" +#include "RageTextureManager.h" -static Actor* LoadActor( CString sPath ) +Actor* LoadFromActorFile( CString sIniPath, CString sLayer ) { // TODO: Check for recursive loading IniFile ini; - ini.SetPath( sPath ); + ini.SetPath( sIniPath ); ini.ReadFile(); - if( !ini.GetKey("Actor") ) - RageException::Throw( "The actor file '%s' is invalid.", sPath.c_str() ); + if( !ini.GetKey(sLayer) ) + RageException::Throw( "The file '%s' doesn't have layer '%s'.", sIniPath.c_str(), sLayer.c_str() ); - CString sFileName; - ini.GetValue( "Actor", "File", sFileName ); - - CString sDir = Dirname( sPath ); + Actor* pActor = NULL; // fill this in before we return; - /* XXX: How to handle translations? Maybe we should have one metrics section, - * "Text", eg: - * - * [Text] - * SoundVolume=Sound Volume - * TextItem=Hello - * - * and allow "$TextItem$" in .actors to reference that. - */ - Actor* pActor = NULL; - CString text; - if( ini.GetValue ( "Actor", "Text", text ) ) + CString sType; + ini.GetValue( sLayer, "Type", sType ); + CString sFile; + ini.GetValue( sLayer, "File", sFile ); + CString sDir = Dirname( sIniPath ); + + if( sType == "SongCreditDisplay" ) { - /* It's a BitmapText. Note that we could do the actual text setting with metrics, - * by adding "text" and "alttext" commands, but right now metrics can't contain - * commas or semicolons. It's useful to be able to refer to fonts in the real - * theme font dirs, too. */ - CString alttext; - ini.GetValue ( "Actor", "AltText", alttext ); - text.Replace( "::", "\n" ); - alttext.Replace( "::", "\n" ); - - BitmapText* pBitmapText = new BitmapText; - pActor = pBitmapText; - - pBitmapText->LoadFromFont( THEME->GetPathToF( sFileName ) ); - pBitmapText->SetText( text, alttext ); + pActor = new SongCreditDisplay; } else { - CStringArray asFiles; - GetDirListing( sDir + sFileName + "*", asFiles ); - if( asFiles.empty() ) - RageException::Throw( "The actor file '%s' references a file '%s' which doesn't exist.", sPath.c_str(), sFileName.c_str() ); - else if( asFiles.size() > 1 ) - RageException::Throw( "The actor file '%s' references a file '%s' which has multiple matches.", sPath.c_str(), sFileName.c_str() ); + /* XXX: How to handle translations? Maybe we should have one metrics section, + * "Text", eg: + * + * [Text] + * SoundVolume=Sound Volume + * TextItem=Hello + * + * and allow "$TextItem$" in .actors to reference that. + */ + CString text; + if( ini.GetValue ( sLayer, "Text", text ) ) + { + /* It's a BitmapText. Note that we could do the actual text setting with metrics, + * by adding "text" and "alttext" commands, but right now metrics can't contain + * commas or semicolons. It's useful to be able to refer to fonts in the real + * theme font dirs, too. */ + CString alttext; + ini.GetValue ( sLayer, "AltText", alttext ); + text.Replace( "::", "\n" ); + alttext.Replace( "::", "\n" ); - CString sNewPath = DerefRedir( sDir + asFiles[0] ); + BitmapText* pBitmapText = new BitmapText; - pActor = MakeActor( sNewPath ); + pBitmapText->LoadFromFont( THEME->GetPathToF( sFile ) ); + pBitmapText->SetText( text, alttext ); + pActor = pBitmapText; + } + else + { + + if( sFile.CompareNoCase("songbackground")==0 ) + { + Song *pSong = GAMESTATE->m_pCurSong; + if( pSong && pSong->HasBackground() ) + sFile = pSong->GetBackgroundPath(); + else + sFile = THEME->GetPathToG("Common fallback background"); + + pActor = MakeActor( sFile ); + } + else if( sFile.CompareNoCase("songbanner")==0 ) + { + const Song *pSong = GAMESTATE->m_pCurSong; + if( pSong && pSong->HasBanner() ) + sFile = pSong->GetBannerPath(); + else + sFile = THEME->GetPathToG("Common fallback banner"); + + TEXTUREMAN->DisableOddDimensionWarning(); + pActor = MakeActor( sFile ); + TEXTUREMAN->EnableOddDimensionWarning(); + } + else + { + CStringArray asPaths; + GetDirListing( sDir + sFile + "*", asPaths, false, true ); // return path too + + if( asPaths.empty() ) + RageException::Throw( "The actor file '%s' references a file '%s' which doesn't exist.", sIniPath.c_str(), sFile.c_str() ); + else if( asPaths.size() > 1 ) + RageException::Throw( "The actor file '%s' references a file '%s' which has multiple matches.", sIniPath.c_str(), sFile.c_str() ); + + CString sNewPath = DerefRedir( asPaths[0] ); + pActor = MakeActor( sNewPath ); + } + } } float f; - if( ini.GetValue ( "Actor", "BaseRotationXDegrees", f ) ) pActor->SetBaseRotationX( f ); - if( ini.GetValue ( "Actor", "BaseRotationYDegrees", f ) ) pActor->SetBaseRotationY( f ); - if( ini.GetValue ( "Actor", "BaseRotationZDegrees", f ) ) pActor->SetBaseRotationZ( f ); - if( ini.GetValue ( "Actor", "BaseZoomX", f ) ) pActor->SetBaseZoomX( f ); - if( ini.GetValue ( "Actor", "BaseZoomY", f ) ) pActor->SetBaseZoomY( f ); - if( ini.GetValue ( "Actor", "BaseZoomZ", f ) ) pActor->SetBaseZoomZ( f ); + if( ini.GetValue ( sLayer, "BaseRotationXDegrees", f ) ) pActor->SetBaseRotationX( f ); + if( ini.GetValue ( sLayer, "BaseRotationYDegrees", f ) ) pActor->SetBaseRotationY( f ); + if( ini.GetValue ( sLayer, "BaseRotationZDegrees", f ) ) pActor->SetBaseRotationZ( f ); + if( ini.GetValue ( sLayer, "BaseZoomX", f ) ) pActor->SetBaseZoomX( f ); + if( ini.GetValue ( sLayer, "BaseZoomY", f ) ) pActor->SetBaseZoomY( f ); + if( ini.GetValue ( sLayer, "BaseZoomZ", f ) ) pActor->SetBaseZoomZ( f ); + ASSERT( pActor ); // we should have filled this in above return pActor; } @@ -99,13 +138,9 @@ Actor* MakeActor( RageTextureID ID ) CString sExt = GetExtension( ID.filename ); sExt.MakeLower(); - if( ID.filename.Right(strlen("SongCreditDisplay")) == "SongCreditDisplay" ) + if( sExt=="actor" ) { - return new SongCreditDisplay; - } - else if( sExt=="actor" ) - { - return LoadActor( ID.filename ); + return LoadFromActorFile( ID.filename ); } else if( sExt=="png" || sExt=="jpg" || diff --git a/stepmania/src/ActorUtil.h b/stepmania/src/ActorUtil.h index d9d766c5a2..7f91a3214e 100644 --- a/stepmania/src/ActorUtil.h +++ b/stepmania/src/ActorUtil.h @@ -43,6 +43,7 @@ inline float UtilOffCommand( Actor* pActor, CString sClassName ) { return UtilOf inline float UtilSetXYAndOnCommand( Actor* pActor, CString sClassName ) { return UtilSetXYAndOnCommand( *pActor, sClassName ); } // Return a Sprite, BitmapText, or Model depending on the file type +Actor* LoadFromActorFile( CString sIniPath, CString sLayer = "Actor" ); Actor* MakeActor( RageTextureID ID ); diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index f8a6eb74f1..730aa024d4 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -122,6 +122,27 @@ void BGAnimation::LoadFromAniDir( CString sAniDir ) m_fLengthSeconds = max(m_fLengthSeconds, m_Layers[i]->GetMaxTweenTimeLeft()); } + bool bUseScroller; + if( ini.GetValue( "BGAnimation", "UseScroller", bUseScroller ) && bUseScroller ) + { +#define REQUIRED_GET_VALUE( szName, valueOut ) \ + if( !ini.GetValue( "BGAnimation", szName, valueOut ) ) \ + RageException::Throw( "File '%s' is missing the value BGAnimation::%s", sPathToIni.c_str(), szName ); + + float fScrollSecondsPerItem, fSpacingX, fSpacingY; + REQUIRED_GET_VALUE( "ScrollSecondsPerItem", fScrollSecondsPerItem ); + REQUIRED_GET_VALUE( "ScrollSpacingX", fSpacingX ); + REQUIRED_GET_VALUE( "ScrollSpacingY", fSpacingY ); +#undef REQUIRED_GET_VALUE + + m_Scroller.Load( fScrollSecondsPerItem, fSpacingX, fSpacingY ); + for( unsigned i=0; iAddChild( &m_Scroller ); + } + CString InitCommand; if( ini.GetValue( "BGAnimation", "InitCommand", InitCommand ) ) { diff --git a/stepmania/src/BGAnimation.h b/stepmania/src/BGAnimation.h index 1ce102cdd9..7d9b63f5ca 100644 --- a/stepmania/src/BGAnimation.h +++ b/stepmania/src/BGAnimation.h @@ -13,6 +13,7 @@ */ #include "ActorFrame.h" +#include "ActorScroller.h" class BGAnimationLayer; @@ -52,6 +53,8 @@ protected: vector m_Layers; float m_fLengthSeconds; bool m_bGeneric; + + ActorScroller m_Scroller; }; diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index db48f09e53..afc30d3b01 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -80,9 +80,7 @@ BGAnimationLayer::~BGAnimationLayer() void BGAnimationLayer::Unload() { - for( unsigned i=0; iLoadBG( ID ); pSprite->StretchTo( FullScreenRectI ); - m_pActors.push_back( pSprite ); + m_SubActors.push_back( pSprite ); } void BGAnimationLayer::LoadFromMovie( CString sMoviePath ) @@ -160,14 +158,14 @@ void BGAnimationLayer::LoadFromMovie( CString sMoviePath ) pSprite->LoadBG( sMoviePath ); pSprite->StretchTo( FullScreenRectI ); pSprite->GetTexture()->Pause(); - m_pActors.push_back( pSprite ); + m_SubActors.push_back( pSprite ); } void BGAnimationLayer::LoadFromVisualization( CString sMoviePath ) { Init(); Sprite* pSprite = new Sprite; - m_pActors.push_back( pSprite ); + m_SubActors.push_back( pSprite ); pSprite->LoadBG( sMoviePath ); pSprite->StretchTo( FullScreenRectI ); pSprite->SetBlendMode( BLEND_ADD ); @@ -236,7 +234,7 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath ) { m_Type = TYPE_SPRITE; Sprite* pSprite = new Sprite; - m_pActors.push_back( pSprite ); + m_SubActors.push_back( pSprite ); pSprite->Load( sPath ); pSprite->SetXY( CENTER_X, CENTER_Y ); } @@ -252,7 +250,7 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath ) { m_Type = TYPE_SPRITE; Sprite* pSprite = new Sprite; - m_pActors.push_back( pSprite ); + m_SubActors.push_back( pSprite ); RageTextureID ID(sPath); ID.bStretch = true; pSprite->LoadBG( ID ); @@ -273,7 +271,7 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath ) { m_Type = TYPE_SPRITE; Sprite* pSprite = new Sprite; - m_pActors.push_back( pSprite ); + m_SubActors.push_back( pSprite ); pSprite->LoadBG( sPath ); const RectI StretchedFullScreenRectI( FullScreenRectI.left-200, @@ -304,7 +302,7 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath ) for( int i=0; iLoad( sPath ); pSprite->SetZoom( 0.7f + 0.6f*i/(float)m_iNumParticles ); pSprite->SetX( randomf( GetGuardRailLeft(pSprite), GetGuardRailRight(pSprite) ) ); @@ -365,7 +363,7 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath ) for( int y=0; yLoad( ID ); pSprite->SetTextureWrapping( true ); // gets rid of some "cracks" @@ -409,24 +407,24 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath ) sPath.MakeLower(); if( sPath.Find("cyclecolor") != -1 ) - for( unsigned i=0; iSetEffectRainbow( 5 ); + for( unsigned i=0; iSetEffectRainbow( 5 ); if( sPath.Find("cyclealpha") != -1 ) - for( unsigned i=0; iSetEffectDiffuseShift( 2, RageColor(1,1,1,1), RageColor(1,1,1,0) ); + for( unsigned i=0; iSetEffectDiffuseShift( 2, RageColor(1,1,1,1), RageColor(1,1,1,0) ); if( sPath.Find("startonrandomframe") != -1 ) - for( unsigned i=0; iSetState( rand()%m_pActors[i]->GetNumStates() ); + for( unsigned i=0; iSetState( rand()%m_SubActors[i]->GetNumStates() ); if( sPath.Find("dontanimate") != -1 ) - for( unsigned i=0; iStopAnimating(); + for( unsigned i=0; iStopAnimating(); if( sPath.Find("add") != -1 ) - for( unsigned i=0; iSetBlendMode( BLEND_ADD ); + for( unsigned i=0; iSetBlendMode( BLEND_ADD ); } @@ -460,64 +458,6 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer ) } } - bool IsBanner = false; - - CString sFile; - ini.GetValue( sLayer, "File", sFile ); - FixSlashesInPlace( sFile ); - - CString sPath = sAniDir+sFile; - CollapsePath( sPath ); - - if( sFile.CompareNoCase("songbackground")==0 ) - { - Song *pSong = GAMESTATE->m_pCurSong; - if( pSong && pSong->HasBackground() ) - sPath = pSong->GetBackgroundPath(); - else - sPath = THEME->GetPathToG("Common fallback background"); - } - else if( sFile.CompareNoCase("songbanner")==0 ) - { - const Song *pSong = GAMESTATE->m_pCurSong; - if( pSong && pSong->HasBanner() ) - sPath = pSong->GetBannerPath(); - else - sPath = THEME->GetPathToG("Common fallback banner"); - IsBanner = true; - } - else if( sFile == "" ) - { - HOOKS->MessageBoxOK( ssprintf( - "In the ini file for BGAnimation '%s', '%s' is missing a the line 'File='.", sAniDir.c_str(), sLayer.c_str() ) ); - sPath = THEME->GetPathToG("_missing"); - } - - - /* XXX: Search the BGA dir first, then search the Graphics directory if this - * is a theme BGA, so common BG graphics can be overridden. */ - { - vector asElementPaths; - GetDirListing( sPath + "*", asElementPaths, false, true ); - if(asElementPaths.size() == 0) - { - CString sError = ssprintf("In the ini file for BGAnimation '%s', the specified File '%s' does not exist.", sAniDir.c_str(), sFile.c_str()); - HOOKS->MessageBoxOK( sError ); - LOG->Warn( sError ); - return; - } - if(asElementPaths.size() > 1) - { - CString sError = ssprintf( - "There is more than one file that matches " - "'%s/%s'. Please remove all but one of these matches.", - sAniDir.c_str(), sFile.c_str() ); - HOOKS->MessageBoxOK( sError ); - LOG->Warn( sError ); - } - sPath = asElementPaths[0]; - } - bool Stretch = false; { CString type = "sprite"; @@ -618,19 +558,13 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer ) if( m_fTexCoordVelocityX != 0 || m_fTexCoordVelocityY != 0 ) NeedTextureStretch = true; - if( IsBanner ) - TEXTUREMAN->DisableOddDimensionWarning(); switch( m_Type ) { case TYPE_SPRITE: { - RageTextureID ID(sPath); - if( NeedTextureStretch ) - ID.bStretch = true; - - Actor* pActor = MakeActor( ID ); - m_pActors.push_back( pActor ); + Actor* pActor = LoadFromActorFile( sPathToIni, sLayer ); + m_SubActors.push_back( pActor ); RAGE_ASSERT_M( !(m_bGeneric && Stretch), ssprintf("BGA \"%s\"::%s can't stretch",sAniDir.c_str(),sLayer.c_str()) ); if( !m_bGeneric ) { @@ -643,11 +577,19 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer ) break; case TYPE_PARTICLES: { + CString sFile; + ini.GetValue( sLayer, "File", sFile ); + FixSlashesInPlace( sFile ); + + CString sPath = sAniDir+sFile; + CollapsePath( sPath ); + + ASSERT( !m_bGeneric ); for( int i=0; iSetXY( randomf(float(FullScreenRectI.left),float(FullScreenRectI.right)), randomf(float(FullScreenRectI.top),float(FullScreenRectI.bottom)) ); pActor->SetZoom( randomf(m_fZoomMin,m_fZoomMax) ); @@ -665,6 +607,13 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer ) break; case TYPE_TILES: { + CString sFile; + ini.GetValue( sLayer, "File", sFile ); + FixSlashesInPlace( sFile ); + + CString sPath = sAniDir+sFile; + CollapsePath( sPath ); + ASSERT( !m_bGeneric ); Sprite s; RageTextureID ID(sPath); @@ -680,7 +629,7 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer ) for( unsigned i=0; iLoad( ID ); pSprite->SetTextureWrapping( true ); // gets rid of some "cracks" pSprite->SetZoom( randomf(m_fZoomMin,m_fZoomMax) ); @@ -690,15 +639,13 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer ) default: ASSERT(0); } - if( IsBanner ) - TEXTUREMAN->EnableOddDimensionWarning(); bool bStartOnRandomFrame = false; ini.GetValue( sLayer, "StartOnRandomFrame", bStartOnRandomFrame ); if( bStartOnRandomFrame ) { - for( unsigned i=0; iSetState( rand()%m_pActors[i]->GetNumStates() ); + for( unsigned i=0; iSetState( rand()%m_SubActors[i]->GetNumStates() ); } if( !m_bGeneric ) @@ -709,16 +656,16 @@ float BGAnimationLayer::GetMaxTweenTimeLeft() const { float ret = 0; - for( unsigned i=0; iGetTweenTimeLeft()); + for( unsigned i=0; iGetTweenTimeLeft()); return ret; } void BGAnimationLayer::FinishTweening() { - for( unsigned i=0; iFinishTweening(); + for( unsigned i=0; iFinishTweening(); } void BGAnimationLayer::Update( float fDeltaTime ) @@ -728,18 +675,18 @@ void BGAnimationLayer::Update( float fDeltaTime ) const float fSongBeat = GAMESTATE->m_fSongBeat; unsigned i; - for( i=0; iUpdate( fDeltaTime ); + for( i=0; iUpdate( fDeltaTime ); switch( m_Type ) { case TYPE_SPRITE: - for( i=0; iCommand( ssprintf("StretchTexCoords,%f,%f", + m_SubActors[i]->Command( ssprintf("StretchTexCoords,%f,%f", fDeltaTime*m_fTexCoordVelocityX, fDeltaTime*m_fTexCoordVelocityY) ); } @@ -748,44 +695,44 @@ void BGAnimationLayer::Update( float fDeltaTime ) /* case EFFECT_PARTICLES_SPIRAL_OUT: for( i=0; i SPIRAL_MAX_ZOOM ) - m_pActors[i].SetZoom( SPIRAL_MIN_ZOOM ); + m_SubActors[i].SetZoom( m_SubActors[i].GetZoom() + fDeltaTime ); + if( m_SubActors[i].GetZoom() > SPIRAL_MAX_ZOOM ) + m_SubActors[i].SetZoom( SPIRAL_MIN_ZOOM ); - m_pActors[i].SetRotationZ( m_pActors[i].GetRotationZ() + fDeltaTime ); + m_SubActors[i].SetRotationZ( m_SubActors[i].GetRotationZ() + fDeltaTime ); - float fRadius = (m_pActors[i].GetZoom()-SPIRAL_MIN_ZOOM); + float fRadius = (m_SubActors[i].GetZoom()-SPIRAL_MIN_ZOOM); fRadius *= fRadius; fRadius *= 200; - m_pActors[i].SetX( CENTER_X + cosf(m_pActors[i].GetRotationZ())*fRadius ); - m_pActors[i].SetY( CENTER_Y + sinf(m_pActors[i].GetRotationZ())*fRadius ); + m_SubActors[i].SetX( CENTER_X + cosf(m_SubActors[i].GetRotationZ())*fRadius ); + m_SubActors[i].SetY( CENTER_Y + sinf(m_SubActors[i].GetRotationZ())*fRadius ); } break; case EFFECT_PARTICLES_SPIRAL_IN: for( i=0; iSetX( pActor->GetX() + fDeltaTime*vel.x ); - m_pActors[i]->SetY( pActor->GetY() + fDeltaTime*vel.y ); + m_SubActors[i]->SetX( pActor->GetX() + fDeltaTime*vel.x ); + m_SubActors[i]->SetY( pActor->GetY() + fDeltaTime*vel.y ); pActor->SetZ( pActor->GetZ() + fDeltaTime*vel.z ); if( m_bParticlesBounce ) { @@ -829,7 +776,7 @@ void BGAnimationLayer::Update( float fDeltaTime ) float fTotalWidth = m_iNumTilesWide * m_fTilesSpacingX; float fTotalHeight = m_iNumTilesHigh * m_fTilesSpacingY; - ASSERT( int(m_pActors.size()) == m_iNumTilesWide * m_iNumTilesHigh ); + ASSERT( int(m_SubActors.size()) == m_iNumTilesWide * m_iNumTilesHigh ); for( int x=0; xSetX( fX ); - m_pActors[i]->SetY( fY ); + m_SubActors[i]->SetX( fX ); + m_SubActors[i]->SetY( fY ); } } /* for( i=0; iSetZoom( sinf( fSongBeat*PI/2 ) ); + for( i=0; iSetZoom( sinf( fSongBeat*PI/2 ) ); break; default: @@ -888,7 +835,7 @@ void BGAnimationLayer::Update( float fDeltaTime ) m_TweenStartTime -= fDeltaTime; if(m_TweenStartTime <= 0) // if we've gone past the magic point... show the beast.... { - // m_pActors[0].SetXY( m_TweenX, m_TweenY); + // m_SubActors[0].SetXY( m_TweenX, m_TweenY); // WHAT WOULD BE NICE HERE: // Set the Sprite Tweening To m_TweenX and m_TweenY @@ -912,25 +859,25 @@ void BGAnimationLayer::Update( float fDeltaTime ) { if(m_TweenPassedY != 1) // Check to see if we still need to Tween Along the Y Axis { - if(m_pActors[0].GetY() < m_TweenY) // it needs to travel down + if(m_SubActors[0].GetY() < m_TweenY) // it needs to travel down { // Speed = Distance / Time.... // Take away from the current position... the distance it has to travel divided by the time they want it done in... - m_pActors[0].SetY(m_pActors[0].GetY() + ((m_TweenY - m_PosY)/(m_TweenSpeed*60))); + m_SubActors[0].SetY(m_SubActors[0].GetY() + ((m_TweenY - m_PosY)/(m_TweenSpeed*60))); - if(m_pActors[0].GetY() > m_TweenY) // passed the location we wanna go to? + if(m_SubActors[0].GetY() > m_TweenY) // passed the location we wanna go to? { - m_pActors[0].SetY(m_TweenY); // set it to the exact location we want + m_SubActors[0].SetY(m_TweenY); // set it to the exact location we want m_TweenPassedY = 1; // say we passed it. } } else // travelling up { - m_pActors[0].SetY(m_pActors[0].GetY() - ((m_TweenY + m_PosY)/(m_TweenSpeed*60))); + m_SubActors[0].SetY(m_SubActors[0].GetY() - ((m_TweenY + m_PosY)/(m_TweenSpeed*60))); - if(m_pActors[0].GetY() < m_TweenY) + if(m_SubActors[0].GetY() < m_TweenY) { - m_pActors[0].SetY(m_TweenY); + m_SubActors[0].SetY(m_TweenY); m_TweenPassedY = 1; } } @@ -938,21 +885,21 @@ void BGAnimationLayer::Update( float fDeltaTime ) if(m_TweenPassedX != 1) // Check to see if we still need to Tween Along the X Axis { - if(m_pActors[0].GetX() < m_TweenX) // it needs to travel right + if(m_SubActors[0].GetX() < m_TweenX) // it needs to travel right { - m_pActors[0].SetX(m_pActors[0].GetX() + ((m_TweenX - m_PosX)/(m_TweenSpeed*60))); - if(m_pActors[0].GetX() > m_TweenX) + m_SubActors[0].SetX(m_SubActors[0].GetX() + ((m_TweenX - m_PosX)/(m_TweenSpeed*60))); + if(m_SubActors[0].GetX() > m_TweenX) { - m_pActors[0].SetX(m_TweenX); + m_SubActors[0].SetX(m_TweenX); m_TweenPassedX = 1; } } else // travelling left { - m_pActors[0].SetX(m_pActors[0].GetX() - ((m_TweenX + m_PosX)/(m_TweenSpeed*60))); - if(m_pActors[0].GetX() < m_TweenX) + m_SubActors[0].SetX(m_SubActors[0].GetX() - ((m_TweenX + m_PosX)/(m_TweenSpeed*60))); + if(m_SubActors[0].GetX() < m_TweenX) { - m_pActors[0].SetX(m_TweenX); + m_SubActors[0].SetX(m_TweenX); m_TweenPassedX = 1; } } @@ -969,7 +916,7 @@ void BGAnimationLayer::Update( float fDeltaTime ) m_ShowTime -= fDeltaTime; if(m_ShowTime <= 0) // if we've gone past the magic point... show the beast.... { - m_pActors[0].SetDiffuse( RageColor(1,1,1,1) ); + m_SubActors[0].SetDiffuse( RageColor(1,1,1,1) ); } } if(m_HideTime != 0 && !(m_HideTime < 0)) // make sure it's not 0 or less than 0... @@ -977,7 +924,7 @@ void BGAnimationLayer::Update( float fDeltaTime ) m_HideTime -= fDeltaTime; if(m_HideTime <= 0) // if we've gone past the magic point... hide the beast.... { - m_pActors[0].SetDiffuse( RageColor(0,0,0,0) ); + m_SubActors[0].SetDiffuse( RageColor(0,0,0,0) ); } } @@ -994,7 +941,7 @@ void BGAnimationLayer::Update( float fDeltaTime ) } } -void BGAnimationLayer::Draw() +void BGAnimationLayer::DrawPrimitives() { if( m_fFOV != -1 ) { @@ -1013,8 +960,7 @@ void BGAnimationLayer::Draw() RageVector3(0,0,1) ); } - for( unsigned i=0; iDraw(); + ActorFrame::DrawPrimitives(); if( m_fFOV != -1 ) { @@ -1030,15 +976,15 @@ void BGAnimationLayer::Draw() void BGAnimationLayer::SetDiffuse( RageColor c ) { - for(unsigned i=0; iSetDiffuse(c); + for(unsigned i=0; iSetDiffuse(c); } void BGAnimationLayer::GainingFocus( float fRate, bool bRewindMovie, bool bLoop ) { m_fUpdateRate = fRate; - if( !m_pActors.size() ) + if( !m_SubActors.size() ) return; // @@ -1048,10 +994,10 @@ void BGAnimationLayer::GainingFocus( float fRate, bool bRewindMovie, bool bLoop // potentially pause the movie again). // if( bRewindMovie ) - m_pActors[0]->Command( "position,0" ); - m_pActors[0]->Command( ssprintf("loop,%i",bLoop) ); - m_pActors[0]->Command( "play" ); - m_pActors[0]->Command( ssprintf("rate,%f",fRate) ); + m_SubActors[0]->Command( "position,0" ); + m_SubActors[0]->Command( ssprintf("loop,%i",bLoop) ); + m_SubActors[0]->Command( "play" ); + m_SubActors[0]->Command( ssprintf("rate,%f",fRate) ); if( m_fRepeatCommandEverySeconds == -1 ) // if not repeating PlayCommand( "On" ); @@ -1059,18 +1005,18 @@ void BGAnimationLayer::GainingFocus( float fRate, bool bRewindMovie, bool bLoop void BGAnimationLayer::LosingFocus() { - if( !m_pActors.size() ) + if( !m_SubActors.size() ) return; - m_pActors[0]->Command( "pause" ); + m_SubActors[0]->Command( "pause" ); } void BGAnimationLayer::PlayCommand( CString cmd ) { unsigned i; - for( i=0; iCommand( ssprintf("playcommand,%s", cmd.c_str()) ); + for( i=0; iCommand( ssprintf("playcommand,%s", cmd.c_str()) ); cmd.MakeLower(); map::const_iterator it = m_asCommands.find( cmd ); @@ -1078,6 +1024,6 @@ void BGAnimationLayer::PlayCommand( CString cmd ) if( it == m_asCommands.end() ) return; - for( i=0; iCommand( it->second ); + for( i=0; iCommand( it->second ); } diff --git a/stepmania/src/BGAnimationLayer.h b/stepmania/src/BGAnimationLayer.h index 557476decb..49c2965e0c 100644 --- a/stepmania/src/BGAnimationLayer.h +++ b/stepmania/src/BGAnimationLayer.h @@ -12,11 +12,11 @@ ----------------------------------------------------------------------------- */ -#include "RageTypes.h" -#include "Sprite.h" #include "GameConstantsAndTypes.h" +#include "ActorFrame.h" +#include -class BGAnimationLayer +class BGAnimationLayer : public ActorFrame { public: BGAnimationLayer( bool Generic ); @@ -31,7 +31,7 @@ public: void LoadFromIni( CString sDir, CString sLayer ); void Update( float fDeltaTime ); - void Draw(); + void DrawPrimitives(); void SetDiffuse( RageColor c ); @@ -44,7 +44,6 @@ public: void PlayOffCommand() { PlayCommand( "Off" ); } protected: - vector m_pActors; vector m_vParticleVelocity; enum Effect {