no message
This commit is contained in:
@@ -22,6 +22,8 @@ const CString VIS_DIR = "Visualizations\\";
|
|||||||
|
|
||||||
Background::Background()
|
Background::Background()
|
||||||
{
|
{
|
||||||
|
m_fSongBeat = 0;
|
||||||
|
|
||||||
m_bShowDanger = false;
|
m_bShowDanger = false;
|
||||||
|
|
||||||
m_sprDanger.SetZoom( 2 );
|
m_sprDanger.SetZoom( 2 );
|
||||||
@@ -31,50 +33,56 @@ Background::Background()
|
|||||||
|
|
||||||
m_sprDangerBackground.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_DANGER_BACKGROUND) );
|
m_sprDangerBackground.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_DANGER_BACKGROUND) );
|
||||||
m_sprDangerBackground.StretchTo( CRect((int)SCREEN_LEFT, (int)SCREEN_TOP, (int)SCREEN_RIGHT, (int)SCREEN_BOTTOM) );
|
m_sprDangerBackground.StretchTo( CRect((int)SCREEN_LEFT, (int)SCREEN_TOP, (int)SCREEN_RIGHT, (int)SCREEN_BOTTOM) );
|
||||||
|
|
||||||
|
// Load background animations
|
||||||
|
for( int i=0; i<NUM_BACKGROUND_ANIMATION_TYPES; i++ )
|
||||||
|
{
|
||||||
|
m_BackgroundAnimations.Add( new BackgroundAnimation( (BackgroundAnimationType)i ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pCurBackgroundAnimation = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations )
|
bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations )
|
||||||
{
|
{
|
||||||
|
// load song background
|
||||||
|
|
||||||
|
CString sBackgroundMoviePath;
|
||||||
if( pSong->HasBackgroundMovie() )
|
if( pSong->HasBackgroundMovie() )
|
||||||
{
|
{
|
||||||
// load the movie backgound, and don't load a visualization
|
|
||||||
m_sprSongBackground.Load( pSong->GetBackgroundMoviePath() );
|
m_sprSongBackground.Load( pSong->GetBackgroundMoviePath() );
|
||||||
m_sprSongBackground.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) );
|
m_sprSongBackground.SetZoomY( -1 ); // flip
|
||||||
m_sprSongBackground.SetZoomY( -1 );
|
}
|
||||||
m_sprSongBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) );
|
else if( pSong->HasBackground() )
|
||||||
this->AddActor( &m_sprSongBackground );
|
{
|
||||||
|
m_sprSongBackground.Load( pSong->GetBackgroundPath(), false, 2, 0, true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// load the static background (if available), and a visualization
|
m_sprSongBackground.Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND), false, 2, 0, true );
|
||||||
if( pSong->HasBackground() ) m_sprSongBackground.Load( pSong->GetBackgroundPath(), false, 2, 0, true );
|
}
|
||||||
else m_sprSongBackground.Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND), false, 2, 0, true );
|
|
||||||
|
|
||||||
m_sprSongBackground.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) );
|
m_sprSongBackground.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) );
|
||||||
m_sprSongBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) );
|
m_sprSongBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) );
|
||||||
this->AddActor( &m_sprSongBackground );
|
|
||||||
|
|
||||||
|
|
||||||
if( PREFSMAN->m_bUseRandomVis && !bDisableVisualizations )
|
if( PREFSMAN->m_visMode == VIS_MODE_MOVIE && !bDisableVisualizations )
|
||||||
|
{
|
||||||
|
// load a random visualization
|
||||||
|
CStringArray sVisualizationNames;
|
||||||
|
GetDirListing( VIS_DIR + "*.avi", sVisualizationNames );
|
||||||
|
GetDirListing( VIS_DIR + "*.mpg", sVisualizationNames );
|
||||||
|
GetDirListing( VIS_DIR + "*.mpeg", sVisualizationNames );
|
||||||
|
if( sVisualizationNames.GetSize() > 0 ) // there is at least one visualization
|
||||||
{
|
{
|
||||||
// load a random visualization
|
int iIndexRandom = rand() % sVisualizationNames.GetSize();
|
||||||
CStringArray sVisualizationPaths;
|
|
||||||
GetDirListing( VIS_DIR + "*.avi", sVisualizationPaths );
|
|
||||||
GetDirListing( VIS_DIR + "*.mpg", sVisualizationPaths );
|
|
||||||
GetDirListing( VIS_DIR + "*.mpeg", sVisualizationPaths );
|
|
||||||
if( sVisualizationPaths.GetSize() > 0 ) // there is at least one visualization
|
|
||||||
{
|
|
||||||
int iIndexRandom = rand() % sVisualizationPaths.GetSize();
|
|
||||||
|
|
||||||
m_sprVisualizationOverlay.Load( VIS_DIR + sVisualizationPaths[iIndexRandom] );
|
m_sprVisualizationOverlay.Load( VIS_DIR + sVisualizationNames[iIndexRandom] );
|
||||||
|
m_sprVisualizationOverlay.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) );
|
||||||
|
m_sprVisualizationOverlay.SetZoomY( m_sprVisualizationOverlay.GetZoomY()*-1 );
|
||||||
m_sprVisualizationOverlay.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) );
|
m_sprVisualizationOverlay.SetBlendModeAdd();
|
||||||
m_sprVisualizationOverlay.SetZoomY( m_sprVisualizationOverlay.GetZoomY()*-1 );
|
m_sprVisualizationOverlay.SetDiffuseColor( D3DXCOLOR(0,0,0,0) );
|
||||||
m_sprVisualizationOverlay.SetBlendModeAdd();
|
this->AddActor( &m_sprVisualizationOverlay );
|
||||||
m_sprVisualizationOverlay.SetDiffuseColor( D3DXCOLOR(0,0,0,0) );
|
|
||||||
this->AddActor( &m_sprVisualizationOverlay );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,6 +93,40 @@ void Background::Update( float fDeltaTime )
|
|||||||
{
|
{
|
||||||
ActorFrame::Update( fDeltaTime );
|
ActorFrame::Update( fDeltaTime );
|
||||||
|
|
||||||
|
if( m_fSongBeat < 8 )
|
||||||
|
m_pCurBackgroundAnimation = NULL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int iIndexToSwitchTo = int(m_fSongBeat/BEATS_PER_MEASURE/2) % m_BackgroundAnimations.GetSize();
|
||||||
|
m_pCurBackgroundAnimation = m_BackgroundAnimations[ iIndexToSwitchTo ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( DangerVisible() )
|
||||||
|
{
|
||||||
|
m_sprDangerBackground.Update( fDeltaTime );
|
||||||
|
m_sprDanger.Update( fDeltaTime );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch( PREFSMAN->m_visMode )
|
||||||
|
{
|
||||||
|
case VIS_MODE_ANIMATION:
|
||||||
|
if( m_pCurBackgroundAnimation )
|
||||||
|
m_pCurBackgroundAnimation->Update( fDeltaTime, m_fSongBeat );
|
||||||
|
else
|
||||||
|
m_sprSongBackground.Update( fDeltaTime );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIS_MODE_MOVIE:
|
||||||
|
m_sprVisualizationOverlay.Update( fDeltaTime );
|
||||||
|
// fall through and draw background
|
||||||
|
|
||||||
|
case VIS_MODE_NONE:
|
||||||
|
m_sprSongBackground.Update( fDeltaTime );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
m_sprVisualizationOverlay.Update( fDeltaTime );
|
m_sprVisualizationOverlay.Update( fDeltaTime );
|
||||||
m_sprSongBackground.Update( fDeltaTime );
|
m_sprSongBackground.Update( fDeltaTime );
|
||||||
m_sprDanger.Update( fDeltaTime );
|
m_sprDanger.Update( fDeltaTime );
|
||||||
@@ -95,17 +137,36 @@ void Background::DrawPrimitives()
|
|||||||
{
|
{
|
||||||
ActorFrame::DrawPrimitives();
|
ActorFrame::DrawPrimitives();
|
||||||
|
|
||||||
if( m_bShowDanger && (TIMER->GetTimeSinceStart() - (int)TIMER->GetTimeSinceStart()) > 0.5f )
|
if( DangerVisible() )
|
||||||
{
|
{
|
||||||
m_sprDangerBackground.Draw();
|
m_sprDangerBackground.Draw();
|
||||||
m_sprDanger.Draw();
|
m_sprDanger.Draw();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
switch( PREFSMAN->m_visMode )
|
||||||
|
{
|
||||||
|
case VIS_MODE_ANIMATION:
|
||||||
|
if( m_pCurBackgroundAnimation )
|
||||||
|
m_pCurBackgroundAnimation->DrawPrimitives();
|
||||||
|
else
|
||||||
|
m_sprSongBackground.Draw();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIS_MODE_MOVIE:
|
||||||
|
m_sprVisualizationOverlay.Draw();
|
||||||
|
// fall through and draw background
|
||||||
|
|
||||||
|
case VIS_MODE_NONE:
|
||||||
|
m_sprSongBackground.Draw();
|
||||||
|
break;
|
||||||
|
}
|
||||||
m_sprSongBackground.Draw();
|
m_sprSongBackground.Draw();
|
||||||
m_sprVisualizationOverlay.Draw();
|
m_sprVisualizationOverlay.Draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Background::DangerVisible()
|
||||||
|
{
|
||||||
|
return m_bShowDanger && (TIMER->GetTimeSinceStart() - (int)TIMER->GetTimeSinceStart()) > 0.5f;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
/*
|
/*
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
File: Background.h
|
Class: Background
|
||||||
|
|
||||||
Desc: Background behind arrows while dancing
|
Desc: Background behind notes while playing.
|
||||||
|
|
||||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Ben Nordstrom
|
||||||
|
Chris Danford
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _Background_H_
|
|
||||||
#define _Background_H_
|
|
||||||
|
|
||||||
|
|
||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
#include "ActorFrame.h"
|
#include "ActorFrame.h"
|
||||||
#include "Song.h"
|
#include "Song.h"
|
||||||
|
#include "BackgroundAnimation.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Background : public ActorFrame
|
class Background : public ActorFrame
|
||||||
@@ -27,8 +29,11 @@ public:
|
|||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives();
|
||||||
|
|
||||||
|
void SetSongBeat( const float fSongBeat ) { m_fSongBeat = fSongBeat; };
|
||||||
|
|
||||||
virtual void SetDiffuseColor( D3DXCOLOR c )
|
virtual void SetDiffuseColor( D3DXCOLOR c )
|
||||||
{
|
{
|
||||||
|
m_sprSongBackground.SetDiffuseColor( c );
|
||||||
m_sprVisualizationOverlay.SetDiffuseColor( c );
|
m_sprVisualizationOverlay.SetDiffuseColor( c );
|
||||||
m_sprSongBackground.SetDiffuseColor( c );
|
m_sprSongBackground.SetDiffuseColor( c );
|
||||||
m_sprDanger.SetDiffuseColor( c );
|
m_sprDanger.SetDiffuseColor( c );
|
||||||
@@ -41,6 +46,11 @@ public:
|
|||||||
virtual bool IsDangerOn() { return m_bShowDanger; };
|
virtual bool IsDangerOn() { return m_bShowDanger; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool DangerVisible();
|
||||||
|
|
||||||
|
CArray<BackgroundAnimation*,BackgroundAnimation*> m_BackgroundAnimations;
|
||||||
|
BackgroundAnimation* m_pCurBackgroundAnimation;
|
||||||
|
|
||||||
Sprite m_sprVisualizationOverlay;
|
Sprite m_sprVisualizationOverlay;
|
||||||
Sprite m_sprSongBackground;
|
Sprite m_sprSongBackground;
|
||||||
|
|
||||||
@@ -48,9 +58,7 @@ protected:
|
|||||||
Sprite m_sprDangerBackground;
|
Sprite m_sprDangerBackground;
|
||||||
|
|
||||||
bool m_bShowDanger;
|
bool m_bShowDanger;
|
||||||
|
|
||||||
|
float m_fSongBeat;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user